aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-06-16 05:27:45 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-16 05:27:45 -0400
commitd939d2851fd12568e2eabb2916769e8a57ba5c89 (patch)
treef3158a5ddd41541a61126f9e48de1ce89c632f64
parent9f5314fb4d556d3132c784d0df47352b2830ca53 (diff)
parent066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff)
Merge branch 'linus' into x86/irq
-rw-r--r--.gitignore2
-rw-r--r--Documentation/ABI/testing/sysfs-class-bdi4
-rw-r--r--Documentation/DocBook/kernel-locking.tmpl25
-rw-r--r--Documentation/SubmittingPatches46
-rw-r--r--Documentation/cciss.txt5
-rw-r--r--Documentation/cgroups.txt4
-rw-r--r--Documentation/cpu-freq/governors.txt8
-rw-r--r--Documentation/cpusets.txt9
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/filesystems/ext4.txt12
-rw-r--r--Documentation/filesystems/sysfs-pci.txt1
-rw-r--r--Documentation/hwmon/adt74733
-rw-r--r--Documentation/hwmon/ibmaem37
-rw-r--r--Documentation/kernel-doc-nano-HOWTO.txt99
-rw-r--r--Documentation/kernel-docs.txt8
-rw-r--r--Documentation/kernel-parameters.txt9
-rw-r--r--Documentation/kobject.txt2
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt2
-rw-r--r--Documentation/lguest/lguest.c12
-rw-r--r--Documentation/memory-barriers.txt12
-rw-r--r--Documentation/networking/arcnet.txt2
-rw-r--r--Documentation/networking/bridge.txt2
-rw-r--r--Documentation/video4linux/CARDLIST.cx238852
-rw-r--r--Documentation/video4linux/CARDLIST.cx882
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx2
-rw-r--r--Documentation/video4linux/cx18.txt4
-rw-r--r--Documentation/vm/pagemap.txt77
-rw-r--r--Kbuild3
-rw-r--r--MAINTAINERS218
-rw-r--r--Makefile7
-rw-r--r--arch/alpha/kernel/init_task.c1
-rw-r--r--arch/arm/boot/compressed/head-xscale.S4
-rw-r--r--arch/arm/common/locomo.c66
-rw-r--r--arch/arm/kernel/armksyms.c2
-rw-r--r--arch/arm/kernel/arthur.c2
-rw-r--r--arch/arm/kernel/init_task.c1
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c21
-rw-r--r--arch/arm/mach-at91/at91x40.c18
-rw-r--r--arch/arm/mach-integrator/impd1.c3
-rw-r--r--arch/arm/mach-integrator/pci_v3.c2
-rw-r--r--arch/arm/mach-omap1/board-palmte.c12
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-apollon.c1
-rw-r--r--arch/arm/mach-omap2/board-generic.c1
-rw-r--r--arch/arm/mach-omap2/board-h4.c1
-rw-r--r--arch/arm/mach-omap2/clock.c4
-rw-r--r--arch/arm/mach-omap2/clock34xx.h21
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h1
-rw-r--r--arch/arm/mach-omap2/mailbox.c25
-rw-r--r--arch/arm/mach-omap2/prm.h2
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c2
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c2
-rw-r--r--arch/arm/mach-pxa/cm-x270.c2
-rw-r--r--arch/arm/mach-pxa/colibri.c3
-rw-r--r--arch/arm/mach-pxa/em-x270.c2
-rw-r--r--arch/arm/mach-pxa/ssp.c2
-rw-r--r--arch/arm/mach-pxa/tosa.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c4
-rw-r--r--arch/arm/mach-sa1100/collie.c42
-rw-r--r--arch/arm/mm/proc-arm925.S2
-rw-r--r--arch/arm/mm/proc-arm926.S2
-rw-r--r--arch/arm/mm/proc-arm940.S2
-rw-r--r--arch/arm/mm/proc-arm946.S2
-rw-r--r--arch/arm/plat-omap/clock.c11
-rw-r--r--arch/arm/plat-omap/dma.c2
-rw-r--r--arch/arm/plat-omap/mailbox.c1
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.c1
-rw-r--r--arch/avr32/configs/atngw100_defconfig336
-rw-r--r--arch/avr32/configs/atstk1002_defconfig241
-rw-r--r--arch/avr32/configs/atstk1003_defconfig158
-rw-r--r--arch/avr32/configs/atstk1004_defconfig110
-rw-r--r--arch/avr32/kernel/avr32_ksyms.c4
-rw-r--r--arch/avr32/kernel/init_task.c1
-rw-r--r--arch/avr32/mach-at32ap/cpufreq.c3
-rw-r--r--arch/blackfin/Kconfig12
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig348
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig416
-rw-r--r--arch/blackfin/configs/IP0X_defconfig2
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c11
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c19
-rw-r--r--arch/blackfin/kernel/bfin_ksyms.c2
-rw-r--r--arch/blackfin/kernel/gptimers.c2
-rw-r--r--arch/blackfin/kernel/init_task.c1
-rw-r--r--arch/blackfin/kernel/traps.c24
-rw-r--r--arch/blackfin/lib/checksum.c21
-rw-r--r--arch/blackfin/lib/ins.S21
-rw-r--r--arch/blackfin/lib/outs.S16
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c15
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c6
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c34
-rw-r--r--arch/blackfin/mach-bf537/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf537/boards/led.S183
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c9
-rw-r--r--arch/blackfin/mach-bf548/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf548/boards/cm_bf548.c2
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c10
-rw-r--r--arch/blackfin/mach-bf548/boards/led.S172
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c9
-rw-r--r--arch/cris/kernel/process.c1
-rw-r--r--arch/frv/kernel/cmode.S2
-rw-r--r--arch/frv/kernel/init_task.c1
-rw-r--r--arch/frv/kernel/sleep.S2
-rw-r--r--arch/frv/mb93090-mb00/pci-dma-nommu.c2
-rw-r--r--arch/frv/mm/init.c3
-rw-r--r--arch/h8300/kernel/init_task.c1
-rw-r--r--arch/ia64/Kconfig13
-rw-r--r--arch/ia64/Makefile2
-rw-r--r--arch/ia64/ia32/ia32_support.c10
-rw-r--r--arch/ia64/kernel/acpi.c19
-rw-r--r--arch/ia64/kernel/entry.S26
-rw-r--r--arch/ia64/kernel/init_task.c1
-rw-r--r--arch/ia64/kernel/ivt.S84
-rw-r--r--arch/ia64/kernel/minstate.h46
-rw-r--r--arch/ia64/kernel/palinfo.c6
-rw-r--r--arch/ia64/kernel/patch.c23
-rw-r--r--arch/ia64/kernel/perfmon.c16
-rw-r--r--arch/ia64/kernel/process.c25
-rw-r--r--arch/ia64/kernel/sal.c11
-rw-r--r--arch/ia64/kernel/setup.c40
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S7
-rw-r--r--arch/ia64/kvm/Makefile3
-rw-r--r--arch/ia64/kvm/memcpy.S1
-rw-r--r--arch/ia64/kvm/memset.S1
-rw-r--r--arch/ia64/kvm/mmio.c3
-rw-r--r--arch/ia64/mm/init.c25
-rw-r--r--arch/ia64/uv/Makefile12
-rw-r--r--arch/ia64/uv/kernel/Makefile13
-rw-r--r--arch/ia64/uv/kernel/machvec.c11
-rw-r--r--arch/ia64/uv/kernel/setup.c98
-rw-r--r--arch/m32r/kernel/init_task.c1
-rw-r--r--arch/m68k/Kconfig9
-rw-r--r--arch/m68k/configs/amiga_defconfig161
-rw-r--r--arch/m68k/configs/apollo_defconfig142
-rw-r--r--arch/m68k/configs/atari_defconfig145
-rw-r--r--arch/m68k/configs/bvme6000_defconfig140
-rw-r--r--arch/m68k/configs/hp300_defconfig144
-rw-r--r--arch/m68k/configs/mac_defconfig146
-rw-r--r--arch/m68k/configs/multi_defconfig1269
-rw-r--r--arch/m68k/configs/mvme147_defconfig140
-rw-r--r--arch/m68k/configs/mvme16x_defconfig140
-rw-r--r--arch/m68k/configs/q40_defconfig161
-rw-r--r--arch/m68k/configs/sun3_defconfig142
-rw-r--r--arch/m68k/configs/sun3x_defconfig142
-rw-r--r--arch/m68k/kernel/head.S2
-rw-r--r--arch/m68k/kernel/process.c1
-rw-r--r--arch/m68k/kernel/setup.c15
-rw-r--r--arch/m68k/lib/string.c6
-rw-r--r--arch/m68knommu/Kconfig3
-rw-r--r--arch/m68knommu/kernel/init_task.c1
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S10
-rw-r--r--arch/m68knommu/platform/coldfire/timers.c8
-rw-r--r--arch/mips/au1000/common/Makefile7
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c145
-rw-r--r--arch/mips/au1000/common/clocks.c25
-rw-r--r--arch/mips/au1000/common/cputable.c5
-rw-r--r--arch/mips/au1000/common/dbdma.c400
-rw-r--r--arch/mips/au1000/common/dbg_io.c32
-rw-r--r--arch/mips/au1000/common/dma.c56
-rw-r--r--arch/mips/au1000/common/gpio.c6
-rw-r--r--arch/mips/au1000/common/irq.c6
-rw-r--r--arch/mips/au1000/common/pci.c11
-rw-r--r--arch/mips/au1000/common/platform.c11
-rw-r--r--arch/mips/au1000/common/power.c157
-rw-r--r--arch/mips/au1000/common/prom.c21
-rw-r--r--arch/mips/au1000/common/puts.c35
-rw-r--r--arch/mips/au1000/common/reset.c33
-rw-r--r--arch/mips/au1000/common/setup.c60
-rw-r--r--arch/mips/au1000/common/time.c78
-rw-r--r--arch/mips/au1000/db1x00/Makefile8
-rw-r--r--arch/mips/au1000/db1x00/board_setup.c61
-rw-r--r--arch/mips/au1000/db1x00/init.c11
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c22
-rw-r--r--arch/mips/au1000/mtx-1/Makefile3
-rw-r--r--arch/mips/au1000/mtx-1/board_setup.c63
-rw-r--r--arch/mips/au1000/mtx-1/init.c11
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c18
-rw-r--r--arch/mips/au1000/mtx-1/platform.c3
-rw-r--r--arch/mips/au1000/pb1000/Makefile8
-rw-r--r--arch/mips/au1000/pb1000/board_setup.c117
-rw-r--r--arch/mips/au1000/pb1000/init.c20
-rw-r--r--arch/mips/au1000/pb1100/Makefile6
-rw-r--r--arch/mips/au1000/pb1100/board_setup.c50
-rw-r--r--arch/mips/au1000/pb1100/init.c11
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c10
-rw-r--r--arch/mips/au1000/pb1200/Makefile2
-rw-r--r--arch/mips/au1000/pb1200/board_setup.c139
-rw-r--r--arch/mips/au1000/pb1200/init.c18
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c66
-rw-r--r--arch/mips/au1000/pb1500/Makefile6
-rw-r--r--arch/mips/au1000/pb1500/board_setup.c46
-rw-r--r--arch/mips/au1000/pb1500/init.c20
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c6
-rw-r--r--arch/mips/au1000/pb1550/Makefile7
-rw-r--r--arch/mips/au1000/pb1550/board_setup.c16
-rw-r--r--arch/mips/au1000/pb1550/init.c20
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c6
-rw-r--r--arch/mips/au1000/xxs1500/Makefile3
-rw-r--r--arch/mips/au1000/xxs1500/board_setup.c39
-rw-r--r--arch/mips/au1000/xxs1500/init.c11
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c2
-rw-r--r--arch/mips/emma2rh/markeins/setup.c7
-rw-r--r--arch/mips/kernel/Makefile3
-rw-r--r--arch/mips/kernel/cpu-bugs64.c2
-rw-r--r--arch/mips/kernel/init_task.c1
-rw-r--r--arch/mips/kernel/irixelf.c11
-rw-r--r--arch/mips/kernel/kspd.c5
-rw-r--r--arch/mips/kernel/rtlx.c65
-rw-r--r--arch/mips/kernel/setup.c1
-rw-r--r--arch/mips/kernel/smp.c4
-rw-r--r--arch/mips/kernel/traps.c16
-rw-r--r--arch/mips/kernel/vpe.c29
-rw-r--r--arch/mips/mips-boards/generic/time.c19
-rw-r--r--arch/mips/mm/highmem.c1
-rw-r--r--arch/mips/mm/page.c10
-rw-r--r--arch/mips/mm/tlbex.c3
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c6
-rw-r--r--arch/mips/pci/fixup-au1000.c7
-rw-r--r--arch/mips/pci/ops-au1000.c115
-rw-r--r--arch/mips/pci/ops-bridge.c20
-rw-r--r--arch/mips/pci/pci-ip27.c8
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-init.c22
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c117
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c31
-rw-r--r--arch/mn10300/boot/install.sh16
-rw-r--r--arch/mn10300/kernel/init_task.c1
-rw-r--r--arch/parisc/kernel/Makefile3
-rw-r--r--arch/parisc/kernel/entry.S46
-rw-r--r--arch/parisc/kernel/head.S3
-rw-r--r--arch/parisc/kernel/init_task.c1
-rw-r--r--arch/parisc/kernel/inventory.c2
-rw-r--r--arch/parisc/kernel/pacache.S70
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c3
-rw-r--r--arch/parisc/kernel/perf_asm.S2
-rw-r--r--arch/parisc/kernel/signal32.c4
-rw-r--r--arch/parisc/kernel/traps.c2
-rw-r--r--arch/parisc/kernel/unaligned.c5
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S1
-rw-r--r--arch/parisc/lib/memcpy.c2
-rw-r--r--arch/parisc/mm/init.c5
-rw-r--r--arch/powerpc/boot/.gitignore8
-rw-r--r--arch/powerpc/boot/4xx.c21
-rw-r--r--arch/powerpc/boot/Makefile10
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts35
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts70
-rw-r--r--arch/powerpc/boot/dts/sbc8548.dts94
-rw-r--r--arch/powerpc/configs/chrp32_defconfig164
-rw-r--r--arch/powerpc/configs/g5_defconfig226
-rw-r--r--arch/powerpc/configs/iseries_defconfig146
-rw-r--r--arch/powerpc/configs/mpc8610_hpcd_defconfig95
-rw-r--r--arch/powerpc/configs/pasemi_defconfig172
-rw-r--r--arch/powerpc/configs/pmac32_defconfig174
-rw-r--r--arch/powerpc/configs/ppc64_defconfig236
-rw-r--r--arch/powerpc/configs/pseries_defconfig224
-rw-r--r--arch/powerpc/kernel/Makefile6
-rw-r--r--arch/powerpc/kernel/cputable.c2
-rw-r--r--arch/powerpc/kernel/init_task.c1
-rw-r--r--arch/powerpc/kernel/pci_64.c2
-rw-r--r--arch/powerpc/kernel/prom_init_check.sh2
-rw-r--r--arch/powerpc/kernel/signal_64.c4
-rw-r--r--arch/powerpc/kvm/44x_tlb.c9
-rw-r--r--arch/powerpc/kvm/booke_guest.c33
-rw-r--r--arch/powerpc/kvm/emulate.c12
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/mm/hash_low_32.S2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c28
-rw-r--r--arch/powerpc/mm/init_64.c10
-rw-r--r--arch/powerpc/mm/mem.c3
-rw-r--r--arch/powerpc/mm/pgtable_32.c2
-rw-r--r--arch/powerpc/mm/slb.c16
-rw-r--r--arch/powerpc/mm/slb_low.S16
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c14
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c121
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c30
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c15
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c5
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.c6
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.h6
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c2
-rw-r--r--arch/powerpc/platforms/pasemi/misc.c7
-rw-r--r--arch/powerpc/platforms/ps3/mm.c3
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c20
-rw-r--r--arch/ppc/Makefile2
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c3
-rw-r--r--arch/ppc/kernel/setup.c1
-rw-r--r--arch/ppc/platforms/residual.c1
-rw-r--r--arch/s390/Kconfig4
-rw-r--r--arch/s390/appldata/appldata_base.c8
-rw-r--r--arch/s390/defconfig11
-rw-r--r--arch/s390/kernel/debug.c20
-rw-r--r--arch/s390/kernel/dis.c2
-rw-r--r--arch/s390/kernel/init_task.c1
-rw-r--r--arch/s390/kernel/irq.c3
-rw-r--r--arch/s390/kernel/smp.c20
-rw-r--r--arch/s390/kvm/diag.c2
-rw-r--r--arch/s390/kvm/interrupt.c7
-rw-r--r--arch/s390/kvm/kvm-s390.c13
-rw-r--r--arch/s390/mm/init.c49
-rw-r--r--arch/s390/mm/pgtable.c44
-rw-r--r--arch/s390/mm/vmem.c5
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/Kconfig.debug2
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c39
-rw-r--r--arch/sh/configs/migor_defconfig294
-rw-r--r--arch/sh/configs/rsk7203_defconfig841
-rw-r--r--arch/sh/configs/se7206_defconfig475
-rw-r--r--arch/sh/drivers/heartbeat.c2
-rw-r--r--arch/sh/kernel/cpu/irq/intc-sh5.c1
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c1
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c49
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c9
-rw-r--r--arch/sh/kernel/entry-common.S12
-rw-r--r--arch/sh/kernel/head_32.S4
-rw-r--r--arch/sh/kernel/init_task.c1
-rw-r--r--arch/sh/kernel/kgdb_stub.c19
-rw-r--r--arch/sh/kernel/module.c39
-rw-r--r--arch/sh/kernel/setup.c11
-rw-r--r--arch/sh/kernel/traps.c10
-rw-r--r--arch/sh/lib/memcpy-sh4.S22
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/boot/Makefile1
-rw-r--r--arch/sparc/boot/btfixupprep.c2
-rw-r--r--arch/sparc/boot/piggyback.c2
-rw-r--r--arch/sparc/kernel/ebus.c2
-rw-r--r--arch/sparc/kernel/etrap.S2
-rw-r--r--arch/sparc/kernel/head.S2
-rw-r--r--arch/sparc/kernel/idprom.c2
-rw-r--r--arch/sparc/kernel/init_task.c1
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/irq.c2
-rw-r--r--arch/sparc/kernel/led.c34
-rw-r--r--arch/sparc/kernel/muldiv.c2
-rw-r--r--arch/sparc/kernel/rtrap.S4
-rw-r--r--arch/sparc/kernel/setup.c2
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c2
-rw-r--r--arch/sparc/kernel/sun4d_irq.c2
-rw-r--r--arch/sparc/kernel/sys_sparc.c48
-rw-r--r--arch/sparc/kernel/trampoline.S2
-rw-r--r--arch/sparc/kernel/traps.c2
-rw-r--r--arch/sparc/kernel/unaligned.c2
-rw-r--r--arch/sparc/kernel/wof.S2
-rw-r--r--arch/sparc/kernel/wuf.S2
-rw-r--r--arch/sparc/lib/Makefile1
-rw-r--r--arch/sparc/lib/ashldi3.S2
-rw-r--r--arch/sparc/lib/ashrdi3.S2
-rw-r--r--arch/sparc/lib/blockops.S2
-rw-r--r--arch/sparc/lib/locks.S2
-rw-r--r--arch/sparc/lib/lshrdi3.S1
-rw-r--r--arch/sparc/lib/memscan.S2
-rw-r--r--arch/sparc/lib/mul.S2
-rw-r--r--arch/sparc/lib/rem.S2
-rw-r--r--arch/sparc/lib/rwsem.S2
-rw-r--r--arch/sparc/lib/sdiv.S2
-rw-r--r--arch/sparc/lib/strncmp.S2
-rw-r--r--arch/sparc/lib/udiv.S2
-rw-r--r--arch/sparc/lib/umul.S2
-rw-r--r--arch/sparc/lib/urem.S2
-rw-r--r--arch/sparc/math-emu/ashldi3.S2
-rw-r--r--arch/sparc/mm/Makefile1
-rw-r--r--arch/sparc/mm/fault.c2
-rw-r--r--arch/sparc/mm/generic.c2
-rw-r--r--arch/sparc/mm/hypersparc.S2
-rw-r--r--arch/sparc/mm/init.c2
-rw-r--r--arch/sparc/mm/io-unit.c2
-rw-r--r--arch/sparc/mm/loadmmu.c2
-rw-r--r--arch/sparc/mm/nosrmmu.c2
-rw-r--r--arch/sparc/mm/nosun4c.c2
-rw-r--r--arch/sparc/mm/swift.S2
-rw-r--r--arch/sparc/mm/tsunami.S2
-rw-r--r--arch/sparc/mm/viking.S2
-rw-r--r--arch/sparc/prom/Makefile1
-rw-r--r--arch/sparc/prom/bootstr.c2
-rw-r--r--arch/sparc/prom/console.c2
-rw-r--r--arch/sparc/prom/devmap.c2
-rw-r--r--arch/sparc/prom/devops.c2
-rw-r--r--arch/sparc/prom/init.c2
-rw-r--r--arch/sparc/prom/misc.c2
-rw-r--r--arch/sparc/prom/mp.c2
-rw-r--r--arch/sparc/prom/palloc.c2
-rw-r--r--arch/sparc/prom/ranges.c2
-rw-r--r--arch/sparc/prom/segment.c2
-rw-r--r--arch/sparc/prom/tree.c2
-rw-r--r--arch/sparc64/Makefile1
-rw-r--r--arch/sparc64/boot/Makefile1
-rw-r--r--arch/sparc64/boot/piggyback.c2
-rw-r--r--arch/sparc64/defconfig40
-rw-r--r--arch/sparc64/kernel/dtlb_prot.S2
-rw-r--r--arch/sparc64/kernel/ebus.c2
-rw-r--r--arch/sparc64/kernel/etrap.S2
-rw-r--r--arch/sparc64/kernel/idprom.c2
-rw-r--r--arch/sparc64/kernel/init_task.c1
-rw-r--r--arch/sparc64/kernel/process.c153
-rw-r--r--arch/sparc64/kernel/rtrap.S9
-rw-r--r--arch/sparc64/kernel/sbus.c2
-rw-r--r--arch/sparc64/kernel/setup.c2
-rw-r--r--arch/sparc64/kernel/signal.c23
-rw-r--r--arch/sparc64/kernel/signal32.c13
-rw-r--r--arch/sparc64/kernel/smp.c10
-rw-r--r--arch/sparc64/kernel/stacktrace.c12
-rw-r--r--arch/sparc64/kernel/starfire.c2
-rw-r--r--arch/sparc64/kernel/sys32.S2
-rw-r--r--arch/sparc64/kernel/sys_sparc.c36
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c33
-rw-r--r--arch/sparc64/kernel/trampoline.S2
-rw-r--r--arch/sparc64/kernel/traps.c12
-rw-r--r--arch/sparc64/kernel/unaligned.c2
-rw-r--r--arch/sparc64/lib/PeeCeeI.c2
-rw-r--r--arch/sparc64/lib/VISsave.S2
-rw-r--r--arch/sparc64/lib/memcmp.S2
-rw-r--r--arch/sparc64/lib/memscan.S2
-rw-r--r--arch/sparc64/lib/strncmp.S2
-rw-r--r--arch/sparc64/lib/strncpy_from_user.S2
-rw-r--r--arch/sparc64/math-emu/math.c2
-rw-r--r--arch/sparc64/math-emu/sfp-util.h2
-rw-r--r--arch/sparc64/mm/Makefile1
-rw-r--r--arch/sparc64/mm/fault.c2
-rw-r--r--arch/sparc64/mm/generic.c2
-rw-r--r--arch/sparc64/mm/init.c20
-rw-r--r--arch/sparc64/mm/ultra.S31
-rw-r--r--arch/sparc64/prom/Makefile1
-rw-r--r--arch/sparc64/prom/bootstr.c2
-rw-r--r--arch/sparc64/prom/devops.c2
-rw-r--r--arch/sparc64/prom/init.c2
-rw-r--r--arch/sparc64/prom/misc.c2
-rw-r--r--arch/sparc64/prom/p1275.c2
-rw-r--r--arch/sparc64/prom/tree.c2
-rw-r--r--arch/um/Kconfig2
-rw-r--r--arch/um/Kconfig.char6
-rw-r--r--arch/um/drivers/chan_user.c1
-rw-r--r--arch/um/drivers/cow_sys.h2
-rw-r--r--arch/um/drivers/daemon_user.c4
-rw-r--r--arch/um/drivers/fd.c2
-rw-r--r--arch/um/drivers/hostaudio_kern.c2
-rw-r--r--arch/um/drivers/mcast_user.c3
-rw-r--r--arch/um/drivers/net_user.c2
-rw-r--r--arch/um/drivers/pcap_user.c2
-rw-r--r--arch/um/drivers/port_user.c2
-rw-r--r--arch/um/drivers/pty.c2
-rw-r--r--arch/um/drivers/random.c122
-rw-r--r--arch/um/drivers/slip_user.c2
-rw-r--r--arch/um/drivers/tty.c2
-rw-r--r--arch/um/drivers/ubd_kern.c5
-rw-r--r--arch/um/drivers/xterm.c2
-rw-r--r--arch/um/include/as-layout.h14
-rw-r--r--arch/um/include/line.h4
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/include/process.h20
-rw-r--r--arch/um/include/skas_ptrace.h13
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h30
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h2
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace_user.h17
-rw-r--r--arch/um/include/um_malloc.h9
-rw-r--r--arch/um/kernel/dyn.lds.S7
-rw-r--r--arch/um/kernel/init_task.c1
-rw-r--r--arch/um/kernel/ksyms.c5
-rw-r--r--arch/um/kernel/mem.c5
-rw-r--r--arch/um/kernel/time.c4
-rw-r--r--arch/um/kernel/um_arch.c9
-rw-r--r--arch/um/kernel/uml.lds.S7
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c4
-rw-r--r--arch/um/os-Linux/helper.c5
-rw-r--r--arch/um/os-Linux/main.c2
-rw-r--r--arch/um/os-Linux/sigio.c39
-rw-r--r--arch/um/os-Linux/signal.c1
-rw-r--r--arch/um/os-Linux/skas/process.c4
-rw-r--r--arch/um/os-Linux/start_up.c106
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c6
-rw-r--r--arch/um/os-Linux/sys-i386/task_size.c31
-rw-r--r--arch/um/os-Linux/sys-x86_64/task_size.c2
-rw-r--r--arch/um/os-Linux/time.c61
-rw-r--r--arch/um/sys-i386/ptrace.c30
-rw-r--r--arch/um/sys-i386/user-offsets.c2
-rw-r--r--arch/um/sys-x86_64/ksyms.c10
-rw-r--r--arch/um/sys-x86_64/user-offsets.c1
-rw-r--r--arch/v850/kernel/init_task.c1
-rw-r--r--arch/x86/Kconfig24
-rw-r--r--arch/x86/Kconfig.debug20
-rw-r--r--arch/x86/boot/a20.c3
-rw-r--r--arch/x86/boot/printf.c2
-rw-r--r--arch/x86/kernel/acpi/boot.c16
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.lds.S10
-rw-r--r--arch/x86/kernel/apic_64.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longrun.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c15
-rw-r--r--arch/x86/kernel/entry_32.S1
-rw-r--r--arch/x86/kernel/head_32.S2
-rw-r--r--arch/x86/kernel/i387.c44
-rw-r--r--arch/x86/kernel/init_task.c1
-rw-r--r--arch/x86/kernel/io_apic_32.c12
-rw-r--r--arch/x86/kernel/kvmclock.c4
-rw-r--r--arch/x86/kernel/mfgpt_32.c2
-rw-r--r--arch/x86/kernel/nmi_32.c9
-rw-r--r--arch/x86/kernel/pci-dma.c20
-rw-r--r--arch/x86/kernel/pci-gart_64.c31
-rw-r--r--arch/x86/kernel/process.c36
-rw-r--r--arch/x86/kernel/process_32.c5
-rw-r--r--arch/x86/kernel/process_64.c5
-rw-r--r--arch/x86/kernel/ptrace.c7
-rw-r--r--arch/x86/kernel/rtc.c34
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/kernel/setup_64.c2
-rw-r--r--arch/x86/kernel/smp.c3
-rw-r--r--arch/x86/kernel/smpboot.c29
-rw-r--r--arch/x86/kernel/traps_32.c1
-rw-r--r--arch/x86/kernel/tsc_32.c25
-rw-r--r--arch/x86/kernel/tsc_64.c5
-rw-r--r--arch/x86/kernel/x8664_ksyms_64.c3
-rw-r--r--arch/x86/kvm/i8254.c16
-rw-r--r--arch/x86/kvm/irq.c6
-rw-r--r--arch/x86/kvm/irq.h2
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/mmu.c5
-rw-r--r--arch/x86/kvm/paging_tmpl.h2
-rw-r--r--arch/x86/kvm/svm.c2
-rw-r--r--arch/x86/kvm/vmx.c3
-rw-r--r--arch/x86/kvm/x86.c2
-rw-r--r--arch/x86/kvm/x86_emulate.c10
-rw-r--r--arch/x86/lguest/boot.c5
-rw-r--r--arch/x86/lib/csum-partial_64.c2
-rw-r--r--arch/x86/lib/delay_32.c31
-rw-r--r--arch/x86/lib/delay_64.c30
-rw-r--r--arch/x86/math-emu/fpu_entry.c13
-rw-r--r--arch/x86/mm/fault.c5
-rw-r--r--arch/x86/mm/init_32.c12
-rw-r--r--arch/x86/mm/init_64.c6
-rw-r--r--arch/x86/mm/ioremap.c5
-rw-r--r--arch/x86/mm/pat.c57
-rw-r--r--arch/x86/mm/srat_64.c27
-rw-r--r--arch/x86/pci/common.c16
-rw-r--r--arch/x86/pci/i386.c4
-rw-r--r--arch/x86/pci/init.c3
-rw-r--r--arch/x86/pci/irq.c7
-rw-r--r--arch/x86/pci/olpc.c5
-rw-r--r--arch/x86/pci/pci.h2
-rw-r--r--arch/x86/vdso/vclock_gettime.c6
-rw-r--r--arch/x86/xen/mmu.c2
-rw-r--r--arch/x86/xen/time.c13
-rw-r--r--arch/xtensa/kernel/init_task.c1
-rw-r--r--block/blk-core.c42
-rw-r--r--block/blk-settings.c8
-rw-r--r--block/blktrace.c31
-rw-r--r--block/cfq-iosched.c36
-rw-r--r--block/compat_ioctl.c2
-rw-r--r--block/elevator.c2
-rw-r--r--block/genhd.c11
-rw-r--r--crypto/cts.c6
-rw-r--r--drivers/acpi/bay.c16
-rw-r--r--drivers/acpi/dispatcher/dsfield.c5
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c2
-rw-r--r--drivers/acpi/dock.c2
-rw-r--r--drivers/acpi/ec.c2
-rw-r--r--drivers/acpi/executer/exconfig.c10
-rw-r--r--drivers/acpi/executer/exmutex.c4
-rw-r--r--drivers/acpi/glue.c6
-rw-r--r--drivers/acpi/hardware/hwsleep.c8
-rw-r--r--drivers/acpi/numa.c31
-rw-r--r--drivers/acpi/parser/psargs.c4
-rw-r--r--drivers/acpi/processor_core.c1
-rw-r--r--drivers/acpi/processor_idle.c13
-rw-r--r--drivers/acpi/sleep/proc.c6
-rw-r--r--drivers/acpi/system.c15
-rw-r--r--drivers/acpi/tables/tbinstal.c25
-rw-r--r--drivers/acpi/tables/tbxface.c2
-rw-r--r--drivers/acpi/thermal.c11
-rw-r--r--drivers/acpi/utilities/utmisc.c2
-rw-r--r--drivers/ata/ahci.c145
-rw-r--r--drivers/ata/ata_piix.c9
-rw-r--r--drivers/ata/libata-acpi.c150
-rw-r--r--drivers/ata/libata-core.c42
-rw-r--r--drivers/ata/libata-eh.c207
-rw-r--r--drivers/ata/libata-pmp.c51
-rw-r--r--drivers/ata/libata-scsi.c9
-rw-r--r--drivers/ata/libata-sff.c115
-rw-r--r--drivers/ata/pata_ali.c10
-rw-r--r--drivers/ata/pata_amd.c14
-rw-r--r--drivers/ata/pata_at32.c2
-rw-r--r--drivers/ata/pata_bf54x.c5
-rw-r--r--drivers/ata/pata_cypress.c8
-rw-r--r--drivers/ata/pata_icside.c2
-rw-r--r--drivers/ata/pata_legacy.c50
-rw-r--r--drivers/ata/pata_ns87410.c6
-rw-r--r--drivers/ata/pata_ns87415.c4
-rw-r--r--drivers/ata/pata_qdi.c16
-rw-r--r--drivers/ata/pata_rb532_cf.c4
-rw-r--r--drivers/ata/pata_scc.c5
-rw-r--r--drivers/ata/pata_sl82c105.c2
-rw-r--r--drivers/ata/pata_via.c14
-rw-r--r--drivers/ata/pata_winbond.c6
-rw-r--r--drivers/ata/sata_fsl.c224
-rw-r--r--drivers/ata/sata_mv.c258
-rw-r--r--drivers/ata/sata_promise.c148
-rw-r--r--drivers/ata/sata_sil24.c11
-rw-r--r--drivers/atm/eni.h1
-rw-r--r--drivers/atm/fore200e.h1
-rw-r--r--drivers/atm/fore200e_mkfirm.c2
-rw-r--r--drivers/atm/he.h2
-rw-r--r--drivers/atm/idt77252.c7
-rw-r--r--drivers/atm/idt77252.h4
-rw-r--r--drivers/atm/iphase.h3
-rw-r--r--drivers/atm/nicstarmac.copyright2
-rw-r--r--drivers/base/class.c1
-rw-r--r--drivers/base/core.c109
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/block/amiflop.c6
-rw-r--r--drivers/block/brd.c2
-rw-r--r--drivers/block/cciss.c21
-rw-r--r--drivers/block/viodasd.c2
-rw-r--r--drivers/block/virtio_blk.c7
-rw-r--r--drivers/block/z2ram.c2
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/Kconfig13
-rw-r--r--drivers/char/agp/ati-agp.c4
-rw-r--r--drivers/char/drm/drm.h17
-rw-r--r--drivers/char/drm/drmP.h91
-rw-r--r--drivers/char/drm/drm_fops.c7
-rw-r--r--drivers/char/drm/drm_irq.c381
-rw-r--r--drivers/char/drm/drm_lock.c35
-rw-r--r--drivers/char/drm/drm_sysfs.c2
-rw-r--r--drivers/char/drm/i915_dma.c160
-rw-r--r--drivers/char/drm/i915_drm.h45
-rw-r--r--drivers/char/drm/i915_drv.c23
-rw-r--r--drivers/char/drm/i915_drv.h115
-rw-r--r--drivers/char/drm/i915_irq.c597
-rw-r--r--drivers/char/drm/mga_drv.c7
-rw-r--r--drivers/char/drm/mga_drv.h6
-rw-r--r--drivers/char/drm/mga_irq.c69
-rw-r--r--drivers/char/drm/r128_drv.c7
-rw-r--r--drivers/char/drm/r128_drv.h9
-rw-r--r--drivers/char/drm/r128_irq.c55
-rw-r--r--drivers/char/drm/radeon_drv.c8
-rw-r--r--drivers/char/drm/radeon_drv.h19
-rw-r--r--drivers/char/drm/radeon_irq.c171
-rw-r--r--drivers/char/drm/via_drv.c6
-rw-r--r--drivers/char/drm/via_drv.h7
-rw-r--r--drivers/char/drm/via_irq.c81
-rw-r--r--drivers/char/generic_nvram.c2
-rw-r--r--drivers/char/hw_random/Kconfig9
-rw-r--r--drivers/char/hw_random/Makefile1
-rw-r--r--drivers/char/hw_random/intel-rng.c2
-rw-r--r--drivers/char/hw_random/virtio-rng.c155
-rw-r--r--drivers/char/ip2/Makefile4
-rw-r--r--drivers/char/ip2/ip2main.c23
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c10
-rw-r--r--drivers/char/keyboard.c7
-rw-r--r--drivers/char/n_tty.c13
-rw-r--r--drivers/char/pcmcia/ipwireless/hardware.c20
-rw-r--r--drivers/char/snsc_event.c2
-rw-r--r--drivers/char/synclink_gt.c2
-rw-r--r--drivers/char/sysrq.c1
-rw-r--r--drivers/char/tty_io.c7
-rw-r--r--drivers/char/viocons.c2
-rw-r--r--drivers/char/viotape.c2
-rw-r--r--drivers/char/vme_scc.c4
-rw-r--r--drivers/char/vt.c15
-rw-r--r--drivers/cpufreq/cpufreq.c10
-rw-r--r--drivers/cpufreq/freq_table.c5
-rw-r--r--drivers/cpuidle/cpuidle.c40
-rw-r--r--drivers/dma/iop-adma.c6
-rw-r--r--drivers/edac/mpc85xx_edac.c3
-rw-r--r--drivers/firewire/fw-cdev.c14
-rw-r--r--drivers/firmware/edd.c2
-rw-r--r--drivers/gpio/gpiolib.c6
-rw-r--r--drivers/gpio/mcp23s08.c2
-rw-r--r--drivers/gpio/pca953x.c1
-rw-r--r--drivers/hid/hid-debug.c2
-rw-r--r--drivers/hid/hid-input.c7
-rw-r--r--drivers/hid/usbhid/hid-quirks.c49
-rw-r--r--drivers/hid/usbhid/usbkbd.c2
-rw-r--r--drivers/hid/usbhid/usbmouse.c2
-rw-r--r--drivers/hwmon/Kconfig14
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/hdaps.c2
-rw-r--r--drivers/hwmon/i5k_amb.c39
-rw-r--r--drivers/hwmon/ibmaem.c1111
-rw-r--r--drivers/i2c/busses/i2c-amd756.c2
-rw-r--r--drivers/i2c/busses/i2c-au1550.c2
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c28
-rw-r--r--drivers/i2c/chips/max6875.c3
-rw-r--r--drivers/i2c/i2c-core.c22
-rw-r--r--drivers/ide/Kconfig55
-rw-r--r--drivers/ide/arm/bast-ide.c1
-rw-r--r--drivers/ide/arm/ide_arm.c1
-rw-r--r--drivers/ide/arm/palm_bk3710.c3
-rw-r--r--drivers/ide/ide-generic.c10
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/ide/ide-pnp.c1
-rw-r--r--drivers/ide/ide-probe.c11
-rw-r--r--drivers/ide/ide-proc.c1
-rw-r--r--drivers/ide/legacy/buddha.c2
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c6
-rw-r--r--drivers/ide/legacy/ide-cs.c41
-rw-r--r--drivers/ide/legacy/macide.c5
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/mips/swarm.c16
-rw-r--r--drivers/ide/pci/alim15x3.c42
-rw-r--r--drivers/ide/pci/cmd640.c2
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/delkin_cb.c28
-rw-r--r--drivers/ide/pci/opti621.c221
-rw-r--r--drivers/ide/pci/sis5513.c5
-rw-r--r--drivers/ide/ppc/mpc8xx.c4
-rw-r--r--drivers/ide/ppc/pmac.c60
-rw-r--r--drivers/ieee1394/sbp2.c20
-rw-r--r--drivers/infiniband/core/mad.c4
-rw-r--r--drivers/infiniband/core/umem.c2
-rw-r--r--drivers/infiniband/core/user_mad.c14
-rw-r--r--drivers/infiniband/core/uverbs_main.c11
-rw-r--r--drivers/infiniband/hw/amso1100/c2_rnic.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c4
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_qp.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_reqs.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c20
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c19
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h15
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c237
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c285
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c329
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sdma.c16
-rw-r--r--drivers/infiniband/hw/ipath/ipath_uc.c61
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c66
-rw-r--r--drivers/infiniband/hw/ipath/ipath_user_sdma.h2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c179
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h64
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c15
-rw-r--r--drivers/infiniband/hw/mthca/mthca_main.c14
-rw-r--r--drivers/infiniband/hw/nes/nes.c4
-rw-r--r--drivers/infiniband/hw/nes/nes.h1
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c6
-rw-r--r--drivers/input/keyboard/aaed2000_kbd.c2
-rw-r--r--drivers/input/keyboard/atkbd.c2
-rw-r--r--drivers/input/keyboard/corgikbd.c2
-rw-r--r--drivers/input/keyboard/hilkbd.c4
-rw-r--r--drivers/input/keyboard/jornada680_kbd.c2
-rw-r--r--drivers/input/keyboard/jornada720_kbd.c2
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c38
-rw-r--r--drivers/input/keyboard/spitzkbd.c2
-rw-r--r--drivers/input/misc/apanel.c1
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c5
-rw-r--r--drivers/input/serio/hp_sdc_mlc.c5
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h7
-rw-r--r--drivers/input/serio/i8042.c33
-rw-r--r--drivers/input/serio/q40kbd.c2
-rw-r--r--drivers/input/tablet/gtco.c17
-rw-r--r--drivers/input/touchscreen/jornada720_ts.c2
-rw-r--r--drivers/input/touchscreen/wm9713.c22
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c25
-rw-r--r--drivers/isdn/capi/capiutil.c6
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c1
-rw-r--r--drivers/isdn/hardware/eicon/divasproc.c4
-rw-r--r--drivers/isdn/hysdn/Kconfig2
-rw-r--r--drivers/isdn/hysdn/boardergo.c14
-rw-r--r--drivers/isdn/hysdn/hycapi.c6
-rw-r--r--drivers/isdn/hysdn/hysdn_procconf.c29
-rw-r--r--drivers/isdn/sc/ioctl.c1
-rw-r--r--drivers/leds/led-class.c6
-rw-r--r--drivers/lguest/lguest_device.c25
-rw-r--r--drivers/macintosh/adb.c2
-rw-r--r--drivers/macintosh/mediabay.c3
-rw-r--r--drivers/md/bitmap.c17
-rw-r--r--drivers/md/linear.c1
-rw-r--r--drivers/md/md.c81
-rw-r--r--drivers/md/multipath.c4
-rw-r--r--drivers/md/raid0.c1
-rw-r--r--drivers/md/raid1.c33
-rw-r--r--drivers/md/raid10.c18
-rw-r--r--drivers/md/raid5.c80
-rw-r--r--drivers/media/Kconfig3
-rw-r--r--drivers/media/Makefile7
-rw-r--r--drivers/media/common/tuners/Kconfig51
-rw-r--r--drivers/media/common/tuners/Makefile1
-rw-r--r--drivers/media/common/tuners/mxl5005s.c4110
-rw-r--r--drivers/media/common/tuners/mxl5005s.h131
-rw-r--r--drivers/media/common/tuners/tda18271-common.c28
-rw-r--r--drivers/media/common/tuners/tda18271-fe.c168
-rw-r--r--drivers/media/common/tuners/tda18271-priv.h9
-rw-r--r--drivers/media/common/tuners/tda827x.c4
-rw-r--r--drivers/media/common/tuners/tea5761.c2
-rw-r--r--drivers/media/common/tuners/tea5767.c6
-rw-r--r--drivers/media/common/tuners/tuner-i2c.h8
-rw-r--r--drivers/media/common/tuners/tuner-simple.c6
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c87
-rw-r--r--drivers/media/common/tuners/xc5000.c9
-rw-r--r--drivers/media/common/tuners/xc5000.h22
-rw-r--r--drivers/media/common/tuners/xc5000_priv.h2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-fe-tuner.c2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-usb.c2
-rw-r--r--drivers/media/dvb/bt8xx/Kconfig1
-rw-r--r--drivers/media/dvb/cinergyT2/Kconfig2
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c46
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ca_en50221.c28
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c12
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig3
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c2
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c10
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c7
-rw-r--r--drivers/media/dvb/frontends/Kconfig18
-rw-r--r--drivers/media/dvb/frontends/dib0070.h15
-rw-r--r--drivers/media/dvb/frontends/dib7000p.h15
-rw-r--r--drivers/media/dvb/frontends/itd1000.c2
-rw-r--r--drivers/media/dvb/frontends/mt312.c9
-rw-r--r--drivers/media/dvb/frontends/mt312.h4
-rw-r--r--drivers/media/dvb/frontends/or51132.c6
-rw-r--r--drivers/media/dvb/ttpci/Kconfig2
-rw-r--r--drivers/media/dvb/ttpci/av7110.c9
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c34
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c2
-rw-r--r--drivers/media/dvb/ttusb-dec/Kconfig3
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c25
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusbdecfe.c10
-rw-r--r--drivers/media/video/Kconfig12
-rw-r--r--drivers/media/video/Makefile2
-rw-r--r--drivers/media/video/au0828/Kconfig3
-rw-r--r--drivers/media/video/au0828/au0828-dvb.c12
-rw-r--r--drivers/media/video/bt8xx/Kconfig3
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c5
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-risc.c8
-rw-r--r--drivers/media/video/btcx-risc.c2
-rw-r--r--drivers/media/video/btcx-risc.h4
-rw-r--r--drivers/media/video/cs5345.c7
-rw-r--r--drivers/media/video/cs53l32a.c10
-rw-r--r--drivers/media/video/cx18/Kconfig5
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c81
-rw-r--r--drivers/media/video/cx18/cx18-cards.c27
-rw-r--r--drivers/media/video/cx18/cx18-cards.h5
-rw-r--r--drivers/media/video/cx18/cx18-controls.c6
-rw-r--r--drivers/media/video/cx18/cx18-driver.c55
-rw-r--r--drivers/media/video/cx18/cx18-driver.h12
-rw-r--r--drivers/media/video/cx18/cx18-dvb.c40
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c19
-rw-r--r--drivers/media/video/cx18/cx18-fileops.h9
-rw-r--r--drivers/media/video/cx18/cx18-gpio.c48
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c10
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c12
-rw-r--r--drivers/media/video/cx18/cx18-irq.c12
-rw-r--r--drivers/media/video/cx18/cx18-mailbox.c8
-rw-r--r--drivers/media/video/cx18/cx18-queue.c22
-rw-r--r--drivers/media/video/cx18/cx18-queue.h4
-rw-r--r--drivers/media/video/cx18/cx18-streams.c50
-rw-r--r--drivers/media/video/cx18/cx18-streams.h2
-rw-r--r--drivers/media/video/cx23885/Kconfig6
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c36
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c8
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c7
-rw-r--r--drivers/media/video/cx25840/Kconfig1
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c7
-rw-r--r--drivers/media/video/cx88/Kconfig6
-rw-r--r--drivers/media/video/cx88/cx88-cards.c13
-rw-r--r--drivers/media/video/cx88/cx88-core.c8
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c253
-rw-r--r--drivers/media/video/em28xx/Kconfig3
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c8
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c2
-rw-r--r--drivers/media/video/ivtv/Kconfig4
-rw-r--r--drivers/media/video/ivtv/ivtv-controls.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c8
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h10
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c13
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c16
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.h6
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.c8
-rw-r--r--drivers/media/video/ivtv/ivtv-queue.c14
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c43
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-vbi.c3
-rw-r--r--drivers/media/video/ivtv/ivtv-version.h4
-rw-r--r--drivers/media/video/ivtv/ivtv-yuv.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-yuv.h2
-rw-r--r--drivers/media/video/ivtv/ivtvfb.c6
-rw-r--r--drivers/media/video/m52790.c9
-rw-r--r--drivers/media/video/msp3400-driver.c17
-rw-r--r--drivers/media/video/mt9m001.c5
-rw-r--r--drivers/media/video/mt9v022.c7
-rw-r--r--drivers/media/video/pvrusb2/Kconfig4
-rw-r--r--drivers/media/video/saa7115.c40
-rw-r--r--drivers/media/video/saa7127.c9
-rw-r--r--drivers/media/video/saa7134/Kconfig3
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c140
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c3
-rw-r--r--drivers/media/video/saa717x.c9
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c2
-rw-r--r--drivers/media/video/stk-webcam.c7
-rw-r--r--drivers/media/video/tuner-core.c103
-rw-r--r--drivers/media/video/tveeprom.c10
-rw-r--r--drivers/media/video/upd64031a.c6
-rw-r--r--drivers/media/video/upd64083.c6
-rw-r--r--drivers/media/video/usbvideo/quickcam_messenger.c2
-rw-r--r--drivers/media/video/usbvision/Kconfig2
-rw-r--r--drivers/media/video/videobuf-core.c3
-rw-r--r--drivers/media/video/vp27smpx.c9
-rw-r--r--drivers/media/video/wm8739.c7
-rw-r--r--drivers/media/video/wm8775.c7
-rw-r--r--drivers/media/video/zc0301/zc0301_core.c2
-rw-r--r--drivers/media/video/zoran.h4
-rw-r--r--drivers/media/video/zoran_device.c4
-rw-r--r--drivers/media/video/zoran_driver.c12
-rw-r--r--drivers/message/fusion/mptfc.c2
-rw-r--r--drivers/message/fusion/mptsas.c2
-rw-r--r--drivers/message/fusion/mptscsih.c8
-rw-r--r--drivers/mfd/Kconfig2
-rw-r--r--drivers/misc/fujitsu-laptop.c6
-rw-r--r--drivers/misc/kgdbts.c33
-rw-r--r--drivers/misc/sgi-xp/xp.h305
-rw-r--r--drivers/misc/sgi-xp/xp_main.c44
-rw-r--r--drivers/misc/sgi-xp/xpc.h83
-rw-r--r--drivers/misc/sgi-xp/xpc_channel.c186
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c60
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c74
-rw-r--r--drivers/misc/sgi-xp/xpnet.c22
-rw-r--r--drivers/misc/thinkpad_acpi.c496
-rw-r--r--drivers/mmc/card/Kconfig12
-rw-r--r--drivers/mmc/card/Makefile1
-rw-r--r--drivers/mmc/card/block.c2
-rw-r--r--drivers/mmc/card/mmc_test.c892
-rw-r--r--drivers/mmc/host/Kconfig2
-rw-r--r--drivers/mmc/host/at91_mci.c5
-rw-r--r--drivers/mmc/host/omap.c12
-rw-r--r--drivers/mmc/host/sdhci.h2
-rw-r--r--drivers/mmc/host/wbsd.c21
-rw-r--r--drivers/mtd/devices/m25p80.c4
-rw-r--r--drivers/mtd/maps/ck804xrom.c18
-rw-r--r--drivers/mtd/maps/omap_nor.c2
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c2
-rw-r--r--drivers/mtd/onenand/generic.c2
-rw-r--r--drivers/mtd/redboot.c2
-rw-r--r--drivers/net/3c509.c17
-rw-r--r--drivers/net/7990.c6
-rw-r--r--drivers/net/82596.c7
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/apne.c3
-rw-r--r--drivers/net/atlx/atl1.c157
-rw-r--r--drivers/net/atlx/atl1.h2
-rw-r--r--drivers/net/atlx/atlx.c2
-rw-r--r--drivers/net/atlx/atlx.h7
-rw-r--r--drivers/net/au1000_eth.c7
-rw-r--r--drivers/net/bfin_mac.c1
-rw-r--r--drivers/net/bnx2.c9
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/bnx2x.c5
-rw-r--r--drivers/net/bnx2x.h3
-rw-r--r--drivers/net/bnx2x_init.h3
-rw-r--r--drivers/net/bonding/bond_sysfs.c12
-rw-r--r--drivers/net/cassini.c11
-rw-r--r--drivers/net/cpmac.c234
-rw-r--r--drivers/net/cs89x0.c10
-rw-r--r--drivers/net/cxgb3/adapter.h1
-rw-r--r--drivers/net/cxgb3/common.h1
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c40
-rw-r--r--drivers/net/cxgb3/regs.h8
-rw-r--r--drivers/net/cxgb3/sge.c29
-rw-r--r--drivers/net/cxgb3/t3_hw.c28
-rw-r--r--drivers/net/dm9000.c37
-rw-r--r--drivers/net/e1000e/netdev.c4
-rw-r--r--drivers/net/ehea/ehea.h27
-rw-r--r--drivers/net/ehea/ehea_main.c49
-rw-r--r--drivers/net/ehea/ehea_qmr.c286
-rw-r--r--drivers/net/fec_mpc52xx.c2
-rw-r--r--drivers/net/forcedeth.c21
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c2
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/hamradio/baycom_epp.c2
-rw-r--r--drivers/net/hamradio/scc.c3
-rw-r--r--drivers/net/ipg.c4
-rw-r--r--drivers/net/irda/Kconfig1
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/irda/irda-usb.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c4
-rw-r--r--drivers/net/mac89x0.c3
-rw-r--r--drivers/net/macmace.c3
-rw-r--r--drivers/net/myri10ge/myri10ge.c732
-rw-r--r--drivers/net/myri10ge/myri10ge_mcp.h56
-rw-r--r--drivers/net/myri10ge/myri10ge_mcp_gen_header.h39
-rw-r--r--drivers/net/niu.c53
-rw-r--r--drivers/net/niu.h9
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c4
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c12
-rw-r--r--drivers/net/pcnet32.c4
-rw-r--r--drivers/net/phy/Kconfig2
-rw-r--r--drivers/net/phy/phy_device.c1
-rw-r--r--drivers/net/ppp_generic.c1
-rw-r--r--drivers/net/pppoe.c37
-rw-r--r--drivers/net/pppol2tp.c157
-rw-r--r--drivers/net/ps3_gelic_wireless.c2
-rw-r--r--drivers/net/r6040.c2
-rw-r--r--drivers/net/s2io-regs.h2
-rw-r--r--drivers/net/s2io.c496
-rw-r--r--drivers/net/s2io.h22
-rw-r--r--drivers/net/sb1250-mac.c67
-rw-r--r--drivers/net/sc92031.c8
-rw-r--r--drivers/net/sfc/Makefile4
-rw-r--r--drivers/net/sfc/bitfield.h7
-rw-r--r--drivers/net/sfc/boards.c9
-rw-r--r--drivers/net/sfc/boards.h2
-rw-r--r--drivers/net/sfc/efx.c88
-rw-r--r--drivers/net/sfc/enum.h49
-rw-r--r--drivers/net/sfc/ethtool.c259
-rw-r--r--drivers/net/sfc/falcon.c97
-rw-r--r--drivers/net/sfc/falcon.h5
-rw-r--r--drivers/net/sfc/falcon_hwdefs.h20
-rw-r--r--drivers/net/sfc/falcon_io.h29
-rw-r--r--drivers/net/sfc/falcon_xmac.c92
-rw-r--r--drivers/net/sfc/mdio_10g.c78
-rw-r--r--drivers/net/sfc/mdio_10g.h24
-rw-r--r--drivers/net/sfc/net_driver.h72
-rw-r--r--drivers/net/sfc/rx.c59
-rw-r--r--drivers/net/sfc/selftest.c719
-rw-r--r--drivers/net/sfc/selftest.h50
-rw-r--r--drivers/net/sfc/sfe4001.c28
-rw-r--r--drivers/net/sfc/tenxpress.c93
-rw-r--r--drivers/net/sfc/tx.c669
-rw-r--r--drivers/net/sfc/workarounds.h2
-rw-r--r--drivers/net/sfc/xfp_phy.c38
-rw-r--r--drivers/net/sky2.c31
-rw-r--r--drivers/net/sky2.h4
-rw-r--r--drivers/net/smc911x.c24
-rw-r--r--drivers/net/smc91x.c17
-rw-r--r--drivers/net/smc91x.h8
-rw-r--r--drivers/net/sun3lance.c3
-rw-r--r--drivers/net/sunhme.c4
-rw-r--r--drivers/net/tg3.c33
-rw-r--r--drivers/net/tokenring/3c359.h2
-rw-r--r--drivers/net/tokenring/olympic.h2
-rw-r--r--drivers/net/tulip/tulip_core.c12
-rw-r--r--drivers/net/tulip/uli526x.c16
-rw-r--r--drivers/net/ucc_geth.c9
-rw-r--r--drivers/net/ucc_geth_ethtool.c3
-rw-r--r--drivers/net/usb/asix.c4
-rw-r--r--drivers/net/usb/catc.c5
-rw-r--r--drivers/net/usb/cdc_subset.c2
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/rndis_host.c6
-rw-r--r--drivers/net/virtio_net.c91
-rw-r--r--drivers/net/wan/Kconfig4
-rw-r--r--drivers/net/wan/cosa.c14
-rw-r--r--drivers/net/wan/hdlc.c19
-rw-r--r--drivers/net/wan/hdlc_cisco.c82
-rw-r--r--drivers/net/wan/hdlc_ppp.c2
-rw-r--r--drivers/net/wan/hostess_sv11.c12
-rw-r--r--drivers/net/wan/lmc/lmc_main.c1
-rw-r--r--drivers/net/wan/sealevel.c1
-rw-r--r--drivers/net/wireless/airo.c3
-rw-r--r--drivers/net/wireless/ath5k/base.c2
-rw-r--r--drivers/net/wireless/ath5k/hw.c6
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/b43/Kconfig2
-rw-r--r--drivers/net/wireless/b43/b43.h1
-rw-r--r--drivers/net/wireless/b43/main.c70
-rw-r--r--drivers/net/wireless/b43legacy/Kconfig2
-rw-r--r--drivers/net/wireless/b43legacy/main.c17
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c9
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c8
-rw-r--r--drivers/net/wireless/ipw2200.c204
-rw-r--r--drivers/net/wireless/ipw2200.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/libertas/cmd.c5
-rw-r--r--drivers/net/wireless/libertas/debugfs.c4
-rw-r--r--drivers/net/wireless/libertas/ethtool.c27
-rw-r--r--drivers/net/wireless/libertas/main.c4
-rw-r--r--drivers/net/wireless/orinoco_cs.c1
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/prism54/islpci_dev.c11
-rw-r--r--drivers/net/wireless/rndis_wlan.c65
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c19
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c31
-rw-r--r--drivers/net/wireless/rtl8180_grf5101.c2
-rw-r--r--drivers/net/wireless/rtl8180_max2820.c5
-rw-r--r--drivers/net/wireless/rtl8180_sa2400.c2
-rw-r--r--drivers/net/wireless/rtl8187_dev.c14
-rw-r--r--drivers/net/wireless/strip.c2
-rw-r--r--drivers/net/wireless/wavelan.c4
-rw-r--r--drivers/net/wireless/wavelan_cs.c6
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c8
-rw-r--r--drivers/net/xen-netfront.c6
-rw-r--r--drivers/of/base.c3
-rw-r--r--drivers/of/of_i2c.c1
-rw-r--r--drivers/oprofile/cpu_buffer.c2
-rw-r--r--drivers/oprofile/cpu_buffer.h2
-rw-r--r--drivers/parisc/asp.c2
-rw-r--r--drivers/parisc/ccio-dma.c36
-rw-r--r--drivers/parisc/dino.c14
-rw-r--r--drivers/parisc/gsc.c4
-rw-r--r--drivers/parisc/lasi.c2
-rw-r--r--drivers/parisc/lba_pci.c22
-rw-r--r--drivers/parisc/led.c2
-rw-r--r--drivers/parisc/sba_iommu.c42
-rw-r--r--drivers/parisc/wax.c2
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c7
-rw-r--r--drivers/pci/hotplug/pciehp.h11
-rw-r--r--drivers/pci/hotplug/pciehp_core.c6
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c36
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c129
-rw-r--r--drivers/pci/hotplug/rpadlpar_sysfs.c8
-rw-r--r--drivers/pci/hotplug/shpchp_core.c4
-rw-r--r--drivers/pci/intel-iommu.c6
-rw-r--r--drivers/pci/pci-acpi.c109
-rw-r--r--drivers/pci/pci-driver.c2
-rw-r--r--drivers/pci/pci-sysfs.c85
-rw-r--r--drivers/pci/pcie/aspm.c20
-rw-r--r--drivers/pci/quirks.c4
-rw-r--r--drivers/pcmcia/electra_cf.c1
-rw-r--r--drivers/pnp/base.h1
-rw-r--r--drivers/pnp/interface.c2
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c46
-rw-r--r--drivers/pnp/quirks.c133
-rw-r--r--drivers/pnp/resource.c2
-rw-r--r--drivers/pnp/support.c8
-rw-r--r--drivers/pnp/system.c2
-rw-r--r--drivers/power/power_supply_core.c6
-rw-r--r--drivers/power/power_supply_sysfs.c2
-rw-r--r--drivers/rtc/Kconfig19
-rw-r--r--drivers/rtc/Makefile2
-rw-r--r--drivers/rtc/rtc-at32ap700x.c7
-rw-r--r--drivers/rtc/rtc-cmos.c31
-rw-r--r--drivers/rtc/rtc-ds1374.c2
-rw-r--r--drivers/rtc/rtc-fm3130.c501
-rw-r--r--drivers/rtc/rtc-lib.c2
-rw-r--r--drivers/rtc/rtc-m41t80.c3
-rw-r--r--drivers/rtc/rtc-ppc.c69
-rw-r--r--drivers/s390/block/dasd.c33
-rw-r--r--drivers/s390/block/dasd_devmap.c10
-rw-r--r--drivers/s390/block/dasd_int.h2
-rw-r--r--drivers/s390/char/raw3270.c9
-rw-r--r--drivers/s390/char/sclp_config.c2
-rw-r--r--drivers/s390/char/sclp_vt220.c28
-rw-r--r--drivers/s390/char/tape.h3
-rw-r--r--drivers/s390/char/tape_3590.c2
-rw-r--r--drivers/s390/char/tape_block.c4
-rw-r--r--drivers/s390/char/tape_core.c47
-rw-r--r--drivers/s390/char/vmlogrdr.c11
-rw-r--r--drivers/s390/cio/blacklist.c7
-rw-r--r--drivers/s390/cio/cio.c20
-rw-r--r--drivers/s390/cio/device_pgid.c12
-rw-r--r--drivers/s390/kvm/kvm_virtio.c58
-rw-r--r--drivers/s390/net/qeth_core_main.c49
-rw-r--r--drivers/s390/net/qeth_core_offl.c6
-rw-r--r--drivers/s390/net/qeth_core_sys.c12
-rw-r--r--drivers/s390/net/qeth_l2_main.c41
-rw-r--r--drivers/s390/net/qeth_l3_main.c75
-rw-r--r--drivers/s390/net/qeth_l3_sys.c24
-rw-r--r--drivers/s390/s390mach.c1
-rw-r--r--drivers/sbus/char/bpp.c6
-rw-r--r--drivers/scsi/3w-9xxx.c6
-rw-r--r--drivers/scsi/aha152x.c12
-rw-r--r--drivers/scsi/atp870u.c2
-rw-r--r--drivers/scsi/ch.c7
-rw-r--r--drivers/scsi/gdth.c51
-rw-r--r--drivers/scsi/hptiop.c12
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/ibmvscsi/viosrp.h3
-rw-r--r--drivers/scsi/libiscsi.c29
-rw-r--r--drivers/scsi/mac_esp.c2
-rw-r--r--drivers/scsi/osst.c3
-rw-r--r--drivers/scsi/qla1280.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c13
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h3
-rw-r--r--drivers/scsi/qla2xxx/qla_inline.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c63
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c12
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c19
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c30
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/scsi/scsi_sysfs.c7
-rw-r--r--drivers/scsi/sg.c11
-rw-r--r--drivers/scsi/st.c12
-rw-r--r--drivers/serial/8250.c1
-rw-r--r--drivers/serial/8250_pci.c7
-rw-r--r--drivers/serial/Kconfig8
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/bfin_5xx.c40
-rw-r--r--drivers/serial/crisv10.c2
-rw-r--r--drivers/serial/mcfserial.c1
-rw-r--r--drivers/serial/sb1250-duart.c2
-rw-r--r--drivers/serial/serial_core.c15
-rw-r--r--drivers/serial/sh-sci.c8
-rw-r--r--drivers/serial/sunhv.c1
-rw-r--r--drivers/serial/ucc_uart.c2
-rw-r--r--drivers/spi/Kconfig1
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c2
-rw-r--r--drivers/spi/pxa2xx_spi.c2
-rw-r--r--drivers/spi/spi_mpc83xx.c411
-rw-r--r--drivers/spi/spidev.c166
-rw-r--r--drivers/ssb/driver_pcicore.c4
-rw-r--r--drivers/uio/uio.c7
-rw-r--r--drivers/usb/c67x00/c67x00-ll-hpi.c13
-rw-r--r--drivers/usb/class/Kconfig11
-rw-r--r--drivers/usb/class/Makefile1
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/class/cdc-wdm.c740
-rw-r--r--drivers/usb/core/endpoint.c11
-rw-r--r--drivers/usb/core/generic.c5
-rw-r--r--drivers/usb/core/hcd.c6
-rw-r--r--drivers/usb/core/hcd.h2
-rw-r--r--drivers/usb/core/hub.c61
-rw-r--r--drivers/usb/core/message.c1
-rw-r--r--drivers/usb/core/quirks.c4
-rw-r--r--drivers/usb/core/sysfs.c181
-rw-r--r--drivers/usb/core/usb.c1
-rw-r--r--drivers/usb/core/usb.h4
-rw-r--r--drivers/usb/gadget/amd5536udc.c10
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c48
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c2
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c20
-rw-r--r--drivers/usb/gadget/pxa27x_udc.h8
-rw-r--r--drivers/usb/gadget/serial.c778
-rw-r--r--drivers/usb/host/Kconfig8
-rw-r--r--drivers/usb/host/ehci-au1xxx.c1
-rw-r--r--drivers/usb/host/ehci-fsl.c7
-rw-r--r--drivers/usb/host/ehci-hub.c16
-rw-r--r--drivers/usb/host/ehci-ixp4xx.c4
-rw-r--r--drivers/usb/host/ehci-orion.c10
-rw-r--r--drivers/usb/host/ehci-pci.c4
-rw-r--r--drivers/usb/host/ehci-ppc-of.c2
-rw-r--r--drivers/usb/host/ehci-ppc-soc.c1
-rw-r--r--drivers/usb/host/ehci-ps3.c1
-rw-r--r--drivers/usb/host/ehci-sched.c67
-rw-r--r--drivers/usb/host/ehci.h5
-rw-r--r--drivers/usb/host/isp1760-hcd.c12
-rw-r--r--drivers/usb/host/isp1760-if.c6
-rw-r--r--drivers/usb/host/ohci-sm501.c2
-rw-r--r--drivers/usb/misc/Kconfig12
-rw-r--r--drivers/usb/misc/Makefile1
-rw-r--r--drivers/usb/misc/isight_firmware.c140
-rw-r--r--drivers/usb/misc/ldusb.c4
-rw-r--r--drivers/usb/misc/phidgetkit.c6
-rw-r--r--drivers/usb/misc/phidgetmotorcontrol.c7
-rw-r--r--drivers/usb/misc/phidgetservo.c6
-rw-r--r--drivers/usb/misc/usbtest.c5
-rw-r--r--drivers/usb/serial/Kconfig9
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/ch341.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c265
-rw-r--r--drivers/usb/serial/ftdi_sio.h273
-rw-r--r--drivers/usb/serial/moto_modem.c70
-rw-r--r--drivers/usb/serial/option.c48
-rw-r--r--drivers/usb/serial/pl2303.c2
-rw-r--r--drivers/usb/serial/pl2303.h2
-rw-r--r--drivers/usb/storage/unusual_devs.h79
-rw-r--r--drivers/video/Kconfig5
-rw-r--r--drivers/video/amifb.c4
-rw-r--r--drivers/video/atmel_lcdfb.c11
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/aty/radeon_base.c4
-rw-r--r--drivers/video/cirrusfb.c6
-rw-r--r--drivers/video/console/fbcon.c35
-rw-r--r--drivers/video/display/display-sysfs.c10
-rw-r--r--drivers/video/dnfb.c3
-rw-r--r--drivers/video/fsl-diu-fb.c4
-rw-r--r--drivers/video/geode/lxfb_ops.c22
-rw-r--r--drivers/video/hgafb.c26
-rw-r--r--drivers/video/hpfb.c2
-rw-r--r--drivers/video/leo.c58
-rw-r--r--drivers/video/logo/Kconfig10
-rw-r--r--drivers/video/logo/Makefile2
-rw-r--r--drivers/video/logo/logo.c10
-rw-r--r--drivers/video/logo/logo_blackfin_clut224.ppm1127
-rw-r--r--drivers/video/logo/logo_blackfin_vga16.ppm1127
-rw-r--r--drivers/video/matrox/matroxfb_base.h2
-rw-r--r--drivers/video/modedb.c2
-rw-r--r--drivers/video/pnx4008/pnxrgbfb.c11
-rw-r--r--drivers/video/pxafb.c12
-rw-r--r--drivers/video/s3c2410fb.c130
-rw-r--r--drivers/video/s3c2410fb.h20
-rw-r--r--drivers/video/sis/sis_main.c2
-rw-r--r--drivers/video/sm501fb.c8
-rw-r--r--drivers/video/tridentfb.c25
-rw-r--r--drivers/virtio/virtio.c10
-rw-r--r--drivers/virtio/virtio_pci.c7
-rw-r--r--drivers/virtio/virtio_ring.c8
-rw-r--r--drivers/watchdog/Kconfig13
-rw-r--r--drivers/watchdog/Makefile1
-rw-r--r--drivers/watchdog/bfin_wdt.c111
-rw-r--r--drivers/watchdog/booke_wdt.c88
-rw-r--r--drivers/watchdog/geodewdt.c308
-rw-r--r--drivers/watchdog/hpwdt.c27
-rw-r--r--drivers/watchdog/iTCO_wdt.c14
-rw-r--r--drivers/watchdog/w83697hf_wdt.c38
-rw-r--r--fs/9p/fid.h15
-rw-r--r--fs/9p/v9fs.c57
-rw-r--r--fs/9p/v9fs.h85
-rw-r--r--fs/9p/vfs_addr.c2
-rw-r--r--fs/9p/vfs_dir.c2
-rw-r--r--fs/9p/vfs_file.c11
-rw-r--r--fs/9p/vfs_inode.c50
-rw-r--r--fs/9p/vfs_super.c35
-rw-r--r--fs/Kconfig.binfmt2
-rw-r--r--fs/afs/callback.c2
-rw-r--r--fs/afs/inode.c2
-rw-r--r--fs/afs/super.c2
-rw-r--r--fs/aio.c4
-rw-r--r--fs/befs/endian.h2
-rw-r--r--fs/binfmt_elf.c9
-rw-r--r--fs/binfmt_elf_fdpic.c2
-rw-r--r--fs/binfmt_flat.c8
-rw-r--r--fs/block_dev.c8
-rw-r--r--fs/cifs/AUTHORS1
-rw-r--r--fs/cifs/CHANGES10
-rw-r--r--fs/cifs/README5
-rw-r--r--fs/cifs/TODO15
-rw-r--r--fs/cifs/asn1.c14
-rw-r--r--fs/cifs/cifs_dfs_ref.c49
-rw-r--r--fs/cifs/cifs_fs_sb.h1
-rw-r--r--fs/cifs/cifs_spnego.c3
-rw-r--r--fs/cifs/cifsfs.c65
-rw-r--r--fs/cifs/cifsfs.h3
-rw-r--r--fs/cifs/cifsglob.h4
-rw-r--r--fs/cifs/cifspdu.h49
-rw-r--r--fs/cifs/cifsproto.h13
-rw-r--r--fs/cifs/cifssmb.c355
-rw-r--r--fs/cifs/connect.c152
-rw-r--r--fs/cifs/dir.c50
-rw-r--r--fs/cifs/dns_resolve.c9
-rw-r--r--fs/cifs/file.c13
-rw-r--r--fs/cifs/inode.c602
-rw-r--r--fs/cifs/ioctl.c4
-rw-r--r--fs/cifs/link.c43
-rw-r--r--fs/cifs/misc.c3
-rw-r--r--fs/cifs/netmisc.c6
-rw-r--r--fs/cifs/ntlmssp.h4
-rw-r--r--fs/cifs/readdir.c84
-rw-r--r--fs/compat.c4
-rw-r--r--fs/dlm/lowcomms.c27
-rw-r--r--fs/dlm/netlink.c2
-rw-r--r--fs/dlm/plock.c2
-rw-r--r--fs/dquot.c10
-rw-r--r--fs/ecryptfs/crypto.c2
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h2
-rw-r--r--fs/ecryptfs/inode.c13
-rw-r--r--fs/ecryptfs/miscdev.c28
-rw-r--r--fs/ecryptfs/read_write.c22
-rw-r--r--fs/exec.c15
-rw-r--r--fs/ext3/resize.c3
-rw-r--r--fs/ext3/xattr.c5
-rw-r--r--fs/ext4/balloc.c88
-rw-r--r--fs/ext4/mballoc.c80
-rw-r--r--fs/ext4/resize.c3
-rw-r--r--fs/ext4/super.c116
-rw-r--r--fs/ext4/xattr.c5
-rw-r--r--fs/fat/file.c44
-rw-r--r--fs/file.c152
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/fuse/fuse_i.h3
-rw-r--r--fs/fuse/inode.c12
-rw-r--r--fs/gfs2/glops.c2
-rw-r--r--fs/gfs2/incore.h1
-rw-r--r--fs/gfs2/inode.c10
-rw-r--r--fs/gfs2/meta_io.c6
-rw-r--r--fs/gfs2/ops_fstype.c4
-rw-r--r--fs/gfs2/ops_super.c16
-rw-r--r--fs/gfs2/rgrp.c2
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hppfs/Makefile5
-rw-r--r--fs/hppfs/hppfs.c (renamed from fs/hppfs/hppfs_kern.c)82
-rw-r--r--fs/jbd/commit.c2
-rw-r--r--fs/jbd2/commit.c3
-rw-r--r--fs/jbd2/journal.c4
-rw-r--r--fs/jbd2/recovery.c12
-rw-r--r--fs/libfs.c18
-rw-r--r--fs/namei.c12
-rw-r--r--fs/nfs/callback.c2
-rw-r--r--fs/nfs/callback_proc.c4
-rw-r--r--fs/nfs/callback_xdr.c40
-rw-r--r--fs/nfs/client.c8
-rw-r--r--fs/nfs/delegation.c4
-rw-r--r--fs/nfs/dir.c18
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfs/inode.c14
-rw-r--r--fs/nfs/namespace.c11
-rw-r--r--fs/nfs/nfs3proc.c6
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4namespace.c12
-rw-r--r--fs/nfs/nfs4proc.c38
-rw-r--r--fs/nfs/nfs4renewd.c10
-rw-r--r--fs/nfs/nfs4state.c8
-rw-r--r--fs/nfs/nfs4xdr.c100
-rw-r--r--fs/nfs/proc.c8
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/super.c12
-rw-r--r--fs/nfs/write.c2
-rw-r--r--fs/nfsd/nfs4callback.c2
-rw-r--r--fs/ntfs/upcase.c5
-rw-r--r--fs/ocfs2/alloc.c4
-rw-r--r--fs/ocfs2/cluster/tcp.c28
-rw-r--r--fs/ocfs2/cluster/tcp.h12
-rw-r--r--fs/ocfs2/cluster/tcp_internal.h32
-rw-r--r--fs/ocfs2/dlm/dlmdebug.h12
-rw-r--r--fs/ocfs2/stack_user.c34
-rw-r--r--fs/proc/array.c3
-rw-r--r--fs/proc/base.c35
-rw-r--r--fs/proc/inode.c3
-rw-r--r--fs/proc/proc_misc.c8
-rw-r--r--fs/proc/task_mmu.c111
-rw-r--r--fs/splice.c17
-rw-r--r--fs/sysfs/dir.c6
-rw-r--r--fs/ufs/ufs.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c24
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h19
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c17
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h8
-rw-r--r--fs/xfs/xfs_inode.c9
-rw-r--r--fs/xfs/xfs_vnodeops.c112
-rw-r--r--fs/xfs/xfs_vnodeops.h3
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-alpha/barrier.h2
-rw-r--r--include/asm-alpha/param.h4
-rw-r--r--include/asm-alpha/pgtable.h21
-rw-r--r--include/asm-arm/arch-at91/io.h2
-rw-r--r--include/asm-arm/arch-omap/board-palmte.h2
-rw-r--r--include/asm-arm/arch-omap/clock.h5
-rw-r--r--include/asm-arm/arch-omap/common.h4
-rw-r--r--include/asm-arm/arch-omap/control.h2
-rw-r--r--include/asm-arm/arch-omap/entry-macro.S1
-rw-r--r--include/asm-arm/arch-omap/gpio.h1
-rw-r--r--include/asm-arm/arch-omap/hardware.h1
-rw-r--r--include/asm-arm/arch-omap/mmc.h24
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa27x.h1
-rw-r--r--include/asm-arm/arch-pxa/pxa2xx-gpio.h9
-rw-r--r--include/asm-arm/arch-pxa/regs-lcd.h5
-rw-r--r--include/asm-arm/arch-sa1100/collie.h4
-rw-r--r--include/asm-arm/arch-sa1100/irqs.h2
-rw-r--r--include/asm-arm/hardware/locomo.h19
-rw-r--r--include/asm-arm/page.h4
-rw-r--r--include/asm-arm/pgtable-nommu.h1
-rw-r--r--include/asm-arm/spinlock.h2
-rw-r--r--include/asm-arm/system.h29
-rw-r--r--include/asm-blackfin/bfin-global.h11
-rw-r--r--include/asm-blackfin/checksum.h29
-rw-r--r--include/asm-blackfin/gpio.h1
-rw-r--r--include/asm-blackfin/io.h2
-rw-r--r--include/asm-blackfin/mach-bf527/anomaly.h5
-rw-r--r--include/asm-blackfin/mach-bf527/bfin_serial_5xx.h6
-rw-r--r--include/asm-blackfin/mach-bf527/blackfin.h8
-rw-r--r--include/asm-blackfin/mach-bf533/anomaly.h31
-rw-r--r--include/asm-blackfin/mach-bf533/bfin_serial_5xx.h6
-rw-r--r--include/asm-blackfin/mach-bf537/anomaly.h10
-rw-r--r--include/asm-blackfin/mach-bf537/bfin_serial_5xx.h6
-rw-r--r--include/asm-blackfin/mach-bf548/anomaly.h2
-rw-r--r--include/asm-blackfin/mach-bf548/bfin_serial_5xx.h6
-rw-r--r--include/asm-blackfin/mach-bf561/anomaly.h2
-rw-r--r--include/asm-blackfin/mach-bf561/bfin_serial_5xx.h6
-rw-r--r--include/asm-blackfin/mach-bf561/dma.h8
-rw-r--r--include/asm-blackfin/serial.h5
-rw-r--r--include/asm-frv/checksum.h2
-rw-r--r--include/asm-frv/mem-layout.h7
-rw-r--r--include/asm-frv/system.h2
-rw-r--r--include/asm-generic/gpio.h6
-rw-r--r--include/asm-h8300/cacheflush.h2
-rw-r--r--include/asm-h8300/param.h8
-rw-r--r--include/asm-ia64/kvm.h12
-rw-r--r--include/asm-ia64/machvec.h2
-rw-r--r--include/asm-ia64/machvec_uv.h26
-rw-r--r--include/asm-ia64/patch.h1
-rw-r--r--include/asm-ia64/ptrace.h2
-rw-r--r--include/asm-ia64/sections.h1
-rw-r--r--include/asm-ia64/uv/uv_hub.h309
-rw-r--r--include/asm-ia64/uv/uv_mmrs.h266
-rw-r--r--include/asm-m32r/uaccess.h2
-rw-r--r--include/asm-m68k/bitops.h45
-rw-r--r--include/asm-m68k/bug.h4
-rw-r--r--include/asm-m68k/io.h44
-rw-r--r--include/asm-m68k/setup.h2
-rw-r--r--include/asm-m68k/uaccess.h6
-rw-r--r--include/asm-mips/bitops.h14
-rw-r--r--include/asm-mips/compiler.h4
-rw-r--r--include/asm-mips/gic.h2
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h1644
-rw-r--r--include/asm-mips/mach-au1x00/au1000_dma.h179
-rw-r--r--include/asm-mips/mach-au1x00/au1000_gpio.h18
-rw-r--r--include/asm-mips/mach-au1x00/au1550_spi.h2
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx.h4
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_dbdma.h156
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h251
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h131
-rw-r--r--include/asm-mips/mach-db1x00/db1200.h73
-rw-r--r--include/asm-mips/mach-db1x00/db1x00.h83
-rw-r--r--include/asm-mips/mach-pb1x00/pb1000.h189
-rw-r--r--include/asm-mips/mach-pb1x00/pb1100.h96
-rw-r--r--include/asm-mips/mach-pb1x00/pb1200.h93
-rw-r--r--include/asm-mips/mach-pb1x00/pb1500.h38
-rw-r--r--include/asm-mips/mach-pb1x00/pb1550.h51
-rw-r--r--include/asm-mips/mipsregs.h3
-rw-r--r--include/asm-mips/pgtable.h3
-rw-r--r--include/asm-mips/rtlx.h6
-rw-r--r--include/asm-mn10300/ipcbuf.h2
-rw-r--r--include/asm-parisc/assembly.h6
-rw-r--r--include/asm-parisc/checksum.h2
-rw-r--r--include/asm-parisc/ioctl.h51
-rw-r--r--include/asm-parisc/ioctls.h4
-rw-r--r--include/asm-parisc/termbits.h5
-rw-r--r--include/asm-parisc/termios.h6
-rw-r--r--include/asm-powerpc/io.h12
-rw-r--r--include/asm-powerpc/kvm_ppc.h1
-rw-r--r--include/asm-powerpc/mmu-hash64.h1
-rw-r--r--include/asm-powerpc/mpic.h3
-rw-r--r--include/asm-powerpc/pgtable-ppc64.h10
-rw-r--r--include/asm-powerpc/uaccess.h4
-rw-r--r--include/asm-ppc/system.h2
-rw-r--r--include/asm-s390/debug.h4
-rw-r--r--include/asm-s390/system.h8
-rw-r--r--include/asm-s390/types.h10
-rw-r--r--include/asm-sh/checksum_32.h2
-rw-r--r--include/asm-sh/kgdb.h14
-rw-r--r--include/asm-sparc/asi.h1
-rw-r--r--include/asm-sparc/auxio.h2
-rw-r--r--include/asm-sparc/bitops.h2
-rw-r--r--include/asm-sparc/btfixup.h2
-rw-r--r--include/asm-sparc/checksum.h1
-rw-r--r--include/asm-sparc/clock.h2
-rw-r--r--include/asm-sparc/contregs.h1
-rw-r--r--include/asm-sparc/cypress.h2
-rw-r--r--include/asm-sparc/delay.h2
-rw-r--r--include/asm-sparc/ebus.h2
-rw-r--r--include/asm-sparc/ecc.h2
-rw-r--r--include/asm-sparc/eeprom.h2
-rw-r--r--include/asm-sparc/elf.h1
-rw-r--r--include/asm-sparc/fcntl.h1
-rw-r--r--include/asm-sparc/head.h1
-rw-r--r--include/asm-sparc/idprom.h2
-rw-r--r--include/asm-sparc/io.h3
-rw-r--r--include/asm-sparc/ioctl.h1
-rw-r--r--include/asm-sparc/kdebug.h2
-rw-r--r--include/asm-sparc/machines.h2
-rw-r--r--include/asm-sparc/mbus.h2
-rw-r--r--include/asm-sparc/memreg.h1
-rw-r--r--include/asm-sparc/mman.h6
-rw-r--r--include/asm-sparc/mostek.h2
-rw-r--r--include/asm-sparc/mpmbox.h2
-rw-r--r--include/asm-sparc/msi.h2
-rw-r--r--include/asm-sparc/mxcc.h2
-rw-r--r--include/asm-sparc/namei.h2
-rw-r--r--include/asm-sparc/obio.h2
-rw-r--r--include/asm-sparc/openprom.h1
-rw-r--r--include/asm-sparc/oplib.h2
-rw-r--r--include/asm-sparc/page.h2
-rw-r--r--include/asm-sparc/param.h1
-rw-r--r--include/asm-sparc/pbm.h2
-rw-r--r--include/asm-sparc/pcic.h2
-rw-r--r--include/asm-sparc/pgalloc.h1
-rw-r--r--include/asm-sparc/pgtable.h1
-rw-r--r--include/asm-sparc/pgtsrmmu.h2
-rw-r--r--include/asm-sparc/pgtsun4.h2
-rw-r--r--include/asm-sparc/pgtsun4c.h2
-rw-r--r--include/asm-sparc/psr.h2
-rw-r--r--include/asm-sparc/ptrace.h3
-rw-r--r--include/asm-sparc/resource.h2
-rw-r--r--include/asm-sparc/ross.h2
-rw-r--r--include/asm-sparc/rtc.h3
-rw-r--r--include/asm-sparc/sbi.h2
-rw-r--r--include/asm-sparc/sbus.h2
-rw-r--r--include/asm-sparc/scatterlist.h1
-rw-r--r--include/asm-sparc/shmparam.h1
-rw-r--r--include/asm-sparc/sigcontext.h1
-rw-r--r--include/asm-sparc/siginfo.h4
-rw-r--r--include/asm-sparc/signal.h1
-rw-r--r--include/asm-sparc/smpprim.h2
-rw-r--r--include/asm-sparc/socket.h1
-rw-r--r--include/asm-sparc/stat.h1
-rw-r--r--include/asm-sparc/statfs.h1
-rw-r--r--include/asm-sparc/string.h2
-rw-r--r--include/asm-sparc/sun4paddr.h2
-rw-r--r--include/asm-sparc/sunbpp.h2
-rw-r--r--include/asm-sparc/sysen.h2
-rw-r--r--include/asm-sparc/termios.h1
-rw-r--r--include/asm-sparc/timer.h2
-rw-r--r--include/asm-sparc/traps.h2
-rw-r--r--include/asm-sparc/tsunami.h2
-rw-r--r--include/asm-sparc/turbosparc.h2
-rw-r--r--include/asm-sparc/types.h1
-rw-r--r--include/asm-sparc/uaccess.h2
-rw-r--r--include/asm-sparc/vac-ops.h1
-rw-r--r--include/asm-sparc/vaddrs.h1
-rw-r--r--include/asm-sparc/viking.h2
-rw-r--r--include/asm-sparc/winmacro.h2
-rw-r--r--include/asm-sparc64/apb.h2
-rw-r--r--include/asm-sparc64/asi.h1
-rw-r--r--include/asm-sparc64/auxio.h2
-rw-r--r--include/asm-sparc64/bbc.h2
-rw-r--r--include/asm-sparc64/bitops.h2
-rw-r--r--include/asm-sparc64/chafsr.h1
-rw-r--r--include/asm-sparc64/checksum.h1
-rw-r--r--include/asm-sparc64/chmctrl.h1
-rw-r--r--include/asm-sparc64/dcr.h1
-rw-r--r--include/asm-sparc64/display7seg.h2
-rw-r--r--include/asm-sparc64/dma.h2
-rw-r--r--include/asm-sparc64/ebus.h2
-rw-r--r--include/asm-sparc64/elf.h1
-rw-r--r--include/asm-sparc64/envctrl.h2
-rw-r--r--include/asm-sparc64/estate.h1
-rw-r--r--include/asm-sparc64/fcntl.h1
-rw-r--r--include/asm-sparc64/fhc.h2
-rw-r--r--include/asm-sparc64/head.h1
-rw-r--r--include/asm-sparc64/ide.h2
-rw-r--r--include/asm-sparc64/idprom.h2
-rw-r--r--include/asm-sparc64/io.h66
-rw-r--r--include/asm-sparc64/ioctl.h1
-rw-r--r--include/asm-sparc64/ioctls.h1
-rw-r--r--include/asm-sparc64/lsu.h1
-rw-r--r--include/asm-sparc64/mman.h6
-rw-r--r--include/asm-sparc64/mmu_context.h1
-rw-r--r--include/asm-sparc64/namei.h2
-rw-r--r--include/asm-sparc64/openprom.h1
-rw-r--r--include/asm-sparc64/page.h2
-rw-r--r--include/asm-sparc64/pgalloc.h1
-rw-r--r--include/asm-sparc64/pgtable.h2
-rw-r--r--include/asm-sparc64/pil.h1
-rw-r--r--include/asm-sparc64/processor.h2
-rw-r--r--include/asm-sparc64/psrcompat.h1
-rw-r--r--include/asm-sparc64/pstate.h1
-rw-r--r--include/asm-sparc64/ptrace.h25
-rw-r--r--include/asm-sparc64/reg.h2
-rw-r--r--include/asm-sparc64/resource.h2
-rw-r--r--include/asm-sparc64/rtc.h3
-rw-r--r--include/asm-sparc64/rwsem.h2
-rw-r--r--include/asm-sparc64/scatterlist.h1
-rw-r--r--include/asm-sparc64/shmparam.h1
-rw-r--r--include/asm-sparc64/sigcontext.h1
-rw-r--r--include/asm-sparc64/signal.h1
-rw-r--r--include/asm-sparc64/smp.h5
-rw-r--r--include/asm-sparc64/socket.h1
-rw-r--r--include/asm-sparc64/starfire.h2
-rw-r--r--include/asm-sparc64/stat.h1
-rw-r--r--include/asm-sparc64/statfs.h1
-rw-r--r--include/asm-sparc64/string.h2
-rw-r--r--include/asm-sparc64/sunbpp.h2
-rw-r--r--include/asm-sparc64/termios.h1
-rw-r--r--include/asm-sparc64/thread_info.h28
-rw-r--r--include/asm-sparc64/ttable.h1
-rw-r--r--include/asm-sparc64/types.h1
-rw-r--r--include/asm-sparc64/uaccess.h1
-rw-r--r--include/asm-sparc64/uctx.h2
-rw-r--r--include/asm-sparc64/utrap.h2
-rw-r--r--include/asm-sparc64/watchdog.h2
-rw-r--r--include/asm-um/irq.h3
-rw-r--r--include/asm-um/keyboard.h6
-rw-r--r--include/asm-um/mmu_context.h12
-rw-r--r--include/asm-um/page.h17
-rw-r--r--include/asm-um/param.h2
-rw-r--r--include/asm-v850/clinkage.h2
-rw-r--r--include/asm-v850/param.h2
-rw-r--r--include/asm-x86/i387.h2
-rw-r--r--include/asm-x86/kvm_x86_emulate.h1
-rw-r--r--include/asm-x86/page.h15
-rw-r--r--include/asm-x86/pgtable-3level.h6
-rw-r--r--include/asm-x86/pgtable.h19
-rw-r--r--include/asm-x86/pgtable_32.h4
-rw-r--r--include/asm-x86/pgtable_64.h12
-rw-r--r--include/asm-x86/tlbflush.h13
-rw-r--r--include/asm-x86/xen/page.h2
-rw-r--r--include/asm-xtensa/param.h2
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/atm.h7
-rw-r--r--include/linux/atm_tcp.h12
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bitmap.h1
-rw-r--r--include/linux/bitrev.h1
-rw-r--r--include/linux/blktrace_api.h26
-rw-r--r--include/linux/capability.h29
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/cpumask.h7
-rw-r--r--include/linux/device.h16
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/linux/fuse.h1
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/gpio.h3
-rw-r--r--include/linux/hid.h3
-rw-r--r--include/linux/hiddev.h2
-rw-r--r--include/linux/i2c.h7
-rw-r--r--include/linux/i2c/pcf857x.h3
-rw-r--r--include/linux/ide.h11
-rw-r--r--include/linux/in_route.h12
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init_task.h23
-rw-r--r--include/linux/input.h4
-rw-r--r--include/linux/ioport.h6
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/jbd2.h3
-rw-r--r--include/linux/kallsyms.h24
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/kvm_host.h2
-rw-r--r--include/linux/libata.h25
-rw-r--r--include/linux/math64.h21
-rw-r--r--include/linux/memory_hotplug.h16
-rw-r--r--include/linux/mm.h17
-rw-r--r--include/linux/mm_types.h13
-rw-r--r--include/linux/mman.h4
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mod_devicetable.h3
-rw-r--r--include/linux/msdos_fs.h12
-rw-r--r--include/linux/msg.h4
-rw-r--r--include/linux/mtd/nand.h2
-rw-r--r--include/linux/netdevice.h38
-rw-r--r--include/linux/netfilter.h2
-rw-r--r--include/linux/netfilter_arp/arp_tables.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h2
-rw-r--r--include/linux/page-flags.h24
-rw-r--r--include/linux/parser.h2
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/percpu.h8
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/raid/bitmap.h1
-rw-r--r--include/linux/raid/md.h2
-rw-r--r--include/linux/raid/md_k.h7
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h20
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/slab.h11
-rw-r--r--include/linux/sm501.h4
-rw-r--r--include/linux/spi/mmc_spi.h2
-rw-r--r--include/linux/ssb/ssb_driver_gige.h2
-rw-r--r--include/linux/sunrpc/svc_rdma.h12
-rw-r--r--include/linux/tcp.h9
-rw-r--r--include/linux/time.h16
-rw-r--r--include/linux/topology.h4
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/usb/association.h150
-rw-r--r--include/linux/usb/cdc.h9
-rw-r--r--include/linux/videodev2.h6
-rw-r--r--include/linux/virtio_blk.h9
-rw-r--r--include/linux/virtio_config.h6
-rw-r--r--include/linux/virtio_net.h2
-rw-r--r--include/linux/virtio_rng.h8
-rw-r--r--include/linux/wm97xx.h1
-rw-r--r--include/media/v4l2-dev.h1
-rw-r--r--include/media/videobuf-core.h3
-rw-r--r--include/net/9p/9p.h240
-rw-r--r--include/net/9p/client.h35
-rw-r--r--include/net/9p/transport.h44
-rw-r--r--include/net/addrconf.h22
-rw-r--r--include/net/genetlink.h4
-rw-r--r--include/net/inet_sock.h10
-rw-r--r--include/net/irda/discovery.h3
-rw-r--r--include/net/mac80211.h25
-rw-r--r--include/net/ndisc.h4
-rw-r--r--include/net/netlink.h31
-rw-r--r--include/net/request_sock.h4
-rw-r--r--include/net/sctp/structs.h17
-rw-r--r--include/net/syncppp.h2
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/net/transp_v6.h3
-rw-r--r--include/net/udp.h1
-rw-r--r--include/rdma/ib_verbs.h1
-rw-r--r--include/sound/ac97_codec.h1
-rw-r--r--include/sound/soc.h2
-rw-r--r--init/Kconfig1
-rw-r--r--init/do_mounts.c27
-rw-r--r--init/do_mounts_md.c1
-rw-r--r--init/main.c82
-rw-r--r--ipc/msg.c13
-rw-r--r--ipc/shm.c18
-rw-r--r--kernel/audit.c11
-rw-r--r--kernel/audit_tree.c5
-rw-r--r--kernel/capability.c111
-rw-r--r--kernel/cgroup.c2
-rw-r--r--kernel/cpuset.c10
-rw-r--r--kernel/exit.c7
-rw-r--r--kernel/fork.c130
-rw-r--r--kernel/kgdb.c24
-rw-r--r--kernel/kprobes.c15
-rw-r--r--kernel/module.c18
-rw-r--r--kernel/relay.c2
-rw-r--r--kernel/sched.c471
-rw-r--r--kernel/sched_clock.c18
-rw-r--r--kernel/sched_debug.c5
-rw-r--r--kernel/sched_fair.c254
-rw-r--r--kernel/sched_rt.c4
-rw-r--r--kernel/sched_stats.h1
-rw-r--r--kernel/signal.c51
-rw-r--r--kernel/stop_machine.c7
-rw-r--r--kernel/sys.c6
-rw-r--r--kernel/sysctl.c5
-rw-r--r--lib/bitmap.c16
-rw-r--r--lib/bitrev.c3
-rw-r--r--lib/div64.c10
-rw-r--r--lib/hexdump.c7
-rw-r--r--lib/lmb.c46
-rw-r--r--lib/parser.c32
-rw-r--r--lib/radix-tree.c120
-rw-r--r--mm/backing-dev.c12
-rw-r--r--mm/filemap.c5
-rw-r--r--mm/hugetlb.c2
-rw-r--r--mm/memory.c23
-rw-r--r--mm/memory_hotplug.c86
-rw-r--r--mm/mmap.c12
-rw-r--r--mm/mprotect.c11
-rw-r--r--mm/nommu.c21
-rw-r--r--mm/page_alloc.c45
-rw-r--r--mm/pagewalk.c42
-rw-r--r--mm/pdflush.c4
-rw-r--r--mm/slob.c5
-rw-r--r--mm/slub.c5
-rw-r--r--mm/swap.c4
-rw-r--r--mm/vmscan.c2
-rw-r--r--mm/vmstat.c2
-rw-r--r--net/8021q/vlan.c28
-rw-r--r--net/8021q/vlan_dev.c2
-rw-r--r--net/9p/Kconfig10
-rw-r--r--net/9p/Makefile3
-rw-r--r--net/9p/client.c32
-rw-r--r--net/9p/conv.c128
-rw-r--r--net/9p/error.c15
-rw-r--r--net/9p/fcprint.c8
-rw-r--r--net/9p/mod.c8
-rw-r--r--net/9p/trans_fd.c204
-rw-r--r--net/9p/trans_virtio.c175
-rw-r--r--net/9p/util.c36
-rw-r--r--net/ax25/ax25_subr.c11
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/rfcomm/tty.c13
-rw-r--r--net/core/dev.c8
-rw-r--r--net/core/neighbour.c9
-rw-r--r--net/core/netpoll.c2
-rw-r--r--net/core/pktgen.c4
-rw-r--r--net/core/rtnetlink.c3
-rw-r--r--net/core/skbuff.c5
-rw-r--r--net/core/sock.c2
-rw-r--r--net/core/user_dma.c2
-rw-r--r--net/dccp/ackvec.c29
-rw-r--r--net/dccp/ccids/ccid3.c27
-rw-r--r--net/dccp/ccids/lib/tfrc.c8
-rw-r--r--net/dccp/ccids/lib/tfrc.h25
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c8
-rw-r--r--net/dccp/ipv4.c7
-rw-r--r--net/dccp/ipv6.c1
-rw-r--r--net/dccp/minisocks.c8
-rw-r--r--net/dccp/options.c4
-rw-r--r--net/dccp/output.c2
-rw-r--r--net/dccp/probe.c2
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ipv4/arp.c7
-rw-r--r--net/ipv4/cipso_ipv4.c4
-rw-r--r--net/ipv4/devinet.c9
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/fib_semantics.c5
-rw-r--r--net/ipv4/igmp.c4
-rw-r--r--net/ipv4/inet_connection_sock.c11
-rw-r--r--net/ipv4/ip_gre.c146
-rw-r--r--net/ipv4/ipconfig.c6
-rw-r--r--net/ipv4/ipip.c130
-rw-r--r--net/ipv4/netfilter/nf_nat_snmp_basic.c14
-rw-r--r--net/ipv4/raw.c19
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/syncookies.c3
-rw-r--r--net/ipv4/tcp.c27
-rw-r--r--net/ipv4/tcp_input.c97
-rw-r--r--net/ipv4/tcp_ipv4.c10
-rw-r--r--net/ipv4/tcp_minisocks.c32
-rw-r--r--net/ipv4/tcp_output.c12
-rw-r--r--net/ipv4/tcp_timer.c5
-rw-r--r--net/ipv4/tunnel4.c2
-rw-r--r--net/ipv4/udp.c3
-rw-r--r--net/ipv6/addrconf.c142
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/datagram.c50
-rw-r--r--net/ipv6/ip6_flowlabel.c2
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6mr.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c33
-rw-r--r--net/ipv6/mcast.c4
-rw-r--r--net/ipv6/ndisc.c12
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c8
-rw-r--r--net/ipv6/raw.c23
-rw-r--r--net/ipv6/route.c26
-rw-r--r--net/ipv6/sit.c89
-rw-r--r--net/ipv6/syncookies.c1
-rw-r--r--net/ipv6/tcp_ipv6.c1
-rw-r--r--net/ipv6/tunnel6.c2
-rw-r--r--net/ipv6/udp.c8
-rw-r--r--net/irda/af_irda.c12
-rw-r--r--net/irda/discovery.c8
-rw-r--r--net/irda/irlmp.c5
-rw-r--r--net/irda/irnet/irnet_irda.c5
-rw-r--r--net/key/af_key.c5
-rw-r--r--net/llc/llc_sap.c10
-rw-r--r--net/mac80211/cfg.c4
-rw-r--r--net/mac80211/debugfs_key.c15
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/iface.c9
-rw-r--r--net/mac80211/main.c3
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mesh_hwmp.c2
-rw-r--r--net/mac80211/mesh_pathtbl.c17
-rw-r--r--net/mac80211/mlme.c130
-rw-r--r--net/mac80211/rx.c16
-rw-r--r--net/mac80211/tx.c5
-rw-r--r--net/mac80211/util.c51
-rw-r--r--net/mac80211/wext.c27
-rw-r--r--net/mac80211/wme.c3
-rw-r--r--net/netfilter/nf_conntrack_core.c3
-rw-r--r--net/netfilter/nf_conntrack_expect.c4
-rw-r--r--net/netfilter/nf_conntrack_netlink.c3
-rw-r--r--net/netfilter/nf_log.c4
-rw-r--r--net/netfilter/xt_connlimit.c3
-rw-r--r--net/netfilter/xt_iprange.c2
-rw-r--r--net/netlink/attr.c12
-rw-r--r--net/netlink/genetlink.c6
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sched/sch_dsmark.c6
-rw-r--r--net/sched/sch_gred.c3
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sched/sch_red.c3
-rw-r--r--net/sctp/associola.c21
-rw-r--r--net/sctp/ipv6.c11
-rw-r--r--net/sctp/output.c2
-rw-r--r--net/sctp/outqueue.c120
-rw-r--r--net/sctp/protocol.c11
-rw-r--r--net/sctp/sm_make_chunk.c16
-rw-r--r--net/sctp/transport.c50
-rw-r--r--net/sunrpc/auth_generic.c8
-rw-r--r--net/sunrpc/svc_xprt.c23
-rw-r--r--net/sunrpc/svcauth_unix.c4
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c102
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c11
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c290
-rw-r--r--net/wireless/nl80211.c12
-rw-r--r--net/xfrm/xfrm_algo.c4
-rw-r--r--net/xfrm/xfrm_output.c6
-rw-r--r--net/xfrm/xfrm_user.c11
-rw-r--r--scripts/Makefile.modpost6
-rwxr-xr-xscripts/checkpatch.pl284
-rwxr-xr-x[-rw-r--r--]scripts/decodecode0
-rw-r--r--scripts/kallsyms.c3
-rw-r--r--scripts/kconfig/util.c2
-rwxr-xr-xscripts/kernel-doc4
-rw-r--r--scripts/mksysmap3
-rw-r--r--scripts/mod/modpost.c27
-rwxr-xr-xscripts/ver_linux5
-rw-r--r--security/device_cgroup.c36
-rw-r--r--security/dummy.c24
-rw-r--r--security/keys/internal.h1
-rw-r--r--security/smack/smack_lsm.c12
-rw-r--r--sound/Kconfig5
-rw-r--r--sound/core/sound.c8
-rw-r--r--sound/drivers/Kconfig15
-rw-r--r--sound/drivers/pcsp/pcsp.c2
-rw-r--r--sound/drivers/pcsp/pcsp.h6
-rw-r--r--sound/drivers/pcsp/pcsp_lib.c58
-rw-r--r--sound/drivers/pcsp/pcsp_mixer.c3
-rw-r--r--sound/oss/Kconfig4
-rw-r--r--sound/pci/ac97/ac97_patch.c48
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c15
-rw-r--r--sound/pci/hda/patch_analog.c51
-rw-r--r--sound/pci/hda/patch_cmedia.c1
-rw-r--r--sound/pci/hda/patch_realtek.c54
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/pci/hda/patch_via.c20
-rw-r--r--sound/soc/codecs/tlv320aic3x.c4
-rw-r--r--sound/soc/fsl/fsl_ssi.c2
-rw-r--r--sound/soc/omap/n810.c4
-rw-r--r--sound/synth/emux/emux_synth.c6
-rw-r--r--sound/usb/caiaq/caiaq-device.c4
-rw-r--r--virt/kvm/ioapic.c21
-rw-r--r--virt/kvm/kvm_main.c29
1984 files changed, 41839 insertions, 20287 deletions
diff --git a/.gitignore b/.gitignore
index 090b293b8779..d24ad506e799 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,8 +52,8 @@ series
52 52
53# cscope files 53# cscope files
54cscope.* 54cscope.*
55ncscope.*
55 56
56*.orig 57*.orig
57*.rej
58*~ 58*~
59\#*# 59\#*#
diff --git a/Documentation/ABI/testing/sysfs-class-bdi b/Documentation/ABI/testing/sysfs-class-bdi
index 5ac1e01bbd48..5f500977b42f 100644
--- a/Documentation/ABI/testing/sysfs-class-bdi
+++ b/Documentation/ABI/testing/sysfs-class-bdi
@@ -14,6 +14,10 @@ MAJOR:MINOR
14 non-block filesystems which provide their own BDI, such as NFS 14 non-block filesystems which provide their own BDI, such as NFS
15 and FUSE. 15 and FUSE.
16 16
17MAJOR:MINOR-fuseblk
18
19 Value of st_dev on fuseblk filesystems.
20
17default 21default
18 22
19 The default backing dev, used for non-block device backed 23 The default backing dev, used for non-block device backed
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
index 77c42f40be5d..2510763295d0 100644
--- a/Documentation/DocBook/kernel-locking.tmpl
+++ b/Documentation/DocBook/kernel-locking.tmpl
@@ -703,6 +703,31 @@
703</sect1> 703</sect1>
704</chapter> 704</chapter>
705 705
706<chapter id="trylock-functions">
707 <title>The trylock Functions</title>
708 <para>
709 There are functions that try to acquire a lock only once and immediately
710 return a value telling about success or failure to acquire the lock.
711 They can be used if you need no access to the data protected with the lock
712 when some other thread is holding the lock. You should acquire the lock
713 later if you then need access to the data protected with the lock.
714 </para>
715
716 <para>
717 <function>spin_trylock()</function> does not spin but returns non-zero if
718 it acquires the spinlock on the first try or 0 if not. This function can
719 be used in all contexts like <function>spin_lock</function>: you must have
720 disabled the contexts that might interrupt you and acquire the spin lock.
721 </para>
722
723 <para>
724 <function>mutex_trylock()</function> does not suspend your task
725 but returns non-zero if it could lock the mutex on the first try
726 or 0 if not. This function cannot be safely used in hardware or software
727 interrupt contexts despite not sleeping.
728 </para>
729</chapter>
730
706 <chapter id="Examples"> 731 <chapter id="Examples">
707 <title>Common Examples</title> 732 <title>Common Examples</title>
708 <para> 733 <para>
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 9c93a03ea33b..118ca6e9404f 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -327,6 +327,52 @@ Some people also put extra tags at the end. They'll just be ignored for
327now, but you can do this to mark internal company procedures or just 327now, but you can do this to mark internal company procedures or just
328point out some special detail about the sign-off. 328point out some special detail about the sign-off.
329 329
330If you are a subsystem or branch maintainer, sometimes you need to slightly
331modify patches you receive in order to merge them, because the code is not
332exactly the same in your tree and the submitters'. If you stick strictly to
333rule (c), you should ask the submitter to rediff, but this is a totally
334counter-productive waste of time and energy. Rule (b) allows you to adjust
335the code, but then it is very impolite to change one submitter's code and
336make him endorse your bugs. To solve this problem, it is recommended that
337you add a line between the last Signed-off-by header and yours, indicating
338the nature of your changes. While there is nothing mandatory about this, it
339seems like prepending the description with your mail and/or name, all
340enclosed in square brackets, is noticeable enough to make it obvious that
341you are responsible for last-minute changes. Example :
342
343 Signed-off-by: Random J Developer <random@developer.example.org>
344 [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h]
345 Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org>
346
347This practise is particularly helpful if you maintain a stable branch and
348want at the same time to credit the author, track changes, merge the fix,
349and protect the submitter from complaints. Note that under no circumstances
350can you change the author's identity (the From header), as it is the one
351which appears in the changelog.
352
353Special note to back-porters: It seems to be a common and useful practise
354to insert an indication of the origin of a patch at the top of the commit
355message (just after the subject line) to facilitate tracking. For instance,
356here's what we see in 2.6-stable :
357
358 Date: Tue May 13 19:10:30 2008 +0000
359
360 SCSI: libiscsi regression in 2.6.25: fix nop timer handling
361
362 commit 4cf1043593db6a337f10e006c23c69e5fc93e722 upstream
363
364And here's what appears in 2.4 :
365
366 Date: Tue May 13 22:12:27 2008 +0200
367
368 wireless, airo: waitbusy() won't delay
369
370 [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a]
371
372Whatever the format, this information provides a valuable help to people
373tracking your trees, and to people trying to trouble-shoot bugs in your
374tree.
375
330 376
33113) When to use Acked-by: and Cc: 37713) When to use Acked-by: and Cc:
332 378
diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt
index e65736c6b8bc..63e59b8847c5 100644
--- a/Documentation/cciss.txt
+++ b/Documentation/cciss.txt
@@ -21,6 +21,11 @@ This driver is known to work with the following cards:
21 * SA E200 21 * SA E200
22 * SA E200i 22 * SA E200i
23 * SA E500 23 * SA E500
24 * SA P212
25 * SA P410
26 * SA P410i
27 * SA P411
28 * SA P812
24 29
25Detecting drive failures: 30Detecting drive failures:
26------------------------- 31-------------------------
diff --git a/Documentation/cgroups.txt b/Documentation/cgroups.txt
index c298a6690e0d..824fc0274471 100644
--- a/Documentation/cgroups.txt
+++ b/Documentation/cgroups.txt
@@ -310,8 +310,8 @@ and then start a subshell 'sh' in that cgroup:
310 cd /dev/cgroup 310 cd /dev/cgroup
311 mkdir Charlie 311 mkdir Charlie
312 cd Charlie 312 cd Charlie
313 /bin/echo 2-3 > cpus 313 /bin/echo 2-3 > cpuset.cpus
314 /bin/echo 1 > mems 314 /bin/echo 1 > cpuset.mems
315 /bin/echo $$ > tasks 315 /bin/echo $$ > tasks
316 sh 316 sh
317 # The subshell 'sh' is now running in cgroup Charlie 317 # The subshell 'sh' is now running in cgroup Charlie
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
index 6a9c55bd556b..dcec0564d040 100644
--- a/Documentation/cpu-freq/governors.txt
+++ b/Documentation/cpu-freq/governors.txt
@@ -129,14 +129,6 @@ to its default value of '80' it means that between the checking
129intervals the CPU needs to be on average more than 80% in use to then 129intervals the CPU needs to be on average more than 80% in use to then
130decide that the CPU frequency needs to be increased. 130decide that the CPU frequency needs to be increased.
131 131
132sampling_down_factor: this parameter controls the rate that the CPU
133makes a decision on when to decrease the frequency. When set to its
134default value of '5' it means that at 1/5 the sampling_rate the kernel
135makes a decision to lower the frequency. Five "lower rate" decisions
136have to be made in a row before the CPU frequency is actually lower.
137If set to '1' then the frequency decreases as quickly as it increases,
138if set to '2' it decreases at half the rate of the increase.
139
140ignore_nice_load: this parameter takes a value of '0' or '1'. When 132ignore_nice_load: this parameter takes a value of '0' or '1'. When
141set to '0' (its default), all processes are counted towards the 133set to '0' (its default), all processes are counted towards the
142'cpu utilisation' value. When set to '1', the processes that are 134'cpu utilisation' value. When set to '1', the processes that are
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index fb7b361e6eea..d803c5c68ab5 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -199,7 +199,7 @@ using the sched_setaffinity, mbind and set_mempolicy system calls.
199The following rules apply to each cpuset: 199The following rules apply to each cpuset:
200 200
201 - Its CPUs and Memory Nodes must be a subset of its parents. 201 - Its CPUs and Memory Nodes must be a subset of its parents.
202 - It can only be marked exclusive if its parent is. 202 - It can't be marked exclusive unless its parent is.
203 - If its cpu or memory is exclusive, they may not overlap any sibling. 203 - If its cpu or memory is exclusive, they may not overlap any sibling.
204 204
205These rules, and the natural hierarchy of cpusets, enable efficient 205These rules, and the natural hierarchy of cpusets, enable efficient
@@ -345,7 +345,7 @@ is modified to perform an inline check for this PF_SPREAD_PAGE task
345flag, and if set, a call to a new routine cpuset_mem_spread_node() 345flag, and if set, a call to a new routine cpuset_mem_spread_node()
346returns the node to prefer for the allocation. 346returns the node to prefer for the allocation.
347 347
348Similarly, setting 'memory_spread_cache' turns on the flag 348Similarly, setting 'memory_spread_slab' turns on the flag
349PF_SPREAD_SLAB, and appropriately marked slab caches will allocate 349PF_SPREAD_SLAB, and appropriately marked slab caches will allocate
350pages from the node returned by cpuset_mem_spread_node(). 350pages from the node returned by cpuset_mem_spread_node().
351 351
@@ -709,7 +709,10 @@ Now you want to do something with this cpuset.
709 709
710In this directory you can find several files: 710In this directory you can find several files:
711# ls 711# ls
712cpus cpu_exclusive mems mem_exclusive mem_hardwall tasks 712cpu_exclusive memory_migrate mems tasks
713cpus memory_pressure notify_on_release
714mem_exclusive memory_spread_page sched_load_balance
715mem_hardwall memory_spread_slab sched_relax_domain_level
713 716
714Reading them will give you information about the state of this cpuset: 717Reading them will give you information about the state of this cpuset:
715the CPUs and Memory Nodes it can use, the processes that are using 718the CPUs and Memory Nodes it can use, the processes that are using
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 3c35d452b1a9..5b3f31faed56 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -289,6 +289,14 @@ Who: Glauber Costa <gcosta@redhat.com>
289 289
290--------------------------- 290---------------------------
291 291
292What: old style serial driver for ColdFire (CONFIG_SERIAL_COLDFIRE)
293When: 2.6.28
294Why: This driver still uses the old interface and has been replaced
295 by CONFIG_SERIAL_MCF.
296Who: Sebastian Siewior <sebastian@breakpoint.cc>
297
298---------------------------
299
292What: /sys/o2cb symlink 300What: /sys/o2cb symlink
293When: January 2010 301When: January 2010
294Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb 302Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 560f88dc7090..0c5086db8352 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -139,8 +139,16 @@ commit=nrsec (*) Ext4 can be told to sync all its data and metadata
139 Setting it to very large values will improve 139 Setting it to very large values will improve
140 performance. 140 performance.
141 141
142barrier=1 This enables/disables barriers. barrier=0 disables 142barrier=<0|1(*)> This enables/disables the use of write barriers in
143 it, barrier=1 enables it. 143 the jbd code. barrier=0 disables, barrier=1 enables.
144 This also requires an IO stack which can support
145 barriers, and if jbd gets an error on a barrier
146 write, it will disable again with a warning.
147 Write barriers enforce proper on-disk ordering
148 of journal commits, making volatile disk write caches
149 safe to use, at some performance penalty. If
150 your disks are battery-backed in one way or another,
151 disabling barriers may safely improve performance.
144 152
145orlov (*) This enables the new Orlov block allocator. It is 153orlov (*) This enables the new Orlov block allocator. It is
146 enabled by default. 154 enabled by default.
diff --git a/Documentation/filesystems/sysfs-pci.txt b/Documentation/filesystems/sysfs-pci.txt
index 5daa2aaec2c5..68ef48839c04 100644
--- a/Documentation/filesystems/sysfs-pci.txt
+++ b/Documentation/filesystems/sysfs-pci.txt
@@ -36,6 +36,7 @@ files, each with their own function.
36 local_cpus nearby CPU mask (cpumask, ro) 36 local_cpus nearby CPU mask (cpumask, ro)
37 resource PCI resource host addresses (ascii, ro) 37 resource PCI resource host addresses (ascii, ro)
38 resource0..N PCI resource N, if present (binary, mmap) 38 resource0..N PCI resource N, if present (binary, mmap)
39 resource0_wc..N_wc PCI WC map resource N, if prefetchable (binary, mmap)
39 rom PCI ROM resource, if present (binary, ro) 40 rom PCI ROM resource, if present (binary, ro)
40 subsystem_device PCI subsystem device (ascii, ro) 41 subsystem_device PCI subsystem device (ascii, ro)
41 subsystem_vendor PCI subsystem vendor (ascii, ro) 42 subsystem_vendor PCI subsystem vendor (ascii, ro)
diff --git a/Documentation/hwmon/adt7473 b/Documentation/hwmon/adt7473
index 22d8b19046ab..2126de34c711 100644
--- a/Documentation/hwmon/adt7473
+++ b/Documentation/hwmon/adt7473
@@ -69,7 +69,8 @@ point2: Set the pwm speed at a higher temperature bound.
69 69
70The ADT7473 will scale the pwm between the lower and higher pwm speed when 70The ADT7473 will scale the pwm between the lower and higher pwm speed when
71the temperature is between the two temperature boundaries. PWM values range 71the temperature is between the two temperature boundaries. PWM values range
72from 0 (off) to 255 (full speed). 72from 0 (off) to 255 (full speed). Fan speed will be set to maximum when the
73temperature sensor associated with the PWM control exceeds temp#_max.
73 74
74Notes 75Notes
75----- 76-----
diff --git a/Documentation/hwmon/ibmaem b/Documentation/hwmon/ibmaem
new file mode 100644
index 000000000000..2fefaf582a43
--- /dev/null
+++ b/Documentation/hwmon/ibmaem
@@ -0,0 +1,37 @@
1Kernel driver ibmaem
2======================
3
4Supported systems:
5 * Any recent IBM System X server with Active Energy Manager support.
6 This includes the x3350, x3550, x3650, x3655, x3755, x3850 M2,
7 x3950 M2, and certain HS2x/LS2x/QS2x blades. The IPMI host interface
8 driver ("ipmi-si") needs to be loaded for this driver to do anything.
9 Prefix: 'ibmaem'
10 Datasheet: Not available
11
12Author: Darrick J. Wong
13
14Description
15-----------
16
17This driver implements sensor reading support for the energy and power
18meters available on various IBM System X hardware through the BMC. All
19sensor banks will be exported as platform devices; this driver can talk
20to both v1 and v2 interfaces. This driver is completely separate from the
21older ibmpex driver.
22
23The v1 AEM interface has a simple set of features to monitor energy use.
24There is a register that displays an estimate of raw energy consumption
25since the last BMC reset, and a power sensor that returns average power
26use over a configurable interval.
27
28The v2 AEM interface is a bit more sophisticated, being able to present
29a wider range of energy and power use registers, the power cap as
30set by the AEM software, and temperature sensors.
31
32Special Features
33----------------
34
35The "power_cap" value displays the current system power cap, as set by
36the Active Energy Manager software. Setting the power cap from the host
37is not currently supported.
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
index 2075c0658bf5..0bd32748a467 100644
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ b/Documentation/kernel-doc-nano-HOWTO.txt
@@ -1,6 +1,105 @@
1kernel-doc nano-HOWTO 1kernel-doc nano-HOWTO
2===================== 2=====================
3 3
4How to format kernel-doc comments
5---------------------------------
6
7In order to provide embedded, 'C' friendly, easy to maintain,
8but consistent and extractable documentation of the functions and
9data structures in the Linux kernel, the Linux kernel has adopted
10a consistent style for documenting functions and their parameters,
11and structures and their members.
12
13The format for this documentation is called the kernel-doc format.
14It is documented in this Documentation/kernel-doc-nano-HOWTO.txt file.
15
16This style embeds the documentation within the source files, using
17a few simple conventions. The scripts/kernel-doc perl script, some
18SGML templates in Documentation/DocBook, and other tools understand
19these conventions, and are used to extract this embedded documentation
20into various documents.
21
22In order to provide good documentation of kernel functions and data
23structures, please use the following conventions to format your
24kernel-doc comments in Linux kernel source.
25
26We definitely need kernel-doc formatted documentation for functions
27that are exported to loadable modules using EXPORT_SYMBOL.
28
29We also look to provide kernel-doc formatted documentation for
30functions externally visible to other kernel files (not marked
31"static").
32
33We also recommend providing kernel-doc formatted documentation
34for private (file "static") routines, for consistency of kernel
35source code layout. But this is lower priority and at the
36discretion of the MAINTAINER of that kernel source file.
37
38Data structures visible in kernel include files should also be
39documented using kernel-doc formatted comments.
40
41The opening comment mark "/**" is reserved for kernel-doc comments.
42Only comments so marked will be considered by the kernel-doc scripts,
43and any comment so marked must be in kernel-doc format. Do not use
44"/**" to be begin a comment block unless the comment block contains
45kernel-doc formatted comments. The closing comment marker for
46kernel-doc comments can be either "*/" or "**/".
47
48Kernel-doc comments should be placed just before the function
49or data structure being described.
50
51Example kernel-doc function comment:
52
53/**
54 * foobar() - short function description of foobar
55 * @arg1: Describe the first argument to foobar.
56 * @arg2: Describe the second argument to foobar.
57 * One can provide multiple line descriptions
58 * for arguments.
59 *
60 * A longer description, with more discussion of the function foobar()
61 * that might be useful to those using or modifying it. Begins with
62 * empty comment line, and may include additional embedded empty
63 * comment lines.
64 *
65 * The longer description can have multiple paragraphs.
66 **/
67
68The first line, with the short description, must be on a single line.
69
70The @argument descriptions must begin on the very next line following
71this opening short function description line, with no intervening
72empty comment lines.
73
74Example kernel-doc data structure comment.
75
76/**
77 * struct blah - the basic blah structure
78 * @mem1: describe the first member of struct blah
79 * @mem2: describe the second member of struct blah,
80 * perhaps with more lines and words.
81 *
82 * Longer description of this structure.
83 **/
84
85The kernel-doc function comments describe each parameter to the
86function, in order, with the @name lines.
87
88The kernel-doc data structure comments describe each structure member
89in the data structure, with the @name lines.
90
91The longer description formatting is "reflowed", losing your line
92breaks. So presenting carefully formatted lists within these
93descriptions won't work so well; derived documentation will lose
94the formatting.
95
96See the section below "How to add extractable documentation to your
97source files" for more details and notes on how to format kernel-doc
98comments.
99
100Components of the kernel-doc system
101-----------------------------------
102
4Many places in the source tree have extractable documentation in the 103Many places in the source tree have extractable documentation in the
5form of block comments above functions. The components of this system 104form of block comments above functions. The components of this system
6are: 105are:
diff --git a/Documentation/kernel-docs.txt b/Documentation/kernel-docs.txt
index 5a4ef48224ae..28cdc2af2131 100644
--- a/Documentation/kernel-docs.txt
+++ b/Documentation/kernel-docs.txt
@@ -715,14 +715,14 @@
715 715
716 * Name: "Gary's Encyclopedia - The Linux Kernel" 716 * Name: "Gary's Encyclopedia - The Linux Kernel"
717 Author: Gary (I suppose...). 717 Author: Gary (I suppose...).
718 URL: http://www.lisoleg.net/cgi-bin/lisoleg.pl?view=kernel.htm 718 URL: http://slencyclopedia.berlios.de/index.html
719 Keywords: links, not found here?. 719 Keywords: linux, community, everything!
720 Description: Gary's Encyclopedia exists to allow the rapid finding 720 Description: Gary's Encyclopedia exists to allow the rapid finding
721 of documentation and other information of interest to GNU/Linux 721 of documentation and other information of interest to GNU/Linux
722 users. It has about 4000 links to external pages in 150 major 722 users. It has about 4000 links to external pages in 150 major
723 categories. This link is for kernel-specific links, documents, 723 categories. This link is for kernel-specific links, documents,
724 sites... Look there if you could not find here what you were 724 sites... This list is now hosted by developer.Berlios.de,
725 looking for. 725 but seems not to have been updated since sometime in 1999.
726 726
727 * Name: "The home page of Linux-MM" 727 * Name: "The home page of Linux-MM"
728 Author: The Linux-MM team. 728 Author: The Linux-MM team.
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index cdd5b934f43e..e07c432c731f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -398,9 +398,6 @@ and is between 256 and 4096 characters. It is defined in the file
398 cio_ignore= [S390] 398 cio_ignore= [S390]
399 See Documentation/s390/CommonIO for details. 399 See Documentation/s390/CommonIO for details.
400 400
401 cio_msg= [S390]
402 See Documentation/s390/CommonIO for details.
403
404 clock= [BUGS=X86-32, HW] gettimeofday clocksource override. 401 clock= [BUGS=X86-32, HW] gettimeofday clocksource override.
405 [Deprecated] 402 [Deprecated]
406 Forces specified clocksource (if available) to be used 403 Forces specified clocksource (if available) to be used
@@ -689,6 +686,12 @@ and is between 256 and 4096 characters. It is defined in the file
689 floppy= [HW] 686 floppy= [HW]
690 See Documentation/floppy.txt. 687 See Documentation/floppy.txt.
691 688
689 force_pal_cache_flush
690 [IA-64] Avoid check_sal_cache_flush which may hang on
691 buggy SAL_CACHE_FLUSH implementations. Using this
692 parameter will force ia64_sal_cache_flush to call
693 ia64_pal_cache_flush instead of SAL_CACHE_FLUSH.
694
692 gamecon.map[2|3]= 695 gamecon.map[2|3]=
693 [HW,JOY] Multisystem joystick and NES/SNES/PSX pad 696 [HW,JOY] Multisystem joystick and NES/SNES/PSX pad
694 support via parallel port (up to 5 devices per port) 697 support via parallel port (up to 5 devices per port)
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index bf3256e04027..51a8021ee532 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -305,7 +305,7 @@ should not be manipulated by any other user.
305 305
306A kset keeps its children in a standard kernel linked list. Kobjects point 306A kset keeps its children in a standard kernel linked list. Kobjects point
307back to their containing kset via their kset field. In almost all cases, 307back to their containing kset via their kset field. In almost all cases,
308the kobjects belonging to a ket have that kset (or, strictly, its embedded 308the kobjects belonging to a kset have that kset (or, strictly, its embedded
309kobject) in their parent. 309kobject) in their parent.
310 310
311As a kset contains a kobject within it, it should always be dynamically 311As a kset contains a kobject within it, it should always be dynamically
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 01c6c3d8a7e3..64b3f146e4b0 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -503,7 +503,7 @@ generate input device EV_KEY events.
503In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW 503In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW
504events for switches: 504events for switches:
505 505
506SW_RADIO T60 and later hardare rfkill rocker switch 506SW_RFKILL_ALL T60 and later hardare rfkill rocker switch
507SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A 507SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A
508 508
509Non hot-key ACPI HKEY event map: 509Non hot-key ACPI HKEY event map:
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 3be8ab2a886a..82fafe0429fe 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -157,6 +157,9 @@ struct virtqueue
157 157
158 /* The routine to call when the Guest pings us. */ 158 /* The routine to call when the Guest pings us. */
159 void (*handle_output)(int fd, struct virtqueue *me); 159 void (*handle_output)(int fd, struct virtqueue *me);
160
161 /* Outstanding buffers */
162 unsigned int inflight;
160}; 163};
161 164
162/* Remember the arguments to the program so we can "reboot" */ 165/* Remember the arguments to the program so we can "reboot" */
@@ -702,6 +705,7 @@ static unsigned get_vq_desc(struct virtqueue *vq,
702 errx(1, "Looped descriptor"); 705 errx(1, "Looped descriptor");
703 } while ((i = next_desc(vq, i)) != vq->vring.num); 706 } while ((i = next_desc(vq, i)) != vq->vring.num);
704 707
708 vq->inflight++;
705 return head; 709 return head;
706} 710}
707 711
@@ -719,6 +723,7 @@ static void add_used(struct virtqueue *vq, unsigned int head, int len)
719 /* Make sure buffer is written before we update index. */ 723 /* Make sure buffer is written before we update index. */
720 wmb(); 724 wmb();
721 vq->vring.used->idx++; 725 vq->vring.used->idx++;
726 vq->inflight--;
722} 727}
723 728
724/* This actually sends the interrupt for this virtqueue */ 729/* This actually sends the interrupt for this virtqueue */
@@ -726,8 +731,9 @@ static void trigger_irq(int fd, struct virtqueue *vq)
726{ 731{
727 unsigned long buf[] = { LHREQ_IRQ, vq->config.irq }; 732 unsigned long buf[] = { LHREQ_IRQ, vq->config.irq };
728 733
729 /* If they don't want an interrupt, don't send one. */ 734 /* If they don't want an interrupt, don't send one, unless empty. */
730 if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) 735 if ((vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
736 && vq->inflight)
731 return; 737 return;
732 738
733 /* Send the Guest an interrupt tell them we used something up. */ 739 /* Send the Guest an interrupt tell them we used something up. */
@@ -1107,6 +1113,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1107 vq->next = NULL; 1113 vq->next = NULL;
1108 vq->last_avail_idx = 0; 1114 vq->last_avail_idx = 0;
1109 vq->dev = dev; 1115 vq->dev = dev;
1116 vq->inflight = 0;
1110 1117
1111 /* Initialize the configuration. */ 1118 /* Initialize the configuration. */
1112 vq->config.num = num_descs; 1119 vq->config.num = num_descs;
@@ -1368,6 +1375,7 @@ static void setup_tun_net(const char *arg)
1368 1375
1369 /* Tell Guest what MAC address to use. */ 1376 /* Tell Guest what MAC address to use. */
1370 add_feature(dev, VIRTIO_NET_F_MAC); 1377 add_feature(dev, VIRTIO_NET_F_MAC);
1378 add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY);
1371 set_config(dev, sizeof(conf), &conf); 1379 set_config(dev, sizeof(conf), &conf);
1372 1380
1373 /* We don't need the socket any more; setup is done. */ 1381 /* We don't need the socket any more; setup is done. */
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index e5a819a4f0c9..f5b7127f54ac 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -994,7 +994,17 @@ The Linux kernel has eight basic CPU memory barriers:
994 DATA DEPENDENCY read_barrier_depends() smp_read_barrier_depends() 994 DATA DEPENDENCY read_barrier_depends() smp_read_barrier_depends()
995 995
996 996
997All CPU memory barriers unconditionally imply compiler barriers. 997All memory barriers except the data dependency barriers imply a compiler
998barrier. Data dependencies do not impose any additional compiler ordering.
999
1000Aside: In the case of data dependencies, the compiler would be expected to
1001issue the loads in the correct order (eg. `a[b]` would have to load the value
1002of b before loading a[b]), however there is no guarantee in the C specification
1003that the compiler may not speculate the value of b (eg. is equal to 1) and load
1004a before b (eg. tmp = a[1]; if (b != 1) tmp = a[b]; ). There is also the
1005problem of a compiler reloading b after having loaded a[b], thus having a newer
1006copy of b than a[b]. A consensus has not yet been reached about these problems,
1007however the ACCESS_ONCE macro is a good place to start looking.
998 1008
999SMP memory barriers are reduced to compiler barriers on uniprocessor compiled 1009SMP memory barriers are reduced to compiler barriers on uniprocessor compiled
1000systems because it is assumed that a CPU will appear to be self-consistent, 1010systems because it is assumed that a CPU will appear to be self-consistent,
diff --git a/Documentation/networking/arcnet.txt b/Documentation/networking/arcnet.txt
index 770fc41a78e8..796012540386 100644
--- a/Documentation/networking/arcnet.txt
+++ b/Documentation/networking/arcnet.txt
@@ -46,7 +46,7 @@ These are the ARCnet drivers for Linux.
46 46
47 47
48This new release (2.91) has been put together by David Woodhouse 48This new release (2.91) has been put together by David Woodhouse
49<dwmw2@cam.ac.uk>, in an attempt to tidy up the driver after adding support 49<dwmw2@infradead.org>, in an attempt to tidy up the driver after adding support
50for yet another chipset. Now the generic support has been separated from the 50for yet another chipset. Now the generic support has been separated from the
51individual chipset drivers, and the source files aren't quite so packed with 51individual chipset drivers, and the source files aren't quite so packed with
52#ifdefs! I've changed this file a bit, but kept it in the first person from 52#ifdefs! I've changed this file a bit, but kept it in the first person from
diff --git a/Documentation/networking/bridge.txt b/Documentation/networking/bridge.txt
index bdae2db4119c..bec69a8a1697 100644
--- a/Documentation/networking/bridge.txt
+++ b/Documentation/networking/bridge.txt
@@ -1,6 +1,6 @@
1In order to use the Ethernet bridging functionality, you'll need the 1In order to use the Ethernet bridging functionality, you'll need the
2userspace tools. These programs and documentation are available 2userspace tools. These programs and documentation are available
3at http://bridge.sourceforge.net. The download page is 3at http://www.linux-foundation.org/en/Net:Bridge. The download page is
4http://prdownloads.sourceforge.net/bridge. 4http://prdownloads.sourceforge.net/bridge.
5 5
6If you still have questions, don't hesitate to post to the mailing list 6If you still have questions, don't hesitate to post to the mailing list
diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885
index 929b90c8387f..191194ea1e25 100644
--- a/Documentation/video4linux/CARDLIST.cx23885
+++ b/Documentation/video4linux/CARDLIST.cx23885
@@ -5,6 +5,6 @@
5 4 -> DViCO FusionHDTV5 Express [18ac:d500] 5 4 -> DViCO FusionHDTV5 Express [18ac:d500]
6 5 -> Hauppauge WinTV-HVR1500Q [0070:7790,0070:7797] 6 5 -> Hauppauge WinTV-HVR1500Q [0070:7790,0070:7797]
7 6 -> Hauppauge WinTV-HVR1500 [0070:7710,0070:7717] 7 6 -> Hauppauge WinTV-HVR1500 [0070:7710,0070:7717]
8 7 -> Hauppauge WinTV-HVR1200 [0070:71d1] 8 7 -> Hauppauge WinTV-HVR1200 [0070:71d1,0070:71d3]
9 8 -> Hauppauge WinTV-HVR1700 [0070:8101] 9 8 -> Hauppauge WinTV-HVR1700 [0070:8101]
10 9 -> Hauppauge WinTV-HVR1400 [0070:8010] 10 9 -> Hauppauge WinTV-HVR1400 [0070:8010]
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 543957346469..7cf5685d3645 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -60,7 +60,7 @@
60 59 -> DViCO FusionHDTV 5 PCI nano [18ac:d530] 60 59 -> DViCO FusionHDTV 5 PCI nano [18ac:d530]
61 60 -> Pinnacle Hybrid PCTV [12ab:1788] 61 60 -> Pinnacle Hybrid PCTV [12ab:1788]
62 61 -> Winfast TV2000 XP Global [107d:6f18] 62 61 -> Winfast TV2000 XP Global [107d:6f18]
63 62 -> PowerColor Real Angel 330 [14f1:ea3d] 63 62 -> PowerColor RA330 [14f1:ea3d]
64 63 -> Geniatech X8000-MT DVBT [14f1:8852] 64 63 -> Geniatech X8000-MT DVBT [14f1:8852]
65 64 -> DViCO FusionHDTV DVB-T PRO [18ac:db30] 65 64 -> DViCO FusionHDTV DVB-T PRO [18ac:db30]
66 65 -> DViCO FusionHDTV 7 Gold [18ac:d610] 66 65 -> DViCO FusionHDTV 7 Gold [18ac:d610]
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index f40e09296f30..1d6a245c828f 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -14,4 +14,4 @@
14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] 14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047]
15 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) 15 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840)
16 15 -> V-Gear PocketTV (em2800) 16 15 -> V-Gear PocketTV (em2800)
17 16 -> Hauppauge WinTV HVR 950 (em2880) [2040:6513] 17 16 -> Hauppauge WinTV HVR 950 (em2880) [2040:6513,2040:6517,2040:651b,2040:651f]
diff --git a/Documentation/video4linux/cx18.txt b/Documentation/video4linux/cx18.txt
index 077d56ec3f3d..6842c262890f 100644
--- a/Documentation/video4linux/cx18.txt
+++ b/Documentation/video4linux/cx18.txt
@@ -1,7 +1,9 @@
1Some notes regarding the cx18 driver for the Conexant CX23418 MPEG 1Some notes regarding the cx18 driver for the Conexant CX23418 MPEG
2encoder chip: 2encoder chip:
3 3
41) The only hardware currently supported is the Hauppauge HVR-1600. 41) The only hardware currently supported is the Hauppauge HVR-1600
5 card and the Compro VideoMate H900 (note that this card only
6 supports analog input, it has no digital tuner!).
5 7
62) Some people have problems getting the i2c bus to work. Cause unknown. 82) Some people have problems getting the i2c bus to work. Cause unknown.
7 The symptom is that the eeprom cannot be read and the card is 9 The symptom is that the eeprom cannot be read and the card is
diff --git a/Documentation/vm/pagemap.txt b/Documentation/vm/pagemap.txt
new file mode 100644
index 000000000000..ce72c0fe6177
--- /dev/null
+++ b/Documentation/vm/pagemap.txt
@@ -0,0 +1,77 @@
1pagemap, from the userspace perspective
2---------------------------------------
3
4pagemap is a new (as of 2.6.25) set of interfaces in the kernel that allow
5userspace programs to examine the page tables and related information by
6reading files in /proc.
7
8There are three components to pagemap:
9
10 * /proc/pid/pagemap. This file lets a userspace process find out which
11 physical frame each virtual page is mapped to. It contains one 64-bit
12 value for each virtual page, containing the following data (from
13 fs/proc/task_mmu.c, above pagemap_read):
14
15 * Bits 0-55 page frame number (PFN) if present
16 * Bits 0-4 swap type if swapped
17 * Bits 5-55 swap offset if swapped
18 * Bits 55-60 page shift (page size = 1<<page shift)
19 * Bit 61 reserved for future use
20 * Bit 62 page swapped
21 * Bit 63 page present
22
23 If the page is not present but in swap, then the PFN contains an
24 encoding of the swap file number and the page's offset into the
25 swap. Unmapped pages return a null PFN. This allows determining
26 precisely which pages are mapped (or in swap) and comparing mapped
27 pages between processes.
28
29 Efficient users of this interface will use /proc/pid/maps to
30 determine which areas of memory are actually mapped and llseek to
31 skip over unmapped regions.
32
33 * /proc/kpagecount. This file contains a 64-bit count of the number of
34 times each page is mapped, indexed by PFN.
35
36 * /proc/kpageflags. This file contains a 64-bit set of flags for each
37 page, indexed by PFN.
38
39 The flags are (from fs/proc/proc_misc, above kpageflags_read):
40
41 0. LOCKED
42 1. ERROR
43 2. REFERENCED
44 3. UPTODATE
45 4. DIRTY
46 5. LRU
47 6. ACTIVE
48 7. SLAB
49 8. WRITEBACK
50 9. RECLAIM
51 10. BUDDY
52
53Using pagemap to do something useful:
54
55The general procedure for using pagemap to find out about a process' memory
56usage goes like this:
57
58 1. Read /proc/pid/maps to determine which parts of the memory space are
59 mapped to what.
60 2. Select the maps you are interested in -- all of them, or a particular
61 library, or the stack or the heap, etc.
62 3. Open /proc/pid/pagemap and seek to the pages you would like to examine.
63 4. Read a u64 for each page from pagemap.
64 5. Open /proc/kpagecount and/or /proc/kpageflags. For each PFN you just
65 read, seek to that entry in the file, and read the data you want.
66
67For example, to find the "unique set size" (USS), which is the amount of
68memory that a process is using that is not shared with any other process,
69you can go through every map in the process, find the PFNs, look those up
70in kpagecount, and tally up the number of pages that are only referenced
71once.
72
73Other notes:
74
75Reading from any of the files will return -EINVAL if you are not starting
76the read on an 8-byte boundary (e.g., if you seeked an odd number of bytes
77into the file), or if the size of the read is not a multiple of 8 bytes.
diff --git a/Kbuild b/Kbuild
index 32f19c5c9bb0..e750e9c3fe59 100644
--- a/Kbuild
+++ b/Kbuild
@@ -96,5 +96,4 @@ missing-syscalls: scripts/checksyscalls.sh FORCE
96 $(call cmd,syscalls) 96 $(call cmd,syscalls)
97 97
98# Delete all targets during make clean 98# Delete all targets during make clean
99clean-files := $(addprefix $(objtree)/,$(targets)) 99clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets)))
100
diff --git a/MAINTAINERS b/MAINTAINERS
index f5583dc7ea39..cd587eec9fa7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -228,21 +228,21 @@ ACPI BATTERY DRIVERS
228P: Alexey Starikovskiy 228P: Alexey Starikovskiy
229M: astarikovskiy@suse.de 229M: astarikovskiy@suse.de
230L: linux-acpi@vger.kernel.org 230L: linux-acpi@vger.kernel.org
231W: http://acpi.sourceforge.net/ 231W: http://www.lesswatts.org/projects/acpi/
232S: Supported 232S: Supported
233 233
234ACPI EC DRIVER 234ACPI EC DRIVER
235P: Alexey Starikovskiy 235P: Alexey Starikovskiy
236M: astarikovskiy@suse.de 236M: astarikovskiy@suse.de
237L: linux-acpi@vger.kernel.org 237L: linux-acpi@vger.kernel.org
238W: http://acpi.sourceforge.net/ 238W: http://www.lesswatts.org/projects/acpi/
239S: Supported 239S: Supported
240 240
241ACPI FAN DRIVER 241ACPI FAN DRIVER
242P: Len Brown 242P: Len Brown
243M: len.brown@intel.com 243M: len.brown@intel.com
244L: linux-acpi@vger.kernel.org 244L: linux-acpi@vger.kernel.org
245W: http://acpi.sourceforge.net/ 245W: http://www.lesswatts.org/projects/acpi/
246S: Supported 246S: Supported
247 247
248ACPI PCI HOTPLUG DRIVER 248ACPI PCI HOTPLUG DRIVER
@@ -255,14 +255,14 @@ ACPI THERMAL DRIVER
255P: Len Brown 255P: Len Brown
256M: len.brown@intel.com 256M: len.brown@intel.com
257L: linux-acpi@vger.kernel.org 257L: linux-acpi@vger.kernel.org
258W: http://acpi.sourceforge.net/ 258W: http://www.lesswatts.org/projects/acpi/
259S: Supported 259S: Supported
260 260
261ACPI VIDEO DRIVER 261ACPI VIDEO DRIVER
262P: Rui Zhang 262P: Rui Zhang
263M: rui.zhang@intel.com 263M: rui.zhang@intel.com
264L: linux-acpi@vger.kernel.org 264L: linux-acpi@vger.kernel.org
265W: http://acpi.sourceforge.net/ 265W: http://www.lesswatts.org/projects/acpi/
266S: Supported 266S: Supported
267 267
268ACPI WMI DRIVER 268ACPI WMI DRIVER
@@ -274,7 +274,7 @@ S: Maintained
274 274
275AD1889 ALSA SOUND DRIVER 275AD1889 ALSA SOUND DRIVER
276P: Kyle McMartin 276P: Kyle McMartin
277M: kyle@parisc-linux.org 277M: kyle@mcmartin.ca
278P: Thibaut Varene 278P: Thibaut Varene
279M: T-Bone@parisc-linux.org 279M: T-Bone@parisc-linux.org
280W: http://wiki.parisc-linux.org/AD1889 280W: http://wiki.parisc-linux.org/AD1889
@@ -367,12 +367,12 @@ S: Maintained for 2.4; PCI support for 2.6.
367AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER 367AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER
368P: Thomas Dahlmann 368P: Thomas Dahlmann
369M: thomas.dahlmann@amd.com 369M: thomas.dahlmann@amd.com
370L: info-linux@geode.amd.com (subscribers-only) 370L: linux-geode@lists.infradead.org (moderated for non-subscribers)
371S: Supported 371S: Supported
372 372
373AMD GEODE PROCESSOR/CHIPSET SUPPORT 373AMD GEODE PROCESSOR/CHIPSET SUPPORT
374P: Jordan Crouse 374P: Jordan Crouse
375L: info-linux@geode.amd.com (subscribers-only) 375L: linux-geode@lists.infradead.org (moderated for non-subscribers)
376W: http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html 376W: http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html
377S: Supported 377S: Supported
378 378
@@ -982,13 +982,6 @@ L: bonding-devel@lists.sourceforge.net
982W: http://sourceforge.net/projects/bonding/ 982W: http://sourceforge.net/projects/bonding/
983S: Supported 983S: Supported
984 984
985BROADBAND PROCESSOR ARCHITECTURE
986P: Arnd Bergmann
987M: arnd@arndb.de
988L: linuxppc-dev@ozlabs.org
989W: http://www.penguinppc.org/ppc64/
990S: Supported
991
992BROADCOM B44 10/100 ETHERNET DRIVER 985BROADCOM B44 10/100 ETHERNET DRIVER
993P: Gary Zambrano 986P: Gary Zambrano
994M: zambrano@broadcom.com 987M: zambrano@broadcom.com
@@ -1002,8 +995,8 @@ L: netdev@vger.kernel.org
1002S: Supported 995S: Supported
1003 996
1004BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER 997BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
1005P: Eliezer Tamir 998P: Eilon Greenstein
1006M: eliezert@broadcom.com 999M: eilong@broadcom.com
1007L: netdev@vger.kernel.org 1000L: netdev@vger.kernel.org
1008S: Supported 1001S: Supported
1009 1002
@@ -1052,6 +1045,14 @@ L: linux-kernel@vger.kernel.org
1052L: discuss@x86-64.org 1045L: discuss@x86-64.org
1053S: Maintained 1046S: Maintained
1054 1047
1048CELL BROADBAND ENGINE ARCHITECTURE
1049P: Arnd Bergmann
1050M: arnd@arndb.de
1051L: linuxppc-dev@ozlabs.org
1052L: cbe-oss-dev@ozlabs.org
1053W: http://www.ibm.com/developerworks/power/cell/
1054S: Supported
1055
1055CFAG12864B LCD DRIVER 1056CFAG12864B LCD DRIVER
1056P: Miguel Ojeda Sandonis 1057P: Miguel Ojeda Sandonis
1057M: maxextreme@gmail.com 1058M: maxextreme@gmail.com
@@ -1201,6 +1202,7 @@ M: pj@sgi.com
1201M: menage@google.com 1202M: menage@google.com
1202L: linux-kernel@vger.kernel.org 1203L: linux-kernel@vger.kernel.org
1203W: http://www.bullopensource.org/cpuset/ 1204W: http://www.bullopensource.org/cpuset/
1205W: http://oss.sgi.com/projects/cpusets/
1204S: Supported 1206S: Supported
1205 1207
1206CRAMFS FILESYSTEM 1208CRAMFS FILESYSTEM
@@ -1230,6 +1232,29 @@ P: Jaya Kumar
1230M: jayakumar.alsa@gmail.com 1232M: jayakumar.alsa@gmail.com
1231S: Maintained 1233S: Maintained
1232 1234
1235CX18 VIDEO4LINUX DRIVER
1236P: Hans Verkuil, Andy Walls
1237M: hverkuil@xs4all.nl, awalls@radix.net
1238L: ivtv-devel@ivtvdriver.org
1239L: ivtv-users@ivtvdriver.org
1240L: video4linux-list@redhat.com
1241W: http://linuxtv.org
1242S: Maintained
1243
1244CXGB3 ETHERNET DRIVER (CXGB3)
1245P: Divy Le Ray
1246M: divy@chelsio.com
1247L: netdev@vger.kernel.org
1248W: http://www.chelsio.com
1249S: Supported
1250
1251CXGB3 IWARP RNIC DRIVER (IW_CXGB3)
1252P: Steve Wise
1253M: swise@chelsio.com
1254L: general@lists.openfabrics.org
1255W: http://www.openfabrics.org
1256S: Supported
1257
1233CYBERPRO FB DRIVER 1258CYBERPRO FB DRIVER
1234P: Russell King 1259P: Russell King
1235M: rmk@arm.linux.org.uk 1260M: rmk@arm.linux.org.uk
@@ -1587,7 +1612,7 @@ ETHERNET BRIDGE
1587P: Stephen Hemminger 1612P: Stephen Hemminger
1588M: shemminger@linux-foundation.org 1613M: shemminger@linux-foundation.org
1589L: bridge@lists.linux-foundation.org 1614L: bridge@lists.linux-foundation.org
1590W: http://bridge.sourceforge.net/ 1615W: http://www.linux-foundation.org/en/Net:Bridge
1591S: Maintained 1616S: Maintained
1592 1617
1593ETHERTEAM 16I DRIVER 1618ETHERTEAM 16I DRIVER
@@ -1636,8 +1661,10 @@ W: http://linux-fbdev.sourceforge.net/
1636S: Maintained 1661S: Maintained
1637 1662
1638FREESCALE DMA DRIVER 1663FREESCALE DMA DRIVER
1639P; Zhang Wei 1664P: Li Yang
1640M: wei.zhang@freescale.com 1665M: leoli@freescale.com
1666P: Zhang Wei
1667M: zw@zh-kernel.org
1641L: linuxppc-embedded@ozlabs.org 1668L: linuxppc-embedded@ozlabs.org
1642L: linux-kernel@vger.kernel.org 1669L: linux-kernel@vger.kernel.org
1643S: Maintained 1670S: Maintained
@@ -1801,7 +1828,7 @@ S: Maintained
1801 1828
1802HARMONY SOUND DRIVER 1829HARMONY SOUND DRIVER
1803P: Kyle McMartin 1830P: Kyle McMartin
1804M: kyle@parisc-linux.org 1831M: kyle@mcmartin.ca
1805L: linux-parisc@vger.kernel.org 1832L: linux-parisc@vger.kernel.org
1806S: Maintained 1833S: Maintained
1807 1834
@@ -1931,8 +1958,10 @@ L: lm-sensors@lm-sensors.org
1931S: Maintained 1958S: Maintained
1932 1959
1933I2C SUBSYSTEM 1960I2C SUBSYSTEM
1934P: Jean Delvare 1961P: Jean Delvare (PC drivers, core)
1935M: khali@linux-fr.org 1962M: khali@linux-fr.org
1963P: Ben Dooks (embedded platforms)
1964M: ben-linux@fluff.org
1936L: i2c@lm-sensors.org 1965L: i2c@lm-sensors.org
1937T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/ 1966T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
1938S: Maintained 1967S: Maintained
@@ -2318,7 +2347,8 @@ S: Maintained
2318KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*) 2347KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*)
2319P: Sam Ravnborg 2348P: Sam Ravnborg
2320M: sam@ravnborg.org 2349M: sam@ravnborg.org
2321T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git 2350T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild-next.git
2351T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild-fixes.git
2322L: linux-kbuild@vger.kernel.org 2352L: linux-kbuild@vger.kernel.org
2323S: Maintained 2353S: Maintained
2324 2354
@@ -2340,24 +2370,24 @@ S: Supported
2340KERNEL VIRTUAL MACHINE (KVM) 2370KERNEL VIRTUAL MACHINE (KVM)
2341P: Avi Kivity 2371P: Avi Kivity
2342M: avi@qumranet.com 2372M: avi@qumranet.com
2343L: kvm-devel@lists.sourceforge.net 2373L: kvm@vger.kernel.org
2344W: kvm.sourceforge.net 2374W: http://kvm.qumranet.com
2345S: Supported 2375S: Supported
2346 2376
2347KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC 2377KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC
2348P: Hollis Blanchard 2378P: Hollis Blanchard
2349M: hollisb@us.ibm.com 2379M: hollisb@us.ibm.com
2350L: kvm-ppc-devel@lists.sourceforge.net 2380L: kvm-ppc@vger.kernel.org
2351W: kvm.sourceforge.net 2381W: http://kvm.qumranet.com
2352S: Supported 2382S: Supported
2353 2383
2354KERNEL VIRTUAL MACHINE For Itanium(KVM/IA64) 2384KERNEL VIRTUAL MACHINE For Itanium (KVM/IA64)
2355P: Anthony Xu 2385P: Anthony Xu
2356M: anthony.xu@intel.com 2386M: anthony.xu@intel.com
2357P: Xiantao Zhang 2387P: Xiantao Zhang
2358M: xiantao.zhang@intel.com 2388M: xiantao.zhang@intel.com
2359L: kvm-ia64-devel@lists.sourceforge.net 2389L: kvm-ia64@vger.kernel.org
2360W: kvm.sourceforge.net 2390W: http://kvm.qumranet.com
2361S: Supported 2391S: Supported
2362 2392
2363KERNEL VIRTUAL MACHINE for s390 (KVM/s390) 2393KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
@@ -2536,7 +2566,6 @@ LINUX SECURITY MODULE (LSM) FRAMEWORK
2536P: Chris Wright 2566P: Chris Wright
2537M: chrisw@sous-sol.org 2567M: chrisw@sous-sol.org
2538L: linux-security-module@vger.kernel.org 2568L: linux-security-module@vger.kernel.org
2539W: http://lsm.immunix.org
2540T: git kernel.org:/pub/scm/linux/kernel/git/chrisw/lsm-2.6.git 2569T: git kernel.org:/pub/scm/linux/kernel/git/chrisw/lsm-2.6.git
2541S: Supported 2570S: Supported
2542 2571
@@ -2808,6 +2837,15 @@ M: jirislaby@gmail.com
2808L: linux-kernel@vger.kernel.org 2837L: linux-kernel@vger.kernel.org
2809S: Maintained 2838S: Maintained
2810 2839
2840MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
2841P: Andrew Gallatin
2842M: gallatin@myri.com
2843P: Brice Goglin
2844M: brice@myri.com
2845L: netdev@vger.kernel.org
2846W: http://www.myri.com/scs/download-Myri10GE.html
2847S: Supported
2848
2811NATSEMI ETHERNET DRIVER (DP8381x) 2849NATSEMI ETHERNET DRIVER (DP8381x)
2812P: Tim Hockin 2850P: Tim Hockin
2813M: thockin@hockin.org 2851M: thockin@hockin.org
@@ -2828,8 +2866,8 @@ S: Maintained
2828NETEFFECT IWARP RNIC DRIVER (IW_NES) 2866NETEFFECT IWARP RNIC DRIVER (IW_NES)
2829P: Faisal Latif 2867P: Faisal Latif
2830M: flatif@neteffect.com 2868M: flatif@neteffect.com
2831P: Nishi Gupta 2869P: Chien Tung
2832M: ngupta@neteffect.com 2870M: ctung@neteffect.com
2833P: Glenn Streiff 2871P: Glenn Streiff
2834M: gstreiff@neteffect.com 2872M: gstreiff@neteffect.com
2835L: general@lists.openfabrics.org 2873L: general@lists.openfabrics.org
@@ -3083,7 +3121,7 @@ S: Maintained
3083 3121
3084PARISC ARCHITECTURE 3122PARISC ARCHITECTURE
3085P: Kyle McMartin 3123P: Kyle McMartin
3086M: kyle@parisc-linux.org 3124M: kyle@mcmartin.ca
3087P: Matthew Wilcox 3125P: Matthew Wilcox
3088M: matthew@wil.cx 3126M: matthew@wil.cx
3089P: Grant Grundler 3127P: Grant Grundler
@@ -3121,7 +3159,7 @@ PCI ERROR RECOVERY
3121P: Linas Vepstas 3159P: Linas Vepstas
3122M: linas@austin.ibm.com 3160M: linas@austin.ibm.com
3123L: linux-kernel@vger.kernel.org 3161L: linux-kernel@vger.kernel.org
3124L: linux-pci@atrey.karlin.mff.cuni.cz 3162L: linux-pci@vger.kernel.org
3125S: Supported 3163S: Supported
3126 3164
3127PCI SUBSYSTEM 3165PCI SUBSYSTEM
@@ -3227,7 +3265,7 @@ S: Maintained
3227 3265
3228PPP OVER ETHERNET 3266PPP OVER ETHERNET
3229P: Michal Ostrowski 3267P: Michal Ostrowski
3230M: mostrows@speakeasy.net 3268M: mostrows@earthlink.net
3231S: Maintained 3269S: Maintained
3232 3270
3233PPP OVER L2TP 3271PPP OVER L2TP
@@ -3292,9 +3330,11 @@ L: video4linux-list@redhat.com
3292W: http://www.isely.net/pvrusb2/ 3330W: http://www.isely.net/pvrusb2/
3293S: Maintained 3331S: Maintained
3294 3332
3295PXA2xx SUPPORT 3333PXA2xx/PXA3xx SUPPORT
3296P: Nicolas Pitre 3334P: Eric Miao
3297M: nico@cam.org 3335M: eric.miao@marvell.com
3336P: Russell King
3337M: linux@arm.linux.org.uk
3298L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 3338L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
3299S: Maintained 3339S: Maintained
3300 3340
@@ -3401,10 +3441,7 @@ L: rtc-linux@googlegroups.com
3401S: Maintained 3441S: Maintained
3402 3442
3403REISERFS FILE SYSTEM 3443REISERFS FILE SYSTEM
3404P: Hans Reiser
3405M: reiserfs-dev@namesys.com
3406L: reiserfs-devel@vger.kernel.org 3444L: reiserfs-devel@vger.kernel.org
3407W: http://www.namesys.com
3408S: Supported 3445S: Supported
3409 3446
3410RFKILL 3447RFKILL
@@ -3624,13 +3661,6 @@ M: romieu@fr.zoreil.com
3624L: netdev@vger.kernel.org 3661L: netdev@vger.kernel.org
3625S: Maintained 3662S: Maintained
3626 3663
3627SIS 5513 IDE CONTROLLER DRIVER
3628P: Lionel Bouton
3629M: Lionel.Bouton@inet6.fr
3630W: http://inet6.dyn.dhs.org/sponsoring/sis5513/index.html
3631W: http://gyver.homeip.net/sis5513/index.html
3632S: Maintained
3633
3634SIS 900/7016 FAST ETHERNET DRIVER 3664SIS 900/7016 FAST ETHERNET DRIVER
3635P: Daniele Venzano 3665P: Daniele Venzano
3636M: venza@brownhat.org 3666M: venza@brownhat.org
@@ -3755,6 +3785,14 @@ M: dbrownell@users.sourceforge.net
3755L: spi-devel-general@lists.sourceforge.net 3785L: spi-devel-general@lists.sourceforge.net
3756S: Maintained 3786S: Maintained
3757 3787
3788SPU FILE SYSTEM
3789P: Jeremy Kerr
3790M: jk@ozlabs.org
3791L: linuxppc-dev@ozlabs.org
3792L: cbe-oss-dev@ozlabs.org
3793W: http://www.ibm.com/developerworks/power/cell/
3794S: Supported
3795
3758STABLE BRANCH: 3796STABLE BRANCH:
3759P: Greg Kroah-Hartman 3797P: Greg Kroah-Hartman
3760M: greg@kroah.com 3798M: greg@kroah.com
@@ -3988,7 +4026,7 @@ TULIP NETWORK DRIVERS
3988P: Grant Grundler 4026P: Grant Grundler
3989M: grundler@parisc-linux.org 4027M: grundler@parisc-linux.org
3990P: Kyle McMartin 4028P: Kyle McMartin
3991M: kyle@parisc-linux.org 4029M: kyle@mcmartin.ca
3992L: netdev@vger.kernel.org 4030L: netdev@vger.kernel.org
3993S: Maintained 4031S: Maintained
3994 4032
@@ -4010,12 +4048,41 @@ M: ballabio_dario@emc.com
4010L: linux-scsi@vger.kernel.org 4048L: linux-scsi@vger.kernel.org
4011S: Maintained 4049S: Maintained
4012 4050
4051UCLINUX (AND M68KNOMMU)
4052P: Greg Ungerer
4053M: gerg@uclinux.org
4054W: http://www.uclinux.org/
4055L: uclinux-dev@uclinux.org (subscribers-only)
4056S: Maintained
4057
4058UCLINUX FOR NEC V850
4059P: Miles Bader
4060
4061UCLINUX FOR RENESAS H8/300
4062P: Yoshinori Sato
4063M: ysato@users.sourceforge.jp
4064W: http://uclinux-h8.sourceforge.jp/
4065S: Supported
4066
4013UDF FILESYSTEM 4067UDF FILESYSTEM
4014P: Jan Kara 4068P: Jan Kara
4015M: jack@suse.cz 4069M: jack@suse.cz
4016W: http://linux-udf.sourceforge.net 4070W: http://linux-udf.sourceforge.net
4017S: Maintained 4071S: Maintained
4018 4072
4073UFS FILESYSTEM
4074P: Evgeniy Dushistov
4075M: dushistov@mail.ru
4076L: linux-kernel@vger.kernel.org
4077S: Maintained
4078
4079UltraSPARC (sparc64):
4080P: David S. Miller
4081M: davem@davemloft.net
4082L: sparclinux@vger.kernel.org
4083T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
4084S: Maintained
4085
4019UNIFORM CDROM DRIVER 4086UNIFORM CDROM DRIVER
4020P: Jens Axboe 4087P: Jens Axboe
4021M: axboe@kernel.dk 4088M: axboe@kernel.dk
@@ -4062,6 +4129,13 @@ L: netdev@vger.kernel.org
4062W: http://www.linux-usb.org/usbnet 4129W: http://www.linux-usb.org/usbnet
4063S: Maintained 4130S: Maintained
4064 4131
4132USB DIAMOND RIO500 DRIVER
4133P: Cesar Miquel
4134M: miquel@df.uba.ar
4135L: rio500-users@lists.sourceforge.net
4136W: http://rio500.sourceforge.net
4137S: Maintained
4138
4065USB EHCI DRIVER 4139USB EHCI DRIVER
4066P: David Brownell 4140P: David Brownell
4067M: dbrownell@users.sourceforge.net 4141M: dbrownell@users.sourceforge.net
@@ -4293,6 +4367,14 @@ M: gregkh@suse.de
4293L: linux-kernel@vger.kernel.org 4367L: linux-kernel@vger.kernel.org
4294S: Maintained 4368S: Maintained
4295 4369
4370UTIL-LINUX-NG PACKAGE
4371P: Karel Zak
4372M: kzak@redhat.com
4373L: util-linux-ng@vger.kernel.org
4374W: http://kernel.org/~kzak/util-linux-ng/
4375T: git://git.kernel.org/pub/scm/utils/util-linux-ng/util-linux-ng.git
4376S: Maintained
4377
4296VFAT/FAT/MSDOS FILESYSTEM: 4378VFAT/FAT/MSDOS FILESYSTEM:
4297P: OGAWA Hirofumi 4379P: OGAWA Hirofumi
4298M: hirofumi@mail.parknet.co.jp 4380M: hirofumi@mail.parknet.co.jp
@@ -4316,42 +4398,6 @@ M: romieu@fr.zoreil.com
4316L: netdev@vger.kernel.org 4398L: netdev@vger.kernel.org
4317S: Maintained 4399S: Maintained
4318 4400
4319UCLINUX (AND M68KNOMMU)
4320P: Greg Ungerer
4321M: gerg@uclinux.org
4322W: http://www.uclinux.org/
4323L: uclinux-dev@uclinux.org (subscribers-only)
4324S: Maintained
4325
4326UCLINUX FOR NEC V850
4327P: Miles Bader
4328
4329UCLINUX FOR RENESAS H8/300
4330P: Yoshinori Sato
4331M: ysato@users.sourceforge.jp
4332W: http://uclinux-h8.sourceforge.jp/
4333S: Supported
4334
4335UFS FILESYSTEM
4336P: Evgeniy Dushistov
4337M: dushistov@mail.ru
4338L: linux-kernel@vger.kernel.org
4339S: Maintained
4340
4341UltraSPARC (sparc64):
4342P: David S. Miller
4343M: davem@davemloft.net
4344L: sparclinux@vger.kernel.org
4345T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
4346S: Maintained
4347
4348USB DIAMOND RIO500 DRIVER
4349P: Cesar Miquel
4350M: miquel@df.uba.ar
4351L: rio500-users@lists.sourceforge.net
4352W: http://rio500.sourceforge.net
4353S: Maintained
4354
4355VIDEO FOR LINUX 4401VIDEO FOR LINUX
4356P: Mauro Carvalho Chehab 4402P: Mauro Carvalho Chehab
4357M: mchehab@infradead.org 4403M: mchehab@infradead.org
diff --git a/Makefile b/Makefile
index 3140145fdfe2..6923d669a4f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 26 3SUBLEVEL = 26
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc6
5NAME = Funky Weasel is Jiggy wit it 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
@@ -1114,6 +1114,7 @@ MRPROPER_DIRS += include/config include2 usr/include
1114MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 1114MRPROPER_FILES += .config .config.old include/asm .version .old_version \
1115 include/linux/autoconf.h include/linux/version.h \ 1115 include/linux/autoconf.h include/linux/version.h \
1116 include/linux/utsrelease.h \ 1116 include/linux/utsrelease.h \
1117 include/linux/bounds.h include/asm*/asm-offsets.h \
1117 Module.symvers tags TAGS cscope* 1118 Module.symvers tags TAGS cscope*
1118 1119
1119# clean - Delete most, but leave enough to build external modules 1120# clean - Delete most, but leave enough to build external modules
@@ -1431,7 +1432,7 @@ define xtags
1431 elif $1 --version 2>&1 | grep -iq emacs; then \ 1432 elif $1 --version 2>&1 | grep -iq emacs; then \
1432 $(all-sources) | xargs $1 -a; \ 1433 $(all-sources) | xargs $1 -a; \
1433 $(all-kconfigs) | xargs $1 -a \ 1434 $(all-kconfigs) | xargs $1 -a \
1434 --regex='/^[ \t]*(menu|)config[ \t]+\([a-zA-Z0-9_]+\)/\2/'; \ 1435 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'; \
1435 $(all-defconfigs) | xargs -r $1 -a \ 1436 $(all-defconfigs) | xargs -r $1 -a \
1436 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ 1437 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
1437 else \ 1438 else \
diff --git a/arch/alpha/kernel/init_task.c b/arch/alpha/kernel/init_task.c
index 835d09a7b332..1f762189fa64 100644
--- a/arch/alpha/kernel/init_task.c
+++ b/arch/alpha/kernel/init_task.c
@@ -9,7 +9,6 @@
9 9
10 10
11static struct fs_struct init_fs = INIT_FS; 11static struct fs_struct init_fs = INIT_FS;
12static struct files_struct init_files = INIT_FILES;
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 12static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/arm/boot/compressed/head-xscale.S b/arch/arm/boot/compressed/head-xscale.S
index 67ea99ef6521..dd3fbd6766e1 100644
--- a/arch/arm/boot/compressed/head-xscale.S
+++ b/arch/arm/boot/compressed/head-xscale.S
@@ -33,10 +33,6 @@ __XScale_start:
33 bic r0, r0, #0x1000 @ clear Icache 33 bic r0, r0, #0x1000 @ clear Icache
34 mcr p15, 0, r0, c1, c0, 0 34 mcr p15, 0, r0, c1, c0, 0
35 35
36#ifdef CONFIG_ARCH_COTULLA_IDP
37 mov r7, #MACH_TYPE_COTULLA_IDP
38#endif
39
40#ifdef CONFIG_ARCH_IXP2000 36#ifdef CONFIG_ARCH_IXP2000
41 mov r1, #-1 37 mov r1, #-1
42 mov r0, #0xd6000000 38 mov r0, #0xd6000000
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index ae21755872ed..d973c986f721 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -321,11 +321,42 @@ static void locomo_gpio_unmask_irq(unsigned int irq)
321 locomo_writel(r, mapbase + LOCOMO_GIE); 321 locomo_writel(r, mapbase + LOCOMO_GIE);
322} 322}
323 323
324static int GPIO_IRQ_rising_edge;
325static int GPIO_IRQ_falling_edge;
326
327static int locomo_gpio_type(unsigned int irq, unsigned int type)
328{
329 unsigned int mask;
330 void __iomem *mapbase = get_irq_chip_data(irq);
331
332 mask = 1 << (irq - LOCOMO_IRQ_GPIO_START);
333
334 if (type == IRQT_PROBE) {
335 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
336 return 0;
337 type = __IRQT_RISEDGE | __IRQT_FALEDGE;
338 }
339
340 if (type & __IRQT_RISEDGE)
341 GPIO_IRQ_rising_edge |= mask;
342 else
343 GPIO_IRQ_rising_edge &= ~mask;
344 if (type & __IRQT_FALEDGE)
345 GPIO_IRQ_falling_edge |= mask;
346 else
347 GPIO_IRQ_falling_edge &= ~mask;
348 locomo_writel(GPIO_IRQ_rising_edge, mapbase + LOCOMO_GRIE);
349 locomo_writel(GPIO_IRQ_falling_edge, mapbase + LOCOMO_GFIE);
350
351 return 0;
352}
353
324static struct irq_chip locomo_gpio_chip = { 354static struct irq_chip locomo_gpio_chip = {
325 .name = "LOCOMO-gpio", 355 .name = "LOCOMO-gpio",
326 .ack = locomo_gpio_ack_irq, 356 .ack = locomo_gpio_ack_irq,
327 .mask = locomo_gpio_mask_irq, 357 .mask = locomo_gpio_mask_irq,
328 .unmask = locomo_gpio_unmask_irq, 358 .unmask = locomo_gpio_unmask_irq,
359 .set_type = locomo_gpio_type,
329}; 360};
330 361
331static void locomo_lt_handler(unsigned int irq, struct irq_desc *desc) 362static void locomo_lt_handler(unsigned int irq, struct irq_desc *desc)
@@ -450,22 +481,18 @@ static void locomo_setup_irq(struct locomo *lchip)
450 set_irq_chip(IRQ_LOCOMO_KEY_BASE, &locomo_chip); 481 set_irq_chip(IRQ_LOCOMO_KEY_BASE, &locomo_chip);
451 set_irq_chip_data(IRQ_LOCOMO_KEY_BASE, irqbase); 482 set_irq_chip_data(IRQ_LOCOMO_KEY_BASE, irqbase);
452 set_irq_chained_handler(IRQ_LOCOMO_KEY_BASE, locomo_key_handler); 483 set_irq_chained_handler(IRQ_LOCOMO_KEY_BASE, locomo_key_handler);
453 set_irq_flags(IRQ_LOCOMO_KEY_BASE, IRQF_VALID | IRQF_PROBE);
454 484
455 set_irq_chip(IRQ_LOCOMO_GPIO_BASE, &locomo_chip); 485 set_irq_chip(IRQ_LOCOMO_GPIO_BASE, &locomo_chip);
456 set_irq_chip_data(IRQ_LOCOMO_GPIO_BASE, irqbase); 486 set_irq_chip_data(IRQ_LOCOMO_GPIO_BASE, irqbase);
457 set_irq_chained_handler(IRQ_LOCOMO_GPIO_BASE, locomo_gpio_handler); 487 set_irq_chained_handler(IRQ_LOCOMO_GPIO_BASE, locomo_gpio_handler);
458 set_irq_flags(IRQ_LOCOMO_GPIO_BASE, IRQF_VALID | IRQF_PROBE);
459 488
460 set_irq_chip(IRQ_LOCOMO_LT_BASE, &locomo_chip); 489 set_irq_chip(IRQ_LOCOMO_LT_BASE, &locomo_chip);
461 set_irq_chip_data(IRQ_LOCOMO_LT_BASE, irqbase); 490 set_irq_chip_data(IRQ_LOCOMO_LT_BASE, irqbase);
462 set_irq_chained_handler(IRQ_LOCOMO_LT_BASE, locomo_lt_handler); 491 set_irq_chained_handler(IRQ_LOCOMO_LT_BASE, locomo_lt_handler);
463 set_irq_flags(IRQ_LOCOMO_LT_BASE, IRQF_VALID | IRQF_PROBE);
464 492
465 set_irq_chip(IRQ_LOCOMO_SPI_BASE, &locomo_chip); 493 set_irq_chip(IRQ_LOCOMO_SPI_BASE, &locomo_chip);
466 set_irq_chip_data(IRQ_LOCOMO_SPI_BASE, irqbase); 494 set_irq_chip_data(IRQ_LOCOMO_SPI_BASE, irqbase);
467 set_irq_chained_handler(IRQ_LOCOMO_SPI_BASE, locomo_spi_handler); 495 set_irq_chained_handler(IRQ_LOCOMO_SPI_BASE, locomo_spi_handler);
468 set_irq_flags(IRQ_LOCOMO_SPI_BASE, IRQF_VALID | IRQF_PROBE);
469 496
470 /* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */ 497 /* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */
471 set_irq_chip(LOCOMO_IRQ_KEY_START, &locomo_key_chip); 498 set_irq_chip(LOCOMO_IRQ_KEY_START, &locomo_key_chip);
@@ -488,7 +515,7 @@ static void locomo_setup_irq(struct locomo *lchip)
488 set_irq_flags(LOCOMO_IRQ_LT_START, IRQF_VALID | IRQF_PROBE); 515 set_irq_flags(LOCOMO_IRQ_LT_START, IRQF_VALID | IRQF_PROBE);
489 516
490 /* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */ 517 /* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */
491 for (irq = LOCOMO_IRQ_SPI_START; irq < LOCOMO_IRQ_SPI_START + 3; irq++) { 518 for (irq = LOCOMO_IRQ_SPI_START; irq < LOCOMO_IRQ_SPI_START + 4; irq++) {
492 set_irq_chip(irq, &locomo_spi_chip); 519 set_irq_chip(irq, &locomo_spi_chip);
493 set_irq_chip_data(irq, irqbase); 520 set_irq_chip_data(irq, irqbase);
494 set_irq_handler(irq, handle_edge_irq); 521 set_irq_handler(irq, handle_edge_irq);
@@ -574,20 +601,20 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)
574 601
575 save->LCM_GPO = locomo_readl(lchip->base + LOCOMO_GPO); /* GPIO */ 602 save->LCM_GPO = locomo_readl(lchip->base + LOCOMO_GPO); /* GPIO */
576 locomo_writel(0x00, lchip->base + LOCOMO_GPO); 603 locomo_writel(0x00, lchip->base + LOCOMO_GPO);
577 save->LCM_SPICT = locomo_readl(lchip->base + LOCOMO_SPICT); /* SPI */ 604 save->LCM_SPICT = locomo_readl(lchip->base + LOCOMO_SPI + LOCOMO_SPICT); /* SPI */
578 locomo_writel(0x40, lchip->base + LOCOMO_SPICT); 605 locomo_writel(0x40, lchip->base + LOCOMO_SPICT);
579 save->LCM_GPE = locomo_readl(lchip->base + LOCOMO_GPE); /* GPIO */ 606 save->LCM_GPE = locomo_readl(lchip->base + LOCOMO_GPE); /* GPIO */
580 locomo_writel(0x00, lchip->base + LOCOMO_GPE); 607 locomo_writel(0x00, lchip->base + LOCOMO_GPE);
581 save->LCM_ASD = locomo_readl(lchip->base + LOCOMO_ASD); /* ADSTART */ 608 save->LCM_ASD = locomo_readl(lchip->base + LOCOMO_ASD); /* ADSTART */
582 locomo_writel(0x00, lchip->base + LOCOMO_ASD); 609 locomo_writel(0x00, lchip->base + LOCOMO_ASD);
583 save->LCM_SPIMD = locomo_readl(lchip->base + LOCOMO_SPIMD); /* SPI */ 610 save->LCM_SPIMD = locomo_readl(lchip->base + LOCOMO_SPI + LOCOMO_SPIMD); /* SPI */
584 locomo_writel(0x3C14, lchip->base + LOCOMO_SPIMD); 611 locomo_writel(0x3C14, lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);
585 612
586 locomo_writel(0x00, lchip->base + LOCOMO_PAIF); 613 locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
587 locomo_writel(0x00, lchip->base + LOCOMO_DAC); 614 locomo_writel(0x00, lchip->base + LOCOMO_DAC);
588 locomo_writel(0x00, lchip->base + LOCOMO_BACKLIGHT + LOCOMO_TC); 615 locomo_writel(0x00, lchip->base + LOCOMO_BACKLIGHT + LOCOMO_TC);
589 616
590 if ( (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) && (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88) ) 617 if ((locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) && (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88))
591 locomo_writel(0x00, lchip->base + LOCOMO_C32K); /* CLK32 off */ 618 locomo_writel(0x00, lchip->base + LOCOMO_C32K); /* CLK32 off */
592 else 619 else
593 /* 18MHz already enabled, so no wait */ 620 /* 18MHz already enabled, so no wait */
@@ -616,10 +643,10 @@ static int locomo_resume(struct platform_device *dev)
616 spin_lock_irqsave(&lchip->lock, flags); 643 spin_lock_irqsave(&lchip->lock, flags);
617 644
618 locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO); 645 locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
619 locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPICT); 646 locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPI + LOCOMO_SPICT);
620 locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE); 647 locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
621 locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD); 648 locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
622 locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPIMD); 649 locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);
623 650
624 locomo_writel(0x00, lchip->base + LOCOMO_C32K); 651 locomo_writel(0x00, lchip->base + LOCOMO_C32K);
625 locomo_writel(0x90, lchip->base + LOCOMO_TADC); 652 locomo_writel(0x90, lchip->base + LOCOMO_TADC);
@@ -688,9 +715,9 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
688 715
689 /* GPIO */ 716 /* GPIO */
690 locomo_writel(0, lchip->base + LOCOMO_GPO); 717 locomo_writel(0, lchip->base + LOCOMO_GPO);
691 locomo_writel( (LOCOMO_GPIO(2) | LOCOMO_GPIO(3) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14)) 718 locomo_writel((LOCOMO_GPIO(1) | LOCOMO_GPIO(2) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
692 , lchip->base + LOCOMO_GPE); 719 , lchip->base + LOCOMO_GPE);
693 locomo_writel( (LOCOMO_GPIO(2) | LOCOMO_GPIO(3) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14)) 720 locomo_writel((LOCOMO_GPIO(1) | LOCOMO_GPIO(2) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
694 , lchip->base + LOCOMO_GPD); 721 , lchip->base + LOCOMO_GPD);
695 locomo_writel(0, lchip->base + LOCOMO_GIE); 722 locomo_writel(0, lchip->base + LOCOMO_GIE);
696 723
@@ -833,7 +860,10 @@ void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir
833 spin_lock_irqsave(&lchip->lock, flags); 860 spin_lock_irqsave(&lchip->lock, flags);
834 861
835 r = locomo_readl(lchip->base + LOCOMO_GPD); 862 r = locomo_readl(lchip->base + LOCOMO_GPD);
836 r &= ~bits; 863 if (dir)
864 r |= bits;
865 else
866 r &= ~bits;
837 locomo_writel(r, lchip->base + LOCOMO_GPD); 867 locomo_writel(r, lchip->base + LOCOMO_GPD);
838 868
839 r = locomo_readl(lchip->base + LOCOMO_GPE); 869 r = locomo_readl(lchip->base + LOCOMO_GPE);
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index f73d62e8ab60..688b7b1ee416 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -179,3 +179,5 @@ EXPORT_SYMBOL(_find_next_zero_bit_be);
179EXPORT_SYMBOL(_find_first_bit_be); 179EXPORT_SYMBOL(_find_first_bit_be);
180EXPORT_SYMBOL(_find_next_bit_be); 180EXPORT_SYMBOL(_find_next_bit_be);
181#endif 181#endif
182
183EXPORT_SYMBOL(copy_page);
diff --git a/arch/arm/kernel/arthur.c b/arch/arm/kernel/arthur.c
index 0ee2e9819631..321c5291d05f 100644
--- a/arch/arm/kernel/arthur.c
+++ b/arch/arm/kernel/arthur.c
@@ -90,3 +90,5 @@ static void __exit arthur_exit(void)
90 90
91module_init(arthur_init); 91module_init(arthur_init);
92module_exit(arthur_exit); 92module_exit(arthur_exit);
93
94MODULE_LICENSE("GPL");
diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c
index bd4ef53bc6b9..8b8c9d38a761 100644
--- a/arch/arm/kernel/init_task.c
+++ b/arch/arm/kernel/init_task.c
@@ -13,7 +13,6 @@
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14 14
15static struct fs_struct init_fs = INIT_FS; 15static struct fs_struct init_fs = INIT_FS;
16static struct files_struct init_files = INIT_FILES;
17static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 16static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
18static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
19struct mm_struct init_mm = INIT_MM(init_mm); 18struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 728bb8f39441..0babb645b83c 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -544,10 +544,10 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
544 struct resource *fb_res = &lcdc_resources[2]; 544 struct resource *fb_res = &lcdc_resources[2];
545 size_t fb_len = fb_res->end - fb_res->start + 1; 545 size_t fb_len = fb_res->end - fb_res->start + 1;
546 546
547 fb = ioremap_writecombine(fb_res->start, fb_len); 547 fb = ioremap(fb_res->start, fb_len);
548 if (fb) { 548 if (fb) {
549 memset(fb, 0, fb_len); 549 memset(fb, 0, fb_len);
550 iounmap(fb, fb_len); 550 iounmap(fb);
551 } 551 }
552 } 552 }
553 lcdc_data = *data; 553 lcdc_data = *data;
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 054689804e77..450db304936f 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -332,13 +332,6 @@ static struct resource lcdc_resources[] = {
332 .end = AT91SAM9RL_ID_LCDC, 332 .end = AT91SAM9RL_ID_LCDC,
333 .flags = IORESOURCE_IRQ, 333 .flags = IORESOURCE_IRQ,
334 }, 334 },
335#if defined(CONFIG_FB_INTSRAM)
336 [2] = {
337 .start = AT91SAM9RL_SRAM_BASE,
338 .end = AT91SAM9RL_SRAM_BASE + AT91SAM9RL_SRAM_SIZE - 1,
339 .flags = IORESOURCE_MEM,
340 },
341#endif
342}; 335};
343 336
344static struct platform_device at91_lcdc_device = { 337static struct platform_device at91_lcdc_device = {
@@ -381,20 +374,6 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
381 at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */ 374 at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */
382 at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */ 375 at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */
383 376
384#ifdef CONFIG_FB_INTSRAM
385 {
386 void __iomem *fb;
387 struct resource *fb_res = &lcdc_resources[2];
388 size_t fb_len = fb_res->end - fb_res->start + 1;
389
390 fb = ioremap_writecombine(fb_res->start, fb_len);
391 if (fb) {
392 memset(fb, 0, fb_len);
393 iounmap(fb, fb_len);
394 }
395 }
396#endif
397
398 lcdc_data = *data; 377 lcdc_data = *data;
399 platform_device_register(&at91_lcdc_device); 378 platform_device_register(&at91_lcdc_device);
400} 379}
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index 1de121fc55f4..f44647738ee4 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -16,16 +16,32 @@
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/arch/at91x40.h> 17#include <asm/arch/at91x40.h>
18#include <asm/arch/at91_st.h> 18#include <asm/arch/at91_st.h>
19#include <asm/arch/timex.h>
19#include "generic.h" 20#include "generic.h"
20 21
21/* 22/*
22 * This is used in the gpio code, stub locally. 23 * Export the clock functions for the AT91X40. Some external code common
24 * to all AT91 family parts relys on this, like the gpio and serial support.
23 */ 25 */
24int clk_enable(struct clk *clk) 26int clk_enable(struct clk *clk)
25{ 27{
26 return 0; 28 return 0;
27} 29}
28 30
31void clk_disable(struct clk *clk)
32{
33}
34
35unsigned long clk_get_rate(struct clk *clk)
36{
37 return AT91X40_MASTER_CLOCK;
38}
39
40struct clk *clk_get(struct device *dev, const char *id)
41{
42 return NULL;
43}
44
29void __init at91x40_initialize(unsigned long main_clock) 45void __init at91x40_initialize(unsigned long main_clock)
30{ 46{
31 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1) 47 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 92d79fb39311..62e653a3ea1a 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -369,7 +369,8 @@ static int impd1_probe(struct lm_device *dev)
369 369
370 lm_set_drvdata(dev, impd1); 370 lm_set_drvdata(dev, impd1);
371 371
372 printk("IM-PD1 found at 0x%08lx\n", dev->resource.start); 372 printk("IM-PD1 found at 0x%08lx\n",
373 (unsigned long)dev->resource.start);
373 374
374 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { 375 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
375 impd1->vcos[i].owner = THIS_MODULE, 376 impd1->vcos[i].owner = THIS_MODULE,
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index d55fa4e9bb43..c07f497000ca 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -405,7 +405,6 @@ v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
405 addr, fsr, pc, instr, __raw_readl(SC_LBFADDR), __raw_readl(SC_LBFCODE) & 255, 405 addr, fsr, pc, instr, __raw_readl(SC_LBFADDR), __raw_readl(SC_LBFCODE) & 255,
406 v3_readb(V3_LB_ISTAT)); 406 v3_readb(V3_LB_ISTAT));
407 printk(KERN_DEBUG "%s", buf); 407 printk(KERN_DEBUG "%s", buf);
408 printascii(buf);
409#endif 408#endif
410 409
411 v3_writeb(V3_LB_ISTAT, 0); 410 v3_writeb(V3_LB_ISTAT, 0);
@@ -447,6 +446,7 @@ static irqreturn_t v3_irq(int dummy, void *devid)
447 unsigned long pc = instruction_pointer(regs); 446 unsigned long pc = instruction_pointer(regs);
448 unsigned long instr = *(unsigned long *)pc; 447 unsigned long instr = *(unsigned long *)pc;
449 char buf[128]; 448 char buf[128];
449 extern void printascii(const char *);
450 450
451 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x " 451 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x "
452 "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr, 452 "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index ca1a4bf78a10..a4d20127a60e 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -24,7 +24,6 @@
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/tsc2102.h>
28#include <linux/interrupt.h> 27#include <linux/interrupt.h>
29#include <linux/apm-emulation.h> 28#include <linux/apm-emulation.h>
30 29
@@ -63,7 +62,7 @@ static const int palmte_keymap[] = {
63 KEY(1, 1, KEY_DOWN), 62 KEY(1, 1, KEY_DOWN),
64 KEY(1, 2, KEY_UP), 63 KEY(1, 2, KEY_UP),
65 KEY(1, 3, KEY_RIGHT), 64 KEY(1, 3, KEY_RIGHT),
66 KEY(1, 4, KEY_CENTER), 65 KEY(1, 4, KEY_ENTER),
67 0, 66 0,
68}; 67};
69 68
@@ -315,14 +314,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
315#define palmte_get_power_status NULL 314#define palmte_get_power_status NULL
316#endif 315#endif
317 316
318static struct tsc2102_config palmte_tsc2102_config = {
319 .use_internal = 0,
320 .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
321 .temp_at25c = { 2200, 2615 },
322 .apm_report = palmte_get_power_status,
323 .alsa_config = &palmte_alsa_config,
324};
325
326static struct omap_board_config_kernel palmte_config[] __initdata = { 317static struct omap_board_config_kernel palmte_config[] __initdata = {
327 { OMAP_TAG_USB, &palmte_usb_config }, 318 { OMAP_TAG_USB, &palmte_usb_config },
328 { OMAP_TAG_MMC, &palmte_mmc_config }, 319 { OMAP_TAG_MMC, &palmte_mmc_config },
@@ -336,7 +327,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = {
336 .bus_num = 2, /* uWire (officially) */ 327 .bus_num = 2, /* uWire (officially) */
337 .chip_select = 0, /* As opposed to 3 */ 328 .chip_select = 0, /* As opposed to 3 */
338 .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO), 329 .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
339 .platform_data = &palmte_tsc2102_config,
340 .max_speed_hz = 8000000, 330 .max_speed_hz = 8000000,
341 }, 331 },
342}; 332};
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 156510777ffe..e020c2774606 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -65,7 +65,7 @@ static int palmz71_keymap[] = {
65 KEY(1, 1, KEY_DOWN), 65 KEY(1, 1, KEY_DOWN),
66 KEY(1, 2, KEY_UP), 66 KEY(1, 2, KEY_UP),
67 KEY(1, 3, KEY_RIGHT), 67 KEY(1, 3, KEY_RIGHT),
68 KEY(1, 4, KEY_CENTER), 68 KEY(1, 4, KEY_ENTER),
69 KEY(2, 0, KEY_CAMERA), 69 KEY(2, 0, KEY_CAMERA),
70 0, 70 0,
71}; 71};
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 1c12d7c6c7fc..1682eb77c46d 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -208,6 +208,7 @@ static void __init omap_2430sdp_init(void)
208 208
209static void __init omap_2430sdp_map_io(void) 209static void __init omap_2430sdp_map_io(void)
210{ 210{
211 omap2_set_globals_243x();
211 omap2_map_common_io(); 212 omap2_map_common_io();
212} 213}
213 214
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index a1e1e6765b5b..620fa0f120ee 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -394,6 +394,7 @@ static void __init omap_apollon_init(void)
394 394
395static void __init omap_apollon_map_io(void) 395static void __init omap_apollon_map_io(void)
396{ 396{
397 omap2_set_globals_242x();
397 omap2_map_common_io(); 398 omap2_map_common_io();
398} 399}
399 400
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 90938151bcf1..df8be081e159 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -65,6 +65,7 @@ static void __init omap_generic_init(void)
65 65
66static void __init omap_generic_map_io(void) 66static void __init omap_generic_map_io(void)
67{ 67{
68 omap2_set_globals_242x(); /* should be 242x, 243x, or 343x */
68 omap2_map_common_io(); 69 omap2_map_common_io();
69} 70}
70 71
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index d1915f99a5fa..0d28f6897c8e 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -420,6 +420,7 @@ static void __init omap_h4_init(void)
420 420
421static void __init omap_h4_map_io(void) 421static void __init omap_h4_map_io(void)
422{ 422{
423 omap2_set_globals_242x();
423 omap2_map_common_io(); 424 omap2_map_common_io();
424} 425}
425 426
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index b57ffb5a22a5..ab9fc57d25f1 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -205,7 +205,9 @@ static void omap2_clk_wait_ready(struct clk *clk)
205 /* REVISIT: What are the appropriate exclusions for 34XX? */ 205 /* REVISIT: What are the appropriate exclusions for 34XX? */
206 /* OMAP3: ignore DSS-mod clocks */ 206 /* OMAP3: ignore DSS-mod clocks */
207 if (cpu_is_omap34xx() && 207 if (cpu_is_omap34xx() &&
208 (((u32)reg & ~0xff) == (u32)OMAP_CM_REGADDR(OMAP3430_DSS_MOD, 0))) 208 (((u32)reg & ~0xff) == (u32)OMAP_CM_REGADDR(OMAP3430_DSS_MOD, 0) ||
209 ((((u32)reg & ~0xff) == (u32)OMAP_CM_REGADDR(CORE_MOD, 0)) &&
210 clk->enable_bit == OMAP3430_EN_SSI_SHIFT)))
209 return; 211 return;
210 212
211 /* Check if both functional and interface clocks 213 /* Check if both functional and interface clocks
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index cf4644a94b9b..c9c5972a2e25 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -836,7 +836,8 @@ static struct clk dpll5_m2_ck = {
836 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5), 836 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
837 .clksel_mask = OMAP3430ES2_DIV_120M_MASK, 837 .clksel_mask = OMAP3430ES2_DIV_120M_MASK,
838 .clksel = div16_dpll5_clksel, 838 .clksel = div16_dpll5_clksel,
839 .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES, 839 .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES |
840 PARENT_CONTROLS_CLOCK,
840 .recalc = &omap2_clksel_recalc, 841 .recalc = &omap2_clksel_recalc,
841}; 842};
842 843
@@ -1046,12 +1047,13 @@ static struct clk iva2_ck = {
1046 .name = "iva2_ck", 1047 .name = "iva2_ck",
1047 .parent = &dpll2_m2_ck, 1048 .parent = &dpll2_m2_ck,
1048 .init = &omap2_init_clksel_parent, 1049 .init = &omap2_init_clksel_parent,
1050 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1051 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1049 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, 1052 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD,
1050 OMAP3430_CM_IDLEST_PLL), 1053 OMAP3430_CM_IDLEST_PLL),
1051 .clksel_mask = OMAP3430_ST_IVA2_CLK_MASK, 1054 .clksel_mask = OMAP3430_ST_IVA2_CLK_MASK,
1052 .clksel = iva2_clksel, 1055 .clksel = iva2_clksel,
1053 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 1056 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES,
1054 PARENT_CONTROLS_CLOCK,
1055 .recalc = &omap2_clksel_recalc, 1057 .recalc = &omap2_clksel_recalc,
1056}; 1058};
1057 1059
@@ -1836,7 +1838,8 @@ static struct clk omapctrl_ick = {
1836static struct clk ssi_l4_ick = { 1838static struct clk ssi_l4_ick = {
1837 .name = "ssi_l4_ick", 1839 .name = "ssi_l4_ick",
1838 .parent = &l4_ick, 1840 .parent = &l4_ick,
1839 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, 1841 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
1842 PARENT_CONTROLS_CLOCK,
1840 .recalc = &followparent_recalc, 1843 .recalc = &followparent_recalc,
1841}; 1844};
1842 1845
@@ -2344,7 +2347,7 @@ static struct clk gpio6_fck = {
2344 .name = "gpio6_fck", 2347 .name = "gpio6_fck",
2345 .parent = &per_32k_alwon_fck, 2348 .parent = &per_32k_alwon_fck,
2346 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2349 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2347 .enable_bit = OMAP3430_EN_GPT6_SHIFT, 2350 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2348 .flags = CLOCK_IN_OMAP343X, 2351 .flags = CLOCK_IN_OMAP343X,
2349 .recalc = &followparent_recalc, 2352 .recalc = &followparent_recalc,
2350}; 2353};
@@ -2353,7 +2356,7 @@ static struct clk gpio5_fck = {
2353 .name = "gpio5_fck", 2356 .name = "gpio5_fck",
2354 .parent = &per_32k_alwon_fck, 2357 .parent = &per_32k_alwon_fck,
2355 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2358 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2356 .enable_bit = OMAP3430_EN_GPT5_SHIFT, 2359 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2357 .flags = CLOCK_IN_OMAP343X, 2360 .flags = CLOCK_IN_OMAP343X,
2358 .recalc = &followparent_recalc, 2361 .recalc = &followparent_recalc,
2359}; 2362};
@@ -2362,7 +2365,7 @@ static struct clk gpio4_fck = {
2362 .name = "gpio4_fck", 2365 .name = "gpio4_fck",
2363 .parent = &per_32k_alwon_fck, 2366 .parent = &per_32k_alwon_fck,
2364 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2367 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2365 .enable_bit = OMAP3430_EN_GPT4_SHIFT, 2368 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2366 .flags = CLOCK_IN_OMAP343X, 2369 .flags = CLOCK_IN_OMAP343X,
2367 .recalc = &followparent_recalc, 2370 .recalc = &followparent_recalc,
2368}; 2371};
@@ -2371,7 +2374,7 @@ static struct clk gpio3_fck = {
2371 .name = "gpio3_fck", 2374 .name = "gpio3_fck",
2372 .parent = &per_32k_alwon_fck, 2375 .parent = &per_32k_alwon_fck,
2373 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2376 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2374 .enable_bit = OMAP3430_EN_GPT3_SHIFT, 2377 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2375 .flags = CLOCK_IN_OMAP343X, 2378 .flags = CLOCK_IN_OMAP343X,
2376 .recalc = &followparent_recalc, 2379 .recalc = &followparent_recalc,
2377}; 2380};
@@ -2380,7 +2383,7 @@ static struct clk gpio2_fck = {
2380 .name = "gpio2_fck", 2383 .name = "gpio2_fck",
2381 .parent = &per_32k_alwon_fck, 2384 .parent = &per_32k_alwon_fck,
2382 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2385 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2383 .enable_bit = OMAP3430_EN_GPT2_SHIFT, 2386 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2384 .flags = CLOCK_IN_OMAP343X, 2387 .flags = CLOCK_IN_OMAP343X,
2385 .recalc = &followparent_recalc, 2388 .recalc = &followparent_recalc,
2386}; 2389};
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 9249129a5f46..3c38395f6442 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -56,6 +56,7 @@
56 56
57/* CM_FCLKEN_IVA2 */ 57/* CM_FCLKEN_IVA2 */
58#define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2 (1 << 0) 58#define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2 (1 << 0)
59#define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT 0
59 60
60/* CM_CLKEN_PLL_IVA2 */ 61/* CM_CLKEN_PLL_IVA2 */
61#define OMAP3430_IVA2_DPLL_RAMPTIME_SHIFT 8 62#define OMAP3430_IVA2_DPLL_RAMPTIME_SHIFT 8
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index b03cd06e055b..4799561c5a9e 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -70,6 +70,9 @@ struct omap_mbox2_priv {
70 70
71static struct clk *mbox_ick_handle; 71static struct clk *mbox_ick_handle;
72 72
73static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
74 omap_mbox_type_t irq);
75
73static inline unsigned int mbox_read_reg(unsigned int reg) 76static inline unsigned int mbox_read_reg(unsigned int reg)
74{ 77{
75 return __raw_readl(mbox_base + reg); 78 return __raw_readl(mbox_base + reg);
@@ -81,7 +84,7 @@ static inline void mbox_write_reg(unsigned int val, unsigned int reg)
81} 84}
82 85
83/* Mailbox H/W preparations */ 86/* Mailbox H/W preparations */
84static inline int omap2_mbox_startup(struct omap_mbox *mbox) 87static int omap2_mbox_startup(struct omap_mbox *mbox)
85{ 88{
86 unsigned int l; 89 unsigned int l;
87 90
@@ -97,38 +100,40 @@ static inline int omap2_mbox_startup(struct omap_mbox *mbox)
97 l |= 0x00000011; 100 l |= 0x00000011;
98 mbox_write_reg(l, MAILBOX_SYSCONFIG); 101 mbox_write_reg(l, MAILBOX_SYSCONFIG);
99 102
103 omap2_mbox_enable_irq(mbox, IRQ_RX);
104
100 return 0; 105 return 0;
101} 106}
102 107
103static inline void omap2_mbox_shutdown(struct omap_mbox *mbox) 108static void omap2_mbox_shutdown(struct omap_mbox *mbox)
104{ 109{
105 clk_disable(mbox_ick_handle); 110 clk_disable(mbox_ick_handle);
106 clk_put(mbox_ick_handle); 111 clk_put(mbox_ick_handle);
107} 112}
108 113
109/* Mailbox FIFO handle functions */ 114/* Mailbox FIFO handle functions */
110static inline mbox_msg_t omap2_mbox_fifo_read(struct omap_mbox *mbox) 115static mbox_msg_t omap2_mbox_fifo_read(struct omap_mbox *mbox)
111{ 116{
112 struct omap_mbox2_fifo *fifo = 117 struct omap_mbox2_fifo *fifo =
113 &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo; 118 &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo;
114 return (mbox_msg_t) mbox_read_reg(fifo->msg); 119 return (mbox_msg_t) mbox_read_reg(fifo->msg);
115} 120}
116 121
117static inline void omap2_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg) 122static void omap2_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
118{ 123{
119 struct omap_mbox2_fifo *fifo = 124 struct omap_mbox2_fifo *fifo =
120 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; 125 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
121 mbox_write_reg(msg, fifo->msg); 126 mbox_write_reg(msg, fifo->msg);
122} 127}
123 128
124static inline int omap2_mbox_fifo_empty(struct omap_mbox *mbox) 129static int omap2_mbox_fifo_empty(struct omap_mbox *mbox)
125{ 130{
126 struct omap_mbox2_fifo *fifo = 131 struct omap_mbox2_fifo *fifo =
127 &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo; 132 &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo;
128 return (mbox_read_reg(fifo->msg_stat) == 0); 133 return (mbox_read_reg(fifo->msg_stat) == 0);
129} 134}
130 135
131static inline int omap2_mbox_fifo_full(struct omap_mbox *mbox) 136static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
132{ 137{
133 struct omap_mbox2_fifo *fifo = 138 struct omap_mbox2_fifo *fifo =
134 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; 139 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
@@ -136,7 +141,7 @@ static inline int omap2_mbox_fifo_full(struct omap_mbox *mbox)
136} 141}
137 142
138/* Mailbox IRQ handle functions */ 143/* Mailbox IRQ handle functions */
139static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox, 144static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
140 omap_mbox_type_t irq) 145 omap_mbox_type_t irq)
141{ 146{
142 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; 147 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
@@ -147,7 +152,7 @@ static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox,
147 mbox_write_reg(l, p->irqenable); 152 mbox_write_reg(l, p->irqenable);
148} 153}
149 154
150static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox, 155static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
151 omap_mbox_type_t irq) 156 omap_mbox_type_t irq)
152{ 157{
153 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; 158 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
@@ -158,7 +163,7 @@ static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox,
158 mbox_write_reg(l, p->irqenable); 163 mbox_write_reg(l, p->irqenable);
159} 164}
160 165
161static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox, 166static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
162 omap_mbox_type_t irq) 167 omap_mbox_type_t irq)
163{ 168{
164 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; 169 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
@@ -167,7 +172,7 @@ static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox,
167 mbox_write_reg(bit, p->irqstatus); 172 mbox_write_reg(bit, p->irqstatus);
168} 173}
169 174
170static inline int omap2_mbox_is_irq(struct omap_mbox *mbox, 175static int omap2_mbox_is_irq(struct omap_mbox *mbox,
171 omap_mbox_type_t irq) 176 omap_mbox_type_t irq)
172{ 177{
173 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; 178 struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index ab7649afd891..618f8111658a 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -30,7 +30,7 @@
30 30
31/* 31/*
32 * Architecture-specific global PRM registers 32 * Architecture-specific global PRM registers
33 * Use prm_{read,write}_reg() with these registers. 33 * Use __raw_{read,write}l() with these registers.
34 * 34 *
35 * With a few exceptions, these are the register names beginning with 35 * With a few exceptions, these are the register names beginning with
36 * PRCM_* on 24xx, and PRM_* on 34xx. (The exceptions are the 36 * PRCM_* on 24xx, and PRM_* on 34xx. (The exceptions are the
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index f9430f5ca9a8..27ce967ab9e5 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -58,7 +58,7 @@ static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
58} 58}
59 59
60static struct hw_pci dns323_pci __initdata = { 60static struct hw_pci dns323_pci __initdata = {
61 .nr_controllers = 1, 61 .nr_controllers = 2,
62 .swizzle = pci_std_swizzle, 62 .swizzle = pci_std_swizzle,
63 .setup = orion5x_pci_sys_setup, 63 .setup = orion5x_pci_sys_setup,
64 .scan = orion5x_pci_sys_scan_bus, 64 .scan = orion5x_pci_sys_scan_bus,
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 88410862feef..f5074b877b7f 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -138,7 +138,7 @@ static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
138} 138}
139 139
140static struct hw_pci kurobox_pro_pci __initdata = { 140static struct hw_pci kurobox_pro_pci __initdata = {
141 .nr_controllers = 1, 141 .nr_controllers = 2,
142 .swizzle = pci_std_swizzle, 142 .swizzle = pci_std_swizzle,
143 .setup = orion5x_pci_sys_setup, 143 .setup = orion5x_pci_sys_setup,
144 .scan = orion5x_pci_sys_scan_bus, 144 .scan = orion5x_pci_sys_scan_bus,
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 6d4416a4f378..f5851d1adc25 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -59,7 +59,7 @@ static struct resource cmx270_dm9k_resource[] = {
59 [2] = { 59 [2] = {
60 .start = CMX270_ETHIRQ, 60 .start = CMX270_ETHIRQ,
61 .end = CMX270_ETHIRQ, 61 .end = CMX270_ETHIRQ,
62 .flags = IORESOURCE_IRQ, 62 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
63 } 63 }
64}; 64};
65 65
diff --git a/arch/arm/mach-pxa/colibri.c b/arch/arm/mach-pxa/colibri.c
index 43bf5a183e90..574839d7c132 100644
--- a/arch/arm/mach-pxa/colibri.c
+++ b/arch/arm/mach-pxa/colibri.c
@@ -98,7 +98,7 @@ static struct resource dm9000_resources[] = {
98 [2] = { 98 [2] = {
99 .start = COLIBRI_ETH_IRQ, 99 .start = COLIBRI_ETH_IRQ,
100 .end = COLIBRI_ETH_IRQ, 100 .end = COLIBRI_ETH_IRQ,
101 .flags = IORESOURCE_IRQ, 101 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
102 }, 102 },
103}; 103};
104 104
@@ -119,7 +119,6 @@ static void __init colibri_init(void)
119 /* DM9000 LAN */ 119 /* DM9000 LAN */
120 pxa_gpio_mode(GPIO78_nCS_2_MD); 120 pxa_gpio_mode(GPIO78_nCS_2_MD);
121 pxa_gpio_mode(GPIO_DM9000 | GPIO_IN); 121 pxa_gpio_mode(GPIO_DM9000 | GPIO_IN);
122 set_irq_type(COLIBRI_ETH_IRQ, IRQT_FALLING);
123 122
124 platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices)); 123 platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices));
125} 124}
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index edc4f07a230d..9c57700ee5c2 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -50,7 +50,7 @@ static struct resource em_x270_dm9k_resource[] = {
50 [2] = { 50 [2] = {
51 .start = EM_X270_ETHIRQ, 51 .start = EM_X270_ETHIRQ,
52 .end = EM_X270_ETHIRQ, 52 .end = EM_X270_ETHIRQ,
53 .flags = IORESOURCE_IRQ, 53 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
54 } 54 }
55}; 55};
56 56
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 00af7f2fed66..0bb31982fb6f 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -330,7 +330,7 @@ struct ssp_device *ssp_request(int port, const char *label)
330 330
331 mutex_unlock(&ssp_lock); 331 mutex_unlock(&ssp_lock);
332 332
333 if (ssp->port_id != port) 333 if (&ssp->node == &ssp_list)
334 return NULL; 334 return NULL;
335 335
336 return ssp; 336 return ssp;
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index c2cbd66db814..ab4a9f579913 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -467,8 +467,8 @@ static struct platform_device *devices[] __initdata = {
467 467
468static void tosa_poweroff(void) 468static void tosa_poweroff(void)
469{ 469{
470 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT); 470 gpio_direction_output(TOSA_GPIO_ON_RESET, 0);
471 GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET); 471 gpio_set_value(TOSA_GPIO_ON_RESET, 1);
472 472
473 mdelay(1000); 473 mdelay(1000);
474 arm_machine_restart('h'); 474 arm_machine_restart('h');
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 661a2358ac22..27f63d5d3a7b 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -374,7 +374,7 @@ static struct resource bast_dm9k_resource[] = {
374 [2] = { 374 [2] = {
375 .start = IRQ_DM9000, 375 .start = IRQ_DM9000,
376 .end = IRQ_DM9000, 376 .end = IRQ_DM9000,
377 .flags = IORESOURCE_IRQ, 377 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
378 } 378 }
379 379
380}; 380};
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index c56423373ff3..4c4b5c4207c4 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -263,7 +263,7 @@ static struct resource vr1000_dm9k0_resource[] = {
263 [2] = { 263 [2] = {
264 .start = IRQ_VR1000_DM9000A, 264 .start = IRQ_VR1000_DM9000A,
265 .end = IRQ_VR1000_DM9000A, 265 .end = IRQ_VR1000_DM9000A,
266 .flags = IORESOURCE_IRQ 266 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
267 } 267 }
268 268
269}; 269};
@@ -282,7 +282,7 @@ static struct resource vr1000_dm9k1_resource[] = {
282 [2] = { 282 [2] = {
283 .start = IRQ_VR1000_DM9000N, 283 .start = IRQ_VR1000_DM9000N,
284 .end = IRQ_VR1000_DM9000N, 284 .end = IRQ_VR1000_DM9000N,
285 .flags = IORESOURCE_IRQ 285 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
286 } 286 }
287}; 287};
288 288
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 6496eb645cee..2f772a3965c4 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -225,26 +225,28 @@ static void __init collie_init(void)
225 int ret = 0; 225 int ret = 0;
226 226
227 /* cpu initialize */ 227 /* cpu initialize */
228 GAFR = ( GPIO_SSP_TXD | \ 228 GAFR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK |
229 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK | GPIO_TIC_ACK | \ 229 GPIO_MCP_CLK | GPIO_32_768kHz;
230 GPIO_32_768kHz ); 230
231 231 GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 |
232 GPDR = ( GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | \ 232 GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD |
233 GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | \ 233 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK |
234 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | \ 234 COLLIE_GPIO_UCB1x00_RESET | COLLIE_GPIO_nMIC_ON |
235 GPIO_SDLC_AAF | GPIO_UART_SCLK1 | GPIO_32_768kHz ); 235 COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz;
236 GPLR = GPIO_GPIO18; 236
237 237 PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 |
238 // PPC pin setting 238 PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS |
239 PPDR = ( PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 | \ 239 PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;
240 PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS | \ 240
241 PPC_TXD1 | PPC_TXD2 | PPC_RXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM ); 241 PWER = COLLIE_GPIO_AC_IN | COLLIE_GPIO_CO | COLLIE_GPIO_ON_KEY |
242 242 COLLIE_GPIO_WAKEUP | COLLIE_GPIO_nREMOCON_INT | PWER_RTC;
243 PSDR = ( PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4 ); 243
244 244 PGSR = COLLIE_GPIO_nREMOCON_ON;
245 GAFR |= GPIO_32_768kHz; 245
246 GPDR |= GPIO_32_768kHz; 246 PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4;
247 TUCR = TUCR_32_768kHz; 247
248 PCFR = PCFR_OPDE;
249
248 250
249 platform_scoop_config = &collie_pcmcia_config; 251 platform_scoop_config = &collie_pcmcia_config;
250 252
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 065087afb772..d045812f3399 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -332,7 +332,7 @@ ENTRY(arm925_dma_flush_range)
332#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 332#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
333 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 333 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
334#else 334#else
335 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 335 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
336#endif 336#endif
337 add r0, r0, #CACHE_DLINESIZE 337 add r0, r0, #CACHE_DLINESIZE
338 cmp r0, r1 338 cmp r0, r1
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 997db8472b5c..4cd33169a7c9 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -295,7 +295,7 @@ ENTRY(arm926_dma_flush_range)
295#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 295#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
296 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 296 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
297#else 297#else
298 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 298 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
299#endif 299#endif
300 add r0, r0, #CACHE_DLINESIZE 300 add r0, r0, #CACHE_DLINESIZE
301 cmp r0, r1 301 cmp r0, r1
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 44ead902bd54..1a3d63df8e90 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -222,7 +222,7 @@ ENTRY(arm940_dma_flush_range)
222#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 222#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
223 mcr p15, 0, r3, c7, c14, 2 @ clean/flush D entry 223 mcr p15, 0, r3, c7, c14, 2 @ clean/flush D entry
224#else 224#else
225 mcr p15, 0, r3, c7, c10, 2 @ clean D entry 225 mcr p15, 0, r3, c7, c6, 2 @ invalidate D entry
226#endif 226#endif
227 subs r3, r3, #1 << 26 227 subs r3, r3, #1 << 26
228 bcs 2b @ entries 63 to 0 228 bcs 2b @ entries 63 to 0
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index 2218b0c01330..82d579ac9b98 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -265,7 +265,7 @@ ENTRY(arm946_dma_flush_range)
265#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 265#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
266 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 266 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
267#else 267#else
268 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 268 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
269#endif 269#endif
270 add r0, r0, #CACHE_DLINESIZE 270 add r0, r0, #CACHE_DLINESIZE
271 cmp r0, r1 271 cmp r0, r1
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 72d34a23a2ec..2db5580048d8 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/cpufreq.h>
24 25
25#include <asm/io.h> 26#include <asm/io.h>
26 27
@@ -134,9 +135,17 @@ void clk_disable(struct clk *clk)
134 return; 135 return;
135 136
136 spin_lock_irqsave(&clockfw_lock, flags); 137 spin_lock_irqsave(&clockfw_lock, flags);
137 BUG_ON(clk->usecount == 0); 138 if (clk->usecount == 0) {
139 printk(KERN_ERR "Trying disable clock %s with 0 usecount\n",
140 clk->name);
141 WARN_ON(1);
142 goto out;
143 }
144
138 if (arch_clock->clk_disable) 145 if (arch_clock->clk_disable)
139 arch_clock->clk_disable(clk); 146 arch_clock->clk_disable(clk);
147
148out:
140 spin_unlock_irqrestore(&clockfw_lock, flags); 149 spin_unlock_irqrestore(&clockfw_lock, flags);
141} 150}
142EXPORT_SYMBOL(clk_disable); 151EXPORT_SYMBOL(clk_disable);
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 793740686be2..c00eda588cd8 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -604,6 +604,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
604 chan->data = data; 604 chan->data = data;
605#ifndef CONFIG_ARCH_OMAP1 605#ifndef CONFIG_ARCH_OMAP1
606 chan->chain_id = -1; 606 chan->chain_id = -1;
607 chan->next_linked_ch = -1;
607#endif 608#endif
608 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; 609 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
609 610
@@ -1087,7 +1088,6 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1087 printk(KERN_ERR "omap_dma: Request failed %d\n", err); 1088 printk(KERN_ERR "omap_dma: Request failed %d\n", err);
1088 return err; 1089 return err;
1089 } 1090 }
1090 dma_chan[channels[i]].next_linked_ch = -1;
1091 dma_chan[channels[i]].prev_linked_ch = -1; 1091 dma_chan[channels[i]].prev_linked_ch = -1;
1092 dma_chan[channels[i]].state = DMA_CH_NOTSTARTED; 1092 dma_chan[channels[i]].state = DMA_CH_NOTSTARTED;
1093 1093
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 1945ddfec18d..6f33f58bca45 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -355,7 +355,6 @@ static int omap_mbox_init(struct omap_mbox *mbox)
355 "failed to register mailbox interrupt:%d\n", ret); 355 "failed to register mailbox interrupt:%d\n", ret);
356 goto fail_request_irq; 356 goto fail_request_irq;
357 } 357 }
358 enable_mbox_irq(mbox, IRQ_RX);
359 358
360 mq = mbox_queue_alloc(mbox, mbox_txq_fn, mbox_tx_work); 359 mq = mbox_queue_alloc(mbox, mbox_txq_fn, mbox_tx_work);
361 if (!mq) { 360 if (!mq) {
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
index f197bb3a2366..2f01af5f64c4 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.c
+++ b/arch/arm/plat-s3c24xx/s3c244x.c
@@ -65,6 +65,7 @@ void __init s3c244x_map_io(struct map_desc *mach_desc, int size)
65 65
66 /* rename any peripherals used differing from the s3c2410 */ 66 /* rename any peripherals used differing from the s3c2410 */
67 67
68 s3c_device_sdi.name = "s3c2440-sdi";
68 s3c_device_i2c.name = "s3c2440-i2c"; 69 s3c_device_i2c.name = "s3c2440-i2c";
69 s3c_device_nand.name = "s3c2440-nand"; 70 s3c_device_nand.name = "s3c2440-nand";
70 s3c_device_usbgadget.name = "s3c2440-usbgadget"; 71 s3c_device_usbgadget.name = "s3c2440-usbgadget";
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig
index 06046074d68b..119edb839ac3 100644
--- a/arch/avr32/configs/atngw100_defconfig
+++ b/arch/avr32/configs/atngw100_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.24-rc7 3# Linux kernel version: 2.6.26-rc3
4# Wed Jan 9 23:20:41 2008 4# Mon May 26 13:30:59 2008
5# 5#
6CONFIG_AVR32=y 6CONFIG_AVR32=y
7CONFIG_GENERIC_GPIO=y 7CONFIG_GENERIC_GPIO=y
@@ -13,10 +13,10 @@ CONFIG_HARDIRQS_SW_RESEND=y
13CONFIG_GENERIC_IRQ_PROBE=y 13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_RWSEM_GENERIC_SPINLOCK=y 14CONFIG_RWSEM_GENERIC_SPINLOCK=y
15CONFIG_GENERIC_TIME=y 15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
16# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 17# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_ARCH_SUPPORTS_OPROFILE=y
20CONFIG_GENERIC_HWEIGHT=y 20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y 21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_BUG=y 22CONFIG_GENERIC_BUG=y
@@ -37,17 +37,15 @@ CONFIG_POSIX_MQUEUE=y
37CONFIG_BSD_PROCESS_ACCT=y 37CONFIG_BSD_PROCESS_ACCT=y
38CONFIG_BSD_PROCESS_ACCT_V3=y 38CONFIG_BSD_PROCESS_ACCT_V3=y
39# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
40# CONFIG_USER_NS is not set
41# CONFIG_PID_NS is not set
42# CONFIG_AUDIT is not set 40# CONFIG_AUDIT is not set
43# CONFIG_IKCONFIG is not set 41# CONFIG_IKCONFIG is not set
44CONFIG_LOG_BUF_SHIFT=14 42CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_CGROUPS is not set 43# CONFIG_CGROUPS is not set
46CONFIG_FAIR_GROUP_SCHED=y 44# CONFIG_GROUP_SCHED is not set
47CONFIG_FAIR_USER_SCHED=y
48# CONFIG_FAIR_CGROUP_SCHED is not set
49CONFIG_SYSFS_DEPRECATED=y 45CONFIG_SYSFS_DEPRECATED=y
46CONFIG_SYSFS_DEPRECATED_V2=y
50# CONFIG_RELAY is not set 47# CONFIG_RELAY is not set
48# CONFIG_NAMESPACES is not set
51CONFIG_BLK_DEV_INITRD=y 49CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE="" 50CONFIG_INITRAMFS_SOURCE=""
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y 51CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -61,11 +59,13 @@ CONFIG_HOTPLUG=y
61CONFIG_PRINTK=y 59CONFIG_PRINTK=y
62CONFIG_BUG=y 60CONFIG_BUG=y
63CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62# CONFIG_COMPAT_BRK is not set
64# CONFIG_BASE_FULL is not set 63# CONFIG_BASE_FULL is not set
65CONFIG_FUTEX=y 64CONFIG_FUTEX=y
66CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
67CONFIG_EPOLL=y 66CONFIG_EPOLL=y
68CONFIG_SIGNALFD=y 67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y 69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y 70CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
@@ -73,11 +73,21 @@ CONFIG_SLUB_DEBUG=y
73# CONFIG_SLAB is not set 73# CONFIG_SLAB is not set
74CONFIG_SLUB=y 74CONFIG_SLUB=y
75# CONFIG_SLOB is not set 75# CONFIG_SLOB is not set
76CONFIG_PROFILING=y
77# CONFIG_MARKERS is not set
78CONFIG_OPROFILE=m
79CONFIG_HAVE_OPROFILE=y
80CONFIG_KPROBES=y
81CONFIG_HAVE_KPROBES=y
82# CONFIG_HAVE_KRETPROBES is not set
83# CONFIG_HAVE_DMA_ATTRS is not set
84CONFIG_PROC_PAGE_MONITOR=y
76CONFIG_SLABINFO=y 85CONFIG_SLABINFO=y
77CONFIG_RT_MUTEXES=y 86CONFIG_RT_MUTEXES=y
78# CONFIG_TINY_SHMEM is not set 87# CONFIG_TINY_SHMEM is not set
79CONFIG_BASE_SMALL=1 88CONFIG_BASE_SMALL=1
80CONFIG_MODULES=y 89CONFIG_MODULES=y
90# CONFIG_MODULE_FORCE_LOAD is not set
81CONFIG_MODULE_UNLOAD=y 91CONFIG_MODULE_UNLOAD=y
82CONFIG_MODULE_FORCE_UNLOAD=y 92CONFIG_MODULE_FORCE_UNLOAD=y
83# CONFIG_MODVERSIONS is not set 93# CONFIG_MODVERSIONS is not set
@@ -101,10 +111,15 @@ CONFIG_IOSCHED_CFQ=y
101CONFIG_DEFAULT_CFQ=y 111CONFIG_DEFAULT_CFQ=y
102# CONFIG_DEFAULT_NOOP is not set 112# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="cfq" 113CONFIG_DEFAULT_IOSCHED="cfq"
114CONFIG_CLASSIC_RCU=y
104 115
105# 116#
106# System Type and features 117# System Type and features
107# 118#
119CONFIG_TICK_ONESHOT=y
120CONFIG_NO_HZ=y
121CONFIG_HIGH_RES_TIMERS=y
122CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
108CONFIG_SUBARCH_AVR32B=y 123CONFIG_SUBARCH_AVR32B=y
109CONFIG_MMU=y 124CONFIG_MMU=y
110CONFIG_PERFORMANCE_COUNTERS=y 125CONFIG_PERFORMANCE_COUNTERS=y
@@ -141,16 +156,19 @@ CONFIG_FLATMEM=y
141CONFIG_FLAT_NODE_MEM_MAP=y 156CONFIG_FLAT_NODE_MEM_MAP=y
142# CONFIG_SPARSEMEM_STATIC is not set 157# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 158# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
159CONFIG_PAGEFLAGS_EXTENDED=y
144CONFIG_SPLIT_PTLOCK_CPUS=4 160CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set 161# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=0 162CONFIG_ZONE_DMA_FLAG=0
147CONFIG_VIRT_TO_BUS=y 163CONFIG_VIRT_TO_BUS=y
148# CONFIG_OWNERSHIP_TRACE is not set 164# CONFIG_OWNERSHIP_TRACE is not set
165CONFIG_NMI_DEBUGGING=y
149# CONFIG_HZ_100 is not set 166# CONFIG_HZ_100 is not set
150CONFIG_HZ_250=y 167CONFIG_HZ_250=y
151# CONFIG_HZ_300 is not set 168# CONFIG_HZ_300 is not set
152# CONFIG_HZ_1000 is not set 169# CONFIG_HZ_1000 is not set
153CONFIG_HZ=250 170CONFIG_HZ=250
171# CONFIG_SCHED_HRTICK is not set
154CONFIG_CMDLINE="" 172CONFIG_CMDLINE=""
155 173
156# 174#
@@ -164,9 +182,10 @@ CONFIG_CPU_FREQ=y
164CONFIG_CPU_FREQ_TABLE=y 182CONFIG_CPU_FREQ_TABLE=y
165# CONFIG_CPU_FREQ_DEBUG is not set 183# CONFIG_CPU_FREQ_DEBUG is not set
166# CONFIG_CPU_FREQ_STAT is not set 184# CONFIG_CPU_FREQ_STAT is not set
167CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 185# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
186# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
168# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 187# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
169# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 188CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
170# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 189# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
171CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 190CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
172# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 191# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
@@ -202,6 +221,7 @@ CONFIG_XFRM=y
202CONFIG_XFRM_USER=y 221CONFIG_XFRM_USER=y
203# CONFIG_XFRM_SUB_POLICY is not set 222# CONFIG_XFRM_SUB_POLICY is not set
204# CONFIG_XFRM_MIGRATE is not set 223# CONFIG_XFRM_MIGRATE is not set
224# CONFIG_XFRM_STATISTICS is not set
205CONFIG_NET_KEY=y 225CONFIG_NET_KEY=y
206# CONFIG_NET_KEY_MIGRATE is not set 226# CONFIG_NET_KEY_MIGRATE is not set
207CONFIG_INET=y 227CONFIG_INET=y
@@ -255,87 +275,40 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
255CONFIG_INET6_XFRM_MODE_BEET=y 275CONFIG_INET6_XFRM_MODE_BEET=y
256# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 276# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
257CONFIG_IPV6_SIT=y 277CONFIG_IPV6_SIT=y
278CONFIG_IPV6_NDISC_NODETYPE=y
258# CONFIG_IPV6_TUNNEL is not set 279# CONFIG_IPV6_TUNNEL is not set
259# CONFIG_IPV6_MULTIPLE_TABLES is not set 280# CONFIG_IPV6_MULTIPLE_TABLES is not set
281# CONFIG_IPV6_MROUTE is not set
260# CONFIG_NETWORK_SECMARK is not set 282# CONFIG_NETWORK_SECMARK is not set
261CONFIG_NETFILTER=y 283CONFIG_NETFILTER=y
262# CONFIG_NETFILTER_DEBUG is not set 284# CONFIG_NETFILTER_DEBUG is not set
263CONFIG_BRIDGE_NETFILTER=y 285# CONFIG_NETFILTER_ADVANCED is not set
264 286
265# 287#
266# Core Netfilter Configuration 288# Core Netfilter Configuration
267# 289#
268# CONFIG_NETFILTER_NETLINK is not set 290CONFIG_NETFILTER_NETLINK=m
269CONFIG_NF_CONNTRACK_ENABLED=m 291CONFIG_NETFILTER_NETLINK_LOG=m
270CONFIG_NF_CONNTRACK=m 292CONFIG_NF_CONNTRACK=m
271CONFIG_NF_CT_ACCT=y
272CONFIG_NF_CONNTRACK_MARK=y
273# CONFIG_NF_CONNTRACK_EVENTS is not set
274CONFIG_NF_CT_PROTO_GRE=m
275# CONFIG_NF_CT_PROTO_SCTP is not set
276# CONFIG_NF_CT_PROTO_UDPLITE is not set
277CONFIG_NF_CONNTRACK_AMANDA=m
278CONFIG_NF_CONNTRACK_FTP=m 293CONFIG_NF_CONNTRACK_FTP=m
279CONFIG_NF_CONNTRACK_H323=m
280CONFIG_NF_CONNTRACK_IRC=m 294CONFIG_NF_CONNTRACK_IRC=m
281CONFIG_NF_CONNTRACK_NETBIOS_NS=m
282CONFIG_NF_CONNTRACK_PPTP=m
283CONFIG_NF_CONNTRACK_SANE=m
284CONFIG_NF_CONNTRACK_SIP=m 295CONFIG_NF_CONNTRACK_SIP=m
285CONFIG_NF_CONNTRACK_TFTP=m 296CONFIG_NF_CT_NETLINK=m
286CONFIG_NETFILTER_XTABLES=y 297CONFIG_NETFILTER_XTABLES=y
287CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
288# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set
289# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
290CONFIG_NETFILTER_XT_TARGET_MARK=m 298CONFIG_NETFILTER_XT_TARGET_MARK=m
291CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
292CONFIG_NETFILTER_XT_TARGET_NFLOG=m 299CONFIG_NETFILTER_XT_TARGET_NFLOG=m
293# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
294# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
295CONFIG_NETFILTER_XT_TARGET_TCPMSS=m 300CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
296CONFIG_NETFILTER_XT_MATCH_COMMENT=m
297CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
298# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
299CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
300CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m 301CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
301# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
302# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
303CONFIG_NETFILTER_XT_MATCH_ESP=m
304CONFIG_NETFILTER_XT_MATCH_HELPER=m
305CONFIG_NETFILTER_XT_MATCH_LENGTH=m
306CONFIG_NETFILTER_XT_MATCH_LIMIT=m
307CONFIG_NETFILTER_XT_MATCH_MAC=m
308CONFIG_NETFILTER_XT_MATCH_MARK=m 302CONFIG_NETFILTER_XT_MATCH_MARK=m
309CONFIG_NETFILTER_XT_MATCH_POLICY=m 303CONFIG_NETFILTER_XT_MATCH_POLICY=m
310CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
311# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
312CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
313CONFIG_NETFILTER_XT_MATCH_QUOTA=m
314CONFIG_NETFILTER_XT_MATCH_REALM=m
315# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
316CONFIG_NETFILTER_XT_MATCH_STATE=m 304CONFIG_NETFILTER_XT_MATCH_STATE=m
317CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
318CONFIG_NETFILTER_XT_MATCH_STRING=m
319CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
320# CONFIG_NETFILTER_XT_MATCH_TIME is not set
321# CONFIG_NETFILTER_XT_MATCH_U32 is not set
322CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
323 305
324# 306#
325# IP: Netfilter Configuration 307# IP: Netfilter Configuration
326# 308#
327CONFIG_NF_CONNTRACK_IPV4=m 309CONFIG_NF_CONNTRACK_IPV4=m
328CONFIG_NF_CONNTRACK_PROC_COMPAT=y 310CONFIG_NF_CONNTRACK_PROC_COMPAT=y
329# CONFIG_IP_NF_QUEUE is not set
330CONFIG_IP_NF_IPTABLES=m 311CONFIG_IP_NF_IPTABLES=m
331CONFIG_IP_NF_MATCH_IPRANGE=m
332CONFIG_IP_NF_MATCH_TOS=m
333CONFIG_IP_NF_MATCH_RECENT=m
334CONFIG_IP_NF_MATCH_ECN=m
335CONFIG_IP_NF_MATCH_AH=m
336CONFIG_IP_NF_MATCH_TTL=m
337CONFIG_IP_NF_MATCH_OWNER=m
338CONFIG_IP_NF_MATCH_ADDRTYPE=m
339CONFIG_IP_NF_FILTER=m 312CONFIG_IP_NF_FILTER=m
340CONFIG_IP_NF_TARGET_REJECT=m 313CONFIG_IP_NF_TARGET_REJECT=m
341CONFIG_IP_NF_TARGET_LOG=m 314CONFIG_IP_NF_TARGET_LOG=m
@@ -343,54 +316,25 @@ CONFIG_IP_NF_TARGET_LOG=m
343CONFIG_NF_NAT=m 316CONFIG_NF_NAT=m
344CONFIG_NF_NAT_NEEDED=y 317CONFIG_NF_NAT_NEEDED=y
345CONFIG_IP_NF_TARGET_MASQUERADE=m 318CONFIG_IP_NF_TARGET_MASQUERADE=m
346CONFIG_IP_NF_TARGET_REDIRECT=m
347CONFIG_IP_NF_TARGET_NETMAP=m
348CONFIG_IP_NF_TARGET_SAME=m
349CONFIG_NF_NAT_SNMP_BASIC=m
350CONFIG_NF_NAT_PROTO_GRE=m
351CONFIG_NF_NAT_FTP=m 319CONFIG_NF_NAT_FTP=m
352CONFIG_NF_NAT_IRC=m 320CONFIG_NF_NAT_IRC=m
353CONFIG_NF_NAT_TFTP=m 321# CONFIG_NF_NAT_TFTP is not set
354CONFIG_NF_NAT_AMANDA=m 322# CONFIG_NF_NAT_AMANDA is not set
355CONFIG_NF_NAT_PPTP=m 323# CONFIG_NF_NAT_PPTP is not set
356CONFIG_NF_NAT_H323=m 324# CONFIG_NF_NAT_H323 is not set
357CONFIG_NF_NAT_SIP=m 325CONFIG_NF_NAT_SIP=m
358CONFIG_IP_NF_MANGLE=m 326CONFIG_IP_NF_MANGLE=m
359CONFIG_IP_NF_TARGET_TOS=m
360CONFIG_IP_NF_TARGET_ECN=m
361CONFIG_IP_NF_TARGET_TTL=m
362CONFIG_IP_NF_TARGET_CLUSTERIP=m
363CONFIG_IP_NF_RAW=m
364CONFIG_IP_NF_ARPTABLES=m
365CONFIG_IP_NF_ARPFILTER=m
366CONFIG_IP_NF_ARP_MANGLE=m
367 327
368# 328#
369# IPv6: Netfilter Configuration (EXPERIMENTAL) 329# IPv6: Netfilter Configuration
370# 330#
371CONFIG_NF_CONNTRACK_IPV6=m 331CONFIG_NF_CONNTRACK_IPV6=m
372CONFIG_IP6_NF_QUEUE=m
373CONFIG_IP6_NF_IPTABLES=m 332CONFIG_IP6_NF_IPTABLES=m
374CONFIG_IP6_NF_MATCH_RT=m
375CONFIG_IP6_NF_MATCH_OPTS=m
376CONFIG_IP6_NF_MATCH_FRAG=m
377CONFIG_IP6_NF_MATCH_HL=m
378CONFIG_IP6_NF_MATCH_OWNER=m
379CONFIG_IP6_NF_MATCH_IPV6HEADER=m 333CONFIG_IP6_NF_MATCH_IPV6HEADER=m
380CONFIG_IP6_NF_MATCH_AH=m
381CONFIG_IP6_NF_MATCH_MH=m
382CONFIG_IP6_NF_MATCH_EUI64=m
383CONFIG_IP6_NF_FILTER=m 334CONFIG_IP6_NF_FILTER=m
384CONFIG_IP6_NF_TARGET_LOG=m 335CONFIG_IP6_NF_TARGET_LOG=m
385CONFIG_IP6_NF_TARGET_REJECT=m 336CONFIG_IP6_NF_TARGET_REJECT=m
386CONFIG_IP6_NF_MANGLE=m 337CONFIG_IP6_NF_MANGLE=m
387CONFIG_IP6_NF_TARGET_HL=m
388CONFIG_IP6_NF_RAW=m
389
390#
391# Bridge: Netfilter Configuration
392#
393# CONFIG_BRIDGE_NF_EBTABLES is not set
394# CONFIG_IP_DCCP is not set 338# CONFIG_IP_DCCP is not set
395# CONFIG_IP_SCTP is not set 339# CONFIG_IP_SCTP is not set
396# CONFIG_TIPC is not set 340# CONFIG_TIPC is not set
@@ -407,7 +351,6 @@ CONFIG_LLC=m
407# CONFIG_ECONET is not set 351# CONFIG_ECONET is not set
408# CONFIG_WAN_ROUTER is not set 352# CONFIG_WAN_ROUTER is not set
409# CONFIG_NET_SCHED is not set 353# CONFIG_NET_SCHED is not set
410CONFIG_NET_CLS_ROUTE=y
411 354
412# 355#
413# Network testing 356# Network testing
@@ -415,6 +358,7 @@ CONFIG_NET_CLS_ROUTE=y
415# CONFIG_NET_PKTGEN is not set 358# CONFIG_NET_PKTGEN is not set
416# CONFIG_NET_TCPPROBE is not set 359# CONFIG_NET_TCPPROBE is not set
417# CONFIG_HAMRADIO is not set 360# CONFIG_HAMRADIO is not set
361# CONFIG_CAN is not set
418# CONFIG_IRDA is not set 362# CONFIG_IRDA is not set
419# CONFIG_BT is not set 363# CONFIG_BT is not set
420# CONFIG_AF_RXRPC is not set 364# CONFIG_AF_RXRPC is not set
@@ -450,6 +394,7 @@ CONFIG_MTD=y
450CONFIG_MTD_PARTITIONS=y 394CONFIG_MTD_PARTITIONS=y
451# CONFIG_MTD_REDBOOT_PARTS is not set 395# CONFIG_MTD_REDBOOT_PARTS is not set
452CONFIG_MTD_CMDLINE_PARTS=y 396CONFIG_MTD_CMDLINE_PARTS=y
397# CONFIG_MTD_AR7_PARTS is not set
453 398
454# 399#
455# User Modules And Translation Layers 400# User Modules And Translation Layers
@@ -531,11 +476,18 @@ CONFIG_BLK_DEV_NBD=m
531CONFIG_BLK_DEV_RAM=m 476CONFIG_BLK_DEV_RAM=m
532CONFIG_BLK_DEV_RAM_COUNT=16 477CONFIG_BLK_DEV_RAM_COUNT=16
533CONFIG_BLK_DEV_RAM_SIZE=4096 478CONFIG_BLK_DEV_RAM_SIZE=4096
534CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 479# CONFIG_BLK_DEV_XIP is not set
535# CONFIG_CDROM_PKTCDVD is not set 480# CONFIG_CDROM_PKTCDVD is not set
536# CONFIG_ATA_OVER_ETH is not set 481# CONFIG_ATA_OVER_ETH is not set
537# CONFIG_MISC_DEVICES is not set 482CONFIG_MISC_DEVICES=y
538# CONFIG_IDE is not set 483# CONFIG_ATMEL_PWM is not set
484CONFIG_ATMEL_TCLIB=y
485CONFIG_ATMEL_TCB_CLKSRC=y
486CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
487# CONFIG_EEPROM_93CX6 is not set
488# CONFIG_ATMEL_SSC is not set
489# CONFIG_ENCLOSURE_SERVICES is not set
490# CONFIG_HAVE_IDE is not set
539 491
540# 492#
541# SCSI device support 493# SCSI device support
@@ -568,11 +520,13 @@ CONFIG_PHYLIB=y
568# CONFIG_SMSC_PHY is not set 520# CONFIG_SMSC_PHY is not set
569# CONFIG_BROADCOM_PHY is not set 521# CONFIG_BROADCOM_PHY is not set
570# CONFIG_ICPLUS_PHY is not set 522# CONFIG_ICPLUS_PHY is not set
523# CONFIG_REALTEK_PHY is not set
571# CONFIG_FIXED_PHY is not set 524# CONFIG_FIXED_PHY is not set
572# CONFIG_MDIO_BITBANG is not set 525# CONFIG_MDIO_BITBANG is not set
573CONFIG_NET_ETHERNET=y 526CONFIG_NET_ETHERNET=y
574# CONFIG_MII is not set 527# CONFIG_MII is not set
575CONFIG_MACB=y 528CONFIG_MACB=y
529# CONFIG_ENC28J60 is not set
576# CONFIG_IBM_NEW_EMAC_ZMII is not set 530# CONFIG_IBM_NEW_EMAC_ZMII is not set
577# CONFIG_IBM_NEW_EMAC_RGMII is not set 531# CONFIG_IBM_NEW_EMAC_RGMII is not set
578# CONFIG_IBM_NEW_EMAC_TAH is not set 532# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -586,6 +540,7 @@ CONFIG_MACB=y
586# 540#
587# CONFIG_WLAN_PRE80211 is not set 541# CONFIG_WLAN_PRE80211 is not set
588# CONFIG_WLAN_80211 is not set 542# CONFIG_WLAN_80211 is not set
543# CONFIG_IWLWIFI_LEDS is not set
589# CONFIG_WAN is not set 544# CONFIG_WAN is not set
590CONFIG_PPP=m 545CONFIG_PPP=m
591# CONFIG_PPP_MULTILINK is not set 546# CONFIG_PPP_MULTILINK is not set
@@ -599,7 +554,6 @@ CONFIG_PPPOE=m
599# CONFIG_PPPOL2TP is not set 554# CONFIG_PPPOL2TP is not set
600# CONFIG_SLIP is not set 555# CONFIG_SLIP is not set
601CONFIG_SLHC=m 556CONFIG_SLHC=m
602# CONFIG_SHAPER is not set
603# CONFIG_NETCONSOLE is not set 557# CONFIG_NETCONSOLE is not set
604# CONFIG_NETPOLL is not set 558# CONFIG_NETPOLL is not set
605# CONFIG_NET_POLL_CONTROLLER is not set 559# CONFIG_NET_POLL_CONTROLLER is not set
@@ -621,6 +575,7 @@ CONFIG_SLHC=m
621# Character devices 575# Character devices
622# 576#
623# CONFIG_VT is not set 577# CONFIG_VT is not set
578# CONFIG_DEVKMEM is not set
624# CONFIG_SERIAL_NONSTANDARD is not set 579# CONFIG_SERIAL_NONSTANDARD is not set
625 580
626# 581#
@@ -633,6 +588,7 @@ CONFIG_SLHC=m
633# 588#
634CONFIG_SERIAL_ATMEL=y 589CONFIG_SERIAL_ATMEL=y
635CONFIG_SERIAL_ATMEL_CONSOLE=y 590CONFIG_SERIAL_ATMEL_CONSOLE=y
591CONFIG_SERIAL_ATMEL_PDC=y
636# CONFIG_SERIAL_ATMEL_TTYAT is not set 592# CONFIG_SERIAL_ATMEL_TTYAT is not set
637CONFIG_SERIAL_CORE=y 593CONFIG_SERIAL_CORE=y
638CONFIG_SERIAL_CORE_CONSOLE=y 594CONFIG_SERIAL_CORE_CONSOLE=y
@@ -640,21 +596,13 @@ CONFIG_UNIX98_PTYS=y
640# CONFIG_LEGACY_PTYS is not set 596# CONFIG_LEGACY_PTYS is not set
641# CONFIG_IPMI_HANDLER is not set 597# CONFIG_IPMI_HANDLER is not set
642# CONFIG_HW_RANDOM is not set 598# CONFIG_HW_RANDOM is not set
643# CONFIG_RTC is not set
644# CONFIG_GEN_RTC is not set
645# CONFIG_R3964 is not set 599# CONFIG_R3964 is not set
646# CONFIG_RAW_DRIVER is not set 600# CONFIG_RAW_DRIVER is not set
647# CONFIG_TCG_TPM is not set 601# CONFIG_TCG_TPM is not set
648CONFIG_I2C=m 602CONFIG_I2C=m
649CONFIG_I2C_BOARDINFO=y 603CONFIG_I2C_BOARDINFO=y
650CONFIG_I2C_CHARDEV=m 604CONFIG_I2C_CHARDEV=m
651
652#
653# I2C Algorithms
654#
655CONFIG_I2C_ALGOBIT=m 605CONFIG_I2C_ALGOBIT=m
656# CONFIG_I2C_ALGOPCF is not set
657# CONFIG_I2C_ALGOPCA is not set
658 606
659# 607#
660# I2C Hardware Bus support 608# I2C Hardware Bus support
@@ -665,27 +613,23 @@ CONFIG_I2C_GPIO=m
665# CONFIG_I2C_SIMTEC is not set 613# CONFIG_I2C_SIMTEC is not set
666# CONFIG_I2C_TAOS_EVM is not set 614# CONFIG_I2C_TAOS_EVM is not set
667# CONFIG_I2C_STUB is not set 615# CONFIG_I2C_STUB is not set
616# CONFIG_I2C_PCA_PLATFORM is not set
668 617
669# 618#
670# Miscellaneous I2C Chip support 619# Miscellaneous I2C Chip support
671# 620#
672# CONFIG_SENSORS_DS1337 is not set
673# CONFIG_SENSORS_DS1374 is not set
674# CONFIG_DS1682 is not set 621# CONFIG_DS1682 is not set
675# CONFIG_SENSORS_EEPROM is not set 622# CONFIG_SENSORS_EEPROM is not set
676# CONFIG_SENSORS_PCF8574 is not set 623# CONFIG_SENSORS_PCF8574 is not set
677# CONFIG_SENSORS_PCA9539 is not set 624# CONFIG_PCF8575 is not set
678# CONFIG_SENSORS_PCF8591 is not set 625# CONFIG_SENSORS_PCF8591 is not set
626# CONFIG_TPS65010 is not set
679# CONFIG_SENSORS_MAX6875 is not set 627# CONFIG_SENSORS_MAX6875 is not set
680# CONFIG_SENSORS_TSL2550 is not set 628# CONFIG_SENSORS_TSL2550 is not set
681# CONFIG_I2C_DEBUG_CORE is not set 629# CONFIG_I2C_DEBUG_CORE is not set
682# CONFIG_I2C_DEBUG_ALGO is not set 630# CONFIG_I2C_DEBUG_ALGO is not set
683# CONFIG_I2C_DEBUG_BUS is not set 631# CONFIG_I2C_DEBUG_BUS is not set
684# CONFIG_I2C_DEBUG_CHIP is not set 632# CONFIG_I2C_DEBUG_CHIP is not set
685
686#
687# SPI support
688#
689CONFIG_SPI=y 633CONFIG_SPI=y
690# CONFIG_SPI_DEBUG is not set 634# CONFIG_SPI_DEBUG is not set
691CONFIG_SPI_MASTER=y 635CONFIG_SPI_MASTER=y
@@ -702,9 +646,27 @@ CONFIG_SPI_ATMEL=y
702# CONFIG_SPI_AT25 is not set 646# CONFIG_SPI_AT25 is not set
703CONFIG_SPI_SPIDEV=m 647CONFIG_SPI_SPIDEV=m
704# CONFIG_SPI_TLE62X0 is not set 648# CONFIG_SPI_TLE62X0 is not set
649CONFIG_HAVE_GPIO_LIB=y
650
651#
652# GPIO Support
653#
654# CONFIG_DEBUG_GPIO is not set
655
656#
657# I2C GPIO expanders:
658#
659# CONFIG_GPIO_PCA953X is not set
660# CONFIG_GPIO_PCF857X is not set
661
662#
663# SPI GPIO expanders:
664#
665# CONFIG_GPIO_MCP23S08 is not set
705# CONFIG_W1 is not set 666# CONFIG_W1 is not set
706# CONFIG_POWER_SUPPLY is not set 667# CONFIG_POWER_SUPPLY is not set
707# CONFIG_HWMON is not set 668# CONFIG_HWMON is not set
669# CONFIG_THERMAL is not set
708CONFIG_WATCHDOG=y 670CONFIG_WATCHDOG=y
709# CONFIG_WATCHDOG_NOWAYOUT is not set 671# CONFIG_WATCHDOG_NOWAYOUT is not set
710 672
@@ -724,12 +686,22 @@ CONFIG_SSB_POSSIBLE=y
724# Multifunction device drivers 686# Multifunction device drivers
725# 687#
726# CONFIG_MFD_SM501 is not set 688# CONFIG_MFD_SM501 is not set
689# CONFIG_HTC_PASIC3 is not set
727 690
728# 691#
729# Multimedia devices 692# Multimedia devices
730# 693#
694
695#
696# Multimedia core support
697#
731# CONFIG_VIDEO_DEV is not set 698# CONFIG_VIDEO_DEV is not set
732# CONFIG_DVB_CORE is not set 699# CONFIG_DVB_CORE is not set
700# CONFIG_VIDEO_MEDIA is not set
701
702#
703# Multimedia drivers
704#
733# CONFIG_DAB is not set 705# CONFIG_DAB is not set
734 706
735# 707#
@@ -753,14 +725,12 @@ CONFIG_USB_SUPPORT=y
753# CONFIG_USB_ARCH_HAS_HCD is not set 725# CONFIG_USB_ARCH_HAS_HCD is not set
754# CONFIG_USB_ARCH_HAS_OHCI is not set 726# CONFIG_USB_ARCH_HAS_OHCI is not set
755# CONFIG_USB_ARCH_HAS_EHCI is not set 727# CONFIG_USB_ARCH_HAS_EHCI is not set
728# CONFIG_USB_OTG_WHITELIST is not set
729# CONFIG_USB_OTG_BLACKLIST_HUB is not set
756 730
757# 731#
758# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 732# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
759# 733#
760
761#
762# USB Gadget Support
763#
764CONFIG_USB_GADGET=y 734CONFIG_USB_GADGET=y
765# CONFIG_USB_GADGET_DEBUG is not set 735# CONFIG_USB_GADGET_DEBUG is not set
766# CONFIG_USB_GADGET_DEBUG_FILES is not set 736# CONFIG_USB_GADGET_DEBUG_FILES is not set
@@ -772,6 +742,7 @@ CONFIG_USB_ATMEL_USBA=y
772# CONFIG_USB_GADGET_NET2280 is not set 742# CONFIG_USB_GADGET_NET2280 is not set
773# CONFIG_USB_GADGET_PXA2XX is not set 743# CONFIG_USB_GADGET_PXA2XX is not set
774# CONFIG_USB_GADGET_M66592 is not set 744# CONFIG_USB_GADGET_M66592 is not set
745# CONFIG_USB_GADGET_PXA27X is not set
775# CONFIG_USB_GADGET_GOKU is not set 746# CONFIG_USB_GADGET_GOKU is not set
776# CONFIG_USB_GADGET_LH7A40X is not set 747# CONFIG_USB_GADGET_LH7A40X is not set
777# CONFIG_USB_GADGET_OMAP is not set 748# CONFIG_USB_GADGET_OMAP is not set
@@ -787,6 +758,7 @@ CONFIG_USB_FILE_STORAGE=m
787# CONFIG_USB_FILE_STORAGE_TEST is not set 758# CONFIG_USB_FILE_STORAGE_TEST is not set
788CONFIG_USB_G_SERIAL=m 759CONFIG_USB_G_SERIAL=m
789# CONFIG_USB_MIDI_GADGET is not set 760# CONFIG_USB_MIDI_GADGET is not set
761# CONFIG_USB_G_PRINTER is not set
790CONFIG_MMC=m 762CONFIG_MMC=m
791# CONFIG_MMC_DEBUG is not set 763# CONFIG_MMC_DEBUG is not set
792# CONFIG_MMC_UNSAFE_RESUME is not set 764# CONFIG_MMC_UNSAFE_RESUME is not set
@@ -797,11 +769,13 @@ CONFIG_MMC=m
797CONFIG_MMC_BLOCK=m 769CONFIG_MMC_BLOCK=m
798CONFIG_MMC_BLOCK_BOUNCE=y 770CONFIG_MMC_BLOCK_BOUNCE=y
799# CONFIG_SDIO_UART is not set 771# CONFIG_SDIO_UART is not set
772# CONFIG_MMC_TEST is not set
800 773
801# 774#
802# MMC/SD Host Controller Drivers 775# MMC/SD Host Controller Drivers
803# 776#
804CONFIG_MMC_SPI=m 777CONFIG_MMC_SPI=m
778# CONFIG_MEMSTICK is not set
805CONFIG_NEW_LEDS=y 779CONFIG_NEW_LEDS=y
806CONFIG_LEDS_CLASS=y 780CONFIG_LEDS_CLASS=y
807 781
@@ -816,6 +790,8 @@ CONFIG_LEDS_GPIO=y
816CONFIG_LEDS_TRIGGERS=y 790CONFIG_LEDS_TRIGGERS=y
817CONFIG_LEDS_TRIGGER_TIMER=y 791CONFIG_LEDS_TRIGGER_TIMER=y
818CONFIG_LEDS_TRIGGER_HEARTBEAT=y 792CONFIG_LEDS_TRIGGER_HEARTBEAT=y
793CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
794# CONFIG_ACCESSIBILITY is not set
819CONFIG_RTC_LIB=y 795CONFIG_RTC_LIB=y
820CONFIG_RTC_CLASS=y 796CONFIG_RTC_CLASS=y
821CONFIG_RTC_HCTOSYS=y 797CONFIG_RTC_HCTOSYS=y
@@ -844,19 +820,22 @@ CONFIG_RTC_INTF_DEV=y
844# CONFIG_RTC_DRV_PCF8563 is not set 820# CONFIG_RTC_DRV_PCF8563 is not set
845# CONFIG_RTC_DRV_PCF8583 is not set 821# CONFIG_RTC_DRV_PCF8583 is not set
846# CONFIG_RTC_DRV_M41T80 is not set 822# CONFIG_RTC_DRV_M41T80 is not set
823# CONFIG_RTC_DRV_S35390A is not set
847 824
848# 825#
849# SPI RTC drivers 826# SPI RTC drivers
850# 827#
851# CONFIG_RTC_DRV_RS5C348 is not set
852# CONFIG_RTC_DRV_MAX6902 is not set 828# CONFIG_RTC_DRV_MAX6902 is not set
829# CONFIG_RTC_DRV_R9701 is not set
830# CONFIG_RTC_DRV_RS5C348 is not set
853 831
854# 832#
855# Platform RTC drivers 833# Platform RTC drivers
856# 834#
835# CONFIG_RTC_DRV_DS1511 is not set
857# CONFIG_RTC_DRV_DS1553 is not set 836# CONFIG_RTC_DRV_DS1553 is not set
858# CONFIG_RTC_DRV_STK17TA8 is not set
859# CONFIG_RTC_DRV_DS1742 is not set 837# CONFIG_RTC_DRV_DS1742 is not set
838# CONFIG_RTC_DRV_STK17TA8 is not set
860# CONFIG_RTC_DRV_M48T86 is not set 839# CONFIG_RTC_DRV_M48T86 is not set
861# CONFIG_RTC_DRV_M48T59 is not set 840# CONFIG_RTC_DRV_M48T59 is not set
862# CONFIG_RTC_DRV_V3020 is not set 841# CONFIG_RTC_DRV_V3020 is not set
@@ -865,10 +844,6 @@ CONFIG_RTC_INTF_DEV=y
865# on-CPU RTC drivers 844# on-CPU RTC drivers
866# 845#
867CONFIG_RTC_DRV_AT32AP700X=y 846CONFIG_RTC_DRV_AT32AP700X=y
868
869#
870# Userspace I/O
871#
872# CONFIG_UIO is not set 847# CONFIG_UIO is not set
873 848
874# 849#
@@ -885,14 +860,11 @@ CONFIG_JBD=m
885# CONFIG_JFS_FS is not set 860# CONFIG_JFS_FS is not set
886# CONFIG_FS_POSIX_ACL is not set 861# CONFIG_FS_POSIX_ACL is not set
887# CONFIG_XFS_FS is not set 862# CONFIG_XFS_FS is not set
888# CONFIG_GFS2_FS is not set
889# CONFIG_OCFS2_FS is not set 863# CONFIG_OCFS2_FS is not set
890# CONFIG_MINIX_FS is not set 864# CONFIG_DNOTIFY is not set
891# CONFIG_ROMFS_FS is not set
892CONFIG_INOTIFY=y 865CONFIG_INOTIFY=y
893CONFIG_INOTIFY_USER=y 866CONFIG_INOTIFY_USER=y
894# CONFIG_QUOTA is not set 867# CONFIG_QUOTA is not set
895# CONFIG_DNOTIFY is not set
896# CONFIG_AUTOFS_FS is not set 868# CONFIG_AUTOFS_FS is not set
897# CONFIG_AUTOFS4_FS is not set 869# CONFIG_AUTOFS4_FS is not set
898CONFIG_FUSE_FS=m 870CONFIG_FUSE_FS=m
@@ -948,8 +920,10 @@ CONFIG_JFFS2_RTIME=y
948# CONFIG_JFFS2_RUBIN is not set 920# CONFIG_JFFS2_RUBIN is not set
949# CONFIG_CRAMFS is not set 921# CONFIG_CRAMFS is not set
950# CONFIG_VXFS_FS is not set 922# CONFIG_VXFS_FS is not set
923# CONFIG_MINIX_FS is not set
951# CONFIG_HPFS_FS is not set 924# CONFIG_HPFS_FS is not set
952# CONFIG_QNX4FS_FS is not set 925# CONFIG_QNX4FS_FS is not set
926# CONFIG_ROMFS_FS is not set
953# CONFIG_SYSV_FS is not set 927# CONFIG_SYSV_FS is not set
954# CONFIG_UFS_FS is not set 928# CONFIG_UFS_FS is not set
955CONFIG_NETWORK_FILESYSTEMS=y 929CONFIG_NETWORK_FILESYSTEMS=y
@@ -957,12 +931,10 @@ CONFIG_NFS_FS=y
957CONFIG_NFS_V3=y 931CONFIG_NFS_V3=y
958# CONFIG_NFS_V3_ACL is not set 932# CONFIG_NFS_V3_ACL is not set
959# CONFIG_NFS_V4 is not set 933# CONFIG_NFS_V4 is not set
960# CONFIG_NFS_DIRECTIO is not set
961CONFIG_NFSD=m 934CONFIG_NFSD=m
962CONFIG_NFSD_V3=y 935CONFIG_NFSD_V3=y
963# CONFIG_NFSD_V3_ACL is not set 936# CONFIG_NFSD_V3_ACL is not set
964# CONFIG_NFSD_V4 is not set 937# CONFIG_NFSD_V4 is not set
965CONFIG_NFSD_TCP=y
966CONFIG_ROOT_NFS=y 938CONFIG_ROOT_NFS=y
967CONFIG_LOCKD=y 939CONFIG_LOCKD=y
968CONFIG_LOCKD_V4=y 940CONFIG_LOCKD_V4=y
@@ -1030,11 +1002,6 @@ CONFIG_NLS_ISO8859_1=m
1030# CONFIG_NLS_KOI8_U is not set 1002# CONFIG_NLS_KOI8_U is not set
1031CONFIG_NLS_UTF8=m 1003CONFIG_NLS_UTF8=m
1032# CONFIG_DLM is not set 1004# CONFIG_DLM is not set
1033CONFIG_INSTRUMENTATION=y
1034CONFIG_PROFILING=y
1035CONFIG_OPROFILE=m
1036CONFIG_KPROBES=y
1037# CONFIG_MARKERS is not set
1038 1005
1039# 1006#
1040# Kernel hacking 1007# Kernel hacking
@@ -1042,6 +1009,7 @@ CONFIG_KPROBES=y
1042# CONFIG_PRINTK_TIME is not set 1009# CONFIG_PRINTK_TIME is not set
1043CONFIG_ENABLE_WARN_DEPRECATED=y 1010CONFIG_ENABLE_WARN_DEPRECATED=y
1044CONFIG_ENABLE_MUST_CHECK=y 1011CONFIG_ENABLE_MUST_CHECK=y
1012CONFIG_FRAME_WARN=1024
1045CONFIG_MAGIC_SYSRQ=y 1013CONFIG_MAGIC_SYSRQ=y
1046# CONFIG_UNUSED_SYMBOLS is not set 1014# CONFIG_UNUSED_SYMBOLS is not set
1047# CONFIG_DEBUG_FS is not set 1015# CONFIG_DEBUG_FS is not set
@@ -1052,7 +1020,9 @@ CONFIG_DETECT_SOFTLOCKUP=y
1052CONFIG_SCHED_DEBUG=y 1020CONFIG_SCHED_DEBUG=y
1053# CONFIG_SCHEDSTATS is not set 1021# CONFIG_SCHEDSTATS is not set
1054# CONFIG_TIMER_STATS is not set 1022# CONFIG_TIMER_STATS is not set
1023# CONFIG_DEBUG_OBJECTS is not set
1055# CONFIG_SLUB_DEBUG_ON is not set 1024# CONFIG_SLUB_DEBUG_ON is not set
1025# CONFIG_SLUB_STATS is not set
1056# CONFIG_DEBUG_RT_MUTEXES is not set 1026# CONFIG_DEBUG_RT_MUTEXES is not set
1057# CONFIG_RT_MUTEX_TESTER is not set 1027# CONFIG_RT_MUTEX_TESTER is not set
1058# CONFIG_DEBUG_SPINLOCK is not set 1028# CONFIG_DEBUG_SPINLOCK is not set
@@ -1066,12 +1036,14 @@ CONFIG_SCHED_DEBUG=y
1066CONFIG_DEBUG_BUGVERBOSE=y 1036CONFIG_DEBUG_BUGVERBOSE=y
1067# CONFIG_DEBUG_INFO is not set 1037# CONFIG_DEBUG_INFO is not set
1068# CONFIG_DEBUG_VM is not set 1038# CONFIG_DEBUG_VM is not set
1039# CONFIG_DEBUG_WRITECOUNT is not set
1069# CONFIG_DEBUG_LIST is not set 1040# CONFIG_DEBUG_LIST is not set
1070# CONFIG_DEBUG_SG is not set 1041# CONFIG_DEBUG_SG is not set
1071CONFIG_FRAME_POINTER=y 1042CONFIG_FRAME_POINTER=y
1072# CONFIG_FORCED_INLINING is not set
1073# CONFIG_BOOT_PRINTK_DELAY is not set 1043# CONFIG_BOOT_PRINTK_DELAY is not set
1074# CONFIG_RCU_TORTURE_TEST is not set 1044# CONFIG_RCU_TORTURE_TEST is not set
1045# CONFIG_KPROBES_SANITY_TEST is not set
1046# CONFIG_BACKTRACE_SELF_TEST is not set
1075# CONFIG_LKDTM is not set 1047# CONFIG_LKDTM is not set
1076# CONFIG_FAULT_INJECTION is not set 1048# CONFIG_FAULT_INJECTION is not set
1077# CONFIG_SAMPLES is not set 1049# CONFIG_SAMPLES is not set
@@ -1083,52 +1055,90 @@ CONFIG_FRAME_POINTER=y
1083# CONFIG_SECURITY is not set 1055# CONFIG_SECURITY is not set
1084# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1056# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1085CONFIG_CRYPTO=y 1057CONFIG_CRYPTO=y
1058
1059#
1060# Crypto core or helper
1061#
1086CONFIG_CRYPTO_ALGAPI=y 1062CONFIG_CRYPTO_ALGAPI=y
1063CONFIG_CRYPTO_AEAD=y
1087CONFIG_CRYPTO_BLKCIPHER=y 1064CONFIG_CRYPTO_BLKCIPHER=y
1088CONFIG_CRYPTO_HASH=y 1065CONFIG_CRYPTO_HASH=y
1089CONFIG_CRYPTO_MANAGER=y 1066CONFIG_CRYPTO_MANAGER=y
1067# CONFIG_CRYPTO_GF128MUL is not set
1068# CONFIG_CRYPTO_NULL is not set
1069# CONFIG_CRYPTO_CRYPTD is not set
1070CONFIG_CRYPTO_AUTHENC=y
1071# CONFIG_CRYPTO_TEST is not set
1072
1073#
1074# Authenticated Encryption with Associated Data
1075#
1076# CONFIG_CRYPTO_CCM is not set
1077# CONFIG_CRYPTO_GCM is not set
1078# CONFIG_CRYPTO_SEQIV is not set
1079
1080#
1081# Block modes
1082#
1083CONFIG_CRYPTO_CBC=y
1084# CONFIG_CRYPTO_CTR is not set
1085# CONFIG_CRYPTO_CTS is not set
1086CONFIG_CRYPTO_ECB=m
1087# CONFIG_CRYPTO_LRW is not set
1088CONFIG_CRYPTO_PCBC=m
1089# CONFIG_CRYPTO_XTS is not set
1090
1091#
1092# Hash modes
1093#
1090CONFIG_CRYPTO_HMAC=y 1094CONFIG_CRYPTO_HMAC=y
1091# CONFIG_CRYPTO_XCBC is not set 1095# CONFIG_CRYPTO_XCBC is not set
1092# CONFIG_CRYPTO_NULL is not set 1096
1097#
1098# Digest
1099#
1100# CONFIG_CRYPTO_CRC32C is not set
1093# CONFIG_CRYPTO_MD4 is not set 1101# CONFIG_CRYPTO_MD4 is not set
1094CONFIG_CRYPTO_MD5=y 1102CONFIG_CRYPTO_MD5=y
1103# CONFIG_CRYPTO_MICHAEL_MIC is not set
1095CONFIG_CRYPTO_SHA1=y 1104CONFIG_CRYPTO_SHA1=y
1096# CONFIG_CRYPTO_SHA256 is not set 1105# CONFIG_CRYPTO_SHA256 is not set
1097# CONFIG_CRYPTO_SHA512 is not set 1106# CONFIG_CRYPTO_SHA512 is not set
1098# CONFIG_CRYPTO_WP512 is not set
1099# CONFIG_CRYPTO_TGR192 is not set 1107# CONFIG_CRYPTO_TGR192 is not set
1100# CONFIG_CRYPTO_GF128MUL is not set 1108# CONFIG_CRYPTO_WP512 is not set
1101CONFIG_CRYPTO_ECB=m 1109
1102CONFIG_CRYPTO_CBC=y 1110#
1103CONFIG_CRYPTO_PCBC=m 1111# Ciphers
1104# CONFIG_CRYPTO_LRW is not set 1112#
1105# CONFIG_CRYPTO_XTS is not set
1106# CONFIG_CRYPTO_CRYPTD is not set
1107CONFIG_CRYPTO_DES=y
1108# CONFIG_CRYPTO_FCRYPT is not set
1109# CONFIG_CRYPTO_BLOWFISH is not set
1110# CONFIG_CRYPTO_TWOFISH is not set
1111# CONFIG_CRYPTO_SERPENT is not set
1112# CONFIG_CRYPTO_AES is not set 1113# CONFIG_CRYPTO_AES is not set
1114# CONFIG_CRYPTO_ANUBIS is not set
1115CONFIG_CRYPTO_ARC4=m
1116# CONFIG_CRYPTO_BLOWFISH is not set
1117# CONFIG_CRYPTO_CAMELLIA is not set
1113# CONFIG_CRYPTO_CAST5 is not set 1118# CONFIG_CRYPTO_CAST5 is not set
1114# CONFIG_CRYPTO_CAST6 is not set 1119# CONFIG_CRYPTO_CAST6 is not set
1115# CONFIG_CRYPTO_TEA is not set 1120CONFIG_CRYPTO_DES=y
1116CONFIG_CRYPTO_ARC4=m 1121# CONFIG_CRYPTO_FCRYPT is not set
1117# CONFIG_CRYPTO_KHAZAD is not set 1122# CONFIG_CRYPTO_KHAZAD is not set
1118# CONFIG_CRYPTO_ANUBIS is not set 1123# CONFIG_CRYPTO_SALSA20 is not set
1119# CONFIG_CRYPTO_SEED is not set 1124# CONFIG_CRYPTO_SEED is not set
1125# CONFIG_CRYPTO_SERPENT is not set
1126# CONFIG_CRYPTO_TEA is not set
1127# CONFIG_CRYPTO_TWOFISH is not set
1128
1129#
1130# Compression
1131#
1120CONFIG_CRYPTO_DEFLATE=y 1132CONFIG_CRYPTO_DEFLATE=y
1121# CONFIG_CRYPTO_MICHAEL_MIC is not set 1133# CONFIG_CRYPTO_LZO is not set
1122# CONFIG_CRYPTO_CRC32C is not set
1123# CONFIG_CRYPTO_CAMELLIA is not set
1124# CONFIG_CRYPTO_TEST is not set
1125# CONFIG_CRYPTO_AUTHENC is not set
1126CONFIG_CRYPTO_HW=y 1134CONFIG_CRYPTO_HW=y
1127 1135
1128# 1136#
1129# Library routines 1137# Library routines
1130# 1138#
1131CONFIG_BITREVERSE=y 1139CONFIG_BITREVERSE=y
1140# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1141# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1132CONFIG_CRC_CCITT=m 1142CONFIG_CRC_CCITT=m
1133# CONFIG_CRC16 is not set 1143# CONFIG_CRC16 is not set
1134CONFIG_CRC_ITU_T=m 1144CONFIG_CRC_ITU_T=m
@@ -1137,10 +1147,6 @@ CONFIG_CRC7=m
1137# CONFIG_LIBCRC32C is not set 1147# CONFIG_LIBCRC32C is not set
1138CONFIG_ZLIB_INFLATE=y 1148CONFIG_ZLIB_INFLATE=y
1139CONFIG_ZLIB_DEFLATE=y 1149CONFIG_ZLIB_DEFLATE=y
1140CONFIG_TEXTSEARCH=y
1141CONFIG_TEXTSEARCH_KMP=m
1142CONFIG_TEXTSEARCH_BM=m
1143CONFIG_TEXTSEARCH_FSM=m
1144CONFIG_PLIST=y 1150CONFIG_PLIST=y
1145CONFIG_HAS_IOMEM=y 1151CONFIG_HAS_IOMEM=y
1146CONFIG_HAS_IOPORT=y 1152CONFIG_HAS_IOPORT=y
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index 2fb2ede5f2b4..c6d02eac8791 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_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.24-rc7 3# Linux kernel version: 2.6.26-rc3
4# Wed Jan 9 23:07:43 2008 4# Mon May 26 13:30:20 2008
5# 5#
6CONFIG_AVR32=y 6CONFIG_AVR32=y
7CONFIG_GENERIC_GPIO=y 7CONFIG_GENERIC_GPIO=y
@@ -13,10 +13,10 @@ CONFIG_HARDIRQS_SW_RESEND=y
13CONFIG_GENERIC_IRQ_PROBE=y 13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_RWSEM_GENERIC_SPINLOCK=y 14CONFIG_RWSEM_GENERIC_SPINLOCK=y
15CONFIG_GENERIC_TIME=y 15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
16# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 17# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_ARCH_SUPPORTS_OPROFILE=y
20CONFIG_GENERIC_HWEIGHT=y 20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y 21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_BUG=y 22CONFIG_GENERIC_BUG=y
@@ -36,15 +36,15 @@ CONFIG_SYSVIPC_SYSCTL=y
36CONFIG_POSIX_MQUEUE=y 36CONFIG_POSIX_MQUEUE=y
37# CONFIG_BSD_PROCESS_ACCT is not set 37# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 38# CONFIG_TASKSTATS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 39# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 40# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14 41CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set 42# CONFIG_CGROUPS is not set
45# CONFIG_FAIR_GROUP_SCHED is not set 43# CONFIG_GROUP_SCHED is not set
46CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
45CONFIG_SYSFS_DEPRECATED_V2=y
47CONFIG_RELAY=y 46CONFIG_RELAY=y
47# CONFIG_NAMESPACES is not set
48CONFIG_BLK_DEV_INITRD=y 48CONFIG_BLK_DEV_INITRD=y
49CONFIG_INITRAMFS_SOURCE="" 49CONFIG_INITRAMFS_SOURCE=""
50CONFIG_CC_OPTIMIZE_FOR_SIZE=y 50CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -58,11 +58,13 @@ CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 58CONFIG_PRINTK=y
59CONFIG_BUG=y 59CONFIG_BUG=y
60CONFIG_ELF_CORE=y 60CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set
61# CONFIG_BASE_FULL is not set 62# CONFIG_BASE_FULL is not set
62CONFIG_FUTEX=y 63CONFIG_FUTEX=y
63CONFIG_ANON_INODES=y 64CONFIG_ANON_INODES=y
64CONFIG_EPOLL=y 65CONFIG_EPOLL=y
65CONFIG_SIGNALFD=y 66CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
66CONFIG_EVENTFD=y 68CONFIG_EVENTFD=y
67CONFIG_SHMEM=y 69CONFIG_SHMEM=y
68CONFIG_VM_EVENT_COUNTERS=y 70CONFIG_VM_EVENT_COUNTERS=y
@@ -70,11 +72,21 @@ CONFIG_SLUB_DEBUG=y
70# CONFIG_SLAB is not set 72# CONFIG_SLAB is not set
71CONFIG_SLUB=y 73CONFIG_SLUB=y
72# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=m
78CONFIG_HAVE_OPROFILE=y
79CONFIG_KPROBES=y
80CONFIG_HAVE_KPROBES=y
81# CONFIG_HAVE_KRETPROBES is not set
82# CONFIG_HAVE_DMA_ATTRS is not set
83CONFIG_PROC_PAGE_MONITOR=y
73CONFIG_SLABINFO=y 84CONFIG_SLABINFO=y
74CONFIG_RT_MUTEXES=y 85CONFIG_RT_MUTEXES=y
75# CONFIG_TINY_SHMEM is not set 86# CONFIG_TINY_SHMEM is not set
76CONFIG_BASE_SMALL=1 87CONFIG_BASE_SMALL=1
77CONFIG_MODULES=y 88CONFIG_MODULES=y
89# CONFIG_MODULE_FORCE_LOAD is not set
78CONFIG_MODULE_UNLOAD=y 90CONFIG_MODULE_UNLOAD=y
79# CONFIG_MODULE_FORCE_UNLOAD is not set 91# CONFIG_MODULE_FORCE_UNLOAD is not set
80# CONFIG_MODVERSIONS is not set 92# CONFIG_MODVERSIONS is not set
@@ -98,10 +110,15 @@ CONFIG_IOSCHED_CFQ=y
98CONFIG_DEFAULT_CFQ=y 110CONFIG_DEFAULT_CFQ=y
99# CONFIG_DEFAULT_NOOP is not set 111# CONFIG_DEFAULT_NOOP is not set
100CONFIG_DEFAULT_IOSCHED="cfq" 112CONFIG_DEFAULT_IOSCHED="cfq"
113CONFIG_CLASSIC_RCU=y
101 114
102# 115#
103# System Type and features 116# System Type and features
104# 117#
118CONFIG_TICK_ONESHOT=y
119CONFIG_NO_HZ=y
120CONFIG_HIGH_RES_TIMERS=y
121CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
105CONFIG_SUBARCH_AVR32B=y 122CONFIG_SUBARCH_AVR32B=y
106CONFIG_MMU=y 123CONFIG_MMU=y
107CONFIG_PERFORMANCE_COUNTERS=y 124CONFIG_PERFORMANCE_COUNTERS=y
@@ -147,16 +164,19 @@ CONFIG_FLATMEM=y
147CONFIG_FLAT_NODE_MEM_MAP=y 164CONFIG_FLAT_NODE_MEM_MAP=y
148# CONFIG_SPARSEMEM_STATIC is not set 165# CONFIG_SPARSEMEM_STATIC is not set
149# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 166# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
167CONFIG_PAGEFLAGS_EXTENDED=y
150CONFIG_SPLIT_PTLOCK_CPUS=4 168CONFIG_SPLIT_PTLOCK_CPUS=4
151# CONFIG_RESOURCES_64BIT is not set 169# CONFIG_RESOURCES_64BIT is not set
152CONFIG_ZONE_DMA_FLAG=0 170CONFIG_ZONE_DMA_FLAG=0
153CONFIG_VIRT_TO_BUS=y 171CONFIG_VIRT_TO_BUS=y
154# CONFIG_OWNERSHIP_TRACE is not set 172# CONFIG_OWNERSHIP_TRACE is not set
173CONFIG_NMI_DEBUGGING=y
155# CONFIG_HZ_100 is not set 174# CONFIG_HZ_100 is not set
156CONFIG_HZ_250=y 175CONFIG_HZ_250=y
157# CONFIG_HZ_300 is not set 176# CONFIG_HZ_300 is not set
158# CONFIG_HZ_1000 is not set 177# CONFIG_HZ_1000 is not set
159CONFIG_HZ=250 178CONFIG_HZ=250
179# CONFIG_SCHED_HRTICK is not set
160CONFIG_CMDLINE="" 180CONFIG_CMDLINE=""
161 181
162# 182#
@@ -170,9 +190,10 @@ CONFIG_CPU_FREQ=y
170CONFIG_CPU_FREQ_TABLE=y 190CONFIG_CPU_FREQ_TABLE=y
171# CONFIG_CPU_FREQ_DEBUG is not set 191# CONFIG_CPU_FREQ_DEBUG is not set
172# CONFIG_CPU_FREQ_STAT is not set 192# CONFIG_CPU_FREQ_STAT is not set
173CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 193# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
194# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
174# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 195# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
175# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 196CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
176# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 197# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
177CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 198CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
178# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 199# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
@@ -208,6 +229,7 @@ CONFIG_XFRM=y
208CONFIG_XFRM_USER=m 229CONFIG_XFRM_USER=m
209# CONFIG_XFRM_SUB_POLICY is not set 230# CONFIG_XFRM_SUB_POLICY is not set
210# CONFIG_XFRM_MIGRATE is not set 231# CONFIG_XFRM_MIGRATE is not set
232# CONFIG_XFRM_STATISTICS is not set
211CONFIG_NET_KEY=m 233CONFIG_NET_KEY=m
212# CONFIG_NET_KEY_MIGRATE is not set 234# CONFIG_NET_KEY_MIGRATE is not set
213CONFIG_INET=y 235CONFIG_INET=y
@@ -252,8 +274,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
252CONFIG_INET6_XFRM_MODE_BEET=m 274CONFIG_INET6_XFRM_MODE_BEET=m
253# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 275# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
254CONFIG_IPV6_SIT=m 276CONFIG_IPV6_SIT=m
277CONFIG_IPV6_NDISC_NODETYPE=y
255CONFIG_IPV6_TUNNEL=m 278CONFIG_IPV6_TUNNEL=m
256# CONFIG_IPV6_MULTIPLE_TABLES is not set 279# CONFIG_IPV6_MULTIPLE_TABLES is not set
280# CONFIG_IPV6_MROUTE is not set
257# CONFIG_NETWORK_SECMARK is not set 281# CONFIG_NETWORK_SECMARK is not set
258# CONFIG_NETFILTER is not set 282# CONFIG_NETFILTER is not set
259# CONFIG_IP_DCCP is not set 283# CONFIG_IP_DCCP is not set
@@ -279,6 +303,7 @@ CONFIG_LLC=m
279# CONFIG_NET_PKTGEN is not set 303# CONFIG_NET_PKTGEN is not set
280# CONFIG_NET_TCPPROBE is not set 304# CONFIG_NET_TCPPROBE is not set
281# CONFIG_HAMRADIO is not set 305# CONFIG_HAMRADIO is not set
306# CONFIG_CAN is not set
282# CONFIG_IRDA is not set 307# CONFIG_IRDA is not set
283# CONFIG_BT is not set 308# CONFIG_BT is not set
284# CONFIG_AF_RXRPC is not set 309# CONFIG_AF_RXRPC is not set
@@ -314,6 +339,7 @@ CONFIG_MTD=y
314CONFIG_MTD_PARTITIONS=y 339CONFIG_MTD_PARTITIONS=y
315# CONFIG_MTD_REDBOOT_PARTS is not set 340# CONFIG_MTD_REDBOOT_PARTS is not set
316CONFIG_MTD_CMDLINE_PARTS=y 341CONFIG_MTD_CMDLINE_PARTS=y
342# CONFIG_MTD_AR7_PARTS is not set
317 343
318# 344#
319# User Modules And Translation Layers 345# User Modules And Translation Layers
@@ -368,6 +394,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
368# 394#
369CONFIG_MTD_DATAFLASH=m 395CONFIG_MTD_DATAFLASH=m
370CONFIG_MTD_M25P80=m 396CONFIG_MTD_M25P80=m
397CONFIG_M25PXX_USE_FAST_READ=y
371# CONFIG_MTD_SLRAM is not set 398# CONFIG_MTD_SLRAM is not set
372# CONFIG_MTD_PHRAM is not set 399# CONFIG_MTD_PHRAM is not set
373# CONFIG_MTD_MTDRAM is not set 400# CONFIG_MTD_MTDRAM is not set
@@ -395,13 +422,18 @@ CONFIG_BLK_DEV_NBD=m
395CONFIG_BLK_DEV_RAM=m 422CONFIG_BLK_DEV_RAM=m
396CONFIG_BLK_DEV_RAM_COUNT=16 423CONFIG_BLK_DEV_RAM_COUNT=16
397CONFIG_BLK_DEV_RAM_SIZE=4096 424CONFIG_BLK_DEV_RAM_SIZE=4096
398CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 425# CONFIG_BLK_DEV_XIP is not set
399# CONFIG_CDROM_PKTCDVD is not set 426# CONFIG_CDROM_PKTCDVD is not set
400# CONFIG_ATA_OVER_ETH is not set 427# CONFIG_ATA_OVER_ETH is not set
401CONFIG_MISC_DEVICES=y 428CONFIG_MISC_DEVICES=y
429CONFIG_ATMEL_PWM=m
430CONFIG_ATMEL_TCLIB=y
431CONFIG_ATMEL_TCB_CLKSRC=y
432CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
402# CONFIG_EEPROM_93CX6 is not set 433# CONFIG_EEPROM_93CX6 is not set
403CONFIG_ATMEL_SSC=m 434CONFIG_ATMEL_SSC=m
404# CONFIG_IDE is not set 435# CONFIG_ENCLOSURE_SERVICES is not set
436# CONFIG_HAVE_IDE is not set
405 437
406# 438#
407# SCSI device support 439# SCSI device support
@@ -444,6 +476,9 @@ CONFIG_SCSI_WAIT_SCAN=m
444# CONFIG_SCSI_LOWLEVEL is not set 476# CONFIG_SCSI_LOWLEVEL is not set
445CONFIG_ATA=m 477CONFIG_ATA=m
446# CONFIG_ATA_NONSTANDARD is not set 478# CONFIG_ATA_NONSTANDARD is not set
479# CONFIG_SATA_PMP is not set
480CONFIG_ATA_SFF=y
481# CONFIG_SATA_MV is not set
447CONFIG_PATA_AT32=m 482CONFIG_PATA_AT32=m
448# CONFIG_PATA_PLATFORM is not set 483# CONFIG_PATA_PLATFORM is not set
449# CONFIG_MD is not set 484# CONFIG_MD is not set
@@ -469,11 +504,13 @@ CONFIG_PHYLIB=y
469# CONFIG_SMSC_PHY is not set 504# CONFIG_SMSC_PHY is not set
470# CONFIG_BROADCOM_PHY is not set 505# CONFIG_BROADCOM_PHY is not set
471# CONFIG_ICPLUS_PHY is not set 506# CONFIG_ICPLUS_PHY is not set
507# CONFIG_REALTEK_PHY is not set
472# CONFIG_FIXED_PHY is not set 508# CONFIG_FIXED_PHY is not set
473# CONFIG_MDIO_BITBANG is not set 509# CONFIG_MDIO_BITBANG is not set
474CONFIG_NET_ETHERNET=y 510CONFIG_NET_ETHERNET=y
475# CONFIG_MII is not set 511# CONFIG_MII is not set
476CONFIG_MACB=y 512CONFIG_MACB=y
513# CONFIG_ENC28J60 is not set
477# CONFIG_IBM_NEW_EMAC_ZMII is not set 514# CONFIG_IBM_NEW_EMAC_ZMII is not set
478# CONFIG_IBM_NEW_EMAC_RGMII is not set 515# CONFIG_IBM_NEW_EMAC_RGMII is not set
479# CONFIG_IBM_NEW_EMAC_TAH is not set 516# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -487,6 +524,7 @@ CONFIG_MACB=y
487# 524#
488# CONFIG_WLAN_PRE80211 is not set 525# CONFIG_WLAN_PRE80211 is not set
489# CONFIG_WLAN_80211 is not set 526# CONFIG_WLAN_80211 is not set
527# CONFIG_IWLWIFI_LEDS is not set
490# CONFIG_WAN is not set 528# CONFIG_WAN is not set
491CONFIG_PPP=m 529CONFIG_PPP=m
492# CONFIG_PPP_MULTILINK is not set 530# CONFIG_PPP_MULTILINK is not set
@@ -500,7 +538,6 @@ CONFIG_PPP_BSDCOMP=m
500# CONFIG_PPPOL2TP is not set 538# CONFIG_PPPOL2TP is not set
501# CONFIG_SLIP is not set 539# CONFIG_SLIP is not set
502CONFIG_SLHC=m 540CONFIG_SLHC=m
503# CONFIG_SHAPER is not set
504# CONFIG_NETCONSOLE is not set 541# CONFIG_NETCONSOLE is not set
505# CONFIG_NETPOLL is not set 542# CONFIG_NETPOLL is not set
506# CONFIG_NET_POLL_CONTROLLER is not set 543# CONFIG_NET_POLL_CONTROLLER is not set
@@ -556,6 +593,7 @@ CONFIG_MOUSE_GPIO=m
556# Character devices 593# Character devices
557# 594#
558# CONFIG_VT is not set 595# CONFIG_VT is not set
596# CONFIG_DEVKMEM is not set
559# CONFIG_SERIAL_NONSTANDARD is not set 597# CONFIG_SERIAL_NONSTANDARD is not set
560 598
561# 599#
@@ -568,6 +606,7 @@ CONFIG_MOUSE_GPIO=m
568# 606#
569CONFIG_SERIAL_ATMEL=y 607CONFIG_SERIAL_ATMEL=y
570CONFIG_SERIAL_ATMEL_CONSOLE=y 608CONFIG_SERIAL_ATMEL_CONSOLE=y
609CONFIG_SERIAL_ATMEL_PDC=y
571# CONFIG_SERIAL_ATMEL_TTYAT is not set 610# CONFIG_SERIAL_ATMEL_TTYAT is not set
572CONFIG_SERIAL_CORE=y 611CONFIG_SERIAL_CORE=y
573CONFIG_SERIAL_CORE_CONSOLE=y 612CONFIG_SERIAL_CORE_CONSOLE=y
@@ -575,21 +614,13 @@ CONFIG_UNIX98_PTYS=y
575# CONFIG_LEGACY_PTYS is not set 614# CONFIG_LEGACY_PTYS is not set
576# CONFIG_IPMI_HANDLER is not set 615# CONFIG_IPMI_HANDLER is not set
577# CONFIG_HW_RANDOM is not set 616# CONFIG_HW_RANDOM is not set
578# CONFIG_RTC is not set
579# CONFIG_GEN_RTC is not set
580# CONFIG_R3964 is not set 617# CONFIG_R3964 is not set
581# CONFIG_RAW_DRIVER is not set 618# CONFIG_RAW_DRIVER is not set
582# CONFIG_TCG_TPM is not set 619# CONFIG_TCG_TPM is not set
583CONFIG_I2C=m 620CONFIG_I2C=m
584CONFIG_I2C_BOARDINFO=y 621CONFIG_I2C_BOARDINFO=y
585CONFIG_I2C_CHARDEV=m 622CONFIG_I2C_CHARDEV=m
586
587#
588# I2C Algorithms
589#
590CONFIG_I2C_ALGOBIT=m 623CONFIG_I2C_ALGOBIT=m
591# CONFIG_I2C_ALGOPCF is not set
592# CONFIG_I2C_ALGOPCA is not set
593 624
594# 625#
595# I2C Hardware Bus support 626# I2C Hardware Bus support
@@ -600,27 +631,23 @@ CONFIG_I2C_GPIO=m
600# CONFIG_I2C_SIMTEC is not set 631# CONFIG_I2C_SIMTEC is not set
601# CONFIG_I2C_TAOS_EVM is not set 632# CONFIG_I2C_TAOS_EVM is not set
602# CONFIG_I2C_STUB is not set 633# CONFIG_I2C_STUB is not set
634# CONFIG_I2C_PCA_PLATFORM is not set
603 635
604# 636#
605# Miscellaneous I2C Chip support 637# Miscellaneous I2C Chip support
606# 638#
607# CONFIG_SENSORS_DS1337 is not set
608# CONFIG_SENSORS_DS1374 is not set
609# CONFIG_DS1682 is not set 639# CONFIG_DS1682 is not set
610# CONFIG_SENSORS_EEPROM is not set 640# CONFIG_SENSORS_EEPROM is not set
611# CONFIG_SENSORS_PCF8574 is not set 641# CONFIG_SENSORS_PCF8574 is not set
612# CONFIG_SENSORS_PCA9539 is not set 642# CONFIG_PCF8575 is not set
613# CONFIG_SENSORS_PCF8591 is not set 643# CONFIG_SENSORS_PCF8591 is not set
644# CONFIG_TPS65010 is not set
614# CONFIG_SENSORS_MAX6875 is not set 645# CONFIG_SENSORS_MAX6875 is not set
615# CONFIG_SENSORS_TSL2550 is not set 646# CONFIG_SENSORS_TSL2550 is not set
616# CONFIG_I2C_DEBUG_CORE is not set 647# CONFIG_I2C_DEBUG_CORE is not set
617# CONFIG_I2C_DEBUG_ALGO is not set 648# CONFIG_I2C_DEBUG_ALGO is not set
618# CONFIG_I2C_DEBUG_BUS is not set 649# CONFIG_I2C_DEBUG_BUS is not set
619# CONFIG_I2C_DEBUG_CHIP is not set 650# CONFIG_I2C_DEBUG_CHIP is not set
620
621#
622# SPI support
623#
624CONFIG_SPI=y 651CONFIG_SPI=y
625# CONFIG_SPI_DEBUG is not set 652# CONFIG_SPI_DEBUG is not set
626CONFIG_SPI_MASTER=y 653CONFIG_SPI_MASTER=y
@@ -637,9 +664,27 @@ CONFIG_SPI_ATMEL=y
637# CONFIG_SPI_AT25 is not set 664# CONFIG_SPI_AT25 is not set
638CONFIG_SPI_SPIDEV=m 665CONFIG_SPI_SPIDEV=m
639# CONFIG_SPI_TLE62X0 is not set 666# CONFIG_SPI_TLE62X0 is not set
667CONFIG_HAVE_GPIO_LIB=y
668
669#
670# GPIO Support
671#
672# CONFIG_DEBUG_GPIO is not set
673
674#
675# I2C GPIO expanders:
676#
677# CONFIG_GPIO_PCA953X is not set
678# CONFIG_GPIO_PCF857X is not set
679
680#
681# SPI GPIO expanders:
682#
683# CONFIG_GPIO_MCP23S08 is not set
640# CONFIG_W1 is not set 684# CONFIG_W1 is not set
641# CONFIG_POWER_SUPPLY is not set 685# CONFIG_POWER_SUPPLY is not set
642# CONFIG_HWMON is not set 686# CONFIG_HWMON is not set
687# CONFIG_THERMAL is not set
643CONFIG_WATCHDOG=y 688CONFIG_WATCHDOG=y
644# CONFIG_WATCHDOG_NOWAYOUT is not set 689# CONFIG_WATCHDOG_NOWAYOUT is not set
645 690
@@ -659,12 +704,22 @@ CONFIG_SSB_POSSIBLE=y
659# Multifunction device drivers 704# Multifunction device drivers
660# 705#
661# CONFIG_MFD_SM501 is not set 706# CONFIG_MFD_SM501 is not set
707# CONFIG_HTC_PASIC3 is not set
662 708
663# 709#
664# Multimedia devices 710# Multimedia devices
665# 711#
712
713#
714# Multimedia core support
715#
666# CONFIG_VIDEO_DEV is not set 716# CONFIG_VIDEO_DEV is not set
667# CONFIG_DVB_CORE is not set 717# CONFIG_DVB_CORE is not set
718# CONFIG_VIDEO_MEDIA is not set
719
720#
721# Multimedia drivers
722#
668# CONFIG_DAB is not set 723# CONFIG_DAB is not set
669 724
670# 725#
@@ -682,8 +737,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
682# CONFIG_FB_SYS_FILLRECT is not set 737# CONFIG_FB_SYS_FILLRECT is not set
683# CONFIG_FB_SYS_COPYAREA is not set 738# CONFIG_FB_SYS_COPYAREA is not set
684# CONFIG_FB_SYS_IMAGEBLIT is not set 739# CONFIG_FB_SYS_IMAGEBLIT is not set
740# CONFIG_FB_FOREIGN_ENDIAN is not set
685# CONFIG_FB_SYS_FOPS is not set 741# CONFIG_FB_SYS_FOPS is not set
686CONFIG_FB_DEFERRED_IO=y
687# CONFIG_FB_SVGALIB is not set 742# CONFIG_FB_SVGALIB is not set
688# CONFIG_FB_MACMODES is not set 743# CONFIG_FB_MACMODES is not set
689# CONFIG_FB_BACKLIGHT is not set 744# CONFIG_FB_BACKLIGHT is not set
@@ -749,7 +804,11 @@ CONFIG_SND_AT73C213_TARGET_BITRATE=48000
749# CONFIG_SND_SOC is not set 804# CONFIG_SND_SOC is not set
750 805
751# 806#
752# SoC Audio support for SuperH 807# ALSA SoC audio for Freescale SOCs
808#
809
810#
811# SoC Audio for the Texas Instruments OMAP
753# 812#
754 813
755# 814#
@@ -761,14 +820,12 @@ CONFIG_USB_SUPPORT=y
761# CONFIG_USB_ARCH_HAS_HCD is not set 820# CONFIG_USB_ARCH_HAS_HCD is not set
762# CONFIG_USB_ARCH_HAS_OHCI is not set 821# CONFIG_USB_ARCH_HAS_OHCI is not set
763# CONFIG_USB_ARCH_HAS_EHCI is not set 822# CONFIG_USB_ARCH_HAS_EHCI is not set
823# CONFIG_USB_OTG_WHITELIST is not set
824# CONFIG_USB_OTG_BLACKLIST_HUB is not set
764 825
765# 826#
766# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 827# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
767# 828#
768
769#
770# USB Gadget Support
771#
772CONFIG_USB_GADGET=y 829CONFIG_USB_GADGET=y
773# CONFIG_USB_GADGET_DEBUG is not set 830# CONFIG_USB_GADGET_DEBUG is not set
774# CONFIG_USB_GADGET_DEBUG_FILES is not set 831# CONFIG_USB_GADGET_DEBUG_FILES is not set
@@ -781,6 +838,7 @@ CONFIG_USB_ATMEL_USBA=y
781# CONFIG_USB_GADGET_NET2280 is not set 838# CONFIG_USB_GADGET_NET2280 is not set
782# CONFIG_USB_GADGET_PXA2XX is not set 839# CONFIG_USB_GADGET_PXA2XX is not set
783# CONFIG_USB_GADGET_M66592 is not set 840# CONFIG_USB_GADGET_M66592 is not set
841# CONFIG_USB_GADGET_PXA27X is not set
784# CONFIG_USB_GADGET_GOKU is not set 842# CONFIG_USB_GADGET_GOKU is not set
785# CONFIG_USB_GADGET_LH7A40X is not set 843# CONFIG_USB_GADGET_LH7A40X is not set
786# CONFIG_USB_GADGET_OMAP is not set 844# CONFIG_USB_GADGET_OMAP is not set
@@ -796,6 +854,7 @@ CONFIG_USB_FILE_STORAGE=m
796# CONFIG_USB_FILE_STORAGE_TEST is not set 854# CONFIG_USB_FILE_STORAGE_TEST is not set
797CONFIG_USB_G_SERIAL=m 855CONFIG_USB_G_SERIAL=m
798# CONFIG_USB_MIDI_GADGET is not set 856# CONFIG_USB_MIDI_GADGET is not set
857# CONFIG_USB_G_PRINTER is not set
799CONFIG_MMC=m 858CONFIG_MMC=m
800# CONFIG_MMC_DEBUG is not set 859# CONFIG_MMC_DEBUG is not set
801# CONFIG_MMC_UNSAFE_RESUME is not set 860# CONFIG_MMC_UNSAFE_RESUME is not set
@@ -806,17 +865,20 @@ CONFIG_MMC=m
806CONFIG_MMC_BLOCK=m 865CONFIG_MMC_BLOCK=m
807CONFIG_MMC_BLOCK_BOUNCE=y 866CONFIG_MMC_BLOCK_BOUNCE=y
808# CONFIG_SDIO_UART is not set 867# CONFIG_SDIO_UART is not set
868CONFIG_MMC_TEST=m
809 869
810# 870#
811# MMC/SD Host Controller Drivers 871# MMC/SD Host Controller Drivers
812# 872#
813CONFIG_MMC_SPI=m 873CONFIG_MMC_SPI=m
874# CONFIG_MEMSTICK is not set
814CONFIG_NEW_LEDS=y 875CONFIG_NEW_LEDS=y
815CONFIG_LEDS_CLASS=m 876CONFIG_LEDS_CLASS=m
816 877
817# 878#
818# LED drivers 879# LED drivers
819# 880#
881CONFIG_LEDS_ATMEL_PWM=m
820CONFIG_LEDS_GPIO=m 882CONFIG_LEDS_GPIO=m
821 883
822# 884#
@@ -825,6 +887,8 @@ CONFIG_LEDS_GPIO=m
825CONFIG_LEDS_TRIGGERS=y 887CONFIG_LEDS_TRIGGERS=y
826CONFIG_LEDS_TRIGGER_TIMER=m 888CONFIG_LEDS_TRIGGER_TIMER=m
827CONFIG_LEDS_TRIGGER_HEARTBEAT=m 889CONFIG_LEDS_TRIGGER_HEARTBEAT=m
890CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
891# CONFIG_ACCESSIBILITY is not set
828CONFIG_RTC_LIB=y 892CONFIG_RTC_LIB=y
829CONFIG_RTC_CLASS=y 893CONFIG_RTC_CLASS=y
830CONFIG_RTC_HCTOSYS=y 894CONFIG_RTC_HCTOSYS=y
@@ -853,19 +917,22 @@ CONFIG_RTC_INTF_DEV=y
853# CONFIG_RTC_DRV_PCF8563 is not set 917# CONFIG_RTC_DRV_PCF8563 is not set
854# CONFIG_RTC_DRV_PCF8583 is not set 918# CONFIG_RTC_DRV_PCF8583 is not set
855# CONFIG_RTC_DRV_M41T80 is not set 919# CONFIG_RTC_DRV_M41T80 is not set
920# CONFIG_RTC_DRV_S35390A is not set
856 921
857# 922#
858# SPI RTC drivers 923# SPI RTC drivers
859# 924#
860# CONFIG_RTC_DRV_RS5C348 is not set
861# CONFIG_RTC_DRV_MAX6902 is not set 925# CONFIG_RTC_DRV_MAX6902 is not set
926# CONFIG_RTC_DRV_R9701 is not set
927# CONFIG_RTC_DRV_RS5C348 is not set
862 928
863# 929#
864# Platform RTC drivers 930# Platform RTC drivers
865# 931#
932# CONFIG_RTC_DRV_DS1511 is not set
866# CONFIG_RTC_DRV_DS1553 is not set 933# CONFIG_RTC_DRV_DS1553 is not set
867# CONFIG_RTC_DRV_STK17TA8 is not set
868# CONFIG_RTC_DRV_DS1742 is not set 934# CONFIG_RTC_DRV_DS1742 is not set
935# CONFIG_RTC_DRV_STK17TA8 is not set
869# CONFIG_RTC_DRV_M48T86 is not set 936# CONFIG_RTC_DRV_M48T86 is not set
870# CONFIG_RTC_DRV_M48T59 is not set 937# CONFIG_RTC_DRV_M48T59 is not set
871# CONFIG_RTC_DRV_V3020 is not set 938# CONFIG_RTC_DRV_V3020 is not set
@@ -874,10 +941,6 @@ CONFIG_RTC_INTF_DEV=y
874# on-CPU RTC drivers 941# on-CPU RTC drivers
875# 942#
876CONFIG_RTC_DRV_AT32AP700X=y 943CONFIG_RTC_DRV_AT32AP700X=y
877
878#
879# Userspace I/O
880#
881# CONFIG_UIO is not set 944# CONFIG_UIO is not set
882 945
883# 946#
@@ -895,14 +958,11 @@ CONFIG_JBD=m
895# CONFIG_JFS_FS is not set 958# CONFIG_JFS_FS is not set
896# CONFIG_FS_POSIX_ACL is not set 959# CONFIG_FS_POSIX_ACL is not set
897# CONFIG_XFS_FS is not set 960# CONFIG_XFS_FS is not set
898# CONFIG_GFS2_FS is not set
899# CONFIG_OCFS2_FS is not set 961# CONFIG_OCFS2_FS is not set
900CONFIG_MINIX_FS=m 962# CONFIG_DNOTIFY is not set
901# CONFIG_ROMFS_FS is not set
902CONFIG_INOTIFY=y 963CONFIG_INOTIFY=y
903CONFIG_INOTIFY_USER=y 964CONFIG_INOTIFY_USER=y
904# CONFIG_QUOTA is not set 965# CONFIG_QUOTA is not set
905# CONFIG_DNOTIFY is not set
906# CONFIG_AUTOFS_FS is not set 966# CONFIG_AUTOFS_FS is not set
907# CONFIG_AUTOFS4_FS is not set 967# CONFIG_AUTOFS4_FS is not set
908CONFIG_FUSE_FS=m 968CONFIG_FUSE_FS=m
@@ -957,8 +1017,10 @@ CONFIG_JFFS2_RTIME=y
957# CONFIG_JFFS2_RUBIN is not set 1017# CONFIG_JFFS2_RUBIN is not set
958# CONFIG_CRAMFS is not set 1018# CONFIG_CRAMFS is not set
959# CONFIG_VXFS_FS is not set 1019# CONFIG_VXFS_FS is not set
1020CONFIG_MINIX_FS=m
960# CONFIG_HPFS_FS is not set 1021# CONFIG_HPFS_FS is not set
961# CONFIG_QNX4FS_FS is not set 1022# CONFIG_QNX4FS_FS is not set
1023# CONFIG_ROMFS_FS is not set
962# CONFIG_SYSV_FS is not set 1024# CONFIG_SYSV_FS is not set
963# CONFIG_UFS_FS is not set 1025# CONFIG_UFS_FS is not set
964CONFIG_NETWORK_FILESYSTEMS=y 1026CONFIG_NETWORK_FILESYSTEMS=y
@@ -966,7 +1028,6 @@ CONFIG_NFS_FS=y
966CONFIG_NFS_V3=y 1028CONFIG_NFS_V3=y
967# CONFIG_NFS_V3_ACL is not set 1029# CONFIG_NFS_V3_ACL is not set
968# CONFIG_NFS_V4 is not set 1030# CONFIG_NFS_V4 is not set
969# CONFIG_NFS_DIRECTIO is not set
970# CONFIG_NFSD is not set 1031# CONFIG_NFSD is not set
971CONFIG_ROOT_NFS=y 1032CONFIG_ROOT_NFS=y
972CONFIG_LOCKD=y 1033CONFIG_LOCKD=y
@@ -1028,11 +1089,6 @@ CONFIG_NLS_ISO8859_1=m
1028# CONFIG_NLS_KOI8_U is not set 1089# CONFIG_NLS_KOI8_U is not set
1029CONFIG_NLS_UTF8=m 1090CONFIG_NLS_UTF8=m
1030# CONFIG_DLM is not set 1091# CONFIG_DLM is not set
1031CONFIG_INSTRUMENTATION=y
1032CONFIG_PROFILING=y
1033CONFIG_OPROFILE=m
1034CONFIG_KPROBES=y
1035# CONFIG_MARKERS is not set
1036 1092
1037# 1093#
1038# Kernel hacking 1094# Kernel hacking
@@ -1040,6 +1096,7 @@ CONFIG_KPROBES=y
1040# CONFIG_PRINTK_TIME is not set 1096# CONFIG_PRINTK_TIME is not set
1041CONFIG_ENABLE_WARN_DEPRECATED=y 1097CONFIG_ENABLE_WARN_DEPRECATED=y
1042CONFIG_ENABLE_MUST_CHECK=y 1098CONFIG_ENABLE_MUST_CHECK=y
1099CONFIG_FRAME_WARN=1024
1043CONFIG_MAGIC_SYSRQ=y 1100CONFIG_MAGIC_SYSRQ=y
1044# CONFIG_UNUSED_SYMBOLS is not set 1101# CONFIG_UNUSED_SYMBOLS is not set
1045CONFIG_DEBUG_FS=y 1102CONFIG_DEBUG_FS=y
@@ -1050,7 +1107,9 @@ CONFIG_DETECT_SOFTLOCKUP=y
1050CONFIG_SCHED_DEBUG=y 1107CONFIG_SCHED_DEBUG=y
1051# CONFIG_SCHEDSTATS is not set 1108# CONFIG_SCHEDSTATS is not set
1052# CONFIG_TIMER_STATS is not set 1109# CONFIG_TIMER_STATS is not set
1110# CONFIG_DEBUG_OBJECTS is not set
1053# CONFIG_SLUB_DEBUG_ON is not set 1111# CONFIG_SLUB_DEBUG_ON is not set
1112# CONFIG_SLUB_STATS is not set
1054# CONFIG_DEBUG_RT_MUTEXES is not set 1113# CONFIG_DEBUG_RT_MUTEXES is not set
1055# CONFIG_RT_MUTEX_TESTER is not set 1114# CONFIG_RT_MUTEX_TESTER is not set
1056# CONFIG_DEBUG_SPINLOCK is not set 1115# CONFIG_DEBUG_SPINLOCK is not set
@@ -1064,12 +1123,14 @@ CONFIG_SCHED_DEBUG=y
1064CONFIG_DEBUG_BUGVERBOSE=y 1123CONFIG_DEBUG_BUGVERBOSE=y
1065# CONFIG_DEBUG_INFO is not set 1124# CONFIG_DEBUG_INFO is not set
1066# CONFIG_DEBUG_VM is not set 1125# CONFIG_DEBUG_VM is not set
1126# CONFIG_DEBUG_WRITECOUNT is not set
1067# CONFIG_DEBUG_LIST is not set 1127# CONFIG_DEBUG_LIST is not set
1068# CONFIG_DEBUG_SG is not set 1128# CONFIG_DEBUG_SG is not set
1069CONFIG_FRAME_POINTER=y 1129CONFIG_FRAME_POINTER=y
1070CONFIG_FORCED_INLINING=y
1071# CONFIG_BOOT_PRINTK_DELAY is not set 1130# CONFIG_BOOT_PRINTK_DELAY is not set
1072# CONFIG_RCU_TORTURE_TEST is not set 1131# CONFIG_RCU_TORTURE_TEST is not set
1132# CONFIG_KPROBES_SANITY_TEST is not set
1133# CONFIG_BACKTRACE_SELF_TEST is not set
1073# CONFIG_LKDTM is not set 1134# CONFIG_LKDTM is not set
1074# CONFIG_FAULT_INJECTION is not set 1135# CONFIG_FAULT_INJECTION is not set
1075# CONFIG_SAMPLES is not set 1136# CONFIG_SAMPLES is not set
@@ -1081,52 +1142,90 @@ CONFIG_FORCED_INLINING=y
1081# CONFIG_SECURITY is not set 1142# CONFIG_SECURITY is not set
1082# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1143# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1083CONFIG_CRYPTO=y 1144CONFIG_CRYPTO=y
1145
1146#
1147# Crypto core or helper
1148#
1084CONFIG_CRYPTO_ALGAPI=m 1149CONFIG_CRYPTO_ALGAPI=m
1150CONFIG_CRYPTO_AEAD=m
1085CONFIG_CRYPTO_BLKCIPHER=m 1151CONFIG_CRYPTO_BLKCIPHER=m
1086CONFIG_CRYPTO_HASH=m 1152CONFIG_CRYPTO_HASH=m
1087CONFIG_CRYPTO_MANAGER=m 1153CONFIG_CRYPTO_MANAGER=m
1154# CONFIG_CRYPTO_GF128MUL is not set
1155# CONFIG_CRYPTO_NULL is not set
1156# CONFIG_CRYPTO_CRYPTD is not set
1157CONFIG_CRYPTO_AUTHENC=m
1158# CONFIG_CRYPTO_TEST is not set
1159
1160#
1161# Authenticated Encryption with Associated Data
1162#
1163# CONFIG_CRYPTO_CCM is not set
1164# CONFIG_CRYPTO_GCM is not set
1165# CONFIG_CRYPTO_SEQIV is not set
1166
1167#
1168# Block modes
1169#
1170CONFIG_CRYPTO_CBC=m
1171# CONFIG_CRYPTO_CTR is not set
1172# CONFIG_CRYPTO_CTS is not set
1173# CONFIG_CRYPTO_ECB is not set
1174# CONFIG_CRYPTO_LRW is not set
1175# CONFIG_CRYPTO_PCBC is not set
1176# CONFIG_CRYPTO_XTS is not set
1177
1178#
1179# Hash modes
1180#
1088CONFIG_CRYPTO_HMAC=m 1181CONFIG_CRYPTO_HMAC=m
1089# CONFIG_CRYPTO_XCBC is not set 1182# CONFIG_CRYPTO_XCBC is not set
1090# CONFIG_CRYPTO_NULL is not set 1183
1184#
1185# Digest
1186#
1187# CONFIG_CRYPTO_CRC32C is not set
1091# CONFIG_CRYPTO_MD4 is not set 1188# CONFIG_CRYPTO_MD4 is not set
1092CONFIG_CRYPTO_MD5=m 1189CONFIG_CRYPTO_MD5=m
1190# CONFIG_CRYPTO_MICHAEL_MIC is not set
1093CONFIG_CRYPTO_SHA1=m 1191CONFIG_CRYPTO_SHA1=m
1094# CONFIG_CRYPTO_SHA256 is not set 1192# CONFIG_CRYPTO_SHA256 is not set
1095# CONFIG_CRYPTO_SHA512 is not set 1193# CONFIG_CRYPTO_SHA512 is not set
1096# CONFIG_CRYPTO_WP512 is not set
1097# CONFIG_CRYPTO_TGR192 is not set 1194# CONFIG_CRYPTO_TGR192 is not set
1098# CONFIG_CRYPTO_GF128MUL is not set 1195# CONFIG_CRYPTO_WP512 is not set
1099# CONFIG_CRYPTO_ECB is not set 1196
1100CONFIG_CRYPTO_CBC=m 1197#
1101# CONFIG_CRYPTO_PCBC is not set 1198# Ciphers
1102# CONFIG_CRYPTO_LRW is not set 1199#
1103# CONFIG_CRYPTO_XTS is not set
1104# CONFIG_CRYPTO_CRYPTD is not set
1105CONFIG_CRYPTO_DES=m
1106# CONFIG_CRYPTO_FCRYPT is not set
1107# CONFIG_CRYPTO_BLOWFISH is not set
1108# CONFIG_CRYPTO_TWOFISH is not set
1109# CONFIG_CRYPTO_SERPENT is not set
1110# CONFIG_CRYPTO_AES is not set 1200# CONFIG_CRYPTO_AES is not set
1201# CONFIG_CRYPTO_ANUBIS is not set
1202# CONFIG_CRYPTO_ARC4 is not set
1203# CONFIG_CRYPTO_BLOWFISH is not set
1204# CONFIG_CRYPTO_CAMELLIA is not set
1111# CONFIG_CRYPTO_CAST5 is not set 1205# CONFIG_CRYPTO_CAST5 is not set
1112# CONFIG_CRYPTO_CAST6 is not set 1206# CONFIG_CRYPTO_CAST6 is not set
1113# CONFIG_CRYPTO_TEA is not set 1207CONFIG_CRYPTO_DES=m
1114# CONFIG_CRYPTO_ARC4 is not set 1208# CONFIG_CRYPTO_FCRYPT is not set
1115# CONFIG_CRYPTO_KHAZAD is not set 1209# CONFIG_CRYPTO_KHAZAD is not set
1116# CONFIG_CRYPTO_ANUBIS is not set 1210# CONFIG_CRYPTO_SALSA20 is not set
1117# CONFIG_CRYPTO_SEED is not set 1211# CONFIG_CRYPTO_SEED is not set
1212# CONFIG_CRYPTO_SERPENT is not set
1213# CONFIG_CRYPTO_TEA is not set
1214# CONFIG_CRYPTO_TWOFISH is not set
1215
1216#
1217# Compression
1218#
1118CONFIG_CRYPTO_DEFLATE=m 1219CONFIG_CRYPTO_DEFLATE=m
1119# CONFIG_CRYPTO_MICHAEL_MIC is not set 1220# CONFIG_CRYPTO_LZO is not set
1120# CONFIG_CRYPTO_CRC32C is not set
1121# CONFIG_CRYPTO_CAMELLIA is not set
1122# CONFIG_CRYPTO_TEST is not set
1123# CONFIG_CRYPTO_AUTHENC is not set
1124# CONFIG_CRYPTO_HW is not set 1221# CONFIG_CRYPTO_HW is not set
1125 1222
1126# 1223#
1127# Library routines 1224# Library routines
1128# 1225#
1129CONFIG_BITREVERSE=y 1226CONFIG_BITREVERSE=y
1227# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1228# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1130CONFIG_CRC_CCITT=m 1229CONFIG_CRC_CCITT=m
1131# CONFIG_CRC16 is not set 1230# CONFIG_CRC16 is not set
1132CONFIG_CRC_ITU_T=m 1231CONFIG_CRC_ITU_T=m
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig
index 45e23e03f074..5a4ae6b5d28f 100644
--- a/arch/avr32/configs/atstk1003_defconfig
+++ b/arch/avr32/configs/atstk1003_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.24-rc7 3# Linux kernel version: 2.6.26-rc3
4# Wed Jan 9 22:54:34 2008 4# Mon May 26 13:33:05 2008
5# 5#
6CONFIG_AVR32=y 6CONFIG_AVR32=y
7CONFIG_GENERIC_GPIO=y 7CONFIG_GENERIC_GPIO=y
@@ -13,10 +13,10 @@ CONFIG_HARDIRQS_SW_RESEND=y
13CONFIG_GENERIC_IRQ_PROBE=y 13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_RWSEM_GENERIC_SPINLOCK=y 14CONFIG_RWSEM_GENERIC_SPINLOCK=y
15CONFIG_GENERIC_TIME=y 15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
16# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 17# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_ARCH_SUPPORTS_OPROFILE=y
20CONFIG_GENERIC_HWEIGHT=y 20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y 21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_BUG=y 22CONFIG_GENERIC_BUG=y
@@ -39,17 +39,15 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
39CONFIG_TASKSTATS=y 39CONFIG_TASKSTATS=y
40CONFIG_TASK_DELAY_ACCT=y 40CONFIG_TASK_DELAY_ACCT=y
41# CONFIG_TASK_XACCT is not set 41# CONFIG_TASK_XACCT is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44CONFIG_AUDIT=y 42CONFIG_AUDIT=y
45# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set 45# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y 46# CONFIG_GROUP_SCHED is not set
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y 47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
52CONFIG_RELAY=y 49CONFIG_RELAY=y
50# CONFIG_NAMESPACES is not set
53CONFIG_BLK_DEV_INITRD=y 51CONFIG_BLK_DEV_INITRD=y
54CONFIG_INITRAMFS_SOURCE="" 52CONFIG_INITRAMFS_SOURCE=""
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y 53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -63,11 +61,13 @@ CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y 61CONFIG_PRINTK=y
64CONFIG_BUG=y 62CONFIG_BUG=y
65CONFIG_ELF_CORE=y 63CONFIG_ELF_CORE=y
64# CONFIG_COMPAT_BRK is not set
66# CONFIG_BASE_FULL is not set 65# CONFIG_BASE_FULL is not set
67CONFIG_FUTEX=y 66CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y 67CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y 68CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y 69CONFIG_SIGNALFD=y
70CONFIG_TIMERFD=y
71CONFIG_EVENTFD=y 71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y 72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y 73CONFIG_VM_EVENT_COUNTERS=y
@@ -75,11 +75,20 @@ CONFIG_VM_EVENT_COUNTERS=y
75# CONFIG_SLAB is not set 75# CONFIG_SLAB is not set
76CONFIG_SLUB=y 76CONFIG_SLUB=y
77# CONFIG_SLOB is not set 77# CONFIG_SLOB is not set
78CONFIG_SLABINFO=y 78CONFIG_PROFILING=y
79# CONFIG_MARKERS is not set
80CONFIG_OPROFILE=m
81CONFIG_HAVE_OPROFILE=y
82CONFIG_KPROBES=y
83CONFIG_HAVE_KPROBES=y
84# CONFIG_HAVE_KRETPROBES is not set
85# CONFIG_HAVE_DMA_ATTRS is not set
86CONFIG_PROC_PAGE_MONITOR=y
79CONFIG_RT_MUTEXES=y 87CONFIG_RT_MUTEXES=y
80# CONFIG_TINY_SHMEM is not set 88# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=1 89CONFIG_BASE_SMALL=1
82CONFIG_MODULES=y 90CONFIG_MODULES=y
91# CONFIG_MODULE_FORCE_LOAD is not set
83CONFIG_MODULE_UNLOAD=y 92CONFIG_MODULE_UNLOAD=y
84# CONFIG_MODULE_FORCE_UNLOAD is not set 93# CONFIG_MODULE_FORCE_UNLOAD is not set
85# CONFIG_MODVERSIONS is not set 94# CONFIG_MODVERSIONS is not set
@@ -103,10 +112,15 @@ CONFIG_IOSCHED_CFQ=y
103CONFIG_DEFAULT_CFQ=y 112CONFIG_DEFAULT_CFQ=y
104# CONFIG_DEFAULT_NOOP is not set 113# CONFIG_DEFAULT_NOOP is not set
105CONFIG_DEFAULT_IOSCHED="cfq" 114CONFIG_DEFAULT_IOSCHED="cfq"
115CONFIG_CLASSIC_RCU=y
106 116
107# 117#
108# System Type and features 118# System Type and features
109# 119#
120CONFIG_TICK_ONESHOT=y
121CONFIG_NO_HZ=y
122CONFIG_HIGH_RES_TIMERS=y
123CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
110CONFIG_SUBARCH_AVR32B=y 124CONFIG_SUBARCH_AVR32B=y
111CONFIG_MMU=y 125CONFIG_MMU=y
112CONFIG_PERFORMANCE_COUNTERS=y 126CONFIG_PERFORMANCE_COUNTERS=y
@@ -152,16 +166,19 @@ CONFIG_FLATMEM=y
152CONFIG_FLAT_NODE_MEM_MAP=y 166CONFIG_FLAT_NODE_MEM_MAP=y
153# CONFIG_SPARSEMEM_STATIC is not set 167# CONFIG_SPARSEMEM_STATIC is not set
154# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 168# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
169CONFIG_PAGEFLAGS_EXTENDED=y
155CONFIG_SPLIT_PTLOCK_CPUS=4 170CONFIG_SPLIT_PTLOCK_CPUS=4
156# CONFIG_RESOURCES_64BIT is not set 171# CONFIG_RESOURCES_64BIT is not set
157CONFIG_ZONE_DMA_FLAG=0 172CONFIG_ZONE_DMA_FLAG=0
158CONFIG_VIRT_TO_BUS=y 173CONFIG_VIRT_TO_BUS=y
159# CONFIG_OWNERSHIP_TRACE is not set 174# CONFIG_OWNERSHIP_TRACE is not set
175CONFIG_NMI_DEBUGGING=y
160# CONFIG_HZ_100 is not set 176# CONFIG_HZ_100 is not set
161CONFIG_HZ_250=y 177CONFIG_HZ_250=y
162# CONFIG_HZ_300 is not set 178# CONFIG_HZ_300 is not set
163# CONFIG_HZ_1000 is not set 179# CONFIG_HZ_1000 is not set
164CONFIG_HZ=250 180CONFIG_HZ=250
181# CONFIG_SCHED_HRTICK is not set
165CONFIG_CMDLINE="" 182CONFIG_CMDLINE=""
166 183
167# 184#
@@ -175,9 +192,10 @@ CONFIG_CPU_FREQ=y
175CONFIG_CPU_FREQ_TABLE=y 192CONFIG_CPU_FREQ_TABLE=y
176# CONFIG_CPU_FREQ_DEBUG is not set 193# CONFIG_CPU_FREQ_DEBUG is not set
177# CONFIG_CPU_FREQ_STAT is not set 194# CONFIG_CPU_FREQ_STAT is not set
178CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 195# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
196# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
179# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 197# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
180# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 198CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
181# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 199# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
182CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 200CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
183# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 201# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
@@ -234,8 +252,6 @@ CONFIG_TCP_CONG_CUBIC=y
234CONFIG_DEFAULT_TCP_CONG="cubic" 252CONFIG_DEFAULT_TCP_CONG="cubic"
235# CONFIG_TCP_MD5SIG is not set 253# CONFIG_TCP_MD5SIG is not set
236# CONFIG_IPV6 is not set 254# CONFIG_IPV6 is not set
237# CONFIG_INET6_XFRM_TUNNEL is not set
238# CONFIG_INET6_TUNNEL is not set
239# CONFIG_NETWORK_SECMARK is not set 255# CONFIG_NETWORK_SECMARK is not set
240# CONFIG_NETFILTER is not set 256# CONFIG_NETFILTER is not set
241# CONFIG_IP_DCCP is not set 257# CONFIG_IP_DCCP is not set
@@ -260,6 +276,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
260# CONFIG_NET_PKTGEN is not set 276# CONFIG_NET_PKTGEN is not set
261# CONFIG_NET_TCPPROBE is not set 277# CONFIG_NET_TCPPROBE is not set
262# CONFIG_HAMRADIO is not set 278# CONFIG_HAMRADIO is not set
279# CONFIG_CAN is not set
263# CONFIG_IRDA is not set 280# CONFIG_IRDA is not set
264# CONFIG_BT is not set 281# CONFIG_BT is not set
265# CONFIG_AF_RXRPC is not set 282# CONFIG_AF_RXRPC is not set
@@ -295,6 +312,7 @@ CONFIG_MTD=y
295CONFIG_MTD_PARTITIONS=y 312CONFIG_MTD_PARTITIONS=y
296# CONFIG_MTD_REDBOOT_PARTS is not set 313# CONFIG_MTD_REDBOOT_PARTS is not set
297CONFIG_MTD_CMDLINE_PARTS=y 314CONFIG_MTD_CMDLINE_PARTS=y
315# CONFIG_MTD_AR7_PARTS is not set
298 316
299# 317#
300# User Modules And Translation Layers 318# User Modules And Translation Layers
@@ -349,6 +367,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
349# 367#
350CONFIG_MTD_DATAFLASH=m 368CONFIG_MTD_DATAFLASH=m
351CONFIG_MTD_M25P80=m 369CONFIG_MTD_M25P80=m
370CONFIG_M25PXX_USE_FAST_READ=y
352# CONFIG_MTD_SLRAM is not set 371# CONFIG_MTD_SLRAM is not set
353# CONFIG_MTD_PHRAM is not set 372# CONFIG_MTD_PHRAM is not set
354# CONFIG_MTD_MTDRAM is not set 373# CONFIG_MTD_MTDRAM is not set
@@ -376,13 +395,18 @@ CONFIG_BLK_DEV_NBD=m
376CONFIG_BLK_DEV_RAM=m 395CONFIG_BLK_DEV_RAM=m
377CONFIG_BLK_DEV_RAM_COUNT=16 396CONFIG_BLK_DEV_RAM_COUNT=16
378CONFIG_BLK_DEV_RAM_SIZE=4096 397CONFIG_BLK_DEV_RAM_SIZE=4096
379CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 398# CONFIG_BLK_DEV_XIP is not set
380# CONFIG_CDROM_PKTCDVD is not set 399# CONFIG_CDROM_PKTCDVD is not set
381# CONFIG_ATA_OVER_ETH is not set 400# CONFIG_ATA_OVER_ETH is not set
382CONFIG_MISC_DEVICES=y 401CONFIG_MISC_DEVICES=y
402CONFIG_ATMEL_PWM=m
403CONFIG_ATMEL_TCLIB=y
404CONFIG_ATMEL_TCB_CLKSRC=y
405CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
383# CONFIG_EEPROM_93CX6 is not set 406# CONFIG_EEPROM_93CX6 is not set
384CONFIG_ATMEL_SSC=m 407CONFIG_ATMEL_SSC=m
385# CONFIG_IDE is not set 408# CONFIG_ENCLOSURE_SERVICES is not set
409# CONFIG_HAVE_IDE is not set
386 410
387# 411#
388# SCSI device support 412# SCSI device support
@@ -427,6 +451,9 @@ CONFIG_SCSI_LOWLEVEL=y
427# CONFIG_SCSI_DEBUG is not set 451# CONFIG_SCSI_DEBUG is not set
428CONFIG_ATA=m 452CONFIG_ATA=m
429# CONFIG_ATA_NONSTANDARD is not set 453# CONFIG_ATA_NONSTANDARD is not set
454# CONFIG_SATA_PMP is not set
455CONFIG_ATA_SFF=y
456# CONFIG_SATA_MV is not set
430CONFIG_PATA_AT32=m 457CONFIG_PATA_AT32=m
431# CONFIG_PATA_PLATFORM is not set 458# CONFIG_PATA_PLATFORM is not set
432# CONFIG_MD is not set 459# CONFIG_MD is not set
@@ -447,6 +474,7 @@ CONFIG_NETDEVICES=y
447# 474#
448# CONFIG_WLAN_PRE80211 is not set 475# CONFIG_WLAN_PRE80211 is not set
449# CONFIG_WLAN_80211 is not set 476# CONFIG_WLAN_80211 is not set
477# CONFIG_IWLWIFI_LEDS is not set
450# CONFIG_WAN is not set 478# CONFIG_WAN is not set
451CONFIG_PPP=m 479CONFIG_PPP=m
452# CONFIG_PPP_MULTILINK is not set 480# CONFIG_PPP_MULTILINK is not set
@@ -460,7 +488,6 @@ CONFIG_PPP_BSDCOMP=m
460# CONFIG_PPPOL2TP is not set 488# CONFIG_PPPOL2TP is not set
461# CONFIG_SLIP is not set 489# CONFIG_SLIP is not set
462CONFIG_SLHC=m 490CONFIG_SLHC=m
463# CONFIG_SHAPER is not set
464# CONFIG_NETCONSOLE is not set 491# CONFIG_NETCONSOLE is not set
465# CONFIG_NETPOLL is not set 492# CONFIG_NETPOLL is not set
466# CONFIG_NET_POLL_CONTROLLER is not set 493# CONFIG_NET_POLL_CONTROLLER is not set
@@ -516,6 +543,7 @@ CONFIG_MOUSE_GPIO=m
516# Character devices 543# Character devices
517# 544#
518# CONFIG_VT is not set 545# CONFIG_VT is not set
546# CONFIG_DEVKMEM is not set
519# CONFIG_SERIAL_NONSTANDARD is not set 547# CONFIG_SERIAL_NONSTANDARD is not set
520 548
521# 549#
@@ -528,6 +556,7 @@ CONFIG_MOUSE_GPIO=m
528# 556#
529CONFIG_SERIAL_ATMEL=y 557CONFIG_SERIAL_ATMEL=y
530CONFIG_SERIAL_ATMEL_CONSOLE=y 558CONFIG_SERIAL_ATMEL_CONSOLE=y
559CONFIG_SERIAL_ATMEL_PDC=y
531# CONFIG_SERIAL_ATMEL_TTYAT is not set 560# CONFIG_SERIAL_ATMEL_TTYAT is not set
532CONFIG_SERIAL_CORE=y 561CONFIG_SERIAL_CORE=y
533CONFIG_SERIAL_CORE_CONSOLE=y 562CONFIG_SERIAL_CORE_CONSOLE=y
@@ -535,21 +564,13 @@ CONFIG_UNIX98_PTYS=y
535# CONFIG_LEGACY_PTYS is not set 564# CONFIG_LEGACY_PTYS is not set
536# CONFIG_IPMI_HANDLER is not set 565# CONFIG_IPMI_HANDLER is not set
537# CONFIG_HW_RANDOM is not set 566# CONFIG_HW_RANDOM is not set
538# CONFIG_RTC is not set
539# CONFIG_GEN_RTC is not set
540# CONFIG_R3964 is not set 567# CONFIG_R3964 is not set
541# CONFIG_RAW_DRIVER is not set 568# CONFIG_RAW_DRIVER is not set
542# CONFIG_TCG_TPM is not set 569# CONFIG_TCG_TPM is not set
543CONFIG_I2C=m 570CONFIG_I2C=m
544CONFIG_I2C_BOARDINFO=y 571CONFIG_I2C_BOARDINFO=y
545CONFIG_I2C_CHARDEV=m 572CONFIG_I2C_CHARDEV=m
546
547#
548# I2C Algorithms
549#
550CONFIG_I2C_ALGOBIT=m 573CONFIG_I2C_ALGOBIT=m
551# CONFIG_I2C_ALGOPCF is not set
552# CONFIG_I2C_ALGOPCA is not set
553 574
554# 575#
555# I2C Hardware Bus support 576# I2C Hardware Bus support
@@ -560,27 +581,23 @@ CONFIG_I2C_GPIO=m
560# CONFIG_I2C_SIMTEC is not set 581# CONFIG_I2C_SIMTEC is not set
561# CONFIG_I2C_TAOS_EVM is not set 582# CONFIG_I2C_TAOS_EVM is not set
562# CONFIG_I2C_STUB is not set 583# CONFIG_I2C_STUB is not set
584# CONFIG_I2C_PCA_PLATFORM is not set
563 585
564# 586#
565# Miscellaneous I2C Chip support 587# Miscellaneous I2C Chip support
566# 588#
567# CONFIG_SENSORS_DS1337 is not set
568# CONFIG_SENSORS_DS1374 is not set
569# CONFIG_DS1682 is not set 589# CONFIG_DS1682 is not set
570# CONFIG_SENSORS_EEPROM is not set 590# CONFIG_SENSORS_EEPROM is not set
571# CONFIG_SENSORS_PCF8574 is not set 591# CONFIG_SENSORS_PCF8574 is not set
572# CONFIG_SENSORS_PCA9539 is not set 592# CONFIG_PCF8575 is not set
573# CONFIG_SENSORS_PCF8591 is not set 593# CONFIG_SENSORS_PCF8591 is not set
594# CONFIG_TPS65010 is not set
574# CONFIG_SENSORS_MAX6875 is not set 595# CONFIG_SENSORS_MAX6875 is not set
575# CONFIG_SENSORS_TSL2550 is not set 596# CONFIG_SENSORS_TSL2550 is not set
576# CONFIG_I2C_DEBUG_CORE is not set 597# CONFIG_I2C_DEBUG_CORE is not set
577# CONFIG_I2C_DEBUG_ALGO is not set 598# CONFIG_I2C_DEBUG_ALGO is not set
578# CONFIG_I2C_DEBUG_BUS is not set 599# CONFIG_I2C_DEBUG_BUS is not set
579# CONFIG_I2C_DEBUG_CHIP is not set 600# CONFIG_I2C_DEBUG_CHIP is not set
580
581#
582# SPI support
583#
584CONFIG_SPI=y 601CONFIG_SPI=y
585# CONFIG_SPI_DEBUG is not set 602# CONFIG_SPI_DEBUG is not set
586CONFIG_SPI_MASTER=y 603CONFIG_SPI_MASTER=y
@@ -597,9 +614,27 @@ CONFIG_SPI_ATMEL=y
597# CONFIG_SPI_AT25 is not set 614# CONFIG_SPI_AT25 is not set
598CONFIG_SPI_SPIDEV=m 615CONFIG_SPI_SPIDEV=m
599# CONFIG_SPI_TLE62X0 is not set 616# CONFIG_SPI_TLE62X0 is not set
617CONFIG_HAVE_GPIO_LIB=y
618
619#
620# GPIO Support
621#
622# CONFIG_DEBUG_GPIO is not set
623
624#
625# I2C GPIO expanders:
626#
627# CONFIG_GPIO_PCA953X is not set
628# CONFIG_GPIO_PCF857X is not set
629
630#
631# SPI GPIO expanders:
632#
633# CONFIG_GPIO_MCP23S08 is not set
600# CONFIG_W1 is not set 634# CONFIG_W1 is not set
601# CONFIG_POWER_SUPPLY is not set 635# CONFIG_POWER_SUPPLY is not set
602# CONFIG_HWMON is not set 636# CONFIG_HWMON is not set
637# CONFIG_THERMAL is not set
603CONFIG_WATCHDOG=y 638CONFIG_WATCHDOG=y
604# CONFIG_WATCHDOG_NOWAYOUT is not set 639# CONFIG_WATCHDOG_NOWAYOUT is not set
605 640
@@ -619,12 +654,22 @@ CONFIG_SSB_POSSIBLE=y
619# Multifunction device drivers 654# Multifunction device drivers
620# 655#
621# CONFIG_MFD_SM501 is not set 656# CONFIG_MFD_SM501 is not set
657# CONFIG_HTC_PASIC3 is not set
622 658
623# 659#
624# Multimedia devices 660# Multimedia devices
625# 661#
662
663#
664# Multimedia core support
665#
626# CONFIG_VIDEO_DEV is not set 666# CONFIG_VIDEO_DEV is not set
627# CONFIG_DVB_CORE is not set 667# CONFIG_DVB_CORE is not set
668# CONFIG_VIDEO_MEDIA is not set
669
670#
671# Multimedia drivers
672#
628# CONFIG_DAB is not set 673# CONFIG_DAB is not set
629 674
630# 675#
@@ -682,7 +727,11 @@ CONFIG_SND_AT73C213_TARGET_BITRATE=48000
682# CONFIG_SND_SOC is not set 727# CONFIG_SND_SOC is not set
683 728
684# 729#
685# SoC Audio support for SuperH 730# ALSA SoC audio for Freescale SOCs
731#
732
733#
734# SoC Audio for the Texas Instruments OMAP
686# 735#
687 736
688# 737#
@@ -694,14 +743,12 @@ CONFIG_USB_SUPPORT=y
694# CONFIG_USB_ARCH_HAS_HCD is not set 743# CONFIG_USB_ARCH_HAS_HCD is not set
695# CONFIG_USB_ARCH_HAS_OHCI is not set 744# CONFIG_USB_ARCH_HAS_OHCI is not set
696# CONFIG_USB_ARCH_HAS_EHCI is not set 745# CONFIG_USB_ARCH_HAS_EHCI is not set
746# CONFIG_USB_OTG_WHITELIST is not set
747# CONFIG_USB_OTG_BLACKLIST_HUB is not set
697 748
698# 749#
699# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 750# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
700# 751#
701
702#
703# USB Gadget Support
704#
705CONFIG_USB_GADGET=y 752CONFIG_USB_GADGET=y
706# CONFIG_USB_GADGET_DEBUG is not set 753# CONFIG_USB_GADGET_DEBUG is not set
707# CONFIG_USB_GADGET_DEBUG_FILES is not set 754# CONFIG_USB_GADGET_DEBUG_FILES is not set
@@ -714,6 +761,7 @@ CONFIG_USB_ATMEL_USBA=y
714# CONFIG_USB_GADGET_NET2280 is not set 761# CONFIG_USB_GADGET_NET2280 is not set
715# CONFIG_USB_GADGET_PXA2XX is not set 762# CONFIG_USB_GADGET_PXA2XX is not set
716# CONFIG_USB_GADGET_M66592 is not set 763# CONFIG_USB_GADGET_M66592 is not set
764# CONFIG_USB_GADGET_PXA27X is not set
717# CONFIG_USB_GADGET_GOKU is not set 765# CONFIG_USB_GADGET_GOKU is not set
718# CONFIG_USB_GADGET_LH7A40X is not set 766# CONFIG_USB_GADGET_LH7A40X is not set
719# CONFIG_USB_GADGET_OMAP is not set 767# CONFIG_USB_GADGET_OMAP is not set
@@ -729,6 +777,7 @@ CONFIG_USB_FILE_STORAGE=m
729# CONFIG_USB_FILE_STORAGE_TEST is not set 777# CONFIG_USB_FILE_STORAGE_TEST is not set
730CONFIG_USB_G_SERIAL=m 778CONFIG_USB_G_SERIAL=m
731# CONFIG_USB_MIDI_GADGET is not set 779# CONFIG_USB_MIDI_GADGET is not set
780# CONFIG_USB_G_PRINTER is not set
732CONFIG_MMC=m 781CONFIG_MMC=m
733# CONFIG_MMC_DEBUG is not set 782# CONFIG_MMC_DEBUG is not set
734# CONFIG_MMC_UNSAFE_RESUME is not set 783# CONFIG_MMC_UNSAFE_RESUME is not set
@@ -739,17 +788,20 @@ CONFIG_MMC=m
739CONFIG_MMC_BLOCK=m 788CONFIG_MMC_BLOCK=m
740# CONFIG_MMC_BLOCK_BOUNCE is not set 789# CONFIG_MMC_BLOCK_BOUNCE is not set
741# CONFIG_SDIO_UART is not set 790# CONFIG_SDIO_UART is not set
791# CONFIG_MMC_TEST is not set
742 792
743# 793#
744# MMC/SD Host Controller Drivers 794# MMC/SD Host Controller Drivers
745# 795#
746CONFIG_MMC_SPI=m 796CONFIG_MMC_SPI=m
797# CONFIG_MEMSTICK is not set
747CONFIG_NEW_LEDS=y 798CONFIG_NEW_LEDS=y
748CONFIG_LEDS_CLASS=y 799CONFIG_LEDS_CLASS=y
749 800
750# 801#
751# LED drivers 802# LED drivers
752# 803#
804CONFIG_LEDS_ATMEL_PWM=m
753CONFIG_LEDS_GPIO=y 805CONFIG_LEDS_GPIO=y
754 806
755# 807#
@@ -758,6 +810,8 @@ CONFIG_LEDS_GPIO=y
758CONFIG_LEDS_TRIGGERS=y 810CONFIG_LEDS_TRIGGERS=y
759CONFIG_LEDS_TRIGGER_TIMER=y 811CONFIG_LEDS_TRIGGER_TIMER=y
760CONFIG_LEDS_TRIGGER_HEARTBEAT=y 812CONFIG_LEDS_TRIGGER_HEARTBEAT=y
813CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
814# CONFIG_ACCESSIBILITY is not set
761CONFIG_RTC_LIB=y 815CONFIG_RTC_LIB=y
762CONFIG_RTC_CLASS=y 816CONFIG_RTC_CLASS=y
763CONFIG_RTC_HCTOSYS=y 817CONFIG_RTC_HCTOSYS=y
@@ -786,19 +840,22 @@ CONFIG_RTC_INTF_DEV=y
786# CONFIG_RTC_DRV_PCF8563 is not set 840# CONFIG_RTC_DRV_PCF8563 is not set
787# CONFIG_RTC_DRV_PCF8583 is not set 841# CONFIG_RTC_DRV_PCF8583 is not set
788# CONFIG_RTC_DRV_M41T80 is not set 842# CONFIG_RTC_DRV_M41T80 is not set
843# CONFIG_RTC_DRV_S35390A is not set
789 844
790# 845#
791# SPI RTC drivers 846# SPI RTC drivers
792# 847#
793# CONFIG_RTC_DRV_RS5C348 is not set
794# CONFIG_RTC_DRV_MAX6902 is not set 848# CONFIG_RTC_DRV_MAX6902 is not set
849# CONFIG_RTC_DRV_R9701 is not set
850# CONFIG_RTC_DRV_RS5C348 is not set
795 851
796# 852#
797# Platform RTC drivers 853# Platform RTC drivers
798# 854#
855# CONFIG_RTC_DRV_DS1511 is not set
799# CONFIG_RTC_DRV_DS1553 is not set 856# CONFIG_RTC_DRV_DS1553 is not set
800# CONFIG_RTC_DRV_STK17TA8 is not set
801# CONFIG_RTC_DRV_DS1742 is not set 857# CONFIG_RTC_DRV_DS1742 is not set
858# CONFIG_RTC_DRV_STK17TA8 is not set
802# CONFIG_RTC_DRV_M48T86 is not set 859# CONFIG_RTC_DRV_M48T86 is not set
803# CONFIG_RTC_DRV_M48T59 is not set 860# CONFIG_RTC_DRV_M48T59 is not set
804# CONFIG_RTC_DRV_V3020 is not set 861# CONFIG_RTC_DRV_V3020 is not set
@@ -807,11 +864,8 @@ CONFIG_RTC_INTF_DEV=y
807# on-CPU RTC drivers 864# on-CPU RTC drivers
808# 865#
809CONFIG_RTC_DRV_AT32AP700X=y 866CONFIG_RTC_DRV_AT32AP700X=y
810
811#
812# Userspace I/O
813#
814CONFIG_UIO=m 867CONFIG_UIO=m
868# CONFIG_UIO_SMX is not set
815 869
816# 870#
817# File systems 871# File systems
@@ -828,14 +882,11 @@ CONFIG_JBD=m
828# CONFIG_JFS_FS is not set 882# CONFIG_JFS_FS is not set
829# CONFIG_FS_POSIX_ACL is not set 883# CONFIG_FS_POSIX_ACL is not set
830# CONFIG_XFS_FS is not set 884# CONFIG_XFS_FS is not set
831# CONFIG_GFS2_FS is not set
832# CONFIG_OCFS2_FS is not set 885# CONFIG_OCFS2_FS is not set
833# CONFIG_MINIX_FS is not set 886# CONFIG_DNOTIFY is not set
834# CONFIG_ROMFS_FS is not set
835CONFIG_INOTIFY=y 887CONFIG_INOTIFY=y
836CONFIG_INOTIFY_USER=y 888CONFIG_INOTIFY_USER=y
837# CONFIG_QUOTA is not set 889# CONFIG_QUOTA is not set
838# CONFIG_DNOTIFY is not set
839# CONFIG_AUTOFS_FS is not set 890# CONFIG_AUTOFS_FS is not set
840# CONFIG_AUTOFS4_FS is not set 891# CONFIG_AUTOFS4_FS is not set
841CONFIG_FUSE_FS=m 892CONFIG_FUSE_FS=m
@@ -891,8 +942,10 @@ CONFIG_JFFS2_RTIME=y
891# CONFIG_JFFS2_RUBIN is not set 942# CONFIG_JFFS2_RUBIN is not set
892# CONFIG_CRAMFS is not set 943# CONFIG_CRAMFS is not set
893# CONFIG_VXFS_FS is not set 944# CONFIG_VXFS_FS is not set
945# CONFIG_MINIX_FS is not set
894# CONFIG_HPFS_FS is not set 946# CONFIG_HPFS_FS is not set
895# CONFIG_QNX4FS_FS is not set 947# CONFIG_QNX4FS_FS is not set
948# CONFIG_ROMFS_FS is not set
896# CONFIG_SYSV_FS is not set 949# CONFIG_SYSV_FS is not set
897# CONFIG_UFS_FS is not set 950# CONFIG_UFS_FS is not set
898# CONFIG_NETWORK_FILESYSTEMS is not set 951# CONFIG_NETWORK_FILESYSTEMS is not set
@@ -943,11 +996,6 @@ CONFIG_NLS_ISO8859_1=m
943# CONFIG_NLS_KOI8_U is not set 996# CONFIG_NLS_KOI8_U is not set
944CONFIG_NLS_UTF8=m 997CONFIG_NLS_UTF8=m
945# CONFIG_DLM is not set 998# CONFIG_DLM is not set
946CONFIG_INSTRUMENTATION=y
947CONFIG_PROFILING=y
948CONFIG_OPROFILE=m
949CONFIG_KPROBES=y
950# CONFIG_MARKERS is not set
951 999
952# 1000#
953# Kernel hacking 1001# Kernel hacking
@@ -955,6 +1003,7 @@ CONFIG_KPROBES=y
955# CONFIG_PRINTK_TIME is not set 1003# CONFIG_PRINTK_TIME is not set
956CONFIG_ENABLE_WARN_DEPRECATED=y 1004CONFIG_ENABLE_WARN_DEPRECATED=y
957CONFIG_ENABLE_MUST_CHECK=y 1005CONFIG_ENABLE_MUST_CHECK=y
1006CONFIG_FRAME_WARN=1024
958CONFIG_MAGIC_SYSRQ=y 1007CONFIG_MAGIC_SYSRQ=y
959# CONFIG_UNUSED_SYMBOLS is not set 1008# CONFIG_UNUSED_SYMBOLS is not set
960CONFIG_DEBUG_FS=y 1009CONFIG_DEBUG_FS=y
@@ -965,6 +1014,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
965CONFIG_SCHED_DEBUG=y 1014CONFIG_SCHED_DEBUG=y
966# CONFIG_SCHEDSTATS is not set 1015# CONFIG_SCHEDSTATS is not set
967# CONFIG_TIMER_STATS is not set 1016# CONFIG_TIMER_STATS is not set
1017# CONFIG_DEBUG_OBJECTS is not set
968# CONFIG_DEBUG_RT_MUTEXES is not set 1018# CONFIG_DEBUG_RT_MUTEXES is not set
969# CONFIG_RT_MUTEX_TESTER is not set 1019# CONFIG_RT_MUTEX_TESTER is not set
970# CONFIG_DEBUG_SPINLOCK is not set 1020# CONFIG_DEBUG_SPINLOCK is not set
@@ -978,12 +1028,14 @@ CONFIG_SCHED_DEBUG=y
978CONFIG_DEBUG_BUGVERBOSE=y 1028CONFIG_DEBUG_BUGVERBOSE=y
979# CONFIG_DEBUG_INFO is not set 1029# CONFIG_DEBUG_INFO is not set
980# CONFIG_DEBUG_VM is not set 1030# CONFIG_DEBUG_VM is not set
1031# CONFIG_DEBUG_WRITECOUNT is not set
981# CONFIG_DEBUG_LIST is not set 1032# CONFIG_DEBUG_LIST is not set
982# CONFIG_DEBUG_SG is not set 1033# CONFIG_DEBUG_SG is not set
983CONFIG_FRAME_POINTER=y 1034CONFIG_FRAME_POINTER=y
984CONFIG_FORCED_INLINING=y
985# CONFIG_BOOT_PRINTK_DELAY is not set 1035# CONFIG_BOOT_PRINTK_DELAY is not set
986# CONFIG_RCU_TORTURE_TEST is not set 1036# CONFIG_RCU_TORTURE_TEST is not set
1037# CONFIG_KPROBES_SANITY_TEST is not set
1038# CONFIG_BACKTRACE_SELF_TEST is not set
987# CONFIG_LKDTM is not set 1039# CONFIG_LKDTM is not set
988# CONFIG_FAULT_INJECTION is not set 1040# CONFIG_FAULT_INJECTION is not set
989# CONFIG_SAMPLES is not set 1041# CONFIG_SAMPLES is not set
@@ -1000,6 +1052,8 @@ CONFIG_FORCED_INLINING=y
1000# Library routines 1052# Library routines
1001# 1053#
1002CONFIG_BITREVERSE=y 1054CONFIG_BITREVERSE=y
1055# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1056# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1003CONFIG_CRC_CCITT=m 1057CONFIG_CRC_CCITT=m
1004# CONFIG_CRC16 is not set 1058# CONFIG_CRC16 is not set
1005CONFIG_CRC_ITU_T=m 1059CONFIG_CRC_ITU_T=m
diff --git a/arch/avr32/configs/atstk1004_defconfig b/arch/avr32/configs/atstk1004_defconfig
index 634c52760349..a0912fb7c92e 100644
--- a/arch/avr32/configs/atstk1004_defconfig
+++ b/arch/avr32/configs/atstk1004_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.24-rc7 3# Linux kernel version: 2.6.26-rc3
4# Wed Jan 9 23:04:20 2008 4# Mon May 26 13:34:57 2008
5# 5#
6CONFIG_AVR32=y 6CONFIG_AVR32=y
7CONFIG_GENERIC_GPIO=y 7CONFIG_GENERIC_GPIO=y
@@ -13,10 +13,10 @@ CONFIG_HARDIRQS_SW_RESEND=y
13CONFIG_GENERIC_IRQ_PROBE=y 13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_RWSEM_GENERIC_SPINLOCK=y 14CONFIG_RWSEM_GENERIC_SPINLOCK=y
15CONFIG_GENERIC_TIME=y 15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
16# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 17# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_ARCH_SUPPORTS_OPROFILE=y
20CONFIG_GENERIC_HWEIGHT=y 20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y 21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_BUG=y 22CONFIG_GENERIC_BUG=y
@@ -34,15 +34,15 @@ CONFIG_LOCALVERSION=""
34# CONFIG_POSIX_MQUEUE is not set 34# CONFIG_POSIX_MQUEUE is not set
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_PID_NS is not set
39# CONFIG_AUDIT is not set 37# CONFIG_AUDIT is not set
40# CONFIG_IKCONFIG is not set 38# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14 39CONFIG_LOG_BUF_SHIFT=14
42# CONFIG_CGROUPS is not set 40# CONFIG_CGROUPS is not set
43# CONFIG_FAIR_GROUP_SCHED is not set 41# CONFIG_GROUP_SCHED is not set
44CONFIG_SYSFS_DEPRECATED=y 42CONFIG_SYSFS_DEPRECATED=y
43CONFIG_SYSFS_DEPRECATED_V2=y
45# CONFIG_RELAY is not set 44# CONFIG_RELAY is not set
45# CONFIG_NAMESPACES is not set
46# CONFIG_BLK_DEV_INITRD is not set 46# CONFIG_BLK_DEV_INITRD is not set
47CONFIG_CC_OPTIMIZE_FOR_SIZE=y 47CONFIG_CC_OPTIMIZE_FOR_SIZE=y
48CONFIG_SYSCTL=y 48CONFIG_SYSCTL=y
@@ -54,24 +54,38 @@ CONFIG_HOTPLUG=y
54CONFIG_PRINTK=y 54CONFIG_PRINTK=y
55CONFIG_BUG=y 55CONFIG_BUG=y
56CONFIG_ELF_CORE=y 56CONFIG_ELF_CORE=y
57# CONFIG_COMPAT_BRK is not set
57# CONFIG_BASE_FULL is not set 58# CONFIG_BASE_FULL is not set
58# CONFIG_FUTEX is not set 59# CONFIG_FUTEX is not set
59# CONFIG_EPOLL is not set 60# CONFIG_EPOLL is not set
60# CONFIG_SIGNALFD is not set 61# CONFIG_SIGNALFD is not set
62# CONFIG_TIMERFD is not set
61# CONFIG_EVENTFD is not set 63# CONFIG_EVENTFD is not set
62CONFIG_SHMEM=y 64CONFIG_SHMEM=y
63CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
64# CONFIG_SLAB is not set 66# CONFIG_SLAB is not set
65# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
66CONFIG_SLOB=y 68CONFIG_SLOB=y
69# CONFIG_PROFILING is not set
70# CONFIG_MARKERS is not set
71CONFIG_HAVE_OPROFILE=y
72CONFIG_HAVE_KPROBES=y
73# CONFIG_HAVE_KRETPROBES is not set
74# CONFIG_HAVE_DMA_ATTRS is not set
75# CONFIG_PROC_PAGE_MONITOR is not set
67# CONFIG_TINY_SHMEM is not set 76# CONFIG_TINY_SHMEM is not set
68CONFIG_BASE_SMALL=1 77CONFIG_BASE_SMALL=1
69# CONFIG_MODULES is not set 78# CONFIG_MODULES is not set
70# CONFIG_BLOCK is not set 79# CONFIG_BLOCK is not set
80CONFIG_CLASSIC_RCU=y
71 81
72# 82#
73# System Type and features 83# System Type and features
74# 84#
85# CONFIG_TICK_ONESHOT is not set
86# CONFIG_NO_HZ is not set
87# CONFIG_HIGH_RES_TIMERS is not set
88CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
75CONFIG_SUBARCH_AVR32B=y 89CONFIG_SUBARCH_AVR32B=y
76CONFIG_MMU=y 90CONFIG_MMU=y
77CONFIG_PERFORMANCE_COUNTERS=y 91CONFIG_PERFORMANCE_COUNTERS=y
@@ -115,16 +129,19 @@ CONFIG_FLATMEM=y
115CONFIG_FLAT_NODE_MEM_MAP=y 129CONFIG_FLAT_NODE_MEM_MAP=y
116# CONFIG_SPARSEMEM_STATIC is not set 130# CONFIG_SPARSEMEM_STATIC is not set
117# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 131# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
132CONFIG_PAGEFLAGS_EXTENDED=y
118CONFIG_SPLIT_PTLOCK_CPUS=4 133CONFIG_SPLIT_PTLOCK_CPUS=4
119# CONFIG_RESOURCES_64BIT is not set 134# CONFIG_RESOURCES_64BIT is not set
120CONFIG_ZONE_DMA_FLAG=0 135CONFIG_ZONE_DMA_FLAG=0
121CONFIG_VIRT_TO_BUS=y 136CONFIG_VIRT_TO_BUS=y
122# CONFIG_OWNERSHIP_TRACE is not set 137# CONFIG_OWNERSHIP_TRACE is not set
138# CONFIG_NMI_DEBUGGING is not set
123# CONFIG_HZ_100 is not set 139# CONFIG_HZ_100 is not set
124CONFIG_HZ_250=y 140CONFIG_HZ_250=y
125# CONFIG_HZ_300 is not set 141# CONFIG_HZ_300 is not set
126# CONFIG_HZ_1000 is not set 142# CONFIG_HZ_1000 is not set
127CONFIG_HZ=250 143CONFIG_HZ=250
144# CONFIG_SCHED_HRTICK is not set
128CONFIG_CMDLINE="" 145CONFIG_CMDLINE=""
129 146
130# 147#
@@ -134,20 +151,7 @@ CONFIG_CMDLINE=""
134# 151#
135# CPU Frequency scaling 152# CPU Frequency scaling
136# 153#
137CONFIG_CPU_FREQ=y 154# CONFIG_CPU_FREQ is not set
138CONFIG_CPU_FREQ_TABLE=y
139# CONFIG_CPU_FREQ_DEBUG is not set
140# CONFIG_CPU_FREQ_STAT is not set
141CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
142# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
143# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
144# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
145CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
146# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
147CONFIG_CPU_FREQ_GOV_USERSPACE=y
148CONFIG_CPU_FREQ_GOV_ONDEMAND=y
149# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
150CONFIG_CPU_FREQ_AT32AP=y
151 155
152# 156#
153# Bus options 157# Bus options
@@ -197,8 +201,6 @@ CONFIG_TCP_CONG_CUBIC=y
197CONFIG_DEFAULT_TCP_CONG="cubic" 201CONFIG_DEFAULT_TCP_CONG="cubic"
198# CONFIG_TCP_MD5SIG is not set 202# CONFIG_TCP_MD5SIG is not set
199# CONFIG_IPV6 is not set 203# CONFIG_IPV6 is not set
200# CONFIG_INET6_XFRM_TUNNEL is not set
201# CONFIG_INET6_TUNNEL is not set
202# CONFIG_NETWORK_SECMARK is not set 204# CONFIG_NETWORK_SECMARK is not set
203# CONFIG_NETFILTER is not set 205# CONFIG_NETFILTER is not set
204# CONFIG_IP_DCCP is not set 206# CONFIG_IP_DCCP is not set
@@ -222,6 +224,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
222# 224#
223# CONFIG_NET_PKTGEN is not set 225# CONFIG_NET_PKTGEN is not set
224# CONFIG_HAMRADIO is not set 226# CONFIG_HAMRADIO is not set
227# CONFIG_CAN is not set
225# CONFIG_IRDA is not set 228# CONFIG_IRDA is not set
226# CONFIG_BT is not set 229# CONFIG_BT is not set
227# CONFIG_AF_RXRPC is not set 230# CONFIG_AF_RXRPC is not set
@@ -255,6 +258,7 @@ CONFIG_MTD=y
255CONFIG_MTD_PARTITIONS=y 258CONFIG_MTD_PARTITIONS=y
256# CONFIG_MTD_REDBOOT_PARTS is not set 259# CONFIG_MTD_REDBOOT_PARTS is not set
257CONFIG_MTD_CMDLINE_PARTS=y 260CONFIG_MTD_CMDLINE_PARTS=y
261# CONFIG_MTD_AR7_PARTS is not set
258 262
259# 263#
260# User Modules And Translation Layers 264# User Modules And Translation Layers
@@ -321,6 +325,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
321# CONFIG_MTD_UBI is not set 325# CONFIG_MTD_UBI is not set
322# CONFIG_PARPORT is not set 326# CONFIG_PARPORT is not set
323# CONFIG_MISC_DEVICES is not set 327# CONFIG_MISC_DEVICES is not set
328# CONFIG_HAVE_IDE is not set
324 329
325# 330#
326# SCSI device support 331# SCSI device support
@@ -346,6 +351,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
346# Character devices 351# Character devices
347# 352#
348# CONFIG_VT is not set 353# CONFIG_VT is not set
354# CONFIG_DEVKMEM is not set
349# CONFIG_SERIAL_NONSTANDARD is not set 355# CONFIG_SERIAL_NONSTANDARD is not set
350 356
351# 357#
@@ -358,6 +364,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
358# 364#
359CONFIG_SERIAL_ATMEL=y 365CONFIG_SERIAL_ATMEL=y
360CONFIG_SERIAL_ATMEL_CONSOLE=y 366CONFIG_SERIAL_ATMEL_CONSOLE=y
367# CONFIG_SERIAL_ATMEL_PDC is not set
361# CONFIG_SERIAL_ATMEL_TTYAT is not set 368# CONFIG_SERIAL_ATMEL_TTYAT is not set
362CONFIG_SERIAL_CORE=y 369CONFIG_SERIAL_CORE=y
363CONFIG_SERIAL_CORE_CONSOLE=y 370CONFIG_SERIAL_CORE_CONSOLE=y
@@ -365,15 +372,9 @@ CONFIG_UNIX98_PTYS=y
365# CONFIG_LEGACY_PTYS is not set 372# CONFIG_LEGACY_PTYS is not set
366# CONFIG_IPMI_HANDLER is not set 373# CONFIG_IPMI_HANDLER is not set
367# CONFIG_HW_RANDOM is not set 374# CONFIG_HW_RANDOM is not set
368# CONFIG_RTC is not set
369# CONFIG_GEN_RTC is not set
370# CONFIG_R3964 is not set 375# CONFIG_R3964 is not set
371# CONFIG_TCG_TPM is not set 376# CONFIG_TCG_TPM is not set
372# CONFIG_I2C is not set 377# CONFIG_I2C is not set
373
374#
375# SPI support
376#
377CONFIG_SPI=y 378CONFIG_SPI=y
378CONFIG_SPI_MASTER=y 379CONFIG_SPI_MASTER=y
379 380
@@ -389,9 +390,24 @@ CONFIG_SPI_ATMEL=y
389# CONFIG_SPI_AT25 is not set 390# CONFIG_SPI_AT25 is not set
390# CONFIG_SPI_SPIDEV is not set 391# CONFIG_SPI_SPIDEV is not set
391# CONFIG_SPI_TLE62X0 is not set 392# CONFIG_SPI_TLE62X0 is not set
393CONFIG_HAVE_GPIO_LIB=y
394
395#
396# GPIO Support
397#
398
399#
400# I2C GPIO expanders:
401#
402
403#
404# SPI GPIO expanders:
405#
406# CONFIG_GPIO_MCP23S08 is not set
392# CONFIG_W1 is not set 407# CONFIG_W1 is not set
393# CONFIG_POWER_SUPPLY is not set 408# CONFIG_POWER_SUPPLY is not set
394# CONFIG_HWMON is not set 409# CONFIG_HWMON is not set
410# CONFIG_THERMAL is not set
395CONFIG_WATCHDOG=y 411CONFIG_WATCHDOG=y
396# CONFIG_WATCHDOG_NOWAYOUT is not set 412# CONFIG_WATCHDOG_NOWAYOUT is not set
397 413
@@ -411,12 +427,22 @@ CONFIG_SSB_POSSIBLE=y
411# Multifunction device drivers 427# Multifunction device drivers
412# 428#
413# CONFIG_MFD_SM501 is not set 429# CONFIG_MFD_SM501 is not set
430# CONFIG_HTC_PASIC3 is not set
414 431
415# 432#
416# Multimedia devices 433# Multimedia devices
417# 434#
435
436#
437# Multimedia core support
438#
418# CONFIG_VIDEO_DEV is not set 439# CONFIG_VIDEO_DEV is not set
419# CONFIG_DVB_CORE is not set 440# CONFIG_DVB_CORE is not set
441# CONFIG_VIDEO_MEDIA is not set
442
443#
444# Multimedia drivers
445#
420# CONFIG_DAB is not set 446# CONFIG_DAB is not set
421 447
422# 448#
@@ -434,8 +460,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
434# CONFIG_FB_SYS_FILLRECT is not set 460# CONFIG_FB_SYS_FILLRECT is not set
435# CONFIG_FB_SYS_COPYAREA is not set 461# CONFIG_FB_SYS_COPYAREA is not set
436# CONFIG_FB_SYS_IMAGEBLIT is not set 462# CONFIG_FB_SYS_IMAGEBLIT is not set
463# CONFIG_FB_FOREIGN_ENDIAN is not set
437# CONFIG_FB_SYS_FOPS is not set 464# CONFIG_FB_SYS_FOPS is not set
438CONFIG_FB_DEFERRED_IO=y
439# CONFIG_FB_SVGALIB is not set 465# CONFIG_FB_SVGALIB is not set
440# CONFIG_FB_MACMODES is not set 466# CONFIG_FB_MACMODES is not set
441# CONFIG_FB_BACKLIGHT is not set 467# CONFIG_FB_BACKLIGHT is not set
@@ -467,14 +493,12 @@ CONFIG_USB_SUPPORT=y
467# CONFIG_USB_ARCH_HAS_HCD is not set 493# CONFIG_USB_ARCH_HAS_HCD is not set
468# CONFIG_USB_ARCH_HAS_OHCI is not set 494# CONFIG_USB_ARCH_HAS_OHCI is not set
469# CONFIG_USB_ARCH_HAS_EHCI is not set 495# CONFIG_USB_ARCH_HAS_EHCI is not set
496# CONFIG_USB_OTG_WHITELIST is not set
497# CONFIG_USB_OTG_BLACKLIST_HUB is not set
470 498
471# 499#
472# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 500# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
473# 501#
474
475#
476# USB Gadget Support
477#
478CONFIG_USB_GADGET=y 502CONFIG_USB_GADGET=y
479# CONFIG_USB_GADGET_DEBUG_FILES is not set 503# CONFIG_USB_GADGET_DEBUG_FILES is not set
480CONFIG_USB_GADGET_SELECTED=y 504CONFIG_USB_GADGET_SELECTED=y
@@ -485,6 +509,7 @@ CONFIG_USB_ATMEL_USBA=y
485# CONFIG_USB_GADGET_NET2280 is not set 509# CONFIG_USB_GADGET_NET2280 is not set
486# CONFIG_USB_GADGET_PXA2XX is not set 510# CONFIG_USB_GADGET_PXA2XX is not set
487# CONFIG_USB_GADGET_M66592 is not set 511# CONFIG_USB_GADGET_M66592 is not set
512# CONFIG_USB_GADGET_PXA27X is not set
488# CONFIG_USB_GADGET_GOKU is not set 513# CONFIG_USB_GADGET_GOKU is not set
489# CONFIG_USB_GADGET_LH7A40X is not set 514# CONFIG_USB_GADGET_LH7A40X is not set
490# CONFIG_USB_GADGET_OMAP is not set 515# CONFIG_USB_GADGET_OMAP is not set
@@ -499,8 +524,11 @@ CONFIG_USB_ETH=y
499# CONFIG_USB_FILE_STORAGE is not set 524# CONFIG_USB_FILE_STORAGE is not set
500# CONFIG_USB_G_SERIAL is not set 525# CONFIG_USB_G_SERIAL is not set
501# CONFIG_USB_MIDI_GADGET is not set 526# CONFIG_USB_MIDI_GADGET is not set
527# CONFIG_USB_G_PRINTER is not set
502# CONFIG_MMC is not set 528# CONFIG_MMC is not set
529# CONFIG_MEMSTICK is not set
503# CONFIG_NEW_LEDS is not set 530# CONFIG_NEW_LEDS is not set
531# CONFIG_ACCESSIBILITY is not set
504CONFIG_RTC_LIB=y 532CONFIG_RTC_LIB=y
505CONFIG_RTC_CLASS=y 533CONFIG_RTC_CLASS=y
506CONFIG_RTC_HCTOSYS=y 534CONFIG_RTC_HCTOSYS=y
@@ -519,15 +547,17 @@ CONFIG_RTC_INTF_DEV=y
519# 547#
520# SPI RTC drivers 548# SPI RTC drivers
521# 549#
522# CONFIG_RTC_DRV_RS5C348 is not set
523# CONFIG_RTC_DRV_MAX6902 is not set 550# CONFIG_RTC_DRV_MAX6902 is not set
551# CONFIG_RTC_DRV_R9701 is not set
552# CONFIG_RTC_DRV_RS5C348 is not set
524 553
525# 554#
526# Platform RTC drivers 555# Platform RTC drivers
527# 556#
557# CONFIG_RTC_DRV_DS1511 is not set
528# CONFIG_RTC_DRV_DS1553 is not set 558# CONFIG_RTC_DRV_DS1553 is not set
529# CONFIG_RTC_DRV_STK17TA8 is not set
530# CONFIG_RTC_DRV_DS1742 is not set 559# CONFIG_RTC_DRV_DS1742 is not set
560# CONFIG_RTC_DRV_STK17TA8 is not set
531# CONFIG_RTC_DRV_M48T86 is not set 561# CONFIG_RTC_DRV_M48T86 is not set
532# CONFIG_RTC_DRV_M48T59 is not set 562# CONFIG_RTC_DRV_M48T59 is not set
533# CONFIG_RTC_DRV_V3020 is not set 563# CONFIG_RTC_DRV_V3020 is not set
@@ -536,18 +566,14 @@ CONFIG_RTC_INTF_DEV=y
536# on-CPU RTC drivers 566# on-CPU RTC drivers
537# 567#
538CONFIG_RTC_DRV_AT32AP700X=y 568CONFIG_RTC_DRV_AT32AP700X=y
539
540#
541# Userspace I/O
542#
543# CONFIG_UIO is not set 569# CONFIG_UIO is not set
544 570
545# 571#
546# File systems 572# File systems
547# 573#
574# CONFIG_DNOTIFY is not set
548# CONFIG_INOTIFY is not set 575# CONFIG_INOTIFY is not set
549# CONFIG_QUOTA is not set 576# CONFIG_QUOTA is not set
550# CONFIG_DNOTIFY is not set
551# CONFIG_AUTOFS_FS is not set 577# CONFIG_AUTOFS_FS is not set
552# CONFIG_AUTOFS4_FS is not set 578# CONFIG_AUTOFS4_FS is not set
553# CONFIG_FUSE_FS is not set 579# CONFIG_FUSE_FS is not set
@@ -580,7 +606,6 @@ CONFIG_JFFS2_RTIME=y
580# CONFIG_NETWORK_FILESYSTEMS is not set 606# CONFIG_NETWORK_FILESYSTEMS is not set
581# CONFIG_NLS is not set 607# CONFIG_NLS is not set
582# CONFIG_DLM is not set 608# CONFIG_DLM is not set
583# CONFIG_INSTRUMENTATION is not set
584 609
585# 610#
586# Kernel hacking 611# Kernel hacking
@@ -588,6 +613,7 @@ CONFIG_JFFS2_RTIME=y
588# CONFIG_PRINTK_TIME is not set 613# CONFIG_PRINTK_TIME is not set
589CONFIG_ENABLE_WARN_DEPRECATED=y 614CONFIG_ENABLE_WARN_DEPRECATED=y
590CONFIG_ENABLE_MUST_CHECK=y 615CONFIG_ENABLE_MUST_CHECK=y
616CONFIG_FRAME_WARN=1024
591CONFIG_MAGIC_SYSRQ=y 617CONFIG_MAGIC_SYSRQ=y
592# CONFIG_UNUSED_SYMBOLS is not set 618# CONFIG_UNUSED_SYMBOLS is not set
593# CONFIG_DEBUG_FS is not set 619# CONFIG_DEBUG_FS is not set
@@ -608,6 +634,8 @@ CONFIG_MAGIC_SYSRQ=y
608# Library routines 634# Library routines
609# 635#
610CONFIG_BITREVERSE=y 636CONFIG_BITREVERSE=y
637# CONFIG_GENERIC_FIND_FIRST_BIT is not set
638# CONFIG_GENERIC_FIND_NEXT_BIT is not set
611# CONFIG_CRC_CCITT is not set 639# CONFIG_CRC_CCITT is not set
612# CONFIG_CRC16 is not set 640# CONFIG_CRC16 is not set
613# CONFIG_CRC_ITU_T is not set 641# CONFIG_CRC_ITU_T is not set
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c
index 80f55f8dbf1c..84a7d44edc67 100644
--- a/arch/avr32/kernel/avr32_ksyms.c
+++ b/arch/avr32/kernel/avr32_ksyms.c
@@ -29,7 +29,9 @@ EXPORT_SYMBOL(__avr32_asr64);
29 */ 29 */
30EXPORT_SYMBOL(memset); 30EXPORT_SYMBOL(memset);
31EXPORT_SYMBOL(memcpy); 31EXPORT_SYMBOL(memcpy);
32
32EXPORT_SYMBOL(clear_page); 33EXPORT_SYMBOL(clear_page);
34EXPORT_SYMBOL(copy_page);
33 35
34/* 36/*
35 * Userspace access stuff. 37 * Userspace access stuff.
@@ -41,6 +43,8 @@ EXPORT_SYMBOL(strncpy_from_user);
41EXPORT_SYMBOL(__strncpy_from_user); 43EXPORT_SYMBOL(__strncpy_from_user);
42EXPORT_SYMBOL(clear_user); 44EXPORT_SYMBOL(clear_user);
43EXPORT_SYMBOL(__clear_user); 45EXPORT_SYMBOL(__clear_user);
46EXPORT_SYMBOL(strnlen_user);
47
44EXPORT_SYMBOL(csum_partial); 48EXPORT_SYMBOL(csum_partial);
45EXPORT_SYMBOL(csum_partial_copy_generic); 49EXPORT_SYMBOL(csum_partial_copy_generic);
46 50
diff --git a/arch/avr32/kernel/init_task.c b/arch/avr32/kernel/init_task.c
index effcacf9d1a2..44058469c6ec 100644
--- a/arch/avr32/kernel/init_task.c
+++ b/arch/avr32/kernel/init_task.c
@@ -14,7 +14,6 @@
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15 15
16static struct fs_struct init_fs = INIT_FS; 16static struct fs_struct init_fs = INIT_FS;
17static struct files_struct init_files = INIT_FILES;
18static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 17static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
19static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 18static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
20struct mm_struct init_mm = INIT_MM(init_mm); 19struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/avr32/mach-at32ap/cpufreq.c b/arch/avr32/mach-at32ap/cpufreq.c
index 235524b79193..5dd8d25428bf 100644
--- a/arch/avr32/mach-at32ap/cpufreq.c
+++ b/arch/avr32/mach-at32ap/cpufreq.c
@@ -108,5 +108,4 @@ static int __init at32_cpufreq_init(void)
108{ 108{
109 return cpufreq_register_driver(&at32_driver); 109 return cpufreq_register_driver(&at32_driver);
110} 110}
111 111late_initcall(at32_cpufreq_init);
112arch_initcall(at32_cpufreq_init);
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index fd5708523f2e..b87634e75f20 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -479,16 +479,6 @@ comment "Memory Setup"
479 479
480comment "Misc" 480comment "Misc"
481 481
482config ENET_FLASH_PIN
483 int "PF port/pin used for flash and ethernet sharing"
484 depends on (BFIN533_STAMP)
485 default 0
486 help
487 PF port/pin used for flash and ethernet sharing to allow other PF
488 pins to be used on other platforms without having to touch common
489 code.
490 For example: PF0 --> 0,PF1 --> 1,PF2 --> 2, etc.
491
492choice 482choice
493 prompt "Blackfin Exception Scratch Register" 483 prompt "Blackfin Exception Scratch Register"
494 default BFIN_SCRATCH_REG_RETN 484 default BFIN_SCRATCH_REG_RETN
@@ -695,6 +685,8 @@ choice
695 prompt "Uncached SDRAM region" 685 prompt "Uncached SDRAM region"
696 default DMA_UNCACHED_1M 686 default DMA_UNCACHED_1M
697 depends on BFIN_DMA_5XX 687 depends on BFIN_DMA_5XX
688config DMA_UNCACHED_4M
689 bool "Enable 4M DMA region"
698config DMA_UNCACHED_2M 690config DMA_UNCACHED_2M
699 bool "Enable 2M DMA region" 691 bool "Enable 2M DMA region"
700config DMA_UNCACHED_1M 692config DMA_UNCACHED_1M
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 64876dfc2e55..5e6fb9d8e50f 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,6 +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.22.16 3# Linux kernel version: 2.6.24.7
4# Fri May 16 10:02:29 2008
4# 5#
5# CONFIG_MMU is not set 6# CONFIG_MMU is not set
6# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -13,35 +14,34 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 14CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 15CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 16CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 21
22# 22#
23# Code maturity level options 23# General setup
24# 24#
25CONFIG_EXPERIMENTAL=y 25CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 26CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 27CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 28CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 29CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 30CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 31CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 32# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 33# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 34# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 35# CONFIG_USER_NS is not set
36# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 37# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 38CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 39CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 40CONFIG_LOG_BUF_SHIFT=14
41# CONFIG_CGROUPS is not set
42CONFIG_FAIR_GROUP_SCHED=y
43CONFIG_FAIR_USER_SCHED=y
44# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 45CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 47CONFIG_BLK_DEV_INITRD=y
@@ -64,32 +64,24 @@ CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
68# CONFIG_NP2 is not set
69CONFIG_SLAB=y 67CONFIG_SLAB=y
70# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70CONFIG_SLABINFO=y
72CONFIG_RT_MUTEXES=y 71CONFIG_RT_MUTEXES=y
73CONFIG_TINY_SHMEM=y 72CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=0 73CONFIG_BASE_SMALL=0
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y 74CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y 75CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set 76# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set 77# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set 78# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y 79CONFIG_KMOD=y
85
86#
87# Block layer
88#
89CONFIG_BLOCK=y 80CONFIG_BLOCK=y
90# CONFIG_LBD is not set 81# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 82# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set 83# CONFIG_LSF is not set
84# CONFIG_BLK_DEV_BSG is not set
93 85
94# 86#
95# IO Schedulers 87# IO Schedulers
@@ -141,7 +133,6 @@ CONFIG_BF_REV_0_0=y
141# CONFIG_BF_REV_ANY is not set 133# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 134# CONFIG_BF_REV_NONE is not set
143CONFIG_BF52x=y 135CONFIG_BF52x=y
144CONFIG_BFIN_SINGLE_CORE=y
145CONFIG_MEM_MT48LC32M16A2TG_75=y 136CONFIG_MEM_MT48LC32M16A2TG_75=y
146CONFIG_BFIN527_EZKIT=y 137CONFIG_BFIN527_EZKIT=y
147 138
@@ -227,12 +218,14 @@ CONFIG_IRQ_USB_DMA=11
227# Board customizations 218# Board customizations
228# 219#
229# CONFIG_CMDLINE_BOOL is not set 220# CONFIG_CMDLINE_BOOL is not set
221CONFIG_BOOT_LOAD=0x1000
230 222
231# 223#
232# Clock/PLL Setup 224# Clock/PLL Setup
233# 225#
234CONFIG_CLKIN_HZ=25000000 226CONFIG_CLKIN_HZ=25000000
235# CONFIG_BFIN_KERNEL_CLOCK is not set 227# CONFIG_BFIN_KERNEL_CLOCK is not set
228CONFIG_MAX_MEM_SIZE=512
236CONFIG_MAX_VCO_HZ=600000000 229CONFIG_MAX_VCO_HZ=600000000
237CONFIG_MIN_VCO_HZ=50000000 230CONFIG_MIN_VCO_HZ=50000000
238CONFIG_MAX_SCLK_HZ=133333333 231CONFIG_MAX_SCLK_HZ=133333333
@@ -246,13 +239,17 @@ CONFIG_HZ_250=y
246# CONFIG_HZ_300 is not set 239# CONFIG_HZ_300 is not set
247# CONFIG_HZ_1000 is not set 240# CONFIG_HZ_1000 is not set
248CONFIG_HZ=250 241CONFIG_HZ=250
242CONFIG_GENERIC_TIME=y
243CONFIG_GENERIC_CLOCKEVENTS=y
244# CONFIG_CYCLES_CLOCKSOURCE is not set
245# CONFIG_TICK_ONESHOT is not set
246# CONFIG_NO_HZ is not set
247# CONFIG_HIGH_RES_TIMERS is not set
248CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
249 249
250# 250#
251# Memory Setup 251# Misc
252# 252#
253CONFIG_MAX_MEM_SIZE=512
254CONFIG_MEM_ADD_WIDTH=10
255CONFIG_BOOT_LOAD=0x1000
256CONFIG_BFIN_SCRATCH_REG_RETN=y 253CONFIG_BFIN_SCRATCH_REG_RETN=y
257# CONFIG_BFIN_SCRATCH_REG_RETE is not set 254# CONFIG_BFIN_SCRATCH_REG_RETE is not set
258# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 255# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -288,12 +285,14 @@ CONFIG_FLATMEM_MANUAL=y
288CONFIG_FLATMEM=y 285CONFIG_FLATMEM=y
289CONFIG_FLAT_NODE_MEM_MAP=y 286CONFIG_FLAT_NODE_MEM_MAP=y
290# CONFIG_SPARSEMEM_STATIC is not set 287# CONFIG_SPARSEMEM_STATIC is not set
288# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
291CONFIG_SPLIT_PTLOCK_CPUS=4 289CONFIG_SPLIT_PTLOCK_CPUS=4
292# CONFIG_RESOURCES_64BIT is not set 290# CONFIG_RESOURCES_64BIT is not set
293CONFIG_ZONE_DMA_FLAG=1 291CONFIG_ZONE_DMA_FLAG=1
294CONFIG_LARGE_ALLOCS=y 292CONFIG_VIRT_TO_BUS=y
295# CONFIG_BFIN_GPTIMERS is not set 293# CONFIG_BFIN_GPTIMERS is not set
296CONFIG_BFIN_DMA_5XX=y 294CONFIG_BFIN_DMA_5XX=y
295# CONFIG_DMA_UNCACHED_4M is not set
297# CONFIG_DMA_UNCACHED_2M is not set 296# CONFIG_DMA_UNCACHED_2M is not set
298CONFIG_DMA_UNCACHED_1M=y 297CONFIG_DMA_UNCACHED_1M=y
299# CONFIG_DMA_UNCACHED_NONE is not set 298# CONFIG_DMA_UNCACHED_NONE is not set
@@ -338,10 +337,6 @@ CONFIG_BANK_3=0xFFC0
338# 337#
339# CONFIG_PCI is not set 338# CONFIG_PCI is not set
340# CONFIG_ARCH_SUPPORTS_MSI is not set 339# CONFIG_ARCH_SUPPORTS_MSI is not set
341
342#
343# PCCARD (PCMCIA/CardBus) support
344#
345# CONFIG_PCCARD is not set 340# CONFIG_PCCARD is not set
346 341
347# 342#
@@ -357,9 +352,15 @@ CONFIG_BINFMT_ZFLAT=y
357# Power management options 352# Power management options
358# 353#
359# CONFIG_PM is not set 354# CONFIG_PM is not set
355CONFIG_SUSPEND_UP_POSSIBLE=y
360# CONFIG_PM_WAKEUP_BY_GPIO is not set 356# CONFIG_PM_WAKEUP_BY_GPIO is not set
361 357
362# 358#
359# CPU Frequency scaling
360#
361# CONFIG_CPU_FREQ is not set
362
363#
363# Networking 364# Networking
364# 365#
365CONFIG_NET=y 366CONFIG_NET=y
@@ -395,6 +396,7 @@ CONFIG_SYN_COOKIES=y
395CONFIG_INET_XFRM_MODE_TRANSPORT=y 396CONFIG_INET_XFRM_MODE_TRANSPORT=y
396CONFIG_INET_XFRM_MODE_TUNNEL=y 397CONFIG_INET_XFRM_MODE_TUNNEL=y
397CONFIG_INET_XFRM_MODE_BEET=y 398CONFIG_INET_XFRM_MODE_BEET=y
399# CONFIG_INET_LRO is not set
398CONFIG_INET_DIAG=y 400CONFIG_INET_DIAG=y
399CONFIG_INET_TCP_DIAG=y 401CONFIG_INET_TCP_DIAG=y
400# CONFIG_TCP_CONG_ADVANCED is not set 402# CONFIG_TCP_CONG_ADVANCED is not set
@@ -421,10 +423,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
421# CONFIG_LAPB is not set 423# CONFIG_LAPB is not set
422# CONFIG_ECONET is not set 424# CONFIG_ECONET is not set
423# CONFIG_WAN_ROUTER is not set 425# CONFIG_WAN_ROUTER is not set
424
425#
426# QoS and/or fair queueing
427#
428# CONFIG_NET_SCHED is not set 426# CONFIG_NET_SCHED is not set
429 427
430# 428#
@@ -444,6 +442,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
444# CONFIG_MAC80211 is not set 442# CONFIG_MAC80211 is not set
445# CONFIG_IEEE80211 is not set 443# CONFIG_IEEE80211 is not set
446# CONFIG_RFKILL is not set 444# CONFIG_RFKILL is not set
445# CONFIG_NET_9P is not set
447 446
448# 447#
449# Device Drivers 448# Device Drivers
@@ -452,14 +451,11 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
452# 451#
453# Generic Driver Options 452# Generic Driver Options
454# 453#
454CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
455CONFIG_STANDALONE=y 455CONFIG_STANDALONE=y
456CONFIG_PREVENT_FIRMWARE_BUILD=y 456CONFIG_PREVENT_FIRMWARE_BUILD=y
457# CONFIG_FW_LOADER is not set 457# CONFIG_FW_LOADER is not set
458# CONFIG_SYS_HYPERVISOR is not set 458# CONFIG_SYS_HYPERVISOR is not set
459
460#
461# Connector - unified userspace <-> kernelspace linker
462#
463# CONFIG_CONNECTOR is not set 459# CONFIG_CONNECTOR is not set
464CONFIG_MTD=y 460CONFIG_MTD=y
465# CONFIG_MTD_DEBUG is not set 461# CONFIG_MTD_DEBUG is not set
@@ -479,6 +475,7 @@ CONFIG_MTD_BLOCK=y
479# CONFIG_INFTL is not set 475# CONFIG_INFTL is not set
480# CONFIG_RFD_FTL is not set 476# CONFIG_RFD_FTL is not set
481# CONFIG_SSFDC is not set 477# CONFIG_SSFDC is not set
478# CONFIG_MTD_OOPS is not set
482 479
483# 480#
484# RAM/ROM/Flash chip drivers 481# RAM/ROM/Flash chip drivers
@@ -542,39 +539,27 @@ CONFIG_MTD_NAND_IDS=m
542# CONFIG_MTD_NAND_DISKONCHIP is not set 539# CONFIG_MTD_NAND_DISKONCHIP is not set
543# CONFIG_MTD_NAND_NANDSIM is not set 540# CONFIG_MTD_NAND_NANDSIM is not set
544# CONFIG_MTD_NAND_PLATFORM is not set 541# CONFIG_MTD_NAND_PLATFORM is not set
542# CONFIG_MTD_ALAUDA is not set
545# CONFIG_MTD_ONENAND is not set 543# CONFIG_MTD_ONENAND is not set
546 544
547# 545#
548# UBI - Unsorted block images 546# UBI - Unsorted block images
549# 547#
550# CONFIG_MTD_UBI is not set 548# CONFIG_MTD_UBI is not set
551
552#
553# Parallel port support
554#
555# CONFIG_PARPORT is not set 549# CONFIG_PARPORT is not set
556 550CONFIG_BLK_DEV=y
557#
558# Plug and Play support
559#
560# CONFIG_PNPACPI is not set
561
562#
563# Block devices
564#
565# CONFIG_BLK_DEV_COW_COMMON is not set 551# CONFIG_BLK_DEV_COW_COMMON is not set
566# CONFIG_BLK_DEV_LOOP is not set 552# CONFIG_BLK_DEV_LOOP is not set
567# CONFIG_BLK_DEV_NBD is not set 553# CONFIG_BLK_DEV_NBD is not set
554# CONFIG_BLK_DEV_UB is not set
568CONFIG_BLK_DEV_RAM=y 555CONFIG_BLK_DEV_RAM=y
569CONFIG_BLK_DEV_RAM_COUNT=16 556CONFIG_BLK_DEV_RAM_COUNT=16
570CONFIG_BLK_DEV_RAM_SIZE=4096 557CONFIG_BLK_DEV_RAM_SIZE=4096
571CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 558CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
572# CONFIG_CDROM_PKTCDVD is not set 559# CONFIG_CDROM_PKTCDVD is not set
573# CONFIG_ATA_OVER_ETH is not set 560# CONFIG_ATA_OVER_ETH is not set
574 561CONFIG_MISC_DEVICES=y
575# 562# CONFIG_EEPROM_93CX6 is not set
576# Misc devices
577#
578# CONFIG_IDE is not set 563# CONFIG_IDE is not set
579 564
580# 565#
@@ -582,22 +567,18 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
582# 567#
583# CONFIG_RAID_ATTRS is not set 568# CONFIG_RAID_ATTRS is not set
584# CONFIG_SCSI is not set 569# CONFIG_SCSI is not set
570# CONFIG_SCSI_DMA is not set
585# CONFIG_SCSI_NETLINK is not set 571# CONFIG_SCSI_NETLINK is not set
586# CONFIG_ATA is not set 572# CONFIG_ATA is not set
587
588#
589# Multi-device support (RAID and LVM)
590#
591# CONFIG_MD is not set 573# CONFIG_MD is not set
592
593#
594# Network device support
595#
596CONFIG_NETDEVICES=y 574CONFIG_NETDEVICES=y
575# CONFIG_NETDEVICES_MULTIQUEUE is not set
597# CONFIG_DUMMY is not set 576# CONFIG_DUMMY is not set
598# CONFIG_BONDING is not set 577# CONFIG_BONDING is not set
578# CONFIG_MACVLAN is not set
599# CONFIG_EQUALIZER is not set 579# CONFIG_EQUALIZER is not set
600# CONFIG_TUN is not set 580# CONFIG_TUN is not set
581# CONFIG_VETH is not set
601CONFIG_PHYLIB=y 582CONFIG_PHYLIB=y
602 583
603# 584#
@@ -611,21 +592,24 @@ CONFIG_PHYLIB=y
611# CONFIG_VITESSE_PHY is not set 592# CONFIG_VITESSE_PHY is not set
612# CONFIG_SMSC_PHY is not set 593# CONFIG_SMSC_PHY is not set
613# CONFIG_BROADCOM_PHY is not set 594# CONFIG_BROADCOM_PHY is not set
595# CONFIG_ICPLUS_PHY is not set
614# CONFIG_FIXED_PHY is not set 596# CONFIG_FIXED_PHY is not set
615 597# CONFIG_MDIO_BITBANG is not set
616#
617# Ethernet (10 or 100Mbit)
618#
619CONFIG_NET_ETHERNET=y 598CONFIG_NET_ETHERNET=y
620CONFIG_MII=y 599CONFIG_MII=y
621# CONFIG_SMC91X is not set
622CONFIG_BFIN_MAC=y 600CONFIG_BFIN_MAC=y
623CONFIG_BFIN_MAC_USE_L1=y 601CONFIG_BFIN_MAC_USE_L1=y
624CONFIG_BFIN_TX_DESC_NUM=10 602CONFIG_BFIN_TX_DESC_NUM=10
625CONFIG_BFIN_RX_DESC_NUM=20 603CONFIG_BFIN_RX_DESC_NUM=20
626CONFIG_BFIN_MAC_RMII=y 604CONFIG_BFIN_MAC_RMII=y
605# CONFIG_SMC91X is not set
627# CONFIG_SMSC911X is not set 606# CONFIG_SMSC911X is not set
628# CONFIG_DM9000 is not set 607# CONFIG_DM9000 is not set
608# CONFIG_IBM_NEW_EMAC_ZMII is not set
609# CONFIG_IBM_NEW_EMAC_RGMII is not set
610# CONFIG_IBM_NEW_EMAC_TAH is not set
611# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
612# CONFIG_B44 is not set
629CONFIG_NETDEV_1000=y 613CONFIG_NETDEV_1000=y
630# CONFIG_AX88180 is not set 614# CONFIG_AX88180 is not set
631CONFIG_NETDEV_10000=y 615CONFIG_NETDEV_10000=y
@@ -635,6 +619,15 @@ CONFIG_NETDEV_10000=y
635# 619#
636# CONFIG_WLAN_PRE80211 is not set 620# CONFIG_WLAN_PRE80211 is not set
637# CONFIG_WLAN_80211 is not set 621# CONFIG_WLAN_80211 is not set
622
623#
624# USB Network Adapters
625#
626# CONFIG_USB_CATC is not set
627# CONFIG_USB_KAWETH is not set
628# CONFIG_USB_PEGASUS is not set
629# CONFIG_USB_RTL8150 is not set
630# CONFIG_USB_USBNET is not set
638# CONFIG_WAN is not set 631# CONFIG_WAN is not set
639# CONFIG_PPP is not set 632# CONFIG_PPP is not set
640# CONFIG_SLIP is not set 633# CONFIG_SLIP is not set
@@ -642,15 +635,7 @@ CONFIG_NETDEV_10000=y
642# CONFIG_NETCONSOLE is not set 635# CONFIG_NETCONSOLE is not set
643# CONFIG_NETPOLL is not set 636# CONFIG_NETPOLL is not set
644# CONFIG_NET_POLL_CONTROLLER is not set 637# CONFIG_NET_POLL_CONTROLLER is not set
645
646#
647# ISDN subsystem
648#
649# CONFIG_ISDN is not set 638# CONFIG_ISDN is not set
650
651#
652# Telephony Support
653#
654# CONFIG_PHONE is not set 639# CONFIG_PHONE is not set
655 640
656# 641#
@@ -665,7 +650,6 @@ CONFIG_INPUT=y
665# 650#
666# CONFIG_INPUT_MOUSEDEV is not set 651# CONFIG_INPUT_MOUSEDEV is not set
667# CONFIG_INPUT_JOYDEV is not set 652# CONFIG_INPUT_JOYDEV is not set
668# CONFIG_INPUT_TSDEV is not set
669# CONFIG_INPUT_EVDEV is not set 653# CONFIG_INPUT_EVDEV is not set
670# CONFIG_INPUT_EVBUG is not set 654# CONFIG_INPUT_EVBUG is not set
671 655
@@ -697,7 +681,6 @@ CONFIG_INPUT_MISC=y
697# 681#
698# CONFIG_AD9960 is not set 682# CONFIG_AD9960 is not set
699# CONFIG_SPI_ADC_BF533 is not set 683# CONFIG_SPI_ADC_BF533 is not set
700# CONFIG_BF5xx_PFLAGS is not set
701# CONFIG_BF5xx_PPIFCD is not set 684# CONFIG_BF5xx_PPIFCD is not set
702# CONFIG_BFIN_SIMPLE_TIMER is not set 685# CONFIG_BFIN_SIMPLE_TIMER is not set
703# CONFIG_BF5xx_PPI is not set 686# CONFIG_BF5xx_PPI is not set
@@ -706,7 +689,7 @@ CONFIG_BFIN_OTP=y
706# CONFIG_BFIN_SPORT is not set 689# CONFIG_BFIN_SPORT is not set
707# CONFIG_BFIN_TIMER_LATENCY is not set 690# CONFIG_BFIN_TIMER_LATENCY is not set
708# CONFIG_TWI_LCD is not set 691# CONFIG_TWI_LCD is not set
709# CONFIG_AD5304 is not set 692# CONFIG_SIMPLE_GPIO is not set
710# CONFIG_VT is not set 693# CONFIG_VT is not set
711# CONFIG_SERIAL_NONSTANDARD is not set 694# CONFIG_SERIAL_NONSTANDARD is not set
712 695
@@ -735,27 +718,11 @@ CONFIG_UNIX98_PTYS=y
735# CAN, the car bus and industrial fieldbus 718# CAN, the car bus and industrial fieldbus
736# 719#
737# CONFIG_CAN4LINUX is not set 720# CONFIG_CAN4LINUX is not set
738
739#
740# IPMI
741#
742# CONFIG_IPMI_HANDLER is not set 721# CONFIG_IPMI_HANDLER is not set
743CONFIG_WATCHDOG=y
744# CONFIG_WATCHDOG_NOWAYOUT is not set
745
746#
747# Watchdog Device Drivers
748#
749# CONFIG_SOFT_WATCHDOG is not set
750CONFIG_BFIN_WDT=y
751CONFIG_HW_RANDOM=y 722CONFIG_HW_RANDOM=y
752# CONFIG_GEN_RTC is not set 723# CONFIG_GEN_RTC is not set
753# CONFIG_R3964 is not set 724# CONFIG_R3964 is not set
754# CONFIG_RAW_DRIVER is not set 725# CONFIG_RAW_DRIVER is not set
755
756#
757# TPM devices
758#
759# CONFIG_TCG_TPM is not set 726# CONFIG_TCG_TPM is not set
760CONFIG_I2C=y 727CONFIG_I2C=y
761CONFIG_I2C_BOARDINFO=y 728CONFIG_I2C_BOARDINFO=y
@@ -777,21 +744,24 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
777# CONFIG_I2C_OCORES is not set 744# CONFIG_I2C_OCORES is not set
778# CONFIG_I2C_PARPORT_LIGHT is not set 745# CONFIG_I2C_PARPORT_LIGHT is not set
779# CONFIG_I2C_SIMTEC is not set 746# CONFIG_I2C_SIMTEC is not set
747# CONFIG_I2C_TAOS_EVM is not set
780# CONFIG_I2C_STUB is not set 748# CONFIG_I2C_STUB is not set
749# CONFIG_I2C_TINY_USB is not set
781 750
782# 751#
783# Miscellaneous I2C Chip support 752# Miscellaneous I2C Chip support
784# 753#
785# CONFIG_SENSORS_DS1337 is not set 754# CONFIG_SENSORS_DS1337 is not set
786# CONFIG_SENSORS_DS1374 is not set 755# CONFIG_SENSORS_DS1374 is not set
756# CONFIG_DS1682 is not set
787# CONFIG_SENSORS_AD5252 is not set 757# CONFIG_SENSORS_AD5252 is not set
788# CONFIG_SENSORS_EEPROM is not set 758# CONFIG_SENSORS_EEPROM is not set
789# CONFIG_SENSORS_PCF8574 is not set 759# CONFIG_SENSORS_PCF8574 is not set
790# CONFIG_SENSORS_PCF8575 is not set 760# CONFIG_SENSORS_PCF8575 is not set
791# CONFIG_SENSORS_PCA9543 is not set
792# CONFIG_SENSORS_PCA9539 is not set 761# CONFIG_SENSORS_PCA9539 is not set
793# CONFIG_SENSORS_PCF8591 is not set 762# CONFIG_SENSORS_PCF8591 is not set
794# CONFIG_SENSORS_MAX6875 is not set 763# CONFIG_SENSORS_MAX6875 is not set
764# CONFIG_SENSORS_TSL2550 is not set
795# CONFIG_I2C_DEBUG_CORE is not set 765# CONFIG_I2C_DEBUG_CORE is not set
796# CONFIG_I2C_DEBUG_ALGO is not set 766# CONFIG_I2C_DEBUG_ALGO is not set
797# CONFIG_I2C_DEBUG_BUS is not set 767# CONFIG_I2C_DEBUG_BUS is not set
@@ -814,14 +784,11 @@ CONFIG_SPI_BFIN=y
814# 784#
815# CONFIG_SPI_AT25 is not set 785# CONFIG_SPI_AT25 is not set
816# CONFIG_SPI_SPIDEV is not set 786# CONFIG_SPI_SPIDEV is not set
817 787# CONFIG_SPI_TLE62X0 is not set
818#
819# Dallas's 1-wire bus
820#
821# CONFIG_W1 is not set 788# CONFIG_W1 is not set
789# CONFIG_POWER_SUPPLY is not set
822CONFIG_HWMON=y 790CONFIG_HWMON=y
823# CONFIG_HWMON_VID is not set 791# CONFIG_HWMON_VID is not set
824# CONFIG_SENSORS_ABITUGURU is not set
825# CONFIG_SENSORS_AD7418 is not set 792# CONFIG_SENSORS_AD7418 is not set
826# CONFIG_SENSORS_ADM1021 is not set 793# CONFIG_SENSORS_ADM1021 is not set
827# CONFIG_SENSORS_ADM1025 is not set 794# CONFIG_SENSORS_ADM1025 is not set
@@ -829,12 +796,12 @@ CONFIG_HWMON=y
829# CONFIG_SENSORS_ADM1029 is not set 796# CONFIG_SENSORS_ADM1029 is not set
830# CONFIG_SENSORS_ADM1031 is not set 797# CONFIG_SENSORS_ADM1031 is not set
831# CONFIG_SENSORS_ADM9240 is not set 798# CONFIG_SENSORS_ADM9240 is not set
832# CONFIG_SENSORS_ASB100 is not set 799# CONFIG_SENSORS_ADT7470 is not set
833# CONFIG_SENSORS_ATXP1 is not set 800# CONFIG_SENSORS_ATXP1 is not set
834# CONFIG_SENSORS_DS1621 is not set 801# CONFIG_SENSORS_DS1621 is not set
835# CONFIG_SENSORS_F71805F is not set 802# CONFIG_SENSORS_F71805F is not set
836# CONFIG_SENSORS_FSCHER is not set 803# CONFIG_SENSORS_F71882FG is not set
837# CONFIG_SENSORS_FSCPOS is not set 804# CONFIG_SENSORS_F75375S is not set
838# CONFIG_SENSORS_GL518SM is not set 805# CONFIG_SENSORS_GL518SM is not set
839# CONFIG_SENSORS_GL520SM is not set 806# CONFIG_SENSORS_GL520SM is not set
840# CONFIG_SENSORS_IT87 is not set 807# CONFIG_SENSORS_IT87 is not set
@@ -849,13 +816,16 @@ CONFIG_HWMON=y
849# CONFIG_SENSORS_LM87 is not set 816# CONFIG_SENSORS_LM87 is not set
850# CONFIG_SENSORS_LM90 is not set 817# CONFIG_SENSORS_LM90 is not set
851# CONFIG_SENSORS_LM92 is not set 818# CONFIG_SENSORS_LM92 is not set
819# CONFIG_SENSORS_LM93 is not set
852# CONFIG_SENSORS_MAX1619 is not set 820# CONFIG_SENSORS_MAX1619 is not set
853# CONFIG_SENSORS_MAX6650 is not set 821# CONFIG_SENSORS_MAX6650 is not set
854# CONFIG_SENSORS_PC87360 is not set 822# CONFIG_SENSORS_PC87360 is not set
855# CONFIG_SENSORS_PC87427 is not set 823# CONFIG_SENSORS_PC87427 is not set
824# CONFIG_SENSORS_DME1737 is not set
856# CONFIG_SENSORS_SMSC47M1 is not set 825# CONFIG_SENSORS_SMSC47M1 is not set
857# CONFIG_SENSORS_SMSC47M192 is not set 826# CONFIG_SENSORS_SMSC47M192 is not set
858# CONFIG_SENSORS_SMSC47B397 is not set 827# CONFIG_SENSORS_SMSC47B397 is not set
828# CONFIG_SENSORS_THMC50 is not set
859# CONFIG_SENSORS_VT1211 is not set 829# CONFIG_SENSORS_VT1211 is not set
860# CONFIG_SENSORS_W83781D is not set 830# CONFIG_SENSORS_W83781D is not set
861# CONFIG_SENSORS_W83791D is not set 831# CONFIG_SENSORS_W83791D is not set
@@ -865,6 +835,25 @@ CONFIG_HWMON=y
865# CONFIG_SENSORS_W83627HF is not set 835# CONFIG_SENSORS_W83627HF is not set
866# CONFIG_SENSORS_W83627EHF is not set 836# CONFIG_SENSORS_W83627EHF is not set
867# CONFIG_HWMON_DEBUG_CHIP is not set 837# CONFIG_HWMON_DEBUG_CHIP is not set
838CONFIG_WATCHDOG=y
839# CONFIG_WATCHDOG_NOWAYOUT is not set
840
841#
842# Watchdog Device Drivers
843#
844# CONFIG_SOFT_WATCHDOG is not set
845CONFIG_BFIN_WDT=y
846
847#
848# USB-based Watchdog Cards
849#
850# CONFIG_USBPCWATCHDOG is not set
851
852#
853# Sonics Silicon Backplane
854#
855CONFIG_SSB_POSSIBLE=y
856# CONFIG_SSB is not set
868 857
869# 858#
870# Multifunction device drivers 859# Multifunction device drivers
@@ -881,72 +870,133 @@ CONFIG_HWMON=y
881# 870#
882# Graphics support 871# Graphics support
883# 872#
873# CONFIG_VGASTATE is not set
874# CONFIG_VIDEO_OUTPUT_CONTROL is not set
875# CONFIG_FB is not set
884# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 876# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
885 877
886# 878#
887# Display device support 879# Display device support
888# 880#
889# CONFIG_DISPLAY_SUPPORT is not set 881# CONFIG_DISPLAY_SUPPORT is not set
890# CONFIG_VGASTATE is not set
891# CONFIG_FB is not set
892 882
893# 883#
894# Sound 884# Sound
895# 885#
896# CONFIG_SOUND is not set 886# CONFIG_SOUND is not set
897 887CONFIG_HID_SUPPORT=y
898#
899# HID Devices
900#
901CONFIG_HID=y 888CONFIG_HID=y
902# CONFIG_HID_DEBUG is not set 889# CONFIG_HID_DEBUG is not set
890# CONFIG_HIDRAW is not set
903 891
904# 892#
905# USB support 893# USB Input Devices
906# 894#
895CONFIG_USB_HID=y
896# CONFIG_USB_HIDINPUT_POWERBOOK is not set
897# CONFIG_HID_FF is not set
898# CONFIG_USB_HIDDEV is not set
899CONFIG_USB_SUPPORT=y
907CONFIG_USB_ARCH_HAS_HCD=y 900CONFIG_USB_ARCH_HAS_HCD=y
908# CONFIG_USB_ARCH_HAS_OHCI is not set 901# CONFIG_USB_ARCH_HAS_OHCI is not set
909# CONFIG_USB_ARCH_HAS_EHCI is not set 902# CONFIG_USB_ARCH_HAS_EHCI is not set
910# CONFIG_USB is not set 903CONFIG_USB=y
904# CONFIG_USB_DEBUG is not set
905
906#
907# Miscellaneous USB options
908#
909# CONFIG_USB_DEVICEFS is not set
910CONFIG_USB_DEVICE_CLASS=y
911# CONFIG_USB_DYNAMIC_MINORS is not set
912# CONFIG_USB_OTG is not set
913# CONFIG_USB_OTG_WHITELIST is not set
914CONFIG_USB_OTG_BLACKLIST_HUB=y
915
916#
917# USB Host Controller Drivers
918#
919# CONFIG_USB_ISP116X_HCD is not set
920# CONFIG_USB_ISP1362_HCD is not set
921# CONFIG_USB_ISP1760_HCD is not set
922# CONFIG_USB_SL811_HCD is not set
923# CONFIG_USB_R8A66597_HCD is not set
924CONFIG_USB_MUSB_HDRC=y
925CONFIG_USB_MUSB_SOC=y
911 926
912# 927#
913# Enable Host or Gadget support to see Inventra options 928# Blackfin high speed USB support
914# 929#
930CONFIG_USB_MUSB_HOST=y
931# CONFIG_USB_MUSB_PERIPHERAL is not set
932# CONFIG_USB_MUSB_OTG is not set
933CONFIG_USB_MUSB_HDRC_HCD=y
934CONFIG_MUSB_PIO_ONLY=y
935CONFIG_USB_MUSB_LOGLEVEL=0
936
937#
938# USB Device Class drivers
939#
940# CONFIG_USB_ACM is not set
941# CONFIG_USB_PRINTER is not set
915 942
916# 943#
917# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 944# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
918# 945#
919 946
920# 947#
921# USB Gadget Support 948# may also be needed; see USB_STORAGE Help for more information
922# 949#
923# CONFIG_USB_GADGET is not set 950# CONFIG_USB_LIBUSUAL is not set
924# CONFIG_MMC is not set
925 951
926# 952#
927# LED devices 953# USB Imaging devices
928# 954#
929# CONFIG_NEW_LEDS is not set 955# CONFIG_USB_MDC800 is not set
956CONFIG_USB_MON=y
930 957
931# 958#
932# LED drivers 959# USB port drivers
933# 960#
934 961
935# 962#
936# LED Triggers 963# USB Serial Converter support
937# 964#
965# CONFIG_USB_SERIAL is not set
938 966
939# 967#
940# InfiniBand support 968# USB Miscellaneous drivers
941# 969#
970# CONFIG_USB_EMI62 is not set
971# CONFIG_USB_EMI26 is not set
972# CONFIG_USB_ADUTUX is not set
973# CONFIG_USB_AUERSWALD is not set
974# CONFIG_USB_RIO500 is not set
975# CONFIG_USB_LEGOTOWER is not set
976# CONFIG_USB_LCD is not set
977# CONFIG_USB_BERRY_CHARGE is not set
978# CONFIG_USB_LED is not set
979# CONFIG_USB_CYPRESS_CY7C63 is not set
980# CONFIG_USB_CYTHERM is not set
981# CONFIG_USB_PHIDGET is not set
982# CONFIG_USB_IDMOUSE is not set
983# CONFIG_USB_FTDI_ELAN is not set
984# CONFIG_USB_APPLEDISPLAY is not set
985# CONFIG_USB_SISUSBVGA is not set
986# CONFIG_USB_LD is not set
987# CONFIG_USB_TRANCEVIBRATOR is not set
988# CONFIG_USB_IOWARRIOR is not set
942 989
943# 990#
944# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 991# USB DSL modem support
945# 992#
946 993
947# 994#
948# Real Time Clock 995# USB Gadget Support
949# 996#
997# CONFIG_USB_GADGET is not set
998# CONFIG_MMC is not set
999# CONFIG_NEW_LEDS is not set
950CONFIG_RTC_LIB=y 1000CONFIG_RTC_LIB=y
951CONFIG_RTC_CLASS=y 1001CONFIG_RTC_CLASS=y
952CONFIG_RTC_HCTOSYS=y 1002CONFIG_RTC_HCTOSYS=y
@@ -966,6 +1016,7 @@ CONFIG_RTC_INTF_DEV=y
966# I2C RTC drivers 1016# I2C RTC drivers
967# 1017#
968# CONFIG_RTC_DRV_DS1307 is not set 1018# CONFIG_RTC_DRV_DS1307 is not set
1019# CONFIG_RTC_DRV_DS1374 is not set
969# CONFIG_RTC_DRV_DS1672 is not set 1020# CONFIG_RTC_DRV_DS1672 is not set
970# CONFIG_RTC_DRV_MAX6900 is not set 1021# CONFIG_RTC_DRV_MAX6900 is not set
971# CONFIG_RTC_DRV_RS5C372 is not set 1022# CONFIG_RTC_DRV_RS5C372 is not set
@@ -973,6 +1024,7 @@ CONFIG_RTC_INTF_DEV=y
973# CONFIG_RTC_DRV_X1205 is not set 1024# CONFIG_RTC_DRV_X1205 is not set
974# CONFIG_RTC_DRV_PCF8563 is not set 1025# CONFIG_RTC_DRV_PCF8563 is not set
975# CONFIG_RTC_DRV_PCF8583 is not set 1026# CONFIG_RTC_DRV_PCF8583 is not set
1027# CONFIG_RTC_DRV_M41T80 is not set
976 1028
977# 1029#
978# SPI RTC drivers 1030# SPI RTC drivers
@@ -984,8 +1036,10 @@ CONFIG_RTC_INTF_DEV=y
984# Platform RTC drivers 1036# Platform RTC drivers
985# 1037#
986# CONFIG_RTC_DRV_DS1553 is not set 1038# CONFIG_RTC_DRV_DS1553 is not set
1039# CONFIG_RTC_DRV_STK17TA8 is not set
987# CONFIG_RTC_DRV_DS1742 is not set 1040# CONFIG_RTC_DRV_DS1742 is not set
988# CONFIG_RTC_DRV_M48T86 is not set 1041# CONFIG_RTC_DRV_M48T86 is not set
1042# CONFIG_RTC_DRV_M48T59 is not set
989# CONFIG_RTC_DRV_V3020 is not set 1043# CONFIG_RTC_DRV_V3020 is not set
990 1044
991# 1045#
@@ -994,22 +1048,9 @@ CONFIG_RTC_INTF_DEV=y
994CONFIG_RTC_DRV_BFIN=y 1048CONFIG_RTC_DRV_BFIN=y
995 1049
996# 1050#
997# DMA Engine support 1051# Userspace I/O
998#
999# CONFIG_DMA_ENGINE is not set
1000
1001#
1002# DMA Clients
1003# 1052#
1004 1053# CONFIG_UIO is not set
1005#
1006# DMA Devices
1007#
1008
1009#
1010# PBX support
1011#
1012# CONFIG_PBX is not set
1013 1054
1014# 1055#
1015# File systems 1056# File systems
@@ -1054,7 +1095,6 @@ CONFIG_PROC_SYSCTL=y
1054CONFIG_SYSFS=y 1095CONFIG_SYSFS=y
1055# CONFIG_TMPFS is not set 1096# CONFIG_TMPFS is not set
1056# CONFIG_HUGETLB_PAGE is not set 1097# CONFIG_HUGETLB_PAGE is not set
1057CONFIG_RAMFS=y
1058# CONFIG_CONFIGFS_FS is not set 1098# CONFIG_CONFIGFS_FS is not set
1059 1099
1060# 1100#
@@ -1080,10 +1120,12 @@ CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1080CONFIG_JFFS2_FS=m 1120CONFIG_JFFS2_FS=m
1081CONFIG_JFFS2_FS_DEBUG=0 1121CONFIG_JFFS2_FS_DEBUG=0
1082CONFIG_JFFS2_FS_WRITEBUFFER=y 1122CONFIG_JFFS2_FS_WRITEBUFFER=y
1123# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1083# CONFIG_JFFS2_SUMMARY is not set 1124# CONFIG_JFFS2_SUMMARY is not set
1084# CONFIG_JFFS2_FS_XATTR is not set 1125# CONFIG_JFFS2_FS_XATTR is not set
1085# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1126# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1086CONFIG_JFFS2_ZLIB=y 1127CONFIG_JFFS2_ZLIB=y
1128# CONFIG_JFFS2_LZO is not set
1087CONFIG_JFFS2_RTIME=y 1129CONFIG_JFFS2_RTIME=y
1088# CONFIG_JFFS2_RUBIN is not set 1130# CONFIG_JFFS2_RUBIN is not set
1089# CONFIG_CRAMFS is not set 1131# CONFIG_CRAMFS is not set
@@ -1092,10 +1134,7 @@ CONFIG_JFFS2_RTIME=y
1092# CONFIG_QNX4FS_FS is not set 1134# CONFIG_QNX4FS_FS is not set
1093# CONFIG_SYSV_FS is not set 1135# CONFIG_SYSV_FS is not set
1094# CONFIG_UFS_FS is not set 1136# CONFIG_UFS_FS is not set
1095 1137CONFIG_NETWORK_FILESYSTEMS=y
1096#
1097# Network File Systems
1098#
1099CONFIG_NFS_FS=m 1138CONFIG_NFS_FS=m
1100CONFIG_NFS_V3=y 1139CONFIG_NFS_V3=y
1101# CONFIG_NFS_V3_ACL is not set 1140# CONFIG_NFS_V3_ACL is not set
@@ -1115,17 +1154,12 @@ CONFIG_SMB_FS=m
1115# CONFIG_NCP_FS is not set 1154# CONFIG_NCP_FS is not set
1116# CONFIG_CODA_FS is not set 1155# CONFIG_CODA_FS is not set
1117# CONFIG_AFS_FS is not set 1156# CONFIG_AFS_FS is not set
1118# CONFIG_9P_FS is not set
1119 1157
1120# 1158#
1121# Partition Types 1159# Partition Types
1122# 1160#
1123# CONFIG_PARTITION_ADVANCED is not set 1161# CONFIG_PARTITION_ADVANCED is not set
1124CONFIG_MSDOS_PARTITION=y 1162CONFIG_MSDOS_PARTITION=y
1125
1126#
1127# Native Language Support
1128#
1129CONFIG_NLS=m 1163CONFIG_NLS=m
1130CONFIG_NLS_DEFAULT="iso8859-1" 1164CONFIG_NLS_DEFAULT="iso8859-1"
1131# CONFIG_NLS_CODEPAGE_437 is not set 1165# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1166,21 +1200,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1166# CONFIG_NLS_KOI8_R is not set 1200# CONFIG_NLS_KOI8_R is not set
1167# CONFIG_NLS_KOI8_U is not set 1201# CONFIG_NLS_KOI8_U is not set
1168# CONFIG_NLS_UTF8 is not set 1202# CONFIG_NLS_UTF8 is not set
1169
1170#
1171# Distributed Lock Manager
1172#
1173# CONFIG_DLM is not set 1203# CONFIG_DLM is not set
1174 1204CONFIG_INSTRUMENTATION=y
1175#
1176# Profiling support
1177#
1178# CONFIG_PROFILING is not set 1205# CONFIG_PROFILING is not set
1206# CONFIG_MARKERS is not set
1179 1207
1180# 1208#
1181# Kernel hacking 1209# Kernel hacking
1182# 1210#
1183# CONFIG_PRINTK_TIME is not set 1211# CONFIG_PRINTK_TIME is not set
1212CONFIG_ENABLE_WARN_DEPRECATED=y
1184CONFIG_ENABLE_MUST_CHECK=y 1213CONFIG_ENABLE_MUST_CHECK=y
1185# CONFIG_MAGIC_SYSRQ is not set 1214# CONFIG_MAGIC_SYSRQ is not set
1186# CONFIG_UNUSED_SYMBOLS is not set 1215# CONFIG_UNUSED_SYMBOLS is not set
@@ -1188,6 +1217,7 @@ CONFIG_DEBUG_FS=y
1188# CONFIG_HEADERS_CHECK is not set 1217# CONFIG_HEADERS_CHECK is not set
1189# CONFIG_DEBUG_KERNEL is not set 1218# CONFIG_DEBUG_KERNEL is not set
1190# CONFIG_DEBUG_BUGVERBOSE is not set 1219# CONFIG_DEBUG_BUGVERBOSE is not set
1220# CONFIG_SAMPLES is not set
1191CONFIG_DEBUG_MMRS=y 1221CONFIG_DEBUG_MMRS=y
1192CONFIG_DEBUG_HUNT_FOR_ZERO=y 1222CONFIG_DEBUG_HUNT_FOR_ZERO=y
1193CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1223CONFIG_DEBUG_BFIN_HWTRACE_ON=y
@@ -1207,11 +1237,8 @@ CONFIG_ACCESS_CHECK=y
1207# CONFIG_KEYS is not set 1237# CONFIG_KEYS is not set
1208CONFIG_SECURITY=y 1238CONFIG_SECURITY=y
1209# CONFIG_SECURITY_NETWORK is not set 1239# CONFIG_SECURITY_NETWORK is not set
1210CONFIG_SECURITY_CAPABILITIES=m 1240# CONFIG_SECURITY_CAPABILITIES is not set
1211 1241# CONFIG_SECURITY_ROOTPLUG is not set
1212#
1213# Cryptographic options
1214#
1215# CONFIG_CRYPTO is not set 1242# CONFIG_CRYPTO is not set
1216 1243
1217# 1244#
@@ -1222,6 +1249,7 @@ CONFIG_CRC_CCITT=m
1222# CONFIG_CRC16 is not set 1249# CONFIG_CRC16 is not set
1223# CONFIG_CRC_ITU_T is not set 1250# CONFIG_CRC_ITU_T is not set
1224CONFIG_CRC32=y 1251CONFIG_CRC32=y
1252# CONFIG_CRC7 is not set
1225# CONFIG_LIBCRC32C is not set 1253# CONFIG_LIBCRC32C is not set
1226CONFIG_ZLIB_INFLATE=y 1254CONFIG_ZLIB_INFLATE=y
1227CONFIG_ZLIB_DEFLATE=m 1255CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 5bfdfb287d13..1ff2ff4b49aa 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.16 3# Linux kernel version: 2.6.24.7
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -13,35 +13,34 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 16CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 17CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 20
22# 21#
23# Code maturity level options 22# General setup
24# 23#
25CONFIG_EXPERIMENTAL=y 24CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 25CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 26CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 27CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 28CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 29CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 30CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 33# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 37CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 38CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 39CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y
42CONFIG_FAIR_USER_SCHED=y
43# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
@@ -64,32 +63,24 @@ CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 63CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
68# CONFIG_NP2 is not set
69CONFIG_SLAB=y 66CONFIG_SLAB=y
70# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set 68# CONFIG_SLOB is not set
69CONFIG_SLABINFO=y
72CONFIG_RT_MUTEXES=y 70CONFIG_RT_MUTEXES=y
73CONFIG_TINY_SHMEM=y 71CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=0 72CONFIG_BASE_SMALL=0
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y 73CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y 74CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set 75# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set 76# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set 77# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y 78CONFIG_KMOD=y
85
86#
87# Block layer
88#
89CONFIG_BLOCK=y 79CONFIG_BLOCK=y
90# CONFIG_LBD is not set 80# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 81# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set 82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
93 84
94# 85#
95# IO Schedulers 86# IO Schedulers
@@ -141,7 +132,6 @@ CONFIG_BF_REV_0_0=y
141# CONFIG_BF_REV_ANY is not set 132# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 133# CONFIG_BF_REV_NONE is not set
143CONFIG_BF54x=y 134CONFIG_BF54x=y
144CONFIG_BFIN_SINGLE_CORE=y
145CONFIG_IRQ_PLL_WAKEUP=7 135CONFIG_IRQ_PLL_WAKEUP=7
146CONFIG_IRQ_RTC=8 136CONFIG_IRQ_RTC=8
147CONFIG_IRQ_SPORT0_RX=9 137CONFIG_IRQ_SPORT0_RX=9
@@ -169,6 +159,7 @@ CONFIG_IRQ_TIMER8=11
169CONFIG_IRQ_TIMER9=11 159CONFIG_IRQ_TIMER9=11
170CONFIG_IRQ_TIMER10=11 160CONFIG_IRQ_TIMER10=11
171CONFIG_BFIN548_EZKIT=y 161CONFIG_BFIN548_EZKIT=y
162# CONFIG_BFIN548_BLUETECHNIX_CM is not set
172 163
173# 164#
174# BF548 Specific Configuration 165# BF548 Specific Configuration
@@ -262,12 +253,14 @@ CONFIG_PINT3_ASSIGN=0x02020303
262# Board customizations 253# Board customizations
263# 254#
264# CONFIG_CMDLINE_BOOL is not set 255# CONFIG_CMDLINE_BOOL is not set
256CONFIG_BOOT_LOAD=0x1000
265 257
266# 258#
267# Clock/PLL Setup 259# Clock/PLL Setup
268# 260#
269CONFIG_CLKIN_HZ=25000000 261CONFIG_CLKIN_HZ=25000000
270# CONFIG_BFIN_KERNEL_CLOCK is not set 262# CONFIG_BFIN_KERNEL_CLOCK is not set
263CONFIG_MAX_MEM_SIZE=512
271CONFIG_MAX_VCO_HZ=600000000 264CONFIG_MAX_VCO_HZ=600000000
272CONFIG_MIN_VCO_HZ=50000000 265CONFIG_MIN_VCO_HZ=50000000
273CONFIG_MAX_SCLK_HZ=133333333 266CONFIG_MAX_SCLK_HZ=133333333
@@ -281,14 +274,17 @@ CONFIG_HZ_250=y
281# CONFIG_HZ_300 is not set 274# CONFIG_HZ_300 is not set
282# CONFIG_HZ_1000 is not set 275# CONFIG_HZ_1000 is not set
283CONFIG_HZ=250 276CONFIG_HZ=250
277CONFIG_GENERIC_TIME=y
278CONFIG_GENERIC_CLOCKEVENTS=y
279# CONFIG_CYCLES_CLOCKSOURCE is not set
280# CONFIG_TICK_ONESHOT is not set
281# CONFIG_NO_HZ is not set
282# CONFIG_HIGH_RES_TIMERS is not set
283CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
284 284
285# 285#
286# Memory Setup 286# Misc
287# 287#
288CONFIG_MAX_MEM_SIZE=512
289# CONFIG_MEM_MT46V32M16_6T is not set
290CONFIG_MEM_MT46V32M16_5B=y
291CONFIG_BOOT_LOAD=0x1000
292CONFIG_BFIN_SCRATCH_REG_RETN=y 288CONFIG_BFIN_SCRATCH_REG_RETN=y
293# CONFIG_BFIN_SCRATCH_REG_RETE is not set 289# CONFIG_BFIN_SCRATCH_REG_RETE is not set
294# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 290# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -324,12 +320,14 @@ CONFIG_FLATMEM_MANUAL=y
324CONFIG_FLATMEM=y 320CONFIG_FLATMEM=y
325CONFIG_FLAT_NODE_MEM_MAP=y 321CONFIG_FLAT_NODE_MEM_MAP=y
326# CONFIG_SPARSEMEM_STATIC is not set 322# CONFIG_SPARSEMEM_STATIC is not set
323# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
327CONFIG_SPLIT_PTLOCK_CPUS=4 324CONFIG_SPLIT_PTLOCK_CPUS=4
328# CONFIG_RESOURCES_64BIT is not set 325# CONFIG_RESOURCES_64BIT is not set
329CONFIG_ZONE_DMA_FLAG=1 326CONFIG_ZONE_DMA_FLAG=1
330CONFIG_LARGE_ALLOCS=y 327CONFIG_VIRT_TO_BUS=y
331# CONFIG_BFIN_GPTIMERS is not set 328# CONFIG_BFIN_GPTIMERS is not set
332CONFIG_BFIN_DMA_5XX=y 329CONFIG_BFIN_DMA_5XX=y
330# CONFIG_DMA_UNCACHED_4M is not set
333CONFIG_DMA_UNCACHED_2M=y 331CONFIG_DMA_UNCACHED_2M=y
334# CONFIG_DMA_UNCACHED_1M is not set 332# CONFIG_DMA_UNCACHED_1M is not set
335# CONFIG_DMA_UNCACHED_NONE is not set 333# CONFIG_DMA_UNCACHED_NONE is not set
@@ -377,10 +375,6 @@ CONFIG_EBIU_FCTLVAL=0x6
377# 375#
378# CONFIG_PCI is not set 376# CONFIG_PCI is not set
379# CONFIG_ARCH_SUPPORTS_MSI is not set 377# CONFIG_ARCH_SUPPORTS_MSI is not set
380
381#
382# PCCARD (PCMCIA/CardBus) support
383#
384# CONFIG_PCCARD is not set 378# CONFIG_PCCARD is not set
385 379
386# 380#
@@ -396,6 +390,7 @@ CONFIG_BINFMT_ZFLAT=y
396# Power management options 390# Power management options
397# 391#
398# CONFIG_PM is not set 392# CONFIG_PM is not set
393CONFIG_SUSPEND_UP_POSSIBLE=y
399# CONFIG_PM_WAKEUP_BY_GPIO is not set 394# CONFIG_PM_WAKEUP_BY_GPIO is not set
400 395
401# 396#
@@ -439,6 +434,7 @@ CONFIG_SYN_COOKIES=y
439CONFIG_INET_XFRM_MODE_TRANSPORT=y 434CONFIG_INET_XFRM_MODE_TRANSPORT=y
440CONFIG_INET_XFRM_MODE_TUNNEL=y 435CONFIG_INET_XFRM_MODE_TUNNEL=y
441CONFIG_INET_XFRM_MODE_BEET=y 436CONFIG_INET_XFRM_MODE_BEET=y
437# CONFIG_INET_LRO is not set
442CONFIG_INET_DIAG=y 438CONFIG_INET_DIAG=y
443CONFIG_INET_TCP_DIAG=y 439CONFIG_INET_TCP_DIAG=y
444# CONFIG_TCP_CONG_ADVANCED is not set 440# CONFIG_TCP_CONG_ADVANCED is not set
@@ -465,10 +461,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
465# CONFIG_LAPB is not set 461# CONFIG_LAPB is not set
466# CONFIG_ECONET is not set 462# CONFIG_ECONET is not set
467# CONFIG_WAN_ROUTER is not set 463# CONFIG_WAN_ROUTER is not set
468
469#
470# QoS and/or fair queueing
471#
472# CONFIG_NET_SCHED is not set 464# CONFIG_NET_SCHED is not set
473 465
474# 466#
@@ -488,6 +480,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
488# CONFIG_MAC80211 is not set 480# CONFIG_MAC80211 is not set
489# CONFIG_IEEE80211 is not set 481# CONFIG_IEEE80211 is not set
490# CONFIG_RFKILL is not set 482# CONFIG_RFKILL is not set
483# CONFIG_NET_9P is not set
491 484
492# 485#
493# Device Drivers 486# Device Drivers
@@ -496,14 +489,11 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
496# 489#
497# Generic Driver Options 490# Generic Driver Options
498# 491#
492CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
499CONFIG_STANDALONE=y 493CONFIG_STANDALONE=y
500CONFIG_PREVENT_FIRMWARE_BUILD=y 494CONFIG_PREVENT_FIRMWARE_BUILD=y
501# CONFIG_FW_LOADER is not set 495# CONFIG_FW_LOADER is not set
502# CONFIG_SYS_HYPERVISOR is not set 496# CONFIG_SYS_HYPERVISOR is not set
503
504#
505# Connector - unified userspace <-> kernelspace linker
506#
507# CONFIG_CONNECTOR is not set 497# CONFIG_CONNECTOR is not set
508CONFIG_MTD=y 498CONFIG_MTD=y
509# CONFIG_MTD_DEBUG is not set 499# CONFIG_MTD_DEBUG is not set
@@ -523,6 +513,7 @@ CONFIG_MTD_BLOCK=y
523# CONFIG_INFTL is not set 513# CONFIG_INFTL is not set
524# CONFIG_RFD_FTL is not set 514# CONFIG_RFD_FTL is not set
525# CONFIG_SSFDC is not set 515# CONFIG_SSFDC is not set
516# CONFIG_MTD_OOPS is not set
526 517
527# 518#
528# RAM/ROM/Flash chip drivers 519# RAM/ROM/Flash chip drivers
@@ -587,39 +578,27 @@ CONFIG_MTD_NAND_BF5XX_HWECC=y
587# CONFIG_MTD_NAND_DISKONCHIP is not set 578# CONFIG_MTD_NAND_DISKONCHIP is not set
588# CONFIG_MTD_NAND_NANDSIM is not set 579# CONFIG_MTD_NAND_NANDSIM is not set
589# CONFIG_MTD_NAND_PLATFORM is not set 580# CONFIG_MTD_NAND_PLATFORM is not set
581# CONFIG_MTD_ALAUDA is not set
590# CONFIG_MTD_ONENAND is not set 582# CONFIG_MTD_ONENAND is not set
591 583
592# 584#
593# UBI - Unsorted block images 585# UBI - Unsorted block images
594# 586#
595# CONFIG_MTD_UBI is not set 587# CONFIG_MTD_UBI is not set
596
597#
598# Parallel port support
599#
600# CONFIG_PARPORT is not set 588# CONFIG_PARPORT is not set
601 589CONFIG_BLK_DEV=y
602#
603# Plug and Play support
604#
605# CONFIG_PNPACPI is not set
606
607#
608# Block devices
609#
610# CONFIG_BLK_DEV_COW_COMMON is not set 590# CONFIG_BLK_DEV_COW_COMMON is not set
611# CONFIG_BLK_DEV_LOOP is not set 591# CONFIG_BLK_DEV_LOOP is not set
612# CONFIG_BLK_DEV_NBD is not set 592# CONFIG_BLK_DEV_NBD is not set
593# CONFIG_BLK_DEV_UB is not set
613CONFIG_BLK_DEV_RAM=y 594CONFIG_BLK_DEV_RAM=y
614CONFIG_BLK_DEV_RAM_COUNT=16 595CONFIG_BLK_DEV_RAM_COUNT=16
615CONFIG_BLK_DEV_RAM_SIZE=4096 596CONFIG_BLK_DEV_RAM_SIZE=4096
616CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 597CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
617# CONFIG_CDROM_PKTCDVD is not set 598# CONFIG_CDROM_PKTCDVD is not set
618# CONFIG_ATA_OVER_ETH is not set 599# CONFIG_ATA_OVER_ETH is not set
619 600CONFIG_MISC_DEVICES=y
620# 601# CONFIG_EEPROM_93CX6 is not set
621# Misc devices
622#
623# CONFIG_IDE is not set 602# CONFIG_IDE is not set
624 603
625# 604#
@@ -627,6 +606,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
627# 606#
628# CONFIG_RAID_ATTRS is not set 607# CONFIG_RAID_ATTRS is not set
629CONFIG_SCSI=y 608CONFIG_SCSI=y
609CONFIG_SCSI_DMA=y
630# CONFIG_SCSI_TGT is not set 610# CONFIG_SCSI_TGT is not set
631# CONFIG_SCSI_NETLINK is not set 611# CONFIG_SCSI_NETLINK is not set
632CONFIG_SCSI_PROC_FS=y 612CONFIG_SCSI_PROC_FS=y
@@ -657,43 +637,35 @@ CONFIG_SCSI_WAIT_SCAN=m
657# CONFIG_SCSI_SPI_ATTRS is not set 637# CONFIG_SCSI_SPI_ATTRS is not set
658# CONFIG_SCSI_FC_ATTRS is not set 638# CONFIG_SCSI_FC_ATTRS is not set
659# CONFIG_SCSI_ISCSI_ATTRS is not set 639# CONFIG_SCSI_ISCSI_ATTRS is not set
660# CONFIG_SCSI_SAS_ATTRS is not set
661# CONFIG_SCSI_SAS_LIBSAS is not set 640# CONFIG_SCSI_SAS_LIBSAS is not set
662 641# CONFIG_SCSI_SRP_ATTRS is not set
663# 642CONFIG_SCSI_LOWLEVEL=y
664# SCSI low-level drivers
665#
666# CONFIG_ISCSI_TCP is not set 643# CONFIG_ISCSI_TCP is not set
667# CONFIG_SCSI_DEBUG is not set 644# CONFIG_SCSI_DEBUG is not set
668CONFIG_ATA=y 645CONFIG_ATA=y
669# CONFIG_ATA_NONSTANDARD is not set 646# CONFIG_ATA_NONSTANDARD is not set
670# CONFIG_PATA_PLATFORM is not set 647# CONFIG_PATA_PLATFORM is not set
671CONFIG_PATA_BF54X=y 648CONFIG_PATA_BF54X=y
672CONFIG_PATA_BF54X_DMA=y
673
674#
675# Multi-device support (RAID and LVM)
676#
677# CONFIG_MD is not set 649# CONFIG_MD is not set
678
679#
680# Network device support
681#
682CONFIG_NETDEVICES=y 650CONFIG_NETDEVICES=y
651# CONFIG_NETDEVICES_MULTIQUEUE is not set
683# CONFIG_DUMMY is not set 652# CONFIG_DUMMY is not set
684# CONFIG_BONDING is not set 653# CONFIG_BONDING is not set
654# CONFIG_MACVLAN is not set
685# CONFIG_EQUALIZER is not set 655# CONFIG_EQUALIZER is not set
686# CONFIG_TUN is not set 656# CONFIG_TUN is not set
657# CONFIG_VETH is not set
687# CONFIG_PHYLIB is not set 658# CONFIG_PHYLIB is not set
688
689#
690# Ethernet (10 or 100Mbit)
691#
692CONFIG_NET_ETHERNET=y 659CONFIG_NET_ETHERNET=y
693CONFIG_MII=y 660CONFIG_MII=y
694# CONFIG_SMC91X is not set 661# CONFIG_SMC91X is not set
695CONFIG_SMSC911X=y 662CONFIG_SMSC911X=y
696# CONFIG_DM9000 is not set 663# CONFIG_DM9000 is not set
664# CONFIG_IBM_NEW_EMAC_ZMII is not set
665# CONFIG_IBM_NEW_EMAC_RGMII is not set
666# CONFIG_IBM_NEW_EMAC_TAH is not set
667# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
668# CONFIG_B44 is not set
697CONFIG_NETDEV_1000=y 669CONFIG_NETDEV_1000=y
698# CONFIG_AX88180 is not set 670# CONFIG_AX88180 is not set
699CONFIG_NETDEV_10000=y 671CONFIG_NETDEV_10000=y
@@ -703,6 +675,15 @@ CONFIG_NETDEV_10000=y
703# 675#
704# CONFIG_WLAN_PRE80211 is not set 676# CONFIG_WLAN_PRE80211 is not set
705# CONFIG_WLAN_80211 is not set 677# CONFIG_WLAN_80211 is not set
678
679#
680# USB Network Adapters
681#
682# CONFIG_USB_CATC is not set
683# CONFIG_USB_KAWETH is not set
684# CONFIG_USB_PEGASUS is not set
685# CONFIG_USB_RTL8150 is not set
686# CONFIG_USB_USBNET is not set
706# CONFIG_WAN is not set 687# CONFIG_WAN is not set
707# CONFIG_PPP is not set 688# CONFIG_PPP is not set
708# CONFIG_SLIP is not set 689# CONFIG_SLIP is not set
@@ -710,15 +691,7 @@ CONFIG_NETDEV_10000=y
710# CONFIG_NETCONSOLE is not set 691# CONFIG_NETCONSOLE is not set
711# CONFIG_NETPOLL is not set 692# CONFIG_NETPOLL is not set
712# CONFIG_NET_POLL_CONTROLLER is not set 693# CONFIG_NET_POLL_CONTROLLER is not set
713
714#
715# ISDN subsystem
716#
717# CONFIG_ISDN is not set 694# CONFIG_ISDN is not set
718
719#
720# Telephony Support
721#
722# CONFIG_PHONE is not set 695# CONFIG_PHONE is not set
723 696
724# 697#
@@ -733,9 +706,6 @@ CONFIG_INPUT=y
733# 706#
734# CONFIG_INPUT_MOUSEDEV is not set 707# CONFIG_INPUT_MOUSEDEV is not set
735# CONFIG_INPUT_JOYDEV is not set 708# CONFIG_INPUT_JOYDEV is not set
736CONFIG_INPUT_TSDEV=m
737CONFIG_INPUT_TSDEV_SCREEN_X=240
738CONFIG_INPUT_TSDEV_SCREEN_Y=320
739CONFIG_INPUT_EVDEV=m 709CONFIG_INPUT_EVDEV=m
740CONFIG_INPUT_EVBUG=m 710CONFIG_INPUT_EVBUG=m
741 711
@@ -758,6 +728,7 @@ CONFIG_KEYBOARD_BFIN=y
758CONFIG_INPUT_TOUCHSCREEN=y 728CONFIG_INPUT_TOUCHSCREEN=y
759# CONFIG_TOUCHSCREEN_ADS7846 is not set 729# CONFIG_TOUCHSCREEN_ADS7846 is not set
760CONFIG_TOUCHSCREEN_AD7877=m 730CONFIG_TOUCHSCREEN_AD7877=m
731# CONFIG_TOUCHSCREEN_FUJITSU is not set
761# CONFIG_TOUCHSCREEN_GUNZE is not set 732# CONFIG_TOUCHSCREEN_GUNZE is not set
762# CONFIG_TOUCHSCREEN_ELO is not set 733# CONFIG_TOUCHSCREEN_ELO is not set
763# CONFIG_TOUCHSCREEN_MTOUCH is not set 734# CONFIG_TOUCHSCREEN_MTOUCH is not set
@@ -787,7 +758,6 @@ CONFIG_INPUT_MISC=y
787# 758#
788# CONFIG_AD9960 is not set 759# CONFIG_AD9960 is not set
789# CONFIG_SPI_ADC_BF533 is not set 760# CONFIG_SPI_ADC_BF533 is not set
790# CONFIG_BF5xx_PFLAGS is not set
791# CONFIG_BF5xx_PPIFCD is not set 761# CONFIG_BF5xx_PPIFCD is not set
792# CONFIG_BFIN_SIMPLE_TIMER is not set 762# CONFIG_BFIN_SIMPLE_TIMER is not set
793# CONFIG_BF5xx_PPI is not set 763# CONFIG_BF5xx_PPI is not set
@@ -796,7 +766,7 @@ CONFIG_BFIN_OTP=y
796# CONFIG_BFIN_SPORT is not set 766# CONFIG_BFIN_SPORT is not set
797# CONFIG_BFIN_TIMER_LATENCY is not set 767# CONFIG_BFIN_TIMER_LATENCY is not set
798# CONFIG_TWI_LCD is not set 768# CONFIG_TWI_LCD is not set
799# CONFIG_AD5304 is not set 769# CONFIG_SIMPLE_GPIO is not set
800CONFIG_VT=y 770CONFIG_VT=y
801CONFIG_VT_CONSOLE=y 771CONFIG_VT_CONSOLE=y
802CONFIG_HW_CONSOLE=y 772CONFIG_HW_CONSOLE=y
@@ -830,27 +800,11 @@ CONFIG_UNIX98_PTYS=y
830# CAN, the car bus and industrial fieldbus 800# CAN, the car bus and industrial fieldbus
831# 801#
832# CONFIG_CAN4LINUX is not set 802# CONFIG_CAN4LINUX is not set
833
834#
835# IPMI
836#
837# CONFIG_IPMI_HANDLER is not set 803# CONFIG_IPMI_HANDLER is not set
838CONFIG_WATCHDOG=y
839# CONFIG_WATCHDOG_NOWAYOUT is not set
840
841#
842# Watchdog Device Drivers
843#
844# CONFIG_SOFT_WATCHDOG is not set
845CONFIG_BFIN_WDT=y
846CONFIG_HW_RANDOM=y 804CONFIG_HW_RANDOM=y
847# CONFIG_GEN_RTC is not set 805# CONFIG_GEN_RTC is not set
848# CONFIG_R3964 is not set 806# CONFIG_R3964 is not set
849# CONFIG_RAW_DRIVER is not set 807# CONFIG_RAW_DRIVER is not set
850
851#
852# TPM devices
853#
854# CONFIG_TCG_TPM is not set 808# CONFIG_TCG_TPM is not set
855CONFIG_I2C=y 809CONFIG_I2C=y
856CONFIG_I2C_BOARDINFO=y 810CONFIG_I2C_BOARDINFO=y
@@ -872,21 +826,24 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
872# CONFIG_I2C_OCORES is not set 826# CONFIG_I2C_OCORES is not set
873# CONFIG_I2C_PARPORT_LIGHT is not set 827# CONFIG_I2C_PARPORT_LIGHT is not set
874# CONFIG_I2C_SIMTEC is not set 828# CONFIG_I2C_SIMTEC is not set
829# CONFIG_I2C_TAOS_EVM is not set
875# CONFIG_I2C_STUB is not set 830# CONFIG_I2C_STUB is not set
831# CONFIG_I2C_TINY_USB is not set
876 832
877# 833#
878# Miscellaneous I2C Chip support 834# Miscellaneous I2C Chip support
879# 835#
880# CONFIG_SENSORS_DS1337 is not set 836# CONFIG_SENSORS_DS1337 is not set
881# CONFIG_SENSORS_DS1374 is not set 837# CONFIG_SENSORS_DS1374 is not set
838# CONFIG_DS1682 is not set
882# CONFIG_SENSORS_AD5252 is not set 839# CONFIG_SENSORS_AD5252 is not set
883# CONFIG_SENSORS_EEPROM is not set 840# CONFIG_SENSORS_EEPROM is not set
884# CONFIG_SENSORS_PCF8574 is not set 841# CONFIG_SENSORS_PCF8574 is not set
885# CONFIG_SENSORS_PCF8575 is not set 842# CONFIG_SENSORS_PCF8575 is not set
886# CONFIG_SENSORS_PCA9543 is not set
887# CONFIG_SENSORS_PCA9539 is not set 843# CONFIG_SENSORS_PCA9539 is not set
888# CONFIG_SENSORS_PCF8591 is not set 844# CONFIG_SENSORS_PCF8591 is not set
889# CONFIG_SENSORS_MAX6875 is not set 845# CONFIG_SENSORS_MAX6875 is not set
846# CONFIG_SENSORS_TSL2550 is not set
890# CONFIG_I2C_DEBUG_CORE is not set 847# CONFIG_I2C_DEBUG_CORE is not set
891# CONFIG_I2C_DEBUG_ALGO is not set 848# CONFIG_I2C_DEBUG_ALGO is not set
892# CONFIG_I2C_DEBUG_BUS is not set 849# CONFIG_I2C_DEBUG_BUS is not set
@@ -909,14 +866,11 @@ CONFIG_SPI_BFIN=y
909# 866#
910# CONFIG_SPI_AT25 is not set 867# CONFIG_SPI_AT25 is not set
911# CONFIG_SPI_SPIDEV is not set 868# CONFIG_SPI_SPIDEV is not set
912 869# CONFIG_SPI_TLE62X0 is not set
913#
914# Dallas's 1-wire bus
915#
916# CONFIG_W1 is not set 870# CONFIG_W1 is not set
871# CONFIG_POWER_SUPPLY is not set
917CONFIG_HWMON=y 872CONFIG_HWMON=y
918# CONFIG_HWMON_VID is not set 873# CONFIG_HWMON_VID is not set
919# CONFIG_SENSORS_ABITUGURU is not set
920# CONFIG_SENSORS_AD7418 is not set 874# CONFIG_SENSORS_AD7418 is not set
921# CONFIG_SENSORS_ADM1021 is not set 875# CONFIG_SENSORS_ADM1021 is not set
922# CONFIG_SENSORS_ADM1025 is not set 876# CONFIG_SENSORS_ADM1025 is not set
@@ -924,12 +878,12 @@ CONFIG_HWMON=y
924# CONFIG_SENSORS_ADM1029 is not set 878# CONFIG_SENSORS_ADM1029 is not set
925# CONFIG_SENSORS_ADM1031 is not set 879# CONFIG_SENSORS_ADM1031 is not set
926# CONFIG_SENSORS_ADM9240 is not set 880# CONFIG_SENSORS_ADM9240 is not set
927# CONFIG_SENSORS_ASB100 is not set 881# CONFIG_SENSORS_ADT7470 is not set
928# CONFIG_SENSORS_ATXP1 is not set 882# CONFIG_SENSORS_ATXP1 is not set
929# CONFIG_SENSORS_DS1621 is not set 883# CONFIG_SENSORS_DS1621 is not set
930# CONFIG_SENSORS_F71805F is not set 884# CONFIG_SENSORS_F71805F is not set
931# CONFIG_SENSORS_FSCHER is not set 885# CONFIG_SENSORS_F71882FG is not set
932# CONFIG_SENSORS_FSCPOS is not set 886# CONFIG_SENSORS_F75375S is not set
933# CONFIG_SENSORS_GL518SM is not set 887# CONFIG_SENSORS_GL518SM is not set
934# CONFIG_SENSORS_GL520SM is not set 888# CONFIG_SENSORS_GL520SM is not set
935# CONFIG_SENSORS_IT87 is not set 889# CONFIG_SENSORS_IT87 is not set
@@ -944,13 +898,16 @@ CONFIG_HWMON=y
944# CONFIG_SENSORS_LM87 is not set 898# CONFIG_SENSORS_LM87 is not set
945# CONFIG_SENSORS_LM90 is not set 899# CONFIG_SENSORS_LM90 is not set
946# CONFIG_SENSORS_LM92 is not set 900# CONFIG_SENSORS_LM92 is not set
901# CONFIG_SENSORS_LM93 is not set
947# CONFIG_SENSORS_MAX1619 is not set 902# CONFIG_SENSORS_MAX1619 is not set
948# CONFIG_SENSORS_MAX6650 is not set 903# CONFIG_SENSORS_MAX6650 is not set
949# CONFIG_SENSORS_PC87360 is not set 904# CONFIG_SENSORS_PC87360 is not set
950# CONFIG_SENSORS_PC87427 is not set 905# CONFIG_SENSORS_PC87427 is not set
906# CONFIG_SENSORS_DME1737 is not set
951# CONFIG_SENSORS_SMSC47M1 is not set 907# CONFIG_SENSORS_SMSC47M1 is not set
952# CONFIG_SENSORS_SMSC47M192 is not set 908# CONFIG_SENSORS_SMSC47M192 is not set
953# CONFIG_SENSORS_SMSC47B397 is not set 909# CONFIG_SENSORS_SMSC47B397 is not set
910# CONFIG_SENSORS_THMC50 is not set
954# CONFIG_SENSORS_VT1211 is not set 911# CONFIG_SENSORS_VT1211 is not set
955# CONFIG_SENSORS_W83781D is not set 912# CONFIG_SENSORS_W83781D is not set
956# CONFIG_SENSORS_W83791D is not set 913# CONFIG_SENSORS_W83791D is not set
@@ -960,6 +917,25 @@ CONFIG_HWMON=y
960# CONFIG_SENSORS_W83627HF is not set 917# CONFIG_SENSORS_W83627HF is not set
961# CONFIG_SENSORS_W83627EHF is not set 918# CONFIG_SENSORS_W83627EHF is not set
962# CONFIG_HWMON_DEBUG_CHIP is not set 919# CONFIG_HWMON_DEBUG_CHIP is not set
920CONFIG_WATCHDOG=y
921# CONFIG_WATCHDOG_NOWAYOUT is not set
922
923#
924# Watchdog Device Drivers
925#
926# CONFIG_SOFT_WATCHDOG is not set
927CONFIG_BFIN_WDT=y
928
929#
930# USB-based Watchdog Cards
931#
932# CONFIG_USBPCWATCHDOG is not set
933
934#
935# Sonics Silicon Backplane
936#
937CONFIG_SSB_POSSIBLE=y
938# CONFIG_SSB is not set
963 939
964# 940#
965# Multifunction device drivers 941# Multifunction device drivers
@@ -972,23 +948,20 @@ CONFIG_HWMON=y
972# CONFIG_VIDEO_DEV is not set 948# CONFIG_VIDEO_DEV is not set
973# CONFIG_DVB_CORE is not set 949# CONFIG_DVB_CORE is not set
974CONFIG_DAB=y 950CONFIG_DAB=y
951# CONFIG_USB_DABUSB is not set
975 952
976# 953#
977# Graphics support 954# Graphics support
978# 955#
979# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
980
981#
982# Display device support
983#
984# CONFIG_DISPLAY_SUPPORT is not set
985# CONFIG_VGASTATE is not set 956# CONFIG_VGASTATE is not set
957# CONFIG_VIDEO_OUTPUT_CONTROL is not set
986CONFIG_FB=y 958CONFIG_FB=y
987CONFIG_FIRMWARE_EDID=y 959CONFIG_FIRMWARE_EDID=y
988# CONFIG_FB_DDC is not set 960# CONFIG_FB_DDC is not set
989CONFIG_FB_CFB_FILLRECT=y 961CONFIG_FB_CFB_FILLRECT=y
990CONFIG_FB_CFB_COPYAREA=y 962CONFIG_FB_CFB_COPYAREA=y
991CONFIG_FB_CFB_IMAGEBLIT=y 963CONFIG_FB_CFB_IMAGEBLIT=y
964# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
992# CONFIG_FB_SYS_FILLRECT is not set 965# CONFIG_FB_SYS_FILLRECT is not set
993# CONFIG_FB_SYS_COPYAREA is not set 966# CONFIG_FB_SYS_COPYAREA is not set
994# CONFIG_FB_SYS_IMAGEBLIT is not set 967# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -1003,18 +976,24 @@ CONFIG_FB_DEFERRED_IO=y
1003# 976#
1004# Frame buffer hardware drivers 977# Frame buffer hardware drivers
1005# 978#
1006# CONFIG_FB_BFIN_7171 is not set
1007# CONFIG_FB_BFIN_7393 is not set
1008CONFIG_FB_BF54X_LQ043=y 979CONFIG_FB_BF54X_LQ043=y
1009# CONFIG_FB_BFIN_T350MCQB is not set 980# CONFIG_FB_BFIN_T350MCQB is not set
981# CONFIG_FB_BFIN_7393 is not set
1010# CONFIG_FB_S1D13XXX is not set 982# CONFIG_FB_S1D13XXX is not set
1011# CONFIG_FB_VIRTUAL is not set 983# CONFIG_FB_VIRTUAL is not set
984# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
985
986#
987# Display device support
988#
989# CONFIG_DISPLAY_SUPPORT is not set
1012 990
1013# 991#
1014# Console display driver support 992# Console display driver support
1015# 993#
1016CONFIG_DUMMY_CONSOLE=y 994CONFIG_DUMMY_CONSOLE=y
1017CONFIG_FRAMEBUFFER_CONSOLE=y 995CONFIG_FRAMEBUFFER_CONSOLE=y
996# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1018# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 997# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1019CONFIG_FONTS=y 998CONFIG_FONTS=y
1020# CONFIG_FONT_8x8 is not set 999# CONFIG_FONT_8x8 is not set
@@ -1065,10 +1044,21 @@ CONFIG_SND_VERBOSE_PROCFS=y
1065# CONFIG_SND_MPU401 is not set 1044# CONFIG_SND_MPU401 is not set
1066 1045
1067# 1046#
1047# SPI devices
1048#
1049
1050#
1068# ALSA Blackfin devices 1051# ALSA Blackfin devices
1069# 1052#
1070# CONFIG_SND_BLACKFIN_AD1836 is not set 1053# CONFIG_SND_BLACKFIN_AD1836 is not set
1071# CONFIG_SND_BFIN_AD73311 is not set 1054# CONFIG_SND_BFIN_AD73311 is not set
1055# CONFIG_SND_BFIN_AD73322 is not set
1056
1057#
1058# USB devices
1059#
1060# CONFIG_SND_USB_AUDIO is not set
1061# CONFIG_SND_USB_CAIAQ is not set
1072 1062
1073# 1063#
1074# System on Chip audio support 1064# System on Chip audio support
@@ -1084,6 +1074,10 @@ CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1084CONFIG_SND_BF5XX_SPORT_NUM=0 1074CONFIG_SND_BF5XX_SPORT_NUM=0
1085CONFIG_SND_BF5XX_HAVE_COLD_RESET=y 1075CONFIG_SND_BF5XX_HAVE_COLD_RESET=y
1086CONFIG_SND_BF5XX_RESET_GPIO_NUM=19 1076CONFIG_SND_BF5XX_RESET_GPIO_NUM=19
1077
1078#
1079# SoC Audio support for SuperH
1080#
1087CONFIG_SND_SOC_AD1980=y 1081CONFIG_SND_SOC_AD1980=y
1088 1082
1089# 1083#
@@ -1091,72 +1085,152 @@ CONFIG_SND_SOC_AD1980=y
1091# 1085#
1092# CONFIG_SOUND_PRIME is not set 1086# CONFIG_SOUND_PRIME is not set
1093CONFIG_AC97_BUS=y 1087CONFIG_AC97_BUS=y
1094 1088CONFIG_HID_SUPPORT=y
1095# 1089CONFIG_HID=y
1096# HID Devices
1097#
1098CONFIG_HID=m
1099# CONFIG_HID_DEBUG is not set 1090# CONFIG_HID_DEBUG is not set
1091# CONFIG_HIDRAW is not set
1100 1092
1101# 1093#
1102# USB support 1094# USB Input Devices
1103# 1095#
1096CONFIG_USB_HID=y
1097# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1098# CONFIG_HID_FF is not set
1099# CONFIG_USB_HIDDEV is not set
1100CONFIG_USB_SUPPORT=y
1104CONFIG_USB_ARCH_HAS_HCD=y 1101CONFIG_USB_ARCH_HAS_HCD=y
1105# CONFIG_USB_ARCH_HAS_OHCI is not set 1102# CONFIG_USB_ARCH_HAS_OHCI is not set
1106# CONFIG_USB_ARCH_HAS_EHCI is not set 1103# CONFIG_USB_ARCH_HAS_EHCI is not set
1107# CONFIG_USB is not set 1104CONFIG_USB=y
1105# CONFIG_USB_DEBUG is not set
1106
1107#
1108# Miscellaneous USB options
1109#
1110# CONFIG_USB_DEVICEFS is not set
1111CONFIG_USB_DEVICE_CLASS=y
1112# CONFIG_USB_DYNAMIC_MINORS is not set
1113# CONFIG_USB_OTG is not set
1114# CONFIG_USB_OTG_WHITELIST is not set
1115CONFIG_USB_OTG_BLACKLIST_HUB=y
1108 1116
1109# 1117#
1110# Enable Host or Gadget support to see Inventra options 1118# USB Host Controller Drivers
1111# 1119#
1120# CONFIG_USB_ISP116X_HCD is not set
1121# CONFIG_USB_ISP1362_HCD is not set
1122# CONFIG_USB_ISP1760_HCD is not set
1123# CONFIG_USB_SL811_HCD is not set
1124# CONFIG_USB_R8A66597_HCD is not set
1125CONFIG_USB_MUSB_HDRC=y
1126CONFIG_USB_MUSB_SOC=y
1127
1128#
1129# Blackfin high speed USB support
1130#
1131CONFIG_USB_MUSB_HOST=y
1132# CONFIG_USB_MUSB_PERIPHERAL is not set
1133# CONFIG_USB_MUSB_OTG is not set
1134CONFIG_USB_MUSB_HDRC_HCD=y
1135# CONFIG_MUSB_PIO_ONLY is not set
1136# CONFIG_USB_INVENTRA_DMA is not set
1137# CONFIG_USB_TI_CPPI_DMA is not set
1138CONFIG_USB_MUSB_LOGLEVEL=0
1139
1140#
1141# USB Device Class drivers
1142#
1143# CONFIG_USB_ACM is not set
1144# CONFIG_USB_PRINTER is not set
1112 1145
1113# 1146#
1114# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1147# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1115# 1148#
1116 1149
1117# 1150#
1118# USB Gadget Support 1151# may also be needed; see USB_STORAGE Help for more information
1119# 1152#
1120# CONFIG_USB_GADGET is not set 1153CONFIG_USB_STORAGE=m
1121CONFIG_MMC=m 1154# CONFIG_USB_STORAGE_DEBUG is not set
1122# CONFIG_MMC_DEBUG is not set 1155# CONFIG_USB_STORAGE_DATAFAB is not set
1123# CONFIG_MMC_UNSAFE_RESUME is not set 1156# CONFIG_USB_STORAGE_FREECOM is not set
1157# CONFIG_USB_STORAGE_ISD200 is not set
1158# CONFIG_USB_STORAGE_DPCM is not set
1159# CONFIG_USB_STORAGE_USBAT is not set
1160# CONFIG_USB_STORAGE_SDDR09 is not set
1161# CONFIG_USB_STORAGE_SDDR55 is not set
1162# CONFIG_USB_STORAGE_JUMPSHOT is not set
1163# CONFIG_USB_STORAGE_ALAUDA is not set
1164# CONFIG_USB_STORAGE_ONETOUCH is not set
1165# CONFIG_USB_STORAGE_KARMA is not set
1166# CONFIG_USB_LIBUSUAL is not set
1124 1167
1125# 1168#
1126# MMC/SD Card Drivers 1169# USB Imaging devices
1127# 1170#
1128CONFIG_MMC_BLOCK=m 1171# CONFIG_USB_MDC800 is not set
1172# CONFIG_USB_MICROTEK is not set
1173CONFIG_USB_MON=y
1129 1174
1130# 1175#
1131# MMC/SD Host Controller Drivers 1176# USB port drivers
1132# 1177#
1133CONFIG_SDH_BFIN=m
1134# CONFIG_SPI_MMC is not set
1135 1178
1136# 1179#
1137# LED devices 1180# USB Serial Converter support
1138# 1181#
1139# CONFIG_NEW_LEDS is not set 1182# CONFIG_USB_SERIAL is not set
1140 1183
1141# 1184#
1142# LED drivers 1185# USB Miscellaneous drivers
1143# 1186#
1187# CONFIG_USB_EMI62 is not set
1188# CONFIG_USB_EMI26 is not set
1189# CONFIG_USB_ADUTUX is not set
1190# CONFIG_USB_AUERSWALD is not set
1191# CONFIG_USB_RIO500 is not set
1192# CONFIG_USB_LEGOTOWER is not set
1193# CONFIG_USB_LCD is not set
1194# CONFIG_USB_BERRY_CHARGE is not set
1195# CONFIG_USB_LED is not set
1196# CONFIG_USB_CYPRESS_CY7C63 is not set
1197# CONFIG_USB_CYTHERM is not set
1198# CONFIG_USB_PHIDGET is not set
1199# CONFIG_USB_IDMOUSE is not set
1200# CONFIG_USB_FTDI_ELAN is not set
1201# CONFIG_USB_APPLEDISPLAY is not set
1202# CONFIG_USB_SISUSBVGA is not set
1203# CONFIG_USB_LD is not set
1204# CONFIG_USB_TRANCEVIBRATOR is not set
1205# CONFIG_USB_IOWARRIOR is not set
1144 1206
1145# 1207#
1146# LED Triggers 1208# USB DSL modem support
1147# 1209#
1148 1210
1149# 1211#
1150# InfiniBand support 1212# USB Gadget Support
1151# 1213#
1214# CONFIG_USB_GADGET is not set
1215CONFIG_MMC=m
1216# CONFIG_MMC_DEBUG is not set
1217# CONFIG_MMC_UNSAFE_RESUME is not set
1152 1218
1153# 1219#
1154# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 1220# MMC/SD Card Drivers
1155# 1221#
1222CONFIG_MMC_BLOCK=m
1223CONFIG_MMC_BLOCK_BOUNCE=y
1224# CONFIG_SDIO_UART is not set
1156 1225
1157# 1226#
1158# Real Time Clock 1227# MMC/SD Host Controller Drivers
1159# 1228#
1229CONFIG_SDH_BFIN=m
1230# CONFIG_SDH_BFIN_MISSING_CMD_PULLUP_WORKAROUND is not set
1231# CONFIG_MMC_SPI is not set
1232# CONFIG_SPI_MMC is not set
1233# CONFIG_NEW_LEDS is not set
1160CONFIG_RTC_LIB=y 1234CONFIG_RTC_LIB=y
1161CONFIG_RTC_CLASS=y 1235CONFIG_RTC_CLASS=y
1162CONFIG_RTC_HCTOSYS=y 1236CONFIG_RTC_HCTOSYS=y
@@ -1176,6 +1250,7 @@ CONFIG_RTC_INTF_DEV=y
1176# I2C RTC drivers 1250# I2C RTC drivers
1177# 1251#
1178# CONFIG_RTC_DRV_DS1307 is not set 1252# CONFIG_RTC_DRV_DS1307 is not set
1253# CONFIG_RTC_DRV_DS1374 is not set
1179# CONFIG_RTC_DRV_DS1672 is not set 1254# CONFIG_RTC_DRV_DS1672 is not set
1180# CONFIG_RTC_DRV_MAX6900 is not set 1255# CONFIG_RTC_DRV_MAX6900 is not set
1181# CONFIG_RTC_DRV_RS5C372 is not set 1256# CONFIG_RTC_DRV_RS5C372 is not set
@@ -1183,6 +1258,7 @@ CONFIG_RTC_INTF_DEV=y
1183# CONFIG_RTC_DRV_X1205 is not set 1258# CONFIG_RTC_DRV_X1205 is not set
1184# CONFIG_RTC_DRV_PCF8563 is not set 1259# CONFIG_RTC_DRV_PCF8563 is not set
1185# CONFIG_RTC_DRV_PCF8583 is not set 1260# CONFIG_RTC_DRV_PCF8583 is not set
1261# CONFIG_RTC_DRV_M41T80 is not set
1186 1262
1187# 1263#
1188# SPI RTC drivers 1264# SPI RTC drivers
@@ -1194,8 +1270,10 @@ CONFIG_RTC_INTF_DEV=y
1194# Platform RTC drivers 1270# Platform RTC drivers
1195# 1271#
1196# CONFIG_RTC_DRV_DS1553 is not set 1272# CONFIG_RTC_DRV_DS1553 is not set
1273# CONFIG_RTC_DRV_STK17TA8 is not set
1197# CONFIG_RTC_DRV_DS1742 is not set 1274# CONFIG_RTC_DRV_DS1742 is not set
1198# CONFIG_RTC_DRV_M48T86 is not set 1275# CONFIG_RTC_DRV_M48T86 is not set
1276# CONFIG_RTC_DRV_M48T59 is not set
1199# CONFIG_RTC_DRV_V3020 is not set 1277# CONFIG_RTC_DRV_V3020 is not set
1200 1278
1201# 1279#
@@ -1204,22 +1282,9 @@ CONFIG_RTC_INTF_DEV=y
1204CONFIG_RTC_DRV_BFIN=y 1282CONFIG_RTC_DRV_BFIN=y
1205 1283
1206# 1284#
1207# DMA Engine support 1285# Userspace I/O
1208#
1209# CONFIG_DMA_ENGINE is not set
1210
1211#
1212# DMA Clients
1213# 1286#
1214 1287# CONFIG_UIO is not set
1215#
1216# DMA Devices
1217#
1218
1219#
1220# PBX support
1221#
1222# CONFIG_PBX is not set
1223 1288
1224# 1289#
1225# File systems 1290# File systems
@@ -1280,7 +1345,6 @@ CONFIG_PROC_SYSCTL=y
1280CONFIG_SYSFS=y 1345CONFIG_SYSFS=y
1281# CONFIG_TMPFS is not set 1346# CONFIG_TMPFS is not set
1282# CONFIG_HUGETLB_PAGE is not set 1347# CONFIG_HUGETLB_PAGE is not set
1283CONFIG_RAMFS=y
1284# CONFIG_CONFIGFS_FS is not set 1348# CONFIG_CONFIGFS_FS is not set
1285 1349
1286# 1350#
@@ -1306,10 +1370,12 @@ CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1306CONFIG_JFFS2_FS=m 1370CONFIG_JFFS2_FS=m
1307CONFIG_JFFS2_FS_DEBUG=0 1371CONFIG_JFFS2_FS_DEBUG=0
1308CONFIG_JFFS2_FS_WRITEBUFFER=y 1372CONFIG_JFFS2_FS_WRITEBUFFER=y
1373# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1309# CONFIG_JFFS2_SUMMARY is not set 1374# CONFIG_JFFS2_SUMMARY is not set
1310# CONFIG_JFFS2_FS_XATTR is not set 1375# CONFIG_JFFS2_FS_XATTR is not set
1311# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1376# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1312CONFIG_JFFS2_ZLIB=y 1377CONFIG_JFFS2_ZLIB=y
1378# CONFIG_JFFS2_LZO is not set
1313CONFIG_JFFS2_RTIME=y 1379CONFIG_JFFS2_RTIME=y
1314# CONFIG_JFFS2_RUBIN is not set 1380# CONFIG_JFFS2_RUBIN is not set
1315# CONFIG_CRAMFS is not set 1381# CONFIG_CRAMFS is not set
@@ -1318,10 +1384,7 @@ CONFIG_JFFS2_RTIME=y
1318# CONFIG_QNX4FS_FS is not set 1384# CONFIG_QNX4FS_FS is not set
1319# CONFIG_SYSV_FS is not set 1385# CONFIG_SYSV_FS is not set
1320# CONFIG_UFS_FS is not set 1386# CONFIG_UFS_FS is not set
1321 1387CONFIG_NETWORK_FILESYSTEMS=y
1322#
1323# Network File Systems
1324#
1325CONFIG_NFS_FS=m 1388CONFIG_NFS_FS=m
1326CONFIG_NFS_V3=y 1389CONFIG_NFS_V3=y
1327# CONFIG_NFS_V3_ACL is not set 1390# CONFIG_NFS_V3_ACL is not set
@@ -1352,7 +1415,6 @@ CONFIG_CIFS=y
1352# CONFIG_NCP_FS is not set 1415# CONFIG_NCP_FS is not set
1353# CONFIG_CODA_FS is not set 1416# CONFIG_CODA_FS is not set
1354# CONFIG_AFS_FS is not set 1417# CONFIG_AFS_FS is not set
1355# CONFIG_9P_FS is not set
1356 1418
1357# 1419#
1358# Partition Types 1420# Partition Types
@@ -1375,10 +1437,6 @@ CONFIG_MSDOS_PARTITION=y
1375# CONFIG_KARMA_PARTITION is not set 1437# CONFIG_KARMA_PARTITION is not set
1376# CONFIG_EFI_PARTITION is not set 1438# CONFIG_EFI_PARTITION is not set
1377# CONFIG_SYSV68_PARTITION is not set 1439# CONFIG_SYSV68_PARTITION is not set
1378
1379#
1380# Native Language Support
1381#
1382CONFIG_NLS=y 1440CONFIG_NLS=y
1383CONFIG_NLS_DEFAULT="iso8859-1" 1441CONFIG_NLS_DEFAULT="iso8859-1"
1384CONFIG_NLS_CODEPAGE_437=m 1442CONFIG_NLS_CODEPAGE_437=m
@@ -1419,21 +1477,16 @@ CONFIG_NLS_ISO8859_15=m
1419CONFIG_NLS_KOI8_R=m 1477CONFIG_NLS_KOI8_R=m
1420CONFIG_NLS_KOI8_U=m 1478CONFIG_NLS_KOI8_U=m
1421CONFIG_NLS_UTF8=m 1479CONFIG_NLS_UTF8=m
1422
1423#
1424# Distributed Lock Manager
1425#
1426# CONFIG_DLM is not set 1480# CONFIG_DLM is not set
1427 1481CONFIG_INSTRUMENTATION=y
1428#
1429# Profiling support
1430#
1431# CONFIG_PROFILING is not set 1482# CONFIG_PROFILING is not set
1483# CONFIG_MARKERS is not set
1432 1484
1433# 1485#
1434# Kernel hacking 1486# Kernel hacking
1435# 1487#
1436# CONFIG_PRINTK_TIME is not set 1488# CONFIG_PRINTK_TIME is not set
1489CONFIG_ENABLE_WARN_DEPRECATED=y
1437CONFIG_ENABLE_MUST_CHECK=y 1490CONFIG_ENABLE_MUST_CHECK=y
1438# CONFIG_MAGIC_SYSRQ is not set 1491# CONFIG_MAGIC_SYSRQ is not set
1439# CONFIG_UNUSED_SYMBOLS is not set 1492# CONFIG_UNUSED_SYMBOLS is not set
@@ -1441,6 +1494,7 @@ CONFIG_DEBUG_FS=y
1441# CONFIG_HEADERS_CHECK is not set 1494# CONFIG_HEADERS_CHECK is not set
1442# CONFIG_DEBUG_KERNEL is not set 1495# CONFIG_DEBUG_KERNEL is not set
1443# CONFIG_DEBUG_BUGVERBOSE is not set 1496# CONFIG_DEBUG_BUGVERBOSE is not set
1497# CONFIG_SAMPLES is not set
1444CONFIG_DEBUG_MMRS=y 1498CONFIG_DEBUG_MMRS=y
1445CONFIG_DEBUG_HUNT_FOR_ZERO=y 1499CONFIG_DEBUG_HUNT_FOR_ZERO=y
1446CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1500CONFIG_DEBUG_BFIN_HWTRACE_ON=y
@@ -1460,11 +1514,8 @@ CONFIG_ACCESS_CHECK=y
1460# CONFIG_KEYS is not set 1514# CONFIG_KEYS is not set
1461CONFIG_SECURITY=y 1515CONFIG_SECURITY=y
1462# CONFIG_SECURITY_NETWORK is not set 1516# CONFIG_SECURITY_NETWORK is not set
1463CONFIG_SECURITY_CAPABILITIES=m 1517# CONFIG_SECURITY_CAPABILITIES is not set
1464 1518# CONFIG_SECURITY_ROOTPLUG is not set
1465#
1466# Cryptographic options
1467#
1468# CONFIG_CRYPTO is not set 1519# CONFIG_CRYPTO is not set
1469 1520
1470# 1521#
@@ -1475,6 +1526,7 @@ CONFIG_CRC_CCITT=m
1475# CONFIG_CRC16 is not set 1526# CONFIG_CRC16 is not set
1476# CONFIG_CRC_ITU_T is not set 1527# CONFIG_CRC_ITU_T is not set
1477CONFIG_CRC32=y 1528CONFIG_CRC32=y
1529# CONFIG_CRC7 is not set
1478# CONFIG_LIBCRC32C is not set 1530# CONFIG_LIBCRC32C is not set
1479CONFIG_ZLIB_INFLATE=y 1531CONFIG_ZLIB_INFLATE=y
1480CONFIG_ZLIB_DEFLATE=m 1532CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/blackfin/configs/IP0X_defconfig b/arch/blackfin/configs/IP0X_defconfig
index 5f6ff04a86c3..4384a670a8b8 100644
--- a/arch/blackfin/configs/IP0X_defconfig
+++ b/arch/blackfin/configs/IP0X_defconfig
@@ -212,7 +212,7 @@ CONFIG_HZ=250
212# 212#
213# Memory Setup 213# Memory Setup
214# 214#
215CONFIG_MEM_SIZE=64 215CONFIG_MAX_MEM_SIZE=64
216CONFIG_MEM_ADD_WIDTH=10 216CONFIG_MEM_ADD_WIDTH=10
217 217
218# 218#
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index fd5448d6107c..d54f19085f37 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -90,6 +90,17 @@ int request_dma(unsigned int channel, char *device_id)
90{ 90{
91 91
92 pr_debug("request_dma() : BEGIN \n"); 92 pr_debug("request_dma() : BEGIN \n");
93
94#if defined(CONFIG_BF561) && ANOMALY_05000182
95 if (channel >= CH_IMEM_STREAM0_DEST && channel <= CH_IMEM_STREAM1_DEST) {
96 if (get_cclk() > 500000000) {
97 printk(KERN_WARNING
98 "Request IMDMA failed due to ANOMALY 05000182\n");
99 return -EFAULT;
100 }
101 }
102#endif
103
93 mutex_lock(&(dma_ch[channel].dmalock)); 104 mutex_lock(&(dma_ch[channel].dmalock));
94 105
95 if ((dma_ch[channel].chan_status == DMA_CHANNEL_REQUESTED) 106 if ((dma_ch[channel].chan_status == DMA_CHANNEL_REQUESTED)
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 7e8eaf4a31bb..b6d89d1644cc 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -1130,6 +1130,25 @@ void bfin_gpio_irq_prepare(unsigned gpio)
1130 1130
1131#else 1131#else
1132 1132
1133int gpio_get_value(unsigned gpio)
1134{
1135 unsigned long flags;
1136 int ret;
1137
1138 if (unlikely(get_gpio_edge(gpio))) {
1139 local_irq_save(flags);
1140 set_gpio_edge(gpio, 0);
1141 ret = get_gpio_data(gpio);
1142 set_gpio_edge(gpio, 1);
1143 local_irq_restore(flags);
1144
1145 return ret;
1146 } else
1147 return get_gpio_data(gpio);
1148}
1149EXPORT_SYMBOL(gpio_get_value);
1150
1151
1133int gpio_direction_input(unsigned gpio) 1152int gpio_direction_input(unsigned gpio)
1134{ 1153{
1135 unsigned long flags; 1154 unsigned long flags;
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c
index 053edff6c0d8..4367330909b2 100644
--- a/arch/blackfin/kernel/bfin_ksyms.c
+++ b/arch/blackfin/kernel/bfin_ksyms.c
@@ -90,7 +90,9 @@ EXPORT_SYMBOL(__umodsi3);
90EXPORT_SYMBOL(outsb); 90EXPORT_SYMBOL(outsb);
91EXPORT_SYMBOL(insb); 91EXPORT_SYMBOL(insb);
92EXPORT_SYMBOL(outsw); 92EXPORT_SYMBOL(outsw);
93EXPORT_SYMBOL(outsw_8);
93EXPORT_SYMBOL(insw); 94EXPORT_SYMBOL(insw);
95EXPORT_SYMBOL(insw_8);
94EXPORT_SYMBOL(outsl); 96EXPORT_SYMBOL(outsl);
95EXPORT_SYMBOL(insl); 97EXPORT_SYMBOL(insl);
96EXPORT_SYMBOL(insl_16); 98EXPORT_SYMBOL(insl_16);
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c
index e698554895a7..3a3e9615b002 100644
--- a/arch/blackfin/kernel/gptimers.c
+++ b/arch/blackfin/kernel/gptimers.c
@@ -10,8 +10,8 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/io.h>
13 14
14#include <asm/io.h>
15#include <asm/blackfin.h> 15#include <asm/blackfin.h>
16#include <asm/gptimers.h> 16#include <asm/gptimers.h>
17 17
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index c640154030e2..6bdba7b21109 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -34,7 +34,6 @@
34#include <linux/fs.h> 34#include <linux/fs.h>
35 35
36static struct fs_struct init_fs = INIT_FS; 36static struct fs_struct init_fs = INIT_FS;
37static struct files_struct init_files = INIT_FILES;
38static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 37static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
39static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 38static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
40 39
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 5b847070dae5..f061f5181623 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -67,7 +67,7 @@ void __init trap_init(void)
67 CSYNC(); 67 CSYNC();
68} 68}
69 69
70void *saved_icplb_fault_addr, *saved_dcplb_fault_addr; 70unsigned long saved_icplb_fault_addr, saved_dcplb_fault_addr;
71 71
72int kstack_depth_to_print = 48; 72int kstack_depth_to_print = 48;
73 73
@@ -364,13 +364,13 @@ asmlinkage void trap_c(struct pt_regs *fp)
364 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ 364 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
365 case VEC_CPLB_MHIT: 365 case VEC_CPLB_MHIT:
366 info.si_code = ILL_CPLB_MULHIT; 366 info.si_code = ILL_CPLB_MULHIT;
367#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
368 sig = SIGSEGV; 367 sig = SIGSEGV;
369 printk(KERN_NOTICE "NULL pointer access (probably)\n"); 368#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
370#else 369 if (saved_dcplb_fault_addr < FIXED_CODE_START)
371 sig = SIGILL; 370 printk(KERN_NOTICE "NULL pointer access\n");
372 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE)); 371 else
373#endif 372#endif
373 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE));
374 CHK_DEBUGGER_TRAP(); 374 CHK_DEBUGGER_TRAP();
375 break; 375 break;
376 /* 0x28 - Emulation Watchpoint, handled here */ 376 /* 0x28 - Emulation Watchpoint, handled here */
@@ -419,13 +419,13 @@ asmlinkage void trap_c(struct pt_regs *fp)
419 /* 0x2D - Instruction CPLB Multiple Hits, handled here */ 419 /* 0x2D - Instruction CPLB Multiple Hits, handled here */
420 case VEC_CPLB_I_MHIT: 420 case VEC_CPLB_I_MHIT:
421 info.si_code = ILL_CPLB_MULHIT; 421 info.si_code = ILL_CPLB_MULHIT;
422#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
423 sig = SIGSEGV; 422 sig = SIGSEGV;
424 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n"); 423#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
425#else 424 if (saved_icplb_fault_addr < FIXED_CODE_START)
426 sig = SIGILL; 425 printk(KERN_NOTICE "Jump to NULL address\n");
427 printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE)); 426 else
428#endif 427#endif
428 printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE));
429 CHK_DEBUGGER_TRAP(); 429 CHK_DEBUGGER_TRAP();
430 break; 430 break;
431 /* 0x2E - Illegal use of Supervisor Resource, handled here */ 431 /* 0x2E - Illegal use of Supervisor Resource, handled here */
@@ -939,8 +939,6 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
939 939
940 oops_in_progress = 1; 940 oops_in_progress = 1;
941 941
942 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", saved_dcplb_fault_addr);
943 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", saved_icplb_fault_addr);
944 dump_bfin_process(fp); 942 dump_bfin_process(fp);
945 dump_bfin_mem(fp); 943 dump_bfin_mem(fp);
946 show_regs(fp); 944 show_regs(fp);
diff --git a/arch/blackfin/lib/checksum.c b/arch/blackfin/lib/checksum.c
index 42768e0c80ca..5c87505165d3 100644
--- a/arch/blackfin/lib/checksum.c
+++ b/arch/blackfin/lib/checksum.c
@@ -72,9 +72,9 @@ static unsigned short do_csum(const unsigned char *buff, int len)
72 * This is a version of ip_compute_csum() optimized for IP headers, 72 * This is a version of ip_compute_csum() optimized for IP headers,
73 * which always checksum on 4 octet boundaries. 73 * which always checksum on 4 octet boundaries.
74 */ 74 */
75unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 75__sum16 ip_fast_csum(unsigned char *iph, unsigned int ihl)
76{ 76{
77 return ~do_csum(iph, ihl * 4); 77 return (__force __sum16)~do_csum(iph, ihl * 4);
78} 78}
79 79
80/* 80/*
@@ -89,7 +89,7 @@ unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
89 * 89 *
90 * it's best to have buff aligned on a 32-bit boundary 90 * it's best to have buff aligned on a 32-bit boundary
91 */ 91 */
92unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum) 92__wsum csum_partial(const void *buff, int len, __wsum sum)
93{ 93{
94 /* 94 /*
95 * Just in case we get nasty checksum data... 95 * Just in case we get nasty checksum data...
@@ -109,22 +109,22 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum)
109 * this routine is used for miscellaneous IP-like checksums, mainly 109 * this routine is used for miscellaneous IP-like checksums, mainly
110 * in icmp.c 110 * in icmp.c
111 */ 111 */
112unsigned short ip_compute_csum(const unsigned char *buff, int len) 112__sum16 ip_compute_csum(const void *buff, int len)
113{ 113{
114 return ~do_csum(buff, len); 114 return (__force __sum16)~do_csum(buff, len);
115} 115}
116 116
117/* 117/*
118 * copy from fs while checksumming, otherwise like csum_partial 118 * copy from fs while checksumming, otherwise like csum_partial
119 */ 119 */
120 120
121unsigned int 121__wsum
122csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, 122csum_partial_copy_from_user(const void __user *src, void *dst,
123 int len, int sum, int *csum_err) 123 int len, __wsum sum, int *csum_err)
124{ 124{
125 if (csum_err) 125 if (csum_err)
126 *csum_err = 0; 126 *csum_err = 0;
127 memcpy(dst, src, len); 127 memcpy(dst, (__force void *)src, len);
128 return csum_partial(dst, len, sum); 128 return csum_partial(dst, len, sum);
129} 129}
130 130
@@ -132,8 +132,7 @@ csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
132 * copy from ds while checksumming, otherwise like csum_partial 132 * copy from ds while checksumming, otherwise like csum_partial
133 */ 133 */
134 134
135unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, 135__wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
136 int len, int sum)
137{ 136{
138 memcpy(dst, src, len); 137 memcpy(dst, src, len);
139 return csum_partial(dst, len, sum); 138 return csum_partial(dst, len, sum);
diff --git a/arch/blackfin/lib/ins.S b/arch/blackfin/lib/ins.S
index df7b8833a0c5..eba2343b1b59 100644
--- a/arch/blackfin/lib/ins.S
+++ b/arch/blackfin/lib/ins.S
@@ -7,7 +7,7 @@
7 * Description: Implementation of ins{bwl} for BlackFin processors using zero overhead loops. 7 * Description: Implementation of ins{bwl} for BlackFin processors using zero overhead loops.
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2008 Analog Devices Inc.
11 * Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl> 11 * Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl>
12 * 12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
@@ -63,6 +63,23 @@ ENTRY(_insw)
63 RTS; 63 RTS;
64ENDPROC(_insw) 64ENDPROC(_insw)
65 65
66ENTRY(_insw_8)
67 P0 = R0; /* P0 = port */
68 cli R3;
69 P1 = R1; /* P1 = address */
70 P2 = R2; /* P2 = count */
71 SSYNC;
72 LSETUP( .Lword8_loop_s, .Lword8_loop_e) LC0 = P2;
73.Lword8_loop_s: R0 = W[P0];
74 B[P1++] = R0;
75 R0 = R0 >> 8;
76 B[P1++] = R0;
77 NOP;
78.Lword8_loop_e: NOP;
79 sti R3;
80 RTS;
81ENDPROC(_insw_8)
82
66ENTRY(_insb) 83ENTRY(_insb)
67 P0 = R0; /* P0 = port */ 84 P0 = R0; /* P0 = port */
68 cli R3; 85 cli R3;
@@ -78,8 +95,6 @@ ENTRY(_insb)
78 RTS; 95 RTS;
79ENDPROC(_insb) 96ENDPROC(_insb)
80 97
81
82
83ENTRY(_insl_16) 98ENTRY(_insl_16)
84 P0 = R0; /* P0 = port */ 99 P0 = R0; /* P0 = port */
85 cli R3; 100 cli R3;
diff --git a/arch/blackfin/lib/outs.S b/arch/blackfin/lib/outs.S
index 4c3da8ae094e..4685b7aa0080 100644
--- a/arch/blackfin/lib/outs.S
+++ b/arch/blackfin/lib/outs.S
@@ -7,7 +7,7 @@
7 * Description: Implementation of outs{bwl} for BlackFin processors using zero overhead loops. 7 * Description: Implementation of outs{bwl} for BlackFin processors using zero overhead loops.
8 * 8 *
9 * Modified: Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl> 9 * Modified: Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl>
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2008 Analog Devices Inc.
11 * 11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 * 13 *
@@ -63,3 +63,17 @@ ENTRY(_outsb)
63.Lbyte_loop_e: B[P0] = R0; 63.Lbyte_loop_e: B[P0] = R0;
64 RTS; 64 RTS;
65ENDPROC(_outsb) 65ENDPROC(_outsb)
66
67ENTRY(_outsw_8)
68 P0 = R0; /* P0 = port */
69 P1 = R1; /* P1 = address */
70 P2 = R2; /* P2 = count */
71
72 LSETUP( .Lword8_loop_s, .Lword8_loop_e) LC0 = P2;
73.Lword8_loop_s: R1 = B[P1++];
74 R0 = B[P1++];
75 R0 = R0 << 8;
76 R0 = R0 + R1;
77.Lword8_loop_e: W[P0] = R0;
78 RTS;
79ENDPROC(_outsw_8)
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 8aa49f804228..5958eecefcf1 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -451,9 +451,6 @@ static struct platform_device net2272_bfin_device = {
451}; 451};
452#endif 452#endif
453 453
454#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
455/* all SPI peripherals info goes here */
456
457#if defined(CONFIG_MTD_M25P80) \ 454#if defined(CONFIG_MTD_M25P80) \
458 || defined(CONFIG_MTD_M25P80_MODULE) 455 || defined(CONFIG_MTD_M25P80_MODULE)
459static struct mtd_partition bfin_spi_flash_partitions[] = { 456static struct mtd_partition bfin_spi_flash_partitions[] = {
@@ -647,10 +644,10 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
647 { 644 {
648 .modalias = "ad7877", 645 .modalias = "ad7877",
649 .platform_data = &bfin_ad7877_ts_info, 646 .platform_data = &bfin_ad7877_ts_info,
650 .irq = IRQ_PF6, 647 .irq = IRQ_PF8,
651 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 648 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
652 .bus_num = 0, 649 .bus_num = 0,
653 .chip_select = 1, 650 .chip_select = 2,
654 .controller_data = &spi_ad7877_chip_info, 651 .controller_data = &spi_ad7877_chip_info,
655 }, 652 },
656#endif 653#endif
@@ -676,6 +673,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
676#endif 673#endif
677}; 674};
678 675
676#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
679/* SPI controller data */ 677/* SPI controller data */
680static struct bfin5xx_spi_master bfin_spi0_info = { 678static struct bfin5xx_spi_master bfin_spi0_info = {
681 .num_chipselect = 8, 679 .num_chipselect = 8,
@@ -799,13 +797,11 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
799#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 797#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
800 { 798 {
801 I2C_BOARD_INFO("pcf8574_lcd", 0x22), 799 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
802 .type = "pcf8574_lcd",
803 }, 800 },
804#endif 801#endif
805#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) 802#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
806 { 803 {
807 I2C_BOARD_INFO("pcf8574_keypad", 0x27), 804 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
808 .type = "pcf8574_keypad",
809 .irq = IRQ_PF8, 805 .irq = IRQ_PF8,
810 }, 806 },
811#endif 807#endif
@@ -1020,10 +1016,7 @@ static int __init stamp_init(void)
1020#endif 1016#endif
1021 1017
1022 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 1018 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1023#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 1019 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1024 spi_register_board_info(bfin_spi_board_info,
1025 ARRAY_SIZE(bfin_spi_board_info));
1026#endif
1027 1020
1028#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 1021#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1029 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; 1022 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 9d28415163ea..079389cbd859 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -87,9 +87,6 @@ static struct platform_device smc91x_device = {
87}; 87};
88#endif 88#endif
89 89
90#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
91/* all SPI peripherals info goes here */
92
93#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) 90#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
94static struct mtd_partition bfin_spi_flash_partitions[] = { 91static struct mtd_partition bfin_spi_flash_partitions[] = {
95 { 92 {
@@ -189,6 +186,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
189#endif 186#endif
190}; 187};
191 188
189#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
192/* SPI (0) */ 190/* SPI (0) */
193static struct resource bfin_spi0_resource[] = { 191static struct resource bfin_spi0_resource[] = {
194 [0] = { 192 [0] = {
@@ -425,9 +423,7 @@ static int __init ezkit_init(void)
425{ 423{
426 printk(KERN_INFO "%s(): registering device resources\n", __func__); 424 printk(KERN_INFO "%s(): registering device resources\n", __func__);
427 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); 425 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
428#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
429 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 426 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
430#endif
431 427
432#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 428#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
433 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; 429 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 7fd35fb32fd5..13ae49515f73 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -111,7 +111,7 @@ static struct platform_device net2272_bfin_device = {
111}; 111};
112#endif 112#endif
113 113
114#if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE) 114#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
115static struct mtd_partition stamp_partitions[] = { 115static struct mtd_partition stamp_partitions[] = {
116 { 116 {
117 .name = "Bootloader", 117 .name = "Bootloader",
@@ -141,13 +141,17 @@ static struct resource stamp_flash_resource[] = {
141 .end = 0x203fffff, 141 .end = 0x203fffff,
142 .flags = IORESOURCE_MEM, 142 .flags = IORESOURCE_MEM,
143 }, { 143 }, {
144 .start = CONFIG_ENET_FLASH_PIN, 144 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
145 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
146 .flags = IORESOURCE_MEM,
147 }, {
148 .start = GPIO_PF0,
145 .flags = IORESOURCE_IRQ, 149 .flags = IORESOURCE_IRQ,
146 } 150 }
147}; 151};
148 152
149static struct platform_device stamp_flash_device = { 153static struct platform_device stamp_flash_device = {
150 .name = "BF5xx-Flash", 154 .name = "bfin-async-flash",
151 .id = 0, 155 .id = 0,
152 .dev = { 156 .dev = {
153 .platform_data = &stamp_flash_data, 157 .platform_data = &stamp_flash_data,
@@ -157,9 +161,6 @@ static struct platform_device stamp_flash_device = {
157}; 161};
158#endif 162#endif
159 163
160#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
161/* all SPI peripherals info goes here */
162
163#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) 164#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
164static struct mtd_partition bfin_spi_flash_partitions[] = { 165static struct mtd_partition bfin_spi_flash_partitions[] = {
165 { 166 {
@@ -316,6 +317,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
316#endif 317#endif
317}; 318};
318 319
320#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
319/* SPI (0) */ 321/* SPI (0) */
320static struct resource bfin_spi0_resource[] = { 322static struct resource bfin_spi0_resource[] = {
321 [0] = { 323 [0] = {
@@ -595,7 +597,7 @@ static struct platform_device *stamp_devices[] __initdata = {
595 597
596 &bfin_gpios_device, 598 &bfin_gpios_device,
597 599
598#if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE) 600#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
599 &stamp_flash_device, 601 &stamp_flash_device,
600#endif 602#endif
601}; 603};
@@ -617,15 +619,13 @@ static int __init stamp_init(void)
617 619
618#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 620#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
619 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */ 621 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
620 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN)); 622 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
621 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN); 623 bfin_write_FIO_FLAG_S(PF0);
622 SSYNC(); 624 SSYNC();
623#endif 625#endif
624 626
625#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 627 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
626 spi_register_board_info(bfin_spi_board_info, 628
627 ARRAY_SIZE(bfin_spi_board_info));
628#endif
629#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 629#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
630 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; 630 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
631#endif 631#endif
@@ -636,8 +636,8 @@ arch_initcall(stamp_init);
636 636
637void native_machine_restart(char *cmd) 637void native_machine_restart(char *cmd)
638{ 638{
639#define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN) 639 /* workaround pull up on cpld / flash pin not being strong enough */
640 bfin_write_FIO_INEN(~BIT_TO_SET); 640 bfin_write_FIO_INEN(~PF0);
641 bfin_write_FIO_DIR(BIT_TO_SET); 641 bfin_write_FIO_DIR(PF0);
642 bfin_write_FIO_FLAG_C(BIT_TO_SET); 642 bfin_write_FIO_FLAG_C(PF0);
643} 643}
diff --git a/arch/blackfin/mach-bf537/boards/Makefile b/arch/blackfin/mach-bf537/boards/Makefile
index 87e450f29e37..c94f7a5b8211 100644
--- a/arch/blackfin/mach-bf537/boards/Makefile
+++ b/arch/blackfin/mach-bf537/boards/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BF537_BOARD) += generic_board.o 5obj-$(CONFIG_GENERIC_BF537_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o 6obj-$(CONFIG_BFIN537_STAMP) += stamp.o
7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o 7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o
8obj-$(CONFIG_PNAV10) += pnav10.o 8obj-$(CONFIG_PNAV10) += pnav10.o
9obj-$(CONFIG_CAMSIG_MINOTAUR) += minotaur.o 9obj-$(CONFIG_CAMSIG_MINOTAUR) += minotaur.o
diff --git a/arch/blackfin/mach-bf537/boards/led.S b/arch/blackfin/mach-bf537/boards/led.S
deleted file mode 100644
index 4e9ea4283e5f..000000000000
--- a/arch/blackfin/mach-bf537/boards/led.S
+++ /dev/null
@@ -1,183 +0,0 @@
1/****************************************************
2 * LED1 ---- PF6 LED2 ---- PF7 *
3 * LED3 ---- PF8 LED4 ---- PF9 *
4 * LED5 ---- PF10 LED6 ---- PF11 *
5 ****************************************************/
6
7#include <linux/linkage.h>
8#include <asm/blackfin.h>
9
10/* All functions in this file save the registers they uses.
11 So there is no need to save any registers before calling them. */
12
13 .text;
14
15/* Initialize LEDs. */
16
17ENTRY(_led_init)
18 LINK 12;
19 [--SP] = P0;
20 [--SP] = R0;
21 [--SP] = R1;
22 [--SP] = R2;
23 R1 = PF6|PF7|PF8|PF9|PF10|PF11 (Z);
24 R2 = ~R1;
25
26 P0.H = hi(PORTF_FER);
27 P0.L = lo(PORTF_FER);
28 R0 = W[P0](Z);
29 SSYNC;
30 R0 = R0 & R2;
31 W[P0] = R0.L;
32 SSYNC;
33
34 P0.H = hi(PORTFIO_DIR);
35 P0.L = lo(PORTFIO_DIR);
36 R0 = W[P0](Z);
37 SSYNC;
38 R0 = R0 | R1;
39 W[P0] = R0.L;
40 SSYNC;
41
42 P0.H = hi(PORTFIO_INEN);
43 P0.L = lo(PORTFIO_INEN);
44 R0 = W[P0](Z);
45 SSYNC;
46 R0 = R0 & R2;
47 W[P0] = R0.L;
48 SSYNC;
49
50 R2 = [SP++];
51 R1 = [SP++];
52 R0 = [SP++];
53 P0 = [SP++];
54 UNLINK;
55 RTS;
56 .size _led_init, .-_led_init
57
58/* Set one LED on. Leave other LEDs unchanged.
59 It expects the LED number passed through R0. */
60
61ENTRY(_led_on)
62 LINK 12;
63 [--SP] = P0;
64 [--SP] = R1;
65 CALL _led_init;
66 R1 = 1;
67 R0 += 5;
68 R1 <<= R0;
69 P0.H = hi(PORTFIO);
70 P0.L = lo(PORTFIO);
71 R0 = W[P0](Z);
72 SSYNC;
73 R0 = R0 | R1;
74 W[P0] = R0.L;
75 SSYNC;
76 R1 = [SP++];
77 P0 = [SP++];
78 UNLINK;
79 RTS;
80 .size _led_on, .-_led_on
81
82/* Set one LED off. Leave other LEDs unchanged. */
83
84ENTRY(_led_off)
85 LINK 12;
86 [--SP] = P0;
87 [--SP] = R1;
88 CALL _led_init;
89 R1 = 1;
90 R0 += 5;
91 R1 <<= R0;
92 R1 = ~R1;
93 P0.H = hi(PORTFIO);
94 P0.L = lo(PORTFIO);
95 R0 = W[P0](Z);
96 SSYNC;
97 R0 = R0 & R1;
98 W[P0] = R0.L;
99 SSYNC;
100 R1 = [SP++];
101 P0 = [SP++];
102 UNLINK;
103 RTS;
104 .size _led_off, .-_led_off
105
106/* Toggle one LED. Leave other LEDs unchanged. */
107
108ENTRY(_led_toggle)
109 LINK 12;
110 [--SP] = P0;
111 [--SP] = R1;
112 CALL _led_init;
113 R1 = 1;
114 R0 += 5;
115 R1 <<= R0;
116 P0.H = hi(PORTFIO);
117 P0.L = lo(PORTFIO);
118 R0 = W[P0](Z);
119 SSYNC;
120 R0 = R0 ^ R1;
121 W[P0] = R0.L;
122 SSYNC;
123 R1 = [SP++];
124 P0 = [SP++];
125 UNLINK;
126 RTS;
127 .size _led_toggle, .-_led_toggle
128
129/* Display the number using LEDs in binary format. */
130
131ENTRY(_led_disp_num)
132 LINK 12;
133 [--SP] = P0;
134 [--SP] = R1;
135 [--SP] = R2;
136 CALL _led_init;
137 R1 = 0x3f(X);
138 R0 = R0 & R1;
139 R2 = 6(X);
140 R0 <<= R2;
141 R1 <<= R2;
142 P0.H = hi(PORTFIO);
143 P0.L = lo(PORTFIO);
144 R2 = W[P0](Z);
145 SSYNC;
146 R1 = ~R1;
147 R2 = R2 & R1;
148 R2 = R2 | R0;
149 W[P0] = R2.L;
150 SSYNC;
151 R2 = [SP++];
152 R1 = [SP++];
153 P0 = [SP++];
154 UNLINK;
155 RTS;
156 .size _led_disp_num, .-_led_disp_num
157
158/* Toggle the number using LEDs in binary format. */
159
160ENTRY(_led_toggle_num)
161 LINK 12;
162 [--SP] = P0;
163 [--SP] = R1;
164 [--SP] = R2;
165 CALL _led_init;
166 R1 = 0x3f(X);
167 R0 = R0 & R1;
168 R1 = 6(X);
169 R0 <<= R1;
170 P0.H = hi(PORTFIO);
171 P0.L = lo(PORTFIO);
172 R1 = W[P0](Z);
173 SSYNC;
174 R1 = R1 ^ R0;
175 W[P0] = R1.L;
176 SSYNC;
177 R2 = [SP++];
178 R1 = [SP++];
179 P0 = [SP++];
180 UNLINK;
181 RTS;
182 .size _led_toggle_num, .-_led_toggle_num
183
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 9a756d1f3d73..671f9d67f23a 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -400,9 +400,6 @@ static struct platform_device stamp_flash_device = {
400}; 400};
401#endif 401#endif
402 402
403#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
404/* all SPI peripherals info goes here */
405
406#if defined(CONFIG_MTD_M25P80) \ 403#if defined(CONFIG_MTD_M25P80) \
407 || defined(CONFIG_MTD_M25P80_MODULE) 404 || defined(CONFIG_MTD_M25P80_MODULE)
408static struct mtd_partition bfin_spi_flash_partitions[] = { 405static struct mtd_partition bfin_spi_flash_partitions[] = {
@@ -629,6 +626,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
629#endif 626#endif
630}; 627};
631 628
629#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
632/* SPI controller data */ 630/* SPI controller data */
633static struct bfin5xx_spi_master bfin_spi0_info = { 631static struct bfin5xx_spi_master bfin_spi0_info = {
634 .num_chipselect = 8, 632 .num_chipselect = 8,
@@ -939,10 +937,7 @@ static int __init stamp_init(void)
939#endif 937#endif
940 938
941 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 939 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
942#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 940 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
943 spi_register_board_info(bfin_spi_board_info,
944 ARRAY_SIZE(bfin_spi_board_info));
945#endif
946 941
947#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 942#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
948 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; 943 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
diff --git a/arch/blackfin/mach-bf548/boards/Makefile b/arch/blackfin/mach-bf548/boards/Makefile
index eed161dd7845..319ef54c4221 100644
--- a/arch/blackfin/mach-bf548/boards/Makefile
+++ b/arch/blackfin/mach-bf548/boards/Makefile
@@ -2,5 +2,5 @@
2# arch/blackfin/mach-bf548/boards/Makefile 2# arch/blackfin/mach-bf548/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_BFIN548_EZKIT) += ezkit.o led.o 5obj-$(CONFIG_BFIN548_EZKIT) += ezkit.o
6obj-$(CONFIG_BFIN548_BLUETECHNIX_CM) += cm_bf548.o 6obj-$(CONFIG_BFIN548_BLUETECHNIX_CM) += cm_bf548.o
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c
index 3b74f96d3590..4f4ae8787edf 100644
--- a/arch/blackfin/mach-bf548/boards/cm_bf548.c
+++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c
@@ -684,7 +684,7 @@ static struct platform_device *cm_bf548_devices[] __initdata = {
684 684
685static int __init cm_bf548_init(void) 685static int __init cm_bf548_init(void)
686{ 686{
687 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); 687 printk(KERN_INFO "%s(): registering device resources\n", __func__);
688 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices)); 688 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
689 689
690#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 690#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index d1682bb37509..af7c211a580e 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -412,8 +412,6 @@ static struct platform_device ezkit_flash_device = {
412}; 412};
413#endif 413#endif
414 414
415#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
416/* all SPI peripherals info goes here */
417#if defined(CONFIG_MTD_M25P80) \ 415#if defined(CONFIG_MTD_M25P80) \
418 || defined(CONFIG_MTD_M25P80_MODULE) 416 || defined(CONFIG_MTD_M25P80_MODULE)
419/* SPI flash chip (m25p16) */ 417/* SPI flash chip (m25p16) */
@@ -481,7 +479,7 @@ static struct bfin5xx_spi_chip spidev_chip_info = {
481}; 479};
482#endif 480#endif
483 481
484static struct spi_board_info bf54x_spi_board_info[] __initdata = { 482static struct spi_board_info bfin_spi_board_info[] __initdata = {
485#if defined(CONFIG_MTD_M25P80) \ 483#if defined(CONFIG_MTD_M25P80) \
486 || defined(CONFIG_MTD_M25P80_MODULE) 484 || defined(CONFIG_MTD_M25P80_MODULE)
487 { 485 {
@@ -527,6 +525,7 @@ static struct spi_board_info bf54x_spi_board_info[] __initdata = {
527#endif 525#endif
528}; 526};
529 527
528#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
530/* SPI (0) */ 529/* SPI (0) */
531static struct resource bfin_spi0_resource[] = { 530static struct resource bfin_spi0_resource[] = {
532 [0] = { 531 [0] = {
@@ -800,10 +799,7 @@ static int __init ezkit_init(void)
800 799
801 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); 800 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
802 801
803#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 802 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
804 spi_register_board_info(bf54x_spi_board_info,
805 ARRAY_SIZE(bf54x_spi_board_info));
806#endif
807 803
808 return 0; 804 return 0;
809} 805}
diff --git a/arch/blackfin/mach-bf548/boards/led.S b/arch/blackfin/mach-bf548/boards/led.S
deleted file mode 100644
index f47daf3770d0..000000000000
--- a/arch/blackfin/mach-bf548/boards/led.S
+++ /dev/null
@@ -1,172 +0,0 @@
1/****************************************************
2 * LED1 ---- PG6 LED2 ---- PG7 *
3 * LED3 ---- PG8 LED4 ---- PG9 *
4 * LED5 ---- PG10 LED6 ---- PG11 *
5 ****************************************************/
6
7#include <linux/linkage.h>
8#include <asm/blackfin.h>
9
10/* All functions in this file save the registers they uses.
11 So there is no need to save any registers before calling them. */
12
13 .text;
14
15/* Initialize LEDs. */
16
17ENTRY(_led_init)
18 LINK 0;
19 [--SP] = P0;
20 [--SP] = R0;
21 [--SP] = R1;
22 [--SP] = R2;
23 R1 = (PG6|PG7|PG8|PG9|PG10|PG11)(Z);
24 R2 = ~R1;
25
26 P0.H = hi(PORTG_FER);
27 P0.L = lo(PORTG_FER);
28 R0 = W[P0](Z);
29 SSYNC;
30 R0 = R0 & R2;
31 W[P0] = R0.L;
32 SSYNC;
33
34 P0.H = hi(PORTG_DIR_SET);
35 P0.L = lo(PORTG_DIR_SET);
36 W[P0] = R1.L;
37 SSYNC;
38
39 P0.H = hi(PORTG_INEN);
40 P0.L = lo(PORTG_INEN);
41 R0 = W[P0](Z);
42 SSYNC;
43 R0 = R0 & R2;
44 W[P0] = R0.L;
45 SSYNC;
46
47 R2 = [SP++];
48 R1 = [SP++];
49 R0 = [SP++];
50 P0 = [SP++];
51 RTS;
52 .size _led_init, .-_led_init
53
54/* Set one LED on. Leave other LEDs unchanged.
55 It expects the LED number passed through R0. */
56
57ENTRY(_led_on)
58 LINK 0;
59 [--SP] = P0;
60 [--SP] = R1;
61 CALL _led_init;
62 R1 = 1;
63 R0 += 5;
64 R1 <<= R0;
65 P0.H = hi(PORTG_SET);
66 P0.L = lo(PORTG_SET);
67 W[P0] = R1.L;
68 SSYNC;
69 R1 = [SP++];
70 P0 = [SP++];
71 UNLINK;
72 RTS;
73 .size _led_on, .-_led_on
74
75/* Set one LED off. Leave other LEDs unchanged. */
76
77ENTRY(_led_off)
78 LINK 0;
79 [--SP] = P0;
80 [--SP] = R1;
81 CALL _led_init;
82 R1 = 1;
83 R0 += 5;
84 R1 <<= R0;
85 P0.H = hi(PORTG_CLEAR);
86 P0.L = lo(PORTG_CLEAR);
87 W[P0] = R1.L;
88 SSYNC;
89 R1 = [SP++];
90 P0 = [SP++];
91 UNLINK;
92 RTS;
93 .size _led_off, .-_led_off
94
95/* Toggle one LED. Leave other LEDs unchanged. */
96
97ENTRY(_led_toggle)
98 LINK 0;
99 [--SP] = P0;
100 [--SP] = R1;
101 CALL _led_init;
102 R1 = 1;
103 R0 += 5;
104 R1 <<= R0;
105 P0.H = hi(PORTG);
106 P0.L = lo(PORTG);
107 R0 = W[P0](Z);
108 SSYNC;
109 R0 = R0 ^ R1;
110 W[P0] = R0.L;
111 SSYNC;
112 R1 = [SP++];
113 P0 = [SP++];
114 UNLINK;
115 RTS;
116 .size _led_toggle, .-_led_toggle
117
118/* Display the number using LEDs in binary format. */
119
120ENTRY(_led_disp_num)
121 LINK 0;
122 [--SP] = P0;
123 [--SP] = R1;
124 [--SP] = R2;
125 CALL _led_init;
126 R1 = 0x3f(X);
127 R0 = R0 & R1;
128 R2 = 6(X);
129 R0 <<= R2;
130 R1 <<= R2;
131 P0.H = hi(PORTG);
132 P0.L = lo(PORTG);
133 R2 = W[P0](Z);
134 SSYNC;
135 R1 = ~R1;
136 R2 = R2 & R1;
137 R2 = R2 | R0;
138 W[P0] = R2.L;
139 SSYNC;
140 R2 = [SP++];
141 R1 = [SP++];
142 P0 = [SP++];
143 UNLINK;
144 RTS;
145 .size _led_disp_num, .-_led_disp_num
146
147/* Toggle the number using LEDs in binary format. */
148
149ENTRY(_led_toggle_num)
150 LINK 0;
151 [--SP] = P0;
152 [--SP] = R1;
153 [--SP] = R2;
154 CALL _led_init;
155 R1 = 0x3f(X);
156 R0 = R0 & R1;
157 R1 = 6(X);
158 R0 <<= R1;
159 P0.H = hi(PORTG);
160 P0.L = lo(PORTG);
161 R1 = W[P0](Z);
162 SSYNC;
163 R1 = R1 ^ R0;
164 W[P0] = R1.L;
165 SSYNC;
166 R2 = [SP++];
167 R1 = [SP++];
168 P0 = [SP++];
169 UNLINK;
170 RTS;
171 .size _led_toggle_num, .-_led_toggle_num
172
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 61d8f7648b24..bc6feded8569 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -280,7 +280,6 @@ static struct platform_device ezkit_flash_device = {
280}; 280};
281#endif 281#endif
282 282
283#ifdef CONFIG_SPI_BFIN
284#if defined(CONFIG_SND_BLACKFIN_AD1836) \ 283#if defined(CONFIG_SND_BLACKFIN_AD1836) \
285 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) 284 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
286static struct bfin5xx_spi_chip ad1836_spi_chip_info = { 285static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
@@ -295,8 +294,8 @@ static struct bfin5xx_spi_chip spidev_chip_info = {
295 .bits_per_word = 8, 294 .bits_per_word = 8,
296}; 295};
297#endif 296#endif
298#endif
299 297
298#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
300/* SPI (0) */ 299/* SPI (0) */
301static struct resource bfin_spi0_resource[] = { 300static struct resource bfin_spi0_resource[] = {
302 [0] = { 301 [0] = {
@@ -327,6 +326,7 @@ static struct platform_device bfin_spi0_device = {
327 .platform_data = &bfin_spi0_info, /* Passed to driver */ 326 .platform_data = &bfin_spi0_info, /* Passed to driver */
328 }, 327 },
329}; 328};
329#endif
330 330
331static struct spi_board_info bfin_spi_board_info[] __initdata = { 331static struct spi_board_info bfin_spi_board_info[] __initdata = {
332#if defined(CONFIG_SND_BLACKFIN_AD1836) \ 332#if defined(CONFIG_SND_BLACKFIN_AD1836) \
@@ -537,10 +537,7 @@ static int __init ezkit_init(void)
537 SSYNC(); 537 SSYNC();
538#endif 538#endif
539 539
540#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 540 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
541 spi_register_board_info(bfin_spi_board_info,
542 ARRAY_SIZE(bfin_spi_board_info));
543#endif
544 541
545#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 542#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
546 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; 543 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index ef2db8fd102a..5933656db5a2 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -38,7 +38,6 @@
38 */ 38 */
39 39
40static struct fs_struct init_fs = INIT_FS; 40static struct fs_struct init_fs = INIT_FS;
41static struct files_struct init_files = INIT_FILES;
42static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 41static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
43static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 42static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
44struct mm_struct init_mm = INIT_MM(init_mm); 43struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/frv/kernel/cmode.S b/arch/frv/kernel/cmode.S
index 81ba28ad2207..53deeb5d7e87 100644
--- a/arch/frv/kernel/cmode.S
+++ b/arch/frv/kernel/cmode.S
@@ -1,7 +1,7 @@
1/* cmode.S: clock mode management 1/* cmode.S: clock mode management
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Woodhouse (dwmw2@redhat.com) 4 * Written by David Woodhouse (dwmw2@infradead.org)
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
diff --git a/arch/frv/kernel/init_task.c b/arch/frv/kernel/init_task.c
index 22993932b3fc..e2198815b630 100644
--- a/arch/frv/kernel/init_task.c
+++ b/arch/frv/kernel/init_task.c
@@ -11,7 +11,6 @@
11 11
12 12
13static struct fs_struct init_fs = INIT_FS; 13static struct fs_struct init_fs = INIT_FS;
14static struct files_struct init_files = INIT_FILES;
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm); 16struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/frv/kernel/sleep.S b/arch/frv/kernel/sleep.S
index c9b2d51ab9ad..f67bf73cd2cc 100644
--- a/arch/frv/kernel/sleep.S
+++ b/arch/frv/kernel/sleep.S
@@ -1,7 +1,7 @@
1/* sleep.S: power saving mode entry 1/* sleep.S: power saving mode entry
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Woodhouse (dwmw2@redhat.com) 4 * Written by David Woodhouse (dwmw2@infradead.org)
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
diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c
index 4985466b1a7c..64ee58d748be 100644
--- a/arch/frv/mb93090-mb00/pci-dma-nommu.c
+++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c
@@ -1,7 +1,7 @@
1/* pci-dma-nommu.c: Dynamic DMA mapping support for the FRV 1/* pci-dma-nommu.c: Dynamic DMA mapping support for the FRV
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Woodhouse (dwmw2@redhat.com) 4 * Written by David Woodhouse (dwmw2@infradead.org)
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
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index b841ecfd5d5a..9af7740f32fb 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -26,6 +26,7 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/bootmem.h> 27#include <linux/bootmem.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/module.h>
29 30
30#include <asm/setup.h> 31#include <asm/setup.h>
31#include <asm/segment.h> 32#include <asm/segment.h>
@@ -56,7 +57,9 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
56 */ 57 */
57static unsigned long empty_bad_page_table; 58static unsigned long empty_bad_page_table;
58static unsigned long empty_bad_page; 59static unsigned long empty_bad_page;
60
59unsigned long empty_zero_page; 61unsigned long empty_zero_page;
62EXPORT_SYMBOL(empty_zero_page);
60 63
61/*****************************************************************************/ 64/*****************************************************************************/
62/* 65/*
diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c
index 19272c2ac56a..93a4899e46c2 100644
--- a/arch/h8300/kernel/init_task.c
+++ b/arch/h8300/kernel/init_task.c
@@ -13,7 +13,6 @@
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14 14
15static struct fs_struct init_fs = INIT_FS; 15static struct fs_struct init_fs = INIT_FS;
16static struct files_struct init_files = INIT_FILES;
17static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 16static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
18static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
19struct mm_struct init_mm = INIT_MM(init_mm); 18struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 0df5f6f75edf..16be41446b5b 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -135,6 +135,7 @@ config IA64_GENERIC
135 HP-zx1/sx1000 For HP systems 135 HP-zx1/sx1000 For HP systems
136 HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices. 136 HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices.
137 SGI-SN2 For SGI Altix systems 137 SGI-SN2 For SGI Altix systems
138 SGI-UV For SGI UV systems
138 Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/> 139 Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/>
139 140
140 If you don't know what to do, choose "generic". 141 If you don't know what to do, choose "generic".
@@ -170,6 +171,18 @@ config IA64_SGI_SN2
170 to select this option. If in doubt, select ia64 generic support 171 to select this option. If in doubt, select ia64 generic support
171 instead. 172 instead.
172 173
174config IA64_SGI_UV`
175 bool "SGI-UV`"
176 select NUMA
177 select ACPI_NUMA
178 select SWIOTLB
179 help
180 Selecting this option will optimize the kernel for use on UV based
181 systems, but the resulting kernel binary will not run on other
182 types of ia64 systems. If you have an SGI UV system, it's safe
183 to select this option. If in doubt, select ia64 generic support
184 instead.
185
173config IA64_HP_SIM 186config IA64_HP_SIM
174 bool "Ski-simulator" 187 bool "Ski-simulator"
175 select SWIOTLB 188 select SWIOTLB
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index ec4cca477f49..88f1a55c6c94 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -63,7 +63,7 @@ drivers-$(CONFIG_PCI) += arch/ia64/pci/
63drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/ 63drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/
64drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ 64drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
65drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ 65drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
66drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/ 66drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/ arch/ia64/uv/
67drivers-$(CONFIG_OPROFILE) += arch/ia64/oprofile/ 67drivers-$(CONFIG_OPROFILE) += arch/ia64/oprofile/
68 68
69boot := arch/ia64/hp/sim/boot 69boot := arch/ia64/hp/sim/boot
diff --git a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c
index 896b1ebbfb26..a6965ddafc46 100644
--- a/arch/ia64/ia32/ia32_support.c
+++ b/arch/ia64/ia32/ia32_support.c
@@ -15,7 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/personality.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20 19
21#include <asm/intrinsics.h> 20#include <asm/intrinsics.h>
@@ -29,7 +28,6 @@
29 28
30extern int die_if_kernel (char *str, struct pt_regs *regs, long err); 29extern int die_if_kernel (char *str, struct pt_regs *regs, long err);
31 30
32struct exec_domain ia32_exec_domain;
33struct page *ia32_shared_page[NR_CPUS]; 31struct page *ia32_shared_page[NR_CPUS];
34unsigned long *ia32_boot_gdt; 32unsigned long *ia32_boot_gdt;
35unsigned long *cpu_gdt_table[NR_CPUS]; 33unsigned long *cpu_gdt_table[NR_CPUS];
@@ -240,14 +238,6 @@ ia32_cpu_init (void)
240static int __init 238static int __init
241ia32_init (void) 239ia32_init (void)
242{ 240{
243 ia32_exec_domain.name = "Linux/x86";
244 ia32_exec_domain.handler = NULL;
245 ia32_exec_domain.pers_low = PER_LINUX32;
246 ia32_exec_domain.pers_high = PER_LINUX32;
247 ia32_exec_domain.signal_map = default_exec_domain.signal_map;
248 ia32_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
249 register_exec_domain(&ia32_exec_domain);
250
251#if PAGE_SHIFT > IA32_PAGE_SHIFT 241#if PAGE_SHIFT > IA32_PAGE_SHIFT
252 { 242 {
253 extern struct kmem_cache *ia64_partial_page_cachep; 243 extern struct kmem_cache *ia64_partial_page_cachep;
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 19709a079635..43687cc60dfb 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -117,7 +117,10 @@ acpi_get_sysname(void)
117 if (!strcmp(hdr->oem_id, "HP")) { 117 if (!strcmp(hdr->oem_id, "HP")) {
118 return "hpzx1"; 118 return "hpzx1";
119 } else if (!strcmp(hdr->oem_id, "SGI")) { 119 } else if (!strcmp(hdr->oem_id, "SGI")) {
120 return "sn2"; 120 if (!strcmp(hdr->oem_table_id + 4, "UV"))
121 return "uv";
122 else
123 return "sn2";
121 } 124 }
122 125
123 return "dig"; 126 return "dig";
@@ -130,6 +133,8 @@ acpi_get_sysname(void)
130 return "hpzx1_swiotlb"; 133 return "hpzx1_swiotlb";
131# elif defined (CONFIG_IA64_SGI_SN2) 134# elif defined (CONFIG_IA64_SGI_SN2)
132 return "sn2"; 135 return "sn2";
136# elif defined (CONFIG_IA64_SGI_UV)
137 return "uv";
133# elif defined (CONFIG_IA64_DIG) 138# elif defined (CONFIG_IA64_DIG)
134 return "dig"; 139 return "dig";
135# else 140# else
@@ -460,7 +465,6 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
460 printk(KERN_ERR 465 printk(KERN_ERR
461 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", 466 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
462 len, slit->header.length); 467 len, slit->header.length);
463 memset(numa_slit, 10, sizeof(numa_slit));
464 return; 468 return;
465 } 469 }
466 slit_table = slit; 470 slit_table = slit;
@@ -569,8 +573,14 @@ void __init acpi_numa_arch_fixup(void)
569 printk(KERN_INFO "Number of memory chunks in system = %d\n", 573 printk(KERN_INFO "Number of memory chunks in system = %d\n",
570 num_node_memblks); 574 num_node_memblks);
571 575
572 if (!slit_table) 576 if (!slit_table) {
577 for (i = 0; i < MAX_NUMNODES; i++)
578 for (j = 0; j < MAX_NUMNODES; j++)
579 node_distance(i, j) = i == j ? LOCAL_DISTANCE :
580 REMOTE_DISTANCE;
573 return; 581 return;
582 }
583
574 memset(numa_slit, -1, sizeof(numa_slit)); 584 memset(numa_slit, -1, sizeof(numa_slit));
575 for (i = 0; i < slit_table->locality_count; i++) { 585 for (i = 0; i < slit_table->locality_count; i++) {
576 if (!pxm_bit_test(i)) 586 if (!pxm_bit_test(i))
@@ -622,6 +632,9 @@ void acpi_unregister_gsi(u32 gsi)
622 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM) 632 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
623 return; 633 return;
624 634
635 if (has_8259 && gsi < 16)
636 return;
637
625 iosapic_unregister_intr(gsi); 638 iosapic_unregister_intr(gsi);
626} 639}
627 640
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index e49ad8c5dc69..ca2bb95726de 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1156,6 +1156,9 @@ skip_rbs_switch:
1156 * r31 = current->thread_info->flags 1156 * r31 = current->thread_info->flags
1157 * On exit: 1157 * On exit:
1158 * p6 = TRUE if work-pending-check needs to be redone 1158 * p6 = TRUE if work-pending-check needs to be redone
1159 *
1160 * Interrupts are disabled on entry, reenabled depend on work, and
1161 * disabled on exit.
1159 */ 1162 */
1160.work_pending_syscall: 1163.work_pending_syscall:
1161 add r2=-8,r2 1164 add r2=-8,r2
@@ -1164,16 +1167,16 @@ skip_rbs_switch:
1164 st8 [r2]=r8 1167 st8 [r2]=r8
1165 st8 [r3]=r10 1168 st8 [r3]=r10
1166.work_pending: 1169.work_pending:
1167 tbit.z p6,p0=r31,TIF_NEED_RESCHED // current_thread_info()->need_resched==0? 1170 tbit.z p6,p0=r31,TIF_NEED_RESCHED // is resched not needed?
1168(p6) br.cond.sptk.few .notify 1171(p6) br.cond.sptk.few .notify
1169#ifdef CONFIG_PREEMPT 1172#ifdef CONFIG_PREEMPT
1170(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1 1173(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1
1171 ;; 1174 ;;
1172(pKStk) st4 [r20]=r21 1175(pKStk) st4 [r20]=r21
1173 ssm psr.i // enable interrupts
1174#endif 1176#endif
1177 ssm psr.i // enable interrupts
1175 br.call.spnt.many rp=schedule 1178 br.call.spnt.many rp=schedule
1176.ret9: cmp.eq p6,p0=r0,r0 // p6 <- 1 1179.ret9: cmp.eq p6,p0=r0,r0 // p6 <- 1 (re-check)
1177 rsm psr.i // disable interrupts 1180 rsm psr.i // disable interrupts
1178 ;; 1181 ;;
1179#ifdef CONFIG_PREEMPT 1182#ifdef CONFIG_PREEMPT
@@ -1182,13 +1185,13 @@ skip_rbs_switch:
1182(pKStk) st4 [r20]=r0 // preempt_count() <- 0 1185(pKStk) st4 [r20]=r0 // preempt_count() <- 0
1183#endif 1186#endif
1184(pLvSys)br.cond.sptk.few .work_pending_syscall_end 1187(pLvSys)br.cond.sptk.few .work_pending_syscall_end
1185 br.cond.sptk.many .work_processed_kernel // re-check 1188 br.cond.sptk.many .work_processed_kernel
1186 1189
1187.notify: 1190.notify:
1188(pUStk) br.call.spnt.many rp=notify_resume_user 1191(pUStk) br.call.spnt.many rp=notify_resume_user
1189.ret10: cmp.ne p6,p0=r0,r0 // p6 <- 0 1192.ret10: cmp.ne p6,p0=r0,r0 // p6 <- 0 (don't re-check)
1190(pLvSys)br.cond.sptk.few .work_pending_syscall_end 1193(pLvSys)br.cond.sptk.few .work_pending_syscall_end
1191 br.cond.sptk.many .work_processed_kernel // don't re-check 1194 br.cond.sptk.many .work_processed_kernel
1192 1195
1193.work_pending_syscall_end: 1196.work_pending_syscall_end:
1194 adds r2=PT(R8)+16,r12 1197 adds r2=PT(R8)+16,r12
@@ -1196,7 +1199,7 @@ skip_rbs_switch:
1196 ;; 1199 ;;
1197 ld8 r8=[r2] 1200 ld8 r8=[r2]
1198 ld8 r10=[r3] 1201 ld8 r10=[r3]
1199 br.cond.sptk.many .work_processed_syscall // re-check 1202 br.cond.sptk.many .work_processed_syscall
1200 1203
1201END(ia64_leave_kernel) 1204END(ia64_leave_kernel)
1202 1205
@@ -1234,9 +1237,12 @@ GLOBAL_ENTRY(ia64_invoke_schedule_tail)
1234END(ia64_invoke_schedule_tail) 1237END(ia64_invoke_schedule_tail)
1235 1238
1236 /* 1239 /*
1237 * Setup stack and call do_notify_resume_user(). Note that pSys and pNonSys need to 1240 * Setup stack and call do_notify_resume_user(), keeping interrupts
1238 * be set up by the caller. We declare 8 input registers so the system call 1241 * disabled.
1239 * args get preserved, in case we need to restart a system call. 1242 *
1243 * Note that pSys and pNonSys need to be set up by the caller.
1244 * We declare 8 input registers so the system call args get preserved,
1245 * in case we need to restart a system call.
1240 */ 1246 */
1241ENTRY(notify_resume_user) 1247ENTRY(notify_resume_user)
1242 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) 1248 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
diff --git a/arch/ia64/kernel/init_task.c b/arch/ia64/kernel/init_task.c
index bc8efcad28b8..9d7e1c66faf4 100644
--- a/arch/ia64/kernel/init_task.c
+++ b/arch/ia64/kernel/init_task.c
@@ -18,7 +18,6 @@
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19 19
20static struct fs_struct init_fs = INIT_FS; 20static struct fs_struct init_fs = INIT_FS;
21static struct files_struct init_files = INIT_FILES;
22static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 21static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
23static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
24struct mm_struct init_mm = INIT_MM(init_mm); 23struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index 6678c49daba3..80b44ea052d7 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -1076,48 +1076,6 @@ END(ia64_syscall_setup)
1076 DBG_FAULT(15) 1076 DBG_FAULT(15)
1077 FAULT(15) 1077 FAULT(15)
1078 1078
1079 /*
1080 * Squatting in this space ...
1081 *
1082 * This special case dispatcher for illegal operation faults allows preserved
1083 * registers to be modified through a callback function (asm only) that is handed
1084 * back from the fault handler in r8. Up to three arguments can be passed to the
1085 * callback function by returning an aggregate with the callback as its first
1086 * element, followed by the arguments.
1087 */
1088ENTRY(dispatch_illegal_op_fault)
1089 .prologue
1090 .body
1091 SAVE_MIN_WITH_COVER
1092 ssm psr.ic | PSR_DEFAULT_BITS
1093 ;;
1094 srlz.i // guarantee that interruption collection is on
1095 ;;
1096(p15) ssm psr.i // restore psr.i
1097 adds r3=8,r2 // set up second base pointer for SAVE_REST
1098 ;;
1099 alloc r14=ar.pfs,0,0,1,0 // must be first in insn group
1100 mov out0=ar.ec
1101 ;;
1102 SAVE_REST
1103 PT_REGS_UNWIND_INFO(0)
1104 ;;
1105 br.call.sptk.many rp=ia64_illegal_op_fault
1106.ret0: ;;
1107 alloc r14=ar.pfs,0,0,3,0 // must be first in insn group
1108 mov out0=r9
1109 mov out1=r10
1110 mov out2=r11
1111 movl r15=ia64_leave_kernel
1112 ;;
1113 mov rp=r15
1114 mov b6=r8
1115 ;;
1116 cmp.ne p6,p0=0,r8
1117(p6) br.call.dpnt.many b6=b6 // call returns to ia64_leave_kernel
1118 br.sptk.many ia64_leave_kernel
1119END(dispatch_illegal_op_fault)
1120
1121 .org ia64_ivt+0x4000 1079 .org ia64_ivt+0x4000
1122///////////////////////////////////////////////////////////////////////////////////////// 1080/////////////////////////////////////////////////////////////////////////////////////////
1123// 0x4000 Entry 16 (size 64 bundles) Reserved 1081// 0x4000 Entry 16 (size 64 bundles) Reserved
@@ -1715,6 +1673,48 @@ END(ia32_interrupt)
1715 DBG_FAULT(67) 1673 DBG_FAULT(67)
1716 FAULT(67) 1674 FAULT(67)
1717 1675
1676 /*
1677 * Squatting in this space ...
1678 *
1679 * This special case dispatcher for illegal operation faults allows preserved
1680 * registers to be modified through a callback function (asm only) that is handed
1681 * back from the fault handler in r8. Up to three arguments can be passed to the
1682 * callback function by returning an aggregate with the callback as its first
1683 * element, followed by the arguments.
1684 */
1685ENTRY(dispatch_illegal_op_fault)
1686 .prologue
1687 .body
1688 SAVE_MIN_WITH_COVER
1689 ssm psr.ic | PSR_DEFAULT_BITS
1690 ;;
1691 srlz.i // guarantee that interruption collection is on
1692 ;;
1693(p15) ssm psr.i // restore psr.i
1694 adds r3=8,r2 // set up second base pointer for SAVE_REST
1695 ;;
1696 alloc r14=ar.pfs,0,0,1,0 // must be first in insn group
1697 mov out0=ar.ec
1698 ;;
1699 SAVE_REST
1700 PT_REGS_UNWIND_INFO(0)
1701 ;;
1702 br.call.sptk.many rp=ia64_illegal_op_fault
1703.ret0: ;;
1704 alloc r14=ar.pfs,0,0,3,0 // must be first in insn group
1705 mov out0=r9
1706 mov out1=r10
1707 mov out2=r11
1708 movl r15=ia64_leave_kernel
1709 ;;
1710 mov rp=r15
1711 mov b6=r8
1712 ;;
1713 cmp.ne p6,p0=0,r8
1714(p6) br.call.dpnt.many b6=b6 // call returns to ia64_leave_kernel
1715 br.sptk.many ia64_leave_kernel
1716END(dispatch_illegal_op_fault)
1717
1718#ifdef CONFIG_IA32_SUPPORT 1718#ifdef CONFIG_IA32_SUPPORT
1719 1719
1720 /* 1720 /*
diff --git a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h
index 7c548ac52bbc..74b6d670aaef 100644
--- a/arch/ia64/kernel/minstate.h
+++ b/arch/ia64/kernel/minstate.h
@@ -15,6 +15,9 @@
15#define ACCOUNT_SYS_ENTER 15#define ACCOUNT_SYS_ENTER
16#endif 16#endif
17 17
18.section ".data.patch.rse", "a"
19.previous
20
18/* 21/*
19 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves 22 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
20 * the minimum state necessary that allows us to turn psr.ic back 23 * the minimum state necessary that allows us to turn psr.ic back
@@ -40,7 +43,7 @@
40 * Note that psr.ic is NOT turned on by this macro. This is so that 43 * Note that psr.ic is NOT turned on by this macro. This is so that
41 * we can pass interruption state as arguments to a handler. 44 * we can pass interruption state as arguments to a handler.
42 */ 45 */
43#define DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA) \ 46#define DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA,WORKAROUND) \
44 mov r16=IA64_KR(CURRENT); /* M */ \ 47 mov r16=IA64_KR(CURRENT); /* M */ \
45 mov r27=ar.rsc; /* M */ \ 48 mov r27=ar.rsc; /* M */ \
46 mov r20=r1; /* A */ \ 49 mov r20=r1; /* A */ \
@@ -87,6 +90,7 @@
87 tbit.nz p15,p0=r29,IA64_PSR_I_BIT; \ 90 tbit.nz p15,p0=r29,IA64_PSR_I_BIT; \
88 mov r29=b0 \ 91 mov r29=b0 \
89 ;; \ 92 ;; \
93 WORKAROUND; \
90 adds r16=PT(R8),r1; /* initialize first base pointer */ \ 94 adds r16=PT(R8),r1; /* initialize first base pointer */ \
91 adds r17=PT(R9),r1; /* initialize second base pointer */ \ 95 adds r17=PT(R9),r1; /* initialize second base pointer */ \
92(pKStk) mov r18=r0; /* make sure r18 isn't NaT */ \ 96(pKStk) mov r18=r0; /* make sure r18 isn't NaT */ \
@@ -206,6 +210,40 @@
206 st8 [r25]=r10; /* ar.ssd */ \ 210 st8 [r25]=r10; /* ar.ssd */ \
207 ;; 211 ;;
208 212
209#define SAVE_MIN_WITH_COVER DO_SAVE_MIN(cover, mov r30=cr.ifs,) 213#define RSE_WORKAROUND \
210#define SAVE_MIN_WITH_COVER_R19 DO_SAVE_MIN(cover, mov r30=cr.ifs, mov r15=r19) 214(pUStk) extr.u r17=r18,3,6; \
211#define SAVE_MIN DO_SAVE_MIN( , mov r30=r0, ) 215(pUStk) sub r16=r18,r22; \
216[1:](pKStk) br.cond.sptk.many 1f; \
217 .xdata4 ".data.patch.rse",1b-. \
218 ;; \
219 cmp.ge p6,p7 = 33,r17; \
220 ;; \
221(p6) mov r17=0x310; \
222(p7) mov r17=0x308; \
223 ;; \
224 cmp.leu p1,p0=r16,r17; \
225(p1) br.cond.sptk.many 1f; \
226 dep.z r17=r26,0,62; \
227 movl r16=2f; \
228 ;; \
229 mov ar.pfs=r17; \
230 dep r27=r0,r27,16,14; \
231 mov b0=r16; \
232 ;; \
233 br.ret.sptk b0; \
234 ;; \
2352: \
236 mov ar.rsc=r0 \
237 ;; \
238 flushrs; \
239 ;; \
240 mov ar.bspstore=r22 \
241 ;; \
242 mov r18=ar.bsp; \
243 ;; \
2441: \
245 .pred.rel "mutex", pKStk, pUStk
246
247#define SAVE_MIN_WITH_COVER DO_SAVE_MIN(cover, mov r30=cr.ifs, , RSE_WORKAROUND)
248#define SAVE_MIN_WITH_COVER_R19 DO_SAVE_MIN(cover, mov r30=cr.ifs, mov r15=r19, RSE_WORKAROUND)
249#define SAVE_MIN DO_SAVE_MIN( , mov r30=r0, , )
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 4547a2092af9..9dc00f7fe10e 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -900,12 +900,6 @@ static void
900palinfo_smp_call(void *info) 900palinfo_smp_call(void *info)
901{ 901{
902 palinfo_smp_data_t *data = (palinfo_smp_data_t *)info; 902 palinfo_smp_data_t *data = (palinfo_smp_data_t *)info;
903 if (data == NULL) {
904 printk(KERN_ERR "palinfo: data pointer is NULL\n");
905 data->ret = 0; /* no output */
906 return;
907 }
908 /* does this actual call */
909 data->ret = (*data->func)(data->page); 903 data->ret = (*data->func)(data->page);
910} 904}
911 905
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index e0dca8743dbb..b83b2c516008 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -115,6 +115,29 @@ ia64_patch_vtop (unsigned long start, unsigned long end)
115 ia64_srlz_i(); 115 ia64_srlz_i();
116} 116}
117 117
118/*
119 * Disable the RSE workaround by turning the conditional branch
120 * that we tagged in each place the workaround was used into an
121 * unconditional branch.
122 */
123void __init
124ia64_patch_rse (unsigned long start, unsigned long end)
125{
126 s32 *offp = (s32 *) start;
127 u64 ip, *b;
128
129 while (offp < (s32 *) end) {
130 ip = (u64) offp + *offp;
131
132 b = (u64 *)(ip & -16);
133 b[1] &= ~0xf800000L;
134 ia64_fc((void *) ip);
135 ++offp;
136 }
137 ia64_sync_i();
138 ia64_srlz_i();
139}
140
118void __init 141void __init
119ia64_patch_mckinley_e9 (unsigned long start, unsigned long end) 142ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
120{ 143{
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index c1ad27de2dd2..71d05133f556 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -5013,12 +5013,13 @@ pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs)
5013} 5013}
5014 5014
5015static int pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds); 5015static int pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds);
5016
5016 /* 5017 /*
5017 * pfm_handle_work() can be called with interrupts enabled 5018 * pfm_handle_work() can be called with interrupts enabled
5018 * (TIF_NEED_RESCHED) or disabled. The down_interruptible 5019 * (TIF_NEED_RESCHED) or disabled. The down_interruptible
5019 * call may sleep, therefore we must re-enable interrupts 5020 * call may sleep, therefore we must re-enable interrupts
5020 * to avoid deadlocks. It is safe to do so because this function 5021 * to avoid deadlocks. It is safe to do so because this function
5021 * is called ONLY when returning to user level (PUStk=1), in which case 5022 * is called ONLY when returning to user level (pUStk=1), in which case
5022 * there is no risk of kernel stack overflow due to deep 5023 * there is no risk of kernel stack overflow due to deep
5023 * interrupt nesting. 5024 * interrupt nesting.
5024 */ 5025 */
@@ -5034,7 +5035,8 @@ pfm_handle_work(void)
5034 5035
5035 ctx = PFM_GET_CTX(current); 5036 ctx = PFM_GET_CTX(current);
5036 if (ctx == NULL) { 5037 if (ctx == NULL) {
5037 printk(KERN_ERR "perfmon: [%d] has no PFM context\n", task_pid_nr(current)); 5038 printk(KERN_ERR "perfmon: [%d] has no PFM context\n",
5039 task_pid_nr(current));
5038 return; 5040 return;
5039 } 5041 }
5040 5042
@@ -5058,11 +5060,12 @@ pfm_handle_work(void)
5058 /* 5060 /*
5059 * must be done before we check for simple-reset mode 5061 * must be done before we check for simple-reset mode
5060 */ 5062 */
5061 if (ctx->ctx_fl_going_zombie || ctx->ctx_state == PFM_CTX_ZOMBIE) goto do_zombie; 5063 if (ctx->ctx_fl_going_zombie || ctx->ctx_state == PFM_CTX_ZOMBIE)
5062 5064 goto do_zombie;
5063 5065
5064 //if (CTX_OVFL_NOBLOCK(ctx)) goto skip_blocking; 5066 //if (CTX_OVFL_NOBLOCK(ctx)) goto skip_blocking;
5065 if (reason == PFM_TRAP_REASON_RESET) goto skip_blocking; 5067 if (reason == PFM_TRAP_REASON_RESET)
5068 goto skip_blocking;
5066 5069
5067 /* 5070 /*
5068 * restore interrupt mask to what it was on entry. 5071 * restore interrupt mask to what it was on entry.
@@ -5110,7 +5113,8 @@ do_zombie:
5110 /* 5113 /*
5111 * in case of interruption of down() we don't restart anything 5114 * in case of interruption of down() we don't restart anything
5112 */ 5115 */
5113 if (ret < 0) goto nothing_to_do; 5116 if (ret < 0)
5117 goto nothing_to_do;
5114 5118
5115skip_blocking: 5119skip_blocking:
5116 pfm_resume_after_ovfl(ctx, ovfl_regs, regs); 5120 pfm_resume_after_ovfl(ctx, ovfl_regs, regs);
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 58dcfac5ea88..a3a34b4eb038 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -167,11 +167,18 @@ void tsk_clear_notify_resume(struct task_struct *tsk)
167 clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME); 167 clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME);
168} 168}
169 169
170/*
171 * do_notify_resume_user():
172 * Called from notify_resume_user at entry.S, with interrupts disabled.
173 */
170void 174void
171do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall) 175do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
172{ 176{
173 if (fsys_mode(current, &scr->pt)) { 177 if (fsys_mode(current, &scr->pt)) {
174 /* defer signal-handling etc. until we return to privilege-level 0. */ 178 /*
179 * defer signal-handling etc. until we return to
180 * privilege-level 0.
181 */
175 if (!ia64_psr(&scr->pt)->lp) 182 if (!ia64_psr(&scr->pt)->lp)
176 ia64_psr(&scr->pt)->lp = 1; 183 ia64_psr(&scr->pt)->lp = 1;
177 return; 184 return;
@@ -179,16 +186,26 @@ do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall
179 186
180#ifdef CONFIG_PERFMON 187#ifdef CONFIG_PERFMON
181 if (current->thread.pfm_needs_checking) 188 if (current->thread.pfm_needs_checking)
189 /*
190 * Note: pfm_handle_work() allow us to call it with interrupts
191 * disabled, and may enable interrupts within the function.
192 */
182 pfm_handle_work(); 193 pfm_handle_work();
183#endif 194#endif
184 195
185 /* deal with pending signal delivery */ 196 /* deal with pending signal delivery */
186 if (test_thread_flag(TIF_SIGPENDING)) 197 if (test_thread_flag(TIF_SIGPENDING)) {
198 local_irq_enable(); /* force interrupt enable */
187 ia64_do_signal(scr, in_syscall); 199 ia64_do_signal(scr, in_syscall);
200 }
188 201
189 /* copy user rbs to kernel rbs */ 202 /* copy user rbs to kernel rbs */
190 if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) 203 if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) {
204 local_irq_enable(); /* force interrupt enable */
191 ia64_sync_krbs(); 205 ia64_sync_krbs();
206 }
207
208 local_irq_disable(); /* force interrupt disable */
192} 209}
193 210
194static int pal_halt = 1; 211static int pal_halt = 1;
diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
index a3022dc48ef8..7e0259709c04 100644
--- a/arch/ia64/kernel/sal.c
+++ b/arch/ia64/kernel/sal.c
@@ -229,6 +229,14 @@ static void __init sal_desc_ap_wakeup(void *p) { }
229 */ 229 */
230static int sal_cache_flush_drops_interrupts; 230static int sal_cache_flush_drops_interrupts;
231 231
232static int __init
233force_pal_cache_flush(char *str)
234{
235 sal_cache_flush_drops_interrupts = 1;
236 return 0;
237}
238early_param("force_pal_cache_flush", force_pal_cache_flush);
239
232void __init 240void __init
233check_sal_cache_flush (void) 241check_sal_cache_flush (void)
234{ 242{
@@ -237,6 +245,9 @@ check_sal_cache_flush (void)
237 u64 vector, cache_type = 3; 245 u64 vector, cache_type = 3;
238 struct ia64_sal_retval isrv; 246 struct ia64_sal_retval isrv;
239 247
248 if (sal_cache_flush_drops_interrupts)
249 return;
250
240 cpu = get_cpu(); 251 cpu = get_cpu();
241 local_irq_save(flags); 252 local_irq_save(flags);
242 253
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5015ca1275ca..f48a809c686d 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -239,6 +239,25 @@ __initcall(register_memory);
239 239
240 240
241#ifdef CONFIG_KEXEC 241#ifdef CONFIG_KEXEC
242
243/*
244 * This function checks if the reserved crashkernel is allowed on the specific
245 * IA64 machine flavour. Machines without an IO TLB use swiotlb and require
246 * some memory below 4 GB (i.e. in 32 bit area), see the implementation of
247 * lib/swiotlb.c. The hpzx1 architecture has an IO TLB but cannot use that
248 * in kdump case. See the comment in sba_init() in sba_iommu.c.
249 *
250 * So, the only machvec that really supports loading the kdump kernel
251 * over 4 GB is "sn2".
252 */
253static int __init check_crashkernel_memory(unsigned long pbase, size_t size)
254{
255 if (ia64_platform_is("sn2") || ia64_platform_is("uv"))
256 return 1;
257 else
258 return pbase < (1UL << 32);
259}
260
242static void __init setup_crashkernel(unsigned long total, int *n) 261static void __init setup_crashkernel(unsigned long total, int *n)
243{ 262{
244 unsigned long long base = 0, size = 0; 263 unsigned long long base = 0, size = 0;
@@ -252,6 +271,16 @@ static void __init setup_crashkernel(unsigned long total, int *n)
252 base = kdump_find_rsvd_region(size, 271 base = kdump_find_rsvd_region(size,
253 rsvd_region, *n); 272 rsvd_region, *n);
254 } 273 }
274
275 if (!check_crashkernel_memory(base, size)) {
276 pr_warning("crashkernel: There would be kdump memory "
277 "at %ld GB but this is unusable because it "
278 "must\nbe below 4 GB. Change the memory "
279 "configuration of the machine.\n",
280 (unsigned long)(base >> 30));
281 return;
282 }
283
255 if (base != ~0UL) { 284 if (base != ~0UL) {
256 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " 285 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
257 "for crashkernel (System RAM: %ldMB)\n", 286 "for crashkernel (System RAM: %ldMB)\n",
@@ -531,6 +560,17 @@ setup_arch (char **cmdline_p)
531 /* process SAL system table: */ 560 /* process SAL system table: */
532 ia64_sal_init(__va(efi.sal_systab)); 561 ia64_sal_init(__va(efi.sal_systab));
533 562
563#ifdef CONFIG_ITANIUM
564 ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist);
565#else
566 {
567 u64 num_phys_stacked;
568
569 if (ia64_pal_rse_info(&num_phys_stacked, 0) == 0 && num_phys_stacked > 96)
570 ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist);
571 }
572#endif
573
534#ifdef CONFIG_SMP 574#ifdef CONFIG_SMP
535 cpu_physical_id(0) = hard_smp_processor_id(); 575 cpu_physical_id(0) = hard_smp_processor_id();
536#endif 576#endif
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 80622acc95de..5929ab10a289 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -156,6 +156,13 @@ SECTIONS
156 __end___vtop_patchlist = .; 156 __end___vtop_patchlist = .;
157 } 157 }
158 158
159 .data.patch.rse : AT(ADDR(.data.patch.rse) - LOAD_OFFSET)
160 {
161 __start___rse_patchlist = .;
162 *(.data.patch.rse)
163 __end___rse_patchlist = .;
164 }
165
159 .data.patch.mckinley_e9 : AT(ADDR(.data.patch.mckinley_e9) - LOAD_OFFSET) 166 .data.patch.mckinley_e9 : AT(ADDR(.data.patch.mckinley_e9) - LOAD_OFFSET)
160 { 167 {
161 __start___mckinley_e9_bundles = .; 168 __start___mckinley_e9_bundles = .;
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile
index 52353397a1a4..112791dd2542 100644
--- a/arch/ia64/kvm/Makefile
+++ b/arch/ia64/kvm/Makefile
@@ -7,7 +7,6 @@ offsets-file := asm-offsets.h
7always := $(offsets-file) 7always := $(offsets-file)
8targets := $(offsets-file) 8targets := $(offsets-file)
9targets += arch/ia64/kvm/asm-offsets.s 9targets += arch/ia64/kvm/asm-offsets.s
10clean-files := $(addprefix $(objtree)/,$(targets) $(obj)/memcpy.S $(obj)/memset.S)
11 10
12# Default sed regexp - multiline due to syntax constraints 11# Default sed regexp - multiline due to syntax constraints
13define sed-y 12define sed-y
@@ -54,5 +53,5 @@ EXTRA_CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127
54kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ 53kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \
55 vtlb.o process.o 54 vtlb.o process.o
56#Add link memcpy and memset to avoid possible structure assignment error 55#Add link memcpy and memset to avoid possible structure assignment error
57kvm-intel-objs += ../lib/memset.o ../lib/memcpy.o 56kvm-intel-objs += memcpy.o memset.o
58obj-$(CONFIG_KVM_INTEL) += kvm-intel.o 57obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
diff --git a/arch/ia64/kvm/memcpy.S b/arch/ia64/kvm/memcpy.S
new file mode 100644
index 000000000000..c04cdbe9f80f
--- /dev/null
+++ b/arch/ia64/kvm/memcpy.S
@@ -0,0 +1 @@
#include "../lib/memcpy.S"
diff --git a/arch/ia64/kvm/memset.S b/arch/ia64/kvm/memset.S
new file mode 100644
index 000000000000..83c3066d844a
--- /dev/null
+++ b/arch/ia64/kvm/memset.S
@@ -0,0 +1 @@
#include "../lib/memset.S"
diff --git a/arch/ia64/kvm/mmio.c b/arch/ia64/kvm/mmio.c
index 351bf70da463..7f1a858bc69f 100644
--- a/arch/ia64/kvm/mmio.c
+++ b/arch/ia64/kvm/mmio.c
@@ -159,7 +159,8 @@ static void mmio_access(struct kvm_vcpu *vcpu, u64 src_pa, u64 *dest,
159 159
160 if (p->u.ioreq.state == STATE_IORESP_READY) { 160 if (p->u.ioreq.state == STATE_IORESP_READY) {
161 if (dir == IOREQ_READ) 161 if (dir == IOREQ_READ)
162 *dest = p->u.ioreq.data; 162 /* it's necessary to ensure zero extending */
163 *dest = p->u.ioreq.data & (~0UL >> (64-(s*8)));
163 } else 164 } else
164 panic_vm(vcpu); 165 panic_vm(vcpu);
165out: 166out:
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index fc6c6636ffda..200100ea7610 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -719,3 +719,28 @@ out:
719EXPORT_SYMBOL_GPL(remove_memory); 719EXPORT_SYMBOL_GPL(remove_memory);
720#endif /* CONFIG_MEMORY_HOTREMOVE */ 720#endif /* CONFIG_MEMORY_HOTREMOVE */
721#endif 721#endif
722
723/*
724 * Even when CONFIG_IA32_SUPPORT is not enabled it is
725 * useful to have the Linux/x86 domain registered to
726 * avoid an attempted module load when emulators call
727 * personality(PER_LINUX32). This saves several milliseconds
728 * on each such call.
729 */
730static struct exec_domain ia32_exec_domain;
731
732static int __init
733per_linux32_init(void)
734{
735 ia32_exec_domain.name = "Linux/x86";
736 ia32_exec_domain.handler = NULL;
737 ia32_exec_domain.pers_low = PER_LINUX32;
738 ia32_exec_domain.pers_high = PER_LINUX32;
739 ia32_exec_domain.signal_map = default_exec_domain.signal_map;
740 ia32_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
741 register_exec_domain(&ia32_exec_domain);
742
743 return 0;
744}
745
746__initcall(per_linux32_init);
diff --git a/arch/ia64/uv/Makefile b/arch/ia64/uv/Makefile
new file mode 100644
index 000000000000..aa9f91947c49
--- /dev/null
+++ b/arch/ia64/uv/Makefile
@@ -0,0 +1,12 @@
1# arch/ia64/uv/Makefile
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 2008 Silicon Graphics, Inc. All Rights Reserved.
8#
9# Makefile for the sn uv subplatform
10#
11
12obj-y += kernel/
diff --git a/arch/ia64/uv/kernel/Makefile b/arch/ia64/uv/kernel/Makefile
new file mode 100644
index 000000000000..8d92b4684d8e
--- /dev/null
+++ b/arch/ia64/uv/kernel/Makefile
@@ -0,0 +1,13 @@
1# arch/ia64/uv/kernel/Makefile
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 2008 Silicon Graphics, Inc. All Rights Reserved.
8#
9
10EXTRA_CFLAGS += -Iarch/ia64/sn/include
11
12obj-y += setup.o
13obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff --git a/arch/ia64/uv/kernel/machvec.c b/arch/ia64/uv/kernel/machvec.c
new file mode 100644
index 000000000000..50737a9dca74
--- /dev/null
+++ b/arch/ia64/uv/kernel/machvec.c
@@ -0,0 +1,11 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#define MACHVEC_PLATFORM_NAME uv
10#define MACHVEC_PLATFORM_HEADER <asm/machvec_uv.h>
11#include <asm/machvec_init.h>
diff --git a/arch/ia64/uv/kernel/setup.c b/arch/ia64/uv/kernel/setup.c
new file mode 100644
index 000000000000..9aa743203c3c
--- /dev/null
+++ b/arch/ia64/uv/kernel/setup.c
@@ -0,0 +1,98 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI UV Core Functions
7 *
8 * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#include <linux/module.h>
12#include <linux/percpu.h>
13#include <asm/sn/simulator.h>
14#include <asm/uv/uv_mmrs.h>
15#include <asm/uv/uv_hub.h>
16
17DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
18EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info);
19
20
21struct redir_addr {
22 unsigned long redirect;
23 unsigned long alias;
24};
25
26#define DEST_SHIFT UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT
27
28static __initdata struct redir_addr redir_addrs[] = {
29 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR, UVH_SI_ALIAS0_OVERLAY_CONFIG},
30 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR, UVH_SI_ALIAS1_OVERLAY_CONFIG},
31 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_SI_ALIAS2_OVERLAY_CONFIG},
32};
33
34static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
35{
36 union uvh_si_alias0_overlay_config_u alias;
37 union uvh_rh_gam_alias210_redirect_config_2_mmr_u redirect;
38 int i;
39
40 for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) {
41 alias.v = uv_read_local_mmr(redir_addrs[i].alias);
42 if (alias.s.base == 0) {
43 *size = (1UL << alias.s.m_alias);
44 redirect.v = uv_read_local_mmr(redir_addrs[i].redirect);
45 *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT;
46 return;
47 }
48 }
49 BUG();
50}
51
52void __init uv_setup(char **cmdline_p)
53{
54 union uvh_si_addr_map_config_u m_n_config;
55 union uvh_node_id_u node_id;
56 unsigned long gnode_upper;
57 int nid, cpu, m_val, n_val;
58 unsigned long mmr_base, lowmem_redir_base, lowmem_redir_size;
59
60 if (IS_MEDUSA()) {
61 lowmem_redir_base = 0;
62 lowmem_redir_size = 0;
63 node_id.v = 0;
64 m_n_config.s.m_skt = 37;
65 m_n_config.s.n_skt = 0;
66 mmr_base = 0;
67 } else {
68 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
69 node_id.v = uv_read_local_mmr(UVH_NODE_ID);
70 m_n_config.v = uv_read_local_mmr(UVH_SI_ADDR_MAP_CONFIG);
71 mmr_base =
72 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
73 ~UV_MMR_ENABLE;
74 }
75
76 m_val = m_n_config.s.m_skt;
77 n_val = m_n_config.s.n_skt;
78 printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
79
80 gnode_upper = (((unsigned long)node_id.s.node_id) &
81 ~((1 << n_val) - 1)) << m_val;
82
83 for_each_present_cpu(cpu) {
84 nid = cpu_to_node(cpu);
85 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
86 uv_cpu_hub_info(cpu)->lowmem_remap_top =
87 lowmem_redir_base + lowmem_redir_size;
88 uv_cpu_hub_info(cpu)->m_val = m_val;
89 uv_cpu_hub_info(cpu)->n_val = m_val;
90 uv_cpu_hub_info(cpu)->pnode_mask = (1 << n_val) -1;
91 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
92 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
93 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
94 uv_cpu_hub_info(cpu)->coherency_domain_number = 0;/* ZZZ */
95 printk(KERN_DEBUG "UV cpu %d, nid %d\n", cpu, nid);
96 }
97}
98
diff --git a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c
index 9e508fd9d970..0d658dbb6766 100644
--- a/arch/m32r/kernel/init_task.c
+++ b/arch/m32r/kernel/init_task.c
@@ -12,7 +12,6 @@
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13 13
14static struct fs_struct init_fs = INIT_FS; 14static struct fs_struct init_fs = INIT_FS;
15static struct files_struct init_files = INIT_FILES;
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18struct mm_struct init_mm = INIT_MM(init_mm); 17struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 65db2261b9ea..55ea52fe6aca 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -44,7 +44,7 @@ config GENERIC_IOMAP
44 44
45config ARCH_MAY_HAVE_PC_FDC 45config ARCH_MAY_HAVE_PC_FDC
46 bool 46 bool
47 depends on Q40 || (BROKEN && SUN3X) 47 depends on BROKEN && (Q40 || SUN3X)
48 default y 48 default y
49 49
50config NO_IOPORT 50config NO_IOPORT
@@ -539,13 +539,6 @@ config AMIGA_BUILTIN_SERIAL
539 539
540 To compile this driver as a module, choose M here. 540 To compile this driver as a module, choose M here.
541 541
542config WHIPPET_SERIAL
543 tristate "Hisoft Whippet PCMCIA serial support"
544 depends on AMIGA_PCMCIA
545 help
546 HiSoft has a web page at <http://www.hisoft.co.uk/>, but there
547 is no listing for the Whippet in their Amiga section.
548
549config MULTIFACE_III_TTY 542config MULTIFACE_III_TTY
550 tristate "Multiface Card III serial support" 543 tristate "Multiface Card III serial support"
551 depends on AMIGA 544 depends on AMIGA
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig
index e41958371367..8e2a0f5faf53 100644
--- a/arch/m68k/configs/amiga_defconfig
+++ b/arch/m68k/configs/amiga_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:06 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -141,6 +144,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
141CONFIG_NEED_MULTIPLE_NODES=y 144CONFIG_NEED_MULTIPLE_NODES=y
142# CONFIG_SPARSEMEM_STATIC is not set 145# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
147CONFIG_PAGEFLAGS_EXTENDED=y
144CONFIG_SPLIT_PTLOCK_CPUS=4 148CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set 149# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=1 150CONFIG_ZONE_DMA_FLAG=1
@@ -222,8 +226,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
222CONFIG_INET6_XFRM_MODE_BEET=m 226CONFIG_INET6_XFRM_MODE_BEET=m
223CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 227CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
224CONFIG_IPV6_SIT=m 228CONFIG_IPV6_SIT=m
229CONFIG_IPV6_NDISC_NODETYPE=y
225CONFIG_IPV6_TUNNEL=m 230CONFIG_IPV6_TUNNEL=m
226# CONFIG_IPV6_MULTIPLE_TABLES is not set 231# CONFIG_IPV6_MULTIPLE_TABLES is not set
232# CONFIG_IPV6_MROUTE is not set
227# CONFIG_NETWORK_SECMARK is not set 233# CONFIG_NETWORK_SECMARK is not set
228CONFIG_NETFILTER=y 234CONFIG_NETFILTER=y
229# CONFIG_NETFILTER_DEBUG is not set 235# CONFIG_NETFILTER_DEBUG is not set
@@ -239,6 +245,7 @@ CONFIG_NF_CONNTRACK=m
239CONFIG_NF_CT_ACCT=y 245CONFIG_NF_CT_ACCT=y
240CONFIG_NF_CONNTRACK_MARK=y 246CONFIG_NF_CONNTRACK_MARK=y
241# CONFIG_NF_CONNTRACK_EVENTS is not set 247# CONFIG_NF_CONNTRACK_EVENTS is not set
248# CONFIG_NF_CT_PROTO_DCCP is not set
242CONFIG_NF_CT_PROTO_GRE=m 249CONFIG_NF_CT_PROTO_GRE=m
243CONFIG_NF_CT_PROTO_SCTP=m 250CONFIG_NF_CT_PROTO_SCTP=m
244CONFIG_NF_CT_PROTO_UDPLITE=m 251CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -317,6 +324,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
317CONFIG_IP_NF_TARGET_NETMAP=m 324CONFIG_IP_NF_TARGET_NETMAP=m
318CONFIG_NF_NAT_SNMP_BASIC=m 325CONFIG_NF_NAT_SNMP_BASIC=m
319CONFIG_NF_NAT_PROTO_GRE=m 326CONFIG_NF_NAT_PROTO_GRE=m
327CONFIG_NF_NAT_PROTO_UDPLITE=m
328CONFIG_NF_NAT_PROTO_SCTP=m
320CONFIG_NF_NAT_FTP=m 329CONFIG_NF_NAT_FTP=m
321CONFIG_NF_NAT_IRC=m 330CONFIG_NF_NAT_IRC=m
322CONFIG_NF_NAT_TFTP=m 331CONFIG_NF_NAT_TFTP=m
@@ -410,8 +419,6 @@ CONFIG_IEEE80211=m
410CONFIG_IEEE80211_CRYPT_WEP=m 419CONFIG_IEEE80211_CRYPT_WEP=m
411CONFIG_IEEE80211_CRYPT_CCMP=m 420CONFIG_IEEE80211_CRYPT_CCMP=m
412CONFIG_IEEE80211_CRYPT_TKIP=m 421CONFIG_IEEE80211_CRYPT_TKIP=m
413CONFIG_IEEE80211_SOFTMAC=m
414# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
415# CONFIG_RFKILL is not set 422# CONFIG_RFKILL is not set
416# CONFIG_NET_9P is not set 423# CONFIG_NET_9P is not set
417 424
@@ -477,27 +484,12 @@ CONFIG_IDE_PROC_FS=y
477# 484#
478# IDE chipset support/bugfixes 485# IDE chipset support/bugfixes
479# 486#
480# CONFIG_IDE_GENERIC is not set
481# CONFIG_BLK_DEV_PLATFORM is not set 487# CONFIG_BLK_DEV_PLATFORM is not set
482CONFIG_BLK_DEV_GAYLE=y 488CONFIG_BLK_DEV_GAYLE=y
483CONFIG_BLK_DEV_IDEDOUBLER=y 489CONFIG_BLK_DEV_IDEDOUBLER=y
484CONFIG_BLK_DEV_BUDDHA=y 490CONFIG_BLK_DEV_BUDDHA=y
485
486#
487# Other IDE chipsets support
488#
489
490#
491# Note: most of these also require special kernel boot parameters
492#
493# CONFIG_BLK_DEV_4DRIVES is not set
494# CONFIG_BLK_DEV_ALI14XX is not set
495# CONFIG_BLK_DEV_DTC2278 is not set
496# CONFIG_BLK_DEV_HT6560B is not set
497# CONFIG_BLK_DEV_QD65XX is not set
498# CONFIG_BLK_DEV_UMC8672 is not set
499# CONFIG_BLK_DEV_IDEDMA is not set 491# CONFIG_BLK_DEV_IDEDMA is not set
500# CONFIG_IDE_ARCH_OBSOLETE_INIT is not set 492# CONFIG_BLK_DEV_HD_ONLY is not set
501# CONFIG_BLK_DEV_HD is not set 493# CONFIG_BLK_DEV_HD is not set
502 494
503# 495#
@@ -626,6 +618,7 @@ CONFIG_APNE=m
626# 618#
627# CONFIG_WLAN_PRE80211 is not set 619# CONFIG_WLAN_PRE80211 is not set
628# CONFIG_WLAN_80211 is not set 620# CONFIG_WLAN_80211 is not set
621# CONFIG_IWLWIFI_LEDS is not set
629# CONFIG_WAN is not set 622# CONFIG_WAN is not set
630# CONFIG_PLIP is not set 623# CONFIG_PLIP is not set
631CONFIG_PPP=m 624CONFIG_PPP=m
@@ -707,6 +700,7 @@ CONFIG_INPUT_JOYSTICK=y
707# CONFIG_JOYSTICK_SPACEBALL is not set 700# CONFIG_JOYSTICK_SPACEBALL is not set
708# CONFIG_JOYSTICK_STINGER is not set 701# CONFIG_JOYSTICK_STINGER is not set
709# CONFIG_JOYSTICK_TWIDJOY is not set 702# CONFIG_JOYSTICK_TWIDJOY is not set
703# CONFIG_JOYSTICK_ZHENHUA is not set
710# CONFIG_JOYSTICK_DB9 is not set 704# CONFIG_JOYSTICK_DB9 is not set
711# CONFIG_JOYSTICK_GAMECON is not set 705# CONFIG_JOYSTICK_GAMECON is not set
712# CONFIG_JOYSTICK_TURBOGRAFX is not set 706# CONFIG_JOYSTICK_TURBOGRAFX is not set
@@ -731,6 +725,7 @@ CONFIG_VT=y
731CONFIG_VT_CONSOLE=y 725CONFIG_VT_CONSOLE=y
732CONFIG_HW_CONSOLE=y 726CONFIG_HW_CONSOLE=y
733CONFIG_VT_HW_CONSOLE_BINDING=y 727CONFIG_VT_HW_CONSOLE_BINDING=y
728# CONFIG_DEVKMEM is not set
734# CONFIG_SERIAL_NONSTANDARD is not set 729# CONFIG_SERIAL_NONSTANDARD is not set
735CONFIG_A2232=m 730CONFIG_A2232=m
736 731
@@ -757,12 +752,7 @@ CONFIG_GEN_RTC_X=y
757# CONFIG_RAW_DRIVER is not set 752# CONFIG_RAW_DRIVER is not set
758# CONFIG_TCG_TPM is not set 753# CONFIG_TCG_TPM is not set
759# CONFIG_I2C is not set 754# CONFIG_I2C is not set
760
761#
762# SPI support
763#
764# CONFIG_SPI is not set 755# CONFIG_SPI is not set
765# CONFIG_SPI_MASTER is not set
766# CONFIG_W1 is not set 756# CONFIG_W1 is not set
767# CONFIG_POWER_SUPPLY is not set 757# CONFIG_POWER_SUPPLY is not set
768# CONFIG_HWMON is not set 758# CONFIG_HWMON is not set
@@ -779,12 +769,22 @@ CONFIG_SSB_POSSIBLE=y
779# Multifunction device drivers 769# Multifunction device drivers
780# 770#
781# CONFIG_MFD_SM501 is not set 771# CONFIG_MFD_SM501 is not set
772# CONFIG_HTC_PASIC3 is not set
782 773
783# 774#
784# Multimedia devices 775# Multimedia devices
785# 776#
777
778#
779# Multimedia core support
780#
786# CONFIG_VIDEO_DEV is not set 781# CONFIG_VIDEO_DEV is not set
787# CONFIG_DVB_CORE is not set 782# CONFIG_DVB_CORE is not set
783# CONFIG_VIDEO_MEDIA is not set
784
785#
786# Multimedia drivers
787#
788# CONFIG_DAB is not set 788# CONFIG_DAB is not set
789 789
790# 790#
@@ -802,8 +802,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
802# CONFIG_FB_SYS_FILLRECT is not set 802# CONFIG_FB_SYS_FILLRECT is not set
803# CONFIG_FB_SYS_COPYAREA is not set 803# CONFIG_FB_SYS_COPYAREA is not set
804# CONFIG_FB_SYS_IMAGEBLIT is not set 804# CONFIG_FB_SYS_IMAGEBLIT is not set
805# CONFIG_FB_FOREIGN_ENDIAN is not set
805# CONFIG_FB_SYS_FOPS is not set 806# CONFIG_FB_SYS_FOPS is not set
806CONFIG_FB_DEFERRED_IO=y
807# CONFIG_FB_SVGALIB is not set 807# CONFIG_FB_SVGALIB is not set
808# CONFIG_FB_MACMODES is not set 808# CONFIG_FB_MACMODES is not set
809# CONFIG_FB_BACKLIGHT is not set 809# CONFIG_FB_BACKLIGHT is not set
@@ -859,19 +859,15 @@ CONFIG_HIDRAW=y
859# CONFIG_MMC is not set 859# CONFIG_MMC is not set
860# CONFIG_MEMSTICK is not set 860# CONFIG_MEMSTICK is not set
861# CONFIG_NEW_LEDS is not set 861# CONFIG_NEW_LEDS is not set
862# CONFIG_ACCESSIBILITY is not set
862# CONFIG_RTC_CLASS is not set 863# CONFIG_RTC_CLASS is not set
863# CONFIG_AUXDISPLAY is not set 864# CONFIG_AUXDISPLAY is not set
864
865#
866# Userspace I/O
867#
868# CONFIG_UIO is not set 865# CONFIG_UIO is not set
869 866
870# 867#
871# Character devices 868# Character devices
872# 869#
873CONFIG_AMIGA_BUILTIN_SERIAL=y 870CONFIG_AMIGA_BUILTIN_SERIAL=y
874# CONFIG_WHIPPET_SERIAL is not set
875CONFIG_MULTIFACE_III_TTY=m 871CONFIG_MULTIFACE_III_TTY=m
876# CONFIG_SERIAL_CONSOLE is not set 872# CONFIG_SERIAL_CONSOLE is not set
877 873
@@ -894,16 +890,15 @@ CONFIG_JFS_FS=m
894# CONFIG_JFS_SECURITY is not set 890# CONFIG_JFS_SECURITY is not set
895# CONFIG_JFS_DEBUG is not set 891# CONFIG_JFS_DEBUG is not set
896# CONFIG_JFS_STATISTICS is not set 892# CONFIG_JFS_STATISTICS is not set
897CONFIG_FS_POSIX_ACL=y 893# CONFIG_FS_POSIX_ACL is not set
898CONFIG_XFS_FS=m 894CONFIG_XFS_FS=m
899# CONFIG_XFS_QUOTA is not set 895# CONFIG_XFS_QUOTA is not set
900# CONFIG_XFS_SECURITY is not set
901# CONFIG_XFS_POSIX_ACL is not set 896# CONFIG_XFS_POSIX_ACL is not set
902# CONFIG_XFS_RT is not set 897# CONFIG_XFS_RT is not set
903CONFIG_GFS2_FS=m 898# CONFIG_XFS_DEBUG is not set
904CONFIG_GFS2_FS_LOCKING_NOLOCK=m
905CONFIG_GFS2_FS_LOCKING_DLM=m
906CONFIG_OCFS2_FS=m 899CONFIG_OCFS2_FS=m
900CONFIG_OCFS2_FS_O2CB=m
901CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
907# CONFIG_OCFS2_DEBUG_MASKLOG is not set 902# CONFIG_OCFS2_DEBUG_MASKLOG is not set
908# CONFIG_OCFS2_DEBUG_FS is not set 903# CONFIG_OCFS2_DEBUG_FS is not set
909CONFIG_DNOTIFY=y 904CONFIG_DNOTIFY=y
@@ -975,12 +970,10 @@ CONFIG_NFS_FS=m
975CONFIG_NFS_V3=y 970CONFIG_NFS_V3=y
976# CONFIG_NFS_V3_ACL is not set 971# CONFIG_NFS_V3_ACL is not set
977CONFIG_NFS_V4=y 972CONFIG_NFS_V4=y
978# CONFIG_NFS_DIRECTIO is not set
979CONFIG_NFSD=m 973CONFIG_NFSD=m
980CONFIG_NFSD_V3=y 974CONFIG_NFSD_V3=y
981# CONFIG_NFSD_V3_ACL is not set 975# CONFIG_NFSD_V3_ACL is not set
982# CONFIG_NFSD_V4 is not set 976# CONFIG_NFSD_V4 is not set
983CONFIG_NFSD_TCP=y
984CONFIG_LOCKD=m 977CONFIG_LOCKD=m
985CONFIG_LOCKD_V4=y 978CONFIG_LOCKD_V4=y
986CONFIG_EXPORTFS=m 979CONFIG_EXPORTFS=m
@@ -1054,6 +1047,7 @@ CONFIG_DLM=m
1054# CONFIG_PRINTK_TIME is not set 1047# CONFIG_PRINTK_TIME is not set
1055CONFIG_ENABLE_WARN_DEPRECATED=y 1048CONFIG_ENABLE_WARN_DEPRECATED=y
1056CONFIG_ENABLE_MUST_CHECK=y 1049CONFIG_ENABLE_MUST_CHECK=y
1050CONFIG_FRAME_WARN=1024
1057CONFIG_MAGIC_SYSRQ=y 1051CONFIG_MAGIC_SYSRQ=y
1058# CONFIG_UNUSED_SYMBOLS is not set 1052# CONFIG_UNUSED_SYMBOLS is not set
1059# CONFIG_DEBUG_FS is not set 1053# CONFIG_DEBUG_FS is not set
@@ -1073,53 +1067,82 @@ CONFIG_ASYNC_CORE=m
1073CONFIG_ASYNC_MEMCPY=m 1067CONFIG_ASYNC_MEMCPY=m
1074CONFIG_ASYNC_XOR=m 1068CONFIG_ASYNC_XOR=m
1075CONFIG_CRYPTO=y 1069CONFIG_CRYPTO=y
1070
1071#
1072# Crypto core or helper
1073#
1076CONFIG_CRYPTO_ALGAPI=y 1074CONFIG_CRYPTO_ALGAPI=y
1077CONFIG_CRYPTO_AEAD=m 1075CONFIG_CRYPTO_AEAD=m
1078CONFIG_CRYPTO_BLKCIPHER=m 1076CONFIG_CRYPTO_BLKCIPHER=m
1079CONFIG_CRYPTO_SEQIV=m
1080CONFIG_CRYPTO_HASH=y 1077CONFIG_CRYPTO_HASH=y
1081CONFIG_CRYPTO_MANAGER=y 1078CONFIG_CRYPTO_MANAGER=y
1079CONFIG_CRYPTO_GF128MUL=m
1080CONFIG_CRYPTO_NULL=m
1081CONFIG_CRYPTO_CRYPTD=m
1082CONFIG_CRYPTO_AUTHENC=m
1083CONFIG_CRYPTO_TEST=m
1084
1085#
1086# Authenticated Encryption with Associated Data
1087#
1088CONFIG_CRYPTO_CCM=m
1089CONFIG_CRYPTO_GCM=m
1090CONFIG_CRYPTO_SEQIV=m
1091
1092#
1093# Block modes
1094#
1095CONFIG_CRYPTO_CBC=m
1096CONFIG_CRYPTO_CTR=m
1097CONFIG_CRYPTO_CTS=m
1098CONFIG_CRYPTO_ECB=m
1099CONFIG_CRYPTO_LRW=m
1100CONFIG_CRYPTO_PCBC=m
1101CONFIG_CRYPTO_XTS=m
1102
1103#
1104# Hash modes
1105#
1082CONFIG_CRYPTO_HMAC=y 1106CONFIG_CRYPTO_HMAC=y
1083CONFIG_CRYPTO_XCBC=m 1107CONFIG_CRYPTO_XCBC=m
1084CONFIG_CRYPTO_NULL=m 1108
1109#
1110# Digest
1111#
1112CONFIG_CRYPTO_CRC32C=m
1085CONFIG_CRYPTO_MD4=m 1113CONFIG_CRYPTO_MD4=m
1086CONFIG_CRYPTO_MD5=m 1114CONFIG_CRYPTO_MD5=m
1115CONFIG_CRYPTO_MICHAEL_MIC=m
1087CONFIG_CRYPTO_SHA1=m 1116CONFIG_CRYPTO_SHA1=m
1088CONFIG_CRYPTO_SHA256=m 1117CONFIG_CRYPTO_SHA256=m
1089CONFIG_CRYPTO_SHA512=m 1118CONFIG_CRYPTO_SHA512=m
1090CONFIG_CRYPTO_WP512=m
1091CONFIG_CRYPTO_TGR192=m 1119CONFIG_CRYPTO_TGR192=m
1092CONFIG_CRYPTO_GF128MUL=m 1120CONFIG_CRYPTO_WP512=m
1093CONFIG_CRYPTO_ECB=m 1121
1094CONFIG_CRYPTO_CBC=m 1122#
1095CONFIG_CRYPTO_PCBC=m 1123# Ciphers
1096CONFIG_CRYPTO_LRW=m 1124#
1097CONFIG_CRYPTO_XTS=m
1098CONFIG_CRYPTO_CTR=m
1099CONFIG_CRYPTO_GCM=m
1100CONFIG_CRYPTO_CCM=m
1101CONFIG_CRYPTO_CRYPTD=m
1102CONFIG_CRYPTO_DES=m
1103CONFIG_CRYPTO_FCRYPT=m
1104CONFIG_CRYPTO_BLOWFISH=m
1105CONFIG_CRYPTO_TWOFISH=m
1106CONFIG_CRYPTO_TWOFISH_COMMON=m
1107CONFIG_CRYPTO_SERPENT=m
1108CONFIG_CRYPTO_AES=m 1125CONFIG_CRYPTO_AES=m
1126CONFIG_CRYPTO_ANUBIS=m
1127CONFIG_CRYPTO_ARC4=m
1128CONFIG_CRYPTO_BLOWFISH=m
1129CONFIG_CRYPTO_CAMELLIA=m
1109CONFIG_CRYPTO_CAST5=m 1130CONFIG_CRYPTO_CAST5=m
1110CONFIG_CRYPTO_CAST6=m 1131CONFIG_CRYPTO_CAST6=m
1111CONFIG_CRYPTO_TEA=m 1132CONFIG_CRYPTO_DES=m
1112CONFIG_CRYPTO_ARC4=m 1133CONFIG_CRYPTO_FCRYPT=m
1113CONFIG_CRYPTO_KHAZAD=m 1134CONFIG_CRYPTO_KHAZAD=m
1114CONFIG_CRYPTO_ANUBIS=m
1115CONFIG_CRYPTO_SEED=m
1116CONFIG_CRYPTO_SALSA20=m 1135CONFIG_CRYPTO_SALSA20=m
1136CONFIG_CRYPTO_SEED=m
1137CONFIG_CRYPTO_SERPENT=m
1138CONFIG_CRYPTO_TEA=m
1139CONFIG_CRYPTO_TWOFISH=m
1140CONFIG_CRYPTO_TWOFISH_COMMON=m
1141
1142#
1143# Compression
1144#
1117CONFIG_CRYPTO_DEFLATE=m 1145CONFIG_CRYPTO_DEFLATE=m
1118CONFIG_CRYPTO_MICHAEL_MIC=m
1119CONFIG_CRYPTO_CRC32C=m
1120CONFIG_CRYPTO_CAMELLIA=m
1121CONFIG_CRYPTO_TEST=m
1122CONFIG_CRYPTO_AUTHENC=m
1123CONFIG_CRYPTO_LZO=m 1146CONFIG_CRYPTO_LZO=m
1124# CONFIG_CRYPTO_HW is not set 1147# CONFIG_CRYPTO_HW is not set
1125 1148
@@ -1127,9 +1150,11 @@ CONFIG_CRYPTO_LZO=m
1127# Library routines 1150# Library routines
1128# 1151#
1129CONFIG_BITREVERSE=y 1152CONFIG_BITREVERSE=y
1153# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1154# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1130CONFIG_CRC_CCITT=m 1155CONFIG_CRC_CCITT=m
1131CONFIG_CRC16=m 1156CONFIG_CRC16=m
1132# CONFIG_CRC_ITU_T is not set 1157CONFIG_CRC_ITU_T=m
1133CONFIG_CRC32=y 1158CONFIG_CRC32=y
1134# CONFIG_CRC7 is not set 1159# CONFIG_CRC7 is not set
1135CONFIG_LIBCRC32C=m 1160CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig
index e61196cd7fa5..e2d511e2a1d1 100644
--- a/arch/m68k/configs/apollo_defconfig
+++ b/arch/m68k/configs/apollo_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:07 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -141,6 +144,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
141CONFIG_NEED_MULTIPLE_NODES=y 144CONFIG_NEED_MULTIPLE_NODES=y
142# CONFIG_SPARSEMEM_STATIC is not set 145# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
147CONFIG_PAGEFLAGS_EXTENDED=y
144CONFIG_SPLIT_PTLOCK_CPUS=4 148CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set 149# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=1 150CONFIG_ZONE_DMA_FLAG=1
@@ -220,8 +224,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
220CONFIG_INET6_XFRM_MODE_BEET=m 224CONFIG_INET6_XFRM_MODE_BEET=m
221CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 225CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
222CONFIG_IPV6_SIT=m 226CONFIG_IPV6_SIT=m
227CONFIG_IPV6_NDISC_NODETYPE=y
223CONFIG_IPV6_TUNNEL=m 228CONFIG_IPV6_TUNNEL=m
224# CONFIG_IPV6_MULTIPLE_TABLES is not set 229# CONFIG_IPV6_MULTIPLE_TABLES is not set
230# CONFIG_IPV6_MROUTE is not set
225# CONFIG_NETWORK_SECMARK is not set 231# CONFIG_NETWORK_SECMARK is not set
226CONFIG_NETFILTER=y 232CONFIG_NETFILTER=y
227# CONFIG_NETFILTER_DEBUG is not set 233# CONFIG_NETFILTER_DEBUG is not set
@@ -237,6 +243,7 @@ CONFIG_NF_CONNTRACK=m
237CONFIG_NF_CT_ACCT=y 243CONFIG_NF_CT_ACCT=y
238CONFIG_NF_CONNTRACK_MARK=y 244CONFIG_NF_CONNTRACK_MARK=y
239# CONFIG_NF_CONNTRACK_EVENTS is not set 245# CONFIG_NF_CONNTRACK_EVENTS is not set
246# CONFIG_NF_CT_PROTO_DCCP is not set
240CONFIG_NF_CT_PROTO_GRE=m 247CONFIG_NF_CT_PROTO_GRE=m
241CONFIG_NF_CT_PROTO_SCTP=m 248CONFIG_NF_CT_PROTO_SCTP=m
242CONFIG_NF_CT_PROTO_UDPLITE=m 249CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -315,6 +322,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
315CONFIG_IP_NF_TARGET_NETMAP=m 322CONFIG_IP_NF_TARGET_NETMAP=m
316CONFIG_NF_NAT_SNMP_BASIC=m 323CONFIG_NF_NAT_SNMP_BASIC=m
317CONFIG_NF_NAT_PROTO_GRE=m 324CONFIG_NF_NAT_PROTO_GRE=m
325CONFIG_NF_NAT_PROTO_UDPLITE=m
326CONFIG_NF_NAT_PROTO_SCTP=m
318CONFIG_NF_NAT_FTP=m 327CONFIG_NF_NAT_FTP=m
319CONFIG_NF_NAT_IRC=m 328CONFIG_NF_NAT_IRC=m
320CONFIG_NF_NAT_TFTP=m 329CONFIG_NF_NAT_TFTP=m
@@ -408,8 +417,6 @@ CONFIG_IEEE80211=m
408CONFIG_IEEE80211_CRYPT_WEP=m 417CONFIG_IEEE80211_CRYPT_WEP=m
409CONFIG_IEEE80211_CRYPT_CCMP=m 418CONFIG_IEEE80211_CRYPT_CCMP=m
410CONFIG_IEEE80211_CRYPT_TKIP=m 419CONFIG_IEEE80211_CRYPT_TKIP=m
411CONFIG_IEEE80211_SOFTMAC=m
412# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
413# CONFIG_RFKILL is not set 420# CONFIG_RFKILL is not set
414# CONFIG_NET_9P is not set 421# CONFIG_NET_9P is not set
415 422
@@ -539,6 +546,7 @@ CONFIG_APOLLO_ELPLUS=y
539# 546#
540# CONFIG_WLAN_PRE80211 is not set 547# CONFIG_WLAN_PRE80211 is not set
541# CONFIG_WLAN_80211 is not set 548# CONFIG_WLAN_80211 is not set
549# CONFIG_IWLWIFI_LEDS is not set
542# CONFIG_WAN is not set 550# CONFIG_WAN is not set
543CONFIG_PPP=m 551CONFIG_PPP=m
544# CONFIG_PPP_MULTILINK is not set 552# CONFIG_PPP_MULTILINK is not set
@@ -622,6 +630,7 @@ CONFIG_VT=y
622CONFIG_VT_CONSOLE=y 630CONFIG_VT_CONSOLE=y
623CONFIG_HW_CONSOLE=y 631CONFIG_HW_CONSOLE=y
624CONFIG_VT_HW_CONSOLE_BINDING=y 632CONFIG_VT_HW_CONSOLE_BINDING=y
633# CONFIG_DEVKMEM is not set
625# CONFIG_SERIAL_NONSTANDARD is not set 634# CONFIG_SERIAL_NONSTANDARD is not set
626 635
627# 636#
@@ -643,12 +652,7 @@ CONFIG_GEN_RTC_X=y
643# CONFIG_RAW_DRIVER is not set 652# CONFIG_RAW_DRIVER is not set
644# CONFIG_TCG_TPM is not set 653# CONFIG_TCG_TPM is not set
645# CONFIG_I2C is not set 654# CONFIG_I2C is not set
646
647#
648# SPI support
649#
650# CONFIG_SPI is not set 655# CONFIG_SPI is not set
651# CONFIG_SPI_MASTER is not set
652# CONFIG_W1 is not set 656# CONFIG_W1 is not set
653# CONFIG_POWER_SUPPLY is not set 657# CONFIG_POWER_SUPPLY is not set
654# CONFIG_HWMON is not set 658# CONFIG_HWMON is not set
@@ -665,12 +669,22 @@ CONFIG_SSB_POSSIBLE=y
665# Multifunction device drivers 669# Multifunction device drivers
666# 670#
667# CONFIG_MFD_SM501 is not set 671# CONFIG_MFD_SM501 is not set
672# CONFIG_HTC_PASIC3 is not set
668 673
669# 674#
670# Multimedia devices 675# Multimedia devices
671# 676#
677
678#
679# Multimedia core support
680#
672# CONFIG_VIDEO_DEV is not set 681# CONFIG_VIDEO_DEV is not set
673# CONFIG_DVB_CORE is not set 682# CONFIG_DVB_CORE is not set
683# CONFIG_VIDEO_MEDIA is not set
684
685#
686# Multimedia drivers
687#
674# CONFIG_DAB is not set 688# CONFIG_DAB is not set
675 689
676# 690#
@@ -688,8 +702,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
688# CONFIG_FB_SYS_FILLRECT is not set 702# CONFIG_FB_SYS_FILLRECT is not set
689# CONFIG_FB_SYS_COPYAREA is not set 703# CONFIG_FB_SYS_COPYAREA is not set
690# CONFIG_FB_SYS_IMAGEBLIT is not set 704# CONFIG_FB_SYS_IMAGEBLIT is not set
705# CONFIG_FB_FOREIGN_ENDIAN is not set
691# CONFIG_FB_SYS_FOPS is not set 706# CONFIG_FB_SYS_FOPS is not set
692CONFIG_FB_DEFERRED_IO=y
693# CONFIG_FB_SVGALIB is not set 707# CONFIG_FB_SVGALIB is not set
694# CONFIG_FB_MACMODES is not set 708# CONFIG_FB_MACMODES is not set
695# CONFIG_FB_BACKLIGHT is not set 709# CONFIG_FB_BACKLIGHT is not set
@@ -737,11 +751,8 @@ CONFIG_HIDRAW=y
737# CONFIG_MMC is not set 751# CONFIG_MMC is not set
738# CONFIG_MEMSTICK is not set 752# CONFIG_MEMSTICK is not set
739# CONFIG_NEW_LEDS is not set 753# CONFIG_NEW_LEDS is not set
754# CONFIG_ACCESSIBILITY is not set
740# CONFIG_RTC_CLASS is not set 755# CONFIG_RTC_CLASS is not set
741
742#
743# Userspace I/O
744#
745# CONFIG_UIO is not set 756# CONFIG_UIO is not set
746 757
747# 758#
@@ -769,16 +780,15 @@ CONFIG_JFS_FS=m
769# CONFIG_JFS_SECURITY is not set 780# CONFIG_JFS_SECURITY is not set
770# CONFIG_JFS_DEBUG is not set 781# CONFIG_JFS_DEBUG is not set
771# CONFIG_JFS_STATISTICS is not set 782# CONFIG_JFS_STATISTICS is not set
772CONFIG_FS_POSIX_ACL=y 783# CONFIG_FS_POSIX_ACL is not set
773CONFIG_XFS_FS=m 784CONFIG_XFS_FS=m
774# CONFIG_XFS_QUOTA is not set 785# CONFIG_XFS_QUOTA is not set
775# CONFIG_XFS_SECURITY is not set
776# CONFIG_XFS_POSIX_ACL is not set 786# CONFIG_XFS_POSIX_ACL is not set
777# CONFIG_XFS_RT is not set 787# CONFIG_XFS_RT is not set
778CONFIG_GFS2_FS=m 788# CONFIG_XFS_DEBUG is not set
779CONFIG_GFS2_FS_LOCKING_NOLOCK=m
780CONFIG_GFS2_FS_LOCKING_DLM=m
781CONFIG_OCFS2_FS=m 789CONFIG_OCFS2_FS=m
790CONFIG_OCFS2_FS_O2CB=m
791CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
782# CONFIG_OCFS2_DEBUG_MASKLOG is not set 792# CONFIG_OCFS2_DEBUG_MASKLOG is not set
783# CONFIG_OCFS2_DEBUG_FS is not set 793# CONFIG_OCFS2_DEBUG_FS is not set
784CONFIG_DNOTIFY=y 794CONFIG_DNOTIFY=y
@@ -850,12 +860,10 @@ CONFIG_NFS_FS=y
850CONFIG_NFS_V3=y 860CONFIG_NFS_V3=y
851# CONFIG_NFS_V3_ACL is not set 861# CONFIG_NFS_V3_ACL is not set
852CONFIG_NFS_V4=y 862CONFIG_NFS_V4=y
853# CONFIG_NFS_DIRECTIO is not set
854CONFIG_NFSD=m 863CONFIG_NFSD=m
855CONFIG_NFSD_V3=y 864CONFIG_NFSD_V3=y
856# CONFIG_NFSD_V3_ACL is not set 865# CONFIG_NFSD_V3_ACL is not set
857# CONFIG_NFSD_V4 is not set 866# CONFIG_NFSD_V4 is not set
858CONFIG_NFSD_TCP=y
859CONFIG_ROOT_NFS=y 867CONFIG_ROOT_NFS=y
860CONFIG_LOCKD=y 868CONFIG_LOCKD=y
861CONFIG_LOCKD_V4=y 869CONFIG_LOCKD_V4=y
@@ -929,6 +937,7 @@ CONFIG_DLM=m
929# CONFIG_PRINTK_TIME is not set 937# CONFIG_PRINTK_TIME is not set
930CONFIG_ENABLE_WARN_DEPRECATED=y 938CONFIG_ENABLE_WARN_DEPRECATED=y
931CONFIG_ENABLE_MUST_CHECK=y 939CONFIG_ENABLE_MUST_CHECK=y
940CONFIG_FRAME_WARN=1024
932CONFIG_MAGIC_SYSRQ=y 941CONFIG_MAGIC_SYSRQ=y
933# CONFIG_UNUSED_SYMBOLS is not set 942# CONFIG_UNUSED_SYMBOLS is not set
934# CONFIG_DEBUG_FS is not set 943# CONFIG_DEBUG_FS is not set
@@ -948,53 +957,82 @@ CONFIG_ASYNC_CORE=m
948CONFIG_ASYNC_MEMCPY=m 957CONFIG_ASYNC_MEMCPY=m
949CONFIG_ASYNC_XOR=m 958CONFIG_ASYNC_XOR=m
950CONFIG_CRYPTO=y 959CONFIG_CRYPTO=y
960
961#
962# Crypto core or helper
963#
951CONFIG_CRYPTO_ALGAPI=y 964CONFIG_CRYPTO_ALGAPI=y
952CONFIG_CRYPTO_AEAD=m 965CONFIG_CRYPTO_AEAD=m
953CONFIG_CRYPTO_BLKCIPHER=y 966CONFIG_CRYPTO_BLKCIPHER=y
954CONFIG_CRYPTO_SEQIV=m
955CONFIG_CRYPTO_HASH=y 967CONFIG_CRYPTO_HASH=y
956CONFIG_CRYPTO_MANAGER=y 968CONFIG_CRYPTO_MANAGER=y
969CONFIG_CRYPTO_GF128MUL=m
970CONFIG_CRYPTO_NULL=m
971CONFIG_CRYPTO_CRYPTD=m
972CONFIG_CRYPTO_AUTHENC=m
973CONFIG_CRYPTO_TEST=m
974
975#
976# Authenticated Encryption with Associated Data
977#
978CONFIG_CRYPTO_CCM=m
979CONFIG_CRYPTO_GCM=m
980CONFIG_CRYPTO_SEQIV=m
981
982#
983# Block modes
984#
985CONFIG_CRYPTO_CBC=y
986CONFIG_CRYPTO_CTR=m
987CONFIG_CRYPTO_CTS=m
988CONFIG_CRYPTO_ECB=m
989CONFIG_CRYPTO_LRW=m
990CONFIG_CRYPTO_PCBC=m
991CONFIG_CRYPTO_XTS=m
992
993#
994# Hash modes
995#
957CONFIG_CRYPTO_HMAC=y 996CONFIG_CRYPTO_HMAC=y
958CONFIG_CRYPTO_XCBC=m 997CONFIG_CRYPTO_XCBC=m
959CONFIG_CRYPTO_NULL=m 998
999#
1000# Digest
1001#
1002CONFIG_CRYPTO_CRC32C=m
960CONFIG_CRYPTO_MD4=m 1003CONFIG_CRYPTO_MD4=m
961CONFIG_CRYPTO_MD5=y 1004CONFIG_CRYPTO_MD5=y
1005CONFIG_CRYPTO_MICHAEL_MIC=m
962CONFIG_CRYPTO_SHA1=m 1006CONFIG_CRYPTO_SHA1=m
963CONFIG_CRYPTO_SHA256=m 1007CONFIG_CRYPTO_SHA256=m
964CONFIG_CRYPTO_SHA512=m 1008CONFIG_CRYPTO_SHA512=m
965CONFIG_CRYPTO_WP512=m
966CONFIG_CRYPTO_TGR192=m 1009CONFIG_CRYPTO_TGR192=m
967CONFIG_CRYPTO_GF128MUL=m 1010CONFIG_CRYPTO_WP512=m
968CONFIG_CRYPTO_ECB=m 1011
969CONFIG_CRYPTO_CBC=y 1012#
970CONFIG_CRYPTO_PCBC=m 1013# Ciphers
971CONFIG_CRYPTO_LRW=m 1014#
972CONFIG_CRYPTO_XTS=m
973CONFIG_CRYPTO_CTR=m
974CONFIG_CRYPTO_GCM=m
975CONFIG_CRYPTO_CCM=m
976CONFIG_CRYPTO_CRYPTD=m
977CONFIG_CRYPTO_DES=y
978CONFIG_CRYPTO_FCRYPT=m
979CONFIG_CRYPTO_BLOWFISH=m
980CONFIG_CRYPTO_TWOFISH=m
981CONFIG_CRYPTO_TWOFISH_COMMON=m
982CONFIG_CRYPTO_SERPENT=m
983CONFIG_CRYPTO_AES=m 1015CONFIG_CRYPTO_AES=m
1016CONFIG_CRYPTO_ANUBIS=m
1017CONFIG_CRYPTO_ARC4=m
1018CONFIG_CRYPTO_BLOWFISH=m
1019CONFIG_CRYPTO_CAMELLIA=m
984CONFIG_CRYPTO_CAST5=m 1020CONFIG_CRYPTO_CAST5=m
985CONFIG_CRYPTO_CAST6=m 1021CONFIG_CRYPTO_CAST6=m
986CONFIG_CRYPTO_TEA=m 1022CONFIG_CRYPTO_DES=y
987CONFIG_CRYPTO_ARC4=m 1023CONFIG_CRYPTO_FCRYPT=m
988CONFIG_CRYPTO_KHAZAD=m 1024CONFIG_CRYPTO_KHAZAD=m
989CONFIG_CRYPTO_ANUBIS=m
990CONFIG_CRYPTO_SEED=m
991CONFIG_CRYPTO_SALSA20=m 1025CONFIG_CRYPTO_SALSA20=m
1026CONFIG_CRYPTO_SEED=m
1027CONFIG_CRYPTO_SERPENT=m
1028CONFIG_CRYPTO_TEA=m
1029CONFIG_CRYPTO_TWOFISH=m
1030CONFIG_CRYPTO_TWOFISH_COMMON=m
1031
1032#
1033# Compression
1034#
992CONFIG_CRYPTO_DEFLATE=m 1035CONFIG_CRYPTO_DEFLATE=m
993CONFIG_CRYPTO_MICHAEL_MIC=m
994CONFIG_CRYPTO_CRC32C=m
995CONFIG_CRYPTO_CAMELLIA=m
996CONFIG_CRYPTO_TEST=m
997CONFIG_CRYPTO_AUTHENC=m
998CONFIG_CRYPTO_LZO=m 1036CONFIG_CRYPTO_LZO=m
999# CONFIG_CRYPTO_HW is not set 1037# CONFIG_CRYPTO_HW is not set
1000 1038
@@ -1002,9 +1040,11 @@ CONFIG_CRYPTO_LZO=m
1002# Library routines 1040# Library routines
1003# 1041#
1004CONFIG_BITREVERSE=y 1042CONFIG_BITREVERSE=y
1043# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1044# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1005CONFIG_CRC_CCITT=m 1045CONFIG_CRC_CCITT=m
1006CONFIG_CRC16=m 1046CONFIG_CRC16=m
1007# CONFIG_CRC_ITU_T is not set 1047CONFIG_CRC_ITU_T=m
1008CONFIG_CRC32=y 1048CONFIG_CRC32=y
1009# CONFIG_CRC7 is not set 1049# CONFIG_CRC7 is not set
1010CONFIG_LIBCRC32C=m 1050CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig
index ba7f971bb026..6e20d656adaf 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:09 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -141,6 +144,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
141CONFIG_NEED_MULTIPLE_NODES=y 144CONFIG_NEED_MULTIPLE_NODES=y
142# CONFIG_SPARSEMEM_STATIC is not set 145# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
147CONFIG_PAGEFLAGS_EXTENDED=y
144CONFIG_SPLIT_PTLOCK_CPUS=4 148CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set 149# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=1 150CONFIG_ZONE_DMA_FLAG=1
@@ -218,8 +222,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
218CONFIG_INET6_XFRM_MODE_BEET=m 222CONFIG_INET6_XFRM_MODE_BEET=m
219CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 223CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
220CONFIG_IPV6_SIT=m 224CONFIG_IPV6_SIT=m
225CONFIG_IPV6_NDISC_NODETYPE=y
221CONFIG_IPV6_TUNNEL=m 226CONFIG_IPV6_TUNNEL=m
222# CONFIG_IPV6_MULTIPLE_TABLES is not set 227# CONFIG_IPV6_MULTIPLE_TABLES is not set
228# CONFIG_IPV6_MROUTE is not set
223# CONFIG_NETWORK_SECMARK is not set 229# CONFIG_NETWORK_SECMARK is not set
224CONFIG_NETFILTER=y 230CONFIG_NETFILTER=y
225# CONFIG_NETFILTER_DEBUG is not set 231# CONFIG_NETFILTER_DEBUG is not set
@@ -235,6 +241,7 @@ CONFIG_NF_CONNTRACK=m
235CONFIG_NF_CT_ACCT=y 241CONFIG_NF_CT_ACCT=y
236CONFIG_NF_CONNTRACK_MARK=y 242CONFIG_NF_CONNTRACK_MARK=y
237# CONFIG_NF_CONNTRACK_EVENTS is not set 243# CONFIG_NF_CONNTRACK_EVENTS is not set
244# CONFIG_NF_CT_PROTO_DCCP is not set
238CONFIG_NF_CT_PROTO_GRE=m 245CONFIG_NF_CT_PROTO_GRE=m
239CONFIG_NF_CT_PROTO_SCTP=m 246CONFIG_NF_CT_PROTO_SCTP=m
240CONFIG_NF_CT_PROTO_UDPLITE=m 247CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -313,6 +320,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
313CONFIG_IP_NF_TARGET_NETMAP=m 320CONFIG_IP_NF_TARGET_NETMAP=m
314CONFIG_NF_NAT_SNMP_BASIC=m 321CONFIG_NF_NAT_SNMP_BASIC=m
315CONFIG_NF_NAT_PROTO_GRE=m 322CONFIG_NF_NAT_PROTO_GRE=m
323CONFIG_NF_NAT_PROTO_UDPLITE=m
324CONFIG_NF_NAT_PROTO_SCTP=m
316CONFIG_NF_NAT_FTP=m 325CONFIG_NF_NAT_FTP=m
317CONFIG_NF_NAT_IRC=m 326CONFIG_NF_NAT_IRC=m
318CONFIG_NF_NAT_TFTP=m 327CONFIG_NF_NAT_TFTP=m
@@ -406,8 +415,6 @@ CONFIG_IEEE80211=m
406CONFIG_IEEE80211_CRYPT_WEP=m 415CONFIG_IEEE80211_CRYPT_WEP=m
407CONFIG_IEEE80211_CRYPT_CCMP=m 416CONFIG_IEEE80211_CRYPT_CCMP=m
408CONFIG_IEEE80211_CRYPT_TKIP=m 417CONFIG_IEEE80211_CRYPT_TKIP=m
409CONFIG_IEEE80211_SOFTMAC=m
410# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
411# CONFIG_RFKILL is not set 418# CONFIG_RFKILL is not set
412# CONFIG_NET_9P is not set 419# CONFIG_NET_9P is not set
413 420
@@ -469,11 +476,10 @@ CONFIG_IDE_PROC_FS=y
469# 476#
470# IDE chipset support/bugfixes 477# IDE chipset support/bugfixes
471# 478#
472# CONFIG_IDE_GENERIC is not set
473# CONFIG_BLK_DEV_PLATFORM is not set 479# CONFIG_BLK_DEV_PLATFORM is not set
474CONFIG_BLK_DEV_FALCON_IDE=y 480CONFIG_BLK_DEV_FALCON_IDE=y
475# CONFIG_BLK_DEV_IDEDMA is not set 481# CONFIG_BLK_DEV_IDEDMA is not set
476# CONFIG_IDE_ARCH_OBSOLETE_INIT is not set 482# CONFIG_BLK_DEV_HD_ONLY is not set
477# CONFIG_BLK_DEV_HD is not set 483# CONFIG_BLK_DEV_HD is not set
478 484
479# 485#
@@ -572,6 +578,7 @@ CONFIG_ATARILANCE=m
572# 578#
573# CONFIG_WLAN_PRE80211 is not set 579# CONFIG_WLAN_PRE80211 is not set
574# CONFIG_WLAN_80211 is not set 580# CONFIG_WLAN_80211 is not set
581# CONFIG_IWLWIFI_LEDS is not set
575# CONFIG_WAN is not set 582# CONFIG_WAN is not set
576# CONFIG_PLIP is not set 583# CONFIG_PLIP is not set
577CONFIG_PPP=m 584CONFIG_PPP=m
@@ -662,6 +669,7 @@ CONFIG_VT=y
662CONFIG_VT_CONSOLE=y 669CONFIG_VT_CONSOLE=y
663CONFIG_HW_CONSOLE=y 670CONFIG_HW_CONSOLE=y
664CONFIG_VT_HW_CONSOLE_BINDING=y 671CONFIG_VT_HW_CONSOLE_BINDING=y
672# CONFIG_DEVKMEM is not set
665# CONFIG_SERIAL_NONSTANDARD is not set 673# CONFIG_SERIAL_NONSTANDARD is not set
666 674
667# 675#
@@ -687,12 +695,7 @@ CONFIG_GEN_RTC_X=y
687# CONFIG_RAW_DRIVER is not set 695# CONFIG_RAW_DRIVER is not set
688# CONFIG_TCG_TPM is not set 696# CONFIG_TCG_TPM is not set
689# CONFIG_I2C is not set 697# CONFIG_I2C is not set
690
691#
692# SPI support
693#
694# CONFIG_SPI is not set 698# CONFIG_SPI is not set
695# CONFIG_SPI_MASTER is not set
696# CONFIG_W1 is not set 699# CONFIG_W1 is not set
697# CONFIG_POWER_SUPPLY is not set 700# CONFIG_POWER_SUPPLY is not set
698# CONFIG_HWMON is not set 701# CONFIG_HWMON is not set
@@ -709,12 +712,22 @@ CONFIG_SSB_POSSIBLE=y
709# Multifunction device drivers 712# Multifunction device drivers
710# 713#
711# CONFIG_MFD_SM501 is not set 714# CONFIG_MFD_SM501 is not set
715# CONFIG_HTC_PASIC3 is not set
712 716
713# 717#
714# Multimedia devices 718# Multimedia devices
715# 719#
720
721#
722# Multimedia core support
723#
716# CONFIG_VIDEO_DEV is not set 724# CONFIG_VIDEO_DEV is not set
717# CONFIG_DVB_CORE is not set 725# CONFIG_DVB_CORE is not set
726# CONFIG_VIDEO_MEDIA is not set
727
728#
729# Multimedia drivers
730#
718# CONFIG_DAB is not set 731# CONFIG_DAB is not set
719 732
720# 733#
@@ -732,8 +745,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
732# CONFIG_FB_SYS_FILLRECT is not set 745# CONFIG_FB_SYS_FILLRECT is not set
733# CONFIG_FB_SYS_COPYAREA is not set 746# CONFIG_FB_SYS_COPYAREA is not set
734# CONFIG_FB_SYS_IMAGEBLIT is not set 747# CONFIG_FB_SYS_IMAGEBLIT is not set
748# CONFIG_FB_FOREIGN_ENDIAN is not set
735# CONFIG_FB_SYS_FOPS is not set 749# CONFIG_FB_SYS_FOPS is not set
736CONFIG_FB_DEFERRED_IO=y
737# CONFIG_FB_SVGALIB is not set 750# CONFIG_FB_SVGALIB is not set
738# CONFIG_FB_MACMODES is not set 751# CONFIG_FB_MACMODES is not set
739# CONFIG_FB_BACKLIGHT is not set 752# CONFIG_FB_BACKLIGHT is not set
@@ -784,12 +797,9 @@ CONFIG_HIDRAW=y
784# CONFIG_MMC is not set 797# CONFIG_MMC is not set
785# CONFIG_MEMSTICK is not set 798# CONFIG_MEMSTICK is not set
786# CONFIG_NEW_LEDS is not set 799# CONFIG_NEW_LEDS is not set
800# CONFIG_ACCESSIBILITY is not set
787# CONFIG_RTC_CLASS is not set 801# CONFIG_RTC_CLASS is not set
788# CONFIG_AUXDISPLAY is not set 802# CONFIG_AUXDISPLAY is not set
789
790#
791# Userspace I/O
792#
793# CONFIG_UIO is not set 803# CONFIG_UIO is not set
794 804
795# 805#
@@ -821,16 +831,15 @@ CONFIG_JFS_FS=m
821# CONFIG_JFS_SECURITY is not set 831# CONFIG_JFS_SECURITY is not set
822# CONFIG_JFS_DEBUG is not set 832# CONFIG_JFS_DEBUG is not set
823# CONFIG_JFS_STATISTICS is not set 833# CONFIG_JFS_STATISTICS is not set
824CONFIG_FS_POSIX_ACL=y 834# CONFIG_FS_POSIX_ACL is not set
825CONFIG_XFS_FS=m 835CONFIG_XFS_FS=m
826# CONFIG_XFS_QUOTA is not set 836# CONFIG_XFS_QUOTA is not set
827# CONFIG_XFS_SECURITY is not set
828# CONFIG_XFS_POSIX_ACL is not set 837# CONFIG_XFS_POSIX_ACL is not set
829# CONFIG_XFS_RT is not set 838# CONFIG_XFS_RT is not set
830CONFIG_GFS2_FS=m 839# CONFIG_XFS_DEBUG is not set
831CONFIG_GFS2_FS_LOCKING_NOLOCK=m
832CONFIG_GFS2_FS_LOCKING_DLM=m
833CONFIG_OCFS2_FS=m 840CONFIG_OCFS2_FS=m
841CONFIG_OCFS2_FS_O2CB=m
842CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
834# CONFIG_OCFS2_DEBUG_MASKLOG is not set 843# CONFIG_OCFS2_DEBUG_MASKLOG is not set
835# CONFIG_OCFS2_DEBUG_FS is not set 844# CONFIG_OCFS2_DEBUG_FS is not set
836CONFIG_DNOTIFY=y 845CONFIG_DNOTIFY=y
@@ -902,12 +911,10 @@ CONFIG_NFS_FS=m
902CONFIG_NFS_V3=y 911CONFIG_NFS_V3=y
903# CONFIG_NFS_V3_ACL is not set 912# CONFIG_NFS_V3_ACL is not set
904# CONFIG_NFS_V4 is not set 913# CONFIG_NFS_V4 is not set
905# CONFIG_NFS_DIRECTIO is not set
906CONFIG_NFSD=m 914CONFIG_NFSD=m
907CONFIG_NFSD_V3=y 915CONFIG_NFSD_V3=y
908# CONFIG_NFSD_V3_ACL is not set 916# CONFIG_NFSD_V3_ACL is not set
909# CONFIG_NFSD_V4 is not set 917# CONFIG_NFSD_V4 is not set
910CONFIG_NFSD_TCP=y
911CONFIG_LOCKD=m 918CONFIG_LOCKD=m
912CONFIG_LOCKD_V4=y 919CONFIG_LOCKD_V4=y
913CONFIG_EXPORTFS=m 920CONFIG_EXPORTFS=m
@@ -980,6 +987,7 @@ CONFIG_DLM=m
980# CONFIG_PRINTK_TIME is not set 987# CONFIG_PRINTK_TIME is not set
981CONFIG_ENABLE_WARN_DEPRECATED=y 988CONFIG_ENABLE_WARN_DEPRECATED=y
982CONFIG_ENABLE_MUST_CHECK=y 989CONFIG_ENABLE_MUST_CHECK=y
990CONFIG_FRAME_WARN=1024
983CONFIG_MAGIC_SYSRQ=y 991CONFIG_MAGIC_SYSRQ=y
984# CONFIG_UNUSED_SYMBOLS is not set 992# CONFIG_UNUSED_SYMBOLS is not set
985# CONFIG_DEBUG_FS is not set 993# CONFIG_DEBUG_FS is not set
@@ -999,53 +1007,82 @@ CONFIG_ASYNC_CORE=m
999CONFIG_ASYNC_MEMCPY=m 1007CONFIG_ASYNC_MEMCPY=m
1000CONFIG_ASYNC_XOR=m 1008CONFIG_ASYNC_XOR=m
1001CONFIG_CRYPTO=y 1009CONFIG_CRYPTO=y
1010
1011#
1012# Crypto core or helper
1013#
1002CONFIG_CRYPTO_ALGAPI=y 1014CONFIG_CRYPTO_ALGAPI=y
1003CONFIG_CRYPTO_AEAD=m 1015CONFIG_CRYPTO_AEAD=m
1004CONFIG_CRYPTO_BLKCIPHER=m 1016CONFIG_CRYPTO_BLKCIPHER=m
1005CONFIG_CRYPTO_SEQIV=m
1006CONFIG_CRYPTO_HASH=y 1017CONFIG_CRYPTO_HASH=y
1007CONFIG_CRYPTO_MANAGER=y 1018CONFIG_CRYPTO_MANAGER=y
1019CONFIG_CRYPTO_GF128MUL=m
1020CONFIG_CRYPTO_NULL=m
1021CONFIG_CRYPTO_CRYPTD=m
1022CONFIG_CRYPTO_AUTHENC=m
1023CONFIG_CRYPTO_TEST=m
1024
1025#
1026# Authenticated Encryption with Associated Data
1027#
1028CONFIG_CRYPTO_CCM=m
1029CONFIG_CRYPTO_GCM=m
1030CONFIG_CRYPTO_SEQIV=m
1031
1032#
1033# Block modes
1034#
1035CONFIG_CRYPTO_CBC=m
1036CONFIG_CRYPTO_CTR=m
1037CONFIG_CRYPTO_CTS=m
1038CONFIG_CRYPTO_ECB=m
1039CONFIG_CRYPTO_LRW=m
1040CONFIG_CRYPTO_PCBC=m
1041CONFIG_CRYPTO_XTS=m
1042
1043#
1044# Hash modes
1045#
1008CONFIG_CRYPTO_HMAC=y 1046CONFIG_CRYPTO_HMAC=y
1009CONFIG_CRYPTO_XCBC=m 1047CONFIG_CRYPTO_XCBC=m
1010CONFIG_CRYPTO_NULL=m 1048
1049#
1050# Digest
1051#
1052CONFIG_CRYPTO_CRC32C=m
1011CONFIG_CRYPTO_MD4=m 1053CONFIG_CRYPTO_MD4=m
1012CONFIG_CRYPTO_MD5=m 1054CONFIG_CRYPTO_MD5=m
1055CONFIG_CRYPTO_MICHAEL_MIC=m
1013CONFIG_CRYPTO_SHA1=m 1056CONFIG_CRYPTO_SHA1=m
1014CONFIG_CRYPTO_SHA256=m 1057CONFIG_CRYPTO_SHA256=m
1015CONFIG_CRYPTO_SHA512=m 1058CONFIG_CRYPTO_SHA512=m
1016CONFIG_CRYPTO_WP512=m
1017CONFIG_CRYPTO_TGR192=m 1059CONFIG_CRYPTO_TGR192=m
1018CONFIG_CRYPTO_GF128MUL=m 1060CONFIG_CRYPTO_WP512=m
1019CONFIG_CRYPTO_ECB=m 1061
1020CONFIG_CRYPTO_CBC=m 1062#
1021CONFIG_CRYPTO_PCBC=m 1063# Ciphers
1022CONFIG_CRYPTO_LRW=m 1064#
1023CONFIG_CRYPTO_XTS=m
1024CONFIG_CRYPTO_CTR=m
1025CONFIG_CRYPTO_GCM=m
1026CONFIG_CRYPTO_CCM=m
1027CONFIG_CRYPTO_CRYPTD=m
1028CONFIG_CRYPTO_DES=m
1029CONFIG_CRYPTO_FCRYPT=m
1030CONFIG_CRYPTO_BLOWFISH=m
1031CONFIG_CRYPTO_TWOFISH=m
1032CONFIG_CRYPTO_TWOFISH_COMMON=m
1033CONFIG_CRYPTO_SERPENT=m
1034CONFIG_CRYPTO_AES=m 1065CONFIG_CRYPTO_AES=m
1066CONFIG_CRYPTO_ANUBIS=m
1067CONFIG_CRYPTO_ARC4=m
1068CONFIG_CRYPTO_BLOWFISH=m
1069CONFIG_CRYPTO_CAMELLIA=m
1035CONFIG_CRYPTO_CAST5=m 1070CONFIG_CRYPTO_CAST5=m
1036CONFIG_CRYPTO_CAST6=m 1071CONFIG_CRYPTO_CAST6=m
1037CONFIG_CRYPTO_TEA=m 1072CONFIG_CRYPTO_DES=m
1038CONFIG_CRYPTO_ARC4=m 1073CONFIG_CRYPTO_FCRYPT=m
1039CONFIG_CRYPTO_KHAZAD=m 1074CONFIG_CRYPTO_KHAZAD=m
1040CONFIG_CRYPTO_ANUBIS=m
1041CONFIG_CRYPTO_SEED=m
1042CONFIG_CRYPTO_SALSA20=m 1075CONFIG_CRYPTO_SALSA20=m
1076CONFIG_CRYPTO_SEED=m
1077CONFIG_CRYPTO_SERPENT=m
1078CONFIG_CRYPTO_TEA=m
1079CONFIG_CRYPTO_TWOFISH=m
1080CONFIG_CRYPTO_TWOFISH_COMMON=m
1081
1082#
1083# Compression
1084#
1043CONFIG_CRYPTO_DEFLATE=m 1085CONFIG_CRYPTO_DEFLATE=m
1044CONFIG_CRYPTO_MICHAEL_MIC=m
1045CONFIG_CRYPTO_CRC32C=m
1046CONFIG_CRYPTO_CAMELLIA=m
1047CONFIG_CRYPTO_TEST=m
1048CONFIG_CRYPTO_AUTHENC=m
1049CONFIG_CRYPTO_LZO=m 1086CONFIG_CRYPTO_LZO=m
1050# CONFIG_CRYPTO_HW is not set 1087# CONFIG_CRYPTO_HW is not set
1051 1088
@@ -1053,9 +1090,11 @@ CONFIG_CRYPTO_LZO=m
1053# Library routines 1090# Library routines
1054# 1091#
1055CONFIG_BITREVERSE=y 1092CONFIG_BITREVERSE=y
1093# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1094# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1056CONFIG_CRC_CCITT=m 1095CONFIG_CRC_CCITT=m
1057CONFIG_CRC16=y 1096CONFIG_CRC16=y
1058# CONFIG_CRC_ITU_T is not set 1097CONFIG_CRC_ITU_T=m
1059CONFIG_CRC32=y 1098CONFIG_CRC32=y
1060# CONFIG_CRC7 is not set 1099# CONFIG_CRC7 is not set
1061CONFIG_LIBCRC32C=m 1100CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig
index ed98eff708c4..a0a9b30bb502 100644
--- a/arch/m68k/configs/bvme6000_defconfig
+++ b/arch/m68k/configs/bvme6000_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:10 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -144,6 +147,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
144CONFIG_NEED_MULTIPLE_NODES=y 147CONFIG_NEED_MULTIPLE_NODES=y
145# CONFIG_SPARSEMEM_STATIC is not set 148# CONFIG_SPARSEMEM_STATIC is not set
146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 149# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
150CONFIG_PAGEFLAGS_EXTENDED=y
147CONFIG_SPLIT_PTLOCK_CPUS=4 151CONFIG_SPLIT_PTLOCK_CPUS=4
148# CONFIG_RESOURCES_64BIT is not set 152# CONFIG_RESOURCES_64BIT is not set
149CONFIG_ZONE_DMA_FLAG=1 153CONFIG_ZONE_DMA_FLAG=1
@@ -222,8 +226,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
222CONFIG_INET6_XFRM_MODE_BEET=m 226CONFIG_INET6_XFRM_MODE_BEET=m
223CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 227CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
224CONFIG_IPV6_SIT=m 228CONFIG_IPV6_SIT=m
229CONFIG_IPV6_NDISC_NODETYPE=y
225CONFIG_IPV6_TUNNEL=m 230CONFIG_IPV6_TUNNEL=m
226# CONFIG_IPV6_MULTIPLE_TABLES is not set 231# CONFIG_IPV6_MULTIPLE_TABLES is not set
232# CONFIG_IPV6_MROUTE is not set
227# CONFIG_NETWORK_SECMARK is not set 233# CONFIG_NETWORK_SECMARK is not set
228CONFIG_NETFILTER=y 234CONFIG_NETFILTER=y
229# CONFIG_NETFILTER_DEBUG is not set 235# CONFIG_NETFILTER_DEBUG is not set
@@ -239,6 +245,7 @@ CONFIG_NF_CONNTRACK=m
239CONFIG_NF_CT_ACCT=y 245CONFIG_NF_CT_ACCT=y
240CONFIG_NF_CONNTRACK_MARK=y 246CONFIG_NF_CONNTRACK_MARK=y
241# CONFIG_NF_CONNTRACK_EVENTS is not set 247# CONFIG_NF_CONNTRACK_EVENTS is not set
248# CONFIG_NF_CT_PROTO_DCCP is not set
242CONFIG_NF_CT_PROTO_GRE=m 249CONFIG_NF_CT_PROTO_GRE=m
243CONFIG_NF_CT_PROTO_SCTP=m 250CONFIG_NF_CT_PROTO_SCTP=m
244CONFIG_NF_CT_PROTO_UDPLITE=m 251CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -317,6 +324,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
317CONFIG_IP_NF_TARGET_NETMAP=m 324CONFIG_IP_NF_TARGET_NETMAP=m
318CONFIG_NF_NAT_SNMP_BASIC=m 325CONFIG_NF_NAT_SNMP_BASIC=m
319CONFIG_NF_NAT_PROTO_GRE=m 326CONFIG_NF_NAT_PROTO_GRE=m
327CONFIG_NF_NAT_PROTO_UDPLITE=m
328CONFIG_NF_NAT_PROTO_SCTP=m
320CONFIG_NF_NAT_FTP=m 329CONFIG_NF_NAT_FTP=m
321CONFIG_NF_NAT_IRC=m 330CONFIG_NF_NAT_IRC=m
322CONFIG_NF_NAT_TFTP=m 331CONFIG_NF_NAT_TFTP=m
@@ -410,8 +419,6 @@ CONFIG_IEEE80211=m
410CONFIG_IEEE80211_CRYPT_WEP=m 419CONFIG_IEEE80211_CRYPT_WEP=m
411CONFIG_IEEE80211_CRYPT_CCMP=m 420CONFIG_IEEE80211_CRYPT_CCMP=m
412CONFIG_IEEE80211_CRYPT_TKIP=m 421CONFIG_IEEE80211_CRYPT_TKIP=m
413CONFIG_IEEE80211_SOFTMAC=m
414# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
415# CONFIG_RFKILL is not set 422# CONFIG_RFKILL is not set
416# CONFIG_NET_9P is not set 423# CONFIG_NET_9P is not set
417 424
@@ -543,6 +550,7 @@ CONFIG_BVME6000_NET=y
543# 550#
544# CONFIG_WLAN_PRE80211 is not set 551# CONFIG_WLAN_PRE80211 is not set
545# CONFIG_WLAN_80211 is not set 552# CONFIG_WLAN_80211 is not set
553# CONFIG_IWLWIFI_LEDS is not set
546# CONFIG_WAN is not set 554# CONFIG_WAN is not set
547CONFIG_PPP=m 555CONFIG_PPP=m
548# CONFIG_PPP_MULTILINK is not set 556# CONFIG_PPP_MULTILINK is not set
@@ -626,6 +634,7 @@ CONFIG_VT=y
626CONFIG_VT_CONSOLE=y 634CONFIG_VT_CONSOLE=y
627CONFIG_HW_CONSOLE=y 635CONFIG_HW_CONSOLE=y
628CONFIG_VT_HW_CONSOLE_BINDING=y 636CONFIG_VT_HW_CONSOLE_BINDING=y
637# CONFIG_DEVKMEM is not set
629# CONFIG_SERIAL_NONSTANDARD is not set 638# CONFIG_SERIAL_NONSTANDARD is not set
630 639
631# 640#
@@ -647,12 +656,7 @@ CONFIG_GEN_RTC_X=y
647# CONFIG_RAW_DRIVER is not set 656# CONFIG_RAW_DRIVER is not set
648# CONFIG_TCG_TPM is not set 657# CONFIG_TCG_TPM is not set
649# CONFIG_I2C is not set 658# CONFIG_I2C is not set
650
651#
652# SPI support
653#
654# CONFIG_SPI is not set 659# CONFIG_SPI is not set
655# CONFIG_SPI_MASTER is not set
656# CONFIG_W1 is not set 660# CONFIG_W1 is not set
657# CONFIG_POWER_SUPPLY is not set 661# CONFIG_POWER_SUPPLY is not set
658# CONFIG_HWMON is not set 662# CONFIG_HWMON is not set
@@ -669,12 +673,22 @@ CONFIG_SSB_POSSIBLE=y
669# Multifunction device drivers 673# Multifunction device drivers
670# 674#
671# CONFIG_MFD_SM501 is not set 675# CONFIG_MFD_SM501 is not set
676# CONFIG_HTC_PASIC3 is not set
672 677
673# 678#
674# Multimedia devices 679# Multimedia devices
675# 680#
681
682#
683# Multimedia core support
684#
676# CONFIG_VIDEO_DEV is not set 685# CONFIG_VIDEO_DEV is not set
677# CONFIG_DVB_CORE is not set 686# CONFIG_DVB_CORE is not set
687# CONFIG_VIDEO_MEDIA is not set
688
689#
690# Multimedia drivers
691#
678# CONFIG_DAB is not set 692# CONFIG_DAB is not set
679 693
680# 694#
@@ -707,11 +721,8 @@ CONFIG_HIDRAW=y
707# CONFIG_MMC is not set 721# CONFIG_MMC is not set
708# CONFIG_MEMSTICK is not set 722# CONFIG_MEMSTICK is not set
709# CONFIG_NEW_LEDS is not set 723# CONFIG_NEW_LEDS is not set
724# CONFIG_ACCESSIBILITY is not set
710# CONFIG_RTC_CLASS is not set 725# CONFIG_RTC_CLASS is not set
711
712#
713# Userspace I/O
714#
715# CONFIG_UIO is not set 726# CONFIG_UIO is not set
716 727
717# 728#
@@ -739,16 +750,15 @@ CONFIG_JFS_FS=m
739# CONFIG_JFS_SECURITY is not set 750# CONFIG_JFS_SECURITY is not set
740# CONFIG_JFS_DEBUG is not set 751# CONFIG_JFS_DEBUG is not set
741# CONFIG_JFS_STATISTICS is not set 752# CONFIG_JFS_STATISTICS is not set
742CONFIG_FS_POSIX_ACL=y 753# CONFIG_FS_POSIX_ACL is not set
743CONFIG_XFS_FS=m 754CONFIG_XFS_FS=m
744# CONFIG_XFS_QUOTA is not set 755# CONFIG_XFS_QUOTA is not set
745# CONFIG_XFS_SECURITY is not set
746# CONFIG_XFS_POSIX_ACL is not set 756# CONFIG_XFS_POSIX_ACL is not set
747# CONFIG_XFS_RT is not set 757# CONFIG_XFS_RT is not set
748CONFIG_GFS2_FS=m 758# CONFIG_XFS_DEBUG is not set
749CONFIG_GFS2_FS_LOCKING_NOLOCK=m
750CONFIG_GFS2_FS_LOCKING_DLM=m
751CONFIG_OCFS2_FS=m 759CONFIG_OCFS2_FS=m
760CONFIG_OCFS2_FS_O2CB=m
761CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
752# CONFIG_OCFS2_DEBUG_MASKLOG is not set 762# CONFIG_OCFS2_DEBUG_MASKLOG is not set
753# CONFIG_OCFS2_DEBUG_FS is not set 763# CONFIG_OCFS2_DEBUG_FS is not set
754CONFIG_DNOTIFY=y 764CONFIG_DNOTIFY=y
@@ -820,12 +830,10 @@ CONFIG_NFS_FS=y
820CONFIG_NFS_V3=y 830CONFIG_NFS_V3=y
821# CONFIG_NFS_V3_ACL is not set 831# CONFIG_NFS_V3_ACL is not set
822CONFIG_NFS_V4=y 832CONFIG_NFS_V4=y
823# CONFIG_NFS_DIRECTIO is not set
824CONFIG_NFSD=m 833CONFIG_NFSD=m
825CONFIG_NFSD_V3=y 834CONFIG_NFSD_V3=y
826# CONFIG_NFSD_V3_ACL is not set 835# CONFIG_NFSD_V3_ACL is not set
827# CONFIG_NFSD_V4 is not set 836# CONFIG_NFSD_V4 is not set
828CONFIG_NFSD_TCP=y
829CONFIG_ROOT_NFS=y 837CONFIG_ROOT_NFS=y
830CONFIG_LOCKD=y 838CONFIG_LOCKD=y
831CONFIG_LOCKD_V4=y 839CONFIG_LOCKD_V4=y
@@ -900,6 +908,7 @@ CONFIG_DLM=m
900# CONFIG_PRINTK_TIME is not set 908# CONFIG_PRINTK_TIME is not set
901CONFIG_ENABLE_WARN_DEPRECATED=y 909CONFIG_ENABLE_WARN_DEPRECATED=y
902CONFIG_ENABLE_MUST_CHECK=y 910CONFIG_ENABLE_MUST_CHECK=y
911CONFIG_FRAME_WARN=1024
903CONFIG_MAGIC_SYSRQ=y 912CONFIG_MAGIC_SYSRQ=y
904# CONFIG_UNUSED_SYMBOLS is not set 913# CONFIG_UNUSED_SYMBOLS is not set
905# CONFIG_DEBUG_FS is not set 914# CONFIG_DEBUG_FS is not set
@@ -919,53 +928,82 @@ CONFIG_ASYNC_CORE=m
919CONFIG_ASYNC_MEMCPY=m 928CONFIG_ASYNC_MEMCPY=m
920CONFIG_ASYNC_XOR=m 929CONFIG_ASYNC_XOR=m
921CONFIG_CRYPTO=y 930CONFIG_CRYPTO=y
931
932#
933# Crypto core or helper
934#
922CONFIG_CRYPTO_ALGAPI=y 935CONFIG_CRYPTO_ALGAPI=y
923CONFIG_CRYPTO_AEAD=m 936CONFIG_CRYPTO_AEAD=m
924CONFIG_CRYPTO_BLKCIPHER=y 937CONFIG_CRYPTO_BLKCIPHER=y
925CONFIG_CRYPTO_SEQIV=m
926CONFIG_CRYPTO_HASH=y 938CONFIG_CRYPTO_HASH=y
927CONFIG_CRYPTO_MANAGER=y 939CONFIG_CRYPTO_MANAGER=y
940CONFIG_CRYPTO_GF128MUL=m
941CONFIG_CRYPTO_NULL=m
942CONFIG_CRYPTO_CRYPTD=m
943CONFIG_CRYPTO_AUTHENC=m
944CONFIG_CRYPTO_TEST=m
945
946#
947# Authenticated Encryption with Associated Data
948#
949CONFIG_CRYPTO_CCM=m
950CONFIG_CRYPTO_GCM=m
951CONFIG_CRYPTO_SEQIV=m
952
953#
954# Block modes
955#
956CONFIG_CRYPTO_CBC=y
957CONFIG_CRYPTO_CTR=m
958CONFIG_CRYPTO_CTS=m
959CONFIG_CRYPTO_ECB=m
960CONFIG_CRYPTO_LRW=m
961CONFIG_CRYPTO_PCBC=m
962CONFIG_CRYPTO_XTS=m
963
964#
965# Hash modes
966#
928CONFIG_CRYPTO_HMAC=y 967CONFIG_CRYPTO_HMAC=y
929CONFIG_CRYPTO_XCBC=m 968CONFIG_CRYPTO_XCBC=m
930CONFIG_CRYPTO_NULL=m 969
970#
971# Digest
972#
973CONFIG_CRYPTO_CRC32C=m
931CONFIG_CRYPTO_MD4=m 974CONFIG_CRYPTO_MD4=m
932CONFIG_CRYPTO_MD5=y 975CONFIG_CRYPTO_MD5=y
976CONFIG_CRYPTO_MICHAEL_MIC=m
933CONFIG_CRYPTO_SHA1=m 977CONFIG_CRYPTO_SHA1=m
934CONFIG_CRYPTO_SHA256=m 978CONFIG_CRYPTO_SHA256=m
935CONFIG_CRYPTO_SHA512=m 979CONFIG_CRYPTO_SHA512=m
936CONFIG_CRYPTO_WP512=m
937CONFIG_CRYPTO_TGR192=m 980CONFIG_CRYPTO_TGR192=m
938CONFIG_CRYPTO_GF128MUL=m 981CONFIG_CRYPTO_WP512=m
939CONFIG_CRYPTO_ECB=m 982
940CONFIG_CRYPTO_CBC=y 983#
941CONFIG_CRYPTO_PCBC=m 984# Ciphers
942CONFIG_CRYPTO_LRW=m 985#
943CONFIG_CRYPTO_XTS=m
944CONFIG_CRYPTO_CTR=m
945CONFIG_CRYPTO_GCM=m
946CONFIG_CRYPTO_CCM=m
947CONFIG_CRYPTO_CRYPTD=m
948CONFIG_CRYPTO_DES=y
949CONFIG_CRYPTO_FCRYPT=m
950CONFIG_CRYPTO_BLOWFISH=m
951CONFIG_CRYPTO_TWOFISH=m
952CONFIG_CRYPTO_TWOFISH_COMMON=m
953CONFIG_CRYPTO_SERPENT=m
954CONFIG_CRYPTO_AES=m 986CONFIG_CRYPTO_AES=m
987CONFIG_CRYPTO_ANUBIS=m
988CONFIG_CRYPTO_ARC4=m
989CONFIG_CRYPTO_BLOWFISH=m
990CONFIG_CRYPTO_CAMELLIA=m
955CONFIG_CRYPTO_CAST5=m 991CONFIG_CRYPTO_CAST5=m
956CONFIG_CRYPTO_CAST6=m 992CONFIG_CRYPTO_CAST6=m
957CONFIG_CRYPTO_TEA=m 993CONFIG_CRYPTO_DES=y
958CONFIG_CRYPTO_ARC4=m 994CONFIG_CRYPTO_FCRYPT=m
959CONFIG_CRYPTO_KHAZAD=m 995CONFIG_CRYPTO_KHAZAD=m
960CONFIG_CRYPTO_ANUBIS=m
961CONFIG_CRYPTO_SEED=m
962CONFIG_CRYPTO_SALSA20=m 996CONFIG_CRYPTO_SALSA20=m
997CONFIG_CRYPTO_SEED=m
998CONFIG_CRYPTO_SERPENT=m
999CONFIG_CRYPTO_TEA=m
1000CONFIG_CRYPTO_TWOFISH=m
1001CONFIG_CRYPTO_TWOFISH_COMMON=m
1002
1003#
1004# Compression
1005#
963CONFIG_CRYPTO_DEFLATE=m 1006CONFIG_CRYPTO_DEFLATE=m
964CONFIG_CRYPTO_MICHAEL_MIC=m
965CONFIG_CRYPTO_CRC32C=m
966CONFIG_CRYPTO_CAMELLIA=m
967CONFIG_CRYPTO_TEST=m
968CONFIG_CRYPTO_AUTHENC=m
969CONFIG_CRYPTO_LZO=m 1007CONFIG_CRYPTO_LZO=m
970# CONFIG_CRYPTO_HW is not set 1008# CONFIG_CRYPTO_HW is not set
971 1009
@@ -973,9 +1011,11 @@ CONFIG_CRYPTO_LZO=m
973# Library routines 1011# Library routines
974# 1012#
975CONFIG_BITREVERSE=m 1013CONFIG_BITREVERSE=m
1014# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1015# CONFIG_GENERIC_FIND_NEXT_BIT is not set
976CONFIG_CRC_CCITT=m 1016CONFIG_CRC_CCITT=m
977CONFIG_CRC16=m 1017CONFIG_CRC16=m
978# CONFIG_CRC_ITU_T is not set 1018CONFIG_CRC_ITU_T=m
979CONFIG_CRC32=m 1019CONFIG_CRC32=m
980# CONFIG_CRC7 is not set 1020# CONFIG_CRC7 is not set
981CONFIG_LIBCRC32C=m 1021CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig
index 38b68c70e567..6778041de262 100644
--- a/arch/m68k/configs/hp300_defconfig
+++ b/arch/m68k/configs/hp300_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:12 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -142,6 +145,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
142CONFIG_NEED_MULTIPLE_NODES=y 145CONFIG_NEED_MULTIPLE_NODES=y
143# CONFIG_SPARSEMEM_STATIC is not set 146# CONFIG_SPARSEMEM_STATIC is not set
144# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 147# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
148CONFIG_PAGEFLAGS_EXTENDED=y
145CONFIG_SPLIT_PTLOCK_CPUS=4 149CONFIG_SPLIT_PTLOCK_CPUS=4
146# CONFIG_RESOURCES_64BIT is not set 150# CONFIG_RESOURCES_64BIT is not set
147CONFIG_ZONE_DMA_FLAG=1 151CONFIG_ZONE_DMA_FLAG=1
@@ -221,8 +225,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
221CONFIG_INET6_XFRM_MODE_BEET=m 225CONFIG_INET6_XFRM_MODE_BEET=m
222CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 226CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
223CONFIG_IPV6_SIT=m 227CONFIG_IPV6_SIT=m
228CONFIG_IPV6_NDISC_NODETYPE=y
224CONFIG_IPV6_TUNNEL=m 229CONFIG_IPV6_TUNNEL=m
225# CONFIG_IPV6_MULTIPLE_TABLES is not set 230# CONFIG_IPV6_MULTIPLE_TABLES is not set
231# CONFIG_IPV6_MROUTE is not set
226# CONFIG_NETWORK_SECMARK is not set 232# CONFIG_NETWORK_SECMARK is not set
227CONFIG_NETFILTER=y 233CONFIG_NETFILTER=y
228# CONFIG_NETFILTER_DEBUG is not set 234# CONFIG_NETFILTER_DEBUG is not set
@@ -238,6 +244,7 @@ CONFIG_NF_CONNTRACK=m
238CONFIG_NF_CT_ACCT=y 244CONFIG_NF_CT_ACCT=y
239CONFIG_NF_CONNTRACK_MARK=y 245CONFIG_NF_CONNTRACK_MARK=y
240# CONFIG_NF_CONNTRACK_EVENTS is not set 246# CONFIG_NF_CONNTRACK_EVENTS is not set
247# CONFIG_NF_CT_PROTO_DCCP is not set
241CONFIG_NF_CT_PROTO_GRE=m 248CONFIG_NF_CT_PROTO_GRE=m
242CONFIG_NF_CT_PROTO_SCTP=m 249CONFIG_NF_CT_PROTO_SCTP=m
243CONFIG_NF_CT_PROTO_UDPLITE=m 250CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -316,6 +323,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
316CONFIG_IP_NF_TARGET_NETMAP=m 323CONFIG_IP_NF_TARGET_NETMAP=m
317CONFIG_NF_NAT_SNMP_BASIC=m 324CONFIG_NF_NAT_SNMP_BASIC=m
318CONFIG_NF_NAT_PROTO_GRE=m 325CONFIG_NF_NAT_PROTO_GRE=m
326CONFIG_NF_NAT_PROTO_UDPLITE=m
327CONFIG_NF_NAT_PROTO_SCTP=m
319CONFIG_NF_NAT_FTP=m 328CONFIG_NF_NAT_FTP=m
320CONFIG_NF_NAT_IRC=m 329CONFIG_NF_NAT_IRC=m
321CONFIG_NF_NAT_TFTP=m 330CONFIG_NF_NAT_TFTP=m
@@ -409,8 +418,6 @@ CONFIG_IEEE80211=m
409CONFIG_IEEE80211_CRYPT_WEP=m 418CONFIG_IEEE80211_CRYPT_WEP=m
410CONFIG_IEEE80211_CRYPT_CCMP=m 419CONFIG_IEEE80211_CRYPT_CCMP=m
411CONFIG_IEEE80211_CRYPT_TKIP=m 420CONFIG_IEEE80211_CRYPT_TKIP=m
412CONFIG_IEEE80211_SOFTMAC=m
413# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
414# CONFIG_RFKILL is not set 421# CONFIG_RFKILL is not set
415# CONFIG_NET_9P is not set 422# CONFIG_NET_9P is not set
416 423
@@ -540,6 +547,7 @@ CONFIG_HPLANCE=y
540# 547#
541# CONFIG_WLAN_PRE80211 is not set 548# CONFIG_WLAN_PRE80211 is not set
542# CONFIG_WLAN_80211 is not set 549# CONFIG_WLAN_80211 is not set
550# CONFIG_IWLWIFI_LEDS is not set
543# CONFIG_WAN is not set 551# CONFIG_WAN is not set
544CONFIG_PPP=m 552CONFIG_PPP=m
545# CONFIG_PPP_MULTILINK is not set 553# CONFIG_PPP_MULTILINK is not set
@@ -631,6 +639,7 @@ CONFIG_VT=y
631CONFIG_VT_CONSOLE=y 639CONFIG_VT_CONSOLE=y
632CONFIG_HW_CONSOLE=y 640CONFIG_HW_CONSOLE=y
633CONFIG_VT_HW_CONSOLE_BINDING=y 641CONFIG_VT_HW_CONSOLE_BINDING=y
642# CONFIG_DEVKMEM is not set
634# CONFIG_SERIAL_NONSTANDARD is not set 643# CONFIG_SERIAL_NONSTANDARD is not set
635 644
636# 645#
@@ -652,12 +661,7 @@ CONFIG_GEN_RTC_X=y
652# CONFIG_RAW_DRIVER is not set 661# CONFIG_RAW_DRIVER is not set
653# CONFIG_TCG_TPM is not set 662# CONFIG_TCG_TPM is not set
654# CONFIG_I2C is not set 663# CONFIG_I2C is not set
655
656#
657# SPI support
658#
659# CONFIG_SPI is not set 664# CONFIG_SPI is not set
660# CONFIG_SPI_MASTER is not set
661# CONFIG_W1 is not set 665# CONFIG_W1 is not set
662# CONFIG_POWER_SUPPLY is not set 666# CONFIG_POWER_SUPPLY is not set
663# CONFIG_HWMON is not set 667# CONFIG_HWMON is not set
@@ -674,12 +678,22 @@ CONFIG_SSB_POSSIBLE=y
674# Multifunction device drivers 678# Multifunction device drivers
675# 679#
676# CONFIG_MFD_SM501 is not set 680# CONFIG_MFD_SM501 is not set
681# CONFIG_HTC_PASIC3 is not set
677 682
678# 683#
679# Multimedia devices 684# Multimedia devices
680# 685#
686
687#
688# Multimedia core support
689#
681# CONFIG_VIDEO_DEV is not set 690# CONFIG_VIDEO_DEV is not set
682# CONFIG_DVB_CORE is not set 691# CONFIG_DVB_CORE is not set
692# CONFIG_VIDEO_MEDIA is not set
693
694#
695# Multimedia drivers
696#
683# CONFIG_DAB is not set 697# CONFIG_DAB is not set
684 698
685# 699#
@@ -690,15 +704,15 @@ CONFIG_SSB_POSSIBLE=y
690CONFIG_FB=y 704CONFIG_FB=y
691# CONFIG_FIRMWARE_EDID is not set 705# CONFIG_FIRMWARE_EDID is not set
692# CONFIG_FB_DDC is not set 706# CONFIG_FB_DDC is not set
693CONFIG_FB_CFB_FILLRECT=y 707# CONFIG_FB_CFB_FILLRECT is not set
694# CONFIG_FB_CFB_COPYAREA is not set 708# CONFIG_FB_CFB_COPYAREA is not set
695CONFIG_FB_CFB_IMAGEBLIT=y 709CONFIG_FB_CFB_IMAGEBLIT=y
696# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set 710# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
697# CONFIG_FB_SYS_FILLRECT is not set 711# CONFIG_FB_SYS_FILLRECT is not set
698# CONFIG_FB_SYS_COPYAREA is not set 712# CONFIG_FB_SYS_COPYAREA is not set
699# CONFIG_FB_SYS_IMAGEBLIT is not set 713# CONFIG_FB_SYS_IMAGEBLIT is not set
714# CONFIG_FB_FOREIGN_ENDIAN is not set
700# CONFIG_FB_SYS_FOPS is not set 715# CONFIG_FB_SYS_FOPS is not set
701CONFIG_FB_DEFERRED_IO=y
702# CONFIG_FB_SVGALIB is not set 716# CONFIG_FB_SVGALIB is not set
703# CONFIG_FB_MACMODES is not set 717# CONFIG_FB_MACMODES is not set
704# CONFIG_FB_BACKLIGHT is not set 718# CONFIG_FB_BACKLIGHT is not set
@@ -746,11 +760,8 @@ CONFIG_HIDRAW=y
746# CONFIG_MMC is not set 760# CONFIG_MMC is not set
747# CONFIG_MEMSTICK is not set 761# CONFIG_MEMSTICK is not set
748# CONFIG_NEW_LEDS is not set 762# CONFIG_NEW_LEDS is not set
763# CONFIG_ACCESSIBILITY is not set
749# CONFIG_RTC_CLASS is not set 764# CONFIG_RTC_CLASS is not set
750
751#
752# Userspace I/O
753#
754# CONFIG_UIO is not set 765# CONFIG_UIO is not set
755 766
756# 767#
@@ -776,16 +787,15 @@ CONFIG_JFS_FS=m
776# CONFIG_JFS_SECURITY is not set 787# CONFIG_JFS_SECURITY is not set
777# CONFIG_JFS_DEBUG is not set 788# CONFIG_JFS_DEBUG is not set
778# CONFIG_JFS_STATISTICS is not set 789# CONFIG_JFS_STATISTICS is not set
779CONFIG_FS_POSIX_ACL=y 790# CONFIG_FS_POSIX_ACL is not set
780CONFIG_XFS_FS=m 791CONFIG_XFS_FS=m
781# CONFIG_XFS_QUOTA is not set 792# CONFIG_XFS_QUOTA is not set
782# CONFIG_XFS_SECURITY is not set
783# CONFIG_XFS_POSIX_ACL is not set 793# CONFIG_XFS_POSIX_ACL is not set
784# CONFIG_XFS_RT is not set 794# CONFIG_XFS_RT is not set
785CONFIG_GFS2_FS=m 795# CONFIG_XFS_DEBUG is not set
786CONFIG_GFS2_FS_LOCKING_NOLOCK=m
787CONFIG_GFS2_FS_LOCKING_DLM=m
788CONFIG_OCFS2_FS=m 796CONFIG_OCFS2_FS=m
797CONFIG_OCFS2_FS_O2CB=m
798CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
789# CONFIG_OCFS2_DEBUG_MASKLOG is not set 799# CONFIG_OCFS2_DEBUG_MASKLOG is not set
790# CONFIG_OCFS2_DEBUG_FS is not set 800# CONFIG_OCFS2_DEBUG_FS is not set
791CONFIG_DNOTIFY=y 801CONFIG_DNOTIFY=y
@@ -857,12 +867,10 @@ CONFIG_NFS_FS=y
857CONFIG_NFS_V3=y 867CONFIG_NFS_V3=y
858# CONFIG_NFS_V3_ACL is not set 868# CONFIG_NFS_V3_ACL is not set
859CONFIG_NFS_V4=y 869CONFIG_NFS_V4=y
860# CONFIG_NFS_DIRECTIO is not set
861CONFIG_NFSD=m 870CONFIG_NFSD=m
862CONFIG_NFSD_V3=y 871CONFIG_NFSD_V3=y
863# CONFIG_NFSD_V3_ACL is not set 872# CONFIG_NFSD_V3_ACL is not set
864# CONFIG_NFSD_V4 is not set 873# CONFIG_NFSD_V4 is not set
865CONFIG_NFSD_TCP=y
866CONFIG_ROOT_NFS=y 874CONFIG_ROOT_NFS=y
867CONFIG_LOCKD=y 875CONFIG_LOCKD=y
868CONFIG_LOCKD_V4=y 876CONFIG_LOCKD_V4=y
@@ -936,6 +944,7 @@ CONFIG_DLM=m
936# CONFIG_PRINTK_TIME is not set 944# CONFIG_PRINTK_TIME is not set
937CONFIG_ENABLE_WARN_DEPRECATED=y 945CONFIG_ENABLE_WARN_DEPRECATED=y
938CONFIG_ENABLE_MUST_CHECK=y 946CONFIG_ENABLE_MUST_CHECK=y
947CONFIG_FRAME_WARN=1024
939CONFIG_MAGIC_SYSRQ=y 948CONFIG_MAGIC_SYSRQ=y
940# CONFIG_UNUSED_SYMBOLS is not set 949# CONFIG_UNUSED_SYMBOLS is not set
941# CONFIG_DEBUG_FS is not set 950# CONFIG_DEBUG_FS is not set
@@ -955,53 +964,82 @@ CONFIG_ASYNC_CORE=m
955CONFIG_ASYNC_MEMCPY=m 964CONFIG_ASYNC_MEMCPY=m
956CONFIG_ASYNC_XOR=m 965CONFIG_ASYNC_XOR=m
957CONFIG_CRYPTO=y 966CONFIG_CRYPTO=y
967
968#
969# Crypto core or helper
970#
958CONFIG_CRYPTO_ALGAPI=y 971CONFIG_CRYPTO_ALGAPI=y
959CONFIG_CRYPTO_AEAD=m 972CONFIG_CRYPTO_AEAD=m
960CONFIG_CRYPTO_BLKCIPHER=y 973CONFIG_CRYPTO_BLKCIPHER=y
961CONFIG_CRYPTO_SEQIV=m
962CONFIG_CRYPTO_HASH=y 974CONFIG_CRYPTO_HASH=y
963CONFIG_CRYPTO_MANAGER=y 975CONFIG_CRYPTO_MANAGER=y
976CONFIG_CRYPTO_GF128MUL=m
977CONFIG_CRYPTO_NULL=m
978CONFIG_CRYPTO_CRYPTD=m
979CONFIG_CRYPTO_AUTHENC=m
980CONFIG_CRYPTO_TEST=m
981
982#
983# Authenticated Encryption with Associated Data
984#
985CONFIG_CRYPTO_CCM=m
986CONFIG_CRYPTO_GCM=m
987CONFIG_CRYPTO_SEQIV=m
988
989#
990# Block modes
991#
992CONFIG_CRYPTO_CBC=y
993CONFIG_CRYPTO_CTR=m
994CONFIG_CRYPTO_CTS=m
995CONFIG_CRYPTO_ECB=m
996CONFIG_CRYPTO_LRW=m
997CONFIG_CRYPTO_PCBC=m
998CONFIG_CRYPTO_XTS=m
999
1000#
1001# Hash modes
1002#
964CONFIG_CRYPTO_HMAC=y 1003CONFIG_CRYPTO_HMAC=y
965CONFIG_CRYPTO_XCBC=m 1004CONFIG_CRYPTO_XCBC=m
966CONFIG_CRYPTO_NULL=m 1005
1006#
1007# Digest
1008#
1009CONFIG_CRYPTO_CRC32C=m
967CONFIG_CRYPTO_MD4=m 1010CONFIG_CRYPTO_MD4=m
968CONFIG_CRYPTO_MD5=y 1011CONFIG_CRYPTO_MD5=y
1012CONFIG_CRYPTO_MICHAEL_MIC=m
969CONFIG_CRYPTO_SHA1=m 1013CONFIG_CRYPTO_SHA1=m
970CONFIG_CRYPTO_SHA256=m 1014CONFIG_CRYPTO_SHA256=m
971CONFIG_CRYPTO_SHA512=m 1015CONFIG_CRYPTO_SHA512=m
972CONFIG_CRYPTO_WP512=m
973CONFIG_CRYPTO_TGR192=m 1016CONFIG_CRYPTO_TGR192=m
974CONFIG_CRYPTO_GF128MUL=m 1017CONFIG_CRYPTO_WP512=m
975CONFIG_CRYPTO_ECB=m 1018
976CONFIG_CRYPTO_CBC=y 1019#
977CONFIG_CRYPTO_PCBC=m 1020# Ciphers
978CONFIG_CRYPTO_LRW=m 1021#
979CONFIG_CRYPTO_XTS=m
980CONFIG_CRYPTO_CTR=m
981CONFIG_CRYPTO_GCM=m
982CONFIG_CRYPTO_CCM=m
983CONFIG_CRYPTO_CRYPTD=m
984CONFIG_CRYPTO_DES=y
985CONFIG_CRYPTO_FCRYPT=m
986CONFIG_CRYPTO_BLOWFISH=m
987CONFIG_CRYPTO_TWOFISH=m
988CONFIG_CRYPTO_TWOFISH_COMMON=m
989CONFIG_CRYPTO_SERPENT=m
990CONFIG_CRYPTO_AES=m 1022CONFIG_CRYPTO_AES=m
1023CONFIG_CRYPTO_ANUBIS=m
1024CONFIG_CRYPTO_ARC4=m
1025CONFIG_CRYPTO_BLOWFISH=m
1026CONFIG_CRYPTO_CAMELLIA=m
991CONFIG_CRYPTO_CAST5=m 1027CONFIG_CRYPTO_CAST5=m
992CONFIG_CRYPTO_CAST6=m 1028CONFIG_CRYPTO_CAST6=m
993CONFIG_CRYPTO_TEA=m 1029CONFIG_CRYPTO_DES=y
994CONFIG_CRYPTO_ARC4=m 1030CONFIG_CRYPTO_FCRYPT=m
995CONFIG_CRYPTO_KHAZAD=m 1031CONFIG_CRYPTO_KHAZAD=m
996CONFIG_CRYPTO_ANUBIS=m
997CONFIG_CRYPTO_SEED=m
998CONFIG_CRYPTO_SALSA20=m 1032CONFIG_CRYPTO_SALSA20=m
1033CONFIG_CRYPTO_SEED=m
1034CONFIG_CRYPTO_SERPENT=m
1035CONFIG_CRYPTO_TEA=m
1036CONFIG_CRYPTO_TWOFISH=m
1037CONFIG_CRYPTO_TWOFISH_COMMON=m
1038
1039#
1040# Compression
1041#
999CONFIG_CRYPTO_DEFLATE=m 1042CONFIG_CRYPTO_DEFLATE=m
1000CONFIG_CRYPTO_MICHAEL_MIC=m
1001CONFIG_CRYPTO_CRC32C=m
1002CONFIG_CRYPTO_CAMELLIA=m
1003CONFIG_CRYPTO_TEST=m
1004CONFIG_CRYPTO_AUTHENC=m
1005CONFIG_CRYPTO_LZO=m 1043CONFIG_CRYPTO_LZO=m
1006# CONFIG_CRYPTO_HW is not set 1044# CONFIG_CRYPTO_HW is not set
1007 1045
@@ -1009,9 +1047,11 @@ CONFIG_CRYPTO_LZO=m
1009# Library routines 1047# Library routines
1010# 1048#
1011CONFIG_BITREVERSE=y 1049CONFIG_BITREVERSE=y
1050# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1051# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1012CONFIG_CRC_CCITT=m 1052CONFIG_CRC_CCITT=m
1013CONFIG_CRC16=m 1053CONFIG_CRC16=m
1014# CONFIG_CRC_ITU_T is not set 1054CONFIG_CRC_ITU_T=m
1015CONFIG_CRC32=y 1055CONFIG_CRC32=y
1016# CONFIG_CRC7 is not set 1056# CONFIG_CRC7 is not set
1017CONFIG_LIBCRC32C=m 1057CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig
index 738bca695a88..7cd375740348 100644
--- a/arch/m68k/configs/mac_defconfig
+++ b/arch/m68k/configs/mac_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:14 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -143,6 +146,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
143CONFIG_NEED_MULTIPLE_NODES=y 146CONFIG_NEED_MULTIPLE_NODES=y
144# CONFIG_SPARSEMEM_STATIC is not set 147# CONFIG_SPARSEMEM_STATIC is not set
145# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 148# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
149CONFIG_PAGEFLAGS_EXTENDED=y
146CONFIG_SPLIT_PTLOCK_CPUS=4 150CONFIG_SPLIT_PTLOCK_CPUS=4
147# CONFIG_RESOURCES_64BIT is not set 151# CONFIG_RESOURCES_64BIT is not set
148CONFIG_ZONE_DMA_FLAG=1 152CONFIG_ZONE_DMA_FLAG=1
@@ -219,8 +223,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
219CONFIG_INET6_XFRM_MODE_BEET=m 223CONFIG_INET6_XFRM_MODE_BEET=m
220CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 224CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
221CONFIG_IPV6_SIT=m 225CONFIG_IPV6_SIT=m
226CONFIG_IPV6_NDISC_NODETYPE=y
222CONFIG_IPV6_TUNNEL=m 227CONFIG_IPV6_TUNNEL=m
223# CONFIG_IPV6_MULTIPLE_TABLES is not set 228# CONFIG_IPV6_MULTIPLE_TABLES is not set
229# CONFIG_IPV6_MROUTE is not set
224# CONFIG_NETWORK_SECMARK is not set 230# CONFIG_NETWORK_SECMARK is not set
225CONFIG_NETFILTER=y 231CONFIG_NETFILTER=y
226# CONFIG_NETFILTER_DEBUG is not set 232# CONFIG_NETFILTER_DEBUG is not set
@@ -236,6 +242,7 @@ CONFIG_NF_CONNTRACK=m
236CONFIG_NF_CT_ACCT=y 242CONFIG_NF_CT_ACCT=y
237CONFIG_NF_CONNTRACK_MARK=y 243CONFIG_NF_CONNTRACK_MARK=y
238# CONFIG_NF_CONNTRACK_EVENTS is not set 244# CONFIG_NF_CONNTRACK_EVENTS is not set
245# CONFIG_NF_CT_PROTO_DCCP is not set
239CONFIG_NF_CT_PROTO_GRE=m 246CONFIG_NF_CT_PROTO_GRE=m
240CONFIG_NF_CT_PROTO_SCTP=m 247CONFIG_NF_CT_PROTO_SCTP=m
241CONFIG_NF_CT_PROTO_UDPLITE=m 248CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -314,6 +321,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
314CONFIG_IP_NF_TARGET_NETMAP=m 321CONFIG_IP_NF_TARGET_NETMAP=m
315CONFIG_NF_NAT_SNMP_BASIC=m 322CONFIG_NF_NAT_SNMP_BASIC=m
316CONFIG_NF_NAT_PROTO_GRE=m 323CONFIG_NF_NAT_PROTO_GRE=m
324CONFIG_NF_NAT_PROTO_UDPLITE=m
325CONFIG_NF_NAT_PROTO_SCTP=m
317CONFIG_NF_NAT_FTP=m 326CONFIG_NF_NAT_FTP=m
318CONFIG_NF_NAT_IRC=m 327CONFIG_NF_NAT_IRC=m
319CONFIG_NF_NAT_TFTP=m 328CONFIG_NF_NAT_TFTP=m
@@ -410,8 +419,6 @@ CONFIG_IEEE80211=m
410CONFIG_IEEE80211_CRYPT_WEP=m 419CONFIG_IEEE80211_CRYPT_WEP=m
411CONFIG_IEEE80211_CRYPT_CCMP=m 420CONFIG_IEEE80211_CRYPT_CCMP=m
412CONFIG_IEEE80211_CRYPT_TKIP=m 421CONFIG_IEEE80211_CRYPT_TKIP=m
413CONFIG_IEEE80211_SOFTMAC=m
414# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
415# CONFIG_RFKILL is not set 422# CONFIG_RFKILL is not set
416# CONFIG_NET_9P is not set 423# CONFIG_NET_9P is not set
417 424
@@ -467,11 +474,10 @@ CONFIG_IDE_PROC_FS=y
467# 474#
468# IDE chipset support/bugfixes 475# IDE chipset support/bugfixes
469# 476#
470# CONFIG_IDE_GENERIC is not set
471# CONFIG_BLK_DEV_PLATFORM is not set 477# CONFIG_BLK_DEV_PLATFORM is not set
472CONFIG_BLK_DEV_MAC_IDE=y 478CONFIG_BLK_DEV_MAC_IDE=y
473# CONFIG_BLK_DEV_IDEDMA is not set 479# CONFIG_BLK_DEV_IDEDMA is not set
474# CONFIG_IDE_ARCH_OBSOLETE_INIT is not set 480# CONFIG_BLK_DEV_HD_ONLY is not set
475# CONFIG_BLK_DEV_HD is not set 481# CONFIG_BLK_DEV_HD is not set
476 482
477# 483#
@@ -520,6 +526,7 @@ CONFIG_SCSI_LOWLEVEL=y
520CONFIG_ISCSI_TCP=m 526CONFIG_ISCSI_TCP=m
521# CONFIG_SCSI_DEBUG is not set 527# CONFIG_SCSI_DEBUG is not set
522CONFIG_MAC_SCSI=y 528CONFIG_MAC_SCSI=y
529CONFIG_SCSI_MAC_ESP=y
523CONFIG_MD=y 530CONFIG_MD=y
524CONFIG_BLK_DEV_MD=m 531CONFIG_BLK_DEV_MD=m
525CONFIG_MD_LINEAR=m 532CONFIG_MD_LINEAR=m
@@ -580,6 +587,7 @@ CONFIG_MACMACE=y
580# 587#
581# CONFIG_WLAN_PRE80211 is not set 588# CONFIG_WLAN_PRE80211 is not set
582# CONFIG_WLAN_80211 is not set 589# CONFIG_WLAN_80211 is not set
590# CONFIG_IWLWIFI_LEDS is not set
583# CONFIG_WAN is not set 591# CONFIG_WAN is not set
584CONFIG_PPP=m 592CONFIG_PPP=m
585# CONFIG_PPP_MULTILINK is not set 593# CONFIG_PPP_MULTILINK is not set
@@ -665,6 +673,7 @@ CONFIG_VT=y
665CONFIG_VT_CONSOLE=y 673CONFIG_VT_CONSOLE=y
666CONFIG_HW_CONSOLE=y 674CONFIG_HW_CONSOLE=y
667CONFIG_VT_HW_CONSOLE_BINDING=y 675CONFIG_VT_HW_CONSOLE_BINDING=y
676# CONFIG_DEVKMEM is not set
668# CONFIG_SERIAL_NONSTANDARD is not set 677# CONFIG_SERIAL_NONSTANDARD is not set
669 678
670# 679#
@@ -686,12 +695,7 @@ CONFIG_GEN_RTC_X=y
686# CONFIG_RAW_DRIVER is not set 695# CONFIG_RAW_DRIVER is not set
687# CONFIG_TCG_TPM is not set 696# CONFIG_TCG_TPM is not set
688# CONFIG_I2C is not set 697# CONFIG_I2C is not set
689
690#
691# SPI support
692#
693# CONFIG_SPI is not set 698# CONFIG_SPI is not set
694# CONFIG_SPI_MASTER is not set
695# CONFIG_W1 is not set 699# CONFIG_W1 is not set
696# CONFIG_POWER_SUPPLY is not set 700# CONFIG_POWER_SUPPLY is not set
697# CONFIG_HWMON is not set 701# CONFIG_HWMON is not set
@@ -708,12 +712,22 @@ CONFIG_SSB_POSSIBLE=y
708# Multifunction device drivers 712# Multifunction device drivers
709# 713#
710# CONFIG_MFD_SM501 is not set 714# CONFIG_MFD_SM501 is not set
715# CONFIG_HTC_PASIC3 is not set
711 716
712# 717#
713# Multimedia devices 718# Multimedia devices
714# 719#
720
721#
722# Multimedia core support
723#
715# CONFIG_VIDEO_DEV is not set 724# CONFIG_VIDEO_DEV is not set
716# CONFIG_DVB_CORE is not set 725# CONFIG_DVB_CORE is not set
726# CONFIG_VIDEO_MEDIA is not set
727
728#
729# Multimedia drivers
730#
717# CONFIG_DAB is not set 731# CONFIG_DAB is not set
718 732
719# 733#
@@ -731,8 +745,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
731# CONFIG_FB_SYS_FILLRECT is not set 745# CONFIG_FB_SYS_FILLRECT is not set
732# CONFIG_FB_SYS_COPYAREA is not set 746# CONFIG_FB_SYS_COPYAREA is not set
733# CONFIG_FB_SYS_IMAGEBLIT is not set 747# CONFIG_FB_SYS_IMAGEBLIT is not set
748# CONFIG_FB_FOREIGN_ENDIAN is not set
734# CONFIG_FB_SYS_FOPS is not set 749# CONFIG_FB_SYS_FOPS is not set
735CONFIG_FB_DEFERRED_IO=y
736# CONFIG_FB_SVGALIB is not set 750# CONFIG_FB_SVGALIB is not set
737CONFIG_FB_MACMODES=y 751CONFIG_FB_MACMODES=y
738# CONFIG_FB_BACKLIGHT is not set 752# CONFIG_FB_BACKLIGHT is not set
@@ -783,11 +797,8 @@ CONFIG_HIDRAW=y
783# CONFIG_MMC is not set 797# CONFIG_MMC is not set
784# CONFIG_MEMSTICK is not set 798# CONFIG_MEMSTICK is not set
785# CONFIG_NEW_LEDS is not set 799# CONFIG_NEW_LEDS is not set
800# CONFIG_ACCESSIBILITY is not set
786# CONFIG_RTC_CLASS is not set 801# CONFIG_RTC_CLASS is not set
787
788#
789# Userspace I/O
790#
791# CONFIG_UIO is not set 802# CONFIG_UIO is not set
792 803
793# 804#
@@ -816,16 +827,15 @@ CONFIG_JFS_FS=m
816# CONFIG_JFS_SECURITY is not set 827# CONFIG_JFS_SECURITY is not set
817# CONFIG_JFS_DEBUG is not set 828# CONFIG_JFS_DEBUG is not set
818# CONFIG_JFS_STATISTICS is not set 829# CONFIG_JFS_STATISTICS is not set
819CONFIG_FS_POSIX_ACL=y 830# CONFIG_FS_POSIX_ACL is not set
820CONFIG_XFS_FS=m 831CONFIG_XFS_FS=m
821# CONFIG_XFS_QUOTA is not set 832# CONFIG_XFS_QUOTA is not set
822# CONFIG_XFS_SECURITY is not set
823# CONFIG_XFS_POSIX_ACL is not set 833# CONFIG_XFS_POSIX_ACL is not set
824# CONFIG_XFS_RT is not set 834# CONFIG_XFS_RT is not set
825CONFIG_GFS2_FS=m 835# CONFIG_XFS_DEBUG is not set
826CONFIG_GFS2_FS_LOCKING_NOLOCK=m
827CONFIG_GFS2_FS_LOCKING_DLM=m
828CONFIG_OCFS2_FS=m 836CONFIG_OCFS2_FS=m
837CONFIG_OCFS2_FS_O2CB=m
838CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
829# CONFIG_OCFS2_DEBUG_MASKLOG is not set 839# CONFIG_OCFS2_DEBUG_MASKLOG is not set
830# CONFIG_OCFS2_DEBUG_FS is not set 840# CONFIG_OCFS2_DEBUG_FS is not set
831CONFIG_DNOTIFY=y 841CONFIG_DNOTIFY=y
@@ -897,12 +907,10 @@ CONFIG_NFS_FS=m
897CONFIG_NFS_V3=y 907CONFIG_NFS_V3=y
898# CONFIG_NFS_V3_ACL is not set 908# CONFIG_NFS_V3_ACL is not set
899CONFIG_NFS_V4=y 909CONFIG_NFS_V4=y
900# CONFIG_NFS_DIRECTIO is not set
901CONFIG_NFSD=m 910CONFIG_NFSD=m
902CONFIG_NFSD_V3=y 911CONFIG_NFSD_V3=y
903# CONFIG_NFSD_V3_ACL is not set 912# CONFIG_NFSD_V3_ACL is not set
904# CONFIG_NFSD_V4 is not set 913# CONFIG_NFSD_V4 is not set
905CONFIG_NFSD_TCP=y
906CONFIG_LOCKD=m 914CONFIG_LOCKD=m
907CONFIG_LOCKD_V4=y 915CONFIG_LOCKD_V4=y
908CONFIG_EXPORTFS=m 916CONFIG_EXPORTFS=m
@@ -976,6 +984,7 @@ CONFIG_DLM=m
976# CONFIG_PRINTK_TIME is not set 984# CONFIG_PRINTK_TIME is not set
977CONFIG_ENABLE_WARN_DEPRECATED=y 985CONFIG_ENABLE_WARN_DEPRECATED=y
978CONFIG_ENABLE_MUST_CHECK=y 986CONFIG_ENABLE_MUST_CHECK=y
987CONFIG_FRAME_WARN=1024
979CONFIG_MAGIC_SYSRQ=y 988CONFIG_MAGIC_SYSRQ=y
980# CONFIG_UNUSED_SYMBOLS is not set 989# CONFIG_UNUSED_SYMBOLS is not set
981# CONFIG_DEBUG_FS is not set 990# CONFIG_DEBUG_FS is not set
@@ -995,53 +1004,82 @@ CONFIG_ASYNC_CORE=m
995CONFIG_ASYNC_MEMCPY=m 1004CONFIG_ASYNC_MEMCPY=m
996CONFIG_ASYNC_XOR=m 1005CONFIG_ASYNC_XOR=m
997CONFIG_CRYPTO=y 1006CONFIG_CRYPTO=y
1007
1008#
1009# Crypto core or helper
1010#
998CONFIG_CRYPTO_ALGAPI=y 1011CONFIG_CRYPTO_ALGAPI=y
999CONFIG_CRYPTO_AEAD=m 1012CONFIG_CRYPTO_AEAD=m
1000CONFIG_CRYPTO_BLKCIPHER=m 1013CONFIG_CRYPTO_BLKCIPHER=m
1001CONFIG_CRYPTO_SEQIV=m
1002CONFIG_CRYPTO_HASH=y 1014CONFIG_CRYPTO_HASH=y
1003CONFIG_CRYPTO_MANAGER=y 1015CONFIG_CRYPTO_MANAGER=y
1016CONFIG_CRYPTO_GF128MUL=m
1017CONFIG_CRYPTO_NULL=m
1018CONFIG_CRYPTO_CRYPTD=m
1019CONFIG_CRYPTO_AUTHENC=m
1020CONFIG_CRYPTO_TEST=m
1021
1022#
1023# Authenticated Encryption with Associated Data
1024#
1025CONFIG_CRYPTO_CCM=m
1026CONFIG_CRYPTO_GCM=m
1027CONFIG_CRYPTO_SEQIV=m
1028
1029#
1030# Block modes
1031#
1032CONFIG_CRYPTO_CBC=m
1033CONFIG_CRYPTO_CTR=m
1034CONFIG_CRYPTO_CTS=m
1035CONFIG_CRYPTO_ECB=m
1036CONFIG_CRYPTO_LRW=m
1037CONFIG_CRYPTO_PCBC=m
1038CONFIG_CRYPTO_XTS=m
1039
1040#
1041# Hash modes
1042#
1004CONFIG_CRYPTO_HMAC=y 1043CONFIG_CRYPTO_HMAC=y
1005CONFIG_CRYPTO_XCBC=m 1044CONFIG_CRYPTO_XCBC=m
1006CONFIG_CRYPTO_NULL=m 1045
1046#
1047# Digest
1048#
1049CONFIG_CRYPTO_CRC32C=m
1007CONFIG_CRYPTO_MD4=m 1050CONFIG_CRYPTO_MD4=m
1008CONFIG_CRYPTO_MD5=m 1051CONFIG_CRYPTO_MD5=m
1052CONFIG_CRYPTO_MICHAEL_MIC=m
1009CONFIG_CRYPTO_SHA1=m 1053CONFIG_CRYPTO_SHA1=m
1010CONFIG_CRYPTO_SHA256=m 1054CONFIG_CRYPTO_SHA256=m
1011CONFIG_CRYPTO_SHA512=m 1055CONFIG_CRYPTO_SHA512=m
1012CONFIG_CRYPTO_WP512=m
1013CONFIG_CRYPTO_TGR192=m 1056CONFIG_CRYPTO_TGR192=m
1014CONFIG_CRYPTO_GF128MUL=m 1057CONFIG_CRYPTO_WP512=m
1015CONFIG_CRYPTO_ECB=m 1058
1016CONFIG_CRYPTO_CBC=m 1059#
1017CONFIG_CRYPTO_PCBC=m 1060# Ciphers
1018CONFIG_CRYPTO_LRW=m 1061#
1019CONFIG_CRYPTO_XTS=m
1020CONFIG_CRYPTO_CTR=m
1021CONFIG_CRYPTO_GCM=m
1022CONFIG_CRYPTO_CCM=m
1023CONFIG_CRYPTO_CRYPTD=m
1024CONFIG_CRYPTO_DES=m
1025CONFIG_CRYPTO_FCRYPT=m
1026CONFIG_CRYPTO_BLOWFISH=m
1027CONFIG_CRYPTO_TWOFISH=m
1028CONFIG_CRYPTO_TWOFISH_COMMON=m
1029CONFIG_CRYPTO_SERPENT=m
1030CONFIG_CRYPTO_AES=m 1062CONFIG_CRYPTO_AES=m
1063CONFIG_CRYPTO_ANUBIS=m
1064CONFIG_CRYPTO_ARC4=m
1065CONFIG_CRYPTO_BLOWFISH=m
1066CONFIG_CRYPTO_CAMELLIA=m
1031CONFIG_CRYPTO_CAST5=m 1067CONFIG_CRYPTO_CAST5=m
1032CONFIG_CRYPTO_CAST6=m 1068CONFIG_CRYPTO_CAST6=m
1033CONFIG_CRYPTO_TEA=m 1069CONFIG_CRYPTO_DES=m
1034CONFIG_CRYPTO_ARC4=m 1070CONFIG_CRYPTO_FCRYPT=m
1035CONFIG_CRYPTO_KHAZAD=m 1071CONFIG_CRYPTO_KHAZAD=m
1036CONFIG_CRYPTO_ANUBIS=m
1037CONFIG_CRYPTO_SEED=m
1038CONFIG_CRYPTO_SALSA20=m 1072CONFIG_CRYPTO_SALSA20=m
1073CONFIG_CRYPTO_SEED=m
1074CONFIG_CRYPTO_SERPENT=m
1075CONFIG_CRYPTO_TEA=m
1076CONFIG_CRYPTO_TWOFISH=m
1077CONFIG_CRYPTO_TWOFISH_COMMON=m
1078
1079#
1080# Compression
1081#
1039CONFIG_CRYPTO_DEFLATE=m 1082CONFIG_CRYPTO_DEFLATE=m
1040CONFIG_CRYPTO_MICHAEL_MIC=m
1041CONFIG_CRYPTO_CRC32C=m
1042CONFIG_CRYPTO_CAMELLIA=m
1043CONFIG_CRYPTO_TEST=m
1044CONFIG_CRYPTO_AUTHENC=m
1045CONFIG_CRYPTO_LZO=m 1083CONFIG_CRYPTO_LZO=m
1046# CONFIG_CRYPTO_HW is not set 1084# CONFIG_CRYPTO_HW is not set
1047 1085
@@ -1049,9 +1087,11 @@ CONFIG_CRYPTO_LZO=m
1049# Library routines 1087# Library routines
1050# 1088#
1051CONFIG_BITREVERSE=y 1089CONFIG_BITREVERSE=y
1090# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1091# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1052CONFIG_CRC_CCITT=m 1092CONFIG_CRC_CCITT=m
1053CONFIG_CRC16=m 1093CONFIG_CRC16=m
1054# CONFIG_CRC_ITU_T is not set 1094CONFIG_CRC_ITU_T=m
1055CONFIG_CRC32=y 1095CONFIG_CRC32=y
1056# CONFIG_CRC7 is not set 1096# CONFIG_CRC7 is not set
1057CONFIG_LIBCRC32C=m 1097CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
new file mode 100644
index 000000000000..0747fa3984df
--- /dev/null
+++ b/arch/m68k/configs/multi_defconfig
@@ -0,0 +1,1269 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4
4# Wed May 28 22:47:35 2008
5#
6CONFIG_M68K=y
7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_ARCH_HAS_ILOG2_U32 is not set
10# CONFIG_ARCH_HAS_ILOG2_U64 is not set
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_TIME_LOW_RES=y
14CONFIG_GENERIC_IOMAP=y
15CONFIG_NO_IOPORT=y
16# CONFIG_NO_DMA is not set
17CONFIG_ARCH_SUPPORTS_AOUT=y
18CONFIG_HZ=100
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20
21#
22# General setup
23#
24CONFIG_EXPERIMENTAL=y
25CONFIG_BROKEN_ON_SMP=y
26CONFIG_INIT_ENV_ARG_LIMIT=32
27CONFIG_LOCALVERSION="-multi"
28CONFIG_LOCALVERSION_AUTO=y
29CONFIG_SWAP=y
30CONFIG_SYSVIPC=y
31CONFIG_SYSVIPC_SYSCTL=y
32CONFIG_POSIX_MQUEUE=y
33CONFIG_BSD_PROCESS_ACCT=y
34# CONFIG_BSD_PROCESS_ACCT_V3 is not set
35# CONFIG_TASKSTATS is not set
36# CONFIG_AUDIT is not set
37# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14
39# CONFIG_CGROUPS is not set
40# CONFIG_GROUP_SCHED is not set
41# CONFIG_SYSFS_DEPRECATED_V2 is not set
42CONFIG_RELAY=y
43CONFIG_NAMESPACES=y
44# CONFIG_UTS_NS is not set
45# CONFIG_IPC_NS is not set
46# CONFIG_USER_NS is not set
47# CONFIG_PID_NS is not set
48CONFIG_BLK_DEV_INITRD=y
49CONFIG_INITRAMFS_SOURCE=""
50# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
51CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y
59CONFIG_PRINTK=y
60CONFIG_BUG=y
61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
63CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y
66CONFIG_EPOLL=y
67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y
72CONFIG_SLAB=y
73# CONFIG_SLUB is not set
74# CONFIG_SLOB is not set
75# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set
78# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
81CONFIG_PROC_PAGE_MONITOR=y
82CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set
85CONFIG_BASE_SMALL=0
86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
88CONFIG_MODULE_UNLOAD=y
89# CONFIG_MODULE_FORCE_UNLOAD is not set
90# CONFIG_MODVERSIONS is not set
91# CONFIG_MODULE_SRCVERSION_ALL is not set
92CONFIG_KMOD=y
93CONFIG_BLOCK=y
94# CONFIG_LBD is not set
95# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y
98
99#
100# IO Schedulers
101#
102CONFIG_IOSCHED_NOOP=y
103CONFIG_IOSCHED_AS=y
104CONFIG_IOSCHED_DEADLINE=y
105CONFIG_IOSCHED_CFQ=y
106CONFIG_DEFAULT_AS=y
107# CONFIG_DEFAULT_DEADLINE is not set
108# CONFIG_DEFAULT_CFQ is not set
109# CONFIG_DEFAULT_NOOP is not set
110CONFIG_DEFAULT_IOSCHED="anticipatory"
111CONFIG_CLASSIC_RCU=y
112
113#
114# Platform dependent setup
115#
116# CONFIG_SUN3 is not set
117CONFIG_AMIGA=y
118CONFIG_ATARI=y
119CONFIG_MAC=y
120CONFIG_NUBUS=y
121CONFIG_M68K_L2_CACHE=y
122CONFIG_APOLLO=y
123CONFIG_VME=y
124CONFIG_MVME147=y
125CONFIG_MVME16x=y
126CONFIG_BVME6000=y
127CONFIG_HP300=y
128CONFIG_DIO=y
129CONFIG_SUN3X=y
130CONFIG_Q40=y
131
132#
133# Processor type
134#
135CONFIG_M68020=y
136CONFIG_M68030=y
137CONFIG_M68040=y
138CONFIG_M68060=y
139CONFIG_MMU_MOTOROLA=y
140# CONFIG_M68KFPU_EMU is not set
141# CONFIG_ADVANCED is not set
142CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
143CONFIG_NODES_SHIFT=3
144CONFIG_SELECT_MEMORY_MODEL=y
145# CONFIG_FLATMEM_MANUAL is not set
146CONFIG_DISCONTIGMEM_MANUAL=y
147# CONFIG_SPARSEMEM_MANUAL is not set
148CONFIG_DISCONTIGMEM=y
149CONFIG_FLAT_NODE_MEM_MAP=y
150CONFIG_NEED_MULTIPLE_NODES=y
151# CONFIG_SPARSEMEM_STATIC is not set
152# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
153CONFIG_PAGEFLAGS_EXTENDED=y
154CONFIG_SPLIT_PTLOCK_CPUS=4
155# CONFIG_RESOURCES_64BIT is not set
156CONFIG_ZONE_DMA_FLAG=1
157CONFIG_BOUNCE=y
158CONFIG_VIRT_TO_BUS=y
159
160#
161# General setup
162#
163CONFIG_BINFMT_ELF=y
164CONFIG_BINFMT_AOUT=m
165CONFIG_BINFMT_MISC=m
166CONFIG_ZORRO=y
167CONFIG_AMIGA_PCMCIA=y
168CONFIG_STRAM_PROC=y
169CONFIG_HEARTBEAT=y
170CONFIG_PROC_HARDWARE=y
171CONFIG_ISA=y
172CONFIG_GENERIC_ISA_DMA=y
173CONFIG_ZONE_DMA=y
174# CONFIG_ARCH_SUPPORTS_MSI is not set
175CONFIG_ZORRO_NAMES=y
176
177#
178# Networking
179#
180CONFIG_NET=y
181
182#
183# Networking options
184#
185CONFIG_PACKET=y
186# CONFIG_PACKET_MMAP is not set
187CONFIG_UNIX=y
188CONFIG_XFRM=y
189# CONFIG_XFRM_USER is not set
190# CONFIG_XFRM_SUB_POLICY is not set
191CONFIG_XFRM_MIGRATE=y
192# CONFIG_XFRM_STATISTICS is not set
193CONFIG_NET_KEY=y
194CONFIG_NET_KEY_MIGRATE=y
195CONFIG_INET=y
196# CONFIG_IP_MULTICAST is not set
197# CONFIG_IP_ADVANCED_ROUTER is not set
198CONFIG_IP_FIB_HASH=y
199CONFIG_IP_PNP=y
200CONFIG_IP_PNP_DHCP=y
201CONFIG_IP_PNP_BOOTP=y
202CONFIG_IP_PNP_RARP=y
203CONFIG_NET_IPIP=m
204CONFIG_NET_IPGRE=m
205# CONFIG_ARPD is not set
206CONFIG_SYN_COOKIES=y
207CONFIG_INET_AH=m
208CONFIG_INET_ESP=m
209CONFIG_INET_IPCOMP=m
210CONFIG_INET_XFRM_TUNNEL=m
211CONFIG_INET_TUNNEL=m
212CONFIG_INET_XFRM_MODE_TRANSPORT=m
213CONFIG_INET_XFRM_MODE_TUNNEL=m
214CONFIG_INET_XFRM_MODE_BEET=m
215CONFIG_INET_LRO=m
216CONFIG_INET_DIAG=m
217CONFIG_INET_TCP_DIAG=m
218# CONFIG_TCP_CONG_ADVANCED is not set
219CONFIG_TCP_CONG_CUBIC=y
220CONFIG_DEFAULT_TCP_CONG="cubic"
221# CONFIG_TCP_MD5SIG is not set
222# CONFIG_IP_VS is not set
223CONFIG_IPV6=m
224CONFIG_IPV6_PRIVACY=y
225CONFIG_IPV6_ROUTER_PREF=y
226CONFIG_IPV6_ROUTE_INFO=y
227# CONFIG_IPV6_OPTIMISTIC_DAD is not set
228CONFIG_INET6_AH=m
229CONFIG_INET6_ESP=m
230CONFIG_INET6_IPCOMP=m
231# CONFIG_IPV6_MIP6 is not set
232CONFIG_INET6_XFRM_TUNNEL=m
233CONFIG_INET6_TUNNEL=m
234CONFIG_INET6_XFRM_MODE_TRANSPORT=m
235CONFIG_INET6_XFRM_MODE_TUNNEL=m
236CONFIG_INET6_XFRM_MODE_BEET=m
237CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
238CONFIG_IPV6_SIT=m
239CONFIG_IPV6_NDISC_NODETYPE=y
240CONFIG_IPV6_TUNNEL=m
241# CONFIG_IPV6_MULTIPLE_TABLES is not set
242# CONFIG_IPV6_MROUTE is not set
243# CONFIG_NETWORK_SECMARK is not set
244CONFIG_NETFILTER=y
245# CONFIG_NETFILTER_DEBUG is not set
246CONFIG_NETFILTER_ADVANCED=y
247
248#
249# Core Netfilter Configuration
250#
251CONFIG_NETFILTER_NETLINK=m
252CONFIG_NETFILTER_NETLINK_QUEUE=m
253CONFIG_NETFILTER_NETLINK_LOG=m
254CONFIG_NF_CONNTRACK=m
255CONFIG_NF_CT_ACCT=y
256CONFIG_NF_CONNTRACK_MARK=y
257# CONFIG_NF_CONNTRACK_EVENTS is not set
258# CONFIG_NF_CT_PROTO_DCCP is not set
259CONFIG_NF_CT_PROTO_GRE=m
260CONFIG_NF_CT_PROTO_SCTP=m
261CONFIG_NF_CT_PROTO_UDPLITE=m
262CONFIG_NF_CONNTRACK_AMANDA=m
263CONFIG_NF_CONNTRACK_FTP=m
264CONFIG_NF_CONNTRACK_H323=m
265CONFIG_NF_CONNTRACK_IRC=m
266CONFIG_NF_CONNTRACK_NETBIOS_NS=m
267CONFIG_NF_CONNTRACK_PPTP=m
268CONFIG_NF_CONNTRACK_SANE=m
269CONFIG_NF_CONNTRACK_SIP=m
270CONFIG_NF_CONNTRACK_TFTP=m
271# CONFIG_NF_CT_NETLINK is not set
272CONFIG_NETFILTER_XTABLES=m
273CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
274CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
275CONFIG_NETFILTER_XT_TARGET_DSCP=m
276CONFIG_NETFILTER_XT_TARGET_MARK=m
277CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
278CONFIG_NETFILTER_XT_TARGET_NFLOG=m
279CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
280CONFIG_NETFILTER_XT_TARGET_RATEEST=m
281CONFIG_NETFILTER_XT_TARGET_TRACE=m
282CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
283CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
284CONFIG_NETFILTER_XT_MATCH_COMMENT=m
285CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
286CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
287CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
288CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
289CONFIG_NETFILTER_XT_MATCH_DCCP=m
290CONFIG_NETFILTER_XT_MATCH_DSCP=m
291CONFIG_NETFILTER_XT_MATCH_ESP=m
292CONFIG_NETFILTER_XT_MATCH_HELPER=m
293CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
294CONFIG_NETFILTER_XT_MATCH_LENGTH=m
295CONFIG_NETFILTER_XT_MATCH_LIMIT=m
296CONFIG_NETFILTER_XT_MATCH_MAC=m
297CONFIG_NETFILTER_XT_MATCH_MARK=m
298CONFIG_NETFILTER_XT_MATCH_OWNER=m
299CONFIG_NETFILTER_XT_MATCH_POLICY=m
300CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
301CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
302CONFIG_NETFILTER_XT_MATCH_QUOTA=m
303CONFIG_NETFILTER_XT_MATCH_RATEEST=m
304CONFIG_NETFILTER_XT_MATCH_REALM=m
305CONFIG_NETFILTER_XT_MATCH_SCTP=m
306CONFIG_NETFILTER_XT_MATCH_STATE=m
307CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
308CONFIG_NETFILTER_XT_MATCH_STRING=m
309CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
310CONFIG_NETFILTER_XT_MATCH_TIME=m
311CONFIG_NETFILTER_XT_MATCH_U32=m
312CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
313
314#
315# IP: Netfilter Configuration
316#
317CONFIG_NF_CONNTRACK_IPV4=m
318CONFIG_NF_CONNTRACK_PROC_COMPAT=y
319CONFIG_IP_NF_QUEUE=m
320CONFIG_IP_NF_IPTABLES=m
321CONFIG_IP_NF_MATCH_RECENT=m
322CONFIG_IP_NF_MATCH_ECN=m
323CONFIG_IP_NF_MATCH_AH=m
324CONFIG_IP_NF_MATCH_TTL=m
325CONFIG_IP_NF_MATCH_ADDRTYPE=m
326CONFIG_IP_NF_FILTER=m
327CONFIG_IP_NF_TARGET_REJECT=m
328CONFIG_IP_NF_TARGET_LOG=m
329CONFIG_IP_NF_TARGET_ULOG=m
330CONFIG_NF_NAT=m
331CONFIG_NF_NAT_NEEDED=y
332CONFIG_IP_NF_TARGET_MASQUERADE=m
333CONFIG_IP_NF_TARGET_REDIRECT=m
334CONFIG_IP_NF_TARGET_NETMAP=m
335CONFIG_NF_NAT_SNMP_BASIC=m
336CONFIG_NF_NAT_PROTO_GRE=m
337CONFIG_NF_NAT_PROTO_UDPLITE=m
338CONFIG_NF_NAT_PROTO_SCTP=m
339CONFIG_NF_NAT_FTP=m
340CONFIG_NF_NAT_IRC=m
341CONFIG_NF_NAT_TFTP=m
342CONFIG_NF_NAT_AMANDA=m
343CONFIG_NF_NAT_PPTP=m
344CONFIG_NF_NAT_H323=m
345CONFIG_NF_NAT_SIP=m
346CONFIG_IP_NF_MANGLE=m
347CONFIG_IP_NF_TARGET_ECN=m
348CONFIG_IP_NF_TARGET_TTL=m
349CONFIG_IP_NF_TARGET_CLUSTERIP=m
350CONFIG_IP_NF_RAW=m
351CONFIG_IP_NF_ARPTABLES=m
352CONFIG_IP_NF_ARPFILTER=m
353CONFIG_IP_NF_ARP_MANGLE=m
354
355#
356# IPv6: Netfilter Configuration
357#
358CONFIG_NF_CONNTRACK_IPV6=m
359CONFIG_IP6_NF_QUEUE=m
360CONFIG_IP6_NF_IPTABLES=m
361CONFIG_IP6_NF_MATCH_RT=m
362CONFIG_IP6_NF_MATCH_OPTS=m
363CONFIG_IP6_NF_MATCH_FRAG=m
364CONFIG_IP6_NF_MATCH_HL=m
365CONFIG_IP6_NF_MATCH_IPV6HEADER=m
366CONFIG_IP6_NF_MATCH_AH=m
367CONFIG_IP6_NF_MATCH_MH=m
368CONFIG_IP6_NF_MATCH_EUI64=m
369CONFIG_IP6_NF_FILTER=m
370CONFIG_IP6_NF_TARGET_LOG=m
371CONFIG_IP6_NF_TARGET_REJECT=m
372CONFIG_IP6_NF_MANGLE=m
373CONFIG_IP6_NF_TARGET_HL=m
374CONFIG_IP6_NF_RAW=m
375CONFIG_IP_DCCP=m
376CONFIG_INET_DCCP_DIAG=m
377CONFIG_IP_DCCP_ACKVEC=y
378
379#
380# DCCP CCIDs Configuration (EXPERIMENTAL)
381#
382CONFIG_IP_DCCP_CCID2=m
383# CONFIG_IP_DCCP_CCID2_DEBUG is not set
384CONFIG_IP_DCCP_CCID3=m
385# CONFIG_IP_DCCP_CCID3_DEBUG is not set
386CONFIG_IP_DCCP_CCID3_RTO=100
387CONFIG_IP_DCCP_TFRC_LIB=m
388CONFIG_IP_SCTP=m
389# CONFIG_SCTP_DBG_MSG is not set
390# CONFIG_SCTP_DBG_OBJCNT is not set
391# CONFIG_SCTP_HMAC_NONE is not set
392# CONFIG_SCTP_HMAC_SHA1 is not set
393CONFIG_SCTP_HMAC_MD5=y
394# CONFIG_TIPC is not set
395# CONFIG_ATM is not set
396# CONFIG_BRIDGE is not set
397# CONFIG_VLAN_8021Q is not set
398# CONFIG_DECNET is not set
399CONFIG_LLC=m
400# CONFIG_LLC2 is not set
401# CONFIG_IPX is not set
402CONFIG_ATALK=m
403CONFIG_DEV_APPLETALK=m
404# CONFIG_COPS is not set
405CONFIG_IPDDP=m
406CONFIG_IPDDP_ENCAP=y
407CONFIG_IPDDP_DECAP=y
408# CONFIG_X25 is not set
409# CONFIG_LAPB is not set
410# CONFIG_ECONET is not set
411# CONFIG_WAN_ROUTER is not set
412# CONFIG_NET_SCHED is not set
413CONFIG_NET_CLS_ROUTE=y
414
415#
416# Network testing
417#
418# CONFIG_NET_PKTGEN is not set
419# CONFIG_HAMRADIO is not set
420# CONFIG_CAN is not set
421# CONFIG_IRDA is not set
422# CONFIG_BT is not set
423# CONFIG_AF_RXRPC is not set
424
425#
426# Wireless
427#
428# CONFIG_CFG80211 is not set
429CONFIG_WIRELESS_EXT=y
430# CONFIG_MAC80211 is not set
431CONFIG_IEEE80211=m
432# CONFIG_IEEE80211_DEBUG is not set
433CONFIG_IEEE80211_CRYPT_WEP=m
434CONFIG_IEEE80211_CRYPT_CCMP=m
435CONFIG_IEEE80211_CRYPT_TKIP=m
436# CONFIG_RFKILL is not set
437# CONFIG_NET_9P is not set
438
439#
440# Device Drivers
441#
442
443#
444# Generic Driver Options
445#
446CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
447CONFIG_STANDALONE=y
448CONFIG_PREVENT_FIRMWARE_BUILD=y
449CONFIG_FW_LOADER=m
450# CONFIG_SYS_HYPERVISOR is not set
451CONFIG_CONNECTOR=m
452# CONFIG_MTD is not set
453CONFIG_PARPORT=m
454# CONFIG_PARPORT_PC is not set
455CONFIG_PARPORT_AMIGA=m
456CONFIG_PARPORT_MFC3=m
457CONFIG_PARPORT_ATARI=m
458# CONFIG_PARPORT_GSC is not set
459# CONFIG_PARPORT_AX88796 is not set
460CONFIG_PARPORT_1284=y
461CONFIG_PARPORT_NOT_PC=y
462# CONFIG_PNP is not set
463CONFIG_BLK_DEV=y
464CONFIG_AMIGA_FLOPPY=y
465CONFIG_ATARI_FLOPPY=y
466CONFIG_AMIGA_Z2RAM=y
467# CONFIG_BLK_DEV_COW_COMMON is not set
468CONFIG_BLK_DEV_LOOP=y
469CONFIG_BLK_DEV_CRYPTOLOOP=m
470CONFIG_BLK_DEV_NBD=m
471CONFIG_BLK_DEV_RAM=y
472CONFIG_BLK_DEV_RAM_COUNT=16
473CONFIG_BLK_DEV_RAM_SIZE=4096
474# CONFIG_BLK_DEV_XIP is not set
475CONFIG_CDROM_PKTCDVD=m
476CONFIG_CDROM_PKTCDVD_BUFFERS=8
477# CONFIG_CDROM_PKTCDVD_WCACHE is not set
478CONFIG_ATA_OVER_ETH=m
479CONFIG_MISC_DEVICES=y
480# CONFIG_EEPROM_93CX6 is not set
481# CONFIG_ENCLOSURE_SERVICES is not set
482CONFIG_HAVE_IDE=y
483CONFIG_IDE=y
484CONFIG_BLK_DEV_IDE=y
485
486#
487# Please see Documentation/ide/ide.txt for help/info on IDE drives
488#
489# CONFIG_BLK_DEV_IDE_SATA is not set
490CONFIG_BLK_DEV_IDEDISK=y
491# CONFIG_IDEDISK_MULTI_MODE is not set
492CONFIG_BLK_DEV_IDECD=y
493CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
494# CONFIG_BLK_DEV_IDETAPE is not set
495CONFIG_BLK_DEV_IDEFLOPPY=m
496# CONFIG_BLK_DEV_IDESCSI is not set
497# CONFIG_IDE_TASK_IOCTL is not set
498CONFIG_IDE_PROC_FS=y
499
500#
501# IDE chipset support/bugfixes
502#
503# CONFIG_BLK_DEV_PLATFORM is not set
504CONFIG_BLK_DEV_GAYLE=y
505CONFIG_BLK_DEV_IDEDOUBLER=y
506CONFIG_BLK_DEV_BUDDHA=y
507CONFIG_BLK_DEV_FALCON_IDE=y
508CONFIG_BLK_DEV_MAC_IDE=y
509CONFIG_BLK_DEV_Q40IDE=y
510# CONFIG_BLK_DEV_IDEDMA is not set
511# CONFIG_BLK_DEV_HD_ONLY is not set
512# CONFIG_BLK_DEV_HD is not set
513
514#
515# SCSI device support
516#
517CONFIG_RAID_ATTRS=m
518CONFIG_SCSI=y
519CONFIG_SCSI_DMA=y
520CONFIG_SCSI_TGT=m
521# CONFIG_SCSI_NETLINK is not set
522CONFIG_SCSI_PROC_FS=y
523
524#
525# SCSI support type (disk, tape, CD-ROM)
526#
527CONFIG_BLK_DEV_SD=y
528CONFIG_CHR_DEV_ST=m
529CONFIG_CHR_DEV_OSST=m
530CONFIG_BLK_DEV_SR=y
531CONFIG_BLK_DEV_SR_VENDOR=y
532CONFIG_CHR_DEV_SG=m
533# CONFIG_CHR_DEV_SCH is not set
534
535#
536# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
537#
538# CONFIG_SCSI_MULTI_LUN is not set
539CONFIG_SCSI_CONSTANTS=y
540# CONFIG_SCSI_LOGGING is not set
541# CONFIG_SCSI_SCAN_ASYNC is not set
542CONFIG_SCSI_WAIT_SCAN=m
543
544#
545# SCSI Transports
546#
547CONFIG_SCSI_SPI_ATTRS=y
548# CONFIG_SCSI_FC_ATTRS is not set
549CONFIG_SCSI_ISCSI_ATTRS=m
550CONFIG_SCSI_SAS_ATTRS=m
551CONFIG_SCSI_SAS_LIBSAS=m
552CONFIG_SCSI_SAS_HOST_SMP=y
553# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
554CONFIG_SCSI_SRP_ATTRS=m
555CONFIG_SCSI_SRP_TGT_ATTRS=y
556CONFIG_SCSI_LOWLEVEL=y
557CONFIG_ISCSI_TCP=m
558# CONFIG_SCSI_AHA152X is not set
559# CONFIG_SCSI_AIC7XXX_OLD is not set
560# CONFIG_SCSI_ADVANSYS is not set
561# CONFIG_SCSI_IN2000 is not set
562# CONFIG_SCSI_DTC3280 is not set
563# CONFIG_SCSI_FUTURE_DOMAIN is not set
564# CONFIG_SCSI_GENERIC_NCR5380 is not set
565# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
566# CONFIG_SCSI_NCR53C406A is not set
567CONFIG_53C700_BE_BUS=y
568# CONFIG_SCSI_PAS16 is not set
569# CONFIG_SCSI_QLOGIC_FAS is not set
570# CONFIG_SCSI_SYM53C416 is not set
571# CONFIG_SCSI_T128 is not set
572# CONFIG_SCSI_DEBUG is not set
573CONFIG_A3000_SCSI=y
574CONFIG_A2091_SCSI=y
575CONFIG_GVP11_SCSI=y
576CONFIG_SCSI_A4000T=y
577CONFIG_SCSI_ZORRO7XX=y
578CONFIG_ATARI_SCSI=y
579# CONFIG_ATARI_SCSI_TOSHIBA_DELAY is not set
580# CONFIG_ATARI_SCSI_RESET_BOOT is not set
581CONFIG_MAC_SCSI=y
582CONFIG_SCSI_MAC_ESP=y
583CONFIG_MVME147_SCSI=y
584CONFIG_MVME16x_SCSI=y
585CONFIG_BVME6000_SCSI=y
586CONFIG_SUN3X_ESP=y
587CONFIG_MD=y
588CONFIG_BLK_DEV_MD=m
589CONFIG_MD_LINEAR=m
590CONFIG_MD_RAID0=m
591CONFIG_MD_RAID1=m
592# CONFIG_MD_RAID10 is not set
593CONFIG_MD_RAID456=m
594CONFIG_MD_RAID5_RESHAPE=y
595CONFIG_MD_MULTIPATH=m
596# CONFIG_MD_FAULTY is not set
597CONFIG_BLK_DEV_DM=m
598# CONFIG_DM_DEBUG is not set
599CONFIG_DM_CRYPT=m
600CONFIG_DM_SNAPSHOT=m
601CONFIG_DM_MIRROR=m
602CONFIG_DM_ZERO=m
603CONFIG_DM_MULTIPATH=m
604CONFIG_DM_MULTIPATH_EMC=m
605CONFIG_DM_MULTIPATH_RDAC=m
606CONFIG_DM_MULTIPATH_HP=m
607# CONFIG_DM_DELAY is not set
608CONFIG_DM_UEVENT=y
609CONFIG_MACINTOSH_DRIVERS=y
610CONFIG_ADB=y
611CONFIG_ADB_MACII=y
612CONFIG_ADB_MACIISI=y
613CONFIG_ADB_IOP=y
614CONFIG_ADB_PMU68K=y
615CONFIG_ADB_CUDA=y
616CONFIG_INPUT_ADBHID=y
617CONFIG_MAC_EMUMOUSEBTN=y
618CONFIG_NETDEVICES=y
619# CONFIG_NETDEVICES_MULTIQUEUE is not set
620CONFIG_DUMMY=m
621# CONFIG_BONDING is not set
622CONFIG_MACVLAN=m
623CONFIG_EQUALIZER=m
624# CONFIG_TUN is not set
625CONFIG_VETH=m
626# CONFIG_ARCNET is not set
627# CONFIG_PHYLIB is not set
628CONFIG_NET_ETHERNET=y
629CONFIG_MII=m
630CONFIG_ARIADNE=m
631CONFIG_A2065=m
632CONFIG_HYDRA=m
633CONFIG_ZORRO8390=m
634CONFIG_APNE=m
635CONFIG_APOLLO_ELPLUS=y
636CONFIG_MAC8390=y
637CONFIG_MAC89x0=m
638CONFIG_MACSONIC=m
639CONFIG_MACMACE=y
640CONFIG_MVME147_NET=y
641CONFIG_MVME16x_NET=y
642CONFIG_BVME6000_NET=y
643CONFIG_ATARILANCE=m
644CONFIG_SUN3LANCE=y
645CONFIG_HPLANCE=y
646# CONFIG_NET_VENDOR_3COM is not set
647# CONFIG_NET_VENDOR_SMC is not set
648# CONFIG_NET_VENDOR_RACAL is not set
649# CONFIG_AT1700 is not set
650# CONFIG_DEPCA is not set
651# CONFIG_HP100 is not set
652# CONFIG_NET_ISA is not set
653CONFIG_NE2000=m
654# CONFIG_IBM_NEW_EMAC_ZMII is not set
655# CONFIG_IBM_NEW_EMAC_RGMII is not set
656# CONFIG_IBM_NEW_EMAC_TAH is not set
657# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
658# CONFIG_NET_PCI is not set
659# CONFIG_B44 is not set
660# CONFIG_NET_POCKET is not set
661# CONFIG_NETDEV_1000 is not set
662# CONFIG_NETDEV_10000 is not set
663# CONFIG_TR is not set
664
665#
666# Wireless LAN
667#
668# CONFIG_WLAN_PRE80211 is not set
669# CONFIG_WLAN_80211 is not set
670# CONFIG_IWLWIFI_LEDS is not set
671# CONFIG_WAN is not set
672# CONFIG_PLIP is not set
673CONFIG_PPP=m
674# CONFIG_PPP_MULTILINK is not set
675CONFIG_PPP_FILTER=y
676CONFIG_PPP_ASYNC=m
677CONFIG_PPP_SYNC_TTY=m
678CONFIG_PPP_DEFLATE=m
679CONFIG_PPP_BSDCOMP=m
680CONFIG_PPP_MPPE=m
681CONFIG_PPPOE=m
682CONFIG_PPPOL2TP=m
683CONFIG_SLIP=m
684CONFIG_SLIP_COMPRESSED=y
685CONFIG_SLHC=m
686CONFIG_SLIP_SMART=y
687CONFIG_SLIP_MODE_SLIP6=y
688CONFIG_NETCONSOLE=m
689CONFIG_NETCONSOLE_DYNAMIC=y
690CONFIG_NETPOLL=y
691# CONFIG_NETPOLL_TRAP is not set
692CONFIG_NET_POLL_CONTROLLER=y
693# CONFIG_ISDN is not set
694# CONFIG_PHONE is not set
695
696#
697# Input device support
698#
699CONFIG_INPUT=y
700CONFIG_INPUT_FF_MEMLESS=m
701# CONFIG_INPUT_POLLDEV is not set
702
703#
704# Userland interfaces
705#
706CONFIG_INPUT_MOUSEDEV=y
707CONFIG_INPUT_MOUSEDEV_PSAUX=y
708CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
709CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
710# CONFIG_INPUT_JOYDEV is not set
711# CONFIG_INPUT_EVDEV is not set
712# CONFIG_INPUT_EVBUG is not set
713
714#
715# Input Device Drivers
716#
717CONFIG_INPUT_KEYBOARD=y
718# CONFIG_KEYBOARD_ATKBD is not set
719CONFIG_KEYBOARD_SUNKBD=y
720# CONFIG_KEYBOARD_LKKBD is not set
721# CONFIG_KEYBOARD_XTKBD is not set
722# CONFIG_KEYBOARD_NEWTON is not set
723# CONFIG_KEYBOARD_STOWAWAY is not set
724CONFIG_KEYBOARD_AMIGA=y
725CONFIG_ATARI_KBD_CORE=y
726CONFIG_KEYBOARD_ATARI=y
727CONFIG_KEYBOARD_HIL_OLD=y
728CONFIG_KEYBOARD_HIL=y
729CONFIG_INPUT_MOUSE=y
730CONFIG_MOUSE_PS2=y
731CONFIG_MOUSE_PS2_ALPS=y
732CONFIG_MOUSE_PS2_LOGIPS2PP=y
733CONFIG_MOUSE_PS2_SYNAPTICS=y
734CONFIG_MOUSE_PS2_LIFEBOOK=y
735CONFIG_MOUSE_PS2_TRACKPOINT=y
736# CONFIG_MOUSE_PS2_TOUCHKIT is not set
737CONFIG_MOUSE_SERIAL=m
738# CONFIG_MOUSE_INPORT is not set
739# CONFIG_MOUSE_LOGIBM is not set
740# CONFIG_MOUSE_PC110PAD is not set
741CONFIG_MOUSE_AMIGA=m
742CONFIG_MOUSE_ATARI=m
743# CONFIG_MOUSE_VSXXXAA is not set
744CONFIG_MOUSE_HIL=m
745CONFIG_INPUT_JOYSTICK=y
746# CONFIG_JOYSTICK_ANALOG is not set
747# CONFIG_JOYSTICK_A3D is not set
748# CONFIG_JOYSTICK_ADI is not set
749# CONFIG_JOYSTICK_COBRA is not set
750# CONFIG_JOYSTICK_GF2K is not set
751# CONFIG_JOYSTICK_GRIP is not set
752# CONFIG_JOYSTICK_GRIP_MP is not set
753# CONFIG_JOYSTICK_GUILLEMOT is not set
754# CONFIG_JOYSTICK_INTERACT is not set
755# CONFIG_JOYSTICK_SIDEWINDER is not set
756# CONFIG_JOYSTICK_TMDC is not set
757# CONFIG_JOYSTICK_IFORCE is not set
758# CONFIG_JOYSTICK_WARRIOR is not set
759# CONFIG_JOYSTICK_MAGELLAN is not set
760# CONFIG_JOYSTICK_SPACEORB is not set
761# CONFIG_JOYSTICK_SPACEBALL is not set
762# CONFIG_JOYSTICK_STINGER is not set
763# CONFIG_JOYSTICK_TWIDJOY is not set
764# CONFIG_JOYSTICK_ZHENHUA is not set
765# CONFIG_JOYSTICK_DB9 is not set
766# CONFIG_JOYSTICK_GAMECON is not set
767# CONFIG_JOYSTICK_TURBOGRAFX is not set
768CONFIG_JOYSTICK_AMIGA=m
769# CONFIG_JOYSTICK_JOYDUMP is not set
770# CONFIG_INPUT_TABLET is not set
771# CONFIG_INPUT_TOUCHSCREEN is not set
772CONFIG_INPUT_MISC=y
773CONFIG_INPUT_M68K_BEEP=m
774# CONFIG_INPUT_UINPUT is not set
775CONFIG_HP_SDC_RTC=m
776
777#
778# Hardware I/O ports
779#
780CONFIG_SERIO=y
781# CONFIG_SERIO_SERPORT is not set
782CONFIG_SERIO_Q40KBD=m
783# CONFIG_SERIO_PARKBD is not set
784CONFIG_HP_SDC=y
785CONFIG_HIL_MLC=y
786CONFIG_SERIO_LIBPS2=y
787# CONFIG_SERIO_RAW is not set
788# CONFIG_GAMEPORT is not set
789
790#
791# Character devices
792#
793CONFIG_VT=y
794CONFIG_VT_CONSOLE=y
795CONFIG_HW_CONSOLE=y
796CONFIG_VT_HW_CONSOLE_BINDING=y
797# CONFIG_DEVKMEM is not set
798# CONFIG_SERIAL_NONSTANDARD is not set
799CONFIG_A2232=m
800
801#
802# Serial drivers
803#
804# CONFIG_SERIAL_8250 is not set
805
806#
807# Non-8250 serial port support
808#
809CONFIG_UNIX98_PTYS=y
810CONFIG_LEGACY_PTYS=y
811CONFIG_LEGACY_PTY_COUNT=256
812CONFIG_PRINTER=m
813# CONFIG_LP_CONSOLE is not set
814# CONFIG_PPDEV is not set
815# CONFIG_IPMI_HANDLER is not set
816# CONFIG_HW_RANDOM is not set
817CONFIG_NVRAM=y
818CONFIG_GEN_RTC=m
819CONFIG_GEN_RTC_X=y
820# CONFIG_DTLK is not set
821# CONFIG_R3964 is not set
822# CONFIG_RAW_DRIVER is not set
823# CONFIG_TCG_TPM is not set
824# CONFIG_I2C is not set
825# CONFIG_SPI is not set
826# CONFIG_W1 is not set
827# CONFIG_POWER_SUPPLY is not set
828# CONFIG_HWMON is not set
829# CONFIG_THERMAL is not set
830# CONFIG_WATCHDOG is not set
831
832#
833# Sonics Silicon Backplane
834#
835CONFIG_SSB_POSSIBLE=y
836# CONFIG_SSB is not set
837
838#
839# Multifunction device drivers
840#
841# CONFIG_MFD_SM501 is not set
842# CONFIG_HTC_PASIC3 is not set
843
844#
845# Multimedia devices
846#
847
848#
849# Multimedia core support
850#
851# CONFIG_VIDEO_DEV is not set
852# CONFIG_DVB_CORE is not set
853# CONFIG_VIDEO_MEDIA is not set
854
855#
856# Multimedia drivers
857#
858# CONFIG_DAB is not set
859
860#
861# Graphics support
862#
863# CONFIG_VGASTATE is not set
864# CONFIG_VIDEO_OUTPUT_CONTROL is not set
865CONFIG_FB=y
866# CONFIG_FIRMWARE_EDID is not set
867# CONFIG_FB_DDC is not set
868CONFIG_FB_CFB_FILLRECT=y
869CONFIG_FB_CFB_COPYAREA=y
870CONFIG_FB_CFB_IMAGEBLIT=y
871# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
872# CONFIG_FB_SYS_FILLRECT is not set
873# CONFIG_FB_SYS_COPYAREA is not set
874# CONFIG_FB_SYS_IMAGEBLIT is not set
875# CONFIG_FB_FOREIGN_ENDIAN is not set
876# CONFIG_FB_SYS_FOPS is not set
877# CONFIG_FB_SVGALIB is not set
878CONFIG_FB_MACMODES=y
879# CONFIG_FB_BACKLIGHT is not set
880# CONFIG_FB_MODE_HELPERS is not set
881# CONFIG_FB_TILEBLITTING is not set
882
883#
884# Frame buffer hardware drivers
885#
886CONFIG_FB_CIRRUS=y
887CONFIG_FB_APOLLO=y
888CONFIG_FB_Q40=y
889CONFIG_FB_AMIGA=y
890CONFIG_FB_AMIGA_OCS=y
891CONFIG_FB_AMIGA_ECS=y
892CONFIG_FB_AMIGA_AGA=y
893CONFIG_FB_FM2=y
894CONFIG_FB_ATARI=y
895CONFIG_FB_VALKYRIE=y
896CONFIG_FB_MAC=y
897CONFIG_FB_HP300=y
898# CONFIG_FB_UVESA is not set
899# CONFIG_FB_S1D13XXX is not set
900# CONFIG_FB_ATY is not set
901# CONFIG_FB_VIRTUAL is not set
902# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
903
904#
905# Display device support
906#
907# CONFIG_DISPLAY_SUPPORT is not set
908
909#
910# Console display driver support
911#
912CONFIG_DUMMY_CONSOLE=y
913CONFIG_FRAMEBUFFER_CONSOLE=y
914# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
915# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
916# CONFIG_FONTS is not set
917CONFIG_FONT_8x8=y
918CONFIG_FONT_8x16=y
919CONFIG_FONT_6x11=y
920CONFIG_FONT_PEARL_8x8=y
921CONFIG_LOGO=y
922CONFIG_LOGO_LINUX_MONO=y
923CONFIG_LOGO_LINUX_VGA16=y
924CONFIG_LOGO_LINUX_CLUT224=y
925CONFIG_LOGO_MAC_CLUT224=y
926
927#
928# Sound
929#
930CONFIG_SOUND=m
931CONFIG_DMASOUND_ATARI=m
932CONFIG_DMASOUND_PAULA=m
933CONFIG_DMASOUND_Q40=m
934CONFIG_DMASOUND=m
935CONFIG_HID_SUPPORT=y
936CONFIG_HID=m
937# CONFIG_HID_DEBUG is not set
938CONFIG_HIDRAW=y
939# CONFIG_USB_SUPPORT is not set
940# CONFIG_MMC is not set
941# CONFIG_MEMSTICK is not set
942# CONFIG_NEW_LEDS is not set
943# CONFIG_ACCESSIBILITY is not set
944# CONFIG_RTC_CLASS is not set
945# CONFIG_AUXDISPLAY is not set
946# CONFIG_UIO is not set
947
948#
949# Character devices
950#
951CONFIG_ATARI_MFPSER=m
952CONFIG_ATARI_SCC=y
953CONFIG_ATARI_SCC_DMA=y
954CONFIG_ATARI_MIDI=m
955CONFIG_ATARI_DSP56K=m
956CONFIG_AMIGA_BUILTIN_SERIAL=y
957CONFIG_MULTIFACE_III_TTY=m
958CONFIG_MAC_SCC=y
959CONFIG_MAC_HID=y
960CONFIG_MVME147_SCC=y
961CONFIG_SERIAL167=y
962CONFIG_MVME162_SCC=y
963CONFIG_BVME6000_SCC=y
964CONFIG_DN_SERIAL=y
965CONFIG_SERIAL_CONSOLE=y
966
967#
968# File systems
969#
970CONFIG_EXT2_FS=y
971# CONFIG_EXT2_FS_XATTR is not set
972# CONFIG_EXT2_FS_XIP is not set
973CONFIG_EXT3_FS=y
974# CONFIG_EXT3_FS_XATTR is not set
975# CONFIG_EXT4DEV_FS is not set
976CONFIG_JBD=y
977CONFIG_REISERFS_FS=m
978# CONFIG_REISERFS_CHECK is not set
979# CONFIG_REISERFS_PROC_INFO is not set
980# CONFIG_REISERFS_FS_XATTR is not set
981CONFIG_JFS_FS=m
982# CONFIG_JFS_POSIX_ACL is not set
983# CONFIG_JFS_SECURITY is not set
984# CONFIG_JFS_DEBUG is not set
985# CONFIG_JFS_STATISTICS is not set
986# CONFIG_FS_POSIX_ACL is not set
987CONFIG_XFS_FS=m
988# CONFIG_XFS_QUOTA is not set
989# CONFIG_XFS_POSIX_ACL is not set
990# CONFIG_XFS_RT is not set
991# CONFIG_XFS_DEBUG is not set
992CONFIG_OCFS2_FS=m
993CONFIG_OCFS2_FS_O2CB=m
994CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
995# CONFIG_OCFS2_DEBUG_MASKLOG is not set
996# CONFIG_OCFS2_DEBUG_FS is not set
997CONFIG_DNOTIFY=y
998CONFIG_INOTIFY=y
999CONFIG_INOTIFY_USER=y
1000CONFIG_QUOTA=y
1001CONFIG_QUOTA_NETLINK_INTERFACE=y
1002# CONFIG_PRINT_QUOTA_WARNING is not set
1003# CONFIG_QFMT_V1 is not set
1004# CONFIG_QFMT_V2 is not set
1005CONFIG_QUOTACTL=y
1006CONFIG_AUTOFS_FS=m
1007CONFIG_AUTOFS4_FS=m
1008CONFIG_FUSE_FS=m
1009
1010#
1011# CD-ROM/DVD Filesystems
1012#
1013CONFIG_ISO9660_FS=y
1014CONFIG_JOLIET=y
1015CONFIG_ZISOFS=y
1016CONFIG_UDF_FS=m
1017CONFIG_UDF_NLS=y
1018
1019#
1020# DOS/FAT/NT Filesystems
1021#
1022CONFIG_FAT_FS=y
1023CONFIG_MSDOS_FS=y
1024CONFIG_VFAT_FS=m
1025CONFIG_FAT_DEFAULT_CODEPAGE=437
1026CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1027# CONFIG_NTFS_FS is not set
1028
1029#
1030# Pseudo filesystems
1031#
1032CONFIG_PROC_FS=y
1033CONFIG_PROC_KCORE=y
1034CONFIG_PROC_SYSCTL=y
1035CONFIG_SYSFS=y
1036CONFIG_TMPFS=y
1037# CONFIG_TMPFS_POSIX_ACL is not set
1038# CONFIG_HUGETLB_PAGE is not set
1039CONFIG_CONFIGFS_FS=m
1040
1041#
1042# Miscellaneous filesystems
1043#
1044# CONFIG_ADFS_FS is not set
1045CONFIG_AFFS_FS=m
1046CONFIG_HFS_FS=y
1047CONFIG_HFSPLUS_FS=y
1048# CONFIG_BEFS_FS is not set
1049# CONFIG_BFS_FS is not set
1050# CONFIG_EFS_FS is not set
1051CONFIG_CRAMFS=m
1052# CONFIG_VXFS_FS is not set
1053CONFIG_MINIX_FS=y
1054CONFIG_HPFS_FS=m
1055# CONFIG_QNX4FS_FS is not set
1056# CONFIG_ROMFS_FS is not set
1057CONFIG_SYSV_FS=m
1058CONFIG_UFS_FS=m
1059# CONFIG_UFS_FS_WRITE is not set
1060# CONFIG_UFS_DEBUG is not set
1061CONFIG_NETWORK_FILESYSTEMS=y
1062CONFIG_NFS_FS=y
1063CONFIG_NFS_V3=y
1064# CONFIG_NFS_V3_ACL is not set
1065CONFIG_NFS_V4=y
1066CONFIG_NFSD=m
1067CONFIG_NFSD_V3=y
1068# CONFIG_NFSD_V3_ACL is not set
1069# CONFIG_NFSD_V4 is not set
1070CONFIG_ROOT_NFS=y
1071CONFIG_LOCKD=y
1072CONFIG_LOCKD_V4=y
1073CONFIG_EXPORTFS=m
1074CONFIG_NFS_COMMON=y
1075CONFIG_SUNRPC=y
1076CONFIG_SUNRPC_GSS=y
1077CONFIG_SUNRPC_BIND34=y
1078CONFIG_RPCSEC_GSS_KRB5=y
1079# CONFIG_RPCSEC_GSS_SPKM3 is not set
1080CONFIG_SMB_FS=m
1081CONFIG_SMB_NLS_DEFAULT=y
1082CONFIG_SMB_NLS_REMOTE="cp437"
1083# CONFIG_CIFS is not set
1084# CONFIG_NCP_FS is not set
1085CONFIG_CODA_FS=m
1086# CONFIG_CODA_FS_OLD_API is not set
1087# CONFIG_AFS_FS is not set
1088
1089#
1090# Partition Types
1091#
1092# CONFIG_PARTITION_ADVANCED is not set
1093CONFIG_AMIGA_PARTITION=y
1094CONFIG_ATARI_PARTITION=y
1095CONFIG_MAC_PARTITION=y
1096CONFIG_MSDOS_PARTITION=y
1097CONFIG_SUN_PARTITION=y
1098CONFIG_SYSV68_PARTITION=y
1099CONFIG_NLS=y
1100CONFIG_NLS_DEFAULT="iso8859-1"
1101CONFIG_NLS_CODEPAGE_437=y
1102CONFIG_NLS_CODEPAGE_737=m
1103CONFIG_NLS_CODEPAGE_775=m
1104CONFIG_NLS_CODEPAGE_850=m
1105CONFIG_NLS_CODEPAGE_852=m
1106CONFIG_NLS_CODEPAGE_855=m
1107CONFIG_NLS_CODEPAGE_857=m
1108CONFIG_NLS_CODEPAGE_860=m
1109CONFIG_NLS_CODEPAGE_861=m
1110CONFIG_NLS_CODEPAGE_862=m
1111CONFIG_NLS_CODEPAGE_863=m
1112CONFIG_NLS_CODEPAGE_864=m
1113CONFIG_NLS_CODEPAGE_865=m
1114CONFIG_NLS_CODEPAGE_866=m
1115CONFIG_NLS_CODEPAGE_869=m
1116CONFIG_NLS_CODEPAGE_936=m
1117CONFIG_NLS_CODEPAGE_950=m
1118CONFIG_NLS_CODEPAGE_932=m
1119CONFIG_NLS_CODEPAGE_949=m
1120CONFIG_NLS_CODEPAGE_874=m
1121CONFIG_NLS_ISO8859_8=m
1122CONFIG_NLS_CODEPAGE_1250=m
1123CONFIG_NLS_CODEPAGE_1251=m
1124CONFIG_NLS_ASCII=m
1125CONFIG_NLS_ISO8859_1=y
1126CONFIG_NLS_ISO8859_2=m
1127CONFIG_NLS_ISO8859_3=m
1128CONFIG_NLS_ISO8859_4=m
1129CONFIG_NLS_ISO8859_5=m
1130CONFIG_NLS_ISO8859_6=m
1131CONFIG_NLS_ISO8859_7=m
1132CONFIG_NLS_ISO8859_9=m
1133CONFIG_NLS_ISO8859_13=m
1134CONFIG_NLS_ISO8859_14=m
1135CONFIG_NLS_ISO8859_15=m
1136CONFIG_NLS_KOI8_R=m
1137CONFIG_NLS_KOI8_U=m
1138CONFIG_NLS_UTF8=y
1139CONFIG_DLM=m
1140# CONFIG_DLM_DEBUG is not set
1141
1142#
1143# Kernel hacking
1144#
1145# CONFIG_PRINTK_TIME is not set
1146CONFIG_ENABLE_WARN_DEPRECATED=y
1147CONFIG_ENABLE_MUST_CHECK=y
1148CONFIG_FRAME_WARN=1024
1149CONFIG_MAGIC_SYSRQ=y
1150# CONFIG_UNUSED_SYMBOLS is not set
1151# CONFIG_DEBUG_FS is not set
1152# CONFIG_HEADERS_CHECK is not set
1153# CONFIG_DEBUG_KERNEL is not set
1154CONFIG_DEBUG_BUGVERBOSE=y
1155# CONFIG_SAMPLES is not set
1156
1157#
1158# Security options
1159#
1160# CONFIG_KEYS is not set
1161# CONFIG_SECURITY is not set
1162# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1163CONFIG_XOR_BLOCKS=m
1164CONFIG_ASYNC_CORE=m
1165CONFIG_ASYNC_MEMCPY=m
1166CONFIG_ASYNC_XOR=m
1167CONFIG_CRYPTO=y
1168
1169#
1170# Crypto core or helper
1171#
1172CONFIG_CRYPTO_ALGAPI=y
1173CONFIG_CRYPTO_AEAD=m
1174CONFIG_CRYPTO_BLKCIPHER=y
1175CONFIG_CRYPTO_HASH=y
1176CONFIG_CRYPTO_MANAGER=y
1177CONFIG_CRYPTO_GF128MUL=m
1178CONFIG_CRYPTO_NULL=m
1179CONFIG_CRYPTO_CRYPTD=m
1180CONFIG_CRYPTO_AUTHENC=m
1181CONFIG_CRYPTO_TEST=m
1182
1183#
1184# Authenticated Encryption with Associated Data
1185#
1186CONFIG_CRYPTO_CCM=m
1187CONFIG_CRYPTO_GCM=m
1188CONFIG_CRYPTO_SEQIV=m
1189
1190#
1191# Block modes
1192#
1193CONFIG_CRYPTO_CBC=y
1194CONFIG_CRYPTO_CTR=m
1195CONFIG_CRYPTO_CTS=m
1196CONFIG_CRYPTO_ECB=m
1197CONFIG_CRYPTO_LRW=m
1198CONFIG_CRYPTO_PCBC=m
1199CONFIG_CRYPTO_XTS=m
1200
1201#
1202# Hash modes
1203#
1204CONFIG_CRYPTO_HMAC=y
1205CONFIG_CRYPTO_XCBC=m
1206
1207#
1208# Digest
1209#
1210CONFIG_CRYPTO_CRC32C=m
1211CONFIG_CRYPTO_MD4=m
1212CONFIG_CRYPTO_MD5=y
1213CONFIG_CRYPTO_MICHAEL_MIC=m
1214CONFIG_CRYPTO_SHA1=m
1215CONFIG_CRYPTO_SHA256=m
1216CONFIG_CRYPTO_SHA512=m
1217CONFIG_CRYPTO_TGR192=m
1218CONFIG_CRYPTO_WP512=m
1219
1220#
1221# Ciphers
1222#
1223CONFIG_CRYPTO_AES=m
1224CONFIG_CRYPTO_ANUBIS=m
1225CONFIG_CRYPTO_ARC4=m
1226CONFIG_CRYPTO_BLOWFISH=m
1227CONFIG_CRYPTO_CAMELLIA=m
1228CONFIG_CRYPTO_CAST5=m
1229CONFIG_CRYPTO_CAST6=m
1230CONFIG_CRYPTO_DES=y
1231CONFIG_CRYPTO_FCRYPT=m
1232CONFIG_CRYPTO_KHAZAD=m
1233CONFIG_CRYPTO_SALSA20=m
1234CONFIG_CRYPTO_SEED=m
1235CONFIG_CRYPTO_SERPENT=m
1236CONFIG_CRYPTO_TEA=m
1237CONFIG_CRYPTO_TWOFISH=m
1238CONFIG_CRYPTO_TWOFISH_COMMON=m
1239
1240#
1241# Compression
1242#
1243CONFIG_CRYPTO_DEFLATE=m
1244CONFIG_CRYPTO_LZO=m
1245# CONFIG_CRYPTO_HW is not set
1246
1247#
1248# Library routines
1249#
1250CONFIG_BITREVERSE=y
1251# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1252# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1253CONFIG_CRC_CCITT=m
1254CONFIG_CRC16=y
1255CONFIG_CRC_ITU_T=m
1256CONFIG_CRC32=y
1257# CONFIG_CRC7 is not set
1258CONFIG_LIBCRC32C=m
1259CONFIG_ZLIB_INFLATE=y
1260CONFIG_ZLIB_DEFLATE=m
1261CONFIG_LZO_COMPRESS=m
1262CONFIG_LZO_DECOMPRESS=m
1263CONFIG_TEXTSEARCH=y
1264CONFIG_TEXTSEARCH_KMP=m
1265CONFIG_TEXTSEARCH_BM=m
1266CONFIG_TEXTSEARCH_FSM=m
1267CONFIG_PLIST=y
1268CONFIG_HAS_IOMEM=y
1269CONFIG_HAS_DMA=y
diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig
index f40b1724254b..e7a8246840b5 100644
--- a/arch/m68k/configs/mvme147_defconfig
+++ b/arch/m68k/configs/mvme147_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:17 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -144,6 +147,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
144CONFIG_NEED_MULTIPLE_NODES=y 147CONFIG_NEED_MULTIPLE_NODES=y
145# CONFIG_SPARSEMEM_STATIC is not set 148# CONFIG_SPARSEMEM_STATIC is not set
146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 149# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
150CONFIG_PAGEFLAGS_EXTENDED=y
147CONFIG_SPLIT_PTLOCK_CPUS=4 151CONFIG_SPLIT_PTLOCK_CPUS=4
148# CONFIG_RESOURCES_64BIT is not set 152# CONFIG_RESOURCES_64BIT is not set
149CONFIG_ZONE_DMA_FLAG=1 153CONFIG_ZONE_DMA_FLAG=1
@@ -222,8 +226,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
222CONFIG_INET6_XFRM_MODE_BEET=m 226CONFIG_INET6_XFRM_MODE_BEET=m
223CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 227CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
224CONFIG_IPV6_SIT=m 228CONFIG_IPV6_SIT=m
229CONFIG_IPV6_NDISC_NODETYPE=y
225CONFIG_IPV6_TUNNEL=m 230CONFIG_IPV6_TUNNEL=m
226# CONFIG_IPV6_MULTIPLE_TABLES is not set 231# CONFIG_IPV6_MULTIPLE_TABLES is not set
232# CONFIG_IPV6_MROUTE is not set
227# CONFIG_NETWORK_SECMARK is not set 233# CONFIG_NETWORK_SECMARK is not set
228CONFIG_NETFILTER=y 234CONFIG_NETFILTER=y
229# CONFIG_NETFILTER_DEBUG is not set 235# CONFIG_NETFILTER_DEBUG is not set
@@ -239,6 +245,7 @@ CONFIG_NF_CONNTRACK=m
239CONFIG_NF_CT_ACCT=y 245CONFIG_NF_CT_ACCT=y
240CONFIG_NF_CONNTRACK_MARK=y 246CONFIG_NF_CONNTRACK_MARK=y
241# CONFIG_NF_CONNTRACK_EVENTS is not set 247# CONFIG_NF_CONNTRACK_EVENTS is not set
248# CONFIG_NF_CT_PROTO_DCCP is not set
242CONFIG_NF_CT_PROTO_GRE=m 249CONFIG_NF_CT_PROTO_GRE=m
243CONFIG_NF_CT_PROTO_SCTP=m 250CONFIG_NF_CT_PROTO_SCTP=m
244CONFIG_NF_CT_PROTO_UDPLITE=m 251CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -317,6 +324,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
317CONFIG_IP_NF_TARGET_NETMAP=m 324CONFIG_IP_NF_TARGET_NETMAP=m
318CONFIG_NF_NAT_SNMP_BASIC=m 325CONFIG_NF_NAT_SNMP_BASIC=m
319CONFIG_NF_NAT_PROTO_GRE=m 326CONFIG_NF_NAT_PROTO_GRE=m
327CONFIG_NF_NAT_PROTO_UDPLITE=m
328CONFIG_NF_NAT_PROTO_SCTP=m
320CONFIG_NF_NAT_FTP=m 329CONFIG_NF_NAT_FTP=m
321CONFIG_NF_NAT_IRC=m 330CONFIG_NF_NAT_IRC=m
322CONFIG_NF_NAT_TFTP=m 331CONFIG_NF_NAT_TFTP=m
@@ -410,8 +419,6 @@ CONFIG_IEEE80211=m
410CONFIG_IEEE80211_CRYPT_WEP=m 419CONFIG_IEEE80211_CRYPT_WEP=m
411CONFIG_IEEE80211_CRYPT_CCMP=m 420CONFIG_IEEE80211_CRYPT_CCMP=m
412CONFIG_IEEE80211_CRYPT_TKIP=m 421CONFIG_IEEE80211_CRYPT_TKIP=m
413CONFIG_IEEE80211_SOFTMAC=m
414# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
415# CONFIG_RFKILL is not set 422# CONFIG_RFKILL is not set
416# CONFIG_NET_9P is not set 423# CONFIG_NET_9P is not set
417 424
@@ -542,6 +549,7 @@ CONFIG_MVME147_NET=y
542# 549#
543# CONFIG_WLAN_PRE80211 is not set 550# CONFIG_WLAN_PRE80211 is not set
544# CONFIG_WLAN_80211 is not set 551# CONFIG_WLAN_80211 is not set
552# CONFIG_IWLWIFI_LEDS is not set
545# CONFIG_WAN is not set 553# CONFIG_WAN is not set
546CONFIG_PPP=m 554CONFIG_PPP=m
547# CONFIG_PPP_MULTILINK is not set 555# CONFIG_PPP_MULTILINK is not set
@@ -625,6 +633,7 @@ CONFIG_VT=y
625CONFIG_VT_CONSOLE=y 633CONFIG_VT_CONSOLE=y
626CONFIG_HW_CONSOLE=y 634CONFIG_HW_CONSOLE=y
627CONFIG_VT_HW_CONSOLE_BINDING=y 635CONFIG_VT_HW_CONSOLE_BINDING=y
636# CONFIG_DEVKMEM is not set
628# CONFIG_SERIAL_NONSTANDARD is not set 637# CONFIG_SERIAL_NONSTANDARD is not set
629 638
630# 639#
@@ -646,12 +655,7 @@ CONFIG_GEN_RTC_X=y
646# CONFIG_RAW_DRIVER is not set 655# CONFIG_RAW_DRIVER is not set
647# CONFIG_TCG_TPM is not set 656# CONFIG_TCG_TPM is not set
648# CONFIG_I2C is not set 657# CONFIG_I2C is not set
649
650#
651# SPI support
652#
653# CONFIG_SPI is not set 658# CONFIG_SPI is not set
654# CONFIG_SPI_MASTER is not set
655# CONFIG_W1 is not set 659# CONFIG_W1 is not set
656# CONFIG_POWER_SUPPLY is not set 660# CONFIG_POWER_SUPPLY is not set
657# CONFIG_HWMON is not set 661# CONFIG_HWMON is not set
@@ -668,12 +672,22 @@ CONFIG_SSB_POSSIBLE=y
668# Multifunction device drivers 672# Multifunction device drivers
669# 673#
670# CONFIG_MFD_SM501 is not set 674# CONFIG_MFD_SM501 is not set
675# CONFIG_HTC_PASIC3 is not set
671 676
672# 677#
673# Multimedia devices 678# Multimedia devices
674# 679#
680
681#
682# Multimedia core support
683#
675# CONFIG_VIDEO_DEV is not set 684# CONFIG_VIDEO_DEV is not set
676# CONFIG_DVB_CORE is not set 685# CONFIG_DVB_CORE is not set
686# CONFIG_VIDEO_MEDIA is not set
687
688#
689# Multimedia drivers
690#
677# CONFIG_DAB is not set 691# CONFIG_DAB is not set
678 692
679# 693#
@@ -706,11 +720,8 @@ CONFIG_HIDRAW=y
706# CONFIG_MMC is not set 720# CONFIG_MMC is not set
707# CONFIG_MEMSTICK is not set 721# CONFIG_MEMSTICK is not set
708# CONFIG_NEW_LEDS is not set 722# CONFIG_NEW_LEDS is not set
723# CONFIG_ACCESSIBILITY is not set
709# CONFIG_RTC_CLASS is not set 724# CONFIG_RTC_CLASS is not set
710
711#
712# Userspace I/O
713#
714# CONFIG_UIO is not set 725# CONFIG_UIO is not set
715 726
716# 727#
@@ -738,16 +749,15 @@ CONFIG_JFS_FS=m
738# CONFIG_JFS_SECURITY is not set 749# CONFIG_JFS_SECURITY is not set
739# CONFIG_JFS_DEBUG is not set 750# CONFIG_JFS_DEBUG is not set
740# CONFIG_JFS_STATISTICS is not set 751# CONFIG_JFS_STATISTICS is not set
741CONFIG_FS_POSIX_ACL=y 752# CONFIG_FS_POSIX_ACL is not set
742CONFIG_XFS_FS=m 753CONFIG_XFS_FS=m
743# CONFIG_XFS_QUOTA is not set 754# CONFIG_XFS_QUOTA is not set
744# CONFIG_XFS_SECURITY is not set
745# CONFIG_XFS_POSIX_ACL is not set 755# CONFIG_XFS_POSIX_ACL is not set
746# CONFIG_XFS_RT is not set 756# CONFIG_XFS_RT is not set
747CONFIG_GFS2_FS=m 757# CONFIG_XFS_DEBUG is not set
748CONFIG_GFS2_FS_LOCKING_NOLOCK=m
749CONFIG_GFS2_FS_LOCKING_DLM=m
750CONFIG_OCFS2_FS=m 758CONFIG_OCFS2_FS=m
759CONFIG_OCFS2_FS_O2CB=m
760CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
751# CONFIG_OCFS2_DEBUG_MASKLOG is not set 761# CONFIG_OCFS2_DEBUG_MASKLOG is not set
752# CONFIG_OCFS2_DEBUG_FS is not set 762# CONFIG_OCFS2_DEBUG_FS is not set
753CONFIG_DNOTIFY=y 763CONFIG_DNOTIFY=y
@@ -819,12 +829,10 @@ CONFIG_NFS_FS=y
819CONFIG_NFS_V3=y 829CONFIG_NFS_V3=y
820# CONFIG_NFS_V3_ACL is not set 830# CONFIG_NFS_V3_ACL is not set
821CONFIG_NFS_V4=y 831CONFIG_NFS_V4=y
822# CONFIG_NFS_DIRECTIO is not set
823CONFIG_NFSD=m 832CONFIG_NFSD=m
824CONFIG_NFSD_V3=y 833CONFIG_NFSD_V3=y
825# CONFIG_NFSD_V3_ACL is not set 834# CONFIG_NFSD_V3_ACL is not set
826# CONFIG_NFSD_V4 is not set 835# CONFIG_NFSD_V4 is not set
827CONFIG_NFSD_TCP=y
828CONFIG_ROOT_NFS=y 836CONFIG_ROOT_NFS=y
829CONFIG_LOCKD=y 837CONFIG_LOCKD=y
830CONFIG_LOCKD_V4=y 838CONFIG_LOCKD_V4=y
@@ -899,6 +907,7 @@ CONFIG_DLM=m
899# CONFIG_PRINTK_TIME is not set 907# CONFIG_PRINTK_TIME is not set
900CONFIG_ENABLE_WARN_DEPRECATED=y 908CONFIG_ENABLE_WARN_DEPRECATED=y
901CONFIG_ENABLE_MUST_CHECK=y 909CONFIG_ENABLE_MUST_CHECK=y
910CONFIG_FRAME_WARN=1024
902CONFIG_MAGIC_SYSRQ=y 911CONFIG_MAGIC_SYSRQ=y
903# CONFIG_UNUSED_SYMBOLS is not set 912# CONFIG_UNUSED_SYMBOLS is not set
904# CONFIG_DEBUG_FS is not set 913# CONFIG_DEBUG_FS is not set
@@ -918,53 +927,82 @@ CONFIG_ASYNC_CORE=m
918CONFIG_ASYNC_MEMCPY=m 927CONFIG_ASYNC_MEMCPY=m
919CONFIG_ASYNC_XOR=m 928CONFIG_ASYNC_XOR=m
920CONFIG_CRYPTO=y 929CONFIG_CRYPTO=y
930
931#
932# Crypto core or helper
933#
921CONFIG_CRYPTO_ALGAPI=y 934CONFIG_CRYPTO_ALGAPI=y
922CONFIG_CRYPTO_AEAD=m 935CONFIG_CRYPTO_AEAD=m
923CONFIG_CRYPTO_BLKCIPHER=y 936CONFIG_CRYPTO_BLKCIPHER=y
924CONFIG_CRYPTO_SEQIV=m
925CONFIG_CRYPTO_HASH=y 937CONFIG_CRYPTO_HASH=y
926CONFIG_CRYPTO_MANAGER=y 938CONFIG_CRYPTO_MANAGER=y
939CONFIG_CRYPTO_GF128MUL=m
940CONFIG_CRYPTO_NULL=m
941CONFIG_CRYPTO_CRYPTD=m
942CONFIG_CRYPTO_AUTHENC=m
943CONFIG_CRYPTO_TEST=m
944
945#
946# Authenticated Encryption with Associated Data
947#
948CONFIG_CRYPTO_CCM=m
949CONFIG_CRYPTO_GCM=m
950CONFIG_CRYPTO_SEQIV=m
951
952#
953# Block modes
954#
955CONFIG_CRYPTO_CBC=y
956CONFIG_CRYPTO_CTR=m
957CONFIG_CRYPTO_CTS=m
958CONFIG_CRYPTO_ECB=m
959CONFIG_CRYPTO_LRW=m
960CONFIG_CRYPTO_PCBC=m
961CONFIG_CRYPTO_XTS=m
962
963#
964# Hash modes
965#
927CONFIG_CRYPTO_HMAC=y 966CONFIG_CRYPTO_HMAC=y
928CONFIG_CRYPTO_XCBC=m 967CONFIG_CRYPTO_XCBC=m
929CONFIG_CRYPTO_NULL=m 968
969#
970# Digest
971#
972CONFIG_CRYPTO_CRC32C=m
930CONFIG_CRYPTO_MD4=m 973CONFIG_CRYPTO_MD4=m
931CONFIG_CRYPTO_MD5=y 974CONFIG_CRYPTO_MD5=y
975CONFIG_CRYPTO_MICHAEL_MIC=m
932CONFIG_CRYPTO_SHA1=m 976CONFIG_CRYPTO_SHA1=m
933CONFIG_CRYPTO_SHA256=m 977CONFIG_CRYPTO_SHA256=m
934CONFIG_CRYPTO_SHA512=m 978CONFIG_CRYPTO_SHA512=m
935CONFIG_CRYPTO_WP512=m
936CONFIG_CRYPTO_TGR192=m 979CONFIG_CRYPTO_TGR192=m
937CONFIG_CRYPTO_GF128MUL=m 980CONFIG_CRYPTO_WP512=m
938CONFIG_CRYPTO_ECB=m 981
939CONFIG_CRYPTO_CBC=y 982#
940CONFIG_CRYPTO_PCBC=m 983# Ciphers
941CONFIG_CRYPTO_LRW=m 984#
942CONFIG_CRYPTO_XTS=m
943CONFIG_CRYPTO_CTR=m
944CONFIG_CRYPTO_GCM=m
945CONFIG_CRYPTO_CCM=m
946CONFIG_CRYPTO_CRYPTD=m
947CONFIG_CRYPTO_DES=y
948CONFIG_CRYPTO_FCRYPT=m
949CONFIG_CRYPTO_BLOWFISH=m
950CONFIG_CRYPTO_TWOFISH=m
951CONFIG_CRYPTO_TWOFISH_COMMON=m
952CONFIG_CRYPTO_SERPENT=m
953CONFIG_CRYPTO_AES=m 985CONFIG_CRYPTO_AES=m
986CONFIG_CRYPTO_ANUBIS=m
987CONFIG_CRYPTO_ARC4=m
988CONFIG_CRYPTO_BLOWFISH=m
989CONFIG_CRYPTO_CAMELLIA=m
954CONFIG_CRYPTO_CAST5=m 990CONFIG_CRYPTO_CAST5=m
955CONFIG_CRYPTO_CAST6=m 991CONFIG_CRYPTO_CAST6=m
956CONFIG_CRYPTO_TEA=m 992CONFIG_CRYPTO_DES=y
957CONFIG_CRYPTO_ARC4=m 993CONFIG_CRYPTO_FCRYPT=m
958CONFIG_CRYPTO_KHAZAD=m 994CONFIG_CRYPTO_KHAZAD=m
959CONFIG_CRYPTO_ANUBIS=m
960CONFIG_CRYPTO_SEED=m
961CONFIG_CRYPTO_SALSA20=m 995CONFIG_CRYPTO_SALSA20=m
996CONFIG_CRYPTO_SEED=m
997CONFIG_CRYPTO_SERPENT=m
998CONFIG_CRYPTO_TEA=m
999CONFIG_CRYPTO_TWOFISH=m
1000CONFIG_CRYPTO_TWOFISH_COMMON=m
1001
1002#
1003# Compression
1004#
962CONFIG_CRYPTO_DEFLATE=m 1005CONFIG_CRYPTO_DEFLATE=m
963CONFIG_CRYPTO_MICHAEL_MIC=m
964CONFIG_CRYPTO_CRC32C=m
965CONFIG_CRYPTO_CAMELLIA=m
966CONFIG_CRYPTO_TEST=m
967CONFIG_CRYPTO_AUTHENC=m
968CONFIG_CRYPTO_LZO=m 1006CONFIG_CRYPTO_LZO=m
969# CONFIG_CRYPTO_HW is not set 1007# CONFIG_CRYPTO_HW is not set
970 1008
@@ -972,9 +1010,11 @@ CONFIG_CRYPTO_LZO=m
972# Library routines 1010# Library routines
973# 1011#
974CONFIG_BITREVERSE=y 1012CONFIG_BITREVERSE=y
1013# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1014# CONFIG_GENERIC_FIND_NEXT_BIT is not set
975CONFIG_CRC_CCITT=m 1015CONFIG_CRC_CCITT=m
976CONFIG_CRC16=m 1016CONFIG_CRC16=m
977# CONFIG_CRC_ITU_T is not set 1017CONFIG_CRC_ITU_T=m
978CONFIG_CRC32=y 1018CONFIG_CRC32=y
979# CONFIG_CRC7 is not set 1019# CONFIG_CRC7 is not set
980CONFIG_LIBCRC32C=m 1020CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig
index e9ccc774334e..ab536eb172bb 100644
--- a/arch/m68k/configs/mvme16x_defconfig
+++ b/arch/m68k/configs/mvme16x_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:19 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -144,6 +147,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
144CONFIG_NEED_MULTIPLE_NODES=y 147CONFIG_NEED_MULTIPLE_NODES=y
145# CONFIG_SPARSEMEM_STATIC is not set 148# CONFIG_SPARSEMEM_STATIC is not set
146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 149# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
150CONFIG_PAGEFLAGS_EXTENDED=y
147CONFIG_SPLIT_PTLOCK_CPUS=4 151CONFIG_SPLIT_PTLOCK_CPUS=4
148# CONFIG_RESOURCES_64BIT is not set 152# CONFIG_RESOURCES_64BIT is not set
149CONFIG_ZONE_DMA_FLAG=1 153CONFIG_ZONE_DMA_FLAG=1
@@ -222,8 +226,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
222CONFIG_INET6_XFRM_MODE_BEET=m 226CONFIG_INET6_XFRM_MODE_BEET=m
223CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 227CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
224CONFIG_IPV6_SIT=m 228CONFIG_IPV6_SIT=m
229CONFIG_IPV6_NDISC_NODETYPE=y
225CONFIG_IPV6_TUNNEL=m 230CONFIG_IPV6_TUNNEL=m
226# CONFIG_IPV6_MULTIPLE_TABLES is not set 231# CONFIG_IPV6_MULTIPLE_TABLES is not set
232# CONFIG_IPV6_MROUTE is not set
227# CONFIG_NETWORK_SECMARK is not set 233# CONFIG_NETWORK_SECMARK is not set
228CONFIG_NETFILTER=y 234CONFIG_NETFILTER=y
229# CONFIG_NETFILTER_DEBUG is not set 235# CONFIG_NETFILTER_DEBUG is not set
@@ -239,6 +245,7 @@ CONFIG_NF_CONNTRACK=m
239CONFIG_NF_CT_ACCT=y 245CONFIG_NF_CT_ACCT=y
240CONFIG_NF_CONNTRACK_MARK=y 246CONFIG_NF_CONNTRACK_MARK=y
241# CONFIG_NF_CONNTRACK_EVENTS is not set 247# CONFIG_NF_CONNTRACK_EVENTS is not set
248# CONFIG_NF_CT_PROTO_DCCP is not set
242CONFIG_NF_CT_PROTO_GRE=m 249CONFIG_NF_CT_PROTO_GRE=m
243CONFIG_NF_CT_PROTO_SCTP=m 250CONFIG_NF_CT_PROTO_SCTP=m
244CONFIG_NF_CT_PROTO_UDPLITE=m 251CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -317,6 +324,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
317CONFIG_IP_NF_TARGET_NETMAP=m 324CONFIG_IP_NF_TARGET_NETMAP=m
318CONFIG_NF_NAT_SNMP_BASIC=m 325CONFIG_NF_NAT_SNMP_BASIC=m
319CONFIG_NF_NAT_PROTO_GRE=m 326CONFIG_NF_NAT_PROTO_GRE=m
327CONFIG_NF_NAT_PROTO_UDPLITE=m
328CONFIG_NF_NAT_PROTO_SCTP=m
320CONFIG_NF_NAT_FTP=m 329CONFIG_NF_NAT_FTP=m
321CONFIG_NF_NAT_IRC=m 330CONFIG_NF_NAT_IRC=m
322CONFIG_NF_NAT_TFTP=m 331CONFIG_NF_NAT_TFTP=m
@@ -410,8 +419,6 @@ CONFIG_IEEE80211=m
410CONFIG_IEEE80211_CRYPT_WEP=m 419CONFIG_IEEE80211_CRYPT_WEP=m
411CONFIG_IEEE80211_CRYPT_CCMP=m 420CONFIG_IEEE80211_CRYPT_CCMP=m
412CONFIG_IEEE80211_CRYPT_TKIP=m 421CONFIG_IEEE80211_CRYPT_TKIP=m
413CONFIG_IEEE80211_SOFTMAC=m
414# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
415# CONFIG_RFKILL is not set 422# CONFIG_RFKILL is not set
416# CONFIG_NET_9P is not set 423# CONFIG_NET_9P is not set
417 424
@@ -543,6 +550,7 @@ CONFIG_MVME16x_NET=y
543# 550#
544# CONFIG_WLAN_PRE80211 is not set 551# CONFIG_WLAN_PRE80211 is not set
545# CONFIG_WLAN_80211 is not set 552# CONFIG_WLAN_80211 is not set
553# CONFIG_IWLWIFI_LEDS is not set
546# CONFIG_WAN is not set 554# CONFIG_WAN is not set
547CONFIG_PPP=m 555CONFIG_PPP=m
548# CONFIG_PPP_MULTILINK is not set 556# CONFIG_PPP_MULTILINK is not set
@@ -626,6 +634,7 @@ CONFIG_VT=y
626CONFIG_VT_CONSOLE=y 634CONFIG_VT_CONSOLE=y
627CONFIG_HW_CONSOLE=y 635CONFIG_HW_CONSOLE=y
628CONFIG_VT_HW_CONSOLE_BINDING=y 636CONFIG_VT_HW_CONSOLE_BINDING=y
637# CONFIG_DEVKMEM is not set
629# CONFIG_SERIAL_NONSTANDARD is not set 638# CONFIG_SERIAL_NONSTANDARD is not set
630 639
631# 640#
@@ -647,12 +656,7 @@ CONFIG_GEN_RTC_X=y
647# CONFIG_RAW_DRIVER is not set 656# CONFIG_RAW_DRIVER is not set
648# CONFIG_TCG_TPM is not set 657# CONFIG_TCG_TPM is not set
649# CONFIG_I2C is not set 658# CONFIG_I2C is not set
650
651#
652# SPI support
653#
654# CONFIG_SPI is not set 659# CONFIG_SPI is not set
655# CONFIG_SPI_MASTER is not set
656# CONFIG_W1 is not set 660# CONFIG_W1 is not set
657# CONFIG_POWER_SUPPLY is not set 661# CONFIG_POWER_SUPPLY is not set
658# CONFIG_HWMON is not set 662# CONFIG_HWMON is not set
@@ -669,12 +673,22 @@ CONFIG_SSB_POSSIBLE=y
669# Multifunction device drivers 673# Multifunction device drivers
670# 674#
671# CONFIG_MFD_SM501 is not set 675# CONFIG_MFD_SM501 is not set
676# CONFIG_HTC_PASIC3 is not set
672 677
673# 678#
674# Multimedia devices 679# Multimedia devices
675# 680#
681
682#
683# Multimedia core support
684#
676# CONFIG_VIDEO_DEV is not set 685# CONFIG_VIDEO_DEV is not set
677# CONFIG_DVB_CORE is not set 686# CONFIG_DVB_CORE is not set
687# CONFIG_VIDEO_MEDIA is not set
688
689#
690# Multimedia drivers
691#
678# CONFIG_DAB is not set 692# CONFIG_DAB is not set
679 693
680# 694#
@@ -707,11 +721,8 @@ CONFIG_HIDRAW=y
707# CONFIG_MMC is not set 721# CONFIG_MMC is not set
708# CONFIG_MEMSTICK is not set 722# CONFIG_MEMSTICK is not set
709# CONFIG_NEW_LEDS is not set 723# CONFIG_NEW_LEDS is not set
724# CONFIG_ACCESSIBILITY is not set
710# CONFIG_RTC_CLASS is not set 725# CONFIG_RTC_CLASS is not set
711
712#
713# Userspace I/O
714#
715# CONFIG_UIO is not set 726# CONFIG_UIO is not set
716 727
717# 728#
@@ -740,16 +751,15 @@ CONFIG_JFS_FS=m
740# CONFIG_JFS_SECURITY is not set 751# CONFIG_JFS_SECURITY is not set
741# CONFIG_JFS_DEBUG is not set 752# CONFIG_JFS_DEBUG is not set
742# CONFIG_JFS_STATISTICS is not set 753# CONFIG_JFS_STATISTICS is not set
743CONFIG_FS_POSIX_ACL=y 754# CONFIG_FS_POSIX_ACL is not set
744CONFIG_XFS_FS=m 755CONFIG_XFS_FS=m
745# CONFIG_XFS_QUOTA is not set 756# CONFIG_XFS_QUOTA is not set
746# CONFIG_XFS_SECURITY is not set
747# CONFIG_XFS_POSIX_ACL is not set 757# CONFIG_XFS_POSIX_ACL is not set
748# CONFIG_XFS_RT is not set 758# CONFIG_XFS_RT is not set
749CONFIG_GFS2_FS=m 759# CONFIG_XFS_DEBUG is not set
750CONFIG_GFS2_FS_LOCKING_NOLOCK=m
751CONFIG_GFS2_FS_LOCKING_DLM=m
752CONFIG_OCFS2_FS=m 760CONFIG_OCFS2_FS=m
761CONFIG_OCFS2_FS_O2CB=m
762CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
753# CONFIG_OCFS2_DEBUG_MASKLOG is not set 763# CONFIG_OCFS2_DEBUG_MASKLOG is not set
754# CONFIG_OCFS2_DEBUG_FS is not set 764# CONFIG_OCFS2_DEBUG_FS is not set
755CONFIG_DNOTIFY=y 765CONFIG_DNOTIFY=y
@@ -821,12 +831,10 @@ CONFIG_NFS_FS=y
821CONFIG_NFS_V3=y 831CONFIG_NFS_V3=y
822# CONFIG_NFS_V3_ACL is not set 832# CONFIG_NFS_V3_ACL is not set
823CONFIG_NFS_V4=y 833CONFIG_NFS_V4=y
824# CONFIG_NFS_DIRECTIO is not set
825CONFIG_NFSD=m 834CONFIG_NFSD=m
826CONFIG_NFSD_V3=y 835CONFIG_NFSD_V3=y
827# CONFIG_NFSD_V3_ACL is not set 836# CONFIG_NFSD_V3_ACL is not set
828# CONFIG_NFSD_V4 is not set 837# CONFIG_NFSD_V4 is not set
829CONFIG_NFSD_TCP=y
830CONFIG_ROOT_NFS=y 838CONFIG_ROOT_NFS=y
831CONFIG_LOCKD=y 839CONFIG_LOCKD=y
832CONFIG_LOCKD_V4=y 840CONFIG_LOCKD_V4=y
@@ -901,6 +909,7 @@ CONFIG_DLM=m
901# CONFIG_PRINTK_TIME is not set 909# CONFIG_PRINTK_TIME is not set
902CONFIG_ENABLE_WARN_DEPRECATED=y 910CONFIG_ENABLE_WARN_DEPRECATED=y
903CONFIG_ENABLE_MUST_CHECK=y 911CONFIG_ENABLE_MUST_CHECK=y
912CONFIG_FRAME_WARN=1024
904CONFIG_MAGIC_SYSRQ=y 913CONFIG_MAGIC_SYSRQ=y
905# CONFIG_UNUSED_SYMBOLS is not set 914# CONFIG_UNUSED_SYMBOLS is not set
906# CONFIG_DEBUG_FS is not set 915# CONFIG_DEBUG_FS is not set
@@ -920,53 +929,82 @@ CONFIG_ASYNC_CORE=m
920CONFIG_ASYNC_MEMCPY=m 929CONFIG_ASYNC_MEMCPY=m
921CONFIG_ASYNC_XOR=m 930CONFIG_ASYNC_XOR=m
922CONFIG_CRYPTO=y 931CONFIG_CRYPTO=y
932
933#
934# Crypto core or helper
935#
923CONFIG_CRYPTO_ALGAPI=y 936CONFIG_CRYPTO_ALGAPI=y
924CONFIG_CRYPTO_AEAD=m 937CONFIG_CRYPTO_AEAD=m
925CONFIG_CRYPTO_BLKCIPHER=y 938CONFIG_CRYPTO_BLKCIPHER=y
926CONFIG_CRYPTO_SEQIV=m
927CONFIG_CRYPTO_HASH=y 939CONFIG_CRYPTO_HASH=y
928CONFIG_CRYPTO_MANAGER=y 940CONFIG_CRYPTO_MANAGER=y
941CONFIG_CRYPTO_GF128MUL=m
942CONFIG_CRYPTO_NULL=m
943CONFIG_CRYPTO_CRYPTD=m
944CONFIG_CRYPTO_AUTHENC=m
945CONFIG_CRYPTO_TEST=m
946
947#
948# Authenticated Encryption with Associated Data
949#
950CONFIG_CRYPTO_CCM=m
951CONFIG_CRYPTO_GCM=m
952CONFIG_CRYPTO_SEQIV=m
953
954#
955# Block modes
956#
957CONFIG_CRYPTO_CBC=y
958CONFIG_CRYPTO_CTR=m
959CONFIG_CRYPTO_CTS=m
960CONFIG_CRYPTO_ECB=m
961CONFIG_CRYPTO_LRW=m
962CONFIG_CRYPTO_PCBC=m
963CONFIG_CRYPTO_XTS=m
964
965#
966# Hash modes
967#
929CONFIG_CRYPTO_HMAC=y 968CONFIG_CRYPTO_HMAC=y
930CONFIG_CRYPTO_XCBC=m 969CONFIG_CRYPTO_XCBC=m
931CONFIG_CRYPTO_NULL=m 970
971#
972# Digest
973#
974CONFIG_CRYPTO_CRC32C=m
932CONFIG_CRYPTO_MD4=m 975CONFIG_CRYPTO_MD4=m
933CONFIG_CRYPTO_MD5=y 976CONFIG_CRYPTO_MD5=y
977CONFIG_CRYPTO_MICHAEL_MIC=m
934CONFIG_CRYPTO_SHA1=m 978CONFIG_CRYPTO_SHA1=m
935CONFIG_CRYPTO_SHA256=m 979CONFIG_CRYPTO_SHA256=m
936CONFIG_CRYPTO_SHA512=m 980CONFIG_CRYPTO_SHA512=m
937CONFIG_CRYPTO_WP512=m
938CONFIG_CRYPTO_TGR192=m 981CONFIG_CRYPTO_TGR192=m
939CONFIG_CRYPTO_GF128MUL=m 982CONFIG_CRYPTO_WP512=m
940CONFIG_CRYPTO_ECB=m 983
941CONFIG_CRYPTO_CBC=y 984#
942CONFIG_CRYPTO_PCBC=m 985# Ciphers
943CONFIG_CRYPTO_LRW=m 986#
944CONFIG_CRYPTO_XTS=m
945CONFIG_CRYPTO_CTR=m
946CONFIG_CRYPTO_GCM=m
947CONFIG_CRYPTO_CCM=m
948CONFIG_CRYPTO_CRYPTD=m
949CONFIG_CRYPTO_DES=y
950CONFIG_CRYPTO_FCRYPT=m
951CONFIG_CRYPTO_BLOWFISH=m
952CONFIG_CRYPTO_TWOFISH=m
953CONFIG_CRYPTO_TWOFISH_COMMON=m
954CONFIG_CRYPTO_SERPENT=m
955CONFIG_CRYPTO_AES=m 987CONFIG_CRYPTO_AES=m
988CONFIG_CRYPTO_ANUBIS=m
989CONFIG_CRYPTO_ARC4=m
990CONFIG_CRYPTO_BLOWFISH=m
991CONFIG_CRYPTO_CAMELLIA=m
956CONFIG_CRYPTO_CAST5=m 992CONFIG_CRYPTO_CAST5=m
957CONFIG_CRYPTO_CAST6=m 993CONFIG_CRYPTO_CAST6=m
958CONFIG_CRYPTO_TEA=m 994CONFIG_CRYPTO_DES=y
959CONFIG_CRYPTO_ARC4=m 995CONFIG_CRYPTO_FCRYPT=m
960CONFIG_CRYPTO_KHAZAD=m 996CONFIG_CRYPTO_KHAZAD=m
961CONFIG_CRYPTO_ANUBIS=m
962CONFIG_CRYPTO_SEED=m
963CONFIG_CRYPTO_SALSA20=m 997CONFIG_CRYPTO_SALSA20=m
998CONFIG_CRYPTO_SEED=m
999CONFIG_CRYPTO_SERPENT=m
1000CONFIG_CRYPTO_TEA=m
1001CONFIG_CRYPTO_TWOFISH=m
1002CONFIG_CRYPTO_TWOFISH_COMMON=m
1003
1004#
1005# Compression
1006#
964CONFIG_CRYPTO_DEFLATE=m 1007CONFIG_CRYPTO_DEFLATE=m
965CONFIG_CRYPTO_MICHAEL_MIC=m
966CONFIG_CRYPTO_CRC32C=m
967CONFIG_CRYPTO_CAMELLIA=m
968CONFIG_CRYPTO_TEST=m
969CONFIG_CRYPTO_AUTHENC=m
970CONFIG_CRYPTO_LZO=m 1008CONFIG_CRYPTO_LZO=m
971# CONFIG_CRYPTO_HW is not set 1009# CONFIG_CRYPTO_HW is not set
972 1010
@@ -974,9 +1012,11 @@ CONFIG_CRYPTO_LZO=m
974# Library routines 1012# Library routines
975# 1013#
976CONFIG_BITREVERSE=y 1014CONFIG_BITREVERSE=y
1015# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1016# CONFIG_GENERIC_FIND_NEXT_BIT is not set
977CONFIG_CRC_CCITT=m 1017CONFIG_CRC_CCITT=m
978CONFIG_CRC16=m 1018CONFIG_CRC16=m
979# CONFIG_CRC_ITU_T is not set 1019CONFIG_CRC_ITU_T=m
980CONFIG_CRC32=y 1020CONFIG_CRC32=y
981# CONFIG_CRC7 is not set 1021# CONFIG_CRC7 is not set
982CONFIG_LIBCRC32C=m 1022CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index 165658fe73eb..e05be687b500 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:20 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -12,7 +12,6 @@ CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_TIME_LOW_RES=y 13CONFIG_TIME_LOW_RES=y
14CONFIG_GENERIC_IOMAP=y 14CONFIG_GENERIC_IOMAP=y
15CONFIG_ARCH_MAY_HAVE_PC_FDC=y
16CONFIG_NO_IOPORT=y 15CONFIG_NO_IOPORT=y
17# CONFIG_NO_DMA is not set 16# CONFIG_NO_DMA is not set
18CONFIG_ARCH_SUPPORTS_AOUT=y 17CONFIG_ARCH_SUPPORTS_AOUT=y
@@ -53,13 +52,14 @@ CONFIG_SYSCTL=y
53# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
54CONFIG_UID16=y 53CONFIG_UID16=y
55CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
59CONFIG_PRINTK=y 59CONFIG_PRINTK=y
60CONFIG_BUG=y 60CONFIG_BUG=y
61CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
63CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y 64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -77,12 +77,14 @@ CONFIG_SLAB=y
77# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
78# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
80CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
81CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
82CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
83# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
84CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
85CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
86CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
87# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
88# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -142,6 +144,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
142CONFIG_NEED_MULTIPLE_NODES=y 144CONFIG_NEED_MULTIPLE_NODES=y
143# CONFIG_SPARSEMEM_STATIC is not set 145# CONFIG_SPARSEMEM_STATIC is not set
144# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
147CONFIG_PAGEFLAGS_EXTENDED=y
145CONFIG_SPLIT_PTLOCK_CPUS=4 148CONFIG_SPLIT_PTLOCK_CPUS=4
146# CONFIG_RESOURCES_64BIT is not set 149# CONFIG_RESOURCES_64BIT is not set
147CONFIG_ZONE_DMA_FLAG=1 150CONFIG_ZONE_DMA_FLAG=1
@@ -220,8 +223,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
220CONFIG_INET6_XFRM_MODE_BEET=m 223CONFIG_INET6_XFRM_MODE_BEET=m
221CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 224CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
222CONFIG_IPV6_SIT=m 225CONFIG_IPV6_SIT=m
226CONFIG_IPV6_NDISC_NODETYPE=y
223CONFIG_IPV6_TUNNEL=m 227CONFIG_IPV6_TUNNEL=m
224# CONFIG_IPV6_MULTIPLE_TABLES is not set 228# CONFIG_IPV6_MULTIPLE_TABLES is not set
229# CONFIG_IPV6_MROUTE is not set
225# CONFIG_NETWORK_SECMARK is not set 230# CONFIG_NETWORK_SECMARK is not set
226CONFIG_NETFILTER=y 231CONFIG_NETFILTER=y
227# CONFIG_NETFILTER_DEBUG is not set 232# CONFIG_NETFILTER_DEBUG is not set
@@ -237,6 +242,7 @@ CONFIG_NF_CONNTRACK=m
237CONFIG_NF_CT_ACCT=y 242CONFIG_NF_CT_ACCT=y
238CONFIG_NF_CONNTRACK_MARK=y 243CONFIG_NF_CONNTRACK_MARK=y
239# CONFIG_NF_CONNTRACK_EVENTS is not set 244# CONFIG_NF_CONNTRACK_EVENTS is not set
245# CONFIG_NF_CT_PROTO_DCCP is not set
240CONFIG_NF_CT_PROTO_GRE=m 246CONFIG_NF_CT_PROTO_GRE=m
241CONFIG_NF_CT_PROTO_SCTP=m 247CONFIG_NF_CT_PROTO_SCTP=m
242CONFIG_NF_CT_PROTO_UDPLITE=m 248CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -315,6 +321,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
315CONFIG_IP_NF_TARGET_NETMAP=m 321CONFIG_IP_NF_TARGET_NETMAP=m
316CONFIG_NF_NAT_SNMP_BASIC=m 322CONFIG_NF_NAT_SNMP_BASIC=m
317CONFIG_NF_NAT_PROTO_GRE=m 323CONFIG_NF_NAT_PROTO_GRE=m
324CONFIG_NF_NAT_PROTO_UDPLITE=m
325CONFIG_NF_NAT_PROTO_SCTP=m
318CONFIG_NF_NAT_FTP=m 326CONFIG_NF_NAT_FTP=m
319CONFIG_NF_NAT_IRC=m 327CONFIG_NF_NAT_IRC=m
320CONFIG_NF_NAT_TFTP=m 328CONFIG_NF_NAT_TFTP=m
@@ -408,8 +416,6 @@ CONFIG_IEEE80211=m
408CONFIG_IEEE80211_CRYPT_WEP=m 416CONFIG_IEEE80211_CRYPT_WEP=m
409CONFIG_IEEE80211_CRYPT_CCMP=m 417CONFIG_IEEE80211_CRYPT_CCMP=m
410CONFIG_IEEE80211_CRYPT_TKIP=m 418CONFIG_IEEE80211_CRYPT_TKIP=m
411CONFIG_IEEE80211_SOFTMAC=m
412# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
413# CONFIG_RFKILL is not set 419# CONFIG_RFKILL is not set
414# CONFIG_NET_9P is not set 420# CONFIG_NET_9P is not set
415 421
@@ -430,7 +436,6 @@ CONFIG_CONNECTOR=m
430# CONFIG_PARPORT is not set 436# CONFIG_PARPORT is not set
431# CONFIG_PNP is not set 437# CONFIG_PNP is not set
432CONFIG_BLK_DEV=y 438CONFIG_BLK_DEV=y
433# CONFIG_BLK_DEV_FD is not set
434# CONFIG_BLK_DEV_COW_COMMON is not set 439# CONFIG_BLK_DEV_COW_COMMON is not set
435CONFIG_BLK_DEV_LOOP=y 440CONFIG_BLK_DEV_LOOP=y
436CONFIG_BLK_DEV_CRYPTOLOOP=m 441CONFIG_BLK_DEV_CRYPTOLOOP=m
@@ -467,25 +472,10 @@ CONFIG_IDE_PROC_FS=y
467# 472#
468# IDE chipset support/bugfixes 473# IDE chipset support/bugfixes
469# 474#
470# CONFIG_IDE_GENERIC is not set
471# CONFIG_BLK_DEV_PLATFORM is not set 475# CONFIG_BLK_DEV_PLATFORM is not set
472CONFIG_BLK_DEV_Q40IDE=y 476CONFIG_BLK_DEV_Q40IDE=y
473
474#
475# Other IDE chipsets support
476#
477
478#
479# Note: most of these also require special kernel boot parameters
480#
481# CONFIG_BLK_DEV_4DRIVES is not set
482# CONFIG_BLK_DEV_ALI14XX is not set
483# CONFIG_BLK_DEV_DTC2278 is not set
484# CONFIG_BLK_DEV_HT6560B is not set
485# CONFIG_BLK_DEV_QD65XX is not set
486# CONFIG_BLK_DEV_UMC8672 is not set
487# CONFIG_BLK_DEV_IDEDMA is not set 477# CONFIG_BLK_DEV_IDEDMA is not set
488# CONFIG_IDE_ARCH_OBSOLETE_INIT is not set 478# CONFIG_BLK_DEV_HD_ONLY is not set
489# CONFIG_BLK_DEV_HD is not set 479# CONFIG_BLK_DEV_HD is not set
490 480
491# 481#
@@ -603,6 +593,7 @@ CONFIG_NE2000=m
603# 593#
604# CONFIG_WLAN_PRE80211 is not set 594# CONFIG_WLAN_PRE80211 is not set
605# CONFIG_WLAN_80211 is not set 595# CONFIG_WLAN_80211 is not set
596# CONFIG_IWLWIFI_LEDS is not set
606# CONFIG_WAN is not set 597# CONFIG_WAN is not set
607CONFIG_PPP=m 598CONFIG_PPP=m
608# CONFIG_PPP_MULTILINK is not set 599# CONFIG_PPP_MULTILINK is not set
@@ -692,6 +683,7 @@ CONFIG_VT=y
692CONFIG_VT_CONSOLE=y 683CONFIG_VT_CONSOLE=y
693CONFIG_HW_CONSOLE=y 684CONFIG_HW_CONSOLE=y
694CONFIG_VT_HW_CONSOLE_BINDING=y 685CONFIG_VT_HW_CONSOLE_BINDING=y
686# CONFIG_DEVKMEM is not set
695# CONFIG_SERIAL_NONSTANDARD is not set 687# CONFIG_SERIAL_NONSTANDARD is not set
696 688
697# 689#
@@ -714,12 +706,7 @@ CONFIG_GEN_RTC_X=y
714# CONFIG_RAW_DRIVER is not set 706# CONFIG_RAW_DRIVER is not set
715# CONFIG_TCG_TPM is not set 707# CONFIG_TCG_TPM is not set
716# CONFIG_I2C is not set 708# CONFIG_I2C is not set
717
718#
719# SPI support
720#
721# CONFIG_SPI is not set 709# CONFIG_SPI is not set
722# CONFIG_SPI_MASTER is not set
723# CONFIG_W1 is not set 710# CONFIG_W1 is not set
724# CONFIG_POWER_SUPPLY is not set 711# CONFIG_POWER_SUPPLY is not set
725# CONFIG_HWMON is not set 712# CONFIG_HWMON is not set
@@ -736,12 +723,22 @@ CONFIG_SSB_POSSIBLE=y
736# Multifunction device drivers 723# Multifunction device drivers
737# 724#
738# CONFIG_MFD_SM501 is not set 725# CONFIG_MFD_SM501 is not set
726# CONFIG_HTC_PASIC3 is not set
739 727
740# 728#
741# Multimedia devices 729# Multimedia devices
742# 730#
731
732#
733# Multimedia core support
734#
743# CONFIG_VIDEO_DEV is not set 735# CONFIG_VIDEO_DEV is not set
744# CONFIG_DVB_CORE is not set 736# CONFIG_DVB_CORE is not set
737# CONFIG_VIDEO_MEDIA is not set
738
739#
740# Multimedia drivers
741#
745# CONFIG_DAB is not set 742# CONFIG_DAB is not set
746 743
747# 744#
@@ -759,8 +756,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
759# CONFIG_FB_SYS_FILLRECT is not set 756# CONFIG_FB_SYS_FILLRECT is not set
760# CONFIG_FB_SYS_COPYAREA is not set 757# CONFIG_FB_SYS_COPYAREA is not set
761# CONFIG_FB_SYS_IMAGEBLIT is not set 758# CONFIG_FB_SYS_IMAGEBLIT is not set
759# CONFIG_FB_FOREIGN_ENDIAN is not set
762# CONFIG_FB_SYS_FOPS is not set 760# CONFIG_FB_SYS_FOPS is not set
763CONFIG_FB_DEFERRED_IO=y
764# CONFIG_FB_SVGALIB is not set 761# CONFIG_FB_SVGALIB is not set
765# CONFIG_FB_MACMODES is not set 762# CONFIG_FB_MACMODES is not set
766# CONFIG_FB_BACKLIGHT is not set 763# CONFIG_FB_BACKLIGHT is not set
@@ -810,11 +807,8 @@ CONFIG_HIDRAW=y
810# CONFIG_MMC is not set 807# CONFIG_MMC is not set
811# CONFIG_MEMSTICK is not set 808# CONFIG_MEMSTICK is not set
812# CONFIG_NEW_LEDS is not set 809# CONFIG_NEW_LEDS is not set
810# CONFIG_ACCESSIBILITY is not set
813# CONFIG_RTC_CLASS is not set 811# CONFIG_RTC_CLASS is not set
814
815#
816# Userspace I/O
817#
818# CONFIG_UIO is not set 812# CONFIG_UIO is not set
819 813
820# 814#
@@ -840,16 +834,15 @@ CONFIG_JFS_FS=m
840# CONFIG_JFS_SECURITY is not set 834# CONFIG_JFS_SECURITY is not set
841# CONFIG_JFS_DEBUG is not set 835# CONFIG_JFS_DEBUG is not set
842# CONFIG_JFS_STATISTICS is not set 836# CONFIG_JFS_STATISTICS is not set
843CONFIG_FS_POSIX_ACL=y 837# CONFIG_FS_POSIX_ACL is not set
844CONFIG_XFS_FS=m 838CONFIG_XFS_FS=m
845# CONFIG_XFS_QUOTA is not set 839# CONFIG_XFS_QUOTA is not set
846# CONFIG_XFS_SECURITY is not set
847# CONFIG_XFS_POSIX_ACL is not set 840# CONFIG_XFS_POSIX_ACL is not set
848# CONFIG_XFS_RT is not set 841# CONFIG_XFS_RT is not set
849CONFIG_GFS2_FS=m 842# CONFIG_XFS_DEBUG is not set
850CONFIG_GFS2_FS_LOCKING_NOLOCK=m
851CONFIG_GFS2_FS_LOCKING_DLM=m
852CONFIG_OCFS2_FS=m 843CONFIG_OCFS2_FS=m
844CONFIG_OCFS2_FS_O2CB=m
845CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
853# CONFIG_OCFS2_DEBUG_MASKLOG is not set 846# CONFIG_OCFS2_DEBUG_MASKLOG is not set
854# CONFIG_OCFS2_DEBUG_FS is not set 847# CONFIG_OCFS2_DEBUG_FS is not set
855CONFIG_DNOTIFY=y 848CONFIG_DNOTIFY=y
@@ -921,12 +914,10 @@ CONFIG_NFS_FS=y
921CONFIG_NFS_V3=y 914CONFIG_NFS_V3=y
922# CONFIG_NFS_V3_ACL is not set 915# CONFIG_NFS_V3_ACL is not set
923CONFIG_NFS_V4=y 916CONFIG_NFS_V4=y
924# CONFIG_NFS_DIRECTIO is not set
925CONFIG_NFSD=m 917CONFIG_NFSD=m
926CONFIG_NFSD_V3=y 918CONFIG_NFSD_V3=y
927# CONFIG_NFSD_V3_ACL is not set 919# CONFIG_NFSD_V3_ACL is not set
928# CONFIG_NFSD_V4 is not set 920# CONFIG_NFSD_V4 is not set
929CONFIG_NFSD_TCP=y
930CONFIG_LOCKD=y 921CONFIG_LOCKD=y
931CONFIG_LOCKD_V4=y 922CONFIG_LOCKD_V4=y
932CONFIG_EXPORTFS=m 923CONFIG_EXPORTFS=m
@@ -999,6 +990,7 @@ CONFIG_DLM=m
999# CONFIG_PRINTK_TIME is not set 990# CONFIG_PRINTK_TIME is not set
1000CONFIG_ENABLE_WARN_DEPRECATED=y 991CONFIG_ENABLE_WARN_DEPRECATED=y
1001CONFIG_ENABLE_MUST_CHECK=y 992CONFIG_ENABLE_MUST_CHECK=y
993CONFIG_FRAME_WARN=1024
1002CONFIG_MAGIC_SYSRQ=y 994CONFIG_MAGIC_SYSRQ=y
1003# CONFIG_UNUSED_SYMBOLS is not set 995# CONFIG_UNUSED_SYMBOLS is not set
1004# CONFIG_DEBUG_FS is not set 996# CONFIG_DEBUG_FS is not set
@@ -1018,53 +1010,82 @@ CONFIG_ASYNC_CORE=m
1018CONFIG_ASYNC_MEMCPY=m 1010CONFIG_ASYNC_MEMCPY=m
1019CONFIG_ASYNC_XOR=m 1011CONFIG_ASYNC_XOR=m
1020CONFIG_CRYPTO=y 1012CONFIG_CRYPTO=y
1013
1014#
1015# Crypto core or helper
1016#
1021CONFIG_CRYPTO_ALGAPI=y 1017CONFIG_CRYPTO_ALGAPI=y
1022CONFIG_CRYPTO_AEAD=m 1018CONFIG_CRYPTO_AEAD=m
1023CONFIG_CRYPTO_BLKCIPHER=y 1019CONFIG_CRYPTO_BLKCIPHER=y
1024CONFIG_CRYPTO_SEQIV=m
1025CONFIG_CRYPTO_HASH=y 1020CONFIG_CRYPTO_HASH=y
1026CONFIG_CRYPTO_MANAGER=y 1021CONFIG_CRYPTO_MANAGER=y
1022CONFIG_CRYPTO_GF128MUL=m
1023CONFIG_CRYPTO_NULL=m
1024CONFIG_CRYPTO_CRYPTD=m
1025CONFIG_CRYPTO_AUTHENC=m
1026CONFIG_CRYPTO_TEST=m
1027
1028#
1029# Authenticated Encryption with Associated Data
1030#
1031CONFIG_CRYPTO_CCM=m
1032CONFIG_CRYPTO_GCM=m
1033CONFIG_CRYPTO_SEQIV=m
1034
1035#
1036# Block modes
1037#
1038CONFIG_CRYPTO_CBC=y
1039CONFIG_CRYPTO_CTR=m
1040CONFIG_CRYPTO_CTS=m
1041CONFIG_CRYPTO_ECB=m
1042CONFIG_CRYPTO_LRW=m
1043CONFIG_CRYPTO_PCBC=m
1044CONFIG_CRYPTO_XTS=m
1045
1046#
1047# Hash modes
1048#
1027CONFIG_CRYPTO_HMAC=y 1049CONFIG_CRYPTO_HMAC=y
1028CONFIG_CRYPTO_XCBC=m 1050CONFIG_CRYPTO_XCBC=m
1029CONFIG_CRYPTO_NULL=m 1051
1052#
1053# Digest
1054#
1055CONFIG_CRYPTO_CRC32C=m
1030CONFIG_CRYPTO_MD4=m 1056CONFIG_CRYPTO_MD4=m
1031CONFIG_CRYPTO_MD5=y 1057CONFIG_CRYPTO_MD5=y
1058CONFIG_CRYPTO_MICHAEL_MIC=m
1032CONFIG_CRYPTO_SHA1=m 1059CONFIG_CRYPTO_SHA1=m
1033CONFIG_CRYPTO_SHA256=m 1060CONFIG_CRYPTO_SHA256=m
1034CONFIG_CRYPTO_SHA512=m 1061CONFIG_CRYPTO_SHA512=m
1035CONFIG_CRYPTO_WP512=m
1036CONFIG_CRYPTO_TGR192=m 1062CONFIG_CRYPTO_TGR192=m
1037CONFIG_CRYPTO_GF128MUL=m 1063CONFIG_CRYPTO_WP512=m
1038CONFIG_CRYPTO_ECB=m 1064
1039CONFIG_CRYPTO_CBC=y 1065#
1040CONFIG_CRYPTO_PCBC=m 1066# Ciphers
1041CONFIG_CRYPTO_LRW=m 1067#
1042CONFIG_CRYPTO_XTS=m
1043CONFIG_CRYPTO_CTR=m
1044CONFIG_CRYPTO_GCM=m
1045CONFIG_CRYPTO_CCM=m
1046CONFIG_CRYPTO_CRYPTD=m
1047CONFIG_CRYPTO_DES=y
1048CONFIG_CRYPTO_FCRYPT=m
1049CONFIG_CRYPTO_BLOWFISH=m
1050CONFIG_CRYPTO_TWOFISH=m
1051CONFIG_CRYPTO_TWOFISH_COMMON=m
1052CONFIG_CRYPTO_SERPENT=m
1053CONFIG_CRYPTO_AES=m 1068CONFIG_CRYPTO_AES=m
1069CONFIG_CRYPTO_ANUBIS=m
1070CONFIG_CRYPTO_ARC4=m
1071CONFIG_CRYPTO_BLOWFISH=m
1072CONFIG_CRYPTO_CAMELLIA=m
1054CONFIG_CRYPTO_CAST5=m 1073CONFIG_CRYPTO_CAST5=m
1055CONFIG_CRYPTO_CAST6=m 1074CONFIG_CRYPTO_CAST6=m
1056CONFIG_CRYPTO_TEA=m 1075CONFIG_CRYPTO_DES=y
1057CONFIG_CRYPTO_ARC4=m 1076CONFIG_CRYPTO_FCRYPT=m
1058CONFIG_CRYPTO_KHAZAD=m 1077CONFIG_CRYPTO_KHAZAD=m
1059CONFIG_CRYPTO_ANUBIS=m
1060CONFIG_CRYPTO_SEED=m
1061CONFIG_CRYPTO_SALSA20=m 1078CONFIG_CRYPTO_SALSA20=m
1079CONFIG_CRYPTO_SEED=m
1080CONFIG_CRYPTO_SERPENT=m
1081CONFIG_CRYPTO_TEA=m
1082CONFIG_CRYPTO_TWOFISH=m
1083CONFIG_CRYPTO_TWOFISH_COMMON=m
1084
1085#
1086# Compression
1087#
1062CONFIG_CRYPTO_DEFLATE=m 1088CONFIG_CRYPTO_DEFLATE=m
1063CONFIG_CRYPTO_MICHAEL_MIC=m
1064CONFIG_CRYPTO_CRC32C=m
1065CONFIG_CRYPTO_CAMELLIA=m
1066CONFIG_CRYPTO_TEST=m
1067CONFIG_CRYPTO_AUTHENC=m
1068CONFIG_CRYPTO_LZO=m 1089CONFIG_CRYPTO_LZO=m
1069# CONFIG_CRYPTO_HW is not set 1090# CONFIG_CRYPTO_HW is not set
1070 1091
@@ -1072,9 +1093,11 @@ CONFIG_CRYPTO_LZO=m
1072# Library routines 1093# Library routines
1073# 1094#
1074CONFIG_BITREVERSE=y 1095CONFIG_BITREVERSE=y
1096# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1097# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1075CONFIG_CRC_CCITT=m 1098CONFIG_CRC_CCITT=m
1076CONFIG_CRC16=m 1099CONFIG_CRC16=m
1077# CONFIG_CRC_ITU_T is not set 1100CONFIG_CRC_ITU_T=m
1078CONFIG_CRC32=y 1101CONFIG_CRC32=y
1079# CONFIG_CRC7 is not set 1102# CONFIG_CRC7 is not set
1080CONFIG_LIBCRC32C=m 1103CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig
index bd2b9c4927c4..296340d2b315 100644
--- a/arch/m68k/configs/sun3_defconfig
+++ b/arch/m68k/configs/sun3_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:22 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -130,6 +133,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
130CONFIG_NEED_MULTIPLE_NODES=y 133CONFIG_NEED_MULTIPLE_NODES=y
131# CONFIG_SPARSEMEM_STATIC is not set 134# CONFIG_SPARSEMEM_STATIC is not set
132# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 135# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
136CONFIG_PAGEFLAGS_EXTENDED=y
133CONFIG_SPLIT_PTLOCK_CPUS=4 137CONFIG_SPLIT_PTLOCK_CPUS=4
134# CONFIG_RESOURCES_64BIT is not set 138# CONFIG_RESOURCES_64BIT is not set
135CONFIG_ZONE_DMA_FLAG=1 139CONFIG_ZONE_DMA_FLAG=1
@@ -208,8 +212,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
208CONFIG_INET6_XFRM_MODE_BEET=m 212CONFIG_INET6_XFRM_MODE_BEET=m
209CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 213CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
210CONFIG_IPV6_SIT=m 214CONFIG_IPV6_SIT=m
215CONFIG_IPV6_NDISC_NODETYPE=y
211CONFIG_IPV6_TUNNEL=m 216CONFIG_IPV6_TUNNEL=m
212# CONFIG_IPV6_MULTIPLE_TABLES is not set 217# CONFIG_IPV6_MULTIPLE_TABLES is not set
218# CONFIG_IPV6_MROUTE is not set
213# CONFIG_NETWORK_SECMARK is not set 219# CONFIG_NETWORK_SECMARK is not set
214CONFIG_NETFILTER=y 220CONFIG_NETFILTER=y
215# CONFIG_NETFILTER_DEBUG is not set 221# CONFIG_NETFILTER_DEBUG is not set
@@ -225,6 +231,7 @@ CONFIG_NF_CONNTRACK=m
225CONFIG_NF_CT_ACCT=y 231CONFIG_NF_CT_ACCT=y
226CONFIG_NF_CONNTRACK_MARK=y 232CONFIG_NF_CONNTRACK_MARK=y
227# CONFIG_NF_CONNTRACK_EVENTS is not set 233# CONFIG_NF_CONNTRACK_EVENTS is not set
234# CONFIG_NF_CT_PROTO_DCCP is not set
228CONFIG_NF_CT_PROTO_GRE=m 235CONFIG_NF_CT_PROTO_GRE=m
229CONFIG_NF_CT_PROTO_SCTP=m 236CONFIG_NF_CT_PROTO_SCTP=m
230CONFIG_NF_CT_PROTO_UDPLITE=m 237CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -303,6 +310,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
303CONFIG_IP_NF_TARGET_NETMAP=m 310CONFIG_IP_NF_TARGET_NETMAP=m
304CONFIG_NF_NAT_SNMP_BASIC=m 311CONFIG_NF_NAT_SNMP_BASIC=m
305CONFIG_NF_NAT_PROTO_GRE=m 312CONFIG_NF_NAT_PROTO_GRE=m
313CONFIG_NF_NAT_PROTO_UDPLITE=m
314CONFIG_NF_NAT_PROTO_SCTP=m
306CONFIG_NF_NAT_FTP=m 315CONFIG_NF_NAT_FTP=m
307CONFIG_NF_NAT_IRC=m 316CONFIG_NF_NAT_IRC=m
308CONFIG_NF_NAT_TFTP=m 317CONFIG_NF_NAT_TFTP=m
@@ -396,8 +405,6 @@ CONFIG_IEEE80211=m
396CONFIG_IEEE80211_CRYPT_WEP=m 405CONFIG_IEEE80211_CRYPT_WEP=m
397CONFIG_IEEE80211_CRYPT_CCMP=m 406CONFIG_IEEE80211_CRYPT_CCMP=m
398CONFIG_IEEE80211_CRYPT_TKIP=m 407CONFIG_IEEE80211_CRYPT_TKIP=m
399CONFIG_IEEE80211_SOFTMAC=m
400# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
401# CONFIG_RFKILL is not set 408# CONFIG_RFKILL is not set
402# CONFIG_NET_9P is not set 409# CONFIG_NET_9P is not set
403 410
@@ -529,6 +536,7 @@ CONFIG_SUN3_82586=y
529# 536#
530# CONFIG_WLAN_PRE80211 is not set 537# CONFIG_WLAN_PRE80211 is not set
531# CONFIG_WLAN_80211 is not set 538# CONFIG_WLAN_80211 is not set
539# CONFIG_IWLWIFI_LEDS is not set
532# CONFIG_WAN is not set 540# CONFIG_WAN is not set
533CONFIG_PPP=m 541CONFIG_PPP=m
534# CONFIG_PPP_MULTILINK is not set 542# CONFIG_PPP_MULTILINK is not set
@@ -612,6 +620,7 @@ CONFIG_VT=y
612CONFIG_VT_CONSOLE=y 620CONFIG_VT_CONSOLE=y
613CONFIG_HW_CONSOLE=y 621CONFIG_HW_CONSOLE=y
614CONFIG_VT_HW_CONSOLE_BINDING=y 622CONFIG_VT_HW_CONSOLE_BINDING=y
623# CONFIG_DEVKMEM is not set
615# CONFIG_SERIAL_NONSTANDARD is not set 624# CONFIG_SERIAL_NONSTANDARD is not set
616 625
617# 626#
@@ -633,12 +642,7 @@ CONFIG_GEN_RTC_X=y
633# CONFIG_RAW_DRIVER is not set 642# CONFIG_RAW_DRIVER is not set
634# CONFIG_TCG_TPM is not set 643# CONFIG_TCG_TPM is not set
635# CONFIG_I2C is not set 644# CONFIG_I2C is not set
636
637#
638# SPI support
639#
640# CONFIG_SPI is not set 645# CONFIG_SPI is not set
641# CONFIG_SPI_MASTER is not set
642# CONFIG_W1 is not set 646# CONFIG_W1 is not set
643# CONFIG_POWER_SUPPLY is not set 647# CONFIG_POWER_SUPPLY is not set
644# CONFIG_HWMON is not set 648# CONFIG_HWMON is not set
@@ -655,12 +659,22 @@ CONFIG_SSB_POSSIBLE=y
655# Multifunction device drivers 659# Multifunction device drivers
656# 660#
657# CONFIG_MFD_SM501 is not set 661# CONFIG_MFD_SM501 is not set
662# CONFIG_HTC_PASIC3 is not set
658 663
659# 664#
660# Multimedia devices 665# Multimedia devices
661# 666#
667
668#
669# Multimedia core support
670#
662# CONFIG_VIDEO_DEV is not set 671# CONFIG_VIDEO_DEV is not set
663# CONFIG_DVB_CORE is not set 672# CONFIG_DVB_CORE is not set
673# CONFIG_VIDEO_MEDIA is not set
674
675#
676# Multimedia drivers
677#
664# CONFIG_DAB is not set 678# CONFIG_DAB is not set
665 679
666# 680#
@@ -678,8 +692,8 @@ CONFIG_FB=y
678# CONFIG_FB_SYS_FILLRECT is not set 692# CONFIG_FB_SYS_FILLRECT is not set
679# CONFIG_FB_SYS_COPYAREA is not set 693# CONFIG_FB_SYS_COPYAREA is not set
680# CONFIG_FB_SYS_IMAGEBLIT is not set 694# CONFIG_FB_SYS_IMAGEBLIT is not set
695# CONFIG_FB_FOREIGN_ENDIAN is not set
681# CONFIG_FB_SYS_FOPS is not set 696# CONFIG_FB_SYS_FOPS is not set
682CONFIG_FB_DEFERRED_IO=y
683# CONFIG_FB_SVGALIB is not set 697# CONFIG_FB_SVGALIB is not set
684# CONFIG_FB_MACMODES is not set 698# CONFIG_FB_MACMODES is not set
685# CONFIG_FB_BACKLIGHT is not set 699# CONFIG_FB_BACKLIGHT is not set
@@ -726,11 +740,8 @@ CONFIG_HIDRAW=y
726# CONFIG_MMC is not set 740# CONFIG_MMC is not set
727# CONFIG_MEMSTICK is not set 741# CONFIG_MEMSTICK is not set
728# CONFIG_NEW_LEDS is not set 742# CONFIG_NEW_LEDS is not set
743# CONFIG_ACCESSIBILITY is not set
729# CONFIG_RTC_CLASS is not set 744# CONFIG_RTC_CLASS is not set
730
731#
732# Userspace I/O
733#
734# CONFIG_UIO is not set 745# CONFIG_UIO is not set
735 746
736# 747#
@@ -756,16 +767,15 @@ CONFIG_JFS_FS=m
756# CONFIG_JFS_SECURITY is not set 767# CONFIG_JFS_SECURITY is not set
757# CONFIG_JFS_DEBUG is not set 768# CONFIG_JFS_DEBUG is not set
758# CONFIG_JFS_STATISTICS is not set 769# CONFIG_JFS_STATISTICS is not set
759CONFIG_FS_POSIX_ACL=y 770# CONFIG_FS_POSIX_ACL is not set
760CONFIG_XFS_FS=m 771CONFIG_XFS_FS=m
761# CONFIG_XFS_QUOTA is not set 772# CONFIG_XFS_QUOTA is not set
762# CONFIG_XFS_SECURITY is not set
763# CONFIG_XFS_POSIX_ACL is not set 773# CONFIG_XFS_POSIX_ACL is not set
764# CONFIG_XFS_RT is not set 774# CONFIG_XFS_RT is not set
765CONFIG_GFS2_FS=m 775# CONFIG_XFS_DEBUG is not set
766CONFIG_GFS2_FS_LOCKING_NOLOCK=m
767CONFIG_GFS2_FS_LOCKING_DLM=m
768CONFIG_OCFS2_FS=m 776CONFIG_OCFS2_FS=m
777CONFIG_OCFS2_FS_O2CB=m
778CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
769# CONFIG_OCFS2_DEBUG_MASKLOG is not set 779# CONFIG_OCFS2_DEBUG_MASKLOG is not set
770# CONFIG_OCFS2_DEBUG_FS is not set 780# CONFIG_OCFS2_DEBUG_FS is not set
771CONFIG_DNOTIFY=y 781CONFIG_DNOTIFY=y
@@ -837,12 +847,10 @@ CONFIG_NFS_FS=y
837CONFIG_NFS_V3=y 847CONFIG_NFS_V3=y
838# CONFIG_NFS_V3_ACL is not set 848# CONFIG_NFS_V3_ACL is not set
839CONFIG_NFS_V4=y 849CONFIG_NFS_V4=y
840# CONFIG_NFS_DIRECTIO is not set
841CONFIG_NFSD=m 850CONFIG_NFSD=m
842CONFIG_NFSD_V3=y 851CONFIG_NFSD_V3=y
843# CONFIG_NFSD_V3_ACL is not set 852# CONFIG_NFSD_V3_ACL is not set
844# CONFIG_NFSD_V4 is not set 853# CONFIG_NFSD_V4 is not set
845CONFIG_NFSD_TCP=y
846CONFIG_ROOT_NFS=y 854CONFIG_ROOT_NFS=y
847CONFIG_LOCKD=y 855CONFIG_LOCKD=y
848CONFIG_LOCKD_V4=y 856CONFIG_LOCKD_V4=y
@@ -917,6 +925,7 @@ CONFIG_DLM=m
917# CONFIG_PRINTK_TIME is not set 925# CONFIG_PRINTK_TIME is not set
918CONFIG_ENABLE_WARN_DEPRECATED=y 926CONFIG_ENABLE_WARN_DEPRECATED=y
919CONFIG_ENABLE_MUST_CHECK=y 927CONFIG_ENABLE_MUST_CHECK=y
928CONFIG_FRAME_WARN=1024
920CONFIG_MAGIC_SYSRQ=y 929CONFIG_MAGIC_SYSRQ=y
921# CONFIG_UNUSED_SYMBOLS is not set 930# CONFIG_UNUSED_SYMBOLS is not set
922# CONFIG_DEBUG_FS is not set 931# CONFIG_DEBUG_FS is not set
@@ -936,53 +945,82 @@ CONFIG_ASYNC_CORE=m
936CONFIG_ASYNC_MEMCPY=m 945CONFIG_ASYNC_MEMCPY=m
937CONFIG_ASYNC_XOR=m 946CONFIG_ASYNC_XOR=m
938CONFIG_CRYPTO=y 947CONFIG_CRYPTO=y
948
949#
950# Crypto core or helper
951#
939CONFIG_CRYPTO_ALGAPI=y 952CONFIG_CRYPTO_ALGAPI=y
940CONFIG_CRYPTO_AEAD=m 953CONFIG_CRYPTO_AEAD=m
941CONFIG_CRYPTO_BLKCIPHER=y 954CONFIG_CRYPTO_BLKCIPHER=y
942CONFIG_CRYPTO_SEQIV=m
943CONFIG_CRYPTO_HASH=y 955CONFIG_CRYPTO_HASH=y
944CONFIG_CRYPTO_MANAGER=y 956CONFIG_CRYPTO_MANAGER=y
957CONFIG_CRYPTO_GF128MUL=m
958CONFIG_CRYPTO_NULL=m
959CONFIG_CRYPTO_CRYPTD=m
960CONFIG_CRYPTO_AUTHENC=m
961CONFIG_CRYPTO_TEST=m
962
963#
964# Authenticated Encryption with Associated Data
965#
966CONFIG_CRYPTO_CCM=m
967CONFIG_CRYPTO_GCM=m
968CONFIG_CRYPTO_SEQIV=m
969
970#
971# Block modes
972#
973CONFIG_CRYPTO_CBC=y
974CONFIG_CRYPTO_CTR=m
975CONFIG_CRYPTO_CTS=m
976CONFIG_CRYPTO_ECB=m
977CONFIG_CRYPTO_LRW=m
978CONFIG_CRYPTO_PCBC=m
979CONFIG_CRYPTO_XTS=m
980
981#
982# Hash modes
983#
945CONFIG_CRYPTO_HMAC=y 984CONFIG_CRYPTO_HMAC=y
946CONFIG_CRYPTO_XCBC=m 985CONFIG_CRYPTO_XCBC=m
947CONFIG_CRYPTO_NULL=m 986
987#
988# Digest
989#
990CONFIG_CRYPTO_CRC32C=m
948CONFIG_CRYPTO_MD4=m 991CONFIG_CRYPTO_MD4=m
949CONFIG_CRYPTO_MD5=y 992CONFIG_CRYPTO_MD5=y
993CONFIG_CRYPTO_MICHAEL_MIC=m
950CONFIG_CRYPTO_SHA1=m 994CONFIG_CRYPTO_SHA1=m
951CONFIG_CRYPTO_SHA256=m 995CONFIG_CRYPTO_SHA256=m
952CONFIG_CRYPTO_SHA512=m 996CONFIG_CRYPTO_SHA512=m
953CONFIG_CRYPTO_WP512=m
954CONFIG_CRYPTO_TGR192=m 997CONFIG_CRYPTO_TGR192=m
955CONFIG_CRYPTO_GF128MUL=m 998CONFIG_CRYPTO_WP512=m
956CONFIG_CRYPTO_ECB=m 999
957CONFIG_CRYPTO_CBC=y 1000#
958CONFIG_CRYPTO_PCBC=m 1001# Ciphers
959CONFIG_CRYPTO_LRW=m 1002#
960CONFIG_CRYPTO_XTS=m
961CONFIG_CRYPTO_CTR=m
962CONFIG_CRYPTO_GCM=m
963CONFIG_CRYPTO_CCM=m
964CONFIG_CRYPTO_CRYPTD=m
965CONFIG_CRYPTO_DES=y
966CONFIG_CRYPTO_FCRYPT=m
967CONFIG_CRYPTO_BLOWFISH=m
968CONFIG_CRYPTO_TWOFISH=m
969CONFIG_CRYPTO_TWOFISH_COMMON=m
970CONFIG_CRYPTO_SERPENT=m
971CONFIG_CRYPTO_AES=m 1003CONFIG_CRYPTO_AES=m
1004CONFIG_CRYPTO_ANUBIS=m
1005CONFIG_CRYPTO_ARC4=m
1006CONFIG_CRYPTO_BLOWFISH=m
1007CONFIG_CRYPTO_CAMELLIA=m
972CONFIG_CRYPTO_CAST5=m 1008CONFIG_CRYPTO_CAST5=m
973CONFIG_CRYPTO_CAST6=m 1009CONFIG_CRYPTO_CAST6=m
974CONFIG_CRYPTO_TEA=m 1010CONFIG_CRYPTO_DES=y
975CONFIG_CRYPTO_ARC4=m 1011CONFIG_CRYPTO_FCRYPT=m
976CONFIG_CRYPTO_KHAZAD=m 1012CONFIG_CRYPTO_KHAZAD=m
977CONFIG_CRYPTO_ANUBIS=m
978CONFIG_CRYPTO_SEED=m
979CONFIG_CRYPTO_SALSA20=m 1013CONFIG_CRYPTO_SALSA20=m
1014CONFIG_CRYPTO_SEED=m
1015CONFIG_CRYPTO_SERPENT=m
1016CONFIG_CRYPTO_TEA=m
1017CONFIG_CRYPTO_TWOFISH=m
1018CONFIG_CRYPTO_TWOFISH_COMMON=m
1019
1020#
1021# Compression
1022#
980CONFIG_CRYPTO_DEFLATE=m 1023CONFIG_CRYPTO_DEFLATE=m
981CONFIG_CRYPTO_MICHAEL_MIC=m
982CONFIG_CRYPTO_CRC32C=m
983CONFIG_CRYPTO_CAMELLIA=m
984CONFIG_CRYPTO_TEST=m
985CONFIG_CRYPTO_AUTHENC=m
986CONFIG_CRYPTO_LZO=m 1024CONFIG_CRYPTO_LZO=m
987# CONFIG_CRYPTO_HW is not set 1025# CONFIG_CRYPTO_HW is not set
988 1026
@@ -990,9 +1028,11 @@ CONFIG_CRYPTO_LZO=m
990# Library routines 1028# Library routines
991# 1029#
992CONFIG_BITREVERSE=y 1030CONFIG_BITREVERSE=y
1031# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1032# CONFIG_GENERIC_FIND_NEXT_BIT is not set
993CONFIG_CRC_CCITT=m 1033CONFIG_CRC_CCITT=m
994CONFIG_CRC16=m 1034CONFIG_CRC16=m
995# CONFIG_CRC_ITU_T is not set 1035CONFIG_CRC_ITU_T=m
996CONFIG_CRC32=y 1036CONFIG_CRC32=y
997# CONFIG_CRC7 is not set 1037# CONFIG_CRC7 is not set
998CONFIG_LIBCRC32C=m 1038CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig
index f18154f1ef1f..8d3a416c92bf 100644
--- a/arch/m68k/configs/sun3x_defconfig
+++ b/arch/m68k/configs/sun3x_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.25-rc8 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 2 20:46:23 2008 4# Wed May 28 22:47:35 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,13 +52,14 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
55CONFIG_KALLSYMS=y 56CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
57CONFIG_HOTPLUG=y 58CONFIG_HOTPLUG=y
58CONFIG_PRINTK=y 59CONFIG_PRINTK=y
59CONFIG_BUG=y 60CONFIG_BUG=y
60CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
61# CONFIG_COMPAT_BRK is not set 62CONFIG_COMPAT_BRK=y
62CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
63CONFIG_FUTEX=y 64CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -76,12 +77,14 @@ CONFIG_SLAB=y
76# CONFIG_HAVE_OPROFILE is not set 77# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_KPROBES is not set 78# CONFIG_HAVE_KPROBES is not set
78# CONFIG_HAVE_KRETPROBES is not set 79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
79CONFIG_PROC_PAGE_MONITOR=y 81CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 82CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 84# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 85CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y 88CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 89# CONFIG_MODULE_FORCE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 90# CONFIG_MODVERSIONS is not set
@@ -141,6 +144,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
141CONFIG_NEED_MULTIPLE_NODES=y 144CONFIG_NEED_MULTIPLE_NODES=y
142# CONFIG_SPARSEMEM_STATIC is not set 145# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 146# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
147CONFIG_PAGEFLAGS_EXTENDED=y
144CONFIG_SPLIT_PTLOCK_CPUS=4 148CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set 149# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=1 150CONFIG_ZONE_DMA_FLAG=1
@@ -219,8 +223,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
219CONFIG_INET6_XFRM_MODE_BEET=m 223CONFIG_INET6_XFRM_MODE_BEET=m
220CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 224CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
221CONFIG_IPV6_SIT=m 225CONFIG_IPV6_SIT=m
226CONFIG_IPV6_NDISC_NODETYPE=y
222CONFIG_IPV6_TUNNEL=m 227CONFIG_IPV6_TUNNEL=m
223# CONFIG_IPV6_MULTIPLE_TABLES is not set 228# CONFIG_IPV6_MULTIPLE_TABLES is not set
229# CONFIG_IPV6_MROUTE is not set
224# CONFIG_NETWORK_SECMARK is not set 230# CONFIG_NETWORK_SECMARK is not set
225CONFIG_NETFILTER=y 231CONFIG_NETFILTER=y
226# CONFIG_NETFILTER_DEBUG is not set 232# CONFIG_NETFILTER_DEBUG is not set
@@ -236,6 +242,7 @@ CONFIG_NF_CONNTRACK=m
236CONFIG_NF_CT_ACCT=y 242CONFIG_NF_CT_ACCT=y
237CONFIG_NF_CONNTRACK_MARK=y 243CONFIG_NF_CONNTRACK_MARK=y
238# CONFIG_NF_CONNTRACK_EVENTS is not set 244# CONFIG_NF_CONNTRACK_EVENTS is not set
245# CONFIG_NF_CT_PROTO_DCCP is not set
239CONFIG_NF_CT_PROTO_GRE=m 246CONFIG_NF_CT_PROTO_GRE=m
240CONFIG_NF_CT_PROTO_SCTP=m 247CONFIG_NF_CT_PROTO_SCTP=m
241CONFIG_NF_CT_PROTO_UDPLITE=m 248CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -314,6 +321,8 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
314CONFIG_IP_NF_TARGET_NETMAP=m 321CONFIG_IP_NF_TARGET_NETMAP=m
315CONFIG_NF_NAT_SNMP_BASIC=m 322CONFIG_NF_NAT_SNMP_BASIC=m
316CONFIG_NF_NAT_PROTO_GRE=m 323CONFIG_NF_NAT_PROTO_GRE=m
324CONFIG_NF_NAT_PROTO_UDPLITE=m
325CONFIG_NF_NAT_PROTO_SCTP=m
317CONFIG_NF_NAT_FTP=m 326CONFIG_NF_NAT_FTP=m
318CONFIG_NF_NAT_IRC=m 327CONFIG_NF_NAT_IRC=m
319CONFIG_NF_NAT_TFTP=m 328CONFIG_NF_NAT_TFTP=m
@@ -407,8 +416,6 @@ CONFIG_IEEE80211=m
407CONFIG_IEEE80211_CRYPT_WEP=m 416CONFIG_IEEE80211_CRYPT_WEP=m
408CONFIG_IEEE80211_CRYPT_CCMP=m 417CONFIG_IEEE80211_CRYPT_CCMP=m
409CONFIG_IEEE80211_CRYPT_TKIP=m 418CONFIG_IEEE80211_CRYPT_TKIP=m
410CONFIG_IEEE80211_SOFTMAC=m
411# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
412# CONFIG_RFKILL is not set 419# CONFIG_RFKILL is not set
413# CONFIG_NET_9P is not set 420# CONFIG_NET_9P is not set
414 421
@@ -539,6 +546,7 @@ CONFIG_SUN3LANCE=y
539# 546#
540# CONFIG_WLAN_PRE80211 is not set 547# CONFIG_WLAN_PRE80211 is not set
541# CONFIG_WLAN_80211 is not set 548# CONFIG_WLAN_80211 is not set
549# CONFIG_IWLWIFI_LEDS is not set
542# CONFIG_WAN is not set 550# CONFIG_WAN is not set
543CONFIG_PPP=m 551CONFIG_PPP=m
544# CONFIG_PPP_MULTILINK is not set 552# CONFIG_PPP_MULTILINK is not set
@@ -622,6 +630,7 @@ CONFIG_VT=y
622CONFIG_VT_CONSOLE=y 630CONFIG_VT_CONSOLE=y
623CONFIG_HW_CONSOLE=y 631CONFIG_HW_CONSOLE=y
624CONFIG_VT_HW_CONSOLE_BINDING=y 632CONFIG_VT_HW_CONSOLE_BINDING=y
633# CONFIG_DEVKMEM is not set
625# CONFIG_SERIAL_NONSTANDARD is not set 634# CONFIG_SERIAL_NONSTANDARD is not set
626 635
627# 636#
@@ -643,12 +652,7 @@ CONFIG_GEN_RTC_X=y
643# CONFIG_RAW_DRIVER is not set 652# CONFIG_RAW_DRIVER is not set
644# CONFIG_TCG_TPM is not set 653# CONFIG_TCG_TPM is not set
645# CONFIG_I2C is not set 654# CONFIG_I2C is not set
646
647#
648# SPI support
649#
650# CONFIG_SPI is not set 655# CONFIG_SPI is not set
651# CONFIG_SPI_MASTER is not set
652# CONFIG_W1 is not set 656# CONFIG_W1 is not set
653# CONFIG_POWER_SUPPLY is not set 657# CONFIG_POWER_SUPPLY is not set
654# CONFIG_HWMON is not set 658# CONFIG_HWMON is not set
@@ -665,12 +669,22 @@ CONFIG_SSB_POSSIBLE=y
665# Multifunction device drivers 669# Multifunction device drivers
666# 670#
667# CONFIG_MFD_SM501 is not set 671# CONFIG_MFD_SM501 is not set
672# CONFIG_HTC_PASIC3 is not set
668 673
669# 674#
670# Multimedia devices 675# Multimedia devices
671# 676#
677
678#
679# Multimedia core support
680#
672# CONFIG_VIDEO_DEV is not set 681# CONFIG_VIDEO_DEV is not set
673# CONFIG_DVB_CORE is not set 682# CONFIG_DVB_CORE is not set
683# CONFIG_VIDEO_MEDIA is not set
684
685#
686# Multimedia drivers
687#
674# CONFIG_DAB is not set 688# CONFIG_DAB is not set
675 689
676# 690#
@@ -688,8 +702,8 @@ CONFIG_FB=y
688# CONFIG_FB_SYS_FILLRECT is not set 702# CONFIG_FB_SYS_FILLRECT is not set
689# CONFIG_FB_SYS_COPYAREA is not set 703# CONFIG_FB_SYS_COPYAREA is not set
690# CONFIG_FB_SYS_IMAGEBLIT is not set 704# CONFIG_FB_SYS_IMAGEBLIT is not set
705# CONFIG_FB_FOREIGN_ENDIAN is not set
691# CONFIG_FB_SYS_FOPS is not set 706# CONFIG_FB_SYS_FOPS is not set
692CONFIG_FB_DEFERRED_IO=y
693# CONFIG_FB_SVGALIB is not set 707# CONFIG_FB_SVGALIB is not set
694# CONFIG_FB_MACMODES is not set 708# CONFIG_FB_MACMODES is not set
695# CONFIG_FB_BACKLIGHT is not set 709# CONFIG_FB_BACKLIGHT is not set
@@ -736,11 +750,8 @@ CONFIG_HIDRAW=y
736# CONFIG_MMC is not set 750# CONFIG_MMC is not set
737# CONFIG_MEMSTICK is not set 751# CONFIG_MEMSTICK is not set
738# CONFIG_NEW_LEDS is not set 752# CONFIG_NEW_LEDS is not set
753# CONFIG_ACCESSIBILITY is not set
739# CONFIG_RTC_CLASS is not set 754# CONFIG_RTC_CLASS is not set
740
741#
742# Userspace I/O
743#
744# CONFIG_UIO is not set 755# CONFIG_UIO is not set
745 756
746# 757#
@@ -766,16 +777,15 @@ CONFIG_JFS_FS=m
766# CONFIG_JFS_SECURITY is not set 777# CONFIG_JFS_SECURITY is not set
767# CONFIG_JFS_DEBUG is not set 778# CONFIG_JFS_DEBUG is not set
768# CONFIG_JFS_STATISTICS is not set 779# CONFIG_JFS_STATISTICS is not set
769CONFIG_FS_POSIX_ACL=y 780# CONFIG_FS_POSIX_ACL is not set
770CONFIG_XFS_FS=m 781CONFIG_XFS_FS=m
771# CONFIG_XFS_QUOTA is not set 782# CONFIG_XFS_QUOTA is not set
772# CONFIG_XFS_SECURITY is not set
773# CONFIG_XFS_POSIX_ACL is not set 783# CONFIG_XFS_POSIX_ACL is not set
774# CONFIG_XFS_RT is not set 784# CONFIG_XFS_RT is not set
775CONFIG_GFS2_FS=m 785# CONFIG_XFS_DEBUG is not set
776CONFIG_GFS2_FS_LOCKING_NOLOCK=m
777CONFIG_GFS2_FS_LOCKING_DLM=m
778CONFIG_OCFS2_FS=m 786CONFIG_OCFS2_FS=m
787CONFIG_OCFS2_FS_O2CB=m
788CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
779# CONFIG_OCFS2_DEBUG_MASKLOG is not set 789# CONFIG_OCFS2_DEBUG_MASKLOG is not set
780# CONFIG_OCFS2_DEBUG_FS is not set 790# CONFIG_OCFS2_DEBUG_FS is not set
781CONFIG_DNOTIFY=y 791CONFIG_DNOTIFY=y
@@ -847,12 +857,10 @@ CONFIG_NFS_FS=y
847CONFIG_NFS_V3=y 857CONFIG_NFS_V3=y
848# CONFIG_NFS_V3_ACL is not set 858# CONFIG_NFS_V3_ACL is not set
849CONFIG_NFS_V4=y 859CONFIG_NFS_V4=y
850# CONFIG_NFS_DIRECTIO is not set
851CONFIG_NFSD=m 860CONFIG_NFSD=m
852CONFIG_NFSD_V3=y 861CONFIG_NFSD_V3=y
853# CONFIG_NFSD_V3_ACL is not set 862# CONFIG_NFSD_V3_ACL is not set
854# CONFIG_NFSD_V4 is not set 863# CONFIG_NFSD_V4 is not set
855CONFIG_NFSD_TCP=y
856CONFIG_ROOT_NFS=y 864CONFIG_ROOT_NFS=y
857CONFIG_LOCKD=y 865CONFIG_LOCKD=y
858CONFIG_LOCKD_V4=y 866CONFIG_LOCKD_V4=y
@@ -927,6 +935,7 @@ CONFIG_DLM=m
927# CONFIG_PRINTK_TIME is not set 935# CONFIG_PRINTK_TIME is not set
928CONFIG_ENABLE_WARN_DEPRECATED=y 936CONFIG_ENABLE_WARN_DEPRECATED=y
929CONFIG_ENABLE_MUST_CHECK=y 937CONFIG_ENABLE_MUST_CHECK=y
938CONFIG_FRAME_WARN=1024
930CONFIG_MAGIC_SYSRQ=y 939CONFIG_MAGIC_SYSRQ=y
931# CONFIG_UNUSED_SYMBOLS is not set 940# CONFIG_UNUSED_SYMBOLS is not set
932# CONFIG_DEBUG_FS is not set 941# CONFIG_DEBUG_FS is not set
@@ -946,53 +955,82 @@ CONFIG_ASYNC_CORE=m
946CONFIG_ASYNC_MEMCPY=m 955CONFIG_ASYNC_MEMCPY=m
947CONFIG_ASYNC_XOR=m 956CONFIG_ASYNC_XOR=m
948CONFIG_CRYPTO=y 957CONFIG_CRYPTO=y
958
959#
960# Crypto core or helper
961#
949CONFIG_CRYPTO_ALGAPI=y 962CONFIG_CRYPTO_ALGAPI=y
950CONFIG_CRYPTO_AEAD=m 963CONFIG_CRYPTO_AEAD=m
951CONFIG_CRYPTO_BLKCIPHER=y 964CONFIG_CRYPTO_BLKCIPHER=y
952CONFIG_CRYPTO_SEQIV=m
953CONFIG_CRYPTO_HASH=y 965CONFIG_CRYPTO_HASH=y
954CONFIG_CRYPTO_MANAGER=y 966CONFIG_CRYPTO_MANAGER=y
967CONFIG_CRYPTO_GF128MUL=m
968CONFIG_CRYPTO_NULL=m
969CONFIG_CRYPTO_CRYPTD=m
970CONFIG_CRYPTO_AUTHENC=m
971CONFIG_CRYPTO_TEST=m
972
973#
974# Authenticated Encryption with Associated Data
975#
976CONFIG_CRYPTO_CCM=m
977CONFIG_CRYPTO_GCM=m
978CONFIG_CRYPTO_SEQIV=m
979
980#
981# Block modes
982#
983CONFIG_CRYPTO_CBC=y
984CONFIG_CRYPTO_CTR=m
985CONFIG_CRYPTO_CTS=m
986CONFIG_CRYPTO_ECB=m
987CONFIG_CRYPTO_LRW=m
988CONFIG_CRYPTO_PCBC=m
989CONFIG_CRYPTO_XTS=m
990
991#
992# Hash modes
993#
955CONFIG_CRYPTO_HMAC=y 994CONFIG_CRYPTO_HMAC=y
956CONFIG_CRYPTO_XCBC=m 995CONFIG_CRYPTO_XCBC=m
957CONFIG_CRYPTO_NULL=m 996
997#
998# Digest
999#
1000CONFIG_CRYPTO_CRC32C=m
958CONFIG_CRYPTO_MD4=m 1001CONFIG_CRYPTO_MD4=m
959CONFIG_CRYPTO_MD5=y 1002CONFIG_CRYPTO_MD5=y
1003CONFIG_CRYPTO_MICHAEL_MIC=m
960CONFIG_CRYPTO_SHA1=m 1004CONFIG_CRYPTO_SHA1=m
961CONFIG_CRYPTO_SHA256=m 1005CONFIG_CRYPTO_SHA256=m
962CONFIG_CRYPTO_SHA512=m 1006CONFIG_CRYPTO_SHA512=m
963CONFIG_CRYPTO_WP512=m
964CONFIG_CRYPTO_TGR192=m 1007CONFIG_CRYPTO_TGR192=m
965CONFIG_CRYPTO_GF128MUL=m 1008CONFIG_CRYPTO_WP512=m
966CONFIG_CRYPTO_ECB=m 1009
967CONFIG_CRYPTO_CBC=y 1010#
968CONFIG_CRYPTO_PCBC=m 1011# Ciphers
969CONFIG_CRYPTO_LRW=m 1012#
970CONFIG_CRYPTO_XTS=m
971CONFIG_CRYPTO_CTR=m
972CONFIG_CRYPTO_GCM=m
973CONFIG_CRYPTO_CCM=m
974CONFIG_CRYPTO_CRYPTD=m
975CONFIG_CRYPTO_DES=y
976CONFIG_CRYPTO_FCRYPT=m
977CONFIG_CRYPTO_BLOWFISH=m
978CONFIG_CRYPTO_TWOFISH=m
979CONFIG_CRYPTO_TWOFISH_COMMON=m
980CONFIG_CRYPTO_SERPENT=m
981CONFIG_CRYPTO_AES=m 1013CONFIG_CRYPTO_AES=m
1014CONFIG_CRYPTO_ANUBIS=m
1015CONFIG_CRYPTO_ARC4=m
1016CONFIG_CRYPTO_BLOWFISH=m
1017CONFIG_CRYPTO_CAMELLIA=m
982CONFIG_CRYPTO_CAST5=m 1018CONFIG_CRYPTO_CAST5=m
983CONFIG_CRYPTO_CAST6=m 1019CONFIG_CRYPTO_CAST6=m
984CONFIG_CRYPTO_TEA=m 1020CONFIG_CRYPTO_DES=y
985CONFIG_CRYPTO_ARC4=m 1021CONFIG_CRYPTO_FCRYPT=m
986CONFIG_CRYPTO_KHAZAD=m 1022CONFIG_CRYPTO_KHAZAD=m
987CONFIG_CRYPTO_ANUBIS=m
988CONFIG_CRYPTO_SEED=m
989CONFIG_CRYPTO_SALSA20=m 1023CONFIG_CRYPTO_SALSA20=m
1024CONFIG_CRYPTO_SEED=m
1025CONFIG_CRYPTO_SERPENT=m
1026CONFIG_CRYPTO_TEA=m
1027CONFIG_CRYPTO_TWOFISH=m
1028CONFIG_CRYPTO_TWOFISH_COMMON=m
1029
1030#
1031# Compression
1032#
990CONFIG_CRYPTO_DEFLATE=m 1033CONFIG_CRYPTO_DEFLATE=m
991CONFIG_CRYPTO_MICHAEL_MIC=m
992CONFIG_CRYPTO_CRC32C=m
993CONFIG_CRYPTO_CAMELLIA=m
994CONFIG_CRYPTO_TEST=m
995CONFIG_CRYPTO_AUTHENC=m
996CONFIG_CRYPTO_LZO=m 1034CONFIG_CRYPTO_LZO=m
997# CONFIG_CRYPTO_HW is not set 1035# CONFIG_CRYPTO_HW is not set
998 1036
@@ -1000,9 +1038,11 @@ CONFIG_CRYPTO_LZO=m
1000# Library routines 1038# Library routines
1001# 1039#
1002CONFIG_BITREVERSE=y 1040CONFIG_BITREVERSE=y
1041# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1042# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1003CONFIG_CRC_CCITT=m 1043CONFIG_CRC_CCITT=m
1004CONFIG_CRC16=m 1044CONFIG_CRC16=m
1005# CONFIG_CRC_ITU_T is not set 1045CONFIG_CRC_ITU_T=m
1006CONFIG_CRC32=y 1046CONFIG_CRC32=y
1007# CONFIG_CRC7 is not set 1047# CONFIG_CRC7 is not set
1008CONFIG_LIBCRC32C=m 1048CONFIG_LIBCRC32C=m
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index faa6764f1d13..f513f530de91 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -1434,7 +1434,7 @@ L(mmu_fixup_done):
1434#endif 1434#endif
1435 1435
1436#ifdef CONFIG_HP300 1436#ifdef CONFIG_HP300
1437 is_not_hp300(1f) 1437 is_not_hp300(2f)
1438 /* 1438 /*
1439 * Fix up the iobase register to point to the new location of the LEDs. 1439 * Fix up the iobase register to point to the new location of the LEDs.
1440 */ 1440 */
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 5de4e4ed76ab..7888cdf91f5d 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -41,7 +41,6 @@
41 * setup. 41 * setup.
42 */ 42 */
43static struct fs_struct init_fs = INIT_FS; 43static struct fs_struct init_fs = INIT_FS;
44static struct files_struct init_files = INIT_FILES;
45static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 44static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
46static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 45static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
47struct mm_struct init_mm = INIT_MM(init_mm); 46struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index bba650312fd9..a9fb83a8c180 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -41,11 +41,12 @@
41#endif 41#endif
42 42
43unsigned long m68k_machtype; 43unsigned long m68k_machtype;
44unsigned long m68k_cputype;
45EXPORT_SYMBOL(m68k_machtype); 44EXPORT_SYMBOL(m68k_machtype);
45unsigned long m68k_cputype;
46EXPORT_SYMBOL(m68k_cputype); 46EXPORT_SYMBOL(m68k_cputype);
47unsigned long m68k_fputype; 47unsigned long m68k_fputype;
48unsigned long m68k_mmutype; 48unsigned long m68k_mmutype;
49EXPORT_SYMBOL(m68k_mmutype);
49#ifdef CONFIG_VME 50#ifdef CONFIG_VME
50unsigned long vme_brdtype; 51unsigned long vme_brdtype;
51EXPORT_SYMBOL(vme_brdtype); 52EXPORT_SYMBOL(vme_brdtype);
@@ -345,19 +346,19 @@ void __init setup_arch(char **cmdline_p)
345 346
346/* set ISA defs early as possible */ 347/* set ISA defs early as possible */
347#if defined(CONFIG_ISA) && defined(MULTI_ISA) 348#if defined(CONFIG_ISA) && defined(MULTI_ISA)
348#if defined(CONFIG_Q40)
349 if (MACH_IS_Q40) { 349 if (MACH_IS_Q40) {
350 isa_type = Q40_ISA; 350 isa_type = ISA_TYPE_Q40;
351 isa_sex = 0; 351 isa_sex = 0;
352 } 352 }
353#elif defined(CONFIG_GG2) 353#ifdef CONFIG_GG2
354 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)) { 354 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)) {
355 isa_type = GG2_ISA; 355 isa_type = ISA_TYPE_GG2;
356 isa_sex = 0; 356 isa_sex = 0;
357 } 357 }
358#elif defined(CONFIG_AMIGA_PCMCIA) 358#endif
359#ifdef CONFIG_AMIGA_PCMCIA
359 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) { 360 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
360 isa_type = AG_ISA; 361 isa_type = ISA_TYPE_AG;
361 isa_sex = 1; 362 isa_sex = 1;
362 } 363 }
363#endif 364#endif
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index 891e1347bc4e..4253f870e54f 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -15,6 +15,12 @@ char *strcpy(char *dest, const char *src)
15} 15}
16EXPORT_SYMBOL(strcpy); 16EXPORT_SYMBOL(strcpy);
17 17
18char *strcat(char *dest, const char *src)
19{
20 return __kernel_strcpy(dest + __kernel_strlen(dest), src);
21}
22EXPORT_SYMBOL(strcat);
23
18void *memset(void *s, int c, size_t count) 24void *memset(void *s, int c, size_t count)
19{ 25{
20 void *xs = s; 26 void *xs = s;
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 07eb4c4bab82..8e8441587c22 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -671,6 +671,9 @@ config ROMKERNEL
671 671
672endchoice 672endchoice
673 673
674if COLDFIRE
675source "kernel/Kconfig.preempt"
676endif
674source "mm/Kconfig" 677source "mm/Kconfig"
675 678
676endmenu 679endmenu
diff --git a/arch/m68knommu/kernel/init_task.c b/arch/m68knommu/kernel/init_task.c
index 3897043a126a..344c01aede08 100644
--- a/arch/m68knommu/kernel/init_task.c
+++ b/arch/m68knommu/kernel/init_task.c
@@ -13,7 +13,6 @@
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14 14
15static struct fs_struct init_fs = INIT_FS; 15static struct fs_struct init_fs = INIT_FS;
16static struct files_struct init_files = INIT_FILES;
17static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 16static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
18static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
19struct mm_struct init_mm = INIT_MM(init_mm); 18struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 5592e0bf951f..93e69236ed6f 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -114,6 +114,16 @@ SECTIONS {
114 *(__kcrctab_gpl) 114 *(__kcrctab_gpl)
115 __stop___kcrctab_gpl = .; 115 __stop___kcrctab_gpl = .;
116 116
117 /* Kernel symbol table: Normal unused symbols */
118 __start___kcrctab_unused = .;
119 *(__kcrctab_unused)
120 __stop___kcrctab_unused = .;
121
122 /* Kernel symbol table: GPL-only unused symbols */
123 __start___kcrctab_unused_gpl = .;
124 *(__kcrctab_unused_gpl)
125 __stop___kcrctab_unused_gpl = .;
126
117 /* Kernel symbol table: GPL-future symbols */ 127 /* Kernel symbol table: GPL-future symbols */
118 __start___kcrctab_gpl_future = .; 128 __start___kcrctab_gpl_future = .;
119 *(__kcrctab_gpl_future) 129 *(__kcrctab_gpl_future)
diff --git a/arch/m68knommu/platform/coldfire/timers.c b/arch/m68knommu/platform/coldfire/timers.c
index ba5a9f32ebd4..454f25493491 100644
--- a/arch/m68knommu/platform/coldfire/timers.c
+++ b/arch/m68knommu/platform/coldfire/timers.c
@@ -111,7 +111,13 @@ void hw_timer_init(void)
111 111
112 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 112 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
113 mcftmr_cycles_per_jiffy = FREQ / HZ; 113 mcftmr_cycles_per_jiffy = FREQ / HZ;
114 __raw_writetrr(mcftmr_cycles_per_jiffy, TA(MCFTIMER_TRR)); 114 /*
115 * The coldfire timer runs from 0 to TRR included, then 0
116 * again and so on. It counts thus actually TRR + 1 steps
117 * for 1 tick, not TRR. So if you want n cycles,
118 * initialize TRR with n - 1.
119 */
120 __raw_writetrr(mcftmr_cycles_per_jiffy - 1, TA(MCFTIMER_TRR));
115 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | 121 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
116 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR)); 122 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
117 123
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
index 90e2d7a46e8e..dd0e19dacfcf 100644
--- a/arch/mips/au1000/common/Makefile
+++ b/arch/mips/au1000/common/Makefile
@@ -1,9 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Au1000 CPU, generic files. 5# Makefile for the Alchemy Au1xx0 CPUs, generic files.
7# 6#
8 7
9obj-y += prom.o irq.o puts.o time.o reset.o \ 8obj-y += prom.o irq.o puts.o time.o reset.o \
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
index 37a10a01de9d..c7ca1596394c 100644
--- a/arch/mips/au1000/common/au1xxx_irqmap.c
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -40,20 +40,20 @@
40struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = { 40struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
41 41
42#if defined(CONFIG_SOC_AU1000) 42#if defined(CONFIG_SOC_AU1000)
43 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 43 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
44 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 44 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
45 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0}, 45 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0 },
46 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 46 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
47 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 47 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 },
48 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 48 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 },
49 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 49 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
50 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 50 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
51 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 51 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
52 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 52 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
53 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 53 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
54 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 54 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
55 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 55 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
56 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 56 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -62,32 +62,32 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
65 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 65 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 },
66 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 66 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 },
67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
71 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 71 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
72 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 72 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
74 74
75#elif defined(CONFIG_SOC_AU1500) 75#elif defined(CONFIG_SOC_AU1500)
76 76
77 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 77 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
80 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 80 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
83 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 83 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
84 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 84 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
85 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 85 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
86 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 86 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
87 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 87 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
88 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 88 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
89 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 89 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
90 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 90 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -100,26 +100,26 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
103 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 103 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
104 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 104 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
106 106
107#elif defined(CONFIG_SOC_AU1100) 107#elif defined(CONFIG_SOC_AU1100)
108 108
109 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 109 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
110 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 110 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
111 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 111 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0 },
112 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 112 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
113 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 113 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 },
114 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 114 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 },
115 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 115 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
116 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 116 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
117 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 117 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
118 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 118 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
119 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 119 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
120 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 120 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
121 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 121 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
122 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 122 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -128,33 +128,33 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
131 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 131 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 },
132 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 132 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 },
133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
137 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 137 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
138 /*{ AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0},*/ 138 /* { AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0 }, */
139 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 139 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0 },
140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
141 141
142#elif defined(CONFIG_SOC_AU1550) 142#elif defined(CONFIG_SOC_AU1550)
143 143
144 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 144 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
147 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 147 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 },
148 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0}, 148 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0 },
149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 }, 151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 },
152 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 152 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
153 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 153 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
154 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 154 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 },
155 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 155 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 },
156 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0}, 156 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0 },
157 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0}, 157 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0 },
158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -163,26 +163,26 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
166 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0}, 166 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0 },
167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
170 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 170 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
171 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 171 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
172 172
173#elif defined(CONFIG_SOC_AU1200) 173#elif defined(CONFIG_SOC_AU1200)
174 174
175 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 175 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 }, 176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 },
177 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 177 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0 },
178 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 178 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 },
179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 }, 179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 },
180 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 180 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 }, 181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 },
182 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 182 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 },
183 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 183 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 },
184 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0}, 184 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0 },
185 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0}, 185 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0 },
186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -191,10 +191,10 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
194 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0}, 194 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0 },
195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 }, 195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 },
196 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 196 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0 },
197 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0}, 197 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0 },
198 198
199#else 199#else
200#error "Error: Unknown Alchemy SOC" 200#error "Error: Unknown Alchemy SOC"
@@ -203,4 +203,3 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
203}; 203};
204 204
205int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map); 205int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map);
206
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c
index 3ce6cace0eb0..043429d17c5f 100644
--- a/arch/mips/au1000/common/clocks.c
+++ b/arch/mips/au1000/common/clocks.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Simple Au1000 clocks routines. 3 * Simple Au1xx0 clocks routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -30,8 +29,8 @@
30#include <linux/module.h> 29#include <linux/module.h>
31#include <asm/mach-au1x00/au1000.h> 30#include <asm/mach-au1x00/au1000.h>
32 31
33static unsigned int au1x00_clock; // Hz 32static unsigned int au1x00_clock; /* Hz */
34static unsigned int lcd_clock; // KHz 33static unsigned int lcd_clock; /* KHz */
35static unsigned long uart_baud_base; 34static unsigned long uart_baud_base;
36 35
37/* 36/*
@@ -46,8 +45,7 @@ unsigned int get_au1x00_speed(void)
46{ 45{
47 return au1x00_clock; 46 return au1x00_clock;
48} 47}
49 48EXPORT_SYMBOL(get_au1x00_speed);
50
51 49
52/* 50/*
53 * The UART baud base is not known at compile time ... if 51 * The UART baud base is not known at compile time ... if
@@ -73,24 +71,23 @@ void set_au1x00_uart_baud_base(unsigned long new_baud_base)
73void set_au1x00_lcd_clock(void) 71void set_au1x00_lcd_clock(void)
74{ 72{
75 unsigned int static_cfg0; 73 unsigned int static_cfg0;
76 unsigned int sys_busclk = 74 unsigned int sys_busclk = (get_au1x00_speed() / 1000) /
77 (get_au1x00_speed()/1000) / 75 ((int)(au_readl(SYS_POWERCTRL) & 0x03) + 2);
78 ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2);
79 76
80 static_cfg0 = au_readl(MEM_STCFG0); 77 static_cfg0 = au_readl(MEM_STCFG0);
81 78
82 if (static_cfg0 & (1<<11)) 79 if (static_cfg0 & (1 << 11))
83 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ 80 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */
84 else 81 else
85 lcd_clock = sys_busclk / 4; 82 lcd_clock = sys_busclk / 4;
86 83
87 if (lcd_clock > 50000) /* Epson MAX */ 84 if (lcd_clock > 50000) /* Epson MAX */
88 printk("warning: LCD clock too high (%d KHz)\n", lcd_clock); 85 printk(KERN_WARNING "warning: LCD clock too high (%u KHz)\n",
86 lcd_clock);
89} 87}
90 88
91unsigned int get_au1x00_lcd_clock(void) 89unsigned int get_au1x00_lcd_clock(void)
92{ 90{
93 return lcd_clock; 91 return lcd_clock;
94} 92}
95
96EXPORT_SYMBOL(get_au1x00_lcd_clock); 93EXPORT_SYMBOL(get_au1x00_lcd_clock);
diff --git a/arch/mips/au1000/common/cputable.c b/arch/mips/au1000/common/cputable.c
index 8c93a05d7382..ba6430bc2d03 100644
--- a/arch/mips/au1000/common/cputable.c
+++ b/arch/mips/au1000/common/cputable.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/mach-au1x00/au1000.h> 15#include <asm/mach-au1x00/au1000.h>
16 16
17struct cpu_spec* cur_cpu_spec[NR_CPUS]; 17struct cpu_spec *cur_cpu_spec[NR_CPUS];
18 18
19/* With some thought, we can probably use the mask to reduce the 19/* With some thought, we can probably use the mask to reduce the
20 * size of the table. 20 * size of the table.
@@ -39,8 +39,7 @@ struct cpu_spec cpu_specs[] = {
39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 } 39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 }
40}; 40};
41 41
42void 42void set_cpuspec(void)
43set_cpuspec(void)
44{ 43{
45 struct cpu_spec *sp; 44 struct cpu_spec *sp;
46 u32 prid; 45 u32 prid;
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index 53377dfc0640..601ee9180ee4 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -53,12 +53,11 @@
53 */ 53 */
54static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock); 54static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock);
55 55
56/* I couldn't find a macro that did this...... 56/* I couldn't find a macro that did this... */
57*/
58#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1)) 57#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1))
59 58
60static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE; 59static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE;
61static int dbdma_initialized=0; 60static int dbdma_initialized;
62static void au1xxx_dbdma_init(void); 61static void au1xxx_dbdma_init(void);
63 62
64static dbdev_tab_t dbdev_tab[] = { 63static dbdev_tab_t dbdev_tab[] = {
@@ -149,7 +148,7 @@ static dbdev_tab_t dbdev_tab[] = {
149 148
150 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, 149 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
151 150
152#endif // CONFIG_SOC_AU1200 151#endif /* CONFIG_SOC_AU1200 */
153 152
154 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 153 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
155 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 154 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
@@ -177,8 +176,7 @@ static dbdev_tab_t dbdev_tab[] = {
177 176
178static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS]; 177static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS];
179 178
180static dbdev_tab_t * 179static dbdev_tab_t *find_dbdev_id(u32 id)
181find_dbdev_id(u32 id)
182{ 180{
183 int i; 181 int i;
184 dbdev_tab_t *p; 182 dbdev_tab_t *p;
@@ -190,29 +188,27 @@ find_dbdev_id(u32 id)
190 return NULL; 188 return NULL;
191} 189}
192 190
193void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp) 191void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp)
194{ 192{
195 return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 193 return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
196} 194}
197EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt); 195EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt);
198 196
199u32 197u32 au1xxx_ddma_add_device(dbdev_tab_t *dev)
200au1xxx_ddma_add_device(dbdev_tab_t *dev)
201{ 198{
202 u32 ret = 0; 199 u32 ret = 0;
203 dbdev_tab_t *p=NULL; 200 dbdev_tab_t *p;
204 static u16 new_id=0x1000; 201 static u16 new_id = 0x1000;
205 202
206 p = find_dbdev_id(~0); 203 p = find_dbdev_id(~0);
207 if ( NULL != p ) 204 if (NULL != p) {
208 {
209 memcpy(p, dev, sizeof(dbdev_tab_t)); 205 memcpy(p, dev, sizeof(dbdev_tab_t));
210 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id); 206 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id);
211 ret = p->dev_id; 207 ret = p->dev_id;
212 new_id++; 208 new_id++;
213#if 0 209#if 0
214 printk("add_device: id:%x flags:%x padd:%x\n", 210 printk(KERN_DEBUG "add_device: id:%x flags:%x padd:%x\n",
215 p->dev_id, p->dev_flags, p->dev_physaddr ); 211 p->dev_id, p->dev_flags, p->dev_physaddr);
216#endif 212#endif
217 } 213 }
218 214
@@ -220,10 +216,19 @@ au1xxx_ddma_add_device(dbdev_tab_t *dev)
220} 216}
221EXPORT_SYMBOL(au1xxx_ddma_add_device); 217EXPORT_SYMBOL(au1xxx_ddma_add_device);
222 218
223/* Allocate a channel and return a non-zero descriptor if successful. 219void au1xxx_ddma_del_device(u32 devid)
224*/ 220{
225u32 221 dbdev_tab_t *p = find_dbdev_id(devid);
226au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, 222
223 if (p != NULL) {
224 memset(p, 0, sizeof(dbdev_tab_t));
225 p->dev_id = ~0;
226 }
227}
228EXPORT_SYMBOL(au1xxx_ddma_del_device);
229
230/* Allocate a channel and return a non-zero descriptor if successful. */
231u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
227 void (*callback)(int, void *), void *callparam) 232 void (*callback)(int, void *), void *callparam)
228{ 233{
229 unsigned long flags; 234 unsigned long flags;
@@ -234,7 +239,8 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
234 chan_tab_t *ctp; 239 chan_tab_t *ctp;
235 au1x_dma_chan_t *cp; 240 au1x_dma_chan_t *cp;
236 241
237 /* We do the intialization on the first channel allocation. 242 /*
243 * We do the intialization on the first channel allocation.
238 * We have to wait because of the interrupt handler initialization 244 * We have to wait because of the interrupt handler initialization
239 * which can't be done successfully during board set up. 245 * which can't be done successfully during board set up.
240 */ 246 */
@@ -242,16 +248,17 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
242 au1xxx_dbdma_init(); 248 au1xxx_dbdma_init();
243 dbdma_initialized = 1; 249 dbdma_initialized = 1;
244 250
245 if ((stp = find_dbdev_id(srcid)) == NULL) 251 stp = find_dbdev_id(srcid);
252 if (stp == NULL)
246 return 0; 253 return 0;
247 if ((dtp = find_dbdev_id(destid)) == NULL) 254 dtp = find_dbdev_id(destid);
255 if (dtp == NULL)
248 return 0; 256 return 0;
249 257
250 used = 0; 258 used = 0;
251 rv = 0; 259 rv = 0;
252 260
253 /* Check to see if we can get both channels. 261 /* Check to see if we can get both channels. */
254 */
255 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 262 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
256 if (!(stp->dev_flags & DEV_FLAGS_INUSE) || 263 if (!(stp->dev_flags & DEV_FLAGS_INUSE) ||
257 (stp->dev_flags & DEV_FLAGS_ANYUSE)) { 264 (stp->dev_flags & DEV_FLAGS_ANYUSE)) {
@@ -261,35 +268,30 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
261 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) { 268 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) {
262 /* Got destination */ 269 /* Got destination */
263 dtp->dev_flags |= DEV_FLAGS_INUSE; 270 dtp->dev_flags |= DEV_FLAGS_INUSE;
264 } 271 } else {
265 else { 272 /* Can't get dest. Release src. */
266 /* Can't get dest. Release src.
267 */
268 stp->dev_flags &= ~DEV_FLAGS_INUSE; 273 stp->dev_flags &= ~DEV_FLAGS_INUSE;
269 used++; 274 used++;
270 } 275 }
271 } 276 } else
272 else {
273 used++; 277 used++;
274 }
275 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 278 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
276 279
277 if (!used) { 280 if (!used) {
278 /* Let's see if we can allocate a channel for it. 281 /* Let's see if we can allocate a channel for it. */
279 */
280 ctp = NULL; 282 ctp = NULL;
281 chan = 0; 283 chan = 0;
282 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 284 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
283 for (i=0; i<NUM_DBDMA_CHANS; i++) { 285 for (i = 0; i < NUM_DBDMA_CHANS; i++)
284 if (chan_tab_ptr[i] == NULL) { 286 if (chan_tab_ptr[i] == NULL) {
285 /* If kmalloc fails, it is caught below same 287 /*
288 * If kmalloc fails, it is caught below same
286 * as a channel not available. 289 * as a channel not available.
287 */ 290 */
288 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC); 291 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
289 chan_tab_ptr[i] = ctp; 292 chan_tab_ptr[i] = ctp;
290 break; 293 break;
291 } 294 }
292 }
293 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 295 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
294 296
295 if (ctp != NULL) { 297 if (ctp != NULL) {
@@ -304,8 +306,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
304 ctp->chan_callback = callback; 306 ctp->chan_callback = callback;
305 ctp->chan_callparam = callparam; 307 ctp->chan_callparam = callparam;
306 308
307 /* Initialize channel configuration. 309 /* Initialize channel configuration. */
308 */
309 i = 0; 310 i = 0;
310 if (stp->dev_intlevel) 311 if (stp->dev_intlevel)
311 i |= DDMA_CFG_SED; 312 i |= DDMA_CFG_SED;
@@ -326,8 +327,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
326 * operations. 327 * operations.
327 */ 328 */
328 rv = (u32)(&chan_tab_ptr[chan]); 329 rv = (u32)(&chan_tab_ptr[chan]);
329 } 330 } else {
330 else {
331 /* Release devices */ 331 /* Release devices */
332 stp->dev_flags &= ~DEV_FLAGS_INUSE; 332 stp->dev_flags &= ~DEV_FLAGS_INUSE;
333 dtp->dev_flags &= ~DEV_FLAGS_INUSE; 333 dtp->dev_flags &= ~DEV_FLAGS_INUSE;
@@ -337,11 +337,11 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
337} 337}
338EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc); 338EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc);
339 339
340/* Set the device width if source or destination is a FIFO. 340/*
341 * Set the device width if source or destination is a FIFO.
341 * Should be 8, 16, or 32 bits. 342 * Should be 8, 16, or 32 bits.
342 */ 343 */
343u32 344u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
344au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
345{ 345{
346 u32 rv; 346 u32 rv;
347 chan_tab_t *ctp; 347 chan_tab_t *ctp;
@@ -365,10 +365,8 @@ au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
365} 365}
366EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth); 366EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth);
367 367
368/* Allocate a descriptor ring, initializing as much as possible. 368/* Allocate a descriptor ring, initializing as much as possible. */
369*/ 369u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
370u32
371au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
372{ 370{
373 int i; 371 int i;
374 u32 desc_base, srcid, destid; 372 u32 desc_base, srcid, destid;
@@ -378,43 +376,45 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
378 dbdev_tab_t *stp, *dtp; 376 dbdev_tab_t *stp, *dtp;
379 au1x_ddma_desc_t *dp; 377 au1x_ddma_desc_t *dp;
380 378
381 /* I guess we could check this to be within the 379 /*
380 * I guess we could check this to be within the
382 * range of the table...... 381 * range of the table......
383 */ 382 */
384 ctp = *((chan_tab_t **)chanid); 383 ctp = *((chan_tab_t **)chanid);
385 stp = ctp->chan_src; 384 stp = ctp->chan_src;
386 dtp = ctp->chan_dest; 385 dtp = ctp->chan_dest;
387 386
388 /* The descriptors must be 32-byte aligned. There is a 387 /*
388 * The descriptors must be 32-byte aligned. There is a
389 * possibility the allocation will give us such an address, 389 * possibility the allocation will give us such an address,
390 * and if we try that first we are likely to not waste larger 390 * and if we try that first we are likely to not waste larger
391 * slabs of memory. 391 * slabs of memory.
392 */ 392 */
393 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), 393 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
394 GFP_KERNEL|GFP_DMA); 394 GFP_KERNEL|GFP_DMA);
395 if (desc_base == 0) 395 if (desc_base == 0)
396 return 0; 396 return 0;
397 397
398 if (desc_base & 0x1f) { 398 if (desc_base & 0x1f) {
399 /* Lost....do it again, allocate extra, and round 399 /*
400 * Lost....do it again, allocate extra, and round
400 * the address base. 401 * the address base.
401 */ 402 */
402 kfree((const void *)desc_base); 403 kfree((const void *)desc_base);
403 i = entries * sizeof(au1x_ddma_desc_t); 404 i = entries * sizeof(au1x_ddma_desc_t);
404 i += (sizeof(au1x_ddma_desc_t) - 1); 405 i += (sizeof(au1x_ddma_desc_t) - 1);
405 if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0) 406 desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA);
407 if (desc_base == 0)
406 return 0; 408 return 0;
407 409
408 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t)); 410 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));
409 } 411 }
410 dp = (au1x_ddma_desc_t *)desc_base; 412 dp = (au1x_ddma_desc_t *)desc_base;
411 413
412 /* Keep track of the base descriptor. 414 /* Keep track of the base descriptor. */
413 */
414 ctp->chan_desc_base = dp; 415 ctp->chan_desc_base = dp;
415 416
416 /* Initialize the rings with as much information as we know. 417 /* Initialize the rings with as much information as we know. */
417 */
418 srcid = stp->dev_id; 418 srcid = stp->dev_id;
419 destid = dtp->dev_id; 419 destid = dtp->dev_id;
420 420
@@ -426,11 +426,12 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
426 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV; 426 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV;
427 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE); 427 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE);
428 428
429 /* is it mem to mem transfer? */ 429 /* Is it mem to mem transfer? */
430 if(((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) && 430 if (((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) ||
431 ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS))) { 431 (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) &&
432 cmd0 |= DSCR_CMD0_MEM; 432 ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) ||
433 } 433 (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS)))
434 cmd0 |= DSCR_CMD0_MEM;
434 435
435 switch (stp->dev_devwidth) { 436 switch (stp->dev_devwidth) {
436 case 8: 437 case 8:
@@ -458,15 +459,17 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
458 break; 459 break;
459 } 460 }
460 461
461 /* If the device is marked as an in/out FIFO, ensure it is 462 /*
463 * If the device is marked as an in/out FIFO, ensure it is
462 * set non-coherent. 464 * set non-coherent.
463 */ 465 */
464 if (stp->dev_flags & DEV_FLAGS_IN) 466 if (stp->dev_flags & DEV_FLAGS_IN)
465 cmd0 |= DSCR_CMD0_SN; /* Source in fifo */ 467 cmd0 |= DSCR_CMD0_SN; /* Source in FIFO */
466 if (dtp->dev_flags & DEV_FLAGS_OUT) 468 if (dtp->dev_flags & DEV_FLAGS_OUT)
467 cmd0 |= DSCR_CMD0_DN; /* Destination out fifo */ 469 cmd0 |= DSCR_CMD0_DN; /* Destination out FIFO */
468 470
469 /* Set up source1. For now, assume no stride and increment. 471 /*
472 * Set up source1. For now, assume no stride and increment.
470 * A channel attribute update can change this later. 473 * A channel attribute update can change this later.
471 */ 474 */
472 switch (stp->dev_tsize) { 475 switch (stp->dev_tsize) {
@@ -485,19 +488,19 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
485 break; 488 break;
486 } 489 }
487 490
488 /* If source input is fifo, set static address. 491 /* If source input is FIFO, set static address. */
489 */
490 if (stp->dev_flags & DEV_FLAGS_IN) { 492 if (stp->dev_flags & DEV_FLAGS_IN) {
491 if ( stp->dev_flags & DEV_FLAGS_BURSTABLE ) 493 if (stp->dev_flags & DEV_FLAGS_BURSTABLE)
492 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST); 494 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST);
493 else 495 else
494 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); 496 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC);
495
496 } 497 }
498
497 if (stp->dev_physaddr) 499 if (stp->dev_physaddr)
498 src0 = stp->dev_physaddr; 500 src0 = stp->dev_physaddr;
499 501
500 /* Set up dest1. For now, assume no stride and increment. 502 /*
503 * Set up dest1. For now, assume no stride and increment.
501 * A channel attribute update can change this later. 504 * A channel attribute update can change this later.
502 */ 505 */
503 switch (dtp->dev_tsize) { 506 switch (dtp->dev_tsize) {
@@ -516,22 +519,24 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
516 break; 519 break;
517 } 520 }
518 521
519 /* If destination output is fifo, set static address. 522 /* If destination output is FIFO, set static address. */
520 */
521 if (dtp->dev_flags & DEV_FLAGS_OUT) { 523 if (dtp->dev_flags & DEV_FLAGS_OUT) {
522 if ( dtp->dev_flags & DEV_FLAGS_BURSTABLE ) 524 if (dtp->dev_flags & DEV_FLAGS_BURSTABLE)
523 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST); 525 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST);
524 else 526 else
525 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC); 527 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC);
526 } 528 }
529
527 if (dtp->dev_physaddr) 530 if (dtp->dev_physaddr)
528 dest0 = dtp->dev_physaddr; 531 dest0 = dtp->dev_physaddr;
529 532
530#if 0 533#if 0
531 printk("did:%x sid:%x cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 534 printk(KERN_DEBUG "did:%x sid:%x cmd0:%x cmd1:%x source0:%x "
532 dtp->dev_id, stp->dev_id, cmd0, cmd1, src0, src1, dest0, dest1 ); 535 "source1:%x dest0:%x dest1:%x\n",
536 dtp->dev_id, stp->dev_id, cmd0, cmd1, src0,
537 src1, dest0, dest1);
533#endif 538#endif
534 for (i=0; i<entries; i++) { 539 for (i = 0; i < entries; i++) {
535 dp->dscr_cmd0 = cmd0; 540 dp->dscr_cmd0 = cmd0;
536 dp->dscr_cmd1 = cmd1; 541 dp->dscr_cmd1 = cmd1;
537 dp->dscr_source0 = src0; 542 dp->dscr_source0 = src0;
@@ -545,49 +550,49 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
545 dp++; 550 dp++;
546 } 551 }
547 552
548 /* Make last descrptor point to the first. 553 /* Make last descrptor point to the first. */
549 */
550 dp--; 554 dp--;
551 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base)); 555 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base));
552 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 556 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
553 557
554 return (u32)(ctp->chan_desc_base); 558 return (u32)ctp->chan_desc_base;
555} 559}
556EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc); 560EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc);
557 561
558/* Put a source buffer into the DMA ring. 562/*
563 * Put a source buffer into the DMA ring.
559 * This updates the source pointer and byte count. Normally used 564 * This updates the source pointer and byte count. Normally used
560 * for memory to fifo transfers. 565 * for memory to fifo transfers.
561 */ 566 */
562u32 567u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
563_au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
564{ 568{
565 chan_tab_t *ctp; 569 chan_tab_t *ctp;
566 au1x_ddma_desc_t *dp; 570 au1x_ddma_desc_t *dp;
567 571
568 /* I guess we could check this to be within the 572 /*
573 * I guess we could check this to be within the
569 * range of the table...... 574 * range of the table......
570 */ 575 */
571 ctp = *((chan_tab_t **)chanid); 576 ctp = *(chan_tab_t **)chanid;
572 577
573 /* We should have multiple callers for a particular channel, 578 /*
579 * We should have multiple callers for a particular channel,
574 * an interrupt doesn't affect this pointer nor the descriptor, 580 * an interrupt doesn't affect this pointer nor the descriptor,
575 * so no locking should be needed. 581 * so no locking should be needed.
576 */ 582 */
577 dp = ctp->put_ptr; 583 dp = ctp->put_ptr;
578 584
579 /* If the descriptor is valid, we are way ahead of the DMA 585 /*
586 * If the descriptor is valid, we are way ahead of the DMA
580 * engine, so just return an error condition. 587 * engine, so just return an error condition.
581 */ 588 */
582 if (dp->dscr_cmd0 & DSCR_CMD0_V) { 589 if (dp->dscr_cmd0 & DSCR_CMD0_V)
583 return 0; 590 return 0;
584 }
585 591
586 /* Load up buffer address and byte count. 592 /* Load up buffer address and byte count. */
587 */
588 dp->dscr_source0 = virt_to_phys(buf); 593 dp->dscr_source0 = virt_to_phys(buf);
589 dp->dscr_cmd1 = nbytes; 594 dp->dscr_cmd1 = nbytes;
590 /* Check flags */ 595 /* Check flags */
591 if (flags & DDMA_FLAGS_IE) 596 if (flags & DDMA_FLAGS_IE)
592 dp->dscr_cmd0 |= DSCR_CMD0_IE; 597 dp->dscr_cmd0 |= DSCR_CMD0_IE;
593 if (flags & DDMA_FLAGS_NOIE) 598 if (flags & DDMA_FLAGS_NOIE)
@@ -595,23 +600,21 @@ _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
595 600
596 /* 601 /*
597 * There is an errata on the Au1200/Au1550 parts that could result 602 * There is an errata on the Au1200/Au1550 parts that could result
598 * in "stale" data being DMA'd. It has to do with the snoop logic on 603 * in "stale" data being DMA'ed. It has to do with the snoop logic on
599 * the dache eviction buffer. NONCOHERENT_IO is on by default for 604 * the cache eviction buffer. DMA_NONCOHERENT is on by default for
600 * these parts. If it is fixedin the future, these dma_cache_inv will 605 * these parts. If it is fixed in the future, these dma_cache_inv will
601 * just be nothing more than empty macros. See io.h. 606 * just be nothing more than empty macros. See io.h.
602 * */ 607 */
603 dma_cache_wback_inv((unsigned long)buf, nbytes); 608 dma_cache_wback_inv((unsigned long)buf, nbytes);
604 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 609 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
605 au_sync(); 610 au_sync();
606 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 611 dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
607 ctp->chan_ptr->ddma_dbell = 0; 612 ctp->chan_ptr->ddma_dbell = 0;
608 613
609 /* Get next descriptor pointer. 614 /* Get next descriptor pointer. */
610 */
611 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 615 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
612 616
613 /* return something not zero. 617 /* Return something non-zero. */
614 */
615 return nbytes; 618 return nbytes;
616} 619}
617EXPORT_SYMBOL(_au1xxx_dbdma_put_source); 620EXPORT_SYMBOL(_au1xxx_dbdma_put_source);
@@ -654,81 +657,77 @@ _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
654 dp->dscr_dest0 = virt_to_phys(buf); 657 dp->dscr_dest0 = virt_to_phys(buf);
655 dp->dscr_cmd1 = nbytes; 658 dp->dscr_cmd1 = nbytes;
656#if 0 659#if 0
657 printk("cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 660 printk(KERN_DEBUG "cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n",
658 dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0, 661 dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0,
659 dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1 ); 662 dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1);
660#endif 663#endif
661 /* 664 /*
662 * There is an errata on the Au1200/Au1550 parts that could result in 665 * There is an errata on the Au1200/Au1550 parts that could result in
663 * "stale" data being DMA'd. It has to do with the snoop logic on the 666 * "stale" data being DMA'ed. It has to do with the snoop logic on the
664 * dache eviction buffer. NONCOHERENT_IO is on by default for these 667 * cache eviction buffer. DMA_NONCOHERENT is on by default for these
665 * parts. If it is fixedin the future, these dma_cache_inv will just 668 * parts. If it is fixed in the future, these dma_cache_inv will just
666 * be nothing more than empty macros. See io.h. 669 * be nothing more than empty macros. See io.h.
667 * */ 670 */
668 dma_cache_inv((unsigned long)buf, nbytes); 671 dma_cache_inv((unsigned long)buf, nbytes);
669 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 672 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
670 au_sync(); 673 au_sync();
671 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 674 dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
672 ctp->chan_ptr->ddma_dbell = 0; 675 ctp->chan_ptr->ddma_dbell = 0;
673 676
674 /* Get next descriptor pointer. 677 /* Get next descriptor pointer. */
675 */
676 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 678 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
677 679
678 /* return something not zero. 680 /* Return something non-zero. */
679 */
680 return nbytes; 681 return nbytes;
681} 682}
682EXPORT_SYMBOL(_au1xxx_dbdma_put_dest); 683EXPORT_SYMBOL(_au1xxx_dbdma_put_dest);
683 684
684/* Get a destination buffer into the DMA ring. 685/*
686 * Get a destination buffer into the DMA ring.
685 * Normally used to get a full buffer from the ring during fifo 687 * Normally used to get a full buffer from the ring during fifo
686 * to memory transfers. This does not set the valid bit, you will 688 * to memory transfers. This does not set the valid bit, you will
687 * have to put another destination buffer to keep the DMA going. 689 * have to put another destination buffer to keep the DMA going.
688 */ 690 */
689u32 691u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
690au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
691{ 692{
692 chan_tab_t *ctp; 693 chan_tab_t *ctp;
693 au1x_ddma_desc_t *dp; 694 au1x_ddma_desc_t *dp;
694 u32 rv; 695 u32 rv;
695 696
696 /* I guess we could check this to be within the 697 /*
698 * I guess we could check this to be within the
697 * range of the table...... 699 * range of the table......
698 */ 700 */
699 ctp = *((chan_tab_t **)chanid); 701 ctp = *((chan_tab_t **)chanid);
700 702
701 /* We should have multiple callers for a particular channel, 703 /*
704 * We should have multiple callers for a particular channel,
702 * an interrupt doesn't affect this pointer nor the descriptor, 705 * an interrupt doesn't affect this pointer nor the descriptor,
703 * so no locking should be needed. 706 * so no locking should be needed.
704 */ 707 */
705 dp = ctp->get_ptr; 708 dp = ctp->get_ptr;
706 709
707 /* If the descriptor is valid, we are way ahead of the DMA 710 /*
711 * If the descriptor is valid, we are way ahead of the DMA
708 * engine, so just return an error condition. 712 * engine, so just return an error condition.
709 */ 713 */
710 if (dp->dscr_cmd0 & DSCR_CMD0_V) 714 if (dp->dscr_cmd0 & DSCR_CMD0_V)
711 return 0; 715 return 0;
712 716
713 /* Return buffer address and byte count. 717 /* Return buffer address and byte count. */
714 */
715 *buf = (void *)(phys_to_virt(dp->dscr_dest0)); 718 *buf = (void *)(phys_to_virt(dp->dscr_dest0));
716 *nbytes = dp->dscr_cmd1; 719 *nbytes = dp->dscr_cmd1;
717 rv = dp->dscr_stat; 720 rv = dp->dscr_stat;
718 721
719 /* Get next descriptor pointer. 722 /* Get next descriptor pointer. */
720 */
721 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 723 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
722 724
723 /* return something not zero. 725 /* Return something non-zero. */
724 */
725 return rv; 726 return rv;
726} 727}
727
728EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest); 728EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest);
729 729
730void 730void au1xxx_dbdma_stop(u32 chanid)
731au1xxx_dbdma_stop(u32 chanid)
732{ 731{
733 chan_tab_t *ctp; 732 chan_tab_t *ctp;
734 au1x_dma_chan_t *cp; 733 au1x_dma_chan_t *cp;
@@ -743,7 +742,7 @@ au1xxx_dbdma_stop(u32 chanid)
743 udelay(1); 742 udelay(1);
744 halt_timeout++; 743 halt_timeout++;
745 if (halt_timeout > 100) { 744 if (halt_timeout > 100) {
746 printk("warning: DMA channel won't halt\n"); 745 printk(KERN_WARNING "warning: DMA channel won't halt\n");
747 break; 746 break;
748 } 747 }
749 } 748 }
@@ -753,12 +752,12 @@ au1xxx_dbdma_stop(u32 chanid)
753} 752}
754EXPORT_SYMBOL(au1xxx_dbdma_stop); 753EXPORT_SYMBOL(au1xxx_dbdma_stop);
755 754
756/* Start using the current descriptor pointer. If the dbdma encounters 755/*
757 * a not valid descriptor, it will stop. In this case, we can just 756 * Start using the current descriptor pointer. If the DBDMA encounters
757 * a non-valid descriptor, it will stop. In this case, we can just
758 * continue by adding a buffer to the list and starting again. 758 * continue by adding a buffer to the list and starting again.
759 */ 759 */
760void 760void au1xxx_dbdma_start(u32 chanid)
761au1xxx_dbdma_start(u32 chanid)
762{ 761{
763 chan_tab_t *ctp; 762 chan_tab_t *ctp;
764 au1x_dma_chan_t *cp; 763 au1x_dma_chan_t *cp;
@@ -773,8 +772,7 @@ au1xxx_dbdma_start(u32 chanid)
773} 772}
774EXPORT_SYMBOL(au1xxx_dbdma_start); 773EXPORT_SYMBOL(au1xxx_dbdma_start);
775 774
776void 775void au1xxx_dbdma_reset(u32 chanid)
777au1xxx_dbdma_reset(u32 chanid)
778{ 776{
779 chan_tab_t *ctp; 777 chan_tab_t *ctp;
780 au1x_ddma_desc_t *dp; 778 au1x_ddma_desc_t *dp;
@@ -784,14 +782,14 @@ au1xxx_dbdma_reset(u32 chanid)
784 ctp = *((chan_tab_t **)chanid); 782 ctp = *((chan_tab_t **)chanid);
785 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 783 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
786 784
787 /* Run through the descriptors and reset the valid indicator. 785 /* Run through the descriptors and reset the valid indicator. */
788 */
789 dp = ctp->chan_desc_base; 786 dp = ctp->chan_desc_base;
790 787
791 do { 788 do {
792 dp->dscr_cmd0 &= ~DSCR_CMD0_V; 789 dp->dscr_cmd0 &= ~DSCR_CMD0_V;
793 /* reset our SW status -- this is used to determine 790 /*
794 * if a descriptor is in use by upper level SW. Since 791 * Reset our software status -- this is used to determine
792 * if a descriptor is in use by upper level software. Since
795 * posting can reset 'V' bit. 793 * posting can reset 'V' bit.
796 */ 794 */
797 dp->sw_status = 0; 795 dp->sw_status = 0;
@@ -800,8 +798,7 @@ au1xxx_dbdma_reset(u32 chanid)
800} 798}
801EXPORT_SYMBOL(au1xxx_dbdma_reset); 799EXPORT_SYMBOL(au1xxx_dbdma_reset);
802 800
803u32 801u32 au1xxx_get_dma_residue(u32 chanid)
804au1xxx_get_dma_residue(u32 chanid)
805{ 802{
806 chan_tab_t *ctp; 803 chan_tab_t *ctp;
807 au1x_dma_chan_t *cp; 804 au1x_dma_chan_t *cp;
@@ -810,18 +807,15 @@ au1xxx_get_dma_residue(u32 chanid)
810 ctp = *((chan_tab_t **)chanid); 807 ctp = *((chan_tab_t **)chanid);
811 cp = ctp->chan_ptr; 808 cp = ctp->chan_ptr;
812 809
813 /* This is only valid if the channel is stopped. 810 /* This is only valid if the channel is stopped. */
814 */
815 rv = cp->ddma_bytecnt; 811 rv = cp->ddma_bytecnt;
816 au_sync(); 812 au_sync();
817 813
818 return rv; 814 return rv;
819} 815}
820
821EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue); 816EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue);
822 817
823void 818void au1xxx_dbdma_chan_free(u32 chanid)
824au1xxx_dbdma_chan_free(u32 chanid)
825{ 819{
826 chan_tab_t *ctp; 820 chan_tab_t *ctp;
827 dbdev_tab_t *stp, *dtp; 821 dbdev_tab_t *stp, *dtp;
@@ -842,8 +836,7 @@ au1xxx_dbdma_chan_free(u32 chanid)
842} 836}
843EXPORT_SYMBOL(au1xxx_dbdma_chan_free); 837EXPORT_SYMBOL(au1xxx_dbdma_chan_free);
844 838
845static irqreturn_t 839static irqreturn_t dbdma_interrupt(int irq, void *dev_id)
846dbdma_interrupt(int irq, void *dev_id)
847{ 840{
848 u32 intstat; 841 u32 intstat;
849 u32 chan_index; 842 u32 chan_index;
@@ -859,13 +852,12 @@ dbdma_interrupt(int irq, void *dev_id)
859 cp = ctp->chan_ptr; 852 cp = ctp->chan_ptr;
860 dp = ctp->cur_ptr; 853 dp = ctp->cur_ptr;
861 854
862 /* Reset interrupt. 855 /* Reset interrupt. */
863 */
864 cp->ddma_irq = 0; 856 cp->ddma_irq = 0;
865 au_sync(); 857 au_sync();
866 858
867 if (ctp->chan_callback) 859 if (ctp->chan_callback)
868 (ctp->chan_callback)(irq, ctp->chan_callparam); 860 ctp->chan_callback(irq, ctp->chan_callparam);
869 861
870 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 862 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
871 return IRQ_RETVAL(1); 863 return IRQ_RETVAL(1);
@@ -890,47 +882,47 @@ static void au1xxx_dbdma_init(void)
890 882
891 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED, 883 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED,
892 "Au1xxx dbdma", (void *)dbdma_gptr)) 884 "Au1xxx dbdma", (void *)dbdma_gptr))
893 printk("Can't get 1550 dbdma irq"); 885 printk(KERN_ERR "Can't get 1550 dbdma irq");
894} 886}
895 887
896void 888void au1xxx_dbdma_dump(u32 chanid)
897au1xxx_dbdma_dump(u32 chanid)
898{ 889{
899 chan_tab_t *ctp; 890 chan_tab_t *ctp;
900 au1x_ddma_desc_t *dp; 891 au1x_ddma_desc_t *dp;
901 dbdev_tab_t *stp, *dtp; 892 dbdev_tab_t *stp, *dtp;
902 au1x_dma_chan_t *cp; 893 au1x_dma_chan_t *cp;
903 u32 i = 0; 894 u32 i = 0;
904 895
905 ctp = *((chan_tab_t **)chanid); 896 ctp = *((chan_tab_t **)chanid);
906 stp = ctp->chan_src; 897 stp = ctp->chan_src;
907 dtp = ctp->chan_dest; 898 dtp = ctp->chan_dest;
908 cp = ctp->chan_ptr; 899 cp = ctp->chan_ptr;
909 900
910 printk("Chan %x, stp %x (dev %d) dtp %x (dev %d) \n", 901 printk(KERN_DEBUG "Chan %x, stp %x (dev %d) dtp %x (dev %d) \n",
911 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp, dtp - dbdev_tab); 902 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp,
912 printk("desc base %x, get %x, put %x, cur %x\n", 903 dtp - dbdev_tab);
913 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr), 904 printk(KERN_DEBUG "desc base %x, get %x, put %x, cur %x\n",
914 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr)); 905 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr),
915 906 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr));
916 printk("dbdma chan %x\n", (u32)cp); 907
917 printk("cfg %08x, desptr %08x, statptr %08x\n", 908 printk(KERN_DEBUG "dbdma chan %x\n", (u32)cp);
918 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr); 909 printk(KERN_DEBUG "cfg %08x, desptr %08x, statptr %08x\n",
919 printk("dbell %08x, irq %08x, stat %08x, bytecnt %08x\n", 910 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr);
920 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat, cp->ddma_bytecnt); 911 printk(KERN_DEBUG "dbell %08x, irq %08x, stat %08x, bytecnt %08x\n",
921 912 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat,
922 913 cp->ddma_bytecnt);
923 /* Run through the descriptors 914
924 */ 915 /* Run through the descriptors */
925 dp = ctp->chan_desc_base; 916 dp = ctp->chan_desc_base;
926 917
927 do { 918 do {
928 printk("Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n", 919 printk(KERN_DEBUG "Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n",
929 i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); 920 i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1);
930 printk("src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n", 921 printk(KERN_DEBUG "src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n",
931 dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1); 922 dp->dscr_source0, dp->dscr_source1,
932 printk("stat %08x, nxtptr %08x\n", 923 dp->dscr_dest0, dp->dscr_dest1);
933 dp->dscr_stat, dp->dscr_nxtptr); 924 printk(KERN_DEBUG "stat %08x, nxtptr %08x\n",
925 dp->dscr_stat, dp->dscr_nxtptr);
934 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 926 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
935 } while (dp != ctp->chan_desc_base); 927 } while (dp != ctp->chan_desc_base);
936} 928}
@@ -938,32 +930,33 @@ au1xxx_dbdma_dump(u32 chanid)
938/* Put a descriptor into the DMA ring. 930/* Put a descriptor into the DMA ring.
939 * This updates the source/destination pointers and byte count. 931 * This updates the source/destination pointers and byte count.
940 */ 932 */
941u32 933u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr)
942au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr )
943{ 934{
944 chan_tab_t *ctp; 935 chan_tab_t *ctp;
945 au1x_ddma_desc_t *dp; 936 au1x_ddma_desc_t *dp;
946 u32 nbytes=0; 937 u32 nbytes = 0;
947 938
948 /* I guess we could check this to be within the 939 /*
949 * range of the table...... 940 * I guess we could check this to be within the
950 */ 941 * range of the table......
942 */
951 ctp = *((chan_tab_t **)chanid); 943 ctp = *((chan_tab_t **)chanid);
952 944
953 /* We should have multiple callers for a particular channel, 945 /*
954 * an interrupt doesn't affect this pointer nor the descriptor, 946 * We should have multiple callers for a particular channel,
955 * so no locking should be needed. 947 * an interrupt doesn't affect this pointer nor the descriptor,
956 */ 948 * so no locking should be needed.
949 */
957 dp = ctp->put_ptr; 950 dp = ctp->put_ptr;
958 951
959 /* If the descriptor is valid, we are way ahead of the DMA 952 /*
960 * engine, so just return an error condition. 953 * If the descriptor is valid, we are way ahead of the DMA
961 */ 954 * engine, so just return an error condition.
955 */
962 if (dp->dscr_cmd0 & DSCR_CMD0_V) 956 if (dp->dscr_cmd0 & DSCR_CMD0_V)
963 return 0; 957 return 0;
964 958
965 /* Load up buffer addresses and byte count. 959 /* Load up buffer addresses and byte count. */
966 */
967 dp->dscr_dest0 = dscr->dscr_dest0; 960 dp->dscr_dest0 = dscr->dscr_dest0;
968 dp->dscr_source0 = dscr->dscr_source0; 961 dp->dscr_source0 = dscr->dscr_source0;
969 dp->dscr_dest1 = dscr->dscr_dest1; 962 dp->dscr_dest1 = dscr->dscr_dest1;
@@ -975,14 +968,11 @@ au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr )
975 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V; 968 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V;
976 ctp->chan_ptr->ddma_dbell = 0; 969 ctp->chan_ptr->ddma_dbell = 0;
977 970
978 /* Get next descriptor pointer. 971 /* Get next descriptor pointer. */
979 */
980 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 972 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
981 973
982 /* return something not zero. 974 /* Return something non-zero. */
983 */
984 return nbytes; 975 return nbytes;
985} 976}
986 977
987#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */ 978#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */
988
diff --git a/arch/mips/au1000/common/dbg_io.c b/arch/mips/au1000/common/dbg_io.c
index eae1bb2ca26e..af5be7df2f2a 100644
--- a/arch/mips/au1000/common/dbg_io.c
+++ b/arch/mips/au1000/common/dbg_io.c
@@ -1,3 +1,4 @@
1#include <linux/types.h>
1 2
2#include <asm/mach-au1x00/au1000.h> 3#include <asm/mach-au1x00/au1000.h>
3 4
@@ -8,12 +9,6 @@
8 * uart to be used for debugging. 9 * uart to be used for debugging.
9 */ 10 */
10#define DEBUG_BASE UART_DEBUG_BASE 11#define DEBUG_BASE UART_DEBUG_BASE
11/**/
12
13/* we need uint32 uint8 */
14/* #include "types.h" */
15typedef unsigned char uint8;
16typedef unsigned int uint32;
17 12
18#define UART16550_BAUD_2400 2400 13#define UART16550_BAUD_2400 2400
19#define UART16550_BAUD_4800 4800 14#define UART16550_BAUD_4800 4800
@@ -51,17 +46,15 @@ typedef unsigned int uint32;
51#define UART_MOD_CNTRL 0x100 /* Module Control */ 46#define UART_MOD_CNTRL 0x100 /* Module Control */
52 47
53/* memory-mapped read/write of the port */ 48/* memory-mapped read/write of the port */
54#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff) 49#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff)
55#define UART16550_WRITE(y, z) (au_writel(z&0xff, DEBUG_BASE + y)) 50#define UART16550_WRITE(y, z) (au_writel(z & 0xff, DEBUG_BASE + y))
56 51
57extern unsigned long calc_clock(void); 52extern unsigned long calc_clock(void);
58 53
59void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) 54void debugInit(u32 baud, u8 data, u8 parity, u8 stop)
60{ 55{
61 56 if (UART16550_READ(UART_MOD_CNTRL) != 0x3)
62 if (UART16550_READ(UART_MOD_CNTRL) != 0x3) {
63 UART16550_WRITE(UART_MOD_CNTRL, 3); 57 UART16550_WRITE(UART_MOD_CNTRL, 3);
64 }
65 calc_clock(); 58 calc_clock();
66 59
67 /* disable interrupts */ 60 /* disable interrupts */
@@ -69,7 +62,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
69 62
70 /* set up baud rate */ 63 /* set up baud rate */
71 { 64 {
72 uint32 divisor; 65 u32 divisor;
73 66
74 /* set divisor */ 67 /* set divisor */
75 divisor = get_au1x00_uart_baud_base() / baud; 68 divisor = get_au1x00_uart_baud_base() / baud;
@@ -80,9 +73,9 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
80 UART16550_WRITE(UART_LCR, (data | parity | stop)); 73 UART16550_WRITE(UART_LCR, (data | parity | stop));
81} 74}
82 75
83static int remoteDebugInitialized = 0; 76static int remoteDebugInitialized;
84 77
85uint8 getDebugChar(void) 78u8 getDebugChar(void)
86{ 79{
87 if (!remoteDebugInitialized) { 80 if (!remoteDebugInitialized) {
88 remoteDebugInitialized = 1; 81 remoteDebugInitialized = 1;
@@ -92,15 +85,13 @@ uint8 getDebugChar(void)
92 UART16550_STOP_1BIT); 85 UART16550_STOP_1BIT);
93 } 86 }
94 87
95 while((UART16550_READ(UART_LSR) & 0x1) == 0); 88 while ((UART16550_READ(UART_LSR) & 0x1) == 0);
96 return UART16550_READ(UART_RX); 89 return UART16550_READ(UART_RX);
97} 90}
98 91
99 92
100int putDebugChar(uint8 byte) 93int putDebugChar(u8 byte)
101{ 94{
102// int i;
103
104 if (!remoteDebugInitialized) { 95 if (!remoteDebugInitialized) {
105 remoteDebugInitialized = 1; 96 remoteDebugInitialized = 1;
106 debugInit(UART16550_BAUD_115200, 97 debugInit(UART16550_BAUD_115200,
@@ -109,9 +100,8 @@ int putDebugChar(uint8 byte)
109 UART16550_STOP_1BIT); 100 UART16550_STOP_1BIT);
110 } 101 }
111 102
112 while ((UART16550_READ(UART_LSR)&0x40) == 0); 103 while ((UART16550_READ(UART_LSR) & 0x40) == 0);
113 UART16550_WRITE(UART_TX, byte); 104 UART16550_WRITE(UART_TX, byte);
114 //for (i=0;i<0xfff;i++);
115 105
116 return 1; 106 return 1;
117} 107}
diff --git a/arch/mips/au1000/common/dma.c b/arch/mips/au1000/common/dma.c
index 95f69ea146e9..d6fbda232e6a 100644
--- a/arch/mips/au1000/common/dma.c
+++ b/arch/mips/au1000/common/dma.c
@@ -1,12 +1,11 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * A DMA channel allocator for Au1000. API is modeled loosely off of 4 * A DMA channel allocator for Au1x00. API is modeled loosely off of
5 * linux/kernel/dma.c. 5 * linux/kernel/dma.c.
6 * 6 *
7 * Copyright 2000 MontaVista Software Inc. 7 * Copyright 2000, 2008 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc. 8 * Author: MontaVista Software, Inc. <source@mvista.com>
9 * stevel@mvista.com or source@mvista.com
10 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 9 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
11 * 10 *
12 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
@@ -39,7 +38,8 @@
39#include <asm/mach-au1x00/au1000.h> 38#include <asm/mach-au1x00/au1000.h>
40#include <asm/mach-au1x00/au1000_dma.h> 39#include <asm/mach-au1x00/au1000_dma.h>
41 40
42#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 41#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
42 defined(CONFIG_SOC_AU1100)
43/* 43/*
44 * A note on resource allocation: 44 * A note on resource allocation:
45 * 45 *
@@ -56,7 +56,6 @@
56 * returned from request_dma. 56 * returned from request_dma.
57 */ 57 */
58 58
59
60DEFINE_SPINLOCK(au1000_dma_spin_lock); 59DEFINE_SPINLOCK(au1000_dma_spin_lock);
61 60
62struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = { 61struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
@@ -71,7 +70,7 @@ struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
71}; 70};
72EXPORT_SYMBOL(au1000_dma_table); 71EXPORT_SYMBOL(au1000_dma_table);
73 72
74// Device FIFO addresses and default DMA modes 73/* Device FIFO addresses and default DMA modes */
75static const struct dma_dev { 74static const struct dma_dev {
76 unsigned int fifo_addr; 75 unsigned int fifo_addr;
77 unsigned int dma_mode; 76 unsigned int dma_mode;
@@ -80,8 +79,8 @@ static const struct dma_dev {
80 {UART0_ADDR + UART_RX, 0}, 79 {UART0_ADDR + UART_RX, 0},
81 {0, 0}, 80 {0, 0},
82 {0, 0}, 81 {0, 0},
83 {AC97C_DATA, DMA_DW16 }, // coherent 82 {AC97C_DATA, DMA_DW16 }, /* coherent */
84 {AC97C_DATA, DMA_DR | DMA_DW16 }, // coherent 83 {AC97C_DATA, DMA_DR | DMA_DW16 }, /* coherent */
85 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC}, 84 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC},
86 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC}, 85 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC},
87 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC}, 86 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC},
@@ -101,10 +100,10 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
101 struct dma_chan *chan; 100 struct dma_chan *chan;
102 101
103 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 102 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) {
104 if ((chan = get_dma_chan(i)) != NULL) { 103 chan = get_dma_chan(i);
104 if (chan != NULL)
105 len += sprintf(buf + len, "%2d: %s\n", 105 len += sprintf(buf + len, "%2d: %s\n",
106 i, chan->dev_str); 106 i, chan->dev_str);
107 }
108 } 107 }
109 108
110 if (fpos >= len) { 109 if (fpos >= len) {
@@ -113,18 +112,19 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
113 return 0; 112 return 0;
114 } 113 }
115 *start = buf + fpos; 114 *start = buf + fpos;
116 if ((len -= fpos) > length) 115 len -= fpos;
116 if (len > length)
117 return length; 117 return length;
118 *eof = 1; 118 *eof = 1;
119 return len; 119 return len;
120} 120}
121 121
122// Device FIFO addresses and default DMA modes - 2nd bank 122/* Device FIFO addresses and default DMA modes - 2nd bank */
123static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = { 123static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = {
124 {SD0_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 124 { SD0_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */
125 {SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8}, // coherent 125 { SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 }, /* coherent */
126 {SD1_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 126 { SD1_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */
127 {SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8} // coherent 127 { SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 } /* coherent */
128}; 128};
129 129
130void dump_au1000_dma_channel(unsigned int dmanr) 130void dump_au1000_dma_channel(unsigned int dmanr)
@@ -150,7 +150,6 @@ void dump_au1000_dma_channel(unsigned int dmanr)
150 au_readl(chan->io + DMA_BUFFER1_COUNT)); 150 au_readl(chan->io + DMA_BUFFER1_COUNT));
151} 151}
152 152
153
154/* 153/*
155 * Finds a free channel, and binds the requested device to it. 154 * Finds a free channel, and binds the requested device to it.
156 * Returns the allocated channel number, or negative on error. 155 * Returns the allocated channel number, or negative on error.
@@ -169,14 +168,14 @@ int request_au1000_dma(int dev_id, const char *dev_str,
169 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2)) 168 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2))
170 return -EINVAL; 169 return -EINVAL;
171#else 170#else
172 if (dev_id < 0 || dev_id >= DMA_NUM_DEV) 171 if (dev_id < 0 || dev_id >= DMA_NUM_DEV)
173 return -EINVAL; 172 return -EINVAL;
174#endif 173#endif
175 174
176 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 175 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++)
177 if (au1000_dma_table[i].dev_id < 0) 176 if (au1000_dma_table[i].dev_id < 0)
178 break; 177 break;
179 } 178
180 if (i == NUM_AU1000_DMA_CHANNELS) 179 if (i == NUM_AU1000_DMA_CHANNELS)
181 return -ENODEV; 180 return -ENODEV;
182 181
@@ -185,15 +184,15 @@ int request_au1000_dma(int dev_id, const char *dev_str,
185 if (dev_id >= DMA_NUM_DEV) { 184 if (dev_id >= DMA_NUM_DEV) {
186 dev_id -= DMA_NUM_DEV; 185 dev_id -= DMA_NUM_DEV;
187 dev = &dma_dev_table_bank2[dev_id]; 186 dev = &dma_dev_table_bank2[dev_id];
188 } else { 187 } else
189 dev = &dma_dev_table[dev_id]; 188 dev = &dma_dev_table[dev_id];
190 }
191 189
192 if (irqhandler) { 190 if (irqhandler) {
193 chan->irq = AU1000_DMA_INT_BASE + i; 191 chan->irq = AU1000_DMA_INT_BASE + i;
194 chan->irq_dev = irq_dev_id; 192 chan->irq_dev = irq_dev_id;
195 if ((ret = request_irq(chan->irq, irqhandler, irqflags, 193 ret = request_irq(chan->irq, irqhandler, irqflags, dev_str,
196 dev_str, chan->irq_dev))) { 194 chan->irq_dev);
195 if (ret) {
197 chan->irq = 0; 196 chan->irq = 0;
198 chan->irq_dev = NULL; 197 chan->irq_dev = NULL;
199 return ret; 198 return ret;
@@ -203,7 +202,7 @@ int request_au1000_dma(int dev_id, const char *dev_str,
203 chan->irq_dev = NULL; 202 chan->irq_dev = NULL;
204 } 203 }
205 204
206 // fill it in 205 /* fill it in */
207 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN; 206 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN;
208 chan->dev_id = dev_id; 207 chan->dev_id = dev_id;
209 chan->dev_str = dev_str; 208 chan->dev_str = dev_str;
@@ -220,8 +219,9 @@ EXPORT_SYMBOL(request_au1000_dma);
220void free_au1000_dma(unsigned int dmanr) 219void free_au1000_dma(unsigned int dmanr)
221{ 220{
222 struct dma_chan *chan = get_dma_chan(dmanr); 221 struct dma_chan *chan = get_dma_chan(dmanr);
222
223 if (!chan) { 223 if (!chan) {
224 printk("Trying to free DMA%d\n", dmanr); 224 printk(KERN_ERR "Error trying to free DMA%d\n", dmanr);
225 return; 225 return;
226 } 226 }
227 227
@@ -235,4 +235,4 @@ void free_au1000_dma(unsigned int dmanr)
235} 235}
236EXPORT_SYMBOL(free_au1000_dma); 236EXPORT_SYMBOL(free_au1000_dma);
237 237
238#endif // AU1000 AU1500 AU1100 238#endif /* AU1000 AU1500 AU1100 */
diff --git a/arch/mips/au1000/common/gpio.c b/arch/mips/au1000/common/gpio.c
index 525452589971..b485d94ce8a5 100644
--- a/arch/mips/au1000/common/gpio.c
+++ b/arch/mips/au1000/common/gpio.c
@@ -69,7 +69,7 @@ static int au1xxx_gpio2_direction_output(unsigned gpio, int value)
69 69
70static int au1xxx_gpio1_read(unsigned gpio) 70static int au1xxx_gpio1_read(unsigned gpio)
71{ 71{
72 return ((gpio1->pinstaterd >> gpio) & 0x01); 72 return (gpio1->pinstaterd >> gpio) & 0x01;
73} 73}
74 74
75static void au1xxx_gpio1_write(unsigned gpio, int value) 75static void au1xxx_gpio1_write(unsigned gpio, int value)
@@ -104,7 +104,6 @@ int au1xxx_gpio_get_value(unsigned gpio)
104 else 104 else
105 return au1xxx_gpio1_read(gpio); 105 return au1xxx_gpio1_read(gpio);
106} 106}
107
108EXPORT_SYMBOL(au1xxx_gpio_get_value); 107EXPORT_SYMBOL(au1xxx_gpio_get_value);
109 108
110void au1xxx_gpio_set_value(unsigned gpio, int value) 109void au1xxx_gpio_set_value(unsigned gpio, int value)
@@ -118,7 +117,6 @@ void au1xxx_gpio_set_value(unsigned gpio, int value)
118 else 117 else
119 au1xxx_gpio1_write(gpio, value); 118 au1xxx_gpio1_write(gpio, value);
120} 119}
121
122EXPORT_SYMBOL(au1xxx_gpio_set_value); 120EXPORT_SYMBOL(au1xxx_gpio_set_value);
123 121
124int au1xxx_gpio_direction_input(unsigned gpio) 122int au1xxx_gpio_direction_input(unsigned gpio)
@@ -132,7 +130,6 @@ int au1xxx_gpio_direction_input(unsigned gpio)
132 130
133 return au1xxx_gpio1_direction_input(gpio); 131 return au1xxx_gpio1_direction_input(gpio);
134} 132}
135
136EXPORT_SYMBOL(au1xxx_gpio_direction_input); 133EXPORT_SYMBOL(au1xxx_gpio_direction_input);
137 134
138int au1xxx_gpio_direction_output(unsigned gpio, int value) 135int au1xxx_gpio_direction_output(unsigned gpio, int value)
@@ -146,5 +143,4 @@ int au1xxx_gpio_direction_output(unsigned gpio, int value)
146 143
147 return au1xxx_gpio1_direction_output(gpio, value); 144 return au1xxx_gpio1_direction_output(gpio, value);
148} 145}
149
150EXPORT_SYMBOL(au1xxx_gpio_direction_output); 146EXPORT_SYMBOL(au1xxx_gpio_direction_output);
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index f0626992fd75..40c6ceceb5f9 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -210,10 +210,8 @@ static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
210 au_sync(); 210 au_sync();
211} 211}
212 212
213
214static inline void mask_and_ack_level_irq(unsigned int irq_nr) 213static inline void mask_and_ack_level_irq(unsigned int irq_nr)
215{ 214{
216
217 local_disable_irq(irq_nr); 215 local_disable_irq(irq_nr);
218 au_sync(); 216 au_sync();
219#if defined(CONFIG_MIPS_PB1000) 217#if defined(CONFIG_MIPS_PB1000)
@@ -263,14 +261,14 @@ void restore_local_and_enable(int controller, unsigned long mask)
263 unsigned long flags, new_mask; 261 unsigned long flags, new_mask;
264 262
265 spin_lock_irqsave(&irq_lock, flags); 263 spin_lock_irqsave(&irq_lock, flags);
266 for (i = 0; i < 32; i++) { 264 for (i = 0; i < 32; i++)
267 if (mask & (1 << i)) { 265 if (mask & (1 << i)) {
268 if (controller) 266 if (controller)
269 local_enable_irq(i + 32); 267 local_enable_irq(i + 32);
270 else 268 else
271 local_enable_irq(i); 269 local_enable_irq(i);
272 } 270 }
273 } 271
274 if (controller) 272 if (controller)
275 new_mask = au_readl(IC1_MASKSET); 273 new_mask = au_readl(IC1_MASKSET);
276 else 274 else
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 7e966b31e3e1..7866cf50cf99 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 PCI support. 3 * Alchemy/AMD Au1x00 PCI support.
4 * 4 *
5 * Copyright 2001-2003, 2007 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007-2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
10 * 9 *
@@ -86,9 +85,9 @@ static int __init au1x_pci_setup(void)
86 u32 prid = read_c0_prid(); 85 u32 prid = read_c0_prid();
87 86
88 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) { 87 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) {
89 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG), 88 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG),
90 Au1500_PCI_CFG); 89 Au1500_PCI_CFG);
91 printk("Non-coherent PCI accesses enabled\n"); 90 printk(KERN_INFO "Non-coherent PCI accesses enabled\n");
92 } 91 }
93 } 92 }
94#endif 93#endif
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index 31d2a2270878..8cae7753ef79 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -269,8 +269,8 @@ static struct platform_device au1x00_pcmcia_device = {
269#ifdef SMBUS_PSC_BASE 269#ifdef SMBUS_PSC_BASE
270static struct resource pbdb_smbus_resources[] = { 270static struct resource pbdb_smbus_resources[] = {
271 { 271 {
272 .start = SMBUS_PSC_BASE, 272 .start = CPHYSADDR(SMBUS_PSC_BASE),
273 .end = SMBUS_PSC_BASE + 0x24 - 1, 273 .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff),
274 .flags = IORESOURCE_MEM, 274 .flags = IORESOURCE_MEM,
275 }, 275 },
276}; 276};
@@ -302,16 +302,17 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
302#endif 302#endif
303}; 303};
304 304
305int __init au1xxx_platform_init(void) 305static int __init au1xxx_platform_init(void)
306{ 306{
307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
308 int i; 308 int i;
309 309
310 /* Fill up uartclk. */ 310 /* Fill up uartclk. */
311 for (i = 0; au1x00_uart_data[i].flags ; i++) 311 for (i = 0; au1x00_uart_data[i].flags; i++)
312 au1x00_uart_data[i].uartclk = uartclk; 312 au1x00_uart_data[i].uartclk = uartclk;
313 313
314 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices)); 314 return platform_add_devices(au1xxx_platform_devices,
315 ARRAY_SIZE(au1xxx_platform_devices));
315} 316}
316 317
317arch_initcall(au1xxx_platform_init); 318arch_initcall(au1xxx_platform_init);
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index a8cd2c1b9e1b..2166b9e1e80c 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1000 Power Management routines. 3 * Au1xx0 Power Management routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Some of the routines are right out of init/main.c, whose 8 * Some of the routines are right out of init/main.c, whose
10 * copyrights apply here. 9 * copyrights apply here.
@@ -43,10 +42,10 @@
43#ifdef CONFIG_PM 42#ifdef CONFIG_PM
44 43
45#define DEBUG 1 44#define DEBUG 1
46#ifdef DEBUG 45#ifdef DEBUG
47# define DPRINTK(fmt, args...) printk("%s: " fmt, __func__, ## args) 46#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args)
48#else 47#else
49# define DPRINTK(fmt, args...) 48#define DPRINTK(fmt, args...)
50#endif 49#endif
51 50
52static void au1000_calibrate_delay(void); 51static void au1000_calibrate_delay(void);
@@ -57,7 +56,8 @@ extern void local_enable_irq(unsigned int irq_nr);
57 56
58static DEFINE_SPINLOCK(pm_lock); 57static DEFINE_SPINLOCK(pm_lock);
59 58
60/* We need to save/restore a bunch of core registers that are 59/*
60 * We need to save/restore a bunch of core registers that are
61 * either volatile or reset to some state across a processor sleep. 61 * either volatile or reset to some state across a processor sleep.
62 * If reading a register doesn't provide a proper result for a 62 * If reading a register doesn't provide a proper result for a
63 * later restore, we have to provide a function for loading that 63 * later restore, we have to provide a function for loading that
@@ -78,24 +78,25 @@ static unsigned int sleep_usbhost_enable;
78static unsigned int sleep_usbdev_enable; 78static unsigned int sleep_usbdev_enable;
79static unsigned int sleep_static_memctlr[4][3]; 79static unsigned int sleep_static_memctlr[4][3];
80 80
81/* Define this to cause the value you write to /proc/sys/pm/sleep to 81/*
82 * Define this to cause the value you write to /proc/sys/pm/sleep to
82 * set the TOY timer for the amount of time you want to sleep. 83 * set the TOY timer for the amount of time you want to sleep.
83 * This is done mainly for testing, but may be useful in other cases. 84 * This is done mainly for testing, but may be useful in other cases.
84 * The value is number of 32KHz ticks to sleep. 85 * The value is number of 32KHz ticks to sleep.
85 */ 86 */
86#define SLEEP_TEST_TIMEOUT 1 87#define SLEEP_TEST_TIMEOUT 1
87#ifdef SLEEP_TEST_TIMEOUT 88#ifdef SLEEP_TEST_TIMEOUT
88static int sleep_ticks; 89static int sleep_ticks;
89void wakeup_counter0_set(int ticks); 90void wakeup_counter0_set(int ticks);
90#endif 91#endif
91 92
92static void 93static void save_core_regs(void)
93save_core_regs(void)
94{ 94{
95 extern void save_au1xxx_intctl(void); 95 extern void save_au1xxx_intctl(void);
96 extern void pm_eth0_shutdown(void); 96 extern void pm_eth0_shutdown(void);
97 97
98 /* Do the serial ports.....these really should be a pm_* 98 /*
99 * Do the serial ports.....these really should be a pm_*
99 * registered function by the driver......but of course the 100 * registered function by the driver......but of course the
100 * standard serial driver doesn't understand our Au1xxx 101 * standard serial driver doesn't understand our Au1xxx
101 * unique registers. 102 * unique registers.
@@ -106,27 +107,24 @@ save_core_regs(void)
106 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK); 107 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK);
107 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL); 108 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL);
108 109
109 /* Shutdown USB host/device. 110 /* Shutdown USB host/device. */
110 */
111 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG); 111 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG);
112 112
113 /* There appears to be some undocumented reset register.... 113 /* There appears to be some undocumented reset register.... */
114 */
115 au_writel(0, 0xb0100004); au_sync(); 114 au_writel(0, 0xb0100004); au_sync();
116 au_writel(0, USB_HOST_CONFIG); au_sync(); 115 au_writel(0, USB_HOST_CONFIG); au_sync();
117 116
118 sleep_usbdev_enable = au_readl(USBD_ENABLE); 117 sleep_usbdev_enable = au_readl(USBD_ENABLE);
119 au_writel(0, USBD_ENABLE); au_sync(); 118 au_writel(0, USBD_ENABLE); au_sync();
120 119
121 /* Save interrupt controller state. 120 /* Save interrupt controller state. */
122 */
123 save_au1xxx_intctl(); 121 save_au1xxx_intctl();
124 122
125 /* Clocks and PLLs. 123 /* Clocks and PLLs. */
126 */
127 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL); 124 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL);
128 125
129 /* We don't really need to do this one, but unless we 126 /*
127 * We don't really need to do this one, but unless we
130 * write it again it won't have a valid value if we 128 * write it again it won't have a valid value if we
131 * happen to read it. 129 * happen to read it.
132 */ 130 */
@@ -134,8 +132,7 @@ save_core_regs(void)
134 132
135 sleep_pin_function = au_readl(SYS_PINFUNC); 133 sleep_pin_function = au_readl(SYS_PINFUNC);
136 134
137 /* Save the static memory controller configuration. 135 /* Save the static memory controller configuration. */
138 */
139 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0); 136 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0);
140 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0); 137 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0);
141 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0); 138 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0);
@@ -150,8 +147,7 @@ save_core_regs(void)
150 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3); 147 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3);
151} 148}
152 149
153static void 150static void restore_core_regs(void)
154restore_core_regs(void)
155{ 151{
156 extern void restore_au1xxx_intctl(void); 152 extern void restore_au1xxx_intctl(void);
157 extern void wakeup_counter0_adjust(void); 153 extern void wakeup_counter0_adjust(void);
@@ -160,8 +156,7 @@ restore_core_regs(void)
160 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync(); 156 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync();
161 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync(); 157 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync();
162 158
163 /* Restore the static memory controller configuration. 159 /* Restore the static memory controller configuration. */
164 */
165 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0); 160 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0);
166 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0); 161 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0);
167 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0); 162 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0);
@@ -175,7 +170,8 @@ restore_core_regs(void)
175 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); 170 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
176 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); 171 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);
177 172
178 /* Enable the UART if it was enabled before sleep. 173 /*
174 * Enable the UART if it was enabled before sleep.
179 * I guess I should define module control bits........ 175 * I guess I should define module control bits........
180 */ 176 */
181 if (sleep_uart0_enable & 0x02) { 177 if (sleep_uart0_enable & 0x02) {
@@ -202,7 +198,7 @@ void wakeup_from_suspend(void)
202int au_sleep(void) 198int au_sleep(void)
203{ 199{
204 unsigned long wakeup, flags; 200 unsigned long wakeup, flags;
205 extern void save_and_sleep(void); 201 extern void save_and_sleep(void);
206 202
207 spin_lock_irqsave(&pm_lock, flags); 203 spin_lock_irqsave(&pm_lock, flags);
208 204
@@ -210,23 +206,22 @@ int au_sleep(void)
210 206
211 flush_cache_all(); 207 flush_cache_all();
212 208
213 /** The code below is all system dependent and we should probably 209 /**
210 ** The code below is all system dependent and we should probably
214 ** have a function call out of here to set this up. You need 211 ** have a function call out of here to set this up. You need
215 ** to configure the GPIO or timer interrupts that will bring 212 ** to configure the GPIO or timer interrupts that will bring
216 ** you out of sleep. 213 ** you out of sleep.
217 ** For testing, the TOY counter wakeup is useful. 214 ** For testing, the TOY counter wakeup is useful.
218 **/ 215 **/
219
220#if 0 216#if 0
221 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD); 217 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD);
222 218
223 /* gpio 6 can cause a wake up event */ 219 /* GPIO 6 can cause a wake up event */
224 wakeup = au_readl(SYS_WAKEMSK); 220 wakeup = au_readl(SYS_WAKEMSK);
225 wakeup &= ~(1 << 8); /* turn off match20 wakeup */ 221 wakeup &= ~(1 << 8); /* turn off match20 wakeup */
226 wakeup |= 1 << 6; /* turn on gpio 6 wakeup */ 222 wakeup |= 1 << 6; /* turn on GPIO 6 wakeup */
227#else 223#else
228 /* For testing, allow match20 to wake us up. 224 /* For testing, allow match20 to wake us up. */
229 */
230#ifdef SLEEP_TEST_TIMEOUT 225#ifdef SLEEP_TEST_TIMEOUT
231 wakeup_counter0_set(sleep_ticks); 226 wakeup_counter0_set(sleep_ticks);
232#endif 227#endif
@@ -240,7 +235,8 @@ int au_sleep(void)
240 235
241 save_and_sleep(); 236 save_and_sleep();
242 237
243 /* after a wakeup, the cpu vectors back to 0x1fc00000 so 238 /*
239 * After a wakeup, the cpu vectors back to 0x1fc00000, so
244 * it's up to the boot code to get us back here. 240 * it's up to the boot code to get us back here.
245 */ 241 */
246 restore_core_regs(); 242 restore_core_regs();
@@ -248,24 +244,22 @@ int au_sleep(void)
248 return 0; 244 return 0;
249} 245}
250 246
251static int pm_do_sleep(ctl_table * ctl, int write, struct file *file, 247static int pm_do_sleep(ctl_table *ctl, int write, struct file *file,
252 void __user *buffer, size_t * len, loff_t *ppos) 248 void __user *buffer, size_t *len, loff_t *ppos)
253{ 249{
254#ifdef SLEEP_TEST_TIMEOUT 250#ifdef SLEEP_TEST_TIMEOUT
255#define TMPBUFLEN2 16 251#define TMPBUFLEN2 16
256 char buf[TMPBUFLEN2], *p; 252 char buf[TMPBUFLEN2], *p;
257#endif 253#endif
258 254
259 if (!write) { 255 if (!write)
260 *len = 0; 256 *len = 0;
261 } else { 257 else {
262#ifdef SLEEP_TEST_TIMEOUT 258#ifdef SLEEP_TEST_TIMEOUT
263 if (*len > TMPBUFLEN2 - 1) { 259 if (*len > TMPBUFLEN2 - 1)
264 return -EFAULT; 260 return -EFAULT;
265 } 261 if (copy_from_user(buf, buffer, *len))
266 if (copy_from_user(buf, buffer, *len)) {
267 return -EFAULT; 262 return -EFAULT;
268 }
269 buf[*len] = 0; 263 buf[*len] = 0;
270 p = buf; 264 p = buf;
271 sleep_ticks = simple_strtoul(p, &p, 0); 265 sleep_ticks = simple_strtoul(p, &p, 0);
@@ -276,8 +270,8 @@ static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,
276 return 0; 270 return 0;
277} 271}
278 272
279static int pm_do_freq(ctl_table * ctl, int write, struct file *file, 273static int pm_do_freq(ctl_table *ctl, int write, struct file *file,
280 void __user *buffer, size_t * len, loff_t *ppos) 274 void __user *buffer, size_t *len, loff_t *ppos)
281{ 275{
282 int retval = 0, i; 276 int retval = 0, i;
283 unsigned long val, pll; 277 unsigned long val, pll;
@@ -285,14 +279,14 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
285#define MAX_CPU_FREQ 396 279#define MAX_CPU_FREQ 396
286 char buf[TMPBUFLEN], *p; 280 char buf[TMPBUFLEN], *p;
287 unsigned long flags, intc0_mask, intc1_mask; 281 unsigned long flags, intc0_mask, intc1_mask;
288 unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, 282 unsigned long old_baud_base, old_cpu_freq, old_clk, old_refresh;
289 old_refresh;
290 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh; 283 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh;
284 unsigned long baud_rate;
291 285
292 spin_lock_irqsave(&pm_lock, flags); 286 spin_lock_irqsave(&pm_lock, flags);
293 if (!write) { 287 if (!write)
294 *len = 0; 288 *len = 0;
295 } else { 289 else {
296 /* Parse the new frequency */ 290 /* Parse the new frequency */
297 if (*len > TMPBUFLEN - 1) { 291 if (*len > TMPBUFLEN - 1) {
298 spin_unlock_irqrestore(&pm_lock, flags); 292 spin_unlock_irqrestore(&pm_lock, flags);
@@ -312,7 +306,7 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
312 306
313 pll = val / 12; 307 pll = val / 12;
314 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */ 308 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */
315 /* revisit this for higher speed cpus */ 309 /* Revisit this for higher speed CPUs */
316 spin_unlock_irqrestore(&pm_lock, flags); 310 spin_unlock_irqrestore(&pm_lock, flags);
317 return -EFAULT; 311 return -EFAULT;
318 } 312 }
@@ -321,30 +315,28 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
321 old_cpu_freq = get_au1x00_speed(); 315 old_cpu_freq = get_au1x00_speed();
322 316
323 new_cpu_freq = pll * 12 * 1000000; 317 new_cpu_freq = pll * 12 * 1000000;
324 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 318 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)
319 & 0x03) + 2) * 16));
325 set_au1x00_speed(new_cpu_freq); 320 set_au1x00_speed(new_cpu_freq);
326 set_au1x00_uart_baud_base(new_baud_base); 321 set_au1x00_uart_baud_base(new_baud_base);
327 322
328 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff; 323 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff;
329 new_refresh = 324 new_refresh = ((old_refresh * new_cpu_freq) / old_cpu_freq) |
330 ((old_refresh * new_cpu_freq) / 325 (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
331 old_cpu_freq) | (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
332 326
333 au_writel(pll, SYS_CPUPLL); 327 au_writel(pll, SYS_CPUPLL);
334 au_sync_delay(1); 328 au_sync_delay(1);
335 au_writel(new_refresh, MEM_SDREFCFG); 329 au_writel(new_refresh, MEM_SDREFCFG);
336 au_sync_delay(1); 330 au_sync_delay(1);
337 331
338 for (i = 0; i < 4; i++) { 332 for (i = 0; i < 4; i++)
339 if (au_readl 333 if (au_readl(UART_BASE + UART_MOD_CNTRL +
340 (UART_BASE + UART_MOD_CNTRL + 334 i * 0x00100000) == 3) {
341 i * 0x00100000) == 3) { 335 old_clk = au_readl(UART_BASE + UART_CLK +
342 old_clk = 336 i * 0x00100000);
343 au_readl(UART_BASE + UART_CLK +
344 i * 0x00100000);
345 // baud_rate = baud_base/clk
346 baud_rate = old_baud_base / old_clk; 337 baud_rate = old_baud_base / old_clk;
347 /* we won't get an exact baud rate and the error 338 /*
339 * We won't get an exact baud rate and the error
348 * could be significant enough that our new 340 * could be significant enough that our new
349 * calculation will result in a clock that will 341 * calculation will result in a clock that will
350 * give us a baud rate that's too far off from 342 * give us a baud rate that's too far off from
@@ -359,18 +351,14 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
359 else if (baud_rate > 17000) 351 else if (baud_rate > 17000)
360 baud_rate = 19200; 352 baud_rate = 19200;
361 else 353 else
362 (baud_rate = 9600); 354 baud_rate = 9600;
363 // new_clk = new_baud_base/baud_rate
364 new_clk = new_baud_base / baud_rate; 355 new_clk = new_baud_base / baud_rate;
365 au_writel(new_clk, 356 au_writel(new_clk, UART_BASE + UART_CLK +
366 UART_BASE + UART_CLK + 357 i * 0x00100000);
367 i * 0x00100000);
368 au_sync_delay(10); 358 au_sync_delay(10);
369 } 359 }
370 }
371 } 360 }
372 361
373
374 /* 362 /*
375 * We don't want _any_ interrupts other than match20. Otherwise our 363 * We don't want _any_ interrupts other than match20. Otherwise our
376 * au1000_calibrate_delay() calculation will be off, potentially a lot. 364 * au1000_calibrate_delay() calculation will be off, potentially a lot.
@@ -428,14 +416,15 @@ static int __init pm_init(void)
428 416
429__initcall(pm_init); 417__initcall(pm_init);
430 418
431
432/* 419/*
433 * This is right out of init/main.c 420 * This is right out of init/main.c
434 */ 421 */
435 422
436/* This is the number of bits of precision for the loops_per_jiffy. Each 423/*
437 bit takes on average 1.5/HZ seconds. This (like the original) is a little 424 * This is the number of bits of precision for the loops_per_jiffy.
438 better than 1% */ 425 * Each bit takes on average 1.5/HZ seconds. This (like the original)
426 * is a little better than 1%.
427 */
439#define LPS_PREC 8 428#define LPS_PREC 8
440 429
441static void au1000_calibrate_delay(void) 430static void au1000_calibrate_delay(void)
@@ -443,14 +432,14 @@ static void au1000_calibrate_delay(void)
443 unsigned long ticks, loopbit; 432 unsigned long ticks, loopbit;
444 int lps_precision = LPS_PREC; 433 int lps_precision = LPS_PREC;
445 434
446 loops_per_jiffy = (1 << 12); 435 loops_per_jiffy = 1 << 12;
447 436
448 while (loops_per_jiffy <<= 1) { 437 while (loops_per_jiffy <<= 1) {
449 /* wait for "start of" clock tick */ 438 /* Wait for "start of" clock tick */
450 ticks = jiffies; 439 ticks = jiffies;
451 while (ticks == jiffies) 440 while (ticks == jiffies)
452 /* nothing */ ; 441 /* nothing */ ;
453 /* Go .. */ 442 /* Go ... */
454 ticks = jiffies; 443 ticks = jiffies;
455 __delay(loops_per_jiffy); 444 __delay(loops_per_jiffy);
456 ticks = jiffies - ticks; 445 ticks = jiffies - ticks;
@@ -458,8 +447,10 @@ static void au1000_calibrate_delay(void)
458 break; 447 break;
459 } 448 }
460 449
461/* Do a binary approximation to get loops_per_jiffy set to equal one clock 450 /*
462 (up to lps_precision bits) */ 451 * Do a binary approximation to get loops_per_jiffy set to be equal
452 * one clock (up to lps_precision bits)
453 */
463 loops_per_jiffy >>= 1; 454 loops_per_jiffy >>= 1;
464 loopbit = loops_per_jiffy; 455 loopbit = loops_per_jiffy;
465 while (lps_precision-- && (loopbit >>= 1)) { 456 while (lps_precision-- && (loopbit >>= 1)) {
@@ -472,4 +463,4 @@ static void au1000_calibrate_delay(void)
472 loops_per_jiffy &= ~loopbit; 463 loops_per_jiffy &= ~loopbit;
473 } 464 }
474} 465}
475#endif /* CONFIG_PM */ 466#endif /* CONFIG_PM */
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index f10af829e4ec..18b310b475ca 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PROM library initialisation code, supports YAMON and U-Boot. 4 * PROM library initialisation code, supports YAMON and U-Boot.
5 * 5 *
6 * Copyright 2000, 2001, 2006 MontaVista Software Inc. 6 * Copyright 2000-2001, 2006, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This file was derived from Carsten Langgaard's 9 * This file was derived from Carsten Langgaard's
11 * arch/mips/mips-boards/xx files. 10 * arch/mips/mips-boards/xx files.
@@ -57,7 +56,7 @@ void prom_init_cmdline(void)
57 actr = 1; /* Always ignore argv[0] */ 56 actr = 1; /* Always ignore argv[0] */
58 57
59 cp = &(arcs_cmdline[0]); 58 cp = &(arcs_cmdline[0]);
60 while(actr < prom_argc) { 59 while (actr < prom_argc) {
61 strcpy(cp, prom_argv[actr]); 60 strcpy(cp, prom_argv[actr]);
62 cp += strlen(prom_argv[actr]); 61 cp += strlen(prom_argv[actr]);
63 *cp++ = ' '; 62 *cp++ = ' ';
@@ -84,10 +83,8 @@ char *prom_getenv(char *envname)
84 if (yamon) { 83 if (yamon) {
85 if (strcmp(envname, *env++) == 0) 84 if (strcmp(envname, *env++) == 0)
86 return *env; 85 return *env;
87 } else { 86 } else if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=')
88 if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') 87 return *env + i + 1;
89 return *env + i + 1;
90 }
91 env++; 88 env++;
92 } 89 }
93 90
@@ -110,13 +107,13 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
110{ 107{
111 int i; 108 int i;
112 109
113 for(i = 0; i < 6; i++) { 110 for (i = 0; i < 6; i++) {
114 unsigned char num; 111 unsigned char num;
115 112
116 if((*str == '.') || (*str == ':')) 113 if ((*str == '.') || (*str == ':'))
117 str++; 114 str++;
118 num = str2hexnum(*str++) << 4; 115 num = str2hexnum(*str++) << 4;
119 num |= (str2hexnum(*str++)); 116 num |= str2hexnum(*str++);
120 ea[i] = num; 117 ea[i] = num;
121 } 118 }
122} 119}
diff --git a/arch/mips/au1000/common/puts.c b/arch/mips/au1000/common/puts.c
index e34c67e89293..55bbe24d45b6 100644
--- a/arch/mips/au1000/common/puts.c
+++ b/arch/mips/au1000/common/puts.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a 16550 uart. 4 * Low level UART routines to directly access Alchemy UART.
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -40,12 +39,12 @@
40 39
41static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE; 40static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE;
42 41
43
44#ifdef SLOW_DOWN 42#ifdef SLOW_DOWN
45static inline void slow_down(void) 43static inline void slow_down(void)
46{ 44{
47 int k; 45 int k;
48 for (k=0; k<10000; k++); 46
47 for (k = 0; k < 10000; k++);
49} 48}
50#else 49#else
51#define slow_down() 50#define slow_down()
@@ -54,16 +53,16 @@ static inline void slow_down(void)
54void 53void
55prom_putchar(const unsigned char c) 54prom_putchar(const unsigned char c)
56{ 55{
57 unsigned char ch; 56 unsigned char ch;
58 int i = 0; 57 int i = 0;
58
59 do {
60 ch = com1[SER_CMD];
61 slow_down();
62 i++;
63 if (i > TIMEOUT)
64 break;
65 } while (0 == (ch & TX_BUSY));
59 66
60 do { 67 com1[SER_DATA] = c;
61 ch = com1[SER_CMD];
62 slow_down();
63 i++;
64 if (i>TIMEOUT) {
65 break;
66 }
67 } while (0 == (ch & TX_BUSY));
68 com1[SER_DATA] = c;
69} 68}
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c
index 60cec537c745..d555429c8d6f 100644
--- a/arch/mips/au1000/common/reset.c
+++ b/arch/mips/au1000/common/reset.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Au1000 reset routines. 4 * Au1xx0 reset routines.
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2006, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -28,10 +27,11 @@
28 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 28 */
30 29
30#include <asm/cacheflush.h>
31
31#include <asm/mach-au1x00/au1000.h> 32#include <asm/mach-au1x00/au1000.h>
32 33
33extern int au_sleep(void); 34extern int au_sleep(void);
34extern void (*flush_cache_all)(void);
35 35
36void au1000_restart(char *command) 36void au1000_restart(char *command)
37{ 37{
@@ -40,8 +40,8 @@ void au1000_restart(char *command)
40 u32 prid = read_c0_prid(); 40 u32 prid = read_c0_prid();
41 41
42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n"); 42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n");
43 switch (prid & 0xFF000000) 43
44 { 44 switch (prid & 0xFF000000) {
45 case 0x00000000: /* Au1000 */ 45 case 0x00000000: /* Au1000 */
46 au_writel(0x02, 0xb0000010); /* ac97_enable */ 46 au_writel(0x02, 0xb0000010); /* ac97_enable */
47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ 47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
@@ -138,9 +138,6 @@ void au1000_restart(char *command)
138 au_writel(0x00, 0xb1900064); /* sys_auxpll */ 138 au_writel(0x00, 0xb1900064); /* sys_auxpll */
139 au_writel(0x00, 0xb1900100); /* sys_pininputen */ 139 au_writel(0x00, 0xb1900100); /* sys_pininputen */
140 break; 140 break;
141
142 default:
143 break;
144 } 141 }
145 142
146 set_c0_status(ST0_BEV | ST0_ERL); 143 set_c0_status(ST0_BEV | ST0_ERL);
@@ -158,25 +155,25 @@ void au1000_restart(char *command)
158void au1000_halt(void) 155void au1000_halt(void)
159{ 156{
160#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550) 157#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550)
161 /* power off system */ 158 /* Power off system */
162 printk("\n** Powering off...\n"); 159 printk(KERN_NOTICE "\n** Powering off...\n");
163 au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C); 160 au_writew(au_readw(0xAF00001C) | (3 << 14), 0xAF00001C);
164 au_sync(); 161 au_sync();
165 while(1); /* should not get here */ 162 while (1); /* should not get here */
166#else 163#else
167 printk(KERN_NOTICE "\n** You can safely turn off the power\n"); 164 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
168#ifdef CONFIG_MIPS_MIRAGE 165#ifdef CONFIG_MIPS_MIRAGE
169 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); 166 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT);
170#endif 167#endif
171#ifdef CONFIG_MIPS_DB1200 168#ifdef CONFIG_MIPS_DB1200
172 au_writew(au_readw(0xB980001C) | (1<<14), 0xB980001C); 169 au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
173#endif 170#endif
174#ifdef CONFIG_PM 171#ifdef CONFIG_PM
175 au_sleep(); 172 au_sleep();
176 173
177 /* should not get here */ 174 /* Should not get here */
178 printk(KERN_ERR "Unable to put cpu in sleep mode\n"); 175 printk(KERN_ERR "Unable to put CPU in sleep mode\n");
179 while(1); 176 while (1);
180#else 177#else
181 while (1) 178 while (1)
182 __asm__(".set\tmips3\n\t" 179 __asm__(".set\tmips3\n\t"
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 0e86f7a6b4a7..1ac6b06f42a3 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2007-2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc. 5 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc.
7 * 6 *
@@ -48,7 +47,7 @@ void __init plat_mem_setup(void)
48{ 47{
49 struct cpu_spec *sp; 48 struct cpu_spec *sp;
50 char *argptr; 49 char *argptr;
51 unsigned long prid, cpufreq, bclk = 1; 50 unsigned long prid, cpufreq, bclk;
52 51
53 set_cpuspec(); 52 set_cpuspec();
54 sp = cur_cpu_spec[0]; 53 sp = cur_cpu_spec[0];
@@ -66,42 +65,39 @@ void __init plat_mem_setup(void)
66 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12; 65 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12;
67 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq); 66 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq);
68 67
69 bclk = sp->cpu_bclk; 68 if (sp->cpu_bclk) {
70 if (bclk)
71 {
72 /* Enable BCLK switching */ 69 /* Enable BCLK switching */
73 bclk = au_readl(0xB190003C); 70 bclk = au_readl(SYS_POWERCTRL);
74 au_writel(bclk | 0x60, 0xB190003C); 71 au_writel(bclk | 0x60, SYS_POWERCTRL);
75 printk("BCLK switching enabled!\n"); 72 printk(KERN_INFO "BCLK switching enabled!\n");
76 } 73 }
77 74
78 if (sp->cpu_od) { 75 if (sp->cpu_od)
79 /* Various early Au1000 Errata corrected by this */ 76 /* Various early Au1xx0 errata corrected by this */
80 set_c0_config(1<<19); /* Set Config[OD] */ 77 set_c0_config(1 << 19); /* Set Config[OD] */
81 } 78 else
82 else {
83 /* Clear to obtain best system bus performance */ 79 /* Clear to obtain best system bus performance */
84 clear_c0_config(1<<19); /* Clear Config[OD] */ 80 clear_c0_config(1 << 19); /* Clear Config[OD] */
85 }
86 81
87 argptr = prom_getcmdline(); 82 argptr = prom_getcmdline();
88 83
89#ifdef CONFIG_SERIAL_8250_CONSOLE 84#ifdef CONFIG_SERIAL_8250_CONSOLE
90 if ((argptr = strstr(argptr, "console=")) == NULL) { 85 argptr = strstr(argptr, "console=");
86 if (argptr == NULL) {
91 argptr = prom_getcmdline(); 87 argptr = prom_getcmdline();
92 strcat(argptr, " console=ttyS0,115200"); 88 strcat(argptr, " console=ttyS0,115200");
93 } 89 }
94#endif 90#endif
95 91
96#ifdef CONFIG_FB_AU1100 92#ifdef CONFIG_FB_AU1100
97 if ((argptr = strstr(argptr, "video=")) == NULL) { 93 argptr = strstr(argptr, "video=");
98 argptr = prom_getcmdline(); 94 if (argptr == NULL) {
99 /* default panel */ 95 argptr = prom_getcmdline();
100 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/ 96 /* default panel */
101 } 97 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
98 }
102#endif 99#endif
103 100
104
105#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000) 101#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
106 /* au1000 does not support vra, au1500 and au1100 do */ 102 /* au1000 does not support vra, au1500 and au1100 do */
107 strcat(argptr, " au1000_audio=vra"); 103 strcat(argptr, " au1000_audio=vra");
@@ -129,7 +125,7 @@ void __init plat_mem_setup(void)
129/* This routine should be valid for all Au1x based boards */ 125/* This routine should be valid for all Au1x based boards */
130phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size) 126phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
131{ 127{
132 /* Don't fixup 36 bit addresses */ 128 /* Don't fixup 36-bit addresses */
133 if ((phys_addr >> 32) != 0) 129 if ((phys_addr >> 32) != 0)
134 return phys_addr; 130 return phys_addr;
135 131
@@ -145,17 +141,17 @@ phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
145 } 141 }
146#endif 142#endif
147 143
148 /* All Au1x SOCs have a pcmcia controller */ 144 /*
149 /* We setup our 32 bit pseudo addresses to be equal to the 145 * All Au1xx0 SOCs have a PCMCIA controller.
150 * 36 bit addr >> 4, to make it easier to check the address 146 * We setup our 32-bit pseudo addresses to be equal to the
147 * 36-bit addr >> 4, to make it easier to check the address
151 * and fix it. 148 * and fix it.
152 * The Au1x socket 0 phys attribute address is 0xF 4000 0000. 149 * The PCMCIA socket 0 physical attribute address is 0xF 4000 0000.
153 * The pseudo address we use is 0xF400 0000. Any address over 150 * The pseudo address we use is 0xF400 0000. Any address over
154 * 0xF400 0000 is a pcmcia pseudo address. 151 * 0xF400 0000 is a PCMCIA pseudo address.
155 */ 152 */
156 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF)) { 153 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF))
157 return (phys_t)(phys_addr << 4); 154 return (phys_t)(phys_addr << 4);
158 }
159 155
160 /* default nop */ 156 /* default nop */
161 return phys_addr; 157 return phys_addr;
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index bdb6d73b26fb..563d9390a872 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -25,11 +25,9 @@
25 * 25 *
26 * Setting up the clock on the MIPS boards. 26 * Setting up the clock on the MIPS boards.
27 * 27 *
28 * Update. Always configure the kernel with CONFIG_NEW_TIME_C. This 28 * We provide the clock interrupt processing and the timer offset compute
29 * will use the user interface gettimeofday() functions from the 29 * functions. If CONFIG_PM is selected, we also ensure the 32KHz timer is
30 * arch/mips/kernel/time.c, and we provide the clock interrupt processing 30 * available. -- Dan
31 * and the timer offset compute functions. If CONFIG_PM is selected,
32 * we also ensure the 32KHz timer is available. -- Dan
33 */ 31 */
34 32
35#include <linux/types.h> 33#include <linux/types.h>
@@ -47,8 +45,7 @@ extern int allow_au1k_wait; /* default off for CP0 Counter */
47#if HZ < 100 || HZ > 1000 45#if HZ < 100 || HZ > 1000
48#error "unsupported HZ value! Must be in [100,1000]" 46#error "unsupported HZ value! Must be in [100,1000]"
49#endif 47#endif
50#define MATCH20_INC (328*100/HZ) /* magic number 328 is for HZ=100... */ 48#define MATCH20_INC (328 * 100 / HZ) /* magic number 328 is for HZ=100... */
51extern void startup_match20_interrupt(irq_handler_t handler);
52static unsigned long last_pc0, last_match20; 49static unsigned long last_pc0, last_match20;
53#endif 50#endif
54 51
@@ -61,7 +58,7 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
61{ 58{
62 unsigned long pc0; 59 unsigned long pc0;
63 int time_elapsed; 60 int time_elapsed;
64 static int jiffie_drift = 0; 61 static int jiffie_drift;
65 62
66 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) { 63 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) {
67 /* should never happen! */ 64 /* should never happen! */
@@ -70,13 +67,11 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
70 } 67 }
71 68
72 pc0 = au_readl(SYS_TOYREAD); 69 pc0 = au_readl(SYS_TOYREAD);
73 if (pc0 < last_match20) { 70 if (pc0 < last_match20)
74 /* counter overflowed */ 71 /* counter overflowed */
75 time_elapsed = (0xffffffff - last_match20) + pc0; 72 time_elapsed = (0xffffffff - last_match20) + pc0;
76 } 73 else
77 else {
78 time_elapsed = pc0 - last_match20; 74 time_elapsed = pc0 - last_match20;
79 }
80 75
81 while (time_elapsed > 0) { 76 while (time_elapsed > 0) {
82 do_timer(1); 77 do_timer(1);
@@ -92,8 +87,9 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
92 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 87 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
93 au_sync(); 88 au_sync();
94 89
95 /* our counter ticks at 10.009765625 ms/tick, we we're running 90 /*
96 * almost 10uS too slow per tick. 91 * Our counter ticks at 10.009765625 ms/tick, we we're running
92 * almost 10 uS too slow per tick.
97 */ 93 */
98 94
99 if (jiffie_drift >= 999) { 95 if (jiffie_drift >= 999) {
@@ -117,20 +113,17 @@ struct irqaction counter0_action = {
117/* When we wakeup from sleep, we have to "catch up" on all of the 113/* When we wakeup from sleep, we have to "catch up" on all of the
118 * timer ticks we have missed. 114 * timer ticks we have missed.
119 */ 115 */
120void 116void wakeup_counter0_adjust(void)
121wakeup_counter0_adjust(void)
122{ 117{
123 unsigned long pc0; 118 unsigned long pc0;
124 int time_elapsed; 119 int time_elapsed;
125 120
126 pc0 = au_readl(SYS_TOYREAD); 121 pc0 = au_readl(SYS_TOYREAD);
127 if (pc0 < last_match20) { 122 if (pc0 < last_match20)
128 /* counter overflowed */ 123 /* counter overflowed */
129 time_elapsed = (0xffffffff - last_match20) + pc0; 124 time_elapsed = (0xffffffff - last_match20) + pc0;
130 } 125 else
131 else {
132 time_elapsed = pc0 - last_match20; 126 time_elapsed = pc0 - last_match20;
133 }
134 127
135 while (time_elapsed > 0) { 128 while (time_elapsed > 0) {
136 time_elapsed -= MATCH20_INC; 129 time_elapsed -= MATCH20_INC;
@@ -143,10 +136,8 @@ wakeup_counter0_adjust(void)
143 136
144} 137}
145 138
146/* This is just for debugging to set the timer for a sleep delay. 139/* This is just for debugging to set the timer for a sleep delay. */
147*/ 140void wakeup_counter0_set(int ticks)
148void
149wakeup_counter0_set(int ticks)
150{ 141{
151 unsigned long pc0; 142 unsigned long pc0;
152 143
@@ -157,21 +148,22 @@ wakeup_counter0_set(int ticks)
157} 148}
158#endif 149#endif
159 150
160/* I haven't found anyone that doesn't use a 12 MHz source clock, 151/*
152 * I haven't found anyone that doesn't use a 12 MHz source clock,
161 * but just in case..... 153 * but just in case.....
162 */ 154 */
163#define AU1000_SRC_CLK 12000000 155#define AU1000_SRC_CLK 12000000
164 156
165/* 157/*
166 * We read the real processor speed from the PLL. This is important 158 * We read the real processor speed from the PLL. This is important
167 * because it is more accurate than computing it from the 32KHz 159 * because it is more accurate than computing it from the 32 KHz
168 * counter, if it exists. If we don't have an accurate processor 160 * counter, if it exists. If we don't have an accurate processor
169 * speed, all of the peripherals that derive their clocks based on 161 * speed, all of the peripherals that derive their clocks based on
170 * this advertised speed will introduce error and sometimes not work 162 * this advertised speed will introduce error and sometimes not work
171 * properly. This function is futher convoluted to still allow configurations 163 * properly. This function is futher convoluted to still allow configurations
172 * to do that in case they have really, really old silicon with a 164 * to do that in case they have really, really old silicon with a
173 * write-only PLL register, that we need the 32KHz when power management 165 * write-only PLL register, that we need the 32 KHz when power management
174 * "wait" is enabled, and we need to detect if the 32KHz isn't present 166 * "wait" is enabled, and we need to detect if the 32 KHz isn't present
175 * but requested......got it? :-) -- Dan 167 * but requested......got it? :-) -- Dan
176 */ 168 */
177unsigned long calc_clock(void) 169unsigned long calc_clock(void)
@@ -182,8 +174,7 @@ unsigned long calc_clock(void)
182 174
183 spin_lock_irqsave(&time_lock, flags); 175 spin_lock_irqsave(&time_lock, flags);
184 176
185 /* Power management cares if we don't have a 32KHz counter. 177 /* Power management cares if we don't have a 32 KHz counter. */
186 */
187 no_au1xxx_32khz = 0; 178 no_au1xxx_32khz = 0;
188 counter = au_readl(SYS_COUNTER_CNTRL); 179 counter = au_readl(SYS_COUNTER_CNTRL);
189 if (counter & SYS_CNTRL_E0) { 180 if (counter & SYS_CNTRL_E0) {
@@ -193,7 +184,7 @@ unsigned long calc_clock(void)
193 184
194 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 185 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
195 /* RTC now ticks at 32.768/16 kHz */ 186 /* RTC now ticks at 32.768/16 kHz */
196 au_writel(trim_divide-1, SYS_RTCTRIM); 187 au_writel(trim_divide - 1, SYS_RTCTRIM);
197 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 188 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
198 189
199 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S); 190 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S);
@@ -215,9 +206,11 @@ unsigned long calc_clock(void)
215#endif 206#endif
216 else 207 else
217 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK; 208 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK;
209 /* On Alchemy CPU:counter ratio is 1:1 */
218 mips_hpt_frequency = cpu_speed; 210 mips_hpt_frequency = cpu_speed;
219 // Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) 211 /* Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) */
220 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 212 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)
213 & 0x03) + 2) * 16));
221 spin_unlock_irqrestore(&time_lock, flags); 214 spin_unlock_irqrestore(&time_lock, flags);
222 return cpu_speed; 215 return cpu_speed;
223} 216}
@@ -228,10 +221,10 @@ void __init plat_time_init(void)
228 221
229 est_freq += 5000; /* round */ 222 est_freq += 5000; /* round */
230 est_freq -= est_freq%10000; 223 est_freq -= est_freq%10000;
231 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000, 224 printk(KERN_INFO "CPU frequency %u.%02u MHz\n",
232 (est_freq%1000000)*100/1000000); 225 est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000);
233 set_au1x00_speed(est_freq); 226 set_au1x00_speed(est_freq);
234 set_au1x00_lcd_clock(); // program the LCD clock 227 set_au1x00_lcd_clock(); /* program the LCD clock */
235 228
236#ifdef CONFIG_PM 229#ifdef CONFIG_PM
237 /* 230 /*
@@ -243,30 +236,29 @@ void __init plat_time_init(void)
243 * counter 0 interrupt as a special irq and it doesn't show 236 * counter 0 interrupt as a special irq and it doesn't show
244 * up under /proc/interrupts. 237 * up under /proc/interrupts.
245 * 238 *
246 * Check to ensure we really have a 32KHz oscillator before 239 * Check to ensure we really have a 32 KHz oscillator before
247 * we do this. 240 * we do this.
248 */ 241 */
249 if (no_au1xxx_32khz) 242 if (no_au1xxx_32khz)
250 printk("WARNING: no 32KHz clock found.\n"); 243 printk(KERN_WARNING "WARNING: no 32KHz clock found.\n");
251 else { 244 else {
252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 245 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
253 au_writel(0, SYS_TOYWRITE); 246 au_writel(0, SYS_TOYWRITE);
254 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 247 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
255 248
256 au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK); 249 au_writel(au_readl(SYS_WAKEMSK) | (1 << 8), SYS_WAKEMSK);
257 au_writel(~0, SYS_WAKESRC); 250 au_writel(~0, SYS_WAKESRC);
258 au_sync(); 251 au_sync();
259 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
260 253
261 /* setup match20 to interrupt once every HZ */ 254 /* Setup match20 to interrupt once every HZ */
262 last_pc0 = last_match20 = au_readl(SYS_TOYREAD); 255 last_pc0 = last_match20 = au_readl(SYS_TOYREAD);
263 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 256 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
264 au_sync(); 257 au_sync();
265 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 258 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
266 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action); 259 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action);
267 260
268 /* We can use the real 'wait' instruction. 261 /* We can use the real 'wait' instruction. */
269 */
270 allow_au1k_wait = 1; 262 allow_au1k_wait = 1;
271 } 263 }
272 264
diff --git a/arch/mips/au1000/db1x00/Makefile b/arch/mips/au1000/db1x00/Makefile
index 51d62bd5d900..274db3b55d82 100644
--- a/arch/mips/au1000/db1x00/Makefile
+++ b/arch/mips/au1000/db1x00/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com 4#
5# Makefile for the Alchemy Semiconductor DBAu1xx0 boards.
5# 6#
6# Makefile for the Alchemy Semiconductor Db1x00 board.
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/db1x00/board_setup.c b/arch/mips/au1000/db1x00/board_setup.c
index b7dcbad5c586..9e5ccbbfcedd 100644
--- a/arch/mips/au1000/db1x00/board_setup.c
+++ b/arch/mips/au1000/db1x00/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Db1x00 board setup. 4 * Alchemy Db1x00 board setup.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -37,49 +36,49 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
37 36
38void board_reset(void) 37void board_reset(void)
39{ 38{
40 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 39 /* Hit BCSR.SW_RESET[RESET] */
41 bcsr->swreset = 0x0000; 40 bcsr->swreset = 0x0000;
42} 41}
43 42
44void __init board_setup(void) 43void __init board_setup(void)
45{ 44{
46 u32 pin_func; 45 u32 pin_func = 0;
47 46
48 pin_func = 0; 47 /* Not valid for Au1550 */
49 /* not valid for 1550 */ 48#if defined(CONFIG_IRDA) && \
50 49 (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
51#if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100)) 50 /* Set IRFIRSEL instead of GPIO15 */
52 /* set IRFIRSEL instead of GPIO15 */ 51 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
53 pin_func = au_readl(SYS_PINFUNC) | (u32)((1<<8));
54 au_writel(pin_func, SYS_PINFUNC); 52 au_writel(pin_func, SYS_PINFUNC);
55 /* power off until the driver is in use */ 53 /* Power off until the driver is in use */
56 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK; 54 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
57 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF; 55 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF;
58 au_sync(); 56 au_sync();
59#endif 57#endif
60 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */ 58 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
61 59
62#ifdef CONFIG_MIPS_MIRAGE 60#ifdef CONFIG_MIPS_MIRAGE
63 /* enable GPIO[31:0] inputs */ 61 /* Enable GPIO[31:0] inputs */
64 au_writel(0, SYS_PININPUTEN); 62 au_writel(0, SYS_PININPUTEN);
65 63
66 /* GPIO[20] is output, tristate the other input primary GPIO's */ 64 /* GPIO[20] is output, tristate the other input primary GPIOs */
67 au_writel((u32)(~(1<<20)), SYS_TRIOUTCLR); 65 au_writel(~(1 << 20), SYS_TRIOUTCLR);
68 66
69 /* set GPIO[210:208] instead of SSI_0 */ 67 /* Set GPIO[210:208] instead of SSI_0 */
70 pin_func = au_readl(SYS_PINFUNC) | (u32)(1); 68 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
71 69
72 /* set GPIO[215:211] for LED's */ 70 /* Set GPIO[215:211] for LEDs */
73 pin_func |= (u32)((5<<2)); 71 pin_func |= 5 << 2;
74 72
75 /* set GPIO[214:213] for more LED's */ 73 /* Set GPIO[214:213] for more LEDs */
76 pin_func |= (u32)((5<<12)); 74 pin_func |= 5 << 12;
77 75
78 /* set GPIO[207:200] instead of PCMCIA/LCD */ 76 /* Set GPIO[207:200] instead of PCMCIA/LCD */
79 pin_func |= (u32)((3<<17)); 77 pin_func |= SYS_PF_LCD | SYS_PF_PC;
80 au_writel(pin_func, SYS_PINFUNC); 78 au_writel(pin_func, SYS_PINFUNC);
81 79
82 /* Enable speaker amplifier. This should 80 /*
81 * Enable speaker amplifier. This should
83 * be part of the audio driver. 82 * be part of the audio driver.
84 */ 83 */
85 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR); 84 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR);
@@ -89,21 +88,21 @@ void __init board_setup(void)
89 au_sync(); 88 au_sync();
90 89
91#ifdef CONFIG_MIPS_DB1000 90#ifdef CONFIG_MIPS_DB1000
92 printk("AMD Alchemy Au1000/Db1000 Board\n"); 91 printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
93#endif 92#endif
94#ifdef CONFIG_MIPS_DB1500 93#ifdef CONFIG_MIPS_DB1500
95 printk("AMD Alchemy Au1500/Db1500 Board\n"); 94 printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
96#endif 95#endif
97#ifdef CONFIG_MIPS_DB1100 96#ifdef CONFIG_MIPS_DB1100
98 printk("AMD Alchemy Au1100/Db1100 Board\n"); 97 printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
99#endif 98#endif
100#ifdef CONFIG_MIPS_BOSPORUS 99#ifdef CONFIG_MIPS_BOSPORUS
101 printk("AMD Alchemy Bosporus Board\n"); 100 printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
102#endif 101#endif
103#ifdef CONFIG_MIPS_MIRAGE 102#ifdef CONFIG_MIPS_MIRAGE
104 printk("AMD Alchemy Mirage Board\n"); 103 printk(KERN_INFO "AMD Alchemy Mirage Board\n");
105#endif 104#endif
106#ifdef CONFIG_MIPS_DB1550 105#ifdef CONFIG_MIPS_DB1550
107 printk("AMD Alchemy Au1550/Db1550 Board\n"); 106 printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
108#endif 107#endif
109} 108}
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index d3b967caf70c..5ebe0de5e459 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup 3 * PB1000 board setup
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -49,8 +48,8 @@ void __init prom_init(void)
49 unsigned long memsize; 48 unsigned long memsize;
50 49
51 prom_argc = fw_arg0; 50 prom_argc = fw_arg0;
52 prom_argv = (char **) fw_arg1; 51 prom_argv = (char **)fw_arg1;
53 prom_envp = (char **) fw_arg2; 52 prom_envp = (char **)fw_arg2;
54 53
55 prom_init_cmdline(); 54 prom_init_cmdline();
56 55
@@ -58,6 +57,6 @@ void __init prom_init(void)
58 if (!memsize_str) 57 if (!memsize_str)
59 memsize = 0x04000000; 58 memsize = 0x04000000;
60 else 59 else
61 memsize = simple_strtol(memsize_str, NULL, 0); 60 memsize = strict_strtol(memsize_str, 0, NULL);
62 add_memory_region(0, memsize, BOOT_MEM_RAM); 61 add_memory_region(0, memsize, BOOT_MEM_RAM);
63} 62}
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
index eaa50c7b6341..94c090e8bf7a 100644
--- a/arch/mips/au1000/db1x00/irqmap.c
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -32,32 +32,32 @@
32 32
33#ifdef CONFIG_MIPS_DB1500 33#ifdef CONFIG_MIPS_DB1500
34char irq_tab_alchemy[][5] __initdata = { 34char irq_tab_alchemy[][5] __initdata = {
35 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT371 */ 35 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT371 */
36 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 36 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
37}; 37};
38#endif 38#endif
39 39
40#ifdef CONFIG_MIPS_BOSPORUS 40#ifdef CONFIG_MIPS_BOSPORUS
41char irq_tab_alchemy[][5] __initdata = { 41char irq_tab_alchemy[][5] __initdata = {
42 [11] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 11 - miniPCI */ 42 [11] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 11 - miniPCI */
43 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - SN1741 */ 43 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - SN1741 */
44 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 44 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
45}; 45};
46#endif 46#endif
47 47
48#ifdef CONFIG_MIPS_MIRAGE 48#ifdef CONFIG_MIPS_MIRAGE
49char irq_tab_alchemy[][5] __initdata = { 49char irq_tab_alchemy[][5] __initdata = {
50 [11] = { -1, INTD, INTX, INTX, INTX}, /* IDSEL 11 - SMI VGX */ 50 [11] = { -1, INTD, INTX, INTX, INTX }, /* IDSEL 11 - SMI VGX */
51 [12] = { -1, INTX, INTX, INTC, INTX}, /* IDSEL 12 - PNX1300 */ 51 [12] = { -1, INTX, INTX, INTC, INTX }, /* IDSEL 12 - PNX1300 */
52 [13] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 13 - miniPCI */ 52 [13] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 13 - miniPCI */
53}; 53};
54#endif 54#endif
55 55
56#ifdef CONFIG_MIPS_DB1550 56#ifdef CONFIG_MIPS_DB1550
57char irq_tab_alchemy[][5] __initdata = { 57char irq_tab_alchemy[][5] __initdata = {
58 [11] = { -1, INTC, INTX, INTX, INTX}, /* IDSEL 11 - on-board HPT371 */ 58 [11] = { -1, INTC, INTX, INTX, INTX }, /* IDSEL 11 - on-board HPT371 */
59 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */ 59 [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
60 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 60 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
61}; 61};
62#endif 62#endif
63 63
diff --git a/arch/mips/au1000/mtx-1/Makefile b/arch/mips/au1000/mtx-1/Makefile
index 85a90941de4f..7c67b3d33bec 100644
--- a/arch/mips/au1000/mtx-1/Makefile
+++ b/arch/mips/au1000/mtx-1/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Copyright 2003 MontaVista Software Inc. 2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# Bruno Randolf <bruno.randolf@4g-systems.biz> 4# Bruno Randolf <bruno.randolf@4g-systems.biz>
6# 5#
7# Makefile for 4G Systems MTX-1 board. 6# Makefile for 4G Systems MTX-1 board.
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c
index 5736354829c6..3f8079186cf2 100644
--- a/arch/mips/au1000/mtx-1/board_setup.c
+++ b/arch/mips/au1000/mtx-1/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup. 4 * 4G Systems MTX-1 board setup.
5 * 5 *
6 * Copyright 2003 MontaVista Software Inc. 6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz> 8 * Bruno Randolf <bruno.randolf@4g-systems.biz>
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
@@ -34,7 +33,7 @@
34#include <asm/mach-au1x00/au1000.h> 33#include <asm/mach-au1x00/au1000.h>
35 34
36extern int (*board_pci_idsel)(unsigned int devsel, int assert); 35extern int (*board_pci_idsel)(unsigned int devsel, int assert);
37int mtx1_pci_idsel(unsigned int devsel, int assert); 36int mtx1_pci_idsel(unsigned int devsel, int assert);
38 37
39void board_reset(void) 38void board_reset(void)
40{ 39{
@@ -45,36 +44,36 @@ void board_reset(void)
45void __init board_setup(void) 44void __init board_setup(void)
46{ 45{
47#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 46#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
48 // enable USB power switch 47 /* Enable USB power switch */
49 au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR ); 48 au_writel(au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR);
50 au_writel( 0x100000, GPIO2_OUTPUT ); 49 au_writel(0x100000, GPIO2_OUTPUT);
51#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 50#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
52 51
53#ifdef CONFIG_PCI 52#ifdef CONFIG_PCI
54#if defined(__MIPSEB__) 53#if defined(__MIPSEB__)
55 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 54 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
56#else 55#else
57 au_writel(0xf, Au1500_PCI_CFG); 56 au_writel(0xf, Au1500_PCI_CFG);
58#endif 57#endif
59#endif 58#endif
60 59
61 // initialize sys_pinfunc: 60 /* Initialize sys_pinfunc */
62 au_writel( SYS_PF_NI2, SYS_PINFUNC ); 61 au_writel(SYS_PF_NI2, SYS_PINFUNC);
63 62
64 // initialize GPIO 63 /* Initialize GPIO */
65 au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); 64 au_writel(0xFFFFFFFF, SYS_TRIOUTCLR);
66 au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF 65 au_writel(0x00000001, SYS_OUTPUTCLR); /* set M66EN (PCI 66MHz) to OFF */
67 au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF 66 au_writel(0x00000008, SYS_OUTPUTSET); /* set PCI CLKRUN# to OFF */
68 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON 67 au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
69 au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF 68 au_writel(0x00000020, SYS_OUTPUTCLR); /* set eth PHY TX_ER to OFF */
70 69
71 // enable LED and set it to green 70 /* Enable LED and set it to green */
72 au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); 71 au_writel(au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR);
73 au_writel( 0x18000800, GPIO2_OUTPUT ); 72 au_writel(0x18000800, GPIO2_OUTPUT);
74 73
75 board_pci_idsel = mtx1_pci_idsel; 74 board_pci_idsel = mtx1_pci_idsel;
76 75
77 printk("4G Systems MTX-1 Board\n"); 76 printk(KERN_INFO "4G Systems MTX-1 Board\n");
78} 77}
79 78
80int 79int
@@ -82,20 +81,18 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
82{ 81{
83#define MTX_IDSEL_ONLY_0_AND_3 0 82#define MTX_IDSEL_ONLY_0_AND_3 0
84#if MTX_IDSEL_ONLY_0_AND_3 83#if MTX_IDSEL_ONLY_0_AND_3
85 if (devsel != 0 && devsel != 3) { 84 if (devsel != 0 && devsel != 3) {
86 printk("*** not 0 or 3\n"); 85 printk(KERN_ERR "*** not 0 or 3\n");
87 return 0; 86 return 0;
88 } 87 }
89#endif 88#endif
90 89
91 if (assert && devsel != 0) { 90 if (assert && devsel != 0)
92 // suppress signal to cardbus 91 /* Suppress signal to Cardbus */
93 au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF 92 au_writel(0x00000002, SYS_OUTPUTCLR); /* set EXT_IO3 OFF */
94 } 93 else
95 else { 94 au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
96 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON 95 au_sync_udelay(1);
97 } 96 return 1;
98 au_sync_udelay(1);
99 return 1;
100} 97}
101 98
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
index c015cbce1cca..33a4aebe0cba 100644
--- a/arch/mips/au1000/mtx-1/init.c
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup 4 * 4G Systems MTX-1 board setup
5 * 5 *
6 * Copyright 2003 MontaVista Software Inc. 6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz> 8 * Bruno Randolf <bruno.randolf@4g-systems.biz>
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
@@ -47,8 +46,8 @@ void __init prom_init(void)
47 unsigned long memsize; 46 unsigned long memsize;
48 47
49 prom_argc = fw_arg0; 48 prom_argc = fw_arg0;
50 prom_argv = (char **) fw_arg1; 49 prom_argv = (char **)fw_arg1;
51 prom_envp = (char **) fw_arg2; 50 prom_envp = (char **)fw_arg2;
52 51
53 prom_init_cmdline(); 52 prom_init_cmdline();
54 53
@@ -56,6 +55,6 @@ void __init prom_init(void)
56 if (!memsize_str) 55 if (!memsize_str)
57 memsize = 0x04000000; 56 memsize = 0x04000000;
58 else 57 else
59 memsize = simple_strtol(memsize_str, NULL, 0); 58 memsize = strict_strtol(memsize_str, 0, NULL);
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 60}
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index 78d70c42c9db..f2bf02951e9c 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -31,18 +31,18 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [0] = { -1, INTA, INTA, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */ 34 [0] = { -1, INTA, INTA, INTX, INTX }, /* IDSEL 00 - AdapterA-Slot0 (top) */
35 [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ 35 [1] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
36 [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */ 36 [2] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 02 - AdapterB-Slot0 (top) */
37 [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ 37 [3] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
38 [4] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 04 - AdapterC-Slot0 (top) */ 38 [4] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 04 - AdapterC-Slot0 (top) */
39 [5] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 05 - AdapterC-Slot1 (bottom) */ 39 [5] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
40 [6] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 06 - AdapterD-Slot0 (top) */ 40 [6] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 06 - AdapterD-Slot0 (top) */
41 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ 41 [7] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
42}; 42};
43 43
44struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 44struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
45 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 45 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
46 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 46 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
47 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 47 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
48 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 48 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/mtx-1/platform.c b/arch/mips/au1000/mtx-1/platform.c
index a7edbf0829ac..9807be37c32f 100644
--- a/arch/mips/au1000/mtx-1/platform.c
+++ b/arch/mips/au1000/mtx-1/platform.c
@@ -21,11 +21,10 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/gpio.h>
24#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
25#include <linux/input.h> 26#include <linux/input.h>
26 27
27#include <asm/gpio.h>
28
29static struct gpio_keys_button mtx1_gpio_button[] = { 28static struct gpio_keys_button mtx1_gpio_button[] = {
30 { 29 {
31 .gpio = 207, 30 .gpio = 207,
diff --git a/arch/mips/au1000/pb1000/Makefile b/arch/mips/au1000/pb1000/Makefile
index daa1a507e72f..99bbec0ca41b 100644
--- a/arch/mips/au1000/pb1000/Makefile
+++ b/arch/mips/au1000/pb1000/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com 4#
5# Makefile for the Alchemy Semiconductor Pb1000 board.
5# 6#
6# Makefile for the Alchemy Semiconductor PB1000 board.
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1000/board_setup.c b/arch/mips/au1000/pb1000/board_setup.c
index 33f15acc1b17..25df167a95b3 100644
--- a/arch/mips/au1000/pb1000/board_setup.c
+++ b/arch/mips/au1000/pb1000/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * 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
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -40,128 +39,126 @@ void __init board_setup(void)
40 u32 sys_freqctrl, sys_clksrc; 39 u32 sys_freqctrl, sys_clksrc;
41 u32 prid = read_c0_prid(); 40 u32 prid = read_c0_prid();
42 41
43 // set AUX clock to 12MHz * 8 = 96 MHz 42 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
44 au_writel(8, SYS_AUXPLL); 43 au_writel(8, SYS_AUXPLL);
45 au_writel(0, SYS_PINSTATERD); 44 au_writel(0, SYS_PINSTATERD);
46 udelay(100); 45 udelay(100);
47 46
48#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 47#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
49 /* zero and disable FREQ2 */ 48 /* Zero and disable FREQ2 */
50 sys_freqctrl = au_readl(SYS_FREQCTRL0); 49 sys_freqctrl = au_readl(SYS_FREQCTRL0);
51 sys_freqctrl &= ~0xFFF00000; 50 sys_freqctrl &= ~0xFFF00000;
52 au_writel(sys_freqctrl, SYS_FREQCTRL0); 51 au_writel(sys_freqctrl, SYS_FREQCTRL0);
53 52
54 /* zero and disable USBH/USBD clocks */ 53 /* Zero and disable USBH/USBD clocks */
55 sys_clksrc = au_readl(SYS_CLKSRC); 54 sys_clksrc = au_readl(SYS_CLKSRC);
56 sys_clksrc &= ~0x00007FE0; 55 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
56 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
57 au_writel(sys_clksrc, SYS_CLKSRC); 57 au_writel(sys_clksrc, SYS_CLKSRC);
58 58
59 sys_freqctrl = au_readl(SYS_FREQCTRL0); 59 sys_freqctrl = au_readl(SYS_FREQCTRL0);
60 sys_freqctrl &= ~0xFFF00000; 60 sys_freqctrl &= ~0xFFF00000;
61 61
62 sys_clksrc = au_readl(SYS_CLKSRC); 62 sys_clksrc = au_readl(SYS_CLKSRC);
63 sys_clksrc &= ~0x00007FE0; 63 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
64 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
64 65
65 switch (prid & 0x000000FF) 66 switch (prid & 0x000000FF) {
66 {
67 case 0x00: /* DA */ 67 case 0x00: /* DA */
68 case 0x01: /* HA */ 68 case 0x01: /* HA */
69 case 0x02: /* HB */ 69 case 0x02: /* HB */
70 /* CPU core freq to 48MHz to slow it way down... */ 70 /* CPU core freq to 48 MHz to slow it way down... */
71 au_writel(4, SYS_CPUPLL); 71 au_writel(4, SYS_CPUPLL);
72 72
73 /* 73 /*
74 * Setup 48MHz FREQ2 from CPUPLL for USB Host 74 * Setup 48 MHz FREQ2 from CPUPLL for USB Host
75 */ 75 * FRDIV2 = 3 -> div by 8 of 384 MHz -> 48 MHz
76 /* FRDIV2=3 -> div by 8 of 384MHz -> 48MHz */ 76 */
77 sys_freqctrl |= ((3<<22) | (1<<21) | (0<<20)); 77 sys_freqctrl |= (3 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2;
78 au_writel(sys_freqctrl, SYS_FREQCTRL0); 78 au_writel(sys_freqctrl, SYS_FREQCTRL0);
79 79
80 /* CPU core freq to 384MHz */ 80 /* CPU core freq to 384 MHz */
81 au_writel(0x20, SYS_CPUPLL); 81 au_writel(0x20, SYS_CPUPLL);
82 82
83 printk("Au1000: 48MHz OHCI workaround enabled\n"); 83 printk(KERN_INFO "Au1000: 48 MHz OHCI workaround enabled\n");
84 break; 84 break;
85 85
86 default: /* HC and newer */ 86 default: /* HC and newer */
87 // FREQ2 = aux/2 = 48 MHz 87 /* FREQ2 = aux / 2 = 48 MHz */
88 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 88 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) |
89 au_writel(sys_freqctrl, SYS_FREQCTRL0); 89 SYS_FC_FE2 | SYS_FC_FS2;
90 au_writel(sys_freqctrl, SYS_FREQCTRL0);
90 break; 91 break;
91 } 92 }
92 93
93 /* 94 /*
94 * Route 48MHz FREQ2 into USB Host and/or Device 95 * Route 48 MHz FREQ2 into USB Host and/or Device
95 */ 96 */
96#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 97 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT;
97 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
98#endif
99 au_writel(sys_clksrc, SYS_CLKSRC); 98 au_writel(sys_clksrc, SYS_CLKSRC);
100 99
101 // configure pins GPIO[14:9] as GPIO 100 /* Configure pins GPIO[14:9] as GPIO */
102 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080); 101 pin_func = au_readl(SYS_PINFUNC) & ~(SYS_PF_UR3 | SYS_PF_USB);
103 102
104 // 2nd USB port is USB host 103 /* 2nd USB port is USB host */
105 pin_func |= 0x8000; 104 pin_func |= SYS_PF_USB;
106 105
107 au_writel(pin_func, SYS_PINFUNC); 106 au_writel(pin_func, SYS_PINFUNC);
108 au_writel(0x2800, SYS_TRIOUTCLR); 107 au_writel(0x2800, SYS_TRIOUTCLR);
109 au_writel(0x0030, SYS_OUTPUTCLR); 108 au_writel(0x0030, SYS_OUTPUTCLR);
110#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 109#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
111 110
112 // make gpio 15 an input (for interrupt line) 111 /* Make GPIO 15 an input (for interrupt line) */
113 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100); 112 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_IRF;
114 // we don't need I2S, so make it available for GPIO[31:29] 113 /* We don't need I2S, so make it available for GPIO[31:29] */
115 pin_func |= (1<<5); 114 pin_func |= SYS_PF_I2S;
116 au_writel(pin_func, SYS_PINFUNC); 115 au_writel(pin_func, SYS_PINFUNC);
117 116
118 au_writel(0x8000, SYS_TRIOUTCLR); 117 au_writel(0x8000, SYS_TRIOUTCLR);
119 118
120 static_cfg0 = au_readl(MEM_STCFG0) & (u32)(~0xc00); 119 static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00;
121 au_writel(static_cfg0, MEM_STCFG0); 120 au_writel(static_cfg0, MEM_STCFG0);
122 121
123 // configure RCE2* for LCD 122 /* configure RCE2* for LCD */
124 au_writel(0x00000004, MEM_STCFG2); 123 au_writel(0x00000004, MEM_STCFG2);
125 124
126 // MEM_STTIME2 125 /* MEM_STTIME2 */
127 au_writel(0x09000000, MEM_STTIME2); 126 au_writel(0x09000000, MEM_STTIME2);
128 127
129 // Set 32-bit base address decoding for RCE2* 128 /* Set 32-bit base address decoding for RCE2* */
130 au_writel(0x10003ff0, MEM_STADDR2); 129 au_writel(0x10003ff0, MEM_STADDR2);
131 130
132 // PCI CPLD setup 131 /*
133 // expand CE0 to cover PCI 132 * PCI CPLD setup
133 * Expand CE0 to cover PCI
134 */
134 au_writel(0x11803e40, MEM_STADDR1); 135 au_writel(0x11803e40, MEM_STADDR1);
135 136
136 // burst visibility on 137 /* Burst visibility on */
137 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0); 138 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0);
138 139
139 au_writel(0x83, MEM_STCFG1); // ewait enabled, flash timing 140 au_writel(0x83, MEM_STCFG1); /* ewait enabled, flash timing */
140 au_writel(0x33030a10, MEM_STTIME1); // slower timing for FPGA 141 au_writel(0x33030a10, MEM_STTIME1); /* slower timing for FPGA */
141 142
142 /* setup the static bus controller */ 143 /* Setup the static bus controller */
143 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 144 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
144 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 145 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
145 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 146 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
146 147
147#ifdef CONFIG_PCI 148 /*
148 au_writel(0, PCI_BRIDGE_CONFIG); // set extend byte to 0 149 * Enable Au1000 BCLK switching - note: sed1356 must not use
149 au_writel(0, SDRAM_MBAR); // set mbar to 0 150 * its BCLK (Au1000 LCLK) for any timings
150 au_writel(0x2, SDRAM_CMD); // enable memory accesses 151 */
151 au_sync_delay(1); 152 switch (prid & 0x000000FF) {
152#endif
153
154 /* Enable Au1000 BCLK switching - note: sed1356 must not use
155 * its BCLK (Au1000 LCLK) for any timings */
156 switch (prid & 0x000000FF)
157 {
158 case 0x00: /* DA */ 153 case 0x00: /* DA */
159 case 0x01: /* HA */ 154 case 0x01: /* HA */
160 case 0x02: /* HB */ 155 case 0x02: /* HB */
161 break; 156 break;
162 default: /* HC and newer */ 157 default: /* HC and newer */
163 /* Enable sys bus clock divider when IDLE state or no bus 158 /*
164 activity. */ 159 * Enable sys bus clock divider when IDLE state or no bus
160 * activity.
161 */
165 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 162 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
166 break; 163 break;
167 } 164 }
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
index 549447df71d6..3837365d613d 100644
--- a/arch/mips/au1000/pb1000/init.c
+++ b/arch/mips/au1000/pb1000/init.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup 3 * Pb1000 board setup
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -44,16 +43,15 @@ void __init prom_init(void)
44 unsigned char *memsize_str; 43 unsigned char *memsize_str;
45 unsigned long memsize; 44 unsigned long memsize;
46 45
47 prom_argc = (int) fw_arg0; 46 prom_argc = (int)fw_arg0;
48 prom_argv = (char **) fw_arg1; 47 prom_argv = (char **)fw_arg1;
49 prom_envp = (char **) fw_arg2; 48 prom_envp = (char **)fw_arg2;
50 49
51 prom_init_cmdline(); 50 prom_init_cmdline();
52 memsize_str = prom_getenv("memsize"); 51 memsize_str = prom_getenv("memsize");
53 if (!memsize_str) { 52 if (!memsize_str)
54 memsize = 0x04000000; 53 memsize = 0x04000000;
55 } else { 54 else
56 memsize = simple_strtol(memsize_str, NULL, 0); 55 memsize = strict_strtol(memsize_str, 0, NULL);
57 }
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 56 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 57}
diff --git a/arch/mips/au1000/pb1100/Makefile b/arch/mips/au1000/pb1100/Makefile
index 996236df6375..793e97c49e46 100644
--- a/arch/mips/au1000/pb1100/Makefile
+++ b/arch/mips/au1000/pb1100/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000,2001 MontaVista Software Inc. 2# Copyright 2000, 2001, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor Pb1100 board. 5# Makefile for the Alchemy Semiconductor Pb1100 board.
6#
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1100/board_setup.c b/arch/mips/au1000/pb1100/board_setup.c
index 656164c8e9ca..c0bfd59a7a36 100644
--- a/arch/mips/au1000/pb1100/board_setup.c
+++ b/arch/mips/au1000/pb1100/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2002 MontaVista Software Inc. 2 * Copyright 2002, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * 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
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -32,15 +31,15 @@
32 31
33void board_reset(void) 32void board_reset(void)
34{ 33{
35 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 34 /* Hit BCSR.RST_VDDI[SOFT_RESET] */
36 au_writel(0x00000000, 0xAE00001C); 35 au_writel(0x00000000, PB1100_RST_VDDI);
37} 36}
38 37
39void __init board_setup(void) 38void __init board_setup(void)
40{ 39{
41 volatile void __iomem * base = (volatile void __iomem *) 0xac000000UL; 40 volatile void __iomem *base = (volatile void __iomem *)0xac000000UL;
42 41
43 // set AUX clock to 12MHz * 8 = 96 MHz 42 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
44 au_writel(8, SYS_AUXPLL); 43 au_writel(8, SYS_AUXPLL);
45 au_writel(0, SYS_PININPUTEN); 44 au_writel(0, SYS_PININPUTEN);
46 udelay(100); 45 udelay(100);
@@ -49,44 +48,47 @@ void __init board_setup(void)
49 { 48 {
50 u32 pin_func, sys_freqctrl, sys_clksrc; 49 u32 pin_func, sys_freqctrl, sys_clksrc;
51 50
52 // configure pins GPIO[14:9] as GPIO 51 /* Configure pins GPIO[14:9] as GPIO */
53 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80); 52 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
54 53
55 /* zero and disable FREQ2 */ 54 /* Zero and disable FREQ2 */
56 sys_freqctrl = au_readl(SYS_FREQCTRL0); 55 sys_freqctrl = au_readl(SYS_FREQCTRL0);
57 sys_freqctrl &= ~0xFFF00000; 56 sys_freqctrl &= ~0xFFF00000;
58 au_writel(sys_freqctrl, SYS_FREQCTRL0); 57 au_writel(sys_freqctrl, SYS_FREQCTRL0);
59 58
60 /* zero and disable USBH/USBD/IrDA clock */ 59 /* Zero and disable USBH/USBD/IrDA clock */
61 sys_clksrc = au_readl(SYS_CLKSRC); 60 sys_clksrc = au_readl(SYS_CLKSRC);
62 sys_clksrc &= ~0x0000001F; 61 sys_clksrc &= ~(SYS_CS_CIR | SYS_CS_DIR | SYS_CS_MIR_MASK);
63 au_writel(sys_clksrc, SYS_CLKSRC); 62 au_writel(sys_clksrc, SYS_CLKSRC);
64 63
65 sys_freqctrl = au_readl(SYS_FREQCTRL0); 64 sys_freqctrl = au_readl(SYS_FREQCTRL0);
66 sys_freqctrl &= ~0xFFF00000; 65 sys_freqctrl &= ~0xFFF00000;
67 66
68 sys_clksrc = au_readl(SYS_CLKSRC); 67 sys_clksrc = au_readl(SYS_CLKSRC);
69 sys_clksrc &= ~0x0000001F; 68 sys_clksrc &= ~(SYS_CS_CIR | SYS_CS_DIR | SYS_CS_MIR_MASK);
70 69
71 // FREQ2 = aux/2 = 48 MHz 70 /* FREQ2 = aux / 2 = 48 MHz */
72 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 71 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) |
72 SYS_FC_FE2 | SYS_FC_FS2;
73 au_writel(sys_freqctrl, SYS_FREQCTRL0); 73 au_writel(sys_freqctrl, SYS_FREQCTRL0);
74 74
75 /* 75 /*
76 * Route 48MHz FREQ2 into USBH/USBD/IrDA 76 * Route 48 MHz FREQ2 into USBH/USBD/IrDA
77 */ 77 */
78 sys_clksrc |= ((4<<2) | (0<<1) | 0 ); 78 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MIR_BIT;
79 au_writel(sys_clksrc, SYS_CLKSRC); 79 au_writel(sys_clksrc, SYS_CLKSRC);
80 80
81 /* setup the static bus controller */ 81 /* Setup the static bus controller */
82 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 82 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
83 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 83 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
84 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 84 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
85 85
86 // get USB Functionality pin state (device vs host drive pins) 86 /*
87 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 87 * Get USB Functionality pin state (device vs host drive pins).
88 // 2nd USB port is USB host 88 */
89 pin_func |= 0x8000; 89 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_USB;
90 /* 2nd USB port is USB host. */
91 pin_func |= SYS_PF_USB;
90 au_writel(pin_func, SYS_PINFUNC); 92 au_writel(pin_func, SYS_PINFUNC);
91 } 93 }
92#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 94#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
@@ -94,12 +96,12 @@ void __init board_setup(void)
94 /* Enable sys bus clock divider when IDLE state or no bus activity. */ 96 /* Enable sys bus clock divider when IDLE state or no bus activity. */
95 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 97 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
96 98
97 // Enable the RTC if not already enabled 99 /* Enable the RTC if not already enabled. */
98 if (!(readb(base + 0x28) & 0x20)) { 100 if (!(readb(base + 0x28) & 0x20)) {
99 writeb(readb(base + 0x28) | 0x20, base + 0x28); 101 writeb(readb(base + 0x28) | 0x20, base + 0x28);
100 au_sync(); 102 au_sync();
101 } 103 }
102 // Put the clock in BCD mode 104 /* Put the clock in BCD mode. */
103 if (readb(base + 0x2C) & 0x4) { /* reg B */ 105 if (readb(base + 0x2C) & 0x4) { /* reg B */
104 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c); 106 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c);
105 au_sync(); 107 au_sync();
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
index c91344648ed3..8355483f3de2 100644
--- a/arch/mips/au1000/pb1100/init.c
+++ b/arch/mips/au1000/pb1100/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Pb1100 board setup 4 * Pb1100 board setup
5 * 5 *
6 * Copyright 2002 MontaVista Software Inc. 6 * Copyright 2002, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -46,8 +45,8 @@ void __init prom_init(void)
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = fw_arg0; 47 prom_argc = fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg3; 49 prom_envp = (char **)fw_arg3;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 52
@@ -55,7 +54,7 @@ void __init prom_init(void)
55 if (!memsize_str) 54 if (!memsize_str)
56 memsize = 0x04000000; 55 memsize = 0x04000000;
57 else 56 else
58 memsize = simple_strtol(memsize_str, NULL, 0); 57 memsize = strict_strtol(memsize_str, 0, NULL);
59 58
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 60}
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
index b5021e3d477f..9b7dd8b41283 100644
--- a/arch/mips/au1000/pb1100/irqmap.c
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table 3 * Au1xx0 IRQ map table
4 * 4 *
5 * Copyright 2003 Embedded Edge, LLC 5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com 6 * dan@embeddededge.com
@@ -31,10 +31,10 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
34 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted# 34 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card Fully_Inserted# */
35 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG# 35 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card STSCHG# */
36 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ# 36 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card IRQ# */
37 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, // DC_IRQ# 37 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, /* DC_IRQ# */
38}; 38};
39 39
40int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); 40int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1200/Makefile b/arch/mips/au1000/pb1200/Makefile
index 4fe02ea65a60..d678adf7ce85 100644
--- a/arch/mips/au1000/pb1200/Makefile
+++ b/arch/mips/au1000/pb1200/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Makefile for the Alchemy Semiconductor PB1200 board. 2# Makefile for the Alchemy Semiconductor Pb1200/DBAu1200 boards.
3# 3#
4 4
5lib-y := init.o board_setup.o irqmap.o 5lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1200/board_setup.c b/arch/mips/au1000/pb1200/board_setup.c
index 4493a792cc4c..6cb2115059ad 100644
--- a/arch/mips/au1000/pb1200/board_setup.c
+++ b/arch/mips/au1000/pb1200/board_setup.c
@@ -27,16 +27,8 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/sched.h> 28#include <linux/sched.h>
29 29
30#include <au1000.h>
31#include <prom.h> 30#include <prom.h>
32 31#include <au1xxx.h>
33#ifdef CONFIG_MIPS_PB1200
34#include <asm/mach-pb1x00/pb1200.h>
35#endif
36
37#ifdef CONFIG_MIPS_DB1200
38#include <asm/mach-db1x00/db1200.h>
39#endif
40 32
41extern void _board_init_irq(void); 33extern void _board_init_irq(void);
42extern void (*board_init_irq)(void); 34extern void (*board_init_irq)(void);
@@ -53,56 +45,57 @@ void __init board_setup(void)
53 45
54#if 0 46#if 0
55 { 47 {
56 u32 pin_func; 48 u32 pin_func;
57 49
58 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 50 /*
59 * but it is board specific code, so put it here. 51 * Enable PSC1 SYNC for AC97. Normaly done in audio driver,
60 */ 52 * but it is board specific code, so put it here.
61 pin_func = au_readl(SYS_PINFUNC); 53 */
62 au_sync(); 54 pin_func = au_readl(SYS_PINFUNC);
63 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; 55 au_sync();
64 au_writel(pin_func, SYS_PINFUNC); 56 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
65 57 au_writel(pin_func, SYS_PINFUNC);
66 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 58
67 au_sync(); 59 au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
60 au_sync();
68 } 61 }
69#endif 62#endif
70 63
71#if defined(CONFIG_I2C_AU1550) 64#if defined(CONFIG_I2C_AU1550)
72 { 65 {
73 u32 freq0, clksrc; 66 u32 freq0, clksrc;
74 u32 pin_func; 67 u32 pin_func;
75 68
76 /* Select SMBUS in CPLD */ 69 /* Select SMBus in CPLD */
77 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX); 70 bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
78 71
79 pin_func = au_readl(SYS_PINFUNC); 72 pin_func = au_readl(SYS_PINFUNC);
80 au_sync(); 73 au_sync();
81 pin_func &= ~(3<<17 | 1<<4); 74 pin_func &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
82 /* Set GPIOs correctly */ 75 /* Set GPIOs correctly */
83 pin_func |= 2<<17; 76 pin_func |= 2 << 17;
84 au_writel(pin_func, SYS_PINFUNC); 77 au_writel(pin_func, SYS_PINFUNC);
85 au_sync(); 78 au_sync();
86 79
87 /* The i2c driver depends on 50Mhz clock */ 80 /* The I2C driver depends on 50 MHz clock */
88 freq0 = au_readl(SYS_FREQCTRL0); 81 freq0 = au_readl(SYS_FREQCTRL0);
89 au_sync(); 82 au_sync();
90 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1); 83 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1);
91 freq0 |= (3<<SYS_FC_FRDIV1_BIT); 84 freq0 |= 3 << SYS_FC_FRDIV1_BIT;
92 /* 396Mhz / (3+1)*2 == 49.5Mhz */ 85 /* 396 MHz / (3 + 1) * 2 == 49.5 MHz */
93 au_writel(freq0, SYS_FREQCTRL0); 86 au_writel(freq0, SYS_FREQCTRL0);
94 au_sync(); 87 au_sync();
95 freq0 |= SYS_FC_FE1; 88 freq0 |= SYS_FC_FE1;
96 au_writel(freq0, SYS_FREQCTRL0); 89 au_writel(freq0, SYS_FREQCTRL0);
97 au_sync(); 90 au_sync();
98 91
99 clksrc = au_readl(SYS_CLKSRC); 92 clksrc = au_readl(SYS_CLKSRC);
100 au_sync(); 93 au_sync();
101 clksrc &= ~0x01f00000; 94 clksrc &= ~(SYS_CS_CE0 | SYS_CS_DE0 | SYS_CS_ME0_MASK);
102 /* bit 22 is EXTCLK0 for PSC0 */ 95 /* Bit 22 is EXTCLK0 for PSC0 */
103 clksrc |= (0x3 << 22); 96 clksrc |= SYS_CS_MUX_FQ1 << SYS_CS_ME0_BIT;
104 au_writel(clksrc, SYS_CLKSRC); 97 au_writel(clksrc, SYS_CLKSRC);
105 au_sync(); 98 au_sync();
106 } 99 }
107#endif 100#endif
108 101
@@ -116,27 +109,27 @@ void __init board_setup(void)
116#endif 109#endif
117#endif 110#endif
118 111
119 /* The Pb1200 development board uses external MUX for PSC0 to 112 /*
120 support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI 113 * The Pb1200 development board uses external MUX for PSC0 to
121 */ 114 * support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
115 */
122#ifdef CONFIG_I2C_AU1550 116#ifdef CONFIG_I2C_AU1550
123 bcsr->resets &= (~BCSR_RESETS_PCS0MUX); 117 bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
124#endif 118#endif
125 au_sync(); 119 au_sync();
126 120
127#ifdef CONFIG_MIPS_PB1200 121#ifdef CONFIG_MIPS_PB1200
128 printk("AMD Alchemy Pb1200 Board\n"); 122 printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
129#endif 123#endif
130#ifdef CONFIG_MIPS_DB1200 124#ifdef CONFIG_MIPS_DB1200
131 printk("AMD Alchemy Db1200 Board\n"); 125 printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
132#endif 126#endif
133 127
134 /* Setup Pb1200 External Interrupt Controller */ 128 /* Setup Pb1200 External Interrupt Controller */
135 board_init_irq = _board_init_irq; 129 board_init_irq = _board_init_irq;
136} 130}
137 131
138int 132int board_au1200fb_panel(void)
139board_au1200fb_panel(void)
140{ 133{
141 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 134 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
142 int p; 135 int p;
@@ -147,23 +140,23 @@ board_au1200fb_panel(void)
147 return p; 140 return p;
148} 141}
149 142
150int 143int board_au1200fb_panel_init(void)
151board_au1200fb_panel_init(void)
152{ 144{
153 /* Apply power */ 145 /* Apply power */
154 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 146 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
155 bcsr->board |= (BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); 147
156 /*printk("board_au1200fb_panel_init()\n"); */ 148 bcsr->board |= BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL;
149 /* printk(KERN_DEBUG "board_au1200fb_panel_init()\n"); */
157 return 0; 150 return 0;
158} 151}
159 152
160int 153int board_au1200fb_panel_shutdown(void)
161board_au1200fb_panel_shutdown(void)
162{ 154{
163 /* Remove power */ 155 /* Remove power */
164 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 156 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
165 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); 157
166 /*printk("board_au1200fb_panel_shutdown()\n"); */ 158 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
159 BCSR_BOARD_LCDBL);
160 /* printk(KERN_DEBUG "board_au1200fb_panel_shutdown()\n"); */
167 return 0; 161 return 0;
168} 162}
169
diff --git a/arch/mips/au1000/pb1200/init.c b/arch/mips/au1000/pb1200/init.c
index 72af5500660b..09fd63b86062 100644
--- a/arch/mips/au1000/pb1200/init.c
+++ b/arch/mips/au1000/pb1200/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1200 board setup 4 * PB1200 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x08000000; 54 memsize = 0x08000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index e61eb8e0b76b..2a505ad8715b 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -39,25 +39,25 @@
39#endif 39#endif
40 40
41struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 41struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
42 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade 42 /* This is external interrupt cascade */
43 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 },
43}; 44};
44 45
45int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); 46int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
46 47
47/* 48/*
48 * Support for External interrupts on the PbAu1200 Development platform. 49 * Support for External interrupts on the Pb1200 Development platform.
49 */ 50 */
50static volatile int pb1200_cascade_en=0; 51static volatile int pb1200_cascade_en;
51 52
52irqreturn_t pb1200_cascade_handler( int irq, void *dev_id) 53irqreturn_t pb1200_cascade_handler(int irq, void *dev_id)
53{ 54{
54 unsigned short bisr = bcsr->int_status; 55 unsigned short bisr = bcsr->int_status;
55 int extirq_nr = 0; 56 int extirq_nr = 0;
56 57
57 /* Clear all the edge interrupts. This has no effect on level */ 58 /* Clear all the edge interrupts. This has no effect on level. */
58 bcsr->int_status = bisr; 59 bcsr->int_status = bisr;
59 for( ; bisr; bisr &= (bisr-1) ) 60 for ( ; bisr; bisr &= bisr - 1) {
60 {
61 extirq_nr = PB1200_INT_BEGIN + __ffs(bisr); 61 extirq_nr = PB1200_INT_BEGIN + __ffs(bisr);
62 /* Ack and dispatch IRQ */ 62 /* Ack and dispatch IRQ */
63 do_IRQ(extirq_nr); 63 do_IRQ(extirq_nr);
@@ -68,26 +68,20 @@ irqreturn_t pb1200_cascade_handler( int irq, void *dev_id)
68 68
69inline void pb1200_enable_irq(unsigned int irq_nr) 69inline void pb1200_enable_irq(unsigned int irq_nr)
70{ 70{
71 bcsr->intset_mask = 1<<(irq_nr - PB1200_INT_BEGIN); 71 bcsr->intset_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
72 bcsr->intset = 1<<(irq_nr - PB1200_INT_BEGIN); 72 bcsr->intset = 1 << (irq_nr - PB1200_INT_BEGIN);
73} 73}
74 74
75inline void pb1200_disable_irq(unsigned int irq_nr) 75inline void pb1200_disable_irq(unsigned int irq_nr)
76{ 76{
77 bcsr->intclr_mask = 1<<(irq_nr - PB1200_INT_BEGIN); 77 bcsr->intclr_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
78 bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); 78 bcsr->intclr = 1 << (irq_nr - PB1200_INT_BEGIN);
79} 79}
80 80
81static unsigned int pb1200_setup_cascade(void) 81static unsigned int pb1200_setup_cascade(void)
82{ 82{
83 int err; 83 return request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
84 84 0, "Pb1200 Cascade", &pb1200_cascade_handler);
85 err = request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
86 0, "Pb1200 Cascade", &pb1200_cascade_handler);
87 if (err)
88 return err;
89
90 return 0;
91} 85}
92 86
93static unsigned int pb1200_startup_irq(unsigned int irq) 87static unsigned int pb1200_startup_irq(unsigned int irq)
@@ -132,23 +126,23 @@ void _board_init_irq(void)
132 unsigned int irq; 126 unsigned int irq;
133 127
134#ifdef CONFIG_MIPS_PB1200 128#ifdef CONFIG_MIPS_PB1200
135 /* We have a problem with CPLD rev3. Enable a workaround */ 129 /* We have a problem with CPLD rev 3. */
136 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) { 130 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) {
137 printk("\nWARNING!!!\n"); 131 printk(KERN_ERR "WARNING!!!\n");
138 printk("\nWARNING!!!\n"); 132 printk(KERN_ERR "WARNING!!!\n");
139 printk("\nWARNING!!!\n"); 133 printk(KERN_ERR "WARNING!!!\n");
140 printk("\nWARNING!!!\n"); 134 printk(KERN_ERR "WARNING!!!\n");
141 printk("\nWARNING!!!\n"); 135 printk(KERN_ERR "WARNING!!!\n");
142 printk("\nWARNING!!!\n"); 136 printk(KERN_ERR "WARNING!!!\n");
143 printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n"); 137 printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n");
144 printk("updated to latest revision. This software will not\n"); 138 printk(KERN_ERR "updated to latest revision. This software will\n");
145 printk("work on anything less than CPLD rev4\n"); 139 printk(KERN_ERR "not work on anything less than CPLD rev 4.\n");
146 printk("\nWARNING!!!\n"); 140 printk(KERN_ERR "WARNING!!!\n");
147 printk("\nWARNING!!!\n"); 141 printk(KERN_ERR "WARNING!!!\n");
148 printk("\nWARNING!!!\n"); 142 printk(KERN_ERR "WARNING!!!\n");
149 printk("\nWARNING!!!\n"); 143 printk(KERN_ERR "WARNING!!!\n");
150 printk("\nWARNING!!!\n"); 144 printk(KERN_ERR "WARNING!!!\n");
151 printk("\nWARNING!!!\n"); 145 printk(KERN_ERR "WARNING!!!\n");
152 panic("Game over. Your score is 0."); 146 panic("Game over. Your score is 0.");
153 } 147 }
154#endif 148#endif
@@ -161,6 +155,6 @@ void _board_init_irq(void)
161 155
162 /* 156 /*
163 * GPIO_7 can not be hooked here, so it is hooked upon first 157 * GPIO_7 can not be hooked here, so it is hooked upon first
164 * request of any source attached to the cascade 158 * request of any source attached to the cascade.
165 */ 159 */
166} 160}
diff --git a/arch/mips/au1000/pb1500/Makefile b/arch/mips/au1000/pb1500/Makefile
index 97a730813cd3..602f38df20bb 100644
--- a/arch/mips/au1000/pb1500/Makefile
+++ b/arch/mips/au1000/pb1500/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000,2001 MontaVista Software Inc. 2# Copyright 2000, 2001, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor Pb1500 board. 5# Makefile for the Alchemy Semiconductor Pb1500 board.
6#
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1500/board_setup.c b/arch/mips/au1000/pb1500/board_setup.c
index 24c652e8ec4b..035771c6e5b8 100644
--- a/arch/mips/au1000/pb1500/board_setup.c
+++ b/arch/mips/au1000/pb1500/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * 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
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -32,8 +31,8 @@
32 31
33void board_reset(void) 32void board_reset(void)
34{ 33{
35 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 34 /* Hit BCSR.RST_VDDI[SOFT_RESET] */
36 au_writel(0x00000000, 0xAE00001C); 35 au_writel(0x00000000, PB1500_RST_VDDI);
37} 36}
38 37
39void __init board_setup(void) 38void __init board_setup(void)
@@ -42,7 +41,7 @@ void __init board_setup(void)
42 u32 sys_freqctrl, sys_clksrc; 41 u32 sys_freqctrl, sys_clksrc;
43 42
44 sys_clksrc = sys_freqctrl = pin_func = 0; 43 sys_clksrc = sys_freqctrl = pin_func = 0;
45 // set AUX clock to 12MHz * 8 = 96 MHz 44 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
46 au_writel(8, SYS_AUXPLL); 45 au_writel(8, SYS_AUXPLL);
47 au_writel(0, SYS_PINSTATERD); 46 au_writel(0, SYS_PINSTATERD);
48 udelay(100); 47 udelay(100);
@@ -51,51 +50,48 @@ void __init board_setup(void)
51 50
52 /* GPIO201 is input for PCMCIA card detect */ 51 /* GPIO201 is input for PCMCIA card detect */
53 /* GPIO203 is input for PCMCIA interrupt request */ 52 /* GPIO203 is input for PCMCIA interrupt request */
54 au_writel(au_readl(GPIO2_DIR) & (u32)(~((1<<1)|(1<<3))), GPIO2_DIR); 53 au_writel(au_readl(GPIO2_DIR) & ~((1 << 1) | (1 << 3)), GPIO2_DIR);
55 54
56 /* zero and disable FREQ2 */ 55 /* Zero and disable FREQ2 */
57 sys_freqctrl = au_readl(SYS_FREQCTRL0); 56 sys_freqctrl = au_readl(SYS_FREQCTRL0);
58 sys_freqctrl &= ~0xFFF00000; 57 sys_freqctrl &= ~0xFFF00000;
59 au_writel(sys_freqctrl, SYS_FREQCTRL0); 58 au_writel(sys_freqctrl, SYS_FREQCTRL0);
60 59
61 /* zero and disable USBH/USBD clocks */ 60 /* zero and disable USBH/USBD clocks */
62 sys_clksrc = au_readl(SYS_CLKSRC); 61 sys_clksrc = au_readl(SYS_CLKSRC);
63 sys_clksrc &= ~0x00007FE0; 62 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
63 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
64 au_writel(sys_clksrc, SYS_CLKSRC); 64 au_writel(sys_clksrc, SYS_CLKSRC);
65 65
66 sys_freqctrl = au_readl(SYS_FREQCTRL0); 66 sys_freqctrl = au_readl(SYS_FREQCTRL0);
67 sys_freqctrl &= ~0xFFF00000; 67 sys_freqctrl &= ~0xFFF00000;
68 68
69 sys_clksrc = au_readl(SYS_CLKSRC); 69 sys_clksrc = au_readl(SYS_CLKSRC);
70 sys_clksrc &= ~0x00007FE0; 70 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
71 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
71 72
72 // FREQ2 = aux/2 = 48 MHz 73 /* FREQ2 = aux/2 = 48 MHz */
73 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 74 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2 | SYS_FC_FS2;
74 au_writel(sys_freqctrl, SYS_FREQCTRL0); 75 au_writel(sys_freqctrl, SYS_FREQCTRL0);
75 76
76 /* 77 /*
77 * Route 48MHz FREQ2 into USB Host and/or Device 78 * Route 48MHz FREQ2 into USB Host and/or Device
78 */ 79 */
79#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 80 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT;
80 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
81#endif
82 au_writel(sys_clksrc, SYS_CLKSRC); 81 au_writel(sys_clksrc, SYS_CLKSRC);
83 82
84 83 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_USB;
85 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 84 /* 2nd USB port is USB host */
86 // 2nd USB port is USB host 85 pin_func |= SYS_PF_USB;
87 pin_func |= 0x8000;
88 au_writel(pin_func, SYS_PINFUNC); 86 au_writel(pin_func, SYS_PINFUNC);
89#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 87#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
90 88
91
92
93#ifdef CONFIG_PCI 89#ifdef CONFIG_PCI
94 // Setup PCI bus controller 90 /* Setup PCI bus controller */
95 au_writel(0, Au1500_PCI_CMEM); 91 au_writel(0, Au1500_PCI_CMEM);
96 au_writel(0x00003fff, Au1500_CFG_BASE); 92 au_writel(0x00003fff, Au1500_CFG_BASE);
97#if defined(__MIPSEB__) 93#if defined(__MIPSEB__)
98 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 94 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
99#else 95#else
100 au_writel(0xf, Au1500_PCI_CFG); 96 au_writel(0xf, Au1500_PCI_CFG);
101#endif 97#endif
@@ -112,11 +108,11 @@ void __init board_setup(void)
112 108
113 /* Enable the RTC if not already enabled */ 109 /* Enable the RTC if not already enabled */
114 if (!(au_readl(0xac000028) & 0x20)) { 110 if (!(au_readl(0xac000028) & 0x20)) {
115 printk("enabling clock ...\n"); 111 printk(KERN_INFO "enabling clock ...\n");
116 au_writel((au_readl(0xac000028) | 0x20), 0xac000028); 112 au_writel((au_readl(0xac000028) | 0x20), 0xac000028);
117 } 113 }
118 /* Put the clock in BCD mode */ 114 /* Put the clock in BCD mode */
119 if (au_readl(0xac00002C) & 0x4) { /* reg B */ 115 if (au_readl(0xac00002c) & 0x4) { /* reg B */
120 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c); 116 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c);
121 au_sync(); 117 au_sync();
122 } 118 }
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
index 488507c07db9..49f51e165863 100644
--- a/arch/mips/au1000/pb1500/init.c
+++ b/arch/mips/au1000/pb1500/init.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1500 board setup 4 * Pb1500 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x04000000; 54 memsize = 0x04000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
index 4817ab44d07f..39c4682766a8 100644
--- a/arch/mips/au1000/pb1500/irqmap.c
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -31,12 +31,12 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT370 */ 34 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT370 */
35 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 35 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
36}; 36};
37 37
38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
39 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 39 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
40 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 40 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
41 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 41 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
42 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 42 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1550/Makefile b/arch/mips/au1000/pb1550/Makefile
index aa35bc6cb8cf..7d8beca87fa5 100644
--- a/arch/mips/au1000/pb1550/Makefile
+++ b/arch/mips/au1000/pb1550/Makefile
@@ -1,9 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor PB1000 board. 5# Makefile for the Alchemy Semiconductor Pb1550 board.
7# 6#
8 7
9lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1550/board_setup.c b/arch/mips/au1000/pb1550/board_setup.c
index 45d60872b565..0ed76b64b6ab 100644
--- a/arch/mips/au1000/pb1550/board_setup.c
+++ b/arch/mips/au1000/pb1550/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Pb1550 board setup. 4 * Alchemy Pb1550 board setup.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -35,15 +34,16 @@
35 34
36void board_reset(void) 35void board_reset(void)
37{ 36{
38 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 37 /* Hit BCSR.SYSTEM[RESET] */
39 au_writew(au_readw(0xAF00001C) & ~(1<<15), 0xAF00001C); 38 au_writew(au_readw(0xAF00001C) & ~BCSR_SYSTEM_RESET, 0xAF00001C);
40} 39}
41 40
42void __init board_setup(void) 41void __init board_setup(void)
43{ 42{
44 u32 pin_func; 43 u32 pin_func;
45 44
46 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 45 /*
46 * Enable PSC1 SYNC for AC'97. Normaly done in audio driver,
47 * but it is board specific code, so put it here. 47 * but it is board specific code, so put it here.
48 */ 48 */
49 pin_func = au_readl(SYS_PINFUNC); 49 pin_func = au_readl(SYS_PINFUNC);
@@ -51,8 +51,8 @@ void __init board_setup(void)
51 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; 51 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
52 au_writel(pin_func, SYS_PINFUNC); 52 au_writel(pin_func, SYS_PINFUNC);
53 53
54 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 54 au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
55 au_sync(); 55 au_sync();
56 56
57 printk("AMD Alchemy Pb1550 Board\n"); 57 printk(KERN_INFO "AMD Alchemy Pb1550 Board\n");
58} 58}
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
index f6b2fc587980..1b5f58434bb7 100644
--- a/arch/mips/au1000/pb1550/init.c
+++ b/arch/mips/au1000/pb1550/init.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1550 board setup 4 * Pb1550 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x08000000; 54 memsize = 0x08000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
index e1dac37af08a..a02a4d1fa899 100644
--- a/arch/mips/au1000/pb1550/irqmap.c
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table 3 * Au1xx0 IRQ map table
4 * 4 *
5 * Copyright 2003 Embedded Edge, LLC 5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com 6 * dan@embeddededge.com
@@ -31,8 +31,8 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */ 34 [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
35 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 35 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
36}; 36};
37 37
38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
diff --git a/arch/mips/au1000/xxs1500/Makefile b/arch/mips/au1000/xxs1500/Makefile
index 44d7f7056ae7..db3c526f64d8 100644
--- a/arch/mips/au1000/xxs1500/Makefile
+++ b/arch/mips/au1000/xxs1500/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Copyright 2003 MontaVista Software Inc. 2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for MyCable XXS1500 board. 5# Makefile for MyCable XXS1500 board.
7# 6#
diff --git a/arch/mips/au1000/xxs1500/board_setup.c b/arch/mips/au1000/xxs1500/board_setup.c
index 79d1798621bf..4c587acac5c3 100644
--- a/arch/mips/au1000/xxs1500/board_setup.c
+++ b/arch/mips/au1000/xxs1500/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000-2003 MontaVista Software Inc. 2 * Copyright 2000-2003, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * 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
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -39,40 +38,40 @@ void __init board_setup(void)
39{ 38{
40 u32 pin_func; 39 u32 pin_func;
41 40
42 // set multiple use pins (UART3/GPIO) to UART (it's used as UART too) 41 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
43 pin_func = au_readl(SYS_PINFUNC) & (u32)(~SYS_PF_UR3); 42 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
44 pin_func |= SYS_PF_UR3; 43 pin_func |= SYS_PF_UR3;
45 au_writel(pin_func, SYS_PINFUNC); 44 au_writel(pin_func, SYS_PINFUNC);
46 45
47 // enable UART 46 /* Enable UART */
48 au_writel(0x01, UART3_ADDR+UART_MOD_CNTRL); // clock enable (CE) 47 au_writel(0x01, UART3_ADDR + UART_MOD_CNTRL); /* clock enable (CE) */
49 mdelay(10); 48 mdelay(10);
50 au_writel(0x03, UART3_ADDR+UART_MOD_CNTRL); // CE and "enable" 49 au_writel(0x03, UART3_ADDR + UART_MOD_CNTRL); /* CE and "enable" */
51 mdelay(10); 50 mdelay(10);
52 51
53 // enable DTR = USB power up 52 /* Enable DTR = USB power up */
54 au_writel(0x01, UART3_ADDR+UART_MCR); //? UART_MCR_DTR is 0x01??? 53 au_writel(0x01, UART3_ADDR + UART_MCR); /* UART_MCR_DTR is 0x01??? */
55 54
56#ifdef CONFIG_PCMCIA_XXS1500 55#ifdef CONFIG_PCMCIA_XXS1500
57 /* setup pcmcia signals */ 56 /* Setup PCMCIA signals */
58 au_writel(0, SYS_PININPUTEN); 57 au_writel(0, SYS_PININPUTEN);
59 58
60 /* gpio 0, 1, and 4 are inputs */ 59 /* GPIO 0, 1, and 4 are inputs */
61 au_writel(1 | (1<<1) | (1<<4), SYS_TRIOUTCLR); 60 au_writel(1 | (1 << 1) | (1 << 4), SYS_TRIOUTCLR);
62 61
63 /* enable GPIO2 if not already enabled */ 62 /* Enable GPIO2 if not already enabled */
64 au_writel(1, GPIO2_ENABLE); 63 au_writel(1, GPIO2_ENABLE);
65 /* gpio2 208/9/10/11 are inputs */ 64 /* GPIO2 208/9/10/11 are inputs */
66 au_writel((1<<8) | (1<<9) | (1<<10) | (1<<11), GPIO2_DIR); 65 au_writel((1 << 8) | (1 << 9) | (1 << 10) | (1 << 11), GPIO2_DIR);
67 66
68 /* turn off power */ 67 /* Turn off power */
69 au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<14))|(1<<30), GPIO2_OUTPUT); 68 au_writel((au_readl(GPIO2_PINSTATE) & ~(1 << 14)) | (1 << 30),
69 GPIO2_OUTPUT);
70#endif 70#endif
71 71
72
73#ifdef CONFIG_PCI 72#ifdef CONFIG_PCI
74#if defined(__MIPSEB__) 73#if defined(__MIPSEB__)
75 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 74 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
76#else 75#else
77 au_writel(0xf, Au1500_PCI_CFG); 76 au_writel(0xf, Au1500_PCI_CFG);
78#endif 77#endif
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
index 24fc6e132dc0..b849bf501c04 100644
--- a/arch/mips/au1000/xxs1500/init.c
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * XXS1500 board setup 3 * XXS1500 board setup
4 * 4 *
5 * Copyright 2003 MontaVista Software Inc. 5 * Copyright 2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -45,8 +44,8 @@ void __init prom_init(void)
45 unsigned long memsize; 44 unsigned long memsize;
46 45
47 prom_argc = fw_arg0; 46 prom_argc = fw_arg0;
48 prom_argv = (char **) fw_arg1; 47 prom_argv = (char **)fw_arg1;
49 prom_envp = (char **) fw_arg2; 48 prom_envp = (char **)fw_arg2;
50 49
51 prom_init_cmdline(); 50 prom_init_cmdline();
52 51
@@ -54,6 +53,6 @@ void __init prom_init(void)
54 if (!memsize_str) 53 if (!memsize_str)
55 memsize = 0x04000000; 54 memsize = 0x04000000;
56 else 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 58}
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
index dd6e3d1eb4d4..edf06ed11870 100644
--- a/arch/mips/au1000/xxs1500/irqmap.c
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -31,7 +31,7 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
34 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 34 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
35 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 35 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
36 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 36 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
37 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 37 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index 82f9e9013e70..62bfb455d1b1 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -76,7 +76,9 @@ static void markeins_machine_power_off(void)
76 while (1) ; 76 while (1) ;
77} 77}
78 78
79static unsigned long clock[4] = { 166500000, 187312500, 199800000, 210600000 }; 79static unsigned long __initdata emma2rh_clock[4] = {
80 166500000, 187312500, 199800000, 210600000
81};
80 82
81static unsigned int __init detect_bus_frequency(unsigned long rtc_base) 83static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
82{ 84{
@@ -85,7 +87,8 @@ static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
85 /* detect from boot strap */ 87 /* detect from boot strap */
86 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); 88 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
87 reg = (reg >> 4) & 0x3; 89 reg = (reg >> 4) & 0x3;
88 return clock[reg]; 90
91 return emma2rh_clock[reg];
89} 92}
90 93
91void __init plat_time_init(void) 94void __init plat_time_init(void)
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 45545be3eb86..65e46a6d4178 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -30,7 +30,6 @@ obj-$(CONFIG_CPU_LOONGSON2) += r4k_fpu.o r4k_switch.o
30obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o 30obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o
31obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o 31obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o
32obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o 32obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o
33obj-$(CONFIG_CPU_R4000) += r4k_fpu.o r4k_switch.o
34obj-$(CONFIG_CPU_R4300) += r4k_fpu.o r4k_switch.o 33obj-$(CONFIG_CPU_R4300) += r4k_fpu.o r4k_switch.o
35obj-$(CONFIG_CPU_R4X00) += r4k_fpu.o r4k_switch.o 34obj-$(CONFIG_CPU_R4X00) += r4k_fpu.o r4k_switch.o
36obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o 35obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o
@@ -56,9 +55,9 @@ obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o
56obj-$(CONFIG_MIPS_CMP) += smp-cmp.o 55obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
57obj-$(CONFIG_CPU_MIPSR2) += spram.o 56obj-$(CONFIG_CPU_MIPSR2) += spram.o
58 57
59obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
60obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o 58obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
61obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o 59obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
60obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
62 61
63obj-$(CONFIG_I8259) += i8259.o 62obj-$(CONFIG_I8259) += i8259.o
64obj-$(CONFIG_IRQ_CPU) += irq_cpu.o 63obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
index a1b48af0992f..02b7713cf71c 100644
--- a/arch/mips/kernel/cpu-bugs64.c
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -38,7 +38,7 @@ static inline void align_mod(const int align, const int mod)
38 ".endr\n\t" 38 ".endr\n\t"
39 ".set pop" 39 ".set pop"
40 : 40 :
41 : GCC_IMM_ASM(align), GCC_IMM_ASM(mod)); 41 : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
42} 42}
43 43
44static inline void mult_sh_align_mod(long *v1, long *v2, long *w, 44static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c
index aeda7f58391b..d72487ad7c15 100644
--- a/arch/mips/kernel/init_task.c
+++ b/arch/mips/kernel/init_task.c
@@ -10,7 +10,6 @@
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11 11
12static struct fs_struct init_fs = INIT_FS; 12static struct fs_struct init_fs = INIT_FS;
13static struct files_struct init_files = INIT_FILES;
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16struct mm_struct init_mm = INIT_MM(init_mm); 15struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 290d8e3a664d..469c7237e5ba 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -578,7 +578,7 @@ static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp,
578 * process and the system, here we map the page and fill the 578 * process and the system, here we map the page and fill the
579 * structure 579 * structure
580 */ 580 */
581static void irix_map_prda_page(void) 581static int irix_map_prda_page(void)
582{ 582{
583 unsigned long v; 583 unsigned long v;
584 struct prda *pp; 584 struct prda *pp;
@@ -587,8 +587,8 @@ static void irix_map_prda_page(void)
587 v = do_brk(PRDA_ADDRESS, PAGE_SIZE); 587 v = do_brk(PRDA_ADDRESS, PAGE_SIZE);
588 up_write(&current->mm->mmap_sem); 588 up_write(&current->mm->mmap_sem);
589 589
590 if (v < 0) 590 if (v != PRDA_ADDRESS)
591 return; 591 return v; /* v must be an error code */
592 592
593 pp = (struct prda *) v; 593 pp = (struct prda *) v;
594 pp->prda_sys.t_pid = task_pid_vnr(current); 594 pp->prda_sys.t_pid = task_pid_vnr(current);
@@ -596,6 +596,8 @@ static void irix_map_prda_page(void)
596 pp->prda_sys.t_rpid = task_pid_vnr(current); 596 pp->prda_sys.t_rpid = task_pid_vnr(current);
597 597
598 /* We leave the rest set to zero */ 598 /* We leave the rest set to zero */
599
600 return 0;
599} 601}
600 602
601 603
@@ -781,7 +783,8 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
781 * IRIX maps a page at 0x200000 which holds some system 783 * IRIX maps a page at 0x200000 which holds some system
782 * information. Programs depend on this. 784 * information. Programs depend on this.
783 */ 785 */
784 irix_map_prda_page(); 786 if (irix_map_prda_page())
787 goto out_free_dentry;
785 788
786 padzero(elf_bss); 789 padzero(elf_bss);
787 790
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index ceb62dce1c9c..b0591ae0ce56 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -257,7 +257,7 @@ void sp_work_handle_request(void)
257 257
258 vcwd = vpe_getcwd(tclimit); 258 vcwd = vpe_getcwd(tclimit);
259 259
260 /* change to the cwd of the process that loaded the SP program */ 260 /* change to cwd of the process that loaded the SP program */
261 old_fs = get_fs(); 261 old_fs = get_fs();
262 set_fs(KERNEL_DS); 262 set_fs(KERNEL_DS);
263 sys_chdir(vcwd); 263 sys_chdir(vcwd);
@@ -323,6 +323,9 @@ static void sp_cleanup(void)
323 set >>= 1; 323 set >>= 1;
324 } 324 }
325 } 325 }
326
327 /* Put daemon cwd back to root to avoid umount problems */
328 sys_chdir("/");
326} 329}
327 330
328static int channel_open = 0; 331static int channel_open = 0;
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 0233798f7155..b88f1c18ff4d 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -72,6 +72,15 @@ static void rtlx_dispatch(void)
72static irqreturn_t rtlx_interrupt(int irq, void *dev_id) 72static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
73{ 73{
74 int i; 74 int i;
75 unsigned int flags, vpeflags;
76
77 /* Ought not to be strictly necessary for SMTC builds */
78 local_irq_save(flags);
79 vpeflags = dvpe();
80 set_c0_status(0x100 << MIPS_CPU_RTLX_IRQ);
81 irq_enable_hazard();
82 evpe(vpeflags);
83 local_irq_restore(flags);
75 84
76 for (i = 0; i < RTLX_CHANNELS; i++) { 85 for (i = 0; i < RTLX_CHANNELS; i++) {
77 wake_up(&channel_wqs[i].lx_queue); 86 wake_up(&channel_wqs[i].lx_queue);
@@ -108,7 +117,8 @@ static void __used dump_rtlx(void)
108static int rtlx_init(struct rtlx_info *rtlxi) 117static int rtlx_init(struct rtlx_info *rtlxi)
109{ 118{
110 if (rtlxi->id != RTLX_ID) { 119 if (rtlxi->id != RTLX_ID) {
111 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n", rtlxi, rtlxi->id); 120 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n",
121 rtlxi, rtlxi->id);
112 return -ENOEXEC; 122 return -ENOEXEC;
113 } 123 }
114 124
@@ -162,18 +172,17 @@ int rtlx_open(int index, int can_sleep)
162 172
163 if (rtlx == NULL) { 173 if (rtlx == NULL) {
164 if( (p = vpe_get_shared(tclimit)) == NULL) { 174 if( (p = vpe_get_shared(tclimit)) == NULL) {
165 if (can_sleep) { 175 if (can_sleep) {
166 __wait_event_interruptible(channel_wqs[index].lx_queue, 176 __wait_event_interruptible(channel_wqs[index].lx_queue,
167 (p = vpe_get_shared(tclimit)), 177 (p = vpe_get_shared(tclimit)), ret);
168 ret); 178 if (ret)
169 if (ret)
170 goto out_fail;
171 } else {
172 printk(KERN_DEBUG "No SP program loaded, and device "
173 "opened with O_NONBLOCK\n");
174 ret = -ENOSYS;
175 goto out_fail; 179 goto out_fail;
176 } 180 } else {
181 printk(KERN_DEBUG "No SP program loaded, and device "
182 "opened with O_NONBLOCK\n");
183 ret = -ENOSYS;
184 goto out_fail;
185 }
177 } 186 }
178 187
179 smp_rmb(); 188 smp_rmb();
@@ -182,7 +191,9 @@ int rtlx_open(int index, int can_sleep)
182 DEFINE_WAIT(wait); 191 DEFINE_WAIT(wait);
183 192
184 for (;;) { 193 for (;;) {
185 prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE); 194 prepare_to_wait(
195 &channel_wqs[index].lx_queue,
196 &wait, TASK_INTERRUPTIBLE);
186 smp_rmb(); 197 smp_rmb();
187 if (*p != NULL) 198 if (*p != NULL)
188 break; 199 break;
@@ -195,7 +206,7 @@ int rtlx_open(int index, int can_sleep)
195 } 206 }
196 finish_wait(&channel_wqs[index].lx_queue, &wait); 207 finish_wait(&channel_wqs[index].lx_queue, &wait);
197 } else { 208 } else {
198 printk(" *vpe_get_shared is NULL. " 209 pr_err(" *vpe_get_shared is NULL. "
199 "Has an SP program been loaded?\n"); 210 "Has an SP program been loaded?\n");
200 ret = -ENOSYS; 211 ret = -ENOSYS;
201 goto out_fail; 212 goto out_fail;
@@ -203,8 +214,9 @@ int rtlx_open(int index, int can_sleep)
203 } 214 }
204 215
205 if ((unsigned int)*p < KSEG0) { 216 if ((unsigned int)*p < KSEG0) {
206 printk(KERN_WARNING "vpe_get_shared returned an invalid pointer " 217 printk(KERN_WARNING "vpe_get_shared returned an "
207 "maybe an error code %d\n", (int)*p); 218 "invalid pointer maybe an error code %d\n",
219 (int)*p);
208 ret = -ENOSYS; 220 ret = -ENOSYS;
209 goto out_fail; 221 goto out_fail;
210 } 222 }
@@ -232,6 +244,10 @@ out_ret:
232 244
233int rtlx_release(int index) 245int rtlx_release(int index)
234{ 246{
247 if (rtlx == NULL) {
248 pr_err("rtlx_release() with null rtlx\n");
249 return 0;
250 }
235 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED; 251 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED;
236 return 0; 252 return 0;
237} 253}
@@ -251,8 +267,8 @@ unsigned int rtlx_read_poll(int index, int can_sleep)
251 int ret = 0; 267 int ret = 0;
252 268
253 __wait_event_interruptible(channel_wqs[index].lx_queue, 269 __wait_event_interruptible(channel_wqs[index].lx_queue,
254 chan->lx_read != chan->lx_write || sp_stopping, 270 (chan->lx_read != chan->lx_write) ||
255 ret); 271 sp_stopping, ret);
256 if (ret) 272 if (ret)
257 return ret; 273 return ret;
258 274
@@ -282,7 +298,9 @@ static inline int write_spacefree(int read, int write, int size)
282unsigned int rtlx_write_poll(int index) 298unsigned int rtlx_write_poll(int index)
283{ 299{
284 struct rtlx_channel *chan = &rtlx->channel[index]; 300 struct rtlx_channel *chan = &rtlx->channel[index];
285 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); 301
302 return write_spacefree(chan->rt_read, chan->rt_write,
303 chan->buffer_size);
286} 304}
287 305
288ssize_t rtlx_read(int index, void __user *buff, size_t count) 306ssize_t rtlx_read(int index, void __user *buff, size_t count)
@@ -344,8 +362,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
344 rt_read = rt->rt_read; 362 rt_read = rt->rt_read;
345 363
346 /* total number of bytes to copy */ 364 /* total number of bytes to copy */
347 count = min(count, 365 count = min(count, (size_t)write_spacefree(rt_read, rt->rt_write,
348 (size_t)write_spacefree(rt_read, rt->rt_write, rt->buffer_size)); 366 rt->buffer_size));
349 367
350 /* first bit from write pointer to the end of the buffer, or count */ 368 /* first bit from write pointer to the end of the buffer, or count */
351 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 369 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
@@ -514,6 +532,11 @@ static int __init rtlx_module_init(void)
514 532
515 if (cpu_has_vint) 533 if (cpu_has_vint)
516 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); 534 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
535 else {
536 pr_err("APRP RTLX init on non-vectored-interrupt processor\n");
537 err = -ENODEV;
538 goto out_chrdev;
539 }
517 540
518 rtlx_irq.dev_id = rtlx; 541 rtlx_irq.dev_id = rtlx;
519 setup_irq(rtlx_irq_num, &rtlx_irq); 542 setup_irq(rtlx_irq_num, &rtlx_irq);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 39f3dfe134fb..c6a063b2a0d9 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -331,6 +331,7 @@ static void __init bootmem_init(void)
331 /* 331 /*
332 * Determine low and high memory ranges 332 * Determine low and high memory ranges
333 */ 333 */
334 max_pfn = max_low_pfn;
334 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) { 335 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) {
335#ifdef CONFIG_HIGHMEM 336#ifdef CONFIG_HIGHMEM
336 highstart_pfn = PFN_DOWN(HIGHMEM_START); 337 highstart_pfn = PFN_DOWN(HIGHMEM_START);
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 33780cc61ce9..63370cdd3c90 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -87,8 +87,8 @@ struct plat_smp_ops *mp_ops;
87 87
88__cpuinit void register_smp_ops(struct plat_smp_ops *ops) 88__cpuinit void register_smp_ops(struct plat_smp_ops *ops)
89{ 89{
90 if (ops) 90 if (mp_ops)
91 printk(KERN_WARNING "Overriding previous set SMP ops\n"); 91 printk(KERN_WARNING "Overriding previously set SMP ops\n");
92 92
93 mp_ops = ops; 93 mp_ops = ops;
94} 94}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index cb8b0e2c7954..f9165d1a17bf 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -88,15 +88,17 @@ static void show_raw_backtrace(unsigned long reg29)
88#ifdef CONFIG_KALLSYMS 88#ifdef CONFIG_KALLSYMS
89 printk("\n"); 89 printk("\n");
90#endif 90#endif
91#define IS_KVA01(a) ((((unsigned int)a) & 0xc0000000) == 0x80000000) 91 while (!kstack_end(sp)) {
92 if (IS_KVA01(sp)) { 92 unsigned long __user *p =
93 while (!kstack_end(sp)) { 93 (unsigned long __user *)(unsigned long)sp++;
94 addr = *sp++; 94 if (__get_user(addr, p)) {
95 if (__kernel_text_address(addr)) 95 printk(" (Bad stack address)");
96 print_ip_sym(addr); 96 break;
97 } 97 }
98 printk("\n"); 98 if (__kernel_text_address(addr))
99 print_ip_sym(addr);
99 } 100 }
101 printk("\n");
100} 102}
101 103
102#ifdef CONFIG_KALLSYMS 104#ifdef CONFIG_KALLSYMS
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 39804c584edd..2794501ff302 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -269,7 +269,7 @@ static void *alloc_progmem(unsigned long len)
269 * This means you must tell Linux to use less memory than you 269 * This means you must tell Linux to use less memory than you
270 * physically have, for example by passing a mem= boot argument. 270 * physically have, for example by passing a mem= boot argument.
271 */ 271 */
272 addr = pfn_to_kaddr(max_pfn); 272 addr = pfn_to_kaddr(max_low_pfn);
273 memset(addr, 0, len); 273 memset(addr, 0, len);
274#else 274#else
275 /* simple grab some mem for now */ 275 /* simple grab some mem for now */
@@ -781,10 +781,15 @@ static int vpe_run(struct vpe * v)
781 /* take system out of configuration state */ 781 /* take system out of configuration state */
782 clear_c0_mvpcontrol(MVPCONTROL_VPC); 782 clear_c0_mvpcontrol(MVPCONTROL_VPC);
783 783
784 /*
785 * SMTC/SMVP kernels manage VPE enable independently,
786 * but uniprocessor kernels need to turn it on, even
787 * if that wasn't the pre-dvpe() state.
788 */
784#ifdef CONFIG_SMP 789#ifdef CONFIG_SMP
785 evpe(EVPE_ENABLE);
786#else
787 evpe(vpeflags); 790 evpe(vpeflags);
791#else
792 evpe(EVPE_ENABLE);
788#endif 793#endif
789 emt(dmt_flag); 794 emt(dmt_flag);
790 local_irq_restore(flags); 795 local_irq_restore(flags);
@@ -840,7 +845,7 @@ static int vpe_elfload(struct vpe * v)
840 845
841 /* Sanity checks against insmoding binaries or wrong arch, 846 /* Sanity checks against insmoding binaries or wrong arch,
842 weird elf version */ 847 weird elf version */
843 if (memcmp(hdr->e_ident, ELFMAG, 4) != 0 848 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
844 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC) 849 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
845 || !elf_check_arch(hdr) 850 || !elf_check_arch(hdr)
846 || hdr->e_shentsize != sizeof(*sechdrs)) { 851 || hdr->e_shentsize != sizeof(*sechdrs)) {
@@ -947,12 +952,14 @@ static int vpe_elfload(struct vpe * v)
947 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); 952 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff);
948 953
949 for (i = 0; i < hdr->e_phnum; i++) { 954 for (i = 0; i < hdr->e_phnum; i++) {
950 if (phdr->p_type != PT_LOAD) 955 if (phdr->p_type == PT_LOAD) {
951 continue; 956 memcpy((void *)phdr->p_paddr,
952 957 (char *)hdr + phdr->p_offset,
953 memcpy((void *)phdr->p_paddr, (char *)hdr + phdr->p_offset, phdr->p_filesz); 958 phdr->p_filesz);
954 memset((void *)phdr->p_paddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); 959 memset((void *)phdr->p_paddr + phdr->p_filesz,
955 phdr++; 960 0, phdr->p_memsz - phdr->p_filesz);
961 }
962 phdr++;
956 } 963 }
957 964
958 for (i = 0; i < hdr->e_shnum; i++) { 965 for (i = 0; i < hdr->e_shnum; i++) {
@@ -1107,7 +1114,7 @@ static int vpe_release(struct inode *inode, struct file *filp)
1107 return -ENODEV; 1114 return -ENODEV;
1108 1115
1109 hdr = (Elf_Ehdr *) v->pbuffer; 1116 hdr = (Elf_Ehdr *) v->pbuffer;
1110 if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) { 1117 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
1111 if (vpe_elfload(v) >= 0) { 1118 if (vpe_elfload(v) >= 0) {
1112 vpe_run(v); 1119 vpe_run(v);
1113 } else { 1120 } else {
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index 008fd82b5840..fe2cac1b4514 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -58,27 +58,8 @@ static int mips_cpu_timer_irq;
58static int mips_cpu_perf_irq; 58static int mips_cpu_perf_irq;
59extern int cp0_perfcount_irq; 59extern int cp0_perfcount_irq;
60 60
61DEFINE_PER_CPU(unsigned int, tickcount);
62#define tickcount_this_cpu __get_cpu_var(tickcount)
63static unsigned long ledbitmask;
64
65static void mips_timer_dispatch(void) 61static void mips_timer_dispatch(void)
66{ 62{
67#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_ATLAS)
68 /*
69 * Yes, this is very tacky, won't work as expected with SMTC and
70 * dyntick will break it,
71 * but it gives me a nice warm feeling during debug
72 */
73#define LEDBAR 0xbf000408
74 if (tickcount_this_cpu++ >= HZ) {
75 tickcount_this_cpu = 0;
76 change_bit(smp_processor_id(), &ledbitmask);
77 smp_wmb(); /* Make sure every one else sees the change */
78 /* This will pick up any recent changes made by other CPU's */
79 *(unsigned int *)LEDBAR = ledbitmask;
80 }
81#endif
82 do_IRQ(mips_cpu_timer_irq); 63 do_IRQ(mips_cpu_timer_irq);
83} 64}
84 65
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 10dd2af2343b..8f2cd8eda741 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -116,4 +116,3 @@ EXPORT_SYMBOL(__kmap);
116EXPORT_SYMBOL(__kunmap); 116EXPORT_SYMBOL(__kunmap);
117EXPORT_SYMBOL(__kmap_atomic); 117EXPORT_SYMBOL(__kmap_atomic);
118EXPORT_SYMBOL(__kunmap_atomic); 118EXPORT_SYMBOL(__kunmap_atomic);
119EXPORT_SYMBOL(__kmap_atomic_to_page);
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index d827d6144369..cab81f42eee5 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -310,8 +310,8 @@ void __cpuinit build_clear_page(void)
310 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) 310 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
311 uasm_i_lui(&buf, AT, 0xa000); 311 uasm_i_lui(&buf, AT, 0xa000);
312 312
313 off = min(8, pref_bias_clear_store / cache_line_size) * 313 off = cache_line_size ? min(8, pref_bias_clear_store / cache_line_size)
314 cache_line_size; 314 * cache_line_size : 0;
315 while (off) { 315 while (off) {
316 build_clear_pref(&buf, -off); 316 build_clear_pref(&buf, -off);
317 off -= cache_line_size; 317 off -= cache_line_size;
@@ -454,12 +454,14 @@ void __cpuinit build_copy_page(void)
454 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) 454 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
455 uasm_i_lui(&buf, AT, 0xa000); 455 uasm_i_lui(&buf, AT, 0xa000);
456 456
457 off = min(8, pref_bias_copy_load / cache_line_size) * cache_line_size; 457 off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
458 cache_line_size : 0;
458 while (off) { 459 while (off) {
459 build_copy_load_pref(&buf, -off); 460 build_copy_load_pref(&buf, -off);
460 off -= cache_line_size; 461 off -= cache_line_size;
461 } 462 }
462 off = min(8, pref_bias_copy_store / cache_line_size) * cache_line_size; 463 off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
464 cache_line_size : 0;
463 while (off) { 465 while (off) {
464 build_copy_store_pref(&buf, -off); 466 build_copy_store_pref(&buf, -off);
465 off -= cache_line_size; 467 off -= cache_line_size;
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 382738ca8a0b..76da73a5ab3c 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -224,8 +224,9 @@ static u32 final_handler[64] __cpuinitdata;
224static void __cpuinit __maybe_unused build_tlb_probe_entry(u32 **p) 224static void __cpuinit __maybe_unused build_tlb_probe_entry(u32 **p)
225{ 225{
226 switch (current_cpu_type()) { 226 switch (current_cpu_type()) {
227 /* Found by experiment: R4600 v2.0 needs this, too. */ 227 /* Found by experiment: R4600 v2.0/R4700 needs this, too. */
228 case CPU_R4600: 228 case CPU_R4600:
229 case CPU_R4700:
229 case CPU_R5000: 230 case CPU_R5000:
230 case CPU_R5000A: 231 case CPU_R5000A:
231 case CPU_NEVADA: 232 case CPU_NEVADA:
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index da8cbb6899dc..b40df7d2cf44 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -281,7 +281,7 @@ static inline int n_counters(void)
281 281
282static void reset_counters(void *arg) 282static void reset_counters(void *arg)
283{ 283{
284 int counters = (int)arg; 284 int counters = (int)(long)arg;
285 switch (counters) { 285 switch (counters) {
286 case 4: 286 case 4:
287 w_c0_perfctrl3(0); 287 w_c0_perfctrl3(0);
@@ -313,7 +313,7 @@ static int __init mipsxx_init(void)
313 if (!cpu_has_mipsmt_pertccounters) 313 if (!cpu_has_mipsmt_pertccounters)
314 counters = counters_total_to_per_cpu(counters); 314 counters = counters_total_to_per_cpu(counters);
315#endif 315#endif
316 on_each_cpu(reset_counters, (void *)counters, 0, 1); 316 on_each_cpu(reset_counters, (void *)(long)counters, 0, 1);
317 317
318 op_model_mipsxx_ops.num_counters = counters; 318 op_model_mipsxx_ops.num_counters = counters;
319 switch (current_cpu_type()) { 319 switch (current_cpu_type()) {
@@ -382,7 +382,7 @@ static void mipsxx_exit(void)
382 int counters = op_model_mipsxx_ops.num_counters; 382 int counters = op_model_mipsxx_ops.num_counters;
383 383
384 counters = counters_per_cpu_to_total(counters); 384 counters = counters_per_cpu_to_total(counters);
385 on_each_cpu(reset_counters, (void *)counters, 0, 1); 385 on_each_cpu(reset_counters, (void *)(long)counters, 0, 1);
386 386
387 perf_irq = save_perf_irq; 387 perf_irq = save_perf_irq;
388} 388}
diff --git a/arch/mips/pci/fixup-au1000.c b/arch/mips/pci/fixup-au1000.c
index 00c36c9dbe0e..e2ddfc49237c 100644
--- a/arch/mips/pci/fixup-au1000.c
+++ b/arch/mips/pci/fixup-au1000.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups. 3 * Board specific PCI fixups.
4 * 4 *
5 * Copyright 2001-2003 MontaVista Software Inc. 5 * Copyright 2001-2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
index 1314bd58f036..9a57c5ab91dd 100644
--- a/arch/mips/pci/ops-au1000.c
+++ b/arch/mips/pci/ops-au1000.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 PCI support. 3 * Alchemy/AMD Au1xx0 PCI support.
4 * 4 *
5 * Copyright 2001-2003, 2007 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007-2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Support for all devices (greater than 16) added by David Gathright. 8 * Support for all devices (greater than 16) added by David Gathright.
10 * 9 *
@@ -28,6 +27,7 @@
28 * with this program; if not, write to the Free Software Foundation, Inc., 27 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */ 29 */
30
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -36,9 +36,9 @@
36 36
37#include <asm/mach-au1x00/au1000.h> 37#include <asm/mach-au1x00/au1000.h>
38 38
39#undef DEBUG 39#undef DEBUG
40#ifdef DEBUG 40#ifdef DEBUG
41#define DBG(x...) printk(x) 41#define DBG(x...) printk(KERN_DEBUG x)
42#else 42#else
43#define DBG(x...) 43#define DBG(x...)
44#endif 44#endif
@@ -46,7 +46,6 @@
46#define PCI_ACCESS_READ 0 46#define PCI_ACCESS_READ 0
47#define PCI_ACCESS_WRITE 1 47#define PCI_ACCESS_WRITE 1
48 48
49
50int (*board_pci_idsel)(unsigned int devsel, int assert); 49int (*board_pci_idsel)(unsigned int devsel, int assert);
51 50
52void mod_wired_entry(int entry, unsigned long entrylo0, 51void mod_wired_entry(int entry, unsigned long entrylo0,
@@ -92,10 +91,9 @@ void __init au1x_pci_cfg_init(void)
92} 91}
93 92
94static int config_access(unsigned char access_type, struct pci_bus *bus, 93static int config_access(unsigned char access_type, struct pci_bus *bus,
95 unsigned int dev_fn, unsigned char where, 94 unsigned int dev_fn, unsigned char where, u32 *data)
96 u32 * data)
97{ 95{
98#if defined( CONFIG_SOC_AU1500 ) || defined( CONFIG_SOC_AU1550 ) 96#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
99 unsigned int device = PCI_SLOT(dev_fn); 97 unsigned int device = PCI_SLOT(dev_fn);
100 unsigned int function = PCI_FUNC(dev_fn); 98 unsigned int function = PCI_FUNC(dev_fn);
101 unsigned long offset, status; 99 unsigned long offset, status;
@@ -114,38 +112,36 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
114 Au1500_PCI_STATCMD); 112 Au1500_PCI_STATCMD);
115 au_sync_udelay(1); 113 au_sync_udelay(1);
116 114
117 /* Allow board vendors to implement their own off-chip idsel. 115 /*
116 * Allow board vendors to implement their own off-chip IDSEL.
118 * If it doesn't succeed, may as well bail out at this point. 117 * If it doesn't succeed, may as well bail out at this point.
119 */ 118 */
120 if (board_pci_idsel) { 119 if (board_pci_idsel && board_pci_idsel(device, 1) == 0) {
121 if (board_pci_idsel(device, 1) == 0) { 120 *data = 0xffffffff;
122 *data = 0xffffffff; 121 local_irq_restore(flags);
123 local_irq_restore(flags); 122 return -1;
124 return -1;
125 }
126 } 123 }
127 124
128 /* setup the config window */ 125 /* Setup the config window */
129 if (bus->number == 0) { 126 if (bus->number == 0)
130 cfg_base = ((1<<device)<<11); 127 cfg_base = (1 << device) << 11;
131 } else { 128 else
132 cfg_base = 0x80000000 | (bus->number<<16) | (device<<11); 129 cfg_base = 0x80000000 | (bus->number << 16) | (device << 11);
133 }
134 130
135 /* setup the lower bits of the 36 bit address */ 131 /* Setup the lower bits of the 36-bit address */
136 offset = (function << 8) | (where & ~0x3); 132 offset = (function << 8) | (where & ~0x3);
137 /* pick up any address that falls below the page mask */ 133 /* Pick up any address that falls below the page mask */
138 offset |= cfg_base & ~PAGE_MASK; 134 offset |= cfg_base & ~PAGE_MASK;
139 135
140 /* page boundary */ 136 /* Page boundary */
141 cfg_base = cfg_base & PAGE_MASK; 137 cfg_base = cfg_base & PAGE_MASK;
142 138
143 /* 139 /*
144 * To improve performance, if the current device is the same as 140 * To improve performance, if the current device is the same as
145 * the last device accessed, we don't touch the TLB. 141 * the last device accessed, we don't touch the TLB.
146 */ 142 */
147 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7; 143 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7;
148 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7; 144 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
149 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) { 145 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
150 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1, 146 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
151 (unsigned long)pci_cfg_vm->addr, PM_4K); 147 (unsigned long)pci_cfg_vm->addr, PM_4K);
@@ -153,38 +149,37 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
153 last_entryLo1 = entryLo1; 149 last_entryLo1 = entryLo1;
154 } 150 }
155 151
156 if (access_type == PCI_ACCESS_WRITE) { 152 if (access_type == PCI_ACCESS_WRITE)
157 au_writel(*data, (int)(pci_cfg_vm->addr + offset)); 153 au_writel(*data, (int)(pci_cfg_vm->addr + offset));
158 } else { 154 else
159 *data = au_readl((int)(pci_cfg_vm->addr + offset)); 155 *data = au_readl((int)(pci_cfg_vm->addr + offset));
160 } 156
161 au_sync_udelay(2); 157 au_sync_udelay(2);
162 158
163 DBG("cfg_access %d bus->number %d dev %d at %x *data %x conf %x\n", 159 DBG("cfg_access %d bus->number %u dev %u at %x *data %x conf %lx\n",
164 access_type, bus->number, device, where, *data, offset); 160 access_type, bus->number, device, where, *data, offset);
165 161
166 /* check master abort */ 162 /* Check master abort */
167 status = au_readl(Au1500_PCI_STATCMD); 163 status = au_readl(Au1500_PCI_STATCMD);
168 164
169 if (status & (1<<29)) { 165 if (status & (1 << 29)) {
170 *data = 0xffffffff; 166 *data = 0xffffffff;
171 error = -1; 167 error = -1;
172 DBG("Au1x Master Abort\n"); 168 DBG("Au1x Master Abort\n");
173 } else if ((status >> 28) & 0xf) { 169 } else if ((status >> 28) & 0xf) {
174 DBG("PCI ERR detected: device %d, status %x\n", device, ((status >> 28) & 0xf)); 170 DBG("PCI ERR detected: device %u, status %lx\n",
171 device, (status >> 28) & 0xf);
175 172
176 /* clear errors */ 173 /* Clear errors */
177 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD); 174 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD);
178 175
179 *data = 0xffffffff; 176 *data = 0xffffffff;
180 error = -1; 177 error = -1;
181 } 178 }
182 179
183 /* Take away the idsel. 180 /* Take away the IDSEL. */
184 */ 181 if (board_pci_idsel)
185 if (board_pci_idsel) {
186 (void)board_pci_idsel(device, 0); 182 (void)board_pci_idsel(device, 0);
187 }
188 183
189 local_irq_restore(flags); 184 local_irq_restore(flags);
190 return error; 185 return error;
@@ -192,7 +187,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
192} 187}
193 188
194static int read_config_byte(struct pci_bus *bus, unsigned int devfn, 189static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
195 int where, u8 * val) 190 int where, u8 *val)
196{ 191{
197 u32 data; 192 u32 data;
198 int ret; 193 int ret;
@@ -206,9 +201,8 @@ static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
206 return ret; 201 return ret;
207} 202}
208 203
209
210static int read_config_word(struct pci_bus *bus, unsigned int devfn, 204static int read_config_word(struct pci_bus *bus, unsigned int devfn,
211 int where, u16 * val) 205 int where, u16 *val)
212{ 206{
213 u32 data; 207 u32 data;
214 int ret; 208 int ret;
@@ -221,7 +215,7 @@ static int read_config_word(struct pci_bus *bus, unsigned int devfn,
221} 215}
222 216
223static int read_config_dword(struct pci_bus *bus, unsigned int devfn, 217static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
224 int where, u32 * val) 218 int where, u32 *val)
225{ 219{
226 int ret; 220 int ret;
227 221
@@ -229,9 +223,8 @@ static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
229 return ret; 223 return ret;
230} 224}
231 225
232static int 226static int write_config_byte(struct pci_bus *bus, unsigned int devfn,
233write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, 227 int where, u8 val)
234 u8 val)
235{ 228{
236 u32 data = 0; 229 u32 data = 0;
237 230
@@ -239,7 +232,7 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
239 return -1; 232 return -1;
240 233
241 data = (data & ~(0xff << ((where & 3) << 3))) | 234 data = (data & ~(0xff << ((where & 3) << 3))) |
242 (val << ((where & 3) << 3)); 235 (val << ((where & 3) << 3));
243 236
244 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 237 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
245 return -1; 238 return -1;
@@ -247,9 +240,8 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
247 return PCIBIOS_SUCCESSFUL; 240 return PCIBIOS_SUCCESSFUL;
248} 241}
249 242
250static int 243static int write_config_word(struct pci_bus *bus, unsigned int devfn,
251write_config_word(struct pci_bus *bus, unsigned int devfn, int where, 244 int where, u16 val)
252 u16 val)
253{ 245{
254 u32 data = 0; 246 u32 data = 0;
255 247
@@ -257,18 +249,16 @@ write_config_word(struct pci_bus *bus, unsigned int devfn, int where,
257 return -1; 249 return -1;
258 250
259 data = (data & ~(0xffff << ((where & 3) << 3))) | 251 data = (data & ~(0xffff << ((where & 3) << 3))) |
260 (val << ((where & 3) << 3)); 252 (val << ((where & 3) << 3));
261 253
262 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 254 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
263 return -1; 255 return -1;
264 256
265
266 return PCIBIOS_SUCCESSFUL; 257 return PCIBIOS_SUCCESSFUL;
267} 258}
268 259
269static int 260static int write_config_dword(struct pci_bus *bus, unsigned int devfn,
270write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, 261 int where, u32 val)
271 u32 val)
272{ 262{
273 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val)) 263 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
274 return -1; 264 return -1;
@@ -277,18 +267,20 @@ write_config_dword(struct pci_bus *bus, unsigned int devfn, int where,
277} 267}
278 268
279static int config_read(struct pci_bus *bus, unsigned int devfn, 269static int config_read(struct pci_bus *bus, unsigned int devfn,
280 int where, int size, u32 * val) 270 int where, int size, u32 *val)
281{ 271{
282 switch (size) { 272 switch (size) {
283 case 1: { 273 case 1: {
284 u8 _val; 274 u8 _val;
285 int rc = read_config_byte(bus, devfn, where, &_val); 275 int rc = read_config_byte(bus, devfn, where, &_val);
276
286 *val = _val; 277 *val = _val;
287 return rc; 278 return rc;
288 } 279 }
289 case 2: { 280 case 2: {
290 u16 _val; 281 u16 _val;
291 int rc = read_config_word(bus, devfn, where, &_val); 282 int rc = read_config_word(bus, devfn, where, &_val);
283
292 *val = _val; 284 *val = _val;
293 return rc; 285 return rc;
294 } 286 }
@@ -310,7 +302,6 @@ static int config_write(struct pci_bus *bus, unsigned int devfn,
310 } 302 }
311} 303}
312 304
313
314struct pci_ops au1x_pci_ops = { 305struct pci_ops au1x_pci_ops = {
315 config_read, 306 config_read,
316 config_write 307 config_write
diff --git a/arch/mips/pci/ops-bridge.c b/arch/mips/pci/ops-bridge.c
index 1fa09929cd7a..b46b3e211775 100644
--- a/arch/mips/pci/ops-bridge.c
+++ b/arch/mips/pci/ops-bridge.c
@@ -14,6 +14,22 @@
14#include <asm/sn/sn0/hub.h> 14#include <asm/sn/sn0/hub.h>
15 15
16/* 16/*
17 * Most of the IOC3 PCI config register aren't present
18 * we emulate what is needed for a normal PCI enumeration
19 */
20static u32 emulate_ioc3_cfg(int where, int size)
21{
22 if (size == 1 && where == 0x3d)
23 return 0x01;
24 else if (size == 2 && where == 0x3c)
25 return 0x0100;
26 else if (size == 4 && where == 0x3c)
27 return 0x00000100;
28
29 return 0;
30}
31
32/*
17 * The Bridge ASIC supports both type 0 and type 1 access. Type 1 is 33 * The Bridge ASIC supports both type 0 and type 1 access. Type 1 is
18 * not really documented, so right now I can't write code which uses it. 34 * not really documented, so right now I can't write code which uses it.
19 * Therefore we use type 0 accesses for now even though they won't work 35 * Therefore we use type 0 accesses for now even though they won't work
@@ -64,7 +80,7 @@ oh_my_gawd:
64 * generic PCI code a chance to look at the wrong register. 80 * generic PCI code a chance to look at the wrong register.
65 */ 81 */
66 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) { 82 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
67 *value = 0; 83 *value = emulate_ioc3_cfg(where, size);
68 return PCIBIOS_SUCCESSFUL; 84 return PCIBIOS_SUCCESSFUL;
69 } 85 }
70 86
@@ -127,7 +143,7 @@ oh_my_gawd:
127 * generic PCI code a chance to look at the wrong register. 143 * generic PCI code a chance to look at the wrong register.
128 */ 144 */
129 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) { 145 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
130 *value = 0; 146 *value = emulate_ioc3_cfg(where, size);
131 return PCIBIOS_SUCCESSFUL; 147 return PCIBIOS_SUCCESSFUL;
132 } 148 }
133 149
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index bb64828a92fe..a18516925cdd 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -47,6 +47,9 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
47 static int num_bridges = 0; 47 static int num_bridges = 0;
48 bridge_t *bridge; 48 bridge_t *bridge;
49 int slot; 49 int slot;
50 extern int pci_probe_only;
51
52 pci_probe_only = 1;
50 53
51 printk("a bridge\n"); 54 printk("a bridge\n");
52 55
@@ -100,6 +103,11 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
100 */ 103 */
101 bridge->b_wid_control |= BRIDGE_CTRL_IO_SWAP | 104 bridge->b_wid_control |= BRIDGE_CTRL_IO_SWAP |
102 BRIDGE_CTRL_MEM_SWAP; 105 BRIDGE_CTRL_MEM_SWAP;
106#ifdef CONFIG_PAGE_SIZE_4KB
107 bridge->b_wid_control &= ~BRIDGE_CTRL_PAGE_SIZE;
108#else /* 16kB or larger */
109 bridge->b_wid_control |= BRIDGE_CTRL_PAGE_SIZE;
110#endif
103 111
104 /* 112 /*
105 * Hmm... IRIX sets additional bits in the address which 113 * Hmm... IRIX sets additional bits in the address which
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
index ab96a2d7f4c4..11769b55438c 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
@@ -126,9 +126,6 @@ static irqreturn_t hwbutton_handler(int irq, void *data)
126 struct hwbutton_interrupt *hirq = data; 126 struct hwbutton_interrupt *hirq = data;
127 unsigned long cic_ext = *CIC_EXT_CFG_REG; 127 unsigned long cic_ext = *CIC_EXT_CFG_REG;
128 128
129 if (irq != hirq->irq)
130 return IRQ_NONE;
131
132 if (CIC_EXT_IS_ACTIVE_HI(cic_ext, hirq->eirq)) { 129 if (CIC_EXT_IS_ACTIVE_HI(cic_ext, hirq->eirq)) {
133 /* Interrupt: pin is now HI */ 130 /* Interrupt: pin is now HI */
134 CIC_EXT_SET_ACTIVE_LO(cic_ext, hirq->eirq); 131 CIC_EXT_SET_ACTIVE_LO(cic_ext, hirq->eirq);
@@ -164,7 +161,7 @@ static int msp_hwbutton_register(struct hwbutton_interrupt *hirq)
164 *CIC_EXT_CFG_REG = cic_ext; 161 *CIC_EXT_CFG_REG = cic_ext;
165 162
166 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED, 163 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED,
167 hirq->name, (void *)hirq); 164 hirq->name, hirq);
168} 165}
169 166
170static int __init msp_hwbutton_setup(void) 167static int __init msp_hwbutton_setup(void)
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index 7093e7c573a4..4a500e8cd3cc 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -161,27 +161,6 @@ cnodeid_t get_compact_nodeid(void)
161 return NASID_TO_COMPACT_NODEID(get_nasid()); 161 return NASID_TO_COMPACT_NODEID(get_nasid());
162} 162}
163 163
164/* Extracted from the IOC3 meta driver. FIXME. */
165static inline void ioc3_sio_init(void)
166{
167 struct ioc3 *ioc3;
168 nasid_t nid;
169 long loops;
170
171 nid = get_nasid();
172 ioc3 = (struct ioc3 *) KL_CONFIG_CH_CONS_INFO(nid)->memory_base;
173
174 ioc3->sscr_a = 0; /* PIO mode for uarta. */
175 ioc3->sscr_b = 0; /* PIO mode for uartb. */
176 ioc3->sio_iec = ~0;
177 ioc3->sio_ies = (SIO_IR_SA_INT | SIO_IR_SB_INT);
178
179 loops=1000000; while(loops--);
180 ioc3->sregs.uarta.iu_fcr = 0;
181 ioc3->sregs.uartb.iu_fcr = 0;
182 loops=1000000; while(loops--);
183}
184
185static inline void ioc3_eth_init(void) 164static inline void ioc3_eth_init(void)
186{ 165{
187 struct ioc3 *ioc3; 166 struct ioc3 *ioc3;
@@ -234,7 +213,6 @@ void __init plat_mem_setup(void)
234 panic("Kernel compiled for N mode."); 213 panic("Kernel compiled for N mode.");
235#endif 214#endif
236 215
237 ioc3_sio_init();
238 ioc3_eth_init(); 216 ioc3_eth_init();
239 per_cpu_init(); 217 per_cpu_init();
240 218
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index bf438d02366e..42cd10956306 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -33,10 +33,6 @@
33#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) 33#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT)
34#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) 34#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT)
35 35
36#define SLOT_IGNORED 0xffff
37
38static short __initdata slot_lastfilled_cache[MAX_COMPACT_NODES];
39static unsigned short __initdata slot_psize_cache[MAX_COMPACT_NODES][MAX_MEM_SLOTS];
40static struct bootmem_data __initdata plat_node_bdata[MAX_COMPACT_NODES]; 36static struct bootmem_data __initdata plat_node_bdata[MAX_COMPACT_NODES];
41 37
42struct node_data *__node_data[MAX_COMPACT_NODES]; 38struct node_data *__node_data[MAX_COMPACT_NODES];
@@ -267,51 +263,6 @@ static pfn_t __init slot_getbasepfn(cnodeid_t cnode, int slot)
267 return ((pfn_t)nasid << PFN_NASIDSHFT) | (slot << SLOT_PFNSHIFT); 263 return ((pfn_t)nasid << PFN_NASIDSHFT) | (slot << SLOT_PFNSHIFT);
268} 264}
269 265
270/*
271 * Return the number of pages of memory provided by the given slot
272 * on the specified node.
273 */
274static pfn_t __init slot_getsize(cnodeid_t node, int slot)
275{
276 return (pfn_t) slot_psize_cache[node][slot];
277}
278
279/*
280 * Return highest slot filled
281 */
282static int __init node_getlastslot(cnodeid_t node)
283{
284 return (int) slot_lastfilled_cache[node];
285}
286
287/*
288 * Return the pfn of the last free page of memory on a node.
289 */
290static pfn_t __init node_getmaxclick(cnodeid_t node)
291{
292 pfn_t slot_psize;
293 int slot;
294
295 /*
296 * Start at the top slot. When we find a slot with memory in it,
297 * that's the winner.
298 */
299 for (slot = (MAX_MEM_SLOTS - 1); slot >= 0; slot--) {
300 if ((slot_psize = slot_getsize(node, slot))) {
301 if (slot_psize == SLOT_IGNORED)
302 continue;
303 /* Return the basepfn + the slot size, minus 1. */
304 return slot_getbasepfn(node, slot) + slot_psize - 1;
305 }
306 }
307
308 /*
309 * If there's no memory on the node, return 0. This is likely
310 * to cause problems.
311 */
312 return 0;
313}
314
315static pfn_t __init slot_psize_compute(cnodeid_t node, int slot) 266static pfn_t __init slot_psize_compute(cnodeid_t node, int slot)
316{ 267{
317 nasid_t nasid; 268 nasid_t nasid;
@@ -404,13 +355,13 @@ static void __init mlreset(void)
404static void __init szmem(void) 355static void __init szmem(void)
405{ 356{
406 pfn_t slot_psize, slot0sz = 0, nodebytes; /* Hack to detect problem configs */ 357 pfn_t slot_psize, slot0sz = 0, nodebytes; /* Hack to detect problem configs */
407 int slot, ignore; 358 int slot;
408 cnodeid_t node; 359 cnodeid_t node;
409 360
410 num_physpages = 0; 361 num_physpages = 0;
411 362
412 for_each_online_node(node) { 363 for_each_online_node(node) {
413 ignore = nodebytes = 0; 364 nodebytes = 0;
414 for (slot = 0; slot < MAX_MEM_SLOTS; slot++) { 365 for (slot = 0; slot < MAX_MEM_SLOTS; slot++) {
415 slot_psize = slot_psize_compute(node, slot); 366 slot_psize = slot_psize_compute(node, slot);
416 if (slot == 0) 367 if (slot == 0)
@@ -420,21 +371,20 @@ static void __init szmem(void)
420 * kernel text. 371 * kernel text.
421 */ 372 */
422 nodebytes += (1LL << SLOT_SHIFT); 373 nodebytes += (1LL << SLOT_SHIFT);
374
375 if (!slot_psize)
376 continue;
377
423 if ((nodebytes >> PAGE_SHIFT) * (sizeof(struct page)) > 378 if ((nodebytes >> PAGE_SHIFT) * (sizeof(struct page)) >
424 (slot0sz << PAGE_SHIFT)) 379 (slot0sz << PAGE_SHIFT)) {
425 ignore = 1;
426 if (ignore && slot_psize) {
427 printk("Ignoring slot %d onwards on node %d\n", 380 printk("Ignoring slot %d onwards on node %d\n",
428 slot, node); 381 slot, node);
429 slot_psize_cache[node][slot] = SLOT_IGNORED;
430 slot = MAX_MEM_SLOTS; 382 slot = MAX_MEM_SLOTS;
431 continue; 383 continue;
432 } 384 }
433 num_physpages += slot_psize; 385 num_physpages += slot_psize;
434 slot_psize_cache[node][slot] = 386 add_active_range(node, slot_getbasepfn(node, slot),
435 (unsigned short) slot_psize; 387 slot_getbasepfn(node, slot) + slot_psize);
436 if (slot_psize)
437 slot_lastfilled_cache[node] = slot;
438 } 388 }
439 } 389 }
440} 390}
@@ -442,18 +392,20 @@ static void __init szmem(void)
442static void __init node_mem_init(cnodeid_t node) 392static void __init node_mem_init(cnodeid_t node)
443{ 393{
444 pfn_t slot_firstpfn = slot_getbasepfn(node, 0); 394 pfn_t slot_firstpfn = slot_getbasepfn(node, 0);
445 pfn_t slot_lastpfn = slot_firstpfn + slot_getsize(node, 0);
446 pfn_t slot_freepfn = node_getfirstfree(node); 395 pfn_t slot_freepfn = node_getfirstfree(node);
447 struct pglist_data *pd;
448 unsigned long bootmap_size; 396 unsigned long bootmap_size;
397 pfn_t start_pfn, end_pfn;
398
399 get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
449 400
450 /* 401 /*
451 * Allocate the node data structures on the node first. 402 * Allocate the node data structures on the node first.
452 */ 403 */
453 __node_data[node] = __va(slot_freepfn << PAGE_SHIFT); 404 __node_data[node] = __va(slot_freepfn << PAGE_SHIFT);
454 405
455 pd = NODE_DATA(node); 406 NODE_DATA(node)->bdata = &plat_node_bdata[node];
456 pd->bdata = &plat_node_bdata[node]; 407 NODE_DATA(node)->node_start_pfn = start_pfn;
408 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
457 409
458 cpus_clear(hub_data(node)->h_cpus); 410 cpus_clear(hub_data(node)->h_cpus);
459 411
@@ -461,12 +413,12 @@ static void __init node_mem_init(cnodeid_t node)
461 sizeof(struct hub_data)); 413 sizeof(struct hub_data));
462 414
463 bootmap_size = init_bootmem_node(NODE_DATA(node), slot_freepfn, 415 bootmap_size = init_bootmem_node(NODE_DATA(node), slot_freepfn,
464 slot_firstpfn, slot_lastpfn); 416 start_pfn, end_pfn);
465 free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 417 free_bootmem_with_active_regions(node, end_pfn);
466 (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT);
467 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 418 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
468 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size, 419 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size,
469 BOOTMEM_DEFAULT); 420 BOOTMEM_DEFAULT);
421 sparse_memory_present_with_active_regions(node);
470} 422}
471 423
472/* 424/*
@@ -515,16 +467,15 @@ void __init paging_init(void)
515 pagetable_init(); 467 pagetable_init();
516 468
517 for_each_online_node(node) { 469 for_each_online_node(node) {
518 pfn_t start_pfn = slot_getbasepfn(node, 0); 470 pfn_t start_pfn, end_pfn;
519 pfn_t end_pfn = node_getmaxclick(node) + 1;
520 471
521 zones_size[ZONE_NORMAL] = end_pfn - start_pfn; 472 get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
522 free_area_init_node(node, NODE_DATA(node),
523 zones_size, start_pfn, NULL);
524 473
525 if (end_pfn > max_low_pfn) 474 if (end_pfn > max_low_pfn)
526 max_low_pfn = end_pfn; 475 max_low_pfn = end_pfn;
527 } 476 }
477 zones_size[ZONE_NORMAL] = max_low_pfn;
478 free_area_init_nodes(zones_size);
528} 479}
529 480
530void __init mem_init(void) 481void __init mem_init(void)
@@ -535,34 +486,10 @@ void __init mem_init(void)
535 high_memory = (void *) __va(num_physpages << PAGE_SHIFT); 486 high_memory = (void *) __va(num_physpages << PAGE_SHIFT);
536 487
537 for_each_online_node(node) { 488 for_each_online_node(node) {
538 unsigned slot, numslots;
539 struct page *end, *p;
540
541 /* 489 /*
542 * This will free up the bootmem, ie, slot 0 memory. 490 * This will free up the bootmem, ie, slot 0 memory.
543 */ 491 */
544 totalram_pages += free_all_bootmem_node(NODE_DATA(node)); 492 totalram_pages += free_all_bootmem_node(NODE_DATA(node));
545
546 /*
547 * We need to manually do the other slots.
548 */
549 numslots = node_getlastslot(node);
550 for (slot = 1; slot <= numslots; slot++) {
551 p = nid_page_nr(node, slot_getbasepfn(node, slot) -
552 slot_getbasepfn(node, 0));
553
554 /*
555 * Free valid memory in current slot.
556 */
557 for (end = p + slot_getsize(node, slot); p < end; p++) {
558 /* if (!page_is_ram(pgnr)) continue; */
559 /* commented out until page_is_ram works */
560 ClearPageReserved(p);
561 init_page_count(p);
562 __free_page(p);
563 totalram_pages++;
564 }
565 }
566 } 493 }
567 494
568 totalram_pages -= setup_zero_pages(); /* This comes from node 0 */ 495 totalram_pages -= setup_zero_pages(); /* This comes from node 0 */
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index f15fc93d6b35..ba5cdebeaf0d 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -176,11 +176,14 @@ static void ip27_send_ipi_mask(cpumask_t mask, unsigned int action)
176static void __cpuinit ip27_init_secondary(void) 176static void __cpuinit ip27_init_secondary(void)
177{ 177{
178 per_cpu_init(); 178 per_cpu_init();
179 local_irq_enable();
180} 179}
181 180
182static void __cpuinit ip27_smp_finish(void) 181static void __cpuinit ip27_smp_finish(void)
183{ 182{
183 extern void hub_rt_clock_event_init(void);
184
185 hub_rt_clock_event_init();
186 local_irq_enable();
184} 187}
185 188
186static void __init ip27_cpus_done(void) 189static void __init ip27_cpus_done(void)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 25d3baf0ebc4..8b4e854af925 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -158,12 +158,15 @@ static void rt_set_mode(enum clock_event_mode mode,
158 } 158 }
159} 159}
160 160
161unsigned int rt_timer_irq; 161int rt_timer_irq;
162
163static DEFINE_PER_CPU(struct clock_event_device, hub_rt_clockevent);
164static DEFINE_PER_CPU(char [11], hub_rt_name);
162 165
163static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id) 166static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
164{ 167{
165 struct clock_event_device *cd = dev_id;
166 unsigned int cpu = smp_processor_id(); 168 unsigned int cpu = smp_processor_id();
169 struct clock_event_device *cd = &per_cpu(hub_rt_clockevent, cpu);
167 int slice = cputoslice(cpu); 170 int slice = cputoslice(cpu);
168 171
169 /* 172 /*
@@ -192,10 +195,7 @@ struct irqaction hub_rt_irqaction = {
192#define NSEC_PER_CYCLE 800 195#define NSEC_PER_CYCLE 800
193#define CYCLES_PER_SEC (NSEC_PER_SEC / NSEC_PER_CYCLE) 196#define CYCLES_PER_SEC (NSEC_PER_SEC / NSEC_PER_CYCLE)
194 197
195static DEFINE_PER_CPU(struct clock_event_device, hub_rt_clockevent); 198void __cpuinit hub_rt_clock_event_init(void)
196static DEFINE_PER_CPU(char [11], hub_rt_name);
197
198static void __cpuinit hub_rt_clock_event_init(void)
199{ 199{
200 unsigned int cpu = smp_processor_id(); 200 unsigned int cpu = smp_processor_id();
201 struct clock_event_device *cd = &per_cpu(hub_rt_clockevent, cpu); 201 struct clock_event_device *cd = &per_cpu(hub_rt_clockevent, cpu);
@@ -203,23 +203,22 @@ static void __cpuinit hub_rt_clock_event_init(void)
203 int irq = rt_timer_irq; 203 int irq = rt_timer_irq;
204 204
205 sprintf(name, "hub-rt %d", cpu); 205 sprintf(name, "hub-rt %d", cpu);
206 cd->name = "HUB-RT", 206 cd->name = name;
207 cd->features = CLOCK_EVT_FEAT_ONESHOT, 207 cd->features = CLOCK_EVT_FEAT_ONESHOT;
208 clockevent_set_clock(cd, CYCLES_PER_SEC); 208 clockevent_set_clock(cd, CYCLES_PER_SEC);
209 cd->max_delta_ns = clockevent_delta2ns(0xfffffffffffff, cd); 209 cd->max_delta_ns = clockevent_delta2ns(0xfffffffffffff, cd);
210 cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 210 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
211 cd->rating = 200, 211 cd->rating = 200;
212 cd->irq = irq, 212 cd->irq = irq;
213 cd->cpumask = cpumask_of_cpu(cpu), 213 cd->cpumask = cpumask_of_cpu(cpu);
214 cd->rating = 300, 214 cd->set_next_event = rt_next_event;
215 cd->set_next_event = rt_next_event, 215 cd->set_mode = rt_set_mode;
216 cd->set_mode = rt_set_mode,
217 clockevents_register_device(cd); 216 clockevents_register_device(cd);
218} 217}
219 218
220static void __init hub_rt_clock_event_global_init(void) 219static void __init hub_rt_clock_event_global_init(void)
221{ 220{
222 unsigned int irq; 221 int irq;
223 222
224 do { 223 do {
225 smp_wmb(); 224 smp_wmb();
@@ -261,6 +260,7 @@ void __init plat_time_init(void)
261{ 260{
262 hub_rt_clocksource_init(); 261 hub_rt_clocksource_init();
263 hub_rt_clock_event_global_init(); 262 hub_rt_clock_event_global_init();
263 hub_rt_clock_event_init();
264} 264}
265 265
266void __cpuinit cpu_time_init(void) 266void __cpuinit cpu_time_init(void)
@@ -281,7 +281,6 @@ void __cpuinit cpu_time_init(void)
281 281
282 printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed); 282 printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed);
283 283
284 hub_rt_clock_event_init();
285 set_c0_status(SRB_TIMOCLK); 284 set_c0_status(SRB_TIMOCLK);
286} 285}
287 286
diff --git a/arch/mn10300/boot/install.sh b/arch/mn10300/boot/install.sh
index 072951c83976..abba30971191 100644
--- a/arch/mn10300/boot/install.sh
+++ b/arch/mn10300/boot/install.sh
@@ -26,42 +26,42 @@ rm -fr $4/../usr/include/linux $4/../usr/include/asm
26install -c -m 0755 $2 $4/vmlinuz 26install -c -m 0755 $2 $4/vmlinuz
27install -c -m 0755 $5 $4/boot.rom 27install -c -m 0755 $5 $4/boot.rom
28install -c -m 0755 -d $4/../usr/include/linux 28install -c -m 0755 -d $4/../usr/include/linux
29cd $TOPDIR/include/linux 29cd ${srctree}/include/linux
30for i in `find . -maxdepth 1 -name '*.h' -print`; do 30for i in `find . -maxdepth 1 -name '*.h' -print`; do
31 install -c -m 0644 $i $4/../usr/include/linux 31 install -c -m 0644 $i $4/../usr/include/linux
32done 32done
33install -c -m 0755 -d $4/../usr/include/linux/byteorder 33install -c -m 0755 -d $4/../usr/include/linux/byteorder
34cd $TOPDIR/include/linux/byteorder 34cd ${srctree}/include/linux/byteorder
35for i in `find . -name '*.h' -print`; do 35for i in `find . -name '*.h' -print`; do
36 install -c -m 0644 $i $4/../usr/include/linux/byteorder 36 install -c -m 0644 $i $4/../usr/include/linux/byteorder
37done 37done
38install -c -m 0755 -d $4/../usr/include/linux/lockd 38install -c -m 0755 -d $4/../usr/include/linux/lockd
39cd $TOPDIR/include/linux/lockd 39cd ${srctree}/include/linux/lockd
40for i in `find . -name '*.h' -print`; do 40for i in `find . -name '*.h' -print`; do
41 install -c -m 0644 $i $4/../usr/include/linux/lockd 41 install -c -m 0644 $i $4/../usr/include/linux/lockd
42done 42done
43install -c -m 0755 -d $4/../usr/include/linux/netfilter_ipv4 43install -c -m 0755 -d $4/../usr/include/linux/netfilter_ipv4
44cd $TOPDIR/include/linux/netfilter_ipv4 44cd ${srctree}/include/linux/netfilter_ipv4
45for i in `find . -name '*.h' -print`; do 45for i in `find . -name '*.h' -print`; do
46 install -c -m 0644 $i $4/../usr/include/linux/netfilter_ipv4 46 install -c -m 0644 $i $4/../usr/include/linux/netfilter_ipv4
47done 47done
48install -c -m 0755 -d $4/../usr/include/linux/nfsd 48install -c -m 0755 -d $4/../usr/include/linux/nfsd
49cd $TOPDIR/include/linux/nfsd 49cd ${srctree}/include/linux/nfsd
50for i in `find . -name '*.h' -print`; do 50for i in `find . -name '*.h' -print`; do
51 install -c -m 0644 $i $4/../usr/include/linux/nfsd/$i 51 install -c -m 0644 $i $4/../usr/include/linux/nfsd/$i
52done 52done
53install -c -m 0755 -d $4/../usr/include/linux/raid 53install -c -m 0755 -d $4/../usr/include/linux/raid
54cd $TOPDIR/include/linux/raid 54cd ${srctree}/include/linux/raid
55for i in `find . -name '*.h' -print`; do 55for i in `find . -name '*.h' -print`; do
56 install -c -m 0644 $i $4/../usr/include/linux/raid 56 install -c -m 0644 $i $4/../usr/include/linux/raid
57done 57done
58install -c -m 0755 -d $4/../usr/include/linux/sunrpc 58install -c -m 0755 -d $4/../usr/include/linux/sunrpc
59cd $TOPDIR/include/linux/sunrpc 59cd ${srctree}/include/linux/sunrpc
60for i in `find . -name '*.h' -print`; do 60for i in `find . -name '*.h' -print`; do
61 install -c -m 0644 $i $4/../usr/include/linux/sunrpc 61 install -c -m 0644 $i $4/../usr/include/linux/sunrpc
62done 62done
63install -c -m 0755 -d $4/../usr/include/asm 63install -c -m 0755 -d $4/../usr/include/asm
64cd $TOPDIR/include/asm 64cd ${srctree}/include/asm
65for i in `find . -name '*.h' -print`; do 65for i in `find . -name '*.h' -print`; do
66 install -c -m 0644 $i $4/../usr/include/asm 66 install -c -m 0644 $i $4/../usr/include/asm
67done 67done
diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c
index 39fe6882dd1d..af16f6e5c918 100644
--- a/arch/mn10300/kernel/init_task.c
+++ b/arch/mn10300/kernel/init_task.c
@@ -19,7 +19,6 @@
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20 20
21static struct fs_struct init_fs = INIT_FS; 21static struct fs_struct init_fs = INIT_FS;
22static struct files_struct init_files = INIT_FILES;
23static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 22static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
24static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 23static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
25struct mm_struct init_mm = INIT_MM(init_mm); 24struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index 1f6585a56f97..016d3fc4111c 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -4,9 +4,6 @@
4 4
5extra-y := init_task.o head.o vmlinux.lds 5extra-y := init_task.o head.o vmlinux.lds
6 6
7AFLAGS_entry.o := -traditional
8AFLAGS_pacache.o := -traditional
9
10obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ 7obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
11 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ 8 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
12 ptrace.o hardware.o inventory.o drivers.o \ 9 ptrace.o hardware.o inventory.o drivers.o \
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 111d47284eac..d1fa4edd2d80 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -40,16 +40,8 @@
40#include <linux/linkage.h> 40#include <linux/linkage.h>
41 41
42#ifdef CONFIG_64BIT 42#ifdef CONFIG_64BIT
43#define CMPIB cmpib,*
44#define CMPB cmpb,*
45#define COND(x) *x
46
47 .level 2.0w 43 .level 2.0w
48#else 44#else
49#define CMPIB cmpib,
50#define CMPB cmpb,
51#define COND(x) x
52
53 .level 2.0 45 .level 2.0
54#endif 46#endif
55 47
@@ -957,9 +949,9 @@ intr_check_sig:
957 * Only do signals if we are returning to user space 949 * Only do signals if we are returning to user space
958 */ 950 */
959 LDREG PT_IASQ0(%r16), %r20 951 LDREG PT_IASQ0(%r16), %r20
960 CMPIB=,n 0,%r20,intr_restore /* backward */ 952 cmpib,COND(=),n 0,%r20,intr_restore /* backward */
961 LDREG PT_IASQ1(%r16), %r20 953 LDREG PT_IASQ1(%r16), %r20
962 CMPIB=,n 0,%r20,intr_restore /* backward */ 954 cmpib,COND(=),n 0,%r20,intr_restore /* backward */
963 955
964 copy %r0, %r25 /* long in_syscall = 0 */ 956 copy %r0, %r25 /* long in_syscall = 0 */
965#ifdef CONFIG_64BIT 957#ifdef CONFIG_64BIT
@@ -1013,10 +1005,10 @@ intr_do_resched:
1013 * we jump back to intr_restore. 1005 * we jump back to intr_restore.
1014 */ 1006 */
1015 LDREG PT_IASQ0(%r16), %r20 1007 LDREG PT_IASQ0(%r16), %r20
1016 CMPIB= 0, %r20, intr_do_preempt 1008 cmpib,COND(=) 0, %r20, intr_do_preempt
1017 nop 1009 nop
1018 LDREG PT_IASQ1(%r16), %r20 1010 LDREG PT_IASQ1(%r16), %r20
1019 CMPIB= 0, %r20, intr_do_preempt 1011 cmpib,COND(=) 0, %r20, intr_do_preempt
1020 nop 1012 nop
1021 1013
1022#ifdef CONFIG_64BIT 1014#ifdef CONFIG_64BIT
@@ -1045,7 +1037,7 @@ intr_do_preempt:
1045 /* current_thread_info()->preempt_count */ 1037 /* current_thread_info()->preempt_count */
1046 mfctl %cr30, %r1 1038 mfctl %cr30, %r1
1047 LDREG TI_PRE_COUNT(%r1), %r19 1039 LDREG TI_PRE_COUNT(%r1), %r19
1048 CMPIB<> 0, %r19, intr_restore /* if preempt_count > 0 */ 1040 cmpib,COND(<>) 0, %r19, intr_restore /* if preempt_count > 0 */
1049 nop /* prev insn branched backwards */ 1041 nop /* prev insn branched backwards */
1050 1042
1051 /* check if we interrupted a critical path */ 1043 /* check if we interrupted a critical path */
@@ -1064,7 +1056,7 @@ intr_do_preempt:
1064 */ 1056 */
1065 1057
1066intr_extint: 1058intr_extint:
1067 CMPIB=,n 0,%r16,1f 1059 cmpib,COND(=),n 0,%r16,1f
1068 1060
1069 get_stack_use_cr30 1061 get_stack_use_cr30
1070 b,n 2f 1062 b,n 2f
@@ -1099,7 +1091,7 @@ ENDPROC(syscall_exit_rfi)
1099 1091
1100ENTRY(intr_save) /* for os_hpmc */ 1092ENTRY(intr_save) /* for os_hpmc */
1101 mfsp %sr7,%r16 1093 mfsp %sr7,%r16
1102 CMPIB=,n 0,%r16,1f 1094 cmpib,COND(=),n 0,%r16,1f
1103 get_stack_use_cr30 1095 get_stack_use_cr30
1104 b 2f 1096 b 2f
1105 copy %r8,%r26 1097 copy %r8,%r26
@@ -1121,7 +1113,7 @@ ENTRY(intr_save) /* for os_hpmc */
1121 * adjust isr/ior below. 1113 * adjust isr/ior below.
1122 */ 1114 */
1123 1115
1124 CMPIB=,n 6,%r26,skip_save_ior 1116 cmpib,COND(=),n 6,%r26,skip_save_ior
1125 1117
1126 1118
1127 mfctl %cr20, %r16 /* isr */ 1119 mfctl %cr20, %r16 /* isr */
@@ -1450,11 +1442,11 @@ nadtlb_emulate:
1450 bb,>=,n %r9,26,nadtlb_nullify /* m bit not set, just nullify */ 1442 bb,>=,n %r9,26,nadtlb_nullify /* m bit not set, just nullify */
1451 BL get_register,%r25 1443 BL get_register,%r25
1452 extrw,u %r9,15,5,%r8 /* Get index register # */ 1444 extrw,u %r9,15,5,%r8 /* Get index register # */
1453 CMPIB=,n -1,%r1,nadtlb_fault /* have to use slow path */ 1445 cmpib,COND(=),n -1,%r1,nadtlb_fault /* have to use slow path */
1454 copy %r1,%r24 1446 copy %r1,%r24
1455 BL get_register,%r25 1447 BL get_register,%r25
1456 extrw,u %r9,10,5,%r8 /* Get base register # */ 1448 extrw,u %r9,10,5,%r8 /* Get base register # */
1457 CMPIB=,n -1,%r1,nadtlb_fault /* have to use slow path */ 1449 cmpib,COND(=),n -1,%r1,nadtlb_fault /* have to use slow path */
1458 BL set_register,%r25 1450 BL set_register,%r25
1459 add,l %r1,%r24,%r1 /* doesn't affect c/b bits */ 1451 add,l %r1,%r24,%r1 /* doesn't affect c/b bits */
1460 1452
@@ -1486,7 +1478,7 @@ nadtlb_probe_check:
1486 cmpb,<>,n %r16,%r17,nadtlb_fault /* Must be probe,[rw]*/ 1478 cmpb,<>,n %r16,%r17,nadtlb_fault /* Must be probe,[rw]*/
1487 BL get_register,%r25 /* Find the target register */ 1479 BL get_register,%r25 /* Find the target register */
1488 extrw,u %r9,31,5,%r8 /* Get target register */ 1480 extrw,u %r9,31,5,%r8 /* Get target register */
1489 CMPIB=,n -1,%r1,nadtlb_fault /* have to use slow path */ 1481 cmpib,COND(=),n -1,%r1,nadtlb_fault /* have to use slow path */
1490 BL set_register,%r25 1482 BL set_register,%r25
1491 copy %r0,%r1 /* Write zero to target register */ 1483 copy %r0,%r1 /* Write zero to target register */
1492 b nadtlb_nullify /* Nullify return insn */ 1484 b nadtlb_nullify /* Nullify return insn */
@@ -1570,12 +1562,12 @@ dbit_trap_20w:
1570 L3_ptep ptp,pte,t0,va,dbit_fault 1562 L3_ptep ptp,pte,t0,va,dbit_fault
1571 1563
1572#ifdef CONFIG_SMP 1564#ifdef CONFIG_SMP
1573 CMPIB=,n 0,spc,dbit_nolock_20w 1565 cmpib,COND(=),n 0,spc,dbit_nolock_20w
1574 load32 PA(pa_dbit_lock),t0 1566 load32 PA(pa_dbit_lock),t0
1575 1567
1576dbit_spin_20w: 1568dbit_spin_20w:
1577 LDCW 0(t0),t1 1569 LDCW 0(t0),t1
1578 cmpib,= 0,t1,dbit_spin_20w 1570 cmpib,COND(=) 0,t1,dbit_spin_20w
1579 nop 1571 nop
1580 1572
1581dbit_nolock_20w: 1573dbit_nolock_20w:
@@ -1586,7 +1578,7 @@ dbit_nolock_20w:
1586 1578
1587 idtlbt pte,prot 1579 idtlbt pte,prot
1588#ifdef CONFIG_SMP 1580#ifdef CONFIG_SMP
1589 CMPIB=,n 0,spc,dbit_nounlock_20w 1581 cmpib,COND(=),n 0,spc,dbit_nounlock_20w
1590 ldi 1,t1 1582 ldi 1,t1
1591 stw t1,0(t0) 1583 stw t1,0(t0)
1592 1584
@@ -1606,7 +1598,7 @@ dbit_trap_11:
1606 L2_ptep ptp,pte,t0,va,dbit_fault 1598 L2_ptep ptp,pte,t0,va,dbit_fault
1607 1599
1608#ifdef CONFIG_SMP 1600#ifdef CONFIG_SMP
1609 CMPIB=,n 0,spc,dbit_nolock_11 1601 cmpib,COND(=),n 0,spc,dbit_nolock_11
1610 load32 PA(pa_dbit_lock),t0 1602 load32 PA(pa_dbit_lock),t0
1611 1603
1612dbit_spin_11: 1604dbit_spin_11:
@@ -1628,7 +1620,7 @@ dbit_nolock_11:
1628 1620
1629 mtsp t1, %sr1 /* Restore sr1 */ 1621 mtsp t1, %sr1 /* Restore sr1 */
1630#ifdef CONFIG_SMP 1622#ifdef CONFIG_SMP
1631 CMPIB=,n 0,spc,dbit_nounlock_11 1623 cmpib,COND(=),n 0,spc,dbit_nounlock_11
1632 ldi 1,t1 1624 ldi 1,t1
1633 stw t1,0(t0) 1625 stw t1,0(t0)
1634 1626
@@ -1646,7 +1638,7 @@ dbit_trap_20:
1646 L2_ptep ptp,pte,t0,va,dbit_fault 1638 L2_ptep ptp,pte,t0,va,dbit_fault
1647 1639
1648#ifdef CONFIG_SMP 1640#ifdef CONFIG_SMP
1649 CMPIB=,n 0,spc,dbit_nolock_20 1641 cmpib,COND(=),n 0,spc,dbit_nolock_20
1650 load32 PA(pa_dbit_lock),t0 1642 load32 PA(pa_dbit_lock),t0
1651 1643
1652dbit_spin_20: 1644dbit_spin_20:
@@ -1665,7 +1657,7 @@ dbit_nolock_20:
1665 idtlbt pte,prot 1657 idtlbt pte,prot
1666 1658
1667#ifdef CONFIG_SMP 1659#ifdef CONFIG_SMP
1668 CMPIB=,n 0,spc,dbit_nounlock_20 1660 cmpib,COND(=),n 0,spc,dbit_nounlock_20
1669 ldi 1,t1 1661 ldi 1,t1
1670 stw t1,0(t0) 1662 stw t1,0(t0)
1671 1663
@@ -1994,7 +1986,7 @@ ENTRY(syscall_exit)
1994 1986
1995 /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */ 1987 /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */
1996 ldo -PER_HPUX(%r19), %r19 1988 ldo -PER_HPUX(%r19), %r19
1997 CMPIB<>,n 0,%r19,1f 1989 cmpib,COND(<>),n 0,%r19,1f
1998 1990
1999 /* Save other hpux returns if personality is PER_HPUX */ 1991 /* Save other hpux returns if personality is PER_HPUX */
2000 STREG %r22,TASK_PT_GR22(%r1) 1992 STREG %r22,TASK_PT_GR22(%r1)
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index ec2482dc1beb..a84e31e82876 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -32,7 +32,8 @@ ENTRY(boot_args)
32 .word 0 /* arg3 */ 32 .word 0 /* arg3 */
33END(boot_args) 33END(boot_args)
34 34
35 .section .text.head 35 __HEAD
36
36 .align 4 37 .align 4
37 .import init_thread_union,data 38 .import init_thread_union,data
38 .import fault_vector_20,code /* IVA parisc 2.0 32 bit */ 39 .import fault_vector_20,code /* IVA parisc 2.0 32 bit */
diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c
index 26198a074d67..f5941c086551 100644
--- a/arch/parisc/kernel/init_task.c
+++ b/arch/parisc/kernel/init_task.c
@@ -35,7 +35,6 @@
35#include <asm/pgalloc.h> 35#include <asm/pgalloc.h>
36 36
37static struct fs_struct init_fs = INIT_FS; 37static struct fs_struct init_fs = INIT_FS;
38static struct files_struct init_files = INIT_FILES;
39static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 38static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
40static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 39static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
41struct mm_struct init_mm = INIT_MM(init_mm); 40struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index 4845a6444633..bd1f7f1ff74e 100644
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -499,7 +499,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs,
499 dev->addr = kmalloc(num_addrs * sizeof(unsigned long), GFP_KERNEL); 499 dev->addr = kmalloc(num_addrs * sizeof(unsigned long), GFP_KERNEL);
500 if(!dev->addr) { 500 if(!dev->addr) {
501 printk(KERN_ERR "%s %s(): memory allocation failure\n", 501 printk(KERN_ERR "%s %s(): memory allocation failure\n",
502 __FILE__, __FUNCTION__); 502 __FILE__, __func__);
503 return; 503 return;
504 } 504 }
505 505
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index 5901092e0196..09b77b2553c6 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -85,7 +85,7 @@ ENTRY(flush_tlb_all_local)
85 LDREG ITLB_OFF_COUNT(%r1), %arg2 85 LDREG ITLB_OFF_COUNT(%r1), %arg2
86 LDREG ITLB_LOOP(%r1), %arg3 86 LDREG ITLB_LOOP(%r1), %arg3
87 87
88 ADDIB= -1, %arg3, fitoneloop /* Preadjust and test */ 88 addib,COND(=) -1, %arg3, fitoneloop /* Preadjust and test */
89 movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */ 89 movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */
90 copy %arg0, %r28 /* Init base addr */ 90 copy %arg0, %r28 /* Init base addr */
91 91
@@ -95,14 +95,14 @@ fitmanyloop: /* Loop if LOOP >= 2 */
95 copy %arg2, %r29 /* Init middle loop count */ 95 copy %arg2, %r29 /* Init middle loop count */
96 96
97fitmanymiddle: /* Loop if LOOP >= 2 */ 97fitmanymiddle: /* Loop if LOOP >= 2 */
98 ADDIB> -1, %r31, fitmanymiddle /* Adjusted inner loop decr */ 98 addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */
99 pitlbe 0(%sr1, %r28) 99 pitlbe 0(%sr1, %r28)
100 pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */ 100 pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */
101 ADDIB> -1, %r29, fitmanymiddle /* Middle loop decr */ 101 addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */
102 copy %arg3, %r31 /* Re-init inner loop count */ 102 copy %arg3, %r31 /* Re-init inner loop count */
103 103
104 movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */ 104 movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */
105 ADDIB<=,n -1, %r22, fitdone /* Outer loop count decr */ 105 addib,COND(<=),n -1, %r22, fitdone /* Outer loop count decr */
106 106
107fitoneloop: /* Loop if LOOP = 1 */ 107fitoneloop: /* Loop if LOOP = 1 */
108 mtsp %r20, %sr1 108 mtsp %r20, %sr1
@@ -110,10 +110,10 @@ fitoneloop: /* Loop if LOOP = 1 */
110 copy %arg2, %r29 /* init middle loop count */ 110 copy %arg2, %r29 /* init middle loop count */
111 111
112fitonemiddle: /* Loop if LOOP = 1 */ 112fitonemiddle: /* Loop if LOOP = 1 */
113 ADDIB> -1, %r29, fitonemiddle /* Middle loop count decr */ 113 addib,COND(>) -1, %r29, fitonemiddle /* Middle loop count decr */
114 pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */ 114 pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */
115 115
116 ADDIB> -1, %r22, fitoneloop /* Outer loop count decr */ 116 addib,COND(>) -1, %r22, fitoneloop /* Outer loop count decr */
117 add %r21, %r20, %r20 /* increment space */ 117 add %r21, %r20, %r20 /* increment space */
118 118
119fitdone: 119fitdone:
@@ -128,7 +128,7 @@ fitdone:
128 LDREG DTLB_OFF_COUNT(%r1), %arg2 128 LDREG DTLB_OFF_COUNT(%r1), %arg2
129 LDREG DTLB_LOOP(%r1), %arg3 129 LDREG DTLB_LOOP(%r1), %arg3
130 130
131 ADDIB= -1, %arg3, fdtoneloop /* Preadjust and test */ 131 addib,COND(=) -1, %arg3, fdtoneloop /* Preadjust and test */
132 movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */ 132 movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */
133 copy %arg0, %r28 /* Init base addr */ 133 copy %arg0, %r28 /* Init base addr */
134 134
@@ -138,14 +138,14 @@ fdtmanyloop: /* Loop if LOOP >= 2 */
138 copy %arg2, %r29 /* Init middle loop count */ 138 copy %arg2, %r29 /* Init middle loop count */
139 139
140fdtmanymiddle: /* Loop if LOOP >= 2 */ 140fdtmanymiddle: /* Loop if LOOP >= 2 */
141 ADDIB> -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */ 141 addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */
142 pdtlbe 0(%sr1, %r28) 142 pdtlbe 0(%sr1, %r28)
143 pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */ 143 pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */
144 ADDIB> -1, %r29, fdtmanymiddle /* Middle loop decr */ 144 addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */
145 copy %arg3, %r31 /* Re-init inner loop count */ 145 copy %arg3, %r31 /* Re-init inner loop count */
146 146
147 movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */ 147 movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */
148 ADDIB<=,n -1, %r22,fdtdone /* Outer loop count decr */ 148 addib,COND(<=),n -1, %r22,fdtdone /* Outer loop count decr */
149 149
150fdtoneloop: /* Loop if LOOP = 1 */ 150fdtoneloop: /* Loop if LOOP = 1 */
151 mtsp %r20, %sr1 151 mtsp %r20, %sr1
@@ -153,10 +153,10 @@ fdtoneloop: /* Loop if LOOP = 1 */
153 copy %arg2, %r29 /* init middle loop count */ 153 copy %arg2, %r29 /* init middle loop count */
154 154
155fdtonemiddle: /* Loop if LOOP = 1 */ 155fdtonemiddle: /* Loop if LOOP = 1 */
156 ADDIB> -1, %r29, fdtonemiddle /* Middle loop count decr */ 156 addib,COND(>) -1, %r29, fdtonemiddle /* Middle loop count decr */
157 pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */ 157 pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */
158 158
159 ADDIB> -1, %r22, fdtoneloop /* Outer loop count decr */ 159 addib,COND(>) -1, %r22, fdtoneloop /* Outer loop count decr */
160 add %r21, %r20, %r20 /* increment space */ 160 add %r21, %r20, %r20 /* increment space */
161 161
162 162
@@ -209,18 +209,18 @@ ENTRY(flush_instruction_cache_local)
209 LDREG ICACHE_COUNT(%r1), %arg2 209 LDREG ICACHE_COUNT(%r1), %arg2
210 LDREG ICACHE_LOOP(%r1), %arg3 210 LDREG ICACHE_LOOP(%r1), %arg3
211 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/ 211 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/
212 ADDIB= -1, %arg3, fioneloop /* Preadjust and test */ 212 addib,COND(=) -1, %arg3, fioneloop /* Preadjust and test */
213 movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */ 213 movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */
214 214
215fimanyloop: /* Loop if LOOP >= 2 */ 215fimanyloop: /* Loop if LOOP >= 2 */
216 ADDIB> -1, %r31, fimanyloop /* Adjusted inner loop decr */ 216 addib,COND(>) -1, %r31, fimanyloop /* Adjusted inner loop decr */
217 fice %r0(%sr1, %arg0) 217 fice %r0(%sr1, %arg0)
218 fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */ 218 fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */
219 movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */ 219 movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */
220 ADDIB<=,n -1, %arg2, fisync /* Outer loop decr */ 220 addib,COND(<=),n -1, %arg2, fisync /* Outer loop decr */
221 221
222fioneloop: /* Loop if LOOP = 1 */ 222fioneloop: /* Loop if LOOP = 1 */
223 ADDIB> -1, %arg2, fioneloop /* Outer loop count decr */ 223 addib,COND(>) -1, %arg2, fioneloop /* Outer loop count decr */
224 fice,m %arg1(%sr1, %arg0) /* Fice for one loop */ 224 fice,m %arg1(%sr1, %arg0) /* Fice for one loop */
225 225
226fisync: 226fisync:
@@ -250,18 +250,18 @@ ENTRY(flush_data_cache_local)
250 LDREG DCACHE_COUNT(%r1), %arg2 250 LDREG DCACHE_COUNT(%r1), %arg2
251 LDREG DCACHE_LOOP(%r1), %arg3 251 LDREG DCACHE_LOOP(%r1), %arg3
252 rsm PSW_SM_I, %r22 252 rsm PSW_SM_I, %r22
253 ADDIB= -1, %arg3, fdoneloop /* Preadjust and test */ 253 addib,COND(=) -1, %arg3, fdoneloop /* Preadjust and test */
254 movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */ 254 movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */
255 255
256fdmanyloop: /* Loop if LOOP >= 2 */ 256fdmanyloop: /* Loop if LOOP >= 2 */
257 ADDIB> -1, %r31, fdmanyloop /* Adjusted inner loop decr */ 257 addib,COND(>) -1, %r31, fdmanyloop /* Adjusted inner loop decr */
258 fdce %r0(%sr1, %arg0) 258 fdce %r0(%sr1, %arg0)
259 fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */ 259 fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */
260 movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */ 260 movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */
261 ADDIB<=,n -1, %arg2, fdsync /* Outer loop decr */ 261 addib,COND(<=),n -1, %arg2, fdsync /* Outer loop decr */
262 262
263fdoneloop: /* Loop if LOOP = 1 */ 263fdoneloop: /* Loop if LOOP = 1 */
264 ADDIB> -1, %arg2, fdoneloop /* Outer loop count decr */ 264 addib,COND(>) -1, %arg2, fdoneloop /* Outer loop count decr */
265 fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */ 265 fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */
266 266
267fdsync: 267fdsync:
@@ -342,7 +342,7 @@ ENTRY(copy_user_page_asm)
342 * non-taken backward branch. Note that .+4 is a backwards branch. 342 * non-taken backward branch. Note that .+4 is a backwards branch.
343 * The ldd should only get executed if the branch is taken. 343 * The ldd should only get executed if the branch is taken.
344 */ 344 */
345 ADDIB>,n -1, %r1, 1b /* bundle 10 */ 345 addib,COND(>),n -1, %r1, 1b /* bundle 10 */
346 ldd 0(%r25), %r19 /* start next loads */ 346 ldd 0(%r25), %r19 /* start next loads */
347 347
348#else 348#else
@@ -391,7 +391,7 @@ ENTRY(copy_user_page_asm)
391 stw %r21, 56(%r26) 391 stw %r21, 56(%r26)
392 stw %r22, 60(%r26) 392 stw %r22, 60(%r26)
393 ldo 64(%r26), %r26 393 ldo 64(%r26), %r26
394 ADDIB>,n -1, %r1, 1b 394 addib,COND(>),n -1, %r1, 1b
395 ldw 0(%r25), %r19 395 ldw 0(%r25), %r19
396#endif 396#endif
397 bv %r0(%r2) 397 bv %r0(%r2)
@@ -515,7 +515,7 @@ ENTRY(copy_user_page_asm)
515 stw %r21, 56(%r28) 515 stw %r21, 56(%r28)
516 stw %r22, 60(%r28) 516 stw %r22, 60(%r28)
517 ldo 64(%r28), %r28 517 ldo 64(%r28), %r28
518 ADDIB> -1, %r1,1b 518 addib,COND(>) -1, %r1,1b
519 ldo 64(%r29), %r29 519 ldo 64(%r29), %r29
520 520
521 bv %r0(%r2) 521 bv %r0(%r2)
@@ -574,7 +574,7 @@ ENTRY(__clear_user_page_asm)
574 std %r0, 104(%r28) 574 std %r0, 104(%r28)
575 std %r0, 112(%r28) 575 std %r0, 112(%r28)
576 std %r0, 120(%r28) 576 std %r0, 120(%r28)
577 ADDIB> -1, %r1, 1b 577 addib,COND(>) -1, %r1, 1b
578 ldo 128(%r28), %r28 578 ldo 128(%r28), %r28
579 579
580#else /* ! CONFIG_64BIT */ 580#else /* ! CONFIG_64BIT */
@@ -597,7 +597,7 @@ ENTRY(__clear_user_page_asm)
597 stw %r0, 52(%r28) 597 stw %r0, 52(%r28)
598 stw %r0, 56(%r28) 598 stw %r0, 56(%r28)
599 stw %r0, 60(%r28) 599 stw %r0, 60(%r28)
600 ADDIB> -1, %r1, 1b 600 addib,COND(>) -1, %r1, 1b
601 ldo 64(%r28), %r28 601 ldo 64(%r28), %r28
602#endif /* CONFIG_64BIT */ 602#endif /* CONFIG_64BIT */
603 603
@@ -640,7 +640,7 @@ ENTRY(flush_kernel_dcache_page_asm)
640 fdc,m %r23(%r26) 640 fdc,m %r23(%r26)
641 fdc,m %r23(%r26) 641 fdc,m %r23(%r26)
642 fdc,m %r23(%r26) 642 fdc,m %r23(%r26)
643 CMPB<< %r26, %r25,1b 643 cmpb,COND(<<) %r26, %r25,1b
644 fdc,m %r23(%r26) 644 fdc,m %r23(%r26)
645 645
646 sync 646 sync
@@ -683,7 +683,7 @@ ENTRY(flush_user_dcache_page)
683 fdc,m %r23(%sr3, %r26) 683 fdc,m %r23(%sr3, %r26)
684 fdc,m %r23(%sr3, %r26) 684 fdc,m %r23(%sr3, %r26)
685 fdc,m %r23(%sr3, %r26) 685 fdc,m %r23(%sr3, %r26)
686 CMPB<< %r26, %r25,1b 686 cmpb,COND(<<) %r26, %r25,1b
687 fdc,m %r23(%sr3, %r26) 687 fdc,m %r23(%sr3, %r26)
688 688
689 sync 689 sync
@@ -726,7 +726,7 @@ ENTRY(flush_user_icache_page)
726 fic,m %r23(%sr3, %r26) 726 fic,m %r23(%sr3, %r26)
727 fic,m %r23(%sr3, %r26) 727 fic,m %r23(%sr3, %r26)
728 fic,m %r23(%sr3, %r26) 728 fic,m %r23(%sr3, %r26)
729 CMPB<< %r26, %r25,1b 729 cmpb,COND(<<) %r26, %r25,1b
730 fic,m %r23(%sr3, %r26) 730 fic,m %r23(%sr3, %r26)
731 731
732 sync 732 sync
@@ -769,7 +769,7 @@ ENTRY(purge_kernel_dcache_page)
769 pdc,m %r23(%r26) 769 pdc,m %r23(%r26)
770 pdc,m %r23(%r26) 770 pdc,m %r23(%r26)
771 pdc,m %r23(%r26) 771 pdc,m %r23(%r26)
772 CMPB<< %r26, %r25, 1b 772 cmpb,COND(<<) %r26, %r25, 1b
773 pdc,m %r23(%r26) 773 pdc,m %r23(%r26)
774 774
775 sync 775 sync
@@ -833,7 +833,7 @@ ENTRY(flush_alias_page)
833 fdc,m %r23(%r28) 833 fdc,m %r23(%r28)
834 fdc,m %r23(%r28) 834 fdc,m %r23(%r28)
835 fdc,m %r23(%r28) 835 fdc,m %r23(%r28)
836 CMPB<< %r28, %r29, 1b 836 cmpb,COND(<<) %r28, %r29, 1b
837 fdc,m %r23(%r28) 837 fdc,m %r23(%r28)
838 838
839 sync 839 sync
@@ -856,7 +856,7 @@ flush_user_dcache_range_asm:
856 ldo -1(%r23), %r21 856 ldo -1(%r23), %r21
857 ANDCM %r26, %r21, %r26 857 ANDCM %r26, %r21, %r26
858 858
8591: CMPB<<,n %r26, %r25, 1b 8591: cmpb,COND(<<),n %r26, %r25, 1b
860 fdc,m %r23(%sr3, %r26) 860 fdc,m %r23(%sr3, %r26)
861 861
862 sync 862 sync
@@ -877,7 +877,7 @@ ENTRY(flush_kernel_dcache_range_asm)
877 ldo -1(%r23), %r21 877 ldo -1(%r23), %r21
878 ANDCM %r26, %r21, %r26 878 ANDCM %r26, %r21, %r26
879 879
8801: CMPB<<,n %r26, %r25,1b 8801: cmpb,COND(<<),n %r26, %r25,1b
881 fdc,m %r23(%r26) 881 fdc,m %r23(%r26)
882 882
883 sync 883 sync
@@ -899,7 +899,7 @@ ENTRY(flush_user_icache_range_asm)
899 ldo -1(%r23), %r21 899 ldo -1(%r23), %r21
900 ANDCM %r26, %r21, %r26 900 ANDCM %r26, %r21, %r26
901 901
9021: CMPB<<,n %r26, %r25,1b 9021: cmpb,COND(<<),n %r26, %r25,1b
903 fic,m %r23(%sr3, %r26) 903 fic,m %r23(%sr3, %r26)
904 904
905 sync 905 sync
@@ -942,7 +942,7 @@ ENTRY(flush_kernel_icache_page)
942 fic,m %r23(%sr4, %r26) 942 fic,m %r23(%sr4, %r26)
943 fic,m %r23(%sr4, %r26) 943 fic,m %r23(%sr4, %r26)
944 fic,m %r23(%sr4, %r26) 944 fic,m %r23(%sr4, %r26)
945 CMPB<< %r26, %r25, 1b 945 cmpb,COND(<<) %r26, %r25, 1b
946 fic,m %r23(%sr4, %r26) 946 fic,m %r23(%sr4, %r26)
947 947
948 sync 948 sync
@@ -963,7 +963,7 @@ ENTRY(flush_kernel_icache_range_asm)
963 ldo -1(%r23), %r21 963 ldo -1(%r23), %r21
964 ANDCM %r26, %r21, %r26 964 ANDCM %r26, %r21, %r26
965 965
9661: CMPB<<,n %r26, %r25, 1b 9661: cmpb,COND(<<),n %r26, %r25, 1b
967 fic,m %r23(%sr4, %r26) 967 fic,m %r23(%sr4, %r26)
968 968
969 sync 969 sync
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 5b7fc4aa044d..0eecfbbc59cd 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -152,3 +152,6 @@ EXPORT_SYMBOL($$dyncall);
152EXPORT_SYMBOL(node_data); 152EXPORT_SYMBOL(node_data);
153EXPORT_SYMBOL(pfnnid_map); 153EXPORT_SYMBOL(pfnnid_map);
154#endif 154#endif
155
156/* from pacache.S -- needed for copy_page */
157EXPORT_SYMBOL(copy_user_page_asm);
diff --git a/arch/parisc/kernel/perf_asm.S b/arch/parisc/kernel/perf_asm.S
index 43874ca3ed67..fa6ea99bb324 100644
--- a/arch/parisc/kernel/perf_asm.S
+++ b/arch/parisc/kernel/perf_asm.S
@@ -20,6 +20,8 @@
20 */ 20 */
21 21
22#include <asm/assembly.h> 22#include <asm/assembly.h>
23
24#include <linux/init.h>
23#include <linux/linkage.h> 25#include <linux/linkage.h>
24 26
25#ifdef CONFIG_64BIT 27#ifdef CONFIG_64BIT
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index db94affe5c71..fb59852006de 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -289,7 +289,7 @@ setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __
289 &sc->sc_iaoq[0], compat_reg); 289 &sc->sc_iaoq[0], compat_reg);
290 290
291 /* Store upper half */ 291 /* Store upper half */
292 compat_reg = (compat_uint_t)(regs->gr[32] >> 32); 292 compat_reg = (compat_uint_t)(regs->gr[31] >> 32);
293 err |= __put_user(compat_reg, &rf->rf_iaoq[0]); 293 err |= __put_user(compat_reg, &rf->rf_iaoq[0]);
294 DBG(2,"setup_sigcontext32: upper half iaoq[0] = %#x\n", compat_reg); 294 DBG(2,"setup_sigcontext32: upper half iaoq[0] = %#x\n", compat_reg);
295 295
@@ -299,7 +299,7 @@ setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __
299 DBG(2,"setup_sigcontext32: sc->sc_iaoq[1] = %p <= %#x\n", 299 DBG(2,"setup_sigcontext32: sc->sc_iaoq[1] = %p <= %#x\n",
300 &sc->sc_iaoq[1], compat_reg); 300 &sc->sc_iaoq[1], compat_reg);
301 /* Store upper half */ 301 /* Store upper half */
302 compat_reg = (compat_uint_t)((regs->gr[32]+4) >> 32); 302 compat_reg = (compat_uint_t)((regs->gr[31]+4) >> 32);
303 err |= __put_user(compat_reg, &rf->rf_iaoq[1]); 303 err |= __put_user(compat_reg, &rf->rf_iaoq[1]);
304 DBG(2,"setup_sigcontext32: upper half iaoq[1] = %#x\n", compat_reg); 304 DBG(2,"setup_sigcontext32: upper half iaoq[1] = %#x\n", compat_reg);
305 305
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 9dc6dc42f9cf..675f1d098f05 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -275,7 +275,7 @@ KERN_CRIT " || ||\n");
275 275
276 /* Wot's wrong wif bein' racy? */ 276 /* Wot's wrong wif bein' racy? */
277 if (current->thread.flags & PARISC_KERNEL_DEATH) { 277 if (current->thread.flags & PARISC_KERNEL_DEATH) {
278 printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__); 278 printk(KERN_CRIT "%s() recursion detected.\n", __func__);
279 local_irq_enable(); 279 local_irq_enable();
280 while (1); 280 while (1);
281 } 281 }
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index aebf3c168871..e6f4b7a4b7e3 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -30,7 +30,7 @@
30/* #define DEBUG_UNALIGNED 1 */ 30/* #define DEBUG_UNALIGNED 1 */
31 31
32#ifdef DEBUG_UNALIGNED 32#ifdef DEBUG_UNALIGNED
33#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __FUNCTION__ ); printk(KERN_DEBUG fmt, ##args ); } while (0) 33#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __func__ ); printk(KERN_DEBUG fmt, ##args ); } while (0)
34#else 34#else
35#define DPRINTF(fmt, args...) 35#define DPRINTF(fmt, args...)
36#endif 36#endif
@@ -460,7 +460,8 @@ void handle_unaligned(struct pt_regs *regs)
460 goto force_sigbus; 460 goto force_sigbus;
461 } 461 }
462 462
463 if (unaligned_count > 5 && jiffies - last_time > 5*HZ) { 463 if (unaligned_count > 5 &&
464 time_after(jiffies, last_time + 5 * HZ)) {
464 unaligned_count = 0; 465 unaligned_count = 0;
465 last_time = jiffies; 466 last_time = jiffies;
466 } 467 }
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 50b4a3a25d0a..2e516b871752 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -50,6 +50,7 @@ SECTIONS
50 50
51 _text = .; /* Text and read-only data */ 51 _text = .; /* Text and read-only data */
52 .text ALIGN(16) : { 52 .text ALIGN(16) : {
53 HEAD_TEXT
53 TEXT_TEXT 54 TEXT_TEXT
54 SCHED_TEXT 55 SCHED_TEXT
55 LOCK_TEXT 56 LOCK_TEXT
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index d22042d33100..2d68431fc22e 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -91,7 +91,7 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
91#define THRESHOLD 16 91#define THRESHOLD 16
92 92
93#ifdef DEBUG_MEMCPY 93#ifdef DEBUG_MEMCPY
94#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __FUNCTION__ ); printk(KERN_DEBUG fmt, ##args ); } while (0) 94#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __func__ ); printk(KERN_DEBUG fmt, ##args ); } while (0)
95#else 95#else
96#define DPRINTF(fmt, args...) 96#define DPRINTF(fmt, args...)
97#endif 97#endif
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 1f012843150f..ce0da689a89d 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -547,6 +547,7 @@ void __init mem_init(void)
547} 547}
548 548
549unsigned long *empty_zero_page __read_mostly; 549unsigned long *empty_zero_page __read_mostly;
550EXPORT_SYMBOL(empty_zero_page);
550 551
551void show_mem(void) 552void show_mem(void)
552{ 553{
@@ -555,8 +556,6 @@ void show_mem(void)
555 556
556 printk(KERN_INFO "Mem-info:\n"); 557 printk(KERN_INFO "Mem-info:\n");
557 show_free_areas(); 558 show_free_areas();
558 printk(KERN_INFO "Free swap: %6ldkB\n",
559 nr_swap_pages<<(PAGE_SHIFT-10));
560#ifndef CONFIG_DISCONTIGMEM 559#ifndef CONFIG_DISCONTIGMEM
561 i = max_mapnr; 560 i = max_mapnr;
562 while (i-- > 0) { 561 while (i-- > 0) {
@@ -606,7 +605,7 @@ void show_mem(void)
606 int i, j; 605 int i, j;
607 606
608 for (i = 0; i < npmem_ranges; i++) { 607 for (i = 0; i < npmem_ranges; i++) {
609 zl = node_zonelist(i); 608 zl = node_zonelist(i, 0);
610 for (j = 0; j < MAX_NR_ZONES; j++) { 609 for (j = 0; j < MAX_NR_ZONES; j++) {
611 struct zoneref *z; 610 struct zoneref *z;
612 struct zone *zone; 611 struct zone *zone;
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 2347294ff35b..2f50acd11a60 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -20,21 +20,19 @@ kernel-vmlinux.strip.gz
20mktree 20mktree
21uImage 21uImage
22cuImage.* 22cuImage.*
23dtbImage.*
23treeImage.* 24treeImage.*
24zImage 25zImage
26zImage.initrd
25zImage.bin.* 27zImage.bin.*
26zImage.chrp 28zImage.chrp
27zImage.coff 29zImage.coff
28zImage.coff.lds 30zImage.holly
29zImage.ep*
30zImage.iseries 31zImage.iseries
31zImage.*lds 32zImage.*lds
32zImage.miboot 33zImage.miboot
33zImage.pmac 34zImage.pmac
34zImage.pseries 35zImage.pseries
35zImage.redboot*
36zImage.sandpoint
37zImage.vmode
38zconf.h 36zconf.h
39zlib.h 37zlib.h
40zutil.h 38zutil.h
diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
index 758edf1c5815..5c878436f348 100644
--- a/arch/powerpc/boot/4xx.c
+++ b/arch/powerpc/boot/4xx.c
@@ -21,6 +21,25 @@
21#include "reg.h" 21#include "reg.h"
22#include "dcr.h" 22#include "dcr.h"
23 23
24static unsigned long chip_11_errata(unsigned long memsize)
25{
26 unsigned long pvr;
27
28 pvr = mfpvr();
29
30 switch (pvr & 0xf0000ff0) {
31 case 0x40000850:
32 case 0x400008d0:
33 case 0x200008d0:
34 memsize -= 4096;
35 break;
36 default:
37 break;
38 }
39
40 return memsize;
41}
42
24/* Read the 4xx SDRAM controller to get size of system memory. */ 43/* Read the 4xx SDRAM controller to get size of system memory. */
25void ibm4xx_sdram_fixup_memsize(void) 44void ibm4xx_sdram_fixup_memsize(void)
26{ 45{
@@ -34,6 +53,7 @@ void ibm4xx_sdram_fixup_memsize(void)
34 memsize += SDRAM_CONFIG_BANK_SIZE(bank_config); 53 memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
35 } 54 }
36 55
56 memsize = chip_11_errata(memsize);
37 dt_fixup_memory(0, memsize); 57 dt_fixup_memory(0, memsize);
38} 58}
39 59
@@ -199,6 +219,7 @@ void ibm4xx_denali_fixup_memsize(void)
199 bank = 4; /* 4 banks */ 219 bank = 4; /* 4 banks */
200 220
201 memsize = cs * (1 << (col+row)) * bank * dpath; 221 memsize = cs * (1 << (col+row)) * bank * dpath;
222 memsize = chip_11_errata(memsize);
202 dt_fixup_memory(0, memsize); 223 dt_fixup_memory(0, memsize);
203} 224}
204 225
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 7822d25c9d31..d53b84e761a9 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -99,7 +99,7 @@ $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srct
99 @cp $< $@ 99 @cp $< $@
100 100
101clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ 101clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
102 empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds 102 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
103 103
104quiet_cmd_bootcc = BOOTCC $@ 104quiet_cmd_bootcc = BOOTCC $@
105 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 105 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -221,8 +221,8 @@ image-$(CONFIG_WARP) += cuImage.warp
221image-$(CONFIG_YOSEMITE) += cuImage.yosemite 221image-$(CONFIG_YOSEMITE) += cuImage.yosemite
222 222
223# Board ports in arch/powerpc/platform/8xx/Kconfig 223# Board ports in arch/powerpc/platform/8xx/Kconfig
224image-$(CONFIG_PPC_MPC86XADS) += cuImage.mpc866ads 224image-$(CONFIG_MPC86XADS) += cuImage.mpc866ads
225image-$(CONFIG_PPC_MPC885ADS) += cuImage.mpc885ads 225image-$(CONFIG_MPC885ADS) += cuImage.mpc885ads
226image-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 226image-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc
227image-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 227image-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \
228 dtbImage.adder875-redboot 228 dtbImage.adder875-redboot
@@ -339,7 +339,9 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
339 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< 339 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
340 340
341# anything not in $(targets) 341# anything not in $(targets)
342clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* \ 342clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
343 zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
344 zImage.iseries zImage.miboot zImage.pmac zImage.pseries \
343 otheros.bld *.dtb 345 otheros.bld *.dtb
344 346
345# clean up files cached by wrapper 347# clean up files cached by wrapper
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index eac8e1b59496..fea592574004 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -268,6 +268,41 @@
268 interrupt-parent = <&ipic>; 268 interrupt-parent = <&ipic>;
269 }; 269 };
270 270
271 dma@82a8 {
272 #address-cells = <1>;
273 #size-cells = <1>;
274 compatible = "fsl,mpc8377-dma", "fsl,elo-dma";
275 reg = <0x82a8 4>;
276 ranges = <0 0x8100 0x1a8>;
277 interrupt-parent = <&ipic>;
278 interrupts = <0x47 8>;
279 cell-index = <0>;
280 dma-channel@0 {
281 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
282 reg = <0 0x80>;
283 interrupt-parent = <&ipic>;
284 interrupts = <0x47 8>;
285 };
286 dma-channel@80 {
287 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
288 reg = <0x80 0x80>;
289 interrupt-parent = <&ipic>;
290 interrupts = <0x47 8>;
291 };
292 dma-channel@100 {
293 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
294 reg = <0x100 0x80>;
295 interrupt-parent = <&ipic>;
296 interrupts = <0x47 8>;
297 };
298 dma-channel@180 {
299 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
300 reg = <0x180 0x28>;
301 interrupt-parent = <&ipic>;
302 interrupts = <0x47 8>;
303 };
304 };
305
271 /* IPIC 306 /* IPIC
272 * interrupts cell = <intr #, sense> 307 * interrupts cell = <intr #, sense>
273 * sense values match linux IORESOURCE_IRQ_* defines: 308 * sense values match linux IORESOURCE_IRQ_* defines:
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index bba234eb14a9..fa9b6bbeb5af 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -46,9 +46,63 @@
46 reg = <0x00000000 0x20000000>; // 512M at 0x0 46 reg = <0x00000000 0x20000000>; // 512M at 0x0
47 }; 47 };
48 48
49 board-control@e8000000 { 49 localbus@e0005000 {
50 compatible = "fsl,fpga-pixis"; 50 #address-cells = <2>;
51 reg = <0xe8000000 32>; // pixis at 0xe8000000 51 #size-cells = <1>;
52 compatible = "fsl,mpc8610-elbc", "fsl,elbc", "simple-bus";
53 reg = <0xe0005000 0x1000>;
54 interrupts = <19 2>;
55 interrupt-parent = <&mpic>;
56 ranges = <0 0 0xf8000000 0x08000000
57 1 0 0xf0000000 0x08000000
58 2 0 0xe8400000 0x00008000
59 4 0 0xe8440000 0x00008000
60 5 0 0xe8480000 0x00008000
61 6 0 0xe84c0000 0x00008000
62 3 0 0xe8000000 0x00000020>;
63
64 flash@0,0 {
65 compatible = "cfi-flash";
66 reg = <0 0 0x8000000>;
67 bank-width = <2>;
68 device-width = <1>;
69 };
70
71 flash@1,0 {
72 compatible = "cfi-flash";
73 reg = <1 0 0x8000000>;
74 bank-width = <2>;
75 device-width = <1>;
76 };
77
78 flash@2,0 {
79 compatible = "fsl,mpc8610-fcm-nand",
80 "fsl,elbc-fcm-nand";
81 reg = <2 0 0x8000>;
82 };
83
84 flash@4,0 {
85 compatible = "fsl,mpc8610-fcm-nand",
86 "fsl,elbc-fcm-nand";
87 reg = <4 0 0x8000>;
88 };
89
90 flash@5,0 {
91 compatible = "fsl,mpc8610-fcm-nand",
92 "fsl,elbc-fcm-nand";
93 reg = <5 0 0x8000>;
94 };
95
96 flash@6,0 {
97 compatible = "fsl,mpc8610-fcm-nand",
98 "fsl,elbc-fcm-nand";
99 reg = <6 0 0x8000>;
100 };
101
102 board-control@3,0 {
103 compatible = "fsl,fpga-pixis";
104 reg = <3 0 0x20>;
105 };
52 }; 106 };
53 107
54 soc@e0000000 { 108 soc@e0000000 {
@@ -197,14 +251,14 @@
197 dma@c300 { 251 dma@c300 {
198 #address-cells = <1>; 252 #address-cells = <1>;
199 #size-cells = <1>; 253 #size-cells = <1>;
200 compatible = "fsl,mpc8610-dma", "fsl,mpc8540-dma"; 254 compatible = "fsl,mpc8610-dma", "fsl,eloplus-dma";
201 cell-index = <1>; 255 cell-index = <1>;
202 reg = <0xc300 0x4>; /* DMA general status register */ 256 reg = <0xc300 0x4>; /* DMA general status register */
203 ranges = <0x0 0xc100 0x200>; 257 ranges = <0x0 0xc100 0x200>;
204 258
205 dma-channel@0 { 259 dma-channel@0 {
206 compatible = "fsl,mpc8610-dma-channel", 260 compatible = "fsl,mpc8610-dma-channel",
207 "fsl,mpc8540-dma-channel"; 261 "fsl,eloplus-dma-channel";
208 cell-index = <0>; 262 cell-index = <0>;
209 reg = <0x0 0x80>; 263 reg = <0x0 0x80>;
210 interrupt-parent = <&mpic>; 264 interrupt-parent = <&mpic>;
@@ -212,7 +266,7 @@
212 }; 266 };
213 dma-channel@1 { 267 dma-channel@1 {
214 compatible = "fsl,mpc8610-dma-channel", 268 compatible = "fsl,mpc8610-dma-channel",
215 "fsl,mpc8540-dma-channel"; 269 "fsl,eloplus-dma-channel";
216 cell-index = <1>; 270 cell-index = <1>;
217 reg = <0x80 0x80>; 271 reg = <0x80 0x80>;
218 interrupt-parent = <&mpic>; 272 interrupt-parent = <&mpic>;
@@ -220,7 +274,7 @@
220 }; 274 };
221 dma-channel@2 { 275 dma-channel@2 {
222 compatible = "fsl,mpc8610-dma-channel", 276 compatible = "fsl,mpc8610-dma-channel",
223 "fsl,mpc8540-dma-channel"; 277 "fsl,eloplus-dma-channel";
224 cell-index = <2>; 278 cell-index = <2>;
225 reg = <0x100 0x80>; 279 reg = <0x100 0x80>;
226 interrupt-parent = <&mpic>; 280 interrupt-parent = <&mpic>;
@@ -228,7 +282,7 @@
228 }; 282 };
229 dma-channel@3 { 283 dma-channel@3 {
230 compatible = "fsl,mpc8610-dma-channel", 284 compatible = "fsl,mpc8610-dma-channel",
231 "fsl,mpc8540-dma-channel"; 285 "fsl,eloplus-dma-channel";
232 cell-index = <3>; 286 cell-index = <3>;
233 reg = <0x180 0x80>; 287 reg = <0x180 0x80>;
234 interrupt-parent = <&mpic>; 288 interrupt-parent = <&mpic>;
diff --git a/arch/powerpc/boot/dts/sbc8548.dts b/arch/powerpc/boot/dts/sbc8548.dts
index b86e65d926c1..22d967178fe9 100644
--- a/arch/powerpc/boot/dts/sbc8548.dts
+++ b/arch/powerpc/boot/dts/sbc8548.dts
@@ -52,6 +52,99 @@
52 reg = <0x00000000 0x10000000>; 52 reg = <0x00000000 0x10000000>;
53 }; 53 };
54 54
55 localbus@e0000000 {
56 #address-cells = <2>;
57 #size-cells = <1>;
58 compatible = "simple-bus";
59 reg = <0xe0000000 0x5000>;
60 interrupt-parent = <&mpic>;
61
62 ranges = <0x0 0x0 0xff800000 0x00800000 /*8MB Flash*/
63 0x3 0x0 0xf0000000 0x04000000 /*64MB SDRAM*/
64 0x4 0x0 0xf4000000 0x04000000 /*64MB SDRAM*/
65 0x5 0x0 0xf8000000 0x00b10000 /* EPLD */
66 0x6 0x0 0xfb800000 0x04000000>; /*64MB Flash*/
67
68
69 flash@0,0 {
70 #address-cells = <1>;
71 #size-cells = <1>;
72 compatible = "cfi-flash";
73 reg = <0x0 0x0 0x800000>;
74 bank-width = <1>;
75 device-width = <1>;
76 partition@0x0 {
77 label = "space";
78 reg = <0x00000000 0x00100000>;
79 };
80 partition@0x100000 {
81 label = "bootloader";
82 reg = <0x00100000 0x00700000>;
83 read-only;
84 };
85 };
86
87 epld@5,0 {
88 compatible = "wrs,epld-localbus";
89 #address-cells = <2>;
90 #size-cells = <1>;
91 reg = <0x5 0x0 0x00b10000>;
92 ranges = <
93 0x0 0x0 0x5 0x000000 0x1fff /* LED */
94 0x1 0x0 0x5 0x100000 0x1fff /* Switches */
95 0x3 0x0 0x5 0x300000 0x1fff /* HW Rev. */
96 0xb 0x0 0x5 0xb00000 0x1fff /* EEPROM */
97 >;
98
99 led@0,0 {
100 compatible = "led";
101 reg = <0x0 0x0 0x1fff>;
102 };
103
104 switches@1,0 {
105 compatible = "switches";
106 reg = <0x1 0x0 0x1fff>;
107 };
108
109 hw-rev@3,0 {
110 compatible = "hw-rev";
111 reg = <0x3 0x0 0x1fff>;
112 };
113
114 eeprom@b,0 {
115 compatible = "eeprom";
116 reg = <0xb 0 0x1fff>;
117 };
118
119 };
120
121 alt-flash@6,0 {
122 #address-cells = <1>;
123 #size-cells = <1>;
124 reg = <0x6 0x0 0x04000000>;
125 compatible = "cfi-flash";
126 bank-width = <4>;
127 device-width = <1>;
128 partition@0x0 {
129 label = "bootloader";
130 reg = <0x00000000 0x00100000>;
131 read-only;
132 };
133 partition@0x00100000 {
134 label = "file-system";
135 reg = <0x00100000 0x01f00000>;
136 };
137 partition@0x02000000 {
138 label = "boot-config";
139 reg = <0x02000000 0x00100000>;
140 };
141 partition@0x02100000 {
142 label = "space";
143 reg = <0x02100000 0x01f00000>;
144 };
145 };
146 };
147
55 soc8548@e0000000 { 148 soc8548@e0000000 {
56 #address-cells = <1>; 149 #address-cells = <1>;
57 #size-cells = <1>; 150 #size-cells = <1>;
@@ -59,6 +152,7 @@
59 ranges = <0x00000000 0xe0000000 0x00100000>; 152 ranges = <0x00000000 0xe0000000 0x00100000>;
60 reg = <0xe0000000 0x00001000>; // CCSRBAR 153 reg = <0xe0000000 0x00001000>; // CCSRBAR
61 bus-frequency = <0>; 154 bus-frequency = <0>;
155 compatible = "simple-bus";
62 156
63 memory-controller@2000 { 157 memory-controller@2000 {
64 compatible = "fsl,8548-memory-controller"; 158 compatible = "fsl,8548-memory-controller";
diff --git a/arch/powerpc/configs/chrp32_defconfig b/arch/powerpc/configs/chrp32_defconfig
index d7fd298bd234..05360d4ef1b1 100644
--- a/arch/powerpc/configs/chrp32_defconfig
+++ b/arch/powerpc/configs/chrp32_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Thu Mar 27 13:55:37 2008 4# Tue May 20 20:00:44 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -32,6 +32,8 @@ CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
34CONFIG_IRQ_PER_CPU=y 34CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_LOCKDEP_SUPPORT=y
35CONFIG_RWSEM_XCHGADD_ALGORITHM=y 37CONFIG_RWSEM_XCHGADD_ALGORITHM=y
36CONFIG_ARCH_HAS_ILOG2_U32=y 38CONFIG_ARCH_HAS_ILOG2_U32=y
37CONFIG_GENERIC_HWEIGHT=y 39CONFIG_GENERIC_HWEIGHT=y
@@ -88,6 +90,7 @@ CONFIG_INITRAMFS_SOURCE=""
88CONFIG_SYSCTL=y 90CONFIG_SYSCTL=y
89# CONFIG_EMBEDDED is not set 91# CONFIG_EMBEDDED is not set
90CONFIG_SYSCTL_SYSCALL=y 92CONFIG_SYSCTL_SYSCALL=y
93CONFIG_SYSCTL_SYSCALL_CHECK=y
91CONFIG_KALLSYMS=y 94CONFIG_KALLSYMS=y
92# CONFIG_KALLSYMS_ALL is not set 95# CONFIG_KALLSYMS_ALL is not set
93# CONFIG_KALLSYMS_EXTRA_PASS is not set 96# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -95,6 +98,7 @@ CONFIG_HOTPLUG=y
95CONFIG_PRINTK=y 98CONFIG_PRINTK=y
96CONFIG_BUG=y 99CONFIG_BUG=y
97CONFIG_ELF_CORE=y 100CONFIG_ELF_CORE=y
101CONFIG_PCSPKR_PLATFORM=y
98# CONFIG_COMPAT_BRK is not set 102# CONFIG_COMPAT_BRK is not set
99CONFIG_BASE_FULL=y 103CONFIG_BASE_FULL=y
100CONFIG_FUTEX=y 104CONFIG_FUTEX=y
@@ -115,12 +119,14 @@ CONFIG_HAVE_OPROFILE=y
115# CONFIG_KPROBES is not set 119# CONFIG_KPROBES is not set
116CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
122# CONFIG_HAVE_DMA_ATTRS is not set
118CONFIG_PROC_PAGE_MONITOR=y 123CONFIG_PROC_PAGE_MONITOR=y
119CONFIG_SLABINFO=y 124CONFIG_SLABINFO=y
120CONFIG_RT_MUTEXES=y 125CONFIG_RT_MUTEXES=y
121# CONFIG_TINY_SHMEM is not set 126# CONFIG_TINY_SHMEM is not set
122CONFIG_BASE_SMALL=0 127CONFIG_BASE_SMALL=0
123CONFIG_MODULES=y 128CONFIG_MODULES=y
129# CONFIG_MODULE_FORCE_LOAD is not set
124CONFIG_MODULE_UNLOAD=y 130CONFIG_MODULE_UNLOAD=y
125CONFIG_MODULE_FORCE_UNLOAD=y 131CONFIG_MODULE_FORCE_UNLOAD=y
126# CONFIG_MODVERSIONS is not set 132# CONFIG_MODVERSIONS is not set
@@ -217,11 +223,13 @@ CONFIG_FLATMEM=y
217CONFIG_FLAT_NODE_MEM_MAP=y 223CONFIG_FLAT_NODE_MEM_MAP=y
218# CONFIG_SPARSEMEM_STATIC is not set 224# CONFIG_SPARSEMEM_STATIC is not set
219# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 225# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
226CONFIG_PAGEFLAGS_EXTENDED=y
220CONFIG_SPLIT_PTLOCK_CPUS=4 227CONFIG_SPLIT_PTLOCK_CPUS=4
221# CONFIG_RESOURCES_64BIT is not set 228# CONFIG_RESOURCES_64BIT is not set
222CONFIG_ZONE_DMA_FLAG=1 229CONFIG_ZONE_DMA_FLAG=1
223CONFIG_BOUNCE=y 230CONFIG_BOUNCE=y
224CONFIG_VIRT_TO_BUS=y 231CONFIG_VIRT_TO_BUS=y
232CONFIG_FORCE_MAX_ZONEORDER=11
225CONFIG_PROC_DEVICETREE=y 233CONFIG_PROC_DEVICETREE=y
226# CONFIG_CMDLINE_BOOL is not set 234# CONFIG_CMDLINE_BOOL is not set
227# CONFIG_PM is not set 235# CONFIG_PM is not set
@@ -245,6 +253,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
245# CONFIG_PCI_DEBUG is not set 253# CONFIG_PCI_DEBUG is not set
246# CONFIG_PCCARD is not set 254# CONFIG_PCCARD is not set
247# CONFIG_HOTPLUG_PCI is not set 255# CONFIG_HOTPLUG_PCI is not set
256# CONFIG_HAS_RAPIDIO is not set
248 257
249# 258#
250# Advanced setup 259# Advanced setup
@@ -254,11 +263,11 @@ CONFIG_ARCH_SUPPORTS_MSI=y
254# 263#
255# Default settings for advanced configuration options are used 264# Default settings for advanced configuration options are used
256# 265#
257CONFIG_HIGHMEM_START=0xfe000000
258CONFIG_LOWMEM_SIZE=0x30000000 266CONFIG_LOWMEM_SIZE=0x30000000
267CONFIG_PAGE_OFFSET=0xc0000000
259CONFIG_KERNEL_START=0xc0000000 268CONFIG_KERNEL_START=0xc0000000
269CONFIG_PHYSICAL_START=0x00000000
260CONFIG_TASK_SIZE=0xc0000000 270CONFIG_TASK_SIZE=0xc0000000
261CONFIG_BOOT_LOAD=0x00800000
262 271
263# 272#
264# Networking 273# Networking
@@ -299,8 +308,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
299# CONFIG_TCP_MD5SIG is not set 308# CONFIG_TCP_MD5SIG is not set
300# CONFIG_IP_VS is not set 309# CONFIG_IP_VS is not set
301# CONFIG_IPV6 is not set 310# CONFIG_IPV6 is not set
302# CONFIG_INET6_XFRM_TUNNEL is not set
303# CONFIG_INET6_TUNNEL is not set
304# CONFIG_NETWORK_SECMARK is not set 311# CONFIG_NETWORK_SECMARK is not set
305CONFIG_NETFILTER=y 312CONFIG_NETFILTER=y
306# CONFIG_NETFILTER_DEBUG is not set 313# CONFIG_NETFILTER_DEBUG is not set
@@ -398,6 +405,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
398# CONFIG_CONNECTOR is not set 405# CONFIG_CONNECTOR is not set
399# CONFIG_MTD is not set 406# CONFIG_MTD is not set
400CONFIG_OF_DEVICE=y 407CONFIG_OF_DEVICE=y
408CONFIG_OF_I2C=y
401# CONFIG_PARPORT is not set 409# CONFIG_PARPORT is not set
402# CONFIG_PNP is not set 410# CONFIG_PNP is not set
403CONFIG_BLK_DEV=y 411CONFIG_BLK_DEV=y
@@ -484,22 +492,8 @@ CONFIG_BLK_DEV_SL82C105=y
484# CONFIG_BLK_DEV_TRM290 is not set 492# CONFIG_BLK_DEV_TRM290 is not set
485CONFIG_BLK_DEV_VIA82CXXX=y 493CONFIG_BLK_DEV_VIA82CXXX=y
486# CONFIG_BLK_DEV_TC86C001 is not set 494# CONFIG_BLK_DEV_TC86C001 is not set
487
488#
489# Other IDE chipsets support
490#
491
492#
493# Note: most of these also require special kernel boot parameters
494#
495# CONFIG_BLK_DEV_4DRIVES is not set
496# CONFIG_BLK_DEV_ALI14XX is not set
497# CONFIG_BLK_DEV_DTC2278 is not set
498# CONFIG_BLK_DEV_HT6560B is not set
499# CONFIG_BLK_DEV_QD65XX is not set
500# CONFIG_BLK_DEV_UMC8672 is not set
501CONFIG_BLK_DEV_IDEDMA=y 495CONFIG_BLK_DEV_IDEDMA=y
502CONFIG_IDE_ARCH_OBSOLETE_INIT=y 496# CONFIG_BLK_DEV_HD_ONLY is not set
503# CONFIG_BLK_DEV_HD is not set 497# CONFIG_BLK_DEV_HD is not set
504 498
505# 499#
@@ -641,7 +635,6 @@ CONFIG_DE4X5=y
641# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 635# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
642CONFIG_NET_PCI=y 636CONFIG_NET_PCI=y
643CONFIG_PCNET32=y 637CONFIG_PCNET32=y
644# CONFIG_PCNET32_NAPI is not set
645# CONFIG_AMD8111_ETH is not set 638# CONFIG_AMD8111_ETH is not set
646# CONFIG_ADAPTEC_STARFIRE is not set 639# CONFIG_ADAPTEC_STARFIRE is not set
647# CONFIG_AC3200 is not set 640# CONFIG_AC3200 is not set
@@ -684,7 +677,6 @@ CONFIG_NETDEV_1000=y
684# CONFIG_SIS190 is not set 677# CONFIG_SIS190 is not set
685# CONFIG_SKGE is not set 678# CONFIG_SKGE is not set
686# CONFIG_SKY2 is not set 679# CONFIG_SKY2 is not set
687# CONFIG_SK98LIN is not set
688# CONFIG_VIA_VELOCITY is not set 680# CONFIG_VIA_VELOCITY is not set
689# CONFIG_TIGON3 is not set 681# CONFIG_TIGON3 is not set
690# CONFIG_BNX2 is not set 682# CONFIG_BNX2 is not set
@@ -703,6 +695,7 @@ CONFIG_NETDEV_10000=y
703# CONFIG_MLX4_CORE is not set 695# CONFIG_MLX4_CORE is not set
704# CONFIG_TEHUTI is not set 696# CONFIG_TEHUTI is not set
705# CONFIG_BNX2X is not set 697# CONFIG_BNX2X is not set
698# CONFIG_SFC is not set
706# CONFIG_TR is not set 699# CONFIG_TR is not set
707 700
708# 701#
@@ -710,6 +703,7 @@ CONFIG_NETDEV_10000=y
710# 703#
711# CONFIG_WLAN_PRE80211 is not set 704# CONFIG_WLAN_PRE80211 is not set
712# CONFIG_WLAN_80211 is not set 705# CONFIG_WLAN_80211 is not set
706# CONFIG_IWLWIFI_LEDS is not set
713 707
714# 708#
715# USB Network Adapters 709# USB Network Adapters
@@ -813,6 +807,7 @@ CONFIG_VT=y
813CONFIG_VT_CONSOLE=y 807CONFIG_VT_CONSOLE=y
814CONFIG_HW_CONSOLE=y 808CONFIG_HW_CONSOLE=y
815# CONFIG_VT_HW_CONSOLE_BINDING is not set 809# CONFIG_VT_HW_CONSOLE_BINDING is not set
810CONFIG_DEVKMEM=y
816# CONFIG_SERIAL_NONSTANDARD is not set 811# CONFIG_SERIAL_NONSTANDARD is not set
817# CONFIG_NOZOMI is not set 812# CONFIG_NOZOMI is not set
818 813
@@ -853,13 +848,7 @@ CONFIG_DEVPORT=y
853CONFIG_I2C=y 848CONFIG_I2C=y
854CONFIG_I2C_BOARDINFO=y 849CONFIG_I2C_BOARDINFO=y
855# CONFIG_I2C_CHARDEV is not set 850# CONFIG_I2C_CHARDEV is not set
856
857#
858# I2C Algorithms
859#
860CONFIG_I2C_ALGOBIT=y 851CONFIG_I2C_ALGOBIT=y
861# CONFIG_I2C_ALGOPCF is not set
862# CONFIG_I2C_ALGOPCA is not set
863 852
864# 853#
865# I2C Hardware Bus support 854# I2C Hardware Bus support
@@ -890,6 +879,7 @@ CONFIG_I2C_ALGOBIT=y
890# CONFIG_I2C_VIAPRO is not set 879# CONFIG_I2C_VIAPRO is not set
891# CONFIG_I2C_VOODOO3 is not set 880# CONFIG_I2C_VOODOO3 is not set
892# CONFIG_I2C_PCA_ISA is not set 881# CONFIG_I2C_PCA_ISA is not set
882# CONFIG_I2C_PCA_PLATFORM is not set
893 883
894# 884#
895# Miscellaneous I2C Chip support 885# Miscellaneous I2C Chip support
@@ -899,19 +889,13 @@ CONFIG_I2C_ALGOBIT=y
899# CONFIG_SENSORS_PCF8574 is not set 889# CONFIG_SENSORS_PCF8574 is not set
900# CONFIG_PCF8575 is not set 890# CONFIG_PCF8575 is not set
901# CONFIG_SENSORS_PCF8591 is not set 891# CONFIG_SENSORS_PCF8591 is not set
902# CONFIG_TPS65010 is not set
903# CONFIG_SENSORS_MAX6875 is not set 892# CONFIG_SENSORS_MAX6875 is not set
904# CONFIG_SENSORS_TSL2550 is not set 893# CONFIG_SENSORS_TSL2550 is not set
905# CONFIG_I2C_DEBUG_CORE is not set 894# CONFIG_I2C_DEBUG_CORE is not set
906# CONFIG_I2C_DEBUG_ALGO is not set 895# CONFIG_I2C_DEBUG_ALGO is not set
907# CONFIG_I2C_DEBUG_BUS is not set 896# CONFIG_I2C_DEBUG_BUS is not set
908# CONFIG_I2C_DEBUG_CHIP is not set 897# CONFIG_I2C_DEBUG_CHIP is not set
909
910#
911# SPI support
912#
913# CONFIG_SPI is not set 898# CONFIG_SPI is not set
914# CONFIG_SPI_MASTER is not set
915# CONFIG_W1 is not set 899# CONFIG_W1 is not set
916# CONFIG_POWER_SUPPLY is not set 900# CONFIG_POWER_SUPPLY is not set
917# CONFIG_HWMON is not set 901# CONFIG_HWMON is not set
@@ -928,12 +912,22 @@ CONFIG_SSB_POSSIBLE=y
928# Multifunction device drivers 912# Multifunction device drivers
929# 913#
930# CONFIG_MFD_SM501 is not set 914# CONFIG_MFD_SM501 is not set
915# CONFIG_HTC_PASIC3 is not set
931 916
932# 917#
933# Multimedia devices 918# Multimedia devices
934# 919#
920
921#
922# Multimedia core support
923#
935# CONFIG_VIDEO_DEV is not set 924# CONFIG_VIDEO_DEV is not set
936# CONFIG_DVB_CORE is not set 925# CONFIG_DVB_CORE is not set
926# CONFIG_VIDEO_MEDIA is not set
927
928#
929# Multimedia drivers
930#
937# CONFIG_DAB is not set 931# CONFIG_DAB is not set
938 932
939# 933#
@@ -953,8 +947,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
953# CONFIG_FB_SYS_FILLRECT is not set 947# CONFIG_FB_SYS_FILLRECT is not set
954# CONFIG_FB_SYS_COPYAREA is not set 948# CONFIG_FB_SYS_COPYAREA is not set
955# CONFIG_FB_SYS_IMAGEBLIT is not set 949# CONFIG_FB_SYS_IMAGEBLIT is not set
950# CONFIG_FB_FOREIGN_ENDIAN is not set
956# CONFIG_FB_SYS_FOPS is not set 951# CONFIG_FB_SYS_FOPS is not set
957CONFIG_FB_DEFERRED_IO=y
958# CONFIG_FB_SVGALIB is not set 952# CONFIG_FB_SVGALIB is not set
959CONFIG_FB_MACMODES=y 953CONFIG_FB_MACMODES=y
960CONFIG_FB_BACKLIGHT=y 954CONFIG_FB_BACKLIGHT=y
@@ -1072,11 +1066,13 @@ CONFIG_USB_DEVICE_CLASS=y
1072# 1066#
1073# USB Host Controller Drivers 1067# USB Host Controller Drivers
1074# 1068#
1069# CONFIG_USB_C67X00_HCD is not set
1075CONFIG_USB_EHCI_HCD=m 1070CONFIG_USB_EHCI_HCD=m
1076# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1071# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1077# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1072# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1078# CONFIG_USB_EHCI_HCD_PPC_OF is not set 1073# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1079# CONFIG_USB_ISP116X_HCD is not set 1074# CONFIG_USB_ISP116X_HCD is not set
1075# CONFIG_USB_ISP1760_HCD is not set
1080CONFIG_USB_OHCI_HCD=y 1076CONFIG_USB_OHCI_HCD=y
1081# CONFIG_USB_OHCI_HCD_PPC_OF is not set 1077# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1082# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1078# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1112,6 +1108,7 @@ CONFIG_USB_STORAGE=m
1112# CONFIG_USB_STORAGE_ALAUDA is not set 1108# CONFIG_USB_STORAGE_ALAUDA is not set
1113# CONFIG_USB_STORAGE_ONETOUCH is not set 1109# CONFIG_USB_STORAGE_ONETOUCH is not set
1114# CONFIG_USB_STORAGE_KARMA is not set 1110# CONFIG_USB_STORAGE_KARMA is not set
1111# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1115# CONFIG_USB_LIBUSUAL is not set 1112# CONFIG_USB_LIBUSUAL is not set
1116 1113
1117# 1114#
@@ -1153,14 +1150,11 @@ CONFIG_USB_MON=y
1153# CONFIG_MMC is not set 1150# CONFIG_MMC is not set
1154# CONFIG_MEMSTICK is not set 1151# CONFIG_MEMSTICK is not set
1155# CONFIG_NEW_LEDS is not set 1152# CONFIG_NEW_LEDS is not set
1153# CONFIG_ACCESSIBILITY is not set
1156# CONFIG_INFINIBAND is not set 1154# CONFIG_INFINIBAND is not set
1157# CONFIG_EDAC is not set 1155# CONFIG_EDAC is not set
1158# CONFIG_RTC_CLASS is not set 1156# CONFIG_RTC_CLASS is not set
1159# CONFIG_DMADEVICES is not set 1157# CONFIG_DMADEVICES is not set
1160
1161#
1162# Userspace I/O
1163#
1164# CONFIG_UIO is not set 1158# CONFIG_UIO is not set
1165 1159
1166# 1160#
@@ -1180,7 +1174,6 @@ CONFIG_FS_MBCACHE=y
1180# CONFIG_JFS_FS is not set 1174# CONFIG_JFS_FS is not set
1181# CONFIG_FS_POSIX_ACL is not set 1175# CONFIG_FS_POSIX_ACL is not set
1182# CONFIG_XFS_FS is not set 1176# CONFIG_XFS_FS is not set
1183# CONFIG_GFS2_FS is not set
1184# CONFIG_OCFS2_FS is not set 1177# CONFIG_OCFS2_FS is not set
1185CONFIG_DNOTIFY=y 1178CONFIG_DNOTIFY=y
1186CONFIG_INOTIFY=y 1179CONFIG_INOTIFY=y
@@ -1314,6 +1307,7 @@ CONFIG_NLS_ISO8859_1=m
1314# Library routines 1307# Library routines
1315# 1308#
1316CONFIG_BITREVERSE=y 1309CONFIG_BITREVERSE=y
1310# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1317CONFIG_CRC_CCITT=m 1311CONFIG_CRC_CCITT=m
1318# CONFIG_CRC16 is not set 1312# CONFIG_CRC16 is not set
1319# CONFIG_CRC_ITU_T is not set 1313# CONFIG_CRC_ITU_T is not set
@@ -1334,6 +1328,7 @@ CONFIG_HAVE_LMB=y
1334# CONFIG_PRINTK_TIME is not set 1328# CONFIG_PRINTK_TIME is not set
1335CONFIG_ENABLE_WARN_DEPRECATED=y 1329CONFIG_ENABLE_WARN_DEPRECATED=y
1336CONFIG_ENABLE_MUST_CHECK=y 1330CONFIG_ENABLE_MUST_CHECK=y
1331CONFIG_FRAME_WARN=1024
1337CONFIG_MAGIC_SYSRQ=y 1332CONFIG_MAGIC_SYSRQ=y
1338# CONFIG_UNUSED_SYMBOLS is not set 1333# CONFIG_UNUSED_SYMBOLS is not set
1339# CONFIG_DEBUG_FS is not set 1334# CONFIG_DEBUG_FS is not set
@@ -1344,6 +1339,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1344CONFIG_SCHED_DEBUG=y 1339CONFIG_SCHED_DEBUG=y
1345# CONFIG_SCHEDSTATS is not set 1340# CONFIG_SCHEDSTATS is not set
1346# CONFIG_TIMER_STATS is not set 1341# CONFIG_TIMER_STATS is not set
1342# CONFIG_DEBUG_OBJECTS is not set
1347# CONFIG_SLUB_DEBUG_ON is not set 1343# CONFIG_SLUB_DEBUG_ON is not set
1348# CONFIG_SLUB_STATS is not set 1344# CONFIG_SLUB_STATS is not set
1349# CONFIG_DEBUG_RT_MUTEXES is not set 1345# CONFIG_DEBUG_RT_MUTEXES is not set
@@ -1357,6 +1353,7 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y
1357CONFIG_DEBUG_BUGVERBOSE=y 1353CONFIG_DEBUG_BUGVERBOSE=y
1358# CONFIG_DEBUG_INFO is not set 1354# CONFIG_DEBUG_INFO is not set
1359# CONFIG_DEBUG_VM is not set 1355# CONFIG_DEBUG_VM is not set
1356# CONFIG_DEBUG_WRITECOUNT is not set
1360# CONFIG_DEBUG_LIST is not set 1357# CONFIG_DEBUG_LIST is not set
1361# CONFIG_DEBUG_SG is not set 1358# CONFIG_DEBUG_SG is not set
1362# CONFIG_BOOT_PRINTK_DELAY is not set 1359# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1371,6 +1368,7 @@ CONFIG_DEBUGGER=y
1371CONFIG_XMON=y 1368CONFIG_XMON=y
1372CONFIG_XMON_DEFAULT=y 1369CONFIG_XMON_DEFAULT=y
1373CONFIG_XMON_DISASSEMBLY=y 1370CONFIG_XMON_DISASSEMBLY=y
1371CONFIG_IRQSTACKS=y
1374# CONFIG_BDI_SWITCH is not set 1372# CONFIG_BDI_SWITCH is not set
1375# CONFIG_BOOTX_TEXT is not set 1373# CONFIG_BOOTX_TEXT is not set
1376# CONFIG_PPC_EARLY_DEBUG is not set 1374# CONFIG_PPC_EARLY_DEBUG is not set
@@ -1382,50 +1380,80 @@ CONFIG_XMON_DISASSEMBLY=y
1382# CONFIG_SECURITY is not set 1380# CONFIG_SECURITY is not set
1383# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1381# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1384CONFIG_CRYPTO=y 1382CONFIG_CRYPTO=y
1383
1384#
1385# Crypto core or helper
1386#
1385CONFIG_CRYPTO_ALGAPI=m 1387CONFIG_CRYPTO_ALGAPI=m
1386CONFIG_CRYPTO_BLKCIPHER=m 1388CONFIG_CRYPTO_BLKCIPHER=m
1387# CONFIG_CRYPTO_SEQIV is not set
1388CONFIG_CRYPTO_MANAGER=m 1389CONFIG_CRYPTO_MANAGER=m
1390# CONFIG_CRYPTO_GF128MUL is not set
1391# CONFIG_CRYPTO_NULL is not set
1392# CONFIG_CRYPTO_CRYPTD is not set
1393# CONFIG_CRYPTO_AUTHENC is not set
1394# CONFIG_CRYPTO_TEST is not set
1395
1396#
1397# Authenticated Encryption with Associated Data
1398#
1399# CONFIG_CRYPTO_CCM is not set
1400# CONFIG_CRYPTO_GCM is not set
1401# CONFIG_CRYPTO_SEQIV is not set
1402
1403#
1404# Block modes
1405#
1406CONFIG_CRYPTO_CBC=m
1407# CONFIG_CRYPTO_CTR is not set
1408# CONFIG_CRYPTO_CTS is not set
1409CONFIG_CRYPTO_ECB=m
1410# CONFIG_CRYPTO_LRW is not set
1411CONFIG_CRYPTO_PCBC=m
1412# CONFIG_CRYPTO_XTS is not set
1413
1414#
1415# Hash modes
1416#
1389# CONFIG_CRYPTO_HMAC is not set 1417# CONFIG_CRYPTO_HMAC is not set
1390# CONFIG_CRYPTO_XCBC is not set 1418# CONFIG_CRYPTO_XCBC is not set
1391# CONFIG_CRYPTO_NULL is not set 1419
1420#
1421# Digest
1422#
1423# CONFIG_CRYPTO_CRC32C is not set
1392# CONFIG_CRYPTO_MD4 is not set 1424# CONFIG_CRYPTO_MD4 is not set
1393# CONFIG_CRYPTO_MD5 is not set 1425# CONFIG_CRYPTO_MD5 is not set
1426# CONFIG_CRYPTO_MICHAEL_MIC is not set
1394CONFIG_CRYPTO_SHA1=m 1427CONFIG_CRYPTO_SHA1=m
1395# CONFIG_CRYPTO_SHA256 is not set 1428# CONFIG_CRYPTO_SHA256 is not set
1396# CONFIG_CRYPTO_SHA512 is not set 1429# CONFIG_CRYPTO_SHA512 is not set
1397# CONFIG_CRYPTO_WP512 is not set
1398# CONFIG_CRYPTO_TGR192 is not set 1430# CONFIG_CRYPTO_TGR192 is not set
1399# CONFIG_CRYPTO_GF128MUL is not set 1431# CONFIG_CRYPTO_WP512 is not set
1400CONFIG_CRYPTO_ECB=m 1432
1401CONFIG_CRYPTO_CBC=m 1433#
1402CONFIG_CRYPTO_PCBC=m 1434# Ciphers
1403# CONFIG_CRYPTO_LRW is not set 1435#
1404# CONFIG_CRYPTO_XTS is not set
1405# CONFIG_CRYPTO_CTR is not set
1406# CONFIG_CRYPTO_GCM is not set
1407# CONFIG_CRYPTO_CCM is not set
1408# CONFIG_CRYPTO_CRYPTD is not set
1409# CONFIG_CRYPTO_DES is not set
1410# CONFIG_CRYPTO_FCRYPT is not set
1411# CONFIG_CRYPTO_BLOWFISH is not set
1412# CONFIG_CRYPTO_TWOFISH is not set
1413# CONFIG_CRYPTO_SERPENT is not set
1414# CONFIG_CRYPTO_AES is not set 1436# CONFIG_CRYPTO_AES is not set
1437# CONFIG_CRYPTO_ANUBIS is not set
1438CONFIG_CRYPTO_ARC4=m
1439# CONFIG_CRYPTO_BLOWFISH is not set
1440# CONFIG_CRYPTO_CAMELLIA is not set
1415# CONFIG_CRYPTO_CAST5 is not set 1441# CONFIG_CRYPTO_CAST5 is not set
1416# CONFIG_CRYPTO_CAST6 is not set 1442# CONFIG_CRYPTO_CAST6 is not set
1417# CONFIG_CRYPTO_TEA is not set 1443# CONFIG_CRYPTO_DES is not set
1418CONFIG_CRYPTO_ARC4=m 1444# CONFIG_CRYPTO_FCRYPT is not set
1419# CONFIG_CRYPTO_KHAZAD is not set 1445# CONFIG_CRYPTO_KHAZAD is not set
1420# CONFIG_CRYPTO_ANUBIS is not set
1421# CONFIG_CRYPTO_SEED is not set
1422# CONFIG_CRYPTO_SALSA20 is not set 1446# CONFIG_CRYPTO_SALSA20 is not set
1447# CONFIG_CRYPTO_SEED is not set
1448# CONFIG_CRYPTO_SERPENT is not set
1449# CONFIG_CRYPTO_TEA is not set
1450# CONFIG_CRYPTO_TWOFISH is not set
1451
1452#
1453# Compression
1454#
1423# CONFIG_CRYPTO_DEFLATE is not set 1455# CONFIG_CRYPTO_DEFLATE is not set
1424# CONFIG_CRYPTO_MICHAEL_MIC is not set
1425# CONFIG_CRYPTO_CRC32C is not set
1426# CONFIG_CRYPTO_CAMELLIA is not set
1427# CONFIG_CRYPTO_TEST is not set
1428# CONFIG_CRYPTO_AUTHENC is not set
1429# CONFIG_CRYPTO_LZO is not set 1456# CONFIG_CRYPTO_LZO is not set
1430# CONFIG_CRYPTO_HW is not set 1457# CONFIG_CRYPTO_HW is not set
1431# CONFIG_PPC_CLOCK is not set 1458# CONFIG_PPC_CLOCK is not set
1459# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 88338a9f5e95..db34909831a2 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Thu Mar 27 13:55:43 2008 4# Tue May 20 20:01:18 2008
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -29,6 +29,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
29CONFIG_GENERIC_HARDIRQS=y 29CONFIG_GENERIC_HARDIRQS=y
30CONFIG_HAVE_SETUP_PER_CPU_AREA=y 30CONFIG_HAVE_SETUP_PER_CPU_AREA=y
31CONFIG_IRQ_PER_CPU=y 31CONFIG_IRQ_PER_CPU=y
32CONFIG_STACKTRACE_SUPPORT=y
33CONFIG_TRACE_IRQFLAGS_SUPPORT=y
34CONFIG_LOCKDEP_SUPPORT=y
32CONFIG_RWSEM_XCHGADD_ALGORITHM=y 35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
33CONFIG_ARCH_HAS_ILOG2_U32=y 36CONFIG_ARCH_HAS_ILOG2_U32=y
34CONFIG_ARCH_HAS_ILOG2_U64=y 37CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -91,6 +94,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
91CONFIG_SYSCTL=y 94CONFIG_SYSCTL=y
92# CONFIG_EMBEDDED is not set 95# CONFIG_EMBEDDED is not set
93CONFIG_SYSCTL_SYSCALL=y 96CONFIG_SYSCTL_SYSCALL=y
97CONFIG_SYSCTL_SYSCALL_CHECK=y
94CONFIG_KALLSYMS=y 98CONFIG_KALLSYMS=y
95# CONFIG_KALLSYMS_ALL is not set 99# CONFIG_KALLSYMS_ALL is not set
96# CONFIG_KALLSYMS_EXTRA_PASS is not set 100# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -119,12 +123,14 @@ CONFIG_HAVE_OPROFILE=y
119# CONFIG_KPROBES is not set 123# CONFIG_KPROBES is not set
120CONFIG_HAVE_KPROBES=y 124CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 125CONFIG_HAVE_KRETPROBES=y
126# CONFIG_HAVE_DMA_ATTRS is not set
122CONFIG_PROC_PAGE_MONITOR=y 127CONFIG_PROC_PAGE_MONITOR=y
123CONFIG_SLABINFO=y 128CONFIG_SLABINFO=y
124CONFIG_RT_MUTEXES=y 129CONFIG_RT_MUTEXES=y
125# CONFIG_TINY_SHMEM is not set 130# CONFIG_TINY_SHMEM is not set
126CONFIG_BASE_SMALL=0 131CONFIG_BASE_SMALL=0
127CONFIG_MODULES=y 132CONFIG_MODULES=y
133# CONFIG_MODULE_FORCE_LOAD is not set
128CONFIG_MODULE_UNLOAD=y 134CONFIG_MODULE_UNLOAD=y
129# CONFIG_MODULE_FORCE_UNLOAD is not set 135# CONFIG_MODULE_FORCE_UNLOAD is not set
130CONFIG_MODVERSIONS=y 136CONFIG_MODVERSIONS=y
@@ -165,11 +171,11 @@ CONFIG_PPC_PMAC=y
165CONFIG_PPC_PMAC64=y 171CONFIG_PPC_PMAC64=y
166# CONFIG_PPC_MAPLE is not set 172# CONFIG_PPC_MAPLE is not set
167# CONFIG_PPC_PASEMI is not set 173# CONFIG_PPC_PASEMI is not set
168# CONFIG_PPC_CELLEB is not set
169# CONFIG_PPC_PS3 is not set 174# CONFIG_PPC_PS3 is not set
170# CONFIG_PPC_CELL is not set 175# CONFIG_PPC_CELL is not set
171# CONFIG_PPC_CELL_NATIVE is not set 176# CONFIG_PPC_CELL_NATIVE is not set
172# CONFIG_PPC_IBM_CELL_BLADE is not set 177# CONFIG_PPC_IBM_CELL_BLADE is not set
178# CONFIG_PPC_CELLEB is not set
173# CONFIG_PQ2ADS is not set 179# CONFIG_PQ2ADS is not set
174CONFIG_PPC_NATIVE=y 180CONFIG_PPC_NATIVE=y
175# CONFIG_IPIC is not set 181# CONFIG_IPIC is not set
@@ -190,6 +196,7 @@ CONFIG_CPU_FREQ_TABLE=y
190CONFIG_CPU_FREQ_STAT=y 196CONFIG_CPU_FREQ_STAT=y
191# CONFIG_CPU_FREQ_STAT_DETAILS is not set 197# CONFIG_CPU_FREQ_STAT_DETAILS is not set
192CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 198CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
199# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
193# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 200# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
194# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 201# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
195# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 202# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
@@ -224,7 +231,6 @@ CONFIG_PREEMPT_NONE=y
224CONFIG_BINFMT_ELF=y 231CONFIG_BINFMT_ELF=y
225CONFIG_COMPAT_BINFMT_ELF=y 232CONFIG_COMPAT_BINFMT_ELF=y
226# CONFIG_BINFMT_MISC is not set 233# CONFIG_BINFMT_MISC is not set
227CONFIG_FORCE_MAX_ZONEORDER=13
228CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y 234CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
229CONFIG_IOMMU_VMERGE=y 235CONFIG_IOMMU_VMERGE=y
230CONFIG_IOMMU_HELPER=y 236CONFIG_IOMMU_HELPER=y
@@ -248,12 +254,14 @@ CONFIG_FLATMEM=y
248CONFIG_FLAT_NODE_MEM_MAP=y 254CONFIG_FLAT_NODE_MEM_MAP=y
249# CONFIG_SPARSEMEM_STATIC is not set 255# CONFIG_SPARSEMEM_STATIC is not set
250CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 256CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
257CONFIG_PAGEFLAGS_EXTENDED=y
251CONFIG_SPLIT_PTLOCK_CPUS=4 258CONFIG_SPLIT_PTLOCK_CPUS=4
252CONFIG_RESOURCES_64BIT=y 259CONFIG_RESOURCES_64BIT=y
253CONFIG_ZONE_DMA_FLAG=1 260CONFIG_ZONE_DMA_FLAG=1
254CONFIG_BOUNCE=y 261CONFIG_BOUNCE=y
255# CONFIG_PPC_HAS_HASH_64K is not set 262# CONFIG_PPC_HAS_HASH_64K is not set
256# CONFIG_PPC_64K_PAGES is not set 263# CONFIG_PPC_64K_PAGES is not set
264CONFIG_FORCE_MAX_ZONEORDER=13
257# CONFIG_SCHED_SMT is not set 265# CONFIG_SCHED_SMT is not set
258CONFIG_PROC_DEVICETREE=y 266CONFIG_PROC_DEVICETREE=y
259# CONFIG_CMDLINE_BOOL is not set 267# CONFIG_CMDLINE_BOOL is not set
@@ -278,7 +286,10 @@ CONFIG_PCI_MSI=y
278# CONFIG_PCI_DEBUG is not set 286# CONFIG_PCI_DEBUG is not set
279# CONFIG_PCCARD is not set 287# CONFIG_PCCARD is not set
280# CONFIG_HOTPLUG_PCI is not set 288# CONFIG_HOTPLUG_PCI is not set
289# CONFIG_HAS_RAPIDIO is not set
290CONFIG_PAGE_OFFSET=0xc000000000000000
281CONFIG_KERNEL_START=0xc000000000000000 291CONFIG_KERNEL_START=0xc000000000000000
292CONFIG_PHYSICAL_START=0x00000000
282 293
283# 294#
284# Networking 295# Networking
@@ -325,8 +336,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
325# CONFIG_TCP_MD5SIG is not set 336# CONFIG_TCP_MD5SIG is not set
326# CONFIG_IP_VS is not set 337# CONFIG_IP_VS is not set
327# CONFIG_IPV6 is not set 338# CONFIG_IPV6 is not set
328# CONFIG_INET6_XFRM_TUNNEL is not set
329# CONFIG_INET6_TUNNEL is not set
330# CONFIG_NETWORK_SECMARK is not set 339# CONFIG_NETWORK_SECMARK is not set
331CONFIG_NETFILTER=y 340CONFIG_NETFILTER=y
332# CONFIG_NETFILTER_DEBUG is not set 341# CONFIG_NETFILTER_DEBUG is not set
@@ -342,6 +351,7 @@ CONFIG_NF_CONNTRACK=m
342# CONFIG_NF_CT_ACCT is not set 351# CONFIG_NF_CT_ACCT is not set
343CONFIG_NF_CONNTRACK_MARK=y 352CONFIG_NF_CONNTRACK_MARK=y
344CONFIG_NF_CONNTRACK_EVENTS=y 353CONFIG_NF_CONNTRACK_EVENTS=y
354# CONFIG_NF_CT_PROTO_DCCP is not set
345# CONFIG_NF_CT_PROTO_SCTP is not set 355# CONFIG_NF_CT_PROTO_SCTP is not set
346# CONFIG_NF_CT_PROTO_UDPLITE is not set 356# CONFIG_NF_CT_PROTO_UDPLITE is not set
347# CONFIG_NF_CONNTRACK_AMANDA is not set 357# CONFIG_NF_CONNTRACK_AMANDA is not set
@@ -418,6 +428,7 @@ CONFIG_FW_LOADER=y
418# CONFIG_CONNECTOR is not set 428# CONFIG_CONNECTOR is not set
419# CONFIG_MTD is not set 429# CONFIG_MTD is not set
420CONFIG_OF_DEVICE=y 430CONFIG_OF_DEVICE=y
431CONFIG_OF_I2C=y
421# CONFIG_PARPORT is not set 432# CONFIG_PARPORT is not set
422CONFIG_BLK_DEV=y 433CONFIG_BLK_DEV=y
423# CONFIG_BLK_DEV_FD is not set 434# CONFIG_BLK_DEV_FD is not set
@@ -465,7 +476,6 @@ CONFIG_IDE_PROC_FS=y
465# 476#
466# IDE chipset support/bugfixes 477# IDE chipset support/bugfixes
467# 478#
468CONFIG_IDE_GENERIC=y
469# CONFIG_BLK_DEV_PLATFORM is not set 479# CONFIG_BLK_DEV_PLATFORM is not set
470CONFIG_BLK_DEV_IDEDMA_SFF=y 480CONFIG_BLK_DEV_IDEDMA_SFF=y
471 481
@@ -506,7 +516,7 @@ CONFIG_BLK_DEV_IDE_PMAC=y
506CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y 516CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
507CONFIG_BLK_DEV_IDEDMA_PMAC=y 517CONFIG_BLK_DEV_IDEDMA_PMAC=y
508CONFIG_BLK_DEV_IDEDMA=y 518CONFIG_BLK_DEV_IDEDMA=y
509CONFIG_IDE_ARCH_OBSOLETE_INIT=y 519# CONFIG_BLK_DEV_HD_ONLY is not set
510# CONFIG_BLK_DEV_HD is not set 520# CONFIG_BLK_DEV_HD is not set
511 521
512# 522#
@@ -584,61 +594,10 @@ CONFIG_SCSI_LOWLEVEL=y
584# CONFIG_SCSI_SRP is not set 594# CONFIG_SCSI_SRP is not set
585CONFIG_ATA=y 595CONFIG_ATA=y
586# CONFIG_ATA_NONSTANDARD is not set 596# CONFIG_ATA_NONSTANDARD is not set
597CONFIG_SATA_PMP=y
587# CONFIG_SATA_AHCI is not set 598# CONFIG_SATA_AHCI is not set
588CONFIG_SATA_SVW=y
589# CONFIG_ATA_PIIX is not set
590# CONFIG_SATA_MV is not set
591# CONFIG_SATA_NV is not set
592# CONFIG_PDC_ADMA is not set
593# CONFIG_SATA_QSTOR is not set
594# CONFIG_SATA_PROMISE is not set
595# CONFIG_SATA_SX4 is not set
596# CONFIG_SATA_SIL is not set
597# CONFIG_SATA_SIL24 is not set 599# CONFIG_SATA_SIL24 is not set
598# CONFIG_SATA_SIS is not set 600# CONFIG_ATA_SFF is not set
599# CONFIG_SATA_ULI is not set
600# CONFIG_SATA_VIA is not set
601# CONFIG_SATA_VITESSE is not set
602# CONFIG_SATA_INIC162X is not set
603# CONFIG_PATA_ALI is not set
604# CONFIG_PATA_AMD is not set
605# CONFIG_PATA_ARTOP is not set
606# CONFIG_PATA_ATIIXP is not set
607# CONFIG_PATA_CMD640_PCI is not set
608# CONFIG_PATA_CMD64X is not set
609# CONFIG_PATA_CS5520 is not set
610# CONFIG_PATA_CS5530 is not set
611# CONFIG_PATA_CYPRESS is not set
612# CONFIG_PATA_EFAR is not set
613# CONFIG_ATA_GENERIC is not set
614# CONFIG_PATA_HPT366 is not set
615# CONFIG_PATA_HPT37X is not set
616# CONFIG_PATA_HPT3X2N is not set
617# CONFIG_PATA_HPT3X3 is not set
618# CONFIG_PATA_IT821X is not set
619# CONFIG_PATA_IT8213 is not set
620# CONFIG_PATA_JMICRON is not set
621# CONFIG_PATA_TRIFLEX is not set
622# CONFIG_PATA_MARVELL is not set
623# CONFIG_PATA_MPIIX is not set
624# CONFIG_PATA_OLDPIIX is not set
625# CONFIG_PATA_NETCELL is not set
626# CONFIG_PATA_NINJA32 is not set
627# CONFIG_PATA_NS87410 is not set
628# CONFIG_PATA_NS87415 is not set
629# CONFIG_PATA_OPTI is not set
630# CONFIG_PATA_OPTIDMA is not set
631# CONFIG_PATA_PDC_OLD is not set
632# CONFIG_PATA_RADISYS is not set
633# CONFIG_PATA_RZ1000 is not set
634# CONFIG_PATA_SC1200 is not set
635# CONFIG_PATA_SERVERWORKS is not set
636# CONFIG_PATA_PDC2027X is not set
637# CONFIG_PATA_SIL680 is not set
638# CONFIG_PATA_SIS is not set
639# CONFIG_PATA_VIA is not set
640# CONFIG_PATA_WINBOND is not set
641# CONFIG_PATA_PLATFORM is not set
642CONFIG_MD=y 601CONFIG_MD=y
643CONFIG_BLK_DEV_MD=y 602CONFIG_BLK_DEV_MD=y
644CONFIG_MD_LINEAR=y 603CONFIG_MD_LINEAR=y
@@ -740,7 +699,6 @@ CONFIG_E1000=y
740# CONFIG_SIS190 is not set 699# CONFIG_SIS190 is not set
741# CONFIG_SKGE is not set 700# CONFIG_SKGE is not set
742# CONFIG_SKY2 is not set 701# CONFIG_SKY2 is not set
743# CONFIG_SK98LIN is not set
744# CONFIG_VIA_VELOCITY is not set 702# CONFIG_VIA_VELOCITY is not set
745CONFIG_TIGON3=y 703CONFIG_TIGON3=y
746# CONFIG_BNX2 is not set 704# CONFIG_BNX2 is not set
@@ -755,10 +713,10 @@ CONFIG_NETDEV_10000=y
755# CONFIG_MYRI10GE is not set 713# CONFIG_MYRI10GE is not set
756# CONFIG_NETXEN_NIC is not set 714# CONFIG_NETXEN_NIC is not set
757# CONFIG_NIU is not set 715# CONFIG_NIU is not set
758# CONFIG_PASEMI_MAC is not set
759# CONFIG_MLX4_CORE is not set 716# CONFIG_MLX4_CORE is not set
760# CONFIG_TEHUTI is not set 717# CONFIG_TEHUTI is not set
761# CONFIG_BNX2X is not set 718# CONFIG_BNX2X is not set
719# CONFIG_SFC is not set
762CONFIG_TR=y 720CONFIG_TR=y
763CONFIG_IBMOL=y 721CONFIG_IBMOL=y
764# CONFIG_3C359 is not set 722# CONFIG_3C359 is not set
@@ -769,6 +727,7 @@ CONFIG_IBMOL=y
769# 727#
770# CONFIG_WLAN_PRE80211 is not set 728# CONFIG_WLAN_PRE80211 is not set
771# CONFIG_WLAN_80211 is not set 729# CONFIG_WLAN_80211 is not set
730# CONFIG_IWLWIFI_LEDS is not set
772 731
773# 732#
774# USB Network Adapters 733# USB Network Adapters
@@ -865,6 +824,7 @@ CONFIG_VT=y
865CONFIG_VT_CONSOLE=y 824CONFIG_VT_CONSOLE=y
866CONFIG_HW_CONSOLE=y 825CONFIG_HW_CONSOLE=y
867# CONFIG_VT_HW_CONSOLE_BINDING is not set 826# CONFIG_VT_HW_CONSOLE_BINDING is not set
827CONFIG_DEVKMEM=y
868# CONFIG_SERIAL_NONSTANDARD is not set 828# CONFIG_SERIAL_NONSTANDARD is not set
869# CONFIG_NOZOMI is not set 829# CONFIG_NOZOMI is not set
870 830
@@ -895,13 +855,7 @@ CONFIG_DEVPORT=y
895CONFIG_I2C=y 855CONFIG_I2C=y
896CONFIG_I2C_BOARDINFO=y 856CONFIG_I2C_BOARDINFO=y
897CONFIG_I2C_CHARDEV=y 857CONFIG_I2C_CHARDEV=y
898
899#
900# I2C Algorithms
901#
902CONFIG_I2C_ALGOBIT=y 858CONFIG_I2C_ALGOBIT=y
903# CONFIG_I2C_ALGOPCF is not set
904# CONFIG_I2C_ALGOPCA is not set
905 859
906# 860#
907# I2C Hardware Bus support 861# I2C Hardware Bus support
@@ -930,6 +884,7 @@ CONFIG_I2C_POWERMAC=y
930# CONFIG_I2C_VIA is not set 884# CONFIG_I2C_VIA is not set
931# CONFIG_I2C_VIAPRO is not set 885# CONFIG_I2C_VIAPRO is not set
932# CONFIG_I2C_VOODOO3 is not set 886# CONFIG_I2C_VOODOO3 is not set
887# CONFIG_I2C_PCA_PLATFORM is not set
933 888
934# 889#
935# Miscellaneous I2C Chip support 890# Miscellaneous I2C Chip support
@@ -939,19 +894,13 @@ CONFIG_I2C_POWERMAC=y
939# CONFIG_SENSORS_PCF8574 is not set 894# CONFIG_SENSORS_PCF8574 is not set
940# CONFIG_PCF8575 is not set 895# CONFIG_PCF8575 is not set
941# CONFIG_SENSORS_PCF8591 is not set 896# CONFIG_SENSORS_PCF8591 is not set
942# CONFIG_TPS65010 is not set
943# CONFIG_SENSORS_MAX6875 is not set 897# CONFIG_SENSORS_MAX6875 is not set
944# CONFIG_SENSORS_TSL2550 is not set 898# CONFIG_SENSORS_TSL2550 is not set
945# CONFIG_I2C_DEBUG_CORE is not set 899# CONFIG_I2C_DEBUG_CORE is not set
946# CONFIG_I2C_DEBUG_ALGO is not set 900# CONFIG_I2C_DEBUG_ALGO is not set
947# CONFIG_I2C_DEBUG_BUS is not set 901# CONFIG_I2C_DEBUG_BUS is not set
948# CONFIG_I2C_DEBUG_CHIP is not set 902# CONFIG_I2C_DEBUG_CHIP is not set
949
950#
951# SPI support
952#
953# CONFIG_SPI is not set 903# CONFIG_SPI is not set
954# CONFIG_SPI_MASTER is not set
955# CONFIG_W1 is not set 904# CONFIG_W1 is not set
956# CONFIG_POWER_SUPPLY is not set 905# CONFIG_POWER_SUPPLY is not set
957# CONFIG_HWMON is not set 906# CONFIG_HWMON is not set
@@ -968,12 +917,22 @@ CONFIG_SSB_POSSIBLE=y
968# Multifunction device drivers 917# Multifunction device drivers
969# 918#
970# CONFIG_MFD_SM501 is not set 919# CONFIG_MFD_SM501 is not set
920# CONFIG_HTC_PASIC3 is not set
971 921
972# 922#
973# Multimedia devices 923# Multimedia devices
974# 924#
925
926#
927# Multimedia core support
928#
975# CONFIG_VIDEO_DEV is not set 929# CONFIG_VIDEO_DEV is not set
976# CONFIG_DVB_CORE is not set 930# CONFIG_DVB_CORE is not set
931# CONFIG_VIDEO_MEDIA is not set
932
933#
934# Multimedia drivers
935#
977CONFIG_DAB=y 936CONFIG_DAB=y
978# CONFIG_USB_DABUSB is not set 937# CONFIG_USB_DABUSB is not set
979 938
@@ -995,8 +954,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
995# CONFIG_FB_SYS_FILLRECT is not set 954# CONFIG_FB_SYS_FILLRECT is not set
996# CONFIG_FB_SYS_COPYAREA is not set 955# CONFIG_FB_SYS_COPYAREA is not set
997# CONFIG_FB_SYS_IMAGEBLIT is not set 956# CONFIG_FB_SYS_IMAGEBLIT is not set
957# CONFIG_FB_FOREIGN_ENDIAN is not set
998# CONFIG_FB_SYS_FOPS is not set 958# CONFIG_FB_SYS_FOPS is not set
999CONFIG_FB_DEFERRED_IO=y
1000# CONFIG_FB_SVGALIB is not set 959# CONFIG_FB_SVGALIB is not set
1001CONFIG_FB_MACMODES=y 960CONFIG_FB_MACMODES=y
1002CONFIG_FB_BACKLIGHT=y 961CONFIG_FB_BACKLIGHT=y
@@ -1112,6 +1071,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
1112# CONFIG_SND_AU8810 is not set 1071# CONFIG_SND_AU8810 is not set
1113# CONFIG_SND_AU8820 is not set 1072# CONFIG_SND_AU8820 is not set
1114# CONFIG_SND_AU8830 is not set 1073# CONFIG_SND_AU8830 is not set
1074# CONFIG_SND_AW2 is not set
1115# CONFIG_SND_AZT3328 is not set 1075# CONFIG_SND_AZT3328 is not set
1116# CONFIG_SND_BT87X is not set 1076# CONFIG_SND_BT87X is not set
1117# CONFIG_SND_CA0106 is not set 1077# CONFIG_SND_CA0106 is not set
@@ -1198,11 +1158,11 @@ CONFIG_SND_USB_AUDIO=m
1198# CONFIG_SND_SOC is not set 1158# CONFIG_SND_SOC is not set
1199 1159
1200# 1160#
1201# SoC Audio support for SuperH 1161# ALSA SoC audio for Freescale SOCs
1202# 1162#
1203 1163
1204# 1164#
1205# ALSA SoC audio for Freescale SOCs 1165# SoC Audio for the Texas Instruments OMAP
1206# 1166#
1207 1167
1208# 1168#
@@ -1222,6 +1182,7 @@ CONFIG_USB_HID=y
1222CONFIG_HID_FF=y 1182CONFIG_HID_FF=y
1223CONFIG_HID_PID=y 1183CONFIG_HID_PID=y
1224CONFIG_LOGITECH_FF=y 1184CONFIG_LOGITECH_FF=y
1185# CONFIG_LOGIRUMBLEPAD2_FF is not set
1225# CONFIG_PANTHERLORD_FF is not set 1186# CONFIG_PANTHERLORD_FF is not set
1226CONFIG_THRUSTMASTER_FF=y 1187CONFIG_THRUSTMASTER_FF=y
1227# CONFIG_ZEROPLUS_FF is not set 1188# CONFIG_ZEROPLUS_FF is not set
@@ -1245,11 +1206,13 @@ CONFIG_USB_DEVICE_CLASS=y
1245# 1206#
1246# USB Host Controller Drivers 1207# USB Host Controller Drivers
1247# 1208#
1209# CONFIG_USB_C67X00_HCD is not set
1248CONFIG_USB_EHCI_HCD=y 1210CONFIG_USB_EHCI_HCD=y
1249# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1211# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1250# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1212# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1251# CONFIG_USB_EHCI_HCD_PPC_OF is not set 1213# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1252# CONFIG_USB_ISP116X_HCD is not set 1214# CONFIG_USB_ISP116X_HCD is not set
1215# CONFIG_USB_ISP1760_HCD is not set
1253CONFIG_USB_OHCI_HCD=y 1216CONFIG_USB_OHCI_HCD=y
1254CONFIG_USB_OHCI_HCD_PPC_OF=y 1217CONFIG_USB_OHCI_HCD_PPC_OF=y
1255CONFIG_USB_OHCI_HCD_PPC_OF_BE=y 1218CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
@@ -1288,6 +1251,7 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
1288# CONFIG_USB_STORAGE_ALAUDA is not set 1251# CONFIG_USB_STORAGE_ALAUDA is not set
1289# CONFIG_USB_STORAGE_ONETOUCH is not set 1252# CONFIG_USB_STORAGE_ONETOUCH is not set
1290# CONFIG_USB_STORAGE_KARMA is not set 1253# CONFIG_USB_STORAGE_KARMA is not set
1254# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1291# CONFIG_USB_LIBUSUAL is not set 1255# CONFIG_USB_LIBUSUAL is not set
1292 1256
1293# 1257#
@@ -1342,9 +1306,11 @@ CONFIG_USB_SERIAL_KOBIL_SCT=m
1342CONFIG_USB_SERIAL_MCT_U232=m 1306CONFIG_USB_SERIAL_MCT_U232=m
1343# CONFIG_USB_SERIAL_MOS7720 is not set 1307# CONFIG_USB_SERIAL_MOS7720 is not set
1344# CONFIG_USB_SERIAL_MOS7840 is not set 1308# CONFIG_USB_SERIAL_MOS7840 is not set
1309# CONFIG_USB_SERIAL_MOTOROLA is not set
1345# CONFIG_USB_SERIAL_NAVMAN is not set 1310# CONFIG_USB_SERIAL_NAVMAN is not set
1346CONFIG_USB_SERIAL_PL2303=m 1311CONFIG_USB_SERIAL_PL2303=m
1347# CONFIG_USB_SERIAL_OTI6858 is not set 1312# CONFIG_USB_SERIAL_OTI6858 is not set
1313# CONFIG_USB_SERIAL_SPCP8X5 is not set
1348# CONFIG_USB_SERIAL_HP4X is not set 1314# CONFIG_USB_SERIAL_HP4X is not set
1349CONFIG_USB_SERIAL_SAFE=m 1315CONFIG_USB_SERIAL_SAFE=m
1350CONFIG_USB_SERIAL_SAFE_PADDED=y 1316CONFIG_USB_SERIAL_SAFE_PADDED=y
@@ -1383,14 +1349,11 @@ CONFIG_USB_APPLEDISPLAY=m
1383# CONFIG_MMC is not set 1349# CONFIG_MMC is not set
1384# CONFIG_MEMSTICK is not set 1350# CONFIG_MEMSTICK is not set
1385# CONFIG_NEW_LEDS is not set 1351# CONFIG_NEW_LEDS is not set
1352# CONFIG_ACCESSIBILITY is not set
1386# CONFIG_INFINIBAND is not set 1353# CONFIG_INFINIBAND is not set
1387# CONFIG_EDAC is not set 1354# CONFIG_EDAC is not set
1388# CONFIG_RTC_CLASS is not set 1355# CONFIG_RTC_CLASS is not set
1389# CONFIG_DMADEVICES is not set 1356# CONFIG_DMADEVICES is not set
1390
1391#
1392# Userspace I/O
1393#
1394# CONFIG_UIO is not set 1357# CONFIG_UIO is not set
1395 1358
1396# 1359#
@@ -1420,9 +1383,9 @@ CONFIG_REISERFS_FS_SECURITY=y
1420CONFIG_FS_POSIX_ACL=y 1383CONFIG_FS_POSIX_ACL=y
1421CONFIG_XFS_FS=m 1384CONFIG_XFS_FS=m
1422# CONFIG_XFS_QUOTA is not set 1385# CONFIG_XFS_QUOTA is not set
1423CONFIG_XFS_SECURITY=y
1424CONFIG_XFS_POSIX_ACL=y 1386CONFIG_XFS_POSIX_ACL=y
1425# CONFIG_XFS_RT is not set 1387# CONFIG_XFS_RT is not set
1388# CONFIG_XFS_DEBUG is not set
1426# CONFIG_GFS2_FS is not set 1389# CONFIG_GFS2_FS is not set
1427# CONFIG_OCFS2_FS is not set 1390# CONFIG_OCFS2_FS is not set
1428CONFIG_DNOTIFY=y 1391CONFIG_DNOTIFY=y
@@ -1488,13 +1451,11 @@ CONFIG_NFS_FS=y
1488CONFIG_NFS_V3=y 1451CONFIG_NFS_V3=y
1489CONFIG_NFS_V3_ACL=y 1452CONFIG_NFS_V3_ACL=y
1490CONFIG_NFS_V4=y 1453CONFIG_NFS_V4=y
1491# CONFIG_NFS_DIRECTIO is not set
1492CONFIG_NFSD=y 1454CONFIG_NFSD=y
1493CONFIG_NFSD_V2_ACL=y 1455CONFIG_NFSD_V2_ACL=y
1494CONFIG_NFSD_V3=y 1456CONFIG_NFSD_V3=y
1495CONFIG_NFSD_V3_ACL=y 1457CONFIG_NFSD_V3_ACL=y
1496CONFIG_NFSD_V4=y 1458CONFIG_NFSD_V4=y
1497CONFIG_NFSD_TCP=y
1498CONFIG_LOCKD=y 1459CONFIG_LOCKD=y
1499CONFIG_LOCKD_V4=y 1460CONFIG_LOCKD_V4=y
1500CONFIG_EXPORTFS=y 1461CONFIG_EXPORTFS=y
@@ -1583,9 +1544,10 @@ CONFIG_NLS_UTF8=y
1583# Library routines 1544# Library routines
1584# 1545#
1585CONFIG_BITREVERSE=y 1546CONFIG_BITREVERSE=y
1547# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1586CONFIG_CRC_CCITT=m 1548CONFIG_CRC_CCITT=m
1587# CONFIG_CRC16 is not set 1549# CONFIG_CRC16 is not set
1588# CONFIG_CRC_ITU_T is not set 1550CONFIG_CRC_ITU_T=m
1589CONFIG_CRC32=y 1551CONFIG_CRC32=y
1590# CONFIG_CRC7 is not set 1552# CONFIG_CRC7 is not set
1591CONFIG_LIBCRC32C=m 1553CONFIG_LIBCRC32C=m
@@ -1603,6 +1565,7 @@ CONFIG_HAVE_LMB=y
1603# CONFIG_PRINTK_TIME is not set 1565# CONFIG_PRINTK_TIME is not set
1604CONFIG_ENABLE_WARN_DEPRECATED=y 1566CONFIG_ENABLE_WARN_DEPRECATED=y
1605CONFIG_ENABLE_MUST_CHECK=y 1567CONFIG_ENABLE_MUST_CHECK=y
1568CONFIG_FRAME_WARN=2048
1606CONFIG_MAGIC_SYSRQ=y 1569CONFIG_MAGIC_SYSRQ=y
1607# CONFIG_UNUSED_SYMBOLS is not set 1570# CONFIG_UNUSED_SYMBOLS is not set
1608CONFIG_DEBUG_FS=y 1571CONFIG_DEBUG_FS=y
@@ -1613,18 +1576,23 @@ CONFIG_DETECT_SOFTLOCKUP=y
1613CONFIG_SCHED_DEBUG=y 1576CONFIG_SCHED_DEBUG=y
1614# CONFIG_SCHEDSTATS is not set 1577# CONFIG_SCHEDSTATS is not set
1615# CONFIG_TIMER_STATS is not set 1578# CONFIG_TIMER_STATS is not set
1579# CONFIG_DEBUG_OBJECTS is not set
1616# CONFIG_SLUB_DEBUG_ON is not set 1580# CONFIG_SLUB_DEBUG_ON is not set
1617# CONFIG_SLUB_STATS is not set 1581# CONFIG_SLUB_STATS is not set
1618# CONFIG_DEBUG_RT_MUTEXES is not set 1582# CONFIG_DEBUG_RT_MUTEXES is not set
1619# CONFIG_RT_MUTEX_TESTER is not set 1583# CONFIG_RT_MUTEX_TESTER is not set
1620# CONFIG_DEBUG_SPINLOCK is not set 1584# CONFIG_DEBUG_SPINLOCK is not set
1621CONFIG_DEBUG_MUTEXES=y 1585CONFIG_DEBUG_MUTEXES=y
1586# CONFIG_DEBUG_LOCK_ALLOC is not set
1587# CONFIG_PROVE_LOCKING is not set
1588# CONFIG_LOCK_STAT is not set
1622# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1589# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1623# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1590# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1624# CONFIG_DEBUG_KOBJECT is not set 1591# CONFIG_DEBUG_KOBJECT is not set
1625CONFIG_DEBUG_BUGVERBOSE=y 1592CONFIG_DEBUG_BUGVERBOSE=y
1626# CONFIG_DEBUG_INFO is not set 1593# CONFIG_DEBUG_INFO is not set
1627# CONFIG_DEBUG_VM is not set 1594# CONFIG_DEBUG_VM is not set
1595# CONFIG_DEBUG_WRITECOUNT is not set
1628# CONFIG_DEBUG_LIST is not set 1596# CONFIG_DEBUG_LIST is not set
1629# CONFIG_DEBUG_SG is not set 1597# CONFIG_DEBUG_SG is not set
1630# CONFIG_BOOT_PRINTK_DELAY is not set 1598# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1648,53 +1616,83 @@ CONFIG_BOOTX_TEXT=y
1648# CONFIG_SECURITY is not set 1616# CONFIG_SECURITY is not set
1649# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1617# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1650CONFIG_CRYPTO=y 1618CONFIG_CRYPTO=y
1619
1620#
1621# Crypto core or helper
1622#
1651CONFIG_CRYPTO_ALGAPI=y 1623CONFIG_CRYPTO_ALGAPI=y
1652CONFIG_CRYPTO_AEAD=m 1624CONFIG_CRYPTO_AEAD=m
1653CONFIG_CRYPTO_BLKCIPHER=y 1625CONFIG_CRYPTO_BLKCIPHER=y
1654# CONFIG_CRYPTO_SEQIV is not set
1655CONFIG_CRYPTO_HASH=y 1626CONFIG_CRYPTO_HASH=y
1656CONFIG_CRYPTO_MANAGER=y 1627CONFIG_CRYPTO_MANAGER=y
1628# CONFIG_CRYPTO_GF128MUL is not set
1629CONFIG_CRYPTO_NULL=m
1630# CONFIG_CRYPTO_CRYPTD is not set
1631CONFIG_CRYPTO_AUTHENC=m
1632CONFIG_CRYPTO_TEST=m
1633
1634#
1635# Authenticated Encryption with Associated Data
1636#
1637# CONFIG_CRYPTO_CCM is not set
1638# CONFIG_CRYPTO_GCM is not set
1639# CONFIG_CRYPTO_SEQIV is not set
1640
1641#
1642# Block modes
1643#
1644CONFIG_CRYPTO_CBC=y
1645# CONFIG_CRYPTO_CTR is not set
1646# CONFIG_CRYPTO_CTS is not set
1647CONFIG_CRYPTO_ECB=m
1648# CONFIG_CRYPTO_LRW is not set
1649CONFIG_CRYPTO_PCBC=m
1650# CONFIG_CRYPTO_XTS is not set
1651
1652#
1653# Hash modes
1654#
1657CONFIG_CRYPTO_HMAC=y 1655CONFIG_CRYPTO_HMAC=y
1658# CONFIG_CRYPTO_XCBC is not set 1656# CONFIG_CRYPTO_XCBC is not set
1659CONFIG_CRYPTO_NULL=m 1657
1658#
1659# Digest
1660#
1661CONFIG_CRYPTO_CRC32C=m
1660CONFIG_CRYPTO_MD4=m 1662CONFIG_CRYPTO_MD4=m
1661CONFIG_CRYPTO_MD5=y 1663CONFIG_CRYPTO_MD5=y
1664CONFIG_CRYPTO_MICHAEL_MIC=m
1662CONFIG_CRYPTO_SHA1=m 1665CONFIG_CRYPTO_SHA1=m
1663CONFIG_CRYPTO_SHA256=m 1666CONFIG_CRYPTO_SHA256=m
1664CONFIG_CRYPTO_SHA512=m 1667CONFIG_CRYPTO_SHA512=m
1665CONFIG_CRYPTO_WP512=m
1666# CONFIG_CRYPTO_TGR192 is not set 1668# CONFIG_CRYPTO_TGR192 is not set
1667# CONFIG_CRYPTO_GF128MUL is not set 1669CONFIG_CRYPTO_WP512=m
1668CONFIG_CRYPTO_ECB=m 1670
1669CONFIG_CRYPTO_CBC=y 1671#
1670CONFIG_CRYPTO_PCBC=m 1672# Ciphers
1671# CONFIG_CRYPTO_LRW is not set 1673#
1672# CONFIG_CRYPTO_XTS is not set
1673# CONFIG_CRYPTO_CTR is not set
1674# CONFIG_CRYPTO_GCM is not set
1675# CONFIG_CRYPTO_CCM is not set
1676# CONFIG_CRYPTO_CRYPTD is not set
1677CONFIG_CRYPTO_DES=y
1678# CONFIG_CRYPTO_FCRYPT is not set
1679CONFIG_CRYPTO_BLOWFISH=m
1680CONFIG_CRYPTO_TWOFISH=m
1681CONFIG_CRYPTO_TWOFISH_COMMON=m
1682CONFIG_CRYPTO_SERPENT=m
1683CONFIG_CRYPTO_AES=m 1674CONFIG_CRYPTO_AES=m
1675CONFIG_CRYPTO_ANUBIS=m
1676CONFIG_CRYPTO_ARC4=m
1677CONFIG_CRYPTO_BLOWFISH=m
1678# CONFIG_CRYPTO_CAMELLIA is not set
1684CONFIG_CRYPTO_CAST5=m 1679CONFIG_CRYPTO_CAST5=m
1685CONFIG_CRYPTO_CAST6=m 1680CONFIG_CRYPTO_CAST6=m
1686CONFIG_CRYPTO_TEA=m 1681CONFIG_CRYPTO_DES=y
1687CONFIG_CRYPTO_ARC4=m 1682# CONFIG_CRYPTO_FCRYPT is not set
1688CONFIG_CRYPTO_KHAZAD=m 1683CONFIG_CRYPTO_KHAZAD=m
1689CONFIG_CRYPTO_ANUBIS=m
1690# CONFIG_CRYPTO_SEED is not set
1691# CONFIG_CRYPTO_SALSA20 is not set 1684# CONFIG_CRYPTO_SALSA20 is not set
1685# CONFIG_CRYPTO_SEED is not set
1686CONFIG_CRYPTO_SERPENT=m
1687CONFIG_CRYPTO_TEA=m
1688CONFIG_CRYPTO_TWOFISH=m
1689CONFIG_CRYPTO_TWOFISH_COMMON=m
1690
1691#
1692# Compression
1693#
1692CONFIG_CRYPTO_DEFLATE=m 1694CONFIG_CRYPTO_DEFLATE=m
1693CONFIG_CRYPTO_MICHAEL_MIC=m
1694CONFIG_CRYPTO_CRC32C=m
1695# CONFIG_CRYPTO_CAMELLIA is not set
1696CONFIG_CRYPTO_TEST=m
1697CONFIG_CRYPTO_AUTHENC=m
1698# CONFIG_CRYPTO_LZO is not set 1695# CONFIG_CRYPTO_LZO is not set
1699# CONFIG_CRYPTO_HW is not set 1696# CONFIG_CRYPTO_HW is not set
1700# CONFIG_PPC_CLOCK is not set 1697# CONFIG_PPC_CLOCK is not set
1698# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig
index b3128fb7ce7e..63f0bdb6340d 100644
--- a/arch/powerpc/configs/iseries_defconfig
+++ b/arch/powerpc/configs/iseries_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Thu Mar 27 13:55:45 2008 4# Tue May 20 20:01:36 2008
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -30,6 +30,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
30CONFIG_GENERIC_HARDIRQS=y 30CONFIG_GENERIC_HARDIRQS=y
31CONFIG_HAVE_SETUP_PER_CPU_AREA=y 31CONFIG_HAVE_SETUP_PER_CPU_AREA=y
32CONFIG_IRQ_PER_CPU=y 32CONFIG_IRQ_PER_CPU=y
33CONFIG_STACKTRACE_SUPPORT=y
34CONFIG_TRACE_IRQFLAGS_SUPPORT=y
35CONFIG_LOCKDEP_SUPPORT=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y 36CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y 37CONFIG_ARCH_HAS_ILOG2_U32=y
35CONFIG_ARCH_HAS_ILOG2_U64=y 38CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -91,6 +94,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
91CONFIG_SYSCTL=y 94CONFIG_SYSCTL=y
92# CONFIG_EMBEDDED is not set 95# CONFIG_EMBEDDED is not set
93CONFIG_SYSCTL_SYSCALL=y 96CONFIG_SYSCTL_SYSCALL=y
97CONFIG_SYSCTL_SYSCALL_CHECK=y
94CONFIG_KALLSYMS=y 98CONFIG_KALLSYMS=y
95# CONFIG_KALLSYMS_ALL is not set 99# CONFIG_KALLSYMS_ALL is not set
96# CONFIG_KALLSYMS_EXTRA_PASS is not set 100# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -118,12 +122,14 @@ CONFIG_HAVE_OPROFILE=y
118# CONFIG_KPROBES is not set 122# CONFIG_KPROBES is not set
119CONFIG_HAVE_KPROBES=y 123CONFIG_HAVE_KPROBES=y
120CONFIG_HAVE_KRETPROBES=y 124CONFIG_HAVE_KRETPROBES=y
125# CONFIG_HAVE_DMA_ATTRS is not set
121CONFIG_PROC_PAGE_MONITOR=y 126CONFIG_PROC_PAGE_MONITOR=y
122CONFIG_SLABINFO=y 127CONFIG_SLABINFO=y
123CONFIG_RT_MUTEXES=y 128CONFIG_RT_MUTEXES=y
124# CONFIG_TINY_SHMEM is not set 129# CONFIG_TINY_SHMEM is not set
125CONFIG_BASE_SMALL=0 130CONFIG_BASE_SMALL=0
126CONFIG_MODULES=y 131CONFIG_MODULES=y
132# CONFIG_MODULE_FORCE_LOAD is not set
127CONFIG_MODULE_UNLOAD=y 133CONFIG_MODULE_UNLOAD=y
128# CONFIG_MODULE_FORCE_UNLOAD is not set 134# CONFIG_MODULE_FORCE_UNLOAD is not set
129CONFIG_MODVERSIONS=y 135CONFIG_MODVERSIONS=y
@@ -172,11 +178,11 @@ CONFIG_VIOPATH=y
172# CONFIG_PPC_PMAC is not set 178# CONFIG_PPC_PMAC is not set
173# CONFIG_PPC_MAPLE is not set 179# CONFIG_PPC_MAPLE is not set
174# CONFIG_PPC_PASEMI is not set 180# CONFIG_PPC_PASEMI is not set
175# CONFIG_PPC_CELLEB is not set
176# CONFIG_PPC_PS3 is not set 181# CONFIG_PPC_PS3 is not set
177# CONFIG_PPC_CELL is not set 182# CONFIG_PPC_CELL is not set
178# CONFIG_PPC_CELL_NATIVE is not set 183# CONFIG_PPC_CELL_NATIVE is not set
179# CONFIG_PPC_IBM_CELL_BLADE is not set 184# CONFIG_PPC_IBM_CELL_BLADE is not set
185# CONFIG_PPC_CELLEB is not set
180# CONFIG_PQ2ADS is not set 186# CONFIG_PQ2ADS is not set
181# CONFIG_IPIC is not set 187# CONFIG_IPIC is not set
182# CONFIG_MPIC is not set 188# CONFIG_MPIC is not set
@@ -212,7 +218,6 @@ CONFIG_PREEMPT_NONE=y
212CONFIG_BINFMT_ELF=y 218CONFIG_BINFMT_ELF=y
213CONFIG_COMPAT_BINFMT_ELF=y 219CONFIG_COMPAT_BINFMT_ELF=y
214# CONFIG_BINFMT_MISC is not set 220# CONFIG_BINFMT_MISC is not set
215CONFIG_FORCE_MAX_ZONEORDER=13
216CONFIG_IOMMU_VMERGE=y 221CONFIG_IOMMU_VMERGE=y
217CONFIG_IOMMU_HELPER=y 222CONFIG_IOMMU_HELPER=y
218CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 223CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
@@ -234,12 +239,14 @@ CONFIG_FLATMEM=y
234CONFIG_FLAT_NODE_MEM_MAP=y 239CONFIG_FLAT_NODE_MEM_MAP=y
235# CONFIG_SPARSEMEM_STATIC is not set 240# CONFIG_SPARSEMEM_STATIC is not set
236CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 241CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
242CONFIG_PAGEFLAGS_EXTENDED=y
237CONFIG_SPLIT_PTLOCK_CPUS=4 243CONFIG_SPLIT_PTLOCK_CPUS=4
238CONFIG_RESOURCES_64BIT=y 244CONFIG_RESOURCES_64BIT=y
239CONFIG_ZONE_DMA_FLAG=1 245CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y 246CONFIG_BOUNCE=y
241# CONFIG_PPC_HAS_HASH_64K is not set 247# CONFIG_PPC_HAS_HASH_64K is not set
242# CONFIG_PPC_64K_PAGES is not set 248# CONFIG_PPC_64K_PAGES is not set
249CONFIG_FORCE_MAX_ZONEORDER=13
243# CONFIG_SCHED_SMT is not set 250# CONFIG_SCHED_SMT is not set
244CONFIG_PROC_DEVICETREE=y 251CONFIG_PROC_DEVICETREE=y
245# CONFIG_CMDLINE_BOOL is not set 252# CONFIG_CMDLINE_BOOL is not set
@@ -263,7 +270,10 @@ CONFIG_ARCH_SUPPORTS_MSI=y
263# CONFIG_PCI_DEBUG is not set 270# CONFIG_PCI_DEBUG is not set
264# CONFIG_PCCARD is not set 271# CONFIG_PCCARD is not set
265# CONFIG_HOTPLUG_PCI is not set 272# CONFIG_HOTPLUG_PCI is not set
273# CONFIG_HAS_RAPIDIO is not set
274CONFIG_PAGE_OFFSET=0xc000000000000000
266CONFIG_KERNEL_START=0xc000000000000000 275CONFIG_KERNEL_START=0xc000000000000000
276CONFIG_PHYSICAL_START=0x00000000
267 277
268# 278#
269# Networking 279# Networking
@@ -310,8 +320,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
310# CONFIG_TCP_MD5SIG is not set 320# CONFIG_TCP_MD5SIG is not set
311# CONFIG_IP_VS is not set 321# CONFIG_IP_VS is not set
312# CONFIG_IPV6 is not set 322# CONFIG_IPV6 is not set
313# CONFIG_INET6_XFRM_TUNNEL is not set
314# CONFIG_INET6_TUNNEL is not set
315# CONFIG_NETWORK_SECMARK is not set 323# CONFIG_NETWORK_SECMARK is not set
316CONFIG_NETFILTER=y 324CONFIG_NETFILTER=y
317# CONFIG_NETFILTER_DEBUG is not set 325# CONFIG_NETFILTER_DEBUG is not set
@@ -327,6 +335,7 @@ CONFIG_NF_CONNTRACK=m
327# CONFIG_NF_CT_ACCT is not set 335# CONFIG_NF_CT_ACCT is not set
328CONFIG_NF_CONNTRACK_MARK=y 336CONFIG_NF_CONNTRACK_MARK=y
329CONFIG_NF_CONNTRACK_EVENTS=y 337CONFIG_NF_CONNTRACK_EVENTS=y
338# CONFIG_NF_CT_PROTO_DCCP is not set
330# CONFIG_NF_CT_PROTO_SCTP is not set 339# CONFIG_NF_CT_PROTO_SCTP is not set
331# CONFIG_NF_CT_PROTO_UDPLITE is not set 340# CONFIG_NF_CT_PROTO_UDPLITE is not set
332# CONFIG_NF_CONNTRACK_AMANDA is not set 341# CONFIG_NF_CONNTRACK_AMANDA is not set
@@ -631,7 +640,6 @@ CONFIG_MII=y
631# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 640# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
632CONFIG_NET_PCI=y 641CONFIG_NET_PCI=y
633CONFIG_PCNET32=y 642CONFIG_PCNET32=y
634CONFIG_PCNET32_NAPI=y
635# CONFIG_AMD8111_ETH is not set 643# CONFIG_AMD8111_ETH is not set
636# CONFIG_ADAPTEC_STARFIRE is not set 644# CONFIG_ADAPTEC_STARFIRE is not set
637# CONFIG_B44 is not set 645# CONFIG_B44 is not set
@@ -667,7 +675,6 @@ CONFIG_E1000=m
667# CONFIG_SIS190 is not set 675# CONFIG_SIS190 is not set
668# CONFIG_SKGE is not set 676# CONFIG_SKGE is not set
669# CONFIG_SKY2 is not set 677# CONFIG_SKY2 is not set
670# CONFIG_SK98LIN is not set
671# CONFIG_VIA_VELOCITY is not set 678# CONFIG_VIA_VELOCITY is not set
672# CONFIG_TIGON3 is not set 679# CONFIG_TIGON3 is not set
673# CONFIG_BNX2 is not set 680# CONFIG_BNX2 is not set
@@ -682,10 +689,10 @@ CONFIG_NETDEV_10000=y
682# CONFIG_MYRI10GE is not set 689# CONFIG_MYRI10GE is not set
683# CONFIG_NETXEN_NIC is not set 690# CONFIG_NETXEN_NIC is not set
684# CONFIG_NIU is not set 691# CONFIG_NIU is not set
685# CONFIG_PASEMI_MAC is not set
686# CONFIG_MLX4_CORE is not set 692# CONFIG_MLX4_CORE is not set
687# CONFIG_TEHUTI is not set 693# CONFIG_TEHUTI is not set
688# CONFIG_BNX2X is not set 694# CONFIG_BNX2X is not set
695# CONFIG_SFC is not set
689CONFIG_TR=y 696CONFIG_TR=y
690CONFIG_IBMOL=y 697CONFIG_IBMOL=y
691# CONFIG_3C359 is not set 698# CONFIG_3C359 is not set
@@ -696,6 +703,7 @@ CONFIG_IBMOL=y
696# 703#
697# CONFIG_WLAN_PRE80211 is not set 704# CONFIG_WLAN_PRE80211 is not set
698# CONFIG_WLAN_80211 is not set 705# CONFIG_WLAN_80211 is not set
706# CONFIG_IWLWIFI_LEDS is not set
699# CONFIG_WAN is not set 707# CONFIG_WAN is not set
700CONFIG_ISERIES_VETH=y 708CONFIG_ISERIES_VETH=y
701# CONFIG_FDDI is not set 709# CONFIG_FDDI is not set
@@ -762,6 +770,7 @@ CONFIG_VT=y
762CONFIG_VT_CONSOLE=y 770CONFIG_VT_CONSOLE=y
763CONFIG_HW_CONSOLE=y 771CONFIG_HW_CONSOLE=y
764# CONFIG_VT_HW_CONSOLE_BINDING is not set 772# CONFIG_VT_HW_CONSOLE_BINDING is not set
773CONFIG_DEVKMEM=y
765# CONFIG_SERIAL_NONSTANDARD is not set 774# CONFIG_SERIAL_NONSTANDARD is not set
766# CONFIG_NOZOMI is not set 775# CONFIG_NOZOMI is not set
767 776
@@ -793,12 +802,7 @@ CONFIG_MAX_RAW_DEVS=256
793# CONFIG_TCG_TPM is not set 802# CONFIG_TCG_TPM is not set
794CONFIG_DEVPORT=y 803CONFIG_DEVPORT=y
795# CONFIG_I2C is not set 804# CONFIG_I2C is not set
796
797#
798# SPI support
799#
800# CONFIG_SPI is not set 805# CONFIG_SPI is not set
801# CONFIG_SPI_MASTER is not set
802# CONFIG_W1 is not set 806# CONFIG_W1 is not set
803# CONFIG_POWER_SUPPLY is not set 807# CONFIG_POWER_SUPPLY is not set
804# CONFIG_HWMON is not set 808# CONFIG_HWMON is not set
@@ -815,12 +819,22 @@ CONFIG_SSB_POSSIBLE=y
815# Multifunction device drivers 819# Multifunction device drivers
816# 820#
817# CONFIG_MFD_SM501 is not set 821# CONFIG_MFD_SM501 is not set
822# CONFIG_HTC_PASIC3 is not set
818 823
819# 824#
820# Multimedia devices 825# Multimedia devices
821# 826#
827
828#
829# Multimedia core support
830#
822# CONFIG_VIDEO_DEV is not set 831# CONFIG_VIDEO_DEV is not set
823# CONFIG_DVB_CORE is not set 832# CONFIG_DVB_CORE is not set
833# CONFIG_VIDEO_MEDIA is not set
834
835#
836# Multimedia drivers
837#
824# CONFIG_DAB is not set 838# CONFIG_DAB is not set
825 839
826# 840#
@@ -854,14 +868,11 @@ CONFIG_DUMMY_CONSOLE=y
854# CONFIG_MMC is not set 868# CONFIG_MMC is not set
855# CONFIG_MEMSTICK is not set 869# CONFIG_MEMSTICK is not set
856# CONFIG_NEW_LEDS is not set 870# CONFIG_NEW_LEDS is not set
871# CONFIG_ACCESSIBILITY is not set
857# CONFIG_INFINIBAND is not set 872# CONFIG_INFINIBAND is not set
858# CONFIG_EDAC is not set 873# CONFIG_EDAC is not set
859# CONFIG_RTC_CLASS is not set 874# CONFIG_RTC_CLASS is not set
860# CONFIG_DMADEVICES is not set 875# CONFIG_DMADEVICES is not set
861
862#
863# Userspace I/O
864#
865# CONFIG_UIO is not set 876# CONFIG_UIO is not set
866 877
867# 878#
@@ -895,9 +906,9 @@ CONFIG_JFS_SECURITY=y
895CONFIG_FS_POSIX_ACL=y 906CONFIG_FS_POSIX_ACL=y
896CONFIG_XFS_FS=m 907CONFIG_XFS_FS=m
897# CONFIG_XFS_QUOTA is not set 908# CONFIG_XFS_QUOTA is not set
898CONFIG_XFS_SECURITY=y
899CONFIG_XFS_POSIX_ACL=y 909CONFIG_XFS_POSIX_ACL=y
900# CONFIG_XFS_RT is not set 910# CONFIG_XFS_RT is not set
911# CONFIG_XFS_DEBUG is not set
901CONFIG_GFS2_FS=m 912CONFIG_GFS2_FS=m
902CONFIG_GFS2_FS_LOCKING_NOLOCK=m 913CONFIG_GFS2_FS_LOCKING_NOLOCK=m
903CONFIG_GFS2_FS_LOCKING_DLM=m 914CONFIG_GFS2_FS_LOCKING_DLM=m
@@ -966,13 +977,11 @@ CONFIG_NFS_FS=y
966CONFIG_NFS_V3=y 977CONFIG_NFS_V3=y
967CONFIG_NFS_V3_ACL=y 978CONFIG_NFS_V3_ACL=y
968CONFIG_NFS_V4=y 979CONFIG_NFS_V4=y
969# CONFIG_NFS_DIRECTIO is not set
970CONFIG_NFSD=m 980CONFIG_NFSD=m
971CONFIG_NFSD_V2_ACL=y 981CONFIG_NFSD_V2_ACL=y
972CONFIG_NFSD_V3=y 982CONFIG_NFSD_V3=y
973CONFIG_NFSD_V3_ACL=y 983CONFIG_NFSD_V3_ACL=y
974CONFIG_NFSD_V4=y 984CONFIG_NFSD_V4=y
975CONFIG_NFSD_TCP=y
976CONFIG_LOCKD=y 985CONFIG_LOCKD=y
977CONFIG_LOCKD_V4=y 986CONFIG_LOCKD_V4=y
978CONFIG_EXPORTFS=m 987CONFIG_EXPORTFS=m
@@ -1047,9 +1056,10 @@ CONFIG_DLM=m
1047# Library routines 1056# Library routines
1048# 1057#
1049CONFIG_BITREVERSE=y 1058CONFIG_BITREVERSE=y
1059# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1050CONFIG_CRC_CCITT=m 1060CONFIG_CRC_CCITT=m
1051# CONFIG_CRC16 is not set 1061# CONFIG_CRC16 is not set
1052# CONFIG_CRC_ITU_T is not set 1062CONFIG_CRC_ITU_T=m
1053CONFIG_CRC32=y 1063CONFIG_CRC32=y
1054# CONFIG_CRC7 is not set 1064# CONFIG_CRC7 is not set
1055CONFIG_LIBCRC32C=m 1065CONFIG_LIBCRC32C=m
@@ -1071,6 +1081,7 @@ CONFIG_HAVE_LMB=y
1071# CONFIG_PRINTK_TIME is not set 1081# CONFIG_PRINTK_TIME is not set
1072CONFIG_ENABLE_WARN_DEPRECATED=y 1082CONFIG_ENABLE_WARN_DEPRECATED=y
1073CONFIG_ENABLE_MUST_CHECK=y 1083CONFIG_ENABLE_MUST_CHECK=y
1084CONFIG_FRAME_WARN=2048
1074CONFIG_MAGIC_SYSRQ=y 1085CONFIG_MAGIC_SYSRQ=y
1075# CONFIG_UNUSED_SYMBOLS is not set 1086# CONFIG_UNUSED_SYMBOLS is not set
1076CONFIG_DEBUG_FS=y 1087CONFIG_DEBUG_FS=y
@@ -1081,18 +1092,23 @@ CONFIG_DETECT_SOFTLOCKUP=y
1081CONFIG_SCHED_DEBUG=y 1092CONFIG_SCHED_DEBUG=y
1082# CONFIG_SCHEDSTATS is not set 1093# CONFIG_SCHEDSTATS is not set
1083# CONFIG_TIMER_STATS is not set 1094# CONFIG_TIMER_STATS is not set
1095# CONFIG_DEBUG_OBJECTS is not set
1084# CONFIG_SLUB_DEBUG_ON is not set 1096# CONFIG_SLUB_DEBUG_ON is not set
1085# CONFIG_SLUB_STATS is not set 1097# CONFIG_SLUB_STATS is not set
1086# CONFIG_DEBUG_RT_MUTEXES is not set 1098# CONFIG_DEBUG_RT_MUTEXES is not set
1087# CONFIG_RT_MUTEX_TESTER is not set 1099# CONFIG_RT_MUTEX_TESTER is not set
1088# CONFIG_DEBUG_SPINLOCK is not set 1100# CONFIG_DEBUG_SPINLOCK is not set
1089# CONFIG_DEBUG_MUTEXES is not set 1101# CONFIG_DEBUG_MUTEXES is not set
1102# CONFIG_DEBUG_LOCK_ALLOC is not set
1103# CONFIG_PROVE_LOCKING is not set
1104# CONFIG_LOCK_STAT is not set
1090# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1105# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1091# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1106# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1092# CONFIG_DEBUG_KOBJECT is not set 1107# CONFIG_DEBUG_KOBJECT is not set
1093CONFIG_DEBUG_BUGVERBOSE=y 1108CONFIG_DEBUG_BUGVERBOSE=y
1094# CONFIG_DEBUG_INFO is not set 1109# CONFIG_DEBUG_INFO is not set
1095# CONFIG_DEBUG_VM is not set 1110# CONFIG_DEBUG_VM is not set
1111# CONFIG_DEBUG_WRITECOUNT is not set
1096# CONFIG_DEBUG_LIST is not set 1112# CONFIG_DEBUG_LIST is not set
1097# CONFIG_DEBUG_SG is not set 1113# CONFIG_DEBUG_SG is not set
1098# CONFIG_BOOT_PRINTK_DELAY is not set 1114# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1116,53 +1132,83 @@ CONFIG_IRQSTACKS=y
1116# CONFIG_SECURITY is not set 1132# CONFIG_SECURITY is not set
1117# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1133# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1118CONFIG_CRYPTO=y 1134CONFIG_CRYPTO=y
1135
1136#
1137# Crypto core or helper
1138#
1119CONFIG_CRYPTO_ALGAPI=y 1139CONFIG_CRYPTO_ALGAPI=y
1120CONFIG_CRYPTO_AEAD=m 1140CONFIG_CRYPTO_AEAD=m
1121CONFIG_CRYPTO_BLKCIPHER=y 1141CONFIG_CRYPTO_BLKCIPHER=y
1122# CONFIG_CRYPTO_SEQIV is not set
1123CONFIG_CRYPTO_HASH=y 1142CONFIG_CRYPTO_HASH=y
1124CONFIG_CRYPTO_MANAGER=y 1143CONFIG_CRYPTO_MANAGER=y
1144# CONFIG_CRYPTO_GF128MUL is not set
1145CONFIG_CRYPTO_NULL=m
1146# CONFIG_CRYPTO_CRYPTD is not set
1147CONFIG_CRYPTO_AUTHENC=m
1148CONFIG_CRYPTO_TEST=m
1149
1150#
1151# Authenticated Encryption with Associated Data
1152#
1153# CONFIG_CRYPTO_CCM is not set
1154# CONFIG_CRYPTO_GCM is not set
1155# CONFIG_CRYPTO_SEQIV is not set
1156
1157#
1158# Block modes
1159#
1160CONFIG_CRYPTO_CBC=y
1161# CONFIG_CRYPTO_CTR is not set
1162# CONFIG_CRYPTO_CTS is not set
1163CONFIG_CRYPTO_ECB=m
1164# CONFIG_CRYPTO_LRW is not set
1165CONFIG_CRYPTO_PCBC=m
1166# CONFIG_CRYPTO_XTS is not set
1167
1168#
1169# Hash modes
1170#
1125CONFIG_CRYPTO_HMAC=y 1171CONFIG_CRYPTO_HMAC=y
1126# CONFIG_CRYPTO_XCBC is not set 1172# CONFIG_CRYPTO_XCBC is not set
1127CONFIG_CRYPTO_NULL=m 1173
1174#
1175# Digest
1176#
1177CONFIG_CRYPTO_CRC32C=m
1128CONFIG_CRYPTO_MD4=m 1178CONFIG_CRYPTO_MD4=m
1129CONFIG_CRYPTO_MD5=y 1179CONFIG_CRYPTO_MD5=y
1180CONFIG_CRYPTO_MICHAEL_MIC=m
1130CONFIG_CRYPTO_SHA1=m 1181CONFIG_CRYPTO_SHA1=m
1131CONFIG_CRYPTO_SHA256=m 1182CONFIG_CRYPTO_SHA256=m
1132CONFIG_CRYPTO_SHA512=m 1183CONFIG_CRYPTO_SHA512=m
1133CONFIG_CRYPTO_WP512=m
1134CONFIG_CRYPTO_TGR192=m 1184CONFIG_CRYPTO_TGR192=m
1135# CONFIG_CRYPTO_GF128MUL is not set 1185CONFIG_CRYPTO_WP512=m
1136CONFIG_CRYPTO_ECB=m 1186
1137CONFIG_CRYPTO_CBC=y 1187#
1138CONFIG_CRYPTO_PCBC=m 1188# Ciphers
1139# CONFIG_CRYPTO_LRW is not set 1189#
1140# CONFIG_CRYPTO_XTS is not set
1141# CONFIG_CRYPTO_CTR is not set
1142# CONFIG_CRYPTO_GCM is not set
1143# CONFIG_CRYPTO_CCM is not set
1144# CONFIG_CRYPTO_CRYPTD is not set
1145CONFIG_CRYPTO_DES=y
1146# CONFIG_CRYPTO_FCRYPT is not set
1147CONFIG_CRYPTO_BLOWFISH=m
1148CONFIG_CRYPTO_TWOFISH=m
1149CONFIG_CRYPTO_TWOFISH_COMMON=m
1150CONFIG_CRYPTO_SERPENT=m
1151CONFIG_CRYPTO_AES=m 1190CONFIG_CRYPTO_AES=m
1191CONFIG_CRYPTO_ANUBIS=m
1192CONFIG_CRYPTO_ARC4=m
1193CONFIG_CRYPTO_BLOWFISH=m
1194# CONFIG_CRYPTO_CAMELLIA is not set
1152CONFIG_CRYPTO_CAST5=m 1195CONFIG_CRYPTO_CAST5=m
1153CONFIG_CRYPTO_CAST6=m 1196CONFIG_CRYPTO_CAST6=m
1154CONFIG_CRYPTO_TEA=m 1197CONFIG_CRYPTO_DES=y
1155CONFIG_CRYPTO_ARC4=m 1198# CONFIG_CRYPTO_FCRYPT is not set
1156CONFIG_CRYPTO_KHAZAD=m 1199CONFIG_CRYPTO_KHAZAD=m
1157CONFIG_CRYPTO_ANUBIS=m
1158CONFIG_CRYPTO_SEED=m
1159# CONFIG_CRYPTO_SALSA20 is not set 1200# CONFIG_CRYPTO_SALSA20 is not set
1201CONFIG_CRYPTO_SEED=m
1202CONFIG_CRYPTO_SERPENT=m
1203CONFIG_CRYPTO_TEA=m
1204CONFIG_CRYPTO_TWOFISH=m
1205CONFIG_CRYPTO_TWOFISH_COMMON=m
1206
1207#
1208# Compression
1209#
1160CONFIG_CRYPTO_DEFLATE=m 1210CONFIG_CRYPTO_DEFLATE=m
1161CONFIG_CRYPTO_MICHAEL_MIC=m
1162CONFIG_CRYPTO_CRC32C=m
1163# CONFIG_CRYPTO_CAMELLIA is not set
1164CONFIG_CRYPTO_TEST=m
1165CONFIG_CRYPTO_AUTHENC=m
1166# CONFIG_CRYPTO_LZO is not set 1211# CONFIG_CRYPTO_LZO is not set
1167# CONFIG_CRYPTO_HW is not set 1212# CONFIG_CRYPTO_HW is not set
1168# CONFIG_PPC_CLOCK is not set 1213# CONFIG_PPC_CLOCK is not set
1214# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/mpc8610_hpcd_defconfig b/arch/powerpc/configs/mpc8610_hpcd_defconfig
index 9270afe7594d..7e5b9ce58d89 100644
--- a/arch/powerpc/configs/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/mpc8610_hpcd_defconfig
@@ -358,7 +358,93 @@ CONFIG_FW_LOADER=y
358# CONFIG_DEBUG_DEVRES is not set 358# CONFIG_DEBUG_DEVRES is not set
359# CONFIG_SYS_HYPERVISOR is not set 359# CONFIG_SYS_HYPERVISOR is not set
360# CONFIG_CONNECTOR is not set 360# CONFIG_CONNECTOR is not set
361# CONFIG_MTD is not set 361CONFIG_MTD=y
362# CONFIG_MTD_DEBUG is not set
363# CONFIG_MTD_CONCAT is not set
364CONFIG_MTD_PARTITIONS=y
365# CONFIG_MTD_REDBOOT_PARTS is not set
366CONFIG_MTD_CMDLINE_PARTS=y
367# CONFIG_MTD_OF_PARTS is not set
368# CONFIG_MTD_AR7_PARTS is not set
369
370#
371# User Modules And Translation Layers
372#
373CONFIG_MTD_CHAR=y
374CONFIG_MTD_BLKDEVS=y
375CONFIG_MTD_BLOCK=y
376# CONFIG_FTL is not set
377# CONFIG_NFTL is not set
378# CONFIG_INFTL is not set
379# CONFIG_RFD_FTL is not set
380# CONFIG_SSFDC is not set
381# CONFIG_MTD_OOPS is not set
382
383#
384# RAM/ROM/Flash chip drivers
385#
386CONFIG_MTD_CFI=y
387# CONFIG_MTD_JEDECPROBE is not set
388CONFIG_MTD_GEN_PROBE=y
389# CONFIG_MTD_CFI_ADV_OPTIONS is not set
390CONFIG_MTD_MAP_BANK_WIDTH_1=y
391CONFIG_MTD_MAP_BANK_WIDTH_2=y
392CONFIG_MTD_MAP_BANK_WIDTH_4=y
393# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
394# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
395# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
396CONFIG_MTD_CFI_I1=y
397CONFIG_MTD_CFI_I2=y
398# CONFIG_MTD_CFI_I4 is not set
399# CONFIG_MTD_CFI_I8 is not set
400# CONFIG_MTD_CFI_INTELEXT is not set
401CONFIG_MTD_CFI_AMDSTD=y
402# CONFIG_MTD_CFI_STAA is not set
403CONFIG_MTD_CFI_UTIL=y
404# CONFIG_MTD_RAM is not set
405# CONFIG_MTD_ROM is not set
406# CONFIG_MTD_ABSENT is not set
407
408#
409# Mapping drivers for chip access
410#
411# CONFIG_MTD_COMPLEX_MAPPINGS is not set
412# CONFIG_MTD_PHYSMAP is not set
413CONFIG_MTD_PHYSMAP_OF=y
414# CONFIG_MTD_INTEL_VR_NOR is not set
415# CONFIG_MTD_PLATRAM is not set
416
417#
418# Self-contained MTD device drivers
419#
420# CONFIG_MTD_PMC551 is not set
421# CONFIG_MTD_SLRAM is not set
422# CONFIG_MTD_PHRAM is not set
423# CONFIG_MTD_MTDRAM is not set
424# CONFIG_MTD_BLOCK2MTD is not set
425
426#
427# Disk-On-Chip Device Drivers
428#
429# CONFIG_MTD_DOC2000 is not set
430# CONFIG_MTD_DOC2001 is not set
431# CONFIG_MTD_DOC2001PLUS is not set
432CONFIG_MTD_NAND=y
433# CONFIG_MTD_NAND_VERIFY_WRITE is not set
434# CONFIG_MTD_NAND_ECC_SMC is not set
435# CONFIG_MTD_NAND_MUSEUM_IDS is not set
436CONFIG_MTD_NAND_IDS=y
437# CONFIG_MTD_NAND_DISKONCHIP is not set
438# CONFIG_MTD_NAND_CAFE is not set
439# CONFIG_MTD_NAND_NANDSIM is not set
440# CONFIG_MTD_NAND_PLATFORM is not set
441CONFIG_MTD_NAND_FSL_ELBC=y
442# CONFIG_MTD_ONENAND is not set
443
444#
445# UBI - Unsorted block images
446#
447# CONFIG_MTD_UBI is not set
362CONFIG_OF_DEVICE=y 448CONFIG_OF_DEVICE=y
363# CONFIG_PARPORT is not set 449# CONFIG_PARPORT is not set
364CONFIG_BLK_DEV=y 450CONFIG_BLK_DEV=y
@@ -567,14 +653,11 @@ CONFIG_MII=y
567# CONFIG_NET_VENDOR_3COM is not set 653# CONFIG_NET_VENDOR_3COM is not set
568CONFIG_NET_TULIP=y 654CONFIG_NET_TULIP=y
569# CONFIG_DE2104X is not set 655# CONFIG_DE2104X is not set
570CONFIG_TULIP=y 656# CONFIG_TULIP is not set
571# CONFIG_TULIP_MWI is not set
572CONFIG_TULIP_MMIO=y
573# CONFIG_TULIP_NAPI is not set
574# CONFIG_DE4X5 is not set 657# CONFIG_DE4X5 is not set
575# CONFIG_WINBOND_840 is not set 658# CONFIG_WINBOND_840 is not set
576# CONFIG_DM9102 is not set 659# CONFIG_DM9102 is not set
577# CONFIG_ULI526X is not set 660CONFIG_ULI526X=y
578# CONFIG_HP100 is not set 661# CONFIG_HP100 is not set
579# CONFIG_IBM_NEW_EMAC_ZMII is not set 662# CONFIG_IBM_NEW_EMAC_ZMII is not set
580# CONFIG_IBM_NEW_EMAC_RGMII is not set 663# CONFIG_IBM_NEW_EMAC_RGMII is not set
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
index 09f306248f2e..199e5f59d7a6 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Tue Mar 25 10:25:48 2008 4# Tue May 27 16:08:06 2008
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -29,6 +29,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
29CONFIG_GENERIC_HARDIRQS=y 29CONFIG_GENERIC_HARDIRQS=y
30CONFIG_HAVE_SETUP_PER_CPU_AREA=y 30CONFIG_HAVE_SETUP_PER_CPU_AREA=y
31CONFIG_IRQ_PER_CPU=y 31CONFIG_IRQ_PER_CPU=y
32CONFIG_STACKTRACE_SUPPORT=y
33CONFIG_TRACE_IRQFLAGS_SUPPORT=y
34CONFIG_LOCKDEP_SUPPORT=y
32CONFIG_RWSEM_XCHGADD_ALGORITHM=y 35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
33CONFIG_ARCH_HAS_ILOG2_U32=y 36CONFIG_ARCH_HAS_ILOG2_U32=y
34CONFIG_ARCH_HAS_ILOG2_U64=y 37CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -87,6 +90,7 @@ CONFIG_INITRAMFS_SOURCE=""
87CONFIG_SYSCTL=y 90CONFIG_SYSCTL=y
88# CONFIG_EMBEDDED is not set 91# CONFIG_EMBEDDED is not set
89CONFIG_SYSCTL_SYSCALL=y 92CONFIG_SYSCTL_SYSCALL=y
93CONFIG_SYSCTL_SYSCALL_CHECK=y
90CONFIG_KALLSYMS=y 94CONFIG_KALLSYMS=y
91# CONFIG_KALLSYMS_ALL is not set 95# CONFIG_KALLSYMS_ALL is not set
92# CONFIG_KALLSYMS_EXTRA_PASS is not set 96# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -115,12 +119,14 @@ CONFIG_HAVE_OPROFILE=y
115# CONFIG_KPROBES is not set 119# CONFIG_KPROBES is not set
116CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
122# CONFIG_HAVE_DMA_ATTRS is not set
118CONFIG_PROC_PAGE_MONITOR=y 123CONFIG_PROC_PAGE_MONITOR=y
119CONFIG_SLABINFO=y 124CONFIG_SLABINFO=y
120CONFIG_RT_MUTEXES=y 125CONFIG_RT_MUTEXES=y
121# CONFIG_TINY_SHMEM is not set 126# CONFIG_TINY_SHMEM is not set
122CONFIG_BASE_SMALL=0 127CONFIG_BASE_SMALL=0
123CONFIG_MODULES=y 128CONFIG_MODULES=y
129# CONFIG_MODULE_FORCE_LOAD is not set
124CONFIG_MODULE_UNLOAD=y 130CONFIG_MODULE_UNLOAD=y
125# CONFIG_MODULE_FORCE_UNLOAD is not set 131# CONFIG_MODULE_FORCE_UNLOAD is not set
126# CONFIG_MODVERSIONS is not set 132# CONFIG_MODVERSIONS is not set
@@ -167,11 +173,11 @@ CONFIG_PPC_PASEMI=y
167CONFIG_PPC_PASEMI_IOMMU=y 173CONFIG_PPC_PASEMI_IOMMU=y
168# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set 174# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
169CONFIG_PPC_PASEMI_MDIO=y 175CONFIG_PPC_PASEMI_MDIO=y
170# CONFIG_PPC_CELLEB is not set
171# CONFIG_PPC_PS3 is not set 176# CONFIG_PPC_PS3 is not set
172# CONFIG_PPC_CELL is not set 177# CONFIG_PPC_CELL is not set
173# CONFIG_PPC_CELL_NATIVE is not set 178# CONFIG_PPC_CELL_NATIVE is not set
174# CONFIG_PPC_IBM_CELL_BLADE is not set 179# CONFIG_PPC_IBM_CELL_BLADE is not set
180# CONFIG_PPC_CELLEB is not set
175# CONFIG_PQ2ADS is not set 181# CONFIG_PQ2ADS is not set
176CONFIG_PPC_NATIVE=y 182CONFIG_PPC_NATIVE=y
177# CONFIG_IPIC is not set 183# CONFIG_IPIC is not set
@@ -192,6 +198,7 @@ CONFIG_CPU_FREQ_DEBUG=y
192CONFIG_CPU_FREQ_STAT=y 198CONFIG_CPU_FREQ_STAT=y
193# CONFIG_CPU_FREQ_STAT_DETAILS is not set 199# CONFIG_CPU_FREQ_STAT_DETAILS is not set
194CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 200CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
201# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
195# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 202# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
196# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 203# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
197# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 204# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
@@ -226,7 +233,6 @@ CONFIG_PREEMPT_NONE=y
226CONFIG_BINFMT_ELF=y 233CONFIG_BINFMT_ELF=y
227CONFIG_COMPAT_BINFMT_ELF=y 234CONFIG_COMPAT_BINFMT_ELF=y
228# CONFIG_BINFMT_MISC is not set 235# CONFIG_BINFMT_MISC is not set
229CONFIG_FORCE_MAX_ZONEORDER=9
230CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y 236CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
231CONFIG_IOMMU_VMERGE=y 237CONFIG_IOMMU_VMERGE=y
232CONFIG_IOMMU_HELPER=y 238CONFIG_IOMMU_HELPER=y
@@ -249,12 +255,14 @@ CONFIG_FLATMEM=y
249CONFIG_FLAT_NODE_MEM_MAP=y 255CONFIG_FLAT_NODE_MEM_MAP=y
250# CONFIG_SPARSEMEM_STATIC is not set 256# CONFIG_SPARSEMEM_STATIC is not set
251CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 257CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
258CONFIG_PAGEFLAGS_EXTENDED=y
252CONFIG_SPLIT_PTLOCK_CPUS=4 259CONFIG_SPLIT_PTLOCK_CPUS=4
253CONFIG_RESOURCES_64BIT=y 260CONFIG_RESOURCES_64BIT=y
254CONFIG_ZONE_DMA_FLAG=1 261CONFIG_ZONE_DMA_FLAG=1
255CONFIG_BOUNCE=y 262CONFIG_BOUNCE=y
256CONFIG_PPC_HAS_HASH_64K=y 263CONFIG_PPC_HAS_HASH_64K=y
257CONFIG_PPC_64K_PAGES=y 264CONFIG_PPC_64K_PAGES=y
265CONFIG_FORCE_MAX_ZONEORDER=9
258# CONFIG_PPC_SUBPAGE_PROT is not set 266# CONFIG_PPC_SUBPAGE_PROT is not set
259# CONFIG_SCHED_SMT is not set 267# CONFIG_SCHED_SMT is not set
260CONFIG_PROC_DEVICETREE=y 268CONFIG_PROC_DEVICETREE=y
@@ -290,9 +298,12 @@ CONFIG_CARDBUS=y
290# CONFIG_YENTA is not set 298# CONFIG_YENTA is not set
291# CONFIG_PD6729 is not set 299# CONFIG_PD6729 is not set
292# CONFIG_I82092 is not set 300# CONFIG_I82092 is not set
293# CONFIG_ELECTRA_CF is not set 301CONFIG_ELECTRA_CF=y
294# CONFIG_HOTPLUG_PCI is not set 302# CONFIG_HOTPLUG_PCI is not set
303# CONFIG_HAS_RAPIDIO is not set
304CONFIG_PAGE_OFFSET=0xc000000000000000
295CONFIG_KERNEL_START=0xc000000000000000 305CONFIG_KERNEL_START=0xc000000000000000
306CONFIG_PHYSICAL_START=0x00000000
296 307
297# 308#
298# Networking 309# Networking
@@ -341,8 +352,6 @@ CONFIG_TCP_CONG_CUBIC=y
341CONFIG_DEFAULT_TCP_CONG="cubic" 352CONFIG_DEFAULT_TCP_CONG="cubic"
342# CONFIG_TCP_MD5SIG is not set 353# CONFIG_TCP_MD5SIG is not set
343# CONFIG_IPV6 is not set 354# CONFIG_IPV6 is not set
344# CONFIG_INET6_XFRM_TUNNEL is not set
345# CONFIG_INET6_TUNNEL is not set
346# CONFIG_NETWORK_SECMARK is not set 355# CONFIG_NETWORK_SECMARK is not set
347# CONFIG_NETFILTER is not set 356# CONFIG_NETFILTER is not set
348# CONFIG_IP_DCCP is not set 357# CONFIG_IP_DCCP is not set
@@ -473,6 +482,7 @@ CONFIG_MTD_NAND_PASEMI=y
473# 482#
474# CONFIG_MTD_UBI is not set 483# CONFIG_MTD_UBI is not set
475CONFIG_OF_DEVICE=y 484CONFIG_OF_DEVICE=y
485CONFIG_OF_I2C=y
476# CONFIG_PARPORT is not set 486# CONFIG_PARPORT is not set
477CONFIG_BLK_DEV=y 487CONFIG_BLK_DEV=y
478# CONFIG_BLK_DEV_FD is not set 488# CONFIG_BLK_DEV_FD is not set
@@ -520,7 +530,6 @@ CONFIG_IDE_PROC_FS=y
520# 530#
521# IDE chipset support/bugfixes 531# IDE chipset support/bugfixes
522# 532#
523# CONFIG_IDE_GENERIC is not set
524# CONFIG_BLK_DEV_PLATFORM is not set 533# CONFIG_BLK_DEV_PLATFORM is not set
525 534
526# 535#
@@ -554,7 +563,7 @@ CONFIG_IDE_PROC_FS=y
554# CONFIG_BLK_DEV_VIA82CXXX is not set 563# CONFIG_BLK_DEV_VIA82CXXX is not set
555# CONFIG_BLK_DEV_TC86C001 is not set 564# CONFIG_BLK_DEV_TC86C001 is not set
556# CONFIG_BLK_DEV_IDEDMA is not set 565# CONFIG_BLK_DEV_IDEDMA is not set
557CONFIG_IDE_ARCH_OBSOLETE_INIT=y 566# CONFIG_BLK_DEV_HD_ONLY is not set
558# CONFIG_BLK_DEV_HD is not set 567# CONFIG_BLK_DEV_HD is not set
559 568
560# 569#
@@ -632,7 +641,10 @@ CONFIG_SCSI_LOWLEVEL=y
632# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 641# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
633CONFIG_ATA=y 642CONFIG_ATA=y
634# CONFIG_ATA_NONSTANDARD is not set 643# CONFIG_ATA_NONSTANDARD is not set
644CONFIG_SATA_PMP=y
635# CONFIG_SATA_AHCI is not set 645# CONFIG_SATA_AHCI is not set
646CONFIG_SATA_SIL24=y
647CONFIG_ATA_SFF=y
636# CONFIG_SATA_SVW is not set 648# CONFIG_SATA_SVW is not set
637# CONFIG_ATA_PIIX is not set 649# CONFIG_ATA_PIIX is not set
638CONFIG_SATA_MV=y 650CONFIG_SATA_MV=y
@@ -642,7 +654,6 @@ CONFIG_SATA_MV=y
642# CONFIG_SATA_PROMISE is not set 654# CONFIG_SATA_PROMISE is not set
643# CONFIG_SATA_SX4 is not set 655# CONFIG_SATA_SX4 is not set
644# CONFIG_SATA_SIL is not set 656# CONFIG_SATA_SIL is not set
645CONFIG_SATA_SIL24=y
646# CONFIG_SATA_SIS is not set 657# CONFIG_SATA_SIS is not set
647# CONFIG_SATA_ULI is not set 658# CONFIG_SATA_ULI is not set
648# CONFIG_SATA_VIA is not set 659# CONFIG_SATA_VIA is not set
@@ -689,6 +700,7 @@ CONFIG_PATA_PCMCIA=y
689# CONFIG_PATA_WINBOND is not set 700# CONFIG_PATA_WINBOND is not set
690CONFIG_PATA_PLATFORM=y 701CONFIG_PATA_PLATFORM=y
691CONFIG_PATA_OF_PLATFORM=y 702CONFIG_PATA_OF_PLATFORM=y
703# CONFIG_PATA_SCH is not set
692CONFIG_MD=y 704CONFIG_MD=y
693CONFIG_BLK_DEV_MD=y 705CONFIG_BLK_DEV_MD=y
694CONFIG_MD_LINEAR=y 706CONFIG_MD_LINEAR=y
@@ -791,7 +803,6 @@ CONFIG_E1000_NAPI=y
791# CONFIG_SIS190 is not set 803# CONFIG_SIS190 is not set
792# CONFIG_SKGE is not set 804# CONFIG_SKGE is not set
793# CONFIG_SKY2 is not set 805# CONFIG_SKY2 is not set
794# CONFIG_SK98LIN is not set
795# CONFIG_VIA_VELOCITY is not set 806# CONFIG_VIA_VELOCITY is not set
796CONFIG_TIGON3=y 807CONFIG_TIGON3=y
797# CONFIG_BNX2 is not set 808# CONFIG_BNX2 is not set
@@ -810,6 +821,7 @@ CONFIG_PASEMI_MAC=y
810# CONFIG_MLX4_CORE is not set 821# CONFIG_MLX4_CORE is not set
811# CONFIG_TEHUTI is not set 822# CONFIG_TEHUTI is not set
812# CONFIG_BNX2X is not set 823# CONFIG_BNX2X is not set
824# CONFIG_SFC is not set
813# CONFIG_TR is not set 825# CONFIG_TR is not set
814 826
815# 827#
@@ -817,6 +829,7 @@ CONFIG_PASEMI_MAC=y
817# 829#
818# CONFIG_WLAN_PRE80211 is not set 830# CONFIG_WLAN_PRE80211 is not set
819# CONFIG_WLAN_80211 is not set 831# CONFIG_WLAN_80211 is not set
832# CONFIG_IWLWIFI_LEDS is not set
820 833
821# 834#
822# USB Network Adapters 835# USB Network Adapters
@@ -890,6 +903,7 @@ CONFIG_VT=y
890CONFIG_VT_CONSOLE=y 903CONFIG_VT_CONSOLE=y
891CONFIG_HW_CONSOLE=y 904CONFIG_HW_CONSOLE=y
892# CONFIG_VT_HW_CONSOLE_BINDING is not set 905# CONFIG_VT_HW_CONSOLE_BINDING is not set
906CONFIG_DEVKMEM=y
893# CONFIG_SERIAL_NONSTANDARD is not set 907# CONFIG_SERIAL_NONSTANDARD is not set
894# CONFIG_NOZOMI is not set 908# CONFIG_NOZOMI is not set
895 909
@@ -917,7 +931,6 @@ CONFIG_LEGACY_PTY_COUNT=4
917# CONFIG_IPMI_HANDLER is not set 931# CONFIG_IPMI_HANDLER is not set
918CONFIG_HW_RANDOM=y 932CONFIG_HW_RANDOM=y
919CONFIG_HW_RANDOM_PASEMI=y 933CONFIG_HW_RANDOM_PASEMI=y
920# CONFIG_GEN_RTC is not set
921# CONFIG_R3964 is not set 934# CONFIG_R3964 is not set
922# CONFIG_APPLICOM is not set 935# CONFIG_APPLICOM is not set
923 936
@@ -936,13 +949,7 @@ CONFIG_DEVPORT=y
936CONFIG_I2C=y 949CONFIG_I2C=y
937CONFIG_I2C_BOARDINFO=y 950CONFIG_I2C_BOARDINFO=y
938CONFIG_I2C_CHARDEV=y 951CONFIG_I2C_CHARDEV=y
939
940#
941# I2C Algorithms
942#
943CONFIG_I2C_ALGOBIT=y 952CONFIG_I2C_ALGOBIT=y
944CONFIG_I2C_ALGOPCF=y
945CONFIG_I2C_ALGOPCA=y
946 953
947# 954#
948# I2C Hardware Bus support 955# I2C Hardware Bus support
@@ -971,6 +978,7 @@ CONFIG_I2C_PASEMI=y
971# CONFIG_I2C_VIA is not set 978# CONFIG_I2C_VIA is not set
972# CONFIG_I2C_VIAPRO is not set 979# CONFIG_I2C_VIAPRO is not set
973# CONFIG_I2C_VOODOO3 is not set 980# CONFIG_I2C_VOODOO3 is not set
981# CONFIG_I2C_PCA_PLATFORM is not set
974 982
975# 983#
976# Miscellaneous I2C Chip support 984# Miscellaneous I2C Chip support
@@ -980,19 +988,13 @@ CONFIG_SENSORS_EEPROM=y
980# CONFIG_SENSORS_PCF8574 is not set 988# CONFIG_SENSORS_PCF8574 is not set
981# CONFIG_PCF8575 is not set 989# CONFIG_PCF8575 is not set
982# CONFIG_SENSORS_PCF8591 is not set 990# CONFIG_SENSORS_PCF8591 is not set
983# CONFIG_TPS65010 is not set
984# CONFIG_SENSORS_MAX6875 is not set 991# CONFIG_SENSORS_MAX6875 is not set
985# CONFIG_SENSORS_TSL2550 is not set 992# CONFIG_SENSORS_TSL2550 is not set
986# CONFIG_I2C_DEBUG_CORE is not set 993# CONFIG_I2C_DEBUG_CORE is not set
987# CONFIG_I2C_DEBUG_ALGO is not set 994# CONFIG_I2C_DEBUG_ALGO is not set
988# CONFIG_I2C_DEBUG_BUS is not set 995# CONFIG_I2C_DEBUG_BUS is not set
989# CONFIG_I2C_DEBUG_CHIP is not set 996# CONFIG_I2C_DEBUG_CHIP is not set
990
991#
992# SPI support
993#
994# CONFIG_SPI is not set 997# CONFIG_SPI is not set
995# CONFIG_SPI_MASTER is not set
996# CONFIG_W1 is not set 998# CONFIG_W1 is not set
997# CONFIG_POWER_SUPPLY is not set 999# CONFIG_POWER_SUPPLY is not set
998CONFIG_HWMON=y 1000CONFIG_HWMON=y
@@ -1062,12 +1064,22 @@ CONFIG_SSB_POSSIBLE=y
1062# Multifunction device drivers 1064# Multifunction device drivers
1063# 1065#
1064# CONFIG_MFD_SM501 is not set 1066# CONFIG_MFD_SM501 is not set
1067# CONFIG_HTC_PASIC3 is not set
1065 1068
1066# 1069#
1067# Multimedia devices 1070# Multimedia devices
1068# 1071#
1072
1073#
1074# Multimedia core support
1075#
1069# CONFIG_VIDEO_DEV is not set 1076# CONFIG_VIDEO_DEV is not set
1070# CONFIG_DVB_CORE is not set 1077# CONFIG_DVB_CORE is not set
1078# CONFIG_VIDEO_MEDIA is not set
1079
1080#
1081# Multimedia drivers
1082#
1071CONFIG_DAB=y 1083CONFIG_DAB=y
1072# CONFIG_USB_DABUSB is not set 1084# CONFIG_USB_DABUSB is not set
1073 1085
@@ -1094,8 +1106,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
1094# CONFIG_FB_SYS_FILLRECT is not set 1106# CONFIG_FB_SYS_FILLRECT is not set
1095# CONFIG_FB_SYS_COPYAREA is not set 1107# CONFIG_FB_SYS_COPYAREA is not set
1096# CONFIG_FB_SYS_IMAGEBLIT is not set 1108# CONFIG_FB_SYS_IMAGEBLIT is not set
1109# CONFIG_FB_FOREIGN_ENDIAN is not set
1097# CONFIG_FB_SYS_FOPS is not set 1110# CONFIG_FB_SYS_FOPS is not set
1098CONFIG_FB_DEFERRED_IO=y
1099# CONFIG_FB_SVGALIB is not set 1111# CONFIG_FB_SVGALIB is not set
1100CONFIG_FB_MACMODES=y 1112CONFIG_FB_MACMODES=y
1101CONFIG_FB_BACKLIGHT=y 1113CONFIG_FB_BACKLIGHT=y
@@ -1213,6 +1225,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
1213# CONFIG_SND_AU8810 is not set 1225# CONFIG_SND_AU8810 is not set
1214# CONFIG_SND_AU8820 is not set 1226# CONFIG_SND_AU8820 is not set
1215# CONFIG_SND_AU8830 is not set 1227# CONFIG_SND_AU8830 is not set
1228# CONFIG_SND_AW2 is not set
1216# CONFIG_SND_AZT3328 is not set 1229# CONFIG_SND_AZT3328 is not set
1217# CONFIG_SND_BT87X is not set 1230# CONFIG_SND_BT87X is not set
1218# CONFIG_SND_CA0106 is not set 1231# CONFIG_SND_CA0106 is not set
@@ -1292,11 +1305,11 @@ CONFIG_SND_USB_USX2Y=y
1292# CONFIG_SND_SOC is not set 1305# CONFIG_SND_SOC is not set
1293 1306
1294# 1307#
1295# SoC Audio support for SuperH 1308# ALSA SoC audio for Freescale SOCs
1296# 1309#
1297 1310
1298# 1311#
1299# ALSA SoC audio for Freescale SOCs 1312# SoC Audio for the Texas Instruments OMAP
1300# 1313#
1301 1314
1302# 1315#
@@ -1334,11 +1347,13 @@ CONFIG_USB_DEVICEFS=y
1334# 1347#
1335# USB Host Controller Drivers 1348# USB Host Controller Drivers
1336# 1349#
1350# CONFIG_USB_C67X00_HCD is not set
1337CONFIG_USB_EHCI_HCD=y 1351CONFIG_USB_EHCI_HCD=y
1338# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1352# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1339# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1353# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1340CONFIG_USB_EHCI_HCD_PPC_OF=y 1354CONFIG_USB_EHCI_HCD_PPC_OF=y
1341# CONFIG_USB_ISP116X_HCD is not set 1355# CONFIG_USB_ISP116X_HCD is not set
1356# CONFIG_USB_ISP1760_HCD is not set
1342CONFIG_USB_OHCI_HCD=y 1357CONFIG_USB_OHCI_HCD=y
1343# CONFIG_USB_OHCI_HCD_PPC_OF is not set 1358# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1344# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1359# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1354,6 +1369,7 @@ CONFIG_USB_SL811_HCD=y
1354# 1369#
1355# CONFIG_USB_ACM is not set 1370# CONFIG_USB_ACM is not set
1356# CONFIG_USB_PRINTER is not set 1371# CONFIG_USB_PRINTER is not set
1372# CONFIG_USB_WDM is not set
1357 1373
1358# 1374#
1359# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1375# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1375,6 +1391,7 @@ CONFIG_USB_STORAGE=y
1375# CONFIG_USB_STORAGE_ALAUDA is not set 1391# CONFIG_USB_STORAGE_ALAUDA is not set
1376# CONFIG_USB_STORAGE_ONETOUCH is not set 1392# CONFIG_USB_STORAGE_ONETOUCH is not set
1377# CONFIG_USB_STORAGE_KARMA is not set 1393# CONFIG_USB_STORAGE_KARMA is not set
1394# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1378CONFIG_USB_LIBUSUAL=y 1395CONFIG_USB_LIBUSUAL=y
1379 1396
1380# 1397#
@@ -1416,6 +1433,7 @@ CONFIG_USB_LIBUSUAL=y
1416# CONFIG_MMC is not set 1433# CONFIG_MMC is not set
1417# CONFIG_MEMSTICK is not set 1434# CONFIG_MEMSTICK is not set
1418# CONFIG_NEW_LEDS is not set 1435# CONFIG_NEW_LEDS is not set
1436# CONFIG_ACCESSIBILITY is not set
1419# CONFIG_INFINIBAND is not set 1437# CONFIG_INFINIBAND is not set
1420CONFIG_EDAC=y 1438CONFIG_EDAC=y
1421 1439
@@ -1475,10 +1493,6 @@ CONFIG_RTC_DRV_DS1307=y
1475# on-CPU RTC drivers 1493# on-CPU RTC drivers
1476# 1494#
1477# CONFIG_DMADEVICES is not set 1495# CONFIG_DMADEVICES is not set
1478
1479#
1480# Userspace I/O
1481#
1482# CONFIG_UIO is not set 1496# CONFIG_UIO is not set
1483 1497
1484# 1498#
@@ -1576,12 +1590,10 @@ CONFIG_NFS_FS=y
1576CONFIG_NFS_V3=y 1590CONFIG_NFS_V3=y
1577# CONFIG_NFS_V3_ACL is not set 1591# CONFIG_NFS_V3_ACL is not set
1578# CONFIG_NFS_V4 is not set 1592# CONFIG_NFS_V4 is not set
1579# CONFIG_NFS_DIRECTIO is not set
1580CONFIG_NFSD=y 1593CONFIG_NFSD=y
1581CONFIG_NFSD_V3=y 1594CONFIG_NFSD_V3=y
1582# CONFIG_NFSD_V3_ACL is not set 1595# CONFIG_NFSD_V3_ACL is not set
1583CONFIG_NFSD_V4=y 1596CONFIG_NFSD_V4=y
1584CONFIG_NFSD_TCP=y
1585CONFIG_ROOT_NFS=y 1597CONFIG_ROOT_NFS=y
1586CONFIG_LOCKD=y 1598CONFIG_LOCKD=y
1587CONFIG_LOCKD_V4=y 1599CONFIG_LOCKD_V4=y
@@ -1665,9 +1677,10 @@ CONFIG_NLS_ISO8859_1=y
1665# Library routines 1677# Library routines
1666# 1678#
1667CONFIG_BITREVERSE=y 1679CONFIG_BITREVERSE=y
1680# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1668CONFIG_CRC_CCITT=y 1681CONFIG_CRC_CCITT=y
1669# CONFIG_CRC16 is not set 1682# CONFIG_CRC16 is not set
1670# CONFIG_CRC_ITU_T is not set 1683CONFIG_CRC_ITU_T=y
1671CONFIG_CRC32=y 1684CONFIG_CRC32=y
1672# CONFIG_CRC7 is not set 1685# CONFIG_CRC7 is not set
1673CONFIG_LIBCRC32C=m 1686CONFIG_LIBCRC32C=m
@@ -1677,6 +1690,7 @@ CONFIG_PLIST=y
1677CONFIG_HAS_IOMEM=y 1690CONFIG_HAS_IOMEM=y
1678CONFIG_HAS_IOPORT=y 1691CONFIG_HAS_IOPORT=y
1679CONFIG_HAS_DMA=y 1692CONFIG_HAS_DMA=y
1693CONFIG_HAVE_LMB=y
1680 1694
1681# 1695#
1682# Kernel hacking 1696# Kernel hacking
@@ -1684,6 +1698,7 @@ CONFIG_HAS_DMA=y
1684# CONFIG_PRINTK_TIME is not set 1698# CONFIG_PRINTK_TIME is not set
1685CONFIG_ENABLE_WARN_DEPRECATED=y 1699CONFIG_ENABLE_WARN_DEPRECATED=y
1686CONFIG_ENABLE_MUST_CHECK=y 1700CONFIG_ENABLE_MUST_CHECK=y
1701CONFIG_FRAME_WARN=2048
1687CONFIG_MAGIC_SYSRQ=y 1702CONFIG_MAGIC_SYSRQ=y
1688# CONFIG_UNUSED_SYMBOLS is not set 1703# CONFIG_UNUSED_SYMBOLS is not set
1689# CONFIG_DEBUG_FS is not set 1704# CONFIG_DEBUG_FS is not set
@@ -1694,18 +1709,23 @@ CONFIG_DETECT_SOFTLOCKUP=y
1694# CONFIG_SCHED_DEBUG is not set 1709# CONFIG_SCHED_DEBUG is not set
1695# CONFIG_SCHEDSTATS is not set 1710# CONFIG_SCHEDSTATS is not set
1696# CONFIG_TIMER_STATS is not set 1711# CONFIG_TIMER_STATS is not set
1712# CONFIG_DEBUG_OBJECTS is not set
1697# CONFIG_SLUB_DEBUG_ON is not set 1713# CONFIG_SLUB_DEBUG_ON is not set
1698# CONFIG_SLUB_STATS is not set 1714# CONFIG_SLUB_STATS is not set
1699# CONFIG_DEBUG_RT_MUTEXES is not set 1715# CONFIG_DEBUG_RT_MUTEXES is not set
1700# CONFIG_RT_MUTEX_TESTER is not set 1716# CONFIG_RT_MUTEX_TESTER is not set
1701# CONFIG_DEBUG_SPINLOCK is not set 1717# CONFIG_DEBUG_SPINLOCK is not set
1702# CONFIG_DEBUG_MUTEXES is not set 1718# CONFIG_DEBUG_MUTEXES is not set
1719# CONFIG_DEBUG_LOCK_ALLOC is not set
1720# CONFIG_PROVE_LOCKING is not set
1721# CONFIG_LOCK_STAT is not set
1703# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1722# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1704# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1723# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1705# CONFIG_DEBUG_KOBJECT is not set 1724# CONFIG_DEBUG_KOBJECT is not set
1706CONFIG_DEBUG_BUGVERBOSE=y 1725CONFIG_DEBUG_BUGVERBOSE=y
1707# CONFIG_DEBUG_INFO is not set 1726# CONFIG_DEBUG_INFO is not set
1708# CONFIG_DEBUG_VM is not set 1727# CONFIG_DEBUG_VM is not set
1728# CONFIG_DEBUG_WRITECOUNT is not set
1709# CONFIG_DEBUG_LIST is not set 1729# CONFIG_DEBUG_LIST is not set
1710# CONFIG_DEBUG_SG is not set 1730# CONFIG_DEBUG_SG is not set
1711# CONFIG_BOOT_PRINTK_DELAY is not set 1731# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1735,53 +1755,83 @@ CONFIG_ASYNC_CORE=y
1735CONFIG_ASYNC_MEMCPY=y 1755CONFIG_ASYNC_MEMCPY=y
1736CONFIG_ASYNC_XOR=y 1756CONFIG_ASYNC_XOR=y
1737CONFIG_CRYPTO=y 1757CONFIG_CRYPTO=y
1758
1759#
1760# Crypto core or helper
1761#
1738CONFIG_CRYPTO_ALGAPI=y 1762CONFIG_CRYPTO_ALGAPI=y
1739CONFIG_CRYPTO_AEAD=y 1763CONFIG_CRYPTO_AEAD=y
1740CONFIG_CRYPTO_BLKCIPHER=y 1764CONFIG_CRYPTO_BLKCIPHER=y
1741# CONFIG_CRYPTO_SEQIV is not set
1742CONFIG_CRYPTO_HASH=y 1765CONFIG_CRYPTO_HASH=y
1743CONFIG_CRYPTO_MANAGER=y 1766CONFIG_CRYPTO_MANAGER=y
1767# CONFIG_CRYPTO_GF128MUL is not set
1768# CONFIG_CRYPTO_NULL is not set
1769# CONFIG_CRYPTO_CRYPTD is not set
1770CONFIG_CRYPTO_AUTHENC=y
1771# CONFIG_CRYPTO_TEST is not set
1772
1773#
1774# Authenticated Encryption with Associated Data
1775#
1776# CONFIG_CRYPTO_CCM is not set
1777# CONFIG_CRYPTO_GCM is not set
1778# CONFIG_CRYPTO_SEQIV is not set
1779
1780#
1781# Block modes
1782#
1783CONFIG_CRYPTO_CBC=y
1784# CONFIG_CRYPTO_CTR is not set
1785# CONFIG_CRYPTO_CTS is not set
1786# CONFIG_CRYPTO_ECB is not set
1787# CONFIG_CRYPTO_LRW is not set
1788# CONFIG_CRYPTO_PCBC is not set
1789# CONFIG_CRYPTO_XTS is not set
1790
1791#
1792# Hash modes
1793#
1744CONFIG_CRYPTO_HMAC=y 1794CONFIG_CRYPTO_HMAC=y
1745# CONFIG_CRYPTO_XCBC is not set 1795# CONFIG_CRYPTO_XCBC is not set
1746# CONFIG_CRYPTO_NULL is not set 1796
1797#
1798# Digest
1799#
1800# CONFIG_CRYPTO_CRC32C is not set
1747CONFIG_CRYPTO_MD4=y 1801CONFIG_CRYPTO_MD4=y
1748CONFIG_CRYPTO_MD5=y 1802CONFIG_CRYPTO_MD5=y
1803# CONFIG_CRYPTO_MICHAEL_MIC is not set
1749CONFIG_CRYPTO_SHA1=y 1804CONFIG_CRYPTO_SHA1=y
1750CONFIG_CRYPTO_SHA256=y 1805CONFIG_CRYPTO_SHA256=y
1751CONFIG_CRYPTO_SHA512=y 1806CONFIG_CRYPTO_SHA512=y
1752# CONFIG_CRYPTO_WP512 is not set
1753# CONFIG_CRYPTO_TGR192 is not set 1807# CONFIG_CRYPTO_TGR192 is not set
1754# CONFIG_CRYPTO_GF128MUL is not set 1808# CONFIG_CRYPTO_WP512 is not set
1755# CONFIG_CRYPTO_ECB is not set 1809
1756CONFIG_CRYPTO_CBC=y 1810#
1757# CONFIG_CRYPTO_PCBC is not set 1811# Ciphers
1758# CONFIG_CRYPTO_LRW is not set 1812#
1759# CONFIG_CRYPTO_XTS is not set
1760# CONFIG_CRYPTO_CTR is not set
1761# CONFIG_CRYPTO_GCM is not set
1762# CONFIG_CRYPTO_CCM is not set
1763# CONFIG_CRYPTO_CRYPTD is not set
1764CONFIG_CRYPTO_DES=y
1765# CONFIG_CRYPTO_FCRYPT is not set
1766CONFIG_CRYPTO_BLOWFISH=y
1767# CONFIG_CRYPTO_TWOFISH is not set
1768# CONFIG_CRYPTO_SERPENT is not set
1769CONFIG_CRYPTO_AES=y 1813CONFIG_CRYPTO_AES=y
1814# CONFIG_CRYPTO_ANUBIS is not set
1815# CONFIG_CRYPTO_ARC4 is not set
1816CONFIG_CRYPTO_BLOWFISH=y
1817# CONFIG_CRYPTO_CAMELLIA is not set
1770# CONFIG_CRYPTO_CAST5 is not set 1818# CONFIG_CRYPTO_CAST5 is not set
1771# CONFIG_CRYPTO_CAST6 is not set 1819# CONFIG_CRYPTO_CAST6 is not set
1772# CONFIG_CRYPTO_TEA is not set 1820CONFIG_CRYPTO_DES=y
1773# CONFIG_CRYPTO_ARC4 is not set 1821# CONFIG_CRYPTO_FCRYPT is not set
1774# CONFIG_CRYPTO_KHAZAD is not set 1822# CONFIG_CRYPTO_KHAZAD is not set
1775# CONFIG_CRYPTO_ANUBIS is not set
1776# CONFIG_CRYPTO_SEED is not set
1777# CONFIG_CRYPTO_SALSA20 is not set 1823# CONFIG_CRYPTO_SALSA20 is not set
1824# CONFIG_CRYPTO_SEED is not set
1825# CONFIG_CRYPTO_SERPENT is not set
1826# CONFIG_CRYPTO_TEA is not set
1827# CONFIG_CRYPTO_TWOFISH is not set
1828
1829#
1830# Compression
1831#
1778# CONFIG_CRYPTO_DEFLATE is not set 1832# CONFIG_CRYPTO_DEFLATE is not set
1779# CONFIG_CRYPTO_MICHAEL_MIC is not set
1780# CONFIG_CRYPTO_CRC32C is not set
1781# CONFIG_CRYPTO_CAMELLIA is not set
1782# CONFIG_CRYPTO_TEST is not set
1783CONFIG_CRYPTO_AUTHENC=y
1784# CONFIG_CRYPTO_LZO is not set 1833# CONFIG_CRYPTO_LZO is not set
1785CONFIG_CRYPTO_HW=y 1834CONFIG_CRYPTO_HW=y
1786# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1835# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1787# CONFIG_PPC_CLOCK is not set 1836# CONFIG_PPC_CLOCK is not set
1837# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index fca114252ac7..3688e4bb6fc2 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Thu Mar 27 13:56:21 2008 4# Tue May 20 20:02:24 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -31,6 +31,8 @@ CONFIG_GENERIC_CLOCKEVENTS=y
31CONFIG_GENERIC_HARDIRQS=y 31CONFIG_GENERIC_HARDIRQS=y
32# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 32# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
33CONFIG_IRQ_PER_CPU=y 33CONFIG_IRQ_PER_CPU=y
34CONFIG_STACKTRACE_SUPPORT=y
35CONFIG_LOCKDEP_SUPPORT=y
34CONFIG_RWSEM_XCHGADD_ALGORITHM=y 36CONFIG_RWSEM_XCHGADD_ALGORITHM=y
35CONFIG_ARCH_HAS_ILOG2_U32=y 37CONFIG_ARCH_HAS_ILOG2_U32=y
36CONFIG_GENERIC_HWEIGHT=y 38CONFIG_GENERIC_HWEIGHT=y
@@ -91,6 +93,7 @@ CONFIG_INITRAMFS_SOURCE=""
91CONFIG_SYSCTL=y 93CONFIG_SYSCTL=y
92# CONFIG_EMBEDDED is not set 94# CONFIG_EMBEDDED is not set
93CONFIG_SYSCTL_SYSCALL=y 95CONFIG_SYSCTL_SYSCALL=y
96CONFIG_SYSCTL_SYSCALL_CHECK=y
94CONFIG_KALLSYMS=y 97CONFIG_KALLSYMS=y
95# CONFIG_KALLSYMS_ALL is not set 98# CONFIG_KALLSYMS_ALL is not set
96# CONFIG_KALLSYMS_EXTRA_PASS is not set 99# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -119,12 +122,14 @@ CONFIG_HAVE_OPROFILE=y
119# CONFIG_KPROBES is not set 122# CONFIG_KPROBES is not set
120CONFIG_HAVE_KPROBES=y 123CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 124CONFIG_HAVE_KRETPROBES=y
125# CONFIG_HAVE_DMA_ATTRS is not set
122CONFIG_PROC_PAGE_MONITOR=y 126CONFIG_PROC_PAGE_MONITOR=y
123CONFIG_SLABINFO=y 127CONFIG_SLABINFO=y
124CONFIG_RT_MUTEXES=y 128CONFIG_RT_MUTEXES=y
125# CONFIG_TINY_SHMEM is not set 129# CONFIG_TINY_SHMEM is not set
126CONFIG_BASE_SMALL=0 130CONFIG_BASE_SMALL=0
127CONFIG_MODULES=y 131CONFIG_MODULES=y
132# CONFIG_MODULE_FORCE_LOAD is not set
128CONFIG_MODULE_UNLOAD=y 133CONFIG_MODULE_UNLOAD=y
129CONFIG_MODULE_FORCE_UNLOAD=y 134CONFIG_MODULE_FORCE_UNLOAD=y
130# CONFIG_MODVERSIONS is not set 135# CONFIG_MODVERSIONS is not set
@@ -185,6 +190,7 @@ CONFIG_CPU_FREQ_TABLE=y
185CONFIG_CPU_FREQ_STAT=y 190CONFIG_CPU_FREQ_STAT=y
186# CONFIG_CPU_FREQ_STAT_DETAILS is not set 191# CONFIG_CPU_FREQ_STAT_DETAILS is not set
187CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 192CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
193# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
188# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 194# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
189# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 195# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
190# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 196# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
@@ -236,16 +242,17 @@ CONFIG_FLATMEM=y
236CONFIG_FLAT_NODE_MEM_MAP=y 242CONFIG_FLAT_NODE_MEM_MAP=y
237# CONFIG_SPARSEMEM_STATIC is not set 243# CONFIG_SPARSEMEM_STATIC is not set
238# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 244# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
245CONFIG_PAGEFLAGS_EXTENDED=y
239CONFIG_SPLIT_PTLOCK_CPUS=4 246CONFIG_SPLIT_PTLOCK_CPUS=4
240# CONFIG_RESOURCES_64BIT is not set 247# CONFIG_RESOURCES_64BIT is not set
241CONFIG_ZONE_DMA_FLAG=1 248CONFIG_ZONE_DMA_FLAG=1
242CONFIG_BOUNCE=y 249CONFIG_BOUNCE=y
243CONFIG_VIRT_TO_BUS=y 250CONFIG_VIRT_TO_BUS=y
251CONFIG_FORCE_MAX_ZONEORDER=11
244CONFIG_PROC_DEVICETREE=y 252CONFIG_PROC_DEVICETREE=y
245# CONFIG_CMDLINE_BOOL is not set 253# CONFIG_CMDLINE_BOOL is not set
246CONFIG_ARCH_WANTS_FREEZER_CONTROL=y 254CONFIG_ARCH_WANTS_FREEZER_CONTROL=y
247CONFIG_PM=y 255CONFIG_PM=y
248# CONFIG_PM_LEGACY is not set
249CONFIG_PM_DEBUG=y 256CONFIG_PM_DEBUG=y
250# CONFIG_PM_VERBOSE is not set 257# CONFIG_PM_VERBOSE is not set
251CONFIG_CAN_PM_TRACE=y 258CONFIG_CAN_PM_TRACE=y
@@ -292,6 +299,7 @@ CONFIG_YENTA_TOSHIBA=y
292# CONFIG_I82092 is not set 299# CONFIG_I82092 is not set
293CONFIG_PCCARD_NONSTATIC=m 300CONFIG_PCCARD_NONSTATIC=m
294# CONFIG_HOTPLUG_PCI is not set 301# CONFIG_HOTPLUG_PCI is not set
302# CONFIG_HAS_RAPIDIO is not set
295 303
296# 304#
297# Advanced setup 305# Advanced setup
@@ -301,11 +309,11 @@ CONFIG_PCCARD_NONSTATIC=m
301# 309#
302# Default settings for advanced configuration options are used 310# Default settings for advanced configuration options are used
303# 311#
304CONFIG_HIGHMEM_START=0xfe000000
305CONFIG_LOWMEM_SIZE=0x30000000 312CONFIG_LOWMEM_SIZE=0x30000000
313CONFIG_PAGE_OFFSET=0xc0000000
306CONFIG_KERNEL_START=0xc0000000 314CONFIG_KERNEL_START=0xc0000000
315CONFIG_PHYSICAL_START=0x00000000
307CONFIG_TASK_SIZE=0xc0000000 316CONFIG_TASK_SIZE=0xc0000000
308CONFIG_BOOT_LOAD=0x00800000
309 317
310# 318#
311# Networking 319# Networking
@@ -352,8 +360,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
352# CONFIG_TCP_MD5SIG is not set 360# CONFIG_TCP_MD5SIG is not set
353# CONFIG_IP_VS is not set 361# CONFIG_IP_VS is not set
354# CONFIG_IPV6 is not set 362# CONFIG_IPV6 is not set
355# CONFIG_INET6_XFRM_TUNNEL is not set
356# CONFIG_INET6_TUNNEL is not set
357# CONFIG_NETWORK_SECMARK is not set 363# CONFIG_NETWORK_SECMARK is not set
358CONFIG_NETFILTER=y 364CONFIG_NETFILTER=y
359# CONFIG_NETFILTER_DEBUG is not set 365# CONFIG_NETFILTER_DEBUG is not set
@@ -369,6 +375,7 @@ CONFIG_NF_CONNTRACK=m
369# CONFIG_NF_CT_ACCT is not set 375# CONFIG_NF_CT_ACCT is not set
370# CONFIG_NF_CONNTRACK_MARK is not set 376# CONFIG_NF_CONNTRACK_MARK is not set
371# CONFIG_NF_CONNTRACK_EVENTS is not set 377# CONFIG_NF_CONNTRACK_EVENTS is not set
378CONFIG_NF_CT_PROTO_DCCP=m
372# CONFIG_NF_CT_PROTO_SCTP is not set 379# CONFIG_NF_CT_PROTO_SCTP is not set
373# CONFIG_NF_CT_PROTO_UDPLITE is not set 380# CONFIG_NF_CT_PROTO_UDPLITE is not set
374# CONFIG_NF_CONNTRACK_AMANDA is not set 381# CONFIG_NF_CONNTRACK_AMANDA is not set
@@ -445,6 +452,7 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
445CONFIG_IP_NF_TARGET_REDIRECT=m 452CONFIG_IP_NF_TARGET_REDIRECT=m
446CONFIG_IP_NF_TARGET_NETMAP=m 453CONFIG_IP_NF_TARGET_NETMAP=m
447# CONFIG_NF_NAT_SNMP_BASIC is not set 454# CONFIG_NF_NAT_SNMP_BASIC is not set
455CONFIG_NF_NAT_PROTO_DCCP=m
448CONFIG_NF_NAT_FTP=m 456CONFIG_NF_NAT_FTP=m
449CONFIG_NF_NAT_IRC=m 457CONFIG_NF_NAT_IRC=m
450CONFIG_NF_NAT_TFTP=m 458CONFIG_NF_NAT_TFTP=m
@@ -586,7 +594,6 @@ CONFIG_MAC80211=m
586# Rate control algorithm selection 594# Rate control algorithm selection
587# 595#
588CONFIG_MAC80211_RC_DEFAULT_PID=y 596CONFIG_MAC80211_RC_DEFAULT_PID=y
589# CONFIG_MAC80211_RC_DEFAULT_SIMPLE is not set
590# CONFIG_MAC80211_RC_DEFAULT_NONE is not set 597# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
591 598
592# 599#
@@ -598,7 +605,7 @@ CONFIG_MAC80211_RC_DEFAULT_PID=y
598# 605#
599CONFIG_MAC80211_RC_DEFAULT="pid" 606CONFIG_MAC80211_RC_DEFAULT="pid"
600CONFIG_MAC80211_RC_PID=y 607CONFIG_MAC80211_RC_PID=y
601# CONFIG_MAC80211_RC_SIMPLE is not set 608# CONFIG_MAC80211_MESH is not set
602CONFIG_MAC80211_LEDS=y 609CONFIG_MAC80211_LEDS=y
603# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set 610# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
604# CONFIG_MAC80211_DEBUG is not set 611# CONFIG_MAC80211_DEBUG is not set
@@ -607,7 +614,6 @@ CONFIG_IEEE80211=m
607CONFIG_IEEE80211_CRYPT_WEP=m 614CONFIG_IEEE80211_CRYPT_WEP=m
608CONFIG_IEEE80211_CRYPT_CCMP=m 615CONFIG_IEEE80211_CRYPT_CCMP=m
609CONFIG_IEEE80211_CRYPT_TKIP=m 616CONFIG_IEEE80211_CRYPT_TKIP=m
610# CONFIG_IEEE80211_SOFTMAC is not set
611# CONFIG_RFKILL is not set 617# CONFIG_RFKILL is not set
612# CONFIG_NET_9P is not set 618# CONFIG_NET_9P is not set
613 619
@@ -629,6 +635,7 @@ CONFIG_CONNECTOR=y
629CONFIG_PROC_EVENTS=y 635CONFIG_PROC_EVENTS=y
630# CONFIG_MTD is not set 636# CONFIG_MTD is not set
631CONFIG_OF_DEVICE=y 637CONFIG_OF_DEVICE=y
638CONFIG_OF_I2C=y
632# CONFIG_PARPORT is not set 639# CONFIG_PARPORT is not set
633CONFIG_BLK_DEV=y 640CONFIG_BLK_DEV=y
634# CONFIG_BLK_DEV_FD is not set 641# CONFIG_BLK_DEV_FD is not set
@@ -720,7 +727,7 @@ CONFIG_BLK_DEV_IDE_PMAC=y
720CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y 727CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
721CONFIG_BLK_DEV_IDEDMA_PMAC=y 728CONFIG_BLK_DEV_IDEDMA_PMAC=y
722CONFIG_BLK_DEV_IDEDMA=y 729CONFIG_BLK_DEV_IDEDMA=y
723CONFIG_IDE_ARCH_OBSOLETE_INIT=y 730# CONFIG_BLK_DEV_HD_ONLY is not set
724# CONFIG_BLK_DEV_HD is not set 731# CONFIG_BLK_DEV_HD is not set
725 732
726# 733#
@@ -906,7 +913,6 @@ CONFIG_SUNGEM=y
906# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 913# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
907CONFIG_NET_PCI=y 914CONFIG_NET_PCI=y
908CONFIG_PCNET32=y 915CONFIG_PCNET32=y
909# CONFIG_PCNET32_NAPI is not set
910# CONFIG_AMD8111_ETH is not set 916# CONFIG_AMD8111_ETH is not set
911# CONFIG_ADAPTEC_STARFIRE is not set 917# CONFIG_ADAPTEC_STARFIRE is not set
912# CONFIG_B44 is not set 918# CONFIG_B44 is not set
@@ -940,7 +946,6 @@ CONFIG_NETDEV_1000=y
940# CONFIG_SIS190 is not set 946# CONFIG_SIS190 is not set
941# CONFIG_SKGE is not set 947# CONFIG_SKGE is not set
942# CONFIG_SKY2 is not set 948# CONFIG_SKY2 is not set
943# CONFIG_SK98LIN is not set
944# CONFIG_VIA_VELOCITY is not set 949# CONFIG_VIA_VELOCITY is not set
945# CONFIG_TIGON3 is not set 950# CONFIG_TIGON3 is not set
946# CONFIG_BNX2 is not set 951# CONFIG_BNX2 is not set
@@ -959,6 +964,7 @@ CONFIG_NETDEV_10000=y
959# CONFIG_MLX4_CORE is not set 964# CONFIG_MLX4_CORE is not set
960# CONFIG_TEHUTI is not set 965# CONFIG_TEHUTI is not set
961# CONFIG_BNX2X is not set 966# CONFIG_BNX2X is not set
967# CONFIG_SFC is not set
962# CONFIG_TR is not set 968# CONFIG_TR is not set
963 969
964# 970#
@@ -992,6 +998,8 @@ CONFIG_P54_COMMON=m
992# CONFIG_P54_USB is not set 998# CONFIG_P54_USB is not set
993# CONFIG_P54_PCI is not set 999# CONFIG_P54_PCI is not set
994# CONFIG_ATH5K is not set 1000# CONFIG_ATH5K is not set
1001# CONFIG_IWLCORE is not set
1002# CONFIG_IWLWIFI_LEDS is not set
995# CONFIG_IWL4965 is not set 1003# CONFIG_IWL4965 is not set
996# CONFIG_IWL3945 is not set 1004# CONFIG_IWL3945 is not set
997# CONFIG_HOSTAP is not set 1005# CONFIG_HOSTAP is not set
@@ -1110,6 +1118,7 @@ CONFIG_VT=y
1110CONFIG_VT_CONSOLE=y 1118CONFIG_VT_CONSOLE=y
1111CONFIG_HW_CONSOLE=y 1119CONFIG_HW_CONSOLE=y
1112# CONFIG_VT_HW_CONSOLE_BINDING is not set 1120# CONFIG_VT_HW_CONSOLE_BINDING is not set
1121CONFIG_DEVKMEM=y
1113# CONFIG_SERIAL_NONSTANDARD is not set 1122# CONFIG_SERIAL_NONSTANDARD is not set
1114# CONFIG_NOZOMI is not set 1123# CONFIG_NOZOMI is not set
1115 1124
@@ -1156,13 +1165,7 @@ CONFIG_DEVPORT=y
1156CONFIG_I2C=y 1165CONFIG_I2C=y
1157CONFIG_I2C_BOARDINFO=y 1166CONFIG_I2C_BOARDINFO=y
1158CONFIG_I2C_CHARDEV=m 1167CONFIG_I2C_CHARDEV=m
1159
1160#
1161# I2C Algorithms
1162#
1163CONFIG_I2C_ALGOBIT=y 1168CONFIG_I2C_ALGOBIT=y
1164# CONFIG_I2C_ALGOPCF is not set
1165# CONFIG_I2C_ALGOPCA is not set
1166 1169
1167# 1170#
1168# I2C Hardware Bus support 1171# I2C Hardware Bus support
@@ -1192,6 +1195,7 @@ CONFIG_I2C_POWERMAC=y
1192# CONFIG_I2C_VIA is not set 1195# CONFIG_I2C_VIA is not set
1193# CONFIG_I2C_VIAPRO is not set 1196# CONFIG_I2C_VIAPRO is not set
1194# CONFIG_I2C_VOODOO3 is not set 1197# CONFIG_I2C_VOODOO3 is not set
1198# CONFIG_I2C_PCA_PLATFORM is not set
1195 1199
1196# 1200#
1197# Miscellaneous I2C Chip support 1201# Miscellaneous I2C Chip support
@@ -1201,19 +1205,13 @@ CONFIG_I2C_POWERMAC=y
1201# CONFIG_SENSORS_PCF8574 is not set 1205# CONFIG_SENSORS_PCF8574 is not set
1202# CONFIG_PCF8575 is not set 1206# CONFIG_PCF8575 is not set
1203# CONFIG_SENSORS_PCF8591 is not set 1207# CONFIG_SENSORS_PCF8591 is not set
1204# CONFIG_TPS65010 is not set
1205# CONFIG_SENSORS_MAX6875 is not set 1208# CONFIG_SENSORS_MAX6875 is not set
1206# CONFIG_SENSORS_TSL2550 is not set 1209# CONFIG_SENSORS_TSL2550 is not set
1207# CONFIG_I2C_DEBUG_CORE is not set 1210# CONFIG_I2C_DEBUG_CORE is not set
1208# CONFIG_I2C_DEBUG_ALGO is not set 1211# CONFIG_I2C_DEBUG_ALGO is not set
1209# CONFIG_I2C_DEBUG_BUS is not set 1212# CONFIG_I2C_DEBUG_BUS is not set
1210# CONFIG_I2C_DEBUG_CHIP is not set 1213# CONFIG_I2C_DEBUG_CHIP is not set
1211
1212#
1213# SPI support
1214#
1215# CONFIG_SPI is not set 1214# CONFIG_SPI is not set
1216# CONFIG_SPI_MASTER is not set
1217# CONFIG_W1 is not set 1215# CONFIG_W1 is not set
1218CONFIG_POWER_SUPPLY=y 1216CONFIG_POWER_SUPPLY=y
1219# CONFIG_POWER_SUPPLY_DEBUG is not set 1217# CONFIG_POWER_SUPPLY_DEBUG is not set
@@ -1230,6 +1228,7 @@ CONFIG_BATTERY_PMU=y
1230# 1228#
1231CONFIG_SSB_POSSIBLE=y 1229CONFIG_SSB_POSSIBLE=y
1232CONFIG_SSB=m 1230CONFIG_SSB=m
1231CONFIG_SSB_SPROM=y
1233CONFIG_SSB_PCIHOST_POSSIBLE=y 1232CONFIG_SSB_PCIHOST_POSSIBLE=y
1234CONFIG_SSB_PCIHOST=y 1233CONFIG_SSB_PCIHOST=y
1235CONFIG_SSB_B43_PCI_BRIDGE=y 1234CONFIG_SSB_B43_PCI_BRIDGE=y
@@ -1243,12 +1242,22 @@ CONFIG_SSB_DRIVER_PCICORE=y
1243# Multifunction device drivers 1242# Multifunction device drivers
1244# 1243#
1245# CONFIG_MFD_SM501 is not set 1244# CONFIG_MFD_SM501 is not set
1245# CONFIG_HTC_PASIC3 is not set
1246 1246
1247# 1247#
1248# Multimedia devices 1248# Multimedia devices
1249# 1249#
1250
1251#
1252# Multimedia core support
1253#
1250# CONFIG_VIDEO_DEV is not set 1254# CONFIG_VIDEO_DEV is not set
1251# CONFIG_DVB_CORE is not set 1255# CONFIG_DVB_CORE is not set
1256# CONFIG_VIDEO_MEDIA is not set
1257
1258#
1259# Multimedia drivers
1260#
1252# CONFIG_DAB is not set 1261# CONFIG_DAB is not set
1253 1262
1254# 1263#
@@ -1276,8 +1285,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
1276# CONFIG_FB_SYS_FILLRECT is not set 1285# CONFIG_FB_SYS_FILLRECT is not set
1277# CONFIG_FB_SYS_COPYAREA is not set 1286# CONFIG_FB_SYS_COPYAREA is not set
1278# CONFIG_FB_SYS_IMAGEBLIT is not set 1287# CONFIG_FB_SYS_IMAGEBLIT is not set
1288# CONFIG_FB_FOREIGN_ENDIAN is not set
1279# CONFIG_FB_SYS_FOPS is not set 1289# CONFIG_FB_SYS_FOPS is not set
1280CONFIG_FB_DEFERRED_IO=y
1281# CONFIG_FB_SVGALIB is not set 1290# CONFIG_FB_SVGALIB is not set
1282CONFIG_FB_MACMODES=y 1291CONFIG_FB_MACMODES=y
1283CONFIG_FB_BACKLIGHT=y 1292CONFIG_FB_BACKLIGHT=y
@@ -1413,6 +1422,7 @@ CONFIG_SND_DUMMY=m
1413# CONFIG_SND_AU8810 is not set 1422# CONFIG_SND_AU8810 is not set
1414# CONFIG_SND_AU8820 is not set 1423# CONFIG_SND_AU8820 is not set
1415# CONFIG_SND_AU8830 is not set 1424# CONFIG_SND_AU8830 is not set
1425# CONFIG_SND_AW2 is not set
1416# CONFIG_SND_AZT3328 is not set 1426# CONFIG_SND_AZT3328 is not set
1417# CONFIG_SND_BT87X is not set 1427# CONFIG_SND_BT87X is not set
1418# CONFIG_SND_CA0106 is not set 1428# CONFIG_SND_CA0106 is not set
@@ -1505,11 +1515,11 @@ CONFIG_SND_USB_AUDIO=m
1505# CONFIG_SND_SOC is not set 1515# CONFIG_SND_SOC is not set
1506 1516
1507# 1517#
1508# SoC Audio support for SuperH 1518# ALSA SoC audio for Freescale SOCs
1509# 1519#
1510 1520
1511# 1521#
1512# ALSA SoC audio for Freescale SOCs 1522# SoC Audio for the Texas Instruments OMAP
1513# 1523#
1514 1524
1515# 1525#
@@ -1543,17 +1553,18 @@ CONFIG_USB_DEVICEFS=y
1543CONFIG_USB_DEVICE_CLASS=y 1553CONFIG_USB_DEVICE_CLASS=y
1544CONFIG_USB_DYNAMIC_MINORS=y 1554CONFIG_USB_DYNAMIC_MINORS=y
1545# CONFIG_USB_SUSPEND is not set 1555# CONFIG_USB_SUSPEND is not set
1546# CONFIG_USB_PERSIST is not set
1547# CONFIG_USB_OTG is not set 1556# CONFIG_USB_OTG is not set
1548 1557
1549# 1558#
1550# USB Host Controller Drivers 1559# USB Host Controller Drivers
1551# 1560#
1561# CONFIG_USB_C67X00_HCD is not set
1552CONFIG_USB_EHCI_HCD=m 1562CONFIG_USB_EHCI_HCD=m
1553CONFIG_USB_EHCI_ROOT_HUB_TT=y 1563CONFIG_USB_EHCI_ROOT_HUB_TT=y
1554# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1564# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1555# CONFIG_USB_EHCI_HCD_PPC_OF is not set 1565# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1556# CONFIG_USB_ISP116X_HCD is not set 1566# CONFIG_USB_ISP116X_HCD is not set
1567# CONFIG_USB_ISP1760_HCD is not set
1557CONFIG_USB_OHCI_HCD=y 1568CONFIG_USB_OHCI_HCD=y
1558# CONFIG_USB_OHCI_HCD_PPC_OF is not set 1569# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1559# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1570# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1587,7 +1598,9 @@ CONFIG_USB_STORAGE=m
1587# CONFIG_USB_STORAGE_SDDR55 is not set 1598# CONFIG_USB_STORAGE_SDDR55 is not set
1588# CONFIG_USB_STORAGE_JUMPSHOT is not set 1599# CONFIG_USB_STORAGE_JUMPSHOT is not set
1589# CONFIG_USB_STORAGE_ALAUDA is not set 1600# CONFIG_USB_STORAGE_ALAUDA is not set
1601CONFIG_USB_STORAGE_ONETOUCH=y
1590# CONFIG_USB_STORAGE_KARMA is not set 1602# CONFIG_USB_STORAGE_KARMA is not set
1603# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1591# CONFIG_USB_LIBUSUAL is not set 1604# CONFIG_USB_LIBUSUAL is not set
1592 1605
1593# 1606#
@@ -1642,9 +1655,11 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1642# CONFIG_USB_SERIAL_MCT_U232 is not set 1655# CONFIG_USB_SERIAL_MCT_U232 is not set
1643# CONFIG_USB_SERIAL_MOS7720 is not set 1656# CONFIG_USB_SERIAL_MOS7720 is not set
1644# CONFIG_USB_SERIAL_MOS7840 is not set 1657# CONFIG_USB_SERIAL_MOS7840 is not set
1658# CONFIG_USB_SERIAL_MOTOROLA is not set
1645# CONFIG_USB_SERIAL_NAVMAN is not set 1659# CONFIG_USB_SERIAL_NAVMAN is not set
1646# CONFIG_USB_SERIAL_PL2303 is not set 1660# CONFIG_USB_SERIAL_PL2303 is not set
1647# CONFIG_USB_SERIAL_OTI6858 is not set 1661# CONFIG_USB_SERIAL_OTI6858 is not set
1662# CONFIG_USB_SERIAL_SPCP8X5 is not set
1648# CONFIG_USB_SERIAL_HP4X is not set 1663# CONFIG_USB_SERIAL_HP4X is not set
1649# CONFIG_USB_SERIAL_SAFE is not set 1664# CONFIG_USB_SERIAL_SAFE is not set
1650# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set 1665# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
@@ -1695,14 +1710,12 @@ CONFIG_LEDS_TRIGGERS=y
1695# CONFIG_LEDS_TRIGGER_TIMER is not set 1710# CONFIG_LEDS_TRIGGER_TIMER is not set
1696CONFIG_LEDS_TRIGGER_IDE_DISK=y 1711CONFIG_LEDS_TRIGGER_IDE_DISK=y
1697# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set 1712# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
1713CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
1714# CONFIG_ACCESSIBILITY is not set
1698# CONFIG_INFINIBAND is not set 1715# CONFIG_INFINIBAND is not set
1699# CONFIG_EDAC is not set 1716# CONFIG_EDAC is not set
1700# CONFIG_RTC_CLASS is not set 1717# CONFIG_RTC_CLASS is not set
1701# CONFIG_DMADEVICES is not set 1718# CONFIG_DMADEVICES is not set
1702
1703#
1704# Userspace I/O
1705#
1706# CONFIG_UIO is not set 1719# CONFIG_UIO is not set
1707 1720
1708# 1721#
@@ -1786,13 +1799,11 @@ CONFIG_NFS_FS=y
1786CONFIG_NFS_V3=y 1799CONFIG_NFS_V3=y
1787CONFIG_NFS_V3_ACL=y 1800CONFIG_NFS_V3_ACL=y
1788CONFIG_NFS_V4=y 1801CONFIG_NFS_V4=y
1789# CONFIG_NFS_DIRECTIO is not set
1790CONFIG_NFSD=m 1802CONFIG_NFSD=m
1791CONFIG_NFSD_V2_ACL=y 1803CONFIG_NFSD_V2_ACL=y
1792CONFIG_NFSD_V3=y 1804CONFIG_NFSD_V3=y
1793CONFIG_NFSD_V3_ACL=y 1805CONFIG_NFSD_V3_ACL=y
1794CONFIG_NFSD_V4=y 1806CONFIG_NFSD_V4=y
1795CONFIG_NFSD_TCP=y
1796CONFIG_LOCKD=y 1807CONFIG_LOCKD=y
1797CONFIG_LOCKD_V4=y 1808CONFIG_LOCKD_V4=y
1798CONFIG_EXPORTFS=m 1809CONFIG_EXPORTFS=m
@@ -1877,9 +1888,10 @@ CONFIG_NLS_UTF8=m
1877# Library routines 1888# Library routines
1878# 1889#
1879CONFIG_BITREVERSE=y 1890CONFIG_BITREVERSE=y
1891# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1880CONFIG_CRC_CCITT=y 1892CONFIG_CRC_CCITT=y
1881CONFIG_CRC16=y 1893CONFIG_CRC16=y
1882# CONFIG_CRC_ITU_T is not set 1894CONFIG_CRC_ITU_T=m
1883CONFIG_CRC32=y 1895CONFIG_CRC32=y
1884# CONFIG_CRC7 is not set 1896# CONFIG_CRC7 is not set
1885CONFIG_LIBCRC32C=m 1897CONFIG_LIBCRC32C=m
@@ -1901,6 +1913,7 @@ CONFIG_HAVE_LMB=y
1901# CONFIG_PRINTK_TIME is not set 1913# CONFIG_PRINTK_TIME is not set
1902CONFIG_ENABLE_WARN_DEPRECATED=y 1914CONFIG_ENABLE_WARN_DEPRECATED=y
1903CONFIG_ENABLE_MUST_CHECK=y 1915CONFIG_ENABLE_MUST_CHECK=y
1916CONFIG_FRAME_WARN=1024
1904CONFIG_MAGIC_SYSRQ=y 1917CONFIG_MAGIC_SYSRQ=y
1905# CONFIG_UNUSED_SYMBOLS is not set 1918# CONFIG_UNUSED_SYMBOLS is not set
1906# CONFIG_DEBUG_FS is not set 1919# CONFIG_DEBUG_FS is not set
@@ -1911,6 +1924,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1911CONFIG_SCHED_DEBUG=y 1924CONFIG_SCHED_DEBUG=y
1912# CONFIG_SCHEDSTATS is not set 1925# CONFIG_SCHEDSTATS is not set
1913# CONFIG_TIMER_STATS is not set 1926# CONFIG_TIMER_STATS is not set
1927# CONFIG_DEBUG_OBJECTS is not set
1914# CONFIG_SLUB_DEBUG_ON is not set 1928# CONFIG_SLUB_DEBUG_ON is not set
1915# CONFIG_SLUB_STATS is not set 1929# CONFIG_SLUB_STATS is not set
1916# CONFIG_DEBUG_RT_MUTEXES is not set 1930# CONFIG_DEBUG_RT_MUTEXES is not set
@@ -1923,6 +1937,7 @@ CONFIG_SCHED_DEBUG=y
1923CONFIG_DEBUG_BUGVERBOSE=y 1937CONFIG_DEBUG_BUGVERBOSE=y
1924# CONFIG_DEBUG_INFO is not set 1938# CONFIG_DEBUG_INFO is not set
1925# CONFIG_DEBUG_VM is not set 1939# CONFIG_DEBUG_VM is not set
1940# CONFIG_DEBUG_WRITECOUNT is not set
1926# CONFIG_DEBUG_LIST is not set 1941# CONFIG_DEBUG_LIST is not set
1927# CONFIG_DEBUG_SG is not set 1942# CONFIG_DEBUG_SG is not set
1928# CONFIG_BOOT_PRINTK_DELAY is not set 1943# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1936,6 +1951,7 @@ CONFIG_DEBUGGER=y
1936CONFIG_XMON=y 1951CONFIG_XMON=y
1937CONFIG_XMON_DEFAULT=y 1952CONFIG_XMON_DEFAULT=y
1938CONFIG_XMON_DISASSEMBLY=y 1953CONFIG_XMON_DISASSEMBLY=y
1954CONFIG_IRQSTACKS=y
1939# CONFIG_BDI_SWITCH is not set 1955# CONFIG_BDI_SWITCH is not set
1940CONFIG_BOOTX_TEXT=y 1956CONFIG_BOOTX_TEXT=y
1941# CONFIG_PPC_EARLY_DEBUG is not set 1957# CONFIG_PPC_EARLY_DEBUG is not set
@@ -1947,54 +1963,84 @@ CONFIG_BOOTX_TEXT=y
1947# CONFIG_SECURITY is not set 1963# CONFIG_SECURITY is not set
1948# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1964# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1949CONFIG_CRYPTO=y 1965CONFIG_CRYPTO=y
1966
1967#
1968# Crypto core or helper
1969#
1950CONFIG_CRYPTO_ALGAPI=y 1970CONFIG_CRYPTO_ALGAPI=y
1951CONFIG_CRYPTO_AEAD=y 1971CONFIG_CRYPTO_AEAD=y
1952CONFIG_CRYPTO_BLKCIPHER=y 1972CONFIG_CRYPTO_BLKCIPHER=y
1953# CONFIG_CRYPTO_SEQIV is not set
1954CONFIG_CRYPTO_HASH=y 1973CONFIG_CRYPTO_HASH=y
1955CONFIG_CRYPTO_MANAGER=y 1974CONFIG_CRYPTO_MANAGER=y
1975# CONFIG_CRYPTO_GF128MUL is not set
1976CONFIG_CRYPTO_NULL=m
1977# CONFIG_CRYPTO_CRYPTD is not set
1978CONFIG_CRYPTO_AUTHENC=y
1979# CONFIG_CRYPTO_TEST is not set
1980
1981#
1982# Authenticated Encryption with Associated Data
1983#
1984# CONFIG_CRYPTO_CCM is not set
1985# CONFIG_CRYPTO_GCM is not set
1986# CONFIG_CRYPTO_SEQIV is not set
1987
1988#
1989# Block modes
1990#
1991CONFIG_CRYPTO_CBC=y
1992# CONFIG_CRYPTO_CTR is not set
1993# CONFIG_CRYPTO_CTS is not set
1994CONFIG_CRYPTO_ECB=m
1995# CONFIG_CRYPTO_LRW is not set
1996CONFIG_CRYPTO_PCBC=m
1997# CONFIG_CRYPTO_XTS is not set
1998
1999#
2000# Hash modes
2001#
1956CONFIG_CRYPTO_HMAC=y 2002CONFIG_CRYPTO_HMAC=y
1957# CONFIG_CRYPTO_XCBC is not set 2003# CONFIG_CRYPTO_XCBC is not set
1958CONFIG_CRYPTO_NULL=m 2004
2005#
2006# Digest
2007#
2008CONFIG_CRYPTO_CRC32C=m
1959CONFIG_CRYPTO_MD4=m 2009CONFIG_CRYPTO_MD4=m
1960CONFIG_CRYPTO_MD5=y 2010CONFIG_CRYPTO_MD5=y
2011CONFIG_CRYPTO_MICHAEL_MIC=m
1961CONFIG_CRYPTO_SHA1=y 2012CONFIG_CRYPTO_SHA1=y
1962CONFIG_CRYPTO_SHA256=m 2013CONFIG_CRYPTO_SHA256=m
1963CONFIG_CRYPTO_SHA512=m 2014CONFIG_CRYPTO_SHA512=m
1964CONFIG_CRYPTO_WP512=m
1965CONFIG_CRYPTO_TGR192=m 2015CONFIG_CRYPTO_TGR192=m
1966# CONFIG_CRYPTO_GF128MUL is not set 2016CONFIG_CRYPTO_WP512=m
1967CONFIG_CRYPTO_ECB=m 2017
1968CONFIG_CRYPTO_CBC=y 2018#
1969CONFIG_CRYPTO_PCBC=m 2019# Ciphers
1970# CONFIG_CRYPTO_LRW is not set 2020#
1971# CONFIG_CRYPTO_XTS is not set
1972# CONFIG_CRYPTO_CTR is not set
1973# CONFIG_CRYPTO_GCM is not set
1974# CONFIG_CRYPTO_CCM is not set
1975# CONFIG_CRYPTO_CRYPTD is not set
1976CONFIG_CRYPTO_DES=y
1977# CONFIG_CRYPTO_FCRYPT is not set
1978CONFIG_CRYPTO_BLOWFISH=m
1979CONFIG_CRYPTO_TWOFISH=m
1980CONFIG_CRYPTO_TWOFISH_COMMON=m
1981CONFIG_CRYPTO_SERPENT=m
1982CONFIG_CRYPTO_AES=m 2021CONFIG_CRYPTO_AES=m
2022CONFIG_CRYPTO_ANUBIS=m
2023CONFIG_CRYPTO_ARC4=m
2024CONFIG_CRYPTO_BLOWFISH=m
2025# CONFIG_CRYPTO_CAMELLIA is not set
1983CONFIG_CRYPTO_CAST5=m 2026CONFIG_CRYPTO_CAST5=m
1984CONFIG_CRYPTO_CAST6=m 2027CONFIG_CRYPTO_CAST6=m
1985CONFIG_CRYPTO_TEA=m 2028CONFIG_CRYPTO_DES=y
1986CONFIG_CRYPTO_ARC4=m 2029# CONFIG_CRYPTO_FCRYPT is not set
1987CONFIG_CRYPTO_KHAZAD=m 2030CONFIG_CRYPTO_KHAZAD=m
1988CONFIG_CRYPTO_ANUBIS=m
1989# CONFIG_CRYPTO_SEED is not set
1990# CONFIG_CRYPTO_SALSA20 is not set 2031# CONFIG_CRYPTO_SALSA20 is not set
2032# CONFIG_CRYPTO_SEED is not set
2033CONFIG_CRYPTO_SERPENT=m
2034CONFIG_CRYPTO_TEA=m
2035CONFIG_CRYPTO_TWOFISH=m
2036CONFIG_CRYPTO_TWOFISH_COMMON=m
2037
2038#
2039# Compression
2040#
1991CONFIG_CRYPTO_DEFLATE=m 2041CONFIG_CRYPTO_DEFLATE=m
1992CONFIG_CRYPTO_MICHAEL_MIC=m
1993CONFIG_CRYPTO_CRC32C=m
1994# CONFIG_CRYPTO_CAMELLIA is not set
1995# CONFIG_CRYPTO_TEST is not set
1996CONFIG_CRYPTO_AUTHENC=y
1997# CONFIG_CRYPTO_LZO is not set 2042# CONFIG_CRYPTO_LZO is not set
1998CONFIG_CRYPTO_HW=y 2043CONFIG_CRYPTO_HW=y
1999# CONFIG_CRYPTO_DEV_HIFN_795X is not set 2044# CONFIG_CRYPTO_DEV_HIFN_795X is not set
2000# CONFIG_PPC_CLOCK is not set 2045# CONFIG_PPC_CLOCK is not set
2046# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 970282b1a004..40f84fa2bd29 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Thu Mar 27 13:56:24 2008 4# Tue May 20 20:03:02 2008
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -30,6 +30,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
30CONFIG_GENERIC_HARDIRQS=y 30CONFIG_GENERIC_HARDIRQS=y
31CONFIG_HAVE_SETUP_PER_CPU_AREA=y 31CONFIG_HAVE_SETUP_PER_CPU_AREA=y
32CONFIG_IRQ_PER_CPU=y 32CONFIG_IRQ_PER_CPU=y
33CONFIG_STACKTRACE_SUPPORT=y
34CONFIG_TRACE_IRQFLAGS_SUPPORT=y
35CONFIG_LOCKDEP_SUPPORT=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y 36CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y 37CONFIG_ARCH_HAS_ILOG2_U32=y
35CONFIG_ARCH_HAS_ILOG2_U64=y 38CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -82,6 +85,7 @@ CONFIG_LOG_BUF_SHIFT=17
82CONFIG_CGROUPS=y 85CONFIG_CGROUPS=y
83# CONFIG_CGROUP_DEBUG is not set 86# CONFIG_CGROUP_DEBUG is not set
84# CONFIG_CGROUP_NS is not set 87# CONFIG_CGROUP_NS is not set
88# CONFIG_CGROUP_DEVICE is not set
85CONFIG_CPUSETS=y 89CONFIG_CPUSETS=y
86# CONFIG_GROUP_SCHED is not set 90# CONFIG_GROUP_SCHED is not set
87# CONFIG_CGROUP_CPUACCT is not set 91# CONFIG_CGROUP_CPUACCT is not set
@@ -101,6 +105,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
101CONFIG_SYSCTL=y 105CONFIG_SYSCTL=y
102# CONFIG_EMBEDDED is not set 106# CONFIG_EMBEDDED is not set
103CONFIG_SYSCTL_SYSCALL=y 107CONFIG_SYSCTL_SYSCALL=y
108CONFIG_SYSCTL_SYSCALL_CHECK=y
104CONFIG_KALLSYMS=y 109CONFIG_KALLSYMS=y
105CONFIG_KALLSYMS_ALL=y 110CONFIG_KALLSYMS_ALL=y
106# CONFIG_KALLSYMS_EXTRA_PASS is not set 111# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -108,6 +113,7 @@ CONFIG_HOTPLUG=y
108CONFIG_PRINTK=y 113CONFIG_PRINTK=y
109CONFIG_BUG=y 114CONFIG_BUG=y
110CONFIG_ELF_CORE=y 115CONFIG_ELF_CORE=y
116CONFIG_PCSPKR_PLATFORM=y
111# CONFIG_COMPAT_BRK is not set 117# CONFIG_COMPAT_BRK is not set
112CONFIG_BASE_FULL=y 118CONFIG_BASE_FULL=y
113CONFIG_FUTEX=y 119CONFIG_FUTEX=y
@@ -129,12 +135,14 @@ CONFIG_HAVE_OPROFILE=y
129# CONFIG_KPROBES is not set 135# CONFIG_KPROBES is not set
130CONFIG_HAVE_KPROBES=y 136CONFIG_HAVE_KPROBES=y
131CONFIG_HAVE_KRETPROBES=y 137CONFIG_HAVE_KRETPROBES=y
138# CONFIG_HAVE_DMA_ATTRS is not set
132CONFIG_PROC_PAGE_MONITOR=y 139CONFIG_PROC_PAGE_MONITOR=y
133CONFIG_SLABINFO=y 140CONFIG_SLABINFO=y
134CONFIG_RT_MUTEXES=y 141CONFIG_RT_MUTEXES=y
135# CONFIG_TINY_SHMEM is not set 142# CONFIG_TINY_SHMEM is not set
136CONFIG_BASE_SMALL=0 143CONFIG_BASE_SMALL=0
137CONFIG_MODULES=y 144CONFIG_MODULES=y
145# CONFIG_MODULE_FORCE_LOAD is not set
138CONFIG_MODULE_UNLOAD=y 146CONFIG_MODULE_UNLOAD=y
139# CONFIG_MODULE_FORCE_UNLOAD is not set 147# CONFIG_MODULE_FORCE_UNLOAD is not set
140CONFIG_MODVERSIONS=y 148CONFIG_MODVERSIONS=y
@@ -194,11 +202,11 @@ CONFIG_PPC_PASEMI=y
194CONFIG_PPC_PASEMI_IOMMU=y 202CONFIG_PPC_PASEMI_IOMMU=y
195# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set 203# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
196CONFIG_PPC_PASEMI_MDIO=y 204CONFIG_PPC_PASEMI_MDIO=y
197CONFIG_PPC_CELLEB=y
198# CONFIG_PPC_PS3 is not set 205# CONFIG_PPC_PS3 is not set
199CONFIG_PPC_CELL=y 206CONFIG_PPC_CELL=y
200CONFIG_PPC_CELL_NATIVE=y 207CONFIG_PPC_CELL_NATIVE=y
201CONFIG_PPC_IBM_CELL_BLADE=y 208CONFIG_PPC_IBM_CELL_BLADE=y
209CONFIG_PPC_CELLEB=y
202 210
203# 211#
204# Cell Broadband Engine options 212# Cell Broadband Engine options
@@ -241,6 +249,7 @@ CONFIG_CPU_FREQ_TABLE=y
241CONFIG_CPU_FREQ_STAT=y 249CONFIG_CPU_FREQ_STAT=y
242# CONFIG_CPU_FREQ_STAT_DETAILS is not set 250# CONFIG_CPU_FREQ_STAT_DETAILS is not set
243CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 251CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
252# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
244# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 253# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
245# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set 254# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
246# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set 255# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
@@ -277,7 +286,6 @@ CONFIG_PREEMPT_NONE=y
277CONFIG_BINFMT_ELF=y 286CONFIG_BINFMT_ELF=y
278CONFIG_COMPAT_BINFMT_ELF=y 287CONFIG_COMPAT_BINFMT_ELF=y
279CONFIG_BINFMT_MISC=m 288CONFIG_BINFMT_MISC=m
280CONFIG_FORCE_MAX_ZONEORDER=13
281CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y 289CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
282CONFIG_IOMMU_VMERGE=y 290CONFIG_IOMMU_VMERGE=y
283CONFIG_IOMMU_HELPER=y 291CONFIG_IOMMU_HELPER=y
@@ -307,6 +315,7 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
307CONFIG_SPARSEMEM_VMEMMAP=y 315CONFIG_SPARSEMEM_VMEMMAP=y
308CONFIG_MEMORY_HOTPLUG=y 316CONFIG_MEMORY_HOTPLUG=y
309CONFIG_MEMORY_HOTPLUG_SPARSE=y 317CONFIG_MEMORY_HOTPLUG_SPARSE=y
318CONFIG_PAGEFLAGS_EXTENDED=y
310CONFIG_SPLIT_PTLOCK_CPUS=4 319CONFIG_SPLIT_PTLOCK_CPUS=4
311CONFIG_RESOURCES_64BIT=y 320CONFIG_RESOURCES_64BIT=y
312CONFIG_ZONE_DMA_FLAG=1 321CONFIG_ZONE_DMA_FLAG=1
@@ -314,6 +323,7 @@ CONFIG_BOUNCE=y
314CONFIG_ARCH_MEMORY_PROBE=y 323CONFIG_ARCH_MEMORY_PROBE=y
315CONFIG_PPC_HAS_HASH_64K=y 324CONFIG_PPC_HAS_HASH_64K=y
316# CONFIG_PPC_64K_PAGES is not set 325# CONFIG_PPC_64K_PAGES is not set
326CONFIG_FORCE_MAX_ZONEORDER=13
317# CONFIG_SCHED_SMT is not set 327# CONFIG_SCHED_SMT is not set
318CONFIG_PROC_DEVICETREE=y 328CONFIG_PROC_DEVICETREE=y
319# CONFIG_CMDLINE_BOOL is not set 329# CONFIG_CMDLINE_BOOL is not set
@@ -356,7 +366,10 @@ CONFIG_HOTPLUG_PCI=m
356# CONFIG_HOTPLUG_PCI_SHPC is not set 366# CONFIG_HOTPLUG_PCI_SHPC is not set
357CONFIG_HOTPLUG_PCI_RPA=m 367CONFIG_HOTPLUG_PCI_RPA=m
358CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 368CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
369# CONFIG_HAS_RAPIDIO is not set
370CONFIG_PAGE_OFFSET=0xc000000000000000
359CONFIG_KERNEL_START=0xc000000000000000 371CONFIG_KERNEL_START=0xc000000000000000
372CONFIG_PHYSICAL_START=0x00000000
360 373
361# 374#
362# Networking 375# Networking
@@ -406,8 +419,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
406# CONFIG_TCP_MD5SIG is not set 419# CONFIG_TCP_MD5SIG is not set
407# CONFIG_IP_VS is not set 420# CONFIG_IP_VS is not set
408# CONFIG_IPV6 is not set 421# CONFIG_IPV6 is not set
409# CONFIG_INET6_XFRM_TUNNEL is not set
410# CONFIG_INET6_TUNNEL is not set
411# CONFIG_NETWORK_SECMARK is not set 422# CONFIG_NETWORK_SECMARK is not set
412CONFIG_NETFILTER=y 423CONFIG_NETFILTER=y
413# CONFIG_NETFILTER_DEBUG is not set 424# CONFIG_NETFILTER_DEBUG is not set
@@ -423,6 +434,7 @@ CONFIG_NF_CONNTRACK=m
423CONFIG_NF_CT_ACCT=y 434CONFIG_NF_CT_ACCT=y
424CONFIG_NF_CONNTRACK_MARK=y 435CONFIG_NF_CONNTRACK_MARK=y
425CONFIG_NF_CONNTRACK_EVENTS=y 436CONFIG_NF_CONNTRACK_EVENTS=y
437# CONFIG_NF_CT_PROTO_DCCP is not set
426CONFIG_NF_CT_PROTO_GRE=m 438CONFIG_NF_CT_PROTO_GRE=m
427CONFIG_NF_CT_PROTO_SCTP=m 439CONFIG_NF_CT_PROTO_SCTP=m
428# CONFIG_NF_CT_PROTO_UDPLITE is not set 440# CONFIG_NF_CT_PROTO_UDPLITE is not set
@@ -501,6 +513,7 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
501CONFIG_IP_NF_TARGET_NETMAP=m 513CONFIG_IP_NF_TARGET_NETMAP=m
502CONFIG_NF_NAT_SNMP_BASIC=m 514CONFIG_NF_NAT_SNMP_BASIC=m
503CONFIG_NF_NAT_PROTO_GRE=m 515CONFIG_NF_NAT_PROTO_GRE=m
516CONFIG_NF_NAT_PROTO_SCTP=m
504CONFIG_NF_NAT_FTP=m 517CONFIG_NF_NAT_FTP=m
505CONFIG_NF_NAT_IRC=m 518CONFIG_NF_NAT_IRC=m
506CONFIG_NF_NAT_TFTP=m 519CONFIG_NF_NAT_TFTP=m
@@ -571,6 +584,7 @@ CONFIG_FW_LOADER=y
571# CONFIG_CONNECTOR is not set 584# CONFIG_CONNECTOR is not set
572# CONFIG_MTD is not set 585# CONFIG_MTD is not set
573CONFIG_OF_DEVICE=y 586CONFIG_OF_DEVICE=y
587CONFIG_OF_I2C=y
574# CONFIG_PARPORT is not set 588# CONFIG_PARPORT is not set
575CONFIG_BLK_DEV=y 589CONFIG_BLK_DEV=y
576CONFIG_BLK_DEV_FD=y 590CONFIG_BLK_DEV_FD=y
@@ -618,7 +632,6 @@ CONFIG_IDE_PROC_FS=y
618# 632#
619# IDE chipset support/bugfixes 633# IDE chipset support/bugfixes
620# 634#
621CONFIG_IDE_GENERIC=y
622# CONFIG_BLK_DEV_PLATFORM is not set 635# CONFIG_BLK_DEV_PLATFORM is not set
623CONFIG_BLK_DEV_IDEDMA_SFF=y 636CONFIG_BLK_DEV_IDEDMA_SFF=y
624 637
@@ -661,7 +674,7 @@ CONFIG_BLK_DEV_IDE_PMAC=y
661CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y 674CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
662CONFIG_BLK_DEV_IDEDMA_PMAC=y 675CONFIG_BLK_DEV_IDEDMA_PMAC=y
663CONFIG_BLK_DEV_IDEDMA=y 676CONFIG_BLK_DEV_IDEDMA=y
664CONFIG_IDE_ARCH_OBSOLETE_INIT=y 677# CONFIG_BLK_DEV_HD_ONLY is not set
665# CONFIG_BLK_DEV_HD is not set 678# CONFIG_BLK_DEV_HD is not set
666 679
667# 680#
@@ -747,64 +760,10 @@ CONFIG_SCSI_DEBUG=m
747# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 760# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
748CONFIG_ATA=y 761CONFIG_ATA=y
749CONFIG_ATA_NONSTANDARD=y 762CONFIG_ATA_NONSTANDARD=y
763CONFIG_SATA_PMP=y
750# CONFIG_SATA_AHCI is not set 764# CONFIG_SATA_AHCI is not set
751CONFIG_SATA_SVW=y
752# CONFIG_ATA_PIIX is not set
753CONFIG_SATA_MV=y
754# CONFIG_SATA_NV is not set
755# CONFIG_PDC_ADMA is not set
756# CONFIG_SATA_QSTOR is not set
757# CONFIG_SATA_PROMISE is not set
758# CONFIG_SATA_SX4 is not set
759# CONFIG_SATA_SIL is not set
760CONFIG_SATA_SIL24=y 765CONFIG_SATA_SIL24=y
761# CONFIG_SATA_SIS is not set 766# CONFIG_ATA_SFF is not set
762# CONFIG_SATA_ULI is not set
763# CONFIG_SATA_VIA is not set
764# CONFIG_SATA_VITESSE is not set
765# CONFIG_SATA_INIC162X is not set
766# CONFIG_PATA_ALI is not set
767# CONFIG_PATA_AMD is not set
768# CONFIG_PATA_ARTOP is not set
769# CONFIG_PATA_ATIIXP is not set
770# CONFIG_PATA_CMD640_PCI is not set
771# CONFIG_PATA_CMD64X is not set
772# CONFIG_PATA_CS5520 is not set
773# CONFIG_PATA_CS5530 is not set
774# CONFIG_PATA_CYPRESS is not set
775# CONFIG_PATA_EFAR is not set
776# CONFIG_ATA_GENERIC is not set
777# CONFIG_PATA_HPT366 is not set
778# CONFIG_PATA_HPT37X is not set
779# CONFIG_PATA_HPT3X2N is not set
780# CONFIG_PATA_HPT3X3 is not set
781# CONFIG_PATA_IT821X is not set
782# CONFIG_PATA_IT8213 is not set
783# CONFIG_PATA_JMICRON is not set
784# CONFIG_PATA_TRIFLEX is not set
785# CONFIG_PATA_MARVELL is not set
786# CONFIG_PATA_MPIIX is not set
787# CONFIG_PATA_OLDPIIX is not set
788# CONFIG_PATA_NETCELL is not set
789# CONFIG_PATA_NINJA32 is not set
790# CONFIG_PATA_NS87410 is not set
791# CONFIG_PATA_NS87415 is not set
792# CONFIG_PATA_OPTI is not set
793# CONFIG_PATA_OPTIDMA is not set
794CONFIG_PATA_PCMCIA=y
795# CONFIG_PATA_PDC_OLD is not set
796# CONFIG_PATA_RADISYS is not set
797# CONFIG_PATA_RZ1000 is not set
798# CONFIG_PATA_SC1200 is not set
799# CONFIG_PATA_SERVERWORKS is not set
800# CONFIG_PATA_PDC2027X is not set
801# CONFIG_PATA_SIL680 is not set
802# CONFIG_PATA_SIS is not set
803# CONFIG_PATA_VIA is not set
804CONFIG_PATA_WINBOND=y
805CONFIG_PATA_PLATFORM=y
806# CONFIG_PATA_OF_PLATFORM is not set
807CONFIG_PATA_SCC=y
808CONFIG_MD=y 767CONFIG_MD=y
809CONFIG_BLK_DEV_MD=y 768CONFIG_BLK_DEV_MD=y
810CONFIG_MD_LINEAR=y 769CONFIG_MD_LINEAR=y
@@ -866,6 +825,7 @@ CONFIG_WINDFARM=y
866CONFIG_WINDFARM_PM81=y 825CONFIG_WINDFARM_PM81=y
867CONFIG_WINDFARM_PM91=y 826CONFIG_WINDFARM_PM91=y
868CONFIG_WINDFARM_PM112=y 827CONFIG_WINDFARM_PM112=y
828CONFIG_WINDFARM_PM121=y
869# CONFIG_PMAC_RACKMETER is not set 829# CONFIG_PMAC_RACKMETER is not set
870CONFIG_NETDEVICES=y 830CONFIG_NETDEVICES=y
871# CONFIG_NETDEVICES_MULTIQUEUE is not set 831# CONFIG_NETDEVICES_MULTIQUEUE is not set
@@ -911,7 +871,6 @@ CONFIG_IBM_NEW_EMAC_TAH=y
911CONFIG_IBM_NEW_EMAC_EMAC4=y 871CONFIG_IBM_NEW_EMAC_EMAC4=y
912CONFIG_NET_PCI=y 872CONFIG_NET_PCI=y
913CONFIG_PCNET32=y 873CONFIG_PCNET32=y
914# CONFIG_PCNET32_NAPI is not set
915# CONFIG_AMD8111_ETH is not set 874# CONFIG_AMD8111_ETH is not set
916# CONFIG_ADAPTEC_STARFIRE is not set 875# CONFIG_ADAPTEC_STARFIRE is not set
917# CONFIG_B44 is not set 876# CONFIG_B44 is not set
@@ -947,7 +906,6 @@ CONFIG_E1000=y
947# CONFIG_SIS190 is not set 906# CONFIG_SIS190 is not set
948# CONFIG_SKGE is not set 907# CONFIG_SKGE is not set
949# CONFIG_SKY2 is not set 908# CONFIG_SKY2 is not set
950# CONFIG_SK98LIN is not set
951# CONFIG_VIA_VELOCITY is not set 909# CONFIG_VIA_VELOCITY is not set
952CONFIG_TIGON3=y 910CONFIG_TIGON3=y
953# CONFIG_BNX2 is not set 911# CONFIG_BNX2 is not set
@@ -969,6 +927,7 @@ CONFIG_PASEMI_MAC=y
969# CONFIG_MLX4_CORE is not set 927# CONFIG_MLX4_CORE is not set
970# CONFIG_TEHUTI is not set 928# CONFIG_TEHUTI is not set
971# CONFIG_BNX2X is not set 929# CONFIG_BNX2X is not set
930# CONFIG_SFC is not set
972CONFIG_TR=y 931CONFIG_TR=y
973CONFIG_IBMOL=y 932CONFIG_IBMOL=y
974# CONFIG_3C359 is not set 933# CONFIG_3C359 is not set
@@ -979,6 +938,7 @@ CONFIG_IBMOL=y
979# 938#
980# CONFIG_WLAN_PRE80211 is not set 939# CONFIG_WLAN_PRE80211 is not set
981# CONFIG_WLAN_80211 is not set 940# CONFIG_WLAN_80211 is not set
941# CONFIG_IWLWIFI_LEDS is not set
982 942
983# 943#
984# USB Network Adapters 944# USB Network Adapters
@@ -1083,6 +1043,7 @@ CONFIG_VT=y
1083CONFIG_VT_CONSOLE=y 1043CONFIG_VT_CONSOLE=y
1084CONFIG_HW_CONSOLE=y 1044CONFIG_HW_CONSOLE=y
1085# CONFIG_VT_HW_CONSOLE_BINDING is not set 1045# CONFIG_VT_HW_CONSOLE_BINDING is not set
1046CONFIG_DEVKMEM=y
1086# CONFIG_SERIAL_NONSTANDARD is not set 1047# CONFIG_SERIAL_NONSTANDARD is not set
1087# CONFIG_NOZOMI is not set 1048# CONFIG_NOZOMI is not set
1088 1049
@@ -1121,8 +1082,6 @@ CONFIG_HVC_BEAT=y
1121CONFIG_HVCS=m 1082CONFIG_HVCS=m
1122# CONFIG_IPMI_HANDLER is not set 1083# CONFIG_IPMI_HANDLER is not set
1123# CONFIG_HW_RANDOM is not set 1084# CONFIG_HW_RANDOM is not set
1124CONFIG_GEN_RTC=y
1125# CONFIG_GEN_RTC_X is not set
1126# CONFIG_R3964 is not set 1085# CONFIG_R3964 is not set
1127# CONFIG_APPLICOM is not set 1086# CONFIG_APPLICOM is not set
1128 1087
@@ -1141,13 +1100,7 @@ CONFIG_DEVPORT=y
1141CONFIG_I2C=y 1100CONFIG_I2C=y
1142CONFIG_I2C_BOARDINFO=y 1101CONFIG_I2C_BOARDINFO=y
1143CONFIG_I2C_CHARDEV=y 1102CONFIG_I2C_CHARDEV=y
1144
1145#
1146# I2C Algorithms
1147#
1148CONFIG_I2C_ALGOBIT=y 1103CONFIG_I2C_ALGOBIT=y
1149# CONFIG_I2C_ALGOPCF is not set
1150# CONFIG_I2C_ALGOPCA is not set
1151 1104
1152# 1105#
1153# I2C Hardware Bus support 1106# I2C Hardware Bus support
@@ -1177,6 +1130,7 @@ CONFIG_I2C_PASEMI=y
1177# CONFIG_I2C_VIA is not set 1130# CONFIG_I2C_VIA is not set
1178# CONFIG_I2C_VIAPRO is not set 1131# CONFIG_I2C_VIAPRO is not set
1179# CONFIG_I2C_VOODOO3 is not set 1132# CONFIG_I2C_VOODOO3 is not set
1133# CONFIG_I2C_PCA_PLATFORM is not set
1180 1134
1181# 1135#
1182# Miscellaneous I2C Chip support 1136# Miscellaneous I2C Chip support
@@ -1186,19 +1140,13 @@ CONFIG_I2C_PASEMI=y
1186# CONFIG_SENSORS_PCF8574 is not set 1140# CONFIG_SENSORS_PCF8574 is not set
1187# CONFIG_PCF8575 is not set 1141# CONFIG_PCF8575 is not set
1188# CONFIG_SENSORS_PCF8591 is not set 1142# CONFIG_SENSORS_PCF8591 is not set
1189# CONFIG_TPS65010 is not set
1190# CONFIG_SENSORS_MAX6875 is not set 1143# CONFIG_SENSORS_MAX6875 is not set
1191# CONFIG_SENSORS_TSL2550 is not set 1144# CONFIG_SENSORS_TSL2550 is not set
1192# CONFIG_I2C_DEBUG_CORE is not set 1145# CONFIG_I2C_DEBUG_CORE is not set
1193# CONFIG_I2C_DEBUG_ALGO is not set 1146# CONFIG_I2C_DEBUG_ALGO is not set
1194# CONFIG_I2C_DEBUG_BUS is not set 1147# CONFIG_I2C_DEBUG_BUS is not set
1195# CONFIG_I2C_DEBUG_CHIP is not set 1148# CONFIG_I2C_DEBUG_CHIP is not set
1196
1197#
1198# SPI support
1199#
1200# CONFIG_SPI is not set 1149# CONFIG_SPI is not set
1201# CONFIG_SPI_MASTER is not set
1202# CONFIG_W1 is not set 1150# CONFIG_W1 is not set
1203# CONFIG_POWER_SUPPLY is not set 1151# CONFIG_POWER_SUPPLY is not set
1204# CONFIG_HWMON is not set 1152# CONFIG_HWMON is not set
@@ -1215,12 +1163,22 @@ CONFIG_SSB_POSSIBLE=y
1215# Multifunction device drivers 1163# Multifunction device drivers
1216# 1164#
1217# CONFIG_MFD_SM501 is not set 1165# CONFIG_MFD_SM501 is not set
1166# CONFIG_HTC_PASIC3 is not set
1218 1167
1219# 1168#
1220# Multimedia devices 1169# Multimedia devices
1221# 1170#
1171
1172#
1173# Multimedia core support
1174#
1222# CONFIG_VIDEO_DEV is not set 1175# CONFIG_VIDEO_DEV is not set
1223# CONFIG_DVB_CORE is not set 1176# CONFIG_DVB_CORE is not set
1177# CONFIG_VIDEO_MEDIA is not set
1178
1179#
1180# Multimedia drivers
1181#
1224# CONFIG_DAB is not set 1182# CONFIG_DAB is not set
1225 1183
1226# 1184#
@@ -1240,8 +1198,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
1240# CONFIG_FB_SYS_FILLRECT is not set 1198# CONFIG_FB_SYS_FILLRECT is not set
1241# CONFIG_FB_SYS_COPYAREA is not set 1199# CONFIG_FB_SYS_COPYAREA is not set
1242# CONFIG_FB_SYS_IMAGEBLIT is not set 1200# CONFIG_FB_SYS_IMAGEBLIT is not set
1201# CONFIG_FB_FOREIGN_ENDIAN is not set
1243# CONFIG_FB_SYS_FOPS is not set 1202# CONFIG_FB_SYS_FOPS is not set
1244CONFIG_FB_DEFERRED_IO=y
1245# CONFIG_FB_SVGALIB is not set 1203# CONFIG_FB_SVGALIB is not set
1246CONFIG_FB_MACMODES=y 1204CONFIG_FB_MACMODES=y
1247CONFIG_FB_BACKLIGHT=y 1205CONFIG_FB_BACKLIGHT=y
@@ -1363,6 +1321,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
1363# CONFIG_SND_AU8810 is not set 1321# CONFIG_SND_AU8810 is not set
1364# CONFIG_SND_AU8820 is not set 1322# CONFIG_SND_AU8820 is not set
1365# CONFIG_SND_AU8830 is not set 1323# CONFIG_SND_AU8830 is not set
1324# CONFIG_SND_AW2 is not set
1366# CONFIG_SND_AZT3328 is not set 1325# CONFIG_SND_AZT3328 is not set
1367# CONFIG_SND_BT87X is not set 1326# CONFIG_SND_BT87X is not set
1368# CONFIG_SND_CA0106 is not set 1327# CONFIG_SND_CA0106 is not set
@@ -1455,11 +1414,11 @@ CONFIG_SND_AOA_SOUNDBUS_I2S=m
1455# CONFIG_SND_SOC is not set 1414# CONFIG_SND_SOC is not set
1456 1415
1457# 1416#
1458# SoC Audio support for SuperH 1417# ALSA SoC audio for Freescale SOCs
1459# 1418#
1460 1419
1461# 1420#
1462# ALSA SoC audio for Freescale SOCs 1421# SoC Audio for the Texas Instruments OMAP
1463# 1422#
1464 1423
1465# 1424#
@@ -1497,12 +1456,14 @@ CONFIG_USB_DEVICE_CLASS=y
1497# 1456#
1498# USB Host Controller Drivers 1457# USB Host Controller Drivers
1499# 1458#
1459# CONFIG_USB_C67X00_HCD is not set
1500CONFIG_USB_EHCI_HCD=y 1460CONFIG_USB_EHCI_HCD=y
1501# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1461# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1502CONFIG_USB_EHCI_TT_NEWSCHED=y 1462CONFIG_USB_EHCI_TT_NEWSCHED=y
1503CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y 1463CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
1504# CONFIG_USB_EHCI_HCD_PPC_OF is not set 1464# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1505# CONFIG_USB_ISP116X_HCD is not set 1465# CONFIG_USB_ISP116X_HCD is not set
1466# CONFIG_USB_ISP1760_HCD is not set
1506CONFIG_USB_OHCI_HCD=y 1467CONFIG_USB_OHCI_HCD=y
1507# CONFIG_USB_OHCI_HCD_PPC_OF is not set 1468# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1508# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1469# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1538,6 +1499,7 @@ CONFIG_USB_STORAGE=m
1538# CONFIG_USB_STORAGE_ALAUDA is not set 1499# CONFIG_USB_STORAGE_ALAUDA is not set
1539# CONFIG_USB_STORAGE_ONETOUCH is not set 1500# CONFIG_USB_STORAGE_ONETOUCH is not set
1540# CONFIG_USB_STORAGE_KARMA is not set 1501# CONFIG_USB_STORAGE_KARMA is not set
1502# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1541# CONFIG_USB_LIBUSUAL is not set 1503# CONFIG_USB_LIBUSUAL is not set
1542 1504
1543# 1505#
@@ -1579,6 +1541,7 @@ CONFIG_USB_APPLEDISPLAY=m
1579# CONFIG_MMC is not set 1541# CONFIG_MMC is not set
1580# CONFIG_MEMSTICK is not set 1542# CONFIG_MEMSTICK is not set
1581# CONFIG_NEW_LEDS is not set 1543# CONFIG_NEW_LEDS is not set
1544# CONFIG_ACCESSIBILITY is not set
1582CONFIG_INFINIBAND=m 1545CONFIG_INFINIBAND=m
1583# CONFIG_INFINIBAND_USER_MAD is not set 1546# CONFIG_INFINIBAND_USER_MAD is not set
1584# CONFIG_INFINIBAND_USER_ACCESS is not set 1547# CONFIG_INFINIBAND_USER_ACCESS is not set
@@ -1607,10 +1570,6 @@ CONFIG_EDAC_PASEMI=y
1607# CONFIG_EDAC_CELL is not set 1570# CONFIG_EDAC_CELL is not set
1608CONFIG_RTC_LIB=y 1571CONFIG_RTC_LIB=y
1609CONFIG_RTC_CLASS=y 1572CONFIG_RTC_CLASS=y
1610
1611#
1612# Conflicting RTC option has been selected, check GEN_RTC and RTC
1613#
1614CONFIG_RTC_HCTOSYS=y 1573CONFIG_RTC_HCTOSYS=y
1615CONFIG_RTC_HCTOSYS_DEVICE="rtc0" 1574CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1616# CONFIG_RTC_DEBUG is not set 1575# CONFIG_RTC_DEBUG is not set
@@ -1659,10 +1618,6 @@ CONFIG_RTC_DRV_DS1307=y
1659# on-CPU RTC drivers 1618# on-CPU RTC drivers
1660# 1619#
1661# CONFIG_DMADEVICES is not set 1620# CONFIG_DMADEVICES is not set
1662
1663#
1664# Userspace I/O
1665#
1666# CONFIG_UIO is not set 1621# CONFIG_UIO is not set
1667 1622
1668# 1623#
@@ -1696,9 +1651,9 @@ CONFIG_JFS_SECURITY=y
1696CONFIG_FS_POSIX_ACL=y 1651CONFIG_FS_POSIX_ACL=y
1697CONFIG_XFS_FS=m 1652CONFIG_XFS_FS=m
1698# CONFIG_XFS_QUOTA is not set 1653# CONFIG_XFS_QUOTA is not set
1699CONFIG_XFS_SECURITY=y
1700CONFIG_XFS_POSIX_ACL=y 1654CONFIG_XFS_POSIX_ACL=y
1701# CONFIG_XFS_RT is not set 1655# CONFIG_XFS_RT is not set
1656# CONFIG_XFS_DEBUG is not set
1702# CONFIG_GFS2_FS is not set 1657# CONFIG_GFS2_FS is not set
1703# CONFIG_OCFS2_FS is not set 1658# CONFIG_OCFS2_FS is not set
1704CONFIG_DNOTIFY=y 1659CONFIG_DNOTIFY=y
@@ -1764,13 +1719,11 @@ CONFIG_NFS_FS=y
1764CONFIG_NFS_V3=y 1719CONFIG_NFS_V3=y
1765CONFIG_NFS_V3_ACL=y 1720CONFIG_NFS_V3_ACL=y
1766CONFIG_NFS_V4=y 1721CONFIG_NFS_V4=y
1767# CONFIG_NFS_DIRECTIO is not set
1768CONFIG_NFSD=m 1722CONFIG_NFSD=m
1769CONFIG_NFSD_V2_ACL=y 1723CONFIG_NFSD_V2_ACL=y
1770CONFIG_NFSD_V3=y 1724CONFIG_NFSD_V3=y
1771CONFIG_NFSD_V3_ACL=y 1725CONFIG_NFSD_V3_ACL=y
1772CONFIG_NFSD_V4=y 1726CONFIG_NFSD_V4=y
1773CONFIG_NFSD_TCP=y
1774CONFIG_ROOT_NFS=y 1727CONFIG_ROOT_NFS=y
1775CONFIG_LOCKD=y 1728CONFIG_LOCKD=y
1776CONFIG_LOCKD_V4=y 1729CONFIG_LOCKD_V4=y
@@ -1862,9 +1815,10 @@ CONFIG_NLS_UTF8=m
1862# Library routines 1815# Library routines
1863# 1816#
1864CONFIG_BITREVERSE=y 1817CONFIG_BITREVERSE=y
1818# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1865CONFIG_CRC_CCITT=m 1819CONFIG_CRC_CCITT=m
1866# CONFIG_CRC16 is not set 1820# CONFIG_CRC16 is not set
1867# CONFIG_CRC_ITU_T is not set 1821CONFIG_CRC_ITU_T=m
1868CONFIG_CRC32=y 1822CONFIG_CRC32=y
1869# CONFIG_CRC7 is not set 1823# CONFIG_CRC7 is not set
1870CONFIG_LIBCRC32C=m 1824CONFIG_LIBCRC32C=m
@@ -1888,6 +1842,7 @@ CONFIG_HAVE_LMB=y
1888# CONFIG_PRINTK_TIME is not set 1842# CONFIG_PRINTK_TIME is not set
1889CONFIG_ENABLE_WARN_DEPRECATED=y 1843CONFIG_ENABLE_WARN_DEPRECATED=y
1890CONFIG_ENABLE_MUST_CHECK=y 1844CONFIG_ENABLE_MUST_CHECK=y
1845CONFIG_FRAME_WARN=2048
1891CONFIG_MAGIC_SYSRQ=y 1846CONFIG_MAGIC_SYSRQ=y
1892# CONFIG_UNUSED_SYMBOLS is not set 1847# CONFIG_UNUSED_SYMBOLS is not set
1893CONFIG_DEBUG_FS=y 1848CONFIG_DEBUG_FS=y
@@ -1898,18 +1853,23 @@ CONFIG_DETECT_SOFTLOCKUP=y
1898CONFIG_SCHED_DEBUG=y 1853CONFIG_SCHED_DEBUG=y
1899# CONFIG_SCHEDSTATS is not set 1854# CONFIG_SCHEDSTATS is not set
1900# CONFIG_TIMER_STATS is not set 1855# CONFIG_TIMER_STATS is not set
1856# CONFIG_DEBUG_OBJECTS is not set
1901# CONFIG_SLUB_DEBUG_ON is not set 1857# CONFIG_SLUB_DEBUG_ON is not set
1902# CONFIG_SLUB_STATS is not set 1858# CONFIG_SLUB_STATS is not set
1903# CONFIG_DEBUG_RT_MUTEXES is not set 1859# CONFIG_DEBUG_RT_MUTEXES is not set
1904# CONFIG_RT_MUTEX_TESTER is not set 1860# CONFIG_RT_MUTEX_TESTER is not set
1905# CONFIG_DEBUG_SPINLOCK is not set 1861# CONFIG_DEBUG_SPINLOCK is not set
1906CONFIG_DEBUG_MUTEXES=y 1862CONFIG_DEBUG_MUTEXES=y
1863# CONFIG_DEBUG_LOCK_ALLOC is not set
1864# CONFIG_PROVE_LOCKING is not set
1865# CONFIG_LOCK_STAT is not set
1907# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1866# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1908# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1867# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1909# CONFIG_DEBUG_KOBJECT is not set 1868# CONFIG_DEBUG_KOBJECT is not set
1910CONFIG_DEBUG_BUGVERBOSE=y 1869CONFIG_DEBUG_BUGVERBOSE=y
1911# CONFIG_DEBUG_INFO is not set 1870# CONFIG_DEBUG_INFO is not set
1912# CONFIG_DEBUG_VM is not set 1871# CONFIG_DEBUG_VM is not set
1872# CONFIG_DEBUG_WRITECOUNT is not set
1913# CONFIG_DEBUG_LIST is not set 1873# CONFIG_DEBUG_LIST is not set
1914# CONFIG_DEBUG_SG is not set 1874# CONFIG_DEBUG_SG is not set
1915# CONFIG_BOOT_PRINTK_DELAY is not set 1875# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1941,53 +1901,83 @@ CONFIG_ASYNC_CORE=y
1941CONFIG_ASYNC_MEMCPY=y 1901CONFIG_ASYNC_MEMCPY=y
1942CONFIG_ASYNC_XOR=y 1902CONFIG_ASYNC_XOR=y
1943CONFIG_CRYPTO=y 1903CONFIG_CRYPTO=y
1904
1905#
1906# Crypto core or helper
1907#
1944CONFIG_CRYPTO_ALGAPI=y 1908CONFIG_CRYPTO_ALGAPI=y
1945CONFIG_CRYPTO_AEAD=m 1909CONFIG_CRYPTO_AEAD=m
1946CONFIG_CRYPTO_BLKCIPHER=y 1910CONFIG_CRYPTO_BLKCIPHER=y
1947CONFIG_CRYPTO_SEQIV=m
1948CONFIG_CRYPTO_HASH=y 1911CONFIG_CRYPTO_HASH=y
1949CONFIG_CRYPTO_MANAGER=y 1912CONFIG_CRYPTO_MANAGER=y
1913CONFIG_CRYPTO_GF128MUL=m
1914CONFIG_CRYPTO_NULL=m
1915# CONFIG_CRYPTO_CRYPTD is not set
1916CONFIG_CRYPTO_AUTHENC=m
1917CONFIG_CRYPTO_TEST=m
1918
1919#
1920# Authenticated Encryption with Associated Data
1921#
1922CONFIG_CRYPTO_CCM=m
1923CONFIG_CRYPTO_GCM=m
1924CONFIG_CRYPTO_SEQIV=m
1925
1926#
1927# Block modes
1928#
1929CONFIG_CRYPTO_CBC=y
1930CONFIG_CRYPTO_CTR=m
1931# CONFIG_CRYPTO_CTS is not set
1932CONFIG_CRYPTO_ECB=m
1933# CONFIG_CRYPTO_LRW is not set
1934CONFIG_CRYPTO_PCBC=m
1935# CONFIG_CRYPTO_XTS is not set
1936
1937#
1938# Hash modes
1939#
1950CONFIG_CRYPTO_HMAC=y 1940CONFIG_CRYPTO_HMAC=y
1951# CONFIG_CRYPTO_XCBC is not set 1941# CONFIG_CRYPTO_XCBC is not set
1952CONFIG_CRYPTO_NULL=m 1942
1943#
1944# Digest
1945#
1946CONFIG_CRYPTO_CRC32C=m
1953CONFIG_CRYPTO_MD4=m 1947CONFIG_CRYPTO_MD4=m
1954CONFIG_CRYPTO_MD5=y 1948CONFIG_CRYPTO_MD5=y
1949CONFIG_CRYPTO_MICHAEL_MIC=m
1955CONFIG_CRYPTO_SHA1=m 1950CONFIG_CRYPTO_SHA1=m
1956CONFIG_CRYPTO_SHA256=m 1951CONFIG_CRYPTO_SHA256=m
1957CONFIG_CRYPTO_SHA512=m 1952CONFIG_CRYPTO_SHA512=m
1958CONFIG_CRYPTO_WP512=m
1959CONFIG_CRYPTO_TGR192=m 1953CONFIG_CRYPTO_TGR192=m
1960CONFIG_CRYPTO_GF128MUL=m 1954CONFIG_CRYPTO_WP512=m
1961CONFIG_CRYPTO_ECB=m 1955
1962CONFIG_CRYPTO_CBC=y 1956#
1963CONFIG_CRYPTO_PCBC=m 1957# Ciphers
1964# CONFIG_CRYPTO_LRW is not set 1958#
1965# CONFIG_CRYPTO_XTS is not set
1966CONFIG_CRYPTO_CTR=m
1967CONFIG_CRYPTO_GCM=m
1968CONFIG_CRYPTO_CCM=m
1969# CONFIG_CRYPTO_CRYPTD is not set
1970CONFIG_CRYPTO_DES=y
1971# CONFIG_CRYPTO_FCRYPT is not set
1972CONFIG_CRYPTO_BLOWFISH=m
1973CONFIG_CRYPTO_TWOFISH=m
1974CONFIG_CRYPTO_TWOFISH_COMMON=m
1975CONFIG_CRYPTO_SERPENT=m
1976CONFIG_CRYPTO_AES=m 1959CONFIG_CRYPTO_AES=m
1960CONFIG_CRYPTO_ANUBIS=m
1961CONFIG_CRYPTO_ARC4=m
1962CONFIG_CRYPTO_BLOWFISH=m
1963# CONFIG_CRYPTO_CAMELLIA is not set
1977CONFIG_CRYPTO_CAST5=m 1964CONFIG_CRYPTO_CAST5=m
1978CONFIG_CRYPTO_CAST6=m 1965CONFIG_CRYPTO_CAST6=m
1979CONFIG_CRYPTO_TEA=m 1966CONFIG_CRYPTO_DES=y
1980CONFIG_CRYPTO_ARC4=m 1967# CONFIG_CRYPTO_FCRYPT is not set
1981CONFIG_CRYPTO_KHAZAD=m 1968CONFIG_CRYPTO_KHAZAD=m
1982CONFIG_CRYPTO_ANUBIS=m
1983# CONFIG_CRYPTO_SEED is not set
1984CONFIG_CRYPTO_SALSA20=m 1969CONFIG_CRYPTO_SALSA20=m
1970# CONFIG_CRYPTO_SEED is not set
1971CONFIG_CRYPTO_SERPENT=m
1972CONFIG_CRYPTO_TEA=m
1973CONFIG_CRYPTO_TWOFISH=m
1974CONFIG_CRYPTO_TWOFISH_COMMON=m
1975
1976#
1977# Compression
1978#
1985CONFIG_CRYPTO_DEFLATE=m 1979CONFIG_CRYPTO_DEFLATE=m
1986CONFIG_CRYPTO_MICHAEL_MIC=m
1987CONFIG_CRYPTO_CRC32C=m
1988# CONFIG_CRYPTO_CAMELLIA is not set
1989CONFIG_CRYPTO_TEST=m
1990CONFIG_CRYPTO_AUTHENC=m
1991CONFIG_CRYPTO_LZO=m 1980CONFIG_CRYPTO_LZO=m
1992# CONFIG_CRYPTO_HW is not set 1981# CONFIG_CRYPTO_HW is not set
1993# CONFIG_PPC_CLOCK is not set 1982# CONFIG_PPC_CLOCK is not set
1983# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 3e2593c60b12..adaa05fb0478 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_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.25-rc6 3# Linux kernel version: 2.6.26-rc3
4# Thu Mar 27 13:56:28 2008 4# Tue May 20 20:03:28 2008
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -30,6 +30,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
30CONFIG_GENERIC_HARDIRQS=y 30CONFIG_GENERIC_HARDIRQS=y
31CONFIG_HAVE_SETUP_PER_CPU_AREA=y 31CONFIG_HAVE_SETUP_PER_CPU_AREA=y
32CONFIG_IRQ_PER_CPU=y 32CONFIG_IRQ_PER_CPU=y
33CONFIG_STACKTRACE_SUPPORT=y
34CONFIG_TRACE_IRQFLAGS_SUPPORT=y
35CONFIG_LOCKDEP_SUPPORT=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y 36CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y 37CONFIG_ARCH_HAS_ILOG2_U32=y
35CONFIG_ARCH_HAS_ILOG2_U64=y 38CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -81,6 +84,7 @@ CONFIG_LOG_BUF_SHIFT=17
81CONFIG_CGROUPS=y 84CONFIG_CGROUPS=y
82# CONFIG_CGROUP_DEBUG is not set 85# CONFIG_CGROUP_DEBUG is not set
83CONFIG_CGROUP_NS=y 86CONFIG_CGROUP_NS=y
87CONFIG_CGROUP_DEVICE=y
84CONFIG_CPUSETS=y 88CONFIG_CPUSETS=y
85# CONFIG_GROUP_SCHED is not set 89# CONFIG_GROUP_SCHED is not set
86CONFIG_CGROUP_CPUACCT=y 90CONFIG_CGROUP_CPUACCT=y
@@ -100,6 +104,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
100CONFIG_SYSCTL=y 104CONFIG_SYSCTL=y
101# CONFIG_EMBEDDED is not set 105# CONFIG_EMBEDDED is not set
102CONFIG_SYSCTL_SYSCALL=y 106CONFIG_SYSCTL_SYSCALL=y
107CONFIG_SYSCTL_SYSCALL_CHECK=y
103CONFIG_KALLSYMS=y 108CONFIG_KALLSYMS=y
104CONFIG_KALLSYMS_ALL=y 109CONFIG_KALLSYMS_ALL=y
105# CONFIG_KALLSYMS_EXTRA_PASS is not set 110# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -107,6 +112,7 @@ CONFIG_HOTPLUG=y
107CONFIG_PRINTK=y 112CONFIG_PRINTK=y
108CONFIG_BUG=y 113CONFIG_BUG=y
109CONFIG_ELF_CORE=y 114CONFIG_ELF_CORE=y
115CONFIG_PCSPKR_PLATFORM=y
110# CONFIG_COMPAT_BRK is not set 116# CONFIG_COMPAT_BRK is not set
111CONFIG_BASE_FULL=y 117CONFIG_BASE_FULL=y
112CONFIG_FUTEX=y 118CONFIG_FUTEX=y
@@ -129,12 +135,14 @@ CONFIG_KPROBES=y
129CONFIG_KRETPROBES=y 135CONFIG_KRETPROBES=y
130CONFIG_HAVE_KPROBES=y 136CONFIG_HAVE_KPROBES=y
131CONFIG_HAVE_KRETPROBES=y 137CONFIG_HAVE_KRETPROBES=y
138# CONFIG_HAVE_DMA_ATTRS is not set
132CONFIG_PROC_PAGE_MONITOR=y 139CONFIG_PROC_PAGE_MONITOR=y
133CONFIG_SLABINFO=y 140CONFIG_SLABINFO=y
134CONFIG_RT_MUTEXES=y 141CONFIG_RT_MUTEXES=y
135# CONFIG_TINY_SHMEM is not set 142# CONFIG_TINY_SHMEM is not set
136CONFIG_BASE_SMALL=0 143CONFIG_BASE_SMALL=0
137CONFIG_MODULES=y 144CONFIG_MODULES=y
145# CONFIG_MODULE_FORCE_LOAD is not set
138CONFIG_MODULE_UNLOAD=y 146CONFIG_MODULE_UNLOAD=y
139# CONFIG_MODULE_FORCE_UNLOAD is not set 147# CONFIG_MODULE_FORCE_UNLOAD is not set
140CONFIG_MODVERSIONS=y 148CONFIG_MODVERSIONS=y
@@ -178,11 +186,11 @@ CONFIG_LPARCFG=y
178# CONFIG_PPC_PMAC is not set 186# CONFIG_PPC_PMAC is not set
179# CONFIG_PPC_MAPLE is not set 187# CONFIG_PPC_MAPLE is not set
180# CONFIG_PPC_PASEMI is not set 188# CONFIG_PPC_PASEMI is not set
181# CONFIG_PPC_CELLEB is not set
182# CONFIG_PPC_PS3 is not set 189# CONFIG_PPC_PS3 is not set
183# CONFIG_PPC_CELL is not set 190# CONFIG_PPC_CELL is not set
184# CONFIG_PPC_CELL_NATIVE is not set 191# CONFIG_PPC_CELL_NATIVE is not set
185# CONFIG_PPC_IBM_CELL_BLADE is not set 192# CONFIG_PPC_IBM_CELL_BLADE is not set
193# CONFIG_PPC_CELLEB is not set
186# CONFIG_PQ2ADS is not set 194# CONFIG_PQ2ADS is not set
187CONFIG_PPC_NATIVE=y 195CONFIG_PPC_NATIVE=y
188# CONFIG_UDBG_RTAS_CONSOLE is not set 196# CONFIG_UDBG_RTAS_CONSOLE is not set
@@ -225,7 +233,6 @@ CONFIG_PREEMPT_NONE=y
225CONFIG_BINFMT_ELF=y 233CONFIG_BINFMT_ELF=y
226CONFIG_COMPAT_BINFMT_ELF=y 234CONFIG_COMPAT_BINFMT_ELF=y
227CONFIG_BINFMT_MISC=m 235CONFIG_BINFMT_MISC=m
228CONFIG_FORCE_MAX_ZONEORDER=13
229CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y 236CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
230CONFIG_IOMMU_VMERGE=y 237CONFIG_IOMMU_VMERGE=y
231CONFIG_IOMMU_HELPER=y 238CONFIG_IOMMU_HELPER=y
@@ -255,6 +262,7 @@ CONFIG_SPARSEMEM_EXTREME=y
255CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 262CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
256CONFIG_SPARSEMEM_VMEMMAP=y 263CONFIG_SPARSEMEM_VMEMMAP=y
257# CONFIG_MEMORY_HOTPLUG is not set 264# CONFIG_MEMORY_HOTPLUG is not set
265CONFIG_PAGEFLAGS_EXTENDED=y
258CONFIG_SPLIT_PTLOCK_CPUS=4 266CONFIG_SPLIT_PTLOCK_CPUS=4
259CONFIG_MIGRATION=y 267CONFIG_MIGRATION=y
260CONFIG_RESOURCES_64BIT=y 268CONFIG_RESOURCES_64BIT=y
@@ -263,6 +271,7 @@ CONFIG_BOUNCE=y
263CONFIG_NODES_SPAN_OTHER_NODES=y 271CONFIG_NODES_SPAN_OTHER_NODES=y
264# CONFIG_PPC_HAS_HASH_64K is not set 272# CONFIG_PPC_HAS_HASH_64K is not set
265# CONFIG_PPC_64K_PAGES is not set 273# CONFIG_PPC_64K_PAGES is not set
274CONFIG_FORCE_MAX_ZONEORDER=13
266CONFIG_SCHED_SMT=y 275CONFIG_SCHED_SMT=y
267CONFIG_PROC_DEVICETREE=y 276CONFIG_PROC_DEVICETREE=y
268# CONFIG_CMDLINE_BOOL is not set 277# CONFIG_CMDLINE_BOOL is not set
@@ -291,7 +300,10 @@ CONFIG_HOTPLUG_PCI=m
291# CONFIG_HOTPLUG_PCI_SHPC is not set 300# CONFIG_HOTPLUG_PCI_SHPC is not set
292CONFIG_HOTPLUG_PCI_RPA=m 301CONFIG_HOTPLUG_PCI_RPA=m
293CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 302CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
303# CONFIG_HAS_RAPIDIO is not set
304CONFIG_PAGE_OFFSET=0xc000000000000000
294CONFIG_KERNEL_START=0xc000000000000000 305CONFIG_KERNEL_START=0xc000000000000000
306CONFIG_PHYSICAL_START=0x00000000
295 307
296# 308#
297# Networking 309# Networking
@@ -338,8 +350,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
338# CONFIG_TCP_MD5SIG is not set 350# CONFIG_TCP_MD5SIG is not set
339# CONFIG_IP_VS is not set 351# CONFIG_IP_VS is not set
340# CONFIG_IPV6 is not set 352# CONFIG_IPV6 is not set
341# CONFIG_INET6_XFRM_TUNNEL is not set
342# CONFIG_INET6_TUNNEL is not set
343# CONFIG_NETWORK_SECMARK is not set 353# CONFIG_NETWORK_SECMARK is not set
344CONFIG_NETFILTER=y 354CONFIG_NETFILTER=y
345# CONFIG_NETFILTER_DEBUG is not set 355# CONFIG_NETFILTER_DEBUG is not set
@@ -355,6 +365,7 @@ CONFIG_NF_CONNTRACK=m
355CONFIG_NF_CT_ACCT=y 365CONFIG_NF_CT_ACCT=y
356CONFIG_NF_CONNTRACK_MARK=y 366CONFIG_NF_CONNTRACK_MARK=y
357CONFIG_NF_CONNTRACK_EVENTS=y 367CONFIG_NF_CONNTRACK_EVENTS=y
368# CONFIG_NF_CT_PROTO_DCCP is not set
358# CONFIG_NF_CT_PROTO_SCTP is not set 369# CONFIG_NF_CT_PROTO_SCTP is not set
359CONFIG_NF_CT_PROTO_UDPLITE=m 370CONFIG_NF_CT_PROTO_UDPLITE=m
360# CONFIG_NF_CONNTRACK_AMANDA is not set 371# CONFIG_NF_CONNTRACK_AMANDA is not set
@@ -426,6 +437,7 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
426CONFIG_IP_NF_TARGET_REDIRECT=m 437CONFIG_IP_NF_TARGET_REDIRECT=m
427CONFIG_IP_NF_TARGET_NETMAP=m 438CONFIG_IP_NF_TARGET_NETMAP=m
428CONFIG_NF_NAT_SNMP_BASIC=m 439CONFIG_NF_NAT_SNMP_BASIC=m
440CONFIG_NF_NAT_PROTO_UDPLITE=m
429CONFIG_NF_NAT_FTP=m 441CONFIG_NF_NAT_FTP=m
430CONFIG_NF_NAT_IRC=m 442CONFIG_NF_NAT_IRC=m
431CONFIG_NF_NAT_TFTP=m 443CONFIG_NF_NAT_TFTP=m
@@ -492,6 +504,7 @@ CONFIG_FW_LOADER=y
492# CONFIG_CONNECTOR is not set 504# CONFIG_CONNECTOR is not set
493# CONFIG_MTD is not set 505# CONFIG_MTD is not set
494CONFIG_OF_DEVICE=y 506CONFIG_OF_DEVICE=y
507CONFIG_OF_I2C=y
495CONFIG_PARPORT=m 508CONFIG_PARPORT=m
496CONFIG_PARPORT_PC=m 509CONFIG_PARPORT_PC=m
497# CONFIG_PARPORT_SERIAL is not set 510# CONFIG_PARPORT_SERIAL is not set
@@ -545,7 +558,6 @@ CONFIG_IDE_PROC_FS=y
545# 558#
546# IDE chipset support/bugfixes 559# IDE chipset support/bugfixes
547# 560#
548CONFIG_IDE_GENERIC=y
549# CONFIG_BLK_DEV_PLATFORM is not set 561# CONFIG_BLK_DEV_PLATFORM is not set
550CONFIG_BLK_DEV_IDEDMA_SFF=y 562CONFIG_BLK_DEV_IDEDMA_SFF=y
551 563
@@ -584,7 +596,7 @@ CONFIG_BLK_DEV_AMD74XX=y
584# CONFIG_BLK_DEV_VIA82CXXX is not set 596# CONFIG_BLK_DEV_VIA82CXXX is not set
585# CONFIG_BLK_DEV_TC86C001 is not set 597# CONFIG_BLK_DEV_TC86C001 is not set
586CONFIG_BLK_DEV_IDEDMA=y 598CONFIG_BLK_DEV_IDEDMA=y
587CONFIG_IDE_ARCH_OBSOLETE_INIT=y 599# CONFIG_BLK_DEV_HD_ONLY is not set
588# CONFIG_BLK_DEV_HD is not set 600# CONFIG_BLK_DEV_HD is not set
589 601
590# 602#
@@ -671,61 +683,10 @@ CONFIG_SCSI_LPFC=m
671# CONFIG_SCSI_SRP is not set 683# CONFIG_SCSI_SRP is not set
672CONFIG_ATA=y 684CONFIG_ATA=y
673# CONFIG_ATA_NONSTANDARD is not set 685# CONFIG_ATA_NONSTANDARD is not set
686CONFIG_SATA_PMP=y
674# CONFIG_SATA_AHCI is not set 687# CONFIG_SATA_AHCI is not set
675# CONFIG_SATA_SVW is not set
676# CONFIG_ATA_PIIX is not set
677# CONFIG_SATA_MV is not set
678# CONFIG_SATA_NV is not set
679# CONFIG_PDC_ADMA is not set
680# CONFIG_SATA_QSTOR is not set
681# CONFIG_SATA_PROMISE is not set
682# CONFIG_SATA_SX4 is not set
683# CONFIG_SATA_SIL is not set
684# CONFIG_SATA_SIL24 is not set 688# CONFIG_SATA_SIL24 is not set
685# CONFIG_SATA_SIS is not set 689# CONFIG_ATA_SFF is not set
686# CONFIG_SATA_ULI is not set
687# CONFIG_SATA_VIA is not set
688# CONFIG_SATA_VITESSE is not set
689# CONFIG_SATA_INIC162X is not set
690# CONFIG_PATA_ALI is not set
691# CONFIG_PATA_AMD is not set
692# CONFIG_PATA_ARTOP is not set
693# CONFIG_PATA_ATIIXP is not set
694# CONFIG_PATA_CMD640_PCI is not set
695# CONFIG_PATA_CMD64X is not set
696# CONFIG_PATA_CS5520 is not set
697# CONFIG_PATA_CS5530 is not set
698# CONFIG_PATA_CYPRESS is not set
699# CONFIG_PATA_EFAR is not set
700# CONFIG_ATA_GENERIC is not set
701# CONFIG_PATA_HPT366 is not set
702# CONFIG_PATA_HPT37X is not set
703# CONFIG_PATA_HPT3X2N is not set
704# CONFIG_PATA_HPT3X3 is not set
705# CONFIG_PATA_IT821X is not set
706# CONFIG_PATA_IT8213 is not set
707# CONFIG_PATA_JMICRON is not set
708# CONFIG_PATA_TRIFLEX is not set
709# CONFIG_PATA_MARVELL is not set
710# CONFIG_PATA_MPIIX is not set
711# CONFIG_PATA_OLDPIIX is not set
712# CONFIG_PATA_NETCELL is not set
713# CONFIG_PATA_NINJA32 is not set
714# CONFIG_PATA_NS87410 is not set
715# CONFIG_PATA_NS87415 is not set
716# CONFIG_PATA_OPTI is not set
717# CONFIG_PATA_OPTIDMA is not set
718# CONFIG_PATA_PDC_OLD is not set
719# CONFIG_PATA_RADISYS is not set
720# CONFIG_PATA_RZ1000 is not set
721# CONFIG_PATA_SC1200 is not set
722# CONFIG_PATA_SERVERWORKS is not set
723# CONFIG_PATA_PDC2027X is not set
724# CONFIG_PATA_SIL680 is not set
725# CONFIG_PATA_SIS is not set
726# CONFIG_PATA_VIA is not set
727CONFIG_PATA_WINBOND=y
728# CONFIG_PATA_PLATFORM is not set
729CONFIG_MD=y 690CONFIG_MD=y
730CONFIG_BLK_DEV_MD=y 691CONFIG_BLK_DEV_MD=y
731CONFIG_MD_LINEAR=y 692CONFIG_MD_LINEAR=y
@@ -783,7 +744,6 @@ CONFIG_IBMVETH=y
783# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 744# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
784CONFIG_NET_PCI=y 745CONFIG_NET_PCI=y
785CONFIG_PCNET32=y 746CONFIG_PCNET32=y
786# CONFIG_PCNET32_NAPI is not set
787# CONFIG_AMD8111_ETH is not set 747# CONFIG_AMD8111_ETH is not set
788# CONFIG_ADAPTEC_STARFIRE is not set 748# CONFIG_ADAPTEC_STARFIRE is not set
789# CONFIG_B44 is not set 749# CONFIG_B44 is not set
@@ -820,7 +780,6 @@ CONFIG_E1000=y
820# CONFIG_SIS190 is not set 780# CONFIG_SIS190 is not set
821# CONFIG_SKGE is not set 781# CONFIG_SKGE is not set
822# CONFIG_SKY2 is not set 782# CONFIG_SKY2 is not set
823# CONFIG_SK98LIN is not set
824# CONFIG_VIA_VELOCITY is not set 783# CONFIG_VIA_VELOCITY is not set
825CONFIG_TIGON3=y 784CONFIG_TIGON3=y
826# CONFIG_BNX2 is not set 785# CONFIG_BNX2 is not set
@@ -829,7 +788,6 @@ CONFIG_TIGON3=y
829CONFIG_NETDEV_10000=y 788CONFIG_NETDEV_10000=y
830# CONFIG_CHELSIO_T1 is not set 789# CONFIG_CHELSIO_T1 is not set
831# CONFIG_CHELSIO_T3 is not set 790# CONFIG_CHELSIO_T3 is not set
832CONFIG_EHEA=m
833# CONFIG_IXGBE is not set 791# CONFIG_IXGBE is not set
834CONFIG_IXGB=m 792CONFIG_IXGB=m
835# CONFIG_IXGB_NAPI is not set 793# CONFIG_IXGB_NAPI is not set
@@ -838,10 +796,10 @@ CONFIG_S2IO=m
838# CONFIG_MYRI10GE is not set 796# CONFIG_MYRI10GE is not set
839# CONFIG_NETXEN_NIC is not set 797# CONFIG_NETXEN_NIC is not set
840# CONFIG_NIU is not set 798# CONFIG_NIU is not set
841# CONFIG_PASEMI_MAC is not set
842# CONFIG_MLX4_CORE is not set 799# CONFIG_MLX4_CORE is not set
843# CONFIG_TEHUTI is not set 800# CONFIG_TEHUTI is not set
844# CONFIG_BNX2X is not set 801# CONFIG_BNX2X is not set
802# CONFIG_SFC is not set
845CONFIG_TR=y 803CONFIG_TR=y
846CONFIG_IBMOL=y 804CONFIG_IBMOL=y
847# CONFIG_3C359 is not set 805# CONFIG_3C359 is not set
@@ -852,6 +810,7 @@ CONFIG_IBMOL=y
852# 810#
853# CONFIG_WLAN_PRE80211 is not set 811# CONFIG_WLAN_PRE80211 is not set
854# CONFIG_WLAN_80211 is not set 812# CONFIG_WLAN_80211 is not set
813# CONFIG_IWLWIFI_LEDS is not set
855 814
856# 815#
857# USB Network Adapters 816# USB Network Adapters
@@ -956,6 +915,7 @@ CONFIG_VT=y
956CONFIG_VT_CONSOLE=y 915CONFIG_VT_CONSOLE=y
957CONFIG_HW_CONSOLE=y 916CONFIG_HW_CONSOLE=y
958# CONFIG_VT_HW_CONSOLE_BINDING is not set 917# CONFIG_VT_HW_CONSOLE_BINDING is not set
918CONFIG_DEVKMEM=y
959# CONFIG_SERIAL_NONSTANDARD is not set 919# CONFIG_SERIAL_NONSTANDARD is not set
960# CONFIG_NOZOMI is not set 920# CONFIG_NOZOMI is not set
961 921
@@ -1000,13 +960,7 @@ CONFIG_DEVPORT=y
1000CONFIG_I2C=y 960CONFIG_I2C=y
1001CONFIG_I2C_BOARDINFO=y 961CONFIG_I2C_BOARDINFO=y
1002# CONFIG_I2C_CHARDEV is not set 962# CONFIG_I2C_CHARDEV is not set
1003
1004#
1005# I2C Algorithms
1006#
1007CONFIG_I2C_ALGOBIT=y 963CONFIG_I2C_ALGOBIT=y
1008# CONFIG_I2C_ALGOPCF is not set
1009# CONFIG_I2C_ALGOPCA is not set
1010 964
1011# 965#
1012# I2C Hardware Bus support 966# I2C Hardware Bus support
@@ -1035,6 +989,7 @@ CONFIG_I2C_ALGOBIT=y
1035# CONFIG_I2C_VIA is not set 989# CONFIG_I2C_VIA is not set
1036# CONFIG_I2C_VIAPRO is not set 990# CONFIG_I2C_VIAPRO is not set
1037# CONFIG_I2C_VOODOO3 is not set 991# CONFIG_I2C_VOODOO3 is not set
992# CONFIG_I2C_PCA_PLATFORM is not set
1038 993
1039# 994#
1040# Miscellaneous I2C Chip support 995# Miscellaneous I2C Chip support
@@ -1044,19 +999,13 @@ CONFIG_I2C_ALGOBIT=y
1044# CONFIG_SENSORS_PCF8574 is not set 999# CONFIG_SENSORS_PCF8574 is not set
1045# CONFIG_PCF8575 is not set 1000# CONFIG_PCF8575 is not set
1046# CONFIG_SENSORS_PCF8591 is not set 1001# CONFIG_SENSORS_PCF8591 is not set
1047# CONFIG_TPS65010 is not set
1048# CONFIG_SENSORS_MAX6875 is not set 1002# CONFIG_SENSORS_MAX6875 is not set
1049# CONFIG_SENSORS_TSL2550 is not set 1003# CONFIG_SENSORS_TSL2550 is not set
1050# CONFIG_I2C_DEBUG_CORE is not set 1004# CONFIG_I2C_DEBUG_CORE is not set
1051# CONFIG_I2C_DEBUG_ALGO is not set 1005# CONFIG_I2C_DEBUG_ALGO is not set
1052# CONFIG_I2C_DEBUG_BUS is not set 1006# CONFIG_I2C_DEBUG_BUS is not set
1053# CONFIG_I2C_DEBUG_CHIP is not set 1007# CONFIG_I2C_DEBUG_CHIP is not set
1054
1055#
1056# SPI support
1057#
1058# CONFIG_SPI is not set 1008# CONFIG_SPI is not set
1059# CONFIG_SPI_MASTER is not set
1060# CONFIG_W1 is not set 1009# CONFIG_W1 is not set
1061# CONFIG_POWER_SUPPLY is not set 1010# CONFIG_POWER_SUPPLY is not set
1062# CONFIG_HWMON is not set 1011# CONFIG_HWMON is not set
@@ -1073,12 +1022,22 @@ CONFIG_SSB_POSSIBLE=y
1073# Multifunction device drivers 1022# Multifunction device drivers
1074# 1023#
1075# CONFIG_MFD_SM501 is not set 1024# CONFIG_MFD_SM501 is not set
1025# CONFIG_HTC_PASIC3 is not set
1076 1026
1077# 1027#
1078# Multimedia devices 1028# Multimedia devices
1079# 1029#
1030
1031#
1032# Multimedia core support
1033#
1080# CONFIG_VIDEO_DEV is not set 1034# CONFIG_VIDEO_DEV is not set
1081# CONFIG_DVB_CORE is not set 1035# CONFIG_DVB_CORE is not set
1036# CONFIG_VIDEO_MEDIA is not set
1037
1038#
1039# Multimedia drivers
1040#
1082# CONFIG_DAB is not set 1041# CONFIG_DAB is not set
1083 1042
1084# 1043#
@@ -1098,8 +1057,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
1098# CONFIG_FB_SYS_FILLRECT is not set 1057# CONFIG_FB_SYS_FILLRECT is not set
1099# CONFIG_FB_SYS_COPYAREA is not set 1058# CONFIG_FB_SYS_COPYAREA is not set
1100# CONFIG_FB_SYS_IMAGEBLIT is not set 1059# CONFIG_FB_SYS_IMAGEBLIT is not set
1060# CONFIG_FB_FOREIGN_ENDIAN is not set
1101# CONFIG_FB_SYS_FOPS is not set 1061# CONFIG_FB_SYS_FOPS is not set
1102CONFIG_FB_DEFERRED_IO=y
1103# CONFIG_FB_SVGALIB is not set 1062# CONFIG_FB_SVGALIB is not set
1104CONFIG_FB_MACMODES=y 1063CONFIG_FB_MACMODES=y
1105CONFIG_FB_BACKLIGHT=y 1064CONFIG_FB_BACKLIGHT=y
@@ -1209,11 +1168,13 @@ CONFIG_USB_DEVICE_CLASS=y
1209# 1168#
1210# USB Host Controller Drivers 1169# USB Host Controller Drivers
1211# 1170#
1171# CONFIG_USB_C67X00_HCD is not set
1212CONFIG_USB_EHCI_HCD=y 1172CONFIG_USB_EHCI_HCD=y
1213# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1173# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1214# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1174# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1215# CONFIG_USB_EHCI_HCD_PPC_OF is not set 1175# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1216# CONFIG_USB_ISP116X_HCD is not set 1176# CONFIG_USB_ISP116X_HCD is not set
1177# CONFIG_USB_ISP1760_HCD is not set
1217CONFIG_USB_OHCI_HCD=y 1178CONFIG_USB_OHCI_HCD=y
1218# CONFIG_USB_OHCI_HCD_PPC_OF is not set 1179# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1219# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1180# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1247,7 +1208,9 @@ CONFIG_USB_STORAGE=y
1247# CONFIG_USB_STORAGE_SDDR55 is not set 1208# CONFIG_USB_STORAGE_SDDR55 is not set
1248# CONFIG_USB_STORAGE_JUMPSHOT is not set 1209# CONFIG_USB_STORAGE_JUMPSHOT is not set
1249# CONFIG_USB_STORAGE_ALAUDA is not set 1210# CONFIG_USB_STORAGE_ALAUDA is not set
1211CONFIG_USB_STORAGE_ONETOUCH=y
1250# CONFIG_USB_STORAGE_KARMA is not set 1212# CONFIG_USB_STORAGE_KARMA is not set
1213# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1251# CONFIG_USB_LIBUSUAL is not set 1214# CONFIG_USB_LIBUSUAL is not set
1252 1215
1253# 1216#
@@ -1290,6 +1253,7 @@ CONFIG_USB_MON=y
1290# CONFIG_MMC is not set 1253# CONFIG_MMC is not set
1291# CONFIG_MEMSTICK is not set 1254# CONFIG_MEMSTICK is not set
1292# CONFIG_NEW_LEDS is not set 1255# CONFIG_NEW_LEDS is not set
1256# CONFIG_ACCESSIBILITY is not set
1293CONFIG_INFINIBAND=m 1257CONFIG_INFINIBAND=m
1294CONFIG_INFINIBAND_USER_MAD=m 1258CONFIG_INFINIBAND_USER_MAD=m
1295CONFIG_INFINIBAND_USER_ACCESS=m 1259CONFIG_INFINIBAND_USER_ACCESS=m
@@ -1312,10 +1276,6 @@ CONFIG_INFINIBAND_SRP=m
1312# CONFIG_RTC_CLASS is not set 1276# CONFIG_RTC_CLASS is not set
1313# CONFIG_DMADEVICES is not set 1277# CONFIG_DMADEVICES is not set
1314# CONFIG_AUXDISPLAY is not set 1278# CONFIG_AUXDISPLAY is not set
1315
1316#
1317# Userspace I/O
1318#
1319# CONFIG_UIO is not set 1279# CONFIG_UIO is not set
1320 1280
1321# 1281#
@@ -1349,11 +1309,12 @@ CONFIG_JFS_SECURITY=y
1349CONFIG_FS_POSIX_ACL=y 1309CONFIG_FS_POSIX_ACL=y
1350CONFIG_XFS_FS=m 1310CONFIG_XFS_FS=m
1351# CONFIG_XFS_QUOTA is not set 1311# CONFIG_XFS_QUOTA is not set
1352CONFIG_XFS_SECURITY=y
1353CONFIG_XFS_POSIX_ACL=y 1312CONFIG_XFS_POSIX_ACL=y
1354# CONFIG_XFS_RT is not set 1313# CONFIG_XFS_RT is not set
1314# CONFIG_XFS_DEBUG is not set
1355# CONFIG_GFS2_FS is not set 1315# CONFIG_GFS2_FS is not set
1356CONFIG_OCFS2_FS=m 1316CONFIG_OCFS2_FS=m
1317CONFIG_OCFS2_FS_O2CB=m
1357CONFIG_OCFS2_DEBUG_MASKLOG=y 1318CONFIG_OCFS2_DEBUG_MASKLOG=y
1358# CONFIG_OCFS2_DEBUG_FS is not set 1319# CONFIG_OCFS2_DEBUG_FS is not set
1359CONFIG_DNOTIFY=y 1320CONFIG_DNOTIFY=y
@@ -1419,13 +1380,11 @@ CONFIG_NFS_FS=y
1419CONFIG_NFS_V3=y 1380CONFIG_NFS_V3=y
1420CONFIG_NFS_V3_ACL=y 1381CONFIG_NFS_V3_ACL=y
1421CONFIG_NFS_V4=y 1382CONFIG_NFS_V4=y
1422# CONFIG_NFS_DIRECTIO is not set
1423CONFIG_NFSD=y 1383CONFIG_NFSD=y
1424CONFIG_NFSD_V2_ACL=y 1384CONFIG_NFSD_V2_ACL=y
1425CONFIG_NFSD_V3=y 1385CONFIG_NFSD_V3=y
1426CONFIG_NFSD_V3_ACL=y 1386CONFIG_NFSD_V3_ACL=y
1427CONFIG_NFSD_V4=y 1387CONFIG_NFSD_V4=y
1428CONFIG_NFSD_TCP=y
1429CONFIG_LOCKD=y 1388CONFIG_LOCKD=y
1430CONFIG_LOCKD_V4=y 1389CONFIG_LOCKD_V4=y
1431CONFIG_EXPORTFS=y 1390CONFIG_EXPORTFS=y
@@ -1500,9 +1459,10 @@ CONFIG_NLS_ISO8859_1=y
1500# Library routines 1459# Library routines
1501# 1460#
1502CONFIG_BITREVERSE=y 1461CONFIG_BITREVERSE=y
1462# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1503CONFIG_CRC_CCITT=m 1463CONFIG_CRC_CCITT=m
1504# CONFIG_CRC16 is not set 1464# CONFIG_CRC16 is not set
1505# CONFIG_CRC_ITU_T is not set 1465CONFIG_CRC_ITU_T=m
1506CONFIG_CRC32=y 1466CONFIG_CRC32=y
1507# CONFIG_CRC7 is not set 1467# CONFIG_CRC7 is not set
1508CONFIG_LIBCRC32C=m 1468CONFIG_LIBCRC32C=m
@@ -1526,6 +1486,7 @@ CONFIG_HAVE_LMB=y
1526# CONFIG_PRINTK_TIME is not set 1486# CONFIG_PRINTK_TIME is not set
1527CONFIG_ENABLE_WARN_DEPRECATED=y 1487CONFIG_ENABLE_WARN_DEPRECATED=y
1528CONFIG_ENABLE_MUST_CHECK=y 1488CONFIG_ENABLE_MUST_CHECK=y
1489CONFIG_FRAME_WARN=2048
1529CONFIG_MAGIC_SYSRQ=y 1490CONFIG_MAGIC_SYSRQ=y
1530# CONFIG_UNUSED_SYMBOLS is not set 1491# CONFIG_UNUSED_SYMBOLS is not set
1531CONFIG_DEBUG_FS=y 1492CONFIG_DEBUG_FS=y
@@ -1536,18 +1497,23 @@ CONFIG_DETECT_SOFTLOCKUP=y
1536CONFIG_SCHED_DEBUG=y 1497CONFIG_SCHED_DEBUG=y
1537# CONFIG_SCHEDSTATS is not set 1498# CONFIG_SCHEDSTATS is not set
1538# CONFIG_TIMER_STATS is not set 1499# CONFIG_TIMER_STATS is not set
1500# CONFIG_DEBUG_OBJECTS is not set
1539# CONFIG_SLUB_DEBUG_ON is not set 1501# CONFIG_SLUB_DEBUG_ON is not set
1540# CONFIG_SLUB_STATS is not set 1502# CONFIG_SLUB_STATS is not set
1541# CONFIG_DEBUG_RT_MUTEXES is not set 1503# CONFIG_DEBUG_RT_MUTEXES is not set
1542# CONFIG_RT_MUTEX_TESTER is not set 1504# CONFIG_RT_MUTEX_TESTER is not set
1543# CONFIG_DEBUG_SPINLOCK is not set 1505# CONFIG_DEBUG_SPINLOCK is not set
1544# CONFIG_DEBUG_MUTEXES is not set 1506# CONFIG_DEBUG_MUTEXES is not set
1507# CONFIG_DEBUG_LOCK_ALLOC is not set
1508# CONFIG_PROVE_LOCKING is not set
1509# CONFIG_LOCK_STAT is not set
1545# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1510# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1546# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1511# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1547# CONFIG_DEBUG_KOBJECT is not set 1512# CONFIG_DEBUG_KOBJECT is not set
1548CONFIG_DEBUG_BUGVERBOSE=y 1513CONFIG_DEBUG_BUGVERBOSE=y
1549# CONFIG_DEBUG_INFO is not set 1514# CONFIG_DEBUG_INFO is not set
1550# CONFIG_DEBUG_VM is not set 1515# CONFIG_DEBUG_VM is not set
1516# CONFIG_DEBUG_WRITECOUNT is not set
1551# CONFIG_DEBUG_LIST is not set 1517# CONFIG_DEBUG_LIST is not set
1552# CONFIG_DEBUG_SG is not set 1518# CONFIG_DEBUG_SG is not set
1553# CONFIG_BOOT_PRINTK_DELAY is not set 1519# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1577,53 +1543,83 @@ CONFIG_VIRQ_DEBUG=y
1577# CONFIG_SECURITY is not set 1543# CONFIG_SECURITY is not set
1578# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1544# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1579CONFIG_CRYPTO=y 1545CONFIG_CRYPTO=y
1546
1547#
1548# Crypto core or helper
1549#
1580CONFIG_CRYPTO_ALGAPI=y 1550CONFIG_CRYPTO_ALGAPI=y
1581CONFIG_CRYPTO_AEAD=m 1551CONFIG_CRYPTO_AEAD=m
1582CONFIG_CRYPTO_BLKCIPHER=y 1552CONFIG_CRYPTO_BLKCIPHER=y
1583CONFIG_CRYPTO_SEQIV=m
1584CONFIG_CRYPTO_HASH=y 1553CONFIG_CRYPTO_HASH=y
1585CONFIG_CRYPTO_MANAGER=y 1554CONFIG_CRYPTO_MANAGER=y
1555CONFIG_CRYPTO_GF128MUL=m
1556CONFIG_CRYPTO_NULL=m
1557# CONFIG_CRYPTO_CRYPTD is not set
1558CONFIG_CRYPTO_AUTHENC=m
1559CONFIG_CRYPTO_TEST=m
1560
1561#
1562# Authenticated Encryption with Associated Data
1563#
1564CONFIG_CRYPTO_CCM=m
1565CONFIG_CRYPTO_GCM=m
1566CONFIG_CRYPTO_SEQIV=m
1567
1568#
1569# Block modes
1570#
1571CONFIG_CRYPTO_CBC=y
1572CONFIG_CRYPTO_CTR=m
1573# CONFIG_CRYPTO_CTS is not set
1574CONFIG_CRYPTO_ECB=m
1575# CONFIG_CRYPTO_LRW is not set
1576CONFIG_CRYPTO_PCBC=m
1577# CONFIG_CRYPTO_XTS is not set
1578
1579#
1580# Hash modes
1581#
1586CONFIG_CRYPTO_HMAC=y 1582CONFIG_CRYPTO_HMAC=y
1587# CONFIG_CRYPTO_XCBC is not set 1583# CONFIG_CRYPTO_XCBC is not set
1588CONFIG_CRYPTO_NULL=m 1584
1585#
1586# Digest
1587#
1588CONFIG_CRYPTO_CRC32C=m
1589CONFIG_CRYPTO_MD4=m 1589CONFIG_CRYPTO_MD4=m
1590CONFIG_CRYPTO_MD5=y 1590CONFIG_CRYPTO_MD5=y
1591CONFIG_CRYPTO_MICHAEL_MIC=m
1591CONFIG_CRYPTO_SHA1=m 1592CONFIG_CRYPTO_SHA1=m
1592CONFIG_CRYPTO_SHA256=m 1593CONFIG_CRYPTO_SHA256=m
1593CONFIG_CRYPTO_SHA512=m 1594CONFIG_CRYPTO_SHA512=m
1594CONFIG_CRYPTO_WP512=m
1595CONFIG_CRYPTO_TGR192=m 1595CONFIG_CRYPTO_TGR192=m
1596CONFIG_CRYPTO_GF128MUL=m 1596CONFIG_CRYPTO_WP512=m
1597CONFIG_CRYPTO_ECB=m 1597
1598CONFIG_CRYPTO_CBC=y 1598#
1599CONFIG_CRYPTO_PCBC=m 1599# Ciphers
1600# CONFIG_CRYPTO_LRW is not set 1600#
1601# CONFIG_CRYPTO_XTS is not set
1602CONFIG_CRYPTO_CTR=m
1603CONFIG_CRYPTO_GCM=m
1604CONFIG_CRYPTO_CCM=m
1605# CONFIG_CRYPTO_CRYPTD is not set
1606CONFIG_CRYPTO_DES=y
1607# CONFIG_CRYPTO_FCRYPT is not set
1608CONFIG_CRYPTO_BLOWFISH=m
1609CONFIG_CRYPTO_TWOFISH=m
1610CONFIG_CRYPTO_TWOFISH_COMMON=m
1611CONFIG_CRYPTO_SERPENT=m
1612CONFIG_CRYPTO_AES=m 1601CONFIG_CRYPTO_AES=m
1602CONFIG_CRYPTO_ANUBIS=m
1603CONFIG_CRYPTO_ARC4=m
1604CONFIG_CRYPTO_BLOWFISH=m
1605# CONFIG_CRYPTO_CAMELLIA is not set
1613CONFIG_CRYPTO_CAST5=m 1606CONFIG_CRYPTO_CAST5=m
1614CONFIG_CRYPTO_CAST6=m 1607CONFIG_CRYPTO_CAST6=m
1615CONFIG_CRYPTO_TEA=m 1608CONFIG_CRYPTO_DES=y
1616CONFIG_CRYPTO_ARC4=m 1609# CONFIG_CRYPTO_FCRYPT is not set
1617CONFIG_CRYPTO_KHAZAD=m 1610CONFIG_CRYPTO_KHAZAD=m
1618CONFIG_CRYPTO_ANUBIS=m
1619# CONFIG_CRYPTO_SEED is not set
1620CONFIG_CRYPTO_SALSA20=m 1611CONFIG_CRYPTO_SALSA20=m
1612# CONFIG_CRYPTO_SEED is not set
1613CONFIG_CRYPTO_SERPENT=m
1614CONFIG_CRYPTO_TEA=m
1615CONFIG_CRYPTO_TWOFISH=m
1616CONFIG_CRYPTO_TWOFISH_COMMON=m
1617
1618#
1619# Compression
1620#
1621CONFIG_CRYPTO_DEFLATE=m 1621CONFIG_CRYPTO_DEFLATE=m
1622CONFIG_CRYPTO_MICHAEL_MIC=m
1623CONFIG_CRYPTO_CRC32C=m
1624# CONFIG_CRYPTO_CAMELLIA is not set
1625CONFIG_CRYPTO_TEST=m
1626CONFIG_CRYPTO_AUTHENC=m
1627CONFIG_CRYPTO_LZO=m 1622CONFIG_CRYPTO_LZO=m
1628# CONFIG_CRYPTO_HW is not set 1623# CONFIG_CRYPTO_HW is not set
1629# CONFIG_PPC_CLOCK is not set 1624# CONFIG_PPC_CLOCK is not set
1625# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index d14cebf62bb0..2346d271fbfd 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -105,6 +105,9 @@ PHONY += systbl_chk
105systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i 105systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
106 $(call cmd,systbl_chk) 106 $(call cmd,systbl_chk)
107 107
108
109ifeq ($(CONFIG_PPC_MERGE),y)
110
108$(obj)/built-in.o: prom_init_check 111$(obj)/built-in.o: prom_init_check
109 112
110quiet_cmd_prom_init_check = CALL $< 113quiet_cmd_prom_init_check = CALL $<
@@ -114,4 +117,7 @@ PHONY += prom_init_check
114prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o 117prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o
115 $(call cmd,prom_init_check) 118 $(call cmd,prom_init_check)
116 119
120endif
121
122
117clean-files := vmlinux.lds 123clean-files := vmlinux.lds
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 81738a4b3c3a..e44d5530f0a6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1484,6 +1484,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1484 .dcache_bsize = 32, 1484 .dcache_bsize = 32,
1485 .machine_check = machine_check_e200, 1485 .machine_check = machine_check_e200,
1486 .platform = "ppc5554", 1486 .platform = "ppc5554",
1487 }
1487#endif /* CONFIG_E200 */ 1488#endif /* CONFIG_E200 */
1488#ifdef CONFIG_E500 1489#ifdef CONFIG_E500
1489 { /* e500 */ 1490 { /* e500 */
@@ -1533,6 +1534,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1533 .dcache_bsize = 32, 1534 .dcache_bsize = 32,
1534 .machine_check = machine_check_e500, 1535 .machine_check = machine_check_e500,
1535 .platform = "powerpc", 1536 .platform = "powerpc",
1537 }
1536#endif /* CONFIG_E500 */ 1538#endif /* CONFIG_E500 */
1537#endif /* CONFIG_PPC32 */ 1539#endif /* CONFIG_PPC32 */
1538}; 1540};
diff --git a/arch/powerpc/kernel/init_task.c b/arch/powerpc/kernel/init_task.c
index 941043ae040f..4c85b8d56478 100644
--- a/arch/powerpc/kernel/init_task.c
+++ b/arch/powerpc/kernel/init_task.c
@@ -8,7 +8,6 @@
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10static struct fs_struct init_fs = INIT_FS; 10static struct fs_struct init_fs = INIT_FS;
11static struct files_struct init_files = INIT_FILES;
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14struct mm_struct init_mm = INIT_MM(init_mm); 13struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 52750745edfd..30eedfc5a566 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -189,7 +189,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
189 189
190 dev->cfg_size = pci_cfg_space_size(dev); 190 dev->cfg_size = pci_cfg_space_size(dev);
191 191
192 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 192 dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
193 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); 193 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
194 dev->class = get_int_prop(node, "class-code", 0); 194 dev->class = get_int_prop(node, "class-code", 0);
195 dev->revision = get_int_prop(node, "revision-id", 0); 195 dev->revision = get_int_prop(node, "revision-id", 0);
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 8e24fc1821e8..31729a9387df 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -20,7 +20,7 @@ WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush
20_end enter_prom memcpy memset reloc_offset __secondary_hold 20_end enter_prom memcpy memset reloc_offset __secondary_hold
21__secondary_hold_acknowledge __secondary_hold_spinloop __start 21__secondary_hold_acknowledge __secondary_hold_spinloop __start
22strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 22strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
23reloc_got2" 23reloc_got2 kernstart_addr"
24 24
25NM="$1" 25NM="$1"
26OBJ="$2" 26OBJ="$2"
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index faeb8f207ea4..da7c058e3731 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -87,6 +87,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
87#ifdef CONFIG_ALTIVEC 87#ifdef CONFIG_ALTIVEC
88 elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *)(((unsigned long)sc->vmx_reserve + 15) & ~0xful); 88 elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *)(((unsigned long)sc->vmx_reserve + 15) & ~0xful);
89#endif 89#endif
90 unsigned long msr = regs->msr;
90 long err = 0; 91 long err = 0;
91 92
92 flush_fp_to_thread(current); 93 flush_fp_to_thread(current);
@@ -102,7 +103,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
102 /* set MSR_VEC in the MSR value in the frame to indicate that sc->v_reg) 103 /* set MSR_VEC in the MSR value in the frame to indicate that sc->v_reg)
103 * contains valid data. 104 * contains valid data.
104 */ 105 */
105 regs->msr |= MSR_VEC; 106 msr |= MSR_VEC;
106 } 107 }
107 /* We always copy to/from vrsave, it's 0 if we don't have or don't 108 /* We always copy to/from vrsave, it's 0 if we don't have or don't
108 * use altivec. 109 * use altivec.
@@ -114,6 +115,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
114 err |= __put_user(&sc->gp_regs, &sc->regs); 115 err |= __put_user(&sc->gp_regs, &sc->regs);
115 WARN_ON(!FULL_REGS(regs)); 116 WARN_ON(!FULL_REGS(regs));
116 err |= __copy_to_user(&sc->gp_regs, regs, GP_REGS_SIZE); 117 err |= __copy_to_user(&sc->gp_regs, regs, GP_REGS_SIZE);
118 err |= __put_user(msr, &sc->gp_regs[PT_MSR]);
117 err |= __copy_to_user(&sc->fp_regs, &current->thread.fpr, FP_REGS_SIZE); 119 err |= __copy_to_user(&sc->fp_regs, &current->thread.fpr, FP_REGS_SIZE);
118 err |= __put_user(signr, &sc->signal); 120 err |= __put_user(signr, &sc->signal);
119 err |= __put_user(handler, &sc->handler); 121 err |= __put_user(handler, &sc->handler);
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index f5d7a5eab96e..75dff7cfa814 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -116,8 +116,6 @@ static void kvmppc_44x_shadow_release(struct kvm_vcpu *vcpu,
116 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[index]; 116 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[index];
117 struct page *page = vcpu->arch.shadow_pages[index]; 117 struct page *page = vcpu->arch.shadow_pages[index];
118 118
119 kunmap(vcpu->arch.shadow_pages[index]);
120
121 if (get_tlb_v(stlbe)) { 119 if (get_tlb_v(stlbe)) {
122 if (kvmppc_44x_tlbe_is_writable(stlbe)) 120 if (kvmppc_44x_tlbe_is_writable(stlbe))
123 kvm_release_page_dirty(page); 121 kvm_release_page_dirty(page);
@@ -144,18 +142,19 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid,
144 stlbe = &vcpu->arch.shadow_tlb[victim]; 142 stlbe = &vcpu->arch.shadow_tlb[victim];
145 143
146 /* Get reference to new page. */ 144 /* Get reference to new page. */
147 down_write(&current->mm->mmap_sem); 145 down_read(&current->mm->mmap_sem);
148 new_page = gfn_to_page(vcpu->kvm, gfn); 146 new_page = gfn_to_page(vcpu->kvm, gfn);
149 if (is_error_page(new_page)) { 147 if (is_error_page(new_page)) {
150 printk(KERN_ERR "Couldn't get guest page!\n"); 148 printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn);
151 kvm_release_page_clean(new_page); 149 kvm_release_page_clean(new_page);
150 up_read(&current->mm->mmap_sem);
152 return; 151 return;
153 } 152 }
154 hpaddr = page_to_phys(new_page); 153 hpaddr = page_to_phys(new_page);
155 154
156 /* Drop reference to old page. */ 155 /* Drop reference to old page. */
157 kvmppc_44x_shadow_release(vcpu, victim); 156 kvmppc_44x_shadow_release(vcpu, victim);
158 up_write(&current->mm->mmap_sem); 157 up_read(&current->mm->mmap_sem);
159 158
160 vcpu->arch.shadow_pages[victim] = new_page; 159 vcpu->arch.shadow_pages[victim] = new_page;
161 160
diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c
index 712d89a28c46..9c8ad850c6e3 100644
--- a/arch/powerpc/kvm/booke_guest.c
+++ b/arch/powerpc/kvm/booke_guest.c
@@ -227,39 +227,6 @@ void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu)
227 } 227 }
228} 228}
229 229
230static int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
231{
232 enum emulation_result er;
233 int r;
234
235 er = kvmppc_emulate_instruction(run, vcpu);
236 switch (er) {
237 case EMULATE_DONE:
238 /* Future optimization: only reload non-volatiles if they were
239 * actually modified. */
240 r = RESUME_GUEST_NV;
241 break;
242 case EMULATE_DO_MMIO:
243 run->exit_reason = KVM_EXIT_MMIO;
244 /* We must reload nonvolatiles because "update" load/store
245 * instructions modify register state. */
246 /* Future optimization: only reload non-volatiles if they were
247 * actually modified. */
248 r = RESUME_HOST_NV;
249 break;
250 case EMULATE_FAIL:
251 /* XXX Deliver Program interrupt to guest. */
252 printk(KERN_EMERG "%s: emulation failed (%08x)\n", __func__,
253 vcpu->arch.last_inst);
254 r = RESUME_HOST;
255 break;
256 default:
257 BUG();
258 }
259
260 return r;
261}
262
263/** 230/**
264 * kvmppc_handle_exit 231 * kvmppc_handle_exit
265 * 232 *
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index a03fe0c80698..000097461283 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -246,6 +246,11 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
246 case 31: 246 case 31:
247 switch (get_xop(inst)) { 247 switch (get_xop(inst)) {
248 248
249 case 23: /* lwzx */
250 rt = get_rt(inst);
251 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
252 break;
253
249 case 83: /* mfmsr */ 254 case 83: /* mfmsr */
250 rt = get_rt(inst); 255 rt = get_rt(inst);
251 vcpu->arch.gpr[rt] = vcpu->arch.msr; 256 vcpu->arch.gpr[rt] = vcpu->arch.msr;
@@ -267,6 +272,13 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
267 kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); 272 kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]);
268 break; 273 break;
269 274
275 case 151: /* stwx */
276 rs = get_rs(inst);
277 emulated = kvmppc_handle_store(run, vcpu,
278 vcpu->arch.gpr[rs],
279 4, 1);
280 break;
281
270 case 163: /* wrteei */ 282 case 163: /* wrteei */
271 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE) 283 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
272 | (inst & MSR_EE); 284 | (inst & MSR_EE);
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index f1d2cdc5331b..c71d37dc6a88 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -10,6 +10,7 @@ ifeq ($(CONFIG_PPC_MERGE),y)
10obj-y := string.o alloc.o \ 10obj-y := string.o alloc.o \
11 checksum_$(CONFIG_WORD_SIZE).o 11 checksum_$(CONFIG_WORD_SIZE).o
12obj-$(CONFIG_PPC32) += div64.o copy_32.o 12obj-$(CONFIG_PPC32) += div64.o copy_32.o
13obj-$(CONFIG_HAS_IOMEM) += devres.o
13endif 14endif
14 15
15obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ 16obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
@@ -23,4 +24,3 @@ obj-$(CONFIG_SMP) += locks.o
23endif 24endif
24 25
25obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o 26obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
26obj-$(CONFIG_HAS_IOMEM) += devres.o
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index ddeaf9e38ad5..b9ba7d930801 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: hashtable.S,v 1.6 1999/10/08 01:56:15 paulus Exp $
3 *
4 * PowerPC version 2 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP 4 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 2b5a399f6fa6..0f2d239d94c4 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -94,6 +94,9 @@ unsigned long htab_hash_mask;
94int mmu_linear_psize = MMU_PAGE_4K; 94int mmu_linear_psize = MMU_PAGE_4K;
95int mmu_virtual_psize = MMU_PAGE_4K; 95int mmu_virtual_psize = MMU_PAGE_4K;
96int mmu_vmalloc_psize = MMU_PAGE_4K; 96int mmu_vmalloc_psize = MMU_PAGE_4K;
97#ifdef CONFIG_SPARSEMEM_VMEMMAP
98int mmu_vmemmap_psize = MMU_PAGE_4K;
99#endif
97int mmu_io_psize = MMU_PAGE_4K; 100int mmu_io_psize = MMU_PAGE_4K;
98int mmu_kernel_ssize = MMU_SEGSIZE_256M; 101int mmu_kernel_ssize = MMU_SEGSIZE_256M;
99int mmu_highuser_ssize = MMU_SEGSIZE_256M; 102int mmu_highuser_ssize = MMU_SEGSIZE_256M;
@@ -387,11 +390,32 @@ static void __init htab_init_page_sizes(void)
387 } 390 }
388#endif /* CONFIG_PPC_64K_PAGES */ 391#endif /* CONFIG_PPC_64K_PAGES */
389 392
393#ifdef CONFIG_SPARSEMEM_VMEMMAP
394 /* We try to use 16M pages for vmemmap if that is supported
395 * and we have at least 1G of RAM at boot
396 */
397 if (mmu_psize_defs[MMU_PAGE_16M].shift &&
398 lmb_phys_mem_size() >= 0x40000000)
399 mmu_vmemmap_psize = MMU_PAGE_16M;
400 else if (mmu_psize_defs[MMU_PAGE_64K].shift)
401 mmu_vmemmap_psize = MMU_PAGE_64K;
402 else
403 mmu_vmemmap_psize = MMU_PAGE_4K;
404#endif /* CONFIG_SPARSEMEM_VMEMMAP */
405
390 printk(KERN_DEBUG "Page orders: linear mapping = %d, " 406 printk(KERN_DEBUG "Page orders: linear mapping = %d, "
391 "virtual = %d, io = %d\n", 407 "virtual = %d, io = %d"
408#ifdef CONFIG_SPARSEMEM_VMEMMAP
409 ", vmemmap = %d"
410#endif
411 "\n",
392 mmu_psize_defs[mmu_linear_psize].shift, 412 mmu_psize_defs[mmu_linear_psize].shift,
393 mmu_psize_defs[mmu_virtual_psize].shift, 413 mmu_psize_defs[mmu_virtual_psize].shift,
394 mmu_psize_defs[mmu_io_psize].shift); 414 mmu_psize_defs[mmu_io_psize].shift
415#ifdef CONFIG_SPARSEMEM_VMEMMAP
416 ,mmu_psize_defs[mmu_vmemmap_psize].shift
417#endif
418 );
395 419
396#ifdef CONFIG_HUGETLB_PAGE 420#ifdef CONFIG_HUGETLB_PAGE
397 /* Init large page size. Currently, we pick 16M or 1M depending 421 /* Init large page size. Currently, we pick 16M or 1M depending
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index c5ac532a0161..6aa65375abf5 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -19,6 +19,8 @@
19 * 19 *
20 */ 20 */
21 21
22#undef DEBUG
23
22#include <linux/signal.h> 24#include <linux/signal.h>
23#include <linux/sched.h> 25#include <linux/sched.h>
24#include <linux/kernel.h> 26#include <linux/kernel.h>
@@ -208,12 +210,12 @@ int __meminit vmemmap_populated(unsigned long start, int page_size)
208} 210}
209 211
210int __meminit vmemmap_populate(struct page *start_page, 212int __meminit vmemmap_populate(struct page *start_page,
211 unsigned long nr_pages, int node) 213 unsigned long nr_pages, int node)
212{ 214{
213 unsigned long mode_rw; 215 unsigned long mode_rw;
214 unsigned long start = (unsigned long)start_page; 216 unsigned long start = (unsigned long)start_page;
215 unsigned long end = (unsigned long)(start_page + nr_pages); 217 unsigned long end = (unsigned long)(start_page + nr_pages);
216 unsigned long page_size = 1 << mmu_psize_defs[mmu_linear_psize].shift; 218 unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
217 219
218 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX; 220 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
219 221
@@ -235,11 +237,11 @@ int __meminit vmemmap_populate(struct page *start_page,
235 start, p, __pa(p)); 237 start, p, __pa(p));
236 238
237 mapped = htab_bolt_mapping(start, start + page_size, 239 mapped = htab_bolt_mapping(start, start + page_size,
238 __pa(p), mode_rw, mmu_linear_psize, 240 __pa(p), mode_rw, mmu_vmemmap_psize,
239 mmu_kernel_ssize); 241 mmu_kernel_ssize);
240 BUG_ON(mapped < 0); 242 BUG_ON(mapped < 0);
241 } 243 }
242 244
243 return 0; 245 return 0;
244} 246}
245#endif 247#endif /* CONFIG_SPARSEMEM_VMEMMAP */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index f67e118116fa..51f82d83bf14 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -151,6 +151,7 @@ out:
151 return ret; 151 return ret;
152} 152}
153#endif /* CONFIG_MEMORY_HOTREMOVE */ 153#endif /* CONFIG_MEMORY_HOTREMOVE */
154#endif /* CONFIG_MEMORY_HOTPLUG */
154 155
155/* 156/*
156 * walk_memory_resource() needs to make sure there is no holes in a given 157 * walk_memory_resource() needs to make sure there is no holes in a given
@@ -184,8 +185,6 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
184} 185}
185EXPORT_SYMBOL_GPL(walk_memory_resource); 186EXPORT_SYMBOL_GPL(walk_memory_resource);
186 187
187#endif /* CONFIG_MEMORY_HOTPLUG */
188
189void show_mem(void) 188void show_mem(void)
190{ 189{
191 unsigned long total = 0, reserved = 0; 190 unsigned long total = 0, reserved = 0;
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 80d1babb230d..e0ff59f21135 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -402,7 +402,7 @@ void __set_fixmap (enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags)
402 return; 402 return;
403 } 403 }
404 404
405 map_page(address, phys, flags); 405 map_page(address, phys, pgprot_val(flags));
406 fixmaps++; 406 fixmaps++;
407} 407}
408 408
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index cf8705e32d60..89497fb04280 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -28,7 +28,7 @@
28#include <asm/udbg.h> 28#include <asm/udbg.h>
29 29
30#ifdef DEBUG 30#ifdef DEBUG
31#define DBG(fmt...) udbg_printf(fmt) 31#define DBG(fmt...) printk(fmt)
32#else 32#else
33#define DBG pr_debug 33#define DBG pr_debug
34#endif 34#endif
@@ -263,13 +263,19 @@ void slb_initialize(void)
263 extern unsigned int *slb_miss_kernel_load_linear; 263 extern unsigned int *slb_miss_kernel_load_linear;
264 extern unsigned int *slb_miss_kernel_load_io; 264 extern unsigned int *slb_miss_kernel_load_io;
265 extern unsigned int *slb_compare_rr_to_size; 265 extern unsigned int *slb_compare_rr_to_size;
266#ifdef CONFIG_SPARSEMEM_VMEMMAP
267 extern unsigned int *slb_miss_kernel_load_vmemmap;
268 unsigned long vmemmap_llp;
269#endif
266 270
267 /* Prepare our SLB miss handler based on our page size */ 271 /* Prepare our SLB miss handler based on our page size */
268 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; 272 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
269 io_llp = mmu_psize_defs[mmu_io_psize].sllp; 273 io_llp = mmu_psize_defs[mmu_io_psize].sllp;
270 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp; 274 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp;
271 get_paca()->vmalloc_sllp = SLB_VSID_KERNEL | vmalloc_llp; 275 get_paca()->vmalloc_sllp = SLB_VSID_KERNEL | vmalloc_llp;
272 276#ifdef CONFIG_SPARSEMEM_VMEMMAP
277 vmemmap_llp = mmu_psize_defs[mmu_vmemmap_psize].sllp;
278#endif
273 if (!slb_encoding_inited) { 279 if (!slb_encoding_inited) {
274 slb_encoding_inited = 1; 280 slb_encoding_inited = 1;
275 patch_slb_encoding(slb_miss_kernel_load_linear, 281 patch_slb_encoding(slb_miss_kernel_load_linear,
@@ -281,6 +287,12 @@ void slb_initialize(void)
281 287
282 DBG("SLB: linear LLP = %04lx\n", linear_llp); 288 DBG("SLB: linear LLP = %04lx\n", linear_llp);
283 DBG("SLB: io LLP = %04lx\n", io_llp); 289 DBG("SLB: io LLP = %04lx\n", io_llp);
290
291#ifdef CONFIG_SPARSEMEM_VMEMMAP
292 patch_slb_encoding(slb_miss_kernel_load_vmemmap,
293 SLB_VSID_KERNEL | vmemmap_llp);
294 DBG("SLB: vmemmap LLP = %04lx\n", vmemmap_llp);
295#endif
284 } 296 }
285 297
286 get_paca()->stab_rr = SLB_NUM_BOLTED; 298 get_paca()->stab_rr = SLB_NUM_BOLTED;
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index 657f6b37e9df..bc44dc4b5c67 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -47,8 +47,7 @@ _GLOBAL(slb_allocate_realmode)
47 * it to VSID 0, which is reserved as a bad VSID - one which 47 * it to VSID 0, which is reserved as a bad VSID - one which
48 * will never have any pages in it. */ 48 * will never have any pages in it. */
49 49
50 /* Check if hitting the linear mapping of the vmalloc/ioremap 50 /* Check if hitting the linear mapping or some other kernel space
51 * kernel space
52 */ 51 */
53 bne cr7,1f 52 bne cr7,1f
54 53
@@ -62,7 +61,18 @@ BEGIN_FTR_SECTION
62END_FTR_SECTION_IFCLR(CPU_FTR_1T_SEGMENT) 61END_FTR_SECTION_IFCLR(CPU_FTR_1T_SEGMENT)
63 b slb_finish_load_1T 62 b slb_finish_load_1T
64 63
651: /* vmalloc/ioremap mapping encoding bits, the "li" instructions below 641:
65#ifdef CONFIG_SPARSEMEM_VMEMMAP
66 /* Check virtual memmap region. To be patches at kernel boot */
67 cmpldi cr0,r9,0xf
68 bne 1f
69_GLOBAL(slb_miss_kernel_load_vmemmap)
70 li r11,0
71 b 6f
721:
73#endif /* CONFIG_SPARSEMEM_VMEMMAP */
74
75 /* vmalloc/ioremap mapping encoding bits, the "li" instructions below
66 * will be patched by the kernel at boot 76 * will be patched by the kernel at boot
67 */ 77 */
68BEGIN_FTR_SECTION 78BEGIN_FTR_SECTION
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 48da5dfe4856..8a455ebce98d 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -100,7 +100,7 @@ static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
100 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 100 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
101 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 101 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
102 struct mpc52xx_gpiochip, mmchip); 102 struct mpc52xx_gpiochip, mmchip);
103 struct mpc52xx_gpio_wkup *regs = mm_gc->regs; 103 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
104 unsigned long flags; 104 unsigned long flags;
105 105
106 spin_lock_irqsave(&gpio_lock, flags); 106 spin_lock_irqsave(&gpio_lock, flags);
@@ -122,7 +122,7 @@ static int
122mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) 122mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
123{ 123{
124 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 124 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
125 struct mpc52xx_gpio_wkup *regs = mm_gc->regs; 125 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
126 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 126 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
127 struct mpc52xx_gpiochip, mmchip); 127 struct mpc52xx_gpiochip, mmchip);
128 unsigned long flags; 128 unsigned long flags;
@@ -150,7 +150,7 @@ static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev,
150 const struct of_device_id *match) 150 const struct of_device_id *match)
151{ 151{
152 struct mpc52xx_gpiochip *chip; 152 struct mpc52xx_gpiochip *chip;
153 struct mpc52xx_gpio_wkup *regs; 153 struct mpc52xx_gpio_wkup __iomem *regs;
154 struct of_gpio_chip *ofchip; 154 struct of_gpio_chip *ofchip;
155 int ret; 155 int ret;
156 156
@@ -260,7 +260,7 @@ static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
260 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 260 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
261 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 261 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
262 struct mpc52xx_gpiochip, mmchip); 262 struct mpc52xx_gpiochip, mmchip);
263 struct mpc52xx_gpio *regs = mm_gc->regs; 263 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
264 unsigned long flags; 264 unsigned long flags;
265 265
266 spin_lock_irqsave(&gpio_lock, flags); 266 spin_lock_irqsave(&gpio_lock, flags);
@@ -284,7 +284,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
284 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 284 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
285 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 285 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
286 struct mpc52xx_gpiochip, mmchip); 286 struct mpc52xx_gpiochip, mmchip);
287 struct mpc52xx_gpio *regs = mm_gc->regs; 287 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
288 unsigned long flags; 288 unsigned long flags;
289 289
290 spin_lock_irqsave(&gpio_lock, flags); 290 spin_lock_irqsave(&gpio_lock, flags);
@@ -312,7 +312,7 @@ static int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofdev,
312{ 312{
313 struct mpc52xx_gpiochip *chip; 313 struct mpc52xx_gpiochip *chip;
314 struct of_gpio_chip *ofchip; 314 struct of_gpio_chip *ofchip;
315 struct mpc52xx_gpio *regs; 315 struct mpc52xx_gpio __iomem *regs;
316 int ret; 316 int ret;
317 317
318 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 318 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
@@ -387,7 +387,7 @@ mpc52xx_gpt_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
387static int mpc52xx_gpt_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) 387static int mpc52xx_gpt_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
388{ 388{
389 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 389 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
390 struct mpc52xx_gpt *regs = mm_gc->regs; 390 struct mpc52xx_gpt __iomem *regs = mm_gc->regs;
391 391
392 out_be32(&regs->mode, 0x04); 392 out_be32(&regs->mode, 0x04);
393 393
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 25f8bc75e838..43a459f63e31 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -32,6 +32,7 @@
32#include <linux/fsl_devices.h> 32#include <linux/fsl_devices.h>
33#include <linux/of_platform.h> 33#include <linux/of_platform.h>
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35#include <linux/phy.h>
35 36
36#include <asm/system.h> 37#include <asm/system.h>
37#include <asm/atomic.h> 38#include <asm/atomic.h>
@@ -56,6 +57,95 @@
56#define DBG(fmt...) 57#define DBG(fmt...)
57#endif 58#endif
58 59
60#define MV88E1111_SCR 0x10
61#define MV88E1111_SCR_125CLK 0x0010
62static int mpc8568_fixup_125_clock(struct phy_device *phydev)
63{
64 int scr;
65 int err;
66
67 /* Workaround for the 125 CLK Toggle */
68 scr = phy_read(phydev, MV88E1111_SCR);
69
70 if (scr < 0)
71 return scr;
72
73 err = phy_write(phydev, MV88E1111_SCR, scr & ~(MV88E1111_SCR_125CLK));
74
75 if (err)
76 return err;
77
78 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
79
80 if (err)
81 return err;
82
83 scr = phy_read(phydev, MV88E1111_SCR);
84
85 if (scr < 0)
86 return err;
87
88 err = phy_write(phydev, MV88E1111_SCR, scr | 0x0008);
89
90 return err;
91}
92
93static int mpc8568_mds_phy_fixups(struct phy_device *phydev)
94{
95 int temp;
96 int err;
97
98 /* Errata */
99 err = phy_write(phydev,29, 0x0006);
100
101 if (err)
102 return err;
103
104 temp = phy_read(phydev, 30);
105
106 if (temp < 0)
107 return temp;
108
109 temp = (temp & (~0x8000)) | 0x4000;
110 err = phy_write(phydev,30, temp);
111
112 if (err)
113 return err;
114
115 err = phy_write(phydev,29, 0x000a);
116
117 if (err)
118 return err;
119
120 temp = phy_read(phydev, 30);
121
122 if (temp < 0)
123 return temp;
124
125 temp = phy_read(phydev, 30);
126
127 if (temp < 0)
128 return temp;
129
130 temp &= ~0x0020;
131
132 err = phy_write(phydev,30,temp);
133
134 if (err)
135 return err;
136
137 /* Disable automatic MDI/MDIX selection */
138 temp = phy_read(phydev, 16);
139
140 if (temp < 0)
141 return temp;
142
143 temp &= ~0x0060;
144 err = phy_write(phydev,16,temp);
145
146 return err;
147}
148
59/* ************************************************************************ 149/* ************************************************************************
60 * 150 *
61 * Setup the architecture 151 * Setup the architecture
@@ -64,7 +154,7 @@
64static void __init mpc85xx_mds_setup_arch(void) 154static void __init mpc85xx_mds_setup_arch(void)
65{ 155{
66 struct device_node *np; 156 struct device_node *np;
67 static u8 *bcsr_regs = NULL; 157 static u8 __iomem *bcsr_regs = NULL;
68 158
69 if (ppc_md.progress) 159 if (ppc_md.progress)
70 ppc_md.progress("mpc85xx_mds_setup_arch()", 0); 160 ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
@@ -138,6 +228,35 @@ static void __init mpc85xx_mds_setup_arch(void)
138#endif /* CONFIG_QUICC_ENGINE */ 228#endif /* CONFIG_QUICC_ENGINE */
139} 229}
140 230
231
232static int __init board_fixups(void)
233{
234 char phy_id[BUS_ID_SIZE];
235 char *compstrs[2] = {"fsl,gianfar-mdio", "fsl,ucc-mdio"};
236 struct device_node *mdio;
237 struct resource res;
238 int i;
239
240 for (i = 0; i < ARRAY_SIZE(compstrs); i++) {
241 mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
242
243 of_address_to_resource(mdio, 0, &res);
244 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1);
245
246 phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock);
247 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
248
249 /* Register a workaround for errata */
250 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 7);
251 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
252
253 of_node_put(mdio);
254 }
255
256 return 0;
257}
258machine_arch_initcall(mpc85xx_mds, board_fixups);
259
141static struct of_device_id mpc85xx_ids[] = { 260static struct of_device_id mpc85xx_ids[] = {
142 { .type = "soc", }, 261 { .type = "soc", },
143 { .compatible = "soc", }, 262 { .compatible = "soc", },
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index 488facb99fe8..b9246ea0928a 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -49,6 +49,8 @@
49#include <sysdev/fsl_soc.h> 49#include <sysdev/fsl_soc.h>
50#include <sysdev/fsl_pci.h> 50#include <sysdev/fsl_pci.h>
51 51
52static int sbc_rev;
53
52static void __init sbc8548_pic_init(void) 54static void __init sbc8548_pic_init(void)
53{ 55{
54 struct mpic *mpic; 56 struct mpic *mpic;
@@ -79,6 +81,30 @@ static void __init sbc8548_pic_init(void)
79 mpic_init(mpic); 81 mpic_init(mpic);
80} 82}
81 83
84/* Extract the HW Rev from the EPLD on the board */
85static int __init sbc8548_hw_rev(void)
86{
87 struct device_node *np;
88 struct resource res;
89 unsigned int *rev;
90 int board_rev = 0;
91
92 np = of_find_compatible_node(NULL, NULL, "hw-rev");
93 if (np == NULL) {
94 printk("No HW-REV found in DTB.\n");
95 return -ENODEV;
96 }
97
98 of_address_to_resource(np, 0, &res);
99 of_node_put(np);
100
101 rev = ioremap(res.start,sizeof(unsigned int));
102 board_rev = (*rev) >> 28;
103 iounmap(rev);
104
105 return board_rev;
106}
107
82/* 108/*
83 * Setup the architecture 109 * Setup the architecture
84 */ 110 */
@@ -104,6 +130,7 @@ static void __init sbc8548_setup_arch(void)
104 } 130 }
105 } 131 }
106#endif 132#endif
133 sbc_rev = sbc8548_hw_rev();
107} 134}
108 135
109static void sbc8548_show_cpuinfo(struct seq_file *m) 136static void sbc8548_show_cpuinfo(struct seq_file *m)
@@ -115,7 +142,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
115 svid = mfspr(SPRN_SVR); 142 svid = mfspr(SPRN_SVR);
116 143
117 seq_printf(m, "Vendor\t\t: Wind River\n"); 144 seq_printf(m, "Vendor\t\t: Wind River\n");
118 seq_printf(m, "Machine\t\t: SBC8548\n"); 145 seq_printf(m, "Machine\t\t: SBC8548 v%d\n", sbc_rev);
119 seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 146 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
120 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 147 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
121 148
@@ -130,6 +157,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
130static struct of_device_id __initdata of_bus_ids[] = { 157static struct of_device_id __initdata of_bus_ids[] = {
131 { .name = "soc", }, 158 { .name = "soc", },
132 { .type = "soc", }, 159 { .type = "soc", },
160 { .compatible = "simple-bus", },
133 {}, 161 {},
134}; 162};
135 163
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 5e1e8cf14e75..dea13208bf64 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -43,6 +43,7 @@ static unsigned char *pixis_bdcfg0, *pixis_arch;
43 43
44static struct of_device_id __initdata mpc8610_ids[] = { 44static struct of_device_id __initdata mpc8610_ids[] = {
45 { .compatible = "fsl,mpc8610-immr", }, 45 { .compatible = "fsl,mpc8610-immr", },
46 { .compatible = "simple-bus", },
46 {} 47 {}
47}; 48};
48 49
@@ -216,11 +217,21 @@ void mpc8610hpcd_set_gamma_table(int monitor_port, char *gamma_table_base)
216 } 217 }
217} 218}
218 219
220#define PX_BRDCFG0_DVISEL (1 << 3)
221#define PX_BRDCFG0_DLINK (1 << 4)
222#define PX_BRDCFG0_DIU_MASK (PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK)
223
219void mpc8610hpcd_set_monitor_port(int monitor_port) 224void mpc8610hpcd_set_monitor_port(int monitor_port)
220{ 225{
221 static const u8 bdcfg[] = {0xBD, 0xB5, 0xA5}; 226 static const u8 bdcfg[] = {
227 PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK,
228 PX_BRDCFG0_DLINK,
229 0,
230 };
231
222 if (monitor_port < 3) 232 if (monitor_port < 3)
223 *pixis_bdcfg0 = bdcfg[monitor_port]; 233 clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK,
234 bdcfg[monitor_port]);
224} 235}
225 236
226void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) 237void mpc8610hpcd_set_pixel_clock(unsigned int pixclock)
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index 31da84c458d2..0e04f8fb152a 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -217,7 +217,7 @@ static u##size scc_pciex_in##name(unsigned long port) \
217static void scc_pciex_ins##name(unsigned long p, void *b, unsigned long c) \ 217static void scc_pciex_ins##name(unsigned long p, void *b, unsigned long c) \
218{ \ 218{ \
219 struct iowa_bus *bus = iowa_pio_find_bus(p); \ 219 struct iowa_bus *bus = iowa_pio_find_bus(p); \
220 u##size *dst = b; \ 220 __le##size *dst = b; \
221 for (; c != 0; c--, dst++) \ 221 for (; c != 0; c--, dst++) \
222 *dst = cpu_to_le##size(__scc_pciex_in##name(bus->phb, p)); \ 222 *dst = cpu_to_le##size(__scc_pciex_in##name(bus->phb, p)); \
223 scc_pciex_io_flush(bus); \ 223 scc_pciex_io_flush(bus); \
@@ -231,10 +231,11 @@ static void scc_pciex_outs##name(unsigned long p, const void *b, \
231 unsigned long c) \ 231 unsigned long c) \
232{ \ 232{ \
233 struct iowa_bus *bus = iowa_pio_find_bus(p); \ 233 struct iowa_bus *bus = iowa_pio_find_bus(p); \
234 const u##size *src = b; \ 234 const __le##size *src = b; \
235 for (; c != 0; c--, src++) \ 235 for (; c != 0; c--, src++) \
236 __scc_pciex_out##name(bus->phb, le##size##_to_cpu(*src), p); \ 236 __scc_pciex_out##name(bus->phb, le##size##_to_cpu(*src), p); \
237} 237}
238#define __le8 u8
238#define cpu_to_le8(x) (x) 239#define cpu_to_le8(x) (x)
239#define le8_to_cpu(x) (x) 240#define le8_to_cpu(x) (x)
240PCIEX_PIO_FUNC(8, b) 241PCIEX_PIO_FUNC(8, b)
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 3b84e8be314c..b5f84e8f0899 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -118,7 +118,7 @@ static void iowa_##name at \
118#undef DEF_PCI_AC_RET 118#undef DEF_PCI_AC_RET
119#undef DEF_PCI_AC_NORET 119#undef DEF_PCI_AC_NORET
120 120
121static struct ppc_pci_io __initdata iowa_pci_io = { 121static const struct ppc_pci_io __devinitconst iowa_pci_io = {
122 122
123#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) .name = iowa_##name, 123#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) .name = iowa_##name,
124#define DEF_PCI_AC_NORET(name, at, al, space, aa) .name = iowa_##name, 124#define DEF_PCI_AC_NORET(name, at, al, space, aa) .name = iowa_##name,
@@ -146,7 +146,7 @@ static void __iomem *iowa_ioremap(unsigned long addr, unsigned long size,
146} 146}
147 147
148/* Regist new bus to support workaround */ 148/* Regist new bus to support workaround */
149void __init iowa_register_bus(struct pci_controller *phb, 149void __devinit iowa_register_bus(struct pci_controller *phb,
150 struct ppc_pci_io *ops, 150 struct ppc_pci_io *ops,
151 int (*initfunc)(struct iowa_bus *, void *), void *data) 151 int (*initfunc)(struct iowa_bus *, void *), void *data)
152{ 152{
@@ -173,7 +173,7 @@ void __init iowa_register_bus(struct pci_controller *phb,
173} 173}
174 174
175/* enable IO workaround */ 175/* enable IO workaround */
176void __init io_workaround_init(void) 176void __devinit io_workaround_init(void)
177{ 177{
178 static int io_workaround_inited; 178 static int io_workaround_inited;
179 179
diff --git a/arch/powerpc/platforms/cell/io-workarounds.h b/arch/powerpc/platforms/cell/io-workarounds.h
index 79d8ed3d510f..6efc7782ebf2 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.h
+++ b/arch/powerpc/platforms/cell/io-workarounds.h
@@ -31,9 +31,9 @@ struct iowa_bus {
31 void *private; 31 void *private;
32}; 32};
33 33
34void __init io_workaround_init(void); 34void __devinit io_workaround_init(void);
35void __init iowa_register_bus(struct pci_controller *, struct ppc_pci_io *, 35void __devinit iowa_register_bus(struct pci_controller *, struct ppc_pci_io *,
36 int (*)(struct iowa_bus *, void *), void *); 36 int (*)(struct iowa_bus *, void *), void *);
37struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR); 37struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
38struct iowa_bus *iowa_pio_find_bus(unsigned long); 38struct iowa_bus *iowa_pio_find_bus(unsigned long);
39 39
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 80911a373400..c81341ff75b5 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -32,6 +32,7 @@
32#include <linux/marker.h> 32#include <linux/marker.h>
33 33
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/time.h>
35#include <asm/spu.h> 36#include <asm/spu.h>
36#include <asm/spu_info.h> 37#include <asm/spu_info.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2e411f23462b..745dd51ec37f 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -659,7 +659,7 @@ static struct spu *find_victim(struct spu_context *ctx)
659 659
660 victim->stats.invol_ctx_switch++; 660 victim->stats.invol_ctx_switch++;
661 spu->stats.invol_ctx_switch++; 661 spu->stats.invol_ctx_switch++;
662 if (test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) 662 if (test_bit(SPU_SCHED_SPU_RUN, &victim->sched_flags))
663 spu_add_to_rq(victim); 663 spu_add_to_rq(victim);
664 664
665 mutex_unlock(&victim->state_mutex); 665 mutex_unlock(&victim->state_mutex);
diff --git a/arch/powerpc/platforms/pasemi/misc.c b/arch/powerpc/platforms/pasemi/misc.c
index ded7d152d00c..e0ab299763c1 100644
--- a/arch/powerpc/platforms/pasemi/misc.c
+++ b/arch/powerpc/platforms/pasemi/misc.c
@@ -24,12 +24,11 @@
24 */ 24 */
25struct i2c_driver_device { 25struct i2c_driver_device {
26 char *of_device; 26 char *of_device;
27 char *i2c_driver;
28 char *i2c_type; 27 char *i2c_type;
29}; 28};
30 29
31static struct i2c_driver_device i2c_devices[] __initdata = { 30static struct i2c_driver_device i2c_devices[] __initdata = {
32 {"dallas,ds1338", "rtc-ds1307", "ds1338"}, 31 {"dallas,ds1338", "ds1338"},
33}; 32};
34 33
35static int __init find_i2c_driver(struct device_node *node, 34static int __init find_i2c_driver(struct device_node *node,
@@ -40,9 +39,7 @@ static int __init find_i2c_driver(struct device_node *node,
40 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { 39 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
41 if (!of_device_is_compatible(node, i2c_devices[i].of_device)) 40 if (!of_device_is_compatible(node, i2c_devices[i].of_device))
42 continue; 41 continue;
43 if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver, 42 if (strlcpy(info->type, i2c_devices[i].i2c_type,
44 KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
45 strlcpy(info->type, i2c_devices[i].i2c_type,
46 I2C_NAME_SIZE) >= I2C_NAME_SIZE) 43 I2C_NAME_SIZE) >= I2C_NAME_SIZE)
47 return -ENOMEM; 44 return -ENOMEM;
48 return 0; 45 return 0;
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 5b3fb2b321ab..3a58ffabccd9 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -317,6 +317,9 @@ static int __init ps3_mm_add_memory(void)
317 return result; 317 return result;
318 } 318 }
319 319
320 lmb_add(start_addr, map.r1.size);
321 lmb_analyze();
322
320 result = online_pages(start_pfn, nr_pages); 323 result = online_pages(start_pfn, nr_pages);
321 324
322 if (result) 325 if (result)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3a7054e2bb75..019657c110b6 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -432,7 +432,7 @@ static struct i2c_driver_device i2c_devices[] __initdata = {
432 {"dallas,ds1339", "ds1339"}, 432 {"dallas,ds1339", "ds1339"},
433 {"dallas,ds1340", "ds1340"}, 433 {"dallas,ds1340", "ds1340"},
434 {"stm,m41t00", "m41t00"}, 434 {"stm,m41t00", "m41t00"},
435 {"dallas,ds1374", "rtc-ds1374"}, 435 {"dallas,ds1374", "ds1374"},
436}; 436};
437 437
438static int __init of_find_i2c_driver(struct device_node *node, 438static int __init of_find_i2c_driver(struct device_node *node,
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 8619f2a3f1f6..7680001676a6 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1331,6 +1331,9 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1331 unsigned long flags; 1331 unsigned long flags;
1332 u32 reg; 1332 u32 reg;
1333 1333
1334 if (!mpic)
1335 return;
1336
1334 spin_lock_irqsave(&mpic_lock, flags); 1337 spin_lock_irqsave(&mpic_lock, flags);
1335 if (is_ipi) { 1338 if (is_ipi) {
1336 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & 1339 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
@@ -1346,23 +1349,6 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1346 spin_unlock_irqrestore(&mpic_lock, flags); 1349 spin_unlock_irqrestore(&mpic_lock, flags);
1347} 1350}
1348 1351
1349unsigned int mpic_irq_get_priority(unsigned int irq)
1350{
1351 unsigned int is_ipi;
1352 struct mpic *mpic = mpic_find(irq, &is_ipi);
1353 unsigned int src = mpic_irq_to_hw(irq);
1354 unsigned long flags;
1355 u32 reg;
1356
1357 spin_lock_irqsave(&mpic_lock, flags);
1358 if (is_ipi)
1359 reg = mpic_ipi_read(src = mpic->ipi_vecs[0]);
1360 else
1361 reg = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
1362 spin_unlock_irqrestore(&mpic_lock, flags);
1363 return (reg & MPIC_VECPRI_PRIORITY_MASK) >> MPIC_VECPRI_PRIORITY_SHIFT;
1364}
1365
1366void mpic_setup_this_cpu(void) 1352void mpic_setup_this_cpu(void)
1367{ 1353{
1368#ifdef CONFIG_SMP 1354#ifdef CONFIG_SMP
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 8df7f0e4c3a6..2352d139b262 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -43,7 +43,7 @@ KBUILD_AFLAGS += $(cpu-as-y)
43KBUILD_CFLAGS += $(cpu-as-y) 43KBUILD_CFLAGS += $(cpu-as-y)
44 44
45# Default to the common case. 45# Default to the common case.
46KBUILD_DEFCONFIG := common_defconfig 46KBUILD_DEFCONFIG := ebony_defconfig
47 47
48head-y := arch/ppc/kernel/head.o 48head-y := arch/ppc/kernel/head.o
49head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o 49head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 16ac11ca7ba0..5d529bcbeee9 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -24,6 +24,7 @@
24#include <asm/checksum.h> 24#include <asm/checksum.h>
25#include <asm/pgtable.h> 25#include <asm/pgtable.h>
26#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
27#include <asm/cacheflush.h>
27#include <linux/adb.h> 28#include <linux/adb.h>
28#include <linux/cuda.h> 29#include <linux/cuda.h>
29#include <linux/pmu.h> 30#include <linux/pmu.h>
@@ -59,8 +60,10 @@ long long __ashrdi3(long long, int);
59long long __ashldi3(long long, int); 60long long __ashldi3(long long, int);
60long long __lshrdi3(long long, int); 61long long __lshrdi3(long long, int);
61 62
63EXPORT_SYMBOL(empty_zero_page);
62EXPORT_SYMBOL(clear_pages); 64EXPORT_SYMBOL(clear_pages);
63EXPORT_SYMBOL(clear_user_page); 65EXPORT_SYMBOL(clear_user_page);
66EXPORT_SYMBOL(copy_page);
64EXPORT_SYMBOL(transfer_to_handler); 67EXPORT_SYMBOL(transfer_to_handler);
65EXPORT_SYMBOL(do_IRQ); 68EXPORT_SYMBOL(do_IRQ);
66EXPORT_SYMBOL(machine_check_exception); 69EXPORT_SYMBOL(machine_check_exception);
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index bfddfdee0b65..51e8094f52d6 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -36,6 +36,7 @@
36#include <asm/nvram.h> 36#include <asm/nvram.h>
37#include <asm/xmon.h> 37#include <asm/xmon.h>
38#include <asm/ocp.h> 38#include <asm/ocp.h>
39#include <asm/irq.h>
39 40
40#define USES_PPC_SYS (defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \ 41#define USES_PPC_SYS (defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \
41 defined(CONFIG_PPC_MPC52xx)) 42 defined(CONFIG_PPC_MPC52xx))
diff --git a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c
index 18495e754e30..d687b0f8763b 100644
--- a/arch/ppc/platforms/residual.c
+++ b/arch/ppc/platforms/residual.c
@@ -38,6 +38,7 @@
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/ioport.h> 39#include <linux/ioport.h>
40#include <linux/pci.h> 40#include <linux/pci.h>
41#include <linux/proc_fs.h>
41 42
42#include <asm/sections.h> 43#include <asm/sections.h>
43#include <asm/mmu.h> 44#include <asm/mmu.h>
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 1d035082e78e..107e492cb47e 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -304,10 +304,14 @@ config ARCH_SPARSEMEM_ENABLE
304 def_bool y 304 def_bool y
305 select SPARSEMEM_VMEMMAP_ENABLE 305 select SPARSEMEM_VMEMMAP_ENABLE
306 select SPARSEMEM_VMEMMAP 306 select SPARSEMEM_VMEMMAP
307 select SPARSEMEM_STATIC if !64BIT
307 308
308config ARCH_SPARSEMEM_DEFAULT 309config ARCH_SPARSEMEM_DEFAULT
309 def_bool y 310 def_bool y
310 311
312config ARCH_SELECT_MEMORY_MODEL
313 def_bool y
314
311source "mm/Kconfig" 315source "mm/Kconfig"
312 316
313comment "I/O subsystem configuration" 317comment "I/O subsystem configuration"
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 655d52543e2d..ad40729bec3d 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -130,6 +130,7 @@ static void appldata_work_fn(struct work_struct *work)
130 130
131 P_DEBUG(" -= Work Queue =-\n"); 131 P_DEBUG(" -= Work Queue =-\n");
132 i = 0; 132 i = 0;
133 get_online_cpus();
133 spin_lock(&appldata_ops_lock); 134 spin_lock(&appldata_ops_lock);
134 list_for_each(lh, &appldata_ops_list) { 135 list_for_each(lh, &appldata_ops_list) {
135 ops = list_entry(lh, struct appldata_ops, list); 136 ops = list_entry(lh, struct appldata_ops, list);
@@ -140,6 +141,7 @@ static void appldata_work_fn(struct work_struct *work)
140 } 141 }
141 } 142 }
142 spin_unlock(&appldata_ops_lock); 143 spin_unlock(&appldata_ops_lock);
144 put_online_cpus();
143} 145}
144 146
145/* 147/*
@@ -266,12 +268,14 @@ appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
266 len = *lenp; 268 len = *lenp;
267 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) 269 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len))
268 return -EFAULT; 270 return -EFAULT;
271 get_online_cpus();
269 spin_lock(&appldata_timer_lock); 272 spin_lock(&appldata_timer_lock);
270 if (buf[0] == '1') 273 if (buf[0] == '1')
271 __appldata_vtimer_setup(APPLDATA_ADD_TIMER); 274 __appldata_vtimer_setup(APPLDATA_ADD_TIMER);
272 else if (buf[0] == '0') 275 else if (buf[0] == '0')
273 __appldata_vtimer_setup(APPLDATA_DEL_TIMER); 276 __appldata_vtimer_setup(APPLDATA_DEL_TIMER);
274 spin_unlock(&appldata_timer_lock); 277 spin_unlock(&appldata_timer_lock);
278 put_online_cpus();
275out: 279out:
276 *lenp = len; 280 *lenp = len;
277 *ppos += len; 281 *ppos += len;
@@ -314,10 +318,12 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
314 return -EINVAL; 318 return -EINVAL;
315 } 319 }
316 320
321 get_online_cpus();
317 spin_lock(&appldata_timer_lock); 322 spin_lock(&appldata_timer_lock);
318 appldata_interval = interval; 323 appldata_interval = interval;
319 __appldata_vtimer_setup(APPLDATA_MOD_TIMER); 324 __appldata_vtimer_setup(APPLDATA_MOD_TIMER);
320 spin_unlock(&appldata_timer_lock); 325 spin_unlock(&appldata_timer_lock);
326 put_online_cpus();
321 327
322 P_INFO("Monitoring CPU interval set to %u milliseconds.\n", 328 P_INFO("Monitoring CPU interval set to %u milliseconds.\n",
323 interval); 329 interval);
@@ -556,8 +562,10 @@ static int __init appldata_init(void)
556 return -ENOMEM; 562 return -ENOMEM;
557 } 563 }
558 564
565 get_online_cpus();
559 for_each_online_cpu(i) 566 for_each_online_cpu(i)
560 appldata_online_cpu(i); 567 appldata_online_cpu(i);
568 put_online_cpus();
561 569
562 /* Register cpu hotplug notifier */ 570 /* Register cpu hotplug notifier */
563 register_hotcpu_notifier(&appldata_nb); 571 register_hotcpu_notifier(&appldata_nb);
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index aa341d0ea1e6..c5cdb975d590 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/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.25 3# Linux kernel version: 2.6.26-rc4
4# Wed Apr 30 11:07:45 2008 4# Fri May 30 09:49:33 2008
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -103,6 +103,7 @@ CONFIG_RT_MUTEXES=y
103# CONFIG_TINY_SHMEM is not set 103# CONFIG_TINY_SHMEM is not set
104CONFIG_BASE_SMALL=0 104CONFIG_BASE_SMALL=0
105CONFIG_MODULES=y 105CONFIG_MODULES=y
106# CONFIG_MODULE_FORCE_LOAD is not set
106CONFIG_MODULE_UNLOAD=y 107CONFIG_MODULE_UNLOAD=y
107# CONFIG_MODULE_FORCE_UNLOAD is not set 108# CONFIG_MODULE_FORCE_UNLOAD is not set
108CONFIG_MODVERSIONS=y 109CONFIG_MODVERSIONS=y
@@ -173,6 +174,7 @@ CONFIG_PREEMPT=y
173# CONFIG_PREEMPT_RCU is not set 174# CONFIG_PREEMPT_RCU is not set
174CONFIG_ARCH_SPARSEMEM_ENABLE=y 175CONFIG_ARCH_SPARSEMEM_ENABLE=y
175CONFIG_ARCH_SPARSEMEM_DEFAULT=y 176CONFIG_ARCH_SPARSEMEM_DEFAULT=y
177CONFIG_ARCH_SELECT_MEMORY_MODEL=y
176CONFIG_SELECT_MEMORY_MODEL=y 178CONFIG_SELECT_MEMORY_MODEL=y
177# CONFIG_FLATMEM_MANUAL is not set 179# CONFIG_FLATMEM_MANUAL is not set
178# CONFIG_DISCONTIGMEM_MANUAL is not set 180# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -210,6 +212,7 @@ CONFIG_FORCE_MAX_ZONEORDER=9
210CONFIG_PFAULT=y 212CONFIG_PFAULT=y
211# CONFIG_SHARED_KERNEL is not set 213# CONFIG_SHARED_KERNEL is not set
212# CONFIG_CMM is not set 214# CONFIG_CMM is not set
215# CONFIG_PAGE_STATES is not set
213CONFIG_VIRT_TIMER=y 216CONFIG_VIRT_TIMER=y
214CONFIG_VIRT_CPU_ACCOUNTING=y 217CONFIG_VIRT_CPU_ACCOUNTING=y
215# CONFIG_APPLDATA_BASE is not set 218# CONFIG_APPLDATA_BASE is not set
@@ -620,6 +623,7 @@ CONFIG_S390_VMUR=m
620# 623#
621# CONFIG_MEMSTICK is not set 624# CONFIG_MEMSTICK is not set
622# CONFIG_NEW_LEDS is not set 625# CONFIG_NEW_LEDS is not set
626CONFIG_ACCESSIBILITY=y
623 627
624# 628#
625# File systems 629# File systems
@@ -754,11 +758,12 @@ CONFIG_FRAME_WARN=2048
754CONFIG_MAGIC_SYSRQ=y 758CONFIG_MAGIC_SYSRQ=y
755# CONFIG_UNUSED_SYMBOLS is not set 759# CONFIG_UNUSED_SYMBOLS is not set
756CONFIG_DEBUG_FS=y 760CONFIG_DEBUG_FS=y
757CONFIG_HEADERS_CHECK=y 761# CONFIG_HEADERS_CHECK is not set
758CONFIG_DEBUG_KERNEL=y 762CONFIG_DEBUG_KERNEL=y
759# CONFIG_SCHED_DEBUG is not set 763# CONFIG_SCHED_DEBUG is not set
760# CONFIG_SCHEDSTATS is not set 764# CONFIG_SCHEDSTATS is not set
761# CONFIG_TIMER_STATS is not set 765# CONFIG_TIMER_STATS is not set
766# CONFIG_DEBUG_OBJECTS is not set
762# CONFIG_DEBUG_SLAB is not set 767# CONFIG_DEBUG_SLAB is not set
763CONFIG_DEBUG_PREEMPT=y 768CONFIG_DEBUG_PREEMPT=y
764# CONFIG_DEBUG_RT_MUTEXES is not set 769# CONFIG_DEBUG_RT_MUTEXES is not set
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index dff0568e67ec..c93d1296cc0a 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -71,7 +71,7 @@ static ssize_t debug_input(struct file *file, const char __user *user_buf,
71 size_t user_len, loff_t * offset); 71 size_t user_len, loff_t * offset);
72static int debug_open(struct inode *inode, struct file *file); 72static int debug_open(struct inode *inode, struct file *file);
73static int debug_close(struct inode *inode, struct file *file); 73static int debug_close(struct inode *inode, struct file *file);
74static debug_info_t* debug_info_create(char *name, int pages_per_area, 74static debug_info_t *debug_info_create(const char *name, int pages_per_area,
75 int nr_areas, int buf_size, mode_t mode); 75 int nr_areas, int buf_size, mode_t mode);
76static void debug_info_get(debug_info_t *); 76static void debug_info_get(debug_info_t *);
77static void debug_info_put(debug_info_t *); 77static void debug_info_put(debug_info_t *);
@@ -234,8 +234,8 @@ fail_malloc_areas:
234 */ 234 */
235 235
236static debug_info_t* 236static debug_info_t*
237debug_info_alloc(char *name, int pages_per_area, int nr_areas, int buf_size, 237debug_info_alloc(const char *name, int pages_per_area, int nr_areas,
238 int level, int mode) 238 int buf_size, int level, int mode)
239{ 239{
240 debug_info_t* rc; 240 debug_info_t* rc;
241 241
@@ -326,8 +326,8 @@ debug_info_free(debug_info_t* db_info){
326 */ 326 */
327 327
328static debug_info_t* 328static debug_info_t*
329debug_info_create(char *name, int pages_per_area, int nr_areas, int buf_size, 329debug_info_create(const char *name, int pages_per_area, int nr_areas,
330 mode_t mode) 330 int buf_size, mode_t mode)
331{ 331{
332 debug_info_t* rc; 332 debug_info_t* rc;
333 333
@@ -684,9 +684,9 @@ debug_close(struct inode *inode, struct file *file)
684 * - Returns handle for debug area 684 * - Returns handle for debug area
685 */ 685 */
686 686
687debug_info_t *debug_register_mode(char *name, int pages_per_area, int nr_areas, 687debug_info_t *debug_register_mode(const char *name, int pages_per_area,
688 int buf_size, mode_t mode, uid_t uid, 688 int nr_areas, int buf_size, mode_t mode,
689 gid_t gid) 689 uid_t uid, gid_t gid)
690{ 690{
691 debug_info_t *rc = NULL; 691 debug_info_t *rc = NULL;
692 692
@@ -722,8 +722,8 @@ EXPORT_SYMBOL(debug_register_mode);
722 * - returns handle for debug area 722 * - returns handle for debug area
723 */ 723 */
724 724
725debug_info_t *debug_register(char *name, int pages_per_area, int nr_areas, 725debug_info_t *debug_register(const char *name, int pages_per_area,
726 int buf_size) 726 int nr_areas, int buf_size)
727{ 727{
728 return debug_register_mode(name, pages_per_area, nr_areas, buf_size, 728 return debug_register_mode(name, pages_per_area, nr_areas, buf_size,
729 S_IRUSR | S_IWUSR, 0, 0); 729 S_IRUSR | S_IWUSR, 0, 0);
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index c14a336f6300..d2f270c995d9 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -208,7 +208,7 @@ static const unsigned char formats[][7] = {
208 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 }, /* e.g. madbr */ 208 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 }, /* e.g. madbr */
209 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },/* e.g. didbr */ 209 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },/* e.g. didbr */
210 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },/* e.g. .insn */ 210 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },/* e.g. .insn */
211 [INSTR_RRF_R0RR] = { 0xff, R_24,R_28,R_16,0,0,0 }, /* e.g. idte */ 211 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 }, /* e.g. idte */
212 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 }, /* e.g. fixr */ 212 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 }, /* e.g. fixr */
213 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 }, /* e.g. cfebr */ 213 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 }, /* e.g. cfebr */
214 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 }, /* e.g. sske */ 214 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 }, /* e.g. sske */
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c
index d494161b05b4..7ad003969251 100644
--- a/arch/s390/kernel/init_task.c
+++ b/arch/s390/kernel/init_task.c
@@ -17,7 +17,6 @@
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18 18
19static struct fs_struct init_fs = INIT_FS; 19static struct fs_struct init_fs = INIT_FS;
20static struct files_struct init_files = INIT_FILES;
21static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 20static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
23struct mm_struct init_mm = INIT_MM(init_mm); 22struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index c59a86dca584..e7c5bfb7c755 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -25,6 +25,7 @@ int show_interrupts(struct seq_file *p, void *v)
25 static const char *intrclass_names[] = { "EXT", "I/O", }; 25 static const char *intrclass_names[] = { "EXT", "I/O", };
26 int i = *(loff_t *) v, j; 26 int i = *(loff_t *) v, j;
27 27
28 get_online_cpus();
28 if (i == 0) { 29 if (i == 0) {
29 seq_puts(p, " "); 30 seq_puts(p, " ");
30 for_each_online_cpu(j) 31 for_each_online_cpu(j)
@@ -43,7 +44,7 @@ int show_interrupts(struct seq_file *p, void *v)
43 seq_putc(p, '\n'); 44 seq_putc(p, '\n');
44 45
45 } 46 }
46 47 put_online_cpus();
47 return 0; 48 return 0;
48} 49}
49 50
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 0aeb290060d9..5d4fa4b1c74c 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -139,7 +139,6 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
139 if (wait) 139 if (wait)
140 data.finished = CPU_MASK_NONE; 140 data.finished = CPU_MASK_NONE;
141 141
142 spin_lock(&call_lock);
143 call_data = &data; 142 call_data = &data;
144 143
145 for_each_cpu_mask(cpu, map) 144 for_each_cpu_mask(cpu, map)
@@ -151,7 +150,6 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
151 if (wait) 150 if (wait)
152 while (!cpus_equal(map, data.finished)) 151 while (!cpus_equal(map, data.finished))
153 cpu_relax(); 152 cpu_relax();
154 spin_unlock(&call_lock);
155out: 153out:
156 if (local) { 154 if (local) {
157 local_irq_disable(); 155 local_irq_disable();
@@ -177,11 +175,11 @@ int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
177{ 175{
178 cpumask_t map; 176 cpumask_t map;
179 177
180 preempt_disable(); 178 spin_lock(&call_lock);
181 map = cpu_online_map; 179 map = cpu_online_map;
182 cpu_clear(smp_processor_id(), map); 180 cpu_clear(smp_processor_id(), map);
183 __smp_call_function_map(func, info, nonatomic, wait, map); 181 __smp_call_function_map(func, info, nonatomic, wait, map);
184 preempt_enable(); 182 spin_unlock(&call_lock);
185 return 0; 183 return 0;
186} 184}
187EXPORT_SYMBOL(smp_call_function); 185EXPORT_SYMBOL(smp_call_function);
@@ -202,10 +200,10 @@ EXPORT_SYMBOL(smp_call_function);
202int smp_call_function_single(int cpu, void (*func) (void *info), void *info, 200int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
203 int nonatomic, int wait) 201 int nonatomic, int wait)
204{ 202{
205 preempt_disable(); 203 spin_lock(&call_lock);
206 __smp_call_function_map(func, info, nonatomic, wait, 204 __smp_call_function_map(func, info, nonatomic, wait,
207 cpumask_of_cpu(cpu)); 205 cpumask_of_cpu(cpu));
208 preempt_enable(); 206 spin_unlock(&call_lock);
209 return 0; 207 return 0;
210} 208}
211EXPORT_SYMBOL(smp_call_function_single); 209EXPORT_SYMBOL(smp_call_function_single);
@@ -228,10 +226,10 @@ EXPORT_SYMBOL(smp_call_function_single);
228int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info, 226int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
229 int wait) 227 int wait)
230{ 228{
231 preempt_disable(); 229 spin_lock(&call_lock);
232 cpu_clear(smp_processor_id(), mask); 230 cpu_clear(smp_processor_id(), mask);
233 __smp_call_function_map(func, info, 0, wait, mask); 231 __smp_call_function_map(func, info, 0, wait, mask);
234 preempt_enable(); 232 spin_unlock(&call_lock);
235 return 0; 233 return 0;
236} 234}
237EXPORT_SYMBOL(smp_call_function_mask); 235EXPORT_SYMBOL(smp_call_function_mask);
@@ -592,7 +590,9 @@ int __cpuinit start_secondary(void *cpuvoid)
592 pfault_init(); 590 pfault_init();
593 591
594 /* Mark this cpu as online */ 592 /* Mark this cpu as online */
593 spin_lock(&call_lock);
595 cpu_set(smp_processor_id(), cpu_online_map); 594 cpu_set(smp_processor_id(), cpu_online_map);
595 spin_unlock(&call_lock);
596 /* Switch on interrupts */ 596 /* Switch on interrupts */
597 local_irq_enable(); 597 local_irq_enable();
598 /* Print info about this processor */ 598 /* Print info about this processor */
@@ -711,7 +711,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
711 memset(sf, 0, sizeof(struct stack_frame)); 711 memset(sf, 0, sizeof(struct stack_frame));
712 sf->gprs[9] = (unsigned long) sf; 712 sf->gprs[9] = (unsigned long) sf;
713 cpu_lowcore->save_area[15] = (unsigned long) sf; 713 cpu_lowcore->save_area[15] = (unsigned long) sf;
714 __ctl_store(cpu_lowcore->cregs_save_area[0], 0, 15); 714 __ctl_store(cpu_lowcore->cregs_save_area, 0, 15);
715 asm volatile( 715 asm volatile(
716 " stam 0,15,0(%0)" 716 " stam 0,15,0(%0)"
717 : : "a" (&cpu_lowcore->access_regs_save_area) : "memory"); 717 : : "a" (&cpu_lowcore->access_regs_save_area) : "memory");
@@ -1089,7 +1089,7 @@ out:
1089 1089
1090#ifdef CONFIG_HOTPLUG_CPU 1090#ifdef CONFIG_HOTPLUG_CPU
1091 1091
1092int smp_rescan_cpus(void) 1092int __ref smp_rescan_cpus(void)
1093{ 1093{
1094 cpumask_t newcpus; 1094 cpumask_t newcpus;
1095 int cpu; 1095 int cpu;
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index f639a152869f..a0775e1f08df 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -20,7 +20,7 @@ static int __diag_time_slice_end(struct kvm_vcpu *vcpu)
20 VCPU_EVENT(vcpu, 5, "%s", "diag time slice end"); 20 VCPU_EVENT(vcpu, 5, "%s", "diag time slice end");
21 vcpu->stat.diagnose_44++; 21 vcpu->stat.diagnose_44++;
22 vcpu_put(vcpu); 22 vcpu_put(vcpu);
23 schedule(); 23 yield();
24 vcpu_load(vcpu); 24 vcpu_load(vcpu);
25 return 0; 25 return 0;
26} 26}
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index fcd1ed8015c1..84a7fed4cd4e 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -339,6 +339,11 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
339 if (kvm_cpu_has_interrupt(vcpu)) 339 if (kvm_cpu_has_interrupt(vcpu))
340 return 0; 340 return 0;
341 341
342 __set_cpu_idle(vcpu);
343 spin_lock_bh(&vcpu->arch.local_int.lock);
344 vcpu->arch.local_int.timer_due = 0;
345 spin_unlock_bh(&vcpu->arch.local_int.lock);
346
342 if (psw_interrupts_disabled(vcpu)) { 347 if (psw_interrupts_disabled(vcpu)) {
343 VCPU_EVENT(vcpu, 3, "%s", "disabled wait"); 348 VCPU_EVENT(vcpu, 3, "%s", "disabled wait");
344 __unset_cpu_idle(vcpu); 349 __unset_cpu_idle(vcpu);
@@ -366,8 +371,6 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
366no_timer: 371no_timer:
367 spin_lock_bh(&vcpu->arch.local_int.float_int->lock); 372 spin_lock_bh(&vcpu->arch.local_int.float_int->lock);
368 spin_lock_bh(&vcpu->arch.local_int.lock); 373 spin_lock_bh(&vcpu->arch.local_int.lock);
369 __set_cpu_idle(vcpu);
370 vcpu->arch.local_int.timer_due = 0;
371 add_wait_queue(&vcpu->arch.local_int.wq, &wait); 374 add_wait_queue(&vcpu->arch.local_int.wq, &wait);
372 while (list_empty(&vcpu->arch.local_int.list) && 375 while (list_empty(&vcpu->arch.local_int.list) &&
373 list_empty(&vcpu->arch.local_int.float_int->list) && 376 list_empty(&vcpu->arch.local_int.float_int->list) &&
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 0ac36a649eba..6558b09ff579 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -423,6 +423,8 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
423 return -EINVAL; /* not implemented yet */ 423 return -EINVAL; /* not implemented yet */
424} 424}
425 425
426extern void s390_handle_mcck(void);
427
426static void __vcpu_run(struct kvm_vcpu *vcpu) 428static void __vcpu_run(struct kvm_vcpu *vcpu)
427{ 429{
428 memcpy(&vcpu->arch.sie_block->gg14, &vcpu->arch.guest_gprs[14], 16); 430 memcpy(&vcpu->arch.sie_block->gg14, &vcpu->arch.guest_gprs[14], 16);
@@ -430,13 +432,21 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
430 if (need_resched()) 432 if (need_resched())
431 schedule(); 433 schedule();
432 434
435 if (test_thread_flag(TIF_MCCK_PENDING))
436 s390_handle_mcck();
437
438 kvm_s390_deliver_pending_interrupts(vcpu);
439
433 vcpu->arch.sie_block->icptcode = 0; 440 vcpu->arch.sie_block->icptcode = 0;
434 local_irq_disable(); 441 local_irq_disable();
435 kvm_guest_enter(); 442 kvm_guest_enter();
436 local_irq_enable(); 443 local_irq_enable();
437 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 444 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
438 atomic_read(&vcpu->arch.sie_block->cpuflags)); 445 atomic_read(&vcpu->arch.sie_block->cpuflags));
439 sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs); 446 if (sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs)) {
447 VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
448 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
449 }
440 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 450 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
441 vcpu->arch.sie_block->icptcode); 451 vcpu->arch.sie_block->icptcode);
442 local_irq_disable(); 452 local_irq_disable();
@@ -475,7 +485,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
475 might_sleep(); 485 might_sleep();
476 486
477 do { 487 do {
478 kvm_s390_deliver_pending_interrupts(vcpu);
479 __vcpu_run(vcpu); 488 __vcpu_run(vcpu);
480 rc = kvm_handle_sie_intercept(vcpu); 489 rc = kvm_handle_sie_intercept(vcpu);
481 } while (!signal_pending(current) && !rc); 490 } while (!signal_pending(current) && !rc);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 29f3a63806b9..05598649b326 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -44,37 +44,34 @@ char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
44 44
45void show_mem(void) 45void show_mem(void)
46{ 46{
47 int i, total = 0, reserved = 0; 47 unsigned long i, total = 0, reserved = 0;
48 int shared = 0, cached = 0; 48 unsigned long shared = 0, cached = 0;
49 unsigned long flags;
49 struct page *page; 50 struct page *page;
51 pg_data_t *pgdat;
50 52
51 printk("Mem-info:\n"); 53 printk("Mem-info:\n");
52 show_free_areas(); 54 show_free_areas();
53 i = max_mapnr; 55 for_each_online_pgdat(pgdat) {
54 while (i-- > 0) { 56 pgdat_resize_lock(pgdat, &flags);
55 if (!pfn_valid(i)) 57 for (i = 0; i < pgdat->node_spanned_pages; i++) {
56 continue; 58 if (!pfn_valid(pgdat->node_start_pfn + i))
57 page = pfn_to_page(i); 59 continue;
58 total++; 60 page = pfn_to_page(pgdat->node_start_pfn + i);
59 if (PageReserved(page)) 61 total++;
60 reserved++; 62 if (PageReserved(page))
61 else if (PageSwapCache(page)) 63 reserved++;
62 cached++; 64 else if (PageSwapCache(page))
63 else if (page_count(page)) 65 cached++;
64 shared += page_count(page) - 1; 66 else if (page_count(page))
67 shared += page_count(page) - 1;
68 }
69 pgdat_resize_unlock(pgdat, &flags);
65 } 70 }
66 printk("%d pages of RAM\n", total); 71 printk("%ld pages of RAM\n", total);
67 printk("%d reserved pages\n", reserved); 72 printk("%ld reserved pages\n", reserved);
68 printk("%d pages shared\n", shared); 73 printk("%ld pages shared\n", shared);
69 printk("%d pages swap cached\n", cached); 74 printk("%ld pages swap cached\n", cached);
70
71 printk("%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
72 printk("%lu pages writeback\n", global_page_state(NR_WRITEBACK));
73 printk("%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
74 printk("%lu pages slab\n",
75 global_page_state(NR_SLAB_RECLAIMABLE) +
76 global_page_state(NR_SLAB_UNRECLAIMABLE));
77 printk("%lu pages pagetables\n", global_page_state(NR_PAGETABLE));
78} 75}
79 76
80/* 77/*
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 5c1aea97cd12..3d98ba82ea67 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -254,36 +254,46 @@ void disable_noexec(struct mm_struct *mm, struct task_struct *tsk)
254int s390_enable_sie(void) 254int s390_enable_sie(void)
255{ 255{
256 struct task_struct *tsk = current; 256 struct task_struct *tsk = current;
257 struct mm_struct *mm; 257 struct mm_struct *mm, *old_mm;
258 int rc;
259 258
260 task_lock(tsk); 259 /* Do we have pgstes? if yes, we are done */
261
262 rc = 0;
263 if (tsk->mm->context.pgstes) 260 if (tsk->mm->context.pgstes)
264 goto unlock; 261 return 0;
265 262
266 rc = -EINVAL; 263 /* lets check if we are allowed to replace the mm */
264 task_lock(tsk);
267 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 || 265 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
268 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) 266 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) {
269 goto unlock; 267 task_unlock(tsk);
268 return -EINVAL;
269 }
270 task_unlock(tsk);
270 271
271 tsk->mm->context.pgstes = 1; /* dirty little tricks .. */ 272 /* we copy the mm with pgstes enabled */
273 tsk->mm->context.pgstes = 1;
272 mm = dup_mm(tsk); 274 mm = dup_mm(tsk);
273 tsk->mm->context.pgstes = 0; 275 tsk->mm->context.pgstes = 0;
274
275 rc = -ENOMEM;
276 if (!mm) 276 if (!mm)
277 goto unlock; 277 return -ENOMEM;
278 mmput(tsk->mm); 278
279 /* Now lets check again if somebody attached ptrace etc */
280 task_lock(tsk);
281 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
282 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) {
283 mmput(mm);
284 task_unlock(tsk);
285 return -EINVAL;
286 }
287
288 /* ok, we are alone. No ptrace, no threads, etc. */
289 old_mm = tsk->mm;
279 tsk->mm = tsk->active_mm = mm; 290 tsk->mm = tsk->active_mm = mm;
280 preempt_disable(); 291 preempt_disable();
281 update_mm(mm, tsk); 292 update_mm(mm, tsk);
282 cpu_set(smp_processor_id(), mm->cpu_vm_mask); 293 cpu_set(smp_processor_id(), mm->cpu_vm_mask);
283 preempt_enable(); 294 preempt_enable();
284 rc = 0;
285unlock:
286 task_unlock(tsk); 295 task_unlock(tsk);
287 return rc; 296 mmput(old_mm);
297 return 0;
288} 298}
289EXPORT_SYMBOL_GPL(s390_enable_sie); 299EXPORT_SYMBOL_GPL(s390_enable_sie);
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index beccacf907f3..e4868bfc672f 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -60,7 +60,7 @@ static inline pmd_t *vmem_pmd_alloc(void)
60 return pmd; 60 return pmd;
61} 61}
62 62
63static pte_t __init_refok *vmem_pte_alloc(void) 63static pte_t __ref *vmem_pte_alloc(void)
64{ 64{
65 pte_t *pte; 65 pte_t *pte;
66 66
@@ -221,6 +221,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
221 *pt_dir = pte; 221 *pt_dir = pte;
222 } 222 }
223 } 223 }
224 memset(start, 0, nr * sizeof(struct page));
224 ret = 0; 225 ret = 0;
225out: 226out:
226 flush_tlb_kernel_range(start_addr, end_addr); 227 flush_tlb_kernel_range(start_addr, end_addr);
@@ -235,7 +236,7 @@ static int insert_memory_segment(struct memory_segment *seg)
235{ 236{
236 struct memory_segment *tmp; 237 struct memory_segment *tmp;
237 238
238 if (seg->start + seg->size >= VMEM_MAX_PHYS || 239 if (seg->start + seg->size > VMEM_MAX_PHYS ||
239 seg->start + seg->size < seg->start) 240 seg->start + seg->size < seg->start)
240 return -ERANGE; 241 return -ERANGE;
241 242
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 8a68160079a9..9a854c8e5274 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -281,7 +281,6 @@ config CPU_SUBTYPE_SH7723
281 select CPU_SH4A 281 select CPU_SH4A
282 select CPU_SHX2 282 select CPU_SHX2
283 select ARCH_SPARSEMEM_ENABLE 283 select ARCH_SPARSEMEM_ENABLE
284 select SYS_SUPPORTS_NUMA
285 help 284 help
286 Select SH7723 if you have an SH-MobileR2 CPU. 285 Select SH7723 if you have an SH-MobileR2 CPU.
287 286
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 0d2ef1e9a6fd..0f4549860226 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -81,7 +81,7 @@ config DEBUG_STACK_USAGE
81 81
82config 4KSTACKS 82config 4KSTACKS
83 bool "Use 4Kb for kernel stacks instead of 8Kb" 83 bool "Use 4Kb for kernel stacks instead of 8Kb"
84 depends on DEBUG_KERNEL 84 depends on DEBUG_KERNEL && (MMU || BROKEN)
85 help 85 help
86 If you say Y here the kernel will use a 4Kb stacksize for the 86 If you say Y here the kernel will use a 4Kb stacksize for the
87 kernel stack attached to each process/thread. This facilitates 87 kernel stack attached to each process/thread. This facilitates
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 8050b03d51fc..fb7b1b15e392 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -41,6 +41,8 @@ cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,)
41cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb 41cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
42cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml 42cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
43 43
44cflags-y += $(call cc-option,-mno-fdpic)
45
44# 46#
45# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that 47# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
46# support it, while -Wa,-dsp by itself limits the range of usable opcodes 48# support it, while -Wa,-dsp by itself limits the range of usable opcodes
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 452d0d6459a4..2308e8753bcd 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/ata_platform.h> 13#include <linux/ata_platform.h>
14#include <linux/serial_8250.h>
15#include <linux/sm501.h> 14#include <linux/sm501.h>
16#include <linux/sm501-regs.h> 15#include <linux/sm501-regs.h>
17#include <linux/pm.h> 16#include <linux/pm.h>
@@ -109,27 +108,6 @@ static struct platform_device heartbeat_device = {
109 .resource = heartbeat_resources, 108 .resource = heartbeat_resources,
110}; 109};
111 110
112static struct plat_serial8250_port uart_platform_data[] = {
113 {
114 .membase = (void __iomem *)0xb3e30000,
115 .mapbase = 0xb3e30000,
116 .iotype = UPIO_MEM,
117 .irq = IRQ_VOYAGER,
118 .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ,
119 .regshift = 2,
120 .uartclk = (9600 * 16),
121 },
122 { 0 },
123};
124
125static struct platform_device uart_device = {
126 .name = "serial8250",
127 .id = PLAT8250_DEV_PLATFORM,
128 .dev = {
129 .platform_data = uart_platform_data,
130 },
131};
132
133static struct resource sm501_resources[] = { 111static struct resource sm501_resources[] = {
134 [0] = { 112 [0] = {
135 .start = 0x10000000, 113 .start = 0x10000000,
@@ -185,11 +163,7 @@ static struct sm501_platdata_fb sm501_fb_pdata = {
185}; 163};
186 164
187static struct sm501_initdata sm501_initdata = { 165static struct sm501_initdata sm501_initdata = {
188 .gpio_high = { 166 .devices = SM501_USE_USB_HOST | SM501_USE_UART0,
189 .set = 0x00001fe0,
190 .mask = 0x0,
191 },
192 .devices = SM501_USE_USB_HOST,
193}; 167};
194 168
195static struct sm501_platdata sm501_platform_data = { 169static struct sm501_platdata sm501_platform_data = {
@@ -208,7 +182,6 @@ static struct platform_device sm501_device = {
208}; 182};
209 183
210static struct platform_device *rts7751r2d_devices[] __initdata = { 184static struct platform_device *rts7751r2d_devices[] __initdata = {
211 &uart_device,
212 &sm501_device, 185 &sm501_device,
213 &heartbeat_device, 186 &heartbeat_device,
214 &spi_sh_sci_device, 187 &spi_sh_sci_device,
@@ -272,16 +245,6 @@ static void __init rts7751r2d_setup(char **cmdline_p)
272 245
273 sm501_reg = (void __iomem *)0xb3e00000 + SM501_DRAM_CONTROL; 246 sm501_reg = (void __iomem *)0xb3e00000 + SM501_DRAM_CONTROL;
274 writel(readl(sm501_reg) | 0x00f107c0, sm501_reg); 247 writel(readl(sm501_reg) | 0x00f107c0, sm501_reg);
275
276 /*
277 * Power Mode Gate - Enable UART0
278 */
279
280 sm501_reg = (void __iomem *)0xb3e00000 + SM501_POWER_MODE_0_GATE;
281 writel(readl(sm501_reg) | (1 << SM501_GATE_UART0), sm501_reg);
282
283 sm501_reg = (void __iomem *)0xb3e00000 + SM501_POWER_MODE_1_GATE;
284 writel(readl(sm501_reg) | (1 << SM501_GATE_UART0), sm501_reg);
285} 248}
286 249
287/* 250/*
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
index ee5900817f8f..287408b2ace6 100644
--- a/arch/sh/configs/migor_defconfig
+++ b/arch/sh/configs/migor_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.24 3# Linux kernel version: 2.6.26-rc3
4# Wed Feb 6 21:52:20 2008 4# Thu May 22 14:30:07 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set 20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 25
25# 26#
@@ -36,18 +37,16 @@ CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 37# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 38# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 40# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 41CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 42CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 43CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_CGROUPS is not set 44# CONFIG_CGROUPS is not set
46CONFIG_FAIR_GROUP_SCHED=y 45# CONFIG_GROUP_SCHED is not set
47CONFIG_FAIR_USER_SCHED=y
48# CONFIG_FAIR_CGROUP_SCHED is not set
49CONFIG_SYSFS_DEPRECATED=y 46CONFIG_SYSFS_DEPRECATED=y
47CONFIG_SYSFS_DEPRECATED_V2=y
50# CONFIG_RELAY is not set 48# CONFIG_RELAY is not set
49# CONFIG_NAMESPACES is not set
51CONFIG_BLK_DEV_INITRD=y 50CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE="" 51CONFIG_INITRAMFS_SOURCE=""
53# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 52# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -61,11 +60,13 @@ CONFIG_HOTPLUG=y
61CONFIG_PRINTK=y 60CONFIG_PRINTK=y
62CONFIG_BUG=y 61CONFIG_BUG=y
63CONFIG_ELF_CORE=y 62CONFIG_ELF_CORE=y
63CONFIG_COMPAT_BRK=y
64CONFIG_BASE_FULL=y 64CONFIG_BASE_FULL=y
65CONFIG_FUTEX=y 65CONFIG_FUTEX=y
66CONFIG_ANON_INODES=y 66CONFIG_ANON_INODES=y
67CONFIG_EPOLL=y 67CONFIG_EPOLL=y
68CONFIG_SIGNALFD=y 68CONFIG_SIGNALFD=y
69CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y 70CONFIG_EVENTFD=y
70CONFIG_SHMEM=y 71CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y 72CONFIG_VM_EVENT_COUNTERS=y
@@ -77,11 +78,15 @@ CONFIG_PROFILING=y
77CONFIG_OPROFILE=y 78CONFIG_OPROFILE=y
78CONFIG_HAVE_OPROFILE=y 79CONFIG_HAVE_OPROFILE=y
79# CONFIG_HAVE_KPROBES is not set 80# CONFIG_HAVE_KPROBES is not set
81# CONFIG_HAVE_KRETPROBES is not set
82# CONFIG_HAVE_DMA_ATTRS is not set
83CONFIG_PROC_PAGE_MONITOR=y
80CONFIG_SLABINFO=y 84CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 85CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 86# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 87CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 88CONFIG_MODULES=y
89# CONFIG_MODULE_FORCE_LOAD is not set
85# CONFIG_MODULE_UNLOAD is not set 90# CONFIG_MODULE_UNLOAD is not set
86# CONFIG_MODVERSIONS is not set 91# CONFIG_MODVERSIONS is not set
87# CONFIG_MODULE_SRCVERSION_ALL is not set 92# CONFIG_MODULE_SRCVERSION_ALL is not set
@@ -105,7 +110,6 @@ CONFIG_DEFAULT_AS=y
105# CONFIG_DEFAULT_NOOP is not set 110# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory" 111CONFIG_DEFAULT_IOSCHED="anticipatory"
107CONFIG_CLASSIC_RCU=y 112CONFIG_CLASSIC_RCU=y
108# CONFIG_PREEMPT_RCU is not set
109 113
110# 114#
111# System type 115# System type
@@ -118,6 +122,7 @@ CONFIG_CPU_SHX2=y
118# CONFIG_CPU_SUBTYPE_SH7203 is not set 122# CONFIG_CPU_SUBTYPE_SH7203 is not set
119# CONFIG_CPU_SUBTYPE_SH7206 is not set 123# CONFIG_CPU_SUBTYPE_SH7206 is not set
120# CONFIG_CPU_SUBTYPE_SH7263 is not set 124# CONFIG_CPU_SUBTYPE_SH7263 is not set
125# CONFIG_CPU_SUBTYPE_MXG is not set
121# CONFIG_CPU_SUBTYPE_SH7705 is not set 126# CONFIG_CPU_SUBTYPE_SH7705 is not set
122# CONFIG_CPU_SUBTYPE_SH7706 is not set 127# CONFIG_CPU_SUBTYPE_SH7706 is not set
123# CONFIG_CPU_SUBTYPE_SH7707 is not set 128# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -135,6 +140,7 @@ CONFIG_CPU_SHX2=y
135# CONFIG_CPU_SUBTYPE_SH7751R is not set 140# CONFIG_CPU_SUBTYPE_SH7751R is not set
136# CONFIG_CPU_SUBTYPE_SH7760 is not set 141# CONFIG_CPU_SUBTYPE_SH7760 is not set
137# CONFIG_CPU_SUBTYPE_SH4_202 is not set 142# CONFIG_CPU_SUBTYPE_SH4_202 is not set
143# CONFIG_CPU_SUBTYPE_SH7723 is not set
138# CONFIG_CPU_SUBTYPE_SH7763 is not set 144# CONFIG_CPU_SUBTYPE_SH7763 is not set
139# CONFIG_CPU_SUBTYPE_SH7770 is not set 145# CONFIG_CPU_SUBTYPE_SH7770 is not set
140# CONFIG_CPU_SUBTYPE_SH7780 is not set 146# CONFIG_CPU_SUBTYPE_SH7780 is not set
@@ -142,6 +148,7 @@ CONFIG_CPU_SHX2=y
142# CONFIG_CPU_SUBTYPE_SHX3 is not set 148# CONFIG_CPU_SUBTYPE_SHX3 is not set
143# CONFIG_CPU_SUBTYPE_SH7343 is not set 149# CONFIG_CPU_SUBTYPE_SH7343 is not set
144CONFIG_CPU_SUBTYPE_SH7722=y 150CONFIG_CPU_SUBTYPE_SH7722=y
151# CONFIG_CPU_SUBTYPE_SH7366 is not set
145# CONFIG_CPU_SUBTYPE_SH5_101 is not set 152# CONFIG_CPU_SUBTYPE_SH5_101 is not set
146# CONFIG_CPU_SUBTYPE_SH5_103 is not set 153# CONFIG_CPU_SUBTYPE_SH5_103 is not set
147 154
@@ -255,7 +262,6 @@ CONFIG_HZ=250
255CONFIG_PREEMPT_NONE=y 262CONFIG_PREEMPT_NONE=y
256# CONFIG_PREEMPT_VOLUNTARY is not set 263# CONFIG_PREEMPT_VOLUNTARY is not set
257# CONFIG_PREEMPT is not set 264# CONFIG_PREEMPT is not set
258CONFIG_RCU_TRACE=y
259CONFIG_GUSA=y 265CONFIG_GUSA=y
260 266
261# 267#
@@ -323,8 +329,6 @@ CONFIG_TCP_CONG_CUBIC=y
323CONFIG_DEFAULT_TCP_CONG="cubic" 329CONFIG_DEFAULT_TCP_CONG="cubic"
324# CONFIG_TCP_MD5SIG is not set 330# CONFIG_TCP_MD5SIG is not set
325# CONFIG_IPV6 is not set 331# CONFIG_IPV6 is not set
326# CONFIG_INET6_XFRM_TUNNEL is not set
327# CONFIG_INET6_TUNNEL is not set
328# CONFIG_NETWORK_SECMARK is not set 332# CONFIG_NETWORK_SECMARK is not set
329# CONFIG_NETFILTER is not set 333# CONFIG_NETFILTER is not set
330# CONFIG_IP_DCCP is not set 334# CONFIG_IP_DCCP is not set
@@ -376,7 +380,90 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
376CONFIG_FW_LOADER=m 380CONFIG_FW_LOADER=m
377# CONFIG_SYS_HYPERVISOR is not set 381# CONFIG_SYS_HYPERVISOR is not set
378# CONFIG_CONNECTOR is not set 382# CONFIG_CONNECTOR is not set
379# CONFIG_MTD is not set 383CONFIG_MTD=y
384# CONFIG_MTD_DEBUG is not set
385CONFIG_MTD_CONCAT=y
386CONFIG_MTD_PARTITIONS=y
387# CONFIG_MTD_REDBOOT_PARTS is not set
388CONFIG_MTD_CMDLINE_PARTS=y
389# CONFIG_MTD_AR7_PARTS is not set
390
391#
392# User Modules And Translation Layers
393#
394CONFIG_MTD_CHAR=y
395CONFIG_MTD_BLKDEVS=y
396CONFIG_MTD_BLOCK=y
397# CONFIG_FTL is not set
398# CONFIG_NFTL is not set
399# CONFIG_INFTL is not set
400# CONFIG_RFD_FTL is not set
401# CONFIG_SSFDC is not set
402# CONFIG_MTD_OOPS is not set
403
404#
405# RAM/ROM/Flash chip drivers
406#
407CONFIG_MTD_CFI=y
408# CONFIG_MTD_JEDECPROBE is not set
409CONFIG_MTD_GEN_PROBE=y
410# CONFIG_MTD_CFI_ADV_OPTIONS is not set
411CONFIG_MTD_MAP_BANK_WIDTH_1=y
412CONFIG_MTD_MAP_BANK_WIDTH_2=y
413CONFIG_MTD_MAP_BANK_WIDTH_4=y
414# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
415# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
416# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
417CONFIG_MTD_CFI_I1=y
418CONFIG_MTD_CFI_I2=y
419# CONFIG_MTD_CFI_I4 is not set
420# CONFIG_MTD_CFI_I8 is not set
421# CONFIG_MTD_CFI_INTELEXT is not set
422CONFIG_MTD_CFI_AMDSTD=y
423# CONFIG_MTD_CFI_STAA is not set
424CONFIG_MTD_CFI_UTIL=y
425# CONFIG_MTD_RAM is not set
426# CONFIG_MTD_ROM is not set
427# CONFIG_MTD_ABSENT is not set
428
429#
430# Mapping drivers for chip access
431#
432# CONFIG_MTD_COMPLEX_MAPPINGS is not set
433CONFIG_MTD_PHYSMAP=y
434CONFIG_MTD_PHYSMAP_START=0xffffffff
435CONFIG_MTD_PHYSMAP_LEN=0
436CONFIG_MTD_PHYSMAP_BANKWIDTH=0
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442# CONFIG_MTD_SLRAM is not set
443# CONFIG_MTD_PHRAM is not set
444# CONFIG_MTD_MTDRAM is not set
445# CONFIG_MTD_BLOCK2MTD is not set
446
447#
448# Disk-On-Chip Device Drivers
449#
450# CONFIG_MTD_DOC2000 is not set
451# CONFIG_MTD_DOC2001 is not set
452# CONFIG_MTD_DOC2001PLUS is not set
453CONFIG_MTD_NAND=y
454# CONFIG_MTD_NAND_VERIFY_WRITE is not set
455# CONFIG_MTD_NAND_ECC_SMC is not set
456# CONFIG_MTD_NAND_MUSEUM_IDS is not set
457CONFIG_MTD_NAND_IDS=y
458# CONFIG_MTD_NAND_DISKONCHIP is not set
459# CONFIG_MTD_NAND_NANDSIM is not set
460CONFIG_MTD_NAND_PLATFORM=y
461# CONFIG_MTD_ONENAND is not set
462
463#
464# UBI - Unsorted block images
465#
466# CONFIG_MTD_UBI is not set
380# CONFIG_PARPORT is not set 467# CONFIG_PARPORT is not set
381CONFIG_BLK_DEV=y 468CONFIG_BLK_DEV=y
382# CONFIG_BLK_DEV_COW_COMMON is not set 469# CONFIG_BLK_DEV_COW_COMMON is not set
@@ -385,11 +472,13 @@ CONFIG_BLK_DEV=y
385CONFIG_BLK_DEV_RAM=y 472CONFIG_BLK_DEV_RAM=y
386CONFIG_BLK_DEV_RAM_COUNT=16 473CONFIG_BLK_DEV_RAM_COUNT=16
387CONFIG_BLK_DEV_RAM_SIZE=4096 474CONFIG_BLK_DEV_RAM_SIZE=4096
388CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 475# CONFIG_BLK_DEV_XIP is not set
389# CONFIG_CDROM_PKTCDVD is not set 476# CONFIG_CDROM_PKTCDVD is not set
390# CONFIG_ATA_OVER_ETH is not set 477# CONFIG_ATA_OVER_ETH is not set
391CONFIG_MISC_DEVICES=y 478CONFIG_MISC_DEVICES=y
392# CONFIG_EEPROM_93CX6 is not set 479# CONFIG_EEPROM_93CX6 is not set
480# CONFIG_ENCLOSURE_SERVICES is not set
481CONFIG_HAVE_IDE=y
393# CONFIG_IDE is not set 482# CONFIG_IDE is not set
394 483
395# 484#
@@ -461,6 +550,7 @@ CONFIG_SMC91X=y
461# 550#
462# CONFIG_WLAN_PRE80211 is not set 551# CONFIG_WLAN_PRE80211 is not set
463# CONFIG_WLAN_80211 is not set 552# CONFIG_WLAN_80211 is not set
553# CONFIG_IWLWIFI_LEDS is not set
464# CONFIG_WAN is not set 554# CONFIG_WAN is not set
465# CONFIG_PPP is not set 555# CONFIG_PPP is not set
466# CONFIG_SLIP is not set 556# CONFIG_SLIP is not set
@@ -482,13 +572,20 @@ CONFIG_INPUT=y
482# 572#
483# CONFIG_INPUT_MOUSEDEV is not set 573# CONFIG_INPUT_MOUSEDEV is not set
484# CONFIG_INPUT_JOYDEV is not set 574# CONFIG_INPUT_JOYDEV is not set
485# CONFIG_INPUT_EVDEV is not set 575CONFIG_INPUT_EVDEV=y
486# CONFIG_INPUT_EVBUG is not set 576# CONFIG_INPUT_EVBUG is not set
487 577
488# 578#
489# Input Device Drivers 579# Input Device Drivers
490# 580#
491# CONFIG_INPUT_KEYBOARD is not set 581CONFIG_INPUT_KEYBOARD=y
582# CONFIG_KEYBOARD_ATKBD is not set
583# CONFIG_KEYBOARD_SUNKBD is not set
584# CONFIG_KEYBOARD_LKKBD is not set
585# CONFIG_KEYBOARD_XTKBD is not set
586# CONFIG_KEYBOARD_NEWTON is not set
587# CONFIG_KEYBOARD_STOWAWAY is not set
588CONFIG_KEYBOARD_SH_KEYSC=y
492# CONFIG_INPUT_MOUSE is not set 589# CONFIG_INPUT_MOUSE is not set
493# CONFIG_INPUT_JOYSTICK is not set 590# CONFIG_INPUT_JOYSTICK is not set
494# CONFIG_INPUT_TABLET is not set 591# CONFIG_INPUT_TABLET is not set
@@ -508,6 +605,7 @@ CONFIG_VT=y
508CONFIG_VT_CONSOLE=y 605CONFIG_VT_CONSOLE=y
509CONFIG_HW_CONSOLE=y 606CONFIG_HW_CONSOLE=y
510CONFIG_VT_HW_CONSOLE_BINDING=y 607CONFIG_VT_HW_CONSOLE_BINDING=y
608CONFIG_DEVKMEM=y
511# CONFIG_SERIAL_NONSTANDARD is not set 609# CONFIG_SERIAL_NONSTANDARD is not set
512 610
513# 611#
@@ -531,16 +629,40 @@ CONFIG_HW_RANDOM=y
531# CONFIG_R3964 is not set 629# CONFIG_R3964 is not set
532# CONFIG_RAW_DRIVER is not set 630# CONFIG_RAW_DRIVER is not set
533# CONFIG_TCG_TPM is not set 631# CONFIG_TCG_TPM is not set
534# CONFIG_I2C is not set 632CONFIG_I2C=y
535 633CONFIG_I2C_BOARDINFO=y
536# 634# CONFIG_I2C_CHARDEV is not set
537# SPI support 635
538# 636#
637# I2C Hardware Bus support
638#
639# CONFIG_I2C_OCORES is not set
640# CONFIG_I2C_PARPORT_LIGHT is not set
641# CONFIG_I2C_SIMTEC is not set
642# CONFIG_I2C_TAOS_EVM is not set
643# CONFIG_I2C_STUB is not set
644# CONFIG_I2C_PCA_PLATFORM is not set
645CONFIG_I2C_SH_MOBILE=y
646
647#
648# Miscellaneous I2C Chip support
649#
650# CONFIG_DS1682 is not set
651# CONFIG_SENSORS_EEPROM is not set
652# CONFIG_SENSORS_PCF8574 is not set
653# CONFIG_PCF8575 is not set
654# CONFIG_SENSORS_PCF8591 is not set
655# CONFIG_SENSORS_MAX6875 is not set
656# CONFIG_SENSORS_TSL2550 is not set
657# CONFIG_I2C_DEBUG_CORE is not set
658# CONFIG_I2C_DEBUG_ALGO is not set
659# CONFIG_I2C_DEBUG_BUS is not set
660# CONFIG_I2C_DEBUG_CHIP is not set
539# CONFIG_SPI is not set 661# CONFIG_SPI is not set
540# CONFIG_SPI_MASTER is not set
541# CONFIG_W1 is not set 662# CONFIG_W1 is not set
542# CONFIG_POWER_SUPPLY is not set 663# CONFIG_POWER_SUPPLY is not set
543# CONFIG_HWMON is not set 664# CONFIG_HWMON is not set
665# CONFIG_THERMAL is not set
544# CONFIG_WATCHDOG is not set 666# CONFIG_WATCHDOG is not set
545 667
546# 668#
@@ -553,12 +675,22 @@ CONFIG_SSB_POSSIBLE=y
553# Multifunction device drivers 675# Multifunction device drivers
554# 676#
555# CONFIG_MFD_SM501 is not set 677# CONFIG_MFD_SM501 is not set
678# CONFIG_HTC_PASIC3 is not set
556 679
557# 680#
558# Multimedia devices 681# Multimedia devices
559# 682#
683
684#
685# Multimedia core support
686#
560# CONFIG_VIDEO_DEV is not set 687# CONFIG_VIDEO_DEV is not set
561# CONFIG_DVB_CORE is not set 688# CONFIG_DVB_CORE is not set
689# CONFIG_VIDEO_MEDIA is not set
690
691#
692# Multimedia drivers
693#
562# CONFIG_DAB is not set 694# CONFIG_DAB is not set
563 695
564# 696#
@@ -592,6 +724,8 @@ CONFIG_USB_ARCH_HAS_HCD=y
592# CONFIG_USB_ARCH_HAS_OHCI is not set 724# CONFIG_USB_ARCH_HAS_OHCI is not set
593# CONFIG_USB_ARCH_HAS_EHCI is not set 725# CONFIG_USB_ARCH_HAS_EHCI is not set
594# CONFIG_USB is not set 726# CONFIG_USB is not set
727# CONFIG_USB_OTG_WHITELIST is not set
728# CONFIG_USB_OTG_BLACKLIST_HUB is not set
595 729
596# 730#
597# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 731# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -608,6 +742,7 @@ CONFIG_USB_GADGET_SELECTED=y
608CONFIG_USB_GADGET_M66592=y 742CONFIG_USB_GADGET_M66592=y
609CONFIG_USB_M66592=y 743CONFIG_USB_M66592=y
610CONFIG_SUPERH_BUILT_IN_M66592=y 744CONFIG_SUPERH_BUILT_IN_M66592=y
745# CONFIG_USB_GADGET_PXA27X is not set
611# CONFIG_USB_GADGET_GOKU is not set 746# CONFIG_USB_GADGET_GOKU is not set
612# CONFIG_USB_GADGET_LH7A40X is not set 747# CONFIG_USB_GADGET_LH7A40X is not set
613# CONFIG_USB_GADGET_OMAP is not set 748# CONFIG_USB_GADGET_OMAP is not set
@@ -623,7 +758,9 @@ CONFIG_USB_G_SERIAL=y
623# CONFIG_USB_MIDI_GADGET is not set 758# CONFIG_USB_MIDI_GADGET is not set
624# CONFIG_USB_G_PRINTER is not set 759# CONFIG_USB_G_PRINTER is not set
625# CONFIG_MMC is not set 760# CONFIG_MMC is not set
761# CONFIG_MEMSTICK is not set
626# CONFIG_NEW_LEDS is not set 762# CONFIG_NEW_LEDS is not set
763# CONFIG_ACCESSIBILITY is not set
627CONFIG_RTC_LIB=y 764CONFIG_RTC_LIB=y
628CONFIG_RTC_CLASS=y 765CONFIG_RTC_CLASS=y
629CONFIG_RTC_HCTOSYS=y 766CONFIG_RTC_HCTOSYS=y
@@ -640,15 +777,31 @@ CONFIG_RTC_INTF_DEV=y
640# CONFIG_RTC_DRV_TEST is not set 777# CONFIG_RTC_DRV_TEST is not set
641 778
642# 779#
780# I2C RTC drivers
781#
782# CONFIG_RTC_DRV_DS1307 is not set
783# CONFIG_RTC_DRV_DS1374 is not set
784# CONFIG_RTC_DRV_DS1672 is not set
785# CONFIG_RTC_DRV_MAX6900 is not set
786CONFIG_RTC_DRV_RS5C372=y
787# CONFIG_RTC_DRV_ISL1208 is not set
788# CONFIG_RTC_DRV_X1205 is not set
789# CONFIG_RTC_DRV_PCF8563 is not set
790# CONFIG_RTC_DRV_PCF8583 is not set
791# CONFIG_RTC_DRV_M41T80 is not set
792# CONFIG_RTC_DRV_S35390A is not set
793
794#
643# SPI RTC drivers 795# SPI RTC drivers
644# 796#
645 797
646# 798#
647# Platform RTC drivers 799# Platform RTC drivers
648# 800#
801# CONFIG_RTC_DRV_DS1511 is not set
649# CONFIG_RTC_DRV_DS1553 is not set 802# CONFIG_RTC_DRV_DS1553 is not set
650# CONFIG_RTC_DRV_STK17TA8 is not set
651# CONFIG_RTC_DRV_DS1742 is not set 803# CONFIG_RTC_DRV_DS1742 is not set
804# CONFIG_RTC_DRV_STK17TA8 is not set
652# CONFIG_RTC_DRV_M48T86 is not set 805# CONFIG_RTC_DRV_M48T86 is not set
653# CONFIG_RTC_DRV_M48T59 is not set 806# CONFIG_RTC_DRV_M48T59 is not set
654# CONFIG_RTC_DRV_V3020 is not set 807# CONFIG_RTC_DRV_V3020 is not set
@@ -657,10 +810,6 @@ CONFIG_RTC_INTF_DEV=y
657# on-CPU RTC drivers 810# on-CPU RTC drivers
658# 811#
659CONFIG_RTC_DRV_SH=y 812CONFIG_RTC_DRV_SH=y
660
661#
662# Userspace I/O
663#
664# CONFIG_UIO is not set 813# CONFIG_UIO is not set
665 814
666# 815#
@@ -673,13 +822,10 @@ CONFIG_RTC_DRV_SH=y
673# CONFIG_JFS_FS is not set 822# CONFIG_JFS_FS is not set
674# CONFIG_FS_POSIX_ACL is not set 823# CONFIG_FS_POSIX_ACL is not set
675# CONFIG_XFS_FS is not set 824# CONFIG_XFS_FS is not set
676# CONFIG_GFS2_FS is not set
677# CONFIG_OCFS2_FS is not set 825# CONFIG_OCFS2_FS is not set
678# CONFIG_MINIX_FS is not set 826# CONFIG_DNOTIFY is not set
679# CONFIG_ROMFS_FS is not set
680# CONFIG_INOTIFY is not set 827# CONFIG_INOTIFY is not set
681# CONFIG_QUOTA is not set 828# CONFIG_QUOTA is not set
682# CONFIG_DNOTIFY is not set
683# CONFIG_AUTOFS_FS is not set 829# CONFIG_AUTOFS_FS is not set
684# CONFIG_AUTOFS4_FS is not set 830# CONFIG_AUTOFS4_FS is not set
685# CONFIG_FUSE_FS is not set 831# CONFIG_FUSE_FS is not set
@@ -720,10 +866,13 @@ CONFIG_TMPFS=y
720# CONFIG_BEFS_FS is not set 866# CONFIG_BEFS_FS is not set
721# CONFIG_BFS_FS is not set 867# CONFIG_BFS_FS is not set
722# CONFIG_EFS_FS is not set 868# CONFIG_EFS_FS is not set
869# CONFIG_JFFS2_FS is not set
723# CONFIG_CRAMFS is not set 870# CONFIG_CRAMFS is not set
724# CONFIG_VXFS_FS is not set 871# CONFIG_VXFS_FS is not set
872# CONFIG_MINIX_FS is not set
725# CONFIG_HPFS_FS is not set 873# CONFIG_HPFS_FS is not set
726# CONFIG_QNX4FS_FS is not set 874# CONFIG_QNX4FS_FS is not set
875# CONFIG_ROMFS_FS is not set
727# CONFIG_SYSV_FS is not set 876# CONFIG_SYSV_FS is not set
728# CONFIG_UFS_FS is not set 877# CONFIG_UFS_FS is not set
729# CONFIG_NETWORK_FILESYSTEMS is not set 878# CONFIG_NETWORK_FILESYSTEMS is not set
@@ -743,6 +892,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
743# CONFIG_PRINTK_TIME is not set 892# CONFIG_PRINTK_TIME is not set
744CONFIG_ENABLE_WARN_DEPRECATED=y 893CONFIG_ENABLE_WARN_DEPRECATED=y
745CONFIG_ENABLE_MUST_CHECK=y 894CONFIG_ENABLE_MUST_CHECK=y
895CONFIG_FRAME_WARN=1024
746# CONFIG_MAGIC_SYSRQ is not set 896# CONFIG_MAGIC_SYSRQ is not set
747# CONFIG_UNUSED_SYMBOLS is not set 897# CONFIG_UNUSED_SYMBOLS is not set
748CONFIG_DEBUG_FS=y 898CONFIG_DEBUG_FS=y
@@ -763,48 +913,77 @@ CONFIG_EARLY_PRINTK=y
763# CONFIG_SECURITY is not set 913# CONFIG_SECURITY is not set
764# CONFIG_SECURITY_FILE_CAPABILITIES is not set 914# CONFIG_SECURITY_FILE_CAPABILITIES is not set
765CONFIG_CRYPTO=y 915CONFIG_CRYPTO=y
766# CONFIG_CRYPTO_SEQIV is not set 916
917#
918# Crypto core or helper
919#
767# CONFIG_CRYPTO_MANAGER is not set 920# CONFIG_CRYPTO_MANAGER is not set
921# CONFIG_CRYPTO_GF128MUL is not set
922# CONFIG_CRYPTO_NULL is not set
923# CONFIG_CRYPTO_CRYPTD is not set
924# CONFIG_CRYPTO_AUTHENC is not set
925# CONFIG_CRYPTO_TEST is not set
926
927#
928# Authenticated Encryption with Associated Data
929#
930# CONFIG_CRYPTO_CCM is not set
931# CONFIG_CRYPTO_GCM is not set
932# CONFIG_CRYPTO_SEQIV is not set
933
934#
935# Block modes
936#
937# CONFIG_CRYPTO_CBC is not set
938# CONFIG_CRYPTO_CTR is not set
939# CONFIG_CRYPTO_CTS is not set
940# CONFIG_CRYPTO_ECB is not set
941# CONFIG_CRYPTO_LRW is not set
942# CONFIG_CRYPTO_PCBC is not set
943# CONFIG_CRYPTO_XTS is not set
944
945#
946# Hash modes
947#
768# CONFIG_CRYPTO_HMAC is not set 948# CONFIG_CRYPTO_HMAC is not set
769# CONFIG_CRYPTO_XCBC is not set 949# CONFIG_CRYPTO_XCBC is not set
770# CONFIG_CRYPTO_NULL is not set 950
951#
952# Digest
953#
954# CONFIG_CRYPTO_CRC32C is not set
771# CONFIG_CRYPTO_MD4 is not set 955# CONFIG_CRYPTO_MD4 is not set
772# CONFIG_CRYPTO_MD5 is not set 956# CONFIG_CRYPTO_MD5 is not set
957# CONFIG_CRYPTO_MICHAEL_MIC is not set
773# CONFIG_CRYPTO_SHA1 is not set 958# CONFIG_CRYPTO_SHA1 is not set
774# CONFIG_CRYPTO_SHA256 is not set 959# CONFIG_CRYPTO_SHA256 is not set
775# CONFIG_CRYPTO_SHA512 is not set 960# CONFIG_CRYPTO_SHA512 is not set
776# CONFIG_CRYPTO_WP512 is not set
777# CONFIG_CRYPTO_TGR192 is not set 961# CONFIG_CRYPTO_TGR192 is not set
778# CONFIG_CRYPTO_GF128MUL is not set 962# CONFIG_CRYPTO_WP512 is not set
779# CONFIG_CRYPTO_ECB is not set 963
780# CONFIG_CRYPTO_CBC is not set 964#
781# CONFIG_CRYPTO_PCBC is not set 965# Ciphers
782# CONFIG_CRYPTO_LRW is not set 966#
783# CONFIG_CRYPTO_XTS is not set
784# CONFIG_CRYPTO_CTR is not set
785# CONFIG_CRYPTO_GCM is not set
786# CONFIG_CRYPTO_CCM is not set
787# CONFIG_CRYPTO_CRYPTD is not set
788# CONFIG_CRYPTO_DES is not set
789# CONFIG_CRYPTO_FCRYPT is not set
790# CONFIG_CRYPTO_BLOWFISH is not set
791# CONFIG_CRYPTO_TWOFISH is not set
792# CONFIG_CRYPTO_SERPENT is not set
793# CONFIG_CRYPTO_AES is not set 967# CONFIG_CRYPTO_AES is not set
968# CONFIG_CRYPTO_ANUBIS is not set
969# CONFIG_CRYPTO_ARC4 is not set
970# CONFIG_CRYPTO_BLOWFISH is not set
971# CONFIG_CRYPTO_CAMELLIA is not set
794# CONFIG_CRYPTO_CAST5 is not set 972# CONFIG_CRYPTO_CAST5 is not set
795# CONFIG_CRYPTO_CAST6 is not set 973# CONFIG_CRYPTO_CAST6 is not set
796# CONFIG_CRYPTO_TEA is not set 974# CONFIG_CRYPTO_DES is not set
797# CONFIG_CRYPTO_ARC4 is not set 975# CONFIG_CRYPTO_FCRYPT is not set
798# CONFIG_CRYPTO_KHAZAD is not set 976# CONFIG_CRYPTO_KHAZAD is not set
799# CONFIG_CRYPTO_ANUBIS is not set
800# CONFIG_CRYPTO_SEED is not set
801# CONFIG_CRYPTO_SALSA20 is not set 977# CONFIG_CRYPTO_SALSA20 is not set
978# CONFIG_CRYPTO_SEED is not set
979# CONFIG_CRYPTO_SERPENT is not set
980# CONFIG_CRYPTO_TEA is not set
981# CONFIG_CRYPTO_TWOFISH is not set
982
983#
984# Compression
985#
802# CONFIG_CRYPTO_DEFLATE is not set 986# CONFIG_CRYPTO_DEFLATE is not set
803# CONFIG_CRYPTO_MICHAEL_MIC is not set
804# CONFIG_CRYPTO_CRC32C is not set
805# CONFIG_CRYPTO_CAMELLIA is not set
806# CONFIG_CRYPTO_TEST is not set
807# CONFIG_CRYPTO_AUTHENC is not set
808# CONFIG_CRYPTO_LZO is not set 987# CONFIG_CRYPTO_LZO is not set
809CONFIG_CRYPTO_HW=y 988CONFIG_CRYPTO_HW=y
810 989
@@ -812,6 +991,7 @@ CONFIG_CRYPTO_HW=y
812# Library routines 991# Library routines
813# 992#
814CONFIG_BITREVERSE=y 993CONFIG_BITREVERSE=y
994# CONFIG_GENERIC_FIND_FIRST_BIT is not set
815# CONFIG_CRC_CCITT is not set 995# CONFIG_CRC_CCITT is not set
816# CONFIG_CRC16 is not set 996# CONFIG_CRC16 is not set
817# CONFIG_CRC_ITU_T is not set 997# CONFIG_CRC_ITU_T is not set
diff --git a/arch/sh/configs/rsk7203_defconfig b/arch/sh/configs/rsk7203_defconfig
new file mode 100644
index 000000000000..a0ebd439cbd2
--- /dev/null
+++ b/arch/sh/configs/rsk7203_defconfig
@@ -0,0 +1,841 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4
4# Tue Jun 3 13:02:42 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15# CONFIG_GENERIC_TIME is not set
16# CONFIG_GENERIC_CLOCKEVENTS is not set
17CONFIG_STACKTRACE_SUPPORT=y
18CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_ARCH_SUPPORTS_AOUT=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24
25#
26# General setup
27#
28CONFIG_EXPERIMENTAL=y
29CONFIG_BROKEN_ON_SMP=y
30CONFIG_INIT_ENV_ARG_LIMIT=32
31CONFIG_LOCALVERSION=""
32# CONFIG_LOCALVERSION_AUTO is not set
33CONFIG_SYSVIPC=y
34CONFIG_SYSVIPC_SYSCTL=y
35CONFIG_POSIX_MQUEUE=y
36# CONFIG_BSD_PROCESS_ACCT is not set
37# CONFIG_TASKSTATS is not set
38# CONFIG_AUDIT is not set
39# CONFIG_IKCONFIG is not set
40CONFIG_LOG_BUF_SHIFT=14
41# CONFIG_CGROUPS is not set
42CONFIG_GROUP_SCHED=y
43CONFIG_FAIR_GROUP_SCHED=y
44# CONFIG_RT_GROUP_SCHED is not set
45CONFIG_USER_SCHED=y
46# CONFIG_CGROUP_SCHED is not set
47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
49# CONFIG_RELAY is not set
50# CONFIG_NAMESPACES is not set
51CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE=""
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
54CONFIG_SYSCTL=y
55CONFIG_EMBEDDED=y
56CONFIG_UID16=y
57CONFIG_SYSCTL_SYSCALL=y
58CONFIG_SYSCTL_SYSCALL_CHECK=y
59CONFIG_KALLSYMS=y
60CONFIG_KALLSYMS_ALL=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_COMPAT_BRK=y
67CONFIG_BASE_FULL=y
68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y
74CONFIG_VM_EVENT_COUNTERS=y
75CONFIG_SLAB=y
76# CONFIG_SLUB is not set
77# CONFIG_SLOB is not set
78CONFIG_PROFILING=y
79# CONFIG_MARKERS is not set
80CONFIG_OPROFILE=y
81CONFIG_HAVE_OPROFILE=y
82# CONFIG_HAVE_KPROBES is not set
83# CONFIG_HAVE_KRETPROBES is not set
84# CONFIG_HAVE_DMA_ATTRS is not set
85CONFIG_SLABINFO=y
86CONFIG_RT_MUTEXES=y
87CONFIG_TINY_SHMEM=y
88CONFIG_BASE_SMALL=0
89# CONFIG_MODULES is not set
90CONFIG_BLOCK=y
91# CONFIG_LBD is not set
92# CONFIG_BLK_DEV_IO_TRACE is not set
93# CONFIG_LSF is not set
94# CONFIG_BLK_DEV_BSG is not set
95
96#
97# IO Schedulers
98#
99CONFIG_IOSCHED_NOOP=y
100# CONFIG_IOSCHED_AS is not set
101# CONFIG_IOSCHED_DEADLINE is not set
102# CONFIG_IOSCHED_CFQ is not set
103# CONFIG_DEFAULT_AS is not set
104# CONFIG_DEFAULT_DEADLINE is not set
105# CONFIG_DEFAULT_CFQ is not set
106CONFIG_DEFAULT_NOOP=y
107CONFIG_DEFAULT_IOSCHED="noop"
108CONFIG_CLASSIC_RCU=y
109
110#
111# System type
112#
113CONFIG_CPU_SH2=y
114CONFIG_CPU_SH2A=y
115# CONFIG_CPU_SUBTYPE_SH7619 is not set
116CONFIG_CPU_SUBTYPE_SH7203=y
117# CONFIG_CPU_SUBTYPE_SH7206 is not set
118# CONFIG_CPU_SUBTYPE_SH7263 is not set
119# CONFIG_CPU_SUBTYPE_MXG is not set
120# CONFIG_CPU_SUBTYPE_SH7705 is not set
121# CONFIG_CPU_SUBTYPE_SH7706 is not set
122# CONFIG_CPU_SUBTYPE_SH7707 is not set
123# CONFIG_CPU_SUBTYPE_SH7708 is not set
124# CONFIG_CPU_SUBTYPE_SH7709 is not set
125# CONFIG_CPU_SUBTYPE_SH7710 is not set
126# CONFIG_CPU_SUBTYPE_SH7712 is not set
127# CONFIG_CPU_SUBTYPE_SH7720 is not set
128# CONFIG_CPU_SUBTYPE_SH7721 is not set
129# CONFIG_CPU_SUBTYPE_SH7750 is not set
130# CONFIG_CPU_SUBTYPE_SH7091 is not set
131# CONFIG_CPU_SUBTYPE_SH7750R is not set
132# CONFIG_CPU_SUBTYPE_SH7750S is not set
133# CONFIG_CPU_SUBTYPE_SH7751 is not set
134# CONFIG_CPU_SUBTYPE_SH7751R is not set
135# CONFIG_CPU_SUBTYPE_SH7760 is not set
136# CONFIG_CPU_SUBTYPE_SH4_202 is not set
137# CONFIG_CPU_SUBTYPE_SH7723 is not set
138# CONFIG_CPU_SUBTYPE_SH7763 is not set
139# CONFIG_CPU_SUBTYPE_SH7770 is not set
140# CONFIG_CPU_SUBTYPE_SH7780 is not set
141# CONFIG_CPU_SUBTYPE_SH7785 is not set
142# CONFIG_CPU_SUBTYPE_SHX3 is not set
143# CONFIG_CPU_SUBTYPE_SH7343 is not set
144# CONFIG_CPU_SUBTYPE_SH7722 is not set
145# CONFIG_CPU_SUBTYPE_SH7366 is not set
146# CONFIG_CPU_SUBTYPE_SH5_101 is not set
147# CONFIG_CPU_SUBTYPE_SH5_103 is not set
148
149#
150# Memory management options
151#
152CONFIG_QUICKLIST=y
153CONFIG_PAGE_OFFSET=0x00000000
154CONFIG_MEMORY_START=0x0c000000
155CONFIG_MEMORY_SIZE=0x01000000
156CONFIG_29BIT=y
157CONFIG_ARCH_FLATMEM_ENABLE=y
158CONFIG_ARCH_SPARSEMEM_ENABLE=y
159CONFIG_ARCH_SPARSEMEM_DEFAULT=y
160CONFIG_MAX_ACTIVE_REGIONS=1
161CONFIG_ARCH_POPULATES_NODE_MAP=y
162CONFIG_ARCH_SELECT_MEMORY_MODEL=y
163CONFIG_PAGE_SIZE_4KB=y
164# CONFIG_PAGE_SIZE_8KB is not set
165# CONFIG_PAGE_SIZE_64KB is not set
166CONFIG_SELECT_MEMORY_MODEL=y
167CONFIG_FLATMEM_MANUAL=y
168# CONFIG_DISCONTIGMEM_MANUAL is not set
169# CONFIG_SPARSEMEM_MANUAL is not set
170CONFIG_FLATMEM=y
171CONFIG_FLAT_NODE_MEM_MAP=y
172CONFIG_SPARSEMEM_STATIC=y
173# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
174CONFIG_PAGEFLAGS_EXTENDED=y
175CONFIG_SPLIT_PTLOCK_CPUS=4
176# CONFIG_RESOURCES_64BIT is not set
177CONFIG_ZONE_DMA_FLAG=0
178CONFIG_NR_QUICK=2
179
180#
181# Cache configuration
182#
183# CONFIG_SH_DIRECT_MAPPED is not set
184CONFIG_CACHE_WRITEBACK=y
185# CONFIG_CACHE_WRITETHROUGH is not set
186# CONFIG_CACHE_OFF is not set
187
188#
189# Processor features
190#
191# CONFIG_CPU_LITTLE_ENDIAN is not set
192CONFIG_CPU_BIG_ENDIAN=y
193CONFIG_SH_FPU=y
194CONFIG_CPU_HAS_FPU=y
195
196#
197# Board support
198#
199
200#
201# Timer and clock configuration
202#
203CONFIG_SH_CMT=y
204# CONFIG_SH_MTU2 is not set
205CONFIG_SH_TIMER_IRQ=142
206CONFIG_SH_PCLK_FREQ=16670800
207CONFIG_SH_CLK_MD=0
208# CONFIG_TICK_ONESHOT is not set
209
210#
211# CPU Frequency scaling
212#
213CONFIG_CPU_FREQ=y
214CONFIG_CPU_FREQ_TABLE=y
215# CONFIG_CPU_FREQ_DEBUG is not set
216CONFIG_CPU_FREQ_STAT=y
217# CONFIG_CPU_FREQ_STAT_DETAILS is not set
218CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
219# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
220# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
221# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
222# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
223CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
224# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
225# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
226# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
227# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
228CONFIG_SH_CPU_FREQ=y
229
230#
231# DMA support
232#
233
234#
235# Companion Chips
236#
237
238#
239# Additional SuperH Device Drivers
240#
241CONFIG_HEARTBEAT=y
242# CONFIG_PUSH_SWITCH is not set
243
244#
245# Kernel features
246#
247# CONFIG_HZ_100 is not set
248# CONFIG_HZ_250 is not set
249# CONFIG_HZ_300 is not set
250CONFIG_HZ_1000=y
251CONFIG_HZ=1000
252# CONFIG_SCHED_HRTICK is not set
253# CONFIG_KEXEC is not set
254# CONFIG_CRASH_DUMP is not set
255CONFIG_PREEMPT_NONE=y
256# CONFIG_PREEMPT_VOLUNTARY is not set
257# CONFIG_PREEMPT is not set
258CONFIG_GUSA=y
259
260#
261# Boot options
262#
263CONFIG_ZERO_PAGE_OFFSET=0x00001000
264CONFIG_BOOT_LINK_OFFSET=0x00800000
265CONFIG_CMDLINE_BOOL=y
266CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
267
268#
269# Bus options
270#
271# CONFIG_ARCH_SUPPORTS_MSI is not set
272# CONFIG_PCCARD is not set
273
274#
275# Executable file formats
276#
277CONFIG_BINFMT_FLAT=y
278CONFIG_BINFMT_ZFLAT=y
279CONFIG_BINFMT_SHARED_FLAT=y
280# CONFIG_BINFMT_MISC is not set
281
282#
283# Networking
284#
285CONFIG_NET=y
286
287#
288# Networking options
289#
290# CONFIG_PACKET is not set
291# CONFIG_UNIX is not set
292# CONFIG_NET_KEY is not set
293CONFIG_INET=y
294# CONFIG_IP_MULTICAST is not set
295# CONFIG_IP_ADVANCED_ROUTER is not set
296CONFIG_IP_FIB_HASH=y
297CONFIG_IP_PNP=y
298CONFIG_IP_PNP_DHCP=y
299# CONFIG_IP_PNP_BOOTP is not set
300# CONFIG_IP_PNP_RARP is not set
301# CONFIG_NET_IPIP is not set
302# CONFIG_NET_IPGRE is not set
303# CONFIG_ARPD is not set
304# CONFIG_SYN_COOKIES is not set
305# CONFIG_INET_AH is not set
306# CONFIG_INET_ESP is not set
307# CONFIG_INET_IPCOMP is not set
308# CONFIG_INET_XFRM_TUNNEL is not set
309# CONFIG_INET_TUNNEL is not set
310# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
311# CONFIG_INET_XFRM_MODE_TUNNEL is not set
312# CONFIG_INET_XFRM_MODE_BEET is not set
313# CONFIG_INET_LRO is not set
314# CONFIG_INET_DIAG is not set
315# CONFIG_TCP_CONG_ADVANCED is not set
316CONFIG_TCP_CONG_CUBIC=y
317CONFIG_DEFAULT_TCP_CONG="cubic"
318# CONFIG_TCP_MD5SIG is not set
319# CONFIG_IPV6 is not set
320# CONFIG_NETWORK_SECMARK is not set
321# CONFIG_NETFILTER is not set
322# CONFIG_IP_DCCP is not set
323# CONFIG_IP_SCTP is not set
324# CONFIG_TIPC is not set
325# CONFIG_ATM is not set
326# CONFIG_BRIDGE 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
338#
339# Network testing
340#
341# CONFIG_NET_PKTGEN is not set
342# CONFIG_HAMRADIO is not set
343# CONFIG_CAN is not set
344# CONFIG_IRDA is not set
345# CONFIG_BT is not set
346# CONFIG_AF_RXRPC is not set
347
348#
349# Wireless
350#
351# CONFIG_CFG80211 is not set
352# CONFIG_WIRELESS_EXT is not set
353# CONFIG_MAC80211 is not set
354# CONFIG_IEEE80211 is not set
355# CONFIG_RFKILL is not set
356# CONFIG_NET_9P is not set
357
358#
359# Device Drivers
360#
361
362#
363# Generic Driver Options
364#
365CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
366# CONFIG_STANDALONE is not set
367# CONFIG_PREVENT_FIRMWARE_BUILD is not set
368# CONFIG_FW_LOADER is not set
369# CONFIG_DEBUG_DRIVER is not set
370# CONFIG_DEBUG_DEVRES is not set
371# CONFIG_SYS_HYPERVISOR is not set
372# CONFIG_CONNECTOR is not set
373CONFIG_MTD=y
374# CONFIG_MTD_DEBUG is not set
375CONFIG_MTD_CONCAT=y
376CONFIG_MTD_PARTITIONS=y
377CONFIG_MTD_REDBOOT_PARTS=y
378CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
379# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
380# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
381# CONFIG_MTD_CMDLINE_PARTS is not set
382# CONFIG_MTD_AR7_PARTS is not set
383
384#
385# User Modules And Translation Layers
386#
387CONFIG_MTD_CHAR=y
388CONFIG_MTD_BLKDEVS=y
389CONFIG_MTD_BLOCK=y
390# CONFIG_FTL is not set
391# CONFIG_NFTL is not set
392# CONFIG_INFTL is not set
393# CONFIG_RFD_FTL is not set
394# CONFIG_SSFDC is not set
395# CONFIG_MTD_OOPS is not set
396
397#
398# RAM/ROM/Flash chip drivers
399#
400CONFIG_MTD_CFI=y
401# CONFIG_MTD_JEDECPROBE is not set
402CONFIG_MTD_GEN_PROBE=y
403# CONFIG_MTD_CFI_ADV_OPTIONS is not set
404CONFIG_MTD_MAP_BANK_WIDTH_1=y
405CONFIG_MTD_MAP_BANK_WIDTH_2=y
406CONFIG_MTD_MAP_BANK_WIDTH_4=y
407# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
408# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
409# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
410CONFIG_MTD_CFI_I1=y
411CONFIG_MTD_CFI_I2=y
412# CONFIG_MTD_CFI_I4 is not set
413# CONFIG_MTD_CFI_I8 is not set
414# CONFIG_MTD_CFI_INTELEXT is not set
415CONFIG_MTD_CFI_AMDSTD=y
416# CONFIG_MTD_CFI_STAA is not set
417CONFIG_MTD_CFI_UTIL=y
418# CONFIG_MTD_RAM is not set
419# CONFIG_MTD_ROM is not set
420# CONFIG_MTD_ABSENT is not set
421
422#
423# Mapping drivers for chip access
424#
425# CONFIG_MTD_COMPLEX_MAPPINGS is not set
426CONFIG_MTD_PHYSMAP=y
427CONFIG_MTD_PHYSMAP_START=0x20000000
428CONFIG_MTD_PHYSMAP_LEN=0x01000000
429CONFIG_MTD_PHYSMAP_BANKWIDTH=4
430# CONFIG_MTD_UCLINUX is not set
431# CONFIG_MTD_PLATRAM is not set
432
433#
434# Self-contained MTD device drivers
435#
436# CONFIG_MTD_SLRAM is not set
437# CONFIG_MTD_PHRAM is not set
438# CONFIG_MTD_MTDRAM is not set
439# CONFIG_MTD_BLOCK2MTD is not set
440
441#
442# Disk-On-Chip Device Drivers
443#
444# CONFIG_MTD_DOC2000 is not set
445# CONFIG_MTD_DOC2001 is not set
446# CONFIG_MTD_DOC2001PLUS is not set
447# CONFIG_MTD_NAND is not set
448# CONFIG_MTD_ONENAND is not set
449
450#
451# UBI - Unsorted block images
452#
453# CONFIG_MTD_UBI is not set
454# CONFIG_PARPORT is not set
455CONFIG_BLK_DEV=y
456# CONFIG_BLK_DEV_COW_COMMON is not set
457# CONFIG_BLK_DEV_LOOP is not set
458# CONFIG_BLK_DEV_NBD is not set
459# CONFIG_BLK_DEV_RAM is not set
460# CONFIG_CDROM_PKTCDVD is not set
461# CONFIG_ATA_OVER_ETH is not set
462CONFIG_MISC_DEVICES=y
463# CONFIG_EEPROM_93CX6 is not set
464# CONFIG_ENCLOSURE_SERVICES is not set
465CONFIG_HAVE_IDE=y
466# CONFIG_IDE is not set
467
468#
469# SCSI device support
470#
471# CONFIG_RAID_ATTRS is not set
472# CONFIG_SCSI is not set
473# CONFIG_SCSI_DMA is not set
474# CONFIG_SCSI_NETLINK is not set
475# CONFIG_ATA is not set
476# CONFIG_MD is not set
477CONFIG_NETDEVICES=y
478# CONFIG_NETDEVICES_MULTIQUEUE is not set
479# CONFIG_DUMMY is not set
480# CONFIG_BONDING is not set
481# CONFIG_MACVLAN is not set
482# CONFIG_EQUALIZER is not set
483# CONFIG_TUN is not set
484# CONFIG_VETH is not set
485# CONFIG_PHYLIB is not set
486CONFIG_NET_ETHERNET=y
487CONFIG_MII=y
488# CONFIG_AX88796 is not set
489# CONFIG_STNIC is not set
490CONFIG_SMC91X=y
491# CONFIG_IBM_NEW_EMAC_ZMII is not set
492# CONFIG_IBM_NEW_EMAC_RGMII is not set
493# CONFIG_IBM_NEW_EMAC_TAH is not set
494# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
495# CONFIG_B44 is not set
496CONFIG_NETDEV_1000=y
497# CONFIG_E1000E_ENABLED is not set
498CONFIG_NETDEV_10000=y
499
500#
501# Wireless LAN
502#
503# CONFIG_WLAN_PRE80211 is not set
504# CONFIG_WLAN_80211 is not set
505# CONFIG_IWLWIFI_LEDS is not set
506# CONFIG_WAN is not set
507# CONFIG_PPP is not set
508# CONFIG_SLIP is not set
509# CONFIG_NETCONSOLE is not set
510# CONFIG_NETPOLL is not set
511# CONFIG_NET_POLL_CONTROLLER is not set
512# CONFIG_ISDN is not set
513# CONFIG_PHONE is not set
514
515#
516# Input device support
517#
518CONFIG_INPUT=y
519# CONFIG_INPUT_FF_MEMLESS is not set
520# CONFIG_INPUT_POLLDEV is not set
521
522#
523# Userland interfaces
524#
525# CONFIG_INPUT_MOUSEDEV is not set
526# CONFIG_INPUT_JOYDEV is not set
527# CONFIG_INPUT_EVDEV is not set
528# CONFIG_INPUT_EVBUG is not set
529
530#
531# Input Device Drivers
532#
533# CONFIG_INPUT_KEYBOARD is not set
534# CONFIG_INPUT_MOUSE is not set
535# CONFIG_INPUT_JOYSTICK is not set
536# CONFIG_INPUT_TABLET is not set
537# CONFIG_INPUT_TOUCHSCREEN is not set
538# CONFIG_INPUT_MISC is not set
539
540#
541# Hardware I/O ports
542#
543# CONFIG_SERIO is not set
544# CONFIG_GAMEPORT is not set
545
546#
547# Character devices
548#
549# CONFIG_VT is not set
550CONFIG_DEVKMEM=y
551# CONFIG_SERIAL_NONSTANDARD is not set
552
553#
554# Serial drivers
555#
556# CONFIG_SERIAL_8250 is not set
557
558#
559# Non-8250 serial port support
560#
561CONFIG_SERIAL_SH_SCI=y
562CONFIG_SERIAL_SH_SCI_NR_UARTS=4
563CONFIG_SERIAL_SH_SCI_CONSOLE=y
564CONFIG_SERIAL_CORE=y
565CONFIG_SERIAL_CORE_CONSOLE=y
566# CONFIG_UNIX98_PTYS is not set
567# CONFIG_LEGACY_PTYS is not set
568# CONFIG_IPMI_HANDLER is not set
569# CONFIG_HW_RANDOM is not set
570# CONFIG_R3964 is not set
571# CONFIG_RAW_DRIVER is not set
572# CONFIG_TCG_TPM is not set
573# CONFIG_I2C is not set
574# CONFIG_SPI is not set
575# CONFIG_W1 is not set
576# CONFIG_POWER_SUPPLY is not set
577# CONFIG_HWMON is not set
578CONFIG_THERMAL=y
579# CONFIG_WATCHDOG is not set
580
581#
582# Sonics Silicon Backplane
583#
584CONFIG_SSB_POSSIBLE=y
585# CONFIG_SSB is not set
586
587#
588# Multifunction device drivers
589#
590# CONFIG_MFD_SM501 is not set
591# CONFIG_HTC_PASIC3 is not set
592
593#
594# Multimedia devices
595#
596
597#
598# Multimedia core support
599#
600# CONFIG_VIDEO_DEV is not set
601# CONFIG_DVB_CORE is not set
602# CONFIG_VIDEO_MEDIA is not set
603
604#
605# Multimedia drivers
606#
607CONFIG_DAB=y
608
609#
610# Graphics support
611#
612# CONFIG_VGASTATE is not set
613CONFIG_VIDEO_OUTPUT_CONTROL=y
614# CONFIG_FB is not set
615# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
616
617#
618# Display device support
619#
620# CONFIG_DISPLAY_SUPPORT is not set
621
622#
623# Sound
624#
625# CONFIG_SOUND is not set
626CONFIG_HID_SUPPORT=y
627CONFIG_HID=y
628# CONFIG_HID_DEBUG is not set
629# CONFIG_HIDRAW is not set
630CONFIG_USB_SUPPORT=y
631CONFIG_USB_ARCH_HAS_HCD=y
632# CONFIG_USB_ARCH_HAS_OHCI is not set
633# CONFIG_USB_ARCH_HAS_EHCI is not set
634# CONFIG_USB is not set
635# CONFIG_USB_OTG_WHITELIST is not set
636# CONFIG_USB_OTG_BLACKLIST_HUB is not set
637
638#
639# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
640#
641# CONFIG_USB_GADGET is not set
642# CONFIG_MMC is not set
643# CONFIG_MEMSTICK is not set
644# CONFIG_NEW_LEDS is not set
645# CONFIG_ACCESSIBILITY is not set
646CONFIG_RTC_LIB=y
647CONFIG_RTC_CLASS=y
648CONFIG_RTC_HCTOSYS=y
649CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
650# CONFIG_RTC_DEBUG is not set
651
652#
653# RTC interfaces
654#
655CONFIG_RTC_INTF_SYSFS=y
656CONFIG_RTC_INTF_PROC=y
657CONFIG_RTC_INTF_DEV=y
658# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
659# CONFIG_RTC_DRV_TEST is not set
660
661#
662# SPI RTC drivers
663#
664
665#
666# Platform RTC drivers
667#
668# CONFIG_RTC_DRV_DS1511 is not set
669# CONFIG_RTC_DRV_DS1553 is not set
670# CONFIG_RTC_DRV_DS1742 is not set
671# CONFIG_RTC_DRV_STK17TA8 is not set
672# CONFIG_RTC_DRV_M48T86 is not set
673# CONFIG_RTC_DRV_M48T59 is not set
674# CONFIG_RTC_DRV_V3020 is not set
675
676#
677# on-CPU RTC drivers
678#
679CONFIG_RTC_DRV_SH=y
680# CONFIG_UIO is not set
681
682#
683# File systems
684#
685# CONFIG_EXT2_FS is not set
686# CONFIG_EXT3_FS is not set
687# CONFIG_EXT4DEV_FS is not set
688# CONFIG_REISERFS_FS is not set
689# CONFIG_JFS_FS is not set
690# CONFIG_FS_POSIX_ACL is not set
691# CONFIG_XFS_FS is not set
692# CONFIG_OCFS2_FS is not set
693# CONFIG_DNOTIFY is not set
694# CONFIG_INOTIFY is not set
695# CONFIG_QUOTA is not set
696# CONFIG_AUTOFS_FS is not set
697# CONFIG_AUTOFS4_FS is not set
698# CONFIG_FUSE_FS is not set
699
700#
701# CD-ROM/DVD Filesystems
702#
703# CONFIG_ISO9660_FS is not set
704# CONFIG_UDF_FS is not set
705
706#
707# DOS/FAT/NT Filesystems
708#
709# CONFIG_MSDOS_FS is not set
710# CONFIG_VFAT_FS is not set
711# CONFIG_NTFS_FS is not set
712
713#
714# Pseudo filesystems
715#
716CONFIG_PROC_FS=y
717CONFIG_PROC_SYSCTL=y
718CONFIG_SYSFS=y
719# CONFIG_TMPFS is not set
720# CONFIG_HUGETLB_PAGE is not set
721# CONFIG_CONFIGFS_FS is not set
722
723#
724# Miscellaneous filesystems
725#
726# CONFIG_ADFS_FS is not set
727# CONFIG_AFFS_FS is not set
728# CONFIG_HFS_FS is not set
729# CONFIG_HFSPLUS_FS is not set
730# CONFIG_BEFS_FS is not set
731# CONFIG_BFS_FS is not set
732# CONFIG_EFS_FS is not set
733# CONFIG_JFFS2_FS is not set
734# CONFIG_CRAMFS is not set
735# CONFIG_VXFS_FS is not set
736# CONFIG_MINIX_FS is not set
737# CONFIG_HPFS_FS is not set
738# CONFIG_QNX4FS_FS is not set
739CONFIG_ROMFS_FS=y
740# CONFIG_SYSV_FS is not set
741# CONFIG_UFS_FS is not set
742CONFIG_NETWORK_FILESYSTEMS=y
743CONFIG_NFS_FS=y
744# CONFIG_NFS_V3 is not set
745# CONFIG_NFS_V4 is not set
746# CONFIG_NFSD is not set
747CONFIG_ROOT_NFS=y
748CONFIG_LOCKD=y
749CONFIG_NFS_COMMON=y
750CONFIG_SUNRPC=y
751# CONFIG_SUNRPC_BIND34 is not set
752# CONFIG_RPCSEC_GSS_KRB5 is not set
753# CONFIG_RPCSEC_GSS_SPKM3 is not set
754# CONFIG_SMB_FS is not set
755# CONFIG_CIFS is not set
756# CONFIG_NCP_FS is not set
757# CONFIG_CODA_FS is not set
758# CONFIG_AFS_FS is not set
759
760#
761# Partition Types
762#
763# CONFIG_PARTITION_ADVANCED is not set
764CONFIG_MSDOS_PARTITION=y
765# CONFIG_NLS is not set
766# CONFIG_DLM is not set
767
768#
769# Kernel hacking
770#
771CONFIG_TRACE_IRQFLAGS_SUPPORT=y
772# CONFIG_PRINTK_TIME is not set
773CONFIG_ENABLE_WARN_DEPRECATED=y
774# CONFIG_ENABLE_MUST_CHECK is not set
775CONFIG_FRAME_WARN=1024
776CONFIG_MAGIC_SYSRQ=y
777# CONFIG_UNUSED_SYMBOLS is not set
778# CONFIG_DEBUG_FS is not set
779# CONFIG_HEADERS_CHECK is not set
780CONFIG_DEBUG_KERNEL=y
781CONFIG_DEBUG_SHIRQ=y
782CONFIG_DETECT_SOFTLOCKUP=y
783CONFIG_SCHED_DEBUG=y
784# CONFIG_SCHEDSTATS is not set
785# CONFIG_TIMER_STATS is not set
786# CONFIG_DEBUG_OBJECTS is not set
787# CONFIG_DEBUG_SLAB is not set
788# CONFIG_DEBUG_RT_MUTEXES is not set
789# CONFIG_RT_MUTEX_TESTER is not set
790# CONFIG_DEBUG_SPINLOCK is not set
791CONFIG_DEBUG_MUTEXES=y
792# CONFIG_DEBUG_LOCK_ALLOC is not set
793# CONFIG_PROVE_LOCKING is not set
794# CONFIG_LOCK_STAT is not set
795CONFIG_DEBUG_SPINLOCK_SLEEP=y
796# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
797# CONFIG_DEBUG_KOBJECT is not set
798CONFIG_DEBUG_BUGVERBOSE=y
799CONFIG_DEBUG_INFO=y
800# CONFIG_DEBUG_VM is not set
801# CONFIG_DEBUG_WRITECOUNT is not set
802# CONFIG_DEBUG_LIST is not set
803# CONFIG_DEBUG_SG is not set
804CONFIG_FRAME_POINTER=y
805# CONFIG_BOOT_PRINTK_DELAY is not set
806# CONFIG_BACKTRACE_SELF_TEST is not set
807# CONFIG_FAULT_INJECTION is not set
808# CONFIG_SAMPLES is not set
809# CONFIG_SH_STANDARD_BIOS is not set
810CONFIG_EARLY_SCIF_CONSOLE=y
811CONFIG_EARLY_SCIF_CONSOLE_PORT=0xfffe8000
812CONFIG_EARLY_PRINTK=y
813CONFIG_DEBUG_BOOTMEM=y
814CONFIG_DEBUG_STACKOVERFLOW=y
815CONFIG_DEBUG_STACK_USAGE=y
816# CONFIG_IRQSTACKS is not set
817
818#
819# Security options
820#
821# CONFIG_KEYS is not set
822# CONFIG_SECURITY is not set
823# CONFIG_SECURITY_FILE_CAPABILITIES is not set
824# CONFIG_CRYPTO is not set
825
826#
827# Library routines
828#
829CONFIG_BITREVERSE=y
830# CONFIG_GENERIC_FIND_FIRST_BIT is not set
831# CONFIG_CRC_CCITT is not set
832# CONFIG_CRC16 is not set
833# CONFIG_CRC_ITU_T is not set
834CONFIG_CRC32=y
835# CONFIG_CRC7 is not set
836# CONFIG_LIBCRC32C is not set
837CONFIG_ZLIB_INFLATE=y
838CONFIG_PLIST=y
839CONFIG_HAS_IOMEM=y
840CONFIG_HAS_IOPORT=y
841CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index 0d0cda908270..6b34baa26eae 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -1,9 +1,10 @@
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-rc4 3# Linux kernel version: 2.6.26-rc4
4# Thu Sep 13 16:40:16 2007 4# Tue Jun 3 20:27:08 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 9CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 10CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -18,6 +19,7 @@ CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_ARCH_NO_VIRT_TO_BUS=y 21CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_ARCH_SUPPORTS_AOUT=y
21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
22 24
23# 25#
@@ -25,47 +27,82 @@ CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25# 27#
26CONFIG_EXPERIMENTAL=y 28CONFIG_EXPERIMENTAL=y
27CONFIG_BROKEN_ON_SMP=y 29CONFIG_BROKEN_ON_SMP=y
30CONFIG_LOCK_KERNEL=y
28CONFIG_INIT_ENV_ARG_LIMIT=32 31CONFIG_INIT_ENV_ARG_LIMIT=32
29CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
30# CONFIG_LOCALVERSION_AUTO is not set 33CONFIG_LOCALVERSION_AUTO=y
31# CONFIG_SYSVIPC is not set 34CONFIG_SYSVIPC=y
32# CONFIG_POSIX_MQUEUE is not set 35CONFIG_SYSVIPC_SYSCTL=y
33# CONFIG_BSD_PROCESS_ACCT is not set 36CONFIG_POSIX_MQUEUE=y
37CONFIG_BSD_PROCESS_ACCT=y
38# CONFIG_BSD_PROCESS_ACCT_V3 is not set
34# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
35# CONFIG_USER_NS is not set 40CONFIG_AUDIT=y
36# CONFIG_AUDIT is not set 41CONFIG_AUDITSYSCALL=y
37# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14 43CONFIG_LOG_BUF_SHIFT=14
39CONFIG_SYSFS_DEPRECATED=y 44CONFIG_CGROUPS=y
40# CONFIG_RELAY is not set 45CONFIG_CGROUP_DEBUG=y
41# CONFIG_BLK_DEV_INITRD is not set 46CONFIG_CGROUP_NS=y
47CONFIG_CGROUP_DEVICE=y
48# CONFIG_GROUP_SCHED is not set
49CONFIG_CGROUP_CPUACCT=y
50CONFIG_RESOURCE_COUNTERS=y
51CONFIG_MM_OWNER=y
52CONFIG_CGROUP_MEM_RES_CTLR=y
53# CONFIG_SYSFS_DEPRECATED_V2 is not set
54CONFIG_RELAY=y
55CONFIG_NAMESPACES=y
56CONFIG_UTS_NS=y
57CONFIG_IPC_NS=y
58CONFIG_USER_NS=y
59CONFIG_PID_NS=y
60CONFIG_BLK_DEV_INITRD=y
61CONFIG_INITRAMFS_SOURCE=""
42CONFIG_CC_OPTIMIZE_FOR_SIZE=y 62CONFIG_CC_OPTIMIZE_FOR_SIZE=y
43CONFIG_SYSCTL=y 63CONFIG_SYSCTL=y
44CONFIG_EMBEDDED=y 64CONFIG_EMBEDDED=y
45# CONFIG_UID16 is not set 65# CONFIG_UID16 is not set
46# CONFIG_SYSCTL_SYSCALL is not set 66# CONFIG_SYSCTL_SYSCALL is not set
47# CONFIG_KALLSYMS is not set 67CONFIG_KALLSYMS=y
48# CONFIG_HOTPLUG is not set 68CONFIG_KALLSYMS_ALL=y
69# CONFIG_KALLSYMS_EXTRA_PASS is not set
70CONFIG_HOTPLUG=y
49CONFIG_PRINTK=y 71CONFIG_PRINTK=y
50CONFIG_BUG=y 72CONFIG_BUG=y
51# CONFIG_ELF_CORE is not set 73# CONFIG_ELF_CORE is not set
52# CONFIG_BASE_FULL is not set 74# CONFIG_COMPAT_BRK is not set
53# CONFIG_FUTEX is not set 75CONFIG_BASE_FULL=y
76CONFIG_FUTEX=y
54CONFIG_ANON_INODES=y 77CONFIG_ANON_INODES=y
55# CONFIG_EPOLL is not set 78CONFIG_EPOLL=y
56CONFIG_SIGNALFD=y 79CONFIG_SIGNALFD=y
57CONFIG_TIMERFD=y 80CONFIG_TIMERFD=y
58CONFIG_EVENTFD=y 81CONFIG_EVENTFD=y
59# CONFIG_VM_EVENT_COUNTERS is not set 82CONFIG_VM_EVENT_COUNTERS=y
60CONFIG_SLUB_DEBUG=y
61# CONFIG_SLAB is not set 83# CONFIG_SLAB is not set
62CONFIG_SLUB=y 84# CONFIG_SLUB is not set
63# CONFIG_SLOB is not set 85CONFIG_SLOB=y
86CONFIG_PROFILING=y
87# CONFIG_MARKERS is not set
88CONFIG_OPROFILE=y
89CONFIG_HAVE_OPROFILE=y
90# CONFIG_HAVE_KPROBES is not set
91# CONFIG_HAVE_KRETPROBES is not set
92# CONFIG_HAVE_DMA_ATTRS is not set
93CONFIG_RT_MUTEXES=y
64CONFIG_TINY_SHMEM=y 94CONFIG_TINY_SHMEM=y
65CONFIG_BASE_SMALL=1 95CONFIG_BASE_SMALL=0
66# CONFIG_MODULES is not set 96CONFIG_MODULES=y
97# CONFIG_MODULE_FORCE_LOAD is not set
98CONFIG_MODULE_UNLOAD=y
99# CONFIG_MODULE_FORCE_UNLOAD is not set
100# CONFIG_MODVERSIONS is not set
101# CONFIG_MODULE_SRCVERSION_ALL is not set
102# CONFIG_KMOD is not set
67CONFIG_BLOCK=y 103CONFIG_BLOCK=y
68# CONFIG_LBD is not set 104# CONFIG_LBD is not set
105# CONFIG_BLK_DEV_IO_TRACE is not set
69# CONFIG_LSF is not set 106# CONFIG_LSF is not set
70# CONFIG_BLK_DEV_BSG is not set 107# CONFIG_BLK_DEV_BSG is not set
71 108
@@ -81,6 +118,7 @@ CONFIG_IOSCHED_NOOP=y
81# CONFIG_DEFAULT_CFQ is not set 118# CONFIG_DEFAULT_CFQ is not set
82CONFIG_DEFAULT_NOOP=y 119CONFIG_DEFAULT_NOOP=y
83CONFIG_DEFAULT_IOSCHED="noop" 120CONFIG_DEFAULT_IOSCHED="noop"
121# CONFIG_CLASSIC_RCU is not set
84 122
85# 123#
86# System type 124# System type
@@ -88,7 +126,10 @@ CONFIG_DEFAULT_IOSCHED="noop"
88CONFIG_CPU_SH2=y 126CONFIG_CPU_SH2=y
89CONFIG_CPU_SH2A=y 127CONFIG_CPU_SH2A=y
90# CONFIG_CPU_SUBTYPE_SH7619 is not set 128# CONFIG_CPU_SUBTYPE_SH7619 is not set
129# CONFIG_CPU_SUBTYPE_SH7203 is not set
91CONFIG_CPU_SUBTYPE_SH7206=y 130CONFIG_CPU_SUBTYPE_SH7206=y
131# CONFIG_CPU_SUBTYPE_SH7263 is not set
132# CONFIG_CPU_SUBTYPE_MXG is not set
92# CONFIG_CPU_SUBTYPE_SH7705 is not set 133# CONFIG_CPU_SUBTYPE_SH7705 is not set
93# CONFIG_CPU_SUBTYPE_SH7706 is not set 134# CONFIG_CPU_SUBTYPE_SH7706 is not set
94# CONFIG_CPU_SUBTYPE_SH7707 is not set 135# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -97,6 +138,7 @@ CONFIG_CPU_SUBTYPE_SH7206=y
97# CONFIG_CPU_SUBTYPE_SH7710 is not set 138# CONFIG_CPU_SUBTYPE_SH7710 is not set
98# CONFIG_CPU_SUBTYPE_SH7712 is not set 139# CONFIG_CPU_SUBTYPE_SH7712 is not set
99# CONFIG_CPU_SUBTYPE_SH7720 is not set 140# CONFIG_CPU_SUBTYPE_SH7720 is not set
141# CONFIG_CPU_SUBTYPE_SH7721 is not set
100# CONFIG_CPU_SUBTYPE_SH7750 is not set 142# CONFIG_CPU_SUBTYPE_SH7750 is not set
101# CONFIG_CPU_SUBTYPE_SH7091 is not set 143# CONFIG_CPU_SUBTYPE_SH7091 is not set
102# CONFIG_CPU_SUBTYPE_SH7750R is not set 144# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -105,14 +147,17 @@ CONFIG_CPU_SUBTYPE_SH7206=y
105# CONFIG_CPU_SUBTYPE_SH7751R is not set 147# CONFIG_CPU_SUBTYPE_SH7751R is not set
106# CONFIG_CPU_SUBTYPE_SH7760 is not set 148# CONFIG_CPU_SUBTYPE_SH7760 is not set
107# CONFIG_CPU_SUBTYPE_SH4_202 is not set 149# CONFIG_CPU_SUBTYPE_SH4_202 is not set
108# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 150# CONFIG_CPU_SUBTYPE_SH7723 is not set
109# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 151# CONFIG_CPU_SUBTYPE_SH7763 is not set
110# CONFIG_CPU_SUBTYPE_SH7770 is not set 152# CONFIG_CPU_SUBTYPE_SH7770 is not set
111# CONFIG_CPU_SUBTYPE_SH7780 is not set 153# CONFIG_CPU_SUBTYPE_SH7780 is not set
112# CONFIG_CPU_SUBTYPE_SH7785 is not set 154# CONFIG_CPU_SUBTYPE_SH7785 is not set
113# CONFIG_CPU_SUBTYPE_SHX3 is not set 155# CONFIG_CPU_SUBTYPE_SHX3 is not set
114# CONFIG_CPU_SUBTYPE_SH7343 is not set 156# CONFIG_CPU_SUBTYPE_SH7343 is not set
115# CONFIG_CPU_SUBTYPE_SH7722 is not set 157# CONFIG_CPU_SUBTYPE_SH7722 is not set
158# CONFIG_CPU_SUBTYPE_SH7366 is not set
159# CONFIG_CPU_SUBTYPE_SH5_101 is not set
160# CONFIG_CPU_SUBTYPE_SH5_103 is not set
116 161
117# 162#
118# Memory management options 163# Memory management options
@@ -121,23 +166,25 @@ CONFIG_QUICKLIST=y
121CONFIG_PAGE_OFFSET=0x00000000 166CONFIG_PAGE_OFFSET=0x00000000
122CONFIG_MEMORY_START=0x0c000000 167CONFIG_MEMORY_START=0x0c000000
123CONFIG_MEMORY_SIZE=0x04000000 168CONFIG_MEMORY_SIZE=0x04000000
169CONFIG_29BIT=y
124CONFIG_ARCH_FLATMEM_ENABLE=y 170CONFIG_ARCH_FLATMEM_ENABLE=y
125CONFIG_ARCH_SPARSEMEM_ENABLE=y 171CONFIG_ARCH_SPARSEMEM_ENABLE=y
126CONFIG_ARCH_SPARSEMEM_DEFAULT=y 172CONFIG_ARCH_SPARSEMEM_DEFAULT=y
127CONFIG_MAX_ACTIVE_REGIONS=1 173CONFIG_MAX_ACTIVE_REGIONS=1
128CONFIG_ARCH_POPULATES_NODE_MAP=y 174CONFIG_ARCH_POPULATES_NODE_MAP=y
129CONFIG_ARCH_SELECT_MEMORY_MODEL=y 175CONFIG_ARCH_SELECT_MEMORY_MODEL=y
130CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
131CONFIG_PAGE_SIZE_4KB=y 176CONFIG_PAGE_SIZE_4KB=y
132# CONFIG_PAGE_SIZE_8KB is not set 177# CONFIG_PAGE_SIZE_8KB is not set
133# CONFIG_PAGE_SIZE_64KB is not set 178# CONFIG_PAGE_SIZE_64KB is not set
134CONFIG_SELECT_MEMORY_MODEL=y 179CONFIG_SELECT_MEMORY_MODEL=y
135# CONFIG_FLATMEM_MANUAL is not set 180CONFIG_FLATMEM_MANUAL=y
136# CONFIG_DISCONTIGMEM_MANUAL is not set 181# CONFIG_DISCONTIGMEM_MANUAL is not set
137CONFIG_SPARSEMEM_MANUAL=y 182# CONFIG_SPARSEMEM_MANUAL is not set
138CONFIG_SPARSEMEM=y 183CONFIG_FLATMEM=y
139CONFIG_HAVE_MEMORY_PRESENT=y 184CONFIG_FLAT_NODE_MEM_MAP=y
140CONFIG_SPARSEMEM_STATIC=y 185CONFIG_SPARSEMEM_STATIC=y
186# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
187CONFIG_PAGEFLAGS_EXTENDED=y
141CONFIG_SPLIT_PTLOCK_CPUS=4 188CONFIG_SPLIT_PTLOCK_CPUS=4
142# CONFIG_RESOURCES_64BIT is not set 189# CONFIG_RESOURCES_64BIT is not set
143CONFIG_ZONE_DMA_FLAG=0 190CONFIG_ZONE_DMA_FLAG=0
@@ -183,13 +230,16 @@ CONFIG_CPU_FREQ_TABLE=y
183CONFIG_CPU_FREQ_STAT=y 230CONFIG_CPU_FREQ_STAT=y
184# CONFIG_CPU_FREQ_STAT_DETAILS is not set 231# CONFIG_CPU_FREQ_STAT_DETAILS is not set
185CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 232CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
233# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
186# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 234# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
235# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
236# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
187CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 237CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
188# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 238# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
189# CONFIG_CPU_FREQ_GOV_USERSPACE is not set 239# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
190# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set 240# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
191# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set 241# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
192# CONFIG_SH_CPU_FREQ is not set 242CONFIG_SH_CPU_FREQ=y
193 243
194# 244#
195# DMA support 245# DMA support
@@ -213,11 +263,15 @@ CONFIG_HEARTBEAT=y
213# CONFIG_HZ_300 is not set 263# CONFIG_HZ_300 is not set
214CONFIG_HZ_1000=y 264CONFIG_HZ_1000=y
215CONFIG_HZ=1000 265CONFIG_HZ=1000
216# CONFIG_KEXEC is not set 266# CONFIG_SCHED_HRTICK is not set
267CONFIG_KEXEC=y
217# CONFIG_CRASH_DUMP is not set 268# CONFIG_CRASH_DUMP is not set
218CONFIG_PREEMPT_NONE=y 269# CONFIG_PREEMPT_NONE is not set
219# CONFIG_PREEMPT_VOLUNTARY is not set 270# CONFIG_PREEMPT_VOLUNTARY is not set
220# CONFIG_PREEMPT is not set 271CONFIG_PREEMPT=y
272CONFIG_PREEMPT_RCU=y
273CONFIG_RCU_TRACE=y
274CONFIG_GUSA=y
221 275
222# 276#
223# Boot options 277# Boot options
@@ -225,25 +279,25 @@ CONFIG_PREEMPT_NONE=y
225CONFIG_ZERO_PAGE_OFFSET=0x00001000 279CONFIG_ZERO_PAGE_OFFSET=0x00001000
226CONFIG_BOOT_LINK_OFFSET=0x00800000 280CONFIG_BOOT_LINK_OFFSET=0x00800000
227CONFIG_CMDLINE_BOOL=y 281CONFIG_CMDLINE_BOOL=y
228CONFIG_CMDLINE="console=ttySC3,115200 earlyprintk=serial ignore_loglevel" 282CONFIG_CMDLINE="console=ttySC3,115200 ignore_loglevel earlyprintk=serial"
229 283
230# 284#
231# Bus options 285# Bus options
232# 286#
233# CONFIG_CF_ENABLER is not set 287CONFIG_CF_ENABLER=y
288# CONFIG_CF_AREA5 is not set
289CONFIG_CF_AREA6=y
290CONFIG_CF_BASE_ADDR=0xb8000000
234# CONFIG_ARCH_SUPPORTS_MSI is not set 291# CONFIG_ARCH_SUPPORTS_MSI is not set
235 292# CONFIG_PCCARD is not set
236#
237# PCCARD (PCMCIA/CardBus) support
238#
239 293
240# 294#
241# Executable file formats 295# Executable file formats
242# 296#
243CONFIG_BINFMT_FLAT=y 297CONFIG_BINFMT_FLAT=y
244CONFIG_BINFMT_ZFLAT=y 298CONFIG_BINFMT_ZFLAT=y
245# CONFIG_BINFMT_SHARED_FLAT is not set 299CONFIG_BINFMT_SHARED_FLAT=y
246# CONFIG_BINFMT_MISC is not set 300CONFIG_BINFMT_MISC=y
247 301
248# 302#
249# Networking 303# Networking
@@ -253,14 +307,24 @@ CONFIG_NET=y
253# 307#
254# Networking options 308# Networking options
255# 309#
256# CONFIG_PACKET is not set 310CONFIG_PACKET=y
257# CONFIG_UNIX is not set 311# CONFIG_PACKET_MMAP is not set
258# CONFIG_NET_KEY is not set 312CONFIG_UNIX=y
313CONFIG_XFRM=y
314# CONFIG_XFRM_USER is not set
315# CONFIG_XFRM_SUB_POLICY is not set
316# CONFIG_XFRM_MIGRATE is not set
317# CONFIG_XFRM_STATISTICS is not set
318CONFIG_NET_KEY=y
319# CONFIG_NET_KEY_MIGRATE is not set
259CONFIG_INET=y 320CONFIG_INET=y
260# CONFIG_IP_MULTICAST is not set 321# CONFIG_IP_MULTICAST is not set
261# CONFIG_IP_ADVANCED_ROUTER is not set 322# CONFIG_IP_ADVANCED_ROUTER is not set
262CONFIG_IP_FIB_HASH=y 323CONFIG_IP_FIB_HASH=y
263# CONFIG_IP_PNP is not set 324CONFIG_IP_PNP=y
325CONFIG_IP_PNP_DHCP=y
326# CONFIG_IP_PNP_BOOTP is not set
327# CONFIG_IP_PNP_RARP is not set
264# CONFIG_NET_IPIP is not set 328# CONFIG_NET_IPIP is not set
265# CONFIG_NET_IPGRE is not set 329# CONFIG_NET_IPGRE is not set
266# CONFIG_ARPD is not set 330# CONFIG_ARPD is not set
@@ -273,14 +337,13 @@ CONFIG_IP_FIB_HASH=y
273# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 337# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
274# CONFIG_INET_XFRM_MODE_TUNNEL is not set 338# CONFIG_INET_XFRM_MODE_TUNNEL is not set
275# CONFIG_INET_XFRM_MODE_BEET is not set 339# CONFIG_INET_XFRM_MODE_BEET is not set
340# CONFIG_INET_LRO is not set
276# CONFIG_INET_DIAG is not set 341# CONFIG_INET_DIAG is not set
277# CONFIG_TCP_CONG_ADVANCED is not set 342# CONFIG_TCP_CONG_ADVANCED is not set
278CONFIG_TCP_CONG_CUBIC=y 343CONFIG_TCP_CONG_CUBIC=y
279CONFIG_DEFAULT_TCP_CONG="cubic" 344CONFIG_DEFAULT_TCP_CONG="cubic"
280# CONFIG_TCP_MD5SIG is not set 345# CONFIG_TCP_MD5SIG is not set
281# CONFIG_IPV6 is not set 346# CONFIG_IPV6 is not set
282# CONFIG_INET6_XFRM_TUNNEL is not set
283# CONFIG_INET6_TUNNEL is not set
284# CONFIG_NETWORK_SECMARK is not set 347# CONFIG_NETWORK_SECMARK is not set
285# CONFIG_NETFILTER is not set 348# CONFIG_NETFILTER is not set
286# CONFIG_IP_DCCP is not set 349# CONFIG_IP_DCCP is not set
@@ -297,10 +360,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
297# CONFIG_LAPB is not set 360# CONFIG_LAPB is not set
298# CONFIG_ECONET is not set 361# CONFIG_ECONET is not set
299# CONFIG_WAN_ROUTER is not set 362# CONFIG_WAN_ROUTER is not set
300
301#
302# QoS and/or fair queueing
303#
304# CONFIG_NET_SCHED is not set 363# CONFIG_NET_SCHED is not set
305 364
306# 365#
@@ -308,6 +367,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
308# 367#
309# CONFIG_NET_PKTGEN is not set 368# CONFIG_NET_PKTGEN is not set
310# CONFIG_HAMRADIO is not set 369# CONFIG_HAMRADIO is not set
370# CONFIG_CAN is not set
311# CONFIG_IRDA is not set 371# CONFIG_IRDA is not set
312# CONFIG_BT is not set 372# CONFIG_BT is not set
313# CONFIG_AF_RXRPC is not set 373# CONFIG_AF_RXRPC is not set
@@ -329,8 +389,10 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
329# 389#
330# Generic Driver Options 390# Generic Driver Options
331# 391#
392CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
332# CONFIG_STANDALONE is not set 393# CONFIG_STANDALONE is not set
333# CONFIG_PREVENT_FIRMWARE_BUILD is not set 394# CONFIG_PREVENT_FIRMWARE_BUILD is not set
395# CONFIG_FW_LOADER is not set
334# CONFIG_DEBUG_DRIVER is not set 396# CONFIG_DEBUG_DRIVER is not set
335# CONFIG_DEBUG_DEVRES is not set 397# CONFIG_DEBUG_DEVRES is not set
336# CONFIG_SYS_HYPERVISOR is not set 398# CONFIG_SYS_HYPERVISOR is not set
@@ -339,11 +401,9 @@ CONFIG_MTD=y
339# CONFIG_MTD_DEBUG is not set 401# CONFIG_MTD_DEBUG is not set
340CONFIG_MTD_CONCAT=y 402CONFIG_MTD_CONCAT=y
341CONFIG_MTD_PARTITIONS=y 403CONFIG_MTD_PARTITIONS=y
342CONFIG_MTD_REDBOOT_PARTS=y 404# CONFIG_MTD_REDBOOT_PARTS is not set
343CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
344# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
345# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
346# CONFIG_MTD_CMDLINE_PARTS is not set 405# CONFIG_MTD_CMDLINE_PARTS is not set
406# CONFIG_MTD_AR7_PARTS is not set
347 407
348# 408#
349# User Modules And Translation Layers 409# User Modules And Translation Layers
@@ -356,6 +416,7 @@ CONFIG_MTD_BLOCK=y
356# CONFIG_INFTL is not set 416# CONFIG_INFTL is not set
357# CONFIG_RFD_FTL is not set 417# CONFIG_RFD_FTL is not set
358# CONFIG_SSFDC is not set 418# CONFIG_SSFDC is not set
419# CONFIG_MTD_OOPS is not set
359 420
360# 421#
361# RAM/ROM/Flash chip drivers 422# RAM/ROM/Flash chip drivers
@@ -390,7 +451,6 @@ CONFIG_MTD_PHYSMAP=y
390CONFIG_MTD_PHYSMAP_START=0x20000000 451CONFIG_MTD_PHYSMAP_START=0x20000000
391CONFIG_MTD_PHYSMAP_LEN=0x01000000 452CONFIG_MTD_PHYSMAP_LEN=0x01000000
392CONFIG_MTD_PHYSMAP_BANKWIDTH=4 453CONFIG_MTD_PHYSMAP_BANKWIDTH=4
393# CONFIG_MTD_SOLUTIONENGINE is not set
394# CONFIG_MTD_UCLINUX is not set 454# CONFIG_MTD_UCLINUX is not set
395# CONFIG_MTD_PLATRAM is not set 455# CONFIG_MTD_PLATRAM is not set
396 456
@@ -418,13 +478,19 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=4
418# CONFIG_PARPORT is not set 478# CONFIG_PARPORT is not set
419CONFIG_BLK_DEV=y 479CONFIG_BLK_DEV=y
420# CONFIG_BLK_DEV_COW_COMMON is not set 480# CONFIG_BLK_DEV_COW_COMMON is not set
421# CONFIG_BLK_DEV_LOOP is not set 481CONFIG_BLK_DEV_LOOP=y
482# CONFIG_BLK_DEV_CRYPTOLOOP is not set
422# CONFIG_BLK_DEV_NBD is not set 483# CONFIG_BLK_DEV_NBD is not set
423# CONFIG_BLK_DEV_RAM is not set 484CONFIG_BLK_DEV_RAM=y
485CONFIG_BLK_DEV_RAM_COUNT=16
486CONFIG_BLK_DEV_RAM_SIZE=4096
487# CONFIG_BLK_DEV_XIP is not set
424# CONFIG_CDROM_PKTCDVD is not set 488# CONFIG_CDROM_PKTCDVD is not set
425# CONFIG_ATA_OVER_ETH is not set 489# CONFIG_ATA_OVER_ETH is not set
426CONFIG_MISC_DEVICES=y 490CONFIG_MISC_DEVICES=y
427# CONFIG_EEPROM_93CX6 is not set 491CONFIG_EEPROM_93CX6=y
492# CONFIG_ENCLOSURE_SERVICES is not set
493CONFIG_HAVE_IDE=y
428# CONFIG_IDE is not set 494# CONFIG_IDE is not set
429 495
430# 496#
@@ -443,23 +509,30 @@ CONFIG_NETDEVICES=y
443# CONFIG_MACVLAN is not set 509# CONFIG_MACVLAN is not set
444# CONFIG_EQUALIZER is not set 510# CONFIG_EQUALIZER is not set
445# CONFIG_TUN is not set 511# CONFIG_TUN is not set
512# CONFIG_VETH is not set
446# CONFIG_PHYLIB is not set 513# CONFIG_PHYLIB is not set
447CONFIG_NET_ETHERNET=y 514CONFIG_NET_ETHERNET=y
448CONFIG_MII=y 515CONFIG_MII=y
516# CONFIG_AX88796 is not set
449# CONFIG_STNIC is not set 517# CONFIG_STNIC is not set
450CONFIG_SMC91X=y 518CONFIG_SMC91X=y
451CONFIG_NETDEV_1000=y 519# CONFIG_IBM_NEW_EMAC_ZMII is not set
452CONFIG_NETDEV_10000=y 520# CONFIG_IBM_NEW_EMAC_RGMII is not set
521# CONFIG_IBM_NEW_EMAC_TAH is not set
522# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
523# CONFIG_B44 is not set
524# CONFIG_NETDEV_1000 is not set
525# CONFIG_NETDEV_10000 is not set
453 526
454# 527#
455# Wireless LAN 528# Wireless LAN
456# 529#
457# CONFIG_WLAN_PRE80211 is not set 530# CONFIG_WLAN_PRE80211 is not set
458# CONFIG_WLAN_80211 is not set 531# CONFIG_WLAN_80211 is not set
532# CONFIG_IWLWIFI_LEDS is not set
459# CONFIG_WAN is not set 533# CONFIG_WAN is not set
460# CONFIG_PPP is not set 534# CONFIG_PPP is not set
461# CONFIG_SLIP is not set 535# CONFIG_SLIP is not set
462# CONFIG_SHAPER is not set
463# CONFIG_NETCONSOLE is not set 536# CONFIG_NETCONSOLE is not set
464# CONFIG_NETPOLL is not set 537# CONFIG_NETPOLL is not set
465# CONFIG_NET_POLL_CONTROLLER is not set 538# CONFIG_NET_POLL_CONTROLLER is not set
@@ -469,28 +542,7 @@ CONFIG_NETDEV_10000=y
469# 542#
470# Input device support 543# Input device support
471# 544#
472CONFIG_INPUT=y 545# CONFIG_INPUT is not set
473# CONFIG_INPUT_FF_MEMLESS is not set
474# CONFIG_INPUT_POLLDEV is not set
475
476#
477# Userland interfaces
478#
479# CONFIG_INPUT_MOUSEDEV is not set
480# CONFIG_INPUT_JOYDEV is not set
481# CONFIG_INPUT_TSDEV is not set
482# CONFIG_INPUT_EVDEV is not set
483# CONFIG_INPUT_EVBUG is not set
484
485#
486# Input Device Drivers
487#
488# CONFIG_INPUT_KEYBOARD is not set
489# CONFIG_INPUT_MOUSE is not set
490# CONFIG_INPUT_JOYSTICK is not set
491# CONFIG_INPUT_TABLET is not set
492# CONFIG_INPUT_TOUCHSCREEN is not set
493# CONFIG_INPUT_MISC is not set
494 546
495# 547#
496# Hardware I/O ports 548# Hardware I/O ports
@@ -502,6 +554,7 @@ CONFIG_INPUT=y
502# Character devices 554# Character devices
503# 555#
504# CONFIG_VT is not set 556# CONFIG_VT is not set
557# CONFIG_DEVKMEM is not set
505# CONFIG_SERIAL_NONSTANDARD is not set 558# CONFIG_SERIAL_NONSTANDARD is not set
506 559
507# 560#
@@ -520,106 +573,119 @@ CONFIG_SERIAL_CORE_CONSOLE=y
520# CONFIG_UNIX98_PTYS is not set 573# CONFIG_UNIX98_PTYS is not set
521# CONFIG_LEGACY_PTYS is not set 574# CONFIG_LEGACY_PTYS is not set
522# CONFIG_IPMI_HANDLER is not set 575# CONFIG_IPMI_HANDLER is not set
523# CONFIG_WATCHDOG is not set
524# CONFIG_HW_RANDOM is not set 576# CONFIG_HW_RANDOM is not set
525# CONFIG_R3964 is not set 577# CONFIG_R3964 is not set
526# CONFIG_RAW_DRIVER is not set 578# CONFIG_RAW_DRIVER is not set
527# CONFIG_TCG_TPM is not set 579# CONFIG_TCG_TPM is not set
528# CONFIG_I2C is not set 580# CONFIG_I2C is not set
529
530#
531# SPI support
532#
533# CONFIG_SPI is not set 581# CONFIG_SPI is not set
534# CONFIG_SPI_MASTER is not set
535# CONFIG_W1 is not set 582# CONFIG_W1 is not set
536# CONFIG_POWER_SUPPLY is not set 583# CONFIG_POWER_SUPPLY is not set
537# CONFIG_HWMON is not set 584# CONFIG_HWMON is not set
585# CONFIG_THERMAL is not set
586# CONFIG_WATCHDOG is not set
587
588#
589# Sonics Silicon Backplane
590#
591CONFIG_SSB_POSSIBLE=y
592# CONFIG_SSB is not set
538 593
539# 594#
540# Multifunction device drivers 595# Multifunction device drivers
541# 596#
542# CONFIG_MFD_SM501 is not set 597# CONFIG_MFD_SM501 is not set
598# CONFIG_HTC_PASIC3 is not set
543 599
544# 600#
545# Multimedia devices 601# Multimedia devices
546# 602#
603
604#
605# Multimedia core support
606#
547# CONFIG_VIDEO_DEV is not set 607# CONFIG_VIDEO_DEV is not set
548# CONFIG_DVB_CORE is not set 608# CONFIG_DVB_CORE is not set
549CONFIG_DAB=y 609# CONFIG_VIDEO_MEDIA is not set
610
611#
612# Multimedia drivers
613#
614# CONFIG_DAB is not set
550 615
551# 616#
552# Graphics support 617# Graphics support
553# 618#
619# CONFIG_VGASTATE is not set
620# CONFIG_VIDEO_OUTPUT_CONTROL is not set
621# CONFIG_FB is not set
554# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 622# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
555 623
556# 624#
557# Display device support 625# Display device support
558# 626#
559# CONFIG_DISPLAY_SUPPORT is not set 627# CONFIG_DISPLAY_SUPPORT is not set
560# CONFIG_VGASTATE is not set
561CONFIG_VIDEO_OUTPUT_CONTROL=y
562# CONFIG_FB is not set
563 628
564# 629#
565# Sound 630# Sound
566# 631#
567# CONFIG_SOUND is not set 632# CONFIG_SOUND is not set
568CONFIG_HID_SUPPORT=y 633# CONFIG_USB_SUPPORT is not set
569CONFIG_HID=y
570# CONFIG_HID_DEBUG is not set
571CONFIG_USB_SUPPORT=y
572CONFIG_USB_ARCH_HAS_HCD=y
573# CONFIG_USB_ARCH_HAS_OHCI is not set
574# CONFIG_USB_ARCH_HAS_EHCI is not set
575# CONFIG_USB is not set
576
577#
578# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
579#
580
581#
582# USB Gadget Support
583#
584# CONFIG_USB_GADGET is not set
585# CONFIG_MMC is not set 634# CONFIG_MMC is not set
635# CONFIG_MEMSTICK is not set
586# CONFIG_NEW_LEDS is not set 636# CONFIG_NEW_LEDS is not set
587# CONFIG_RTC_CLASS is not set 637# CONFIG_ACCESSIBILITY is not set
638CONFIG_RTC_LIB=y
639CONFIG_RTC_CLASS=y
640CONFIG_RTC_HCTOSYS=y
641CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
642# CONFIG_RTC_DEBUG is not set
588 643
589# 644#
590# DMA Engine support 645# RTC interfaces
591# 646#
592# CONFIG_DMA_ENGINE is not set 647CONFIG_RTC_INTF_SYSFS=y
648CONFIG_RTC_INTF_PROC=y
649CONFIG_RTC_INTF_DEV=y
650# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
651# CONFIG_RTC_DRV_TEST is not set
593 652
594# 653#
595# DMA Clients 654# SPI RTC drivers
596# 655#
597 656
598# 657#
599# DMA Devices 658# Platform RTC drivers
600# 659#
660# CONFIG_RTC_DRV_DS1511 is not set
661# CONFIG_RTC_DRV_DS1553 is not set
662# CONFIG_RTC_DRV_DS1742 is not set
663# CONFIG_RTC_DRV_STK17TA8 is not set
664# CONFIG_RTC_DRV_M48T86 is not set
665# CONFIG_RTC_DRV_M48T59 is not set
666# CONFIG_RTC_DRV_V3020 is not set
601 667
602# 668#
603# Userspace I/O 669# on-CPU RTC drivers
604# 670#
671CONFIG_RTC_DRV_SH=y
605# CONFIG_UIO is not set 672# CONFIG_UIO is not set
606 673
607# 674#
608# File systems 675# File systems
609# 676#
610# CONFIG_EXT2_FS is not set 677CONFIG_EXT2_FS=y
678# CONFIG_EXT2_FS_XATTR is not set
611# CONFIG_EXT3_FS is not set 679# CONFIG_EXT3_FS is not set
612# CONFIG_EXT4DEV_FS is not set 680# CONFIG_EXT4DEV_FS is not set
613# CONFIG_REISERFS_FS is not set 681# CONFIG_REISERFS_FS is not set
614# CONFIG_JFS_FS is not set 682# CONFIG_JFS_FS is not set
615# CONFIG_FS_POSIX_ACL is not set 683# CONFIG_FS_POSIX_ACL is not set
616# CONFIG_XFS_FS is not set 684# CONFIG_XFS_FS is not set
617# CONFIG_GFS2_FS is not set 685# CONFIG_OCFS2_FS is not set
618# CONFIG_MINIX_FS is not set 686# CONFIG_DNOTIFY is not set
619CONFIG_ROMFS_FS=y
620# CONFIG_INOTIFY is not set 687# CONFIG_INOTIFY is not set
621# CONFIG_QUOTA is not set 688# CONFIG_QUOTA is not set
622# CONFIG_DNOTIFY is not set
623# CONFIG_AUTOFS_FS is not set 689# CONFIG_AUTOFS_FS is not set
624# CONFIG_AUTOFS4_FS is not set 690# CONFIG_AUTOFS4_FS is not set
625# CONFIG_FUSE_FS is not set 691# CONFIG_FUSE_FS is not set
@@ -642,10 +708,11 @@ CONFIG_ROMFS_FS=y
642# 708#
643CONFIG_PROC_FS=y 709CONFIG_PROC_FS=y
644CONFIG_PROC_SYSCTL=y 710CONFIG_PROC_SYSCTL=y
645# CONFIG_SYSFS is not set 711CONFIG_SYSFS=y
646# CONFIG_TMPFS is not set 712CONFIG_TMPFS=y
713# CONFIG_TMPFS_POSIX_ACL is not set
647# CONFIG_HUGETLB_PAGE is not set 714# CONFIG_HUGETLB_PAGE is not set
648CONFIG_RAMFS=y 715CONFIG_CONFIGFS_FS=y
649 716
650# 717#
651# Miscellaneous filesystems 718# Miscellaneous filesystems
@@ -658,18 +725,28 @@ CONFIG_RAMFS=y
658# CONFIG_BFS_FS is not set 725# CONFIG_BFS_FS is not set
659# CONFIG_EFS_FS is not set 726# CONFIG_EFS_FS is not set
660# CONFIG_JFFS2_FS is not set 727# CONFIG_JFFS2_FS is not set
661# CONFIG_CRAMFS is not set 728CONFIG_CRAMFS=y
662# CONFIG_VXFS_FS is not set 729# CONFIG_VXFS_FS is not set
730# CONFIG_MINIX_FS is not set
663# CONFIG_HPFS_FS is not set 731# CONFIG_HPFS_FS is not set
664# CONFIG_QNX4FS_FS is not set 732# CONFIG_QNX4FS_FS is not set
733CONFIG_ROMFS_FS=y
665# CONFIG_SYSV_FS is not set 734# CONFIG_SYSV_FS is not set
666# CONFIG_UFS_FS is not set 735# CONFIG_UFS_FS is not set
667 736CONFIG_NETWORK_FILESYSTEMS=y
668# 737CONFIG_NFS_FS=y
669# Network File Systems 738CONFIG_NFS_V3=y
670# 739# CONFIG_NFS_V3_ACL is not set
671# CONFIG_NFS_FS is not set 740# CONFIG_NFS_V4 is not set
672# CONFIG_NFSD is not set 741# CONFIG_NFSD is not set
742CONFIG_ROOT_NFS=y
743CONFIG_LOCKD=y
744CONFIG_LOCKD_V4=y
745CONFIG_NFS_COMMON=y
746CONFIG_SUNRPC=y
747# CONFIG_SUNRPC_BIND34 is not set
748# CONFIG_RPCSEC_GSS_KRB5 is not set
749# CONFIG_RPCSEC_GSS_SPKM3 is not set
673# CONFIG_SMB_FS is not set 750# CONFIG_SMB_FS is not set
674# CONFIG_CIFS is not set 751# CONFIG_CIFS is not set
675# CONFIG_NCP_FS is not set 752# CONFIG_NCP_FS is not set
@@ -681,30 +758,20 @@ CONFIG_RAMFS=y
681# 758#
682# CONFIG_PARTITION_ADVANCED is not set 759# CONFIG_PARTITION_ADVANCED is not set
683CONFIG_MSDOS_PARTITION=y 760CONFIG_MSDOS_PARTITION=y
684
685#
686# Native Language Support
687#
688# CONFIG_NLS is not set 761# CONFIG_NLS is not set
689 762# CONFIG_DLM is not set
690#
691# Distributed Lock Manager
692#
693
694#
695# Profiling support
696#
697CONFIG_PROFILING=y
698# CONFIG_OPROFILE is not set
699 763
700# 764#
701# Kernel hacking 765# Kernel hacking
702# 766#
703CONFIG_TRACE_IRQFLAGS_SUPPORT=y 767CONFIG_TRACE_IRQFLAGS_SUPPORT=y
704# CONFIG_PRINTK_TIME is not set 768# CONFIG_PRINTK_TIME is not set
769CONFIG_ENABLE_WARN_DEPRECATED=y
705# CONFIG_ENABLE_MUST_CHECK is not set 770# CONFIG_ENABLE_MUST_CHECK is not set
771CONFIG_FRAME_WARN=1024
706# CONFIG_MAGIC_SYSRQ is not set 772# CONFIG_MAGIC_SYSRQ is not set
707# CONFIG_UNUSED_SYMBOLS is not set 773# CONFIG_UNUSED_SYMBOLS is not set
774CONFIG_DEBUG_FS=y
708# CONFIG_HEADERS_CHECK is not set 775# CONFIG_HEADERS_CHECK is not set
709CONFIG_DEBUG_KERNEL=y 776CONFIG_DEBUG_KERNEL=y
710# CONFIG_DEBUG_SHIRQ is not set 777# CONFIG_DEBUG_SHIRQ is not set
@@ -712,7 +779,10 @@ CONFIG_DETECT_SOFTLOCKUP=y
712CONFIG_SCHED_DEBUG=y 779CONFIG_SCHED_DEBUG=y
713# CONFIG_SCHEDSTATS is not set 780# CONFIG_SCHEDSTATS is not set
714# CONFIG_TIMER_STATS is not set 781# CONFIG_TIMER_STATS is not set
715CONFIG_SLUB_DEBUG_ON=y 782# CONFIG_DEBUG_OBJECTS is not set
783CONFIG_DEBUG_PREEMPT=y
784# CONFIG_DEBUG_RT_MUTEXES is not set
785# CONFIG_RT_MUTEX_TESTER is not set
716# CONFIG_DEBUG_SPINLOCK is not set 786# CONFIG_DEBUG_SPINLOCK is not set
717# CONFIG_DEBUG_MUTEXES is not set 787# CONFIG_DEBUG_MUTEXES is not set
718# CONFIG_DEBUG_LOCK_ALLOC is not set 788# CONFIG_DEBUG_LOCK_ALLOC is not set
@@ -722,38 +792,123 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y
722# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 792# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
723# CONFIG_DEBUG_KOBJECT is not set 793# CONFIG_DEBUG_KOBJECT is not set
724CONFIG_DEBUG_BUGVERBOSE=y 794CONFIG_DEBUG_BUGVERBOSE=y
725CONFIG_DEBUG_INFO=y 795# CONFIG_DEBUG_INFO is not set
726# CONFIG_DEBUG_VM is not set 796CONFIG_DEBUG_VM=y
727# CONFIG_DEBUG_LIST is not set 797# CONFIG_DEBUG_WRITECOUNT is not set
798CONFIG_DEBUG_LIST=y
799# CONFIG_DEBUG_SG is not set
728CONFIG_FRAME_POINTER=y 800CONFIG_FRAME_POINTER=y
729CONFIG_FORCED_INLINING=y 801# CONFIG_BOOT_PRINTK_DELAY is not set
802# CONFIG_RCU_TORTURE_TEST is not set
803# CONFIG_BACKTRACE_SELF_TEST is not set
730# CONFIG_FAULT_INJECTION is not set 804# CONFIG_FAULT_INJECTION is not set
805# CONFIG_SAMPLES is not set
731# CONFIG_SH_STANDARD_BIOS is not set 806# CONFIG_SH_STANDARD_BIOS is not set
732CONFIG_EARLY_SCIF_CONSOLE=y 807# CONFIG_EARLY_SCIF_CONSOLE is not set
733CONFIG_EARLY_SCIF_CONSOLE_PORT=0xfffe9800
734CONFIG_EARLY_PRINTK=y
735# CONFIG_DEBUG_BOOTMEM is not set 808# CONFIG_DEBUG_BOOTMEM is not set
736CONFIG_DEBUG_STACKOVERFLOW=y 809CONFIG_DEBUG_STACKOVERFLOW=y
737CONFIG_DEBUG_STACK_USAGE=y 810CONFIG_DEBUG_STACK_USAGE=y
738# CONFIG_4KSTACKS is not set 811# CONFIG_IRQSTACKS is not set
739 812
740# 813#
741# Security options 814# Security options
742# 815#
743# CONFIG_KEYS is not set 816# CONFIG_KEYS is not set
744# CONFIG_CRYPTO is not set 817# CONFIG_SECURITY is not set
818# CONFIG_SECURITY_FILE_CAPABILITIES is not set
819CONFIG_CRYPTO=y
820
821#
822# Crypto core or helper
823#
824CONFIG_CRYPTO_ALGAPI=y
825# CONFIG_CRYPTO_MANAGER is not set
826# CONFIG_CRYPTO_GF128MUL is not set
827# CONFIG_CRYPTO_NULL is not set
828# CONFIG_CRYPTO_CRYPTD is not set
829# CONFIG_CRYPTO_AUTHENC is not set
830# CONFIG_CRYPTO_TEST is not set
831
832#
833# Authenticated Encryption with Associated Data
834#
835# CONFIG_CRYPTO_CCM is not set
836# CONFIG_CRYPTO_GCM is not set
837# CONFIG_CRYPTO_SEQIV is not set
838
839#
840# Block modes
841#
842# CONFIG_CRYPTO_CBC is not set
843# CONFIG_CRYPTO_CTR is not set
844# CONFIG_CRYPTO_CTS is not set
845# CONFIG_CRYPTO_ECB is not set
846# CONFIG_CRYPTO_LRW is not set
847# CONFIG_CRYPTO_PCBC is not set
848# CONFIG_CRYPTO_XTS is not set
849
850#
851# Hash modes
852#
853# CONFIG_CRYPTO_HMAC is not set
854# CONFIG_CRYPTO_XCBC is not set
855
856#
857# Digest
858#
859# CONFIG_CRYPTO_CRC32C is not set
860# CONFIG_CRYPTO_MD4 is not set
861# CONFIG_CRYPTO_MD5 is not set
862# CONFIG_CRYPTO_MICHAEL_MIC is not set
863# CONFIG_CRYPTO_SHA1 is not set
864# CONFIG_CRYPTO_SHA256 is not set
865# CONFIG_CRYPTO_SHA512 is not set
866# CONFIG_CRYPTO_TGR192 is not set
867# CONFIG_CRYPTO_WP512 is not set
868
869#
870# Ciphers
871#
872# CONFIG_CRYPTO_AES is not set
873# CONFIG_CRYPTO_ANUBIS is not set
874# CONFIG_CRYPTO_ARC4 is not set
875# CONFIG_CRYPTO_BLOWFISH is not set
876# CONFIG_CRYPTO_CAMELLIA is not set
877# CONFIG_CRYPTO_CAST5 is not set
878# CONFIG_CRYPTO_CAST6 is not set
879# CONFIG_CRYPTO_DES is not set
880# CONFIG_CRYPTO_FCRYPT is not set
881# CONFIG_CRYPTO_KHAZAD is not set
882# CONFIG_CRYPTO_SALSA20 is not set
883# CONFIG_CRYPTO_SEED is not set
884# CONFIG_CRYPTO_SERPENT is not set
885# CONFIG_CRYPTO_TEA is not set
886# CONFIG_CRYPTO_TWOFISH is not set
887
888#
889# Compression
890#
891CONFIG_CRYPTO_DEFLATE=y
892CONFIG_CRYPTO_LZO=y
893# CONFIG_CRYPTO_HW is not set
745 894
746# 895#
747# Library routines 896# Library routines
748# 897#
749CONFIG_BITREVERSE=y 898CONFIG_BITREVERSE=y
750# CONFIG_CRC_CCITT is not set 899# CONFIG_GENERIC_FIND_FIRST_BIT is not set
751# CONFIG_CRC16 is not set 900CONFIG_CRC_CCITT=y
752# CONFIG_CRC_ITU_T is not set 901CONFIG_CRC16=y
902CONFIG_CRC_ITU_T=y
753CONFIG_CRC32=y 903CONFIG_CRC32=y
754# CONFIG_CRC7 is not set 904CONFIG_CRC7=y
755# CONFIG_LIBCRC32C is not set 905CONFIG_LIBCRC32C=y
906CONFIG_AUDIT_GENERIC=y
756CONFIG_ZLIB_INFLATE=y 907CONFIG_ZLIB_INFLATE=y
908CONFIG_ZLIB_DEFLATE=y
909CONFIG_LZO_COMPRESS=y
910CONFIG_LZO_DECOMPRESS=y
911CONFIG_PLIST=y
757CONFIG_HAS_IOMEM=y 912CONFIG_HAS_IOMEM=y
758CONFIG_HAS_IOPORT=y 913CONFIG_HAS_IOPORT=y
759CONFIG_HAS_DMA=y 914CONFIG_HAS_DMA=y
diff --git a/arch/sh/drivers/heartbeat.c b/arch/sh/drivers/heartbeat.c
index ab77b0e0fa0e..938817e34e2b 100644
--- a/arch/sh/drivers/heartbeat.c
+++ b/arch/sh/drivers/heartbeat.c
@@ -154,4 +154,4 @@ module_exit(heartbeat_exit);
154 154
155MODULE_VERSION(DRV_VERSION); 155MODULE_VERSION(DRV_VERSION);
156MODULE_AUTHOR("Paul Mundt"); 156MODULE_AUTHOR("Paul Mundt");
157MODULE_LICENSE("GPLv2"); 157MODULE_LICENSE("GPL v2");
diff --git a/arch/sh/kernel/cpu/irq/intc-sh5.c b/arch/sh/kernel/cpu/irq/intc-sh5.c
index de45c6a3e33b..79baa47af977 100644
--- a/arch/sh/kernel/cpu/irq/intc-sh5.c
+++ b/arch/sh/kernel/cpu/irq/intc-sh5.c
@@ -242,6 +242,7 @@ void __init plat_irq_setup(void)
242 reg += 8; 242 reg += 8;
243 } 243 }
244 } 244 }
245 }
245#endif 246#endif
246 247
247 /* 248 /*
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index ebceb0dadff5..be4926969181 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -132,6 +132,7 @@ int __init detect_cpu_and_cache_system(void)
132 132
133 switch (prr) { 133 switch (prr) {
134 case 0x50: 134 case 0x50:
135 case 0x51:
135 boot_cpu_data.type = CPU_SH7723; 136 boot_cpu_data.type = CPU_SH7723;
136 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_L2_CACHE; 137 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_L2_CACHE;
137 break; 138 break;
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index 805535aa505e..27fa81bef6a0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -26,7 +26,7 @@ static int pfc_divisors[] = { 1, 1, 1, 1, 1, 1, 1, 18,
26 26
27static void master_clk_init(struct clk *clk) 27static void master_clk_init(struct clk *clk)
28{ 28{
29 clk->rate *= 36; 29 clk->rate *= pfc_divisors[ctrl_inl(FRQMR1) & 0x000f];
30} 30}
31 31
32static struct clk_ops sh7785_master_clk_ops = { 32static struct clk_ops sh7785_master_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 069314037049..62ebccf18b3c 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -16,7 +16,7 @@
16 16
17static struct resource usbf_resources[] = { 17static struct resource usbf_resources[] = {
18 [0] = { 18 [0] = {
19 .name = "USBF", 19 .name = "m66592_udc",
20 .start = 0x04480000, 20 .start = 0x04480000,
21 .end = 0x044800FF, 21 .end = 0x044800FF,
22 .flags = IORESOURCE_MEM, 22 .flags = IORESOURCE_MEM,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 16925cf28db8..a0470f2f5479 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -16,6 +16,21 @@
16 16
17static struct plat_sci_port sci_platform_data[] = { 17static struct plat_sci_port sci_platform_data[] = {
18 { 18 {
19 .mapbase = 0xffe00000,
20 .flags = UPF_BOOT_AUTOCONF,
21 .type = PORT_SCIF,
22 .irqs = { 80, 80, 80, 80 },
23 },{
24 .mapbase = 0xffe10000,
25 .flags = UPF_BOOT_AUTOCONF,
26 .type = PORT_SCIF,
27 .irqs = { 81, 81, 81, 81 },
28 },{
29 .mapbase = 0xffe20000,
30 .flags = UPF_BOOT_AUTOCONF,
31 .type = PORT_SCIF,
32 .irqs = { 82, 82, 82, 82 },
33 },{
19 .mapbase = 0xa4e30000, 34 .mapbase = 0xa4e30000,
20 .flags = UPF_BOOT_AUTOCONF, 35 .flags = UPF_BOOT_AUTOCONF,
21 .type = PORT_SCI, 36 .type = PORT_SCI,
@@ -73,9 +88,35 @@ static struct platform_device rtc_device = {
73 .resource = rtc_resources, 88 .resource = rtc_resources,
74}; 89};
75 90
91static struct resource sh7723_usb_host_resources[] = {
92 [0] = {
93 .name = "r8a66597_hcd",
94 .start = 0xa4d80000,
95 .end = 0xa4d800ff,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = 65,
100 .end = 65,
101 .flags = IORESOURCE_IRQ,
102 },
103};
104
105static struct platform_device sh7723_usb_host_device = {
106 .name = "r8a66597_hcd",
107 .id = 0,
108 .dev = {
109 .dma_mask = NULL, /* not use dma */
110 .coherent_dma_mask = 0xffffffff,
111 },
112 .num_resources = ARRAY_SIZE(sh7723_usb_host_resources),
113 .resource = sh7723_usb_host_resources,
114};
115
76static struct platform_device *sh7723_devices[] __initdata = { 116static struct platform_device *sh7723_devices[] __initdata = {
77 &sci_device, 117 &sci_device,
78 &rtc_device, 118 &rtc_device,
119 &sh7723_usb_host_device,
79}; 120};
80 121
81static int __init sh7723_devices_setup(void) 122static int __init sh7723_devices_setup(void)
@@ -153,7 +194,7 @@ static struct intc_vect vectors[] __initdata = {
153 INTC_VECT(VIO_VOUI,0x8E0), 194 INTC_VECT(VIO_VOUI,0x8E0),
154 195
155 INTC_VECT(SCIFA_SCIFA0,0x900), 196 INTC_VECT(SCIFA_SCIFA0,0x900),
156 INTC_VECT(VPU_VPUI,0x920), 197 INTC_VECT(VPU_VPUI,0x980),
157 INTC_VECT(TPU_TPUI,0x9A0), 198 INTC_VECT(TPU_TPUI,0x9A0),
158 INTC_VECT(ADC_ADI,0x9E0), 199 INTC_VECT(ADC_ADI,0x9E0),
159 INTC_VECT(USB_USI0,0xA20), 200 INTC_VECT(USB_USI0,0xA20),
@@ -292,9 +333,3 @@ void __init plat_irq_setup(void)
292{ 333{
293 register_intc_controller(&intc_desc); 334 register_intc_controller(&intc_desc);
294} 335}
295
296void __init plat_mem_setup(void)
297{
298 /* Register the URAM space as Node 1 */
299 setup_bootmem_node(1, 0x055f0000, 0x05610000);
300}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index ae2b22219f02..f189a559462b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -291,8 +291,9 @@ static struct intc_sense_reg irq_sense_registers[] __initdata = {
291}; 291};
292 292
293static DECLARE_INTC_DESC(intc_irq_desc, "sh7763-irq", irq_vectors, 293static DECLARE_INTC_DESC(intc_irq_desc, "sh7763-irq", irq_vectors,
294 NULL, NULL, irq_mask_registers, irq_prio_registers, 294 NULL, irq_mask_registers, irq_prio_registers,
295 irq_sense_registers); 295 irq_sense_registers);
296
296 297
297/* External interrupt pins in IRL mode */ 298/* External interrupt pins in IRL mode */
298static struct intc_vect irl_vectors[] __initdata = { 299static struct intc_vect irl_vectors[] __initdata = {
@@ -324,10 +325,10 @@ static struct intc_mask_reg irl7654_mask_registers[] __initdata = {
324}; 325};
325 326
326static DECLARE_INTC_DESC(intc_irl7654_desc, "sh7763-irl7654", irl_vectors, 327static DECLARE_INTC_DESC(intc_irl7654_desc, "sh7763-irl7654", irl_vectors,
327 NULL, NULL, irl7654_mask_registers, NULL, NULL); 328 NULL, irl7654_mask_registers, NULL, NULL);
328 329
329static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7763-irl3210", irl_vectors, 330static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7763-irl3210", irl_vectors,
330 NULL, NULL, irl3210_mask_registers, NULL, NULL); 331 NULL, irl3210_mask_registers, NULL, NULL);
331 332
332#define INTC_ICR0 0xffd00000 333#define INTC_ICR0 0xffd00000
333#define INTC_INTMSK0 0xffd00044 334#define INTC_INTMSK0 0xffd00044
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 926b2e7b11c1..718bd2356b34 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -1,9 +1,6 @@
1/* $Id: entry.S,v 1.37 2004/06/11 13:02:46 doyu Exp $ 1/*
2 *
3 * linux/arch/sh/entry.S
4 *
5 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 2 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
6 * Copyright (C) 2003 Paul Mundt 3 * Copyright (C) 2003 - 2008 Paul Mundt
7 * 4 *
8 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
@@ -262,6 +259,7 @@ __restore_all:
262 259
263 .align 2 260 .align 2
264syscall_badsys: ! Bad syscall number 261syscall_badsys: ! Bad syscall number
262 get_current_thread_info r8, r0
265 mov #-ENOSYS, r0 263 mov #-ENOSYS, r0
266 bra resume_userspace 264 bra resume_userspace
267 mov.l r0, @(OFF_R0,r15) ! Return value 265 mov.l r0, @(OFF_R0,r15) ! Return value
@@ -281,7 +279,9 @@ debug_trap:
281 mov.l 1f, r8 279 mov.l 1f, r8
282 add r0, r8 280 add r0, r8
283 mov.l @r8, r8 281 mov.l @r8, r8
284 jmp @r8 282 jsr @r8
283 nop
284 bra __restore_all
285 nop 285 nop
286 286
287 .align 2 287 .align 2
diff --git a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S
index d67d7ed09f22..ae0a382a82eb 100644
--- a/arch/sh/kernel/head_32.S
+++ b/arch/sh/kernel/head_32.S
@@ -30,8 +30,8 @@ ENTRY(empty_zero_page)
30 .long 0 /* RAMDISK_FLAGS */ 30 .long 0 /* RAMDISK_FLAGS */
31 .long 0x0200 /* ORIG_ROOT_DEV */ 31 .long 0x0200 /* ORIG_ROOT_DEV */
32 .long 1 /* LOADER_TYPE */ 32 .long 1 /* LOADER_TYPE */
33 .long 0x00360000 /* INITRD_START */ 33 .long 0x00000000 /* INITRD_START */
34 .long 0x000a0000 /* INITRD_SIZE */ 34 .long 0x00000000 /* INITRD_SIZE */
35#ifdef CONFIG_32BIT 35#ifdef CONFIG_32BIT
36 .long 0x53453f00 + 32 /* "SE?" = 32 bit */ 36 .long 0x53453f00 + 32 /* "SE?" = 32 bit */
37#else 37#else
diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c
index f9bcc606127e..b151a25cb14d 100644
--- a/arch/sh/kernel/init_task.c
+++ b/arch/sh/kernel/init_task.c
@@ -8,7 +8,6 @@
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9 9
10static struct fs_struct init_fs = INIT_FS; 10static struct fs_struct init_fs = INIT_FS;
11static struct files_struct init_files = INIT_FILES;
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14struct pt_regs fake_swapper_regs; 13struct pt_regs fake_swapper_regs;
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index d453c3a1c79f..bf8ac4c71640 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -274,8 +274,7 @@ static char *mem_to_hex(const char *mem, char *buf, const int count)
274 } 274 }
275 for (i = 0; i < count; i++) { 275 for (i = 0; i < count; i++) {
276 ch = *mem++; 276 ch = *mem++;
277 *buf++ = highhex(ch); 277 buf = pack_hex_byte(buf, ch);
278 *buf++ = lowhex(ch);
279 } 278 }
280 *buf = 0; 279 *buf = 0;
281 return (buf); 280 return (buf);
@@ -330,14 +329,6 @@ static char *ebin_to_mem(const char *buf, char *mem, int count)
330 return mem; 329 return mem;
331} 330}
332 331
333/* Pack a hex byte */
334static char *pack_hex_byte(char *pkt, int byte)
335{
336 *pkt++ = hexchars[(byte >> 4) & 0xf];
337 *pkt++ = hexchars[(byte & 0xf)];
338 return pkt;
339}
340
341/* Scan for the start char '$', read the packet and check the checksum */ 332/* Scan for the start char '$', read the packet and check the checksum */
342static void get_packet(char *buffer, int buflen) 333static void get_packet(char *buffer, int buflen)
343{ 334{
@@ -435,8 +426,8 @@ static void put_packet(char *buffer)
435 426
436 /* '#' Separator, put high and low components of checksum */ 427 /* '#' Separator, put high and low components of checksum */
437 put_debug_char('#'); 428 put_debug_char('#');
438 put_debug_char(highhex(checksum)); 429 put_debug_char(hex_asc_hi(checksum));
439 put_debug_char(lowhex(checksum)); 430 put_debug_char(hex_asc_lo(checksum));
440 } 431 }
441 while ((get_debug_char()) != '+'); /* While no ack */ 432 while ((get_debug_char()) != '+'); /* While no ack */
442} 433}
@@ -658,8 +649,8 @@ static void undo_single_step(void)
658static void send_signal_msg(const int signum) 649static void send_signal_msg(const int signum)
659{ 650{
660 out_buffer[0] = 'S'; 651 out_buffer[0] = 'S';
661 out_buffer[1] = highhex(signum); 652 out_buffer[1] = hex_asc_hi(signum);
662 out_buffer[2] = lowhex(signum); 653 out_buffer[2] = hex_asc_lo(signum);
663 out_buffer[3] = 0; 654 out_buffer[3] = 0;
664 put_packet(out_buffer); 655 put_packet(out_buffer);
665} 656}
diff --git a/arch/sh/kernel/module.c b/arch/sh/kernel/module.c
index b3d0a03b4c76..5482e65375a9 100644
--- a/arch/sh/kernel/module.c
+++ b/arch/sh/kernel/module.c
@@ -30,6 +30,7 @@
30#include <linux/fs.h> 30#include <linux/fs.h>
31#include <linux/string.h> 31#include <linux/string.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <asm/unaligned.h>
33 34
34void *module_alloc(unsigned long size) 35void *module_alloc(unsigned long size)
35{ 36{
@@ -56,34 +57,6 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
56 return 0; 57 return 0;
57} 58}
58 59
59#ifdef CONFIG_SUPERH32
60#define COPY_UNALIGNED_WORD(sw, tw, align) \
61{ \
62 void *__s = &(sw), *__t = &(tw); \
63 unsigned short *__s2 = __s, *__t2 = __t; \
64 unsigned char *__s1 = __s, *__t1 = __t; \
65 switch ((align)) \
66 { \
67 case 0: \
68 *(unsigned long *) __t = *(unsigned long *) __s; \
69 break; \
70 case 2: \
71 *__t2++ = *__s2++; \
72 *__t2 = *__s2; \
73 break; \
74 default: \
75 *__t1++ = *__s1++; \
76 *__t1++ = *__s1++; \
77 *__t1++ = *__s1++; \
78 *__t1 = *__s1; \
79 break; \
80 } \
81}
82#else
83/* One thing SHmedia doesn't screw up! */
84#define COPY_UNALIGNED_WORD(sw, tw, align) { (tw) = (sw); }
85#endif
86
87int apply_relocate_add(Elf32_Shdr *sechdrs, 60int apply_relocate_add(Elf32_Shdr *sechdrs,
88 const char *strtab, 61 const char *strtab,
89 unsigned int symindex, 62 unsigned int symindex,
@@ -96,7 +69,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
96 Elf32_Addr relocation; 69 Elf32_Addr relocation;
97 uint32_t *location; 70 uint32_t *location;
98 uint32_t value; 71 uint32_t value;
99 int align;
100 72
101 pr_debug("Applying relocate section %u to %u\n", relsec, 73 pr_debug("Applying relocate section %u to %u\n", relsec,
102 sechdrs[relsec].sh_info); 74 sechdrs[relsec].sh_info);
@@ -109,7 +81,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
109 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr 81 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
110 + ELF32_R_SYM(rel[i].r_info); 82 + ELF32_R_SYM(rel[i].r_info);
111 relocation = sym->st_value + rel[i].r_addend; 83 relocation = sym->st_value + rel[i].r_addend;
112 align = (int)location & 3;
113 84
114#ifdef CONFIG_SUPERH64 85#ifdef CONFIG_SUPERH64
115 /* For text addresses, bit2 of the st_other field indicates 86 /* For text addresses, bit2 of the st_other field indicates
@@ -122,15 +93,15 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
122 93
123 switch (ELF32_R_TYPE(rel[i].r_info)) { 94 switch (ELF32_R_TYPE(rel[i].r_info)) {
124 case R_SH_DIR32: 95 case R_SH_DIR32:
125 COPY_UNALIGNED_WORD (*location, value, align); 96 value = get_unaligned(location);
126 value += relocation; 97 value += relocation;
127 COPY_UNALIGNED_WORD (value, *location, align); 98 put_unaligned(value, location);
128 break; 99 break;
129 case R_SH_REL32: 100 case R_SH_REL32:
130 relocation = (relocation - (Elf32_Addr) location); 101 relocation = (relocation - (Elf32_Addr) location);
131 COPY_UNALIGNED_WORD (*location, value, align); 102 value = get_unaligned(location);
132 value += relocation; 103 value += relocation;
133 COPY_UNALIGNED_WORD (value, *location, align); 104 put_unaligned(value, location);
134 break; 105 break;
135 case R_SH_IMM_LOW16: 106 case R_SH_IMM_LOW16:
136 *location = (*location & ~0x3fffc00) | 107 *location = (*location & ~0x3fffc00) |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 516bde9c50fa..bca2bbc575db 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -292,6 +292,17 @@ void __init setup_arch(char **cmdline_p)
292 292
293 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 293 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
294 294
295 printk(KERN_NOTICE "Boot params:\n"
296 "... MOUNT_ROOT_RDONLY - %08lx\n"
297 "... RAMDISK_FLAGS - %08lx\n"
298 "... ORIG_ROOT_DEV - %08lx\n"
299 "... LOADER_TYPE - %08lx\n"
300 "... INITRD_START - %08lx\n"
301 "... INITRD_SIZE - %08lx\n",
302 MOUNT_ROOT_RDONLY, RAMDISK_FLAGS,
303 ORIG_ROOT_DEV, LOADER_TYPE,
304 INITRD_START, INITRD_SIZE);
305
295#ifdef CONFIG_BLK_DEV_RAM 306#ifdef CONFIG_BLK_DEV_RAM
296 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 307 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
297 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 308 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index a3bdc68ef02c..438f1ebcc453 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -4,6 +4,7 @@
4#include <linux/kdebug.h> 4#include <linux/kdebug.h>
5#include <linux/signal.h> 5#include <linux/signal.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/uaccess.h>
7#include <asm/system.h> 8#include <asm/system.h>
8 9
9#ifdef CONFIG_BUG 10#ifdef CONFIG_BUG
@@ -21,7 +22,14 @@ static void handle_BUG(struct pt_regs *regs)
21 22
22int is_valid_bugaddr(unsigned long addr) 23int is_valid_bugaddr(unsigned long addr)
23{ 24{
24 return addr >= PAGE_OFFSET; 25 unsigned short opcode;
26
27 if (addr < PAGE_OFFSET)
28 return 0;
29 if (probe_kernel_address((u16 *)addr, opcode))
30 return 0;
31
32 return opcode == TRAPA_BUG_OPCODE;
25} 33}
26#endif 34#endif
27 35
diff --git a/arch/sh/lib/memcpy-sh4.S b/arch/sh/lib/memcpy-sh4.S
index 560bc17eebdd..459fa92a7c53 100644
--- a/arch/sh/lib/memcpy-sh4.S
+++ b/arch/sh/lib/memcpy-sh4.S
@@ -126,10 +126,10 @@
126 126
127 mov.l r3,@-r0 ! 30 LS 127 mov.l r3,@-r0 ! 30 LS
128#else 128#else
1293: mov r1,r3 ! OPQR 1293: mov r7,r3 ! OPQR
130 shlr8 r3 ! xOPQ 130 shlr8 r3 ! xOPQ
131 mov.l @(r0,r5),r1 ! KLMN 131 mov.l @(r0,r5),r7 ! KLMN
132 mov r1,r6 132 mov r7,r6
133 shll16 r6 133 shll16 r6
134 shll8 r6 ! Nxxx 134 shll8 r6 ! Nxxx
135 or r6,r3 ! NOPQ 135 or r6,r3 ! NOPQ
@@ -733,24 +733,24 @@ ENTRY(memcpy)
733 movca.l r0,@r1 ! 40 LS (latency=3-7) 733 movca.l r0,@r1 ! 40 LS (latency=3-7)
734 add #-0x1c, r1 ! 50 EX 734 add #-0x1c, r1 ! 50 EX
735 735
736 mov.l r3, @(0x1c,r1) ! 33 LS 736 mov.l r3, @(0x18,r1) ! 33 LS
737 xtrct r11, r10 ! 48 EX 737 xtrct r11, r10 ! 48 EX
738 738
739 mov.l r6, @(0x18,r1) ! 33 LS 739 mov.l r6, @(0x14,r1) ! 33 LS
740 xtrct r12, r11 ! 48 EX 740 xtrct r12, r11 ! 48 EX
741 741
742 mov.l r7, @(0x14,r1) ! 33 LS 742 mov.l r7, @(0x10,r1) ! 33 LS
743 743
744 mov.l r8, @(0x10,r1) ! 33 LS 744 mov.l r8, @(0x0c,r1) ! 33 LS
745 add #-0x3e, r5 ! 50 EX 745 add #-0x1e, r5 ! 50 EX
746 746
747 mov.l r9, @(0x0c,r1) ! 33 LS 747 mov.l r9, @(0x08,r1) ! 33 LS
748 cmp/eq r2,r1 ! 54 MT 748 cmp/eq r2,r1 ! 54 MT
749 749
750 mov.l r10, @(0x08,r1) ! 33 LS 750 mov.l r10, @(0x04,r1) ! 33 LS
751 bf/s 2b ! 109 BR 751 bf/s 2b ! 109 BR
752 752
753 mov.l r11, @(0x04,r1) ! 33 LS 753 mov.l r11, @(0x00,r1) ! 33 LS
754#endif 754#endif
755 755
756 mov.l @r15+, r12 756 mov.l @r15+, r12
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index d211fdb24584..789724e61e83 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -1,4 +1,3 @@
1# $Id: config.in,v 1.113 2002/01/24 22:14:44 davem Exp $
2# For a description of the syntax of this configuration file, 1# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt. 2# see Documentation/kbuild/kconfig-language.txt.
4# 3#
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index b365084316ac..22d331e1e941 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.10 2000/02/23 08:17:46 jj Exp $
2# Makefile for the Sparc boot stuff. 1# Makefile for the Sparc boot stuff.
3# 2#
4# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/boot/btfixupprep.c b/arch/sparc/boot/btfixupprep.c
index dc7b0546e3bb..52a4208fe4f0 100644
--- a/arch/sparc/boot/btfixupprep.c
+++ b/arch/sparc/boot/btfixupprep.c
@@ -1,4 +1,4 @@
1/* $Id: btfixupprep.c,v 1.6 2001/08/22 15:27:47 davem Exp $ 1/*
2 Simple utility to prepare vmlinux image for sparc. 2 Simple utility to prepare vmlinux image for sparc.
3 Resolves all BTFIXUP uses and settings and creates 3 Resolves all BTFIXUP uses and settings and creates
4 a special .s object to link to the image. 4 a special .s object to link to the image.
diff --git a/arch/sparc/boot/piggyback.c b/arch/sparc/boot/piggyback.c
index 6962cc68ed5b..c9f500c1a8b2 100644
--- a/arch/sparc/boot/piggyback.c
+++ b/arch/sparc/boot/piggyback.c
@@ -1,4 +1,4 @@
1/* $Id: piggyback.c,v 1.4 2000/12/05 00:48:57 anton Exp $ 1/*
2 Simple utility to make a single-image install kernel with initial ramdisk 2 Simple utility to make a single-image install kernel with initial ramdisk
3 for Sparc tftpbooting without need to set up nfs. 3 for Sparc tftpbooting without need to set up nfs.
4 4
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 96344ff2bbe1..92c6fc07e59c 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -1,4 +1,4 @@
1/* $Id: ebus.c,v 1.20 2002/01/05 01:13:43 davem Exp $ 1/*
2 * ebus.c: PCI to EBus bridge device. 2 * ebus.c: PCI to EBus bridge device.
3 * 3 *
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/arch/sparc/kernel/etrap.S b/arch/sparc/kernel/etrap.S
index a8b35bed12a2..f37d961d67a6 100644
--- a/arch/sparc/kernel/etrap.S
+++ b/arch/sparc/kernel/etrap.S
@@ -1,4 +1,4 @@
1/* $Id: etrap.S,v 1.31 2000/01/08 16:38:18 anton Exp $ 1/*
2 * etrap.S: Sparc trap window preparation for entry into the 2 * etrap.S: Sparc trap window preparation for entry into the
3 * Linux kernel. 3 * Linux kernel.
4 * 4 *
diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S
index 8bec05fa5795..3bfd6085a91d 100644
--- a/arch/sparc/kernel/head.S
+++ b/arch/sparc/kernel/head.S
@@ -1,4 +1,4 @@
1/* $Id: head.S,v 1.105 2001/08/12 09:08:56 davem Exp $ 1/*
2 * head.S: The initial boot code for the Sparc port of Linux. 2 * head.S: The initial boot code for the Sparc port of Linux.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/idprom.c b/arch/sparc/kernel/idprom.c
index 3a5bad525394..7220562cdb34 100644
--- a/arch/sparc/kernel/idprom.c
+++ b/arch/sparc/kernel/idprom.c
@@ -1,4 +1,4 @@
1/* $Id: idprom.c,v 1.24 1999/08/31 06:54:20 davem Exp $ 1/*
2 * idprom.c: Routines to load the idprom into kernel addresses and 2 * idprom.c: Routines to load the idprom into kernel addresses and
3 * interpret the data contained within. 3 * interpret the data contained within.
4 * 4 *
diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
index d9d4f96360c7..8e64ebc445ef 100644
--- a/arch/sparc/kernel/init_task.c
+++ b/arch/sparc/kernel/init_task.c
@@ -9,7 +9,6 @@
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10 10
11static struct fs_struct init_fs = INIT_FS; 11static struct fs_struct init_fs = INIT_FS;
12static struct files_struct init_files = INIT_FILES;
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 12static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index ad0ede24ca1d..7b17522f59bf 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -1,4 +1,4 @@
1/* $Id: ioport.c,v 1.45 2001/10/30 04:54:21 davem Exp $ 1/*
2 * ioport.c: Simple io mapping allocator. 2 * ioport.c: Simple io mapping allocator.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index 01a6756ba371..087390b092b0 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -1,4 +1,4 @@
1/* $Id: irq.c,v 1.114 2001/12/11 04:55:51 davem Exp $ 1/*
2 * arch/sparc/kernel/irq.c: Interrupt request handling routines. On the 2 * arch/sparc/kernel/irq.c: Interrupt request handling routines. On the
3 * Sparc the IRQs are basically 'cast in stone' 3 * Sparc the IRQs are basically 'cast in stone'
4 * and you are supposed to probe the prom's device 4 * and you are supposed to probe the prom's device
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c
index 59e9344e7a0d..adaaed4ea2fb 100644
--- a/arch/sparc/kernel/led.c
+++ b/arch/sparc/kernel/led.c
@@ -2,6 +2,7 @@
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <linux/seq_file.h>
5#include <linux/string.h> 6#include <linux/string.h>
6#include <linux/jiffies.h> 7#include <linux/jiffies.h>
7#include <linux/timer.h> 8#include <linux/timer.h>
@@ -45,21 +46,22 @@ static void led_blink(unsigned long timeout)
45 add_timer(&led_blink_timer); 46 add_timer(&led_blink_timer);
46} 47}
47 48
48static int led_read_proc(char *buf, char **start, off_t offset, int count, 49static int led_proc_show(struct seq_file *m, void *v)
49 int *eof, void *data)
50{ 50{
51 int len = 0;
52
53 if (get_auxio() & AUXIO_LED) 51 if (get_auxio() & AUXIO_LED)
54 len = sprintf(buf, "on\n"); 52 seq_puts(m, "on\n");
55 else 53 else
56 len = sprintf(buf, "off\n"); 54 seq_puts(m, "off\n");
55 return 0;
56}
57 57
58 return len; 58static int led_proc_open(struct inode *inode, struct file *file)
59{
60 return single_open(file, led_proc_show, NULL);
59} 61}
60 62
61static int led_write_proc(struct file *file, const char __user *buffer, 63static ssize_t led_proc_write(struct file *file, const char __user *buffer,
62 unsigned long count, void *data) 64 size_t count, loff_t *ppos)
63{ 65{
64 char *buf = NULL; 66 char *buf = NULL;
65 67
@@ -103,6 +105,15 @@ static int led_write_proc(struct file *file, const char __user *buffer,
103 return count; 105 return count;
104} 106}
105 107
108static const struct file_operations led_proc_fops = {
109 .owner = THIS_MODULE,
110 .open = led_proc_open,
111 .read = seq_read,
112 .llseek = seq_lseek,
113 .release = single_release,
114 .write = led_proc_write,
115};
116
106static struct proc_dir_entry *led; 117static struct proc_dir_entry *led;
107 118
108#define LED_VERSION "0.1" 119#define LED_VERSION "0.1"
@@ -112,12 +123,9 @@ static int __init led_init(void)
112 init_timer(&led_blink_timer); 123 init_timer(&led_blink_timer);
113 led_blink_timer.function = led_blink; 124 led_blink_timer.function = led_blink;
114 125
115 led = create_proc_entry("led", 0, NULL); 126 led = proc_create("led", 0, NULL, &led_proc_fops);
116 if (!led) 127 if (!led)
117 return -ENOMEM; 128 return -ENOMEM;
118
119 led->read_proc = led_read_proc; /* reader function */
120 led->write_proc = led_write_proc; /* writer function */
121 led->owner = THIS_MODULE; 129 led->owner = THIS_MODULE;
122 130
123 printk(KERN_INFO 131 printk(KERN_INFO
diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
index 37b9a4942232..e352239e72c8 100644
--- a/arch/sparc/kernel/muldiv.c
+++ b/arch/sparc/kernel/muldiv.c
@@ -1,4 +1,4 @@
1/* $Id: muldiv.c,v 1.5 1997/12/15 20:07:20 ecd Exp $ 1/*
2 * muldiv.c: Hardware multiply/division illegal instruction trap 2 * muldiv.c: Hardware multiply/division illegal instruction trap
3 * for sun4c/sun4 (which do not have those instructions) 3 * for sun4c/sun4 (which do not have those instructions)
4 * 4 *
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S
index b27b5b56f77a..ce30082ab266 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap.S
@@ -1,4 +1,4 @@
1/* $Id: rtrap.S,v 1.58 2002/01/31 03:30:05 davem Exp $ 1/*
2 * rtrap.S: Return from Sparc trap low-level code. 2 * rtrap.S: Return from Sparc trap low-level code.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -139,7 +139,7 @@ ret_trap_userwins_ok:
139 LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc) 139 LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc)
140 or %t_pc, %t_npc, %g2 140 or %t_pc, %t_npc, %g2
141 andcc %g2, 0x3, %g0 141 andcc %g2, 0x3, %g0
142 sethi %hi(PSR_SYCALL), %g2 142 sethi %hi(PSR_SYSCALL), %g2
143 be 1f 143 be 1f
144 andn %t_psr, %g2, %t_psr 144 andn %t_psr, %g2, %t_psr
145 145
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 8a55c4f0df84..a0ea0bc6f471 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -1,4 +1,4 @@
1/* $Id: setup.c,v 1.126 2001/11/13 00:49:27 davem Exp $ 1/*
2 * linux/arch/sparc/kernel/setup.c 2 * linux/arch/sparc/kernel/setup.c
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index aa8ee06cf488..b23cea5ca5d1 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -1,4 +1,4 @@
1/* $Id: sparc_ksyms.c,v 1.107 2001/07/17 16:17:33 anton Exp $ 1/*
2 * arch/sparc/kernel/ksyms.c: Sparc specific ksyms support. 2 * arch/sparc/kernel/ksyms.c: Sparc specific ksyms support.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index e0efab2a6bef..8ac5661cafff 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -1,4 +1,4 @@
1/* $Id: sun4d_irq.c,v 1.29 2001/12/11 04:55:51 davem Exp $ 1/*
2 * arch/sparc/kernel/sun4d_irq.c: 2 * arch/sparc/kernel/sun4d_irq.c:
3 * SS1000/SC2000 interrupt handling. 3 * SS1000/SC2000 interrupt handling.
4 * 4 *
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index e995491c4436..3c6b49a53ae8 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -219,7 +219,7 @@ out:
219 return err; 219 return err;
220} 220}
221 221
222int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) 222int sparc_mmap_check(unsigned long addr, unsigned long len)
223{ 223{
224 if (ARCH_SUN4C_SUN4 && 224 if (ARCH_SUN4C_SUN4 &&
225 (len > 0x20000000 || 225 (len > 0x20000000 ||
@@ -295,52 +295,14 @@ asmlinkage unsigned long sparc_mremap(unsigned long addr,
295 unsigned long old_len, unsigned long new_len, 295 unsigned long old_len, unsigned long new_len,
296 unsigned long flags, unsigned long new_addr) 296 unsigned long flags, unsigned long new_addr)
297{ 297{
298 struct vm_area_struct *vma;
299 unsigned long ret = -EINVAL; 298 unsigned long ret = -EINVAL;
300 if (ARCH_SUN4C_SUN4) { 299
301 if (old_len > 0x20000000 || new_len > 0x20000000) 300 if (unlikely(sparc_mmap_check(addr, old_len)))
302 goto out; 301 goto out;
303 if (addr < 0xe0000000 && addr + old_len > 0x20000000) 302 if (unlikely(sparc_mmap_check(new_addr, new_len)))
304 goto out;
305 }
306 if (old_len > TASK_SIZE - PAGE_SIZE ||
307 new_len > TASK_SIZE - PAGE_SIZE)
308 goto out; 303 goto out;
309 down_write(&current->mm->mmap_sem); 304 down_write(&current->mm->mmap_sem);
310 if (flags & MREMAP_FIXED) {
311 if (ARCH_SUN4C_SUN4 &&
312 new_addr < 0xe0000000 &&
313 new_addr + new_len > 0x20000000)
314 goto out_sem;
315 if (new_addr + new_len > TASK_SIZE - PAGE_SIZE)
316 goto out_sem;
317 } else if ((ARCH_SUN4C_SUN4 && addr < 0xe0000000 &&
318 addr + new_len > 0x20000000) ||
319 addr + new_len > TASK_SIZE - PAGE_SIZE) {
320 unsigned long map_flags = 0;
321 struct file *file = NULL;
322
323 ret = -ENOMEM;
324 if (!(flags & MREMAP_MAYMOVE))
325 goto out_sem;
326
327 vma = find_vma(current->mm, addr);
328 if (vma) {
329 if (vma->vm_flags & VM_SHARED)
330 map_flags |= MAP_SHARED;
331 file = vma->vm_file;
332 }
333
334 new_addr = get_unmapped_area(file, addr, new_len,
335 vma ? vma->vm_pgoff : 0,
336 map_flags);
337 ret = new_addr;
338 if (new_addr & ~PAGE_MASK)
339 goto out_sem;
340 flags |= MREMAP_FIXED;
341 }
342 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 305 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
343out_sem:
344 up_write(&current->mm->mmap_sem); 306 up_write(&current->mm->mmap_sem);
345out: 307out:
346 return ret; 308 return ret;
diff --git a/arch/sparc/kernel/trampoline.S b/arch/sparc/kernel/trampoline.S
index 2dcdaa1fd8cd..356c56aebc62 100644
--- a/arch/sparc/kernel/trampoline.S
+++ b/arch/sparc/kernel/trampoline.S
@@ -1,4 +1,4 @@
1/* $Id: trampoline.S,v 1.14 2002/01/11 08:45:38 davem Exp $ 1/*
2 * trampoline.S: SMP cpu boot-up trampoline code. 2 * trampoline.S: SMP cpu boot-up trampoline code.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index d404e7994527..978e9d85949e 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -1,4 +1,4 @@
1/* $Id: traps.c,v 1.64 2000/09/03 15:00:49 anton Exp $ 1/*
2 * arch/sparc/kernel/traps.c 2 * arch/sparc/kernel/traps.c
3 * 3 *
4 * Copyright 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned.c
index 33857be16661..c2a28c5ad650 100644
--- a/arch/sparc/kernel/unaligned.c
+++ b/arch/sparc/kernel/unaligned.c
@@ -1,4 +1,4 @@
1/* $Id: unaligned.c,v 1.23 2001/12/21 00:54:31 davem Exp $ 1/*
2 * unaligned.c: Unaligned load/store trap handling with special 2 * unaligned.c: Unaligned load/store trap handling with special
3 * cases for the kernel to do them more quickly. 3 * cases for the kernel to do them more quickly.
4 * 4 *
diff --git a/arch/sparc/kernel/wof.S b/arch/sparc/kernel/wof.S
index 083b1215d515..4bce38dfe3c5 100644
--- a/arch/sparc/kernel/wof.S
+++ b/arch/sparc/kernel/wof.S
@@ -1,4 +1,4 @@
1/* $Id: wof.S,v 1.40 2000/01/08 16:38:18 anton Exp $ 1/*
2 * wof.S: Sparc window overflow handler. 2 * wof.S: Sparc window overflow handler.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/kernel/wuf.S b/arch/sparc/kernel/wuf.S
index d1a266bf103a..82e5145b0f77 100644
--- a/arch/sparc/kernel/wuf.S
+++ b/arch/sparc/kernel/wuf.S
@@ -1,4 +1,4 @@
1/* $Id: wuf.S,v 1.39 2000/01/08 16:38:18 anton Exp $ 1/*
2 * wuf.S: Window underflow trap handler for the Sparc. 2 * wuf.S: Window underflow trap handler for the Sparc.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller 4 * Copyright (C) 1995 David S. Miller
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 76effdbea075..6e303e10c3b9 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.35 2000/12/15 00:41:18 davem Exp $
2# Makefile for Sparc library files.. 1# Makefile for Sparc library files..
3# 2#
4 3
diff --git a/arch/sparc/lib/ashldi3.S b/arch/sparc/lib/ashldi3.S
index 52418a0cb3dd..17912e608716 100644
--- a/arch/sparc/lib/ashldi3.S
+++ b/arch/sparc/lib/ashldi3.S
@@ -1,4 +1,4 @@
1/* $Id: ashldi3.S,v 1.2 1999/11/19 04:11:46 davem Exp $ 1/*
2 * ashldi3.S: GCC emits these for certain drivers playing 2 * ashldi3.S: GCC emits these for certain drivers playing
3 * with long longs. 3 * with long longs.
4 * 4 *
diff --git a/arch/sparc/lib/ashrdi3.S b/arch/sparc/lib/ashrdi3.S
index 2848237598a4..85398fd6dcc9 100644
--- a/arch/sparc/lib/ashrdi3.S
+++ b/arch/sparc/lib/ashrdi3.S
@@ -1,4 +1,4 @@
1/* $Id: ashrdi3.S,v 1.4 1999/11/19 04:11:49 davem Exp $ 1/*
2 * ashrdi3.S: The filesystem code creates all kinds of references to 2 * ashrdi3.S: The filesystem code creates all kinds of references to
3 * this little routine on the sparc with gcc. 3 * this little routine on the sparc with gcc.
4 * 4 *
diff --git a/arch/sparc/lib/blockops.S b/arch/sparc/lib/blockops.S
index a7c7ffaa4a94..804be87f9a42 100644
--- a/arch/sparc/lib/blockops.S
+++ b/arch/sparc/lib/blockops.S
@@ -1,4 +1,4 @@
1/* $Id: blockops.S,v 1.8 1998/01/30 10:58:44 jj Exp $ 1/*
2 * blockops.S: Common block zero optimized routines. 2 * blockops.S: Common block zero optimized routines.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/lib/locks.S b/arch/sparc/lib/locks.S
index b1df55cb2215..64f53f2b673d 100644
--- a/arch/sparc/lib/locks.S
+++ b/arch/sparc/lib/locks.S
@@ -1,4 +1,4 @@
1/* $Id: locks.S,v 1.16 2000/02/26 11:02:47 anton Exp $ 1/*
2 * locks.S: SMP low-level lock primitives on Sparc. 2 * locks.S: SMP low-level lock primitives on Sparc.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/lib/lshrdi3.S b/arch/sparc/lib/lshrdi3.S
index 35abf5b2bd15..47a1354c1602 100644
--- a/arch/sparc/lib/lshrdi3.S
+++ b/arch/sparc/lib/lshrdi3.S
@@ -1,4 +1,3 @@
1/* $Id: lshrdi3.S,v 1.1 1999/03/21 06:37:45 davem Exp $ */
2 1
3 .globl __lshrdi3 2 .globl __lshrdi3
4__lshrdi3: 3__lshrdi3:
diff --git a/arch/sparc/lib/memscan.S b/arch/sparc/lib/memscan.S
index 28e78ff090ac..4ff1657dfc24 100644
--- a/arch/sparc/lib/memscan.S
+++ b/arch/sparc/lib/memscan.S
@@ -1,4 +1,4 @@
1/* $Id: memscan.S,v 1.4 1996/09/08 02:01:20 davem Exp $ 1/*
2 * memscan.S: Optimized memscan for the Sparc. 2 * memscan.S: Optimized memscan for the Sparc.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/lib/mul.S b/arch/sparc/lib/mul.S
index da693560d878..c45470d0b0ce 100644
--- a/arch/sparc/lib/mul.S
+++ b/arch/sparc/lib/mul.S
@@ -1,4 +1,4 @@
1/* $Id: mul.S,v 1.4 1996/09/30 02:22:32 davem Exp $ 1/*
2 * mul.S: This routine was taken from glibc-1.09 and is covered 2 * mul.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2. 3 * by the GNU Library General Public License Version 2.
4 */ 4 */
diff --git a/arch/sparc/lib/rem.S b/arch/sparc/lib/rem.S
index bf015a90d07e..42fb86252815 100644
--- a/arch/sparc/lib/rem.S
+++ b/arch/sparc/lib/rem.S
@@ -1,4 +1,4 @@
1/* $Id: rem.S,v 1.7 1996/09/30 02:22:34 davem Exp $ 1/*
2 * rem.S: This routine was taken from glibc-1.09 and is covered 2 * rem.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2. 3 * by the GNU Library General Public License Version 2.
4 */ 4 */
diff --git a/arch/sparc/lib/rwsem.S b/arch/sparc/lib/rwsem.S
index f406b1f22791..9675268e7fde 100644
--- a/arch/sparc/lib/rwsem.S
+++ b/arch/sparc/lib/rwsem.S
@@ -1,4 +1,4 @@
1/* $Id: rwsem.S,v 1.5 2000/05/09 17:40:13 davem Exp $ 1/*
2 * Assembly part of rw semaphores. 2 * Assembly part of rw semaphores.
3 * 3 *
4 * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) 4 * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com)
diff --git a/arch/sparc/lib/sdiv.S b/arch/sparc/lib/sdiv.S
index af9451629d0b..f0a0d4e4db78 100644
--- a/arch/sparc/lib/sdiv.S
+++ b/arch/sparc/lib/sdiv.S
@@ -1,4 +1,4 @@
1/* $Id: sdiv.S,v 1.6 1996/10/02 17:37:00 davem Exp $ 1/*
2 * sdiv.S: This routine was taken from glibc-1.09 and is covered 2 * sdiv.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2. 3 * by the GNU Library General Public License Version 2.
4 */ 4 */
diff --git a/arch/sparc/lib/strncmp.S b/arch/sparc/lib/strncmp.S
index 615626805d4b..494ec664537a 100644
--- a/arch/sparc/lib/strncmp.S
+++ b/arch/sparc/lib/strncmp.S
@@ -1,4 +1,4 @@
1/* $Id: strncmp.S,v 1.2 1996/09/09 02:47:20 davem Exp $ 1/*
2 * strncmp.S: Hand optimized Sparc assembly of GCC output from GNU libc 2 * strncmp.S: Hand optimized Sparc assembly of GCC output from GNU libc
3 * generic strncmp routine. 3 * generic strncmp routine.
4 */ 4 */
diff --git a/arch/sparc/lib/udiv.S b/arch/sparc/lib/udiv.S
index 169e01da6715..2101405bdfcb 100644
--- a/arch/sparc/lib/udiv.S
+++ b/arch/sparc/lib/udiv.S
@@ -1,4 +1,4 @@
1/* $Id: udiv.S,v 1.4 1996/09/30 02:22:38 davem Exp $ 1/*
2 * udiv.S: This routine was taken from glibc-1.09 and is covered 2 * udiv.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2. 3 * by the GNU Library General Public License Version 2.
4 */ 4 */
diff --git a/arch/sparc/lib/umul.S b/arch/sparc/lib/umul.S
index f0e5b20a2536..1f36ae682529 100644
--- a/arch/sparc/lib/umul.S
+++ b/arch/sparc/lib/umul.S
@@ -1,4 +1,4 @@
1/* $Id: umul.S,v 1.4 1996/09/30 02:22:39 davem Exp $ 1/*
2 * umul.S: This routine was taken from glibc-1.09 and is covered 2 * umul.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2. 3 * by the GNU Library General Public License Version 2.
4 */ 4 */
diff --git a/arch/sparc/lib/urem.S b/arch/sparc/lib/urem.S
index 6b92bdc8b04c..77123eb83c44 100644
--- a/arch/sparc/lib/urem.S
+++ b/arch/sparc/lib/urem.S
@@ -1,4 +1,4 @@
1/* $Id: urem.S,v 1.4 1996/09/30 02:22:42 davem Exp $ 1/*
2 * urem.S: This routine was taken from glibc-1.09 and is covered 2 * urem.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2. 3 * by the GNU Library General Public License Version 2.
4 */ 4 */
diff --git a/arch/sparc/math-emu/ashldi3.S b/arch/sparc/math-emu/ashldi3.S
index eab1d097296a..7230ff5c7aa1 100644
--- a/arch/sparc/math-emu/ashldi3.S
+++ b/arch/sparc/math-emu/ashldi3.S
@@ -1,4 +1,4 @@
1/* $Id: ashldi3.S,v 1.1 1998/04/06 16:09:28 jj Exp $ 1/*
2 * ashldi3.S: Math-emu code creates all kinds of references to 2 * ashldi3.S: Math-emu code creates all kinds of references to
3 * this little routine on the sparc with gcc. 3 * this little routine on the sparc with gcc.
4 * 4 *
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
index 16eeba4b991a..109c8b22cb38 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.38 2000/12/15 00:41:22 davem Exp $
2# Makefile for the linux Sparc-specific parts of the memory manager. 1# Makefile for the linux Sparc-specific parts of the memory manager.
3# 2#
4 3
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
index abd50795a7b6..0a3cd8f6cfe4 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault.c
@@ -1,4 +1,4 @@
1/* $Id: fault.c,v 1.122 2001/11/17 07:19:26 davem Exp $ 1/*
2 * fault.c: Page fault handlers for the Sparc. 2 * fault.c: Page fault handlers for the Sparc.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c
index 1ef7fa03fefe..a289261da9fd 100644
--- a/arch/sparc/mm/generic.c
+++ b/arch/sparc/mm/generic.c
@@ -1,4 +1,4 @@
1/* $Id: generic.c,v 1.14 2001/12/21 04:56:15 davem Exp $ 1/*
2 * generic.c: Generic Sparc mm routines that are not dependent upon 2 * generic.c: Generic Sparc mm routines that are not dependent upon
3 * MMU type but are Sparc specific. 3 * MMU type but are Sparc specific.
4 * 4 *
diff --git a/arch/sparc/mm/hypersparc.S b/arch/sparc/mm/hypersparc.S
index d29cc24c5bba..44aad32eeb4e 100644
--- a/arch/sparc/mm/hypersparc.S
+++ b/arch/sparc/mm/hypersparc.S
@@ -1,4 +1,4 @@
1/* $Id: hypersparc.S,v 1.18 2001/12/21 04:56:15 davem Exp $ 1/*
2 * hypersparc.S: High speed Hypersparc mmu/cache operations. 2 * hypersparc.S: High speed Hypersparc mmu/cache operations.
3 * 3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
index b89837accc88..7794ecb896e3 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -1,4 +1,4 @@
1/* $Id: init.c,v 1.103 2001/11/19 19:03:08 davem Exp $ 1/*
2 * linux/arch/sparc/mm/init.c 2 * linux/arch/sparc/mm/init.c
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index b86dfce8eee4..f167835db3df 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -1,4 +1,4 @@
1/* $Id: io-unit.c,v 1.24 2001/12/17 07:05:09 davem Exp $ 1/*
2 * io-unit.c: IO-UNIT specific routines for memory management. 2 * io-unit.c: IO-UNIT specific routines for memory management.
3 * 3 *
4 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
diff --git a/arch/sparc/mm/loadmmu.c b/arch/sparc/mm/loadmmu.c
index 2d9cd65160a4..652be05acbea 100644
--- a/arch/sparc/mm/loadmmu.c
+++ b/arch/sparc/mm/loadmmu.c
@@ -1,4 +1,4 @@
1/* $Id: loadmmu.c,v 1.56 2000/02/08 20:24:21 davem Exp $ 1/*
2 * loadmmu.c: This code loads up all the mm function pointers once the 2 * loadmmu.c: This code loads up all the mm function pointers once the
3 * machine type has been determined. It also sets the static 3 * machine type has been determined. It also sets the static
4 * mmu values such as PAGE_NONE, etc. 4 * mmu values such as PAGE_NONE, etc.
diff --git a/arch/sparc/mm/nosrmmu.c b/arch/sparc/mm/nosrmmu.c
index 9e215659697e..3701f70fc30a 100644
--- a/arch/sparc/mm/nosrmmu.c
+++ b/arch/sparc/mm/nosrmmu.c
@@ -1,4 +1,4 @@
1/* $Id: nosrmmu.c,v 1.5 1999/11/19 04:11:54 davem Exp $ 1/*
2 * nosrmmu.c: This file is a bunch of dummies for sun4 compiles, 2 * nosrmmu.c: This file is a bunch of dummies for sun4 compiles,
3 * so that it does not need srmmu and avoid ifdefs. 3 * so that it does not need srmmu and avoid ifdefs.
4 * 4 *
diff --git a/arch/sparc/mm/nosun4c.c b/arch/sparc/mm/nosun4c.c
index ea2e2105341d..196263f895b7 100644
--- a/arch/sparc/mm/nosun4c.c
+++ b/arch/sparc/mm/nosun4c.c
@@ -1,4 +1,4 @@
1/* $Id: nosun4c.c,v 1.3 2000/02/14 04:52:36 jj Exp $ 1/*
2 * nosun4c.c: This file is a bunch of dummies for SMP compiles, 2 * nosun4c.c: This file is a bunch of dummies for SMP compiles,
3 * so that it does not need sun4c and avoid ifdefs. 3 * so that it does not need sun4c and avoid ifdefs.
4 * 4 *
diff --git a/arch/sparc/mm/swift.S b/arch/sparc/mm/swift.S
index 9f4cd396a0fa..c801c3953a00 100644
--- a/arch/sparc/mm/swift.S
+++ b/arch/sparc/mm/swift.S
@@ -1,4 +1,4 @@
1/* $Id: swift.S,v 1.9 2002/01/08 11:11:59 davem Exp $ 1/*
2 * swift.S: MicroSparc-II mmu/cache operations. 2 * swift.S: MicroSparc-II mmu/cache operations.
3 * 3 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
diff --git a/arch/sparc/mm/tsunami.S b/arch/sparc/mm/tsunami.S
index 4988e6a310bb..db0d6de33a87 100644
--- a/arch/sparc/mm/tsunami.S
+++ b/arch/sparc/mm/tsunami.S
@@ -1,4 +1,4 @@
1/* $Id: tsunami.S,v 1.7 2001/12/21 04:56:15 davem Exp $ 1/*
2 * tsunami.S: High speed MicroSparc-I mmu/cache operations. 2 * tsunami.S: High speed MicroSparc-I mmu/cache operations.
3 * 3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S
index 754c622548a5..6dfcc13d3100 100644
--- a/arch/sparc/mm/viking.S
+++ b/arch/sparc/mm/viking.S
@@ -1,4 +1,4 @@
1/* $Id: viking.S,v 1.19 2001/12/21 04:56:15 davem Exp $ 1/*
2 * viking.S: High speed Viking cache/mmu operations 2 * viking.S: High speed Viking cache/mmu operations
3 * 3 *
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile
index 2b217ee40703..7f5eacfcfbcf 100644
--- a/arch/sparc/prom/Makefile
+++ b/arch/sparc/prom/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.8 2000/12/15 00:41:22 davem Exp $
2# Makefile for the Sun Boot PROM interface library under 1# Makefile for the Sun Boot PROM interface library under
3# Linux. 2# Linux.
4# 3#
diff --git a/arch/sparc/prom/bootstr.c b/arch/sparc/prom/bootstr.c
index cfdeac2788d1..5a35c768ff7c 100644
--- a/arch/sparc/prom/bootstr.c
+++ b/arch/sparc/prom/bootstr.c
@@ -1,4 +1,4 @@
1/* $Id: bootstr.c,v 1.20 2000/02/08 20:24:23 davem Exp $ 1/*
2 * bootstr.c: Boot string/argument acquisition from the PROM. 2 * bootstr.c: Boot string/argument acquisition from the PROM.
3 * 3 *
4 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/prom/console.c b/arch/sparc/prom/console.c
index 2a007a784415..790057a34616 100644
--- a/arch/sparc/prom/console.c
+++ b/arch/sparc/prom/console.c
@@ -1,4 +1,4 @@
1/* $Id: console.c,v 1.25 2001/10/30 04:54:22 davem Exp $ 1/*
2 * console.c: Routines that deal with sending and receiving IO 2 * console.c: Routines that deal with sending and receiving IO
3 * to/from the current console device using the PROM. 3 * to/from the current console device using the PROM.
4 * 4 *
diff --git a/arch/sparc/prom/devmap.c b/arch/sparc/prom/devmap.c
index eb12073578ad..1e517915b0df 100644
--- a/arch/sparc/prom/devmap.c
+++ b/arch/sparc/prom/devmap.c
@@ -1,4 +1,4 @@
1/* $Id: devmap.c,v 1.7 2000/08/26 02:38:03 anton Exp $ 1/*
2 * promdevmap.c: Map device/IO areas to virtual addresses. 2 * promdevmap.c: Map device/IO areas to virtual addresses.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/prom/devops.c b/arch/sparc/prom/devops.c
index 61919b54f6cc..9f1a95c91ad1 100644
--- a/arch/sparc/prom/devops.c
+++ b/arch/sparc/prom/devops.c
@@ -1,4 +1,4 @@
1/* $Id: devops.c,v 1.13 2000/08/26 02:38:03 anton Exp $ 1/*
2 * devops.c: Device operations using the PROM. 2 * devops.c: Device operations using the PROM.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/prom/init.c b/arch/sparc/prom/init.c
index 2fa3a474e3a2..729f87066945 100644
--- a/arch/sparc/prom/init.c
+++ b/arch/sparc/prom/init.c
@@ -1,4 +1,4 @@
1/* $Id: init.c,v 1.14 2000/01/29 01:09:12 anton Exp $ 1/*
2 * init.c: Initialize internal variables used by the PROM 2 * init.c: Initialize internal variables used by the PROM
3 * library functions. 3 * library functions.
4 * 4 *
diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc.c
index d9fb3af41c1f..49b5057b9601 100644
--- a/arch/sparc/prom/misc.c
+++ b/arch/sparc/prom/misc.c
@@ -1,4 +1,4 @@
1/* $Id: misc.c,v 1.18 2000/08/26 02:38:03 anton Exp $ 1/*
2 * misc.c: Miscellaneous prom functions that don't belong 2 * misc.c: Miscellaneous prom functions that don't belong
3 * anywhere else. 3 * anywhere else.
4 * 4 *
diff --git a/arch/sparc/prom/mp.c b/arch/sparc/prom/mp.c
index 92fe3739fdb8..4c4dc79f65af 100644
--- a/arch/sparc/prom/mp.c
+++ b/arch/sparc/prom/mp.c
@@ -1,4 +1,4 @@
1/* $Id: mp.c,v 1.12 2000/08/26 02:38:03 anton Exp $ 1/*
2 * mp.c: OpenBoot Prom Multiprocessor support routines. Don't call 2 * mp.c: OpenBoot Prom Multiprocessor support routines. Don't call
3 * these on a UP or else you will halt and catch fire. ;) 3 * these on a UP or else you will halt and catch fire. ;)
4 * 4 *
diff --git a/arch/sparc/prom/palloc.c b/arch/sparc/prom/palloc.c
index 84ce8bc54473..20be339cc2ce 100644
--- a/arch/sparc/prom/palloc.c
+++ b/arch/sparc/prom/palloc.c
@@ -1,4 +1,4 @@
1/* $Id: palloc.c,v 1.4 1996/04/25 06:09:48 davem Exp $ 1/*
2 * palloc.c: Memory allocation from the Sun PROM. 2 * palloc.c: Memory allocation from the Sun PROM.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c
index a2920323c900..f9b7def35f6e 100644
--- a/arch/sparc/prom/ranges.c
+++ b/arch/sparc/prom/ranges.c
@@ -1,4 +1,4 @@
1/* $Id: ranges.c,v 1.15 2001/12/19 00:29:51 davem Exp $ 1/*
2 * ranges.c: Handle ranges in newer proms for obio/sbus. 2 * ranges.c: Handle ranges in newer proms for obio/sbus.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc/prom/segment.c b/arch/sparc/prom/segment.c
index 09d6460165ab..04fd03a7f926 100644
--- a/arch/sparc/prom/segment.c
+++ b/arch/sparc/prom/segment.c
@@ -1,4 +1,4 @@
1/* $Id: segment.c,v 1.7 2000/08/26 02:38:03 anton Exp $ 1/*
2 * segment.c: Prom routine to map segments in other contexts before 2 * segment.c: Prom routine to map segments in other contexts before
3 * a standalone is completely mapped. This is for sun4 and 3 * a standalone is completely mapped. This is for sun4 and
4 * sun4c architectures only. 4 * sun4c architectures only.
diff --git a/arch/sparc/prom/tree.c b/arch/sparc/prom/tree.c
index 5ec246573a98..f228fe057b24 100644
--- a/arch/sparc/prom/tree.c
+++ b/arch/sparc/prom/tree.c
@@ -1,4 +1,4 @@
1/* $Id: tree.c,v 1.26 2000/08/26 02:38:03 anton Exp $ 1/*
2 * tree.c: Basic device tree traversal/scanning for the Linux 2 * tree.c: Basic device tree traversal/scanning for the Linux
3 * prom library. 3 * prom library.
4 * 4 *
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index 9cb75c852b45..4b8f2b084c21 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.52 2002/02/09 19:49:31 davem Exp $
2# sparc64/Makefile 1# sparc64/Makefile
3# 2#
4# Makefile for the architecture dependent flags and dependencies on the 3# Makefile for the architecture dependent flags and dependencies on the
diff --git a/arch/sparc64/boot/Makefile b/arch/sparc64/boot/Makefile
index 6968a6da57da..0458b5244f09 100644
--- a/arch/sparc64/boot/Makefile
+++ b/arch/sparc64/boot/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.4 1997/12/15 20:08:56 ecd Exp $
2# Makefile for the Sparc64 boot stuff. 1# Makefile for the Sparc64 boot stuff.
3# 2#
4# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/boot/piggyback.c b/arch/sparc64/boot/piggyback.c
index 36f907408c60..de364bfed0bb 100644
--- a/arch/sparc64/boot/piggyback.c
+++ b/arch/sparc64/boot/piggyback.c
@@ -1,4 +1,4 @@
1/* $Id: piggyback.c,v 1.2 2000/09/19 14:34:39 anton Exp $ 1/*
2 Simple utility to make a single-image install kernel with initial ramdisk 2 Simple utility to make a single-image install kernel with initial ramdisk
3 for Sparc64 tftpbooting without need to set up nfs. 3 for Sparc64 tftpbooting without need to set up nfs.
4 4
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index aff93c9d13f4..76eb832527f2 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/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.25 3# Linux kernel version: 2.6.26-rc2
4# Sat Apr 26 03:11:06 2008 4# Fri May 16 13:36:07 2008
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -74,6 +74,7 @@ CONFIG_SYSCTL=y
74# CONFIG_EMBEDDED is not set 74# CONFIG_EMBEDDED is not set
75CONFIG_UID16=y 75CONFIG_UID16=y
76CONFIG_SYSCTL_SYSCALL=y 76CONFIG_SYSCTL_SYSCALL=y
77CONFIG_SYSCTL_SYSCALL_CHECK=y
77CONFIG_KALLSYMS=y 78CONFIG_KALLSYMS=y
78# CONFIG_KALLSYMS_ALL is not set 79# CONFIG_KALLSYMS_ALL is not set
79# CONFIG_KALLSYMS_EXTRA_PASS is not set 80# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -103,12 +104,14 @@ CONFIG_KPROBES=y
103CONFIG_KRETPROBES=y 104CONFIG_KRETPROBES=y
104CONFIG_HAVE_KPROBES=y 105CONFIG_HAVE_KPROBES=y
105CONFIG_HAVE_KRETPROBES=y 106CONFIG_HAVE_KRETPROBES=y
107# CONFIG_HAVE_DMA_ATTRS is not set
106CONFIG_PROC_PAGE_MONITOR=y 108CONFIG_PROC_PAGE_MONITOR=y
107CONFIG_SLABINFO=y 109CONFIG_SLABINFO=y
108CONFIG_RT_MUTEXES=y 110CONFIG_RT_MUTEXES=y
109# CONFIG_TINY_SHMEM is not set 111# CONFIG_TINY_SHMEM is not set
110CONFIG_BASE_SMALL=0 112CONFIG_BASE_SMALL=0
111CONFIG_MODULES=y 113CONFIG_MODULES=y
114# CONFIG_MODULE_FORCE_LOAD is not set
112CONFIG_MODULE_UNLOAD=y 115CONFIG_MODULE_UNLOAD=y
113CONFIG_MODULE_FORCE_UNLOAD=y 116CONFIG_MODULE_FORCE_UNLOAD=y
114CONFIG_MODVERSIONS=y 117CONFIG_MODVERSIONS=y
@@ -170,6 +173,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
170CONFIG_SPARSEMEM_EXTREME=y 173CONFIG_SPARSEMEM_EXTREME=y
171CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 174CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
172CONFIG_SPARSEMEM_VMEMMAP=y 175CONFIG_SPARSEMEM_VMEMMAP=y
176CONFIG_PAGEFLAGS_EXTENDED=y
173CONFIG_SPLIT_PTLOCK_CPUS=4 177CONFIG_SPLIT_PTLOCK_CPUS=4
174CONFIG_MIGRATION=y 178CONFIG_MIGRATION=y
175CONFIG_RESOURCES_64BIT=y 179CONFIG_RESOURCES_64BIT=y
@@ -402,7 +406,6 @@ CONFIG_IDEPCI_PCIBUS_ORDER=y
402CONFIG_BLK_DEV_IDEDMA_PCI=y 406CONFIG_BLK_DEV_IDEDMA_PCI=y
403# CONFIG_BLK_DEV_AEC62XX is not set 407# CONFIG_BLK_DEV_AEC62XX is not set
404CONFIG_BLK_DEV_ALI15X3=y 408CONFIG_BLK_DEV_ALI15X3=y
405# CONFIG_WDC_ALI15X3 is not set
406# CONFIG_BLK_DEV_AMD74XX is not set 409# CONFIG_BLK_DEV_AMD74XX is not set
407# CONFIG_BLK_DEV_CMD64X is not set 410# CONFIG_BLK_DEV_CMD64X is not set
408# CONFIG_BLK_DEV_TRIFLEX is not set 411# CONFIG_BLK_DEV_TRIFLEX is not set
@@ -609,6 +612,7 @@ CONFIG_NIU=m
609# CONFIG_MLX4_CORE is not set 612# CONFIG_MLX4_CORE is not set
610# CONFIG_TEHUTI is not set 613# CONFIG_TEHUTI is not set
611# CONFIG_BNX2X is not set 614# CONFIG_BNX2X is not set
615# CONFIG_SFC is not set
612# CONFIG_TR is not set 616# CONFIG_TR is not set
613 617
614# 618#
@@ -717,6 +721,7 @@ CONFIG_VT=y
717CONFIG_VT_CONSOLE=y 721CONFIG_VT_CONSOLE=y
718CONFIG_HW_CONSOLE=y 722CONFIG_HW_CONSOLE=y
719# CONFIG_VT_HW_CONSOLE_BINDING is not set 723# CONFIG_VT_HW_CONSOLE_BINDING is not set
724# CONFIG_DEVKMEM is not set
720# CONFIG_SERIAL_NONSTANDARD is not set 725# CONFIG_SERIAL_NONSTANDARD is not set
721# CONFIG_NOZOMI is not set 726# CONFIG_NOZOMI is not set
722 727
@@ -793,12 +798,7 @@ CONFIG_I2C_ALGOBIT=y
793# CONFIG_I2C_DEBUG_ALGO is not set 798# CONFIG_I2C_DEBUG_ALGO is not set
794# CONFIG_I2C_DEBUG_BUS is not set 799# CONFIG_I2C_DEBUG_BUS is not set
795# CONFIG_I2C_DEBUG_CHIP is not set 800# CONFIG_I2C_DEBUG_CHIP is not set
796
797#
798# SPI support
799#
800# CONFIG_SPI is not set 801# CONFIG_SPI is not set
801# CONFIG_SPI_MASTER is not set
802# CONFIG_W1 is not set 802# CONFIG_W1 is not set
803# CONFIG_POWER_SUPPLY is not set 803# CONFIG_POWER_SUPPLY is not set
804CONFIG_HWMON=y 804CONFIG_HWMON=y
@@ -873,8 +873,17 @@ CONFIG_SSB_POSSIBLE=y
873# 873#
874# Multimedia devices 874# Multimedia devices
875# 875#
876
877#
878# Multimedia core support
879#
876# CONFIG_VIDEO_DEV is not set 880# CONFIG_VIDEO_DEV is not set
877# CONFIG_DVB_CORE is not set 881# CONFIG_DVB_CORE is not set
882# CONFIG_VIDEO_MEDIA is not set
883
884#
885# Multimedia drivers
886#
878# CONFIG_DAB is not set 887# CONFIG_DAB is not set
879 888
880# 889#
@@ -893,8 +902,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
893# CONFIG_FB_SYS_FILLRECT is not set 902# CONFIG_FB_SYS_FILLRECT is not set
894# CONFIG_FB_SYS_COPYAREA is not set 903# CONFIG_FB_SYS_COPYAREA is not set
895# CONFIG_FB_SYS_IMAGEBLIT is not set 904# CONFIG_FB_SYS_IMAGEBLIT is not set
905# CONFIG_FB_FOREIGN_ENDIAN is not set
896# CONFIG_FB_SYS_FOPS is not set 906# CONFIG_FB_SYS_FOPS is not set
897CONFIG_FB_DEFERRED_IO=y
898# CONFIG_FB_SVGALIB is not set 907# CONFIG_FB_SVGALIB is not set
899# CONFIG_FB_MACMODES is not set 908# CONFIG_FB_MACMODES is not set
900# CONFIG_FB_BACKLIGHT is not set 909# CONFIG_FB_BACKLIGHT is not set
@@ -1100,6 +1109,10 @@ CONFIG_SND_SUN_CS4231=m
1100# 1109#
1101 1110
1102# 1111#
1112# SoC Audio for the Texas Instruments OMAP
1113#
1114
1115#
1103# Open Sound System 1116# Open Sound System
1104# 1117#
1105# CONFIG_SOUND_PRIME is not set 1118# CONFIG_SOUND_PRIME is not set
@@ -1135,10 +1148,12 @@ CONFIG_USB_DEVICEFS=y
1135# 1148#
1136# USB Host Controller Drivers 1149# USB Host Controller Drivers
1137# 1150#
1151# CONFIG_USB_C67X00_HCD is not set
1138CONFIG_USB_EHCI_HCD=m 1152CONFIG_USB_EHCI_HCD=m
1139# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1153# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1140# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1154# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1141# CONFIG_USB_ISP116X_HCD is not set 1155# CONFIG_USB_ISP116X_HCD is not set
1156# CONFIG_USB_ISP1760_HCD is not set
1142CONFIG_USB_OHCI_HCD=y 1157CONFIG_USB_OHCI_HCD=y
1143# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1158# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1144# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1159# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1173,6 +1188,7 @@ CONFIG_USB_STORAGE=m
1173# CONFIG_USB_STORAGE_ALAUDA is not set 1188# CONFIG_USB_STORAGE_ALAUDA is not set
1174# CONFIG_USB_STORAGE_ONETOUCH is not set 1189# CONFIG_USB_STORAGE_ONETOUCH is not set
1175# CONFIG_USB_STORAGE_KARMA is not set 1190# CONFIG_USB_STORAGE_KARMA is not set
1191# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1176# CONFIG_USB_LIBUSUAL is not set 1192# CONFIG_USB_LIBUSUAL is not set
1177 1193
1178# 1194#
@@ -1214,6 +1230,7 @@ CONFIG_USB_STORAGE=m
1214# CONFIG_MMC is not set 1230# CONFIG_MMC is not set
1215# CONFIG_MEMSTICK is not set 1231# CONFIG_MEMSTICK is not set
1216# CONFIG_NEW_LEDS is not set 1232# CONFIG_NEW_LEDS is not set
1233# CONFIG_ACCESSIBILITY is not set
1217# CONFIG_INFINIBAND is not set 1234# CONFIG_INFINIBAND is not set
1218# CONFIG_RTC_CLASS is not set 1235# CONFIG_RTC_CLASS is not set
1219# CONFIG_UIO is not set 1236# CONFIG_UIO is not set
@@ -1367,6 +1384,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1367CONFIG_PRINTK_TIME=y 1384CONFIG_PRINTK_TIME=y
1368# CONFIG_ENABLE_WARN_DEPRECATED is not set 1385# CONFIG_ENABLE_WARN_DEPRECATED is not set
1369CONFIG_ENABLE_MUST_CHECK=y 1386CONFIG_ENABLE_MUST_CHECK=y
1387CONFIG_FRAME_WARN=2048
1370CONFIG_MAGIC_SYSRQ=y 1388CONFIG_MAGIC_SYSRQ=y
1371# CONFIG_UNUSED_SYMBOLS is not set 1389# CONFIG_UNUSED_SYMBOLS is not set
1372CONFIG_DEBUG_FS=y 1390CONFIG_DEBUG_FS=y
@@ -1377,6 +1395,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1377# CONFIG_SCHED_DEBUG is not set 1395# CONFIG_SCHED_DEBUG is not set
1378CONFIG_SCHEDSTATS=y 1396CONFIG_SCHEDSTATS=y
1379# CONFIG_TIMER_STATS is not set 1397# CONFIG_TIMER_STATS is not set
1398# CONFIG_DEBUG_OBJECTS is not set
1380# CONFIG_SLUB_DEBUG_ON is not set 1399# CONFIG_SLUB_DEBUG_ON is not set
1381# CONFIG_SLUB_STATS is not set 1400# CONFIG_SLUB_STATS is not set
1382# CONFIG_DEBUG_RT_MUTEXES is not set 1401# CONFIG_DEBUG_RT_MUTEXES is not set
@@ -1402,6 +1421,8 @@ CONFIG_DEBUG_BUGVERBOSE=y
1402# CONFIG_LKDTM is not set 1421# CONFIG_LKDTM is not set
1403# CONFIG_FAULT_INJECTION is not set 1422# CONFIG_FAULT_INJECTION is not set
1404# CONFIG_SAMPLES is not set 1423# CONFIG_SAMPLES is not set
1424CONFIG_HAVE_ARCH_KGDB=y
1425# CONFIG_KGDB is not set
1405# CONFIG_DEBUG_STACK_USAGE is not set 1426# CONFIG_DEBUG_STACK_USAGE is not set
1406# CONFIG_DEBUG_DCFLUSH is not set 1427# CONFIG_DEBUG_DCFLUSH is not set
1407# CONFIG_STACK_DEBUG is not set 1428# CONFIG_STACK_DEBUG is not set
@@ -1503,6 +1524,7 @@ CONFIG_CRYPTO_HW=y
1503# Library routines 1524# Library routines
1504# 1525#
1505CONFIG_BITREVERSE=y 1526CONFIG_BITREVERSE=y
1527# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1506CONFIG_CRC_CCITT=m 1528CONFIG_CRC_CCITT=m
1507CONFIG_CRC16=m 1529CONFIG_CRC16=m
1508# CONFIG_CRC_ITU_T is not set 1530# CONFIG_CRC_ITU_T is not set
diff --git a/arch/sparc64/kernel/dtlb_prot.S b/arch/sparc64/kernel/dtlb_prot.S
index e0a920162604..b2c2c5be281c 100644
--- a/arch/sparc64/kernel/dtlb_prot.S
+++ b/arch/sparc64/kernel/dtlb_prot.S
@@ -1,4 +1,4 @@
1/* $Id: dtlb_prot.S,v 1.22 2001/04/11 23:40:32 davem Exp $ 1/*
2 * dtlb_prot.S: DTLB protection trap strategy. 2 * dtlb_prot.S: DTLB protection trap strategy.
3 * This is included directly into the trap table. 3 * This is included directly into the trap table.
4 * 4 *
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
index bc2632274840..c49d0388b793 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc64/kernel/ebus.c
@@ -1,4 +1,4 @@
1/* $Id: ebus.c,v 1.64 2001/11/08 04:41:33 davem Exp $ 1/*
2 * ebus.c: PCI to EBus bridge device. 2 * ebus.c: PCI to EBus bridge device.
3 * 3 *
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S
index f25e1da3fd03..29ce489bc188 100644
--- a/arch/sparc64/kernel/etrap.S
+++ b/arch/sparc64/kernel/etrap.S
@@ -1,4 +1,4 @@
1/* $Id: etrap.S,v 1.46 2002/02/09 19:49:30 davem Exp $ 1/*
2 * etrap.S: Preparing for entry into the kernel on Sparc V9. 2 * etrap.S: Preparing for entry into the kernel on Sparc V9.
3 * 3 *
4 * Copyright (C) 1996, 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/kernel/idprom.c b/arch/sparc64/kernel/idprom.c
index 3b6789e09a72..5b45a808c621 100644
--- a/arch/sparc64/kernel/idprom.c
+++ b/arch/sparc64/kernel/idprom.c
@@ -1,4 +1,4 @@
1/* $Id: idprom.c,v 1.3 1999/08/31 06:54:53 davem Exp $ 1/*
2 * idprom.c: Routines to load the idprom into kernel addresses and 2 * idprom.c: Routines to load the idprom into kernel addresses and
3 * interpret the data contained within. 3 * interpret the data contained within.
4 * 4 *
diff --git a/arch/sparc64/kernel/init_task.c b/arch/sparc64/kernel/init_task.c
index 90007cf88bac..d2b312381c19 100644
--- a/arch/sparc64/kernel/init_task.c
+++ b/arch/sparc64/kernel/init_task.c
@@ -10,7 +10,6 @@
10#include <asm/processor.h> 10#include <asm/processor.h>
11 11
12static struct fs_struct init_fs = INIT_FS; 12static struct fs_struct init_fs = INIT_FS;
13static struct files_struct init_files = INIT_FILES;
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16struct mm_struct init_mm = INIT_MM(init_mm); 15struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 4129c0449856..2084f81a76e1 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -1,6 +1,6 @@
1/* arch/sparc64/kernel/process.c 1/* arch/sparc64/kernel/process.c
2 * 2 *
3 * Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995, 1996, 2008 David S. Miller (davem@davemloft.net)
4 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
5 * Copyright (C) 1997, 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5 * Copyright (C) 1997, 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */ 6 */
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/cpu.h> 31#include <linux/cpu.h>
32#include <linux/elfcore.h> 32#include <linux/elfcore.h>
33#include <linux/sysrq.h>
33 34
34#include <asm/oplib.h> 35#include <asm/oplib.h>
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
@@ -49,6 +50,8 @@
49#include <asm/sstate.h> 50#include <asm/sstate.h>
50#include <asm/reboot.h> 51#include <asm/reboot.h>
51#include <asm/syscalls.h> 52#include <asm/syscalls.h>
53#include <asm/irq_regs.h>
54#include <asm/smp.h>
52 55
53/* #define VERBOSE_SHOWREGS */ 56/* #define VERBOSE_SHOWREGS */
54 57
@@ -298,6 +301,118 @@ void show_regs(struct pt_regs *regs)
298#endif 301#endif
299} 302}
300 303
304#ifdef CONFIG_MAGIC_SYSRQ
305struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
306static DEFINE_SPINLOCK(global_reg_snapshot_lock);
307
308static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
309 int this_cpu)
310{
311 flushw_all();
312
313 global_reg_snapshot[this_cpu].tstate = regs->tstate;
314 global_reg_snapshot[this_cpu].tpc = regs->tpc;
315 global_reg_snapshot[this_cpu].tnpc = regs->tnpc;
316 global_reg_snapshot[this_cpu].o7 = regs->u_regs[UREG_I7];
317
318 if (regs->tstate & TSTATE_PRIV) {
319 struct reg_window *rw;
320
321 rw = (struct reg_window *)
322 (regs->u_regs[UREG_FP] + STACK_BIAS);
323 global_reg_snapshot[this_cpu].i7 = rw->ins[6];
324 } else
325 global_reg_snapshot[this_cpu].i7 = 0;
326
327 global_reg_snapshot[this_cpu].thread = tp;
328}
329
330/* In order to avoid hangs we do not try to synchronize with the
331 * global register dump client cpus. The last store they make is to
332 * the thread pointer, so do a short poll waiting for that to become
333 * non-NULL.
334 */
335static void __global_reg_poll(struct global_reg_snapshot *gp)
336{
337 int limit = 0;
338
339 while (!gp->thread && ++limit < 100) {
340 barrier();
341 udelay(1);
342 }
343}
344
345static void sysrq_handle_globreg(int key, struct tty_struct *tty)
346{
347 struct thread_info *tp = current_thread_info();
348 struct pt_regs *regs = get_irq_regs();
349#ifdef CONFIG_KALLSYMS
350 char buffer[KSYM_SYMBOL_LEN];
351#endif
352 unsigned long flags;
353 int this_cpu, cpu;
354
355 if (!regs)
356 regs = tp->kregs;
357
358 spin_lock_irqsave(&global_reg_snapshot_lock, flags);
359
360 memset(global_reg_snapshot, 0, sizeof(global_reg_snapshot));
361
362 this_cpu = raw_smp_processor_id();
363
364 __global_reg_self(tp, regs, this_cpu);
365
366 smp_fetch_global_regs();
367
368 for_each_online_cpu(cpu) {
369 struct global_reg_snapshot *gp = &global_reg_snapshot[cpu];
370 struct thread_info *tp;
371
372 __global_reg_poll(gp);
373
374 tp = gp->thread;
375 printk("%c CPU[%3d]: TSTATE[%016lx] TPC[%016lx] TNPC[%016lx] TASK[%s:%d]\n",
376 (cpu == this_cpu ? '*' : ' '), cpu,
377 gp->tstate, gp->tpc, gp->tnpc,
378 ((tp && tp->task) ? tp->task->comm : "NULL"),
379 ((tp && tp->task) ? tp->task->pid : -1));
380#ifdef CONFIG_KALLSYMS
381 if (gp->tstate & TSTATE_PRIV) {
382 sprint_symbol(buffer, gp->tpc);
383 printk(" TPC[%s] ", buffer);
384 sprint_symbol(buffer, gp->o7);
385 printk("O7[%s] ", buffer);
386 sprint_symbol(buffer, gp->i7);
387 printk("I7[%s]\n", buffer);
388 } else
389#endif
390 {
391 printk(" TPC[%lx] O7[%lx] I7[%lx]\n",
392 gp->tpc, gp->o7, gp->i7);
393 }
394 }
395
396 memset(global_reg_snapshot, 0, sizeof(global_reg_snapshot));
397
398 spin_unlock_irqrestore(&global_reg_snapshot_lock, flags);
399}
400
401static struct sysrq_key_op sparc_globalreg_op = {
402 .handler = sysrq_handle_globreg,
403 .help_msg = "Globalregs",
404 .action_msg = "Show Global CPU Regs",
405};
406
407static int __init sparc_globreg_init(void)
408{
409 return register_sysrq_key('y', &sparc_globalreg_op);
410}
411
412core_initcall(sparc_globreg_init);
413
414#endif
415
301unsigned long thread_saved_pc(struct task_struct *tsk) 416unsigned long thread_saved_pc(struct task_struct *tsk)
302{ 417{
303 struct thread_info *ti = task_thread_info(tsk); 418 struct thread_info *ti = task_thread_info(tsk);
@@ -542,20 +657,39 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
542 struct task_struct *p, struct pt_regs *regs) 657 struct task_struct *p, struct pt_regs *regs)
543{ 658{
544 struct thread_info *t = task_thread_info(p); 659 struct thread_info *t = task_thread_info(p);
660 struct sparc_stackf *parent_sf;
661 unsigned long child_stack_sz;
545 char *child_trap_frame; 662 char *child_trap_frame;
663 int kernel_thread;
546 664
547 /* Calculate offset to stack_frame & pt_regs */ 665 kernel_thread = (regs->tstate & TSTATE_PRIV) ? 1 : 0;
548 child_trap_frame = task_stack_page(p) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); 666 parent_sf = ((struct sparc_stackf *) regs) - 1;
549 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
550 667
551 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) | 668 /* Calculate offset to stack_frame & pt_regs */
669 child_stack_sz = ((STACKFRAME_SZ + TRACEREG_SZ) +
670 (kernel_thread ? STACKFRAME_SZ : 0));
671 child_trap_frame = (task_stack_page(p) +
672 (THREAD_SIZE - child_stack_sz));
673 memcpy(child_trap_frame, parent_sf, child_stack_sz);
674
675 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) |
676 (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) |
552 (((regs->tstate + 1) & TSTATE_CWP) << TI_FLAG_CWP_SHIFT); 677 (((regs->tstate + 1) & TSTATE_CWP) << TI_FLAG_CWP_SHIFT);
553 t->new_child = 1; 678 t->new_child = 1;
554 t->ksp = ((unsigned long) child_trap_frame) - STACK_BIAS; 679 t->ksp = ((unsigned long) child_trap_frame) - STACK_BIAS;
555 t->kregs = (struct pt_regs *)(child_trap_frame+sizeof(struct sparc_stackf)); 680 t->kregs = (struct pt_regs *) (child_trap_frame +
681 sizeof(struct sparc_stackf));
556 t->fpsaved[0] = 0; 682 t->fpsaved[0] = 0;
557 683
558 if (regs->tstate & TSTATE_PRIV) { 684 if (kernel_thread) {
685 struct sparc_stackf *child_sf = (struct sparc_stackf *)
686 (child_trap_frame + (STACKFRAME_SZ + TRACEREG_SZ));
687
688 /* Zero terminate the stack backtrace. */
689 child_sf->fp = NULL;
690 t->kregs->u_regs[UREG_FP] =
691 ((unsigned long) child_sf) - STACK_BIAS;
692
559 /* Special case, if we are spawning a kernel thread from 693 /* Special case, if we are spawning a kernel thread from
560 * a userspace task (via KMOD, NFS, or similar) we must 694 * a userspace task (via KMOD, NFS, or similar) we must
561 * disable performance counters in the child because the 695 * disable performance counters in the child because the
@@ -566,12 +700,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
566 t->pcr_reg = 0; 700 t->pcr_reg = 0;
567 t->flags &= ~_TIF_PERFCTR; 701 t->flags &= ~_TIF_PERFCTR;
568 } 702 }
569 t->kregs->u_regs[UREG_FP] = t->ksp;
570 t->flags |= ((long)ASI_P << TI_FLAG_CURRENT_DS_SHIFT); 703 t->flags |= ((long)ASI_P << TI_FLAG_CURRENT_DS_SHIFT);
571 flush_register_windows();
572 memcpy((void *)(t->ksp + STACK_BIAS),
573 (void *)(regs->u_regs[UREG_FP] + STACK_BIAS),
574 sizeof(struct sparc_stackf));
575 t->kregs->u_regs[UREG_G6] = (unsigned long) t; 704 t->kregs->u_regs[UREG_G6] = (unsigned long) t;
576 t->kregs->u_regs[UREG_G4] = (unsigned long) t->task; 705 t->kregs->u_regs[UREG_G4] = (unsigned long) t->task;
577 } else { 706 } else {
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index b9b785fd8b46..c6fc695fe1fe 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -1,4 +1,4 @@
1/* $Id: rtrap.S,v 1.61 2002/02/09 19:49:31 davem Exp $ 1/*
2 * rtrap.S: Preparing for return from trap on Sparc V9. 2 * rtrap.S: Preparing for return from trap on Sparc V9.
3 * 3 *
4 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -46,7 +46,7 @@ __handle_user_windows:
46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
47 ldx [%g6 + TI_FLAGS], %l0 47 ldx [%g6 + TI_FLAGS], %l0
48 48
491: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 491: andcc %l0, _TIF_SIGPENDING, %g0
50 be,pt %xcc, __handle_user_windows_continue 50 be,pt %xcc, __handle_user_windows_continue
51 nop 51 nop
52 mov %l5, %o1 52 mov %l5, %o1
@@ -86,7 +86,7 @@ __handle_perfctrs:
86 wrpr %g0, RTRAP_PSTATE, %pstate 86 wrpr %g0, RTRAP_PSTATE, %pstate
87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
88 ldx [%g6 + TI_FLAGS], %l0 88 ldx [%g6 + TI_FLAGS], %l0
891: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 891: andcc %l0, _TIF_SIGPENDING, %g0
90 90
91 be,pt %xcc, __handle_perfctrs_continue 91 be,pt %xcc, __handle_perfctrs_continue
92 sethi %hi(TSTATE_PEF), %o0 92 sethi %hi(TSTATE_PEF), %o0
@@ -195,7 +195,7 @@ __handle_preemption_continue:
195 andcc %l1, %o0, %g0 195 andcc %l1, %o0, %g0
196 andcc %l0, _TIF_NEED_RESCHED, %g0 196 andcc %l0, _TIF_NEED_RESCHED, %g0
197 bne,pn %xcc, __handle_preemption 197 bne,pn %xcc, __handle_preemption
198 andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 198 andcc %l0, _TIF_SIGPENDING, %g0
199 bne,pn %xcc, __handle_signal 199 bne,pn %xcc, __handle_signal
200__handle_signal_continue: 200__handle_signal_continue:
201 ldub [%g6 + TI_WSAVED], %o2 201 ldub [%g6 + TI_WSAVED], %o2
@@ -363,6 +363,7 @@ kern_rtt: rdpr %canrestore, %g1
363 brz,pn %g1, kern_rtt_fill 363 brz,pn %g1, kern_rtt_fill
364 nop 364 nop
365kern_rtt_restore: 365kern_rtt_restore:
366 stw %g0, [%sp + PTREGS_OFF + PT_V9_MAGIC]
366 restore 367 restore
367 retry 368 retry
368 369
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index fa2827c4a3ad..e33a8a660e9e 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -1,4 +1,4 @@
1/* $Id: sbus.c,v 1.19 2002/01/23 11:27:32 davem Exp $ 1/*
2 * sbus.c: UltraSparc SBUS controller support. 2 * sbus.c: UltraSparc SBUS controller support.
3 * 3 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index da5e6ee0c661..c8b03a4f68bf 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -1,4 +1,4 @@
1/* $Id: setup.c,v 1.72 2002/02/09 19:49:30 davem Exp $ 1/*
2 * linux/arch/sparc64/kernel/setup.c 2 * linux/arch/sparc64/kernel/setup.c
3 * 3 *
4 * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index 2378482c2aab..9667e96fd513 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -1,4 +1,4 @@
1/* $Id: signal.c,v 1.60 2002/02/09 19:49:31 davem Exp $ 1/*
2 * arch/sparc64/kernel/signal.c 2 * arch/sparc64/kernel/signal.c
3 * 3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 4 * Copyright (C) 1991, 1992 Linus Torvalds
@@ -247,7 +247,9 @@ static long _sigpause_common(old_sigset_t set)
247 247
248 current->state = TASK_INTERRUPTIBLE; 248 current->state = TASK_INTERRUPTIBLE;
249 schedule(); 249 schedule();
250 set_thread_flag(TIF_RESTORE_SIGMASK); 250
251 set_restore_sigmask();
252
251 return -ERESTARTNOHAND; 253 return -ERESTARTNOHAND;
252} 254}
253 255
@@ -537,7 +539,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
537 } else 539 } else
538 restart_syscall = 0; 540 restart_syscall = 0;
539 541
540 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 542 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
541 oldset = &current->saved_sigmask; 543 oldset = &current->saved_sigmask;
542 else 544 else
543 oldset = &current->blocked; 545 oldset = &current->blocked;
@@ -566,13 +568,12 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
566 syscall_restart(orig_i0, regs, &ka.sa); 568 syscall_restart(orig_i0, regs, &ka.sa);
567 handle_signal(signr, &ka, &info, oldset, regs); 569 handle_signal(signr, &ka, &info, oldset, regs);
568 570
569 /* a signal was successfully delivered; the saved 571 /* A signal was successfully delivered; the saved
570 * sigmask will have been stored in the signal frame, 572 * sigmask will have been stored in the signal frame,
571 * and will be restored by sigreturn, so we can simply 573 * and will be restored by sigreturn, so we can simply
572 * clear the TIF_RESTORE_SIGMASK flag. 574 * clear the TS_RESTORE_SIGMASK flag.
573 */ 575 */
574 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 576 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
575 clear_thread_flag(TIF_RESTORE_SIGMASK);
576 return; 577 return;
577 } 578 }
578 if (restart_syscall && 579 if (restart_syscall &&
@@ -591,17 +592,17 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
591 regs->tnpc -= 4; 592 regs->tnpc -= 4;
592 } 593 }
593 594
594 /* if there's no signal to deliver, we just put the saved sigmask 595 /* If there's no signal to deliver, we just put the saved sigmask
595 * back 596 * back
596 */ 597 */
597 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 598 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
598 clear_thread_flag(TIF_RESTORE_SIGMASK); 599 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
599 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 600 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
600 } 601 }
601} 602}
602 603
603void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) 604void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags)
604{ 605{
605 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 606 if (thread_info_flags & _TIF_SIGPENDING)
606 do_signal(regs, orig_i0); 607 do_signal(regs, orig_i0);
607} 608}
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 3f19e9af3d1b..97cdd1bf4a10 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -788,13 +788,12 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
788 syscall_restart32(orig_i0, regs, &ka.sa); 788 syscall_restart32(orig_i0, regs, &ka.sa);
789 handle_signal32(signr, &ka, &info, oldset, regs); 789 handle_signal32(signr, &ka, &info, oldset, regs);
790 790
791 /* a signal was successfully delivered; the saved 791 /* A signal was successfully delivered; the saved
792 * sigmask will have been stored in the signal frame, 792 * sigmask will have been stored in the signal frame,
793 * and will be restored by sigreturn, so we can simply 793 * and will be restored by sigreturn, so we can simply
794 * clear the TIF_RESTORE_SIGMASK flag. 794 * clear the TS_RESTORE_SIGMASK flag.
795 */ 795 */
796 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 796 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
797 clear_thread_flag(TIF_RESTORE_SIGMASK);
798 return; 797 return;
799 } 798 }
800 if (restart_syscall && 799 if (restart_syscall &&
@@ -813,11 +812,11 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
813 regs->tnpc -= 4; 812 regs->tnpc -= 4;
814 } 813 }
815 814
816 /* if there's no signal to deliver, we just put the saved sigmask 815 /* If there's no signal to deliver, we just put the saved sigmask
817 * back 816 * back
818 */ 817 */
819 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 818 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
820 clear_thread_flag(TIF_RESTORE_SIGMASK); 819 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
821 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 820 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
822 } 821 }
823} 822}
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 0d6403a630ac..fa63c68a1819 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -900,6 +900,9 @@ extern unsigned long xcall_flush_tlb_mm;
900extern unsigned long xcall_flush_tlb_pending; 900extern unsigned long xcall_flush_tlb_pending;
901extern unsigned long xcall_flush_tlb_kernel_range; 901extern unsigned long xcall_flush_tlb_kernel_range;
902extern unsigned long xcall_report_regs; 902extern unsigned long xcall_report_regs;
903#ifdef CONFIG_MAGIC_SYSRQ
904extern unsigned long xcall_fetch_glob_regs;
905#endif
903extern unsigned long xcall_receive_signal; 906extern unsigned long xcall_receive_signal;
904extern unsigned long xcall_new_mmu_context_version; 907extern unsigned long xcall_new_mmu_context_version;
905#ifdef CONFIG_KGDB 908#ifdef CONFIG_KGDB
@@ -1080,6 +1083,13 @@ void smp_report_regs(void)
1080 smp_cross_call(&xcall_report_regs, 0, 0, 0); 1083 smp_cross_call(&xcall_report_regs, 0, 0, 0);
1081} 1084}
1082 1085
1086#ifdef CONFIG_MAGIC_SYSRQ
1087void smp_fetch_global_regs(void)
1088{
1089 smp_cross_call(&xcall_fetch_glob_regs, 0, 0, 0);
1090}
1091#endif
1092
1083/* We know that the window frames of the user have been flushed 1093/* We know that the window frames of the user have been flushed
1084 * to the stack before we get here because all callers of us 1094 * to the stack before we get here because all callers of us
1085 * are flush_tlb_*() routines, and these run after flush_cache_*() 1095 * are flush_tlb_*() routines, and these run after flush_cache_*()
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c
index 01b52f561af4..c73ce3f4197e 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -19,7 +19,7 @@ void save_stack_trace(struct stack_trace *trace)
19 fp = ksp + STACK_BIAS; 19 fp = ksp + STACK_BIAS;
20 thread_base = (unsigned long) tp; 20 thread_base = (unsigned long) tp;
21 do { 21 do {
22 struct reg_window *rw; 22 struct sparc_stackf *sf;
23 struct pt_regs *regs; 23 struct pt_regs *regs;
24 unsigned long pc; 24 unsigned long pc;
25 25
@@ -28,15 +28,17 @@ void save_stack_trace(struct stack_trace *trace)
28 fp >= (thread_base + THREAD_SIZE)) 28 fp >= (thread_base + THREAD_SIZE))
29 break; 29 break;
30 30
31 rw = (struct reg_window *) fp; 31 sf = (struct sparc_stackf *) fp;
32 regs = (struct pt_regs *) (rw + 1); 32 regs = (struct pt_regs *) (sf + 1);
33 33
34 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { 34 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
35 if (!(regs->tstate & TSTATE_PRIV))
36 break;
35 pc = regs->tpc; 37 pc = regs->tpc;
36 fp = regs->u_regs[UREG_I6] + STACK_BIAS; 38 fp = regs->u_regs[UREG_I6] + STACK_BIAS;
37 } else { 39 } else {
38 pc = rw->ins[7]; 40 pc = sf->callers_pc;
39 fp = rw->ins[6] + STACK_BIAS; 41 fp = (unsigned long)sf->fp + STACK_BIAS;
40 } 42 }
41 43
42 if (trace->skip > 0) 44 if (trace->skip > 0)
diff --git a/arch/sparc64/kernel/starfire.c b/arch/sparc64/kernel/starfire.c
index b930fee7708a..7461581b3bb9 100644
--- a/arch/sparc64/kernel/starfire.c
+++ b/arch/sparc64/kernel/starfire.c
@@ -1,4 +1,4 @@
1/* $Id: starfire.c,v 1.10 2001/04/14 21:13:45 davem Exp $ 1/*
2 * starfire.c: Starfire/E10000 support. 2 * starfire.c: Starfire/E10000 support.
3 * 3 *
4 * Copyright (C) 1998 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
index 010a737908ee..ade18ba0c686 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc64/kernel/sys32.S
@@ -1,4 +1,4 @@
1/* $Id: sys32.S,v 1.12 2000/03/24 04:17:37 davem Exp $ 1/*
2 * sys32.S: I-cache tricks for 32-bit compatibility layer simple 2 * sys32.S: I-cache tricks for 32-bit compatibility layer simple
3 * conversions. 3 * conversions.
4 * 4 *
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 0dbc941f130e..ac1bff58c1ac 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -542,8 +542,7 @@ asmlinkage long sparc64_personality(unsigned long personality)
542 return ret; 542 return ret;
543} 543}
544 544
545int sparc64_mmap_check(unsigned long addr, unsigned long len, 545int sparc64_mmap_check(unsigned long addr, unsigned long len)
546 unsigned long flags)
547{ 546{
548 if (test_thread_flag(TIF_32BIT)) { 547 if (test_thread_flag(TIF_32BIT)) {
549 if (len >= STACK_TOP32) 548 if (len >= STACK_TOP32)
@@ -609,46 +608,19 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr,
609 unsigned long old_len, unsigned long new_len, 608 unsigned long old_len, unsigned long new_len,
610 unsigned long flags, unsigned long new_addr) 609 unsigned long flags, unsigned long new_addr)
611{ 610{
612 struct vm_area_struct *vma;
613 unsigned long ret = -EINVAL; 611 unsigned long ret = -EINVAL;
614 612
615 if (test_thread_flag(TIF_32BIT)) 613 if (test_thread_flag(TIF_32BIT))
616 goto out; 614 goto out;
617 if (unlikely(new_len >= VA_EXCLUDE_START)) 615 if (unlikely(new_len >= VA_EXCLUDE_START))
618 goto out; 616 goto out;
619 if (unlikely(invalid_64bit_range(addr, old_len))) 617 if (unlikely(sparc64_mmap_check(addr, old_len)))
618 goto out;
619 if (unlikely(sparc64_mmap_check(new_addr, new_len)))
620 goto out; 620 goto out;
621 621
622 down_write(&current->mm->mmap_sem); 622 down_write(&current->mm->mmap_sem);
623 if (flags & MREMAP_FIXED) {
624 if (invalid_64bit_range(new_addr, new_len))
625 goto out_sem;
626 } else if (invalid_64bit_range(addr, new_len)) {
627 unsigned long map_flags = 0;
628 struct file *file = NULL;
629
630 ret = -ENOMEM;
631 if (!(flags & MREMAP_MAYMOVE))
632 goto out_sem;
633
634 vma = find_vma(current->mm, addr);
635 if (vma) {
636 if (vma->vm_flags & VM_SHARED)
637 map_flags |= MAP_SHARED;
638 file = vma->vm_file;
639 }
640
641 /* MREMAP_FIXED checked above. */
642 new_addr = get_unmapped_area(file, addr, new_len,
643 vma ? vma->vm_pgoff : 0,
644 map_flags);
645 ret = new_addr;
646 if (new_addr & ~PAGE_MASK)
647 goto out_sem;
648 flags |= MREMAP_FIXED;
649 }
650 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 623 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
651out_sem:
652 up_write(&current->mm->mmap_sem); 624 up_write(&current->mm->mmap_sem);
653out: 625out:
654 return ret; 626 return ret;
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 1aa4288125f2..ba5bd626b39e 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -867,44 +867,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
867 unsigned long old_len, unsigned long new_len, 867 unsigned long old_len, unsigned long new_len,
868 unsigned long flags, u32 __new_addr) 868 unsigned long flags, u32 __new_addr)
869{ 869{
870 struct vm_area_struct *vma;
871 unsigned long ret = -EINVAL; 870 unsigned long ret = -EINVAL;
872 unsigned long new_addr = __new_addr; 871 unsigned long new_addr = __new_addr;
873 872
874 if (old_len > STACK_TOP32 || new_len > STACK_TOP32) 873 if (unlikely(sparc64_mmap_check(addr, old_len)))
875 goto out; 874 goto out;
876 if (addr > STACK_TOP32 - old_len) 875 if (unlikely(sparc64_mmap_check(new_addr, new_len)))
877 goto out; 876 goto out;
878 down_write(&current->mm->mmap_sem); 877 down_write(&current->mm->mmap_sem);
879 if (flags & MREMAP_FIXED) {
880 if (new_addr > STACK_TOP32 - new_len)
881 goto out_sem;
882 } else if (addr > STACK_TOP32 - new_len) {
883 unsigned long map_flags = 0;
884 struct file *file = NULL;
885
886 ret = -ENOMEM;
887 if (!(flags & MREMAP_MAYMOVE))
888 goto out_sem;
889
890 vma = find_vma(current->mm, addr);
891 if (vma) {
892 if (vma->vm_flags & VM_SHARED)
893 map_flags |= MAP_SHARED;
894 file = vma->vm_file;
895 }
896
897 /* MREMAP_FIXED checked above. */
898 new_addr = get_unmapped_area(file, addr, new_len,
899 vma ? vma->vm_pgoff : 0,
900 map_flags);
901 ret = new_addr;
902 if (new_addr & ~PAGE_MASK)
903 goto out_sem;
904 flags |= MREMAP_FIXED;
905 }
906 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 878 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
907out_sem:
908 up_write(&current->mm->mmap_sem); 879 up_write(&current->mm->mmap_sem);
909out: 880out:
910 return ret; 881 return ret;
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 56ff55211341..704a3afcfd06 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -1,4 +1,4 @@
1/* $Id: trampoline.S,v 1.26 2002/02/09 19:49:30 davem Exp $ 1/*
2 * trampoline.S: Jump start slave processors on sparc64. 2 * trampoline.S: Jump start slave processors on sparc64.
3 * 3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index d9b8d46707d1..369749262653 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -2116,7 +2116,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2116 printk("\n"); 2116 printk("\n");
2117#endif 2117#endif
2118 do { 2118 do {
2119 struct reg_window *rw; 2119 struct sparc_stackf *sf;
2120 struct pt_regs *regs; 2120 struct pt_regs *regs;
2121 unsigned long pc; 2121 unsigned long pc;
2122 2122
@@ -2124,15 +2124,17 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2124 if (fp < (thread_base + sizeof(struct thread_info)) || 2124 if (fp < (thread_base + sizeof(struct thread_info)) ||
2125 fp >= (thread_base + THREAD_SIZE)) 2125 fp >= (thread_base + THREAD_SIZE))
2126 break; 2126 break;
2127 rw = (struct reg_window *)fp; 2127 sf = (struct sparc_stackf *) fp;
2128 regs = (struct pt_regs *) (rw + 1); 2128 regs = (struct pt_regs *) (sf + 1);
2129 2129
2130 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { 2130 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
2131 if (!(regs->tstate & TSTATE_PRIV))
2132 break;
2131 pc = regs->tpc; 2133 pc = regs->tpc;
2132 fp = regs->u_regs[UREG_I6] + STACK_BIAS; 2134 fp = regs->u_regs[UREG_I6] + STACK_BIAS;
2133 } else { 2135 } else {
2134 pc = rw->ins[7]; 2136 pc = sf->callers_pc;
2135 fp = rw->ins[6] + STACK_BIAS; 2137 fp = (unsigned long)sf->fp + STACK_BIAS;
2136 } 2138 }
2137 2139
2138 printk(" [%016lx] ", pc); 2140 printk(" [%016lx] ", pc);
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index 1a511e9f0d3e..afa7fc4f5193 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -1,4 +1,4 @@
1/* $Id: unaligned.c,v 1.24 2002/02/09 19:49:31 davem Exp $ 1/*
2 * unaligned.c: Unaligned load/store trap handling with special 2 * unaligned.c: Unaligned load/store trap handling with special
3 * cases for the kernel to do them more quickly. 3 * cases for the kernel to do them more quickly.
4 * 4 *
diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c
index 3c6cfbb20360..8b313f11bc8d 100644
--- a/arch/sparc64/lib/PeeCeeI.c
+++ b/arch/sparc64/lib/PeeCeeI.c
@@ -1,4 +1,4 @@
1/* $Id: PeeCeeI.c,v 1.4 1999/09/06 01:17:35 davem Exp $ 1/*
2 * PeeCeeI.c: The emerging standard... 2 * PeeCeeI.c: The emerging standard...
3 * 3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/lib/VISsave.S b/arch/sparc64/lib/VISsave.S
index a0ded5c5aa5c..b320ae9e2e2e 100644
--- a/arch/sparc64/lib/VISsave.S
+++ b/arch/sparc64/lib/VISsave.S
@@ -1,4 +1,4 @@
1/* $Id: VISsave.S,v 1.6 2002/02/09 19:49:30 davem Exp $ 1/*
2 * VISsave.S: Code for saving FPU register state for 2 * VISsave.S: Code for saving FPU register state for
3 * VIS routines. One should not call this directly, 3 * VIS routines. One should not call this directly,
4 * but use macros provided in <asm/visasm.h>. 4 * but use macros provided in <asm/visasm.h>.
diff --git a/arch/sparc64/lib/memcmp.S b/arch/sparc64/lib/memcmp.S
index c90ad96c51b9..d3fdaa898566 100644
--- a/arch/sparc64/lib/memcmp.S
+++ b/arch/sparc64/lib/memcmp.S
@@ -1,4 +1,4 @@
1/* $Id: memcmp.S,v 1.3 2000/03/23 07:51:08 davem Exp $ 1/*
2 * Sparc64 optimized memcmp code. 2 * Sparc64 optimized memcmp code.
3 * 3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
diff --git a/arch/sparc64/lib/memscan.S b/arch/sparc64/lib/memscan.S
index 5e72d4911417..5686dfa5dc15 100644
--- a/arch/sparc64/lib/memscan.S
+++ b/arch/sparc64/lib/memscan.S
@@ -1,4 +1,4 @@
1/* $Id: memscan.S,v 1.3 2000/01/31 04:59:10 davem Exp $ 1/*
2 * memscan.S: Optimized memscan for Sparc64. 2 * memscan.S: Optimized memscan for Sparc64.
3 * 3 *
4 * Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
diff --git a/arch/sparc64/lib/strncmp.S b/arch/sparc64/lib/strncmp.S
index 6f14f53dbabe..980e83751556 100644
--- a/arch/sparc64/lib/strncmp.S
+++ b/arch/sparc64/lib/strncmp.S
@@ -1,4 +1,4 @@
1/* $Id: strncmp.S,v 1.2 1997/03/11 17:51:44 jj Exp $ 1/*
2 * Sparc64 optimized strncmp code. 2 * Sparc64 optimized strncmp code.
3 * 3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
diff --git a/arch/sparc64/lib/strncpy_from_user.S b/arch/sparc64/lib/strncpy_from_user.S
index b2f499f79427..511c8f136f95 100644
--- a/arch/sparc64/lib/strncpy_from_user.S
+++ b/arch/sparc64/lib/strncpy_from_user.S
@@ -1,4 +1,4 @@
1/* $Id: strncpy_from_user.S,v 1.6 1999/05/25 16:53:05 jj Exp $ 1/*
2 * strncpy_from_user.S: Sparc64 strncpy from userspace. 2 * strncpy_from_user.S: Sparc64 strncpy from userspace.
3 * 3 *
4 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
diff --git a/arch/sparc64/math-emu/math.c b/arch/sparc64/math-emu/math.c
index 6ee496c2864a..add053e0f3b3 100644
--- a/arch/sparc64/math-emu/math.c
+++ b/arch/sparc64/math-emu/math.c
@@ -1,4 +1,4 @@
1/* $Id: math.c,v 1.11 1999/12/20 05:02:25 davem Exp $ 1/*
2 * arch/sparc64/math-emu/math.c 2 * arch/sparc64/math-emu/math.c
3 * 3 *
4 * Copyright (C) 1997,1999 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1997,1999 Jakub Jelinek (jj@ultra.linux.cz)
diff --git a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc64/math-emu/sfp-util.h
index 31e474738cf6..425d3cf01af4 100644
--- a/arch/sparc64/math-emu/sfp-util.h
+++ b/arch/sparc64/math-emu/sfp-util.h
@@ -1,4 +1,4 @@
1/* $Id: sfp-util.h,v 1.5 2001/06/10 06:48:46 davem Exp $ 1/*
2 * arch/sparc64/math-emu/sfp-util.h 2 * arch/sparc64/math-emu/sfp-util.h
3 * 3 *
4 * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz)
diff --git a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile
index e415bf942bcd..68d04c0370f4 100644
--- a/arch/sparc64/mm/Makefile
+++ b/arch/sparc64/mm/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.8 2000/12/14 22:57:25 davem Exp $
2# Makefile for the linux Sparc64-specific parts of the memory manager. 1# Makefile for the linux Sparc64-specific parts of the memory manager.
3# 2#
4 3
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index 2650d0d33ac2..236f4d228d2b 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -1,4 +1,4 @@
1/* $Id: fault.c,v 1.59 2002/02/09 19:49:31 davem Exp $ 1/*
2 * arch/sparc64/mm/fault.c: Page fault handlers for the 64-bit Sparc. 2 * arch/sparc64/mm/fault.c: Page fault handlers for the 64-bit Sparc.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c
index af9d81db0b38..f362c2037013 100644
--- a/arch/sparc64/mm/generic.c
+++ b/arch/sparc64/mm/generic.c
@@ -1,4 +1,4 @@
1/* $Id: generic.c,v 1.18 2001/12/21 04:56:15 davem Exp $ 1/*
2 * generic.c: Generic Sparc mm routines that are not dependent upon 2 * generic.c: Generic Sparc mm routines that are not dependent upon
3 * MMU type but are Sparc specific. 3 * MMU type but are Sparc specific.
4 * 4 *
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index ec3e2c72302a..84898c44dd4d 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -1,4 +1,4 @@
1/* $Id: init.c,v 1.209 2002/02/09 19:49:31 davem Exp $ 1/*
2 * arch/sparc64/mm/init.c 2 * arch/sparc64/mm/init.c
3 * 3 *
4 * Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu)
@@ -610,8 +610,6 @@ static void __init remap_kernel(void)
610 610
611static void __init inherit_prom_mappings(void) 611static void __init inherit_prom_mappings(void)
612{ 612{
613 read_obp_translations();
614
615 /* Now fixup OBP's idea about where we really are mapped. */ 613 /* Now fixup OBP's idea about where we really are mapped. */
616 printk("Remapping the kernel... "); 614 printk("Remapping the kernel... ");
617 remap_kernel(); 615 remap_kernel();
@@ -770,7 +768,7 @@ static void __init find_ramdisk(unsigned long phys_base)
770 initrd_start = ramdisk_image; 768 initrd_start = ramdisk_image;
771 initrd_end = ramdisk_image + sparc_ramdisk_size; 769 initrd_end = ramdisk_image + sparc_ramdisk_size;
772 770
773 lmb_reserve(initrd_start, initrd_end); 771 lmb_reserve(initrd_start, sparc_ramdisk_size);
774 772
775 initrd_start += PAGE_OFFSET; 773 initrd_start += PAGE_OFFSET;
776 initrd_end += PAGE_OFFSET; 774 initrd_end += PAGE_OFFSET;
@@ -1747,7 +1745,17 @@ void __init paging_init(void)
1747 1745
1748 lmb_init(); 1746 lmb_init();
1749 1747
1750 /* Find available physical memory... */ 1748 /* Find available physical memory...
1749 *
1750 * Read it twice in order to work around a bug in openfirmware.
1751 * The call to grab this table itself can cause openfirmware to
1752 * allocate memory, which in turn can take away some space from
1753 * the list of available memory. Reading it twice makes sure
1754 * we really do get the final value.
1755 */
1756 read_obp_translations();
1757 read_obp_memory("reg", &pall[0], &pall_ents);
1758 read_obp_memory("available", &pavail[0], &pavail_ents);
1751 read_obp_memory("available", &pavail[0], &pavail_ents); 1759 read_obp_memory("available", &pavail[0], &pavail_ents);
1752 1760
1753 phys_base = 0xffffffffffffffffUL; 1761 phys_base = 0xffffffffffffffffUL;
@@ -1788,8 +1796,6 @@ void __init paging_init(void)
1788 1796
1789 inherit_prom_mappings(); 1797 inherit_prom_mappings();
1790 1798
1791 read_obp_memory("reg", &pall[0], &pall_ents);
1792
1793 init_kpte_bitmap(); 1799 init_kpte_bitmap();
1794 1800
1795 /* Ok, we can use our TLB miss and window trap handlers safely. */ 1801 /* Ok, we can use our TLB miss and window trap handlers safely. */
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 796e005dad8b..9bb2d90a9df6 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -1,7 +1,7 @@
1/* $Id: ultra.S,v 1.72 2002/02/09 19:49:31 davem Exp $ 1/*
2 * ultra.S: Don't expand these all over the place... 2 * ultra.S: Don't expand these all over the place...
3 * 3 *
4 * Copyright (C) 1997, 2000 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1997, 2000, 2008 David S. Miller (davem@davemloft.net)
5 */ 5 */
6 6
7#include <asm/asi.h> 7#include <asm/asi.h>
@@ -15,6 +15,7 @@
15#include <asm/thread_info.h> 15#include <asm/thread_info.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/hypervisor.h> 17#include <asm/hypervisor.h>
18#include <asm/cpudata.h>
18 19
19 /* Basically, most of the Spitfire vs. Cheetah madness 20 /* Basically, most of the Spitfire vs. Cheetah madness
20 * has to do with the fact that Cheetah does not support 21 * has to do with the fact that Cheetah does not support
@@ -514,6 +515,32 @@ xcall_report_regs:
514 b rtrap_xcall 515 b rtrap_xcall
515 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 516 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
516 517
518#ifdef CONFIG_MAGIC_SYSRQ
519 .globl xcall_fetch_glob_regs
520xcall_fetch_glob_regs:
521 sethi %hi(global_reg_snapshot), %g1
522 or %g1, %lo(global_reg_snapshot), %g1
523 __GET_CPUID(%g2)
524 sllx %g2, 6, %g3
525 add %g1, %g3, %g1
526 rdpr %tstate, %g7
527 stx %g7, [%g1 + GR_SNAP_TSTATE]
528 rdpr %tpc, %g7
529 stx %g7, [%g1 + GR_SNAP_TPC]
530 rdpr %tnpc, %g7
531 stx %g7, [%g1 + GR_SNAP_TNPC]
532 stx %o7, [%g1 + GR_SNAP_O7]
533 stx %i7, [%g1 + GR_SNAP_I7]
534 sethi %hi(trap_block), %g7
535 or %g7, %lo(trap_block), %g7
536 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2
537 add %g7, %g2, %g7
538 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3
539 membar #StoreStore
540 stx %g3, [%g1 + GR_SNAP_THREAD]
541 retry
542#endif /* CONFIG_MAGIC_SYSRQ */
543
517#ifdef DCACHE_ALIASING_POSSIBLE 544#ifdef DCACHE_ALIASING_POSSIBLE
518 .align 32 545 .align 32
519 .globl xcall_flush_dcache_page_cheetah 546 .globl xcall_flush_dcache_page_cheetah
diff --git a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile
index 3d33ed27bc27..8c94483ca54d 100644
--- a/arch/sparc64/prom/Makefile
+++ b/arch/sparc64/prom/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.7 2000/12/14 22:57:25 davem Exp $
2# Makefile for the Sun Boot PROM interface library under 1# Makefile for the Sun Boot PROM interface library under
3# Linux. 2# Linux.
4# 3#
diff --git a/arch/sparc64/prom/bootstr.c b/arch/sparc64/prom/bootstr.c
index a7278614e99d..ab9ccc63b388 100644
--- a/arch/sparc64/prom/bootstr.c
+++ b/arch/sparc64/prom/bootstr.c
@@ -1,4 +1,4 @@
1/* $Id: bootstr.c,v 1.6 1999/08/31 06:55:01 davem Exp $ 1/*
2 * bootstr.c: Boot string/argument acquisition from the PROM. 2 * bootstr.c: Boot string/argument acquisition from the PROM.
3 * 3 *
4 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/prom/devops.c b/arch/sparc64/prom/devops.c
index 4641839eb39a..9dbd803e46e1 100644
--- a/arch/sparc64/prom/devops.c
+++ b/arch/sparc64/prom/devops.c
@@ -1,4 +1,4 @@
1/* $Id: devops.c,v 1.3 1997/10/29 07:43:28 ecd Exp $ 1/*
2 * devops.c: Device operations using the PROM. 2 * devops.c: Device operations using the PROM.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/arch/sparc64/prom/init.c b/arch/sparc64/prom/init.c
index 87e7c7ea0ee6..7b00f89490a4 100644
--- a/arch/sparc64/prom/init.c
+++ b/arch/sparc64/prom/init.c
@@ -1,4 +1,4 @@
1/* $Id: init.c,v 1.10 1999/09/21 14:35:59 davem Exp $ 1/*
2 * init.c: Initialize internal variables used by the PROM 2 * init.c: Initialize internal variables used by the PROM
3 * library functions. 3 * library functions.
4 * 4 *
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c
index 47a877a15abd..9b0c0760901e 100644
--- a/arch/sparc64/prom/misc.c
+++ b/arch/sparc64/prom/misc.c
@@ -1,4 +1,4 @@
1/* $Id: misc.c,v 1.20 2001/09/21 03:17:07 kanoj Exp $ 1/*
2 * misc.c: Miscellaneous prom functions that don't belong 2 * misc.c: Miscellaneous prom functions that don't belong
3 * anywhere else. 3 * anywhere else.
4 * 4 *
diff --git a/arch/sparc64/prom/p1275.c b/arch/sparc64/prom/p1275.c
index 7fcccc0e19cf..4b7c937bba61 100644
--- a/arch/sparc64/prom/p1275.c
+++ b/arch/sparc64/prom/p1275.c
@@ -1,4 +1,4 @@
1/* $Id: p1275.c,v 1.22 2001/10/18 09:40:00 davem Exp $ 1/*
2 * p1275.c: Sun IEEE 1275 PROM low level interface routines 2 * p1275.c: Sun IEEE 1275 PROM low level interface routines
3 * 3 *
4 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
diff --git a/arch/sparc64/prom/tree.c b/arch/sparc64/prom/tree.c
index a99ccd7fb1b0..281aea44790b 100644
--- a/arch/sparc64/prom/tree.c
+++ b/arch/sparc64/prom/tree.c
@@ -1,4 +1,4 @@
1/* $Id: tree.c,v 1.10 1998/01/10 22:39:00 ecd Exp $ 1/*
2 * tree.c: Basic device tree traversal/scanning for the Linux 2 * tree.c: Basic device tree traversal/scanning for the Linux
3 * prom library. 3 * prom library.
4 * 4 *
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index dba8e05f0287..6976812cfb18 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -259,6 +259,8 @@ if BROKEN
259 source "drivers/mtd/Kconfig" 259 source "drivers/mtd/Kconfig"
260endif 260endif
261 261
262source "drivers/leds/Kconfig"
263
262#This is just to shut up some Kconfig warnings, so no prompt. 264#This is just to shut up some Kconfig warnings, so no prompt.
263config INPUT 265config INPUT
264 bool 266 bool
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 3a4b396d7979..1b238ebae6b3 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -145,14 +145,14 @@ config LEGACY_PTYS
145 systems, it is safe to say N. 145 systems, it is safe to say N.
146 146
147config RAW_DRIVER 147config RAW_DRIVER
148 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)" 148 tristate "RAW driver (/dev/raw/rawN)"
149 depends on BLOCK
149 help 150 help
150 The raw driver permits block devices to be bound to /dev/raw/rawN. 151 The raw driver permits block devices to be bound to /dev/raw/rawN.
151 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O. 152 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
152 See the raw(8) manpage for more details. 153 See the raw(8) manpage for more details.
153 154
154 The raw driver is deprecated and will be removed soon. 155 Applications should preferably open the device (eg /dev/hda1)
155 Applications should simply open the device (eg /dev/hda1)
156 with the O_DIRECT flag. 156 with the O_DIRECT flag.
157 157
158config MAX_RAW_DEVS 158config MAX_RAW_DEVS
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 025764089ac8..cfeb3f4a44af 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -11,6 +11,7 @@
11#include <termios.h> 11#include <termios.h>
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
14#include "os.h" 15#include "os.h"
15#include "um_malloc.h" 16#include "um_malloc.h"
16#include "user.h" 17#include "user.h"
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index ca8c9e11a39b..f5701fd2ef90 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -8,7 +8,7 @@
8 8
9static inline void *cow_malloc(int size) 9static inline void *cow_malloc(int size)
10{ 10{
11 return kmalloc(size, UM_GFP_KERNEL); 11 return uml_kmalloc(size, UM_GFP_KERNEL);
12} 12}
13 13
14static inline void cow_free(void *ptr) 14static inline void cow_free(void *ptr)
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index f23c109a055c..f8e85e0bdace 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
34{ 34{
35 struct sockaddr_un *sun; 35 struct sockaddr_un *sun;
36 36
37 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 37 sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
38 if (sun == NULL) { 38 if (sun == NULL) {
39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " 39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
40 "failed\n"); 40 "failed\n");
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
83 goto out_close; 83 goto out_close;
84 } 84 }
85 85
86 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 86 sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
87 if (sun == NULL) { 87 if (sun == NULL) {
88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " 88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
89 "failed\n"); 89 "failed\n");
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 0a2bb5b64b82..f5a981a16240 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 43 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
44 if (data == NULL) 44 if (data == NULL)
45 return NULL; 45 return NULL;
46 46
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index ff1b22b69e9c..368219cc2366 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -154,7 +154,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
154 case SNDCTL_DSP_SUBDIVIDE: 154 case SNDCTL_DSP_SUBDIVIDE:
155 case SNDCTL_DSP_SETFRAGMENT: 155 case SNDCTL_DSP_SETFRAGMENT:
156 if (get_user(data, (int __user *) arg)) 156 if (get_user(data, (int __user *) arg))
157 return EFAULT; 157 return -EFAULT;
158 break; 158 break;
159 default: 159 default:
160 break; 160 break;
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 5f647d7a7292..ee19e91568a2 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -15,6 +15,7 @@
15#include <unistd.h> 15#include <unistd.h>
16#include <errno.h> 16#include <errno.h>
17#include <netinet/in.h> 17#include <netinet/in.h>
18#include "kern_constants.h"
18#include "mcast.h" 19#include "mcast.h"
19#include "net_user.h" 20#include "net_user.h"
20#include "um_malloc.h" 21#include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
24{ 25{
25 struct sockaddr_in *sin; 26 struct sockaddr_in *sin;
26 27
27 sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL); 28 sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
28 if (sin == NULL) { 29 if (sin == NULL) {
29 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in " 30 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
30 "failed\n"); 31 "failed\n");
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index abf2653f5517..9415dd9e63ef 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char *addr,
222 netmask[2], netmask[3]); 222 netmask[2], netmask[3]);
223 223
224 output_len = UM_KERN_PAGE_SIZE; 224 output_len = UM_KERN_PAGE_SIZE;
225 output = kmalloc(output_len, UM_GFP_KERNEL); 225 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
226 if (output == NULL) 226 if (output == NULL)
227 printk(UM_KERN_ERR "change : failed to allocate output " 227 printk(UM_KERN_ERR "change : failed to allocate output "
228 "buffer\n"); 228 "buffer\n");
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index e9809356c530..5f903587d69e 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -50,7 +50,7 @@ static int pcap_open(void *data)
50 return -EIO; 50 return -EIO;
51 } 51 }
52 52
53 pri->compiled = kmalloc(sizeof(struct bpf_program), 53 pri->compiled = uml_kmalloc(sizeof(struct bpf_program),
54 UM_GFP_KERNEL); 54 UM_GFP_KERNEL);
55 if (pri->compiled == NULL) { 55 if (pri->compiled == NULL) {
56 printk(UM_KERN_ERR "pcap_open : kmalloc failed\n"); 56 printk(UM_KERN_ERR "pcap_open : kmalloc failed\n");
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index d269ca387f10..b49bf56a56aa 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -47,7 +47,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)
47 if (kern_data == NULL) 47 if (kern_data == NULL)
48 return NULL; 48 return NULL;
49 49
50 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 50 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
51 if (data == NULL) 51 if (data == NULL)
52 goto err; 52 goto err;
53 53
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index 49c79dda6046..1113911dcb2b 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
29{ 29{
30 struct pty_chan *data; 30 struct pty_chan *data;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 35
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index 71f0959c1535..4949044773ba 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -1,4 +1,5 @@
1/* Copyright (C) 2005 Jeff Dike <jdike@addtoit.com> */ 1/* Copyright (C) 2005 - 2008 Jeff Dike <jdike@{linux.intel,addtoit}.com> */
2
2/* Much of this ripped from drivers/char/hw_random.c, see there for other 3/* Much of this ripped from drivers/char/hw_random.c, see there for other
3 * copyright. 4 * copyright.
4 * 5 *
@@ -8,16 +9,18 @@
8#include <linux/sched.h> 9#include <linux/sched.h>
9#include <linux/module.h> 10#include <linux/module.h>
10#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/interrupt.h>
11#include <linux/miscdevice.h> 13#include <linux/miscdevice.h>
12#include <linux/delay.h> 14#include <linux/delay.h>
13#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include "irq_kern.h"
14#include "os.h" 17#include "os.h"
15 18
16/* 19/*
17 * core module and version information 20 * core module and version information
18 */ 21 */
19#define RNG_VERSION "1.0.0" 22#define RNG_VERSION "1.0.0"
20#define RNG_MODULE_NAME "random" 23#define RNG_MODULE_NAME "hw_random"
21 24
22#define RNG_MISCDEV_MINOR 183 /* official */ 25#define RNG_MISCDEV_MINOR 183 /* official */
23 26
@@ -26,47 +29,67 @@
26 * protects against a module being loaded twice at the same time. 29 * protects against a module being loaded twice at the same time.
27 */ 30 */
28static int random_fd = -1; 31static int random_fd = -1;
32static DECLARE_WAIT_QUEUE_HEAD(host_read_wait);
29 33
30static int rng_dev_open (struct inode *inode, struct file *filp) 34static int rng_dev_open (struct inode *inode, struct file *filp)
31{ 35{
32 /* enforce read-only access to this chrdev */ 36 /* enforce read-only access to this chrdev */
33 if ((filp->f_mode & FMODE_READ) == 0) 37 if ((filp->f_mode & FMODE_READ) == 0)
34 return -EINVAL; 38 return -EINVAL;
35 if (filp->f_mode & FMODE_WRITE) 39 if ((filp->f_mode & FMODE_WRITE) != 0)
36 return -EINVAL; 40 return -EINVAL;
37 41
38 return 0; 42 return 0;
39} 43}
40 44
45static atomic_t host_sleep_count = ATOMIC_INIT(0);
46
41static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, 47static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
42 loff_t * offp) 48 loff_t *offp)
43{ 49{
44 u32 data; 50 u32 data;
45 int n, ret = 0, have_data; 51 int n, ret = 0, have_data;
46 52
47 while(size){ 53 while (size) {
48 n = os_read_file(random_fd, &data, sizeof(data)); 54 n = os_read_file(random_fd, &data, sizeof(data));
49 if(n > 0){ 55 if (n > 0) {
50 have_data = n; 56 have_data = n;
51 while (have_data && size) { 57 while (have_data && size) {
52 if (put_user((u8)data, buf++)) { 58 if (put_user((u8) data, buf++)) {
53 ret = ret ? : -EFAULT; 59 ret = ret ? : -EFAULT;
54 break; 60 break;
55 } 61 }
56 size--; 62 size--;
57 ret++; 63 ret++;
58 have_data--; 64 have_data--;
59 data>>=8; 65 data >>= 8;
60 } 66 }
61 } 67 }
62 else if(n == -EAGAIN){ 68 else if (n == -EAGAIN) {
63 if (filp->f_flags & O_NONBLOCK) 69 DECLARE_WAITQUEUE(wait, current);
64 return ret ? : -EAGAIN; 70
65 71 if (filp->f_flags & O_NONBLOCK)
66 if(need_resched()) 72 return ret ? : -EAGAIN;
67 schedule_timeout_interruptible(1); 73
68 } 74 atomic_inc(&host_sleep_count);
69 else return n; 75 reactivate_fd(random_fd, RANDOM_IRQ);
76 add_sigio_fd(random_fd);
77
78 add_wait_queue(&host_read_wait, &wait);
79 set_task_state(current, TASK_INTERRUPTIBLE);
80
81 schedule();
82 set_task_state(current, TASK_RUNNING);
83 remove_wait_queue(&host_read_wait, &wait);
84
85 if (atomic_dec_and_test(&host_sleep_count)) {
86 ignore_sigio_fd(random_fd);
87 deactivate_fd(random_fd, RANDOM_IRQ);
88 }
89 }
90 else
91 return n;
92
70 if (signal_pending (current)) 93 if (signal_pending (current))
71 return ret ? : -ERESTARTSYS; 94 return ret ? : -ERESTARTSYS;
72 } 95 }
@@ -86,6 +109,13 @@ static struct miscdevice rng_miscdev = {
86 &rng_chrdev_ops, 109 &rng_chrdev_ops,
87}; 110};
88 111
112static irqreturn_t random_interrupt(int irq, void *data)
113{
114 wake_up(&host_read_wait);
115
116 return IRQ_HANDLED;
117}
118
89/* 119/*
90 * rng_init - initialize RNG module 120 * rng_init - initialize RNG module
91 */ 121 */
@@ -93,28 +123,33 @@ static int __init rng_init (void)
93{ 123{
94 int err; 124 int err;
95 125
96 err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0); 126 err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0);
97 if(err < 0) 127 if (err < 0)
98 goto out; 128 goto out;
99 129
100 random_fd = err; 130 random_fd = err;
101 131
102 err = os_set_fd_block(random_fd, 0); 132 err = um_request_irq(RANDOM_IRQ, random_fd, IRQ_READ, random_interrupt,
103 if(err) 133 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "random",
134 NULL);
135 if (err)
104 goto err_out_cleanup_hw; 136 goto err_out_cleanup_hw;
105 137
138 sigio_broken(random_fd, 1);
139
106 err = misc_register (&rng_miscdev); 140 err = misc_register (&rng_miscdev);
107 if (err) { 141 if (err) {
108 printk (KERN_ERR RNG_MODULE_NAME ": misc device register failed\n"); 142 printk (KERN_ERR RNG_MODULE_NAME ": misc device register "
143 "failed\n");
109 goto err_out_cleanup_hw; 144 goto err_out_cleanup_hw;
110 } 145 }
146out:
147 return err;
111 148
112 out: 149err_out_cleanup_hw:
113 return err; 150 os_close_file(random_fd);
114 151 random_fd = -1;
115 err_out_cleanup_hw: 152 goto out;
116 random_fd = -1;
117 goto out;
118} 153}
119 154
120/* 155/*
@@ -122,6 +157,7 @@ static int __init rng_init (void)
122 */ 157 */
123static void __exit rng_cleanup (void) 158static void __exit rng_cleanup (void)
124{ 159{
160 os_close_file(random_fd);
125 misc_deregister (&rng_miscdev); 161 misc_deregister (&rng_miscdev);
126} 162}
127 163
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 8b80505a3fb0..a1c2d2c98a94 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -96,7 +96,7 @@ static int slip_tramp(char **argv, int fd)
96 pid = err; 96 pid = err;
97 97
98 output_len = UM_KERN_PAGE_SIZE; 98 output_len = UM_KERN_PAGE_SIZE;
99 output = kmalloc(output_len, UM_GFP_KERNEL); 99 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
100 if (output == NULL) { 100 if (output == NULL) {
101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output " 101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output "
102 "buffer\n"); 102 "buffer\n");
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index c930fedc5172..495858a090e4 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
29 } 29 }
30 str++; 30 str++;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 *data = ((struct tty_chan) { .dev = str, 35 *data = ((struct tty_chan) { .dev = str,
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 5e45e39a8a8d..b58fb8941d8d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -49,7 +49,6 @@
49#include "irq_user.h" 49#include "irq_user.h"
50#include "irq_kern.h" 50#include "irq_kern.h"
51#include "ubd_user.h" 51#include "ubd_user.h"
52#include "kern_util.h"
53#include "os.h" 52#include "os.h"
54#include "mem.h" 53#include "mem.h"
55#include "mem_kern.h" 54#include "mem_kern.h"
@@ -1178,8 +1177,8 @@ static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
1178 * by one word. Thanks to Lynn Kerby for the fix and James McMechan 1177 * by one word. Thanks to Lynn Kerby for the fix and James McMechan
1179 * for the original diagnosis. 1178 * for the original diagnosis.
1180 */ 1179 */
1181 if(*cow_offset == ((bitmap_len + sizeof(unsigned long) - 1) / 1180 if (*cow_offset == (DIV_ROUND_UP(bitmap_len,
1182 sizeof(unsigned long) - 1)) 1181 sizeof(unsigned long)) - 1))
1183 (*cow_offset)--; 1182 (*cow_offset)--;
1184 1183
1185 bitmap_words[0] = bitmap[*cow_offset]; 1184 bitmap_words[0] = bitmap[*cow_offset];
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 8a1c18a9b240..da2caa5a21ef 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -30,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
30{ 30{
31 struct xterm_chan *data; 31 struct xterm_chan *data;
32 32
33 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 33 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
34 if (data == NULL) 34 if (data == NULL)
35 return NULL; 35 return NULL;
36 *data = ((struct xterm_chan) { .pid = -1, 36 *data = ((struct xterm_chan) { .pid = -1,
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h
index cac542d8ff70..58e852dfb0ce 100644
--- a/arch/um/include/as-layout.h
+++ b/arch/um/include/as-layout.h
@@ -23,16 +23,16 @@
23 */ 23 */
24 24
25#ifdef __ASSEMBLY__ 25#ifdef __ASSEMBLY__
26#define _AC(X, Y) (Y) 26#define _UML_AC(X, Y) (Y)
27#else 27#else
28#define __AC(X, Y) (X (Y)) 28#define __UML_AC(X, Y) (X(Y))
29#define _AC(X, Y) __AC(X, Y) 29#define _UML_AC(X, Y) __UML_AC(X, Y)
30#endif 30#endif
31 31
32#define STUB_START _AC(, 0x100000) 32#define STUB_START _UML_AC(, 0x100000)
33#define STUB_CODE _AC((unsigned long), STUB_START) 33#define STUB_CODE _UML_AC((unsigned long), STUB_START)
34#define STUB_DATA _AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE) 34#define STUB_DATA _UML_AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE)
35#define STUB_END _AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE) 35#define STUB_END _UML_AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE)
36 36
37#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
38 38
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 979b73e6352d..311a0d3d93af 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -58,11 +58,11 @@ struct line {
58}; 58};
59 59
60#define LINE_INIT(str, d) \ 60#define LINE_INIT(str, d) \
61 { .count_lock = SPIN_LOCK_UNLOCKED, \ 61 { .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
62 .init_str = str, \ 62 .init_str = str, \
63 .init_pri = INIT_STATIC, \ 63 .init_pri = INIT_STATIC, \
64 .valid = 1, \ 64 .valid = 1, \
65 .lock = SPIN_LOCK_UNLOCKED, \ 65 .lock = __SPIN_LOCK_UNLOCKED((str).lock), \
66 .driver = d } 66 .driver = d }
67 67
68extern void line_close(struct tty_struct *tty, struct file * filp); 68extern void line_close(struct tty_struct *tty, struct file * filp);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 32c799e3a495..db5be46e3e18 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -290,6 +290,7 @@ extern void os_set_ioignore(void);
290extern int add_sigio_fd(int fd); 290extern int add_sigio_fd(int fd);
291extern int ignore_sigio_fd(int fd); 291extern int ignore_sigio_fd(int fd);
292extern void maybe_sigio_broken(int fd, int read); 292extern void maybe_sigio_broken(int fd, int read);
293extern void sigio_broken(int fd, int read);
293 294
294/* sys-x86_64/prctl.c */ 295/* sys-x86_64/prctl.c */
295extern int os_arch_prctl(int pid, int code, unsigned long *addr); 296extern int os_arch_prctl(int pid, int code, unsigned long *addr);
@@ -298,6 +299,6 @@ extern int os_arch_prctl(int pid, int code, unsigned long *addr);
298extern int get_pty(void); 299extern int get_pty(void);
299 300
300/* sys-$ARCH/task_size.c */ 301/* sys-$ARCH/task_size.c */
301extern unsigned long os_get_task_size(void); 302extern unsigned long os_get_top_address(void);
302 303
303#endif 304#endif
diff --git a/arch/um/include/process.h b/arch/um/include/process.h
index 5af9157ff54f..bb873a51262e 100644
--- a/arch/um/include/process.h
+++ b/arch/um/include/process.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -8,18 +8,10 @@
8 8
9#include <signal.h> 9#include <signal.h>
10 10
11extern void sig_handler(int sig, struct sigcontext sc); 11/* Copied from linux/compiler-gcc.h since we can't include it directly */
12extern void alarm_handler(int sig, struct sigcontext sc); 12#define barrier() __asm__ __volatile__("": : :"memory")
13 13
14#endif 14extern void sig_handler(int sig, struct sigcontext *sc);
15extern void alarm_handler(int sig, struct sigcontext *sc);
15 16
16/* 17#endif
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/skas_ptrace.h b/arch/um/include/skas_ptrace.h
index cd2327d09c8d..3d31bbacd016 100644
--- a/arch/um/include/skas_ptrace.h
+++ b/arch/um/include/skas_ptrace.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -12,14 +12,3 @@
12#include "sysdep/skas_ptrace.h" 12#include "sysdep/skas_ptrace.h"
13 13
14#endif 14#endif
15
16/*
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
index 75650723c38f..ef56247e4143 100644
--- a/arch/um/include/sysdep-i386/ptrace_user.h
+++ b/arch/um/include/sysdep-i386/ptrace_user.h
@@ -41,38 +41,10 @@
41#define PT_SP_OFFSET PT_OFFSET(UESP) 41#define PT_SP_OFFSET PT_OFFSET(UESP)
42#define PT_SP(regs) ((regs)[UESP]) 42#define PT_SP(regs) ((regs)[UESP])
43 43
44#define FP_SIZE ((HOST_XFP_SIZE > HOST_FP_SIZE) ? HOST_XFP_SIZE : HOST_FP_SIZE) 44#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
45 45
46#ifndef FRAME_SIZE 46#ifndef FRAME_SIZE
47#define FRAME_SIZE (17) 47#define FRAME_SIZE (17)
48#endif 48#endif
49#define FRAME_SIZE_OFFSET (FRAME_SIZE * sizeof(unsigned long))
50
51#define FP_FRAME_SIZE (27)
52#define FPX_FRAME_SIZE (128)
53
54#ifdef PTRACE_GETREGS
55#define UM_HAVE_GETREGS
56#endif
57
58#ifdef PTRACE_SETREGS
59#define UM_HAVE_SETREGS
60#endif
61
62#ifdef PTRACE_GETFPREGS
63#define UM_HAVE_GETFPREGS
64#endif
65
66#ifdef PTRACE_SETFPREGS
67#define UM_HAVE_SETFPREGS
68#endif
69
70#ifdef PTRACE_GETFPXREGS
71#define UM_HAVE_GETFPXREGS
72#endif
73
74#ifdef PTRACE_SETFPXREGS
75#define UM_HAVE_SETFPXREGS
76#endif
77 49
78#endif 50#endif
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
index 67e77122aa45..f583c87111a0 100644
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -10,7 +10,7 @@
10 10
11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2) 11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
12 12
13#define GET_FAULTINFO_FROM_SC(fi,sc) \ 13#define GET_FAULTINFO_FROM_SC(fi, sc) \
14 { \ 14 { \
15 (fi).cr2 = SC_CR2(sc); \ 15 (fi).cr2 = SC_CR2(sc); \
16 (fi).error_code = SC_ERR(sc); \ 16 (fi).error_code = SC_ERR(sc); \
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h
index 45c0bd881cb3..4dbccdb58f48 100644
--- a/arch/um/include/sysdep-x86_64/ptrace_user.h
+++ b/arch/um/include/sysdep-x86_64/ptrace_user.h
@@ -48,7 +48,8 @@
48#define PT_ORIG_RAX_OFFSET (ORIG_RAX) 48#define PT_ORIG_RAX_OFFSET (ORIG_RAX)
49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)]) 49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)])
50 50
51/* x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though 51/*
52 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
52 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the 53 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
53 * 2.4 name and value for 2.4 host compatibility. 54 * 2.4 name and value for 2.4 host compatibility.
54 */ 55 */
@@ -56,7 +57,8 @@
56#define PTRACE_OLDSETOPTIONS 21 57#define PTRACE_OLDSETOPTIONS 21
57#endif 58#endif
58 59
59/* These are before the system call, so the system call number is RAX 60/*
61 * These are before the system call, so the system call number is RAX
60 * rather than ORIG_RAX, and arg4 is R10 rather than RCX 62 * rather than ORIG_RAX, and arg4 is R10 rather than RCX
61 */ 63 */
62#define REGS_SYSCALL_NR PT_INDEX(RAX) 64#define REGS_SYSCALL_NR PT_INDEX(RAX)
@@ -73,14 +75,3 @@
73#define FP_SIZE (HOST_FP_SIZE) 75#define FP_SIZE (HOST_FP_SIZE)
74 76
75#endif 77#endif
76
77/*
78 * Overrides for Emacs so that we follow Linus's tabbing style.
79 * Emacs will notice this stuff at the end of the file and automatically
80 * adjust the settings for this buffer only. This must remain at the end
81 * of the file.
82 * ---------------------------------------------------------------------------
83 * Local variables:
84 * c-file-style: "linux"
85 * End:
86 */
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h
index 0ad17cb83d96..c554d706d106 100644
--- a/arch/um/include/um_malloc.h
+++ b/arch/um/include/um_malloc.h
@@ -8,15 +8,12 @@
8 8
9#include "kern_constants.h" 9#include "kern_constants.h"
10 10
11extern void *__kmalloc(int size, int flags); 11extern void *uml_kmalloc(int size, int flags);
12static inline void *kmalloc(int size, int flags)
13{
14 return __kmalloc(size, flags);
15}
16
17extern void kfree(const void *ptr); 12extern void kfree(const void *ptr);
18 13
19extern void *vmalloc(unsigned long size); 14extern void *vmalloc(unsigned long size);
20extern void vfree(void *ptr); 15extern void vfree(void *ptr);
21 16
22#endif /* __UM_MALLOC_H__ */ 17#endif /* __UM_MALLOC_H__ */
18
19
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 26090b7f323e..9975e1ab44fb 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
4OUTPUT_ARCH(ELF_ARCH) 5OUTPUT_ARCH(ELF_ARCH)
@@ -21,7 +22,7 @@ SECTIONS
21 _einittext = .; 22 _einittext = .;
22 } 23 }
23 24
24 . = ALIGN(4096); 25 . = ALIGN(PAGE_SIZE);
25 26
26 /* Read-only sections, merged into text segment: */ 27 /* Read-only sections, merged into text segment: */
27 .hash : { *(.hash) } 28 .hash : { *(.hash) }
@@ -68,9 +69,9 @@ SECTIONS
68 /* .gnu.warning sections are handled specially by elf32.em. */ 69 /* .gnu.warning sections are handled specially by elf32.em. */
69 *(.gnu.warning) 70 *(.gnu.warning)
70 71
71 . = ALIGN(4096); 72 . = ALIGN(PAGE_SIZE);
72 } =0x90909090 73 } =0x90909090
73 . = ALIGN(4096); 74 . = ALIGN(PAGE_SIZE);
74 .syscall_stub : { 75 .syscall_stub : {
75 __syscall_stub_start = .; 76 __syscall_stub_start = .;
76 *(.__syscall_stub*) 77 *(.__syscall_stub*)
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index dcfceca95052..910eda8fca18 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -12,7 +12,6 @@
12 12
13static struct fs_struct init_fs = INIT_FS; 13static struct fs_struct init_fs = INIT_FS;
14struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
15static struct files_struct init_files = INIT_FILES;
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18EXPORT_SYMBOL(init_mm); 17EXPORT_SYMBOL(init_mm);
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 66e2a305a8d6..ccc02a616c22 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -60,6 +60,11 @@ EXPORT_SYMBOL(os_rcv_fd);
60EXPORT_SYMBOL(run_helper); 60EXPORT_SYMBOL(run_helper);
61EXPORT_SYMBOL(start_thread); 61EXPORT_SYMBOL(start_thread);
62 62
63EXPORT_SYMBOL(add_sigio_fd);
64EXPORT_SYMBOL(ignore_sigio_fd);
65EXPORT_SYMBOL(deactivate_fd);
66EXPORT_SYMBOL(sigio_broken);
67
63#ifdef CONFIG_SMP 68#ifdef CONFIG_SMP
64 69
65/* required for SMP */ 70/* required for SMP */
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 2eea1ff235e6..b0ee64622ff7 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -375,3 +375,8 @@ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
375 return pmd; 375 return pmd;
376} 376}
377#endif 377#endif
378
379void *uml_kmalloc(int size, int flags)
380{
381 return kmalloc(size, flags);
382}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 0d0cea2ac98d..c3e2f369c33c 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -75,7 +75,7 @@ static irqreturn_t um_timer(int irq, void *dev)
75 75
76static cycle_t itimer_read(void) 76static cycle_t itimer_read(void)
77{ 77{
78 return os_nsecs(); 78 return os_nsecs() / 1000;
79} 79}
80 80
81static struct clocksource itimer_clocksource = { 81static struct clocksource itimer_clocksource = {
@@ -83,7 +83,7 @@ static struct clocksource itimer_clocksource = {
83 .rating = 300, 83 .rating = 300,
84 .read = itimer_read, 84 .read = itimer_read,
85 .mask = CLOCKSOURCE_MASK(64), 85 .mask = CLOCKSOURCE_MASK(64),
86 .mult = 1, 86 .mult = 1000,
87 .shift = 0, 87 .shift = 0,
88 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 88 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
89}; 89};
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 56deed623446..8d84250324b3 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -150,7 +150,7 @@ __uml_setup("root=", uml_root_setup,
150static int __init no_skas_debug_setup(char *line, int *add) 150static int __init no_skas_debug_setup(char *line, int *add)
151{ 151{
152 printf("'debug' is not necessary to gdb UML in skas mode - run \n"); 152 printf("'debug' is not necessary to gdb UML in skas mode - run \n");
153 printf("'gdb linux'"); 153 printf("'gdb linux'\n");
154 154
155 return 0; 155 return 0;
156} 156}
@@ -258,6 +258,7 @@ int __init linux_main(int argc, char **argv)
258{ 258{
259 unsigned long avail, diff; 259 unsigned long avail, diff;
260 unsigned long virtmem_size, max_physmem; 260 unsigned long virtmem_size, max_physmem;
261 unsigned long stack;
261 unsigned int i; 262 unsigned int i;
262 int add; 263 int add;
263 char * mode; 264 char * mode;
@@ -273,7 +274,7 @@ int __init linux_main(int argc, char **argv)
273 if (have_root == 0) 274 if (have_root == 0)
274 add_arg(DEFAULT_COMMAND_LINE); 275 add_arg(DEFAULT_COMMAND_LINE);
275 276
276 host_task_size = os_get_task_size(); 277 host_task_size = os_get_top_address();
277 /* 278 /*
278 * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps 279 * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps
279 * out 280 * out
@@ -348,7 +349,9 @@ int __init linux_main(int argc, char **argv)
348 } 349 }
349 350
350 virtmem_size = physmem_size; 351 virtmem_size = physmem_size;
351 avail = TASK_SIZE - start_vm; 352 stack = (unsigned long) argv;
353 stack &= ~(1024 * 1024 - 1);
354 avail = stack - start_vm;
352 if (physmem_size > avail) 355 if (physmem_size > avail)
353 virtmem_size = avail; 356 virtmem_size = avail;
354 end_vm = start_vm + virtmem_size; 357 end_vm = start_vm + virtmem_size;
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 5828c1d54505..11b835248b86 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
4OUTPUT_ARCH(ELF_ARCH) 5OUTPUT_ARCH(ELF_ARCH)
@@ -26,7 +27,7 @@ SECTIONS
26 INIT_TEXT 27 INIT_TEXT
27 _einittext = .; 28 _einittext = .;
28 } 29 }
29 . = ALIGN(4096); 30 . = ALIGN(PAGE_SIZE);
30 31
31 .text : 32 .text :
32 { 33 {
@@ -39,7 +40,7 @@ SECTIONS
39 *(.gnu.linkonce.t*) 40 *(.gnu.linkonce.t*)
40 } 41 }
41 42
42 . = ALIGN(4096); 43 . = ALIGN(PAGE_SIZE);
43 .syscall_stub : { 44 .syscall_stub : {
44 __syscall_stub_start = .; 45 __syscall_stub_start = .;
45 *(.__syscall_stub*) 46 *(.__syscall_stub*)
@@ -79,7 +80,7 @@ SECTIONS
79 .sdata : { *(.sdata) } 80 .sdata : { *(.sdata) }
80 _edata = .; 81 _edata = .;
81 PROVIDE (edata = .); 82 PROVIDE (edata = .);
82 . = ALIGN(0x1000); 83 . = ALIGN(PAGE_SIZE);
83 .sbss : 84 .sbss :
84 { 85 {
85 __bss_start = .; 86 __bss_start = .;
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index 6fb0b174f538..cc72cb2c1af6 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -52,7 +52,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
52 return; 52 return;
53 } 53 }
54 54
55 output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL); 55 output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
56 if (output == NULL) 56 if (output == NULL)
57 printk(UM_KERN_ERR "etap_change : Failed to allocate output " 57 printk(UM_KERN_ERR "etap_change : Failed to allocate output "
58 "buffer\n"); 58 "buffer\n");
@@ -165,7 +165,7 @@ static int etap_open(void *data)
165 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], 165 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
166 control_fds[1], data_fds[0], data_fds[1]); 166 control_fds[1], data_fds[0], data_fds[1]);
167 output_len = UM_KERN_PAGE_SIZE; 167 output_len = UM_KERN_PAGE_SIZE;
168 output = kmalloc(output_len, UM_GFP_KERNEL); 168 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
169 read_output(control_fds[0], output, output_len); 169 read_output(control_fds[0], output, output_len);
170 170
171 if (output == NULL) 171 if (output == NULL)
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index f25c29a12d00..30860b89ec58 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -7,6 +7,7 @@
7#include <unistd.h> 7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include <sched.h> 9#include <sched.h>
10#include <linux/limits.h>
10#include <sys/socket.h> 11#include <sys/socket.h>
11#include <sys/wait.h> 12#include <sys/wait.h>
12#include "kern_constants.h" 13#include "kern_constants.h"
@@ -71,8 +72,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
71 data.pre_data = pre_data; 72 data.pre_data = pre_data;
72 data.argv = argv; 73 data.argv = argv;
73 data.fd = fds[1]; 74 data.fd = fds[1];
74 data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) : 75 data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
75 kmalloc(PATH_MAX, UM_GFP_KERNEL); 76 uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
76 pid = clone(helper_child, (void *) sp, CLONE_VM, &data); 77 pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
77 if (pid < 0) { 78 if (pid < 0) {
78 ret = -errno; 79 ret = -errno;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index abb9b0ffd960..eee69b9f52c9 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -199,7 +199,7 @@ void *__wrap_malloc(int size)
199 return __real_malloc(size); 199 return __real_malloc(size);
200 else if (size <= UM_KERN_PAGE_SIZE) 200 else if (size <= UM_KERN_PAGE_SIZE)
201 /* finding contiguous pages can be hard*/ 201 /* finding contiguous pages can be hard*/
202 ret = kmalloc(size, UM_GFP_KERNEL); 202 ret = uml_kmalloc(size, UM_GFP_KERNEL);
203 else ret = vmalloc(size); 203 else ret = vmalloc(size);
204 204
205 /* 205 /*
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index abf47a7c4abd..eb8f2e4be192 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -15,6 +15,7 @@
15#include "kern_util.h" 15#include "kern_util.h"
16#include "init.h" 16#include "init.h"
17#include "os.h" 17#include "os.h"
18#include "process.h"
18#include "sigio.h" 19#include "sigio.h"
19#include "um_malloc.h" 20#include "um_malloc.h"
20#include "user.h" 21#include "user.h"
@@ -109,7 +110,7 @@ static int need_poll(struct pollfds *polls, int n)
109 if (n <= polls->size) 110 if (n <= polls->size)
110 return 0; 111 return 0;
111 112
112 new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC); 113 new = uml_kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
113 if (new == NULL) { 114 if (new == NULL) {
114 printk(UM_KERN_ERR "need_poll : failed to allocate new " 115 printk(UM_KERN_ERR "need_poll : failed to allocate new "
115 "pollfds\n"); 116 "pollfds\n");
@@ -243,7 +244,7 @@ static struct pollfd *setup_initial_poll(int fd)
243{ 244{
244 struct pollfd *p; 245 struct pollfd *p;
245 246
246 p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL); 247 p = uml_kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
247 if (p == NULL) { 248 if (p == NULL) {
248 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate " 249 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate "
249 "poll\n"); 250 "poll\n");
@@ -338,20 +339,10 @@ out_close1:
338 close(l_write_sigio_fds[1]); 339 close(l_write_sigio_fds[1]);
339} 340}
340 341
341/* Changed during early boot */ 342void sigio_broken(int fd, int read)
342static int pty_output_sigio = 0;
343static int pty_close_sigio = 0;
344
345void maybe_sigio_broken(int fd, int read)
346{ 343{
347 int err; 344 int err;
348 345
349 if (!isatty(fd))
350 return;
351
352 if ((read || pty_output_sigio) && (!read || pty_close_sigio))
353 return;
354
355 write_sigio_workaround(); 346 write_sigio_workaround();
356 347
357 sigio_lock(); 348 sigio_lock();
@@ -370,6 +361,21 @@ out:
370 sigio_unlock(); 361 sigio_unlock();
371} 362}
372 363
364/* Changed during early boot */
365static int pty_output_sigio;
366static int pty_close_sigio;
367
368void maybe_sigio_broken(int fd, int read)
369{
370 if (!isatty(fd))
371 return;
372
373 if ((read || pty_output_sigio) && (!read || pty_close_sigio))
374 return;
375
376 sigio_broken(fd, read);
377}
378
373static void sigio_cleanup(void) 379static void sigio_cleanup(void)
374{ 380{
375 if (write_sigio_pid == -1) 381 if (write_sigio_pid == -1)
@@ -383,7 +389,7 @@ static void sigio_cleanup(void)
383__uml_exitcall(sigio_cleanup); 389__uml_exitcall(sigio_cleanup);
384 390
385/* Used as a flag during SIGIO testing early in boot */ 391/* Used as a flag during SIGIO testing early in boot */
386static volatile int got_sigio = 0; 392static int got_sigio;
387 393
388static void __init handler(int sig) 394static void __init handler(int sig)
389{ 395{
@@ -498,7 +504,8 @@ static void tty_output(int master, int slave)
498 if (errno != EAGAIN) 504 if (errno != EAGAIN)
499 printk(UM_KERN_ERR "tty_output : write failed, errno = %d\n", 505 printk(UM_KERN_ERR "tty_output : write failed, errno = %d\n",
500 errno); 506 errno);
501 while (((n = read(slave, buf, sizeof(buf))) > 0) && !got_sigio) 507 while (((n = read(slave, buf, sizeof(buf))) > 0) &&
508 !({ barrier(); got_sigio; }))
502 ; 509 ;
503 510
504 if (got_sigio) { 511 if (got_sigio) {
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 3f1694b134cb..5aade6027e40 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -12,6 +12,7 @@
12#include "as-layout.h" 12#include "as-layout.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "os.h" 14#include "os.h"
15#include "process.h"
15#include "sysdep/barrier.h" 16#include "sysdep/barrier.h"
16#include "sysdep/sigcontext.h" 17#include "sysdep/sigcontext.h"
17#include "user.h" 18#include "user.h"
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 1e8cba6550a9..172ad8f72e12 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -55,7 +55,7 @@ static int ptrace_dump_regs(int pid)
55 * Signals that are OK to receive in the stub - we'll just continue it. 55 * Signals that are OK to receive in the stub - we'll just continue it.
56 * SIGWINCH will happen when UML is inside a detached screen. 56 * SIGWINCH will happen when UML is inside a detached screen.
57 */ 57 */
58#define STUB_SIG_MASK (1 << SIGVTALRM) 58#define STUB_SIG_MASK ((1 << SIGVTALRM) | (1 << SIGWINCH))
59 59
60/* Signals that the stub will finish with - anything else is an error */ 60/* Signals that the stub will finish with - anything else is an error */
61#define STUB_DONE_MASK (1 << SIGTRAP) 61#define STUB_DONE_MASK (1 << SIGTRAP)
@@ -442,7 +442,7 @@ void userspace(struct uml_pt_regs *regs)
442 unblock_signals(); 442 unblock_signals();
443 break; 443 break;
444 default: 444 default:
445 printk(UM_KERN_ERR "userspace - child stopped " 445 printk(UM_KERN_ERR "userspace - child stopped "
446 "with signal %d\n", sig); 446 "with signal %d\n", sig);
447 fatal_sigsegv(); 447 fatal_sigsegv();
448 } 448 }
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 997d01944f91..183db26d01bf 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -23,6 +23,7 @@
23#include "mem_user.h" 23#include "mem_user.h"
24#include "ptrace_user.h" 24#include "ptrace_user.h"
25#include "registers.h" 25#include "registers.h"
26#include "skas.h"
26#include "skas_ptrace.h" 27#include "skas_ptrace.h"
27 28
28static void ptrace_child(void) 29static void ptrace_child(void)
@@ -120,8 +121,10 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
120{ 121{
121 int status, n, ret = 0; 122 int status, n, ret = 0;
122 123
123 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) 124 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) {
124 fatal_perror("stop_ptraced_child : ptrace failed"); 125 perror("stop_ptraced_child : ptrace failed");
126 return -1;
127 }
125 CATCH_EINTR(n = waitpid(pid, &status, 0)); 128 CATCH_EINTR(n = waitpid(pid, &status, 0));
126 if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 129 if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
127 int exit_with = WEXITSTATUS(status); 130 int exit_with = WEXITSTATUS(status);
@@ -140,14 +143,27 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
140} 143}
141 144
142/* Changed only during early boot */ 145/* Changed only during early boot */
143int ptrace_faultinfo = 1; 146int ptrace_faultinfo;
144int ptrace_ldt = 1; 147static int disable_ptrace_faultinfo;
145int proc_mm = 1; 148
146int skas_needs_stub = 0; 149int ptrace_ldt;
150static int disable_ptrace_ldt;
151
152int proc_mm;
153static int disable_proc_mm;
154
155int have_switch_mm;
156static int disable_switch_mm;
157
158int skas_needs_stub;
147 159
148static int __init skas0_cmd_param(char *str, int* add) 160static int __init skas0_cmd_param(char *str, int* add)
149{ 161{
150 ptrace_faultinfo = proc_mm = 0; 162 disable_ptrace_faultinfo = 1;
163 disable_ptrace_ldt = 1;
164 disable_proc_mm = 1;
165 disable_switch_mm = 1;
166
151 return 0; 167 return 0;
152} 168}
153 169
@@ -157,15 +173,12 @@ static int __init mode_skas0_cmd_param(char *str, int* add)
157 __attribute__((alias("skas0_cmd_param"))); 173 __attribute__((alias("skas0_cmd_param")));
158 174
159__uml_setup("skas0", skas0_cmd_param, 175__uml_setup("skas0", skas0_cmd_param,
160 "skas0\n" 176"skas0\n"
161 " Disables SKAS3 usage, so that SKAS0 is used, unless \n" 177" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used\n\n");
162 " you specify mode=tt.\n\n");
163 178
164__uml_setup("mode=skas0", mode_skas0_cmd_param, 179__uml_setup("mode=skas0", mode_skas0_cmd_param,
165 "mode=skas0\n" 180"mode=skas0\n"
166 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n" 181" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used.\n\n");
167 " specify mode=tt. Note that this was recently added - on \n"
168 " older kernels you must use simply \"skas0\".\n\n");
169 182
170/* Changed only during early boot */ 183/* Changed only during early boot */
171static int force_sysemu_disabled = 0; 184static int force_sysemu_disabled = 0;
@@ -201,7 +214,7 @@ static void __init check_sysemu(void)
201 if (n < 0) 214 if (n < 0)
202 fatal_perror("check_sysemu : wait failed"); 215 fatal_perror("check_sysemu : wait failed");
203 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) 216 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
204 fatal("check_sysemu : expected SIGTRAP, got status = %d", 217 fatal("check_sysemu : expected SIGTRAP, got status = %d\n",
205 status); 218 status);
206 219
207 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 220 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
@@ -243,9 +256,11 @@ static void __init check_sysemu(void)
243 256
244 if (WIFSTOPPED(status) && 257 if (WIFSTOPPED(status) &&
245 (WSTOPSIG(status) == (SIGTRAP|0x80))) { 258 (WSTOPSIG(status) == (SIGTRAP|0x80))) {
246 if (!count) 259 if (!count) {
247 fatal("check_ptrace : SYSEMU_SINGLESTEP " 260 non_fatal("check_ptrace : SYSEMU_SINGLESTEP "
248 "doesn't singlestep"); 261 "doesn't singlestep");
262 goto fail;
263 }
249 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, 264 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
250 os_getpid()); 265 os_getpid());
251 if (n < 0) 266 if (n < 0)
@@ -255,9 +270,12 @@ static void __init check_sysemu(void)
255 } 270 }
256 else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP)) 271 else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP))
257 count++; 272 count++;
258 else 273 else {
259 fatal("check_ptrace : expected SIGTRAP or " 274 non_fatal("check_ptrace : expected SIGTRAP or "
260 "(SIGTRAP | 0x80), got status = %d", status); 275 "(SIGTRAP | 0x80), got status = %d\n",
276 status);
277 goto fail;
278 }
261 } 279 }
262 if (stop_ptraced_child(pid, 0, 0) < 0) 280 if (stop_ptraced_child(pid, 0, 0) < 0)
263 goto fail_stopped; 281 goto fail_stopped;
@@ -360,7 +378,7 @@ void __init os_early_checks(void)
360 378
361static int __init noprocmm_cmd_param(char *str, int* add) 379static int __init noprocmm_cmd_param(char *str, int* add)
362{ 380{
363 proc_mm = 0; 381 disable_proc_mm = 1;
364 return 0; 382 return 0;
365} 383}
366 384
@@ -372,7 +390,7 @@ __uml_setup("noprocmm", noprocmm_cmd_param,
372 390
373static int __init noptracefaultinfo_cmd_param(char *str, int* add) 391static int __init noptracefaultinfo_cmd_param(char *str, int* add)
374{ 392{
375 ptrace_faultinfo = 0; 393 disable_ptrace_faultinfo = 1;
376 return 0; 394 return 0;
377} 395}
378 396
@@ -384,7 +402,7 @@ __uml_setup("noptracefaultinfo", noptracefaultinfo_cmd_param,
384 402
385static int __init noptraceldt_cmd_param(char *str, int* add) 403static int __init noptraceldt_cmd_param(char *str, int* add)
386{ 404{
387 ptrace_ldt = 0; 405 disable_ptrace_ldt = 1;
388 return 0; 406 return 0;
389} 407}
390 408
@@ -404,17 +422,15 @@ static inline void check_skas3_ptrace_faultinfo(void)
404 422
405 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 423 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
406 if (n < 0) { 424 if (n < 0) {
407 ptrace_faultinfo = 0;
408 if (errno == EIO) 425 if (errno == EIO)
409 non_fatal("not found\n"); 426 non_fatal("not found\n");
410 else 427 else
411 perror("not found"); 428 perror("not found");
412 } 429 } else if (disable_ptrace_faultinfo)
430 non_fatal("found but disabled on command line\n");
413 else { 431 else {
414 if (!ptrace_faultinfo) 432 ptrace_faultinfo = 1;
415 non_fatal("found but disabled on command line\n"); 433 non_fatal("found\n");
416 else
417 non_fatal("found\n");
418 } 434 }
419 435
420 stop_ptraced_child(pid, 1, 1); 436 stop_ptraced_child(pid, 1, 1);
@@ -437,38 +453,30 @@ static inline void check_skas3_ptrace_ldt(void)
437 if (n < 0) { 453 if (n < 0) {
438 if (errno == EIO) 454 if (errno == EIO)
439 non_fatal("not found\n"); 455 non_fatal("not found\n");
440 else { 456 else
441 perror("not found"); 457 perror("not found");
442 } 458 } else if (disable_ptrace_ldt)
443 ptrace_ldt = 0; 459 non_fatal("found, but use is disabled\n");
444 }
445 else { 460 else {
446 if (ptrace_ldt) 461 ptrace_ldt = 1;
447 non_fatal("found\n"); 462 non_fatal("found\n");
448 else
449 non_fatal("found, but use is disabled\n");
450 } 463 }
451 464
452 stop_ptraced_child(pid, 1, 1); 465 stop_ptraced_child(pid, 1, 1);
453#else
454 /* PTRACE_LDT might be disabled via cmdline option.
455 * We want to override this, else we might use the stub
456 * without real need
457 */
458 ptrace_ldt = 1;
459#endif 466#endif
460} 467}
461 468
462static inline void check_skas3_proc_mm(void) 469static inline void check_skas3_proc_mm(void)
463{ 470{
464 non_fatal(" - /proc/mm..."); 471 non_fatal(" - /proc/mm...");
465 if (access("/proc/mm", W_OK) < 0) { 472 if (access("/proc/mm", W_OK) < 0)
466 proc_mm = 0;
467 perror("not found"); 473 perror("not found");
468 } 474 else if (disable_proc_mm)
469 else if (!proc_mm)
470 non_fatal("found but disabled on command line\n"); 475 non_fatal("found but disabled on command line\n");
471 else non_fatal("found\n"); 476 else {
477 proc_mm = 1;
478 non_fatal("found\n");
479 }
472} 480}
473 481
474void can_do_skas(void) 482void can_do_skas(void)
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index b613473b3ec1..229f7a53d8da 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -5,6 +5,8 @@
5 */ 5 */
6 6
7#include <errno.h> 7#include <errno.h>
8#include <sys/ptrace.h>
9#include <sys/user.h>
8#include "kern_constants.h" 10#include "kern_constants.h"
9#include "longjmp.h" 11#include "longjmp.h"
10#include "user.h" 12#include "user.h"
@@ -74,10 +76,10 @@ int put_fp_registers(int pid, unsigned long *regs)
74 76
75void arch_init_registers(int pid) 77void arch_init_registers(int pid)
76{ 78{
77 unsigned long fpx_regs[HOST_XFP_SIZE]; 79 struct user_fpxregs_struct fpx_regs;
78 int err; 80 int err;
79 81
80 err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs); 82 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs);
81 if (!err) 83 if (!err)
82 return; 84 return;
83 85
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-i386/task_size.c
index ccb49b0aff59..be04c1e183bf 100644
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ b/arch/um/os-Linux/sys-i386/task_size.c
@@ -63,7 +63,7 @@ static int page_ok(unsigned long page)
63 return ok; 63 return ok;
64} 64}
65 65
66unsigned long os_get_task_size(void) 66unsigned long os_get_top_address(void)
67{ 67{
68 struct sigaction sa, old; 68 struct sigaction sa, old;
69 unsigned long bottom = 0; 69 unsigned long bottom = 0;
@@ -76,9 +76,9 @@ unsigned long os_get_task_size(void)
76 * hosts, but shouldn't hurt otherwise. 76 * hosts, but shouldn't hurt otherwise.
77 */ 77 */
78 unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT; 78 unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT;
79 unsigned long test; 79 unsigned long test, original;
80 80
81 printf("Locating the top of the address space ... "); 81 printf("Locating the bottom of the address space ... ");
82 fflush(stdout); 82 fflush(stdout);
83 83
84 /* 84 /*
@@ -89,16 +89,31 @@ unsigned long os_get_task_size(void)
89 sigemptyset(&sa.sa_mask); 89 sigemptyset(&sa.sa_mask);
90 sa.sa_flags = SA_NODEFER; 90 sa.sa_flags = SA_NODEFER;
91 if (sigaction(SIGSEGV, &sa, &old)) { 91 if (sigaction(SIGSEGV, &sa, &old)) {
92 perror("os_get_task_size"); 92 perror("os_get_top_address");
93 exit(1); 93 exit(1);
94 } 94 }
95 95
96 if (!page_ok(bottom)) { 96 /* Manually scan the address space, bottom-up, until we find
97 fprintf(stderr, "Address 0x%x no good?\n", 97 * the first valid page (or run out of them).
98 bottom << UM_KERN_PAGE_SHIFT); 98 */
99 for (bottom = 0; bottom < top; bottom++) {
100 if (page_ok(bottom))
101 break;
102 }
103
104 /* If we've got this far, we ran out of pages. */
105 if (bottom == top) {
106 fprintf(stderr, "Unable to determine bottom of address "
107 "space.\n");
99 exit(1); 108 exit(1);
100 } 109 }
101 110
111 printf("0x%x\n", bottom << UM_KERN_PAGE_SHIFT);
112 printf("Locating the top of the address space ... ");
113 fflush(stdout);
114
115 original = bottom;
116
102 /* This could happen with a 4G/4G split */ 117 /* This could happen with a 4G/4G split */
103 if (page_ok(top)) 118 if (page_ok(top))
104 goto out; 119 goto out;
@@ -114,7 +129,7 @@ unsigned long os_get_task_size(void)
114out: 129out:
115 /* Restore the old SIGSEGV handling */ 130 /* Restore the old SIGSEGV handling */
116 if (sigaction(SIGSEGV, &old, NULL)) { 131 if (sigaction(SIGSEGV, &old, NULL)) {
117 perror("os_get_task_size"); 132 perror("os_get_top_address");
118 exit(1); 133 exit(1);
119 } 134 }
120 top <<= UM_KERN_PAGE_SHIFT; 135 top <<= UM_KERN_PAGE_SHIFT;
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c
index fad6f57f8ee3..26a0dd1f349c 100644
--- a/arch/um/os-Linux/sys-x86_64/task_size.c
+++ b/arch/um/os-Linux/sys-x86_64/task_size.c
@@ -1,4 +1,4 @@
1unsigned long os_get_task_size(unsigned long shift) 1unsigned long os_get_top_address(unsigned long shift)
2{ 2{
3 /* The old value of CONFIG_TOP_ADDR */ 3 /* The old value of CONFIG_TOP_ADDR */
4 return 0x7fc0000000; 4 return 0x7fc0000000;
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index e49280599465..dec5678fc17f 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -9,7 +9,9 @@
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include "kern_constants.h" 11#include "kern_constants.h"
12#include "kern_util.h"
12#include "os.h" 13#include "os.h"
14#include "process.h"
13#include "user.h" 15#include "user.h"
14 16
15int set_interval(void) 17int set_interval(void)
@@ -58,12 +60,17 @@ static inline long long timeval_to_ns(const struct timeval *tv)
58long long disable_timer(void) 60long long disable_timer(void)
59{ 61{
60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); 62 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
63 int remain, max = UM_NSEC_PER_SEC / UM_HZ;
61 64
62 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) 65 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
63 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 66 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
64 "errno = %d\n", errno); 67 "errno = %d\n", errno);
65 68
66 return timeval_to_ns(&time.it_value); 69 remain = timeval_to_ns(&time.it_value);
70 if (remain > max)
71 remain = max;
72
73 return remain;
67} 74}
68 75
69long long os_nsecs(void) 76long long os_nsecs(void)
@@ -79,7 +86,48 @@ static int after_sleep_interval(struct timespec *ts)
79{ 86{
80 return 0; 87 return 0;
81} 88}
89
90static void deliver_alarm(void)
91{
92 alarm_handler(SIGVTALRM, NULL);
93}
94
95static unsigned long long sleep_time(unsigned long long nsecs)
96{
97 return nsecs;
98}
99
82#else 100#else
101unsigned long long last_tick;
102unsigned long long skew;
103
104static void deliver_alarm(void)
105{
106 unsigned long long this_tick = os_nsecs();
107 int one_tick = UM_NSEC_PER_SEC / UM_HZ;
108
109 /* Protection against the host's time going backwards */
110 if ((last_tick != 0) && (this_tick < last_tick))
111 this_tick = last_tick;
112
113 if (last_tick == 0)
114 last_tick = this_tick - one_tick;
115
116 skew += this_tick - last_tick;
117
118 while (skew >= one_tick) {
119 alarm_handler(SIGVTALRM, NULL);
120 skew -= one_tick;
121 }
122
123 last_tick = this_tick;
124}
125
126static unsigned long long sleep_time(unsigned long long nsecs)
127{
128 return nsecs > skew ? nsecs - skew : 0;
129}
130
83static inline long long timespec_to_us(const struct timespec *ts) 131static inline long long timespec_to_us(const struct timespec *ts)
84{ 132{
85 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) + 133 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
@@ -102,6 +150,11 @@ static int after_sleep_interval(struct timespec *ts)
102 */ 150 */
103 if (start_usecs > usec) 151 if (start_usecs > usec)
104 start_usecs = usec; 152 start_usecs = usec;
153
154 start_usecs -= skew / UM_NSEC_PER_USEC;
155 if (start_usecs < 0)
156 start_usecs = 0;
157
105 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, 158 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC,
106 .tv_usec = start_usecs % UM_USEC_PER_SEC }); 159 .tv_usec = start_usecs % UM_USEC_PER_SEC });
107 interval = ((struct itimerval) { { 0, usec }, tv }); 160 interval = ((struct itimerval) { { 0, usec }, tv });
@@ -113,8 +166,6 @@ static int after_sleep_interval(struct timespec *ts)
113} 166}
114#endif 167#endif
115 168
116extern void alarm_handler(int sig, struct sigcontext *sc);
117
118void idle_sleep(unsigned long long nsecs) 169void idle_sleep(unsigned long long nsecs)
119{ 170{
120 struct timespec ts; 171 struct timespec ts;
@@ -126,10 +177,12 @@ void idle_sleep(unsigned long long nsecs)
126 */ 177 */
127 if (nsecs == 0) 178 if (nsecs == 0)
128 nsecs = UM_NSEC_PER_SEC / UM_HZ; 179 nsecs = UM_NSEC_PER_SEC / UM_HZ;
180
181 nsecs = sleep_time(nsecs);
129 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC, 182 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
130 .tv_nsec = nsecs % UM_NSEC_PER_SEC }); 183 .tv_nsec = nsecs % UM_NSEC_PER_SEC });
131 184
132 if (nanosleep(&ts, &ts) == 0) 185 if (nanosleep(&ts, &ts) == 0)
133 alarm_handler(SIGVTALRM, NULL); 186 deliver_alarm();
134 after_sleep_interval(&ts); 187 after_sleep_interval(&ts);
135} 188}
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 6b4499906a6c..c9b176534d65 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -148,14 +148,13 @@ int peek_user(struct task_struct *child, long addr, long data)
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 long fpregs[HOST_FP_SIZE]; 151 struct user_i387_struct fpregs;
152 152
153 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 153 err = save_fp_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
154 err = save_fp_registers(userspace_pid[cpu], fpregs);
155 if (err) 154 if (err)
156 return err; 155 return err;
157 156
158 n = copy_to_user(buf, fpregs, sizeof(fpregs)); 157 n = copy_to_user(buf, &fpregs, sizeof(fpregs));
159 if(n > 0) 158 if(n > 0)
160 return -EFAULT; 159 return -EFAULT;
161 160
@@ -165,27 +164,26 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
165int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 164int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
166{ 165{
167 int n, cpu = ((struct thread_info *) child->stack)->cpu; 166 int n, cpu = ((struct thread_info *) child->stack)->cpu;
168 long fpregs[HOST_FP_SIZE]; 167 struct user_i387_struct fpregs;
169 168
170 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 169 n = copy_from_user(&fpregs, buf, sizeof(fpregs));
171 n = copy_from_user(fpregs, buf, sizeof(fpregs));
172 if (n > 0) 170 if (n > 0)
173 return -EFAULT; 171 return -EFAULT;
174 172
175 return restore_fp_registers(userspace_pid[cpu], fpregs); 173 return restore_fp_registers(userspace_pid[cpu],
174 (unsigned long *) &fpregs);
176} 175}
177 176
178int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 177int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
179{ 178{
180 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
181 long fpregs[HOST_XFP_SIZE]; 180 struct user_fxsr_struct fpregs;
182 181
183 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 182 err = save_fpx_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
184 err = save_fpx_registers(userspace_pid[cpu], fpregs);
185 if (err) 183 if (err)
186 return err; 184 return err;
187 185
188 n = copy_to_user(buf, fpregs, sizeof(fpregs)); 186 n = copy_to_user(buf, &fpregs, sizeof(fpregs));
189 if(n > 0) 187 if(n > 0)
190 return -EFAULT; 188 return -EFAULT;
191 189
@@ -195,14 +193,14 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
195int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 193int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
196{ 194{
197 int n, cpu = ((struct thread_info *) child->stack)->cpu; 195 int n, cpu = ((struct thread_info *) child->stack)->cpu;
198 long fpregs[HOST_XFP_SIZE]; 196 struct user_fxsr_struct fpregs;
199 197
200 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 198 n = copy_from_user(&fpregs, buf, sizeof(fpregs));
201 n = copy_from_user(fpregs, buf, sizeof(fpregs));
202 if (n > 0) 199 if (n > 0)
203 return -EFAULT; 200 return -EFAULT;
204 201
205 return restore_fpx_registers(userspace_pid[cpu], fpregs); 202 return restore_fpx_registers(userspace_pid[cpu],
203 (unsigned long *) &fpregs);
206} 204}
207 205
208long subarch_ptrace(struct task_struct *child, long request, long addr, 206long subarch_ptrace(struct task_struct *child, long request, long addr,
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 39bd32bf84f0..5f883bfe773f 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -22,7 +22,7 @@ void foo(void)
22 OFFSET(HOST_SC_CR2, sigcontext, cr2); 22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
23 23
24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); 24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
25 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct)); 25 DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct));
26 26
27 DEFINE(HOST_IP, EIP); 27 DEFINE(HOST_IP, EIP);
28 DEFINE(HOST_SP, UESP); 28 DEFINE(HOST_SP, UESP);
diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c
index 4d7d1a812d8f..1db2fce00948 100644
--- a/arch/um/sys-x86_64/ksyms.c
+++ b/arch/um/sys-x86_64/ksyms.c
@@ -1,5 +1,11 @@
1#include "linux/module.h" 1#include <linux/module.h>
2#include "asm/string.h" 2#include <asm/string.h>
3#include <asm/checksum.h>
3 4
4/*XXX: we need them because they would be exported by x86_64 */ 5/*XXX: we need them because they would be exported by x86_64 */
6#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
7EXPORT_SYMBOL(memcpy);
8#else
5EXPORT_SYMBOL(__memcpy); 9EXPORT_SYMBOL(__memcpy);
10#endif
11EXPORT_SYMBOL(csum_partial);
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 2f3443c6e859..973585414a66 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -24,7 +24,6 @@ void foo(void)
24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); 24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
25 25
26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
27 DEFINE(HOST_XFP_SIZE, 0);
28 DEFINE_LONGS(HOST_RBX, RBX); 27 DEFINE_LONGS(HOST_RBX, RBX);
29 DEFINE_LONGS(HOST_RCX, RCX); 28 DEFINE_LONGS(HOST_RCX, RCX);
30 DEFINE_LONGS(HOST_RDI, RDI); 29 DEFINE_LONGS(HOST_RDI, RDI);
diff --git a/arch/v850/kernel/init_task.c b/arch/v850/kernel/init_task.c
index ed2f93cf7c66..44b274dff33f 100644
--- a/arch/v850/kernel/init_task.c
+++ b/arch/v850/kernel/init_task.c
@@ -21,7 +21,6 @@
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22 22
23static struct fs_struct init_fs = INIT_FS; 23static struct fs_struct init_fs = INIT_FS;
24static struct files_struct init_files = INIT_FILES;
25static struct signal_struct init_signals = INIT_SIGNALS (init_signals); 24static struct signal_struct init_signals = INIT_SIGNALS (init_signals);
26static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 25static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
27struct mm_struct init_mm = INIT_MM (init_mm); 26struct mm_struct init_mm = INIT_MM (init_mm);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fe361ae7ef2f..52e18e6d2ba0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -26,17 +26,10 @@ config X86
26 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 26 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
27 select HAVE_ARCH_KGDB if !X86_VOYAGER 27 select HAVE_ARCH_KGDB if !X86_VOYAGER
28 28
29config DEFCONFIG_LIST 29config ARCH_DEFCONFIG
30 string 30 string
31 depends on X86_32 31 default "arch/x86/configs/i386_defconfig" if X86_32
32 option defconfig_list 32 default "arch/x86/configs/x86_64_defconfig" if X86_64
33 default "arch/x86/configs/i386_defconfig"
34
35config DEFCONFIG_LIST
36 string
37 depends on X86_64
38 option defconfig_list
39 default "arch/x86/configs/x86_64_defconfig"
40 33
41 34
42config GENERIC_LOCKBREAK 35config GENERIC_LOCKBREAK
@@ -1515,13 +1508,13 @@ config PCI_GOMMCONFIG
1515config PCI_GODIRECT 1508config PCI_GODIRECT
1516 bool "Direct" 1509 bool "Direct"
1517 1510
1518config PCI_GOANY
1519 bool "Any"
1520
1521config PCI_GOOLPC 1511config PCI_GOOLPC
1522 bool "OLPC" 1512 bool "OLPC"
1523 depends on OLPC 1513 depends on OLPC
1524 1514
1515config PCI_GOANY
1516 bool "Any"
1517
1525endchoice 1518endchoice
1526 1519
1527config PCI_BIOS 1520config PCI_BIOS
@@ -1538,9 +1531,8 @@ config PCI_MMCONFIG
1538 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1531 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1539 1532
1540config PCI_OLPC 1533config PCI_OLPC
1541 bool 1534 def_bool y
1542 depends on PCI && PCI_GOOLPC 1535 depends on PCI && OLPC && (PCI_GOOLPC || PCI_GOANY)
1543 default y
1544 1536
1545config PCI_DOMAINS 1537config PCI_DOMAINS
1546 def_bool y 1538 def_bool y
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index ac1e31ba4795..18363374d51a 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -6,15 +6,19 @@ config TRACE_IRQFLAGS_SUPPORT
6source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
7 7
8config NONPROMISC_DEVMEM 8config NONPROMISC_DEVMEM
9 bool "Disable promiscuous /dev/mem" 9 bool "Filter access to /dev/mem"
10 help 10 help
11 The /dev/mem file by default only allows userspace access to PCI 11 If this option is left off, you allow userspace access to all
12 space and the BIOS code and data regions. This is sufficient for 12 of memory, including kernel and userspace memory. Accidental
13 dosemu and X and all common users of /dev/mem. With this config 13 access to this is obviously disastrous, but specific access can
14 option, you allow userspace access to all of memory, including 14 be used by people debugging the kernel.
15 kernel and userspace memory. Accidental access to this is 15
16 obviously disasterous, but specific access can be used by people 16 If this option is switched on, the /dev/mem file only allows
17 debugging the kernel. 17 userspace access to PCI space and the BIOS code and data regions.
18 This is sufficient for dosemu and X and all common users of
19 /dev/mem.
20
21 If in doubt, say Y.
18 22
19config EARLY_PRINTK 23config EARLY_PRINTK
20 bool "Early printk" if EMBEDDED 24 bool "Early printk" if EMBEDDED
diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c
index 90943f83e84d..e01aafd03bde 100644
--- a/arch/x86/boot/a20.c
+++ b/arch/x86/boot/a20.c
@@ -115,8 +115,6 @@ static void enable_a20_fast(void)
115 115
116int enable_a20(void) 116int enable_a20(void)
117{ 117{
118 int loops = A20_ENABLE_LOOPS;
119
120#if defined(CONFIG_X86_ELAN) 118#if defined(CONFIG_X86_ELAN)
121 /* Elan croaks if we try to touch the KBC */ 119 /* Elan croaks if we try to touch the KBC */
122 enable_a20_fast(); 120 enable_a20_fast();
@@ -128,6 +126,7 @@ int enable_a20(void)
128 enable_a20_kbc(); 126 enable_a20_kbc();
129 return 0; 127 return 0;
130#else 128#else
129 int loops = A20_ENABLE_LOOPS;
131 while (loops--) { 130 while (loops--) {
132 /* First, check to see if A20 is already enabled 131 /* First, check to see if A20 is already enabled
133 (legacy free, etc.) */ 132 (legacy free, etc.) */
diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c
index c1d00c0274c4..50e47cdbdddd 100644
--- a/arch/x86/boot/printf.c
+++ b/arch/x86/boot/printf.c
@@ -56,7 +56,7 @@ static char *number(char *str, long num, int base, int size, int precision,
56 if (type & LEFT) 56 if (type & LEFT)
57 type &= ~ZEROPAD; 57 type &= ~ZEROPAD;
58 if (base < 2 || base > 36) 58 if (base < 2 || base > 36)
59 return 0; 59 return NULL;
60 c = (type & ZEROPAD) ? '0' : ' '; 60 c = (type & ZEROPAD) ? '0' : ' ';
61 sign = 0; 61 sign = 0;
62 if (type & SIGN) { 62 if (type & SIGN) {
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 671591fcc61d..ff1a7b49a460 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -242,12 +242,19 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
242 242
243static void __cpuinit acpi_register_lapic(int id, u8 enabled) 243static void __cpuinit acpi_register_lapic(int id, u8 enabled)
244{ 244{
245 unsigned int ver = 0;
246
245 if (!enabled) { 247 if (!enabled) {
246 ++disabled_cpus; 248 ++disabled_cpus;
247 return; 249 return;
248 } 250 }
249 251
250 generic_processor_info(id, 0); 252#ifdef CONFIG_X86_32
253 if (boot_cpu_physical_apicid != -1U)
254 ver = apic_version[boot_cpu_physical_apicid];
255#endif
256
257 generic_processor_info(id, ver);
251} 258}
252 259
253static int __init 260static int __init
@@ -765,8 +772,13 @@ static void __init acpi_register_lapic_address(unsigned long address)
765 mp_lapic_addr = address; 772 mp_lapic_addr = address;
766 773
767 set_fixmap_nocache(FIX_APIC_BASE, address); 774 set_fixmap_nocache(FIX_APIC_BASE, address);
768 if (boot_cpu_physical_apicid == -1U) 775 if (boot_cpu_physical_apicid == -1U) {
769 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); 776 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
777#ifdef CONFIG_X86_32
778 apic_version[boot_cpu_physical_apicid] =
779 GET_APIC_VERSION(apic_read(APIC_LVR));
780#endif
781 }
770} 782}
771 783
772static int __init early_acpi_parse_madt_lapic_addr_ovr(void) 784static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.lds.S b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
index 22fab6c4be15..7da00b799cda 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.lds.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
@@ -12,11 +12,6 @@ ENTRY(_start)
12 12
13SECTIONS 13SECTIONS
14{ 14{
15 . = HEADER_OFFSET;
16 .header : {
17 *(.header)
18 }
19
20 . = 0; 15 . = 0;
21 .text : { 16 .text : {
22 *(.text*) 17 *(.text*)
@@ -50,6 +45,11 @@ SECTIONS
50 __bss_end = .; 45 __bss_end = .;
51 } 46 }
52 47
48 . = HEADER_OFFSET;
49 .header : {
50 *(.header)
51 }
52
53 . = ALIGN(16); 53 . = ALIGN(16);
54 _end = .; 54 _end = .;
55 55
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 5910020c3f24..0633cfd0dc29 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -534,7 +534,7 @@ int setup_profiling_timer(unsigned int multiplier)
534 */ 534 */
535void clear_local_APIC(void) 535void clear_local_APIC(void)
536{ 536{
537 int maxlvt = lapic_get_maxlvt(); 537 int maxlvt;
538 u32 v; 538 u32 v;
539 539
540 /* APIC hasn't been mapped yet */ 540 /* APIC hasn't been mapped yet */
diff --git a/arch/x86/kernel/cpu/cpufreq/longrun.c b/arch/x86/kernel/cpu/cpufreq/longrun.c
index af4a867a097c..777a7ff075de 100644
--- a/arch/x86/kernel/cpu/cpufreq/longrun.c
+++ b/arch/x86/kernel/cpu/cpufreq/longrun.c
@@ -245,7 +245,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
245 if ((ecx > 95) || (ecx == 0) || (eax < ebx)) 245 if ((ecx > 95) || (ecx == 0) || (eax < ebx))
246 return -EIO; 246 return -EIO;
247 247
248 edx = (eax - ebx) / (100 - ecx); 248 edx = ((eax - ebx) * 100) / (100 - ecx);
249 *low_freq = edx * 1000; /* back to kHz */ 249 *low_freq = edx * 1000; /* back to kHz */
250 250
251 dprintk("low frequency is %u kHz\n", *low_freq); 251 dprintk("low frequency is %u kHz\n", *low_freq);
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 46d4034d9f37..206791eb46e3 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1127,12 +1127,23 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1127 * an UP version, and is deprecated by AMD. 1127 * an UP version, and is deprecated by AMD.
1128 */ 1128 */
1129 if (num_online_cpus() != 1) { 1129 if (num_online_cpus() != 1) {
1130 printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n"); 1130#ifndef CONFIG_ACPI_PROCESSOR
1131 printk(KERN_ERR PFX "ACPI Processor support is required "
1132 "for SMP systems but is absent. Please load the "
1133 "ACPI Processor module before starting this "
1134 "driver.\n");
1135#else
1136 printk(KERN_ERR PFX "Your BIOS does not provide ACPI "
1137 "_PSS objects in a way that Linux understands. "
1138 "Please report this to the Linux ACPI maintainers"
1139 " and complain to your BIOS vendor.\n");
1140#endif
1131 kfree(data); 1141 kfree(data);
1132 return -ENODEV; 1142 return -ENODEV;
1133 } 1143 }
1134 if (pol->cpu != 0) { 1144 if (pol->cpu != 0) {
1135 printk(KERN_ERR PFX "No _PSS objects for CPU other than CPU0\n"); 1145 printk(KERN_ERR PFX "No ACPI _PSS objects for CPU other than "
1146 "CPU0. Complain to your BIOS vendor.\n");
1136 kfree(data); 1147 kfree(data);
1137 return -ENODEV; 1148 return -ENODEV;
1138 } 1149 }
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 0c7f64b99e17..159a1c76d2bd 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -248,6 +248,7 @@ ENTRY(resume_userspace)
248 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 248 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
249 # setting need_resched or sigpending 249 # setting need_resched or sigpending
250 # between sampling and the iret 250 # between sampling and the iret
251 TRACE_IRQS_OFF
251 movl TI_flags(%ebp), %ecx 252 movl TI_flags(%ebp), %ecx
252 andl $_TIF_WORK_MASK, %ecx # is there any work to be done on 253 andl $_TIF_WORK_MASK, %ecx # is there any work to be done on
253 # int/exception return? 254 # int/exception return?
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index b2cc73768a9d..f7357cc0162c 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -189,7 +189,7 @@ default_entry:
189 * this stage. 189 * this stage.
190 */ 190 */
191 191
192#define KPMDS ((0x100000000-__PAGE_OFFSET) >> 30) /* Number of kernel PMDs */ 192#define KPMDS (((-__PAGE_OFFSET) >> 30) & 3) /* Number of kernel PMDs */
193 193
194 xorl %ebx,%ebx /* %ebx is kept at zero */ 194 xorl %ebx,%ebx /* %ebx is kept at zero */
195 195
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index e03cc952f233..eb9ddd8efb82 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -56,6 +56,11 @@ void __cpuinit mxcsr_feature_mask_init(void)
56 56
57void __init init_thread_xstate(void) 57void __init init_thread_xstate(void)
58{ 58{
59 if (!HAVE_HWFP) {
60 xstate_size = sizeof(struct i387_soft_struct);
61 return;
62 }
63
59 if (cpu_has_fxsr) 64 if (cpu_has_fxsr)
60 xstate_size = sizeof(struct i387_fxsave_struct); 65 xstate_size = sizeof(struct i387_fxsave_struct);
61#ifdef CONFIG_X86_32 66#ifdef CONFIG_X86_32
@@ -94,7 +99,7 @@ void __cpuinit fpu_init(void)
94int init_fpu(struct task_struct *tsk) 99int init_fpu(struct task_struct *tsk)
95{ 100{
96 if (tsk_used_math(tsk)) { 101 if (tsk_used_math(tsk)) {
97 if (tsk == current) 102 if (HAVE_HWFP && tsk == current)
98 unlazy_fpu(tsk); 103 unlazy_fpu(tsk);
99 return 0; 104 return 0;
100 } 105 }
@@ -109,6 +114,15 @@ int init_fpu(struct task_struct *tsk)
109 return -ENOMEM; 114 return -ENOMEM;
110 } 115 }
111 116
117#ifdef CONFIG_X86_32
118 if (!HAVE_HWFP) {
119 memset(tsk->thread.xstate, 0, xstate_size);
120 finit();
121 set_stopped_child_used_math(tsk);
122 return 0;
123 }
124#endif
125
112 if (cpu_has_fxsr) { 126 if (cpu_has_fxsr) {
113 struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; 127 struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave;
114 128
@@ -330,13 +344,13 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,
330 struct user_i387_ia32_struct env; 344 struct user_i387_ia32_struct env;
331 int ret; 345 int ret;
332 346
333 if (!HAVE_HWFP)
334 return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
335
336 ret = init_fpu(target); 347 ret = init_fpu(target);
337 if (ret) 348 if (ret)
338 return ret; 349 return ret;
339 350
351 if (!HAVE_HWFP)
352 return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
353
340 if (!cpu_has_fxsr) { 354 if (!cpu_has_fxsr) {
341 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 355 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
342 &target->thread.xstate->fsave, 0, 356 &target->thread.xstate->fsave, 0,
@@ -360,15 +374,15 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
360 struct user_i387_ia32_struct env; 374 struct user_i387_ia32_struct env;
361 int ret; 375 int ret;
362 376
363 if (!HAVE_HWFP)
364 return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
365
366 ret = init_fpu(target); 377 ret = init_fpu(target);
367 if (ret) 378 if (ret)
368 return ret; 379 return ret;
369 380
370 set_stopped_child_used_math(target); 381 set_stopped_child_used_math(target);
371 382
383 if (!HAVE_HWFP)
384 return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
385
372 if (!cpu_has_fxsr) { 386 if (!cpu_has_fxsr) {
373 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 387 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
374 &target->thread.xstate->fsave, 0, -1); 388 &target->thread.xstate->fsave, 0, -1);
@@ -474,18 +488,18 @@ static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf)
474int restore_i387_ia32(struct _fpstate_ia32 __user *buf) 488int restore_i387_ia32(struct _fpstate_ia32 __user *buf)
475{ 489{
476 int err; 490 int err;
491 struct task_struct *tsk = current;
477 492
478 if (HAVE_HWFP) { 493 if (HAVE_HWFP)
479 struct task_struct *tsk = current;
480
481 clear_fpu(tsk); 494 clear_fpu(tsk);
482 495
483 if (!used_math()) { 496 if (!used_math()) {
484 err = init_fpu(tsk); 497 err = init_fpu(tsk);
485 if (err) 498 if (err)
486 return err; 499 return err;
487 } 500 }
488 501
502 if (HAVE_HWFP) {
489 if (cpu_has_fxsr) 503 if (cpu_has_fxsr)
490 err = restore_i387_fxsave(buf); 504 err = restore_i387_fxsave(buf);
491 else 505 else
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c
index 3d01e47777db..a4f93b4120c1 100644
--- a/arch/x86/kernel/init_task.c
+++ b/arch/x86/kernel/init_task.c
@@ -11,7 +11,6 @@
11#include <asm/desc.h> 11#include <asm/desc.h>
12 12
13static struct fs_struct init_fs = INIT_FS; 13static struct fs_struct init_fs = INIT_FS;
14static struct files_struct init_files = INIT_FILES;
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm); 16struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 76769ccb1425..0774b231a28b 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -2130,14 +2130,10 @@ static inline void __init check_timer(void)
2130{ 2130{
2131 int apic1, pin1, apic2, pin2; 2131 int apic1, pin1, apic2, pin2;
2132 int vector; 2132 int vector;
2133 unsigned int ver;
2134 unsigned long flags; 2133 unsigned long flags;
2135 2134
2136 local_irq_save(flags); 2135 local_irq_save(flags);
2137 2136
2138 ver = apic_read(APIC_LVR);
2139 ver = GET_APIC_VERSION(ver);
2140
2141 /* 2137 /*
2142 * get/set the timer IRQ vector: 2138 * get/set the timer IRQ vector:
2143 */ 2139 */
@@ -2150,15 +2146,11 @@ static inline void __init check_timer(void)
2150 * mode for the 8259A whenever interrupts are routed 2146 * mode for the 8259A whenever interrupts are routed
2151 * through I/O APICs. Also IRQ0 has to be enabled in 2147 * through I/O APICs. Also IRQ0 has to be enabled in
2152 * the 8259A which implies the virtual wire has to be 2148 * the 8259A which implies the virtual wire has to be
2153 * disabled in the local APIC. Finally timer interrupts 2149 * disabled in the local APIC.
2154 * need to be acknowledged manually in the 8259A for
2155 * timer_interrupt() and for the i82489DX when using
2156 * the NMI watchdog.
2157 */ 2150 */
2158 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2151 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2159 init_8259A(1); 2152 init_8259A(1);
2160 timer_ack = !cpu_has_tsc; 2153 timer_ack = 1;
2161 timer_ack |= (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
2162 if (timer_over_8254 > 0) 2154 if (timer_over_8254 > 0)
2163 enable_8259A_irq(0); 2155 enable_8259A_irq(0);
2164 2156
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 4bc1be5d5472..08a30986d472 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -53,7 +53,7 @@ static cycle_t kvm_clock_read(void);
53 * have elapsed since the hypervisor wrote the data. So we try to account for 53 * have elapsed since the hypervisor wrote the data. So we try to account for
54 * that with system time 54 * that with system time
55 */ 55 */
56unsigned long kvm_get_wallclock(void) 56static unsigned long kvm_get_wallclock(void)
57{ 57{
58 u32 wc_sec, wc_nsec; 58 u32 wc_sec, wc_nsec;
59 u64 delta; 59 u64 delta;
@@ -86,7 +86,7 @@ unsigned long kvm_get_wallclock(void)
86 return ts.tv_sec + 1; 86 return ts.tv_sec + 1;
87} 87}
88 88
89int kvm_set_wallclock(unsigned long now) 89static int kvm_set_wallclock(unsigned long now)
90{ 90{
91 return 0; 91 return 0;
92} 92}
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index 3cad17fe026b..07c0f828f488 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -155,6 +155,7 @@ int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable)
155 wrmsr(msr, value, dummy); 155 wrmsr(msr, value, dummy);
156 return 0; 156 return 0;
157} 157}
158EXPORT_SYMBOL_GPL(geode_mfgpt_toggle_event);
158 159
159int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable) 160int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable)
160{ 161{
@@ -222,6 +223,7 @@ int geode_mfgpt_alloc_timer(int timer, int domain)
222 /* No timers available - too bad */ 223 /* No timers available - too bad */
223 return -1; 224 return -1;
224} 225}
226EXPORT_SYMBOL_GPL(geode_mfgpt_alloc_timer);
225 227
226 228
227#ifdef CONFIG_GEODE_MFGPT_TIMER 229#ifdef CONFIG_GEODE_MFGPT_TIMER
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 11b14bbaa61e..84160f74eeb0 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -26,7 +26,6 @@
26 26
27#include <asm/smp.h> 27#include <asm/smp.h>
28#include <asm/nmi.h> 28#include <asm/nmi.h>
29#include <asm/timer.h>
30 29
31#include "mach_traps.h" 30#include "mach_traps.h"
32 31
@@ -82,7 +81,7 @@ int __init check_nmi_watchdog(void)
82 81
83 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 82 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
84 if (!prev_nmi_count) 83 if (!prev_nmi_count)
85 goto error; 84 return -1;
86 85
87 printk(KERN_INFO "Testing NMI watchdog ... "); 86 printk(KERN_INFO "Testing NMI watchdog ... ");
88 87
@@ -119,7 +118,7 @@ int __init check_nmi_watchdog(void)
119 if (!atomic_read(&nmi_active)) { 118 if (!atomic_read(&nmi_active)) {
120 kfree(prev_nmi_count); 119 kfree(prev_nmi_count);
121 atomic_set(&nmi_active, -1); 120 atomic_set(&nmi_active, -1);
122 goto error; 121 return -1;
123 } 122 }
124 printk("OK.\n"); 123 printk("OK.\n");
125 124
@@ -130,10 +129,6 @@ int __init check_nmi_watchdog(void)
130 129
131 kfree(prev_nmi_count); 130 kfree(prev_nmi_count);
132 return 0; 131 return 0;
133error:
134 timer_ack = !cpu_has_tsc;
135
136 return -1;
137} 132}
138 133
139static int __init setup_nmi_watchdog(char *str) 134static int __init setup_nmi_watchdog(char *str)
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 0c37f16b6950..dc00a1331ace 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -378,6 +378,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
378 struct page *page; 378 struct page *page;
379 unsigned long dma_mask = 0; 379 unsigned long dma_mask = 0;
380 dma_addr_t bus; 380 dma_addr_t bus;
381 int noretry = 0;
381 382
382 /* ignore region specifiers */ 383 /* ignore region specifiers */
383 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); 384 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
@@ -385,30 +386,37 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
385 if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) 386 if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory))
386 return memory; 387 return memory;
387 388
388 if (!dev) 389 if (!dev) {
389 dev = &fallback_dev; 390 dev = &fallback_dev;
391 gfp |= GFP_DMA;
392 }
390 dma_mask = dev->coherent_dma_mask; 393 dma_mask = dev->coherent_dma_mask;
391 if (dma_mask == 0) 394 if (dma_mask == 0)
392 dma_mask = DMA_32BIT_MASK; 395 dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK;
393 396
394 /* Device not DMA able */ 397 /* Device not DMA able */
395 if (dev->dma_mask == NULL) 398 if (dev->dma_mask == NULL)
396 return NULL; 399 return NULL;
397 400
398 /* Don't invoke OOM killer */ 401 /* Don't invoke OOM killer or retry in lower 16MB DMA zone */
399 gfp |= __GFP_NORETRY; 402 if (gfp & __GFP_DMA)
403 noretry = 1;
400 404
401#ifdef CONFIG_X86_64 405#ifdef CONFIG_X86_64
402 /* Why <=? Even when the mask is smaller than 4GB it is often 406 /* Why <=? Even when the mask is smaller than 4GB it is often
403 larger than 16MB and in this case we have a chance of 407 larger than 16MB and in this case we have a chance of
404 finding fitting memory in the next higher zone first. If 408 finding fitting memory in the next higher zone first. If
405 not retry with true GFP_DMA. -AK */ 409 not retry with true GFP_DMA. -AK */
406 if (dma_mask <= DMA_32BIT_MASK) 410 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) {
407 gfp |= GFP_DMA32; 411 gfp |= GFP_DMA32;
412 if (dma_mask < DMA_32BIT_MASK)
413 noretry = 1;
414 }
408#endif 415#endif
409 416
410 again: 417 again:
411 page = dma_alloc_pages(dev, gfp, get_order(size)); 418 page = dma_alloc_pages(dev,
419 noretry ? gfp | __GFP_NORETRY : gfp, get_order(size));
412 if (page == NULL) 420 if (page == NULL)
413 return NULL; 421 return NULL;
414 422
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index c07455d1695f..aa8ec928caa8 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -26,6 +26,7 @@
26#include <linux/kdebug.h> 26#include <linux/kdebug.h>
27#include <linux/scatterlist.h> 27#include <linux/scatterlist.h>
28#include <linux/iommu-helper.h> 28#include <linux/iommu-helper.h>
29#include <linux/sysdev.h>
29#include <asm/atomic.h> 30#include <asm/atomic.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/mtrr.h> 32#include <asm/mtrr.h>
@@ -548,6 +549,28 @@ static __init unsigned read_aperture(struct pci_dev *dev, u32 *size)
548 return aper_base; 549 return aper_base;
549} 550}
550 551
552static int gart_resume(struct sys_device *dev)
553{
554 return 0;
555}
556
557static int gart_suspend(struct sys_device *dev, pm_message_t state)
558{
559 return -EINVAL;
560}
561
562static struct sysdev_class gart_sysdev_class = {
563 .name = "gart",
564 .suspend = gart_suspend,
565 .resume = gart_resume,
566
567};
568
569static struct sys_device device_gart = {
570 .id = 0,
571 .cls = &gart_sysdev_class,
572};
573
551/* 574/*
552 * Private Northbridge GATT initialization in case we cannot use the 575 * Private Northbridge GATT initialization in case we cannot use the
553 * AGP driver for some reason. 576 * AGP driver for some reason.
@@ -558,7 +581,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
558 unsigned aper_base, new_aper_base; 581 unsigned aper_base, new_aper_base;
559 struct pci_dev *dev; 582 struct pci_dev *dev;
560 void *gatt; 583 void *gatt;
561 int i; 584 int i, error;
562 585
563 printk(KERN_INFO "PCI-DMA: Disabling AGP.\n"); 586 printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
564 aper_size = aper_base = info->aper_size = 0; 587 aper_size = aper_base = info->aper_size = 0;
@@ -606,6 +629,12 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
606 629
607 pci_write_config_dword(dev, 0x90, ctl); 630 pci_write_config_dword(dev, 0x90, ctl);
608 } 631 }
632
633 error = sysdev_class_register(&gart_sysdev_class);
634 if (!error)
635 error = sysdev_register(&device_gart);
636 if (error)
637 panic("Could not register gart_sysdev -- would corrupt data on next suspend");
609 flush_gart(); 638 flush_gart();
610 639
611 printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n", 640 printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 67e9b4a1e89d..ba370dc8685b 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -99,15 +99,6 @@ static void mwait_idle(void)
99 local_irq_enable(); 99 local_irq_enable();
100} 100}
101 101
102
103static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
104{
105 if (force_mwait)
106 return 1;
107 /* Any C1 states supported? */
108 return c->cpuid_level >= 5 && ((cpuid_edx(5) >> 4) & 0xf) > 0;
109}
110
111/* 102/*
112 * On SMP it's slightly faster (but much more power-consuming!) 103 * On SMP it's slightly faster (but much more power-consuming!)
113 * to poll the ->work.need_resched flag instead of waiting for the 104 * to poll the ->work.need_resched flag instead of waiting for the
@@ -119,6 +110,33 @@ static void poll_idle(void)
119 cpu_relax(); 110 cpu_relax();
120} 111}
121 112
113/*
114 * mwait selection logic:
115 *
116 * It depends on the CPU. For AMD CPUs that support MWAIT this is
117 * wrong. Family 0x10 and 0x11 CPUs will enter C1 on HLT. Powersavings
118 * then depend on a clock divisor and current Pstate of the core. If
119 * all cores of a processor are in halt state (C1) the processor can
120 * enter the C1E (C1 enhanced) state. If mwait is used this will never
121 * happen.
122 *
123 * idle=mwait overrides this decision and forces the usage of mwait.
124 */
125static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
126{
127 if (force_mwait)
128 return 1;
129
130 if (c->x86_vendor == X86_VENDOR_AMD) {
131 switch(c->x86) {
132 case 0x10:
133 case 0x11:
134 return 0;
135 }
136 }
137 return 1;
138}
139
122void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 140void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
123{ 141{
124 static int selected; 142 static int selected;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index f8476dfbb60d..6d5483356e74 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -649,8 +649,11 @@ struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct
649 /* If the task has used fpu the last 5 timeslices, just do a full 649 /* If the task has used fpu the last 5 timeslices, just do a full
650 * restore of the math state immediately to avoid the trap; the 650 * restore of the math state immediately to avoid the trap; the
651 * chances of needing FPU soon are obviously high now 651 * chances of needing FPU soon are obviously high now
652 *
653 * tsk_used_math() checks prevent calling math_state_restore(),
654 * which can sleep in the case of !tsk_used_math()
652 */ 655 */
653 if (next_p->fpu_counter > 5) 656 if (tsk_used_math(next_p) && next_p->fpu_counter > 5)
654 math_state_restore(); 657 math_state_restore();
655 658
656 /* 659 /*
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index e2319f39988b..ac54ff56df80 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -658,8 +658,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
658 /* If the task has used fpu the last 5 timeslices, just do a full 658 /* If the task has used fpu the last 5 timeslices, just do a full
659 * restore of the math state immediately to avoid the trap; the 659 * restore of the math state immediately to avoid the trap; the
660 * chances of needing FPU soon are obviously high now 660 * chances of needing FPU soon are obviously high now
661 *
662 * tsk_used_math() checks prevent calling math_state_restore(),
663 * which can sleep in the case of !tsk_used_math()
661 */ 664 */
662 if (next_p->fpu_counter>5) 665 if (tsk_used_math(next_p) && next_p->fpu_counter > 5)
663 math_state_restore(); 666 math_state_restore();
664 return prev_p; 667 return prev_p;
665} 668}
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index fb03ef380f0e..a7835f282936 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1303,6 +1303,9 @@ static const struct user_regset_view user_x86_64_view = {
1303#define genregs32_get genregs_get 1303#define genregs32_get genregs_get
1304#define genregs32_set genregs_set 1304#define genregs32_set genregs_set
1305 1305
1306#define user_i387_ia32_struct user_i387_struct
1307#define user32_fxsr_struct user_fxsr_struct
1308
1306#endif /* CONFIG_X86_64 */ 1309#endif /* CONFIG_X86_64 */
1307 1310
1308#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION 1311#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
@@ -1315,13 +1318,13 @@ static const struct user_regset x86_32_regsets[] = {
1315 }, 1318 },
1316 [REGSET_FP] = { 1319 [REGSET_FP] = {
1317 .core_note_type = NT_PRFPREG, 1320 .core_note_type = NT_PRFPREG,
1318 .n = sizeof(struct user_i387_struct) / sizeof(u32), 1321 .n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
1319 .size = sizeof(u32), .align = sizeof(u32), 1322 .size = sizeof(u32), .align = sizeof(u32),
1320 .active = fpregs_active, .get = fpregs_get, .set = fpregs_set 1323 .active = fpregs_active, .get = fpregs_get, .set = fpregs_set
1321 }, 1324 },
1322 [REGSET_XFP] = { 1325 [REGSET_XFP] = {
1323 .core_note_type = NT_PRXFPREG, 1326 .core_note_type = NT_PRXFPREG,
1324 .n = sizeof(struct user_i387_struct) / sizeof(u32), 1327 .n = sizeof(struct user32_fxsr_struct) / sizeof(u32),
1325 .size = sizeof(u32), .align = sizeof(u32), 1328 .size = sizeof(u32), .align = sizeof(u32),
1326 .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set 1329 .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
1327 }, 1330 },
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 9615eee9b775..05191bbc68b8 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -4,6 +4,8 @@
4#include <linux/acpi.h> 4#include <linux/acpi.h>
5#include <linux/bcd.h> 5#include <linux/bcd.h>
6#include <linux/mc146818rtc.h> 6#include <linux/mc146818rtc.h>
7#include <linux/platform_device.h>
8#include <linux/pnp.h>
7 9
8#include <asm/time.h> 10#include <asm/time.h>
9#include <asm/vsyscall.h> 11#include <asm/vsyscall.h>
@@ -197,3 +199,35 @@ unsigned long long native_read_tsc(void)
197} 199}
198EXPORT_SYMBOL(native_read_tsc); 200EXPORT_SYMBOL(native_read_tsc);
199 201
202
203static struct resource rtc_resources[] = {
204 [0] = {
205 .start = RTC_PORT(0),
206 .end = RTC_PORT(1),
207 .flags = IORESOURCE_IO,
208 },
209 [1] = {
210 .start = RTC_IRQ,
211 .end = RTC_IRQ,
212 .flags = IORESOURCE_IRQ,
213 }
214};
215
216static struct platform_device rtc_device = {
217 .name = "rtc_cmos",
218 .id = -1,
219 .resource = rtc_resources,
220 .num_resources = ARRAY_SIZE(rtc_resources),
221};
222
223static __init int add_rtc_cmos(void)
224{
225#ifdef CONFIG_PNP
226 if (!pnp_platform_devices)
227 platform_device_register(&rtc_device);
228#else
229 platform_device_register(&rtc_device);
230#endif /* CONFIG_PNP */
231 return 0;
232}
233device_initcall(add_rtc_cmos);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c0c68c18a788..6f80b852a196 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -12,6 +12,7 @@
12#include <asm/mpspec.h> 12#include <asm/mpspec.h>
13#include <asm/apicdef.h> 13#include <asm/apicdef.h>
14 14
15#ifdef CONFIG_X86_LOCAL_APIC
15unsigned int num_processors; 16unsigned int num_processors;
16unsigned disabled_cpus __cpuinitdata; 17unsigned disabled_cpus __cpuinitdata;
17/* Processor that is doing the boot up */ 18/* Processor that is doing the boot up */
@@ -23,8 +24,9 @@ EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
23 24
24/* Bitmask of physically existing CPUs */ 25/* Bitmask of physically existing CPUs */
25physid_mask_t phys_cpu_present_map; 26physid_mask_t phys_cpu_present_map;
27#endif
26 28
27#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_SMP) 29#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_X86_SMP)
28/* 30/*
29 * Copy data used in early init routines from the initial arrays to the 31 * Copy data used in early init routines from the initial arrays to the
30 * per cpu data areas. These arrays then become expendable and the 32 * per cpu data areas. These arrays then become expendable and the
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index f2fc8feb727d..6dff1286ad8a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -951,7 +951,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
951static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c) 951static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c)
952{ 952{
953 if (c->x86 == 0x6 && c->x86_model >= 0xf) 953 if (c->x86 == 0x6 && c->x86_model >= 0xf)
954 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 954 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
955} 955}
956 956
957static void __cpuinit init_centaur(struct cpuinfo_x86 *c) 957static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 8f75893a6467..0cb7aadc87cd 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -231,7 +231,8 @@ native_smp_call_function_mask(cpumask_t mask,
231 wmb(); 231 wmb();
232 232
233 /* Send a message to other CPUs */ 233 /* Send a message to other CPUs */
234 if (cpus_equal(mask, allbutself)) 234 if (cpus_equal(mask, allbutself) &&
235 cpus_equal(cpu_online_map, cpu_callout_map))
235 send_IPI_allbutself(CALL_FUNCTION_VECTOR); 236 send_IPI_allbutself(CALL_FUNCTION_VECTOR);
236 else 237 else
237 send_IPI_mask(mask, CALL_FUNCTION_VECTOR); 238 send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 6b087ab6cd8f..56078d61c793 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -86,6 +86,7 @@ void *x86_bios_cpu_apicid_early_ptr;
86 86
87#ifdef CONFIG_X86_32 87#ifdef CONFIG_X86_32
88u8 apicid_2_node[MAX_APICID]; 88u8 apicid_2_node[MAX_APICID];
89static int low_mappings;
89#endif 90#endif
90 91
91/* State of each CPU */ 92/* State of each CPU */
@@ -326,6 +327,12 @@ static void __cpuinit start_secondary(void *unused)
326 enable_8259A_irq(0); 327 enable_8259A_irq(0);
327 } 328 }
328 329
330#ifdef CONFIG_X86_32
331 while (low_mappings)
332 cpu_relax();
333 __flush_tlb_all();
334#endif
335
329 /* This must be done before setting cpu_online_map */ 336 /* This must be done before setting cpu_online_map */
330 set_cpu_sibling_map(raw_smp_processor_id()); 337 set_cpu_sibling_map(raw_smp_processor_id());
331 wmb(); 338 wmb();
@@ -1040,14 +1047,20 @@ int __cpuinit native_cpu_up(unsigned int cpu)
1040#ifdef CONFIG_X86_32 1047#ifdef CONFIG_X86_32
1041 /* init low mem mapping */ 1048 /* init low mem mapping */
1042 clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY, 1049 clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY,
1043 min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); 1050 min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
1044 flush_tlb_all(); 1051 flush_tlb_all();
1045#endif 1052 low_mappings = 1;
1053
1054 err = do_boot_cpu(apicid, cpu);
1046 1055
1056 zap_low_mappings();
1057 low_mappings = 0;
1058#else
1047 err = do_boot_cpu(apicid, cpu); 1059 err = do_boot_cpu(apicid, cpu);
1048 if (err < 0) { 1060#endif
1061 if (err) {
1049 Dprintk("do_boot_cpu failed %d\n", err); 1062 Dprintk("do_boot_cpu failed %d\n", err);
1050 return err; 1063 return -EIO;
1051 } 1064 }
1052 1065
1053 /* 1066 /*
@@ -1177,6 +1190,7 @@ static void __init smp_cpu_index_default(void)
1177 */ 1190 */
1178void __init native_smp_prepare_cpus(unsigned int max_cpus) 1191void __init native_smp_prepare_cpus(unsigned int max_cpus)
1179{ 1192{
1193 preempt_disable();
1180 nmi_watchdog_default(); 1194 nmi_watchdog_default();
1181 smp_cpu_index_default(); 1195 smp_cpu_index_default();
1182 current_cpu_data = boot_cpu_data; 1196 current_cpu_data = boot_cpu_data;
@@ -1193,7 +1207,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1193 if (smp_sanity_check(max_cpus) < 0) { 1207 if (smp_sanity_check(max_cpus) < 0) {
1194 printk(KERN_INFO "SMP disabled\n"); 1208 printk(KERN_INFO "SMP disabled\n");
1195 disable_smp(); 1209 disable_smp();
1196 return; 1210 goto out;
1197 } 1211 }
1198 1212
1199 preempt_disable(); 1213 preempt_disable();
@@ -1233,6 +1247,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1233 printk(KERN_INFO "CPU%d: ", 0); 1247 printk(KERN_INFO "CPU%d: ", 0);
1234 print_cpu_info(&cpu_data(0)); 1248 print_cpu_info(&cpu_data(0));
1235 setup_boot_clock(); 1249 setup_boot_clock();
1250out:
1251 preempt_enable();
1236} 1252}
1237/* 1253/*
1238 * Early setup to make printk work. 1254 * Early setup to make printk work.
@@ -1259,9 +1275,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
1259 setup_ioapic_dest(); 1275 setup_ioapic_dest();
1260#endif 1276#endif
1261 check_nmi_watchdog(); 1277 check_nmi_watchdog();
1262#ifdef CONFIG_X86_32
1263 zap_low_mappings();
1264#endif
1265} 1278}
1266 1279
1267#ifdef CONFIG_HOTPLUG_CPU 1280#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index bde6f63e15d5..08d752de4eee 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -544,6 +544,7 @@ vm86_trap:
544#define DO_ERROR(trapnr, signr, str, name) \ 544#define DO_ERROR(trapnr, signr, str, name) \
545void do_##name(struct pt_regs *regs, long error_code) \ 545void do_##name(struct pt_regs *regs, long error_code) \
546{ \ 546{ \
547 trace_hardirqs_fixup(); \
547 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 548 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
548 == NOTIFY_STOP) \ 549 == NOTIFY_STOP) \
549 return; \ 550 return; \
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index e4790728b224..068759db63dd 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -14,7 +14,7 @@
14 14
15#include "mach_timer.h" 15#include "mach_timer.h"
16 16
17static int tsc_enabled; 17static int tsc_disabled;
18 18
19/* 19/*
20 * On some systems the TSC frequency does not 20 * On some systems the TSC frequency does not
@@ -28,8 +28,8 @@ EXPORT_SYMBOL_GPL(tsc_khz);
28static int __init tsc_setup(char *str) 28static int __init tsc_setup(char *str)
29{ 29{
30 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, " 30 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
31 "cannot disable TSC completely.\n"); 31 "cannot disable TSC completely.\n");
32 mark_tsc_unstable("user disabled TSC"); 32 tsc_disabled = 1;
33 return 1; 33 return 1;
34} 34}
35#else 35#else
@@ -120,7 +120,7 @@ unsigned long long native_sched_clock(void)
120 * very important for it to be as fast as the platform 120 * very important for it to be as fast as the platform
121 * can achive it. ) 121 * can achive it. )
122 */ 122 */
123 if (unlikely(!tsc_enabled && !tsc_unstable)) 123 if (unlikely(tsc_disabled))
124 /* No locking but a rare wrong value is not a big deal: */ 124 /* No locking but a rare wrong value is not a big deal: */
125 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 125 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
126 126
@@ -322,7 +322,6 @@ void mark_tsc_unstable(char *reason)
322{ 322{
323 if (!tsc_unstable) { 323 if (!tsc_unstable) {
324 tsc_unstable = 1; 324 tsc_unstable = 1;
325 tsc_enabled = 0;
326 printk("Marking TSC unstable due to: %s.\n", reason); 325 printk("Marking TSC unstable due to: %s.\n", reason);
327 /* Can be called before registration */ 326 /* Can be called before registration */
328 if (clocksource_tsc.mult) 327 if (clocksource_tsc.mult)
@@ -336,7 +335,7 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
336static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d) 335static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d)
337{ 336{
338 printk(KERN_NOTICE "%s detected: marking TSC unstable.\n", 337 printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
339 d->ident); 338 d->ident);
340 tsc_unstable = 1; 339 tsc_unstable = 1;
341 return 0; 340 return 0;
342} 341}
@@ -403,14 +402,22 @@ void __init tsc_init(void)
403{ 402{
404 int cpu; 403 int cpu;
405 404
406 if (!cpu_has_tsc) 405 if (!cpu_has_tsc || tsc_disabled) {
406 /* Disable the TSC in case of !cpu_has_tsc */
407 tsc_disabled = 1;
407 return; 408 return;
409 }
408 410
409 cpu_khz = calculate_cpu_khz(); 411 cpu_khz = calculate_cpu_khz();
410 tsc_khz = cpu_khz; 412 tsc_khz = cpu_khz;
411 413
412 if (!cpu_khz) { 414 if (!cpu_khz) {
413 mark_tsc_unstable("could not calculate TSC khz"); 415 mark_tsc_unstable("could not calculate TSC khz");
416 /*
417 * We need to disable the TSC completely in this case
418 * to prevent sched_clock() from using it.
419 */
420 tsc_disabled = 1;
414 return; 421 return;
415 } 422 }
416 423
@@ -441,8 +448,6 @@ void __init tsc_init(void)
441 if (check_tsc_unstable()) { 448 if (check_tsc_unstable()) {
442 clocksource_tsc.rating = 0; 449 clocksource_tsc.rating = 0;
443 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 450 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
444 } else 451 }
445 tsc_enabled = 1;
446
447 clocksource_register(&clocksource_tsc); 452 clocksource_register(&clocksource_tsc);
448} 453}
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index fcc16e58609e..1784b8077a12 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -227,14 +227,14 @@ void __init tsc_calibrate(void)
227 /* hpet or pmtimer available ? */ 227 /* hpet or pmtimer available ? */
228 if (!hpet && !pm1 && !pm2) { 228 if (!hpet && !pm1 && !pm2) {
229 printk(KERN_INFO "TSC calibrated against PIT\n"); 229 printk(KERN_INFO "TSC calibrated against PIT\n");
230 return; 230 goto out;
231 } 231 }
232 232
233 /* Check, whether the sampling was disturbed by an SMI */ 233 /* Check, whether the sampling was disturbed by an SMI */
234 if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) { 234 if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
235 printk(KERN_WARNING "TSC calibration disturbed by SMI, " 235 printk(KERN_WARNING "TSC calibration disturbed by SMI, "
236 "using PIT calibration result\n"); 236 "using PIT calibration result\n");
237 return; 237 goto out;
238 } 238 }
239 239
240 tsc2 = (tsc2 - tsc1) * 1000000L; 240 tsc2 = (tsc2 - tsc1) * 1000000L;
@@ -255,6 +255,7 @@ void __init tsc_calibrate(void)
255 255
256 tsc_khz = tsc2 / tsc1; 256 tsc_khz = tsc2 / tsc1;
257 257
258out:
258 for_each_possible_cpu(cpu) 259 for_each_possible_cpu(cpu)
259 set_cyc2ns_scale(tsc_khz, cpu); 260 set_cyc2ns_scale(tsc_khz, cpu);
260} 261}
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index 58882f9f2637..f6c05d0410fb 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -2,6 +2,7 @@
2 All C exports should go in the respective C files. */ 2 All C exports should go in the respective C files. */
3 3
4#include <linux/module.h> 4#include <linux/module.h>
5#include <net/checksum.h>
5#include <linux/smp.h> 6#include <linux/smp.h>
6 7
7#include <asm/processor.h> 8#include <asm/processor.h>
@@ -29,6 +30,8 @@ EXPORT_SYMBOL(__copy_from_user_inatomic);
29EXPORT_SYMBOL(copy_page); 30EXPORT_SYMBOL(copy_page);
30EXPORT_SYMBOL(clear_page); 31EXPORT_SYMBOL(clear_page);
31 32
33EXPORT_SYMBOL(csum_partial);
34
32/* 35/*
33 * Export string functions. We normally rely on gcc builtin for most of these, 36 * Export string functions. We normally rely on gcc builtin for most of these,
34 * but gcc sometimes decides not to inline them. 37 * but gcc sometimes decides not to inline them.
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 3324d90038e4..f2f5d260874e 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -200,7 +200,6 @@ int __pit_timer_fn(struct kvm_kpit_state *ps)
200 200
201 atomic_inc(&pt->pending); 201 atomic_inc(&pt->pending);
202 smp_mb__after_atomic_inc(); 202 smp_mb__after_atomic_inc();
203 /* FIXME: handle case where the guest is in guest mode */
204 if (vcpu0 && waitqueue_active(&vcpu0->wq)) { 203 if (vcpu0 && waitqueue_active(&vcpu0->wq)) {
205 vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE; 204 vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE;
206 wake_up_interruptible(&vcpu0->wq); 205 wake_up_interruptible(&vcpu0->wq);
@@ -216,7 +215,7 @@ int pit_has_pending_timer(struct kvm_vcpu *vcpu)
216{ 215{
217 struct kvm_pit *pit = vcpu->kvm->arch.vpit; 216 struct kvm_pit *pit = vcpu->kvm->arch.vpit;
218 217
219 if (pit && vcpu->vcpu_id == 0) 218 if (pit && vcpu->vcpu_id == 0 && pit->pit_state.inject_pending)
220 return atomic_read(&pit->pit_state.pit_timer.pending); 219 return atomic_read(&pit->pit_state.pit_timer.pending);
221 220
222 return 0; 221 return 0;
@@ -237,6 +236,19 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data)
237 return HRTIMER_NORESTART; 236 return HRTIMER_NORESTART;
238} 237}
239 238
239void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)
240{
241 struct kvm_pit *pit = vcpu->kvm->arch.vpit;
242 struct hrtimer *timer;
243
244 if (vcpu->vcpu_id != 0 || !pit)
245 return;
246
247 timer = &pit->pit_state.pit_timer.timer;
248 if (hrtimer_cancel(timer))
249 hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
250}
251
240static void destroy_pit_timer(struct kvm_kpit_timer *pt) 252static void destroy_pit_timer(struct kvm_kpit_timer *pt)
241{ 253{
242 pr_debug("pit: execute del timer!\n"); 254 pr_debug("pit: execute del timer!\n");
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index ce1f583459b1..76d736b5f664 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -94,3 +94,9 @@ void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec)
94 /* TODO: PIT, RTC etc. */ 94 /* TODO: PIT, RTC etc. */
95} 95}
96EXPORT_SYMBOL_GPL(kvm_timer_intr_post); 96EXPORT_SYMBOL_GPL(kvm_timer_intr_post);
97
98void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
99{
100 __kvm_migrate_apic_timer(vcpu);
101 __kvm_migrate_pit_timer(vcpu);
102}
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 1802134b836f..2a15be2275c0 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -84,6 +84,8 @@ void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
84void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); 84void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
85void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); 85void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
86void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu); 86void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu);
87void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu);
88void __kvm_migrate_timers(struct kvm_vcpu *vcpu);
87 89
88int pit_has_pending_timer(struct kvm_vcpu *vcpu); 90int pit_has_pending_timer(struct kvm_vcpu *vcpu);
89int apic_has_pending_timer(struct kvm_vcpu *vcpu); 91int apic_has_pending_timer(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 36809d79788b..c297c50eba63 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -957,7 +957,7 @@ int apic_has_pending_timer(struct kvm_vcpu *vcpu)
957{ 957{
958 struct kvm_lapic *lapic = vcpu->arch.apic; 958 struct kvm_lapic *lapic = vcpu->arch.apic;
959 959
960 if (lapic) 960 if (lapic && apic_enabled(lapic) && apic_lvt_enabled(lapic, APIC_LVTT))
961 return atomic_read(&lapic->timer.pending); 961 return atomic_read(&lapic->timer.pending);
962 962
963 return 0; 963 return 0;
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 36c5406b1813..ee3f53098f0c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -658,7 +658,7 @@ static int is_empty_shadow_page(u64 *spt)
658 u64 *end; 658 u64 *end;
659 659
660 for (pos = spt, end = pos + PAGE_SIZE / sizeof(u64); pos != end; pos++) 660 for (pos = spt, end = pos + PAGE_SIZE / sizeof(u64); pos != end; pos++)
661 if (*pos != shadow_trap_nonpresent_pte) { 661 if (is_shadow_present_pte(*pos)) {
662 printk(KERN_ERR "%s: %p %llx\n", __func__, 662 printk(KERN_ERR "%s: %p %llx\n", __func__,
663 pos, *pos); 663 pos, *pos);
664 return 0; 664 return 0;
@@ -1858,6 +1858,7 @@ static void free_mmu_pages(struct kvm_vcpu *vcpu)
1858 sp = container_of(vcpu->kvm->arch.active_mmu_pages.next, 1858 sp = container_of(vcpu->kvm->arch.active_mmu_pages.next,
1859 struct kvm_mmu_page, link); 1859 struct kvm_mmu_page, link);
1860 kvm_mmu_zap_page(vcpu->kvm, sp); 1860 kvm_mmu_zap_page(vcpu->kvm, sp);
1861 cond_resched();
1861 } 1862 }
1862 free_page((unsigned long)vcpu->arch.mmu.pae_root); 1863 free_page((unsigned long)vcpu->arch.mmu.pae_root);
1863} 1864}
@@ -1996,7 +1997,7 @@ static struct shrinker mmu_shrinker = {
1996 .seeks = DEFAULT_SEEKS * 10, 1997 .seeks = DEFAULT_SEEKS * 10,
1997}; 1998};
1998 1999
1999void mmu_destroy_caches(void) 2000static void mmu_destroy_caches(void)
2000{ 2001{
2001 if (pte_chain_cache) 2002 if (pte_chain_cache)
2002 kmem_cache_destroy(pte_chain_cache); 2003 kmem_cache_destroy(pte_chain_cache);
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 156fe10288ae..934c7b619396 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -418,7 +418,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
418 418
419 /* mmio */ 419 /* mmio */
420 if (is_error_pfn(pfn)) { 420 if (is_error_pfn(pfn)) {
421 pgprintk("gfn %x is mmio\n", walker.gfn); 421 pgprintk("gfn %lx is mmio\n", walker.gfn);
422 kvm_release_pfn_clean(pfn); 422 kvm_release_pfn_clean(pfn);
423 return 1; 423 return 1;
424 } 424 }
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ab22615eee89..6b0d5fa5bab3 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -688,7 +688,7 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
688 delta = vcpu->arch.host_tsc - tsc_this; 688 delta = vcpu->arch.host_tsc - tsc_this;
689 svm->vmcb->control.tsc_offset += delta; 689 svm->vmcb->control.tsc_offset += delta;
690 vcpu->cpu = cpu; 690 vcpu->cpu = cpu;
691 kvm_migrate_apic_timer(vcpu); 691 kvm_migrate_timers(vcpu);
692 } 692 }
693 693
694 for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) 694 for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bfe4db11989c..02efbe75f317 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -608,7 +608,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
608 608
609 if (vcpu->cpu != cpu) { 609 if (vcpu->cpu != cpu) {
610 vcpu_clear(vmx); 610 vcpu_clear(vmx);
611 kvm_migrate_apic_timer(vcpu); 611 kvm_migrate_timers(vcpu);
612 vpid_sync_vcpu_all(vmx); 612 vpid_sync_vcpu_all(vmx);
613 } 613 }
614 614
@@ -1036,6 +1036,7 @@ static void hardware_enable(void *garbage)
1036static void hardware_disable(void *garbage) 1036static void hardware_disable(void *garbage)
1037{ 1037{
1038 asm volatile (ASM_VMX_VMXOFF : : : "cc"); 1038 asm volatile (ASM_VMX_VMXOFF : : : "cc");
1039 write_cr4(read_cr4() & ~X86_CR4_VMXE);
1039} 1040}
1040 1041
1041static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, 1042static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 21338bdb28ff..00acf1301a15 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2758,7 +2758,7 @@ again:
2758 2758
2759 if (vcpu->requests) { 2759 if (vcpu->requests) {
2760 if (test_and_clear_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests)) 2760 if (test_and_clear_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests))
2761 __kvm_migrate_apic_timer(vcpu); 2761 __kvm_migrate_timers(vcpu);
2762 if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS, 2762 if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS,
2763 &vcpu->requests)) { 2763 &vcpu->requests)) {
2764 kvm_run->exit_reason = KVM_EXIT_TPR_ACCESS; 2764 kvm_run->exit_reason = KVM_EXIT_TPR_ACCESS;
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index f2a696d6a243..932f216d890c 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -677,8 +677,9 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
677 c->use_modrm_ea = 1; 677 c->use_modrm_ea = 1;
678 678
679 if (c->modrm_mod == 3) { 679 if (c->modrm_mod == 3) {
680 c->modrm_val = *(unsigned long *) 680 c->modrm_ptr = decode_register(c->modrm_rm,
681 decode_register(c->modrm_rm, c->regs, c->d & ByteOp); 681 c->regs, c->d & ByteOp);
682 c->modrm_val = *(unsigned long *)c->modrm_ptr;
682 return rc; 683 return rc;
683 } 684 }
684 685
@@ -1005,6 +1006,7 @@ done_prefixes:
1005 if ((c->d & ModRM) && c->modrm_mod == 3) { 1006 if ((c->d & ModRM) && c->modrm_mod == 3) {
1006 c->src.type = OP_REG; 1007 c->src.type = OP_REG;
1007 c->src.val = c->modrm_val; 1008 c->src.val = c->modrm_val;
1009 c->src.ptr = c->modrm_ptr;
1008 break; 1010 break;
1009 } 1011 }
1010 c->src.type = OP_MEM; 1012 c->src.type = OP_MEM;
@@ -1049,6 +1051,7 @@ done_prefixes:
1049 if ((c->d & ModRM) && c->modrm_mod == 3) { 1051 if ((c->d & ModRM) && c->modrm_mod == 3) {
1050 c->dst.type = OP_REG; 1052 c->dst.type = OP_REG;
1051 c->dst.val = c->dst.orig_val = c->modrm_val; 1053 c->dst.val = c->dst.orig_val = c->modrm_val;
1054 c->dst.ptr = c->modrm_ptr;
1052 break; 1055 break;
1053 } 1056 }
1054 c->dst.type = OP_MEM; 1057 c->dst.type = OP_MEM;
@@ -1724,7 +1727,8 @@ twobyte_insn:
1724 if (rc) 1727 if (rc)
1725 goto done; 1728 goto done;
1726 1729
1727 kvm_emulate_hypercall(ctxt->vcpu); 1730 /* Let the processor re-execute the fixed hypercall */
1731 c->eip = ctxt->vcpu->arch.rip;
1728 /* Disable writeback. */ 1732 /* Disable writeback. */
1729 c->dst.type = OP_NONE; 1733 c->dst.type = OP_NONE;
1730 break; 1734 break;
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index af65b2da3ba0..5c7e2fd52075 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -582,8 +582,9 @@ static void __init lguest_init_IRQ(void)
582 int vector = FIRST_EXTERNAL_VECTOR + i; 582 int vector = FIRST_EXTERNAL_VECTOR + i;
583 if (vector != SYSCALL_VECTOR) { 583 if (vector != SYSCALL_VECTOR) {
584 set_intr_gate(vector, interrupt[i]); 584 set_intr_gate(vector, interrupt[i]);
585 set_irq_chip_and_handler(i, &lguest_irq_controller, 585 set_irq_chip_and_handler_name(i, &lguest_irq_controller,
586 handle_level_irq); 586 handle_level_irq,
587 "level");
587 } 588 }
588 } 589 }
589 /* This call is required to set up for 4k stacks, where we have 590 /* This call is required to set up for 4k stacks, where we have
diff --git a/arch/x86/lib/csum-partial_64.c b/arch/x86/lib/csum-partial_64.c
index bc503f506903..bf51144d97e1 100644
--- a/arch/x86/lib/csum-partial_64.c
+++ b/arch/x86/lib/csum-partial_64.c
@@ -136,8 +136,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
136 (__force u32)sum); 136 (__force u32)sum);
137} 137}
138 138
139EXPORT_SYMBOL(csum_partial);
140
141/* 139/*
142 * this routine is used for miscellaneous IP-like checksums, mainly 140 * this routine is used for miscellaneous IP-like checksums, mainly
143 * in icmp.c 141 * in icmp.c
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c
index 4535e6d147ad..d710f2d167bb 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay_32.c
@@ -44,13 +44,36 @@ static void delay_loop(unsigned long loops)
44static void delay_tsc(unsigned long loops) 44static void delay_tsc(unsigned long loops)
45{ 45{
46 unsigned long bclock, now; 46 unsigned long bclock, now;
47 int cpu;
47 48
48 preempt_disable(); /* TSC's are per-cpu */ 49 preempt_disable();
50 cpu = smp_processor_id();
49 rdtscl(bclock); 51 rdtscl(bclock);
50 do { 52 for (;;) {
51 rep_nop();
52 rdtscl(now); 53 rdtscl(now);
53 } while ((now-bclock) < loops); 54 if ((now - bclock) >= loops)
55 break;
56
57 /* Allow RT tasks to run */
58 preempt_enable();
59 rep_nop();
60 preempt_disable();
61
62 /*
63 * It is possible that we moved to another CPU, and
64 * since TSC's are per-cpu we need to calculate
65 * that. The delay must guarantee that we wait "at
66 * least" the amount of time. Being moved to another
67 * CPU could make the wait longer but we just need to
68 * make sure we waited long enough. Rebalance the
69 * counter for this CPU.
70 */
71 if (unlikely(cpu != smp_processor_id())) {
72 loops -= (now - bclock);
73 cpu = smp_processor_id();
74 rdtscl(bclock);
75 }
76 }
54 preempt_enable(); 77 preempt_enable();
55} 78}
56 79
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
index bbc610518516..4c441be92641 100644
--- a/arch/x86/lib/delay_64.c
+++ b/arch/x86/lib/delay_64.c
@@ -31,14 +31,36 @@ int __devinit read_current_timer(unsigned long *timer_value)
31void __delay(unsigned long loops) 31void __delay(unsigned long loops)
32{ 32{
33 unsigned bclock, now; 33 unsigned bclock, now;
34 int cpu;
34 35
35 preempt_disable(); /* TSC's are pre-cpu */ 36 preempt_disable();
37 cpu = smp_processor_id();
36 rdtscl(bclock); 38 rdtscl(bclock);
37 do { 39 for (;;) {
38 rep_nop();
39 rdtscl(now); 40 rdtscl(now);
41 if ((now - bclock) >= loops)
42 break;
43
44 /* Allow RT tasks to run */
45 preempt_enable();
46 rep_nop();
47 preempt_disable();
48
49 /*
50 * It is possible that we moved to another CPU, and
51 * since TSC's are per-cpu we need to calculate
52 * that. The delay must guarantee that we wait "at
53 * least" the amount of time. Being moved to another
54 * CPU could make the wait longer but we just need to
55 * make sure we waited long enough. Rebalance the
56 * counter for this CPU.
57 */
58 if (unlikely(cpu != smp_processor_id())) {
59 loops -= (now - bclock);
60 cpu = smp_processor_id();
61 rdtscl(bclock);
62 }
40 } 63 }
41 while ((now-bclock) < loops);
42 preempt_enable(); 64 preempt_enable();
43} 65}
44EXPORT_SYMBOL(__delay); 66EXPORT_SYMBOL(__delay);
diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c
index 6e38d877ea77..c7b06feb139b 100644
--- a/arch/x86/math-emu/fpu_entry.c
+++ b/arch/x86/math-emu/fpu_entry.c
@@ -30,6 +30,7 @@
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/desc.h> 31#include <asm/desc.h>
32#include <asm/user.h> 32#include <asm/user.h>
33#include <asm/i387.h>
33 34
34#include "fpu_system.h" 35#include "fpu_system.h"
35#include "fpu_emu.h" 36#include "fpu_emu.h"
@@ -146,6 +147,13 @@ asmlinkage void math_emulate(long arg)
146 unsigned long code_limit = 0; /* Initialized to stop compiler warnings */ 147 unsigned long code_limit = 0; /* Initialized to stop compiler warnings */
147 struct desc_struct code_descriptor; 148 struct desc_struct code_descriptor;
148 149
150 if (!used_math()) {
151 if (init_fpu(current)) {
152 do_group_exit(SIGKILL);
153 return;
154 }
155 }
156
149#ifdef RE_ENTRANT_CHECKING 157#ifdef RE_ENTRANT_CHECKING
150 if (emulating) { 158 if (emulating) {
151 printk("ERROR: wm-FPU-emu is not RE-ENTRANT!\n"); 159 printk("ERROR: wm-FPU-emu is not RE-ENTRANT!\n");
@@ -153,11 +161,6 @@ asmlinkage void math_emulate(long arg)
153 RE_ENTRANT_CHECK_ON; 161 RE_ENTRANT_CHECK_ON;
154#endif /* RE_ENTRANT_CHECKING */ 162#endif /* RE_ENTRANT_CHECKING */
155 163
156 if (!used_math()) {
157 finit();
158 set_used_math();
159 }
160
161 SETUP_DATA_AREA(arg); 164 SETUP_DATA_AREA(arg);
162 165
163 FPU_ORIG_EIP = FPU_EIP; 166 FPU_ORIG_EIP = FPU_EIP;
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index fd7e1798c75a..8bcb6f40ccb6 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -497,6 +497,11 @@ static int vmalloc_fault(unsigned long address)
497 unsigned long pgd_paddr; 497 unsigned long pgd_paddr;
498 pmd_t *pmd_k; 498 pmd_t *pmd_k;
499 pte_t *pte_k; 499 pte_t *pte_k;
500
501 /* Make sure we are in vmalloc area */
502 if (!(address >= VMALLOC_START && address < VMALLOC_END))
503 return -1;
504
500 /* 505 /*
501 * Synchronize this task's top level page-table 506 * Synchronize this task's top level page-table
502 * with the 'reference' page table. 507 * with the 'reference' page table.
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index de236e419cb5..ec30d10154b6 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -438,8 +438,6 @@ void zap_low_mappings(void)
438{ 438{
439 int i; 439 int i;
440 440
441 save_pg_dir();
442
443 /* 441 /*
444 * Zap initial low-memory mappings. 442 * Zap initial low-memory mappings.
445 * 443 *
@@ -663,16 +661,8 @@ void __init mem_init(void)
663 test_wp_bit(); 661 test_wp_bit();
664 662
665 cpa_init(); 663 cpa_init();
666 664 save_pg_dir();
667 /*
668 * Subtle. SMP is doing it's boot stuff late (because it has to
669 * fork idle threads) - but it also needs low mappings for the
670 * protected-mode entry to work. We zap these entries only after
671 * the WP-bit has been tested.
672 */
673#ifndef CONFIG_SMP
674 zap_low_mappings(); 665 zap_low_mappings();
675#endif
676} 666}
677 667
678#ifdef CONFIG_MEMORY_HOTPLUG 668#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 32ba13b0f818..156e6d7b0e32 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -206,7 +206,7 @@ void __init cleanup_highmap(void)
206 pmd_t *last_pmd = pmd + PTRS_PER_PMD; 206 pmd_t *last_pmd = pmd + PTRS_PER_PMD;
207 207
208 for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) { 208 for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) {
209 if (!pmd_present(*pmd)) 209 if (pmd_none(*pmd))
210 continue; 210 continue;
211 if (vaddr < (unsigned long) _text || vaddr > end) 211 if (vaddr < (unsigned long) _text || vaddr > end)
212 set_pmd(pmd, __pmd(0)); 212 set_pmd(pmd, __pmd(0));
@@ -506,7 +506,7 @@ early_param("memtest", parse_memtest);
506 506
507static void __init early_memtest(unsigned long start, unsigned long end) 507static void __init early_memtest(unsigned long start, unsigned long end)
508{ 508{
509 unsigned long t_start, t_size; 509 u64 t_start, t_size;
510 unsigned pattern; 510 unsigned pattern;
511 511
512 if (!memtest_pattern) 512 if (!memtest_pattern)
@@ -525,7 +525,7 @@ static void __init early_memtest(unsigned long start, unsigned long end)
525 if (t_start + t_size > end) 525 if (t_start + t_size > end)
526 t_size = end - t_start; 526 t_size = end - t_start;
527 527
528 printk(KERN_CONT "\n %016lx - %016lx pattern %d", 528 printk(KERN_CONT "\n %016llx - %016llx pattern %d",
529 t_start, t_start + t_size, pattern); 529 t_start, t_start + t_size, pattern);
530 530
531 memtest(t_start, t_size, pattern); 531 memtest(t_start, t_size, pattern);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 71bb3159031a..2b2bb3f9b683 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -593,10 +593,11 @@ void __init early_iounmap(void *addr, unsigned long size)
593 unsigned long offset; 593 unsigned long offset;
594 unsigned int nrpages; 594 unsigned int nrpages;
595 enum fixed_addresses idx; 595 enum fixed_addresses idx;
596 unsigned int nesting; 596 int nesting;
597 597
598 nesting = --early_ioremap_nested; 598 nesting = --early_ioremap_nested;
599 WARN_ON(nesting < 0); 599 if (WARN_ON(nesting < 0))
600 return;
600 601
601 if (early_ioremap_debug) { 602 if (early_ioremap_debug) {
602 printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr, 603 printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr,
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 60adbe22efa0..06b7a1c90fb8 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -28,13 +28,13 @@
28#ifdef CONFIG_X86_PAT 28#ifdef CONFIG_X86_PAT
29int __read_mostly pat_wc_enabled = 1; 29int __read_mostly pat_wc_enabled = 1;
30 30
31void __init pat_disable(char *reason) 31void __cpuinit pat_disable(char *reason)
32{ 32{
33 pat_wc_enabled = 0; 33 pat_wc_enabled = 0;
34 printk(KERN_INFO "%s\n", reason); 34 printk(KERN_INFO "%s\n", reason);
35} 35}
36 36
37static int nopat(char *str) 37static int __init nopat(char *str)
38{ 38{
39 pat_disable("PAT support disabled."); 39 pat_disable("PAT support disabled.");
40 return 0; 40 return 0;
@@ -151,32 +151,33 @@ static int pat_x_mtrr_type(u64 start, u64 end, unsigned long prot,
151 unsigned long pat_type; 151 unsigned long pat_type;
152 u8 mtrr_type; 152 u8 mtrr_type;
153 153
154 mtrr_type = mtrr_type_lookup(start, end);
155 if (mtrr_type == 0xFF) { /* MTRR not enabled */
156 *ret_prot = prot;
157 return 0;
158 }
159 if (mtrr_type == 0xFE) { /* MTRR match error */
160 *ret_prot = _PAGE_CACHE_UC;
161 return -1;
162 }
163 if (mtrr_type != MTRR_TYPE_UNCACHABLE &&
164 mtrr_type != MTRR_TYPE_WRBACK &&
165 mtrr_type != MTRR_TYPE_WRCOMB) { /* MTRR type unhandled */
166 *ret_prot = _PAGE_CACHE_UC;
167 return -1;
168 }
169
170 pat_type = prot & _PAGE_CACHE_MASK; 154 pat_type = prot & _PAGE_CACHE_MASK;
171 prot &= (~_PAGE_CACHE_MASK); 155 prot &= (~_PAGE_CACHE_MASK);
172 156
173 /* Currently doing intersection by hand. Optimize it later. */ 157 /*
158 * We return the PAT request directly for types where PAT takes
159 * precedence with respect to MTRR and for UC_MINUS.
160 * Consistency checks with other PAT requests is done later
161 * while going through memtype list.
162 */
174 if (pat_type == _PAGE_CACHE_WC) { 163 if (pat_type == _PAGE_CACHE_WC) {
175 *ret_prot = prot | _PAGE_CACHE_WC; 164 *ret_prot = prot | _PAGE_CACHE_WC;
165 return 0;
176 } else if (pat_type == _PAGE_CACHE_UC_MINUS) { 166 } else if (pat_type == _PAGE_CACHE_UC_MINUS) {
177 *ret_prot = prot | _PAGE_CACHE_UC_MINUS; 167 *ret_prot = prot | _PAGE_CACHE_UC_MINUS;
178 } else if (pat_type == _PAGE_CACHE_UC || 168 return 0;
179 mtrr_type == MTRR_TYPE_UNCACHABLE) { 169 } else if (pat_type == _PAGE_CACHE_UC) {
170 *ret_prot = prot | _PAGE_CACHE_UC;
171 return 0;
172 }
173
174 /*
175 * Look for MTRR hint to get the effective type in case where PAT
176 * request is for WB.
177 */
178 mtrr_type = mtrr_type_lookup(start, end);
179
180 if (mtrr_type == MTRR_TYPE_UNCACHABLE) {
180 *ret_prot = prot | _PAGE_CACHE_UC; 181 *ret_prot = prot | _PAGE_CACHE_UC;
181 } else if (mtrr_type == MTRR_TYPE_WRCOMB) { 182 } else if (mtrr_type == MTRR_TYPE_WRCOMB) {
182 *ret_prot = prot | _PAGE_CACHE_WC; 183 *ret_prot = prot | _PAGE_CACHE_WC;
@@ -233,14 +234,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
233 234
234 if (req_type == -1) { 235 if (req_type == -1) {
235 /* 236 /*
236 * Special case where caller wants to inherit from mtrr or 237 * Call mtrr_lookup to get the type hint. This is an
237 * existing pat mapping, defaulting to UC_MINUS in case of 238 * optimization for /dev/mem mmap'ers into WB memory (BIOS
238 * no match. 239 * tools and ACPI tools). Use WB request for WB memory and use
240 * UC_MINUS otherwise.
239 */ 241 */
240 u8 mtrr_type = mtrr_type_lookup(start, end); 242 u8 mtrr_type = mtrr_type_lookup(start, end);
241 if (mtrr_type == 0xFE) { /* MTRR match error */
242 err = -1;
243 }
244 243
245 if (mtrr_type == MTRR_TYPE_WRBACK) { 244 if (mtrr_type == MTRR_TYPE_WRBACK) {
246 req_type = _PAGE_CACHE_WB; 245 req_type = _PAGE_CACHE_WB;
@@ -555,7 +554,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
555 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", 554 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
556 current->comm, current->pid, 555 current->comm, current->pid,
557 cattr_name(flags), 556 cattr_name(flags),
558 offset, offset + size); 557 offset, (unsigned long long)(offset + size));
559 return 0; 558 return 0;
560 } 559 }
561 560
@@ -576,7 +575,7 @@ void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
576 "%s:%d /dev/mem expected mapping type %s for %Lx-%Lx, got %s\n", 575 "%s:%d /dev/mem expected mapping type %s for %Lx-%Lx, got %s\n",
577 current->comm, current->pid, 576 current->comm, current->pid,
578 cattr_name(want_flags), 577 cattr_name(want_flags),
579 addr, addr + size, 578 addr, (unsigned long long)(addr + size),
580 cattr_name(flags)); 579 cattr_name(flags));
581 } 580 }
582} 581}
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 3890234e5b26..99649dccad28 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -97,36 +97,9 @@ static __init inline int srat_disabled(void)
97 return numa_off || acpi_numa < 0; 97 return numa_off || acpi_numa < 0;
98} 98}
99 99
100/*
101 * A lot of BIOS fill in 10 (= no distance) everywhere. This messes
102 * up the NUMA heuristics which wants the local node to have a smaller
103 * distance than the others.
104 * Do some quick checks here and only use the SLIT if it passes.
105 */
106static __init int slit_valid(struct acpi_table_slit *slit)
107{
108 int i, j;
109 int d = slit->locality_count;
110 for (i = 0; i < d; i++) {
111 for (j = 0; j < d; j++) {
112 u8 val = slit->entry[d*i + j];
113 if (i == j) {
114 if (val != LOCAL_DISTANCE)
115 return 0;
116 } else if (val <= LOCAL_DISTANCE)
117 return 0;
118 }
119 }
120 return 1;
121}
122
123/* Callback for SLIT parsing */ 100/* Callback for SLIT parsing */
124void __init acpi_numa_slit_init(struct acpi_table_slit *slit) 101void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
125{ 102{
126 if (!slit_valid(slit)) {
127 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
128 return;
129 }
130 acpi_slit = slit; 103 acpi_slit = slit;
131} 104}
132 105
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 8545c8a9d107..940185ecaeda 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -302,18 +302,18 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
302 }, 302 },
303 { 303 {
304 .callback = set_bf_sort, 304 .callback = set_bf_sort,
305 .ident = "HP ProLiant DL385 G2", 305 .ident = "HP ProLiant DL360",
306 .matches = { 306 .matches = {
307 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 307 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
308 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"), 308 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL360"),
309 }, 309 },
310 }, 310 },
311 { 311 {
312 .callback = set_bf_sort, 312 .callback = set_bf_sort,
313 .ident = "HP ProLiant DL585 G2", 313 .ident = "HP ProLiant DL380",
314 .matches = { 314 .matches = {
315 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 315 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
316 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"), 316 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL380"),
317 }, 317 },
318 }, 318 },
319#ifdef __i386__ 319#ifdef __i386__
@@ -328,18 +328,18 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
328#endif 328#endif
329 { 329 {
330 .callback = set_bf_sort, 330 .callback = set_bf_sort,
331 .ident = "HP ProLiant DL385 G2", 331 .ident = "HP ProLiant DL360",
332 .matches = { 332 .matches = {
333 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 333 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
334 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"), 334 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL360"),
335 }, 335 },
336 }, 336 },
337 { 337 {
338 .callback = set_bf_sort, 338 .callback = set_bf_sort,
339 .ident = "HP ProLiant DL585 G2", 339 .ident = "HP ProLiant DL380",
340 .matches = { 340 .matches = {
341 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 341 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
342 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"), 342 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL380"),
343 }, 343 },
344 }, 344 },
345 {} 345 {}
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 8af0f0bae2af..10fb308fded8 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -301,15 +301,13 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
301 prot = pgprot_val(vma->vm_page_prot); 301 prot = pgprot_val(vma->vm_page_prot);
302 if (pat_wc_enabled && write_combine) 302 if (pat_wc_enabled && write_combine)
303 prot |= _PAGE_CACHE_WC; 303 prot |= _PAGE_CACHE_WC;
304 else if (pat_wc_enabled) 304 else if (pat_wc_enabled || boot_cpu_data.x86 > 3)
305 /* 305 /*
306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now. 306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
307 * To avoid attribute conflicts, request UC MINUS here 307 * To avoid attribute conflicts, request UC MINUS here
308 * aswell. 308 * aswell.
309 */ 309 */
310 prot |= _PAGE_CACHE_UC_MINUS; 310 prot |= _PAGE_CACHE_UC_MINUS;
311 else if (boot_cpu_data.x86 > 3)
312 prot |= _PAGE_CACHE_UC;
313 311
314 vma->vm_page_prot = __pgprot(prot); 312 vma->vm_page_prot = __pgprot(prot);
315 313
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index e70b9c57b88e..b821f4462d99 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -15,7 +15,8 @@ static __init int pci_access_init(void)
15 pci_mmcfg_early_init(); 15 pci_mmcfg_early_init();
16 16
17#ifdef CONFIG_PCI_OLPC 17#ifdef CONFIG_PCI_OLPC
18 pci_olpc_init(); 18 if (!pci_olpc_init())
19 return 0; /* skip additional checks if it's an XO */
19#endif 20#endif
20#ifdef CONFIG_PCI_BIOS 21#ifdef CONFIG_PCI_BIOS
21 pci_pcbios_init(); 22 pci_pcbios_init();
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 0908fca901bf..ca8df9c260bc 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -621,6 +621,13 @@ static __init int via_router_probe(struct irq_router *r,
621 */ 621 */
622 device = PCI_DEVICE_ID_VIA_8235; 622 device = PCI_DEVICE_ID_VIA_8235;
623 break; 623 break;
624 case PCI_DEVICE_ID_VIA_8237:
625 /**
626 * Asus a7v600 bios wrongly reports 8237
627 * as 586-compatible
628 */
629 device = PCI_DEVICE_ID_VIA_8237;
630 break;
624 } 631 }
625 } 632 }
626 633
diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c
index 5e7636558c02..e11e9e803d5f 100644
--- a/arch/x86/pci/olpc.c
+++ b/arch/x86/pci/olpc.c
@@ -302,12 +302,13 @@ static struct pci_raw_ops pci_olpc_conf = {
302 .write = pci_olpc_write, 302 .write = pci_olpc_write,
303}; 303};
304 304
305void __init pci_olpc_init(void) 305int __init pci_olpc_init(void)
306{ 306{
307 if (!machine_is_olpc() || olpc_has_vsa()) 307 if (!machine_is_olpc() || olpc_has_vsa())
308 return; 308 return -ENODEV;
309 309
310 printk(KERN_INFO "PCI: Using configuration type OLPC\n"); 310 printk(KERN_INFO "PCI: Using configuration type OLPC\n");
311 raw_pci_ops = &pci_olpc_conf; 311 raw_pci_ops = &pci_olpc_conf;
312 is_lx = is_geode_lx(); 312 is_lx = is_geode_lx();
313 return 0;
313} 314}
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index f3972b12c60a..720c4c554534 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -101,7 +101,7 @@ extern struct pci_raw_ops pci_direct_conf1;
101extern int pci_direct_probe(void); 101extern int pci_direct_probe(void);
102extern void pci_direct_init(int type); 102extern void pci_direct_init(int type);
103extern void pci_pcbios_init(void); 103extern void pci_pcbios_init(void);
104extern void pci_olpc_init(void); 104extern int pci_olpc_init(void);
105 105
106/* pci-mmconfig.c */ 106/* pci-mmconfig.c */
107 107
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 23476c2ebfc4..efa2ba7c6005 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -106,9 +106,9 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
106 do_realtime((struct timespec *)tv); 106 do_realtime((struct timespec *)tv);
107 tv->tv_usec /= 1000; 107 tv->tv_usec /= 1000;
108 if (unlikely(tz != NULL)) { 108 if (unlikely(tz != NULL)) {
109 /* This relies on gcc inlining the memcpy. We'll notice 109 /* Avoid memcpy. Some old compilers fail to inline it */
110 if it ever fails to do so. */ 110 tz->tz_minuteswest = gtod->sys_tz.tz_minuteswest;
111 memcpy(tz, &gtod->sys_tz, sizeof(struct timezone)); 111 tz->tz_dsttime = gtod->sys_tz.tz_dsttime;
112 } 112 }
113 return 0; 113 return 0;
114 } 114 }
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 126766d43aea..3525ef523a74 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -60,7 +60,7 @@ xmaddr_t arbitrary_virt_to_machine(unsigned long address)
60{ 60{
61 unsigned int level; 61 unsigned int level;
62 pte_t *pte = lookup_address(address, &level); 62 pte_t *pte = lookup_address(address, &level);
63 unsigned offset = address & PAGE_MASK; 63 unsigned offset = address & ~PAGE_MASK;
64 64
65 BUG_ON(pte == NULL); 65 BUG_ON(pte == NULL);
66 66
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index c39e1a5aa241..52b2e3856980 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -12,6 +12,7 @@
12#include <linux/clocksource.h> 12#include <linux/clocksource.h>
13#include <linux/clockchips.h> 13#include <linux/clockchips.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/math64.h>
15 16
16#include <asm/xen/hypervisor.h> 17#include <asm/xen/hypervisor.h>
17#include <asm/xen/hypercall.h> 18#include <asm/xen/hypercall.h>
@@ -150,11 +151,7 @@ static void do_stolen_accounting(void)
150 if (stolen < 0) 151 if (stolen < 0)
151 stolen = 0; 152 stolen = 0;
152 153
153 ticks = 0; 154 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
154 while (stolen >= NS_PER_TICK) {
155 ticks++;
156 stolen -= NS_PER_TICK;
157 }
158 __get_cpu_var(residual_stolen) = stolen; 155 __get_cpu_var(residual_stolen) = stolen;
159 account_steal_time(NULL, ticks); 156 account_steal_time(NULL, ticks);
160 157
@@ -166,11 +163,7 @@ static void do_stolen_accounting(void)
166 if (blocked < 0) 163 if (blocked < 0)
167 blocked = 0; 164 blocked = 0;
168 165
169 ticks = 0; 166 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
170 while (blocked >= NS_PER_TICK) {
171 ticks++;
172 blocked -= NS_PER_TICK;
173 }
174 __get_cpu_var(residual_blocked) = blocked; 167 __get_cpu_var(residual_blocked) = blocked;
175 account_steal_time(idle_task(smp_processor_id()), ticks); 168 account_steal_time(idle_task(smp_processor_id()), ticks);
176} 169}
diff --git a/arch/xtensa/kernel/init_task.c b/arch/xtensa/kernel/init_task.c
index 021b4f46ff94..3df469dbe814 100644
--- a/arch/xtensa/kernel/init_task.c
+++ b/arch/xtensa/kernel/init_task.c
@@ -22,7 +22,6 @@
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23 23
24static struct fs_struct init_fs = INIT_FS; 24static struct fs_struct init_fs = INIT_FS;
25static struct files_struct init_files = INIT_FILES;
26static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 25static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
27static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 26static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
28struct mm_struct init_mm = INIT_MM(init_mm); 27struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/block/blk-core.c b/block/blk-core.c
index 2987fe47b5ee..1905aaba49fb 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -482,6 +482,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
482 kobject_init(&q->kobj, &blk_queue_ktype); 482 kobject_init(&q->kobj, &blk_queue_ktype);
483 483
484 mutex_init(&q->sysfs_lock); 484 mutex_init(&q->sysfs_lock);
485 spin_lock_init(&q->__queue_lock);
485 486
486 return q; 487 return q;
487} 488}
@@ -544,10 +545,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
544 * if caller didn't supply a lock, they get per-queue locking with 545 * if caller didn't supply a lock, they get per-queue locking with
545 * our embedded lock 546 * our embedded lock
546 */ 547 */
547 if (!lock) { 548 if (!lock)
548 spin_lock_init(&q->__queue_lock);
549 lock = &q->__queue_lock; 549 lock = &q->__queue_lock;
550 }
551 550
552 q->request_fn = rfn; 551 q->request_fn = rfn;
553 q->prep_rq_fn = NULL; 552 q->prep_rq_fn = NULL;
@@ -807,35 +806,32 @@ static struct request *get_request_wait(struct request_queue *q, int rw_flags,
807 rq = get_request(q, rw_flags, bio, GFP_NOIO); 806 rq = get_request(q, rw_flags, bio, GFP_NOIO);
808 while (!rq) { 807 while (!rq) {
809 DEFINE_WAIT(wait); 808 DEFINE_WAIT(wait);
809 struct io_context *ioc;
810 struct request_list *rl = &q->rq; 810 struct request_list *rl = &q->rq;
811 811
812 prepare_to_wait_exclusive(&rl->wait[rw], &wait, 812 prepare_to_wait_exclusive(&rl->wait[rw], &wait,
813 TASK_UNINTERRUPTIBLE); 813 TASK_UNINTERRUPTIBLE);
814 814
815 rq = get_request(q, rw_flags, bio, GFP_NOIO); 815 blk_add_trace_generic(q, bio, rw, BLK_TA_SLEEPRQ);
816
817 if (!rq) {
818 struct io_context *ioc;
819
820 blk_add_trace_generic(q, bio, rw, BLK_TA_SLEEPRQ);
821 816
822 __generic_unplug_device(q); 817 __generic_unplug_device(q);
823 spin_unlock_irq(q->queue_lock); 818 spin_unlock_irq(q->queue_lock);
824 io_schedule(); 819 io_schedule();
825 820
826 /* 821 /*
827 * After sleeping, we become a "batching" process and 822 * After sleeping, we become a "batching" process and
828 * will be able to allocate at least one request, and 823 * will be able to allocate at least one request, and
829 * up to a big batch of them for a small period time. 824 * up to a big batch of them for a small period time.
830 * See ioc_batching, ioc_set_batching 825 * See ioc_batching, ioc_set_batching
831 */ 826 */
832 ioc = current_io_context(GFP_NOIO, q->node); 827 ioc = current_io_context(GFP_NOIO, q->node);
833 ioc_set_batching(q, ioc); 828 ioc_set_batching(q, ioc);
834 829
835 spin_lock_irq(q->queue_lock); 830 spin_lock_irq(q->queue_lock);
836 }
837 finish_wait(&rl->wait[rw], &wait); 831 finish_wait(&rl->wait[rw], &wait);
838 } 832
833 rq = get_request(q, rw_flags, bio, GFP_NOIO);
834 };
839 835
840 return rq; 836 return rq;
841} 837}
diff --git a/block/blk-settings.c b/block/blk-settings.c
index bb93d4c32775..8dd86418f35d 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -286,8 +286,14 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
286 t->max_hw_segments = min(t->max_hw_segments, b->max_hw_segments); 286 t->max_hw_segments = min(t->max_hw_segments, b->max_hw_segments);
287 t->max_segment_size = min(t->max_segment_size, b->max_segment_size); 287 t->max_segment_size = min(t->max_segment_size, b->max_segment_size);
288 t->hardsect_size = max(t->hardsect_size, b->hardsect_size); 288 t->hardsect_size = max(t->hardsect_size, b->hardsect_size);
289 if (!test_bit(QUEUE_FLAG_CLUSTER, &b->queue_flags)) 289 if (!t->queue_lock)
290 WARN_ON_ONCE(1);
291 else if (!test_bit(QUEUE_FLAG_CLUSTER, &b->queue_flags)) {
292 unsigned long flags;
293 spin_lock_irqsave(t->queue_lock, flags);
290 queue_flag_clear(QUEUE_FLAG_CLUSTER, t); 294 queue_flag_clear(QUEUE_FLAG_CLUSTER, t);
295 spin_unlock_irqrestore(t->queue_lock, flags);
296 }
291} 297}
292EXPORT_SYMBOL(blk_queue_stack_limits); 298EXPORT_SYMBOL(blk_queue_stack_limits);
293 299
diff --git a/block/blktrace.c b/block/blktrace.c
index 568588cd16b2..8d3a27780260 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -75,6 +75,24 @@ static void trace_note_time(struct blk_trace *bt)
75 local_irq_restore(flags); 75 local_irq_restore(flags);
76} 76}
77 77
78void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
79{
80 int n;
81 va_list args;
82 unsigned long flags;
83 char *buf;
84
85 local_irq_save(flags);
86 buf = per_cpu_ptr(bt->msg_data, smp_processor_id());
87 va_start(args, fmt);
88 n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
89 va_end(args);
90
91 trace_note(bt, 0, BLK_TN_MESSAGE, buf, n);
92 local_irq_restore(flags);
93}
94EXPORT_SYMBOL_GPL(__trace_note_message);
95
78static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector, 96static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector,
79 pid_t pid) 97 pid_t pid)
80{ 98{
@@ -141,10 +159,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
141 /* 159 /*
142 * A word about the locking here - we disable interrupts to reserve 160 * A word about the locking here - we disable interrupts to reserve
143 * some space in the relay per-cpu buffer, to prevent an irq 161 * some space in the relay per-cpu buffer, to prevent an irq
144 * from coming in and stepping on our toes. Once reserved, it's 162 * from coming in and stepping on our toes.
145 * enough to get preemption disabled to prevent read of this data
146 * before we are through filling it. get_cpu()/put_cpu() does this
147 * for us
148 */ 163 */
149 local_irq_save(flags); 164 local_irq_save(flags);
150 165
@@ -232,6 +247,7 @@ static void blk_trace_cleanup(struct blk_trace *bt)
232 debugfs_remove(bt->dropped_file); 247 debugfs_remove(bt->dropped_file);
233 blk_remove_tree(bt->dir); 248 blk_remove_tree(bt->dir);
234 free_percpu(bt->sequence); 249 free_percpu(bt->sequence);
250 free_percpu(bt->msg_data);
235 kfree(bt); 251 kfree(bt);
236} 252}
237 253
@@ -346,6 +362,10 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
346 if (!bt->sequence) 362 if (!bt->sequence)
347 goto err; 363 goto err;
348 364
365 bt->msg_data = __alloc_percpu(BLK_TN_MAX_MSG);
366 if (!bt->msg_data)
367 goto err;
368
349 ret = -ENOENT; 369 ret = -ENOENT;
350 dir = blk_create_tree(buts->name); 370 dir = blk_create_tree(buts->name);
351 if (!dir) 371 if (!dir)
@@ -392,6 +412,7 @@ err:
392 if (bt->dropped_file) 412 if (bt->dropped_file)
393 debugfs_remove(bt->dropped_file); 413 debugfs_remove(bt->dropped_file);
394 free_percpu(bt->sequence); 414 free_percpu(bt->sequence);
415 free_percpu(bt->msg_data);
395 if (bt->rchan) 416 if (bt->rchan)
396 relay_close(bt->rchan); 417 relay_close(bt->rchan);
397 kfree(bt); 418 kfree(bt);
@@ -476,7 +497,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
476 497
477 switch (cmd) { 498 switch (cmd) {
478 case BLKTRACESETUP: 499 case BLKTRACESETUP:
479 strcpy(b, bdevname(bdev, b)); 500 bdevname(bdev, b);
480 ret = blk_trace_setup(q, b, bdev->bd_dev, arg); 501 ret = blk_trace_setup(q, b, bdev->bd_dev, arg);
481 break; 502 break;
482 case BLKTRACESTART: 503 case BLKTRACESTART:
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index b399c62936e0..d01b411c72f0 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -124,6 +124,8 @@ struct cfq_data {
124struct cfq_queue { 124struct cfq_queue {
125 /* reference count */ 125 /* reference count */
126 atomic_t ref; 126 atomic_t ref;
127 /* various state flags, see below */
128 unsigned int flags;
127 /* parent cfq_data */ 129 /* parent cfq_data */
128 struct cfq_data *cfqd; 130 struct cfq_data *cfqd;
129 /* service_tree member */ 131 /* service_tree member */
@@ -138,14 +140,14 @@ struct cfq_queue {
138 int queued[2]; 140 int queued[2];
139 /* currently allocated requests */ 141 /* currently allocated requests */
140 int allocated[2]; 142 int allocated[2];
141 /* pending metadata requests */
142 int meta_pending;
143 /* fifo list of requests in sort_list */ 143 /* fifo list of requests in sort_list */
144 struct list_head fifo; 144 struct list_head fifo;
145 145
146 unsigned long slice_end; 146 unsigned long slice_end;
147 long slice_resid; 147 long slice_resid;
148 148
149 /* pending metadata requests */
150 int meta_pending;
149 /* number of requests that are on the dispatch list or inside driver */ 151 /* number of requests that are on the dispatch list or inside driver */
150 int dispatched; 152 int dispatched;
151 153
@@ -153,8 +155,6 @@ struct cfq_queue {
153 unsigned short ioprio, org_ioprio; 155 unsigned short ioprio, org_ioprio;
154 unsigned short ioprio_class, org_ioprio_class; 156 unsigned short ioprio_class, org_ioprio_class;
155 157
156 /* various state flags, see below */
157 unsigned int flags;
158}; 158};
159 159
160enum cfqq_state_flags { 160enum cfqq_state_flags {
@@ -1142,6 +1142,9 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
1142 kmem_cache_free(cfq_pool, cfqq); 1142 kmem_cache_free(cfq_pool, cfqq);
1143} 1143}
1144 1144
1145/*
1146 * Must always be called with the rcu_read_lock() held
1147 */
1145static void 1148static void
1146__call_for_each_cic(struct io_context *ioc, 1149__call_for_each_cic(struct io_context *ioc,
1147 void (*func)(struct io_context *, struct cfq_io_context *)) 1150 void (*func)(struct io_context *, struct cfq_io_context *))
@@ -1197,6 +1200,11 @@ static void cic_free_func(struct io_context *ioc, struct cfq_io_context *cic)
1197 cfq_cic_free(cic); 1200 cfq_cic_free(cic);
1198} 1201}
1199 1202
1203/*
1204 * Must be called with rcu_read_lock() held or preemption otherwise disabled.
1205 * Only two callers of this - ->dtor() which is called with the rcu_read_lock(),
1206 * and ->trim() which is called with the task lock held
1207 */
1200static void cfq_free_io_context(struct io_context *ioc) 1208static void cfq_free_io_context(struct io_context *ioc)
1201{ 1209{
1202 /* 1210 /*
@@ -1502,20 +1510,24 @@ static struct cfq_io_context *
1502cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc) 1510cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc)
1503{ 1511{
1504 struct cfq_io_context *cic; 1512 struct cfq_io_context *cic;
1513 unsigned long flags;
1505 void *k; 1514 void *k;
1506 1515
1507 if (unlikely(!ioc)) 1516 if (unlikely(!ioc))
1508 return NULL; 1517 return NULL;
1509 1518
1519 rcu_read_lock();
1520
1510 /* 1521 /*
1511 * we maintain a last-hit cache, to avoid browsing over the tree 1522 * we maintain a last-hit cache, to avoid browsing over the tree
1512 */ 1523 */
1513 cic = rcu_dereference(ioc->ioc_data); 1524 cic = rcu_dereference(ioc->ioc_data);
1514 if (cic && cic->key == cfqd) 1525 if (cic && cic->key == cfqd) {
1526 rcu_read_unlock();
1515 return cic; 1527 return cic;
1528 }
1516 1529
1517 do { 1530 do {
1518 rcu_read_lock();
1519 cic = radix_tree_lookup(&ioc->radix_root, (unsigned long) cfqd); 1531 cic = radix_tree_lookup(&ioc->radix_root, (unsigned long) cfqd);
1520 rcu_read_unlock(); 1532 rcu_read_unlock();
1521 if (!cic) 1533 if (!cic)
@@ -1524,10 +1536,13 @@ cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc)
1524 k = cic->key; 1536 k = cic->key;
1525 if (unlikely(!k)) { 1537 if (unlikely(!k)) {
1526 cfq_drop_dead_cic(cfqd, ioc, cic); 1538 cfq_drop_dead_cic(cfqd, ioc, cic);
1539 rcu_read_lock();
1527 continue; 1540 continue;
1528 } 1541 }
1529 1542
1543 spin_lock_irqsave(&ioc->lock, flags);
1530 rcu_assign_pointer(ioc->ioc_data, cic); 1544 rcu_assign_pointer(ioc->ioc_data, cic);
1545 spin_unlock_irqrestore(&ioc->lock, flags);
1531 break; 1546 break;
1532 } while (1); 1547 } while (1);
1533 1548
@@ -2134,6 +2149,10 @@ static void *cfq_init_queue(struct request_queue *q)
2134 2149
2135static void cfq_slab_kill(void) 2150static void cfq_slab_kill(void)
2136{ 2151{
2152 /*
2153 * Caller already ensured that pending RCU callbacks are completed,
2154 * so we should have no busy allocations at this point.
2155 */
2137 if (cfq_pool) 2156 if (cfq_pool)
2138 kmem_cache_destroy(cfq_pool); 2157 kmem_cache_destroy(cfq_pool);
2139 if (cfq_ioc_pool) 2158 if (cfq_ioc_pool)
@@ -2292,6 +2311,11 @@ static void __exit cfq_exit(void)
2292 ioc_gone = &all_gone; 2311 ioc_gone = &all_gone;
2293 /* ioc_gone's update must be visible before reading ioc_count */ 2312 /* ioc_gone's update must be visible before reading ioc_count */
2294 smp_wmb(); 2313 smp_wmb();
2314
2315 /*
2316 * this also protects us from entering cfq_slab_kill() with
2317 * pending RCU callbacks
2318 */
2295 if (elv_ioc_count_read(ioc_count)) 2319 if (elv_ioc_count_read(ioc_count))
2296 wait_for_completion(ioc_gone); 2320 wait_for_completion(ioc_gone);
2297 cfq_slab_kill(); 2321 cfq_slab_kill();
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index c70d0b6f666f..c23177e4623f 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -555,7 +555,7 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg)
555 if (copy_from_user(&cbuts, arg, sizeof(cbuts))) 555 if (copy_from_user(&cbuts, arg, sizeof(cbuts)))
556 return -EFAULT; 556 return -EFAULT;
557 557
558 strcpy(b, bdevname(bdev, b)); 558 bdevname(bdev, b);
559 559
560 buts = (struct blk_user_trace_setup) { 560 buts = (struct blk_user_trace_setup) {
561 .act_mask = cbuts.act_mask, 561 .act_mask = cbuts.act_mask,
diff --git a/block/elevator.c b/block/elevator.c
index 980f8ae147b4..902dd1344d56 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -1110,6 +1110,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1110 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q); 1110 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
1111 spin_unlock_irq(q->queue_lock); 1111 spin_unlock_irq(q->queue_lock);
1112 1112
1113 blk_add_trace_msg(q, "elv switch: %s", e->elevator_type->elevator_name);
1114
1113 return 1; 1115 return 1;
1114 1116
1115fail_register: 1117fail_register:
diff --git a/block/genhd.c b/block/genhd.c
index fda9c7a63c29..b922d4801c87 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -653,15 +653,21 @@ void genhd_media_change_notify(struct gendisk *disk)
653EXPORT_SYMBOL_GPL(genhd_media_change_notify); 653EXPORT_SYMBOL_GPL(genhd_media_change_notify);
654#endif /* 0 */ 654#endif /* 0 */
655 655
656dev_t blk_lookup_devt(const char *name) 656dev_t blk_lookup_devt(const char *name, int part)
657{ 657{
658 struct device *dev; 658 struct device *dev;
659 dev_t devt = MKDEV(0, 0); 659 dev_t devt = MKDEV(0, 0);
660 660
661 mutex_lock(&block_class_lock); 661 mutex_lock(&block_class_lock);
662 list_for_each_entry(dev, &block_class.devices, node) { 662 list_for_each_entry(dev, &block_class.devices, node) {
663 if (dev->type != &disk_type)
664 continue;
663 if (strcmp(dev->bus_id, name) == 0) { 665 if (strcmp(dev->bus_id, name) == 0) {
664 devt = dev->devt; 666 struct gendisk *disk = dev_to_disk(dev);
667
668 if (part < disk->minors)
669 devt = MKDEV(MAJOR(dev->devt),
670 MINOR(dev->devt) + part);
665 break; 671 break;
666 } 672 }
667 } 673 }
@@ -669,7 +675,6 @@ dev_t blk_lookup_devt(const char *name)
669 675
670 return devt; 676 return devt;
671} 677}
672
673EXPORT_SYMBOL(blk_lookup_devt); 678EXPORT_SYMBOL(blk_lookup_devt);
674 679
675struct gendisk *alloc_disk(int minors) 680struct gendisk *alloc_disk(int minors)
diff --git a/crypto/cts.c b/crypto/cts.c
index c4e70bfb4970..ccf9c5de3958 100644
--- a/crypto/cts.c
+++ b/crypto/cts.c
@@ -89,6 +89,9 @@ static int cts_cbc_encrypt(struct crypto_cts_ctx *ctx,
89 if (lastn < 0) 89 if (lastn < 0)
90 return -EINVAL; 90 return -EINVAL;
91 91
92 sg_init_table(sgsrc, 1);
93 sg_init_table(sgdst, 1);
94
92 memset(s, 0, sizeof(s)); 95 memset(s, 0, sizeof(s));
93 scatterwalk_map_and_copy(s, src, offset, nbytes, 0); 96 scatterwalk_map_and_copy(s, src, offset, nbytes, 0);
94 97
@@ -172,6 +175,9 @@ static int cts_cbc_decrypt(struct crypto_cts_ctx *ctx,
172 if (lastn < 0) 175 if (lastn < 0)
173 return -EINVAL; 176 return -EINVAL;
174 177
178 sg_init_table(sgsrc, 1);
179 sg_init_table(sgdst, 1);
180
175 scatterwalk_map_and_copy(s, src, offset, nbytes, 0); 181 scatterwalk_map_and_copy(s, src, offset, nbytes, 0);
176 182
177 lcldesc.tfm = ctx->child; 183 lcldesc.tfm = ctx->child;
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index d2fc94161848..26038c2a2a71 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -301,16 +301,20 @@ static int bay_add(acpi_handle handle, int id)
301 */ 301 */
302 pdev->dev.uevent_suppress = 0; 302 pdev->dev.uevent_suppress = 0;
303 303
304 if (acpi_bay_add_fs(new_bay)) {
305 platform_device_unregister(new_bay->pdev);
306 goto bay_add_err;
307 }
308
309 /* register for events on this device */ 304 /* register for events on this device */
310 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 305 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
311 bay_notify, new_bay); 306 bay_notify, new_bay);
312 if (ACPI_FAILURE(status)) { 307 if (ACPI_FAILURE(status)) {
313 printk(KERN_ERR PREFIX "Error installing bay notify handler\n"); 308 printk(KERN_INFO PREFIX "Error installing bay notify handler\n");
309 platform_device_unregister(new_bay->pdev);
310 goto bay_add_err;
311 }
312
313 if (acpi_bay_add_fs(new_bay)) {
314 acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
315 bay_notify);
316 platform_device_unregister(new_bay->pdev);
317 goto bay_add_err;
314 } 318 }
315 319
316 /* if we are on a dock station, we should register for dock 320 /* if we are on a dock station, we should register for dock
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c
index c78078315be9..f988a5e7d2b4 100644
--- a/drivers/acpi/dispatcher/dsfield.c
+++ b/drivers/acpi/dispatcher/dsfield.c
@@ -450,10 +450,6 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
450 return_ACPI_STATUS(AE_BAD_PARAMETER); 450 return_ACPI_STATUS(AE_BAD_PARAMETER);
451 } 451 }
452 452
453 if (!arg) {
454 return_ACPI_STATUS(AE_AML_NO_OPERAND);
455 }
456
457 /* Creating new namespace node(s), should not already exist */ 453 /* Creating new namespace node(s), should not already exist */
458 454
459 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 455 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
@@ -467,6 +463,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
467 463
468 /* 464 /*
469 * Walk the list of entries in the field_list 465 * Walk the list of entries in the field_list
466 * Note: field_list can be of zero length. In this case, Arg will be NULL.
470 */ 467 */
471 while (arg) { 468 while (arg) {
472 /* 469 /*
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index e48a3ea03117..2509809a36cf 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -565,7 +565,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
565 565
566 acpi_os_release_mutex(method_desc->method. 566 acpi_os_release_mutex(method_desc->method.
567 mutex->mutex.os_mutex); 567 mutex->mutex.os_mutex);
568 method_desc->method.mutex->mutex.thread_id = 0; 568 method_desc->method.mutex->mutex.thread_id = NULL;
569 } 569 }
570 } 570 }
571 571
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index fa44fb96fc34..96c542f7fded 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -834,7 +834,7 @@ static int dock_add(acpi_handle handle)
834 goto dock_add_err; 834 goto dock_add_err;
835 } 835 }
836 836
837 printk(KERN_INFO PREFIX "%s \n", ACPI_DOCK_DRIVER_DESCRIPTION); 837 printk(KERN_INFO PREFIX "%s\n", ACPI_DOCK_DRIVER_DESCRIPTION);
838 838
839 return 0; 839 return 0;
840 840
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 0924992187e8..5622aee996b2 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -194,7 +194,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
194 while (time_before(jiffies, delay)) { 194 while (time_before(jiffies, delay)) {
195 if (acpi_ec_check_status(ec, event)) 195 if (acpi_ec_check_status(ec, event))
196 return 0; 196 return 0;
197 udelay(ACPI_EC_UDELAY); 197 msleep(1);
198 } 198 }
199 } 199 }
200 pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", 200 pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n",
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 24da921d13e3..39d742190584 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -375,9 +375,15 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
375 goto cleanup; 375 goto cleanup;
376 } 376 }
377 377
378 /*
379 * Add the table to the namespace.
380 *
381 * Note: We load the table objects relative to the root of the namespace.
382 * This appears to go against the ACPI specification, but we do it for
383 * compatibility with other ACPI implementations.
384 */
378 status = 385 status =
379 acpi_ex_add_table(table_index, walk_state->scope_info->scope.node, 386 acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle);
380 &ddb_handle);
381 if (ACPI_FAILURE(status)) { 387 if (ACPI_FAILURE(status)) {
382 388
383 /* On error, table_ptr was deallocated above */ 389 /* On error, table_ptr was deallocated above */
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
index c873ab40cd0e..a8bf3d713e28 100644
--- a/drivers/acpi/executer/exmutex.c
+++ b/drivers/acpi/executer/exmutex.c
@@ -326,7 +326,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc)
326 326
327 /* Clear mutex info */ 327 /* Clear mutex info */
328 328
329 obj_desc->mutex.thread_id = 0; 329 obj_desc->mutex.thread_id = NULL;
330 return_ACPI_STATUS(status); 330 return_ACPI_STATUS(status);
331} 331}
332 332
@@ -463,7 +463,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
463 /* Mark mutex unowned */ 463 /* Mark mutex unowned */
464 464
465 obj_desc->mutex.owner_thread = NULL; 465 obj_desc->mutex.owner_thread = NULL;
466 obj_desc->mutex.thread_id = 0; 466 obj_desc->mutex.thread_id = NULL;
467 467
468 /* Update Thread sync_level (Last mutex is the important one) */ 468 /* Update Thread sync_level (Last mutex is the important one) */
469 469
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 06f8634fe58b..2808dc60fd67 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -272,6 +272,12 @@ static u32 rtc_handler(void *context)
272static inline void rtc_wake_setup(void) 272static inline void rtc_wake_setup(void)
273{ 273{
274 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 274 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
275 /*
276 * After the RTC handler is installed, the Fixed_RTC event should
277 * be disabled. Only when the RTC alarm is set will it be enabled.
278 */
279 acpi_clear_event(ACPI_EVENT_RTC);
280 acpi_disable_event(ACPI_EVENT_RTC, 0);
275} 281}
276 282
277static void rtc_wake_on(struct device *dev) 283static void rtc_wake_on(struct device *dev)
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index d9937e05ec6a..dba3cfbe8cba 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -223,15 +223,17 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
223 break; 223 break;
224 } 224 }
225 225
226 /* Set the system indicators to show the desired sleep state. */ 226 /*
227 227 * Set the system indicators to show the desired sleep state.
228 * _SST is an optional method (return no error if not found)
229 */
228 status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 230 status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
229 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 231 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
230 ACPI_EXCEPTION((AE_INFO, status, 232 ACPI_EXCEPTION((AE_INFO, status,
231 "While executing method _SST")); 233 "While executing method _SST"));
232 } 234 }
233 235
234 return_ACPI_STATUS(status); 236 return_ACPI_STATUS(AE_OK);
235} 237}
236 238
237ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 239ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 5d59cb33b1a5..658e5f3abae0 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -140,19 +140,42 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
140 } 140 }
141} 141}
142 142
143/*
144 * A lot of BIOS fill in 10 (= no distance) everywhere. This messes
145 * up the NUMA heuristics which wants the local node to have a smaller
146 * distance than the others.
147 * Do some quick checks here and only use the SLIT if it passes.
148 */
149static __init int slit_valid(struct acpi_table_slit *slit)
150{
151 int i, j;
152 int d = slit->locality_count;
153 for (i = 0; i < d; i++) {
154 for (j = 0; j < d; j++) {
155 u8 val = slit->entry[d*i + j];
156 if (i == j) {
157 if (val != LOCAL_DISTANCE)
158 return 0;
159 } else if (val <= LOCAL_DISTANCE)
160 return 0;
161 }
162 }
163 return 1;
164}
165
143static int __init acpi_parse_slit(struct acpi_table_header *table) 166static int __init acpi_parse_slit(struct acpi_table_header *table)
144{ 167{
145 struct acpi_table_slit *slit; 168 struct acpi_table_slit *slit;
146 u32 localities;
147 169
148 if (!table) 170 if (!table)
149 return -EINVAL; 171 return -EINVAL;
150 172
151 slit = (struct acpi_table_slit *)table; 173 slit = (struct acpi_table_slit *)table;
152 174
153 /* downcast just for %llu vs %lu for i386/ia64 */ 175 if (!slit_valid(slit)) {
154 localities = (u32) slit->locality_count; 176 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
155 177 return -EINVAL;
178 }
156 acpi_numa_slit_init(slit); 179 acpi_numa_slit_init(slit);
157 180
158 return 0; 181 return 0;
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index f1e8bf65e24e..e94463778845 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -268,7 +268,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
268 */ 268 */
269 if (ACPI_SUCCESS(status) && 269 if (ACPI_SUCCESS(status) &&
270 possible_method_call && (node->type == ACPI_TYPE_METHOD)) { 270 possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
271 if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { 271 if (walk_state->opcode == AML_UNLOAD_OP) {
272 /* 272 /*
273 * acpi_ps_get_next_namestring has increased the AML pointer, 273 * acpi_ps_get_next_namestring has increased the AML pointer,
274 * so we need to restore the saved AML pointer for method call. 274 * so we need to restore the saved AML pointer for method call.
@@ -691,7 +691,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
691 691
692 /* To support super_name arg of Unload */ 692 /* To support super_name arg of Unload */
693 693
694 if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { 694 if (walk_state->opcode == AML_UNLOAD_OP) {
695 status = 695 status =
696 acpi_ps_get_next_namepath(walk_state, 696 acpi_ps_get_next_namepath(walk_state,
697 parser_state, arg, 697 parser_state, arg,
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 386e5aa48834..9dd0fa93b9e1 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -86,7 +86,6 @@ static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
86static void acpi_processor_notify(acpi_handle handle, u32 event, void *data); 86static void acpi_processor_notify(acpi_handle handle, u32 event, void *data);
87static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 87static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
88static int acpi_processor_handle_eject(struct acpi_processor *pr); 88static int acpi_processor_handle_eject(struct acpi_processor *pr);
89extern int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
90 89
91 90
92static const struct acpi_device_id processor_device_ids[] = { 91static const struct acpi_device_id processor_device_ids[] = {
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2dd2c1f3a01c..556ee1585192 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1669,6 +1669,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1669 return -EINVAL; 1669 return -EINVAL;
1670 } 1670 }
1671 1671
1672 dev->cpu = pr->id;
1672 for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 1673 for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
1673 dev->states[i].name[0] = '\0'; 1674 dev->states[i].name[0] = '\0';
1674 dev->states[i].desc[0] = '\0'; 1675 dev->states[i].desc[0] = '\0';
@@ -1738,7 +1739,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1738 1739
1739int acpi_processor_cst_has_changed(struct acpi_processor *pr) 1740int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1740{ 1741{
1741 int ret; 1742 int ret = 0;
1742 1743
1743 if (boot_option_idle_override) 1744 if (boot_option_idle_override)
1744 return 0; 1745 return 0;
@@ -1756,8 +1757,10 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1756 cpuidle_pause_and_lock(); 1757 cpuidle_pause_and_lock();
1757 cpuidle_disable_device(&pr->power.dev); 1758 cpuidle_disable_device(&pr->power.dev);
1758 acpi_processor_get_power_info(pr); 1759 acpi_processor_get_power_info(pr);
1759 acpi_processor_setup_cpuidle(pr); 1760 if (pr->flags.power) {
1760 ret = cpuidle_enable_device(&pr->power.dev); 1761 acpi_processor_setup_cpuidle(pr);
1762 ret = cpuidle_enable_device(&pr->power.dev);
1763 }
1761 cpuidle_resume_and_unlock(); 1764 cpuidle_resume_and_unlock();
1762 1765
1763 return ret; 1766 return ret;
@@ -1813,7 +1816,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1813 if (pr->flags.power) { 1816 if (pr->flags.power) {
1814#ifdef CONFIG_CPU_IDLE 1817#ifdef CONFIG_CPU_IDLE
1815 acpi_processor_setup_cpuidle(pr); 1818 acpi_processor_setup_cpuidle(pr);
1816 pr->power.dev.cpu = pr->id;
1817 if (cpuidle_register_device(&pr->power.dev)) 1819 if (cpuidle_register_device(&pr->power.dev))
1818 return -EIO; 1820 return -EIO;
1819#endif 1821#endif
@@ -1850,8 +1852,7 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1850 return 0; 1852 return 0;
1851 1853
1852#ifdef CONFIG_CPU_IDLE 1854#ifdef CONFIG_CPU_IDLE
1853 if (pr->flags.power) 1855 cpuidle_unregister_device(&pr->power.dev);
1854 cpuidle_unregister_device(&pr->power.dev);
1855#endif 1856#endif
1856 pr->flags.power_setup_done = 0; 1857 pr->flags.power_setup_done = 0;
1857 1858
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 8a5fe8710513..224c57c03381 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -495,6 +495,12 @@ static int __init acpi_sleep_proc_init(void)
495 acpi_root_dir, &acpi_system_alarm_fops); 495 acpi_root_dir, &acpi_system_alarm_fops);
496 496
497 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 497 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
498 /*
499 * Disable the RTC event after installing RTC handler.
500 * Only when RTC alarm is set will it be enabled.
501 */
502 acpi_clear_event(ACPI_EVENT_RTC);
503 acpi_disable_event(ACPI_EVENT_RTC, 0);
498#endif /* HAVE_ACPI_LEGACY_ALARM */ 504#endif /* HAVE_ACPI_LEGACY_ALARM */
499 505
500 /* 'wakeup device' [R/W] */ 506 /* 'wakeup device' [R/W] */
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index 769f24855eb6..5bd2dec9a7ac 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -77,7 +77,6 @@ static ssize_t acpi_table_show(struct kobject *kobj,
77 container_of(bin_attr, struct acpi_table_attr, attr); 77 container_of(bin_attr, struct acpi_table_attr, attr);
78 struct acpi_table_header *table_header = NULL; 78 struct acpi_table_header *table_header = NULL;
79 acpi_status status; 79 acpi_status status;
80 ssize_t ret_count = count;
81 80
82 status = 81 status =
83 acpi_get_table(table_attr->name, table_attr->instance, 82 acpi_get_table(table_attr->name, table_attr->instance,
@@ -85,18 +84,8 @@ static ssize_t acpi_table_show(struct kobject *kobj,
85 if (ACPI_FAILURE(status)) 84 if (ACPI_FAILURE(status))
86 return -ENODEV; 85 return -ENODEV;
87 86
88 if (offset >= table_header->length) { 87 return memory_read_from_buffer(buf, count, &offset,
89 ret_count = 0; 88 table_header, table_header->length);
90 goto end;
91 }
92
93 if (offset + ret_count > table_header->length)
94 ret_count = table_header->length - offset;
95
96 memcpy(buf, ((char *)table_header) + offset, ret_count);
97
98 end:
99 return ret_count;
100} 89}
101 90
102static void acpi_table_attr_init(struct acpi_table_attr *table_attr, 91static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 402f93e1ff20..5336ce88f89f 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -123,24 +123,13 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc,
123 } 123 }
124 } 124 }
125 125
126 /* The table must be either an SSDT or a PSDT or an OEMx */ 126 /*
127 127 * Originally, we checked the table signature for "SSDT" or "PSDT" here.
128 if (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)&& 128 * Next, we added support for OEMx tables, signature "OEM".
129 !ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)&& 129 * Valid tables were encountered with a null signature, so we've just
130 strncmp(table_desc->pointer->signature, "OEM", 3)) { 130 * given up on validating the signature, since it seems to be a waste
131 /* Check for a printable name */ 131 * of code. The original code was removed (05/2008).
132 if (acpi_ut_valid_acpi_name( 132 */
133 *(u32 *) table_desc->pointer->signature)) {
134 ACPI_ERROR((AE_INFO, "Table has invalid signature "
135 "[%4.4s], must be SSDT or PSDT",
136 table_desc->pointer->signature));
137 } else {
138 ACPI_ERROR((AE_INFO, "Table has invalid signature "
139 "(0x%8.8X), must be SSDT or PSDT",
140 *(u32 *) table_desc->pointer->signature));
141 }
142 return_ACPI_STATUS(AE_BAD_SIGNATURE);
143 }
144 133
145 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 134 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
146 135
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index fb57b93c2495..0e319604d3e7 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -540,7 +540,7 @@ static acpi_status acpi_tb_load_namespace(void)
540 acpi_tb_print_table_header(0, table); 540 acpi_tb_print_table_header(0, table);
541 541
542 if (no_auto_ssdt == 0) { 542 if (no_auto_ssdt == 0) {
543 printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\""); 543 printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\"\n");
544 } 544 }
545 } 545 }
546 546
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 504385b1f211..84c795fb9b1e 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -364,10 +364,17 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
364 if (flag & ACPI_TRIPS_CRITICAL) { 364 if (flag & ACPI_TRIPS_CRITICAL) {
365 status = acpi_evaluate_integer(tz->device->handle, 365 status = acpi_evaluate_integer(tz->device->handle,
366 "_CRT", NULL, &tz->trips.critical.temperature); 366 "_CRT", NULL, &tz->trips.critical.temperature);
367 if (ACPI_FAILURE(status)) { 367 /*
368 * Treat freezing temperatures as invalid as well; some
369 * BIOSes return really low values and cause reboots at startup.
370 * Below zero (Celcius) values clearly aren't right for sure..
371 * ... so lets discard those as invalid.
372 */
373 if (ACPI_FAILURE(status) ||
374 tz->trips.critical.temperature <= 2732) {
368 tz->trips.critical.flags.valid = 0; 375 tz->trips.critical.flags.valid = 0;
369 ACPI_EXCEPTION((AE_INFO, status, 376 ACPI_EXCEPTION((AE_INFO, status,
370 "No critical threshold")); 377 "No or invalid critical threshold"));
371 return -ENODEV; 378 return -ENODEV;
372 } else { 379 } else {
373 tz->trips.critical.flags.valid = 1; 380 tz->trips.critical.flags.valid = 1;
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index e4ba7192cd15..1f057b71db1a 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -1048,6 +1048,7 @@ acpi_ut_exception(char *module_name,
1048 va_start(args, format); 1048 va_start(args, format);
1049 acpi_os_vprintf(format, args); 1049 acpi_os_vprintf(format, args);
1050 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1050 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
1051 va_end(args);
1051} 1052}
1052 1053
1053EXPORT_SYMBOL(acpi_ut_exception); 1054EXPORT_SYMBOL(acpi_ut_exception);
@@ -1063,7 +1064,6 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...)
1063 acpi_os_vprintf(format, args); 1064 acpi_os_vprintf(format, args);
1064 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1065 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
1065 va_end(args); 1066 va_end(args);
1066 va_end(args);
1067} 1067}
1068 1068
1069void ACPI_INTERNAL_VAR_XFACE 1069void ACPI_INTERNAL_VAR_XFACE
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 97f83fb2ee2e..966ab401e523 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -89,6 +89,7 @@ enum {
89 board_ahci_sb600 = 3, 89 board_ahci_sb600 = 3,
90 board_ahci_mv = 4, 90 board_ahci_mv = 4,
91 board_ahci_sb700 = 5, 91 board_ahci_sb700 = 5,
92 board_ahci_mcp65 = 6,
92 93
93 /* global controller registers */ 94 /* global controller registers */
94 HOST_CAP = 0x00, /* host capabilities */ 95 HOST_CAP = 0x00, /* host capabilities */
@@ -190,6 +191,7 @@ enum {
190 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ 191 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */
191 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */ 192 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */
192 AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ 193 AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */
194 AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */
193 195
194 /* ap->flags bits */ 196 /* ap->flags bits */
195 197
@@ -253,6 +255,8 @@ static void ahci_pmp_attach(struct ata_port *ap);
253static void ahci_pmp_detach(struct ata_port *ap); 255static void ahci_pmp_detach(struct ata_port *ap);
254static int ahci_softreset(struct ata_link *link, unsigned int *class, 256static int ahci_softreset(struct ata_link *link, unsigned int *class,
255 unsigned long deadline); 257 unsigned long deadline);
258static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
259 unsigned long deadline);
256static int ahci_hardreset(struct ata_link *link, unsigned int *class, 260static int ahci_hardreset(struct ata_link *link, unsigned int *class,
257 unsigned long deadline); 261 unsigned long deadline);
258static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, 262static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
@@ -329,6 +333,12 @@ static struct ata_port_operations ahci_p5wdh_ops = {
329 .hardreset = ahci_p5wdh_hardreset, 333 .hardreset = ahci_p5wdh_hardreset,
330}; 334};
331 335
336static struct ata_port_operations ahci_sb600_ops = {
337 .inherits = &ahci_ops,
338 .softreset = ahci_sb600_softreset,
339 .pmp_softreset = ahci_sb600_softreset,
340};
341
332#define AHCI_HFLAGS(flags) .private_data = (void *)(flags) 342#define AHCI_HFLAGS(flags) .private_data = (void *)(flags)
333 343
334static const struct ata_port_info ahci_port_info[] = { 344static const struct ata_port_info ahci_port_info[] = {
@@ -359,11 +369,11 @@ static const struct ata_port_info ahci_port_info[] = {
359 { 369 {
360 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 370 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL |
361 AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI | 371 AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
362 AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), 372 AHCI_HFLAG_SECT255),
363 .flags = AHCI_FLAG_COMMON, 373 .flags = AHCI_FLAG_COMMON,
364 .pio_mask = 0x1f, /* pio0-4 */ 374 .pio_mask = 0x1f, /* pio0-4 */
365 .udma_mask = ATA_UDMA6, 375 .udma_mask = ATA_UDMA6,
366 .port_ops = &ahci_ops, 376 .port_ops = &ahci_sb600_ops,
367 }, 377 },
368 /* board_ahci_mv */ 378 /* board_ahci_mv */
369 { 379 {
@@ -377,8 +387,15 @@ static const struct ata_port_info ahci_port_info[] = {
377 }, 387 },
378 /* board_ahci_sb700 */ 388 /* board_ahci_sb700 */
379 { 389 {
380 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 390 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL),
381 AHCI_HFLAG_NO_PMP), 391 .flags = AHCI_FLAG_COMMON,
392 .pio_mask = 0x1f, /* pio0-4 */
393 .udma_mask = ATA_UDMA6,
394 .port_ops = &ahci_sb600_ops,
395 },
396 /* board_ahci_mcp65 */
397 {
398 AHCI_HFLAGS (AHCI_HFLAG_YES_NCQ),
382 .flags = AHCI_FLAG_COMMON, 399 .flags = AHCI_FLAG_COMMON,
383 .pio_mask = 0x1f, /* pio0-4 */ 400 .pio_mask = 0x1f, /* pio0-4 */
384 .udma_mask = ATA_UDMA6, 401 .udma_mask = ATA_UDMA6,
@@ -438,14 +455,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
438 { PCI_VDEVICE(VIA, 0x6287), board_ahci_vt8251 }, /* VIA VT8251 */ 455 { PCI_VDEVICE(VIA, 0x6287), board_ahci_vt8251 }, /* VIA VT8251 */
439 456
440 /* NVIDIA */ 457 /* NVIDIA */
441 { PCI_VDEVICE(NVIDIA, 0x044c), board_ahci }, /* MCP65 */ 458 { PCI_VDEVICE(NVIDIA, 0x044c), board_ahci_mcp65 }, /* MCP65 */
442 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci }, /* MCP65 */ 459 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci_mcp65 }, /* MCP65 */
443 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci }, /* MCP65 */ 460 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci_mcp65 }, /* MCP65 */
444 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci }, /* MCP65 */ 461 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci_mcp65 }, /* MCP65 */
445 { PCI_VDEVICE(NVIDIA, 0x045c), board_ahci }, /* MCP65 */ 462 { PCI_VDEVICE(NVIDIA, 0x045c), board_ahci_mcp65 }, /* MCP65 */
446 { PCI_VDEVICE(NVIDIA, 0x045d), board_ahci }, /* MCP65 */ 463 { PCI_VDEVICE(NVIDIA, 0x045d), board_ahci_mcp65 }, /* MCP65 */
447 { PCI_VDEVICE(NVIDIA, 0x045e), board_ahci }, /* MCP65 */ 464 { PCI_VDEVICE(NVIDIA, 0x045e), board_ahci_mcp65 }, /* MCP65 */
448 { PCI_VDEVICE(NVIDIA, 0x045f), board_ahci }, /* MCP65 */ 465 { PCI_VDEVICE(NVIDIA, 0x045f), board_ahci_mcp65 }, /* MCP65 */
449 { PCI_VDEVICE(NVIDIA, 0x0550), board_ahci }, /* MCP67 */ 466 { PCI_VDEVICE(NVIDIA, 0x0550), board_ahci }, /* MCP67 */
450 { PCI_VDEVICE(NVIDIA, 0x0551), board_ahci }, /* MCP67 */ 467 { PCI_VDEVICE(NVIDIA, 0x0551), board_ahci }, /* MCP67 */
451 { PCI_VDEVICE(NVIDIA, 0x0552), board_ahci }, /* MCP67 */ 468 { PCI_VDEVICE(NVIDIA, 0x0552), board_ahci }, /* MCP67 */
@@ -502,10 +519,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
502 { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ 519 { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */
503 { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ 520 { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */
504 { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ 521 { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */
505 { PCI_VDEVICE(NVIDIA, 0x0bd0), board_ahci }, /* MCP7B */ 522 { PCI_VDEVICE(NVIDIA, 0x0bc4), board_ahci }, /* MCP7B */
506 { PCI_VDEVICE(NVIDIA, 0x0bd1), board_ahci }, /* MCP7B */ 523 { PCI_VDEVICE(NVIDIA, 0x0bc5), board_ahci }, /* MCP7B */
507 { PCI_VDEVICE(NVIDIA, 0x0bd2), board_ahci }, /* MCP7B */ 524 { PCI_VDEVICE(NVIDIA, 0x0bc6), board_ahci }, /* MCP7B */
508 { PCI_VDEVICE(NVIDIA, 0x0bd3), board_ahci }, /* MCP7B */ 525 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */
509 526
510 /* SiS */ 527 /* SiS */
511 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ 528 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
@@ -624,6 +641,12 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
624 cap &= ~HOST_CAP_NCQ; 641 cap &= ~HOST_CAP_NCQ;
625 } 642 }
626 643
644 if (!(cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_YES_NCQ)) {
645 dev_printk(KERN_INFO, &pdev->dev,
646 "controller can do NCQ, turning on CAP_NCQ\n");
647 cap |= HOST_CAP_NCQ;
648 }
649
627 if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { 650 if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) {
628 dev_printk(KERN_INFO, &pdev->dev, 651 dev_printk(KERN_INFO, &pdev->dev,
629 "controller can't do PMP, turning off CAP_PMP\n"); 652 "controller can't do PMP, turning off CAP_PMP\n");
@@ -1262,19 +1285,11 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,
1262 return 0; 1285 return 0;
1263} 1286}
1264 1287
1265static int ahci_check_ready(struct ata_link *link) 1288static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1266{ 1289 int pmp, unsigned long deadline,
1267 void __iomem *port_mmio = ahci_port_base(link->ap); 1290 int (*check_ready)(struct ata_link *link))
1268 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1269
1270 return ata_check_ready(status);
1271}
1272
1273static int ahci_softreset(struct ata_link *link, unsigned int *class,
1274 unsigned long deadline)
1275{ 1291{
1276 struct ata_port *ap = link->ap; 1292 struct ata_port *ap = link->ap;
1277 int pmp = sata_srst_pmp(link);
1278 const char *reason = NULL; 1293 const char *reason = NULL;
1279 unsigned long now, msecs; 1294 unsigned long now, msecs;
1280 struct ata_taskfile tf; 1295 struct ata_taskfile tf;
@@ -1312,7 +1327,7 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
1312 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); 1327 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0);
1313 1328
1314 /* wait for link to become ready */ 1329 /* wait for link to become ready */
1315 rc = ata_wait_after_reset(link, deadline, ahci_check_ready); 1330 rc = ata_wait_after_reset(link, deadline, check_ready);
1316 /* link occupied, -ENODEV too is an error */ 1331 /* link occupied, -ENODEV too is an error */
1317 if (rc) { 1332 if (rc) {
1318 reason = "device not ready"; 1333 reason = "device not ready";
@@ -1328,6 +1343,72 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
1328 return rc; 1343 return rc;
1329} 1344}
1330 1345
1346static int ahci_check_ready(struct ata_link *link)
1347{
1348 void __iomem *port_mmio = ahci_port_base(link->ap);
1349 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1350
1351 return ata_check_ready(status);
1352}
1353
1354static int ahci_softreset(struct ata_link *link, unsigned int *class,
1355 unsigned long deadline)
1356{
1357 int pmp = sata_srst_pmp(link);
1358
1359 DPRINTK("ENTER\n");
1360
1361 return ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
1362}
1363
1364static int ahci_sb600_check_ready(struct ata_link *link)
1365{
1366 void __iomem *port_mmio = ahci_port_base(link->ap);
1367 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1368 u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
1369
1370 /*
1371 * There is no need to check TFDATA if BAD PMP is found due to HW bug,
1372 * which can save timeout delay.
1373 */
1374 if (irq_status & PORT_IRQ_BAD_PMP)
1375 return -EIO;
1376
1377 return ata_check_ready(status);
1378}
1379
1380static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
1381 unsigned long deadline)
1382{
1383 struct ata_port *ap = link->ap;
1384 void __iomem *port_mmio = ahci_port_base(ap);
1385 int pmp = sata_srst_pmp(link);
1386 int rc;
1387 u32 irq_sts;
1388
1389 DPRINTK("ENTER\n");
1390
1391 rc = ahci_do_softreset(link, class, pmp, deadline,
1392 ahci_sb600_check_ready);
1393
1394 /*
1395 * Soft reset fails on some ATI chips with IPMS set when PMP
1396 * is enabled but SATA HDD/ODD is connected to SATA port,
1397 * do soft reset again to port 0.
1398 */
1399 if (rc == -EIO) {
1400 irq_sts = readl(port_mmio + PORT_IRQ_STAT);
1401 if (irq_sts & PORT_IRQ_BAD_PMP) {
1402 ata_link_printk(link, KERN_WARNING,
1403 "failed due to HW bug, retry pmp=0\n");
1404 rc = ahci_do_softreset(link, class, 0, deadline,
1405 ahci_check_ready);
1406 }
1407 }
1408
1409 return rc;
1410}
1411
1331static int ahci_hardreset(struct ata_link *link, unsigned int *class, 1412static int ahci_hardreset(struct ata_link *link, unsigned int *class,
1332 unsigned long deadline) 1413 unsigned long deadline)
1333{ 1414{
@@ -2118,7 +2199,8 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
2118static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2199static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2119{ 2200{
2120 static int printed_version; 2201 static int printed_version;
2121 struct ata_port_info pi = ahci_port_info[ent->driver_data]; 2202 unsigned int board_id = ent->driver_data;
2203 struct ata_port_info pi = ahci_port_info[board_id];
2122 const struct ata_port_info *ppi[] = { &pi, NULL }; 2204 const struct ata_port_info *ppi[] = { &pi, NULL };
2123 struct device *dev = &pdev->dev; 2205 struct device *dev = &pdev->dev;
2124 struct ahci_host_priv *hpriv; 2206 struct ahci_host_priv *hpriv;
@@ -2167,6 +2249,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2167 return -ENOMEM; 2249 return -ENOMEM;
2168 hpriv->flags |= (unsigned long)pi.private_data; 2250 hpriv->flags |= (unsigned long)pi.private_data;
2169 2251
2252 /* MCP65 revision A1 and A2 can't do MSI */
2253 if (board_id == board_ahci_mcp65 &&
2254 (pdev->revision == 0xa1 || pdev->revision == 0xa2))
2255 hpriv->flags |= AHCI_HFLAG_NO_MSI;
2256
2170 if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) 2257 if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
2171 pci_intx(pdev, 1); 2258 pci_intx(pdev, 1);
2172 2259
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a9027b8fbdd5..81b7ae376951 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -247,10 +247,11 @@ static const struct pci_device_id piix_pci_tbl[] = {
247 { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 247 { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
248 /* SATA Controller 2 IDE (ICH8) */ 248 /* SATA Controller 2 IDE (ICH8) */
249 { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 249 { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
250 /* Mobile SATA Controller IDE (ICH8M) */
251 { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
252 /* Mobile SATA Controller IDE (ICH8M), Apple */ 250 /* Mobile SATA Controller IDE (ICH8M), Apple */
253 { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata }, 251 { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata },
252 { 0x8086, 0x2828, 0x106b, 0x00a1, 0, 0, ich8m_apple_sata },
253 /* Mobile SATA Controller IDE (ICH8M) */
254 { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
254 /* SATA Controller IDE (ICH9) */ 255 /* SATA Controller IDE (ICH9) */
255 { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 256 { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
256 /* SATA Controller IDE (ICH9) */ 257 /* SATA Controller IDE (ICH9) */
@@ -526,7 +527,7 @@ static struct ata_port_info piix_port_info[] = {
526 527
527 [ich8m_apple_sata] = 528 [ich8m_apple_sata] =
528 { 529 {
529 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR, 530 .flags = PIIX_SATA_FLAGS,
530 .pio_mask = 0x1f, /* pio0-4 */ 531 .pio_mask = 0x1f, /* pio0-4 */
531 .mwdma_mask = 0x07, /* mwdma0-2 */ 532 .mwdma_mask = 0x07, /* mwdma0-2 */
532 .udma_mask = ATA_UDMA6, 533 .udma_mask = ATA_UDMA6,
@@ -573,6 +574,8 @@ static const struct ich_laptop ich_laptop[] = {
573 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 574 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
574 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ 575 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */
575 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ 576 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */
577 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */
578 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */
576 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ 579 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */
577 /* end marker */ 580 /* end marker */
578 { 0, } 581 { 0, }
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 70b77e0899a8..3ff8b14420d9 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -118,19 +118,82 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap)
118 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; 118 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
119} 119}
120 120
121static void ata_acpi_eject_device(acpi_handle handle)
122{
123 struct acpi_object_list arg_list;
124 union acpi_object arg;
125
126 arg_list.count = 1;
127 arg_list.pointer = &arg;
128 arg.type = ACPI_TYPE_INTEGER;
129 arg.integer.value = 1;
130
131 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_EJ0",
132 &arg_list, NULL)))
133 printk(KERN_ERR "Failed to evaluate _EJ0!\n");
134}
135
136/* @ap and @dev are the same as ata_acpi_handle_hotplug() */
137static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev)
138{
139 if (dev)
140 dev->flags |= ATA_DFLAG_DETACH;
141 else {
142 struct ata_link *tlink;
143 struct ata_device *tdev;
144
145 ata_port_for_each_link(tlink, ap)
146 ata_link_for_each_dev(tdev, tlink)
147 tdev->flags |= ATA_DFLAG_DETACH;
148 }
149
150 ata_port_schedule_eh(ap);
151}
152
153/**
154 * ata_acpi_handle_hotplug - ACPI event handler backend
155 * @ap: ATA port ACPI event occurred
156 * @dev: ATA device ACPI event occurred (can be NULL)
157 * @event: ACPI event which occurred
158 * @is_dock_event: boolean indicating whether the event was a dock one
159 *
160 * All ACPI bay / device realted events end up in this function. If
161 * the event is port-wide @dev is NULL. If the event is specific to a
162 * device, @dev points to it.
163 *
164 * Hotplug (as opposed to unplug) notification is always handled as
165 * port-wide while unplug only kills the target device on device-wide
166 * event.
167 *
168 * LOCKING:
169 * ACPI notify handler context. May sleep.
170 */
121static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, 171static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
122 u32 event) 172 u32 event, int is_dock_event)
123{ 173{
124 char event_string[12]; 174 char event_string[12];
125 char *envp[] = { event_string, NULL }; 175 char *envp[] = { event_string, NULL };
126 struct ata_eh_info *ehi; 176 struct ata_eh_info *ehi = &ap->link.eh_info;
127 struct kobject *kobj = NULL; 177 struct kobject *kobj = NULL;
128 int wait = 0; 178 int wait = 0;
129 unsigned long flags; 179 unsigned long flags;
180 acpi_handle handle, tmphandle;
181 unsigned long sta;
182 acpi_status status;
183
184 if (dev) {
185 if (dev->sdev)
186 kobj = &dev->sdev->sdev_gendev.kobj;
187 handle = dev->acpi_handle;
188 } else {
189 kobj = &ap->dev->kobj;
190 handle = ap->acpi_handle;
191 }
130 192
131 if (!ap) 193 status = acpi_get_handle(handle, "_EJ0", &tmphandle);
132 ap = dev->link->ap; 194 if (ACPI_FAILURE(status))
133 ehi = &ap->link.eh_info; 195 /* This device does not support hotplug */
196 return;
134 197
135 spin_lock_irqsave(ap->lock, flags); 198 spin_lock_irqsave(ap->lock, flags);
136 199
@@ -138,57 +201,80 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
138 case ACPI_NOTIFY_BUS_CHECK: 201 case ACPI_NOTIFY_BUS_CHECK:
139 case ACPI_NOTIFY_DEVICE_CHECK: 202 case ACPI_NOTIFY_DEVICE_CHECK:
140 ata_ehi_push_desc(ehi, "ACPI event"); 203 ata_ehi_push_desc(ehi, "ACPI event");
141 ata_ehi_hotplugged(ehi);
142 ata_port_freeze(ap);
143 break;
144 204
205 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
206 if (ACPI_FAILURE(status)) {
207 ata_port_printk(ap, KERN_ERR,
208 "acpi: failed to determine bay status (0x%x)\n",
209 status);
210 break;
211 }
212
213 if (sta) {
214 ata_ehi_hotplugged(ehi);
215 ata_port_freeze(ap);
216 } else {
217 /* The device has gone - unplug it */
218 ata_acpi_detach_device(ap, dev);
219 wait = 1;
220 }
221 break;
145 case ACPI_NOTIFY_EJECT_REQUEST: 222 case ACPI_NOTIFY_EJECT_REQUEST:
146 ata_ehi_push_desc(ehi, "ACPI event"); 223 ata_ehi_push_desc(ehi, "ACPI event");
147 if (dev)
148 dev->flags |= ATA_DFLAG_DETACH;
149 else {
150 struct ata_link *tlink;
151 struct ata_device *tdev;
152
153 ata_port_for_each_link(tlink, ap)
154 ata_link_for_each_dev(tdev, tlink)
155 tdev->flags |= ATA_DFLAG_DETACH;
156 }
157 224
158 ata_port_schedule_eh(ap); 225 if (!is_dock_event)
226 break;
227
228 /* undock event - immediate unplug */
229 ata_acpi_detach_device(ap, dev);
159 wait = 1; 230 wait = 1;
160 break; 231 break;
161 } 232 }
162 233
163 if (dev) { 234 /* make sure kobj doesn't go away while ap->lock is released */
164 if (dev->sdev) 235 kobject_get(kobj);
165 kobj = &dev->sdev->sdev_gendev.kobj; 236
166 } else 237 spin_unlock_irqrestore(ap->lock, flags);
167 kobj = &ap->dev->kobj; 238
239 if (wait) {
240 ata_port_wait_eh(ap);
241 ata_acpi_eject_device(handle);
242 }
168 243
169 if (kobj) { 244 if (kobj && !is_dock_event) {
170 sprintf(event_string, "BAY_EVENT=%d", event); 245 sprintf(event_string, "BAY_EVENT=%d", event);
171 kobject_uevent_env(kobj, KOBJ_CHANGE, envp); 246 kobject_uevent_env(kobj, KOBJ_CHANGE, envp);
172 } 247 }
173 248
174 spin_unlock_irqrestore(ap->lock, flags); 249 kobject_put(kobj);
250}
175 251
176 if (wait) 252static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data)
177 ata_port_wait_eh(ap); 253{
254 struct ata_device *dev = data;
255
256 ata_acpi_handle_hotplug(dev->link->ap, dev, event, 1);
257}
258
259static void ata_acpi_ap_notify_dock(acpi_handle handle, u32 event, void *data)
260{
261 struct ata_port *ap = data;
262
263 ata_acpi_handle_hotplug(ap, NULL, event, 1);
178} 264}
179 265
180static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) 266static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data)
181{ 267{
182 struct ata_device *dev = data; 268 struct ata_device *dev = data;
183 269
184 ata_acpi_handle_hotplug(NULL, dev, event); 270 ata_acpi_handle_hotplug(dev->link->ap, dev, event, 0);
185} 271}
186 272
187static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) 273static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data)
188{ 274{
189 struct ata_port *ap = data; 275 struct ata_port *ap = data;
190 276
191 ata_acpi_handle_hotplug(ap, NULL, event); 277 ata_acpi_handle_hotplug(ap, NULL, event, 0);
192} 278}
193 279
194/** 280/**
@@ -229,7 +315,7 @@ void ata_acpi_associate(struct ata_host *host)
229 ata_acpi_ap_notify, ap); 315 ata_acpi_ap_notify, ap);
230 /* we might be on a docking station */ 316 /* we might be on a docking station */
231 register_hotplug_dock_device(ap->acpi_handle, 317 register_hotplug_dock_device(ap->acpi_handle,
232 ata_acpi_ap_notify, ap); 318 ata_acpi_ap_notify_dock, ap);
233 } 319 }
234 320
235 for (j = 0; j < ata_link_max_devices(&ap->link); j++) { 321 for (j = 0; j < ata_link_max_devices(&ap->link); j++) {
@@ -241,7 +327,7 @@ void ata_acpi_associate(struct ata_host *host)
241 ata_acpi_dev_notify, dev); 327 ata_acpi_dev_notify, dev);
242 /* we might be on a docking station */ 328 /* we might be on a docking station */
243 register_hotplug_dock_device(dev->acpi_handle, 329 register_hotplug_dock_device(dev->acpi_handle,
244 ata_acpi_dev_notify, dev); 330 ata_acpi_dev_notify_dock, dev);
245 } 331 }
246 } 332 }
247 } 333 }
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 927b692d723c..cc816ca623d3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2126,6 +2126,13 @@ int ata_dev_configure(struct ata_device *dev)
2126 dev->horkage |= ata_dev_blacklisted(dev); 2126 dev->horkage |= ata_dev_blacklisted(dev);
2127 ata_force_horkage(dev); 2127 ata_force_horkage(dev);
2128 2128
2129 if (dev->horkage & ATA_HORKAGE_DISABLE) {
2130 ata_dev_printk(dev, KERN_INFO,
2131 "unsupported device, disabling\n");
2132 ata_dev_disable(dev);
2133 return 0;
2134 }
2135
2129 /* let ACPI work its magic */ 2136 /* let ACPI work its magic */
2130 rc = ata_acpi_on_devcfg(dev); 2137 rc = ata_acpi_on_devcfg(dev);
2131 if (rc) 2138 if (rc)
@@ -3490,22 +3497,11 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,
3490 if ((rc = sata_link_debounce(link, params, deadline))) 3497 if ((rc = sata_link_debounce(link, params, deadline)))
3491 return rc; 3498 return rc;
3492 3499
3493 /* Clear SError. PMP and some host PHYs require this to 3500 /* clear SError, some PHYs require this even for SRST to work */
3494 * operate and clearing should be done before checking PHY
3495 * online status to avoid race condition (hotplugging between
3496 * link resume and status check).
3497 */
3498 if (!(rc = sata_scr_read(link, SCR_ERROR, &serror))) 3501 if (!(rc = sata_scr_read(link, SCR_ERROR, &serror)))
3499 rc = sata_scr_write(link, SCR_ERROR, serror); 3502 rc = sata_scr_write(link, SCR_ERROR, serror);
3500 if (rc == 0 || rc == -EINVAL) {
3501 unsigned long flags;
3502 3503
3503 spin_lock_irqsave(link->ap->lock, flags); 3504 return rc != -EINVAL ? rc : 0;
3504 link->eh_info.serror = 0;
3505 spin_unlock_irqrestore(link->ap->lock, flags);
3506 rc = 0;
3507 }
3508 return rc;
3509} 3505}
3510 3506
3511/** 3507/**
@@ -3653,9 +3649,13 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
3653 if (check_ready) 3649 if (check_ready)
3654 rc = ata_wait_ready(link, deadline, check_ready); 3650 rc = ata_wait_ready(link, deadline, check_ready);
3655 out: 3651 out:
3656 if (rc && rc != -EAGAIN) 3652 if (rc && rc != -EAGAIN) {
3653 /* online is set iff link is online && reset succeeded */
3654 if (online)
3655 *online = false;
3657 ata_link_printk(link, KERN_ERR, 3656 ata_link_printk(link, KERN_ERR,
3658 "COMRESET failed (errno=%d)\n", rc); 3657 "COMRESET failed (errno=%d)\n", rc);
3658 }
3659 DPRINTK("EXIT, rc=%d\n", rc); 3659 DPRINTK("EXIT, rc=%d\n", rc);
3660 return rc; 3660 return rc;
3661} 3661}
@@ -3700,8 +3700,14 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,
3700 */ 3700 */
3701void ata_std_postreset(struct ata_link *link, unsigned int *classes) 3701void ata_std_postreset(struct ata_link *link, unsigned int *classes)
3702{ 3702{
3703 u32 serror;
3704
3703 DPRINTK("ENTER\n"); 3705 DPRINTK("ENTER\n");
3704 3706
3707 /* reset complete, clear SError */
3708 if (!sata_scr_read(link, SCR_ERROR, &serror))
3709 sata_scr_write(link, SCR_ERROR, serror);
3710
3705 /* print link status */ 3711 /* print link status */
3706 sata_print_link_status(link); 3712 sata_print_link_status(link);
3707 3713
@@ -3894,8 +3900,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3894 { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, 3900 { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA },
3895 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, 3901 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA },
3896 /* Odd clown on sil3726/4726 PMPs */ 3902 /* Odd clown on sil3726/4726 PMPs */
3897 { "Config Disk", NULL, ATA_HORKAGE_NODMA | 3903 { "Config Disk", NULL, ATA_HORKAGE_DISABLE },
3898 ATA_HORKAGE_SKIP_PM },
3899 3904
3900 /* Weird ATAPI devices */ 3905 /* Weird ATAPI devices */
3901 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, 3906 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
@@ -5398,7 +5403,7 @@ static void ata_host_stop(struct device *gendev, void *res)
5398 */ 5403 */
5399static void ata_finalize_port_ops(struct ata_port_operations *ops) 5404static void ata_finalize_port_ops(struct ata_port_operations *ops)
5400{ 5405{
5401 static spinlock_t lock = SPIN_LOCK_UNLOCKED; 5406 static DEFINE_SPINLOCK(lock);
5402 const struct ata_port_operations *cur; 5407 const struct ata_port_operations *cur;
5403 void **begin = (void **)ops; 5408 void **begin = (void **)ops;
5404 void **end = (void **)&ops->inherits; 5409 void **end = (void **)&ops->inherits;
@@ -5616,7 +5621,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
5616 spin_lock_irqsave(ap->lock, flags); 5621 spin_lock_irqsave(ap->lock, flags);
5617 5622
5618 ehi->probe_mask |= ATA_ALL_DEVICES; 5623 ehi->probe_mask |= ATA_ALL_DEVICES;
5619 ehi->action |= ATA_EH_RESET; 5624 ehi->action |= ATA_EH_RESET | ATA_EH_LPM;
5620 ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; 5625 ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
5621 5626
5622 ap->pflags &= ~ATA_PFLAG_INITIALIZING; 5627 ap->pflags &= ~ATA_PFLAG_INITIALIZING;
@@ -5649,7 +5654,6 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
5649 struct ata_port *ap = host->ports[i]; 5654 struct ata_port *ap = host->ports[i];
5650 5655
5651 ata_scsi_scan_host(ap, 1); 5656 ata_scsi_scan_host(ap, 1);
5652 ata_lpm_schedule(ap, ap->pm_policy);
5653 } 5657 }
5654 5658
5655 return 0; 5659 return 0;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 62e033146bed..7894d83ea1eb 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1308,12 +1308,7 @@ static void ata_eh_analyze_serror(struct ata_link *link)
1308 unsigned int err_mask = 0, action = 0; 1308 unsigned int err_mask = 0, action = 0;
1309 u32 hotplug_mask; 1309 u32 hotplug_mask;
1310 1310
1311 if (serror & SERR_PERSISTENT) { 1311 if (serror & (SERR_PERSISTENT | SERR_DATA)) {
1312 err_mask |= AC_ERR_ATA_BUS;
1313 action |= ATA_EH_RESET;
1314 }
1315 if (serror &
1316 (SERR_DATA_RECOVERED | SERR_COMM_RECOVERED | SERR_DATA)) {
1317 err_mask |= AC_ERR_ATA_BUS; 1312 err_mask |= AC_ERR_ATA_BUS;
1318 action |= ATA_EH_RESET; 1313 action |= ATA_EH_RESET;
1319 } 1314 }
@@ -2047,19 +2042,11 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
2047 unsigned int *classes, unsigned long deadline) 2042 unsigned int *classes, unsigned long deadline)
2048{ 2043{
2049 struct ata_device *dev; 2044 struct ata_device *dev;
2050 int rc;
2051 2045
2052 ata_link_for_each_dev(dev, link) 2046 ata_link_for_each_dev(dev, link)
2053 classes[dev->devno] = ATA_DEV_UNKNOWN; 2047 classes[dev->devno] = ATA_DEV_UNKNOWN;
2054 2048
2055 rc = reset(link, classes, deadline); 2049 return reset(link, classes, deadline);
2056
2057 /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
2058 ata_link_for_each_dev(dev, link)
2059 if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2060 classes[dev->devno] = ATA_DEV_NONE;
2061
2062 return rc;
2063} 2050}
2064 2051
2065static int ata_eh_followup_srst_needed(struct ata_link *link, 2052static int ata_eh_followup_srst_needed(struct ata_link *link,
@@ -2096,9 +2083,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2096 ata_reset_fn_t reset; 2083 ata_reset_fn_t reset;
2097 unsigned long flags; 2084 unsigned long flags;
2098 u32 sstatus; 2085 u32 sstatus;
2099 int rc; 2086 int nr_known, rc;
2100 2087
2101 /* about to reset */ 2088 /*
2089 * Prepare to reset
2090 */
2102 spin_lock_irqsave(ap->lock, flags); 2091 spin_lock_irqsave(ap->lock, flags);
2103 ap->pflags |= ATA_PFLAG_RESETTING; 2092 ap->pflags |= ATA_PFLAG_RESETTING;
2104 spin_unlock_irqrestore(ap->lock, flags); 2093 spin_unlock_irqrestore(ap->lock, flags);
@@ -2124,16 +2113,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2124 ap->ops->set_piomode(ap, dev); 2113 ap->ops->set_piomode(ap, dev);
2125 } 2114 }
2126 2115
2127 if (!softreset && !hardreset) {
2128 if (verbose)
2129 ata_link_printk(link, KERN_INFO, "no reset method "
2130 "available, skipping reset\n");
2131 if (!(lflags & ATA_LFLAG_ASSUME_CLASS))
2132 lflags |= ATA_LFLAG_ASSUME_ATA;
2133 goto done;
2134 }
2135
2136 /* prefer hardreset */ 2116 /* prefer hardreset */
2117 reset = NULL;
2137 ehc->i.action &= ~ATA_EH_RESET; 2118 ehc->i.action &= ~ATA_EH_RESET;
2138 if (hardreset) { 2119 if (hardreset) {
2139 reset = hardreset; 2120 reset = hardreset;
@@ -2141,11 +2122,6 @@ int ata_eh_reset(struct ata_link *link, int classify,
2141 } else if (softreset) { 2122 } else if (softreset) {
2142 reset = softreset; 2123 reset = softreset;
2143 ehc->i.action = ATA_EH_SOFTRESET; 2124 ehc->i.action = ATA_EH_SOFTRESET;
2144 } else {
2145 ata_link_printk(link, KERN_ERR, "BUG: no reset method, "
2146 "please report to linux-ide@vger.kernel.org\n");
2147 dump_stack();
2148 return -EINVAL;
2149 } 2125 }
2150 2126
2151 if (prereset) { 2127 if (prereset) {
@@ -2165,55 +2141,71 @@ int ata_eh_reset(struct ata_link *link, int classify,
2165 "prereset failed (errno=%d)\n", rc); 2141 "prereset failed (errno=%d)\n", rc);
2166 goto out; 2142 goto out;
2167 } 2143 }
2168 }
2169 2144
2170 /* prereset() might have cleared ATA_EH_RESET */ 2145 /* prereset() might have cleared ATA_EH_RESET. If so,
2171 if (!(ehc->i.action & ATA_EH_RESET)) { 2146 * bang classes and return.
2172 /* prereset told us not to reset, bang classes and return */ 2147 */
2173 ata_link_for_each_dev(dev, link) 2148 if (reset && !(ehc->i.action & ATA_EH_RESET)) {
2174 classes[dev->devno] = ATA_DEV_NONE; 2149 ata_link_for_each_dev(dev, link)
2175 rc = 0; 2150 classes[dev->devno] = ATA_DEV_NONE;
2176 goto out; 2151 rc = 0;
2152 goto out;
2153 }
2177 } 2154 }
2178 2155
2179 retry: 2156 retry:
2157 /*
2158 * Perform reset
2159 */
2160 if (ata_is_host_link(link))
2161 ata_eh_freeze_port(ap);
2162
2180 deadline = jiffies + ata_eh_reset_timeouts[try++]; 2163 deadline = jiffies + ata_eh_reset_timeouts[try++];
2181 2164
2182 /* shut up during boot probing */ 2165 if (reset) {
2183 if (verbose) 2166 if (verbose)
2184 ata_link_printk(link, KERN_INFO, "%s resetting link\n", 2167 ata_link_printk(link, KERN_INFO, "%s resetting link\n",
2185 reset == softreset ? "soft" : "hard"); 2168 reset == softreset ? "soft" : "hard");
2186 2169
2187 /* mark that this EH session started with reset */ 2170 /* mark that this EH session started with reset */
2188 if (reset == hardreset) 2171 if (reset == hardreset)
2189 ehc->i.flags |= ATA_EHI_DID_HARDRESET; 2172 ehc->i.flags |= ATA_EHI_DID_HARDRESET;
2190 else 2173 else
2191 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 2174 ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
2192 2175
2193 rc = ata_do_reset(link, reset, classes, deadline); 2176 rc = ata_do_reset(link, reset, classes, deadline);
2194 2177
2195 if (reset == hardreset && 2178 if (reset == hardreset &&
2196 ata_eh_followup_srst_needed(link, rc, classify, classes)) { 2179 ata_eh_followup_srst_needed(link, rc, classify, classes)) {
2197 /* okay, let's do follow-up softreset */ 2180 /* okay, let's do follow-up softreset */
2198 reset = softreset; 2181 reset = softreset;
2199 2182
2200 if (!reset) { 2183 if (!reset) {
2201 ata_link_printk(link, KERN_ERR, 2184 ata_link_printk(link, KERN_ERR,
2202 "follow-up softreset required " 2185 "follow-up softreset required "
2203 "but no softreset avaliable\n"); 2186 "but no softreset avaliable\n");
2204 rc = -EINVAL; 2187 rc = -EINVAL;
2205 goto fail; 2188 goto fail;
2189 }
2190
2191 ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
2192 rc = ata_do_reset(link, reset, classes, deadline);
2206 } 2193 }
2207 2194
2208 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); 2195 /* -EAGAIN can happen if we skipped followup SRST */
2209 rc = ata_do_reset(link, reset, classes, deadline); 2196 if (rc && rc != -EAGAIN)
2197 goto fail;
2198 } else {
2199 if (verbose)
2200 ata_link_printk(link, KERN_INFO, "no reset method "
2201 "available, skipping reset\n");
2202 if (!(lflags & ATA_LFLAG_ASSUME_CLASS))
2203 lflags |= ATA_LFLAG_ASSUME_ATA;
2210 } 2204 }
2211 2205
2212 /* -EAGAIN can happen if we skipped followup SRST */ 2206 /*
2213 if (rc && rc != -EAGAIN) 2207 * Post-reset processing
2214 goto fail; 2208 */
2215
2216 done:
2217 ata_link_for_each_dev(dev, link) { 2209 ata_link_for_each_dev(dev, link) {
2218 /* After the reset, the device state is PIO 0 and the 2210 /* After the reset, the device state is PIO 0 and the
2219 * controller state is undefined. Reset also wakes up 2211 * controller state is undefined. Reset also wakes up
@@ -2236,9 +2228,53 @@ int ata_eh_reset(struct ata_link *link, int classify,
2236 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2228 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2237 link->sata_spd = (sstatus >> 4) & 0xf; 2229 link->sata_spd = (sstatus >> 4) & 0xf;
2238 2230
2231 /* thaw the port */
2232 if (ata_is_host_link(link))
2233 ata_eh_thaw_port(ap);
2234
2235 /* postreset() should clear hardware SError. Although SError
2236 * is cleared during link resume, clearing SError here is
2237 * necessary as some PHYs raise hotplug events after SRST.
2238 * This introduces race condition where hotplug occurs between
2239 * reset and here. This race is mediated by cross checking
2240 * link onlineness and classification result later.
2241 */
2239 if (postreset) 2242 if (postreset)
2240 postreset(link, classes); 2243 postreset(link, classes);
2241 2244
2245 /* clear cached SError */
2246 spin_lock_irqsave(link->ap->lock, flags);
2247 link->eh_info.serror = 0;
2248 spin_unlock_irqrestore(link->ap->lock, flags);
2249
2250 /* Make sure onlineness and classification result correspond.
2251 * Hotplug could have happened during reset and some
2252 * controllers fail to wait while a drive is spinning up after
2253 * being hotplugged causing misdetection. By cross checking
2254 * link onlineness and classification result, those conditions
2255 * can be reliably detected and retried.
2256 */
2257 nr_known = 0;
2258 ata_link_for_each_dev(dev, link) {
2259 /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
2260 if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2261 classes[dev->devno] = ATA_DEV_NONE;
2262 else
2263 nr_known++;
2264 }
2265
2266 if (classify && !nr_known && ata_link_online(link)) {
2267 if (try < max_tries) {
2268 ata_link_printk(link, KERN_WARNING, "link online but "
2269 "device misclassified, retrying\n");
2270 rc = -EAGAIN;
2271 goto fail;
2272 }
2273 ata_link_printk(link, KERN_WARNING,
2274 "link online but device misclassified, "
2275 "device detection might fail\n");
2276 }
2277
2242 /* reset successful, schedule revalidation */ 2278 /* reset successful, schedule revalidation */
2243 ata_eh_done(link, NULL, ATA_EH_RESET); 2279 ata_eh_done(link, NULL, ATA_EH_RESET);
2244 ehc->i.action |= ATA_EH_REVALIDATE; 2280 ehc->i.action |= ATA_EH_REVALIDATE;
@@ -2587,7 +2623,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2587 struct ata_link *link; 2623 struct ata_link *link;
2588 struct ata_device *dev; 2624 struct ata_device *dev;
2589 int nr_failed_devs, nr_disabled_devs; 2625 int nr_failed_devs, nr_disabled_devs;
2590 int reset, rc; 2626 int rc;
2591 unsigned long flags; 2627 unsigned long flags;
2592 2628
2593 DPRINTK("ENTER\n"); 2629 DPRINTK("ENTER\n");
@@ -2630,7 +2666,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2630 rc = 0; 2666 rc = 0;
2631 nr_failed_devs = 0; 2667 nr_failed_devs = 0;
2632 nr_disabled_devs = 0; 2668 nr_disabled_devs = 0;
2633 reset = 0;
2634 2669
2635 /* if UNLOADING, finish immediately */ 2670 /* if UNLOADING, finish immediately */
2636 if (ap->pflags & ATA_PFLAG_UNLOADING) 2671 if (ap->pflags & ATA_PFLAG_UNLOADING)
@@ -2644,40 +2679,24 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2644 if (ata_eh_skip_recovery(link)) 2679 if (ata_eh_skip_recovery(link))
2645 ehc->i.action = 0; 2680 ehc->i.action = 0;
2646 2681
2647 /* do we need to reset? */
2648 if (ehc->i.action & ATA_EH_RESET)
2649 reset = 1;
2650
2651 ata_link_for_each_dev(dev, link) 2682 ata_link_for_each_dev(dev, link)
2652 ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; 2683 ehc->classes[dev->devno] = ATA_DEV_UNKNOWN;
2653 } 2684 }
2654 2685
2655 /* reset */ 2686 /* reset */
2656 if (reset) { 2687 ata_port_for_each_link(link, ap) {
2657 /* if PMP is attached, this function only deals with 2688 struct ata_eh_context *ehc = &link->eh_context;
2658 * downstream links, port should stay thawed.
2659 */
2660 if (!sata_pmp_attached(ap))
2661 ata_eh_freeze_port(ap);
2662
2663 ata_port_for_each_link(link, ap) {
2664 struct ata_eh_context *ehc = &link->eh_context;
2665 2689
2666 if (!(ehc->i.action & ATA_EH_RESET)) 2690 if (!(ehc->i.action & ATA_EH_RESET))
2667 continue; 2691 continue;
2668 2692
2669 rc = ata_eh_reset(link, ata_link_nr_vacant(link), 2693 rc = ata_eh_reset(link, ata_link_nr_vacant(link),
2670 prereset, softreset, hardreset, 2694 prereset, softreset, hardreset, postreset);
2671 postreset); 2695 if (rc) {
2672 if (rc) { 2696 ata_link_printk(link, KERN_ERR,
2673 ata_link_printk(link, KERN_ERR, 2697 "reset failed, giving up\n");
2674 "reset failed, giving up\n"); 2698 goto out;
2675 goto out;
2676 }
2677 } 2699 }
2678
2679 if (!sata_pmp_attached(ap))
2680 ata_eh_thaw_port(ap);
2681 } 2700 }
2682 2701
2683 /* the rest */ 2702 /* the rest */
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index ff1822a7da38..7daf4c0f6216 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -48,7 +48,7 @@ static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val)
48 tf.device = link->pmp; 48 tf.device = link->pmp;
49 49
50 err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, 50 err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0,
51 SATA_PMP_SCR_TIMEOUT); 51 SATA_PMP_RW_TIMEOUT);
52 if (err_mask) 52 if (err_mask)
53 return err_mask; 53 return err_mask;
54 54
@@ -88,7 +88,7 @@ static unsigned int sata_pmp_write(struct ata_link *link, int reg, u32 val)
88 tf.lbah = (val >> 24) & 0xff; 88 tf.lbah = (val >> 24) & 0xff;
89 89
90 return ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, 90 return ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0,
91 SATA_PMP_SCR_TIMEOUT); 91 SATA_PMP_RW_TIMEOUT);
92} 92}
93 93
94/** 94/**
@@ -257,19 +257,6 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info)
257 goto fail; 257 goto fail;
258 } 258 }
259 259
260 /* turn off notification till fan-out ports are reset and configured */
261 if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) {
262 gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY;
263
264 err_mask = sata_pmp_write(dev->link, SATA_PMP_GSCR_FEAT_EN,
265 gscr[SATA_PMP_GSCR_FEAT_EN]);
266 if (err_mask) {
267 rc = -EIO;
268 reason = "failed to write GSCR_FEAT_EN";
269 goto fail;
270 }
271 }
272
273 if (print_info) { 260 if (print_info) {
274 ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " 261 ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, "
275 "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", 262 "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n",
@@ -335,9 +322,12 @@ static void sata_pmp_quirks(struct ata_port *ap)
335 if (vendor == 0x1095 && devid == 0x3726) { 322 if (vendor == 0x1095 && devid == 0x3726) {
336 /* sil3726 quirks */ 323 /* sil3726 quirks */
337 ata_port_for_each_link(link, ap) { 324 ata_port_for_each_link(link, ap) {
338 /* class code report is unreliable */ 325 /* Class code report is unreliable and SRST
326 * times out under certain configurations.
327 */
339 if (link->pmp < 5) 328 if (link->pmp < 5)
340 link->flags |= ATA_LFLAG_ASSUME_ATA; 329 link->flags |= ATA_LFLAG_NO_SRST |
330 ATA_LFLAG_ASSUME_ATA;
341 331
342 /* port 5 is for SEMB device and it doesn't like SRST */ 332 /* port 5 is for SEMB device and it doesn't like SRST */
343 if (link->pmp == 5) 333 if (link->pmp == 5)
@@ -700,8 +690,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
700 if (ehc->i.action & ATA_EH_RESET) { 690 if (ehc->i.action & ATA_EH_RESET) {
701 struct ata_link *tlink; 691 struct ata_link *tlink;
702 692
703 ata_eh_freeze_port(ap);
704
705 /* reset */ 693 /* reset */
706 rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, 694 rc = ata_eh_reset(link, 0, prereset, softreset, hardreset,
707 postreset); 695 postreset);
@@ -711,8 +699,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
711 goto fail; 699 goto fail;
712 } 700 }
713 701
714 ata_eh_thaw_port(ap);
715
716 /* PMP is reset, SErrors cannot be trusted, scan all */ 702 /* PMP is reset, SErrors cannot be trusted, scan all */
717 ata_port_for_each_link(tlink, ap) { 703 ata_port_for_each_link(tlink, ap) {
718 struct ata_eh_context *ehc = &tlink->eh_context; 704 struct ata_eh_context *ehc = &tlink->eh_context;
@@ -864,6 +850,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
864 struct ata_link *pmp_link = &ap->link; 850 struct ata_link *pmp_link = &ap->link;
865 struct ata_device *pmp_dev = pmp_link->device; 851 struct ata_device *pmp_dev = pmp_link->device;
866 struct ata_eh_context *pmp_ehc = &pmp_link->eh_context; 852 struct ata_eh_context *pmp_ehc = &pmp_link->eh_context;
853 u32 *gscr = pmp_dev->gscr;
867 struct ata_link *link; 854 struct ata_link *link;
868 struct ata_device *dev; 855 struct ata_device *dev;
869 unsigned int err_mask; 856 unsigned int err_mask;
@@ -901,6 +888,22 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
901 if (rc) 888 if (rc)
902 goto pmp_fail; 889 goto pmp_fail;
903 890
891 /* PHY event notification can disturb reset and other recovery
892 * operations. Turn it off.
893 */
894 if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) {
895 gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY;
896
897 err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN,
898 gscr[SATA_PMP_GSCR_FEAT_EN]);
899 if (err_mask) {
900 ata_link_printk(pmp_link, KERN_WARNING,
901 "failed to disable NOTIFY (err_mask=0x%x)\n",
902 err_mask);
903 goto pmp_fail;
904 }
905 }
906
904 /* handle disabled links */ 907 /* handle disabled links */
905 rc = sata_pmp_eh_handle_disabled_links(ap); 908 rc = sata_pmp_eh_handle_disabled_links(ap);
906 if (rc) 909 if (rc)
@@ -923,10 +926,10 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
923 926
924 /* enable notification */ 927 /* enable notification */
925 if (pmp_dev->flags & ATA_DFLAG_AN) { 928 if (pmp_dev->flags & ATA_DFLAG_AN) {
926 pmp_dev->gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY; 929 gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY;
927 930
928 err_mask = sata_pmp_write(pmp_dev->link, SATA_PMP_GSCR_FEAT_EN, 931 err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN,
929 pmp_dev->gscr[SATA_PMP_GSCR_FEAT_EN]); 932 gscr[SATA_PMP_GSCR_FEAT_EN]);
930 if (err_mask) { 933 if (err_mask) {
931 ata_dev_printk(pmp_dev, KERN_ERR, "failed to write " 934 ata_dev_printk(pmp_dev, KERN_ERR, "failed to write "
932 "PMP_FEAT_EN (Emask=0x%x)\n", err_mask); 935 "PMP_FEAT_EN (Emask=0x%x)\n", err_mask);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 3ce43920e459..2e6e1622dc6d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1082,12 +1082,6 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
1082 if (((cdb[4] >> 4) & 0xf) != 0) 1082 if (((cdb[4] >> 4) & 0xf) != 0)
1083 goto invalid_fld; /* power conditions not supported */ 1083 goto invalid_fld; /* power conditions not supported */
1084 1084
1085 if (qc->dev->horkage & ATA_HORKAGE_SKIP_PM) {
1086 /* the device lacks PM support, finish without doing anything */
1087 scmd->result = SAM_STAT_GOOD;
1088 return 1;
1089 }
1090
1091 if (cdb[4] & 0x1) { 1085 if (cdb[4] & 0x1) {
1092 tf->nsect = 1; /* 1 sector, lba=0 */ 1086 tf->nsect = 1; /* 1 sector, lba=0 */
1093 1087
@@ -1643,6 +1637,7 @@ defer:
1643 1637
1644/** 1638/**
1645 * ata_scsi_rbuf_get - Map response buffer. 1639 * ata_scsi_rbuf_get - Map response buffer.
1640 * @cmd: SCSI command containing buffer to be mapped.
1646 * @flags: unsigned long variable to store irq enable status 1641 * @flags: unsigned long variable to store irq enable status
1647 * @copy_in: copy in from user buffer 1642 * @copy_in: copy in from user buffer
1648 * 1643 *
@@ -1960,7 +1955,7 @@ static unsigned int ata_msense_ctl_mode(u8 *buf)
1960 1955
1961/** 1956/**
1962 * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page 1957 * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page
1963 * @bufp: output buffer 1958 * @buf: output buffer
1964 * 1959 *
1965 * Generate a generic MODE SENSE r/w error recovery page. 1960 * Generate a generic MODE SENSE r/w error recovery page.
1966 * 1961 *
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 3c2d2289f85e..215d18672a5a 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -247,7 +247,7 @@ u8 ata_sff_check_status(struct ata_port *ap)
247 * LOCKING: 247 * LOCKING:
248 * Inherited from caller. 248 * Inherited from caller.
249 */ 249 */
250u8 ata_sff_altstatus(struct ata_port *ap) 250static u8 ata_sff_altstatus(struct ata_port *ap)
251{ 251{
252 if (ap->ops->sff_check_altstatus) 252 if (ap->ops->sff_check_altstatus)
253 return ap->ops->sff_check_altstatus(ap); 253 return ap->ops->sff_check_altstatus(ap);
@@ -256,6 +256,93 @@ u8 ata_sff_altstatus(struct ata_port *ap)
256} 256}
257 257
258/** 258/**
259 * ata_sff_irq_status - Check if the device is busy
260 * @ap: port where the device is
261 *
262 * Determine if the port is currently busy. Uses altstatus
263 * if available in order to avoid clearing shared IRQ status
264 * when finding an IRQ source. Non ctl capable devices don't
265 * share interrupt lines fortunately for us.
266 *
267 * LOCKING:
268 * Inherited from caller.
269 */
270static u8 ata_sff_irq_status(struct ata_port *ap)
271{
272 u8 status;
273
274 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) {
275 status = ata_sff_altstatus(ap);
276 /* Not us: We are busy */
277 if (status & ATA_BUSY)
278 return status;
279 }
280 /* Clear INTRQ latch */
281 status = ap->ops->sff_check_status(ap);
282 return status;
283}
284
285/**
286 * ata_sff_sync - Flush writes
287 * @ap: Port to wait for.
288 *
289 * CAUTION:
290 * If we have an mmio device with no ctl and no altstatus
291 * method this will fail. No such devices are known to exist.
292 *
293 * LOCKING:
294 * Inherited from caller.
295 */
296
297static void ata_sff_sync(struct ata_port *ap)
298{
299 if (ap->ops->sff_check_altstatus)
300 ap->ops->sff_check_altstatus(ap);
301 else if (ap->ioaddr.altstatus_addr)
302 ioread8(ap->ioaddr.altstatus_addr);
303}
304
305/**
306 * ata_sff_pause - Flush writes and wait 400nS
307 * @ap: Port to pause for.
308 *
309 * CAUTION:
310 * If we have an mmio device with no ctl and no altstatus
311 * method this will fail. No such devices are known to exist.
312 *
313 * LOCKING:
314 * Inherited from caller.
315 */
316
317void ata_sff_pause(struct ata_port *ap)
318{
319 ata_sff_sync(ap);
320 ndelay(400);
321}
322
323/**
324 * ata_sff_dma_pause - Pause before commencing DMA
325 * @ap: Port to pause for.
326 *
327 * Perform I/O fencing and ensure sufficient cycle delays occur
328 * for the HDMA1:0 transition
329 */
330
331void ata_sff_dma_pause(struct ata_port *ap)
332{
333 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) {
334 /* An altstatus read will cause the needed delay without
335 messing up the IRQ status */
336 ata_sff_altstatus(ap);
337 return;
338 }
339 /* There are no DMA controllers without ctl. BUG here to ensure
340 we never violate the HDMA1:0 transition timing and risk
341 corruption. */
342 BUG();
343}
344
345/**
259 * ata_sff_busy_sleep - sleep until BSY clears, or timeout 346 * ata_sff_busy_sleep - sleep until BSY clears, or timeout
260 * @ap: port containing status register to be polled 347 * @ap: port containing status register to be polled
261 * @tmout_pat: impatience timeout 348 * @tmout_pat: impatience timeout
@@ -742,7 +829,7 @@ static void ata_pio_sectors(struct ata_queued_cmd *qc)
742 } else 829 } else
743 ata_pio_sector(qc); 830 ata_pio_sector(qc);
744 831
745 ata_sff_altstatus(qc->ap); /* flush */ 832 ata_sff_sync(qc->ap); /* flush */
746} 833}
747 834
748/** 835/**
@@ -763,8 +850,9 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
763 WARN_ON(qc->dev->cdb_len < 12); 850 WARN_ON(qc->dev->cdb_len < 12);
764 851
765 ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); 852 ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1);
766 ata_sff_altstatus(ap); /* flush */ 853 ata_sff_sync(ap);
767 854 /* FIXME: If the CDB is for DMA do we need to do the transition delay
855 or is bmdma_start guaranteed to do it ? */
768 switch (qc->tf.protocol) { 856 switch (qc->tf.protocol) {
769 case ATAPI_PROT_PIO: 857 case ATAPI_PROT_PIO:
770 ap->hsm_task_state = HSM_ST; 858 ap->hsm_task_state = HSM_ST;
@@ -905,7 +993,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
905 993
906 if (unlikely(__atapi_pio_bytes(qc, bytes))) 994 if (unlikely(__atapi_pio_bytes(qc, bytes)))
907 goto err_out; 995 goto err_out;
908 ata_sff_altstatus(ap); /* flush */ 996 ata_sff_sync(ap); /* flush */
909 997
910 return; 998 return;
911 999
@@ -1489,14 +1577,10 @@ inline unsigned int ata_sff_host_intr(struct ata_port *ap,
1489 goto idle_irq; 1577 goto idle_irq;
1490 } 1578 }
1491 1579
1492 /* check altstatus */
1493 status = ata_sff_altstatus(ap);
1494 if (status & ATA_BUSY)
1495 goto idle_irq;
1496 1580
1497 /* check main status, clearing INTRQ */ 1581 /* check main status, clearing INTRQ if needed */
1498 status = ap->ops->sff_check_status(ap); 1582 status = ata_sff_irq_status(ap);
1499 if (unlikely(status & ATA_BUSY)) 1583 if (status & ATA_BUSY)
1500 goto idle_irq; 1584 goto idle_irq;
1501 1585
1502 /* ack bmdma irq events */ 1586 /* ack bmdma irq events */
@@ -2030,7 +2114,7 @@ void ata_sff_error_handler(struct ata_port *ap)
2030 ap->ops->bmdma_stop(qc); 2114 ap->ops->bmdma_stop(qc);
2031 } 2115 }
2032 2116
2033 ata_sff_altstatus(ap); 2117 ata_sff_sync(ap); /* FIXME: We don't need this */
2034 ap->ops->sff_check_status(ap); 2118 ap->ops->sff_check_status(ap);
2035 ap->ops->sff_irq_clear(ap); 2119 ap->ops->sff_irq_clear(ap);
2036 2120
@@ -2203,7 +2287,7 @@ void ata_bmdma_stop(struct ata_queued_cmd *qc)
2203 mmio + ATA_DMA_CMD); 2287 mmio + ATA_DMA_CMD);
2204 2288
2205 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 2289 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
2206 ata_sff_altstatus(ap); /* dummy read */ 2290 ata_sff_dma_pause(ap);
2207} 2291}
2208 2292
2209/** 2293/**
@@ -2722,7 +2806,8 @@ EXPORT_SYMBOL_GPL(ata_sff_qc_prep);
2722EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep); 2806EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep);
2723EXPORT_SYMBOL_GPL(ata_sff_dev_select); 2807EXPORT_SYMBOL_GPL(ata_sff_dev_select);
2724EXPORT_SYMBOL_GPL(ata_sff_check_status); 2808EXPORT_SYMBOL_GPL(ata_sff_check_status);
2725EXPORT_SYMBOL_GPL(ata_sff_altstatus); 2809EXPORT_SYMBOL_GPL(ata_sff_dma_pause);
2810EXPORT_SYMBOL_GPL(ata_sff_pause);
2726EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); 2811EXPORT_SYMBOL_GPL(ata_sff_busy_sleep);
2727EXPORT_SYMBOL_GPL(ata_sff_wait_ready); 2812EXPORT_SYMBOL_GPL(ata_sff_wait_ready);
2728EXPORT_SYMBOL_GPL(ata_sff_tf_load); 2813EXPORT_SYMBOL_GPL(ata_sff_tf_load);
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index fcabe46f262b..0f3e659db99a 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -177,11 +177,11 @@ static void ali_program_modes(struct ata_port *ap, struct ata_device *adev, stru
177 u8 udma; 177 u8 udma;
178 178
179 if (t != NULL) { 179 if (t != NULL) {
180 t->setup = FIT(t->setup, 1, 8) & 7; 180 t->setup = clamp_val(t->setup, 1, 8) & 7;
181 t->act8b = FIT(t->act8b, 1, 8) & 7; 181 t->act8b = clamp_val(t->act8b, 1, 8) & 7;
182 t->rec8b = FIT(t->rec8b, 1, 16) & 15; 182 t->rec8b = clamp_val(t->rec8b, 1, 16) & 15;
183 t->active = FIT(t->active, 1, 8) & 7; 183 t->active = clamp_val(t->active, 1, 8) & 7;
184 t->recover = FIT(t->recover, 1, 16) & 15; 184 t->recover = clamp_val(t->recover, 1, 16) & 15;
185 185
186 pci_write_config_byte(pdev, cas, t->setup); 186 pci_write_config_byte(pdev, cas, t->setup);
187 pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b); 187 pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b);
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 26665c396485..57dd00f463d3 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -84,32 +84,32 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse
84 84
85 /* Configure the address set up timing */ 85 /* Configure the address set up timing */
86 pci_read_config_byte(pdev, offset + 0x0C, &t); 86 pci_read_config_byte(pdev, offset + 0x0C, &t);
87 t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(at.setup, 1, 4) - 1) << ((3 - dn) << 1)); 87 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(at.setup, 1, 4) - 1) << ((3 - dn) << 1));
88 pci_write_config_byte(pdev, offset + 0x0C , t); 88 pci_write_config_byte(pdev, offset + 0x0C , t);
89 89
90 /* Configure the 8bit I/O timing */ 90 /* Configure the 8bit I/O timing */
91 pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)), 91 pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)),
92 ((FIT(at.act8b, 1, 16) - 1) << 4) | (FIT(at.rec8b, 1, 16) - 1)); 92 ((clamp_val(at.act8b, 1, 16) - 1) << 4) | (clamp_val(at.rec8b, 1, 16) - 1));
93 93
94 /* Drive timing */ 94 /* Drive timing */
95 pci_write_config_byte(pdev, offset + 0x08 + (3 - dn), 95 pci_write_config_byte(pdev, offset + 0x08 + (3 - dn),
96 ((FIT(at.active, 1, 16) - 1) << 4) | (FIT(at.recover, 1, 16) - 1)); 96 ((clamp_val(at.active, 1, 16) - 1) << 4) | (clamp_val(at.recover, 1, 16) - 1));
97 97
98 switch (clock) { 98 switch (clock) {
99 case 1: 99 case 1:
100 t = at.udma ? (0xc0 | (FIT(at.udma, 2, 5) - 2)) : 0x03; 100 t = at.udma ? (0xc0 | (clamp_val(at.udma, 2, 5) - 2)) : 0x03;
101 break; 101 break;
102 102
103 case 2: 103 case 2:
104 t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 2, 10)]) : 0x03; 104 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 2, 10)]) : 0x03;
105 break; 105 break;
106 106
107 case 3: 107 case 3:
108 t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 1, 10)]) : 0x03; 108 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 10)]) : 0x03;
109 break; 109 break;
110 110
111 case 4: 111 case 4:
112 t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 1, 15)]) : 0x03; 112 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 15)]) : 0x03;
113 break; 113 break;
114 114
115 default: 115 default:
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c
index 5e104385d6a3..82fb6e273169 100644
--- a/drivers/ata/pata_at32.c
+++ b/drivers/ata/pata_at32.c
@@ -291,8 +291,6 @@ static int __init pata_at32_probe(struct platform_device *pdev)
291 if (!info) 291 if (!info)
292 return -ENOMEM; 292 return -ENOMEM;
293 293
294 memset(info, 0, sizeof(struct at32_ide_info));
295
296 info->irq = irq; 294 info->irq = irq;
297 info->cs = board->cs; 295 info->cs = board->cs;
298 296
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 9ab89732cf94..55516103626a 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -911,7 +911,10 @@ static void bfin_bmdma_start(struct ata_queued_cmd *qc)
911 /* Reset all transfer count */ 911 /* Reset all transfer count */
912 ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | TFRCNT_RST); 912 ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | TFRCNT_RST);
913 913
914 /* Set transfer length to buffer len */ 914 /* Set ATAPI state machine contorl in terminate sequence */
915 ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | END_ON_TERM);
916
917 /* Set transfer length to buffer len */
915 for_each_sg(qc->sg, sg, qc->n_elem, si) { 918 for_each_sg(qc->sg, sg, qc->n_elem, si) {
916 ATAPI_SET_XFER_LEN(base, (sg_dma_len(sg) >> 1)); 919 ATAPI_SET_XFER_LEN(base, (sg_dma_len(sg) >> 1));
917 } 920 }
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index a9c3218e22fd..2ff62608ae37 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -62,14 +62,14 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
62 return; 62 return;
63 } 63 }
64 64
65 time_16 = FIT(t.recover, 0, 15) | (FIT(t.active, 0, 15) << 4); 65 time_16 = clamp_val(t.recover, 0, 15) | (clamp_val(t.active, 0, 15) << 4);
66 time_8 = FIT(t.act8b, 0, 15) | (FIT(t.rec8b, 0, 15) << 4); 66 time_8 = clamp_val(t.act8b, 0, 15) | (clamp_val(t.rec8b, 0, 15) << 4);
67 67
68 if (adev->devno == 0) { 68 if (adev->devno == 0) {
69 pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); 69 pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr);
70 70
71 addr &= ~0x0F; /* Mask bits */ 71 addr &= ~0x0F; /* Mask bits */
72 addr |= FIT(t.setup, 0, 15); 72 addr |= clamp_val(t.setup, 0, 15);
73 73
74 pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); 74 pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr);
75 pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); 75 pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16);
@@ -79,7 +79,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
79 pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); 79 pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr);
80 80
81 addr &= ~0xF0; /* Mask bits */ 81 addr &= ~0xF0; /* Mask bits */
82 addr |= (FIT(t.setup, 0, 15) << 4); 82 addr |= (clamp_val(t.setup, 0, 15) << 4);
83 83
84 pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); 84 pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr);
85 pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); 85 pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16);
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 17138436423d..cf9e9848f8b5 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -270,7 +270,7 @@ static void pata_icside_bmdma_stop(struct ata_queued_cmd *qc)
270 disable_dma(state->dma); 270 disable_dma(state->dma);
271 271
272 /* see ata_bmdma_stop */ 272 /* see ata_bmdma_stop */
273 ata_sff_altstatus(ap); 273 ata_sff_dma_pause(ap);
274} 274}
275 275
276static u8 pata_icside_bmdma_status(struct ata_port *ap) 276static u8 pata_icside_bmdma_status(struct ata_port *ap)
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 7af4b29cc422..fe7cc8ed4ea4 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -343,8 +343,8 @@ static void ht6560a_set_piomode(struct ata_port *ap, struct ata_device *adev)
343 /* Get the timing data in cycles. For now play safe at 50Mhz */ 343 /* Get the timing data in cycles. For now play safe at 50Mhz */
344 ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); 344 ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000);
345 345
346 active = FIT(t.active, 2, 15); 346 active = clamp_val(t.active, 2, 15);
347 recover = FIT(t.recover, 4, 15); 347 recover = clamp_val(t.recover, 4, 15);
348 348
349 inb(0x3E6); 349 inb(0x3E6);
350 inb(0x3E6); 350 inb(0x3E6);
@@ -377,8 +377,8 @@ static void ht6560b_set_piomode(struct ata_port *ap, struct ata_device *adev)
377 /* Get the timing data in cycles. For now play safe at 50Mhz */ 377 /* Get the timing data in cycles. For now play safe at 50Mhz */
378 ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); 378 ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000);
379 379
380 active = FIT(t.active, 2, 15); 380 active = clamp_val(t.active, 2, 15);
381 recover = FIT(t.recover, 2, 16); 381 recover = clamp_val(t.recover, 2, 16);
382 recover &= 0x15; 382 recover &= 0x15;
383 383
384 inb(0x3E6); 384 inb(0x3E6);
@@ -462,9 +462,9 @@ static void opti82c611a_set_piomode(struct ata_port *ap,
462 ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); 462 ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP);
463 } 463 }
464 464
465 active = FIT(t.active, 2, 17) - 2; 465 active = clamp_val(t.active, 2, 17) - 2;
466 recover = FIT(t.recover, 1, 16) - 1; 466 recover = clamp_val(t.recover, 1, 16) - 1;
467 setup = FIT(t.setup, 1, 4) - 1; 467 setup = clamp_val(t.setup, 1, 4) - 1;
468 468
469 /* Select the right timing bank for write timing */ 469 /* Select the right timing bank for write timing */
470 rc = ioread8(ap->ioaddr.lbal_addr); 470 rc = ioread8(ap->ioaddr.lbal_addr);
@@ -541,9 +541,9 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev)
541 ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); 541 ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP);
542 } 542 }
543 543
544 active = FIT(t.active, 2, 17) - 2; 544 active = clamp_val(t.active, 2, 17) - 2;
545 recover = FIT(t.recover, 1, 16) - 1; 545 recover = clamp_val(t.recover, 1, 16) - 1;
546 setup = FIT(t.setup, 1, 4) - 1; 546 setup = clamp_val(t.setup, 1, 4) - 1;
547 547
548 /* Select the right timing bank for write timing */ 548 /* Select the right timing bank for write timing */
549 rc = ioread8(ap->ioaddr.lbal_addr); 549 rc = ioread8(ap->ioaddr.lbal_addr);
@@ -624,11 +624,11 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
624 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 624 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
625 625
626 if (ld_qdi->fast) { 626 if (ld_qdi->fast) {
627 active = 8 - FIT(t.active, 1, 8); 627 active = 8 - clamp_val(t.active, 1, 8);
628 recovery = 18 - FIT(t.recover, 3, 18); 628 recovery = 18 - clamp_val(t.recover, 3, 18);
629 } else { 629 } else {
630 active = 9 - FIT(t.active, 2, 9); 630 active = 9 - clamp_val(t.active, 2, 9);
631 recovery = 15 - FIT(t.recover, 0, 15); 631 recovery = 15 - clamp_val(t.recover, 0, 15);
632 } 632 }
633 timing = (recovery << 4) | active | 0x08; 633 timing = (recovery << 4) | active | 0x08;
634 634
@@ -658,11 +658,11 @@ static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev)
658 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 658 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
659 659
660 if (ld_qdi->fast) { 660 if (ld_qdi->fast) {
661 active = 8 - FIT(t.active, 1, 8); 661 active = 8 - clamp_val(t.active, 1, 8);
662 recovery = 18 - FIT(t.recover, 3, 18); 662 recovery = 18 - clamp_val(t.recover, 3, 18);
663 } else { 663 } else {
664 active = 9 - FIT(t.active, 2, 9); 664 active = 9 - clamp_val(t.active, 2, 9);
665 recovery = 15 - FIT(t.recover, 0, 15); 665 recovery = 15 - clamp_val(t.recover, 0, 15);
666 } 666 }
667 timing = (recovery << 4) | active | 0x08; 667 timing = (recovery << 4) | active | 0x08;
668 668
@@ -695,11 +695,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
695 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 695 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
696 696
697 if (ld_qdi->fast) { 697 if (ld_qdi->fast) {
698 active = 8 - FIT(t.active, 1, 8); 698 active = 8 - clamp_val(t.active, 1, 8);
699 recovery = 18 - FIT(t.recover, 3, 18); 699 recovery = 18 - clamp_val(t.recover, 3, 18);
700 } else { 700 } else {
701 active = 9 - FIT(t.active, 2, 9); 701 active = 9 - clamp_val(t.active, 2, 9);
702 recovery = 15 - FIT(t.recover, 0, 15); 702 recovery = 15 - clamp_val(t.recover, 0, 15);
703 } 703 }
704 timing = (recovery << 4) | active | 0x08; 704 timing = (recovery << 4) | active | 0x08;
705 ld_qdi->clock[adev->devno] = timing; 705 ld_qdi->clock[adev->devno] = timing;
@@ -830,8 +830,8 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
830 else 830 else
831 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 831 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
832 832
833 active = (FIT(t.active, 3, 17) - 1) & 0x0F; 833 active = (clamp_val(t.active, 3, 17) - 1) & 0x0F;
834 recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; 834 recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F;
835 timing = (active << 4) | recovery; 835 timing = (active << 4) | recovery;
836 winbond_writecfg(ld_winbond->timing, timing, reg); 836 winbond_writecfg(ld_winbond->timing, timing, reg);
837 837
@@ -842,7 +842,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
842 reg |= 0x08; /* FIFO off */ 842 reg |= 0x08; /* FIFO off */
843 if (!ata_pio_need_iordy(adev)) 843 if (!ata_pio_need_iordy(adev))
844 reg |= 0x02; /* IORDY off */ 844 reg |= 0x02; /* IORDY off */
845 reg |= (FIT(t.setup, 0, 3) << 6); 845 reg |= (clamp_val(t.setup, 0, 3) << 6);
846 winbond_writecfg(ld_winbond->timing, timing + 1, reg); 846 winbond_writecfg(ld_winbond->timing, timing + 1, reg);
847} 847}
848 848
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 76d2455bc453..be756b7ef07e 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -91,9 +91,9 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev)
91 return; 91 return;
92 } 92 }
93 93
94 at.active = FIT(at.active, 2, 16) - 2; 94 at.active = clamp_val(at.active, 2, 16) - 2;
95 at.setup = FIT(at.setup, 1, 4) - 1; 95 at.setup = clamp_val(at.setup, 1, 4) - 1;
96 at.recover = FIT(at.recover, 1, 12) - 1; 96 at.recover = clamp_val(at.recover, 1, 12) - 1;
97 97
98 idetcr = (at.setup << 6) | (recoverbits[at.recover] << 3) | activebits[at.active]; 98 idetcr = (at.setup << 6) | (recoverbits[at.recover] << 3) | activebits[at.active];
99 99
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index ae92b0049bd5..e0aa7eaaee0a 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -66,8 +66,8 @@ static void ns87415_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo
66 66
67 ata_timing_compute(adev, adev->pio_mode, &t, T, 0); 67 ata_timing_compute(adev, adev->pio_mode, &t, T, 0);
68 68
69 clocking = 17 - FIT(t.active, 2, 17); 69 clocking = 17 - clamp_val(t.active, 2, 17);
70 clocking |= (16 - FIT(t.recover, 1, 16)) << 4; 70 clocking |= (16 - clamp_val(t.recover, 1, 16)) << 4;
71 /* Use the same timing for read and write bytes */ 71 /* Use the same timing for read and write bytes */
72 clocking |= (clocking << 8); 72 clocking |= (clocking << 8);
73 pci_write_config_word(dev, timing, clocking); 73 pci_write_config_word(dev, timing, clocking);
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index bf45cf017753..97e5b090d7c2 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -60,11 +60,11 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
60 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 60 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
61 61
62 if (qdi->fast) { 62 if (qdi->fast) {
63 active = 8 - FIT(t.active, 1, 8); 63 active = 8 - clamp_val(t.active, 1, 8);
64 recovery = 18 - FIT(t.recover, 3, 18); 64 recovery = 18 - clamp_val(t.recover, 3, 18);
65 } else { 65 } else {
66 active = 9 - FIT(t.active, 2, 9); 66 active = 9 - clamp_val(t.active, 2, 9);
67 recovery = 15 - FIT(t.recover, 0, 15); 67 recovery = 15 - clamp_val(t.recover, 0, 15);
68 } 68 }
69 timing = (recovery << 4) | active | 0x08; 69 timing = (recovery << 4) | active | 0x08;
70 70
@@ -84,11 +84,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
84 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 84 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
85 85
86 if (qdi->fast) { 86 if (qdi->fast) {
87 active = 8 - FIT(t.active, 1, 8); 87 active = 8 - clamp_val(t.active, 1, 8);
88 recovery = 18 - FIT(t.recover, 3, 18); 88 recovery = 18 - clamp_val(t.recover, 3, 18);
89 } else { 89 } else {
90 active = 9 - FIT(t.active, 2, 9); 90 active = 9 - clamp_val(t.active, 2, 9);
91 recovery = 15 - FIT(t.recover, 0, 15); 91 recovery = 15 - clamp_val(t.recover, 0, 15);
92 } 92 }
93 timing = (recovery << 4) | active | 0x08; 93 timing = (recovery << 4) | active | 0x08;
94 94
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
index a108d259f19d..f8b3ffc8ae9e 100644
--- a/drivers/ata/pata_rb532_cf.c
+++ b/drivers/ata/pata_rb532_cf.c
@@ -57,7 +57,9 @@ static inline void rb532_pata_finish_io(struct ata_port *ap)
57 struct ata_host *ah = ap->host; 57 struct ata_host *ah = ap->host;
58 struct rb532_cf_info *info = ah->private_data; 58 struct rb532_cf_info *info = ah->private_data;
59 59
60 ata_sff_altstatus(ap); 60 /* FIXME: Keep previous delay. If this is merely a fence then
61 ata_sff_sync might be sufficient. */
62 ata_sff_dma_pause(ap);
61 ndelay(RB500_CF_IO_DELAY); 63 ndelay(RB500_CF_IO_DELAY);
62 64
63 set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); 65 set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index e965b251ca24..bbf5aa345e68 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -726,7 +726,7 @@ static void scc_bmdma_stop (struct ata_queued_cmd *qc)
726 in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START); 726 in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START);
727 727
728 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 728 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
729 ata_sff_altstatus(ap); /* dummy read */ 729 ata_sff_dma_pause(ap); /* dummy read */
730} 730}
731 731
732/** 732/**
@@ -747,7 +747,8 @@ static u8 scc_bmdma_status (struct ata_port *ap)
747 return host_stat; 747 return host_stat;
748 748
749 /* errata A252,A308 workaround: Step4 */ 749 /* errata A252,A308 workaround: Step4 */
750 if ((ata_sff_altstatus(ap) & ATA_ERR) && (int_status & INTSTS_INTRQ)) 750 if ((scc_check_altstatus(ap) & ATA_ERR)
751 && (int_status & INTSTS_INTRQ))
751 return (host_stat | ATA_DMA_INTR); 752 return (host_stat | ATA_DMA_INTR);
752 753
753 /* errata A308 workaround Step5 */ 754 /* errata A308 workaround Step5 */
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 70d94fb28a5f..69877bd81815 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -216,7 +216,7 @@ static int sl82c105_qc_defer(struct ata_queued_cmd *qc)
216 struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; 216 struct ata_port *alt = host->ports[1 ^ qc->ap->port_no];
217 int rc; 217 int rc;
218 218
219 /* First apply the usual rules */ 219 /* First apply the usual rules */
220 rc = ata_std_qc_defer(qc); 220 rc = ata_std_qc_defer(qc);
221 if (rc != 0) 221 if (rc != 0)
222 return rc; 222 return rc;
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 2fea6cbe7755..708ed144ede9 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -259,15 +259,15 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
259 259
260 pci_read_config_byte(pdev, 0x4C, &setup); 260 pci_read_config_byte(pdev, 0x4C, &setup);
261 setup &= ~(3 << shift); 261 setup &= ~(3 << shift);
262 setup |= FIT(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ 262 setup |= clamp_val(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */
263 pci_write_config_byte(pdev, 0x4C, setup); 263 pci_write_config_byte(pdev, 0x4C, setup);
264 } 264 }
265 265
266 /* Load the PIO mode bits */ 266 /* Load the PIO mode bits */
267 pci_write_config_byte(pdev, 0x4F - ap->port_no, 267 pci_write_config_byte(pdev, 0x4F - ap->port_no,
268 ((FIT(t.act8b, 1, 16) - 1) << 4) | (FIT(t.rec8b, 1, 16) - 1)); 268 ((clamp_val(t.act8b, 1, 16) - 1) << 4) | (clamp_val(t.rec8b, 1, 16) - 1));
269 pci_write_config_byte(pdev, 0x48 + offset, 269 pci_write_config_byte(pdev, 0x48 + offset,
270 ((FIT(t.active, 1, 16) - 1) << 4) | (FIT(t.recover, 1, 16) - 1)); 270 ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1));
271 271
272 /* Load the UDMA bits according to type */ 272 /* Load the UDMA bits according to type */
273 switch(udma_type) { 273 switch(udma_type) {
@@ -275,16 +275,16 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo
275 /* BUG() ? */ 275 /* BUG() ? */
276 /* fall through */ 276 /* fall through */
277 case 33: 277 case 33:
278 ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 5) - 2)) : 0x03; 278 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03;
279 break; 279 break;
280 case 66: 280 case 66:
281 ut = t.udma ? (0xe8 | (FIT(t.udma, 2, 9) - 2)) : 0x0f; 281 ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f;
282 break; 282 break;
283 case 100: 283 case 100:
284 ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; 284 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07;
285 break; 285 break;
286 case 133: 286 case 133:
287 ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; 287 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07;
288 break; 288 break;
289 } 289 }
290 290
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 6e52a3573fbf..474528f8fe3d 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -75,8 +75,8 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
75 else 75 else
76 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 76 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
77 77
78 active = (FIT(t.active, 3, 17) - 1) & 0x0F; 78 active = (clamp_val(t.active, 3, 17) - 1) & 0x0F;
79 recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; 79 recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F;
80 timing = (active << 4) | recovery; 80 timing = (active << 4) | recovery;
81 winbond_writecfg(winbond->config, timing, reg); 81 winbond_writecfg(winbond->config, timing, reg);
82 82
@@ -87,7 +87,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
87 reg |= 0x08; /* FIFO off */ 87 reg |= 0x08; /* FIFO off */
88 if (!ata_pio_need_iordy(adev)) 88 if (!ata_pio_need_iordy(adev))
89 reg |= 0x02; /* IORDY off */ 89 reg |= 0x02; /* IORDY off */
90 reg |= (FIT(t.setup, 0, 3) << 6); 90 reg |= (clamp_val(t.setup, 0, 3) << 6);
91 winbond_writecfg(winbond->config, timing + 1, reg); 91 winbond_writecfg(winbond->config, timing + 1, reg);
92} 92}
93 93
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 853559e32315..3924e7209a44 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -34,7 +34,7 @@ enum {
34 34
35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
37 ATA_FLAG_NCQ), 37 ATA_FLAG_PMP | ATA_FLAG_NCQ),
38 38
39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, 39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH,
40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ 40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
@@ -395,7 +395,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
395 cd = (struct command_desc *)pp->cmdentry + tag; 395 cd = (struct command_desc *)pp->cmdentry + tag;
396 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; 396 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE;
397 397
398 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis); 398 ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *) &cd->cfis);
399 399
400 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", 400 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
401 cd->cfis[0], cd->cfis[1], cd->cfis[2]); 401 cd->cfis[0], cd->cfis[1], cd->cfis[2]);
@@ -438,6 +438,8 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc)
438 ioread32(CA + hcr_base), 438 ioread32(CA + hcr_base),
439 ioread32(CE + hcr_base), ioread32(CC + hcr_base)); 439 ioread32(CE + hcr_base), ioread32(CC + hcr_base));
440 440
441 iowrite32(qc->dev->link->pmp, CQPMP + hcr_base);
442
441 /* Simply queue command to the controller/device */ 443 /* Simply queue command to the controller/device */
442 iowrite32(1 << tag, CQ + hcr_base); 444 iowrite32(1 << tag, CQ + hcr_base);
443 445
@@ -558,11 +560,36 @@ static void sata_fsl_thaw(struct ata_port *ap)
558 ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS)); 560 ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS));
559} 561}
560 562
563static void sata_fsl_pmp_attach(struct ata_port *ap)
564{
565 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
566 void __iomem *hcr_base = host_priv->hcr_base;
567 u32 temp;
568
569 temp = ioread32(hcr_base + HCONTROL);
570 iowrite32((temp | HCONTROL_PMP_ATTACHED), hcr_base + HCONTROL);
571}
572
573static void sata_fsl_pmp_detach(struct ata_port *ap)
574{
575 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
576 void __iomem *hcr_base = host_priv->hcr_base;
577 u32 temp;
578
579 temp = ioread32(hcr_base + HCONTROL);
580 temp &= ~HCONTROL_PMP_ATTACHED;
581 iowrite32(temp, hcr_base + HCONTROL);
582
583 /* enable interrupts on the controller/port */
584 temp = ioread32(hcr_base + HCONTROL);
585 iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL);
586
587}
588
561static int sata_fsl_port_start(struct ata_port *ap) 589static int sata_fsl_port_start(struct ata_port *ap)
562{ 590{
563 struct device *dev = ap->host->dev; 591 struct device *dev = ap->host->dev;
564 struct sata_fsl_port_priv *pp; 592 struct sata_fsl_port_priv *pp;
565 int retval;
566 void *mem; 593 void *mem;
567 dma_addr_t mem_dma; 594 dma_addr_t mem_dma;
568 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 595 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
@@ -688,12 +715,13 @@ static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline)
688} 715}
689 716
690static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, 717static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
691 unsigned long deadline) 718 unsigned long deadline)
692{ 719{
693 struct ata_port *ap = link->ap; 720 struct ata_port *ap = link->ap;
694 struct sata_fsl_port_priv *pp = ap->private_data; 721 struct sata_fsl_port_priv *pp = ap->private_data;
695 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 722 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
696 void __iomem *hcr_base = host_priv->hcr_base; 723 void __iomem *hcr_base = host_priv->hcr_base;
724 int pmp = sata_srst_pmp(link);
697 u32 temp; 725 u32 temp;
698 struct ata_taskfile tf; 726 struct ata_taskfile tf;
699 u8 *cfis; 727 u8 *cfis;
@@ -703,6 +731,9 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
703 731
704 DPRINTK("in xx_softreset\n"); 732 DPRINTK("in xx_softreset\n");
705 733
734 if (pmp != SATA_PMP_CTRL_PORT)
735 goto issue_srst;
736
706try_offline_again: 737try_offline_again:
707 /* 738 /*
708 * Force host controller to go off-line, aborting current operations 739 * Force host controller to go off-line, aborting current operations
@@ -746,6 +777,7 @@ try_offline_again:
746 777
747 temp = ioread32(hcr_base + HCONTROL); 778 temp = ioread32(hcr_base + HCONTROL);
748 temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE); 779 temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE);
780 temp |= HCONTROL_PMP_ATTACHED;
749 iowrite32(temp, hcr_base + HCONTROL); 781 iowrite32(temp, hcr_base + HCONTROL);
750 782
751 temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500); 783 temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500);
@@ -771,7 +803,8 @@ try_offline_again:
771 ata_port_printk(ap, KERN_WARNING, 803 ata_port_printk(ap, KERN_WARNING,
772 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 804 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
773 ioread32(hcr_base + HSTATUS)); 805 ioread32(hcr_base + HSTATUS));
774 goto err; 806 *class = ATA_DEV_NONE;
807 goto out;
775 } 808 }
776 809
777 /* 810 /*
@@ -783,7 +816,8 @@ try_offline_again:
783 816
784 if ((temp & 0xFF) != 0x18) { 817 if ((temp & 0xFF) != 0x18) {
785 ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); 818 ata_port_printk(ap, KERN_WARNING, "No Signature Update\n");
786 goto err; 819 *class = ATA_DEV_NONE;
820 goto out;
787 } else { 821 } else {
788 ata_port_printk(ap, KERN_INFO, 822 ata_port_printk(ap, KERN_INFO,
789 "Signature Update detected @ %d msecs\n", 823 "Signature Update detected @ %d msecs\n",
@@ -798,6 +832,7 @@ try_offline_again:
798 * reached here, we can send a command to the target device 832 * reached here, we can send a command to the target device
799 */ 833 */
800 834
835issue_srst:
801 DPRINTK("Sending SRST/device reset\n"); 836 DPRINTK("Sending SRST/device reset\n");
802 837
803 ata_tf_init(link->device, &tf); 838 ata_tf_init(link->device, &tf);
@@ -808,7 +843,7 @@ try_offline_again:
808 SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); 843 SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
809 844
810 tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ 845 tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */
811 ata_tf_to_fis(&tf, 0, 0, cfis); 846 ata_tf_to_fis(&tf, pmp, 0, cfis);
812 847
813 DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n", 848 DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n",
814 cfis[0], cfis[1], cfis[2], cfis[3]); 849 cfis[0], cfis[1], cfis[2], cfis[3]);
@@ -854,8 +889,10 @@ try_offline_again:
854 sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); 889 sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
855 890
856 tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ 891 tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */
857 ata_tf_to_fis(&tf, 0, 0, cfis); 892 ata_tf_to_fis(&tf, pmp, 0, cfis);
858 893
894 if (pmp != SATA_PMP_CTRL_PORT)
895 iowrite32(pmp, CQPMP + hcr_base);
859 iowrite32(1, CQ + hcr_base); 896 iowrite32(1, CQ + hcr_base);
860 msleep(150); /* ?? */ 897 msleep(150); /* ?? */
861 898
@@ -886,12 +923,21 @@ try_offline_again:
886 VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); 923 VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
887 } 924 }
888 925
926out:
889 return 0; 927 return 0;
890 928
891err: 929err:
892 return -EIO; 930 return -EIO;
893} 931}
894 932
933static void sata_fsl_error_handler(struct ata_port *ap)
934{
935
936 DPRINTK("in xx_error_handler\n");
937 sata_pmp_error_handler(ap);
938
939}
940
895static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) 941static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc)
896{ 942{
897 if (qc->flags & ATA_QCFLAG_FAILED) 943 if (qc->flags & ATA_QCFLAG_FAILED)
@@ -905,18 +951,21 @@ static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc)
905 951
906static void sata_fsl_error_intr(struct ata_port *ap) 952static void sata_fsl_error_intr(struct ata_port *ap)
907{ 953{
908 struct ata_link *link = &ap->link;
909 struct ata_eh_info *ehi = &link->eh_info;
910 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 954 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
911 void __iomem *hcr_base = host_priv->hcr_base; 955 void __iomem *hcr_base = host_priv->hcr_base;
912 u32 hstatus, dereg, cereg = 0, SError = 0; 956 u32 hstatus, dereg=0, cereg = 0, SError = 0;
913 unsigned int err_mask = 0, action = 0; 957 unsigned int err_mask = 0, action = 0;
914 struct ata_queued_cmd *qc; 958 int freeze = 0, abort=0;
915 int freeze = 0; 959 struct ata_link *link = NULL;
960 struct ata_queued_cmd *qc = NULL;
961 struct ata_eh_info *ehi;
916 962
917 hstatus = ioread32(hcr_base + HSTATUS); 963 hstatus = ioread32(hcr_base + HSTATUS);
918 cereg = ioread32(hcr_base + CE); 964 cereg = ioread32(hcr_base + CE);
919 965
966 /* first, analyze and record host port events */
967 link = &ap->link;
968 ehi = &link->eh_info;
920 ata_ehi_clear_desc(ehi); 969 ata_ehi_clear_desc(ehi);
921 970
922 /* 971 /*
@@ -926,42 +975,28 @@ static void sata_fsl_error_intr(struct ata_port *ap)
926 sata_fsl_scr_read(ap, SCR_ERROR, &SError); 975 sata_fsl_scr_read(ap, SCR_ERROR, &SError);
927 if (unlikely(SError & 0xFFFF0000)) { 976 if (unlikely(SError & 0xFFFF0000)) {
928 sata_fsl_scr_write(ap, SCR_ERROR, SError); 977 sata_fsl_scr_write(ap, SCR_ERROR, SError);
929 err_mask |= AC_ERR_ATA_BUS;
930 } 978 }
931 979
932 DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", 980 DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n",
933 hstatus, cereg, ioread32(hcr_base + DE), SError); 981 hstatus, cereg, ioread32(hcr_base + DE), SError);
934 982
935 /* handle single device errors */ 983 /* handle fatal errors */
936 if (cereg) { 984 if (hstatus & FATAL_ERROR_DECODE) {
937 /* 985 ehi->err_mask |= AC_ERR_ATA_BUS;
938 * clear the command error, also clears queue to the device 986 ehi->action |= ATA_EH_SOFTRESET;
939 * in error, and we can (re)issue commands to this device.
940 * When a device is in error all commands queued into the
941 * host controller and at the device are considered aborted
942 * and the queue for that device is stopped. Now, after
943 * clearing the device error, we can issue commands to the
944 * device to interrogate it to find the source of the error.
945 */
946 dereg = ioread32(hcr_base + DE);
947 iowrite32(dereg, hcr_base + DE);
948 iowrite32(cereg, hcr_base + CE);
949 987
950 DPRINTK("single device error, CE=0x%x, DE=0x%x\n",
951 ioread32(hcr_base + CE), ioread32(hcr_base + DE));
952 /* 988 /*
953 * We should consider this as non fatal error, and TF must 989 * Ignore serror in case of fatal errors as we always want
954 * be updated as done below. 990 * to do a soft-reset of the FSL SATA controller. Analyzing
991 * serror may cause libata to schedule a hard-reset action,
992 * and hard-reset currently does not do controller
993 * offline/online, causing command timeouts and leads to an
994 * un-recoverable state, hence make libATA ignore
995 * autopsy in case of fatal errors.
955 */ 996 */
956 997
957 err_mask |= AC_ERR_DEV; 998 ehi->flags |= ATA_EHI_NO_AUTOPSY;
958 }
959 999
960 /* handle fatal errors */
961 if (hstatus & FATAL_ERROR_DECODE) {
962 err_mask |= AC_ERR_ATA_BUS;
963 action |= ATA_EH_RESET;
964 /* how will fatal error interrupts be completed ?? */
965 freeze = 1; 1000 freeze = 1;
966 } 1001 }
967 1002
@@ -971,30 +1006,83 @@ static void sata_fsl_error_intr(struct ata_port *ap)
971 1006
972 /* Setup a soft-reset EH action */ 1007 /* Setup a soft-reset EH action */
973 ata_ehi_hotplugged(ehi); 1008 ata_ehi_hotplugged(ehi);
1009 ata_ehi_push_desc(ehi, "%s", "PHY RDY changed");
974 freeze = 1; 1010 freeze = 1;
975 } 1011 }
976 1012
977 /* record error info */ 1013 /* handle single device errors */
978 qc = ata_qc_from_tag(ap, link->active_tag); 1014 if (cereg) {
1015 /*
1016 * clear the command error, also clears queue to the device
1017 * in error, and we can (re)issue commands to this device.
1018 * When a device is in error all commands queued into the
1019 * host controller and at the device are considered aborted
1020 * and the queue for that device is stopped. Now, after
1021 * clearing the device error, we can issue commands to the
1022 * device to interrogate it to find the source of the error.
1023 */
1024 abort = 1;
1025
1026 DPRINTK("single device error, CE=0x%x, DE=0x%x\n",
1027 ioread32(hcr_base + CE), ioread32(hcr_base + DE));
979 1028
980 if (qc) 1029 /* find out the offending link and qc */
1030 if (ap->nr_pmp_links) {
1031 dereg = ioread32(hcr_base + DE);
1032 iowrite32(dereg, hcr_base + DE);
1033 iowrite32(cereg, hcr_base + CE);
1034
1035 if (dereg < ap->nr_pmp_links) {
1036 link = &ap->pmp_link[dereg];
1037 ehi = &link->eh_info;
1038 qc = ata_qc_from_tag(ap, link->active_tag);
1039 /*
1040 * We should consider this as non fatal error,
1041 * and TF must be updated as done below.
1042 */
1043
1044 err_mask |= AC_ERR_DEV;
1045
1046 } else {
1047 err_mask |= AC_ERR_HSM;
1048 action |= ATA_EH_HARDRESET;
1049 freeze = 1;
1050 }
1051 } else {
1052 dereg = ioread32(hcr_base + DE);
1053 iowrite32(dereg, hcr_base + DE);
1054 iowrite32(cereg, hcr_base + CE);
1055
1056 qc = ata_qc_from_tag(ap, link->active_tag);
1057 /*
1058 * We should consider this as non fatal error,
1059 * and TF must be updated as done below.
1060 */
1061 err_mask |= AC_ERR_DEV;
1062 }
1063 }
1064
1065 /* record error info */
1066 if (qc) {
981 qc->err_mask |= err_mask; 1067 qc->err_mask |= err_mask;
982 else 1068 } else
983 ehi->err_mask |= err_mask; 1069 ehi->err_mask |= err_mask;
984 1070
985 ehi->action |= action; 1071 ehi->action |= action;
986 ehi->serror |= SError;
987 1072
988 /* freeze or abort */ 1073 /* freeze or abort */
989 if (freeze) 1074 if (freeze)
990 ata_port_freeze(ap); 1075 ata_port_freeze(ap);
991 else 1076 else if (abort) {
992 ata_port_abort(ap); 1077 if (qc)
1078 ata_link_abort(qc->dev->link);
1079 else
1080 ata_port_abort(ap);
1081 }
993} 1082}
994 1083
995static void sata_fsl_host_intr(struct ata_port *ap) 1084static void sata_fsl_host_intr(struct ata_port *ap)
996{ 1085{
997 struct ata_link *link = &ap->link;
998 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 1086 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
999 void __iomem *hcr_base = host_priv->hcr_base; 1087 void __iomem *hcr_base = host_priv->hcr_base;
1000 u32 hstatus, qc_active = 0; 1088 u32 hstatus, qc_active = 0;
@@ -1017,10 +1105,19 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1017 return; 1105 return;
1018 } 1106 }
1019 1107
1020 if (link->sactive) { /* only true for NCQ commands */ 1108 /* Read command completed register */
1109 qc_active = ioread32(hcr_base + CC);
1110
1111 VPRINTK("Status of all queues :\n");
1112 VPRINTK("qc_active/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%x\n",
1113 qc_active,
1114 ioread32(hcr_base + CA),
1115 ioread32(hcr_base + CE),
1116 ioread32(hcr_base + CQ),
1117 ap->qc_active);
1118
1119 if (qc_active & ap->qc_active) {
1021 int i; 1120 int i;
1022 /* Read command completed register */
1023 qc_active = ioread32(hcr_base + CC);
1024 /* clear CC bit, this will also complete the interrupt */ 1121 /* clear CC bit, this will also complete the interrupt */
1025 iowrite32(qc_active, hcr_base + CC); 1122 iowrite32(qc_active, hcr_base + CC);
1026 1123
@@ -1032,8 +1129,9 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1032 for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) { 1129 for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) {
1033 if (qc_active & (1 << i)) { 1130 if (qc_active & (1 << i)) {
1034 qc = ata_qc_from_tag(ap, i); 1131 qc = ata_qc_from_tag(ap, i);
1035 if (qc) 1132 if (qc) {
1036 ata_qc_complete(qc); 1133 ata_qc_complete(qc);
1134 }
1037 DPRINTK 1135 DPRINTK
1038 ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n", 1136 ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n",
1039 i, ioread32(hcr_base + CC), 1137 i, ioread32(hcr_base + CC),
@@ -1042,19 +1140,21 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1042 } 1140 }
1043 return; 1141 return;
1044 1142
1045 } else if (ap->qc_active) { 1143 } else if ((ap->qc_active & (1 << ATA_TAG_INTERNAL))) {
1046 iowrite32(1, hcr_base + CC); 1144 iowrite32(1, hcr_base + CC);
1047 qc = ata_qc_from_tag(ap, link->active_tag); 1145 qc = ata_qc_from_tag(ap, ATA_TAG_INTERNAL);
1048 1146
1049 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", 1147 DPRINTK("completing non-ncq cmd, CC=0x%x\n",
1050 link->active_tag, ioread32(hcr_base + CC)); 1148 ioread32(hcr_base + CC));
1051 1149
1052 if (qc) 1150 if (qc) {
1053 ata_qc_complete(qc); 1151 ata_qc_complete(qc);
1152 }
1054 } else { 1153 } else {
1055 /* Spurious Interrupt!! */ 1154 /* Spurious Interrupt!! */
1056 DPRINTK("spurious interrupt!!, CC = 0x%x\n", 1155 DPRINTK("spurious interrupt!!, CC = 0x%x\n",
1057 ioread32(hcr_base + CC)); 1156 ioread32(hcr_base + CC));
1157 iowrite32(qc_active, hcr_base + CC);
1058 return; 1158 return;
1059 } 1159 }
1060} 1160}
@@ -1130,9 +1230,6 @@ static int sata_fsl_init_controller(struct ata_host *host)
1130 iowrite32(0x00000FFFF, hcr_base + CE); 1230 iowrite32(0x00000FFFF, hcr_base + CE);
1131 iowrite32(0x00000FFFF, hcr_base + DE); 1231 iowrite32(0x00000FFFF, hcr_base + DE);
1132 1232
1133 /* initially assuming no Port multiplier, set CQPMP to 0 */
1134 iowrite32(0x0, hcr_base + CQPMP);
1135
1136 /* 1233 /*
1137 * host controller will be brought on-line, during xx_port_start() 1234 * host controller will be brought on-line, during xx_port_start()
1138 * callback, that should also initiate the OOB, COMINIT sequence 1235 * callback, that should also initiate the OOB, COMINIT sequence
@@ -1154,8 +1251,8 @@ static struct scsi_host_template sata_fsl_sht = {
1154 .dma_boundary = ATA_DMA_BOUNDARY, 1251 .dma_boundary = ATA_DMA_BOUNDARY,
1155}; 1252};
1156 1253
1157static const struct ata_port_operations sata_fsl_ops = { 1254static struct ata_port_operations sata_fsl_ops = {
1158 .inherits = &sata_port_ops, 1255 .inherits = &sata_pmp_port_ops,
1159 1256
1160 .qc_prep = sata_fsl_qc_prep, 1257 .qc_prep = sata_fsl_qc_prep,
1161 .qc_issue = sata_fsl_qc_issue, 1258 .qc_issue = sata_fsl_qc_issue,
@@ -1168,10 +1265,15 @@ static const struct ata_port_operations sata_fsl_ops = {
1168 .thaw = sata_fsl_thaw, 1265 .thaw = sata_fsl_thaw,
1169 .prereset = sata_fsl_prereset, 1266 .prereset = sata_fsl_prereset,
1170 .softreset = sata_fsl_softreset, 1267 .softreset = sata_fsl_softreset,
1268 .pmp_softreset = sata_fsl_softreset,
1269 .error_handler = sata_fsl_error_handler,
1171 .post_internal_cmd = sata_fsl_post_internal_cmd, 1270 .post_internal_cmd = sata_fsl_post_internal_cmd,
1172 1271
1173 .port_start = sata_fsl_port_start, 1272 .port_start = sata_fsl_port_start,
1174 .port_stop = sata_fsl_port_stop, 1273 .port_stop = sata_fsl_port_stop,
1274
1275 .pmp_attach = sata_fsl_pmp_attach,
1276 .pmp_detach = sata_fsl_pmp_detach,
1175}; 1277};
1176 1278
1177static const struct ata_port_info sata_fsl_port_info[] = { 1279static const struct ata_port_info sata_fsl_port_info[] = {
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index bb73b2222627..60391e9a84db 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -72,7 +72,7 @@
72#include <linux/libata.h> 72#include <linux/libata.h>
73 73
74#define DRV_NAME "sata_mv" 74#define DRV_NAME "sata_mv"
75#define DRV_VERSION "1.20" 75#define DRV_VERSION "1.24"
76 76
77enum { 77enum {
78 /* BAR's are enumerated in terms of pci_resource_start() terms */ 78 /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -122,14 +122,17 @@ enum {
122 /* Host Flags */ 122 /* Host Flags */
123 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ 123 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */
124 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ 124 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */
125 /* SoC integrated controllers, no PCI interface */
126 MV_FLAG_SOC = (1 << 28),
127 125
128 MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 126 MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
129 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | 127 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI |
130 ATA_FLAG_PIO_POLLING, 128 ATA_FLAG_PIO_POLLING,
129
131 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, 130 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE,
132 131
132 MV_GENIIE_FLAGS = MV_COMMON_FLAGS | MV_6XXX_FLAGS |
133 ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA |
134 ATA_FLAG_NCQ | ATA_FLAG_AN,
135
133 CRQB_FLAG_READ = (1 << 0), 136 CRQB_FLAG_READ = (1 << 0),
134 CRQB_TAG_SHIFT = 1, 137 CRQB_TAG_SHIFT = 1,
135 CRQB_IOID_SHIFT = 6, /* CRQB Gen-II/IIE IO Id shift */ 138 CRQB_IOID_SHIFT = 6, /* CRQB Gen-II/IIE IO Id shift */
@@ -197,13 +200,6 @@ enum {
197 HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ 200 HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */
198 HC_MAIN_RSVD_5 = (0x1fff << 19), /* bits 31-19 */ 201 HC_MAIN_RSVD_5 = (0x1fff << 19), /* bits 31-19 */
199 HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */ 202 HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */
200 HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE |
201 PORTS_0_3_COAL_DONE | PORTS_4_7_COAL_DONE |
202 PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT |
203 HC_MAIN_RSVD),
204 HC_MAIN_MASKED_IRQS_5 = (PORTS_0_3_COAL_DONE | PORTS_4_7_COAL_DONE |
205 HC_MAIN_RSVD_5),
206 HC_MAIN_MASKED_IRQS_SOC = (PORTS_0_3_COAL_DONE | HC_MAIN_RSVD_SOC),
207 203
208 /* SATAHC registers */ 204 /* SATAHC registers */
209 HC_CFG_OFS = 0, 205 HC_CFG_OFS = 0,
@@ -221,12 +217,18 @@ enum {
221 SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ 217 SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */
222 SATA_ACTIVE_OFS = 0x350, 218 SATA_ACTIVE_OFS = 0x350,
223 SATA_FIS_IRQ_CAUSE_OFS = 0x364, 219 SATA_FIS_IRQ_CAUSE_OFS = 0x364,
220 SATA_FIS_IRQ_AN = (1 << 9), /* async notification */
224 221
225 LTMODE_OFS = 0x30c, 222 LTMODE_OFS = 0x30c,
226 LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */ 223 LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */
227 224
228 PHY_MODE3 = 0x310, 225 PHY_MODE3 = 0x310,
229 PHY_MODE4 = 0x314, 226 PHY_MODE4 = 0x314,
227 PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */
228 PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */
229 PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */
230 PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */
231
230 PHY_MODE2 = 0x330, 232 PHY_MODE2 = 0x330,
231 SATA_IFCTL_OFS = 0x344, 233 SATA_IFCTL_OFS = 0x344,
232 SATA_TESTCTL_OFS = 0x348, 234 SATA_TESTCTL_OFS = 0x348,
@@ -357,12 +359,12 @@ enum {
357 MV_HP_ERRATA_50XXB2 = (1 << 2), 359 MV_HP_ERRATA_50XXB2 = (1 << 2),
358 MV_HP_ERRATA_60X1B2 = (1 << 3), 360 MV_HP_ERRATA_60X1B2 = (1 << 3),
359 MV_HP_ERRATA_60X1C0 = (1 << 4), 361 MV_HP_ERRATA_60X1C0 = (1 << 4),
360 MV_HP_ERRATA_XX42A0 = (1 << 5),
361 MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ 362 MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */
362 MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ 363 MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */
363 MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ 364 MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */
364 MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ 365 MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */
365 MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ 366 MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */
367 MV_HP_FLAG_SOC = (1 << 11), /* SystemOnChip, no PCI */
366 368
367 /* Port private flags (pp_flags) */ 369 /* Port private flags (pp_flags) */
368 MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ 370 MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */
@@ -375,7 +377,7 @@ enum {
375#define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) 377#define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II)
376#define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) 378#define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE)
377#define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE) 379#define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE)
378#define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) 380#define IS_SOC(hpriv) ((hpriv)->hp_flags & MV_HP_FLAG_SOC)
379 381
380#define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) 382#define WINDOW_CTRL(i) (0x20030 + ((i) << 4))
381#define WINDOW_BASE(i) (0x20034 + ((i) << 4)) 383#define WINDOW_BASE(i) (0x20034 + ((i) << 4))
@@ -459,6 +461,7 @@ struct mv_port_signal {
459 461
460struct mv_host_priv { 462struct mv_host_priv {
461 u32 hp_flags; 463 u32 hp_flags;
464 u32 main_irq_mask;
462 struct mv_port_signal signal[8]; 465 struct mv_port_signal signal[8];
463 const struct mv_hw_ops *ops; 466 const struct mv_hw_ops *ops;
464 int n_ports; 467 int n_ports;
@@ -640,25 +643,19 @@ static const struct ata_port_info mv_port_info[] = {
640 .port_ops = &mv6_ops, 643 .port_ops = &mv6_ops,
641 }, 644 },
642 { /* chip_6042 */ 645 { /* chip_6042 */
643 .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | 646 .flags = MV_GENIIE_FLAGS,
644 ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA |
645 ATA_FLAG_NCQ,
646 .pio_mask = 0x1f, /* pio0-4 */ 647 .pio_mask = 0x1f, /* pio0-4 */
647 .udma_mask = ATA_UDMA6, 648 .udma_mask = ATA_UDMA6,
648 .port_ops = &mv_iie_ops, 649 .port_ops = &mv_iie_ops,
649 }, 650 },
650 { /* chip_7042 */ 651 { /* chip_7042 */
651 .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | 652 .flags = MV_GENIIE_FLAGS,
652 ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA |
653 ATA_FLAG_NCQ,
654 .pio_mask = 0x1f, /* pio0-4 */ 653 .pio_mask = 0x1f, /* pio0-4 */
655 .udma_mask = ATA_UDMA6, 654 .udma_mask = ATA_UDMA6,
656 .port_ops = &mv_iie_ops, 655 .port_ops = &mv_iie_ops,
657 }, 656 },
658 { /* chip_soc */ 657 { /* chip_soc */
659 .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | 658 .flags = MV_GENIIE_FLAGS,
660 ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA |
661 ATA_FLAG_NCQ | MV_FLAG_SOC,
662 .pio_mask = 0x1f, /* pio0-4 */ 659 .pio_mask = 0x1f, /* pio0-4 */
663 .udma_mask = ATA_UDMA6, 660 .udma_mask = ATA_UDMA6,
664 .port_ops = &mv_iie_ops, 661 .port_ops = &mv_iie_ops,
@@ -818,12 +815,7 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio,
818 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); 815 writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS);
819 writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index, 816 writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index,
820 port_mmio + EDMA_REQ_Q_IN_PTR_OFS); 817 port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
821 818 writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS);
822 if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0)
823 writelfl((pp->crqb_dma & 0xffffffff) | index,
824 port_mmio + EDMA_REQ_Q_OUT_PTR_OFS);
825 else
826 writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS);
827 819
828 /* 820 /*
829 * initialize response queue 821 * initialize response queue
@@ -833,17 +825,38 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio,
833 825
834 WARN_ON(pp->crpb_dma & 0xff); 826 WARN_ON(pp->crpb_dma & 0xff);
835 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); 827 writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS);
836 828 writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS);
837 if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0)
838 writelfl((pp->crpb_dma & 0xffffffff) | index,
839 port_mmio + EDMA_RSP_Q_IN_PTR_OFS);
840 else
841 writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS);
842
843 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index, 829 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index,
844 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 830 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
845} 831}
846 832
833static void mv_set_main_irq_mask(struct ata_host *host,
834 u32 disable_bits, u32 enable_bits)
835{
836 struct mv_host_priv *hpriv = host->private_data;
837 u32 old_mask, new_mask;
838
839 old_mask = hpriv->main_irq_mask;
840 new_mask = (old_mask & ~disable_bits) | enable_bits;
841 if (new_mask != old_mask) {
842 hpriv->main_irq_mask = new_mask;
843 writelfl(new_mask, hpriv->main_irq_mask_addr);
844 }
845}
846
847static void mv_enable_port_irqs(struct ata_port *ap,
848 unsigned int port_bits)
849{
850 unsigned int shift, hardport, port = ap->port_no;
851 u32 disable_bits, enable_bits;
852
853 MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport);
854
855 disable_bits = (DONE_IRQ | ERR_IRQ) << shift;
856 enable_bits = port_bits << shift;
857 mv_set_main_irq_mask(ap->host, disable_bits, enable_bits);
858}
859
847/** 860/**
848 * mv_start_dma - Enable eDMA engine 861 * mv_start_dma - Enable eDMA engine
849 * @base: port base address 862 * @base: port base address
@@ -886,9 +899,11 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio,
886 mv_edma_cfg(ap, want_ncq); 899 mv_edma_cfg(ap, want_ncq);
887 900
888 /* clear FIS IRQ Cause */ 901 /* clear FIS IRQ Cause */
889 writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); 902 if (IS_GEN_IIE(hpriv))
903 writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS);
890 904
891 mv_set_edma_ptrs(port_mmio, hpriv, pp); 905 mv_set_edma_ptrs(port_mmio, hpriv, pp);
906 mv_enable_port_irqs(ap, DONE_IRQ|ERR_IRQ);
892 907
893 writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS); 908 writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS);
894 pp->pp_flags |= MV_PP_FLAG_EDMA_EN; 909 pp->pp_flags |= MV_PP_FLAG_EDMA_EN;
@@ -1231,7 +1246,7 @@ static void mv_edma_cfg(struct ata_port *ap, int want_ncq)
1231 1246
1232 cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ 1247 cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */
1233 cfg |= (1 << 22); /* enab 4-entry host queue cache */ 1248 cfg |= (1 << 22); /* enab 4-entry host queue cache */
1234 if (HAS_PCI(ap->host)) 1249 if (!IS_SOC(hpriv))
1235 cfg |= (1 << 18); /* enab early completion */ 1250 cfg |= (1 << 18); /* enab early completion */
1236 if (hpriv->hp_flags & MV_HP_CUT_THROUGH) 1251 if (hpriv->hp_flags & MV_HP_CUT_THROUGH)
1237 cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */ 1252 cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */
@@ -1341,6 +1356,7 @@ out_port_free_dma_mem:
1341static void mv_port_stop(struct ata_port *ap) 1356static void mv_port_stop(struct ata_port *ap)
1342{ 1357{
1343 mv_stop_edma(ap); 1358 mv_stop_edma(ap);
1359 mv_enable_port_irqs(ap, 0);
1344 mv_port_free_dma_mem(ap); 1360 mv_port_free_dma_mem(ap);
1345} 1361}
1346 1362
@@ -1582,6 +1598,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
1582 * shadow block, etc registers. 1598 * shadow block, etc registers.
1583 */ 1599 */
1584 mv_stop_edma(ap); 1600 mv_stop_edma(ap);
1601 mv_enable_port_irqs(ap, ERR_IRQ);
1585 mv_pmp_select(ap, qc->dev->link->pmp); 1602 mv_pmp_select(ap, qc->dev->link->pmp);
1586 return ata_sff_qc_issue(qc); 1603 return ata_sff_qc_issue(qc);
1587 } 1604 }
@@ -1670,6 +1687,18 @@ static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map)
1670 } 1687 }
1671} 1688}
1672 1689
1690static int mv_req_q_empty(struct ata_port *ap)
1691{
1692 void __iomem *port_mmio = mv_ap_base(ap);
1693 u32 in_ptr, out_ptr;
1694
1695 in_ptr = (readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS)
1696 >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
1697 out_ptr = (readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS)
1698 >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
1699 return (in_ptr == out_ptr); /* 1 == queue_is_empty */
1700}
1701
1673static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) 1702static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap)
1674{ 1703{
1675 struct mv_port_priv *pp = ap->private_data; 1704 struct mv_port_priv *pp = ap->private_data;
@@ -1703,7 +1732,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap)
1703 ap->qc_active, failed_links, 1732 ap->qc_active, failed_links,
1704 ap->nr_active_links); 1733 ap->nr_active_links);
1705 1734
1706 if (ap->nr_active_links <= failed_links) { 1735 if (ap->nr_active_links <= failed_links && mv_req_q_empty(ap)) {
1707 mv_process_crpb_entries(ap, pp); 1736 mv_process_crpb_entries(ap, pp);
1708 mv_stop_edma(ap); 1737 mv_stop_edma(ap);
1709 mv_eh_freeze(ap); 1738 mv_eh_freeze(ap);
@@ -1812,6 +1841,7 @@ static void mv_err_intr(struct ata_port *ap)
1812{ 1841{
1813 void __iomem *port_mmio = mv_ap_base(ap); 1842 void __iomem *port_mmio = mv_ap_base(ap);
1814 u32 edma_err_cause, eh_freeze_mask, serr = 0; 1843 u32 edma_err_cause, eh_freeze_mask, serr = 0;
1844 u32 fis_cause = 0;
1815 struct mv_port_priv *pp = ap->private_data; 1845 struct mv_port_priv *pp = ap->private_data;
1816 struct mv_host_priv *hpriv = ap->host->private_data; 1846 struct mv_host_priv *hpriv = ap->host->private_data;
1817 unsigned int action = 0, err_mask = 0; 1847 unsigned int action = 0, err_mask = 0;
@@ -1821,16 +1851,19 @@ static void mv_err_intr(struct ata_port *ap)
1821 1851
1822 /* 1852 /*
1823 * Read and clear the SError and err_cause bits. 1853 * Read and clear the SError and err_cause bits.
1854 * For GenIIe, if EDMA_ERR_TRANS_IRQ_7 is set, we also must read/clear
1855 * the FIS_IRQ_CAUSE register before clearing edma_err_cause.
1824 */ 1856 */
1825 sata_scr_read(&ap->link, SCR_ERROR, &serr); 1857 sata_scr_read(&ap->link, SCR_ERROR, &serr);
1826 sata_scr_write_flush(&ap->link, SCR_ERROR, serr); 1858 sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
1827 1859
1828 edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 1860 edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
1861 if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) {
1862 fis_cause = readl(port_mmio + SATA_FIS_IRQ_CAUSE_OFS);
1863 writelfl(~fis_cause, port_mmio + SATA_FIS_IRQ_CAUSE_OFS);
1864 }
1829 writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 1865 writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
1830 1866
1831 ata_port_printk(ap, KERN_INFO, "%s: err_cause=%08x pp_flags=0x%x\n",
1832 __func__, edma_err_cause, pp->pp_flags);
1833
1834 if (edma_err_cause & EDMA_ERR_DEV) { 1867 if (edma_err_cause & EDMA_ERR_DEV) {
1835 /* 1868 /*
1836 * Device errors during FIS-based switching operation 1869 * Device errors during FIS-based switching operation
@@ -1844,6 +1877,18 @@ static void mv_err_intr(struct ata_port *ap)
1844 ata_ehi_clear_desc(ehi); 1877 ata_ehi_clear_desc(ehi);
1845 ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x", 1878 ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x",
1846 edma_err_cause, pp->pp_flags); 1879 edma_err_cause, pp->pp_flags);
1880
1881 if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) {
1882 ata_ehi_push_desc(ehi, "fis_cause=%08x", fis_cause);
1883 if (fis_cause & SATA_FIS_IRQ_AN) {
1884 u32 ec = edma_err_cause &
1885 ~(EDMA_ERR_TRANS_IRQ_7 | EDMA_ERR_IRQ_TRANSIENT);
1886 sata_async_notification(ap);
1887 if (!ec)
1888 return; /* Just an AN; no need for the nukes */
1889 ata_ehi_push_desc(ehi, "SDB notify");
1890 }
1891 }
1847 /* 1892 /*
1848 * All generations share these EDMA error cause bits: 1893 * All generations share these EDMA error cause bits:
1849 */ 1894 */
@@ -2162,20 +2207,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance)
2162 struct ata_host *host = dev_instance; 2207 struct ata_host *host = dev_instance;
2163 struct mv_host_priv *hpriv = host->private_data; 2208 struct mv_host_priv *hpriv = host->private_data;
2164 unsigned int handled = 0; 2209 unsigned int handled = 0;
2165 u32 main_irq_cause, main_irq_mask; 2210 u32 main_irq_cause, pending_irqs;
2166 2211
2167 spin_lock(&host->lock); 2212 spin_lock(&host->lock);
2168 main_irq_cause = readl(hpriv->main_irq_cause_addr); 2213 main_irq_cause = readl(hpriv->main_irq_cause_addr);
2169 main_irq_mask = readl(hpriv->main_irq_mask_addr); 2214 pending_irqs = main_irq_cause & hpriv->main_irq_mask;
2170 /* 2215 /*
2171 * Deal with cases where we either have nothing pending, or have read 2216 * Deal with cases where we either have nothing pending, or have read
2172 * a bogus register value which can indicate HW removal or PCI fault. 2217 * a bogus register value which can indicate HW removal or PCI fault.
2173 */ 2218 */
2174 if ((main_irq_cause & main_irq_mask) && (main_irq_cause != 0xffffffffU)) { 2219 if (pending_irqs && main_irq_cause != 0xffffffffU) {
2175 if (unlikely((main_irq_cause & PCI_ERR) && HAS_PCI(host))) 2220 if (unlikely((pending_irqs & PCI_ERR) && !IS_SOC(hpriv)))
2176 handled = mv_pci_error(host, hpriv->base); 2221 handled = mv_pci_error(host, hpriv->base);
2177 else 2222 else
2178 handled = mv_host_intr(host, main_irq_cause); 2223 handled = mv_host_intr(host, pending_irqs);
2179 } 2224 }
2180 spin_unlock(&host->lock); 2225 spin_unlock(&host->lock);
2181 return IRQ_RETVAL(handled); 2226 return IRQ_RETVAL(handled);
@@ -2373,7 +2418,6 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio)
2373 ZERO(MV_PCI_DISC_TIMER); 2418 ZERO(MV_PCI_DISC_TIMER);
2374 ZERO(MV_PCI_MSI_TRIGGER); 2419 ZERO(MV_PCI_MSI_TRIGGER);
2375 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); 2420 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS);
2376 ZERO(PCI_HC_MAIN_IRQ_MASK_OFS);
2377 ZERO(MV_PCI_SERR_MASK); 2421 ZERO(MV_PCI_SERR_MASK);
2378 ZERO(hpriv->irq_cause_ofs); 2422 ZERO(hpriv->irq_cause_ofs);
2379 ZERO(hpriv->irq_mask_ofs); 2423 ZERO(hpriv->irq_mask_ofs);
@@ -2495,7 +2539,7 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
2495 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); 2539 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0);
2496 int fix_phy_mode4 = 2540 int fix_phy_mode4 =
2497 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); 2541 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0);
2498 u32 m2, tmp; 2542 u32 m2, m3;
2499 2543
2500 if (fix_phy_mode2) { 2544 if (fix_phy_mode2) {
2501 m2 = readl(port_mmio + PHY_MODE2); 2545 m2 = readl(port_mmio + PHY_MODE2);
@@ -2512,28 +2556,36 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
2512 udelay(200); 2556 udelay(200);
2513 } 2557 }
2514 2558
2515 /* who knows what this magic does */ 2559 /*
2516 tmp = readl(port_mmio + PHY_MODE3); 2560 * Gen-II/IIe PHY_MODE3 errata RM#2:
2517 tmp &= ~0x7F800000; 2561 * Achieves better receiver noise performance than the h/w default:
2518 tmp |= 0x2A800000; 2562 */
2519 writel(tmp, port_mmio + PHY_MODE3); 2563 m3 = readl(port_mmio + PHY_MODE3);
2520 2564 m3 = (m3 & 0x1f) | (0x5555601 << 5);
2521 if (fix_phy_mode4) {
2522 u32 m4;
2523
2524 m4 = readl(port_mmio + PHY_MODE4);
2525
2526 if (hp_flags & MV_HP_ERRATA_60X1B2)
2527 tmp = readl(port_mmio + PHY_MODE3);
2528 2565
2529 /* workaround for errata FEr SATA#10 (part 1) */ 2566 /* Guideline 88F5182 (GL# SATA-S11) */
2530 m4 = (m4 & ~(1 << 1)) | (1 << 0); 2567 if (IS_SOC(hpriv))
2568 m3 &= ~0x1c;
2531 2569
2570 if (fix_phy_mode4) {
2571 u32 m4 = readl(port_mmio + PHY_MODE4);
2572 /*
2573 * Enforce reserved-bit restrictions on GenIIe devices only.
2574 * For earlier chipsets, force only the internal config field
2575 * (workaround for errata FEr SATA#10 part 1).
2576 */
2577 if (IS_GEN_IIE(hpriv))
2578 m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES;
2579 else
2580 m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE;
2532 writel(m4, port_mmio + PHY_MODE4); 2581 writel(m4, port_mmio + PHY_MODE4);
2533
2534 if (hp_flags & MV_HP_ERRATA_60X1B2)
2535 writel(tmp, port_mmio + PHY_MODE3);
2536 } 2582 }
2583 /*
2584 * Workaround for 60x1-B2 errata SATA#13:
2585 * Any write to PHY_MODE4 (above) may corrupt PHY_MODE3,
2586 * so we must always rewrite PHY_MODE3 after PHY_MODE4.
2587 */
2588 writel(m3, port_mmio + PHY_MODE3);
2537 2589
2538 /* Revert values of pre-emphasis and signal amps to the saved ones */ 2590 /* Revert values of pre-emphasis and signal amps to the saved ones */
2539 m2 = readl(port_mmio + PHY_MODE2); 2591 m2 = readl(port_mmio + PHY_MODE2);
@@ -2728,6 +2780,7 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class,
2728 2780
2729 rc = sata_link_hardreset(link, timing, deadline + extra, 2781 rc = sata_link_hardreset(link, timing, deadline + extra,
2730 &online, NULL); 2782 &online, NULL);
2783 rc = online ? -EAGAIN : rc;
2731 if (rc) 2784 if (rc)
2732 return rc; 2785 return rc;
2733 sata_scr_read(link, SCR_STATUS, &sstatus); 2786 sata_scr_read(link, SCR_STATUS, &sstatus);
@@ -2744,32 +2797,18 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class,
2744 2797
2745static void mv_eh_freeze(struct ata_port *ap) 2798static void mv_eh_freeze(struct ata_port *ap)
2746{ 2799{
2747 struct mv_host_priv *hpriv = ap->host->private_data;
2748 unsigned int shift, hardport, port = ap->port_no;
2749 u32 main_irq_mask;
2750
2751 /* FIXME: handle coalescing completion events properly */
2752
2753 mv_stop_edma(ap); 2800 mv_stop_edma(ap);
2754 MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); 2801 mv_enable_port_irqs(ap, 0);
2755
2756 /* disable assertion of portN err, done events */
2757 main_irq_mask = readl(hpriv->main_irq_mask_addr);
2758 main_irq_mask &= ~((DONE_IRQ | ERR_IRQ) << shift);
2759 writelfl(main_irq_mask, hpriv->main_irq_mask_addr);
2760} 2802}
2761 2803
2762static void mv_eh_thaw(struct ata_port *ap) 2804static void mv_eh_thaw(struct ata_port *ap)
2763{ 2805{
2764 struct mv_host_priv *hpriv = ap->host->private_data; 2806 struct mv_host_priv *hpriv = ap->host->private_data;
2765 unsigned int shift, hardport, port = ap->port_no; 2807 unsigned int port = ap->port_no;
2808 unsigned int hardport = mv_hardport_from_port(port);
2766 void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); 2809 void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port);
2767 void __iomem *port_mmio = mv_ap_base(ap); 2810 void __iomem *port_mmio = mv_ap_base(ap);
2768 u32 main_irq_mask, hc_irq_cause; 2811 u32 hc_irq_cause;
2769
2770 /* FIXME: handle coalescing completion events properly */
2771
2772 MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport);
2773 2812
2774 /* clear EDMA errors on this port */ 2813 /* clear EDMA errors on this port */
2775 writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 2814 writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
@@ -2779,10 +2818,7 @@ static void mv_eh_thaw(struct ata_port *ap)
2779 hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport); 2818 hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport);
2780 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); 2819 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS);
2781 2820
2782 /* enable assertion of portN err, done events */ 2821 mv_enable_port_irqs(ap, ERR_IRQ);
2783 main_irq_mask = readl(hpriv->main_irq_mask_addr);
2784 main_irq_mask |= ((DONE_IRQ | ERR_IRQ) << shift);
2785 writelfl(main_irq_mask, hpriv->main_irq_mask_addr);
2786} 2822}
2787 2823
2788/** 2824/**
@@ -2840,7 +2876,7 @@ static unsigned int mv_in_pcix_mode(struct ata_host *host)
2840 void __iomem *mmio = hpriv->base; 2876 void __iomem *mmio = hpriv->base;
2841 u32 reg; 2877 u32 reg;
2842 2878
2843 if (!HAS_PCI(host) || !IS_PCIE(hpriv)) 2879 if (IS_SOC(hpriv) || !IS_PCIE(hpriv))
2844 return 0; /* not PCI-X capable */ 2880 return 0; /* not PCI-X capable */
2845 reg = readl(mmio + MV_PCI_MODE_OFS); 2881 reg = readl(mmio + MV_PCI_MODE_OFS);
2846 if ((reg & MV_PCI_MODE_MASK) == 0) 2882 if ((reg & MV_PCI_MODE_MASK) == 0)
@@ -2967,10 +3003,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2967 hp_flags |= MV_HP_CUT_THROUGH; 3003 hp_flags |= MV_HP_CUT_THROUGH;
2968 3004
2969 switch (pdev->revision) { 3005 switch (pdev->revision) {
2970 case 0x0: 3006 case 0x2: /* Rev.B0: the first/only public release */
2971 hp_flags |= MV_HP_ERRATA_XX42A0;
2972 break;
2973 case 0x1:
2974 hp_flags |= MV_HP_ERRATA_60X1C0; 3007 hp_flags |= MV_HP_ERRATA_60X1C0;
2975 break; 3008 break;
2976 default: 3009 default:
@@ -2982,7 +3015,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2982 break; 3015 break;
2983 case chip_soc: 3016 case chip_soc:
2984 hpriv->ops = &mv_soc_ops; 3017 hpriv->ops = &mv_soc_ops;
2985 hp_flags |= MV_HP_ERRATA_60X1C0; 3018 hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0;
2986 break; 3019 break;
2987 3020
2988 default: 3021 default:
@@ -3026,16 +3059,16 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3026 if (rc) 3059 if (rc)
3027 goto done; 3060 goto done;
3028 3061
3029 if (HAS_PCI(host)) { 3062 if (IS_SOC(hpriv)) {
3030 hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS;
3031 hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS;
3032 } else {
3033 hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; 3063 hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS;
3034 hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; 3064 hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS;
3065 } else {
3066 hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS;
3067 hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS;
3035 } 3068 }
3036 3069
3037 /* global interrupt mask: 0 == mask everything */ 3070 /* global interrupt mask: 0 == mask everything */
3038 writel(0, hpriv->main_irq_mask_addr); 3071 mv_set_main_irq_mask(host, ~0, 0);
3039 3072
3040 n_hc = mv_get_hc_count(host->ports[0]->flags); 3073 n_hc = mv_get_hc_count(host->ports[0]->flags);
3041 3074
@@ -3057,7 +3090,7 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3057 mv_port_init(&ap->ioaddr, port_mmio); 3090 mv_port_init(&ap->ioaddr, port_mmio);
3058 3091
3059#ifdef CONFIG_PCI 3092#ifdef CONFIG_PCI
3060 if (HAS_PCI(host)) { 3093 if (!IS_SOC(hpriv)) {
3061 unsigned int offset = port_mmio - mmio; 3094 unsigned int offset = port_mmio - mmio;
3062 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); 3095 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio");
3063 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); 3096 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port");
@@ -3077,31 +3110,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3077 writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); 3110 writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS);
3078 } 3111 }
3079 3112
3080 if (HAS_PCI(host)) { 3113 if (!IS_SOC(hpriv)) {
3081 /* Clear any currently outstanding host interrupt conditions */ 3114 /* Clear any currently outstanding host interrupt conditions */
3082 writelfl(0, mmio + hpriv->irq_cause_ofs); 3115 writelfl(0, mmio + hpriv->irq_cause_ofs);
3083 3116
3084 /* and unmask interrupt generation for host regs */ 3117 /* and unmask interrupt generation for host regs */
3085 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); 3118 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs);
3086 if (IS_GEN_I(hpriv)) 3119
3087 writelfl(~HC_MAIN_MASKED_IRQS_5, 3120 /*
3088 hpriv->main_irq_mask_addr); 3121 * enable only global host interrupts for now.
3089 else 3122 * The per-port interrupts get done later as ports are set up.
3090 writelfl(~HC_MAIN_MASKED_IRQS, 3123 */
3091 hpriv->main_irq_mask_addr); 3124 mv_set_main_irq_mask(host, 0, PCI_ERR);
3092
3093 VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x "
3094 "PCI int cause/mask=0x%08x/0x%08x\n",
3095 readl(hpriv->main_irq_cause_addr),
3096 readl(hpriv->main_irq_mask_addr),
3097 readl(mmio + hpriv->irq_cause_ofs),
3098 readl(mmio + hpriv->irq_mask_ofs));
3099 } else {
3100 writelfl(~HC_MAIN_MASKED_IRQS_SOC,
3101 hpriv->main_irq_mask_addr);
3102 VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n",
3103 readl(hpriv->main_irq_cause_addr),
3104 readl(hpriv->main_irq_mask_addr));
3105 } 3125 }
3106done: 3126done:
3107 return rc; 3127 return rc;
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 5a10dc5048ad..030665ba76b7 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -53,7 +53,15 @@ enum {
53 PDC_MMIO_BAR = 3, 53 PDC_MMIO_BAR = 3,
54 PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */ 54 PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */
55 55
56 /* register offsets */ 56 /* host register offsets (from host->iomap[PDC_MMIO_BAR]) */
57 PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */
58 PDC_FLASH_CTL = 0x44, /* Flash control register */
59 PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */
60 PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */
61 PDC_TBG_MODE = 0x41C, /* TBG mode (not SATAII) */
62 PDC_SLEW_CTL = 0x470, /* slew rate control reg (not SATAII) */
63
64 /* per-port ATA register offsets (from ap->ioaddr.cmd_addr) */
57 PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ 65 PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */
58 PDC_SECTOR_COUNT = 0x08, /* Sector count reg (per port) */ 66 PDC_SECTOR_COUNT = 0x08, /* Sector count reg (per port) */
59 PDC_SECTOR_NUMBER = 0x0C, /* Sector number reg (per port) */ 67 PDC_SECTOR_NUMBER = 0x0C, /* Sector number reg (per port) */
@@ -63,14 +71,11 @@ enum {
63 PDC_COMMAND = 0x1C, /* Command/status reg (per port) */ 71 PDC_COMMAND = 0x1C, /* Command/status reg (per port) */
64 PDC_ALTSTATUS = 0x38, /* Alternate-status/device-control reg (per port) */ 72 PDC_ALTSTATUS = 0x38, /* Alternate-status/device-control reg (per port) */
65 PDC_PKT_SUBMIT = 0x40, /* Command packet pointer addr */ 73 PDC_PKT_SUBMIT = 0x40, /* Command packet pointer addr */
66 PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */
67 PDC_FLASH_CTL = 0x44, /* Flash control register */
68 PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ 74 PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */
69 PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ 75 PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */
70 PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ 76
71 PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */ 77 /* per-port SATA register offsets (from ap->ioaddr.scr_addr) */
72 PDC_TBG_MODE = 0x41C, /* TBG mode (not SATAII) */ 78 PDC_PHYMODE4 = 0x14,
73 PDC_SLEW_CTL = 0x470, /* slew rate control reg (not SATAII) */
74 79
75 /* PDC_GLOBAL_CTL bit definitions */ 80 /* PDC_GLOBAL_CTL bit definitions */
76 PDC_PH_ERR = (1 << 8), /* PCI error while loading packet */ 81 PDC_PH_ERR = (1 << 8), /* PCI error while loading packet */
@@ -134,7 +139,7 @@ struct pdc_port_priv {
134 139
135static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 140static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
136static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 141static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
137static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 142static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
138static int pdc_common_port_start(struct ata_port *ap); 143static int pdc_common_port_start(struct ata_port *ap);
139static int pdc_sata_port_start(struct ata_port *ap); 144static int pdc_sata_port_start(struct ata_port *ap);
140static void pdc_qc_prep(struct ata_queued_cmd *qc); 145static void pdc_qc_prep(struct ata_queued_cmd *qc);
@@ -332,12 +337,12 @@ static int pdc_sata_port_start(struct ata_port *ap)
332 337
333 /* fix up PHYMODE4 align timing */ 338 /* fix up PHYMODE4 align timing */
334 if (ap->flags & PDC_FLAG_GEN_II) { 339 if (ap->flags & PDC_FLAG_GEN_II) {
335 void __iomem *mmio = ap->ioaddr.scr_addr; 340 void __iomem *sata_mmio = ap->ioaddr.scr_addr;
336 unsigned int tmp; 341 unsigned int tmp;
337 342
338 tmp = readl(mmio + 0x014); 343 tmp = readl(sata_mmio + PDC_PHYMODE4);
339 tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */ 344 tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */
340 writel(tmp, mmio + 0x014); 345 writel(tmp, sata_mmio + PDC_PHYMODE4);
341 } 346 }
342 347
343 return 0; 348 return 0;
@@ -345,32 +350,32 @@ static int pdc_sata_port_start(struct ata_port *ap)
345 350
346static void pdc_reset_port(struct ata_port *ap) 351static void pdc_reset_port(struct ata_port *ap)
347{ 352{
348 void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; 353 void __iomem *ata_ctlstat_mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT;
349 unsigned int i; 354 unsigned int i;
350 u32 tmp; 355 u32 tmp;
351 356
352 for (i = 11; i > 0; i--) { 357 for (i = 11; i > 0; i--) {
353 tmp = readl(mmio); 358 tmp = readl(ata_ctlstat_mmio);
354 if (tmp & PDC_RESET) 359 if (tmp & PDC_RESET)
355 break; 360 break;
356 361
357 udelay(100); 362 udelay(100);
358 363
359 tmp |= PDC_RESET; 364 tmp |= PDC_RESET;
360 writel(tmp, mmio); 365 writel(tmp, ata_ctlstat_mmio);
361 } 366 }
362 367
363 tmp &= ~PDC_RESET; 368 tmp &= ~PDC_RESET;
364 writel(tmp, mmio); 369 writel(tmp, ata_ctlstat_mmio);
365 readl(mmio); /* flush */ 370 readl(ata_ctlstat_mmio); /* flush */
366} 371}
367 372
368static int pdc_pata_cable_detect(struct ata_port *ap) 373static int pdc_pata_cable_detect(struct ata_port *ap)
369{ 374{
370 u8 tmp; 375 u8 tmp;
371 void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; 376 void __iomem *ata_mmio = ap->ioaddr.cmd_addr;
372 377
373 tmp = readb(mmio); 378 tmp = readb(ata_mmio + PDC_CTLSTAT + 3);
374 if (tmp & 0x01) 379 if (tmp & 0x01)
375 return ATA_CBL_PATA40; 380 return ATA_CBL_PATA40;
376 return ATA_CBL_PATA80; 381 return ATA_CBL_PATA80;
@@ -557,31 +562,25 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
557 switch (qc->tf.protocol) { 562 switch (qc->tf.protocol) {
558 case ATA_PROT_DMA: 563 case ATA_PROT_DMA:
559 pdc_fill_sg(qc); 564 pdc_fill_sg(qc);
560 /* fall through */ 565 /*FALLTHROUGH*/
561
562 case ATA_PROT_NODATA: 566 case ATA_PROT_NODATA:
563 i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma, 567 i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma,
564 qc->dev->devno, pp->pkt); 568 qc->dev->devno, pp->pkt);
565
566 if (qc->tf.flags & ATA_TFLAG_LBA48) 569 if (qc->tf.flags & ATA_TFLAG_LBA48)
567 i = pdc_prep_lba48(&qc->tf, pp->pkt, i); 570 i = pdc_prep_lba48(&qc->tf, pp->pkt, i);
568 else 571 else
569 i = pdc_prep_lba28(&qc->tf, pp->pkt, i); 572 i = pdc_prep_lba28(&qc->tf, pp->pkt, i);
570
571 pdc_pkt_footer(&qc->tf, pp->pkt, i); 573 pdc_pkt_footer(&qc->tf, pp->pkt, i);
572 break; 574 break;
573
574 case ATAPI_PROT_PIO: 575 case ATAPI_PROT_PIO:
575 pdc_fill_sg(qc); 576 pdc_fill_sg(qc);
576 break; 577 break;
577
578 case ATAPI_PROT_DMA: 578 case ATAPI_PROT_DMA:
579 pdc_fill_sg(qc); 579 pdc_fill_sg(qc);
580 /*FALLTHROUGH*/ 580 /*FALLTHROUGH*/
581 case ATAPI_PROT_NODATA: 581 case ATAPI_PROT_NODATA:
582 pdc_atapi_pkt(qc); 582 pdc_atapi_pkt(qc);
583 break; 583 break;
584
585 default: 584 default:
586 break; 585 break;
587 } 586 }
@@ -611,7 +610,7 @@ static unsigned int pdc_sata_ata_port_to_ata_no(const struct ata_port *ap)
611 unsigned int nr_ports = pdc_sata_nr_ports(ap); 610 unsigned int nr_ports = pdc_sata_nr_ports(ap);
612 unsigned int i; 611 unsigned int i;
613 612
614 for(i = 0; i < nr_ports && host->ports[i] != ap; ++i) 613 for (i = 0; i < nr_ports && host->ports[i] != ap; ++i)
615 ; 614 ;
616 BUG_ON(i >= nr_ports); 615 BUG_ON(i >= nr_ports);
617 return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); 616 return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags));
@@ -624,14 +623,14 @@ static unsigned int pdc_sata_hotplug_offset(const struct ata_port *ap)
624 623
625static void pdc_freeze(struct ata_port *ap) 624static void pdc_freeze(struct ata_port *ap)
626{ 625{
627 void __iomem *mmio = ap->ioaddr.cmd_addr; 626 void __iomem *ata_mmio = ap->ioaddr.cmd_addr;
628 u32 tmp; 627 u32 tmp;
629 628
630 tmp = readl(mmio + PDC_CTLSTAT); 629 tmp = readl(ata_mmio + PDC_CTLSTAT);
631 tmp |= PDC_IRQ_DISABLE; 630 tmp |= PDC_IRQ_DISABLE;
632 tmp &= ~PDC_DMA_ENABLE; 631 tmp &= ~PDC_DMA_ENABLE;
633 writel(tmp, mmio + PDC_CTLSTAT); 632 writel(tmp, ata_mmio + PDC_CTLSTAT);
634 readl(mmio + PDC_CTLSTAT); /* flush */ 633 readl(ata_mmio + PDC_CTLSTAT); /* flush */
635} 634}
636 635
637static void pdc_sata_freeze(struct ata_port *ap) 636static void pdc_sata_freeze(struct ata_port *ap)
@@ -659,17 +658,17 @@ static void pdc_sata_freeze(struct ata_port *ap)
659 658
660static void pdc_thaw(struct ata_port *ap) 659static void pdc_thaw(struct ata_port *ap)
661{ 660{
662 void __iomem *mmio = ap->ioaddr.cmd_addr; 661 void __iomem *ata_mmio = ap->ioaddr.cmd_addr;
663 u32 tmp; 662 u32 tmp;
664 663
665 /* clear IRQ */ 664 /* clear IRQ */
666 readl(mmio + PDC_INT_SEQMASK); 665 readl(ata_mmio + PDC_COMMAND);
667 666
668 /* turn IRQ back on */ 667 /* turn IRQ back on */
669 tmp = readl(mmio + PDC_CTLSTAT); 668 tmp = readl(ata_mmio + PDC_CTLSTAT);
670 tmp &= ~PDC_IRQ_DISABLE; 669 tmp &= ~PDC_IRQ_DISABLE;
671 writel(tmp, mmio + PDC_CTLSTAT); 670 writel(tmp, ata_mmio + PDC_CTLSTAT);
672 readl(mmio + PDC_CTLSTAT); /* flush */ 671 readl(ata_mmio + PDC_CTLSTAT); /* flush */
673} 672}
674 673
675static void pdc_sata_thaw(struct ata_port *ap) 674static void pdc_sata_thaw(struct ata_port *ap)
@@ -743,11 +742,11 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
743 ata_port_abort(ap); 742 ata_port_abort(ap);
744} 743}
745 744
746static inline unsigned int pdc_host_intr(struct ata_port *ap, 745static unsigned int pdc_host_intr(struct ata_port *ap,
747 struct ata_queued_cmd *qc) 746 struct ata_queued_cmd *qc)
748{ 747{
749 unsigned int handled = 0; 748 unsigned int handled = 0;
750 void __iomem *port_mmio = ap->ioaddr.cmd_addr; 749 void __iomem *ata_mmio = ap->ioaddr.cmd_addr;
751 u32 port_status, err_mask; 750 u32 port_status, err_mask;
752 751
753 err_mask = PDC_ERR_MASK; 752 err_mask = PDC_ERR_MASK;
@@ -755,7 +754,7 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap,
755 err_mask &= ~PDC1_ERR_MASK; 754 err_mask &= ~PDC1_ERR_MASK;
756 else 755 else
757 err_mask &= ~PDC2_ERR_MASK; 756 err_mask &= ~PDC2_ERR_MASK;
758 port_status = readl(port_mmio + PDC_GLOBAL_CTL); 757 port_status = readl(ata_mmio + PDC_GLOBAL_CTL);
759 if (unlikely(port_status & err_mask)) { 758 if (unlikely(port_status & err_mask)) {
760 pdc_error_intr(ap, qc, port_status, err_mask); 759 pdc_error_intr(ap, qc, port_status, err_mask);
761 return 1; 760 return 1;
@@ -770,7 +769,6 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap,
770 ata_qc_complete(qc); 769 ata_qc_complete(qc);
771 handled = 1; 770 handled = 1;
772 break; 771 break;
773
774 default: 772 default:
775 ap->stats.idle_irq++; 773 ap->stats.idle_irq++;
776 break; 774 break;
@@ -781,10 +779,9 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap,
781 779
782static void pdc_irq_clear(struct ata_port *ap) 780static void pdc_irq_clear(struct ata_port *ap)
783{ 781{
784 struct ata_host *host = ap->host; 782 void __iomem *ata_mmio = ap->ioaddr.cmd_addr;
785 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
786 783
787 readl(mmio + PDC_INT_SEQMASK); 784 readl(ata_mmio + PDC_COMMAND);
788} 785}
789 786
790static irqreturn_t pdc_interrupt(int irq, void *dev_instance) 787static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
@@ -794,7 +791,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
794 u32 mask = 0; 791 u32 mask = 0;
795 unsigned int i, tmp; 792 unsigned int i, tmp;
796 unsigned int handled = 0; 793 unsigned int handled = 0;
797 void __iomem *mmio_base; 794 void __iomem *host_mmio;
798 unsigned int hotplug_offset, ata_no; 795 unsigned int hotplug_offset, ata_no;
799 u32 hotplug_status; 796 u32 hotplug_status;
800 int is_sataii_tx4; 797 int is_sataii_tx4;
@@ -806,7 +803,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
806 return IRQ_NONE; 803 return IRQ_NONE;
807 } 804 }
808 805
809 mmio_base = host->iomap[PDC_MMIO_BAR]; 806 host_mmio = host->iomap[PDC_MMIO_BAR];
810 807
811 spin_lock(&host->lock); 808 spin_lock(&host->lock);
812 809
@@ -815,26 +812,26 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
815 hotplug_offset = PDC2_SATA_PLUG_CSR; 812 hotplug_offset = PDC2_SATA_PLUG_CSR;
816 else 813 else
817 hotplug_offset = PDC_SATA_PLUG_CSR; 814 hotplug_offset = PDC_SATA_PLUG_CSR;
818 hotplug_status = readl(mmio_base + hotplug_offset); 815 hotplug_status = readl(host_mmio + hotplug_offset);
819 if (hotplug_status & 0xff) 816 if (hotplug_status & 0xff)
820 writel(hotplug_status | 0xff, mmio_base + hotplug_offset); 817 writel(hotplug_status | 0xff, host_mmio + hotplug_offset);
821 hotplug_status &= 0xff; /* clear uninteresting bits */ 818 hotplug_status &= 0xff; /* clear uninteresting bits */
822 819
823 /* reading should also clear interrupts */ 820 /* reading should also clear interrupts */
824 mask = readl(mmio_base + PDC_INT_SEQMASK); 821 mask = readl(host_mmio + PDC_INT_SEQMASK);
825 822
826 if (mask == 0xffffffff && hotplug_status == 0) { 823 if (mask == 0xffffffff && hotplug_status == 0) {
827 VPRINTK("QUICK EXIT 2\n"); 824 VPRINTK("QUICK EXIT 2\n");
828 goto done_irq; 825 goto done_irq;
829 } 826 }
830 827
831 mask &= 0xffff; /* only 16 tags possible */ 828 mask &= 0xffff; /* only 16 SEQIDs possible */
832 if (mask == 0 && hotplug_status == 0) { 829 if (mask == 0 && hotplug_status == 0) {
833 VPRINTK("QUICK EXIT 3\n"); 830 VPRINTK("QUICK EXIT 3\n");
834 goto done_irq; 831 goto done_irq;
835 } 832 }
836 833
837 writel(mask, mmio_base + PDC_INT_SEQMASK); 834 writel(mask, host_mmio + PDC_INT_SEQMASK);
838 835
839 is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags); 836 is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags);
840 837
@@ -875,23 +872,24 @@ done_irq:
875 return IRQ_RETVAL(handled); 872 return IRQ_RETVAL(handled);
876} 873}
877 874
878static inline void pdc_packet_start(struct ata_queued_cmd *qc) 875static void pdc_packet_start(struct ata_queued_cmd *qc)
879{ 876{
880 struct ata_port *ap = qc->ap; 877 struct ata_port *ap = qc->ap;
881 struct pdc_port_priv *pp = ap->private_data; 878 struct pdc_port_priv *pp = ap->private_data;
882 void __iomem *mmio = ap->host->iomap[PDC_MMIO_BAR]; 879 void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR];
880 void __iomem *ata_mmio = ap->ioaddr.cmd_addr;
883 unsigned int port_no = ap->port_no; 881 unsigned int port_no = ap->port_no;
884 u8 seq = (u8) (port_no + 1); 882 u8 seq = (u8) (port_no + 1);
885 883
886 VPRINTK("ENTER, ap %p\n", ap); 884 VPRINTK("ENTER, ap %p\n", ap);
887 885
888 writel(0x00000001, mmio + (seq * 4)); 886 writel(0x00000001, host_mmio + (seq * 4));
889 readl(mmio + (seq * 4)); /* flush */ 887 readl(host_mmio + (seq * 4)); /* flush */
890 888
891 pp->pkt[2] = seq; 889 pp->pkt[2] = seq;
892 wmb(); /* flush PRD, pkt writes */ 890 wmb(); /* flush PRD, pkt writes */
893 writel(pp->pkt_dma, ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); 891 writel(pp->pkt_dma, ata_mmio + PDC_PKT_SUBMIT);
894 readl(ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ 892 readl(ata_mmio + PDC_PKT_SUBMIT); /* flush */
895} 893}
896 894
897static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) 895static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc)
@@ -909,11 +907,9 @@ static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc)
909 case ATA_PROT_DMA: 907 case ATA_PROT_DMA:
910 pdc_packet_start(qc); 908 pdc_packet_start(qc);
911 return 0; 909 return 0;
912
913 default: 910 default:
914 break; 911 break;
915 } 912 }
916
917 return ata_sff_qc_issue(qc); 913 return ata_sff_qc_issue(qc);
918} 914}
919 915
@@ -987,7 +983,7 @@ static void pdc_ata_setup_port(struct ata_port *ap,
987 983
988static void pdc_host_init(struct ata_host *host) 984static void pdc_host_init(struct ata_host *host)
989{ 985{
990 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; 986 void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR];
991 int is_gen2 = host->ports[0]->flags & PDC_FLAG_GEN_II; 987 int is_gen2 = host->ports[0]->flags & PDC_FLAG_GEN_II;
992 int hotplug_offset; 988 int hotplug_offset;
993 u32 tmp; 989 u32 tmp;
@@ -1004,38 +1000,38 @@ static void pdc_host_init(struct ata_host *host)
1004 */ 1000 */
1005 1001
1006 /* enable BMR_BURST, maybe change FIFO_SHD to 8 dwords */ 1002 /* enable BMR_BURST, maybe change FIFO_SHD to 8 dwords */
1007 tmp = readl(mmio + PDC_FLASH_CTL); 1003 tmp = readl(host_mmio + PDC_FLASH_CTL);
1008 tmp |= 0x02000; /* bit 13 (enable bmr burst) */ 1004 tmp |= 0x02000; /* bit 13 (enable bmr burst) */
1009 if (!is_gen2) 1005 if (!is_gen2)
1010 tmp |= 0x10000; /* bit 16 (fifo threshold at 8 dw) */ 1006 tmp |= 0x10000; /* bit 16 (fifo threshold at 8 dw) */
1011 writel(tmp, mmio + PDC_FLASH_CTL); 1007 writel(tmp, host_mmio + PDC_FLASH_CTL);
1012 1008
1013 /* clear plug/unplug flags for all ports */ 1009 /* clear plug/unplug flags for all ports */
1014 tmp = readl(mmio + hotplug_offset); 1010 tmp = readl(host_mmio + hotplug_offset);
1015 writel(tmp | 0xff, mmio + hotplug_offset); 1011 writel(tmp | 0xff, host_mmio + hotplug_offset);
1016 1012
1017 /* unmask plug/unplug ints */ 1013 /* unmask plug/unplug ints */
1018 tmp = readl(mmio + hotplug_offset); 1014 tmp = readl(host_mmio + hotplug_offset);
1019 writel(tmp & ~0xff0000, mmio + hotplug_offset); 1015 writel(tmp & ~0xff0000, host_mmio + hotplug_offset);
1020 1016
1021 /* don't initialise TBG or SLEW on 2nd generation chips */ 1017 /* don't initialise TBG or SLEW on 2nd generation chips */
1022 if (is_gen2) 1018 if (is_gen2)
1023 return; 1019 return;
1024 1020
1025 /* reduce TBG clock to 133 Mhz. */ 1021 /* reduce TBG clock to 133 Mhz. */
1026 tmp = readl(mmio + PDC_TBG_MODE); 1022 tmp = readl(host_mmio + PDC_TBG_MODE);
1027 tmp &= ~0x30000; /* clear bit 17, 16*/ 1023 tmp &= ~0x30000; /* clear bit 17, 16*/
1028 tmp |= 0x10000; /* set bit 17:16 = 0:1 */ 1024 tmp |= 0x10000; /* set bit 17:16 = 0:1 */
1029 writel(tmp, mmio + PDC_TBG_MODE); 1025 writel(tmp, host_mmio + PDC_TBG_MODE);
1030 1026
1031 readl(mmio + PDC_TBG_MODE); /* flush */ 1027 readl(host_mmio + PDC_TBG_MODE); /* flush */
1032 msleep(10); 1028 msleep(10);
1033 1029
1034 /* adjust slew rate control register. */ 1030 /* adjust slew rate control register. */
1035 tmp = readl(mmio + PDC_SLEW_CTL); 1031 tmp = readl(host_mmio + PDC_SLEW_CTL);
1036 tmp &= 0xFFFFF03F; /* clear bit 11 ~ 6 */ 1032 tmp &= 0xFFFFF03F; /* clear bit 11 ~ 6 */
1037 tmp |= 0x00000900; /* set bit 11-9 = 100b , bit 8-6 = 100 */ 1033 tmp |= 0x00000900; /* set bit 11-9 = 100b , bit 8-6 = 100 */
1038 writel(tmp, mmio + PDC_SLEW_CTL); 1034 writel(tmp, host_mmio + PDC_SLEW_CTL);
1039} 1035}
1040 1036
1041static int pdc_ata_init_one(struct pci_dev *pdev, 1037static int pdc_ata_init_one(struct pci_dev *pdev,
@@ -1045,7 +1041,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
1045 const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; 1041 const struct ata_port_info *pi = &pdc_port_info[ent->driver_data];
1046 const struct ata_port_info *ppi[PDC_MAX_PORTS]; 1042 const struct ata_port_info *ppi[PDC_MAX_PORTS];
1047 struct ata_host *host; 1043 struct ata_host *host;
1048 void __iomem *base; 1044 void __iomem *host_mmio;
1049 int n_ports, i, rc; 1045 int n_ports, i, rc;
1050 int is_sataii_tx4; 1046 int is_sataii_tx4;
1051 1047
@@ -1062,7 +1058,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
1062 pcim_pin_device(pdev); 1058 pcim_pin_device(pdev);
1063 if (rc) 1059 if (rc)
1064 return rc; 1060 return rc;
1065 base = pcim_iomap_table(pdev)[PDC_MMIO_BAR]; 1061 host_mmio = pcim_iomap_table(pdev)[PDC_MMIO_BAR];
1066 1062
1067 /* determine port configuration and setup host */ 1063 /* determine port configuration and setup host */
1068 n_ports = 2; 1064 n_ports = 2;
@@ -1072,7 +1068,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
1072 ppi[i] = pi; 1068 ppi[i] = pi;
1073 1069
1074 if (pi->flags & PDC_FLAG_SATA_PATA) { 1070 if (pi->flags & PDC_FLAG_SATA_PATA) {
1075 u8 tmp = readb(base + PDC_FLASH_CTL+1); 1071 u8 tmp = readb(host_mmio + PDC_FLASH_CTL + 1);
1076 if (!(tmp & 0x80)) 1072 if (!(tmp & 0x80))
1077 ppi[n_ports++] = pi + 1; 1073 ppi[n_ports++] = pi + 1;
1078 } 1074 }
@@ -1088,13 +1084,13 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
1088 for (i = 0; i < host->n_ports; i++) { 1084 for (i = 0; i < host->n_ports; i++) {
1089 struct ata_port *ap = host->ports[i]; 1085 struct ata_port *ap = host->ports[i];
1090 unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); 1086 unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4);
1091 unsigned int port_offset = 0x200 + ata_no * 0x80; 1087 unsigned int ata_offset = 0x200 + ata_no * 0x80;
1092 unsigned int scr_offset = 0x400 + ata_no * 0x100; 1088 unsigned int scr_offset = 0x400 + ata_no * 0x100;
1093 1089
1094 pdc_ata_setup_port(ap, base + port_offset, base + scr_offset); 1090 pdc_ata_setup_port(ap, host_mmio + ata_offset, host_mmio + scr_offset);
1095 1091
1096 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); 1092 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio");
1097 ata_port_pbar_desc(ap, PDC_MMIO_BAR, port_offset, "port"); 1093 ata_port_pbar_desc(ap, PDC_MMIO_BAR, ata_offset, "ata");
1098 } 1094 }
1099 1095
1100 /* initialize adapter */ 1096 /* initialize adapter */
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 27a110110077..8ee6b5b4ede7 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -899,14 +899,25 @@ static bool sil24_qc_fill_rtf(struct ata_queued_cmd *qc)
899 899
900static void sil24_pmp_attach(struct ata_port *ap) 900static void sil24_pmp_attach(struct ata_port *ap)
901{ 901{
902 u32 *gscr = ap->link.device->gscr;
903
902 sil24_config_pmp(ap, 1); 904 sil24_config_pmp(ap, 1);
903 sil24_init_port(ap); 905 sil24_init_port(ap);
906
907 if (sata_pmp_gscr_vendor(gscr) == 0x11ab &&
908 sata_pmp_gscr_devid(gscr) == 0x4140) {
909 ata_port_printk(ap, KERN_INFO,
910 "disabling NCQ support due to sil24-mv4140 quirk\n");
911 ap->flags &= ~ATA_FLAG_NCQ;
912 }
904} 913}
905 914
906static void sil24_pmp_detach(struct ata_port *ap) 915static void sil24_pmp_detach(struct ata_port *ap)
907{ 916{
908 sil24_init_port(ap); 917 sil24_init_port(ap);
909 sil24_config_pmp(ap, 0); 918 sil24_config_pmp(ap, 0);
919
920 ap->flags |= ATA_FLAG_NCQ;
910} 921}
911 922
912static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class, 923static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class,
diff --git a/drivers/atm/eni.h b/drivers/atm/eni.h
index d04fefb0841f..e4c9525e60b3 100644
--- a/drivers/atm/eni.h
+++ b/drivers/atm/eni.h
@@ -18,7 +18,6 @@
18#include "midway.h" 18#include "midway.h"
19 19
20 20
21#define KERNEL_OFFSET 0xC0000000 /* kernel 0x0 is at phys 0xC0000000 */
22#define DEV_LABEL "eni" 21#define DEV_LABEL "eni"
23 22
24#define UBR_BUFFER (128*1024) /* UBR buffer size */ 23#define UBR_BUFFER (128*1024) /* UBR buffer size */
diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h
index 183841cc8fdf..8dd4aa76c3bd 100644
--- a/drivers/atm/fore200e.h
+++ b/drivers/atm/fore200e.h
@@ -1,4 +1,3 @@
1/* $Id: fore200e.h,v 1.4 2000/04/14 10:10:34 davem Exp $ */
2#ifndef _FORE200E_H 1#ifndef _FORE200E_H
3#define _FORE200E_H 2#define _FORE200E_H
4 3
diff --git a/drivers/atm/fore200e_mkfirm.c b/drivers/atm/fore200e_mkfirm.c
index 2ebe1a1e6f8b..520e14b488ff 100644
--- a/drivers/atm/fore200e_mkfirm.c
+++ b/drivers/atm/fore200e_mkfirm.c
@@ -1,6 +1,4 @@
1/* 1/*
2 $Id: fore200e_mkfirm.c,v 1.1 2000/02/21 16:04:32 davem Exp $
3
4 mkfirm.c: generates a C readable file from a binary firmware image 2 mkfirm.c: generates a C readable file from a binary firmware image
5 3
6 Christophe Lizzi (lizzi@{csti.fr, cnam.fr}), June 1999. 4 Christophe Lizzi (lizzi@{csti.fr, cnam.fr}), June 1999.
diff --git a/drivers/atm/he.h b/drivers/atm/he.h
index 1dc277547a73..fe6cd15a78a4 100644
--- a/drivers/atm/he.h
+++ b/drivers/atm/he.h
@@ -1,5 +1,3 @@
1/* $Id: he.h,v 1.4 2003/05/06 22:48:00 chas Exp $ */
2
3/* 1/*
4 2
5 he.h 3 he.h
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 28d77b5195de..3a504e94a4d9 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -1,8 +1,4 @@
1/******************************************************************* 1/*******************************************************************
2 * ident "$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $"
3 *
4 * $Author: ecd $
5 * $Date: 2001/11/11 08:13:54 $
6 * 2 *
7 * Copyright (c) 2000 ATecoM GmbH 3 * Copyright (c) 2000 ATecoM GmbH
8 * 4 *
@@ -29,9 +25,6 @@
29 * 675 Mass Ave, Cambridge, MA 02139, USA. 25 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 * 26 *
31 *******************************************************************/ 27 *******************************************************************/
32static char const rcsid[] =
33"$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $";
34
35 28
36#include <linux/module.h> 29#include <linux/module.h>
37#include <linux/pci.h> 30#include <linux/pci.h>
diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h
index 6f2b4a5875fb..e83eaf120da0 100644
--- a/drivers/atm/idt77252.h
+++ b/drivers/atm/idt77252.h
@@ -1,8 +1,4 @@
1/******************************************************************* 1/*******************************************************************
2 * ident "$Id: idt77252.h,v 1.2 2001/11/11 08:13:54 ecd Exp $"
3 *
4 * $Author: ecd $
5 * $Date: 2001/11/11 08:13:54 $
6 * 2 *
7 * Copyright (c) 2000 ATecoM GmbH 3 * Copyright (c) 2000 ATecoM GmbH
8 * 4 *
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h
index 133eefcc0475..b2cd20f549cb 100644
--- a/drivers/atm/iphase.h
+++ b/drivers/atm/iphase.h
@@ -1025,7 +1025,8 @@ typedef struct iadev_t {
1025 spinlock_t rx_lock, misc_lock; 1025 spinlock_t rx_lock, misc_lock;
1026 struct atm_vcc **rx_open; /* list of all open VCs */ 1026 struct atm_vcc **rx_open; /* list of all open VCs */
1027 u16 num_rx_desc, rx_buf_sz, rxing; 1027 u16 num_rx_desc, rx_buf_sz, rxing;
1028 u32 rx_pkt_ram, rx_tmp_cnt, rx_tmp_jif; 1028 u32 rx_pkt_ram, rx_tmp_cnt;
1029 unsigned long rx_tmp_jif;
1029 void __iomem *RX_DESC_BASE_ADDR; 1030 void __iomem *RX_DESC_BASE_ADDR;
1030 u32 drop_rxpkt, drop_rxcell, rx_cell_cnt, rx_pkt_cnt; 1031 u32 drop_rxpkt, drop_rxcell, rx_cell_cnt, rx_pkt_cnt;
1031 struct atm_dev *next_board; /* other iphase devices */ 1032 struct atm_dev *next_board; /* other iphase devices */
diff --git a/drivers/atm/nicstarmac.copyright b/drivers/atm/nicstarmac.copyright
index 2e15b39fac4f..180531a83c62 100644
--- a/drivers/atm/nicstarmac.copyright
+++ b/drivers/atm/nicstarmac.copyright
@@ -13,7 +13,7 @@
13 * 13 *
14 * Modified to work with the IDT7721 nicstar -- AAL5 (tested) only. 14 * Modified to work with the IDT7721 nicstar -- AAL5 (tested) only.
15 * 15 *
16 * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997 $Revision: 1.1 $ $Date: 1999/08/20 11:00:11 $ 16 * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997
17 * 17 *
18 * Linux driver for the IDT77201 NICStAR PCI ATM controller. 18 * Linux driver for the IDT77201 NICStAR PCI ATM controller.
19 * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155; 19 * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155;
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 0ef00e8d4153..e085af0ff94f 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -140,7 +140,6 @@ int class_register(struct class *cls)
140 140
141 pr_debug("device class '%s': registering\n", cls->name); 141 pr_debug("device class '%s': registering\n", cls->name);
142 142
143 INIT_LIST_HEAD(&cls->children);
144 INIT_LIST_HEAD(&cls->devices); 143 INIT_LIST_HEAD(&cls->devices);
145 INIT_LIST_HEAD(&cls->interfaces); 144 INIT_LIST_HEAD(&cls->interfaces);
146 kset_init(&cls->class_dirs); 145 kset_init(&cls->class_dirs);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index be288b5e4180..ee0a51a3a41d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -760,6 +760,22 @@ static void device_remove_class_symlinks(struct device *dev)
760} 760}
761 761
762/** 762/**
763 * dev_set_name - set a device name
764 * @dev: device
765 * @fmt: format string for the device's name
766 */
767int dev_set_name(struct device *dev, const char *fmt, ...)
768{
769 va_list vargs;
770
771 va_start(vargs, fmt);
772 vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs);
773 va_end(vargs);
774 return 0;
775}
776EXPORT_SYMBOL_GPL(dev_set_name);
777
778/**
763 * device_add - add device to device hierarchy. 779 * device_add - add device to device hierarchy.
764 * @dev: device. 780 * @dev: device.
765 * 781 *
@@ -1084,11 +1100,13 @@ static void device_create_release(struct device *dev)
1084} 1100}
1085 1101
1086/** 1102/**
1087 * device_create - creates a device and registers it with sysfs 1103 * device_create_vargs - creates a device and registers it with sysfs
1088 * @class: pointer to the struct class that this device should be registered to 1104 * @class: pointer to the struct class that this device should be registered to
1089 * @parent: pointer to the parent struct device of this new device, if any 1105 * @parent: pointer to the parent struct device of this new device, if any
1090 * @devt: the dev_t for the char device to be added 1106 * @devt: the dev_t for the char device to be added
1107 * @drvdata: the data to be added to the device for callbacks
1091 * @fmt: string for the device's name 1108 * @fmt: string for the device's name
1109 * @args: va_list for the device's name
1092 * 1110 *
1093 * This function can be used by char device classes. A struct device 1111 * This function can be used by char device classes. A struct device
1094 * will be created in sysfs, registered to the specified class. 1112 * will be created in sysfs, registered to the specified class.
@@ -1104,10 +1122,10 @@ static void device_create_release(struct device *dev)
1104 * Note: the struct class passed to this function must have previously 1122 * Note: the struct class passed to this function must have previously
1105 * been created with a call to class_create(). 1123 * been created with a call to class_create().
1106 */ 1124 */
1107struct device *device_create(struct class *class, struct device *parent, 1125struct device *device_create_vargs(struct class *class, struct device *parent,
1108 dev_t devt, const char *fmt, ...) 1126 dev_t devt, void *drvdata, const char *fmt,
1127 va_list args)
1109{ 1128{
1110 va_list args;
1111 struct device *dev = NULL; 1129 struct device *dev = NULL;
1112 int retval = -ENODEV; 1130 int retval = -ENODEV;
1113 1131
@@ -1124,10 +1142,9 @@ struct device *device_create(struct class *class, struct device *parent,
1124 dev->class = class; 1142 dev->class = class;
1125 dev->parent = parent; 1143 dev->parent = parent;
1126 dev->release = device_create_release; 1144 dev->release = device_create_release;
1145 dev_set_drvdata(dev, drvdata);
1127 1146
1128 va_start(args, fmt);
1129 vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); 1147 vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args);
1130 va_end(args);
1131 retval = device_register(dev); 1148 retval = device_register(dev);
1132 if (retval) 1149 if (retval)
1133 goto error; 1150 goto error;
@@ -1138,6 +1155,78 @@ error:
1138 kfree(dev); 1155 kfree(dev);
1139 return ERR_PTR(retval); 1156 return ERR_PTR(retval);
1140} 1157}
1158EXPORT_SYMBOL_GPL(device_create_vargs);
1159
1160/**
1161 * device_create_drvdata - creates a device and registers it with sysfs
1162 * @class: pointer to the struct class that this device should be registered to
1163 * @parent: pointer to the parent struct device of this new device, if any
1164 * @devt: the dev_t for the char device to be added
1165 * @drvdata: the data to be added to the device for callbacks
1166 * @fmt: string for the device's name
1167 *
1168 * This function can be used by char device classes. A struct device
1169 * will be created in sysfs, registered to the specified class.
1170 *
1171 * A "dev" file will be created, showing the dev_t for the device, if
1172 * the dev_t is not 0,0.
1173 * If a pointer to a parent struct device is passed in, the newly created
1174 * struct device will be a child of that device in sysfs.
1175 * The pointer to the struct device will be returned from the call.
1176 * Any further sysfs files that might be required can be created using this
1177 * pointer.
1178 *
1179 * Note: the struct class passed to this function must have previously
1180 * been created with a call to class_create().
1181 */
1182struct device *device_create_drvdata(struct class *class,
1183 struct device *parent,
1184 dev_t devt,
1185 void *drvdata,
1186 const char *fmt, ...)
1187{
1188 va_list vargs;
1189 struct device *dev;
1190
1191 va_start(vargs, fmt);
1192 dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs);
1193 va_end(vargs);
1194 return dev;
1195}
1196EXPORT_SYMBOL_GPL(device_create_drvdata);
1197
1198/**
1199 * device_create - creates a device and registers it with sysfs
1200 * @class: pointer to the struct class that this device should be registered to
1201 * @parent: pointer to the parent struct device of this new device, if any
1202 * @devt: the dev_t for the char device to be added
1203 * @fmt: string for the device's name
1204 *
1205 * This function can be used by char device classes. A struct device
1206 * will be created in sysfs, registered to the specified class.
1207 *
1208 * A "dev" file will be created, showing the dev_t for the device, if
1209 * the dev_t is not 0,0.
1210 * If a pointer to a parent struct device is passed in, the newly created
1211 * struct device will be a child of that device in sysfs.
1212 * The pointer to the struct device will be returned from the call.
1213 * Any further sysfs files that might be required can be created using this
1214 * pointer.
1215 *
1216 * Note: the struct class passed to this function must have previously
1217 * been created with a call to class_create().
1218 */
1219struct device *device_create(struct class *class, struct device *parent,
1220 dev_t devt, const char *fmt, ...)
1221{
1222 va_list vargs;
1223 struct device *dev;
1224
1225 va_start(vargs, fmt);
1226 dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs);
1227 va_end(vargs);
1228 return dev;
1229}
1141EXPORT_SYMBOL_GPL(device_create); 1230EXPORT_SYMBOL_GPL(device_create);
1142 1231
1143static int __match_devt(struct device *dev, void *data) 1232static int __match_devt(struct device *dev, void *data)
@@ -1218,13 +1307,11 @@ int device_rename(struct device *dev, char *new_name)
1218 } 1307 }
1219#else 1308#else
1220 if (dev->class) { 1309 if (dev->class) {
1221 sysfs_remove_link(&dev->class->subsys.kobj, old_device_name);
1222 error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, 1310 error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
1223 dev->bus_id); 1311 dev->bus_id);
1224 if (error) { 1312 if (error)
1225 dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", 1313 goto out;
1226 __func__, error); 1314 sysfs_remove_link(&dev->class->subsys.kobj, old_device_name);
1227 }
1228 } 1315 }
1229#endif 1316#endif
1230 1317
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 8ce6de5a7e28..937e8258981d 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -53,11 +53,13 @@ int register_memory_notifier(struct notifier_block *nb)
53{ 53{
54 return blocking_notifier_chain_register(&memory_chain, nb); 54 return blocking_notifier_chain_register(&memory_chain, nb);
55} 55}
56EXPORT_SYMBOL(register_memory_notifier);
56 57
57void unregister_memory_notifier(struct notifier_block *nb) 58void unregister_memory_notifier(struct notifier_block *nb)
58{ 59{
59 blocking_notifier_chain_unregister(&memory_chain, nb); 60 blocking_notifier_chain_unregister(&memory_chain, nb);
60} 61}
62EXPORT_SYMBOL(unregister_memory_notifier);
61 63
62/* 64/*
63 * register_memory - Setup a sysfs device for a memory block 65 * register_memory - Setup a sysfs device for a memory block
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 7b76fd3b93a4..45cc3d9eacb8 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -418,7 +418,7 @@ void __suspend_report_result(const char *function, void *fn, int ret)
418{ 418{
419 if (ret) { 419 if (ret) {
420 printk(KERN_ERR "%s(): ", function); 420 printk(KERN_ERR "%s(): ", function);
421 print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn); 421 print_fn_descriptor_symbol("%s returns ", fn);
422 printk("%d\n", ret); 422 printk("%d\n", ret);
423 } 423 }
424} 424}
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index c9751b2b57e6..7516baff3bb9 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1714,10 +1714,10 @@ static int __init amiga_floppy_init(void)
1714 int i, ret; 1714 int i, ret;
1715 1715
1716 if (!MACH_IS_AMIGA) 1716 if (!MACH_IS_AMIGA)
1717 return -ENXIO; 1717 return -ENODEV;
1718 1718
1719 if (!AMIGAHW_PRESENT(AMI_FLOPPY)) 1719 if (!AMIGAHW_PRESENT(AMI_FLOPPY))
1720 return -ENXIO; 1720 return -ENODEV;
1721 1721
1722 if (register_blkdev(FLOPPY_MAJOR,"fd")) 1722 if (register_blkdev(FLOPPY_MAJOR,"fd"))
1723 return -EBUSY; 1723 return -EBUSY;
@@ -1755,7 +1755,7 @@ static int __init amiga_floppy_init(void)
1755 if (!floppy_queue) 1755 if (!floppy_queue)
1756 goto out_queue; 1756 goto out_queue;
1757 1757
1758 ret = -ENXIO; 1758 ret = -ENODEV;
1759 if (fd_probe_drives() < 1) /* No usable drives */ 1759 if (fd_probe_drives() < 1) /* No usable drives */
1760 goto out_probe; 1760 goto out_probe;
1761 1761
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index a196ef7f147f..24b97b0bef99 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -397,6 +397,7 @@ module_param(max_part, int, 0);
397MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk"); 397MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk");
398MODULE_LICENSE("GPL"); 398MODULE_LICENSE("GPL");
399MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR); 399MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR);
400MODULE_ALIAS("rd");
400 401
401#ifndef MODULE 402#ifndef MODULE
402/* Legacy boot options - nonmodular */ 403/* Legacy boot options - nonmodular */
@@ -447,6 +448,7 @@ static struct brd_device *brd_alloc(int i)
447 disk->fops = &brd_fops; 448 disk->fops = &brd_fops;
448 disk->private_data = brd; 449 disk->private_data = brd;
449 disk->queue = brd->brd_queue; 450 disk->queue = brd->brd_queue;
451 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
450 sprintf(disk->disk_name, "ram%d", i); 452 sprintf(disk->disk_name, "ram%d", i);
451 set_capacity(disk, rd_size * 2); 453 set_capacity(disk, rd_size * 2);
452 454
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index e336b05fe4a7..5f1e1cc6165a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -53,15 +53,16 @@
53#include <linux/scatterlist.h> 53#include <linux/scatterlist.h>
54 54
55#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) 55#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
56#define DRIVER_NAME "HP CISS Driver (v 3.6.14)" 56#define DRIVER_NAME "HP CISS Driver (v 3.6.20)"
57#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,14) 57#define DRIVER_VERSION CCISS_DRIVER_VERSION(3, 6, 20)
58 58
59/* Embedded module documentation macros - see modules.h */ 59/* Embedded module documentation macros - see modules.h */
60MODULE_AUTHOR("Hewlett-Packard Company"); 60MODULE_AUTHOR("Hewlett-Packard Company");
61MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.14"); 61MODULE_DESCRIPTION("Driver for HP Smart Array Controllers");
62MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" 62MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
63 " SA6i P600 P800 P400 P400i E200 E200i E500"); 63 " SA6i P600 P800 P400 P400i E200 E200i E500 P700m"
64MODULE_VERSION("3.6.14"); 64 " Smart Array G2 Series SAS/SATA Controllers");
65MODULE_VERSION("3.6.20");
65MODULE_LICENSE("GPL"); 66MODULE_LICENSE("GPL");
66 67
67#include "cciss_cmd.h" 68#include "cciss_cmd.h"
@@ -90,6 +91,11 @@ static const struct pci_device_id cciss_pci_device_id[] = {
90 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, 91 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215},
91 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237}, 92 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237},
92 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x323D}, 93 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x323D},
94 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3241},
95 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3243},
96 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245},
97 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247},
98 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
93 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 99 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
94 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, 100 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
95 {0,} 101 {0,}
@@ -123,6 +129,11 @@ static struct board_type products[] = {
123 {0x3215103C, "Smart Array E200i", &SA5_access, 120}, 129 {0x3215103C, "Smart Array E200i", &SA5_access, 120},
124 {0x3237103C, "Smart Array E500", &SA5_access, 512}, 130 {0x3237103C, "Smart Array E500", &SA5_access, 512},
125 {0x323D103C, "Smart Array P700m", &SA5_access, 512}, 131 {0x323D103C, "Smart Array P700m", &SA5_access, 512},
132 {0x3241103C, "Smart Array P212", &SA5_access, 384},
133 {0x3243103C, "Smart Array P410", &SA5_access, 384},
134 {0x3245103C, "Smart Array P410i", &SA5_access, 384},
135 {0x3247103C, "Smart Array P411", &SA5_access, 384},
136 {0x3249103C, "Smart Array P812", &SA5_access, 384},
126 {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120}, 137 {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120},
127}; 138};
128 139
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index ebfe038d859e..f1c8feb5510b 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -3,7 +3,7 @@
3 * Authors: Dave Boutcher <boutcher@us.ibm.com> 3 * Authors: Dave Boutcher <boutcher@us.ibm.com>
4 * Ryan Arnold <ryanarn@us.ibm.com> 4 * Ryan Arnold <ryanarn@us.ibm.com>
5 * Colin Devilbiss <devilbis@us.ibm.com> 5 * Colin Devilbiss <devilbis@us.ibm.com>
6 * Stephen Rothwell <sfr@au1.ibm.com> 6 * Stephen Rothwell
7 * 7 *
8 * (C) Copyright 2000-2004 IBM Corporation 8 * (C) Copyright 2000-2004 IBM Corporation
9 * 9 *
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 84e064ffee52..dd7ea203f940 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -260,6 +260,10 @@ static int virtblk_probe(struct virtio_device *vdev)
260 if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) 260 if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
261 blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); 261 blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);
262 262
263 /* If disk is read-only in the host, the guest should obey */
264 if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
265 set_disk_ro(vblk->disk, 1);
266
263 /* Host must always specify the capacity. */ 267 /* Host must always specify the capacity. */
264 vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity), 268 vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity),
265 &cap, sizeof(cap)); 269 &cap, sizeof(cap));
@@ -311,6 +315,7 @@ static void virtblk_remove(struct virtio_device *vdev)
311 /* Stop all the virtqueues. */ 315 /* Stop all the virtqueues. */
312 vdev->config->reset(vdev); 316 vdev->config->reset(vdev);
313 317
318 del_gendisk(vblk->disk);
314 blk_cleanup_queue(vblk->disk->queue); 319 blk_cleanup_queue(vblk->disk->queue);
315 put_disk(vblk->disk); 320 put_disk(vblk->disk);
316 mempool_destroy(vblk->pool); 321 mempool_destroy(vblk->pool);
@@ -325,7 +330,7 @@ static struct virtio_device_id id_table[] = {
325 330
326static unsigned int features[] = { 331static unsigned int features[] = {
327 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, 332 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
328 VIRTIO_BLK_F_GEOMETRY, 333 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO,
329}; 334};
330 335
331static struct virtio_driver virtio_blk = { 336static struct virtio_driver virtio_blk = {
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 2d5853cbd4b0..be20a67f1fa8 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -332,7 +332,7 @@ z2_init(void)
332 int ret; 332 int ret;
333 333
334 if (!MACH_IS_AMIGA) 334 if (!MACH_IS_AMIGA)
335 return -ENXIO; 335 return -ENODEV;
336 336
337 ret = -EBUSY; 337 ret = -EBUSY;
338 if (register_blkdev(Z2RAM_MAJOR, DEVICE_NAME)) 338 if (register_blkdev(Z2RAM_MAJOR, DEVICE_NAME))
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 5245a4a0ba74..9d0dfe6e0d63 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -6,7 +6,7 @@
6 * Authors: Dave Boutcher <boutcher@us.ibm.com> 6 * Authors: Dave Boutcher <boutcher@us.ibm.com>
7 * Ryan Arnold <ryanarn@us.ibm.com> 7 * Ryan Arnold <ryanarn@us.ibm.com>
8 * Colin Devilbiss <devilbis@us.ibm.com> 8 * Colin Devilbiss <devilbis@us.ibm.com>
9 * Stephen Rothwell <sfr@au1.ibm.com> 9 * Stephen Rothwell
10 * 10 *
11 * (C) Copyright 2000-2004 IBM Corporation 11 * (C) Copyright 2000-2004 IBM Corporation
12 * 12 *
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 5dce3877eee5..2d854bb9373e 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -118,8 +118,8 @@ config COMPUTONE
118 order to become a dial-in server. If you have a card like that, say 118 order to become a dial-in server. If you have a card like that, say
119 Y here and read <file:Documentation/computone.txt>. 119 Y here and read <file:Documentation/computone.txt>.
120 120
121 To compile this driver as modules, choose M here: the 121 To compile this driver as module, choose M here: the
122 modules will be called ip2 and ip2main. 122 module will be called ip2.
123 123
124config ROCKETPORT 124config ROCKETPORT
125 tristate "Comtrol RocketPort support" 125 tristate "Comtrol RocketPort support"
@@ -196,6 +196,7 @@ config ESPSERIAL
196config MOXA_INTELLIO 196config MOXA_INTELLIO
197 tristate "Moxa Intellio support" 197 tristate "Moxa Intellio support"
198 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) 198 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
199 select FW_LOADER
199 help 200 help
200 Say Y here if you have a Moxa Intellio multiport serial card. 201 Say Y here if you have a Moxa Intellio multiport serial card.
201 202
@@ -748,7 +749,7 @@ config NVRAM
748if RTC_LIB=n 749if RTC_LIB=n
749 750
750config RTC 751config RTC
751 tristate "Enhanced Real Time Clock Support" 752 tristate "Enhanced Real Time Clock Support (legacy PC RTC driver)"
752 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \ 753 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \
753 && !ARM && !SUPERH && !S390 && !AVR32 754 && !ARM && !SUPERH && !S390 && !AVR32
754 ---help--- 755 ---help---
@@ -1035,9 +1036,9 @@ config HPET
1035 non-periodic and/or periodic. 1036 non-periodic and/or periodic.
1036 1037
1037config HPET_RTC_IRQ 1038config HPET_RTC_IRQ
1038 bool "HPET Control RTC IRQ" if !HPET_EMULATE_RTC 1039 bool
1039 default n 1040 default HPET_EMULATE_RTC
1040 depends on HPET 1041 depends on RTC && HPET
1041 help 1042 help
1042 If you say Y here, you will disable RTC_IRQ in drivers/char/rtc.c. It 1043 If you say Y here, you will disable RTC_IRQ in drivers/char/rtc.c. It
1043 is assumed the platform called hpet_alloc with the RTC IRQ values for 1044 is assumed the platform called hpet_alloc with the RTC IRQ values for
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 55c97f623242..07b4d8ff56e5 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -458,6 +458,10 @@ static struct agp_device_ids ati_agp_device_ids[] __devinitdata =
458 .chipset_name = "IGP9100/M", 458 .chipset_name = "IGP9100/M",
459 }, 459 },
460 { 460 {
461 .device_id = PCI_DEVICE_ID_ATI_RS350_133,
462 .chipset_name = "IGP9000/M",
463 },
464 {
461 .device_id = PCI_DEVICE_ID_ATI_RS350_200, 465 .device_id = PCI_DEVICE_ID_ATI_RS350_200,
462 .chipset_name = "IGP9100/M", 466 .chipset_name = "IGP9100/M",
463 }, 467 },
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 6874f31ca8ca..3a05c6d5ebe1 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -471,7 +471,6 @@ struct drm_irq_busid {
471enum drm_vblank_seq_type { 471enum drm_vblank_seq_type {
472 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 472 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
473 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 473 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
474 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
475 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 474 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
476 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 475 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
477 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ 476 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */
@@ -504,21 +503,6 @@ union drm_wait_vblank {
504 struct drm_wait_vblank_reply reply; 503 struct drm_wait_vblank_reply reply;
505}; 504};
506 505
507enum drm_modeset_ctl_cmd {
508 _DRM_PRE_MODESET = 1,
509 _DRM_POST_MODESET = 2,
510};
511
512/**
513 * DRM_IOCTL_MODESET_CTL ioctl argument type
514 *
515 * \sa drmModesetCtl().
516 */
517struct drm_modeset_ctl {
518 unsigned long arg;
519 enum drm_modeset_ctl_cmd cmd;
520};
521
522/** 506/**
523 * DRM_IOCTL_AGP_ENABLE ioctl argument type. 507 * DRM_IOCTL_AGP_ENABLE ioctl argument type.
524 * 508 *
@@ -603,7 +587,6 @@ struct drm_set_version {
603#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 587#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)
604#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 588#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)
605#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 589#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)
606#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)
607 590
608#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 591#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
609#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 592#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 213b3ca3468e..0764b662b339 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -100,8 +100,10 @@ struct drm_device;
100#define DRIVER_HAVE_DMA 0x20 100#define DRIVER_HAVE_DMA 0x20
101#define DRIVER_HAVE_IRQ 0x40 101#define DRIVER_HAVE_IRQ 0x40
102#define DRIVER_IRQ_SHARED 0x80 102#define DRIVER_IRQ_SHARED 0x80
103#define DRIVER_IRQ_VBL 0x100
103#define DRIVER_DMA_QUEUE 0x200 104#define DRIVER_DMA_QUEUE 0x200
104#define DRIVER_FB_DMA 0x400 105#define DRIVER_FB_DMA 0x400
106#define DRIVER_IRQ_VBL2 0x800
105 107
106/***********************************************************************/ 108/***********************************************************************/
107/** \name Begin the DRM... */ 109/** \name Begin the DRM... */
@@ -577,52 +579,10 @@ struct drm_driver {
577 int (*context_dtor) (struct drm_device *dev, int context); 579 int (*context_dtor) (struct drm_device *dev, int context);
578 int (*kernel_context_switch) (struct drm_device *dev, int old, 580 int (*kernel_context_switch) (struct drm_device *dev, int old,
579 int new); 581 int new);
580 void (*kernel_context_switch_unlock) (struct drm_device * dev); 582 void (*kernel_context_switch_unlock) (struct drm_device *dev);
581 /** 583 int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence);
582 * get_vblank_counter - get raw hardware vblank counter 584 int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence);
583 * @dev: DRM device 585 int (*dri_library_name) (struct drm_device *dev, char *buf);
584 * @crtc: counter to fetch
585 *
586 * Driver callback for fetching a raw hardware vblank counter
587 * for @crtc. If a device doesn't have a hardware counter, the
588 * driver can simply return the value of drm_vblank_count and
589 * make the enable_vblank() and disable_vblank() hooks into no-ops,
590 * leaving interrupts enabled at all times.
591 *
592 * Wraparound handling and loss of events due to modesetting is dealt
593 * with in the DRM core code.
594 *
595 * RETURNS
596 * Raw vblank counter value.
597 */
598 u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);
599
600 /**
601 * enable_vblank - enable vblank interrupt events
602 * @dev: DRM device
603 * @crtc: which irq to enable
604 *
605 * Enable vblank interrupts for @crtc. If the device doesn't have
606 * a hardware vblank counter, this routine should be a no-op, since
607 * interrupts will have to stay on to keep the count accurate.
608 *
609 * RETURNS
610 * Zero on success, appropriate errno if the given @crtc's vblank
611 * interrupt cannot be enabled.
612 */
613 int (*enable_vblank) (struct drm_device *dev, int crtc);
614
615 /**
616 * disable_vblank - disable vblank interrupt events
617 * @dev: DRM device
618 * @crtc: which irq to enable
619 *
620 * Disable vblank interrupts for @crtc. If the device doesn't have
621 * a hardware vblank counter, this routine should be a no-op, since
622 * interrupts will have to stay on to keep the count accurate.
623 */
624 void (*disable_vblank) (struct drm_device *dev, int crtc);
625 int (*dri_library_name) (struct drm_device *dev, char * buf);
626 586
627 /** 587 /**
628 * Called by \c drm_device_is_agp. Typically used to determine if a 588 * Called by \c drm_device_is_agp. Typically used to determine if a
@@ -641,7 +601,7 @@ struct drm_driver {
641 601
642 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 602 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
643 void (*irq_preinstall) (struct drm_device *dev); 603 void (*irq_preinstall) (struct drm_device *dev);
644 int (*irq_postinstall) (struct drm_device *dev); 604 void (*irq_postinstall) (struct drm_device *dev);
645 void (*irq_uninstall) (struct drm_device *dev); 605 void (*irq_uninstall) (struct drm_device *dev);
646 void (*reclaim_buffers) (struct drm_device *dev, 606 void (*reclaim_buffers) (struct drm_device *dev,
647 struct drm_file * file_priv); 607 struct drm_file * file_priv);
@@ -770,21 +730,13 @@ struct drm_device {
770 /** \name VBLANK IRQ support */ 730 /** \name VBLANK IRQ support */
771 /*@{ */ 731 /*@{ */
772 732
773 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ 733 wait_queue_head_t vbl_queue; /**< VBLANK wait queue */
774 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ 734 atomic_t vbl_received;
735 atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */
775 spinlock_t vbl_lock; 736 spinlock_t vbl_lock;
776 struct list_head *vbl_sigs; /**< signal list to send on VBLANK */ 737 struct list_head vbl_sigs; /**< signal list to send on VBLANK */
777 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/ 738 struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */
778 atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */ 739 unsigned int vbl_pending;
779 u32 *last_vblank; /* protected by dev->vbl_lock, used */
780 /* for wraparound handling */
781 u32 *vblank_offset; /* used to track how many vblanks */
782 int *vblank_enabled; /* so we don't call enable more than
783 once per disable */
784 u32 *vblank_premodeset; /* were lost during modeset */
785 struct timer_list vblank_disable_timer;
786
787 unsigned long max_vblank_count; /**< size of vblank counter register */
788 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ 740 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */
789 void (*locked_tasklet_func)(struct drm_device *dev); 741 void (*locked_tasklet_func)(struct drm_device *dev);
790 742
@@ -804,7 +756,6 @@ struct drm_device {
804#ifdef __alpha__ 756#ifdef __alpha__
805 struct pci_controller *hose; 757 struct pci_controller *hose;
806#endif 758#endif
807 int num_crtcs; /**< Number of CRTCs on this device */
808 struct drm_sg_mem *sg; /**< Scatter gather memory */ 759 struct drm_sg_mem *sg; /**< Scatter gather memory */
809 void *dev_private; /**< device private data */ 760 void *dev_private; /**< device private data */
810 struct drm_sigdata sigdata; /**< For block_all_signals */ 761 struct drm_sigdata sigdata; /**< For block_all_signals */
@@ -1039,19 +990,11 @@ extern void drm_driver_irq_preinstall(struct drm_device *dev);
1039extern void drm_driver_irq_postinstall(struct drm_device *dev); 990extern void drm_driver_irq_postinstall(struct drm_device *dev);
1040extern void drm_driver_irq_uninstall(struct drm_device *dev); 991extern void drm_driver_irq_uninstall(struct drm_device *dev);
1041 992
1042extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); 993extern int drm_wait_vblank(struct drm_device *dev, void *data,
1043extern int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *filp);
1044extern int drm_vblank_wait(struct drm_device * dev, unsigned int *vbl_seq);
1045extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
1046extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1047extern void drm_update_vblank_count(struct drm_device *dev, int crtc);
1048extern void drm_handle_vblank(struct drm_device *dev, int crtc);
1049extern int drm_vblank_get(struct drm_device *dev, int crtc);
1050extern void drm_vblank_put(struct drm_device *dev, int crtc);
1051
1052 /* Modesetting support */
1053extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1054 struct drm_file *file_priv); 994 struct drm_file *file_priv);
995extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
996extern void drm_vbl_send_signals(struct drm_device *dev);
997extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
1055 998
1056 /* AGP/GART support (drm_agpsupport.h) */ 999 /* AGP/GART support (drm_agpsupport.h) */
1057extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); 1000extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index 68f0da801ed8..d2e6da85f58a 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -323,7 +323,6 @@ int drm_release(struct inode *inode, struct file *filp)
323 struct drm_file *file_priv = filp->private_data; 323 struct drm_file *file_priv = filp->private_data;
324 struct drm_device *dev = file_priv->minor->dev; 324 struct drm_device *dev = file_priv->minor->dev;
325 int retcode = 0; 325 int retcode = 0;
326 unsigned long irqflags;
327 326
328 lock_kernel(); 327 lock_kernel();
329 328
@@ -355,11 +354,9 @@ int drm_release(struct inode *inode, struct file *filp)
355 */ 354 */
356 355
357 do{ 356 do{
358 spin_lock_irqsave(&dev->lock.spinlock, 357 spin_lock_bh(&dev->lock.spinlock);
359 irqflags);
360 locked = dev->lock.idle_has_lock; 358 locked = dev->lock.idle_has_lock;
361 spin_unlock_irqrestore(&dev->lock.spinlock, 359 spin_unlock_bh(&dev->lock.spinlock);
362 irqflags);
363 if (locked) 360 if (locked)
364 break; 361 break;
365 schedule(); 362 schedule();
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index 286f9d61e7d5..089c015c01d1 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -71,117 +71,6 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
71 return 0; 71 return 0;
72} 72}
73 73
74static void vblank_disable_fn(unsigned long arg)
75{
76 struct drm_device *dev = (struct drm_device *)arg;
77 unsigned long irqflags;
78 int i;
79
80 for (i = 0; i < dev->num_crtcs; i++) {
81 spin_lock_irqsave(&dev->vbl_lock, irqflags);
82 if (atomic_read(&dev->vblank_refcount[i]) == 0 &&
83 dev->vblank_enabled[i]) {
84 dev->driver->disable_vblank(dev, i);
85 dev->vblank_enabled[i] = 0;
86 }
87 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
88 }
89}
90
91static void drm_vblank_cleanup(struct drm_device *dev)
92{
93 /* Bail if the driver didn't call drm_vblank_init() */
94 if (dev->num_crtcs == 0)
95 return;
96
97 del_timer(&dev->vblank_disable_timer);
98
99 vblank_disable_fn((unsigned long)dev);
100
101 drm_free(dev->vbl_queue, sizeof(*dev->vbl_queue) * dev->num_crtcs,
102 DRM_MEM_DRIVER);
103 drm_free(dev->vbl_sigs, sizeof(*dev->vbl_sigs) * dev->num_crtcs,
104 DRM_MEM_DRIVER);
105 drm_free(dev->_vblank_count, sizeof(*dev->_vblank_count) *
106 dev->num_crtcs, DRM_MEM_DRIVER);
107 drm_free(dev->vblank_refcount, sizeof(*dev->vblank_refcount) *
108 dev->num_crtcs, DRM_MEM_DRIVER);
109 drm_free(dev->vblank_enabled, sizeof(*dev->vblank_enabled) *
110 dev->num_crtcs, DRM_MEM_DRIVER);
111 drm_free(dev->last_vblank, sizeof(*dev->last_vblank) * dev->num_crtcs,
112 DRM_MEM_DRIVER);
113 drm_free(dev->vblank_premodeset, sizeof(*dev->vblank_premodeset) *
114 dev->num_crtcs, DRM_MEM_DRIVER);
115 drm_free(dev->vblank_offset, sizeof(*dev->vblank_offset) * dev->num_crtcs,
116 DRM_MEM_DRIVER);
117
118 dev->num_crtcs = 0;
119}
120
121int drm_vblank_init(struct drm_device *dev, int num_crtcs)
122{
123 int i, ret = -ENOMEM;
124
125 setup_timer(&dev->vblank_disable_timer, vblank_disable_fn,
126 (unsigned long)dev);
127 spin_lock_init(&dev->vbl_lock);
128 atomic_set(&dev->vbl_signal_pending, 0);
129 dev->num_crtcs = num_crtcs;
130
131 dev->vbl_queue = drm_alloc(sizeof(wait_queue_head_t) * num_crtcs,
132 DRM_MEM_DRIVER);
133 if (!dev->vbl_queue)
134 goto err;
135
136 dev->vbl_sigs = drm_alloc(sizeof(struct list_head) * num_crtcs,
137 DRM_MEM_DRIVER);
138 if (!dev->vbl_sigs)
139 goto err;
140
141 dev->_vblank_count = drm_alloc(sizeof(atomic_t) * num_crtcs,
142 DRM_MEM_DRIVER);
143 if (!dev->_vblank_count)
144 goto err;
145
146 dev->vblank_refcount = drm_alloc(sizeof(atomic_t) * num_crtcs,
147 DRM_MEM_DRIVER);
148 if (!dev->vblank_refcount)
149 goto err;
150
151 dev->vblank_enabled = drm_calloc(num_crtcs, sizeof(int),
152 DRM_MEM_DRIVER);
153 if (!dev->vblank_enabled)
154 goto err;
155
156 dev->last_vblank = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
157 if (!dev->last_vblank)
158 goto err;
159
160 dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32),
161 DRM_MEM_DRIVER);
162 if (!dev->vblank_premodeset)
163 goto err;
164
165 dev->vblank_offset = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
166 if (!dev->vblank_offset)
167 goto err;
168
169 /* Zero per-crtc vblank stuff */
170 for (i = 0; i < num_crtcs; i++) {
171 init_waitqueue_head(&dev->vbl_queue[i]);
172 INIT_LIST_HEAD(&dev->vbl_sigs[i]);
173 atomic_set(&dev->_vblank_count[i], 0);
174 atomic_set(&dev->vblank_refcount[i], 0);
175 }
176
177 return 0;
178
179err:
180 drm_vblank_cleanup(dev);
181 return ret;
182}
183EXPORT_SYMBOL(drm_vblank_init);
184
185/** 74/**
186 * Install IRQ handler. 75 * Install IRQ handler.
187 * 76 *
@@ -220,6 +109,17 @@ static int drm_irq_install(struct drm_device * dev)
220 109
221 DRM_DEBUG("irq=%d\n", dev->irq); 110 DRM_DEBUG("irq=%d\n", dev->irq);
222 111
112 if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) {
113 init_waitqueue_head(&dev->vbl_queue);
114
115 spin_lock_init(&dev->vbl_lock);
116
117 INIT_LIST_HEAD(&dev->vbl_sigs);
118 INIT_LIST_HEAD(&dev->vbl_sigs2);
119
120 dev->vbl_pending = 0;
121 }
122
223 /* Before installing handler */ 123 /* Before installing handler */
224 dev->driver->irq_preinstall(dev); 124 dev->driver->irq_preinstall(dev);
225 125
@@ -237,14 +137,9 @@ static int drm_irq_install(struct drm_device * dev)
237 } 137 }
238 138
239 /* After installing handler */ 139 /* After installing handler */
240 ret = dev->driver->irq_postinstall(dev); 140 dev->driver->irq_postinstall(dev);
241 if (ret < 0) {
242 mutex_lock(&dev->struct_mutex);
243 dev->irq_enabled = 0;
244 mutex_unlock(&dev->struct_mutex);
245 }
246 141
247 return ret; 142 return 0;
248} 143}
249 144
250/** 145/**
@@ -275,8 +170,6 @@ int drm_irq_uninstall(struct drm_device * dev)
275 170
276 free_irq(dev->irq, dev); 171 free_irq(dev->irq, dev);
277 172
278 drm_vblank_cleanup(dev);
279
280 dev->locked_tasklet_func = NULL; 173 dev->locked_tasklet_func = NULL;
281 174
282 return 0; 175 return 0;
@@ -321,148 +214,6 @@ int drm_control(struct drm_device *dev, void *data,
321} 214}
322 215
323/** 216/**
324 * drm_vblank_count - retrieve "cooked" vblank counter value
325 * @dev: DRM device
326 * @crtc: which counter to retrieve
327 *
328 * Fetches the "cooked" vblank count value that represents the number of
329 * vblank events since the system was booted, including lost events due to
330 * modesetting activity.
331 */
332u32 drm_vblank_count(struct drm_device *dev, int crtc)
333{
334 return atomic_read(&dev->_vblank_count[crtc]) +
335 dev->vblank_offset[crtc];
336}
337EXPORT_SYMBOL(drm_vblank_count);
338
339/**
340 * drm_update_vblank_count - update the master vblank counter
341 * @dev: DRM device
342 * @crtc: counter to update
343 *
344 * Call back into the driver to update the appropriate vblank counter
345 * (specified by @crtc). Deal with wraparound, if it occurred, and
346 * update the last read value so we can deal with wraparound on the next
347 * call if necessary.
348 */
349void drm_update_vblank_count(struct drm_device *dev, int crtc)
350{
351 unsigned long irqflags;
352 u32 cur_vblank, diff;
353
354 /*
355 * Interrupts were disabled prior to this call, so deal with counter
356 * wrap if needed.
357 * NOTE! It's possible we lost a full dev->max_vblank_count events
358 * here if the register is small or we had vblank interrupts off for
359 * a long time.
360 */
361 cur_vblank = dev->driver->get_vblank_counter(dev, crtc);
362 spin_lock_irqsave(&dev->vbl_lock, irqflags);
363 if (cur_vblank < dev->last_vblank[crtc]) {
364 diff = dev->max_vblank_count -
365 dev->last_vblank[crtc];
366 diff += cur_vblank;
367 } else {
368 diff = cur_vblank - dev->last_vblank[crtc];
369 }
370 dev->last_vblank[crtc] = cur_vblank;
371 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
372
373 atomic_add(diff, &dev->_vblank_count[crtc]);
374}
375EXPORT_SYMBOL(drm_update_vblank_count);
376
377/**
378 * drm_vblank_get - get a reference count on vblank events
379 * @dev: DRM device
380 * @crtc: which CRTC to own
381 *
382 * Acquire a reference count on vblank events to avoid having them disabled
383 * while in use. Note callers will probably want to update the master counter
384 * using drm_update_vblank_count() above before calling this routine so that
385 * wakeups occur on the right vblank event.
386 *
387 * RETURNS
388 * Zero on success, nonzero on failure.
389 */
390int drm_vblank_get(struct drm_device *dev, int crtc)
391{
392 unsigned long irqflags;
393 int ret = 0;
394
395 spin_lock_irqsave(&dev->vbl_lock, irqflags);
396 /* Going from 0->1 means we have to enable interrupts again */
397 if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1 &&
398 !dev->vblank_enabled[crtc]) {
399 ret = dev->driver->enable_vblank(dev, crtc);
400 if (ret)
401 atomic_dec(&dev->vblank_refcount[crtc]);
402 else
403 dev->vblank_enabled[crtc] = 1;
404 }
405 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
406
407 return ret;
408}
409EXPORT_SYMBOL(drm_vblank_get);
410
411/**
412 * drm_vblank_put - give up ownership of vblank events
413 * @dev: DRM device
414 * @crtc: which counter to give up
415 *
416 * Release ownership of a given vblank counter, turning off interrupts
417 * if possible.
418 */
419void drm_vblank_put(struct drm_device *dev, int crtc)
420{
421 /* Last user schedules interrupt disable */
422 if (atomic_dec_and_test(&dev->vblank_refcount[crtc]))
423 mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ);
424}
425EXPORT_SYMBOL(drm_vblank_put);
426
427/**
428 * drm_modeset_ctl - handle vblank event counter changes across mode switch
429 * @DRM_IOCTL_ARGS: standard ioctl arguments
430 *
431 * Applications should call the %_DRM_PRE_MODESET and %_DRM_POST_MODESET
432 * ioctls around modesetting so that any lost vblank events are accounted for.
433 */
434int drm_modeset_ctl(struct drm_device *dev, void *data,
435 struct drm_file *file_priv)
436{
437 struct drm_modeset_ctl *modeset = data;
438 int crtc, ret = 0;
439 u32 new;
440
441 crtc = modeset->arg;
442 if (crtc >= dev->num_crtcs) {
443 ret = -EINVAL;
444 goto out;
445 }
446
447 switch (modeset->cmd) {
448 case _DRM_PRE_MODESET:
449 dev->vblank_premodeset[crtc] =
450 dev->driver->get_vblank_counter(dev, crtc);
451 break;
452 case _DRM_POST_MODESET:
453 new = dev->driver->get_vblank_counter(dev, crtc);
454 dev->vblank_offset[crtc] = dev->vblank_premodeset[crtc] - new;
455 break;
456 default:
457 ret = -EINVAL;
458 break;
459 }
460
461out:
462 return ret;
463}
464
465/**
466 * Wait for VBLANK. 217 * Wait for VBLANK.
467 * 218 *
468 * \param inode device inode. 219 * \param inode device inode.
@@ -481,13 +232,12 @@ out:
481 * 232 *
482 * If a signal is not requested, then calls vblank_wait(). 233 * If a signal is not requested, then calls vblank_wait().
483 */ 234 */
484int drm_wait_vblank(struct drm_device *dev, void *data, 235int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv)
485 struct drm_file *file_priv)
486{ 236{
487 union drm_wait_vblank *vblwait = data; 237 union drm_wait_vblank *vblwait = data;
488 struct timeval now; 238 struct timeval now;
489 int ret = 0; 239 int ret = 0;
490 unsigned int flags, seq, crtc; 240 unsigned int flags, seq;
491 241
492 if ((!dev->irq) || (!dev->irq_enabled)) 242 if ((!dev->irq) || (!dev->irq_enabled))
493 return -EINVAL; 243 return -EINVAL;
@@ -501,13 +251,13 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
501 } 251 }
502 252
503 flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; 253 flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
504 crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0;
505 254
506 if (crtc >= dev->num_crtcs) 255 if (!drm_core_check_feature(dev, (flags & _DRM_VBLANK_SECONDARY) ?
256 DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL))
507 return -EINVAL; 257 return -EINVAL;
508 258
509 drm_update_vblank_count(dev, crtc); 259 seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2
510 seq = drm_vblank_count(dev, crtc); 260 : &dev->vbl_received);
511 261
512 switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { 262 switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
513 case _DRM_VBLANK_RELATIVE: 263 case _DRM_VBLANK_RELATIVE:
@@ -526,7 +276,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
526 276
527 if (flags & _DRM_VBLANK_SIGNAL) { 277 if (flags & _DRM_VBLANK_SIGNAL) {
528 unsigned long irqflags; 278 unsigned long irqflags;
529 struct list_head *vbl_sigs = &dev->vbl_sigs[crtc]; 279 struct list_head *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY)
280 ? &dev->vbl_sigs2 : &dev->vbl_sigs;
530 struct drm_vbl_sig *vbl_sig; 281 struct drm_vbl_sig *vbl_sig;
531 282
532 spin_lock_irqsave(&dev->vbl_lock, irqflags); 283 spin_lock_irqsave(&dev->vbl_lock, irqflags);
@@ -547,26 +298,22 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
547 } 298 }
548 } 299 }
549 300
550 if (atomic_read(&dev->vbl_signal_pending) >= 100) { 301 if (dev->vbl_pending >= 100) {
551 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 302 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
552 return -EBUSY; 303 return -EBUSY;
553 } 304 }
554 305
306 dev->vbl_pending++;
307
555 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 308 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
556 309
557 vbl_sig = drm_calloc(1, sizeof(struct drm_vbl_sig), 310 if (!
558 DRM_MEM_DRIVER); 311 (vbl_sig =
559 if (!vbl_sig) 312 drm_alloc(sizeof(struct drm_vbl_sig), DRM_MEM_DRIVER))) {
560 return -ENOMEM; 313 return -ENOMEM;
561
562 ret = drm_vblank_get(dev, crtc);
563 if (ret) {
564 drm_free(vbl_sig, sizeof(struct drm_vbl_sig),
565 DRM_MEM_DRIVER);
566 return ret;
567 } 314 }
568 315
569 atomic_inc(&dev->vbl_signal_pending); 316 memset((void *)vbl_sig, 0, sizeof(*vbl_sig));
570 317
571 vbl_sig->sequence = vblwait->request.sequence; 318 vbl_sig->sequence = vblwait->request.sequence;
572 vbl_sig->info.si_signo = vblwait->request.signal; 319 vbl_sig->info.si_signo = vblwait->request.signal;
@@ -580,20 +327,17 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
580 327
581 vblwait->reply.sequence = seq; 328 vblwait->reply.sequence = seq;
582 } else { 329 } else {
583 unsigned long cur_vblank; 330 if (flags & _DRM_VBLANK_SECONDARY) {
584 331 if (dev->driver->vblank_wait2)
585 ret = drm_vblank_get(dev, crtc); 332 ret = dev->driver->vblank_wait2(dev, &vblwait->request.sequence);
586 if (ret) 333 } else if (dev->driver->vblank_wait)
587 return ret; 334 ret =
588 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, 335 dev->driver->vblank_wait(dev,
589 (((cur_vblank = drm_vblank_count(dev, crtc)) 336 &vblwait->request.sequence);
590 - vblwait->request.sequence) <= (1 << 23)));
591 drm_vblank_put(dev, crtc);
592 do_gettimeofday(&now);
593 337
338 do_gettimeofday(&now);
594 vblwait->reply.tval_sec = now.tv_sec; 339 vblwait->reply.tval_sec = now.tv_sec;
595 vblwait->reply.tval_usec = now.tv_usec; 340 vblwait->reply.tval_usec = now.tv_usec;
596 vblwait->reply.sequence = cur_vblank;
597 } 341 }
598 342
599 done: 343 done:
@@ -604,57 +348,44 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
604 * Send the VBLANK signals. 348 * Send the VBLANK signals.
605 * 349 *
606 * \param dev DRM device. 350 * \param dev DRM device.
607 * \param crtc CRTC where the vblank event occurred
608 * 351 *
609 * Sends a signal for each task in drm_device::vbl_sigs and empties the list. 352 * Sends a signal for each task in drm_device::vbl_sigs and empties the list.
610 * 353 *
611 * If a signal is not requested, then calls vblank_wait(). 354 * If a signal is not requested, then calls vblank_wait().
612 */ 355 */
613static void drm_vbl_send_signals(struct drm_device * dev, int crtc) 356void drm_vbl_send_signals(struct drm_device * dev)
614{ 357{
615 struct drm_vbl_sig *vbl_sig, *tmp;
616 struct list_head *vbl_sigs;
617 unsigned int vbl_seq;
618 unsigned long flags; 358 unsigned long flags;
359 int i;
619 360
620 spin_lock_irqsave(&dev->vbl_lock, flags); 361 spin_lock_irqsave(&dev->vbl_lock, flags);
621 362
622 vbl_sigs = &dev->vbl_sigs[crtc]; 363 for (i = 0; i < 2; i++) {
623 vbl_seq = drm_vblank_count(dev, crtc); 364 struct drm_vbl_sig *vbl_sig, *tmp;
365 struct list_head *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
366 unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 :
367 &dev->vbl_received);
624 368
625 list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) { 369 list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) {
626 if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { 370 if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) {
627 vbl_sig->info.si_code = vbl_seq; 371 vbl_sig->info.si_code = vbl_seq;
628 send_sig_info(vbl_sig->info.si_signo, 372 send_sig_info(vbl_sig->info.si_signo,
629 &vbl_sig->info, vbl_sig->task); 373 &vbl_sig->info, vbl_sig->task);
630 374
631 list_del(&vbl_sig->head); 375 list_del(&vbl_sig->head);
632 376
633 drm_free(vbl_sig, sizeof(*vbl_sig), 377 drm_free(vbl_sig, sizeof(*vbl_sig),
634 DRM_MEM_DRIVER); 378 DRM_MEM_DRIVER);
635 atomic_dec(&dev->vbl_signal_pending); 379
636 drm_vblank_put(dev, crtc); 380 dev->vbl_pending--;
637 } 381 }
382 }
638 } 383 }
639 384
640 spin_unlock_irqrestore(&dev->vbl_lock, flags); 385 spin_unlock_irqrestore(&dev->vbl_lock, flags);
641} 386}
642 387
643/** 388EXPORT_SYMBOL(drm_vbl_send_signals);
644 * drm_handle_vblank - handle a vblank event
645 * @dev: DRM device
646 * @crtc: where this event occurred
647 *
648 * Drivers should call this routine in their vblank interrupt handlers to
649 * update the vblank counter and send any signals that may be pending.
650 */
651void drm_handle_vblank(struct drm_device *dev, int crtc)
652{
653 drm_update_vblank_count(dev, crtc);
654 DRM_WAKEUP(&dev->vbl_queue[crtc]);
655 drm_vbl_send_signals(dev, crtc);
656}
657EXPORT_SYMBOL(drm_handle_vblank);
658 389
659/** 390/**
660 * Tasklet wrapper function. 391 * Tasklet wrapper function.
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c
index 12dcdd1832f0..0998723cde79 100644
--- a/drivers/char/drm/drm_lock.c
+++ b/drivers/char/drm/drm_lock.c
@@ -53,7 +53,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
53 DECLARE_WAITQUEUE(entry, current); 53 DECLARE_WAITQUEUE(entry, current);
54 struct drm_lock *lock = data; 54 struct drm_lock *lock = data;
55 int ret = 0; 55 int ret = 0;
56 unsigned long irqflags;
57 56
58 ++file_priv->lock_count; 57 ++file_priv->lock_count;
59 58
@@ -72,9 +71,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
72 return -EINVAL; 71 return -EINVAL;
73 72
74 add_wait_queue(&dev->lock.lock_queue, &entry); 73 add_wait_queue(&dev->lock.lock_queue, &entry);
75 spin_lock_irqsave(&dev->lock.spinlock, irqflags); 74 spin_lock_bh(&dev->lock.spinlock);
76 dev->lock.user_waiters++; 75 dev->lock.user_waiters++;
77 spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); 76 spin_unlock_bh(&dev->lock.spinlock);
78 for (;;) { 77 for (;;) {
79 __set_current_state(TASK_INTERRUPTIBLE); 78 __set_current_state(TASK_INTERRUPTIBLE);
80 if (!dev->lock.hw_lock) { 79 if (!dev->lock.hw_lock) {
@@ -96,9 +95,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
96 break; 95 break;
97 } 96 }
98 } 97 }
99 spin_lock_irqsave(&dev->lock.spinlock, irqflags); 98 spin_lock_bh(&dev->lock.spinlock);
100 dev->lock.user_waiters--; 99 dev->lock.user_waiters--;
101 spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); 100 spin_unlock_bh(&dev->lock.spinlock);
102 __set_current_state(TASK_RUNNING); 101 __set_current_state(TASK_RUNNING);
103 remove_wait_queue(&dev->lock.lock_queue, &entry); 102 remove_wait_queue(&dev->lock.lock_queue, &entry);
104 103
@@ -199,9 +198,8 @@ int drm_lock_take(struct drm_lock_data *lock_data,
199{ 198{
200 unsigned int old, new, prev; 199 unsigned int old, new, prev;
201 volatile unsigned int *lock = &lock_data->hw_lock->lock; 200 volatile unsigned int *lock = &lock_data->hw_lock->lock;
202 unsigned long irqflags;
203 201
204 spin_lock_irqsave(&lock_data->spinlock, irqflags); 202 spin_lock_bh(&lock_data->spinlock);
205 do { 203 do {
206 old = *lock; 204 old = *lock;
207 if (old & _DRM_LOCK_HELD) 205 if (old & _DRM_LOCK_HELD)
@@ -213,7 +211,7 @@ int drm_lock_take(struct drm_lock_data *lock_data,
213 } 211 }
214 prev = cmpxchg(lock, old, new); 212 prev = cmpxchg(lock, old, new);
215 } while (prev != old); 213 } while (prev != old);
216 spin_unlock_irqrestore(&lock_data->spinlock, irqflags); 214 spin_unlock_bh(&lock_data->spinlock);
217 215
218 if (_DRM_LOCKING_CONTEXT(old) == context) { 216 if (_DRM_LOCKING_CONTEXT(old) == context) {
219 if (old & _DRM_LOCK_HELD) { 217 if (old & _DRM_LOCK_HELD) {
@@ -274,16 +272,15 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
274{ 272{
275 unsigned int old, new, prev; 273 unsigned int old, new, prev;
276 volatile unsigned int *lock = &lock_data->hw_lock->lock; 274 volatile unsigned int *lock = &lock_data->hw_lock->lock;
277 unsigned long irqflags;
278 275
279 spin_lock_irqsave(&lock_data->spinlock, irqflags); 276 spin_lock_bh(&lock_data->spinlock);
280 if (lock_data->kernel_waiters != 0) { 277 if (lock_data->kernel_waiters != 0) {
281 drm_lock_transfer(lock_data, 0); 278 drm_lock_transfer(lock_data, 0);
282 lock_data->idle_has_lock = 1; 279 lock_data->idle_has_lock = 1;
283 spin_unlock_irqrestore(&lock_data->spinlock, irqflags); 280 spin_unlock_bh(&lock_data->spinlock);
284 return 1; 281 return 1;
285 } 282 }
286 spin_unlock_irqrestore(&lock_data->spinlock, irqflags); 283 spin_unlock_bh(&lock_data->spinlock);
287 284
288 do { 285 do {
289 old = *lock; 286 old = *lock;
@@ -347,20 +344,19 @@ static int drm_notifier(void *priv)
347void drm_idlelock_take(struct drm_lock_data *lock_data) 344void drm_idlelock_take(struct drm_lock_data *lock_data)
348{ 345{
349 int ret = 0; 346 int ret = 0;
350 unsigned long irqflags;
351 347
352 spin_lock_irqsave(&lock_data->spinlock, irqflags); 348 spin_lock_bh(&lock_data->spinlock);
353 lock_data->kernel_waiters++; 349 lock_data->kernel_waiters++;
354 if (!lock_data->idle_has_lock) { 350 if (!lock_data->idle_has_lock) {
355 351
356 spin_unlock_irqrestore(&lock_data->spinlock, irqflags); 352 spin_unlock_bh(&lock_data->spinlock);
357 ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); 353 ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT);
358 spin_lock_irqsave(&lock_data->spinlock, irqflags); 354 spin_lock_bh(&lock_data->spinlock);
359 355
360 if (ret == 1) 356 if (ret == 1)
361 lock_data->idle_has_lock = 1; 357 lock_data->idle_has_lock = 1;
362 } 358 }
363 spin_unlock_irqrestore(&lock_data->spinlock, irqflags); 359 spin_unlock_bh(&lock_data->spinlock);
364} 360}
365EXPORT_SYMBOL(drm_idlelock_take); 361EXPORT_SYMBOL(drm_idlelock_take);
366 362
@@ -368,9 +364,8 @@ void drm_idlelock_release(struct drm_lock_data *lock_data)
368{ 364{
369 unsigned int old, prev; 365 unsigned int old, prev;
370 volatile unsigned int *lock = &lock_data->hw_lock->lock; 366 volatile unsigned int *lock = &lock_data->hw_lock->lock;
371 unsigned long irqflags;
372 367
373 spin_lock_irqsave(&lock_data->spinlock, irqflags); 368 spin_lock_bh(&lock_data->spinlock);
374 if (--lock_data->kernel_waiters == 0) { 369 if (--lock_data->kernel_waiters == 0) {
375 if (lock_data->idle_has_lock) { 370 if (lock_data->idle_has_lock) {
376 do { 371 do {
@@ -381,7 +376,7 @@ void drm_idlelock_release(struct drm_lock_data *lock_data)
381 lock_data->idle_has_lock = 0; 376 lock_data->idle_has_lock = 0;
382 } 377 }
383 } 378 }
384 spin_unlock_irqrestore(&lock_data->spinlock, irqflags); 379 spin_unlock_bh(&lock_data->spinlock);
385} 380}
386EXPORT_SYMBOL(drm_idlelock_release); 381EXPORT_SYMBOL(drm_idlelock_release);
387 382
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index 9a32169e88fb..af211a0ef179 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -34,8 +34,6 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
34 struct drm_minor *drm_minor = to_drm_minor(dev); 34 struct drm_minor *drm_minor = to_drm_minor(dev);
35 struct drm_device *drm_dev = drm_minor->dev; 35 struct drm_device *drm_dev = drm_minor->dev;
36 36
37 printk(KERN_ERR "%s\n", __func__);
38
39 if (drm_dev->driver->suspend) 37 if (drm_dev->driver->suspend)
40 return drm_dev->driver->suspend(drm_dev, state); 38 return drm_dev->driver->suspend(drm_dev, state);
41 39
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index f47e46e3529f..88974342933c 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -415,13 +415,10 @@ static void i915_emit_breadcrumb(struct drm_device *dev)
415 drm_i915_private_t *dev_priv = dev->dev_private; 415 drm_i915_private_t *dev_priv = dev->dev_private;
416 RING_LOCALS; 416 RING_LOCALS;
417 417
418 if (++dev_priv->counter > BREADCRUMB_MASK) { 418 dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter;
419 dev_priv->counter = 1;
420 DRM_DEBUG("Breadcrumb counter wrapped around\n");
421 }
422 419
423 if (dev_priv->sarea_priv) 420 if (dev_priv->counter > 0x7FFFFFFFUL)
424 dev_priv->sarea_priv->last_enqueue = dev_priv->counter; 421 dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1;
425 422
426 BEGIN_LP_RING(4); 423 BEGIN_LP_RING(4);
427 OUT_RING(CMD_STORE_DWORD_IDX); 424 OUT_RING(CMD_STORE_DWORD_IDX);
@@ -431,26 +428,6 @@ static void i915_emit_breadcrumb(struct drm_device *dev)
431 ADVANCE_LP_RING(); 428 ADVANCE_LP_RING();
432} 429}
433 430
434int i915_emit_mi_flush(struct drm_device *dev, uint32_t flush)
435{
436 drm_i915_private_t *dev_priv = dev->dev_private;
437 uint32_t flush_cmd = CMD_MI_FLUSH;
438 RING_LOCALS;
439
440 flush_cmd |= flush;
441
442 i915_kernel_lost_context(dev);
443
444 BEGIN_LP_RING(4);
445 OUT_RING(flush_cmd);
446 OUT_RING(0);
447 OUT_RING(0);
448 OUT_RING(0);
449 ADVANCE_LP_RING();
450
451 return 0;
452}
453
454static int i915_dispatch_cmdbuffer(struct drm_device * dev, 431static int i915_dispatch_cmdbuffer(struct drm_device * dev,
455 drm_i915_cmdbuffer_t * cmd) 432 drm_i915_cmdbuffer_t * cmd)
456{ 433{
@@ -534,74 +511,52 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
534 return 0; 511 return 0;
535} 512}
536 513
537static void i915_do_dispatch_flip(struct drm_device * dev, int plane, int sync) 514static int i915_dispatch_flip(struct drm_device * dev)
538{ 515{
539 drm_i915_private_t *dev_priv = dev->dev_private; 516 drm_i915_private_t *dev_priv = dev->dev_private;
540 u32 num_pages, current_page, next_page, dspbase;
541 int shift = 2 * plane, x, y;
542 RING_LOCALS; 517 RING_LOCALS;
543 518
544 /* Calculate display base offset */ 519 DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n",
545 num_pages = dev_priv->sarea_priv->third_handle ? 3 : 2; 520 __FUNCTION__,
546 current_page = (dev_priv->sarea_priv->pf_current_page >> shift) & 0x3; 521 dev_priv->current_page,
547 next_page = (current_page + 1) % num_pages; 522 dev_priv->sarea_priv->pf_current_page);
548 523
549 switch (next_page) { 524 i915_kernel_lost_context(dev);
550 default: 525
551 case 0: 526 BEGIN_LP_RING(2);
552 dspbase = dev_priv->sarea_priv->front_offset; 527 OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
553 break; 528 OUT_RING(0);
554 case 1: 529 ADVANCE_LP_RING();
555 dspbase = dev_priv->sarea_priv->back_offset;
556 break;
557 case 2:
558 dspbase = dev_priv->sarea_priv->third_offset;
559 break;
560 }
561 530
562 if (plane == 0) { 531 BEGIN_LP_RING(6);
563 x = dev_priv->sarea_priv->planeA_x; 532 OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | ASYNC_FLIP);
564 y = dev_priv->sarea_priv->planeA_y; 533 OUT_RING(0);
534 if (dev_priv->current_page == 0) {
535 OUT_RING(dev_priv->back_offset);
536 dev_priv->current_page = 1;
565 } else { 537 } else {
566 x = dev_priv->sarea_priv->planeB_x; 538 OUT_RING(dev_priv->front_offset);
567 y = dev_priv->sarea_priv->planeB_y; 539 dev_priv->current_page = 0;
568 } 540 }
541 OUT_RING(0);
542 ADVANCE_LP_RING();
569 543
570 dspbase += (y * dev_priv->sarea_priv->pitch + x) * dev_priv->cpp; 544 BEGIN_LP_RING(2);
545 OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PLANE_A_FLIP);
546 OUT_RING(0);
547 ADVANCE_LP_RING();
571 548
572 DRM_DEBUG("plane=%d current_page=%d dspbase=0x%x\n", plane, current_page, 549 dev_priv->sarea_priv->last_enqueue = dev_priv->counter++;
573 dspbase);
574 550
575 BEGIN_LP_RING(4); 551 BEGIN_LP_RING(4);
576 OUT_RING(sync ? 0 : 552 OUT_RING(CMD_STORE_DWORD_IDX);
577 (MI_WAIT_FOR_EVENT | (plane ? MI_WAIT_FOR_PLANE_B_FLIP : 553 OUT_RING(20);
578 MI_WAIT_FOR_PLANE_A_FLIP))); 554 OUT_RING(dev_priv->counter);
579 OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | (sync ? 0 : ASYNC_FLIP) | 555 OUT_RING(0);
580 (plane ? DISPLAY_PLANE_B : DISPLAY_PLANE_A));
581 OUT_RING(dev_priv->sarea_priv->pitch * dev_priv->cpp);
582 OUT_RING(dspbase);
583 ADVANCE_LP_RING(); 556 ADVANCE_LP_RING();
584 557
585 dev_priv->sarea_priv->pf_current_page &= ~(0x3 << shift); 558 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
586 dev_priv->sarea_priv->pf_current_page |= next_page << shift; 559 return 0;
587}
588
589void i915_dispatch_flip(struct drm_device * dev, int planes, int sync)
590{
591 drm_i915_private_t *dev_priv = dev->dev_private;
592 int i;
593
594 DRM_DEBUG("planes=0x%x pfCurrentPage=%d\n",
595 planes, dev_priv->sarea_priv->pf_current_page);
596
597 i915_emit_mi_flush(dev, MI_READ_FLUSH | MI_EXE_FLUSH);
598
599 for (i = 0; i < 2; i++)
600 if (planes & (1 << i))
601 i915_do_dispatch_flip(dev, i, sync);
602
603 i915_emit_breadcrumb(dev);
604
605} 560}
606 561
607static int i915_quiescent(struct drm_device * dev) 562static int i915_quiescent(struct drm_device * dev)
@@ -624,6 +579,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
624 struct drm_file *file_priv) 579 struct drm_file *file_priv)
625{ 580{
626 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 581 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
582 u32 *hw_status = dev_priv->hw_status_page;
627 drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) 583 drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
628 dev_priv->sarea_priv; 584 dev_priv->sarea_priv;
629 drm_i915_batchbuffer_t *batch = data; 585 drm_i915_batchbuffer_t *batch = data;
@@ -646,7 +602,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
646 602
647 ret = i915_dispatch_batchbuffer(dev, batch); 603 ret = i915_dispatch_batchbuffer(dev, batch);
648 604
649 sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 605 sarea_priv->last_dispatch = (int)hw_status[5];
650 return ret; 606 return ret;
651} 607}
652 608
@@ -654,6 +610,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
654 struct drm_file *file_priv) 610 struct drm_file *file_priv)
655{ 611{
656 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 612 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
613 u32 *hw_status = dev_priv->hw_status_page;
657 drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) 614 drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
658 dev_priv->sarea_priv; 615 dev_priv->sarea_priv;
659 drm_i915_cmdbuffer_t *cmdbuf = data; 616 drm_i915_cmdbuffer_t *cmdbuf = data;
@@ -678,51 +635,18 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
678 return ret; 635 return ret;
679 } 636 }
680 637
681 sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 638 sarea_priv->last_dispatch = (int)hw_status[5];
682 return 0;
683}
684
685static int i915_do_cleanup_pageflip(struct drm_device * dev)
686{
687 drm_i915_private_t *dev_priv = dev->dev_private;
688 int i, planes, num_pages = dev_priv->sarea_priv->third_handle ? 3 : 2;
689
690 DRM_DEBUG("\n");
691
692 for (i = 0, planes = 0; i < 2; i++)
693 if (dev_priv->sarea_priv->pf_current_page & (0x3 << (2 * i))) {
694 dev_priv->sarea_priv->pf_current_page =
695 (dev_priv->sarea_priv->pf_current_page &
696 ~(0x3 << (2 * i))) | ((num_pages - 1) << (2 * i));
697
698 planes |= 1 << i;
699 }
700
701 if (planes)
702 i915_dispatch_flip(dev, planes, 0);
703
704 return 0; 639 return 0;
705} 640}
706 641
707static int i915_flip_bufs(struct drm_device *dev, void *data, 642static int i915_flip_bufs(struct drm_device *dev, void *data,
708 struct drm_file *file_priv) 643 struct drm_file *file_priv)
709{ 644{
710 drm_i915_flip_t *param = data; 645 DRM_DEBUG("%s\n", __FUNCTION__);
711
712 DRM_DEBUG("\n");
713 646
714 LOCK_TEST_WITH_RETURN(dev, file_priv); 647 LOCK_TEST_WITH_RETURN(dev, file_priv);
715 648
716 /* This is really planes */ 649 return i915_dispatch_flip(dev);
717 if (param->pipes & ~0x3) {
718 DRM_ERROR("Invalid planes 0x%x, only <= 0x3 is valid\n",
719 param->pipes);
720 return -EINVAL;
721 }
722
723 i915_dispatch_flip(dev, param->pipes, 0);
724
725 return 0;
726} 650}
727 651
728static int i915_getparam(struct drm_device *dev, void *data, 652static int i915_getparam(struct drm_device *dev, void *data,
@@ -883,8 +807,6 @@ void i915_driver_lastclose(struct drm_device * dev)
883 if (!dev_priv) 807 if (!dev_priv)
884 return; 808 return;
885 809
886 if (drm_getsarea(dev) && dev_priv->sarea_priv)
887 i915_do_cleanup_pageflip(dev);
888 if (dev_priv->agp_heap) 810 if (dev_priv->agp_heap)
889 i915_mem_takedown(&(dev_priv->agp_heap)); 811 i915_mem_takedown(&(dev_priv->agp_heap));
890 812
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h
index 0431c00e2289..05c66cf03a9e 100644
--- a/drivers/char/drm/i915_drm.h
+++ b/drivers/char/drm/i915_drm.h
@@ -105,29 +105,14 @@ typedef struct _drm_i915_sarea {
105 unsigned int rotated_tiled; 105 unsigned int rotated_tiled;
106 unsigned int rotated2_tiled; 106 unsigned int rotated2_tiled;
107 107
108 int planeA_x; 108 int pipeA_x;
109 int planeA_y; 109 int pipeA_y;
110 int planeA_w; 110 int pipeA_w;
111 int planeA_h; 111 int pipeA_h;
112 int planeB_x; 112 int pipeB_x;
113 int planeB_y; 113 int pipeB_y;
114 int planeB_w; 114 int pipeB_w;
115 int planeB_h; 115 int pipeB_h;
116
117 /* Triple buffering */
118 drm_handle_t third_handle;
119 int third_offset;
120 int third_size;
121 unsigned int third_tiled;
122
123 /* buffer object handles for the static buffers. May change
124 * over the lifetime of the client, though it doesn't in our current
125 * implementation.
126 */
127 unsigned int front_bo_handle;
128 unsigned int back_bo_handle;
129 unsigned int third_bo_handle;
130 unsigned int depth_bo_handle;
131} drm_i915_sarea_t; 116} drm_i915_sarea_t;
132 117
133/* Flags for perf_boxes 118/* Flags for perf_boxes
@@ -161,7 +146,7 @@ typedef struct _drm_i915_sarea {
161 146
162#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 147#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
163#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 148#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
164#define DRM_IOCTL_I915_FLIP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FLIP, drm_i915_flip_t) 149#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
165#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) 150#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
166#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) 151#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
167#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) 152#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
@@ -176,18 +161,6 @@ typedef struct _drm_i915_sarea {
176#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 161#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
177#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 162#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
178 163
179/* Asynchronous page flipping:
180 */
181typedef struct drm_i915_flip {
182 /*
183 * This is really talking about planes, and we could rename it
184 * except for the fact that some of the duplicated i915_drm.h files
185 * out there check for HAVE_I915_FLIP and so might pick up this
186 * version.
187 */
188 int pipes;
189} drm_i915_flip_t;
190
191/* Allow drivers to submit batchbuffers directly to hardware, relying 164/* Allow drivers to submit batchbuffers directly to hardware, relying
192 * on the security mechanisms provided by hardware. 165 * on the security mechanisms provided by hardware.
193 */ 166 */
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index bb8f1b2fb383..e8f3d682e3b1 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -147,7 +147,7 @@ static void i915_save_vga(struct drm_device *dev)
147 i915_write_indexed(cr_index, cr_data, 0x11, 147 i915_write_indexed(cr_index, cr_data, 0x11,
148 i915_read_indexed(cr_index, cr_data, 0x11) & 148 i915_read_indexed(cr_index, cr_data, 0x11) &
149 (~0x80)); 149 (~0x80));
150 for (i = 0; i < 0x24; i++) 150 for (i = 0; i <= 0x24; i++)
151 dev_priv->saveCR[i] = 151 dev_priv->saveCR[i] =
152 i915_read_indexed(cr_index, cr_data, i); 152 i915_read_indexed(cr_index, cr_data, i);
153 /* Make sure we don't turn off CR group 0 writes */ 153 /* Make sure we don't turn off CR group 0 writes */
@@ -156,7 +156,7 @@ static void i915_save_vga(struct drm_device *dev)
156 /* Attribute controller registers */ 156 /* Attribute controller registers */
157 inb(st01); 157 inb(st01);
158 dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX); 158 dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX);
159 for (i = 0; i < 20; i++) 159 for (i = 0; i <= 0x14; i++)
160 dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); 160 dev_priv->saveAR[i] = i915_read_ar(st01, i, 0);
161 inb(st01); 161 inb(st01);
162 outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); 162 outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX);
@@ -206,7 +206,7 @@ static void i915_restore_vga(struct drm_device *dev)
206 /* CRT controller regs */ 206 /* CRT controller regs */
207 /* Enable CR group 0 writes */ 207 /* Enable CR group 0 writes */
208 i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); 208 i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]);
209 for (i = 0; i < 0x24; i++) 209 for (i = 0; i <= 0x24; i++)
210 i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]); 210 i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]);
211 211
212 /* Graphics controller regs */ 212 /* Graphics controller regs */
@@ -223,7 +223,7 @@ static void i915_restore_vga(struct drm_device *dev)
223 223
224 /* Attribute controller registers */ 224 /* Attribute controller registers */
225 inb(st01); 225 inb(st01);
226 for (i = 0; i < 20; i++) 226 for (i = 0; i <= 0x14; i++)
227 i915_write_ar(st01, i, dev_priv->saveAR[i], 0); 227 i915_write_ar(st01, i, dev_priv->saveAR[i], 0);
228 inb(st01); /* switch back to index mode */ 228 inb(st01); /* switch back to index mode */
229 outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); 229 outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX);
@@ -256,6 +256,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
256 pci_save_state(dev->pdev); 256 pci_save_state(dev->pdev);
257 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); 257 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
258 258
259 /* Display arbitration control */
260 dev_priv->saveDSPARB = I915_READ(DSPARB);
261
259 /* Pipe & plane A info */ 262 /* Pipe & plane A info */
260 dev_priv->savePIPEACONF = I915_READ(PIPEACONF); 263 dev_priv->savePIPEACONF = I915_READ(PIPEACONF);
261 dev_priv->savePIPEASRC = I915_READ(PIPEASRC); 264 dev_priv->savePIPEASRC = I915_READ(PIPEASRC);
@@ -349,6 +352,7 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
349 dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); 352 dev_priv->saveVGACNTRL = I915_READ(VGACNTRL);
350 353
351 /* Clock gating state */ 354 /* Clock gating state */
355 dev_priv->saveD_STATE = I915_READ(D_STATE);
352 dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D); 356 dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D);
353 357
354 /* Cache mode state */ 358 /* Cache mode state */
@@ -388,6 +392,8 @@ static int i915_resume(struct drm_device *dev)
388 392
389 pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); 393 pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
390 394
395 I915_WRITE(DSPARB, dev_priv->saveDSPARB);
396
391 /* Pipe & plane A info */ 397 /* Pipe & plane A info */
392 /* Prime the clock */ 398 /* Prime the clock */
393 if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { 399 if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) {
@@ -507,6 +513,7 @@ static int i915_resume(struct drm_device *dev)
507 udelay(150); 513 udelay(150);
508 514
509 /* Clock gating state */ 515 /* Clock gating state */
516 I915_WRITE (D_STATE, dev_priv->saveD_STATE);
510 I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D); 517 I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D);
511 518
512 /* Cache mode state */ 519 /* Cache mode state */
@@ -533,7 +540,8 @@ static struct drm_driver driver = {
533 */ 540 */
534 .driver_features = 541 .driver_features =
535 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ 542 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/
536 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, 543 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL |
544 DRIVER_IRQ_VBL2,
537 .load = i915_driver_load, 545 .load = i915_driver_load,
538 .unload = i915_driver_unload, 546 .unload = i915_driver_unload,
539 .lastclose = i915_driver_lastclose, 547 .lastclose = i915_driver_lastclose,
@@ -541,9 +549,8 @@ static struct drm_driver driver = {
541 .suspend = i915_suspend, 549 .suspend = i915_suspend,
542 .resume = i915_resume, 550 .resume = i915_resume,
543 .device_is_agp = i915_driver_device_is_agp, 551 .device_is_agp = i915_driver_device_is_agp,
544 .get_vblank_counter = i915_get_vblank_counter, 552 .vblank_wait = i915_driver_vblank_wait,
545 .enable_vblank = i915_enable_vblank, 553 .vblank_wait2 = i915_driver_vblank_wait2,
546 .disable_vblank = i915_disable_vblank,
547 .irq_preinstall = i915_driver_irq_preinstall, 554 .irq_preinstall = i915_driver_irq_preinstall,
548 .irq_postinstall = i915_driver_irq_postinstall, 555 .irq_postinstall = i915_driver_irq_postinstall,
549 .irq_uninstall = i915_driver_irq_uninstall, 556 .irq_uninstall = i915_driver_irq_uninstall,
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index db7001f22561..1b20f7c0639c 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -76,9 +76,8 @@ struct mem_block {
76typedef struct _drm_i915_vbl_swap { 76typedef struct _drm_i915_vbl_swap {
77 struct list_head head; 77 struct list_head head;
78 drm_drawable_t drw_id; 78 drm_drawable_t drw_id;
79 unsigned int plane; 79 unsigned int pipe;
80 unsigned int sequence; 80 unsigned int sequence;
81 int flip;
82} drm_i915_vbl_swap_t; 81} drm_i915_vbl_swap_t;
83 82
84typedef struct drm_i915_private { 83typedef struct drm_i915_private {
@@ -91,7 +90,7 @@ typedef struct drm_i915_private {
91 drm_dma_handle_t *status_page_dmah; 90 drm_dma_handle_t *status_page_dmah;
92 void *hw_status_page; 91 void *hw_status_page;
93 dma_addr_t dma_status_page; 92 dma_addr_t dma_status_page;
94 uint32_t counter; 93 unsigned long counter;
95 unsigned int status_gfx_addr; 94 unsigned int status_gfx_addr;
96 drm_local_map_t hws_map; 95 drm_local_map_t hws_map;
97 96
@@ -104,18 +103,13 @@ typedef struct drm_i915_private {
104 103
105 wait_queue_head_t irq_queue; 104 wait_queue_head_t irq_queue;
106 atomic_t irq_received; 105 atomic_t irq_received;
107 atomic_t irq_emited; 106 atomic_t irq_emitted;
108 107
109 int tex_lru_log_granularity; 108 int tex_lru_log_granularity;
110 int allow_batchbuffer; 109 int allow_batchbuffer;
111 struct mem_block *agp_heap; 110 struct mem_block *agp_heap;
112 unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; 111 unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
113 int vblank_pipe; 112 int vblank_pipe;
114 spinlock_t user_irq_lock;
115 int user_irq_refcount;
116 int fence_irq_on;
117 uint32_t irq_enable_reg;
118 int irq_enabled;
119 113
120 spinlock_t swaps_lock; 114 spinlock_t swaps_lock;
121 drm_i915_vbl_swap_t vbl_swaps; 115 drm_i915_vbl_swap_t vbl_swaps;
@@ -125,6 +119,7 @@ typedef struct drm_i915_private {
125 u8 saveLBB; 119 u8 saveLBB;
126 u32 saveDSPACNTR; 120 u32 saveDSPACNTR;
127 u32 saveDSPBCNTR; 121 u32 saveDSPBCNTR;
122 u32 saveDSPARB;
128 u32 savePIPEACONF; 123 u32 savePIPEACONF;
129 u32 savePIPEBCONF; 124 u32 savePIPEBCONF;
130 u32 savePIPEASRC; 125 u32 savePIPEASRC;
@@ -194,6 +189,7 @@ typedef struct drm_i915_private {
194 u32 saveIIR; 189 u32 saveIIR;
195 u32 saveIMR; 190 u32 saveIMR;
196 u32 saveCACHE_MODE_0; 191 u32 saveCACHE_MODE_0;
192 u32 saveD_STATE;
197 u32 saveDSPCLK_GATE_D; 193 u32 saveDSPCLK_GATE_D;
198 u32 saveMI_ARB_STATE; 194 u32 saveMI_ARB_STATE;
199 u32 saveSWF0[16]; 195 u32 saveSWF0[16];
@@ -203,10 +199,10 @@ typedef struct drm_i915_private {
203 u8 saveSR[8]; 199 u8 saveSR[8];
204 u8 saveGR[25]; 200 u8 saveGR[25];
205 u8 saveAR_INDEX; 201 u8 saveAR_INDEX;
206 u8 saveAR[20]; 202 u8 saveAR[21];
207 u8 saveDACMASK; 203 u8 saveDACMASK;
208 u8 saveDACDATA[256*3]; /* 256 3-byte colors */ 204 u8 saveDACDATA[256*3]; /* 256 3-byte colors */
209 u8 saveCR[36]; 205 u8 saveCR[37];
210} drm_i915_private_t; 206} drm_i915_private_t;
211 207
212extern struct drm_ioctl_desc i915_ioctls[]; 208extern struct drm_ioctl_desc i915_ioctls[];
@@ -222,7 +218,7 @@ extern void i915_driver_preclose(struct drm_device *dev,
222extern int i915_driver_device_is_agp(struct drm_device * dev); 218extern int i915_driver_device_is_agp(struct drm_device * dev);
223extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, 219extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
224 unsigned long arg); 220 unsigned long arg);
225extern void i915_dispatch_flip(struct drm_device * dev, int pipes, int sync); 221
226/* i915_irq.c */ 222/* i915_irq.c */
227extern int i915_irq_emit(struct drm_device *dev, void *data, 223extern int i915_irq_emit(struct drm_device *dev, void *data,
228 struct drm_file *file_priv); 224 struct drm_file *file_priv);
@@ -233,7 +229,7 @@ extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequenc
233extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence); 229extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
234extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); 230extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
235extern void i915_driver_irq_preinstall(struct drm_device * dev); 231extern void i915_driver_irq_preinstall(struct drm_device * dev);
236extern int i915_driver_irq_postinstall(struct drm_device * dev); 232extern void i915_driver_irq_postinstall(struct drm_device * dev);
237extern void i915_driver_irq_uninstall(struct drm_device * dev); 233extern void i915_driver_irq_uninstall(struct drm_device * dev);
238extern int i915_vblank_pipe_set(struct drm_device *dev, void *data, 234extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
239 struct drm_file *file_priv); 235 struct drm_file *file_priv);
@@ -241,9 +237,6 @@ extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
241 struct drm_file *file_priv); 237 struct drm_file *file_priv);
242extern int i915_vblank_swap(struct drm_device *dev, void *data, 238extern int i915_vblank_swap(struct drm_device *dev, void *data,
243 struct drm_file *file_priv); 239 struct drm_file *file_priv);
244extern int i915_enable_vblank(struct drm_device *dev, int crtc);
245extern void i915_disable_vblank(struct drm_device *dev, int crtc);
246extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
247 240
248/* i915_mem.c */ 241/* i915_mem.c */
249extern int i915_mem_alloc(struct drm_device *dev, void *data, 242extern int i915_mem_alloc(struct drm_device *dev, void *data,
@@ -388,91 +381,21 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
388 381
389/* Interrupt bits: 382/* Interrupt bits:
390 */ 383 */
391#define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18) 384#define USER_INT_FLAG (1<<1)
392#define I915_DISPLAY_PORT_INTERRUPT (1<<17) 385#define VSYNC_PIPEB_FLAG (1<<5)
393#define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15) 386#define VSYNC_PIPEA_FLAG (1<<7)
394#define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14) 387#define HWB_OOM_FLAG (1<<13) /* binner out of memory */
395#define I915_HWB_OOM_INTERRUPT (1<<13) /* binner out of memory */
396#define I915_SYNC_STATUS_INTERRUPT (1<<12)
397#define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
398#define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
399#define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9)
400#define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
401#define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7)
402#define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
403#define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
404#define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
405#define I915_DEBUG_INTERRUPT (1<<2)
406#define I915_USER_INTERRUPT (1<<1)
407
408 388
409#define I915REG_HWSTAM 0x02098 389#define I915REG_HWSTAM 0x02098
410#define I915REG_INT_IDENTITY_R 0x020a4 390#define I915REG_INT_IDENTITY_R 0x020a4
411#define I915REG_INT_MASK_R 0x020a8 391#define I915REG_INT_MASK_R 0x020a8
412#define I915REG_INT_ENABLE_R 0x020a0 392#define I915REG_INT_ENABLE_R 0x020a0
413#define I915REG_INSTPM 0x020c0
414
415#define PIPEADSL 0x70000
416#define PIPEBDSL 0x71000
417 393
418#define I915REG_PIPEASTAT 0x70024 394#define I915REG_PIPEASTAT 0x70024
419#define I915REG_PIPEBSTAT 0x71024 395#define I915REG_PIPEBSTAT 0x71024
420/*
421 * The two pipe frame counter registers are not synchronized, so
422 * reading a stable value is somewhat tricky. The following code
423 * should work:
424 *
425 * do {
426 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
427 * PIPE_FRAME_HIGH_SHIFT;
428 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
429 * PIPE_FRAME_LOW_SHIFT);
430 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
431 * PIPE_FRAME_HIGH_SHIFT);
432 * } while (high1 != high2);
433 * frame = (high1 << 8) | low1;
434 */
435#define PIPEAFRAMEHIGH 0x70040
436#define PIPEBFRAMEHIGH 0x71040
437#define PIPE_FRAME_HIGH_MASK 0x0000ffff
438#define PIPE_FRAME_HIGH_SHIFT 0
439#define PIPEAFRAMEPIXEL 0x70044
440#define PIPEBFRAMEPIXEL 0x71044
441 396
442#define PIPE_FRAME_LOW_MASK 0xff000000 397#define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
443#define PIPE_FRAME_LOW_SHIFT 24 398#define I915_VBLANK_CLEAR (1UL<<1)
444/*
445 * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register
446 * and is 24 bits wide.
447 */
448#define PIPE_PIXEL_MASK 0x00ffffff
449#define PIPE_PIXEL_SHIFT 0
450
451#define I915_FIFO_UNDERRUN_STATUS (1UL<<31)
452#define I915_CRC_ERROR_ENABLE (1UL<<29)
453#define I915_CRC_DONE_ENABLE (1UL<<28)
454#define I915_GMBUS_EVENT_ENABLE (1UL<<27)
455#define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25)
456#define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
457#define I915_DPST_EVENT_ENABLE (1UL<<23)
458#define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
459#define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
460#define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
461#define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
462#define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
463#define I915_OVERLAY_UPDATED_ENABLE (1UL<<16)
464#define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
465#define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
466#define I915_GMBUS_INTERRUPT_STATUS (1UL<<11)
467#define I915_VSYNC_INTERRUPT_STATUS (1UL<<9)
468#define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
469#define I915_DPST_EVENT_STATUS (1UL<<7)
470#define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6)
471#define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
472#define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
473#define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
474#define I915_VBLANK_INTERRUPT_STATUS (1UL<<1)
475#define I915_OVERLAY_UPDATED_STATUS (1UL<<0)
476 399
477#define SRX_INDEX 0x3c4 400#define SRX_INDEX 0x3c4
478#define SRX_DATA 0x3c5 401#define SRX_DATA 0x3c5
@@ -749,6 +672,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
749/** P1 value is 2 greater than this field */ 672/** P1 value is 2 greater than this field */
750# define VGA0_PD_P1_MASK (0x1f << 0) 673# define VGA0_PD_P1_MASK (0x1f << 0)
751 674
675/* PCI D state control register */
676#define D_STATE 0x6104
752#define DSPCLK_GATE_D 0x6200 677#define DSPCLK_GATE_D 0x6200
753 678
754/* I830 CRTC registers */ 679/* I830 CRTC registers */
@@ -1059,6 +984,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1059#define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) 984#define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
1060#define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) 985#define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
1061 986
987#define DSPARB 0x70030
988#define DSPARB_CSTART_MASK (0x7f << 7)
989#define DSPARB_CSTART_SHIFT 7
990#define DSPARB_BSTART_MASK (0x7f)
991#define DSPARB_BSTART_SHIFT 0
992
1062#define PIPEBCONF 0x71008 993#define PIPEBCONF 0x71008
1063#define PIPEBCONF_ENABLE (1<<31) 994#define PIPEBCONF_ENABLE (1<<31)
1064#define PIPEBCONF_DISABLE 0 995#define PIPEBCONF_DISABLE 0
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index 023ce66ef3ab..f7f16e7a8bf3 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -38,109 +38,6 @@
38#define MAX_NOPID ((u32)~0) 38#define MAX_NOPID ((u32)~0)
39 39
40/** 40/**
41 * i915_get_pipe - return the the pipe associated with a given plane
42 * @dev: DRM device
43 * @plane: plane to look for
44 *
45 * The Intel Mesa & 2D drivers call the vblank routines with a plane number
46 * rather than a pipe number, since they may not always be equal. This routine
47 * maps the given @plane back to a pipe number.
48 */
49static int
50i915_get_pipe(struct drm_device *dev, int plane)
51{
52 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
53 u32 dspcntr;
54
55 dspcntr = plane ? I915_READ(DSPBCNTR) : I915_READ(DSPACNTR);
56
57 return dspcntr & DISPPLANE_SEL_PIPE_MASK ? 1 : 0;
58}
59
60/**
61 * i915_get_plane - return the the plane associated with a given pipe
62 * @dev: DRM device
63 * @pipe: pipe to look for
64 *
65 * The Intel Mesa & 2D drivers call the vblank routines with a plane number
66 * rather than a plane number, since they may not always be equal. This routine
67 * maps the given @pipe back to a plane number.
68 */
69static int
70i915_get_plane(struct drm_device *dev, int pipe)
71{
72 if (i915_get_pipe(dev, 0) == pipe)
73 return 0;
74 return 1;
75}
76
77/**
78 * i915_pipe_enabled - check if a pipe is enabled
79 * @dev: DRM device
80 * @pipe: pipe to check
81 *
82 * Reading certain registers when the pipe is disabled can hang the chip.
83 * Use this routine to make sure the PLL is running and the pipe is active
84 * before reading such registers if unsure.
85 */
86static int
87i915_pipe_enabled(struct drm_device *dev, int pipe)
88{
89 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
90 unsigned long pipeconf = pipe ? PIPEBCONF : PIPEACONF;
91
92 if (I915_READ(pipeconf) & PIPEACONF_ENABLE)
93 return 1;
94
95 return 0;
96}
97
98/**
99 * Emit a synchronous flip.
100 *
101 * This function must be called with the drawable spinlock held.
102 */
103static void
104i915_dispatch_vsync_flip(struct drm_device *dev, struct drm_drawable_info *drw,
105 int plane)
106{
107 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
108 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv;
109 u16 x1, y1, x2, y2;
110 int pf_planes = 1 << plane;
111
112 /* If the window is visible on the other plane, we have to flip on that
113 * plane as well.
114 */
115 if (plane == 1) {
116 x1 = sarea_priv->planeA_x;
117 y1 = sarea_priv->planeA_y;
118 x2 = x1 + sarea_priv->planeA_w;
119 y2 = y1 + sarea_priv->planeA_h;
120 } else {
121 x1 = sarea_priv->planeB_x;
122 y1 = sarea_priv->planeB_y;
123 x2 = x1 + sarea_priv->planeB_w;
124 y2 = y1 + sarea_priv->planeB_h;
125 }
126
127 if (x2 > 0 && y2 > 0) {
128 int i, num_rects = drw->num_rects;
129 struct drm_clip_rect *rect = drw->rects;
130
131 for (i = 0; i < num_rects; i++)
132 if (!(rect[i].x1 >= x2 || rect[i].y1 >= y2 ||
133 rect[i].x2 <= x1 || rect[i].y2 <= y1)) {
134 pf_planes = 0x3;
135
136 break;
137 }
138 }
139
140 i915_dispatch_flip(dev, pf_planes, 1);
141}
142
143/**
144 * Emit blits for scheduled buffer swaps. 41 * Emit blits for scheduled buffer swaps.
145 * 42 *
146 * This function will be called with the HW lock held. 43 * This function will be called with the HW lock held.
@@ -148,19 +45,20 @@ i915_dispatch_vsync_flip(struct drm_device *dev, struct drm_drawable_info *drw,
148static void i915_vblank_tasklet(struct drm_device *dev) 45static void i915_vblank_tasklet(struct drm_device *dev)
149{ 46{
150 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 47 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
48 unsigned long irqflags;
151 struct list_head *list, *tmp, hits, *hit; 49 struct list_head *list, *tmp, hits, *hit;
152 int nhits, nrects, slice[2], upper[2], lower[2], i, num_pages; 50 int nhits, nrects, slice[2], upper[2], lower[2], i;
153 unsigned counter[2]; 51 unsigned counter[2] = { atomic_read(&dev->vbl_received),
52 atomic_read(&dev->vbl_received2) };
154 struct drm_drawable_info *drw; 53 struct drm_drawable_info *drw;
155 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; 54 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv;
156 u32 cpp = dev_priv->cpp, offsets[3]; 55 u32 cpp = dev_priv->cpp;
157 u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | 56 u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD |
158 XY_SRC_COPY_BLT_WRITE_ALPHA | 57 XY_SRC_COPY_BLT_WRITE_ALPHA |
159 XY_SRC_COPY_BLT_WRITE_RGB) 58 XY_SRC_COPY_BLT_WRITE_RGB)
160 : XY_SRC_COPY_BLT_CMD; 59 : XY_SRC_COPY_BLT_CMD;
161 u32 src_pitch = sarea_priv->pitch * cpp; 60 u32 src_pitch = sarea_priv->pitch * cpp;
162 u32 dst_pitch = sarea_priv->pitch * cpp; 61 u32 dst_pitch = sarea_priv->pitch * cpp;
163 /* COPY rop (0xcc), map cpp to magic color depth constants */
164 u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); 62 u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24);
165 RING_LOCALS; 63 RING_LOCALS;
166 64
@@ -173,34 +71,24 @@ static void i915_vblank_tasklet(struct drm_device *dev)
173 src_pitch >>= 2; 71 src_pitch >>= 2;
174 } 72 }
175 73
176 counter[0] = drm_vblank_count(dev, 0);
177 counter[1] = drm_vblank_count(dev, 1);
178
179 DRM_DEBUG("\n"); 74 DRM_DEBUG("\n");
180 75
181 INIT_LIST_HEAD(&hits); 76 INIT_LIST_HEAD(&hits);
182 77
183 nhits = nrects = 0; 78 nhits = nrects = 0;
184 79
185 /* No irqsave/restore necessary. This tasklet may be run in an 80 spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
186 * interrupt context or normal context, but we don't have to worry
187 * about getting interrupted by something acquiring the lock, because
188 * we are the interrupt context thing that acquires the lock.
189 */
190 spin_lock(&dev_priv->swaps_lock);
191 81
192 /* Find buffer swaps scheduled for this vertical blank */ 82 /* Find buffer swaps scheduled for this vertical blank */
193 list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) { 83 list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) {
194 drm_i915_vbl_swap_t *vbl_swap = 84 drm_i915_vbl_swap_t *vbl_swap =
195 list_entry(list, drm_i915_vbl_swap_t, head); 85 list_entry(list, drm_i915_vbl_swap_t, head);
196 int pipe = i915_get_pipe(dev, vbl_swap->plane);
197 86
198 if ((counter[pipe] - vbl_swap->sequence) > (1<<23)) 87 if ((counter[vbl_swap->pipe] - vbl_swap->sequence) > (1<<23))
199 continue; 88 continue;
200 89
201 list_del(list); 90 list_del(list);
202 dev_priv->swaps_pending--; 91 dev_priv->swaps_pending--;
203 drm_vblank_put(dev, pipe);
204 92
205 spin_unlock(&dev_priv->swaps_lock); 93 spin_unlock(&dev_priv->swaps_lock);
206 spin_lock(&dev->drw_lock); 94 spin_lock(&dev->drw_lock);
@@ -238,23 +126,43 @@ static void i915_vblank_tasklet(struct drm_device *dev)
238 spin_lock(&dev_priv->swaps_lock); 126 spin_lock(&dev_priv->swaps_lock);
239 } 127 }
240 128
241 spin_unlock(&dev_priv->swaps_lock); 129 if (nhits == 0) {
242 130 spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
243 if (nhits == 0)
244 return; 131 return;
132 }
133
134 spin_unlock(&dev_priv->swaps_lock);
245 135
246 i915_kernel_lost_context(dev); 136 i915_kernel_lost_context(dev);
247 137
248 upper[0] = upper[1] = 0; 138 if (IS_I965G(dev)) {
249 slice[0] = max(sarea_priv->planeA_h / nhits, 1); 139 BEGIN_LP_RING(4);
250 slice[1] = max(sarea_priv->planeB_h / nhits, 1); 140
251 lower[0] = sarea_priv->planeA_y + slice[0]; 141 OUT_RING(GFX_OP_DRAWRECT_INFO_I965);
252 lower[1] = sarea_priv->planeB_y + slice[0]; 142 OUT_RING(0);
143 OUT_RING(((sarea_priv->width - 1) & 0xffff) | ((sarea_priv->height - 1) << 16));
144 OUT_RING(0);
145 ADVANCE_LP_RING();
146 } else {
147 BEGIN_LP_RING(6);
253 148
254 offsets[0] = sarea_priv->front_offset; 149 OUT_RING(GFX_OP_DRAWRECT_INFO);
255 offsets[1] = sarea_priv->back_offset; 150 OUT_RING(0);
256 offsets[2] = sarea_priv->third_offset; 151 OUT_RING(0);
257 num_pages = sarea_priv->third_handle ? 3 : 2; 152 OUT_RING(sarea_priv->width | sarea_priv->height << 16);
153 OUT_RING(sarea_priv->width | sarea_priv->height << 16);
154 OUT_RING(0);
155
156 ADVANCE_LP_RING();
157 }
158
159 sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT;
160
161 upper[0] = upper[1] = 0;
162 slice[0] = max(sarea_priv->pipeA_h / nhits, 1);
163 slice[1] = max(sarea_priv->pipeB_h / nhits, 1);
164 lower[0] = sarea_priv->pipeA_y + slice[0];
165 lower[1] = sarea_priv->pipeB_y + slice[0];
258 166
259 spin_lock(&dev->drw_lock); 167 spin_lock(&dev->drw_lock);
260 168
@@ -266,8 +174,6 @@ static void i915_vblank_tasklet(struct drm_device *dev)
266 for (i = 0; i++ < nhits; 174 for (i = 0; i++ < nhits;
267 upper[0] = lower[0], lower[0] += slice[0], 175 upper[0] = lower[0], lower[0] += slice[0],
268 upper[1] = lower[1], lower[1] += slice[1]) { 176 upper[1] = lower[1], lower[1] += slice[1]) {
269 int init_drawrect = 1;
270
271 if (i == nhits) 177 if (i == nhits)
272 lower[0] = lower[1] = sarea_priv->height; 178 lower[0] = lower[1] = sarea_priv->height;
273 179
@@ -275,7 +181,7 @@ static void i915_vblank_tasklet(struct drm_device *dev)
275 drm_i915_vbl_swap_t *swap_hit = 181 drm_i915_vbl_swap_t *swap_hit =
276 list_entry(hit, drm_i915_vbl_swap_t, head); 182 list_entry(hit, drm_i915_vbl_swap_t, head);
277 struct drm_clip_rect *rect; 183 struct drm_clip_rect *rect;
278 int num_rects, plane, front, back; 184 int num_rects, pipe;
279 unsigned short top, bottom; 185 unsigned short top, bottom;
280 186
281 drw = drm_get_drawable_info(dev, swap_hit->drw_id); 187 drw = drm_get_drawable_info(dev, swap_hit->drw_id);
@@ -283,50 +189,10 @@ static void i915_vblank_tasklet(struct drm_device *dev)
283 if (!drw) 189 if (!drw)
284 continue; 190 continue;
285 191
286 plane = swap_hit->plane;
287
288 if (swap_hit->flip) {
289 i915_dispatch_vsync_flip(dev, drw, plane);
290 continue;
291 }
292
293 if (init_drawrect) {
294 int width = sarea_priv->width;
295 int height = sarea_priv->height;
296 if (IS_I965G(dev)) {
297 BEGIN_LP_RING(4);
298
299 OUT_RING(GFX_OP_DRAWRECT_INFO_I965);
300 OUT_RING(0);
301 OUT_RING(((width - 1) & 0xffff) | ((height - 1) << 16));
302 OUT_RING(0);
303
304 ADVANCE_LP_RING();
305 } else {
306 BEGIN_LP_RING(6);
307
308 OUT_RING(GFX_OP_DRAWRECT_INFO);
309 OUT_RING(0);
310 OUT_RING(0);
311 OUT_RING(((width - 1) & 0xffff) | ((height - 1) << 16));
312 OUT_RING(0);
313 OUT_RING(0);
314
315 ADVANCE_LP_RING();
316 }
317
318 sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT;
319
320 init_drawrect = 0;
321 }
322
323 rect = drw->rects; 192 rect = drw->rects;
324 top = upper[plane]; 193 pipe = swap_hit->pipe;
325 bottom = lower[plane]; 194 top = upper[pipe];
326 195 bottom = lower[pipe];
327 front = (dev_priv->sarea_priv->pf_current_page >>
328 (2 * plane)) & 0x3;
329 back = (front + 1) % num_pages;
330 196
331 for (num_rects = drw->num_rects; num_rects--; rect++) { 197 for (num_rects = drw->num_rects; num_rects--; rect++) {
332 int y1 = max(rect->y1, top); 198 int y1 = max(rect->y1, top);
@@ -341,17 +207,17 @@ static void i915_vblank_tasklet(struct drm_device *dev)
341 OUT_RING(ropcpp | dst_pitch); 207 OUT_RING(ropcpp | dst_pitch);
342 OUT_RING((y1 << 16) | rect->x1); 208 OUT_RING((y1 << 16) | rect->x1);
343 OUT_RING((y2 << 16) | rect->x2); 209 OUT_RING((y2 << 16) | rect->x2);
344 OUT_RING(offsets[front]); 210 OUT_RING(sarea_priv->front_offset);
345 OUT_RING((y1 << 16) | rect->x1); 211 OUT_RING((y1 << 16) | rect->x1);
346 OUT_RING(src_pitch); 212 OUT_RING(src_pitch);
347 OUT_RING(offsets[back]); 213 OUT_RING(sarea_priv->back_offset);
348 214
349 ADVANCE_LP_RING(); 215 ADVANCE_LP_RING();
350 } 216 }
351 } 217 }
352 } 218 }
353 219
354 spin_unlock(&dev->drw_lock); 220 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
355 221
356 list_for_each_safe(hit, tmp, &hits) { 222 list_for_each_safe(hit, tmp, &hits) {
357 drm_i915_vbl_swap_t *swap_hit = 223 drm_i915_vbl_swap_t *swap_hit =
@@ -363,112 +229,67 @@ static void i915_vblank_tasklet(struct drm_device *dev)
363 } 229 }
364} 230}
365 231
366u32 i915_get_vblank_counter(struct drm_device *dev, int plane)
367{
368 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
369 unsigned long high_frame;
370 unsigned long low_frame;
371 u32 high1, high2, low, count;
372 int pipe;
373
374 pipe = i915_get_pipe(dev, plane);
375 high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH;
376 low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL;
377
378 if (!i915_pipe_enabled(dev, pipe)) {
379 printk(KERN_ERR "trying to get vblank count for disabled "
380 "pipe %d\n", pipe);
381 return 0;
382 }
383
384 /*
385 * High & low register fields aren't synchronized, so make sure
386 * we get a low value that's stable across two reads of the high
387 * register.
388 */
389 do {
390 high1 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >>
391 PIPE_FRAME_HIGH_SHIFT);
392 low = ((I915_READ(low_frame) & PIPE_FRAME_LOW_MASK) >>
393 PIPE_FRAME_LOW_SHIFT);
394 high2 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >>
395 PIPE_FRAME_HIGH_SHIFT);
396 } while (high1 != high2);
397
398 count = (high1 << 8) | low;
399
400 /* count may be reset by other driver(e.g. 2D driver),
401 we have no way to know if it is wrapped or resetted
402 when count is zero. do a rough guess.
403 */
404 if (count == 0 && dev->last_vblank[pipe] < dev->max_vblank_count/2)
405 dev->last_vblank[pipe] = 0;
406
407 return count;
408}
409
410irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) 232irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
411{ 233{
412 struct drm_device *dev = (struct drm_device *) arg; 234 struct drm_device *dev = (struct drm_device *) arg;
413 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 235 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
414 u32 iir; 236 u16 temp;
415 u32 pipea_stats, pipeb_stats; 237 u32 pipea_stats, pipeb_stats;
416 int vblank = 0;
417
418 iir = I915_READ(I915REG_INT_IDENTITY_R);
419 if (iir == 0) {
420 DRM_DEBUG ("iir 0x%08x im 0x%08x ie 0x%08x pipea 0x%08x pipeb 0x%08x\n",
421 iir,
422 I915_READ(I915REG_INT_MASK_R),
423 I915_READ(I915REG_INT_ENABLE_R),
424 I915_READ(I915REG_PIPEASTAT),
425 I915_READ(I915REG_PIPEBSTAT));
426 return IRQ_NONE;
427 }
428 238
429 /* 239 pipea_stats = I915_READ(I915REG_PIPEASTAT);
430 * Clear the PIPE(A|B)STAT regs before the IIR otherwise 240 pipeb_stats = I915_READ(I915REG_PIPEBSTAT);
431 * we may get extra interrupts.
432 */
433 if (iir & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) {
434 pipea_stats = I915_READ(I915REG_PIPEASTAT);
435 if (pipea_stats & (I915_START_VBLANK_INTERRUPT_STATUS|
436 I915_VBLANK_INTERRUPT_STATUS))
437 {
438 vblank++;
439 drm_handle_vblank(dev, i915_get_plane(dev, 0));
440 }
441 I915_WRITE(I915REG_PIPEASTAT, pipea_stats);
442 }
443 if (iir & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) {
444 pipeb_stats = I915_READ(I915REG_PIPEBSTAT);
445 if (pipeb_stats & (I915_START_VBLANK_INTERRUPT_STATUS|
446 I915_VBLANK_INTERRUPT_STATUS))
447 {
448 vblank++;
449 drm_handle_vblank(dev, i915_get_plane(dev, 1));
450 }
451 I915_WRITE(I915REG_PIPEBSTAT, pipeb_stats);
452 }
453 241
454 if (dev_priv->sarea_priv) 242 temp = I915_READ16(I915REG_INT_IDENTITY_R);
455 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
456 243
457 I915_WRITE(I915REG_INT_IDENTITY_R, iir); 244 temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG);
458 (void) I915_READ(I915REG_INT_IDENTITY_R); /* Flush posted write */
459 245
460 if (iir & I915_USER_INTERRUPT) { 246 DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp);
247
248 if (temp == 0)
249 return IRQ_NONE;
250
251 I915_WRITE16(I915REG_INT_IDENTITY_R, temp);
252 (void) I915_READ16(I915REG_INT_IDENTITY_R);
253 DRM_READMEMORYBARRIER();
254
255 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
256
257 if (temp & USER_INT_FLAG)
461 DRM_WAKEUP(&dev_priv->irq_queue); 258 DRM_WAKEUP(&dev_priv->irq_queue);
462 } 259
463 if (vblank) { 260 if (temp & (VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG)) {
261 int vblank_pipe = dev_priv->vblank_pipe;
262
263 if ((vblank_pipe &
264 (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B))
265 == (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) {
266 if (temp & VSYNC_PIPEA_FLAG)
267 atomic_inc(&dev->vbl_received);
268 if (temp & VSYNC_PIPEB_FLAG)
269 atomic_inc(&dev->vbl_received2);
270 } else if (((temp & VSYNC_PIPEA_FLAG) &&
271 (vblank_pipe & DRM_I915_VBLANK_PIPE_A)) ||
272 ((temp & VSYNC_PIPEB_FLAG) &&
273 (vblank_pipe & DRM_I915_VBLANK_PIPE_B)))
274 atomic_inc(&dev->vbl_received);
275
276 DRM_WAKEUP(&dev->vbl_queue);
277 drm_vbl_send_signals(dev);
278
464 if (dev_priv->swaps_pending > 0) 279 if (dev_priv->swaps_pending > 0)
465 drm_locked_tasklet(dev, i915_vblank_tasklet); 280 drm_locked_tasklet(dev, i915_vblank_tasklet);
281 I915_WRITE(I915REG_PIPEASTAT,
282 pipea_stats|I915_VBLANK_INTERRUPT_ENABLE|
283 I915_VBLANK_CLEAR);
284 I915_WRITE(I915REG_PIPEBSTAT,
285 pipeb_stats|I915_VBLANK_INTERRUPT_ENABLE|
286 I915_VBLANK_CLEAR);
466 } 287 }
467 288
468 return IRQ_HANDLED; 289 return IRQ_HANDLED;
469} 290}
470 291
471static int i915_emit_irq(struct drm_device *dev) 292static int i915_emit_irq(struct drm_device * dev)
472{ 293{
473 drm_i915_private_t *dev_priv = dev->dev_private; 294 drm_i915_private_t *dev_priv = dev->dev_private;
474 RING_LOCALS; 295 RING_LOCALS;
@@ -515,12 +336,42 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
515 READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); 336 READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
516 } 337 }
517 338
518 if (dev_priv->sarea_priv) 339 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
519 dev_priv->sarea_priv->last_dispatch =
520 READ_BREADCRUMB(dev_priv);
521 return ret; 340 return ret;
522} 341}
523 342
343static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequence,
344 atomic_t *counter)
345{
346 drm_i915_private_t *dev_priv = dev->dev_private;
347 unsigned int cur_vblank;
348 int ret = 0;
349
350 if (!dev_priv) {
351 DRM_ERROR("called with no initialization\n");
352 return -EINVAL;
353 }
354
355 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
356 (((cur_vblank = atomic_read(counter))
357 - *sequence) <= (1<<23)));
358
359 *sequence = cur_vblank;
360
361 return ret;
362}
363
364
365int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence)
366{
367 return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received);
368}
369
370int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
371{
372 return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received2);
373}
374
524/* Needs the lock as it touches the ring. 375/* Needs the lock as it touches the ring.
525 */ 376 */
526int i915_irq_emit(struct drm_device *dev, void *data, 377int i915_irq_emit(struct drm_device *dev, void *data,
@@ -563,96 +414,18 @@ int i915_irq_wait(struct drm_device *dev, void *data,
563 return i915_wait_irq(dev, irqwait->irq_seq); 414 return i915_wait_irq(dev, irqwait->irq_seq);
564} 415}
565 416
566int i915_enable_vblank(struct drm_device *dev, int plane)
567{
568 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
569 int pipe = i915_get_pipe(dev, plane);
570 u32 pipestat_reg = 0;
571 u32 pipestat;
572
573 switch (pipe) {
574 case 0:
575 pipestat_reg = I915REG_PIPEASTAT;
576 dev_priv->irq_enable_reg |= I915_DISPLAY_PIPE_A_EVENT_INTERRUPT;
577 break;
578 case 1:
579 pipestat_reg = I915REG_PIPEBSTAT;
580 dev_priv->irq_enable_reg |= I915_DISPLAY_PIPE_B_EVENT_INTERRUPT;
581 break;
582 default:
583 DRM_ERROR("tried to enable vblank on non-existent pipe %d\n",
584 pipe);
585 break;
586 }
587
588 if (pipestat_reg)
589 {
590 pipestat = I915_READ (pipestat_reg);
591 /*
592 * Older chips didn't have the start vblank interrupt,
593 * but
594 */
595 if (IS_I965G (dev))
596 pipestat |= I915_START_VBLANK_INTERRUPT_ENABLE;
597 else
598 pipestat |= I915_VBLANK_INTERRUPT_ENABLE;
599 /*
600 * Clear any pending status
601 */
602 pipestat |= (I915_START_VBLANK_INTERRUPT_STATUS |
603 I915_VBLANK_INTERRUPT_STATUS);
604 I915_WRITE(pipestat_reg, pipestat);
605 }
606 I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg);
607
608 return 0;
609}
610
611void i915_disable_vblank(struct drm_device *dev, int plane)
612{
613 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
614 int pipe = i915_get_pipe(dev, plane);
615 u32 pipestat_reg = 0;
616 u32 pipestat;
617
618 switch (pipe) {
619 case 0:
620 pipestat_reg = I915REG_PIPEASTAT;
621 dev_priv->irq_enable_reg &= ~I915_DISPLAY_PIPE_A_EVENT_INTERRUPT;
622 break;
623 case 1:
624 pipestat_reg = I915REG_PIPEBSTAT;
625 dev_priv->irq_enable_reg &= ~I915_DISPLAY_PIPE_B_EVENT_INTERRUPT;
626 break;
627 default:
628 DRM_ERROR("tried to disable vblank on non-existent pipe %d\n",
629 pipe);
630 break;
631 }
632
633 I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg);
634 if (pipestat_reg)
635 {
636 pipestat = I915_READ (pipestat_reg);
637 pipestat &= ~(I915_START_VBLANK_INTERRUPT_ENABLE |
638 I915_VBLANK_INTERRUPT_ENABLE);
639 /*
640 * Clear any pending status
641 */
642 pipestat |= (I915_START_VBLANK_INTERRUPT_STATUS |
643 I915_VBLANK_INTERRUPT_STATUS);
644 I915_WRITE(pipestat_reg, pipestat);
645 }
646}
647
648static void i915_enable_interrupt (struct drm_device *dev) 417static void i915_enable_interrupt (struct drm_device *dev)
649{ 418{
650 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 419 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
420 u16 flag;
651 421
652 dev_priv->irq_enable_reg |= I915_USER_INTERRUPT; 422 flag = 0;
423 if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A)
424 flag |= VSYNC_PIPEA_FLAG;
425 if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B)
426 flag |= VSYNC_PIPEB_FLAG;
653 427
654 I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); 428 I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag);
655 dev_priv->irq_enabled = 1;
656} 429}
657 430
658/* Set the vblank monitor pipe 431/* Set the vblank monitor pipe
@@ -675,6 +448,8 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data,
675 448
676 dev_priv->vblank_pipe = pipe->pipe; 449 dev_priv->vblank_pipe = pipe->pipe;
677 450
451 i915_enable_interrupt (dev);
452
678 return 0; 453 return 0;
679} 454}
680 455
@@ -692,9 +467,9 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data,
692 467
693 flag = I915_READ(I915REG_INT_ENABLE_R); 468 flag = I915_READ(I915REG_INT_ENABLE_R);
694 pipe->pipe = 0; 469 pipe->pipe = 0;
695 if (flag & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) 470 if (flag & VSYNC_PIPEA_FLAG)
696 pipe->pipe |= DRM_I915_VBLANK_PIPE_A; 471 pipe->pipe |= DRM_I915_VBLANK_PIPE_A;
697 if (flag & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) 472 if (flag & VSYNC_PIPEB_FLAG)
698 pipe->pipe |= DRM_I915_VBLANK_PIPE_B; 473 pipe->pipe |= DRM_I915_VBLANK_PIPE_B;
699 474
700 return 0; 475 return 0;
@@ -709,30 +484,27 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
709 drm_i915_private_t *dev_priv = dev->dev_private; 484 drm_i915_private_t *dev_priv = dev->dev_private;
710 drm_i915_vblank_swap_t *swap = data; 485 drm_i915_vblank_swap_t *swap = data;
711 drm_i915_vbl_swap_t *vbl_swap; 486 drm_i915_vbl_swap_t *vbl_swap;
712 unsigned int pipe, seqtype, curseq, plane; 487 unsigned int pipe, seqtype, curseq;
713 unsigned long irqflags; 488 unsigned long irqflags;
714 struct list_head *list; 489 struct list_head *list;
715 int ret;
716 490
717 if (!dev_priv) { 491 if (!dev_priv) {
718 DRM_ERROR("%s called with no initialization\n", __func__); 492 DRM_ERROR("%s called with no initialization\n", __func__);
719 return -EINVAL; 493 return -EINVAL;
720 } 494 }
721 495
722 if (!dev_priv->sarea_priv || dev_priv->sarea_priv->rotation) { 496 if (dev_priv->sarea_priv->rotation) {
723 DRM_DEBUG("Rotation not supported\n"); 497 DRM_DEBUG("Rotation not supported\n");
724 return -EINVAL; 498 return -EINVAL;
725 } 499 }
726 500
727 if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | 501 if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE |
728 _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS | 502 _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) {
729 _DRM_VBLANK_FLIP)) {
730 DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); 503 DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype);
731 return -EINVAL; 504 return -EINVAL;
732 } 505 }
733 506
734 plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; 507 pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0;
735 pipe = i915_get_pipe(dev, plane);
736 508
737 seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); 509 seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE);
738 510
@@ -743,11 +515,6 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
743 515
744 spin_lock_irqsave(&dev->drw_lock, irqflags); 516 spin_lock_irqsave(&dev->drw_lock, irqflags);
745 517
746 /* It makes no sense to schedule a swap for a drawable that doesn't have
747 * valid information at this point. E.g. this could mean that the X
748 * server is too old to push drawable information to the DRM, in which
749 * case all such swaps would become ineffective.
750 */
751 if (!drm_get_drawable_info(dev, swap->drawable)) { 518 if (!drm_get_drawable_info(dev, swap->drawable)) {
752 spin_unlock_irqrestore(&dev->drw_lock, irqflags); 519 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
753 DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); 520 DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable);
@@ -756,8 +523,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
756 523
757 spin_unlock_irqrestore(&dev->drw_lock, irqflags); 524 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
758 525
759 drm_update_vblank_count(dev, pipe); 526 curseq = atomic_read(pipe ? &dev->vbl_received2 : &dev->vbl_received);
760 curseq = drm_vblank_count(dev, pipe);
761 527
762 if (seqtype == _DRM_VBLANK_RELATIVE) 528 if (seqtype == _DRM_VBLANK_RELATIVE)
763 swap->sequence += curseq; 529 swap->sequence += curseq;
@@ -771,43 +537,14 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
771 } 537 }
772 } 538 }
773 539
774 if (swap->seqtype & _DRM_VBLANK_FLIP) {
775 swap->sequence--;
776
777 if ((curseq - swap->sequence) <= (1<<23)) {
778 struct drm_drawable_info *drw;
779
780 LOCK_TEST_WITH_RETURN(dev, file_priv);
781
782 spin_lock_irqsave(&dev->drw_lock, irqflags);
783
784 drw = drm_get_drawable_info(dev, swap->drawable);
785
786 if (!drw) {
787 spin_unlock_irqrestore(&dev->drw_lock,
788 irqflags);
789 DRM_DEBUG("Invalid drawable ID %d\n",
790 swap->drawable);
791 return -EINVAL;
792 }
793
794 i915_dispatch_vsync_flip(dev, drw, plane);
795
796 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
797
798 return 0;
799 }
800 }
801
802 spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); 540 spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
803 541
804 list_for_each(list, &dev_priv->vbl_swaps.head) { 542 list_for_each(list, &dev_priv->vbl_swaps.head) {
805 vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head); 543 vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head);
806 544
807 if (vbl_swap->drw_id == swap->drawable && 545 if (vbl_swap->drw_id == swap->drawable &&
808 vbl_swap->plane == plane && 546 vbl_swap->pipe == pipe &&
809 vbl_swap->sequence == swap->sequence) { 547 vbl_swap->sequence == swap->sequence) {
810 vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP);
811 spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); 548 spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
812 DRM_DEBUG("Already scheduled\n"); 549 DRM_DEBUG("Already scheduled\n");
813 return 0; 550 return 0;
@@ -830,19 +567,9 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
830 567
831 DRM_DEBUG("\n"); 568 DRM_DEBUG("\n");
832 569
833 ret = drm_vblank_get(dev, pipe);
834 if (ret) {
835 drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER);
836 return ret;
837 }
838
839 vbl_swap->drw_id = swap->drawable; 570 vbl_swap->drw_id = swap->drawable;
840 vbl_swap->plane = plane; 571 vbl_swap->pipe = pipe;
841 vbl_swap->sequence = swap->sequence; 572 vbl_swap->sequence = swap->sequence;
842 vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP);
843
844 if (vbl_swap->flip)
845 swap->sequence++;
846 573
847 spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); 574 spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
848 575
@@ -860,57 +587,37 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
860{ 587{
861 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 588 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
862 589
863 I915_WRITE16(I915REG_HWSTAM, 0xeffe); 590 I915_WRITE16(I915REG_HWSTAM, 0xfffe);
864 I915_WRITE16(I915REG_INT_MASK_R, 0x0); 591 I915_WRITE16(I915REG_INT_MASK_R, 0x0);
865 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); 592 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0);
866} 593}
867 594
868int i915_driver_irq_postinstall(struct drm_device * dev) 595void i915_driver_irq_postinstall(struct drm_device * dev)
869{ 596{
870 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 597 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
871 int ret, num_pipes = 2;
872 598
873 spin_lock_init(&dev_priv->swaps_lock); 599 spin_lock_init(&dev_priv->swaps_lock);
874 INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); 600 INIT_LIST_HEAD(&dev_priv->vbl_swaps.head);
875 dev_priv->swaps_pending = 0; 601 dev_priv->swaps_pending = 0;
876 602
877 dev_priv->user_irq_refcount = 0; 603 if (!dev_priv->vblank_pipe)
878 dev_priv->irq_enable_reg = 0; 604 dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A;
879
880 ret = drm_vblank_init(dev, num_pipes);
881 if (ret)
882 return ret;
883
884 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
885
886 i915_enable_interrupt(dev); 605 i915_enable_interrupt(dev);
887 DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); 606 DRM_INIT_WAITQUEUE(&dev_priv->irq_queue);
888
889 /*
890 * Initialize the hardware status page IRQ location.
891 */
892
893 I915_WRITE(I915REG_INSTPM, (1 << 5) | (1 << 21));
894 return 0;
895} 607}
896 608
897void i915_driver_irq_uninstall(struct drm_device * dev) 609void i915_driver_irq_uninstall(struct drm_device * dev)
898{ 610{
899 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 611 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
900 u32 temp; 612 u16 temp;
901 613
902 if (!dev_priv) 614 if (!dev_priv)
903 return; 615 return;
904 616
905 dev_priv->irq_enabled = 0; 617 I915_WRITE16(I915REG_HWSTAM, 0xffff);
906 I915_WRITE(I915REG_HWSTAM, 0xffffffff); 618 I915_WRITE16(I915REG_INT_MASK_R, 0xffff);
907 I915_WRITE(I915REG_INT_MASK_R, 0xffffffff); 619 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0);
908 I915_WRITE(I915REG_INT_ENABLE_R, 0x0); 620
909 621 temp = I915_READ16(I915REG_INT_IDENTITY_R);
910 temp = I915_READ(I915REG_PIPEASTAT); 622 I915_WRITE16(I915REG_INT_IDENTITY_R, temp);
911 I915_WRITE(I915REG_PIPEASTAT, temp);
912 temp = I915_READ(I915REG_PIPEBSTAT);
913 I915_WRITE(I915REG_PIPEBSTAT, temp);
914 temp = I915_READ(I915REG_INT_IDENTITY_R);
915 I915_WRITE(I915REG_INT_IDENTITY_R, temp);
916} 623}
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 6b3790939e76..5572939fc7d1 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -45,16 +45,15 @@ static struct pci_device_id pciidlist[] = {
45static struct drm_driver driver = { 45static struct drm_driver driver = {
46 .driver_features = 46 .driver_features =
47 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | 47 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
48 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, 48 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
49 DRIVER_IRQ_VBL,
49 .dev_priv_size = sizeof(drm_mga_buf_priv_t), 50 .dev_priv_size = sizeof(drm_mga_buf_priv_t),
50 .load = mga_driver_load, 51 .load = mga_driver_load,
51 .unload = mga_driver_unload, 52 .unload = mga_driver_unload,
52 .lastclose = mga_driver_lastclose, 53 .lastclose = mga_driver_lastclose,
53 .dma_quiescent = mga_driver_dma_quiescent, 54 .dma_quiescent = mga_driver_dma_quiescent,
54 .device_is_agp = mga_driver_device_is_agp, 55 .device_is_agp = mga_driver_device_is_agp,
55 .get_vblank_counter = mga_get_vblank_counter, 56 .vblank_wait = mga_driver_vblank_wait,
56 .enable_vblank = mga_enable_vblank,
57 .disable_vblank = mga_disable_vblank,
58 .irq_preinstall = mga_driver_irq_preinstall, 57 .irq_preinstall = mga_driver_irq_preinstall,
59 .irq_postinstall = mga_driver_irq_postinstall, 58 .irq_postinstall = mga_driver_irq_postinstall,
60 .irq_uninstall = mga_driver_irq_uninstall, 59 .irq_uninstall = mga_driver_irq_uninstall,
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
index 8f7291f36363..f6ebd24bd587 100644
--- a/drivers/char/drm/mga_drv.h
+++ b/drivers/char/drm/mga_drv.h
@@ -120,7 +120,6 @@ typedef struct drm_mga_private {
120 u32 clear_cmd; 120 u32 clear_cmd;
121 u32 maccess; 121 u32 maccess;
122 122
123 atomic_t vbl_received; /**< Number of vblanks received. */
124 wait_queue_head_t fence_queue; 123 wait_queue_head_t fence_queue;
125 atomic_t last_fence_retired; 124 atomic_t last_fence_retired;
126 u32 next_fence_to_post; 125 u32 next_fence_to_post;
@@ -182,14 +181,11 @@ extern int mga_warp_install_microcode(drm_mga_private_t * dev_priv);
182extern int mga_warp_init(drm_mga_private_t * dev_priv); 181extern int mga_warp_init(drm_mga_private_t * dev_priv);
183 182
184 /* mga_irq.c */ 183 /* mga_irq.c */
185extern int mga_enable_vblank(struct drm_device *dev, int crtc);
186extern void mga_disable_vblank(struct drm_device *dev, int crtc);
187extern u32 mga_get_vblank_counter(struct drm_device *dev, int crtc);
188extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence); 184extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence);
189extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); 185extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
190extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS); 186extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS);
191extern void mga_driver_irq_preinstall(struct drm_device * dev); 187extern void mga_driver_irq_preinstall(struct drm_device * dev);
192extern int mga_driver_irq_postinstall(struct drm_device * dev); 188extern void mga_driver_irq_postinstall(struct drm_device * dev);
193extern void mga_driver_irq_uninstall(struct drm_device * dev); 189extern void mga_driver_irq_uninstall(struct drm_device * dev);
194extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, 190extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
195 unsigned long arg); 191 unsigned long arg);
diff --git a/drivers/char/drm/mga_irq.c b/drivers/char/drm/mga_irq.c
index 06852fb4b278..9302cb8f0f83 100644
--- a/drivers/char/drm/mga_irq.c
+++ b/drivers/char/drm/mga_irq.c
@@ -35,20 +35,6 @@
35#include "mga_drm.h" 35#include "mga_drm.h"
36#include "mga_drv.h" 36#include "mga_drv.h"
37 37
38u32 mga_get_vblank_counter(struct drm_device *dev, int crtc)
39{
40 const drm_mga_private_t *const dev_priv =
41 (drm_mga_private_t *) dev->dev_private;
42
43 if (crtc != 0) {
44 return 0;
45 }
46
47
48 return atomic_read(&dev_priv->vbl_received);
49}
50
51
52irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) 38irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
53{ 39{
54 struct drm_device *dev = (struct drm_device *) arg; 40 struct drm_device *dev = (struct drm_device *) arg;
@@ -61,8 +47,9 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
61 /* VBLANK interrupt */ 47 /* VBLANK interrupt */
62 if (status & MGA_VLINEPEN) { 48 if (status & MGA_VLINEPEN) {
63 MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR); 49 MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR);
64 atomic_inc(&dev_priv->vbl_received); 50 atomic_inc(&dev->vbl_received);
65 drm_handle_vblank(dev, 0); 51 DRM_WAKEUP(&dev->vbl_queue);
52 drm_vbl_send_signals(dev);
66 handled = 1; 53 handled = 1;
67 } 54 }
68 55
@@ -91,34 +78,22 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
91 return IRQ_NONE; 78 return IRQ_NONE;
92} 79}
93 80
94int mga_enable_vblank(struct drm_device *dev, int crtc) 81int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
95{ 82{
96 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 83 unsigned int cur_vblank;
97 84 int ret = 0;
98 if (crtc != 0) {
99 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
100 crtc);
101 return 0;
102 }
103
104 MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN);
105 return 0;
106}
107 85
86 /* Assume that the user has missed the current sequence number
87 * by about a day rather than she wants to wait for years
88 * using vertical blanks...
89 */
90 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
91 (((cur_vblank = atomic_read(&dev->vbl_received))
92 - *sequence) <= (1 << 23)));
108 93
109void mga_disable_vblank(struct drm_device *dev, int crtc) 94 *sequence = cur_vblank;
110{
111 if (crtc != 0) {
112 DRM_ERROR("tried to disable vblank on non-existent crtc %d\n",
113 crtc);
114 }
115 95
116 /* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have 96 return ret;
117 * a nice hardware counter that tracks the number of refreshes when
118 * the interrupt is disabled, and the kernel doesn't know the refresh
119 * rate to calculate an estimate.
120 */
121 /* MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); */
122} 97}
123 98
124int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence) 99int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence)
@@ -150,22 +125,14 @@ void mga_driver_irq_preinstall(struct drm_device * dev)
150 MGA_WRITE(MGA_ICLEAR, ~0); 125 MGA_WRITE(MGA_ICLEAR, ~0);
151} 126}
152 127
153int mga_driver_irq_postinstall(struct drm_device * dev) 128void mga_driver_irq_postinstall(struct drm_device * dev)
154{ 129{
155 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 130 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
156 int ret;
157
158 ret = drm_vblank_init(dev, 1);
159 if (ret)
160 return ret;
161 131
162 DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); 132 DRM_INIT_WAITQUEUE(&dev_priv->fence_queue);
163 133
164 /* Turn on soft trap interrupt. Vertical blank interrupts are enabled 134 /* Turn on vertical blank interrupt and soft trap interrupt. */
165 * in mga_enable_vblank. 135 MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN);
166 */
167 MGA_WRITE(MGA_IEN, MGA_SOFTRAPEN);
168 return 0;
169} 136}
170 137
171void mga_driver_irq_uninstall(struct drm_device * dev) 138void mga_driver_irq_uninstall(struct drm_device * dev)
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c
index 2888aa01ebc7..6108e7587e12 100644
--- a/drivers/char/drm/r128_drv.c
+++ b/drivers/char/drm/r128_drv.c
@@ -43,13 +43,12 @@ static struct pci_device_id pciidlist[] = {
43static struct drm_driver driver = { 43static struct drm_driver driver = {
44 .driver_features = 44 .driver_features =
45 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | 45 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
46 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, 46 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
47 DRIVER_IRQ_VBL,
47 .dev_priv_size = sizeof(drm_r128_buf_priv_t), 48 .dev_priv_size = sizeof(drm_r128_buf_priv_t),
48 .preclose = r128_driver_preclose, 49 .preclose = r128_driver_preclose,
49 .lastclose = r128_driver_lastclose, 50 .lastclose = r128_driver_lastclose,
50 .get_vblank_counter = r128_get_vblank_counter, 51 .vblank_wait = r128_driver_vblank_wait,
51 .enable_vblank = r128_enable_vblank,
52 .disable_vblank = r128_disable_vblank,
53 .irq_preinstall = r128_driver_irq_preinstall, 52 .irq_preinstall = r128_driver_irq_preinstall,
54 .irq_postinstall = r128_driver_irq_postinstall, 53 .irq_postinstall = r128_driver_irq_postinstall,
55 .irq_uninstall = r128_driver_irq_uninstall, 54 .irq_uninstall = r128_driver_irq_uninstall,
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
index 80af9e09e75d..011105e51ac6 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -97,8 +97,6 @@ typedef struct drm_r128_private {
97 u32 crtc_offset; 97 u32 crtc_offset;
98 u32 crtc_offset_cntl; 98 u32 crtc_offset_cntl;
99 99
100 atomic_t vbl_received;
101
102 u32 color_fmt; 100 u32 color_fmt;
103 unsigned int front_offset; 101 unsigned int front_offset;
104 unsigned int front_pitch; 102 unsigned int front_pitch;
@@ -151,12 +149,11 @@ extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n);
151extern int r128_do_cce_idle(drm_r128_private_t * dev_priv); 149extern int r128_do_cce_idle(drm_r128_private_t * dev_priv);
152extern int r128_do_cleanup_cce(struct drm_device * dev); 150extern int r128_do_cleanup_cce(struct drm_device * dev);
153 151
154extern int r128_enable_vblank(struct drm_device *dev, int crtc); 152extern int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
155extern void r128_disable_vblank(struct drm_device *dev, int crtc); 153
156extern u32 r128_get_vblank_counter(struct drm_device *dev, int crtc);
157extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); 154extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS);
158extern void r128_driver_irq_preinstall(struct drm_device * dev); 155extern void r128_driver_irq_preinstall(struct drm_device * dev);
159extern int r128_driver_irq_postinstall(struct drm_device * dev); 156extern void r128_driver_irq_postinstall(struct drm_device * dev);
160extern void r128_driver_irq_uninstall(struct drm_device * dev); 157extern void r128_driver_irq_uninstall(struct drm_device * dev);
161extern void r128_driver_lastclose(struct drm_device * dev); 158extern void r128_driver_lastclose(struct drm_device * dev);
162extern void r128_driver_preclose(struct drm_device * dev, 159extern void r128_driver_preclose(struct drm_device * dev,
diff --git a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c
index 5b95bd898f95..c76fdca7662d 100644
--- a/drivers/char/drm/r128_irq.c
+++ b/drivers/char/drm/r128_irq.c
@@ -35,16 +35,6 @@
35#include "r128_drm.h" 35#include "r128_drm.h"
36#include "r128_drv.h" 36#include "r128_drv.h"
37 37
38u32 r128_get_vblank_counter(struct drm_device *dev, int crtc)
39{
40 const drm_r128_private_t *dev_priv = dev->dev_private;
41
42 if (crtc != 0)
43 return 0;
44
45 return atomic_read(&dev_priv->vbl_received);
46}
47
48irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) 38irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS)
49{ 39{
50 struct drm_device *dev = (struct drm_device *) arg; 40 struct drm_device *dev = (struct drm_device *) arg;
@@ -56,38 +46,30 @@ irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS)
56 /* VBLANK interrupt */ 46 /* VBLANK interrupt */
57 if (status & R128_CRTC_VBLANK_INT) { 47 if (status & R128_CRTC_VBLANK_INT) {
58 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); 48 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK);
59 atomic_inc(&dev_priv->vbl_received); 49 atomic_inc(&dev->vbl_received);
60 drm_handle_vblank(dev, 0); 50 DRM_WAKEUP(&dev->vbl_queue);
51 drm_vbl_send_signals(dev);
61 return IRQ_HANDLED; 52 return IRQ_HANDLED;
62 } 53 }
63 return IRQ_NONE; 54 return IRQ_NONE;
64} 55}
65 56
66int r128_enable_vblank(struct drm_device *dev, int crtc) 57int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
67{ 58{
68 drm_r128_private_t *dev_priv = dev->dev_private; 59 unsigned int cur_vblank;
69 60 int ret = 0;
70 if (crtc != 0) {
71 DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc);
72 return -EINVAL;
73 }
74 61
75 R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN); 62 /* Assume that the user has missed the current sequence number
76 return 0; 63 * by about a day rather than she wants to wait for years
77} 64 * using vertical blanks...
65 */
66 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
67 (((cur_vblank = atomic_read(&dev->vbl_received))
68 - *sequence) <= (1 << 23)));
78 69
79void r128_disable_vblank(struct drm_device *dev, int crtc) 70 *sequence = cur_vblank;
80{
81 if (crtc != 0)
82 DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc);
83 71
84 /* 72 return ret;
85 * FIXME: implement proper interrupt disable by using the vblank
86 * counter register (if available)
87 *
88 * R128_WRITE(R128_GEN_INT_CNTL,
89 * R128_READ(R128_GEN_INT_CNTL) & ~R128_CRTC_VBLANK_INT_EN);
90 */
91} 73}
92 74
93void r128_driver_irq_preinstall(struct drm_device * dev) 75void r128_driver_irq_preinstall(struct drm_device * dev)
@@ -100,9 +82,12 @@ void r128_driver_irq_preinstall(struct drm_device * dev)
100 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); 82 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK);
101} 83}
102 84
103int r128_driver_irq_postinstall(struct drm_device * dev) 85void r128_driver_irq_postinstall(struct drm_device * dev)
104{ 86{
105 return drm_vblank_init(dev, 1); 87 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
88
89 /* Turn on VBL interrupt */
90 R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN);
106} 91}
107 92
108void r128_driver_irq_uninstall(struct drm_device * dev) 93void r128_driver_irq_uninstall(struct drm_device * dev)
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index a2610319624d..349ac3d3b848 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -59,7 +59,8 @@ static struct pci_device_id pciidlist[] = {
59static struct drm_driver driver = { 59static struct drm_driver driver = {
60 .driver_features = 60 .driver_features =
61 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | 61 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
62 DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED, 62 DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED |
63 DRIVER_IRQ_VBL | DRIVER_IRQ_VBL2,
63 .dev_priv_size = sizeof(drm_radeon_buf_priv_t), 64 .dev_priv_size = sizeof(drm_radeon_buf_priv_t),
64 .load = radeon_driver_load, 65 .load = radeon_driver_load,
65 .firstopen = radeon_driver_firstopen, 66 .firstopen = radeon_driver_firstopen,
@@ -68,9 +69,8 @@ static struct drm_driver driver = {
68 .postclose = radeon_driver_postclose, 69 .postclose = radeon_driver_postclose,
69 .lastclose = radeon_driver_lastclose, 70 .lastclose = radeon_driver_lastclose,
70 .unload = radeon_driver_unload, 71 .unload = radeon_driver_unload,
71 .get_vblank_counter = radeon_get_vblank_counter, 72 .vblank_wait = radeon_driver_vblank_wait,
72 .enable_vblank = radeon_enable_vblank, 73 .vblank_wait2 = radeon_driver_vblank_wait2,
73 .disable_vblank = radeon_disable_vblank,
74 .dri_library_name = dri_library_name, 74 .dri_library_name = dri_library_name,
75 .irq_preinstall = radeon_driver_irq_preinstall, 75 .irq_preinstall = radeon_driver_irq_preinstall,
76 .irq_postinstall = radeon_driver_irq_postinstall, 76 .irq_postinstall = radeon_driver_irq_postinstall,
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index b791420bd3d9..173ae620223a 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -304,9 +304,6 @@ typedef struct drm_radeon_private {
304 304
305 u32 scratch_ages[5]; 305 u32 scratch_ages[5];
306 306
307 unsigned int crtc_last_cnt;
308 unsigned int crtc2_last_cnt;
309
310 /* starting from here on, data is preserved accross an open */ 307 /* starting from here on, data is preserved accross an open */
311 uint32_t flags; /* see radeon_chip_flags */ 308 uint32_t flags; /* see radeon_chip_flags */
312 unsigned long fb_aper_offset; 309 unsigned long fb_aper_offset;
@@ -377,13 +374,13 @@ extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *
377extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); 374extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv);
378 375
379extern void radeon_do_release(struct drm_device * dev); 376extern void radeon_do_release(struct drm_device * dev);
380extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc); 377extern int radeon_driver_vblank_wait(struct drm_device * dev,
381extern int radeon_enable_vblank(struct drm_device *dev, int crtc); 378 unsigned int *sequence);
382extern void radeon_disable_vblank(struct drm_device *dev, int crtc); 379extern int radeon_driver_vblank_wait2(struct drm_device * dev,
383extern void radeon_do_release(struct drm_device * dev); 380 unsigned int *sequence);
384extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); 381extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS);
385extern void radeon_driver_irq_preinstall(struct drm_device * dev); 382extern void radeon_driver_irq_preinstall(struct drm_device * dev);
386extern int radeon_driver_irq_postinstall(struct drm_device * dev); 383extern void radeon_driver_irq_postinstall(struct drm_device * dev);
387extern void radeon_driver_irq_uninstall(struct drm_device * dev); 384extern void radeon_driver_irq_uninstall(struct drm_device * dev);
388extern int radeon_vblank_crtc_get(struct drm_device *dev); 385extern int radeon_vblank_crtc_get(struct drm_device *dev);
389extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value); 386extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value);
@@ -561,12 +558,6 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
561 ? DRM_READ32( dev_priv->ring_rptr, RADEON_SCRATCHOFF(x) ) \ 558 ? DRM_READ32( dev_priv->ring_rptr, RADEON_SCRATCHOFF(x) ) \
562 : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) ) 559 : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) )
563 560
564#define RADEON_CRTC_CRNT_FRAME 0x0214
565#define RADEON_CRTC2_CRNT_FRAME 0x0314
566
567#define RADEON_CRTC_STATUS 0x005c
568#define RADEON_CRTC2_STATUS 0x03fc
569
570#define RADEON_GEN_INT_CNTL 0x0040 561#define RADEON_GEN_INT_CNTL 0x0040
571# define RADEON_CRTC_VBLANK_MASK (1 << 0) 562# define RADEON_CRTC_VBLANK_MASK (1 << 0)
572# define RADEON_CRTC2_VBLANK_MASK (1 << 9) 563# define RADEON_CRTC2_VBLANK_MASK (1 << 9)
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
index 507d6b747a13..009af3814b6f 100644
--- a/drivers/char/drm/radeon_irq.c
+++ b/drivers/char/drm/radeon_irq.c
@@ -35,61 +35,12 @@
35#include "radeon_drm.h" 35#include "radeon_drm.h"
36#include "radeon_drv.h" 36#include "radeon_drv.h"
37 37
38static void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state) 38static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv,
39 u32 mask)
39{ 40{
40 drm_radeon_private_t *dev_priv = dev->dev_private; 41 u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & mask;
41
42 if (state)
43 dev_priv->irq_enable_reg |= mask;
44 else
45 dev_priv->irq_enable_reg &= ~mask;
46
47 RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
48}
49
50int radeon_enable_vblank(struct drm_device *dev, int crtc)
51{
52 switch (crtc) {
53 case 0:
54 radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1);
55 break;
56 case 1:
57 radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1);
58 break;
59 default:
60 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
61 crtc);
62 return EINVAL;
63 }
64
65 return 0;
66}
67
68void radeon_disable_vblank(struct drm_device *dev, int crtc)
69{
70 switch (crtc) {
71 case 0:
72 radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0);
73 break;
74 case 1:
75 radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0);
76 break;
77 default:
78 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
79 crtc);
80 break;
81 }
82}
83
84static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv)
85{
86 u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) &
87 (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT |
88 RADEON_CRTC2_VBLANK_STAT);
89
90 if (irqs) 42 if (irqs)
91 RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs); 43 RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs);
92
93 return irqs; 44 return irqs;
94} 45}
95 46
@@ -121,21 +72,39 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
121 /* Only consider the bits we're interested in - others could be used 72 /* Only consider the bits we're interested in - others could be used
122 * outside the DRM 73 * outside the DRM
123 */ 74 */
124 stat = radeon_acknowledge_irqs(dev_priv); 75 stat = radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
76 RADEON_CRTC_VBLANK_STAT |
77 RADEON_CRTC2_VBLANK_STAT));
125 if (!stat) 78 if (!stat)
126 return IRQ_NONE; 79 return IRQ_NONE;
127 80
128 stat &= dev_priv->irq_enable_reg; 81 stat &= dev_priv->irq_enable_reg;
129 82
130 /* SW interrupt */ 83 /* SW interrupt */
131 if (stat & RADEON_SW_INT_TEST) 84 if (stat & RADEON_SW_INT_TEST) {
132 DRM_WAKEUP(&dev_priv->swi_queue); 85 DRM_WAKEUP(&dev_priv->swi_queue);
86 }
133 87
134 /* VBLANK interrupt */ 88 /* VBLANK interrupt */
135 if (stat & RADEON_CRTC_VBLANK_STAT) 89 if (stat & (RADEON_CRTC_VBLANK_STAT|RADEON_CRTC2_VBLANK_STAT)) {
136 drm_handle_vblank(dev, 0); 90 int vblank_crtc = dev_priv->vblank_crtc;
137 if (stat & RADEON_CRTC2_VBLANK_STAT) 91
138 drm_handle_vblank(dev, 1); 92 if ((vblank_crtc &
93 (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) ==
94 (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
95 if (stat & RADEON_CRTC_VBLANK_STAT)
96 atomic_inc(&dev->vbl_received);
97 if (stat & RADEON_CRTC2_VBLANK_STAT)
98 atomic_inc(&dev->vbl_received2);
99 } else if (((stat & RADEON_CRTC_VBLANK_STAT) &&
100 (vblank_crtc & DRM_RADEON_VBLANK_CRTC1)) ||
101 ((stat & RADEON_CRTC2_VBLANK_STAT) &&
102 (vblank_crtc & DRM_RADEON_VBLANK_CRTC2)))
103 atomic_inc(&dev->vbl_received);
104
105 DRM_WAKEUP(&dev->vbl_queue);
106 drm_vbl_send_signals(dev);
107 }
139 108
140 return IRQ_HANDLED; 109 return IRQ_HANDLED;
141} 110}
@@ -175,27 +144,54 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr)
175 return ret; 144 return ret;
176} 145}
177 146
178u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc) 147static int radeon_driver_vblank_do_wait(struct drm_device * dev,
148 unsigned int *sequence, int crtc)
179{ 149{
180 drm_radeon_private_t *dev_priv = dev->dev_private; 150 drm_radeon_private_t *dev_priv =
181 u32 crtc_cnt_reg, crtc_status_reg; 151 (drm_radeon_private_t *) dev->dev_private;
182 152 unsigned int cur_vblank;
153 int ret = 0;
154 int ack = 0;
155 atomic_t *counter;
183 if (!dev_priv) { 156 if (!dev_priv) {
184 DRM_ERROR("called with no initialization\n"); 157 DRM_ERROR("called with no initialization\n");
185 return -EINVAL; 158 return -EINVAL;
186 } 159 }
187 160
188 if (crtc == 0) { 161 if (crtc == DRM_RADEON_VBLANK_CRTC1) {
189 crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME; 162 counter = &dev->vbl_received;
190 crtc_status_reg = RADEON_CRTC_STATUS; 163 ack |= RADEON_CRTC_VBLANK_STAT;
191 } else if (crtc == 1) { 164 } else if (crtc == DRM_RADEON_VBLANK_CRTC2) {
192 crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME; 165 counter = &dev->vbl_received2;
193 crtc_status_reg = RADEON_CRTC2_STATUS; 166 ack |= RADEON_CRTC2_VBLANK_STAT;
194 } else { 167 } else
195 return -EINVAL; 168 return -EINVAL;
196 }
197 169
198 return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1); 170 radeon_acknowledge_irqs(dev_priv, ack);
171
172 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
173
174 /* Assume that the user has missed the current sequence number
175 * by about a day rather than she wants to wait for years
176 * using vertical blanks...
177 */
178 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
179 (((cur_vblank = atomic_read(counter))
180 - *sequence) <= (1 << 23)));
181
182 *sequence = cur_vblank;
183
184 return ret;
185}
186
187int radeon_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence)
188{
189 return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC1);
190}
191
192int radeon_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
193{
194 return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC2);
199} 195}
200 196
201/* Needs the lock as it touches the ring. 197/* Needs the lock as it touches the ring.
@@ -238,6 +234,21 @@ int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_pr
238 return radeon_wait_irq(dev, irqwait->irq_seq); 234 return radeon_wait_irq(dev, irqwait->irq_seq);
239} 235}
240 236
237static void radeon_enable_interrupt(struct drm_device *dev)
238{
239 drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
240
241 dev_priv->irq_enable_reg = RADEON_SW_INT_ENABLE;
242 if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC1)
243 dev_priv->irq_enable_reg |= RADEON_CRTC_VBLANK_MASK;
244
245 if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC2)
246 dev_priv->irq_enable_reg |= RADEON_CRTC2_VBLANK_MASK;
247
248 RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
249 dev_priv->irq_enabled = 1;
250}
251
241/* drm_dma.h hooks 252/* drm_dma.h hooks
242*/ 253*/
243void radeon_driver_irq_preinstall(struct drm_device * dev) 254void radeon_driver_irq_preinstall(struct drm_device * dev)
@@ -249,27 +260,20 @@ void radeon_driver_irq_preinstall(struct drm_device * dev)
249 RADEON_WRITE(RADEON_GEN_INT_CNTL, 0); 260 RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
250 261
251 /* Clear bits if they're already high */ 262 /* Clear bits if they're already high */
252 radeon_acknowledge_irqs(dev_priv); 263 radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
264 RADEON_CRTC_VBLANK_STAT |
265 RADEON_CRTC2_VBLANK_STAT));
253} 266}
254 267
255int radeon_driver_irq_postinstall(struct drm_device * dev) 268void radeon_driver_irq_postinstall(struct drm_device * dev)
256{ 269{
257 drm_radeon_private_t *dev_priv = 270 drm_radeon_private_t *dev_priv =
258 (drm_radeon_private_t *) dev->dev_private; 271 (drm_radeon_private_t *) dev->dev_private;
259 int ret;
260 272
261 atomic_set(&dev_priv->swi_emitted, 0); 273 atomic_set(&dev_priv->swi_emitted, 0);
262 DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); 274 DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
263 275
264 ret = drm_vblank_init(dev, 2); 276 radeon_enable_interrupt(dev);
265 if (ret)
266 return ret;
267
268 dev->max_vblank_count = 0x001fffff;
269
270 radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
271
272 return 0;
273} 277}
274 278
275void radeon_driver_irq_uninstall(struct drm_device * dev) 279void radeon_driver_irq_uninstall(struct drm_device * dev)
@@ -311,5 +315,6 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value)
311 return -EINVAL; 315 return -EINVAL;
312 } 316 }
313 dev_priv->vblank_crtc = (unsigned int)value; 317 dev_priv->vblank_crtc = (unsigned int)value;
318 radeon_enable_interrupt(dev);
314 return 0; 319 return 0;
315} 320}
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c
index 37870a4a3dc7..80c01cdfa37d 100644
--- a/drivers/char/drm/via_drv.c
+++ b/drivers/char/drm/via_drv.c
@@ -40,13 +40,11 @@ static struct pci_device_id pciidlist[] = {
40static struct drm_driver driver = { 40static struct drm_driver driver = {
41 .driver_features = 41 .driver_features =
42 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | 42 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ |
43 DRIVER_IRQ_SHARED, 43 DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL,
44 .load = via_driver_load, 44 .load = via_driver_load,
45 .unload = via_driver_unload, 45 .unload = via_driver_unload,
46 .context_dtor = via_final_context, 46 .context_dtor = via_final_context,
47 .get_vblank_counter = via_get_vblank_counter, 47 .vblank_wait = via_driver_vblank_wait,
48 .enable_vblank = via_enable_vblank,
49 .disable_vblank = via_disable_vblank,
50 .irq_preinstall = via_driver_irq_preinstall, 48 .irq_preinstall = via_driver_irq_preinstall,
51 .irq_postinstall = via_driver_irq_postinstall, 49 .irq_postinstall = via_driver_irq_postinstall,
52 .irq_uninstall = via_driver_irq_uninstall, 50 .irq_uninstall = via_driver_irq_uninstall,
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h
index fe67030e39ac..2daae81874cd 100644
--- a/drivers/char/drm/via_drv.h
+++ b/drivers/char/drm/via_drv.h
@@ -75,7 +75,6 @@ typedef struct drm_via_private {
75 struct timeval last_vblank; 75 struct timeval last_vblank;
76 int last_vblank_valid; 76 int last_vblank_valid;
77 unsigned usec_per_vblank; 77 unsigned usec_per_vblank;
78 atomic_t vbl_received;
79 drm_via_state_t hc_state; 78 drm_via_state_t hc_state;
80 char pci_buf[VIA_PCI_BUF_SIZE]; 79 char pci_buf[VIA_PCI_BUF_SIZE];
81 const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE]; 80 const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE];
@@ -131,13 +130,11 @@ extern int via_init_context(struct drm_device * dev, int context);
131extern int via_final_context(struct drm_device * dev, int context); 130extern int via_final_context(struct drm_device * dev, int context);
132 131
133extern int via_do_cleanup_map(struct drm_device * dev); 132extern int via_do_cleanup_map(struct drm_device * dev);
134extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc); 133extern int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
135extern int via_enable_vblank(struct drm_device *dev, int crtc);
136extern void via_disable_vblank(struct drm_device *dev, int crtc);
137 134
138extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); 135extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
139extern void via_driver_irq_preinstall(struct drm_device * dev); 136extern void via_driver_irq_preinstall(struct drm_device * dev);
140extern int via_driver_irq_postinstall(struct drm_device * dev); 137extern void via_driver_irq_postinstall(struct drm_device * dev);
141extern void via_driver_irq_uninstall(struct drm_device * dev); 138extern void via_driver_irq_uninstall(struct drm_device * dev);
142 139
143extern int via_dma_cleanup(struct drm_device * dev); 140extern int via_dma_cleanup(struct drm_device * dev);
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c
index f1ab6fc7c07e..c6bb978a1106 100644
--- a/drivers/char/drm/via_irq.c
+++ b/drivers/char/drm/via_irq.c
@@ -92,17 +92,8 @@ static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1};
92static unsigned time_diff(struct timeval *now, struct timeval *then) 92static unsigned time_diff(struct timeval *now, struct timeval *then)
93{ 93{
94 return (now->tv_usec >= then->tv_usec) ? 94 return (now->tv_usec >= then->tv_usec) ?
95 now->tv_usec - then->tv_usec : 95 now->tv_usec - then->tv_usec :
96 1000000 - (then->tv_usec - now->tv_usec); 96 1000000 - (then->tv_usec - now->tv_usec);
97}
98
99u32 via_get_vblank_counter(struct drm_device *dev, int crtc)
100{
101 drm_via_private_t *dev_priv = dev->dev_private;
102 if (crtc != 0)
103 return 0;
104
105 return atomic_read(&dev_priv->vbl_received);
106} 97}
107 98
108irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) 99irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
@@ -117,8 +108,8 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
117 108
118 status = VIA_READ(VIA_REG_INTERRUPT); 109 status = VIA_READ(VIA_REG_INTERRUPT);
119 if (status & VIA_IRQ_VBLANK_PENDING) { 110 if (status & VIA_IRQ_VBLANK_PENDING) {
120 atomic_inc(&dev_priv->vbl_received); 111 atomic_inc(&dev->vbl_received);
121 if (!(atomic_read(&dev_priv->vbl_received) & 0x0F)) { 112 if (!(atomic_read(&dev->vbl_received) & 0x0F)) {
122 do_gettimeofday(&cur_vblank); 113 do_gettimeofday(&cur_vblank);
123 if (dev_priv->last_vblank_valid) { 114 if (dev_priv->last_vblank_valid) {
124 dev_priv->usec_per_vblank = 115 dev_priv->usec_per_vblank =
@@ -128,11 +119,12 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
128 dev_priv->last_vblank = cur_vblank; 119 dev_priv->last_vblank = cur_vblank;
129 dev_priv->last_vblank_valid = 1; 120 dev_priv->last_vblank_valid = 1;
130 } 121 }
131 if (!(atomic_read(&dev_priv->vbl_received) & 0xFF)) { 122 if (!(atomic_read(&dev->vbl_received) & 0xFF)) {
132 DRM_DEBUG("US per vblank is: %u\n", 123 DRM_DEBUG("US per vblank is: %u\n",
133 dev_priv->usec_per_vblank); 124 dev_priv->usec_per_vblank);
134 } 125 }
135 drm_handle_vblank(dev, 0); 126 DRM_WAKEUP(&dev->vbl_queue);
127 drm_vbl_send_signals(dev);
136 handled = 1; 128 handled = 1;
137 } 129 }
138 130
@@ -171,34 +163,31 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv)
171 } 163 }
172} 164}
173 165
174int via_enable_vblank(struct drm_device *dev, int crtc) 166int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
175{ 167{
176 drm_via_private_t *dev_priv = dev->dev_private; 168 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
177 u32 status; 169 unsigned int cur_vblank;
170 int ret = 0;
178 171
179 if (crtc != 0) { 172 DRM_DEBUG("\n");
180 DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); 173 if (!dev_priv) {
174 DRM_ERROR("called with no initialization\n");
181 return -EINVAL; 175 return -EINVAL;
182 } 176 }
183 177
184 status = VIA_READ(VIA_REG_INTERRUPT); 178 viadrv_acknowledge_irqs(dev_priv);
185 VIA_WRITE(VIA_REG_INTERRUPT, status & VIA_IRQ_VBLANK_ENABLE);
186 179
187 VIA_WRITE8(0x83d4, 0x11); 180 /* Assume that the user has missed the current sequence number
188 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); 181 * by about a day rather than she wants to wait for years
182 * using vertical blanks...
183 */
189 184
190 return 0; 185 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
191} 186 (((cur_vblank = atomic_read(&dev->vbl_received)) -
187 *sequence) <= (1 << 23)));
192 188
193void via_disable_vblank(struct drm_device *dev, int crtc) 189 *sequence = cur_vblank;
194{ 190 return ret;
195 drm_via_private_t *dev_priv = dev->dev_private;
196
197 VIA_WRITE8(0x83d4, 0x11);
198 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30);
199
200 if (crtc != 0)
201 DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc);
202} 191}
203 192
204static int 193static int
@@ -303,25 +292,23 @@ void via_driver_irq_preinstall(struct drm_device * dev)
303 } 292 }
304} 293}
305 294
306int via_driver_irq_postinstall(struct drm_device * dev) 295void via_driver_irq_postinstall(struct drm_device * dev)
307{ 296{
308 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 297 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
309 u32 status; 298 u32 status;
310 299
311 DRM_DEBUG("via_driver_irq_postinstall\n"); 300 DRM_DEBUG("\n");
312 if (!dev_priv) 301 if (dev_priv) {
313 return -EINVAL; 302 status = VIA_READ(VIA_REG_INTERRUPT);
303 VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL
304 | dev_priv->irq_enable_mask);
314 305
315 drm_vblank_init(dev, 1); 306 /* Some magic, oh for some data sheets ! */
316 status = VIA_READ(VIA_REG_INTERRUPT);
317 VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL
318 | dev_priv->irq_enable_mask);
319 307
320 /* Some magic, oh for some data sheets ! */ 308 VIA_WRITE8(0x83d4, 0x11);
321 VIA_WRITE8(0x83d4, 0x11); 309 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30);
322 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30);
323 310
324 return 0; 311 }
325} 312}
326 313
327void via_driver_irq_uninstall(struct drm_device * dev) 314void via_driver_irq_uninstall(struct drm_device * dev)
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index 2398e864c28d..a00869c650d5 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -133,7 +133,7 @@ static struct miscdevice nvram_dev = {
133 133
134int __init nvram_init(void) 134int __init nvram_init(void)
135{ 135{
136 printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n", 136 printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
137 NVRAM_VERSION); 137 NVRAM_VERSION);
138 return misc_register(&nvram_dev); 138 return misc_register(&nvram_dev);
139} 139}
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 8d6c2089d2a8..efd0b4db7c8e 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -112,3 +112,12 @@ config HW_RANDOM_PASEMI
112 112
113 If unsure, say Y. 113 If unsure, say Y.
114 114
115config HW_RANDOM_VIRTIO
116 tristate "VirtIO Random Number Generator support"
117 depends on HW_RANDOM && VIRTIO
118 ---help---
119 This driver provides kernel-side support for the virtual Random Number
120 Generator hardware.
121
122 To compile this driver as a module, choose M here: the
123 module will be called virtio-rng. If unsure, say N.
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index c8b7300e2fb1..b4940ddbb35f 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o
11obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o 11obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o
12obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o 12obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o
13obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o 13obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o
14obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c
index 5cc651ef75eb..27fdc0866496 100644
--- a/drivers/char/hw_random/intel-rng.c
+++ b/drivers/char/hw_random/intel-rng.c
@@ -273,7 +273,7 @@ static int __init intel_rng_hw_init(void *_intel_rng_hw)
273 if (mfc != INTEL_FWH_MANUFACTURER_CODE || 273 if (mfc != INTEL_FWH_MANUFACTURER_CODE ||
274 (dvc != INTEL_FWH_DEVICE_CODE_8M && 274 (dvc != INTEL_FWH_DEVICE_CODE_8M &&
275 dvc != INTEL_FWH_DEVICE_CODE_4M)) { 275 dvc != INTEL_FWH_DEVICE_CODE_4M)) {
276 printk(KERN_ERR PFX "FWH not detected\n"); 276 printk(KERN_NOTICE PFX "FWH not detected\n");
277 return -ENODEV; 277 return -ENODEV;
278 } 278 }
279 279
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
new file mode 100644
index 000000000000..d0e563e4fc39
--- /dev/null
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -0,0 +1,155 @@
1/*
2 * Randomness driver for virtio
3 * Copyright (C) 2007, 2008 Rusty Russell IBM Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/err.h>
20#include <linux/hw_random.h>
21#include <linux/scatterlist.h>
22#include <linux/spinlock.h>
23#include <linux/virtio.h>
24#include <linux/virtio_rng.h>
25
26/* The host will fill any buffer we give it with sweet, sweet randomness. We
27 * give it 64 bytes at a time, and the hwrng framework takes it 4 bytes at a
28 * time. */
29#define RANDOM_DATA_SIZE 64
30
31static struct virtqueue *vq;
32static u32 *random_data;
33static unsigned int data_left;
34static DECLARE_COMPLETION(have_data);
35
36static void random_recv_done(struct virtqueue *vq)
37{
38 int len;
39
40 /* We never get spurious callbacks. */
41 if (!vq->vq_ops->get_buf(vq, &len))
42 BUG();
43
44 data_left = len / sizeof(random_data[0]);
45 complete(&have_data);
46}
47
48static void register_buffer(void)
49{
50 struct scatterlist sg;
51
52 sg_init_one(&sg, random_data, RANDOM_DATA_SIZE);
53 /* There should always be room for one buffer. */
54 if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0)
55 BUG();
56 vq->vq_ops->kick(vq);
57}
58
59/* At least we don't udelay() in a loop like some other drivers. */
60static int virtio_data_present(struct hwrng *rng, int wait)
61{
62 if (data_left)
63 return 1;
64
65 if (!wait)
66 return 0;
67
68 wait_for_completion(&have_data);
69 return 1;
70}
71
72/* virtio_data_present() must have succeeded before this is called. */
73static int virtio_data_read(struct hwrng *rng, u32 *data)
74{
75 BUG_ON(!data_left);
76
77 *data = random_data[--data_left];
78
79 if (!data_left) {
80 init_completion(&have_data);
81 register_buffer();
82 }
83 return sizeof(*data);
84}
85
86static struct hwrng virtio_hwrng = {
87 .name = "virtio",
88 .data_present = virtio_data_present,
89 .data_read = virtio_data_read,
90};
91
92static int virtrng_probe(struct virtio_device *vdev)
93{
94 int err;
95
96 /* We expect a single virtqueue. */
97 vq = vdev->config->find_vq(vdev, 0, random_recv_done);
98 if (IS_ERR(vq))
99 return PTR_ERR(vq);
100
101 err = hwrng_register(&virtio_hwrng);
102 if (err) {
103 vdev->config->del_vq(vq);
104 return err;
105 }
106
107 register_buffer();
108 return 0;
109}
110
111static void virtrng_remove(struct virtio_device *vdev)
112{
113 vdev->config->reset(vdev);
114 hwrng_unregister(&virtio_hwrng);
115 vdev->config->del_vq(vq);
116}
117
118static struct virtio_device_id id_table[] = {
119 { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
120 { 0 },
121};
122
123static struct virtio_driver virtio_rng = {
124 .driver.name = KBUILD_MODNAME,
125 .driver.owner = THIS_MODULE,
126 .id_table = id_table,
127 .probe = virtrng_probe,
128 .remove = __devexit_p(virtrng_remove),
129};
130
131static int __init init(void)
132{
133 int err;
134
135 random_data = kmalloc(RANDOM_DATA_SIZE, GFP_KERNEL);
136 if (!random_data)
137 return -ENOMEM;
138
139 err = register_virtio_driver(&virtio_rng);
140 if (err)
141 kfree(random_data);
142 return err;
143}
144
145static void __exit fini(void)
146{
147 kfree(random_data);
148 unregister_virtio_driver(&virtio_rng);
149}
150module_init(init);
151module_exit(fini);
152
153MODULE_DEVICE_TABLE(virtio, id_table);
154MODULE_DESCRIPTION("Virtio random number driver");
155MODULE_LICENSE("GPL");
diff --git a/drivers/char/ip2/Makefile b/drivers/char/ip2/Makefile
index 6bfe2543ddc2..939618f62fe1 100644
--- a/drivers/char/ip2/Makefile
+++ b/drivers/char/ip2/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Computone IntelliPort Plus Driver 2# Makefile for the Computone IntelliPort Plus Driver
3# 3#
4 4
5obj-$(CONFIG_COMPUTONE) += ip2.o ip2main.o 5obj-$(CONFIG_COMPUTONE) += ip2.o
6 6
7ip2-objs := ip2base.o 7ip2-objs := ip2base.o ip2main.o
8 8
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 70957acaa960..c12cf8fc4be0 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -346,27 +346,6 @@ have_requested_irq( char irq )
346} 346}
347 347
348/******************************************************************************/ 348/******************************************************************************/
349/* Function: init_module() */
350/* Parameters: None */
351/* Returns: Success (0) */
352/* */
353/* Description: */
354/* This is a required entry point for an installable module. It simply calls */
355/* the driver initialisation function and returns what it returns. */
356/******************************************************************************/
357#ifdef MODULE
358static int __init
359ip2_init_module(void)
360{
361#ifdef IP2DEBUG_INIT
362 printk (KERN_DEBUG "Loading module ...\n" );
363#endif
364 return 0;
365}
366module_init(ip2_init_module);
367#endif /* MODULE */
368
369/******************************************************************************/
370/* Function: cleanup_module() */ 349/* Function: cleanup_module() */
371/* Parameters: None */ 350/* Parameters: None */
372/* Returns: Nothing */ 351/* Returns: Nothing */
@@ -779,8 +758,6 @@ out:
779 return err; 758 return err;
780} 759}
781 760
782EXPORT_SYMBOL(ip2_loadmain);
783
784/******************************************************************************/ 761/******************************************************************************/
785/* Function: ip2_init_board() */ 762/* Function: ip2_init_board() */
786/* Parameters: Index of board in configuration structure */ 763/* Parameters: Index of board in configuration structure */
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 5a5455585c1d..192688344ed2 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2352,10 +2352,16 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
2352 2352
2353 info->si_type = (enum si_type) match->data; 2353 info->si_type = (enum si_type) match->data;
2354 info->addr_source = "device-tree"; 2354 info->addr_source = "device-tree";
2355 info->io_setup = mem_setup;
2356 info->irq_setup = std_irq_setup; 2355 info->irq_setup = std_irq_setup;
2357 2356
2358 info->io.addr_type = IPMI_MEM_ADDR_SPACE; 2357 if (resource.flags & IORESOURCE_IO) {
2358 info->io_setup = port_setup;
2359 info->io.addr_type = IPMI_IO_ADDR_SPACE;
2360 } else {
2361 info->io_setup = mem_setup;
2362 info->io.addr_type = IPMI_MEM_ADDR_SPACE;
2363 }
2364
2359 info->io.addr_data = resource.start; 2365 info->io.addr_data = resource.start;
2360 2366
2361 info->io.regsize = regsize ? *regsize : DEFAULT_REGSIZE; 2367 info->io.regsize = regsize ? *regsize : DEFAULT_REGSIZE;
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7f7e798c1384..d9a0a53c842d 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -677,12 +677,7 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
677 677
678static void k_self(struct vc_data *vc, unsigned char value, char up_flag) 678static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
679{ 679{
680 unsigned int uni; 680 k_unicode(vc, conv_8bit_to_uni(value), up_flag);
681 if (kbd->kbdmode == VC_UNICODE)
682 uni = value;
683 else
684 uni = conv_8bit_to_uni(value);
685 k_unicode(vc, uni, up_flag);
686} 681}
687 682
688static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) 683static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag)
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 19105ec203f7..8096389b0dc2 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -282,16 +282,20 @@ static int opost(unsigned char c, struct tty_struct *tty)
282 if (O_ONLRET(tty)) 282 if (O_ONLRET(tty))
283 tty->column = 0; 283 tty->column = 0;
284 if (O_ONLCR(tty)) { 284 if (O_ONLCR(tty)) {
285 if (space < 2) 285 if (space < 2) {
286 unlock_kernel();
286 return -1; 287 return -1;
288 }
287 tty_put_char(tty, '\r'); 289 tty_put_char(tty, '\r');
288 tty->column = 0; 290 tty->column = 0;
289 } 291 }
290 tty->canon_column = tty->column; 292 tty->canon_column = tty->column;
291 break; 293 break;
292 case '\r': 294 case '\r':
293 if (O_ONOCR(tty) && tty->column == 0) 295 if (O_ONOCR(tty) && tty->column == 0) {
296 unlock_kernel();
294 return 0; 297 return 0;
298 }
295 if (O_OCRNL(tty)) { 299 if (O_OCRNL(tty)) {
296 c = '\n'; 300 c = '\n';
297 if (O_ONLRET(tty)) 301 if (O_ONLRET(tty))
@@ -303,10 +307,13 @@ static int opost(unsigned char c, struct tty_struct *tty)
303 case '\t': 307 case '\t':
304 spaces = 8 - (tty->column & 7); 308 spaces = 8 - (tty->column & 7);
305 if (O_TABDLY(tty) == XTABS) { 309 if (O_TABDLY(tty) == XTABS) {
306 if (space < spaces) 310 if (space < spaces) {
311 unlock_kernel();
307 return -1; 312 return -1;
313 }
308 tty->column += spaces; 314 tty->column += spaces;
309 tty->ops->write(tty, " ", spaces); 315 tty->ops->write(tty, " ", spaces);
316 unlock_kernel();
310 return 0; 317 return 0;
311 } 318 }
312 tty->column += spaces; 319 tty->column += spaces;
diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c
index fa9d3c945f31..ba6340ae98af 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/char/pcmcia/ipwireless/hardware.c
@@ -251,10 +251,11 @@ struct ipw_hardware {
251 int init_loops; 251 int init_loops;
252 struct timer_list setup_timer; 252 struct timer_list setup_timer;
253 253
254 /* Flag if hw is ready to send next packet */
254 int tx_ready; 255 int tx_ready;
255 struct list_head tx_queue[NL_NUM_OF_PRIORITIES]; 256 /* Count of pending packets to be sent */
256 /* True if any packets are queued for transmission */
257 int tx_queued; 257 int tx_queued;
258 struct list_head tx_queue[NL_NUM_OF_PRIORITIES];
258 259
259 int rx_bytes_queued; 260 int rx_bytes_queued;
260 struct list_head rx_queue; 261 struct list_head rx_queue;
@@ -404,6 +405,8 @@ static int do_send_fragment(struct ipw_hardware *hw, const unsigned char *data,
404 405
405 spin_lock_irqsave(&hw->spinlock, flags); 406 spin_lock_irqsave(&hw->spinlock, flags);
406 407
408 hw->tx_ready = 0;
409
407 if (hw->hw_version == HW_VERSION_1) { 410 if (hw->hw_version == HW_VERSION_1) {
408 outw((unsigned short) length, hw->base_port + IODWR); 411 outw((unsigned short) length, hw->base_port + IODWR);
409 412
@@ -492,6 +495,7 @@ static int do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet)
492 495
493 spin_lock_irqsave(&hw->spinlock, flags); 496 spin_lock_irqsave(&hw->spinlock, flags);
494 list_add(&packet->queue, &hw->tx_queue[0]); 497 list_add(&packet->queue, &hw->tx_queue[0]);
498 hw->tx_queued++;
495 spin_unlock_irqrestore(&hw->spinlock, flags); 499 spin_unlock_irqrestore(&hw->spinlock, flags);
496 } else { 500 } else {
497 if (packet->packet_callback) 501 if (packet->packet_callback)
@@ -949,12 +953,10 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
949 unsigned long flags; 953 unsigned long flags;
950 954
951 spin_lock_irqsave(&hw->spinlock, flags); 955 spin_lock_irqsave(&hw->spinlock, flags);
952 if (hw->tx_queued && hw->tx_ready != 0) { 956 if (hw->tx_queued && hw->tx_ready) {
953 int priority; 957 int priority;
954 struct ipw_tx_packet *packet = NULL; 958 struct ipw_tx_packet *packet = NULL;
955 959
956 hw->tx_ready--;
957
958 /* Pick a packet */ 960 /* Pick a packet */
959 for (priority = 0; priority < priority_limit; priority++) { 961 for (priority = 0; priority < priority_limit; priority++) {
960 if (!list_empty(&hw->tx_queue[priority])) { 962 if (!list_empty(&hw->tx_queue[priority])) {
@@ -963,6 +965,7 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
963 struct ipw_tx_packet, 965 struct ipw_tx_packet,
964 queue); 966 queue);
965 967
968 hw->tx_queued--;
966 list_del(&packet->queue); 969 list_del(&packet->queue);
967 970
968 break; 971 break;
@@ -973,6 +976,7 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
973 spin_unlock_irqrestore(&hw->spinlock, flags); 976 spin_unlock_irqrestore(&hw->spinlock, flags);
974 return 0; 977 return 0;
975 } 978 }
979
976 spin_unlock_irqrestore(&hw->spinlock, flags); 980 spin_unlock_irqrestore(&hw->spinlock, flags);
977 981
978 /* Send */ 982 /* Send */
@@ -1063,7 +1067,7 @@ static irqreturn_t ipwireless_handle_v1_interrupt(int irq,
1063 if (irqn & IR_TXINTR) { 1067 if (irqn & IR_TXINTR) {
1064 ack |= IR_TXINTR; 1068 ack |= IR_TXINTR;
1065 spin_lock_irqsave(&hw->spinlock, flags); 1069 spin_lock_irqsave(&hw->spinlock, flags);
1066 hw->tx_ready++; 1070 hw->tx_ready = 1;
1067 spin_unlock_irqrestore(&hw->spinlock, flags); 1071 spin_unlock_irqrestore(&hw->spinlock, flags);
1068 } 1072 }
1069 /* Received data */ 1073 /* Received data */
@@ -1170,7 +1174,7 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
1170 if (memrxdone & MEMRX_RX_DONE) { 1174 if (memrxdone & MEMRX_RX_DONE) {
1171 writew(0, &hw->memory_info_regs->memreg_rx_done); 1175 writew(0, &hw->memory_info_regs->memreg_rx_done);
1172 spin_lock_irqsave(&hw->spinlock, flags); 1176 spin_lock_irqsave(&hw->spinlock, flags);
1173 hw->tx_ready++; 1177 hw->tx_ready = 1;
1174 spin_unlock_irqrestore(&hw->spinlock, flags); 1178 spin_unlock_irqrestore(&hw->spinlock, flags);
1175 tx = 1; 1179 tx = 1;
1176 } 1180 }
@@ -1234,7 +1238,7 @@ static void send_packet(struct ipw_hardware *hw, int priority,
1234 1238
1235 spin_lock_irqsave(&hw->spinlock, flags); 1239 spin_lock_irqsave(&hw->spinlock, flags);
1236 list_add_tail(&packet->queue, &hw->tx_queue[priority]); 1240 list_add_tail(&packet->queue, &hw->tx_queue[priority]);
1237 hw->tx_queued = 1; 1241 hw->tx_queued++;
1238 spin_unlock_irqrestore(&hw->spinlock, flags); 1242 spin_unlock_irqrestore(&hw->spinlock, flags);
1239 1243
1240 flush_packets_to_hw(hw); 1244 flush_packets_to_hw(hw);
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c
index 53b3d44f8c06..55a95892ccf9 100644
--- a/drivers/char/snsc_event.c
+++ b/drivers/char/snsc_event.c
@@ -17,7 +17,7 @@
17 17
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/byteorder/generic.h> 20#include <asm/byteorder.h>
21#include <asm/sn/sn_sal.h> 21#include <asm/sn/sn_sal.h>
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
23#include "snsc.h" 23#include "snsc.h"
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 2001b0e52dc6..55c1653be00c 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -916,7 +916,7 @@ static int put_char(struct tty_struct *tty, unsigned char ch)
916{ 916{
917 struct slgt_info *info = tty->driver_data; 917 struct slgt_info *info = tty->driver_data;
918 unsigned long flags; 918 unsigned long flags;
919 int ret; 919 int ret = 0;
920 920
921 if (sanity_check(info, tty->name, "put_char")) 921 if (sanity_check(info, tty->name, "put_char"))
922 return 0; 922 return 0;
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 9e9bad8bdcf4..dbce1263bdff 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -402,6 +402,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
402 &sysrq_showstate_blocked_op, /* w */ 402 &sysrq_showstate_blocked_op, /* w */
403 /* x: May be registered on ppc/powerpc for xmon */ 403 /* x: May be registered on ppc/powerpc for xmon */
404 NULL, /* x */ 404 NULL, /* x */
405 /* y: May be registered on sparc64 for global register dump */
405 NULL, /* y */ 406 NULL, /* y */
406 NULL /* z */ 407 NULL /* z */
407}; 408};
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 49c1a2267a55..e94bee032314 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1215,10 +1215,11 @@ int tty_check_change(struct tty_struct *tty)
1215 1215
1216 if (!tty->pgrp) { 1216 if (!tty->pgrp) {
1217 printk(KERN_WARNING "tty_check_change: tty->pgrp == NULL!\n"); 1217 printk(KERN_WARNING "tty_check_change: tty->pgrp == NULL!\n");
1218 goto out; 1218 goto out_unlock;
1219 } 1219 }
1220 if (task_pgrp(current) == tty->pgrp) 1220 if (task_pgrp(current) == tty->pgrp)
1221 goto out; 1221 goto out_unlock;
1222 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
1222 if (is_ignored(SIGTTOU)) 1223 if (is_ignored(SIGTTOU))
1223 goto out; 1224 goto out;
1224 if (is_current_pgrp_orphaned()) { 1225 if (is_current_pgrp_orphaned()) {
@@ -1229,6 +1230,8 @@ int tty_check_change(struct tty_struct *tty)
1229 set_thread_flag(TIF_SIGPENDING); 1230 set_thread_flag(TIF_SIGPENDING);
1230 ret = -ERESTARTSYS; 1231 ret = -ERESTARTSYS;
1231out: 1232out:
1233 return ret;
1234out_unlock:
1232 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 1235 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
1233 return ret; 1236 return ret;
1234} 1237}
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c
index 3d3e1c2b310f..65fb848e1cce 100644
--- a/drivers/char/viocons.c
+++ b/drivers/char/viocons.c
@@ -7,7 +7,7 @@
7 * Authors: Dave Boutcher <boutcher@us.ibm.com> 7 * Authors: Dave Boutcher <boutcher@us.ibm.com>
8 * Ryan Arnold <ryanarn@us.ibm.com> 8 * Ryan Arnold <ryanarn@us.ibm.com>
9 * Colin Devilbiss <devilbis@us.ibm.com> 9 * Colin Devilbiss <devilbis@us.ibm.com>
10 * Stephen Rothwell <sfr@au1.ibm.com> 10 * Stephen Rothwell
11 * 11 *
12 * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation 12 * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation
13 * 13 *
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 58aad63831f4..c39ddaff5e8f 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -6,7 +6,7 @@
6 * Authors: Dave Boutcher <boutcher@us.ibm.com> 6 * Authors: Dave Boutcher <boutcher@us.ibm.com>
7 * Ryan Arnold <ryanarn@us.ibm.com> 7 * Ryan Arnold <ryanarn@us.ibm.com>
8 * Colin Devilbiss <devilbis@us.ibm.com> 8 * Colin Devilbiss <devilbis@us.ibm.com>
9 * Stephen Rothwell <sfr@au1.ibm.com> 9 * Stephen Rothwell
10 * 10 *
11 * (C) Copyright 2000-2004 IBM Corporation 11 * (C) Copyright 2000-2004 IBM Corporation
12 * 12 *
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index e122a0e87bb0..f17ac043b551 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -89,9 +89,7 @@ static void scc_break_ctl(struct tty_struct *tty, int break_state);
89 89
90static struct tty_driver *scc_driver; 90static struct tty_driver *scc_driver;
91 91
92struct scc_port scc_ports[2]; 92static struct scc_port scc_ports[2];
93
94int scc_initialized = 0;
95 93
96/*--------------------------------------------------------------------------- 94/*---------------------------------------------------------------------------
97 * Interface from generic_serial.c back here 95 * Interface from generic_serial.c back here
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index fa1ffbf2c621..935f1c207a1f 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -434,7 +434,7 @@ static void update_attr(struct vc_data *vc)
434 vc->vc_blink, vc->vc_underline, 434 vc->vc_blink, vc->vc_underline,
435 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic); 435 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic);
436 vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' '; 436 vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' ';
437 vc->vc_scrl_erase_char = (build_attr(vc, vc->vc_def_color, 1, false, false, false, false) << 8) | ' '; 437 vc->vc_scrl_erase_char = (build_attr(vc, vc->vc_def_color, 1, false, false, vc->vc_decscnm, false) << 8) | ' ';
438} 438}
439 439
440/* Note: inverting the screen twice should revert to the original state */ 440/* Note: inverting the screen twice should revert to the original state */
@@ -909,7 +909,7 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
909 909
910 if (vc->vc_tty) { 910 if (vc->vc_tty) {
911 struct winsize ws, *cws = &vc->vc_tty->winsize; 911 struct winsize ws, *cws = &vc->vc_tty->winsize;
912 unsigned long flags; 912 struct pid *pgrp = NULL;
913 913
914 memset(&ws, 0, sizeof(ws)); 914 memset(&ws, 0, sizeof(ws));
915 ws.ws_row = vc->vc_rows; 915 ws.ws_row = vc->vc_rows;
@@ -917,11 +917,14 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
917 ws.ws_ypixel = vc->vc_scan_lines; 917 ws.ws_ypixel = vc->vc_scan_lines;
918 918
919 mutex_lock(&vc->vc_tty->termios_mutex); 919 mutex_lock(&vc->vc_tty->termios_mutex);
920 spin_lock_irqsave(&vc->vc_tty->ctrl_lock, flags); 920 spin_lock_irq(&vc->vc_tty->ctrl_lock);
921 if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) && 921 if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col))
922 vc->vc_tty->pgrp) 922 pgrp = get_pid(vc->vc_tty->pgrp);
923 spin_unlock_irq(&vc->vc_tty->ctrl_lock);
924 if (pgrp) {
923 kill_pgrp(vc->vc_tty->pgrp, SIGWINCH, 1); 925 kill_pgrp(vc->vc_tty->pgrp, SIGWINCH, 1);
924 spin_unlock_irqrestore(&vc->vc_tty->ctrl_lock, flags); 926 put_pid(pgrp);
927 }
925 *cws = ws; 928 *cws = ws;
926 mutex_unlock(&vc->vc_tty->termios_mutex); 929 mutex_unlock(&vc->vc_tty->termios_mutex);
927 } 930 }
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7fce038fa57e..1d41496ed2f8 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -412,7 +412,7 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
412 int ret; 412 int ret;
413 413
414 mutex_unlock(&cpufreq_governor_mutex); 414 mutex_unlock(&cpufreq_governor_mutex);
415 ret = request_module(name); 415 ret = request_module("%s", name);
416 mutex_lock(&cpufreq_governor_mutex); 416 mutex_lock(&cpufreq_governor_mutex);
417 417
418 if (ret == 0) 418 if (ret == 0)
@@ -625,7 +625,7 @@ static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
625 unsigned int freq = 0; 625 unsigned int freq = 0;
626 unsigned int ret; 626 unsigned int ret;
627 627
628 if (!policy->governor->store_setspeed) 628 if (!policy->governor || !policy->governor->store_setspeed)
629 return -EINVAL; 629 return -EINVAL;
630 630
631 ret = sscanf(buf, "%u", &freq); 631 ret = sscanf(buf, "%u", &freq);
@@ -639,7 +639,7 @@ static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
639 639
640static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf) 640static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf)
641{ 641{
642 if (!policy->governor->show_setspeed) 642 if (!policy->governor || !policy->governor->show_setspeed)
643 return sprintf(buf, "<unsupported>\n"); 643 return sprintf(buf, "<unsupported>\n");
644 644
645 return policy->governor->show_setspeed(policy, buf); 645 return policy->governor->show_setspeed(policy, buf);
@@ -928,13 +928,13 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
928 policy->user_policy.policy = policy->policy; 928 policy->user_policy.policy = policy->policy;
929 policy->user_policy.governor = policy->governor; 929 policy->user_policy.governor = policy->governor;
930 930
931 unlock_policy_rwsem_write(cpu);
932
933 if (ret) { 931 if (ret) {
934 dprintk("setting policy failed\n"); 932 dprintk("setting policy failed\n");
935 goto err_out_unregister; 933 goto err_out_unregister;
936 } 934 }
937 935
936 unlock_policy_rwsem_write(cpu);
937
938 kobject_uevent(&policy->kobj, KOBJ_ADD); 938 kobject_uevent(&policy->kobj, KOBJ_ADD);
939 module_put(cpufreq_driver->owner); 939 module_put(cpufreq_driver->owner);
940 dprintk("initialization complete\n"); 940 dprintk("initialization complete\n");
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index ae6cd60d5c14..b64c6bc445e3 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -2,6 +2,11 @@
2 * linux/drivers/cpufreq/freq_table.c 2 * linux/drivers/cpufreq/freq_table.c
3 * 3 *
4 * Copyright (C) 2002 - 2003 Dominik Brodowski 4 * Copyright (C) 2002 - 2003 Dominik Brodowski
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
5 */ 10 */
6 11
7#include <linux/kernel.h> 12#include <linux/kernel.h>
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index fc555a90bb21..23554b676d6e 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -38,6 +38,8 @@ static void cpuidle_kick_cpus(void)
38static void cpuidle_kick_cpus(void) {} 38static void cpuidle_kick_cpus(void) {}
39#endif 39#endif
40 40
41static int __cpuidle_register_device(struct cpuidle_device *dev);
42
41/** 43/**
42 * cpuidle_idle_call - the main idle loop 44 * cpuidle_idle_call - the main idle loop
43 * 45 *
@@ -138,6 +140,12 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
138 if (!dev->state_count) 140 if (!dev->state_count)
139 return -EINVAL; 141 return -EINVAL;
140 142
143 if (dev->registered == 0) {
144 ret = __cpuidle_register_device(dev);
145 if (ret)
146 return ret;
147 }
148
141 if ((ret = cpuidle_add_state_sysfs(dev))) 149 if ((ret = cpuidle_add_state_sysfs(dev)))
142 return ret; 150 return ret;
143 151
@@ -232,10 +240,13 @@ static void poll_idle_init(struct cpuidle_device *dev) {}
232#endif /* CONFIG_ARCH_HAS_CPU_RELAX */ 240#endif /* CONFIG_ARCH_HAS_CPU_RELAX */
233 241
234/** 242/**
235 * cpuidle_register_device - registers a CPU's idle PM feature 243 * __cpuidle_register_device - internal register function called before register
244 * and enable routines
236 * @dev: the cpu 245 * @dev: the cpu
246 *
247 * cpuidle_lock mutex must be held before this is called
237 */ 248 */
238int cpuidle_register_device(struct cpuidle_device *dev) 249static int __cpuidle_register_device(struct cpuidle_device *dev)
239{ 250{
240 int ret; 251 int ret;
241 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 252 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
@@ -247,18 +258,34 @@ int cpuidle_register_device(struct cpuidle_device *dev)
247 258
248 init_completion(&dev->kobj_unregister); 259 init_completion(&dev->kobj_unregister);
249 260
250 mutex_lock(&cpuidle_lock);
251
252 poll_idle_init(dev); 261 poll_idle_init(dev);
253 262
254 per_cpu(cpuidle_devices, dev->cpu) = dev; 263 per_cpu(cpuidle_devices, dev->cpu) = dev;
255 list_add(&dev->device_list, &cpuidle_detected_devices); 264 list_add(&dev->device_list, &cpuidle_detected_devices);
256 if ((ret = cpuidle_add_sysfs(sys_dev))) { 265 if ((ret = cpuidle_add_sysfs(sys_dev))) {
257 mutex_unlock(&cpuidle_lock);
258 module_put(cpuidle_curr_driver->owner); 266 module_put(cpuidle_curr_driver->owner);
259 return ret; 267 return ret;
260 } 268 }
261 269
270 dev->registered = 1;
271 return 0;
272}
273
274/**
275 * cpuidle_register_device - registers a CPU's idle PM feature
276 * @dev: the cpu
277 */
278int cpuidle_register_device(struct cpuidle_device *dev)
279{
280 int ret;
281
282 mutex_lock(&cpuidle_lock);
283
284 if ((ret = __cpuidle_register_device(dev))) {
285 mutex_unlock(&cpuidle_lock);
286 return ret;
287 }
288
262 cpuidle_enable_device(dev); 289 cpuidle_enable_device(dev);
263 cpuidle_install_idle_handler(); 290 cpuidle_install_idle_handler();
264 291
@@ -278,6 +305,9 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
278{ 305{
279 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 306 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
280 307
308 if (dev->registered == 0)
309 return;
310
281 cpuidle_pause_and_lock(); 311 cpuidle_pause_and_lock();
282 312
283 cpuidle_disable_device(dev); 313 cpuidle_disable_device(dev);
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 762b729672e0..0ec0f431e6a1 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
821 821
822 dev_dbg(device->common.dev, "%s\n", __func__); 822 dev_dbg(device->common.dev, "%s\n", __func__);
823 823
824 src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); 824 src = kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL);
825 if (!src) 825 if (!src)
826 return -ENOMEM; 826 return -ENOMEM;
827 dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); 827 dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL);
828 if (!dest) { 828 if (!dest) {
829 kfree(src); 829 kfree(src);
830 return -ENOMEM; 830 return -ENOMEM;
@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
834 for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) 834 for (i = 0; i < IOP_ADMA_TEST_SIZE; i++)
835 ((u8 *) src)[i] = (u8)i; 835 ((u8 *) src)[i] = (u8)i;
836 836
837 memset(dest, 0, IOP_ADMA_TEST_SIZE);
838
839 /* Start copy, using first DMA channel */ 837 /* Start copy, using first DMA channel */
840 dma_chan = container_of(device->common.channels.next, 838 dma_chan = container_of(device->common.channels.next,
841 struct dma_chan, 839 struct dma_chan,
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 065732ddf40c..d49361bfe670 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/of_device.h> 22#include <linux/of_device.h>
23#include <asm/mpc85xx.h>
24#include "edac_module.h" 23#include "edac_module.h"
25#include "edac_core.h" 24#include "edac_core.h"
26#include "mpc85xx_edac.h" 25#include "mpc85xx_edac.h"
@@ -43,8 +42,6 @@ static u32 orig_pci_err_en;
43static u32 orig_l2_err_disable; 42static u32 orig_l2_err_disable;
44static u32 orig_hid1; 43static u32 orig_hid1;
45 44
46static const char *mpc85xx_ctl_name = "MPC85xx";
47
48/************************ MC SYSFS parts ***********************************/ 45/************************ MC SYSFS parts ***********************************/
49 46
50static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci, 47static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci,
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 4a541921a14a..dda14015e873 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -113,6 +113,11 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
113 if (device == NULL) 113 if (device == NULL)
114 return -ENODEV; 114 return -ENODEV;
115 115
116 if (fw_device_is_shutdown(device)) {
117 fw_device_put(device);
118 return -ENODEV;
119 }
120
116 client = kzalloc(sizeof(*client), GFP_KERNEL); 121 client = kzalloc(sizeof(*client), GFP_KERNEL);
117 if (client == NULL) { 122 if (client == NULL) {
118 fw_device_put(device); 123 fw_device_put(device);
@@ -901,6 +906,9 @@ fw_device_op_ioctl(struct file *file,
901{ 906{
902 struct client *client = file->private_data; 907 struct client *client = file->private_data;
903 908
909 if (fw_device_is_shutdown(client->device))
910 return -ENODEV;
911
904 return dispatch_ioctl(client, cmd, (void __user *) arg); 912 return dispatch_ioctl(client, cmd, (void __user *) arg);
905} 913}
906 914
@@ -911,6 +919,9 @@ fw_device_op_compat_ioctl(struct file *file,
911{ 919{
912 struct client *client = file->private_data; 920 struct client *client = file->private_data;
913 921
922 if (fw_device_is_shutdown(client->device))
923 return -ENODEV;
924
914 return dispatch_ioctl(client, cmd, compat_ptr(arg)); 925 return dispatch_ioctl(client, cmd, compat_ptr(arg));
915} 926}
916#endif 927#endif
@@ -922,6 +933,9 @@ static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma)
922 unsigned long size; 933 unsigned long size;
923 int page_count, retval; 934 int page_count, retval;
924 935
936 if (fw_device_is_shutdown(client->device))
937 return -ENODEV;
938
925 /* FIXME: We could support multiple buffers, but we don't. */ 939 /* FIXME: We could support multiple buffers, but we don't. */
926 if (client->buffer.pages != NULL) 940 if (client->buffer.pages != NULL)
927 return -EBUSY; 941 return -EBUSY;
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 744011989044..9e4f59dc7f1e 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -753,7 +753,7 @@ edd_init(void)
753 753
754 if (!edd_num_devices()) { 754 if (!edd_num_devices()) {
755 printk(KERN_INFO "EDD information not available.\n"); 755 printk(KERN_INFO "EDD information not available.\n");
756 return 1; 756 return -ENODEV;
757 } 757 }
758 758
759 edd_kset = kset_create_and_add("edd", NULL, firmware_kobj); 759 edd_kset = kset_create_and_add("edd", NULL, firmware_kobj);
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7f138c6195ff..beaf6b3a37dc 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -127,7 +127,7 @@ int __init gpiochip_reserve(int start, int ngpio)
127 unsigned long flags; 127 unsigned long flags;
128 int i; 128 int i;
129 129
130 if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio)) 130 if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio - 1))
131 return -EINVAL; 131 return -EINVAL;
132 132
133 spin_lock_irqsave(&gpio_lock, flags); 133 spin_lock_irqsave(&gpio_lock, flags);
@@ -170,7 +170,7 @@ int gpiochip_add(struct gpio_chip *chip)
170 unsigned id; 170 unsigned id;
171 int base = chip->base; 171 int base = chip->base;
172 172
173 if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio)) 173 if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio - 1))
174 && base >= 0) { 174 && base >= 0) {
175 status = -EINVAL; 175 status = -EINVAL;
176 goto fail; 176 goto fail;
@@ -207,7 +207,7 @@ fail:
207 /* failures here can mean systems won't boot... */ 207 /* failures here can mean systems won't boot... */
208 if (status) 208 if (status)
209 pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", 209 pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n",
210 chip->base, chip->base + chip->ngpio, 210 chip->base, chip->base + chip->ngpio - 1,
211 chip->label ? : "generic"); 211 chip->label ? : "generic");
212 return status; 212 return status;
213} 213}
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index 7fb5b9d009d4..7f92fdd5f0e2 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -168,7 +168,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip)
168{ 168{
169 struct mcp23s08 *mcp; 169 struct mcp23s08 *mcp;
170 char bank; 170 char bank;
171 unsigned t; 171 int t;
172 unsigned mask; 172 unsigned mask;
173 173
174 mcp = container_of(chip, struct mcp23s08, chip); 174 mcp = container_of(chip, struct mcp23s08, chip);
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 93f916720b13..7e40e8a55edf 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -30,6 +30,7 @@ static const struct i2c_device_id pca953x_id[] = {
30 { "pca9537", 4, }, 30 { "pca9537", 4, },
31 { "pca9538", 8, }, 31 { "pca9538", 8, },
32 { "pca9539", 16, }, 32 { "pca9539", 16, },
33 { "pca9554", 8, },
33 { "pca9555", 16, }, 34 { "pca9555", 16, },
34 { "pca9557", 8, }, 35 { "pca9557", 8, },
35 /* REVISIT several pca955x parts should work here too */ 36 /* REVISIT several pca955x parts should work here too */
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index f88714b06000..47ac1a7d66e1 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: hid-debug.h,v 1.8 2001/09/25 09:37:57 vojtech Exp $
3 *
4 * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> 2 * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de>
5 * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> 3 * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
6 * (c) 2007 Jiri Kosina 4 * (c) 2007 Jiri Kosina
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index c3eb3f13e2ca..5c52a20ad344 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik 2 * Copyright (c) 2000-2001 Vojtech Pavlik
5 * Copyright (c) 2006-2007 Jiri Kosina 3 * Copyright (c) 2006-2007 Jiri Kosina
6 * 4 *
@@ -218,8 +216,9 @@ int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
218 } 216 }
219 } 217 }
220 218
221 if (test_bit(usage->code, hid->pb_pressed_numlock) || 219 if (hid->quirks & HID_QUIRK_APPLE_NUMLOCK_EMULATION && (
222 test_bit(LED_NUML, input->led)) { 220 test_bit(usage->code, hid->pb_pressed_numlock) ||
221 test_bit(LED_NUML, input->led))) {
223 trans = find_translation(powerbook_numlock_keys, usage->code); 222 trans = find_translation(powerbook_numlock_keys, usage->code);
224 223
225 if (trans) { 224 if (trans) {
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index d3f8d9194f30..1df832a8fcbc 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -325,6 +325,10 @@
325#define USB_DEVICE_ID_MGE_UPS 0xffff 325#define USB_DEVICE_ID_MGE_UPS 0xffff
326#define USB_DEVICE_ID_MGE_UPS1 0x0001 326#define USB_DEVICE_ID_MGE_UPS1 0x0001
327 327
328#define USB_VENDOR_ID_MICROCHIP 0x04d8
329#define USB_DEVICE_ID_PICKIT1 0x0032
330#define USB_DEVICE_ID_PICKIT2 0x0033
331
328#define USB_VENDOR_ID_MICROSOFT 0x045e 332#define USB_VENDOR_ID_MICROSOFT 0x045e
329#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b 333#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
330#define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d 334#define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
@@ -371,6 +375,9 @@
371#define USB_VENDOR_ID_SONY 0x054c 375#define USB_VENDOR_ID_SONY 0x054c
372#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 376#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
373 377
378#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
379#define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038
380
374#define USB_VENDOR_ID_SUN 0x0430 381#define USB_VENDOR_ID_SUN 0x0430
375#define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab 382#define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab
376 383
@@ -567,6 +574,7 @@ static const struct hid_blacklist {
567 { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, 574 { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE },
568 { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, 575 { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE },
569 { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, 576 { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE },
577 { USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD, HID_QUIRK_IGNORE },
570 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, 578 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE },
571 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, 579 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE },
572 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, 580 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE },
@@ -580,6 +588,9 @@ static const struct hid_blacklist {
580 { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, 588 { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE },
581 { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, 589 { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE },
582 590
591 { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1, HID_QUIRK_IGNORE },
592 { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2, HID_QUIRK_IGNORE },
593
583 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, 594 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP },
584 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, 595 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP },
585 596
@@ -611,28 +622,28 @@ static const struct hid_blacklist {
611 622
612 { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 623 { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
613 624
614 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 625 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
615 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 626 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
616 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 627 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
617 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, 628 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
618 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 629 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
619 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 630 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
620 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, 631 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
621 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 632 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
622 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 633 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
623 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, 634 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
624 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 635 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
625 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, 636 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN },
626 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, 637 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
627 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, 638 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN },
628 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 639 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
629 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 640 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
630 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 641 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
631 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, 642 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
632 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, 643 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
633 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_HAS_FN }, 644 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
634 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 645 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
635 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 646 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
636 647
637 { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, 648 { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
638 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, 649 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS },
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index 5d9dbb47e4a8..3cd46d2e53c1 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: usbkbd.c,v 1.27 2001/12/27 10:37:41 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * USB HIDBP Keyboard support 4 * USB HIDBP Keyboard support
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c
index df0d96d989de..703e9d0e8714 100644
--- a/drivers/hid/usbhid/usbmouse.c
+++ b/drivers/hid/usbhid/usbmouse.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: usbmouse.c,v 1.15 2001/12/27 10:37:41 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik 2 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 3 *
6 * USB HIDBP Mouse support 4 * USB HIDBP Mouse support
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 4dc76bc45c9d..00ff53348491 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -330,6 +330,20 @@ config SENSORS_CORETEMP
330 sensor inside your CPU. Supported all are all known variants 330 sensor inside your CPU. Supported all are all known variants
331 of Intel Core family. 331 of Intel Core family.
332 332
333config SENSORS_IBMAEM
334 tristate "IBM Active Energy Manager temperature/power sensors and control"
335 select IPMI_SI
336 depends on IPMI_HANDLER
337 help
338 If you say yes here you get support for the temperature and
339 power sensors and capping hardware in various IBM System X
340 servers that support Active Energy Manager. This includes
341 the x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2,
342 and certain HS2x/LS2x/QS2x blades.
343
344 This driver can also be built as a module. If so, the module
345 will be called ibmaem.
346
333config SENSORS_IBMPEX 347config SENSORS_IBMPEX
334 tristate "IBM PowerExecutive temperature/power sensors" 348 tristate "IBM PowerExecutive temperature/power sensors"
335 select IPMI_SI 349 select IPMI_SI
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 3bdb05a5cbd7..d098677e08de 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
41obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o 41obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
42obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o 42obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o
43obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o 43obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
44obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o
44obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o 45obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o
45obj-$(CONFIG_SENSORS_IT87) += it87.o 46obj-$(CONFIG_SENSORS_IT87) += it87.o
46obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o 47obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index bab5fd2e4dfd..26df06f840eb 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -515,12 +515,14 @@ static struct dmi_system_id __initdata hdaps_whitelist[] = {
515 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), 515 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
516 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), 516 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
517 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"), 517 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"),
518 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61i"),
518 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"), 519 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"),
519 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"), 520 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"),
520 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"), 521 HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"),
521 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T42"), 522 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T42"),
522 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T43"), 523 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T43"),
523 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T60"), 524 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T60"),
525 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T61"),
524 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X40"), 526 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X40"),
525 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X41"), 527 HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X41"),
526 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X60"), 528 HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X60"),
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index 6ac5c6f53585..f9e2ed621f7b 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -111,6 +111,7 @@ struct i5k_amb_data {
111 void __iomem *amb_mmio; 111 void __iomem *amb_mmio;
112 struct i5k_device_attribute *attrs; 112 struct i5k_device_attribute *attrs;
113 unsigned int num_attrs; 113 unsigned int num_attrs;
114 unsigned long chipset_id;
114}; 115};
115 116
116static ssize_t show_name(struct device *dev, struct device_attribute *devattr, 117static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
@@ -382,7 +383,8 @@ err:
382 return res; 383 return res;
383} 384}
384 385
385static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) 386static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data,
387 unsigned long devid)
386{ 388{
387 struct pci_dev *pcidev; 389 struct pci_dev *pcidev;
388 u32 val32; 390 u32 val32;
@@ -390,7 +392,7 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
390 392
391 /* Find AMB register memory space */ 393 /* Find AMB register memory space */
392 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, 394 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
393 PCI_DEVICE_ID_INTEL_5000_ERR, 395 devid,
394 NULL); 396 NULL);
395 if (!pcidev) 397 if (!pcidev)
396 return -ENODEV; 398 return -ENODEV;
@@ -409,6 +411,8 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
409 goto out; 411 goto out;
410 } 412 }
411 413
414 data->chipset_id = devid;
415
412 res = 0; 416 res = 0;
413out: 417out:
414 pci_dev_put(pcidev); 418 pci_dev_put(pcidev);
@@ -441,10 +445,30 @@ out:
441 return res; 445 return res;
442} 446}
443 447
448static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data,
449 unsigned long channel)
450{
451 switch (data->chipset_id) {
452 case PCI_DEVICE_ID_INTEL_5000_ERR:
453 return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel;
454 case PCI_DEVICE_ID_INTEL_5400_ERR:
455 return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel;
456 default:
457 BUG();
458 }
459}
460
461static unsigned long chipset_ids[] = {
462 PCI_DEVICE_ID_INTEL_5000_ERR,
463 PCI_DEVICE_ID_INTEL_5400_ERR,
464 0
465};
466
444static int __devinit i5k_amb_probe(struct platform_device *pdev) 467static int __devinit i5k_amb_probe(struct platform_device *pdev)
445{ 468{
446 struct i5k_amb_data *data; 469 struct i5k_amb_data *data;
447 struct resource *reso; 470 struct resource *reso;
471 int i;
448 int res = -ENODEV; 472 int res = -ENODEV;
449 473
450 data = kzalloc(sizeof(*data), GFP_KERNEL); 474 data = kzalloc(sizeof(*data), GFP_KERNEL);
@@ -452,19 +476,24 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev)
452 return -ENOMEM; 476 return -ENOMEM;
453 477
454 /* Figure out where the AMB registers live */ 478 /* Figure out where the AMB registers live */
455 res = i5k_find_amb_registers(data); 479 i = 0;
480 do {
481 res = i5k_find_amb_registers(data, chipset_ids[i]);
482 i++;
483 } while (res && chipset_ids[i]);
484
456 if (res) 485 if (res)
457 goto err; 486 goto err;
458 487
459 /* Copy the DIMM presence map for the first two channels */ 488 /* Copy the DIMM presence map for the first two channels */
460 res = i5k_channel_probe(&data->amb_present[0], 489 res = i5k_channel_probe(&data->amb_present[0],
461 PCI_DEVICE_ID_INTEL_5000_FBD0); 490 i5k_channel_pci_id(data, 0));
462 if (res) 491 if (res)
463 goto err; 492 goto err;
464 493
465 /* Copy the DIMM presence map for the optional second two channels */ 494 /* Copy the DIMM presence map for the optional second two channels */
466 i5k_channel_probe(&data->amb_present[2], 495 i5k_channel_probe(&data->amb_present[2],
467 PCI_DEVICE_ID_INTEL_5000_FBD1); 496 i5k_channel_pci_id(data, 1));
468 497
469 /* Set up resource regions */ 498 /* Set up resource regions */
470 reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); 499 reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
new file mode 100644
index 000000000000..c9416e657487
--- /dev/null
+++ b/drivers/hwmon/ibmaem.c
@@ -0,0 +1,1111 @@
1/*
2 * A hwmon driver for the IBM Active Energy Manager temperature/power sensors
3 * and capping functionality.
4 * Copyright (C) 2008 IBM
5 *
6 * Author: Darrick J. Wong <djwong@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/ipmi.h>
24#include <linux/module.h>
25#include <linux/hwmon.h>
26#include <linux/hwmon-sysfs.h>
27#include <linux/jiffies.h>
28#include <linux/mutex.h>
29#include <linux/kdev_t.h>
30#include <linux/spinlock.h>
31#include <linux/idr.h>
32#include <linux/sched.h>
33#include <linux/platform_device.h>
34#include <linux/math64.h>
35#include <linux/time.h>
36
37#define REFRESH_INTERVAL (HZ)
38#define IPMI_TIMEOUT (30 * HZ)
39#define DRVNAME "aem"
40
41#define AEM_NETFN 0x2E
42
43#define AEM_FIND_FW_CMD 0x80
44#define AEM_ELEMENT_CMD 0x81
45#define AEM_FW_INSTANCE_CMD 0x82
46
47#define AEM_READ_ELEMENT_CFG 0x80
48#define AEM_READ_BUFFER 0x81
49#define AEM_READ_REGISTER 0x82
50#define AEM_WRITE_REGISTER 0x83
51#define AEM_SET_REG_MASK 0x84
52#define AEM_CLEAR_REG_MASK 0x85
53#define AEM_READ_ELEMENT_CFG2 0x86
54
55#define AEM_CONTROL_ELEMENT 0
56#define AEM_ENERGY_ELEMENT 1
57#define AEM_CLOCK_ELEMENT 4
58#define AEM_POWER_CAP_ELEMENT 7
59#define AEM_EXHAUST_ELEMENT 9
60#define AEM_POWER_ELEMENT 10
61
62#define AEM_MODULE_TYPE_ID 0x0001
63
64#define AEM2_NUM_ENERGY_REGS 2
65#define AEM2_NUM_PCAP_REGS 6
66#define AEM2_NUM_TEMP_REGS 2
67#define AEM2_NUM_SENSORS 14
68
69#define AEM1_NUM_ENERGY_REGS 1
70#define AEM1_NUM_SENSORS 3
71
72/* AEM 2.x has more energy registers */
73#define AEM_NUM_ENERGY_REGS AEM2_NUM_ENERGY_REGS
74/* AEM 2.x needs more sensor files */
75#define AEM_NUM_SENSORS AEM2_NUM_SENSORS
76
77#define POWER_CAP 0
78#define POWER_CAP_MAX_HOTPLUG 1
79#define POWER_CAP_MAX 2
80#define POWER_CAP_MIN_WARNING 3
81#define POWER_CAP_MIN 4
82#define POWER_AUX 5
83
84#define AEM_DEFAULT_POWER_INTERVAL 1000
85#define AEM_MIN_POWER_INTERVAL 200
86#define UJ_PER_MJ 1000L
87
88static DEFINE_IDR(aem_idr);
89static DEFINE_SPINLOCK(aem_idr_lock);
90
91static struct device_driver aem_driver = {
92 .name = DRVNAME,
93 .bus = &platform_bus_type,
94};
95
96struct aem_ipmi_data {
97 struct completion read_complete;
98 struct ipmi_addr address;
99 ipmi_user_t user;
100 int interface;
101
102 struct kernel_ipmi_msg tx_message;
103 long tx_msgid;
104
105 void *rx_msg_data;
106 unsigned short rx_msg_len;
107 unsigned char rx_result;
108 int rx_recv_type;
109
110 struct device *bmc_device;
111};
112
113struct aem_ro_sensor_template {
114 char *label;
115 ssize_t (*show)(struct device *dev,
116 struct device_attribute *devattr,
117 char *buf);
118 int index;
119};
120
121struct aem_rw_sensor_template {
122 char *label;
123 ssize_t (*show)(struct device *dev,
124 struct device_attribute *devattr,
125 char *buf);
126 ssize_t (*set)(struct device *dev,
127 struct device_attribute *devattr,
128 const char *buf, size_t count);
129 int index;
130};
131
132struct aem_data {
133 struct list_head list;
134
135 struct device *hwmon_dev;
136 struct platform_device *pdev;
137 struct mutex lock;
138 char valid;
139 unsigned long last_updated; /* In jiffies */
140 u8 ver_major;
141 u8 ver_minor;
142 u8 module_handle;
143 int id;
144 struct aem_ipmi_data ipmi;
145
146 /* Function to update sensors */
147 void (*update)(struct aem_data *data);
148
149 /*
150 * AEM 1.x sensors:
151 * Available sensors:
152 * Energy meter
153 * Power meter
154 *
155 * AEM 2.x sensors:
156 * Two energy meters
157 * Two power meters
158 * Two temperature sensors
159 * Six power cap registers
160 */
161
162 /* sysfs attrs */
163 struct sensor_device_attribute sensors[AEM_NUM_SENSORS];
164
165 /* energy use in mJ */
166 u64 energy[AEM_NUM_ENERGY_REGS];
167
168 /* power sampling interval in ms */
169 unsigned long power_period[AEM_NUM_ENERGY_REGS];
170
171 /* Everything past here is for AEM2 only */
172
173 /* power caps in dW */
174 u16 pcap[AEM2_NUM_PCAP_REGS];
175
176 /* exhaust temperature in C */
177 u8 temp[AEM2_NUM_TEMP_REGS];
178};
179
180/* Data structures returned by the AEM firmware */
181struct aem_iana_id {
182 u8 bytes[3];
183};
184static struct aem_iana_id system_x_id = {
185 .bytes = {0x4D, 0x4F, 0x00}
186};
187
188/* These are used to find AEM1 instances */
189struct aem_find_firmware_req {
190 struct aem_iana_id id;
191 u8 rsvd;
192 __be16 index;
193 __be16 module_type_id;
194} __packed;
195
196struct aem_find_firmware_resp {
197 struct aem_iana_id id;
198 u8 num_instances;
199} __packed;
200
201/* These are used to find AEM2 instances */
202struct aem_find_instance_req {
203 struct aem_iana_id id;
204 u8 instance_number;
205 __be16 module_type_id;
206} __packed;
207
208struct aem_find_instance_resp {
209 struct aem_iana_id id;
210 u8 num_instances;
211 u8 major;
212 u8 minor;
213 u8 module_handle;
214 u16 record_id;
215} __packed;
216
217/* These are used to query sensors */
218struct aem_read_sensor_req {
219 struct aem_iana_id id;
220 u8 module_handle;
221 u8 element;
222 u8 subcommand;
223 u8 reg;
224 u8 rx_buf_size;
225} __packed;
226
227struct aem_read_sensor_resp {
228 struct aem_iana_id id;
229 u8 bytes[0];
230} __packed;
231
232/* Data structures to talk to the IPMI layer */
233struct aem_driver_data {
234 struct list_head aem_devices;
235 struct ipmi_smi_watcher bmc_events;
236 struct ipmi_user_hndl ipmi_hndlrs;
237};
238
239static void aem_register_bmc(int iface, struct device *dev);
240static void aem_bmc_gone(int iface);
241static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data);
242
243static void aem_remove_sensors(struct aem_data *data);
244static int aem_init_aem1(struct aem_ipmi_data *probe);
245static int aem_init_aem2(struct aem_ipmi_data *probe);
246static int aem1_find_sensors(struct aem_data *data);
247static int aem2_find_sensors(struct aem_data *data);
248static void update_aem1_sensors(struct aem_data *data);
249static void update_aem2_sensors(struct aem_data *data);
250
251static struct aem_driver_data driver_data = {
252 .aem_devices = LIST_HEAD_INIT(driver_data.aem_devices),
253 .bmc_events = {
254 .owner = THIS_MODULE,
255 .new_smi = aem_register_bmc,
256 .smi_gone = aem_bmc_gone,
257 },
258 .ipmi_hndlrs = {
259 .ipmi_recv_hndl = aem_msg_handler,
260 },
261};
262
263/* Functions to talk to the IPMI layer */
264
265/* Initialize IPMI address, message buffers and user data */
266static int aem_init_ipmi_data(struct aem_ipmi_data *data, int iface,
267 struct device *bmc)
268{
269 int err;
270
271 init_completion(&data->read_complete);
272 data->bmc_device = bmc;
273
274 /* Initialize IPMI address */
275 data->address.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
276 data->address.channel = IPMI_BMC_CHANNEL;
277 data->address.data[0] = 0;
278 data->interface = iface;
279
280 /* Initialize message buffers */
281 data->tx_msgid = 0;
282 data->tx_message.netfn = AEM_NETFN;
283
284 /* Create IPMI messaging interface user */
285 err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs,
286 data, &data->user);
287 if (err < 0) {
288 dev_err(bmc, "Unable to register user with IPMI "
289 "interface %d\n", data->interface);
290 return -EACCES;
291 }
292
293 return 0;
294}
295
296/* Send an IPMI command */
297static int aem_send_message(struct aem_ipmi_data *data)
298{
299 int err;
300
301 err = ipmi_validate_addr(&data->address, sizeof(data->address));
302 if (err)
303 goto out;
304
305 data->tx_msgid++;
306 err = ipmi_request_settime(data->user, &data->address, data->tx_msgid,
307 &data->tx_message, data, 0, 0, 0);
308 if (err)
309 goto out1;
310
311 return 0;
312out1:
313 dev_err(data->bmc_device, "request_settime=%x\n", err);
314 return err;
315out:
316 dev_err(data->bmc_device, "validate_addr=%x\n", err);
317 return err;
318}
319
320/* Dispatch IPMI messages to callers */
321static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
322{
323 unsigned short rx_len;
324 struct aem_ipmi_data *data = user_msg_data;
325
326 if (msg->msgid != data->tx_msgid) {
327 dev_err(data->bmc_device, "Mismatch between received msgid "
328 "(%02x) and transmitted msgid (%02x)!\n",
329 (int)msg->msgid,
330 (int)data->tx_msgid);
331 ipmi_free_recv_msg(msg);
332 return;
333 }
334
335 data->rx_recv_type = msg->recv_type;
336 if (msg->msg.data_len > 0)
337 data->rx_result = msg->msg.data[0];
338 else
339 data->rx_result = IPMI_UNKNOWN_ERR_COMPLETION_CODE;
340
341 if (msg->msg.data_len > 1) {
342 rx_len = msg->msg.data_len - 1;
343 if (data->rx_msg_len < rx_len)
344 rx_len = data->rx_msg_len;
345 data->rx_msg_len = rx_len;
346 memcpy(data->rx_msg_data, msg->msg.data + 1, data->rx_msg_len);
347 } else
348 data->rx_msg_len = 0;
349
350 ipmi_free_recv_msg(msg);
351 complete(&data->read_complete);
352}
353
354/* ID functions */
355
356/* Obtain an id */
357static int aem_idr_get(int *id)
358{
359 int i, err;
360
361again:
362 if (unlikely(!idr_pre_get(&aem_idr, GFP_KERNEL)))
363 return -ENOMEM;
364
365 spin_lock(&aem_idr_lock);
366 err = idr_get_new(&aem_idr, NULL, &i);
367 spin_unlock(&aem_idr_lock);
368
369 if (unlikely(err == -EAGAIN))
370 goto again;
371 else if (unlikely(err))
372 return err;
373
374 *id = i & MAX_ID_MASK;
375 return 0;
376}
377
378/* Release an object ID */
379static void aem_idr_put(int id)
380{
381 spin_lock(&aem_idr_lock);
382 idr_remove(&aem_idr, id);
383 spin_unlock(&aem_idr_lock);
384}
385
386/* Sensor support functions */
387
388/* Read a sensor value */
389static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
390 void *buf, size_t size)
391{
392 int rs_size, res;
393 struct aem_read_sensor_req rs_req;
394 struct aem_read_sensor_resp *rs_resp;
395 struct aem_ipmi_data *ipmi = &data->ipmi;
396
397 /* AEM registers are 1, 2, 4 or 8 bytes */
398 switch (size) {
399 case 1:
400 case 2:
401 case 4:
402 case 8:
403 break;
404 default:
405 return -EINVAL;
406 }
407
408 rs_req.id = system_x_id;
409 rs_req.module_handle = data->module_handle;
410 rs_req.element = elt;
411 rs_req.subcommand = AEM_READ_REGISTER;
412 rs_req.reg = reg;
413 rs_req.rx_buf_size = size;
414
415 ipmi->tx_message.cmd = AEM_ELEMENT_CMD;
416 ipmi->tx_message.data = (char *)&rs_req;
417 ipmi->tx_message.data_len = sizeof(rs_req);
418
419 rs_size = sizeof(*rs_resp) + size;
420 rs_resp = kzalloc(rs_size, GFP_KERNEL);
421 if (!rs_resp)
422 return -ENOMEM;
423
424 ipmi->rx_msg_data = rs_resp;
425 ipmi->rx_msg_len = rs_size;
426
427 aem_send_message(ipmi);
428
429 res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT);
430 if (!res)
431 return -ETIMEDOUT;
432
433 if (ipmi->rx_result || ipmi->rx_msg_len != rs_size ||
434 memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) {
435 kfree(rs_resp);
436 return -ENOENT;
437 }
438
439 switch (size) {
440 case 1: {
441 u8 *x = buf;
442 *x = rs_resp->bytes[0];
443 break;
444 }
445 case 2: {
446 u16 *x = buf;
447 *x = be16_to_cpup((__be16 *)rs_resp->bytes);
448 break;
449 }
450 case 4: {
451 u32 *x = buf;
452 *x = be32_to_cpup((__be32 *)rs_resp->bytes);
453 break;
454 }
455 case 8: {
456 u64 *x = buf;
457 *x = be64_to_cpup((__be64 *)rs_resp->bytes);
458 break;
459 }
460 }
461
462 return 0;
463}
464
465/* Update AEM energy registers */
466static void update_aem_energy(struct aem_data *data)
467{
468 aem_read_sensor(data, AEM_ENERGY_ELEMENT, 0, &data->energy[0], 8);
469 if (data->ver_major < 2)
470 return;
471 aem_read_sensor(data, AEM_ENERGY_ELEMENT, 1, &data->energy[1], 8);
472}
473
474/* Update all AEM1 sensors */
475static void update_aem1_sensors(struct aem_data *data)
476{
477 mutex_lock(&data->lock);
478 if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) &&
479 data->valid)
480 goto out;
481
482 update_aem_energy(data);
483out:
484 mutex_unlock(&data->lock);
485}
486
487/* Update all AEM2 sensors */
488static void update_aem2_sensors(struct aem_data *data)
489{
490 int i;
491
492 mutex_lock(&data->lock);
493 if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) &&
494 data->valid)
495 goto out;
496
497 update_aem_energy(data);
498 aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 0, &data->temp[0], 1);
499 aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 1, &data->temp[1], 1);
500
501 for (i = POWER_CAP; i <= POWER_AUX; i++)
502 aem_read_sensor(data, AEM_POWER_CAP_ELEMENT, i,
503 &data->pcap[i], 2);
504out:
505 mutex_unlock(&data->lock);
506}
507
508/* Delete an AEM instance */
509static void aem_delete(struct aem_data *data)
510{
511 list_del(&data->list);
512 aem_remove_sensors(data);
513 hwmon_device_unregister(data->hwmon_dev);
514 ipmi_destroy_user(data->ipmi.user);
515 dev_set_drvdata(&data->pdev->dev, NULL);
516 platform_device_unregister(data->pdev);
517 aem_idr_put(data->id);
518 kfree(data);
519}
520
521/* Probe functions for AEM1 devices */
522
523/* Retrieve version and module handle for an AEM1 instance */
524static int aem_find_aem1_count(struct aem_ipmi_data *data)
525{
526 int res;
527 struct aem_find_firmware_req ff_req;
528 struct aem_find_firmware_resp ff_resp;
529
530 ff_req.id = system_x_id;
531 ff_req.index = 0;
532 ff_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID);
533
534 data->tx_message.cmd = AEM_FIND_FW_CMD;
535 data->tx_message.data = (char *)&ff_req;
536 data->tx_message.data_len = sizeof(ff_req);
537
538 data->rx_msg_data = &ff_resp;
539 data->rx_msg_len = sizeof(ff_resp);
540
541 aem_send_message(data);
542
543 res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT);
544 if (!res)
545 return -ETIMEDOUT;
546
547 if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) ||
548 memcmp(&ff_resp.id, &system_x_id, sizeof(system_x_id)))
549 return -ENOENT;
550
551 return ff_resp.num_instances;
552}
553
554/* Find and initialize one AEM1 instance */
555static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
556{
557 struct aem_data *data;
558 int i;
559 int res = -ENOMEM;
560
561 data = kzalloc(sizeof(*data), GFP_KERNEL);
562 if (!data)
563 return res;
564 mutex_init(&data->lock);
565
566 /* Copy instance data */
567 data->ver_major = 1;
568 data->ver_minor = 0;
569 data->module_handle = module_handle;
570 for (i = 0; i < AEM1_NUM_ENERGY_REGS; i++)
571 data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
572
573 /* Create sub-device for this fw instance */
574 if (aem_idr_get(&data->id))
575 goto id_err;
576
577 data->pdev = platform_device_alloc(DRVNAME, data->id);
578 if (!data->pdev)
579 goto dev_err;
580 data->pdev->dev.driver = &aem_driver;
581
582 res = platform_device_add(data->pdev);
583 if (res)
584 goto ipmi_err;
585
586 dev_set_drvdata(&data->pdev->dev, data);
587
588 /* Set up IPMI interface */
589 if (aem_init_ipmi_data(&data->ipmi, probe->interface,
590 probe->bmc_device))
591 goto ipmi_err;
592
593 /* Register with hwmon */
594 data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
595
596 if (IS_ERR(data->hwmon_dev)) {
597 dev_err(&data->pdev->dev, "Unable to register hwmon "
598 "device for IPMI interface %d\n",
599 probe->interface);
600 goto hwmon_reg_err;
601 }
602
603 data->update = update_aem1_sensors;
604
605 /* Find sensors */
606 if (aem1_find_sensors(data))
607 goto sensor_err;
608
609 /* Add to our list of AEM devices */
610 list_add_tail(&data->list, &driver_data.aem_devices);
611
612 dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n",
613 data->ver_major, data->ver_minor,
614 data->module_handle);
615 return 0;
616
617sensor_err:
618 hwmon_device_unregister(data->hwmon_dev);
619hwmon_reg_err:
620 ipmi_destroy_user(data->ipmi.user);
621ipmi_err:
622 dev_set_drvdata(&data->pdev->dev, NULL);
623 platform_device_unregister(data->pdev);
624dev_err:
625 aem_idr_put(data->id);
626id_err:
627 kfree(data);
628
629 return res;
630}
631
632/* Find and initialize all AEM1 instances */
633static int aem_init_aem1(struct aem_ipmi_data *probe)
634{
635 int num, i, err;
636
637 num = aem_find_aem1_count(probe);
638 for (i = 0; i < num; i++) {
639 err = aem_init_aem1_inst(probe, i);
640 if (err) {
641 dev_err(probe->bmc_device,
642 "Error %d initializing AEM1 0x%X\n",
643 err, i);
644 return err;
645 }
646 }
647
648 return 0;
649}
650
651/* Probe functions for AEM2 devices */
652
653/* Retrieve version and module handle for an AEM2 instance */
654static int aem_find_aem2(struct aem_ipmi_data *data,
655 struct aem_find_instance_resp *fi_resp,
656 int instance_num)
657{
658 int res;
659 struct aem_find_instance_req fi_req;
660
661 fi_req.id = system_x_id;
662 fi_req.instance_number = instance_num;
663 fi_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID);
664
665 data->tx_message.cmd = AEM_FW_INSTANCE_CMD;
666 data->tx_message.data = (char *)&fi_req;
667 data->tx_message.data_len = sizeof(fi_req);
668
669 data->rx_msg_data = fi_resp;
670 data->rx_msg_len = sizeof(*fi_resp);
671
672 aem_send_message(data);
673
674 res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT);
675 if (!res)
676 return -ETIMEDOUT;
677
678 if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) ||
679 memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id)))
680 return -ENOENT;
681
682 return 0;
683}
684
685/* Find and initialize one AEM2 instance */
686static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
687 struct aem_find_instance_resp *fi_resp)
688{
689 struct aem_data *data;
690 int i;
691 int res = -ENOMEM;
692
693 data = kzalloc(sizeof(*data), GFP_KERNEL);
694 if (!data)
695 return res;
696 mutex_init(&data->lock);
697
698 /* Copy instance data */
699 data->ver_major = fi_resp->major;
700 data->ver_minor = fi_resp->minor;
701 data->module_handle = fi_resp->module_handle;
702 for (i = 0; i < AEM2_NUM_ENERGY_REGS; i++)
703 data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
704
705 /* Create sub-device for this fw instance */
706 if (aem_idr_get(&data->id))
707 goto id_err;
708
709 data->pdev = platform_device_alloc(DRVNAME, data->id);
710 if (!data->pdev)
711 goto dev_err;
712 data->pdev->dev.driver = &aem_driver;
713
714 res = platform_device_add(data->pdev);
715 if (res)
716 goto ipmi_err;
717
718 dev_set_drvdata(&data->pdev->dev, data);
719
720 /* Set up IPMI interface */
721 if (aem_init_ipmi_data(&data->ipmi, probe->interface,
722 probe->bmc_device))
723 goto ipmi_err;
724
725 /* Register with hwmon */
726 data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
727
728 if (IS_ERR(data->hwmon_dev)) {
729 dev_err(&data->pdev->dev, "Unable to register hwmon "
730 "device for IPMI interface %d\n",
731 probe->interface);
732 goto hwmon_reg_err;
733 }
734
735 data->update = update_aem2_sensors;
736
737 /* Find sensors */
738 if (aem2_find_sensors(data))
739 goto sensor_err;
740
741 /* Add to our list of AEM devices */
742 list_add_tail(&data->list, &driver_data.aem_devices);
743
744 dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n",
745 data->ver_major, data->ver_minor,
746 data->module_handle);
747 return 0;
748
749sensor_err:
750 hwmon_device_unregister(data->hwmon_dev);
751hwmon_reg_err:
752 ipmi_destroy_user(data->ipmi.user);
753ipmi_err:
754 dev_set_drvdata(&data->pdev->dev, NULL);
755 platform_device_unregister(data->pdev);
756dev_err:
757 aem_idr_put(data->id);
758id_err:
759 kfree(data);
760
761 return res;
762}
763
764/* Find and initialize all AEM2 instances */
765static int aem_init_aem2(struct aem_ipmi_data *probe)
766{
767 struct aem_find_instance_resp fi_resp;
768 int err;
769 int i = 0;
770
771 while (!aem_find_aem2(probe, &fi_resp, i)) {
772 if (fi_resp.major != 2) {
773 dev_err(probe->bmc_device, "Unknown AEM v%d; please "
774 "report this to the maintainer.\n",
775 fi_resp.major);
776 i++;
777 continue;
778 }
779 err = aem_init_aem2_inst(probe, &fi_resp);
780 if (err) {
781 dev_err(probe->bmc_device,
782 "Error %d initializing AEM2 0x%X\n",
783 err, fi_resp.module_handle);
784 return err;
785 }
786 i++;
787 }
788
789 return 0;
790}
791
792/* Probe a BMC for AEM firmware instances */
793static void aem_register_bmc(int iface, struct device *dev)
794{
795 struct aem_ipmi_data probe;
796
797 if (aem_init_ipmi_data(&probe, iface, dev))
798 return;
799
800 /* Ignore probe errors; they won't cause problems */
801 aem_init_aem1(&probe);
802 aem_init_aem2(&probe);
803
804 ipmi_destroy_user(probe.user);
805}
806
807/* Handle BMC deletion */
808static void aem_bmc_gone(int iface)
809{
810 struct aem_data *p1, *next1;
811
812 list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
813 if (p1->ipmi.interface == iface)
814 aem_delete(p1);
815}
816
817/* sysfs support functions */
818
819/* AEM device name */
820static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
821 char *buf)
822{
823 struct aem_data *data = dev_get_drvdata(dev);
824
825 return sprintf(buf, "%s%d\n", DRVNAME, data->ver_major);
826}
827static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
828
829/* AEM device version */
830static ssize_t show_version(struct device *dev,
831 struct device_attribute *devattr,
832 char *buf)
833{
834 struct aem_data *data = dev_get_drvdata(dev);
835
836 return sprintf(buf, "%d.%d\n", data->ver_major, data->ver_minor);
837}
838static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, 0);
839
840/* Display power use */
841static ssize_t aem_show_power(struct device *dev,
842 struct device_attribute *devattr,
843 char *buf)
844{
845 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
846 struct aem_data *data = dev_get_drvdata(dev);
847 u64 before, after, delta, time;
848 signed long leftover;
849 struct timespec b, a;
850
851 mutex_lock(&data->lock);
852 update_aem_energy(data);
853 getnstimeofday(&b);
854 before = data->energy[attr->index];
855
856 leftover = schedule_timeout_interruptible(
857 msecs_to_jiffies(data->power_period[attr->index])
858 );
859 if (leftover) {
860 mutex_unlock(&data->lock);
861 return 0;
862 }
863
864 update_aem_energy(data);
865 getnstimeofday(&a);
866 after = data->energy[attr->index];
867 mutex_unlock(&data->lock);
868
869 time = timespec_to_ns(&a) - timespec_to_ns(&b);
870 delta = (after - before) * UJ_PER_MJ;
871
872 return sprintf(buf, "%llu\n",
873 (unsigned long long)div64_u64(delta * NSEC_PER_SEC, time));
874}
875
876/* Display energy use */
877static ssize_t aem_show_energy(struct device *dev,
878 struct device_attribute *devattr,
879 char *buf)
880{
881 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
882 struct aem_data *a = dev_get_drvdata(dev);
883 a->update(a);
884
885 return sprintf(buf, "%llu\n",
886 (unsigned long long)a->energy[attr->index] * 1000);
887}
888
889/* Display power interval registers */
890static ssize_t aem_show_power_period(struct device *dev,
891 struct device_attribute *devattr,
892 char *buf)
893{
894 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
895 struct aem_data *a = dev_get_drvdata(dev);
896 a->update(a);
897
898 return sprintf(buf, "%lu\n", a->power_period[attr->index]);
899}
900
901/* Set power interval registers */
902static ssize_t aem_set_power_period(struct device *dev,
903 struct device_attribute *devattr,
904 const char *buf, size_t count)
905{
906 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
907 struct aem_data *a = dev_get_drvdata(dev);
908 unsigned long temp;
909 int res;
910
911 res = strict_strtoul(buf, 10, &temp);
912 if (res)
913 return res;
914
915 if (temp < AEM_MIN_POWER_INTERVAL)
916 return -EINVAL;
917
918 mutex_lock(&a->lock);
919 a->power_period[attr->index] = temp;
920 mutex_unlock(&a->lock);
921
922 return count;
923}
924
925/* Discover sensors on an AEM device */
926static int aem_register_sensors(struct aem_data *data,
927 struct aem_ro_sensor_template *ro,
928 struct aem_rw_sensor_template *rw)
929{
930 struct device *dev = &data->pdev->dev;
931 struct sensor_device_attribute *sensors = data->sensors;
932 int err;
933
934 /* Set up read-only sensors */
935 while (ro->label) {
936 sensors->dev_attr.attr.name = ro->label;
937 sensors->dev_attr.attr.mode = S_IRUGO;
938 sensors->dev_attr.show = ro->show;
939 sensors->index = ro->index;
940
941 err = device_create_file(dev, &sensors->dev_attr);
942 if (err) {
943 sensors->dev_attr.attr.name = NULL;
944 goto error;
945 }
946 sensors++;
947 ro++;
948 }
949
950 /* Set up read-write sensors */
951 while (rw->label) {
952 sensors->dev_attr.attr.name = rw->label;
953 sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR;
954 sensors->dev_attr.show = rw->show;
955 sensors->dev_attr.store = rw->set;
956 sensors->index = rw->index;
957
958 err = device_create_file(dev, &sensors->dev_attr);
959 if (err) {
960 sensors->dev_attr.attr.name = NULL;
961 goto error;
962 }
963 sensors++;
964 rw++;
965 }
966
967 err = device_create_file(dev, &sensor_dev_attr_name.dev_attr);
968 if (err)
969 goto error;
970 err = device_create_file(dev, &sensor_dev_attr_version.dev_attr);
971 return err;
972
973error:
974 aem_remove_sensors(data);
975 return err;
976}
977
978/* sysfs support functions for AEM2 sensors */
979
980/* Display temperature use */
981static ssize_t aem2_show_temp(struct device *dev,
982 struct device_attribute *devattr,
983 char *buf)
984{
985 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
986 struct aem_data *a = dev_get_drvdata(dev);
987 a->update(a);
988
989 return sprintf(buf, "%u\n", a->temp[attr->index] * 1000);
990}
991
992/* Display power-capping registers */
993static ssize_t aem2_show_pcap_value(struct device *dev,
994 struct device_attribute *devattr,
995 char *buf)
996{
997 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
998 struct aem_data *a = dev_get_drvdata(dev);
999 a->update(a);
1000
1001 return sprintf(buf, "%u\n", a->pcap[attr->index] * 100000);
1002}
1003
1004/* Remove sensors attached to an AEM device */
1005static void aem_remove_sensors(struct aem_data *data)
1006{
1007 int i;
1008
1009 for (i = 0; i < AEM_NUM_SENSORS; i++) {
1010 if (!data->sensors[i].dev_attr.attr.name)
1011 continue;
1012 device_remove_file(&data->pdev->dev,
1013 &data->sensors[i].dev_attr);
1014 }
1015
1016 device_remove_file(&data->pdev->dev,
1017 &sensor_dev_attr_name.dev_attr);
1018 device_remove_file(&data->pdev->dev,
1019 &sensor_dev_attr_version.dev_attr);
1020}
1021
1022/* Sensor probe functions */
1023
1024/* Description of AEM1 sensors */
1025static struct aem_ro_sensor_template aem1_ro_sensors[] = {
1026{"energy1_input", aem_show_energy, 0},
1027{"power1_average", aem_show_power, 0},
1028{NULL, NULL, 0},
1029};
1030
1031static struct aem_rw_sensor_template aem1_rw_sensors[] = {
1032{"power1_average_interval", aem_show_power_period, aem_set_power_period, 0},
1033{NULL, NULL, NULL, 0},
1034};
1035
1036/* Description of AEM2 sensors */
1037static struct aem_ro_sensor_template aem2_ro_sensors[] = {
1038{"energy1_input", aem_show_energy, 0},
1039{"energy2_input", aem_show_energy, 1},
1040{"power1_average", aem_show_power, 0},
1041{"power2_average", aem_show_power, 1},
1042{"temp1_input", aem2_show_temp, 0},
1043{"temp2_input", aem2_show_temp, 1},
1044
1045{"power4_average", aem2_show_pcap_value, POWER_CAP_MAX_HOTPLUG},
1046{"power5_average", aem2_show_pcap_value, POWER_CAP_MAX},
1047{"power6_average", aem2_show_pcap_value, POWER_CAP_MIN_WARNING},
1048{"power7_average", aem2_show_pcap_value, POWER_CAP_MIN},
1049
1050{"power3_average", aem2_show_pcap_value, POWER_AUX},
1051{"power_cap", aem2_show_pcap_value, POWER_CAP},
1052{NULL, NULL, 0},
1053};
1054
1055static struct aem_rw_sensor_template aem2_rw_sensors[] = {
1056{"power1_average_interval", aem_show_power_period, aem_set_power_period, 0},
1057{"power2_average_interval", aem_show_power_period, aem_set_power_period, 1},
1058{NULL, NULL, NULL, 0},
1059};
1060
1061/* Set up AEM1 sensor attrs */
1062static int aem1_find_sensors(struct aem_data *data)
1063{
1064 return aem_register_sensors(data, aem1_ro_sensors, aem1_rw_sensors);
1065}
1066
1067/* Set up AEM2 sensor attrs */
1068static int aem2_find_sensors(struct aem_data *data)
1069{
1070 return aem_register_sensors(data, aem2_ro_sensors, aem2_rw_sensors);
1071}
1072
1073/* Module init/exit routines */
1074
1075static int __init aem_init(void)
1076{
1077 int res;
1078
1079 res = driver_register(&aem_driver);
1080 if (res) {
1081 printk(KERN_ERR "Can't register aem driver\n");
1082 return res;
1083 }
1084
1085 res = ipmi_smi_watcher_register(&driver_data.bmc_events);
1086 if (res)
1087 goto ipmi_reg_err;
1088 return 0;
1089
1090ipmi_reg_err:
1091 driver_unregister(&aem_driver);
1092 return res;
1093
1094}
1095
1096static void __exit aem_exit(void)
1097{
1098 struct aem_data *p1, *next1;
1099
1100 ipmi_smi_watcher_unregister(&driver_data.bmc_events);
1101 driver_unregister(&aem_driver);
1102 list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
1103 aem_delete(p1);
1104}
1105
1106MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
1107MODULE_DESCRIPTION("IBM Active Energy Manager power/temp sensor driver");
1108MODULE_LICENSE("GPL");
1109
1110module_init(aem_init);
1111module_exit(aem_exit);
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 2fa43183d375..43508d61eb7c 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -290,7 +290,7 @@ static u32 amd756_func(struct i2c_adapter *adapter)
290{ 290{
291 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | 291 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
292 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | 292 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
293 I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL; 293 I2C_FUNC_SMBUS_BLOCK_DATA;
294} 294}
295 295
296static const struct i2c_algorithm smbus_algorithm = { 296static const struct i2c_algorithm smbus_algorithm = {
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index 491718fe46b7..cae9dc89d88c 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -335,7 +335,7 @@ i2c_au1550_probe(struct platform_device *pdev)
335 goto out_mem; 335 goto out_mem;
336 } 336 }
337 337
338 priv->psc_base = r->start; 338 priv->psc_base = CKSEG1ADDR(r->start);
339 priv->xfer_timeout = 200; 339 priv->xfer_timeout = 200;
340 priv->ack_timeout = 200; 340 priv->ack_timeout = 200;
341 341
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 3dac920e53ea..43c9f8df9509 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -50,6 +50,7 @@
50#include <linux/init.h> 50#include <linux/init.h>
51#include <linux/i2c.h> 51#include <linux/i2c.h>
52#include <linux/delay.h> 52#include <linux/delay.h>
53#include <linux/dmi.h>
53#include <asm/io.h> 54#include <asm/io.h>
54 55
55MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
@@ -109,6 +110,18 @@ struct nforce2_smbus {
109/* Misc definitions */ 110/* Misc definitions */
110#define MAX_TIMEOUT 100 111#define MAX_TIMEOUT 100
111 112
113/* We disable the second SMBus channel on these boards */
114static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = {
115 {
116 .ident = "DFI Lanparty NF4 Expert",
117 .matches = {
118 DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"),
119 DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"),
120 },
121 },
122 { }
123};
124
112static struct pci_driver nforce2_driver; 125static struct pci_driver nforce2_driver;
113 126
114static void nforce2_abort(struct i2c_adapter *adap) 127static void nforce2_abort(struct i2c_adapter *adap)
@@ -367,10 +380,17 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
367 smbuses[0].base = 0; /* to have a check value */ 380 smbuses[0].base = 0; /* to have a check value */
368 } 381 }
369 /* SMBus adapter 2 */ 382 /* SMBus adapter 2 */
370 res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); 383 if (dmi_check_system(nforce2_dmi_blacklist2)) {
371 if (res2 < 0) { 384 dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n");
372 dev_err(&dev->dev, "Error probing SMB2.\n"); 385 res2 = -EPERM;
373 smbuses[1].base = 0; /* to have a check value */ 386 smbuses[1].base = 0;
387 } else {
388 res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1],
389 "SMB2");
390 if (res2 < 0) {
391 dev_err(&dev->dev, "Error probing SMB2.\n");
392 smbuses[1].base = 0; /* to have a check value */
393 }
374 } 394 }
375 if ((res1 < 0) && (res2 < 0)) { 395 if ((res1 < 0) && (res2 < 0)) {
376 /* we did not find even one of the SMBuses, so we give up */ 396 /* we did not find even one of the SMBuses, so we give up */
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index fb7ea5637eca..cf507b3f60f3 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -207,9 +207,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
207 fake_client->flags = 0; 207 fake_client->flags = 0;
208 strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE); 208 strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE);
209 209
210 /* Prevent 24RF08 corruption (in case of user error) */
211 i2c_smbus_write_quick(real_client, 0);
212
213 if ((err = i2c_attach_client(real_client)) != 0) 210 if ((err = i2c_attach_client(real_client)) != 0)
214 goto exit_kfree2; 211 goto exit_kfree2;
215 212
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index c99ebeadb558..d0175f4f8fc6 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)
74 if (driver->id_table) 74 if (driver->id_table)
75 return i2c_match_id(driver->id_table, client) != NULL; 75 return i2c_match_id(driver->id_table, client) != NULL;
76 76
77 /* new style drivers use the same kind of driver matching policy 77 return 0;
78 * as platform devices or SPI: compare device and driver IDs.
79 */
80 return strcmp(client->driver_name, drv->name) == 0;
81} 78}
82 79
83#ifdef CONFIG_HOTPLUG 80#ifdef CONFIG_HOTPLUG
@@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
91 if (dev->driver) 88 if (dev->driver)
92 return 0; 89 return 0;
93 90
94 if (client->driver_name[0]) { 91 if (add_uevent_var(env, "MODALIAS=%s%s",
95 if (add_uevent_var(env, "MODALIAS=%s", client->driver_name)) 92 I2C_MODULE_PREFIX, client->name))
96 return -ENOMEM; 93 return -ENOMEM;
97 } else {
98 if (add_uevent_var(env, "MODALIAS=%s%s",
99 I2C_MODULE_PREFIX, client->name))
100 return -ENOMEM;
101 }
102 dev_dbg(dev, "uevent\n"); 94 dev_dbg(dev, "uevent\n");
103 return 0; 95 return 0;
104} 96}
@@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att
206static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 198static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
207{ 199{
208 struct i2c_client *client = to_i2c_client(dev); 200 struct i2c_client *client = to_i2c_client(dev);
209 return client->driver_name[0] 201 return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
210 ? sprintf(buf, "%s\n", client->driver_name)
211 : sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
212} 202}
213 203
214static struct device_attribute i2c_dev_attrs[] = { 204static struct device_attribute i2c_dev_attrs[] = {
@@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
282 client->addr = info->addr; 272 client->addr = info->addr;
283 client->irq = info->irq; 273 client->irq = info->irq;
284 274
285 strlcpy(client->driver_name, info->driver_name,
286 sizeof(client->driver_name));
287 strlcpy(client->name, info->type, sizeof(client->name)); 275 strlcpy(client->name, info->type, sizeof(client->name));
288 276
289 /* a new style driver may be bound to this device when we 277 /* a new style driver may be bound to this device when we
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index f702f9152ce6..1607536ff5fb 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1,8 +1,6 @@
1# 1#
2# IDE ATA ATAPI Block device driver configuration 2# IDE ATA ATAPI Block device driver configuration
3# 3#
4# Andre Hedrick <andre@linux-ide.org>
5#
6 4
7# Select HAVE_IDE if IDE is supported 5# Select HAVE_IDE if IDE is supported
8config HAVE_IDE 6config HAVE_IDE
@@ -335,7 +333,7 @@ config BLK_DEV_CMD640
335 This driver will work automatically in PCI based systems (most new 333 This driver will work automatically in PCI based systems (most new
336 systems have PCI slots). But if your system uses VESA local bus 334 systems have PCI slots). But if your system uses VESA local bus
337 (VLB) instead of PCI, you must also supply a kernel boot parameter 335 (VLB) instead of PCI, you must also supply a kernel boot parameter
338 to enable the CMD640 bugfix/support: "ide0=cmd640_vlb". (Try "man 336 to enable the CMD640 bugfix/support: "cmd640.probe_vlb". (Try "man
339 bootparam" or see the documentation of your boot loader about how to 337 bootparam" or see the documentation of your boot loader about how to
340 pass options to the kernel.) 338 pass options to the kernel.)
341 339
@@ -457,27 +455,11 @@ config BLK_DEV_ALI15X3
457 onboard chipsets. It also tests for Simplex mode and enables 455 onboard chipsets. It also tests for Simplex mode and enables
458 normal dual channel support. 456 normal dual channel support.
459 457
460 If you say Y here, you also need to say Y to "Use DMA by default 458 Please read the comments at the top of
461 when available", above. Please read the comments at the top of
462 <file:drivers/ide/pci/alim15x3.c>. 459 <file:drivers/ide/pci/alim15x3.c>.
463 460
464 If unsure, say N. 461 If unsure, say N.
465 462
466config WDC_ALI15X3
467 bool "ALI M15x3 WDC support (DANGEROUS)"
468 depends on BLK_DEV_ALI15X3
469 ---help---
470 This allows for UltraDMA support for WDC drives that ignore CRC
471 checking. You are a fool for enabling this option, but there have
472 been requests. DO NOT COMPLAIN IF YOUR DRIVE HAS FS CORRUPTION, IF
473 YOU ENABLE THIS! No one will listen, just laugh for ignoring this
474 SERIOUS WARNING.
475
476 Using this option can allow WDC drives to run at ATA-4/5 transfer
477 rates with only an ATA-2 support structure.
478
479 SAY N!
480
481config BLK_DEV_AMD74XX 463config BLK_DEV_AMD74XX
482 tristate "AMD and nVidia IDE support" 464 tristate "AMD and nVidia IDE support"
483 depends on !ARM 465 depends on !ARM
@@ -520,9 +502,6 @@ config BLK_DEV_CY82C693
520 This driver adds detection and support for the CY82C693 chipset 502 This driver adds detection and support for the CY82C693 chipset
521 used on Digital's PC-Alpha 164SX boards. 503 used on Digital's PC-Alpha 164SX boards.
522 504
523 If you say Y here, you need to say Y to "Use DMA by default
524 when available" as well.
525
526config BLK_DEV_CS5520 505config BLK_DEV_CS5520
527 tristate "Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)" 506 tristate "Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)"
528 depends on EXPERIMENTAL 507 depends on EXPERIMENTAL
@@ -613,13 +592,12 @@ config BLK_DEV_SC1200
613 National SCx200 series of embedded x86 "Geode" systems. 592 National SCx200 series of embedded x86 "Geode" systems.
614 593
615config BLK_DEV_PIIX 594config BLK_DEV_PIIX
616 tristate "Intel PIIXn chipsets support" 595 tristate "Intel PIIX/ICH chipsets support"
617 select BLK_DEV_IDEDMA_PCI 596 select BLK_DEV_IDEDMA_PCI
618 help 597 help
619 This driver adds explicit support for Intel PIIX and ICH chips 598 This driver adds explicit support for Intel PIIX and ICH chips.
620 and also for the Efar Victory66 (slc90e66) chip. This allows 599 This allows the kernel to change PIO, DMA and UDMA speeds and to
621 the kernel to change PIO, DMA and UDMA speeds and to configure 600 configure the chip to optimum performance.
622 the chip to optimum performance.
623 601
624config BLK_DEV_IT8213 602config BLK_DEV_IT8213
625 tristate "IT8213 IDE support" 603 tristate "IT8213 IDE support"
@@ -657,11 +635,7 @@ config BLK_DEV_PDC202XX_OLD
657 happen if the BIOS revisions of all installed cards (three-max) do 635 happen if the BIOS revisions of all installed cards (three-max) do
658 not match, the driver attempts to do dynamic tuning of the chipset 636 not match, the driver attempts to do dynamic tuning of the chipset
659 at boot-time for max-speed. Ultra33 BIOS 1.25 or newer is required 637 at boot-time for max-speed. Ultra33 BIOS 1.25 or newer is required
660 for more than one card. This card may require that you say Y to 638 for more than one card.
661 "Special UDMA Feature".
662
663 If you say Y here, you need to say Y to "Use DMA by default when
664 available" as well.
665 639
666 Please read the comments at the top of 640 Please read the comments at the top of
667 <file:drivers/ide/pci/pdc202xx_old.c>. 641 <file:drivers/ide/pci/pdc202xx_old.c>.
@@ -710,9 +684,6 @@ config BLK_DEV_SIS5513
710 ATA100: SiS635, SiS645, SiS650, SiS730, SiS735, SiS740, 684 ATA100: SiS635, SiS645, SiS650, SiS730, SiS735, SiS740,
711 SiS745, SiS750 685 SiS745, SiS750
712 686
713 If you say Y here, you need to say Y to "Use DMA by default when
714 available" as well.
715
716 Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>. 687 Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>.
717 688
718config BLK_DEV_SL82C105 689config BLK_DEV_SL82C105
@@ -734,9 +705,6 @@ config BLK_DEV_SLC90E66
734 and it will handle timing cycles. Since this is an improved 705 and it will handle timing cycles. Since this is an improved
735 look-a-like to the PIIX4 it should be a nice addition. 706 look-a-like to the PIIX4 it should be a nice addition.
736 707
737 If you say Y here, you need to say Y to "Use DMA by default when
738 available" as well.
739
740 Please read the comments at the top of 708 Please read the comments at the top of
741 <file:drivers/ide/pci/slc90e66.c>. 709 <file:drivers/ide/pci/slc90e66.c>.
742 710
@@ -888,17 +856,17 @@ config BLK_DEV_IDEDOUBLER
888 bool "Amiga IDE Doubler support (EXPERIMENTAL)" 856 bool "Amiga IDE Doubler support (EXPERIMENTAL)"
889 depends on BLK_DEV_GAYLE && EXPERIMENTAL 857 depends on BLK_DEV_GAYLE && EXPERIMENTAL
890 ---help--- 858 ---help---
891 This driver provides support for the so-called `IDE doublers' (made 859 This feature provides support for the so-called `IDE doublers' (made
892 by various manufacturers, e.g. Eyetech) that can be connected to 860 by various manufacturers, e.g. Eyetech) that can be connected to
893 the on-board IDE interface of some Amiga models. Using such an IDE 861 the on-board IDE interface of some Amiga models. Using such an IDE
894 doubler, you can connect up to four instead of two IDE devices to 862 doubler, you can connect up to four instead of two IDE devices to
895 the Amiga's on-board IDE interface. 863 the Amiga's on-board IDE interface.
896 864
897 Note that the normal Amiga Gayle IDE driver may not work correctly 865 Note that the normal Amiga Gayle IDE driver may not work correctly
898 if you have an IDE doubler and don't enable this driver! 866 if you have an IDE doubler and don't enable this feature!
899 867
900 Say Y if you have an IDE doubler. The driver is enabled at kernel 868 Say Y if you have an IDE doubler. The feature is enabled at kernel
901 runtime using the "ide=doubler" kernel boot parameter. 869 runtime using the "gayle.doubler" kernel boot parameter.
902 870
903config BLK_DEV_BUDDHA 871config BLK_DEV_BUDDHA
904 tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" 872 tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)"
@@ -1060,6 +1028,7 @@ endif
1060 1028
1061config BLK_DEV_HD_ONLY 1029config BLK_DEV_HD_ONLY
1062 bool "Old hard disk (MFM/RLL/IDE) driver" 1030 bool "Old hard disk (MFM/RLL/IDE) driver"
1031 depends on !ARM || ARCH_RPC || ARCH_SHARK || BROKEN
1063 help 1032 help
1064 There are two drivers for MFM/RLL/IDE hard disks. Most people use 1033 There are two drivers for MFM/RLL/IDE hard disks. Most people use
1065 the newer enhanced driver, but this old one is still around for two 1034 the newer enhanced driver, but this old one is still around for two
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
index 713cef20622e..8e8c28104b45 100644
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -42,6 +42,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
42 42
43 hw.io_ports.ctl_addr = aux + (6 * 0x20); 43 hw.io_ports.ctl_addr = aux + (6 * 0x20);
44 hw.irq = irq; 44 hw.irq = irq;
45 hw.chipset = ide_generic;
45 46
46 hwif = ide_find_port(); 47 hwif = ide_find_port();
47 if (hwif == NULL) 48 if (hwif == NULL)
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index 4263ffd4ab20..2f311da4c963 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -49,6 +49,7 @@ static int __init ide_arm_init(void)
49 memset(&hw, 0, sizeof(hw)); 49 memset(&hw, 0, sizeof(hw));
50 ide_std_init_ports(&hw, base, ctl); 50 ide_std_init_ports(&hw, base, ctl);
51 hw.irq = IDE_ARM_IRQ; 51 hw.irq = IDE_ARM_IRQ;
52 hw.chipset = ide_generic;
52 53
53 hwif = ide_find_port(); 54 hwif = ide_find_port();
54 if (hwif) { 55 if (hwif) {
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index 96378ebfb31f..d024ac8fad14 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -409,9 +409,6 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
409 409
410 ide_device_add(idx, &palm_bk3710_port_info); 410 ide_device_add(idx, &palm_bk3710_port_info);
411 411
412 if (!hwif->present)
413 goto out;
414
415 return 0; 412 return 0;
416out: 413out:
417 printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n"); 414 printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n");
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index a6073e248f45..2d92214096ab 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -22,6 +22,10 @@
22 22
23#define DRV_NAME "ide_generic" 23#define DRV_NAME "ide_generic"
24 24
25static int probe_mask = 0x03;
26module_param(probe_mask, int, 0);
27MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports");
28
25static ssize_t store_add(struct class *cls, const char *buf, size_t n) 29static ssize_t store_add(struct class *cls, const char *buf, size_t n)
26{ 30{
27 ide_hwif_t *hwif; 31 ide_hwif_t *hwif;
@@ -89,6 +93,9 @@ static int __init ide_generic_init(void)
89 u8 idx[MAX_HWIFS]; 93 u8 idx[MAX_HWIFS];
90 int i; 94 int i;
91 95
96 printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" module "
97 "parameter for probing all legacy ISA IDE ports\n");
98
92 for (i = 0; i < MAX_HWIFS; i++) { 99 for (i = 0; i < MAX_HWIFS; i++) {
93 ide_hwif_t *hwif; 100 ide_hwif_t *hwif;
94 unsigned long io_addr = ide_default_io_base(i); 101 unsigned long io_addr = ide_default_io_base(i);
@@ -96,7 +103,7 @@ static int __init ide_generic_init(void)
96 103
97 idx[i] = 0xff; 104 idx[i] = 0xff;
98 105
99 if (io_addr) { 106 if ((probe_mask & (1 << i)) && io_addr) {
100 if (!request_region(io_addr, 8, DRV_NAME)) { 107 if (!request_region(io_addr, 8, DRV_NAME)) {
101 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX " 108 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX "
102 "not free.\n", 109 "not free.\n",
@@ -125,6 +132,7 @@ static int __init ide_generic_init(void)
125 memset(&hw, 0, sizeof(hw)); 132 memset(&hw, 0, sizeof(hw));
126 ide_std_init_ports(&hw, io_addr, io_addr + 0x206); 133 ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
127 hw.irq = ide_default_irq(io_addr); 134 hw.irq = ide_default_irq(io_addr);
135 hw.chipset = ide_generic;
128 ide_init_port_hw(hwif, &hw); 136 ide_init_port_hw(hwif, &hw);
129 137
130 idx[i] = i; 138 idx[i] = i;
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 57d9a9a79a6f..0daf923541ff 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -95,7 +95,7 @@ void SELECT_DRIVE (ide_drive_t *drive)
95 hwif->OUTB(drive->select.all, hwif->io_ports.device_addr); 95 hwif->OUTB(drive->select.all, hwif->io_ports.device_addr);
96} 96}
97 97
98void SELECT_MASK (ide_drive_t *drive, int mask) 98static void SELECT_MASK(ide_drive_t *drive, int mask)
99{ 99{
100 const struct ide_port_ops *port_ops = drive->hwif->port_ops; 100 const struct ide_port_ops *port_ops = drive->hwif->port_ops;
101 101
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 6a8953f68e9f..adbd01784162 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -55,6 +55,7 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
55 memset(&hw, 0, sizeof(hw)); 55 memset(&hw, 0, sizeof(hw));
56 ide_std_init_ports(&hw, base, ctl); 56 ide_std_init_ports(&hw, base, ctl);
57 hw.irq = pnp_irq(dev, 0); 57 hw.irq = pnp_irq(dev, 0);
58 hw.chipset = ide_generic;
58 59
59 hwif = ide_find_port(); 60 hwif = ide_find_port();
60 if (hwif) { 61 if (hwif) {
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 34b0d4f26b58..380fa0c8cc84 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif)
648 648
649 get_device(&hwif->gendev); 649 get_device(&hwif->gendev);
650 650
651 hwif->portdev = device_create(ide_port_class, &hwif->gendev, 651 hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev,
652 MKDEV(0, 0), hwif->name); 652 MKDEV(0, 0), hwif, hwif->name);
653 if (IS_ERR(hwif->portdev)) { 653 if (IS_ERR(hwif->portdev)) {
654 ret = PTR_ERR(hwif->portdev); 654 ret = PTR_ERR(hwif->portdev);
655 device_unregister(&hwif->gendev); 655 device_unregister(&hwif->gendev);
656 } 656 }
657 dev_set_drvdata(hwif->portdev, hwif);
658out: 657out:
659 return ret; 658 return ret;
660} 659}
@@ -1334,8 +1333,7 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
1334static void ide_init_port(ide_hwif_t *hwif, unsigned int port, 1333static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1335 const struct ide_port_info *d) 1334 const struct ide_port_info *d)
1336{ 1335{
1337 if (d->chipset != ide_etrax100) 1336 hwif->channel = port;
1338 hwif->channel = port;
1339 1337
1340 if (d->chipset) 1338 if (d->chipset)
1341 hwif->chipset = d->chipset; 1339 hwif->chipset = d->chipset;
@@ -1520,7 +1518,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1520 continue; 1518 continue;
1521 } 1519 }
1522 1520
1523 if (d->chipset != ide_etrax100 && (i & 1) && mate) { 1521 if ((i & 1) && mate) {
1524 hwif->mate = mate; 1522 hwif->mate = mate;
1525 mate->mate = hwif; 1523 mate->mate = hwif;
1526 } 1524 }
@@ -1666,6 +1664,7 @@ static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no,
1666 1664
1667 ide_std_init_ports(hw, base, ctl); 1665 ide_std_init_ports(hw, base, ctl);
1668 hw->irq = irq; 1666 hw->irq = irq;
1667 hw->chipset = d->chipset;
1669 1668
1670 hwif = ide_find_port_slot(d); 1669 hwif = ide_find_port_slot(d);
1671 if (hwif) { 1670 if (hwif) {
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 8d6ad812a014..55ec7f798772 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -63,7 +63,6 @@ static int proc_ide_read_imodel
63 case ide_pmac: name = "mac-io"; break; 63 case ide_pmac: name = "mac-io"; break;
64 case ide_au1xxx: name = "au1xxx"; break; 64 case ide_au1xxx: name = "au1xxx"; break;
65 case ide_palm3710: name = "palm3710"; break; 65 case ide_palm3710: name = "palm3710"; break;
66 case ide_etrax100: name = "etrax100"; break;
67 case ide_acorn: name = "acorn"; break; 66 case ide_acorn: name = "acorn"; break;
68 default: name = "(unknown)"; break; 67 default: name = "(unknown)"; break;
69 } 68 }
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 5c730e4dd735..9a1d27ef3f8a 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -138,6 +138,8 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
138 138
139 hw->irq = IRQ_AMIGA_PORTS; 139 hw->irq = IRQ_AMIGA_PORTS;
140 hw->ack_intr = ack_intr; 140 hw->ack_intr = ack_intr;
141
142 hw->chipset = ide_generic;
141} 143}
142 144
143 /* 145 /*
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index 9e449a0c623f..af11028b4794 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -81,6 +81,8 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
81 81
82 hw->irq = IRQ_MFP_IDE; 82 hw->irq = IRQ_MFP_IDE;
83 hw->ack_intr = NULL; 83 hw->ack_intr = NULL;
84
85 hw->chipset = ide_generic;
84} 86}
85 87
86 /* 88 /*
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index a9c2593a898c..fed7d812761c 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -16,6 +16,7 @@
16#include <linux/ide.h> 16#include <linux/ide.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/zorro.h> 18#include <linux/zorro.h>
19#include <linux/module.h>
19 20
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/amigahw.h> 22#include <asm/amigahw.h>
@@ -62,7 +63,10 @@
62 GAYLE_NUM_HWIFS-1) 63 GAYLE_NUM_HWIFS-1)
63#define GAYLE_HAS_CONTROL_REG (!ide_doubler) 64#define GAYLE_HAS_CONTROL_REG (!ide_doubler)
64#define GAYLE_IDEREG_SIZE (ide_doubler ? 0x1000 : 0x2000) 65#define GAYLE_IDEREG_SIZE (ide_doubler ? 0x1000 : 0x2000)
66
65int ide_doubler = 0; /* support IDE doublers? */ 67int ide_doubler = 0; /* support IDE doublers? */
68EXPORT_SYMBOL_GPL(ide_doubler);
69
66module_param_named(doubler, ide_doubler, bool, 0); 70module_param_named(doubler, ide_doubler, bool, 0);
67MODULE_PARM_DESC(doubler, "enable support for IDE doublers"); 71MODULE_PARM_DESC(doubler, "enable support for IDE doublers");
68#endif /* CONFIG_BLK_DEV_IDEDOUBLER */ 72#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
@@ -112,6 +116,8 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base,
112 116
113 hw->irq = IRQ_AMIGA_PORTS; 117 hw->irq = IRQ_AMIGA_PORTS;
114 hw->ack_intr = ack_intr; 118 hw->ack_intr = ack_intr;
119
120 hw->chipset = ide_generic;
115} 121}
116 122
117 /* 123 /*
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index aa2ea3deac85..f633b6b3c7f3 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -135,13 +135,17 @@ static void ide_detach(struct pcmcia_device *link)
135{ 135{
136 ide_info_t *info = link->priv; 136 ide_info_t *info = link->priv;
137 ide_hwif_t *hwif = info->hwif; 137 ide_hwif_t *hwif = info->hwif;
138 unsigned long data_addr, ctl_addr;
138 139
139 DEBUG(0, "ide_detach(0x%p)\n", link); 140 DEBUG(0, "ide_detach(0x%p)\n", link);
140 141
142 data_addr = hwif->io_ports.data_addr;
143 ctl_addr = hwif->io_ports.ctl_addr;
144
141 ide_release(link); 145 ide_release(link);
142 146
143 release_region(hwif->io_ports.ctl_addr, 1); 147 release_region(ctl_addr, 1);
144 release_region(hwif->io_ports.data_addr, 8); 148 release_region(data_addr, 8);
145 149
146 kfree(info); 150 kfree(info);
147} /* ide_detach */ 151} /* ide_detach */
@@ -194,6 +198,16 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl,
194 if (hwif->present) 198 if (hwif->present)
195 return hwif; 199 return hwif;
196 200
201 /* retry registration in case device is still spinning up */
202 for (i = 0; i < 10; i++) {
203 msleep(100);
204 ide_port_scan(hwif);
205 if (hwif->present)
206 return hwif;
207 }
208
209 return hwif;
210
197out_release: 211out_release:
198 release_region(ctl, 1); 212 release_region(ctl, 1);
199 release_region(io, 8); 213 release_region(io, 8);
@@ -222,7 +236,7 @@ static int ide_config(struct pcmcia_device *link)
222 cistpl_cftable_entry_t dflt; 236 cistpl_cftable_entry_t dflt;
223 } *stk = NULL; 237 } *stk = NULL;
224 cistpl_cftable_entry_t *cfg; 238 cistpl_cftable_entry_t *cfg;
225 int i, pass, last_ret = 0, last_fn = 0, is_kme = 0; 239 int pass, last_ret = 0, last_fn = 0, is_kme = 0;
226 unsigned long io_base, ctl_base; 240 unsigned long io_base, ctl_base;
227 ide_hwif_t *hwif; 241 ide_hwif_t *hwif;
228 242
@@ -319,30 +333,15 @@ static int ide_config(struct pcmcia_device *link)
319 if (is_kme) 333 if (is_kme)
320 outb(0x81, ctl_base+1); 334 outb(0x81, ctl_base+1);
321 335
322 /* retry registration in case device is still spinning up */ 336 hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
323 for (i = 0; i < 10; i++) { 337 if (hwif == NULL && link->io.NumPorts1 == 0x20) {
324 hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
325 if (hwif)
326 break;
327 if (link->io.NumPorts1 == 0x20) {
328 outb(0x02, ctl_base + 0x10); 338 outb(0x02, ctl_base + 0x10);
329 hwif = idecs_register(io_base + 0x10, ctl_base + 0x10, 339 hwif = idecs_register(io_base + 0x10, ctl_base + 0x10,
330 link->irq.AssignedIRQ, link); 340 link->irq.AssignedIRQ, link);
331 if (hwif) {
332 io_base += 0x10;
333 ctl_base += 0x10;
334 break;
335 }
336 }
337 msleep(100);
338 } 341 }
339 342
340 if (hwif == NULL) { 343 if (hwif == NULL)
341 printk(KERN_NOTICE "ide-cs: ide_register() at 0x%3lx & 0x%3lx"
342 ", irq %u failed\n", io_base, ctl_base,
343 link->irq.AssignedIRQ);
344 goto failed; 344 goto failed;
345 }
346 345
347 info->ndev = 1; 346 info->ndev = 1;
348 sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2); 347 sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2);
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 1f527bbf8d96..2e84290d0bcc 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -78,6 +78,8 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
78 78
79 hw->irq = irq; 79 hw->irq = irq;
80 hw->ack_intr = ack_intr; 80 hw->ack_intr = ack_intr;
81
82 hw->chipset = ide_generic;
81} 83}
82 84
83static const char *mac_ide_name[] = 85static const char *mac_ide_name[] =
@@ -95,6 +97,9 @@ static int __init macide_init(void)
95 int irq; 97 int irq;
96 hw_regs_t hw; 98 hw_regs_t hw;
97 99
100 if (!MACH_IS_MAC)
101 return -ENODEV;
102
98 switch (macintosh_config->ide_type) { 103 switch (macintosh_config->ide_type) {
99 case MAC_IDE_QUADRA: 104 case MAC_IDE_QUADRA:
100 base = IDE_BASE; 105 base = IDE_BASE;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index 6f535d00e638..8ff6e2d20834 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -70,6 +70,8 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base,
70 70
71 hw->irq = irq; 71 hw->irq = irq;
72 hw->ack_intr = ack_intr; 72 hw->ack_intr = ack_intr;
73
74 hw->chipset = ide_generic;
73} 75}
74 76
75static void q40ide_input_data(ide_drive_t *drive, struct request *rq, 77static void q40ide_input_data(ide_drive_t *drive, struct request *rq,
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index 712d17bdd470..52fee3d2771a 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -4,7 +4,7 @@
4 * Author: Manish Lachwani, mlachwani@mvista.com 4 * Author: Manish Lachwani, mlachwani@mvista.com
5 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved. 5 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved.
6 * Author: Maciej W. Rozycki <macro@mips.com> 6 * Author: Maciej W. Rozycki <macro@mips.com>
7 * Copyright (c) 2006 Maciej W. Rozycki 7 * Copyright (c) 2006, 2008 Maciej W. Rozycki
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
@@ -70,8 +70,9 @@ static int __devinit swarm_ide_probe(struct device *dev)
70 ide_hwif_t *hwif; 70 ide_hwif_t *hwif;
71 u8 __iomem *base; 71 u8 __iomem *base;
72 phys_t offset, size; 72 phys_t offset, size;
73 hw_regs_t hw;
73 int i; 74 int i;
74 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 75 u8 idx[] = { 0xff, 0xff, 0xff, 0xff };
75 76
76 if (!SIBYTE_HAVE_IDE) 77 if (!SIBYTE_HAVE_IDE)
77 return -ENODEV; 78 return -ENODEV;
@@ -112,14 +113,15 @@ static int __devinit swarm_ide_probe(struct device *dev)
112 hwif->host_flags = IDE_HFLAG_MMIO; 113 hwif->host_flags = IDE_HFLAG_MMIO;
113 default_hwif_mmiops(hwif); 114 default_hwif_mmiops(hwif);
114 115
115 hwif->chipset = ide_generic;
116
117 for (i = 0; i <= 7; i++) 116 for (i = 0; i <= 7; i++)
118 hwif->io_ports_array[i] = 117 hw.io_ports_array[i] =
119 (unsigned long)(base + ((0x1f0 + i) << 5)); 118 (unsigned long)(base + ((0x1f0 + i) << 5));
120 hwif->io_ports.ctl_addr = 119 hw.io_ports.ctl_addr =
121 (unsigned long)(base + (0x3f6 << 5)); 120 (unsigned long)(base + (0x3f6 << 5));
122 hwif->irq = K_INT_GB_IDE; 121 hw.irq = K_INT_GB_IDE;
122 hw.chipset = ide_generic;
123
124 ide_init_port_hw(hwif, &hw);
123 125
124 idx[0] = hwif->index; 126 idx[0] = hwif->index;
125 127
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index c1922f9cfe80..f2129d5e07f2 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -39,6 +39,16 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41/* 41/*
42 * Allow UDMA on M1543C-E chipset for WDC disks that ignore CRC checking
43 * (this is DANGEROUS and could result in data corruption).
44 */
45static int wdc_udma;
46
47module_param(wdc_udma, bool, 0);
48MODULE_PARM_DESC(wdc_udma,
49 "allow UDMA on M1543C-E chipset for WDC disks (DANGEROUS)");
50
51/*
42 * ALi devices are not plug in. Otherwise these static values would 52 * ALi devices are not plug in. Otherwise these static values would
43 * need to go. They ought to go away anyway 53 * need to go. They ought to go away anyway
44 */ 54 */
@@ -76,11 +86,6 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
76 a_clc = 0; 86 a_clc = 0;
77 c_time = ide_pio_timings[pio].cycle_time; 87 c_time = ide_pio_timings[pio].cycle_time;
78 88
79#if 0
80 if ((r_clc = ((c_time - s_time - a_time) * bus_speed + 999) / 1000) >= 16)
81 r_clc = 0;
82#endif
83
84 if (!(r_clc = (c_time * bus_speed + 999) / 1000 - a_clc - s_clc)) { 89 if (!(r_clc = (c_time * bus_speed + 999) / 1000 - a_clc - s_clc)) {
85 r_clc = 1; 90 r_clc = 1;
86 } else { 91 } else {
@@ -110,16 +115,6 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
110 pci_write_config_byte(dev, port, s_clc); 115 pci_write_config_byte(dev, port, s_clc);
111 pci_write_config_byte(dev, port+drive->select.b.unit+2, (a_clc << 4) | r_clc); 116 pci_write_config_byte(dev, port+drive->select.b.unit+2, (a_clc << 4) | r_clc);
112 local_irq_restore(flags); 117 local_irq_restore(flags);
113
114 /*
115 * setup active rec
116 * { 70, 165, 365 }, PIO Mode 0
117 * { 50, 125, 208 }, PIO Mode 1
118 * { 30, 100, 110 }, PIO Mode 2
119 * { 30, 80, 70 }, PIO Mode 3 with IORDY
120 * { 25, 70, 25 }, PIO Mode 4 with IORDY ns
121 * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard)
122 */
123} 118}
124 119
125/** 120/**
@@ -131,9 +126,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
131 * The actual rules for the ALi are: 126 * The actual rules for the ALi are:
132 * No UDMA on revisions <= 0x20 127 * No UDMA on revisions <= 0x20
133 * Disk only for revisions < 0xC2 128 * Disk only for revisions < 0xC2
134 * Not WDC drives for revisions < 0xC2 129 * Not WDC drives on M1543C-E (?)
135 *
136 * FIXME: WDC ifdef needs to die
137 */ 130 */
138 131
139static u8 ali_udma_filter(ide_drive_t *drive) 132static u8 ali_udma_filter(ide_drive_t *drive)
@@ -141,10 +134,9 @@ static u8 ali_udma_filter(ide_drive_t *drive)
141 if (m5229_revision > 0x20 && m5229_revision < 0xC2) { 134 if (m5229_revision > 0x20 && m5229_revision < 0xC2) {
142 if (drive->media != ide_disk) 135 if (drive->media != ide_disk)
143 return 0; 136 return 0;
144#ifndef CONFIG_WDC_ALI15X3 137 if (chip_is_1543c_e && strstr(drive->id->model, "WDC ") &&
145 if (chip_is_1543c_e && strstr(drive->id->model, "WDC ")) 138 wdc_udma == 0)
146 return 0; 139 return 0;
147#endif
148 } 140 }
149 141
150 return drive->hwif->ultra_mask; 142 return drive->hwif->ultra_mask;
@@ -537,17 +529,9 @@ static const struct ide_port_info ali15x3_chipset __devinitdata = {
537 529
538static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) 530static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
539{ 531{
540 static struct pci_device_id ati_rs100[] = {
541 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100) },
542 { },
543 };
544
545 struct ide_port_info d = ali15x3_chipset; 532 struct ide_port_info d = ali15x3_chipset;
546 u8 rev = dev->revision, idx = id->driver_data; 533 u8 rev = dev->revision, idx = id->driver_data;
547 534
548 if (pci_dev_present(ati_rs100))
549 printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n");
550
551 /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ 535 /* don't use LBA48 DMA on ALi devices before rev 0xC5 */
552 if (rev <= 0xC4) 536 if (rev <= 0xC4)
553 d.host_flags |= IDE_HFLAG_NO_LBA48_DMA; 537 d.host_flags |= IDE_HFLAG_NO_LBA48_DMA;
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index aaf38109eaec..b38a1980dcd5 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -747,9 +747,11 @@ static int __init cmd640x_init(void)
747 747
748 ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); 748 ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
749 hw[0].irq = 14; 749 hw[0].irq = 14;
750 hw[0].chipset = ide_cmd640;
750 751
751 ide_std_init_ports(&hw[1], 0x170, 0x376); 752 ide_std_init_ports(&hw[1], 0x170, 0x376);
752 hw[1].irq = 15; 753 hw[1].irq = 15;
754 hw[1].chipset = ide_cmd640;
753 755
754 printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x" 756 printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x"
755 "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); 757 "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr);
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 17669a434438..992b1cf8db69 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -119,6 +119,7 @@ static const struct ide_dma_ops cs5520_dma_ops = {
119 .dma_timeout = ide_dma_timeout, 119 .dma_timeout = ide_dma_timeout,
120}; 120};
121 121
122/* FIXME: VDMA is disabled because it caused system hangs */
122#define DECLARE_CS_DEV(name_str) \ 123#define DECLARE_CS_DEV(name_str) \
123 { \ 124 { \
124 .name = name_str, \ 125 .name = name_str, \
@@ -126,7 +127,6 @@ static const struct ide_dma_ops cs5520_dma_ops = {
126 .dma_ops = &cs5520_dma_ops, \ 127 .dma_ops = &cs5520_dma_ops, \
127 .host_flags = IDE_HFLAG_ISA_PORTS | \ 128 .host_flags = IDE_HFLAG_ISA_PORTS | \
128 IDE_HFLAG_CS5520 | \ 129 IDE_HFLAG_CS5520 | \
129 IDE_HFLAG_VDMA | \
130 IDE_HFLAG_NO_ATAPI_DMA | \ 130 IDE_HFLAG_NO_ATAPI_DMA | \
131 IDE_HFLAG_ABUSE_SET_DMA_MODE, \ 131 IDE_HFLAG_ABUSE_SET_DMA_MODE, \
132 .pio_mask = ATA_PIO4, \ 132 .pio_mask = ATA_PIO4, \
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
index b9e457996d0e..af0f30051d5a 100644
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -47,13 +47,18 @@ static const struct ide_port_ops delkin_cb_port_ops = {
47 .quirkproc = ide_undecoded_slave, 47 .quirkproc = ide_undecoded_slave,
48}; 48};
49 49
50static const struct ide_port_info delkin_cb_port_info = {
51 .port_ops = &delkin_cb_port_ops,
52 .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS |
53 IDE_HFLAG_NO_DMA,
54};
55
50static int __devinit 56static int __devinit
51delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) 57delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
52{ 58{
53 unsigned long base; 59 unsigned long base;
54 hw_regs_t hw; 60 hw_regs_t hw;
55 ide_hwif_t *hwif = NULL; 61 ide_hwif_t *hwif = NULL;
56 ide_drive_t *drive;
57 int i, rc; 62 int i, rc;
58 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 63 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
59 64
@@ -79,6 +84,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
79 memset(&hw, 0, sizeof(hw)); 84 memset(&hw, 0, sizeof(hw));
80 ide_std_init_ports(&hw, base + 0x10, base + 0x1e); 85 ide_std_init_ports(&hw, base + 0x10, base + 0x1e);
81 hw.irq = dev->irq; 86 hw.irq = dev->irq;
87 hw.dev = &dev->dev;
82 hw.chipset = ide_pci; /* this enables IRQ sharing */ 88 hw.chipset = ide_pci; /* this enables IRQ sharing */
83 89
84 hwif = ide_find_port(); 90 hwif = ide_find_port();
@@ -89,26 +95,16 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
89 95
90 ide_init_port_data(hwif, i); 96 ide_init_port_data(hwif, i);
91 ide_init_port_hw(hwif, &hw); 97 ide_init_port_hw(hwif, &hw);
92 hwif->port_ops = &delkin_cb_port_ops;
93 98
94 idx[0] = i; 99 idx[0] = i;
95 100
96 ide_device_add(idx, NULL); 101 ide_device_add(idx, &delkin_cb_port_info);
97
98 if (!hwif->present)
99 goto out_disable;
100 102
101 pci_set_drvdata(dev, hwif); 103 pci_set_drvdata(dev, hwif);
102 hwif->dev = &dev->dev; 104
103 drive = &hwif->drives[0];
104 if (drive->present) {
105 drive->io_32bit = 1;
106 drive->unmask = 1;
107 }
108 return 0; 105 return 0;
109 106
110out_disable: 107out_disable:
111 printk(KERN_ERR "delkin_cb: no IDE devices found\n");
112 pci_release_regions(dev); 108 pci_release_regions(dev);
113 pci_disable_device(dev); 109 pci_disable_device(dev);
114 return -ENODEV; 110 return -ENODEV;
@@ -139,14 +135,12 @@ static struct pci_driver driver = {
139 .remove = delkin_cb_remove, 135 .remove = delkin_cb_remove,
140}; 136};
141 137
142static int 138static int __init delkin_cb_init(void)
143delkin_cb_init (void)
144{ 139{
145 return pci_register_driver(&driver); 140 return pci_register_driver(&driver);
146} 141}
147 142
148static void 143static void __exit delkin_cb_exit(void)
149delkin_cb_exit (void)
150{ 144{
151 pci_unregister_driver(&driver); 145 pci_unregister_driver(&driver);
152} 146}
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 6e99080497bf..725c80508d90 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -81,8 +81,6 @@
81 * 0.5 doesn't work. 81 * 0.5 doesn't work.
82 */ 82 */
83 83
84#define OPTI621_DEBUG /* define for debug messages */
85
86#include <linux/types.h> 84#include <linux/types.h>
87#include <linux/module.h> 85#include <linux/module.h>
88#include <linux/kernel.h> 86#include <linux/kernel.h>
@@ -92,28 +90,6 @@
92 90
93#include <asm/io.h> 91#include <asm/io.h>
94 92
95//#define OPTI621_MAX_PIO 3
96/* In fact, I do not have any PIO 4 drive
97 * (address: 25 ns, data: 70 ns, recovery: 35 ns),
98 * but OPTi 82C621 is programmable and it can do (minimal values):
99 * on 40MHz PCI bus (pulse 25 ns):
100 * address: 25 ns, data: 25 ns, recovery: 50 ns;
101 * on 20MHz PCI bus (pulse 50 ns):
102 * address: 50 ns, data: 50 ns, recovery: 100 ns.
103 */
104
105/* #define READ_PREFETCH 0 */
106/* Uncomment for disable read prefetch.
107 * There is some readprefetch capatibility in hdparm,
108 * but when I type hdparm -P 1 /dev/hda, I got errors
109 * and till reset drive is inaccessible.
110 * This (hw) read prefetch is safe on my drive.
111 */
112
113#ifndef READ_PREFETCH
114#define READ_PREFETCH 0x40 /* read prefetch is enabled */
115#endif /* else read prefetch is disabled */
116
117#define READ_REG 0 /* index of Read cycle timing register */ 93#define READ_REG 0 /* index of Read cycle timing register */
118#define WRITE_REG 1 /* index of Write cycle timing register */ 94#define WRITE_REG 1 /* index of Write cycle timing register */
119#define CNTRL_REG 3 /* index of Control register */ 95#define CNTRL_REG 3 /* index of Control register */
@@ -122,51 +98,8 @@
122 98
123static int reg_base; 99static int reg_base;
124 100
125#define PIO_NOT_EXIST 254
126#define PIO_DONT_KNOW 255
127
128static DEFINE_SPINLOCK(opti621_lock); 101static DEFINE_SPINLOCK(opti621_lock);
129 102
130/* there are stored pio numbers from other calls of opti621_set_pio_mode */
131static void compute_pios(ide_drive_t *drive, const u8 pio)
132/* Store values into drive->drive_data
133 * second_contr - 0 for primary controller, 1 for secondary
134 * slave_drive - 0 -> pio is for master, 1 -> pio is for slave
135 * pio - PIO mode for selected drive (for other we don't know)
136 */
137{
138 int d;
139 ide_hwif_t *hwif = HWIF(drive);
140
141 drive->drive_data = pio;
142
143 for (d = 0; d < 2; ++d) {
144 drive = &hwif->drives[d];
145 if (drive->present) {
146 if (drive->drive_data == PIO_DONT_KNOW)
147 drive->drive_data = ide_get_best_pio_mode(drive, 255, 3);
148#ifdef OPTI621_DEBUG
149 printk("%s: Selected PIO mode %d\n",
150 drive->name, drive->drive_data);
151#endif
152 } else {
153 drive->drive_data = PIO_NOT_EXIST;
154 }
155 }
156}
157
158static int cmpt_clk(int time, int bus_speed)
159/* Returns (rounded up) time in clocks for time in ns,
160 * with bus_speed in MHz.
161 * Example: bus_speed = 40 MHz, time = 80 ns
162 * 1000/40 = 25 ns (clk value),
163 * 80/25 = 3.2, rounded up to 4 (I hope ;-)).
164 * Use idebus=xx to select right frequency.
165 */
166{
167 return ((time*bus_speed+999)/1000);
168}
169
170/* Write value to register reg, base of register 103/* Write value to register reg, base of register
171 * is at reg_base (0x1f0 primary, 0x170 secondary, 104 * is at reg_base (0x1f0 primary, 0x170 secondary,
172 * if not changed by PCI configuration). 105 * if not changed by PCI configuration).
@@ -199,83 +132,29 @@ static u8 read_reg(int reg)
199 return ret; 132 return ret;
200} 133}
201 134
202typedef struct pio_clocks_s {
203 int address_time; /* Address setup (clocks) */
204 int data_time; /* Active/data pulse (clocks) */
205 int recovery_time; /* Recovery time (clocks) */
206} pio_clocks_t;
207
208static void compute_clocks(int pio, pio_clocks_t *clks)
209{
210 if (pio != PIO_NOT_EXIST) {
211 int adr_setup, data_pls;
212 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock();
213
214 adr_setup = ide_pio_timings[pio].setup_time;
215 data_pls = ide_pio_timings[pio].active_time;
216 clks->address_time = cmpt_clk(adr_setup, bus_speed);
217 clks->data_time = cmpt_clk(data_pls, bus_speed);
218 clks->recovery_time = cmpt_clk(ide_pio_timings[pio].cycle_time
219 - adr_setup-data_pls, bus_speed);
220 if (clks->address_time < 1)
221 clks->address_time = 1;
222 if (clks->address_time > 4)
223 clks->address_time = 4;
224 if (clks->data_time < 1)
225 clks->data_time = 1;
226 if (clks->data_time > 16)
227 clks->data_time = 16;
228 if (clks->recovery_time < 2)
229 clks->recovery_time = 2;
230 if (clks->recovery_time > 17)
231 clks->recovery_time = 17;
232 } else {
233 clks->address_time = 1;
234 clks->data_time = 1;
235 clks->recovery_time = 2;
236 /* minimal values */
237 }
238}
239
240static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) 135static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
241{ 136{
242 /* primary and secondary drives share some registers, 137 ide_hwif_t *hwif = drive->hwif;
243 * so we have to program both drives 138 ide_drive_t *pair = ide_get_paired_drive(drive);
244 */
245 unsigned long flags; 139 unsigned long flags;
246 u8 pio1 = 0, pio2 = 0; 140 u8 tim, misc, addr_pio = pio, clk;
247 pio_clocks_t first, second; 141
248 int ax, drdy; 142 /* DRDY is default 2 (by OPTi Databook) */
249 u8 cycle1, cycle2, misc; 143 static const u8 addr_timings[2][5] = {
250 ide_hwif_t *hwif = HWIF(drive); 144 { 0x20, 0x10, 0x00, 0x00, 0x00 }, /* 33 MHz */
251 145 { 0x10, 0x10, 0x00, 0x00, 0x00 }, /* 25 MHz */
252 /* sets drive->drive_data for both drives */ 146 };
253 compute_pios(drive, pio); 147 static const u8 data_rec_timings[2][5] = {
254 pio1 = hwif->drives[0].drive_data; 148 { 0x5b, 0x45, 0x32, 0x21, 0x20 }, /* 33 MHz */
255 pio2 = hwif->drives[1].drive_data; 149 { 0x48, 0x34, 0x21, 0x10, 0x10 } /* 25 MHz */
256 150 };
257 compute_clocks(pio1, &first); 151
258 compute_clocks(pio2, &second); 152 drive->drive_data = XFER_PIO_0 + pio;
259 153
260 /* ax = max(a1,a2) */ 154 if (pair->present) {
261 ax = (first.address_time < second.address_time) ? second.address_time : first.address_time; 155 if (pair->drive_data && pair->drive_data < drive->drive_data)
262 156 addr_pio = pair->drive_data - XFER_PIO_0;
263 drdy = 2; /* DRDY is default 2 (by OPTi Databook) */ 157 }
264
265 cycle1 = ((first.data_time-1)<<4) | (first.recovery_time-2);
266 cycle2 = ((second.data_time-1)<<4) | (second.recovery_time-2);
267 misc = READ_PREFETCH | ((ax-1)<<4) | ((drdy-2)<<1);
268
269#ifdef OPTI621_DEBUG
270 printk("%s: master: address: %d, data: %d, "
271 "recovery: %d, drdy: %d [clk]\n",
272 hwif->name, ax, first.data_time,
273 first.recovery_time, drdy);
274 printk("%s: slave: address: %d, data: %d, "
275 "recovery: %d, drdy: %d [clk]\n",
276 hwif->name, ax, second.data_time,
277 second.recovery_time, drdy);
278#endif
279 158
280 spin_lock_irqsave(&opti621_lock, flags); 159 spin_lock_irqsave(&opti621_lock, flags);
281 160
@@ -289,24 +168,21 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
289 (void)inb(reg_base + CNTRL_REG); 168 (void)inb(reg_base + CNTRL_REG);
290 /* if reads 0xc0, no interface exist? */ 169 /* if reads 0xc0, no interface exist? */
291 read_reg(CNTRL_REG); 170 read_reg(CNTRL_REG);
292 /* read version, probably 0 */
293 read_reg(STRAP_REG);
294 171
295 /* program primary drive */ 172 /* check CLK speed */
296 /* select Index-0 for Register-A */ 173 clk = read_reg(STRAP_REG) & 1;
297 write_reg(0, MISC_REG); 174
298 /* set read cycle timings */ 175 printk(KERN_INFO "%s: CLK = %d MHz\n", hwif->name, clk ? 25 : 33);
299 write_reg(cycle1, READ_REG);
300 /* set write cycle timings */
301 write_reg(cycle1, WRITE_REG);
302 176
303 /* program secondary drive */ 177 tim = data_rec_timings[clk][pio];
304 /* select Index-1 for Register-B */ 178 misc = addr_timings[clk][addr_pio];
305 write_reg(1, MISC_REG); 179
180 /* select Index-0/1 for Register-A/B */
181 write_reg(drive->select.b.unit, MISC_REG);
306 /* set read cycle timings */ 182 /* set read cycle timings */
307 write_reg(cycle2, READ_REG); 183 write_reg(tim, READ_REG);
308 /* set write cycle timings */ 184 /* set write cycle timings */
309 write_reg(cycle2, WRITE_REG); 185 write_reg(tim, WRITE_REG);
310 186
311 /* use Register-A for drive 0 */ 187 /* use Register-A for drive 0 */
312 /* use Register-B for drive 1 */ 188 /* use Register-B for drive 1 */
@@ -319,45 +195,26 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
319 spin_unlock_irqrestore(&opti621_lock, flags); 195 spin_unlock_irqrestore(&opti621_lock, flags);
320} 196}
321 197
322static void __devinit opti621_port_init_devs(ide_hwif_t *hwif)
323{
324 hwif->drives[0].drive_data = PIO_DONT_KNOW;
325 hwif->drives[1].drive_data = PIO_DONT_KNOW;
326}
327
328static const struct ide_port_ops opti621_port_ops = { 198static const struct ide_port_ops opti621_port_ops = {
329 .port_init_devs = opti621_port_init_devs,
330 .set_pio_mode = opti621_set_pio_mode, 199 .set_pio_mode = opti621_set_pio_mode,
331}; 200};
332 201
333static const struct ide_port_info opti621_chipsets[] __devinitdata = { 202static const struct ide_port_info opti621_chipset __devinitdata = {
334 { /* 0 */ 203 .name = "OPTI621/X",
335 .name = "OPTI621", 204 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} },
336 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} }, 205 .port_ops = &opti621_port_ops,
337 .port_ops = &opti621_port_ops, 206 .host_flags = IDE_HFLAG_NO_DMA,
338 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 207 .pio_mask = ATA_PIO4,
339 .pio_mask = ATA_PIO3,
340 .swdma_mask = ATA_SWDMA2,
341 .mwdma_mask = ATA_MWDMA2,
342 }, { /* 1 */
343 .name = "OPTI621X",
344 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} },
345 .port_ops = &opti621_port_ops,
346 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
347 .pio_mask = ATA_PIO3,
348 .swdma_mask = ATA_SWDMA2,
349 .mwdma_mask = ATA_MWDMA2,
350 }
351}; 208};
352 209
353static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) 210static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
354{ 211{
355 return ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]); 212 return ide_setup_pci_device(dev, &opti621_chipset);
356} 213}
357 214
358static const struct pci_device_id opti621_pci_tbl[] = { 215static const struct pci_device_id opti621_pci_tbl[] = {
359 { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C621), 0 }, 216 { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C621), 0 },
360 { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C825), 1 }, 217 { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C825), 0 },
361 { 0, }, 218 { 0, },
362}; 219};
363MODULE_DEVICE_TABLE(pci, opti621_pci_tbl); 220MODULE_DEVICE_TABLE(pci, opti621_pci_tbl);
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 4b0b85d8faf5..e127eb25ab63 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -569,6 +569,11 @@ static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_devi
569{ 569{
570 struct ide_port_info d = sis5513_chipset; 570 struct ide_port_info d = sis5513_chipset;
571 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f }; 571 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
572 int rc;
573
574 rc = pci_enable_device(dev);
575 if (rc)
576 return rc;
572 577
573 if (sis_find_family(dev) == 0) 578 if (sis_find_family(dev) == 0)
574 return -ENOTSUPP; 579 return -ENOTSUPP;
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index f0e638dcc3ab..236f9c38e519 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -303,6 +303,8 @@ static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
303 pcmp->pcmc_per = 0x100000 >> (16 * _slot_); 303 pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
304#endif /* CONFIG_IDE_8xx_PCCARD */ 304#endif /* CONFIG_IDE_8xx_PCCARD */
305 305
306 hw->chipset = ide_generic;
307
306 return 0; 308 return 0;
307} 309}
308#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ 310#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
@@ -377,6 +379,8 @@ static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
377 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= 379 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
378 (0x80000000 >> ioport_dsc[data_port].irq); 380 (0x80000000 >> ioport_dsc[data_port].irq);
379 381
382 hw->chipset = ide_generic;
383
380 return 0; 384 return 0;
381} 385}
382#endif /* CONFIG_IDE_8xx_DIRECT */ 386#endif /* CONFIG_IDE_8xx_DIRECT */
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 48aa019127bc..ba2d58727964 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -59,7 +59,6 @@ typedef struct pmac_ide_hwif {
59 int irq; 59 int irq;
60 int kind; 60 int kind;
61 int aapl_bus_id; 61 int aapl_bus_id;
62 unsigned cable_80 : 1;
63 unsigned mediabay : 1; 62 unsigned mediabay : 1;
64 unsigned broken_dma : 1; 63 unsigned broken_dma : 1;
65 unsigned broken_dma_warn : 1; 64 unsigned broken_dma_warn : 1;
@@ -918,10 +917,40 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
918 return 0; 917 return 0;
919} 918}
920 919
920static u8 pmac_ide_cable_detect(ide_hwif_t *hwif)
921{
922 pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)ide_get_hwifdata(hwif);
923 struct device_node *np = pmif->node;
924 const char *cable = of_get_property(np, "cable-type", NULL);
925
926 /* Get cable type from device-tree. */
927 if (cable && !strncmp(cable, "80-", 3))
928 return ATA_CBL_PATA80;
929
930 /*
931 * G5's seem to have incorrect cable type in device-tree.
932 * Let's assume they have a 80 conductor cable, this seem
933 * to be always the case unless the user mucked around.
934 */
935 if (of_device_is_compatible(np, "K2-UATA") ||
936 of_device_is_compatible(np, "shasta-ata"))
937 return ATA_CBL_PATA80;
938
939 return ATA_CBL_PATA40;
940}
941
921static const struct ide_port_ops pmac_ide_ata6_port_ops = { 942static const struct ide_port_ops pmac_ide_ata6_port_ops = {
922 .set_pio_mode = pmac_ide_set_pio_mode, 943 .set_pio_mode = pmac_ide_set_pio_mode,
923 .set_dma_mode = pmac_ide_set_dma_mode, 944 .set_dma_mode = pmac_ide_set_dma_mode,
924 .selectproc = pmac_ide_kauai_selectproc, 945 .selectproc = pmac_ide_kauai_selectproc,
946 .cable_detect = pmac_ide_cable_detect,
947};
948
949static const struct ide_port_ops pmac_ide_ata4_port_ops = {
950 .set_pio_mode = pmac_ide_set_pio_mode,
951 .set_dma_mode = pmac_ide_set_dma_mode,
952 .selectproc = pmac_ide_selectproc,
953 .cable_detect = pmac_ide_cable_detect,
925}; 954};
926 955
927static const struct ide_port_ops pmac_ide_port_ops = { 956static const struct ide_port_ops pmac_ide_port_ops = {
@@ -949,10 +978,7 @@ static const struct ide_port_info pmac_port_info = {
949 978
950/* 979/*
951 * Setup, register & probe an IDE channel driven by this driver, this is 980 * Setup, register & probe an IDE channel driven by this driver, this is
952 * called by one of the 2 probe functions (macio or PCI). Note that a channel 981 * called by one of the 2 probe functions (macio or PCI).
953 * that ends up beeing free of any device is not kept around by this driver
954 * (it is kept in 2.4). This introduce an interface numbering change on some
955 * rare machines unfortunately, but it's better this way.
956 */ 982 */
957static int __devinit 983static int __devinit
958pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) 984pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
@@ -962,7 +988,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
962 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 988 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
963 struct ide_port_info d = pmac_port_info; 989 struct ide_port_info d = pmac_port_info;
964 990
965 pmif->cable_80 = 0;
966 pmif->broken_dma = pmif->broken_dma_warn = 0; 991 pmif->broken_dma = pmif->broken_dma_warn = 0;
967 if (of_device_is_compatible(np, "shasta-ata")) { 992 if (of_device_is_compatible(np, "shasta-ata")) {
968 pmif->kind = controller_sh_ata6; 993 pmif->kind = controller_sh_ata6;
@@ -979,6 +1004,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
979 } else if (of_device_is_compatible(np, "keylargo-ata")) { 1004 } else if (of_device_is_compatible(np, "keylargo-ata")) {
980 if (strcmp(np->name, "ata-4") == 0) { 1005 if (strcmp(np->name, "ata-4") == 0) {
981 pmif->kind = controller_kl_ata4; 1006 pmif->kind = controller_kl_ata4;
1007 d.port_ops = &pmac_ide_ata4_port_ops;
982 d.udma_mask = ATA_UDMA4; 1008 d.udma_mask = ATA_UDMA4;
983 } else 1009 } else
984 pmif->kind = controller_kl_ata3; 1010 pmif->kind = controller_kl_ata3;
@@ -992,22 +1018,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
992 bidp = of_get_property(np, "AAPL,bus-id", NULL); 1018 bidp = of_get_property(np, "AAPL,bus-id", NULL);
993 pmif->aapl_bus_id = bidp ? *bidp : 0; 1019 pmif->aapl_bus_id = bidp ? *bidp : 0;
994 1020
995 /* Get cable type from device-tree */
996 if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6
997 || pmif->kind == controller_k2_ata6
998 || pmif->kind == controller_sh_ata6) {
999 const char* cable = of_get_property(np, "cable-type", NULL);
1000 if (cable && !strncmp(cable, "80-", 3))
1001 pmif->cable_80 = 1;
1002 }
1003 /* G5's seem to have incorrect cable type in device-tree. Let's assume
1004 * they have a 80 conductor cable, this seem to be always the case unless
1005 * the user mucked around
1006 */
1007 if (of_device_is_compatible(np, "K2-UATA") ||
1008 of_device_is_compatible(np, "shasta-ata"))
1009 pmif->cable_80 = 1;
1010
1011 /* On Kauai-type controllers, we make sure the FCR is correct */ 1021 /* On Kauai-type controllers, we make sure the FCR is correct */
1012 if (pmif->kauai_fcr) 1022 if (pmif->kauai_fcr)
1013 writel(KAUAI_FCR_UATA_MAGIC | 1023 writel(KAUAI_FCR_UATA_MAGIC |
@@ -1053,7 +1063,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1053 1063
1054 hwif->hwif_data = pmif; 1064 hwif->hwif_data = pmif;
1055 ide_init_port_hw(hwif, hw); 1065 ide_init_port_hw(hwif, hw);
1056 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
1057 1066
1058 printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", 1067 printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n",
1059 hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, 1068 hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
@@ -1070,11 +1079,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1070 } 1079 }
1071 } 1080 }
1072 1081
1073#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
1074 if (pmif->cable_80 == 0)
1075 d.udma_mask &= ATA_UDMA2;
1076#endif
1077
1078 idx[0] = hwif->index; 1082 idx[0] = hwif->index;
1079 1083
1080 ide_device_add(idx, &d); 1084 ide_device_add(idx, &d);
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 16b9d0ad154e..a5ceff287a28 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -1539,15 +1539,13 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1539 1539
1540static void sbp2_create_command_orb(struct sbp2_lu *lu, 1540static void sbp2_create_command_orb(struct sbp2_lu *lu,
1541 struct sbp2_command_info *cmd, 1541 struct sbp2_command_info *cmd,
1542 unchar *scsi_cmd, 1542 struct scsi_cmnd *SCpnt)
1543 unsigned int scsi_use_sg,
1544 unsigned int scsi_request_bufflen,
1545 struct scatterlist *sg,
1546 enum dma_data_direction dma_dir)
1547{ 1543{
1548 struct sbp2_fwhost_info *hi = lu->hi; 1544 struct sbp2_fwhost_info *hi = lu->hi;
1549 struct sbp2_command_orb *orb = &cmd->command_orb; 1545 struct sbp2_command_orb *orb = &cmd->command_orb;
1550 u32 orb_direction; 1546 u32 orb_direction;
1547 unsigned int scsi_request_bufflen = scsi_bufflen(SCpnt);
1548 enum dma_data_direction dma_dir = SCpnt->sc_data_direction;
1551 1549
1552 /* 1550 /*
1553 * Set-up our command ORB. 1551 * Set-up our command ORB.
@@ -1580,13 +1578,14 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu,
1580 orb->data_descriptor_lo = 0x0; 1578 orb->data_descriptor_lo = 0x0;
1581 orb->misc |= ORB_SET_DIRECTION(1); 1579 orb->misc |= ORB_SET_DIRECTION(1);
1582 } else 1580 } else
1583 sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg, 1581 sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_sg_count(SCpnt),
1582 scsi_sglist(SCpnt),
1584 orb_direction, dma_dir); 1583 orb_direction, dma_dir);
1585 1584
1586 sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); 1585 sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb));
1587 1586
1588 memset(orb->cdb, 0, 12); 1587 memset(orb->cdb, 0, sizeof(orb->cdb));
1589 memcpy(orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd)); 1588 memcpy(orb->cdb, SCpnt->cmnd, SCpnt->cmd_len);
1590} 1589}
1591 1590
1592static void sbp2_link_orb_command(struct sbp2_lu *lu, 1591static void sbp2_link_orb_command(struct sbp2_lu *lu,
@@ -1669,16 +1668,13 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu,
1669static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, 1668static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt,
1670 void (*done)(struct scsi_cmnd *)) 1669 void (*done)(struct scsi_cmnd *))
1671{ 1670{
1672 unchar *scsi_cmd = (unchar *)SCpnt->cmnd;
1673 struct sbp2_command_info *cmd; 1671 struct sbp2_command_info *cmd;
1674 1672
1675 cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); 1673 cmd = sbp2util_allocate_command_orb(lu, SCpnt, done);
1676 if (!cmd) 1674 if (!cmd)
1677 return -EIO; 1675 return -EIO;
1678 1676
1679 sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt), 1677 sbp2_create_command_orb(lu, cmd, SCpnt);
1680 scsi_bufflen(SCpnt), scsi_sglist(SCpnt),
1681 SCpnt->sc_data_direction);
1682 sbp2_link_orb_command(lu, cmd); 1678 sbp2_link_orb_command(lu, cmd);
1683 1679
1684 return 0; 1680 return 0;
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index fbe16d5250a4..1adf2efd3cb3 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -747,7 +747,9 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
747 break; 747 break;
748 case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED: 748 case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED:
749 kmem_cache_free(ib_mad_cache, mad_priv); 749 kmem_cache_free(ib_mad_cache, mad_priv);
750 break; 750 kfree(local);
751 ret = 1;
752 goto out;
751 case IB_MAD_RESULT_SUCCESS: 753 case IB_MAD_RESULT_SUCCESS:
752 /* Treat like an incoming receive MAD */ 754 /* Treat like an incoming receive MAD */
753 port_priv = ib_get_mad_port(mad_agent_priv->agent.device, 755 port_priv = ib_get_mad_port(mad_agent_priv->agent.device,
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index fe78f7d25099..a1768dbb0720 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -150,7 +150,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
150 ret = 0; 150 ret = 0;
151 while (npages) { 151 while (npages) {
152 ret = get_user_pages(current, current->mm, cur_base, 152 ret = get_user_pages(current, current->mm, cur_base,
153 min_t(int, npages, 153 min_t(unsigned long, npages,
154 PAGE_SIZE / sizeof (struct page *)), 154 PAGE_SIZE / sizeof (struct page *)),
155 1, !umem->writable, page_list, vma_list); 155 1, !umem->writable, page_list, vma_list);
156 156
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 3aa2db54eae4..840ede9ae965 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1005,8 +1005,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
1005 if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) 1005 if (cdev_add(port->cdev, base_dev + port->dev_num, 1))
1006 goto err_cdev; 1006 goto err_cdev;
1007 1007
1008 port->dev = device_create(umad_class, device->dma_device, 1008 port->dev = device_create_drvdata(umad_class, device->dma_device,
1009 port->cdev->dev, "umad%d", port->dev_num); 1009 port->cdev->dev, port,
1010 "umad%d", port->dev_num);
1010 if (IS_ERR(port->dev)) 1011 if (IS_ERR(port->dev))
1011 goto err_cdev; 1012 goto err_cdev;
1012 1013
@@ -1024,15 +1025,12 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
1024 if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) 1025 if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1))
1025 goto err_sm_cdev; 1026 goto err_sm_cdev;
1026 1027
1027 port->sm_dev = device_create(umad_class, device->dma_device, 1028 port->sm_dev = device_create_drvdata(umad_class, device->dma_device,
1028 port->sm_cdev->dev, 1029 port->sm_cdev->dev, port,
1029 "issm%d", port->dev_num); 1030 "issm%d", port->dev_num);
1030 if (IS_ERR(port->sm_dev)) 1031 if (IS_ERR(port->sm_dev))
1031 goto err_sm_cdev; 1032 goto err_sm_cdev;
1032 1033
1033 dev_set_drvdata(port->dev, port);
1034 dev_set_drvdata(port->sm_dev, port);
1035
1036 if (device_create_file(port->sm_dev, &dev_attr_ibdev)) 1034 if (device_create_file(port->sm_dev, &dev_attr_ibdev))
1037 goto err_sm_dev; 1035 goto err_sm_dev;
1038 if (device_create_file(port->sm_dev, &dev_attr_port)) 1036 if (device_create_file(port->sm_dev, &dev_attr_port))
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index cc1afa28c181..f806da184b51 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -755,14 +755,15 @@ static void ib_uverbs_add_one(struct ib_device *device)
755 if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) 755 if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1))
756 goto err_cdev; 756 goto err_cdev;
757 757
758 uverbs_dev->dev = device_create(uverbs_class, device->dma_device, 758 uverbs_dev->dev = device_create_drvdata(uverbs_class,
759 uverbs_dev->cdev->dev, 759 device->dma_device,
760 "uverbs%d", uverbs_dev->devnum); 760 uverbs_dev->cdev->dev,
761 uverbs_dev,
762 "uverbs%d",
763 uverbs_dev->devnum);
761 if (IS_ERR(uverbs_dev->dev)) 764 if (IS_ERR(uverbs_dev->dev))
762 goto err_cdev; 765 goto err_cdev;
763 766
764 dev_set_drvdata(uverbs_dev->dev, uverbs_dev);
765
766 if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) 767 if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev))
767 goto err_class; 768 goto err_class;
768 if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) 769 if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version))
diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index 9a054c6941a4..b1441aeb60c2 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -455,8 +455,7 @@ int __devinit c2_rnic_init(struct c2_dev *c2dev)
455 IB_DEVICE_CURR_QP_STATE_MOD | 455 IB_DEVICE_CURR_QP_STATE_MOD |
456 IB_DEVICE_SYS_IMAGE_GUID | 456 IB_DEVICE_SYS_IMAGE_GUID |
457 IB_DEVICE_ZERO_STAG | 457 IB_DEVICE_ZERO_STAG |
458 IB_DEVICE_MEM_WINDOW | 458 IB_DEVICE_MEM_WINDOW);
459 IB_DEVICE_SEND_W_INV);
460 459
461 /* Allocate the qptr_array */ 460 /* Allocate the qptr_array */
462 c2dev->qptr_array = vmalloc(C2_MAX_CQS * sizeof(void *)); 461 c2dev->qptr_array = vmalloc(C2_MAX_CQS * sizeof(void *));
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index ebf9d3043f80..3f441fc57c17 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -405,11 +405,11 @@ int cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count)
405 struct t3_swsq *sqp = wq->sq + Q_PTR2IDX(wq->sq_rptr, wq->sq_size_log2); 405 struct t3_swsq *sqp = wq->sq + Q_PTR2IDX(wq->sq_rptr, wq->sq_size_log2);
406 406
407 ptr = wq->sq_rptr + count; 407 ptr = wq->sq_rptr + count;
408 sqp += count; 408 sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2);
409 while (ptr != wq->sq_wptr) { 409 while (ptr != wq->sq_wptr) {
410 insert_sq_cqe(wq, cq, sqp); 410 insert_sq_cqe(wq, cq, sqp);
411 sqp++;
412 ptr++; 411 ptr++;
412 sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2);
413 flushed++; 413 flushed++;
414 } 414 }
415 return flushed; 415 return flushed;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c
index 79dbe5beae52..992613799228 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_qp.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
@@ -229,7 +229,7 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
229 struct ib_send_wr **bad_wr) 229 struct ib_send_wr **bad_wr)
230{ 230{
231 int err = 0; 231 int err = 0;
232 u8 t3_wr_flit_cnt; 232 u8 uninitialized_var(t3_wr_flit_cnt);
233 enum t3_wr_opcode t3_wr_opcode = 0; 233 enum t3_wr_opcode t3_wr_opcode = 0;
234 enum t3_wr_flags t3_wr_flags; 234 enum t3_wr_flags t3_wr_flags;
235 struct iwch_qp *qhp; 235 struct iwch_qp *qhp;
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c
index bbe0436f4f75..f093b0033daf 100644
--- a/drivers/infiniband/hw/ehca/ehca_reqs.c
+++ b/drivers/infiniband/hw/ehca/ehca_reqs.c
@@ -421,8 +421,10 @@ int ehca_post_send(struct ib_qp *qp,
421 int ret = 0; 421 int ret = 0;
422 unsigned long flags; 422 unsigned long flags;
423 423
424 if (unlikely(my_qp->state != IB_QPS_RTS)) { 424 /* Reject WR if QP is in RESET, INIT or RTR state */
425 ehca_err(qp->device, "QP not in RTS state qpn=%x", qp->qp_num); 425 if (unlikely(my_qp->state < IB_QPS_RTS)) {
426 ehca_err(qp->device, "Invalid QP state qp_state=%d qpn=%x",
427 my_qp->state, qp->qp_num);
426 return -EINVAL; 428 return -EINVAL;
427 } 429 }
428 430
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index ce7b7c34360e..daad09a45910 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -1894,7 +1894,7 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl)
1894 */ 1894 */
1895 if (dd->ipath_flags & IPATH_HAS_SEND_DMA) { 1895 if (dd->ipath_flags & IPATH_HAS_SEND_DMA) {
1896 int skip_cancel; 1896 int skip_cancel;
1897 u64 *statp = &dd->ipath_sdma_status; 1897 unsigned long *statp = &dd->ipath_sdma_status;
1898 1898
1899 spin_lock_irqsave(&dd->ipath_sdma_lock, flags); 1899 spin_lock_irqsave(&dd->ipath_sdma_lock, flags);
1900 skip_cancel = 1900 skip_cancel =
@@ -2616,7 +2616,7 @@ int ipath_reset_device(int unit)
2616 ipath_dbg("unit %u port %d is in use " 2616 ipath_dbg("unit %u port %d is in use "
2617 "(PID %u cmd %s), can't reset\n", 2617 "(PID %u cmd %s), can't reset\n",
2618 unit, i, 2618 unit, i,
2619 dd->ipath_pd[i]->port_pid, 2619 pid_nr(dd->ipath_pd[i]->port_pid),
2620 dd->ipath_pd[i]->port_comm); 2620 dd->ipath_pd[i]->port_comm);
2621 ret = -EBUSY; 2621 ret = -EBUSY;
2622 goto bail; 2622 goto bail;
@@ -2654,19 +2654,21 @@ bail:
2654static int ipath_signal_procs(struct ipath_devdata *dd, int sig) 2654static int ipath_signal_procs(struct ipath_devdata *dd, int sig)
2655{ 2655{
2656 int i, sub, any = 0; 2656 int i, sub, any = 0;
2657 pid_t pid; 2657 struct pid *pid;
2658 2658
2659 if (!dd->ipath_pd) 2659 if (!dd->ipath_pd)
2660 return 0; 2660 return 0;
2661 for (i = 1; i < dd->ipath_cfgports; i++) { 2661 for (i = 1; i < dd->ipath_cfgports; i++) {
2662 if (!dd->ipath_pd[i] || !dd->ipath_pd[i]->port_cnt || 2662 if (!dd->ipath_pd[i] || !dd->ipath_pd[i]->port_cnt)
2663 !dd->ipath_pd[i]->port_pid)
2664 continue; 2663 continue;
2665 pid = dd->ipath_pd[i]->port_pid; 2664 pid = dd->ipath_pd[i]->port_pid;
2665 if (!pid)
2666 continue;
2667
2666 dev_info(&dd->pcidev->dev, "context %d in use " 2668 dev_info(&dd->pcidev->dev, "context %d in use "
2667 "(PID %u), sending signal %d\n", 2669 "(PID %u), sending signal %d\n",
2668 i, pid, sig); 2670 i, pid_nr(pid), sig);
2669 kill_proc(pid, sig, 1); 2671 kill_pid(pid, sig, 1);
2670 any++; 2672 any++;
2671 for (sub = 0; sub < INFINIPATH_MAX_SUBPORT; sub++) { 2673 for (sub = 0; sub < INFINIPATH_MAX_SUBPORT; sub++) {
2672 pid = dd->ipath_pd[i]->port_subpid[sub]; 2674 pid = dd->ipath_pd[i]->port_subpid[sub];
@@ -2674,8 +2676,8 @@ static int ipath_signal_procs(struct ipath_devdata *dd, int sig)
2674 continue; 2676 continue;
2675 dev_info(&dd->pcidev->dev, "sub-context " 2677 dev_info(&dd->pcidev->dev, "sub-context "
2676 "%d:%d in use (PID %u), sending " 2678 "%d:%d in use (PID %u), sending "
2677 "signal %d\n", i, sub, pid, sig); 2679 "signal %d\n", i, sub, pid_nr(pid), sig);
2678 kill_proc(pid, sig, 1); 2680 kill_pid(pid, sig, 1);
2679 any++; 2681 any++;
2680 } 2682 }
2681 } 2683 }
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 3295177c937e..b472b15637f0 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -555,7 +555,7 @@ static int ipath_tid_free(struct ipath_portdata *pd, unsigned subport,
555 p = dd->ipath_pageshadow[porttid + tid]; 555 p = dd->ipath_pageshadow[porttid + tid];
556 dd->ipath_pageshadow[porttid + tid] = NULL; 556 dd->ipath_pageshadow[porttid + tid] = NULL;
557 ipath_cdbg(VERBOSE, "PID %u freeing TID %u\n", 557 ipath_cdbg(VERBOSE, "PID %u freeing TID %u\n",
558 pd->port_pid, tid); 558 pid_nr(pd->port_pid), tid);
559 dd->ipath_f_put_tid(dd, &tidbase[tid], 559 dd->ipath_f_put_tid(dd, &tidbase[tid],
560 RCVHQ_RCV_TYPE_EXPECTED, 560 RCVHQ_RCV_TYPE_EXPECTED,
561 dd->ipath_tidinvalid); 561 dd->ipath_tidinvalid);
@@ -1609,7 +1609,7 @@ static int try_alloc_port(struct ipath_devdata *dd, int port,
1609 port); 1609 port);
1610 pd->port_cnt = 1; 1610 pd->port_cnt = 1;
1611 port_fp(fp) = pd; 1611 port_fp(fp) = pd;
1612 pd->port_pid = current->pid; 1612 pd->port_pid = get_pid(task_pid(current));
1613 strncpy(pd->port_comm, current->comm, sizeof(pd->port_comm)); 1613 strncpy(pd->port_comm, current->comm, sizeof(pd->port_comm));
1614 ipath_stats.sps_ports++; 1614 ipath_stats.sps_ports++;
1615 ret = 0; 1615 ret = 0;
@@ -1793,14 +1793,15 @@ static int find_shared_port(struct file *fp,
1793 } 1793 }
1794 port_fp(fp) = pd; 1794 port_fp(fp) = pd;
1795 subport_fp(fp) = pd->port_cnt++; 1795 subport_fp(fp) = pd->port_cnt++;
1796 pd->port_subpid[subport_fp(fp)] = current->pid; 1796 pd->port_subpid[subport_fp(fp)] =
1797 get_pid(task_pid(current));
1797 tidcursor_fp(fp) = 0; 1798 tidcursor_fp(fp) = 0;
1798 pd->active_slaves |= 1 << subport_fp(fp); 1799 pd->active_slaves |= 1 << subport_fp(fp);
1799 ipath_cdbg(PROC, 1800 ipath_cdbg(PROC,
1800 "%s[%u] %u sharing %s[%u] unit:port %u:%u\n", 1801 "%s[%u] %u sharing %s[%u] unit:port %u:%u\n",
1801 current->comm, current->pid, 1802 current->comm, current->pid,
1802 subport_fp(fp), 1803 subport_fp(fp),
1803 pd->port_comm, pd->port_pid, 1804 pd->port_comm, pid_nr(pd->port_pid),
1804 dd->ipath_unit, pd->port_port); 1805 dd->ipath_unit, pd->port_port);
1805 ret = 1; 1806 ret = 1;
1806 goto done; 1807 goto done;
@@ -2066,7 +2067,8 @@ static int ipath_close(struct inode *in, struct file *fp)
2066 * the slave(s) don't wait for receive data forever. 2067 * the slave(s) don't wait for receive data forever.
2067 */ 2068 */
2068 pd->active_slaves &= ~(1 << fd->subport); 2069 pd->active_slaves &= ~(1 << fd->subport);
2069 pd->port_subpid[fd->subport] = 0; 2070 put_pid(pd->port_subpid[fd->subport]);
2071 pd->port_subpid[fd->subport] = NULL;
2070 mutex_unlock(&ipath_mutex); 2072 mutex_unlock(&ipath_mutex);
2071 goto bail; 2073 goto bail;
2072 } 2074 }
@@ -2074,7 +2076,7 @@ static int ipath_close(struct inode *in, struct file *fp)
2074 2076
2075 if (pd->port_hdrqfull) { 2077 if (pd->port_hdrqfull) {
2076 ipath_cdbg(PROC, "%s[%u] had %u rcvhdrqfull errors " 2078 ipath_cdbg(PROC, "%s[%u] had %u rcvhdrqfull errors "
2077 "during run\n", pd->port_comm, pd->port_pid, 2079 "during run\n", pd->port_comm, pid_nr(pd->port_pid),
2078 pd->port_hdrqfull); 2080 pd->port_hdrqfull);
2079 pd->port_hdrqfull = 0; 2081 pd->port_hdrqfull = 0;
2080 } 2082 }
@@ -2134,11 +2136,12 @@ static int ipath_close(struct inode *in, struct file *fp)
2134 unlock_expected_tids(pd); 2136 unlock_expected_tids(pd);
2135 ipath_stats.sps_ports--; 2137 ipath_stats.sps_ports--;
2136 ipath_cdbg(PROC, "%s[%u] closed port %u:%u\n", 2138 ipath_cdbg(PROC, "%s[%u] closed port %u:%u\n",
2137 pd->port_comm, pd->port_pid, 2139 pd->port_comm, pid_nr(pd->port_pid),
2138 dd->ipath_unit, port); 2140 dd->ipath_unit, port);
2139 } 2141 }
2140 2142
2141 pd->port_pid = 0; 2143 put_pid(pd->port_pid);
2144 pd->port_pid = NULL;
2142 dd->ipath_pd[pd->port_port] = NULL; /* before releasing mutex */ 2145 dd->ipath_pd[pd->port_port] = NULL; /* before releasing mutex */
2143 mutex_unlock(&ipath_mutex); 2146 mutex_unlock(&ipath_mutex);
2144 ipath_free_pddata(dd, pd); /* after releasing the mutex */ 2147 ipath_free_pddata(dd, pd); /* after releasing the mutex */
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 02b24a340599..0bd8bcb184a1 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -159,8 +159,8 @@ struct ipath_portdata {
159 /* saved total number of polled urgent packets for poll edge trigger */ 159 /* saved total number of polled urgent packets for poll edge trigger */
160 u32 port_urgent_poll; 160 u32 port_urgent_poll;
161 /* pid of process using this port */ 161 /* pid of process using this port */
162 pid_t port_pid; 162 struct pid *port_pid;
163 pid_t port_subpid[INFINIPATH_MAX_SUBPORT]; 163 struct pid *port_subpid[INFINIPATH_MAX_SUBPORT];
164 /* same size as task_struct .comm[] */ 164 /* same size as task_struct .comm[] */
165 char port_comm[16]; 165 char port_comm[16];
166 /* pkeys set by this use of this port */ 166 /* pkeys set by this use of this port */
@@ -232,6 +232,11 @@ struct ipath_sdma_desc {
232#define IPATH_SDMA_TXREQ_S_ABORTED 2 232#define IPATH_SDMA_TXREQ_S_ABORTED 2
233#define IPATH_SDMA_TXREQ_S_SHUTDOWN 3 233#define IPATH_SDMA_TXREQ_S_SHUTDOWN 3
234 234
235#define IPATH_SDMA_STATUS_SCORE_BOARD_DRAIN_IN_PROG (1ull << 63)
236#define IPATH_SDMA_STATUS_ABORT_IN_PROG (1ull << 62)
237#define IPATH_SDMA_STATUS_INTERNAL_SDMA_ENABLE (1ull << 61)
238#define IPATH_SDMA_STATUS_SCB_EMPTY (1ull << 30)
239
235/* max dwords in small buffer packet */ 240/* max dwords in small buffer packet */
236#define IPATH_SMALLBUF_DWORDS (dd->ipath_piosize2k >> 2) 241#define IPATH_SMALLBUF_DWORDS (dd->ipath_piosize2k >> 2)
237 242
@@ -483,7 +488,7 @@ struct ipath_devdata {
483 488
484 /* SendDMA related entries */ 489 /* SendDMA related entries */
485 spinlock_t ipath_sdma_lock; 490 spinlock_t ipath_sdma_lock;
486 u64 ipath_sdma_status; 491 unsigned long ipath_sdma_status;
487 unsigned long ipath_sdma_abort_jiffies; 492 unsigned long ipath_sdma_abort_jiffies;
488 unsigned long ipath_sdma_abort_intr_timeout; 493 unsigned long ipath_sdma_abort_intr_timeout;
489 unsigned long ipath_sdma_buf_jiffies; 494 unsigned long ipath_sdma_buf_jiffies;
@@ -822,8 +827,8 @@ struct ipath_devdata {
822#define IPATH_SDMA_DISARMED 1 827#define IPATH_SDMA_DISARMED 1
823#define IPATH_SDMA_DISABLED 2 828#define IPATH_SDMA_DISABLED 2
824#define IPATH_SDMA_LAYERBUF 3 829#define IPATH_SDMA_LAYERBUF 3
825#define IPATH_SDMA_RUNNING 62 830#define IPATH_SDMA_RUNNING 30
826#define IPATH_SDMA_SHUTDOWN 63 831#define IPATH_SDMA_SHUTDOWN 31
827 832
828/* bit combinations that correspond to abort states */ 833/* bit combinations that correspond to abort states */
829#define IPATH_SDMA_ABORT_NONE 0 834#define IPATH_SDMA_ABORT_NONE 0
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index 1ff46ae7dd99..5f9315d77a43 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -1492,6 +1492,10 @@ static int process_subn(struct ib_device *ibdev, int mad_flags,
1492 goto bail; 1492 goto bail;
1493 } 1493 }
1494 1494
1495 case IB_MGMT_METHOD_TRAP:
1496 case IB_MGMT_METHOD_REPORT:
1497 case IB_MGMT_METHOD_REPORT_RESP:
1498 case IB_MGMT_METHOD_TRAP_REPRESS:
1495 case IB_MGMT_METHOD_GET_RESP: 1499 case IB_MGMT_METHOD_GET_RESP:
1496 /* 1500 /*
1497 * The ib_mad module will call us to process responses 1501 * The ib_mad module will call us to process responses
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index dd5b6e9d57c2..4715911101e4 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -242,7 +242,6 @@ static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
242{ 242{
243 struct ipath_qp *q, **qpp; 243 struct ipath_qp *q, **qpp;
244 unsigned long flags; 244 unsigned long flags;
245 int fnd = 0;
246 245
247 spin_lock_irqsave(&qpt->lock, flags); 246 spin_lock_irqsave(&qpt->lock, flags);
248 247
@@ -253,51 +252,40 @@ static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
253 *qpp = qp->next; 252 *qpp = qp->next;
254 qp->next = NULL; 253 qp->next = NULL;
255 atomic_dec(&qp->refcount); 254 atomic_dec(&qp->refcount);
256 fnd = 1;
257 break; 255 break;
258 } 256 }
259 } 257 }
260 258
261 spin_unlock_irqrestore(&qpt->lock, flags); 259 spin_unlock_irqrestore(&qpt->lock, flags);
262
263 if (!fnd)
264 return;
265
266 free_qpn(qpt, qp->ibqp.qp_num);
267
268 wait_event(qp->wait, !atomic_read(&qp->refcount));
269} 260}
270 261
271/** 262/**
272 * ipath_free_all_qps - remove all QPs from the table 263 * ipath_free_all_qps - check for QPs still in use
273 * @qpt: the QP table to empty 264 * @qpt: the QP table to empty
265 *
266 * There should not be any QPs still in use.
267 * Free memory for table.
274 */ 268 */
275void ipath_free_all_qps(struct ipath_qp_table *qpt) 269unsigned ipath_free_all_qps(struct ipath_qp_table *qpt)
276{ 270{
277 unsigned long flags; 271 unsigned long flags;
278 struct ipath_qp *qp, *nqp; 272 struct ipath_qp *qp;
279 u32 n; 273 u32 n, qp_inuse = 0;
280 274
275 spin_lock_irqsave(&qpt->lock, flags);
281 for (n = 0; n < qpt->max; n++) { 276 for (n = 0; n < qpt->max; n++) {
282 spin_lock_irqsave(&qpt->lock, flags);
283 qp = qpt->table[n]; 277 qp = qpt->table[n];
284 qpt->table[n] = NULL; 278 qpt->table[n] = NULL;
285 spin_unlock_irqrestore(&qpt->lock, flags); 279
286 280 for (; qp; qp = qp->next)
287 while (qp) { 281 qp_inuse++;
288 nqp = qp->next;
289 free_qpn(qpt, qp->ibqp.qp_num);
290 if (!atomic_dec_and_test(&qp->refcount) ||
291 !ipath_destroy_qp(&qp->ibqp))
292 ipath_dbg("QP memory leak!\n");
293 qp = nqp;
294 }
295 } 282 }
283 spin_unlock_irqrestore(&qpt->lock, flags);
296 284
297 for (n = 0; n < ARRAY_SIZE(qpt->map); n++) { 285 for (n = 0; n < ARRAY_SIZE(qpt->map); n++)
298 if (qpt->map[n].page) 286 if (qpt->map[n].page)
299 free_page((unsigned long)qpt->map[n].page); 287 free_page((unsigned long) qpt->map[n].page);
300 } 288 return qp_inuse;
301} 289}
302 290
303/** 291/**
@@ -336,11 +324,12 @@ static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type)
336 qp->remote_qpn = 0; 324 qp->remote_qpn = 0;
337 qp->qkey = 0; 325 qp->qkey = 0;
338 qp->qp_access_flags = 0; 326 qp->qp_access_flags = 0;
339 qp->s_busy = 0; 327 atomic_set(&qp->s_dma_busy, 0);
340 qp->s_flags &= IPATH_S_SIGNAL_REQ_WR; 328 qp->s_flags &= IPATH_S_SIGNAL_REQ_WR;
341 qp->s_hdrwords = 0; 329 qp->s_hdrwords = 0;
342 qp->s_wqe = NULL; 330 qp->s_wqe = NULL;
343 qp->s_pkt_delay = 0; 331 qp->s_pkt_delay = 0;
332 qp->s_draining = 0;
344 qp->s_psn = 0; 333 qp->s_psn = 0;
345 qp->r_psn = 0; 334 qp->r_psn = 0;
346 qp->r_msn = 0; 335 qp->r_msn = 0;
@@ -353,7 +342,8 @@ static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type)
353 } 342 }
354 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; 343 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
355 qp->r_nak_state = 0; 344 qp->r_nak_state = 0;
356 qp->r_wrid_valid = 0; 345 qp->r_aflags = 0;
346 qp->r_flags = 0;
357 qp->s_rnr_timeout = 0; 347 qp->s_rnr_timeout = 0;
358 qp->s_head = 0; 348 qp->s_head = 0;
359 qp->s_tail = 0; 349 qp->s_tail = 0;
@@ -361,7 +351,6 @@ static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type)
361 qp->s_last = 0; 351 qp->s_last = 0;
362 qp->s_ssn = 1; 352 qp->s_ssn = 1;
363 qp->s_lsn = 0; 353 qp->s_lsn = 0;
364 qp->s_wait_credit = 0;
365 memset(qp->s_ack_queue, 0, sizeof(qp->s_ack_queue)); 354 memset(qp->s_ack_queue, 0, sizeof(qp->s_ack_queue));
366 qp->r_head_ack_queue = 0; 355 qp->r_head_ack_queue = 0;
367 qp->s_tail_ack_queue = 0; 356 qp->s_tail_ack_queue = 0;
@@ -370,17 +359,17 @@ static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type)
370 qp->r_rq.wq->head = 0; 359 qp->r_rq.wq->head = 0;
371 qp->r_rq.wq->tail = 0; 360 qp->r_rq.wq->tail = 0;
372 } 361 }
373 qp->r_reuse_sge = 0;
374} 362}
375 363
376/** 364/**
377 * ipath_error_qp - put a QP into an error state 365 * ipath_error_qp - put a QP into the error state
378 * @qp: the QP to put into an error state 366 * @qp: the QP to put into the error state
379 * @err: the receive completion error to signal if a RWQE is active 367 * @err: the receive completion error to signal if a RWQE is active
380 * 368 *
381 * Flushes both send and receive work queues. 369 * Flushes both send and receive work queues.
382 * Returns true if last WQE event should be generated. 370 * Returns true if last WQE event should be generated.
383 * The QP s_lock should be held and interrupts disabled. 371 * The QP s_lock should be held and interrupts disabled.
372 * If we are already in error state, just return.
384 */ 373 */
385 374
386int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err) 375int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
@@ -389,8 +378,10 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
389 struct ib_wc wc; 378 struct ib_wc wc;
390 int ret = 0; 379 int ret = 0;
391 380
392 ipath_dbg("QP%d/%d in error state (%d)\n", 381 if (qp->state == IB_QPS_ERR)
393 qp->ibqp.qp_num, qp->remote_qpn, err); 382 goto bail;
383
384 qp->state = IB_QPS_ERR;
394 385
395 spin_lock(&dev->pending_lock); 386 spin_lock(&dev->pending_lock);
396 if (!list_empty(&qp->timerwait)) 387 if (!list_empty(&qp->timerwait))
@@ -399,39 +390,21 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
399 list_del_init(&qp->piowait); 390 list_del_init(&qp->piowait);
400 spin_unlock(&dev->pending_lock); 391 spin_unlock(&dev->pending_lock);
401 392
402 wc.vendor_err = 0; 393 /* Schedule the sending tasklet to drain the send work queue. */
403 wc.byte_len = 0; 394 if (qp->s_last != qp->s_head)
404 wc.imm_data = 0; 395 ipath_schedule_send(qp);
396
397 memset(&wc, 0, sizeof(wc));
405 wc.qp = &qp->ibqp; 398 wc.qp = &qp->ibqp;
406 wc.src_qp = 0; 399 wc.opcode = IB_WC_RECV;
407 wc.wc_flags = 0; 400
408 wc.pkey_index = 0; 401 if (test_and_clear_bit(IPATH_R_WRID_VALID, &qp->r_aflags)) {
409 wc.slid = 0;
410 wc.sl = 0;
411 wc.dlid_path_bits = 0;
412 wc.port_num = 0;
413 if (qp->r_wrid_valid) {
414 qp->r_wrid_valid = 0;
415 wc.wr_id = qp->r_wr_id; 402 wc.wr_id = qp->r_wr_id;
416 wc.opcode = IB_WC_RECV;
417 wc.status = err; 403 wc.status = err;
418 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); 404 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1);
419 } 405 }
420 wc.status = IB_WC_WR_FLUSH_ERR; 406 wc.status = IB_WC_WR_FLUSH_ERR;
421 407
422 while (qp->s_last != qp->s_head) {
423 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
424
425 wc.wr_id = wqe->wr.wr_id;
426 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
427 if (++qp->s_last >= qp->s_size)
428 qp->s_last = 0;
429 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1);
430 }
431 qp->s_cur = qp->s_tail = qp->s_head;
432 qp->s_hdrwords = 0;
433 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
434
435 if (qp->r_rq.wq) { 408 if (qp->r_rq.wq) {
436 struct ipath_rwq *wq; 409 struct ipath_rwq *wq;
437 u32 head; 410 u32 head;
@@ -447,7 +420,6 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
447 tail = wq->tail; 420 tail = wq->tail;
448 if (tail >= qp->r_rq.size) 421 if (tail >= qp->r_rq.size)
449 tail = 0; 422 tail = 0;
450 wc.opcode = IB_WC_RECV;
451 while (tail != head) { 423 while (tail != head) {
452 wc.wr_id = get_rwqe_ptr(&qp->r_rq, tail)->wr_id; 424 wc.wr_id = get_rwqe_ptr(&qp->r_rq, tail)->wr_id;
453 if (++tail >= qp->r_rq.size) 425 if (++tail >= qp->r_rq.size)
@@ -460,6 +432,7 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
460 } else if (qp->ibqp.event_handler) 432 } else if (qp->ibqp.event_handler)
461 ret = 1; 433 ret = 1;
462 434
435bail:
463 return ret; 436 return ret;
464} 437}
465 438
@@ -478,11 +451,10 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
478 struct ipath_ibdev *dev = to_idev(ibqp->device); 451 struct ipath_ibdev *dev = to_idev(ibqp->device);
479 struct ipath_qp *qp = to_iqp(ibqp); 452 struct ipath_qp *qp = to_iqp(ibqp);
480 enum ib_qp_state cur_state, new_state; 453 enum ib_qp_state cur_state, new_state;
481 unsigned long flags;
482 int lastwqe = 0; 454 int lastwqe = 0;
483 int ret; 455 int ret;
484 456
485 spin_lock_irqsave(&qp->s_lock, flags); 457 spin_lock_irq(&qp->s_lock);
486 458
487 cur_state = attr_mask & IB_QP_CUR_STATE ? 459 cur_state = attr_mask & IB_QP_CUR_STATE ?
488 attr->cur_qp_state : qp->state; 460 attr->cur_qp_state : qp->state;
@@ -535,16 +507,42 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
535 507
536 switch (new_state) { 508 switch (new_state) {
537 case IB_QPS_RESET: 509 case IB_QPS_RESET:
510 if (qp->state != IB_QPS_RESET) {
511 qp->state = IB_QPS_RESET;
512 spin_lock(&dev->pending_lock);
513 if (!list_empty(&qp->timerwait))
514 list_del_init(&qp->timerwait);
515 if (!list_empty(&qp->piowait))
516 list_del_init(&qp->piowait);
517 spin_unlock(&dev->pending_lock);
518 qp->s_flags &= ~IPATH_S_ANY_WAIT;
519 spin_unlock_irq(&qp->s_lock);
520 /* Stop the sending tasklet */
521 tasklet_kill(&qp->s_task);
522 wait_event(qp->wait_dma, !atomic_read(&qp->s_dma_busy));
523 spin_lock_irq(&qp->s_lock);
524 }
538 ipath_reset_qp(qp, ibqp->qp_type); 525 ipath_reset_qp(qp, ibqp->qp_type);
539 break; 526 break;
540 527
528 case IB_QPS_SQD:
529 qp->s_draining = qp->s_last != qp->s_cur;
530 qp->state = new_state;
531 break;
532
533 case IB_QPS_SQE:
534 if (qp->ibqp.qp_type == IB_QPT_RC)
535 goto inval;
536 qp->state = new_state;
537 break;
538
541 case IB_QPS_ERR: 539 case IB_QPS_ERR:
542 lastwqe = ipath_error_qp(qp, IB_WC_WR_FLUSH_ERR); 540 lastwqe = ipath_error_qp(qp, IB_WC_WR_FLUSH_ERR);
543 break; 541 break;
544 542
545 default: 543 default:
544 qp->state = new_state;
546 break; 545 break;
547
548 } 546 }
549 547
550 if (attr_mask & IB_QP_PKEY_INDEX) 548 if (attr_mask & IB_QP_PKEY_INDEX)
@@ -597,8 +595,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
597 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC) 595 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC)
598 qp->s_max_rd_atomic = attr->max_rd_atomic; 596 qp->s_max_rd_atomic = attr->max_rd_atomic;
599 597
600 qp->state = new_state; 598 spin_unlock_irq(&qp->s_lock);
601 spin_unlock_irqrestore(&qp->s_lock, flags);
602 599
603 if (lastwqe) { 600 if (lastwqe) {
604 struct ib_event ev; 601 struct ib_event ev;
@@ -612,7 +609,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
612 goto bail; 609 goto bail;
613 610
614inval: 611inval:
615 spin_unlock_irqrestore(&qp->s_lock, flags); 612 spin_unlock_irq(&qp->s_lock);
616 ret = -EINVAL; 613 ret = -EINVAL;
617 614
618bail: 615bail:
@@ -643,7 +640,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
643 attr->pkey_index = qp->s_pkey_index; 640 attr->pkey_index = qp->s_pkey_index;
644 attr->alt_pkey_index = 0; 641 attr->alt_pkey_index = 0;
645 attr->en_sqd_async_notify = 0; 642 attr->en_sqd_async_notify = 0;
646 attr->sq_draining = 0; 643 attr->sq_draining = qp->s_draining;
647 attr->max_rd_atomic = qp->s_max_rd_atomic; 644 attr->max_rd_atomic = qp->s_max_rd_atomic;
648 attr->max_dest_rd_atomic = qp->r_max_rd_atomic; 645 attr->max_dest_rd_atomic = qp->r_max_rd_atomic;
649 attr->min_rnr_timer = qp->r_min_rnr_timer; 646 attr->min_rnr_timer = qp->r_min_rnr_timer;
@@ -833,6 +830,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
833 spin_lock_init(&qp->r_rq.lock); 830 spin_lock_init(&qp->r_rq.lock);
834 atomic_set(&qp->refcount, 0); 831 atomic_set(&qp->refcount, 0);
835 init_waitqueue_head(&qp->wait); 832 init_waitqueue_head(&qp->wait);
833 init_waitqueue_head(&qp->wait_dma);
836 tasklet_init(&qp->s_task, ipath_do_send, (unsigned long)qp); 834 tasklet_init(&qp->s_task, ipath_do_send, (unsigned long)qp);
837 INIT_LIST_HEAD(&qp->piowait); 835 INIT_LIST_HEAD(&qp->piowait);
838 INIT_LIST_HEAD(&qp->timerwait); 836 INIT_LIST_HEAD(&qp->timerwait);
@@ -926,6 +924,7 @@ bail_ip:
926 else 924 else
927 vfree(qp->r_rq.wq); 925 vfree(qp->r_rq.wq);
928 ipath_free_qp(&dev->qp_table, qp); 926 ipath_free_qp(&dev->qp_table, qp);
927 free_qpn(&dev->qp_table, qp->ibqp.qp_num);
929bail_qp: 928bail_qp:
930 kfree(qp); 929 kfree(qp);
931bail_swq: 930bail_swq:
@@ -947,41 +946,44 @@ int ipath_destroy_qp(struct ib_qp *ibqp)
947{ 946{
948 struct ipath_qp *qp = to_iqp(ibqp); 947 struct ipath_qp *qp = to_iqp(ibqp);
949 struct ipath_ibdev *dev = to_idev(ibqp->device); 948 struct ipath_ibdev *dev = to_idev(ibqp->device);
950 unsigned long flags;
951 949
952 spin_lock_irqsave(&qp->s_lock, flags); 950 /* Make sure HW and driver activity is stopped. */
953 qp->state = IB_QPS_ERR; 951 spin_lock_irq(&qp->s_lock);
954 spin_unlock_irqrestore(&qp->s_lock, flags); 952 if (qp->state != IB_QPS_RESET) {
955 spin_lock(&dev->n_qps_lock); 953 qp->state = IB_QPS_RESET;
956 dev->n_qps_allocated--; 954 spin_lock(&dev->pending_lock);
957 spin_unlock(&dev->n_qps_lock); 955 if (!list_empty(&qp->timerwait))
956 list_del_init(&qp->timerwait);
957 if (!list_empty(&qp->piowait))
958 list_del_init(&qp->piowait);
959 spin_unlock(&dev->pending_lock);
960 qp->s_flags &= ~IPATH_S_ANY_WAIT;
961 spin_unlock_irq(&qp->s_lock);
962 /* Stop the sending tasklet */
963 tasklet_kill(&qp->s_task);
964 wait_event(qp->wait_dma, !atomic_read(&qp->s_dma_busy));
965 } else
966 spin_unlock_irq(&qp->s_lock);
958 967
959 /* Stop the sending tasklet. */ 968 ipath_free_qp(&dev->qp_table, qp);
960 tasklet_kill(&qp->s_task);
961 969
962 if (qp->s_tx) { 970 if (qp->s_tx) {
963 atomic_dec(&qp->refcount); 971 atomic_dec(&qp->refcount);
964 if (qp->s_tx->txreq.flags & IPATH_SDMA_TXREQ_F_FREEBUF) 972 if (qp->s_tx->txreq.flags & IPATH_SDMA_TXREQ_F_FREEBUF)
965 kfree(qp->s_tx->txreq.map_addr); 973 kfree(qp->s_tx->txreq.map_addr);
974 spin_lock_irq(&dev->pending_lock);
975 list_add(&qp->s_tx->txreq.list, &dev->txreq_free);
976 spin_unlock_irq(&dev->pending_lock);
977 qp->s_tx = NULL;
966 } 978 }
967 979
968 /* Make sure the QP isn't on the timeout list. */ 980 wait_event(qp->wait, !atomic_read(&qp->refcount));
969 spin_lock_irqsave(&dev->pending_lock, flags);
970 if (!list_empty(&qp->timerwait))
971 list_del_init(&qp->timerwait);
972 if (!list_empty(&qp->piowait))
973 list_del_init(&qp->piowait);
974 if (qp->s_tx)
975 list_add(&qp->s_tx->txreq.list, &dev->txreq_free);
976 spin_unlock_irqrestore(&dev->pending_lock, flags);
977 981
978 /* 982 /* all user's cleaned up, mark it available */
979 * Make sure that the QP is not in the QPN table so receive 983 free_qpn(&dev->qp_table, qp->ibqp.qp_num);
980 * interrupts will discard packets for this QP. XXX Also remove QP 984 spin_lock(&dev->n_qps_lock);
981 * from multicast table. 985 dev->n_qps_allocated--;
982 */ 986 spin_unlock(&dev->n_qps_lock);
983 if (atomic_read(&qp->refcount) != 0)
984 ipath_free_qp(&dev->qp_table, qp);
985 987
986 if (qp->ip) 988 if (qp->ip)
987 kref_put(&qp->ip->ref, ipath_release_mmap_info); 989 kref_put(&qp->ip->ref, ipath_release_mmap_info);
@@ -1026,48 +1028,6 @@ bail:
1026} 1028}
1027 1029
1028/** 1030/**
1029 * ipath_sqerror_qp - put a QP's send queue into an error state
1030 * @qp: QP who's send queue will be put into an error state
1031 * @wc: the WC responsible for putting the QP in this state
1032 *
1033 * Flushes the send work queue.
1034 * The QP s_lock should be held and interrupts disabled.
1035 */
1036
1037void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
1038{
1039 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
1040 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
1041
1042 ipath_dbg("Send queue error on QP%d/%d: err: %d\n",
1043 qp->ibqp.qp_num, qp->remote_qpn, wc->status);
1044
1045 spin_lock(&dev->pending_lock);
1046 if (!list_empty(&qp->timerwait))
1047 list_del_init(&qp->timerwait);
1048 if (!list_empty(&qp->piowait))
1049 list_del_init(&qp->piowait);
1050 spin_unlock(&dev->pending_lock);
1051
1052 ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1);
1053 if (++qp->s_last >= qp->s_size)
1054 qp->s_last = 0;
1055
1056 wc->status = IB_WC_WR_FLUSH_ERR;
1057
1058 while (qp->s_last != qp->s_head) {
1059 wqe = get_swqe_ptr(qp, qp->s_last);
1060 wc->wr_id = wqe->wr.wr_id;
1061 wc->opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
1062 ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1);
1063 if (++qp->s_last >= qp->s_size)
1064 qp->s_last = 0;
1065 }
1066 qp->s_cur = qp->s_tail = qp->s_head;
1067 qp->state = IB_QPS_SQE;
1068}
1069
1070/**
1071 * ipath_get_credit - flush the send work queue of a QP 1031 * ipath_get_credit - flush the send work queue of a QP
1072 * @qp: the qp who's send work queue to flush 1032 * @qp: the qp who's send work queue to flush
1073 * @aeth: the Acknowledge Extended Transport Header 1033 * @aeth: the Acknowledge Extended Transport Header
@@ -1093,9 +1053,10 @@ void ipath_get_credit(struct ipath_qp *qp, u32 aeth)
1093 } 1053 }
1094 1054
1095 /* Restart sending if it was blocked due to lack of credits. */ 1055 /* Restart sending if it was blocked due to lack of credits. */
1096 if (qp->s_cur != qp->s_head && 1056 if ((qp->s_flags & IPATH_S_WAIT_SSN_CREDIT) &&
1057 qp->s_cur != qp->s_head &&
1097 (qp->s_lsn == (u32) -1 || 1058 (qp->s_lsn == (u32) -1 ||
1098 ipath_cmp24(get_swqe_ptr(qp, qp->s_cur)->ssn, 1059 ipath_cmp24(get_swqe_ptr(qp, qp->s_cur)->ssn,
1099 qp->s_lsn + 1) <= 0)) 1060 qp->s_lsn + 1) <= 0))
1100 tasklet_hi_schedule(&qp->s_task); 1061 ipath_schedule_send(qp);
1101} 1062}
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 08b11b567614..108df667d2ee 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -92,6 +92,10 @@ static int ipath_make_rc_ack(struct ipath_ibdev *dev, struct ipath_qp *qp,
92 u32 bth0; 92 u32 bth0;
93 u32 bth2; 93 u32 bth2;
94 94
95 /* Don't send an ACK if we aren't supposed to. */
96 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK))
97 goto bail;
98
95 /* header size in 32-bit words LRH+BTH = (8+12)/4. */ 99 /* header size in 32-bit words LRH+BTH = (8+12)/4. */
96 hwords = 5; 100 hwords = 5;
97 101
@@ -238,14 +242,25 @@ int ipath_make_rc_req(struct ipath_qp *qp)
238 ipath_make_rc_ack(dev, qp, ohdr, pmtu)) 242 ipath_make_rc_ack(dev, qp, ohdr, pmtu))
239 goto done; 243 goto done;
240 244
241 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK) || 245 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)) {
242 qp->s_rnr_timeout || qp->s_wait_credit) 246 if (!(ib_ipath_state_ops[qp->state] & IPATH_FLUSH_SEND))
243 goto bail; 247 goto bail;
248 /* We are in the error state, flush the work request. */
249 if (qp->s_last == qp->s_head)
250 goto bail;
251 /* If DMAs are in progress, we can't flush immediately. */
252 if (atomic_read(&qp->s_dma_busy)) {
253 qp->s_flags |= IPATH_S_WAIT_DMA;
254 goto bail;
255 }
256 wqe = get_swqe_ptr(qp, qp->s_last);
257 ipath_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR);
258 goto done;
259 }
244 260
245 /* Limit the number of packets sent without an ACK. */ 261 /* Leave BUSY set until RNR timeout. */
246 if (ipath_cmp24(qp->s_psn, qp->s_last_psn + IPATH_PSN_CREDIT) > 0) { 262 if (qp->s_rnr_timeout) {
247 qp->s_wait_credit = 1; 263 qp->s_flags |= IPATH_S_WAITING;
248 dev->n_rc_stalls++;
249 goto bail; 264 goto bail;
250 } 265 }
251 266
@@ -257,6 +272,9 @@ int ipath_make_rc_req(struct ipath_qp *qp)
257 wqe = get_swqe_ptr(qp, qp->s_cur); 272 wqe = get_swqe_ptr(qp, qp->s_cur);
258 switch (qp->s_state) { 273 switch (qp->s_state) {
259 default: 274 default:
275 if (!(ib_ipath_state_ops[qp->state] &
276 IPATH_PROCESS_NEXT_SEND_OK))
277 goto bail;
260 /* 278 /*
261 * Resend an old request or start a new one. 279 * Resend an old request or start a new one.
262 * 280 *
@@ -294,8 +312,10 @@ int ipath_make_rc_req(struct ipath_qp *qp)
294 case IB_WR_SEND_WITH_IMM: 312 case IB_WR_SEND_WITH_IMM:
295 /* If no credit, return. */ 313 /* If no credit, return. */
296 if (qp->s_lsn != (u32) -1 && 314 if (qp->s_lsn != (u32) -1 &&
297 ipath_cmp24(wqe->ssn, qp->s_lsn + 1) > 0) 315 ipath_cmp24(wqe->ssn, qp->s_lsn + 1) > 0) {
316 qp->s_flags |= IPATH_S_WAIT_SSN_CREDIT;
298 goto bail; 317 goto bail;
318 }
299 wqe->lpsn = wqe->psn; 319 wqe->lpsn = wqe->psn;
300 if (len > pmtu) { 320 if (len > pmtu) {
301 wqe->lpsn += (len - 1) / pmtu; 321 wqe->lpsn += (len - 1) / pmtu;
@@ -325,8 +345,10 @@ int ipath_make_rc_req(struct ipath_qp *qp)
325 case IB_WR_RDMA_WRITE_WITH_IMM: 345 case IB_WR_RDMA_WRITE_WITH_IMM:
326 /* If no credit, return. */ 346 /* If no credit, return. */
327 if (qp->s_lsn != (u32) -1 && 347 if (qp->s_lsn != (u32) -1 &&
328 ipath_cmp24(wqe->ssn, qp->s_lsn + 1) > 0) 348 ipath_cmp24(wqe->ssn, qp->s_lsn + 1) > 0) {
349 qp->s_flags |= IPATH_S_WAIT_SSN_CREDIT;
329 goto bail; 350 goto bail;
351 }
330 ohdr->u.rc.reth.vaddr = 352 ohdr->u.rc.reth.vaddr =
331 cpu_to_be64(wqe->wr.wr.rdma.remote_addr); 353 cpu_to_be64(wqe->wr.wr.rdma.remote_addr);
332 ohdr->u.rc.reth.rkey = 354 ohdr->u.rc.reth.rkey =
@@ -570,7 +592,11 @@ int ipath_make_rc_req(struct ipath_qp *qp)
570 ipath_make_ruc_header(dev, qp, ohdr, bth0 | (qp->s_state << 24), bth2); 592 ipath_make_ruc_header(dev, qp, ohdr, bth0 | (qp->s_state << 24), bth2);
571done: 593done:
572 ret = 1; 594 ret = 1;
595 goto unlock;
596
573bail: 597bail:
598 qp->s_flags &= ~IPATH_S_BUSY;
599unlock:
574 spin_unlock_irqrestore(&qp->s_lock, flags); 600 spin_unlock_irqrestore(&qp->s_lock, flags);
575 return ret; 601 return ret;
576} 602}
@@ -606,7 +632,11 @@ static void send_rc_ack(struct ipath_qp *qp)
606 632
607 spin_unlock_irqrestore(&qp->s_lock, flags); 633 spin_unlock_irqrestore(&qp->s_lock, flags);
608 634
635 /* Don't try to send ACKs if the link isn't ACTIVE */
609 dd = dev->dd; 636 dd = dev->dd;
637 if (!(dd->ipath_flags & IPATH_LINKACTIVE))
638 goto done;
639
610 piobuf = ipath_getpiobuf(dd, 0, NULL); 640 piobuf = ipath_getpiobuf(dd, 0, NULL);
611 if (!piobuf) { 641 if (!piobuf) {
612 /* 642 /*
@@ -668,15 +698,16 @@ static void send_rc_ack(struct ipath_qp *qp)
668 goto done; 698 goto done;
669 699
670queue_ack: 700queue_ack:
671 dev->n_rc_qacks++; 701 if (ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK) {
672 qp->s_flags |= IPATH_S_ACK_PENDING; 702 dev->n_rc_qacks++;
673 qp->s_nak_state = qp->r_nak_state; 703 qp->s_flags |= IPATH_S_ACK_PENDING;
674 qp->s_ack_psn = qp->r_ack_psn; 704 qp->s_nak_state = qp->r_nak_state;
705 qp->s_ack_psn = qp->r_ack_psn;
706
707 /* Schedule the send tasklet. */
708 ipath_schedule_send(qp);
709 }
675 spin_unlock_irqrestore(&qp->s_lock, flags); 710 spin_unlock_irqrestore(&qp->s_lock, flags);
676
677 /* Call ipath_do_rc_send() in another thread. */
678 tasklet_hi_schedule(&qp->s_task);
679
680done: 711done:
681 return; 712 return;
682} 713}
@@ -735,7 +766,7 @@ static void reset_psn(struct ipath_qp *qp, u32 psn)
735 /* 766 /*
736 * Set the state to restart in the middle of a request. 767 * Set the state to restart in the middle of a request.
737 * Don't change the s_sge, s_cur_sge, or s_cur_size. 768 * Don't change the s_sge, s_cur_sge, or s_cur_size.
738 * See ipath_do_rc_send(). 769 * See ipath_make_rc_req().
739 */ 770 */
740 switch (opcode) { 771 switch (opcode) {
741 case IB_WR_SEND: 772 case IB_WR_SEND:
@@ -771,27 +802,14 @@ done:
771 * 802 *
772 * The QP s_lock should be held and interrupts disabled. 803 * The QP s_lock should be held and interrupts disabled.
773 */ 804 */
774void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) 805void ipath_restart_rc(struct ipath_qp *qp, u32 psn)
775{ 806{
776 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last); 807 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
777 struct ipath_ibdev *dev; 808 struct ipath_ibdev *dev;
778 809
779 if (qp->s_retry == 0) { 810 if (qp->s_retry == 0) {
780 wc->wr_id = wqe->wr.wr_id; 811 ipath_send_complete(qp, wqe, IB_WC_RETRY_EXC_ERR);
781 wc->status = IB_WC_RETRY_EXC_ERR; 812 ipath_error_qp(qp, IB_WC_WR_FLUSH_ERR);
782 wc->opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
783 wc->vendor_err = 0;
784 wc->byte_len = 0;
785 wc->qp = &qp->ibqp;
786 wc->imm_data = 0;
787 wc->src_qp = qp->remote_qpn;
788 wc->wc_flags = 0;
789 wc->pkey_index = 0;
790 wc->slid = qp->remote_ah_attr.dlid;
791 wc->sl = qp->remote_ah_attr.sl;
792 wc->dlid_path_bits = 0;
793 wc->port_num = 0;
794 ipath_sqerror_qp(qp, wc);
795 goto bail; 813 goto bail;
796 } 814 }
797 qp->s_retry--; 815 qp->s_retry--;
@@ -804,6 +822,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
804 spin_lock(&dev->pending_lock); 822 spin_lock(&dev->pending_lock);
805 if (!list_empty(&qp->timerwait)) 823 if (!list_empty(&qp->timerwait))
806 list_del_init(&qp->timerwait); 824 list_del_init(&qp->timerwait);
825 if (!list_empty(&qp->piowait))
826 list_del_init(&qp->piowait);
807 spin_unlock(&dev->pending_lock); 827 spin_unlock(&dev->pending_lock);
808 828
809 if (wqe->wr.opcode == IB_WR_RDMA_READ) 829 if (wqe->wr.opcode == IB_WR_RDMA_READ)
@@ -812,7 +832,7 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
812 dev->n_rc_resends += (qp->s_psn - psn) & IPATH_PSN_MASK; 832 dev->n_rc_resends += (qp->s_psn - psn) & IPATH_PSN_MASK;
813 833
814 reset_psn(qp, psn); 834 reset_psn(qp, psn);
815 tasklet_hi_schedule(&qp->s_task); 835 ipath_schedule_send(qp);
816 836
817bail: 837bail:
818 return; 838 return;
@@ -820,13 +840,7 @@ bail:
820 840
821static inline void update_last_psn(struct ipath_qp *qp, u32 psn) 841static inline void update_last_psn(struct ipath_qp *qp, u32 psn)
822{ 842{
823 if (qp->s_last_psn != psn) { 843 qp->s_last_psn = psn;
824 qp->s_last_psn = psn;
825 if (qp->s_wait_credit) {
826 qp->s_wait_credit = 0;
827 tasklet_hi_schedule(&qp->s_task);
828 }
829 }
830} 844}
831 845
832/** 846/**
@@ -845,6 +859,7 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
845{ 859{
846 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 860 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
847 struct ib_wc wc; 861 struct ib_wc wc;
862 enum ib_wc_status status;
848 struct ipath_swqe *wqe; 863 struct ipath_swqe *wqe;
849 int ret = 0; 864 int ret = 0;
850 u32 ack_psn; 865 u32 ack_psn;
@@ -909,7 +924,7 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
909 */ 924 */
910 update_last_psn(qp, wqe->psn - 1); 925 update_last_psn(qp, wqe->psn - 1);
911 /* Retry this request. */ 926 /* Retry this request. */
912 ipath_restart_rc(qp, wqe->psn, &wc); 927 ipath_restart_rc(qp, wqe->psn);
913 /* 928 /*
914 * No need to process the ACK/NAK since we are 929 * No need to process the ACK/NAK since we are
915 * restarting an earlier request. 930 * restarting an earlier request.
@@ -925,32 +940,23 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
925 wqe->wr.opcode == IB_WR_ATOMIC_FETCH_AND_ADD)) { 940 wqe->wr.opcode == IB_WR_ATOMIC_FETCH_AND_ADD)) {
926 qp->s_num_rd_atomic--; 941 qp->s_num_rd_atomic--;
927 /* Restart sending task if fence is complete */ 942 /* Restart sending task if fence is complete */
928 if ((qp->s_flags & IPATH_S_FENCE_PENDING) && 943 if (((qp->s_flags & IPATH_S_FENCE_PENDING) &&
929 !qp->s_num_rd_atomic) { 944 !qp->s_num_rd_atomic) ||
930 qp->s_flags &= ~IPATH_S_FENCE_PENDING; 945 qp->s_flags & IPATH_S_RDMAR_PENDING)
931 tasklet_hi_schedule(&qp->s_task); 946 ipath_schedule_send(qp);
932 } else if (qp->s_flags & IPATH_S_RDMAR_PENDING) {
933 qp->s_flags &= ~IPATH_S_RDMAR_PENDING;
934 tasklet_hi_schedule(&qp->s_task);
935 }
936 } 947 }
937 /* Post a send completion queue entry if requested. */ 948 /* Post a send completion queue entry if requested. */
938 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) || 949 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) ||
939 (wqe->wr.send_flags & IB_SEND_SIGNALED)) { 950 (wqe->wr.send_flags & IB_SEND_SIGNALED)) {
951 memset(&wc, 0, sizeof wc);
940 wc.wr_id = wqe->wr.wr_id; 952 wc.wr_id = wqe->wr.wr_id;
941 wc.status = IB_WC_SUCCESS; 953 wc.status = IB_WC_SUCCESS;
942 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; 954 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
943 wc.vendor_err = 0;
944 wc.byte_len = wqe->length; 955 wc.byte_len = wqe->length;
945 wc.imm_data = 0;
946 wc.qp = &qp->ibqp; 956 wc.qp = &qp->ibqp;
947 wc.src_qp = qp->remote_qpn; 957 wc.src_qp = qp->remote_qpn;
948 wc.wc_flags = 0;
949 wc.pkey_index = 0;
950 wc.slid = qp->remote_ah_attr.dlid; 958 wc.slid = qp->remote_ah_attr.dlid;
951 wc.sl = qp->remote_ah_attr.sl; 959 wc.sl = qp->remote_ah_attr.sl;
952 wc.dlid_path_bits = 0;
953 wc.port_num = 0;
954 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0); 960 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0);
955 } 961 }
956 qp->s_retry = qp->s_retry_cnt; 962 qp->s_retry = qp->s_retry_cnt;
@@ -971,6 +977,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
971 } else { 977 } else {
972 if (++qp->s_last >= qp->s_size) 978 if (++qp->s_last >= qp->s_size)
973 qp->s_last = 0; 979 qp->s_last = 0;
980 if (qp->state == IB_QPS_SQD && qp->s_last == qp->s_cur)
981 qp->s_draining = 0;
974 if (qp->s_last == qp->s_tail) 982 if (qp->s_last == qp->s_tail)
975 break; 983 break;
976 wqe = get_swqe_ptr(qp, qp->s_last); 984 wqe = get_swqe_ptr(qp, qp->s_last);
@@ -994,7 +1002,7 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
994 */ 1002 */
995 if (ipath_cmp24(qp->s_psn, psn) <= 0) { 1003 if (ipath_cmp24(qp->s_psn, psn) <= 0) {
996 reset_psn(qp, psn + 1); 1004 reset_psn(qp, psn + 1);
997 tasklet_hi_schedule(&qp->s_task); 1005 ipath_schedule_send(qp);
998 } 1006 }
999 } else if (ipath_cmp24(qp->s_psn, psn) <= 0) { 1007 } else if (ipath_cmp24(qp->s_psn, psn) <= 0) {
1000 qp->s_state = OP(SEND_LAST); 1008 qp->s_state = OP(SEND_LAST);
@@ -1012,7 +1020,7 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
1012 if (qp->s_last == qp->s_tail) 1020 if (qp->s_last == qp->s_tail)
1013 goto bail; 1021 goto bail;
1014 if (qp->s_rnr_retry == 0) { 1022 if (qp->s_rnr_retry == 0) {
1015 wc.status = IB_WC_RNR_RETRY_EXC_ERR; 1023 status = IB_WC_RNR_RETRY_EXC_ERR;
1016 goto class_b; 1024 goto class_b;
1017 } 1025 }
1018 if (qp->s_rnr_retry_cnt < 7) 1026 if (qp->s_rnr_retry_cnt < 7)
@@ -1033,6 +1041,7 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
1033 ib_ipath_rnr_table[(aeth >> IPATH_AETH_CREDIT_SHIFT) & 1041 ib_ipath_rnr_table[(aeth >> IPATH_AETH_CREDIT_SHIFT) &
1034 IPATH_AETH_CREDIT_MASK]; 1042 IPATH_AETH_CREDIT_MASK];
1035 ipath_insert_rnr_queue(qp); 1043 ipath_insert_rnr_queue(qp);
1044 ipath_schedule_send(qp);
1036 goto bail; 1045 goto bail;
1037 1046
1038 case 3: /* NAK */ 1047 case 3: /* NAK */
@@ -1050,37 +1059,25 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
1050 * RDMA READ response which terminates the RDMA 1059 * RDMA READ response which terminates the RDMA
1051 * READ. 1060 * READ.
1052 */ 1061 */
1053 ipath_restart_rc(qp, psn, &wc); 1062 ipath_restart_rc(qp, psn);
1054 break; 1063 break;
1055 1064
1056 case 1: /* Invalid Request */ 1065 case 1: /* Invalid Request */
1057 wc.status = IB_WC_REM_INV_REQ_ERR; 1066 status = IB_WC_REM_INV_REQ_ERR;
1058 dev->n_other_naks++; 1067 dev->n_other_naks++;
1059 goto class_b; 1068 goto class_b;
1060 1069
1061 case 2: /* Remote Access Error */ 1070 case 2: /* Remote Access Error */
1062 wc.status = IB_WC_REM_ACCESS_ERR; 1071 status = IB_WC_REM_ACCESS_ERR;
1063 dev->n_other_naks++; 1072 dev->n_other_naks++;
1064 goto class_b; 1073 goto class_b;
1065 1074
1066 case 3: /* Remote Operation Error */ 1075 case 3: /* Remote Operation Error */
1067 wc.status = IB_WC_REM_OP_ERR; 1076 status = IB_WC_REM_OP_ERR;
1068 dev->n_other_naks++; 1077 dev->n_other_naks++;
1069 class_b: 1078 class_b:
1070 wc.wr_id = wqe->wr.wr_id; 1079 ipath_send_complete(qp, wqe, status);
1071 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; 1080 ipath_error_qp(qp, IB_WC_WR_FLUSH_ERR);
1072 wc.vendor_err = 0;
1073 wc.byte_len = 0;
1074 wc.qp = &qp->ibqp;
1075 wc.imm_data = 0;
1076 wc.src_qp = qp->remote_qpn;
1077 wc.wc_flags = 0;
1078 wc.pkey_index = 0;
1079 wc.slid = qp->remote_ah_attr.dlid;
1080 wc.sl = qp->remote_ah_attr.sl;
1081 wc.dlid_path_bits = 0;
1082 wc.port_num = 0;
1083 ipath_sqerror_qp(qp, &wc);
1084 break; 1081 break;
1085 1082
1086 default: 1083 default:
@@ -1126,8 +1123,8 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1126 int header_in_data) 1123 int header_in_data)
1127{ 1124{
1128 struct ipath_swqe *wqe; 1125 struct ipath_swqe *wqe;
1126 enum ib_wc_status status;
1129 unsigned long flags; 1127 unsigned long flags;
1130 struct ib_wc wc;
1131 int diff; 1128 int diff;
1132 u32 pad; 1129 u32 pad;
1133 u32 aeth; 1130 u32 aeth;
@@ -1135,6 +1132,10 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1135 1132
1136 spin_lock_irqsave(&qp->s_lock, flags); 1133 spin_lock_irqsave(&qp->s_lock, flags);
1137 1134
1135 /* Double check we can process this now that we hold the s_lock. */
1136 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK))
1137 goto ack_done;
1138
1138 /* Ignore invalid responses. */ 1139 /* Ignore invalid responses. */
1139 if (ipath_cmp24(psn, qp->s_next_psn) >= 0) 1140 if (ipath_cmp24(psn, qp->s_next_psn) >= 0)
1140 goto ack_done; 1141 goto ack_done;
@@ -1159,6 +1160,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1159 if (unlikely(qp->s_last == qp->s_tail)) 1160 if (unlikely(qp->s_last == qp->s_tail))
1160 goto ack_done; 1161 goto ack_done;
1161 wqe = get_swqe_ptr(qp, qp->s_last); 1162 wqe = get_swqe_ptr(qp, qp->s_last);
1163 status = IB_WC_SUCCESS;
1162 1164
1163 switch (opcode) { 1165 switch (opcode) {
1164 case OP(ACKNOWLEDGE): 1166 case OP(ACKNOWLEDGE):
@@ -1187,6 +1189,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1187 wqe = get_swqe_ptr(qp, qp->s_last); 1189 wqe = get_swqe_ptr(qp, qp->s_last);
1188 if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ)) 1190 if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ))
1189 goto ack_op_err; 1191 goto ack_op_err;
1192 qp->r_flags &= ~IPATH_R_RDMAR_SEQ;
1190 /* 1193 /*
1191 * If this is a response to a resent RDMA read, we 1194 * If this is a response to a resent RDMA read, we
1192 * have to be careful to copy the data to the right 1195 * have to be careful to copy the data to the right
@@ -1200,7 +1203,10 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1200 /* no AETH, no ACK */ 1203 /* no AETH, no ACK */
1201 if (unlikely(ipath_cmp24(psn, qp->s_last_psn + 1))) { 1204 if (unlikely(ipath_cmp24(psn, qp->s_last_psn + 1))) {
1202 dev->n_rdma_seq++; 1205 dev->n_rdma_seq++;
1203 ipath_restart_rc(qp, qp->s_last_psn + 1, &wc); 1206 if (qp->r_flags & IPATH_R_RDMAR_SEQ)
1207 goto ack_done;
1208 qp->r_flags |= IPATH_R_RDMAR_SEQ;
1209 ipath_restart_rc(qp, qp->s_last_psn + 1);
1204 goto ack_done; 1210 goto ack_done;
1205 } 1211 }
1206 if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ)) 1212 if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ))
@@ -1261,7 +1267,10 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1261 /* ACKs READ req. */ 1267 /* ACKs READ req. */
1262 if (unlikely(ipath_cmp24(psn, qp->s_last_psn + 1))) { 1268 if (unlikely(ipath_cmp24(psn, qp->s_last_psn + 1))) {
1263 dev->n_rdma_seq++; 1269 dev->n_rdma_seq++;
1264 ipath_restart_rc(qp, qp->s_last_psn + 1, &wc); 1270 if (qp->r_flags & IPATH_R_RDMAR_SEQ)
1271 goto ack_done;
1272 qp->r_flags |= IPATH_R_RDMAR_SEQ;
1273 ipath_restart_rc(qp, qp->s_last_psn + 1);
1265 goto ack_done; 1274 goto ack_done;
1266 } 1275 }
1267 if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ)) 1276 if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ))
@@ -1291,31 +1300,16 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1291 goto ack_done; 1300 goto ack_done;
1292 } 1301 }
1293 1302
1294ack_done:
1295 spin_unlock_irqrestore(&qp->s_lock, flags);
1296 goto bail;
1297
1298ack_op_err: 1303ack_op_err:
1299 wc.status = IB_WC_LOC_QP_OP_ERR; 1304 status = IB_WC_LOC_QP_OP_ERR;
1300 goto ack_err; 1305 goto ack_err;
1301 1306
1302ack_len_err: 1307ack_len_err:
1303 wc.status = IB_WC_LOC_LEN_ERR; 1308 status = IB_WC_LOC_LEN_ERR;
1304ack_err: 1309ack_err:
1305 wc.wr_id = wqe->wr.wr_id; 1310 ipath_send_complete(qp, wqe, status);
1306 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; 1311 ipath_error_qp(qp, IB_WC_WR_FLUSH_ERR);
1307 wc.vendor_err = 0; 1312ack_done:
1308 wc.byte_len = 0;
1309 wc.imm_data = 0;
1310 wc.qp = &qp->ibqp;
1311 wc.src_qp = qp->remote_qpn;
1312 wc.wc_flags = 0;
1313 wc.pkey_index = 0;
1314 wc.slid = qp->remote_ah_attr.dlid;
1315 wc.sl = qp->remote_ah_attr.sl;
1316 wc.dlid_path_bits = 0;
1317 wc.port_num = 0;
1318 ipath_sqerror_qp(qp, &wc);
1319 spin_unlock_irqrestore(&qp->s_lock, flags); 1313 spin_unlock_irqrestore(&qp->s_lock, flags);
1320bail: 1314bail:
1321 return; 1315 return;
@@ -1384,7 +1378,12 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1384 psn &= IPATH_PSN_MASK; 1378 psn &= IPATH_PSN_MASK;
1385 e = NULL; 1379 e = NULL;
1386 old_req = 1; 1380 old_req = 1;
1381
1387 spin_lock_irqsave(&qp->s_lock, flags); 1382 spin_lock_irqsave(&qp->s_lock, flags);
1383 /* Double check we can process this now that we hold the s_lock. */
1384 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK))
1385 goto unlock_done;
1386
1388 for (i = qp->r_head_ack_queue; ; i = prev) { 1387 for (i = qp->r_head_ack_queue; ; i = prev) {
1389 if (i == qp->s_tail_ack_queue) 1388 if (i == qp->s_tail_ack_queue)
1390 old_req = 0; 1389 old_req = 0;
@@ -1512,7 +1511,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1512 break; 1511 break;
1513 } 1512 }
1514 qp->r_nak_state = 0; 1513 qp->r_nak_state = 0;
1515 tasklet_hi_schedule(&qp->s_task); 1514 ipath_schedule_send(qp);
1516 1515
1517unlock_done: 1516unlock_done:
1518 spin_unlock_irqrestore(&qp->s_lock, flags); 1517 spin_unlock_irqrestore(&qp->s_lock, flags);
@@ -1523,13 +1522,12 @@ send_ack:
1523 return 0; 1522 return 0;
1524} 1523}
1525 1524
1526static void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err) 1525void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err)
1527{ 1526{
1528 unsigned long flags; 1527 unsigned long flags;
1529 int lastwqe; 1528 int lastwqe;
1530 1529
1531 spin_lock_irqsave(&qp->s_lock, flags); 1530 spin_lock_irqsave(&qp->s_lock, flags);
1532 qp->state = IB_QPS_ERR;
1533 lastwqe = ipath_error_qp(qp, err); 1531 lastwqe = ipath_error_qp(qp, err);
1534 spin_unlock_irqrestore(&qp->s_lock, flags); 1532 spin_unlock_irqrestore(&qp->s_lock, flags);
1535 1533
@@ -1545,18 +1543,15 @@ static void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err)
1545 1543
1546static inline void ipath_update_ack_queue(struct ipath_qp *qp, unsigned n) 1544static inline void ipath_update_ack_queue(struct ipath_qp *qp, unsigned n)
1547{ 1545{
1548 unsigned long flags;
1549 unsigned next; 1546 unsigned next;
1550 1547
1551 next = n + 1; 1548 next = n + 1;
1552 if (next > IPATH_MAX_RDMA_ATOMIC) 1549 if (next > IPATH_MAX_RDMA_ATOMIC)
1553 next = 0; 1550 next = 0;
1554 spin_lock_irqsave(&qp->s_lock, flags);
1555 if (n == qp->s_tail_ack_queue) { 1551 if (n == qp->s_tail_ack_queue) {
1556 qp->s_tail_ack_queue = next; 1552 qp->s_tail_ack_queue = next;
1557 qp->s_ack_state = OP(ACKNOWLEDGE); 1553 qp->s_ack_state = OP(ACKNOWLEDGE);
1558 } 1554 }
1559 spin_unlock_irqrestore(&qp->s_lock, flags);
1560} 1555}
1561 1556
1562/** 1557/**
@@ -1585,6 +1580,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1585 int diff; 1580 int diff;
1586 struct ib_reth *reth; 1581 struct ib_reth *reth;
1587 int header_in_data; 1582 int header_in_data;
1583 unsigned long flags;
1588 1584
1589 /* Validate the SLID. See Ch. 9.6.1.5 */ 1585 /* Validate the SLID. See Ch. 9.6.1.5 */
1590 if (unlikely(be16_to_cpu(hdr->lrh[3]) != qp->remote_ah_attr.dlid)) 1586 if (unlikely(be16_to_cpu(hdr->lrh[3]) != qp->remote_ah_attr.dlid))
@@ -1643,11 +1639,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1643 opcode == OP(SEND_LAST) || 1639 opcode == OP(SEND_LAST) ||
1644 opcode == OP(SEND_LAST_WITH_IMMEDIATE)) 1640 opcode == OP(SEND_LAST_WITH_IMMEDIATE))
1645 break; 1641 break;
1646 nack_inv: 1642 goto nack_inv;
1647 ipath_rc_error(qp, IB_WC_REM_INV_REQ_ERR);
1648 qp->r_nak_state = IB_NAK_INVALID_REQUEST;
1649 qp->r_ack_psn = qp->r_psn;
1650 goto send_ack;
1651 1643
1652 case OP(RDMA_WRITE_FIRST): 1644 case OP(RDMA_WRITE_FIRST):
1653 case OP(RDMA_WRITE_MIDDLE): 1645 case OP(RDMA_WRITE_MIDDLE):
@@ -1673,18 +1665,13 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1673 break; 1665 break;
1674 } 1666 }
1675 1667
1676 wc.imm_data = 0; 1668 memset(&wc, 0, sizeof wc);
1677 wc.wc_flags = 0;
1678 1669
1679 /* OK, process the packet. */ 1670 /* OK, process the packet. */
1680 switch (opcode) { 1671 switch (opcode) {
1681 case OP(SEND_FIRST): 1672 case OP(SEND_FIRST):
1682 if (!ipath_get_rwqe(qp, 0)) { 1673 if (!ipath_get_rwqe(qp, 0))
1683 rnr_nak: 1674 goto rnr_nak;
1684 qp->r_nak_state = IB_RNR_NAK | qp->r_min_rnr_timer;
1685 qp->r_ack_psn = qp->r_psn;
1686 goto send_ack;
1687 }
1688 qp->r_rcv_len = 0; 1675 qp->r_rcv_len = 0;
1689 /* FALLTHROUGH */ 1676 /* FALLTHROUGH */
1690 case OP(SEND_MIDDLE): 1677 case OP(SEND_MIDDLE):
@@ -1741,9 +1728,8 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1741 goto nack_inv; 1728 goto nack_inv;
1742 ipath_copy_sge(&qp->r_sge, data, tlen); 1729 ipath_copy_sge(&qp->r_sge, data, tlen);
1743 qp->r_msn++; 1730 qp->r_msn++;
1744 if (!qp->r_wrid_valid) 1731 if (!test_and_clear_bit(IPATH_R_WRID_VALID, &qp->r_aflags))
1745 break; 1732 break;
1746 qp->r_wrid_valid = 0;
1747 wc.wr_id = qp->r_wr_id; 1733 wc.wr_id = qp->r_wr_id;
1748 wc.status = IB_WC_SUCCESS; 1734 wc.status = IB_WC_SUCCESS;
1749 if (opcode == OP(RDMA_WRITE_LAST_WITH_IMMEDIATE) || 1735 if (opcode == OP(RDMA_WRITE_LAST_WITH_IMMEDIATE) ||
@@ -1751,14 +1737,10 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1751 wc.opcode = IB_WC_RECV_RDMA_WITH_IMM; 1737 wc.opcode = IB_WC_RECV_RDMA_WITH_IMM;
1752 else 1738 else
1753 wc.opcode = IB_WC_RECV; 1739 wc.opcode = IB_WC_RECV;
1754 wc.vendor_err = 0;
1755 wc.qp = &qp->ibqp; 1740 wc.qp = &qp->ibqp;
1756 wc.src_qp = qp->remote_qpn; 1741 wc.src_qp = qp->remote_qpn;
1757 wc.pkey_index = 0;
1758 wc.slid = qp->remote_ah_attr.dlid; 1742 wc.slid = qp->remote_ah_attr.dlid;
1759 wc.sl = qp->remote_ah_attr.sl; 1743 wc.sl = qp->remote_ah_attr.sl;
1760 wc.dlid_path_bits = 0;
1761 wc.port_num = 0;
1762 /* Signal completion event if the solicited bit is set. */ 1744 /* Signal completion event if the solicited bit is set. */
1763 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1745 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
1764 (ohdr->bth[0] & 1746 (ohdr->bth[0] &
@@ -1819,9 +1801,13 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1819 next = qp->r_head_ack_queue + 1; 1801 next = qp->r_head_ack_queue + 1;
1820 if (next > IPATH_MAX_RDMA_ATOMIC) 1802 if (next > IPATH_MAX_RDMA_ATOMIC)
1821 next = 0; 1803 next = 0;
1804 spin_lock_irqsave(&qp->s_lock, flags);
1805 /* Double check we can process this while holding the s_lock. */
1806 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK))
1807 goto unlock;
1822 if (unlikely(next == qp->s_tail_ack_queue)) { 1808 if (unlikely(next == qp->s_tail_ack_queue)) {
1823 if (!qp->s_ack_queue[next].sent) 1809 if (!qp->s_ack_queue[next].sent)
1824 goto nack_inv; 1810 goto nack_inv_unlck;
1825 ipath_update_ack_queue(qp, next); 1811 ipath_update_ack_queue(qp, next);
1826 } 1812 }
1827 e = &qp->s_ack_queue[qp->r_head_ack_queue]; 1813 e = &qp->s_ack_queue[qp->r_head_ack_queue];
@@ -1842,7 +1828,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1842 ok = ipath_rkey_ok(qp, &e->rdma_sge, len, vaddr, 1828 ok = ipath_rkey_ok(qp, &e->rdma_sge, len, vaddr,
1843 rkey, IB_ACCESS_REMOTE_READ); 1829 rkey, IB_ACCESS_REMOTE_READ);
1844 if (unlikely(!ok)) 1830 if (unlikely(!ok))
1845 goto nack_acc; 1831 goto nack_acc_unlck;
1846 /* 1832 /*
1847 * Update the next expected PSN. We add 1 later 1833 * Update the next expected PSN. We add 1 later
1848 * below, so only add the remainder here. 1834 * below, so only add the remainder here.
@@ -1869,13 +1855,12 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1869 qp->r_psn++; 1855 qp->r_psn++;
1870 qp->r_state = opcode; 1856 qp->r_state = opcode;
1871 qp->r_nak_state = 0; 1857 qp->r_nak_state = 0;
1872 barrier();
1873 qp->r_head_ack_queue = next; 1858 qp->r_head_ack_queue = next;
1874 1859
1875 /* Call ipath_do_rc_send() in another thread. */ 1860 /* Schedule the send tasklet. */
1876 tasklet_hi_schedule(&qp->s_task); 1861 ipath_schedule_send(qp);
1877 1862
1878 goto done; 1863 goto unlock;
1879 } 1864 }
1880 1865
1881 case OP(COMPARE_SWAP): 1866 case OP(COMPARE_SWAP):
@@ -1894,9 +1879,13 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1894 next = qp->r_head_ack_queue + 1; 1879 next = qp->r_head_ack_queue + 1;
1895 if (next > IPATH_MAX_RDMA_ATOMIC) 1880 if (next > IPATH_MAX_RDMA_ATOMIC)
1896 next = 0; 1881 next = 0;
1882 spin_lock_irqsave(&qp->s_lock, flags);
1883 /* Double check we can process this while holding the s_lock. */
1884 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK))
1885 goto unlock;
1897 if (unlikely(next == qp->s_tail_ack_queue)) { 1886 if (unlikely(next == qp->s_tail_ack_queue)) {
1898 if (!qp->s_ack_queue[next].sent) 1887 if (!qp->s_ack_queue[next].sent)
1899 goto nack_inv; 1888 goto nack_inv_unlck;
1900 ipath_update_ack_queue(qp, next); 1889 ipath_update_ack_queue(qp, next);
1901 } 1890 }
1902 if (!header_in_data) 1891 if (!header_in_data)
@@ -1906,13 +1895,13 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1906 vaddr = ((u64) be32_to_cpu(ateth->vaddr[0]) << 32) | 1895 vaddr = ((u64) be32_to_cpu(ateth->vaddr[0]) << 32) |
1907 be32_to_cpu(ateth->vaddr[1]); 1896 be32_to_cpu(ateth->vaddr[1]);
1908 if (unlikely(vaddr & (sizeof(u64) - 1))) 1897 if (unlikely(vaddr & (sizeof(u64) - 1)))
1909 goto nack_inv; 1898 goto nack_inv_unlck;
1910 rkey = be32_to_cpu(ateth->rkey); 1899 rkey = be32_to_cpu(ateth->rkey);
1911 /* Check rkey & NAK */ 1900 /* Check rkey & NAK */
1912 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, 1901 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge,
1913 sizeof(u64), vaddr, rkey, 1902 sizeof(u64), vaddr, rkey,
1914 IB_ACCESS_REMOTE_ATOMIC))) 1903 IB_ACCESS_REMOTE_ATOMIC)))
1915 goto nack_acc; 1904 goto nack_acc_unlck;
1916 /* Perform atomic OP and save result. */ 1905 /* Perform atomic OP and save result. */
1917 maddr = (atomic64_t *) qp->r_sge.sge.vaddr; 1906 maddr = (atomic64_t *) qp->r_sge.sge.vaddr;
1918 sdata = be64_to_cpu(ateth->swap_data); 1907 sdata = be64_to_cpu(ateth->swap_data);
@@ -1929,13 +1918,12 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1929 qp->r_psn++; 1918 qp->r_psn++;
1930 qp->r_state = opcode; 1919 qp->r_state = opcode;
1931 qp->r_nak_state = 0; 1920 qp->r_nak_state = 0;
1932 barrier();
1933 qp->r_head_ack_queue = next; 1921 qp->r_head_ack_queue = next;
1934 1922
1935 /* Call ipath_do_rc_send() in another thread. */ 1923 /* Schedule the send tasklet. */
1936 tasklet_hi_schedule(&qp->s_task); 1924 ipath_schedule_send(qp);
1937 1925
1938 goto done; 1926 goto unlock;
1939 } 1927 }
1940 1928
1941 default: 1929 default:
@@ -1951,14 +1939,31 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1951 goto send_ack; 1939 goto send_ack;
1952 goto done; 1940 goto done;
1953 1941
1942rnr_nak:
1943 qp->r_nak_state = IB_RNR_NAK | qp->r_min_rnr_timer;
1944 qp->r_ack_psn = qp->r_psn;
1945 goto send_ack;
1946
1947nack_inv_unlck:
1948 spin_unlock_irqrestore(&qp->s_lock, flags);
1949nack_inv:
1950 ipath_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
1951 qp->r_nak_state = IB_NAK_INVALID_REQUEST;
1952 qp->r_ack_psn = qp->r_psn;
1953 goto send_ack;
1954
1955nack_acc_unlck:
1956 spin_unlock_irqrestore(&qp->s_lock, flags);
1954nack_acc: 1957nack_acc:
1955 ipath_rc_error(qp, IB_WC_REM_ACCESS_ERR); 1958 ipath_rc_error(qp, IB_WC_LOC_PROT_ERR);
1956 qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR; 1959 qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR;
1957 qp->r_ack_psn = qp->r_psn; 1960 qp->r_ack_psn = qp->r_psn;
1958
1959send_ack: 1961send_ack:
1960 send_rc_ack(qp); 1962 send_rc_ack(qp);
1963 goto done;
1961 1964
1965unlock:
1966 spin_unlock_irqrestore(&qp->s_lock, flags);
1962done: 1967done:
1963 return; 1968 return;
1964} 1969}
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 9e3fe61cbd08..a4b5521567fe 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008 QLogic Corporation. All rights reserved.
3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
4 * 4 *
5 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -78,6 +78,7 @@ const u32 ib_ipath_rnr_table[32] = {
78 * ipath_insert_rnr_queue - put QP on the RNR timeout list for the device 78 * ipath_insert_rnr_queue - put QP on the RNR timeout list for the device
79 * @qp: the QP 79 * @qp: the QP
80 * 80 *
81 * Called with the QP s_lock held and interrupts disabled.
81 * XXX Use a simple list for now. We might need a priority 82 * XXX Use a simple list for now. We might need a priority
82 * queue if we have lots of QPs waiting for RNR timeouts 83 * queue if we have lots of QPs waiting for RNR timeouts
83 * but that should be rare. 84 * but that should be rare.
@@ -85,9 +86,9 @@ const u32 ib_ipath_rnr_table[32] = {
85void ipath_insert_rnr_queue(struct ipath_qp *qp) 86void ipath_insert_rnr_queue(struct ipath_qp *qp)
86{ 87{
87 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 88 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
88 unsigned long flags;
89 89
90 spin_lock_irqsave(&dev->pending_lock, flags); 90 /* We already did a spin_lock_irqsave(), so just use spin_lock */
91 spin_lock(&dev->pending_lock);
91 if (list_empty(&dev->rnrwait)) 92 if (list_empty(&dev->rnrwait))
92 list_add(&qp->timerwait, &dev->rnrwait); 93 list_add(&qp->timerwait, &dev->rnrwait);
93 else { 94 else {
@@ -109,7 +110,7 @@ void ipath_insert_rnr_queue(struct ipath_qp *qp)
109 nqp->s_rnr_timeout -= qp->s_rnr_timeout; 110 nqp->s_rnr_timeout -= qp->s_rnr_timeout;
110 list_add(&qp->timerwait, l); 111 list_add(&qp->timerwait, l);
111 } 112 }
112 spin_unlock_irqrestore(&dev->pending_lock, flags); 113 spin_unlock(&dev->pending_lock);
113} 114}
114 115
115/** 116/**
@@ -140,20 +141,11 @@ int ipath_init_sge(struct ipath_qp *qp, struct ipath_rwqe *wqe,
140 goto bail; 141 goto bail;
141 142
142bad_lkey: 143bad_lkey:
144 memset(&wc, 0, sizeof(wc));
143 wc.wr_id = wqe->wr_id; 145 wc.wr_id = wqe->wr_id;
144 wc.status = IB_WC_LOC_PROT_ERR; 146 wc.status = IB_WC_LOC_PROT_ERR;
145 wc.opcode = IB_WC_RECV; 147 wc.opcode = IB_WC_RECV;
146 wc.vendor_err = 0;
147 wc.byte_len = 0;
148 wc.imm_data = 0;
149 wc.qp = &qp->ibqp; 148 wc.qp = &qp->ibqp;
150 wc.src_qp = 0;
151 wc.wc_flags = 0;
152 wc.pkey_index = 0;
153 wc.slid = 0;
154 wc.sl = 0;
155 wc.dlid_path_bits = 0;
156 wc.port_num = 0;
157 /* Signal solicited completion event. */ 149 /* Signal solicited completion event. */
158 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); 150 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1);
159 ret = 0; 151 ret = 0;
@@ -194,6 +186,11 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
194 } 186 }
195 187
196 spin_lock_irqsave(&rq->lock, flags); 188 spin_lock_irqsave(&rq->lock, flags);
189 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK)) {
190 ret = 0;
191 goto unlock;
192 }
193
197 wq = rq->wq; 194 wq = rq->wq;
198 tail = wq->tail; 195 tail = wq->tail;
199 /* Validate tail before using it since it is user writable. */ 196 /* Validate tail before using it since it is user writable. */
@@ -201,9 +198,8 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
201 tail = 0; 198 tail = 0;
202 do { 199 do {
203 if (unlikely(tail == wq->head)) { 200 if (unlikely(tail == wq->head)) {
204 spin_unlock_irqrestore(&rq->lock, flags);
205 ret = 0; 201 ret = 0;
206 goto bail; 202 goto unlock;
207 } 203 }
208 /* Make sure entry is read after head index is read. */ 204 /* Make sure entry is read after head index is read. */
209 smp_rmb(); 205 smp_rmb();
@@ -216,7 +212,7 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
216 wq->tail = tail; 212 wq->tail = tail;
217 213
218 ret = 1; 214 ret = 1;
219 qp->r_wrid_valid = 1; 215 set_bit(IPATH_R_WRID_VALID, &qp->r_aflags);
220 if (handler) { 216 if (handler) {
221 u32 n; 217 u32 n;
222 218
@@ -243,8 +239,8 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
243 goto bail; 239 goto bail;
244 } 240 }
245 } 241 }
242unlock:
246 spin_unlock_irqrestore(&rq->lock, flags); 243 spin_unlock_irqrestore(&rq->lock, flags);
247
248bail: 244bail:
249 return ret; 245 return ret;
250} 246}
@@ -270,38 +266,63 @@ static void ipath_ruc_loopback(struct ipath_qp *sqp)
270 struct ib_wc wc; 266 struct ib_wc wc;
271 u64 sdata; 267 u64 sdata;
272 atomic64_t *maddr; 268 atomic64_t *maddr;
269 enum ib_wc_status send_status;
273 270
271 /*
272 * Note that we check the responder QP state after
273 * checking the requester's state.
274 */
274 qp = ipath_lookup_qpn(&dev->qp_table, sqp->remote_qpn); 275 qp = ipath_lookup_qpn(&dev->qp_table, sqp->remote_qpn);
275 if (!qp) {
276 dev->n_pkt_drops++;
277 return;
278 }
279 276
280again:
281 spin_lock_irqsave(&sqp->s_lock, flags); 277 spin_lock_irqsave(&sqp->s_lock, flags);
282 278
283 if (!(ib_ipath_state_ops[sqp->state] & IPATH_PROCESS_SEND_OK) || 279 /* Return if we are already busy processing a work request. */
284 sqp->s_rnr_timeout) { 280 if ((sqp->s_flags & (IPATH_S_BUSY | IPATH_S_ANY_WAIT)) ||
285 spin_unlock_irqrestore(&sqp->s_lock, flags); 281 !(ib_ipath_state_ops[sqp->state] & IPATH_PROCESS_OR_FLUSH_SEND))
286 goto done; 282 goto unlock;
287 }
288 283
289 /* Get the next send request. */ 284 sqp->s_flags |= IPATH_S_BUSY;
290 if (sqp->s_last == sqp->s_head) { 285
291 /* Send work queue is empty. */ 286again:
292 spin_unlock_irqrestore(&sqp->s_lock, flags); 287 if (sqp->s_last == sqp->s_head)
293 goto done; 288 goto clr_busy;
289 wqe = get_swqe_ptr(sqp, sqp->s_last);
290
291 /* Return if it is not OK to start a new work reqeust. */
292 if (!(ib_ipath_state_ops[sqp->state] & IPATH_PROCESS_NEXT_SEND_OK)) {
293 if (!(ib_ipath_state_ops[sqp->state] & IPATH_FLUSH_SEND))
294 goto clr_busy;
295 /* We are in the error state, flush the work request. */
296 send_status = IB_WC_WR_FLUSH_ERR;
297 goto flush_send;
294 } 298 }
295 299
296 /* 300 /*
297 * We can rely on the entry not changing without the s_lock 301 * We can rely on the entry not changing without the s_lock
298 * being held until we update s_last. 302 * being held until we update s_last.
303 * We increment s_cur to indicate s_last is in progress.
299 */ 304 */
300 wqe = get_swqe_ptr(sqp, sqp->s_last); 305 if (sqp->s_last == sqp->s_cur) {
306 if (++sqp->s_cur >= sqp->s_size)
307 sqp->s_cur = 0;
308 }
301 spin_unlock_irqrestore(&sqp->s_lock, flags); 309 spin_unlock_irqrestore(&sqp->s_lock, flags);
302 310
303 wc.wc_flags = 0; 311 if (!qp || !(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK)) {
304 wc.imm_data = 0; 312 dev->n_pkt_drops++;
313 /*
314 * For RC, the requester would timeout and retry so
315 * shortcut the timeouts and just signal too many retries.
316 */
317 if (sqp->ibqp.qp_type == IB_QPT_RC)
318 send_status = IB_WC_RETRY_EXC_ERR;
319 else
320 send_status = IB_WC_SUCCESS;
321 goto serr;
322 }
323
324 memset(&wc, 0, sizeof wc);
325 send_status = IB_WC_SUCCESS;
305 326
306 sqp->s_sge.sge = wqe->sg_list[0]; 327 sqp->s_sge.sge = wqe->sg_list[0];
307 sqp->s_sge.sg_list = wqe->sg_list + 1; 328 sqp->s_sge.sg_list = wqe->sg_list + 1;
@@ -313,75 +334,33 @@ again:
313 wc.imm_data = wqe->wr.ex.imm_data; 334 wc.imm_data = wqe->wr.ex.imm_data;
314 /* FALLTHROUGH */ 335 /* FALLTHROUGH */
315 case IB_WR_SEND: 336 case IB_WR_SEND:
316 if (!ipath_get_rwqe(qp, 0)) { 337 if (!ipath_get_rwqe(qp, 0))
317 rnr_nak: 338 goto rnr_nak;
318 /* Handle RNR NAK */
319 if (qp->ibqp.qp_type == IB_QPT_UC)
320 goto send_comp;
321 if (sqp->s_rnr_retry == 0) {
322 wc.status = IB_WC_RNR_RETRY_EXC_ERR;
323 goto err;
324 }
325 if (sqp->s_rnr_retry_cnt < 7)
326 sqp->s_rnr_retry--;
327 dev->n_rnr_naks++;
328 sqp->s_rnr_timeout =
329 ib_ipath_rnr_table[qp->r_min_rnr_timer];
330 ipath_insert_rnr_queue(sqp);
331 goto done;
332 }
333 break; 339 break;
334 340
335 case IB_WR_RDMA_WRITE_WITH_IMM: 341 case IB_WR_RDMA_WRITE_WITH_IMM:
336 if (unlikely(!(qp->qp_access_flags & 342 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_WRITE)))
337 IB_ACCESS_REMOTE_WRITE))) { 343 goto inv_err;
338 wc.status = IB_WC_REM_INV_REQ_ERR;
339 goto err;
340 }
341 wc.wc_flags = IB_WC_WITH_IMM; 344 wc.wc_flags = IB_WC_WITH_IMM;
342 wc.imm_data = wqe->wr.ex.imm_data; 345 wc.imm_data = wqe->wr.ex.imm_data;
343 if (!ipath_get_rwqe(qp, 1)) 346 if (!ipath_get_rwqe(qp, 1))
344 goto rnr_nak; 347 goto rnr_nak;
345 /* FALLTHROUGH */ 348 /* FALLTHROUGH */
346 case IB_WR_RDMA_WRITE: 349 case IB_WR_RDMA_WRITE:
347 if (unlikely(!(qp->qp_access_flags & 350 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_WRITE)))
348 IB_ACCESS_REMOTE_WRITE))) { 351 goto inv_err;
349 wc.status = IB_WC_REM_INV_REQ_ERR;
350 goto err;
351 }
352 if (wqe->length == 0) 352 if (wqe->length == 0)
353 break; 353 break;
354 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, wqe->length, 354 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, wqe->length,
355 wqe->wr.wr.rdma.remote_addr, 355 wqe->wr.wr.rdma.remote_addr,
356 wqe->wr.wr.rdma.rkey, 356 wqe->wr.wr.rdma.rkey,
357 IB_ACCESS_REMOTE_WRITE))) { 357 IB_ACCESS_REMOTE_WRITE)))
358 acc_err: 358 goto acc_err;
359 wc.status = IB_WC_REM_ACCESS_ERR;
360 err:
361 wc.wr_id = wqe->wr.wr_id;
362 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
363 wc.vendor_err = 0;
364 wc.byte_len = 0;
365 wc.qp = &sqp->ibqp;
366 wc.src_qp = sqp->remote_qpn;
367 wc.pkey_index = 0;
368 wc.slid = sqp->remote_ah_attr.dlid;
369 wc.sl = sqp->remote_ah_attr.sl;
370 wc.dlid_path_bits = 0;
371 wc.port_num = 0;
372 spin_lock_irqsave(&sqp->s_lock, flags);
373 ipath_sqerror_qp(sqp, &wc);
374 spin_unlock_irqrestore(&sqp->s_lock, flags);
375 goto done;
376 }
377 break; 359 break;
378 360
379 case IB_WR_RDMA_READ: 361 case IB_WR_RDMA_READ:
380 if (unlikely(!(qp->qp_access_flags & 362 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_READ)))
381 IB_ACCESS_REMOTE_READ))) { 363 goto inv_err;
382 wc.status = IB_WC_REM_INV_REQ_ERR;
383 goto err;
384 }
385 if (unlikely(!ipath_rkey_ok(qp, &sqp->s_sge, wqe->length, 364 if (unlikely(!ipath_rkey_ok(qp, &sqp->s_sge, wqe->length,
386 wqe->wr.wr.rdma.remote_addr, 365 wqe->wr.wr.rdma.remote_addr,
387 wqe->wr.wr.rdma.rkey, 366 wqe->wr.wr.rdma.rkey,
@@ -394,11 +373,8 @@ again:
394 373
395 case IB_WR_ATOMIC_CMP_AND_SWP: 374 case IB_WR_ATOMIC_CMP_AND_SWP:
396 case IB_WR_ATOMIC_FETCH_AND_ADD: 375 case IB_WR_ATOMIC_FETCH_AND_ADD:
397 if (unlikely(!(qp->qp_access_flags & 376 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC)))
398 IB_ACCESS_REMOTE_ATOMIC))) { 377 goto inv_err;
399 wc.status = IB_WC_REM_INV_REQ_ERR;
400 goto err;
401 }
402 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, sizeof(u64), 378 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, sizeof(u64),
403 wqe->wr.wr.atomic.remote_addr, 379 wqe->wr.wr.atomic.remote_addr,
404 wqe->wr.wr.atomic.rkey, 380 wqe->wr.wr.atomic.rkey,
@@ -415,7 +391,8 @@ again:
415 goto send_comp; 391 goto send_comp;
416 392
417 default: 393 default:
418 goto done; 394 send_status = IB_WC_LOC_QP_OP_ERR;
395 goto serr;
419 } 396 }
420 397
421 sge = &sqp->s_sge.sge; 398 sge = &sqp->s_sge.sge;
@@ -448,8 +425,7 @@ again:
448 sqp->s_len -= len; 425 sqp->s_len -= len;
449 } 426 }
450 427
451 if (wqe->wr.opcode == IB_WR_RDMA_WRITE || 428 if (!test_and_clear_bit(IPATH_R_WRID_VALID, &qp->r_aflags))
452 wqe->wr.opcode == IB_WR_RDMA_READ)
453 goto send_comp; 429 goto send_comp;
454 430
455 if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM) 431 if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM)
@@ -458,33 +434,89 @@ again:
458 wc.opcode = IB_WC_RECV; 434 wc.opcode = IB_WC_RECV;
459 wc.wr_id = qp->r_wr_id; 435 wc.wr_id = qp->r_wr_id;
460 wc.status = IB_WC_SUCCESS; 436 wc.status = IB_WC_SUCCESS;
461 wc.vendor_err = 0;
462 wc.byte_len = wqe->length; 437 wc.byte_len = wqe->length;
463 wc.qp = &qp->ibqp; 438 wc.qp = &qp->ibqp;
464 wc.src_qp = qp->remote_qpn; 439 wc.src_qp = qp->remote_qpn;
465 wc.pkey_index = 0;
466 wc.slid = qp->remote_ah_attr.dlid; 440 wc.slid = qp->remote_ah_attr.dlid;
467 wc.sl = qp->remote_ah_attr.sl; 441 wc.sl = qp->remote_ah_attr.sl;
468 wc.dlid_path_bits = 0;
469 wc.port_num = 1; 442 wc.port_num = 1;
470 /* Signal completion event if the solicited bit is set. */ 443 /* Signal completion event if the solicited bit is set. */
471 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 444 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
472 wqe->wr.send_flags & IB_SEND_SOLICITED); 445 wqe->wr.send_flags & IB_SEND_SOLICITED);
473 446
474send_comp: 447send_comp:
448 spin_lock_irqsave(&sqp->s_lock, flags);
449flush_send:
475 sqp->s_rnr_retry = sqp->s_rnr_retry_cnt; 450 sqp->s_rnr_retry = sqp->s_rnr_retry_cnt;
476 ipath_send_complete(sqp, wqe, IB_WC_SUCCESS); 451 ipath_send_complete(sqp, wqe, send_status);
477 goto again; 452 goto again;
478 453
454rnr_nak:
455 /* Handle RNR NAK */
456 if (qp->ibqp.qp_type == IB_QPT_UC)
457 goto send_comp;
458 /*
459 * Note: we don't need the s_lock held since the BUSY flag
460 * makes this single threaded.
461 */
462 if (sqp->s_rnr_retry == 0) {
463 send_status = IB_WC_RNR_RETRY_EXC_ERR;
464 goto serr;
465 }
466 if (sqp->s_rnr_retry_cnt < 7)
467 sqp->s_rnr_retry--;
468 spin_lock_irqsave(&sqp->s_lock, flags);
469 if (!(ib_ipath_state_ops[sqp->state] & IPATH_PROCESS_RECV_OK))
470 goto clr_busy;
471 sqp->s_flags |= IPATH_S_WAITING;
472 dev->n_rnr_naks++;
473 sqp->s_rnr_timeout = ib_ipath_rnr_table[qp->r_min_rnr_timer];
474 ipath_insert_rnr_queue(sqp);
475 goto clr_busy;
476
477inv_err:
478 send_status = IB_WC_REM_INV_REQ_ERR;
479 wc.status = IB_WC_LOC_QP_OP_ERR;
480 goto err;
481
482acc_err:
483 send_status = IB_WC_REM_ACCESS_ERR;
484 wc.status = IB_WC_LOC_PROT_ERR;
485err:
486 /* responder goes to error state */
487 ipath_rc_error(qp, wc.status);
488
489serr:
490 spin_lock_irqsave(&sqp->s_lock, flags);
491 ipath_send_complete(sqp, wqe, send_status);
492 if (sqp->ibqp.qp_type == IB_QPT_RC) {
493 int lastwqe = ipath_error_qp(sqp, IB_WC_WR_FLUSH_ERR);
494
495 sqp->s_flags &= ~IPATH_S_BUSY;
496 spin_unlock_irqrestore(&sqp->s_lock, flags);
497 if (lastwqe) {
498 struct ib_event ev;
499
500 ev.device = sqp->ibqp.device;
501 ev.element.qp = &sqp->ibqp;
502 ev.event = IB_EVENT_QP_LAST_WQE_REACHED;
503 sqp->ibqp.event_handler(&ev, sqp->ibqp.qp_context);
504 }
505 goto done;
506 }
507clr_busy:
508 sqp->s_flags &= ~IPATH_S_BUSY;
509unlock:
510 spin_unlock_irqrestore(&sqp->s_lock, flags);
479done: 511done:
480 if (atomic_dec_and_test(&qp->refcount)) 512 if (qp && atomic_dec_and_test(&qp->refcount))
481 wake_up(&qp->wait); 513 wake_up(&qp->wait);
482} 514}
483 515
484static void want_buffer(struct ipath_devdata *dd, struct ipath_qp *qp) 516static void want_buffer(struct ipath_devdata *dd, struct ipath_qp *qp)
485{ 517{
486 if (!(dd->ipath_flags & IPATH_HAS_SEND_DMA) || 518 if (!(dd->ipath_flags & IPATH_HAS_SEND_DMA) ||
487 qp->ibqp.qp_type == IB_QPT_SMI) { 519 qp->ibqp.qp_type == IB_QPT_SMI) {
488 unsigned long flags; 520 unsigned long flags;
489 521
490 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); 522 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags);
@@ -502,26 +534,36 @@ static void want_buffer(struct ipath_devdata *dd, struct ipath_qp *qp)
502 * @dev: the device we ran out of buffers on 534 * @dev: the device we ran out of buffers on
503 * 535 *
504 * Called when we run out of PIO buffers. 536 * Called when we run out of PIO buffers.
537 * If we are now in the error state, return zero to flush the
538 * send work request.
505 */ 539 */
506static void ipath_no_bufs_available(struct ipath_qp *qp, 540static int ipath_no_bufs_available(struct ipath_qp *qp,
507 struct ipath_ibdev *dev) 541 struct ipath_ibdev *dev)
508{ 542{
509 unsigned long flags; 543 unsigned long flags;
544 int ret = 1;
510 545
511 /* 546 /*
512 * Note that as soon as want_buffer() is called and 547 * Note that as soon as want_buffer() is called and
513 * possibly before it returns, ipath_ib_piobufavail() 548 * possibly before it returns, ipath_ib_piobufavail()
514 * could be called. If we are still in the tasklet function, 549 * could be called. Therefore, put QP on the piowait list before
515 * tasklet_hi_schedule() will not call us until the next time 550 * enabling the PIO avail interrupt.
516 * tasklet_hi_schedule() is called.
517 * We leave the busy flag set so that another post send doesn't
518 * try to put the same QP on the piowait list again.
519 */ 551 */
520 spin_lock_irqsave(&dev->pending_lock, flags); 552 spin_lock_irqsave(&qp->s_lock, flags);
521 list_add_tail(&qp->piowait, &dev->piowait); 553 if (ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK) {
522 spin_unlock_irqrestore(&dev->pending_lock, flags); 554 dev->n_piowait++;
523 want_buffer(dev->dd, qp); 555 qp->s_flags |= IPATH_S_WAITING;
524 dev->n_piowait++; 556 qp->s_flags &= ~IPATH_S_BUSY;
557 spin_lock(&dev->pending_lock);
558 if (list_empty(&qp->piowait))
559 list_add_tail(&qp->piowait, &dev->piowait);
560 spin_unlock(&dev->pending_lock);
561 } else
562 ret = 0;
563 spin_unlock_irqrestore(&qp->s_lock, flags);
564 if (ret)
565 want_buffer(dev->dd, qp);
566 return ret;
525} 567}
526 568
527/** 569/**
@@ -597,15 +639,13 @@ void ipath_do_send(unsigned long data)
597 struct ipath_qp *qp = (struct ipath_qp *)data; 639 struct ipath_qp *qp = (struct ipath_qp *)data;
598 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 640 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
599 int (*make_req)(struct ipath_qp *qp); 641 int (*make_req)(struct ipath_qp *qp);
600 642 unsigned long flags;
601 if (test_and_set_bit(IPATH_S_BUSY, &qp->s_busy))
602 goto bail;
603 643
604 if ((qp->ibqp.qp_type == IB_QPT_RC || 644 if ((qp->ibqp.qp_type == IB_QPT_RC ||
605 qp->ibqp.qp_type == IB_QPT_UC) && 645 qp->ibqp.qp_type == IB_QPT_UC) &&
606 qp->remote_ah_attr.dlid == dev->dd->ipath_lid) { 646 qp->remote_ah_attr.dlid == dev->dd->ipath_lid) {
607 ipath_ruc_loopback(qp); 647 ipath_ruc_loopback(qp);
608 goto clear; 648 goto bail;
609 } 649 }
610 650
611 if (qp->ibqp.qp_type == IB_QPT_RC) 651 if (qp->ibqp.qp_type == IB_QPT_RC)
@@ -615,6 +655,19 @@ void ipath_do_send(unsigned long data)
615 else 655 else
616 make_req = ipath_make_ud_req; 656 make_req = ipath_make_ud_req;
617 657
658 spin_lock_irqsave(&qp->s_lock, flags);
659
660 /* Return if we are already busy processing a work request. */
661 if ((qp->s_flags & (IPATH_S_BUSY | IPATH_S_ANY_WAIT)) ||
662 !(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_OR_FLUSH_SEND)) {
663 spin_unlock_irqrestore(&qp->s_lock, flags);
664 goto bail;
665 }
666
667 qp->s_flags |= IPATH_S_BUSY;
668
669 spin_unlock_irqrestore(&qp->s_lock, flags);
670
618again: 671again:
619 /* Check for a constructed packet to be sent. */ 672 /* Check for a constructed packet to be sent. */
620 if (qp->s_hdrwords != 0) { 673 if (qp->s_hdrwords != 0) {
@@ -624,8 +677,8 @@ again:
624 */ 677 */
625 if (ipath_verbs_send(qp, &qp->s_hdr, qp->s_hdrwords, 678 if (ipath_verbs_send(qp, &qp->s_hdr, qp->s_hdrwords,
626 qp->s_cur_sge, qp->s_cur_size)) { 679 qp->s_cur_sge, qp->s_cur_size)) {
627 ipath_no_bufs_available(qp, dev); 680 if (ipath_no_bufs_available(qp, dev))
628 goto bail; 681 goto bail;
629 } 682 }
630 dev->n_unicast_xmit++; 683 dev->n_unicast_xmit++;
631 /* Record that we sent the packet and s_hdr is empty. */ 684 /* Record that we sent the packet and s_hdr is empty. */
@@ -634,16 +687,20 @@ again:
634 687
635 if (make_req(qp)) 688 if (make_req(qp))
636 goto again; 689 goto again;
637clear: 690
638 clear_bit(IPATH_S_BUSY, &qp->s_busy);
639bail:; 691bail:;
640} 692}
641 693
694/*
695 * This should be called with s_lock held.
696 */
642void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe, 697void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,
643 enum ib_wc_status status) 698 enum ib_wc_status status)
644{ 699{
645 unsigned long flags; 700 u32 old_last, last;
646 u32 last; 701
702 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_OR_FLUSH_SEND))
703 return;
647 704
648 /* See ch. 11.2.4.1 and 10.7.3.1 */ 705 /* See ch. 11.2.4.1 and 10.7.3.1 */
649 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) || 706 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) ||
@@ -651,27 +708,25 @@ void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,
651 status != IB_WC_SUCCESS) { 708 status != IB_WC_SUCCESS) {
652 struct ib_wc wc; 709 struct ib_wc wc;
653 710
711 memset(&wc, 0, sizeof wc);
654 wc.wr_id = wqe->wr.wr_id; 712 wc.wr_id = wqe->wr.wr_id;
655 wc.status = status; 713 wc.status = status;
656 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; 714 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
657 wc.vendor_err = 0;
658 wc.byte_len = wqe->length;
659 wc.imm_data = 0;
660 wc.qp = &qp->ibqp; 715 wc.qp = &qp->ibqp;
661 wc.src_qp = 0; 716 if (status == IB_WC_SUCCESS)
662 wc.wc_flags = 0; 717 wc.byte_len = wqe->length;
663 wc.pkey_index = 0; 718 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc,
664 wc.slid = 0; 719 status != IB_WC_SUCCESS);
665 wc.sl = 0;
666 wc.dlid_path_bits = 0;
667 wc.port_num = 0;
668 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0);
669 } 720 }
670 721
671 spin_lock_irqsave(&qp->s_lock, flags); 722 old_last = last = qp->s_last;
672 last = qp->s_last;
673 if (++last >= qp->s_size) 723 if (++last >= qp->s_size)
674 last = 0; 724 last = 0;
675 qp->s_last = last; 725 qp->s_last = last;
676 spin_unlock_irqrestore(&qp->s_lock, flags); 726 if (qp->s_cur == old_last)
727 qp->s_cur = last;
728 if (qp->s_tail == old_last)
729 qp->s_tail = last;
730 if (qp->state == IB_QPS_SQD && last == qp->s_cur)
731 qp->s_draining = 0;
677} 732}
diff --git a/drivers/infiniband/hw/ipath/ipath_sdma.c b/drivers/infiniband/hw/ipath/ipath_sdma.c
index 3697449c1ba4..eaba03273e4f 100644
--- a/drivers/infiniband/hw/ipath/ipath_sdma.c
+++ b/drivers/infiniband/hw/ipath/ipath_sdma.c
@@ -263,14 +263,10 @@ static void sdma_abort_task(unsigned long opaque)
263 hwstatus = ipath_read_kreg64(dd, 263 hwstatus = ipath_read_kreg64(dd,
264 dd->ipath_kregs->kr_senddmastatus); 264 dd->ipath_kregs->kr_senddmastatus);
265 265
266 if (/* ScoreBoardDrainInProg */ 266 if ((hwstatus & (IPATH_SDMA_STATUS_SCORE_BOARD_DRAIN_IN_PROG |
267 test_bit(63, &hwstatus) || 267 IPATH_SDMA_STATUS_ABORT_IN_PROG |
268 /* AbortInProg */ 268 IPATH_SDMA_STATUS_INTERNAL_SDMA_ENABLE)) ||
269 test_bit(62, &hwstatus) || 269 !(hwstatus & IPATH_SDMA_STATUS_SCB_EMPTY)) {
270 /* InternalSDmaEnable */
271 test_bit(61, &hwstatus) ||
272 /* ScbEmpty */
273 !test_bit(30, &hwstatus)) {
274 if (dd->ipath_sdma_reset_wait > 0) { 270 if (dd->ipath_sdma_reset_wait > 0) {
275 /* not done shutting down sdma */ 271 /* not done shutting down sdma */
276 --dd->ipath_sdma_reset_wait; 272 --dd->ipath_sdma_reset_wait;
@@ -345,7 +341,7 @@ resched:
345 * state change 341 * state change
346 */ 342 */
347 if (jiffies > dd->ipath_sdma_abort_jiffies) { 343 if (jiffies > dd->ipath_sdma_abort_jiffies) {
348 ipath_dbg("looping with status 0x%016llx\n", 344 ipath_dbg("looping with status 0x%08lx\n",
349 dd->ipath_sdma_status); 345 dd->ipath_sdma_status);
350 dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ; 346 dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ;
351 } 347 }
@@ -615,7 +611,7 @@ void ipath_restart_sdma(struct ipath_devdata *dd)
615 } 611 }
616 spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); 612 spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags);
617 if (!needed) { 613 if (!needed) {
618 ipath_dbg("invalid attempt to restart SDMA, status 0x%016llx\n", 614 ipath_dbg("invalid attempt to restart SDMA, status 0x%08lx\n",
619 dd->ipath_sdma_status); 615 dd->ipath_sdma_status);
620 goto bail; 616 goto bail;
621 } 617 }
diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c
index bfe8926b5514..0596ec16fcbd 100644
--- a/drivers/infiniband/hw/ipath/ipath_uc.c
+++ b/drivers/infiniband/hw/ipath/ipath_uc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008 QLogic Corporation. All rights reserved.
3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
4 * 4 *
5 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -47,14 +47,30 @@ int ipath_make_uc_req(struct ipath_qp *qp)
47{ 47{
48 struct ipath_other_headers *ohdr; 48 struct ipath_other_headers *ohdr;
49 struct ipath_swqe *wqe; 49 struct ipath_swqe *wqe;
50 unsigned long flags;
50 u32 hwords; 51 u32 hwords;
51 u32 bth0; 52 u32 bth0;
52 u32 len; 53 u32 len;
53 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); 54 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu);
54 int ret = 0; 55 int ret = 0;
55 56
56 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)) 57 spin_lock_irqsave(&qp->s_lock, flags);
58
59 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)) {
60 if (!(ib_ipath_state_ops[qp->state] & IPATH_FLUSH_SEND))
61 goto bail;
62 /* We are in the error state, flush the work request. */
63 if (qp->s_last == qp->s_head)
64 goto bail;
65 /* If DMAs are in progress, we can't flush immediately. */
66 if (atomic_read(&qp->s_dma_busy)) {
67 qp->s_flags |= IPATH_S_WAIT_DMA;
68 goto bail;
69 }
70 wqe = get_swqe_ptr(qp, qp->s_last);
71 ipath_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR);
57 goto done; 72 goto done;
73 }
58 74
59 ohdr = &qp->s_hdr.u.oth; 75 ohdr = &qp->s_hdr.u.oth;
60 if (qp->remote_ah_attr.ah_flags & IB_AH_GRH) 76 if (qp->remote_ah_attr.ah_flags & IB_AH_GRH)
@@ -69,9 +85,12 @@ int ipath_make_uc_req(struct ipath_qp *qp)
69 qp->s_wqe = NULL; 85 qp->s_wqe = NULL;
70 switch (qp->s_state) { 86 switch (qp->s_state) {
71 default: 87 default:
88 if (!(ib_ipath_state_ops[qp->state] &
89 IPATH_PROCESS_NEXT_SEND_OK))
90 goto bail;
72 /* Check if send work queue is empty. */ 91 /* Check if send work queue is empty. */
73 if (qp->s_cur == qp->s_head) 92 if (qp->s_cur == qp->s_head)
74 goto done; 93 goto bail;
75 /* 94 /*
76 * Start a new request. 95 * Start a new request.
77 */ 96 */
@@ -134,7 +153,7 @@ int ipath_make_uc_req(struct ipath_qp *qp)
134 break; 153 break;
135 154
136 default: 155 default:
137 goto done; 156 goto bail;
138 } 157 }
139 break; 158 break;
140 159
@@ -194,9 +213,14 @@ int ipath_make_uc_req(struct ipath_qp *qp)
194 ipath_make_ruc_header(to_idev(qp->ibqp.device), 213 ipath_make_ruc_header(to_idev(qp->ibqp.device),
195 qp, ohdr, bth0 | (qp->s_state << 24), 214 qp, ohdr, bth0 | (qp->s_state << 24),
196 qp->s_next_psn++ & IPATH_PSN_MASK); 215 qp->s_next_psn++ & IPATH_PSN_MASK);
216done:
197 ret = 1; 217 ret = 1;
218 goto unlock;
198 219
199done: 220bail:
221 qp->s_flags &= ~IPATH_S_BUSY;
222unlock:
223 spin_unlock_irqrestore(&qp->s_lock, flags);
200 return ret; 224 return ret;
201} 225}
202 226
@@ -258,8 +282,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
258 */ 282 */
259 opcode = be32_to_cpu(ohdr->bth[0]) >> 24; 283 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
260 284
261 wc.imm_data = 0; 285 memset(&wc, 0, sizeof wc);
262 wc.wc_flags = 0;
263 286
264 /* Compare the PSN verses the expected PSN. */ 287 /* Compare the PSN verses the expected PSN. */
265 if (unlikely(ipath_cmp24(psn, qp->r_psn) != 0)) { 288 if (unlikely(ipath_cmp24(psn, qp->r_psn) != 0)) {
@@ -322,8 +345,8 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
322 case OP(SEND_ONLY): 345 case OP(SEND_ONLY):
323 case OP(SEND_ONLY_WITH_IMMEDIATE): 346 case OP(SEND_ONLY_WITH_IMMEDIATE):
324 send_first: 347 send_first:
325 if (qp->r_reuse_sge) { 348 if (qp->r_flags & IPATH_R_REUSE_SGE) {
326 qp->r_reuse_sge = 0; 349 qp->r_flags &= ~IPATH_R_REUSE_SGE;
327 qp->r_sge = qp->s_rdma_read_sge; 350 qp->r_sge = qp->s_rdma_read_sge;
328 } else if (!ipath_get_rwqe(qp, 0)) { 351 } else if (!ipath_get_rwqe(qp, 0)) {
329 dev->n_pkt_drops++; 352 dev->n_pkt_drops++;
@@ -340,13 +363,13 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
340 case OP(SEND_MIDDLE): 363 case OP(SEND_MIDDLE):
341 /* Check for invalid length PMTU or posted rwqe len. */ 364 /* Check for invalid length PMTU or posted rwqe len. */
342 if (unlikely(tlen != (hdrsize + pmtu + 4))) { 365 if (unlikely(tlen != (hdrsize + pmtu + 4))) {
343 qp->r_reuse_sge = 1; 366 qp->r_flags |= IPATH_R_REUSE_SGE;
344 dev->n_pkt_drops++; 367 dev->n_pkt_drops++;
345 goto done; 368 goto done;
346 } 369 }
347 qp->r_rcv_len += pmtu; 370 qp->r_rcv_len += pmtu;
348 if (unlikely(qp->r_rcv_len > qp->r_len)) { 371 if (unlikely(qp->r_rcv_len > qp->r_len)) {
349 qp->r_reuse_sge = 1; 372 qp->r_flags |= IPATH_R_REUSE_SGE;
350 dev->n_pkt_drops++; 373 dev->n_pkt_drops++;
351 goto done; 374 goto done;
352 } 375 }
@@ -372,7 +395,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
372 /* Check for invalid length. */ 395 /* Check for invalid length. */
373 /* XXX LAST len should be >= 1 */ 396 /* XXX LAST len should be >= 1 */
374 if (unlikely(tlen < (hdrsize + pad + 4))) { 397 if (unlikely(tlen < (hdrsize + pad + 4))) {
375 qp->r_reuse_sge = 1; 398 qp->r_flags |= IPATH_R_REUSE_SGE;
376 dev->n_pkt_drops++; 399 dev->n_pkt_drops++;
377 goto done; 400 goto done;
378 } 401 }
@@ -380,24 +403,19 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
380 tlen -= (hdrsize + pad + 4); 403 tlen -= (hdrsize + pad + 4);
381 wc.byte_len = tlen + qp->r_rcv_len; 404 wc.byte_len = tlen + qp->r_rcv_len;
382 if (unlikely(wc.byte_len > qp->r_len)) { 405 if (unlikely(wc.byte_len > qp->r_len)) {
383 qp->r_reuse_sge = 1; 406 qp->r_flags |= IPATH_R_REUSE_SGE;
384 dev->n_pkt_drops++; 407 dev->n_pkt_drops++;
385 goto done; 408 goto done;
386 } 409 }
387 /* XXX Need to free SGEs */ 410 wc.opcode = IB_WC_RECV;
388 last_imm: 411 last_imm:
389 ipath_copy_sge(&qp->r_sge, data, tlen); 412 ipath_copy_sge(&qp->r_sge, data, tlen);
390 wc.wr_id = qp->r_wr_id; 413 wc.wr_id = qp->r_wr_id;
391 wc.status = IB_WC_SUCCESS; 414 wc.status = IB_WC_SUCCESS;
392 wc.opcode = IB_WC_RECV;
393 wc.vendor_err = 0;
394 wc.qp = &qp->ibqp; 415 wc.qp = &qp->ibqp;
395 wc.src_qp = qp->remote_qpn; 416 wc.src_qp = qp->remote_qpn;
396 wc.pkey_index = 0;
397 wc.slid = qp->remote_ah_attr.dlid; 417 wc.slid = qp->remote_ah_attr.dlid;
398 wc.sl = qp->remote_ah_attr.sl; 418 wc.sl = qp->remote_ah_attr.sl;
399 wc.dlid_path_bits = 0;
400 wc.port_num = 0;
401 /* Signal completion event if the solicited bit is set. */ 419 /* Signal completion event if the solicited bit is set. */
402 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 420 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
403 (ohdr->bth[0] & 421 (ohdr->bth[0] &
@@ -488,13 +506,14 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
488 dev->n_pkt_drops++; 506 dev->n_pkt_drops++;
489 goto done; 507 goto done;
490 } 508 }
491 if (qp->r_reuse_sge) 509 if (qp->r_flags & IPATH_R_REUSE_SGE)
492 qp->r_reuse_sge = 0; 510 qp->r_flags &= ~IPATH_R_REUSE_SGE;
493 else if (!ipath_get_rwqe(qp, 1)) { 511 else if (!ipath_get_rwqe(qp, 1)) {
494 dev->n_pkt_drops++; 512 dev->n_pkt_drops++;
495 goto done; 513 goto done;
496 } 514 }
497 wc.byte_len = qp->r_len; 515 wc.byte_len = qp->r_len;
516 wc.opcode = IB_WC_RECV_RDMA_WITH_IMM;
498 goto last_imm; 517 goto last_imm;
499 518
500 case OP(RDMA_WRITE_LAST): 519 case OP(RDMA_WRITE_LAST):
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 8b6a261c89e3..77ca8ca74e78 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -65,9 +65,9 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
65 u32 length; 65 u32 length;
66 66
67 qp = ipath_lookup_qpn(&dev->qp_table, swqe->wr.wr.ud.remote_qpn); 67 qp = ipath_lookup_qpn(&dev->qp_table, swqe->wr.wr.ud.remote_qpn);
68 if (!qp) { 68 if (!qp || !(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK)) {
69 dev->n_pkt_drops++; 69 dev->n_pkt_drops++;
70 goto send_comp; 70 goto done;
71 } 71 }
72 72
73 rsge.sg_list = NULL; 73 rsge.sg_list = NULL;
@@ -91,14 +91,12 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
91 * present on the wire. 91 * present on the wire.
92 */ 92 */
93 length = swqe->length; 93 length = swqe->length;
94 memset(&wc, 0, sizeof wc);
94 wc.byte_len = length + sizeof(struct ib_grh); 95 wc.byte_len = length + sizeof(struct ib_grh);
95 96
96 if (swqe->wr.opcode == IB_WR_SEND_WITH_IMM) { 97 if (swqe->wr.opcode == IB_WR_SEND_WITH_IMM) {
97 wc.wc_flags = IB_WC_WITH_IMM; 98 wc.wc_flags = IB_WC_WITH_IMM;
98 wc.imm_data = swqe->wr.ex.imm_data; 99 wc.imm_data = swqe->wr.ex.imm_data;
99 } else {
100 wc.wc_flags = 0;
101 wc.imm_data = 0;
102 } 100 }
103 101
104 /* 102 /*
@@ -229,7 +227,6 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
229 } 227 }
230 wc.status = IB_WC_SUCCESS; 228 wc.status = IB_WC_SUCCESS;
231 wc.opcode = IB_WC_RECV; 229 wc.opcode = IB_WC_RECV;
232 wc.vendor_err = 0;
233 wc.qp = &qp->ibqp; 230 wc.qp = &qp->ibqp;
234 wc.src_qp = sqp->ibqp.qp_num; 231 wc.src_qp = sqp->ibqp.qp_num;
235 /* XXX do we know which pkey matched? Only needed for GSI. */ 232 /* XXX do we know which pkey matched? Only needed for GSI. */
@@ -248,8 +245,7 @@ drop:
248 kfree(rsge.sg_list); 245 kfree(rsge.sg_list);
249 if (atomic_dec_and_test(&qp->refcount)) 246 if (atomic_dec_and_test(&qp->refcount))
250 wake_up(&qp->wait); 247 wake_up(&qp->wait);
251send_comp: 248done:;
252 ipath_send_complete(sqp, swqe, IB_WC_SUCCESS);
253} 249}
254 250
255/** 251/**
@@ -264,6 +260,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
264 struct ipath_other_headers *ohdr; 260 struct ipath_other_headers *ohdr;
265 struct ib_ah_attr *ah_attr; 261 struct ib_ah_attr *ah_attr;
266 struct ipath_swqe *wqe; 262 struct ipath_swqe *wqe;
263 unsigned long flags;
267 u32 nwords; 264 u32 nwords;
268 u32 extra_bytes; 265 u32 extra_bytes;
269 u32 bth0; 266 u32 bth0;
@@ -271,13 +268,30 @@ int ipath_make_ud_req(struct ipath_qp *qp)
271 u16 lid; 268 u16 lid;
272 int ret = 0; 269 int ret = 0;
273 270
274 if (unlikely(!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK))) 271 spin_lock_irqsave(&qp->s_lock, flags);
275 goto bail; 272
273 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_NEXT_SEND_OK)) {
274 if (!(ib_ipath_state_ops[qp->state] & IPATH_FLUSH_SEND))
275 goto bail;
276 /* We are in the error state, flush the work request. */
277 if (qp->s_last == qp->s_head)
278 goto bail;
279 /* If DMAs are in progress, we can't flush immediately. */
280 if (atomic_read(&qp->s_dma_busy)) {
281 qp->s_flags |= IPATH_S_WAIT_DMA;
282 goto bail;
283 }
284 wqe = get_swqe_ptr(qp, qp->s_last);
285 ipath_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR);
286 goto done;
287 }
276 288
277 if (qp->s_cur == qp->s_head) 289 if (qp->s_cur == qp->s_head)
278 goto bail; 290 goto bail;
279 291
280 wqe = get_swqe_ptr(qp, qp->s_cur); 292 wqe = get_swqe_ptr(qp, qp->s_cur);
293 if (++qp->s_cur >= qp->s_size)
294 qp->s_cur = 0;
281 295
282 /* Construct the header. */ 296 /* Construct the header. */
283 ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr; 297 ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr;
@@ -288,10 +302,23 @@ int ipath_make_ud_req(struct ipath_qp *qp)
288 dev->n_unicast_xmit++; 302 dev->n_unicast_xmit++;
289 } else { 303 } else {
290 dev->n_unicast_xmit++; 304 dev->n_unicast_xmit++;
291 lid = ah_attr->dlid & 305 lid = ah_attr->dlid & ~((1 << dev->dd->ipath_lmc) - 1);
292 ~((1 << dev->dd->ipath_lmc) - 1);
293 if (unlikely(lid == dev->dd->ipath_lid)) { 306 if (unlikely(lid == dev->dd->ipath_lid)) {
307 /*
308 * If DMAs are in progress, we can't generate
309 * a completion for the loopback packet since
310 * it would be out of order.
311 * XXX Instead of waiting, we could queue a
312 * zero length descriptor so we get a callback.
313 */
314 if (atomic_read(&qp->s_dma_busy)) {
315 qp->s_flags |= IPATH_S_WAIT_DMA;
316 goto bail;
317 }
318 spin_unlock_irqrestore(&qp->s_lock, flags);
294 ipath_ud_loopback(qp, wqe); 319 ipath_ud_loopback(qp, wqe);
320 spin_lock_irqsave(&qp->s_lock, flags);
321 ipath_send_complete(qp, wqe, IB_WC_SUCCESS);
295 goto done; 322 goto done;
296 } 323 }
297 } 324 }
@@ -368,11 +395,13 @@ int ipath_make_ud_req(struct ipath_qp *qp)
368 ohdr->u.ud.deth[1] = cpu_to_be32(qp->ibqp.qp_num); 395 ohdr->u.ud.deth[1] = cpu_to_be32(qp->ibqp.qp_num);
369 396
370done: 397done:
371 if (++qp->s_cur >= qp->s_size)
372 qp->s_cur = 0;
373 ret = 1; 398 ret = 1;
399 goto unlock;
374 400
375bail: 401bail:
402 qp->s_flags &= ~IPATH_S_BUSY;
403unlock:
404 spin_unlock_irqrestore(&qp->s_lock, flags);
376 return ret; 405 return ret;
377} 406}
378 407
@@ -506,8 +535,8 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
506 /* 535 /*
507 * Get the next work request entry to find where to put the data. 536 * Get the next work request entry to find where to put the data.
508 */ 537 */
509 if (qp->r_reuse_sge) 538 if (qp->r_flags & IPATH_R_REUSE_SGE)
510 qp->r_reuse_sge = 0; 539 qp->r_flags &= ~IPATH_R_REUSE_SGE;
511 else if (!ipath_get_rwqe(qp, 0)) { 540 else if (!ipath_get_rwqe(qp, 0)) {
512 /* 541 /*
513 * Count VL15 packets dropped due to no receive buffer. 542 * Count VL15 packets dropped due to no receive buffer.
@@ -523,7 +552,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
523 } 552 }
524 /* Silently drop packets which are too big. */ 553 /* Silently drop packets which are too big. */
525 if (wc.byte_len > qp->r_len) { 554 if (wc.byte_len > qp->r_len) {
526 qp->r_reuse_sge = 1; 555 qp->r_flags |= IPATH_R_REUSE_SGE;
527 dev->n_pkt_drops++; 556 dev->n_pkt_drops++;
528 goto bail; 557 goto bail;
529 } 558 }
@@ -535,7 +564,8 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
535 ipath_skip_sge(&qp->r_sge, sizeof(struct ib_grh)); 564 ipath_skip_sge(&qp->r_sge, sizeof(struct ib_grh));
536 ipath_copy_sge(&qp->r_sge, data, 565 ipath_copy_sge(&qp->r_sge, data,
537 wc.byte_len - sizeof(struct ib_grh)); 566 wc.byte_len - sizeof(struct ib_grh));
538 qp->r_wrid_valid = 0; 567 if (!test_and_clear_bit(IPATH_R_WRID_VALID, &qp->r_aflags))
568 goto bail;
539 wc.wr_id = qp->r_wr_id; 569 wc.wr_id = qp->r_wr_id;
540 wc.status = IB_WC_SUCCESS; 570 wc.status = IB_WC_SUCCESS;
541 wc.opcode = IB_WC_RECV; 571 wc.opcode = IB_WC_RECV;
diff --git a/drivers/infiniband/hw/ipath/ipath_user_sdma.h b/drivers/infiniband/hw/ipath/ipath_user_sdma.h
index e70946c1428c..fc76316c4a58 100644
--- a/drivers/infiniband/hw/ipath/ipath_user_sdma.h
+++ b/drivers/infiniband/hw/ipath/ipath_user_sdma.h
@@ -45,8 +45,6 @@ int ipath_user_sdma_writev(struct ipath_devdata *dd,
45int ipath_user_sdma_make_progress(struct ipath_devdata *dd, 45int ipath_user_sdma_make_progress(struct ipath_devdata *dd,
46 struct ipath_user_sdma_queue *pq); 46 struct ipath_user_sdma_queue *pq);
47 47
48int ipath_user_sdma_pkt_sent(const struct ipath_user_sdma_queue *pq,
49 u32 counter);
50void ipath_user_sdma_queue_drain(struct ipath_devdata *dd, 48void ipath_user_sdma_queue_drain(struct ipath_devdata *dd,
51 struct ipath_user_sdma_queue *pq); 49 struct ipath_user_sdma_queue *pq);
52 50
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 5015cd2e57bd..7779165b2c2c 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -111,16 +111,24 @@ static unsigned int ib_ipath_disable_sma;
111module_param_named(disable_sma, ib_ipath_disable_sma, uint, S_IWUSR | S_IRUGO); 111module_param_named(disable_sma, ib_ipath_disable_sma, uint, S_IWUSR | S_IRUGO);
112MODULE_PARM_DESC(disable_sma, "Disable the SMA"); 112MODULE_PARM_DESC(disable_sma, "Disable the SMA");
113 113
114/*
115 * Note that it is OK to post send work requests in the SQE and ERR
116 * states; ipath_do_send() will process them and generate error
117 * completions as per IB 1.2 C10-96.
118 */
114const int ib_ipath_state_ops[IB_QPS_ERR + 1] = { 119const int ib_ipath_state_ops[IB_QPS_ERR + 1] = {
115 [IB_QPS_RESET] = 0, 120 [IB_QPS_RESET] = 0,
116 [IB_QPS_INIT] = IPATH_POST_RECV_OK, 121 [IB_QPS_INIT] = IPATH_POST_RECV_OK,
117 [IB_QPS_RTR] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK, 122 [IB_QPS_RTR] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK,
118 [IB_QPS_RTS] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK | 123 [IB_QPS_RTS] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK |
119 IPATH_POST_SEND_OK | IPATH_PROCESS_SEND_OK, 124 IPATH_POST_SEND_OK | IPATH_PROCESS_SEND_OK |
125 IPATH_PROCESS_NEXT_SEND_OK,
120 [IB_QPS_SQD] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK | 126 [IB_QPS_SQD] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK |
121 IPATH_POST_SEND_OK, 127 IPATH_POST_SEND_OK | IPATH_PROCESS_SEND_OK,
122 [IB_QPS_SQE] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK, 128 [IB_QPS_SQE] = IPATH_POST_RECV_OK | IPATH_PROCESS_RECV_OK |
123 [IB_QPS_ERR] = 0, 129 IPATH_POST_SEND_OK | IPATH_FLUSH_SEND,
130 [IB_QPS_ERR] = IPATH_POST_RECV_OK | IPATH_FLUSH_RECV |
131 IPATH_POST_SEND_OK | IPATH_FLUSH_SEND,
124}; 132};
125 133
126struct ipath_ucontext { 134struct ipath_ucontext {
@@ -230,18 +238,6 @@ void ipath_skip_sge(struct ipath_sge_state *ss, u32 length)
230 } 238 }
231} 239}
232 240
233static void ipath_flush_wqe(struct ipath_qp *qp, struct ib_send_wr *wr)
234{
235 struct ib_wc wc;
236
237 memset(&wc, 0, sizeof(wc));
238 wc.wr_id = wr->wr_id;
239 wc.status = IB_WC_WR_FLUSH_ERR;
240 wc.opcode = ib_ipath_wc_opcode[wr->opcode];
241 wc.qp = &qp->ibqp;
242 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1);
243}
244
245/* 241/*
246 * Count the number of DMA descriptors needed to send length bytes of data. 242 * Count the number of DMA descriptors needed to send length bytes of data.
247 * Don't modify the ipath_sge_state to get the count. 243 * Don't modify the ipath_sge_state to get the count.
@@ -347,14 +343,8 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr)
347 spin_lock_irqsave(&qp->s_lock, flags); 343 spin_lock_irqsave(&qp->s_lock, flags);
348 344
349 /* Check that state is OK to post send. */ 345 /* Check that state is OK to post send. */
350 if (unlikely(!(ib_ipath_state_ops[qp->state] & IPATH_POST_SEND_OK))) { 346 if (unlikely(!(ib_ipath_state_ops[qp->state] & IPATH_POST_SEND_OK)))
351 if (qp->state != IB_QPS_SQE && qp->state != IB_QPS_ERR) 347 goto bail_inval;
352 goto bail_inval;
353 /* C10-96 says generate a flushed completion entry. */
354 ipath_flush_wqe(qp, wr);
355 ret = 0;
356 goto bail;
357 }
358 348
359 /* IB spec says that num_sge == 0 is OK. */ 349 /* IB spec says that num_sge == 0 is OK. */
360 if (wr->num_sge > qp->s_max_sge) 350 if (wr->num_sge > qp->s_max_sge)
@@ -677,6 +667,7 @@ bail:;
677static void ipath_ib_timer(struct ipath_ibdev *dev) 667static void ipath_ib_timer(struct ipath_ibdev *dev)
678{ 668{
679 struct ipath_qp *resend = NULL; 669 struct ipath_qp *resend = NULL;
670 struct ipath_qp *rnr = NULL;
680 struct list_head *last; 671 struct list_head *last;
681 struct ipath_qp *qp; 672 struct ipath_qp *qp;
682 unsigned long flags; 673 unsigned long flags;
@@ -703,7 +694,9 @@ static void ipath_ib_timer(struct ipath_ibdev *dev)
703 if (--qp->s_rnr_timeout == 0) { 694 if (--qp->s_rnr_timeout == 0) {
704 do { 695 do {
705 list_del_init(&qp->timerwait); 696 list_del_init(&qp->timerwait);
706 tasklet_hi_schedule(&qp->s_task); 697 qp->timer_next = rnr;
698 rnr = qp;
699 atomic_inc(&qp->refcount);
707 if (list_empty(last)) 700 if (list_empty(last))
708 break; 701 break;
709 qp = list_entry(last->next, struct ipath_qp, 702 qp = list_entry(last->next, struct ipath_qp,
@@ -743,13 +736,15 @@ static void ipath_ib_timer(struct ipath_ibdev *dev)
743 spin_unlock_irqrestore(&dev->pending_lock, flags); 736 spin_unlock_irqrestore(&dev->pending_lock, flags);
744 737
745 /* XXX What if timer fires again while this is running? */ 738 /* XXX What if timer fires again while this is running? */
746 for (qp = resend; qp != NULL; qp = qp->timer_next) { 739 while (resend != NULL) {
747 struct ib_wc wc; 740 qp = resend;
741 resend = qp->timer_next;
748 742
749 spin_lock_irqsave(&qp->s_lock, flags); 743 spin_lock_irqsave(&qp->s_lock, flags);
750 if (qp->s_last != qp->s_tail && qp->state == IB_QPS_RTS) { 744 if (qp->s_last != qp->s_tail &&
745 ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK) {
751 dev->n_timeouts++; 746 dev->n_timeouts++;
752 ipath_restart_rc(qp, qp->s_last_psn + 1, &wc); 747 ipath_restart_rc(qp, qp->s_last_psn + 1);
753 } 748 }
754 spin_unlock_irqrestore(&qp->s_lock, flags); 749 spin_unlock_irqrestore(&qp->s_lock, flags);
755 750
@@ -757,6 +752,19 @@ static void ipath_ib_timer(struct ipath_ibdev *dev)
757 if (atomic_dec_and_test(&qp->refcount)) 752 if (atomic_dec_and_test(&qp->refcount))
758 wake_up(&qp->wait); 753 wake_up(&qp->wait);
759 } 754 }
755 while (rnr != NULL) {
756 qp = rnr;
757 rnr = qp->timer_next;
758
759 spin_lock_irqsave(&qp->s_lock, flags);
760 if (ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)
761 ipath_schedule_send(qp);
762 spin_unlock_irqrestore(&qp->s_lock, flags);
763
764 /* Notify ipath_destroy_qp() if it is waiting. */
765 if (atomic_dec_and_test(&qp->refcount))
766 wake_up(&qp->wait);
767 }
760} 768}
761 769
762static void update_sge(struct ipath_sge_state *ss, u32 length) 770static void update_sge(struct ipath_sge_state *ss, u32 length)
@@ -1012,13 +1020,24 @@ static void sdma_complete(void *cookie, int status)
1012 struct ipath_verbs_txreq *tx = cookie; 1020 struct ipath_verbs_txreq *tx = cookie;
1013 struct ipath_qp *qp = tx->qp; 1021 struct ipath_qp *qp = tx->qp;
1014 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 1022 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
1023 unsigned int flags;
1024 enum ib_wc_status ibs = status == IPATH_SDMA_TXREQ_S_OK ?
1025 IB_WC_SUCCESS : IB_WC_WR_FLUSH_ERR;
1015 1026
1016 /* Generate a completion queue entry if needed */ 1027 if (atomic_dec_and_test(&qp->s_dma_busy)) {
1017 if (qp->ibqp.qp_type != IB_QPT_RC && tx->wqe) { 1028 spin_lock_irqsave(&qp->s_lock, flags);
1018 enum ib_wc_status ibs = status == IPATH_SDMA_TXREQ_S_OK ? 1029 if (tx->wqe)
1019 IB_WC_SUCCESS : IB_WC_WR_FLUSH_ERR; 1030 ipath_send_complete(qp, tx->wqe, ibs);
1020 1031 if ((ib_ipath_state_ops[qp->state] & IPATH_FLUSH_SEND &&
1032 qp->s_last != qp->s_head) ||
1033 (qp->s_flags & IPATH_S_WAIT_DMA))
1034 ipath_schedule_send(qp);
1035 spin_unlock_irqrestore(&qp->s_lock, flags);
1036 wake_up(&qp->wait_dma);
1037 } else if (tx->wqe) {
1038 spin_lock_irqsave(&qp->s_lock, flags);
1021 ipath_send_complete(qp, tx->wqe, ibs); 1039 ipath_send_complete(qp, tx->wqe, ibs);
1040 spin_unlock_irqrestore(&qp->s_lock, flags);
1022 } 1041 }
1023 1042
1024 if (tx->txreq.flags & IPATH_SDMA_TXREQ_F_FREEBUF) 1043 if (tx->txreq.flags & IPATH_SDMA_TXREQ_F_FREEBUF)
@@ -1029,6 +1048,21 @@ static void sdma_complete(void *cookie, int status)
1029 wake_up(&qp->wait); 1048 wake_up(&qp->wait);
1030} 1049}
1031 1050
1051static void decrement_dma_busy(struct ipath_qp *qp)
1052{
1053 unsigned int flags;
1054
1055 if (atomic_dec_and_test(&qp->s_dma_busy)) {
1056 spin_lock_irqsave(&qp->s_lock, flags);
1057 if ((ib_ipath_state_ops[qp->state] & IPATH_FLUSH_SEND &&
1058 qp->s_last != qp->s_head) ||
1059 (qp->s_flags & IPATH_S_WAIT_DMA))
1060 ipath_schedule_send(qp);
1061 spin_unlock_irqrestore(&qp->s_lock, flags);
1062 wake_up(&qp->wait_dma);
1063 }
1064}
1065
1032/* 1066/*
1033 * Compute the number of clock cycles of delay before sending the next packet. 1067 * Compute the number of clock cycles of delay before sending the next packet.
1034 * The multipliers reflect the number of clocks for the fastest rate so 1068 * The multipliers reflect the number of clocks for the fastest rate so
@@ -1067,9 +1101,12 @@ static int ipath_verbs_send_dma(struct ipath_qp *qp,
1067 if (tx) { 1101 if (tx) {
1068 qp->s_tx = NULL; 1102 qp->s_tx = NULL;
1069 /* resend previously constructed packet */ 1103 /* resend previously constructed packet */
1104 atomic_inc(&qp->s_dma_busy);
1070 ret = ipath_sdma_verbs_send(dd, tx->ss, tx->len, tx); 1105 ret = ipath_sdma_verbs_send(dd, tx->ss, tx->len, tx);
1071 if (ret) 1106 if (ret) {
1072 qp->s_tx = tx; 1107 qp->s_tx = tx;
1108 decrement_dma_busy(qp);
1109 }
1073 goto bail; 1110 goto bail;
1074 } 1111 }
1075 1112
@@ -1120,12 +1157,14 @@ static int ipath_verbs_send_dma(struct ipath_qp *qp,
1120 tx->txreq.sg_count = ndesc; 1157 tx->txreq.sg_count = ndesc;
1121 tx->map_len = (hdrwords + 2) << 2; 1158 tx->map_len = (hdrwords + 2) << 2;
1122 tx->txreq.map_addr = &tx->hdr; 1159 tx->txreq.map_addr = &tx->hdr;
1160 atomic_inc(&qp->s_dma_busy);
1123 ret = ipath_sdma_verbs_send(dd, ss, dwords, tx); 1161 ret = ipath_sdma_verbs_send(dd, ss, dwords, tx);
1124 if (ret) { 1162 if (ret) {
1125 /* save ss and length in dwords */ 1163 /* save ss and length in dwords */
1126 tx->ss = ss; 1164 tx->ss = ss;
1127 tx->len = dwords; 1165 tx->len = dwords;
1128 qp->s_tx = tx; 1166 qp->s_tx = tx;
1167 decrement_dma_busy(qp);
1129 } 1168 }
1130 goto bail; 1169 goto bail;
1131 } 1170 }
@@ -1146,6 +1185,7 @@ static int ipath_verbs_send_dma(struct ipath_qp *qp,
1146 memcpy(piobuf, hdr, hdrwords << 2); 1185 memcpy(piobuf, hdr, hdrwords << 2);
1147 ipath_copy_from_sge(piobuf + hdrwords, ss, len); 1186 ipath_copy_from_sge(piobuf + hdrwords, ss, len);
1148 1187
1188 atomic_inc(&qp->s_dma_busy);
1149 ret = ipath_sdma_verbs_send(dd, NULL, 0, tx); 1189 ret = ipath_sdma_verbs_send(dd, NULL, 0, tx);
1150 /* 1190 /*
1151 * If we couldn't queue the DMA request, save the info 1191 * If we couldn't queue the DMA request, save the info
@@ -1156,6 +1196,7 @@ static int ipath_verbs_send_dma(struct ipath_qp *qp,
1156 tx->ss = NULL; 1196 tx->ss = NULL;
1157 tx->len = 0; 1197 tx->len = 0;
1158 qp->s_tx = tx; 1198 qp->s_tx = tx;
1199 decrement_dma_busy(qp);
1159 } 1200 }
1160 dev->n_unaligned++; 1201 dev->n_unaligned++;
1161 goto bail; 1202 goto bail;
@@ -1179,6 +1220,7 @@ static int ipath_verbs_send_pio(struct ipath_qp *qp,
1179 unsigned flush_wc; 1220 unsigned flush_wc;
1180 u32 control; 1221 u32 control;
1181 int ret; 1222 int ret;
1223 unsigned int flags;
1182 1224
1183 piobuf = ipath_getpiobuf(dd, plen, NULL); 1225 piobuf = ipath_getpiobuf(dd, plen, NULL);
1184 if (unlikely(piobuf == NULL)) { 1226 if (unlikely(piobuf == NULL)) {
@@ -1249,8 +1291,11 @@ static int ipath_verbs_send_pio(struct ipath_qp *qp,
1249 } 1291 }
1250 copy_io(piobuf, ss, len, flush_wc); 1292 copy_io(piobuf, ss, len, flush_wc);
1251done: 1293done:
1252 if (qp->s_wqe) 1294 if (qp->s_wqe) {
1295 spin_lock_irqsave(&qp->s_lock, flags);
1253 ipath_send_complete(qp, qp->s_wqe, IB_WC_SUCCESS); 1296 ipath_send_complete(qp, qp->s_wqe, IB_WC_SUCCESS);
1297 spin_unlock_irqrestore(&qp->s_lock, flags);
1298 }
1254 ret = 0; 1299 ret = 0;
1255bail: 1300bail:
1256 return ret; 1301 return ret;
@@ -1283,19 +1328,12 @@ int ipath_verbs_send(struct ipath_qp *qp, struct ipath_ib_header *hdr,
1283 * can defer SDMA restart until link goes ACTIVE without 1328 * can defer SDMA restart until link goes ACTIVE without
1284 * worrying about just how we got there. 1329 * worrying about just how we got there.
1285 */ 1330 */
1286 if (qp->ibqp.qp_type == IB_QPT_SMI) 1331 if (qp->ibqp.qp_type == IB_QPT_SMI ||
1332 !(dd->ipath_flags & IPATH_HAS_SEND_DMA))
1287 ret = ipath_verbs_send_pio(qp, hdr, hdrwords, ss, len, 1333 ret = ipath_verbs_send_pio(qp, hdr, hdrwords, ss, len,
1288 plen, dwords); 1334 plen, dwords);
1289 /* All non-VL15 packets are dropped if link is not ACTIVE */
1290 else if (!(dd->ipath_flags & IPATH_LINKACTIVE)) {
1291 if (qp->s_wqe)
1292 ipath_send_complete(qp, qp->s_wqe, IB_WC_SUCCESS);
1293 ret = 0;
1294 } else if (dd->ipath_flags & IPATH_HAS_SEND_DMA)
1295 ret = ipath_verbs_send_dma(qp, hdr, hdrwords, ss, len,
1296 plen, dwords);
1297 else 1335 else
1298 ret = ipath_verbs_send_pio(qp, hdr, hdrwords, ss, len, 1336 ret = ipath_verbs_send_dma(qp, hdr, hdrwords, ss, len,
1299 plen, dwords); 1337 plen, dwords);
1300 1338
1301 return ret; 1339 return ret;
@@ -1403,27 +1441,46 @@ bail:
1403 * This is called from ipath_intr() at interrupt level when a PIO buffer is 1441 * This is called from ipath_intr() at interrupt level when a PIO buffer is
1404 * available after ipath_verbs_send() returned an error that no buffers were 1442 * available after ipath_verbs_send() returned an error that no buffers were
1405 * available. Return 1 if we consumed all the PIO buffers and we still have 1443 * available. Return 1 if we consumed all the PIO buffers and we still have
1406 * QPs waiting for buffers (for now, just do a tasklet_hi_schedule and 1444 * QPs waiting for buffers (for now, just restart the send tasklet and
1407 * return zero). 1445 * return zero).
1408 */ 1446 */
1409int ipath_ib_piobufavail(struct ipath_ibdev *dev) 1447int ipath_ib_piobufavail(struct ipath_ibdev *dev)
1410{ 1448{
1449 struct list_head *list;
1450 struct ipath_qp *qplist;
1411 struct ipath_qp *qp; 1451 struct ipath_qp *qp;
1412 unsigned long flags; 1452 unsigned long flags;
1413 1453
1414 if (dev == NULL) 1454 if (dev == NULL)
1415 goto bail; 1455 goto bail;
1416 1456
1457 list = &dev->piowait;
1458 qplist = NULL;
1459
1417 spin_lock_irqsave(&dev->pending_lock, flags); 1460 spin_lock_irqsave(&dev->pending_lock, flags);
1418 while (!list_empty(&dev->piowait)) { 1461 while (!list_empty(list)) {
1419 qp = list_entry(dev->piowait.next, struct ipath_qp, 1462 qp = list_entry(list->next, struct ipath_qp, piowait);
1420 piowait);
1421 list_del_init(&qp->piowait); 1463 list_del_init(&qp->piowait);
1422 clear_bit(IPATH_S_BUSY, &qp->s_busy); 1464 qp->pio_next = qplist;
1423 tasklet_hi_schedule(&qp->s_task); 1465 qplist = qp;
1466 atomic_inc(&qp->refcount);
1424 } 1467 }
1425 spin_unlock_irqrestore(&dev->pending_lock, flags); 1468 spin_unlock_irqrestore(&dev->pending_lock, flags);
1426 1469
1470 while (qplist != NULL) {
1471 qp = qplist;
1472 qplist = qp->pio_next;
1473
1474 spin_lock_irqsave(&qp->s_lock, flags);
1475 if (ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)
1476 ipath_schedule_send(qp);
1477 spin_unlock_irqrestore(&qp->s_lock, flags);
1478
1479 /* Notify ipath_destroy_qp() if it is waiting. */
1480 if (atomic_dec_and_test(&qp->refcount))
1481 wake_up(&qp->wait);
1482 }
1483
1427bail: 1484bail:
1428 return 0; 1485 return 0;
1429} 1486}
@@ -1437,7 +1494,8 @@ static int ipath_query_device(struct ib_device *ibdev,
1437 1494
1438 props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR | 1495 props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR |
1439 IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT | 1496 IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT |
1440 IB_DEVICE_SYS_IMAGE_GUID; 1497 IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_RC_RNR_NAK_GEN |
1498 IB_DEVICE_PORT_ACTIVE_EVENT | IB_DEVICE_SRQ_RESIZE;
1441 props->page_size_cap = PAGE_SIZE; 1499 props->page_size_cap = PAGE_SIZE;
1442 props->vendor_id = dev->dd->ipath_vendorid; 1500 props->vendor_id = dev->dd->ipath_vendorid;
1443 props->vendor_part_id = dev->dd->ipath_deviceid; 1501 props->vendor_part_id = dev->dd->ipath_deviceid;
@@ -2145,11 +2203,12 @@ bail:
2145void ipath_unregister_ib_device(struct ipath_ibdev *dev) 2203void ipath_unregister_ib_device(struct ipath_ibdev *dev)
2146{ 2204{
2147 struct ib_device *ibdev = &dev->ibdev; 2205 struct ib_device *ibdev = &dev->ibdev;
2148 2206 u32 qps_inuse;
2149 disable_timer(dev->dd);
2150 2207
2151 ib_unregister_device(ibdev); 2208 ib_unregister_device(ibdev);
2152 2209
2210 disable_timer(dev->dd);
2211
2153 if (!list_empty(&dev->pending[0]) || 2212 if (!list_empty(&dev->pending[0]) ||
2154 !list_empty(&dev->pending[1]) || 2213 !list_empty(&dev->pending[1]) ||
2155 !list_empty(&dev->pending[2])) 2214 !list_empty(&dev->pending[2]))
@@ -2164,7 +2223,10 @@ void ipath_unregister_ib_device(struct ipath_ibdev *dev)
2164 * Note that ipath_unregister_ib_device() can be called before all 2223 * Note that ipath_unregister_ib_device() can be called before all
2165 * the QPs are destroyed! 2224 * the QPs are destroyed!
2166 */ 2225 */
2167 ipath_free_all_qps(&dev->qp_table); 2226 qps_inuse = ipath_free_all_qps(&dev->qp_table);
2227 if (qps_inuse)
2228 ipath_dev_err(dev->dd, "QP memory leak! %u still in use\n",
2229 qps_inuse);
2168 kfree(dev->qp_table.table); 2230 kfree(dev->qp_table.table);
2169 kfree(dev->lk_table.table); 2231 kfree(dev->lk_table.table);
2170 kfree(dev->txreq_bufs); 2232 kfree(dev->txreq_bufs);
@@ -2215,17 +2277,14 @@ static ssize_t show_stats(struct device *device, struct device_attribute *attr,
2215 "RC OTH NAKs %d\n" 2277 "RC OTH NAKs %d\n"
2216 "RC timeouts %d\n" 2278 "RC timeouts %d\n"
2217 "RC RDMA dup %d\n" 2279 "RC RDMA dup %d\n"
2218 "RC stalls %d\n"
2219 "piobuf wait %d\n" 2280 "piobuf wait %d\n"
2220 "no piobuf %d\n"
2221 "unaligned %d\n" 2281 "unaligned %d\n"
2222 "PKT drops %d\n" 2282 "PKT drops %d\n"
2223 "WQE errs %d\n", 2283 "WQE errs %d\n",
2224 dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks, 2284 dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks,
2225 dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks, 2285 dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks,
2226 dev->n_other_naks, dev->n_timeouts, 2286 dev->n_other_naks, dev->n_timeouts,
2227 dev->n_rdma_dup_busy, dev->n_rc_stalls, dev->n_piowait, 2287 dev->n_rdma_dup_busy, dev->n_piowait, dev->n_unaligned,
2228 dev->n_no_piobuf, dev->n_unaligned,
2229 dev->n_pkt_drops, dev->n_wqe_errs); 2288 dev->n_pkt_drops, dev->n_wqe_errs);
2230 for (i = 0; i < ARRAY_SIZE(dev->opstats); i++) { 2289 for (i = 0; i < ARRAY_SIZE(dev->opstats); i++) {
2231 const struct ipath_opcode_stats *si = &dev->opstats[i]; 2290 const struct ipath_opcode_stats *si = &dev->opstats[i];
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index 6514aa8306cd..9d12ae8a778e 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -74,6 +74,11 @@
74#define IPATH_POST_RECV_OK 0x02 74#define IPATH_POST_RECV_OK 0x02
75#define IPATH_PROCESS_RECV_OK 0x04 75#define IPATH_PROCESS_RECV_OK 0x04
76#define IPATH_PROCESS_SEND_OK 0x08 76#define IPATH_PROCESS_SEND_OK 0x08
77#define IPATH_PROCESS_NEXT_SEND_OK 0x10
78#define IPATH_FLUSH_SEND 0x20
79#define IPATH_FLUSH_RECV 0x40
80#define IPATH_PROCESS_OR_FLUSH_SEND \
81 (IPATH_PROCESS_SEND_OK | IPATH_FLUSH_SEND)
77 82
78/* IB Performance Manager status values */ 83/* IB Performance Manager status values */
79#define IB_PMA_SAMPLE_STATUS_DONE 0x00 84#define IB_PMA_SAMPLE_STATUS_DONE 0x00
@@ -353,12 +358,14 @@ struct ipath_qp {
353 struct ib_qp ibqp; 358 struct ib_qp ibqp;
354 struct ipath_qp *next; /* link list for QPN hash table */ 359 struct ipath_qp *next; /* link list for QPN hash table */
355 struct ipath_qp *timer_next; /* link list for ipath_ib_timer() */ 360 struct ipath_qp *timer_next; /* link list for ipath_ib_timer() */
361 struct ipath_qp *pio_next; /* link for ipath_ib_piobufavail() */
356 struct list_head piowait; /* link for wait PIO buf */ 362 struct list_head piowait; /* link for wait PIO buf */
357 struct list_head timerwait; /* link for waiting for timeouts */ 363 struct list_head timerwait; /* link for waiting for timeouts */
358 struct ib_ah_attr remote_ah_attr; 364 struct ib_ah_attr remote_ah_attr;
359 struct ipath_ib_header s_hdr; /* next packet header to send */ 365 struct ipath_ib_header s_hdr; /* next packet header to send */
360 atomic_t refcount; 366 atomic_t refcount;
361 wait_queue_head_t wait; 367 wait_queue_head_t wait;
368 wait_queue_head_t wait_dma;
362 struct tasklet_struct s_task; 369 struct tasklet_struct s_task;
363 struct ipath_mmap_info *ip; 370 struct ipath_mmap_info *ip;
364 struct ipath_sge_state *s_cur_sge; 371 struct ipath_sge_state *s_cur_sge;
@@ -369,7 +376,7 @@ struct ipath_qp {
369 struct ipath_sge_state s_rdma_read_sge; 376 struct ipath_sge_state s_rdma_read_sge;
370 struct ipath_sge_state r_sge; /* current receive data */ 377 struct ipath_sge_state r_sge; /* current receive data */
371 spinlock_t s_lock; 378 spinlock_t s_lock;
372 unsigned long s_busy; 379 atomic_t s_dma_busy;
373 u16 s_pkt_delay; 380 u16 s_pkt_delay;
374 u16 s_hdrwords; /* size of s_hdr in 32 bit words */ 381 u16 s_hdrwords; /* size of s_hdr in 32 bit words */
375 u32 s_cur_size; /* size of send packet in bytes */ 382 u32 s_cur_size; /* size of send packet in bytes */
@@ -383,6 +390,7 @@ struct ipath_qp {
383 u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */ 390 u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */
384 u32 r_ack_psn; /* PSN for next ACK or atomic ACK */ 391 u32 r_ack_psn; /* PSN for next ACK or atomic ACK */
385 u64 r_wr_id; /* ID for current receive WQE */ 392 u64 r_wr_id; /* ID for current receive WQE */
393 unsigned long r_aflags;
386 u32 r_len; /* total length of r_sge */ 394 u32 r_len; /* total length of r_sge */
387 u32 r_rcv_len; /* receive data len processed */ 395 u32 r_rcv_len; /* receive data len processed */
388 u32 r_psn; /* expected rcv packet sequence number */ 396 u32 r_psn; /* expected rcv packet sequence number */
@@ -394,8 +402,7 @@ struct ipath_qp {
394 u8 r_state; /* opcode of last packet received */ 402 u8 r_state; /* opcode of last packet received */
395 u8 r_nak_state; /* non-zero if NAK is pending */ 403 u8 r_nak_state; /* non-zero if NAK is pending */
396 u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */ 404 u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */
397 u8 r_reuse_sge; /* for UC receive errors */ 405 u8 r_flags;
398 u8 r_wrid_valid; /* r_wrid set but CQ entry not yet made */
399 u8 r_max_rd_atomic; /* max number of RDMA read/atomic to receive */ 406 u8 r_max_rd_atomic; /* max number of RDMA read/atomic to receive */
400 u8 r_head_ack_queue; /* index into s_ack_queue[] */ 407 u8 r_head_ack_queue; /* index into s_ack_queue[] */
401 u8 qp_access_flags; 408 u8 qp_access_flags;
@@ -404,13 +411,13 @@ struct ipath_qp {
404 u8 s_rnr_retry_cnt; 411 u8 s_rnr_retry_cnt;
405 u8 s_retry; /* requester retry counter */ 412 u8 s_retry; /* requester retry counter */
406 u8 s_rnr_retry; /* requester RNR retry counter */ 413 u8 s_rnr_retry; /* requester RNR retry counter */
407 u8 s_wait_credit; /* limit number of unacked packets sent */
408 u8 s_pkey_index; /* PKEY index to use */ 414 u8 s_pkey_index; /* PKEY index to use */
409 u8 s_max_rd_atomic; /* max number of RDMA read/atomic to send */ 415 u8 s_max_rd_atomic; /* max number of RDMA read/atomic to send */
410 u8 s_num_rd_atomic; /* number of RDMA read/atomic pending */ 416 u8 s_num_rd_atomic; /* number of RDMA read/atomic pending */
411 u8 s_tail_ack_queue; /* index into s_ack_queue[] */ 417 u8 s_tail_ack_queue; /* index into s_ack_queue[] */
412 u8 s_flags; 418 u8 s_flags;
413 u8 s_dmult; 419 u8 s_dmult;
420 u8 s_draining;
414 u8 timeout; /* Timeout for this QP */ 421 u8 timeout; /* Timeout for this QP */
415 enum ib_mtu path_mtu; 422 enum ib_mtu path_mtu;
416 u32 remote_qpn; 423 u32 remote_qpn;
@@ -428,16 +435,40 @@ struct ipath_qp {
428 struct ipath_sge r_sg_list[0]; /* verified SGEs */ 435 struct ipath_sge r_sg_list[0]; /* verified SGEs */
429}; 436};
430 437
431/* Bit definition for s_busy. */ 438/*
432#define IPATH_S_BUSY 0 439 * Atomic bit definitions for r_aflags.
440 */
441#define IPATH_R_WRID_VALID 0
442
443/*
444 * Bit definitions for r_flags.
445 */
446#define IPATH_R_REUSE_SGE 0x01
447#define IPATH_R_RDMAR_SEQ 0x02
433 448
434/* 449/*
435 * Bit definitions for s_flags. 450 * Bit definitions for s_flags.
451 *
452 * IPATH_S_FENCE_PENDING - waiting for all prior RDMA read or atomic SWQEs
453 * before processing the next SWQE
454 * IPATH_S_RDMAR_PENDING - waiting for any RDMA read or atomic SWQEs
455 * before processing the next SWQE
456 * IPATH_S_WAITING - waiting for RNR timeout or send buffer available.
457 * IPATH_S_WAIT_SSN_CREDIT - waiting for RC credits to process next SWQE
458 * IPATH_S_WAIT_DMA - waiting for send DMA queue to drain before generating
459 * next send completion entry not via send DMA.
436 */ 460 */
437#define IPATH_S_SIGNAL_REQ_WR 0x01 461#define IPATH_S_SIGNAL_REQ_WR 0x01
438#define IPATH_S_FENCE_PENDING 0x02 462#define IPATH_S_FENCE_PENDING 0x02
439#define IPATH_S_RDMAR_PENDING 0x04 463#define IPATH_S_RDMAR_PENDING 0x04
440#define IPATH_S_ACK_PENDING 0x08 464#define IPATH_S_ACK_PENDING 0x08
465#define IPATH_S_BUSY 0x10
466#define IPATH_S_WAITING 0x20
467#define IPATH_S_WAIT_SSN_CREDIT 0x40
468#define IPATH_S_WAIT_DMA 0x80
469
470#define IPATH_S_ANY_WAIT (IPATH_S_FENCE_PENDING | IPATH_S_RDMAR_PENDING | \
471 IPATH_S_WAITING | IPATH_S_WAIT_SSN_CREDIT | IPATH_S_WAIT_DMA)
441 472
442#define IPATH_PSN_CREDIT 512 473#define IPATH_PSN_CREDIT 512
443 474
@@ -573,13 +604,11 @@ struct ipath_ibdev {
573 u32 n_rnr_naks; 604 u32 n_rnr_naks;
574 u32 n_other_naks; 605 u32 n_other_naks;
575 u32 n_timeouts; 606 u32 n_timeouts;
576 u32 n_rc_stalls;
577 u32 n_pkt_drops; 607 u32 n_pkt_drops;
578 u32 n_vl15_dropped; 608 u32 n_vl15_dropped;
579 u32 n_wqe_errs; 609 u32 n_wqe_errs;
580 u32 n_rdma_dup_busy; 610 u32 n_rdma_dup_busy;
581 u32 n_piowait; 611 u32 n_piowait;
582 u32 n_no_piobuf;
583 u32 n_unaligned; 612 u32 n_unaligned;
584 u32 port_cap_flags; 613 u32 port_cap_flags;
585 u32 pma_sample_start; 614 u32 pma_sample_start;
@@ -657,6 +686,17 @@ static inline struct ipath_ibdev *to_idev(struct ib_device *ibdev)
657 return container_of(ibdev, struct ipath_ibdev, ibdev); 686 return container_of(ibdev, struct ipath_ibdev, ibdev);
658} 687}
659 688
689/*
690 * This must be called with s_lock held.
691 */
692static inline void ipath_schedule_send(struct ipath_qp *qp)
693{
694 if (qp->s_flags & IPATH_S_ANY_WAIT)
695 qp->s_flags &= ~IPATH_S_ANY_WAIT;
696 if (!(qp->s_flags & IPATH_S_BUSY))
697 tasklet_hi_schedule(&qp->s_task);
698}
699
660int ipath_process_mad(struct ib_device *ibdev, 700int ipath_process_mad(struct ib_device *ibdev,
661 int mad_flags, 701 int mad_flags,
662 u8 port_num, 702 u8 port_num,
@@ -706,12 +746,10 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
706int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 746int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
707 int attr_mask, struct ib_qp_init_attr *init_attr); 747 int attr_mask, struct ib_qp_init_attr *init_attr);
708 748
709void ipath_free_all_qps(struct ipath_qp_table *qpt); 749unsigned ipath_free_all_qps(struct ipath_qp_table *qpt);
710 750
711int ipath_init_qp_table(struct ipath_ibdev *idev, int size); 751int ipath_init_qp_table(struct ipath_ibdev *idev, int size);
712 752
713void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc);
714
715void ipath_get_credit(struct ipath_qp *qp, u32 aeth); 753void ipath_get_credit(struct ipath_qp *qp, u32 aeth);
716 754
717unsigned ipath_ib_rate_to_mult(enum ib_rate rate); 755unsigned ipath_ib_rate_to_mult(enum ib_rate rate);
@@ -729,7 +767,9 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
729void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, 767void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
730 int has_grh, void *data, u32 tlen, struct ipath_qp *qp); 768 int has_grh, void *data, u32 tlen, struct ipath_qp *qp);
731 769
732void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc); 770void ipath_restart_rc(struct ipath_qp *qp, u32 psn);
771
772void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err);
733 773
734int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr); 774int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr);
735 775
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 8e02ecfec188..a80df22deae8 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -333,6 +333,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
333 cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) + 333 cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) +
334 send_wqe_overhead(type, qp->flags); 334 send_wqe_overhead(type, qp->flags);
335 335
336 if (s > dev->dev->caps.max_sq_desc_sz)
337 return -EINVAL;
338
336 /* 339 /*
337 * Hermon supports shrinking WQEs, such that a single work 340 * Hermon supports shrinking WQEs, such that a single work
338 * request can include multiple units of 1 << wqe_shift. This 341 * request can include multiple units of 1 << wqe_shift. This
@@ -372,9 +375,6 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
372 qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s)); 375 qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s));
373 376
374 for (;;) { 377 for (;;) {
375 if (1 << qp->sq.wqe_shift > dev->dev->caps.max_sq_desc_sz)
376 return -EINVAL;
377
378 qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift); 378 qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift);
379 379
380 /* 380 /*
@@ -395,7 +395,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
395 ++qp->sq.wqe_shift; 395 ++qp->sq.wqe_shift;
396 } 396 }
397 397
398 qp->sq.max_gs = ((qp->sq_max_wqes_per_wr << qp->sq.wqe_shift) - 398 qp->sq.max_gs = (min(dev->dev->caps.max_sq_desc_sz,
399 (qp->sq_max_wqes_per_wr << qp->sq.wqe_shift)) -
399 send_wqe_overhead(type, qp->flags)) / 400 send_wqe_overhead(type, qp->flags)) /
400 sizeof (struct mlx4_wqe_data_seg); 401 sizeof (struct mlx4_wqe_data_seg);
401 402
@@ -411,7 +412,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
411 412
412 cap->max_send_wr = qp->sq.max_post = 413 cap->max_send_wr = qp->sq.max_post =
413 (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr; 414 (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr;
414 cap->max_send_sge = qp->sq.max_gs; 415 cap->max_send_sge = min(qp->sq.max_gs,
416 min(dev->dev->caps.max_sq_sg,
417 dev->dev->caps.max_rq_sg));
415 /* We don't support inline sends for kernel QPs (yet) */ 418 /* We don't support inline sends for kernel QPs (yet) */
416 cap->max_inline_data = 0; 419 cap->max_inline_data = 0;
417 420
@@ -1457,7 +1460,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1457 unsigned ind; 1460 unsigned ind;
1458 int uninitialized_var(stamp); 1461 int uninitialized_var(stamp);
1459 int uninitialized_var(size); 1462 int uninitialized_var(size);
1460 unsigned seglen; 1463 unsigned uninitialized_var(seglen);
1461 int i; 1464 int i;
1462 1465
1463 spin_lock_irqsave(&qp->sq.lock, flags); 1466 spin_lock_irqsave(&qp->sq.lock, flags);
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index 9ebadd6e0cfb..200cf13fc9bb 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -45,6 +45,7 @@
45#include "mthca_cmd.h" 45#include "mthca_cmd.h"
46#include "mthca_profile.h" 46#include "mthca_profile.h"
47#include "mthca_memfree.h" 47#include "mthca_memfree.h"
48#include "mthca_wqe.h"
48 49
49MODULE_AUTHOR("Roland Dreier"); 50MODULE_AUTHOR("Roland Dreier");
50MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver"); 51MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver");
@@ -200,7 +201,18 @@ static int mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim *dev_lim)
200 mdev->limits.gid_table_len = dev_lim->max_gids; 201 mdev->limits.gid_table_len = dev_lim->max_gids;
201 mdev->limits.pkey_table_len = dev_lim->max_pkeys; 202 mdev->limits.pkey_table_len = dev_lim->max_pkeys;
202 mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay; 203 mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay;
203 mdev->limits.max_sg = dev_lim->max_sg; 204 /*
205 * Need to allow for worst case send WQE overhead and check
206 * whether max_desc_sz imposes a lower limit than max_sg; UD
207 * send has the biggest overhead.
208 */
209 mdev->limits.max_sg = min_t(int, dev_lim->max_sg,
210 (dev_lim->max_desc_sz -
211 sizeof (struct mthca_next_seg) -
212 (mthca_is_memfree(mdev) ?
213 sizeof (struct mthca_arbel_ud_seg) :
214 sizeof (struct mthca_tavor_ud_seg))) /
215 sizeof (struct mthca_data_seg));
204 mdev->limits.max_wqes = dev_lim->max_qp_sz; 216 mdev->limits.max_wqes = dev_lim->max_qp_sz;
205 mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp; 217 mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp;
206 mdev->limits.reserved_qps = dev_lim->reserved_qps; 218 mdev->limits.reserved_qps = dev_lim->reserved_qps;
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 9f7364a9096d..a4e9269a29bd 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -91,10 +91,6 @@ unsigned int nes_debug_level = 0;
91module_param_named(debug_level, nes_debug_level, uint, 0644); 91module_param_named(debug_level, nes_debug_level, uint, 0644);
92MODULE_PARM_DESC(debug_level, "Enable debug output level"); 92MODULE_PARM_DESC(debug_level, "Enable debug output level");
93 93
94unsigned int nes_lro_max_aggr = NES_LRO_MAX_AGGR;
95module_param(nes_lro_max_aggr, int, NES_LRO_MAX_AGGR);
96MODULE_PARM_DESC(nes_mro_max_aggr, " nic LRO MAX packet aggregation");
97
98LIST_HEAD(nes_adapter_list); 94LIST_HEAD(nes_adapter_list);
99static LIST_HEAD(nes_dev_list); 95static LIST_HEAD(nes_dev_list);
100 96
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index 1f9f7bf73862..61b46e9c7d2d 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -173,7 +173,6 @@ extern int disable_mpa_crc;
173extern unsigned int send_first; 173extern unsigned int send_first;
174extern unsigned int nes_drv_opt; 174extern unsigned int nes_drv_opt;
175extern unsigned int nes_debug_level; 175extern unsigned int nes_debug_level;
176extern unsigned int nes_lro_max_aggr;
177 176
178extern struct list_head nes_adapter_list; 177extern struct list_head nes_adapter_list;
179 178
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 8dc70f9bad2f..d3278f111ca7 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -42,6 +42,10 @@
42 42
43#include "nes.h" 43#include "nes.h"
44 44
45static unsigned int nes_lro_max_aggr = NES_LRO_MAX_AGGR;
46module_param(nes_lro_max_aggr, uint, 0444);
47MODULE_PARM_DESC(nes_lro_max_aggr, "NIC LRO max packet aggregation");
48
45static u32 crit_err_count; 49static u32 crit_err_count;
46u32 int_mod_timer_init; 50u32 int_mod_timer_init;
47u32 int_mod_cq_depth_256; 51u32 int_mod_cq_depth_256;
@@ -1738,7 +1742,7 @@ int nes_init_nic_qp(struct nes_device *nesdev, struct net_device *netdev)
1738 jumbomode = 1; 1742 jumbomode = 1;
1739 nes_nic_init_timer_defaults(nesdev, jumbomode); 1743 nes_nic_init_timer_defaults(nesdev, jumbomode);
1740 } 1744 }
1741 nesvnic->lro_mgr.max_aggr = NES_LRO_MAX_AGGR; 1745 nesvnic->lro_mgr.max_aggr = nes_lro_max_aggr;
1742 nesvnic->lro_mgr.max_desc = NES_MAX_LRO_DESCRIPTORS; 1746 nesvnic->lro_mgr.max_desc = NES_MAX_LRO_DESCRIPTORS;
1743 nesvnic->lro_mgr.lro_arr = nesvnic->lro_desc; 1747 nesvnic->lro_mgr.lro_arr = nesvnic->lro_desc;
1744 nesvnic->lro_mgr.get_skb_header = nes_lro_get_skb_hdr; 1748 nesvnic->lro_mgr.get_skb_header = nes_lro_get_skb_hdr;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index d00a2c174aee..3f663fb852c1 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -194,7 +194,13 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
194 /* Set the cached Q_Key before we attach if it's the broadcast group */ 194 /* Set the cached Q_Key before we attach if it's the broadcast group */
195 if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4, 195 if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
196 sizeof (union ib_gid))) { 196 sizeof (union ib_gid))) {
197 spin_lock_irq(&priv->lock);
198 if (!priv->broadcast) {
199 spin_unlock_irq(&priv->lock);
200 return -EAGAIN;
201 }
197 priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey); 202 priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey);
203 spin_unlock_irq(&priv->lock);
198 priv->tx_wr.wr.ud.remote_qkey = priv->qkey; 204 priv->tx_wr.wr.ud.remote_qkey = priv->qkey;
199 } 205 }
200 206
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c
index a293e8b3f508..8a77bfcd05bc 100644
--- a/drivers/input/keyboard/aaed2000_kbd.c
+++ b/drivers/input/keyboard/aaed2000_kbd.c
@@ -183,4 +183,4 @@ module_exit(aaedkbd_exit);
183 183
184MODULE_AUTHOR("Nicolas Bellido Y Ortega"); 184MODULE_AUTHOR("Nicolas Bellido Y Ortega");
185MODULE_DESCRIPTION("AAED-2000 Keyboard Driver"); 185MODULE_DESCRIPTION("AAED-2000 Keyboard Driver");
186MODULE_LICENSE("GPLv2"); 186MODULE_LICENSE("GPL v2");
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 4a95adc4cc78..af58a6f1e898 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -807,6 +807,8 @@ static int atkbd_activate(struct atkbd *atkbd)
807static void atkbd_cleanup(struct serio *serio) 807static void atkbd_cleanup(struct serio *serio)
808{ 808{
809 struct atkbd *atkbd = serio_get_drvdata(serio); 809 struct atkbd *atkbd = serio_get_drvdata(serio);
810
811 atkbd_disable(atkbd);
810 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); 812 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT);
811} 813}
812 814
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index 29fbec6218b9..1aa46ae12630 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -412,5 +412,5 @@ module_exit(corgikbd_exit);
412 412
413MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 413MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
414MODULE_DESCRIPTION("Corgi Keyboard Driver"); 414MODULE_DESCRIPTION("Corgi Keyboard Driver");
415MODULE_LICENSE("GPLv2"); 415MODULE_LICENSE("GPL v2");
416MODULE_ALIAS("platform:corgi-keyboard"); 416MODULE_ALIAS("platform:corgi-keyboard");
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c
index 50d80ecf0b80..aacf71f3cd44 100644
--- a/drivers/input/keyboard/hilkbd.c
+++ b/drivers/input/keyboard/hilkbd.c
@@ -217,6 +217,10 @@ hil_keyb_init(void)
217 return -ENOMEM; 217 return -ENOMEM;
218 218
219#if defined(CONFIG_HP300) 219#if defined(CONFIG_HP300)
220 if (!MACH_IS_HP300) {
221 err = -ENODEV;
222 goto err1;
223 }
220 if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { 224 if (!hwreg_present((void *)(HILBASE + HIL_DATA))) {
221 printk(KERN_ERR "HIL: hardware register was not found\n"); 225 printk(KERN_ERR "HIL: hardware register was not found\n");
222 err = -ENODEV; 226 err = -ENODEV;
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index 9387da343f97..781fc6102860 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -275,5 +275,5 @@ module_exit(jornada680kbd_exit);
275 275
276MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); 276MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
277MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); 277MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver");
278MODULE_LICENSE("GPLv2"); 278MODULE_LICENSE("GPL v2");
279MODULE_ALIAS("platform:jornada680_kbd"); 279MODULE_ALIAS("platform:jornada680_kbd");
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c
index a1164a0c7736..ce650af6d649 100644
--- a/drivers/input/keyboard/jornada720_kbd.c
+++ b/drivers/input/keyboard/jornada720_kbd.c
@@ -29,7 +29,7 @@
29 29
30MODULE_AUTHOR("Kristoffer Ericson <Kristoffer.Ericson@gmail.com>"); 30MODULE_AUTHOR("Kristoffer Ericson <Kristoffer.Ericson@gmail.com>");
31MODULE_DESCRIPTION("HP Jornada 710/720/728 keyboard driver"); 31MODULE_DESCRIPTION("HP Jornada 710/720/728 keyboard driver");
32MODULE_LICENSE("GPLv2"); 32MODULE_LICENSE("GPL v2");
33 33
34static unsigned short jornada_std_keymap[128] = { /* ROW */ 34static unsigned short jornada_std_keymap[128] = { /* ROW */
35 0, KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* #1 */ 35 0, KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* #1 */
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 3dea0c5077a9..45767e73f071 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -136,6 +136,9 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
136 set_bit(code, input_dev->keybit); 136 set_bit(code, input_dev->keybit);
137 } 137 }
138 138
139 for (i = 0; i < pdata->direct_key_num; i++)
140 set_bit(pdata->direct_key_map[i], input_dev->keybit);
141
139 keypad->rotary_up_key[0] = pdata->rotary0_up_key; 142 keypad->rotary_up_key[0] = pdata->rotary0_up_key;
140 keypad->rotary_up_key[1] = pdata->rotary1_up_key; 143 keypad->rotary_up_key[1] = pdata->rotary1_up_key;
141 keypad->rotary_down_key[0] = pdata->rotary0_down_key; 144 keypad->rotary_down_key[0] = pdata->rotary0_down_key;
@@ -143,17 +146,21 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
143 keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; 146 keypad->rotary_rel_code[0] = pdata->rotary0_rel_code;
144 keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; 147 keypad->rotary_rel_code[1] = pdata->rotary1_rel_code;
145 148
146 if (pdata->rotary0_up_key && pdata->rotary0_down_key) { 149 if (pdata->enable_rotary0) {
147 set_bit(pdata->rotary0_up_key, input_dev->keybit); 150 if (pdata->rotary0_up_key && pdata->rotary0_down_key) {
148 set_bit(pdata->rotary0_down_key, input_dev->keybit); 151 set_bit(pdata->rotary0_up_key, input_dev->keybit);
149 } else 152 set_bit(pdata->rotary0_down_key, input_dev->keybit);
150 set_bit(pdata->rotary0_rel_code, input_dev->relbit); 153 } else
151 154 set_bit(pdata->rotary0_rel_code, input_dev->relbit);
152 if (pdata->rotary1_up_key && pdata->rotary1_down_key) { 155 }
153 set_bit(pdata->rotary1_up_key, input_dev->keybit); 156
154 set_bit(pdata->rotary1_down_key, input_dev->keybit); 157 if (pdata->enable_rotary1) {
155 } else 158 if (pdata->rotary1_up_key && pdata->rotary1_down_key) {
156 set_bit(pdata->rotary1_rel_code, input_dev->relbit); 159 set_bit(pdata->rotary1_up_key, input_dev->keybit);
160 set_bit(pdata->rotary1_down_key, input_dev->keybit);
161 } else
162 set_bit(pdata->rotary1_rel_code, input_dev->relbit);
163 }
157} 164}
158 165
159static inline unsigned int lookup_matrix_keycode( 166static inline unsigned int lookup_matrix_keycode(
@@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
484 keypad->input_dev = input_dev; 491 keypad->input_dev = input_dev;
485 input_set_drvdata(input_dev, keypad); 492 input_set_drvdata(input_dev, keypad);
486 493
487 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | 494 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
488 BIT_MASK(EV_REL); 495 if ((keypad->pdata->enable_rotary0 &&
496 keypad->pdata->rotary0_rel_code) ||
497 (keypad->pdata->enable_rotary1 &&
498 keypad->pdata->rotary1_rel_code)) {
499 input_dev->evbit[0] |= BIT_MASK(EV_REL);
500 }
489 501
490 pxa27x_keypad_build_keycode(keypad); 502 pxa27x_keypad_build_keycode(keypad);
491 platform_set_drvdata(pdev, keypad); 503 platform_set_drvdata(pdev, keypad);
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 61e401bc9109..1aa37181c40f 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -494,5 +494,5 @@ module_exit(spitzkbd_exit);
494 494
495MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 495MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
496MODULE_DESCRIPTION("Spitz Keyboard Driver"); 496MODULE_DESCRIPTION("Spitz Keyboard Driver");
497MODULE_LICENSE("GPLv2"); 497MODULE_LICENSE("GPL v2");
498MODULE_ALIAS("platform:spitz-keyboard"); 498MODULE_ALIAS("platform:spitz-keyboard");
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c
index 9531d8c7444f..d82f7f727f7a 100644
--- a/drivers/input/misc/apanel.c
+++ b/drivers/input/misc/apanel.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/module.h>
24#include <linux/input-polldev.h> 23#include <linux/input-polldev.h>
25#include <linux/i2c.h> 24#include <linux/i2c.h>
26#include <linux/workqueue.h> 25#include <linux/workqueue.h>
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index ab76ea442fa5..45e5d05b01de 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -691,6 +691,11 @@ static int __init hp_sdc_rtc_init(void)
691{ 691{
692 int ret; 692 int ret;
693 693
694#ifdef __mc68000__
695 if (!MACH_IS_HP300)
696 return -ENODEV;
697#endif
698
694 init_MUTEX(&i8042tregs); 699 init_MUTEX(&i8042tregs);
695 700
696 if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) 701 if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr)))
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c
index f1fd3b638a37..587398f5c9df 100644
--- a/drivers/input/serio/hp_sdc_mlc.c
+++ b/drivers/input/serio/hp_sdc_mlc.c
@@ -306,6 +306,11 @@ static int __init hp_sdc_mlc_init(void)
306{ 306{
307 hil_mlc *mlc = &hp_sdc_mlc; 307 hil_mlc *mlc = &hp_sdc_mlc;
308 308
309#ifdef __mc68000__
310 if (!MACH_IS_HP300)
311 return -ENODEV;
312#endif
313
309 printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n"); 314 printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n");
310 315
311 hp_sdc_mlc_priv.emtestmode = 0; 316 hp_sdc_mlc_priv.emtestmode = 0;
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 5ece9f56babc..9aafa96cb746 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -331,6 +331,13 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
331 }, 331 },
332 }, 332 },
333 { 333 {
334 .ident = "Acer TravelMate 660",
335 .matches = {
336 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
337 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
338 },
339 },
340 {
334 .ident = "Acer TravelMate 2490", 341 .ident = "Acer TravelMate 2490",
335 .matches = { 342 .matches = {
336 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 343 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 65a74cfc187b..592ff55b62d0 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -885,6 +885,20 @@ static long i8042_panic_blink(long count)
885 885
886#undef DELAY 886#undef DELAY
887 887
888#ifdef CONFIG_X86
889static void i8042_dritek_enable(void)
890{
891 char param = 0x90;
892 int error;
893
894 error = i8042_command(&param, 0x1059);
895 if (error)
896 printk(KERN_WARNING
897 "Failed to enable DRITEK extension: %d\n",
898 error);
899}
900#endif
901
888#ifdef CONFIG_PM 902#ifdef CONFIG_PM
889/* 903/*
890 * Here we try to restore the original BIOS settings. We only want to 904 * Here we try to restore the original BIOS settings. We only want to
@@ -942,6 +956,12 @@ static int i8042_resume(struct platform_device *dev)
942 return -EIO; 956 return -EIO;
943 } 957 }
944 958
959
960#ifdef CONFIG_X86
961 if (i8042_dritek)
962 i8042_dritek_enable();
963#endif
964
945 if (i8042_mux_present) { 965 if (i8042_mux_present) {
946 if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports()) 966 if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports())
947 printk(KERN_WARNING 967 printk(KERN_WARNING
@@ -1160,6 +1180,11 @@ static int __devinit i8042_probe(struct platform_device *dev)
1160 if (error) 1180 if (error)
1161 return error; 1181 return error;
1162 1182
1183#ifdef CONFIG_X86
1184 if (i8042_dritek)
1185 i8042_dritek_enable();
1186#endif
1187
1163 if (!i8042_noaux) { 1188 if (!i8042_noaux) {
1164 error = i8042_setup_aux(); 1189 error = i8042_setup_aux();
1165 if (error && error != -ENODEV && error != -EBUSY) 1190 if (error && error != -ENODEV && error != -EBUSY)
@@ -1171,14 +1196,6 @@ static int __devinit i8042_probe(struct platform_device *dev)
1171 if (error) 1196 if (error)
1172 goto out_fail; 1197 goto out_fail;
1173 } 1198 }
1174#ifdef CONFIG_X86
1175 if (i8042_dritek) {
1176 char param = 0x90;
1177 error = i8042_command(&param, 0x1059);
1178 if (error)
1179 goto out_fail;
1180 }
1181#endif
1182/* 1199/*
1183 * Ok, everything is ready, let's register all serio ports 1200 * Ok, everything is ready, let's register all serio ports
1184 */ 1201 */
diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c
index cb89aff2e160..d962a8d78b14 100644
--- a/drivers/input/serio/q40kbd.c
+++ b/drivers/input/serio/q40kbd.c
@@ -156,7 +156,7 @@ static int __init q40kbd_init(void)
156 int error; 156 int error;
157 157
158 if (!MACH_IS_Q40) 158 if (!MACH_IS_Q40)
159 return -EIO; 159 return -ENODEV;
160 160
161 error = platform_driver_register(&q40kbd_driver); 161 error = platform_driver_register(&q40kbd_driver);
162 if (error) 162 if (error)
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index c5a8661a1baa..1e748e46d12e 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -830,7 +830,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
830 struct gtco *gtco; 830 struct gtco *gtco;
831 struct input_dev *input_dev; 831 struct input_dev *input_dev;
832 struct hid_descriptor *hid_desc; 832 struct hid_descriptor *hid_desc;
833 char *report = NULL; 833 char *report;
834 int result = 0, retry; 834 int result = 0, retry;
835 int error; 835 int error;
836 struct usb_endpoint_descriptor *endpoint; 836 struct usb_endpoint_descriptor *endpoint;
@@ -916,12 +916,16 @@ static int gtco_probe(struct usb_interface *usbinterface,
916 le16_to_cpu(hid_desc->wDescriptorLength), 916 le16_to_cpu(hid_desc->wDescriptorLength),
917 5000); /* 5 secs */ 917 5000); /* 5 secs */
918 918
919 if (result == le16_to_cpu(hid_desc->wDescriptorLength)) 919 dbg("usb_control_msg result: %d", result);
920 if (result == le16_to_cpu(hid_desc->wDescriptorLength)) {
921 parse_hid_report_descriptor(gtco, report, result);
920 break; 922 break;
923 }
921 } 924 }
922 925
926 kfree(report);
927
923 /* If we didn't get the report, fail */ 928 /* If we didn't get the report, fail */
924 dbg("usb_control_msg result: :%d", result);
925 if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { 929 if (result != le16_to_cpu(hid_desc->wDescriptorLength)) {
926 err("Failed to get HID Report Descriptor of size: %d", 930 err("Failed to get HID Report Descriptor of size: %d",
927 hid_desc->wDescriptorLength); 931 hid_desc->wDescriptorLength);
@@ -929,12 +933,6 @@ static int gtco_probe(struct usb_interface *usbinterface,
929 goto err_free_urb; 933 goto err_free_urb;
930 } 934 }
931 935
932 /* Now we parse the report */
933 parse_hid_report_descriptor(gtco, report, result);
934
935 /* Now we delete it */
936 kfree(report);
937
938 /* Create a device file node */ 936 /* Create a device file node */
939 usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); 937 usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath));
940 strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); 938 strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath));
@@ -988,7 +986,6 @@ static int gtco_probe(struct usb_interface *usbinterface,
988 usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, 986 usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE,
989 gtco->buffer, gtco->buf_dma); 987 gtco->buffer, gtco->buf_dma);
990 err_free_devs: 988 err_free_devs:
991 kfree(report);
992 input_free_device(input_dev); 989 input_free_device(input_dev);
993 kfree(gtco); 990 kfree(gtco);
994 return error; 991 return error;
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c
index 742242111bf1..1aca108b1031 100644
--- a/drivers/input/touchscreen/jornada720_ts.c
+++ b/drivers/input/touchscreen/jornada720_ts.c
@@ -24,7 +24,7 @@
24 24
25MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); 25MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
26MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver"); 26MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver");
27MODULE_LICENSE("GPLv2"); 27MODULE_LICENSE("GPL v2");
28 28
29struct jornada_ts { 29struct jornada_ts {
30 struct input_dev *dev; 30 struct input_dev *dev;
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c
index 01278bd7e65c..838458792ea0 100644
--- a/drivers/input/touchscreen/wm9713.c
+++ b/drivers/input/touchscreen/wm9713.c
@@ -85,6 +85,15 @@ module_param(delay, int, 0);
85MODULE_PARM_DESC(delay, "Set adc sample delay."); 85MODULE_PARM_DESC(delay, "Set adc sample delay.");
86 86
87/* 87/*
88 * Set five_wire = 1 to use a 5 wire touchscreen.
89 *
90 * NOTE: Five wire mode does not allow for readback of pressure.
91 */
92static int five_wire;
93module_param(five_wire, int, 0);
94MODULE_PARM_DESC(five_wire, "Set to '1' to use 5-wire touchscreen.");
95
96/*
88 * Set adc mask function. 97 * Set adc mask function.
89 * 98 *
90 * Sources of glitch noise, such as signals driving an LCD display, may feed 99 * Sources of glitch noise, such as signals driving an LCD display, may feed
@@ -162,6 +171,19 @@ static void wm9713_phy_init(struct wm97xx *wm)
162 64000 / rpu); 171 64000 / rpu);
163 } 172 }
164 173
174 /* Five wire panel? */
175 if (five_wire) {
176 dig3 |= WM9713_45W;
177 dev_info(wm->dev, "setting 5-wire touchscreen mode.");
178
179 if (pil) {
180 dev_warn(wm->dev,
181 "Pressure measurement not supported in 5 "
182 "wire mode, disabling\n");
183 pil = 0;
184 }
185 }
186
165 /* touchpanel pressure */ 187 /* touchpanel pressure */
166 if (pil == 2) { 188 if (pil == 2) {
167 dig3 |= WM9712_PIL; 189 dig3 |= WM9712_PIL;
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index e9c7ea46b6e3..cdc24ad314e0 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -608,6 +608,17 @@ static int wm97xx_probe(struct device *dev)
608 goto alloc_err; 608 goto alloc_err;
609 } 609 }
610 610
611 /* set up physical characteristics */
612 wm->codec->phy_init(wm);
613
614 /* load gpio cache */
615 wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG);
616 wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
617 wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY);
618 wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP);
619 wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
620 wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE);
621
611 wm->input_dev = input_allocate_device(); 622 wm->input_dev = input_allocate_device();
612 if (wm->input_dev == NULL) { 623 if (wm->input_dev == NULL) {
613 ret = -ENOMEM; 624 ret = -ENOMEM;
@@ -616,6 +627,7 @@ static int wm97xx_probe(struct device *dev)
616 627
617 /* set up touch configuration */ 628 /* set up touch configuration */
618 wm->input_dev->name = "wm97xx touchscreen"; 629 wm->input_dev->name = "wm97xx touchscreen";
630 wm->input_dev->phys = "wm97xx";
619 wm->input_dev->open = wm97xx_ts_input_open; 631 wm->input_dev->open = wm97xx_ts_input_open;
620 wm->input_dev->close = wm97xx_ts_input_close; 632 wm->input_dev->close = wm97xx_ts_input_close;
621 set_bit(EV_ABS, wm->input_dev->evbit); 633 set_bit(EV_ABS, wm->input_dev->evbit);
@@ -634,17 +646,6 @@ static int wm97xx_probe(struct device *dev)
634 if (ret < 0) 646 if (ret < 0)
635 goto dev_alloc_err; 647 goto dev_alloc_err;
636 648
637 /* set up physical characteristics */
638 wm->codec->phy_init(wm);
639
640 /* load gpio cache */
641 wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG);
642 wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
643 wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY);
644 wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP);
645 wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
646 wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE);
647
648 /* register our battery device */ 649 /* register our battery device */
649 wm->battery_dev = platform_device_alloc("wm97xx-battery", -1); 650 wm->battery_dev = platform_device_alloc("wm97xx-battery", -1);
650 if (!wm->battery_dev) { 651 if (!wm->battery_dev) {
@@ -801,7 +802,7 @@ void wm97xx_unregister_mach_ops(struct wm97xx *wm)
801EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops); 802EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops);
802 803
803static struct device_driver wm97xx_driver = { 804static struct device_driver wm97xx_driver = {
804 .name = "ac97", 805 .name = "wm97xx-ts",
805 .bus = &ac97_bus_type, 806 .bus = &ac97_bus_type,
806 .owner = THIS_MODULE, 807 .owner = THIS_MODULE,
807 .probe = wm97xx_probe, 808 .probe = wm97xx_probe,
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index ebef4ce1b00c..29419a8d31dc 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -948,17 +948,17 @@ int __init cdebug_init(void)
948{ 948{
949 g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL); 949 g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL);
950 if (!g_cmsg) 950 if (!g_cmsg)
951 return ENOMEM; 951 return -ENOMEM;
952 g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL); 952 g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL);
953 if (!g_debbuf) { 953 if (!g_debbuf) {
954 kfree(g_cmsg); 954 kfree(g_cmsg);
955 return ENOMEM; 955 return -ENOMEM;
956 } 956 }
957 g_debbuf->buf = kmalloc(CDEBUG_GSIZE, GFP_KERNEL); 957 g_debbuf->buf = kmalloc(CDEBUG_GSIZE, GFP_KERNEL);
958 if (!g_debbuf->buf) { 958 if (!g_debbuf->buf) {
959 kfree(g_cmsg); 959 kfree(g_cmsg);
960 kfree(g_debbuf); 960 kfree(g_debbuf);
961 return ENOMEM;; 961 return -ENOMEM;;
962 } 962 }
963 g_debbuf->size = CDEBUG_GSIZE; 963 g_debbuf->size = CDEBUG_GSIZE;
964 g_debbuf->buf[0] = 0; 964 g_debbuf->buf[0] = 0;
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index 5fcbdccd7a53..16a874bb1561 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -806,7 +806,6 @@ static int DIVA_INIT_FUNCTION divas_init(void)
806 806
807 if (!create_divas_proc()) { 807 if (!create_divas_proc()) {
808#ifdef MODULE 808#ifdef MODULE
809 remove_divas_proc();
810 divas_unregister_chrdev(); 809 divas_unregister_chrdev();
811 divasfunc_exit(); 810 divasfunc_exit();
812#endif 811#endif
diff --git a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c
index fae895828a17..040827288ec9 100644
--- a/drivers/isdn/hardware/eicon/divasproc.c
+++ b/drivers/isdn/hardware/eicon/divasproc.c
@@ -125,8 +125,8 @@ static const struct file_operations divas_fops = {
125 125
126int create_divas_proc(void) 126int create_divas_proc(void)
127{ 127{
128 proc_create(divas_proc_name, S_IFREG | S_IRUGO, proc_net_eicon, 128 divas_proc_entry = proc_create(divas_proc_name, S_IFREG | S_IRUGO,
129 &divas_fops); 129 proc_net_eicon, &divas_fops);
130 if (!divas_proc_entry) 130 if (!divas_proc_entry)
131 return (0); 131 return (0);
132 132
diff --git a/drivers/isdn/hysdn/Kconfig b/drivers/isdn/hysdn/Kconfig
index c6d8a7042988..c9e4231968ef 100644
--- a/drivers/isdn/hysdn/Kconfig
+++ b/drivers/isdn/hysdn/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4config HYSDN 4config HYSDN
5 tristate "Hypercope HYSDN cards (Champ, Ergo, Metro) support (module only)" 5 tristate "Hypercope HYSDN cards (Champ, Ergo, Metro) support (module only)"
6 depends on m && PROC_FS && PCI && BROKEN_ON_SMP 6 depends on m && PROC_FS && PCI
7 help 7 help
8 Say Y here if you have one of Hypercope's active PCI ISDN cards 8 Say Y here if you have one of Hypercope's active PCI ISDN cards
9 Champ, Ergo and Metro. You will then get a module called hysdn. 9 Champ, Ergo and Metro. You will then get a module called hysdn.
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index 6cdbad3a9926..3eb096f0ae1b 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -64,10 +64,11 @@ ergo_interrupt(int intno, void *dev_id)
64} /* ergo_interrupt */ 64} /* ergo_interrupt */
65 65
66/******************************************************************************/ 66/******************************************************************************/
67/* ergo_irq_bh is the function called by the immediate kernel task list after */ 67/* ergo_irq_bh will be called as part of the kernel clearing its shared work */
68/* being activated with queue_task and no interrupts active. This task is the */ 68/* queue sometime after a call to schedule_work has been made passing our */
69/* only one handling data transfer from or to the card after booting. The task */ 69/* work_struct. This task is the only one handling data transfer from or to */
70/* may be queued from everywhere (interrupts included). */ 70/* the card after booting. The task may be queued from everywhere */
71/* (interrupts included). */
71/******************************************************************************/ 72/******************************************************************************/
72static void 73static void
73ergo_irq_bh(struct work_struct *ugli_api) 74ergo_irq_bh(struct work_struct *ugli_api)
@@ -90,7 +91,6 @@ ergo_irq_bh(struct work_struct *ugli_api)
90 card->hw_lock = 1; /* we now lock the hardware */ 91 card->hw_lock = 1; /* we now lock the hardware */
91 92
92 do { 93 do {
93 sti(); /* reenable other ints */
94 again = 0; /* assume loop not to be repeated */ 94 again = 0; /* assume loop not to be repeated */
95 95
96 if (!dpr->ToHyFlag) { 96 if (!dpr->ToHyFlag) {
@@ -110,7 +110,6 @@ ergo_irq_bh(struct work_struct *ugli_api)
110 again = 1; /* restart loop */ 110 again = 1; /* restart loop */
111 } 111 }
112 } /* a message has arrived for us */ 112 } /* a message has arrived for us */
113 cli(); /* no further ints */
114 if (again) { 113 if (again) {
115 dpr->ToHyInt = 1; 114 dpr->ToHyInt = 1;
116 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ 115 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */
@@ -242,7 +241,6 @@ ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf,
242 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */ 241 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */
243 /* the interrupts are still masked */ 242 /* the interrupts are still masked */
244 243
245 sti();
246 msleep_interruptible(20); /* Timeout 20ms */ 244 msleep_interruptible(20); /* Timeout 20ms */
247 245
248 if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) { 246 if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) {
@@ -276,7 +274,6 @@ ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len)
276 dst = sp->Data; /* point to data in spool structure */ 274 dst = sp->Data; /* point to data in spool structure */
277 buflen = sp->Len; /* maximum len of spooled data */ 275 buflen = sp->Len; /* maximum len of spooled data */
278 wr_mirror = sp->WrPtr; /* only once read */ 276 wr_mirror = sp->WrPtr; /* only once read */
279 sti();
280 277
281 /* try until all bytes written or error */ 278 /* try until all bytes written or error */
282 i = 0x1000; /* timeout value */ 279 i = 0x1000; /* timeout value */
@@ -380,7 +377,6 @@ ergo_waitpofready(struct HYSDN_CARD *card)
380#endif /* CONFIG_HYSDN_CAPI */ 377#endif /* CONFIG_HYSDN_CAPI */
381 return (0); /* success */ 378 return (0); /* success */
382 } /* data has arrived */ 379 } /* data has arrived */
383 sti();
384 msleep_interruptible(50); /* Timeout 50ms */ 380 msleep_interruptible(50); /* Timeout 50ms */
385 } /* wait until timeout */ 381 } /* wait until timeout */
386 382
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c
index d3999a8e9f88..53f6ad1235db 100644
--- a/drivers/isdn/hysdn/hycapi.c
+++ b/drivers/isdn/hysdn/hycapi.c
@@ -462,11 +462,11 @@ static int hycapi_read_proc(char *page, char **start, off_t off,
462 default: s = "???"; break; 462 default: s = "???"; break;
463 } 463 }
464 len += sprintf(page+len, "%-16s %s\n", "type", s); 464 len += sprintf(page+len, "%-16s %s\n", "type", s);
465 if ((s = cinfo->version[VER_DRIVER]) != 0) 465 if ((s = cinfo->version[VER_DRIVER]) != NULL)
466 len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); 466 len += sprintf(page+len, "%-16s %s\n", "ver_driver", s);
467 if ((s = cinfo->version[VER_CARDTYPE]) != 0) 467 if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
468 len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); 468 len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s);
469 if ((s = cinfo->version[VER_SERIAL]) != 0) 469 if ((s = cinfo->version[VER_SERIAL]) != NULL)
470 len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); 470 len += sprintf(page+len, "%-16s %s\n", "ver_serial", s);
471 471
472 len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); 472 len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname);
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c
index 15906d005b05..484299b031f8 100644
--- a/drivers/isdn/hysdn/hysdn_procconf.c
+++ b/drivers/isdn/hysdn/hysdn_procconf.c
@@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t
207/* read conf file -> output card info data */ 207/* read conf file -> output card info data */
208/*******************************************/ 208/*******************************************/
209static ssize_t 209static ssize_t
210hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off) 210hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t *off)
211{ 211{
212 char *cp; 212 char *cp;
213 int i;
214 213
215 if (file->f_mode & FMODE_READ) { 214 if (!(file->f_mode & FMODE_READ))
216 if (!(cp = file->private_data)) 215 return -EPERM; /* no permission to read */
217 return (-EFAULT); /* should never happen */ 216
218 i = strlen(cp); /* get total string length */ 217 if (!(cp = file->private_data))
219 if (*off < i) { 218 return -EFAULT; /* should never happen */
220 /* still bytes to transfer */ 219
221 cp += *off; /* point to desired data offset */ 220 return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
222 i -= *off; /* remaining length */
223 if (i > count)
224 i = count; /* limit length to transfer */
225 if (copy_to_user(buf, cp, i))
226 return (-EFAULT); /* copy error */
227 *off += i; /* adjust offset */
228 } else
229 return (0);
230 } else
231 return (-EPERM); /* no permission to read */
232
233 return (i);
234} /* hysdn_conf_read */ 221} /* hysdn_conf_read */
235 222
236/******************/ 223/******************/
diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c
index 7817d2244921..1081091bbfaf 100644
--- a/drivers/isdn/sc/ioctl.c
+++ b/drivers/isdn/sc/ioctl.c
@@ -226,6 +226,7 @@ int sc_ioctl(int card, scs_ioctl *data)
226 */ 226 */
227 if (copy_from_user(spid, data->dataptr, SCIOC_SPIDSIZE)) { 227 if (copy_from_user(spid, data->dataptr, SCIOC_SPIDSIZE)) {
228 kfree(rcvmsg); 228 kfree(rcvmsg);
229 kfree(spid);
229 return -EFAULT; 230 return -EFAULT;
230 } 231 }
231 232
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index b3c54be74556..559a40861c39 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
103{ 103{
104 int rc; 104 int rc;
105 105
106 led_cdev->dev = device_create(leds_class, parent, 0, "%s", 106 led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev,
107 led_cdev->name); 107 "%s", led_cdev->name);
108 if (IS_ERR(led_cdev->dev)) 108 if (IS_ERR(led_cdev->dev))
109 return PTR_ERR(led_cdev->dev); 109 return PTR_ERR(led_cdev->dev);
110 110
111 dev_set_drvdata(led_cdev->dev, led_cdev);
112
113 /* register the attributes */ 111 /* register the attributes */
114 rc = device_create_file(led_cdev->dev, &dev_attr_brightness); 112 rc = device_create_file(led_cdev->dev, &dev_attr_brightness);
115 if (rc) 113 if (rc)
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 8080249957af..1a8de57289eb 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -20,14 +20,11 @@
20/* The pointer to our (page) of device descriptions. */ 20/* The pointer to our (page) of device descriptions. */
21static void *lguest_devices; 21static void *lguest_devices;
22 22
23/* Unique numbering for lguest devices. */
24static unsigned int dev_index;
25
26/* For Guests, device memory can be used as normal memory, so we cast away the 23/* For Guests, device memory can be used as normal memory, so we cast away the
27 * __iomem to quieten sparse. */ 24 * __iomem to quieten sparse. */
28static inline void *lguest_map(unsigned long phys_addr, unsigned long pages) 25static inline void *lguest_map(unsigned long phys_addr, unsigned long pages)
29{ 26{
30 return (__force void *)ioremap(phys_addr, PAGE_SIZE*pages); 27 return (__force void *)ioremap_cache(phys_addr, PAGE_SIZE*pages);
31} 28}
32 29
33static inline void lguest_unmap(void *addr) 30static inline void lguest_unmap(void *addr)
@@ -325,8 +322,10 @@ static struct device lguest_root = {
325 * As Andrew Tridgell says, "Untested code is buggy code". 322 * As Andrew Tridgell says, "Untested code is buggy code".
326 * 323 *
327 * It's worth reading this carefully: we start with a pointer to the new device 324 * It's worth reading this carefully: we start with a pointer to the new device
328 * descriptor in the "lguest_devices" page. */ 325 * descriptor in the "lguest_devices" page, and the offset into the device
329static void add_lguest_device(struct lguest_device_desc *d) 326 * descriptor page so we can uniquely identify it if things go badly wrong. */
327static void add_lguest_device(struct lguest_device_desc *d,
328 unsigned int offset)
330{ 329{
331 struct lguest_device *ldev; 330 struct lguest_device *ldev;
332 331
@@ -334,18 +333,14 @@ static void add_lguest_device(struct lguest_device_desc *d)
334 * it. */ 333 * it. */
335 ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); 334 ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
336 if (!ldev) { 335 if (!ldev) {
337 printk(KERN_EMERG "Cannot allocate lguest dev %u\n", 336 printk(KERN_EMERG "Cannot allocate lguest dev %u type %u\n",
338 dev_index++); 337 offset, d->type);
339 return; 338 return;
340 } 339 }
341 340
342 /* This devices' parent is the lguest/ dir. */ 341 /* This devices' parent is the lguest/ dir. */
343 ldev->vdev.dev.parent = &lguest_root; 342 ldev->vdev.dev.parent = &lguest_root;
344 /* We have a unique device index thanks to the dev_index counter. */ 343 /* We have a unique device index thanks to the dev_index counter. */
345 ldev->vdev.index = dev_index++;
346 /* The device type comes straight from the descriptor. There's also a
347 * device vendor field in the virtio_device struct, which we leave as
348 * 0. */
349 ldev->vdev.id.device = d->type; 344 ldev->vdev.id.device = d->type;
350 /* We have a simple set of routines for querying the device's 345 /* We have a simple set of routines for querying the device's
351 * configuration information and setting its status. */ 346 * configuration information and setting its status. */
@@ -357,8 +352,8 @@ static void add_lguest_device(struct lguest_device_desc *d)
357 * virtio_device and calls device_register(). This makes the bus 352 * virtio_device and calls device_register(). This makes the bus
358 * infrastructure look for a matching driver. */ 353 * infrastructure look for a matching driver. */
359 if (register_virtio_device(&ldev->vdev) != 0) { 354 if (register_virtio_device(&ldev->vdev) != 0) {
360 printk(KERN_ERR "Failed to register lguest device %u\n", 355 printk(KERN_ERR "Failed to register lguest dev %u type %u\n",
361 ldev->vdev.index); 356 offset, d->type);
362 kfree(ldev); 357 kfree(ldev);
363 } 358 }
364} 359}
@@ -379,7 +374,7 @@ static void scan_devices(void)
379 break; 374 break;
380 375
381 printk("Device at %i has size %u\n", i, desc_size(d)); 376 printk("Device at %i has size %u\n", i, desc_size(d));
382 add_lguest_device(d); 377 add_lguest_device(d, i);
383 } 378 }
384} 379}
385 380
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index b8b9e44f7f4e..dbaad39020a1 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -334,7 +334,7 @@ int __init adb_init(void)
334 return 0; 334 return 0;
335} 335}
336 336
337__initcall(adb_init); 337device_initcall(adb_init);
338 338
339static int 339static int
340do_adb_reset_bus(void) 340do_adb_reset_bus(void)
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 82add26cc665..c34bdf852e32 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -556,7 +556,8 @@ static void media_bay_step(int i)
556 printk("mediabay %d, registering IDE...\n", i); 556 printk("mediabay %d, registering IDE...\n", i);
557 pmu_suspend(); 557 pmu_suspend();
558 ide_port_scan(bay->cd_port); 558 ide_port_scan(bay->cd_port);
559 bay->cd_index = bay->cd_port->index; 559 if (bay->cd_port->present)
560 bay->cd_index = bay->cd_port->index;
560 pmu_resume(); 561 pmu_resume();
561 } 562 }
562 if (bay->cd_index == -1) { 563 if (bay->cd_index == -1) {
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index c14dacdacfac..b26927ce889c 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -203,17 +203,6 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
203 * bitmap file handling - read and write the bitmap file and its superblock 203 * bitmap file handling - read and write the bitmap file and its superblock
204 */ 204 */
205 205
206/* copy the pathname of a file to a buffer */
207char *file_path(struct file *file, char *buf, int count)
208{
209 if (!buf)
210 return NULL;
211
212 buf = d_path(&file->f_path, buf, count);
213
214 return IS_ERR(buf) ? NULL : buf;
215}
216
217/* 206/*
218 * basic page I/O operations 207 * basic page I/O operations
219 */ 208 */
@@ -721,11 +710,13 @@ static void bitmap_file_kick(struct bitmap *bitmap)
721 if (bitmap->file) { 710 if (bitmap->file) {
722 path = kmalloc(PAGE_SIZE, GFP_KERNEL); 711 path = kmalloc(PAGE_SIZE, GFP_KERNEL);
723 if (path) 712 if (path)
724 ptr = file_path(bitmap->file, path, PAGE_SIZE); 713 ptr = d_path(&bitmap->file->f_path, path,
714 PAGE_SIZE);
715
725 716
726 printk(KERN_ALERT 717 printk(KERN_ALERT
727 "%s: kicking failed bitmap file %s from array!\n", 718 "%s: kicking failed bitmap file %s from array!\n",
728 bmname(bitmap), ptr ? ptr : ""); 719 bmname(bitmap), IS_ERR(ptr) ? "" : ptr);
729 720
730 kfree(path); 721 kfree(path);
731 } else 722 } else
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 0b8511776b3e..10748240cb2f 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -250,6 +250,7 @@ static int linear_run (mddev_t *mddev)
250{ 250{
251 linear_conf_t *conf; 251 linear_conf_t *conf;
252 252
253 mddev->queue->queue_lock = &mddev->queue->__queue_lock;
253 conf = linear_conf(mddev, mddev->raid_disks); 254 conf = linear_conf(mddev, mddev->raid_disks);
254 255
255 if (!conf) 256 if (!conf)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 83eb78b00137..7cf512a34ccf 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -74,6 +74,8 @@ static DEFINE_SPINLOCK(pers_lock);
74 74
75static void md_print_devices(void); 75static void md_print_devices(void);
76 76
77static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
78
77#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } 79#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
78 80
79/* 81/*
@@ -274,6 +276,7 @@ static mddev_t * mddev_find(dev_t unit)
274 atomic_set(&new->active, 1); 276 atomic_set(&new->active, 1);
275 spin_lock_init(&new->write_lock); 277 spin_lock_init(&new->write_lock);
276 init_waitqueue_head(&new->sb_wait); 278 init_waitqueue_head(&new->sb_wait);
279 init_waitqueue_head(&new->recovery_wait);
277 new->reshape_position = MaxSector; 280 new->reshape_position = MaxSector;
278 new->resync_max = MaxSector; 281 new->resync_max = MaxSector;
279 new->level = LEVEL_NONE; 282 new->level = LEVEL_NONE;
@@ -3013,6 +3016,36 @@ degraded_show(mddev_t *mddev, char *page)
3013static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); 3016static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
3014 3017
3015static ssize_t 3018static ssize_t
3019sync_force_parallel_show(mddev_t *mddev, char *page)
3020{
3021 return sprintf(page, "%d\n", mddev->parallel_resync);
3022}
3023
3024static ssize_t
3025sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len)
3026{
3027 long n;
3028
3029 if (strict_strtol(buf, 10, &n))
3030 return -EINVAL;
3031
3032 if (n != 0 && n != 1)
3033 return -EINVAL;
3034
3035 mddev->parallel_resync = n;
3036
3037 if (mddev->sync_thread)
3038 wake_up(&resync_wait);
3039
3040 return len;
3041}
3042
3043/* force parallel resync, even with shared block devices */
3044static struct md_sysfs_entry md_sync_force_parallel =
3045__ATTR(sync_force_parallel, S_IRUGO|S_IWUSR,
3046 sync_force_parallel_show, sync_force_parallel_store);
3047
3048static ssize_t
3016sync_speed_show(mddev_t *mddev, char *page) 3049sync_speed_show(mddev_t *mddev, char *page)
3017{ 3050{
3018 unsigned long resync, dt, db; 3051 unsigned long resync, dt, db;
@@ -3187,6 +3220,7 @@ static struct attribute *md_redundancy_attrs[] = {
3187 &md_sync_min.attr, 3220 &md_sync_min.attr,
3188 &md_sync_max.attr, 3221 &md_sync_max.attr,
3189 &md_sync_speed.attr, 3222 &md_sync_speed.attr,
3223 &md_sync_force_parallel.attr,
3190 &md_sync_completed.attr, 3224 &md_sync_completed.attr,
3191 &md_max_sync.attr, 3225 &md_max_sync.attr,
3192 &md_suspend_lo.attr, 3226 &md_suspend_lo.attr,
@@ -3691,6 +3725,8 @@ static int do_md_stop(mddev_t * mddev, int mode)
3691 3725
3692 module_put(mddev->pers->owner); 3726 module_put(mddev->pers->owner);
3693 mddev->pers = NULL; 3727 mddev->pers = NULL;
3728 /* tell userspace to handle 'inactive' */
3729 sysfs_notify(&mddev->kobj, NULL, "array_state");
3694 3730
3695 set_capacity(disk, 0); 3731 set_capacity(disk, 0);
3696 mddev->changed = 1; 3732 mddev->changed = 1;
@@ -3987,8 +4023,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg)
3987 if (!buf) 4023 if (!buf)
3988 goto out; 4024 goto out;
3989 4025
3990 ptr = file_path(mddev->bitmap->file, buf, sizeof(file->pathname)); 4026 ptr = d_path(&mddev->bitmap->file->f_path, buf, sizeof(file->pathname));
3991 if (!ptr) 4027 if (IS_ERR(ptr))
3992 goto out; 4028 goto out;
3993 4029
3994 strcpy(file->pathname, ptr); 4030 strcpy(file->pathname, ptr);
@@ -5399,7 +5435,7 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok)
5399 atomic_sub(blocks, &mddev->recovery_active); 5435 atomic_sub(blocks, &mddev->recovery_active);
5400 wake_up(&mddev->recovery_wait); 5436 wake_up(&mddev->recovery_wait);
5401 if (!ok) { 5437 if (!ok) {
5402 set_bit(MD_RECOVERY_ERR, &mddev->recovery); 5438 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
5403 md_wakeup_thread(mddev->thread); 5439 md_wakeup_thread(mddev->thread);
5404 // stop recovery, signal do_sync .... 5440 // stop recovery, signal do_sync ....
5405 } 5441 }
@@ -5435,8 +5471,11 @@ void md_write_start(mddev_t *mddev, struct bio *bi)
5435 md_wakeup_thread(mddev->thread); 5471 md_wakeup_thread(mddev->thread);
5436 } 5472 }
5437 spin_unlock_irq(&mddev->write_lock); 5473 spin_unlock_irq(&mddev->write_lock);
5474 sysfs_notify(&mddev->kobj, NULL, "array_state");
5438 } 5475 }
5439 wait_event(mddev->sb_wait, mddev->flags==0); 5476 wait_event(mddev->sb_wait,
5477 !test_bit(MD_CHANGE_CLEAN, &mddev->flags) &&
5478 !test_bit(MD_CHANGE_PENDING, &mddev->flags));
5440} 5479}
5441 5480
5442void md_write_end(mddev_t *mddev) 5481void md_write_end(mddev_t *mddev)
@@ -5471,13 +5510,17 @@ void md_allow_write(mddev_t *mddev)
5471 mddev->safemode = 1; 5510 mddev->safemode = 1;
5472 spin_unlock_irq(&mddev->write_lock); 5511 spin_unlock_irq(&mddev->write_lock);
5473 md_update_sb(mddev, 0); 5512 md_update_sb(mddev, 0);
5513
5514 sysfs_notify(&mddev->kobj, NULL, "array_state");
5515 /* wait for the dirty state to be recorded in the metadata */
5516 wait_event(mddev->sb_wait,
5517 !test_bit(MD_CHANGE_CLEAN, &mddev->flags) &&
5518 !test_bit(MD_CHANGE_PENDING, &mddev->flags));
5474 } else 5519 } else
5475 spin_unlock_irq(&mddev->write_lock); 5520 spin_unlock_irq(&mddev->write_lock);
5476} 5521}
5477EXPORT_SYMBOL_GPL(md_allow_write); 5522EXPORT_SYMBOL_GPL(md_allow_write);
5478 5523
5479static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
5480
5481#define SYNC_MARKS 10 5524#define SYNC_MARKS 10
5482#define SYNC_MARK_STEP (3*HZ) 5525#define SYNC_MARK_STEP (3*HZ)
5483void md_do_sync(mddev_t *mddev) 5526void md_do_sync(mddev_t *mddev)
@@ -5541,8 +5584,9 @@ void md_do_sync(mddev_t *mddev)
5541 for_each_mddev(mddev2, tmp) { 5584 for_each_mddev(mddev2, tmp) {
5542 if (mddev2 == mddev) 5585 if (mddev2 == mddev)
5543 continue; 5586 continue;
5544 if (mddev2->curr_resync && 5587 if (!mddev->parallel_resync
5545 match_mddev_units(mddev,mddev2)) { 5588 && mddev2->curr_resync
5589 && match_mddev_units(mddev, mddev2)) {
5546 DEFINE_WAIT(wq); 5590 DEFINE_WAIT(wq);
5547 if (mddev < mddev2 && mddev->curr_resync == 2) { 5591 if (mddev < mddev2 && mddev->curr_resync == 2) {
5548 /* arbitrarily yield */ 5592 /* arbitrarily yield */
@@ -5622,7 +5666,6 @@ void md_do_sync(mddev_t *mddev)
5622 window/2,(unsigned long long) max_sectors/2); 5666 window/2,(unsigned long long) max_sectors/2);
5623 5667
5624 atomic_set(&mddev->recovery_active, 0); 5668 atomic_set(&mddev->recovery_active, 0);
5625 init_waitqueue_head(&mddev->recovery_wait);
5626 last_check = 0; 5669 last_check = 0;
5627 5670
5628 if (j>2) { 5671 if (j>2) {
@@ -5647,7 +5690,7 @@ void md_do_sync(mddev_t *mddev)
5647 sectors = mddev->pers->sync_request(mddev, j, &skipped, 5690 sectors = mddev->pers->sync_request(mddev, j, &skipped,
5648 currspeed < speed_min(mddev)); 5691 currspeed < speed_min(mddev));
5649 if (sectors == 0) { 5692 if (sectors == 0) {
5650 set_bit(MD_RECOVERY_ERR, &mddev->recovery); 5693 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
5651 goto out; 5694 goto out;
5652 } 5695 }
5653 5696
@@ -5670,8 +5713,7 @@ void md_do_sync(mddev_t *mddev)
5670 5713
5671 last_check = io_sectors; 5714 last_check = io_sectors;
5672 5715
5673 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery) || 5716 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
5674 test_bit(MD_RECOVERY_ERR, &mddev->recovery))
5675 break; 5717 break;
5676 5718
5677 repeat: 5719 repeat:
@@ -5725,8 +5767,7 @@ void md_do_sync(mddev_t *mddev)
5725 /* tell personality that we are finished */ 5767 /* tell personality that we are finished */
5726 mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); 5768 mddev->pers->sync_request(mddev, max_sectors, &skipped, 1);
5727 5769
5728 if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && 5770 if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) &&
5729 !test_bit(MD_RECOVERY_CHECK, &mddev->recovery) &&
5730 mddev->curr_resync > 2) { 5771 mddev->curr_resync > 2) {
5731 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { 5772 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
5732 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { 5773 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
@@ -5795,7 +5836,10 @@ static int remove_and_add_spares(mddev_t *mddev)
5795 } 5836 }
5796 5837
5797 if (mddev->degraded) { 5838 if (mddev->degraded) {
5798 rdev_for_each(rdev, rtmp, mddev) 5839 rdev_for_each(rdev, rtmp, mddev) {
5840 if (rdev->raid_disk >= 0 &&
5841 !test_bit(In_sync, &rdev->flags))
5842 spares++;
5799 if (rdev->raid_disk < 0 5843 if (rdev->raid_disk < 0
5800 && !test_bit(Faulty, &rdev->flags)) { 5844 && !test_bit(Faulty, &rdev->flags)) {
5801 rdev->recovery_offset = 0; 5845 rdev->recovery_offset = 0;
@@ -5813,6 +5857,7 @@ static int remove_and_add_spares(mddev_t *mddev)
5813 } else 5857 } else
5814 break; 5858 break;
5815 } 5859 }
5860 }
5816 } 5861 }
5817 return spares; 5862 return spares;
5818} 5863}
@@ -5826,7 +5871,7 @@ static int remove_and_add_spares(mddev_t *mddev)
5826 * to do that as needed. 5871 * to do that as needed.
5827 * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in 5872 * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in
5828 * "->recovery" and create a thread at ->sync_thread. 5873 * "->recovery" and create a thread at ->sync_thread.
5829 * When the thread finishes it sets MD_RECOVERY_DONE (and might set MD_RECOVERY_ERR) 5874 * When the thread finishes it sets MD_RECOVERY_DONE
5830 * and wakeups up this thread which will reap the thread and finish up. 5875 * and wakeups up this thread which will reap the thread and finish up.
5831 * This thread also removes any faulty devices (with nr_pending == 0). 5876 * This thread also removes any faulty devices (with nr_pending == 0).
5832 * 5877 *
@@ -5901,8 +5946,7 @@ void md_check_recovery(mddev_t *mddev)
5901 /* resync has finished, collect result */ 5946 /* resync has finished, collect result */
5902 md_unregister_thread(mddev->sync_thread); 5947 md_unregister_thread(mddev->sync_thread);
5903 mddev->sync_thread = NULL; 5948 mddev->sync_thread = NULL;
5904 if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && 5949 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
5905 !test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
5906 /* success...*/ 5950 /* success...*/
5907 /* activate any spares */ 5951 /* activate any spares */
5908 mddev->pers->spare_active(mddev); 5952 mddev->pers->spare_active(mddev);
@@ -5926,7 +5970,6 @@ void md_check_recovery(mddev_t *mddev)
5926 * might be left set 5970 * might be left set
5927 */ 5971 */
5928 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 5972 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
5929 clear_bit(MD_RECOVERY_ERR, &mddev->recovery);
5930 clear_bit(MD_RECOVERY_INTR, &mddev->recovery); 5973 clear_bit(MD_RECOVERY_INTR, &mddev->recovery);
5931 clear_bit(MD_RECOVERY_DONE, &mddev->recovery); 5974 clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
5932 5975
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 42ee1a2dc144..e968116e0de9 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -327,7 +327,8 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
327 if (rdev) { 327 if (rdev) {
328 if (test_bit(In_sync, &rdev->flags) || 328 if (test_bit(In_sync, &rdev->flags) ||
329 atomic_read(&rdev->nr_pending)) { 329 atomic_read(&rdev->nr_pending)) {
330 printk(KERN_ERR "hot-remove-disk, slot %d is identified" " but is still operational!\n", number); 330 printk(KERN_ERR "hot-remove-disk, slot %d is identified"
331 " but is still operational!\n", number);
331 err = -EBUSY; 332 err = -EBUSY;
332 goto abort; 333 goto abort;
333 } 334 }
@@ -417,6 +418,7 @@ static int multipath_run (mddev_t *mddev)
417 * bookkeeping area. [whatever we allocate in multipath_run(), 418 * bookkeeping area. [whatever we allocate in multipath_run(),
418 * should be freed in multipath_stop()] 419 * should be freed in multipath_stop()]
419 */ 420 */
421 mddev->queue->queue_lock = &mddev->queue->__queue_lock;
420 422
421 conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); 423 conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL);
422 mddev->private = conf; 424 mddev->private = conf;
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 818b48284096..914c04ddec7c 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -280,6 +280,7 @@ static int raid0_run (mddev_t *mddev)
280 (mddev->chunk_size>>1)-1); 280 (mddev->chunk_size>>1)-1);
281 blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9); 281 blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9);
282 blk_queue_segment_boundary(mddev->queue, (mddev->chunk_size>>1) - 1); 282 blk_queue_segment_boundary(mddev->queue, (mddev->chunk_size>>1) - 1);
283 mddev->queue->queue_lock = &mddev->queue->__queue_lock;
283 284
284 conf = kmalloc(sizeof (raid0_conf_t), GFP_KERNEL); 285 conf = kmalloc(sizeof (raid0_conf_t), GFP_KERNEL);
285 if (!conf) 286 if (!conf)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 6778b7cb39bd..c610b947218a 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -773,7 +773,7 @@ static int make_request(struct request_queue *q, struct bio * bio)
773 r1bio_t *r1_bio; 773 r1bio_t *r1_bio;
774 struct bio *read_bio; 774 struct bio *read_bio;
775 int i, targets = 0, disks; 775 int i, targets = 0, disks;
776 struct bitmap *bitmap = mddev->bitmap; 776 struct bitmap *bitmap;
777 unsigned long flags; 777 unsigned long flags;
778 struct bio_list bl; 778 struct bio_list bl;
779 struct page **behind_pages = NULL; 779 struct page **behind_pages = NULL;
@@ -802,6 +802,8 @@ static int make_request(struct request_queue *q, struct bio * bio)
802 802
803 wait_barrier(conf); 803 wait_barrier(conf);
804 804
805 bitmap = mddev->bitmap;
806
805 disk_stat_inc(mddev->gendisk, ios[rw]); 807 disk_stat_inc(mddev->gendisk, ios[rw]);
806 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); 808 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio));
807 809
@@ -1025,7 +1027,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
1025 /* 1027 /*
1026 * if recovery is running, make sure it aborts. 1028 * if recovery is running, make sure it aborts.
1027 */ 1029 */
1028 set_bit(MD_RECOVERY_ERR, &mddev->recovery); 1030 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1029 } else 1031 } else
1030 set_bit(Faulty, &rdev->flags); 1032 set_bit(Faulty, &rdev->flags);
1031 set_bit(MD_CHANGE_DEVS, &mddev->flags); 1033 set_bit(MD_CHANGE_DEVS, &mddev->flags);
@@ -1146,6 +1148,14 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
1146 err = -EBUSY; 1148 err = -EBUSY;
1147 goto abort; 1149 goto abort;
1148 } 1150 }
1151 /* Only remove non-faulty devices is recovery
1152 * is not possible.
1153 */
1154 if (!test_bit(Faulty, &rdev->flags) &&
1155 mddev->degraded < conf->raid_disks) {
1156 err = -EBUSY;
1157 goto abort;
1158 }
1149 p->rdev = NULL; 1159 p->rdev = NULL;
1150 synchronize_rcu(); 1160 synchronize_rcu();
1151 if (atomic_read(&rdev->nr_pending)) { 1161 if (atomic_read(&rdev->nr_pending)) {
@@ -1282,6 +1292,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1282 rdev_dec_pending(conf->mirrors[i].rdev, mddev); 1292 rdev_dec_pending(conf->mirrors[i].rdev, mddev);
1283 } else { 1293 } else {
1284 /* fixup the bio for reuse */ 1294 /* fixup the bio for reuse */
1295 int size;
1285 sbio->bi_vcnt = vcnt; 1296 sbio->bi_vcnt = vcnt;
1286 sbio->bi_size = r1_bio->sectors << 9; 1297 sbio->bi_size = r1_bio->sectors << 9;
1287 sbio->bi_idx = 0; 1298 sbio->bi_idx = 0;
@@ -1295,10 +1306,20 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1295 sbio->bi_sector = r1_bio->sector + 1306 sbio->bi_sector = r1_bio->sector +
1296 conf->mirrors[i].rdev->data_offset; 1307 conf->mirrors[i].rdev->data_offset;
1297 sbio->bi_bdev = conf->mirrors[i].rdev->bdev; 1308 sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
1298 for (j = 0; j < vcnt ; j++) 1309 size = sbio->bi_size;
1299 memcpy(page_address(sbio->bi_io_vec[j].bv_page), 1310 for (j = 0; j < vcnt ; j++) {
1311 struct bio_vec *bi;
1312 bi = &sbio->bi_io_vec[j];
1313 bi->bv_offset = 0;
1314 if (size > PAGE_SIZE)
1315 bi->bv_len = PAGE_SIZE;
1316 else
1317 bi->bv_len = size;
1318 size -= PAGE_SIZE;
1319 memcpy(page_address(bi->bv_page),
1300 page_address(pbio->bi_io_vec[j].bv_page), 1320 page_address(pbio->bi_io_vec[j].bv_page),
1301 PAGE_SIZE); 1321 PAGE_SIZE);
1322 }
1302 1323
1303 } 1324 }
1304 } 1325 }
@@ -1935,6 +1956,9 @@ static int run(mddev_t *mddev)
1935 if (!conf->r1bio_pool) 1956 if (!conf->r1bio_pool)
1936 goto out_no_mem; 1957 goto out_no_mem;
1937 1958
1959 spin_lock_init(&conf->device_lock);
1960 mddev->queue->queue_lock = &conf->device_lock;
1961
1938 rdev_for_each(rdev, tmp, mddev) { 1962 rdev_for_each(rdev, tmp, mddev) {
1939 disk_idx = rdev->raid_disk; 1963 disk_idx = rdev->raid_disk;
1940 if (disk_idx >= mddev->raid_disks 1964 if (disk_idx >= mddev->raid_disks
@@ -1958,7 +1982,6 @@ static int run(mddev_t *mddev)
1958 } 1982 }
1959 conf->raid_disks = mddev->raid_disks; 1983 conf->raid_disks = mddev->raid_disks;
1960 conf->mddev = mddev; 1984 conf->mddev = mddev;
1961 spin_lock_init(&conf->device_lock);
1962 INIT_LIST_HEAD(&conf->retry_list); 1985 INIT_LIST_HEAD(&conf->retry_list);
1963 1986
1964 spin_lock_init(&conf->resync_lock); 1987 spin_lock_init(&conf->resync_lock);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index faf3d8912979..1de17da34a95 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1020,7 +1020,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
1020 /* 1020 /*
1021 * if recovery is running, make sure it aborts. 1021 * if recovery is running, make sure it aborts.
1022 */ 1022 */
1023 set_bit(MD_RECOVERY_ERR, &mddev->recovery); 1023 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1024 } 1024 }
1025 set_bit(Faulty, &rdev->flags); 1025 set_bit(Faulty, &rdev->flags);
1026 set_bit(MD_CHANGE_DEVS, &mddev->flags); 1026 set_bit(MD_CHANGE_DEVS, &mddev->flags);
@@ -1171,6 +1171,14 @@ static int raid10_remove_disk(mddev_t *mddev, int number)
1171 err = -EBUSY; 1171 err = -EBUSY;
1172 goto abort; 1172 goto abort;
1173 } 1173 }
1174 /* Only remove faulty devices in recovery
1175 * is not possible.
1176 */
1177 if (!test_bit(Faulty, &rdev->flags) &&
1178 enough(conf)) {
1179 err = -EBUSY;
1180 goto abort;
1181 }
1174 p->rdev = NULL; 1182 p->rdev = NULL;
1175 synchronize_rcu(); 1183 synchronize_rcu();
1176 if (atomic_read(&rdev->nr_pending)) { 1184 if (atomic_read(&rdev->nr_pending)) {
@@ -1237,6 +1245,7 @@ static void end_sync_write(struct bio *bio, int error)
1237 1245
1238 if (!uptodate) 1246 if (!uptodate)
1239 md_error(mddev, conf->mirrors[d].rdev); 1247 md_error(mddev, conf->mirrors[d].rdev);
1248
1240 update_head_pos(i, r10_bio); 1249 update_head_pos(i, r10_bio);
1241 1250
1242 while (atomic_dec_and_test(&r10_bio->remaining)) { 1251 while (atomic_dec_and_test(&r10_bio->remaining)) {
@@ -1844,7 +1853,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1844 if (rb2) 1853 if (rb2)
1845 atomic_dec(&rb2->remaining); 1854 atomic_dec(&rb2->remaining);
1846 r10_bio = rb2; 1855 r10_bio = rb2;
1847 if (!test_and_set_bit(MD_RECOVERY_ERR, &mddev->recovery)) 1856 if (!test_and_set_bit(MD_RECOVERY_INTR,
1857 &mddev->recovery))
1848 printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n", 1858 printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n",
1849 mdname(mddev)); 1859 mdname(mddev));
1850 break; 1860 break;
@@ -2082,6 +2092,9 @@ static int run(mddev_t *mddev)
2082 goto out_free_conf; 2092 goto out_free_conf;
2083 } 2093 }
2084 2094
2095 spin_lock_init(&conf->device_lock);
2096 mddev->queue->queue_lock = &conf->device_lock;
2097
2085 rdev_for_each(rdev, tmp, mddev) { 2098 rdev_for_each(rdev, tmp, mddev) {
2086 disk_idx = rdev->raid_disk; 2099 disk_idx = rdev->raid_disk;
2087 if (disk_idx >= mddev->raid_disks 2100 if (disk_idx >= mddev->raid_disks
@@ -2103,7 +2116,6 @@ static int run(mddev_t *mddev)
2103 2116
2104 disk->head_position = 0; 2117 disk->head_position = 0;
2105 } 2118 }
2106 spin_lock_init(&conf->device_lock);
2107 INIT_LIST_HEAD(&conf->retry_list); 2119 INIT_LIST_HEAD(&conf->retry_list);
2108 2120
2109 spin_lock_init(&conf->resync_lock); 2121 spin_lock_init(&conf->resync_lock);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 087eee0cb809..c37e256b1176 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -94,6 +94,8 @@
94#define __inline__ 94#define __inline__
95#endif 95#endif
96 96
97#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))
98
97#if !RAID6_USE_EMPTY_ZERO_PAGE 99#if !RAID6_USE_EMPTY_ZERO_PAGE
98/* In .bss so it's zeroed */ 100/* In .bss so it's zeroed */
99const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); 101const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
@@ -1143,10 +1145,12 @@ static void raid5_end_read_request(struct bio * bi, int error)
1143 set_bit(R5_UPTODATE, &sh->dev[i].flags); 1145 set_bit(R5_UPTODATE, &sh->dev[i].flags);
1144 if (test_bit(R5_ReadError, &sh->dev[i].flags)) { 1146 if (test_bit(R5_ReadError, &sh->dev[i].flags)) {
1145 rdev = conf->disks[i].rdev; 1147 rdev = conf->disks[i].rdev;
1146 printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", 1148 printk_rl(KERN_INFO "raid5:%s: read error corrected"
1147 mdname(conf->mddev), STRIPE_SECTORS, 1149 " (%lu sectors at %llu on %s)\n",
1148 (unsigned long long)(sh->sector + rdev->data_offset), 1150 mdname(conf->mddev), STRIPE_SECTORS,
1149 bdevname(rdev->bdev, b)); 1151 (unsigned long long)(sh->sector
1152 + rdev->data_offset),
1153 bdevname(rdev->bdev, b));
1150 clear_bit(R5_ReadError, &sh->dev[i].flags); 1154 clear_bit(R5_ReadError, &sh->dev[i].flags);
1151 clear_bit(R5_ReWrite, &sh->dev[i].flags); 1155 clear_bit(R5_ReWrite, &sh->dev[i].flags);
1152 } 1156 }
@@ -1160,16 +1164,22 @@ static void raid5_end_read_request(struct bio * bi, int error)
1160 clear_bit(R5_UPTODATE, &sh->dev[i].flags); 1164 clear_bit(R5_UPTODATE, &sh->dev[i].flags);
1161 atomic_inc(&rdev->read_errors); 1165 atomic_inc(&rdev->read_errors);
1162 if (conf->mddev->degraded) 1166 if (conf->mddev->degraded)
1163 printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", 1167 printk_rl(KERN_WARNING
1164 mdname(conf->mddev), 1168 "raid5:%s: read error not correctable "
1165 (unsigned long long)(sh->sector + rdev->data_offset), 1169 "(sector %llu on %s).\n",
1166 bdn); 1170 mdname(conf->mddev),
1171 (unsigned long long)(sh->sector
1172 + rdev->data_offset),
1173 bdn);
1167 else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) 1174 else if (test_bit(R5_ReWrite, &sh->dev[i].flags))
1168 /* Oh, no!!! */ 1175 /* Oh, no!!! */
1169 printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", 1176 printk_rl(KERN_WARNING
1170 mdname(conf->mddev), 1177 "raid5:%s: read error NOT corrected!! "
1171 (unsigned long long)(sh->sector + rdev->data_offset), 1178 "(sector %llu on %s).\n",
1172 bdn); 1179 mdname(conf->mddev),
1180 (unsigned long long)(sh->sector
1181 + rdev->data_offset),
1182 bdn);
1173 else if (atomic_read(&rdev->read_errors) 1183 else if (atomic_read(&rdev->read_errors)
1174 > conf->max_nr_stripes) 1184 > conf->max_nr_stripes)
1175 printk(KERN_WARNING 1185 printk(KERN_WARNING
@@ -1258,7 +1268,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
1258 /* 1268 /*
1259 * if recovery was running, make sure it aborts. 1269 * if recovery was running, make sure it aborts.
1260 */ 1270 */
1261 set_bit(MD_RECOVERY_ERR, &mddev->recovery); 1271 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1262 } 1272 }
1263 set_bit(Faulty, &rdev->flags); 1273 set_bit(Faulty, &rdev->flags);
1264 printk (KERN_ALERT 1274 printk (KERN_ALERT
@@ -1992,6 +2002,7 @@ static int __handle_issuing_new_read_requests5(struct stripe_head *sh,
1992 * have quiesced. 2002 * have quiesced.
1993 */ 2003 */
1994 if ((s->uptodate == disks - 1) && 2004 if ((s->uptodate == disks - 1) &&
2005 (s->failed && disk_idx == s->failed_num) &&
1995 !test_bit(STRIPE_OP_CHECK, &sh->ops.pending)) { 2006 !test_bit(STRIPE_OP_CHECK, &sh->ops.pending)) {
1996 set_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending); 2007 set_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending);
1997 set_bit(R5_Wantcompute, &dev->flags); 2008 set_bit(R5_Wantcompute, &dev->flags);
@@ -2077,7 +2088,9 @@ static void handle_issuing_new_read_requests6(struct stripe_head *sh,
2077 /* we would like to get this block, possibly 2088 /* we would like to get this block, possibly
2078 * by computing it, but we might not be able to 2089 * by computing it, but we might not be able to
2079 */ 2090 */
2080 if (s->uptodate == disks-1) { 2091 if ((s->uptodate == disks - 1) &&
2092 (s->failed && (i == r6s->failed_num[0] ||
2093 i == r6s->failed_num[1]))) {
2081 pr_debug("Computing stripe %llu block %d\n", 2094 pr_debug("Computing stripe %llu block %d\n",
2082 (unsigned long long)sh->sector, i); 2095 (unsigned long long)sh->sector, i);
2083 compute_block_1(sh, i, 0); 2096 compute_block_1(sh, i, 0);
@@ -2369,8 +2382,8 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
2369 2382
2370 /* complete a check operation */ 2383 /* complete a check operation */
2371 if (test_and_clear_bit(STRIPE_OP_CHECK, &sh->ops.complete)) { 2384 if (test_and_clear_bit(STRIPE_OP_CHECK, &sh->ops.complete)) {
2372 clear_bit(STRIPE_OP_CHECK, &sh->ops.ack); 2385 clear_bit(STRIPE_OP_CHECK, &sh->ops.ack);
2373 clear_bit(STRIPE_OP_CHECK, &sh->ops.pending); 2386 clear_bit(STRIPE_OP_CHECK, &sh->ops.pending);
2374 if (s->failed == 0) { 2387 if (s->failed == 0) {
2375 if (sh->ops.zero_sum_result == 0) 2388 if (sh->ops.zero_sum_result == 0)
2376 /* parity is correct (on disc, 2389 /* parity is correct (on disc,
@@ -2400,16 +2413,6 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
2400 canceled_check = 1; /* STRIPE_INSYNC is not set */ 2413 canceled_check = 1; /* STRIPE_INSYNC is not set */
2401 } 2414 }
2402 2415
2403 /* check if we can clear a parity disk reconstruct */
2404 if (test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete) &&
2405 test_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending)) {
2406
2407 clear_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending);
2408 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete);
2409 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.ack);
2410 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending);
2411 }
2412
2413 /* start a new check operation if there are no failures, the stripe is 2416 /* start a new check operation if there are no failures, the stripe is
2414 * not insync, and a repair is not in flight 2417 * not insync, and a repair is not in flight
2415 */ 2418 */
@@ -2424,6 +2427,17 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
2424 } 2427 }
2425 } 2428 }
2426 2429
2430 /* check if we can clear a parity disk reconstruct */
2431 if (test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete) &&
2432 test_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending)) {
2433
2434 clear_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending);
2435 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete);
2436 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.ack);
2437 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending);
2438 }
2439
2440
2427 /* Wait for check parity and compute block operations to complete 2441 /* Wait for check parity and compute block operations to complete
2428 * before write-back. If a failure occurred while the check operation 2442 * before write-back. If a failure occurred while the check operation
2429 * was in flight we need to cycle this stripe through handle_stripe 2443 * was in flight we need to cycle this stripe through handle_stripe
@@ -2634,6 +2648,7 @@ static void handle_stripe5(struct stripe_head *sh)
2634 struct r5dev *dev; 2648 struct r5dev *dev;
2635 unsigned long pending = 0; 2649 unsigned long pending = 0;
2636 mdk_rdev_t *blocked_rdev = NULL; 2650 mdk_rdev_t *blocked_rdev = NULL;
2651 int prexor;
2637 2652
2638 memset(&s, 0, sizeof(s)); 2653 memset(&s, 0, sizeof(s));
2639 pr_debug("handling stripe %llu, state=%#lx cnt=%d, pd_idx=%d " 2654 pr_debug("handling stripe %llu, state=%#lx cnt=%d, pd_idx=%d "
@@ -2763,9 +2778,11 @@ static void handle_stripe5(struct stripe_head *sh)
2763 /* leave prexor set until postxor is done, allows us to distinguish 2778 /* leave prexor set until postxor is done, allows us to distinguish
2764 * a rmw from a rcw during biodrain 2779 * a rmw from a rcw during biodrain
2765 */ 2780 */
2781 prexor = 0;
2766 if (test_bit(STRIPE_OP_PREXOR, &sh->ops.complete) && 2782 if (test_bit(STRIPE_OP_PREXOR, &sh->ops.complete) &&
2767 test_bit(STRIPE_OP_POSTXOR, &sh->ops.complete)) { 2783 test_bit(STRIPE_OP_POSTXOR, &sh->ops.complete)) {
2768 2784
2785 prexor = 1;
2769 clear_bit(STRIPE_OP_PREXOR, &sh->ops.complete); 2786 clear_bit(STRIPE_OP_PREXOR, &sh->ops.complete);
2770 clear_bit(STRIPE_OP_PREXOR, &sh->ops.ack); 2787 clear_bit(STRIPE_OP_PREXOR, &sh->ops.ack);
2771 clear_bit(STRIPE_OP_PREXOR, &sh->ops.pending); 2788 clear_bit(STRIPE_OP_PREXOR, &sh->ops.pending);
@@ -2799,6 +2816,8 @@ static void handle_stripe5(struct stripe_head *sh)
2799 if (!test_and_set_bit( 2816 if (!test_and_set_bit(
2800 STRIPE_OP_IO, &sh->ops.pending)) 2817 STRIPE_OP_IO, &sh->ops.pending))
2801 sh->ops.count++; 2818 sh->ops.count++;
2819 if (prexor)
2820 continue;
2802 if (!test_bit(R5_Insync, &dev->flags) || 2821 if (!test_bit(R5_Insync, &dev->flags) ||
2803 (i == sh->pd_idx && s.failed == 0)) 2822 (i == sh->pd_idx && s.failed == 0))
2804 set_bit(STRIPE_INSYNC, &sh->state); 2823 set_bit(STRIPE_INSYNC, &sh->state);
@@ -4256,6 +4275,7 @@ static int run(mddev_t *mddev)
4256 goto abort; 4275 goto abort;
4257 } 4276 }
4258 spin_lock_init(&conf->device_lock); 4277 spin_lock_init(&conf->device_lock);
4278 mddev->queue->queue_lock = &conf->device_lock;
4259 init_waitqueue_head(&conf->wait_for_stripe); 4279 init_waitqueue_head(&conf->wait_for_stripe);
4260 init_waitqueue_head(&conf->wait_for_overlap); 4280 init_waitqueue_head(&conf->wait_for_overlap);
4261 INIT_LIST_HEAD(&conf->handle_list); 4281 INIT_LIST_HEAD(&conf->handle_list);
@@ -4562,6 +4582,14 @@ static int raid5_remove_disk(mddev_t *mddev, int number)
4562 err = -EBUSY; 4582 err = -EBUSY;
4563 goto abort; 4583 goto abort;
4564 } 4584 }
4585 /* Only remove non-faulty devices if recovery
4586 * isn't possible.
4587 */
4588 if (!test_bit(Faulty, &rdev->flags) &&
4589 mddev->degraded <= conf->max_degraded) {
4590 err = -EBUSY;
4591 goto abort;
4592 }
4565 p->rdev = NULL; 4593 p->rdev = NULL;
4566 synchronize_rcu(); 4594 synchronize_rcu();
4567 if (atomic_read(&rdev->nr_pending)) { 4595 if (atomic_read(&rdev->nr_pending)) {
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index ddf57e135c6c..7a7803b5d497 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -89,8 +89,7 @@ config DVB_CORE
89 89
90config VIDEO_MEDIA 90config VIDEO_MEDIA
91 tristate 91 tristate
92 default DVB_CORE || VIDEO_DEV 92 default (DVB_CORE && (VIDEO_DEV = n)) || (VIDEO_DEV && (DVB_CORE = n)) || (DVB_CORE && VIDEO_DEV)
93 depends on DVB_CORE || VIDEO_DEV
94 93
95comment "Multimedia drivers" 94comment "Multimedia drivers"
96 95
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index cc11c4c0e7e7..09a829d8a7e7 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -2,12 +2,7 @@
2# Makefile for the kernel multimedia device drivers. 2# Makefile for the kernel multimedia device drivers.
3# 3#
4 4
5obj-y := common/ 5obj-y += common/ video/
6
7obj-$(CONFIG_VIDEO_MEDIA) += common/
8
9# Since hybrid devices are here, should be compiled if DVB and/or V4L
10obj-$(CONFIG_VIDEO_MEDIA) += video/
11 6
12obj-$(CONFIG_VIDEO_DEV) += radio/ 7obj-$(CONFIG_VIDEO_DEV) += radio/
13obj-$(CONFIG_DVB_CORE) += dvb/ 8obj-$(CONFIG_DVB_CORE) += dvb/
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig
index 5be85ff53e12..85482960d012 100644
--- a/drivers/media/common/tuners/Kconfig
+++ b/drivers/media/common/tuners/Kconfig
@@ -1,6 +1,6 @@
1config MEDIA_ATTACH 1config MEDIA_ATTACH
2 bool "Load and attach frontend and tuner driver modules as needed" 2 bool "Load and attach frontend and tuner driver modules as needed"
3 depends on DVB_CORE 3 depends on VIDEO_MEDIA
4 depends on MODULES 4 depends on MODULES
5 help 5 help
6 Remove the static dependency of DVB card drivers on all 6 Remove the static dependency of DVB card drivers on all
@@ -19,10 +19,11 @@ config MEDIA_ATTACH
19 19
20config MEDIA_TUNER 20config MEDIA_TUNER
21 tristate 21 tristate
22 default DVB_CORE || VIDEO_DEV 22 default VIDEO_MEDIA && I2C
23 depends on DVB_CORE || VIDEO_DEV 23 depends on VIDEO_MEDIA && I2C
24 select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE 24 select FW_LOADER if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
25 select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE 25 select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
26 select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
26 select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMIZE 27 select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMIZE
27 select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMIZE 28 select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMIZE
28 select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMIZE 29 select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMIZE
@@ -46,7 +47,7 @@ if MEDIA_TUNER_CUSTOMIZE
46 47
47config MEDIA_TUNER_SIMPLE 48config MEDIA_TUNER_SIMPLE
48 tristate "Simple tuner support" 49 tristate "Simple tuner support"
49 depends on I2C 50 depends on VIDEO_MEDIA && I2C
50 select MEDIA_TUNER_TDA9887 51 select MEDIA_TUNER_TDA9887
51 default m if MEDIA_TUNER_CUSTOMIZE 52 default m if MEDIA_TUNER_CUSTOMIZE
52 help 53 help
@@ -54,7 +55,7 @@ config MEDIA_TUNER_SIMPLE
54 55
55config MEDIA_TUNER_TDA8290 56config MEDIA_TUNER_TDA8290
56 tristate "TDA 8290/8295 + 8275(a)/18271 tuner combo" 57 tristate "TDA 8290/8295 + 8275(a)/18271 tuner combo"
57 depends on I2C 58 depends on VIDEO_MEDIA && I2C
58 select MEDIA_TUNER_TDA827X 59 select MEDIA_TUNER_TDA827X
59 select MEDIA_TUNER_TDA18271 60 select MEDIA_TUNER_TDA18271
60 default m if MEDIA_TUNER_CUSTOMIZE 61 default m if MEDIA_TUNER_CUSTOMIZE
@@ -63,21 +64,21 @@ config MEDIA_TUNER_TDA8290
63 64
64config MEDIA_TUNER_TDA827X 65config MEDIA_TUNER_TDA827X
65 tristate "Philips TDA827X silicon tuner" 66 tristate "Philips TDA827X silicon tuner"
66 depends on DVB_CORE && I2C 67 depends on VIDEO_MEDIA && I2C
67 default m if DVB_FE_CUSTOMISE 68 default m if DVB_FE_CUSTOMISE
68 help 69 help
69 A DVB-T silicon tuner module. Say Y when you want to support this tuner. 70 A DVB-T silicon tuner module. Say Y when you want to support this tuner.
70 71
71config MEDIA_TUNER_TDA18271 72config MEDIA_TUNER_TDA18271
72 tristate "NXP TDA18271 silicon tuner" 73 tristate "NXP TDA18271 silicon tuner"
73 depends on I2C 74 depends on VIDEO_MEDIA && I2C
74 default m if DVB_FE_CUSTOMISE 75 default m if DVB_FE_CUSTOMISE
75 help 76 help
76 A silicon tuner module. Say Y when you want to support this tuner. 77 A silicon tuner module. Say Y when you want to support this tuner.
77 78
78config MEDIA_TUNER_TDA9887 79config MEDIA_TUNER_TDA9887
79 tristate "TDA 9885/6/7 analog IF demodulator" 80 tristate "TDA 9885/6/7 analog IF demodulator"
80 depends on I2C 81 depends on VIDEO_MEDIA && I2C
81 default m if MEDIA_TUNER_CUSTOMIZE 82 default m if MEDIA_TUNER_CUSTOMIZE
82 help 83 help
83 Say Y here to include support for Philips TDA9885/6/7 84 Say Y here to include support for Philips TDA9885/6/7
@@ -85,67 +86,79 @@ config MEDIA_TUNER_TDA9887
85 86
86config MEDIA_TUNER_TEA5761 87config MEDIA_TUNER_TEA5761
87 tristate "TEA 5761 radio tuner (EXPERIMENTAL)" 88 tristate "TEA 5761 radio tuner (EXPERIMENTAL)"
88 depends on I2C && EXPERIMENTAL 89 depends on VIDEO_MEDIA && I2C
90 depends on EXPERIMENTAL
89 default m if MEDIA_TUNER_CUSTOMIZE 91 default m if MEDIA_TUNER_CUSTOMIZE
90 help 92 help
91 Say Y here to include support for the Philips TEA5761 radio tuner. 93 Say Y here to include support for the Philips TEA5761 radio tuner.
92 94
93config MEDIA_TUNER_TEA5767 95config MEDIA_TUNER_TEA5767
94 tristate "TEA 5767 radio tuner" 96 tristate "TEA 5767 radio tuner"
95 depends on I2C 97 depends on VIDEO_MEDIA && I2C
96 default m if MEDIA_TUNER_CUSTOMIZE 98 default m if MEDIA_TUNER_CUSTOMIZE
97 help 99 help
98 Say Y here to include support for the Philips TEA5767 radio tuner. 100 Say Y here to include support for the Philips TEA5767 radio tuner.
99 101
100config MEDIA_TUNER_MT20XX 102config MEDIA_TUNER_MT20XX
101 tristate "Microtune 2032 / 2050 tuners" 103 tristate "Microtune 2032 / 2050 tuners"
102 depends on I2C 104 depends on VIDEO_MEDIA && I2C
103 default m if MEDIA_TUNER_CUSTOMIZE 105 default m if MEDIA_TUNER_CUSTOMIZE
104 help 106 help
105 Say Y here to include support for the MT2032 / MT2050 tuner. 107 Say Y here to include support for the MT2032 / MT2050 tuner.
106 108
107config MEDIA_TUNER_MT2060 109config MEDIA_TUNER_MT2060
108 tristate "Microtune MT2060 silicon IF tuner" 110 tristate "Microtune MT2060 silicon IF tuner"
109 depends on I2C 111 depends on VIDEO_MEDIA && I2C
110 default m if DVB_FE_CUSTOMISE 112 default m if DVB_FE_CUSTOMISE
111 help 113 help
112 A driver for the silicon IF tuner MT2060 from Microtune. 114 A driver for the silicon IF tuner MT2060 from Microtune.
113 115
114config MEDIA_TUNER_MT2266 116config MEDIA_TUNER_MT2266
115 tristate "Microtune MT2266 silicon tuner" 117 tristate "Microtune MT2266 silicon tuner"
116 depends on I2C 118 depends on VIDEO_MEDIA && I2C
117 default m if DVB_FE_CUSTOMISE 119 default m if DVB_FE_CUSTOMISE
118 help 120 help
119 A driver for the silicon baseband tuner MT2266 from Microtune. 121 A driver for the silicon baseband tuner MT2266 from Microtune.
120 122
121config MEDIA_TUNER_MT2131 123config MEDIA_TUNER_MT2131
122 tristate "Microtune MT2131 silicon tuner" 124 tristate "Microtune MT2131 silicon tuner"
123 depends on I2C 125 depends on VIDEO_MEDIA && I2C
124 default m if DVB_FE_CUSTOMISE 126 default m if DVB_FE_CUSTOMISE
125 help 127 help
126 A driver for the silicon baseband tuner MT2131 from Microtune. 128 A driver for the silicon baseband tuner MT2131 from Microtune.
127 129
128config MEDIA_TUNER_QT1010 130config MEDIA_TUNER_QT1010
129 tristate "Quantek QT1010 silicon tuner" 131 tristate "Quantek QT1010 silicon tuner"
130 depends on DVB_CORE && I2C 132 depends on VIDEO_MEDIA && I2C
131 default m if DVB_FE_CUSTOMISE 133 default m if DVB_FE_CUSTOMISE
132 help 134 help
133 A driver for the silicon tuner QT1010 from Quantek. 135 A driver for the silicon tuner QT1010 from Quantek.
134 136
135config MEDIA_TUNER_XC2028 137config MEDIA_TUNER_XC2028
136 tristate "XCeive xc2028/xc3028 tuners" 138 tristate "XCeive xc2028/xc3028 tuners"
137 depends on I2C && FW_LOADER 139 depends on VIDEO_MEDIA && I2C
140 depends on HOTPLUG
141 select FW_LOADER
138 default m if MEDIA_TUNER_CUSTOMIZE 142 default m if MEDIA_TUNER_CUSTOMIZE
139 help 143 help
140 Say Y here to include support for the xc2028/xc3028 tuners. 144 Say Y here to include support for the xc2028/xc3028 tuners.
141 145
142config MEDIA_TUNER_XC5000 146config MEDIA_TUNER_XC5000
143 tristate "Xceive XC5000 silicon tuner" 147 tristate "Xceive XC5000 silicon tuner"
144 depends on I2C 148 depends on VIDEO_MEDIA && I2C
149 depends on HOTPLUG
150 select FW_LOADER
145 default m if DVB_FE_CUSTOMISE 151 default m if DVB_FE_CUSTOMISE
146 help 152 help
147 A driver for the silicon tuner XC5000 from Xceive. 153 A driver for the silicon tuner XC5000 from Xceive.
148 This device is only used inside a SiP called togther with a 154 This device is only used inside a SiP called togther with a
149 demodulator for now. 155 demodulator for now.
150 156
157config MEDIA_TUNER_MXL5005S
158 tristate "MaxLinear MSL5005S silicon tuner"
159 depends on VIDEO_MEDIA && I2C
160 default m if DVB_FE_CUSTOMISE
161 help
162 A driver for the silicon tuner MXL5005S from MaxLinear.
163
151endif # MEDIA_TUNER_CUSTOMIZE 164endif # MEDIA_TUNER_CUSTOMIZE
diff --git a/drivers/media/common/tuners/Makefile b/drivers/media/common/tuners/Makefile
index 236d9932fd92..55f7e6706297 100644
--- a/drivers/media/common/tuners/Makefile
+++ b/drivers/media/common/tuners/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_MEDIA_TUNER_MT2060) += mt2060.o
20obj-$(CONFIG_MEDIA_TUNER_MT2266) += mt2266.o 20obj-$(CONFIG_MEDIA_TUNER_MT2266) += mt2266.o
21obj-$(CONFIG_MEDIA_TUNER_QT1010) += qt1010.o 21obj-$(CONFIG_MEDIA_TUNER_QT1010) += qt1010.o
22obj-$(CONFIG_MEDIA_TUNER_MT2131) += mt2131.o 22obj-$(CONFIG_MEDIA_TUNER_MT2131) += mt2131.o
23obj-$(CONFIG_MEDIA_TUNER_MXL5005S) += mxl5005s.o
23 24
24EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core 25EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
25EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 26EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
diff --git a/drivers/media/common/tuners/mxl5005s.c b/drivers/media/common/tuners/mxl5005s.c
new file mode 100644
index 000000000000..0dc2bef9f6a3
--- /dev/null
+++ b/drivers/media/common/tuners/mxl5005s.c
@@ -0,0 +1,4110 @@
1/*
2 MaxLinear MXL5005S VSB/QAM/DVBT tuner driver
3
4 Copyright (C) 2008 MaxLinear
5 Copyright (C) 2006 Steven Toth <stoth@hauppauge.com>
6 Functions:
7 mxl5005s_reset()
8 mxl5005s_writereg()
9 mxl5005s_writeregs()
10 mxl5005s_init()
11 mxl5005s_reconfigure()
12 mxl5005s_AssignTunerMode()
13 mxl5005s_set_params()
14 mxl5005s_get_frequency()
15 mxl5005s_get_bandwidth()
16 mxl5005s_release()
17 mxl5005s_attach()
18
19 Copyright (C) 2008 Realtek
20 Copyright (C) 2008 Jan Hoogenraad
21 Functions:
22 mxl5005s_SetRfFreqHz()
23
24 This program is free software; you can redistribute it and/or modify
25 it under the terms of the GNU General Public License as published by
26 the Free Software Foundation; either version 2 of the License, or
27 (at your option) any later version.
28
29 This program is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 GNU General Public License for more details.
33
34 You should have received a copy of the GNU General Public License
35 along with this program; if not, write to the Free Software
36 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
37
38*/
39
40/*
41 History of this driver (Steven Toth):
42 I was given a public release of a linux driver that included
43 support for the MaxLinear MXL5005S silicon tuner. Analysis of
44 the tuner driver showed clearly three things.
45
46 1. The tuner driver didn't support the LinuxTV tuner API
47 so the code Realtek added had to be removed.
48
49 2. A significant amount of the driver is reference driver code
50 from MaxLinear, I felt it was important to identify and
51 preserve this.
52
53 3. New code has to be added to interface correctly with the
54 LinuxTV API, as a regular kernel module.
55
56 Other than the reference driver enum's, I've clearly marked
57 sections of the code and retained the copyright of the
58 respective owners.
59*/
60#include <linux/kernel.h>
61#include <linux/init.h>
62#include <linux/module.h>
63#include <linux/string.h>
64#include <linux/slab.h>
65#include <linux/delay.h>
66#include "dvb_frontend.h"
67#include "mxl5005s.h"
68
69static int debug;
70
71#define dprintk(level, arg...) do { \
72 if (level <= debug) \
73 printk(arg); \
74 } while (0)
75
76#define TUNER_REGS_NUM 104
77#define INITCTRL_NUM 40
78
79#ifdef _MXL_PRODUCTION
80#define CHCTRL_NUM 39
81#else
82#define CHCTRL_NUM 36
83#endif
84
85#define MXLCTRL_NUM 189
86#define MASTER_CONTROL_ADDR 9
87
88/* Enumeration of Master Control Register State */
89enum master_control_state {
90 MC_LOAD_START = 1,
91 MC_POWER_DOWN,
92 MC_SYNTH_RESET,
93 MC_SEQ_OFF
94};
95
96/* Enumeration of MXL5005 Tuner Modulation Type */
97enum {
98 MXL_DEFAULT_MODULATION = 0,
99 MXL_DVBT,
100 MXL_ATSC,
101 MXL_QAM,
102 MXL_ANALOG_CABLE,
103 MXL_ANALOG_OTA
104};
105
106/* MXL5005 Tuner Register Struct */
107struct TunerReg {
108 u16 Reg_Num; /* Tuner Register Address */
109 u16 Reg_Val; /* Current sw programmed value waiting to be writen */
110};
111
112enum {
113 /* Initialization Control Names */
114 DN_IQTN_AMP_CUT = 1, /* 1 */
115 BB_MODE, /* 2 */
116 BB_BUF, /* 3 */
117 BB_BUF_OA, /* 4 */
118 BB_ALPF_BANDSELECT, /* 5 */
119 BB_IQSWAP, /* 6 */
120 BB_DLPF_BANDSEL, /* 7 */
121 RFSYN_CHP_GAIN, /* 8 */
122 RFSYN_EN_CHP_HIGAIN, /* 9 */
123 AGC_IF, /* 10 */
124 AGC_RF, /* 11 */
125 IF_DIVVAL, /* 12 */
126 IF_VCO_BIAS, /* 13 */
127 CHCAL_INT_MOD_IF, /* 14 */
128 CHCAL_FRAC_MOD_IF, /* 15 */
129 DRV_RES_SEL, /* 16 */
130 I_DRIVER, /* 17 */
131 EN_AAF, /* 18 */
132 EN_3P, /* 19 */
133 EN_AUX_3P, /* 20 */
134 SEL_AAF_BAND, /* 21 */
135 SEQ_ENCLK16_CLK_OUT, /* 22 */
136 SEQ_SEL4_16B, /* 23 */
137 XTAL_CAPSELECT, /* 24 */
138 IF_SEL_DBL, /* 25 */
139 RFSYN_R_DIV, /* 26 */
140 SEQ_EXTSYNTHCALIF, /* 27 */
141 SEQ_EXTDCCAL, /* 28 */
142 AGC_EN_RSSI, /* 29 */
143 RFA_ENCLKRFAGC, /* 30 */
144 RFA_RSSI_REFH, /* 31 */
145 RFA_RSSI_REF, /* 32 */
146 RFA_RSSI_REFL, /* 33 */
147 RFA_FLR, /* 34 */
148 RFA_CEIL, /* 35 */
149 SEQ_EXTIQFSMPULSE, /* 36 */
150 OVERRIDE_1, /* 37 */
151 BB_INITSTATE_DLPF_TUNE, /* 38 */
152 TG_R_DIV, /* 39 */
153 EN_CHP_LIN_B, /* 40 */
154
155 /* Channel Change Control Names */
156 DN_POLY = 51, /* 51 */
157 DN_RFGAIN, /* 52 */
158 DN_CAP_RFLPF, /* 53 */
159 DN_EN_VHFUHFBAR, /* 54 */
160 DN_GAIN_ADJUST, /* 55 */
161 DN_IQTNBUF_AMP, /* 56 */
162 DN_IQTNGNBFBIAS_BST, /* 57 */
163 RFSYN_EN_OUTMUX, /* 58 */
164 RFSYN_SEL_VCO_OUT, /* 59 */
165 RFSYN_SEL_VCO_HI, /* 60 */
166 RFSYN_SEL_DIVM, /* 61 */
167 RFSYN_RF_DIV_BIAS, /* 62 */
168 DN_SEL_FREQ, /* 63 */
169 RFSYN_VCO_BIAS, /* 64 */
170 CHCAL_INT_MOD_RF, /* 65 */
171 CHCAL_FRAC_MOD_RF, /* 66 */
172 RFSYN_LPF_R, /* 67 */
173 CHCAL_EN_INT_RF, /* 68 */
174 TG_LO_DIVVAL, /* 69 */
175 TG_LO_SELVAL, /* 70 */
176 TG_DIV_VAL, /* 71 */
177 TG_VCO_BIAS, /* 72 */
178 SEQ_EXTPOWERUP, /* 73 */
179 OVERRIDE_2, /* 74 */
180 OVERRIDE_3, /* 75 */
181 OVERRIDE_4, /* 76 */
182 SEQ_FSM_PULSE, /* 77 */
183 GPIO_4B, /* 78 */
184 GPIO_3B, /* 79 */
185 GPIO_4, /* 80 */
186 GPIO_3, /* 81 */
187 GPIO_1B, /* 82 */
188 DAC_A_ENABLE, /* 83 */
189 DAC_B_ENABLE, /* 84 */
190 DAC_DIN_A, /* 85 */
191 DAC_DIN_B, /* 86 */
192#ifdef _MXL_PRODUCTION
193 RFSYN_EN_DIV, /* 87 */
194 RFSYN_DIVM, /* 88 */
195 DN_BYPASS_AGC_I2C /* 89 */
196#endif
197};
198
199/*
200 * The following context is source code provided by MaxLinear.
201 * MaxLinear source code - Common_MXL.h (?)
202 */
203
204/* Constants */
205#define MXL5005S_REG_WRITING_TABLE_LEN_MAX 104
206#define MXL5005S_LATCH_BYTE 0xfe
207
208/* Register address, MSB, and LSB */
209#define MXL5005S_BB_IQSWAP_ADDR 59
210#define MXL5005S_BB_IQSWAP_MSB 0
211#define MXL5005S_BB_IQSWAP_LSB 0
212
213#define MXL5005S_BB_DLPF_BANDSEL_ADDR 53
214#define MXL5005S_BB_DLPF_BANDSEL_MSB 4
215#define MXL5005S_BB_DLPF_BANDSEL_LSB 3
216
217/* Standard modes */
218enum {
219 MXL5005S_STANDARD_DVBT,
220 MXL5005S_STANDARD_ATSC,
221};
222#define MXL5005S_STANDARD_MODE_NUM 2
223
224/* Bandwidth modes */
225enum {
226 MXL5005S_BANDWIDTH_6MHZ = 6000000,
227 MXL5005S_BANDWIDTH_7MHZ = 7000000,
228 MXL5005S_BANDWIDTH_8MHZ = 8000000,
229};
230#define MXL5005S_BANDWIDTH_MODE_NUM 3
231
232/* MXL5005 Tuner Control Struct */
233struct TunerControl {
234 u16 Ctrl_Num; /* Control Number */
235 u16 size; /* Number of bits to represent Value */
236 u16 addr[25]; /* Array of Tuner Register Address for each bit pos */
237 u16 bit[25]; /* Array of bit pos in Reg Addr for each bit pos */
238 u16 val[25]; /* Binary representation of Value */
239};
240
241/* MXL5005 Tuner Struct */
242struct mxl5005s_state {
243 u8 Mode; /* 0: Analog Mode ; 1: Digital Mode */
244 u8 IF_Mode; /* for Analog Mode, 0: zero IF; 1: low IF */
245 u32 Chan_Bandwidth; /* filter channel bandwidth (6, 7, 8) */
246 u32 IF_OUT; /* Desired IF Out Frequency */
247 u16 IF_OUT_LOAD; /* IF Out Load Resistor (200/300 Ohms) */
248 u32 RF_IN; /* RF Input Frequency */
249 u32 Fxtal; /* XTAL Frequency */
250 u8 AGC_Mode; /* AGC Mode 0: Dual AGC; 1: Single AGC */
251 u16 TOP; /* Value: take over point */
252 u8 CLOCK_OUT; /* 0: turn off clk out; 1: turn on clock out */
253 u8 DIV_OUT; /* 4MHz or 16MHz */
254 u8 CAPSELECT; /* 0: disable On-Chip pulling cap; 1: enable */
255 u8 EN_RSSI; /* 0: disable RSSI; 1: enable RSSI */
256
257 /* Modulation Type; */
258 /* 0 - Default; 1 - DVB-T; 2 - ATSC; 3 - QAM; 4 - Analog Cable */
259 u8 Mod_Type;
260
261 /* Tracking Filter Type */
262 /* 0 - Default; 1 - Off; 2 - Type C; 3 - Type C-H */
263 u8 TF_Type;
264
265 /* Calculated Settings */
266 u32 RF_LO; /* Synth RF LO Frequency */
267 u32 IF_LO; /* Synth IF LO Frequency */
268 u32 TG_LO; /* Synth TG_LO Frequency */
269
270 /* Pointers to ControlName Arrays */
271 u16 Init_Ctrl_Num; /* Number of INIT Control Names */
272 struct TunerControl
273 Init_Ctrl[INITCTRL_NUM]; /* INIT Control Names Array Pointer */
274
275 u16 CH_Ctrl_Num; /* Number of CH Control Names */
276 struct TunerControl
277 CH_Ctrl[CHCTRL_NUM]; /* CH Control Name Array Pointer */
278
279 u16 MXL_Ctrl_Num; /* Number of MXL Control Names */
280 struct TunerControl
281 MXL_Ctrl[MXLCTRL_NUM]; /* MXL Control Name Array Pointer */
282
283 /* Pointer to Tuner Register Array */
284 u16 TunerRegs_Num; /* Number of Tuner Registers */
285 struct TunerReg
286 TunerRegs[TUNER_REGS_NUM]; /* Tuner Register Array Pointer */
287
288 /* Linux driver framework specific */
289 struct mxl5005s_config *config;
290 struct dvb_frontend *frontend;
291 struct i2c_adapter *i2c;
292
293 /* Cache values */
294 u32 current_mode;
295
296};
297
298static u16 MXL_GetMasterControl(u8 *MasterReg, int state);
299static u16 MXL_ControlWrite(struct dvb_frontend *fe, u16 ControlNum, u32 value);
300static u16 MXL_ControlRead(struct dvb_frontend *fe, u16 controlNum, u32 *value);
301static void MXL_RegWriteBit(struct dvb_frontend *fe, u8 address, u8 bit,
302 u8 bitVal);
303static u16 MXL_GetCHRegister(struct dvb_frontend *fe, u8 *RegNum,
304 u8 *RegVal, int *count);
305static u32 MXL_Ceiling(u32 value, u32 resolution);
306static u16 MXL_RegRead(struct dvb_frontend *fe, u8 RegNum, u8 *RegVal);
307static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
308 u32 value, u16 controlGroup);
309static u16 MXL_SetGPIO(struct dvb_frontend *fe, u8 GPIO_Num, u8 GPIO_Val);
310static u16 MXL_GetInitRegister(struct dvb_frontend *fe, u8 *RegNum,
311 u8 *RegVal, int *count);
312static u32 MXL_GetXtalInt(u32 Xtal_Freq);
313static u16 MXL_TuneRF(struct dvb_frontend *fe, u32 RF_Freq);
314static void MXL_SynthIFLO_Calc(struct dvb_frontend *fe);
315static void MXL_SynthRFTGLO_Calc(struct dvb_frontend *fe);
316static u16 MXL_GetCHRegister_ZeroIF(struct dvb_frontend *fe, u8 *RegNum,
317 u8 *RegVal, int *count);
318static int mxl5005s_writeregs(struct dvb_frontend *fe, u8 *addrtable,
319 u8 *datatable, u8 len);
320static u16 MXL_IFSynthInit(struct dvb_frontend *fe);
321static int mxl5005s_AssignTunerMode(struct dvb_frontend *fe, u32 mod_type,
322 u32 bandwidth);
323static int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type,
324 u32 bandwidth);
325
326/* ----------------------------------------------------------------
327 * Begin: Custom code salvaged from the Realtek driver.
328 * Copyright (C) 2008 Realtek
329 * Copyright (C) 2008 Jan Hoogenraad
330 * This code is placed under the terms of the GNU General Public License
331 *
332 * Released by Realtek under GPLv2.
333 * Thanks to Realtek for a lot of support we received !
334 *
335 * Revision: 080314 - original version
336 */
337
338static int mxl5005s_SetRfFreqHz(struct dvb_frontend *fe, unsigned long RfFreqHz)
339{
340 struct mxl5005s_state *state = fe->tuner_priv;
341 unsigned char AddrTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
342 unsigned char ByteTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
343 int TableLen;
344
345 u32 IfDivval = 0;
346 unsigned char MasterControlByte;
347
348 dprintk(1, "%s() freq=%ld\n", __func__, RfFreqHz);
349
350 /* Set MxL5005S tuner RF frequency according to example code. */
351
352 /* Tuner RF frequency setting stage 0 */
353 MXL_GetMasterControl(ByteTable, MC_SYNTH_RESET);
354 AddrTable[0] = MASTER_CONTROL_ADDR;
355 ByteTable[0] |= state->config->AgcMasterByte;
356
357 mxl5005s_writeregs(fe, AddrTable, ByteTable, 1);
358
359 /* Tuner RF frequency setting stage 1 */
360 MXL_TuneRF(fe, RfFreqHz);
361
362 MXL_ControlRead(fe, IF_DIVVAL, &IfDivval);
363
364 MXL_ControlWrite(fe, SEQ_FSM_PULSE, 0);
365 MXL_ControlWrite(fe, SEQ_EXTPOWERUP, 1);
366 MXL_ControlWrite(fe, IF_DIVVAL, 8);
367 MXL_GetCHRegister(fe, AddrTable, ByteTable, &TableLen);
368
369 MXL_GetMasterControl(&MasterControlByte, MC_LOAD_START);
370 AddrTable[TableLen] = MASTER_CONTROL_ADDR ;
371 ByteTable[TableLen] = MasterControlByte |
372 state->config->AgcMasterByte;
373 TableLen += 1;
374
375 mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen);
376
377 /* Wait 30 ms. */
378 msleep(150);
379
380 /* Tuner RF frequency setting stage 2 */
381 MXL_ControlWrite(fe, SEQ_FSM_PULSE, 1);
382 MXL_ControlWrite(fe, IF_DIVVAL, IfDivval);
383 MXL_GetCHRegister_ZeroIF(fe, AddrTable, ByteTable, &TableLen);
384
385 MXL_GetMasterControl(&MasterControlByte, MC_LOAD_START);
386 AddrTable[TableLen] = MASTER_CONTROL_ADDR ;
387 ByteTable[TableLen] = MasterControlByte |
388 state->config->AgcMasterByte ;
389 TableLen += 1;
390
391 mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen);
392
393 msleep(100);
394
395 return 0;
396}
397/* End: Custom code taken from the Realtek driver */
398
399/* ----------------------------------------------------------------
400 * Begin: Reference driver code found in the Realtek driver.
401 * Copyright (C) 2008 MaxLinear
402 */
403static u16 MXL5005_RegisterInit(struct dvb_frontend *fe)
404{
405 struct mxl5005s_state *state = fe->tuner_priv;
406 state->TunerRegs_Num = TUNER_REGS_NUM ;
407
408 state->TunerRegs[0].Reg_Num = 9 ;
409 state->TunerRegs[0].Reg_Val = 0x40 ;
410
411 state->TunerRegs[1].Reg_Num = 11 ;
412 state->TunerRegs[1].Reg_Val = 0x19 ;
413
414 state->TunerRegs[2].Reg_Num = 12 ;
415 state->TunerRegs[2].Reg_Val = 0x60 ;
416
417 state->TunerRegs[3].Reg_Num = 13 ;
418 state->TunerRegs[3].Reg_Val = 0x00 ;
419
420 state->TunerRegs[4].Reg_Num = 14 ;
421 state->TunerRegs[4].Reg_Val = 0x00 ;
422
423 state->TunerRegs[5].Reg_Num = 15 ;
424 state->TunerRegs[5].Reg_Val = 0xC0 ;
425
426 state->TunerRegs[6].Reg_Num = 16 ;
427 state->TunerRegs[6].Reg_Val = 0x00 ;
428
429 state->TunerRegs[7].Reg_Num = 17 ;
430 state->TunerRegs[7].Reg_Val = 0x00 ;
431
432 state->TunerRegs[8].Reg_Num = 18 ;
433 state->TunerRegs[8].Reg_Val = 0x00 ;
434
435 state->TunerRegs[9].Reg_Num = 19 ;
436 state->TunerRegs[9].Reg_Val = 0x34 ;
437
438 state->TunerRegs[10].Reg_Num = 21 ;
439 state->TunerRegs[10].Reg_Val = 0x00 ;
440
441 state->TunerRegs[11].Reg_Num = 22 ;
442 state->TunerRegs[11].Reg_Val = 0x6B ;
443
444 state->TunerRegs[12].Reg_Num = 23 ;
445 state->TunerRegs[12].Reg_Val = 0x35 ;
446
447 state->TunerRegs[13].Reg_Num = 24 ;
448 state->TunerRegs[13].Reg_Val = 0x70 ;
449
450 state->TunerRegs[14].Reg_Num = 25 ;
451 state->TunerRegs[14].Reg_Val = 0x3E ;
452
453 state->TunerRegs[15].Reg_Num = 26 ;
454 state->TunerRegs[15].Reg_Val = 0x82 ;
455
456 state->TunerRegs[16].Reg_Num = 31 ;
457 state->TunerRegs[16].Reg_Val = 0x00 ;
458
459 state->TunerRegs[17].Reg_Num = 32 ;
460 state->TunerRegs[17].Reg_Val = 0x40 ;
461
462 state->TunerRegs[18].Reg_Num = 33 ;
463 state->TunerRegs[18].Reg_Val = 0x53 ;
464
465 state->TunerRegs[19].Reg_Num = 34 ;
466 state->TunerRegs[19].Reg_Val = 0x81 ;
467
468 state->TunerRegs[20].Reg_Num = 35 ;
469 state->TunerRegs[20].Reg_Val = 0xC9 ;
470
471 state->TunerRegs[21].Reg_Num = 36 ;
472 state->TunerRegs[21].Reg_Val = 0x01 ;
473
474 state->TunerRegs[22].Reg_Num = 37 ;
475 state->TunerRegs[22].Reg_Val = 0x00 ;
476
477 state->TunerRegs[23].Reg_Num = 41 ;
478 state->TunerRegs[23].Reg_Val = 0x00 ;
479
480 state->TunerRegs[24].Reg_Num = 42 ;
481 state->TunerRegs[24].Reg_Val = 0xF8 ;
482
483 state->TunerRegs[25].Reg_Num = 43 ;
484 state->TunerRegs[25].Reg_Val = 0x43 ;
485
486 state->TunerRegs[26].Reg_Num = 44 ;
487 state->TunerRegs[26].Reg_Val = 0x20 ;
488
489 state->TunerRegs[27].Reg_Num = 45 ;
490 state->TunerRegs[27].Reg_Val = 0x80 ;
491
492 state->TunerRegs[28].Reg_Num = 46 ;
493 state->TunerRegs[28].Reg_Val = 0x88 ;
494
495 state->TunerRegs[29].Reg_Num = 47 ;
496 state->TunerRegs[29].Reg_Val = 0x86 ;
497
498 state->TunerRegs[30].Reg_Num = 48 ;
499 state->TunerRegs[30].Reg_Val = 0x00 ;
500
501 state->TunerRegs[31].Reg_Num = 49 ;
502 state->TunerRegs[31].Reg_Val = 0x00 ;
503
504 state->TunerRegs[32].Reg_Num = 53 ;
505 state->TunerRegs[32].Reg_Val = 0x94 ;
506
507 state->TunerRegs[33].Reg_Num = 54 ;
508 state->TunerRegs[33].Reg_Val = 0xFA ;
509
510 state->TunerRegs[34].Reg_Num = 55 ;
511 state->TunerRegs[34].Reg_Val = 0x92 ;
512
513 state->TunerRegs[35].Reg_Num = 56 ;
514 state->TunerRegs[35].Reg_Val = 0x80 ;
515
516 state->TunerRegs[36].Reg_Num = 57 ;
517 state->TunerRegs[36].Reg_Val = 0x41 ;
518
519 state->TunerRegs[37].Reg_Num = 58 ;
520 state->TunerRegs[37].Reg_Val = 0xDB ;
521
522 state->TunerRegs[38].Reg_Num = 59 ;
523 state->TunerRegs[38].Reg_Val = 0x00 ;
524
525 state->TunerRegs[39].Reg_Num = 60 ;
526 state->TunerRegs[39].Reg_Val = 0x00 ;
527
528 state->TunerRegs[40].Reg_Num = 61 ;
529 state->TunerRegs[40].Reg_Val = 0x00 ;
530
531 state->TunerRegs[41].Reg_Num = 62 ;
532 state->TunerRegs[41].Reg_Val = 0x00 ;
533
534 state->TunerRegs[42].Reg_Num = 65 ;
535 state->TunerRegs[42].Reg_Val = 0xF8 ;
536
537 state->TunerRegs[43].Reg_Num = 66 ;
538 state->TunerRegs[43].Reg_Val = 0xE4 ;
539
540 state->TunerRegs[44].Reg_Num = 67 ;
541 state->TunerRegs[44].Reg_Val = 0x90 ;
542
543 state->TunerRegs[45].Reg_Num = 68 ;
544 state->TunerRegs[45].Reg_Val = 0xC0 ;
545
546 state->TunerRegs[46].Reg_Num = 69 ;
547 state->TunerRegs[46].Reg_Val = 0x01 ;
548
549 state->TunerRegs[47].Reg_Num = 70 ;
550 state->TunerRegs[47].Reg_Val = 0x50 ;
551
552 state->TunerRegs[48].Reg_Num = 71 ;
553 state->TunerRegs[48].Reg_Val = 0x06 ;
554
555 state->TunerRegs[49].Reg_Num = 72 ;
556 state->TunerRegs[49].Reg_Val = 0x00 ;
557
558 state->TunerRegs[50].Reg_Num = 73 ;
559 state->TunerRegs[50].Reg_Val = 0x20 ;
560
561 state->TunerRegs[51].Reg_Num = 76 ;
562 state->TunerRegs[51].Reg_Val = 0xBB ;
563
564 state->TunerRegs[52].Reg_Num = 77 ;
565 state->TunerRegs[52].Reg_Val = 0x13 ;
566
567 state->TunerRegs[53].Reg_Num = 81 ;
568 state->TunerRegs[53].Reg_Val = 0x04 ;
569
570 state->TunerRegs[54].Reg_Num = 82 ;
571 state->TunerRegs[54].Reg_Val = 0x75 ;
572
573 state->TunerRegs[55].Reg_Num = 83 ;
574 state->TunerRegs[55].Reg_Val = 0x00 ;
575
576 state->TunerRegs[56].Reg_Num = 84 ;
577 state->TunerRegs[56].Reg_Val = 0x00 ;
578
579 state->TunerRegs[57].Reg_Num = 85 ;
580 state->TunerRegs[57].Reg_Val = 0x00 ;
581
582 state->TunerRegs[58].Reg_Num = 91 ;
583 state->TunerRegs[58].Reg_Val = 0x70 ;
584
585 state->TunerRegs[59].Reg_Num = 92 ;
586 state->TunerRegs[59].Reg_Val = 0x00 ;
587
588 state->TunerRegs[60].Reg_Num = 93 ;
589 state->TunerRegs[60].Reg_Val = 0x00 ;
590
591 state->TunerRegs[61].Reg_Num = 94 ;
592 state->TunerRegs[61].Reg_Val = 0x00 ;
593
594 state->TunerRegs[62].Reg_Num = 95 ;
595 state->TunerRegs[62].Reg_Val = 0x0C ;
596
597 state->TunerRegs[63].Reg_Num = 96 ;
598 state->TunerRegs[63].Reg_Val = 0x00 ;
599
600 state->TunerRegs[64].Reg_Num = 97 ;
601 state->TunerRegs[64].Reg_Val = 0x00 ;
602
603 state->TunerRegs[65].Reg_Num = 98 ;
604 state->TunerRegs[65].Reg_Val = 0xE2 ;
605
606 state->TunerRegs[66].Reg_Num = 99 ;
607 state->TunerRegs[66].Reg_Val = 0x00 ;
608
609 state->TunerRegs[67].Reg_Num = 100 ;
610 state->TunerRegs[67].Reg_Val = 0x00 ;
611
612 state->TunerRegs[68].Reg_Num = 101 ;
613 state->TunerRegs[68].Reg_Val = 0x12 ;
614
615 state->TunerRegs[69].Reg_Num = 102 ;
616 state->TunerRegs[69].Reg_Val = 0x80 ;
617
618 state->TunerRegs[70].Reg_Num = 103 ;
619 state->TunerRegs[70].Reg_Val = 0x32 ;
620
621 state->TunerRegs[71].Reg_Num = 104 ;
622 state->TunerRegs[71].Reg_Val = 0xB4 ;
623
624 state->TunerRegs[72].Reg_Num = 105 ;
625 state->TunerRegs[72].Reg_Val = 0x60 ;
626
627 state->TunerRegs[73].Reg_Num = 106 ;
628 state->TunerRegs[73].Reg_Val = 0x83 ;
629
630 state->TunerRegs[74].Reg_Num = 107 ;
631 state->TunerRegs[74].Reg_Val = 0x84 ;
632
633 state->TunerRegs[75].Reg_Num = 108 ;
634 state->TunerRegs[75].Reg_Val = 0x9C ;
635
636 state->TunerRegs[76].Reg_Num = 109 ;
637 state->TunerRegs[76].Reg_Val = 0x02 ;
638
639 state->TunerRegs[77].Reg_Num = 110 ;
640 state->TunerRegs[77].Reg_Val = 0x81 ;
641
642 state->TunerRegs[78].Reg_Num = 111 ;
643 state->TunerRegs[78].Reg_Val = 0xC0 ;
644
645 state->TunerRegs[79].Reg_Num = 112 ;
646 state->TunerRegs[79].Reg_Val = 0x10 ;
647
648 state->TunerRegs[80].Reg_Num = 131 ;
649 state->TunerRegs[80].Reg_Val = 0x8A ;
650
651 state->TunerRegs[81].Reg_Num = 132 ;
652 state->TunerRegs[81].Reg_Val = 0x10 ;
653
654 state->TunerRegs[82].Reg_Num = 133 ;
655 state->TunerRegs[82].Reg_Val = 0x24 ;
656
657 state->TunerRegs[83].Reg_Num = 134 ;
658 state->TunerRegs[83].Reg_Val = 0x00 ;
659
660 state->TunerRegs[84].Reg_Num = 135 ;
661 state->TunerRegs[84].Reg_Val = 0x00 ;
662
663 state->TunerRegs[85].Reg_Num = 136 ;
664 state->TunerRegs[85].Reg_Val = 0x7E ;
665
666 state->TunerRegs[86].Reg_Num = 137 ;
667 state->TunerRegs[86].Reg_Val = 0x40 ;
668
669 state->TunerRegs[87].Reg_Num = 138 ;
670 state->TunerRegs[87].Reg_Val = 0x38 ;
671
672 state->TunerRegs[88].Reg_Num = 146 ;
673 state->TunerRegs[88].Reg_Val = 0xF6 ;
674
675 state->TunerRegs[89].Reg_Num = 147 ;
676 state->TunerRegs[89].Reg_Val = 0x1A ;
677
678 state->TunerRegs[90].Reg_Num = 148 ;
679 state->TunerRegs[90].Reg_Val = 0x62 ;
680
681 state->TunerRegs[91].Reg_Num = 149 ;
682 state->TunerRegs[91].Reg_Val = 0x33 ;
683
684 state->TunerRegs[92].Reg_Num = 150 ;
685 state->TunerRegs[92].Reg_Val = 0x80 ;
686
687 state->TunerRegs[93].Reg_Num = 156 ;
688 state->TunerRegs[93].Reg_Val = 0x56 ;
689
690 state->TunerRegs[94].Reg_Num = 157 ;
691 state->TunerRegs[94].Reg_Val = 0x17 ;
692
693 state->TunerRegs[95].Reg_Num = 158 ;
694 state->TunerRegs[95].Reg_Val = 0xA9 ;
695
696 state->TunerRegs[96].Reg_Num = 159 ;
697 state->TunerRegs[96].Reg_Val = 0x00 ;
698
699 state->TunerRegs[97].Reg_Num = 160 ;
700 state->TunerRegs[97].Reg_Val = 0x00 ;
701
702 state->TunerRegs[98].Reg_Num = 161 ;
703 state->TunerRegs[98].Reg_Val = 0x00 ;
704
705 state->TunerRegs[99].Reg_Num = 162 ;
706 state->TunerRegs[99].Reg_Val = 0x40 ;
707
708 state->TunerRegs[100].Reg_Num = 166 ;
709 state->TunerRegs[100].Reg_Val = 0xAE ;
710
711 state->TunerRegs[101].Reg_Num = 167 ;
712 state->TunerRegs[101].Reg_Val = 0x1B ;
713
714 state->TunerRegs[102].Reg_Num = 168 ;
715 state->TunerRegs[102].Reg_Val = 0xF2 ;
716
717 state->TunerRegs[103].Reg_Num = 195 ;
718 state->TunerRegs[103].Reg_Val = 0x00 ;
719
720 return 0 ;
721}
722
723static u16 MXL5005_ControlInit(struct dvb_frontend *fe)
724{
725 struct mxl5005s_state *state = fe->tuner_priv;
726 state->Init_Ctrl_Num = INITCTRL_NUM;
727
728 state->Init_Ctrl[0].Ctrl_Num = DN_IQTN_AMP_CUT ;
729 state->Init_Ctrl[0].size = 1 ;
730 state->Init_Ctrl[0].addr[0] = 73;
731 state->Init_Ctrl[0].bit[0] = 7;
732 state->Init_Ctrl[0].val[0] = 0;
733
734 state->Init_Ctrl[1].Ctrl_Num = BB_MODE ;
735 state->Init_Ctrl[1].size = 1 ;
736 state->Init_Ctrl[1].addr[0] = 53;
737 state->Init_Ctrl[1].bit[0] = 2;
738 state->Init_Ctrl[1].val[0] = 1;
739
740 state->Init_Ctrl[2].Ctrl_Num = BB_BUF ;
741 state->Init_Ctrl[2].size = 2 ;
742 state->Init_Ctrl[2].addr[0] = 53;
743 state->Init_Ctrl[2].bit[0] = 1;
744 state->Init_Ctrl[2].val[0] = 0;
745 state->Init_Ctrl[2].addr[1] = 57;
746 state->Init_Ctrl[2].bit[1] = 0;
747 state->Init_Ctrl[2].val[1] = 1;
748
749 state->Init_Ctrl[3].Ctrl_Num = BB_BUF_OA ;
750 state->Init_Ctrl[3].size = 1 ;
751 state->Init_Ctrl[3].addr[0] = 53;
752 state->Init_Ctrl[3].bit[0] = 0;
753 state->Init_Ctrl[3].val[0] = 0;
754
755 state->Init_Ctrl[4].Ctrl_Num = BB_ALPF_BANDSELECT ;
756 state->Init_Ctrl[4].size = 3 ;
757 state->Init_Ctrl[4].addr[0] = 53;
758 state->Init_Ctrl[4].bit[0] = 5;
759 state->Init_Ctrl[4].val[0] = 0;
760 state->Init_Ctrl[4].addr[1] = 53;
761 state->Init_Ctrl[4].bit[1] = 6;
762 state->Init_Ctrl[4].val[1] = 0;
763 state->Init_Ctrl[4].addr[2] = 53;
764 state->Init_Ctrl[4].bit[2] = 7;
765 state->Init_Ctrl[4].val[2] = 1;
766
767 state->Init_Ctrl[5].Ctrl_Num = BB_IQSWAP ;
768 state->Init_Ctrl[5].size = 1 ;
769 state->Init_Ctrl[5].addr[0] = 59;
770 state->Init_Ctrl[5].bit[0] = 0;
771 state->Init_Ctrl[5].val[0] = 0;
772
773 state->Init_Ctrl[6].Ctrl_Num = BB_DLPF_BANDSEL ;
774 state->Init_Ctrl[6].size = 2 ;
775 state->Init_Ctrl[6].addr[0] = 53;
776 state->Init_Ctrl[6].bit[0] = 3;
777 state->Init_Ctrl[6].val[0] = 0;
778 state->Init_Ctrl[6].addr[1] = 53;
779 state->Init_Ctrl[6].bit[1] = 4;
780 state->Init_Ctrl[6].val[1] = 1;
781
782 state->Init_Ctrl[7].Ctrl_Num = RFSYN_CHP_GAIN ;
783 state->Init_Ctrl[7].size = 4 ;
784 state->Init_Ctrl[7].addr[0] = 22;
785 state->Init_Ctrl[7].bit[0] = 4;
786 state->Init_Ctrl[7].val[0] = 0;
787 state->Init_Ctrl[7].addr[1] = 22;
788 state->Init_Ctrl[7].bit[1] = 5;
789 state->Init_Ctrl[7].val[1] = 1;
790 state->Init_Ctrl[7].addr[2] = 22;
791 state->Init_Ctrl[7].bit[2] = 6;
792 state->Init_Ctrl[7].val[2] = 1;
793 state->Init_Ctrl[7].addr[3] = 22;
794 state->Init_Ctrl[7].bit[3] = 7;
795 state->Init_Ctrl[7].val[3] = 0;
796
797 state->Init_Ctrl[8].Ctrl_Num = RFSYN_EN_CHP_HIGAIN ;
798 state->Init_Ctrl[8].size = 1 ;
799 state->Init_Ctrl[8].addr[0] = 22;
800 state->Init_Ctrl[8].bit[0] = 2;
801 state->Init_Ctrl[8].val[0] = 0;
802
803 state->Init_Ctrl[9].Ctrl_Num = AGC_IF ;
804 state->Init_Ctrl[9].size = 4 ;
805 state->Init_Ctrl[9].addr[0] = 76;
806 state->Init_Ctrl[9].bit[0] = 0;
807 state->Init_Ctrl[9].val[0] = 1;
808 state->Init_Ctrl[9].addr[1] = 76;
809 state->Init_Ctrl[9].bit[1] = 1;
810 state->Init_Ctrl[9].val[1] = 1;
811 state->Init_Ctrl[9].addr[2] = 76;
812 state->Init_Ctrl[9].bit[2] = 2;
813 state->Init_Ctrl[9].val[2] = 0;
814 state->Init_Ctrl[9].addr[3] = 76;
815 state->Init_Ctrl[9].bit[3] = 3;
816 state->Init_Ctrl[9].val[3] = 1;
817
818 state->Init_Ctrl[10].Ctrl_Num = AGC_RF ;
819 state->Init_Ctrl[10].size = 4 ;
820 state->Init_Ctrl[10].addr[0] = 76;
821 state->Init_Ctrl[10].bit[0] = 4;
822 state->Init_Ctrl[10].val[0] = 1;
823 state->Init_Ctrl[10].addr[1] = 76;
824 state->Init_Ctrl[10].bit[1] = 5;
825 state->Init_Ctrl[10].val[1] = 1;
826 state->Init_Ctrl[10].addr[2] = 76;
827 state->Init_Ctrl[10].bit[2] = 6;
828 state->Init_Ctrl[10].val[2] = 0;
829 state->Init_Ctrl[10].addr[3] = 76;
830 state->Init_Ctrl[10].bit[3] = 7;
831 state->Init_Ctrl[10].val[3] = 1;
832
833 state->Init_Ctrl[11].Ctrl_Num = IF_DIVVAL ;
834 state->Init_Ctrl[11].size = 5 ;
835 state->Init_Ctrl[11].addr[0] = 43;
836 state->Init_Ctrl[11].bit[0] = 3;
837 state->Init_Ctrl[11].val[0] = 0;
838 state->Init_Ctrl[11].addr[1] = 43;
839 state->Init_Ctrl[11].bit[1] = 4;
840 state->Init_Ctrl[11].val[1] = 0;
841 state->Init_Ctrl[11].addr[2] = 43;
842 state->Init_Ctrl[11].bit[2] = 5;
843 state->Init_Ctrl[11].val[2] = 0;
844 state->Init_Ctrl[11].addr[3] = 43;
845 state->Init_Ctrl[11].bit[3] = 6;
846 state->Init_Ctrl[11].val[3] = 1;
847 state->Init_Ctrl[11].addr[4] = 43;
848 state->Init_Ctrl[11].bit[4] = 7;
849 state->Init_Ctrl[11].val[4] = 0;
850
851 state->Init_Ctrl[12].Ctrl_Num = IF_VCO_BIAS ;
852 state->Init_Ctrl[12].size = 6 ;
853 state->Init_Ctrl[12].addr[0] = 44;
854 state->Init_Ctrl[12].bit[0] = 2;
855 state->Init_Ctrl[12].val[0] = 0;
856 state->Init_Ctrl[12].addr[1] = 44;
857 state->Init_Ctrl[12].bit[1] = 3;
858 state->Init_Ctrl[12].val[1] = 0;
859 state->Init_Ctrl[12].addr[2] = 44;
860 state->Init_Ctrl[12].bit[2] = 4;
861 state->Init_Ctrl[12].val[2] = 0;
862 state->Init_Ctrl[12].addr[3] = 44;
863 state->Init_Ctrl[12].bit[3] = 5;
864 state->Init_Ctrl[12].val[3] = 1;
865 state->Init_Ctrl[12].addr[4] = 44;
866 state->Init_Ctrl[12].bit[4] = 6;
867 state->Init_Ctrl[12].val[4] = 0;
868 state->Init_Ctrl[12].addr[5] = 44;
869 state->Init_Ctrl[12].bit[5] = 7;
870 state->Init_Ctrl[12].val[5] = 0;
871
872 state->Init_Ctrl[13].Ctrl_Num = CHCAL_INT_MOD_IF ;
873 state->Init_Ctrl[13].size = 7 ;
874 state->Init_Ctrl[13].addr[0] = 11;
875 state->Init_Ctrl[13].bit[0] = 0;
876 state->Init_Ctrl[13].val[0] = 1;
877 state->Init_Ctrl[13].addr[1] = 11;
878 state->Init_Ctrl[13].bit[1] = 1;
879 state->Init_Ctrl[13].val[1] = 0;
880 state->Init_Ctrl[13].addr[2] = 11;
881 state->Init_Ctrl[13].bit[2] = 2;
882 state->Init_Ctrl[13].val[2] = 0;
883 state->Init_Ctrl[13].addr[3] = 11;
884 state->Init_Ctrl[13].bit[3] = 3;
885 state->Init_Ctrl[13].val[3] = 1;
886 state->Init_Ctrl[13].addr[4] = 11;
887 state->Init_Ctrl[13].bit[4] = 4;
888 state->Init_Ctrl[13].val[4] = 1;
889 state->Init_Ctrl[13].addr[5] = 11;
890 state->Init_Ctrl[13].bit[5] = 5;
891 state->Init_Ctrl[13].val[5] = 0;
892 state->Init_Ctrl[13].addr[6] = 11;
893 state->Init_Ctrl[13].bit[6] = 6;
894 state->Init_Ctrl[13].val[6] = 0;
895
896 state->Init_Ctrl[14].Ctrl_Num = CHCAL_FRAC_MOD_IF ;
897 state->Init_Ctrl[14].size = 16 ;
898 state->Init_Ctrl[14].addr[0] = 13;
899 state->Init_Ctrl[14].bit[0] = 0;
900 state->Init_Ctrl[14].val[0] = 0;
901 state->Init_Ctrl[14].addr[1] = 13;
902 state->Init_Ctrl[14].bit[1] = 1;
903 state->Init_Ctrl[14].val[1] = 0;
904 state->Init_Ctrl[14].addr[2] = 13;
905 state->Init_Ctrl[14].bit[2] = 2;
906 state->Init_Ctrl[14].val[2] = 0;
907 state->Init_Ctrl[14].addr[3] = 13;
908 state->Init_Ctrl[14].bit[3] = 3;
909 state->Init_Ctrl[14].val[3] = 0;
910 state->Init_Ctrl[14].addr[4] = 13;
911 state->Init_Ctrl[14].bit[4] = 4;
912 state->Init_Ctrl[14].val[4] = 0;
913 state->Init_Ctrl[14].addr[5] = 13;
914 state->Init_Ctrl[14].bit[5] = 5;
915 state->Init_Ctrl[14].val[5] = 0;
916 state->Init_Ctrl[14].addr[6] = 13;
917 state->Init_Ctrl[14].bit[6] = 6;
918 state->Init_Ctrl[14].val[6] = 0;
919 state->Init_Ctrl[14].addr[7] = 13;
920 state->Init_Ctrl[14].bit[7] = 7;
921 state->Init_Ctrl[14].val[7] = 0;
922 state->Init_Ctrl[14].addr[8] = 12;
923 state->Init_Ctrl[14].bit[8] = 0;
924 state->Init_Ctrl[14].val[8] = 0;
925 state->Init_Ctrl[14].addr[9] = 12;
926 state->Init_Ctrl[14].bit[9] = 1;
927 state->Init_Ctrl[14].val[9] = 0;
928 state->Init_Ctrl[14].addr[10] = 12;
929 state->Init_Ctrl[14].bit[10] = 2;
930 state->Init_Ctrl[14].val[10] = 0;
931 state->Init_Ctrl[14].addr[11] = 12;
932 state->Init_Ctrl[14].bit[11] = 3;
933 state->Init_Ctrl[14].val[11] = 0;
934 state->Init_Ctrl[14].addr[12] = 12;
935 state->Init_Ctrl[14].bit[12] = 4;
936 state->Init_Ctrl[14].val[12] = 0;
937 state->Init_Ctrl[14].addr[13] = 12;
938 state->Init_Ctrl[14].bit[13] = 5;
939 state->Init_Ctrl[14].val[13] = 1;
940 state->Init_Ctrl[14].addr[14] = 12;
941 state->Init_Ctrl[14].bit[14] = 6;
942 state->Init_Ctrl[14].val[14] = 1;
943 state->Init_Ctrl[14].addr[15] = 12;
944 state->Init_Ctrl[14].bit[15] = 7;
945 state->Init_Ctrl[14].val[15] = 0;
946
947 state->Init_Ctrl[15].Ctrl_Num = DRV_RES_SEL ;
948 state->Init_Ctrl[15].size = 3 ;
949 state->Init_Ctrl[15].addr[0] = 147;
950 state->Init_Ctrl[15].bit[0] = 2;
951 state->Init_Ctrl[15].val[0] = 0;
952 state->Init_Ctrl[15].addr[1] = 147;
953 state->Init_Ctrl[15].bit[1] = 3;
954 state->Init_Ctrl[15].val[1] = 1;
955 state->Init_Ctrl[15].addr[2] = 147;
956 state->Init_Ctrl[15].bit[2] = 4;
957 state->Init_Ctrl[15].val[2] = 1;
958
959 state->Init_Ctrl[16].Ctrl_Num = I_DRIVER ;
960 state->Init_Ctrl[16].size = 2 ;
961 state->Init_Ctrl[16].addr[0] = 147;
962 state->Init_Ctrl[16].bit[0] = 0;
963 state->Init_Ctrl[16].val[0] = 0;
964 state->Init_Ctrl[16].addr[1] = 147;
965 state->Init_Ctrl[16].bit[1] = 1;
966 state->Init_Ctrl[16].val[1] = 1;
967
968 state->Init_Ctrl[17].Ctrl_Num = EN_AAF ;
969 state->Init_Ctrl[17].size = 1 ;
970 state->Init_Ctrl[17].addr[0] = 147;
971 state->Init_Ctrl[17].bit[0] = 7;
972 state->Init_Ctrl[17].val[0] = 0;
973
974 state->Init_Ctrl[18].Ctrl_Num = EN_3P ;
975 state->Init_Ctrl[18].size = 1 ;
976 state->Init_Ctrl[18].addr[0] = 147;
977 state->Init_Ctrl[18].bit[0] = 6;
978 state->Init_Ctrl[18].val[0] = 0;
979
980 state->Init_Ctrl[19].Ctrl_Num = EN_AUX_3P ;
981 state->Init_Ctrl[19].size = 1 ;
982 state->Init_Ctrl[19].addr[0] = 156;
983 state->Init_Ctrl[19].bit[0] = 0;
984 state->Init_Ctrl[19].val[0] = 0;
985
986 state->Init_Ctrl[20].Ctrl_Num = SEL_AAF_BAND ;
987 state->Init_Ctrl[20].size = 1 ;
988 state->Init_Ctrl[20].addr[0] = 147;
989 state->Init_Ctrl[20].bit[0] = 5;
990 state->Init_Ctrl[20].val[0] = 0;
991
992 state->Init_Ctrl[21].Ctrl_Num = SEQ_ENCLK16_CLK_OUT ;
993 state->Init_Ctrl[21].size = 1 ;
994 state->Init_Ctrl[21].addr[0] = 137;
995 state->Init_Ctrl[21].bit[0] = 4;
996 state->Init_Ctrl[21].val[0] = 0;
997
998 state->Init_Ctrl[22].Ctrl_Num = SEQ_SEL4_16B ;
999 state->Init_Ctrl[22].size = 1 ;
1000 state->Init_Ctrl[22].addr[0] = 137;
1001 state->Init_Ctrl[22].bit[0] = 7;
1002 state->Init_Ctrl[22].val[0] = 0;
1003
1004 state->Init_Ctrl[23].Ctrl_Num = XTAL_CAPSELECT ;
1005 state->Init_Ctrl[23].size = 1 ;
1006 state->Init_Ctrl[23].addr[0] = 91;
1007 state->Init_Ctrl[23].bit[0] = 5;
1008 state->Init_Ctrl[23].val[0] = 1;
1009
1010 state->Init_Ctrl[24].Ctrl_Num = IF_SEL_DBL ;
1011 state->Init_Ctrl[24].size = 1 ;
1012 state->Init_Ctrl[24].addr[0] = 43;
1013 state->Init_Ctrl[24].bit[0] = 0;
1014 state->Init_Ctrl[24].val[0] = 1;
1015
1016 state->Init_Ctrl[25].Ctrl_Num = RFSYN_R_DIV ;
1017 state->Init_Ctrl[25].size = 2 ;
1018 state->Init_Ctrl[25].addr[0] = 22;
1019 state->Init_Ctrl[25].bit[0] = 0;
1020 state->Init_Ctrl[25].val[0] = 1;
1021 state->Init_Ctrl[25].addr[1] = 22;
1022 state->Init_Ctrl[25].bit[1] = 1;
1023 state->Init_Ctrl[25].val[1] = 1;
1024
1025 state->Init_Ctrl[26].Ctrl_Num = SEQ_EXTSYNTHCALIF ;
1026 state->Init_Ctrl[26].size = 1 ;
1027 state->Init_Ctrl[26].addr[0] = 134;
1028 state->Init_Ctrl[26].bit[0] = 2;
1029 state->Init_Ctrl[26].val[0] = 0;
1030
1031 state->Init_Ctrl[27].Ctrl_Num = SEQ_EXTDCCAL ;
1032 state->Init_Ctrl[27].size = 1 ;
1033 state->Init_Ctrl[27].addr[0] = 137;
1034 state->Init_Ctrl[27].bit[0] = 3;
1035 state->Init_Ctrl[27].val[0] = 0;
1036
1037 state->Init_Ctrl[28].Ctrl_Num = AGC_EN_RSSI ;
1038 state->Init_Ctrl[28].size = 1 ;
1039 state->Init_Ctrl[28].addr[0] = 77;
1040 state->Init_Ctrl[28].bit[0] = 7;
1041 state->Init_Ctrl[28].val[0] = 0;
1042
1043 state->Init_Ctrl[29].Ctrl_Num = RFA_ENCLKRFAGC ;
1044 state->Init_Ctrl[29].size = 1 ;
1045 state->Init_Ctrl[29].addr[0] = 166;
1046 state->Init_Ctrl[29].bit[0] = 7;
1047 state->Init_Ctrl[29].val[0] = 1;
1048
1049 state->Init_Ctrl[30].Ctrl_Num = RFA_RSSI_REFH ;
1050 state->Init_Ctrl[30].size = 3 ;
1051 state->Init_Ctrl[30].addr[0] = 166;
1052 state->Init_Ctrl[30].bit[0] = 0;
1053 state->Init_Ctrl[30].val[0] = 0;
1054 state->Init_Ctrl[30].addr[1] = 166;
1055 state->Init_Ctrl[30].bit[1] = 1;
1056 state->Init_Ctrl[30].val[1] = 1;
1057 state->Init_Ctrl[30].addr[2] = 166;
1058 state->Init_Ctrl[30].bit[2] = 2;
1059 state->Init_Ctrl[30].val[2] = 1;
1060
1061 state->Init_Ctrl[31].Ctrl_Num = RFA_RSSI_REF ;
1062 state->Init_Ctrl[31].size = 3 ;
1063 state->Init_Ctrl[31].addr[0] = 166;
1064 state->Init_Ctrl[31].bit[0] = 3;
1065 state->Init_Ctrl[31].val[0] = 1;
1066 state->Init_Ctrl[31].addr[1] = 166;
1067 state->Init_Ctrl[31].bit[1] = 4;
1068 state->Init_Ctrl[31].val[1] = 0;
1069 state->Init_Ctrl[31].addr[2] = 166;
1070 state->Init_Ctrl[31].bit[2] = 5;
1071 state->Init_Ctrl[31].val[2] = 1;
1072
1073 state->Init_Ctrl[32].Ctrl_Num = RFA_RSSI_REFL ;
1074 state->Init_Ctrl[32].size = 3 ;
1075 state->Init_Ctrl[32].addr[0] = 167;
1076 state->Init_Ctrl[32].bit[0] = 0;
1077 state->Init_Ctrl[32].val[0] = 1;
1078 state->Init_Ctrl[32].addr[1] = 167;
1079 state->Init_Ctrl[32].bit[1] = 1;
1080 state->Init_Ctrl[32].val[1] = 1;
1081 state->Init_Ctrl[32].addr[2] = 167;
1082 state->Init_Ctrl[32].bit[2] = 2;
1083 state->Init_Ctrl[32].val[2] = 0;
1084
1085 state->Init_Ctrl[33].Ctrl_Num = RFA_FLR ;
1086 state->Init_Ctrl[33].size = 4 ;
1087 state->Init_Ctrl[33].addr[0] = 168;
1088 state->Init_Ctrl[33].bit[0] = 0;
1089 state->Init_Ctrl[33].val[0] = 0;
1090 state->Init_Ctrl[33].addr[1] = 168;
1091 state->Init_Ctrl[33].bit[1] = 1;
1092 state->Init_Ctrl[33].val[1] = 1;
1093 state->Init_Ctrl[33].addr[2] = 168;
1094 state->Init_Ctrl[33].bit[2] = 2;
1095 state->Init_Ctrl[33].val[2] = 0;
1096 state->Init_Ctrl[33].addr[3] = 168;
1097 state->Init_Ctrl[33].bit[3] = 3;
1098 state->Init_Ctrl[33].val[3] = 0;
1099
1100 state->Init_Ctrl[34].Ctrl_Num = RFA_CEIL ;
1101 state->Init_Ctrl[34].size = 4 ;
1102 state->Init_Ctrl[34].addr[0] = 168;
1103 state->Init_Ctrl[34].bit[0] = 4;
1104 state->Init_Ctrl[34].val[0] = 1;
1105 state->Init_Ctrl[34].addr[1] = 168;
1106 state->Init_Ctrl[34].bit[1] = 5;
1107 state->Init_Ctrl[34].val[1] = 1;
1108 state->Init_Ctrl[34].addr[2] = 168;
1109 state->Init_Ctrl[34].bit[2] = 6;
1110 state->Init_Ctrl[34].val[2] = 1;
1111 state->Init_Ctrl[34].addr[3] = 168;
1112 state->Init_Ctrl[34].bit[3] = 7;
1113 state->Init_Ctrl[34].val[3] = 1;
1114
1115 state->Init_Ctrl[35].Ctrl_Num = SEQ_EXTIQFSMPULSE ;
1116 state->Init_Ctrl[35].size = 1 ;
1117 state->Init_Ctrl[35].addr[0] = 135;
1118 state->Init_Ctrl[35].bit[0] = 0;
1119 state->Init_Ctrl[35].val[0] = 0;
1120
1121 state->Init_Ctrl[36].Ctrl_Num = OVERRIDE_1 ;
1122 state->Init_Ctrl[36].size = 1 ;
1123 state->Init_Ctrl[36].addr[0] = 56;
1124 state->Init_Ctrl[36].bit[0] = 3;
1125 state->Init_Ctrl[36].val[0] = 0;
1126
1127 state->Init_Ctrl[37].Ctrl_Num = BB_INITSTATE_DLPF_TUNE ;
1128 state->Init_Ctrl[37].size = 7 ;
1129 state->Init_Ctrl[37].addr[0] = 59;
1130 state->Init_Ctrl[37].bit[0] = 1;
1131 state->Init_Ctrl[37].val[0] = 0;
1132 state->Init_Ctrl[37].addr[1] = 59;
1133 state->Init_Ctrl[37].bit[1] = 2;
1134 state->Init_Ctrl[37].val[1] = 0;
1135 state->Init_Ctrl[37].addr[2] = 59;
1136 state->Init_Ctrl[37].bit[2] = 3;
1137 state->Init_Ctrl[37].val[2] = 0;
1138 state->Init_Ctrl[37].addr[3] = 59;
1139 state->Init_Ctrl[37].bit[3] = 4;
1140 state->Init_Ctrl[37].val[3] = 0;
1141 state->Init_Ctrl[37].addr[4] = 59;
1142 state->Init_Ctrl[37].bit[4] = 5;
1143 state->Init_Ctrl[37].val[4] = 0;
1144 state->Init_Ctrl[37].addr[5] = 59;
1145 state->Init_Ctrl[37].bit[5] = 6;
1146 state->Init_Ctrl[37].val[5] = 0;
1147 state->Init_Ctrl[37].addr[6] = 59;
1148 state->Init_Ctrl[37].bit[6] = 7;
1149 state->Init_Ctrl[37].val[6] = 0;
1150
1151 state->Init_Ctrl[38].Ctrl_Num = TG_R_DIV ;
1152 state->Init_Ctrl[38].size = 6 ;
1153 state->Init_Ctrl[38].addr[0] = 32;
1154 state->Init_Ctrl[38].bit[0] = 2;
1155 state->Init_Ctrl[38].val[0] = 0;
1156 state->Init_Ctrl[38].addr[1] = 32;
1157 state->Init_Ctrl[38].bit[1] = 3;
1158 state->Init_Ctrl[38].val[1] = 0;
1159 state->Init_Ctrl[38].addr[2] = 32;
1160 state->Init_Ctrl[38].bit[2] = 4;
1161 state->Init_Ctrl[38].val[2] = 0;
1162 state->Init_Ctrl[38].addr[3] = 32;
1163 state->Init_Ctrl[38].bit[3] = 5;
1164 state->Init_Ctrl[38].val[3] = 0;
1165 state->Init_Ctrl[38].addr[4] = 32;
1166 state->Init_Ctrl[38].bit[4] = 6;
1167 state->Init_Ctrl[38].val[4] = 1;
1168 state->Init_Ctrl[38].addr[5] = 32;
1169 state->Init_Ctrl[38].bit[5] = 7;
1170 state->Init_Ctrl[38].val[5] = 0;
1171
1172 state->Init_Ctrl[39].Ctrl_Num = EN_CHP_LIN_B ;
1173 state->Init_Ctrl[39].size = 1 ;
1174 state->Init_Ctrl[39].addr[0] = 25;
1175 state->Init_Ctrl[39].bit[0] = 3;
1176 state->Init_Ctrl[39].val[0] = 1;
1177
1178
1179 state->CH_Ctrl_Num = CHCTRL_NUM ;
1180
1181 state->CH_Ctrl[0].Ctrl_Num = DN_POLY ;
1182 state->CH_Ctrl[0].size = 2 ;
1183 state->CH_Ctrl[0].addr[0] = 68;
1184 state->CH_Ctrl[0].bit[0] = 6;
1185 state->CH_Ctrl[0].val[0] = 1;
1186 state->CH_Ctrl[0].addr[1] = 68;
1187 state->CH_Ctrl[0].bit[1] = 7;
1188 state->CH_Ctrl[0].val[1] = 1;
1189
1190 state->CH_Ctrl[1].Ctrl_Num = DN_RFGAIN ;
1191 state->CH_Ctrl[1].size = 2 ;
1192 state->CH_Ctrl[1].addr[0] = 70;
1193 state->CH_Ctrl[1].bit[0] = 6;
1194 state->CH_Ctrl[1].val[0] = 1;
1195 state->CH_Ctrl[1].addr[1] = 70;
1196 state->CH_Ctrl[1].bit[1] = 7;
1197 state->CH_Ctrl[1].val[1] = 0;
1198
1199 state->CH_Ctrl[2].Ctrl_Num = DN_CAP_RFLPF ;
1200 state->CH_Ctrl[2].size = 9 ;
1201 state->CH_Ctrl[2].addr[0] = 69;
1202 state->CH_Ctrl[2].bit[0] = 5;
1203 state->CH_Ctrl[2].val[0] = 0;
1204 state->CH_Ctrl[2].addr[1] = 69;
1205 state->CH_Ctrl[2].bit[1] = 6;
1206 state->CH_Ctrl[2].val[1] = 0;
1207 state->CH_Ctrl[2].addr[2] = 69;
1208 state->CH_Ctrl[2].bit[2] = 7;
1209 state->CH_Ctrl[2].val[2] = 0;
1210 state->CH_Ctrl[2].addr[3] = 68;
1211 state->CH_Ctrl[2].bit[3] = 0;
1212 state->CH_Ctrl[2].val[3] = 0;
1213 state->CH_Ctrl[2].addr[4] = 68;
1214 state->CH_Ctrl[2].bit[4] = 1;
1215 state->CH_Ctrl[2].val[4] = 0;
1216 state->CH_Ctrl[2].addr[5] = 68;
1217 state->CH_Ctrl[2].bit[5] = 2;
1218 state->CH_Ctrl[2].val[5] = 0;
1219 state->CH_Ctrl[2].addr[6] = 68;
1220 state->CH_Ctrl[2].bit[6] = 3;
1221 state->CH_Ctrl[2].val[6] = 0;
1222 state->CH_Ctrl[2].addr[7] = 68;
1223 state->CH_Ctrl[2].bit[7] = 4;
1224 state->CH_Ctrl[2].val[7] = 0;
1225 state->CH_Ctrl[2].addr[8] = 68;
1226 state->CH_Ctrl[2].bit[8] = 5;
1227 state->CH_Ctrl[2].val[8] = 0;
1228
1229 state->CH_Ctrl[3].Ctrl_Num = DN_EN_VHFUHFBAR ;
1230 state->CH_Ctrl[3].size = 1 ;
1231 state->CH_Ctrl[3].addr[0] = 70;
1232 state->CH_Ctrl[3].bit[0] = 5;
1233 state->CH_Ctrl[3].val[0] = 0;
1234
1235 state->CH_Ctrl[4].Ctrl_Num = DN_GAIN_ADJUST ;
1236 state->CH_Ctrl[4].size = 3 ;
1237 state->CH_Ctrl[4].addr[0] = 73;
1238 state->CH_Ctrl[4].bit[0] = 4;
1239 state->CH_Ctrl[4].val[0] = 0;
1240 state->CH_Ctrl[4].addr[1] = 73;
1241 state->CH_Ctrl[4].bit[1] = 5;
1242 state->CH_Ctrl[4].val[1] = 1;
1243 state->CH_Ctrl[4].addr[2] = 73;
1244 state->CH_Ctrl[4].bit[2] = 6;
1245 state->CH_Ctrl[4].val[2] = 0;
1246
1247 state->CH_Ctrl[5].Ctrl_Num = DN_IQTNBUF_AMP ;
1248 state->CH_Ctrl[5].size = 4 ;
1249 state->CH_Ctrl[5].addr[0] = 70;
1250 state->CH_Ctrl[5].bit[0] = 0;
1251 state->CH_Ctrl[5].val[0] = 0;
1252 state->CH_Ctrl[5].addr[1] = 70;
1253 state->CH_Ctrl[5].bit[1] = 1;
1254 state->CH_Ctrl[5].val[1] = 0;
1255 state->CH_Ctrl[5].addr[2] = 70;
1256 state->CH_Ctrl[5].bit[2] = 2;
1257 state->CH_Ctrl[5].val[2] = 0;
1258 state->CH_Ctrl[5].addr[3] = 70;
1259 state->CH_Ctrl[5].bit[3] = 3;
1260 state->CH_Ctrl[5].val[3] = 0;
1261
1262 state->CH_Ctrl[6].Ctrl_Num = DN_IQTNGNBFBIAS_BST ;
1263 state->CH_Ctrl[6].size = 1 ;
1264 state->CH_Ctrl[6].addr[0] = 70;
1265 state->CH_Ctrl[6].bit[0] = 4;
1266 state->CH_Ctrl[6].val[0] = 1;
1267
1268 state->CH_Ctrl[7].Ctrl_Num = RFSYN_EN_OUTMUX ;
1269 state->CH_Ctrl[7].size = 1 ;
1270 state->CH_Ctrl[7].addr[0] = 111;
1271 state->CH_Ctrl[7].bit[0] = 4;
1272 state->CH_Ctrl[7].val[0] = 0;
1273
1274 state->CH_Ctrl[8].Ctrl_Num = RFSYN_SEL_VCO_OUT ;
1275 state->CH_Ctrl[8].size = 1 ;
1276 state->CH_Ctrl[8].addr[0] = 111;
1277 state->CH_Ctrl[8].bit[0] = 7;
1278 state->CH_Ctrl[8].val[0] = 1;
1279
1280 state->CH_Ctrl[9].Ctrl_Num = RFSYN_SEL_VCO_HI ;
1281 state->CH_Ctrl[9].size = 1 ;
1282 state->CH_Ctrl[9].addr[0] = 111;
1283 state->CH_Ctrl[9].bit[0] = 6;
1284 state->CH_Ctrl[9].val[0] = 1;
1285
1286 state->CH_Ctrl[10].Ctrl_Num = RFSYN_SEL_DIVM ;
1287 state->CH_Ctrl[10].size = 1 ;
1288 state->CH_Ctrl[10].addr[0] = 111;
1289 state->CH_Ctrl[10].bit[0] = 5;
1290 state->CH_Ctrl[10].val[0] = 0;
1291
1292 state->CH_Ctrl[11].Ctrl_Num = RFSYN_RF_DIV_BIAS ;
1293 state->CH_Ctrl[11].size = 2 ;
1294 state->CH_Ctrl[11].addr[0] = 110;
1295 state->CH_Ctrl[11].bit[0] = 0;
1296 state->CH_Ctrl[11].val[0] = 1;
1297 state->CH_Ctrl[11].addr[1] = 110;
1298 state->CH_Ctrl[11].bit[1] = 1;
1299 state->CH_Ctrl[11].val[1] = 0;
1300
1301 state->CH_Ctrl[12].Ctrl_Num = DN_SEL_FREQ ;
1302 state->CH_Ctrl[12].size = 3 ;
1303 state->CH_Ctrl[12].addr[0] = 69;
1304 state->CH_Ctrl[12].bit[0] = 2;
1305 state->CH_Ctrl[12].val[0] = 0;
1306 state->CH_Ctrl[12].addr[1] = 69;
1307 state->CH_Ctrl[12].bit[1] = 3;
1308 state->CH_Ctrl[12].val[1] = 0;
1309 state->CH_Ctrl[12].addr[2] = 69;
1310 state->CH_Ctrl[12].bit[2] = 4;
1311 state->CH_Ctrl[12].val[2] = 0;
1312
1313 state->CH_Ctrl[13].Ctrl_Num = RFSYN_VCO_BIAS ;
1314 state->CH_Ctrl[13].size = 6 ;
1315 state->CH_Ctrl[13].addr[0] = 110;
1316 state->CH_Ctrl[13].bit[0] = 2;
1317 state->CH_Ctrl[13].val[0] = 0;
1318 state->CH_Ctrl[13].addr[1] = 110;
1319 state->CH_Ctrl[13].bit[1] = 3;
1320 state->CH_Ctrl[13].val[1] = 0;
1321 state->CH_Ctrl[13].addr[2] = 110;
1322 state->CH_Ctrl[13].bit[2] = 4;
1323 state->CH_Ctrl[13].val[2] = 0;
1324 state->CH_Ctrl[13].addr[3] = 110;
1325 state->CH_Ctrl[13].bit[3] = 5;
1326 state->CH_Ctrl[13].val[3] = 0;
1327 state->CH_Ctrl[13].addr[4] = 110;
1328 state->CH_Ctrl[13].bit[4] = 6;
1329 state->CH_Ctrl[13].val[4] = 0;
1330 state->CH_Ctrl[13].addr[5] = 110;
1331 state->CH_Ctrl[13].bit[5] = 7;
1332 state->CH_Ctrl[13].val[5] = 1;
1333
1334 state->CH_Ctrl[14].Ctrl_Num = CHCAL_INT_MOD_RF ;
1335 state->CH_Ctrl[14].size = 7 ;
1336 state->CH_Ctrl[14].addr[0] = 14;
1337 state->CH_Ctrl[14].bit[0] = 0;
1338 state->CH_Ctrl[14].val[0] = 0;
1339 state->CH_Ctrl[14].addr[1] = 14;
1340 state->CH_Ctrl[14].bit[1] = 1;
1341 state->CH_Ctrl[14].val[1] = 0;
1342 state->CH_Ctrl[14].addr[2] = 14;
1343 state->CH_Ctrl[14].bit[2] = 2;
1344 state->CH_Ctrl[14].val[2] = 0;
1345 state->CH_Ctrl[14].addr[3] = 14;
1346 state->CH_Ctrl[14].bit[3] = 3;
1347 state->CH_Ctrl[14].val[3] = 0;
1348 state->CH_Ctrl[14].addr[4] = 14;
1349 state->CH_Ctrl[14].bit[4] = 4;
1350 state->CH_Ctrl[14].val[4] = 0;
1351 state->CH_Ctrl[14].addr[5] = 14;
1352 state->CH_Ctrl[14].bit[5] = 5;
1353 state->CH_Ctrl[14].val[5] = 0;
1354 state->CH_Ctrl[14].addr[6] = 14;
1355 state->CH_Ctrl[14].bit[6] = 6;
1356 state->CH_Ctrl[14].val[6] = 0;
1357
1358 state->CH_Ctrl[15].Ctrl_Num = CHCAL_FRAC_MOD_RF ;
1359 state->CH_Ctrl[15].size = 18 ;
1360 state->CH_Ctrl[15].addr[0] = 17;
1361 state->CH_Ctrl[15].bit[0] = 6;
1362 state->CH_Ctrl[15].val[0] = 0;
1363 state->CH_Ctrl[15].addr[1] = 17;
1364 state->CH_Ctrl[15].bit[1] = 7;
1365 state->CH_Ctrl[15].val[1] = 0;
1366 state->CH_Ctrl[15].addr[2] = 16;
1367 state->CH_Ctrl[15].bit[2] = 0;
1368 state->CH_Ctrl[15].val[2] = 0;
1369 state->CH_Ctrl[15].addr[3] = 16;
1370 state->CH_Ctrl[15].bit[3] = 1;
1371 state->CH_Ctrl[15].val[3] = 0;
1372 state->CH_Ctrl[15].addr[4] = 16;
1373 state->CH_Ctrl[15].bit[4] = 2;
1374 state->CH_Ctrl[15].val[4] = 0;
1375 state->CH_Ctrl[15].addr[5] = 16;
1376 state->CH_Ctrl[15].bit[5] = 3;
1377 state->CH_Ctrl[15].val[5] = 0;
1378 state->CH_Ctrl[15].addr[6] = 16;
1379 state->CH_Ctrl[15].bit[6] = 4;
1380 state->CH_Ctrl[15].val[6] = 0;
1381 state->CH_Ctrl[15].addr[7] = 16;
1382 state->CH_Ctrl[15].bit[7] = 5;
1383 state->CH_Ctrl[15].val[7] = 0;
1384 state->CH_Ctrl[15].addr[8] = 16;
1385 state->CH_Ctrl[15].bit[8] = 6;
1386 state->CH_Ctrl[15].val[8] = 0;
1387 state->CH_Ctrl[15].addr[9] = 16;
1388 state->CH_Ctrl[15].bit[9] = 7;
1389 state->CH_Ctrl[15].val[9] = 0;
1390 state->CH_Ctrl[15].addr[10] = 15;
1391 state->CH_Ctrl[15].bit[10] = 0;
1392 state->CH_Ctrl[15].val[10] = 0;
1393 state->CH_Ctrl[15].addr[11] = 15;
1394 state->CH_Ctrl[15].bit[11] = 1;
1395 state->CH_Ctrl[15].val[11] = 0;
1396 state->CH_Ctrl[15].addr[12] = 15;
1397 state->CH_Ctrl[15].bit[12] = 2;
1398 state->CH_Ctrl[15].val[12] = 0;
1399 state->CH_Ctrl[15].addr[13] = 15;
1400 state->CH_Ctrl[15].bit[13] = 3;
1401 state->CH_Ctrl[15].val[13] = 0;
1402 state->CH_Ctrl[15].addr[14] = 15;
1403 state->CH_Ctrl[15].bit[14] = 4;
1404 state->CH_Ctrl[15].val[14] = 0;
1405 state->CH_Ctrl[15].addr[15] = 15;
1406 state->CH_Ctrl[15].bit[15] = 5;
1407 state->CH_Ctrl[15].val[15] = 0;
1408 state->CH_Ctrl[15].addr[16] = 15;
1409 state->CH_Ctrl[15].bit[16] = 6;
1410 state->CH_Ctrl[15].val[16] = 1;
1411 state->CH_Ctrl[15].addr[17] = 15;
1412 state->CH_Ctrl[15].bit[17] = 7;
1413 state->CH_Ctrl[15].val[17] = 1;
1414
1415 state->CH_Ctrl[16].Ctrl_Num = RFSYN_LPF_R ;
1416 state->CH_Ctrl[16].size = 5 ;
1417 state->CH_Ctrl[16].addr[0] = 112;
1418 state->CH_Ctrl[16].bit[0] = 0;
1419 state->CH_Ctrl[16].val[0] = 0;
1420 state->CH_Ctrl[16].addr[1] = 112;
1421 state->CH_Ctrl[16].bit[1] = 1;
1422 state->CH_Ctrl[16].val[1] = 0;
1423 state->CH_Ctrl[16].addr[2] = 112;
1424 state->CH_Ctrl[16].bit[2] = 2;
1425 state->CH_Ctrl[16].val[2] = 0;
1426 state->CH_Ctrl[16].addr[3] = 112;
1427 state->CH_Ctrl[16].bit[3] = 3;
1428 state->CH_Ctrl[16].val[3] = 0;
1429 state->CH_Ctrl[16].addr[4] = 112;
1430 state->CH_Ctrl[16].bit[4] = 4;
1431 state->CH_Ctrl[16].val[4] = 1;
1432
1433 state->CH_Ctrl[17].Ctrl_Num = CHCAL_EN_INT_RF ;
1434 state->CH_Ctrl[17].size = 1 ;
1435 state->CH_Ctrl[17].addr[0] = 14;
1436 state->CH_Ctrl[17].bit[0] = 7;
1437 state->CH_Ctrl[17].val[0] = 0;
1438
1439 state->CH_Ctrl[18].Ctrl_Num = TG_LO_DIVVAL ;
1440 state->CH_Ctrl[18].size = 4 ;
1441 state->CH_Ctrl[18].addr[0] = 107;
1442 state->CH_Ctrl[18].bit[0] = 3;
1443 state->CH_Ctrl[18].val[0] = 0;
1444 state->CH_Ctrl[18].addr[1] = 107;
1445 state->CH_Ctrl[18].bit[1] = 4;
1446 state->CH_Ctrl[18].val[1] = 0;
1447 state->CH_Ctrl[18].addr[2] = 107;
1448 state->CH_Ctrl[18].bit[2] = 5;
1449 state->CH_Ctrl[18].val[2] = 0;
1450 state->CH_Ctrl[18].addr[3] = 107;
1451 state->CH_Ctrl[18].bit[3] = 6;
1452 state->CH_Ctrl[18].val[3] = 0;
1453
1454 state->CH_Ctrl[19].Ctrl_Num = TG_LO_SELVAL ;
1455 state->CH_Ctrl[19].size = 3 ;
1456 state->CH_Ctrl[19].addr[0] = 107;
1457 state->CH_Ctrl[19].bit[0] = 7;
1458 state->CH_Ctrl[19].val[0] = 1;
1459 state->CH_Ctrl[19].addr[1] = 106;
1460 state->CH_Ctrl[19].bit[1] = 0;
1461 state->CH_Ctrl[19].val[1] = 1;
1462 state->CH_Ctrl[19].addr[2] = 106;
1463 state->CH_Ctrl[19].bit[2] = 1;
1464 state->CH_Ctrl[19].val[2] = 1;
1465
1466 state->CH_Ctrl[20].Ctrl_Num = TG_DIV_VAL ;
1467 state->CH_Ctrl[20].size = 11 ;
1468 state->CH_Ctrl[20].addr[0] = 109;
1469 state->CH_Ctrl[20].bit[0] = 2;
1470 state->CH_Ctrl[20].val[0] = 0;
1471 state->CH_Ctrl[20].addr[1] = 109;
1472 state->CH_Ctrl[20].bit[1] = 3;
1473 state->CH_Ctrl[20].val[1] = 0;
1474 state->CH_Ctrl[20].addr[2] = 109;
1475 state->CH_Ctrl[20].bit[2] = 4;
1476 state->CH_Ctrl[20].val[2] = 0;
1477 state->CH_Ctrl[20].addr[3] = 109;
1478 state->CH_Ctrl[20].bit[3] = 5;
1479 state->CH_Ctrl[20].val[3] = 0;
1480 state->CH_Ctrl[20].addr[4] = 109;
1481 state->CH_Ctrl[20].bit[4] = 6;
1482 state->CH_Ctrl[20].val[4] = 0;
1483 state->CH_Ctrl[20].addr[5] = 109;
1484 state->CH_Ctrl[20].bit[5] = 7;
1485 state->CH_Ctrl[20].val[5] = 0;
1486 state->CH_Ctrl[20].addr[6] = 108;
1487 state->CH_Ctrl[20].bit[6] = 0;
1488 state->CH_Ctrl[20].val[6] = 0;
1489 state->CH_Ctrl[20].addr[7] = 108;
1490 state->CH_Ctrl[20].bit[7] = 1;
1491 state->CH_Ctrl[20].val[7] = 0;
1492 state->CH_Ctrl[20].addr[8] = 108;
1493 state->CH_Ctrl[20].bit[8] = 2;
1494 state->CH_Ctrl[20].val[8] = 1;
1495 state->CH_Ctrl[20].addr[9] = 108;
1496 state->CH_Ctrl[20].bit[9] = 3;
1497 state->CH_Ctrl[20].val[9] = 1;
1498 state->CH_Ctrl[20].addr[10] = 108;
1499 state->CH_Ctrl[20].bit[10] = 4;
1500 state->CH_Ctrl[20].val[10] = 1;
1501
1502 state->CH_Ctrl[21].Ctrl_Num = TG_VCO_BIAS ;
1503 state->CH_Ctrl[21].size = 6 ;
1504 state->CH_Ctrl[21].addr[0] = 106;
1505 state->CH_Ctrl[21].bit[0] = 2;
1506 state->CH_Ctrl[21].val[0] = 0;
1507 state->CH_Ctrl[21].addr[1] = 106;
1508 state->CH_Ctrl[21].bit[1] = 3;
1509 state->CH_Ctrl[21].val[1] = 0;
1510 state->CH_Ctrl[21].addr[2] = 106;
1511 state->CH_Ctrl[21].bit[2] = 4;
1512 state->CH_Ctrl[21].val[2] = 0;
1513 state->CH_Ctrl[21].addr[3] = 106;
1514 state->CH_Ctrl[21].bit[3] = 5;
1515 state->CH_Ctrl[21].val[3] = 0;
1516 state->CH_Ctrl[21].addr[4] = 106;
1517 state->CH_Ctrl[21].bit[4] = 6;
1518 state->CH_Ctrl[21].val[4] = 0;
1519 state->CH_Ctrl[21].addr[5] = 106;
1520 state->CH_Ctrl[21].bit[5] = 7;
1521 state->CH_Ctrl[21].val[5] = 1;
1522
1523 state->CH_Ctrl[22].Ctrl_Num = SEQ_EXTPOWERUP ;
1524 state->CH_Ctrl[22].size = 1 ;
1525 state->CH_Ctrl[22].addr[0] = 138;
1526 state->CH_Ctrl[22].bit[0] = 4;
1527 state->CH_Ctrl[22].val[0] = 1;
1528
1529 state->CH_Ctrl[23].Ctrl_Num = OVERRIDE_2 ;
1530 state->CH_Ctrl[23].size = 1 ;
1531 state->CH_Ctrl[23].addr[0] = 17;
1532 state->CH_Ctrl[23].bit[0] = 5;
1533 state->CH_Ctrl[23].val[0] = 0;
1534
1535 state->CH_Ctrl[24].Ctrl_Num = OVERRIDE_3 ;
1536 state->CH_Ctrl[24].size = 1 ;
1537 state->CH_Ctrl[24].addr[0] = 111;
1538 state->CH_Ctrl[24].bit[0] = 3;
1539 state->CH_Ctrl[24].val[0] = 0;
1540
1541 state->CH_Ctrl[25].Ctrl_Num = OVERRIDE_4 ;
1542 state->CH_Ctrl[25].size = 1 ;
1543 state->CH_Ctrl[25].addr[0] = 112;
1544 state->CH_Ctrl[25].bit[0] = 7;
1545 state->CH_Ctrl[25].val[0] = 0;
1546
1547 state->CH_Ctrl[26].Ctrl_Num = SEQ_FSM_PULSE ;
1548 state->CH_Ctrl[26].size = 1 ;
1549 state->CH_Ctrl[26].addr[0] = 136;
1550 state->CH_Ctrl[26].bit[0] = 7;
1551 state->CH_Ctrl[26].val[0] = 0;
1552
1553 state->CH_Ctrl[27].Ctrl_Num = GPIO_4B ;
1554 state->CH_Ctrl[27].size = 1 ;
1555 state->CH_Ctrl[27].addr[0] = 149;
1556 state->CH_Ctrl[27].bit[0] = 7;
1557 state->CH_Ctrl[27].val[0] = 0;
1558
1559 state->CH_Ctrl[28].Ctrl_Num = GPIO_3B ;
1560 state->CH_Ctrl[28].size = 1 ;
1561 state->CH_Ctrl[28].addr[0] = 149;
1562 state->CH_Ctrl[28].bit[0] = 6;
1563 state->CH_Ctrl[28].val[0] = 0;
1564
1565 state->CH_Ctrl[29].Ctrl_Num = GPIO_4 ;
1566 state->CH_Ctrl[29].size = 1 ;
1567 state->CH_Ctrl[29].addr[0] = 149;
1568 state->CH_Ctrl[29].bit[0] = 5;
1569 state->CH_Ctrl[29].val[0] = 1;
1570
1571 state->CH_Ctrl[30].Ctrl_Num = GPIO_3 ;
1572 state->CH_Ctrl[30].size = 1 ;
1573 state->CH_Ctrl[30].addr[0] = 149;
1574 state->CH_Ctrl[30].bit[0] = 4;
1575 state->CH_Ctrl[30].val[0] = 1;
1576
1577 state->CH_Ctrl[31].Ctrl_Num = GPIO_1B ;
1578 state->CH_Ctrl[31].size = 1 ;
1579 state->CH_Ctrl[31].addr[0] = 149;
1580 state->CH_Ctrl[31].bit[0] = 3;
1581 state->CH_Ctrl[31].val[0] = 0;
1582
1583 state->CH_Ctrl[32].Ctrl_Num = DAC_A_ENABLE ;
1584 state->CH_Ctrl[32].size = 1 ;
1585 state->CH_Ctrl[32].addr[0] = 93;
1586 state->CH_Ctrl[32].bit[0] = 1;
1587 state->CH_Ctrl[32].val[0] = 0;
1588
1589 state->CH_Ctrl[33].Ctrl_Num = DAC_B_ENABLE ;
1590 state->CH_Ctrl[33].size = 1 ;
1591 state->CH_Ctrl[33].addr[0] = 93;
1592 state->CH_Ctrl[33].bit[0] = 0;
1593 state->CH_Ctrl[33].val[0] = 0;
1594
1595 state->CH_Ctrl[34].Ctrl_Num = DAC_DIN_A ;
1596 state->CH_Ctrl[34].size = 6 ;
1597 state->CH_Ctrl[34].addr[0] = 92;
1598 state->CH_Ctrl[34].bit[0] = 2;
1599 state->CH_Ctrl[34].val[0] = 0;
1600 state->CH_Ctrl[34].addr[1] = 92;
1601 state->CH_Ctrl[34].bit[1] = 3;
1602 state->CH_Ctrl[34].val[1] = 0;
1603 state->CH_Ctrl[34].addr[2] = 92;
1604 state->CH_Ctrl[34].bit[2] = 4;
1605 state->CH_Ctrl[34].val[2] = 0;
1606 state->CH_Ctrl[34].addr[3] = 92;
1607 state->CH_Ctrl[34].bit[3] = 5;
1608 state->CH_Ctrl[34].val[3] = 0;
1609 state->CH_Ctrl[34].addr[4] = 92;
1610 state->CH_Ctrl[34].bit[4] = 6;
1611 state->CH_Ctrl[34].val[4] = 0;
1612 state->CH_Ctrl[34].addr[5] = 92;
1613 state->CH_Ctrl[34].bit[5] = 7;
1614 state->CH_Ctrl[34].val[5] = 0;
1615
1616 state->CH_Ctrl[35].Ctrl_Num = DAC_DIN_B ;
1617 state->CH_Ctrl[35].size = 6 ;
1618 state->CH_Ctrl[35].addr[0] = 93;
1619 state->CH_Ctrl[35].bit[0] = 2;
1620 state->CH_Ctrl[35].val[0] = 0;
1621 state->CH_Ctrl[35].addr[1] = 93;
1622 state->CH_Ctrl[35].bit[1] = 3;
1623 state->CH_Ctrl[35].val[1] = 0;
1624 state->CH_Ctrl[35].addr[2] = 93;
1625 state->CH_Ctrl[35].bit[2] = 4;
1626 state->CH_Ctrl[35].val[2] = 0;
1627 state->CH_Ctrl[35].addr[3] = 93;
1628 state->CH_Ctrl[35].bit[3] = 5;
1629 state->CH_Ctrl[35].val[3] = 0;
1630 state->CH_Ctrl[35].addr[4] = 93;
1631 state->CH_Ctrl[35].bit[4] = 6;
1632 state->CH_Ctrl[35].val[4] = 0;
1633 state->CH_Ctrl[35].addr[5] = 93;
1634 state->CH_Ctrl[35].bit[5] = 7;
1635 state->CH_Ctrl[35].val[5] = 0;
1636
1637#ifdef _MXL_PRODUCTION
1638 state->CH_Ctrl[36].Ctrl_Num = RFSYN_EN_DIV ;
1639 state->CH_Ctrl[36].size = 1 ;
1640 state->CH_Ctrl[36].addr[0] = 109;
1641 state->CH_Ctrl[36].bit[0] = 1;
1642 state->CH_Ctrl[36].val[0] = 1;
1643
1644 state->CH_Ctrl[37].Ctrl_Num = RFSYN_DIVM ;
1645 state->CH_Ctrl[37].size = 2 ;
1646 state->CH_Ctrl[37].addr[0] = 112;
1647 state->CH_Ctrl[37].bit[0] = 5;
1648 state->CH_Ctrl[37].val[0] = 0;
1649 state->CH_Ctrl[37].addr[1] = 112;
1650 state->CH_Ctrl[37].bit[1] = 6;
1651 state->CH_Ctrl[37].val[1] = 0;
1652
1653 state->CH_Ctrl[38].Ctrl_Num = DN_BYPASS_AGC_I2C ;
1654 state->CH_Ctrl[38].size = 1 ;
1655 state->CH_Ctrl[38].addr[0] = 65;
1656 state->CH_Ctrl[38].bit[0] = 1;
1657 state->CH_Ctrl[38].val[0] = 0;
1658#endif
1659
1660 return 0 ;
1661}
1662
1663static void InitTunerControls(struct dvb_frontend *fe)
1664{
1665 MXL5005_RegisterInit(fe);
1666 MXL5005_ControlInit(fe);
1667#ifdef _MXL_INTERNAL
1668 MXL5005_MXLControlInit(fe);
1669#endif
1670}
1671
1672static u16 MXL5005_TunerConfig(struct dvb_frontend *fe,
1673 u8 Mode, /* 0: Analog Mode ; 1: Digital Mode */
1674 u8 IF_mode, /* for Analog Mode, 0: zero IF; 1: low IF */
1675 u32 Bandwidth, /* filter channel bandwidth (6, 7, 8) */
1676 u32 IF_out, /* Desired IF Out Frequency */
1677 u32 Fxtal, /* XTAL Frequency */
1678 u8 AGC_Mode, /* AGC Mode - Dual AGC: 0, Single AGC: 1 */
1679 u16 TOP, /* 0: Dual AGC; Value: take over point */
1680 u16 IF_OUT_LOAD, /* IF Out Load Resistor (200 / 300 Ohms) */
1681 u8 CLOCK_OUT, /* 0: turn off clk out; 1: turn on clock out */
1682 u8 DIV_OUT, /* 0: Div-1; 1: Div-4 */
1683 u8 CAPSELECT, /* 0: disable On-Chip pulling cap; 1: enable */
1684 u8 EN_RSSI, /* 0: disable RSSI; 1: enable RSSI */
1685
1686 /* Modulation Type; */
1687 /* 0 - Default; 1 - DVB-T; 2 - ATSC; 3 - QAM; 4 - Analog Cable */
1688 u8 Mod_Type,
1689
1690 /* Tracking Filter */
1691 /* 0 - Default; 1 - Off; 2 - Type C; 3 - Type C-H */
1692 u8 TF_Type
1693 )
1694{
1695 struct mxl5005s_state *state = fe->tuner_priv;
1696 u16 status = 0;
1697
1698 state->Mode = Mode;
1699 state->IF_Mode = IF_mode;
1700 state->Chan_Bandwidth = Bandwidth;
1701 state->IF_OUT = IF_out;
1702 state->Fxtal = Fxtal;
1703 state->AGC_Mode = AGC_Mode;
1704 state->TOP = TOP;
1705 state->IF_OUT_LOAD = IF_OUT_LOAD;
1706 state->CLOCK_OUT = CLOCK_OUT;
1707 state->DIV_OUT = DIV_OUT;
1708 state->CAPSELECT = CAPSELECT;
1709 state->EN_RSSI = EN_RSSI;
1710 state->Mod_Type = Mod_Type;
1711 state->TF_Type = TF_Type;
1712
1713 /* Initialize all the controls and registers */
1714 InitTunerControls(fe);
1715
1716 /* Synthesizer LO frequency calculation */
1717 MXL_SynthIFLO_Calc(fe);
1718
1719 return status;
1720}
1721
1722static void MXL_SynthIFLO_Calc(struct dvb_frontend *fe)
1723{
1724 struct mxl5005s_state *state = fe->tuner_priv;
1725 if (state->Mode == 1) /* Digital Mode */
1726 state->IF_LO = state->IF_OUT;
1727 else /* Analog Mode */ {
1728 if (state->IF_Mode == 0) /* Analog Zero IF mode */
1729 state->IF_LO = state->IF_OUT + 400000;
1730 else /* Analog Low IF mode */
1731 state->IF_LO = state->IF_OUT + state->Chan_Bandwidth/2;
1732 }
1733}
1734
1735static void MXL_SynthRFTGLO_Calc(struct dvb_frontend *fe)
1736{
1737 struct mxl5005s_state *state = fe->tuner_priv;
1738
1739 if (state->Mode == 1) /* Digital Mode */ {
1740 /* remove 20.48MHz setting for 2.6.10 */
1741 state->RF_LO = state->RF_IN;
1742 /* change for 2.6.6 */
1743 state->TG_LO = state->RF_IN - 750000;
1744 } else /* Analog Mode */ {
1745 if (state->IF_Mode == 0) /* Analog Zero IF mode */ {
1746 state->RF_LO = state->RF_IN - 400000;
1747 state->TG_LO = state->RF_IN - 1750000;
1748 } else /* Analog Low IF mode */ {
1749 state->RF_LO = state->RF_IN - state->Chan_Bandwidth/2;
1750 state->TG_LO = state->RF_IN -
1751 state->Chan_Bandwidth + 500000;
1752 }
1753 }
1754}
1755
1756static u16 MXL_OverwriteICDefault(struct dvb_frontend *fe)
1757{
1758 u16 status = 0;
1759
1760 status += MXL_ControlWrite(fe, OVERRIDE_1, 1);
1761 status += MXL_ControlWrite(fe, OVERRIDE_2, 1);
1762 status += MXL_ControlWrite(fe, OVERRIDE_3, 1);
1763 status += MXL_ControlWrite(fe, OVERRIDE_4, 1);
1764
1765 return status;
1766}
1767
1768static u16 MXL_BlockInit(struct dvb_frontend *fe)
1769{
1770 struct mxl5005s_state *state = fe->tuner_priv;
1771 u16 status = 0;
1772
1773 status += MXL_OverwriteICDefault(fe);
1774
1775 /* Downconverter Control Dig Ana */
1776 status += MXL_ControlWrite(fe, DN_IQTN_AMP_CUT, state->Mode ? 1 : 0);
1777
1778 /* Filter Control Dig Ana */
1779 status += MXL_ControlWrite(fe, BB_MODE, state->Mode ? 0 : 1);
1780 status += MXL_ControlWrite(fe, BB_BUF, state->Mode ? 3 : 2);
1781 status += MXL_ControlWrite(fe, BB_BUF_OA, state->Mode ? 1 : 0);
1782 status += MXL_ControlWrite(fe, BB_IQSWAP, state->Mode ? 0 : 1);
1783 status += MXL_ControlWrite(fe, BB_INITSTATE_DLPF_TUNE, 0);
1784
1785 /* Initialize Low-Pass Filter */
1786 if (state->Mode) { /* Digital Mode */
1787 switch (state->Chan_Bandwidth) {
1788 case 8000000:
1789 status += MXL_ControlWrite(fe, BB_DLPF_BANDSEL, 0);
1790 break;
1791 case 7000000:
1792 status += MXL_ControlWrite(fe, BB_DLPF_BANDSEL, 2);
1793 break;
1794 case 6000000:
1795 status += MXL_ControlWrite(fe,
1796 BB_DLPF_BANDSEL, 3);
1797 break;
1798 }
1799 } else { /* Analog Mode */
1800 switch (state->Chan_Bandwidth) {
1801 case 8000000: /* Low Zero */
1802 status += MXL_ControlWrite(fe, BB_ALPF_BANDSELECT,
1803 (state->IF_Mode ? 0 : 3));
1804 break;
1805 case 7000000:
1806 status += MXL_ControlWrite(fe, BB_ALPF_BANDSELECT,
1807 (state->IF_Mode ? 1 : 4));
1808 break;
1809 case 6000000:
1810 status += MXL_ControlWrite(fe, BB_ALPF_BANDSELECT,
1811 (state->IF_Mode ? 2 : 5));
1812 break;
1813 }
1814 }
1815
1816 /* Charge Pump Control Dig Ana */
1817 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, state->Mode ? 5 : 8);
1818 status += MXL_ControlWrite(fe,
1819 RFSYN_EN_CHP_HIGAIN, state->Mode ? 1 : 1);
1820 status += MXL_ControlWrite(fe, EN_CHP_LIN_B, state->Mode ? 0 : 0);
1821
1822 /* AGC TOP Control */
1823 if (state->AGC_Mode == 0) /* Dual AGC */ {
1824 status += MXL_ControlWrite(fe, AGC_IF, 15);
1825 status += MXL_ControlWrite(fe, AGC_RF, 15);
1826 } else /* Single AGC Mode Dig Ana */
1827 status += MXL_ControlWrite(fe, AGC_RF, state->Mode ? 15 : 12);
1828
1829 if (state->TOP == 55) /* TOP == 5.5 */
1830 status += MXL_ControlWrite(fe, AGC_IF, 0x0);
1831
1832 if (state->TOP == 72) /* TOP == 7.2 */
1833 status += MXL_ControlWrite(fe, AGC_IF, 0x1);
1834
1835 if (state->TOP == 92) /* TOP == 9.2 */
1836 status += MXL_ControlWrite(fe, AGC_IF, 0x2);
1837
1838 if (state->TOP == 110) /* TOP == 11.0 */
1839 status += MXL_ControlWrite(fe, AGC_IF, 0x3);
1840
1841 if (state->TOP == 129) /* TOP == 12.9 */
1842 status += MXL_ControlWrite(fe, AGC_IF, 0x4);
1843
1844 if (state->TOP == 147) /* TOP == 14.7 */
1845 status += MXL_ControlWrite(fe, AGC_IF, 0x5);
1846
1847 if (state->TOP == 168) /* TOP == 16.8 */
1848 status += MXL_ControlWrite(fe, AGC_IF, 0x6);
1849
1850 if (state->TOP == 194) /* TOP == 19.4 */
1851 status += MXL_ControlWrite(fe, AGC_IF, 0x7);
1852
1853 if (state->TOP == 212) /* TOP == 21.2 */
1854 status += MXL_ControlWrite(fe, AGC_IF, 0x9);
1855
1856 if (state->TOP == 232) /* TOP == 23.2 */
1857 status += MXL_ControlWrite(fe, AGC_IF, 0xA);
1858
1859 if (state->TOP == 252) /* TOP == 25.2 */
1860 status += MXL_ControlWrite(fe, AGC_IF, 0xB);
1861
1862 if (state->TOP == 271) /* TOP == 27.1 */
1863 status += MXL_ControlWrite(fe, AGC_IF, 0xC);
1864
1865 if (state->TOP == 292) /* TOP == 29.2 */
1866 status += MXL_ControlWrite(fe, AGC_IF, 0xD);
1867
1868 if (state->TOP == 317) /* TOP == 31.7 */
1869 status += MXL_ControlWrite(fe, AGC_IF, 0xE);
1870
1871 if (state->TOP == 349) /* TOP == 34.9 */
1872 status += MXL_ControlWrite(fe, AGC_IF, 0xF);
1873
1874 /* IF Synthesizer Control */
1875 status += MXL_IFSynthInit(fe);
1876
1877 /* IF UpConverter Control */
1878 if (state->IF_OUT_LOAD == 200) {
1879 status += MXL_ControlWrite(fe, DRV_RES_SEL, 6);
1880 status += MXL_ControlWrite(fe, I_DRIVER, 2);
1881 }
1882 if (state->IF_OUT_LOAD == 300) {
1883 status += MXL_ControlWrite(fe, DRV_RES_SEL, 4);
1884 status += MXL_ControlWrite(fe, I_DRIVER, 1);
1885 }
1886
1887 /* Anti-Alias Filtering Control
1888 * initialise Anti-Aliasing Filter
1889 */
1890 if (state->Mode) { /* Digital Mode */
1891 if (state->IF_OUT >= 4000000UL && state->IF_OUT <= 6280000UL) {
1892 status += MXL_ControlWrite(fe, EN_AAF, 1);
1893 status += MXL_ControlWrite(fe, EN_3P, 1);
1894 status += MXL_ControlWrite(fe, EN_AUX_3P, 1);
1895 status += MXL_ControlWrite(fe, SEL_AAF_BAND, 0);
1896 }
1897 if ((state->IF_OUT == 36125000UL) ||
1898 (state->IF_OUT == 36150000UL)) {
1899 status += MXL_ControlWrite(fe, EN_AAF, 1);
1900 status += MXL_ControlWrite(fe, EN_3P, 1);
1901 status += MXL_ControlWrite(fe, EN_AUX_3P, 1);
1902 status += MXL_ControlWrite(fe, SEL_AAF_BAND, 1);
1903 }
1904 if (state->IF_OUT > 36150000UL) {
1905 status += MXL_ControlWrite(fe, EN_AAF, 0);
1906 status += MXL_ControlWrite(fe, EN_3P, 1);
1907 status += MXL_ControlWrite(fe, EN_AUX_3P, 1);
1908 status += MXL_ControlWrite(fe, SEL_AAF_BAND, 1);
1909 }
1910 } else { /* Analog Mode */
1911 if (state->IF_OUT >= 4000000UL && state->IF_OUT <= 5000000UL) {
1912 status += MXL_ControlWrite(fe, EN_AAF, 1);
1913 status += MXL_ControlWrite(fe, EN_3P, 1);
1914 status += MXL_ControlWrite(fe, EN_AUX_3P, 1);
1915 status += MXL_ControlWrite(fe, SEL_AAF_BAND, 0);
1916 }
1917 if (state->IF_OUT > 5000000UL) {
1918 status += MXL_ControlWrite(fe, EN_AAF, 0);
1919 status += MXL_ControlWrite(fe, EN_3P, 0);
1920 status += MXL_ControlWrite(fe, EN_AUX_3P, 0);
1921 status += MXL_ControlWrite(fe, SEL_AAF_BAND, 0);
1922 }
1923 }
1924
1925 /* Demod Clock Out */
1926 if (state->CLOCK_OUT)
1927 status += MXL_ControlWrite(fe, SEQ_ENCLK16_CLK_OUT, 1);
1928 else
1929 status += MXL_ControlWrite(fe, SEQ_ENCLK16_CLK_OUT, 0);
1930
1931 if (state->DIV_OUT == 1)
1932 status += MXL_ControlWrite(fe, SEQ_SEL4_16B, 1);
1933 if (state->DIV_OUT == 0)
1934 status += MXL_ControlWrite(fe, SEQ_SEL4_16B, 0);
1935
1936 /* Crystal Control */
1937 if (state->CAPSELECT)
1938 status += MXL_ControlWrite(fe, XTAL_CAPSELECT, 1);
1939 else
1940 status += MXL_ControlWrite(fe, XTAL_CAPSELECT, 0);
1941
1942 if (state->Fxtal >= 12000000UL && state->Fxtal <= 16000000UL)
1943 status += MXL_ControlWrite(fe, IF_SEL_DBL, 1);
1944 if (state->Fxtal > 16000000UL && state->Fxtal <= 32000000UL)
1945 status += MXL_ControlWrite(fe, IF_SEL_DBL, 0);
1946
1947 if (state->Fxtal >= 12000000UL && state->Fxtal <= 22000000UL)
1948 status += MXL_ControlWrite(fe, RFSYN_R_DIV, 3);
1949 if (state->Fxtal > 22000000UL && state->Fxtal <= 32000000UL)
1950 status += MXL_ControlWrite(fe, RFSYN_R_DIV, 0);
1951
1952 /* Misc Controls */
1953 if (state->Mode == 0 && state->IF_Mode == 1) /* Analog LowIF mode */
1954 status += MXL_ControlWrite(fe, SEQ_EXTIQFSMPULSE, 0);
1955 else
1956 status += MXL_ControlWrite(fe, SEQ_EXTIQFSMPULSE, 1);
1957
1958 /* status += MXL_ControlRead(fe, IF_DIVVAL, &IF_DIVVAL_Val); */
1959
1960 /* Set TG_R_DIV */
1961 status += MXL_ControlWrite(fe, TG_R_DIV,
1962 MXL_Ceiling(state->Fxtal, 1000000));
1963
1964 /* Apply Default value to BB_INITSTATE_DLPF_TUNE */
1965
1966 /* RSSI Control */
1967 if (state->EN_RSSI) {
1968 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
1969 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
1970 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1);
1971 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
1972
1973 /* RSSI reference point */
1974 status += MXL_ControlWrite(fe, RFA_RSSI_REF, 2);
1975 status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 3);
1976 status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 1);
1977
1978 /* TOP point */
1979 status += MXL_ControlWrite(fe, RFA_FLR, 0);
1980 status += MXL_ControlWrite(fe, RFA_CEIL, 12);
1981 }
1982
1983 /* Modulation type bit settings
1984 * Override the control values preset
1985 */
1986 if (state->Mod_Type == MXL_DVBT) /* DVB-T Mode */ {
1987 state->AGC_Mode = 1; /* Single AGC Mode */
1988
1989 /* Enable RSSI */
1990 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
1991 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
1992 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1);
1993 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
1994
1995 /* RSSI reference point */
1996 status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3);
1997 status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5);
1998 status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 1);
1999
2000 /* TOP point */
2001 status += MXL_ControlWrite(fe, RFA_FLR, 2);
2002 status += MXL_ControlWrite(fe, RFA_CEIL, 13);
2003 if (state->IF_OUT <= 6280000UL) /* Low IF */
2004 status += MXL_ControlWrite(fe, BB_IQSWAP, 0);
2005 else /* High IF */
2006 status += MXL_ControlWrite(fe, BB_IQSWAP, 1);
2007
2008 }
2009 if (state->Mod_Type == MXL_ATSC) /* ATSC Mode */ {
2010 state->AGC_Mode = 1; /* Single AGC Mode */
2011
2012 /* Enable RSSI */
2013 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
2014 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
2015 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1);
2016 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
2017
2018 /* RSSI reference point */
2019 status += MXL_ControlWrite(fe, RFA_RSSI_REF, 2);
2020 status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 4);
2021 status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 1);
2022
2023 /* TOP point */
2024 status += MXL_ControlWrite(fe, RFA_FLR, 2);
2025 status += MXL_ControlWrite(fe, RFA_CEIL, 13);
2026 status += MXL_ControlWrite(fe, BB_INITSTATE_DLPF_TUNE, 1);
2027 /* Low Zero */
2028 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 5);
2029
2030 if (state->IF_OUT <= 6280000UL) /* Low IF */
2031 status += MXL_ControlWrite(fe, BB_IQSWAP, 0);
2032 else /* High IF */
2033 status += MXL_ControlWrite(fe, BB_IQSWAP, 1);
2034 }
2035 if (state->Mod_Type == MXL_QAM) /* QAM Mode */ {
2036 state->Mode = MXL_DIGITAL_MODE;
2037
2038 /* state->AGC_Mode = 1; */ /* Single AGC Mode */
2039
2040 /* Disable RSSI */ /* change here for v2.6.5 */
2041 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
2042 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
2043 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0);
2044 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
2045
2046 /* RSSI reference point */
2047 status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5);
2048 status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3);
2049 status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 2);
2050 /* change here for v2.6.5 */
2051 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3);
2052
2053 if (state->IF_OUT <= 6280000UL) /* Low IF */
2054 status += MXL_ControlWrite(fe, BB_IQSWAP, 0);
2055 else /* High IF */
2056 status += MXL_ControlWrite(fe, BB_IQSWAP, 1);
2057 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 2);
2058
2059 }
2060 if (state->Mod_Type == MXL_ANALOG_CABLE) {
2061 /* Analog Cable Mode */
2062 /* state->Mode = MXL_DIGITAL_MODE; */
2063
2064 state->AGC_Mode = 1; /* Single AGC Mode */
2065
2066 /* Disable RSSI */
2067 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
2068 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
2069 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0);
2070 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
2071 /* change for 2.6.3 */
2072 status += MXL_ControlWrite(fe, AGC_IF, 1);
2073 status += MXL_ControlWrite(fe, AGC_RF, 15);
2074 status += MXL_ControlWrite(fe, BB_IQSWAP, 1);
2075 }
2076
2077 if (state->Mod_Type == MXL_ANALOG_OTA) {
2078 /* Analog OTA Terrestrial mode add for 2.6.7 */
2079 /* state->Mode = MXL_ANALOG_MODE; */
2080
2081 /* Enable RSSI */
2082 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
2083 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
2084 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1);
2085 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
2086
2087 /* RSSI reference point */
2088 status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5);
2089 status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3);
2090 status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 2);
2091 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3);
2092 status += MXL_ControlWrite(fe, BB_IQSWAP, 1);
2093 }
2094
2095 /* RSSI disable */
2096 if (state->EN_RSSI == 0) {
2097 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
2098 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
2099 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0);
2100 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
2101 }
2102
2103 return status;
2104}
2105
2106static u16 MXL_IFSynthInit(struct dvb_frontend *fe)
2107{
2108 struct mxl5005s_state *state = fe->tuner_priv;
2109 u16 status = 0 ;
2110 u32 Fref = 0 ;
2111 u32 Kdbl, intModVal ;
2112 u32 fracModVal ;
2113 Kdbl = 2 ;
2114
2115 if (state->Fxtal >= 12000000UL && state->Fxtal <= 16000000UL)
2116 Kdbl = 2 ;
2117 if (state->Fxtal > 16000000UL && state->Fxtal <= 32000000UL)
2118 Kdbl = 1 ;
2119
2120 /* IF Synthesizer Control */
2121 if (state->Mode == 0 && state->IF_Mode == 1) /* Analog Low IF mode */ {
2122 if (state->IF_LO == 41000000UL) {
2123 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2124 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2125 Fref = 328000000UL ;
2126 }
2127 if (state->IF_LO == 47000000UL) {
2128 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2129 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2130 Fref = 376000000UL ;
2131 }
2132 if (state->IF_LO == 54000000UL) {
2133 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10);
2134 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2135 Fref = 324000000UL ;
2136 }
2137 if (state->IF_LO == 60000000UL) {
2138 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10);
2139 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2140 Fref = 360000000UL ;
2141 }
2142 if (state->IF_LO == 39250000UL) {
2143 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2144 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2145 Fref = 314000000UL ;
2146 }
2147 if (state->IF_LO == 39650000UL) {
2148 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2149 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2150 Fref = 317200000UL ;
2151 }
2152 if (state->IF_LO == 40150000UL) {
2153 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2154 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2155 Fref = 321200000UL ;
2156 }
2157 if (state->IF_LO == 40650000UL) {
2158 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2159 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2160 Fref = 325200000UL ;
2161 }
2162 }
2163
2164 if (state->Mode || (state->Mode == 0 && state->IF_Mode == 0)) {
2165 if (state->IF_LO == 57000000UL) {
2166 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10);
2167 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2168 Fref = 342000000UL ;
2169 }
2170 if (state->IF_LO == 44000000UL) {
2171 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2172 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2173 Fref = 352000000UL ;
2174 }
2175 if (state->IF_LO == 43750000UL) {
2176 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2177 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2178 Fref = 350000000UL ;
2179 }
2180 if (state->IF_LO == 36650000UL) {
2181 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2182 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2183 Fref = 366500000UL ;
2184 }
2185 if (state->IF_LO == 36150000UL) {
2186 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2187 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2188 Fref = 361500000UL ;
2189 }
2190 if (state->IF_LO == 36000000UL) {
2191 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2192 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2193 Fref = 360000000UL ;
2194 }
2195 if (state->IF_LO == 35250000UL) {
2196 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2197 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2198 Fref = 352500000UL ;
2199 }
2200 if (state->IF_LO == 34750000UL) {
2201 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2202 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2203 Fref = 347500000UL ;
2204 }
2205 if (state->IF_LO == 6280000UL) {
2206 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07);
2207 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2208 Fref = 376800000UL ;
2209 }
2210 if (state->IF_LO == 5000000UL) {
2211 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x09);
2212 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2213 Fref = 360000000UL ;
2214 }
2215 if (state->IF_LO == 4500000UL) {
2216 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x06);
2217 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2218 Fref = 360000000UL ;
2219 }
2220 if (state->IF_LO == 4570000UL) {
2221 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x06);
2222 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2223 Fref = 365600000UL ;
2224 }
2225 if (state->IF_LO == 4000000UL) {
2226 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x05);
2227 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2228 Fref = 360000000UL ;
2229 }
2230 if (state->IF_LO == 57400000UL) {
2231 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10);
2232 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2233 Fref = 344400000UL ;
2234 }
2235 if (state->IF_LO == 44400000UL) {
2236 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2237 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2238 Fref = 355200000UL ;
2239 }
2240 if (state->IF_LO == 44150000UL) {
2241 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08);
2242 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2243 Fref = 353200000UL ;
2244 }
2245 if (state->IF_LO == 37050000UL) {
2246 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2247 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2248 Fref = 370500000UL ;
2249 }
2250 if (state->IF_LO == 36550000UL) {
2251 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2252 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2253 Fref = 365500000UL ;
2254 }
2255 if (state->IF_LO == 36125000UL) {
2256 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04);
2257 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2258 Fref = 361250000UL ;
2259 }
2260 if (state->IF_LO == 6000000UL) {
2261 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07);
2262 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2263 Fref = 360000000UL ;
2264 }
2265 if (state->IF_LO == 5400000UL) {
2266 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07);
2267 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2268 Fref = 324000000UL ;
2269 }
2270 if (state->IF_LO == 5380000UL) {
2271 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07);
2272 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C);
2273 Fref = 322800000UL ;
2274 }
2275 if (state->IF_LO == 5200000UL) {
2276 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x09);
2277 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2278 Fref = 374400000UL ;
2279 }
2280 if (state->IF_LO == 4900000UL) {
2281 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x09);
2282 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2283 Fref = 352800000UL ;
2284 }
2285 if (state->IF_LO == 4400000UL) {
2286 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x06);
2287 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2288 Fref = 352000000UL ;
2289 }
2290 if (state->IF_LO == 4063000UL) /* add for 2.6.8 */ {
2291 status += MXL_ControlWrite(fe, IF_DIVVAL, 0x05);
2292 status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08);
2293 Fref = 365670000UL ;
2294 }
2295 }
2296 /* CHCAL_INT_MOD_IF */
2297 /* CHCAL_FRAC_MOD_IF */
2298 intModVal = Fref / (state->Fxtal * Kdbl/2);
2299 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_IF, intModVal);
2300
2301 fracModVal = (2<<15)*(Fref/1000 - (state->Fxtal/1000 * Kdbl/2) *
2302 intModVal);
2303
2304 fracModVal = fracModVal / ((state->Fxtal * Kdbl/2)/1000);
2305 status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_IF, fracModVal);
2306
2307 return status ;
2308}
2309
2310static u32 MXL_GetXtalInt(u32 Xtal_Freq)
2311{
2312 if ((Xtal_Freq % 1000000) == 0)
2313 return (Xtal_Freq / 10000);
2314 else
2315 return (((Xtal_Freq / 1000000) + 1)*100);
2316}
2317
2318static u16 MXL_TuneRF(struct dvb_frontend *fe, u32 RF_Freq)
2319{
2320 struct mxl5005s_state *state = fe->tuner_priv;
2321 u16 status = 0;
2322 u32 divider_val, E3, E4, E5, E5A;
2323 u32 Fmax, Fmin, FmaxBin, FminBin;
2324 u32 Kdbl_RF = 2;
2325 u32 tg_divval;
2326 u32 tg_lo;
2327 u32 Xtal_Int;
2328
2329 u32 Fref_TG;
2330 u32 Fvco;
2331
2332 Xtal_Int = MXL_GetXtalInt(state->Fxtal);
2333
2334 state->RF_IN = RF_Freq;
2335
2336 MXL_SynthRFTGLO_Calc(fe);
2337
2338 if (state->Fxtal >= 12000000UL && state->Fxtal <= 22000000UL)
2339 Kdbl_RF = 2;
2340 if (state->Fxtal > 22000000 && state->Fxtal <= 32000000)
2341 Kdbl_RF = 1;
2342
2343 /* Downconverter Controls
2344 * Look-Up Table Implementation for:
2345 * DN_POLY
2346 * DN_RFGAIN
2347 * DN_CAP_RFLPF
2348 * DN_EN_VHFUHFBAR
2349 * DN_GAIN_ADJUST
2350 * Change the boundary reference from RF_IN to RF_LO
2351 */
2352 if (state->RF_LO < 40000000UL)
2353 return -1;
2354
2355 if (state->RF_LO >= 40000000UL && state->RF_LO <= 75000000UL) {
2356 status += MXL_ControlWrite(fe, DN_POLY, 2);
2357 status += MXL_ControlWrite(fe, DN_RFGAIN, 3);
2358 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 423);
2359 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1);
2360 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 1);
2361 }
2362 if (state->RF_LO > 75000000UL && state->RF_LO <= 100000000UL) {
2363 status += MXL_ControlWrite(fe, DN_POLY, 3);
2364 status += MXL_ControlWrite(fe, DN_RFGAIN, 3);
2365 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 222);
2366 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1);
2367 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 1);
2368 }
2369 if (state->RF_LO > 100000000UL && state->RF_LO <= 150000000UL) {
2370 status += MXL_ControlWrite(fe, DN_POLY, 3);
2371 status += MXL_ControlWrite(fe, DN_RFGAIN, 3);
2372 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 147);
2373 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1);
2374 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 2);
2375 }
2376 if (state->RF_LO > 150000000UL && state->RF_LO <= 200000000UL) {
2377 status += MXL_ControlWrite(fe, DN_POLY, 3);
2378 status += MXL_ControlWrite(fe, DN_RFGAIN, 3);
2379 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 9);
2380 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1);
2381 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 2);
2382 }
2383 if (state->RF_LO > 200000000UL && state->RF_LO <= 300000000UL) {
2384 status += MXL_ControlWrite(fe, DN_POLY, 3);
2385 status += MXL_ControlWrite(fe, DN_RFGAIN, 3);
2386 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 0);
2387 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1);
2388 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 3);
2389 }
2390 if (state->RF_LO > 300000000UL && state->RF_LO <= 650000000UL) {
2391 status += MXL_ControlWrite(fe, DN_POLY, 3);
2392 status += MXL_ControlWrite(fe, DN_RFGAIN, 1);
2393 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 0);
2394 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 0);
2395 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 3);
2396 }
2397 if (state->RF_LO > 650000000UL && state->RF_LO <= 900000000UL) {
2398 status += MXL_ControlWrite(fe, DN_POLY, 3);
2399 status += MXL_ControlWrite(fe, DN_RFGAIN, 2);
2400 status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 0);
2401 status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 0);
2402 status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 3);
2403 }
2404 if (state->RF_LO > 900000000UL)
2405 return -1;
2406
2407 /* DN_IQTNBUF_AMP */
2408 /* DN_IQTNGNBFBIAS_BST */
2409 if (state->RF_LO >= 40000000UL && state->RF_LO <= 75000000UL) {
2410 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2411 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2412 }
2413 if (state->RF_LO > 75000000UL && state->RF_LO <= 100000000UL) {
2414 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2415 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2416 }
2417 if (state->RF_LO > 100000000UL && state->RF_LO <= 150000000UL) {
2418 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2419 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2420 }
2421 if (state->RF_LO > 150000000UL && state->RF_LO <= 200000000UL) {
2422 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2423 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2424 }
2425 if (state->RF_LO > 200000000UL && state->RF_LO <= 300000000UL) {
2426 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2427 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2428 }
2429 if (state->RF_LO > 300000000UL && state->RF_LO <= 400000000UL) {
2430 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2431 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2432 }
2433 if (state->RF_LO > 400000000UL && state->RF_LO <= 450000000UL) {
2434 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2435 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2436 }
2437 if (state->RF_LO > 450000000UL && state->RF_LO <= 500000000UL) {
2438 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2439 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2440 }
2441 if (state->RF_LO > 500000000UL && state->RF_LO <= 550000000UL) {
2442 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2443 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2444 }
2445 if (state->RF_LO > 550000000UL && state->RF_LO <= 600000000UL) {
2446 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2447 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2448 }
2449 if (state->RF_LO > 600000000UL && state->RF_LO <= 650000000UL) {
2450 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2451 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2452 }
2453 if (state->RF_LO > 650000000UL && state->RF_LO <= 700000000UL) {
2454 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2455 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2456 }
2457 if (state->RF_LO > 700000000UL && state->RF_LO <= 750000000UL) {
2458 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2459 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2460 }
2461 if (state->RF_LO > 750000000UL && state->RF_LO <= 800000000UL) {
2462 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1);
2463 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0);
2464 }
2465 if (state->RF_LO > 800000000UL && state->RF_LO <= 850000000UL) {
2466 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 10);
2467 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 1);
2468 }
2469 if (state->RF_LO > 850000000UL && state->RF_LO <= 900000000UL) {
2470 status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 10);
2471 status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 1);
2472 }
2473
2474 /*
2475 * Set RF Synth and LO Path Control
2476 *
2477 * Look-Up table implementation for:
2478 * RFSYN_EN_OUTMUX
2479 * RFSYN_SEL_VCO_OUT
2480 * RFSYN_SEL_VCO_HI
2481 * RFSYN_SEL_DIVM
2482 * RFSYN_RF_DIV_BIAS
2483 * DN_SEL_FREQ
2484 *
2485 * Set divider_val, Fmax, Fmix to use in Equations
2486 */
2487 FminBin = 28000000UL ;
2488 FmaxBin = 42500000UL ;
2489 if (state->RF_LO >= 40000000UL && state->RF_LO <= FmaxBin) {
2490 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1);
2491 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0);
2492 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
2493 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2494 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2495 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1);
2496 divider_val = 64 ;
2497 Fmax = FmaxBin ;
2498 Fmin = FminBin ;
2499 }
2500 FminBin = 42500000UL ;
2501 FmaxBin = 56000000UL ;
2502 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2503 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1);
2504 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0);
2505 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
2506 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2507 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2508 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1);
2509 divider_val = 64 ;
2510 Fmax = FmaxBin ;
2511 Fmin = FminBin ;
2512 }
2513 FminBin = 56000000UL ;
2514 FmaxBin = 85000000UL ;
2515 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2516 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2517 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2518 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
2519 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2520 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2521 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1);
2522 divider_val = 32 ;
2523 Fmax = FmaxBin ;
2524 Fmin = FminBin ;
2525 }
2526 FminBin = 85000000UL ;
2527 FmaxBin = 112000000UL ;
2528 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2529 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2530 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2531 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
2532 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2533 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2534 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1);
2535 divider_val = 32 ;
2536 Fmax = FmaxBin ;
2537 Fmin = FminBin ;
2538 }
2539 FminBin = 112000000UL ;
2540 FmaxBin = 170000000UL ;
2541 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2542 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2543 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2544 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
2545 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2546 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2547 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 2);
2548 divider_val = 16 ;
2549 Fmax = FmaxBin ;
2550 Fmin = FminBin ;
2551 }
2552 FminBin = 170000000UL ;
2553 FmaxBin = 225000000UL ;
2554 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2555 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2556 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2557 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
2558 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2559 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2560 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 2);
2561 divider_val = 16 ;
2562 Fmax = FmaxBin ;
2563 Fmin = FminBin ;
2564 }
2565 FminBin = 225000000UL ;
2566 FmaxBin = 300000000UL ;
2567 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2568 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2569 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2570 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
2571 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2572 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2573 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 4);
2574 divider_val = 8 ;
2575 Fmax = 340000000UL ;
2576 Fmin = FminBin ;
2577 }
2578 FminBin = 300000000UL ;
2579 FmaxBin = 340000000UL ;
2580 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2581 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1);
2582 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0);
2583 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
2584 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2585 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2586 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
2587 divider_val = 8 ;
2588 Fmax = FmaxBin ;
2589 Fmin = 225000000UL ;
2590 }
2591 FminBin = 340000000UL ;
2592 FmaxBin = 450000000UL ;
2593 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2594 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1);
2595 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0);
2596 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
2597 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
2598 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 2);
2599 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
2600 divider_val = 8 ;
2601 Fmax = FmaxBin ;
2602 Fmin = FminBin ;
2603 }
2604 FminBin = 450000000UL ;
2605 FmaxBin = 680000000UL ;
2606 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2607 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2608 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2609 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
2610 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 1);
2611 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2612 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
2613 divider_val = 4 ;
2614 Fmax = FmaxBin ;
2615 Fmin = FminBin ;
2616 }
2617 FminBin = 680000000UL ;
2618 FmaxBin = 900000000UL ;
2619 if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) {
2620 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
2621 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
2622 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
2623 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 1);
2624 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
2625 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
2626 divider_val = 4 ;
2627 Fmax = FmaxBin ;
2628 Fmin = FminBin ;
2629 }
2630
2631 /* CHCAL_INT_MOD_RF
2632 * CHCAL_FRAC_MOD_RF
2633 * RFSYN_LPF_R
2634 * CHCAL_EN_INT_RF
2635 */
2636 /* Equation E3 RFSYN_VCO_BIAS */
2637 E3 = (((Fmax-state->RF_LO)/1000)*32)/((Fmax-Fmin)/1000) + 8 ;
2638 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, E3);
2639
2640 /* Equation E4 CHCAL_INT_MOD_RF */
2641 E4 = (state->RF_LO*divider_val/1000)/(2*state->Fxtal*Kdbl_RF/1000);
2642 MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, E4);
2643
2644 /* Equation E5 CHCAL_FRAC_MOD_RF CHCAL_EN_INT_RF */
2645 E5 = ((2<<17)*(state->RF_LO/10000*divider_val -
2646 (E4*(2*state->Fxtal*Kdbl_RF)/10000))) /
2647 (2*state->Fxtal*Kdbl_RF/10000);
2648
2649 status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, E5);
2650
2651 /* Equation E5A RFSYN_LPF_R */
2652 E5A = (((Fmax - state->RF_LO)/1000)*4/((Fmax-Fmin)/1000)) + 1 ;
2653 status += MXL_ControlWrite(fe, RFSYN_LPF_R, E5A);
2654
2655 /* Euqation E5B CHCAL_EN_INIT_RF */
2656 status += MXL_ControlWrite(fe, CHCAL_EN_INT_RF, ((E5 == 0) ? 1 : 0));
2657 /*if (E5 == 0)
2658 * status += MXL_ControlWrite(fe, CHCAL_EN_INT_RF, 1);
2659 *else
2660 * status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, E5);
2661 */
2662
2663 /*
2664 * Set TG Synth
2665 *
2666 * Look-Up table implementation for:
2667 * TG_LO_DIVVAL
2668 * TG_LO_SELVAL
2669 *
2670 * Set divider_val, Fmax, Fmix to use in Equations
2671 */
2672 if (state->TG_LO < 33000000UL)
2673 return -1;
2674
2675 FminBin = 33000000UL ;
2676 FmaxBin = 50000000UL ;
2677 if (state->TG_LO >= FminBin && state->TG_LO <= FmaxBin) {
2678 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x6);
2679 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x0);
2680 divider_val = 36 ;
2681 Fmax = FmaxBin ;
2682 Fmin = FminBin ;
2683 }
2684 FminBin = 50000000UL ;
2685 FmaxBin = 67000000UL ;
2686 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2687 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x1);
2688 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x0);
2689 divider_val = 24 ;
2690 Fmax = FmaxBin ;
2691 Fmin = FminBin ;
2692 }
2693 FminBin = 67000000UL ;
2694 FmaxBin = 100000000UL ;
2695 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2696 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0xC);
2697 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x2);
2698 divider_val = 18 ;
2699 Fmax = FmaxBin ;
2700 Fmin = FminBin ;
2701 }
2702 FminBin = 100000000UL ;
2703 FmaxBin = 150000000UL ;
2704 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2705 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x8);
2706 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x2);
2707 divider_val = 12 ;
2708 Fmax = FmaxBin ;
2709 Fmin = FminBin ;
2710 }
2711 FminBin = 150000000UL ;
2712 FmaxBin = 200000000UL ;
2713 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2714 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x0);
2715 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x2);
2716 divider_val = 8 ;
2717 Fmax = FmaxBin ;
2718 Fmin = FminBin ;
2719 }
2720 FminBin = 200000000UL ;
2721 FmaxBin = 300000000UL ;
2722 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2723 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x8);
2724 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x3);
2725 divider_val = 6 ;
2726 Fmax = FmaxBin ;
2727 Fmin = FminBin ;
2728 }
2729 FminBin = 300000000UL ;
2730 FmaxBin = 400000000UL ;
2731 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2732 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x0);
2733 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x3);
2734 divider_val = 4 ;
2735 Fmax = FmaxBin ;
2736 Fmin = FminBin ;
2737 }
2738 FminBin = 400000000UL ;
2739 FmaxBin = 600000000UL ;
2740 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2741 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x8);
2742 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x7);
2743 divider_val = 3 ;
2744 Fmax = FmaxBin ;
2745 Fmin = FminBin ;
2746 }
2747 FminBin = 600000000UL ;
2748 FmaxBin = 900000000UL ;
2749 if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) {
2750 status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x0);
2751 status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x7);
2752 divider_val = 2 ;
2753 Fmax = FmaxBin ;
2754 Fmin = FminBin ;
2755 }
2756
2757 /* TG_DIV_VAL */
2758 tg_divval = (state->TG_LO*divider_val/100000) *
2759 (MXL_Ceiling(state->Fxtal, 1000000) * 100) /
2760 (state->Fxtal/1000);
2761
2762 status += MXL_ControlWrite(fe, TG_DIV_VAL, tg_divval);
2763
2764 if (state->TG_LO > 600000000UL)
2765 status += MXL_ControlWrite(fe, TG_DIV_VAL, tg_divval + 1);
2766
2767 Fmax = 1800000000UL ;
2768 Fmin = 1200000000UL ;
2769
2770 /* prevent overflow of 32 bit unsigned integer, use
2771 * following equation. Edit for v2.6.4
2772 */
2773 /* Fref_TF = Fref_TG * 1000 */
2774 Fref_TG = (state->Fxtal/1000) / MXL_Ceiling(state->Fxtal, 1000000);
2775
2776 /* Fvco = Fvco/10 */
2777 Fvco = (state->TG_LO/10000) * divider_val * Fref_TG;
2778
2779 tg_lo = (((Fmax/10 - Fvco)/100)*32) / ((Fmax-Fmin)/1000)+8;
2780
2781 /* below equation is same as above but much harder to debug.
2782 * tg_lo = ( ((Fmax/10000 * Xtal_Int)/100) -
2783 * ((state->TG_LO/10000)*divider_val *
2784 * (state->Fxtal/10000)/100) )*32/((Fmax-Fmin)/10000 *
2785 * Xtal_Int/100) + 8;
2786 */
2787
2788 status += MXL_ControlWrite(fe, TG_VCO_BIAS , tg_lo);
2789
2790 /* add for 2.6.5 Special setting for QAM */
2791 if (state->Mod_Type == MXL_QAM) {
2792 if (state->RF_IN < 680000000)
2793 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3);
2794 else
2795 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 2);
2796 }
2797
2798 /* Off Chip Tracking Filter Control */
2799 if (state->TF_Type == MXL_TF_OFF) {
2800 /* Tracking Filter Off State; turn off all the banks */
2801 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2802 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
2803 status += MXL_SetGPIO(fe, 3, 1); /* Bank1 Off */
2804 status += MXL_SetGPIO(fe, 1, 1); /* Bank2 Off */
2805 status += MXL_SetGPIO(fe, 4, 1); /* Bank3 Off */
2806 }
2807
2808 if (state->TF_Type == MXL_TF_C) /* Tracking Filter type C */ {
2809 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
2810 status += MXL_ControlWrite(fe, DAC_DIN_A, 0);
2811
2812 if (state->RF_IN >= 43000000 && state->RF_IN < 150000000) {
2813 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2814 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2815 status += MXL_SetGPIO(fe, 3, 0);
2816 status += MXL_SetGPIO(fe, 1, 1);
2817 status += MXL_SetGPIO(fe, 4, 1);
2818 }
2819 if (state->RF_IN >= 150000000 && state->RF_IN < 280000000) {
2820 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2821 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2822 status += MXL_SetGPIO(fe, 3, 1);
2823 status += MXL_SetGPIO(fe, 1, 0);
2824 status += MXL_SetGPIO(fe, 4, 1);
2825 }
2826 if (state->RF_IN >= 280000000 && state->RF_IN < 360000000) {
2827 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2828 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2829 status += MXL_SetGPIO(fe, 3, 1);
2830 status += MXL_SetGPIO(fe, 1, 0);
2831 status += MXL_SetGPIO(fe, 4, 0);
2832 }
2833 if (state->RF_IN >= 360000000 && state->RF_IN < 560000000) {
2834 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2835 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2836 status += MXL_SetGPIO(fe, 3, 1);
2837 status += MXL_SetGPIO(fe, 1, 1);
2838 status += MXL_SetGPIO(fe, 4, 0);
2839 }
2840 if (state->RF_IN >= 560000000 && state->RF_IN < 580000000) {
2841 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2842 status += MXL_ControlWrite(fe, DAC_DIN_B, 29);
2843 status += MXL_SetGPIO(fe, 3, 1);
2844 status += MXL_SetGPIO(fe, 1, 1);
2845 status += MXL_SetGPIO(fe, 4, 0);
2846 }
2847 if (state->RF_IN >= 580000000 && state->RF_IN < 630000000) {
2848 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2849 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2850 status += MXL_SetGPIO(fe, 3, 1);
2851 status += MXL_SetGPIO(fe, 1, 1);
2852 status += MXL_SetGPIO(fe, 4, 0);
2853 }
2854 if (state->RF_IN >= 630000000 && state->RF_IN < 700000000) {
2855 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2856 status += MXL_ControlWrite(fe, DAC_DIN_B, 16);
2857 status += MXL_SetGPIO(fe, 3, 1);
2858 status += MXL_SetGPIO(fe, 1, 1);
2859 status += MXL_SetGPIO(fe, 4, 1);
2860 }
2861 if (state->RF_IN >= 700000000 && state->RF_IN < 760000000) {
2862 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2863 status += MXL_ControlWrite(fe, DAC_DIN_B, 7);
2864 status += MXL_SetGPIO(fe, 3, 1);
2865 status += MXL_SetGPIO(fe, 1, 1);
2866 status += MXL_SetGPIO(fe, 4, 1);
2867 }
2868 if (state->RF_IN >= 760000000 && state->RF_IN <= 900000000) {
2869 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2870 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2871 status += MXL_SetGPIO(fe, 3, 1);
2872 status += MXL_SetGPIO(fe, 1, 1);
2873 status += MXL_SetGPIO(fe, 4, 1);
2874 }
2875 }
2876
2877 if (state->TF_Type == MXL_TF_C_H) {
2878
2879 /* Tracking Filter type C-H for Hauppauge only */
2880 status += MXL_ControlWrite(fe, DAC_DIN_A, 0);
2881
2882 if (state->RF_IN >= 43000000 && state->RF_IN < 150000000) {
2883 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2884 status += MXL_SetGPIO(fe, 4, 0);
2885 status += MXL_SetGPIO(fe, 3, 1);
2886 status += MXL_SetGPIO(fe, 1, 1);
2887 }
2888 if (state->RF_IN >= 150000000 && state->RF_IN < 280000000) {
2889 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2890 status += MXL_SetGPIO(fe, 4, 1);
2891 status += MXL_SetGPIO(fe, 3, 0);
2892 status += MXL_SetGPIO(fe, 1, 1);
2893 }
2894 if (state->RF_IN >= 280000000 && state->RF_IN < 360000000) {
2895 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2896 status += MXL_SetGPIO(fe, 4, 1);
2897 status += MXL_SetGPIO(fe, 3, 0);
2898 status += MXL_SetGPIO(fe, 1, 0);
2899 }
2900 if (state->RF_IN >= 360000000 && state->RF_IN < 560000000) {
2901 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2902 status += MXL_SetGPIO(fe, 4, 1);
2903 status += MXL_SetGPIO(fe, 3, 1);
2904 status += MXL_SetGPIO(fe, 1, 0);
2905 }
2906 if (state->RF_IN >= 560000000 && state->RF_IN < 580000000) {
2907 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2908 status += MXL_SetGPIO(fe, 4, 1);
2909 status += MXL_SetGPIO(fe, 3, 1);
2910 status += MXL_SetGPIO(fe, 1, 0);
2911 }
2912 if (state->RF_IN >= 580000000 && state->RF_IN < 630000000) {
2913 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2914 status += MXL_SetGPIO(fe, 4, 1);
2915 status += MXL_SetGPIO(fe, 3, 1);
2916 status += MXL_SetGPIO(fe, 1, 0);
2917 }
2918 if (state->RF_IN >= 630000000 && state->RF_IN < 700000000) {
2919 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2920 status += MXL_SetGPIO(fe, 4, 1);
2921 status += MXL_SetGPIO(fe, 3, 1);
2922 status += MXL_SetGPIO(fe, 1, 1);
2923 }
2924 if (state->RF_IN >= 700000000 && state->RF_IN < 760000000) {
2925 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2926 status += MXL_SetGPIO(fe, 4, 1);
2927 status += MXL_SetGPIO(fe, 3, 1);
2928 status += MXL_SetGPIO(fe, 1, 1);
2929 }
2930 if (state->RF_IN >= 760000000 && state->RF_IN <= 900000000) {
2931 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
2932 status += MXL_SetGPIO(fe, 4, 1);
2933 status += MXL_SetGPIO(fe, 3, 1);
2934 status += MXL_SetGPIO(fe, 1, 1);
2935 }
2936 }
2937
2938 if (state->TF_Type == MXL_TF_D) { /* Tracking Filter type D */
2939
2940 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
2941
2942 if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) {
2943 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
2944 status += MXL_SetGPIO(fe, 4, 0);
2945 status += MXL_SetGPIO(fe, 1, 1);
2946 status += MXL_SetGPIO(fe, 3, 1);
2947 }
2948 if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) {
2949 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
2950 status += MXL_SetGPIO(fe, 4, 0);
2951 status += MXL_SetGPIO(fe, 1, 0);
2952 status += MXL_SetGPIO(fe, 3, 1);
2953 }
2954 if (state->RF_IN >= 250000000 && state->RF_IN < 310000000) {
2955 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
2956 status += MXL_SetGPIO(fe, 4, 1);
2957 status += MXL_SetGPIO(fe, 1, 0);
2958 status += MXL_SetGPIO(fe, 3, 1);
2959 }
2960 if (state->RF_IN >= 310000000 && state->RF_IN < 360000000) {
2961 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
2962 status += MXL_SetGPIO(fe, 4, 1);
2963 status += MXL_SetGPIO(fe, 1, 0);
2964 status += MXL_SetGPIO(fe, 3, 0);
2965 }
2966 if (state->RF_IN >= 360000000 && state->RF_IN < 470000000) {
2967 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
2968 status += MXL_SetGPIO(fe, 4, 1);
2969 status += MXL_SetGPIO(fe, 1, 1);
2970 status += MXL_SetGPIO(fe, 3, 0);
2971 }
2972 if (state->RF_IN >= 470000000 && state->RF_IN < 640000000) {
2973 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
2974 status += MXL_SetGPIO(fe, 4, 1);
2975 status += MXL_SetGPIO(fe, 1, 1);
2976 status += MXL_SetGPIO(fe, 3, 0);
2977 }
2978 if (state->RF_IN >= 640000000 && state->RF_IN <= 900000000) {
2979 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
2980 status += MXL_SetGPIO(fe, 4, 1);
2981 status += MXL_SetGPIO(fe, 1, 1);
2982 status += MXL_SetGPIO(fe, 3, 1);
2983 }
2984 }
2985
2986 if (state->TF_Type == MXL_TF_D_L) {
2987
2988 /* Tracking Filter type D-L for Lumanate ONLY change 2.6.3 */
2989 status += MXL_ControlWrite(fe, DAC_DIN_A, 0);
2990
2991 /* if UHF and terrestrial => Turn off Tracking Filter */
2992 if (state->RF_IN >= 471000000 &&
2993 (state->RF_IN - 471000000)%6000000 != 0) {
2994 /* Turn off all the banks */
2995 status += MXL_SetGPIO(fe, 3, 1);
2996 status += MXL_SetGPIO(fe, 1, 1);
2997 status += MXL_SetGPIO(fe, 4, 1);
2998 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
2999 status += MXL_ControlWrite(fe, AGC_IF, 10);
3000 } else {
3001 /* if VHF or cable => Turn on Tracking Filter */
3002 if (state->RF_IN >= 43000000 &&
3003 state->RF_IN < 140000000) {
3004
3005 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
3006 status += MXL_SetGPIO(fe, 4, 1);
3007 status += MXL_SetGPIO(fe, 1, 1);
3008 status += MXL_SetGPIO(fe, 3, 0);
3009 }
3010 if (state->RF_IN >= 140000000 &&
3011 state->RF_IN < 240000000) {
3012 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
3013 status += MXL_SetGPIO(fe, 4, 1);
3014 status += MXL_SetGPIO(fe, 1, 0);
3015 status += MXL_SetGPIO(fe, 3, 0);
3016 }
3017 if (state->RF_IN >= 240000000 &&
3018 state->RF_IN < 340000000) {
3019 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
3020 status += MXL_SetGPIO(fe, 4, 0);
3021 status += MXL_SetGPIO(fe, 1, 1);
3022 status += MXL_SetGPIO(fe, 3, 0);
3023 }
3024 if (state->RF_IN >= 340000000 &&
3025 state->RF_IN < 430000000) {
3026 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
3027 status += MXL_SetGPIO(fe, 4, 0);
3028 status += MXL_SetGPIO(fe, 1, 0);
3029 status += MXL_SetGPIO(fe, 3, 1);
3030 }
3031 if (state->RF_IN >= 430000000 &&
3032 state->RF_IN < 470000000) {
3033 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
3034 status += MXL_SetGPIO(fe, 4, 1);
3035 status += MXL_SetGPIO(fe, 1, 0);
3036 status += MXL_SetGPIO(fe, 3, 1);
3037 }
3038 if (state->RF_IN >= 470000000 &&
3039 state->RF_IN < 570000000) {
3040 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
3041 status += MXL_SetGPIO(fe, 4, 0);
3042 status += MXL_SetGPIO(fe, 1, 0);
3043 status += MXL_SetGPIO(fe, 3, 1);
3044 }
3045 if (state->RF_IN >= 570000000 &&
3046 state->RF_IN < 620000000) {
3047 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0);
3048 status += MXL_SetGPIO(fe, 4, 0);
3049 status += MXL_SetGPIO(fe, 1, 1);
3050 status += MXL_SetGPIO(fe, 3, 1);
3051 }
3052 if (state->RF_IN >= 620000000 &&
3053 state->RF_IN < 760000000) {
3054 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
3055 status += MXL_SetGPIO(fe, 4, 0);
3056 status += MXL_SetGPIO(fe, 1, 1);
3057 status += MXL_SetGPIO(fe, 3, 1);
3058 }
3059 if (state->RF_IN >= 760000000 &&
3060 state->RF_IN <= 900000000) {
3061 status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1);
3062 status += MXL_SetGPIO(fe, 4, 1);
3063 status += MXL_SetGPIO(fe, 1, 1);
3064 status += MXL_SetGPIO(fe, 3, 1);
3065 }
3066 }
3067 }
3068
3069 if (state->TF_Type == MXL_TF_E) /* Tracking Filter type E */ {
3070
3071 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
3072
3073 if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) {
3074 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3075 status += MXL_SetGPIO(fe, 4, 0);
3076 status += MXL_SetGPIO(fe, 1, 1);
3077 status += MXL_SetGPIO(fe, 3, 1);
3078 }
3079 if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) {
3080 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3081 status += MXL_SetGPIO(fe, 4, 0);
3082 status += MXL_SetGPIO(fe, 1, 0);
3083 status += MXL_SetGPIO(fe, 3, 1);
3084 }
3085 if (state->RF_IN >= 250000000 && state->RF_IN < 310000000) {
3086 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3087 status += MXL_SetGPIO(fe, 4, 1);
3088 status += MXL_SetGPIO(fe, 1, 0);
3089 status += MXL_SetGPIO(fe, 3, 1);
3090 }
3091 if (state->RF_IN >= 310000000 && state->RF_IN < 360000000) {
3092 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3093 status += MXL_SetGPIO(fe, 4, 1);
3094 status += MXL_SetGPIO(fe, 1, 0);
3095 status += MXL_SetGPIO(fe, 3, 0);
3096 }
3097 if (state->RF_IN >= 360000000 && state->RF_IN < 470000000) {
3098 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3099 status += MXL_SetGPIO(fe, 4, 1);
3100 status += MXL_SetGPIO(fe, 1, 1);
3101 status += MXL_SetGPIO(fe, 3, 0);
3102 }
3103 if (state->RF_IN >= 470000000 && state->RF_IN < 640000000) {
3104 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3105 status += MXL_SetGPIO(fe, 4, 1);
3106 status += MXL_SetGPIO(fe, 1, 1);
3107 status += MXL_SetGPIO(fe, 3, 0);
3108 }
3109 if (state->RF_IN >= 640000000 && state->RF_IN <= 900000000) {
3110 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3111 status += MXL_SetGPIO(fe, 4, 1);
3112 status += MXL_SetGPIO(fe, 1, 1);
3113 status += MXL_SetGPIO(fe, 3, 1);
3114 }
3115 }
3116
3117 if (state->TF_Type == MXL_TF_F) {
3118
3119 /* Tracking Filter type F */
3120 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
3121
3122 if (state->RF_IN >= 43000000 && state->RF_IN < 160000000) {
3123 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3124 status += MXL_SetGPIO(fe, 4, 0);
3125 status += MXL_SetGPIO(fe, 1, 1);
3126 status += MXL_SetGPIO(fe, 3, 1);
3127 }
3128 if (state->RF_IN >= 160000000 && state->RF_IN < 210000000) {
3129 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3130 status += MXL_SetGPIO(fe, 4, 0);
3131 status += MXL_SetGPIO(fe, 1, 0);
3132 status += MXL_SetGPIO(fe, 3, 1);
3133 }
3134 if (state->RF_IN >= 210000000 && state->RF_IN < 300000000) {
3135 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3136 status += MXL_SetGPIO(fe, 4, 1);
3137 status += MXL_SetGPIO(fe, 1, 0);
3138 status += MXL_SetGPIO(fe, 3, 1);
3139 }
3140 if (state->RF_IN >= 300000000 && state->RF_IN < 390000000) {
3141 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3142 status += MXL_SetGPIO(fe, 4, 1);
3143 status += MXL_SetGPIO(fe, 1, 0);
3144 status += MXL_SetGPIO(fe, 3, 0);
3145 }
3146 if (state->RF_IN >= 390000000 && state->RF_IN < 515000000) {
3147 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3148 status += MXL_SetGPIO(fe, 4, 1);
3149 status += MXL_SetGPIO(fe, 1, 1);
3150 status += MXL_SetGPIO(fe, 3, 0);
3151 }
3152 if (state->RF_IN >= 515000000 && state->RF_IN < 650000000) {
3153 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3154 status += MXL_SetGPIO(fe, 4, 1);
3155 status += MXL_SetGPIO(fe, 1, 1);
3156 status += MXL_SetGPIO(fe, 3, 0);
3157 }
3158 if (state->RF_IN >= 650000000 && state->RF_IN <= 900000000) {
3159 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3160 status += MXL_SetGPIO(fe, 4, 1);
3161 status += MXL_SetGPIO(fe, 1, 1);
3162 status += MXL_SetGPIO(fe, 3, 1);
3163 }
3164 }
3165
3166 if (state->TF_Type == MXL_TF_E_2) {
3167
3168 /* Tracking Filter type E_2 */
3169 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
3170
3171 if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) {
3172 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3173 status += MXL_SetGPIO(fe, 4, 0);
3174 status += MXL_SetGPIO(fe, 1, 1);
3175 status += MXL_SetGPIO(fe, 3, 1);
3176 }
3177 if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) {
3178 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3179 status += MXL_SetGPIO(fe, 4, 0);
3180 status += MXL_SetGPIO(fe, 1, 0);
3181 status += MXL_SetGPIO(fe, 3, 1);
3182 }
3183 if (state->RF_IN >= 250000000 && state->RF_IN < 350000000) {
3184 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3185 status += MXL_SetGPIO(fe, 4, 1);
3186 status += MXL_SetGPIO(fe, 1, 0);
3187 status += MXL_SetGPIO(fe, 3, 1);
3188 }
3189 if (state->RF_IN >= 350000000 && state->RF_IN < 400000000) {
3190 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3191 status += MXL_SetGPIO(fe, 4, 1);
3192 status += MXL_SetGPIO(fe, 1, 0);
3193 status += MXL_SetGPIO(fe, 3, 0);
3194 }
3195 if (state->RF_IN >= 400000000 && state->RF_IN < 570000000) {
3196 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3197 status += MXL_SetGPIO(fe, 4, 1);
3198 status += MXL_SetGPIO(fe, 1, 1);
3199 status += MXL_SetGPIO(fe, 3, 0);
3200 }
3201 if (state->RF_IN >= 570000000 && state->RF_IN < 770000000) {
3202 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3203 status += MXL_SetGPIO(fe, 4, 1);
3204 status += MXL_SetGPIO(fe, 1, 1);
3205 status += MXL_SetGPIO(fe, 3, 0);
3206 }
3207 if (state->RF_IN >= 770000000 && state->RF_IN <= 900000000) {
3208 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3209 status += MXL_SetGPIO(fe, 4, 1);
3210 status += MXL_SetGPIO(fe, 1, 1);
3211 status += MXL_SetGPIO(fe, 3, 1);
3212 }
3213 }
3214
3215 if (state->TF_Type == MXL_TF_G) {
3216
3217 /* Tracking Filter type G add for v2.6.8 */
3218 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
3219
3220 if (state->RF_IN >= 50000000 && state->RF_IN < 190000000) {
3221
3222 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3223 status += MXL_SetGPIO(fe, 4, 0);
3224 status += MXL_SetGPIO(fe, 1, 1);
3225 status += MXL_SetGPIO(fe, 3, 1);
3226 }
3227 if (state->RF_IN >= 190000000 && state->RF_IN < 280000000) {
3228 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3229 status += MXL_SetGPIO(fe, 4, 0);
3230 status += MXL_SetGPIO(fe, 1, 0);
3231 status += MXL_SetGPIO(fe, 3, 1);
3232 }
3233 if (state->RF_IN >= 280000000 && state->RF_IN < 350000000) {
3234 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3235 status += MXL_SetGPIO(fe, 4, 1);
3236 status += MXL_SetGPIO(fe, 1, 0);
3237 status += MXL_SetGPIO(fe, 3, 1);
3238 }
3239 if (state->RF_IN >= 350000000 && state->RF_IN < 400000000) {
3240 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3241 status += MXL_SetGPIO(fe, 4, 1);
3242 status += MXL_SetGPIO(fe, 1, 0);
3243 status += MXL_SetGPIO(fe, 3, 0);
3244 }
3245 if (state->RF_IN >= 400000000 && state->RF_IN < 470000000) {
3246 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3247 status += MXL_SetGPIO(fe, 4, 1);
3248 status += MXL_SetGPIO(fe, 1, 0);
3249 status += MXL_SetGPIO(fe, 3, 1);
3250 }
3251 if (state->RF_IN >= 470000000 && state->RF_IN < 640000000) {
3252 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3253 status += MXL_SetGPIO(fe, 4, 1);
3254 status += MXL_SetGPIO(fe, 1, 1);
3255 status += MXL_SetGPIO(fe, 3, 0);
3256 }
3257 if (state->RF_IN >= 640000000 && state->RF_IN < 820000000) {
3258 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3259 status += MXL_SetGPIO(fe, 4, 1);
3260 status += MXL_SetGPIO(fe, 1, 1);
3261 status += MXL_SetGPIO(fe, 3, 0);
3262 }
3263 if (state->RF_IN >= 820000000 && state->RF_IN <= 900000000) {
3264 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3265 status += MXL_SetGPIO(fe, 4, 1);
3266 status += MXL_SetGPIO(fe, 1, 1);
3267 status += MXL_SetGPIO(fe, 3, 1);
3268 }
3269 }
3270
3271 if (state->TF_Type == MXL_TF_E_NA) {
3272
3273 /* Tracking Filter type E-NA for Empia ONLY change for 2.6.8 */
3274 status += MXL_ControlWrite(fe, DAC_DIN_B, 0);
3275
3276 /* if UHF and terrestrial=> Turn off Tracking Filter */
3277 if (state->RF_IN >= 471000000 &&
3278 (state->RF_IN - 471000000)%6000000 != 0) {
3279
3280 /* Turn off all the banks */
3281 status += MXL_SetGPIO(fe, 3, 1);
3282 status += MXL_SetGPIO(fe, 1, 1);
3283 status += MXL_SetGPIO(fe, 4, 1);
3284 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3285
3286 /* 2.6.12 Turn on RSSI */
3287 status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1);
3288 status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1);
3289 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1);
3290 status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1);
3291
3292 /* RSSI reference point */
3293 status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5);
3294 status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3);
3295 status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 2);
3296
3297 /* following parameter is from analog OTA mode,
3298 * can be change to seek better performance */
3299 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3);
3300 } else {
3301 /* if VHF or Cable => Turn on Tracking Filter */
3302
3303 /* 2.6.12 Turn off RSSI */
3304 status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0);
3305
3306 /* change back from above condition */
3307 status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 5);
3308
3309
3310 if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) {
3311
3312 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3313 status += MXL_SetGPIO(fe, 4, 0);
3314 status += MXL_SetGPIO(fe, 1, 1);
3315 status += MXL_SetGPIO(fe, 3, 1);
3316 }
3317 if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) {
3318 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3319 status += MXL_SetGPIO(fe, 4, 0);
3320 status += MXL_SetGPIO(fe, 1, 0);
3321 status += MXL_SetGPIO(fe, 3, 1);
3322 }
3323 if (state->RF_IN >= 250000000 && state->RF_IN < 350000000) {
3324 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3325 status += MXL_SetGPIO(fe, 4, 1);
3326 status += MXL_SetGPIO(fe, 1, 0);
3327 status += MXL_SetGPIO(fe, 3, 1);
3328 }
3329 if (state->RF_IN >= 350000000 && state->RF_IN < 400000000) {
3330 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3331 status += MXL_SetGPIO(fe, 4, 1);
3332 status += MXL_SetGPIO(fe, 1, 0);
3333 status += MXL_SetGPIO(fe, 3, 0);
3334 }
3335 if (state->RF_IN >= 400000000 && state->RF_IN < 570000000) {
3336 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0);
3337 status += MXL_SetGPIO(fe, 4, 1);
3338 status += MXL_SetGPIO(fe, 1, 1);
3339 status += MXL_SetGPIO(fe, 3, 0);
3340 }
3341 if (state->RF_IN >= 570000000 && state->RF_IN < 770000000) {
3342 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3343 status += MXL_SetGPIO(fe, 4, 1);
3344 status += MXL_SetGPIO(fe, 1, 1);
3345 status += MXL_SetGPIO(fe, 3, 0);
3346 }
3347 if (state->RF_IN >= 770000000 && state->RF_IN <= 900000000) {
3348 status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1);
3349 status += MXL_SetGPIO(fe, 4, 1);
3350 status += MXL_SetGPIO(fe, 1, 1);
3351 status += MXL_SetGPIO(fe, 3, 1);
3352 }
3353 }
3354 }
3355 return status ;
3356}
3357
3358static u16 MXL_SetGPIO(struct dvb_frontend *fe, u8 GPIO_Num, u8 GPIO_Val)
3359{
3360 u16 status = 0;
3361
3362 if (GPIO_Num == 1)
3363 status += MXL_ControlWrite(fe, GPIO_1B, GPIO_Val ? 0 : 1);
3364
3365 /* GPIO2 is not available */
3366
3367 if (GPIO_Num == 3) {
3368 if (GPIO_Val == 1) {
3369 status += MXL_ControlWrite(fe, GPIO_3, 0);
3370 status += MXL_ControlWrite(fe, GPIO_3B, 0);
3371 }
3372 if (GPIO_Val == 0) {
3373 status += MXL_ControlWrite(fe, GPIO_3, 1);
3374 status += MXL_ControlWrite(fe, GPIO_3B, 1);
3375 }
3376 if (GPIO_Val == 3) { /* tri-state */
3377 status += MXL_ControlWrite(fe, GPIO_3, 0);
3378 status += MXL_ControlWrite(fe, GPIO_3B, 1);
3379 }
3380 }
3381 if (GPIO_Num == 4) {
3382 if (GPIO_Val == 1) {
3383 status += MXL_ControlWrite(fe, GPIO_4, 0);
3384 status += MXL_ControlWrite(fe, GPIO_4B, 0);
3385 }
3386 if (GPIO_Val == 0) {
3387 status += MXL_ControlWrite(fe, GPIO_4, 1);
3388 status += MXL_ControlWrite(fe, GPIO_4B, 1);
3389 }
3390 if (GPIO_Val == 3) { /* tri-state */
3391 status += MXL_ControlWrite(fe, GPIO_4, 0);
3392 status += MXL_ControlWrite(fe, GPIO_4B, 1);
3393 }
3394 }
3395
3396 return status;
3397}
3398
3399static u16 MXL_ControlWrite(struct dvb_frontend *fe, u16 ControlNum, u32 value)
3400{
3401 u16 status = 0;
3402
3403 /* Will write ALL Matching Control Name */
3404 /* Write Matching INIT Control */
3405 status += MXL_ControlWrite_Group(fe, ControlNum, value, 1);
3406 /* Write Matching CH Control */
3407 status += MXL_ControlWrite_Group(fe, ControlNum, value, 2);
3408#ifdef _MXL_INTERNAL
3409 /* Write Matching MXL Control */
3410 status += MXL_ControlWrite_Group(fe, ControlNum, value, 3);
3411#endif
3412 return status;
3413}
3414
3415static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
3416 u32 value, u16 controlGroup)
3417{
3418 struct mxl5005s_state *state = fe->tuner_priv;
3419 u16 i, j, k;
3420 u32 highLimit;
3421 u32 ctrlVal;
3422
3423 if (controlGroup == 1) /* Initial Control */ {
3424
3425 for (i = 0; i < state->Init_Ctrl_Num; i++) {
3426
3427 if (controlNum == state->Init_Ctrl[i].Ctrl_Num) {
3428
3429 highLimit = 1 << state->Init_Ctrl[i].size;
3430 if (value < highLimit) {
3431 for (j = 0; j < state->Init_Ctrl[i].size; j++) {
3432 state->Init_Ctrl[i].val[j] = (u8)((value >> j) & 0x01);
3433 MXL_RegWriteBit(fe, (u8)(state->Init_Ctrl[i].addr[j]),
3434 (u8)(state->Init_Ctrl[i].bit[j]),
3435 (u8)((value>>j) & 0x01));
3436 }
3437 ctrlVal = 0;
3438 for (k = 0; k < state->Init_Ctrl[i].size; k++)
3439 ctrlVal += state->Init_Ctrl[i].val[k] * (1 << k);
3440 } else
3441 return -1;
3442 }
3443 }
3444 }
3445 if (controlGroup == 2) /* Chan change Control */ {
3446
3447 for (i = 0; i < state->CH_Ctrl_Num; i++) {
3448
3449 if (controlNum == state->CH_Ctrl[i].Ctrl_Num) {
3450
3451 highLimit = 1 << state->CH_Ctrl[i].size;
3452 if (value < highLimit) {
3453 for (j = 0; j < state->CH_Ctrl[i].size; j++) {
3454 state->CH_Ctrl[i].val[j] = (u8)((value >> j) & 0x01);
3455 MXL_RegWriteBit(fe, (u8)(state->CH_Ctrl[i].addr[j]),
3456 (u8)(state->CH_Ctrl[i].bit[j]),
3457 (u8)((value>>j) & 0x01));
3458 }
3459 ctrlVal = 0;
3460 for (k = 0; k < state->CH_Ctrl[i].size; k++)
3461 ctrlVal += state->CH_Ctrl[i].val[k] * (1 << k);
3462 } else
3463 return -1;
3464 }
3465 }
3466 }
3467#ifdef _MXL_INTERNAL
3468 if (controlGroup == 3) /* Maxlinear Control */ {
3469
3470 for (i = 0; i < state->MXL_Ctrl_Num; i++) {
3471
3472 if (controlNum == state->MXL_Ctrl[i].Ctrl_Num) {
3473
3474 highLimit = (1 << state->MXL_Ctrl[i].size);
3475 if (value < highLimit) {
3476 for (j = 0; j < state->MXL_Ctrl[i].size; j++) {
3477 state->MXL_Ctrl[i].val[j] = (u8)((value >> j) & 0x01);
3478 MXL_RegWriteBit(fe, (u8)(state->MXL_Ctrl[i].addr[j]),
3479 (u8)(state->MXL_Ctrl[i].bit[j]),
3480 (u8)((value>>j) & 0x01));
3481 }
3482 ctrlVal = 0;
3483 for (k = 0; k < state->MXL_Ctrl[i].size; k++)
3484 ctrlVal += state->MXL_Ctrl[i].val[k] * (1 << k);
3485 } else
3486 return -1;
3487 }
3488 }
3489 }
3490#endif
3491 return 0 ; /* successful return */
3492}
3493
3494static u16 MXL_RegRead(struct dvb_frontend *fe, u8 RegNum, u8 *RegVal)
3495{
3496 struct mxl5005s_state *state = fe->tuner_priv;
3497 int i ;
3498
3499 for (i = 0; i < 104; i++) {
3500 if (RegNum == state->TunerRegs[i].Reg_Num) {
3501 *RegVal = (u8)(state->TunerRegs[i].Reg_Val);
3502 return 0;
3503 }
3504 }
3505
3506 return 1;
3507}
3508
3509static u16 MXL_ControlRead(struct dvb_frontend *fe, u16 controlNum, u32 *value)
3510{
3511 struct mxl5005s_state *state = fe->tuner_priv;
3512 u32 ctrlVal ;
3513 u16 i, k ;
3514
3515 for (i = 0; i < state->Init_Ctrl_Num ; i++) {
3516
3517 if (controlNum == state->Init_Ctrl[i].Ctrl_Num) {
3518
3519 ctrlVal = 0;
3520 for (k = 0; k < state->Init_Ctrl[i].size; k++)
3521 ctrlVal += state->Init_Ctrl[i].val[k] * (1<<k);
3522 *value = ctrlVal;
3523 return 0;
3524 }
3525 }
3526
3527 for (i = 0; i < state->CH_Ctrl_Num ; i++) {
3528
3529 if (controlNum == state->CH_Ctrl[i].Ctrl_Num) {
3530
3531 ctrlVal = 0;
3532 for (k = 0; k < state->CH_Ctrl[i].size; k++)
3533 ctrlVal += state->CH_Ctrl[i].val[k] * (1 << k);
3534 *value = ctrlVal;
3535 return 0;
3536
3537 }
3538 }
3539
3540#ifdef _MXL_INTERNAL
3541 for (i = 0; i < state->MXL_Ctrl_Num ; i++) {
3542
3543 if (controlNum == state->MXL_Ctrl[i].Ctrl_Num) {
3544
3545 ctrlVal = 0;
3546 for (k = 0; k < state->MXL_Ctrl[i].size; k++)
3547 ctrlVal += state->MXL_Ctrl[i].val[k] * (1<<k);
3548 *value = ctrlVal;
3549 return 0;
3550
3551 }
3552 }
3553#endif
3554 return 1;
3555}
3556
3557static void MXL_RegWriteBit(struct dvb_frontend *fe, u8 address, u8 bit,
3558 u8 bitVal)
3559{
3560 struct mxl5005s_state *state = fe->tuner_priv;
3561 int i ;
3562
3563 const u8 AND_MAP[8] = {
3564 0xFE, 0xFD, 0xFB, 0xF7,
3565 0xEF, 0xDF, 0xBF, 0x7F } ;
3566
3567 const u8 OR_MAP[8] = {
3568 0x01, 0x02, 0x04, 0x08,
3569 0x10, 0x20, 0x40, 0x80 } ;
3570
3571 for (i = 0; i < state->TunerRegs_Num; i++) {
3572 if (state->TunerRegs[i].Reg_Num == address) {
3573 if (bitVal)
3574 state->TunerRegs[i].Reg_Val |= OR_MAP[bit];
3575 else
3576 state->TunerRegs[i].Reg_Val &= AND_MAP[bit];
3577 break ;
3578 }
3579 }
3580}
3581
3582static u32 MXL_Ceiling(u32 value, u32 resolution)
3583{
3584 return (value/resolution + (value % resolution > 0 ? 1 : 0));
3585}
3586
3587/* Retrieve the Initialzation Registers */
3588static u16 MXL_GetInitRegister(struct dvb_frontend *fe, u8 *RegNum,
3589 u8 *RegVal, int *count)
3590{
3591 u16 status = 0;
3592 int i ;
3593
3594 u8 RegAddr[] = {
3595 11, 12, 13, 22, 32, 43, 44, 53, 56, 59, 73,
3596 76, 77, 91, 134, 135, 137, 147,
3597 156, 166, 167, 168, 25 };
3598
3599 *count = sizeof(RegAddr) / sizeof(u8);
3600
3601 status += MXL_BlockInit(fe);
3602
3603 for (i = 0 ; i < *count; i++) {
3604 RegNum[i] = RegAddr[i];
3605 status += MXL_RegRead(fe, RegNum[i], &RegVal[i]);
3606 }
3607
3608 return status;
3609}
3610
3611static u16 MXL_GetCHRegister(struct dvb_frontend *fe, u8 *RegNum, u8 *RegVal,
3612 int *count)
3613{
3614 u16 status = 0;
3615 int i ;
3616
3617/* add 77, 166, 167, 168 register for 2.6.12 */
3618#ifdef _MXL_PRODUCTION
3619 u8 RegAddr[] = {14, 15, 16, 17, 22, 43, 65, 68, 69, 70, 73, 92, 93, 106,
3620 107, 108, 109, 110, 111, 112, 136, 138, 149, 77, 166, 167, 168 } ;
3621#else
3622 u8 RegAddr[] = {14, 15, 16, 17, 22, 43, 68, 69, 70, 73, 92, 93, 106,
3623 107, 108, 109, 110, 111, 112, 136, 138, 149, 77, 166, 167, 168 } ;
3624 /*
3625 u8 RegAddr[171];
3626 for (i = 0; i <= 170; i++)
3627 RegAddr[i] = i;
3628 */
3629#endif
3630
3631 *count = sizeof(RegAddr) / sizeof(u8);
3632
3633 for (i = 0 ; i < *count; i++) {
3634 RegNum[i] = RegAddr[i];
3635 status += MXL_RegRead(fe, RegNum[i], &RegVal[i]);
3636 }
3637
3638 return status;
3639}
3640
3641static u16 MXL_GetCHRegister_ZeroIF(struct dvb_frontend *fe, u8 *RegNum,
3642 u8 *RegVal, int *count)
3643{
3644 u16 status = 0;
3645 int i;
3646
3647 u8 RegAddr[] = {43, 136};
3648
3649 *count = sizeof(RegAddr) / sizeof(u8);
3650
3651 for (i = 0; i < *count; i++) {
3652 RegNum[i] = RegAddr[i];
3653 status += MXL_RegRead(fe, RegNum[i], &RegVal[i]);
3654 }
3655
3656 return status;
3657}
3658
3659static u16 MXL_GetMasterControl(u8 *MasterReg, int state)
3660{
3661 if (state == 1) /* Load_Start */
3662 *MasterReg = 0xF3;
3663 if (state == 2) /* Power_Down */
3664 *MasterReg = 0x41;
3665 if (state == 3) /* Synth_Reset */
3666 *MasterReg = 0xB1;
3667 if (state == 4) /* Seq_Off */
3668 *MasterReg = 0xF1;
3669
3670 return 0;
3671}
3672
3673#ifdef _MXL_PRODUCTION
3674static u16 MXL_VCORange_Test(struct dvb_frontend *fe, int VCO_Range)
3675{
3676 struct mxl5005s_state *state = fe->tuner_priv;
3677 u16 status = 0 ;
3678
3679 if (VCO_Range == 1) {
3680 status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1);
3681 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
3682 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
3683 status += MXL_ControlWrite(fe, RFSYN_DIVM, 1);
3684 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
3685 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
3686 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
3687 if (state->Mode == 0 && state->IF_Mode == 1) {
3688 /* Analog Low IF Mode */
3689 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3690 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3691 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 56);
3692 status += MXL_ControlWrite(fe,
3693 CHCAL_FRAC_MOD_RF, 180224);
3694 }
3695 if (state->Mode == 0 && state->IF_Mode == 0) {
3696 /* Analog Zero IF Mode */
3697 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3698 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3699 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 56);
3700 status += MXL_ControlWrite(fe,
3701 CHCAL_FRAC_MOD_RF, 222822);
3702 }
3703 if (state->Mode == 1) /* Digital Mode */ {
3704 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3705 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3706 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 56);
3707 status += MXL_ControlWrite(fe,
3708 CHCAL_FRAC_MOD_RF, 229376);
3709 }
3710 }
3711
3712 if (VCO_Range == 2) {
3713 status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1);
3714 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
3715 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
3716 status += MXL_ControlWrite(fe, RFSYN_DIVM, 1);
3717 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
3718 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
3719 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
3720 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3721 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3722 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 41);
3723 if (state->Mode == 0 && state->IF_Mode == 1) {
3724 /* Analog Low IF Mode */
3725 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3726 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3727 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42);
3728 status += MXL_ControlWrite(fe,
3729 CHCAL_FRAC_MOD_RF, 206438);
3730 }
3731 if (state->Mode == 0 && state->IF_Mode == 0) {
3732 /* Analog Zero IF Mode */
3733 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3734 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3735 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42);
3736 status += MXL_ControlWrite(fe,
3737 CHCAL_FRAC_MOD_RF, 206438);
3738 }
3739 if (state->Mode == 1) /* Digital Mode */ {
3740 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1);
3741 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3742 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 41);
3743 status += MXL_ControlWrite(fe,
3744 CHCAL_FRAC_MOD_RF, 16384);
3745 }
3746 }
3747
3748 if (VCO_Range == 3) {
3749 status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1);
3750 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
3751 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
3752 status += MXL_ControlWrite(fe, RFSYN_DIVM, 1);
3753 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
3754 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
3755 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
3756 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3757 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3758 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42);
3759 if (state->Mode == 0 && state->IF_Mode == 1) {
3760 /* Analog Low IF Mode */
3761 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3762 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3763 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 44);
3764 status += MXL_ControlWrite(fe,
3765 CHCAL_FRAC_MOD_RF, 173670);
3766 }
3767 if (state->Mode == 0 && state->IF_Mode == 0) {
3768 /* Analog Zero IF Mode */
3769 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3770 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3771 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 44);
3772 status += MXL_ControlWrite(fe,
3773 CHCAL_FRAC_MOD_RF, 173670);
3774 }
3775 if (state->Mode == 1) /* Digital Mode */ {
3776 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3777 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8);
3778 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42);
3779 status += MXL_ControlWrite(fe,
3780 CHCAL_FRAC_MOD_RF, 245760);
3781 }
3782 }
3783
3784 if (VCO_Range == 4) {
3785 status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1);
3786 status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0);
3787 status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0);
3788 status += MXL_ControlWrite(fe, RFSYN_DIVM, 1);
3789 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1);
3790 status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1);
3791 status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0);
3792 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3793 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3794 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27);
3795 if (state->Mode == 0 && state->IF_Mode == 1) {
3796 /* Analog Low IF Mode */
3797 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3798 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3799 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27);
3800 status += MXL_ControlWrite(fe,
3801 CHCAL_FRAC_MOD_RF, 206438);
3802 }
3803 if (state->Mode == 0 && state->IF_Mode == 0) {
3804 /* Analog Zero IF Mode */
3805 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3806 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3807 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27);
3808 status += MXL_ControlWrite(fe,
3809 CHCAL_FRAC_MOD_RF, 206438);
3810 }
3811 if (state->Mode == 1) /* Digital Mode */ {
3812 status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0);
3813 status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40);
3814 status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27);
3815 status += MXL_ControlWrite(fe,
3816 CHCAL_FRAC_MOD_RF, 212992);
3817 }
3818 }
3819
3820 return status;
3821}
3822
3823static u16 MXL_Hystersis_Test(struct dvb_frontend *fe, int Hystersis)
3824{
3825 struct mxl5005s_state *state = fe->tuner_priv;
3826 u16 status = 0;
3827
3828 if (Hystersis == 1)
3829 status += MXL_ControlWrite(fe, DN_BYPASS_AGC_I2C, 1);
3830
3831 return status;
3832}
3833#endif
3834/* End: Reference driver code found in the Realtek driver that
3835 * is copyright MaxLinear */
3836
3837/* ----------------------------------------------------------------
3838 * Begin: Everything after here is new code to adapt the
3839 * proprietary Realtek driver into a Linux API tuner.
3840 * Copyright (C) 2008 Steven Toth <stoth@hauppauge.com>
3841 */
3842static int mxl5005s_reset(struct dvb_frontend *fe)
3843{
3844 struct mxl5005s_state *state = fe->tuner_priv;
3845 int ret = 0;
3846
3847 u8 buf[2] = { 0xff, 0x00 };
3848 struct i2c_msg msg = { .addr = state->config->i2c_address, .flags = 0,
3849 .buf = buf, .len = 2 };
3850
3851 dprintk(2, "%s()\n", __func__);
3852
3853 if (fe->ops.i2c_gate_ctrl)
3854 fe->ops.i2c_gate_ctrl(fe, 1);
3855
3856 if (i2c_transfer(state->i2c, &msg, 1) != 1) {
3857 printk(KERN_WARNING "mxl5005s I2C reset failed\n");
3858 ret = -EREMOTEIO;
3859 }
3860
3861 if (fe->ops.i2c_gate_ctrl)
3862 fe->ops.i2c_gate_ctrl(fe, 0);
3863
3864 return ret;
3865}
3866
3867/* Write a single byte to a single reg, latch the value if required by
3868 * following the transaction with the latch byte.
3869 */
3870static int mxl5005s_writereg(struct dvb_frontend *fe, u8 reg, u8 val, int latch)
3871{
3872 struct mxl5005s_state *state = fe->tuner_priv;
3873 u8 buf[3] = { reg, val, MXL5005S_LATCH_BYTE };
3874 struct i2c_msg msg = { .addr = state->config->i2c_address, .flags = 0,
3875 .buf = buf, .len = 3 };
3876
3877 if (latch == 0)
3878 msg.len = 2;
3879
3880 dprintk(2, "%s(0x%x, 0x%x, 0x%x)\n", __func__, reg, val, msg.addr);
3881
3882 if (i2c_transfer(state->i2c, &msg, 1) != 1) {
3883 printk(KERN_WARNING "mxl5005s I2C write failed\n");
3884 return -EREMOTEIO;
3885 }
3886 return 0;
3887}
3888
3889static int mxl5005s_writeregs(struct dvb_frontend *fe, u8 *addrtable,
3890 u8 *datatable, u8 len)
3891{
3892 int ret = 0, i;
3893
3894 if (fe->ops.i2c_gate_ctrl)
3895 fe->ops.i2c_gate_ctrl(fe, 1);
3896
3897 for (i = 0 ; i < len-1; i++) {
3898 ret = mxl5005s_writereg(fe, addrtable[i], datatable[i], 0);
3899 if (ret < 0)
3900 break;
3901 }
3902
3903 ret = mxl5005s_writereg(fe, addrtable[i], datatable[i], 1);
3904
3905 if (fe->ops.i2c_gate_ctrl)
3906 fe->ops.i2c_gate_ctrl(fe, 0);
3907
3908 return ret;
3909}
3910
3911static int mxl5005s_init(struct dvb_frontend *fe)
3912{
3913 dprintk(1, "%s()\n", __func__);
3914 return mxl5005s_reconfigure(fe, MXL_QAM, MXL5005S_BANDWIDTH_6MHZ);
3915}
3916
3917static int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type,
3918 u32 bandwidth)
3919{
3920 struct mxl5005s_state *state = fe->tuner_priv;
3921
3922 u8 AddrTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
3923 u8 ByteTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
3924 int TableLen;
3925
3926 dprintk(1, "%s(type=%d, bw=%d)\n", __func__, mod_type, bandwidth);
3927
3928 mxl5005s_reset(fe);
3929
3930 /* Tuner initialization stage 0 */
3931 MXL_GetMasterControl(ByteTable, MC_SYNTH_RESET);
3932 AddrTable[0] = MASTER_CONTROL_ADDR;
3933 ByteTable[0] |= state->config->AgcMasterByte;
3934
3935 mxl5005s_writeregs(fe, AddrTable, ByteTable, 1);
3936
3937 mxl5005s_AssignTunerMode(fe, mod_type, bandwidth);
3938
3939 /* Tuner initialization stage 1 */
3940 MXL_GetInitRegister(fe, AddrTable, ByteTable, &TableLen);
3941
3942 mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen);
3943
3944 return 0;
3945}
3946
3947static int mxl5005s_AssignTunerMode(struct dvb_frontend *fe, u32 mod_type,
3948 u32 bandwidth)
3949{
3950 struct mxl5005s_state *state = fe->tuner_priv;
3951 struct mxl5005s_config *c = state->config;
3952
3953 InitTunerControls(fe);
3954
3955 /* Set MxL5005S parameters. */
3956 MXL5005_TunerConfig(
3957 fe,
3958 c->mod_mode,
3959 c->if_mode,
3960 bandwidth,
3961 c->if_freq,
3962 c->xtal_freq,
3963 c->agc_mode,
3964 c->top,
3965 c->output_load,
3966 c->clock_out,
3967 c->div_out,
3968 c->cap_select,
3969 c->rssi_enable,
3970 mod_type,
3971 c->tracking_filter);
3972
3973 return 0;
3974}
3975
3976static int mxl5005s_set_params(struct dvb_frontend *fe,
3977 struct dvb_frontend_parameters *params)
3978{
3979 struct mxl5005s_state *state = fe->tuner_priv;
3980 u32 req_mode, req_bw = 0;
3981 int ret;
3982
3983 dprintk(1, "%s()\n", __func__);
3984
3985 if (fe->ops.info.type == FE_ATSC) {
3986 switch (params->u.vsb.modulation) {
3987 case VSB_8:
3988 req_mode = MXL_ATSC; break;
3989 default:
3990 case QAM_64:
3991 case QAM_256:
3992 case QAM_AUTO:
3993 req_mode = MXL_QAM; break;
3994 }
3995 } else
3996 req_mode = MXL_DVBT;
3997
3998 /* Change tuner for new modulation type if reqd */
3999 if (req_mode != state->current_mode) {
4000 switch (req_mode) {
4001 case VSB_8:
4002 case QAM_64:
4003 case QAM_256:
4004 case QAM_AUTO:
4005 req_bw = MXL5005S_BANDWIDTH_6MHZ;
4006 break;
4007 default:
4008 /* Assume DVB-T */
4009 switch (params->u.ofdm.bandwidth) {
4010 case BANDWIDTH_6_MHZ:
4011 req_bw = MXL5005S_BANDWIDTH_6MHZ;
4012 break;
4013 case BANDWIDTH_7_MHZ:
4014 req_bw = MXL5005S_BANDWIDTH_7MHZ;
4015 break;
4016 case BANDWIDTH_AUTO:
4017 case BANDWIDTH_8_MHZ:
4018 req_bw = MXL5005S_BANDWIDTH_8MHZ;
4019 break;
4020 }
4021 }
4022
4023 state->current_mode = req_mode;
4024 ret = mxl5005s_reconfigure(fe, req_mode, req_bw);
4025
4026 } else
4027 ret = 0;
4028
4029 if (ret == 0) {
4030 dprintk(1, "%s() freq=%d\n", __func__, params->frequency);
4031 ret = mxl5005s_SetRfFreqHz(fe, params->frequency);
4032 }
4033
4034 return ret;
4035}
4036
4037static int mxl5005s_get_frequency(struct dvb_frontend *fe, u32 *frequency)
4038{
4039 struct mxl5005s_state *state = fe->tuner_priv;
4040 dprintk(1, "%s()\n", __func__);
4041
4042 *frequency = state->RF_IN;
4043
4044 return 0;
4045}
4046
4047static int mxl5005s_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
4048{
4049 struct mxl5005s_state *state = fe->tuner_priv;
4050 dprintk(1, "%s()\n", __func__);
4051
4052 *bandwidth = state->Chan_Bandwidth;
4053
4054 return 0;
4055}
4056
4057static int mxl5005s_release(struct dvb_frontend *fe)
4058{
4059 dprintk(1, "%s()\n", __func__);
4060 kfree(fe->tuner_priv);
4061 fe->tuner_priv = NULL;
4062 return 0;
4063}
4064
4065static const struct dvb_tuner_ops mxl5005s_tuner_ops = {
4066 .info = {
4067 .name = "MaxLinear MXL5005S",
4068 .frequency_min = 48000000,
4069 .frequency_max = 860000000,
4070 .frequency_step = 50000,
4071 },
4072
4073 .release = mxl5005s_release,
4074 .init = mxl5005s_init,
4075
4076 .set_params = mxl5005s_set_params,
4077 .get_frequency = mxl5005s_get_frequency,
4078 .get_bandwidth = mxl5005s_get_bandwidth,
4079};
4080
4081struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe,
4082 struct i2c_adapter *i2c,
4083 struct mxl5005s_config *config)
4084{
4085 struct mxl5005s_state *state = NULL;
4086 dprintk(1, "%s()\n", __func__);
4087
4088 state = kzalloc(sizeof(struct mxl5005s_state), GFP_KERNEL);
4089 if (state == NULL)
4090 return NULL;
4091
4092 state->frontend = fe;
4093 state->config = config;
4094 state->i2c = i2c;
4095 state->current_mode = MXL_QAM;
4096
4097 printk(KERN_INFO "MXL5005S: Attached at address 0x%02x\n",
4098 config->i2c_address);
4099
4100 memcpy(&fe->ops.tuner_ops, &mxl5005s_tuner_ops,
4101 sizeof(struct dvb_tuner_ops));
4102
4103 fe->tuner_priv = state;
4104 return fe;
4105}
4106EXPORT_SYMBOL(mxl5005s_attach);
4107
4108MODULE_DESCRIPTION("MaxLinear MXL5005S silicon tuner driver");
4109MODULE_AUTHOR("Steven Toth");
4110MODULE_LICENSE("GPL");
diff --git a/drivers/media/common/tuners/mxl5005s.h b/drivers/media/common/tuners/mxl5005s.h
new file mode 100644
index 000000000000..396db150bf0c
--- /dev/null
+++ b/drivers/media/common/tuners/mxl5005s.h
@@ -0,0 +1,131 @@
1/*
2 MaxLinear MXL5005S VSB/QAM/DVBT tuner driver
3
4 Copyright (C) 2008 MaxLinear
5 Copyright (C) 2008 Steven Toth <stoth@hauppauge.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21*/
22
23#ifndef __MXL5005S_H
24#define __MXL5005S_H
25
26#include <linux/i2c.h>
27#include "dvb_frontend.h"
28
29struct mxl5005s_config {
30
31 /* 7 bit i2c address */
32 u8 i2c_address;
33
34#define IF_FREQ_4570000HZ 4570000
35#define IF_FREQ_4571429HZ 4571429
36#define IF_FREQ_5380000HZ 5380000
37#define IF_FREQ_36000000HZ 36000000
38#define IF_FREQ_36125000HZ 36125000
39#define IF_FREQ_36166667HZ 36166667
40#define IF_FREQ_44000000HZ 44000000
41 u32 if_freq;
42
43#define CRYSTAL_FREQ_4000000HZ 4000000
44#define CRYSTAL_FREQ_16000000HZ 16000000
45#define CRYSTAL_FREQ_25000000HZ 25000000
46#define CRYSTAL_FREQ_28800000HZ 28800000
47 u32 xtal_freq;
48
49#define MXL_DUAL_AGC 0
50#define MXL_SINGLE_AGC 1
51 u8 agc_mode;
52
53#define MXL_TF_DEFAULT 0
54#define MXL_TF_OFF 1
55#define MXL_TF_C 2
56#define MXL_TF_C_H 3
57#define MXL_TF_D 4
58#define MXL_TF_D_L 5
59#define MXL_TF_E 6
60#define MXL_TF_F 7
61#define MXL_TF_E_2 8
62#define MXL_TF_E_NA 9
63#define MXL_TF_G 10
64 u8 tracking_filter;
65
66#define MXL_RSSI_DISABLE 0
67#define MXL_RSSI_ENABLE 1
68 u8 rssi_enable;
69
70#define MXL_CAP_SEL_DISABLE 0
71#define MXL_CAP_SEL_ENABLE 1
72 u8 cap_select;
73
74#define MXL_DIV_OUT_1 0
75#define MXL_DIV_OUT_4 1
76 u8 div_out;
77
78#define MXL_CLOCK_OUT_DISABLE 0
79#define MXL_CLOCK_OUT_ENABLE 1
80 u8 clock_out;
81
82#define MXL5005S_IF_OUTPUT_LOAD_200_OHM 200
83#define MXL5005S_IF_OUTPUT_LOAD_300_OHM 300
84 u32 output_load;
85
86#define MXL5005S_TOP_5P5 55
87#define MXL5005S_TOP_7P2 72
88#define MXL5005S_TOP_9P2 92
89#define MXL5005S_TOP_11P0 110
90#define MXL5005S_TOP_12P9 129
91#define MXL5005S_TOP_14P7 147
92#define MXL5005S_TOP_16P8 168
93#define MXL5005S_TOP_19P4 194
94#define MXL5005S_TOP_21P2 212
95#define MXL5005S_TOP_23P2 232
96#define MXL5005S_TOP_25P2 252
97#define MXL5005S_TOP_27P1 271
98#define MXL5005S_TOP_29P2 292
99#define MXL5005S_TOP_31P7 317
100#define MXL5005S_TOP_34P9 349
101 u32 top;
102
103#define MXL_ANALOG_MODE 0
104#define MXL_DIGITAL_MODE 1
105 u8 mod_mode;
106
107#define MXL_ZERO_IF 0
108#define MXL_LOW_IF 1
109 u8 if_mode;
110
111 /* Stuff I don't know what to do with */
112 u8 AgcMasterByte;
113};
114
115#if defined(CONFIG_MEDIA_TUNER_MXL5005S) || \
116 (defined(CONFIG_MEDIA_TUNER_MXL5005S_MODULE) && defined(MODULE))
117extern struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe,
118 struct i2c_adapter *i2c,
119 struct mxl5005s_config *config);
120#else
121static inline struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe,
122 struct i2c_adapter *i2c,
123 struct mxl5005s_config *config)
124{
125 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
126 return NULL;
127}
128#endif /* CONFIG_DVB_TUNER_MXL5005S */
129
130#endif /* __MXL5005S_H */
131
diff --git a/drivers/media/common/tuners/tda18271-common.c b/drivers/media/common/tuners/tda18271-common.c
index e27a7620a32f..f1894fec32b9 100644
--- a/drivers/media/common/tuners/tda18271-common.c
+++ b/drivers/media/common/tuners/tda18271-common.c
@@ -227,9 +227,8 @@ int tda18271_charge_pump_source(struct dvb_frontend *fe,
227 227
228 regs[r_cp] &= ~0x20; 228 regs[r_cp] &= ~0x20;
229 regs[r_cp] |= ((force & 1) << 5); 229 regs[r_cp] |= ((force & 1) << 5);
230 tda18271_write_regs(fe, r_cp, 1);
231 230
232 return 0; 231 return tda18271_write_regs(fe, r_cp, 1);
233} 232}
234 233
235int tda18271_init_regs(struct dvb_frontend *fe) 234int tda18271_init_regs(struct dvb_frontend *fe)
@@ -487,16 +486,15 @@ int tda18271_set_standby_mode(struct dvb_frontend *fe,
487 struct tda18271_priv *priv = fe->tuner_priv; 486 struct tda18271_priv *priv = fe->tuner_priv;
488 unsigned char *regs = priv->tda18271_regs; 487 unsigned char *regs = priv->tda18271_regs;
489 488
490 tda_dbg("sm = %d, sm_lt = %d, sm_xt = %d\n", sm, sm_lt, sm_xt); 489 if (tda18271_debug & DBG_ADV)
490 tda_dbg("sm = %d, sm_lt = %d, sm_xt = %d\n", sm, sm_lt, sm_xt);
491 491
492 regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */ 492 regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */
493 regs[R_EP3] |= sm ? (1 << 7) : 0 | 493 regs[R_EP3] |= sm ? (1 << 7) : 0 |
494 sm_lt ? (1 << 6) : 0 | 494 sm_lt ? (1 << 6) : 0 |
495 sm_xt ? (1 << 5) : 0; 495 sm_xt ? (1 << 5) : 0;
496 496
497 tda18271_write_regs(fe, R_EP3, 1); 497 return tda18271_write_regs(fe, R_EP3, 1);
498
499 return 0;
500} 498}
501 499
502/*---------------------------------------------------------------------*/ 500/*---------------------------------------------------------------------*/
@@ -510,7 +508,7 @@ int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq)
510 u32 div; 508 u32 div;
511 509
512 int ret = tda18271_lookup_pll_map(fe, MAIN_PLL, &freq, &pd, &d); 510 int ret = tda18271_lookup_pll_map(fe, MAIN_PLL, &freq, &pd, &d);
513 if (ret < 0) 511 if (tda_fail(ret))
514 goto fail; 512 goto fail;
515 513
516 regs[R_MPD] = (0x77 & pd); 514 regs[R_MPD] = (0x77 & pd);
@@ -542,7 +540,7 @@ int tda18271_calc_cal_pll(struct dvb_frontend *fe, u32 freq)
542 u32 div; 540 u32 div;
543 541
544 int ret = tda18271_lookup_pll_map(fe, CAL_PLL, &freq, &pd, &d); 542 int ret = tda18271_lookup_pll_map(fe, CAL_PLL, &freq, &pd, &d);
545 if (ret < 0) 543 if (tda_fail(ret))
546 goto fail; 544 goto fail;
547 545
548 regs[R_CPD] = pd; 546 regs[R_CPD] = pd;
@@ -566,7 +564,7 @@ int tda18271_calc_bp_filter(struct dvb_frontend *fe, u32 *freq)
566 u8 val; 564 u8 val;
567 565
568 int ret = tda18271_lookup_map(fe, BP_FILTER, freq, &val); 566 int ret = tda18271_lookup_map(fe, BP_FILTER, freq, &val);
569 if (ret < 0) 567 if (tda_fail(ret))
570 goto fail; 568 goto fail;
571 569
572 regs[R_EP1] &= ~0x07; /* clear bp filter bits */ 570 regs[R_EP1] &= ~0x07; /* clear bp filter bits */
@@ -583,7 +581,7 @@ int tda18271_calc_km(struct dvb_frontend *fe, u32 *freq)
583 u8 val; 581 u8 val;
584 582
585 int ret = tda18271_lookup_map(fe, RF_CAL_KMCO, freq, &val); 583 int ret = tda18271_lookup_map(fe, RF_CAL_KMCO, freq, &val);
586 if (ret < 0) 584 if (tda_fail(ret))
587 goto fail; 585 goto fail;
588 586
589 regs[R_EB13] &= ~0x7c; /* clear k & m bits */ 587 regs[R_EB13] &= ~0x7c; /* clear k & m bits */
@@ -600,7 +598,7 @@ int tda18271_calc_rf_band(struct dvb_frontend *fe, u32 *freq)
600 u8 val; 598 u8 val;
601 599
602 int ret = tda18271_lookup_map(fe, RF_BAND, freq, &val); 600 int ret = tda18271_lookup_map(fe, RF_BAND, freq, &val);
603 if (ret < 0) 601 if (tda_fail(ret))
604 goto fail; 602 goto fail;
605 603
606 regs[R_EP2] &= ~0xe0; /* clear rf band bits */ 604 regs[R_EP2] &= ~0xe0; /* clear rf band bits */
@@ -617,7 +615,7 @@ int tda18271_calc_gain_taper(struct dvb_frontend *fe, u32 *freq)
617 u8 val; 615 u8 val;
618 616
619 int ret = tda18271_lookup_map(fe, GAIN_TAPER, freq, &val); 617 int ret = tda18271_lookup_map(fe, GAIN_TAPER, freq, &val);
620 if (ret < 0) 618 if (tda_fail(ret))
621 goto fail; 619 goto fail;
622 620
623 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */ 621 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */
@@ -634,7 +632,7 @@ int tda18271_calc_ir_measure(struct dvb_frontend *fe, u32 *freq)
634 u8 val; 632 u8 val;
635 633
636 int ret = tda18271_lookup_map(fe, IR_MEASURE, freq, &val); 634 int ret = tda18271_lookup_map(fe, IR_MEASURE, freq, &val);
637 if (ret < 0) 635 if (tda_fail(ret))
638 goto fail; 636 goto fail;
639 637
640 regs[R_EP5] &= ~0x07; 638 regs[R_EP5] &= ~0x07;
@@ -650,11 +648,11 @@ int tda18271_calc_rf_cal(struct dvb_frontend *fe, u32 *freq)
650 unsigned char *regs = priv->tda18271_regs; 648 unsigned char *regs = priv->tda18271_regs;
651 u8 val; 649 u8 val;
652 650
653 tda18271_lookup_map(fe, RF_CAL, freq, &val); 651 int ret = tda18271_lookup_map(fe, RF_CAL, freq, &val);
654 652
655 regs[R_EB14] = val; 653 regs[R_EB14] = val;
656 654
657 return 0; 655 return ret;
658} 656}
659 657
660/* 658/*
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index b262100ae897..89c01fb1f859 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -51,6 +51,7 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
51{ 51{
52 struct tda18271_priv *priv = fe->tuner_priv; 52 struct tda18271_priv *priv = fe->tuner_priv;
53 unsigned char *regs = priv->tda18271_regs; 53 unsigned char *regs = priv->tda18271_regs;
54 int ret;
54 u32 N; 55 u32 N;
55 56
56 /* update TV broadcast parameters */ 57 /* update TV broadcast parameters */
@@ -85,7 +86,9 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
85 /* update rf top / if top */ 86 /* update rf top / if top */
86 regs[R_EB22] = 0x00; 87 regs[R_EB22] = 0x00;
87 regs[R_EB22] |= map->rfagc_top; 88 regs[R_EB22] |= map->rfagc_top;
88 tda18271_write_regs(fe, R_EB22, 1); 89 ret = tda18271_write_regs(fe, R_EB22, 1);
90 if (tda_fail(ret))
91 goto fail;
89 92
90 /* --------------------------------------------------------------- */ 93 /* --------------------------------------------------------------- */
91 94
@@ -121,7 +124,9 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
121 /* agc1 has priority on agc2 */ 124 /* agc1 has priority on agc2 */
122 regs[R_EB1] &= ~0x01; 125 regs[R_EB1] &= ~0x01;
123 126
124 tda18271_write_regs(fe, R_EB1, 1); 127 ret = tda18271_write_regs(fe, R_EB1, 1);
128 if (tda_fail(ret))
129 goto fail;
125 130
126 /* --------------------------------------------------------------- */ 131 /* --------------------------------------------------------------- */
127 132
@@ -141,7 +146,9 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
141 break; 146 break;
142 } 147 }
143 148
144 tda18271_write_regs(fe, R_TM, 7); 149 ret = tda18271_write_regs(fe, R_TM, 7);
150 if (tda_fail(ret))
151 goto fail;
145 152
146 /* force charge pump source */ 153 /* force charge pump source */
147 charge_pump_source(fe, 1); 154 charge_pump_source(fe, 1);
@@ -158,9 +165,9 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
158 regs[R_EP3] &= ~0x04; 165 regs[R_EP3] &= ~0x04;
159 else 166 else
160 regs[R_EP3] |= 0x04; 167 regs[R_EP3] |= 0x04;
161 tda18271_write_regs(fe, R_EP3, 1); 168 ret = tda18271_write_regs(fe, R_EP3, 1);
162 169fail:
163 return 0; 170 return ret;
164} 171}
165 172
166static int tda18271_read_thermometer(struct dvb_frontend *fe) 173static int tda18271_read_thermometer(struct dvb_frontend *fe)
@@ -213,11 +220,13 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe,
213 struct tda18271_priv *priv = fe->tuner_priv; 220 struct tda18271_priv *priv = fe->tuner_priv;
214 struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state; 221 struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
215 unsigned char *regs = priv->tda18271_regs; 222 unsigned char *regs = priv->tda18271_regs;
216 int tm_current, rfcal_comp, approx, i; 223 int tm_current, rfcal_comp, approx, i, ret;
217 u8 dc_over_dt, rf_tab; 224 u8 dc_over_dt, rf_tab;
218 225
219 /* power up */ 226 /* power up */
220 tda18271_set_standby_mode(fe, 0, 0, 0); 227 ret = tda18271_set_standby_mode(fe, 0, 0, 0);
228 if (tda_fail(ret))
229 goto fail;
221 230
222 /* read die current temperature */ 231 /* read die current temperature */
223 tm_current = tda18271_read_thermometer(fe); 232 tm_current = tda18271_read_thermometer(fe);
@@ -228,8 +237,8 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe,
228 rf_tab = regs[R_EB14]; 237 rf_tab = regs[R_EB14];
229 238
230 i = tda18271_lookup_rf_band(fe, &freq, NULL); 239 i = tda18271_lookup_rf_band(fe, &freq, NULL);
231 if (i < 0) 240 if (tda_fail(i))
232 return -EINVAL; 241 return i;
233 242
234 if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) { 243 if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) {
235 approx = map[i].rf_a1 * 244 approx = map[i].rf_a1 *
@@ -250,35 +259,42 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe,
250 rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal); 259 rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal);
251 260
252 regs[R_EB14] = approx + rfcal_comp; 261 regs[R_EB14] = approx + rfcal_comp;
253 tda18271_write_regs(fe, R_EB14, 1); 262 ret = tda18271_write_regs(fe, R_EB14, 1);
254 263fail:
255 return 0; 264 return ret;
256} 265}
257 266
258static int tda18271_por(struct dvb_frontend *fe) 267static int tda18271_por(struct dvb_frontend *fe)
259{ 268{
260 struct tda18271_priv *priv = fe->tuner_priv; 269 struct tda18271_priv *priv = fe->tuner_priv;
261 unsigned char *regs = priv->tda18271_regs; 270 unsigned char *regs = priv->tda18271_regs;
271 int ret;
262 272
263 /* power up detector 1 */ 273 /* power up detector 1 */
264 regs[R_EB12] &= ~0x20; 274 regs[R_EB12] &= ~0x20;
265 tda18271_write_regs(fe, R_EB12, 1); 275 ret = tda18271_write_regs(fe, R_EB12, 1);
276 if (tda_fail(ret))
277 goto fail;
266 278
267 regs[R_EB18] &= ~0x80; /* turn agc1 loop on */ 279 regs[R_EB18] &= ~0x80; /* turn agc1 loop on */
268 regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */ 280 regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */
269 tda18271_write_regs(fe, R_EB18, 1); 281 ret = tda18271_write_regs(fe, R_EB18, 1);
282 if (tda_fail(ret))
283 goto fail;
270 284
271 regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */ 285 regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */
272 286
273 /* POR mode */ 287 /* POR mode */
274 tda18271_set_standby_mode(fe, 1, 0, 0); 288 ret = tda18271_set_standby_mode(fe, 1, 0, 0);
289 if (tda_fail(ret))
290 goto fail;
275 291
276 /* disable 1.5 MHz low pass filter */ 292 /* disable 1.5 MHz low pass filter */
277 regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */ 293 regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */
278 regs[R_EB23] &= ~0x02; /* XXX: lp_fc[2] = 0 */ 294 regs[R_EB23] &= ~0x02; /* XXX: lp_fc[2] = 0 */
279 tda18271_write_regs(fe, R_EB21, 3); 295 ret = tda18271_write_regs(fe, R_EB21, 3);
280 296fail:
281 return 0; 297 return ret;
282} 298}
283 299
284static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) 300static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
@@ -389,7 +405,7 @@ static int tda18271_powerscan(struct dvb_frontend *fe,
389{ 405{
390 struct tda18271_priv *priv = fe->tuner_priv; 406 struct tda18271_priv *priv = fe->tuner_priv;
391 unsigned char *regs = priv->tda18271_regs; 407 unsigned char *regs = priv->tda18271_regs;
392 int sgn, bcal, count, wait; 408 int sgn, bcal, count, wait, ret;
393 u8 cid_target; 409 u8 cid_target;
394 u16 count_limit; 410 u16 count_limit;
395 u32 freq; 411 u32 freq;
@@ -421,7 +437,9 @@ static int tda18271_powerscan(struct dvb_frontend *fe,
421 tda18271_write_regs(fe, R_EP2, 1); 437 tda18271_write_regs(fe, R_EP2, 1);
422 438
423 /* read power detection info, stored in EB10 */ 439 /* read power detection info, stored in EB10 */
424 tda18271_read_extended(fe); 440 ret = tda18271_read_extended(fe);
441 if (tda_fail(ret))
442 return ret;
425 443
426 /* algorithm initialization */ 444 /* algorithm initialization */
427 sgn = 1; 445 sgn = 1;
@@ -447,7 +465,9 @@ static int tda18271_powerscan(struct dvb_frontend *fe,
447 tda18271_write_regs(fe, R_EP2, 1); 465 tda18271_write_regs(fe, R_EP2, 1);
448 466
449 /* read power detection info, stored in EB10 */ 467 /* read power detection info, stored in EB10 */
450 tda18271_read_extended(fe); 468 ret = tda18271_read_extended(fe);
469 if (tda_fail(ret))
470 return ret;
451 471
452 count += 200; 472 count += 200;
453 473
@@ -478,6 +498,7 @@ static int tda18271_powerscan_init(struct dvb_frontend *fe)
478{ 498{
479 struct tda18271_priv *priv = fe->tuner_priv; 499 struct tda18271_priv *priv = fe->tuner_priv;
480 unsigned char *regs = priv->tda18271_regs; 500 unsigned char *regs = priv->tda18271_regs;
501 int ret;
481 502
482 /* set standard to digital */ 503 /* set standard to digital */
483 regs[R_EP3] &= ~0x1f; /* clear std bits */ 504 regs[R_EP3] &= ~0x1f; /* clear std bits */
@@ -489,10 +510,14 @@ static int tda18271_powerscan_init(struct dvb_frontend *fe)
489 /* update IF output level & IF notch frequency */ 510 /* update IF output level & IF notch frequency */
490 regs[R_EP4] &= ~0x1c; /* clear if level bits */ 511 regs[R_EP4] &= ~0x1c; /* clear if level bits */
491 512
492 tda18271_write_regs(fe, R_EP3, 2); 513 ret = tda18271_write_regs(fe, R_EP3, 2);
514 if (tda_fail(ret))
515 goto fail;
493 516
494 regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */ 517 regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */
495 tda18271_write_regs(fe, R_EB18, 1); 518 ret = tda18271_write_regs(fe, R_EB18, 1);
519 if (tda_fail(ret))
520 goto fail;
496 521
497 regs[R_EB21] &= ~0x03; /* set agc2_gain to -15 dB */ 522 regs[R_EB21] &= ~0x03; /* set agc2_gain to -15 dB */
498 523
@@ -500,9 +525,9 @@ static int tda18271_powerscan_init(struct dvb_frontend *fe)
500 regs[R_EB23] |= 0x04; /* forcelp_fc2_en = 1 */ 525 regs[R_EB23] |= 0x04; /* forcelp_fc2_en = 1 */
501 regs[R_EB23] |= 0x02; /* lp_fc[2] = 1 */ 526 regs[R_EB23] |= 0x02; /* lp_fc[2] = 1 */
502 527
503 tda18271_write_regs(fe, R_EB21, 3); 528 ret = tda18271_write_regs(fe, R_EB21, 3);
504 529fail:
505 return 0; 530 return ret;
506} 531}
507 532
508static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) 533static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
@@ -521,7 +546,7 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
521 546
522 i = tda18271_lookup_rf_band(fe, &freq, NULL); 547 i = tda18271_lookup_rf_band(fe, &freq, NULL);
523 548
524 if (i < 0) 549 if (tda_fail(i))
525 return i; 550 return i;
526 551
527 rf_default[RF1] = 1000 * map[i].rf1_def; 552 rf_default[RF1] = 1000 * map[i].rf1_def;
@@ -535,6 +560,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
535 560
536 /* look for optimized calibration frequency */ 561 /* look for optimized calibration frequency */
537 bcal = tda18271_powerscan(fe, &rf_default[rf], &rf_freq[rf]); 562 bcal = tda18271_powerscan(fe, &rf_default[rf], &rf_freq[rf]);
563 if (tda_fail(bcal))
564 return bcal;
538 565
539 tda18271_calc_rf_cal(fe, &rf_freq[rf]); 566 tda18271_calc_rf_cal(fe, &rf_freq[rf]);
540 prog_tab[rf] = regs[R_EB14]; 567 prog_tab[rf] = regs[R_EB14];
@@ -575,22 +602,29 @@ static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe)
575{ 602{
576 struct tda18271_priv *priv = fe->tuner_priv; 603 struct tda18271_priv *priv = fe->tuner_priv;
577 unsigned int i; 604 unsigned int i;
605 int ret;
578 606
579 tda_info("tda18271: performing RF tracking filter calibration\n"); 607 tda_info("tda18271: performing RF tracking filter calibration\n");
580 608
581 /* wait for die temperature stabilization */ 609 /* wait for die temperature stabilization */
582 msleep(200); 610 msleep(200);
583 611
584 tda18271_powerscan_init(fe); 612 ret = tda18271_powerscan_init(fe);
613 if (tda_fail(ret))
614 goto fail;
585 615
586 /* rf band calibration */ 616 /* rf band calibration */
587 for (i = 0; priv->rf_cal_state[i].rfmax != 0; i++) 617 for (i = 0; priv->rf_cal_state[i].rfmax != 0; i++) {
618 ret =
588 tda18271_rf_tracking_filters_init(fe, 1000 * 619 tda18271_rf_tracking_filters_init(fe, 1000 *
589 priv->rf_cal_state[i].rfmax); 620 priv->rf_cal_state[i].rfmax);
621 if (tda_fail(ret))
622 goto fail;
623 }
590 624
591 priv->tm_rfcal = tda18271_read_thermometer(fe); 625 priv->tm_rfcal = tda18271_read_thermometer(fe);
592 626fail:
593 return 0; 627 return ret;
594} 628}
595 629
596/* ------------------------------------------------------------------ */ 630/* ------------------------------------------------------------------ */
@@ -599,6 +633,7 @@ static int tda18271c2_rf_cal_init(struct dvb_frontend *fe)
599{ 633{
600 struct tda18271_priv *priv = fe->tuner_priv; 634 struct tda18271_priv *priv = fe->tuner_priv;
601 unsigned char *regs = priv->tda18271_regs; 635 unsigned char *regs = priv->tda18271_regs;
636 int ret;
602 637
603 /* test RF_CAL_OK to see if we need init */ 638 /* test RF_CAL_OK to see if we need init */
604 if ((regs[R_EP1] & 0x10) == 0) 639 if ((regs[R_EP1] & 0x10) == 0)
@@ -607,15 +642,22 @@ static int tda18271c2_rf_cal_init(struct dvb_frontend *fe)
607 if (priv->cal_initialized) 642 if (priv->cal_initialized)
608 return 0; 643 return 0;
609 644
610 tda18271_calc_rf_filter_curve(fe); 645 ret = tda18271_calc_rf_filter_curve(fe);
646 if (tda_fail(ret))
647 goto fail;
611 648
612 tda18271_por(fe); 649 ret = tda18271_por(fe);
650 if (tda_fail(ret))
651 goto fail;
613 652
614 tda_info("tda18271: RF tracking filter calibration complete\n"); 653 tda_info("tda18271: RF tracking filter calibration complete\n");
615 654
616 priv->cal_initialized = true; 655 priv->cal_initialized = true;
617 656 goto end;
618 return 0; 657fail:
658 tda_info("tda18271: RF tracking filter calibration failed!\n");
659end:
660 return ret;
619} 661}
620 662
621static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe, 663static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe,
@@ -623,6 +665,7 @@ static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe,
623{ 665{
624 struct tda18271_priv *priv = fe->tuner_priv; 666 struct tda18271_priv *priv = fe->tuner_priv;
625 unsigned char *regs = priv->tda18271_regs; 667 unsigned char *regs = priv->tda18271_regs;
668 int ret;
626 u32 N = 0; 669 u32 N = 0;
627 670
628 /* calculate bp filter */ 671 /* calculate bp filter */
@@ -671,7 +714,10 @@ static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe,
671 714
672 tda18271_calc_main_pll(fe, N); 715 tda18271_calc_main_pll(fe, N);
673 716
674 tda18271_write_regs(fe, R_EP3, 11); 717 ret = tda18271_write_regs(fe, R_EP3, 11);
718 if (tda_fail(ret))
719 return ret;
720
675 msleep(5); /* RF tracking filter calibration initialization */ 721 msleep(5); /* RF tracking filter calibration initialization */
676 722
677 /* search for K,M,CO for RF calibration */ 723 /* search for K,M,CO for RF calibration */
@@ -719,45 +765,56 @@ static int tda18271_ir_cal_init(struct dvb_frontend *fe)
719{ 765{
720 struct tda18271_priv *priv = fe->tuner_priv; 766 struct tda18271_priv *priv = fe->tuner_priv;
721 unsigned char *regs = priv->tda18271_regs; 767 unsigned char *regs = priv->tda18271_regs;
768 int ret;
722 769
723 tda18271_read_regs(fe); 770 ret = tda18271_read_regs(fe);
771 if (tda_fail(ret))
772 goto fail;
724 773
725 /* test IR_CAL_OK to see if we need init */ 774 /* test IR_CAL_OK to see if we need init */
726 if ((regs[R_EP1] & 0x08) == 0) 775 if ((regs[R_EP1] & 0x08) == 0)
727 tda18271_init_regs(fe); 776 ret = tda18271_init_regs(fe);
728 777fail:
729 return 0; 778 return ret;
730} 779}
731 780
732static int tda18271_init(struct dvb_frontend *fe) 781static int tda18271_init(struct dvb_frontend *fe)
733{ 782{
734 struct tda18271_priv *priv = fe->tuner_priv; 783 struct tda18271_priv *priv = fe->tuner_priv;
784 int ret;
735 785
736 mutex_lock(&priv->lock); 786 mutex_lock(&priv->lock);
737 787
738 /* power up */ 788 /* power up */
739 tda18271_set_standby_mode(fe, 0, 0, 0); 789 ret = tda18271_set_standby_mode(fe, 0, 0, 0);
790 if (tda_fail(ret))
791 goto fail;
740 792
741 /* initialization */ 793 /* initialization */
742 tda18271_ir_cal_init(fe); 794 ret = tda18271_ir_cal_init(fe);
795 if (tda_fail(ret))
796 goto fail;
743 797
744 if (priv->id == TDA18271HDC2) 798 if (priv->id == TDA18271HDC2)
745 tda18271c2_rf_cal_init(fe); 799 tda18271c2_rf_cal_init(fe);
746 800fail:
747 mutex_unlock(&priv->lock); 801 mutex_unlock(&priv->lock);
748 802
749 return 0; 803 return ret;
750} 804}
751 805
752static int tda18271_tune(struct dvb_frontend *fe, 806static int tda18271_tune(struct dvb_frontend *fe,
753 struct tda18271_std_map_item *map, u32 freq, u32 bw) 807 struct tda18271_std_map_item *map, u32 freq, u32 bw)
754{ 808{
755 struct tda18271_priv *priv = fe->tuner_priv; 809 struct tda18271_priv *priv = fe->tuner_priv;
810 int ret;
756 811
757 tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", 812 tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
758 freq, map->if_freq, bw, map->agc_mode, map->std); 813 freq, map->if_freq, bw, map->agc_mode, map->std);
759 814
760 tda18271_init(fe); 815 ret = tda18271_init(fe);
816 if (tda_fail(ret))
817 goto fail;
761 818
762 mutex_lock(&priv->lock); 819 mutex_lock(&priv->lock);
763 820
@@ -769,11 +826,11 @@ static int tda18271_tune(struct dvb_frontend *fe,
769 tda18271c2_rf_tracking_filters_correction(fe, freq); 826 tda18271c2_rf_tracking_filters_correction(fe, freq);
770 break; 827 break;
771 } 828 }
772 tda18271_channel_configuration(fe, map, freq, bw); 829 ret = tda18271_channel_configuration(fe, map, freq, bw);
773 830
774 mutex_unlock(&priv->lock); 831 mutex_unlock(&priv->lock);
775 832fail:
776 return 0; 833 return ret;
777} 834}
778 835
779/* ------------------------------------------------------------------ */ 836/* ------------------------------------------------------------------ */
@@ -837,7 +894,7 @@ static int tda18271_set_params(struct dvb_frontend *fe,
837 894
838 ret = tda18271_tune(fe, map, freq, bw); 895 ret = tda18271_tune(fe, map, freq, bw);
839 896
840 if (ret < 0) 897 if (tda_fail(ret))
841 goto fail; 898 goto fail;
842 899
843 priv->frequency = freq; 900 priv->frequency = freq;
@@ -893,7 +950,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
893 950
894 ret = tda18271_tune(fe, map, freq, 0); 951 ret = tda18271_tune(fe, map, freq, 0);
895 952
896 if (ret < 0) 953 if (tda_fail(ret))
897 goto fail; 954 goto fail;
898 955
899 priv->frequency = freq; 956 priv->frequency = freq;
@@ -905,16 +962,17 @@ fail:
905static int tda18271_sleep(struct dvb_frontend *fe) 962static int tda18271_sleep(struct dvb_frontend *fe)
906{ 963{
907 struct tda18271_priv *priv = fe->tuner_priv; 964 struct tda18271_priv *priv = fe->tuner_priv;
965 int ret;
908 966
909 mutex_lock(&priv->lock); 967 mutex_lock(&priv->lock);
910 968
911 /* standby mode w/ slave tuner output 969 /* standby mode w/ slave tuner output
912 * & loop thru & xtal oscillator on */ 970 * & loop thru & xtal oscillator on */
913 tda18271_set_standby_mode(fe, 1, 0, 0); 971 ret = tda18271_set_standby_mode(fe, 1, 0, 0);
914 972
915 mutex_unlock(&priv->lock); 973 mutex_unlock(&priv->lock);
916 974
917 return 0; 975 return ret;
918} 976}
919 977
920static int tda18271_release(struct dvb_frontend *fe) 978static int tda18271_release(struct dvb_frontend *fe)
@@ -1095,10 +1153,10 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1095 if (cfg) 1153 if (cfg)
1096 priv->small_i2c = cfg->small_i2c; 1154 priv->small_i2c = cfg->small_i2c;
1097 1155
1098 if (tda18271_get_id(fe) < 0) 1156 if (tda_fail(tda18271_get_id(fe)))
1099 goto fail; 1157 goto fail;
1100 1158
1101 if (tda18271_assign_map_layout(fe) < 0) 1159 if (tda_fail(tda18271_assign_map_layout(fe)))
1102 goto fail; 1160 goto fail;
1103 1161
1104 mutex_lock(&priv->lock); 1162 mutex_lock(&priv->lock);
diff --git a/drivers/media/common/tuners/tda18271-priv.h b/drivers/media/common/tuners/tda18271-priv.h
index 2bc5eb368ea2..81a739365f8c 100644
--- a/drivers/media/common/tuners/tda18271-priv.h
+++ b/drivers/media/common/tuners/tda18271-priv.h
@@ -153,6 +153,15 @@ extern int tda18271_debug;
153#define tda_reg(fmt, arg...) dprintk(KERN_DEBUG, DBG_REG, fmt, ##arg) 153#define tda_reg(fmt, arg...) dprintk(KERN_DEBUG, DBG_REG, fmt, ##arg)
154#define tda_cal(fmt, arg...) dprintk(KERN_DEBUG, DBG_CAL, fmt, ##arg) 154#define tda_cal(fmt, arg...) dprintk(KERN_DEBUG, DBG_CAL, fmt, ##arg)
155 155
156#define tda_fail(ret) \
157({ \
158 int __ret; \
159 __ret = (ret < 0); \
160 if (__ret) \
161 tda_printk(KERN_ERR, "error %d on line %d\n", ret, __LINE__);\
162 __ret; \
163})
164
156/*---------------------------------------------------------------------*/ 165/*---------------------------------------------------------------------*/
157 166
158enum tda18271_map_type { 167enum tda18271_map_type {
diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c
index d30d2c9094d9..8555d9cf9051 100644
--- a/drivers/media/common/tuners/tda827x.c
+++ b/drivers/media/common/tuners/tda827x.c
@@ -418,13 +418,13 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
418 unsigned char buf[] = {0x22, 0x01}; 418 unsigned char buf[] = {0x22, 0x01};
419 int arg; 419 int arg;
420 int gp_func; 420 int gp_func;
421 struct i2c_msg msg = { .addr = priv->cfg->switch_addr, .flags = 0, 421 struct i2c_msg msg = { .flags = 0, .buf = buf, .len = sizeof(buf) };
422 .buf = buf, .len = sizeof(buf) };
423 422
424 if (NULL == priv->cfg) { 423 if (NULL == priv->cfg) {
425 dprintk("tda827x_config not defined, cannot set LNA gain!\n"); 424 dprintk("tda827x_config not defined, cannot set LNA gain!\n");
426 return; 425 return;
427 } 426 }
427 msg.addr = priv->cfg->switch_addr;
428 if (priv->cfg->config) { 428 if (priv->cfg->config) {
429 if (high) 429 if (high)
430 dprintk("setting LNA to high gain\n"); 430 dprintk("setting LNA to high gain\n");
diff --git a/drivers/media/common/tuners/tea5761.c b/drivers/media/common/tuners/tea5761.c
index b93cdef9ac73..b23dadeecd05 100644
--- a/drivers/media/common/tuners/tea5761.c
+++ b/drivers/media/common/tuners/tea5761.c
@@ -295,7 +295,7 @@ struct dvb_frontend *tea5761_attach(struct dvb_frontend *fe,
295{ 295{
296 struct tea5761_priv *priv = NULL; 296 struct tea5761_priv *priv = NULL;
297 297
298 if (tea5761_autodetection(i2c_adap, i2c_addr) == EINVAL) 298 if (tea5761_autodetection(i2c_adap, i2c_addr) != 0)
299 return NULL; 299 return NULL;
300 300
301 priv = kzalloc(sizeof(struct tea5761_priv), GFP_KERNEL); 301 priv = kzalloc(sizeof(struct tea5761_priv), GFP_KERNEL);
diff --git a/drivers/media/common/tuners/tea5767.c b/drivers/media/common/tuners/tea5767.c
index f6e7d7ad8424..1f5646334a8f 100644
--- a/drivers/media/common/tuners/tea5767.c
+++ b/drivers/media/common/tuners/tea5767.c
@@ -373,14 +373,14 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
373 373
374 if ((rc = tuner_i2c_xfer_recv(&i2c, buffer, 7))< 5) { 374 if ((rc = tuner_i2c_xfer_recv(&i2c, buffer, 7))< 5) {
375 printk(KERN_WARNING "It is not a TEA5767. Received %i bytes.\n", rc); 375 printk(KERN_WARNING "It is not a TEA5767. Received %i bytes.\n", rc);
376 return EINVAL; 376 return -EINVAL;
377 } 377 }
378 378
379 /* If all bytes are the same then it's a TV tuner and not a tea5767 */ 379 /* If all bytes are the same then it's a TV tuner and not a tea5767 */
380 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && 380 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
381 buffer[0] == buffer[3] && buffer[0] == buffer[4]) { 381 buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
382 printk(KERN_WARNING "All bytes are equal. It is not a TEA5767\n"); 382 printk(KERN_WARNING "All bytes are equal. It is not a TEA5767\n");
383 return EINVAL; 383 return -EINVAL;
384 } 384 }
385 385
386 /* Status bytes: 386 /* Status bytes:
@@ -390,7 +390,7 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
390 */ 390 */
391 if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) { 391 if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) {
392 printk(KERN_WARNING "Chip ID is not zero. It is not a TEA5767\n"); 392 printk(KERN_WARNING "Chip ID is not zero. It is not a TEA5767\n");
393 return EINVAL; 393 return -EINVAL;
394 } 394 }
395 395
396 396
diff --git a/drivers/media/common/tuners/tuner-i2c.h b/drivers/media/common/tuners/tuner-i2c.h
index 3ad6c8e0b04c..cb1c7141f0c6 100644
--- a/drivers/media/common/tuners/tuner-i2c.h
+++ b/drivers/media/common/tuners/tuner-i2c.h
@@ -170,4 +170,12 @@ __fail: \
170 __ret; \ 170 __ret; \
171}) 171})
172 172
173#define hybrid_tuner_report_instance_count(state) \
174({ \
175 int __ret = 0; \
176 if (state) \
177 __ret = state->i2c_props.count; \
178 __ret; \
179})
180
173#endif /* __TUNER_I2C_H__ */ 181#endif /* __TUNER_I2C_H__ */
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c
index be8d903171b7..266c255cf0d8 100644
--- a/drivers/media/common/tuners/tuner-simple.c
+++ b/drivers/media/common/tuners/tuner-simple.c
@@ -1018,8 +1018,10 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
1018 fe->ops.i2c_gate_ctrl(fe, 1); 1018 fe->ops.i2c_gate_ctrl(fe, 1);
1019 1019
1020 if (1 != i2c_transfer(i2c_adap, &msg, 1)) 1020 if (1 != i2c_transfer(i2c_adap, &msg, 1))
1021 tuner_warn("unable to probe %s, proceeding anyway.", 1021 printk(KERN_WARNING "tuner-simple %d-%04x: "
1022 tuners[type].name); 1022 "unable to probe %s, proceeding anyway.",
1023 i2c_adapter_id(i2c_adap), i2c_addr,
1024 tuners[type].name);
1023 1025
1024 if (fe->ops.i2c_gate_ctrl) 1026 if (fe->ops.i2c_gate_ctrl)
1025 fe->ops.i2c_gate_ctrl(fe, 0); 1027 fe->ops.i2c_gate_ctrl(fe, 0);
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index 9e9003cffc7f..0cbde17bfbb7 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -46,7 +46,7 @@ module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0);
46MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the " 46MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the "
47 "default firmware name\n"); 47 "default firmware name\n");
48 48
49static LIST_HEAD(xc2028_list); 49static LIST_HEAD(hybrid_tuner_instance_list);
50static DEFINE_MUTEX(xc2028_list_mutex); 50static DEFINE_MUTEX(xc2028_list_mutex);
51 51
52/* struct for storing firmware table */ 52/* struct for storing firmware table */
@@ -68,12 +68,11 @@ struct firmware_properties {
68}; 68};
69 69
70struct xc2028_data { 70struct xc2028_data {
71 struct list_head xc2028_list; 71 struct list_head hybrid_tuner_instance_list;
72 struct tuner_i2c_props i2c_props; 72 struct tuner_i2c_props i2c_props;
73 int (*tuner_callback) (void *dev, 73 int (*tuner_callback) (void *dev,
74 int command, int arg); 74 int command, int arg);
75 void *video_dev; 75 void *video_dev;
76 int count;
77 __u32 frequency; 76 __u32 frequency;
78 77
79 struct firmware_description *firm; 78 struct firmware_description *firm;
@@ -1072,20 +1071,19 @@ static int xc2028_dvb_release(struct dvb_frontend *fe)
1072 1071
1073 mutex_lock(&xc2028_list_mutex); 1072 mutex_lock(&xc2028_list_mutex);
1074 1073
1075 priv->count--; 1074 /* only perform final cleanup if this is the last instance */
1076 1075 if (hybrid_tuner_report_instance_count(priv) == 1) {
1077 if (!priv->count) {
1078 list_del(&priv->xc2028_list);
1079
1080 kfree(priv->ctrl.fname); 1076 kfree(priv->ctrl.fname);
1081
1082 free_firmware(priv); 1077 free_firmware(priv);
1083 kfree(priv);
1084 fe->tuner_priv = NULL;
1085 } 1078 }
1086 1079
1080 if (priv)
1081 hybrid_tuner_release_state(priv);
1082
1087 mutex_unlock(&xc2028_list_mutex); 1083 mutex_unlock(&xc2028_list_mutex);
1088 1084
1085 fe->tuner_priv = NULL;
1086
1089 return 0; 1087 return 0;
1090} 1088}
1091 1089
@@ -1150,7 +1148,7 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1150 struct xc2028_config *cfg) 1148 struct xc2028_config *cfg)
1151{ 1149{
1152 struct xc2028_data *priv; 1150 struct xc2028_data *priv;
1153 void *video_dev; 1151 int instance;
1154 1152
1155 if (debug) 1153 if (debug)
1156 printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n"); 1154 printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n");
@@ -1163,48 +1161,40 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1163 return NULL; 1161 return NULL;
1164 } 1162 }
1165 1163
1166 video_dev = cfg->i2c_adap->algo_data;
1167
1168 if (debug)
1169 printk(KERN_DEBUG "xc2028: video_dev =%p\n", video_dev);
1170
1171 mutex_lock(&xc2028_list_mutex); 1164 mutex_lock(&xc2028_list_mutex);
1172 1165
1173 list_for_each_entry(priv, &xc2028_list, xc2028_list) { 1166 instance = hybrid_tuner_request_state(struct xc2028_data, priv,
1174 if (&priv->i2c_props.adap->dev == &cfg->i2c_adap->dev) { 1167 hybrid_tuner_instance_list,
1175 video_dev = NULL; 1168 cfg->i2c_adap, cfg->i2c_addr,
1176 if (debug) 1169 "xc2028");
1177 printk(KERN_DEBUG "xc2028: reusing device\n"); 1170 switch (instance) {
1178 1171 case 0:
1179 break; 1172 /* memory allocation failure */
1180 } 1173 goto fail;
1181 } 1174 break;
1182 1175 case 1:
1183 if (video_dev) { 1176 /* new tuner instance */
1184 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1185 if (priv == NULL) {
1186 mutex_unlock(&xc2028_list_mutex);
1187 return NULL;
1188 }
1189
1190 priv->i2c_props.addr = cfg->i2c_addr;
1191 priv->i2c_props.adap = cfg->i2c_adap;
1192 priv->i2c_props.name = "xc2028";
1193
1194 priv->video_dev = video_dev;
1195 priv->tuner_callback = cfg->callback; 1177 priv->tuner_callback = cfg->callback;
1196 priv->ctrl.max_len = 13; 1178 priv->ctrl.max_len = 13;
1197 1179
1198 mutex_init(&priv->lock); 1180 mutex_init(&priv->lock);
1199 1181
1200 list_add_tail(&priv->xc2028_list, &xc2028_list); 1182 /* analog side (tuner-core) uses i2c_adap->algo_data.
1201 } 1183 * digital side is not guaranteed to have algo_data defined.
1202 1184 *
1203 fe->tuner_priv = priv; 1185 * digital side will always have fe->dvb defined.
1204 priv->count++; 1186 * analog side (tuner-core) doesn't (yet) define fe->dvb.
1187 */
1188 priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ?
1189 fe->dvb->priv : cfg->i2c_adap->algo_data;
1205 1190
1206 if (debug) 1191 fe->tuner_priv = priv;
1207 printk(KERN_DEBUG "xc2028: usage count is %i\n", priv->count); 1192 break;
1193 case 2:
1194 /* existing tuner instance */
1195 fe->tuner_priv = priv;
1196 break;
1197 }
1208 1198
1209 memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops, 1199 memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
1210 sizeof(xc2028_dvb_tuner_ops)); 1200 sizeof(xc2028_dvb_tuner_ops));
@@ -1217,6 +1207,11 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1217 mutex_unlock(&xc2028_list_mutex); 1207 mutex_unlock(&xc2028_list_mutex);
1218 1208
1219 return fe; 1209 return fe;
1210fail:
1211 mutex_unlock(&xc2028_list_mutex);
1212
1213 xc2028_dvb_release(fe);
1214 return NULL;
1220} 1215}
1221 1216
1222EXPORT_SYMBOL(xc2028_attach); 1217EXPORT_SYMBOL(xc2028_attach);
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 43d35bdb221f..ceae6db901ec 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -212,7 +212,7 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)
212 dprintk(1, "%s()\n", __func__); 212 dprintk(1, "%s()\n", __func__);
213 213
214 if (priv->cfg->tuner_callback) { 214 if (priv->cfg->tuner_callback) {
215 ret = priv->cfg->tuner_callback(priv->cfg->priv, 215 ret = priv->cfg->tuner_callback(priv->devptr,
216 XC5000_TUNER_RESET, 0); 216 XC5000_TUNER_RESET, 0);
217 if (ret) 217 if (ret)
218 printk(KERN_ERR "xc5000: reset failed\n"); 218 printk(KERN_ERR "xc5000: reset failed\n");
@@ -900,9 +900,9 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = {
900 .get_status = xc5000_get_status 900 .get_status = xc5000_get_status
901}; 901};
902 902
903struct dvb_frontend * xc5000_attach(struct dvb_frontend *fe, 903struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
904 struct i2c_adapter *i2c, 904 struct i2c_adapter *i2c,
905 struct xc5000_config *cfg) 905 struct xc5000_config *cfg, void *devptr)
906{ 906{
907 struct xc5000_priv *priv = NULL; 907 struct xc5000_priv *priv = NULL;
908 u16 id = 0; 908 u16 id = 0;
@@ -916,6 +916,7 @@ struct dvb_frontend * xc5000_attach(struct dvb_frontend *fe,
916 priv->cfg = cfg; 916 priv->cfg = cfg;
917 priv->bandwidth = BANDWIDTH_6_MHZ; 917 priv->bandwidth = BANDWIDTH_6_MHZ;
918 priv->i2c = i2c; 918 priv->i2c = i2c;
919 priv->devptr = devptr;
919 920
920 /* Check if firmware has been loaded. It is possible that another 921 /* Check if firmware has been loaded. It is possible that another
921 instance of the driver has loaded the firmware. 922 instance of the driver has loaded the firmware.
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index 0ee80f9d19b8..c910715addc9 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -31,29 +31,31 @@ struct xc5000_config {
31 u8 i2c_address; 31 u8 i2c_address;
32 u32 if_khz; 32 u32 if_khz;
33 33
34 /* For each bridge framework, when it attaches either analog or digital,
35 * it has to store a reference back to its _core equivalent structure,
36 * so that it can service the hardware by steering gpio's etc.
37 * Each bridge implementation is different so cast priv accordingly.
38 * The xc5000 driver cares not for this value, other than ensuring
39 * it's passed back to a bridge during tuner_callback().
40 */
41 void *priv;
42 int (*tuner_callback) (void *priv, int command, int arg); 34 int (*tuner_callback) (void *priv, int command, int arg);
43}; 35};
44 36
45/* xc5000 callback command */ 37/* xc5000 callback command */
46#define XC5000_TUNER_RESET 0 38#define XC5000_TUNER_RESET 0
47 39
40/* For each bridge framework, when it attaches either analog or digital,
41 * it has to store a reference back to its _core equivalent structure,
42 * so that it can service the hardware by steering gpio's etc.
43 * Each bridge implementation is different so cast devptr accordingly.
44 * The xc5000 driver cares not for this value, other than ensuring
45 * it's passed back to a bridge during tuner_callback().
46 */
47
48#if defined(CONFIG_MEDIA_TUNER_XC5000) || \ 48#if defined(CONFIG_MEDIA_TUNER_XC5000) || \
49 (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) 49 (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE))
50extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, 50extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
51 struct i2c_adapter *i2c, 51 struct i2c_adapter *i2c,
52 struct xc5000_config *cfg); 52 struct xc5000_config *cfg,
53 void *devptr);
53#else 54#else
54static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, 55static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
55 struct i2c_adapter *i2c, 56 struct i2c_adapter *i2c,
56 struct xc5000_config *cfg) 57 struct xc5000_config *cfg,
58 void *devptr)
57{ 59{
58 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 60 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
59 return NULL; 61 return NULL;
diff --git a/drivers/media/common/tuners/xc5000_priv.h b/drivers/media/common/tuners/xc5000_priv.h
index 13b2d19341da..ecebfe4745ad 100644
--- a/drivers/media/common/tuners/xc5000_priv.h
+++ b/drivers/media/common/tuners/xc5000_priv.h
@@ -31,6 +31,8 @@ struct xc5000_priv {
31 u8 video_standard; 31 u8 video_standard;
32 u8 rf_mode; 32 u8 rf_mode;
33 u8 fwloaded; 33 u8 fwloaded;
34
35 void *devptr;
34}; 36};
35 37
36#endif 38#endif
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index 7b0ea3bdfafb..f9d087669d5d 100644
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -634,7 +634,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
634 } 634 }
635 635
636 /* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */ 636 /* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */
637 fc->fe = dvb_attach(vp310_mt312_attach, 637 fc->fe = dvb_attach(mt312_attach,
638 &skystar23_samsung_tbdu18132_config, i2c); 638 &skystar23_samsung_tbdu18132_config, i2c);
639 if (fc->fe != NULL) { 639 if (fc->fe != NULL) {
640 ops = &fc->fe->ops; 640 ops = &fc->fe->ops;
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c
index 449fb5c3d0b1..ae0d76a5d51d 100644
--- a/drivers/media/dvb/b2c2/flexcop-usb.c
+++ b/drivers/media/dvb/b2c2/flexcop-usb.c
@@ -379,7 +379,7 @@ static void flexcop_usb_transfer_exit(struct flexcop_usb *fc_usb)
379 379
380static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) 380static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
381{ 381{
382 u16 frame_size = fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize; 382 u16 frame_size = le16_to_cpu(fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize);
383 int bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO * frame_size,i,j,ret; 383 int bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO * frame_size,i,j,ret;
384 int buffer_offset = 0; 384 int buffer_offset = 0;
385 385
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig
index d1239b8342f8..7588db1319d0 100644
--- a/drivers/media/dvb/bt8xx/Kconfig
+++ b/drivers/media/dvb/bt8xx/Kconfig
@@ -1,6 +1,7 @@
1config DVB_BT8XX 1config DVB_BT8XX
2 tristate "BT8xx based PCI cards" 2 tristate "BT8xx based PCI cards"
3 depends on DVB_CORE && PCI && I2C && VIDEO_BT848 3 depends on DVB_CORE && PCI && I2C && VIDEO_BT848
4 depends on HOTPLUG # due to FW_LOADER
4 select DVB_MT352 if !DVB_FE_CUSTOMISE 5 select DVB_MT352 if !DVB_FE_CUSTOMISE
5 select DVB_SP887X if !DVB_FE_CUSTOMISE 6 select DVB_SP887X if !DVB_FE_CUSTOMISE
6 select DVB_NXT6000 if !DVB_FE_CUSTOMISE 7 select DVB_NXT6000 if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/dvb/cinergyT2/Kconfig b/drivers/media/dvb/cinergyT2/Kconfig
index 3d778c5aba68..c03513b2ccae 100644
--- a/drivers/media/dvb/cinergyT2/Kconfig
+++ b/drivers/media/dvb/cinergyT2/Kconfig
@@ -1,6 +1,6 @@
1config DVB_CINERGYT2 1config DVB_CINERGYT2
2 tristate "Terratec CinergyT2/qanu USB2 DVB-T receiver" 2 tristate "Terratec CinergyT2/qanu USB2 DVB-T receiver"
3 depends on DVB_CORE && USB 3 depends on DVB_CORE && USB && INPUT
4 help 4 help
5 Support for "TerraTec CinergyT2" USB2.0 Highspeed DVB Receivers 5 Support for "TerraTec CinergyT2" USB2.0 Highspeed DVB Receivers
6 6
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index f5010e8671b8..a824f3719f81 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -82,22 +82,22 @@ enum cinergyt2_ep1_cmd {
82 82
83struct dvbt_set_parameters_msg { 83struct dvbt_set_parameters_msg {
84 uint8_t cmd; 84 uint8_t cmd;
85 uint32_t freq; 85 __le32 freq;
86 uint8_t bandwidth; 86 uint8_t bandwidth;
87 uint16_t tps; 87 __le16 tps;
88 uint8_t flags; 88 uint8_t flags;
89} __attribute__((packed)); 89} __attribute__((packed));
90 90
91struct dvbt_get_status_msg { 91struct dvbt_get_status_msg {
92 uint32_t freq; 92 __le32 freq;
93 uint8_t bandwidth; 93 uint8_t bandwidth;
94 uint16_t tps; 94 __le16 tps;
95 uint8_t flags; 95 uint8_t flags;
96 uint16_t gain; 96 __le16 gain;
97 uint8_t snr; 97 uint8_t snr;
98 uint32_t viterbi_error_rate; 98 __le32 viterbi_error_rate;
99 uint32_t rs_error_rate; 99 __le32 rs_error_rate;
100 uint32_t uncorrected_block_count; 100 __le32 uncorrected_block_count;
101 uint8_t lock_bits; 101 uint8_t lock_bits;
102 uint8_t prev_lock_bits; 102 uint8_t prev_lock_bits;
103} __attribute__((packed)); 103} __attribute__((packed));
@@ -136,6 +136,7 @@ struct cinergyt2 {
136 wait_queue_head_t poll_wq; 136 wait_queue_head_t poll_wq;
137 int pending_fe_events; 137 int pending_fe_events;
138 int disconnect_pending; 138 int disconnect_pending;
139 unsigned int uncorrected_block_count;
139 atomic_t inuse; 140 atomic_t inuse;
140 141
141 void *streambuf; 142 void *streambuf;
@@ -147,7 +148,7 @@ struct cinergyt2 {
147 char phys[64]; 148 char phys[64];
148 struct delayed_work rc_query_work; 149 struct delayed_work rc_query_work;
149 int rc_input_event; 150 int rc_input_event;
150 u32 rc_last_code; 151 __le32 rc_last_code;
151 unsigned long last_event_jiffies; 152 unsigned long last_event_jiffies;
152#endif 153#endif
153}; 154};
@@ -160,7 +161,7 @@ enum {
160 161
161struct cinergyt2_rc_event { 162struct cinergyt2_rc_event {
162 char type; 163 char type;
163 uint32_t value; 164 __le32 value;
164} __attribute__((packed)); 165} __attribute__((packed));
165 166
166static const uint32_t rc_keys[] = { 167static const uint32_t rc_keys[] = {
@@ -619,8 +620,11 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file,
619 { 620 {
620 uint32_t unc_count; 621 uint32_t unc_count;
621 622
622 unc_count = stat->uncorrected_block_count; 623 if (mutex_lock_interruptible(&cinergyt2->sem))
623 stat->uncorrected_block_count = 0; 624 return -ERESTARTSYS;
625 unc_count = cinergyt2->uncorrected_block_count;
626 cinergyt2->uncorrected_block_count = 0;
627 mutex_unlock(&cinergyt2->sem);
624 628
625 /* UNC are already converted to host byte order... */ 629 /* UNC are already converted to host byte order... */
626 return put_user(unc_count,(__u32 __user *) arg); 630 return put_user(unc_count,(__u32 __user *) arg);
@@ -769,7 +773,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
769 input_sync(cinergyt2->rc_input_dev); 773 input_sync(cinergyt2->rc_input_dev);
770 cinergyt2->rc_input_event = KEY_MAX; 774 cinergyt2->rc_input_event = KEY_MAX;
771 } 775 }
772 cinergyt2->rc_last_code = ~0; 776 cinergyt2->rc_last_code = cpu_to_le32(~0);
773 } 777 }
774 goto out; 778 goto out;
775 } 779 }
@@ -780,7 +784,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
780 n, le32_to_cpu(rc_events[n].value), rc_events[n].type); 784 n, le32_to_cpu(rc_events[n].value), rc_events[n].type);
781 785
782 if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC && 786 if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC &&
783 rc_events[n].value == ~0) { 787 rc_events[n].value == cpu_to_le32(~0)) {
784 /* keyrepeat bit -> just repeat last rc_input_event */ 788 /* keyrepeat bit -> just repeat last rc_input_event */
785 } else { 789 } else {
786 cinergyt2->rc_input_event = KEY_MAX; 790 cinergyt2->rc_input_event = KEY_MAX;
@@ -795,7 +799,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
795 799
796 if (cinergyt2->rc_input_event != KEY_MAX) { 800 if (cinergyt2->rc_input_event != KEY_MAX) {
797 if (rc_events[n].value == cinergyt2->rc_last_code && 801 if (rc_events[n].value == cinergyt2->rc_last_code &&
798 cinergyt2->rc_last_code != ~0) { 802 cinergyt2->rc_last_code != cpu_to_le32(~0)) {
799 /* emit a key-up so the double event is recognized */ 803 /* emit a key-up so the double event is recognized */
800 dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event); 804 dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event);
801 input_report_key(cinergyt2->rc_input_dev, 805 input_report_key(cinergyt2->rc_input_dev,
@@ -829,7 +833,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
829 usb_make_path(cinergyt2->udev, cinergyt2->phys, sizeof(cinergyt2->phys)); 833 usb_make_path(cinergyt2->udev, cinergyt2->phys, sizeof(cinergyt2->phys));
830 strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys)); 834 strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys));
831 cinergyt2->rc_input_event = KEY_MAX; 835 cinergyt2->rc_input_event = KEY_MAX;
832 cinergyt2->rc_last_code = ~0; 836 cinergyt2->rc_last_code = cpu_to_le32(~0);
833 INIT_DELAYED_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc); 837 INIT_DELAYED_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc);
834 838
835 input_dev->name = DRIVER_NAME " remote control"; 839 input_dev->name = DRIVER_NAME " remote control";
@@ -840,8 +844,8 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
840 input_dev->keycodesize = 0; 844 input_dev->keycodesize = 0;
841 input_dev->keycodemax = 0; 845 input_dev->keycodemax = 0;
842 input_dev->id.bustype = BUS_USB; 846 input_dev->id.bustype = BUS_USB;
843 input_dev->id.vendor = cinergyt2->udev->descriptor.idVendor; 847 input_dev->id.vendor = le16_to_cpu(cinergyt2->udev->descriptor.idVendor);
844 input_dev->id.product = cinergyt2->udev->descriptor.idProduct; 848 input_dev->id.product = le16_to_cpu(cinergyt2->udev->descriptor.idProduct);
845 input_dev->id.version = 1; 849 input_dev->id.version = 1;
846 input_dev->dev.parent = &cinergyt2->udev->dev; 850 input_dev->dev.parent = &cinergyt2->udev->dev;
847 851
@@ -889,18 +893,16 @@ static void cinergyt2_query (struct work_struct *work)
889 char cmd [] = { CINERGYT2_EP1_GET_TUNER_STATUS }; 893 char cmd [] = { CINERGYT2_EP1_GET_TUNER_STATUS };
890 struct dvbt_get_status_msg *s = &cinergyt2->status; 894 struct dvbt_get_status_msg *s = &cinergyt2->status;
891 uint8_t lock_bits; 895 uint8_t lock_bits;
892 uint32_t unc;
893 896
894 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 897 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
895 return; 898 return;
896 899
897 unc = s->uncorrected_block_count;
898 lock_bits = s->lock_bits; 900 lock_bits = s->lock_bits;
899 901
900 cinergyt2_command(cinergyt2, cmd, sizeof(cmd), (char *) s, sizeof(*s)); 902 cinergyt2_command(cinergyt2, cmd, sizeof(cmd), (char *) s, sizeof(*s));
901 903
902 unc += le32_to_cpu(s->uncorrected_block_count); 904 cinergyt2->uncorrected_block_count +=
903 s->uncorrected_block_count = unc; 905 le32_to_cpu(s->uncorrected_block_count);
904 906
905 if (lock_bits != s->lock_bits) { 907 if (lock_bits != s->lock_bits) {
906 wake_up_interruptible(&cinergyt2->poll_wq); 908 wake_up_interruptible(&cinergyt2->poll_wq);
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index 8cbdb0ec67e2..588fbe105c27 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -910,15 +910,21 @@ static void dvb_ca_en50221_thread_update_delay(struct dvb_ca_private *ca)
910 int curdelay = 100000000; 910 int curdelay = 100000000;
911 int slot; 911 int slot;
912 912
913 /* Beware of too high polling frequency, because one polling
914 * call might take several hundred milliseconds until timeout!
915 */
913 for (slot = 0; slot < ca->slot_count; slot++) { 916 for (slot = 0; slot < ca->slot_count; slot++) {
914 switch (ca->slot_info[slot].slot_state) { 917 switch (ca->slot_info[slot].slot_state) {
915 default: 918 default:
916 case DVB_CA_SLOTSTATE_NONE: 919 case DVB_CA_SLOTSTATE_NONE:
920 delay = HZ * 60; /* 60s */
921 if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE))
922 delay = HZ * 5; /* 5s */
923 break;
917 case DVB_CA_SLOTSTATE_INVALID: 924 case DVB_CA_SLOTSTATE_INVALID:
918 delay = HZ * 60; 925 delay = HZ * 60; /* 60s */
919 if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) { 926 if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE))
920 delay = HZ / 10; 927 delay = HZ / 10; /* 100ms */
921 }
922 break; 928 break;
923 929
924 case DVB_CA_SLOTSTATE_UNINITIALISED: 930 case DVB_CA_SLOTSTATE_UNINITIALISED:
@@ -926,19 +932,17 @@ static void dvb_ca_en50221_thread_update_delay(struct dvb_ca_private *ca)
926 case DVB_CA_SLOTSTATE_VALIDATE: 932 case DVB_CA_SLOTSTATE_VALIDATE:
927 case DVB_CA_SLOTSTATE_WAITFR: 933 case DVB_CA_SLOTSTATE_WAITFR:
928 case DVB_CA_SLOTSTATE_LINKINIT: 934 case DVB_CA_SLOTSTATE_LINKINIT:
929 delay = HZ / 10; 935 delay = HZ / 10; /* 100ms */
930 break; 936 break;
931 937
932 case DVB_CA_SLOTSTATE_RUNNING: 938 case DVB_CA_SLOTSTATE_RUNNING:
933 delay = HZ * 60; 939 delay = HZ * 60; /* 60s */
934 if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) { 940 if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE))
935 delay = HZ / 10; 941 delay = HZ / 10; /* 100ms */
936 }
937 if (ca->open) { 942 if (ca->open) {
938 if ((!ca->slot_info[slot].da_irq_supported) || 943 if ((!ca->slot_info[slot].da_irq_supported) ||
939 (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_DA))) { 944 (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_DA)))
940 delay = HZ / 10; 945 delay = HZ / 10; /* 100ms */
941 }
942 } 946 }
943 break; 947 break;
944 } 948 }
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index 56d871cfd7fc..c2334aef4143 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -168,7 +168,7 @@ struct dvb_net_priv {
168 * stolen from eth.c out of the linux kernel, hacked for dvb-device 168 * stolen from eth.c out of the linux kernel, hacked for dvb-device
169 * by Michael Holzt <kju@debian.org> 169 * by Michael Holzt <kju@debian.org>
170 */ 170 */
171static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb, 171static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
172 struct net_device *dev) 172 struct net_device *dev)
173{ 173{
174 struct ethhdr *eth; 174 struct ethhdr *eth;
@@ -277,10 +277,10 @@ static int handle_one_ule_extension( struct dvb_net_priv *p )
277 if(ext_len >= 0) { 277 if(ext_len >= 0) {
278 p->ule_next_hdr += ext_len; 278 p->ule_next_hdr += ext_len;
279 if (!p->ule_bridged) { 279 if (!p->ule_bridged) {
280 p->ule_sndu_type = ntohs(*(unsigned short *)p->ule_next_hdr); 280 p->ule_sndu_type = ntohs(*(__be16 *)p->ule_next_hdr);
281 p->ule_next_hdr += 2; 281 p->ule_next_hdr += 2;
282 } else { 282 } else {
283 p->ule_sndu_type = ntohs(*(unsigned short *)(p->ule_next_hdr + ((p->ule_dbit ? 2 : 3) * ETH_ALEN))); 283 p->ule_sndu_type = ntohs(*(__be16 *)(p->ule_next_hdr + ((p->ule_dbit ? 2 : 3) * ETH_ALEN)));
284 /* This assures the extension handling loop will terminate. */ 284 /* This assures the extension handling loop will terminate. */
285 } 285 }
286 } 286 }
@@ -294,7 +294,7 @@ static int handle_one_ule_extension( struct dvb_net_priv *p )
294 if (ule_optional_ext_handlers[htype]) 294 if (ule_optional_ext_handlers[htype])
295 (void)ule_optional_ext_handlers[htype]( p ); 295 (void)ule_optional_ext_handlers[htype]( p );
296 p->ule_next_hdr += ext_len; 296 p->ule_next_hdr += ext_len;
297 p->ule_sndu_type = ntohs( *(unsigned short *)(p->ule_next_hdr-2) ); 297 p->ule_sndu_type = ntohs( *(__be16 *)(p->ule_next_hdr-2) );
298 /* 298 /*
299 * note: the length of the next header type is included in the 299 * note: the length of the next header type is included in the
300 * length of THIS optional extension header 300 * length of THIS optional extension header
@@ -594,8 +594,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
594 /* Check for complete payload. */ 594 /* Check for complete payload. */
595 if (priv->ule_sndu_remain <= 0) { 595 if (priv->ule_sndu_remain <= 0) {
596 /* Check CRC32, we've got it in our skb already. */ 596 /* Check CRC32, we've got it in our skb already. */
597 unsigned short ulen = htons(priv->ule_sndu_len); 597 __be16 ulen = htons(priv->ule_sndu_len);
598 unsigned short utype = htons(priv->ule_sndu_type); 598 __be16 utype = htons(priv->ule_sndu_type);
599 const u8 *tail; 599 const u8 *tail;
600 struct kvec iov[3] = { 600 struct kvec iov[3] = {
601 { &ulen, sizeof ulen }, 601 { &ulen, sizeof ulen },
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 4c1cff9feb2e..f00a0eb40420 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -1,6 +1,7 @@
1config DVB_USB 1config DVB_USB
2 tristate "Support for various USB DVB devices" 2 tristate "Support for various USB DVB devices"
3 depends on DVB_CORE && USB && I2C 3 depends on DVB_CORE && USB && I2C && INPUT
4 depends on HOTPLUG # due to FW_LOADER
4 select FW_LOADER 5 select FW_LOADER
5 help 6 help
6 By enabling this you will be able to choose the various supported 7 By enabling this you will be able to choose the various supported
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 346223856f59..c4d40fe01d57 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -111,8 +111,8 @@ static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
111 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); 111 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
112 s8 a; 112 s8 a;
113 int if1=1220; 113 int if1=1220;
114 if (adap->dev->udev->descriptor.idVendor == USB_VID_HAUPPAUGE && 114 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
115 adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_500_2) { 115 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
116 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a; 116 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
117 } 117 }
118 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id], 118 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
@@ -402,8 +402,8 @@ static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
402{ 402{
403 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; 403 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
404 404
405 if (desc->idVendor == USB_VID_PINNACLE && 405 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
406 desc->idProduct == USB_PID_PINNACLE_EXPRESSCARD_320CX) 406 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
407 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); 407 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
408 else 408 else
409 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 409 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
@@ -845,8 +845,8 @@ static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
845 struct i2c_adapter *tun_i2c; 845 struct i2c_adapter *tun_i2c;
846 s8 a; 846 s8 a;
847 int if1=1220; 847 int if1=1220;
848 if (adap->dev->udev->descriptor.idVendor == USB_VID_HAUPPAUGE && 848 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
849 adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_STICK) { 849 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
850 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a; 850 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
851 } 851 }
852 if (st->is_dib7000pc) 852 if (st->is_dib7000pc)
@@ -990,11 +990,12 @@ static struct dib7000p_config dib7070p_dib7000p_config = {
990/* STK7070P */ 990/* STK7070P */
991static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) 991static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
992{ 992{
993 if (adap->dev->udev->descriptor.idVendor == USB_VID_PINNACLE && 993 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
994 adap->dev->udev->descriptor.idProduct == USB_PID_PINNACLE_PCTV72E) 994 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
995 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); 995 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
996 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
996 else 997 else
997 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 998 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
998 msleep(10); 999 msleep(10);
999 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); 1000 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1000 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); 1001 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
index e1112e39fb63..733a7ff7b207 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
@@ -127,7 +127,7 @@ int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
127 if ((*pos + hx->len + 4) >= fw->size) 127 if ((*pos + hx->len + 4) >= fw->size)
128 return -EINVAL; 128 return -EINVAL;
129 129
130 hx->addr = le16_to_cpu( *((u16 *) &b[1]) ); 130 hx->addr = b[1] | (b[2] << 8);
131 hx->type = b[3]; 131 hx->type = b[3];
132 132
133 if (hx->type == 0x04) { 133 if (hx->type == 0x04) {
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index 9a942afaf0af..2653120673b7 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -146,24 +146,24 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
146 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 146 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
147 if (! (status & bm8pskFW_Loaded)) /* BCM4500 firmware loaded */ 147 if (! (status & bm8pskFW_Loaded)) /* BCM4500 firmware loaded */
148 if(gp8psk_load_bcm4500fw(d)) 148 if(gp8psk_load_bcm4500fw(d))
149 return EINVAL; 149 return -EINVAL;
150 150
151 if (! (status & bmIntersilOn)) /* LNB Power */ 151 if (! (status & bmIntersilOn)) /* LNB Power */
152 if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0, 152 if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0,
153 &buf, 1)) 153 &buf, 1))
154 return EINVAL; 154 return -EINVAL;
155 155
156 /* Set DVB mode to 1 */ 156 /* Set DVB mode to 1 */
157 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 157 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
158 if (gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0)) 158 if (gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0))
159 return EINVAL; 159 return -EINVAL;
160 /* Abort possible TS (if previous tune crashed) */ 160 /* Abort possible TS (if previous tune crashed) */
161 if (gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0)) 161 if (gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0))
162 return EINVAL; 162 return -EINVAL;
163 } else { 163 } else {
164 /* Turn off LNB power */ 164 /* Turn off LNB power */
165 if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1)) 165 if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1))
166 return EINVAL; 166 return -EINVAL;
167 /* Turn off 8psk power */ 167 /* Turn off 8psk power */
168 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) 168 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1))
169 return -EINVAL; 169 return -EINVAL;
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index a12e6f784fda..54626a0dbf68 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -16,6 +16,7 @@
16#include "qt1010.h" 16#include "qt1010.h"
17#include "tda1004x.h" 17#include "tda1004x.h"
18#include "tda827x.h" 18#include "tda827x.h"
19#include <asm/unaligned.h>
19 20
20/* debug */ 21/* debug */
21static int dvb_usb_m920x_debug; 22static int dvb_usb_m920x_debug;
@@ -347,13 +348,13 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar
347 348
348 for (pass = 0; pass < 2; pass++) { 349 for (pass = 0; pass < 2; pass++) {
349 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) { 350 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
350 value = le16_to_cpu(*(u16 *)(fw->data + i)); 351 value = get_unaligned_le16(fw->data + i);
351 i += sizeof(u16); 352 i += sizeof(u16);
352 353
353 index = le16_to_cpu(*(u16 *)(fw->data + i)); 354 index = get_unaligned_le16(fw->data + i);
354 i += sizeof(u16); 355 i += sizeof(u16);
355 356
356 size = le16_to_cpu(*(u16 *)(fw->data + i)); 357 size = get_unaligned_le16(fw->data + i);
357 i += sizeof(u16); 358 i += sizeof(u16);
358 359
359 if (pass == 1) { 360 if (pass == 1) {
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index 6d2384605927..c20553c4da1f 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -30,7 +30,7 @@ config DVB_CX24123
30 A DVB-S tuner module. Say Y when you want to support this frontend. 30 A DVB-S tuner module. Say Y when you want to support this frontend.
31 31
32config DVB_MT312 32config DVB_MT312
33 tristate "Zarlink VP310/MT312 based" 33 tristate "Zarlink VP310/MT312/ZL10313 based"
34 depends on DVB_CORE && I2C 34 depends on DVB_CORE && I2C
35 default m if DVB_FE_CUSTOMISE 35 default m if DVB_FE_CUSTOMISE
36 help 36 help
@@ -97,7 +97,7 @@ comment "DVB-T (terrestrial) frontends"
97 97
98config DVB_SP8870 98config DVB_SP8870
99 tristate "Spase sp8870 based" 99 tristate "Spase sp8870 based"
100 depends on DVB_CORE && I2C 100 depends on DVB_CORE && I2C && HOTPLUG
101 default m if DVB_FE_CUSTOMISE 101 default m if DVB_FE_CUSTOMISE
102 select FW_LOADER 102 select FW_LOADER
103 help 103 help
@@ -110,7 +110,7 @@ config DVB_SP8870
110 110
111config DVB_SP887X 111config DVB_SP887X
112 tristate "Spase sp887x based" 112 tristate "Spase sp887x based"
113 depends on DVB_CORE && I2C 113 depends on DVB_CORE && I2C && HOTPLUG
114 default m if DVB_FE_CUSTOMISE 114 default m if DVB_FE_CUSTOMISE
115 select FW_LOADER 115 select FW_LOADER
116 help 116 help
@@ -144,7 +144,7 @@ config DVB_L64781
144 144
145config DVB_TDA1004X 145config DVB_TDA1004X
146 tristate "Philips TDA10045H/TDA10046H based" 146 tristate "Philips TDA10045H/TDA10046H based"
147 depends on DVB_CORE && I2C 147 depends on DVB_CORE && I2C && HOTPLUG
148 default m if DVB_FE_CUSTOMISE 148 default m if DVB_FE_CUSTOMISE
149 select FW_LOADER 149 select FW_LOADER
150 help 150 help
@@ -211,7 +211,7 @@ config DVB_DIB7000P
211 211
212config DVB_TDA10048 212config DVB_TDA10048
213 tristate "Philips TDA10048HN based" 213 tristate "Philips TDA10048HN based"
214 depends on DVB_CORE && I2C 214 depends on DVB_CORE && I2C && HOTPLUG
215 default m if DVB_FE_CUSTOMISE 215 default m if DVB_FE_CUSTOMISE
216 select FW_LOADER 216 select FW_LOADER
217 help 217 help
@@ -253,7 +253,7 @@ comment "ATSC (North American/Korean Terrestrial/Cable DTV) frontends"
253 253
254config DVB_NXT200X 254config DVB_NXT200X
255 tristate "NxtWave Communications NXT2002/NXT2004 based" 255 tristate "NxtWave Communications NXT2002/NXT2004 based"
256 depends on DVB_CORE && I2C 256 depends on DVB_CORE && I2C && HOTPLUG
257 default m if DVB_FE_CUSTOMISE 257 default m if DVB_FE_CUSTOMISE
258 select FW_LOADER 258 select FW_LOADER
259 help 259 help
@@ -268,7 +268,7 @@ config DVB_NXT200X
268 268
269config DVB_OR51211 269config DVB_OR51211
270 tristate "Oren OR51211 based" 270 tristate "Oren OR51211 based"
271 depends on DVB_CORE && I2C 271 depends on DVB_CORE && I2C && HOTPLUG
272 default m if DVB_FE_CUSTOMISE 272 default m if DVB_FE_CUSTOMISE
273 select FW_LOADER 273 select FW_LOADER
274 help 274 help
@@ -281,7 +281,7 @@ config DVB_OR51211
281 281
282config DVB_OR51132 282config DVB_OR51132
283 tristate "Oren OR51132 based" 283 tristate "Oren OR51132 based"
284 depends on DVB_CORE && I2C 284 depends on DVB_CORE && I2C && HOTPLUG
285 default m if DVB_FE_CUSTOMISE 285 default m if DVB_FE_CUSTOMISE
286 select FW_LOADER 286 select FW_LOADER
287 help 287 help
@@ -297,7 +297,7 @@ config DVB_OR51132
297 297
298config DVB_BCM3510 298config DVB_BCM3510
299 tristate "Broadcom BCM3510" 299 tristate "Broadcom BCM3510"
300 depends on DVB_CORE && I2C 300 depends on DVB_CORE && I2C && HOTPLUG
301 default m if DVB_FE_CUSTOMISE 301 default m if DVB_FE_CUSTOMISE
302 select FW_LOADER 302 select FW_LOADER
303 help 303 help
diff --git a/drivers/media/dvb/frontends/dib0070.h b/drivers/media/dvb/frontends/dib0070.h
index 786e37d33889..3eedfdf505bc 100644
--- a/drivers/media/dvb/frontends/dib0070.h
+++ b/drivers/media/dvb/frontends/dib0070.h
@@ -37,7 +37,20 @@ struct dib0070_config {
37 u8 flip_chip; 37 u8 flip_chip;
38}; 38};
39 39
40extern struct dvb_frontend * dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg); 40#if defined(CONFIG_DVB_TUNER_DIB0070) || (defined(CONFIG_DVB_TUNER_DIB0070_MODULE) && defined(MODULE))
41extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe,
42 struct i2c_adapter *i2c,
43 struct dib0070_config *cfg);
44#else
45static inline struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe,
46 struct i2c_adapter *i2c,
47 struct dib0070_config *cfg)
48{
49 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
50 return NULL;
51}
52#endif
53
41extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, uint8_t open); 54extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, uint8_t open);
42extern u16 dib0070_wbd_offset(struct dvb_frontend *); 55extern u16 dib0070_wbd_offset(struct dvb_frontend *);
43 56
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h
index 081bd81f3da2..07c4d12ed5b7 100644
--- a/drivers/media/dvb/frontends/dib7000p.h
+++ b/drivers/media/dvb/frontends/dib7000p.h
@@ -37,7 +37,20 @@ struct dib7000p_config {
37 37
38#define DEFAULT_DIB7000P_I2C_ADDRESS 18 38#define DEFAULT_DIB7000P_I2C_ADDRESS 18
39 39
40extern struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg); 40#if defined(CONFIG_DVB_DIB7000P) || (defined(CONFIG_DVB_DIB7000P_MODULE) && defined(MODULE))
41extern struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap,
42 u8 i2c_addr,
43 struct dib7000p_config *cfg);
44#else
45static inline struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap,
46 u8 i2c_addr,
47 struct dib7000p_config *cfg)
48{
49 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
50 return NULL;
51}
52#endif
53
41extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]); 54extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]);
42 55
43extern struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int); 56extern struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int);
diff --git a/drivers/media/dvb/frontends/itd1000.c b/drivers/media/dvb/frontends/itd1000.c
index 04c562ccf990..600dad6b41ea 100644
--- a/drivers/media/dvb/frontends/itd1000.c
+++ b/drivers/media/dvb/frontends/itd1000.c
@@ -195,7 +195,7 @@ static void itd1000_set_vco(struct itd1000_state *state, u32 freq_khz)
195 } 195 }
196} 196}
197 197
198struct { 198static const struct {
199 u32 freq; 199 u32 freq;
200 u8 values[10]; /* RFTR, RFST1 - RFST9 */ 200 u8 values[10]; /* RFTR, RFST1 - RFST9 */
201} itd1000_fre_values[] = { 201} itd1000_fre_values[] = {
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index 081ca3398c76..5ac9b15920f8 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -737,7 +737,7 @@ static void mt312_release(struct dvb_frontend *fe)
737} 737}
738 738
739#define MT312_SYS_CLK 90000000UL /* 90 MHz */ 739#define MT312_SYS_CLK 90000000UL /* 90 MHz */
740static struct dvb_frontend_ops vp310_mt312_ops = { 740static struct dvb_frontend_ops mt312_ops = {
741 741
742 .info = { 742 .info = {
743 .name = "Zarlink ???? DVB-S", 743 .name = "Zarlink ???? DVB-S",
@@ -776,7 +776,7 @@ static struct dvb_frontend_ops vp310_mt312_ops = {
776 .set_voltage = mt312_set_voltage, 776 .set_voltage = mt312_set_voltage,
777}; 777};
778 778
779struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config, 779struct dvb_frontend *mt312_attach(const struct mt312_config *config,
780 struct i2c_adapter *i2c) 780 struct i2c_adapter *i2c)
781{ 781{
782 struct mt312_state *state = NULL; 782 struct mt312_state *state = NULL;
@@ -795,7 +795,7 @@ struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config,
795 goto error; 795 goto error;
796 796
797 /* create dvb_frontend */ 797 /* create dvb_frontend */
798 memcpy(&state->frontend.ops, &vp310_mt312_ops, 798 memcpy(&state->frontend.ops, &mt312_ops,
799 sizeof(struct dvb_frontend_ops)); 799 sizeof(struct dvb_frontend_ops));
800 state->frontend.demodulator_priv = state; 800 state->frontend.demodulator_priv = state;
801 801
@@ -827,12 +827,13 @@ error:
827 kfree(state); 827 kfree(state);
828 return NULL; 828 return NULL;
829} 829}
830EXPORT_SYMBOL(vp310_mt312_attach); 830EXPORT_SYMBOL(mt312_attach);
831 831
832module_param(debug, int, 0644); 832module_param(debug, int, 0644);
833MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); 833MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
834 834
835MODULE_DESCRIPTION("Zarlink VP310/MT312/ZL10313 DVB-S Demodulator driver"); 835MODULE_DESCRIPTION("Zarlink VP310/MT312/ZL10313 DVB-S Demodulator driver");
836MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); 836MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>");
837MODULE_AUTHOR("Matthias Schwarzott <zzam@gentoo.org>");
837MODULE_LICENSE("GPL"); 838MODULE_LICENSE("GPL");
838 839
diff --git a/drivers/media/dvb/frontends/mt312.h b/drivers/media/dvb/frontends/mt312.h
index de796eab3911..29e3bb5496b8 100644
--- a/drivers/media/dvb/frontends/mt312.h
+++ b/drivers/media/dvb/frontends/mt312.h
@@ -37,10 +37,10 @@ struct mt312_config {
37}; 37};
38 38
39#if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE)) 39#if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE))
40struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config, 40struct dvb_frontend *mt312_attach(const struct mt312_config *config,
41 struct i2c_adapter *i2c); 41 struct i2c_adapter *i2c);
42#else 42#else
43static inline struct dvb_frontend *vp310_mt312_attach( 43static inline struct dvb_frontend *mt312_attach(
44 const struct mt312_config *config, struct i2c_adapter *i2c) 44 const struct mt312_config *config, struct i2c_adapter *i2c)
45{ 45{
46 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 46 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index c7b5785f81f2..5ed32544de39 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -126,7 +126,7 @@ static int or51132_readreg(struct or51132_state *state, u8 reg)
126 reg, err); 126 reg, err);
127 return -EREMOTEIO; 127 return -EREMOTEIO;
128 } 128 }
129 return le16_to_cpup((u16*)buf); 129 return buf[0] | (buf[1] << 8);
130} 130}
131 131
132static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) 132static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware *fw)
@@ -140,9 +140,9 @@ static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware
140 dprintk("Firmware is %Zd bytes\n",fw->size); 140 dprintk("Firmware is %Zd bytes\n",fw->size);
141 141
142 /* Get size of firmware A and B */ 142 /* Get size of firmware A and B */
143 firmwareAsize = le32_to_cpu(*((u32*)fw->data)); 143 firmwareAsize = le32_to_cpu(*((__le32*)fw->data));
144 dprintk("FirmwareA is %i bytes\n",firmwareAsize); 144 dprintk("FirmwareA is %i bytes\n",firmwareAsize);
145 firmwareBsize = le32_to_cpu(*((u32*)(fw->data+4))); 145 firmwareBsize = le32_to_cpu(*((__le32*)(fw->data+4)));
146 dprintk("FirmwareB is %i bytes\n",firmwareBsize); 146 dprintk("FirmwareB is %i bytes\n",firmwareBsize);
147 147
148 /* Upload firmware */ 148 /* Upload firmware */
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index ae882432dd3d..d4339b1b3b68 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -5,6 +5,7 @@ config TTPCI_EEPROM
5config DVB_AV7110 5config DVB_AV7110
6 tristate "AV7110 cards" 6 tristate "AV7110 cards"
7 depends on DVB_CORE && PCI && I2C 7 depends on DVB_CORE && PCI && I2C
8 depends on HOTPLUG
8 select FW_LOADER if !DVB_AV7110_FIRMWARE 9 select FW_LOADER if !DVB_AV7110_FIRMWARE
9 select TTPCI_EEPROM 10 select TTPCI_EEPROM
10 select VIDEO_SAA7146_VV 11 select VIDEO_SAA7146_VV
@@ -123,6 +124,7 @@ config DVB_BUDGET_AV
123 depends on DVB_BUDGET_CORE && I2C 124 depends on DVB_BUDGET_CORE && I2C
124 select VIDEO_SAA7146_VV 125 select VIDEO_SAA7146_VV
125 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV 126 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV
127 depends on HOTPLUG # dependency of FW_LOADER
126 select DVB_PLL if !DVB_FE_CUSTOMISE 128 select DVB_PLL if !DVB_FE_CUSTOMISE
127 select DVB_STV0299 if !DVB_FE_CUSTOMISE 129 select DVB_STV0299 if !DVB_FE_CUSTOMISE
128 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 130 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 747e7f1a6267..f05d43d8b5cf 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -51,6 +51,7 @@
51#include <linux/crc32.h> 51#include <linux/crc32.h>
52#include <linux/i2c.h> 52#include <linux/i2c.h>
53#include <linux/kthread.h> 53#include <linux/kthread.h>
54#include <asm/unaligned.h>
54 55
55#include <asm/system.h> 56#include <asm/system.h>
56 57
@@ -1461,9 +1462,9 @@ static int check_firmware(struct av7110* av7110)
1461 ptr += 4; 1462 ptr += 4;
1462 1463
1463 /* check dpram file */ 1464 /* check dpram file */
1464 crc = ntohl(*(u32*) ptr); 1465 crc = get_unaligned_be32(ptr);
1465 ptr += 4; 1466 ptr += 4;
1466 len = ntohl(*(u32*) ptr); 1467 len = get_unaligned_be32(ptr);
1467 ptr += 4; 1468 ptr += 4;
1468 if (len >= 512) { 1469 if (len >= 512) {
1469 printk("dvb-ttpci: dpram file is way too big.\n"); 1470 printk("dvb-ttpci: dpram file is way too big.\n");
@@ -1478,9 +1479,9 @@ static int check_firmware(struct av7110* av7110)
1478 ptr += len; 1479 ptr += len;
1479 1480
1480 /* check root file */ 1481 /* check root file */
1481 crc = ntohl(*(u32*) ptr); 1482 crc = get_unaligned_be32(ptr);
1482 ptr += 4; 1483 ptr += 4;
1483 len = ntohl(*(u32*) ptr); 1484 len = get_unaligned_be32(ptr);
1484 ptr += 4; 1485 ptr += 4;
1485 1486
1486 if (len <= 200000 || len >= 300000 || 1487 if (len <= 200000 || len >= 300000 ||
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index 3e6b650fbb81..ec55a968f204 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -965,8 +965,9 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x
965 965
966static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock) 966static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock)
967{ 967{
968 int i, n; 968 unsigned i, n;
969 int progressive = 0; 969 int progressive = 0;
970 int match = 0;
970 971
971 dprintk(2, "av7110:%p, \n", av7110); 972 dprintk(2, "av7110:%p, \n", av7110);
972 973
@@ -975,12 +976,31 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
975 return -EBUSY; 976 return -EBUSY;
976 } 977 }
977 978
978 for (i = 0; i < len - 5; i++) { 979 /* search in buf for instances of 00 00 01 b5 1? */
979 /* get progressive flag from picture extension */ 980 for (i = 0; i < len; i++) {
980 if (buf[i] == 0x00 && buf[i+1] == 0x00 && 981 unsigned char c;
981 buf[i+2] == 0x01 && (unsigned char)buf[i+3] == 0xb5 && 982 if (get_user(c, buf + i))
982 (buf[i+4] & 0xf0) == 0x10) 983 return -EFAULT;
983 progressive = buf[i+5] & 0x08; 984 if (match == 5) {
985 progressive = c & 0x08;
986 match = 0;
987 }
988 if (c == 0x00) {
989 match = (match == 1 || match == 2) ? 2 : 1;
990 continue;
991 }
992 switch (match++) {
993 case 2: if (c == 0x01)
994 continue;
995 break;
996 case 3: if (c == 0xb5)
997 continue;
998 break;
999 case 4: if ((c & 0xf0) == 0x10)
1000 continue;
1001 break;
1002 }
1003 match = 0;
984 } 1004 }
985 1005
986 /* setting n always > 1, fixes problems when playing stillframes 1006 /* setting n always > 1, fixes problems when playing stillframes
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 732ce4de512e..5d2d81ab2371 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -552,7 +552,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
552 u16 csum = 0, cc; 552 u16 csum = 0, cc;
553 int i; 553 int i;
554 for (i = 0; i < len; i += 2) 554 for (i = 0; i < len; i += 2)
555 csum ^= le16_to_cpup((u16 *) (muxpack + i)); 555 csum ^= le16_to_cpup((__le16 *) (muxpack + i));
556 if (csum) { 556 if (csum) {
557 printk("%s: muxpack with incorrect checksum, ignoring\n", 557 printk("%s: muxpack with incorrect checksum, ignoring\n",
558 __func__); 558 __func__);
diff --git a/drivers/media/dvb/ttusb-dec/Kconfig b/drivers/media/dvb/ttusb-dec/Kconfig
index 83611012ef34..a23cc0aa17d3 100644
--- a/drivers/media/dvb/ttusb-dec/Kconfig
+++ b/drivers/media/dvb/ttusb-dec/Kconfig
@@ -1,6 +1,7 @@
1config DVB_TTUSB_DEC 1config DVB_TTUSB_DEC
2 tristate "Technotrend/Hauppauge USB DEC devices" 2 tristate "Technotrend/Hauppauge USB DEC devices"
3 depends on DVB_CORE && USB 3 depends on DVB_CORE && USB && INPUT
4 depends on HOTPLUG # due to FW_LOADER
4 select FW_LOADER 5 select FW_LOADER
5 select CRC32 6 select CRC32
6 help 7 help
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index 42eee04daa5d..fefdc05e84ac 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -343,7 +343,7 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode,
343 u8 c[COMMAND_PACKET_SIZE]; 343 u8 c[COMMAND_PACKET_SIZE];
344 int c_length; 344 int c_length;
345 int result; 345 int result;
346 unsigned int tmp; 346 __be32 tmp;
347 347
348 dprintk("%s\n", __func__); 348 dprintk("%s\n", __func__);
349 349
@@ -398,9 +398,9 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec)
398 0x00, 0x00, 0xff, 0xff, 398 0x00, 0x00, 0xff, 0xff,
399 0xff, 0xff, 0xff, 0xff }; 399 0xff, 0xff, 0xff, 0xff };
400 400
401 u16 pcr = htons(dec->pid[DMX_PES_PCR]); 401 __be16 pcr = htons(dec->pid[DMX_PES_PCR]);
402 u16 audio = htons(dec->pid[DMX_PES_AUDIO]); 402 __be16 audio = htons(dec->pid[DMX_PES_AUDIO]);
403 u16 video = htons(dec->pid[DMX_PES_VIDEO]); 403 __be16 video = htons(dec->pid[DMX_PES_VIDEO]);
404 404
405 dprintk("%s\n", __func__); 405 dprintk("%s\n", __func__);
406 406
@@ -435,7 +435,7 @@ static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length)
435 case 0x01: { /* VideoStream */ 435 case 0x01: { /* VideoStream */
436 int prebytes = pva[5] & 0x03; 436 int prebytes = pva[5] & 0x03;
437 int postbytes = (pva[5] & 0x0c) >> 2; 437 int postbytes = (pva[5] & 0x0c) >> 2;
438 u16 v_pes_payload_length; 438 __be16 v_pes_payload_length;
439 439
440 if (output_pva) { 440 if (output_pva) {
441 dec->video_filter->feed->cb.ts(pva, length, NULL, 0, 441 dec->video_filter->feed->cb.ts(pva, length, NULL, 0,
@@ -1006,7 +1006,7 @@ static int ttusb_dec_start_sec_feed(struct dvb_demux_feed *dvbdmxfeed)
1006 0x00, 0x00, 0x00, 0x00, 1006 0x00, 0x00, 0x00, 0x00,
1007 0x00, 0x00, 0x00, 0x00, 1007 0x00, 0x00, 0x00, 0x00,
1008 0x00 }; 1008 0x00 };
1009 u16 pid; 1009 __be16 pid;
1010 u8 c[COMMAND_PACKET_SIZE]; 1010 u8 c[COMMAND_PACKET_SIZE];
1011 int c_length; 1011 int c_length;
1012 int result; 1012 int result;
@@ -1278,9 +1278,10 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
1278 u8 *firmware = NULL; 1278 u8 *firmware = NULL;
1279 size_t firmware_size = 0; 1279 size_t firmware_size = 0;
1280 u16 firmware_csum = 0; 1280 u16 firmware_csum = 0;
1281 u16 firmware_csum_ns; 1281 __be16 firmware_csum_ns;
1282 u32 firmware_size_nl; 1282 __be32 firmware_size_nl;
1283 u32 crc32_csum, crc32_check, tmp; 1283 u32 crc32_csum, crc32_check;
1284 __be32 tmp;
1284 const struct firmware *fw_entry = NULL; 1285 const struct firmware *fw_entry = NULL;
1285 1286
1286 dprintk("%s\n", __func__); 1287 dprintk("%s\n", __func__);
@@ -1306,7 +1307,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
1306 valid. */ 1307 valid. */
1307 crc32_csum = crc32(~0L, firmware, 56) ^ ~0L; 1308 crc32_csum = crc32(~0L, firmware, 56) ^ ~0L;
1308 memcpy(&tmp, &firmware[56], 4); 1309 memcpy(&tmp, &firmware[56], 4);
1309 crc32_check = htonl(tmp); 1310 crc32_check = ntohl(tmp);
1310 if (crc32_csum != crc32_check) { 1311 if (crc32_csum != crc32_check) {
1311 printk("%s: crc32 check of DSP code failed (calculated " 1312 printk("%s: crc32 check of DSP code failed (calculated "
1312 "0x%08x != 0x%08x in file), file invalid.\n", 1313 "0x%08x != 0x%08x in file), file invalid.\n",
@@ -1627,7 +1628,7 @@ static int ttusb_dec_probe(struct usb_interface *intf,
1627 1628
1628 usb_set_intfdata(intf, (void *)dec); 1629 usb_set_intfdata(intf, (void *)dec);
1629 1630
1630 switch (le16_to_cpu(id->idProduct)) { 1631 switch (id->idProduct) {
1631 case 0x1006: 1632 case 0x1006:
1632 ttusb_dec_set_model(dec, TTUSB_DEC3000S); 1633 ttusb_dec_set_model(dec, TTUSB_DEC3000S);
1633 break; 1634 break;
@@ -1652,7 +1653,7 @@ static int ttusb_dec_probe(struct usb_interface *intf,
1652 ttusb_dec_init_dvb(dec); 1653 ttusb_dec_init_dvb(dec);
1653 1654
1654 dec->adapter.priv = dec; 1655 dec->adapter.priv = dec;
1655 switch (le16_to_cpu(id->idProduct)) { 1656 switch (id->idProduct) {
1656 case 0x1006: 1657 case 0x1006:
1657 dec->fe = ttusbdecfe_dvbs_attach(&fe_config); 1658 dec->fe = ttusbdecfe_dvbs_attach(&fe_config);
1658 break; 1659 break;
diff --git a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
index eb5eaeccd7c4..443af24097f3 100644
--- a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
+++ b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
@@ -86,7 +86,7 @@ static int ttusbdecfe_dvbt_set_frontend(struct dvb_frontend* fe, struct dvb_fron
86 0x00, 0x00, 0x00, 0xff, 86 0x00, 0x00, 0x00, 0xff,
87 0x00, 0x00, 0x00, 0xff }; 87 0x00, 0x00, 0x00, 0xff };
88 88
89 u32 freq = htonl(p->frequency / 1000); 89 __be32 freq = htonl(p->frequency / 1000);
90 memcpy(&b[4], &freq, sizeof (u32)); 90 memcpy(&b[4], &freq, sizeof (u32));
91 state->config->send_command(fe, 0x71, sizeof(b), b, NULL, NULL); 91 state->config->send_command(fe, 0x71, sizeof(b), b, NULL, NULL);
92 92
@@ -117,10 +117,10 @@ static int ttusbdecfe_dvbs_set_frontend(struct dvb_frontend* fe, struct dvb_fron
117 0x00, 0x00, 0x00, 0x00, 117 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x00, 0x00, 0x00, 118 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00 }; 119 0x00, 0x00, 0x00, 0x00 };
120 u32 freq; 120 __be32 freq;
121 u32 sym_rate; 121 __be32 sym_rate;
122 u32 band; 122 __be32 band;
123 u32 lnb_voltage; 123 __be32 lnb_voltage;
124 124
125 freq = htonl(p->frequency + 125 freq = htonl(p->frequency +
126 (state->hi_band ? LOF_HI : LOF_LO)); 126 (state->hi_band ? LOF_HI : LOF_LO));
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index fe743aa7f645..3b26fbd3e558 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -44,6 +44,10 @@ config VIDEO_TVEEPROM
44 tristate 44 tristate
45 depends on I2C 45 depends on I2C
46 46
47config VIDEO_TUNER
48 tristate
49 depends on MEDIA_TUNER
50
47# 51#
48# Multimedia Video device configuration 52# Multimedia Video device configuration
49# 53#
@@ -690,7 +694,7 @@ config VIDEO_MXB
690 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" 694 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
691 depends on PCI && VIDEO_V4L1 && I2C 695 depends on PCI && VIDEO_V4L1 && I2C
692 select VIDEO_SAA7146_VV 696 select VIDEO_SAA7146_VV
693 select MEDIA_TUNER 697 select VIDEO_TUNER
694 select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO 698 select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO
695 select VIDEO_TDA9840 if VIDEO_HELPER_CHIPS_AUTO 699 select VIDEO_TDA9840 if VIDEO_HELPER_CHIPS_AUTO
696 select VIDEO_TEA6415C if VIDEO_HELPER_CHIPS_AUTO 700 select VIDEO_TEA6415C if VIDEO_HELPER_CHIPS_AUTO
@@ -897,7 +901,7 @@ endif # V4L_USB_DRIVERS
897 901
898config SOC_CAMERA 902config SOC_CAMERA
899 tristate "SoC camera support" 903 tristate "SoC camera support"
900 depends on VIDEO_V4L2 904 depends on VIDEO_V4L2 && HAS_DMA
901 select VIDEOBUF_DMA_SG 905 select VIDEOBUF_DMA_SG
902 help 906 help
903 SoC Camera is a common API to several cameras, not connecting 907 SoC Camera is a common API to several cameras, not connecting
@@ -906,7 +910,7 @@ config SOC_CAMERA
906 910
907config SOC_CAMERA_MT9M001 911config SOC_CAMERA_MT9M001
908 tristate "mt9m001 support" 912 tristate "mt9m001 support"
909 depends on SOC_CAMERA 913 depends on SOC_CAMERA && I2C
910 select GPIO_PCA953X if MT9M001_PCA9536_SWITCH 914 select GPIO_PCA953X if MT9M001_PCA9536_SWITCH
911 help 915 help
912 This driver supports MT9M001 cameras from Micron, monochrome 916 This driver supports MT9M001 cameras from Micron, monochrome
@@ -921,7 +925,7 @@ config MT9M001_PCA9536_SWITCH
921 925
922config SOC_CAMERA_MT9V022 926config SOC_CAMERA_MT9V022
923 tristate "mt9v022 support" 927 tristate "mt9v022 support"
924 depends on SOC_CAMERA 928 depends on SOC_CAMERA && I2C
925 select GPIO_PCA953X if MT9V022_PCA9536_SWITCH 929 select GPIO_PCA953X if MT9V022_PCA9536_SWITCH
926 help 930 help
927 This driver supports MT9V022 cameras from Micron 931 This driver supports MT9V022 cameras from Micron
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index a352c6e31f0c..dff0d6abe917 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -84,7 +84,7 @@ obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
84obj-$(CONFIG_VIDEO_DPC) += dpc7146.o 84obj-$(CONFIG_VIDEO_DPC) += dpc7146.o
85obj-$(CONFIG_TUNER_3036) += tuner-3036.o 85obj-$(CONFIG_TUNER_3036) += tuner-3036.o
86 86
87obj-$(CONFIG_MEDIA_TUNER) += tuner.o 87obj-$(CONFIG_VIDEO_TUNER) += tuner.o
88 88
89obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o 89obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
90obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o 90obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
diff --git a/drivers/media/video/au0828/Kconfig b/drivers/media/video/au0828/Kconfig
index cab277fafa63..52b2491581a8 100644
--- a/drivers/media/video/au0828/Kconfig
+++ b/drivers/media/video/au0828/Kconfig
@@ -1,8 +1,9 @@
1 1
2config VIDEO_AU0828 2config VIDEO_AU0828
3 tristate "Auvitek AU0828 support" 3 tristate "Auvitek AU0828 support"
4 depends on VIDEO_DEV && I2C && INPUT && DVB_CORE 4 depends on I2C && INPUT && DVB_CORE && USB
5 select I2C_ALGOBIT 5 select I2C_ALGOBIT
6 select VIDEO_TVEEPROM
6 select DVB_AU8522 if !DVB_FE_CUSTOMIZE 7 select DVB_AU8522 if !DVB_FE_CUSTOMIZE
7 select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE 8 select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE
8 ---help--- 9 ---help---
diff --git a/drivers/media/video/au0828/au0828-dvb.c b/drivers/media/video/au0828/au0828-dvb.c
index 1371b4e4b5f1..c6d470590380 100644
--- a/drivers/media/video/au0828/au0828-dvb.c
+++ b/drivers/media/video/au0828/au0828-dvb.c
@@ -337,12 +337,10 @@ int au0828_dvb_register(struct au0828_dev *dev)
337 dvb->frontend = dvb_attach(au8522_attach, 337 dvb->frontend = dvb_attach(au8522_attach,
338 &hauppauge_hvr950q_config, 338 &hauppauge_hvr950q_config,
339 &dev->i2c_adap); 339 &dev->i2c_adap);
340 if (dvb->frontend != NULL) { 340 if (dvb->frontend != NULL)
341 hauppauge_hvr950q_tunerconfig.priv = dev;
342 dvb_attach(xc5000_attach, dvb->frontend, 341 dvb_attach(xc5000_attach, dvb->frontend,
343 &dev->i2c_adap, 342 &dev->i2c_adap,
344 &hauppauge_hvr950q_tunerconfig); 343 &hauppauge_hvr950q_tunerconfig, dev);
345 }
346 break; 344 break;
347 default: 345 default:
348 printk(KERN_WARNING "The frontend of your DVB/ATSC card " 346 printk(KERN_WARNING "The frontend of your DVB/ATSC card "
@@ -355,12 +353,6 @@ int au0828_dvb_register(struct au0828_dev *dev)
355 return -1; 353 return -1;
356 } 354 }
357 355
358 /* Put the analog decoder in standby to keep it quiet */
359 au0828_call_i2c_clients(dev, TUNER_SET_STANDBY, NULL);
360
361 if (dvb->frontend->ops.analog_ops.standby)
362 dvb->frontend->ops.analog_ops.standby(dvb->frontend);
363
364 /* register everything */ 356 /* register everything */
365 ret = dvb_register(dev); 357 ret = dvb_register(dev);
366 if (ret < 0) { 358 if (ret < 0) {
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig
index 7431ef6de9f1..24a34fc1f2b3 100644
--- a/drivers/media/video/bt8xx/Kconfig
+++ b/drivers/media/video/bt8xx/Kconfig
@@ -1,12 +1,13 @@
1config VIDEO_BT848 1config VIDEO_BT848
2 tristate "BT848 Video For Linux" 2 tristate "BT848 Video For Linux"
3 depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 && INPUT 3 depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 && INPUT
4 depends on HOTPLUG # due to FW_LOADER
4 select I2C_ALGOBIT 5 select I2C_ALGOBIT
5 select FW_LOADER 6 select FW_LOADER
6 select VIDEO_BTCX 7 select VIDEO_BTCX
7 select VIDEOBUF_DMA_SG 8 select VIDEOBUF_DMA_SG
8 select VIDEO_IR 9 select VIDEO_IR
9 select MEDIA_TUNER 10 select VIDEO_TUNER
10 select VIDEO_TVEEPROM 11 select VIDEO_TVEEPROM
11 select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO 12 select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO
12 select VIDEO_TVAUDIO if VIDEO_HELPER_CHIPS_AUTO 13 select VIDEO_TVAUDIO if VIDEO_HELPER_CHIPS_AUTO
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index f20a01cfc73e..8ef0424c26c4 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -34,6 +34,7 @@
34#include <linux/firmware.h> 34#include <linux/firmware.h>
35#include <net/checksum.h> 35#include <net/checksum.h>
36 36
37#include <asm/unaligned.h>
37#include <asm/io.h> 38#include <asm/io.h>
38 39
39#include "bttvp.h" 40#include "bttvp.h"
@@ -3858,7 +3859,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
3858 ee += i; 3859 ee += i;
3859 3860
3860 /* found a valid descriptor */ 3861 /* found a valid descriptor */
3861 type = be16_to_cpup((u16*)(ee+4)); 3862 type = get_unaligned_be16((__be16 *)(ee+4));
3862 3863
3863 switch(type) { 3864 switch(type) {
3864 /* 848 based */ 3865 /* 848 based */
@@ -3918,7 +3919,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
3918 btv->c.nr, type); 3919 btv->c.nr, type);
3919 break; 3920 break;
3920 } 3921 }
3921 serial = be32_to_cpup((u32*)(ee+6)); 3922 serial = get_unaligned_be32((__be32 *)(ee+6));
3922 } 3923 }
3923 3924
3924 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n", 3925 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 2ca3e9cfb2bb..0165aac533bf 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2613,7 +2613,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
2613 struct bttv_fh *fh = priv; 2613 struct bttv_fh *fh = priv;
2614 2614
2615 mutex_lock(&fh->cap.vb_lock); 2615 mutex_lock(&fh->cap.vb_lock);
2616 retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, 2616 retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
2617 V4L2_MEMORY_MMAP); 2617 V4L2_MEMORY_MMAP);
2618 if (retval < 0) { 2618 if (retval < 0) {
2619 mutex_unlock(&fh->cap.vb_lock); 2619 mutex_unlock(&fh->cap.vb_lock);
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c
index e5979f77504c..0af586876e72 100644
--- a/drivers/media/video/bt8xx/bttv-risc.c
+++ b/drivers/media/video/bt8xx/bttv-risc.c
@@ -48,7 +48,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
48{ 48{
49 u32 instructions,line,todo; 49 u32 instructions,line,todo;
50 struct scatterlist *sg; 50 struct scatterlist *sg;
51 u32 *rp; 51 __le32 *rp;
52 int rc; 52 int rc;
53 53
54 /* estimate risc mem: worst case is one write per page border + 54 /* estimate risc mem: worst case is one write per page border +
@@ -128,7 +128,8 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
128 unsigned int cpadding) 128 unsigned int cpadding)
129{ 129{
130 unsigned int instructions,line,todo,ylen,chroma; 130 unsigned int instructions,line,todo,ylen,chroma;
131 u32 *rp,ri; 131 __le32 *rp;
132 u32 ri;
132 struct scatterlist *ysg; 133 struct scatterlist *ysg;
133 struct scatterlist *usg; 134 struct scatterlist *usg;
134 struct scatterlist *vsg; 135 struct scatterlist *vsg;
@@ -244,7 +245,8 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
244{ 245{
245 int dwords,rc,line,maxy,start,end,skip,nskips; 246 int dwords,rc,line,maxy,start,end,skip,nskips;
246 struct btcx_skiplist *skips; 247 struct btcx_skiplist *skips;
247 u32 *rp,ri,ra; 248 __le32 *rp;
249 u32 ri,ra;
248 u32 addr; 250 u32 addr;
249 251
250 /* skip list for window clipping */ 252 /* skip list for window clipping */
diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c
index ce0840ccd594..f42701f82e7f 100644
--- a/drivers/media/video/btcx-risc.c
+++ b/drivers/media/video/btcx-risc.c
@@ -63,7 +63,7 @@ int btcx_riscmem_alloc(struct pci_dev *pci,
63 struct btcx_riscmem *risc, 63 struct btcx_riscmem *risc,
64 unsigned int size) 64 unsigned int size)
65{ 65{
66 u32 *cpu; 66 __le32 *cpu;
67 dma_addr_t dma; 67 dma_addr_t dma;
68 68
69 if (NULL != risc->cpu && risc->size < size) 69 if (NULL != risc->cpu && risc->size < size)
diff --git a/drivers/media/video/btcx-risc.h b/drivers/media/video/btcx-risc.h
index 503e6c6d7b69..861bc8112824 100644
--- a/drivers/media/video/btcx-risc.h
+++ b/drivers/media/video/btcx-risc.h
@@ -2,8 +2,8 @@
2 */ 2 */
3struct btcx_riscmem { 3struct btcx_riscmem {
4 unsigned int size; 4 unsigned int size;
5 u32 *cpu; 5 __le32 *cpu;
6 u32 *jmp; 6 __le32 *jmp;
7 dma_addr_t dma; 7 dma_addr_t dma;
8}; 8};
9 9
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c
index 2a429f9e32cd..03411503457e 100644
--- a/drivers/media/video/cs5345.c
+++ b/drivers/media/video/cs5345.c
@@ -160,10 +160,17 @@ static int cs5345_probe(struct i2c_client *client,
160 160
161/* ----------------------------------------------------------------------- */ 161/* ----------------------------------------------------------------------- */
162 162
163static const struct i2c_device_id cs5345_id[] = {
164 { "cs5345", 0 },
165 { }
166};
167MODULE_DEVICE_TABLE(i2c, cs5345_id);
168
163static struct v4l2_i2c_driver_data v4l2_i2c_data = { 169static struct v4l2_i2c_driver_data v4l2_i2c_data = {
164 .name = "cs5345", 170 .name = "cs5345",
165 .driverid = I2C_DRIVERID_CS5345, 171 .driverid = I2C_DRIVERID_CS5345,
166 .command = cs5345_command, 172 .command = cs5345_command,
167 .probe = cs5345_probe, 173 .probe = cs5345_probe,
174 .id_table = cs5345_id,
168}; 175};
169 176
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index 2dfd0afc62db..d965af860ab2 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -144,7 +144,8 @@ static int cs53l32a_probe(struct i2c_client *client,
144 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 144 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
145 return -EIO; 145 return -EIO;
146 146
147 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); 147 if (!id)
148 strlcpy(client->name, "cs53l32a", sizeof(client->name));
148 149
149 v4l_info(client, "chip found @ 0x%x (%s)\n", 150 v4l_info(client, "chip found @ 0x%x (%s)\n",
150 client->addr << 1, client->adapter->name); 151 client->addr << 1, client->adapter->name);
@@ -175,10 +176,17 @@ static int cs53l32a_probe(struct i2c_client *client,
175 return 0; 176 return 0;
176} 177}
177 178
179static const struct i2c_device_id cs53l32a_id[] = {
180 { "cs53l32a", 0 },
181 { }
182};
183MODULE_DEVICE_TABLE(i2c, cs53l32a_id);
184
178static struct v4l2_i2c_driver_data v4l2_i2c_data = { 185static struct v4l2_i2c_driver_data v4l2_i2c_data = {
179 .name = "cs53l32a", 186 .name = "cs53l32a",
180 .driverid = I2C_DRIVERID_CS53L32A, 187 .driverid = I2C_DRIVERID_CS53L32A,
181 .command = cs53l32a_command, 188 .command = cs53l32a_command,
182 .probe = cs53l32a_probe, 189 .probe = cs53l32a_probe,
190 .id_table = cs53l32a_id,
183}; 191};
184 192
diff --git a/drivers/media/video/cx18/Kconfig b/drivers/media/video/cx18/Kconfig
index acc4b47f1d1d..5f942690570c 100644
--- a/drivers/media/video/cx18/Kconfig
+++ b/drivers/media/video/cx18/Kconfig
@@ -1,14 +1,17 @@
1config VIDEO_CX18 1config VIDEO_CX18
2 tristate "Conexant cx23418 MPEG encoder support" 2 tristate "Conexant cx23418 MPEG encoder support"
3 depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL
4 depends on INPUT # due to VIDEO_IR
5 depends on HOTPLUG # due to FW_LOADER
4 select I2C_ALGOBIT 6 select I2C_ALGOBIT
5 select FW_LOADER 7 select FW_LOADER
6 select VIDEO_IR 8 select VIDEO_IR
7 select MEDIA_TUNER 9 select VIDEO_TUNER
8 select VIDEO_TVEEPROM 10 select VIDEO_TVEEPROM
9 select VIDEO_CX2341X 11 select VIDEO_CX2341X
10 select VIDEO_CS5345 12 select VIDEO_CS5345
11 select DVB_S5H1409 13 select DVB_S5H1409
14 select MEDIA_TUNER_MXL5005S
12 ---help--- 15 ---help---
13 This is a video4linux driver for Conexant cx23418 based 16 This is a video4linux driver for Conexant cx23418 based
14 PCI combo video recorder devices. 17 PCI combo video recorder devices.
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index 66864904c99b..9a26751615c6 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -182,14 +182,16 @@ static void input_change(struct cx18 *cx)
182 if (std == V4L2_STD_NTSC_M_JP) { 182 if (std == V4L2_STD_NTSC_M_JP) {
183 /* Japan uses EIAJ audio standard */ 183 /* Japan uses EIAJ audio standard */
184 cx18_av_write(cx, 0x808, 0xf7); 184 cx18_av_write(cx, 0x808, 0xf7);
185 cx18_av_write(cx, 0x80b, 0x02);
185 } else if (std == V4L2_STD_NTSC_M_KR) { 186 } else if (std == V4L2_STD_NTSC_M_KR) {
186 /* South Korea uses A2 audio standard */ 187 /* South Korea uses A2 audio standard */
187 cx18_av_write(cx, 0x808, 0xf8); 188 cx18_av_write(cx, 0x808, 0xf8);
189 cx18_av_write(cx, 0x80b, 0x03);
188 } else { 190 } else {
189 /* Others use the BTSC audio standard */ 191 /* Others use the BTSC audio standard */
190 cx18_av_write(cx, 0x808, 0xf6); 192 cx18_av_write(cx, 0x808, 0xf6);
193 cx18_av_write(cx, 0x80b, 0x01);
191 } 194 }
192 cx18_av_write(cx, 0x80b, 0x00);
193 } else if (std & V4L2_STD_PAL) { 195 } else if (std & V4L2_STD_PAL) {
194 /* Follow tuner change procedure for PAL */ 196 /* Follow tuner change procedure for PAL */
195 cx18_av_write(cx, 0x808, 0xff); 197 cx18_av_write(cx, 0x808, 0xff);
@@ -741,8 +743,8 @@ static void log_audio_status(struct cx18 *cx)
741{ 743{
742 struct cx18_av_state *state = &cx->av_state; 744 struct cx18_av_state *state = &cx->av_state;
743 u8 download_ctl = cx18_av_read(cx, 0x803); 745 u8 download_ctl = cx18_av_read(cx, 0x803);
744 u8 mod_det_stat0 = cx18_av_read(cx, 0x805); 746 u8 mod_det_stat0 = cx18_av_read(cx, 0x804);
745 u8 mod_det_stat1 = cx18_av_read(cx, 0x804); 747 u8 mod_det_stat1 = cx18_av_read(cx, 0x805);
746 u8 audio_config = cx18_av_read(cx, 0x808); 748 u8 audio_config = cx18_av_read(cx, 0x808);
747 u8 pref_mode = cx18_av_read(cx, 0x809); 749 u8 pref_mode = cx18_av_read(cx, 0x809);
748 u8 afc0 = cx18_av_read(cx, 0x80b); 750 u8 afc0 = cx18_av_read(cx, 0x80b);
@@ -760,12 +762,12 @@ static void log_audio_status(struct cx18 *cx)
760 case 0x12: p = "dual with SAP"; break; 762 case 0x12: p = "dual with SAP"; break;
761 case 0x14: p = "tri with SAP"; break; 763 case 0x14: p = "tri with SAP"; break;
762 case 0xfe: p = "forced mode"; break; 764 case 0xfe: p = "forced mode"; break;
763 default: p = "not defined"; 765 default: p = "not defined"; break;
764 } 766 }
765 CX18_INFO("Detected audio mode: %s\n", p); 767 CX18_INFO("Detected audio mode: %s\n", p);
766 768
767 switch (mod_det_stat1) { 769 switch (mod_det_stat1) {
768 case 0x00: p = "BTSC"; break; 770 case 0x00: p = "not defined"; break;
769 case 0x01: p = "EIAJ"; break; 771 case 0x01: p = "EIAJ"; break;
770 case 0x02: p = "A2-M"; break; 772 case 0x02: p = "A2-M"; break;
771 case 0x03: p = "A2-BG"; break; 773 case 0x03: p = "A2-BG"; break;
@@ -779,8 +781,13 @@ static void log_audio_status(struct cx18 *cx)
779 case 0x0b: p = "NICAM-I"; break; 781 case 0x0b: p = "NICAM-I"; break;
780 case 0x0c: p = "NICAM-L"; break; 782 case 0x0c: p = "NICAM-L"; break;
781 case 0x0d: p = "BTSC/EIAJ/A2-M Mono (4.5 MHz FMMono)"; break; 783 case 0x0d: p = "BTSC/EIAJ/A2-M Mono (4.5 MHz FMMono)"; break;
784 case 0x0e: p = "IF FM Radio"; break;
785 case 0x0f: p = "BTSC"; break;
786 case 0x10: p = "detected chrominance"; break;
787 case 0xfd: p = "unknown audio standard"; break;
788 case 0xfe: p = "forced audio standard"; break;
782 case 0xff: p = "no detected audio standard"; break; 789 case 0xff: p = "no detected audio standard"; break;
783 default: p = "not defined"; 790 default: p = "not defined"; break;
784 } 791 }
785 CX18_INFO("Detected audio standard: %s\n", p); 792 CX18_INFO("Detected audio standard: %s\n", p);
786 CX18_INFO("Audio muted: %s\n", 793 CX18_INFO("Audio muted: %s\n",
@@ -789,22 +796,23 @@ static void log_audio_status(struct cx18 *cx)
789 (download_ctl & 0x10) ? "running" : "stopped"); 796 (download_ctl & 0x10) ? "running" : "stopped");
790 797
791 switch (audio_config >> 4) { 798 switch (audio_config >> 4) {
792 case 0x00: p = "BTSC"; break; 799 case 0x00: p = "undefined"; break;
793 case 0x01: p = "EIAJ"; break; 800 case 0x01: p = "BTSC"; break;
794 case 0x02: p = "A2-M"; break; 801 case 0x02: p = "EIAJ"; break;
795 case 0x03: p = "A2-BG"; break; 802 case 0x03: p = "A2-M"; break;
796 case 0x04: p = "A2-DK1"; break; 803 case 0x04: p = "A2-BG"; break;
797 case 0x05: p = "A2-DK2"; break; 804 case 0x05: p = "A2-DK1"; break;
798 case 0x06: p = "A2-DK3"; break; 805 case 0x06: p = "A2-DK2"; break;
799 case 0x07: p = "A1 (6.0 MHz FM Mono)"; break; 806 case 0x07: p = "A2-DK3"; break;
800 case 0x08: p = "AM-L"; break; 807 case 0x08: p = "A1 (6.0 MHz FM Mono)"; break;
801 case 0x09: p = "NICAM-BG"; break; 808 case 0x09: p = "AM-L"; break;
802 case 0x0a: p = "NICAM-DK"; break; 809 case 0x0a: p = "NICAM-BG"; break;
803 case 0x0b: p = "NICAM-I"; break; 810 case 0x0b: p = "NICAM-DK"; break;
804 case 0x0c: p = "NICAM-L"; break; 811 case 0x0c: p = "NICAM-I"; break;
805 case 0x0d: p = "FM radio"; break; 812 case 0x0d: p = "NICAM-L"; break;
813 case 0x0e: p = "FM radio"; break;
806 case 0x0f: p = "automatic detection"; break; 814 case 0x0f: p = "automatic detection"; break;
807 default: p = "undefined"; 815 default: p = "undefined"; break;
808 } 816 }
809 CX18_INFO("Configured audio standard: %s\n", p); 817 CX18_INFO("Configured audio standard: %s\n", p);
810 818
@@ -815,12 +823,9 @@ static void log_audio_status(struct cx18 *cx)
815 case 0x02: p = "MONO3 (STEREO forced MONO)"; break; 823 case 0x02: p = "MONO3 (STEREO forced MONO)"; break;
816 case 0x03: p = "MONO4 (NICAM ANALOG-Language C/Analog Fallback)"; break; 824 case 0x03: p = "MONO4 (NICAM ANALOG-Language C/Analog Fallback)"; break;
817 case 0x04: p = "STEREO"; break; 825 case 0x04: p = "STEREO"; break;
818 case 0x05: p = "DUAL1 (AB)"; break; 826 case 0x05: p = "DUAL1 (AC)"; break;
819 case 0x06: p = "DUAL2 (AC) (FM)"; break; 827 case 0x06: p = "DUAL2 (BC)"; break;
820 case 0x07: p = "DUAL3 (BC) (FM)"; break; 828 case 0x07: p = "DUAL3 (AB)"; break;
821 case 0x08: p = "DUAL4 (AC) (AM)"; break;
822 case 0x09: p = "DUAL5 (BC) (AM)"; break;
823 case 0x0a: p = "SAP"; break;
824 default: p = "undefined"; 829 default: p = "undefined";
825 } 830 }
826 CX18_INFO("Configured audio mode: %s\n", p); 831 CX18_INFO("Configured audio mode: %s\n", p);
@@ -835,9 +840,11 @@ static void log_audio_status(struct cx18 *cx)
835 case 0x06: p = "BTSC"; break; 840 case 0x06: p = "BTSC"; break;
836 case 0x07: p = "EIAJ"; break; 841 case 0x07: p = "EIAJ"; break;
837 case 0x08: p = "A2-M"; break; 842 case 0x08: p = "A2-M"; break;
838 case 0x09: p = "FM Radio"; break; 843 case 0x09: p = "FM Radio (4.5 MHz)"; break;
844 case 0x0a: p = "FM Radio (5.5 MHz)"; break;
845 case 0x0b: p = "S-Video"; break;
839 case 0x0f: p = "automatic standard and mode detection"; break; 846 case 0x0f: p = "automatic standard and mode detection"; break;
840 default: p = "undefined"; 847 default: p = "undefined"; break;
841 } 848 }
842 CX18_INFO("Configured audio system: %s\n", p); 849 CX18_INFO("Configured audio system: %s\n", p);
843 } 850 }
@@ -857,22 +864,24 @@ static void log_audio_status(struct cx18 *cx)
857 case 5: p = "language AC"; break; 864 case 5: p = "language AC"; break;
858 case 6: p = "language BC"; break; 865 case 6: p = "language BC"; break;
859 case 7: p = "language AB"; break; 866 case 7: p = "language AB"; break;
860 default: p = "undefined"; 867 default: p = "undefined"; break;
861 } 868 }
862 CX18_INFO("Preferred audio mode: %s\n", p); 869 CX18_INFO("Preferred audio mode: %s\n", p);
863 870
864 if ((audio_config & 0xf) == 0xf) { 871 if ((audio_config & 0xf) == 0xf) {
865 switch ((afc0 >> 2) & 0x1) { 872 switch ((afc0 >> 3) & 0x1) {
866 case 0: p = "system DK"; break; 873 case 0: p = "system DK"; break;
867 case 1: p = "system L"; break; 874 case 1: p = "system L"; break;
868 } 875 }
869 CX18_INFO("Selected 65 MHz format: %s\n", p); 876 CX18_INFO("Selected 65 MHz format: %s\n", p);
870 877
871 switch (afc0 & 0x3) { 878 switch (afc0 & 0x7) {
872 case 0: p = "BTSC"; break; 879 case 0: p = "Chroma"; break;
873 case 1: p = "EIAJ"; break; 880 case 1: p = "BTSC"; break;
874 case 2: p = "A2-M"; break; 881 case 2: p = "EIAJ"; break;
875 default: p = "undefined"; 882 case 3: p = "A2-M"; break;
883 case 4: p = "autodetect"; break;
884 default: p = "undefined"; break;
876 } 885 }
877 CX18_INFO("Selected 45 MHz format: %s\n", p); 886 CX18_INFO("Selected 45 MHz format: %s\n", p);
878 } 887 }
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index f5e3ba1f5354..baccd079243d 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -47,11 +47,12 @@ static struct cx18_card_tuner_i2c cx18_i2c_std = {
47static const struct cx18_card cx18_card_hvr1600_esmt = { 47static const struct cx18_card cx18_card_hvr1600_esmt = {
48 .type = CX18_CARD_HVR_1600_ESMT, 48 .type = CX18_CARD_HVR_1600_ESMT,
49 .name = "Hauppauge HVR-1600", 49 .name = "Hauppauge HVR-1600",
50 .comment = "DVB & VBI are not yet supported\n", 50 .comment = "VBI is not yet supported\n",
51 .v4l2_capabilities = CX18_CAP_ENCODER, 51 .v4l2_capabilities = CX18_CAP_ENCODER,
52 .hw_audio_ctrl = CX18_HW_CX23418, 52 .hw_audio_ctrl = CX18_HW_CX23418,
53 .hw_muxer = CX18_HW_CS5345, 53 .hw_muxer = CX18_HW_CS5345,
54 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER | CX18_HW_CS5345, 54 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
55 CX18_HW_CS5345 | CX18_HW_DVB,
55 .video_inputs = { 56 .video_inputs = {
56 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, 57 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 },
57 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, 58 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 },
@@ -86,11 +87,12 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
86static const struct cx18_card cx18_card_hvr1600_samsung = { 87static const struct cx18_card cx18_card_hvr1600_samsung = {
87 .type = CX18_CARD_HVR_1600_SAMSUNG, 88 .type = CX18_CARD_HVR_1600_SAMSUNG,
88 .name = "Hauppauge HVR-1600 (Preproduction)", 89 .name = "Hauppauge HVR-1600 (Preproduction)",
89 .comment = "DVB & VBI are not yet supported\n", 90 .comment = "VBI is not yet supported\n",
90 .v4l2_capabilities = CX18_CAP_ENCODER, 91 .v4l2_capabilities = CX18_CAP_ENCODER,
91 .hw_audio_ctrl = CX18_HW_CX23418, 92 .hw_audio_ctrl = CX18_HW_CX23418,
92 .hw_muxer = CX18_HW_CS5345, 93 .hw_muxer = CX18_HW_CS5345,
93 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER | CX18_HW_CS5345, 94 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
95 CX18_HW_CS5345 | CX18_HW_DVB,
94 .video_inputs = { 96 .video_inputs = {
95 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, 97 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 },
96 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, 98 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 },
@@ -124,7 +126,7 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
124 126
125/* ------------------------------------------------------------------------- */ 127/* ------------------------------------------------------------------------- */
126 128
127/* Compro VideoMate H900: not working at the moment! */ 129/* Compro VideoMate H900: note that this card is analog only! */
128 130
129static const struct cx18_card_pci_info cx18_pci_h900[] = { 131static const struct cx18_card_pci_info cx18_pci_h900[] = {
130 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 }, 132 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
@@ -134,14 +136,15 @@ static const struct cx18_card_pci_info cx18_pci_h900[] = {
134static const struct cx18_card cx18_card_h900 = { 136static const struct cx18_card cx18_card_h900 = {
135 .type = CX18_CARD_COMPRO_H900, 137 .type = CX18_CARD_COMPRO_H900,
136 .name = "Compro VideoMate H900", 138 .name = "Compro VideoMate H900",
137 .comment = "Not yet supported!\n", 139 .comment = "VBI is not yet supported\n",
138 .v4l2_capabilities = 0, 140 .v4l2_capabilities = CX18_CAP_ENCODER,
139 .hw_audio_ctrl = CX18_HW_CX23418, 141 .hw_audio_ctrl = CX18_HW_CX23418,
140 .hw_all = CX18_HW_TUNER, 142 .hw_all = CX18_HW_TUNER,
141 .video_inputs = { 143 .video_inputs = {
142 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, 144 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE2 },
143 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, 145 { CX18_CARD_INPUT_SVIDEO1, 1,
144 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 }, 146 CX23418_SVIDEO_LUMA3 | CX23418_SVIDEO_CHROMA4 },
147 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE1 },
145 }, 148 },
146 .audio_inputs = { 149 .audio_inputs = {
147 { CX18_CARD_INPUT_AUD_TUNER, 150 { CX18_CARD_INPUT_AUD_TUNER,
@@ -163,6 +166,7 @@ static const struct cx18_card cx18_card_h900 = {
163 .tune_lane = 0, 166 .tune_lane = 0,
164 .initial_emrs = 0, 167 .initial_emrs = 0,
165 }, 168 },
169 .xceive_pin = 15,
166 .pci_list = cx18_pci_h900, 170 .pci_list = cx18_pci_h900,
167 .i2c = &cx18_i2c_std, 171 .i2c = &cx18_i2c_std,
168}; 172};
@@ -200,8 +204,6 @@ static const struct cx18_card cx18_card_mpc718 = {
200 /* XC3028 tuner */ 204 /* XC3028 tuner */
201 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, 205 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
202 }, 206 },
203 /* tuner reset */
204 .gpio_init = { .direction = 0x1000, .initial_value = 0x1000 },
205 .ddr = { 207 .ddr = {
206 /* Probably Samsung K4D263238G-VC33 memory */ 208 /* Probably Samsung K4D263238G-VC33 memory */
207 .chip_config = 0x003, 209 .chip_config = 0x003,
@@ -211,6 +213,7 @@ static const struct cx18_card cx18_card_mpc718 = {
211 .tune_lane = 0, 213 .tune_lane = 0,
212 .initial_emrs = 2, 214 .initial_emrs = 2,
213 }, 215 },
216 .xceive_pin = 15,
214 .pci_list = cx18_pci_mpc718, 217 .pci_list = cx18_pci_mpc718,
215 .i2c = &cx18_i2c_std, 218 .i2c = &cx18_i2c_std,
216}; 219};
diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h
index bca249bdd337..bccb67f0db16 100644
--- a/drivers/media/video/cx18/cx18-cards.h
+++ b/drivers/media/video/cx18/cx18-cards.h
@@ -114,8 +114,8 @@ struct cx18_card_pci_info {
114/* The mask is the set of bits used by the operation */ 114/* The mask is the set of bits used by the operation */
115 115
116struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */ 116struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
117 u16 direction; /* DIR setting. Leave to 0 if no init is needed */ 117 u32 direction; /* DIR setting. Leave to 0 if no init is needed */
118 u16 initial_value; 118 u32 initial_value;
119}; 119};
120 120
121struct cx18_card_tuner { 121struct cx18_card_tuner {
@@ -153,6 +153,7 @@ struct cx18_card {
153 struct cx18_card_audio_input radio_input; 153 struct cx18_card_audio_input radio_input;
154 154
155 /* GPIO card-specific settings */ 155 /* GPIO card-specific settings */
156 u8 xceive_pin; /* XCeive tuner GPIO reset pin */
156 struct cx18_gpio_init gpio_init; 157 struct cx18_gpio_init gpio_init;
157 158
158 struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS]; 159 struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
index 2bdac5ebbb0d..87cf41021665 100644
--- a/drivers/media/video/cx18/cx18-controls.c
+++ b/drivers/media/video/cx18/cx18-controls.c
@@ -159,7 +159,7 @@ static int cx18_setup_vbi_fmt(struct cx18 *cx, enum v4l2_mpeg_stream_vbi_fmt fmt
159{ 159{
160 if (!(cx->v4l2_cap & V4L2_CAP_SLICED_VBI_CAPTURE)) 160 if (!(cx->v4l2_cap & V4L2_CAP_SLICED_VBI_CAPTURE))
161 return -EINVAL; 161 return -EINVAL;
162 if (atomic_read(&cx->capturing) > 0) 162 if (atomic_read(&cx->ana_capturing) > 0)
163 return -EBUSY; 163 return -EBUSY;
164 164
165 /* First try to allocate sliced VBI buffers if needed. */ 165 /* First try to allocate sliced VBI buffers if needed. */
@@ -235,7 +235,7 @@ int cx18_control_ioctls(struct cx18 *cx, unsigned int cmd, void *arg)
235 CX18_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n"); 235 CX18_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n");
236 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { 236 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
237 struct cx2341x_mpeg_params p = cx->params; 237 struct cx2341x_mpeg_params p = cx->params;
238 int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->capturing), arg, cmd); 238 int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing), arg, cmd);
239 239
240 if (err) 240 if (err)
241 return err; 241 return err;
@@ -295,7 +295,7 @@ int cx18_control_ioctls(struct cx18 *cx, unsigned int cmd, void *arg)
295 CX18_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n"); 295 CX18_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n");
296 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 296 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
297 return cx2341x_ext_ctrls(&cx->params, 297 return cx2341x_ext_ctrls(&cx->params,
298 atomic_read(&cx->capturing), arg, cmd); 298 atomic_read(&cx->ana_capturing), arg, cmd);
299 return -EINVAL; 299 return -EINVAL;
300 } 300 }
301 301
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 3f55d47bc4b9..2b810bb2a4c7 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -164,16 +164,6 @@ MODULE_LICENSE("GPL");
164 164
165MODULE_VERSION(CX18_VERSION); 165MODULE_VERSION(CX18_VERSION);
166 166
167int cx18_waitq(wait_queue_head_t *waitq)
168{
169 DEFINE_WAIT(wait);
170
171 prepare_to_wait(waitq, &wait, TASK_INTERRUPTIBLE);
172 schedule();
173 finish_wait(waitq, &wait);
174 return signal_pending(current) ? -EINTR : 0;
175}
176
177/* Generic utility functions */ 167/* Generic utility functions */
178int cx18_msleep_timeout(unsigned int msecs, int intr) 168int cx18_msleep_timeout(unsigned int msecs, int intr)
179{ 169{
@@ -220,13 +210,13 @@ static void cx18_process_eeprom(struct cx18 *cx)
220 210
221 /* Many thanks to Steven Toth from Hauppauge for providing the 211 /* Many thanks to Steven Toth from Hauppauge for providing the
222 model numbers */ 212 model numbers */
213 /* Note: the Samsung memory models cannot be reliably determined
214 from the model number. Use the cardtype module option if you
215 have one of these preproduction models. */
223 switch (tv.model) { 216 switch (tv.model) {
224 case 74000 ... 74099: 217 case 74000 ... 74999:
225 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); 218 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
226 break; 219 break;
227 case 74700 ... 74799:
228 cx->card = cx18_get_card(CX18_CARD_HVR_1600_SAMSUNG);
229 break;
230 case 0: 220 case 0:
231 CX18_ERR("Invalid EEPROM\n"); 221 CX18_ERR("Invalid EEPROM\n");
232 return; 222 return;
@@ -548,6 +538,7 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev,
548 return 0; 538 return 0;
549} 539}
550 540
541#ifdef MODULE
551static u32 cx18_request_module(struct cx18 *cx, u32 hw, 542static u32 cx18_request_module(struct cx18 *cx, u32 hw,
552 const char *name, u32 id) 543 const char *name, u32 id)
553{ 544{
@@ -560,12 +551,14 @@ static u32 cx18_request_module(struct cx18 *cx, u32 hw,
560 CX18_DEBUG_INFO("Loaded module %s\n", name); 551 CX18_DEBUG_INFO("Loaded module %s\n", name);
561 return hw; 552 return hw;
562} 553}
554#endif
563 555
564static void cx18_load_and_init_modules(struct cx18 *cx) 556static void cx18_load_and_init_modules(struct cx18 *cx)
565{ 557{
566 u32 hw = cx->card->hw_all; 558 u32 hw = cx->card->hw_all;
567 int i; 559 int i;
568 560
561#ifdef MODULE
569 /* load modules */ 562 /* load modules */
570#ifndef CONFIG_MEDIA_TUNER 563#ifndef CONFIG_MEDIA_TUNER
571 hw = cx18_request_module(cx, hw, "tuner", CX18_HW_TUNER); 564 hw = cx18_request_module(cx, hw, "tuner", CX18_HW_TUNER);
@@ -573,6 +566,7 @@ static void cx18_load_and_init_modules(struct cx18 *cx)
573#ifndef CONFIG_VIDEO_CS5345 566#ifndef CONFIG_VIDEO_CS5345
574 hw = cx18_request_module(cx, hw, "cs5345", CX18_HW_CS5345); 567 hw = cx18_request_module(cx, hw, "cs5345", CX18_HW_CS5345);
575#endif 568#endif
569#endif
576 570
577 /* check which i2c devices are actually found */ 571 /* check which i2c devices are actually found */
578 for (i = 0; i < 32; i++) { 572 for (i = 0; i < 32; i++) {
@@ -676,7 +670,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
676 cx18_init_power(cx, 1); 670 cx18_init_power(cx, 1);
677 cx18_init_memory(cx); 671 cx18_init_memory(cx);
678 672
679 cx->scb = (struct cx18_scb *)(cx->enc_mem + SCB_OFFSET); 673 cx->scb = (struct cx18_scb __iomem *)(cx->enc_mem + SCB_OFFSET);
680 cx18_init_scb(cx); 674 cx18_init_scb(cx);
681 675
682 cx18_gpio_init(cx); 676 cx18_gpio_init(cx);
@@ -757,17 +751,6 @@ static int __devinit cx18_probe(struct pci_dev *dev,
757 if (cx->options.radio > 0) 751 if (cx->options.radio > 0)
758 cx->v4l2_cap |= V4L2_CAP_RADIO; 752 cx->v4l2_cap |= V4L2_CAP_RADIO;
759 753
760 retval = cx18_streams_setup(cx);
761 if (retval) {
762 CX18_ERR("Error %d setting up streams\n", retval);
763 goto free_irq;
764 }
765 retval = cx18_streams_register(cx);
766 if (retval) {
767 CX18_ERR("Error %d registering devices\n", retval);
768 goto free_streams;
769 }
770
771 if (cx->options.tuner > -1) { 754 if (cx->options.tuner > -1) {
772 struct tuner_setup setup; 755 struct tuner_setup setup;
773 756
@@ -794,14 +777,23 @@ static int __devinit cx18_probe(struct pci_dev *dev,
794 are not. */ 777 are not. */
795 cx->tuner_std = cx->std; 778 cx->tuner_std = cx->std;
796 779
797 cx18_init_on_first_open(cx); 780 retval = cx18_streams_setup(cx);
781 if (retval) {
782 CX18_ERR("Error %d setting up streams\n", retval);
783 goto free_irq;
784 }
785 retval = cx18_streams_register(cx);
786 if (retval) {
787 CX18_ERR("Error %d registering devices\n", retval);
788 goto free_streams;
789 }
798 790
799 CX18_INFO("Initialized card #%d: %s\n", cx->num, cx->card_name); 791 CX18_INFO("Initialized card #%d: %s\n", cx->num, cx->card_name);
800 792
801 return 0; 793 return 0;
802 794
803free_streams: 795free_streams:
804 cx18_streams_cleanup(cx); 796 cx18_streams_cleanup(cx, 1);
805free_irq: 797free_irq:
806 free_irq(cx->dev->irq, (void *)cx); 798 free_irq(cx->dev->irq, (void *)cx);
807free_i2c: 799free_i2c:
@@ -895,7 +887,7 @@ static void cx18_remove(struct pci_dev *pci_dev)
895 887
896 /* Stop all captures */ 888 /* Stop all captures */
897 CX18_DEBUG_INFO("Stopping all streams\n"); 889 CX18_DEBUG_INFO("Stopping all streams\n");
898 if (atomic_read(&cx->capturing) > 0) 890 if (atomic_read(&cx->tot_capturing) > 0)
899 cx18_stop_all_captures(cx); 891 cx18_stop_all_captures(cx);
900 892
901 /* Interrupts */ 893 /* Interrupts */
@@ -904,14 +896,13 @@ static void cx18_remove(struct pci_dev *pci_dev)
904 896
905 cx18_halt_firmware(cx); 897 cx18_halt_firmware(cx);
906 898
907 cx18_streams_cleanup(cx); 899 cx18_streams_cleanup(cx, 1);
908 900
909 exit_cx18_i2c(cx); 901 exit_cx18_i2c(cx);
910 902
911 free_irq(cx->dev->irq, (void *)cx); 903 free_irq(cx->dev->irq, (void *)cx);
912 904
913 if (cx->dev) 905 cx18_iounmap(cx);
914 cx18_iounmap(cx);
915 906
916 release_mem_region(cx->base_addr, CX18_MEM_SIZE); 907 release_mem_region(cx->base_addr, CX18_MEM_SIZE);
917 908
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 2ee939193bb7..de14ab59a206 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -358,7 +358,7 @@ struct cx18 {
358 u32 v4l2_cap; /* V4L2 capabilities of card */ 358 u32 v4l2_cap; /* V4L2 capabilities of card */
359 u32 hw_flags; /* Hardware description of the board */ 359 u32 hw_flags; /* Hardware description of the board */
360 unsigned mdl_offset; 360 unsigned mdl_offset;
361 struct cx18_scb *scb; /* pointer to SCB */ 361 struct cx18_scb __iomem *scb; /* pointer to SCB */
362 362
363 struct cx18_av_state av_state; 363 struct cx18_av_state av_state;
364 364
@@ -380,7 +380,8 @@ struct cx18 {
380 int stream_buf_size[CX18_MAX_STREAMS]; /* Stream buffer size */ 380 int stream_buf_size[CX18_MAX_STREAMS]; /* Stream buffer size */
381 struct cx18_stream streams[CX18_MAX_STREAMS]; /* Stream data */ 381 struct cx18_stream streams[CX18_MAX_STREAMS]; /* Stream data */
382 unsigned long i_flags; /* global cx18 flags */ 382 unsigned long i_flags; /* global cx18 flags */
383 atomic_t capturing; /* count number of active capture streams */ 383 atomic_t ana_capturing; /* count number of active analog capture streams */
384 atomic_t tot_capturing; /* total count number of active capture streams */
384 spinlock_t lock; /* lock access to this struct */ 385 spinlock_t lock; /* lock access to this struct */
385 int search_pack_header; 386 int search_pack_header;
386 387
@@ -423,6 +424,10 @@ struct cx18 {
423 struct mutex i2c_bus_lock[2]; 424 struct mutex i2c_bus_lock[2];
424 struct i2c_client *i2c_clients[I2C_CLIENTS_MAX]; 425 struct i2c_client *i2c_clients[I2C_CLIENTS_MAX];
425 426
427 /* gpio */
428 u32 gpio_dir;
429 u32 gpio_val;
430
426 /* v4l2 and User settings */ 431 /* v4l2 and User settings */
427 432
428 /* codec settings */ 433 /* codec settings */
@@ -444,9 +449,6 @@ extern spinlock_t cx18_cards_lock;
444/* Return non-zero if a signal is pending */ 449/* Return non-zero if a signal is pending */
445int cx18_msleep_timeout(unsigned int msecs, int intr); 450int cx18_msleep_timeout(unsigned int msecs, int intr);
446 451
447/* Wait on queue, returns -EINTR if interrupted */
448int cx18_waitq(wait_queue_head_t *waitq);
449
450/* Read Hauppauge eeprom */ 452/* Read Hauppauge eeprom */
451struct tveeprom; /* forward reference */ 453struct tveeprom; /* forward reference */
452void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv); 454void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv);
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c
index 65efe69d939a..c9744173f969 100644
--- a/drivers/media/video/cx18/cx18-dvb.c
+++ b/drivers/media/video/cx18/cx18-dvb.c
@@ -24,25 +24,27 @@
24#include "cx18-streams.h" 24#include "cx18-streams.h"
25#include "cx18-cards.h" 25#include "cx18-cards.h"
26#include "s5h1409.h" 26#include "s5h1409.h"
27 27#include "mxl5005s.h"
28/* Wait until the MXL500X driver is merged */
29#ifdef HAVE_MXL500X
30#include "mxl500x.h"
31#endif
32 28
33DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 29DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
34 30
35#define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000 31#define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000
36 32
37#ifdef HAVE_MXL500X 33static struct mxl5005s_config hauppauge_hvr1600_tuner = {
38static struct mxl500x_config hauppauge_hvr1600_tuner = { 34 .i2c_address = 0xC6 >> 1,
39 .delsys = MXL500x_MODE_ATSC, 35 .if_freq = IF_FREQ_5380000HZ,
40 .octf = MXL500x_OCTF_CH, 36 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
41 .xtal_freq = 16000000, 37 .agc_mode = MXL_SINGLE_AGC,
42 .iflo_freq = 5380000, 38 .tracking_filter = MXL_TF_C_H,
43 .ref_freq = 322800000, 39 .rssi_enable = MXL_RSSI_ENABLE,
44 .rssi_ena = MXL_RSSI_ENABLE, 40 .cap_select = MXL_CAP_SEL_ENABLE,
45 .addr = 0xC6 >> 1, 41 .div_out = MXL_DIV_OUT_4,
42 .clock_out = MXL_CLOCK_OUT_DISABLE,
43 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
44 .top = MXL5005S_TOP_25P2,
45 .mod_mode = MXL_DIGITAL_MODE,
46 .if_mode = MXL_ZERO_IF,
47 .AgcMasterByte = 0x00,
46}; 48};
47 49
48static struct s5h1409_config hauppauge_hvr1600_config = { 50static struct s5h1409_config hauppauge_hvr1600_config = {
@@ -55,7 +57,6 @@ static struct s5h1409_config hauppauge_hvr1600_config = {
55 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK 57 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK
56 58
57}; 59};
58#endif
59 60
60static int dvb_register(struct cx18_stream *stream); 61static int dvb_register(struct cx18_stream *stream);
61 62
@@ -252,21 +253,18 @@ static int dvb_register(struct cx18_stream *stream)
252 int ret = 0; 253 int ret = 0;
253 254
254 switch (cx->card->type) { 255 switch (cx->card->type) {
255/* Wait until the MXL500X driver is merged */
256#ifdef HAVE_MXL500X
257 case CX18_CARD_HVR_1600_ESMT: 256 case CX18_CARD_HVR_1600_ESMT:
258 case CX18_CARD_HVR_1600_SAMSUNG: 257 case CX18_CARD_HVR_1600_SAMSUNG:
259 dvb->fe = dvb_attach(s5h1409_attach, 258 dvb->fe = dvb_attach(s5h1409_attach,
260 &hauppauge_hvr1600_config, 259 &hauppauge_hvr1600_config,
261 &cx->i2c_adap[0]); 260 &cx->i2c_adap[0]);
262 if (dvb->fe != NULL) { 261 if (dvb->fe != NULL) {
263 dvb_attach(mxl500x_attach, dvb->fe, 262 dvb_attach(mxl5005s_attach, dvb->fe,
264 &hauppauge_hvr1600_tuner, 263 &cx->i2c_adap[0],
265 &cx->i2c_adap[0]); 264 &hauppauge_hvr1600_tuner);
266 ret = 0; 265 ret = 0;
267 } 266 }
268 break; 267 break;
269#endif
270 default: 268 default:
271 /* No Digital Tv Support */ 269 /* No Digital Tv Support */
272 break; 270 break;
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 69303065a294..1e537fe04a23 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -39,7 +39,7 @@
39 associated VBI streams are also automatically claimed. 39 associated VBI streams are also automatically claimed.
40 Possible error returns: -EBUSY if someone else has claimed 40 Possible error returns: -EBUSY if someone else has claimed
41 the stream or 0 on success. */ 41 the stream or 0 on success. */
42int cx18_claim_stream(struct cx18_open_id *id, int type) 42static int cx18_claim_stream(struct cx18_open_id *id, int type)
43{ 43{
44 struct cx18 *cx = id->cx; 44 struct cx18 *cx = id->cx;
45 struct cx18_stream *s = &cx->streams[type]; 45 struct cx18_stream *s = &cx->streams[type];
@@ -87,7 +87,7 @@ int cx18_claim_stream(struct cx18_open_id *id, int type)
87 87
88/* This function releases a previously claimed stream. It will take into 88/* This function releases a previously claimed stream. It will take into
89 account associated VBI streams. */ 89 account associated VBI streams. */
90void cx18_release_stream(struct cx18_stream *s) 90static void cx18_release_stream(struct cx18_stream *s)
91{ 91{
92 struct cx18 *cx = s->cx; 92 struct cx18 *cx = s->cx;
93 struct cx18_stream *s_vbi; 93 struct cx18_stream *s_vbi;
@@ -318,7 +318,7 @@ static ssize_t cx18_read(struct cx18_stream *s, char __user *ubuf,
318 size_t tot_written = 0; 318 size_t tot_written = 0;
319 int single_frame = 0; 319 int single_frame = 0;
320 320
321 if (atomic_read(&cx->capturing) == 0 && s->id == -1) { 321 if (atomic_read(&cx->ana_capturing) == 0 && s->id == -1) {
322 /* shouldn't happen */ 322 /* shouldn't happen */
323 CX18_DEBUG_WARN("Stream %s not initialized before read\n", 323 CX18_DEBUG_WARN("Stream %s not initialized before read\n",
324 s->name); 324 s->name);
@@ -361,7 +361,8 @@ static ssize_t cx18_read(struct cx18_stream *s, char __user *ubuf,
361 cx18_enqueue(s, buf, &s->q_free); 361 cx18_enqueue(s, buf, &s->q_free);
362 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, 362 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5,
363 s->handle, 363 s->handle,
364 (void *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, 364 (void __iomem *)&cx->scb->cpu_mdl[buf->id] -
365 cx->enc_mem,
365 1, buf->id, s->buf_size); 366 1, buf->id, s->buf_size);
366 } else 367 } else
367 cx18_enqueue(s, buf, &s->q_io); 368 cx18_enqueue(s, buf, &s->q_io);
@@ -581,7 +582,7 @@ int cx18_v4l2_close(struct inode *inode, struct file *filp)
581 cx18_call_i2c_clients(cx, VIDIOC_S_STD, &cx->std); 582 cx18_call_i2c_clients(cx, VIDIOC_S_STD, &cx->std);
582 /* Select correct audio input (i.e. TV tuner or Line in) */ 583 /* Select correct audio input (i.e. TV tuner or Line in) */
583 cx18_audio_set_io(cx); 584 cx18_audio_set_io(cx);
584 if (atomic_read(&cx->capturing) > 0) { 585 if (atomic_read(&cx->ana_capturing) > 0) {
585 /* Undo video mute */ 586 /* Undo video mute */
586 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, 587 cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle,
587 cx->params.video_mute | 588 cx->params.video_mute |
@@ -627,7 +628,7 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
627 } 628 }
628 629
629 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { 630 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) {
630 if (atomic_read(&cx->capturing) > 0) { 631 if (atomic_read(&cx->ana_capturing) > 0) {
631 /* switching to radio while capture is 632 /* switching to radio while capture is
632 in progress is not polite */ 633 in progress is not polite */
633 cx18_release_stream(s); 634 cx18_release_stream(s);
@@ -662,6 +663,8 @@ int cx18_v4l2_open(struct inode *inode, struct file *filp)
662 for (x = 0; cx == NULL && x < cx18_cards_active; x++) { 663 for (x = 0; cx == NULL && x < cx18_cards_active; x++) {
663 /* find out which stream this open was on */ 664 /* find out which stream this open was on */
664 for (y = 0; y < CX18_MAX_STREAMS; y++) { 665 for (y = 0; y < CX18_MAX_STREAMS; y++) {
666 if (cx18_cards[x] == NULL)
667 continue;
665 s = &cx18_cards[x]->streams[y]; 668 s = &cx18_cards[x]->streams[y];
666 if (s->v4l2dev && s->v4l2dev->minor == minor) { 669 if (s->v4l2dev && s->v4l2dev->minor == minor) {
667 cx = cx18_cards[x]; 670 cx = cx18_cards[x];
@@ -692,7 +695,7 @@ int cx18_v4l2_open(struct inode *inode, struct file *filp)
692 695
693void cx18_mute(struct cx18 *cx) 696void cx18_mute(struct cx18 *cx)
694{ 697{
695 if (atomic_read(&cx->capturing)) 698 if (atomic_read(&cx->ana_capturing))
696 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, 699 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2,
697 cx18_find_handle(cx), 1); 700 cx18_find_handle(cx), 1);
698 CX18_DEBUG_INFO("Mute\n"); 701 CX18_DEBUG_INFO("Mute\n");
@@ -700,7 +703,7 @@ void cx18_mute(struct cx18 *cx)
700 703
701void cx18_unmute(struct cx18 *cx) 704void cx18_unmute(struct cx18 *cx)
702{ 705{
703 if (atomic_read(&cx->capturing)) { 706 if (atomic_read(&cx->ana_capturing)) {
704 cx18_msleep_timeout(100, 0); 707 cx18_msleep_timeout(100, 0);
705 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2, 708 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2,
706 cx18_find_handle(cx), 12); 709 cx18_find_handle(cx), 12);
diff --git a/drivers/media/video/cx18/cx18-fileops.h b/drivers/media/video/cx18/cx18-fileops.h
index 16cdafbd24c5..46da0282fc7d 100644
--- a/drivers/media/video/cx18/cx18-fileops.h
+++ b/drivers/media/video/cx18/cx18-fileops.h
@@ -34,12 +34,3 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
34void cx18_mute(struct cx18 *cx); 34void cx18_mute(struct cx18 *cx);
35void cx18_unmute(struct cx18 *cx); 35void cx18_unmute(struct cx18 *cx);
36 36
37/* Utilities */
38
39/* Try to claim a stream for the filehandle. Return 0 on success,
40 -EBUSY if stream already claimed. Once a stream is claimed, it
41 remains claimed until the associated filehandle is closed. */
42int cx18_claim_stream(struct cx18_open_id *id, int type);
43
44/* Release a previously claimed stream. */
45void cx18_release_stream(struct cx18_stream *s);
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c
index 19253e6b8673..ceb63653c926 100644
--- a/drivers/media/video/cx18/cx18-gpio.c
+++ b/drivers/media/video/cx18/cx18-gpio.c
@@ -44,31 +44,57 @@
44 * gpio13: cs5345 reset pin 44 * gpio13: cs5345 reset pin
45*/ 45*/
46 46
47static void gpio_write(struct cx18 *cx)
48{
49 u32 dir = cx->gpio_dir;
50 u32 val = cx->gpio_val;
51
52 write_reg((dir & 0xffff) << 16, CX18_REG_GPIO_DIR1);
53 write_reg(((dir & 0xffff) << 16) | (val & 0xffff),
54 CX18_REG_GPIO_OUT1);
55 write_reg(dir & 0xffff0000, CX18_REG_GPIO_DIR2);
56 write_reg((dir & 0xffff0000) | ((val & 0xffff0000) >> 16),
57 CX18_REG_GPIO_OUT2);
58}
59
47void cx18_gpio_init(struct cx18 *cx) 60void cx18_gpio_init(struct cx18 *cx)
48{ 61{
49 if (cx->card->gpio_init.direction == 0) 62 cx->gpio_dir = cx->card->gpio_init.direction;
63 cx->gpio_val = cx->card->gpio_init.initial_value;
64
65 if (cx->card->tuners[0].tuner == TUNER_XC2028) {
66 cx->gpio_dir |= 1 << cx->card->xceive_pin;
67 cx->gpio_val |= 1 << cx->card->xceive_pin;
68 }
69
70 if (cx->gpio_dir == 0)
50 return; 71 return;
51 72
52 CX18_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", 73 CX18_DEBUG_INFO("GPIO initial dir: %08x/%08x out: %08x/%08x\n",
53 read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_OUT1)); 74 read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_DIR2),
75 read_reg(CX18_REG_GPIO_OUT1), read_reg(CX18_REG_GPIO_OUT2));
54 76
55 /* init output data then direction */ 77 gpio_write(cx);
56 write_reg(cx->card->gpio_init.direction << 16, CX18_REG_GPIO_DIR1);
57 write_reg(0, CX18_REG_GPIO_DIR2);
58 write_reg((cx->card->gpio_init.direction << 16) |
59 cx->card->gpio_init.initial_value, CX18_REG_GPIO_OUT1);
60 write_reg(0, CX18_REG_GPIO_OUT2);
61} 78}
62 79
63/* Xceive tuner reset function */ 80/* Xceive tuner reset function */
64int cx18_reset_tuner_gpio(void *dev, int cmd, int value) 81int cx18_reset_tuner_gpio(void *dev, int cmd, int value)
65{ 82{
66 struct i2c_algo_bit_data *algo = dev; 83 struct i2c_algo_bit_data *algo = dev;
67 struct cx18 *cx = algo->data; 84 struct cx18_i2c_algo_callback_data *cb_data = algo->data;
68/* int curdir, curout;*/ 85 struct cx18 *cx = cb_data->cx;
69 86
70 if (cmd != XC2028_TUNER_RESET) 87 if (cmd != XC2028_TUNER_RESET)
71 return 0; 88 return 0;
72 CX18_DEBUG_INFO("Resetting tuner\n"); 89 CX18_DEBUG_INFO("Resetting tuner\n");
90
91 cx->gpio_val &= ~(1 << cx->card->xceive_pin);
92
93 gpio_write(cx);
94 schedule_timeout_interruptible(msecs_to_jiffies(1));
95
96 cx->gpio_val |= 1 << cx->card->xceive_pin;
97 gpio_write(cx);
98 schedule_timeout_interruptible(msecs_to_jiffies(1));
73 return 0; 99 return 0;
74} 100}
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 18c88d1e4833..1d6c51a75313 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -25,6 +25,7 @@
25#include "cx18-cards.h" 25#include "cx18-cards.h"
26#include "cx18-gpio.h" 26#include "cx18-gpio.h"
27#include "cx18-av-core.h" 27#include "cx18-av-core.h"
28#include "cx18-i2c.h"
28 29
29#include <media/ir-kbd-i2c.h> 30#include <media/ir-kbd-i2c.h>
30 31
@@ -73,7 +74,7 @@ static const u8 hw_bus[] = {
73}; 74};
74 75
75/* This array should match the CX18_HW_ defines */ 76/* This array should match the CX18_HW_ defines */
76static const char * const hw_drivernames[] = { 77static const char * const hw_devicenames[] = {
77 "tuner", 78 "tuner",
78 "tveeprom", 79 "tveeprom",
79 "cs5345", 80 "cs5345",
@@ -94,8 +95,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
94 id = hw_driverids[idx]; 95 id = hw_driverids[idx];
95 bus = hw_bus[idx]; 96 bus = hw_bus[idx];
96 memset(&info, 0, sizeof(info)); 97 memset(&info, 0, sizeof(info));
97 strlcpy(info.driver_name, hw_drivernames[idx], 98 strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
98 sizeof(info.driver_name));
99 info.addr = hw_addrs[idx]; 99 info.addr = hw_addrs[idx];
100 for (i = 0; i < I2C_CLIENTS_MAX; i++) 100 for (i = 0; i < I2C_CLIENTS_MAX; i++)
101 if (cx->i2c_clients[i] == NULL) 101 if (cx->i2c_clients[i] == NULL)
@@ -278,7 +278,7 @@ static const char *cx18_i2c_id_name(u32 id)
278 278
279 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) 279 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
280 if (hw_driverids[i] == id) 280 if (hw_driverids[i] == id)
281 return hw_drivernames[i]; 281 return hw_devicenames[i];
282 return "unknown device"; 282 return "unknown device";
283} 283}
284 284
@@ -289,7 +289,7 @@ static const char *cx18_i2c_hw_name(u32 hw)
289 289
290 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) 290 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
291 if (1 << i == hw) 291 if (1 << i == hw)
292 return hw_drivernames[i]; 292 return hw_devicenames[i];
293 return "unknown device"; 293 return "unknown device";
294} 294}
295 295
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index dbdcb86ec5aa..4151f1e5493f 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -247,7 +247,7 @@ static int cx18_try_or_set_fmt(struct cx18 *cx, int streamtype,
247 247
248 if (!set_fmt || (cx->params.width == w && cx->params.height == h)) 248 if (!set_fmt || (cx->params.width == w && cx->params.height == h))
249 return 0; 249 return 0;
250 if (atomic_read(&cx->capturing) > 0) 250 if (atomic_read(&cx->ana_capturing) > 0)
251 return -EBUSY; 251 return -EBUSY;
252 252
253 cx->params.width = w; 253 cx->params.width = w;
@@ -264,7 +264,7 @@ static int cx18_try_or_set_fmt(struct cx18 *cx, int streamtype,
264 if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 264 if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
265 if (set_fmt && streamtype == CX18_ENC_STREAM_TYPE_VBI && 265 if (set_fmt && streamtype == CX18_ENC_STREAM_TYPE_VBI &&
266 cx->vbi.sliced_in->service_set && 266 cx->vbi.sliced_in->service_set &&
267 atomic_read(&cx->capturing) > 0) 267 atomic_read(&cx->ana_capturing) > 0)
268 return -EBUSY; 268 return -EBUSY;
269 if (set_fmt) { 269 if (set_fmt) {
270 cx->vbi.sliced_in->service_set = 0; 270 cx->vbi.sliced_in->service_set = 0;
@@ -293,7 +293,7 @@ static int cx18_try_or_set_fmt(struct cx18 *cx, int streamtype,
293 return 0; 293 return 0;
294 if (set == 0) 294 if (set == 0)
295 return -EINVAL; 295 return -EINVAL;
296 if (atomic_read(&cx->capturing) > 0 && cx->vbi.sliced_in->service_set == 0) 296 if (atomic_read(&cx->ana_capturing) > 0 && cx->vbi.sliced_in->service_set == 0)
297 return -EBUSY; 297 return -EBUSY;
298 cx18_av_cmd(cx, VIDIOC_S_FMT, fmt); 298 cx18_av_cmd(cx, VIDIOC_S_FMT, fmt);
299 memcpy(cx->vbi.sliced_in, vbifmt, sizeof(*cx->vbi.sliced_in)); 299 memcpy(cx->vbi.sliced_in, vbifmt, sizeof(*cx->vbi.sliced_in));
@@ -581,7 +581,7 @@ int cx18_v4l2_ioctls(struct cx18 *cx, struct file *filp, unsigned cmd, void *arg
581 break; 581 break;
582 582
583 if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags) || 583 if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags) ||
584 atomic_read(&cx->capturing) > 0) { 584 atomic_read(&cx->ana_capturing) > 0) {
585 /* Switching standard would turn off the radio or mess 585 /* Switching standard would turn off the radio or mess
586 with already running streams, prevent that by 586 with already running streams, prevent that by
587 returning EBUSY. */ 587 returning EBUSY. */
@@ -677,7 +677,7 @@ int cx18_v4l2_ioctls(struct cx18 *cx, struct file *filp, unsigned cmd, void *arg
677 enc->flags = 0; 677 enc->flags = 0;
678 if (try) 678 if (try)
679 return 0; 679 return 0;
680 if (!atomic_read(&cx->capturing)) 680 if (!atomic_read(&cx->ana_capturing))
681 return -EPERM; 681 return -EPERM;
682 if (test_and_set_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) 682 if (test_and_set_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags))
683 return 0; 683 return 0;
@@ -689,7 +689,7 @@ int cx18_v4l2_ioctls(struct cx18 *cx, struct file *filp, unsigned cmd, void *arg
689 enc->flags = 0; 689 enc->flags = 0;
690 if (try) 690 if (try)
691 return 0; 691 return 0;
692 if (!atomic_read(&cx->capturing)) 692 if (!atomic_read(&cx->ana_capturing))
693 return -EPERM; 693 return -EPERM;
694 if (!test_and_clear_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) 694 if (!test_and_clear_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags))
695 return 0; 695 return 0;
diff --git a/drivers/media/video/cx18/cx18-irq.c b/drivers/media/video/cx18/cx18-irq.c
index 6e14f8bda559..25114a5cbd57 100644
--- a/drivers/media/video/cx18/cx18-irq.c
+++ b/drivers/media/video/cx18/cx18-irq.c
@@ -75,7 +75,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb)
75 75
76 cx18_buf_sync_for_device(s, buf); 76 cx18_buf_sync_for_device(s, buf);
77 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, 77 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle,
78 (void *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, 78 (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem,
79 1, buf->id, s->buf_size); 79 1, buf->id, s->buf_size);
80 } else 80 } else
81 set_bit(CX18_F_B_NEED_BUF_SWAP, &buf->b_flags); 81 set_bit(CX18_F_B_NEED_BUF_SWAP, &buf->b_flags);
@@ -161,13 +161,15 @@ irqreturn_t cx18_irq_handler(int irq, void *dev_id)
161 */ 161 */
162 162
163 if (sw2) { 163 if (sw2) {
164 if (sw2 & (cx->scb->cpu2hpu_irq_ack | cx->scb->cpu2epu_irq_ack)) 164 if (sw2 & (readl(&cx->scb->cpu2hpu_irq_ack) |
165 readl(&cx->scb->cpu2epu_irq_ack)))
165 wake_up(&cx->mb_cpu_waitq); 166 wake_up(&cx->mb_cpu_waitq);
166 if (sw2 & (cx->scb->apu2hpu_irq_ack | cx->scb->apu2epu_irq_ack)) 167 if (sw2 & (readl(&cx->scb->apu2hpu_irq_ack) |
168 readl(&cx->scb->apu2epu_irq_ack)))
167 wake_up(&cx->mb_apu_waitq); 169 wake_up(&cx->mb_apu_waitq);
168 if (sw2 & cx->scb->epu2hpu_irq_ack) 170 if (sw2 & readl(&cx->scb->epu2hpu_irq_ack))
169 wake_up(&cx->mb_epu_waitq); 171 wake_up(&cx->mb_epu_waitq);
170 if (sw2 & cx->scb->hpu2epu_irq_ack) 172 if (sw2 & readl(&cx->scb->hpu2epu_irq_ack))
171 wake_up(&cx->mb_hpu_waitq); 173 wake_up(&cx->mb_hpu_waitq);
172 } 174 }
173 175
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c
index 0c5f328bca54..2a5ccef9185b 100644
--- a/drivers/media/video/cx18/cx18-mailbox.c
+++ b/drivers/media/video/cx18/cx18-mailbox.c
@@ -94,10 +94,10 @@ static const struct cx18_api_info *find_api_info(u32 cmd)
94 return NULL; 94 return NULL;
95} 95}
96 96
97static struct cx18_mailbox *cx18_mb_is_complete(struct cx18 *cx, int rpu, 97static struct cx18_mailbox __iomem *cx18_mb_is_complete(struct cx18 *cx, int rpu,
98 u32 *state, u32 *irq, u32 *req) 98 u32 *state, u32 *irq, u32 *req)
99{ 99{
100 struct cx18_mailbox *mb = NULL; 100 struct cx18_mailbox __iomem *mb = NULL;
101 int wait_count = 0; 101 int wait_count = 0;
102 u32 ack; 102 u32 ack;
103 103
@@ -142,7 +142,7 @@ static struct cx18_mailbox *cx18_mb_is_complete(struct cx18 *cx, int rpu,
142long cx18_mb_ack(struct cx18 *cx, const struct cx18_mailbox *mb) 142long cx18_mb_ack(struct cx18 *cx, const struct cx18_mailbox *mb)
143{ 143{
144 const struct cx18_api_info *info = find_api_info(mb->cmd); 144 const struct cx18_api_info *info = find_api_info(mb->cmd);
145 struct cx18_mailbox *ack_mb; 145 struct cx18_mailbox __iomem *ack_mb;
146 u32 ack_irq; 146 u32 ack_irq;
147 u8 rpu = CPU; 147 u8 rpu = CPU;
148 148
@@ -182,7 +182,7 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
182{ 182{
183 const struct cx18_api_info *info = find_api_info(cmd); 183 const struct cx18_api_info *info = find_api_info(cmd);
184 u32 state = 0, irq = 0, req, oldreq, err; 184 u32 state = 0, irq = 0, req, oldreq, err;
185 struct cx18_mailbox *mb; 185 struct cx18_mailbox __iomem *mb;
186 wait_queue_head_t *waitq; 186 wait_queue_head_t *waitq;
187 int timeout = 100; 187 int timeout = 100;
188 int cnt = 0; 188 int cnt = 0;
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c
index 65af1bb507ca..6990b77c6200 100644
--- a/drivers/media/video/cx18/cx18-queue.c
+++ b/drivers/media/video/cx18/cx18-queue.c
@@ -26,17 +26,6 @@
26#include "cx18-queue.h" 26#include "cx18-queue.h"
27#include "cx18-scb.h" 27#include "cx18-scb.h"
28 28
29int cx18_buf_copy_from_user(struct cx18_stream *s, struct cx18_buffer *buf,
30 const char __user *src, int copybytes)
31{
32 if (s->buf_size - buf->bytesused < copybytes)
33 copybytes = s->buf_size - buf->bytesused;
34 if (copy_from_user(buf->buf + buf->bytesused, src, copybytes))
35 return -EFAULT;
36 buf->bytesused += copybytes;
37 return copybytes;
38}
39
40void cx18_buf_swap(struct cx18_buffer *buf) 29void cx18_buf_swap(struct cx18_buffer *buf)
41{ 30{
42 int i; 31 int i;
@@ -159,8 +148,9 @@ static void cx18_queue_move_buf(struct cx18_stream *s, struct cx18_queue *from,
159 -ENOMEM is returned if the buffers could not be obtained, 0 if all 148 -ENOMEM is returned if the buffers could not be obtained, 0 if all
160 buffers where obtained from the 'from' list and if non-zero then 149 buffers where obtained from the 'from' list and if non-zero then
161 the number of stolen buffers is returned. */ 150 the number of stolen buffers is returned. */
162int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from, 151static int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from,
163 struct cx18_queue *steal, struct cx18_queue *to, int needed_bytes) 152 struct cx18_queue *steal, struct cx18_queue *to,
153 int needed_bytes)
164{ 154{
165 unsigned long flags; 155 unsigned long flags;
166 int rc = 0; 156 int rc = 0;
@@ -239,12 +229,12 @@ int cx18_stream_alloc(struct cx18_stream *s)
239 229
240 /* allocate stream buffers. Initially all buffers are in q_free. */ 230 /* allocate stream buffers. Initially all buffers are in q_free. */
241 for (i = 0; i < s->buffers; i++) { 231 for (i = 0; i < s->buffers; i++) {
242 struct cx18_buffer *buf = 232 struct cx18_buffer *buf = kzalloc(sizeof(struct cx18_buffer),
243 kzalloc(sizeof(struct cx18_buffer), GFP_KERNEL); 233 GFP_KERNEL|__GFP_NOWARN);
244 234
245 if (buf == NULL) 235 if (buf == NULL)
246 break; 236 break;
247 buf->buf = kmalloc(s->buf_size, GFP_KERNEL); 237 buf->buf = kmalloc(s->buf_size, GFP_KERNEL|__GFP_NOWARN);
248 if (buf->buf == NULL) { 238 if (buf->buf == NULL) {
249 kfree(buf); 239 kfree(buf);
250 break; 240 break;
diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h
index f86c8a6fa6e7..91423b9863a4 100644
--- a/drivers/media/video/cx18/cx18-queue.h
+++ b/drivers/media/video/cx18/cx18-queue.h
@@ -39,8 +39,6 @@ static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
39 s->buf_size, s->dma); 39 s->buf_size, s->dma);
40} 40}
41 41
42int cx18_buf_copy_from_user(struct cx18_stream *s, struct cx18_buffer *buf,
43 const char __user *src, int copybytes);
44void cx18_buf_swap(struct cx18_buffer *buf); 42void cx18_buf_swap(struct cx18_buffer *buf);
45 43
46/* cx18_queue utility functions */ 44/* cx18_queue utility functions */
@@ -48,8 +46,6 @@ void cx18_queue_init(struct cx18_queue *q);
48void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, 46void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,
49 struct cx18_queue *q); 47 struct cx18_queue *q);
50struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); 48struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q);
51int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from,
52 struct cx18_queue *steal, struct cx18_queue *to, int needed_bytes);
53struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, 49struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id,
54 u32 bytesused); 50 u32 bytesused);
55void cx18_flush_queues(struct cx18_stream *s); 51void cx18_flush_queues(struct cx18_stream *s);
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index afb141b2027a..1b921a336092 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -36,12 +36,13 @@
36#define CX18_DSP0_INTERRUPT_MASK 0xd0004C 36#define CX18_DSP0_INTERRUPT_MASK 0xd0004C
37 37
38static struct file_operations cx18_v4l2_enc_fops = { 38static struct file_operations cx18_v4l2_enc_fops = {
39 .owner = THIS_MODULE, 39 .owner = THIS_MODULE,
40 .read = cx18_v4l2_read, 40 .read = cx18_v4l2_read,
41 .open = cx18_v4l2_open, 41 .open = cx18_v4l2_open,
42 .ioctl = cx18_v4l2_ioctl, 42 .ioctl = cx18_v4l2_ioctl,
43 .release = cx18_v4l2_close, 43 .compat_ioctl = v4l_compat_ioctl32,
44 .poll = cx18_v4l2_enc_poll, 44 .release = cx18_v4l2_close,
45 .poll = cx18_v4l2_enc_poll,
45}; 46};
46 47
47/* offset from 0 to register ts v4l2 minors on */ 48/* offset from 0 to register ts v4l2 minors on */
@@ -218,7 +219,7 @@ int cx18_streams_setup(struct cx18 *cx)
218 return 0; 219 return 0;
219 220
220 /* One or more streams could not be initialized. Clean 'em all up. */ 221 /* One or more streams could not be initialized. Clean 'em all up. */
221 cx18_streams_cleanup(cx); 222 cx18_streams_cleanup(cx, 0);
222 return -ENOMEM; 223 return -ENOMEM;
223} 224}
224 225
@@ -296,12 +297,12 @@ int cx18_streams_register(struct cx18 *cx)
296 return 0; 297 return 0;
297 298
298 /* One or more streams could not be initialized. Clean 'em all up. */ 299 /* One or more streams could not be initialized. Clean 'em all up. */
299 cx18_streams_cleanup(cx); 300 cx18_streams_cleanup(cx, 1);
300 return -ENOMEM; 301 return -ENOMEM;
301} 302}
302 303
303/* Unregister v4l2 devices */ 304/* Unregister v4l2 devices */
304void cx18_streams_cleanup(struct cx18 *cx) 305void cx18_streams_cleanup(struct cx18 *cx, int unregister)
305{ 306{
306 struct video_device *vdev; 307 struct video_device *vdev;
307 int type; 308 int type;
@@ -319,8 +320,11 @@ void cx18_streams_cleanup(struct cx18 *cx)
319 320
320 cx18_stream_free(&cx->streams[type]); 321 cx18_stream_free(&cx->streams[type]);
321 322
322 /* Unregister device */ 323 /* Unregister or release device */
323 video_unregister_device(vdev); 324 if (unregister)
325 video_unregister_device(vdev);
326 else
327 video_device_release(vdev);
324 } 328 }
325} 329}
326 330
@@ -440,7 +444,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
440 s->handle = data[0]; 444 s->handle = data[0];
441 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); 445 cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
442 446
443 if (atomic_read(&cx->capturing) == 0 && !ts) { 447 if (atomic_read(&cx->ana_capturing) == 0 && !ts) {
444 /* Stuff from Windows, we don't know what it is */ 448 /* Stuff from Windows, we don't know what it is */
445 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); 449 cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
446 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1); 450 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
@@ -463,14 +467,14 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
463 cx2341x_update(cx, cx18_api_func, NULL, &cx->params); 467 cx2341x_update(cx, cx18_api_func, NULL, &cx->params);
464 } 468 }
465 469
466 if (atomic_read(&cx->capturing) == 0) { 470 if (atomic_read(&cx->tot_capturing) == 0) {
467 clear_bit(CX18_F_I_EOS, &cx->i_flags); 471 clear_bit(CX18_F_I_EOS, &cx->i_flags);
468 write_reg(7, CX18_DSP0_INTERRUPT_MASK); 472 write_reg(7, CX18_DSP0_INTERRUPT_MASK);
469 } 473 }
470 474
471 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle, 475 cx18_vapi(cx, CX18_CPU_DE_SET_MDL_ACK, 3, s->handle,
472 (void *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem, 476 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][0] - cx->enc_mem,
473 (void *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem); 477 (void __iomem *)&cx->scb->cpu_mdl_ack[s->type][1] - cx->enc_mem);
474 478
475 list_for_each(p, &s->q_free.list) { 479 list_for_each(p, &s->q_free.list) {
476 struct cx18_buffer *buf = list_entry(p, struct cx18_buffer, list); 480 struct cx18_buffer *buf = list_entry(p, struct cx18_buffer, list);
@@ -478,8 +482,8 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
478 writel(buf->dma_handle, &cx->scb->cpu_mdl[buf->id].paddr); 482 writel(buf->dma_handle, &cx->scb->cpu_mdl[buf->id].paddr);
479 writel(s->buf_size, &cx->scb->cpu_mdl[buf->id].length); 483 writel(s->buf_size, &cx->scb->cpu_mdl[buf->id].length);
480 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, 484 cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle,
481 (void *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, 1, 485 (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem,
482 buf->id, s->buf_size); 486 1, buf->id, s->buf_size);
483 } 487 }
484 /* begin_capture */ 488 /* begin_capture */
485 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { 489 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) {
@@ -489,7 +493,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
489 } 493 }
490 494
491 /* you're live! sit back and await interrupts :) */ 495 /* you're live! sit back and await interrupts :) */
492 atomic_inc(&cx->capturing); 496 if (!ts)
497 atomic_inc(&cx->ana_capturing);
498 atomic_inc(&cx->tot_capturing);
493 return 0; 499 return 0;
494} 500}
495 501
@@ -520,7 +526,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
520 526
521 CX18_DEBUG_INFO("Stop Capture\n"); 527 CX18_DEBUG_INFO("Stop Capture\n");
522 528
523 if (atomic_read(&cx->capturing) == 0) 529 if (atomic_read(&cx->tot_capturing) == 0)
524 return 0; 530 return 0;
525 531
526 if (s->type == CX18_ENC_STREAM_TYPE_MPG) 532 if (s->type == CX18_ENC_STREAM_TYPE_MPG)
@@ -534,7 +540,9 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
534 CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n"); 540 CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n");
535 } 541 }
536 542
537 atomic_dec(&cx->capturing); 543 if (s->type != CX18_ENC_STREAM_TYPE_TS)
544 atomic_dec(&cx->ana_capturing);
545 atomic_dec(&cx->tot_capturing);
538 546
539 /* Clear capture and no-read bits */ 547 /* Clear capture and no-read bits */
540 clear_bit(CX18_F_S_STREAMING, &s->s_flags); 548 clear_bit(CX18_F_S_STREAMING, &s->s_flags);
@@ -542,7 +550,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
542 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); 550 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
543 s->handle = 0xffffffff; 551 s->handle = 0xffffffff;
544 552
545 if (atomic_read(&cx->capturing) > 0) 553 if (atomic_read(&cx->tot_capturing) > 0)
546 return 0; 554 return 0;
547 555
548 write_reg(5, CX18_DSP0_INTERRUPT_MASK); 556 write_reg(5, CX18_DSP0_INTERRUPT_MASK);
diff --git a/drivers/media/video/cx18/cx18-streams.h b/drivers/media/video/cx18/cx18-streams.h
index 8c7ba7d2fa79..f327e947b24f 100644
--- a/drivers/media/video/cx18/cx18-streams.h
+++ b/drivers/media/video/cx18/cx18-streams.h
@@ -24,7 +24,7 @@
24u32 cx18_find_handle(struct cx18 *cx); 24u32 cx18_find_handle(struct cx18 *cx);
25int cx18_streams_setup(struct cx18 *cx); 25int cx18_streams_setup(struct cx18 *cx);
26int cx18_streams_register(struct cx18 *cx); 26int cx18_streams_register(struct cx18 *cx);
27void cx18_streams_cleanup(struct cx18 *cx); 27void cx18_streams_cleanup(struct cx18 *cx, int unregister);
28 28
29/* Capture related */ 29/* Capture related */
30int cx18_start_v4l2_encode_stream(struct cx18_stream *s); 30int cx18_start_v4l2_encode_stream(struct cx18_stream *s);
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig
index cadf936c3673..7bf14c9a15c7 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,18 +1,20 @@
1config VIDEO_CX23885 1config VIDEO_CX23885
2 tristate "Conexant cx23885 (2388x successor) support" 2 tristate "Conexant cx23885 (2388x successor) support"
3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT 3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
4 depends on HOTPLUG # due to FW_LOADER
4 select I2C_ALGOBIT 5 select I2C_ALGOBIT
5 select FW_LOADER 6 select FW_LOADER
6 select VIDEO_BTCX 7 select VIDEO_BTCX
7 select MEDIA_TUNER 8 select VIDEO_TUNER
8 select VIDEO_TVEEPROM 9 select VIDEO_TVEEPROM
9 select VIDEO_IR 10 select VIDEO_IR
10 select VIDEOBUF_DVB 11 select VIDEOBUF_DVB
11 select VIDEO_CX25840 12 select VIDEO_CX25840
13 select VIDEO_CX2341X
14 select DVB_DIB7000P if !DVB_FE_CUSTOMISE
12 select MEDIA_TUNER_MT2131 if !DVB_FE_CUSTOMISE 15 select MEDIA_TUNER_MT2131 if !DVB_FE_CUSTOMISE
13 select DVB_S5H1409 if !DVB_FE_CUSTOMISE 16 select DVB_S5H1409 if !DVB_FE_CUSTOMISE
14 select DVB_LGDT330X if !DVB_FE_CUSTOMISE 17 select DVB_LGDT330X if !DVB_FE_CUSTOMISE
15 select DVB_PLL if !DVB_FE_CUSTOMISE
16 select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMIZE 18 select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMIZE
17 select MEDIA_TUNER_TDA8290 if !DVB_FE_CUSTOMIZE 19 select MEDIA_TUNER_TDA8290 if !DVB_FE_CUSTOMIZE
18 select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE 20 select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 6ebf58724a01..20e05f230546 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -200,6 +200,10 @@ struct cx23885_subid cx23885_subids[] = {
200 .card = CX23885_BOARD_HAUPPAUGE_HVR1200, 200 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
201 }, { 201 }, {
202 .subvendor = 0x0070, 202 .subvendor = 0x0070,
203 .subdevice = 0x71d3,
204 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
205 }, {
206 .subvendor = 0x0070,
203 .subdevice = 0x8101, 207 .subdevice = 0x8101,
204 .card = CX23885_BOARD_HAUPPAUGE_HVR1700, 208 .card = CX23885_BOARD_HAUPPAUGE_HVR1700,
205 }, { 209 }, {
@@ -245,6 +249,33 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
245 /* Make sure we support the board model */ 249 /* Make sure we support the board model */
246 switch (tv.model) 250 switch (tv.model)
247 { 251 {
252 case 71009:
253 /* WinTV-HVR1200 (PCIe, Retail, full height)
254 * DVB-T and basic analog */
255 case 71359:
256 /* WinTV-HVR1200 (PCIe, OEM, half height)
257 * DVB-T and basic analog */
258 case 71439:
259 /* WinTV-HVR1200 (PCIe, OEM, half height)
260 * DVB-T and basic analog */
261 case 71449:
262 /* WinTV-HVR1200 (PCIe, OEM, full height)
263 * DVB-T and basic analog */
264 case 71939:
265 /* WinTV-HVR1200 (PCIe, OEM, half height)
266 * DVB-T and basic analog */
267 case 71949:
268 /* WinTV-HVR1200 (PCIe, OEM, full height)
269 * DVB-T and basic analog */
270 case 71959:
271 /* WinTV-HVR1200 (PCIe, OEM, full height)
272 * DVB-T and basic analog */
273 case 71979:
274 /* WinTV-HVR1200 (PCIe, OEM, half height)
275 * DVB-T and basic analog */
276 case 71999:
277 /* WinTV-HVR1200 (PCIe, OEM, full height)
278 * DVB-T and basic analog */
248 case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */ 279 case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */
249 case 77001: /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC and Basic analog */ 280 case 77001: /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC and Basic analog */
250 case 77011: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */ 281 case 77011: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */
@@ -263,8 +294,11 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
263 case 80019: 294 case 80019:
264 /* WinTV-HVR1400 (Express Card, Retail, IR, 295 /* WinTV-HVR1400 (Express Card, Retail, IR,
265 * DVB-T and Basic analog */ 296 * DVB-T and Basic analog */
297 case 81509:
298 /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
299 * DVB-T and MPEG2 HW Encoder */
266 case 81519: 300 case 81519:
267 /* WinTV-HVR1700 (PCIe, Retail, No IR, half height, 301 /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
268 * DVB-T and MPEG2 HW Encoder */ 302 * DVB-T and MPEG2 HW Encoder */
269 break; 303 break;
270 default: 304 default:
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index f24abcd06dea..c4cc2f3b8876 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -823,7 +823,7 @@ static void cx23885_dev_unregister(struct cx23885_dev *dev)
823 iounmap(dev->lmmio); 823 iounmap(dev->lmmio);
824} 824}
825 825
826static u32* cx23885_risc_field(u32 *rp, struct scatterlist *sglist, 826static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist,
827 unsigned int offset, u32 sync_line, 827 unsigned int offset, u32 sync_line,
828 unsigned int bpl, unsigned int padding, 828 unsigned int bpl, unsigned int padding,
829 unsigned int lines) 829 unsigned int lines)
@@ -883,7 +883,7 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
883 unsigned int padding, unsigned int lines) 883 unsigned int padding, unsigned int lines)
884{ 884{
885 u32 instructions, fields; 885 u32 instructions, fields;
886 u32 *rp; 886 __le32 *rp;
887 int rc; 887 int rc;
888 888
889 fields = 0; 889 fields = 0;
@@ -924,7 +924,7 @@ static int cx23885_risc_databuffer(struct pci_dev *pci,
924 unsigned int lines) 924 unsigned int lines)
925{ 925{
926 u32 instructions; 926 u32 instructions;
927 u32 *rp; 927 __le32 *rp;
928 int rc; 928 int rc;
929 929
930 /* estimate risc mem: worst case is one write per page border + 930 /* estimate risc mem: worst case is one write per page border +
@@ -951,7 +951,7 @@ static int cx23885_risc_databuffer(struct pci_dev *pci,
951int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 951int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
952 u32 reg, u32 mask, u32 value) 952 u32 reg, u32 mask, u32 value)
953{ 953{
954 u32 *rp; 954 __le32 *rp;
955 int rc; 955 int rc;
956 956
957 if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0) 957 if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0)
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index f05649727b60..022aa391937a 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -37,7 +37,6 @@
37#include "lgdt330x.h" 37#include "lgdt330x.h"
38#include "xc5000.h" 38#include "xc5000.h"
39#include "tda10048.h" 39#include "tda10048.h"
40#include "dvb-pll.h"
41#include "tuner-xc2028.h" 40#include "tuner-xc2028.h"
42#include "tuner-simple.h" 41#include "tuner-simple.h"
43#include "dib7000p.h" 42#include "dib7000p.h"
@@ -385,12 +384,10 @@ static int dvb_register(struct cx23885_tsport *port)
385 port->dvb.frontend = dvb_attach(s5h1409_attach, 384 port->dvb.frontend = dvb_attach(s5h1409_attach,
386 &hauppauge_hvr1500q_config, 385 &hauppauge_hvr1500q_config,
387 &dev->i2c_bus[0].i2c_adap); 386 &dev->i2c_bus[0].i2c_adap);
388 if (port->dvb.frontend != NULL) { 387 if (port->dvb.frontend != NULL)
389 hauppauge_hvr1500q_tunerconfig.priv = i2c_bus;
390 dvb_attach(xc5000_attach, port->dvb.frontend, 388 dvb_attach(xc5000_attach, port->dvb.frontend,
391 &i2c_bus->i2c_adap, 389 &i2c_bus->i2c_adap,
392 &hauppauge_hvr1500q_tunerconfig); 390 &hauppauge_hvr1500q_tunerconfig, i2c_bus);
393 }
394 break; 391 break;
395 case CX23885_BOARD_HAUPPAUGE_HVR1500: 392 case CX23885_BOARD_HAUPPAUGE_HVR1500:
396 i2c_bus = &dev->i2c_bus[1]; 393 i2c_bus = &dev->i2c_bus[1];
diff --git a/drivers/media/video/cx25840/Kconfig b/drivers/media/video/cx25840/Kconfig
index 7cf29a03ed63..448f4cd0ce34 100644
--- a/drivers/media/video/cx25840/Kconfig
+++ b/drivers/media/video/cx25840/Kconfig
@@ -1,6 +1,7 @@
1config VIDEO_CX25840 1config VIDEO_CX25840
2 tristate "Conexant CX2584x audio/video decoders" 2 tristate "Conexant CX2584x audio/video decoders"
3 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
4 depends on HOTPLUG # due to FW_LOADER
4 select FW_LOADER 5 select FW_LOADER
5 ---help--- 6 ---help---
6 Support for the Conexant CX2584x audio/video decoders. 7 Support for the Conexant CX2584x audio/video decoders.
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 88823810497c..607efdcd22f8 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1284,10 +1284,17 @@ static int cx25840_remove(struct i2c_client *client)
1284 return 0; 1284 return 0;
1285} 1285}
1286 1286
1287static const struct i2c_device_id cx25840_id[] = {
1288 { "cx25840", 0 },
1289 { }
1290};
1291MODULE_DEVICE_TABLE(i2c, cx25840_id);
1292
1287static struct v4l2_i2c_driver_data v4l2_i2c_data = { 1293static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1288 .name = "cx25840", 1294 .name = "cx25840",
1289 .driverid = I2C_DRIVERID_CX25840, 1295 .driverid = I2C_DRIVERID_CX25840,
1290 .command = cx25840_command, 1296 .command = cx25840_command,
1291 .probe = cx25840_probe, 1297 .probe = cx25840_probe,
1292 .remove = cx25840_remove, 1298 .remove = cx25840_remove,
1299 .id_table = cx25840_id,
1293}; 1300};
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index b0d7d6a7a4cc..10e20d8196dc 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -2,10 +2,9 @@ config VIDEO_CX88
2 tristate "Conexant 2388x (bt878 successor) support" 2 tristate "Conexant 2388x (bt878 successor) support"
3 depends on VIDEO_DEV && PCI && I2C && INPUT 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER
6 select VIDEO_BTCX 5 select VIDEO_BTCX
7 select VIDEOBUF_DMA_SG 6 select VIDEOBUF_DMA_SG
8 select MEDIA_TUNER 7 select VIDEO_TUNER
9 select VIDEO_TVEEPROM 8 select VIDEO_TVEEPROM
10 select VIDEO_IR 9 select VIDEO_IR
11 select VIDEO_WM8775 if VIDEO_HELPER_CHIPS_AUTO 10 select VIDEO_WM8775 if VIDEO_HELPER_CHIPS_AUTO
@@ -34,8 +33,9 @@ config VIDEO_CX88_ALSA
34 33
35config VIDEO_CX88_BLACKBIRD 34config VIDEO_CX88_BLACKBIRD
36 tristate "Blackbird MPEG encoder support (cx2388x + cx23416)" 35 tristate "Blackbird MPEG encoder support (cx2388x + cx23416)"
37 depends on VIDEO_CX88 36 depends on VIDEO_CX88 && HOTPLUG
38 select VIDEO_CX2341X 37 select VIDEO_CX2341X
38 select FW_LOADER
39 ---help--- 39 ---help---
40 This adds support for MPEG encoder cards based on the 40 This adds support for MPEG encoder cards based on the
41 Blackbird reference design, using the Conexant 2388x 41 Blackbird reference design, using the Conexant 2388x
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index aeba26dc0a37..fa6d398e97b9 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1493,10 +1493,16 @@ static const struct cx88_board cx88_boards[] = {
1493 }, 1493 },
1494 }, 1494 },
1495 [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = { 1495 [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
1496 .name = "PowerColor Real Angel 330", 1496 .name = "PowerColor RA330", /* Long names may confuse LIRC. */
1497 .tuner_type = TUNER_XC2028, 1497 .tuner_type = TUNER_XC2028,
1498 .tuner_addr = 0x61, 1498 .tuner_addr = 0x61,
1499 .input = { { 1499 .input = { {
1500 .type = CX88_VMUX_DEBUG,
1501 .vmux = 3, /* Due to the way the cx88 driver is written, */
1502 .gpio0 = 0x00ff, /* there is no way to deactivate audio pass- */
1503 .gpio1 = 0xf39d, /* through without this entry. Furthermore, if */
1504 .gpio3 = 0x0000, /* the TV mux entry is first, you get audio */
1505 }, { /* from the tuner on boot for a little while. */
1500 .type = CX88_VMUX_TELEVISION, 1506 .type = CX88_VMUX_TELEVISION,
1501 .vmux = 0, 1507 .vmux = 0,
1502 .gpio0 = 0x00ff, 1508 .gpio0 = 0x00ff,
@@ -2424,8 +2430,9 @@ void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl)
2424 2430
2425 switch (core->boardnr) { 2431 switch (core->boardnr) {
2426 case CX88_BOARD_POWERCOLOR_REAL_ANGEL: 2432 case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2427 /* Doesn't work with firmware version 2.7 */ 2433 /* Now works with firmware version 2.7 */
2428 ctl->fname = "xc3028-v25.fw"; 2434 if (core->i2c_algo.udelay < 16)
2435 core->i2c_algo.udelay = 16;
2429 break; 2436 break;
2430 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: 2437 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2431 ctl->scode_table = XC3028_FE_ZARLINK456; 2438 ctl->scode_table = XC3028_FE_ZARLINK456;
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index c4d1aff1fdb4..60eeda3057e9 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -70,7 +70,7 @@ static DEFINE_MUTEX(devlist);
70 70
71/* @lpi: lines per IRQ, or 0 to not generate irqs. Note: IRQ to be 71/* @lpi: lines per IRQ, or 0 to not generate irqs. Note: IRQ to be
72 generated _after_ lpi lines are transferred. */ 72 generated _after_ lpi lines are transferred. */
73static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist, 73static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
74 unsigned int offset, u32 sync_line, 74 unsigned int offset, u32 sync_line,
75 unsigned int bpl, unsigned int padding, 75 unsigned int bpl, unsigned int padding,
76 unsigned int lines, unsigned int lpi) 76 unsigned int lines, unsigned int lpi)
@@ -130,7 +130,7 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
130 unsigned int bpl, unsigned int padding, unsigned int lines) 130 unsigned int bpl, unsigned int padding, unsigned int lines)
131{ 131{
132 u32 instructions,fields; 132 u32 instructions,fields;
133 u32 *rp; 133 __le32 *rp;
134 int rc; 134 int rc;
135 135
136 fields = 0; 136 fields = 0;
@@ -168,7 +168,7 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
168 unsigned int lines, unsigned int lpi) 168 unsigned int lines, unsigned int lpi)
169{ 169{
170 u32 instructions; 170 u32 instructions;
171 u32 *rp; 171 __le32 *rp;
172 int rc; 172 int rc;
173 173
174 /* estimate risc mem: worst case is one write per page border + 174 /* estimate risc mem: worst case is one write per page border +
@@ -193,7 +193,7 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
193int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 193int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
194 u32 reg, u32 mask, u32 value) 194 u32 reg, u32 mask, u32 value)
195{ 195{
196 u32 *rp; 196 __le32 *rp;
197 int rc; 197 int rc;
198 198
199 if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0) 199 if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0)
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 1c7fe6862a60..d96173ff1dba 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -509,9 +509,6 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
509 if (!fe) { 509 if (!fe) {
510 printk(KERN_ERR "%s/2: xc3028 attach failed\n", 510 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
511 dev->core->name); 511 dev->core->name);
512 dvb_frontend_detach(dev->dvb.frontend);
513 dvb_unregister_frontend(dev->dvb.frontend);
514 dev->dvb.frontend = NULL;
515 return -EINVAL; 512 return -EINVAL;
516 } 513 }
517 514
@@ -523,20 +520,23 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
523 520
524static int dvb_register(struct cx8802_dev *dev) 521static int dvb_register(struct cx8802_dev *dev)
525{ 522{
523 struct cx88_core *core = dev->core;
524
526 /* init struct videobuf_dvb */ 525 /* init struct videobuf_dvb */
527 dev->dvb.name = dev->core->name; 526 dev->dvb.name = core->name;
528 dev->ts_gen_cntrl = 0x0c; 527 dev->ts_gen_cntrl = 0x0c;
529 528
530 /* init frontend */ 529 /* init frontend */
531 switch (dev->core->boardnr) { 530 switch (core->boardnr) {
532 case CX88_BOARD_HAUPPAUGE_DVB_T1: 531 case CX88_BOARD_HAUPPAUGE_DVB_T1:
533 dev->dvb.frontend = dvb_attach(cx22702_attach, 532 dev->dvb.frontend = dvb_attach(cx22702_attach,
534 &connexant_refboard_config, 533 &connexant_refboard_config,
535 &dev->core->i2c_adap); 534 &core->i2c_adap);
536 if (dev->dvb.frontend != NULL) { 535 if (dev->dvb.frontend != NULL) {
537 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 536 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
538 &dev->core->i2c_adap, 537 0x61, &core->i2c_adap,
539 DVB_PLL_THOMSON_DTT759X); 538 DVB_PLL_THOMSON_DTT759X))
539 goto frontend_detach;
540 } 540 }
541 break; 541 break;
542 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 542 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
@@ -545,11 +545,12 @@ static int dvb_register(struct cx8802_dev *dev)
545 case CX88_BOARD_WINFAST_DTV1000: 545 case CX88_BOARD_WINFAST_DTV1000:
546 dev->dvb.frontend = dvb_attach(cx22702_attach, 546 dev->dvb.frontend = dvb_attach(cx22702_attach,
547 &connexant_refboard_config, 547 &connexant_refboard_config,
548 &dev->core->i2c_adap); 548 &core->i2c_adap);
549 if (dev->dvb.frontend != NULL) { 549 if (dev->dvb.frontend != NULL) {
550 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, 550 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
551 &dev->core->i2c_adap, 551 0x60, &core->i2c_adap,
552 DVB_PLL_THOMSON_DTT7579); 552 DVB_PLL_THOMSON_DTT7579))
553 goto frontend_detach;
553 } 554 }
554 break; 555 break;
555 case CX88_BOARD_WINFAST_DTV2000H: 556 case CX88_BOARD_WINFAST_DTV2000H:
@@ -559,29 +560,32 @@ static int dvb_register(struct cx8802_dev *dev)
559 case CX88_BOARD_HAUPPAUGE_HVR3000: 560 case CX88_BOARD_HAUPPAUGE_HVR3000:
560 dev->dvb.frontend = dvb_attach(cx22702_attach, 561 dev->dvb.frontend = dvb_attach(cx22702_attach,
561 &hauppauge_hvr_config, 562 &hauppauge_hvr_config,
562 &dev->core->i2c_adap); 563 &core->i2c_adap);
563 if (dev->dvb.frontend != NULL) { 564 if (dev->dvb.frontend != NULL) {
564 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 565 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
565 &dev->core->i2c_adap, 0x61, 566 &core->i2c_adap, 0x61,
566 TUNER_PHILIPS_FMD1216ME_MK3); 567 TUNER_PHILIPS_FMD1216ME_MK3))
568 goto frontend_detach;
567 } 569 }
568 break; 570 break;
569 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: 571 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
570 dev->dvb.frontend = dvb_attach(mt352_attach, 572 dev->dvb.frontend = dvb_attach(mt352_attach,
571 &dvico_fusionhdtv, 573 &dvico_fusionhdtv,
572 &dev->core->i2c_adap); 574 &core->i2c_adap);
573 if (dev->dvb.frontend != NULL) { 575 if (dev->dvb.frontend != NULL) {
574 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, 576 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
575 NULL, DVB_PLL_THOMSON_DTT7579); 577 0x60, NULL, DVB_PLL_THOMSON_DTT7579))
578 goto frontend_detach;
576 break; 579 break;
577 } 580 }
578 /* ZL10353 replaces MT352 on later cards */ 581 /* ZL10353 replaces MT352 on later cards */
579 dev->dvb.frontend = dvb_attach(zl10353_attach, 582 dev->dvb.frontend = dvb_attach(zl10353_attach,
580 &dvico_fusionhdtv_plus_v1_1, 583 &dvico_fusionhdtv_plus_v1_1,
581 &dev->core->i2c_adap); 584 &core->i2c_adap);
582 if (dev->dvb.frontend != NULL) { 585 if (dev->dvb.frontend != NULL) {
583 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, 586 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
584 NULL, DVB_PLL_THOMSON_DTT7579); 587 0x60, NULL, DVB_PLL_THOMSON_DTT7579))
588 goto frontend_detach;
585 } 589 }
586 break; 590 break;
587 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: 591 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
@@ -589,28 +593,31 @@ static int dvb_register(struct cx8802_dev *dev)
589 * compatible, with a slightly different MT352 AGC gain. */ 593 * compatible, with a slightly different MT352 AGC gain. */
590 dev->dvb.frontend = dvb_attach(mt352_attach, 594 dev->dvb.frontend = dvb_attach(mt352_attach,
591 &dvico_fusionhdtv_dual, 595 &dvico_fusionhdtv_dual,
592 &dev->core->i2c_adap); 596 &core->i2c_adap);
593 if (dev->dvb.frontend != NULL) { 597 if (dev->dvb.frontend != NULL) {
594 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 598 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
595 NULL, DVB_PLL_THOMSON_DTT7579); 599 0x61, NULL, DVB_PLL_THOMSON_DTT7579))
600 goto frontend_detach;
596 break; 601 break;
597 } 602 }
598 /* ZL10353 replaces MT352 on later cards */ 603 /* ZL10353 replaces MT352 on later cards */
599 dev->dvb.frontend = dvb_attach(zl10353_attach, 604 dev->dvb.frontend = dvb_attach(zl10353_attach,
600 &dvico_fusionhdtv_plus_v1_1, 605 &dvico_fusionhdtv_plus_v1_1,
601 &dev->core->i2c_adap); 606 &core->i2c_adap);
602 if (dev->dvb.frontend != NULL) { 607 if (dev->dvb.frontend != NULL) {
603 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 608 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
604 NULL, DVB_PLL_THOMSON_DTT7579); 609 0x61, NULL, DVB_PLL_THOMSON_DTT7579))
610 goto frontend_detach;
605 } 611 }
606 break; 612 break;
607 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: 613 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
608 dev->dvb.frontend = dvb_attach(mt352_attach, 614 dev->dvb.frontend = dvb_attach(mt352_attach,
609 &dvico_fusionhdtv, 615 &dvico_fusionhdtv,
610 &dev->core->i2c_adap); 616 &core->i2c_adap);
611 if (dev->dvb.frontend != NULL) { 617 if (dev->dvb.frontend != NULL) {
612 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 618 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
613 NULL, DVB_PLL_LG_Z201); 619 0x61, NULL, DVB_PLL_LG_Z201))
620 goto frontend_detach;
614 } 621 }
615 break; 622 break;
616 case CX88_BOARD_KWORLD_DVB_T: 623 case CX88_BOARD_KWORLD_DVB_T:
@@ -618,10 +625,11 @@ static int dvb_register(struct cx8802_dev *dev)
618 case CX88_BOARD_ADSTECH_DVB_T_PCI: 625 case CX88_BOARD_ADSTECH_DVB_T_PCI:
619 dev->dvb.frontend = dvb_attach(mt352_attach, 626 dev->dvb.frontend = dvb_attach(mt352_attach,
620 &dntv_live_dvbt_config, 627 &dntv_live_dvbt_config,
621 &dev->core->i2c_adap); 628 &core->i2c_adap);
622 if (dev->dvb.frontend != NULL) { 629 if (dev->dvb.frontend != NULL) {
623 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 630 if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend,
624 NULL, DVB_PLL_UNKNOWN_1); 631 0x61, NULL, DVB_PLL_UNKNOWN_1))
632 goto frontend_detach;
625 } 633 }
626 break; 634 break;
627 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: 635 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
@@ -630,32 +638,35 @@ static int dvb_register(struct cx8802_dev *dev)
630 dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, 638 dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config,
631 &dev->vp3054->adap); 639 &dev->vp3054->adap);
632 if (dev->dvb.frontend != NULL) { 640 if (dev->dvb.frontend != NULL) {
633 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 641 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
634 &dev->core->i2c_adap, 0x61, 642 &core->i2c_adap, 0x61,
635 TUNER_PHILIPS_FMD1216ME_MK3); 643 TUNER_PHILIPS_FMD1216ME_MK3))
644 goto frontend_detach;
636 } 645 }
637#else 646#else
638 printk(KERN_ERR "%s/2: built without vp3054 support\n", dev->core->name); 647 printk(KERN_ERR "%s/2: built without vp3054 support\n",
648 core->name);
639#endif 649#endif
640 break; 650 break;
641 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: 651 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
642 dev->dvb.frontend = dvb_attach(zl10353_attach, 652 dev->dvb.frontend = dvb_attach(zl10353_attach,
643 &dvico_fusionhdtv_hybrid, 653 &dvico_fusionhdtv_hybrid,
644 &dev->core->i2c_adap); 654 &core->i2c_adap);
645 if (dev->dvb.frontend != NULL) { 655 if (dev->dvb.frontend != NULL) {
646 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 656 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
647 &dev->core->i2c_adap, 0x61, 657 &core->i2c_adap, 0x61,
648 TUNER_THOMSON_FE6600); 658 TUNER_THOMSON_FE6600))
659 goto frontend_detach;
649 } 660 }
650 break; 661 break;
651 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: 662 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
652 dev->dvb.frontend = dvb_attach(zl10353_attach, 663 dev->dvb.frontend = dvb_attach(zl10353_attach,
653 &dvico_fusionhdtv_xc3028, 664 &dvico_fusionhdtv_xc3028,
654 &dev->core->i2c_adap); 665 &core->i2c_adap);
655 if (dev->dvb.frontend == NULL) 666 if (dev->dvb.frontend == NULL)
656 dev->dvb.frontend = dvb_attach(mt352_attach, 667 dev->dvb.frontend = dvb_attach(mt352_attach,
657 &dvico_fusionhdtv_mt352_xc3028, 668 &dvico_fusionhdtv_mt352_xc3028,
658 &dev->core->i2c_adap); 669 &core->i2c_adap);
659 /* 670 /*
660 * On this board, the demod provides the I2C bus pullup. 671 * On this board, the demod provides the I2C bus pullup.
661 * We must not permit gate_ctrl to be performed, or 672 * We must not permit gate_ctrl to be performed, or
@@ -668,19 +679,18 @@ static int dvb_register(struct cx8802_dev *dev)
668 break; 679 break;
669 case CX88_BOARD_PCHDTV_HD3000: 680 case CX88_BOARD_PCHDTV_HD3000:
670 dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, 681 dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000,
671 &dev->core->i2c_adap); 682 &core->i2c_adap);
672 if (dev->dvb.frontend != NULL) { 683 if (dev->dvb.frontend != NULL) {
673 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 684 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
674 &dev->core->i2c_adap, 0x61, 685 &core->i2c_adap, 0x61,
675 TUNER_THOMSON_DTT761X); 686 TUNER_THOMSON_DTT761X))
687 goto frontend_detach;
676 } 688 }
677 break; 689 break;
678 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 690 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
679 dev->ts_gen_cntrl = 0x08; 691 dev->ts_gen_cntrl = 0x08;
680 {
681 /* Do a hardware reset of chip before using it. */
682 struct cx88_core *core = dev->core;
683 692
693 /* Do a hardware reset of chip before using it. */
684 cx_clear(MO_GP0_IO, 1); 694 cx_clear(MO_GP0_IO, 1);
685 mdelay(100); 695 mdelay(100);
686 cx_set(MO_GP0_IO, 1); 696 cx_set(MO_GP0_IO, 1);
@@ -690,139 +700,137 @@ static int dvb_register(struct cx8802_dev *dev)
690 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; 700 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
691 dev->dvb.frontend = dvb_attach(lgdt330x_attach, 701 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
692 &fusionhdtv_3_gold, 702 &fusionhdtv_3_gold,
693 &dev->core->i2c_adap); 703 &core->i2c_adap);
694 if (dev->dvb.frontend != NULL) { 704 if (dev->dvb.frontend != NULL) {
695 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 705 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
696 &dev->core->i2c_adap, 0x61, 706 &core->i2c_adap, 0x61,
697 TUNER_MICROTUNE_4042FI5); 707 TUNER_MICROTUNE_4042FI5))
698 } 708 goto frontend_detach;
699 } 709 }
700 break; 710 break;
701 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: 711 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
702 dev->ts_gen_cntrl = 0x08; 712 dev->ts_gen_cntrl = 0x08;
703 {
704 /* Do a hardware reset of chip before using it. */
705 struct cx88_core *core = dev->core;
706 713
714 /* Do a hardware reset of chip before using it. */
707 cx_clear(MO_GP0_IO, 1); 715 cx_clear(MO_GP0_IO, 1);
708 mdelay(100); 716 mdelay(100);
709 cx_set(MO_GP0_IO, 9); 717 cx_set(MO_GP0_IO, 9);
710 mdelay(200); 718 mdelay(200);
711 dev->dvb.frontend = dvb_attach(lgdt330x_attach, 719 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
712 &fusionhdtv_3_gold, 720 &fusionhdtv_3_gold,
713 &dev->core->i2c_adap); 721 &core->i2c_adap);
714 if (dev->dvb.frontend != NULL) { 722 if (dev->dvb.frontend != NULL) {
715 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 723 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
716 &dev->core->i2c_adap, 0x61, 724 &core->i2c_adap, 0x61,
717 TUNER_THOMSON_DTT761X); 725 TUNER_THOMSON_DTT761X))
718 } 726 goto frontend_detach;
719 } 727 }
720 break; 728 break;
721 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: 729 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
722 dev->ts_gen_cntrl = 0x08; 730 dev->ts_gen_cntrl = 0x08;
723 {
724 /* Do a hardware reset of chip before using it. */
725 struct cx88_core *core = dev->core;
726 731
732 /* Do a hardware reset of chip before using it. */
727 cx_clear(MO_GP0_IO, 1); 733 cx_clear(MO_GP0_IO, 1);
728 mdelay(100); 734 mdelay(100);
729 cx_set(MO_GP0_IO, 1); 735 cx_set(MO_GP0_IO, 1);
730 mdelay(200); 736 mdelay(200);
731 dev->dvb.frontend = dvb_attach(lgdt330x_attach, 737 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
732 &fusionhdtv_5_gold, 738 &fusionhdtv_5_gold,
733 &dev->core->i2c_adap); 739 &core->i2c_adap);
734 if (dev->dvb.frontend != NULL) { 740 if (dev->dvb.frontend != NULL) {
735 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 741 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
736 &dev->core->i2c_adap, 0x61, 742 &core->i2c_adap, 0x61,
737 TUNER_LG_TDVS_H06XF); 743 TUNER_LG_TDVS_H06XF))
738 dvb_attach(tda9887_attach, dev->dvb.frontend, 744 goto frontend_detach;
739 &dev->core->i2c_adap, 0x43); 745 if (!dvb_attach(tda9887_attach, dev->dvb.frontend,
740 } 746 &core->i2c_adap, 0x43))
747 goto frontend_detach;
741 } 748 }
742 break; 749 break;
743 case CX88_BOARD_PCHDTV_HD5500: 750 case CX88_BOARD_PCHDTV_HD5500:
744 dev->ts_gen_cntrl = 0x08; 751 dev->ts_gen_cntrl = 0x08;
745 {
746 /* Do a hardware reset of chip before using it. */
747 struct cx88_core *core = dev->core;
748 752
753 /* Do a hardware reset of chip before using it. */
749 cx_clear(MO_GP0_IO, 1); 754 cx_clear(MO_GP0_IO, 1);
750 mdelay(100); 755 mdelay(100);
751 cx_set(MO_GP0_IO, 1); 756 cx_set(MO_GP0_IO, 1);
752 mdelay(200); 757 mdelay(200);
753 dev->dvb.frontend = dvb_attach(lgdt330x_attach, 758 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
754 &pchdtv_hd5500, 759 &pchdtv_hd5500,
755 &dev->core->i2c_adap); 760 &core->i2c_adap);
756 if (dev->dvb.frontend != NULL) { 761 if (dev->dvb.frontend != NULL) {
757 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 762 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
758 &dev->core->i2c_adap, 0x61, 763 &core->i2c_adap, 0x61,
759 TUNER_LG_TDVS_H06XF); 764 TUNER_LG_TDVS_H06XF))
760 dvb_attach(tda9887_attach, dev->dvb.frontend, 765 goto frontend_detach;
761 &dev->core->i2c_adap, 0x43); 766 if (!dvb_attach(tda9887_attach, dev->dvb.frontend,
762 } 767 &core->i2c_adap, 0x43))
768 goto frontend_detach;
763 } 769 }
764 break; 770 break;
765 case CX88_BOARD_ATI_HDTVWONDER: 771 case CX88_BOARD_ATI_HDTVWONDER:
766 dev->dvb.frontend = dvb_attach(nxt200x_attach, 772 dev->dvb.frontend = dvb_attach(nxt200x_attach,
767 &ati_hdtvwonder, 773 &ati_hdtvwonder,
768 &dev->core->i2c_adap); 774 &core->i2c_adap);
769 if (dev->dvb.frontend != NULL) { 775 if (dev->dvb.frontend != NULL) {
770 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 776 if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend,
771 &dev->core->i2c_adap, 0x61, 777 &core->i2c_adap, 0x61,
772 TUNER_PHILIPS_TUV1236D); 778 TUNER_PHILIPS_TUV1236D))
779 goto frontend_detach;
773 } 780 }
774 break; 781 break;
775 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 782 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
776 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 783 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
777 dev->dvb.frontend = dvb_attach(cx24123_attach, 784 dev->dvb.frontend = dvb_attach(cx24123_attach,
778 &hauppauge_novas_config, 785 &hauppauge_novas_config,
779 &dev->core->i2c_adap); 786 &core->i2c_adap);
780 if (dev->dvb.frontend) { 787 if (dev->dvb.frontend) {
781 dvb_attach(isl6421_attach, dev->dvb.frontend, 788 if (!dvb_attach(isl6421_attach, dev->dvb.frontend,
782 &dev->core->i2c_adap, 0x08, 0x00, 0x00); 789 &core->i2c_adap, 0x08, 0x00, 0x00))
790 goto frontend_detach;
783 } 791 }
784 break; 792 break;
785 case CX88_BOARD_KWORLD_DVBS_100: 793 case CX88_BOARD_KWORLD_DVBS_100:
786 dev->dvb.frontend = dvb_attach(cx24123_attach, 794 dev->dvb.frontend = dvb_attach(cx24123_attach,
787 &kworld_dvbs_100_config, 795 &kworld_dvbs_100_config,
788 &dev->core->i2c_adap); 796 &core->i2c_adap);
789 if (dev->dvb.frontend) { 797 if (dev->dvb.frontend) {
790 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; 798 core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage;
791 dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; 799 dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage;
792 } 800 }
793 break; 801 break;
794 case CX88_BOARD_GENIATECH_DVBS: 802 case CX88_BOARD_GENIATECH_DVBS:
795 dev->dvb.frontend = dvb_attach(cx24123_attach, 803 dev->dvb.frontend = dvb_attach(cx24123_attach,
796 &geniatech_dvbs_config, 804 &geniatech_dvbs_config,
797 &dev->core->i2c_adap); 805 &core->i2c_adap);
798 if (dev->dvb.frontend) { 806 if (dev->dvb.frontend) {
799 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; 807 core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage;
800 dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; 808 dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage;
801 } 809 }
802 break; 810 break;
803 case CX88_BOARD_PINNACLE_PCTV_HD_800i: 811 case CX88_BOARD_PINNACLE_PCTV_HD_800i:
804 dev->dvb.frontend = dvb_attach(s5h1409_attach, 812 dev->dvb.frontend = dvb_attach(s5h1409_attach,
805 &pinnacle_pctv_hd_800i_config, 813 &pinnacle_pctv_hd_800i_config,
806 &dev->core->i2c_adap); 814 &core->i2c_adap);
807 if (dev->dvb.frontend != NULL) { 815 if (dev->dvb.frontend != NULL) {
808 /* tuner_config.video_dev must point to 816 /* tuner_config.video_dev must point to
809 * i2c_adap.algo_data 817 * i2c_adap.algo_data
810 */ 818 */
811 pinnacle_pctv_hd_800i_tuner_config.priv = 819 if (!dvb_attach(xc5000_attach, dev->dvb.frontend,
812 dev->core->i2c_adap.algo_data; 820 &core->i2c_adap,
813 dvb_attach(xc5000_attach, dev->dvb.frontend, 821 &pinnacle_pctv_hd_800i_tuner_config,
814 &dev->core->i2c_adap, 822 core->i2c_adap.algo_data))
815 &pinnacle_pctv_hd_800i_tuner_config); 823 goto frontend_detach;
816 } 824 }
817 break; 825 break;
818 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: 826 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
819 dev->dvb.frontend = dvb_attach(s5h1409_attach, 827 dev->dvb.frontend = dvb_attach(s5h1409_attach,
820 &dvico_hdtv5_pci_nano_config, 828 &dvico_hdtv5_pci_nano_config,
821 &dev->core->i2c_adap); 829 &core->i2c_adap);
822 if (dev->dvb.frontend != NULL) { 830 if (dev->dvb.frontend != NULL) {
823 struct dvb_frontend *fe; 831 struct dvb_frontend *fe;
824 struct xc2028_config cfg = { 832 struct xc2028_config cfg = {
825 .i2c_adap = &dev->core->i2c_adap, 833 .i2c_adap = &core->i2c_adap,
826 .i2c_addr = 0x61, 834 .i2c_addr = 0x61,
827 .callback = cx88_pci_nano_callback, 835 .callback = cx88_pci_nano_callback,
828 }; 836 };
@@ -841,50 +849,50 @@ static int dvb_register(struct cx8802_dev *dev)
841 case CX88_BOARD_PINNACLE_HYBRID_PCTV: 849 case CX88_BOARD_PINNACLE_HYBRID_PCTV:
842 dev->dvb.frontend = dvb_attach(zl10353_attach, 850 dev->dvb.frontend = dvb_attach(zl10353_attach,
843 &cx88_geniatech_x8000_mt, 851 &cx88_geniatech_x8000_mt,
844 &dev->core->i2c_adap); 852 &core->i2c_adap);
845 if (attach_xc3028(0x61, dev) < 0) 853 if (attach_xc3028(0x61, dev) < 0)
846 return -EINVAL; 854 goto frontend_detach;
847 break; 855 break;
848 case CX88_BOARD_GENIATECH_X8000_MT: 856 case CX88_BOARD_GENIATECH_X8000_MT:
849 dev->ts_gen_cntrl = 0x00; 857 dev->ts_gen_cntrl = 0x00;
850 858
851 dev->dvb.frontend = dvb_attach(zl10353_attach, 859 dev->dvb.frontend = dvb_attach(zl10353_attach,
852 &cx88_geniatech_x8000_mt, 860 &cx88_geniatech_x8000_mt,
853 &dev->core->i2c_adap); 861 &core->i2c_adap);
854 if (attach_xc3028(0x61, dev) < 0) 862 if (attach_xc3028(0x61, dev) < 0)
855 return -EINVAL; 863 goto frontend_detach;
856 break; 864 break;
857 case CX88_BOARD_KWORLD_ATSC_120: 865 case CX88_BOARD_KWORLD_ATSC_120:
858 dev->dvb.frontend = dvb_attach(s5h1409_attach, 866 dev->dvb.frontend = dvb_attach(s5h1409_attach,
859 &kworld_atsc_120_config, 867 &kworld_atsc_120_config,
860 &dev->core->i2c_adap); 868 &core->i2c_adap);
861 if (attach_xc3028(0x61, dev) < 0) 869 if (attach_xc3028(0x61, dev) < 0)
862 return -EINVAL; 870 goto frontend_detach;
863 break; 871 break;
864 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: 872 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
865 dev->dvb.frontend = dvb_attach(s5h1411_attach, 873 dev->dvb.frontend = dvb_attach(s5h1411_attach,
866 &dvico_fusionhdtv7_config, 874 &dvico_fusionhdtv7_config,
867 &dev->core->i2c_adap); 875 &core->i2c_adap);
868 if (dev->dvb.frontend != NULL) { 876 if (dev->dvb.frontend != NULL) {
869 /* tuner_config.video_dev must point to 877 /* tuner_config.video_dev must point to
870 * i2c_adap.algo_data 878 * i2c_adap.algo_data
871 */ 879 */
872 dvico_fusionhdtv7_tuner_config.priv = 880 if (!dvb_attach(xc5000_attach, dev->dvb.frontend,
873 dev->core->i2c_adap.algo_data; 881 &core->i2c_adap,
874 dvb_attach(xc5000_attach, dev->dvb.frontend, 882 &dvico_fusionhdtv7_tuner_config,
875 &dev->core->i2c_adap, 883 core->i2c_adap.algo_data))
876 &dvico_fusionhdtv7_tuner_config); 884 goto frontend_detach;
877 } 885 }
878 break; 886 break;
879 default: 887 default:
880 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", 888 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
881 dev->core->name); 889 core->name);
882 break; 890 break;
883 } 891 }
884 if (NULL == dev->dvb.frontend) { 892 if (NULL == dev->dvb.frontend) {
885 printk(KERN_ERR 893 printk(KERN_ERR
886 "%s/2: frontend initialization failed\n", 894 "%s/2: frontend initialization failed\n",
887 dev->core->name); 895 core->name);
888 return -EINVAL; 896 return -EINVAL;
889 } 897 }
890 898
@@ -892,11 +900,18 @@ static int dvb_register(struct cx8802_dev *dev)
892 dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; 900 dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;
893 901
894 /* Put the analog decoder in standby to keep it quiet */ 902 /* Put the analog decoder in standby to keep it quiet */
895 cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); 903 cx88_call_i2c_clients(core, TUNER_SET_STANDBY, NULL);
896 904
897 /* register everything */ 905 /* register everything */
898 return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, 906 return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev,
899 &dev->pci->dev, adapter_nr); 907 &dev->pci->dev, adapter_nr);
908
909frontend_detach:
910 if (dev->dvb.frontend) {
911 dvb_frontend_detach(dev->dvb.frontend);
912 dev->dvb.frontend = NULL;
913 }
914 return -EINVAL;
900} 915}
901 916
902/* ----------------------------------------------------------- */ 917/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index c7c2896bbd8b..16a5af30e9d1 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -1,7 +1,7 @@
1config VIDEO_EM28XX 1config VIDEO_EM28XX
2 tristate "Empia EM28xx USB video capture support" 2 tristate "Empia EM28xx USB video capture support"
3 depends on VIDEO_DEV && I2C && INPUT 3 depends on VIDEO_DEV && I2C && INPUT
4 select MEDIA_TUNER 4 select VIDEO_TUNER
5 select VIDEO_TVEEPROM 5 select VIDEO_TVEEPROM
6 select VIDEO_IR 6 select VIDEO_IR
7 select VIDEOBUF_VMALLOC 7 select VIDEOBUF_VMALLOC
@@ -35,7 +35,6 @@ config VIDEO_EM28XX_DVB
35 select DVB_LGDT330X if !DVB_FE_CUSTOMISE 35 select DVB_LGDT330X if !DVB_FE_CUSTOMISE
36 select DVB_ZL10353 if !DVB_FE_CUSTOMISE 36 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
37 select VIDEOBUF_DVB 37 select VIDEOBUF_DVB
38 select FW_LOADER
39 ---help--- 38 ---help---
40 This adds support for DVB cards based on the 39 This adds support for DVB cards based on the
41 Empiatech em28xx chips. 40 Empiatech em28xx chips.
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 50ccf3771204..3e4f3c7e92e7 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -420,7 +420,13 @@ struct usb_device_id em28xx_id_table [] = {
420 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, 420 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
421 { USB_DEVICE(0x2040, 0x6502), 421 { USB_DEVICE(0x2040, 0x6502),
422 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, 422 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
423 { USB_DEVICE(0x2040, 0x6513), 423 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
424 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 },
425 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
426 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 },
427 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
428 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 },
429 { USB_DEVICE(0x2040, 0x651f), /* HCW HVR-850 */
424 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, 430 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 },
425 { USB_DEVICE(0x0ccd, 0x0042), 431 { USB_DEVICE(0x0ccd, 0x0042),
426 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS }, 432 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 7df81575b7f2..8cf4983f0039 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -251,7 +251,6 @@ static int attach_xc3028(u8 addr, struct em28xx *dev)
251 printk(KERN_ERR "%s/2: xc3028 attach failed\n", 251 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
252 dev->name); 252 dev->name);
253 dvb_frontend_detach(dev->dvb->frontend); 253 dvb_frontend_detach(dev->dvb->frontend);
254 dvb_unregister_frontend(dev->dvb->frontend);
255 dev->dvb->frontend = NULL; 254 dev->dvb->frontend = NULL;
256 return -EINVAL; 255 return -EINVAL;
257 } 256 }
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 8996175cc950..fb163ecd9216 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1166,13 +1166,13 @@ static int vidioc_g_register(struct file *file, void *priv,
1166 1166
1167 reg->val = ret; 1167 reg->val = ret;
1168 } else { 1168 } else {
1169 u64 val = 0; 1169 __le64 val = 0;
1170 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1170 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
1171 reg->reg, (char *)&val, 2); 1171 reg->reg, (char *)&val, 2);
1172 if (ret < 0) 1172 if (ret < 0)
1173 return ret; 1173 return ret;
1174 1174
1175 reg->val = cpu_to_le64((__u64)val); 1175 reg->val = le64_to_cpu(val);
1176 } 1176 }
1177 1177
1178 return 0; 1178 return 0;
@@ -1183,9 +1183,9 @@ static int vidioc_s_register(struct file *file, void *priv,
1183{ 1183{
1184 struct em28xx_fh *fh = priv; 1184 struct em28xx_fh *fh = priv;
1185 struct em28xx *dev = fh->dev; 1185 struct em28xx *dev = fh->dev;
1186 u64 buf; 1186 __le64 buf;
1187 1187
1188 buf = le64_to_cpu((__u64)reg->val); 1188 buf = cpu_to_le64(reg->val);
1189 1189
1190 return em28xx_write_regs(dev, reg->reg, (char *)&buf, 1190 return em28xx_write_regs(dev, reg->reg, (char *)&buf,
1191 em28xx_reg_len(reg->reg)); 1191 em28xx_reg_len(reg->reg));
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 5e749c528a62..15d037ae25c5 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -34,7 +34,7 @@
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/page-flags.h> 36#include <linux/page-flags.h>
37#include <linux/byteorder/generic.h> 37#include <asm/byteorder.h>
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40 40
diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig
index eec115bf9517..5d7ee8fcdd50 100644
--- a/drivers/media/video/ivtv/Kconfig
+++ b/drivers/media/video/ivtv/Kconfig
@@ -1,10 +1,12 @@
1config VIDEO_IVTV 1config VIDEO_IVTV
2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" 2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support"
3 depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL
4 depends on INPUT # due to VIDEO_IR
5 depends on HOTPLUG # due to FW_LOADER
4 select I2C_ALGOBIT 6 select I2C_ALGOBIT
5 select FW_LOADER 7 select FW_LOADER
6 select VIDEO_IR 8 select VIDEO_IR
7 select MEDIA_TUNER 9 select VIDEO_TUNER
8 select VIDEO_TVEEPROM 10 select VIDEO_TVEEPROM
9 select VIDEO_CX2341X 11 select VIDEO_CX2341X
10 select VIDEO_CX25840 12 select VIDEO_CX25840
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
index 8c02fa661591..c7e449f6397b 100644
--- a/drivers/media/video/ivtv/ivtv-controls.c
+++ b/drivers/media/video/ivtv/ivtv-controls.c
@@ -181,12 +181,12 @@ static int ivtv_setup_vbi_fmt(struct ivtv *itv, enum v4l2_mpeg_stream_vbi_fmt fm
181 return 0; 181 return 0;
182 } 182 }
183 /* Need sliced data for mpeg insertion */ 183 /* Need sliced data for mpeg insertion */
184 if (get_service_set(itv->vbi.sliced_in) == 0) { 184 if (ivtv_get_service_set(itv->vbi.sliced_in) == 0) {
185 if (itv->is_60hz) 185 if (itv->is_60hz)
186 itv->vbi.sliced_in->service_set = V4L2_SLICED_CAPTION_525; 186 itv->vbi.sliced_in->service_set = V4L2_SLICED_CAPTION_525;
187 else 187 else
188 itv->vbi.sliced_in->service_set = V4L2_SLICED_WSS_625; 188 itv->vbi.sliced_in->service_set = V4L2_SLICED_WSS_625;
189 expand_service_set(itv->vbi.sliced_in, itv->is_50hz); 189 ivtv_expand_service_set(itv->vbi.sliced_in, itv->is_50hz);
190 } 190 }
191 return 0; 191 return 0;
192} 192}
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index ed020f722b05..797e636771da 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -853,6 +853,7 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *dev,
853 return 0; 853 return 0;
854} 854}
855 855
856#ifdef MODULE
856static u32 ivtv_request_module(struct ivtv *itv, u32 hw, 857static u32 ivtv_request_module(struct ivtv *itv, u32 hw,
857 const char *name, u32 id) 858 const char *name, u32 id)
858{ 859{
@@ -865,12 +866,14 @@ static u32 ivtv_request_module(struct ivtv *itv, u32 hw,
865 IVTV_DEBUG_INFO("Loaded module %s\n", name); 866 IVTV_DEBUG_INFO("Loaded module %s\n", name);
866 return hw; 867 return hw;
867} 868}
869#endif
868 870
869static void ivtv_load_and_init_modules(struct ivtv *itv) 871static void ivtv_load_and_init_modules(struct ivtv *itv)
870{ 872{
871 u32 hw = itv->card->hw_all; 873 u32 hw = itv->card->hw_all;
872 unsigned i; 874 unsigned i;
873 875
876#ifdef MODULE
874 /* load modules */ 877 /* load modules */
875#ifndef CONFIG_MEDIA_TUNER 878#ifndef CONFIG_MEDIA_TUNER
876 hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER); 879 hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER);
@@ -911,6 +914,7 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
911#ifndef CONFIG_VIDEO_M52790 914#ifndef CONFIG_VIDEO_M52790
912 hw = ivtv_request_module(itv, hw, "m52790", IVTV_HW_M52790); 915 hw = ivtv_request_module(itv, hw, "m52790", IVTV_HW_M52790);
913#endif 916#endif
917#endif
914 918
915 /* check which i2c devices are actually found */ 919 /* check which i2c devices are actually found */
916 for (i = 0; i < 32; i++) { 920 for (i = 0; i < 32; i++) {
@@ -1228,7 +1232,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1228 return 0; 1232 return 0;
1229 1233
1230free_streams: 1234free_streams:
1231 ivtv_streams_cleanup(itv); 1235 ivtv_streams_cleanup(itv, 1);
1232free_irq: 1236free_irq:
1233 free_irq(itv->dev->irq, (void *)itv); 1237 free_irq(itv->dev->irq, (void *)itv);
1234free_i2c: 1238free_i2c:
@@ -1373,7 +1377,7 @@ static void ivtv_remove(struct pci_dev *pci_dev)
1373 flush_workqueue(itv->irq_work_queues); 1377 flush_workqueue(itv->irq_work_queues);
1374 destroy_workqueue(itv->irq_work_queues); 1378 destroy_workqueue(itv->irq_work_queues);
1375 1379
1376 ivtv_streams_cleanup(itv); 1380 ivtv_streams_cleanup(itv, 1);
1377 ivtv_udma_free(itv); 1381 ivtv_udma_free(itv);
1378 1382
1379 exit_ivtv_i2c(itv); 1383 exit_ivtv_i2c(itv);
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index ba06e813c58c..9d23b1efd36d 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -259,6 +259,12 @@ struct ivtv_mailbox_data {
259 259
260/* Scatter-Gather array element, used in DMA transfers */ 260/* Scatter-Gather array element, used in DMA transfers */
261struct ivtv_sg_element { 261struct ivtv_sg_element {
262 __le32 src;
263 __le32 dst;
264 __le32 size;
265};
266
267struct ivtv_sg_host_element {
262 u32 src; 268 u32 src;
263 u32 dst; 269 u32 dst;
264 u32 size; 270 u32 size;
@@ -349,8 +355,8 @@ struct ivtv_stream {
349 u16 dma_xfer_cnt; 355 u16 dma_xfer_cnt;
350 356
351 /* Base Dev SG Array for cx23415/6 */ 357 /* Base Dev SG Array for cx23415/6 */
352 struct ivtv_sg_element *sg_pending; 358 struct ivtv_sg_host_element *sg_pending;
353 struct ivtv_sg_element *sg_processing; 359 struct ivtv_sg_host_element *sg_processing;
354 struct ivtv_sg_element *sg_dma; 360 struct ivtv_sg_element *sg_dma;
355 dma_addr_t sg_handle; 361 dma_addr_t sg_handle;
356 int sg_pending_size; 362 int sg_pending_size;
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 2b74b0ab1477..db813e071ce6 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -587,7 +587,7 @@ retry:
587 since we may get here before the stream has been fully set-up */ 587 since we may get here before the stream has been fully set-up */
588 if (mode == OUT_YUV && s->q_full.length == 0 && itv->dma_data_req_size) { 588 if (mode == OUT_YUV && s->q_full.length == 0 && itv->dma_data_req_size) {
589 while (count >= itv->dma_data_req_size) { 589 while (count >= itv->dma_data_req_size) {
590 if (!ivtv_yuv_udma_stream_frame (itv, (void *)user_buf)) { 590 if (!ivtv_yuv_udma_stream_frame (itv, (void __user *)user_buf)) {
591 bytes_written += itv->dma_data_req_size; 591 bytes_written += itv->dma_data_req_size;
592 user_buf += itv->dma_data_req_size; 592 user_buf += itv->dma_data_req_size;
593 count -= itv->dma_data_req_size; 593 count -= itv->dma_data_req_size;
@@ -987,6 +987,8 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
987 /* Find which card this open was on */ 987 /* Find which card this open was on */
988 spin_lock(&ivtv_cards_lock); 988 spin_lock(&ivtv_cards_lock);
989 for (x = 0; itv == NULL && x < ivtv_cards_active; x++) { 989 for (x = 0; itv == NULL && x < ivtv_cards_active; x++) {
990 if (ivtv_cards[x] == NULL)
991 continue;
990 /* find out which stream this open was on */ 992 /* find out which stream this open was on */
991 for (y = 0; y < IVTV_MAX_STREAMS; y++) { 993 for (y = 0; y < IVTV_MAX_STREAMS; y++) {
992 s = &ivtv_cards[x]->streams[y]; 994 s = &ivtv_cards[x]->streams[y];
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 771adf47e944..32129f3ea836 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -136,7 +136,7 @@ static const u8 hw_addrs[] = {
136}; 136};
137 137
138/* This array should match the IVTV_HW_ defines */ 138/* This array should match the IVTV_HW_ defines */
139static const char * const hw_drivernames[] = { 139static const char * const hw_devicenames[] = {
140 "cx25840", 140 "cx25840",
141 "saa7115", 141 "saa7115",
142 "saa7127", 142 "saa7127",
@@ -145,7 +145,7 @@ static const char * const hw_drivernames[] = {
145 "wm8775", 145 "wm8775",
146 "cs53l32a", 146 "cs53l32a",
147 "tveeprom", 147 "tveeprom",
148 "saa7115", 148 "saa7114",
149 "upd64031a", 149 "upd64031a",
150 "upd64083", 150 "upd64083",
151 "saa717x", 151 "saa717x",
@@ -167,8 +167,7 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
167 return -1; 167 return -1;
168 id = hw_driverids[idx]; 168 id = hw_driverids[idx];
169 memset(&info, 0, sizeof(info)); 169 memset(&info, 0, sizeof(info));
170 strlcpy(info.driver_name, hw_drivernames[idx], 170 strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
171 sizeof(info.driver_name));
172 info.addr = hw_addrs[idx]; 171 info.addr = hw_addrs[idx];
173 for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} 172 for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {}
174 173
@@ -657,7 +656,7 @@ static const char *ivtv_i2c_id_name(u32 id)
657 656
658 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) 657 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
659 if (hw_driverids[i] == id) 658 if (hw_driverids[i] == id)
660 return hw_drivernames[i]; 659 return hw_devicenames[i];
661 return "unknown device"; 660 return "unknown device";
662} 661}
663 662
@@ -668,7 +667,7 @@ static const char *ivtv_i2c_hw_name(u32 hw)
668 667
669 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) 668 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
670 if (1 << i == hw) 669 if (1 << i == hw)
671 return hw_drivernames[i]; 670 return hw_devicenames[i];
672 return "unknown device"; 671 return "unknown device";
673} 672}
674 673
@@ -770,7 +769,7 @@ int init_ivtv_i2c(struct ivtv *itv)
770 * same size and GPIO must be the last entry. 769 * same size and GPIO must be the last entry.
771 */ 770 */
772 if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) || 771 if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
773 ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) || 772 ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
774 IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) || 773 IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
775 hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) { 774 hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
776 IVTV_ERR("Mismatched I2C hardware arrays\n"); 775 IVTV_ERR("Mismatched I2C hardware arrays\n");
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index d508b5d0538c..26cc0f6699fd 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -38,7 +38,7 @@
38#include <linux/dvb/audio.h> 38#include <linux/dvb/audio.h>
39#include <linux/i2c-id.h> 39#include <linux/i2c-id.h>
40 40
41u16 service2vbi(int type) 41u16 ivtv_service2vbi(int type)
42{ 42{
43 switch (type) { 43 switch (type) {
44 case V4L2_SLICED_TELETEXT_B: 44 case V4L2_SLICED_TELETEXT_B:
@@ -88,7 +88,7 @@ static u16 select_service_from_set(int field, int line, u16 set, int is_pal)
88 return 0; 88 return 0;
89} 89}
90 90
91void expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal) 91void ivtv_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal)
92{ 92{
93 u16 set = fmt->service_set; 93 u16 set = fmt->service_set;
94 int f, l; 94 int f, l;
@@ -115,7 +115,7 @@ static int check_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal)
115 return set != 0; 115 return set != 0;
116} 116}
117 117
118u16 get_service_set(struct v4l2_sliced_vbi_format *fmt) 118u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt)
119{ 119{
120 int f, l; 120 int f, l;
121 u16 set = 0; 121 u16 set = 0;
@@ -466,7 +466,7 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm
466 vbifmt->service_lines[0][23] = V4L2_SLICED_WSS_625; 466 vbifmt->service_lines[0][23] = V4L2_SLICED_WSS_625;
467 vbifmt->service_lines[0][16] = V4L2_SLICED_VPS; 467 vbifmt->service_lines[0][16] = V4L2_SLICED_VPS;
468 } 468 }
469 vbifmt->service_set = get_service_set(vbifmt); 469 vbifmt->service_set = ivtv_get_service_set(vbifmt);
470 break; 470 break;
471 } 471 }
472 472
@@ -481,12 +481,12 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm
481 if (streamtype == IVTV_DEC_STREAM_TYPE_VBI) { 481 if (streamtype == IVTV_DEC_STREAM_TYPE_VBI) {
482 vbifmt->service_set = itv->is_50hz ? V4L2_SLICED_VBI_625 : 482 vbifmt->service_set = itv->is_50hz ? V4L2_SLICED_VBI_625 :
483 V4L2_SLICED_VBI_525; 483 V4L2_SLICED_VBI_525;
484 expand_service_set(vbifmt, itv->is_50hz); 484 ivtv_expand_service_set(vbifmt, itv->is_50hz);
485 break; 485 break;
486 } 486 }
487 487
488 itv->video_dec_func(itv, VIDIOC_G_FMT, fmt); 488 itv->video_dec_func(itv, VIDIOC_G_FMT, fmt);
489 vbifmt->service_set = get_service_set(vbifmt); 489 vbifmt->service_set = ivtv_get_service_set(vbifmt);
490 break; 490 break;
491 } 491 }
492 case V4L2_BUF_TYPE_VBI_OUTPUT: 492 case V4L2_BUF_TYPE_VBI_OUTPUT:
@@ -640,9 +640,9 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype,
640 memset(vbifmt->reserved, 0, sizeof(vbifmt->reserved)); 640 memset(vbifmt->reserved, 0, sizeof(vbifmt->reserved));
641 641
642 if (vbifmt->service_set) 642 if (vbifmt->service_set)
643 expand_service_set(vbifmt, itv->is_50hz); 643 ivtv_expand_service_set(vbifmt, itv->is_50hz);
644 set = check_service_set(vbifmt, itv->is_50hz); 644 set = check_service_set(vbifmt, itv->is_50hz);
645 vbifmt->service_set = get_service_set(vbifmt); 645 vbifmt->service_set = ivtv_get_service_set(vbifmt);
646 646
647 if (!set_fmt) 647 if (!set_fmt)
648 return 0; 648 return 0;
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.h b/drivers/media/video/ivtv/ivtv-ioctl.h
index a03351b6853d..4e67f0ed1fc0 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.h
+++ b/drivers/media/video/ivtv/ivtv-ioctl.h
@@ -21,9 +21,9 @@
21#ifndef IVTV_IOCTL_H 21#ifndef IVTV_IOCTL_H
22#define IVTV_IOCTL_H 22#define IVTV_IOCTL_H
23 23
24u16 service2vbi(int type); 24u16 ivtv_service2vbi(int type);
25void expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal); 25void ivtv_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal);
26u16 get_service_set(struct v4l2_sliced_vbi_format *fmt); 26u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt);
27int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 27int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
28 unsigned long arg); 28 unsigned long arg);
29int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void *arg); 29int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void *arg);
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c
index d8ba3a4a8761..fba150a6cd23 100644
--- a/drivers/media/video/ivtv/ivtv-irq.c
+++ b/drivers/media/video/ivtv/ivtv-irq.c
@@ -231,14 +231,14 @@ static void dma_post(struct ivtv_stream *s)
231 struct ivtv_buffer *buf = NULL; 231 struct ivtv_buffer *buf = NULL;
232 struct list_head *p; 232 struct list_head *p;
233 u32 offset; 233 u32 offset;
234 u32 *u32buf; 234 __le32 *u32buf;
235 int x = 0; 235 int x = 0;
236 236
237 IVTV_DEBUG_HI_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", 237 IVTV_DEBUG_HI_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA",
238 s->name, s->dma_offset); 238 s->name, s->dma_offset);
239 list_for_each(p, &s->q_dma.list) { 239 list_for_each(p, &s->q_dma.list) {
240 buf = list_entry(p, struct ivtv_buffer, list); 240 buf = list_entry(p, struct ivtv_buffer, list);
241 u32buf = (u32 *)buf->buf; 241 u32buf = (__le32 *)buf->buf;
242 242
243 /* Sync Buffer */ 243 /* Sync Buffer */
244 ivtv_buf_sync_for_cpu(s, buf); 244 ivtv_buf_sync_for_cpu(s, buf);
@@ -444,7 +444,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
444 } 444 }
445 445
446 s->dma_xfer_cnt++; 446 s->dma_xfer_cnt++;
447 memcpy(s->sg_processing, s->sg_pending, sizeof(struct ivtv_sg_element) * s->sg_pending_size); 447 memcpy(s->sg_processing, s->sg_pending, sizeof(struct ivtv_sg_host_element) * s->sg_pending_size);
448 s->sg_processing_size = s->sg_pending_size; 448 s->sg_processing_size = s->sg_pending_size;
449 s->sg_pending_size = 0; 449 s->sg_pending_size = 0;
450 s->sg_processed = 0; 450 s->sg_processed = 0;
@@ -473,7 +473,7 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s)
473 if (s->q_predma.bytesused) 473 if (s->q_predma.bytesused)
474 ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); 474 ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused);
475 s->dma_xfer_cnt++; 475 s->dma_xfer_cnt++;
476 memcpy(s->sg_processing, s->sg_pending, sizeof(struct ivtv_sg_element) * s->sg_pending_size); 476 memcpy(s->sg_processing, s->sg_pending, sizeof(struct ivtv_sg_host_element) * s->sg_pending_size);
477 s->sg_processing_size = s->sg_pending_size; 477 s->sg_processing_size = s->sg_pending_size;
478 s->sg_pending_size = 0; 478 s->sg_pending_size = 0;
479 s->sg_processed = 0; 479 s->sg_processed = 0;
diff --git a/drivers/media/video/ivtv/ivtv-queue.c b/drivers/media/video/ivtv/ivtv-queue.c
index 3e1deec67a5e..71bd13e22e2e 100644
--- a/drivers/media/video/ivtv/ivtv-queue.c
+++ b/drivers/media/video/ivtv/ivtv-queue.c
@@ -193,7 +193,7 @@ void ivtv_flush_queues(struct ivtv_stream *s)
193int ivtv_stream_alloc(struct ivtv_stream *s) 193int ivtv_stream_alloc(struct ivtv_stream *s)
194{ 194{
195 struct ivtv *itv = s->itv; 195 struct ivtv *itv = s->itv;
196 int SGsize = sizeof(struct ivtv_sg_element) * s->buffers; 196 int SGsize = sizeof(struct ivtv_sg_host_element) * s->buffers;
197 int i; 197 int i;
198 198
199 if (s->buffers == 0) 199 if (s->buffers == 0)
@@ -203,14 +203,14 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
203 s->dma != PCI_DMA_NONE ? "DMA " : "", 203 s->dma != PCI_DMA_NONE ? "DMA " : "",
204 s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024); 204 s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024);
205 205
206 s->sg_pending = kzalloc(SGsize, GFP_KERNEL); 206 s->sg_pending = kzalloc(SGsize, GFP_KERNEL|__GFP_NOWARN);
207 if (s->sg_pending == NULL) { 207 if (s->sg_pending == NULL) {
208 IVTV_ERR("Could not allocate sg_pending for %s stream\n", s->name); 208 IVTV_ERR("Could not allocate sg_pending for %s stream\n", s->name);
209 return -ENOMEM; 209 return -ENOMEM;
210 } 210 }
211 s->sg_pending_size = 0; 211 s->sg_pending_size = 0;
212 212
213 s->sg_processing = kzalloc(SGsize, GFP_KERNEL); 213 s->sg_processing = kzalloc(SGsize, GFP_KERNEL|__GFP_NOWARN);
214 if (s->sg_processing == NULL) { 214 if (s->sg_processing == NULL) {
215 IVTV_ERR("Could not allocate sg_processing for %s stream\n", s->name); 215 IVTV_ERR("Could not allocate sg_processing for %s stream\n", s->name);
216 kfree(s->sg_pending); 216 kfree(s->sg_pending);
@@ -219,7 +219,8 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
219 } 219 }
220 s->sg_processing_size = 0; 220 s->sg_processing_size = 0;
221 221
222 s->sg_dma = kzalloc(sizeof(struct ivtv_sg_element), GFP_KERNEL); 222 s->sg_dma = kzalloc(sizeof(struct ivtv_sg_element),
223 GFP_KERNEL|__GFP_NOWARN);
223 if (s->sg_dma == NULL) { 224 if (s->sg_dma == NULL) {
224 IVTV_ERR("Could not allocate sg_dma for %s stream\n", s->name); 225 IVTV_ERR("Could not allocate sg_dma for %s stream\n", s->name);
225 kfree(s->sg_pending); 226 kfree(s->sg_pending);
@@ -235,11 +236,12 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
235 236
236 /* allocate stream buffers. Initially all buffers are in q_free. */ 237 /* allocate stream buffers. Initially all buffers are in q_free. */
237 for (i = 0; i < s->buffers; i++) { 238 for (i = 0; i < s->buffers; i++) {
238 struct ivtv_buffer *buf = kzalloc(sizeof(struct ivtv_buffer), GFP_KERNEL); 239 struct ivtv_buffer *buf = kzalloc(sizeof(struct ivtv_buffer),
240 GFP_KERNEL|__GFP_NOWARN);
239 241
240 if (buf == NULL) 242 if (buf == NULL)
241 break; 243 break;
242 buf->buf = kmalloc(s->buf_size + 256, GFP_KERNEL); 244 buf->buf = kmalloc(s->buf_size + 256, GFP_KERNEL|__GFP_NOWARN);
243 if (buf->buf == NULL) { 245 if (buf->buf == NULL) {
244 kfree(buf); 246 kfree(buf);
245 break; 247 break;
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 4ab8d36831ba..c854285a4371 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -44,23 +44,25 @@
44#include "ivtv-streams.h" 44#include "ivtv-streams.h"
45 45
46static const struct file_operations ivtv_v4l2_enc_fops = { 46static const struct file_operations ivtv_v4l2_enc_fops = {
47 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
48 .read = ivtv_v4l2_read, 48 .read = ivtv_v4l2_read,
49 .write = ivtv_v4l2_write, 49 .write = ivtv_v4l2_write,
50 .open = ivtv_v4l2_open, 50 .open = ivtv_v4l2_open,
51 .ioctl = ivtv_v4l2_ioctl, 51 .ioctl = ivtv_v4l2_ioctl,
52 .release = ivtv_v4l2_close, 52 .compat_ioctl = v4l_compat_ioctl32,
53 .poll = ivtv_v4l2_enc_poll, 53 .release = ivtv_v4l2_close,
54 .poll = ivtv_v4l2_enc_poll,
54}; 55};
55 56
56static const struct file_operations ivtv_v4l2_dec_fops = { 57static const struct file_operations ivtv_v4l2_dec_fops = {
57 .owner = THIS_MODULE, 58 .owner = THIS_MODULE,
58 .read = ivtv_v4l2_read, 59 .read = ivtv_v4l2_read,
59 .write = ivtv_v4l2_write, 60 .write = ivtv_v4l2_write,
60 .open = ivtv_v4l2_open, 61 .open = ivtv_v4l2_open,
61 .ioctl = ivtv_v4l2_ioctl, 62 .ioctl = ivtv_v4l2_ioctl,
62 .release = ivtv_v4l2_close, 63 .compat_ioctl = v4l_compat_ioctl32,
63 .poll = ivtv_v4l2_dec_poll, 64 .release = ivtv_v4l2_close,
65 .poll = ivtv_v4l2_dec_poll,
64}; 66};
65 67
66#define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ 68#define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */
@@ -244,7 +246,7 @@ int ivtv_streams_setup(struct ivtv *itv)
244 return 0; 246 return 0;
245 247
246 /* One or more streams could not be initialized. Clean 'em all up. */ 248 /* One or more streams could not be initialized. Clean 'em all up. */
247 ivtv_streams_cleanup(itv); 249 ivtv_streams_cleanup(itv, 0);
248 return -ENOMEM; 250 return -ENOMEM;
249} 251}
250 252
@@ -304,12 +306,12 @@ int ivtv_streams_register(struct ivtv *itv)
304 return 0; 306 return 0;
305 307
306 /* One or more streams could not be initialized. Clean 'em all up. */ 308 /* One or more streams could not be initialized. Clean 'em all up. */
307 ivtv_streams_cleanup(itv); 309 ivtv_streams_cleanup(itv, 1);
308 return -ENOMEM; 310 return -ENOMEM;
309} 311}
310 312
311/* Unregister v4l2 devices */ 313/* Unregister v4l2 devices */
312void ivtv_streams_cleanup(struct ivtv *itv) 314void ivtv_streams_cleanup(struct ivtv *itv, int unregister)
313{ 315{
314 int type; 316 int type;
315 317
@@ -322,8 +324,11 @@ void ivtv_streams_cleanup(struct ivtv *itv)
322 continue; 324 continue;
323 325
324 ivtv_stream_free(&itv->streams[type]); 326 ivtv_stream_free(&itv->streams[type]);
325 /* Unregister device */ 327 /* Unregister or release device */
326 video_unregister_device(vdev); 328 if (unregister)
329 video_unregister_device(vdev);
330 else
331 video_device_release(vdev);
327 } 332 }
328} 333}
329 334
diff --git a/drivers/media/video/ivtv/ivtv-streams.h b/drivers/media/video/ivtv/ivtv-streams.h
index 3d76a415fbd8..a653a5136417 100644
--- a/drivers/media/video/ivtv/ivtv-streams.h
+++ b/drivers/media/video/ivtv/ivtv-streams.h
@@ -23,7 +23,7 @@
23 23
24int ivtv_streams_setup(struct ivtv *itv); 24int ivtv_streams_setup(struct ivtv *itv);
25int ivtv_streams_register(struct ivtv *itv); 25int ivtv_streams_register(struct ivtv *itv);
26void ivtv_streams_cleanup(struct ivtv *itv); 26void ivtv_streams_cleanup(struct ivtv *itv, int unregister);
27 27
28/* Capture related */ 28/* Capture related */
29int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s); 29int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s);
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c
index c151bcf5519a..71798f0da27f 100644
--- a/drivers/media/video/ivtv/ivtv-vbi.c
+++ b/drivers/media/video/ivtv/ivtv-vbi.c
@@ -169,7 +169,8 @@ static void copy_vbi_data(struct ivtv *itv, int lines, u32 pts_stamp)
169 linemask[0] |= (1 << l); 169 linemask[0] |= (1 << l);
170 else 170 else
171 linemask[1] |= (1 << (l - 32)); 171 linemask[1] |= (1 << (l - 32));
172 dst[sd + 12 + line * 43] = service2vbi(itv->vbi.sliced_data[i].id); 172 dst[sd + 12 + line * 43] =
173 ivtv_service2vbi(itv->vbi.sliced_data[i].id);
173 memcpy(dst + sd + 12 + line * 43 + 1, itv->vbi.sliced_data[i].data, 42); 174 memcpy(dst + sd + 12 + line * 43 + 1, itv->vbi.sliced_data[i].data, 42);
174 line++; 175 line++;
175 } 176 }
diff --git a/drivers/media/video/ivtv/ivtv-version.h b/drivers/media/video/ivtv/ivtv-version.h
index 02c5ab071d1b..442f43f11b73 100644
--- a/drivers/media/video/ivtv/ivtv-version.h
+++ b/drivers/media/video/ivtv/ivtv-version.h
@@ -22,8 +22,8 @@
22 22
23#define IVTV_DRIVER_NAME "ivtv" 23#define IVTV_DRIVER_NAME "ivtv"
24#define IVTV_DRIVER_VERSION_MAJOR 1 24#define IVTV_DRIVER_VERSION_MAJOR 1
25#define IVTV_DRIVER_VERSION_MINOR 2 25#define IVTV_DRIVER_VERSION_MINOR 3
26#define IVTV_DRIVER_VERSION_PATCHLEVEL 1 26#define IVTV_DRIVER_VERSION_PATCHLEVEL 0
27 27
28#define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL) 28#define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL)
29#define IVTV_DRIVER_VERSION KERNEL_VERSION(IVTV_DRIVER_VERSION_MAJOR,IVTV_DRIVER_VERSION_MINOR,IVTV_DRIVER_VERSION_PATCHLEVEL) 29#define IVTV_DRIVER_VERSION KERNEL_VERSION(IVTV_DRIVER_VERSION_MAJOR,IVTV_DRIVER_VERSION_MINOR,IVTV_DRIVER_VERSION_PATCHLEVEL)
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c
index 62f70bd5e3cb..3092ff1d00a0 100644
--- a/drivers/media/video/ivtv/ivtv-yuv.c
+++ b/drivers/media/video/ivtv/ivtv-yuv.c
@@ -908,7 +908,7 @@ static void ivtv_yuv_init(struct ivtv *itv)
908 } 908 }
909 909
910 /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ 910 /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */
911 yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL); 911 yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL|__GFP_NOWARN);
912 if (yi->blanking_ptr) { 912 if (yi->blanking_ptr) {
913 yi->blanking_dmaptr = pci_map_single(itv->dev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE); 913 yi->blanking_dmaptr = pci_map_single(itv->dev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE);
914 } else { 914 } else {
@@ -1116,7 +1116,7 @@ void ivtv_yuv_setup_stream_frame(struct ivtv *itv)
1116} 1116}
1117 1117
1118/* Attempt to dma a frame from a user buffer */ 1118/* Attempt to dma a frame from a user buffer */
1119int ivtv_yuv_udma_stream_frame(struct ivtv *itv, void *src) 1119int ivtv_yuv_udma_stream_frame(struct ivtv *itv, void __user *src)
1120{ 1120{
1121 struct yuv_playback_info *yi = &itv->yuv_info; 1121 struct yuv_playback_info *yi = &itv->yuv_info;
1122 struct ivtv_dma_frame dma_args; 1122 struct ivtv_dma_frame dma_args;
diff --git a/drivers/media/video/ivtv/ivtv-yuv.h b/drivers/media/video/ivtv/ivtv-yuv.h
index 2fe5f1250762..ca5173fbf006 100644
--- a/drivers/media/video/ivtv/ivtv-yuv.h
+++ b/drivers/media/video/ivtv/ivtv-yuv.h
@@ -35,7 +35,7 @@ extern const u32 yuv_offset[IVTV_YUV_BUFFERS];
35 35
36int ivtv_yuv_filter_check(struct ivtv *itv); 36int ivtv_yuv_filter_check(struct ivtv *itv);
37void ivtv_yuv_setup_stream_frame(struct ivtv *itv); 37void ivtv_yuv_setup_stream_frame(struct ivtv *itv);
38int ivtv_yuv_udma_stream_frame(struct ivtv *itv, void *src); 38int ivtv_yuv_udma_stream_frame(struct ivtv *itv, void __user *src);
39void ivtv_yuv_frame_complete(struct ivtv *itv); 39void ivtv_yuv_frame_complete(struct ivtv *itv);
40int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args); 40int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args);
41void ivtv_yuv_close(struct ivtv *itv); 41void ivtv_yuv_close(struct ivtv *itv);
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index df789f683e63..73be154f7f05 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -948,7 +948,8 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
948 } 948 }
949 949
950 /* Allocate the pseudo palette */ 950 /* Allocate the pseudo palette */
951 oi->ivtvfb_info.pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 951 oi->ivtvfb_info.pseudo_palette =
952 kmalloc(sizeof(u32) * 16, GFP_KERNEL|__GFP_NOWARN);
952 953
953 if (!oi->ivtvfb_info.pseudo_palette) { 954 if (!oi->ivtvfb_info.pseudo_palette) {
954 IVTVFB_ERR("abort, unable to alloc pseudo pallete\n"); 955 IVTVFB_ERR("abort, unable to alloc pseudo pallete\n");
@@ -1056,7 +1057,8 @@ static int ivtvfb_init_card(struct ivtv *itv)
1056 return -EBUSY; 1057 return -EBUSY;
1057 } 1058 }
1058 1059
1059 itv->osd_info = kzalloc(sizeof(struct osd_info), GFP_ATOMIC); 1060 itv->osd_info = kzalloc(sizeof(struct osd_info),
1061 GFP_ATOMIC|__GFP_NOWARN);
1060 if (itv->osd_info == NULL) { 1062 if (itv->osd_info == NULL) {
1061 IVTVFB_ERR("Failed to allocate memory for osd_info\n"); 1063 IVTVFB_ERR("Failed to allocate memory for osd_info\n");
1062 return -ENOMEM; 1064 return -ENOMEM;
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c
index 5b9dfa2c51b4..8e0160d275ca 100644
--- a/drivers/media/video/m52790.c
+++ b/drivers/media/video/m52790.c
@@ -135,8 +135,6 @@ static int m52790_probe(struct i2c_client *client,
135 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 135 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
136 return -EIO; 136 return -EIO;
137 137
138 snprintf(client->name, sizeof(client->name) - 1, "m52790");
139
140 v4l_info(client, "chip found @ 0x%x (%s)\n", 138 v4l_info(client, "chip found @ 0x%x (%s)\n",
141 client->addr << 1, client->adapter->name); 139 client->addr << 1, client->adapter->name);
142 140
@@ -159,11 +157,18 @@ static int m52790_remove(struct i2c_client *client)
159 157
160/* ----------------------------------------------------------------------- */ 158/* ----------------------------------------------------------------------- */
161 159
160static const struct i2c_device_id m52790_id[] = {
161 { "m52790", 0 },
162 { }
163};
164MODULE_DEVICE_TABLE(i2c, m52790_id);
165
162static struct v4l2_i2c_driver_data v4l2_i2c_data = { 166static struct v4l2_i2c_driver_data v4l2_i2c_data = {
163 .name = "m52790", 167 .name = "m52790",
164 .driverid = I2C_DRIVERID_M52790, 168 .driverid = I2C_DRIVERID_M52790,
165 .command = m52790_command, 169 .command = m52790_command,
166 .probe = m52790_probe, 170 .probe = m52790_probe,
167 .remove = m52790_remove, 171 .remove = m52790_remove,
172 .id_table = m52790_id,
168}; 173};
169 174
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index e6273162e123..310dbaba55ff 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -815,7 +815,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
815 int msp_product, msp_prod_hi, msp_prod_lo; 815 int msp_product, msp_prod_hi, msp_prod_lo;
816 int msp_rom; 816 int msp_rom;
817 817
818 snprintf(client->name, sizeof(client->name) - 1, "msp3400"); 818 if (!id)
819 strlcpy(client->name, "msp3400", sizeof(client->name));
819 820
820 if (msp_reset(client) == -1) { 821 if (msp_reset(client) == -1) {
821 v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); 822 v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
@@ -864,9 +865,6 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
864 msp_revision = (state->rev1 & 0x0f) + '@'; 865 msp_revision = (state->rev1 & 0x0f) + '@';
865 msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; 866 msp_hard = ((state->rev1 >> 8) & 0xff) + '@';
866 msp_rom = state->rev2 & 0x1f; 867 msp_rom = state->rev2 & 0x1f;
867 snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d",
868 msp_family, msp_product,
869 msp_revision, msp_hard, msp_rom);
870 /* Rev B=2, C=3, D=4, G=7 */ 868 /* Rev B=2, C=3, D=4, G=7 */
871 state->ident = msp_family * 10000 + 4000 + msp_product * 10 + 869 state->ident = msp_family * 10000 + 4000 + msp_product * 10 +
872 msp_revision - '@'; 870 msp_revision - '@';
@@ -931,7 +929,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
931 } 929 }
932 930
933 /* hello world :-) */ 931 /* hello world :-) */
934 v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, 932 v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n",
933 msp_family, msp_product,
934 msp_revision, msp_hard, msp_rom,
935 client->addr << 1, client->adapter->name); 935 client->addr << 1, client->adapter->name);
936 v4l_info(client, "%s ", client->name); 936 v4l_info(client, "%s ", client->name);
937 if (state->has_nicam && state->has_radio) 937 if (state->has_nicam && state->has_radio)
@@ -987,6 +987,12 @@ static int msp_remove(struct i2c_client *client)
987 987
988/* ----------------------------------------------------------------------- */ 988/* ----------------------------------------------------------------------- */
989 989
990static const struct i2c_device_id msp_id[] = {
991 { "msp3400", 0 },
992 { }
993};
994MODULE_DEVICE_TABLE(i2c, msp_id);
995
990static struct v4l2_i2c_driver_data v4l2_i2c_data = { 996static struct v4l2_i2c_driver_data v4l2_i2c_data = {
991 .name = "msp3400", 997 .name = "msp3400",
992 .driverid = I2C_DRIVERID_MSP3400, 998 .driverid = I2C_DRIVERID_MSP3400,
@@ -995,6 +1001,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
995 .remove = msp_remove, 1001 .remove = msp_remove,
996 .suspend = msp_suspend, 1002 .suspend = msp_suspend,
997 .resume = msp_resume, 1003 .resume = msp_resume,
1004 .id_table = msp_id,
998}; 1005};
999 1006
1000 1007
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 179e47049a45..ee43499544c1 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -12,15 +12,12 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/log2.h> 14#include <linux/log2.h>
15#include <linux/gpio.h>
15 16
16#include <media/v4l2-common.h> 17#include <media/v4l2-common.h>
17#include <media/v4l2-chip-ident.h> 18#include <media/v4l2-chip-ident.h>
18#include <media/soc_camera.h> 19#include <media/soc_camera.h>
19 20
20#ifdef CONFIG_MT9M001_PCA9536_SWITCH
21#include <asm/gpio.h>
22#endif
23
24/* mt9m001 i2c address 0x5d 21/* mt9m001 i2c address 0x5d
25 * The platform has to define i2c_board_info 22 * The platform has to define i2c_board_info
26 * and call i2c_register_board_info() */ 23 * and call i2c_register_board_info() */
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index d1391ac55096..1658fe590392 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -13,15 +13,12 @@
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/log2.h> 15#include <linux/log2.h>
16#include <linux/gpio.h>
16 17
17#include <media/v4l2-common.h> 18#include <media/v4l2-common.h>
18#include <media/v4l2-chip-ident.h> 19#include <media/v4l2-chip-ident.h>
19#include <media/soc_camera.h> 20#include <media/soc_camera.h>
20 21
21#ifdef CONFIG_MT9M001_PCA9536_SWITCH
22#include <asm/gpio.h>
23#endif
24
25/* mt9v022 i2c address 0x48, 0x4c, 0x58, 0x5c 22/* mt9v022 i2c address 0x48, 0x4c, 0x58, 0x5c
26 * The platform has to define i2c_board_info 23 * The platform has to define i2c_board_info
27 * and call i2c_register_board_info() */ 24 * and call i2c_register_board_info() */
@@ -91,7 +88,7 @@ static const struct soc_camera_data_format mt9v022_monochrome_formats[] = {
91struct mt9v022 { 88struct mt9v022 {
92 struct i2c_client *client; 89 struct i2c_client *client;
93 struct soc_camera_device icd; 90 struct soc_camera_device icd;
94 int model; /* V4L2_IDENT_MT9M001* codes from v4l2-chip-ident.h */ 91 int model; /* V4L2_IDENT_MT9V022* codes from v4l2-chip-ident.h */
95 int switch_gpio; 92 int switch_gpio;
96 u16 chip_control; 93 u16 chip_control;
97 unsigned char datawidth; 94 unsigned char datawidth;
diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig
index 9620c67fae77..4482b2c72ced 100644
--- a/drivers/media/video/pvrusb2/Kconfig
+++ b/drivers/media/video/pvrusb2/Kconfig
@@ -1,8 +1,10 @@
1config VIDEO_PVRUSB2 1config VIDEO_PVRUSB2
2 tristate "Hauppauge WinTV-PVR USB2 support" 2 tristate "Hauppauge WinTV-PVR USB2 support"
3 depends on VIDEO_V4L2 && I2C 3 depends on VIDEO_V4L2 && I2C
4 depends on VIDEO_MEDIA # Avoids pvrusb = Y / DVB = M
5 depends on HOTPLUG # due to FW_LOADER
4 select FW_LOADER 6 select FW_LOADER
5 select MEDIA_TUNER 7 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 8 select VIDEO_TVEEPROM
7 select VIDEO_CX2341X 9 select VIDEO_CX2341X
8 select VIDEO_SAA711X 10 select VIDEO_SAA711X
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index e684108637ad..435c083cc542 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1456,14 +1456,13 @@ static int saa7115_probe(struct i2c_client *client,
1456 struct saa711x_state *state; 1456 struct saa711x_state *state;
1457 int i; 1457 int i;
1458 char name[17]; 1458 char name[17];
1459 u8 chip_id; 1459 char chip_id;
1460 int autodetect = !id || id->driver_data == 1;
1460 1461
1461 /* Check if the adapter supports the needed features */ 1462 /* Check if the adapter supports the needed features */
1462 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1463 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1463 return -EIO; 1464 return -EIO;
1464 1465
1465 snprintf(client->name, sizeof(client->name) - 1, "saa7115");
1466
1467 for (i = 0; i < 0x0f; i++) { 1466 for (i = 0; i < 0x0f; i++) {
1468 saa711x_write(client, 0, i); 1467 saa711x_write(client, 0, i);
1469 name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; 1468 name[i] = (saa711x_read(client, 0) & 0x0f) + '0';
@@ -1472,8 +1471,7 @@ static int saa7115_probe(struct i2c_client *client,
1472 } 1471 }
1473 name[i] = '\0'; 1472 name[i] = '\0';
1474 1473
1475 saa711x_write(client, 0, 5); 1474 chip_id = name[5];
1476 chip_id = saa711x_read(client, 0) & 0x0f;
1477 1475
1478 /* Check whether this chip is part of the saa711x series */ 1476 /* Check whether this chip is part of the saa711x series */
1479 if (memcmp(name, "1f711", 5)) { 1477 if (memcmp(name, "1f711", 5)) {
@@ -1482,8 +1480,14 @@ static int saa7115_probe(struct i2c_client *client,
1482 return -ENODEV; 1480 return -ENODEV;
1483 } 1481 }
1484 1482
1485 snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); 1483 /* Safety check */
1486 v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, client->addr << 1, client->adapter->name); 1484 if (!autodetect && id->name[6] != chip_id) {
1485 v4l_warn(client, "found saa711%c while %s was expected\n",
1486 chip_id, id->name);
1487 }
1488 snprintf(client->name, sizeof(client->name), "saa711%c", chip_id);
1489 v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name,
1490 client->addr << 1, client->adapter->name);
1487 1491
1488 state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); 1492 state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
1489 i2c_set_clientdata(client, state); 1493 i2c_set_clientdata(client, state);
@@ -1499,19 +1503,19 @@ static int saa7115_probe(struct i2c_client *client,
1499 state->hue = 0; 1503 state->hue = 0;
1500 state->sat = 64; 1504 state->sat = 64;
1501 switch (chip_id) { 1505 switch (chip_id) {
1502 case 1: 1506 case '1':
1503 state->ident = V4L2_IDENT_SAA7111; 1507 state->ident = V4L2_IDENT_SAA7111;
1504 break; 1508 break;
1505 case 3: 1509 case '3':
1506 state->ident = V4L2_IDENT_SAA7113; 1510 state->ident = V4L2_IDENT_SAA7113;
1507 break; 1511 break;
1508 case 4: 1512 case '4':
1509 state->ident = V4L2_IDENT_SAA7114; 1513 state->ident = V4L2_IDENT_SAA7114;
1510 break; 1514 break;
1511 case 5: 1515 case '5':
1512 state->ident = V4L2_IDENT_SAA7115; 1516 state->ident = V4L2_IDENT_SAA7115;
1513 break; 1517 break;
1514 case 8: 1518 case '8':
1515 state->ident = V4L2_IDENT_SAA7118; 1519 state->ident = V4L2_IDENT_SAA7118;
1516 break; 1520 break;
1517 default: 1521 default:
@@ -1553,6 +1557,17 @@ static int saa7115_remove(struct i2c_client *client)
1553 return 0; 1557 return 0;
1554} 1558}
1555 1559
1560static const struct i2c_device_id saa7115_id[] = {
1561 { "saa711x", 1 }, /* autodetect */
1562 { "saa7111", 0 },
1563 { "saa7113", 0 },
1564 { "saa7114", 0 },
1565 { "saa7115", 0 },
1566 { "saa7118", 0 },
1567 { }
1568};
1569MODULE_DEVICE_TABLE(i2c, saa7115_id);
1570
1556static struct v4l2_i2c_driver_data v4l2_i2c_data = { 1571static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1557 .name = "saa7115", 1572 .name = "saa7115",
1558 .driverid = I2C_DRIVERID_SAA711X, 1573 .driverid = I2C_DRIVERID_SAA711X,
@@ -1560,5 +1575,6 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1560 .probe = saa7115_probe, 1575 .probe = saa7115_probe,
1561 .remove = saa7115_remove, 1576 .remove = saa7115_remove,
1562 .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, 1577 .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL,
1578 .id_table = saa7115_id,
1563}; 1579};
1564 1580
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index e750cd65c1c3..79d11a658bdf 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -672,8 +672,6 @@ static int saa7127_probe(struct i2c_client *client,
672 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 672 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
673 return -EIO; 673 return -EIO;
674 674
675 snprintf(client->name, sizeof(client->name) - 1, "saa7127");
676
677 v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", 675 v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n",
678 client->addr << 1); 676 client->addr << 1);
679 677
@@ -741,11 +739,18 @@ static int saa7127_remove(struct i2c_client *client)
741 739
742/* ----------------------------------------------------------------------- */ 740/* ----------------------------------------------------------------------- */
743 741
742static struct i2c_device_id saa7127_id[] = {
743 { "saa7127", 0 },
744 { }
745};
746MODULE_DEVICE_TABLE(i2c, saa7127_id);
747
744static struct v4l2_i2c_driver_data v4l2_i2c_data = { 748static struct v4l2_i2c_driver_data v4l2_i2c_data = {
745 .name = "saa7127", 749 .name = "saa7127",
746 .driverid = I2C_DRIVERID_SAA7127, 750 .driverid = I2C_DRIVERID_SAA7127,
747 .command = saa7127_command, 751 .command = saa7127_command,
748 .probe = saa7127_probe, 752 .probe = saa7127_probe,
749 .remove = saa7127_remove, 753 .remove = saa7127_remove,
754 .id_table = saa7127_id,
750}; 755};
751 756
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index 40e4c3bd2cb9..83f076abce35 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -3,7 +3,7 @@ config VIDEO_SAA7134
3 depends on VIDEO_DEV && PCI && I2C && INPUT 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select VIDEOBUF_DMA_SG 4 select VIDEOBUF_DMA_SG
5 select VIDEO_IR 5 select VIDEO_IR
6 select MEDIA_TUNER 6 select VIDEO_TUNER
7 select VIDEO_TVEEPROM 7 select VIDEO_TVEEPROM
8 select CRC32 8 select CRC32
9 ---help--- 9 ---help---
@@ -27,6 +27,7 @@ config VIDEO_SAA7134_ALSA
27config VIDEO_SAA7134_DVB 27config VIDEO_SAA7134_DVB
28 tristate "DVB/ATSC Support for saa7134 based TV cards" 28 tristate "DVB/ATSC Support for saa7134 based TV cards"
29 depends on VIDEO_SAA7134 && DVB_CORE 29 depends on VIDEO_SAA7134 && DVB_CORE
30 depends on HOTPLUG # due to FW_LOADER
30 select VIDEOBUF_DVB 31 select VIDEOBUF_DVB
31 select FW_LOADER 32 select FW_LOADER
32 select DVB_PLL if !DVB_FE_CUSTOMISE 33 select DVB_PLL if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index eec127864fe3..2c19cd0113c8 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -864,7 +864,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
864 struct saa7134_dev *dev; 864 struct saa7134_dev *dev;
865 struct saa7134_mpeg_ops *mops; 865 struct saa7134_mpeg_ops *mops;
866 int err; 866 int err;
867 int mask;
868 867
869 if (saa7134_devcount == SAA7134_MAXBOARDS) 868 if (saa7134_devcount == SAA7134_MAXBOARDS)
870 return -ENOMEM; 869 return -ENOMEM;
@@ -1065,11 +1064,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1065 if (TUNER_ABSENT != dev->tuner_type) 1064 if (TUNER_ABSENT != dev->tuner_type)
1066 saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); 1065 saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
1067 1066
1068 if (card(dev).gpiomask != 0) {
1069 mask = card(dev).gpiomask;
1070 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
1071 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, 0);
1072 }
1073 return 0; 1067 return 0;
1074 1068
1075 fail4: 1069 fail4:
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 2d16be2259db..469f93aac008 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -538,19 +538,23 @@ static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe)
538 return 0; 538 return 0;
539} 539}
540 540
541static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *cdec_conf, 541static int configure_tda827x_fe(struct saa7134_dev *dev,
542 struct tda827x_config *tuner_conf) 542 struct tda1004x_config *cdec_conf,
543 struct tda827x_config *tuner_conf)
543{ 544{
544 dev->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); 545 dev->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap);
545 if (dev->dvb.frontend) { 546 if (dev->dvb.frontend) {
546 if (cdec_conf->i2c_gate) 547 if (cdec_conf->i2c_gate)
547 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; 548 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
548 if (dvb_attach(tda827x_attach, dev->dvb.frontend, cdec_conf->tuner_address, 549 if (dvb_attach(tda827x_attach, dev->dvb.frontend,
549 &dev->i2c_adap, tuner_conf) == NULL) { 550 cdec_conf->tuner_address,
550 wprintk("no tda827x tuner found at addr: %02x\n", 551 &dev->i2c_adap, tuner_conf))
552 return 0;
553
554 wprintk("no tda827x tuner found at addr: %02x\n",
551 cdec_conf->tuner_address); 555 cdec_conf->tuner_address);
552 }
553 } 556 }
557 return -EINVAL;
554} 558}
555 559
556/* ------------------------------------------------------------------ */ 560/* ------------------------------------------------------------------ */
@@ -997,7 +1001,9 @@ static int dvb_init(struct saa7134_dev *dev)
997 break; 1001 break;
998 case SAA7134_BOARD_FLYDVBTDUO: 1002 case SAA7134_BOARD_FLYDVBTDUO:
999 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: 1003 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
1000 configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0); 1004 if (configure_tda827x_fe(dev, &tda827x_lifeview_config,
1005 &tda827x_cfg_0) < 0)
1006 goto dettach_frontend;
1001 break; 1007 break;
1002 case SAA7134_BOARD_PHILIPS_EUROPA: 1008 case SAA7134_BOARD_PHILIPS_EUROPA:
1003 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 1009 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
@@ -1022,36 +1028,52 @@ static int dvb_init(struct saa7134_dev *dev)
1022 } 1028 }
1023 break; 1029 break;
1024 case SAA7134_BOARD_KWORLD_DVBT_210: 1030 case SAA7134_BOARD_KWORLD_DVBT_210:
1025 configure_tda827x_fe(dev, &kworld_dvb_t_210_config, &tda827x_cfg_2); 1031 if (configure_tda827x_fe(dev, &kworld_dvb_t_210_config,
1032 &tda827x_cfg_2) < 0)
1033 goto dettach_frontend;
1026 break; 1034 break;
1027 case SAA7134_BOARD_PHILIPS_TIGER: 1035 case SAA7134_BOARD_PHILIPS_TIGER:
1028 configure_tda827x_fe(dev, &philips_tiger_config, &tda827x_cfg_0); 1036 if (configure_tda827x_fe(dev, &philips_tiger_config,
1037 &tda827x_cfg_0) < 0)
1038 goto dettach_frontend;
1029 break; 1039 break;
1030 case SAA7134_BOARD_PINNACLE_PCTV_310i: 1040 case SAA7134_BOARD_PINNACLE_PCTV_310i:
1031 configure_tda827x_fe(dev, &pinnacle_pctv_310i_config, &tda827x_cfg_1); 1041 if (configure_tda827x_fe(dev, &pinnacle_pctv_310i_config,
1042 &tda827x_cfg_1) < 0)
1043 goto dettach_frontend;
1032 break; 1044 break;
1033 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 1045 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
1034 configure_tda827x_fe(dev, &hauppauge_hvr_1110_config, &tda827x_cfg_1); 1046 if (configure_tda827x_fe(dev, &hauppauge_hvr_1110_config,
1047 &tda827x_cfg_1) < 0)
1048 goto dettach_frontend;
1035 break; 1049 break;
1036 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 1050 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
1037 configure_tda827x_fe(dev, &asus_p7131_dual_config, &tda827x_cfg_0); 1051 if (configure_tda827x_fe(dev, &asus_p7131_dual_config,
1052 &tda827x_cfg_0) < 0)
1053 goto dettach_frontend;
1038 break; 1054 break;
1039 case SAA7134_BOARD_FLYDVBT_LR301: 1055 case SAA7134_BOARD_FLYDVBT_LR301:
1040 configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0); 1056 if (configure_tda827x_fe(dev, &tda827x_lifeview_config,
1057 &tda827x_cfg_0) < 0)
1058 goto dettach_frontend;
1041 break; 1059 break;
1042 case SAA7134_BOARD_FLYDVB_TRIO: 1060 case SAA7134_BOARD_FLYDVB_TRIO:
1043 if(! use_frontend) { /* terrestrial */ 1061 if (!use_frontend) { /* terrestrial */
1044 configure_tda827x_fe(dev, &lifeview_trio_config, &tda827x_cfg_0); 1062 if (configure_tda827x_fe(dev, &lifeview_trio_config,
1063 &tda827x_cfg_0) < 0)
1064 goto dettach_frontend;
1045 } else { /* satellite */ 1065 } else { /* satellite */
1046 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); 1066 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
1047 if (dev->dvb.frontend) { 1067 if (dev->dvb.frontend) {
1048 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, 1068 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
1049 &dev->i2c_adap, 0) == NULL) { 1069 &dev->i2c_adap, 0) == NULL) {
1050 wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__); 1070 wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__);
1071 goto dettach_frontend;
1051 } 1072 }
1052 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, 1073 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap,
1053 0x08, 0, 0) == NULL) { 1074 0x08, 0, 0) == NULL) {
1054 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__); 1075 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__);
1076 goto dettach_frontend;
1055 } 1077 }
1056 } 1078 }
1057 } 1079 }
@@ -1067,15 +1089,20 @@ static int dvb_init(struct saa7134_dev *dev)
1067 &ads_duo_cfg) == NULL) { 1089 &ads_duo_cfg) == NULL) {
1068 wprintk("no tda827x tuner found at addr: %02x\n", 1090 wprintk("no tda827x tuner found at addr: %02x\n",
1069 ads_tech_duo_config.tuner_address); 1091 ads_tech_duo_config.tuner_address);
1092 goto dettach_frontend;
1070 } 1093 }
1071 } 1094 }
1072 break; 1095 break;
1073 case SAA7134_BOARD_TEVION_DVBT_220RF: 1096 case SAA7134_BOARD_TEVION_DVBT_220RF:
1074 configure_tda827x_fe(dev, &tevion_dvbt220rf_config, &tda827x_cfg_0); 1097 if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config,
1098 &tda827x_cfg_0) < 0)
1099 goto dettach_frontend;
1075 break; 1100 break;
1076 case SAA7134_BOARD_MEDION_MD8800_QUADRO: 1101 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
1077 if (!use_frontend) { /* terrestrial */ 1102 if (!use_frontend) { /* terrestrial */
1078 configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0); 1103 if (configure_tda827x_fe(dev, &md8800_dvbt_config,
1104 &tda827x_cfg_0) < 0)
1105 goto dettach_frontend;
1079 } else { /* satellite */ 1106 } else { /* satellite */
1080 dev->dvb.frontend = dvb_attach(tda10086_attach, 1107 dev->dvb.frontend = dvb_attach(tda10086_attach,
1081 &flydvbs, &dev->i2c_adap); 1108 &flydvbs, &dev->i2c_adap);
@@ -1086,16 +1113,20 @@ static int dvb_init(struct saa7134_dev *dev)
1086 struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1}; 1113 struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1};
1087 1114
1088 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 1115 if (dvb_attach(tda826x_attach, dev->dvb.frontend,
1089 0x60, &dev->i2c_adap, 0) == NULL) 1116 0x60, &dev->i2c_adap, 0) == NULL) {
1090 wprintk("%s: Medion Quadro, no tda826x " 1117 wprintk("%s: Medion Quadro, no tda826x "
1091 "found !\n", __func__); 1118 "found !\n", __func__);
1119 goto dettach_frontend;
1120 }
1092 if (dev_id != 0x08) { 1121 if (dev_id != 0x08) {
1093 /* we need to open the i2c gate (we know it exists) */ 1122 /* we need to open the i2c gate (we know it exists) */
1094 fe->ops.i2c_gate_ctrl(fe, 1); 1123 fe->ops.i2c_gate_ctrl(fe, 1);
1095 if (dvb_attach(isl6405_attach, fe, 1124 if (dvb_attach(isl6405_attach, fe,
1096 &dev->i2c_adap, 0x08, 0, 0) == NULL) 1125 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
1097 wprintk("%s: Medion Quadro, no ISL6405 " 1126 wprintk("%s: Medion Quadro, no ISL6405 "
1098 "found !\n", __func__); 1127 "found !\n", __func__);
1128 goto dettach_frontend;
1129 }
1099 if (dev_id == 0x07) { 1130 if (dev_id == 0x07) {
1100 /* fire up the 2nd section of the LNB supply since 1131 /* fire up the 2nd section of the LNB supply since
1101 we can't do this from the other section */ 1132 we can't do this from the other section */
@@ -1117,19 +1148,17 @@ static int dvb_init(struct saa7134_dev *dev)
1117 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: 1148 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
1118 dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, 1149 dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,
1119 &dev->i2c_adap); 1150 &dev->i2c_adap);
1120 if (dev->dvb.frontend) { 1151 if (dev->dvb.frontend)
1121 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 1152 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
1122 NULL, DVB_PLL_TDHU2); 1153 NULL, DVB_PLL_TDHU2);
1123 }
1124 break; 1154 break;
1125 case SAA7134_BOARD_KWORLD_ATSC110: 1155 case SAA7134_BOARD_KWORLD_ATSC110:
1126 dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, 1156 dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110,
1127 &dev->i2c_adap); 1157 &dev->i2c_adap);
1128 if (dev->dvb.frontend) { 1158 if (dev->dvb.frontend)
1129 dvb_attach(simple_tuner_attach, dev->dvb.frontend, 1159 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
1130 &dev->i2c_adap, 0x61, 1160 &dev->i2c_adap, 0x61,
1131 TUNER_PHILIPS_TUV1236D); 1161 TUNER_PHILIPS_TUV1236D);
1132 }
1133 break; 1162 break;
1134 case SAA7134_BOARD_FLYDVBS_LR300: 1163 case SAA7134_BOARD_FLYDVBS_LR300:
1135 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, 1164 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
@@ -1138,10 +1167,12 @@ static int dvb_init(struct saa7134_dev *dev)
1138 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, 1167 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1139 &dev->i2c_adap, 0) == NULL) { 1168 &dev->i2c_adap, 0) == NULL) {
1140 wprintk("%s: No tda826x found!\n", __func__); 1169 wprintk("%s: No tda826x found!\n", __func__);
1170 goto dettach_frontend;
1141 } 1171 }
1142 if (dvb_attach(isl6421_attach, dev->dvb.frontend, 1172 if (dvb_attach(isl6421_attach, dev->dvb.frontend,
1143 &dev->i2c_adap, 0x08, 0, 0) == NULL) { 1173 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
1144 wprintk("%s: No ISL6421 found!\n", __func__); 1174 wprintk("%s: No ISL6421 found!\n", __func__);
1175 goto dettach_frontend;
1145 } 1176 }
1146 } 1177 }
1147 break; 1178 break;
@@ -1168,43 +1199,65 @@ static int dvb_init(struct saa7134_dev *dev)
1168 } 1199 }
1169 break; 1200 break;
1170 case SAA7134_BOARD_CINERGY_HT_PCMCIA: 1201 case SAA7134_BOARD_CINERGY_HT_PCMCIA:
1171 configure_tda827x_fe(dev, &cinergy_ht_config, &tda827x_cfg_0); 1202 if (configure_tda827x_fe(dev, &cinergy_ht_config,
1203 &tda827x_cfg_0) < 0)
1204 goto dettach_frontend;
1172 break; 1205 break;
1173 case SAA7134_BOARD_CINERGY_HT_PCI: 1206 case SAA7134_BOARD_CINERGY_HT_PCI:
1174 configure_tda827x_fe(dev, &cinergy_ht_pci_config, &tda827x_cfg_0); 1207 if (configure_tda827x_fe(dev, &cinergy_ht_pci_config,
1208 &tda827x_cfg_0) < 0)
1209 goto dettach_frontend;
1175 break; 1210 break;
1176 case SAA7134_BOARD_PHILIPS_TIGER_S: 1211 case SAA7134_BOARD_PHILIPS_TIGER_S:
1177 configure_tda827x_fe(dev, &philips_tiger_s_config, &tda827x_cfg_2); 1212 if (configure_tda827x_fe(dev, &philips_tiger_s_config,
1213 &tda827x_cfg_2) < 0)
1214 goto dettach_frontend;
1178 break; 1215 break;
1179 case SAA7134_BOARD_ASUS_P7131_4871: 1216 case SAA7134_BOARD_ASUS_P7131_4871:
1180 configure_tda827x_fe(dev, &asus_p7131_4871_config, &tda827x_cfg_2); 1217 if (configure_tda827x_fe(dev, &asus_p7131_4871_config,
1218 &tda827x_cfg_2) < 0)
1219 goto dettach_frontend;
1181 break; 1220 break;
1182 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: 1221 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
1183 configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config, &tda827x_cfg_2); 1222 if (configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config,
1223 &tda827x_cfg_2) < 0)
1224 goto dettach_frontend;
1184 break; 1225 break;
1185 case SAA7134_BOARD_AVERMEDIA_SUPER_007: 1226 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
1186 configure_tda827x_fe(dev, &avermedia_super_007_config, &tda827x_cfg_0); 1227 if (configure_tda827x_fe(dev, &avermedia_super_007_config,
1228 &tda827x_cfg_0) < 0)
1229 goto dettach_frontend;
1187 break; 1230 break;
1188 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: 1231 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
1189 configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config, &tda827x_cfg_2_sw42); 1232 if (configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config,
1233 &tda827x_cfg_2_sw42) < 0)
1234 goto dettach_frontend;
1190 break; 1235 break;
1191 case SAA7134_BOARD_PHILIPS_SNAKE: 1236 case SAA7134_BOARD_PHILIPS_SNAKE:
1192 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, 1237 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
1193 &dev->i2c_adap); 1238 &dev->i2c_adap);
1194 if (dev->dvb.frontend) { 1239 if (dev->dvb.frontend) {
1195 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, 1240 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1196 &dev->i2c_adap, 0) == NULL) 1241 &dev->i2c_adap, 0) == NULL) {
1197 wprintk("%s: No tda826x found!\n", __func__); 1242 wprintk("%s: No tda826x found!\n", __func__);
1243 goto dettach_frontend;
1244 }
1198 if (dvb_attach(lnbp21_attach, dev->dvb.frontend, 1245 if (dvb_attach(lnbp21_attach, dev->dvb.frontend,
1199 &dev->i2c_adap, 0, 0) == NULL) 1246 &dev->i2c_adap, 0, 0) == NULL) {
1200 wprintk("%s: No lnbp21 found!\n", __func__); 1247 wprintk("%s: No lnbp21 found!\n", __func__);
1248 goto dettach_frontend;
1249 }
1201 } 1250 }
1202 break; 1251 break;
1203 case SAA7134_BOARD_CREATIX_CTX953: 1252 case SAA7134_BOARD_CREATIX_CTX953:
1204 configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0); 1253 if (configure_tda827x_fe(dev, &md8800_dvbt_config,
1254 &tda827x_cfg_0) < 0)
1255 goto dettach_frontend;
1205 break; 1256 break;
1206 case SAA7134_BOARD_MSI_TVANYWHERE_AD11: 1257 case SAA7134_BOARD_MSI_TVANYWHERE_AD11:
1207 configure_tda827x_fe(dev, &philips_tiger_s_config, &tda827x_cfg_2); 1258 if (configure_tda827x_fe(dev, &philips_tiger_s_config,
1259 &tda827x_cfg_2) < 0)
1260 goto dettach_frontend;
1208 break; 1261 break;
1209 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 1262 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
1210 dev->dvb.frontend = dvb_attach(mt352_attach, 1263 dev->dvb.frontend = dvb_attach(mt352_attach,
@@ -1218,16 +1271,20 @@ static int dvb_init(struct saa7134_dev *dev)
1218 if (dev->dvb.frontend) { 1271 if (dev->dvb.frontend) {
1219 struct dvb_frontend *fe; 1272 struct dvb_frontend *fe;
1220 if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, 1273 if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,
1221 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) 1274 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) {
1222 wprintk("%s: MD7134 DVB-S, no SD1878 " 1275 wprintk("%s: MD7134 DVB-S, no SD1878 "
1223 "found !\n", __func__); 1276 "found !\n", __func__);
1277 goto dettach_frontend;
1278 }
1224 /* we need to open the i2c gate (we know it exists) */ 1279 /* we need to open the i2c gate (we know it exists) */
1225 fe = dev->dvb.frontend; 1280 fe = dev->dvb.frontend;
1226 fe->ops.i2c_gate_ctrl(fe, 1); 1281 fe->ops.i2c_gate_ctrl(fe, 1);
1227 if (dvb_attach(isl6405_attach, fe, 1282 if (dvb_attach(isl6405_attach, fe,
1228 &dev->i2c_adap, 0x08, 0, 0) == NULL) 1283 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
1229 wprintk("%s: MD7134 DVB-S, no ISL6405 " 1284 wprintk("%s: MD7134 DVB-S, no ISL6405 "
1230 "found !\n", __func__); 1285 "found !\n", __func__);
1286 goto dettach_frontend;
1287 }
1231 fe->ops.i2c_gate_ctrl(fe, 0); 1288 fe->ops.i2c_gate_ctrl(fe, 0);
1232 dev->original_set_voltage = fe->ops.set_voltage; 1289 dev->original_set_voltage = fe->ops.set_voltage;
1233 fe->ops.set_voltage = md8800_set_voltage; 1290 fe->ops.set_voltage = md8800_set_voltage;
@@ -1254,10 +1311,7 @@ static int dvb_init(struct saa7134_dev *dev)
1254 if (!fe) { 1311 if (!fe) {
1255 printk(KERN_ERR "%s/2: xc3028 attach failed\n", 1312 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
1256 dev->name); 1313 dev->name);
1257 dvb_frontend_detach(dev->dvb.frontend); 1314 goto dettach_frontend;
1258 dvb_unregister_frontend(dev->dvb.frontend);
1259 dev->dvb.frontend = NULL;
1260 return -1;
1261 } 1315 }
1262 } 1316 }
1263 1317
@@ -1282,6 +1336,12 @@ static int dvb_init(struct saa7134_dev *dev)
1282 dev->dvb.frontend->ops.tuner_ops.sleep(dev->dvb.frontend); 1336 dev->dvb.frontend->ops.tuner_ops.sleep(dev->dvb.frontend);
1283 } 1337 }
1284 return ret; 1338 return ret;
1339
1340dettach_frontend:
1341 dvb_frontend_detach(dev->dvb.frontend);
1342 dev->dvb.frontend = NULL;
1343
1344 return -1;
1285} 1345}
1286 1346
1287static int dvb_fini(struct saa7134_dev *dev) 1347static int dvb_fini(struct saa7134_dev *dev)
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 1314522a8130..81431ee41842 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -163,8 +163,7 @@ ts_mmap(struct file *file, struct vm_area_struct * vma)
163static int empress_querycap(struct file *file, void *priv, 163static int empress_querycap(struct file *file, void *priv,
164 struct v4l2_capability *cap) 164 struct v4l2_capability *cap)
165{ 165{
166 struct saa7134_fh *fh = priv; 166 struct saa7134_dev *dev = file->private_data;
167 struct saa7134_dev *dev = fh->dev;
168 167
169 strcpy(cap->driver, "saa7134"); 168 strcpy(cap->driver, "saa7134");
170 strlcpy(cap->card, saa7134_boards[dev->board].name, 169 strlcpy(cap->card, saa7134_boards[dev->board].name,
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c
index 72c4081feff5..2220f9569941 100644
--- a/drivers/media/video/saa717x.c
+++ b/drivers/media/video/saa717x.c
@@ -1429,8 +1429,6 @@ static int saa717x_probe(struct i2c_client *client,
1429 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1429 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1430 return -EIO; 1430 return -EIO;
1431 1431
1432 snprintf(client->name, sizeof(client->name) - 1, "saa717x");
1433
1434 if (saa717x_write(client, 0x5a4, 0xfe) && 1432 if (saa717x_write(client, 0x5a4, 0xfe) &&
1435 saa717x_write(client, 0x5a5, 0x0f) && 1433 saa717x_write(client, 0x5a5, 0x0f) &&
1436 saa717x_write(client, 0x5a6, 0x00) && 1434 saa717x_write(client, 0x5a6, 0x00) &&
@@ -1507,6 +1505,12 @@ static int saa717x_remove(struct i2c_client *client)
1507 1505
1508/* ----------------------------------------------------------------------- */ 1506/* ----------------------------------------------------------------------- */
1509 1507
1508static const struct i2c_device_id saa717x_id[] = {
1509 { "saa717x", 0 },
1510 { }
1511};
1512MODULE_DEVICE_TABLE(i2c, saa717x_id);
1513
1510static struct v4l2_i2c_driver_data v4l2_i2c_data = { 1514static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1511 .name = "saa717x", 1515 .name = "saa717x",
1512 .driverid = I2C_DRIVERID_SAA717X, 1516 .driverid = I2C_DRIVERID_SAA717X,
@@ -1514,4 +1518,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1514 .probe = saa717x_probe, 1518 .probe = saa717x_probe,
1515 .remove = saa717x_remove, 1519 .remove = saa717x_remove,
1516 .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, 1520 .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL,
1521 .id_table = saa717x_id,
1517}; 1522};
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index 5748b1e1a128..7f9c7bcf3c85 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -34,7 +34,7 @@
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/page-flags.h> 36#include <linux/page-flags.h>
37#include <linux/byteorder/generic.h> 37#include <asm/byteorder.h>
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40 40
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index 9276ed997388..b12c60cf5a09 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -30,6 +30,7 @@
30#include <linux/kref.h> 30#include <linux/kref.h>
31 31
32#include <linux/usb.h> 32#include <linux/usb.h>
33#include <linux/mm.h>
33#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
34#include <linux/videodev2.h> 35#include <linux/videodev2.h>
35#include <media/v4l2-common.h> 36#include <media/v4l2-common.h>
@@ -245,6 +246,8 @@ static int stk_initialise(struct stk_camera *dev)
245 return -1; 246 return -1;
246} 247}
247 248
249#ifdef CONFIG_VIDEO_V4L1_COMPAT
250
248/* sysfs functions */ 251/* sysfs functions */
249/*FIXME cleanup this */ 252/*FIXME cleanup this */
250 253
@@ -350,6 +353,10 @@ static void stk_remove_sysfs_files(struct video_device *vdev)
350 video_device_remove_file(vdev, &dev_attr_vflip); 353 video_device_remove_file(vdev, &dev_attr_vflip);
351} 354}
352 355
356#else
357#define stk_create_sysfs_files(a)
358#define stk_remove_sysfs_files(a)
359#endif
353 360
354/* *********************************************** */ 361/* *********************************************** */
355/* 362/*
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6bf104ea051d..0d12ace61665 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -40,11 +40,11 @@
40 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \ 40 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
41 if (__a) { \ 41 if (__a) { \
42 __r = (int) __a(ARGS); \ 42 __r = (int) __a(ARGS); \
43 symbol_put(FUNCTION); \
43 } else { \ 44 } else { \
44 printk(KERN_ERR "TUNER: Unable to find " \ 45 printk(KERN_ERR "TUNER: Unable to find " \
45 "symbol "#FUNCTION"()\n"); \ 46 "symbol "#FUNCTION"()\n"); \
46 } \ 47 } \
47 symbol_put(FUNCTION); \
48 __r; \ 48 __r; \
49}) 49})
50 50
@@ -92,6 +92,7 @@ struct tuner {
92 unsigned int type; /* chip type id */ 92 unsigned int type; /* chip type id */
93 unsigned int config; 93 unsigned int config;
94 int (*tuner_callback) (void *dev, int command, int arg); 94 int (*tuner_callback) (void *dev, int command, int arg);
95 const char *name;
95}; 96};
96 97
97/* standard i2c insmod options */ 98/* standard i2c insmod options */
@@ -330,26 +331,16 @@ static void tuner_i2c_address_check(struct tuner *t)
330 tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); 331 tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n");
331 tuner_warn("will soon be dropped. This message indicates that your\n"); 332 tuner_warn("will soon be dropped. This message indicates that your\n");
332 tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", 333 tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n",
333 t->i2c->name, t->i2c->addr); 334 t->name, t->i2c->addr);
334 tuner_warn("To ensure continued support for your device, please\n"); 335 tuner_warn("To ensure continued support for your device, please\n");
335 tuner_warn("send a copy of this message, along with full dmesg\n"); 336 tuner_warn("send a copy of this message, along with full dmesg\n");
336 tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); 337 tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n");
337 tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); 338 tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n");
338 tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", 339 tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n",
339 t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name); 340 t->i2c->adapter->name, t->i2c->addr, t->type, t->name);
340 tuner_warn("====================== WARNING! ======================\n"); 341 tuner_warn("====================== WARNING! ======================\n");
341} 342}
342 343
343static void attach_tda829x(struct tuner *t)
344{
345 struct tda829x_config cfg = {
346 .lna_cfg = t->config,
347 .tuner_callback = t->tuner_callback,
348 };
349 dvb_attach(tda829x_attach,
350 &t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
351}
352
353static struct xc5000_config xc5000_cfg; 344static struct xc5000_config xc5000_cfg;
354 345
355static void set_type(struct i2c_client *c, unsigned int type, 346static void set_type(struct i2c_client *c, unsigned int type,
@@ -385,12 +376,19 @@ static void set_type(struct i2c_client *c, unsigned int type,
385 376
386 switch (t->type) { 377 switch (t->type) {
387 case TUNER_MT2032: 378 case TUNER_MT2032:
388 dvb_attach(microtune_attach, 379 if (!dvb_attach(microtune_attach,
389 &t->fe, t->i2c->adapter, t->i2c->addr); 380 &t->fe, t->i2c->adapter, t->i2c->addr))
381 goto attach_failed;
390 break; 382 break;
391 case TUNER_PHILIPS_TDA8290: 383 case TUNER_PHILIPS_TDA8290:
392 { 384 {
393 attach_tda829x(t); 385 struct tda829x_config cfg = {
386 .lna_cfg = t->config,
387 .tuner_callback = t->tuner_callback,
388 };
389 if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter,
390 t->i2c->addr, &cfg))
391 goto attach_failed;
394 break; 392 break;
395 } 393 }
396 case TUNER_TEA5767: 394 case TUNER_TEA5767:
@@ -441,8 +439,9 @@ static void set_type(struct i2c_client *c, unsigned int type,
441 break; 439 break;
442 } 440 }
443 case TUNER_TDA9887: 441 case TUNER_TDA9887:
444 dvb_attach(tda9887_attach, 442 if (!dvb_attach(tda9887_attach,
445 &t->fe, t->i2c->adapter, t->i2c->addr); 443 &t->fe, t->i2c->adapter, t->i2c->addr))
444 goto attach_failed;
446 break; 445 break;
447 case TUNER_XC5000: 446 case TUNER_XC5000:
448 { 447 {
@@ -450,10 +449,10 @@ static void set_type(struct i2c_client *c, unsigned int type,
450 449
451 xc5000_cfg.i2c_address = t->i2c->addr; 450 xc5000_cfg.i2c_address = t->i2c->addr;
452 xc5000_cfg.if_khz = 5380; 451 xc5000_cfg.if_khz = 5380;
453 xc5000_cfg.priv = c->adapter->algo_data;
454 xc5000_cfg.tuner_callback = t->tuner_callback; 452 xc5000_cfg.tuner_callback = t->tuner_callback;
455 if (!dvb_attach(xc5000_attach, 453 if (!dvb_attach(xc5000_attach,
456 &t->fe, t->i2c->adapter, &xc5000_cfg)) 454 &t->fe, t->i2c->adapter, &xc5000_cfg,
455 c->adapter->algo_data))
457 goto attach_failed; 456 goto attach_failed;
458 457
459 xc_tuner_ops = &t->fe.ops.tuner_ops; 458 xc_tuner_ops = &t->fe.ops.tuner_ops;
@@ -472,19 +471,17 @@ static void set_type(struct i2c_client *c, unsigned int type,
472 if ((NULL == analog_ops->set_params) && 471 if ((NULL == analog_ops->set_params) &&
473 (fe_tuner_ops->set_analog_params)) { 472 (fe_tuner_ops->set_analog_params)) {
474 473
475 strlcpy(t->i2c->name, fe_tuner_ops->info.name, 474 t->name = fe_tuner_ops->info.name;
476 sizeof(t->i2c->name));
477 475
478 t->fe.analog_demod_priv = t; 476 t->fe.analog_demod_priv = t;
479 memcpy(analog_ops, &tuner_core_ops, 477 memcpy(analog_ops, &tuner_core_ops,
480 sizeof(struct analog_demod_ops)); 478 sizeof(struct analog_demod_ops));
481 479
482 } else { 480 } else {
483 strlcpy(t->i2c->name, analog_ops->info.name, 481 t->name = analog_ops->info.name;
484 sizeof(t->i2c->name));
485 } 482 }
486 483
487 tuner_dbg("type set to %s\n", t->i2c->name); 484 tuner_dbg("type set to %s\n", t->name);
488 485
489 if (t->mode_mask == T_UNINITIALIZED) 486 if (t->mode_mask == T_UNINITIALIZED)
490 t->mode_mask = new_mode_mask; 487 t->mode_mask = new_mode_mask;
@@ -539,7 +536,7 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
539static inline int check_mode(struct tuner *t, char *cmd) 536static inline int check_mode(struct tuner *t, char *cmd)
540{ 537{
541 if ((1 << t->mode & t->mode_mask) == 0) { 538 if ((1 << t->mode & t->mode_mask) == 0) {
542 return EINVAL; 539 return -EINVAL;
543 } 540 }
544 541
545 switch (t->mode) { 542 switch (t->mode) {
@@ -733,11 +730,11 @@ static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode,
733 730
734 t->mode = mode; 731 t->mode = mode;
735 732
736 if (check_mode(t, cmd) == EINVAL) { 733 if (check_mode(t, cmd) == -EINVAL) {
737 t->mode = T_STANDBY; 734 t->mode = T_STANDBY;
738 if (analog_ops->standby) 735 if (analog_ops->standby)
739 analog_ops->standby(&t->fe); 736 analog_ops->standby(&t->fe);
740 return EINVAL; 737 return -EINVAL;
741 } 738 }
742 return 0; 739 return 0;
743} 740}
@@ -779,13 +776,13 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
779 break; 776 break;
780 case AUDC_SET_RADIO: 777 case AUDC_SET_RADIO:
781 if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") 778 if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO")
782 == EINVAL) 779 == -EINVAL)
783 return 0; 780 return 0;
784 if (t->radio_freq) 781 if (t->radio_freq)
785 set_freq(client, t->radio_freq); 782 set_freq(client, t->radio_freq);
786 break; 783 break;
787 case TUNER_SET_STANDBY: 784 case TUNER_SET_STANDBY:
788 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) 785 if (check_mode(t, "TUNER_SET_STANDBY") == -EINVAL)
789 return 0; 786 return 0;
790 t->mode = T_STANDBY; 787 t->mode = T_STANDBY;
791 if (analog_ops->standby) 788 if (analog_ops->standby)
@@ -793,9 +790,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
793 break; 790 break;
794#ifdef CONFIG_VIDEO_ALLOW_V4L1 791#ifdef CONFIG_VIDEO_ALLOW_V4L1
795 case VIDIOCSAUDIO: 792 case VIDIOCSAUDIO:
796 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) 793 if (check_mode(t, "VIDIOCSAUDIO") == -EINVAL)
797 return 0; 794 return 0;
798 if (check_v4l2(t) == EINVAL) 795 if (check_v4l2(t) == -EINVAL)
799 return 0; 796 return 0;
800 797
801 /* Should be implemented, since bttv calls it */ 798 /* Should be implemented, since bttv calls it */
@@ -813,10 +810,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
813 }; 810 };
814 struct video_channel *vc = arg; 811 struct video_channel *vc = arg;
815 812
816 if (check_v4l2(t) == EINVAL) 813 if (check_v4l2(t) == -EINVAL)
817 return 0; 814 return 0;
818 815
819 if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL) 816 if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==-EINVAL)
820 return 0; 817 return 0;
821 818
822 if (vc->norm < ARRAY_SIZE(map)) 819 if (vc->norm < ARRAY_SIZE(map))
@@ -830,9 +827,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
830 { 827 {
831 unsigned long *v = arg; 828 unsigned long *v = arg;
832 829
833 if (check_mode(t, "VIDIOCSFREQ") == EINVAL) 830 if (check_mode(t, "VIDIOCSFREQ") == -EINVAL)
834 return 0; 831 return 0;
835 if (check_v4l2(t) == EINVAL) 832 if (check_v4l2(t) == -EINVAL)
836 return 0; 833 return 0;
837 834
838 set_freq(client, *v); 835 set_freq(client, *v);
@@ -842,9 +839,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
842 { 839 {
843 struct video_tuner *vt = arg; 840 struct video_tuner *vt = arg;
844 841
845 if (check_mode(t, "VIDIOCGTUNER") == EINVAL) 842 if (check_mode(t, "VIDIOCGTUNER") == -EINVAL)
846 return 0; 843 return 0;
847 if (check_v4l2(t) == EINVAL) 844 if (check_v4l2(t) == -EINVAL)
848 return 0; 845 return 0;
849 846
850 if (V4L2_TUNER_RADIO == t->mode) { 847 if (V4L2_TUNER_RADIO == t->mode) {
@@ -886,9 +883,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
886 { 883 {
887 struct video_audio *va = arg; 884 struct video_audio *va = arg;
888 885
889 if (check_mode(t, "VIDIOCGAUDIO") == EINVAL) 886 if (check_mode(t, "VIDIOCGAUDIO") == -EINVAL)
890 return 0; 887 return 0;
891 if (check_v4l2(t) == EINVAL) 888 if (check_v4l2(t) == -EINVAL)
892 return 0; 889 return 0;
893 890
894 if (V4L2_TUNER_RADIO == t->mode) { 891 if (V4L2_TUNER_RADIO == t->mode) {
@@ -928,7 +925,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
928 v4l2_std_id *id = arg; 925 v4l2_std_id *id = arg;
929 926
930 if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD") 927 if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD")
931 == EINVAL) 928 == -EINVAL)
932 return 0; 929 return 0;
933 930
934 switch_v4l2(); 931 switch_v4l2();
@@ -944,7 +941,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
944 struct v4l2_frequency *f = arg; 941 struct v4l2_frequency *f = arg;
945 942
946 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") 943 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
947 == EINVAL) 944 == -EINVAL)
948 return 0; 945 return 0;
949 switch_v4l2(); 946 switch_v4l2();
950 set_freq(client,f->frequency); 947 set_freq(client,f->frequency);
@@ -955,7 +952,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
955 { 952 {
956 struct v4l2_frequency *f = arg; 953 struct v4l2_frequency *f = arg;
957 954
958 if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL) 955 if (check_mode(t, "VIDIOC_G_FREQUENCY") == -EINVAL)
959 return 0; 956 return 0;
960 switch_v4l2(); 957 switch_v4l2();
961 f->type = t->mode; 958 f->type = t->mode;
@@ -976,7 +973,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
976 { 973 {
977 struct v4l2_tuner *tuner = arg; 974 struct v4l2_tuner *tuner = arg;
978 975
979 if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL) 976 if (check_mode(t, "VIDIOC_G_TUNER") == -EINVAL)
980 return 0; 977 return 0;
981 switch_v4l2(); 978 switch_v4l2();
982 979
@@ -1023,7 +1020,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
1023 { 1020 {
1024 struct v4l2_tuner *tuner = arg; 1021 struct v4l2_tuner *tuner = arg;
1025 1022
1026 if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL) 1023 if (check_mode(t, "VIDIOC_S_TUNER") == -EINVAL)
1027 return 0; 1024 return 0;
1028 1025
1029 switch_v4l2(); 1026 switch_v4l2();
@@ -1117,7 +1114,7 @@ static int tuner_probe(struct i2c_client *client,
1117 if (NULL == t) 1114 if (NULL == t)
1118 return -ENOMEM; 1115 return -ENOMEM;
1119 t->i2c = client; 1116 t->i2c = client;
1120 strlcpy(client->name, "(tuner unset)", sizeof(client->name)); 1117 t->name = "(tuner unset)";
1121 i2c_set_clientdata(client, t); 1118 i2c_set_clientdata(client, t);
1122 t->type = UNSET; 1119 t->type = UNSET;
1123 t->audmode = V4L2_TUNER_MODE_STEREO; 1120 t->audmode = V4L2_TUNER_MODE_STEREO;
@@ -1167,7 +1164,7 @@ static int tuner_probe(struct i2c_client *client,
1167 /* If chip is not tda8290, don't register. 1164 /* If chip is not tda8290, don't register.
1168 since it can be tda9887*/ 1165 since it can be tda9887*/
1169 if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter, 1166 if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter,
1170 t->i2c->addr) == 0) { 1167 t->i2c->addr) >= 0) {
1171 tuner_dbg("tda829x detected\n"); 1168 tuner_dbg("tda829x detected\n");
1172 } else { 1169 } else {
1173 /* Default is being tda9887 */ 1170 /* Default is being tda9887 */
@@ -1181,7 +1178,7 @@ static int tuner_probe(struct i2c_client *client,
1181 case 0x60: 1178 case 0x60:
1182 if (tuner_symbol_probe(tea5767_autodetection, 1179 if (tuner_symbol_probe(tea5767_autodetection,
1183 t->i2c->adapter, t->i2c->addr) 1180 t->i2c->adapter, t->i2c->addr)
1184 != EINVAL) { 1181 >= 0) {
1185 t->type = TUNER_TEA5767; 1182 t->type = TUNER_TEA5767;
1186 t->mode_mask = T_RADIO; 1183 t->mode_mask = T_RADIO;
1187 t->mode = T_STANDBY; 1184 t->mode = T_STANDBY;
@@ -1280,6 +1277,15 @@ static int tuner_remove(struct i2c_client *client)
1280 1277
1281/* ----------------------------------------------------------------------- */ 1278/* ----------------------------------------------------------------------- */
1282 1279
1280/* This driver supports many devices and the idea is to let the driver
1281 detect which device is present. So rather than listing all supported
1282 devices here, we pretend to support a single, fake device type. */
1283static const struct i2c_device_id tuner_id[] = {
1284 { "tuner", }, /* autodetect */
1285 { }
1286};
1287MODULE_DEVICE_TABLE(i2c, tuner_id);
1288
1283static struct v4l2_i2c_driver_data v4l2_i2c_data = { 1289static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1284 .name = "tuner", 1290 .name = "tuner",
1285 .driverid = I2C_DRIVERID_TUNER, 1291 .driverid = I2C_DRIVERID_TUNER,
@@ -1289,6 +1295,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1289 .suspend = tuner_suspend, 1295 .suspend = tuner_suspend,
1290 .resume = tuner_resume, 1296 .resume = tuner_resume,
1291 .legacy_probe = tuner_legacy_probe, 1297 .legacy_probe = tuner_legacy_probe,
1298 .id_table = tuner_id,
1292}; 1299};
1293 1300
1294 1301
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 3cf8a8e801e5..9da0e1807ffb 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -319,10 +319,12 @@ audioIC[] =
319 {AUDIO_CHIP_INTERNAL, "CX25843"}, 319 {AUDIO_CHIP_INTERNAL, "CX25843"},
320 {AUDIO_CHIP_INTERNAL, "CX23418"}, 320 {AUDIO_CHIP_INTERNAL, "CX23418"},
321 {AUDIO_CHIP_INTERNAL, "CX23885"}, 321 {AUDIO_CHIP_INTERNAL, "CX23885"},
322 /* 40-42 */ 322 /* 40-44 */
323 {AUDIO_CHIP_INTERNAL, "CX23888"}, 323 {AUDIO_CHIP_INTERNAL, "CX23888"},
324 {AUDIO_CHIP_INTERNAL, "SAA7131"}, 324 {AUDIO_CHIP_INTERNAL, "SAA7131"},
325 {AUDIO_CHIP_INTERNAL, "CX23887"}, 325 {AUDIO_CHIP_INTERNAL, "CX23887"},
326 {AUDIO_CHIP_INTERNAL, "SAA7164"},
327 {AUDIO_CHIP_INTERNAL, "AU8522"},
326}; 328};
327 329
328/* This list is supplied by Hauppauge. Thanks! */ 330/* This list is supplied by Hauppauge. Thanks! */
@@ -341,8 +343,10 @@ static const char *decoderIC[] = {
341 "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842", 343 "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842",
342 /* 30-34 */ 344 /* 30-34 */
343 "CX25843", "CX23418", "NEC61153", "CX23885", "CX23888", 345 "CX25843", "CX23418", "NEC61153", "CX23885", "CX23888",
344 /* 35-37 */ 346 /* 35-39 */
345 "SAA7131", "CX25837", "CX23887" 347 "SAA7131", "CX25837", "CX23887", "CX23885A", "CX23887A",
348 /* 40-42 */
349 "SAA7164", "CX23885B", "AU8522"
346}; 350};
347 351
348static int hasRadioTuner(int tunerType) 352static int hasRadioTuner(int tunerType)
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index 93bfd19dec7d..b4628874933b 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -228,6 +228,11 @@ static int upd64031a_remove(struct i2c_client *client)
228 228
229/* ----------------------------------------------------------------------- */ 229/* ----------------------------------------------------------------------- */
230 230
231static const struct i2c_device_id upd64031a_id[] = {
232 { "upd64031a", 0 },
233 { }
234};
235MODULE_DEVICE_TABLE(i2c, upd64031a_id);
231 236
232static struct v4l2_i2c_driver_data v4l2_i2c_data = { 237static struct v4l2_i2c_driver_data v4l2_i2c_data = {
233 .name = "upd64031a", 238 .name = "upd64031a",
@@ -235,4 +240,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
235 .command = upd64031a_command, 240 .command = upd64031a_command,
236 .probe = upd64031a_probe, 241 .probe = upd64031a_probe,
237 .remove = upd64031a_remove, 242 .remove = upd64031a_remove,
243 .id_table = upd64031a_id,
238}; 244};
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index 9ab712a56ce0..9521ce004dcc 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -205,6 +205,11 @@ static int upd64083_remove(struct i2c_client *client)
205 205
206/* ----------------------------------------------------------------------- */ 206/* ----------------------------------------------------------------------- */
207 207
208static const struct i2c_device_id upd64083_id[] = {
209 { "upd64083", 0 },
210 { }
211};
212MODULE_DEVICE_TABLE(i2c, upd64083_id);
208 213
209static struct v4l2_i2c_driver_data v4l2_i2c_data = { 214static struct v4l2_i2c_driver_data v4l2_i2c_data = {
210 .name = "upd64083", 215 .name = "upd64083",
@@ -212,4 +217,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
212 .command = upd64083_command, 217 .command = upd64083_command,
213 .probe = upd64083_probe, 218 .probe = upd64083_probe,
214 .remove = upd64083_remove, 219 .remove = upd64083_remove,
220 .id_table = upd64083_id,
215}; 221};
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c
index 32e536edf09d..3d26a30abe1e 100644
--- a/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -210,7 +210,7 @@ static int qcm_stv_setb(struct usb_device *dev, u16 reg, u8 val)
210 return ret; 210 return ret;
211} 211}
212 212
213static int qcm_stv_setw(struct usb_device *dev, u16 reg, u16 val) 213static int qcm_stv_setw(struct usb_device *dev, u16 reg, __le16 val)
214{ 214{
215 int ret; 215 int ret;
216 216
diff --git a/drivers/media/video/usbvision/Kconfig b/drivers/media/video/usbvision/Kconfig
index 74e1d3075a20..fc24ef05b3f3 100644
--- a/drivers/media/video/usbvision/Kconfig
+++ b/drivers/media/video/usbvision/Kconfig
@@ -1,7 +1,7 @@
1config VIDEO_USBVISION 1config VIDEO_USBVISION
2 tristate "USB video devices based on Nogatech NT1003/1004/1005" 2 tristate "USB video devices based on Nogatech NT1003/1004/1005"
3 depends on I2C && VIDEO_V4L2 3 depends on I2C && VIDEO_V4L2
4 select MEDIA_TUNER 4 select VIDEO_TUNER
5 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO 5 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
6 ---help--- 6 ---help---
7 There are more than 50 different USB video devices based on 7 There are more than 50 different USB video devices based on
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 982f4463896c..0a88c44ace00 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -331,7 +331,7 @@ int videobuf_mmap_free(struct videobuf_queue *q)
331} 331}
332 332
333/* Locking: Caller holds q->vb_lock */ 333/* Locking: Caller holds q->vb_lock */
334static int __videobuf_mmap_setup(struct videobuf_queue *q, 334int __videobuf_mmap_setup(struct videobuf_queue *q,
335 unsigned int bcount, unsigned int bsize, 335 unsigned int bcount, unsigned int bsize,
336 enum v4l2_memory memory) 336 enum v4l2_memory memory)
337{ 337{
@@ -1129,6 +1129,7 @@ EXPORT_SYMBOL_GPL(videobuf_read_stream);
1129EXPORT_SYMBOL_GPL(videobuf_read_one); 1129EXPORT_SYMBOL_GPL(videobuf_read_one);
1130EXPORT_SYMBOL_GPL(videobuf_poll_stream); 1130EXPORT_SYMBOL_GPL(videobuf_poll_stream);
1131 1131
1132EXPORT_SYMBOL_GPL(__videobuf_mmap_setup);
1132EXPORT_SYMBOL_GPL(videobuf_mmap_setup); 1133EXPORT_SYMBOL_GPL(videobuf_mmap_setup);
1133EXPORT_SYMBOL_GPL(videobuf_mmap_free); 1134EXPORT_SYMBOL_GPL(videobuf_mmap_free);
1134EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); 1135EXPORT_SYMBOL_GPL(videobuf_mmap_mapper);
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c
index fac0deba24af..a1f76ee032e7 100644
--- a/drivers/media/video/vp27smpx.c
+++ b/drivers/media/video/vp27smpx.c
@@ -130,8 +130,6 @@ static int vp27smpx_probe(struct i2c_client *client,
130 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 130 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
131 return -EIO; 131 return -EIO;
132 132
133 snprintf(client->name, sizeof(client->name) - 1, "vp27smpx");
134
135 v4l_info(client, "chip found @ 0x%x (%s)\n", 133 v4l_info(client, "chip found @ 0x%x (%s)\n",
136 client->addr << 1, client->adapter->name); 134 client->addr << 1, client->adapter->name);
137 135
@@ -154,11 +152,18 @@ static int vp27smpx_remove(struct i2c_client *client)
154 152
155/* ----------------------------------------------------------------------- */ 153/* ----------------------------------------------------------------------- */
156 154
155static const struct i2c_device_id vp27smpx_id[] = {
156 { "vp27smpx", 0 },
157 { }
158};
159MODULE_DEVICE_TABLE(i2c, vp27smpx_id);
160
157static struct v4l2_i2c_driver_data v4l2_i2c_data = { 161static struct v4l2_i2c_driver_data v4l2_i2c_data = {
158 .name = "vp27smpx", 162 .name = "vp27smpx",
159 .driverid = I2C_DRIVERID_VP27SMPX, 163 .driverid = I2C_DRIVERID_VP27SMPX,
160 .command = vp27smpx_command, 164 .command = vp27smpx_command,
161 .probe = vp27smpx_probe, 165 .probe = vp27smpx_probe,
162 .remove = vp27smpx_remove, 166 .remove = vp27smpx_remove,
167 .id_table = vp27smpx_id,
163}; 168};
164 169
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index 0f8ed8461fba..fc50299caa36 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -313,11 +313,18 @@ static int wm8739_remove(struct i2c_client *client)
313 return 0; 313 return 0;
314} 314}
315 315
316static const struct i2c_device_id wm8739_id[] = {
317 { "wm8739", 0 },
318 { }
319};
320MODULE_DEVICE_TABLE(i2c, wm8739_id);
321
316static struct v4l2_i2c_driver_data v4l2_i2c_data = { 322static struct v4l2_i2c_driver_data v4l2_i2c_data = {
317 .name = "wm8739", 323 .name = "wm8739",
318 .driverid = I2C_DRIVERID_WM8739, 324 .driverid = I2C_DRIVERID_WM8739,
319 .command = wm8739_command, 325 .command = wm8739_command,
320 .probe = wm8739_probe, 326 .probe = wm8739_probe,
321 .remove = wm8739_remove, 327 .remove = wm8739_remove,
328 .id_table = wm8739_id,
322}; 329};
323 330
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index 67a409e60c46..506378a508b9 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -216,11 +216,18 @@ static int wm8775_remove(struct i2c_client *client)
216 return 0; 216 return 0;
217} 217}
218 218
219static const struct i2c_device_id wm8775_id[] = {
220 { "wm8775", 0 },
221 { }
222};
223MODULE_DEVICE_TABLE(i2c, wm8775_id);
224
219static struct v4l2_i2c_driver_data v4l2_i2c_data = { 225static struct v4l2_i2c_driver_data v4l2_i2c_data = {
220 .name = "wm8775", 226 .name = "wm8775",
221 .driverid = I2C_DRIVERID_WM8775, 227 .driverid = I2C_DRIVERID_WM8775,
222 .command = wm8775_command, 228 .command = wm8775_command,
223 .probe = wm8775_probe, 229 .probe = wm8775_probe,
224 .remove = wm8775_remove, 230 .remove = wm8775_remove,
231 .id_table = wm8775_id,
225}; 232};
226 233
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c
index 363dd2b9475c..e5c4e9f5193f 100644
--- a/drivers/media/video/zc0301/zc0301_core.c
+++ b/drivers/media/video/zc0301/zc0301_core.c
@@ -38,7 +38,7 @@
38#include <linux/mm.h> 38#include <linux/mm.h>
39#include <linux/vmalloc.h> 39#include <linux/vmalloc.h>
40#include <linux/page-flags.h> 40#include <linux/page-flags.h>
41#include <linux/byteorder/generic.h> 41#include <asm/byteorder.h>
42#include <asm/page.h> 42#include <asm/page.h>
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44 44
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h
index 81cc3b00a079..46b7ad477ceb 100644
--- a/drivers/media/video/zoran.h
+++ b/drivers/media/video/zoran.h
@@ -285,7 +285,7 @@ struct zoran_mapping {
285 285
286struct zoran_jpg_buffer { 286struct zoran_jpg_buffer {
287 struct zoran_mapping *map; 287 struct zoran_mapping *map;
288 u32 *frag_tab; /* addresses of frag table */ 288 __le32 *frag_tab; /* addresses of frag table */
289 u32 frag_tab_bus; /* same value cached to save time in ISR */ 289 u32 frag_tab_bus; /* same value cached to save time in ISR */
290 enum zoran_buffer_state state; /* non-zero if corresponding buffer is in use in grab queue */ 290 enum zoran_buffer_state state; /* non-zero if corresponding buffer is in use in grab queue */
291 struct zoran_sync bs; /* DONE: info to return to application */ 291 struct zoran_sync bs; /* DONE: info to return to application */
@@ -450,7 +450,7 @@ struct zoran {
450 unsigned long jpg_queued_num; /* count of frames queued since grab/play started */ 450 unsigned long jpg_queued_num; /* count of frames queued since grab/play started */
451 451
452 /* zr36057's code buffer table */ 452 /* zr36057's code buffer table */
453 u32 *stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */ 453 __le32 *stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */
454 454
455 /* (value & BUZ_MASK_FRAME) corresponds to index in pend[] queue */ 455 /* (value & BUZ_MASK_FRAME) corresponds to index in pend[] queue */
456 int jpg_pend[BUZ_MAX_FRAME]; 456 int jpg_pend[BUZ_MAX_FRAME];
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
index 7b60533efe45..88d369708e4c 100644
--- a/drivers/media/video/zoran_device.c
+++ b/drivers/media/video/zoran_device.c
@@ -31,7 +31,6 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
34#include <linux/byteorder/generic.h>
35 34
36#include <linux/interrupt.h> 35#include <linux/interrupt.h>
37#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
@@ -47,6 +46,7 @@
47#include <linux/delay.h> 46#include <linux/delay.h>
48#include <linux/wait.h> 47#include <linux/wait.h>
49 48
49#include <asm/byteorder.h>
50#include <asm/io.h> 50#include <asm/io.h>
51 51
52#include "videocodec.h" 52#include "videocodec.h"
@@ -1320,7 +1320,7 @@ error_handler (struct zoran *zr,
1320 if (i) { 1320 if (i) {
1321 /* Rotate stat_comm entries to make current entry first */ 1321 /* Rotate stat_comm entries to make current entry first */
1322 int j; 1322 int j;
1323 u32 bus_addr[BUZ_NUM_STAT_COM]; 1323 __le32 bus_addr[BUZ_NUM_STAT_COM];
1324 1324
1325 /* Here we are copying the stat_com array, which 1325 /* Here we are copying the stat_com array, which
1326 * is already in little endian format, so 1326 * is already in little endian format, so
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index 0134bec1e399..5394d7a5cfee 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -52,7 +52,6 @@
52#include <linux/pci.h> 52#include <linux/pci.h>
53#include <linux/vmalloc.h> 53#include <linux/vmalloc.h>
54#include <linux/wait.h> 54#include <linux/wait.h>
55#include <linux/byteorder/generic.h>
56 55
57#include <linux/interrupt.h> 56#include <linux/interrupt.h>
58#include <linux/i2c.h> 57#include <linux/i2c.h>
@@ -74,6 +73,7 @@
74#include <media/v4l2-common.h> 73#include <media/v4l2-common.h>
75#include "videocodec.h" 74#include "videocodec.h"
76 75
76#include <asm/byteorder.h>
77#include <asm/io.h> 77#include <asm/io.h>
78#include <asm/uaccess.h> 78#include <asm/uaccess.h>
79#include <linux/proc_fs.h> 79#include <linux/proc_fs.h>
@@ -495,7 +495,7 @@ jpg_fbuffer_alloc (struct file *file)
495 jpg_fbuffer_free(file); 495 jpg_fbuffer_free(file);
496 return -ENOBUFS; 496 return -ENOBUFS;
497 } 497 }
498 fh->jpg_buffers.buffer[i].frag_tab = (u32 *) mem; 498 fh->jpg_buffers.buffer[i].frag_tab = (__le32 *) mem;
499 fh->jpg_buffers.buffer[i].frag_tab_bus = 499 fh->jpg_buffers.buffer[i].frag_tab_bus =
500 virt_to_bus((void *) mem); 500 virt_to_bus((void *) mem);
501 501
@@ -1167,7 +1167,7 @@ zoran_close_end_session (struct file *file)
1167 1167
1168 /* v4l capture */ 1168 /* v4l capture */
1169 if (fh->v4l_buffers.active != ZORAN_FREE) { 1169 if (fh->v4l_buffers.active != ZORAN_FREE) {
1170 long flags; 1170 unsigned long flags;
1171 1171
1172 spin_lock_irqsave(&zr->spinlock, flags); 1172 spin_lock_irqsave(&zr->spinlock, flags);
1173 zr36057_set_memgrab(zr, 0); 1173 zr36057_set_memgrab(zr, 0);
@@ -3436,7 +3436,7 @@ zoran_do_ioctl (struct inode *inode,
3436 3436
3437 /* unload capture */ 3437 /* unload capture */
3438 if (zr->v4l_memgrab_active) { 3438 if (zr->v4l_memgrab_active) {
3439 long flags; 3439 unsigned long flags;
3440 3440
3441 spin_lock_irqsave(&zr->spinlock, flags); 3441 spin_lock_irqsave(&zr->spinlock, flags);
3442 zr36057_set_memgrab(zr, 0); 3442 zr36057_set_memgrab(zr, 0);
@@ -4375,7 +4375,7 @@ zoran_vm_close (struct vm_area_struct *vma)
4375 mutex_lock(&zr->resource_lock); 4375 mutex_lock(&zr->resource_lock);
4376 4376
4377 if (fh->v4l_buffers.active != ZORAN_FREE) { 4377 if (fh->v4l_buffers.active != ZORAN_FREE) {
4378 long flags; 4378 unsigned long flags;
4379 4379
4380 spin_lock_irqsave(&zr->spinlock, flags); 4380 spin_lock_irqsave(&zr->spinlock, flags);
4381 zr36057_set_memgrab(zr, 0); 4381 zr36057_set_memgrab(zr, 0);
@@ -4506,7 +4506,7 @@ zoran_mmap (struct file *file,
4506 if (todo > fraglen) 4506 if (todo > fraglen)
4507 todo = fraglen; 4507 todo = fraglen;
4508 pos = 4508 pos =
4509 le32_to_cpu((unsigned long) fh->jpg_buffers. 4509 le32_to_cpu(fh->jpg_buffers.
4510 buffer[i].frag_tab[2 * j]); 4510 buffer[i].frag_tab[2 * j]);
4511 /* should just be pos on i386 */ 4511 /* should just be pos on i386 */
4512 page = virt_to_phys(bus_to_virt(pos)) 4512 page = virt_to_phys(bus_to_virt(pos))
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 3cdd4e962115..1e24ab4ac38c 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -1238,8 +1238,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1238 sh->max_id = ioc->pfacts->MaxDevices; 1238 sh->max_id = ioc->pfacts->MaxDevices;
1239 sh->max_lun = max_lun; 1239 sh->max_lun = max_lun;
1240 1240
1241 sh->this_id = ioc->pfacts[0].PortSCSIID;
1242
1243 /* Required entry. 1241 /* Required entry.
1244 */ 1242 */
1245 sh->unique_id = ioc->id; 1243 sh->unique_id = ioc->id;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 468480771f13..4d492ba232b0 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -3193,8 +3193,6 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3193 3193
3194 sh->transportt = mptsas_transport_template; 3194 sh->transportt = mptsas_transport_template;
3195 3195
3196 sh->this_id = ioc->pfacts[0].PortSCSIID;
3197
3198 /* Required entry. 3196 /* Required entry.
3199 */ 3197 */
3200 sh->unique_id = ioc->id; 3198 sh->unique_id = ioc->id;
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index b109bd8a4d19..c68ef00c2f92 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2451,12 +2451,6 @@ mptscsih_slave_configure(struct scsi_device *sdev)
2451 ioc->name, sdev->sdtr, sdev->wdtr, 2451 ioc->name, sdev->sdtr, sdev->wdtr,
2452 sdev->ppr, sdev->inquiry_len)); 2452 sdev->ppr, sdev->inquiry_len));
2453 2453
2454 if (sdev->id > sh->max_id) {
2455 /* error case, should never happen */
2456 scsi_adjust_queue_depth(sdev, 0, 1);
2457 goto slave_configure_exit;
2458 }
2459
2460 vdevice->configured_lun = 1; 2454 vdevice->configured_lun = 1;
2461 mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); 2455 mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
2462 2456
@@ -2470,8 +2464,6 @@ mptscsih_slave_configure(struct scsi_device *sdev)
2470 ioc->name, vtarget->negoFlags, vtarget->maxOffset, 2464 ioc->name, vtarget->negoFlags, vtarget->maxOffset,
2471 vtarget->minSyncFactor)); 2465 vtarget->minSyncFactor));
2472 2466
2473slave_configure_exit:
2474
2475 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2467 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2476 "tagged %d, simple %d, ordered %d\n", 2468 "tagged %d, simple %d, ordered %d\n",
2477 ioc->name,sdev->tagged_supported, sdev->simple_tags, 2469 ioc->name,sdev->tagged_supported, sdev->simple_tags,
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 2566479937c9..ae96bd6242f2 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -24,7 +24,7 @@ config MFD_ASIC3
24 24
25config HTC_EGPIO 25config HTC_EGPIO
26 bool "HTC EGPIO support" 26 bool "HTC EGPIO support"
27 depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB 27 depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM
28 help 28 help
29 This driver supports the CPLD egpio chip present on 29 This driver supports the CPLD egpio chip present on
30 several HTC phones. It provides basic support for input 30 several HTC phones. It provides basic support for input
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c
index e2e7c05a147b..6d14e8fe1537 100644
--- a/drivers/misc/fujitsu-laptop.c
+++ b/drivers/misc/fujitsu-laptop.c
@@ -352,3 +352,9 @@ MODULE_AUTHOR("Jonathan Woithe");
352MODULE_DESCRIPTION("Fujitsu laptop extras support"); 352MODULE_DESCRIPTION("Fujitsu laptop extras support");
353MODULE_VERSION(FUJITSU_DRIVER_VERSION); 353MODULE_VERSION(FUJITSU_DRIVER_VERSION);
354MODULE_LICENSE("GPL"); 354MODULE_LICENSE("GPL");
355
356static struct pnp_device_id pnp_ids[] = {
357 { .id = "FUJ02bf" },
358 { .id = "" }
359};
360MODULE_DEVICE_TABLE(pnp, pnp_ids);
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index fa394104339c..e4ff50b95a5e 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -102,7 +102,6 @@
102#include <linux/nmi.h> 102#include <linux/nmi.h>
103#include <linux/delay.h> 103#include <linux/delay.h>
104#include <linux/kthread.h> 104#include <linux/kthread.h>
105#include <linux/delay.h>
106 105
107#define v1printk(a...) do { \ 106#define v1printk(a...) do { \
108 if (verbose) \ 107 if (verbose) \
@@ -119,7 +118,6 @@
119 } while (0) 118 } while (0)
120#define MAX_CONFIG_LEN 40 119#define MAX_CONFIG_LEN 40
121 120
122static const char hexchars[] = "0123456789abcdef";
123static struct kgdb_io kgdbts_io_ops; 121static struct kgdb_io kgdbts_io_ops;
124static char get_buf[BUFMAX]; 122static char get_buf[BUFMAX];
125static int get_buf_cnt; 123static int get_buf_cnt;
@@ -131,6 +129,8 @@ static int repeat_test;
131static int test_complete; 129static int test_complete;
132static int send_ack; 130static int send_ack;
133static int final_ack; 131static int final_ack;
132static int force_hwbrks;
133static int hwbreaks_ok;
134static int hw_break_val; 134static int hw_break_val;
135static int hw_break_val2; 135static int hw_break_val2;
136#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_SPARC) 136#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_SPARC)
@@ -234,12 +234,12 @@ static void break_helper(char *bp_type, char *arg, unsigned long vaddr)
234 234
235static void sw_break(char *arg) 235static void sw_break(char *arg)
236{ 236{
237 break_helper("Z0", arg, 0); 237 break_helper(force_hwbrks ? "Z1" : "Z0", arg, 0);
238} 238}
239 239
240static void sw_rem_break(char *arg) 240static void sw_rem_break(char *arg)
241{ 241{
242 break_helper("z0", arg, 0); 242 break_helper(force_hwbrks ? "z1" : "z0", arg, 0);
243} 243}
244 244
245static void hw_break(char *arg) 245static void hw_break(char *arg)
@@ -619,8 +619,8 @@ static void fill_get_buf(char *buf)
619 count++; 619 count++;
620 } 620 }
621 strcat(get_buf, "#"); 621 strcat(get_buf, "#");
622 get_buf[count + 2] = hexchars[checksum >> 4]; 622 get_buf[count + 2] = hex_asc_hi(checksum);
623 get_buf[count + 3] = hexchars[checksum & 0xf]; 623 get_buf[count + 3] = hex_asc_lo(checksum);
624 get_buf[count + 4] = '\0'; 624 get_buf[count + 4] = '\0';
625 v2printk("get%i: %s\n", ts.idx, get_buf); 625 v2printk("get%i: %s\n", ts.idx, get_buf);
626} 626}
@@ -781,6 +781,8 @@ static void run_breakpoint_test(int is_hw_breakpoint)
781 return; 781 return;
782 782
783 eprintk("kgdbts: ERROR %s test failed\n", ts.name); 783 eprintk("kgdbts: ERROR %s test failed\n", ts.name);
784 if (is_hw_breakpoint)
785 hwbreaks_ok = 0;
784} 786}
785 787
786static void run_hw_break_test(int is_write_test) 788static void run_hw_break_test(int is_write_test)
@@ -798,9 +800,11 @@ static void run_hw_break_test(int is_write_test)
798 kgdb_breakpoint(); 800 kgdb_breakpoint();
799 hw_break_val_access(); 801 hw_break_val_access();
800 if (is_write_test) { 802 if (is_write_test) {
801 if (test_complete == 2) 803 if (test_complete == 2) {
802 eprintk("kgdbts: ERROR %s broke on access\n", 804 eprintk("kgdbts: ERROR %s broke on access\n",
803 ts.name); 805 ts.name);
806 hwbreaks_ok = 0;
807 }
804 hw_break_val_write(); 808 hw_break_val_write();
805 } 809 }
806 kgdb_breakpoint(); 810 kgdb_breakpoint();
@@ -809,6 +813,7 @@ static void run_hw_break_test(int is_write_test)
809 return; 813 return;
810 814
811 eprintk("kgdbts: ERROR %s test failed\n", ts.name); 815 eprintk("kgdbts: ERROR %s test failed\n", ts.name);
816 hwbreaks_ok = 0;
812} 817}
813 818
814static void run_nmi_sleep_test(int nmi_sleep) 819static void run_nmi_sleep_test(int nmi_sleep)
@@ -912,6 +917,7 @@ static void kgdbts_run_tests(void)
912 917
913 /* All HW break point tests */ 918 /* All HW break point tests */
914 if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { 919 if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) {
920 hwbreaks_ok = 1;
915 v1printk("kgdbts:RUN hw breakpoint test\n"); 921 v1printk("kgdbts:RUN hw breakpoint test\n");
916 run_breakpoint_test(1); 922 run_breakpoint_test(1);
917 v1printk("kgdbts:RUN hw write breakpoint test\n"); 923 v1printk("kgdbts:RUN hw write breakpoint test\n");
@@ -925,6 +931,19 @@ static void kgdbts_run_tests(void)
925 run_nmi_sleep_test(nmi_sleep); 931 run_nmi_sleep_test(nmi_sleep);
926 } 932 }
927 933
934#ifdef CONFIG_DEBUG_RODATA
935 /* Until there is an api to write to read-only text segments, use
936 * HW breakpoints for the remainder of any tests, else print a
937 * failure message if hw breakpoints do not work.
938 */
939 if (!(arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT && hwbreaks_ok)) {
940 eprintk("kgdbts: HW breakpoints do not work,"
941 "skipping remaining tests\n");
942 return;
943 }
944 force_hwbrks = 1;
945#endif /* CONFIG_DEBUG_RODATA */
946
928 /* If the do_fork test is run it will be the last test that is 947 /* If the do_fork test is run it will be the last test that is
929 * executed because a kernel thread will be spawned at the very 948 * executed because a kernel thread will be spawned at the very
930 * end to unregister the debug hooks. 949 * end to unregister the debug hooks.
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h
index 5515234be86a..03a87a307e32 100644
--- a/drivers/misc/sgi-xp/xp.h
+++ b/drivers/misc/sgi-xp/xp.h
@@ -157,215 +157,136 @@ struct xpc_msg {
157/* 157/*
158 * Define the return values and values passed to user's callout functions. 158 * Define the return values and values passed to user's callout functions.
159 * (It is important to add new value codes at the end just preceding 159 * (It is important to add new value codes at the end just preceding
160 * xpcUnknownReason, which must have the highest numerical value.) 160 * xpUnknownReason, which must have the highest numerical value.)
161 */ 161 */
162enum xpc_retval { 162enum xp_retval {
163 xpcSuccess = 0, 163 xpSuccess = 0,
164 164
165 xpcNotConnected, /* 1: channel is not connected */ 165 xpNotConnected, /* 1: channel is not connected */
166 xpcConnected, /* 2: channel connected (opened) */ 166 xpConnected, /* 2: channel connected (opened) */
167 xpcRETIRED1, /* 3: (formerly xpcDisconnected) */ 167 xpRETIRED1, /* 3: (formerly xpDisconnected) */
168 168
169 xpcMsgReceived, /* 4: message received */ 169 xpMsgReceived, /* 4: message received */
170 xpcMsgDelivered, /* 5: message delivered and acknowledged */ 170 xpMsgDelivered, /* 5: message delivered and acknowledged */
171 171
172 xpcRETIRED2, /* 6: (formerly xpcTransferFailed) */ 172 xpRETIRED2, /* 6: (formerly xpTransferFailed) */
173 173
174 xpcNoWait, /* 7: operation would require wait */ 174 xpNoWait, /* 7: operation would require wait */
175 xpcRetry, /* 8: retry operation */ 175 xpRetry, /* 8: retry operation */
176 xpcTimeout, /* 9: timeout in xpc_allocate_msg_wait() */ 176 xpTimeout, /* 9: timeout in xpc_allocate_msg_wait() */
177 xpcInterrupted, /* 10: interrupted wait */ 177 xpInterrupted, /* 10: interrupted wait */
178 178
179 xpcUnequalMsgSizes, /* 11: message size disparity between sides */ 179 xpUnequalMsgSizes, /* 11: message size disparity between sides */
180 xpcInvalidAddress, /* 12: invalid address */ 180 xpInvalidAddress, /* 12: invalid address */
181 181
182 xpcNoMemory, /* 13: no memory available for XPC structures */ 182 xpNoMemory, /* 13: no memory available for XPC structures */
183 xpcLackOfResources, /* 14: insufficient resources for operation */ 183 xpLackOfResources, /* 14: insufficient resources for operation */
184 xpcUnregistered, /* 15: channel is not registered */ 184 xpUnregistered, /* 15: channel is not registered */
185 xpcAlreadyRegistered, /* 16: channel is already registered */ 185 xpAlreadyRegistered, /* 16: channel is already registered */
186 186
187 xpcPartitionDown, /* 17: remote partition is down */ 187 xpPartitionDown, /* 17: remote partition is down */
188 xpcNotLoaded, /* 18: XPC module is not loaded */ 188 xpNotLoaded, /* 18: XPC module is not loaded */
189 xpcUnloading, /* 19: this side is unloading XPC module */ 189 xpUnloading, /* 19: this side is unloading XPC module */
190 190
191 xpcBadMagic, /* 20: XPC MAGIC string not found */ 191 xpBadMagic, /* 20: XPC MAGIC string not found */
192 192
193 xpcReactivating, /* 21: remote partition was reactivated */ 193 xpReactivating, /* 21: remote partition was reactivated */
194 194
195 xpcUnregistering, /* 22: this side is unregistering channel */ 195 xpUnregistering, /* 22: this side is unregistering channel */
196 xpcOtherUnregistering, /* 23: other side is unregistering channel */ 196 xpOtherUnregistering, /* 23: other side is unregistering channel */
197 197
198 xpcCloneKThread, /* 24: cloning kernel thread */ 198 xpCloneKThread, /* 24: cloning kernel thread */
199 xpcCloneKThreadFailed, /* 25: cloning kernel thread failed */ 199 xpCloneKThreadFailed, /* 25: cloning kernel thread failed */
200 200
201 xpcNoHeartbeat, /* 26: remote partition has no heartbeat */ 201 xpNoHeartbeat, /* 26: remote partition has no heartbeat */
202 202
203 xpcPioReadError, /* 27: PIO read error */ 203 xpPioReadError, /* 27: PIO read error */
204 xpcPhysAddrRegFailed, /* 28: registration of phys addr range failed */ 204 xpPhysAddrRegFailed, /* 28: registration of phys addr range failed */
205 205
206 xpcBteDirectoryError, /* 29: maps to BTEFAIL_DIR */ 206 xpRETIRED3, /* 29: (formerly xpBteDirectoryError) */
207 xpcBtePoisonError, /* 30: maps to BTEFAIL_POISON */ 207 xpRETIRED4, /* 30: (formerly xpBtePoisonError) */
208 xpcBteWriteError, /* 31: maps to BTEFAIL_WERR */ 208 xpRETIRED5, /* 31: (formerly xpBteWriteError) */
209 xpcBteAccessError, /* 32: maps to BTEFAIL_ACCESS */ 209 xpRETIRED6, /* 32: (formerly xpBteAccessError) */
210 xpcBtePWriteError, /* 33: maps to BTEFAIL_PWERR */ 210 xpRETIRED7, /* 33: (formerly xpBtePWriteError) */
211 xpcBtePReadError, /* 34: maps to BTEFAIL_PRERR */ 211 xpRETIRED8, /* 34: (formerly xpBtePReadError) */
212 xpcBteTimeOutError, /* 35: maps to BTEFAIL_TOUT */ 212 xpRETIRED9, /* 35: (formerly xpBteTimeOutError) */
213 xpcBteXtalkError, /* 36: maps to BTEFAIL_XTERR */ 213 xpRETIRED10, /* 36: (formerly xpBteXtalkError) */
214 xpcBteNotAvailable, /* 37: maps to BTEFAIL_NOTAVAIL */ 214 xpRETIRED11, /* 37: (formerly xpBteNotAvailable) */
215 xpcBteUnmappedError, /* 38: unmapped BTEFAIL_ error */ 215 xpRETIRED12, /* 38: (formerly xpBteUnmappedError) */
216 216
217 xpcBadVersion, /* 39: bad version number */ 217 xpBadVersion, /* 39: bad version number */
218 xpcVarsNotSet, /* 40: the XPC variables are not set up */ 218 xpVarsNotSet, /* 40: the XPC variables are not set up */
219 xpcNoRsvdPageAddr, /* 41: unable to get rsvd page's phys addr */ 219 xpNoRsvdPageAddr, /* 41: unable to get rsvd page's phys addr */
220 xpcInvalidPartid, /* 42: invalid partition ID */ 220 xpInvalidPartid, /* 42: invalid partition ID */
221 xpcLocalPartid, /* 43: local partition ID */ 221 xpLocalPartid, /* 43: local partition ID */
222 222
223 xpcOtherGoingDown, /* 44: other side going down, reason unknown */ 223 xpOtherGoingDown, /* 44: other side going down, reason unknown */
224 xpcSystemGoingDown, /* 45: system is going down, reason unknown */ 224 xpSystemGoingDown, /* 45: system is going down, reason unknown */
225 xpcSystemHalt, /* 46: system is being halted */ 225 xpSystemHalt, /* 46: system is being halted */
226 xpcSystemReboot, /* 47: system is being rebooted */ 226 xpSystemReboot, /* 47: system is being rebooted */
227 xpcSystemPoweroff, /* 48: system is being powered off */ 227 xpSystemPoweroff, /* 48: system is being powered off */
228 228
229 xpcDisconnecting, /* 49: channel disconnecting (closing) */ 229 xpDisconnecting, /* 49: channel disconnecting (closing) */
230 230
231 xpcOpenCloseError, /* 50: channel open/close protocol error */ 231 xpOpenCloseError, /* 50: channel open/close protocol error */
232 232
233 xpcDisconnected, /* 51: channel disconnected (closed) */ 233 xpDisconnected, /* 51: channel disconnected (closed) */
234 234
235 xpcBteSh2Start, /* 52: BTE CRB timeout */ 235 xpBteCopyError, /* 52: bte_copy() returned error */
236 236
237 /* 53: 0x1 BTE Error Response Short */ 237 xpUnknownReason /* 53: unknown reason - must be last in enum */
238 xpcBteSh2RspShort = xpcBteSh2Start + BTEFAIL_SH2_RESP_SHORT,
239
240 /* 54: 0x2 BTE Error Response Long */
241 xpcBteSh2RspLong = xpcBteSh2Start + BTEFAIL_SH2_RESP_LONG,
242
243 /* 56: 0x4 BTE Error Response DSB */
244 xpcBteSh2RspDSB = xpcBteSh2Start + BTEFAIL_SH2_RESP_DSP,
245
246 /* 60: 0x8 BTE Error Response Access */
247 xpcBteSh2RspAccess = xpcBteSh2Start + BTEFAIL_SH2_RESP_ACCESS,
248
249 /* 68: 0x10 BTE Error CRB timeout */
250 xpcBteSh2CRBTO = xpcBteSh2Start + BTEFAIL_SH2_CRB_TO,
251
252 /* 84: 0x20 BTE Error NACK limit */
253 xpcBteSh2NACKLimit = xpcBteSh2Start + BTEFAIL_SH2_NACK_LIMIT,
254
255 /* 115: BTE end */
256 xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL,
257
258 xpcUnknownReason /* 116: unknown reason - must be last in enum */
259}; 238};
260 239
261/* 240/*
262 * Define the callout function types used by XPC to update the user on 241 * Define the callout function type used by XPC to update the user on
263 * connection activity and state changes (via the user function registered by 242 * connection activity and state changes via the user function registered
264 * xpc_connect()) and to notify them of messages received and delivered (via 243 * by xpc_connect().
265 * the user function registered by xpc_send_notify()).
266 *
267 * The two function types are xpc_channel_func and xpc_notify_func and
268 * both share the following arguments, with the exception of "data", which
269 * only xpc_channel_func has.
270 * 244 *
271 * Arguments: 245 * Arguments:
272 * 246 *
273 * reason - reason code. (See following table.) 247 * reason - reason code.
274 * partid - partition ID associated with condition. 248 * partid - partition ID associated with condition.
275 * ch_number - channel # associated with condition. 249 * ch_number - channel # associated with condition.
276 * data - pointer to optional data. (See following table.) 250 * data - pointer to optional data.
277 * key - pointer to optional user-defined value provided as the "key" 251 * key - pointer to optional user-defined value provided as the "key"
278 * argument to xpc_connect() or xpc_send_notify(). 252 * argument to xpc_connect().
279 * 253 *
280 * In the following table the "Optional Data" column applies to callouts made 254 * A reason code of xpConnected indicates that a connection has been
281 * to functions registered by xpc_connect(). A "NA" in that column indicates 255 * established to the specified partition on the specified channel. The data
282 * that this reason code can be passed to functions registered by 256 * argument indicates the max number of entries allowed in the message queue.
283 * xpc_send_notify() (i.e. they don't have data arguments).
284 * 257 *
285 * Also, the first three reason codes in the following table indicate 258 * A reason code of xpMsgReceived indicates that a XPC message arrived from
286 * success, whereas the others indicate failure. When a failure reason code 259 * the specified partition on the specified channel. The data argument
287 * is received, one can assume that the channel is not connected. 260 * specifies the address of the message's payload. The user must call
261 * xpc_received() when finished with the payload.
288 * 262 *
289 * 263 * All other reason codes indicate failure. The data argmument is NULL.
290 * Reason Code | Cause | Optional Data 264 * When a failure reason code is received, one can assume that the channel
291 * =====================+================================+===================== 265 * is not connected.
292 * xpcConnected | connection has been established| max #of entries
293 * | to the specified partition on | allowed in message
294 * | the specified channel | queue
295 * ---------------------+--------------------------------+---------------------
296 * xpcMsgReceived | an XPC message arrived from | address of payload
297 * | the specified partition on the |
298 * | specified channel | [the user must call
299 * | | xpc_received() when
300 * | | finished with the
301 * | | payload]
302 * ---------------------+--------------------------------+---------------------
303 * xpcMsgDelivered | notification that the message | NA
304 * | was delivered to the intended |
305 * | recipient and that they have |
306 * | acknowledged its receipt by |
307 * | calling xpc_received() |
308 * =====================+================================+=====================
309 * xpcUnequalMsgSizes | can't connect to the specified | NULL
310 * | partition on the specified |
311 * | channel because of mismatched |
312 * | message sizes |
313 * ---------------------+--------------------------------+---------------------
314 * xpcNoMemory | insufficient memory avaiable | NULL
315 * | to allocate message queue |
316 * ---------------------+--------------------------------+---------------------
317 * xpcLackOfResources | lack of resources to create | NULL
318 * | the necessary kthreads to |
319 * | support the channel |
320 * ---------------------+--------------------------------+---------------------
321 * xpcUnregistering | this side's user has | NULL or NA
322 * | unregistered by calling |
323 * | xpc_disconnect() |
324 * ---------------------+--------------------------------+---------------------
325 * xpcOtherUnregistering| the other side's user has | NULL or NA
326 * | unregistered by calling |
327 * | xpc_disconnect() |
328 * ---------------------+--------------------------------+---------------------
329 * xpcNoHeartbeat | the other side's XPC is no | NULL or NA
330 * | longer heartbeating |
331 * | |
332 * ---------------------+--------------------------------+---------------------
333 * xpcUnloading | this side's XPC module is | NULL or NA
334 * | being unloaded |
335 * | |
336 * ---------------------+--------------------------------+---------------------
337 * xpcOtherUnloading | the other side's XPC module is | NULL or NA
338 * | is being unloaded |
339 * | |
340 * ---------------------+--------------------------------+---------------------
341 * xpcPioReadError | xp_nofault_PIOR() returned an | NULL or NA
342 * | error while sending an IPI |
343 * | |
344 * ---------------------+--------------------------------+---------------------
345 * xpcInvalidAddress | the address either received or | NULL or NA
346 * | sent by the specified partition|
347 * | is invalid |
348 * ---------------------+--------------------------------+---------------------
349 * xpcBteNotAvailable | attempt to pull data from the | NULL or NA
350 * xpcBtePoisonError | specified partition over the |
351 * xpcBteWriteError | specified channel via a |
352 * xpcBteAccessError | bte_copy() failed |
353 * xpcBteTimeOutError | |
354 * xpcBteXtalkError | |
355 * xpcBteDirectoryError | |
356 * xpcBteGenericError | |
357 * xpcBteUnmappedError | |
358 * ---------------------+--------------------------------+---------------------
359 * xpcUnknownReason | the specified channel to the | NULL or NA
360 * | specified partition was |
361 * | unavailable for unknown reasons|
362 * =====================+================================+=====================
363 */ 266 */
364 267typedef void (*xpc_channel_func) (enum xp_retval reason, short partid,
365typedef void (*xpc_channel_func) (enum xpc_retval reason, partid_t partid,
366 int ch_number, void *data, void *key); 268 int ch_number, void *data, void *key);
367 269
368typedef void (*xpc_notify_func) (enum xpc_retval reason, partid_t partid, 270/*
271 * Define the callout function type used by XPC to notify the user of
272 * messages received and delivered via the user function registered by
273 * xpc_send_notify().
274 *
275 * Arguments:
276 *
277 * reason - reason code.
278 * partid - partition ID associated with condition.
279 * ch_number - channel # associated with condition.
280 * key - pointer to optional user-defined value provided as the "key"
281 * argument to xpc_send_notify().
282 *
283 * A reason code of xpMsgDelivered indicates that the message was delivered
284 * to the intended recipient and that they have acknowledged its receipt by
285 * calling xpc_received().
286 *
287 * All other reason codes indicate failure.
288 */
289typedef void (*xpc_notify_func) (enum xp_retval reason, short partid,
369 int ch_number, void *key); 290 int ch_number, void *key);
370 291
371/* 292/*
@@ -401,57 +322,57 @@ struct xpc_registration {
401struct xpc_interface { 322struct xpc_interface {
402 void (*connect) (int); 323 void (*connect) (int);
403 void (*disconnect) (int); 324 void (*disconnect) (int);
404 enum xpc_retval (*allocate) (partid_t, int, u32, void **); 325 enum xp_retval (*allocate) (short, int, u32, void **);
405 enum xpc_retval (*send) (partid_t, int, void *); 326 enum xp_retval (*send) (short, int, void *);
406 enum xpc_retval (*send_notify) (partid_t, int, void *, 327 enum xp_retval (*send_notify) (short, int, void *,
407 xpc_notify_func, void *); 328 xpc_notify_func, void *);
408 void (*received) (partid_t, int, void *); 329 void (*received) (short, int, void *);
409 enum xpc_retval (*partid_to_nasids) (partid_t, void *); 330 enum xp_retval (*partid_to_nasids) (short, void *);
410}; 331};
411 332
412extern struct xpc_interface xpc_interface; 333extern struct xpc_interface xpc_interface;
413 334
414extern void xpc_set_interface(void (*)(int), 335extern void xpc_set_interface(void (*)(int),
415 void (*)(int), 336 void (*)(int),
416 enum xpc_retval (*)(partid_t, int, u32, void **), 337 enum xp_retval (*)(short, int, u32, void **),
417 enum xpc_retval (*)(partid_t, int, void *), 338 enum xp_retval (*)(short, int, void *),
418 enum xpc_retval (*)(partid_t, int, void *, 339 enum xp_retval (*)(short, int, void *,
419 xpc_notify_func, void *), 340 xpc_notify_func, void *),
420 void (*)(partid_t, int, void *), 341 void (*)(short, int, void *),
421 enum xpc_retval (*)(partid_t, void *)); 342 enum xp_retval (*)(short, void *));
422extern void xpc_clear_interface(void); 343extern void xpc_clear_interface(void);
423 344
424extern enum xpc_retval xpc_connect(int, xpc_channel_func, void *, u16, 345extern enum xp_retval xpc_connect(int, xpc_channel_func, void *, u16,
425 u16, u32, u32); 346 u16, u32, u32);
426extern void xpc_disconnect(int); 347extern void xpc_disconnect(int);
427 348
428static inline enum xpc_retval 349static inline enum xp_retval
429xpc_allocate(partid_t partid, int ch_number, u32 flags, void **payload) 350xpc_allocate(short partid, int ch_number, u32 flags, void **payload)
430{ 351{
431 return xpc_interface.allocate(partid, ch_number, flags, payload); 352 return xpc_interface.allocate(partid, ch_number, flags, payload);
432} 353}
433 354
434static inline enum xpc_retval 355static inline enum xp_retval
435xpc_send(partid_t partid, int ch_number, void *payload) 356xpc_send(short partid, int ch_number, void *payload)
436{ 357{
437 return xpc_interface.send(partid, ch_number, payload); 358 return xpc_interface.send(partid, ch_number, payload);
438} 359}
439 360
440static inline enum xpc_retval 361static inline enum xp_retval
441xpc_send_notify(partid_t partid, int ch_number, void *payload, 362xpc_send_notify(short partid, int ch_number, void *payload,
442 xpc_notify_func func, void *key) 363 xpc_notify_func func, void *key)
443{ 364{
444 return xpc_interface.send_notify(partid, ch_number, payload, func, key); 365 return xpc_interface.send_notify(partid, ch_number, payload, func, key);
445} 366}
446 367
447static inline void 368static inline void
448xpc_received(partid_t partid, int ch_number, void *payload) 369xpc_received(short partid, int ch_number, void *payload)
449{ 370{
450 return xpc_interface.received(partid, ch_number, payload); 371 return xpc_interface.received(partid, ch_number, payload);
451} 372}
452 373
453static inline enum xpc_retval 374static inline enum xp_retval
454xpc_partid_to_nasids(partid_t partid, void *nasids) 375xpc_partid_to_nasids(short partid, void *nasids)
455{ 376{
456 return xpc_interface.partid_to_nasids(partid, nasids); 377 return xpc_interface.partid_to_nasids(partid, nasids);
457} 378}
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c
index 1fbf99bae963..196480b691a1 100644
--- a/drivers/misc/sgi-xp/xp_main.c
+++ b/drivers/misc/sgi-xp/xp_main.c
@@ -42,21 +42,21 @@ EXPORT_SYMBOL_GPL(xpc_registrations);
42/* 42/*
43 * Initialize the XPC interface to indicate that XPC isn't loaded. 43 * Initialize the XPC interface to indicate that XPC isn't loaded.
44 */ 44 */
45static enum xpc_retval 45static enum xp_retval
46xpc_notloaded(void) 46xpc_notloaded(void)
47{ 47{
48 return xpcNotLoaded; 48 return xpNotLoaded;
49} 49}
50 50
51struct xpc_interface xpc_interface = { 51struct xpc_interface xpc_interface = {
52 (void (*)(int))xpc_notloaded, 52 (void (*)(int))xpc_notloaded,
53 (void (*)(int))xpc_notloaded, 53 (void (*)(int))xpc_notloaded,
54 (enum xpc_retval(*)(partid_t, int, u32, void **))xpc_notloaded, 54 (enum xp_retval(*)(short, int, u32, void **))xpc_notloaded,
55 (enum xpc_retval(*)(partid_t, int, void *))xpc_notloaded, 55 (enum xp_retval(*)(short, int, void *))xpc_notloaded,
56 (enum xpc_retval(*)(partid_t, int, void *, xpc_notify_func, void *)) 56 (enum xp_retval(*)(short, int, void *, xpc_notify_func, void *))
57 xpc_notloaded, 57 xpc_notloaded,
58 (void (*)(partid_t, int, void *))xpc_notloaded, 58 (void (*)(short, int, void *))xpc_notloaded,
59 (enum xpc_retval(*)(partid_t, void *))xpc_notloaded 59 (enum xp_retval(*)(short, void *))xpc_notloaded
60}; 60};
61EXPORT_SYMBOL_GPL(xpc_interface); 61EXPORT_SYMBOL_GPL(xpc_interface);
62 62
@@ -66,12 +66,12 @@ EXPORT_SYMBOL_GPL(xpc_interface);
66void 66void
67xpc_set_interface(void (*connect) (int), 67xpc_set_interface(void (*connect) (int),
68 void (*disconnect) (int), 68 void (*disconnect) (int),
69 enum xpc_retval (*allocate) (partid_t, int, u32, void **), 69 enum xp_retval (*allocate) (short, int, u32, void **),
70 enum xpc_retval (*send) (partid_t, int, void *), 70 enum xp_retval (*send) (short, int, void *),
71 enum xpc_retval (*send_notify) (partid_t, int, void *, 71 enum xp_retval (*send_notify) (short, int, void *,
72 xpc_notify_func, void *), 72 xpc_notify_func, void *),
73 void (*received) (partid_t, int, void *), 73 void (*received) (short, int, void *),
74 enum xpc_retval (*partid_to_nasids) (partid_t, void *)) 74 enum xp_retval (*partid_to_nasids) (short, void *))
75{ 75{
76 xpc_interface.connect = connect; 76 xpc_interface.connect = connect;
77 xpc_interface.disconnect = disconnect; 77 xpc_interface.disconnect = disconnect;
@@ -91,16 +91,16 @@ xpc_clear_interface(void)
91{ 91{
92 xpc_interface.connect = (void (*)(int))xpc_notloaded; 92 xpc_interface.connect = (void (*)(int))xpc_notloaded;
93 xpc_interface.disconnect = (void (*)(int))xpc_notloaded; 93 xpc_interface.disconnect = (void (*)(int))xpc_notloaded;
94 xpc_interface.allocate = (enum xpc_retval(*)(partid_t, int, u32, 94 xpc_interface.allocate = (enum xp_retval(*)(short, int, u32,
95 void **))xpc_notloaded; 95 void **))xpc_notloaded;
96 xpc_interface.send = (enum xpc_retval(*)(partid_t, int, void *)) 96 xpc_interface.send = (enum xp_retval(*)(short, int, void *))
97 xpc_notloaded; 97 xpc_notloaded;
98 xpc_interface.send_notify = (enum xpc_retval(*)(partid_t, int, void *, 98 xpc_interface.send_notify = (enum xp_retval(*)(short, int, void *,
99 xpc_notify_func, 99 xpc_notify_func,
100 void *))xpc_notloaded; 100 void *))xpc_notloaded;
101 xpc_interface.received = (void (*)(partid_t, int, void *)) 101 xpc_interface.received = (void (*)(short, int, void *))
102 xpc_notloaded; 102 xpc_notloaded;
103 xpc_interface.partid_to_nasids = (enum xpc_retval(*)(partid_t, void *)) 103 xpc_interface.partid_to_nasids = (enum xp_retval(*)(short, void *))
104 xpc_notloaded; 104 xpc_notloaded;
105} 105}
106EXPORT_SYMBOL_GPL(xpc_clear_interface); 106EXPORT_SYMBOL_GPL(xpc_clear_interface);
@@ -123,13 +123,13 @@ EXPORT_SYMBOL_GPL(xpc_clear_interface);
123 * nentries - max #of XPC message entries a message queue can contain. 123 * nentries - max #of XPC message entries a message queue can contain.
124 * The actual number, which is determined when a connection 124 * The actual number, which is determined when a connection
125 * is established and may be less then requested, will be 125 * is established and may be less then requested, will be
126 * passed to the user via the xpcConnected callout. 126 * passed to the user via the xpConnected callout.
127 * assigned_limit - max number of kthreads allowed to be processing 127 * assigned_limit - max number of kthreads allowed to be processing
128 * messages (per connection) at any given instant. 128 * messages (per connection) at any given instant.
129 * idle_limit - max number of kthreads allowed to be idle at any given 129 * idle_limit - max number of kthreads allowed to be idle at any given
130 * instant. 130 * instant.
131 */ 131 */
132enum xpc_retval 132enum xp_retval
133xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size, 133xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
134 u16 nentries, u32 assigned_limit, u32 idle_limit) 134 u16 nentries, u32 assigned_limit, u32 idle_limit)
135{ 135{
@@ -143,12 +143,12 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
143 registration = &xpc_registrations[ch_number]; 143 registration = &xpc_registrations[ch_number];
144 144
145 if (mutex_lock_interruptible(&registration->mutex) != 0) 145 if (mutex_lock_interruptible(&registration->mutex) != 0)
146 return xpcInterrupted; 146 return xpInterrupted;
147 147
148 /* if XPC_CHANNEL_REGISTERED(ch_number) */ 148 /* if XPC_CHANNEL_REGISTERED(ch_number) */
149 if (registration->func != NULL) { 149 if (registration->func != NULL) {
150 mutex_unlock(&registration->mutex); 150 mutex_unlock(&registration->mutex);
151 return xpcAlreadyRegistered; 151 return xpAlreadyRegistered;
152 } 152 }
153 153
154 /* register the channel for connection */ 154 /* register the channel for connection */
@@ -163,7 +163,7 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
163 163
164 xpc_interface.connect(ch_number); 164 xpc_interface.connect(ch_number);
165 165
166 return xpcSuccess; 166 return xpSuccess;
167} 167}
168EXPORT_SYMBOL_GPL(xpc_connect); 168EXPORT_SYMBOL_GPL(xpc_connect);
169 169
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index 9eb6d4a3269c..11ac267ed68f 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -172,13 +172,13 @@ struct xpc_vars {
172 (_version >= _XPC_VERSION(3, 1)) 172 (_version >= _XPC_VERSION(3, 1))
173 173
174static inline int 174static inline int
175xpc_hb_allowed(partid_t partid, struct xpc_vars *vars) 175xpc_hb_allowed(short partid, struct xpc_vars *vars)
176{ 176{
177 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0); 177 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
178} 178}
179 179
180static inline void 180static inline void
181xpc_allow_hb(partid_t partid, struct xpc_vars *vars) 181xpc_allow_hb(short partid, struct xpc_vars *vars)
182{ 182{
183 u64 old_mask, new_mask; 183 u64 old_mask, new_mask;
184 184
@@ -190,7 +190,7 @@ xpc_allow_hb(partid_t partid, struct xpc_vars *vars)
190} 190}
191 191
192static inline void 192static inline void
193xpc_disallow_hb(partid_t partid, struct xpc_vars *vars) 193xpc_disallow_hb(short partid, struct xpc_vars *vars)
194{ 194{
195 u64 old_mask, new_mask; 195 u64 old_mask, new_mask;
196 196
@@ -408,11 +408,11 @@ struct xpc_notify {
408 * messages. 408 * messages.
409 */ 409 */
410struct xpc_channel { 410struct xpc_channel {
411 partid_t partid; /* ID of remote partition connected */ 411 short partid; /* ID of remote partition connected */
412 spinlock_t lock; /* lock for updating this structure */ 412 spinlock_t lock; /* lock for updating this structure */
413 u32 flags; /* general flags */ 413 u32 flags; /* general flags */
414 414
415 enum xpc_retval reason; /* reason why channel is disconnect'g */ 415 enum xp_retval reason; /* reason why channel is disconnect'g */
416 int reason_line; /* line# disconnect initiated from */ 416 int reason_line; /* line# disconnect initiated from */
417 417
418 u16 number; /* channel # */ 418 u16 number; /* channel # */
@@ -522,7 +522,7 @@ struct xpc_partition {
522 spinlock_t act_lock; /* protect updating of act_state */ 522 spinlock_t act_lock; /* protect updating of act_state */
523 u8 act_state; /* from XPC HB viewpoint */ 523 u8 act_state; /* from XPC HB viewpoint */
524 u8 remote_vars_version; /* version# of partition's vars */ 524 u8 remote_vars_version; /* version# of partition's vars */
525 enum xpc_retval reason; /* reason partition is deactivating */ 525 enum xp_retval reason; /* reason partition is deactivating */
526 int reason_line; /* line# deactivation initiated from */ 526 int reason_line; /* line# deactivation initiated from */
527 int reactivate_nasid; /* nasid in partition to reactivate */ 527 int reactivate_nasid; /* nasid in partition to reactivate */
528 528
@@ -615,7 +615,7 @@ struct xpc_partition {
615/* interval in seconds to print 'waiting disengagement' messages */ 615/* interval in seconds to print 'waiting disengagement' messages */
616#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10 616#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10
617 617
618#define XPC_PARTID(_p) ((partid_t) ((_p) - &xpc_partitions[0])) 618#define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0]))
619 619
620/* found in xp_main.c */ 620/* found in xp_main.c */
621extern struct xpc_registration xpc_registrations[]; 621extern struct xpc_registration xpc_registrations[];
@@ -646,31 +646,31 @@ extern void xpc_allow_IPI_ops(void);
646extern void xpc_restrict_IPI_ops(void); 646extern void xpc_restrict_IPI_ops(void);
647extern int xpc_identify_act_IRQ_sender(void); 647extern int xpc_identify_act_IRQ_sender(void);
648extern int xpc_partition_disengaged(struct xpc_partition *); 648extern int xpc_partition_disengaged(struct xpc_partition *);
649extern enum xpc_retval xpc_mark_partition_active(struct xpc_partition *); 649extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *);
650extern void xpc_mark_partition_inactive(struct xpc_partition *); 650extern void xpc_mark_partition_inactive(struct xpc_partition *);
651extern void xpc_discovery(void); 651extern void xpc_discovery(void);
652extern void xpc_check_remote_hb(void); 652extern void xpc_check_remote_hb(void);
653extern void xpc_deactivate_partition(const int, struct xpc_partition *, 653extern void xpc_deactivate_partition(const int, struct xpc_partition *,
654 enum xpc_retval); 654 enum xp_retval);
655extern enum xpc_retval xpc_initiate_partid_to_nasids(partid_t, void *); 655extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *);
656 656
657/* found in xpc_channel.c */ 657/* found in xpc_channel.c */
658extern void xpc_initiate_connect(int); 658extern void xpc_initiate_connect(int);
659extern void xpc_initiate_disconnect(int); 659extern void xpc_initiate_disconnect(int);
660extern enum xpc_retval xpc_initiate_allocate(partid_t, int, u32, void **); 660extern enum xp_retval xpc_initiate_allocate(short, int, u32, void **);
661extern enum xpc_retval xpc_initiate_send(partid_t, int, void *); 661extern enum xp_retval xpc_initiate_send(short, int, void *);
662extern enum xpc_retval xpc_initiate_send_notify(partid_t, int, void *, 662extern enum xp_retval xpc_initiate_send_notify(short, int, void *,
663 xpc_notify_func, void *); 663 xpc_notify_func, void *);
664extern void xpc_initiate_received(partid_t, int, void *); 664extern void xpc_initiate_received(short, int, void *);
665extern enum xpc_retval xpc_setup_infrastructure(struct xpc_partition *); 665extern enum xp_retval xpc_setup_infrastructure(struct xpc_partition *);
666extern enum xpc_retval xpc_pull_remote_vars_part(struct xpc_partition *); 666extern enum xp_retval xpc_pull_remote_vars_part(struct xpc_partition *);
667extern void xpc_process_channel_activity(struct xpc_partition *); 667extern void xpc_process_channel_activity(struct xpc_partition *);
668extern void xpc_connected_callout(struct xpc_channel *); 668extern void xpc_connected_callout(struct xpc_channel *);
669extern void xpc_deliver_msg(struct xpc_channel *); 669extern void xpc_deliver_msg(struct xpc_channel *);
670extern void xpc_disconnect_channel(const int, struct xpc_channel *, 670extern void xpc_disconnect_channel(const int, struct xpc_channel *,
671 enum xpc_retval, unsigned long *); 671 enum xp_retval, unsigned long *);
672extern void xpc_disconnect_callout(struct xpc_channel *, enum xpc_retval); 672extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval);
673extern void xpc_partition_going_down(struct xpc_partition *, enum xpc_retval); 673extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval);
674extern void xpc_teardown_infrastructure(struct xpc_partition *); 674extern void xpc_teardown_infrastructure(struct xpc_partition *);
675 675
676static inline void 676static inline void
@@ -901,7 +901,7 @@ xpc_IPI_receive(AMO_t *amo)
901 return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR); 901 return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR);
902} 902}
903 903
904static inline enum xpc_retval 904static inline enum xp_retval
905xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector) 905xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
906{ 906{
907 int ret = 0; 907 int ret = 0;
@@ -923,7 +923,7 @@ xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
923 923
924 local_irq_restore(irq_flags); 924 local_irq_restore(irq_flags);
925 925
926 return ((ret == 0) ? xpcSuccess : xpcPioReadError); 926 return ((ret == 0) ? xpSuccess : xpPioReadError);
927} 927}
928 928
929/* 929/*
@@ -992,7 +992,7 @@ xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
992 unsigned long *irq_flags) 992 unsigned long *irq_flags)
993{ 993{
994 struct xpc_partition *part = &xpc_partitions[ch->partid]; 994 struct xpc_partition *part = &xpc_partitions[ch->partid];
995 enum xpc_retval ret; 995 enum xp_retval ret;
996 996
997 if (likely(part->act_state != XPC_P_DEACTIVATING)) { 997 if (likely(part->act_state != XPC_P_DEACTIVATING)) {
998 ret = xpc_IPI_send(part->remote_IPI_amo_va, 998 ret = xpc_IPI_send(part->remote_IPI_amo_va,
@@ -1001,7 +1001,7 @@ xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
1001 part->remote_IPI_phys_cpuid, SGI_XPC_NOTIFY); 1001 part->remote_IPI_phys_cpuid, SGI_XPC_NOTIFY);
1002 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n", 1002 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
1003 ipi_flag_string, ch->partid, ch->number, ret); 1003 ipi_flag_string, ch->partid, ch->number, ret);
1004 if (unlikely(ret != xpcSuccess)) { 1004 if (unlikely(ret != xpSuccess)) {
1005 if (irq_flags != NULL) 1005 if (irq_flags != NULL)
1006 spin_unlock_irqrestore(&ch->lock, *irq_flags); 1006 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1007 XPC_DEACTIVATE_PARTITION(part, ret); 1007 XPC_DEACTIVATE_PARTITION(part, ret);
@@ -1123,41 +1123,10 @@ xpc_IPI_init(int index)
1123 return amo; 1123 return amo;
1124} 1124}
1125 1125
1126static inline enum xpc_retval 1126static inline enum xp_retval
1127xpc_map_bte_errors(bte_result_t error) 1127xpc_map_bte_errors(bte_result_t error)
1128{ 1128{
1129 if (error == BTE_SUCCESS) 1129 return ((error == BTE_SUCCESS) ? xpSuccess : xpBteCopyError);
1130 return xpcSuccess;
1131
1132 if (is_shub2()) {
1133 if (BTE_VALID_SH2_ERROR(error))
1134 return xpcBteSh2Start + error;
1135 return xpcBteUnmappedError;
1136 }
1137 switch (error) {
1138 case BTE_SUCCESS:
1139 return xpcSuccess;
1140 case BTEFAIL_DIR:
1141 return xpcBteDirectoryError;
1142 case BTEFAIL_POISON:
1143 return xpcBtePoisonError;
1144 case BTEFAIL_WERR:
1145 return xpcBteWriteError;
1146 case BTEFAIL_ACCESS:
1147 return xpcBteAccessError;
1148 case BTEFAIL_PWERR:
1149 return xpcBtePWriteError;
1150 case BTEFAIL_PRERR:
1151 return xpcBtePReadError;
1152 case BTEFAIL_TOUT:
1153 return xpcBteTimeOutError;
1154 case BTEFAIL_XTERR:
1155 return xpcBteXtalkError;
1156 case BTEFAIL_NOTAVAIL:
1157 return xpcBteNotAvailable;
1158 default:
1159 return xpcBteUnmappedError;
1160 }
1161} 1130}
1162 1131
1163/* 1132/*
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
index bfcb9ea968e9..9c90c2d55c08 100644
--- a/drivers/misc/sgi-xp/xpc_channel.c
+++ b/drivers/misc/sgi-xp/xpc_channel.c
@@ -53,7 +53,7 @@ xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
53 * Set up the initial values for the XPartition Communication channels. 53 * Set up the initial values for the XPartition Communication channels.
54 */ 54 */
55static void 55static void
56xpc_initialize_channels(struct xpc_partition *part, partid_t partid) 56xpc_initialize_channels(struct xpc_partition *part, short partid)
57{ 57{
58 int ch_number; 58 int ch_number;
59 struct xpc_channel *ch; 59 struct xpc_channel *ch;
@@ -90,12 +90,12 @@ xpc_initialize_channels(struct xpc_partition *part, partid_t partid)
90 * Setup the infrastructure necessary to support XPartition Communication 90 * Setup the infrastructure necessary to support XPartition Communication
91 * between the specified remote partition and the local one. 91 * between the specified remote partition and the local one.
92 */ 92 */
93enum xpc_retval 93enum xp_retval
94xpc_setup_infrastructure(struct xpc_partition *part) 94xpc_setup_infrastructure(struct xpc_partition *part)
95{ 95{
96 int ret, cpuid; 96 int ret, cpuid;
97 struct timer_list *timer; 97 struct timer_list *timer;
98 partid_t partid = XPC_PARTID(part); 98 short partid = XPC_PARTID(part);
99 99
100 /* 100 /*
101 * Zero out MOST of the entry for this partition. Only the fields 101 * Zero out MOST of the entry for this partition. Only the fields
@@ -114,7 +114,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
114 GFP_KERNEL); 114 GFP_KERNEL);
115 if (part->channels == NULL) { 115 if (part->channels == NULL) {
116 dev_err(xpc_chan, "can't get memory for channels\n"); 116 dev_err(xpc_chan, "can't get memory for channels\n");
117 return xpcNoMemory; 117 return xpNoMemory;
118 } 118 }
119 119
120 part->nchannels = XPC_NCHANNELS; 120 part->nchannels = XPC_NCHANNELS;
@@ -129,7 +129,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
129 part->channels = NULL; 129 part->channels = NULL;
130 dev_err(xpc_chan, "can't get memory for local get/put " 130 dev_err(xpc_chan, "can't get memory for local get/put "
131 "values\n"); 131 "values\n");
132 return xpcNoMemory; 132 return xpNoMemory;
133 } 133 }
134 134
135 part->remote_GPs = xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE, 135 part->remote_GPs = xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE,
@@ -143,7 +143,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
143 part->local_GPs = NULL; 143 part->local_GPs = NULL;
144 kfree(part->channels); 144 kfree(part->channels);
145 part->channels = NULL; 145 part->channels = NULL;
146 return xpcNoMemory; 146 return xpNoMemory;
147 } 147 }
148 148
149 /* allocate all the required open and close args */ 149 /* allocate all the required open and close args */
@@ -159,7 +159,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
159 part->local_GPs = NULL; 159 part->local_GPs = NULL;
160 kfree(part->channels); 160 kfree(part->channels);
161 part->channels = NULL; 161 part->channels = NULL;
162 return xpcNoMemory; 162 return xpNoMemory;
163 } 163 }
164 164
165 part->remote_openclose_args = 165 part->remote_openclose_args =
@@ -175,7 +175,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
175 part->local_GPs = NULL; 175 part->local_GPs = NULL;
176 kfree(part->channels); 176 kfree(part->channels);
177 part->channels = NULL; 177 part->channels = NULL;
178 return xpcNoMemory; 178 return xpNoMemory;
179 } 179 }
180 180
181 xpc_initialize_channels(part, partid); 181 xpc_initialize_channels(part, partid);
@@ -209,7 +209,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
209 part->local_GPs = NULL; 209 part->local_GPs = NULL;
210 kfree(part->channels); 210 kfree(part->channels);
211 part->channels = NULL; 211 part->channels = NULL;
212 return xpcLackOfResources; 212 return xpLackOfResources;
213 } 213 }
214 214
215 /* Setup a timer to check for dropped IPIs */ 215 /* Setup a timer to check for dropped IPIs */
@@ -243,7 +243,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
243 xpc_vars_part[partid].nchannels = part->nchannels; 243 xpc_vars_part[partid].nchannels = part->nchannels;
244 xpc_vars_part[partid].magic = XPC_VP_MAGIC1; 244 xpc_vars_part[partid].magic = XPC_VP_MAGIC1;
245 245
246 return xpcSuccess; 246 return xpSuccess;
247} 247}
248 248
249/* 249/*
@@ -254,7 +254,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
254 * dst must be a cacheline aligned virtual address on this partition. 254 * dst must be a cacheline aligned virtual address on this partition.
255 * cnt must be an cacheline sized 255 * cnt must be an cacheline sized
256 */ 256 */
257static enum xpc_retval 257static enum xp_retval
258xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst, 258xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst,
259 const void *src, size_t cnt) 259 const void *src, size_t cnt)
260{ 260{
@@ -270,7 +270,7 @@ xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst,
270 bte_ret = xp_bte_copy((u64)src, (u64)dst, (u64)cnt, 270 bte_ret = xp_bte_copy((u64)src, (u64)dst, (u64)cnt,
271 (BTE_NORMAL | BTE_WACQUIRE), NULL); 271 (BTE_NORMAL | BTE_WACQUIRE), NULL);
272 if (bte_ret == BTE_SUCCESS) 272 if (bte_ret == BTE_SUCCESS)
273 return xpcSuccess; 273 return xpSuccess;
274 274
275 dev_dbg(xpc_chan, "xp_bte_copy() from partition %d failed, ret=%d\n", 275 dev_dbg(xpc_chan, "xp_bte_copy() from partition %d failed, ret=%d\n",
276 XPC_PARTID(part), bte_ret); 276 XPC_PARTID(part), bte_ret);
@@ -282,7 +282,7 @@ xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst,
282 * Pull the remote per partition specific variables from the specified 282 * Pull the remote per partition specific variables from the specified
283 * partition. 283 * partition.
284 */ 284 */
285enum xpc_retval 285enum xp_retval
286xpc_pull_remote_vars_part(struct xpc_partition *part) 286xpc_pull_remote_vars_part(struct xpc_partition *part)
287{ 287{
288 u8 buffer[L1_CACHE_BYTES * 2]; 288 u8 buffer[L1_CACHE_BYTES * 2];
@@ -290,8 +290,8 @@ xpc_pull_remote_vars_part(struct xpc_partition *part)
290 (struct xpc_vars_part *)L1_CACHE_ALIGN((u64)buffer); 290 (struct xpc_vars_part *)L1_CACHE_ALIGN((u64)buffer);
291 struct xpc_vars_part *pulled_entry; 291 struct xpc_vars_part *pulled_entry;
292 u64 remote_entry_cacheline_pa, remote_entry_pa; 292 u64 remote_entry_cacheline_pa, remote_entry_pa;
293 partid_t partid = XPC_PARTID(part); 293 short partid = XPC_PARTID(part);
294 enum xpc_retval ret; 294 enum xp_retval ret;
295 295
296 /* pull the cacheline that contains the variables we're interested in */ 296 /* pull the cacheline that contains the variables we're interested in */
297 297
@@ -311,7 +311,7 @@ xpc_pull_remote_vars_part(struct xpc_partition *part)
311 ret = xpc_pull_remote_cachelines(part, pulled_entry_cacheline, 311 ret = xpc_pull_remote_cachelines(part, pulled_entry_cacheline,
312 (void *)remote_entry_cacheline_pa, 312 (void *)remote_entry_cacheline_pa,
313 L1_CACHE_BYTES); 313 L1_CACHE_BYTES);
314 if (ret != xpcSuccess) { 314 if (ret != xpSuccess) {
315 dev_dbg(xpc_chan, "failed to pull XPC vars_part from " 315 dev_dbg(xpc_chan, "failed to pull XPC vars_part from "
316 "partition %d, ret=%d\n", partid, ret); 316 "partition %d, ret=%d\n", partid, ret);
317 return ret; 317 return ret;
@@ -326,11 +326,11 @@ xpc_pull_remote_vars_part(struct xpc_partition *part)
326 dev_dbg(xpc_chan, "partition %d's XPC vars_part for " 326 dev_dbg(xpc_chan, "partition %d's XPC vars_part for "
327 "partition %d has bad magic value (=0x%lx)\n", 327 "partition %d has bad magic value (=0x%lx)\n",
328 partid, sn_partition_id, pulled_entry->magic); 328 partid, sn_partition_id, pulled_entry->magic);
329 return xpcBadMagic; 329 return xpBadMagic;
330 } 330 }
331 331
332 /* they've not been initialized yet */ 332 /* they've not been initialized yet */
333 return xpcRetry; 333 return xpRetry;
334 } 334 }
335 335
336 if (xpc_vars_part[partid].magic == XPC_VP_MAGIC1) { 336 if (xpc_vars_part[partid].magic == XPC_VP_MAGIC1) {
@@ -344,7 +344,7 @@ xpc_pull_remote_vars_part(struct xpc_partition *part)
344 dev_err(xpc_chan, "partition %d's XPC vars_part for " 344 dev_err(xpc_chan, "partition %d's XPC vars_part for "
345 "partition %d are not valid\n", partid, 345 "partition %d are not valid\n", partid,
346 sn_partition_id); 346 sn_partition_id);
347 return xpcInvalidAddress; 347 return xpInvalidAddress;
348 } 348 }
349 349
350 /* the variables we imported look to be valid */ 350 /* the variables we imported look to be valid */
@@ -366,9 +366,9 @@ xpc_pull_remote_vars_part(struct xpc_partition *part)
366 } 366 }
367 367
368 if (pulled_entry->magic == XPC_VP_MAGIC1) 368 if (pulled_entry->magic == XPC_VP_MAGIC1)
369 return xpcRetry; 369 return xpRetry;
370 370
371 return xpcSuccess; 371 return xpSuccess;
372} 372}
373 373
374/* 374/*
@@ -379,7 +379,7 @@ xpc_get_IPI_flags(struct xpc_partition *part)
379{ 379{
380 unsigned long irq_flags; 380 unsigned long irq_flags;
381 u64 IPI_amo; 381 u64 IPI_amo;
382 enum xpc_retval ret; 382 enum xp_retval ret;
383 383
384 /* 384 /*
385 * See if there are any IPI flags to be handled. 385 * See if there are any IPI flags to be handled.
@@ -398,7 +398,7 @@ xpc_get_IPI_flags(struct xpc_partition *part)
398 (void *)part-> 398 (void *)part->
399 remote_openclose_args_pa, 399 remote_openclose_args_pa,
400 XPC_OPENCLOSE_ARGS_SIZE); 400 XPC_OPENCLOSE_ARGS_SIZE);
401 if (ret != xpcSuccess) { 401 if (ret != xpSuccess) {
402 XPC_DEACTIVATE_PARTITION(part, ret); 402 XPC_DEACTIVATE_PARTITION(part, ret);
403 403
404 dev_dbg(xpc_chan, "failed to pull openclose args from " 404 dev_dbg(xpc_chan, "failed to pull openclose args from "
@@ -414,7 +414,7 @@ xpc_get_IPI_flags(struct xpc_partition *part)
414 ret = xpc_pull_remote_cachelines(part, part->remote_GPs, 414 ret = xpc_pull_remote_cachelines(part, part->remote_GPs,
415 (void *)part->remote_GPs_pa, 415 (void *)part->remote_GPs_pa,
416 XPC_GP_SIZE); 416 XPC_GP_SIZE);
417 if (ret != xpcSuccess) { 417 if (ret != xpSuccess) {
418 XPC_DEACTIVATE_PARTITION(part, ret); 418 XPC_DEACTIVATE_PARTITION(part, ret);
419 419
420 dev_dbg(xpc_chan, "failed to pull GPs from partition " 420 dev_dbg(xpc_chan, "failed to pull GPs from partition "
@@ -431,7 +431,7 @@ xpc_get_IPI_flags(struct xpc_partition *part)
431/* 431/*
432 * Allocate the local message queue and the notify queue. 432 * Allocate the local message queue and the notify queue.
433 */ 433 */
434static enum xpc_retval 434static enum xp_retval
435xpc_allocate_local_msgqueue(struct xpc_channel *ch) 435xpc_allocate_local_msgqueue(struct xpc_channel *ch)
436{ 436{
437 unsigned long irq_flags; 437 unsigned long irq_flags;
@@ -464,18 +464,18 @@ xpc_allocate_local_msgqueue(struct xpc_channel *ch)
464 ch->local_nentries = nentries; 464 ch->local_nentries = nentries;
465 } 465 }
466 spin_unlock_irqrestore(&ch->lock, irq_flags); 466 spin_unlock_irqrestore(&ch->lock, irq_flags);
467 return xpcSuccess; 467 return xpSuccess;
468 } 468 }
469 469
470 dev_dbg(xpc_chan, "can't get memory for local message queue and notify " 470 dev_dbg(xpc_chan, "can't get memory for local message queue and notify "
471 "queue, partid=%d, channel=%d\n", ch->partid, ch->number); 471 "queue, partid=%d, channel=%d\n", ch->partid, ch->number);
472 return xpcNoMemory; 472 return xpNoMemory;
473} 473}
474 474
475/* 475/*
476 * Allocate the cached remote message queue. 476 * Allocate the cached remote message queue.
477 */ 477 */
478static enum xpc_retval 478static enum xp_retval
479xpc_allocate_remote_msgqueue(struct xpc_channel *ch) 479xpc_allocate_remote_msgqueue(struct xpc_channel *ch)
480{ 480{
481 unsigned long irq_flags; 481 unsigned long irq_flags;
@@ -502,12 +502,12 @@ xpc_allocate_remote_msgqueue(struct xpc_channel *ch)
502 ch->remote_nentries = nentries; 502 ch->remote_nentries = nentries;
503 } 503 }
504 spin_unlock_irqrestore(&ch->lock, irq_flags); 504 spin_unlock_irqrestore(&ch->lock, irq_flags);
505 return xpcSuccess; 505 return xpSuccess;
506 } 506 }
507 507
508 dev_dbg(xpc_chan, "can't get memory for cached remote message queue, " 508 dev_dbg(xpc_chan, "can't get memory for cached remote message queue, "
509 "partid=%d, channel=%d\n", ch->partid, ch->number); 509 "partid=%d, channel=%d\n", ch->partid, ch->number);
510 return xpcNoMemory; 510 return xpNoMemory;
511} 511}
512 512
513/* 513/*
@@ -515,20 +515,20 @@ xpc_allocate_remote_msgqueue(struct xpc_channel *ch)
515 * 515 *
516 * Note: Assumes all of the channel sizes are filled in. 516 * Note: Assumes all of the channel sizes are filled in.
517 */ 517 */
518static enum xpc_retval 518static enum xp_retval
519xpc_allocate_msgqueues(struct xpc_channel *ch) 519xpc_allocate_msgqueues(struct xpc_channel *ch)
520{ 520{
521 unsigned long irq_flags; 521 unsigned long irq_flags;
522 enum xpc_retval ret; 522 enum xp_retval ret;
523 523
524 DBUG_ON(ch->flags & XPC_C_SETUP); 524 DBUG_ON(ch->flags & XPC_C_SETUP);
525 525
526 ret = xpc_allocate_local_msgqueue(ch); 526 ret = xpc_allocate_local_msgqueue(ch);
527 if (ret != xpcSuccess) 527 if (ret != xpSuccess)
528 return ret; 528 return ret;
529 529
530 ret = xpc_allocate_remote_msgqueue(ch); 530 ret = xpc_allocate_remote_msgqueue(ch);
531 if (ret != xpcSuccess) { 531 if (ret != xpSuccess) {
532 kfree(ch->local_msgqueue_base); 532 kfree(ch->local_msgqueue_base);
533 ch->local_msgqueue = NULL; 533 ch->local_msgqueue = NULL;
534 kfree(ch->notify_queue); 534 kfree(ch->notify_queue);
@@ -540,7 +540,7 @@ xpc_allocate_msgqueues(struct xpc_channel *ch)
540 ch->flags |= XPC_C_SETUP; 540 ch->flags |= XPC_C_SETUP;
541 spin_unlock_irqrestore(&ch->lock, irq_flags); 541 spin_unlock_irqrestore(&ch->lock, irq_flags);
542 542
543 return xpcSuccess; 543 return xpSuccess;
544} 544}
545 545
546/* 546/*
@@ -552,7 +552,7 @@ xpc_allocate_msgqueues(struct xpc_channel *ch)
552static void 552static void
553xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags) 553xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
554{ 554{
555 enum xpc_retval ret; 555 enum xp_retval ret;
556 556
557 DBUG_ON(!spin_is_locked(&ch->lock)); 557 DBUG_ON(!spin_is_locked(&ch->lock));
558 558
@@ -568,7 +568,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
568 ret = xpc_allocate_msgqueues(ch); 568 ret = xpc_allocate_msgqueues(ch);
569 spin_lock_irqsave(&ch->lock, *irq_flags); 569 spin_lock_irqsave(&ch->lock, *irq_flags);
570 570
571 if (ret != xpcSuccess) 571 if (ret != xpSuccess)
572 XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags); 572 XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags);
573 573
574 if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING)) 574 if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING))
@@ -603,7 +603,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
603 * Notify those who wanted to be notified upon delivery of their message. 603 * Notify those who wanted to be notified upon delivery of their message.
604 */ 604 */
605static void 605static void
606xpc_notify_senders(struct xpc_channel *ch, enum xpc_retval reason, s64 put) 606xpc_notify_senders(struct xpc_channel *ch, enum xp_retval reason, s64 put)
607{ 607{
608 struct xpc_notify *notify; 608 struct xpc_notify *notify;
609 u8 notify_type; 609 u8 notify_type;
@@ -748,7 +748,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
748 748
749 if (ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE) { 749 if (ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE) {
750 spin_unlock_irqrestore(&ch->lock, *irq_flags); 750 spin_unlock_irqrestore(&ch->lock, *irq_flags);
751 xpc_disconnect_callout(ch, xpcDisconnected); 751 xpc_disconnect_callout(ch, xpDisconnected);
752 spin_lock_irqsave(&ch->lock, *irq_flags); 752 spin_lock_irqsave(&ch->lock, *irq_flags);
753 } 753 }
754 754
@@ -791,7 +791,7 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
791 struct xpc_openclose_args *args = 791 struct xpc_openclose_args *args =
792 &part->remote_openclose_args[ch_number]; 792 &part->remote_openclose_args[ch_number];
793 struct xpc_channel *ch = &part->channels[ch_number]; 793 struct xpc_channel *ch = &part->channels[ch_number];
794 enum xpc_retval reason; 794 enum xp_retval reason;
795 795
796 spin_lock_irqsave(&ch->lock, irq_flags); 796 spin_lock_irqsave(&ch->lock, irq_flags);
797 797
@@ -871,10 +871,10 @@ again:
871 871
872 if (!(ch->flags & XPC_C_DISCONNECTING)) { 872 if (!(ch->flags & XPC_C_DISCONNECTING)) {
873 reason = args->reason; 873 reason = args->reason;
874 if (reason <= xpcSuccess || reason > xpcUnknownReason) 874 if (reason <= xpSuccess || reason > xpUnknownReason)
875 reason = xpcUnknownReason; 875 reason = xpUnknownReason;
876 else if (reason == xpcUnregistering) 876 else if (reason == xpUnregistering)
877 reason = xpcOtherUnregistering; 877 reason = xpOtherUnregistering;
878 878
879 XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags); 879 XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags);
880 880
@@ -961,7 +961,7 @@ again:
961 961
962 if (ch->flags & XPC_C_OPENREQUEST) { 962 if (ch->flags & XPC_C_OPENREQUEST) {
963 if (args->msg_size != ch->msg_size) { 963 if (args->msg_size != ch->msg_size) {
964 XPC_DISCONNECT_CHANNEL(ch, xpcUnequalMsgSizes, 964 XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes,
965 &irq_flags); 965 &irq_flags);
966 spin_unlock_irqrestore(&ch->lock, irq_flags); 966 spin_unlock_irqrestore(&ch->lock, irq_flags);
967 return; 967 return;
@@ -991,7 +991,7 @@ again:
991 return; 991 return;
992 } 992 }
993 if (!(ch->flags & XPC_C_OPENREQUEST)) { 993 if (!(ch->flags & XPC_C_OPENREQUEST)) {
994 XPC_DISCONNECT_CHANNEL(ch, xpcOpenCloseError, 994 XPC_DISCONNECT_CHANNEL(ch, xpOpenCloseError,
995 &irq_flags); 995 &irq_flags);
996 spin_unlock_irqrestore(&ch->lock, irq_flags); 996 spin_unlock_irqrestore(&ch->lock, irq_flags);
997 return; 997 return;
@@ -1042,18 +1042,18 @@ again:
1042/* 1042/*
1043 * Attempt to establish a channel connection to a remote partition. 1043 * Attempt to establish a channel connection to a remote partition.
1044 */ 1044 */
1045static enum xpc_retval 1045static enum xp_retval
1046xpc_connect_channel(struct xpc_channel *ch) 1046xpc_connect_channel(struct xpc_channel *ch)
1047{ 1047{
1048 unsigned long irq_flags; 1048 unsigned long irq_flags;
1049 struct xpc_registration *registration = &xpc_registrations[ch->number]; 1049 struct xpc_registration *registration = &xpc_registrations[ch->number];
1050 1050
1051 if (mutex_trylock(&registration->mutex) == 0) 1051 if (mutex_trylock(&registration->mutex) == 0)
1052 return xpcRetry; 1052 return xpRetry;
1053 1053
1054 if (!XPC_CHANNEL_REGISTERED(ch->number)) { 1054 if (!XPC_CHANNEL_REGISTERED(ch->number)) {
1055 mutex_unlock(&registration->mutex); 1055 mutex_unlock(&registration->mutex);
1056 return xpcUnregistered; 1056 return xpUnregistered;
1057 } 1057 }
1058 1058
1059 spin_lock_irqsave(&ch->lock, irq_flags); 1059 spin_lock_irqsave(&ch->lock, irq_flags);
@@ -1095,10 +1095,10 @@ xpc_connect_channel(struct xpc_channel *ch)
1095 * the channel lock as needed. 1095 * the channel lock as needed.
1096 */ 1096 */
1097 mutex_unlock(&registration->mutex); 1097 mutex_unlock(&registration->mutex);
1098 XPC_DISCONNECT_CHANNEL(ch, xpcUnequalMsgSizes, 1098 XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes,
1099 &irq_flags); 1099 &irq_flags);
1100 spin_unlock_irqrestore(&ch->lock, irq_flags); 1100 spin_unlock_irqrestore(&ch->lock, irq_flags);
1101 return xpcUnequalMsgSizes; 1101 return xpUnequalMsgSizes;
1102 } 1102 }
1103 } else { 1103 } else {
1104 ch->msg_size = registration->msg_size; 1104 ch->msg_size = registration->msg_size;
@@ -1120,7 +1120,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1120 1120
1121 spin_unlock_irqrestore(&ch->lock, irq_flags); 1121 spin_unlock_irqrestore(&ch->lock, irq_flags);
1122 1122
1123 return xpcSuccess; 1123 return xpSuccess;
1124} 1124}
1125 1125
1126/* 1126/*
@@ -1203,7 +1203,7 @@ xpc_process_msg_IPI(struct xpc_partition *part, int ch_number)
1203 * Notify senders that messages sent have been 1203 * Notify senders that messages sent have been
1204 * received and delivered by the other side. 1204 * received and delivered by the other side.
1205 */ 1205 */
1206 xpc_notify_senders(ch, xpcMsgDelivered, 1206 xpc_notify_senders(ch, xpMsgDelivered,
1207 ch->remote_GP.get); 1207 ch->remote_GP.get);
1208 } 1208 }
1209 1209
@@ -1335,7 +1335,7 @@ xpc_process_channel_activity(struct xpc_partition *part)
1335 * at the same time. 1335 * at the same time.
1336 */ 1336 */
1337void 1337void
1338xpc_partition_going_down(struct xpc_partition *part, enum xpc_retval reason) 1338xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason)
1339{ 1339{
1340 unsigned long irq_flags; 1340 unsigned long irq_flags;
1341 int ch_number; 1341 int ch_number;
@@ -1375,7 +1375,7 @@ xpc_partition_going_down(struct xpc_partition *part, enum xpc_retval reason)
1375void 1375void
1376xpc_teardown_infrastructure(struct xpc_partition *part) 1376xpc_teardown_infrastructure(struct xpc_partition *part)
1377{ 1377{
1378 partid_t partid = XPC_PARTID(part); 1378 short partid = XPC_PARTID(part);
1379 1379
1380 /* 1380 /*
1381 * We start off by making this partition inaccessible to local 1381 * We start off by making this partition inaccessible to local
@@ -1428,7 +1428,7 @@ xpc_teardown_infrastructure(struct xpc_partition *part)
1428void 1428void
1429xpc_initiate_connect(int ch_number) 1429xpc_initiate_connect(int ch_number)
1430{ 1430{
1431 partid_t partid; 1431 short partid;
1432 struct xpc_partition *part; 1432 struct xpc_partition *part;
1433 struct xpc_channel *ch; 1433 struct xpc_channel *ch;
1434 1434
@@ -1456,13 +1456,13 @@ xpc_connected_callout(struct xpc_channel *ch)
1456 /* let the registerer know that a connection has been established */ 1456 /* let the registerer know that a connection has been established */
1457 1457
1458 if (ch->func != NULL) { 1458 if (ch->func != NULL) {
1459 dev_dbg(xpc_chan, "ch->func() called, reason=xpcConnected, " 1459 dev_dbg(xpc_chan, "ch->func() called, reason=xpConnected, "
1460 "partid=%d, channel=%d\n", ch->partid, ch->number); 1460 "partid=%d, channel=%d\n", ch->partid, ch->number);
1461 1461
1462 ch->func(xpcConnected, ch->partid, ch->number, 1462 ch->func(xpConnected, ch->partid, ch->number,
1463 (void *)(u64)ch->local_nentries, ch->key); 1463 (void *)(u64)ch->local_nentries, ch->key);
1464 1464
1465 dev_dbg(xpc_chan, "ch->func() returned, reason=xpcConnected, " 1465 dev_dbg(xpc_chan, "ch->func() returned, reason=xpConnected, "
1466 "partid=%d, channel=%d\n", ch->partid, ch->number); 1466 "partid=%d, channel=%d\n", ch->partid, ch->number);
1467 } 1467 }
1468} 1468}
@@ -1484,7 +1484,7 @@ void
1484xpc_initiate_disconnect(int ch_number) 1484xpc_initiate_disconnect(int ch_number)
1485{ 1485{
1486 unsigned long irq_flags; 1486 unsigned long irq_flags;
1487 partid_t partid; 1487 short partid;
1488 struct xpc_partition *part; 1488 struct xpc_partition *part;
1489 struct xpc_channel *ch; 1489 struct xpc_channel *ch;
1490 1490
@@ -1503,7 +1503,7 @@ xpc_initiate_disconnect(int ch_number)
1503 if (!(ch->flags & XPC_C_DISCONNECTED)) { 1503 if (!(ch->flags & XPC_C_DISCONNECTED)) {
1504 ch->flags |= XPC_C_WDISCONNECT; 1504 ch->flags |= XPC_C_WDISCONNECT;
1505 1505
1506 XPC_DISCONNECT_CHANNEL(ch, xpcUnregistering, 1506 XPC_DISCONNECT_CHANNEL(ch, xpUnregistering,
1507 &irq_flags); 1507 &irq_flags);
1508 } 1508 }
1509 1509
@@ -1528,7 +1528,7 @@ xpc_initiate_disconnect(int ch_number)
1528 */ 1528 */
1529void 1529void
1530xpc_disconnect_channel(const int line, struct xpc_channel *ch, 1530xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1531 enum xpc_retval reason, unsigned long *irq_flags) 1531 enum xp_retval reason, unsigned long *irq_flags)
1532{ 1532{
1533 u32 channel_was_connected = (ch->flags & XPC_C_CONNECTED); 1533 u32 channel_was_connected = (ch->flags & XPC_C_CONNECTED);
1534 1534
@@ -1563,7 +1563,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1563 1563
1564 } else if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) && 1564 } else if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
1565 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) { 1565 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) {
1566 /* start a kthread that will do the xpcDisconnecting callout */ 1566 /* start a kthread that will do the xpDisconnecting callout */
1567 xpc_create_kthreads(ch, 1, 1); 1567 xpc_create_kthreads(ch, 1, 1);
1568 } 1568 }
1569 1569
@@ -1575,7 +1575,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1575} 1575}
1576 1576
1577void 1577void
1578xpc_disconnect_callout(struct xpc_channel *ch, enum xpc_retval reason) 1578xpc_disconnect_callout(struct xpc_channel *ch, enum xp_retval reason)
1579{ 1579{
1580 /* 1580 /*
1581 * Let the channel's registerer know that the channel is being 1581 * Let the channel's registerer know that the channel is being
@@ -1598,13 +1598,13 @@ xpc_disconnect_callout(struct xpc_channel *ch, enum xpc_retval reason)
1598 * Wait for a message entry to become available for the specified channel, 1598 * Wait for a message entry to become available for the specified channel,
1599 * but don't wait any longer than 1 jiffy. 1599 * but don't wait any longer than 1 jiffy.
1600 */ 1600 */
1601static enum xpc_retval 1601static enum xp_retval
1602xpc_allocate_msg_wait(struct xpc_channel *ch) 1602xpc_allocate_msg_wait(struct xpc_channel *ch)
1603{ 1603{
1604 enum xpc_retval ret; 1604 enum xp_retval ret;
1605 1605
1606 if (ch->flags & XPC_C_DISCONNECTING) { 1606 if (ch->flags & XPC_C_DISCONNECTING) {
1607 DBUG_ON(ch->reason == xpcInterrupted); 1607 DBUG_ON(ch->reason == xpInterrupted);
1608 return ch->reason; 1608 return ch->reason;
1609 } 1609 }
1610 1610
@@ -1614,11 +1614,11 @@ xpc_allocate_msg_wait(struct xpc_channel *ch)
1614 1614
1615 if (ch->flags & XPC_C_DISCONNECTING) { 1615 if (ch->flags & XPC_C_DISCONNECTING) {
1616 ret = ch->reason; 1616 ret = ch->reason;
1617 DBUG_ON(ch->reason == xpcInterrupted); 1617 DBUG_ON(ch->reason == xpInterrupted);
1618 } else if (ret == 0) { 1618 } else if (ret == 0) {
1619 ret = xpcTimeout; 1619 ret = xpTimeout;
1620 } else { 1620 } else {
1621 ret = xpcInterrupted; 1621 ret = xpInterrupted;
1622 } 1622 }
1623 1623
1624 return ret; 1624 return ret;
@@ -1628,12 +1628,12 @@ xpc_allocate_msg_wait(struct xpc_channel *ch)
1628 * Allocate an entry for a message from the message queue associated with the 1628 * Allocate an entry for a message from the message queue associated with the
1629 * specified channel. 1629 * specified channel.
1630 */ 1630 */
1631static enum xpc_retval 1631static enum xp_retval
1632xpc_allocate_msg(struct xpc_channel *ch, u32 flags, 1632xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1633 struct xpc_msg **address_of_msg) 1633 struct xpc_msg **address_of_msg)
1634{ 1634{
1635 struct xpc_msg *msg; 1635 struct xpc_msg *msg;
1636 enum xpc_retval ret; 1636 enum xp_retval ret;
1637 s64 put; 1637 s64 put;
1638 1638
1639 /* this reference will be dropped in xpc_send_msg() */ 1639 /* this reference will be dropped in xpc_send_msg() */
@@ -1645,7 +1645,7 @@ xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1645 } 1645 }
1646 if (!(ch->flags & XPC_C_CONNECTED)) { 1646 if (!(ch->flags & XPC_C_CONNECTED)) {
1647 xpc_msgqueue_deref(ch); 1647 xpc_msgqueue_deref(ch);
1648 return xpcNotConnected; 1648 return xpNotConnected;
1649 } 1649 }
1650 1650
1651 /* 1651 /*
@@ -1653,7 +1653,7 @@ xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1653 * If none are available, we'll make sure that we grab the latest 1653 * If none are available, we'll make sure that we grab the latest
1654 * GP values. 1654 * GP values.
1655 */ 1655 */
1656 ret = xpcTimeout; 1656 ret = xpTimeout;
1657 1657
1658 while (1) { 1658 while (1) {
1659 1659
@@ -1683,16 +1683,16 @@ xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1683 * that will cause the IPI handler to fetch the latest 1683 * that will cause the IPI handler to fetch the latest
1684 * GP values as if an IPI was sent by the other side. 1684 * GP values as if an IPI was sent by the other side.
1685 */ 1685 */
1686 if (ret == xpcTimeout) 1686 if (ret == xpTimeout)
1687 xpc_IPI_send_local_msgrequest(ch); 1687 xpc_IPI_send_local_msgrequest(ch);
1688 1688
1689 if (flags & XPC_NOWAIT) { 1689 if (flags & XPC_NOWAIT) {
1690 xpc_msgqueue_deref(ch); 1690 xpc_msgqueue_deref(ch);
1691 return xpcNoWait; 1691 return xpNoWait;
1692 } 1692 }
1693 1693
1694 ret = xpc_allocate_msg_wait(ch); 1694 ret = xpc_allocate_msg_wait(ch);
1695 if (ret != xpcInterrupted && ret != xpcTimeout) { 1695 if (ret != xpInterrupted && ret != xpTimeout) {
1696 xpc_msgqueue_deref(ch); 1696 xpc_msgqueue_deref(ch);
1697 return ret; 1697 return ret;
1698 } 1698 }
@@ -1711,7 +1711,7 @@ xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1711 1711
1712 *address_of_msg = msg; 1712 *address_of_msg = msg;
1713 1713
1714 return xpcSuccess; 1714 return xpSuccess;
1715} 1715}
1716 1716
1717/* 1717/*
@@ -1727,11 +1727,11 @@ xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1727 * payload - address of the allocated payload area pointer (filled in on 1727 * payload - address of the allocated payload area pointer (filled in on
1728 * return) in which the user-defined message is constructed. 1728 * return) in which the user-defined message is constructed.
1729 */ 1729 */
1730enum xpc_retval 1730enum xp_retval
1731xpc_initiate_allocate(partid_t partid, int ch_number, u32 flags, void **payload) 1731xpc_initiate_allocate(short partid, int ch_number, u32 flags, void **payload)
1732{ 1732{
1733 struct xpc_partition *part = &xpc_partitions[partid]; 1733 struct xpc_partition *part = &xpc_partitions[partid];
1734 enum xpc_retval ret = xpcUnknownReason; 1734 enum xp_retval ret = xpUnknownReason;
1735 struct xpc_msg *msg = NULL; 1735 struct xpc_msg *msg = NULL;
1736 1736
1737 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 1737 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
@@ -1814,11 +1814,11 @@ xpc_send_msgs(struct xpc_channel *ch, s64 initial_put)
1814 * local message queue's Put value and sends an IPI to the partition the 1814 * local message queue's Put value and sends an IPI to the partition the
1815 * message is being sent to. 1815 * message is being sent to.
1816 */ 1816 */
1817static enum xpc_retval 1817static enum xp_retval
1818xpc_send_msg(struct xpc_channel *ch, struct xpc_msg *msg, u8 notify_type, 1818xpc_send_msg(struct xpc_channel *ch, struct xpc_msg *msg, u8 notify_type,
1819 xpc_notify_func func, void *key) 1819 xpc_notify_func func, void *key)
1820{ 1820{
1821 enum xpc_retval ret = xpcSuccess; 1821 enum xp_retval ret = xpSuccess;
1822 struct xpc_notify *notify = notify; 1822 struct xpc_notify *notify = notify;
1823 s64 put, msg_number = msg->number; 1823 s64 put, msg_number = msg->number;
1824 1824
@@ -1908,12 +1908,12 @@ xpc_send_msg(struct xpc_channel *ch, struct xpc_msg *msg, u8 notify_type,
1908 * payload - pointer to the payload area allocated via 1908 * payload - pointer to the payload area allocated via
1909 * xpc_initiate_allocate(). 1909 * xpc_initiate_allocate().
1910 */ 1910 */
1911enum xpc_retval 1911enum xp_retval
1912xpc_initiate_send(partid_t partid, int ch_number, void *payload) 1912xpc_initiate_send(short partid, int ch_number, void *payload)
1913{ 1913{
1914 struct xpc_partition *part = &xpc_partitions[partid]; 1914 struct xpc_partition *part = &xpc_partitions[partid];
1915 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload); 1915 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
1916 enum xpc_retval ret; 1916 enum xp_retval ret;
1917 1917
1918 dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg, 1918 dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg,
1919 partid, ch_number); 1919 partid, ch_number);
@@ -1957,13 +1957,13 @@ xpc_initiate_send(partid_t partid, int ch_number, void *payload)
1957 * receipt. THIS FUNCTION MUST BE NON-BLOCKING. 1957 * receipt. THIS FUNCTION MUST BE NON-BLOCKING.
1958 * key - user-defined key to be passed to the function when it's called. 1958 * key - user-defined key to be passed to the function when it's called.
1959 */ 1959 */
1960enum xpc_retval 1960enum xp_retval
1961xpc_initiate_send_notify(partid_t partid, int ch_number, void *payload, 1961xpc_initiate_send_notify(short partid, int ch_number, void *payload,
1962 xpc_notify_func func, void *key) 1962 xpc_notify_func func, void *key)
1963{ 1963{
1964 struct xpc_partition *part = &xpc_partitions[partid]; 1964 struct xpc_partition *part = &xpc_partitions[partid];
1965 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload); 1965 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
1966 enum xpc_retval ret; 1966 enum xp_retval ret;
1967 1967
1968 dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg, 1968 dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg,
1969 partid, ch_number); 1969 partid, ch_number);
@@ -1985,7 +1985,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
1985 struct xpc_msg *remote_msg, *msg; 1985 struct xpc_msg *remote_msg, *msg;
1986 u32 msg_index, nmsgs; 1986 u32 msg_index, nmsgs;
1987 u64 msg_offset; 1987 u64 msg_offset;
1988 enum xpc_retval ret; 1988 enum xp_retval ret;
1989 1989
1990 if (mutex_lock_interruptible(&ch->msg_to_pull_mutex) != 0) { 1990 if (mutex_lock_interruptible(&ch->msg_to_pull_mutex) != 0) {
1991 /* we were interrupted by a signal */ 1991 /* we were interrupted by a signal */
@@ -2012,7 +2012,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
2012 2012
2013 ret = xpc_pull_remote_cachelines(part, msg, remote_msg, 2013 ret = xpc_pull_remote_cachelines(part, msg, remote_msg,
2014 nmsgs * ch->msg_size); 2014 nmsgs * ch->msg_size);
2015 if (ret != xpcSuccess) { 2015 if (ret != xpSuccess) {
2016 2016
2017 dev_dbg(xpc_chan, "failed to pull %d msgs starting with" 2017 dev_dbg(xpc_chan, "failed to pull %d msgs starting with"
2018 " msg %ld from partition %d, channel=%d, " 2018 " msg %ld from partition %d, channel=%d, "
@@ -2112,7 +2112,7 @@ xpc_deliver_msg(struct xpc_channel *ch)
2112 ch->number); 2112 ch->number);
2113 2113
2114 /* deliver the message to its intended recipient */ 2114 /* deliver the message to its intended recipient */
2115 ch->func(xpcMsgReceived, ch->partid, ch->number, 2115 ch->func(xpMsgReceived, ch->partid, ch->number,
2116 &msg->payload, ch->key); 2116 &msg->payload, ch->key);
2117 2117
2118 dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, " 2118 dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, "
@@ -2203,7 +2203,7 @@ xpc_acknowledge_msgs(struct xpc_channel *ch, s64 initial_get, u8 msg_flags)
2203 * xpc_initiate_allocate(). 2203 * xpc_initiate_allocate().
2204 */ 2204 */
2205void 2205void
2206xpc_initiate_received(partid_t partid, int ch_number, void *payload) 2206xpc_initiate_received(short partid, int ch_number, void *payload)
2207{ 2207{
2208 struct xpc_partition *part = &xpc_partitions[partid]; 2208 struct xpc_partition *part = &xpc_partitions[partid];
2209 struct xpc_channel *ch; 2209 struct xpc_channel *ch;
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index f673ba90eb0e..08256ed0d9a6 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -315,13 +315,13 @@ xpc_initiate_discovery(void *ignore)
315 * the XPC per partition variables from the remote partition and waiting for 315 * the XPC per partition variables from the remote partition and waiting for
316 * the remote partition to pull ours. 316 * the remote partition to pull ours.
317 */ 317 */
318static enum xpc_retval 318static enum xp_retval
319xpc_make_first_contact(struct xpc_partition *part) 319xpc_make_first_contact(struct xpc_partition *part)
320{ 320{
321 enum xpc_retval ret; 321 enum xp_retval ret;
322 322
323 while ((ret = xpc_pull_remote_vars_part(part)) != xpcSuccess) { 323 while ((ret = xpc_pull_remote_vars_part(part)) != xpSuccess) {
324 if (ret != xpcRetry) { 324 if (ret != xpRetry) {
325 XPC_DEACTIVATE_PARTITION(part, ret); 325 XPC_DEACTIVATE_PARTITION(part, ret);
326 return ret; 326 return ret;
327 } 327 }
@@ -406,7 +406,7 @@ xpc_partition_up(struct xpc_partition *part)
406 406
407 dev_dbg(xpc_chan, "activating partition %d\n", XPC_PARTID(part)); 407 dev_dbg(xpc_chan, "activating partition %d\n", XPC_PARTID(part));
408 408
409 if (xpc_setup_infrastructure(part) != xpcSuccess) 409 if (xpc_setup_infrastructure(part) != xpSuccess)
410 return; 410 return;
411 411
412 /* 412 /*
@@ -418,7 +418,7 @@ xpc_partition_up(struct xpc_partition *part)
418 418
419 (void)xpc_part_ref(part); /* this will always succeed */ 419 (void)xpc_part_ref(part); /* this will always succeed */
420 420
421 if (xpc_make_first_contact(part) == xpcSuccess) 421 if (xpc_make_first_contact(part) == xpSuccess)
422 xpc_channel_mgr(part); 422 xpc_channel_mgr(part);
423 423
424 xpc_part_deref(part); 424 xpc_part_deref(part);
@@ -429,7 +429,7 @@ xpc_partition_up(struct xpc_partition *part)
429static int 429static int
430xpc_activating(void *__partid) 430xpc_activating(void *__partid)
431{ 431{
432 partid_t partid = (u64)__partid; 432 short partid = (u64)__partid;
433 struct xpc_partition *part = &xpc_partitions[partid]; 433 struct xpc_partition *part = &xpc_partitions[partid];
434 unsigned long irq_flags; 434 unsigned long irq_flags;
435 435
@@ -470,7 +470,7 @@ xpc_activating(void *__partid)
470 470
471 spin_lock_irqsave(&part->act_lock, irq_flags); 471 spin_lock_irqsave(&part->act_lock, irq_flags);
472 part->act_state = XPC_P_INACTIVE; 472 part->act_state = XPC_P_INACTIVE;
473 XPC_SET_REASON(part, xpcPhysAddrRegFailed, __LINE__); 473 XPC_SET_REASON(part, xpPhysAddrRegFailed, __LINE__);
474 spin_unlock_irqrestore(&part->act_lock, irq_flags); 474 spin_unlock_irqrestore(&part->act_lock, irq_flags);
475 part->remote_rp_pa = 0; 475 part->remote_rp_pa = 0;
476 return 0; 476 return 0;
@@ -488,7 +488,7 @@ xpc_activating(void *__partid)
488 xpc_disallow_hb(partid, xpc_vars); 488 xpc_disallow_hb(partid, xpc_vars);
489 xpc_mark_partition_inactive(part); 489 xpc_mark_partition_inactive(part);
490 490
491 if (part->reason == xpcReactivating) { 491 if (part->reason == xpReactivating) {
492 /* interrupting ourselves results in activating partition */ 492 /* interrupting ourselves results in activating partition */
493 xpc_IPI_send_reactivate(part); 493 xpc_IPI_send_reactivate(part);
494 } 494 }
@@ -499,7 +499,7 @@ xpc_activating(void *__partid)
499void 499void
500xpc_activate_partition(struct xpc_partition *part) 500xpc_activate_partition(struct xpc_partition *part)
501{ 501{
502 partid_t partid = XPC_PARTID(part); 502 short partid = XPC_PARTID(part);
503 unsigned long irq_flags; 503 unsigned long irq_flags;
504 struct task_struct *kthread; 504 struct task_struct *kthread;
505 505
@@ -508,7 +508,7 @@ xpc_activate_partition(struct xpc_partition *part)
508 DBUG_ON(part->act_state != XPC_P_INACTIVE); 508 DBUG_ON(part->act_state != XPC_P_INACTIVE);
509 509
510 part->act_state = XPC_P_ACTIVATION_REQ; 510 part->act_state = XPC_P_ACTIVATION_REQ;
511 XPC_SET_REASON(part, xpcCloneKThread, __LINE__); 511 XPC_SET_REASON(part, xpCloneKThread, __LINE__);
512 512
513 spin_unlock_irqrestore(&part->act_lock, irq_flags); 513 spin_unlock_irqrestore(&part->act_lock, irq_flags);
514 514
@@ -517,7 +517,7 @@ xpc_activate_partition(struct xpc_partition *part)
517 if (IS_ERR(kthread)) { 517 if (IS_ERR(kthread)) {
518 spin_lock_irqsave(&part->act_lock, irq_flags); 518 spin_lock_irqsave(&part->act_lock, irq_flags);
519 part->act_state = XPC_P_INACTIVE; 519 part->act_state = XPC_P_INACTIVE;
520 XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__); 520 XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__);
521 spin_unlock_irqrestore(&part->act_lock, irq_flags); 521 spin_unlock_irqrestore(&part->act_lock, irq_flags);
522 } 522 }
523} 523}
@@ -541,7 +541,7 @@ xpc_activate_partition(struct xpc_partition *part)
541irqreturn_t 541irqreturn_t
542xpc_notify_IRQ_handler(int irq, void *dev_id) 542xpc_notify_IRQ_handler(int irq, void *dev_id)
543{ 543{
544 partid_t partid = (partid_t) (u64)dev_id; 544 short partid = (short)(u64)dev_id;
545 struct xpc_partition *part = &xpc_partitions[partid]; 545 struct xpc_partition *part = &xpc_partitions[partid];
546 546
547 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 547 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
@@ -643,7 +643,7 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
643static int 643static int
644xpc_kthread_start(void *args) 644xpc_kthread_start(void *args)
645{ 645{
646 partid_t partid = XPC_UNPACK_ARG1(args); 646 short partid = XPC_UNPACK_ARG1(args);
647 u16 ch_number = XPC_UNPACK_ARG2(args); 647 u16 ch_number = XPC_UNPACK_ARG2(args);
648 struct xpc_partition *part = &xpc_partitions[partid]; 648 struct xpc_partition *part = &xpc_partitions[partid];
649 struct xpc_channel *ch; 649 struct xpc_channel *ch;
@@ -696,7 +696,7 @@ xpc_kthread_start(void *args)
696 ch->flags |= XPC_C_DISCONNECTINGCALLOUT; 696 ch->flags |= XPC_C_DISCONNECTINGCALLOUT;
697 spin_unlock_irqrestore(&ch->lock, irq_flags); 697 spin_unlock_irqrestore(&ch->lock, irq_flags);
698 698
699 xpc_disconnect_callout(ch, xpcDisconnecting); 699 xpc_disconnect_callout(ch, xpDisconnecting);
700 700
701 spin_lock_irqsave(&ch->lock, irq_flags); 701 spin_lock_irqsave(&ch->lock, irq_flags);
702 ch->flags |= XPC_C_DISCONNECTINGCALLOUT_MADE; 702 ch->flags |= XPC_C_DISCONNECTINGCALLOUT_MADE;
@@ -776,7 +776,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
776 * then we'll deadlock if all other kthreads assigned 776 * then we'll deadlock if all other kthreads assigned
777 * to this channel are blocked in the channel's 777 * to this channel are blocked in the channel's
778 * registerer, because the only thing that will unblock 778 * registerer, because the only thing that will unblock
779 * them is the xpcDisconnecting callout that this 779 * them is the xpDisconnecting callout that this
780 * failed kthread_run() would have made. 780 * failed kthread_run() would have made.
781 */ 781 */
782 782
@@ -796,7 +796,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
796 * to function. 796 * to function.
797 */ 797 */
798 spin_lock_irqsave(&ch->lock, irq_flags); 798 spin_lock_irqsave(&ch->lock, irq_flags);
799 XPC_DISCONNECT_CHANNEL(ch, xpcLackOfResources, 799 XPC_DISCONNECT_CHANNEL(ch, xpLackOfResources,
800 &irq_flags); 800 &irq_flags);
801 spin_unlock_irqrestore(&ch->lock, irq_flags); 801 spin_unlock_irqrestore(&ch->lock, irq_flags);
802 } 802 }
@@ -809,7 +809,7 @@ void
809xpc_disconnect_wait(int ch_number) 809xpc_disconnect_wait(int ch_number)
810{ 810{
811 unsigned long irq_flags; 811 unsigned long irq_flags;
812 partid_t partid; 812 short partid;
813 struct xpc_partition *part; 813 struct xpc_partition *part;
814 struct xpc_channel *ch; 814 struct xpc_channel *ch;
815 int wakeup_channel_mgr; 815 int wakeup_channel_mgr;
@@ -857,9 +857,9 @@ xpc_disconnect_wait(int ch_number)
857} 857}
858 858
859static void 859static void
860xpc_do_exit(enum xpc_retval reason) 860xpc_do_exit(enum xp_retval reason)
861{ 861{
862 partid_t partid; 862 short partid;
863 int active_part_count, printed_waiting_msg = 0; 863 int active_part_count, printed_waiting_msg = 0;
864 struct xpc_partition *part; 864 struct xpc_partition *part;
865 unsigned long printmsg_time, disengage_request_timeout = 0; 865 unsigned long printmsg_time, disengage_request_timeout = 0;
@@ -955,7 +955,7 @@ xpc_do_exit(enum xpc_retval reason)
955 del_timer_sync(&xpc_hb_timer); 955 del_timer_sync(&xpc_hb_timer);
956 DBUG_ON(xpc_vars->heartbeating_to_mask != 0); 956 DBUG_ON(xpc_vars->heartbeating_to_mask != 0);
957 957
958 if (reason == xpcUnloading) { 958 if (reason == xpUnloading) {
959 /* take ourselves off of the reboot_notifier_list */ 959 /* take ourselves off of the reboot_notifier_list */
960 (void)unregister_reboot_notifier(&xpc_reboot_notifier); 960 (void)unregister_reboot_notifier(&xpc_reboot_notifier);
961 961
@@ -981,20 +981,20 @@ xpc_do_exit(enum xpc_retval reason)
981static int 981static int
982xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused) 982xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
983{ 983{
984 enum xpc_retval reason; 984 enum xp_retval reason;
985 985
986 switch (event) { 986 switch (event) {
987 case SYS_RESTART: 987 case SYS_RESTART:
988 reason = xpcSystemReboot; 988 reason = xpSystemReboot;
989 break; 989 break;
990 case SYS_HALT: 990 case SYS_HALT:
991 reason = xpcSystemHalt; 991 reason = xpSystemHalt;
992 break; 992 break;
993 case SYS_POWER_OFF: 993 case SYS_POWER_OFF:
994 reason = xpcSystemPoweroff; 994 reason = xpSystemPoweroff;
995 break; 995 break;
996 default: 996 default:
997 reason = xpcSystemGoingDown; 997 reason = xpSystemGoingDown;
998 } 998 }
999 999
1000 xpc_do_exit(reason); 1000 xpc_do_exit(reason);
@@ -1008,7 +1008,7 @@ static void
1008xpc_die_disengage(void) 1008xpc_die_disengage(void)
1009{ 1009{
1010 struct xpc_partition *part; 1010 struct xpc_partition *part;
1011 partid_t partid; 1011 short partid;
1012 unsigned long engaged; 1012 unsigned long engaged;
1013 long time, printmsg_time, disengage_request_timeout; 1013 long time, printmsg_time, disengage_request_timeout;
1014 1014
@@ -1124,7 +1124,7 @@ int __init
1124xpc_init(void) 1124xpc_init(void)
1125{ 1125{
1126 int ret; 1126 int ret;
1127 partid_t partid; 1127 short partid;
1128 struct xpc_partition *part; 1128 struct xpc_partition *part;
1129 struct task_struct *kthread; 1129 struct task_struct *kthread;
1130 size_t buf_size; 1130 size_t buf_size;
@@ -1279,7 +1279,7 @@ xpc_init(void)
1279 /* mark this new thread as a non-starter */ 1279 /* mark this new thread as a non-starter */
1280 complete(&xpc_discovery_exited); 1280 complete(&xpc_discovery_exited);
1281 1281
1282 xpc_do_exit(xpcUnloading); 1282 xpc_do_exit(xpUnloading);
1283 return -EBUSY; 1283 return -EBUSY;
1284 } 1284 }
1285 1285
@@ -1297,7 +1297,7 @@ module_init(xpc_init);
1297void __exit 1297void __exit
1298xpc_exit(void) 1298xpc_exit(void)
1299{ 1299{
1300 xpc_do_exit(xpcUnloading); 1300 xpc_do_exit(xpUnloading);
1301} 1301}
1302 1302
1303module_exit(xpc_exit); 1303module_exit(xpc_exit);
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index acd3fd4285d7..7dd4b5812c42 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -403,7 +403,7 @@ xpc_check_remote_hb(void)
403{ 403{
404 struct xpc_vars *remote_vars; 404 struct xpc_vars *remote_vars;
405 struct xpc_partition *part; 405 struct xpc_partition *part;
406 partid_t partid; 406 short partid;
407 bte_result_t bres; 407 bte_result_t bres;
408 408
409 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; 409 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
@@ -444,7 +444,7 @@ xpc_check_remote_hb(void)
444 (remote_vars->heartbeat_offline == 0)) || 444 (remote_vars->heartbeat_offline == 0)) ||
445 !xpc_hb_allowed(sn_partition_id, remote_vars)) { 445 !xpc_hb_allowed(sn_partition_id, remote_vars)) {
446 446
447 XPC_DEACTIVATE_PARTITION(part, xpcNoHeartbeat); 447 XPC_DEACTIVATE_PARTITION(part, xpNoHeartbeat);
448 continue; 448 continue;
449 } 449 }
450 450
@@ -459,7 +459,7 @@ xpc_check_remote_hb(void)
459 * is large enough to contain a copy of their reserved page header and 459 * is large enough to contain a copy of their reserved page header and
460 * part_nasids mask. 460 * part_nasids mask.
461 */ 461 */
462static enum xpc_retval 462static enum xp_retval
463xpc_get_remote_rp(int nasid, u64 *discovered_nasids, 463xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
464 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) 464 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
465{ 465{
@@ -469,7 +469,7 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
469 469
470 *remote_rp_pa = xpc_get_rsvd_page_pa(nasid); 470 *remote_rp_pa = xpc_get_rsvd_page_pa(nasid);
471 if (*remote_rp_pa == 0) 471 if (*remote_rp_pa == 0)
472 return xpcNoRsvdPageAddr; 472 return xpNoRsvdPageAddr;
473 473
474 /* pull over the reserved page header and part_nasids mask */ 474 /* pull over the reserved page header and part_nasids mask */
475 bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp, 475 bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp,
@@ -489,18 +489,18 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
489 489
490 if (remote_rp->partid < 1 || 490 if (remote_rp->partid < 1 ||
491 remote_rp->partid > (XP_MAX_PARTITIONS - 1)) { 491 remote_rp->partid > (XP_MAX_PARTITIONS - 1)) {
492 return xpcInvalidPartid; 492 return xpInvalidPartid;
493 } 493 }
494 494
495 if (remote_rp->partid == sn_partition_id) 495 if (remote_rp->partid == sn_partition_id)
496 return xpcLocalPartid; 496 return xpLocalPartid;
497 497
498 if (XPC_VERSION_MAJOR(remote_rp->version) != 498 if (XPC_VERSION_MAJOR(remote_rp->version) !=
499 XPC_VERSION_MAJOR(XPC_RP_VERSION)) { 499 XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
500 return xpcBadVersion; 500 return xpBadVersion;
501 } 501 }
502 502
503 return xpcSuccess; 503 return xpSuccess;
504} 504}
505 505
506/* 506/*
@@ -509,13 +509,13 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
509 * remote_vars points to a buffer that is cacheline aligned for BTE copies and 509 * remote_vars points to a buffer that is cacheline aligned for BTE copies and
510 * assumed to be of size XPC_RP_VARS_SIZE. 510 * assumed to be of size XPC_RP_VARS_SIZE.
511 */ 511 */
512static enum xpc_retval 512static enum xp_retval
513xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) 513xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
514{ 514{
515 int bres; 515 int bres;
516 516
517 if (remote_vars_pa == 0) 517 if (remote_vars_pa == 0)
518 return xpcVarsNotSet; 518 return xpVarsNotSet;
519 519
520 /* pull over the cross partition variables */ 520 /* pull over the cross partition variables */
521 bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE, 521 bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE,
@@ -525,10 +525,10 @@ xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
525 525
526 if (XPC_VERSION_MAJOR(remote_vars->version) != 526 if (XPC_VERSION_MAJOR(remote_vars->version) !=
527 XPC_VERSION_MAJOR(XPC_V_VERSION)) { 527 XPC_VERSION_MAJOR(XPC_V_VERSION)) {
528 return xpcBadVersion; 528 return xpBadVersion;
529 } 529 }
530 530
531 return xpcSuccess; 531 return xpSuccess;
532} 532}
533 533
534/* 534/*
@@ -604,16 +604,16 @@ xpc_identify_act_IRQ_req(int nasid)
604 int reactivate = 0; 604 int reactivate = 0;
605 int stamp_diff; 605 int stamp_diff;
606 struct timespec remote_rp_stamp = { 0, 0 }; 606 struct timespec remote_rp_stamp = { 0, 0 };
607 partid_t partid; 607 short partid;
608 struct xpc_partition *part; 608 struct xpc_partition *part;
609 enum xpc_retval ret; 609 enum xp_retval ret;
610 610
611 /* pull over the reserved page structure */ 611 /* pull over the reserved page structure */
612 612
613 remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer; 613 remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer;
614 614
615 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa); 615 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
616 if (ret != xpcSuccess) { 616 if (ret != xpSuccess) {
617 dev_warn(xpc_part, "unable to get reserved page from nasid %d, " 617 dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
618 "which sent interrupt, reason=%d\n", nasid, ret); 618 "which sent interrupt, reason=%d\n", nasid, ret);
619 return; 619 return;
@@ -632,7 +632,7 @@ xpc_identify_act_IRQ_req(int nasid)
632 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; 632 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
633 633
634 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars); 634 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
635 if (ret != xpcSuccess) { 635 if (ret != xpSuccess) {
636 636
637 dev_warn(xpc_part, "unable to get XPC variables from nasid %d, " 637 dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
638 "which sent interrupt, reason=%d\n", nasid, ret); 638 "which sent interrupt, reason=%d\n", nasid, ret);
@@ -699,7 +699,7 @@ xpc_identify_act_IRQ_req(int nasid)
699 &remote_rp_stamp, remote_rp_pa, 699 &remote_rp_stamp, remote_rp_pa,
700 remote_vars_pa, remote_vars); 700 remote_vars_pa, remote_vars);
701 part->reactivate_nasid = nasid; 701 part->reactivate_nasid = nasid;
702 XPC_DEACTIVATE_PARTITION(part, xpcReactivating); 702 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
703 return; 703 return;
704 } 704 }
705 705
@@ -754,11 +754,11 @@ xpc_identify_act_IRQ_req(int nasid)
754 754
755 if (reactivate) { 755 if (reactivate) {
756 part->reactivate_nasid = nasid; 756 part->reactivate_nasid = nasid;
757 XPC_DEACTIVATE_PARTITION(part, xpcReactivating); 757 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
758 758
759 } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) && 759 } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) &&
760 xpc_partition_disengage_requested(1UL << partid)) { 760 xpc_partition_disengage_requested(1UL << partid)) {
761 XPC_DEACTIVATE_PARTITION(part, xpcOtherGoingDown); 761 XPC_DEACTIVATE_PARTITION(part, xpOtherGoingDown);
762 } 762 }
763} 763}
764 764
@@ -825,7 +825,7 @@ xpc_identify_act_IRQ_sender(void)
825int 825int
826xpc_partition_disengaged(struct xpc_partition *part) 826xpc_partition_disengaged(struct xpc_partition *part)
827{ 827{
828 partid_t partid = XPC_PARTID(part); 828 short partid = XPC_PARTID(part);
829 int disengaged; 829 int disengaged;
830 830
831 disengaged = (xpc_partition_engaged(1UL << partid) == 0); 831 disengaged = (xpc_partition_engaged(1UL << partid) == 0);
@@ -870,20 +870,20 @@ xpc_partition_disengaged(struct xpc_partition *part)
870/* 870/*
871 * Mark specified partition as active. 871 * Mark specified partition as active.
872 */ 872 */
873enum xpc_retval 873enum xp_retval
874xpc_mark_partition_active(struct xpc_partition *part) 874xpc_mark_partition_active(struct xpc_partition *part)
875{ 875{
876 unsigned long irq_flags; 876 unsigned long irq_flags;
877 enum xpc_retval ret; 877 enum xp_retval ret;
878 878
879 dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part)); 879 dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part));
880 880
881 spin_lock_irqsave(&part->act_lock, irq_flags); 881 spin_lock_irqsave(&part->act_lock, irq_flags);
882 if (part->act_state == XPC_P_ACTIVATING) { 882 if (part->act_state == XPC_P_ACTIVATING) {
883 part->act_state = XPC_P_ACTIVE; 883 part->act_state = XPC_P_ACTIVE;
884 ret = xpcSuccess; 884 ret = xpSuccess;
885 } else { 885 } else {
886 DBUG_ON(part->reason == xpcSuccess); 886 DBUG_ON(part->reason == xpSuccess);
887 ret = part->reason; 887 ret = part->reason;
888 } 888 }
889 spin_unlock_irqrestore(&part->act_lock, irq_flags); 889 spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -896,7 +896,7 @@ xpc_mark_partition_active(struct xpc_partition *part)
896 */ 896 */
897void 897void
898xpc_deactivate_partition(const int line, struct xpc_partition *part, 898xpc_deactivate_partition(const int line, struct xpc_partition *part,
899 enum xpc_retval reason) 899 enum xp_retval reason)
900{ 900{
901 unsigned long irq_flags; 901 unsigned long irq_flags;
902 902
@@ -905,15 +905,15 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
905 if (part->act_state == XPC_P_INACTIVE) { 905 if (part->act_state == XPC_P_INACTIVE) {
906 XPC_SET_REASON(part, reason, line); 906 XPC_SET_REASON(part, reason, line);
907 spin_unlock_irqrestore(&part->act_lock, irq_flags); 907 spin_unlock_irqrestore(&part->act_lock, irq_flags);
908 if (reason == xpcReactivating) { 908 if (reason == xpReactivating) {
909 /* we interrupt ourselves to reactivate partition */ 909 /* we interrupt ourselves to reactivate partition */
910 xpc_IPI_send_reactivate(part); 910 xpc_IPI_send_reactivate(part);
911 } 911 }
912 return; 912 return;
913 } 913 }
914 if (part->act_state == XPC_P_DEACTIVATING) { 914 if (part->act_state == XPC_P_DEACTIVATING) {
915 if ((part->reason == xpcUnloading && reason != xpcUnloading) || 915 if ((part->reason == xpUnloading && reason != xpUnloading) ||
916 reason == xpcReactivating) { 916 reason == xpReactivating) {
917 XPC_SET_REASON(part, reason, line); 917 XPC_SET_REASON(part, reason, line);
918 } 918 }
919 spin_unlock_irqrestore(&part->act_lock, irq_flags); 919 spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -982,10 +982,10 @@ xpc_discovery(void)
982 int max_regions; 982 int max_regions;
983 int nasid; 983 int nasid;
984 struct xpc_rsvd_page *rp; 984 struct xpc_rsvd_page *rp;
985 partid_t partid; 985 short partid;
986 struct xpc_partition *part; 986 struct xpc_partition *part;
987 u64 *discovered_nasids; 987 u64 *discovered_nasids;
988 enum xpc_retval ret; 988 enum xp_retval ret;
989 989
990 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE + 990 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
991 xp_nasid_mask_bytes, 991 xp_nasid_mask_bytes,
@@ -1063,12 +1063,12 @@ xpc_discovery(void)
1063 1063
1064 ret = xpc_get_remote_rp(nasid, discovered_nasids, 1064 ret = xpc_get_remote_rp(nasid, discovered_nasids,
1065 remote_rp, &remote_rp_pa); 1065 remote_rp, &remote_rp_pa);
1066 if (ret != xpcSuccess) { 1066 if (ret != xpSuccess) {
1067 dev_dbg(xpc_part, "unable to get reserved page " 1067 dev_dbg(xpc_part, "unable to get reserved page "
1068 "from nasid %d, reason=%d\n", nasid, 1068 "from nasid %d, reason=%d\n", nasid,
1069 ret); 1069 ret);
1070 1070
1071 if (ret == xpcLocalPartid) 1071 if (ret == xpLocalPartid)
1072 break; 1072 break;
1073 1073
1074 continue; 1074 continue;
@@ -1082,7 +1082,7 @@ xpc_discovery(void)
1082 /* pull over the cross partition variables */ 1082 /* pull over the cross partition variables */
1083 1083
1084 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars); 1084 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
1085 if (ret != xpcSuccess) { 1085 if (ret != xpSuccess) {
1086 dev_dbg(xpc_part, "unable to get XPC variables " 1086 dev_dbg(xpc_part, "unable to get XPC variables "
1087 "from nasid %d, reason=%d\n", nasid, 1087 "from nasid %d, reason=%d\n", nasid,
1088 ret); 1088 ret);
@@ -1116,7 +1116,7 @@ xpc_discovery(void)
1116 "register xp_addr region 0x%016lx\n", 1116 "register xp_addr region 0x%016lx\n",
1117 partid, remote_vars->amos_page_pa); 1117 partid, remote_vars->amos_page_pa);
1118 1118
1119 XPC_SET_REASON(part, xpcPhysAddrRegFailed, 1119 XPC_SET_REASON(part, xpPhysAddrRegFailed,
1120 __LINE__); 1120 __LINE__);
1121 break; 1121 break;
1122 } 1122 }
@@ -1151,8 +1151,8 @@ xpc_discovery(void)
1151 * Given a partid, get the nasids owned by that partition from the 1151 * Given a partid, get the nasids owned by that partition from the
1152 * remote partition's reserved page. 1152 * remote partition's reserved page.
1153 */ 1153 */
1154enum xpc_retval 1154enum xp_retval
1155xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask) 1155xpc_initiate_partid_to_nasids(short partid, void *nasid_mask)
1156{ 1156{
1157 struct xpc_partition *part; 1157 struct xpc_partition *part;
1158 u64 part_nasid_pa; 1158 u64 part_nasid_pa;
@@ -1160,7 +1160,7 @@ xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
1160 1160
1161 part = &xpc_partitions[partid]; 1161 part = &xpc_partitions[partid];
1162 if (part->remote_rp_pa == 0) 1162 if (part->remote_rp_pa == 0)
1163 return xpcPartitionDown; 1163 return xpPartitionDown;
1164 1164
1165 memset(nasid_mask, 0, XP_NASID_MASK_BYTES); 1165 memset(nasid_mask, 0, XP_NASID_MASK_BYTES);
1166 1166
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index a9543c65814d..822dc8e8d7f0 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -166,7 +166,7 @@ struct device *xpnet = &xpnet_dbg_subname;
166 * Packet was recevied by XPC and forwarded to us. 166 * Packet was recevied by XPC and forwarded to us.
167 */ 167 */
168static void 168static void
169xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) 169xpnet_receive(short partid, int channel, struct xpnet_message *msg)
170{ 170{
171 struct sk_buff *skb; 171 struct sk_buff *skb;
172 bte_result_t bret; 172 bte_result_t bret;
@@ -282,7 +282,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg)
282 * state or message reception on a connection. 282 * state or message reception on a connection.
283 */ 283 */
284static void 284static void
285xpnet_connection_activity(enum xpc_retval reason, partid_t partid, int channel, 285xpnet_connection_activity(enum xp_retval reason, short partid, int channel,
286 void *data, void *key) 286 void *data, void *key)
287{ 287{
288 long bp; 288 long bp;
@@ -291,13 +291,13 @@ xpnet_connection_activity(enum xpc_retval reason, partid_t partid, int channel,
291 DBUG_ON(channel != XPC_NET_CHANNEL); 291 DBUG_ON(channel != XPC_NET_CHANNEL);
292 292
293 switch (reason) { 293 switch (reason) {
294 case xpcMsgReceived: /* message received */ 294 case xpMsgReceived: /* message received */
295 DBUG_ON(data == NULL); 295 DBUG_ON(data == NULL);
296 296
297 xpnet_receive(partid, channel, (struct xpnet_message *)data); 297 xpnet_receive(partid, channel, (struct xpnet_message *)data);
298 break; 298 break;
299 299
300 case xpcConnected: /* connection completed to a partition */ 300 case xpConnected: /* connection completed to a partition */
301 spin_lock_bh(&xpnet_broadcast_lock); 301 spin_lock_bh(&xpnet_broadcast_lock);
302 xpnet_broadcast_partitions |= 1UL << (partid - 1); 302 xpnet_broadcast_partitions |= 1UL << (partid - 1);
303 bp = xpnet_broadcast_partitions; 303 bp = xpnet_broadcast_partitions;
@@ -330,7 +330,7 @@ xpnet_connection_activity(enum xpc_retval reason, partid_t partid, int channel,
330static int 330static int
331xpnet_dev_open(struct net_device *dev) 331xpnet_dev_open(struct net_device *dev)
332{ 332{
333 enum xpc_retval ret; 333 enum xp_retval ret;
334 334
335 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, " 335 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, "
336 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity, 336 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity,
@@ -340,7 +340,7 @@ xpnet_dev_open(struct net_device *dev)
340 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL, 340 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL,
341 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, 341 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES,
342 XPNET_MAX_KTHREADS, XPNET_MAX_IDLE_KTHREADS); 342 XPNET_MAX_KTHREADS, XPNET_MAX_IDLE_KTHREADS);
343 if (ret != xpcSuccess) { 343 if (ret != xpSuccess) {
344 dev_err(xpnet, "ifconfig up of %s failed on XPC connect, " 344 dev_err(xpnet, "ifconfig up of %s failed on XPC connect, "
345 "ret=%d\n", dev->name, ret); 345 "ret=%d\n", dev->name, ret);
346 346
@@ -407,7 +407,7 @@ xpnet_dev_get_stats(struct net_device *dev)
407 * release the skb and then release our pending message structure. 407 * release the skb and then release our pending message structure.
408 */ 408 */
409static void 409static void
410xpnet_send_completed(enum xpc_retval reason, partid_t partid, int channel, 410xpnet_send_completed(enum xp_retval reason, short partid, int channel,
411 void *__qm) 411 void *__qm)
412{ 412{
413 struct xpnet_pending_msg *queued_msg = (struct xpnet_pending_msg *)__qm; 413 struct xpnet_pending_msg *queued_msg = (struct xpnet_pending_msg *)__qm;
@@ -439,12 +439,12 @@ static int
439xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 439xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
440{ 440{
441 struct xpnet_pending_msg *queued_msg; 441 struct xpnet_pending_msg *queued_msg;
442 enum xpc_retval ret; 442 enum xp_retval ret;
443 struct xpnet_message *msg; 443 struct xpnet_message *msg;
444 u64 start_addr, end_addr; 444 u64 start_addr, end_addr;
445 long dp; 445 long dp;
446 u8 second_mac_octet; 446 u8 second_mac_octet;
447 partid_t dest_partid; 447 short dest_partid;
448 struct xpnet_dev_private *priv; 448 struct xpnet_dev_private *priv;
449 u16 embedded_bytes; 449 u16 embedded_bytes;
450 450
@@ -528,7 +528,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
528 528
529 ret = xpc_allocate(dest_partid, XPC_NET_CHANNEL, 529 ret = xpc_allocate(dest_partid, XPC_NET_CHANNEL,
530 XPC_NOWAIT, (void **)&msg); 530 XPC_NOWAIT, (void **)&msg);
531 if (unlikely(ret != xpcSuccess)) 531 if (unlikely(ret != xpSuccess))
532 continue; 532 continue;
533 533
534 msg->embedded_bytes = embedded_bytes; 534 msg->embedded_bytes = embedded_bytes;
@@ -557,7 +557,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
557 557
558 ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, msg, 558 ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, msg,
559 xpnet_send_completed, queued_msg); 559 xpnet_send_completed, queued_msg);
560 if (unlikely(ret != xpcSuccess)) { 560 if (unlikely(ret != xpSuccess)) {
561 atomic_dec(&queued_msg->use_count); 561 atomic_dec(&queued_msg->use_count);
562 continue; 562 continue;
563 } 563 }
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 3f28f6eabdbf..b5969298f3d3 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1293,7 +1293,7 @@ static void tpacpi_input_send_radiosw(void)
1293 mutex_lock(&tpacpi_inputdev_send_mutex); 1293 mutex_lock(&tpacpi_inputdev_send_mutex);
1294 1294
1295 input_report_switch(tpacpi_inputdev, 1295 input_report_switch(tpacpi_inputdev,
1296 SW_RADIO, !!wlsw); 1296 SW_RFKILL_ALL, !!wlsw);
1297 input_sync(tpacpi_inputdev); 1297 input_sync(tpacpi_inputdev);
1298 1298
1299 mutex_unlock(&tpacpi_inputdev_send_mutex); 1299 mutex_unlock(&tpacpi_inputdev_send_mutex);
@@ -1921,6 +1921,29 @@ static struct attribute *hotkey_mask_attributes[] __initdata = {
1921 &dev_attr_hotkey_wakeup_hotunplug_complete.attr, 1921 &dev_attr_hotkey_wakeup_hotunplug_complete.attr,
1922}; 1922};
1923 1923
1924static void hotkey_exit(void)
1925{
1926#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
1927 hotkey_poll_stop_sync();
1928#endif
1929
1930 if (hotkey_dev_attributes)
1931 delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj);
1932
1933 kfree(hotkey_keycode_map);
1934
1935 if (tp_features.hotkey) {
1936 dbg_printk(TPACPI_DBG_EXIT,
1937 "restoring original hot key mask\n");
1938 /* no short-circuit boolean operator below! */
1939 if ((hotkey_mask_set(hotkey_orig_mask) |
1940 hotkey_status_set(hotkey_orig_status)) != 0)
1941 printk(TPACPI_ERR
1942 "failed to restore hot key mask "
1943 "to BIOS defaults\n");
1944 }
1945}
1946
1924static int __init hotkey_init(struct ibm_init_struct *iibm) 1947static int __init hotkey_init(struct ibm_init_struct *iibm)
1925{ 1948{
1926 /* Requirements for changing the default keymaps: 1949 /* Requirements for changing the default keymaps:
@@ -2060,226 +2083,220 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2060 vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n", 2083 vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n",
2061 str_supported(tp_features.hotkey)); 2084 str_supported(tp_features.hotkey));
2062 2085
2063 if (tp_features.hotkey) { 2086 if (!tp_features.hotkey)
2064 hotkey_dev_attributes = create_attr_set(13, NULL); 2087 return 1;
2065 if (!hotkey_dev_attributes)
2066 return -ENOMEM;
2067 res = add_many_to_attr_set(hotkey_dev_attributes,
2068 hotkey_attributes,
2069 ARRAY_SIZE(hotkey_attributes));
2070 if (res)
2071 return res;
2072 2088
2073 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 2089 hotkey_dev_attributes = create_attr_set(13, NULL);
2074 A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking 2090 if (!hotkey_dev_attributes)
2075 for HKEY interface version 0x100 */ 2091 return -ENOMEM;
2076 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { 2092 res = add_many_to_attr_set(hotkey_dev_attributes,
2077 if ((hkeyv >> 8) != 1) { 2093 hotkey_attributes,
2078 printk(TPACPI_ERR "unknown version of the " 2094 ARRAY_SIZE(hotkey_attributes));
2079 "HKEY interface: 0x%x\n", hkeyv); 2095 if (res)
2080 printk(TPACPI_ERR "please report this to %s\n", 2096 goto err_exit;
2081 TPACPI_MAIL); 2097
2082 } else { 2098 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
2083 /* 2099 A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking
2084 * MHKV 0x100 in A31, R40, R40e, 2100 for HKEY interface version 0x100 */
2085 * T4x, X31, and later 2101 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
2086 */ 2102 if ((hkeyv >> 8) != 1) {
2087 tp_features.hotkey_mask = 1; 2103 printk(TPACPI_ERR "unknown version of the "
2088 } 2104 "HKEY interface: 0x%x\n", hkeyv);
2105 printk(TPACPI_ERR "please report this to %s\n",
2106 TPACPI_MAIL);
2107 } else {
2108 /*
2109 * MHKV 0x100 in A31, R40, R40e,
2110 * T4x, X31, and later
2111 */
2112 tp_features.hotkey_mask = 1;
2089 } 2113 }
2114 }
2090 2115
2091 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", 2116 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n",
2092 str_supported(tp_features.hotkey_mask)); 2117 str_supported(tp_features.hotkey_mask));
2093 2118
2094 if (tp_features.hotkey_mask) { 2119 if (tp_features.hotkey_mask) {
2095 if (!acpi_evalf(hkey_handle, &hotkey_all_mask, 2120 if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
2096 "MHKA", "qd")) { 2121 "MHKA", "qd")) {
2097 printk(TPACPI_ERR 2122 printk(TPACPI_ERR
2098 "missing MHKA handler, " 2123 "missing MHKA handler, "
2099 "please report this to %s\n", 2124 "please report this to %s\n",
2100 TPACPI_MAIL); 2125 TPACPI_MAIL);
2101 /* FN+F12, FN+F4, FN+F3 */ 2126 /* FN+F12, FN+F4, FN+F3 */
2102 hotkey_all_mask = 0x080cU; 2127 hotkey_all_mask = 0x080cU;
2103 }
2104 } 2128 }
2129 }
2105 2130
2106 /* hotkey_source_mask *must* be zero for 2131 /* hotkey_source_mask *must* be zero for
2107 * the first hotkey_mask_get */ 2132 * the first hotkey_mask_get */
2108 res = hotkey_status_get(&hotkey_orig_status); 2133 res = hotkey_status_get(&hotkey_orig_status);
2109 if (!res && tp_features.hotkey_mask) { 2134 if (res)
2110 res = hotkey_mask_get(); 2135 goto err_exit;
2111 hotkey_orig_mask = hotkey_mask; 2136
2112 if (!res) { 2137 if (tp_features.hotkey_mask) {
2113 res = add_many_to_attr_set( 2138 res = hotkey_mask_get();
2114 hotkey_dev_attributes, 2139 if (res)
2115 hotkey_mask_attributes, 2140 goto err_exit;
2116 ARRAY_SIZE(hotkey_mask_attributes)); 2141
2117 } 2142 hotkey_orig_mask = hotkey_mask;
2118 } 2143 res = add_many_to_attr_set(
2144 hotkey_dev_attributes,
2145 hotkey_mask_attributes,
2146 ARRAY_SIZE(hotkey_mask_attributes));
2147 if (res)
2148 goto err_exit;
2149 }
2119 2150
2120#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2151#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
2121 if (tp_features.hotkey_mask) { 2152 if (tp_features.hotkey_mask) {
2122 hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK 2153 hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK
2123 & ~hotkey_all_mask; 2154 & ~hotkey_all_mask;
2124 } else { 2155 } else {
2125 hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK; 2156 hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK;
2126 } 2157 }
2127 2158
2128 vdbg_printk(TPACPI_DBG_INIT, 2159 vdbg_printk(TPACPI_DBG_INIT,
2129 "hotkey source mask 0x%08x, polling freq %d\n", 2160 "hotkey source mask 0x%08x, polling freq %d\n",
2130 hotkey_source_mask, hotkey_poll_freq); 2161 hotkey_source_mask, hotkey_poll_freq);
2131#endif 2162#endif
2132 2163
2133 /* Not all thinkpads have a hardware radio switch */ 2164 /* Not all thinkpads have a hardware radio switch */
2134 if (!res && acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { 2165 if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) {
2135 tp_features.hotkey_wlsw = 1; 2166 tp_features.hotkey_wlsw = 1;
2136 printk(TPACPI_INFO 2167 printk(TPACPI_INFO
2137 "radio switch found; radios are %s\n", 2168 "radio switch found; radios are %s\n",
2138 enabled(status, 0)); 2169 enabled(status, 0));
2139 res = add_to_attr_set(hotkey_dev_attributes, 2170 res = add_to_attr_set(hotkey_dev_attributes,
2140 &dev_attr_hotkey_radio_sw.attr); 2171 &dev_attr_hotkey_radio_sw.attr);
2141 } 2172 }
2142 2173
2143 /* For X41t, X60t, X61t Tablets... */ 2174 /* For X41t, X60t, X61t Tablets... */
2144 if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { 2175 if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) {
2145 tp_features.hotkey_tablet = 1; 2176 tp_features.hotkey_tablet = 1;
2146 printk(TPACPI_INFO 2177 printk(TPACPI_INFO
2147 "possible tablet mode switch found; " 2178 "possible tablet mode switch found; "
2148 "ThinkPad in %s mode\n", 2179 "ThinkPad in %s mode\n",
2149 (status & TP_HOTKEY_TABLET_MASK)? 2180 (status & TP_HOTKEY_TABLET_MASK)?
2150 "tablet" : "laptop"); 2181 "tablet" : "laptop");
2151 res = add_to_attr_set(hotkey_dev_attributes, 2182 res = add_to_attr_set(hotkey_dev_attributes,
2152 &dev_attr_hotkey_tablet_mode.attr); 2183 &dev_attr_hotkey_tablet_mode.attr);
2153 } 2184 }
2154 2185
2155 if (!res) 2186 if (!res)
2156 res = register_attr_set_with_sysfs( 2187 res = register_attr_set_with_sysfs(
2157 hotkey_dev_attributes, 2188 hotkey_dev_attributes,
2158 &tpacpi_pdev->dev.kobj); 2189 &tpacpi_pdev->dev.kobj);
2159 if (res) 2190 if (res)
2160 return res; 2191 goto err_exit;
2161 2192
2162 /* Set up key map */ 2193 /* Set up key map */
2163 2194
2164 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, 2195 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE,
2165 GFP_KERNEL); 2196 GFP_KERNEL);
2166 if (!hotkey_keycode_map) { 2197 if (!hotkey_keycode_map) {
2167 printk(TPACPI_ERR 2198 printk(TPACPI_ERR
2168 "failed to allocate memory for key map\n"); 2199 "failed to allocate memory for key map\n");
2169 return -ENOMEM; 2200 res = -ENOMEM;
2170 } 2201 goto err_exit;
2202 }
2171 2203
2172 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { 2204 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) {
2173 dbg_printk(TPACPI_DBG_INIT, 2205 dbg_printk(TPACPI_DBG_INIT,
2174 "using Lenovo default hot key map\n"); 2206 "using Lenovo default hot key map\n");
2175 memcpy(hotkey_keycode_map, &lenovo_keycode_map, 2207 memcpy(hotkey_keycode_map, &lenovo_keycode_map,
2176 TPACPI_HOTKEY_MAP_SIZE); 2208 TPACPI_HOTKEY_MAP_SIZE);
2209 } else {
2210 dbg_printk(TPACPI_DBG_INIT,
2211 "using IBM default hot key map\n");
2212 memcpy(hotkey_keycode_map, &ibm_keycode_map,
2213 TPACPI_HOTKEY_MAP_SIZE);
2214 }
2215
2216 set_bit(EV_KEY, tpacpi_inputdev->evbit);
2217 set_bit(EV_MSC, tpacpi_inputdev->evbit);
2218 set_bit(MSC_SCAN, tpacpi_inputdev->mscbit);
2219 tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE;
2220 tpacpi_inputdev->keycodemax = TPACPI_HOTKEY_MAP_LEN;
2221 tpacpi_inputdev->keycode = hotkey_keycode_map;
2222 for (i = 0; i < TPACPI_HOTKEY_MAP_LEN; i++) {
2223 if (hotkey_keycode_map[i] != KEY_RESERVED) {
2224 set_bit(hotkey_keycode_map[i],
2225 tpacpi_inputdev->keybit);
2177 } else { 2226 } else {
2178 dbg_printk(TPACPI_DBG_INIT, 2227 if (i < sizeof(hotkey_reserved_mask)*8)
2179 "using IBM default hot key map\n"); 2228 hotkey_reserved_mask |= 1 << i;
2180 memcpy(hotkey_keycode_map, &ibm_keycode_map,
2181 TPACPI_HOTKEY_MAP_SIZE);
2182 }
2183
2184 set_bit(EV_KEY, tpacpi_inputdev->evbit);
2185 set_bit(EV_MSC, tpacpi_inputdev->evbit);
2186 set_bit(MSC_SCAN, tpacpi_inputdev->mscbit);
2187 tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE;
2188 tpacpi_inputdev->keycodemax = TPACPI_HOTKEY_MAP_LEN;
2189 tpacpi_inputdev->keycode = hotkey_keycode_map;
2190 for (i = 0; i < TPACPI_HOTKEY_MAP_LEN; i++) {
2191 if (hotkey_keycode_map[i] != KEY_RESERVED) {
2192 set_bit(hotkey_keycode_map[i],
2193 tpacpi_inputdev->keybit);
2194 } else {
2195 if (i < sizeof(hotkey_reserved_mask)*8)
2196 hotkey_reserved_mask |= 1 << i;
2197 }
2198 }
2199
2200 if (tp_features.hotkey_wlsw) {
2201 set_bit(EV_SW, tpacpi_inputdev->evbit);
2202 set_bit(SW_RADIO, tpacpi_inputdev->swbit);
2203 }
2204 if (tp_features.hotkey_tablet) {
2205 set_bit(EV_SW, tpacpi_inputdev->evbit);
2206 set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit);
2207 } 2229 }
2230 }
2208 2231
2209 /* Do not issue duplicate brightness change events to 2232 if (tp_features.hotkey_wlsw) {
2210 * userspace */ 2233 set_bit(EV_SW, tpacpi_inputdev->evbit);
2211 if (!tp_features.bright_acpimode) 2234 set_bit(SW_RFKILL_ALL, tpacpi_inputdev->swbit);
2212 /* update bright_acpimode... */ 2235 }
2213 tpacpi_check_std_acpi_brightness_support(); 2236 if (tp_features.hotkey_tablet) {
2214 2237 set_bit(EV_SW, tpacpi_inputdev->evbit);
2215 if (tp_features.bright_acpimode) { 2238 set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit);
2216 printk(TPACPI_INFO 2239 }
2217 "This ThinkPad has standard ACPI backlight "
2218 "brightness control, supported by the ACPI "
2219 "video driver\n");
2220 printk(TPACPI_NOTICE
2221 "Disabling thinkpad-acpi brightness events "
2222 "by default...\n");
2223
2224 /* The hotkey_reserved_mask change below is not
2225 * necessary while the keys are at KEY_RESERVED in the
2226 * default map, but better safe than sorry, leave it
2227 * here as a marker of what we have to do, especially
2228 * when we finally become able to set this at runtime
2229 * on response to X.org requests */
2230 hotkey_reserved_mask |=
2231 (1 << TP_ACPI_HOTKEYSCAN_FNHOME)
2232 | (1 << TP_ACPI_HOTKEYSCAN_FNEND);
2233 }
2234 2240
2235 dbg_printk(TPACPI_DBG_INIT, 2241 /* Do not issue duplicate brightness change events to
2236 "enabling hot key handling\n"); 2242 * userspace */
2237 res = hotkey_status_set(1); 2243 if (!tp_features.bright_acpimode)
2238 if (res) 2244 /* update bright_acpimode... */
2239 return res; 2245 tpacpi_check_std_acpi_brightness_support();
2240 res = hotkey_mask_set(((hotkey_all_mask | hotkey_source_mask)
2241 & ~hotkey_reserved_mask)
2242 | hotkey_orig_mask);
2243 if (res < 0 && res != -ENXIO)
2244 return res;
2245 2246
2246 dbg_printk(TPACPI_DBG_INIT, 2247 if (tp_features.bright_acpimode) {
2247 "legacy hot key reporting over procfs %s\n", 2248 printk(TPACPI_INFO
2248 (hotkey_report_mode < 2) ? 2249 "This ThinkPad has standard ACPI backlight "
2249 "enabled" : "disabled"); 2250 "brightness control, supported by the ACPI "
2251 "video driver\n");
2252 printk(TPACPI_NOTICE
2253 "Disabling thinkpad-acpi brightness events "
2254 "by default...\n");
2255
2256 /* The hotkey_reserved_mask change below is not
2257 * necessary while the keys are at KEY_RESERVED in the
2258 * default map, but better safe than sorry, leave it
2259 * here as a marker of what we have to do, especially
2260 * when we finally become able to set this at runtime
2261 * on response to X.org requests */
2262 hotkey_reserved_mask |=
2263 (1 << TP_ACPI_HOTKEYSCAN_FNHOME)
2264 | (1 << TP_ACPI_HOTKEYSCAN_FNEND);
2265 }
2266
2267 dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n");
2268 res = hotkey_status_set(1);
2269 if (res) {
2270 hotkey_exit();
2271 return res;
2272 }
2273 res = hotkey_mask_set(((hotkey_all_mask | hotkey_source_mask)
2274 & ~hotkey_reserved_mask)
2275 | hotkey_orig_mask);
2276 if (res < 0 && res != -ENXIO) {
2277 hotkey_exit();
2278 return res;
2279 }
2250 2280
2251 tpacpi_inputdev->open = &hotkey_inputdev_open; 2281 dbg_printk(TPACPI_DBG_INIT,
2252 tpacpi_inputdev->close = &hotkey_inputdev_close; 2282 "legacy hot key reporting over procfs %s\n",
2283 (hotkey_report_mode < 2) ?
2284 "enabled" : "disabled");
2253 2285
2254 hotkey_poll_setup_safe(1); 2286 tpacpi_inputdev->open = &hotkey_inputdev_open;
2255 tpacpi_input_send_radiosw(); 2287 tpacpi_inputdev->close = &hotkey_inputdev_close;
2256 tpacpi_input_send_tabletsw();
2257 }
2258 2288
2259 return (tp_features.hotkey)? 0 : 1; 2289 hotkey_poll_setup_safe(1);
2260} 2290 tpacpi_input_send_radiosw();
2291 tpacpi_input_send_tabletsw();
2261 2292
2262static void hotkey_exit(void) 2293 return 0;
2263{
2264#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
2265 hotkey_poll_stop_sync();
2266#endif
2267 2294
2268 if (tp_features.hotkey) { 2295err_exit:
2269 dbg_printk(TPACPI_DBG_EXIT, 2296 delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj);
2270 "restoring original hot key mask\n"); 2297 hotkey_dev_attributes = NULL;
2271 /* no short-circuit boolean operator below! */
2272 if ((hotkey_mask_set(hotkey_orig_mask) |
2273 hotkey_status_set(hotkey_orig_status)) != 0)
2274 printk(TPACPI_ERR
2275 "failed to restore hot key mask "
2276 "to BIOS defaults\n");
2277 }
2278 2298
2279 if (hotkey_dev_attributes) { 2299 return (res < 0)? res : 1;
2280 delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj);
2281 hotkey_dev_attributes = NULL;
2282 }
2283} 2300}
2284 2301
2285static void hotkey_notify(struct ibm_struct *ibm, u32 event) 2302static void hotkey_notify(struct ibm_struct *ibm, u32 event)
@@ -3319,7 +3336,7 @@ static struct tpacpi_led_classdev tpacpi_led_thinklight = {
3319 3336
3320static int __init light_init(struct ibm_init_struct *iibm) 3337static int __init light_init(struct ibm_init_struct *iibm)
3321{ 3338{
3322 int rc = 0; 3339 int rc;
3323 3340
3324 vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n"); 3341 vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n");
3325 3342
@@ -3337,20 +3354,23 @@ static int __init light_init(struct ibm_init_struct *iibm)
3337 tp_features.light_status = 3354 tp_features.light_status =
3338 acpi_evalf(ec_handle, NULL, "KBLT", "qv"); 3355 acpi_evalf(ec_handle, NULL, "KBLT", "qv");
3339 3356
3340 vdbg_printk(TPACPI_DBG_INIT, "light is %s\n", 3357 vdbg_printk(TPACPI_DBG_INIT, "light is %s, light status is %s\n",
3341 str_supported(tp_features.light)); 3358 str_supported(tp_features.light),
3359 str_supported(tp_features.light_status));
3342 3360
3343 if (tp_features.light) { 3361 if (!tp_features.light)
3344 rc = led_classdev_register(&tpacpi_pdev->dev, 3362 return 1;
3345 &tpacpi_led_thinklight.led_classdev); 3363
3346 } 3364 rc = led_classdev_register(&tpacpi_pdev->dev,
3365 &tpacpi_led_thinklight.led_classdev);
3347 3366
3348 if (rc < 0) { 3367 if (rc < 0) {
3349 tp_features.light = 0; 3368 tp_features.light = 0;
3350 tp_features.light_status = 0; 3369 tp_features.light_status = 0;
3351 } else { 3370 } else {
3352 rc = (tp_features.light)? 0 : 1; 3371 rc = 0;
3353 } 3372 }
3373
3354 return rc; 3374 return rc;
3355} 3375}
3356 3376
@@ -3821,7 +3841,7 @@ TPACPI_HANDLE(led, ec, "SLED", /* 570 */
3821#define TPACPI_LED_NUMLEDS 8 3841#define TPACPI_LED_NUMLEDS 8
3822static struct tpacpi_led_classdev *tpacpi_leds; 3842static struct tpacpi_led_classdev *tpacpi_leds;
3823static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; 3843static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS];
3824static const char const *tpacpi_led_names[TPACPI_LED_NUMLEDS] = { 3844static const char * const tpacpi_led_names[TPACPI_LED_NUMLEDS] = {
3825 /* there's a limit of 19 chars + NULL before 2.6.26 */ 3845 /* there's a limit of 19 chars + NULL before 2.6.26 */
3826 "tpacpi::power", 3846 "tpacpi::power",
3827 "tpacpi:orange:batt", 3847 "tpacpi:orange:batt",
@@ -3833,7 +3853,7 @@ static const char const *tpacpi_led_names[TPACPI_LED_NUMLEDS] = {
3833 "tpacpi::standby", 3853 "tpacpi::standby",
3834}; 3854};
3835 3855
3836static int led_get_status(unsigned int led) 3856static int led_get_status(const unsigned int led)
3837{ 3857{
3838 int status; 3858 int status;
3839 enum led_status_t led_s; 3859 enum led_status_t led_s;
@@ -3857,41 +3877,42 @@ static int led_get_status(unsigned int led)
3857 /* not reached */ 3877 /* not reached */
3858} 3878}
3859 3879
3860static int led_set_status(unsigned int led, enum led_status_t ledstatus) 3880static int led_set_status(const unsigned int led,
3881 const enum led_status_t ledstatus)
3861{ 3882{
3862 /* off, on, blink. Index is led_status_t */ 3883 /* off, on, blink. Index is led_status_t */
3863 static const int const led_sled_arg1[] = { 0, 1, 3 }; 3884 static const unsigned int led_sled_arg1[] = { 0, 1, 3 };
3864 static const int const led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ 3885 static const unsigned int led_led_arg1[] = { 0, 0x80, 0xc0 };
3865 static const int const led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */
3866 static const int const led_led_arg1[] = { 0, 0x80, 0xc0 };
3867 3886
3868 int rc = 0; 3887 int rc = 0;
3869 3888
3870 switch (led_supported) { 3889 switch (led_supported) {
3871 case TPACPI_LED_570: 3890 case TPACPI_LED_570:
3872 /* 570 */ 3891 /* 570 */
3873 led = 1 << led; 3892 if (led > 7)
3874 if (!acpi_evalf(led_handle, NULL, NULL, "vdd", 3893 return -EINVAL;
3875 led, led_sled_arg1[ledstatus])) 3894 if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
3876 rc = -EIO; 3895 (1 << led), led_sled_arg1[ledstatus]))
3877 break; 3896 rc = -EIO;
3897 break;
3878 case TPACPI_LED_OLD: 3898 case TPACPI_LED_OLD:
3879 /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ 3899 /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */
3880 led = 1 << led; 3900 if (led > 7)
3881 rc = ec_write(TPACPI_LED_EC_HLMS, led); 3901 return -EINVAL;
3882 if (rc >= 0) 3902 rc = ec_write(TPACPI_LED_EC_HLMS, (1 << led));
3883 rc = ec_write(TPACPI_LED_EC_HLBL, 3903 if (rc >= 0)
3884 led * led_exp_hlbl[ledstatus]); 3904 rc = ec_write(TPACPI_LED_EC_HLBL,
3885 if (rc >= 0) 3905 (ledstatus == TPACPI_LED_BLINK) << led);
3886 rc = ec_write(TPACPI_LED_EC_HLCL, 3906 if (rc >= 0)
3887 led * led_exp_hlcl[ledstatus]); 3907 rc = ec_write(TPACPI_LED_EC_HLCL,
3888 break; 3908 (ledstatus != TPACPI_LED_OFF) << led);
3909 break;
3889 case TPACPI_LED_NEW: 3910 case TPACPI_LED_NEW:
3890 /* all others */ 3911 /* all others */
3891 if (!acpi_evalf(led_handle, NULL, NULL, "vdd", 3912 if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
3892 led, led_led_arg1[ledstatus])) 3913 led, led_led_arg1[ledstatus]))
3893 rc = -EIO; 3914 rc = -EIO;
3894 break; 3915 break;
3895 default: 3916 default:
3896 rc = -ENXIO; 3917 rc = -ENXIO;
3897 } 3918 }
@@ -3978,7 +3999,6 @@ static void led_exit(void)
3978 } 3999 }
3979 4000
3980 kfree(tpacpi_leds); 4001 kfree(tpacpi_leds);
3981 tpacpi_leds = NULL;
3982} 4002}
3983 4003
3984static int __init led_init(struct ibm_init_struct *iibm) 4004static int __init led_init(struct ibm_init_struct *iibm)
@@ -4802,7 +4822,6 @@ static void brightness_exit(void)
4802 vdbg_printk(TPACPI_DBG_EXIT, 4822 vdbg_printk(TPACPI_DBG_EXIT,
4803 "calling backlight_device_unregister()\n"); 4823 "calling backlight_device_unregister()\n");
4804 backlight_device_unregister(ibm_backlight_device); 4824 backlight_device_unregister(ibm_backlight_device);
4805 ibm_backlight_device = NULL;
4806 } 4825 }
4807} 4826}
4808 4827
@@ -5764,11 +5783,16 @@ static int __init fan_init(struct ibm_init_struct *iibm)
5764 fan_control_access_mode != TPACPI_FAN_WR_NONE) { 5783 fan_control_access_mode != TPACPI_FAN_WR_NONE) {
5765 rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj, 5784 rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
5766 &fan_attr_group); 5785 &fan_attr_group);
5767 if (!(rc < 0))
5768 rc = driver_create_file(&tpacpi_hwmon_pdriver.driver,
5769 &driver_attr_fan_watchdog);
5770 if (rc < 0) 5786 if (rc < 0)
5771 return rc; 5787 return rc;
5788
5789 rc = driver_create_file(&tpacpi_hwmon_pdriver.driver,
5790 &driver_attr_fan_watchdog);
5791 if (rc < 0) {
5792 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
5793 &fan_attr_group);
5794 return rc;
5795 }
5772 return 0; 5796 return 0;
5773 } else 5797 } else
5774 return 1; 5798 return 1;
diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig
index aa8a4e461942..dd0f398ee2f5 100644
--- a/drivers/mmc/card/Kconfig
+++ b/drivers/mmc/card/Kconfig
@@ -39,3 +39,15 @@ config SDIO_UART
39 SDIO function driver for SDIO cards that implements the UART 39 SDIO function driver for SDIO cards that implements the UART
40 class, as well as the GPS class which appears like a UART. 40 class, as well as the GPS class which appears like a UART.
41 41
42config MMC_TEST
43 tristate "MMC host test driver"
44 default n
45 help
46 Development driver that performs a series of reads and writes
47 to a memory card in order to expose certain well known bugs
48 in host controllers. The tests are executed by writing to the
49 "test" file in sysfs under each card. Note that whatever is
50 on your card will be overwritten by these tests.
51
52 This driver is only of interest to those developing or
53 testing a host driver. Most people should say N here.
diff --git a/drivers/mmc/card/Makefile b/drivers/mmc/card/Makefile
index fc5a784cfa1a..0d407514f67d 100644
--- a/drivers/mmc/card/Makefile
+++ b/drivers/mmc/card/Makefile
@@ -8,6 +8,7 @@ endif
8 8
9obj-$(CONFIG_MMC_BLOCK) += mmc_block.o 9obj-$(CONFIG_MMC_BLOCK) += mmc_block.o
10mmc_block-objs := block.o queue.o 10mmc_block-objs := block.o queue.o
11obj-$(CONFIG_MMC_TEST) += mmc_test.o
11 12
12obj-$(CONFIG_SDIO_UART) += sdio_uart.o 13obj-$(CONFIG_SDIO_UART) += sdio_uart.o
13 14
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 91ded3e82401..f9ad960d7c1a 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -46,7 +46,7 @@
46#define MMC_SHIFT 3 46#define MMC_SHIFT 3
47#define MMC_NUM_MINORS (256 >> MMC_SHIFT) 47#define MMC_NUM_MINORS (256 >> MMC_SHIFT)
48 48
49static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))]; 49static DECLARE_BITMAP(dev_use, MMC_NUM_MINORS);
50 50
51/* 51/*
52 * There is one mmc_blk_data per slot. 52 * There is one mmc_blk_data per slot.
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
new file mode 100644
index 000000000000..ffadee549a41
--- /dev/null
+++ b/drivers/mmc/card/mmc_test.c
@@ -0,0 +1,892 @@
1/*
2 * linux/drivers/mmc/card/mmc_test.c
3 *
4 * Copyright 2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#include <linux/mmc/core.h>
13#include <linux/mmc/card.h>
14#include <linux/mmc/host.h>
15#include <linux/mmc/mmc.h>
16
17#include <linux/scatterlist.h>
18
19#define RESULT_OK 0
20#define RESULT_FAIL 1
21#define RESULT_UNSUP_HOST 2
22#define RESULT_UNSUP_CARD 3
23
24#define BUFFER_SIZE (PAGE_SIZE * 4)
25
26struct mmc_test_card {
27 struct mmc_card *card;
28
29 u8 *buffer;
30};
31
32/*******************************************************************/
33/* Helper functions */
34/*******************************************************************/
35
36static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size)
37{
38 struct mmc_command cmd;
39 int ret;
40
41 cmd.opcode = MMC_SET_BLOCKLEN;
42 cmd.arg = size;
43 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
44 ret = mmc_wait_for_cmd(test->card->host, &cmd, 0);
45 if (ret)
46 return ret;
47
48 return 0;
49}
50
51static int __mmc_test_transfer(struct mmc_test_card *test, int write,
52 unsigned broken_xfer, u8 *buffer, unsigned addr,
53 unsigned blocks, unsigned blksz)
54{
55 int ret, busy;
56
57 struct mmc_request mrq;
58 struct mmc_command cmd;
59 struct mmc_command stop;
60 struct mmc_data data;
61
62 struct scatterlist sg;
63
64 memset(&mrq, 0, sizeof(struct mmc_request));
65
66 mrq.cmd = &cmd;
67 mrq.data = &data;
68
69 memset(&cmd, 0, sizeof(struct mmc_command));
70
71 if (broken_xfer) {
72 if (blocks > 1) {
73 cmd.opcode = write ?
74 MMC_WRITE_BLOCK : MMC_READ_SINGLE_BLOCK;
75 } else {
76 cmd.opcode = MMC_SEND_STATUS;
77 }
78 } else {
79 if (blocks > 1) {
80 cmd.opcode = write ?
81 MMC_WRITE_MULTIPLE_BLOCK : MMC_READ_MULTIPLE_BLOCK;
82 } else {
83 cmd.opcode = write ?
84 MMC_WRITE_BLOCK : MMC_READ_SINGLE_BLOCK;
85 }
86 }
87
88 if (broken_xfer && blocks == 1)
89 cmd.arg = test->card->rca << 16;
90 else
91 cmd.arg = addr;
92 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
93
94 memset(&stop, 0, sizeof(struct mmc_command));
95
96 if (!broken_xfer && (blocks > 1)) {
97 stop.opcode = MMC_STOP_TRANSMISSION;
98 stop.arg = 0;
99 stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
100
101 mrq.stop = &stop;
102 }
103
104 memset(&data, 0, sizeof(struct mmc_data));
105
106 data.blksz = blksz;
107 data.blocks = blocks;
108 data.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ;
109 data.sg = &sg;
110 data.sg_len = 1;
111
112 sg_init_one(&sg, buffer, blocks * blksz);
113
114 mmc_set_data_timeout(&data, test->card);
115
116 mmc_wait_for_req(test->card->host, &mrq);
117
118 ret = 0;
119
120 if (broken_xfer) {
121 if (!ret && cmd.error)
122 ret = cmd.error;
123 if (!ret && data.error == 0)
124 ret = RESULT_FAIL;
125 if (!ret && data.error != -ETIMEDOUT)
126 ret = data.error;
127 if (!ret && stop.error)
128 ret = stop.error;
129 if (blocks > 1) {
130 if (!ret && data.bytes_xfered > blksz)
131 ret = RESULT_FAIL;
132 } else {
133 if (!ret && data.bytes_xfered > 0)
134 ret = RESULT_FAIL;
135 }
136 } else {
137 if (!ret && cmd.error)
138 ret = cmd.error;
139 if (!ret && data.error)
140 ret = data.error;
141 if (!ret && stop.error)
142 ret = stop.error;
143 if (!ret && data.bytes_xfered != blocks * blksz)
144 ret = RESULT_FAIL;
145 }
146
147 if (ret == -EINVAL)
148 ret = RESULT_UNSUP_HOST;
149
150 busy = 0;
151 do {
152 int ret2;
153
154 memset(&cmd, 0, sizeof(struct mmc_command));
155
156 cmd.opcode = MMC_SEND_STATUS;
157 cmd.arg = test->card->rca << 16;
158 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
159
160 ret2 = mmc_wait_for_cmd(test->card->host, &cmd, 0);
161 if (ret2)
162 break;
163
164 if (!busy && !(cmd.resp[0] & R1_READY_FOR_DATA)) {
165 busy = 1;
166 printk(KERN_INFO "%s: Warning: Host did not "
167 "wait for busy state to end.\n",
168 mmc_hostname(test->card->host));
169 }
170 } while (!(cmd.resp[0] & R1_READY_FOR_DATA));
171
172 return ret;
173}
174
175static int mmc_test_transfer(struct mmc_test_card *test, int write,
176 u8 *buffer, unsigned addr, unsigned blocks, unsigned blksz)
177{
178 return __mmc_test_transfer(test, write, 0, buffer,
179 addr, blocks, blksz);
180}
181
182static int mmc_test_prepare_verify(struct mmc_test_card *test, int write)
183{
184 int ret, i;
185
186 ret = mmc_test_set_blksize(test, 512);
187 if (ret)
188 return ret;
189
190 if (write)
191 memset(test->buffer, 0xDF, BUFFER_SIZE);
192 else {
193 for (i = 0;i < BUFFER_SIZE;i++)
194 test->buffer[i] = i;
195 }
196
197 for (i = 0;i < BUFFER_SIZE / 512;i++) {
198 ret = mmc_test_transfer(test, 1, test->buffer + i * 512,
199 i * 512, 1, 512);
200 if (ret)
201 return ret;
202 }
203
204 return 0;
205}
206
207static int mmc_test_prepare_verify_write(struct mmc_test_card *test)
208{
209 return mmc_test_prepare_verify(test, 1);
210}
211
212static int mmc_test_prepare_verify_read(struct mmc_test_card *test)
213{
214 return mmc_test_prepare_verify(test, 0);
215}
216
217static int mmc_test_verified_transfer(struct mmc_test_card *test, int write,
218 u8 *buffer, unsigned addr, unsigned blocks, unsigned blksz)
219{
220 int ret, i, sectors;
221
222 /*
223 * It is assumed that the above preparation has been done.
224 */
225
226 memset(test->buffer, 0, BUFFER_SIZE);
227
228 if (write) {
229 for (i = 0;i < blocks * blksz;i++)
230 buffer[i] = i;
231 }
232
233 ret = mmc_test_set_blksize(test, blksz);
234 if (ret)
235 return ret;
236
237 ret = mmc_test_transfer(test, write, buffer, addr, blocks, blksz);
238 if (ret)
239 return ret;
240
241 if (write) {
242 ret = mmc_test_set_blksize(test, 512);
243 if (ret)
244 return ret;
245
246 sectors = (blocks * blksz + 511) / 512;
247 if ((sectors * 512) == (blocks * blksz))
248 sectors++;
249
250 if ((sectors * 512) > BUFFER_SIZE)
251 return -EINVAL;
252
253 memset(test->buffer, 0, sectors * 512);
254
255 for (i = 0;i < sectors;i++) {
256 ret = mmc_test_transfer(test, 0,
257 test->buffer + i * 512,
258 addr + i * 512, 1, 512);
259 if (ret)
260 return ret;
261 }
262
263 for (i = 0;i < blocks * blksz;i++) {
264 if (test->buffer[i] != (u8)i)
265 return RESULT_FAIL;
266 }
267
268 for (;i < sectors * 512;i++) {
269 if (test->buffer[i] != 0xDF)
270 return RESULT_FAIL;
271 }
272 } else {
273 for (i = 0;i < blocks * blksz;i++) {
274 if (buffer[i] != (u8)i)
275 return RESULT_FAIL;
276 }
277 }
278
279 return 0;
280}
281
282static int mmc_test_cleanup_verify(struct mmc_test_card *test)
283{
284 int ret, i;
285
286 ret = mmc_test_set_blksize(test, 512);
287 if (ret)
288 return ret;
289
290 memset(test->buffer, 0, BUFFER_SIZE);
291
292 for (i = 0;i < BUFFER_SIZE / 512;i++) {
293 ret = mmc_test_transfer(test, 1, test->buffer + i * 512,
294 i * 512, 1, 512);
295 if (ret)
296 return ret;
297 }
298
299 return 0;
300}
301
302/*******************************************************************/
303/* Tests */
304/*******************************************************************/
305
306struct mmc_test_case {
307 const char *name;
308
309 int (*prepare)(struct mmc_test_card *);
310 int (*run)(struct mmc_test_card *);
311 int (*cleanup)(struct mmc_test_card *);
312};
313
314static int mmc_test_basic_write(struct mmc_test_card *test)
315{
316 int ret;
317
318 ret = mmc_test_set_blksize(test, 512);
319 if (ret)
320 return ret;
321
322 ret = mmc_test_transfer(test, 1, test->buffer, 0, 1, 512);
323 if (ret)
324 return ret;
325
326 return 0;
327}
328
329static int mmc_test_basic_read(struct mmc_test_card *test)
330{
331 int ret;
332
333 ret = mmc_test_set_blksize(test, 512);
334 if (ret)
335 return ret;
336
337 ret = mmc_test_transfer(test, 0, test->buffer, 0, 1, 512);
338 if (ret)
339 return ret;
340
341 return 0;
342}
343
344static int mmc_test_verify_write(struct mmc_test_card *test)
345{
346 int ret;
347
348 ret = mmc_test_verified_transfer(test, 1, test->buffer, 0, 1, 512);
349 if (ret)
350 return ret;
351
352 return 0;
353}
354
355static int mmc_test_verify_read(struct mmc_test_card *test)
356{
357 int ret;
358
359 ret = mmc_test_verified_transfer(test, 0, test->buffer, 0, 1, 512);
360 if (ret)
361 return ret;
362
363 return 0;
364}
365
366static int mmc_test_multi_write(struct mmc_test_card *test)
367{
368 int ret;
369 unsigned int size;
370
371 if (test->card->host->max_blk_count == 1)
372 return RESULT_UNSUP_HOST;
373
374 size = PAGE_SIZE * 2;
375 size = min(size, test->card->host->max_req_size);
376 size = min(size, test->card->host->max_seg_size);
377 size = min(size, test->card->host->max_blk_count * 512);
378
379 if (size < 1024)
380 return RESULT_UNSUP_HOST;
381
382 ret = mmc_test_verified_transfer(test, 1, test->buffer, 0,
383 size / 512, 512);
384 if (ret)
385 return ret;
386
387 return 0;
388}
389
390static int mmc_test_multi_read(struct mmc_test_card *test)
391{
392 int ret;
393 unsigned int size;
394
395 if (test->card->host->max_blk_count == 1)
396 return RESULT_UNSUP_HOST;
397
398 size = PAGE_SIZE * 2;
399 size = min(size, test->card->host->max_req_size);
400 size = min(size, test->card->host->max_seg_size);
401 size = min(size, test->card->host->max_blk_count * 512);
402
403 if (size < 1024)
404 return RESULT_UNSUP_HOST;
405
406 ret = mmc_test_verified_transfer(test, 0, test->buffer, 0,
407 size / 512, 512);
408 if (ret)
409 return ret;
410
411 return 0;
412}
413
414static int mmc_test_pow2_write(struct mmc_test_card *test)
415{
416 int ret, i;
417
418 if (!test->card->csd.write_partial)
419 return RESULT_UNSUP_CARD;
420
421 for (i = 1; i < 512;i <<= 1) {
422 ret = mmc_test_verified_transfer(test, 1,
423 test->buffer, 0, 1, i);
424 if (ret)
425 return ret;
426 }
427
428 return 0;
429}
430
431static int mmc_test_pow2_read(struct mmc_test_card *test)
432{
433 int ret, i;
434
435 if (!test->card->csd.read_partial)
436 return RESULT_UNSUP_CARD;
437
438 for (i = 1; i < 512;i <<= 1) {
439 ret = mmc_test_verified_transfer(test, 0,
440 test->buffer, 0, 1, i);
441 if (ret)
442 return ret;
443 }
444
445 return 0;
446}
447
448static int mmc_test_weird_write(struct mmc_test_card *test)
449{
450 int ret, i;
451
452 if (!test->card->csd.write_partial)
453 return RESULT_UNSUP_CARD;
454
455 for (i = 3; i < 512;i += 7) {
456 ret = mmc_test_verified_transfer(test, 1,
457 test->buffer, 0, 1, i);
458 if (ret)
459 return ret;
460 }
461
462 return 0;
463}
464
465static int mmc_test_weird_read(struct mmc_test_card *test)
466{
467 int ret, i;
468
469 if (!test->card->csd.read_partial)
470 return RESULT_UNSUP_CARD;
471
472 for (i = 3; i < 512;i += 7) {
473 ret = mmc_test_verified_transfer(test, 0,
474 test->buffer, 0, 1, i);
475 if (ret)
476 return ret;
477 }
478
479 return 0;
480}
481
482static int mmc_test_align_write(struct mmc_test_card *test)
483{
484 int ret, i;
485
486 for (i = 1;i < 4;i++) {
487 ret = mmc_test_verified_transfer(test, 1, test->buffer + i,
488 0, 1, 512);
489 if (ret)
490 return ret;
491 }
492
493 return 0;
494}
495
496static int mmc_test_align_read(struct mmc_test_card *test)
497{
498 int ret, i;
499
500 for (i = 1;i < 4;i++) {
501 ret = mmc_test_verified_transfer(test, 0, test->buffer + i,
502 0, 1, 512);
503 if (ret)
504 return ret;
505 }
506
507 return 0;
508}
509
510static int mmc_test_align_multi_write(struct mmc_test_card *test)
511{
512 int ret, i;
513 unsigned int size;
514
515 if (test->card->host->max_blk_count == 1)
516 return RESULT_UNSUP_HOST;
517
518 size = PAGE_SIZE * 2;
519 size = min(size, test->card->host->max_req_size);
520 size = min(size, test->card->host->max_seg_size);
521 size = min(size, test->card->host->max_blk_count * 512);
522
523 if (size < 1024)
524 return RESULT_UNSUP_HOST;
525
526 for (i = 1;i < 4;i++) {
527 ret = mmc_test_verified_transfer(test, 1, test->buffer + i,
528 0, size / 512, 512);
529 if (ret)
530 return ret;
531 }
532
533 return 0;
534}
535
536static int mmc_test_align_multi_read(struct mmc_test_card *test)
537{
538 int ret, i;
539 unsigned int size;
540
541 if (test->card->host->max_blk_count == 1)
542 return RESULT_UNSUP_HOST;
543
544 size = PAGE_SIZE * 2;
545 size = min(size, test->card->host->max_req_size);
546 size = min(size, test->card->host->max_seg_size);
547 size = min(size, test->card->host->max_blk_count * 512);
548
549 if (size < 1024)
550 return RESULT_UNSUP_HOST;
551
552 for (i = 1;i < 4;i++) {
553 ret = mmc_test_verified_transfer(test, 0, test->buffer + i,
554 0, size / 512, 512);
555 if (ret)
556 return ret;
557 }
558
559 return 0;
560}
561
562static int mmc_test_xfersize_write(struct mmc_test_card *test)
563{
564 int ret;
565
566 ret = mmc_test_set_blksize(test, 512);
567 if (ret)
568 return ret;
569
570 ret = __mmc_test_transfer(test, 1, 1, test->buffer, 0, 1, 512);
571 if (ret)
572 return ret;
573
574 return 0;
575}
576
577static int mmc_test_xfersize_read(struct mmc_test_card *test)
578{
579 int ret;
580
581 ret = mmc_test_set_blksize(test, 512);
582 if (ret)
583 return ret;
584
585 ret = __mmc_test_transfer(test, 0, 1, test->buffer, 0, 1, 512);
586 if (ret)
587 return ret;
588
589 return 0;
590}
591
592static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
593{
594 int ret;
595
596 if (test->card->host->max_blk_count == 1)
597 return RESULT_UNSUP_HOST;
598
599 ret = mmc_test_set_blksize(test, 512);
600 if (ret)
601 return ret;
602
603 ret = __mmc_test_transfer(test, 1, 1, test->buffer, 0, 2, 512);
604 if (ret)
605 return ret;
606
607 return 0;
608}
609
610static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
611{
612 int ret;
613
614 if (test->card->host->max_blk_count == 1)
615 return RESULT_UNSUP_HOST;
616
617 ret = mmc_test_set_blksize(test, 512);
618 if (ret)
619 return ret;
620
621 ret = __mmc_test_transfer(test, 0, 1, test->buffer, 0, 2, 512);
622 if (ret)
623 return ret;
624
625 return 0;
626}
627
628static const struct mmc_test_case mmc_test_cases[] = {
629 {
630 .name = "Basic write (no data verification)",
631 .run = mmc_test_basic_write,
632 },
633
634 {
635 .name = "Basic read (no data verification)",
636 .run = mmc_test_basic_read,
637 },
638
639 {
640 .name = "Basic write (with data verification)",
641 .prepare = mmc_test_prepare_verify_write,
642 .run = mmc_test_verify_write,
643 .cleanup = mmc_test_cleanup_verify,
644 },
645
646 {
647 .name = "Basic read (with data verification)",
648 .prepare = mmc_test_prepare_verify_read,
649 .run = mmc_test_verify_read,
650 .cleanup = mmc_test_cleanup_verify,
651 },
652
653 {
654 .name = "Multi-block write",
655 .prepare = mmc_test_prepare_verify_write,
656 .run = mmc_test_multi_write,
657 .cleanup = mmc_test_cleanup_verify,
658 },
659
660 {
661 .name = "Multi-block read",
662 .prepare = mmc_test_prepare_verify_read,
663 .run = mmc_test_multi_read,
664 .cleanup = mmc_test_cleanup_verify,
665 },
666
667 {
668 .name = "Power of two block writes",
669 .prepare = mmc_test_prepare_verify_write,
670 .run = mmc_test_pow2_write,
671 .cleanup = mmc_test_cleanup_verify,
672 },
673
674 {
675 .name = "Power of two block reads",
676 .prepare = mmc_test_prepare_verify_read,
677 .run = mmc_test_pow2_read,
678 .cleanup = mmc_test_cleanup_verify,
679 },
680
681 {
682 .name = "Weird sized block writes",
683 .prepare = mmc_test_prepare_verify_write,
684 .run = mmc_test_weird_write,
685 .cleanup = mmc_test_cleanup_verify,
686 },
687
688 {
689 .name = "Weird sized block reads",
690 .prepare = mmc_test_prepare_verify_read,
691 .run = mmc_test_weird_read,
692 .cleanup = mmc_test_cleanup_verify,
693 },
694
695 {
696 .name = "Badly aligned write",
697 .prepare = mmc_test_prepare_verify_write,
698 .run = mmc_test_align_write,
699 .cleanup = mmc_test_cleanup_verify,
700 },
701
702 {
703 .name = "Badly aligned read",
704 .prepare = mmc_test_prepare_verify_read,
705 .run = mmc_test_align_read,
706 .cleanup = mmc_test_cleanup_verify,
707 },
708
709 {
710 .name = "Badly aligned multi-block write",
711 .prepare = mmc_test_prepare_verify_write,
712 .run = mmc_test_align_multi_write,
713 .cleanup = mmc_test_cleanup_verify,
714 },
715
716 {
717 .name = "Badly aligned multi-block read",
718 .prepare = mmc_test_prepare_verify_read,
719 .run = mmc_test_align_multi_read,
720 .cleanup = mmc_test_cleanup_verify,
721 },
722
723 {
724 .name = "Correct xfer_size at write (start failure)",
725 .run = mmc_test_xfersize_write,
726 },
727
728 {
729 .name = "Correct xfer_size at read (start failure)",
730 .run = mmc_test_xfersize_read,
731 },
732
733 {
734 .name = "Correct xfer_size at write (midway failure)",
735 .run = mmc_test_multi_xfersize_write,
736 },
737
738 {
739 .name = "Correct xfer_size at read (midway failure)",
740 .run = mmc_test_multi_xfersize_read,
741 },
742};
743
744static struct mutex mmc_test_lock;
745
746static void mmc_test_run(struct mmc_test_card *test)
747{
748 int i, ret;
749
750 printk(KERN_INFO "%s: Starting tests of card %s...\n",
751 mmc_hostname(test->card->host), mmc_card_id(test->card));
752
753 mmc_claim_host(test->card->host);
754
755 for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
756 printk(KERN_INFO "%s: Test case %d. %s...\n",
757 mmc_hostname(test->card->host), i + 1,
758 mmc_test_cases[i].name);
759
760 if (mmc_test_cases[i].prepare) {
761 ret = mmc_test_cases[i].prepare(test);
762 if (ret) {
763 printk(KERN_INFO "%s: Result: Prepare "
764 "stage failed! (%d)\n",
765 mmc_hostname(test->card->host),
766 ret);
767 continue;
768 }
769 }
770
771 ret = mmc_test_cases[i].run(test);
772 switch (ret) {
773 case RESULT_OK:
774 printk(KERN_INFO "%s: Result: OK\n",
775 mmc_hostname(test->card->host));
776 break;
777 case RESULT_FAIL:
778 printk(KERN_INFO "%s: Result: FAILED\n",
779 mmc_hostname(test->card->host));
780 break;
781 case RESULT_UNSUP_HOST:
782 printk(KERN_INFO "%s: Result: UNSUPPORTED "
783 "(by host)\n",
784 mmc_hostname(test->card->host));
785 break;
786 case RESULT_UNSUP_CARD:
787 printk(KERN_INFO "%s: Result: UNSUPPORTED "
788 "(by card)\n",
789 mmc_hostname(test->card->host));
790 break;
791 default:
792 printk(KERN_INFO "%s: Result: ERROR (%d)\n",
793 mmc_hostname(test->card->host), ret);
794 }
795
796 if (mmc_test_cases[i].cleanup) {
797 ret = mmc_test_cases[i].cleanup(test);
798 if (ret) {
799 printk(KERN_INFO "%s: Warning: Cleanup "
800 "stage failed! (%d)\n",
801 mmc_hostname(test->card->host),
802 ret);
803 }
804 }
805 }
806
807 mmc_release_host(test->card->host);
808
809 printk(KERN_INFO "%s: Tests completed.\n",
810 mmc_hostname(test->card->host));
811}
812
813static ssize_t mmc_test_show(struct device *dev,
814 struct device_attribute *attr, char *buf)
815{
816 mutex_lock(&mmc_test_lock);
817 mutex_unlock(&mmc_test_lock);
818
819 return 0;
820}
821
822static ssize_t mmc_test_store(struct device *dev,
823 struct device_attribute *attr, const char *buf, size_t count)
824{
825 struct mmc_card *card;
826 struct mmc_test_card *test;
827
828 card = container_of(dev, struct mmc_card, dev);
829
830 test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
831 if (!test)
832 return -ENOMEM;
833
834 test->card = card;
835
836 test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL);
837 if (test->buffer) {
838 mutex_lock(&mmc_test_lock);
839 mmc_test_run(test);
840 mutex_unlock(&mmc_test_lock);
841 }
842
843 kfree(test->buffer);
844 kfree(test);
845
846 return count;
847}
848
849static DEVICE_ATTR(test, S_IWUSR | S_IRUGO, mmc_test_show, mmc_test_store);
850
851static int mmc_test_probe(struct mmc_card *card)
852{
853 int ret;
854
855 mutex_init(&mmc_test_lock);
856
857 ret = device_create_file(&card->dev, &dev_attr_test);
858 if (ret)
859 return ret;
860
861 return 0;
862}
863
864static void mmc_test_remove(struct mmc_card *card)
865{
866 device_remove_file(&card->dev, &dev_attr_test);
867}
868
869static struct mmc_driver mmc_driver = {
870 .drv = {
871 .name = "mmc_test",
872 },
873 .probe = mmc_test_probe,
874 .remove = mmc_test_remove,
875};
876
877static int __init mmc_test_init(void)
878{
879 return mmc_register_driver(&mmc_driver);
880}
881
882static void __exit mmc_test_exit(void)
883{
884 mmc_unregister_driver(&mmc_driver);
885}
886
887module_init(mmc_test_init);
888module_exit(mmc_test_exit);
889
890MODULE_LICENSE("GPL");
891MODULE_DESCRIPTION("Multimedia Card (MMC) host test driver");
892MODULE_AUTHOR("Pierre Ossman");
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 3b3cd0e74715..dead61754ad7 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -119,7 +119,7 @@ config MMC_TIFM_SD
119 119
120config MMC_SPI 120config MMC_SPI
121 tristate "MMC/SD over SPI" 121 tristate "MMC/SD over SPI"
122 depends on MMC && SPI_MASTER && !HIGHMEM 122 depends on MMC && SPI_MASTER && !HIGHMEM && HAS_DMA
123 select CRC7 123 select CRC7
124 select CRC_ITU_T 124 select CRC_ITU_T
125 help 125 help
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index a28fc2f68ce2..8979ad330a4d 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -663,9 +663,12 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
663 gpio_set_value(host->board->vcc_pin, 0); 663 gpio_set_value(host->board->vcc_pin, 0);
664 break; 664 break;
665 case MMC_POWER_UP: 665 case MMC_POWER_UP:
666 case MMC_POWER_ON:
667 gpio_set_value(host->board->vcc_pin, 1); 666 gpio_set_value(host->board->vcc_pin, 1);
668 break; 667 break;
668 case MMC_POWER_ON:
669 break;
670 default:
671 WARN_ON(1);
669 } 672 }
670 } 673 }
671} 674}
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 14759e9f42ad..549517c35675 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1003,7 +1003,7 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
1003 1003
1004static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data *data) 1004static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data *data)
1005{ 1005{
1006 const char *dev_name; 1006 const char *dma_dev_name;
1007 int sync_dev, dma_ch, is_read, r; 1007 int sync_dev, dma_ch, is_read, r;
1008 1008
1009 is_read = !(data->flags & MMC_DATA_WRITE); 1009 is_read = !(data->flags & MMC_DATA_WRITE);
@@ -1018,21 +1018,21 @@ static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data
1018 if (is_read) { 1018 if (is_read) {
1019 if (host->id == 1) { 1019 if (host->id == 1) {
1020 sync_dev = OMAP_DMA_MMC_RX; 1020 sync_dev = OMAP_DMA_MMC_RX;
1021 dev_name = "MMC1 read"; 1021 dma_dev_name = "MMC1 read";
1022 } else { 1022 } else {
1023 sync_dev = OMAP_DMA_MMC2_RX; 1023 sync_dev = OMAP_DMA_MMC2_RX;
1024 dev_name = "MMC2 read"; 1024 dma_dev_name = "MMC2 read";
1025 } 1025 }
1026 } else { 1026 } else {
1027 if (host->id == 1) { 1027 if (host->id == 1) {
1028 sync_dev = OMAP_DMA_MMC_TX; 1028 sync_dev = OMAP_DMA_MMC_TX;
1029 dev_name = "MMC1 write"; 1029 dma_dev_name = "MMC1 write";
1030 } else { 1030 } else {
1031 sync_dev = OMAP_DMA_MMC2_TX; 1031 sync_dev = OMAP_DMA_MMC2_TX;
1032 dev_name = "MMC2 write"; 1032 dma_dev_name = "MMC2 write";
1033 } 1033 }
1034 } 1034 }
1035 r = omap_request_dma(sync_dev, dev_name, mmc_omap_dma_cb, 1035 r = omap_request_dma(sync_dev, dma_dev_name, mmc_omap_dma_cb,
1036 host, &dma_ch); 1036 host, &dma_ch);
1037 if (r != 0) { 1037 if (r != 0) {
1038 dev_dbg(mmc_dev(host->mmc), "omap_request_dma() failed with %d\n", r); 1038 dev_dbg(mmc_dev(host->mmc), "omap_request_dma() failed with %d\n", r);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 7fb02e177a3d..299118de8933 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -187,7 +187,7 @@ struct sdhci_host {
187 struct mmc_request *mrq; /* Current request */ 187 struct mmc_request *mrq; /* Current request */
188 struct mmc_command *cmd; /* Current command */ 188 struct mmc_command *cmd; /* Current command */
189 struct mmc_data *data; /* Current data request */ 189 struct mmc_data *data; /* Current data request */
190 int data_early:1; /* Data finished before cmd */ 190 unsigned int data_early:1; /* Data finished before cmd */
191 191
192 struct scatterlist *cur_sg; /* We're working on this */ 192 struct scatterlist *cur_sg; /* We're working on this */
193 int num_sg; /* Entries left */ 193 int num_sg; /* Entries left */
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index be624a049c67..c303e7f57ab4 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1457,17 +1457,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1457 int ret; 1457 int ret;
1458 1458
1459 /* 1459 /*
1460 * Allocate interrupt. 1460 * Set up tasklets. Must be done before requesting interrupt.
1461 */
1462
1463 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host);
1464 if (ret)
1465 return ret;
1466
1467 host->irq = irq;
1468
1469 /*
1470 * Set up tasklets.
1471 */ 1461 */
1472 tasklet_init(&host->card_tasklet, wbsd_tasklet_card, 1462 tasklet_init(&host->card_tasklet, wbsd_tasklet_card,
1473 (unsigned long)host); 1463 (unsigned long)host);
@@ -1480,6 +1470,15 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1480 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, 1470 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish,
1481 (unsigned long)host); 1471 (unsigned long)host);
1482 1472
1473 /*
1474 * Allocate interrupt.
1475 */
1476 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host);
1477 if (ret)
1478 return ret;
1479
1480 host->irq = irq;
1481
1483 return 0; 1482 return 0;
1484} 1483}
1485 1484
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 25efd331ef28..b402269301f6 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -346,8 +346,10 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
346 mutex_lock(&flash->lock); 346 mutex_lock(&flash->lock);
347 347
348 /* Wait until finished previous write command. */ 348 /* Wait until finished previous write command. */
349 if (wait_till_ready(flash)) 349 if (wait_till_ready(flash)) {
350 mutex_unlock(&flash->lock);
350 return 1; 351 return 1;
352 }
351 353
352 write_enable(flash); 354 write_enable(flash);
353 355
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 59d8fb49270a..effaf7cdefab 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -331,15 +331,15 @@ static void __devexit ck804xrom_remove_one (struct pci_dev *pdev)
331} 331}
332 332
333static struct pci_device_id ck804xrom_pci_tbl[] = { 333static struct pci_device_id ck804xrom_pci_tbl[] = {
334 { PCI_VENDOR_ID_NVIDIA, 0x0051, PCI_ANY_ID, PCI_ANY_ID, DEV_CK804 }, 334 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0051), .driver_data = DEV_CK804 },
335 { PCI_VENDOR_ID_NVIDIA, 0x0360, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 335 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0360), .driver_data = DEV_MCP55 },
336 { PCI_VENDOR_ID_NVIDIA, 0x0361, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 336 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0361), .driver_data = DEV_MCP55 },
337 { PCI_VENDOR_ID_NVIDIA, 0x0362, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 337 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0362), .driver_data = DEV_MCP55 },
338 { PCI_VENDOR_ID_NVIDIA, 0x0363, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 338 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0363), .driver_data = DEV_MCP55 },
339 { PCI_VENDOR_ID_NVIDIA, 0x0364, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 339 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0364), .driver_data = DEV_MCP55 },
340 { PCI_VENDOR_ID_NVIDIA, 0x0365, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 340 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0365), .driver_data = DEV_MCP55 },
341 { PCI_VENDOR_ID_NVIDIA, 0x0366, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 341 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0366), .driver_data = DEV_MCP55 },
342 { PCI_VENDOR_ID_NVIDIA, 0x0367, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, 342 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0367), .driver_data = DEV_MCP55 },
343 { 0, } 343 { 0, }
344}; 344};
345 345
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index 240b0e2d095d..c12d8056bebd 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -110,7 +110,7 @@ static int __init omapflash_probe(struct platform_device *pdev)
110 err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0); 110 err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0);
111 if (err > 0) 111 if (err > 0)
112 add_mtd_partitions(info->mtd, info->parts, err); 112 add_mtd_partitions(info->mtd, info->parts, err);
113 else if (err < 0 && pdata->parts) 113 else if (err <= 0 && pdata->parts)
114 add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts); 114 add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts);
115 else 115 else
116#endif 116#endif
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index fceb468ccdec..fe2bc7e42119 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1216,7 +1216,7 @@ static int pxa3xx_nand_resume(struct platform_device *pdev)
1216 1216
1217 clk_enable(info->clk); 1217 clk_enable(info->clk);
1218 1218
1219 return pxa3xx_nand_config_flash(info); 1219 return pxa3xx_nand_config_flash(info, info->flash_info);
1220} 1220}
1221#else 1221#else
1222#define pxa3xx_nand_suspend NULL 1222#define pxa3xx_nand_suspend NULL
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c
index 3d44d040a47d..ad81ab8e95e2 100644
--- a/drivers/mtd/onenand/generic.c
+++ b/drivers/mtd/onenand/generic.c
@@ -76,7 +76,7 @@ static int __devinit generic_onenand_probe(struct device *dev)
76 err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); 76 err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0);
77 if (err > 0) 77 if (err > 0)
78 add_mtd_partitions(&info->mtd, info->parts, err); 78 add_mtd_partitions(&info->mtd, info->parts, err);
79 else if (err < 0 && pdata->parts) 79 else if (err <= 0 && pdata->parts)
80 add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts); 80 add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts);
81 else 81 else
82#endif 82#endif
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 47474903263c..c5030f94f04e 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -295,5 +295,5 @@ module_init(redboot_parser_init);
295module_exit(redboot_parser_exit); 295module_exit(redboot_parser_exit);
296 296
297MODULE_LICENSE("GPL"); 297MODULE_LICENSE("GPL");
298MODULE_AUTHOR("Red Hat, Inc. - David Woodhouse <dwmw2@cambridge.redhat.com>"); 298MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
299MODULE_DESCRIPTION("Parsing code for RedBoot Flash Image System (FIS) tables"); 299MODULE_DESCRIPTION("Parsing code for RedBoot Flash Image System (FIS) tables");
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index e6c545fe5f58..b9d097c9f6bb 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -413,7 +413,7 @@ static int __devinit el3_pnp_probe(struct pnp_dev *pdev,
413{ 413{
414 short i; 414 short i;
415 int ioaddr, irq, if_port; 415 int ioaddr, irq, if_port;
416 u16 phys_addr[3]; 416 __be16 phys_addr[3];
417 struct net_device *dev = NULL; 417 struct net_device *dev = NULL;
418 int err; 418 int err;
419 419
@@ -605,7 +605,7 @@ static int __init el3_mca_probe(struct device *device)
605 605
606 short i; 606 short i;
607 int ioaddr, irq, if_port; 607 int ioaddr, irq, if_port;
608 u16 phys_addr[3]; 608 __be16 phys_addr[3];
609 struct net_device *dev = NULL; 609 struct net_device *dev = NULL;
610 u_char pos4, pos5; 610 u_char pos4, pos5;
611 struct mca_device *mdev = to_mca_device(device); 611 struct mca_device *mdev = to_mca_device(device);
@@ -635,14 +635,13 @@ static int __init el3_mca_probe(struct device *device)
635 printk(KERN_DEBUG "3c529: irq %d ioaddr 0x%x ifport %d\n", irq, ioaddr, if_port); 635 printk(KERN_DEBUG "3c529: irq %d ioaddr 0x%x ifport %d\n", irq, ioaddr, if_port);
636 } 636 }
637 EL3WINDOW(0); 637 EL3WINDOW(0);
638 for (i = 0; i < 3; i++) { 638 for (i = 0; i < 3; i++)
639 phys_addr[i] = htons(read_eeprom(ioaddr, i)); 639 phys_addr[i] = htons(read_eeprom(ioaddr, i));
640 }
641 640
642 dev = alloc_etherdev(sizeof (struct el3_private)); 641 dev = alloc_etherdev(sizeof (struct el3_private));
643 if (dev == NULL) { 642 if (dev == NULL) {
644 release_region(ioaddr, EL3_IO_EXTENT); 643 release_region(ioaddr, EL3_IO_EXTENT);
645 return -ENOMEM; 644 return -ENOMEM;
646 } 645 }
647 646
648 netdev_boot_setup_check(dev); 647 netdev_boot_setup_check(dev);
@@ -668,7 +667,7 @@ static int __init el3_eisa_probe (struct device *device)
668{ 667{
669 short i; 668 short i;
670 int ioaddr, irq, if_port; 669 int ioaddr, irq, if_port;
671 u16 phys_addr[3]; 670 __be16 phys_addr[3];
672 struct net_device *dev = NULL; 671 struct net_device *dev = NULL;
673 struct eisa_device *edev; 672 struct eisa_device *edev;
674 int err; 673 int err;
@@ -1063,7 +1062,6 @@ el3_rx(struct net_device *dev)
1063 struct sk_buff *skb; 1062 struct sk_buff *skb;
1064 1063
1065 skb = dev_alloc_skb(pkt_len+5); 1064 skb = dev_alloc_skb(pkt_len+5);
1066 dev->stats.rx_bytes += pkt_len;
1067 if (el3_debug > 4) 1065 if (el3_debug > 4)
1068 printk("Receiving packet size %d status %4.4x.\n", 1066 printk("Receiving packet size %d status %4.4x.\n",
1069 pkt_len, rx_status); 1067 pkt_len, rx_status);
@@ -1078,6 +1076,7 @@ el3_rx(struct net_device *dev)
1078 skb->protocol = eth_type_trans(skb,dev); 1076 skb->protocol = eth_type_trans(skb,dev);
1079 netif_rx(skb); 1077 netif_rx(skb);
1080 dev->last_rx = jiffies; 1078 dev->last_rx = jiffies;
1079 dev->stats.rx_bytes += pkt_len;
1081 dev->stats.rx_packets++; 1080 dev->stats.rx_packets++;
1082 continue; 1081 continue;
1083 } 1082 }
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index 750a46f4bc58..ad6b8a5b6574 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -506,6 +506,7 @@ int lance_open (struct net_device *dev)
506 506
507 return res; 507 return res;
508} 508}
509EXPORT_SYMBOL_GPL(lance_open);
509 510
510int lance_close (struct net_device *dev) 511int lance_close (struct net_device *dev)
511{ 512{
@@ -521,6 +522,7 @@ int lance_close (struct net_device *dev)
521 522
522 return 0; 523 return 0;
523} 524}
525EXPORT_SYMBOL_GPL(lance_close);
524 526
525void lance_tx_timeout(struct net_device *dev) 527void lance_tx_timeout(struct net_device *dev)
526{ 528{
@@ -529,7 +531,7 @@ void lance_tx_timeout(struct net_device *dev)
529 dev->trans_start = jiffies; 531 dev->trans_start = jiffies;
530 netif_wake_queue (dev); 532 netif_wake_queue (dev);
531} 533}
532 534EXPORT_SYMBOL_GPL(lance_tx_timeout);
533 535
534int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) 536int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
535{ 537{
@@ -586,6 +588,7 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
586 588
587 return 0; 589 return 0;
588} 590}
591EXPORT_SYMBOL_GPL(lance_start_xmit);
589 592
590/* taken from the depca driver via a2065.c */ 593/* taken from the depca driver via a2065.c */
591static void lance_load_multicast (struct net_device *dev) 594static void lance_load_multicast (struct net_device *dev)
@@ -654,6 +657,7 @@ void lance_set_multicast (struct net_device *dev)
654 if (!stopped) 657 if (!stopped)
655 netif_start_queue (dev); 658 netif_start_queue (dev);
656} 659}
660EXPORT_SYMBOL_GPL(lance_set_multicast);
657 661
658#ifdef CONFIG_NET_POLL_CONTROLLER 662#ifdef CONFIG_NET_POLL_CONTROLLER
659void lance_poll(struct net_device *dev) 663void lance_poll(struct net_device *dev)
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7eeee6..da292e647eb1 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1162,6 +1162,7 @@ struct net_device * __init i82596_probe(int unit)
1162 memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */ 1162 memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */
1163 dev->base_addr = MVME_I596_BASE; 1163 dev->base_addr = MVME_I596_BASE;
1164 dev->irq = (unsigned) MVME16x_IRQ_I596; 1164 dev->irq = (unsigned) MVME16x_IRQ_I596;
1165 goto found;
1165 } 1166 }
1166#endif 1167#endif
1167#ifdef ENABLE_BVME6000_NET 1168#ifdef ENABLE_BVME6000_NET
@@ -1176,6 +1177,7 @@ struct net_device * __init i82596_probe(int unit)
1176 rtc[3] = msr; 1177 rtc[3] = msr;
1177 dev->base_addr = BVME_I596_BASE; 1178 dev->base_addr = BVME_I596_BASE;
1178 dev->irq = (unsigned) BVME_IRQ_I596; 1179 dev->irq = (unsigned) BVME_IRQ_I596;
1180 goto found;
1179 } 1181 }
1180#endif 1182#endif
1181#ifdef ENABLE_APRICOT 1183#ifdef ENABLE_APRICOT
@@ -1212,8 +1214,13 @@ struct net_device * __init i82596_probe(int unit)
1212 } 1214 }
1213 1215
1214 dev->irq = 10; 1216 dev->irq = 10;
1217 goto found;
1215 } 1218 }
1216#endif 1219#endif
1220 err = -ENODEV;
1221 goto out;
1222
1223found:
1217 dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0); 1224 dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0);
1218 if (!dev->mem_start) { 1225 if (!dev->mem_start) {
1219 err = -ENOMEM; 1226 err = -ENOMEM;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d27f54a2df77..f4182cfffe9d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1353,7 +1353,7 @@ config APRICOT
1353 1353
1354config B44 1354config B44
1355 tristate "Broadcom 440x/47xx ethernet support" 1355 tristate "Broadcom 440x/47xx ethernet support"
1356 depends on SSB_POSSIBLE 1356 depends on SSB_POSSIBLE && HAS_DMA
1357 select SSB 1357 select SSB
1358 select MII 1358 select MII
1359 help 1359 help
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index 47a8275d3962..867f6fff543c 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -127,6 +127,9 @@ struct net_device * __init apne_probe(int unit)
127#endif 127#endif
128 int err; 128 int err;
129 129
130 if (!MACH_IS_AMIGA)
131 return ERR_PTR(-ENODEV);
132
130 if (apne_owned) 133 if (apne_owned)
131 return ERR_PTR(-ENODEV); 134 return ERR_PTR(-ENODEV);
132 135
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 0afe522b8f7b..99e0b4cdc56f 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 2 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
3 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com> 3 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com>
4 * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> 4 * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com>
5 * 5 *
6 * Derived from Intel e1000 driver 6 * Derived from Intel e1000 driver
7 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. 7 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
@@ -36,7 +36,6 @@
36 * A very incomplete list of things that need to be dealt with: 36 * A very incomplete list of things that need to be dealt with:
37 * 37 *
38 * TODO: 38 * TODO:
39 * Wake on LAN.
40 * Add more ethtool functions. 39 * Add more ethtool functions.
41 * Fix abstruse irq enable/disable condition described here: 40 * Fix abstruse irq enable/disable condition described here:
42 * http://marc.theaimsgroup.com/?l=linux-netdev&m=116398508500553&w=2 41 * http://marc.theaimsgroup.com/?l=linux-netdev&m=116398508500553&w=2
@@ -638,25 +637,6 @@ static s32 atl1_phy_leave_power_saving(struct atl1_hw *hw)
638} 637}
639 638
640/* 639/*
641 *TODO: do something or get rid of this
642 */
643#ifdef CONFIG_PM
644static s32 atl1_phy_enter_power_saving(struct atl1_hw *hw)
645{
646/* s32 ret_val;
647 * u16 phy_data;
648 */
649
650/*
651 ret_val = atl1_write_phy_reg(hw, ...);
652 ret_val = atl1_write_phy_reg(hw, ...);
653 ....
654*/
655 return 0;
656}
657#endif
658
659/*
660 * Resets the PHY and make all config validate 640 * Resets the PHY and make all config validate
661 * hw - Struct containing variables accessed by shared code 641 * hw - Struct containing variables accessed by shared code
662 * 642 *
@@ -2027,6 +2007,7 @@ rrd_ok:
2027 /* Good Receive */ 2007 /* Good Receive */
2028 pci_unmap_page(adapter->pdev, buffer_info->dma, 2008 pci_unmap_page(adapter->pdev, buffer_info->dma,
2029 buffer_info->length, PCI_DMA_FROMDEVICE); 2009 buffer_info->length, PCI_DMA_FROMDEVICE);
2010 buffer_info->dma = 0;
2030 skb = buffer_info->skb; 2011 skb = buffer_info->skb;
2031 length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); 2012 length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size);
2032 2013
@@ -2139,7 +2120,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
2139 return -1; 2120 return -1;
2140 } 2121 }
2141 2122
2142 if (skb->protocol == ntohs(ETH_P_IP)) { 2123 if (skb->protocol == htons(ETH_P_IP)) {
2143 struct iphdr *iph = ip_hdr(skb); 2124 struct iphdr *iph = ip_hdr(skb);
2144 2125
2145 real_len = (((unsigned char *)iph - skb->data) + 2126 real_len = (((unsigned char *)iph - skb->data) +
@@ -2784,64 +2765,92 @@ static int atl1_suspend(struct pci_dev *pdev, pm_message_t state)
2784 struct atl1_hw *hw = &adapter->hw; 2765 struct atl1_hw *hw = &adapter->hw;
2785 u32 ctrl = 0; 2766 u32 ctrl = 0;
2786 u32 wufc = adapter->wol; 2767 u32 wufc = adapter->wol;
2768 u32 val;
2769 int retval;
2770 u16 speed;
2771 u16 duplex;
2787 2772
2788 netif_device_detach(netdev); 2773 netif_device_detach(netdev);
2789 if (netif_running(netdev)) 2774 if (netif_running(netdev))
2790 atl1_down(adapter); 2775 atl1_down(adapter);
2791 2776
2777 retval = pci_save_state(pdev);
2778 if (retval)
2779 return retval;
2780
2792 atl1_read_phy_reg(hw, MII_BMSR, (u16 *) & ctrl); 2781 atl1_read_phy_reg(hw, MII_BMSR, (u16 *) & ctrl);
2793 atl1_read_phy_reg(hw, MII_BMSR, (u16 *) & ctrl); 2782 atl1_read_phy_reg(hw, MII_BMSR, (u16 *) & ctrl);
2794 if (ctrl & BMSR_LSTATUS) 2783 val = ctrl & BMSR_LSTATUS;
2784 if (val)
2795 wufc &= ~ATLX_WUFC_LNKC; 2785 wufc &= ~ATLX_WUFC_LNKC;
2796 2786
2797 /* reduce speed to 10/100M */ 2787 if (val && wufc) {
2798 if (wufc) { 2788 val = atl1_get_speed_and_duplex(hw, &speed, &duplex);
2799 atl1_phy_enter_power_saving(hw); 2789 if (val) {
2800 /* if resume, let driver to re- setup link */ 2790 if (netif_msg_ifdown(adapter))
2801 hw->phy_configured = false; 2791 dev_printk(KERN_DEBUG, &pdev->dev,
2802 atl1_set_mac_addr(hw); 2792 "error getting speed/duplex\n");
2803 atlx_set_multi(netdev); 2793 goto disable_wol;
2794 }
2804 2795
2805 ctrl = 0; 2796 ctrl = 0;
2806 /* turn on magic packet wol */
2807 if (wufc & ATLX_WUFC_MAG)
2808 ctrl = WOL_MAGIC_EN | WOL_MAGIC_PME_EN;
2809 2797
2810 /* turn on Link change WOL */ 2798 /* enable magic packet WOL */
2811 if (wufc & ATLX_WUFC_LNKC) 2799 if (wufc & ATLX_WUFC_MAG)
2812 ctrl |= (WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN); 2800 ctrl |= (WOL_MAGIC_EN | WOL_MAGIC_PME_EN);
2813 iowrite32(ctrl, hw->hw_addr + REG_WOL_CTRL); 2801 iowrite32(ctrl, hw->hw_addr + REG_WOL_CTRL);
2802 ioread32(hw->hw_addr + REG_WOL_CTRL);
2803
2804 /* configure the mac */
2805 ctrl = MAC_CTRL_RX_EN;
2806 ctrl |= ((u32)((speed == SPEED_1000) ? MAC_CTRL_SPEED_1000 :
2807 MAC_CTRL_SPEED_10_100) << MAC_CTRL_SPEED_SHIFT);
2808 if (duplex == FULL_DUPLEX)
2809 ctrl |= MAC_CTRL_DUPLX;
2810 ctrl |= (((u32)adapter->hw.preamble_len &
2811 MAC_CTRL_PRMLEN_MASK) << MAC_CTRL_PRMLEN_SHIFT);
2812 if (adapter->vlgrp)
2813 ctrl |= MAC_CTRL_RMV_VLAN;
2814 if (wufc & ATLX_WUFC_MAG)
2815 ctrl |= MAC_CTRL_BC_EN;
2816 iowrite32(ctrl, hw->hw_addr + REG_MAC_CTRL);
2817 ioread32(hw->hw_addr + REG_MAC_CTRL);
2814 2818
2815 /* turn on all-multi mode if wake on multicast is enabled */ 2819 /* poke the PHY */
2816 ctrl = ioread32(hw->hw_addr + REG_MAC_CTRL); 2820 ctrl = ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
2817 ctrl &= ~MAC_CTRL_DBG; 2821 ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
2818 ctrl &= ~MAC_CTRL_PROMIS_EN; 2822 iowrite32(ctrl, hw->hw_addr + REG_PCIE_PHYMISC);
2819 if (wufc & ATLX_WUFC_MC) 2823 ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
2820 ctrl |= MAC_CTRL_MC_ALL_EN;
2821 else
2822 ctrl &= ~MAC_CTRL_MC_ALL_EN;
2823 2824
2824 /* turn on broadcast mode if wake on-BC is enabled */ 2825 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
2825 if (wufc & ATLX_WUFC_BC) 2826 goto exit;
2826 ctrl |= MAC_CTRL_BC_EN; 2827 }
2827 else
2828 ctrl &= ~MAC_CTRL_BC_EN;
2829 2828
2830 /* enable RX */ 2829 if (!val && wufc) {
2831 ctrl |= MAC_CTRL_RX_EN; 2830 ctrl |= (WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN);
2832 iowrite32(ctrl, hw->hw_addr + REG_MAC_CTRL); 2831 iowrite32(ctrl, hw->hw_addr + REG_WOL_CTRL);
2833 pci_enable_wake(pdev, PCI_D3hot, 1); 2832 ioread32(hw->hw_addr + REG_WOL_CTRL);
2834 pci_enable_wake(pdev, PCI_D3cold, 1); 2833 iowrite32(0, hw->hw_addr + REG_MAC_CTRL);
2835 } else { 2834 ioread32(hw->hw_addr + REG_MAC_CTRL);
2836 iowrite32(0, hw->hw_addr + REG_WOL_CTRL); 2835 hw->phy_configured = false;
2837 pci_enable_wake(pdev, PCI_D3hot, 0); 2836 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
2838 pci_enable_wake(pdev, PCI_D3cold, 0); 2837 goto exit;
2839 } 2838 }
2840 2839
2841 pci_save_state(pdev); 2840disable_wol:
2841 iowrite32(0, hw->hw_addr + REG_WOL_CTRL);
2842 ioread32(hw->hw_addr + REG_WOL_CTRL);
2843 ctrl = ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
2844 ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
2845 iowrite32(ctrl, hw->hw_addr + REG_PCIE_PHYMISC);
2846 ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
2847 hw->phy_configured = false;
2848 pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
2849exit:
2850 if (netif_running(netdev))
2851 pci_disable_msi(adapter->pdev);
2842 pci_disable_device(pdev); 2852 pci_disable_device(pdev);
2843 2853 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2844 pci_set_power_state(pdev, PCI_D3hot);
2845 2854
2846 return 0; 2855 return 0;
2847} 2856}
@@ -2855,20 +2864,26 @@ static int atl1_resume(struct pci_dev *pdev)
2855 pci_set_power_state(pdev, PCI_D0); 2864 pci_set_power_state(pdev, PCI_D0);
2856 pci_restore_state(pdev); 2865 pci_restore_state(pdev);
2857 2866
2858 /* FIXME: check and handle */
2859 err = pci_enable_device(pdev); 2867 err = pci_enable_device(pdev);
2868 if (err) {
2869 if (netif_msg_ifup(adapter))
2870 dev_printk(KERN_DEBUG, &pdev->dev,
2871 "error enabling pci device\n");
2872 return err;
2873 }
2874
2875 pci_set_master(pdev);
2876 iowrite32(0, adapter->hw.hw_addr + REG_WOL_CTRL);
2860 pci_enable_wake(pdev, PCI_D3hot, 0); 2877 pci_enable_wake(pdev, PCI_D3hot, 0);
2861 pci_enable_wake(pdev, PCI_D3cold, 0); 2878 pci_enable_wake(pdev, PCI_D3cold, 0);
2862 2879
2863 iowrite32(0, adapter->hw.hw_addr + REG_WOL_CTRL); 2880 atl1_reset_hw(&adapter->hw);
2864 atl1_reset(adapter); 2881 adapter->cmb.cmb->int_stats = 0;
2865 2882
2866 if (netif_running(netdev)) 2883 if (netif_running(netdev))
2867 atl1_up(adapter); 2884 atl1_up(adapter);
2868 netif_device_attach(netdev); 2885 netif_device_attach(netdev);
2869 2886
2870 atl1_via_workaround(adapter);
2871
2872 return 0; 2887 return 0;
2873} 2888}
2874#else 2889#else
@@ -2876,6 +2891,13 @@ static int atl1_resume(struct pci_dev *pdev)
2876#define atl1_resume NULL 2891#define atl1_resume NULL
2877#endif 2892#endif
2878 2893
2894static void atl1_shutdown(struct pci_dev *pdev)
2895{
2896#ifdef CONFIG_PM
2897 atl1_suspend(pdev, PMSG_SUSPEND);
2898#endif
2899}
2900
2879#ifdef CONFIG_NET_POLL_CONTROLLER 2901#ifdef CONFIG_NET_POLL_CONTROLLER
2880static void atl1_poll_controller(struct net_device *netdev) 2902static void atl1_poll_controller(struct net_device *netdev)
2881{ 2903{
@@ -3122,7 +3144,8 @@ static struct pci_driver atl1_driver = {
3122 .probe = atl1_probe, 3144 .probe = atl1_probe,
3123 .remove = __devexit_p(atl1_remove), 3145 .remove = __devexit_p(atl1_remove),
3124 .suspend = atl1_suspend, 3146 .suspend = atl1_suspend,
3125 .resume = atl1_resume 3147 .resume = atl1_resume,
3148 .shutdown = atl1_shutdown
3126}; 3149};
3127 3150
3128/* 3151/*
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h
index 51893d66eae1..a5015b14a429 100644
--- a/drivers/net/atlx/atl1.h
+++ b/drivers/net/atlx/atl1.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 2 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
3 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com> 3 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com>
4 * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> 4 * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com>
5 * 5 *
6 * Derived from Intel e1000 driver 6 * Derived from Intel e1000 driver
7 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. 7 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
diff --git a/drivers/net/atlx/atlx.c b/drivers/net/atlx/atlx.c
index f06b854e2501..b3e7fcf0f6e7 100644
--- a/drivers/net/atlx/atlx.c
+++ b/drivers/net/atlx/atlx.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 3 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
4 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com> 4 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com>
5 * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> 5 * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com>
6 * Copyright(c) 2007 Atheros Corporation. All rights reserved. 6 * Copyright(c) 2007 Atheros Corporation. All rights reserved.
7 * 7 *
8 * Derived from Intel e1000 driver 8 * Derived from Intel e1000 driver
diff --git a/drivers/net/atlx/atlx.h b/drivers/net/atlx/atlx.h
index 3be7c09734d4..297a03da6b7f 100644
--- a/drivers/net/atlx/atlx.h
+++ b/drivers/net/atlx/atlx.h
@@ -2,7 +2,7 @@
2 * 2 *
3 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 3 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
4 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com> 4 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com>
5 * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> 5 * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com>
6 * Copyright(c) 2007 Atheros Corporation. All rights reserved. 6 * Copyright(c) 2007 Atheros Corporation. All rights reserved.
7 * 7 *
8 * Derived from Intel e1000 driver 8 * Derived from Intel e1000 driver
@@ -29,7 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/types.h> 30#include <linux/types.h>
31 31
32#define ATLX_DRIVER_VERSION "2.1.1" 32#define ATLX_DRIVER_VERSION "2.1.3"
33MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \ 33MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \
34 Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>"); 34 Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
@@ -460,6 +460,9 @@ MODULE_VERSION(ATLX_DRIVER_VERSION);
460#define MII_ATLX_PSSR_100MBS 0x4000 /* 01=100Mbs */ 460#define MII_ATLX_PSSR_100MBS 0x4000 /* 01=100Mbs */
461#define MII_ATLX_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ 461#define MII_ATLX_PSSR_1000MBS 0x8000 /* 10=1000Mbs */
462 462
463#define MII_DBG_ADDR 0x1D
464#define MII_DBG_DATA 0x1E
465
463/* PCI Command Register Bit Definitions */ 466/* PCI Command Register Bit Definitions */
464#define PCI_REG_COMMAND 0x04 /* PCI Command Register */ 467#define PCI_REG_COMMAND 0x04 /* PCI Command Register */
465#define CMD_IO_SPACE 0x0001 468#define CMD_IO_SPACE 0x0001
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 3634b5fd7919..7023d77bf380 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -1239,12 +1239,7 @@ static int au1000_rx(struct net_device *dev)
1239 */ 1239 */
1240static irqreturn_t au1000_interrupt(int irq, void *dev_id) 1240static irqreturn_t au1000_interrupt(int irq, void *dev_id)
1241{ 1241{
1242 struct net_device *dev = (struct net_device *) dev_id; 1242 struct net_device *dev = dev_id;
1243
1244 if (dev == NULL) {
1245 printk(KERN_ERR "%s: isr: null dev ptr\n", dev->name);
1246 return IRQ_RETVAL(1);
1247 }
1248 1243
1249 /* Handle RX interrupts first to minimize chance of overrun */ 1244 /* Handle RX interrupts first to minimize chance of overrun */
1250 1245
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 89c0018132ec..41443435ab1c 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -22,7 +22,6 @@
22#include <linux/crc32.h> 22#include <linux/crc32.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/ethtool.h>
26#include <linux/mii.h> 25#include <linux/mii.h>
27#include <linux/phy.h> 26#include <linux/phy.h>
28#include <linux/netdevice.h> 27#include <linux/netdevice.h>
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 4b46e68183e0..367b6d462708 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5724,14 +5724,12 @@ bnx2_reset_task(struct work_struct *work)
5724 if (!netif_running(bp->dev)) 5724 if (!netif_running(bp->dev))
5725 return; 5725 return;
5726 5726
5727 bp->in_reset_task = 1;
5728 bnx2_netif_stop(bp); 5727 bnx2_netif_stop(bp);
5729 5728
5730 bnx2_init_nic(bp); 5729 bnx2_init_nic(bp);
5731 5730
5732 atomic_set(&bp->intr_sem, 1); 5731 atomic_set(&bp->intr_sem, 1);
5733 bnx2_netif_start(bp); 5732 bnx2_netif_start(bp);
5734 bp->in_reset_task = 0;
5735} 5733}
5736 5734
5737static void 5735static void
@@ -5907,12 +5905,7 @@ bnx2_close(struct net_device *dev)
5907 struct bnx2 *bp = netdev_priv(dev); 5905 struct bnx2 *bp = netdev_priv(dev);
5908 u32 reset_code; 5906 u32 reset_code;
5909 5907
5910 /* Calling flush_scheduled_work() may deadlock because 5908 cancel_work_sync(&bp->reset_task);
5911 * linkwatch_event() may be on the workqueue and it will try to get
5912 * the rtnl_lock which we are holding.
5913 */
5914 while (bp->in_reset_task)
5915 msleep(1);
5916 5909
5917 bnx2_disable_int_sync(bp); 5910 bnx2_disable_int_sync(bp);
5918 bnx2_napi_disable(bp); 5911 bnx2_napi_disable(bp);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 1eaf5bb3d9c2..2377cc13bf61 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6656,7 +6656,6 @@ struct bnx2 {
6656 int current_interval; 6656 int current_interval;
6657 struct timer_list timer; 6657 struct timer_list timer;
6658 struct work_struct reset_task; 6658 struct work_struct reset_task;
6659 int in_reset_task;
6660 6659
6661 /* Used to synchronize phy accesses. */ 6660 /* Used to synchronize phy accesses. */
6662 spinlock_t phy_lock; 6661 spinlock_t phy_lock;
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c
index 7bdb5af35951..70cba64732ca 100644
--- a/drivers/net/bnx2x.c
+++ b/drivers/net/bnx2x.c
@@ -6,7 +6,8 @@
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 * 8 *
9 * Written by: Eliezer Tamir <eliezert@broadcom.com> 9 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
10 * Written by: Eliezer Tamir
10 * Based on code from Michael Chan's bnx2 driver 11 * Based on code from Michael Chan's bnx2 driver
11 * UDP CSUM errata workaround by Arik Gendelman 12 * UDP CSUM errata workaround by Arik Gendelman
12 * Slowpath rework by Vladislav Zolotarov 13 * Slowpath rework by Vladislav Zolotarov
@@ -74,7 +75,7 @@ static char version[] __devinitdata =
74 "Broadcom NetXtreme II 5771X 10Gigabit Ethernet Driver " 75 "Broadcom NetXtreme II 5771X 10Gigabit Ethernet Driver "
75 DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 76 DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
76 77
77MODULE_AUTHOR("Eliezer Tamir <eliezert@broadcom.com>"); 78MODULE_AUTHOR("Eliezer Tamir");
78MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver"); 79MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver");
79MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
80MODULE_VERSION(DRV_MODULE_VERSION); 81MODULE_VERSION(DRV_MODULE_VERSION);
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 4f0c0d31e7c1..8e68d06510a6 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -6,7 +6,8 @@
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 * 8 *
9 * Written by: Eliezer Tamir <eliezert@broadcom.com> 9 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
10 * Written by: Eliezer Tamir
10 * Based on code from Michael Chan's bnx2 driver 11 * Based on code from Michael Chan's bnx2 driver
11 */ 12 */
12 13
diff --git a/drivers/net/bnx2x_init.h b/drivers/net/bnx2x_init.h
index dcaecc53bdb1..370686eef97c 100644
--- a/drivers/net/bnx2x_init.h
+++ b/drivers/net/bnx2x_init.h
@@ -6,7 +6,8 @@
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 * 8 *
9 * Written by: Eliezer Tamir <eliezert@broadcom.com> 9 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
10 * Written by: Eliezer Tamir
10 */ 11 */
11 12
12#ifndef BNX2X_INIT_H 13#ifndef BNX2X_INIT_H
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 68c41a00d93d..08f3d396bcd6 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1437,8 +1437,16 @@ int bond_create_sysfs(void)
1437 * configure multiple bonding devices. 1437 * configure multiple bonding devices.
1438 */ 1438 */
1439 if (ret == -EEXIST) { 1439 if (ret == -EEXIST) {
1440 netdev_class = NULL; 1440 /* Is someone being kinky and naming a device bonding_master? */
1441 return 0; 1441 if (__dev_get_by_name(&init_net,
1442 class_attr_bonding_masters.attr.name))
1443 printk(KERN_ERR
1444 "network device named %s already exists in sysfs",
1445 class_attr_bonding_masters.attr.name);
1446 else {
1447 netdev_class = NULL;
1448 return 0;
1449 }
1442 } 1450 }
1443 1451
1444 return ret; 1452 return ret;
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 93e13636f8dd..83768df27806 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -142,8 +142,8 @@
142 142
143#define DRV_MODULE_NAME "cassini" 143#define DRV_MODULE_NAME "cassini"
144#define PFX DRV_MODULE_NAME ": " 144#define PFX DRV_MODULE_NAME ": "
145#define DRV_MODULE_VERSION "1.5" 145#define DRV_MODULE_VERSION "1.6"
146#define DRV_MODULE_RELDATE "4 Jan 2008" 146#define DRV_MODULE_RELDATE "21 May 2008"
147 147
148#define CAS_DEF_MSG_ENABLE \ 148#define CAS_DEF_MSG_ENABLE \
149 (NETIF_MSG_DRV | \ 149 (NETIF_MSG_DRV | \
@@ -2136,9 +2136,12 @@ end_copy_pkt:
2136 if (addr) 2136 if (addr)
2137 cas_page_unmap(addr); 2137 cas_page_unmap(addr);
2138 } 2138 }
2139 skb->csum = csum_unfold(~csum);
2140 skb->ip_summed = CHECKSUM_COMPLETE;
2141 skb->protocol = eth_type_trans(skb, cp->dev); 2139 skb->protocol = eth_type_trans(skb, cp->dev);
2140 if (skb->protocol == htons(ETH_P_IP)) {
2141 skb->csum = csum_unfold(~csum);
2142 skb->ip_summed = CHECKSUM_COMPLETE;
2143 } else
2144 skb->ip_summed = CHECKSUM_NONE;
2142 return len; 2145 return len;
2143} 2146}
2144 2147
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 2b5740b3d182..7f3f62e1b113 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -38,6 +38,7 @@
38#include <linux/platform_device.h> 38#include <linux/platform_device.h>
39#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
40#include <asm/gpio.h> 40#include <asm/gpio.h>
41#include <asm/atomic.h>
41 42
42MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>"); 43MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>");
43MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)"); 44MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)");
@@ -187,6 +188,7 @@ struct cpmac_desc {
187#define CPMAC_EOQ 0x1000 188#define CPMAC_EOQ 0x1000
188 struct sk_buff *skb; 189 struct sk_buff *skb;
189 struct cpmac_desc *next; 190 struct cpmac_desc *next;
191 struct cpmac_desc *prev;
190 dma_addr_t mapping; 192 dma_addr_t mapping;
191 dma_addr_t data_mapping; 193 dma_addr_t data_mapping;
192}; 194};
@@ -208,6 +210,7 @@ struct cpmac_priv {
208 struct work_struct reset_work; 210 struct work_struct reset_work;
209 struct platform_device *pdev; 211 struct platform_device *pdev;
210 struct napi_struct napi; 212 struct napi_struct napi;
213 atomic_t reset_pending;
211}; 214};
212 215
213static irqreturn_t cpmac_irq(int, void *); 216static irqreturn_t cpmac_irq(int, void *);
@@ -241,6 +244,16 @@ static void cpmac_dump_desc(struct net_device *dev, struct cpmac_desc *desc)
241 printk("\n"); 244 printk("\n");
242} 245}
243 246
247static void cpmac_dump_all_desc(struct net_device *dev)
248{
249 struct cpmac_priv *priv = netdev_priv(dev);
250 struct cpmac_desc *dump = priv->rx_head;
251 do {
252 cpmac_dump_desc(dev, dump);
253 dump = dump->next;
254 } while (dump != priv->rx_head);
255}
256
244static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb) 257static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb)
245{ 258{
246 int i; 259 int i;
@@ -412,21 +425,42 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
412static int cpmac_poll(struct napi_struct *napi, int budget) 425static int cpmac_poll(struct napi_struct *napi, int budget)
413{ 426{
414 struct sk_buff *skb; 427 struct sk_buff *skb;
415 struct cpmac_desc *desc; 428 struct cpmac_desc *desc, *restart;
416 int received = 0;
417 struct cpmac_priv *priv = container_of(napi, struct cpmac_priv, napi); 429 struct cpmac_priv *priv = container_of(napi, struct cpmac_priv, napi);
430 int received = 0, processed = 0;
418 431
419 spin_lock(&priv->rx_lock); 432 spin_lock(&priv->rx_lock);
420 if (unlikely(!priv->rx_head)) { 433 if (unlikely(!priv->rx_head)) {
421 if (netif_msg_rx_err(priv) && net_ratelimit()) 434 if (netif_msg_rx_err(priv) && net_ratelimit())
422 printk(KERN_WARNING "%s: rx: polling, but no queue\n", 435 printk(KERN_WARNING "%s: rx: polling, but no queue\n",
423 priv->dev->name); 436 priv->dev->name);
437 spin_unlock(&priv->rx_lock);
424 netif_rx_complete(priv->dev, napi); 438 netif_rx_complete(priv->dev, napi);
425 return 0; 439 return 0;
426 } 440 }
427 441
428 desc = priv->rx_head; 442 desc = priv->rx_head;
443 restart = NULL;
429 while (((desc->dataflags & CPMAC_OWN) == 0) && (received < budget)) { 444 while (((desc->dataflags & CPMAC_OWN) == 0) && (received < budget)) {
445 processed++;
446
447 if ((desc->dataflags & CPMAC_EOQ) != 0) {
448 /* The last update to eoq->hw_next didn't happen
449 * soon enough, and the receiver stopped here.
450 *Remember this descriptor so we can restart
451 * the receiver after freeing some space.
452 */
453 if (unlikely(restart)) {
454 if (netif_msg_rx_err(priv))
455 printk(KERN_ERR "%s: poll found a"
456 " duplicate EOQ: %p and %p\n",
457 priv->dev->name, restart, desc);
458 goto fatal_error;
459 }
460
461 restart = desc->next;
462 }
463
430 skb = cpmac_rx_one(priv, desc); 464 skb = cpmac_rx_one(priv, desc);
431 if (likely(skb)) { 465 if (likely(skb)) {
432 netif_receive_skb(skb); 466 netif_receive_skb(skb);
@@ -435,19 +469,90 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
435 desc = desc->next; 469 desc = desc->next;
436 } 470 }
437 471
472 if (desc != priv->rx_head) {
473 /* We freed some buffers, but not the whole ring,
474 * add what we did free to the rx list */
475 desc->prev->hw_next = (u32)0;
476 priv->rx_head->prev->hw_next = priv->rx_head->mapping;
477 }
478
479 /* Optimization: If we did not actually process an EOQ (perhaps because
480 * of quota limits), check to see if the tail of the queue has EOQ set.
481 * We should immediately restart in that case so that the receiver can
482 * restart and run in parallel with more packet processing.
483 * This lets us handle slightly larger bursts before running
484 * out of ring space (assuming dev->weight < ring_size) */
485
486 if (!restart &&
487 (priv->rx_head->prev->dataflags & (CPMAC_OWN|CPMAC_EOQ))
488 == CPMAC_EOQ &&
489 (priv->rx_head->dataflags & CPMAC_OWN) != 0) {
490 /* reset EOQ so the poll loop (above) doesn't try to
491 * restart this when it eventually gets to this descriptor.
492 */
493 priv->rx_head->prev->dataflags &= ~CPMAC_EOQ;
494 restart = priv->rx_head;
495 }
496
497 if (restart) {
498 priv->dev->stats.rx_errors++;
499 priv->dev->stats.rx_fifo_errors++;
500 if (netif_msg_rx_err(priv) && net_ratelimit())
501 printk(KERN_WARNING "%s: rx dma ring overrun\n",
502 priv->dev->name);
503
504 if (unlikely((restart->dataflags & CPMAC_OWN) == 0)) {
505 if (netif_msg_drv(priv))
506 printk(KERN_ERR "%s: cpmac_poll is trying to "
507 "restart rx from a descriptor that's "
508 "not free: %p\n",
509 priv->dev->name, restart);
510 goto fatal_error;
511 }
512
513 cpmac_write(priv->regs, CPMAC_RX_PTR(0), restart->mapping);
514 }
515
438 priv->rx_head = desc; 516 priv->rx_head = desc;
439 spin_unlock(&priv->rx_lock); 517 spin_unlock(&priv->rx_lock);
440 if (unlikely(netif_msg_rx_status(priv))) 518 if (unlikely(netif_msg_rx_status(priv)))
441 printk(KERN_DEBUG "%s: poll processed %d packets\n", 519 printk(KERN_DEBUG "%s: poll processed %d packets\n",
442 priv->dev->name, received); 520 priv->dev->name, received);
443 if (desc->dataflags & CPMAC_OWN) { 521 if (processed == 0) {
522 /* we ran out of packets to read,
523 * revert to interrupt-driven mode */
444 netif_rx_complete(priv->dev, napi); 524 netif_rx_complete(priv->dev, napi);
445 cpmac_write(priv->regs, CPMAC_RX_PTR(0), (u32)desc->mapping);
446 cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1); 525 cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1);
447 return 0; 526 return 0;
448 } 527 }
449 528
450 return 1; 529 return 1;
530
531fatal_error:
532 /* Something went horribly wrong.
533 * Reset hardware to try to recover rather than wedging. */
534
535 if (netif_msg_drv(priv)) {
536 printk(KERN_ERR "%s: cpmac_poll is confused. "
537 "Resetting hardware\n", priv->dev->name);
538 cpmac_dump_all_desc(priv->dev);
539 printk(KERN_DEBUG "%s: RX_PTR(0)=0x%08x RX_ACK(0)=0x%08x\n",
540 priv->dev->name,
541 cpmac_read(priv->regs, CPMAC_RX_PTR(0)),
542 cpmac_read(priv->regs, CPMAC_RX_ACK(0)));
543 }
544
545 spin_unlock(&priv->rx_lock);
546 netif_rx_complete(priv->dev, napi);
547 netif_stop_queue(priv->dev);
548 napi_disable(&priv->napi);
549
550 atomic_inc(&priv->reset_pending);
551 cpmac_hw_stop(priv->dev);
552 if (!schedule_work(&priv->reset_work))
553 atomic_dec(&priv->reset_pending);
554 return 0;
555
451} 556}
452 557
453static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) 558static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -456,6 +561,9 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
456 struct cpmac_desc *desc; 561 struct cpmac_desc *desc;
457 struct cpmac_priv *priv = netdev_priv(dev); 562 struct cpmac_priv *priv = netdev_priv(dev);
458 563
564 if (unlikely(atomic_read(&priv->reset_pending)))
565 return NETDEV_TX_BUSY;
566
459 if (unlikely(skb_padto(skb, ETH_ZLEN))) 567 if (unlikely(skb_padto(skb, ETH_ZLEN)))
460 return NETDEV_TX_OK; 568 return NETDEV_TX_OK;
461 569
@@ -621,8 +729,10 @@ static void cpmac_clear_rx(struct net_device *dev)
621 desc->dataflags = CPMAC_OWN; 729 desc->dataflags = CPMAC_OWN;
622 dev->stats.rx_dropped++; 730 dev->stats.rx_dropped++;
623 } 731 }
732 desc->hw_next = desc->next->mapping;
624 desc = desc->next; 733 desc = desc->next;
625 } 734 }
735 priv->rx_head->prev->hw_next = 0;
626} 736}
627 737
628static void cpmac_clear_tx(struct net_device *dev) 738static void cpmac_clear_tx(struct net_device *dev)
@@ -635,14 +745,14 @@ static void cpmac_clear_tx(struct net_device *dev)
635 priv->desc_ring[i].dataflags = 0; 745 priv->desc_ring[i].dataflags = 0;
636 if (priv->desc_ring[i].skb) { 746 if (priv->desc_ring[i].skb) {
637 dev_kfree_skb_any(priv->desc_ring[i].skb); 747 dev_kfree_skb_any(priv->desc_ring[i].skb);
638 if (netif_subqueue_stopped(dev, i)) 748 priv->desc_ring[i].skb = NULL;
639 netif_wake_subqueue(dev, i);
640 } 749 }
641 } 750 }
642} 751}
643 752
644static void cpmac_hw_error(struct work_struct *work) 753static void cpmac_hw_error(struct work_struct *work)
645{ 754{
755 int i;
646 struct cpmac_priv *priv = 756 struct cpmac_priv *priv =
647 container_of(work, struct cpmac_priv, reset_work); 757 container_of(work, struct cpmac_priv, reset_work);
648 758
@@ -651,8 +761,48 @@ static void cpmac_hw_error(struct work_struct *work)
651 spin_unlock(&priv->rx_lock); 761 spin_unlock(&priv->rx_lock);
652 cpmac_clear_tx(priv->dev); 762 cpmac_clear_tx(priv->dev);
653 cpmac_hw_start(priv->dev); 763 cpmac_hw_start(priv->dev);
654 napi_enable(&priv->napi); 764 barrier();
655 netif_start_queue(priv->dev); 765 atomic_dec(&priv->reset_pending);
766
767 for (i = 0; i < CPMAC_QUEUES; i++)
768 netif_wake_subqueue(priv->dev, i);
769 netif_wake_queue(priv->dev);
770 cpmac_write(priv->regs, CPMAC_MAC_INT_ENABLE, 3);
771}
772
773static void cpmac_check_status(struct net_device *dev)
774{
775 struct cpmac_priv *priv = netdev_priv(dev);
776
777 u32 macstatus = cpmac_read(priv->regs, CPMAC_MAC_STATUS);
778 int rx_channel = (macstatus >> 8) & 7;
779 int rx_code = (macstatus >> 12) & 15;
780 int tx_channel = (macstatus >> 16) & 7;
781 int tx_code = (macstatus >> 20) & 15;
782
783 if (rx_code || tx_code) {
784 if (netif_msg_drv(priv) && net_ratelimit()) {
785 /* Can't find any documentation on what these
786 *error codes actually are. So just log them and hope..
787 */
788 if (rx_code)
789 printk(KERN_WARNING "%s: host error %d on rx "
790 "channel %d (macstatus %08x), resetting\n",
791 dev->name, rx_code, rx_channel, macstatus);
792 if (tx_code)
793 printk(KERN_WARNING "%s: host error %d on tx "
794 "channel %d (macstatus %08x), resetting\n",
795 dev->name, tx_code, tx_channel, macstatus);
796 }
797
798 netif_stop_queue(dev);
799 cpmac_hw_stop(dev);
800 if (schedule_work(&priv->reset_work))
801 atomic_inc(&priv->reset_pending);
802 if (unlikely(netif_msg_hw(priv)))
803 cpmac_dump_regs(dev);
804 }
805 cpmac_write(priv->regs, CPMAC_MAC_INT_CLEAR, 0xff);
656} 806}
657 807
658static irqreturn_t cpmac_irq(int irq, void *dev_id) 808static irqreturn_t cpmac_irq(int irq, void *dev_id)
@@ -683,49 +833,32 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
683 833
684 cpmac_write(priv->regs, CPMAC_MAC_EOI_VECTOR, 0); 834 cpmac_write(priv->regs, CPMAC_MAC_EOI_VECTOR, 0);
685 835
686 if (unlikely(status & (MAC_INT_HOST | MAC_INT_STATUS))) { 836 if (unlikely(status & (MAC_INT_HOST | MAC_INT_STATUS)))
687 if (netif_msg_drv(priv) && net_ratelimit()) 837 cpmac_check_status(dev);
688 printk(KERN_ERR "%s: hw error, resetting...\n",
689 dev->name);
690 netif_stop_queue(dev);
691 napi_disable(&priv->napi);
692 cpmac_hw_stop(dev);
693 schedule_work(&priv->reset_work);
694 if (unlikely(netif_msg_hw(priv)))
695 cpmac_dump_regs(dev);
696 }
697 838
698 return IRQ_HANDLED; 839 return IRQ_HANDLED;
699} 840}
700 841
701static void cpmac_tx_timeout(struct net_device *dev) 842static void cpmac_tx_timeout(struct net_device *dev)
702{ 843{
703 struct cpmac_priv *priv = netdev_priv(dev);
704 int i; 844 int i;
845 struct cpmac_priv *priv = netdev_priv(dev);
705 846
706 spin_lock(&priv->lock); 847 spin_lock(&priv->lock);
707 dev->stats.tx_errors++; 848 dev->stats.tx_errors++;
708 spin_unlock(&priv->lock); 849 spin_unlock(&priv->lock);
709 if (netif_msg_tx_err(priv) && net_ratelimit()) 850 if (netif_msg_tx_err(priv) && net_ratelimit())
710 printk(KERN_WARNING "%s: transmit timeout\n", dev->name); 851 printk(KERN_WARNING "%s: transmit timeout\n", dev->name);
711 /* 852
712 * FIXME: waking up random queue is not the best thing to 853 atomic_inc(&priv->reset_pending);
713 * do... on the other hand why we got here at all? 854 barrier();
714 */ 855 cpmac_clear_tx(dev);
715#ifdef CONFIG_NETDEVICES_MULTIQUEUE 856 barrier();
857 atomic_dec(&priv->reset_pending);
858
859 netif_wake_queue(priv->dev);
716 for (i = 0; i < CPMAC_QUEUES; i++) 860 for (i = 0; i < CPMAC_QUEUES; i++)
717 if (priv->desc_ring[i].skb) { 861 netif_wake_subqueue(dev, i);
718 priv->desc_ring[i].dataflags = 0;
719 dev_kfree_skb_any(priv->desc_ring[i].skb);
720 netif_wake_subqueue(dev, i);
721 break;
722 }
723#else
724 priv->desc_ring[0].dataflags = 0;
725 if (priv->desc_ring[0].skb)
726 dev_kfree_skb_any(priv->desc_ring[0].skb);
727 netif_wake_queue(dev);
728#endif
729} 862}
730 863
731static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 864static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
@@ -901,9 +1034,12 @@ static int cpmac_open(struct net_device *dev)
901 desc->buflen = CPMAC_SKB_SIZE; 1034 desc->buflen = CPMAC_SKB_SIZE;
902 desc->dataflags = CPMAC_OWN; 1035 desc->dataflags = CPMAC_OWN;
903 desc->next = &priv->rx_head[(i + 1) % priv->ring_size]; 1036 desc->next = &priv->rx_head[(i + 1) % priv->ring_size];
1037 desc->next->prev = desc;
904 desc->hw_next = (u32)desc->next->mapping; 1038 desc->hw_next = (u32)desc->next->mapping;
905 } 1039 }
906 1040
1041 priv->rx_head->prev->hw_next = (u32)0;
1042
907 if ((res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, 1043 if ((res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED,
908 dev->name, dev))) { 1044 dev->name, dev))) {
909 if (netif_msg_drv(priv)) 1045 if (netif_msg_drv(priv))
@@ -912,6 +1048,7 @@ static int cpmac_open(struct net_device *dev)
912 goto fail_irq; 1048 goto fail_irq;
913 } 1049 }
914 1050
1051 atomic_set(&priv->reset_pending, 0);
915 INIT_WORK(&priv->reset_work, cpmac_hw_error); 1052 INIT_WORK(&priv->reset_work, cpmac_hw_error);
916 cpmac_hw_start(dev); 1053 cpmac_hw_start(dev);
917 1054
@@ -1007,21 +1144,10 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1007 1144
1008 if (phy_id == PHY_MAX_ADDR) { 1145 if (phy_id == PHY_MAX_ADDR) {
1009 if (external_switch || dumb_switch) { 1146 if (external_switch || dumb_switch) {
1010 struct fixed_phy_status status = {}; 1147 mdio_bus_id = 0; /* fixed phys bus */
1011 1148 phy_id = pdev->id;
1012 /*
1013 * FIXME: this should be in the platform code!
1014 * Since there is not platform code at all (that is,
1015 * no mainline users of that driver), place it here
1016 * for now.
1017 */
1018 phy_id = 0;
1019 status.link = 1;
1020 status.duplex = 1;
1021 status.speed = 100;
1022 fixed_phy_add(PHY_POLL, phy_id, &status);
1023 } else { 1149 } else {
1024 printk(KERN_ERR "cpmac: no PHY present\n"); 1150 dev_err(&pdev->dev, "no PHY present\n");
1025 return -ENODEV; 1151 return -ENODEV;
1026 } 1152 }
1027 } 1153 }
@@ -1064,10 +1190,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1064 priv->msg_enable = netif_msg_init(debug_level, 0xff); 1190 priv->msg_enable = netif_msg_init(debug_level, 0xff);
1065 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); 1191 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
1066 1192
1067 snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); 1193 priv->phy = phy_connect(dev, cpmac_mii.phy_map[phy_id]->dev.bus_id,
1068 1194 &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII);
1069 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
1070 PHY_INTERFACE_MODE_MII);
1071 if (IS_ERR(priv->phy)) { 1195 if (IS_ERR(priv->phy)) {
1072 if (netif_msg_drv(priv)) 1196 if (netif_msg_drv(priv))
1073 printk(KERN_ERR "%s: Could not attach to PHY\n", 1197 printk(KERN_ERR "%s: Could not attach to PHY\n",
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 348371fda597..fba87abe78ee 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1394,7 +1394,11 @@ net_open(struct net_device *dev)
1394#endif 1394#endif
1395 if (!result) { 1395 if (!result) {
1396 printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name); 1396 printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name);
1397 release_irq: 1397release_dma:
1398#if ALLOW_DMA
1399 free_dma(dev->dma);
1400#endif
1401release_irq:
1398#if ALLOW_DMA 1402#if ALLOW_DMA
1399 release_dma_buff(lp); 1403 release_dma_buff(lp);
1400#endif 1404#endif
@@ -1442,12 +1446,12 @@ net_open(struct net_device *dev)
1442 if ((result = detect_bnc(dev)) != DETECTED_NONE) 1446 if ((result = detect_bnc(dev)) != DETECTED_NONE)
1443 break; 1447 break;
1444 printk(KERN_ERR "%s: no media detected\n", dev->name); 1448 printk(KERN_ERR "%s: no media detected\n", dev->name);
1445 goto release_irq; 1449 goto release_dma;
1446 } 1450 }
1447 switch(result) { 1451 switch(result) {
1448 case DETECTED_NONE: 1452 case DETECTED_NONE:
1449 printk(KERN_ERR "%s: no network cable attached to configured media\n", dev->name); 1453 printk(KERN_ERR "%s: no network cable attached to configured media\n", dev->name);
1450 goto release_irq; 1454 goto release_dma;
1451 case DETECTED_RJ45H: 1455 case DETECTED_RJ45H:
1452 printk(KERN_INFO "%s: using half-duplex 10Base-T (RJ-45)\n", dev->name); 1456 printk(KERN_INFO "%s: using half-duplex 10Base-T (RJ-45)\n", dev->name);
1453 break; 1457 break;
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 4fdb13f8447b..acebe431d068 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -71,6 +71,7 @@ enum { /* adapter flags */
71 USING_MSIX = (1 << 2), 71 USING_MSIX = (1 << 2),
72 QUEUES_BOUND = (1 << 3), 72 QUEUES_BOUND = (1 << 3),
73 TP_PARITY_INIT = (1 << 4), 73 TP_PARITY_INIT = (1 << 4),
74 NAPI_INIT = (1 << 5),
74}; 75};
75 76
76struct fl_pg_chunk { 77struct fl_pg_chunk {
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 91ee7277b813..579bee42a5cb 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -698,6 +698,7 @@ void mac_prep(struct cmac *mac, struct adapter *adapter, int index);
698void early_hw_init(struct adapter *adapter, const struct adapter_info *ai); 698void early_hw_init(struct adapter *adapter, const struct adapter_info *ai);
699int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, 699int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
700 int reset); 700 int reset);
701int t3_replay_prep_adapter(struct adapter *adapter);
701void t3_led_ready(struct adapter *adapter); 702void t3_led_ready(struct adapter *adapter);
702void t3_fatal_err(struct adapter *adapter); 703void t3_fatal_err(struct adapter *adapter);
703void t3_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on); 704void t3_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ce949d5fae39..3a3127216791 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -421,6 +421,13 @@ static void init_napi(struct adapter *adap)
421 netif_napi_add(qs->netdev, &qs->napi, qs->napi.poll, 421 netif_napi_add(qs->netdev, &qs->napi, qs->napi.poll,
422 64); 422 64);
423 } 423 }
424
425 /*
426 * netif_napi_add() can be called only once per napi_struct because it
427 * adds each new napi_struct to a list. Be careful not to call it a
428 * second time, e.g., during EEH recovery, by making a note of it.
429 */
430 adap->flags |= NAPI_INIT;
424} 431}
425 432
426/* 433/*
@@ -896,7 +903,8 @@ static int cxgb_up(struct adapter *adap)
896 goto out; 903 goto out;
897 904
898 setup_rss(adap); 905 setup_rss(adap);
899 init_napi(adap); 906 if (!(adap->flags & NAPI_INIT))
907 init_napi(adap);
900 adap->flags |= FULL_INIT_DONE; 908 adap->flags |= FULL_INIT_DONE;
901 } 909 }
902 910
@@ -999,7 +1007,7 @@ static int offload_open(struct net_device *dev)
999 return 0; 1007 return 0;
1000 1008
1001 if (!adap_up && (err = cxgb_up(adapter)) < 0) 1009 if (!adap_up && (err = cxgb_up(adapter)) < 0)
1002 return err; 1010 goto out;
1003 1011
1004 t3_tp_set_offload_mode(adapter, 1); 1012 t3_tp_set_offload_mode(adapter, 1);
1005 tdev->lldev = adapter->port[0]; 1013 tdev->lldev = adapter->port[0];
@@ -1061,10 +1069,8 @@ static int cxgb_open(struct net_device *dev)
1061 int other_ports = adapter->open_device_map & PORT_MASK; 1069 int other_ports = adapter->open_device_map & PORT_MASK;
1062 int err; 1070 int err;
1063 1071
1064 if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0) { 1072 if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0)
1065 quiesce_rx(adapter);
1066 return err; 1073 return err;
1067 }
1068 1074
1069 set_bit(pi->port_id, &adapter->open_device_map); 1075 set_bit(pi->port_id, &adapter->open_device_map);
1070 if (is_offload(adapter) && !ofld_disable) { 1076 if (is_offload(adapter) && !ofld_disable) {
@@ -2424,14 +2430,11 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
2424 test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) 2430 test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
2425 offload_close(&adapter->tdev); 2431 offload_close(&adapter->tdev);
2426 2432
2427 /* Free sge resources */
2428 t3_free_sge_resources(adapter);
2429
2430 adapter->flags &= ~FULL_INIT_DONE; 2433 adapter->flags &= ~FULL_INIT_DONE;
2431 2434
2432 pci_disable_device(pdev); 2435 pci_disable_device(pdev);
2433 2436
2434 /* Request a slot slot reset. */ 2437 /* Request a slot reset. */
2435 return PCI_ERS_RESULT_NEED_RESET; 2438 return PCI_ERS_RESULT_NEED_RESET;
2436} 2439}
2437 2440
@@ -2448,13 +2451,20 @@ static pci_ers_result_t t3_io_slot_reset(struct pci_dev *pdev)
2448 if (pci_enable_device(pdev)) { 2451 if (pci_enable_device(pdev)) {
2449 dev_err(&pdev->dev, 2452 dev_err(&pdev->dev,
2450 "Cannot re-enable PCI device after reset.\n"); 2453 "Cannot re-enable PCI device after reset.\n");
2451 return PCI_ERS_RESULT_DISCONNECT; 2454 goto err;
2452 } 2455 }
2453 pci_set_master(pdev); 2456 pci_set_master(pdev);
2457 pci_restore_state(pdev);
2454 2458
2455 t3_prep_adapter(adapter, adapter->params.info, 1); 2459 /* Free sge resources */
2460 t3_free_sge_resources(adapter);
2461
2462 if (t3_replay_prep_adapter(adapter))
2463 goto err;
2456 2464
2457 return PCI_ERS_RESULT_RECOVERED; 2465 return PCI_ERS_RESULT_RECOVERED;
2466err:
2467 return PCI_ERS_RESULT_DISCONNECT;
2458} 2468}
2459 2469
2460/** 2470/**
@@ -2483,13 +2493,6 @@ static void t3_io_resume(struct pci_dev *pdev)
2483 netif_device_attach(netdev); 2493 netif_device_attach(netdev);
2484 } 2494 }
2485 } 2495 }
2486
2487 if (is_offload(adapter)) {
2488 __set_bit(OFFLOAD_DEVMAP_BIT, &adapter->registered_device_map);
2489 if (offload_open(adapter->port[0]))
2490 printk(KERN_WARNING
2491 "Could not bring back offload capabilities\n");
2492 }
2493} 2496}
2494 2497
2495static struct pci_error_handlers t3_err_handler = { 2498static struct pci_error_handlers t3_err_handler = {
@@ -2608,6 +2611,7 @@ static int __devinit init_one(struct pci_dev *pdev,
2608 } 2611 }
2609 2612
2610 pci_set_master(pdev); 2613 pci_set_master(pdev);
2614 pci_save_state(pdev);
2611 2615
2612 mmio_start = pci_resource_start(pdev, 0); 2616 mmio_start = pci_resource_start(pdev, 0);
2613 mmio_len = pci_resource_len(pdev, 0); 2617 mmio_len = pci_resource_len(pdev, 0);
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 02dbbb300929..567178879345 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -444,6 +444,14 @@
444 444
445#define A_PCIE_CFG 0x88 445#define A_PCIE_CFG 0x88
446 446
447#define S_ENABLELINKDWNDRST 21
448#define V_ENABLELINKDWNDRST(x) ((x) << S_ENABLELINKDWNDRST)
449#define F_ENABLELINKDWNDRST V_ENABLELINKDWNDRST(1U)
450
451#define S_ENABLELINKDOWNRST 20
452#define V_ENABLELINKDOWNRST(x) ((x) << S_ENABLELINKDOWNRST)
453#define F_ENABLELINKDOWNRST V_ENABLELINKDOWNRST(1U)
454
447#define S_PCIE_CLIDECEN 16 455#define S_PCIE_CLIDECEN 16
448#define V_PCIE_CLIDECEN(x) ((x) << S_PCIE_CLIDECEN) 456#define V_PCIE_CLIDECEN(x) ((x) << S_PCIE_CLIDECEN)
449#define F_PCIE_CLIDECEN V_PCIE_CLIDECEN(1U) 457#define F_PCIE_CLIDECEN V_PCIE_CLIDECEN(1U)
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 98a6bbd11d4c..796eb305cdc3 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -539,6 +539,31 @@ static void *alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size,
539} 539}
540 540
541/** 541/**
542 * t3_reset_qset - reset a sge qset
543 * @q: the queue set
544 *
545 * Reset the qset structure.
546 * the NAPI structure is preserved in the event of
547 * the qset's reincarnation, for example during EEH recovery.
548 */
549static void t3_reset_qset(struct sge_qset *q)
550{
551 if (q->adap &&
552 !(q->adap->flags & NAPI_INIT)) {
553 memset(q, 0, sizeof(*q));
554 return;
555 }
556
557 q->adap = NULL;
558 memset(&q->rspq, 0, sizeof(q->rspq));
559 memset(q->fl, 0, sizeof(struct sge_fl) * SGE_RXQ_PER_SET);
560 memset(q->txq, 0, sizeof(struct sge_txq) * SGE_TXQ_PER_SET);
561 q->txq_stopped = 0;
562 memset(&q->tx_reclaim_timer, 0, sizeof(q->tx_reclaim_timer));
563}
564
565
566/**
542 * free_qset - free the resources of an SGE queue set 567 * free_qset - free the resources of an SGE queue set
543 * @adapter: the adapter owning the queue set 568 * @adapter: the adapter owning the queue set
544 * @q: the queue set 569 * @q: the queue set
@@ -594,7 +619,7 @@ static void t3_free_qset(struct adapter *adapter, struct sge_qset *q)
594 q->rspq.desc, q->rspq.phys_addr); 619 q->rspq.desc, q->rspq.phys_addr);
595 } 620 }
596 621
597 memset(q, 0, sizeof(*q)); 622 t3_reset_qset(q);
598} 623}
599 624
600/** 625/**
@@ -1365,7 +1390,7 @@ static void restart_ctrlq(unsigned long data)
1365 */ 1390 */
1366int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb) 1391int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb)
1367{ 1392{
1368 int ret; 1393 int ret;
1369 local_bh_disable(); 1394 local_bh_disable();
1370 ret = ctrl_xmit(adap, &adap->sge.qs[0].txq[TXQ_CTRL], skb); 1395 ret = ctrl_xmit(adap, &adap->sge.qs[0].txq[TXQ_CTRL], skb);
1371 local_bh_enable(); 1396 local_bh_enable();
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index a99496a431c4..d405a932c73a 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -3264,6 +3264,7 @@ static void config_pcie(struct adapter *adap)
3264 3264
3265 t3_write_reg(adap, A_PCIE_PEX_ERR, 0xffffffff); 3265 t3_write_reg(adap, A_PCIE_PEX_ERR, 0xffffffff);
3266 t3_set_reg_field(adap, A_PCIE_CFG, 0, 3266 t3_set_reg_field(adap, A_PCIE_CFG, 0,
3267 F_ENABLELINKDWNDRST | F_ENABLELINKDOWNRST |
3267 F_PCIE_DMASTOPEN | F_PCIE_CLIDECEN); 3268 F_PCIE_DMASTOPEN | F_PCIE_CLIDECEN);
3268} 3269}
3269 3270
@@ -3655,3 +3656,30 @@ void t3_led_ready(struct adapter *adapter)
3655 t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 3656 t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL,
3656 F_GPIO0_OUT_VAL); 3657 F_GPIO0_OUT_VAL);
3657} 3658}
3659
3660int t3_replay_prep_adapter(struct adapter *adapter)
3661{
3662 const struct adapter_info *ai = adapter->params.info;
3663 unsigned int i, j = 0;
3664 int ret;
3665
3666 early_hw_init(adapter, ai);
3667 ret = init_parity(adapter);
3668 if (ret)
3669 return ret;
3670
3671 for_each_port(adapter, i) {
3672 struct port_info *p = adap2pinfo(adapter, i);
3673 while (!adapter->params.vpd.port_type[j])
3674 ++j;
3675
3676 p->port_type->phy_prep(&p->phy, adapter, ai->phy_base_addr + j,
3677 ai->mdio_ops);
3678
3679 p->phy.ops->power_down(&p->phy, 1);
3680 ++j;
3681 }
3682
3683return 0;
3684}
3685
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index e6fe2614ea6d..864295e081b6 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -117,6 +117,9 @@ typedef struct board_info {
117 117
118 struct mutex addr_lock; /* phy and eeprom access lock */ 118 struct mutex addr_lock; /* phy and eeprom access lock */
119 119
120 struct delayed_work phy_poll;
121 struct net_device *ndev;
122
120 spinlock_t lock; 123 spinlock_t lock;
121 124
122 struct mii_if_info mii; 125 struct mii_if_info mii;
@@ -297,6 +300,10 @@ static void dm9000_set_io(struct board_info *db, int byte_width)
297 } 300 }
298} 301}
299 302
303static void dm9000_schedule_poll(board_info_t *db)
304{
305 schedule_delayed_work(&db->phy_poll, HZ * 2);
306}
300 307
301/* Our watchdog timed out. Called by the networking layer */ 308/* Our watchdog timed out. Called by the networking layer */
302static void dm9000_timeout(struct net_device *dev) 309static void dm9000_timeout(struct net_device *dev)
@@ -465,6 +472,17 @@ static const struct ethtool_ops dm9000_ethtool_ops = {
465 .set_eeprom = dm9000_set_eeprom, 472 .set_eeprom = dm9000_set_eeprom,
466}; 473};
467 474
475static void
476dm9000_poll_work(struct work_struct *w)
477{
478 struct delayed_work *dw = container_of(w, struct delayed_work, work);
479 board_info_t *db = container_of(dw, board_info_t, phy_poll);
480
481 mii_check_media(&db->mii, netif_msg_link(db), 0);
482
483 if (netif_running(db->ndev))
484 dm9000_schedule_poll(db);
485}
468 486
469/* dm9000_release_board 487/* dm9000_release_board
470 * 488 *
@@ -503,7 +521,7 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
503/* 521/*
504 * Search DM9000 board, allocate space and register it 522 * Search DM9000 board, allocate space and register it
505 */ 523 */
506static int 524static int __devinit
507dm9000_probe(struct platform_device *pdev) 525dm9000_probe(struct platform_device *pdev)
508{ 526{
509 struct dm9000_plat_data *pdata = pdev->dev.platform_data; 527 struct dm9000_plat_data *pdata = pdev->dev.platform_data;
@@ -525,17 +543,21 @@ dm9000_probe(struct platform_device *pdev)
525 543
526 SET_NETDEV_DEV(ndev, &pdev->dev); 544 SET_NETDEV_DEV(ndev, &pdev->dev);
527 545
528 dev_dbg(&pdev->dev, "dm9000_probe()"); 546 dev_dbg(&pdev->dev, "dm9000_probe()\n");
529 547
530 /* setup board info structure */ 548 /* setup board info structure */
531 db = (struct board_info *) ndev->priv; 549 db = (struct board_info *) ndev->priv;
532 memset(db, 0, sizeof (*db)); 550 memset(db, 0, sizeof (*db));
533 551
534 db->dev = &pdev->dev; 552 db->dev = &pdev->dev;
553 db->ndev = ndev;
535 554
536 spin_lock_init(&db->lock); 555 spin_lock_init(&db->lock);
537 mutex_init(&db->addr_lock); 556 mutex_init(&db->addr_lock);
538 557
558 INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
559
560
539 if (pdev->num_resources < 2) { 561 if (pdev->num_resources < 2) {
540 ret = -ENODEV; 562 ret = -ENODEV;
541 goto out; 563 goto out;
@@ -761,6 +783,8 @@ dm9000_open(struct net_device *dev)
761 783
762 mii_check_media(&db->mii, netif_msg_link(db), 1); 784 mii_check_media(&db->mii, netif_msg_link(db), 1);
763 netif_start_queue(dev); 785 netif_start_queue(dev);
786
787 dm9000_schedule_poll(db);
764 788
765 return 0; 789 return 0;
766} 790}
@@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev)
879 if (netif_msg_ifdown(db)) 903 if (netif_msg_ifdown(db))
880 dev_dbg(db->dev, "shutting down %s\n", ndev->name); 904 dev_dbg(db->dev, "shutting down %s\n", ndev->name);
881 905
906 cancel_delayed_work_sync(&db->phy_poll);
907
882 netif_stop_queue(ndev); 908 netif_stop_queue(ndev);
883 netif_carrier_off(ndev); 909 netif_carrier_off(ndev);
884 910
@@ -1288,6 +1314,8 @@ dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1288 spin_unlock_irqrestore(&db->lock,flags); 1314 spin_unlock_irqrestore(&db->lock,flags);
1289 1315
1290 mutex_unlock(&db->addr_lock); 1316 mutex_unlock(&db->addr_lock);
1317
1318 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
1291 return ret; 1319 return ret;
1292} 1320}
1293 1321
@@ -1301,6 +1329,7 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
1301 unsigned long flags; 1329 unsigned long flags;
1302 unsigned long reg_save; 1330 unsigned long reg_save;
1303 1331
1332 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
1304 mutex_lock(&db->addr_lock); 1333 mutex_lock(&db->addr_lock);
1305 1334
1306 spin_lock_irqsave(&db->lock,flags); 1335 spin_lock_irqsave(&db->lock,flags);
@@ -1372,7 +1401,7 @@ dm9000_drv_resume(struct platform_device *dev)
1372 return 0; 1401 return 0;
1373} 1402}
1374 1403
1375static int 1404static int __devexit
1376dm9000_drv_remove(struct platform_device *pdev) 1405dm9000_drv_remove(struct platform_device *pdev)
1377{ 1406{
1378 struct net_device *ndev = platform_get_drvdata(pdev); 1407 struct net_device *ndev = platform_get_drvdata(pdev);
@@ -1393,7 +1422,7 @@ static struct platform_driver dm9000_driver = {
1393 .owner = THIS_MODULE, 1422 .owner = THIS_MODULE,
1394 }, 1423 },
1395 .probe = dm9000_probe, 1424 .probe = dm9000_probe,
1396 .remove = dm9000_drv_remove, 1425 .remove = __devexit_p(dm9000_drv_remove),
1397 .suspend = dm9000_drv_suspend, 1426 .suspend = dm9000_drv_suspend,
1398 .resume = dm9000_drv_resume, 1427 .resume = dm9000_drv_resume,
1399}; 1428};
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 8cbb40f3a506..cab1835173cd 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4201,8 +4201,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4201 struct e1000_adapter *adapter; 4201 struct e1000_adapter *adapter;
4202 struct e1000_hw *hw; 4202 struct e1000_hw *hw;
4203 const struct e1000_info *ei = e1000_info_tbl[ent->driver_data]; 4203 const struct e1000_info *ei = e1000_info_tbl[ent->driver_data];
4204 unsigned long mmio_start, mmio_len; 4204 resource_size_t mmio_start, mmio_len;
4205 unsigned long flash_start, flash_len; 4205 resource_size_t flash_start, flash_len;
4206 4206
4207 static int cards_found; 4207 static int cards_found;
4208 int i, err, pci_using_dac; 4208 int i, err, pci_using_dac;
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index f5dacceab95b..fe872fbd671e 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0090" 43#define DRV_VERSION "EHEA_0091"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
@@ -118,6 +118,13 @@
118#define EHEA_MR_ACC_CTRL 0x00800000 118#define EHEA_MR_ACC_CTRL 0x00800000
119 119
120#define EHEA_BUSMAP_START 0x8000000000000000ULL 120#define EHEA_BUSMAP_START 0x8000000000000000ULL
121#define EHEA_INVAL_ADDR 0xFFFFFFFFFFFFFFFFULL
122#define EHEA_DIR_INDEX_SHIFT 13 /* 8k Entries in 64k block */
123#define EHEA_TOP_INDEX_SHIFT (EHEA_DIR_INDEX_SHIFT * 2)
124#define EHEA_MAP_ENTRIES (1 << EHEA_DIR_INDEX_SHIFT)
125#define EHEA_MAP_SIZE (0x10000) /* currently fixed map size */
126#define EHEA_INDEX_MASK (EHEA_MAP_ENTRIES - 1)
127
121 128
122#define EHEA_WATCH_DOG_TIMEOUT 10*HZ 129#define EHEA_WATCH_DOG_TIMEOUT 10*HZ
123 130
@@ -192,10 +199,20 @@ struct h_epas {
192 set to 0 if unused */ 199 set to 0 if unused */
193}; 200};
194 201
195struct ehea_busmap { 202/*
196 unsigned int entries; /* total number of entries */ 203 * Memory map data structures
197 unsigned int valid_sections; /* number of valid sections */ 204 */
198 u64 *vaddr; 205struct ehea_dir_bmap
206{
207 u64 ent[EHEA_MAP_ENTRIES];
208};
209struct ehea_top_bmap
210{
211 struct ehea_dir_bmap *dir[EHEA_MAP_ENTRIES];
212};
213struct ehea_bmap
214{
215 struct ehea_top_bmap *top[EHEA_MAP_ENTRIES];
199}; 216};
200 217
201struct ehea_qp; 218struct ehea_qp;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f9bc21c74b59..075fd547421e 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -35,6 +35,7 @@
35#include <linux/if_ether.h> 35#include <linux/if_ether.h>
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/reboot.h> 37#include <linux/reboot.h>
38#include <linux/memory.h>
38#include <asm/kexec.h> 39#include <asm/kexec.h>
39#include <linux/mutex.h> 40#include <linux/mutex.h>
40 41
@@ -1765,16 +1766,20 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
1765 mutex_lock(&ehea_bcmc_regs.lock); 1766 mutex_lock(&ehea_bcmc_regs.lock);
1766 1767
1767 /* Deregister old MAC in pHYP */ 1768 /* Deregister old MAC in pHYP */
1768 ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); 1769 if (port->state == EHEA_PORT_UP) {
1769 if (ret) 1770 ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
1770 goto out_upregs; 1771 if (ret)
1772 goto out_upregs;
1773 }
1771 1774
1772 port->mac_addr = cb0->port_mac_addr << 16; 1775 port->mac_addr = cb0->port_mac_addr << 16;
1773 1776
1774 /* Register new MAC in pHYP */ 1777 /* Register new MAC in pHYP */
1775 ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); 1778 if (port->state == EHEA_PORT_UP) {
1776 if (ret) 1779 ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
1777 goto out_upregs; 1780 if (ret)
1781 goto out_upregs;
1782 }
1778 1783
1779 ret = 0; 1784 ret = 0;
1780 1785
@@ -2212,8 +2217,6 @@ static void ehea_vlan_rx_register(struct net_device *dev,
2212 goto out; 2217 goto out;
2213 } 2218 }
2214 2219
2215 memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
2216
2217 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 2220 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
2218 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 2221 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
2219 if (hret != H_SUCCESS) 2222 if (hret != H_SUCCESS)
@@ -2602,7 +2605,8 @@ static int ehea_stop(struct net_device *dev)
2602 if (netif_msg_ifdown(port)) 2605 if (netif_msg_ifdown(port))
2603 ehea_info("disabling port %s", dev->name); 2606 ehea_info("disabling port %s", dev->name);
2604 2607
2605 flush_scheduled_work(); 2608 cancel_work_sync(&port->reset_task);
2609
2606 mutex_lock(&port->port_lock); 2610 mutex_lock(&port->port_lock);
2607 netif_stop_queue(dev); 2611 netif_stop_queue(dev);
2608 port_napi_disable(port); 2612 port_napi_disable(port);
@@ -3177,11 +3181,12 @@ out_err:
3177 3181
3178static void ehea_shutdown_single_port(struct ehea_port *port) 3182static void ehea_shutdown_single_port(struct ehea_port *port)
3179{ 3183{
3184 struct ehea_adapter *adapter = port->adapter;
3180 unregister_netdev(port->netdev); 3185 unregister_netdev(port->netdev);
3181 ehea_unregister_port(port); 3186 ehea_unregister_port(port);
3182 kfree(port->mc_list); 3187 kfree(port->mc_list);
3183 free_netdev(port->netdev); 3188 free_netdev(port->netdev);
3184 port->adapter->active_ports--; 3189 adapter->active_ports--;
3185} 3190}
3186 3191
3187static int ehea_setup_ports(struct ehea_adapter *adapter) 3192static int ehea_setup_ports(struct ehea_adapter *adapter)
@@ -3503,6 +3508,24 @@ void ehea_crash_handler(void)
3503 0, H_DEREG_BCMC); 3508 0, H_DEREG_BCMC);
3504} 3509}
3505 3510
3511static int ehea_mem_notifier(struct notifier_block *nb,
3512 unsigned long action, void *data)
3513{
3514 switch (action) {
3515 case MEM_OFFLINE:
3516 ehea_info("memory has been removed");
3517 ehea_rereg_mrs(NULL);
3518 break;
3519 default:
3520 break;
3521 }
3522 return NOTIFY_OK;
3523}
3524
3525static struct notifier_block ehea_mem_nb = {
3526 .notifier_call = ehea_mem_notifier,
3527};
3528
3506static int ehea_reboot_notifier(struct notifier_block *nb, 3529static int ehea_reboot_notifier(struct notifier_block *nb,
3507 unsigned long action, void *unused) 3530 unsigned long action, void *unused)
3508{ 3531{
@@ -3581,6 +3604,10 @@ int __init ehea_module_init(void)
3581 if (ret) 3604 if (ret)
3582 ehea_info("failed registering reboot notifier"); 3605 ehea_info("failed registering reboot notifier");
3583 3606
3607 ret = register_memory_notifier(&ehea_mem_nb);
3608 if (ret)
3609 ehea_info("failed registering memory remove notifier");
3610
3584 ret = crash_shutdown_register(&ehea_crash_handler); 3611 ret = crash_shutdown_register(&ehea_crash_handler);
3585 if (ret) 3612 if (ret)
3586 ehea_info("failed registering crash handler"); 3613 ehea_info("failed registering crash handler");
@@ -3604,6 +3631,7 @@ int __init ehea_module_init(void)
3604out3: 3631out3:
3605 ibmebus_unregister_driver(&ehea_driver); 3632 ibmebus_unregister_driver(&ehea_driver);
3606out2: 3633out2:
3634 unregister_memory_notifier(&ehea_mem_nb);
3607 unregister_reboot_notifier(&ehea_reboot_nb); 3635 unregister_reboot_notifier(&ehea_reboot_nb);
3608 crash_shutdown_unregister(&ehea_crash_handler); 3636 crash_shutdown_unregister(&ehea_crash_handler);
3609out: 3637out:
@@ -3621,6 +3649,7 @@ static void __exit ehea_module_exit(void)
3621 ret = crash_shutdown_unregister(&ehea_crash_handler); 3649 ret = crash_shutdown_unregister(&ehea_crash_handler);
3622 if (ret) 3650 if (ret)
3623 ehea_info("failed unregistering crash handler"); 3651 ehea_info("failed unregistering crash handler");
3652 unregister_memory_notifier(&ehea_mem_nb);
3624 kfree(ehea_fw_handles.arr); 3653 kfree(ehea_fw_handles.arr);
3625 kfree(ehea_bcmc_regs.arr); 3654 kfree(ehea_bcmc_regs.arr);
3626 ehea_destroy_busmap(); 3655 ehea_destroy_busmap();
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index d522e905f460..140f05baafd8 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -31,8 +31,8 @@
31#include "ehea_phyp.h" 31#include "ehea_phyp.h"
32#include "ehea_qmr.h" 32#include "ehea_qmr.h"
33 33
34struct ehea_bmap *ehea_bmap = NULL;
34 35
35struct ehea_busmap ehea_bmap = { 0, 0, NULL };
36 36
37 37
38static void *hw_qpageit_get_inc(struct hw_queue *queue) 38static void *hw_qpageit_get_inc(struct hw_queue *queue)
@@ -559,125 +559,253 @@ int ehea_destroy_qp(struct ehea_qp *qp)
559 return 0; 559 return 0;
560} 560}
561 561
562int ehea_create_busmap(void) 562static inline int ehea_calc_index(unsigned long i, unsigned long s)
563{ 563{
564 u64 vaddr = EHEA_BUSMAP_START; 564 return (i >> s) & EHEA_INDEX_MASK;
565 unsigned long high_section_index = 0; 565}
566 int i;
567 566
568 /* 567static inline int ehea_init_top_bmap(struct ehea_top_bmap *ehea_top_bmap,
569 * Sections are not in ascending order -> Loop over all sections and 568 int dir)
570 * find the highest PFN to compute the required map size. 569{
571 */ 570 if(!ehea_top_bmap->dir[dir]) {
572 ehea_bmap.valid_sections = 0; 571 ehea_top_bmap->dir[dir] =
572 kzalloc(sizeof(struct ehea_dir_bmap), GFP_KERNEL);
573 if (!ehea_top_bmap->dir[dir])
574 return -ENOMEM;
575 }
576 return 0;
577}
573 578
574 for (i = 0; i < NR_MEM_SECTIONS; i++) 579static inline int ehea_init_bmap(struct ehea_bmap *ehea_bmap, int top, int dir)
575 if (valid_section_nr(i)) 580{
576 high_section_index = i; 581 if(!ehea_bmap->top[top]) {
582 ehea_bmap->top[top] =
583 kzalloc(sizeof(struct ehea_top_bmap), GFP_KERNEL);
584 if (!ehea_bmap->top[top])
585 return -ENOMEM;
586 }
587 return ehea_init_top_bmap(ehea_bmap->top[top], dir);
588}
577 589
578 ehea_bmap.entries = high_section_index + 1; 590static int ehea_create_busmap_callback(unsigned long pfn,
579 ehea_bmap.vaddr = vmalloc(ehea_bmap.entries * sizeof(*ehea_bmap.vaddr)); 591 unsigned long nr_pages, void *arg)
592{
593 unsigned long i, mr_len, start_section, end_section;
594 start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE;
595 end_section = start_section + ((nr_pages * PAGE_SIZE) / EHEA_SECTSIZE);
596 mr_len = *(unsigned long *)arg;
580 597
581 if (!ehea_bmap.vaddr) 598 ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL);
599 if (!ehea_bmap)
582 return -ENOMEM; 600 return -ENOMEM;
583 601
584 for (i = 0 ; i < ehea_bmap.entries; i++) { 602 for (i = start_section; i < end_section; i++) {
585 unsigned long pfn = section_nr_to_pfn(i); 603 int ret;
604 int top, dir, idx;
605 u64 vaddr;
606
607 top = ehea_calc_index(i, EHEA_TOP_INDEX_SHIFT);
608 dir = ehea_calc_index(i, EHEA_DIR_INDEX_SHIFT);
609
610 ret = ehea_init_bmap(ehea_bmap, top, dir);
611 if(ret)
612 return ret;
586 613
587 if (pfn_valid(pfn)) { 614 idx = i & EHEA_INDEX_MASK;
588 ehea_bmap.vaddr[i] = vaddr; 615 vaddr = EHEA_BUSMAP_START + mr_len + i * EHEA_SECTSIZE;
589 vaddr += EHEA_SECTSIZE; 616
590 ehea_bmap.valid_sections++; 617 ehea_bmap->top[top]->dir[dir]->ent[idx] = vaddr;
591 } else
592 ehea_bmap.vaddr[i] = 0;
593 } 618 }
594 619
620 mr_len += nr_pages * PAGE_SIZE;
621 *(unsigned long *)arg = mr_len;
622
595 return 0; 623 return 0;
596} 624}
597 625
626static unsigned long ehea_mr_len;
627
628static DEFINE_MUTEX(ehea_busmap_mutex);
629
630int ehea_create_busmap(void)
631{
632 int ret;
633 mutex_lock(&ehea_busmap_mutex);
634 ehea_mr_len = 0;
635 ret = walk_memory_resource(0, 1ULL << MAX_PHYSMEM_BITS, &ehea_mr_len,
636 ehea_create_busmap_callback);
637 mutex_unlock(&ehea_busmap_mutex);
638 return ret;
639}
640
598void ehea_destroy_busmap(void) 641void ehea_destroy_busmap(void)
599{ 642{
600 vfree(ehea_bmap.vaddr); 643 int top, dir;
644 mutex_lock(&ehea_busmap_mutex);
645 if (!ehea_bmap)
646 goto out_destroy;
647
648 for (top = 0; top < EHEA_MAP_ENTRIES; top++) {
649 if (!ehea_bmap->top[top])
650 continue;
651
652 for (dir = 0; dir < EHEA_MAP_ENTRIES; dir++) {
653 if (!ehea_bmap->top[top]->dir[dir])
654 continue;
655
656 kfree(ehea_bmap->top[top]->dir[dir]);
657 }
658
659 kfree(ehea_bmap->top[top]);
660 }
661
662 kfree(ehea_bmap);
663 ehea_bmap = NULL;
664out_destroy:
665 mutex_unlock(&ehea_busmap_mutex);
601} 666}
602 667
603u64 ehea_map_vaddr(void *caddr) 668u64 ehea_map_vaddr(void *caddr)
604{ 669{
605 u64 mapped_addr; 670 int top, dir, idx;
606 unsigned long index = __pa(caddr) >> SECTION_SIZE_BITS; 671 unsigned long index, offset;
607 672
608 if (likely(index < ehea_bmap.entries)) { 673 if (!ehea_bmap)
609 mapped_addr = ehea_bmap.vaddr[index]; 674 return EHEA_INVAL_ADDR;
610 if (likely(mapped_addr)) 675
611 mapped_addr |= (((unsigned long)caddr) 676 index = virt_to_abs(caddr) >> SECTION_SIZE_BITS;
612 & (EHEA_SECTSIZE - 1)); 677 top = (index >> EHEA_TOP_INDEX_SHIFT) & EHEA_INDEX_MASK;
613 else 678 if (!ehea_bmap->top[top])
614 mapped_addr = -1; 679 return EHEA_INVAL_ADDR;
615 } else 680
616 mapped_addr = -1; 681 dir = (index >> EHEA_DIR_INDEX_SHIFT) & EHEA_INDEX_MASK;
617 682 if (!ehea_bmap->top[top]->dir[dir])
618 if (unlikely(mapped_addr == -1)) 683 return EHEA_INVAL_ADDR;
619 if (!test_and_set_bit(__EHEA_STOP_XFER, &ehea_driver_flags)) 684
620 schedule_work(&ehea_rereg_mr_task); 685 idx = index & EHEA_INDEX_MASK;
621 686 if (!ehea_bmap->top[top]->dir[dir]->ent[idx])
622 return mapped_addr; 687 return EHEA_INVAL_ADDR;
688
689 offset = (unsigned long)caddr & (EHEA_SECTSIZE - 1);
690 return ehea_bmap->top[top]->dir[dir]->ent[idx] | offset;
691}
692
693static inline void *ehea_calc_sectbase(int top, int dir, int idx)
694{
695 unsigned long ret = idx;
696 ret |= dir << EHEA_DIR_INDEX_SHIFT;
697 ret |= top << EHEA_TOP_INDEX_SHIFT;
698 return abs_to_virt(ret << SECTION_SIZE_BITS);
699}
700
701static u64 ehea_reg_mr_section(int top, int dir, int idx, u64 *pt,
702 struct ehea_adapter *adapter,
703 struct ehea_mr *mr)
704{
705 void *pg;
706 u64 j, m, hret;
707 unsigned long k = 0;
708 u64 pt_abs = virt_to_abs(pt);
709
710 void *sectbase = ehea_calc_sectbase(top, dir, idx);
711
712 for (j = 0; j < (EHEA_PAGES_PER_SECTION / EHEA_MAX_RPAGE); j++) {
713
714 for (m = 0; m < EHEA_MAX_RPAGE; m++) {
715 pg = sectbase + ((k++) * EHEA_PAGESIZE);
716 pt[m] = virt_to_abs(pg);
717 }
718 hret = ehea_h_register_rpage_mr(adapter->handle, mr->handle, 0,
719 0, pt_abs, EHEA_MAX_RPAGE);
720
721 if ((hret != H_SUCCESS)
722 && (hret != H_PAGE_REGISTERED)) {
723 ehea_h_free_resource(adapter->handle, mr->handle,
724 FORCE_FREE);
725 ehea_error("register_rpage_mr failed");
726 return hret;
727 }
728 }
729 return hret;
730}
731
732static u64 ehea_reg_mr_sections(int top, int dir, u64 *pt,
733 struct ehea_adapter *adapter,
734 struct ehea_mr *mr)
735{
736 u64 hret = H_SUCCESS;
737 int idx;
738
739 for (idx = 0; idx < EHEA_MAP_ENTRIES; idx++) {
740 if (!ehea_bmap->top[top]->dir[dir]->ent[idx])
741 continue;
742
743 hret = ehea_reg_mr_section(top, dir, idx, pt, adapter, mr);
744 if ((hret != H_SUCCESS) && (hret != H_PAGE_REGISTERED))
745 return hret;
746 }
747 return hret;
748}
749
750static u64 ehea_reg_mr_dir_sections(int top, u64 *pt,
751 struct ehea_adapter *adapter,
752 struct ehea_mr *mr)
753{
754 u64 hret = H_SUCCESS;
755 int dir;
756
757 for (dir = 0; dir < EHEA_MAP_ENTRIES; dir++) {
758 if (!ehea_bmap->top[top]->dir[dir])
759 continue;
760
761 hret = ehea_reg_mr_sections(top, dir, pt, adapter, mr);
762 if ((hret != H_SUCCESS) && (hret != H_PAGE_REGISTERED))
763 return hret;
764 }
765 return hret;
623} 766}
624 767
625int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) 768int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr)
626{ 769{
627 int ret; 770 int ret;
628 u64 *pt; 771 u64 *pt;
629 void *pg; 772 u64 hret;
630 u64 hret, pt_abs, i, j, m, mr_len;
631 u32 acc_ctrl = EHEA_MR_ACC_CTRL; 773 u32 acc_ctrl = EHEA_MR_ACC_CTRL;
632 774
633 mr_len = ehea_bmap.valid_sections * EHEA_SECTSIZE; 775 unsigned long top;
634 776
635 pt = kzalloc(PAGE_SIZE, GFP_KERNEL); 777 pt = kzalloc(PAGE_SIZE, GFP_KERNEL);
636 if (!pt) { 778 if (!pt) {
637 ehea_error("no mem"); 779 ehea_error("no mem");
638 ret = -ENOMEM; 780 ret = -ENOMEM;
639 goto out; 781 goto out;
640 } 782 }
641 pt_abs = virt_to_abs(pt);
642 783
643 hret = ehea_h_alloc_resource_mr(adapter->handle, 784 hret = ehea_h_alloc_resource_mr(adapter->handle, EHEA_BUSMAP_START,
644 EHEA_BUSMAP_START, mr_len, 785 ehea_mr_len, acc_ctrl, adapter->pd,
645 acc_ctrl, adapter->pd,
646 &mr->handle, &mr->lkey); 786 &mr->handle, &mr->lkey);
787
647 if (hret != H_SUCCESS) { 788 if (hret != H_SUCCESS) {
648 ehea_error("alloc_resource_mr failed"); 789 ehea_error("alloc_resource_mr failed");
649 ret = -EIO; 790 ret = -EIO;
650 goto out; 791 goto out;
651 } 792 }
652 793
653 for (i = 0 ; i < ehea_bmap.entries; i++) 794 if (!ehea_bmap) {
654 if (ehea_bmap.vaddr[i]) { 795 ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE);
655 void *sectbase = __va(i << SECTION_SIZE_BITS); 796 ehea_error("no busmap available");
656 unsigned long k = 0; 797 ret = -EIO;
657 798 goto out;
658 for (j = 0; j < (EHEA_PAGES_PER_SECTION / 799 }
659 EHEA_MAX_RPAGE); j++) { 800
660 801 for (top = 0; top < EHEA_MAP_ENTRIES; top++) {
661 for (m = 0; m < EHEA_MAX_RPAGE; m++) { 802 if (!ehea_bmap->top[top])
662 pg = sectbase + ((k++) * EHEA_PAGESIZE); 803 continue;
663 pt[m] = virt_to_abs(pg); 804
664 } 805 hret = ehea_reg_mr_dir_sections(top, pt, adapter, mr);
665 806 if((hret != H_PAGE_REGISTERED) && (hret != H_SUCCESS))
666 hret = ehea_h_register_rpage_mr(adapter->handle, 807 break;
667 mr->handle, 808 }
668 0, 0, pt_abs,
669 EHEA_MAX_RPAGE);
670 if ((hret != H_SUCCESS)
671 && (hret != H_PAGE_REGISTERED)) {
672 ehea_h_free_resource(adapter->handle,
673 mr->handle,
674 FORCE_FREE);
675 ehea_error("register_rpage_mr failed");
676 ret = -EIO;
677 goto out;
678 }
679 }
680 }
681 809
682 if (hret != H_SUCCESS) { 810 if (hret != H_SUCCESS) {
683 ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE); 811 ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE);
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 5f9c42e7a7f1..329edd9c08fc 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -78,7 +78,7 @@ module_param_array_named(mac, mpc52xx_fec_mac_addr, byte, NULL, 0);
78MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe"); 78MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe");
79 79
80#define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \ 80#define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \
81 NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFDOWN ) 81 NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP)
82static int debug = -1; /* the above default */ 82static int debug = -1; /* the above default */
83module_param(debug, int, 0); 83module_param(debug, int, 0);
84MODULE_PARM_DESC(debug, "debugging messages level"); 84MODULE_PARM_DESC(debug, "debugging messages level");
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 35f66d4a4595..2cb244763292 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -3273,6 +3273,20 @@ static void nv_link_irq(struct net_device *dev)
3273 dprintk(KERN_DEBUG "%s: link change notification done.\n", dev->name); 3273 dprintk(KERN_DEBUG "%s: link change notification done.\n", dev->name);
3274} 3274}
3275 3275
3276static void nv_msi_workaround(struct fe_priv *np)
3277{
3278
3279 /* Need to toggle the msi irq mask within the ethernet device,
3280 * otherwise, future interrupts will not be detected.
3281 */
3282 if (np->msi_flags & NV_MSI_ENABLED) {
3283 u8 __iomem *base = np->base;
3284
3285 writel(0, base + NvRegMSIIrqMask);
3286 writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask);
3287 }
3288}
3289
3276static irqreturn_t nv_nic_irq(int foo, void *data) 3290static irqreturn_t nv_nic_irq(int foo, void *data)
3277{ 3291{
3278 struct net_device *dev = (struct net_device *) data; 3292 struct net_device *dev = (struct net_device *) data;
@@ -3295,6 +3309,8 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3295 if (!(events & np->irqmask)) 3309 if (!(events & np->irqmask))
3296 break; 3310 break;
3297 3311
3312 nv_msi_workaround(np);
3313
3298 spin_lock(&np->lock); 3314 spin_lock(&np->lock);
3299 nv_tx_done(dev); 3315 nv_tx_done(dev);
3300 spin_unlock(&np->lock); 3316 spin_unlock(&np->lock);
@@ -3410,6 +3426,8 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3410 if (!(events & np->irqmask)) 3426 if (!(events & np->irqmask))
3411 break; 3427 break;
3412 3428
3429 nv_msi_workaround(np);
3430
3413 spin_lock(&np->lock); 3431 spin_lock(&np->lock);
3414 nv_tx_done_optimized(dev, TX_WORK_PER_LOOP); 3432 nv_tx_done_optimized(dev, TX_WORK_PER_LOOP);
3415 spin_unlock(&np->lock); 3433 spin_unlock(&np->lock);
@@ -3750,6 +3768,8 @@ static irqreturn_t nv_nic_irq_test(int foo, void *data)
3750 if (!(events & NVREG_IRQ_TIMER)) 3768 if (!(events & NVREG_IRQ_TIMER))
3751 return IRQ_RETVAL(0); 3769 return IRQ_RETVAL(0);
3752 3770
3771 nv_msi_workaround(np);
3772
3753 spin_lock(&np->lock); 3773 spin_lock(&np->lock);
3754 np->intr_test = 1; 3774 np->intr_test = 1;
3755 spin_unlock(&np->lock); 3775 spin_unlock(&np->lock);
@@ -5823,6 +5843,7 @@ static int nv_resume(struct pci_dev *pdev)
5823 writel(txreg, base + NvRegTransmitPoll); 5843 writel(txreg, base + NvRegTransmitPoll);
5824 5844
5825 rc = nv_open(dev); 5845 rc = nv_open(dev);
5846 nv_set_multicast(dev);
5826out: 5847out:
5827 return rc; 5848 return rc;
5828} 5849}
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 67b4b0728fce..a5baaf59ff66 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1093,7 +1093,7 @@ err:
1093 if (registered) 1093 if (registered)
1094 unregister_netdev(ndev); 1094 unregister_netdev(ndev);
1095 1095
1096 if (fep != NULL) { 1096 if (fep && fep->ops) {
1097 (*fep->ops->free_bd)(ndev); 1097 (*fep->ops->free_bd)(ndev);
1098 (*fep->ops->cleanup_data)(ndev); 1098 (*fep->ops->cleanup_data)(ndev);
1099 } 1099 }
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6f22f068d6ee..25bdd0832df5 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -635,6 +635,8 @@ static void free_skb_resources(struct gfar_private *priv)
635 dev_kfree_skb_any(priv->tx_skbuff[i]); 635 dev_kfree_skb_any(priv->tx_skbuff[i]);
636 priv->tx_skbuff[i] = NULL; 636 priv->tx_skbuff[i] = NULL;
637 } 637 }
638
639 txbdp++;
638 } 640 }
639 641
640 kfree(priv->tx_skbuff); 642 kfree(priv->tx_skbuff);
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index dde9c7e6408a..00bc7fbb6b37 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -959,7 +959,7 @@ static int epp_close(struct net_device *dev)
959 unsigned char tmp[1]; 959 unsigned char tmp[1];
960 960
961 bc->work_running = 0; 961 bc->work_running = 0;
962 flush_scheduled_work(); 962 cancel_delayed_work_sync(&bc->run_work);
963 bc->stat = EPP_DCDBIT; 963 bc->stat = EPP_DCDBIT;
964 tmp[0] = 0; 964 tmp[0] = 0;
965 pp->ops->epp_write_addr(pp, tmp, 1, 0); 965 pp->ops->epp_write_addr(pp, tmp, 1, 0);
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index f90515935833..45ae9d1191d7 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1340,9 +1340,10 @@ static unsigned int scc_set_param(struct scc_channel *scc, unsigned int cmd, uns
1340 case PARAM_RTS: 1340 case PARAM_RTS:
1341 if ( !(scc->wreg[R5] & RTS) ) 1341 if ( !(scc->wreg[R5] & RTS) )
1342 { 1342 {
1343 if (arg != TX_OFF) 1343 if (arg != TX_OFF) {
1344 scc_key_trx(scc, TX_ON); 1344 scc_key_trx(scc, TX_ON);
1345 scc_start_tx_timer(scc, t_txdelay, scc->kiss.txdelay); 1345 scc_start_tx_timer(scc, t_txdelay, scc->kiss.txdelay);
1346 }
1346 } else { 1347 } else {
1347 if (arg == TX_OFF) 1348 if (arg == TX_OFF)
1348 { 1349 {
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 9b358f61ed7f..679a0826780e 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -577,12 +577,12 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
577 /* NIC to be configured in promiscuous mode. */ 577 /* NIC to be configured in promiscuous mode. */
578 receivemode = IPG_RM_RECEIVEALLFRAMES; 578 receivemode = IPG_RM_RECEIVEALLFRAMES;
579 } else if ((dev->flags & IFF_ALLMULTI) || 579 } else if ((dev->flags & IFF_ALLMULTI) ||
580 (dev->flags & IFF_MULTICAST & 580 ((dev->flags & IFF_MULTICAST) &&
581 (dev->mc_count > IPG_MULTICAST_HASHTABLE_SIZE))) { 581 (dev->mc_count > IPG_MULTICAST_HASHTABLE_SIZE))) {
582 /* NIC to be configured to receive all multicast 582 /* NIC to be configured to receive all multicast
583 * frames. */ 583 * frames. */
584 receivemode |= IPG_RM_RECEIVEMULTICAST; 584 receivemode |= IPG_RM_RECEIVEMULTICAST;
585 } else if (dev->flags & IFF_MULTICAST & (dev->mc_count > 0)) { 585 } else if ((dev->flags & IFF_MULTICAST) && (dev->mc_count > 0)) {
586 /* NIC to be configured to receive selected 586 /* NIC to be configured to receive selected
587 * multicast addresses. */ 587 * multicast addresses. */
588 receivemode |= IPG_RM_RECEIVEMULTICASTHASH; 588 receivemode |= IPG_RM_RECEIVEMULTICASTHASH;
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
index ce816ba9c40d..e6317557a531 100644
--- a/drivers/net/irda/Kconfig
+++ b/drivers/net/irda/Kconfig
@@ -329,6 +329,7 @@ config PXA_FICP
329config MCS_FIR 329config MCS_FIR
330 tristate "MosChip MCS7780 IrDA-USB dongle" 330 tristate "MosChip MCS7780 IrDA-USB dongle"
331 depends on IRDA && USB && EXPERIMENTAL 331 depends on IRDA && USB && EXPERIMENTAL
332 select CRC32
332 help 333 help
333 Say Y or M here if you want to build support for the MosChip 334 Say Y or M here if you want to build support for the MosChip
334 MCS7780 IrDA-USB bridge device driver. 335 MCS7780 IrDA-USB bridge device driver.
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 9081234ab458..6f50ed7b183f 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1120,7 +1120,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1120 } 1120 }
1121 } 1121 }
1122 1122
1123 if (self->usbdev->descriptor.bcdDevice == fw_version) { 1123 if (self->usbdev->descriptor.bcdDevice == cpu_to_le16(fw_version)) {
1124 /* 1124 /*
1125 * If we're here, we've found a correct patch 1125 * If we're here, we've found a correct patch
1126 * The actual image starts after the "STMP" keyword 1126 * The actual image starts after the "STMP" keyword
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index e846c38224a3..a0ca9c1fe196 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -117,11 +117,11 @@
117struct irda_class_desc { 117struct irda_class_desc {
118 __u8 bLength; 118 __u8 bLength;
119 __u8 bDescriptorType; 119 __u8 bDescriptorType;
120 __u16 bcdSpecRevision; 120 __le16 bcdSpecRevision;
121 __u8 bmDataSize; 121 __u8 bmDataSize;
122 __u8 bmWindowSize; 122 __u8 bmWindowSize;
123 __u8 bmMinTurnaroundTime; 123 __u8 bmMinTurnaroundTime;
124 __u16 wBaudRate; 124 __le16 wBaudRate;
125 __u8 bmAdditionalBOFs; 125 __u8 bmAdditionalBOFs;
126 __u8 bIrdaRateSniff; 126 __u8 bIrdaRateSniff;
127 __u8 bMaxUnicastList; 127 __u8 bMaxUnicastList;
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 6321b059ce13..2f38e847e2cd 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -58,8 +58,8 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw);
58 58
59static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) 59static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
60{ 60{
61 hw->mac.num_rx_queues = IXGBE_82598_MAX_TX_QUEUES; 61 hw->mac.num_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
62 hw->mac.num_tx_queues = IXGBE_82598_MAX_RX_QUEUES; 62 hw->mac.num_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
63 hw->mac.num_rx_addrs = IXGBE_82598_RAR_ENTRIES; 63 hw->mac.num_rx_addrs = IXGBE_82598_RAR_ENTRIES;
64 64
65 /* PHY ops are filled in by default properly for Fiber only */ 65 /* PHY ops are filled in by default properly for Fiber only */
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 2a66e5b7cebc..4ce8afd481c3 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -183,6 +183,9 @@ struct net_device * __init mac89x0_probe(int unit)
183 int err = -ENODEV; 183 int err = -ENODEV;
184 DECLARE_MAC_BUF(mac); 184 DECLARE_MAC_BUF(mac);
185 185
186 if (!MACH_IS_MAC)
187 return ERR_PTR(-ENODEV);
188
186 dev = alloc_etherdev(sizeof(struct net_local)); 189 dev = alloc_etherdev(sizeof(struct net_local));
187 if (!dev) 190 if (!dev)
188 return ERR_PTR(-ENOMEM); 191 return ERR_PTR(-ENOMEM);
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index 18770527df99..51ad3765e075 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -781,6 +781,9 @@ static int __init mac_mace_init_module(void)
781{ 781{
782 int err; 782 int err;
783 783
784 if (!MACH_IS_MAC)
785 return -ENODEV;
786
784 if ((err = platform_driver_register(&mac_mace_driver))) { 787 if ((err = platform_driver_register(&mac_mace_driver))) {
785 printk(KERN_ERR "Driver registration failed\n"); 788 printk(KERN_ERR "Driver registration failed\n");
786 return err; 789 return err;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index ef63c8d2bd7e..e0d76c75aea0 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -75,7 +75,7 @@
75#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
76#include "myri10ge_mcp_gen_header.h" 76#include "myri10ge_mcp_gen_header.h"
77 77
78#define MYRI10GE_VERSION_STR "1.3.2-1.287" 78#define MYRI10GE_VERSION_STR "1.3.99-1.347"
79 79
80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
81MODULE_AUTHOR("Maintainer: help@myri.com"); 81MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -144,11 +144,13 @@ struct myri10ge_tx_buf {
144 char *req_bytes; 144 char *req_bytes;
145 struct myri10ge_tx_buffer_state *info; 145 struct myri10ge_tx_buffer_state *info;
146 int mask; /* number of transmit slots -1 */ 146 int mask; /* number of transmit slots -1 */
147 int boundary; /* boundary transmits cannot cross */
148 int req ____cacheline_aligned; /* transmit slots submitted */ 147 int req ____cacheline_aligned; /* transmit slots submitted */
149 int pkt_start; /* packets started */ 148 int pkt_start; /* packets started */
149 int stop_queue;
150 int linearized;
150 int done ____cacheline_aligned; /* transmit slots completed */ 151 int done ____cacheline_aligned; /* transmit slots completed */
151 int pkt_done; /* packets completed */ 152 int pkt_done; /* packets completed */
153 int wake_queue;
152}; 154};
153 155
154struct myri10ge_rx_done { 156struct myri10ge_rx_done {
@@ -160,29 +162,50 @@ struct myri10ge_rx_done {
160 struct net_lro_desc lro_desc[MYRI10GE_MAX_LRO_DESCRIPTORS]; 162 struct net_lro_desc lro_desc[MYRI10GE_MAX_LRO_DESCRIPTORS];
161}; 163};
162 164
163struct myri10ge_priv { 165struct myri10ge_slice_netstats {
164 int running; /* running? */ 166 unsigned long rx_packets;
165 int csum_flag; /* rx_csums? */ 167 unsigned long tx_packets;
168 unsigned long rx_bytes;
169 unsigned long tx_bytes;
170 unsigned long rx_dropped;
171 unsigned long tx_dropped;
172};
173
174struct myri10ge_slice_state {
166 struct myri10ge_tx_buf tx; /* transmit ring */ 175 struct myri10ge_tx_buf tx; /* transmit ring */
167 struct myri10ge_rx_buf rx_small; 176 struct myri10ge_rx_buf rx_small;
168 struct myri10ge_rx_buf rx_big; 177 struct myri10ge_rx_buf rx_big;
169 struct myri10ge_rx_done rx_done; 178 struct myri10ge_rx_done rx_done;
179 struct net_device *dev;
180 struct napi_struct napi;
181 struct myri10ge_priv *mgp;
182 struct myri10ge_slice_netstats stats;
183 __be32 __iomem *irq_claim;
184 struct mcp_irq_data *fw_stats;
185 dma_addr_t fw_stats_bus;
186 int watchdog_tx_done;
187 int watchdog_tx_req;
188};
189
190struct myri10ge_priv {
191 struct myri10ge_slice_state ss;
192 int tx_boundary; /* boundary transmits cannot cross */
193 int running; /* running? */
194 int csum_flag; /* rx_csums? */
170 int small_bytes; 195 int small_bytes;
171 int big_bytes; 196 int big_bytes;
197 int max_intr_slots;
172 struct net_device *dev; 198 struct net_device *dev;
173 struct napi_struct napi;
174 struct net_device_stats stats; 199 struct net_device_stats stats;
200 spinlock_t stats_lock;
175 u8 __iomem *sram; 201 u8 __iomem *sram;
176 int sram_size; 202 int sram_size;
177 unsigned long board_span; 203 unsigned long board_span;
178 unsigned long iomem_base; 204 unsigned long iomem_base;
179 __be32 __iomem *irq_claim;
180 __be32 __iomem *irq_deassert; 205 __be32 __iomem *irq_deassert;
181 char *mac_addr_string; 206 char *mac_addr_string;
182 struct mcp_cmd_response *cmd; 207 struct mcp_cmd_response *cmd;
183 dma_addr_t cmd_bus; 208 dma_addr_t cmd_bus;
184 struct mcp_irq_data *fw_stats;
185 dma_addr_t fw_stats_bus;
186 struct pci_dev *pdev; 209 struct pci_dev *pdev;
187 int msi_enabled; 210 int msi_enabled;
188 u32 link_state; 211 u32 link_state;
@@ -191,20 +214,16 @@ struct myri10ge_priv {
191 __be32 __iomem *intr_coal_delay_ptr; 214 __be32 __iomem *intr_coal_delay_ptr;
192 int mtrr; 215 int mtrr;
193 int wc_enabled; 216 int wc_enabled;
194 int wake_queue;
195 int stop_queue;
196 int down_cnt; 217 int down_cnt;
197 wait_queue_head_t down_wq; 218 wait_queue_head_t down_wq;
198 struct work_struct watchdog_work; 219 struct work_struct watchdog_work;
199 struct timer_list watchdog_timer; 220 struct timer_list watchdog_timer;
200 int watchdog_tx_done;
201 int watchdog_tx_req;
202 int watchdog_pause;
203 int watchdog_resets; 221 int watchdog_resets;
204 int tx_linearized; 222 int watchdog_pause;
205 int pause; 223 int pause;
206 char *fw_name; 224 char *fw_name;
207 char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE]; 225 char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE];
226 char *product_code_string;
208 char fw_version[128]; 227 char fw_version[128];
209 int fw_ver_major; 228 int fw_ver_major;
210 int fw_ver_minor; 229 int fw_ver_minor;
@@ -228,58 +247,54 @@ static char *myri10ge_fw_aligned = "myri10ge_eth_z8e.dat";
228 247
229static char *myri10ge_fw_name = NULL; 248static char *myri10ge_fw_name = NULL;
230module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); 249module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR);
231MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name\n"); 250MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name");
232 251
233static int myri10ge_ecrc_enable = 1; 252static int myri10ge_ecrc_enable = 1;
234module_param(myri10ge_ecrc_enable, int, S_IRUGO); 253module_param(myri10ge_ecrc_enable, int, S_IRUGO);
235MODULE_PARM_DESC(myri10ge_ecrc_enable, "Enable Extended CRC on PCI-E\n"); 254MODULE_PARM_DESC(myri10ge_ecrc_enable, "Enable Extended CRC on PCI-E");
236
237static int myri10ge_max_intr_slots = 1024;
238module_param(myri10ge_max_intr_slots, int, S_IRUGO);
239MODULE_PARM_DESC(myri10ge_max_intr_slots, "Interrupt queue slots\n");
240 255
241static int myri10ge_small_bytes = -1; /* -1 == auto */ 256static int myri10ge_small_bytes = -1; /* -1 == auto */
242module_param(myri10ge_small_bytes, int, S_IRUGO | S_IWUSR); 257module_param(myri10ge_small_bytes, int, S_IRUGO | S_IWUSR);
243MODULE_PARM_DESC(myri10ge_small_bytes, "Threshold of small packets\n"); 258MODULE_PARM_DESC(myri10ge_small_bytes, "Threshold of small packets");
244 259
245static int myri10ge_msi = 1; /* enable msi by default */ 260static int myri10ge_msi = 1; /* enable msi by default */
246module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR); 261module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR);
247MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n"); 262MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts");
248 263
249static int myri10ge_intr_coal_delay = 75; 264static int myri10ge_intr_coal_delay = 75;
250module_param(myri10ge_intr_coal_delay, int, S_IRUGO); 265module_param(myri10ge_intr_coal_delay, int, S_IRUGO);
251MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n"); 266MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay");
252 267
253static int myri10ge_flow_control = 1; 268static int myri10ge_flow_control = 1;
254module_param(myri10ge_flow_control, int, S_IRUGO); 269module_param(myri10ge_flow_control, int, S_IRUGO);
255MODULE_PARM_DESC(myri10ge_flow_control, "Pause parameter\n"); 270MODULE_PARM_DESC(myri10ge_flow_control, "Pause parameter");
256 271
257static int myri10ge_deassert_wait = 1; 272static int myri10ge_deassert_wait = 1;
258module_param(myri10ge_deassert_wait, int, S_IRUGO | S_IWUSR); 273module_param(myri10ge_deassert_wait, int, S_IRUGO | S_IWUSR);
259MODULE_PARM_DESC(myri10ge_deassert_wait, 274MODULE_PARM_DESC(myri10ge_deassert_wait,
260 "Wait when deasserting legacy interrupts\n"); 275 "Wait when deasserting legacy interrupts");
261 276
262static int myri10ge_force_firmware = 0; 277static int myri10ge_force_firmware = 0;
263module_param(myri10ge_force_firmware, int, S_IRUGO); 278module_param(myri10ge_force_firmware, int, S_IRUGO);
264MODULE_PARM_DESC(myri10ge_force_firmware, 279MODULE_PARM_DESC(myri10ge_force_firmware,
265 "Force firmware to assume aligned completions\n"); 280 "Force firmware to assume aligned completions");
266 281
267static int myri10ge_initial_mtu = MYRI10GE_MAX_ETHER_MTU - ETH_HLEN; 282static int myri10ge_initial_mtu = MYRI10GE_MAX_ETHER_MTU - ETH_HLEN;
268module_param(myri10ge_initial_mtu, int, S_IRUGO); 283module_param(myri10ge_initial_mtu, int, S_IRUGO);
269MODULE_PARM_DESC(myri10ge_initial_mtu, "Initial MTU\n"); 284MODULE_PARM_DESC(myri10ge_initial_mtu, "Initial MTU");
270 285
271static int myri10ge_napi_weight = 64; 286static int myri10ge_napi_weight = 64;
272module_param(myri10ge_napi_weight, int, S_IRUGO); 287module_param(myri10ge_napi_weight, int, S_IRUGO);
273MODULE_PARM_DESC(myri10ge_napi_weight, "Set NAPI weight\n"); 288MODULE_PARM_DESC(myri10ge_napi_weight, "Set NAPI weight");
274 289
275static int myri10ge_watchdog_timeout = 1; 290static int myri10ge_watchdog_timeout = 1;
276module_param(myri10ge_watchdog_timeout, int, S_IRUGO); 291module_param(myri10ge_watchdog_timeout, int, S_IRUGO);
277MODULE_PARM_DESC(myri10ge_watchdog_timeout, "Set watchdog timeout\n"); 292MODULE_PARM_DESC(myri10ge_watchdog_timeout, "Set watchdog timeout");
278 293
279static int myri10ge_max_irq_loops = 1048576; 294static int myri10ge_max_irq_loops = 1048576;
280module_param(myri10ge_max_irq_loops, int, S_IRUGO); 295module_param(myri10ge_max_irq_loops, int, S_IRUGO);
281MODULE_PARM_DESC(myri10ge_max_irq_loops, 296MODULE_PARM_DESC(myri10ge_max_irq_loops,
282 "Set stuck legacy IRQ detection threshold\n"); 297 "Set stuck legacy IRQ detection threshold");
283 298
284#define MYRI10GE_MSG_DEFAULT NETIF_MSG_LINK 299#define MYRI10GE_MSG_DEFAULT NETIF_MSG_LINK
285 300
@@ -289,21 +304,22 @@ MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)");
289 304
290static int myri10ge_lro = 1; 305static int myri10ge_lro = 1;
291module_param(myri10ge_lro, int, S_IRUGO); 306module_param(myri10ge_lro, int, S_IRUGO);
292MODULE_PARM_DESC(myri10ge_lro, "Enable large receive offload\n"); 307MODULE_PARM_DESC(myri10ge_lro, "Enable large receive offload");
293 308
294static int myri10ge_lro_max_pkts = MYRI10GE_LRO_MAX_PKTS; 309static int myri10ge_lro_max_pkts = MYRI10GE_LRO_MAX_PKTS;
295module_param(myri10ge_lro_max_pkts, int, S_IRUGO); 310module_param(myri10ge_lro_max_pkts, int, S_IRUGO);
296MODULE_PARM_DESC(myri10ge_lro, "Number of LRO packets to be aggregated\n"); 311MODULE_PARM_DESC(myri10ge_lro_max_pkts,
312 "Number of LRO packets to be aggregated");
297 313
298static int myri10ge_fill_thresh = 256; 314static int myri10ge_fill_thresh = 256;
299module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); 315module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
300MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); 316MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed");
301 317
302static int myri10ge_reset_recover = 1; 318static int myri10ge_reset_recover = 1;
303 319
304static int myri10ge_wcfifo = 0; 320static int myri10ge_wcfifo = 0;
305module_param(myri10ge_wcfifo, int, S_IRUGO); 321module_param(myri10ge_wcfifo, int, S_IRUGO);
306MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); 322MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled");
307 323
308#define MYRI10GE_FW_OFFSET 1024*1024 324#define MYRI10GE_FW_OFFSET 1024*1024
309#define MYRI10GE_HIGHPART_TO_U32(X) \ 325#define MYRI10GE_HIGHPART_TO_U32(X) \
@@ -359,8 +375,10 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
359 for (sleep_total = 0; 375 for (sleep_total = 0;
360 sleep_total < 1000 376 sleep_total < 1000
361 && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT); 377 && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
362 sleep_total += 10) 378 sleep_total += 10) {
363 udelay(10); 379 udelay(10);
380 mb();
381 }
364 } else { 382 } else {
365 /* use msleep for most command */ 383 /* use msleep for most command */
366 for (sleep_total = 0; 384 for (sleep_total = 0;
@@ -420,6 +438,10 @@ static int myri10ge_read_mac_addr(struct myri10ge_priv *mgp)
420 ptr += 1; 438 ptr += 1;
421 } 439 }
422 } 440 }
441 if (memcmp(ptr, "PC=", 3) == 0) {
442 ptr += 3;
443 mgp->product_code_string = ptr;
444 }
423 if (memcmp((const void *)ptr, "SN=", 3) == 0) { 445 if (memcmp((const void *)ptr, "SN=", 3) == 0) {
424 ptr += 3; 446 ptr += 3;
425 mgp->serial_number = simple_strtoul(ptr, &ptr, 10); 447 mgp->serial_number = simple_strtoul(ptr, &ptr, 10);
@@ -442,7 +464,7 @@ abort:
442static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) 464static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
443{ 465{
444 char __iomem *submit; 466 char __iomem *submit;
445 __be32 buf[16]; 467 __be32 buf[16] __attribute__ ((__aligned__(8)));
446 u32 dma_low, dma_high; 468 u32 dma_low, dma_high;
447 int i; 469 int i;
448 470
@@ -609,13 +631,38 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp)
609 return status; 631 return status;
610} 632}
611 633
634static int myri10ge_get_firmware_capabilities(struct myri10ge_priv *mgp)
635{
636 struct myri10ge_cmd cmd;
637 int status;
638
639 /* probe for IPv6 TSO support */
640 mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
641 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
642 &cmd, 0);
643 if (status == 0) {
644 mgp->max_tso6 = cmd.data0;
645 mgp->features |= NETIF_F_TSO6;
646 }
647
648 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
649 if (status != 0) {
650 dev_err(&mgp->pdev->dev,
651 "failed MXGEFW_CMD_GET_RX_RING_SIZE\n");
652 return -ENXIO;
653 }
654
655 mgp->max_intr_slots = 2 * (cmd.data0 / sizeof(struct mcp_dma_addr));
656
657 return 0;
658}
659
612static int myri10ge_load_firmware(struct myri10ge_priv *mgp) 660static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
613{ 661{
614 char __iomem *submit; 662 char __iomem *submit;
615 __be32 buf[16]; 663 __be32 buf[16] __attribute__ ((__aligned__(8)));
616 u32 dma_low, dma_high, size; 664 u32 dma_low, dma_high, size;
617 int status, i; 665 int status, i;
618 struct myri10ge_cmd cmd;
619 666
620 size = 0; 667 size = 0;
621 status = myri10ge_load_hotplug_firmware(mgp, &size); 668 status = myri10ge_load_hotplug_firmware(mgp, &size);
@@ -635,7 +682,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
635 } 682 }
636 dev_info(&mgp->pdev->dev, 683 dev_info(&mgp->pdev->dev,
637 "Successfully adopted running firmware\n"); 684 "Successfully adopted running firmware\n");
638 if (mgp->tx.boundary == 4096) { 685 if (mgp->tx_boundary == 4096) {
639 dev_warn(&mgp->pdev->dev, 686 dev_warn(&mgp->pdev->dev,
640 "Using firmware currently running on NIC" 687 "Using firmware currently running on NIC"
641 ". For optimal\n"); 688 ". For optimal\n");
@@ -646,7 +693,9 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
646 } 693 }
647 694
648 mgp->fw_name = "adopted"; 695 mgp->fw_name = "adopted";
649 mgp->tx.boundary = 2048; 696 mgp->tx_boundary = 2048;
697 myri10ge_dummy_rdma(mgp, 1);
698 status = myri10ge_get_firmware_capabilities(mgp);
650 return status; 699 return status;
651 } 700 }
652 701
@@ -681,26 +730,18 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
681 msleep(1); 730 msleep(1);
682 mb(); 731 mb();
683 i = 0; 732 i = 0;
684 while (mgp->cmd->data != MYRI10GE_NO_CONFIRM_DATA && i < 20) { 733 while (mgp->cmd->data != MYRI10GE_NO_CONFIRM_DATA && i < 9) {
685 msleep(1); 734 msleep(1 << i);
686 i++; 735 i++;
687 } 736 }
688 if (mgp->cmd->data != MYRI10GE_NO_CONFIRM_DATA) { 737 if (mgp->cmd->data != MYRI10GE_NO_CONFIRM_DATA) {
689 dev_err(&mgp->pdev->dev, "handoff failed\n"); 738 dev_err(&mgp->pdev->dev, "handoff failed\n");
690 return -ENXIO; 739 return -ENXIO;
691 } 740 }
692 dev_info(&mgp->pdev->dev, "handoff confirmed\n");
693 myri10ge_dummy_rdma(mgp, 1); 741 myri10ge_dummy_rdma(mgp, 1);
742 status = myri10ge_get_firmware_capabilities(mgp);
694 743
695 /* probe for IPv6 TSO support */ 744 return status;
696 mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
697 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
698 &cmd, 0);
699 if (status == 0) {
700 mgp->max_tso6 = cmd.data0;
701 mgp->features |= NETIF_F_TSO6;
702 }
703 return 0;
704} 745}
705 746
706static int myri10ge_update_mac_address(struct myri10ge_priv *mgp, u8 * addr) 747static int myri10ge_update_mac_address(struct myri10ge_priv *mgp, u8 * addr)
@@ -772,7 +813,7 @@ static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type)
772 * transfers took to complete. 813 * transfers took to complete.
773 */ 814 */
774 815
775 len = mgp->tx.boundary; 816 len = mgp->tx_boundary;
776 817
777 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); 818 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
778 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); 819 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
@@ -834,17 +875,17 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
834 875
835 /* Now exchange information about interrupts */ 876 /* Now exchange information about interrupts */
836 877
837 bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); 878 bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
838 memset(mgp->rx_done.entry, 0, bytes); 879 memset(mgp->ss.rx_done.entry, 0, bytes);
839 cmd.data0 = (u32) bytes; 880 cmd.data0 = (u32) bytes;
840 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_INTRQ_SIZE, &cmd, 0); 881 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_INTRQ_SIZE, &cmd, 0);
841 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 882 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->ss.rx_done.bus);
842 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 883 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->ss.rx_done.bus);
843 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_INTRQ_DMA, &cmd, 0); 884 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_INTRQ_DMA, &cmd, 0);
844 885
845 status |= 886 status |=
846 myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0); 887 myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0);
847 mgp->irq_claim = (__iomem __be32 *) (mgp->sram + cmd.data0); 888 mgp->ss.irq_claim = (__iomem __be32 *) (mgp->sram + cmd.data0);
848 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, 889 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET,
849 &cmd, 0); 890 &cmd, 0);
850 mgp->irq_deassert = (__iomem __be32 *) (mgp->sram + cmd.data0); 891 mgp->irq_deassert = (__iomem __be32 *) (mgp->sram + cmd.data0);
@@ -858,17 +899,17 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
858 } 899 }
859 put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); 900 put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr);
860 901
861 memset(mgp->rx_done.entry, 0, bytes); 902 memset(mgp->ss.rx_done.entry, 0, bytes);
862 903
863 /* reset mcp/driver shared state back to 0 */ 904 /* reset mcp/driver shared state back to 0 */
864 mgp->tx.req = 0; 905 mgp->ss.tx.req = 0;
865 mgp->tx.done = 0; 906 mgp->ss.tx.done = 0;
866 mgp->tx.pkt_start = 0; 907 mgp->ss.tx.pkt_start = 0;
867 mgp->tx.pkt_done = 0; 908 mgp->ss.tx.pkt_done = 0;
868 mgp->rx_big.cnt = 0; 909 mgp->ss.rx_big.cnt = 0;
869 mgp->rx_small.cnt = 0; 910 mgp->ss.rx_small.cnt = 0;
870 mgp->rx_done.idx = 0; 911 mgp->ss.rx_done.idx = 0;
871 mgp->rx_done.cnt = 0; 912 mgp->ss.rx_done.cnt = 0;
872 mgp->link_changes = 0; 913 mgp->link_changes = 0;
873 status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr); 914 status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr);
874 myri10ge_change_pause(mgp, mgp->pause); 915 myri10ge_change_pause(mgp, mgp->pause);
@@ -1020,9 +1061,10 @@ myri10ge_unmap_rx_page(struct pci_dev *pdev,
1020 * page into an skb */ 1061 * page into an skb */
1021 1062
1022static inline int 1063static inline int
1023myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, 1064myri10ge_rx_done(struct myri10ge_slice_state *ss, struct myri10ge_rx_buf *rx,
1024 int bytes, int len, __wsum csum) 1065 int bytes, int len, __wsum csum)
1025{ 1066{
1067 struct myri10ge_priv *mgp = ss->mgp;
1026 struct sk_buff *skb; 1068 struct sk_buff *skb;
1027 struct skb_frag_struct rx_frags[MYRI10GE_MAX_FRAGS_PER_FRAME]; 1069 struct skb_frag_struct rx_frags[MYRI10GE_MAX_FRAGS_PER_FRAME];
1028 int i, idx, hlen, remainder; 1070 int i, idx, hlen, remainder;
@@ -1052,11 +1094,10 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1052 rx_frags[0].page_offset += MXGEFW_PAD; 1094 rx_frags[0].page_offset += MXGEFW_PAD;
1053 rx_frags[0].size -= MXGEFW_PAD; 1095 rx_frags[0].size -= MXGEFW_PAD;
1054 len -= MXGEFW_PAD; 1096 len -= MXGEFW_PAD;
1055 lro_receive_frags(&mgp->rx_done.lro_mgr, rx_frags, 1097 lro_receive_frags(&ss->rx_done.lro_mgr, rx_frags,
1056 len, len, 1098 len, len,
1057 /* opaque, will come back in get_frag_header */ 1099 /* opaque, will come back in get_frag_header */
1058 (void *)(__force unsigned long)csum, 1100 (void *)(__force unsigned long)csum, csum);
1059 csum);
1060 return 1; 1101 return 1;
1061 } 1102 }
1062 1103
@@ -1096,10 +1137,11 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1096 return 1; 1137 return 1;
1097} 1138}
1098 1139
1099static inline void myri10ge_tx_done(struct myri10ge_priv *mgp, int mcp_index) 1140static inline void
1141myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index)
1100{ 1142{
1101 struct pci_dev *pdev = mgp->pdev; 1143 struct pci_dev *pdev = ss->mgp->pdev;
1102 struct myri10ge_tx_buf *tx = &mgp->tx; 1144 struct myri10ge_tx_buf *tx = &ss->tx;
1103 struct sk_buff *skb; 1145 struct sk_buff *skb;
1104 int idx, len; 1146 int idx, len;
1105 1147
@@ -1117,8 +1159,8 @@ static inline void myri10ge_tx_done(struct myri10ge_priv *mgp, int mcp_index)
1117 len = pci_unmap_len(&tx->info[idx], len); 1159 len = pci_unmap_len(&tx->info[idx], len);
1118 pci_unmap_len_set(&tx->info[idx], len, 0); 1160 pci_unmap_len_set(&tx->info[idx], len, 0);
1119 if (skb) { 1161 if (skb) {
1120 mgp->stats.tx_bytes += skb->len; 1162 ss->stats.tx_bytes += skb->len;
1121 mgp->stats.tx_packets++; 1163 ss->stats.tx_packets++;
1122 dev_kfree_skb_irq(skb); 1164 dev_kfree_skb_irq(skb);
1123 if (len) 1165 if (len)
1124 pci_unmap_single(pdev, 1166 pci_unmap_single(pdev,
@@ -1134,16 +1176,18 @@ static inline void myri10ge_tx_done(struct myri10ge_priv *mgp, int mcp_index)
1134 } 1176 }
1135 } 1177 }
1136 /* start the queue if we've stopped it */ 1178 /* start the queue if we've stopped it */
1137 if (netif_queue_stopped(mgp->dev) 1179 if (netif_queue_stopped(ss->dev)
1138 && tx->req - tx->done < (tx->mask >> 1)) { 1180 && tx->req - tx->done < (tx->mask >> 1)) {
1139 mgp->wake_queue++; 1181 tx->wake_queue++;
1140 netif_wake_queue(mgp->dev); 1182 netif_wake_queue(ss->dev);
1141 } 1183 }
1142} 1184}
1143 1185
1144static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget) 1186static inline int
1187myri10ge_clean_rx_done(struct myri10ge_slice_state *ss, int budget)
1145{ 1188{
1146 struct myri10ge_rx_done *rx_done = &mgp->rx_done; 1189 struct myri10ge_rx_done *rx_done = &ss->rx_done;
1190 struct myri10ge_priv *mgp = ss->mgp;
1147 unsigned long rx_bytes = 0; 1191 unsigned long rx_bytes = 0;
1148 unsigned long rx_packets = 0; 1192 unsigned long rx_packets = 0;
1149 unsigned long rx_ok; 1193 unsigned long rx_ok;
@@ -1159,40 +1203,40 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget)
1159 rx_done->entry[idx].length = 0; 1203 rx_done->entry[idx].length = 0;
1160 checksum = csum_unfold(rx_done->entry[idx].checksum); 1204 checksum = csum_unfold(rx_done->entry[idx].checksum);
1161 if (length <= mgp->small_bytes) 1205 if (length <= mgp->small_bytes)
1162 rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small, 1206 rx_ok = myri10ge_rx_done(ss, &ss->rx_small,
1163 mgp->small_bytes, 1207 mgp->small_bytes,
1164 length, checksum); 1208 length, checksum);
1165 else 1209 else
1166 rx_ok = myri10ge_rx_done(mgp, &mgp->rx_big, 1210 rx_ok = myri10ge_rx_done(ss, &ss->rx_big,
1167 mgp->big_bytes, 1211 mgp->big_bytes,
1168 length, checksum); 1212 length, checksum);
1169 rx_packets += rx_ok; 1213 rx_packets += rx_ok;
1170 rx_bytes += rx_ok * (unsigned long)length; 1214 rx_bytes += rx_ok * (unsigned long)length;
1171 cnt++; 1215 cnt++;
1172 idx = cnt & (myri10ge_max_intr_slots - 1); 1216 idx = cnt & (mgp->max_intr_slots - 1);
1173 work_done++; 1217 work_done++;
1174 } 1218 }
1175 rx_done->idx = idx; 1219 rx_done->idx = idx;
1176 rx_done->cnt = cnt; 1220 rx_done->cnt = cnt;
1177 mgp->stats.rx_packets += rx_packets; 1221 ss->stats.rx_packets += rx_packets;
1178 mgp->stats.rx_bytes += rx_bytes; 1222 ss->stats.rx_bytes += rx_bytes;
1179 1223
1180 if (myri10ge_lro) 1224 if (myri10ge_lro)
1181 lro_flush_all(&rx_done->lro_mgr); 1225 lro_flush_all(&rx_done->lro_mgr);
1182 1226
1183 /* restock receive rings if needed */ 1227 /* restock receive rings if needed */
1184 if (mgp->rx_small.fill_cnt - mgp->rx_small.cnt < myri10ge_fill_thresh) 1228 if (ss->rx_small.fill_cnt - ss->rx_small.cnt < myri10ge_fill_thresh)
1185 myri10ge_alloc_rx_pages(mgp, &mgp->rx_small, 1229 myri10ge_alloc_rx_pages(mgp, &ss->rx_small,
1186 mgp->small_bytes + MXGEFW_PAD, 0); 1230 mgp->small_bytes + MXGEFW_PAD, 0);
1187 if (mgp->rx_big.fill_cnt - mgp->rx_big.cnt < myri10ge_fill_thresh) 1231 if (ss->rx_big.fill_cnt - ss->rx_big.cnt < myri10ge_fill_thresh)
1188 myri10ge_alloc_rx_pages(mgp, &mgp->rx_big, mgp->big_bytes, 0); 1232 myri10ge_alloc_rx_pages(mgp, &ss->rx_big, mgp->big_bytes, 0);
1189 1233
1190 return work_done; 1234 return work_done;
1191} 1235}
1192 1236
1193static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) 1237static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1194{ 1238{
1195 struct mcp_irq_data *stats = mgp->fw_stats; 1239 struct mcp_irq_data *stats = mgp->ss.fw_stats;
1196 1240
1197 if (unlikely(stats->stats_updated)) { 1241 if (unlikely(stats->stats_updated)) {
1198 unsigned link_up = ntohl(stats->link_up); 1242 unsigned link_up = ntohl(stats->link_up);
@@ -1219,9 +1263,9 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1219 } 1263 }
1220 } 1264 }
1221 if (mgp->rdma_tags_available != 1265 if (mgp->rdma_tags_available !=
1222 ntohl(mgp->fw_stats->rdma_tags_available)) { 1266 ntohl(stats->rdma_tags_available)) {
1223 mgp->rdma_tags_available = 1267 mgp->rdma_tags_available =
1224 ntohl(mgp->fw_stats->rdma_tags_available); 1268 ntohl(stats->rdma_tags_available);
1225 printk(KERN_WARNING "myri10ge: %s: RDMA timed out! " 1269 printk(KERN_WARNING "myri10ge: %s: RDMA timed out! "
1226 "%d tags left\n", mgp->dev->name, 1270 "%d tags left\n", mgp->dev->name,
1227 mgp->rdma_tags_available); 1271 mgp->rdma_tags_available);
@@ -1234,26 +1278,27 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1234 1278
1235static int myri10ge_poll(struct napi_struct *napi, int budget) 1279static int myri10ge_poll(struct napi_struct *napi, int budget)
1236{ 1280{
1237 struct myri10ge_priv *mgp = 1281 struct myri10ge_slice_state *ss =
1238 container_of(napi, struct myri10ge_priv, napi); 1282 container_of(napi, struct myri10ge_slice_state, napi);
1239 struct net_device *netdev = mgp->dev; 1283 struct net_device *netdev = ss->mgp->dev;
1240 int work_done; 1284 int work_done;
1241 1285
1242 /* process as many rx events as NAPI will allow */ 1286 /* process as many rx events as NAPI will allow */
1243 work_done = myri10ge_clean_rx_done(mgp, budget); 1287 work_done = myri10ge_clean_rx_done(ss, budget);
1244 1288
1245 if (work_done < budget) { 1289 if (work_done < budget) {
1246 netif_rx_complete(netdev, napi); 1290 netif_rx_complete(netdev, napi);
1247 put_be32(htonl(3), mgp->irq_claim); 1291 put_be32(htonl(3), ss->irq_claim);
1248 } 1292 }
1249 return work_done; 1293 return work_done;
1250} 1294}
1251 1295
1252static irqreturn_t myri10ge_intr(int irq, void *arg) 1296static irqreturn_t myri10ge_intr(int irq, void *arg)
1253{ 1297{
1254 struct myri10ge_priv *mgp = arg; 1298 struct myri10ge_slice_state *ss = arg;
1255 struct mcp_irq_data *stats = mgp->fw_stats; 1299 struct myri10ge_priv *mgp = ss->mgp;
1256 struct myri10ge_tx_buf *tx = &mgp->tx; 1300 struct mcp_irq_data *stats = ss->fw_stats;
1301 struct myri10ge_tx_buf *tx = &ss->tx;
1257 u32 send_done_count; 1302 u32 send_done_count;
1258 int i; 1303 int i;
1259 1304
@@ -1264,7 +1309,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1264 /* low bit indicates receives are present, so schedule 1309 /* low bit indicates receives are present, so schedule
1265 * napi poll handler */ 1310 * napi poll handler */
1266 if (stats->valid & 1) 1311 if (stats->valid & 1)
1267 netif_rx_schedule(mgp->dev, &mgp->napi); 1312 netif_rx_schedule(ss->dev, &ss->napi);
1268 1313
1269 if (!mgp->msi_enabled) { 1314 if (!mgp->msi_enabled) {
1270 put_be32(0, mgp->irq_deassert); 1315 put_be32(0, mgp->irq_deassert);
@@ -1281,7 +1326,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1281 /* check for transmit completes and receives */ 1326 /* check for transmit completes and receives */
1282 send_done_count = ntohl(stats->send_done_count); 1327 send_done_count = ntohl(stats->send_done_count);
1283 if (send_done_count != tx->pkt_done) 1328 if (send_done_count != tx->pkt_done)
1284 myri10ge_tx_done(mgp, (int)send_done_count); 1329 myri10ge_tx_done(ss, (int)send_done_count);
1285 if (unlikely(i > myri10ge_max_irq_loops)) { 1330 if (unlikely(i > myri10ge_max_irq_loops)) {
1286 printk(KERN_WARNING "myri10ge: %s: irq stuck?\n", 1331 printk(KERN_WARNING "myri10ge: %s: irq stuck?\n",
1287 mgp->dev->name); 1332 mgp->dev->name);
@@ -1296,16 +1341,46 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1296 1341
1297 myri10ge_check_statblock(mgp); 1342 myri10ge_check_statblock(mgp);
1298 1343
1299 put_be32(htonl(3), mgp->irq_claim + 1); 1344 put_be32(htonl(3), ss->irq_claim + 1);
1300 return (IRQ_HANDLED); 1345 return (IRQ_HANDLED);
1301} 1346}
1302 1347
1303static int 1348static int
1304myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) 1349myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
1305{ 1350{
1351 struct myri10ge_priv *mgp = netdev_priv(netdev);
1352 char *ptr;
1353 int i;
1354
1306 cmd->autoneg = AUTONEG_DISABLE; 1355 cmd->autoneg = AUTONEG_DISABLE;
1307 cmd->speed = SPEED_10000; 1356 cmd->speed = SPEED_10000;
1308 cmd->duplex = DUPLEX_FULL; 1357 cmd->duplex = DUPLEX_FULL;
1358
1359 /*
1360 * parse the product code to deterimine the interface type
1361 * (CX4, XFP, Quad Ribbon Fiber) by looking at the character
1362 * after the 3rd dash in the driver's cached copy of the
1363 * EEPROM's product code string.
1364 */
1365 ptr = mgp->product_code_string;
1366 if (ptr == NULL) {
1367 printk(KERN_ERR "myri10ge: %s: Missing product code\n",
1368 netdev->name);
1369 return 0;
1370 }
1371 for (i = 0; i < 3; i++, ptr++) {
1372 ptr = strchr(ptr, '-');
1373 if (ptr == NULL) {
1374 printk(KERN_ERR "myri10ge: %s: Invalid product "
1375 "code %s\n", netdev->name,
1376 mgp->product_code_string);
1377 return 0;
1378 }
1379 }
1380 if (*ptr == 'R' || *ptr == 'Q') {
1381 /* We've found either an XFP or quad ribbon fiber */
1382 cmd->port = PORT_FIBRE;
1383 }
1309 return 0; 1384 return 0;
1310} 1385}
1311 1386
@@ -1324,6 +1399,7 @@ static int
1324myri10ge_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal) 1399myri10ge_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal)
1325{ 1400{
1326 struct myri10ge_priv *mgp = netdev_priv(netdev); 1401 struct myri10ge_priv *mgp = netdev_priv(netdev);
1402
1327 coal->rx_coalesce_usecs = mgp->intr_coal_delay; 1403 coal->rx_coalesce_usecs = mgp->intr_coal_delay;
1328 return 0; 1404 return 0;
1329} 1405}
@@ -1370,10 +1446,10 @@ myri10ge_get_ringparam(struct net_device *netdev,
1370{ 1446{
1371 struct myri10ge_priv *mgp = netdev_priv(netdev); 1447 struct myri10ge_priv *mgp = netdev_priv(netdev);
1372 1448
1373 ring->rx_mini_max_pending = mgp->rx_small.mask + 1; 1449 ring->rx_mini_max_pending = mgp->ss.rx_small.mask + 1;
1374 ring->rx_max_pending = mgp->rx_big.mask + 1; 1450 ring->rx_max_pending = mgp->ss.rx_big.mask + 1;
1375 ring->rx_jumbo_max_pending = 0; 1451 ring->rx_jumbo_max_pending = 0;
1376 ring->tx_max_pending = mgp->rx_small.mask + 1; 1452 ring->tx_max_pending = mgp->ss.rx_small.mask + 1;
1377 ring->rx_mini_pending = ring->rx_mini_max_pending; 1453 ring->rx_mini_pending = ring->rx_mini_max_pending;
1378 ring->rx_pending = ring->rx_max_pending; 1454 ring->rx_pending = ring->rx_max_pending;
1379 ring->rx_jumbo_pending = ring->rx_jumbo_max_pending; 1455 ring->rx_jumbo_pending = ring->rx_jumbo_max_pending;
@@ -1383,6 +1459,7 @@ myri10ge_get_ringparam(struct net_device *netdev,
1383static u32 myri10ge_get_rx_csum(struct net_device *netdev) 1459static u32 myri10ge_get_rx_csum(struct net_device *netdev)
1384{ 1460{
1385 struct myri10ge_priv *mgp = netdev_priv(netdev); 1461 struct myri10ge_priv *mgp = netdev_priv(netdev);
1462
1386 if (mgp->csum_flag) 1463 if (mgp->csum_flag)
1387 return 1; 1464 return 1;
1388 else 1465 else
@@ -1392,6 +1469,7 @@ static u32 myri10ge_get_rx_csum(struct net_device *netdev)
1392static int myri10ge_set_rx_csum(struct net_device *netdev, u32 csum_enabled) 1469static int myri10ge_set_rx_csum(struct net_device *netdev, u32 csum_enabled)
1393{ 1470{
1394 struct myri10ge_priv *mgp = netdev_priv(netdev); 1471 struct myri10ge_priv *mgp = netdev_priv(netdev);
1472
1395 if (csum_enabled) 1473 if (csum_enabled)
1396 mgp->csum_flag = MXGEFW_FLAGS_CKSUM; 1474 mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
1397 else 1475 else
@@ -1411,7 +1489,7 @@ static int myri10ge_set_tso(struct net_device *netdev, u32 tso_enabled)
1411 return 0; 1489 return 0;
1412} 1490}
1413 1491
1414static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = { 1492static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = {
1415 "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors", 1493 "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors",
1416 "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions", 1494 "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions",
1417 "rx_length_errors", "rx_over_errors", "rx_crc_errors", 1495 "rx_length_errors", "rx_over_errors", "rx_crc_errors",
@@ -1421,28 +1499,39 @@ static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = {
1421 /* device-specific stats */ 1499 /* device-specific stats */
1422 "tx_boundary", "WC", "irq", "MSI", 1500 "tx_boundary", "WC", "irq", "MSI",
1423 "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs", 1501 "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs",
1424 "serial_number", "tx_pkt_start", "tx_pkt_done", 1502 "serial_number", "watchdog_resets",
1425 "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt",
1426 "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized",
1427 "link_changes", "link_up", "dropped_link_overflow", 1503 "link_changes", "link_up", "dropped_link_overflow",
1428 "dropped_link_error_or_filtered", 1504 "dropped_link_error_or_filtered",
1429 "dropped_pause", "dropped_bad_phy", "dropped_bad_crc32", 1505 "dropped_pause", "dropped_bad_phy", "dropped_bad_crc32",
1430 "dropped_unicast_filtered", "dropped_multicast_filtered", 1506 "dropped_unicast_filtered", "dropped_multicast_filtered",
1431 "dropped_runt", "dropped_overrun", "dropped_no_small_buffer", 1507 "dropped_runt", "dropped_overrun", "dropped_no_small_buffer",
1432 "dropped_no_big_buffer", "LRO aggregated", "LRO flushed", 1508 "dropped_no_big_buffer"
1509};
1510
1511static const char myri10ge_gstrings_slice_stats[][ETH_GSTRING_LEN] = {
1512 "----------- slice ---------",
1513 "tx_pkt_start", "tx_pkt_done", "tx_req", "tx_done",
1514 "rx_small_cnt", "rx_big_cnt",
1515 "wake_queue", "stop_queue", "tx_linearized", "LRO aggregated",
1516 "LRO flushed",
1433 "LRO avg aggr", "LRO no_desc" 1517 "LRO avg aggr", "LRO no_desc"
1434}; 1518};
1435 1519
1436#define MYRI10GE_NET_STATS_LEN 21 1520#define MYRI10GE_NET_STATS_LEN 21
1437#define MYRI10GE_STATS_LEN ARRAY_SIZE(myri10ge_gstrings_stats) 1521#define MYRI10GE_MAIN_STATS_LEN ARRAY_SIZE(myri10ge_gstrings_main_stats)
1522#define MYRI10GE_SLICE_STATS_LEN ARRAY_SIZE(myri10ge_gstrings_slice_stats)
1438 1523
1439static void 1524static void
1440myri10ge_get_strings(struct net_device *netdev, u32 stringset, u8 * data) 1525myri10ge_get_strings(struct net_device *netdev, u32 stringset, u8 * data)
1441{ 1526{
1442 switch (stringset) { 1527 switch (stringset) {
1443 case ETH_SS_STATS: 1528 case ETH_SS_STATS:
1444 memcpy(data, *myri10ge_gstrings_stats, 1529 memcpy(data, *myri10ge_gstrings_main_stats,
1445 sizeof(myri10ge_gstrings_stats)); 1530 sizeof(myri10ge_gstrings_main_stats));
1531 data += sizeof(myri10ge_gstrings_main_stats);
1532 memcpy(data, *myri10ge_gstrings_slice_stats,
1533 sizeof(myri10ge_gstrings_slice_stats));
1534 data += sizeof(myri10ge_gstrings_slice_stats);
1446 break; 1535 break;
1447 } 1536 }
1448} 1537}
@@ -1451,7 +1540,7 @@ static int myri10ge_get_sset_count(struct net_device *netdev, int sset)
1451{ 1540{
1452 switch (sset) { 1541 switch (sset) {
1453 case ETH_SS_STATS: 1542 case ETH_SS_STATS:
1454 return MYRI10GE_STATS_LEN; 1543 return MYRI10GE_MAIN_STATS_LEN + MYRI10GE_SLICE_STATS_LEN;
1455 default: 1544 default:
1456 return -EOPNOTSUPP; 1545 return -EOPNOTSUPP;
1457 } 1546 }
@@ -1462,12 +1551,13 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1462 struct ethtool_stats *stats, u64 * data) 1551 struct ethtool_stats *stats, u64 * data)
1463{ 1552{
1464 struct myri10ge_priv *mgp = netdev_priv(netdev); 1553 struct myri10ge_priv *mgp = netdev_priv(netdev);
1554 struct myri10ge_slice_state *ss;
1465 int i; 1555 int i;
1466 1556
1467 for (i = 0; i < MYRI10GE_NET_STATS_LEN; i++) 1557 for (i = 0; i < MYRI10GE_NET_STATS_LEN; i++)
1468 data[i] = ((unsigned long *)&mgp->stats)[i]; 1558 data[i] = ((unsigned long *)&mgp->stats)[i];
1469 1559
1470 data[i++] = (unsigned int)mgp->tx.boundary; 1560 data[i++] = (unsigned int)mgp->tx_boundary;
1471 data[i++] = (unsigned int)mgp->wc_enabled; 1561 data[i++] = (unsigned int)mgp->wc_enabled;
1472 data[i++] = (unsigned int)mgp->pdev->irq; 1562 data[i++] = (unsigned int)mgp->pdev->irq;
1473 data[i++] = (unsigned int)mgp->msi_enabled; 1563 data[i++] = (unsigned int)mgp->msi_enabled;
@@ -1475,40 +1565,44 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1475 data[i++] = (unsigned int)mgp->write_dma; 1565 data[i++] = (unsigned int)mgp->write_dma;
1476 data[i++] = (unsigned int)mgp->read_write_dma; 1566 data[i++] = (unsigned int)mgp->read_write_dma;
1477 data[i++] = (unsigned int)mgp->serial_number; 1567 data[i++] = (unsigned int)mgp->serial_number;
1478 data[i++] = (unsigned int)mgp->tx.pkt_start;
1479 data[i++] = (unsigned int)mgp->tx.pkt_done;
1480 data[i++] = (unsigned int)mgp->tx.req;
1481 data[i++] = (unsigned int)mgp->tx.done;
1482 data[i++] = (unsigned int)mgp->rx_small.cnt;
1483 data[i++] = (unsigned int)mgp->rx_big.cnt;
1484 data[i++] = (unsigned int)mgp->wake_queue;
1485 data[i++] = (unsigned int)mgp->stop_queue;
1486 data[i++] = (unsigned int)mgp->watchdog_resets; 1568 data[i++] = (unsigned int)mgp->watchdog_resets;
1487 data[i++] = (unsigned int)mgp->tx_linearized;
1488 data[i++] = (unsigned int)mgp->link_changes; 1569 data[i++] = (unsigned int)mgp->link_changes;
1489 data[i++] = (unsigned int)ntohl(mgp->fw_stats->link_up); 1570
1490 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow); 1571 /* firmware stats are useful only in the first slice */
1491 data[i++] = 1572 ss = &mgp->ss;
1492 (unsigned int)ntohl(mgp->fw_stats->dropped_link_error_or_filtered); 1573 data[i++] = (unsigned int)ntohl(ss->fw_stats->link_up);
1493 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_pause); 1574 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_link_overflow);
1494 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_bad_phy);
1495 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_bad_crc32);
1496 data[i++] = 1575 data[i++] =
1497 (unsigned int)ntohl(mgp->fw_stats->dropped_unicast_filtered); 1576 (unsigned int)ntohl(ss->fw_stats->dropped_link_error_or_filtered);
1577 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_pause);
1578 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_bad_phy);
1579 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_bad_crc32);
1580 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_unicast_filtered);
1498 data[i++] = 1581 data[i++] =
1499 (unsigned int)ntohl(mgp->fw_stats->dropped_multicast_filtered); 1582 (unsigned int)ntohl(ss->fw_stats->dropped_multicast_filtered);
1500 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_runt); 1583 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_runt);
1501 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_overrun); 1584 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_overrun);
1502 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_small_buffer); 1585 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_no_small_buffer);
1503 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_big_buffer); 1586 data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_no_big_buffer);
1504 data[i++] = mgp->rx_done.lro_mgr.stats.aggregated; 1587
1505 data[i++] = mgp->rx_done.lro_mgr.stats.flushed; 1588 data[i++] = 0;
1506 if (mgp->rx_done.lro_mgr.stats.flushed) 1589 data[i++] = (unsigned int)ss->tx.pkt_start;
1507 data[i++] = mgp->rx_done.lro_mgr.stats.aggregated / 1590 data[i++] = (unsigned int)ss->tx.pkt_done;
1508 mgp->rx_done.lro_mgr.stats.flushed; 1591 data[i++] = (unsigned int)ss->tx.req;
1592 data[i++] = (unsigned int)ss->tx.done;
1593 data[i++] = (unsigned int)ss->rx_small.cnt;
1594 data[i++] = (unsigned int)ss->rx_big.cnt;
1595 data[i++] = (unsigned int)ss->tx.wake_queue;
1596 data[i++] = (unsigned int)ss->tx.stop_queue;
1597 data[i++] = (unsigned int)ss->tx.linearized;
1598 data[i++] = ss->rx_done.lro_mgr.stats.aggregated;
1599 data[i++] = ss->rx_done.lro_mgr.stats.flushed;
1600 if (ss->rx_done.lro_mgr.stats.flushed)
1601 data[i++] = ss->rx_done.lro_mgr.stats.aggregated /
1602 ss->rx_done.lro_mgr.stats.flushed;
1509 else 1603 else
1510 data[i++] = 0; 1604 data[i++] = 0;
1511 data[i++] = mgp->rx_done.lro_mgr.stats.no_desc; 1605 data[i++] = ss->rx_done.lro_mgr.stats.no_desc;
1512} 1606}
1513 1607
1514static void myri10ge_set_msglevel(struct net_device *netdev, u32 value) 1608static void myri10ge_set_msglevel(struct net_device *netdev, u32 value)
@@ -1544,19 +1638,17 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
1544 .get_msglevel = myri10ge_get_msglevel 1638 .get_msglevel = myri10ge_get_msglevel
1545}; 1639};
1546 1640
1547static int myri10ge_allocate_rings(struct net_device *dev) 1641static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)
1548{ 1642{
1549 struct myri10ge_priv *mgp; 1643 struct myri10ge_priv *mgp = ss->mgp;
1550 struct myri10ge_cmd cmd; 1644 struct myri10ge_cmd cmd;
1645 struct net_device *dev = mgp->dev;
1551 int tx_ring_size, rx_ring_size; 1646 int tx_ring_size, rx_ring_size;
1552 int tx_ring_entries, rx_ring_entries; 1647 int tx_ring_entries, rx_ring_entries;
1553 int i, status; 1648 int i, status;
1554 size_t bytes; 1649 size_t bytes;
1555 1650
1556 mgp = netdev_priv(dev);
1557
1558 /* get ring sizes */ 1651 /* get ring sizes */
1559
1560 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); 1652 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0);
1561 tx_ring_size = cmd.data0; 1653 tx_ring_size = cmd.data0;
1562 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); 1654 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
@@ -1566,144 +1658,142 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1566 1658
1567 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); 1659 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send);
1568 rx_ring_entries = rx_ring_size / sizeof(struct mcp_dma_addr); 1660 rx_ring_entries = rx_ring_size / sizeof(struct mcp_dma_addr);
1569 mgp->tx.mask = tx_ring_entries - 1; 1661 ss->tx.mask = tx_ring_entries - 1;
1570 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; 1662 ss->rx_small.mask = ss->rx_big.mask = rx_ring_entries - 1;
1571 1663
1572 status = -ENOMEM; 1664 status = -ENOMEM;
1573 1665
1574 /* allocate the host shadow rings */ 1666 /* allocate the host shadow rings */
1575 1667
1576 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) 1668 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4)
1577 * sizeof(*mgp->tx.req_list); 1669 * sizeof(*ss->tx.req_list);
1578 mgp->tx.req_bytes = kzalloc(bytes, GFP_KERNEL); 1670 ss->tx.req_bytes = kzalloc(bytes, GFP_KERNEL);
1579 if (mgp->tx.req_bytes == NULL) 1671 if (ss->tx.req_bytes == NULL)
1580 goto abort_with_nothing; 1672 goto abort_with_nothing;
1581 1673
1582 /* ensure req_list entries are aligned to 8 bytes */ 1674 /* ensure req_list entries are aligned to 8 bytes */
1583 mgp->tx.req_list = (struct mcp_kreq_ether_send *) 1675 ss->tx.req_list = (struct mcp_kreq_ether_send *)
1584 ALIGN((unsigned long)mgp->tx.req_bytes, 8); 1676 ALIGN((unsigned long)ss->tx.req_bytes, 8);
1585 1677
1586 bytes = rx_ring_entries * sizeof(*mgp->rx_small.shadow); 1678 bytes = rx_ring_entries * sizeof(*ss->rx_small.shadow);
1587 mgp->rx_small.shadow = kzalloc(bytes, GFP_KERNEL); 1679 ss->rx_small.shadow = kzalloc(bytes, GFP_KERNEL);
1588 if (mgp->rx_small.shadow == NULL) 1680 if (ss->rx_small.shadow == NULL)
1589 goto abort_with_tx_req_bytes; 1681 goto abort_with_tx_req_bytes;
1590 1682
1591 bytes = rx_ring_entries * sizeof(*mgp->rx_big.shadow); 1683 bytes = rx_ring_entries * sizeof(*ss->rx_big.shadow);
1592 mgp->rx_big.shadow = kzalloc(bytes, GFP_KERNEL); 1684 ss->rx_big.shadow = kzalloc(bytes, GFP_KERNEL);
1593 if (mgp->rx_big.shadow == NULL) 1685 if (ss->rx_big.shadow == NULL)
1594 goto abort_with_rx_small_shadow; 1686 goto abort_with_rx_small_shadow;
1595 1687
1596 /* allocate the host info rings */ 1688 /* allocate the host info rings */
1597 1689
1598 bytes = tx_ring_entries * sizeof(*mgp->tx.info); 1690 bytes = tx_ring_entries * sizeof(*ss->tx.info);
1599 mgp->tx.info = kzalloc(bytes, GFP_KERNEL); 1691 ss->tx.info = kzalloc(bytes, GFP_KERNEL);
1600 if (mgp->tx.info == NULL) 1692 if (ss->tx.info == NULL)
1601 goto abort_with_rx_big_shadow; 1693 goto abort_with_rx_big_shadow;
1602 1694
1603 bytes = rx_ring_entries * sizeof(*mgp->rx_small.info); 1695 bytes = rx_ring_entries * sizeof(*ss->rx_small.info);
1604 mgp->rx_small.info = kzalloc(bytes, GFP_KERNEL); 1696 ss->rx_small.info = kzalloc(bytes, GFP_KERNEL);
1605 if (mgp->rx_small.info == NULL) 1697 if (ss->rx_small.info == NULL)
1606 goto abort_with_tx_info; 1698 goto abort_with_tx_info;
1607 1699
1608 bytes = rx_ring_entries * sizeof(*mgp->rx_big.info); 1700 bytes = rx_ring_entries * sizeof(*ss->rx_big.info);
1609 mgp->rx_big.info = kzalloc(bytes, GFP_KERNEL); 1701 ss->rx_big.info = kzalloc(bytes, GFP_KERNEL);
1610 if (mgp->rx_big.info == NULL) 1702 if (ss->rx_big.info == NULL)
1611 goto abort_with_rx_small_info; 1703 goto abort_with_rx_small_info;
1612 1704
1613 /* Fill the receive rings */ 1705 /* Fill the receive rings */
1614 mgp->rx_big.cnt = 0; 1706 ss->rx_big.cnt = 0;
1615 mgp->rx_small.cnt = 0; 1707 ss->rx_small.cnt = 0;
1616 mgp->rx_big.fill_cnt = 0; 1708 ss->rx_big.fill_cnt = 0;
1617 mgp->rx_small.fill_cnt = 0; 1709 ss->rx_small.fill_cnt = 0;
1618 mgp->rx_small.page_offset = MYRI10GE_ALLOC_SIZE; 1710 ss->rx_small.page_offset = MYRI10GE_ALLOC_SIZE;
1619 mgp->rx_big.page_offset = MYRI10GE_ALLOC_SIZE; 1711 ss->rx_big.page_offset = MYRI10GE_ALLOC_SIZE;
1620 mgp->rx_small.watchdog_needed = 0; 1712 ss->rx_small.watchdog_needed = 0;
1621 mgp->rx_big.watchdog_needed = 0; 1713 ss->rx_big.watchdog_needed = 0;
1622 myri10ge_alloc_rx_pages(mgp, &mgp->rx_small, 1714 myri10ge_alloc_rx_pages(mgp, &ss->rx_small,
1623 mgp->small_bytes + MXGEFW_PAD, 0); 1715 mgp->small_bytes + MXGEFW_PAD, 0);
1624 1716
1625 if (mgp->rx_small.fill_cnt < mgp->rx_small.mask + 1) { 1717 if (ss->rx_small.fill_cnt < ss->rx_small.mask + 1) {
1626 printk(KERN_ERR "myri10ge: %s: alloced only %d small bufs\n", 1718 printk(KERN_ERR "myri10ge: %s: alloced only %d small bufs\n",
1627 dev->name, mgp->rx_small.fill_cnt); 1719 dev->name, ss->rx_small.fill_cnt);
1628 goto abort_with_rx_small_ring; 1720 goto abort_with_rx_small_ring;
1629 } 1721 }
1630 1722
1631 myri10ge_alloc_rx_pages(mgp, &mgp->rx_big, mgp->big_bytes, 0); 1723 myri10ge_alloc_rx_pages(mgp, &ss->rx_big, mgp->big_bytes, 0);
1632 if (mgp->rx_big.fill_cnt < mgp->rx_big.mask + 1) { 1724 if (ss->rx_big.fill_cnt < ss->rx_big.mask + 1) {
1633 printk(KERN_ERR "myri10ge: %s: alloced only %d big bufs\n", 1725 printk(KERN_ERR "myri10ge: %s: alloced only %d big bufs\n",
1634 dev->name, mgp->rx_big.fill_cnt); 1726 dev->name, ss->rx_big.fill_cnt);
1635 goto abort_with_rx_big_ring; 1727 goto abort_with_rx_big_ring;
1636 } 1728 }
1637 1729
1638 return 0; 1730 return 0;
1639 1731
1640abort_with_rx_big_ring: 1732abort_with_rx_big_ring:
1641 for (i = mgp->rx_big.cnt; i < mgp->rx_big.fill_cnt; i++) { 1733 for (i = ss->rx_big.cnt; i < ss->rx_big.fill_cnt; i++) {
1642 int idx = i & mgp->rx_big.mask; 1734 int idx = i & ss->rx_big.mask;
1643 myri10ge_unmap_rx_page(mgp->pdev, &mgp->rx_big.info[idx], 1735 myri10ge_unmap_rx_page(mgp->pdev, &ss->rx_big.info[idx],
1644 mgp->big_bytes); 1736 mgp->big_bytes);
1645 put_page(mgp->rx_big.info[idx].page); 1737 put_page(ss->rx_big.info[idx].page);
1646 } 1738 }
1647 1739
1648abort_with_rx_small_ring: 1740abort_with_rx_small_ring:
1649 for (i = mgp->rx_small.cnt; i < mgp->rx_small.fill_cnt; i++) { 1741 for (i = ss->rx_small.cnt; i < ss->rx_small.fill_cnt; i++) {
1650 int idx = i & mgp->rx_small.mask; 1742 int idx = i & ss->rx_small.mask;
1651 myri10ge_unmap_rx_page(mgp->pdev, &mgp->rx_small.info[idx], 1743 myri10ge_unmap_rx_page(mgp->pdev, &ss->rx_small.info[idx],
1652 mgp->small_bytes + MXGEFW_PAD); 1744 mgp->small_bytes + MXGEFW_PAD);
1653 put_page(mgp->rx_small.info[idx].page); 1745 put_page(ss->rx_small.info[idx].page);
1654 } 1746 }
1655 1747
1656 kfree(mgp->rx_big.info); 1748 kfree(ss->rx_big.info);
1657 1749
1658abort_with_rx_small_info: 1750abort_with_rx_small_info:
1659 kfree(mgp->rx_small.info); 1751 kfree(ss->rx_small.info);
1660 1752
1661abort_with_tx_info: 1753abort_with_tx_info:
1662 kfree(mgp->tx.info); 1754 kfree(ss->tx.info);
1663 1755
1664abort_with_rx_big_shadow: 1756abort_with_rx_big_shadow:
1665 kfree(mgp->rx_big.shadow); 1757 kfree(ss->rx_big.shadow);
1666 1758
1667abort_with_rx_small_shadow: 1759abort_with_rx_small_shadow:
1668 kfree(mgp->rx_small.shadow); 1760 kfree(ss->rx_small.shadow);
1669 1761
1670abort_with_tx_req_bytes: 1762abort_with_tx_req_bytes:
1671 kfree(mgp->tx.req_bytes); 1763 kfree(ss->tx.req_bytes);
1672 mgp->tx.req_bytes = NULL; 1764 ss->tx.req_bytes = NULL;
1673 mgp->tx.req_list = NULL; 1765 ss->tx.req_list = NULL;
1674 1766
1675abort_with_nothing: 1767abort_with_nothing:
1676 return status; 1768 return status;
1677} 1769}
1678 1770
1679static void myri10ge_free_rings(struct net_device *dev) 1771static void myri10ge_free_rings(struct myri10ge_slice_state *ss)
1680{ 1772{
1681 struct myri10ge_priv *mgp; 1773 struct myri10ge_priv *mgp = ss->mgp;
1682 struct sk_buff *skb; 1774 struct sk_buff *skb;
1683 struct myri10ge_tx_buf *tx; 1775 struct myri10ge_tx_buf *tx;
1684 int i, len, idx; 1776 int i, len, idx;
1685 1777
1686 mgp = netdev_priv(dev); 1778 for (i = ss->rx_big.cnt; i < ss->rx_big.fill_cnt; i++) {
1687 1779 idx = i & ss->rx_big.mask;
1688 for (i = mgp->rx_big.cnt; i < mgp->rx_big.fill_cnt; i++) { 1780 if (i == ss->rx_big.fill_cnt - 1)
1689 idx = i & mgp->rx_big.mask; 1781 ss->rx_big.info[idx].page_offset = MYRI10GE_ALLOC_SIZE;
1690 if (i == mgp->rx_big.fill_cnt - 1) 1782 myri10ge_unmap_rx_page(mgp->pdev, &ss->rx_big.info[idx],
1691 mgp->rx_big.info[idx].page_offset = MYRI10GE_ALLOC_SIZE;
1692 myri10ge_unmap_rx_page(mgp->pdev, &mgp->rx_big.info[idx],
1693 mgp->big_bytes); 1783 mgp->big_bytes);
1694 put_page(mgp->rx_big.info[idx].page); 1784 put_page(ss->rx_big.info[idx].page);
1695 } 1785 }
1696 1786
1697 for (i = mgp->rx_small.cnt; i < mgp->rx_small.fill_cnt; i++) { 1787 for (i = ss->rx_small.cnt; i < ss->rx_small.fill_cnt; i++) {
1698 idx = i & mgp->rx_small.mask; 1788 idx = i & ss->rx_small.mask;
1699 if (i == mgp->rx_small.fill_cnt - 1) 1789 if (i == ss->rx_small.fill_cnt - 1)
1700 mgp->rx_small.info[idx].page_offset = 1790 ss->rx_small.info[idx].page_offset =
1701 MYRI10GE_ALLOC_SIZE; 1791 MYRI10GE_ALLOC_SIZE;
1702 myri10ge_unmap_rx_page(mgp->pdev, &mgp->rx_small.info[idx], 1792 myri10ge_unmap_rx_page(mgp->pdev, &ss->rx_small.info[idx],
1703 mgp->small_bytes + MXGEFW_PAD); 1793 mgp->small_bytes + MXGEFW_PAD);
1704 put_page(mgp->rx_small.info[idx].page); 1794 put_page(ss->rx_small.info[idx].page);
1705 } 1795 }
1706 tx = &mgp->tx; 1796 tx = &ss->tx;
1707 while (tx->done != tx->req) { 1797 while (tx->done != tx->req) {
1708 idx = tx->done & tx->mask; 1798 idx = tx->done & tx->mask;
1709 skb = tx->info[idx].skb; 1799 skb = tx->info[idx].skb;
@@ -1714,7 +1804,7 @@ static void myri10ge_free_rings(struct net_device *dev)
1714 len = pci_unmap_len(&tx->info[idx], len); 1804 len = pci_unmap_len(&tx->info[idx], len);
1715 pci_unmap_len_set(&tx->info[idx], len, 0); 1805 pci_unmap_len_set(&tx->info[idx], len, 0);
1716 if (skb) { 1806 if (skb) {
1717 mgp->stats.tx_dropped++; 1807 ss->stats.tx_dropped++;
1718 dev_kfree_skb_any(skb); 1808 dev_kfree_skb_any(skb);
1719 if (len) 1809 if (len)
1720 pci_unmap_single(mgp->pdev, 1810 pci_unmap_single(mgp->pdev,
@@ -1729,19 +1819,19 @@ static void myri10ge_free_rings(struct net_device *dev)
1729 PCI_DMA_TODEVICE); 1819 PCI_DMA_TODEVICE);
1730 } 1820 }
1731 } 1821 }
1732 kfree(mgp->rx_big.info); 1822 kfree(ss->rx_big.info);
1733 1823
1734 kfree(mgp->rx_small.info); 1824 kfree(ss->rx_small.info);
1735 1825
1736 kfree(mgp->tx.info); 1826 kfree(ss->tx.info);
1737 1827
1738 kfree(mgp->rx_big.shadow); 1828 kfree(ss->rx_big.shadow);
1739 1829
1740 kfree(mgp->rx_small.shadow); 1830 kfree(ss->rx_small.shadow);
1741 1831
1742 kfree(mgp->tx.req_bytes); 1832 kfree(ss->tx.req_bytes);
1743 mgp->tx.req_bytes = NULL; 1833 ss->tx.req_bytes = NULL;
1744 mgp->tx.req_list = NULL; 1834 ss->tx.req_list = NULL;
1745} 1835}
1746 1836
1747static int myri10ge_request_irq(struct myri10ge_priv *mgp) 1837static int myri10ge_request_irq(struct myri10ge_priv *mgp)
@@ -1840,13 +1930,11 @@ myri10ge_get_frag_header(struct skb_frag_struct *frag, void **mac_hdr,
1840 1930
1841static int myri10ge_open(struct net_device *dev) 1931static int myri10ge_open(struct net_device *dev)
1842{ 1932{
1843 struct myri10ge_priv *mgp; 1933 struct myri10ge_priv *mgp = netdev_priv(dev);
1844 struct myri10ge_cmd cmd; 1934 struct myri10ge_cmd cmd;
1845 struct net_lro_mgr *lro_mgr; 1935 struct net_lro_mgr *lro_mgr;
1846 int status, big_pow2; 1936 int status, big_pow2;
1847 1937
1848 mgp = netdev_priv(dev);
1849
1850 if (mgp->running != MYRI10GE_ETH_STOPPED) 1938 if (mgp->running != MYRI10GE_ETH_STOPPED)
1851 return -EBUSY; 1939 return -EBUSY;
1852 1940
@@ -1883,16 +1971,16 @@ static int myri10ge_open(struct net_device *dev)
1883 /* get the lanai pointers to the send and receive rings */ 1971 /* get the lanai pointers to the send and receive rings */
1884 1972
1885 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_OFFSET, &cmd, 0); 1973 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_OFFSET, &cmd, 0);
1886 mgp->tx.lanai = 1974 mgp->ss.tx.lanai =
1887 (struct mcp_kreq_ether_send __iomem *)(mgp->sram + cmd.data0); 1975 (struct mcp_kreq_ether_send __iomem *)(mgp->sram + cmd.data0);
1888 1976
1889 status |= 1977 status |=
1890 myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SMALL_RX_OFFSET, &cmd, 0); 1978 myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SMALL_RX_OFFSET, &cmd, 0);
1891 mgp->rx_small.lanai = 1979 mgp->ss.rx_small.lanai =
1892 (struct mcp_kreq_ether_recv __iomem *)(mgp->sram + cmd.data0); 1980 (struct mcp_kreq_ether_recv __iomem *)(mgp->sram + cmd.data0);
1893 1981
1894 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_BIG_RX_OFFSET, &cmd, 0); 1982 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_BIG_RX_OFFSET, &cmd, 0);
1895 mgp->rx_big.lanai = 1983 mgp->ss.rx_big.lanai =
1896 (struct mcp_kreq_ether_recv __iomem *)(mgp->sram + cmd.data0); 1984 (struct mcp_kreq_ether_recv __iomem *)(mgp->sram + cmd.data0);
1897 1985
1898 if (status != 0) { 1986 if (status != 0) {
@@ -1904,15 +1992,15 @@ static int myri10ge_open(struct net_device *dev)
1904 } 1992 }
1905 1993
1906 if (myri10ge_wcfifo && mgp->wc_enabled) { 1994 if (myri10ge_wcfifo && mgp->wc_enabled) {
1907 mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; 1995 mgp->ss.tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4;
1908 mgp->rx_small.wc_fifo = 1996 mgp->ss.rx_small.wc_fifo =
1909 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; 1997 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL;
1910 mgp->rx_big.wc_fifo = 1998 mgp->ss.rx_big.wc_fifo =
1911 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_BIG; 1999 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_BIG;
1912 } else { 2000 } else {
1913 mgp->tx.wc_fifo = NULL; 2001 mgp->ss.tx.wc_fifo = NULL;
1914 mgp->rx_small.wc_fifo = NULL; 2002 mgp->ss.rx_small.wc_fifo = NULL;
1915 mgp->rx_big.wc_fifo = NULL; 2003 mgp->ss.rx_big.wc_fifo = NULL;
1916 } 2004 }
1917 2005
1918 /* Firmware needs the big buff size as a power of 2. Lie and 2006 /* Firmware needs the big buff size as a power of 2. Lie and
@@ -1929,7 +2017,7 @@ static int myri10ge_open(struct net_device *dev)
1929 mgp->big_bytes = big_pow2; 2017 mgp->big_bytes = big_pow2;
1930 } 2018 }
1931 2019
1932 status = myri10ge_allocate_rings(dev); 2020 status = myri10ge_allocate_rings(&mgp->ss);
1933 if (status != 0) 2021 if (status != 0)
1934 goto abort_with_irq; 2022 goto abort_with_irq;
1935 2023
@@ -1948,12 +2036,12 @@ static int myri10ge_open(struct net_device *dev)
1948 goto abort_with_rings; 2036 goto abort_with_rings;
1949 } 2037 }
1950 2038
1951 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->fw_stats_bus); 2039 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->ss.fw_stats_bus);
1952 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->fw_stats_bus); 2040 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->ss.fw_stats_bus);
1953 cmd.data2 = sizeof(struct mcp_irq_data); 2041 cmd.data2 = sizeof(struct mcp_irq_data);
1954 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_STATS_DMA_V2, &cmd, 0); 2042 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_STATS_DMA_V2, &cmd, 0);
1955 if (status == -ENOSYS) { 2043 if (status == -ENOSYS) {
1956 dma_addr_t bus = mgp->fw_stats_bus; 2044 dma_addr_t bus = mgp->ss.fw_stats_bus;
1957 bus += offsetof(struct mcp_irq_data, send_done_count); 2045 bus += offsetof(struct mcp_irq_data, send_done_count);
1958 cmd.data0 = MYRI10GE_LOWPART_TO_U32(bus); 2046 cmd.data0 = MYRI10GE_LOWPART_TO_U32(bus);
1959 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(bus); 2047 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(bus);
@@ -1974,20 +2062,20 @@ static int myri10ge_open(struct net_device *dev)
1974 mgp->link_state = ~0U; 2062 mgp->link_state = ~0U;
1975 mgp->rdma_tags_available = 15; 2063 mgp->rdma_tags_available = 15;
1976 2064
1977 lro_mgr = &mgp->rx_done.lro_mgr; 2065 lro_mgr = &mgp->ss.rx_done.lro_mgr;
1978 lro_mgr->dev = dev; 2066 lro_mgr->dev = dev;
1979 lro_mgr->features = LRO_F_NAPI; 2067 lro_mgr->features = LRO_F_NAPI;
1980 lro_mgr->ip_summed = CHECKSUM_COMPLETE; 2068 lro_mgr->ip_summed = CHECKSUM_COMPLETE;
1981 lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY; 2069 lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY;
1982 lro_mgr->max_desc = MYRI10GE_MAX_LRO_DESCRIPTORS; 2070 lro_mgr->max_desc = MYRI10GE_MAX_LRO_DESCRIPTORS;
1983 lro_mgr->lro_arr = mgp->rx_done.lro_desc; 2071 lro_mgr->lro_arr = mgp->ss.rx_done.lro_desc;
1984 lro_mgr->get_frag_header = myri10ge_get_frag_header; 2072 lro_mgr->get_frag_header = myri10ge_get_frag_header;
1985 lro_mgr->max_aggr = myri10ge_lro_max_pkts; 2073 lro_mgr->max_aggr = myri10ge_lro_max_pkts;
1986 lro_mgr->frag_align_pad = 2; 2074 lro_mgr->frag_align_pad = 2;
1987 if (lro_mgr->max_aggr > MAX_SKB_FRAGS) 2075 if (lro_mgr->max_aggr > MAX_SKB_FRAGS)
1988 lro_mgr->max_aggr = MAX_SKB_FRAGS; 2076 lro_mgr->max_aggr = MAX_SKB_FRAGS;
1989 2077
1990 napi_enable(&mgp->napi); /* must happen prior to any irq */ 2078 napi_enable(&mgp->ss.napi); /* must happen prior to any irq */
1991 2079
1992 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_UP, &cmd, 0); 2080 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_UP, &cmd, 0);
1993 if (status) { 2081 if (status) {
@@ -1996,8 +2084,8 @@ static int myri10ge_open(struct net_device *dev)
1996 goto abort_with_rings; 2084 goto abort_with_rings;
1997 } 2085 }
1998 2086
1999 mgp->wake_queue = 0; 2087 mgp->ss.tx.wake_queue = 0;
2000 mgp->stop_queue = 0; 2088 mgp->ss.tx.stop_queue = 0;
2001 mgp->running = MYRI10GE_ETH_RUNNING; 2089 mgp->running = MYRI10GE_ETH_RUNNING;
2002 mgp->watchdog_timer.expires = jiffies + myri10ge_watchdog_timeout * HZ; 2090 mgp->watchdog_timer.expires = jiffies + myri10ge_watchdog_timeout * HZ;
2003 add_timer(&mgp->watchdog_timer); 2091 add_timer(&mgp->watchdog_timer);
@@ -2005,7 +2093,7 @@ static int myri10ge_open(struct net_device *dev)
2005 return 0; 2093 return 0;
2006 2094
2007abort_with_rings: 2095abort_with_rings:
2008 myri10ge_free_rings(dev); 2096 myri10ge_free_rings(&mgp->ss);
2009 2097
2010abort_with_irq: 2098abort_with_irq:
2011 myri10ge_free_irq(mgp); 2099 myri10ge_free_irq(mgp);
@@ -2017,21 +2105,19 @@ abort_with_nothing:
2017 2105
2018static int myri10ge_close(struct net_device *dev) 2106static int myri10ge_close(struct net_device *dev)
2019{ 2107{
2020 struct myri10ge_priv *mgp; 2108 struct myri10ge_priv *mgp = netdev_priv(dev);
2021 struct myri10ge_cmd cmd; 2109 struct myri10ge_cmd cmd;
2022 int status, old_down_cnt; 2110 int status, old_down_cnt;
2023 2111
2024 mgp = netdev_priv(dev);
2025
2026 if (mgp->running != MYRI10GE_ETH_RUNNING) 2112 if (mgp->running != MYRI10GE_ETH_RUNNING)
2027 return 0; 2113 return 0;
2028 2114
2029 if (mgp->tx.req_bytes == NULL) 2115 if (mgp->ss.tx.req_bytes == NULL)
2030 return 0; 2116 return 0;
2031 2117
2032 del_timer_sync(&mgp->watchdog_timer); 2118 del_timer_sync(&mgp->watchdog_timer);
2033 mgp->running = MYRI10GE_ETH_STOPPING; 2119 mgp->running = MYRI10GE_ETH_STOPPING;
2034 napi_disable(&mgp->napi); 2120 napi_disable(&mgp->ss.napi);
2035 netif_carrier_off(dev); 2121 netif_carrier_off(dev);
2036 netif_stop_queue(dev); 2122 netif_stop_queue(dev);
2037 old_down_cnt = mgp->down_cnt; 2123 old_down_cnt = mgp->down_cnt;
@@ -2047,7 +2133,7 @@ static int myri10ge_close(struct net_device *dev)
2047 2133
2048 netif_tx_disable(dev); 2134 netif_tx_disable(dev);
2049 myri10ge_free_irq(mgp); 2135 myri10ge_free_irq(mgp);
2050 myri10ge_free_rings(dev); 2136 myri10ge_free_rings(&mgp->ss);
2051 2137
2052 mgp->running = MYRI10GE_ETH_STOPPED; 2138 mgp->running = MYRI10GE_ETH_STOPPED;
2053 return 0; 2139 return 0;
@@ -2143,7 +2229,7 @@ myri10ge_submit_req_wc(struct myri10ge_tx_buf *tx,
2143 2229
2144/* 2230/*
2145 * Transmit a packet. We need to split the packet so that a single 2231 * Transmit a packet. We need to split the packet so that a single
2146 * segment does not cross myri10ge->tx.boundary, so this makes segment 2232 * segment does not cross myri10ge->tx_boundary, so this makes segment
2147 * counting tricky. So rather than try to count segments up front, we 2233 * counting tricky. So rather than try to count segments up front, we
2148 * just give up if there are too few segments to hold a reasonably 2234 * just give up if there are too few segments to hold a reasonably
2149 * fragmented packet currently available. If we run 2235 * fragmented packet currently available. If we run
@@ -2154,8 +2240,9 @@ myri10ge_submit_req_wc(struct myri10ge_tx_buf *tx,
2154static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) 2240static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
2155{ 2241{
2156 struct myri10ge_priv *mgp = netdev_priv(dev); 2242 struct myri10ge_priv *mgp = netdev_priv(dev);
2243 struct myri10ge_slice_state *ss;
2157 struct mcp_kreq_ether_send *req; 2244 struct mcp_kreq_ether_send *req;
2158 struct myri10ge_tx_buf *tx = &mgp->tx; 2245 struct myri10ge_tx_buf *tx;
2159 struct skb_frag_struct *frag; 2246 struct skb_frag_struct *frag;
2160 dma_addr_t bus; 2247 dma_addr_t bus;
2161 u32 low; 2248 u32 low;
@@ -2166,6 +2253,9 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
2166 int cum_len, seglen, boundary, rdma_count; 2253 int cum_len, seglen, boundary, rdma_count;
2167 u8 flags, odd_flag; 2254 u8 flags, odd_flag;
2168 2255
2256 /* always transmit through slot 0 */
2257 ss = &mgp->ss;
2258 tx = &ss->tx;
2169again: 2259again:
2170 req = tx->req_list; 2260 req = tx->req_list;
2171 avail = tx->mask - 1 - (tx->req - tx->done); 2261 avail = tx->mask - 1 - (tx->req - tx->done);
@@ -2180,7 +2270,7 @@ again:
2180 2270
2181 if ((unlikely(avail < max_segments))) { 2271 if ((unlikely(avail < max_segments))) {
2182 /* we are out of transmit resources */ 2272 /* we are out of transmit resources */
2183 mgp->stop_queue++; 2273 tx->stop_queue++;
2184 netif_stop_queue(dev); 2274 netif_stop_queue(dev);
2185 return 1; 2275 return 1;
2186 } 2276 }
@@ -2242,7 +2332,7 @@ again:
2242 if (skb_padto(skb, ETH_ZLEN)) { 2332 if (skb_padto(skb, ETH_ZLEN)) {
2243 /* The packet is gone, so we must 2333 /* The packet is gone, so we must
2244 * return 0 */ 2334 * return 0 */
2245 mgp->stats.tx_dropped += 1; 2335 ss->stats.tx_dropped += 1;
2246 return 0; 2336 return 0;
2247 } 2337 }
2248 /* adjust the len to account for the zero pad 2338 /* adjust the len to account for the zero pad
@@ -2284,7 +2374,7 @@ again:
2284 2374
2285 while (1) { 2375 while (1) {
2286 /* Break the SKB or Fragment up into pieces which 2376 /* Break the SKB or Fragment up into pieces which
2287 * do not cross mgp->tx.boundary */ 2377 * do not cross mgp->tx_boundary */
2288 low = MYRI10GE_LOWPART_TO_U32(bus); 2378 low = MYRI10GE_LOWPART_TO_U32(bus);
2289 high_swapped = htonl(MYRI10GE_HIGHPART_TO_U32(bus)); 2379 high_swapped = htonl(MYRI10GE_HIGHPART_TO_U32(bus));
2290 while (len) { 2380 while (len) {
@@ -2294,7 +2384,8 @@ again:
2294 if (unlikely(count == max_segments)) 2384 if (unlikely(count == max_segments))
2295 goto abort_linearize; 2385 goto abort_linearize;
2296 2386
2297 boundary = (low + tx->boundary) & ~(tx->boundary - 1); 2387 boundary =
2388 (low + mgp->tx_boundary) & ~(mgp->tx_boundary - 1);
2298 seglen = boundary - low; 2389 seglen = boundary - low;
2299 if (seglen > len) 2390 if (seglen > len)
2300 seglen = len; 2391 seglen = len;
@@ -2378,7 +2469,7 @@ again:
2378 myri10ge_submit_req_wc(tx, tx->req_list, count); 2469 myri10ge_submit_req_wc(tx, tx->req_list, count);
2379 tx->pkt_start++; 2470 tx->pkt_start++;
2380 if ((avail - count) < MXGEFW_MAX_SEND_DESC) { 2471 if ((avail - count) < MXGEFW_MAX_SEND_DESC) {
2381 mgp->stop_queue++; 2472 tx->stop_queue++;
2382 netif_stop_queue(dev); 2473 netif_stop_queue(dev);
2383 } 2474 }
2384 dev->trans_start = jiffies; 2475 dev->trans_start = jiffies;
@@ -2420,12 +2511,12 @@ abort_linearize:
2420 if (skb_linearize(skb)) 2511 if (skb_linearize(skb))
2421 goto drop; 2512 goto drop;
2422 2513
2423 mgp->tx_linearized++; 2514 tx->linearized++;
2424 goto again; 2515 goto again;
2425 2516
2426drop: 2517drop:
2427 dev_kfree_skb_any(skb); 2518 dev_kfree_skb_any(skb);
2428 mgp->stats.tx_dropped += 1; 2519 ss->stats.tx_dropped += 1;
2429 return 0; 2520 return 0;
2430 2521
2431} 2522}
@@ -2433,7 +2524,7 @@ drop:
2433static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev) 2524static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev)
2434{ 2525{
2435 struct sk_buff *segs, *curr; 2526 struct sk_buff *segs, *curr;
2436 struct myri10ge_priv *mgp = dev->priv; 2527 struct myri10ge_priv *mgp = netdev_priv(dev);
2437 int status; 2528 int status;
2438 2529
2439 segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6); 2530 segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6);
@@ -2473,14 +2564,13 @@ static struct net_device_stats *myri10ge_get_stats(struct net_device *dev)
2473 2564
2474static void myri10ge_set_multicast_list(struct net_device *dev) 2565static void myri10ge_set_multicast_list(struct net_device *dev)
2475{ 2566{
2567 struct myri10ge_priv *mgp = netdev_priv(dev);
2476 struct myri10ge_cmd cmd; 2568 struct myri10ge_cmd cmd;
2477 struct myri10ge_priv *mgp;
2478 struct dev_mc_list *mc_list; 2569 struct dev_mc_list *mc_list;
2479 __be32 data[2] = { 0, 0 }; 2570 __be32 data[2] = { 0, 0 };
2480 int err; 2571 int err;
2481 DECLARE_MAC_BUF(mac); 2572 DECLARE_MAC_BUF(mac);
2482 2573
2483 mgp = netdev_priv(dev);
2484 /* can be called from atomic contexts, 2574 /* can be called from atomic contexts,
2485 * pass 1 to force atomicity in myri10ge_send_cmd() */ 2575 * pass 1 to force atomicity in myri10ge_send_cmd() */
2486 myri10ge_change_promisc(mgp, dev->flags & IFF_PROMISC, 1); 2576 myri10ge_change_promisc(mgp, dev->flags & IFF_PROMISC, 1);
@@ -2616,13 +2706,14 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
2616 ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4; 2706 ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4;
2617 if (ext_type != PCI_EXP_TYPE_ROOT_PORT) { 2707 if (ext_type != PCI_EXP_TYPE_ROOT_PORT) {
2618 if (myri10ge_ecrc_enable > 1) { 2708 if (myri10ge_ecrc_enable > 1) {
2619 struct pci_dev *old_bridge = bridge; 2709 struct pci_dev *prev_bridge, *old_bridge = bridge;
2620 2710
2621 /* Walk the hierarchy up to the root port 2711 /* Walk the hierarchy up to the root port
2622 * where ECRC has to be enabled */ 2712 * where ECRC has to be enabled */
2623 do { 2713 do {
2714 prev_bridge = bridge;
2624 bridge = bridge->bus->self; 2715 bridge = bridge->bus->self;
2625 if (!bridge) { 2716 if (!bridge || prev_bridge == bridge) {
2626 dev_err(dev, 2717 dev_err(dev,
2627 "Failed to find root port" 2718 "Failed to find root port"
2628 " to force ECRC\n"); 2719 " to force ECRC\n");
@@ -2681,9 +2772,9 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
2681 * already been enabled, then it must use a firmware image which works 2772 * already been enabled, then it must use a firmware image which works
2682 * around unaligned completion packets (myri10ge_ethp_z8e.dat), and it 2773 * around unaligned completion packets (myri10ge_ethp_z8e.dat), and it
2683 * should also ensure that it never gives the device a Read-DMA which is 2774 * should also ensure that it never gives the device a Read-DMA which is
2684 * larger than 2KB by setting the tx.boundary to 2KB. If ECRC is 2775 * larger than 2KB by setting the tx_boundary to 2KB. If ECRC is
2685 * enabled, then the driver should use the aligned (myri10ge_eth_z8e.dat) 2776 * enabled, then the driver should use the aligned (myri10ge_eth_z8e.dat)
2686 * firmware image, and set tx.boundary to 4KB. 2777 * firmware image, and set tx_boundary to 4KB.
2687 */ 2778 */
2688 2779
2689static void myri10ge_firmware_probe(struct myri10ge_priv *mgp) 2780static void myri10ge_firmware_probe(struct myri10ge_priv *mgp)
@@ -2692,7 +2783,7 @@ static void myri10ge_firmware_probe(struct myri10ge_priv *mgp)
2692 struct device *dev = &pdev->dev; 2783 struct device *dev = &pdev->dev;
2693 int status; 2784 int status;
2694 2785
2695 mgp->tx.boundary = 4096; 2786 mgp->tx_boundary = 4096;
2696 /* 2787 /*
2697 * Verify the max read request size was set to 4KB 2788 * Verify the max read request size was set to 4KB
2698 * before trying the test with 4KB. 2789 * before trying the test with 4KB.
@@ -2704,7 +2795,7 @@ static void myri10ge_firmware_probe(struct myri10ge_priv *mgp)
2704 } 2795 }
2705 if (status != 4096) { 2796 if (status != 4096) {
2706 dev_warn(dev, "Max Read Request size != 4096 (%d)\n", status); 2797 dev_warn(dev, "Max Read Request size != 4096 (%d)\n", status);
2707 mgp->tx.boundary = 2048; 2798 mgp->tx_boundary = 2048;
2708 } 2799 }
2709 /* 2800 /*
2710 * load the optimized firmware (which assumes aligned PCIe 2801 * load the optimized firmware (which assumes aligned PCIe
@@ -2737,7 +2828,7 @@ static void myri10ge_firmware_probe(struct myri10ge_priv *mgp)
2737 "Please install up to date fw\n"); 2828 "Please install up to date fw\n");
2738abort: 2829abort:
2739 /* fall back to using the unaligned firmware */ 2830 /* fall back to using the unaligned firmware */
2740 mgp->tx.boundary = 2048; 2831 mgp->tx_boundary = 2048;
2741 mgp->fw_name = myri10ge_fw_unaligned; 2832 mgp->fw_name = myri10ge_fw_unaligned;
2742 2833
2743} 2834}
@@ -2758,7 +2849,7 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2758 if (link_width < 8) { 2849 if (link_width < 8) {
2759 dev_info(&mgp->pdev->dev, "PCIE x%d Link\n", 2850 dev_info(&mgp->pdev->dev, "PCIE x%d Link\n",
2760 link_width); 2851 link_width);
2761 mgp->tx.boundary = 4096; 2852 mgp->tx_boundary = 4096;
2762 mgp->fw_name = myri10ge_fw_aligned; 2853 mgp->fw_name = myri10ge_fw_aligned;
2763 } else { 2854 } else {
2764 myri10ge_firmware_probe(mgp); 2855 myri10ge_firmware_probe(mgp);
@@ -2767,12 +2858,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2767 if (myri10ge_force_firmware == 1) { 2858 if (myri10ge_force_firmware == 1) {
2768 dev_info(&mgp->pdev->dev, 2859 dev_info(&mgp->pdev->dev,
2769 "Assuming aligned completions (forced)\n"); 2860 "Assuming aligned completions (forced)\n");
2770 mgp->tx.boundary = 4096; 2861 mgp->tx_boundary = 4096;
2771 mgp->fw_name = myri10ge_fw_aligned; 2862 mgp->fw_name = myri10ge_fw_aligned;
2772 } else { 2863 } else {
2773 dev_info(&mgp->pdev->dev, 2864 dev_info(&mgp->pdev->dev,
2774 "Assuming unaligned completions (forced)\n"); 2865 "Assuming unaligned completions (forced)\n");
2775 mgp->tx.boundary = 2048; 2866 mgp->tx_boundary = 2048;
2776 mgp->fw_name = myri10ge_fw_unaligned; 2867 mgp->fw_name = myri10ge_fw_unaligned;
2777 } 2868 }
2778 } 2869 }
@@ -2889,6 +2980,7 @@ static void myri10ge_watchdog(struct work_struct *work)
2889{ 2980{
2890 struct myri10ge_priv *mgp = 2981 struct myri10ge_priv *mgp =
2891 container_of(work, struct myri10ge_priv, watchdog_work); 2982 container_of(work, struct myri10ge_priv, watchdog_work);
2983 struct myri10ge_tx_buf *tx;
2892 u32 reboot; 2984 u32 reboot;
2893 int status; 2985 int status;
2894 u16 cmd, vendor; 2986 u16 cmd, vendor;
@@ -2938,15 +3030,16 @@ static void myri10ge_watchdog(struct work_struct *work)
2938 3030
2939 printk(KERN_ERR "myri10ge: %s: device timeout, resetting\n", 3031 printk(KERN_ERR "myri10ge: %s: device timeout, resetting\n",
2940 mgp->dev->name); 3032 mgp->dev->name);
3033 tx = &mgp->ss.tx;
2941 printk(KERN_INFO "myri10ge: %s: %d %d %d %d %d\n", 3034 printk(KERN_INFO "myri10ge: %s: %d %d %d %d %d\n",
2942 mgp->dev->name, mgp->tx.req, mgp->tx.done, 3035 mgp->dev->name, tx->req, tx->done,
2943 mgp->tx.pkt_start, mgp->tx.pkt_done, 3036 tx->pkt_start, tx->pkt_done,
2944 (int)ntohl(mgp->fw_stats->send_done_count)); 3037 (int)ntohl(mgp->ss.fw_stats->send_done_count));
2945 msleep(2000); 3038 msleep(2000);
2946 printk(KERN_INFO "myri10ge: %s: %d %d %d %d %d\n", 3039 printk(KERN_INFO "myri10ge: %s: %d %d %d %d %d\n",
2947 mgp->dev->name, mgp->tx.req, mgp->tx.done, 3040 mgp->dev->name, tx->req, tx->done,
2948 mgp->tx.pkt_start, mgp->tx.pkt_done, 3041 tx->pkt_start, tx->pkt_done,
2949 (int)ntohl(mgp->fw_stats->send_done_count)); 3042 (int)ntohl(mgp->ss.fw_stats->send_done_count));
2950 } 3043 }
2951 rtnl_lock(); 3044 rtnl_lock();
2952 myri10ge_close(mgp->dev); 3045 myri10ge_close(mgp->dev);
@@ -2969,28 +3062,31 @@ static void myri10ge_watchdog(struct work_struct *work)
2969static void myri10ge_watchdog_timer(unsigned long arg) 3062static void myri10ge_watchdog_timer(unsigned long arg)
2970{ 3063{
2971 struct myri10ge_priv *mgp; 3064 struct myri10ge_priv *mgp;
3065 struct myri10ge_slice_state *ss;
2972 u32 rx_pause_cnt; 3066 u32 rx_pause_cnt;
2973 3067
2974 mgp = (struct myri10ge_priv *)arg; 3068 mgp = (struct myri10ge_priv *)arg;
2975 3069
2976 if (mgp->rx_small.watchdog_needed) { 3070 rx_pause_cnt = ntohl(mgp->ss.fw_stats->dropped_pause);
2977 myri10ge_alloc_rx_pages(mgp, &mgp->rx_small, 3071
3072 ss = &mgp->ss;
3073 if (ss->rx_small.watchdog_needed) {
3074 myri10ge_alloc_rx_pages(mgp, &ss->rx_small,
2978 mgp->small_bytes + MXGEFW_PAD, 1); 3075 mgp->small_bytes + MXGEFW_PAD, 1);
2979 if (mgp->rx_small.fill_cnt - mgp->rx_small.cnt >= 3076 if (ss->rx_small.fill_cnt - ss->rx_small.cnt >=
2980 myri10ge_fill_thresh) 3077 myri10ge_fill_thresh)
2981 mgp->rx_small.watchdog_needed = 0; 3078 ss->rx_small.watchdog_needed = 0;
2982 } 3079 }
2983 if (mgp->rx_big.watchdog_needed) { 3080 if (ss->rx_big.watchdog_needed) {
2984 myri10ge_alloc_rx_pages(mgp, &mgp->rx_big, mgp->big_bytes, 1); 3081 myri10ge_alloc_rx_pages(mgp, &ss->rx_big, mgp->big_bytes, 1);
2985 if (mgp->rx_big.fill_cnt - mgp->rx_big.cnt >= 3082 if (ss->rx_big.fill_cnt - ss->rx_big.cnt >=
2986 myri10ge_fill_thresh) 3083 myri10ge_fill_thresh)
2987 mgp->rx_big.watchdog_needed = 0; 3084 ss->rx_big.watchdog_needed = 0;
2988 } 3085 }
2989 rx_pause_cnt = ntohl(mgp->fw_stats->dropped_pause);
2990 3086
2991 if (mgp->tx.req != mgp->tx.done && 3087 if (ss->tx.req != ss->tx.done &&
2992 mgp->tx.done == mgp->watchdog_tx_done && 3088 ss->tx.done == ss->watchdog_tx_done &&
2993 mgp->watchdog_tx_req != mgp->watchdog_tx_done) { 3089 ss->watchdog_tx_req != ss->watchdog_tx_done) {
2994 /* nic seems like it might be stuck.. */ 3090 /* nic seems like it might be stuck.. */
2995 if (rx_pause_cnt != mgp->watchdog_pause) { 3091 if (rx_pause_cnt != mgp->watchdog_pause) {
2996 if (net_ratelimit()) 3092 if (net_ratelimit())
@@ -3005,8 +3101,8 @@ static void myri10ge_watchdog_timer(unsigned long arg)
3005 /* rearm timer */ 3101 /* rearm timer */
3006 mod_timer(&mgp->watchdog_timer, 3102 mod_timer(&mgp->watchdog_timer,
3007 jiffies + myri10ge_watchdog_timeout * HZ); 3103 jiffies + myri10ge_watchdog_timeout * HZ);
3008 mgp->watchdog_tx_done = mgp->tx.done; 3104 ss->watchdog_tx_done = ss->tx.done;
3009 mgp->watchdog_tx_req = mgp->tx.req; 3105 ss->watchdog_tx_req = ss->tx.req;
3010 mgp->watchdog_pause = rx_pause_cnt; 3106 mgp->watchdog_pause = rx_pause_cnt;
3011} 3107}
3012 3108
@@ -3030,7 +3126,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3030 3126
3031 mgp = netdev_priv(netdev); 3127 mgp = netdev_priv(netdev);
3032 mgp->dev = netdev; 3128 mgp->dev = netdev;
3033 netif_napi_add(netdev, &mgp->napi, myri10ge_poll, myri10ge_napi_weight); 3129 netif_napi_add(netdev, &mgp->ss.napi, myri10ge_poll, myri10ge_napi_weight);
3034 mgp->pdev = pdev; 3130 mgp->pdev = pdev;
3035 mgp->csum_flag = MXGEFW_FLAGS_CKSUM; 3131 mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
3036 mgp->pause = myri10ge_flow_control; 3132 mgp->pause = myri10ge_flow_control;
@@ -3076,9 +3172,9 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3076 if (mgp->cmd == NULL) 3172 if (mgp->cmd == NULL)
3077 goto abort_with_netdev; 3173 goto abort_with_netdev;
3078 3174
3079 mgp->fw_stats = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->fw_stats), 3175 mgp->ss.fw_stats = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->ss.fw_stats),
3080 &mgp->fw_stats_bus, GFP_KERNEL); 3176 &mgp->ss.fw_stats_bus, GFP_KERNEL);
3081 if (mgp->fw_stats == NULL) 3177 if (mgp->ss.fw_stats == NULL)
3082 goto abort_with_cmd; 3178 goto abort_with_cmd;
3083 3179
3084 mgp->board_span = pci_resource_len(pdev, 0); 3180 mgp->board_span = pci_resource_len(pdev, 0);
@@ -3118,12 +3214,12 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3118 netdev->dev_addr[i] = mgp->mac_addr[i]; 3214 netdev->dev_addr[i] = mgp->mac_addr[i];
3119 3215
3120 /* allocate rx done ring */ 3216 /* allocate rx done ring */
3121 bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); 3217 bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
3122 mgp->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes, 3218 mgp->ss.rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes,
3123 &mgp->rx_done.bus, GFP_KERNEL); 3219 &mgp->ss.rx_done.bus, GFP_KERNEL);
3124 if (mgp->rx_done.entry == NULL) 3220 if (mgp->ss.rx_done.entry == NULL)
3125 goto abort_with_ioremap; 3221 goto abort_with_ioremap;
3126 memset(mgp->rx_done.entry, 0, bytes); 3222 memset(mgp->ss.rx_done.entry, 0, bytes);
3127 3223
3128 myri10ge_select_firmware(mgp); 3224 myri10ge_select_firmware(mgp);
3129 3225
@@ -3183,7 +3279,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3183 } 3279 }
3184 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", 3280 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n",
3185 (mgp->msi_enabled ? "MSI" : "xPIC"), 3281 (mgp->msi_enabled ? "MSI" : "xPIC"),
3186 netdev->irq, mgp->tx.boundary, mgp->fw_name, 3282 netdev->irq, mgp->tx_boundary, mgp->fw_name,
3187 (mgp->wc_enabled ? "Enabled" : "Disabled")); 3283 (mgp->wc_enabled ? "Enabled" : "Disabled"));
3188 3284
3189 return 0; 3285 return 0;
@@ -3195,9 +3291,9 @@ abort_with_firmware:
3195 myri10ge_dummy_rdma(mgp, 0); 3291 myri10ge_dummy_rdma(mgp, 0);
3196 3292
3197abort_with_rx_done: 3293abort_with_rx_done:
3198 bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); 3294 bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
3199 dma_free_coherent(&pdev->dev, bytes, 3295 dma_free_coherent(&pdev->dev, bytes,
3200 mgp->rx_done.entry, mgp->rx_done.bus); 3296 mgp->ss.rx_done.entry, mgp->ss.rx_done.bus);
3201 3297
3202abort_with_ioremap: 3298abort_with_ioremap:
3203 iounmap(mgp->sram); 3299 iounmap(mgp->sram);
@@ -3207,8 +3303,8 @@ abort_with_wc:
3207 if (mgp->mtrr >= 0) 3303 if (mgp->mtrr >= 0)
3208 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span); 3304 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
3209#endif 3305#endif
3210 dma_free_coherent(&pdev->dev, sizeof(*mgp->fw_stats), 3306 dma_free_coherent(&pdev->dev, sizeof(*mgp->ss.fw_stats),
3211 mgp->fw_stats, mgp->fw_stats_bus); 3307 mgp->ss.fw_stats, mgp->ss.fw_stats_bus);
3212 3308
3213abort_with_cmd: 3309abort_with_cmd:
3214 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 3310 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
@@ -3246,9 +3342,9 @@ static void myri10ge_remove(struct pci_dev *pdev)
3246 /* avoid a memory leak */ 3342 /* avoid a memory leak */
3247 pci_restore_state(pdev); 3343 pci_restore_state(pdev);
3248 3344
3249 bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); 3345 bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
3250 dma_free_coherent(&pdev->dev, bytes, 3346 dma_free_coherent(&pdev->dev, bytes,
3251 mgp->rx_done.entry, mgp->rx_done.bus); 3347 mgp->ss.rx_done.entry, mgp->ss.rx_done.bus);
3252 3348
3253 iounmap(mgp->sram); 3349 iounmap(mgp->sram);
3254 3350
@@ -3256,8 +3352,8 @@ static void myri10ge_remove(struct pci_dev *pdev)
3256 if (mgp->mtrr >= 0) 3352 if (mgp->mtrr >= 0)
3257 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span); 3353 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
3258#endif 3354#endif
3259 dma_free_coherent(&pdev->dev, sizeof(*mgp->fw_stats), 3355 dma_free_coherent(&pdev->dev, sizeof(*mgp->ss.fw_stats),
3260 mgp->fw_stats, mgp->fw_stats_bus); 3356 mgp->ss.fw_stats, mgp->ss.fw_stats_bus);
3261 3357
3262 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 3358 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
3263 mgp->cmd, mgp->cmd_bus); 3359 mgp->cmd, mgp->cmd_bus);
diff --git a/drivers/net/myri10ge/myri10ge_mcp.h b/drivers/net/myri10ge/myri10ge_mcp.h
index 58e57178c563..fdbeeee07372 100644
--- a/drivers/net/myri10ge/myri10ge_mcp.h
+++ b/drivers/net/myri10ge/myri10ge_mcp.h
@@ -10,7 +10,7 @@ struct mcp_dma_addr {
10 __be32 low; 10 __be32 low;
11}; 11};
12 12
13/* 4 Bytes. 8 Bytes for NDIS drivers. */ 13/* 4 Bytes */
14struct mcp_slot { 14struct mcp_slot {
15 __sum16 checksum; 15 __sum16 checksum;
16 __be16 length; 16 __be16 length;
@@ -144,6 +144,7 @@ enum myri10ge_mcp_cmd_type {
144 * a power of 2 number of entries. */ 144 * a power of 2 number of entries. */
145 145
146 MXGEFW_CMD_SET_INTRQ_SIZE, /* in bytes */ 146 MXGEFW_CMD_SET_INTRQ_SIZE, /* in bytes */
147#define MXGEFW_CMD_SET_INTRQ_SIZE_FLAG_NO_STRICT_SIZE_CHECK (1 << 31)
147 148
148 /* command to bring ethernet interface up. Above parameters 149 /* command to bring ethernet interface up. Above parameters
149 * (plus mtu & mac address) must have been exchanged prior 150 * (plus mtu & mac address) must have been exchanged prior
@@ -221,10 +222,14 @@ enum myri10ge_mcp_cmd_type {
221 MXGEFW_CMD_GET_MAX_RSS_QUEUES, 222 MXGEFW_CMD_GET_MAX_RSS_QUEUES,
222 MXGEFW_CMD_ENABLE_RSS_QUEUES, 223 MXGEFW_CMD_ENABLE_RSS_QUEUES,
223 /* data0 = number of slices n (0, 1, ..., n-1) to enable 224 /* data0 = number of slices n (0, 1, ..., n-1) to enable
224 * data1 = interrupt mode. 0=share one INTx/MSI, 1=use one MSI-X per queue. 225 * data1 = interrupt mode.
226 * 0=share one INTx/MSI, 1=use one MSI-X per queue.
225 * If all queues share one interrupt, the driver must have set 227 * If all queues share one interrupt, the driver must have set
226 * RSS_SHARED_INTERRUPT_DMA before enabling queues. 228 * RSS_SHARED_INTERRUPT_DMA before enabling queues.
227 */ 229 */
230#define MXGEFW_SLICE_INTR_MODE_SHARED 0
231#define MXGEFW_SLICE_INTR_MODE_ONE_PER_SLICE 1
232
228 MXGEFW_CMD_GET_RSS_SHARED_INTERRUPT_MASK_OFFSET, 233 MXGEFW_CMD_GET_RSS_SHARED_INTERRUPT_MASK_OFFSET,
229 MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA, 234 MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA,
230 /* data0, data1 = bus address lsw, msw */ 235 /* data0, data1 = bus address lsw, msw */
@@ -241,10 +246,14 @@ enum myri10ge_mcp_cmd_type {
241 * 0: disable rss. nic does not distribute receive packets. 246 * 0: disable rss. nic does not distribute receive packets.
242 * 1: enable rss. nic distributes receive packets among queues. 247 * 1: enable rss. nic distributes receive packets among queues.
243 * data1 = hash type 248 * data1 = hash type
244 * 1: IPV4 249 * 1: IPV4 (required by RSS)
245 * 2: TCP_IPV4 250 * 2: TCP_IPV4 (required by RSS)
246 * 3: IPV4 | TCP_IPV4 251 * 3: IPV4 | TCP_IPV4 (required by RSS)
252 * 4: source port
247 */ 253 */
254#define MXGEFW_RSS_HASH_TYPE_IPV4 0x1
255#define MXGEFW_RSS_HASH_TYPE_TCP_IPV4 0x2
256#define MXGEFW_RSS_HASH_TYPE_SRC_PORT 0x4
248 257
249 MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE, 258 MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
250 /* Return data = the max. size of the entire headers of a IPv6 TSO packet. 259 /* Return data = the max. size of the entire headers of a IPv6 TSO packet.
@@ -260,6 +269,8 @@ enum myri10ge_mcp_cmd_type {
260 * 0: Linux/FreeBSD style (NIC default) 269 * 0: Linux/FreeBSD style (NIC default)
261 * 1: NDIS/NetBSD style 270 * 1: NDIS/NetBSD style
262 */ 271 */
272#define MXGEFW_TSO_MODE_LINUX 0
273#define MXGEFW_TSO_MODE_NDIS 1
263 274
264 MXGEFW_CMD_MDIO_READ, 275 MXGEFW_CMD_MDIO_READ,
265 /* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */ 276 /* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */
@@ -286,6 +297,38 @@ enum myri10ge_mcp_cmd_type {
286 /* Return data = NIC memory offset of mcp_vpump_public_global */ 297 /* Return data = NIC memory offset of mcp_vpump_public_global */
287 MXGEFW_CMD_RESET_VPUMP, 298 MXGEFW_CMD_RESET_VPUMP,
288 /* Resets the VPUMP state */ 299 /* Resets the VPUMP state */
300
301 MXGEFW_CMD_SET_RSS_MCP_SLOT_TYPE,
302 /* data0 = mcp_slot type to use.
303 * 0 = the default 4B mcp_slot
304 * 1 = 8B mcp_slot_8
305 */
306#define MXGEFW_RSS_MCP_SLOT_TYPE_MIN 0
307#define MXGEFW_RSS_MCP_SLOT_TYPE_WITH_HASH 1
308
309 MXGEFW_CMD_SET_THROTTLE_FACTOR,
310 /* set the throttle factor for ethp_z8e
311 * data0 = throttle_factor
312 * throttle_factor = 256 * pcie-raw-speed / tx_speed
313 * tx_speed = 256 * pcie-raw-speed / throttle_factor
314 *
315 * For PCI-E x8: pcie-raw-speed == 16Gb/s
316 * For PCI-E x4: pcie-raw-speed == 8Gb/s
317 *
318 * ex1: throttle_factor == 0x1a0 (416), tx_speed == 1.23GB/s == 9.846 Gb/s
319 * ex2: throttle_factor == 0x200 (512), tx_speed == 1.0GB/s == 8 Gb/s
320 *
321 * with tx_boundary == 2048, max-throttle-factor == 8191 => min-speed == 500Mb/s
322 * with tx_boundary == 4096, max-throttle-factor == 4095 => min-speed == 1Gb/s
323 */
324
325 MXGEFW_CMD_VPUMP_UP,
326 /* Allocates VPump Connection, Send Request and Zero copy buffer address tables */
327 MXGEFW_CMD_GET_VPUMP_CLK,
328 /* Get the lanai clock */
329
330 MXGEFW_CMD_GET_DCA_OFFSET,
331 /* offset of dca control for WDMAs */
289}; 332};
290 333
291enum myri10ge_mcp_cmd_status { 334enum myri10ge_mcp_cmd_status {
@@ -302,7 +345,8 @@ enum myri10ge_mcp_cmd_status {
302 MXGEFW_CMD_ERROR_UNALIGNED, 345 MXGEFW_CMD_ERROR_UNALIGNED,
303 MXGEFW_CMD_ERROR_NO_MDIO, 346 MXGEFW_CMD_ERROR_NO_MDIO,
304 MXGEFW_CMD_ERROR_XFP_FAILURE, 347 MXGEFW_CMD_ERROR_XFP_FAILURE,
305 MXGEFW_CMD_ERROR_XFP_ABSENT 348 MXGEFW_CMD_ERROR_XFP_ABSENT,
349 MXGEFW_CMD_ERROR_BAD_PCIE_LINK
306}; 350};
307 351
308#define MXGEFW_OLD_IRQ_DATA_LEN 40 352#define MXGEFW_OLD_IRQ_DATA_LEN 40
diff --git a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
index 16a810dd6d51..07d65c2cbb24 100644
--- a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
+++ b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
@@ -1,30 +1,6 @@
1#ifndef __MYRI10GE_MCP_GEN_HEADER_H__ 1#ifndef __MYRI10GE_MCP_GEN_HEADER_H__
2#define __MYRI10GE_MCP_GEN_HEADER_H__ 2#define __MYRI10GE_MCP_GEN_HEADER_H__
3 3
4/* this file define a standard header used as a first entry point to
5 * exchange information between firmware/driver and driver. The
6 * header structure can be anywhere in the mcp. It will usually be in
7 * the .data section, because some fields needs to be initialized at
8 * compile time.
9 * The 32bit word at offset MX_HEADER_PTR_OFFSET in the mcp must
10 * contains the location of the header.
11 *
12 * Typically a MCP will start with the following:
13 * .text
14 * .space 52 ! to help catch MEMORY_INT errors
15 * bt start ! jump to real code
16 * nop
17 * .long _gen_mcp_header
18 *
19 * The source will have a definition like:
20 *
21 * mcp_gen_header_t gen_mcp_header = {
22 * .header_length = sizeof(mcp_gen_header_t),
23 * .mcp_type = MCP_TYPE_XXX,
24 * .version = "something $Id: mcp_gen_header.h,v 1.2 2006/05/13 10:04:35 bgoglin Exp $",
25 * .mcp_globals = (unsigned)&Globals
26 * };
27 */
28 4
29#define MCP_HEADER_PTR_OFFSET 0x3c 5#define MCP_HEADER_PTR_OFFSET 0x3c
30 6
@@ -32,13 +8,14 @@
32#define MCP_TYPE_PCIE 0x70636965 /* "PCIE" pcie-only MCP */ 8#define MCP_TYPE_PCIE 0x70636965 /* "PCIE" pcie-only MCP */
33#define MCP_TYPE_ETH 0x45544820 /* "ETH " */ 9#define MCP_TYPE_ETH 0x45544820 /* "ETH " */
34#define MCP_TYPE_MCP0 0x4d435030 /* "MCP0" */ 10#define MCP_TYPE_MCP0 0x4d435030 /* "MCP0" */
11#define MCP_TYPE_DFLT 0x20202020 /* " " */
35 12
36struct mcp_gen_header { 13struct mcp_gen_header {
37 /* the first 4 fields are filled at compile time */ 14 /* the first 4 fields are filled at compile time */
38 unsigned header_length; 15 unsigned header_length;
39 __be32 mcp_type; 16 __be32 mcp_type;
40 char version[128]; 17 char version[128];
41 unsigned mcp_globals; /* pointer to mcp-type specific structure */ 18 unsigned mcp_private; /* pointer to mcp-type specific structure */
42 19
43 /* filled by the MCP at run-time */ 20 /* filled by the MCP at run-time */
44 unsigned sram_size; 21 unsigned sram_size;
@@ -53,6 +30,18 @@ struct mcp_gen_header {
53 * 30 *
54 * Never remove any field. Keep everything naturally align. 31 * Never remove any field. Keep everything naturally align.
55 */ 32 */
33
34 /* Specifies if the running mcp is mcp0, 1, or 2. */
35 unsigned char mcp_index;
36 unsigned char disable_rabbit;
37 unsigned char unaligned_tlp;
38 unsigned char pad1;
39 unsigned counters_addr;
40 unsigned copy_block_info; /* for small mcps loaded with "lload -d" */
41 unsigned short handoff_id_major; /* must be equal */
42 unsigned short handoff_id_caps; /* bitfield: new mcp must have superset */
43 unsigned msix_table_addr; /* start address of msix table in firmware */
44 /* 8 */
56}; 45};
57 46
58#endif /* __MYRI10GE_MCP_GEN_HEADER_H__ */ 47#endif /* __MYRI10GE_MCP_GEN_HEADER_H__ */
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 57cfd72ffdf7..918f802fe089 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -865,7 +865,6 @@ static int link_status_1g_serdes(struct niu *np, int *link_up_p)
865 return 0; 865 return 0;
866} 866}
867 867
868
869static int link_status_10g_serdes(struct niu *np, int *link_up_p) 868static int link_status_10g_serdes(struct niu *np, int *link_up_p)
870{ 869{
871 unsigned long flags; 870 unsigned long flags;
@@ -900,7 +899,6 @@ static int link_status_10g_serdes(struct niu *np, int *link_up_p)
900 return 0; 899 return 0;
901} 900}
902 901
903
904static int link_status_1g_rgmii(struct niu *np, int *link_up_p) 902static int link_status_1g_rgmii(struct niu *np, int *link_up_p)
905{ 903{
906 struct niu_link_config *lp = &np->link_config; 904 struct niu_link_config *lp = &np->link_config;
@@ -957,7 +955,6 @@ out:
957 return err; 955 return err;
958} 956}
959 957
960
961static int bcm8704_reset(struct niu *np) 958static int bcm8704_reset(struct niu *np)
962{ 959{
963 int err, limit; 960 int err, limit;
@@ -1357,8 +1354,6 @@ static int mii_reset(struct niu *np)
1357 return 0; 1354 return 0;
1358} 1355}
1359 1356
1360
1361
1362static int xcvr_init_1g_rgmii(struct niu *np) 1357static int xcvr_init_1g_rgmii(struct niu *np)
1363{ 1358{
1364 int err; 1359 int err;
@@ -1419,7 +1414,6 @@ static int xcvr_init_1g_rgmii(struct niu *np)
1419 return 0; 1414 return 0;
1420} 1415}
1421 1416
1422
1423static int mii_init_common(struct niu *np) 1417static int mii_init_common(struct niu *np)
1424{ 1418{
1425 struct niu_link_config *lp = &np->link_config; 1419 struct niu_link_config *lp = &np->link_config;
@@ -7008,31 +7002,20 @@ static int __devinit niu_phy_type_prop_decode(struct niu *np,
7008 return 0; 7002 return 0;
7009} 7003}
7010 7004
7011/* niu board models have a trailing dash version incremented
7012 * with HW rev change. Need to ingnore the dash version while
7013 * checking for match
7014 *
7015 * for example, for the 10G card the current vpd.board_model
7016 * is 501-5283-04, of which -04 is the dash version and have
7017 * to be ignored
7018 */
7019static int niu_board_model_match(struct niu *np, const char *model)
7020{
7021 return !strncmp(np->vpd.board_model, model, strlen(model));
7022}
7023
7024static int niu_pci_vpd_get_nports(struct niu *np) 7005static int niu_pci_vpd_get_nports(struct niu *np)
7025{ 7006{
7026 int ports = 0; 7007 int ports = 0;
7027 7008
7028 if ((niu_board_model_match(np, NIU_QGC_LP_BM_STR)) || 7009 if ((!strcmp(np->vpd.model, NIU_QGC_LP_MDL_STR)) ||
7029 (niu_board_model_match(np, NIU_QGC_PEM_BM_STR)) || 7010 (!strcmp(np->vpd.model, NIU_QGC_PEM_MDL_STR)) ||
7030 (niu_board_model_match(np, NIU_ALONSO_BM_STR))) { 7011 (!strcmp(np->vpd.model, NIU_MARAMBA_MDL_STR)) ||
7012 (!strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) ||
7013 (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR))) {
7031 ports = 4; 7014 ports = 4;
7032 } else if ((niu_board_model_match(np, NIU_2XGF_LP_BM_STR)) || 7015 } else if ((!strcmp(np->vpd.model, NIU_2XGF_LP_MDL_STR)) ||
7033 (niu_board_model_match(np, NIU_2XGF_PEM_BM_STR)) || 7016 (!strcmp(np->vpd.model, NIU_2XGF_PEM_MDL_STR)) ||
7034 (niu_board_model_match(np, NIU_FOXXY_BM_STR)) || 7017 (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) ||
7035 (niu_board_model_match(np, NIU_2XGF_MRVL_BM_STR))) { 7018 (!strcmp(np->vpd.model, NIU_2XGF_MRVL_MDL_STR))) {
7036 ports = 2; 7019 ports = 2;
7037 } 7020 }
7038 7021
@@ -7053,8 +7036,8 @@ static void __devinit niu_pci_vpd_validate(struct niu *np)
7053 return; 7036 return;
7054 } 7037 }
7055 7038
7056 if (!strcmp(np->vpd.model, "SUNW,CP3220") || 7039 if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) ||
7057 !strcmp(np->vpd.model, "SUNW,CP3260")) { 7040 !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) {
7058 np->flags |= NIU_FLAGS_10G; 7041 np->flags |= NIU_FLAGS_10G;
7059 np->flags &= ~NIU_FLAGS_FIBER; 7042 np->flags &= ~NIU_FLAGS_FIBER;
7060 np->flags |= NIU_FLAGS_XCVR_SERDES; 7043 np->flags |= NIU_FLAGS_XCVR_SERDES;
@@ -7065,7 +7048,7 @@ static void __devinit niu_pci_vpd_validate(struct niu *np)
7065 } 7048 }
7066 if (np->flags & NIU_FLAGS_10G) 7049 if (np->flags & NIU_FLAGS_10G)
7067 np->mac_xcvr = MAC_XCVR_XPCS; 7050 np->mac_xcvr = MAC_XCVR_XPCS;
7068 } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) { 7051 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) {
7069 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | 7052 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER |
7070 NIU_FLAGS_HOTPLUG_PHY); 7053 NIU_FLAGS_HOTPLUG_PHY);
7071 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { 7054 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) {
@@ -7541,8 +7524,8 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
7541 u32 val; 7524 u32 val;
7542 int err; 7525 int err;
7543 7526
7544 if (!strcmp(np->vpd.model, "SUNW,CP3220") || 7527 if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) ||
7545 !strcmp(np->vpd.model, "SUNW,CP3260")) { 7528 !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) {
7546 num_10g = 0; 7529 num_10g = 0;
7547 num_1g = 2; 7530 num_1g = 2;
7548 parent->plat_type = PLAT_TYPE_ATCA_CP3220; 7531 parent->plat_type = PLAT_TYPE_ATCA_CP3220;
@@ -7551,7 +7534,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
7551 phy_encode(PORT_TYPE_1G, 1) | 7534 phy_encode(PORT_TYPE_1G, 1) |
7552 phy_encode(PORT_TYPE_1G, 2) | 7535 phy_encode(PORT_TYPE_1G, 2) |
7553 phy_encode(PORT_TYPE_1G, 3)); 7536 phy_encode(PORT_TYPE_1G, 3));
7554 } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) { 7537 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) {
7555 num_10g = 2; 7538 num_10g = 2;
7556 num_1g = 0; 7539 num_1g = 0;
7557 parent->num_ports = 2; 7540 parent->num_ports = 2;
@@ -7946,6 +7929,7 @@ static int __devinit niu_get_of_props(struct niu *np)
7946 struct device_node *dp; 7929 struct device_node *dp;
7947 const char *phy_type; 7930 const char *phy_type;
7948 const u8 *mac_addr; 7931 const u8 *mac_addr;
7932 const char *model;
7949 int prop_len; 7933 int prop_len;
7950 7934
7951 if (np->parent->plat_type == PLAT_TYPE_NIU) 7935 if (np->parent->plat_type == PLAT_TYPE_NIU)
@@ -8000,6 +7984,11 @@ static int __devinit niu_get_of_props(struct niu *np)
8000 7984
8001 memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); 7985 memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len);
8002 7986
7987 model = of_get_property(dp, "model", &prop_len);
7988
7989 if (model)
7990 strcpy(np->vpd.model, model);
7991
8003 return 0; 7992 return 0;
8004#else 7993#else
8005 return -EINVAL; 7994 return -EINVAL;
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 97ffbe137bcb..12fd570b9423 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -2946,6 +2946,15 @@ struct rx_ring_info {
2946#define NIU_ALONSO_BM_STR "373-0202" 2946#define NIU_ALONSO_BM_STR "373-0202"
2947#define NIU_FOXXY_BM_STR "501-7961" 2947#define NIU_FOXXY_BM_STR "501-7961"
2948#define NIU_2XGF_MRVL_BM_STR "SK-6E82" 2948#define NIU_2XGF_MRVL_BM_STR "SK-6E82"
2949#define NIU_QGC_LP_MDL_STR "SUNW,pcie-qgc"
2950#define NIU_2XGF_LP_MDL_STR "SUNW,pcie-2xgf"
2951#define NIU_QGC_PEM_MDL_STR "SUNW,pcie-qgc-pem"
2952#define NIU_2XGF_PEM_MDL_STR "SUNW,pcie-2xgf-pem"
2953#define NIU_ALONSO_MDL_STR "SUNW,CP3220"
2954#define NIU_KIMI_MDL_STR "SUNW,CP3260"
2955#define NIU_MARAMBA_MDL_STR "SUNW,pcie-neptune"
2956#define NIU_FOXXY_MDL_STR "SUNW,pcie-rfem"
2957#define NIU_2XGF_MRVL_MDL_STR "SysKonnect,pcie-2xgf"
2949 2958
2950#define NIU_VPD_MIN_MAJOR 3 2959#define NIU_VPD_MIN_MAJOR 3
2951#define NIU_VPD_MIN_MINOR 4 2960#define NIU_VPD_MIN_MINOR 4
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 8f328a03847b..a550c9bd126f 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -391,7 +391,9 @@ static int fmvj18x_config(struct pcmcia_device *link)
391 cardtype = CONTEC; 391 cardtype = CONTEC;
392 break; 392 break;
393 case MANFID_FUJITSU: 393 case MANFID_FUJITSU:
394 if (link->card_id == PRODID_FUJITSU_MBH10302) 394 if (link->conf.ConfigBase == 0x0fe0)
395 cardtype = MBH10302;
396 else if (link->card_id == PRODID_FUJITSU_MBH10302)
395 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), 397 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302),
396 but these are MBH10304 based card. */ 398 but these are MBH10304 based card. */
397 cardtype = MBH10304; 399 cardtype = MBH10304;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index d041f831a18d..f6c4698ce738 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1461,22 +1461,25 @@ static void
1461set_multicast_list(struct net_device *dev) 1461set_multicast_list(struct net_device *dev)
1462{ 1462{
1463 unsigned int ioaddr = dev->base_addr; 1463 unsigned int ioaddr = dev->base_addr;
1464 unsigned value;
1464 1465
1465 SelectPage(0x42); 1466 SelectPage(0x42);
1467 value = GetByte(XIRCREG42_SWC1) & 0xC0;
1468
1466 if (dev->flags & IFF_PROMISC) { /* snoop */ 1469 if (dev->flags & IFF_PROMISC) { /* snoop */
1467 PutByte(XIRCREG42_SWC1, 0x06); /* set MPE and PME */ 1470 PutByte(XIRCREG42_SWC1, value | 0x06); /* set MPE and PME */
1468 } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) { 1471 } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) {
1469 PutByte(XIRCREG42_SWC1, 0x02); /* set MPE */ 1472 PutByte(XIRCREG42_SWC1, value | 0x02); /* set MPE */
1470 } else if (dev->mc_count) { 1473 } else if (dev->mc_count) {
1471 /* the chip can filter 9 addresses perfectly */ 1474 /* the chip can filter 9 addresses perfectly */
1472 PutByte(XIRCREG42_SWC1, 0x01); 1475 PutByte(XIRCREG42_SWC1, value | 0x01);
1473 SelectPage(0x40); 1476 SelectPage(0x40);
1474 PutByte(XIRCREG40_CMD0, Offline); 1477 PutByte(XIRCREG40_CMD0, Offline);
1475 set_addresses(dev); 1478 set_addresses(dev);
1476 SelectPage(0x40); 1479 SelectPage(0x40);
1477 PutByte(XIRCREG40_CMD0, EnableRecv | Online); 1480 PutByte(XIRCREG40_CMD0, EnableRecv | Online);
1478 } else { /* standard usage */ 1481 } else { /* standard usage */
1479 PutByte(XIRCREG42_SWC1, 0x00); 1482 PutByte(XIRCREG42_SWC1, value | 0x00);
1480 } 1483 }
1481 SelectPage(0); 1484 SelectPage(0);
1482} 1485}
@@ -1722,6 +1725,7 @@ do_reset(struct net_device *dev, int full)
1722 1725
1723 /* enable receiver and put the mac online */ 1726 /* enable receiver and put the mac online */
1724 if (full) { 1727 if (full) {
1728 set_multicast_list(dev);
1725 SelectPage(0x40); 1729 SelectPage(0x40);
1726 PutByte(XIRCREG40_CMD0, EnableRecv | Online); 1730 PutByte(XIRCREG40_CMD0, EnableRecv | Online);
1727 } 1731 }
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index a1c454dbc164..1c89b97f4e09 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -325,7 +325,7 @@ static int pcnet32_get_regs_len(struct net_device *dev);
325static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, 325static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,
326 void *ptr); 326 void *ptr);
327static void pcnet32_purge_tx_ring(struct net_device *dev); 327static void pcnet32_purge_tx_ring(struct net_device *dev);
328static int pcnet32_alloc_ring(struct net_device *dev, char *name); 328static int pcnet32_alloc_ring(struct net_device *dev, const char *name);
329static void pcnet32_free_ring(struct net_device *dev); 329static void pcnet32_free_ring(struct net_device *dev);
330static void pcnet32_check_media(struct net_device *dev, int verbose); 330static void pcnet32_check_media(struct net_device *dev, int verbose);
331 331
@@ -1983,7 +1983,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1983} 1983}
1984 1984
1985/* if any allocation fails, caller must also call pcnet32_free_ring */ 1985/* if any allocation fails, caller must also call pcnet32_free_ring */
1986static int pcnet32_alloc_ring(struct net_device *dev, char *name) 1986static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
1987{ 1987{
1988 struct pcnet32_private *lp = netdev_priv(dev); 1988 struct pcnet32_private *lp = netdev_priv(dev);
1989 1989
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 6bf9e76b0a00..6eb2d31d1e34 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -5,7 +5,7 @@
5menuconfig PHYLIB 5menuconfig PHYLIB
6 tristate "PHY Device support and infrastructure" 6 tristate "PHY Device support and infrastructure"
7 depends on !S390 7 depends on !S390
8 depends on NET_ETHERNET && (BROKEN || !S390) 8 depends on NET_ETHERNET
9 help 9 help
10 Ethernet controllers are usually attached to PHY 10 Ethernet controllers are usually attached to PHY
11 devices. This option provides infrastructure for 11 devices. This option provides infrastructure for
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ac3c01d28fdf..16a0e7de5888 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -207,6 +207,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id)
207 207
208 return 0; 208 return 0;
209} 209}
210EXPORT_SYMBOL(get_phy_id);
210 211
211/** 212/**
212 * get_phy_device - reads the specified PHY device and returns its @phy_device struct 213 * get_phy_device - reads the specified PHY device and returns its @phy_device struct
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index d3207c0da895..1f4ca2b54a73 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2458,6 +2458,7 @@ ppp_create_interface(int unit, int *retp)
2458 2458
2459out3: 2459out3:
2460 atomic_dec(&ppp_unit_count); 2460 atomic_dec(&ppp_unit_count);
2461 unregister_netdev(dev);
2461out2: 2462out2:
2462 mutex_unlock(&all_ppp_mutex); 2463 mutex_unlock(&all_ppp_mutex);
2463 free_netdev(dev); 2464 free_netdev(dev);
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 58a26a47af29..bafb69b6f7cb 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -341,12 +341,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
341 struct pppox_sock *relay_po; 341 struct pppox_sock *relay_po;
342 342
343 if (sk->sk_state & PPPOX_BOUND) { 343 if (sk->sk_state & PPPOX_BOUND) {
344 struct pppoe_hdr *ph = pppoe_hdr(skb);
345 int len = ntohs(ph->length);
346 skb_pull_rcsum(skb, sizeof(struct pppoe_hdr));
347 if (pskb_trim_rcsum(skb, len))
348 goto abort_kfree;
349
350 ppp_input(&po->chan, skb); 344 ppp_input(&po->chan, skb);
351 } else if (sk->sk_state & PPPOX_RELAY) { 345 } else if (sk->sk_state & PPPOX_RELAY) {
352 relay_po = get_item_by_addr(&po->pppoe_relay); 346 relay_po = get_item_by_addr(&po->pppoe_relay);
@@ -357,7 +351,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
357 if ((sk_pppox(relay_po)->sk_state & PPPOX_CONNECTED) == 0) 351 if ((sk_pppox(relay_po)->sk_state & PPPOX_CONNECTED) == 0)
358 goto abort_put; 352 goto abort_put;
359 353
360 skb_pull(skb, sizeof(struct pppoe_hdr));
361 if (!__pppoe_xmit(sk_pppox(relay_po), skb)) 354 if (!__pppoe_xmit(sk_pppox(relay_po), skb))
362 goto abort_put; 355 goto abort_put;
363 } else { 356 } else {
@@ -388,6 +381,7 @@ static int pppoe_rcv(struct sk_buff *skb,
388{ 381{
389 struct pppoe_hdr *ph; 382 struct pppoe_hdr *ph;
390 struct pppox_sock *po; 383 struct pppox_sock *po;
384 int len;
391 385
392 if (!(skb = skb_share_check(skb, GFP_ATOMIC))) 386 if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
393 goto out; 387 goto out;
@@ -399,10 +393,21 @@ static int pppoe_rcv(struct sk_buff *skb,
399 goto drop; 393 goto drop;
400 394
401 ph = pppoe_hdr(skb); 395 ph = pppoe_hdr(skb);
396 len = ntohs(ph->length);
397
398 skb_pull_rcsum(skb, sizeof(*ph));
399 if (skb->len < len)
400 goto drop;
402 401
403 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex); 402 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
404 if (po != NULL) 403 if (!po)
405 return sk_receive_skb(sk_pppox(po), skb, 0); 404 goto drop;
405
406 if (pskb_trim_rcsum(skb, len))
407 goto drop;
408
409 return sk_receive_skb(sk_pppox(po), skb, 0);
410
406drop: 411drop:
407 kfree_skb(skb); 412 kfree_skb(skb);
408out: 413out:
@@ -427,12 +432,12 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
427 if (dev_net(dev) != &init_net) 432 if (dev_net(dev) != &init_net)
428 goto abort; 433 goto abort;
429 434
430 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
431 goto abort;
432
433 if (!(skb = skb_share_check(skb, GFP_ATOMIC))) 435 if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
434 goto out; 436 goto out;
435 437
438 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
439 goto abort;
440
436 ph = pppoe_hdr(skb); 441 ph = pppoe_hdr(skb);
437 if (ph->code != PADT_CODE) 442 if (ph->code != PADT_CODE)
438 goto abort; 443 goto abort;
@@ -937,12 +942,10 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
937 m->msg_namelen = 0; 942 m->msg_namelen = 0;
938 943
939 if (skb) { 944 if (skb) {
940 struct pppoe_hdr *ph = pppoe_hdr(skb); 945 total_len = min(total_len, skb->len);
941 const int len = ntohs(ph->length); 946 error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
942
943 error = memcpy_toiovec(m->msg_iov, (unsigned char *) &ph->tag[0], len);
944 if (error == 0) 947 if (error == 0)
945 error = len; 948 error = total_len;
946 } 949 }
947 950
948 kfree_skb(skb); 951 kfree_skb(skb);
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 244d7830c92a..f9298827a76c 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -240,12 +240,15 @@ static inline struct pppol2tp_session *pppol2tp_sock_to_session(struct sock *sk)
240 if (sk == NULL) 240 if (sk == NULL)
241 return NULL; 241 return NULL;
242 242
243 sock_hold(sk);
243 session = (struct pppol2tp_session *)(sk->sk_user_data); 244 session = (struct pppol2tp_session *)(sk->sk_user_data);
244 if (session == NULL) 245 if (session == NULL) {
245 return NULL; 246 sock_put(sk);
247 goto out;
248 }
246 249
247 BUG_ON(session->magic != L2TP_SESSION_MAGIC); 250 BUG_ON(session->magic != L2TP_SESSION_MAGIC);
248 251out:
249 return session; 252 return session;
250} 253}
251 254
@@ -256,12 +259,15 @@ static inline struct pppol2tp_tunnel *pppol2tp_sock_to_tunnel(struct sock *sk)
256 if (sk == NULL) 259 if (sk == NULL)
257 return NULL; 260 return NULL;
258 261
262 sock_hold(sk);
259 tunnel = (struct pppol2tp_tunnel *)(sk->sk_user_data); 263 tunnel = (struct pppol2tp_tunnel *)(sk->sk_user_data);
260 if (tunnel == NULL) 264 if (tunnel == NULL) {
261 return NULL; 265 sock_put(sk);
266 goto out;
267 }
262 268
263 BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC); 269 BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC);
264 270out:
265 return tunnel; 271 return tunnel;
266} 272}
267 273
@@ -716,12 +722,14 @@ discard:
716 session->stats.rx_errors++; 722 session->stats.rx_errors++;
717 kfree_skb(skb); 723 kfree_skb(skb);
718 sock_put(session->sock); 724 sock_put(session->sock);
725 sock_put(sock);
719 726
720 return 0; 727 return 0;
721 728
722error: 729error:
723 /* Put UDP header back */ 730 /* Put UDP header back */
724 __skb_push(skb, sizeof(struct udphdr)); 731 __skb_push(skb, sizeof(struct udphdr));
732 sock_put(sock);
725 733
726no_tunnel: 734no_tunnel:
727 return 1; 735 return 1;
@@ -745,10 +753,13 @@ static int pppol2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
745 "%s: received %d bytes\n", tunnel->name, skb->len); 753 "%s: received %d bytes\n", tunnel->name, skb->len);
746 754
747 if (pppol2tp_recv_core(sk, skb)) 755 if (pppol2tp_recv_core(sk, skb))
748 goto pass_up; 756 goto pass_up_put;
749 757
758 sock_put(sk);
750 return 0; 759 return 0;
751 760
761pass_up_put:
762 sock_put(sk);
752pass_up: 763pass_up:
753 return 1; 764 return 1;
754} 765}
@@ -772,14 +783,18 @@ static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock,
772 err = 0; 783 err = 0;
773 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 784 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
774 flags & MSG_DONTWAIT, &err); 785 flags & MSG_DONTWAIT, &err);
775 if (skb) { 786 if (!skb)
776 err = memcpy_toiovec(msg->msg_iov, (unsigned char *) skb->data, 787 goto end;
777 skb->len); 788
778 if (err < 0) 789 if (len > skb->len)
779 goto do_skb_free; 790 len = skb->len;
780 err = skb->len; 791 else if (len < skb->len)
781 } 792 msg->msg_flags |= MSG_TRUNC;
782do_skb_free: 793
794 err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, len);
795 if (likely(err == 0))
796 err = len;
797
783 kfree_skb(skb); 798 kfree_skb(skb);
784end: 799end:
785 return err; 800 return err;
@@ -858,7 +873,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
858 873
859 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 874 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
860 if (tunnel == NULL) 875 if (tunnel == NULL)
861 goto error; 876 goto error_put_sess;
862 877
863 /* What header length is configured for this session? */ 878 /* What header length is configured for this session? */
864 hdr_len = pppol2tp_l2tp_header_len(session); 879 hdr_len = pppol2tp_l2tp_header_len(session);
@@ -870,7 +885,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
870 sizeof(ppph) + total_len, 885 sizeof(ppph) + total_len,
871 0, GFP_KERNEL); 886 0, GFP_KERNEL);
872 if (!skb) 887 if (!skb)
873 goto error; 888 goto error_put_sess_tun;
874 889
875 /* Reserve space for headers. */ 890 /* Reserve space for headers. */
876 skb_reserve(skb, NET_SKB_PAD); 891 skb_reserve(skb, NET_SKB_PAD);
@@ -900,7 +915,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
900 error = memcpy_fromiovec(skb->data, m->msg_iov, total_len); 915 error = memcpy_fromiovec(skb->data, m->msg_iov, total_len);
901 if (error < 0) { 916 if (error < 0) {
902 kfree_skb(skb); 917 kfree_skb(skb);
903 goto error; 918 goto error_put_sess_tun;
904 } 919 }
905 skb_put(skb, total_len); 920 skb_put(skb, total_len);
906 921
@@ -947,10 +962,33 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
947 session->stats.tx_errors++; 962 session->stats.tx_errors++;
948 } 963 }
949 964
965 return error;
966
967error_put_sess_tun:
968 sock_put(session->tunnel_sock);
969error_put_sess:
970 sock_put(sk);
950error: 971error:
951 return error; 972 return error;
952} 973}
953 974
975/* Automatically called when the skb is freed.
976 */
977static void pppol2tp_sock_wfree(struct sk_buff *skb)
978{
979 sock_put(skb->sk);
980}
981
982/* For data skbs that we transmit, we associate with the tunnel socket
983 * but don't do accounting.
984 */
985static inline void pppol2tp_skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
986{
987 sock_hold(sk);
988 skb->sk = sk;
989 skb->destructor = pppol2tp_sock_wfree;
990}
991
954/* Transmit function called by generic PPP driver. Sends PPP frame 992/* Transmit function called by generic PPP driver. Sends PPP frame
955 * over PPPoL2TP socket. 993 * over PPPoL2TP socket.
956 * 994 *
@@ -980,6 +1018,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
980 __wsum csum = 0; 1018 __wsum csum = 0;
981 struct udphdr *uh; 1019 struct udphdr *uh;
982 unsigned int len; 1020 unsigned int len;
1021 int old_headroom;
1022 int new_headroom;
983 1023
984 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) 1024 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
985 goto abort; 1025 goto abort;
@@ -991,25 +1031,27 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
991 1031
992 sk_tun = session->tunnel_sock; 1032 sk_tun = session->tunnel_sock;
993 if (sk_tun == NULL) 1033 if (sk_tun == NULL)
994 goto abort; 1034 goto abort_put_sess;
995 tunnel = pppol2tp_sock_to_tunnel(sk_tun); 1035 tunnel = pppol2tp_sock_to_tunnel(sk_tun);
996 if (tunnel == NULL) 1036 if (tunnel == NULL)
997 goto abort; 1037 goto abort_put_sess;
998 1038
999 /* What header length is configured for this session? */ 1039 /* What header length is configured for this session? */
1000 hdr_len = pppol2tp_l2tp_header_len(session); 1040 hdr_len = pppol2tp_l2tp_header_len(session);
1001 1041
1002 /* Check that there's enough headroom in the skb to insert IP, 1042 /* Check that there's enough headroom in the skb to insert IP,
1003 * UDP and L2TP and PPP headers. If not enough, expand it to 1043 * UDP and L2TP and PPP headers. If not enough, expand it to
1004 * make room. Note that a new skb (or a clone) is 1044 * make room. Adjust truesize.
1005 * allocated. If we return an error from this point on, make
1006 * sure we free the new skb but do not free the original skb
1007 * since that is done by the caller for the error case.
1008 */ 1045 */
1009 headroom = NET_SKB_PAD + sizeof(struct iphdr) + 1046 headroom = NET_SKB_PAD + sizeof(struct iphdr) +
1010 sizeof(struct udphdr) + hdr_len + sizeof(ppph); 1047 sizeof(struct udphdr) + hdr_len + sizeof(ppph);
1048 old_headroom = skb_headroom(skb);
1011 if (skb_cow_head(skb, headroom)) 1049 if (skb_cow_head(skb, headroom))
1012 goto abort; 1050 goto abort_put_sess_tun;
1051
1052 new_headroom = skb_headroom(skb);
1053 skb_orphan(skb);
1054 skb->truesize += new_headroom - old_headroom;
1013 1055
1014 /* Setup PPP header */ 1056 /* Setup PPP header */
1015 __skb_push(skb, sizeof(ppph)); 1057 __skb_push(skb, sizeof(ppph));
@@ -1065,8 +1107,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1065 /* Get routing info from the tunnel socket */ 1107 /* Get routing info from the tunnel socket */
1066 dst_release(skb->dst); 1108 dst_release(skb->dst);
1067 skb->dst = dst_clone(__sk_dst_get(sk_tun)); 1109 skb->dst = dst_clone(__sk_dst_get(sk_tun));
1068 skb_orphan(skb); 1110 pppol2tp_skb_set_owner_w(skb, sk_tun);
1069 skb->sk = sk_tun;
1070 1111
1071 /* Queue the packet to IP for output */ 1112 /* Queue the packet to IP for output */
1072 len = skb->len; 1113 len = skb->len;
@@ -1083,8 +1124,14 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1083 session->stats.tx_errors++; 1124 session->stats.tx_errors++;
1084 } 1125 }
1085 1126
1127 sock_put(sk_tun);
1128 sock_put(sk);
1086 return 1; 1129 return 1;
1087 1130
1131abort_put_sess_tun:
1132 sock_put(sk_tun);
1133abort_put_sess:
1134 sock_put(sk);
1088abort: 1135abort:
1089 /* Free the original skb */ 1136 /* Free the original skb */
1090 kfree_skb(skb); 1137 kfree_skb(skb);
@@ -1188,7 +1235,7 @@ static void pppol2tp_tunnel_destruct(struct sock *sk)
1188{ 1235{
1189 struct pppol2tp_tunnel *tunnel; 1236 struct pppol2tp_tunnel *tunnel;
1190 1237
1191 tunnel = pppol2tp_sock_to_tunnel(sk); 1238 tunnel = sk->sk_user_data;
1192 if (tunnel == NULL) 1239 if (tunnel == NULL)
1193 goto end; 1240 goto end;
1194 1241
@@ -1227,10 +1274,12 @@ static void pppol2tp_session_destruct(struct sock *sk)
1227 if (sk->sk_user_data != NULL) { 1274 if (sk->sk_user_data != NULL) {
1228 struct pppol2tp_tunnel *tunnel; 1275 struct pppol2tp_tunnel *tunnel;
1229 1276
1230 session = pppol2tp_sock_to_session(sk); 1277 session = sk->sk_user_data;
1231 if (session == NULL) 1278 if (session == NULL)
1232 goto out; 1279 goto out;
1233 1280
1281 BUG_ON(session->magic != L2TP_SESSION_MAGIC);
1282
1234 /* Don't use pppol2tp_sock_to_tunnel() here to 1283 /* Don't use pppol2tp_sock_to_tunnel() here to
1235 * get the tunnel context because the tunnel 1284 * get the tunnel context because the tunnel
1236 * socket might have already been closed (its 1285 * socket might have already been closed (its
@@ -1276,6 +1325,7 @@ out:
1276static int pppol2tp_release(struct socket *sock) 1325static int pppol2tp_release(struct socket *sock)
1277{ 1326{
1278 struct sock *sk = sock->sk; 1327 struct sock *sk = sock->sk;
1328 struct pppol2tp_session *session;
1279 int error; 1329 int error;
1280 1330
1281 if (!sk) 1331 if (!sk)
@@ -1293,9 +1343,18 @@ static int pppol2tp_release(struct socket *sock)
1293 sock_orphan(sk); 1343 sock_orphan(sk);
1294 sock->sk = NULL; 1344 sock->sk = NULL;
1295 1345
1346 session = pppol2tp_sock_to_session(sk);
1347
1296 /* Purge any queued data */ 1348 /* Purge any queued data */
1297 skb_queue_purge(&sk->sk_receive_queue); 1349 skb_queue_purge(&sk->sk_receive_queue);
1298 skb_queue_purge(&sk->sk_write_queue); 1350 skb_queue_purge(&sk->sk_write_queue);
1351 if (session != NULL) {
1352 struct sk_buff *skb;
1353 while ((skb = skb_dequeue(&session->reorder_q))) {
1354 kfree_skb(skb);
1355 sock_put(sk);
1356 }
1357 }
1299 1358
1300 release_sock(sk); 1359 release_sock(sk);
1301 1360
@@ -1598,7 +1657,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
1598 1657
1599 error = ppp_register_channel(&po->chan); 1658 error = ppp_register_channel(&po->chan);
1600 if (error) 1659 if (error)
1601 goto end; 1660 goto end_put_tun;
1602 1661
1603 /* This is how we get the session context from the socket. */ 1662 /* This is how we get the session context from the socket. */
1604 sk->sk_user_data = session; 1663 sk->sk_user_data = session;
@@ -1618,12 +1677,21 @@ out_no_ppp:
1618 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1677 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1619 "%s: created\n", session->name); 1678 "%s: created\n", session->name);
1620 1679
1680end_put_tun:
1681 sock_put(tunnel_sock);
1621end: 1682end:
1622 release_sock(sk); 1683 release_sock(sk);
1623 1684
1624 if (error != 0) 1685 if (error != 0) {
1625 PRINTK(session ? session->debug : -1, PPPOL2TP_MSG_CONTROL, KERN_WARNING, 1686 if (session)
1626 "%s: connect failed: %d\n", session->name, error); 1687 PRINTK(session->debug,
1688 PPPOL2TP_MSG_CONTROL, KERN_WARNING,
1689 "%s: connect failed: %d\n",
1690 session->name, error);
1691 else
1692 PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_WARNING,
1693 "connect failed: %d\n", error);
1694 }
1627 1695
1628 return error; 1696 return error;
1629} 1697}
@@ -1658,6 +1726,7 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
1658 *usockaddr_len = len; 1726 *usockaddr_len = len;
1659 1727
1660 error = 0; 1728 error = 0;
1729 sock_put(sock->sk);
1661 1730
1662end: 1731end:
1663 return error; 1732 return error;
@@ -1896,14 +1965,17 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd,
1896 err = -EBADF; 1965 err = -EBADF;
1897 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 1966 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
1898 if (tunnel == NULL) 1967 if (tunnel == NULL)
1899 goto end; 1968 goto end_put_sess;
1900 1969
1901 err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg); 1970 err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg);
1902 goto end; 1971 sock_put(session->tunnel_sock);
1972 goto end_put_sess;
1903 } 1973 }
1904 1974
1905 err = pppol2tp_session_ioctl(session, cmd, arg); 1975 err = pppol2tp_session_ioctl(session, cmd, arg);
1906 1976
1977end_put_sess:
1978 sock_put(sk);
1907end: 1979end:
1908 return err; 1980 return err;
1909} 1981}
@@ -2049,14 +2121,17 @@ static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,
2049 err = -EBADF; 2121 err = -EBADF;
2050 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 2122 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
2051 if (tunnel == NULL) 2123 if (tunnel == NULL)
2052 goto end; 2124 goto end_put_sess;
2053 2125
2054 err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val); 2126 err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val);
2127 sock_put(session->tunnel_sock);
2055 } else 2128 } else
2056 err = pppol2tp_session_setsockopt(sk, session, optname, val); 2129 err = pppol2tp_session_setsockopt(sk, session, optname, val);
2057 2130
2058 err = 0; 2131 err = 0;
2059 2132
2133end_put_sess:
2134 sock_put(sk);
2060end: 2135end:
2061 return err; 2136 return err;
2062} 2137}
@@ -2171,20 +2246,24 @@ static int pppol2tp_getsockopt(struct socket *sock, int level,
2171 err = -EBADF; 2246 err = -EBADF;
2172 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); 2247 tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock);
2173 if (tunnel == NULL) 2248 if (tunnel == NULL)
2174 goto end; 2249 goto end_put_sess;
2175 2250
2176 err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val); 2251 err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val);
2252 sock_put(session->tunnel_sock);
2177 } else 2253 } else
2178 err = pppol2tp_session_getsockopt(sk, session, optname, &val); 2254 err = pppol2tp_session_getsockopt(sk, session, optname, &val);
2179 2255
2180 err = -EFAULT; 2256 err = -EFAULT;
2181 if (put_user(len, (int __user *) optlen)) 2257 if (put_user(len, (int __user *) optlen))
2182 goto end; 2258 goto end_put_sess;
2183 2259
2184 if (copy_to_user((void __user *) optval, &val, len)) 2260 if (copy_to_user((void __user *) optval, &val, len))
2185 goto end; 2261 goto end_put_sess;
2186 2262
2187 err = 0; 2263 err = 0;
2264
2265end_put_sess:
2266 sock_put(sk);
2188end: 2267end:
2189 return err; 2268 return err;
2190} 2269}
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index 0d32123085e9..1dae1f2ed813 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -2474,6 +2474,8 @@ static void gelic_wl_free(struct gelic_wl_info *wl)
2474 2474
2475 pr_debug("%s: <-\n", __func__); 2475 pr_debug("%s: <-\n", __func__);
2476 2476
2477 free_page((unsigned long)wl->buf);
2478
2477 pr_debug("%s: destroy queues\n", __func__); 2479 pr_debug("%s: destroy queues\n", __func__);
2478 destroy_workqueue(wl->eurus_cmd_queue); 2480 destroy_workqueue(wl->eurus_cmd_queue);
2479 destroy_workqueue(wl->event_queue); 2481 destroy_workqueue(wl->event_queue);
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 169edc154928..858b191517b3 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -733,7 +733,7 @@ static void r6040_timer(unsigned long data)
733 } 733 }
734 734
735 /* Timer active again */ 735 /* Timer active again */
736 mod_timer(&lp->timer, jiffies + round_jiffies(HZ)); 736 mod_timer(&lp->timer, round_jiffies(jiffies + HZ));
737} 737}
738 738
739/* Read/set MAC address routines */ 739/* Read/set MAC address routines */
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h
index 2109508c047a..f8274f8941ea 100644
--- a/drivers/net/s2io-regs.h
+++ b/drivers/net/s2io-regs.h
@@ -250,7 +250,7 @@ struct XENA_dev_config {
250 u64 tx_mat0_n[0x8]; 250 u64 tx_mat0_n[0x8];
251#define TX_MAT_SET(fifo, msi) vBIT(msi, (8 * fifo), 8) 251#define TX_MAT_SET(fifo, msi) vBIT(msi, (8 * fifo), 8)
252 252
253 u8 unused_1[0x8]; 253 u64 xmsi_mask_reg;
254 u64 stat_byte_cnt; 254 u64 stat_byte_cnt;
255#define STAT_BC(n) vBIT(n,4,12) 255#define STAT_BC(n) vBIT(n,4,12)
256 256
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 523478ebfd69..b5c1e663417d 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -86,7 +86,7 @@
86#include "s2io.h" 86#include "s2io.h"
87#include "s2io-regs.h" 87#include "s2io-regs.h"
88 88
89#define DRV_VERSION "2.0.26.23" 89#define DRV_VERSION "2.0.26.24"
90 90
91/* S2io Driver name & version. */ 91/* S2io Driver name & version. */
92static char s2io_driver_name[] = "Neterion"; 92static char s2io_driver_name[] = "Neterion";
@@ -1113,9 +1113,10 @@ static int s2io_on_nec_bridge(struct pci_dev *s2io_pdev)
1113 struct pci_dev *tdev = NULL; 1113 struct pci_dev *tdev = NULL;
1114 while ((tdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) { 1114 while ((tdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) {
1115 if (tdev->vendor == NEC_VENID && tdev->device == NEC_DEVID) { 1115 if (tdev->vendor == NEC_VENID && tdev->device == NEC_DEVID) {
1116 if (tdev->bus == s2io_pdev->bus->parent) 1116 if (tdev->bus == s2io_pdev->bus->parent) {
1117 pci_dev_put(tdev); 1117 pci_dev_put(tdev);
1118 return 1; 1118 return 1;
1119 }
1119 } 1120 }
1120 } 1121 }
1121 return 0; 1122 return 0;
@@ -1219,15 +1220,33 @@ static int init_tti(struct s2io_nic *nic, int link)
1219 TTI_DATA1_MEM_TX_URNG_B(0x10) | 1220 TTI_DATA1_MEM_TX_URNG_B(0x10) |
1220 TTI_DATA1_MEM_TX_URNG_C(0x30) | 1221 TTI_DATA1_MEM_TX_URNG_C(0x30) |
1221 TTI_DATA1_MEM_TX_TIMER_AC_EN; 1222 TTI_DATA1_MEM_TX_TIMER_AC_EN;
1222 1223 if (i == 0)
1223 if (use_continuous_tx_intrs && (link == LINK_UP)) 1224 if (use_continuous_tx_intrs && (link == LINK_UP))
1224 val64 |= TTI_DATA1_MEM_TX_TIMER_CI_EN; 1225 val64 |= TTI_DATA1_MEM_TX_TIMER_CI_EN;
1225 writeq(val64, &bar0->tti_data1_mem); 1226 writeq(val64, &bar0->tti_data1_mem);
1226 1227
1227 val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) | 1228 if (nic->config.intr_type == MSI_X) {
1228 TTI_DATA2_MEM_TX_UFC_B(0x20) | 1229 val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
1229 TTI_DATA2_MEM_TX_UFC_C(0x40) | 1230 TTI_DATA2_MEM_TX_UFC_B(0x100) |
1230 TTI_DATA2_MEM_TX_UFC_D(0x80); 1231 TTI_DATA2_MEM_TX_UFC_C(0x200) |
1232 TTI_DATA2_MEM_TX_UFC_D(0x300);
1233 } else {
1234 if ((nic->config.tx_steering_type ==
1235 TX_DEFAULT_STEERING) &&
1236 (config->tx_fifo_num > 1) &&
1237 (i >= nic->udp_fifo_idx) &&
1238 (i < (nic->udp_fifo_idx +
1239 nic->total_udp_fifos)))
1240 val64 = TTI_DATA2_MEM_TX_UFC_A(0x50) |
1241 TTI_DATA2_MEM_TX_UFC_B(0x80) |
1242 TTI_DATA2_MEM_TX_UFC_C(0x100) |
1243 TTI_DATA2_MEM_TX_UFC_D(0x120);
1244 else
1245 val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
1246 TTI_DATA2_MEM_TX_UFC_B(0x20) |
1247 TTI_DATA2_MEM_TX_UFC_C(0x40) |
1248 TTI_DATA2_MEM_TX_UFC_D(0x80);
1249 }
1231 1250
1232 writeq(val64, &bar0->tti_data2_mem); 1251 writeq(val64, &bar0->tti_data2_mem);
1233 1252
@@ -2813,6 +2832,15 @@ static void free_rx_buffers(struct s2io_nic *sp)
2813 } 2832 }
2814} 2833}
2815 2834
2835static int s2io_chk_rx_buffers(struct ring_info *ring)
2836{
2837 if (fill_rx_buffers(ring) == -ENOMEM) {
2838 DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name);
2839 DBG_PRINT(INFO_DBG, " in Rx Intr!!\n");
2840 }
2841 return 0;
2842}
2843
2816/** 2844/**
2817 * s2io_poll - Rx interrupt handler for NAPI support 2845 * s2io_poll - Rx interrupt handler for NAPI support
2818 * @napi : pointer to the napi structure. 2846 * @napi : pointer to the napi structure.
@@ -2826,57 +2854,73 @@ static void free_rx_buffers(struct s2io_nic *sp)
2826 * 0 on success and 1 if there are No Rx packets to be processed. 2854 * 0 on success and 1 if there are No Rx packets to be processed.
2827 */ 2855 */
2828 2856
2829static int s2io_poll(struct napi_struct *napi, int budget) 2857static int s2io_poll_msix(struct napi_struct *napi, int budget)
2830{ 2858{
2831 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi); 2859 struct ring_info *ring = container_of(napi, struct ring_info, napi);
2832 struct net_device *dev = nic->dev; 2860 struct net_device *dev = ring->dev;
2833 int pkt_cnt = 0, org_pkts_to_process;
2834 struct mac_info *mac_control;
2835 struct config_param *config; 2861 struct config_param *config;
2862 struct mac_info *mac_control;
2863 int pkts_processed = 0;
2864 u8 __iomem *addr = NULL;
2865 u8 val8 = 0;
2866 struct s2io_nic *nic = dev->priv;
2836 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2867 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2837 int i; 2868 int budget_org = budget;
2838 2869
2839 mac_control = &nic->mac_control;
2840 config = &nic->config; 2870 config = &nic->config;
2871 mac_control = &nic->mac_control;
2841 2872
2842 nic->pkts_to_process = budget; 2873 if (unlikely(!is_s2io_card_up(nic)))
2843 org_pkts_to_process = nic->pkts_to_process; 2874 return 0;
2844 2875
2845 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); 2876 pkts_processed = rx_intr_handler(ring, budget);
2846 readl(&bar0->rx_traffic_int); 2877 s2io_chk_rx_buffers(ring);
2847 2878
2848 for (i = 0; i < config->rx_ring_num; i++) { 2879 if (pkts_processed < budget_org) {
2849 rx_intr_handler(&mac_control->rings[i]); 2880 netif_rx_complete(dev, napi);
2850 pkt_cnt = org_pkts_to_process - nic->pkts_to_process; 2881 /*Re Enable MSI-Rx Vector*/
2851 if (!nic->pkts_to_process) { 2882 addr = (u8 __iomem *)&bar0->xmsi_mask_reg;
2852 /* Quota for the current iteration has been met */ 2883 addr += 7 - ring->ring_no;
2853 goto no_rx; 2884 val8 = (ring->ring_no == 0) ? 0x3f : 0xbf;
2854 } 2885 writeb(val8, addr);
2886 val8 = readb(addr);
2855 } 2887 }
2888 return pkts_processed;
2889}
2890static int s2io_poll_inta(struct napi_struct *napi, int budget)
2891{
2892 struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi);
2893 struct ring_info *ring;
2894 struct net_device *dev = nic->dev;
2895 struct config_param *config;
2896 struct mac_info *mac_control;
2897 int pkts_processed = 0;
2898 int ring_pkts_processed, i;
2899 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2900 int budget_org = budget;
2856 2901
2857 netif_rx_complete(dev, napi); 2902 config = &nic->config;
2903 mac_control = &nic->mac_control;
2858 2904
2859 for (i = 0; i < config->rx_ring_num; i++) { 2905 if (unlikely(!is_s2io_card_up(nic)))
2860 if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { 2906 return 0;
2861 DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name);
2862 DBG_PRINT(INFO_DBG, " in Rx Poll!!\n");
2863 break;
2864 }
2865 }
2866 /* Re enable the Rx interrupts. */
2867 writeq(0x0, &bar0->rx_traffic_mask);
2868 readl(&bar0->rx_traffic_mask);
2869 return pkt_cnt;
2870 2907
2871no_rx:
2872 for (i = 0; i < config->rx_ring_num; i++) { 2908 for (i = 0; i < config->rx_ring_num; i++) {
2873 if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { 2909 ring = &mac_control->rings[i];
2874 DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); 2910 ring_pkts_processed = rx_intr_handler(ring, budget);
2875 DBG_PRINT(INFO_DBG, " in Rx Poll!!\n"); 2911 s2io_chk_rx_buffers(ring);
2912 pkts_processed += ring_pkts_processed;
2913 budget -= ring_pkts_processed;
2914 if (budget <= 0)
2876 break; 2915 break;
2877 }
2878 } 2916 }
2879 return pkt_cnt; 2917 if (pkts_processed < budget_org) {
2918 netif_rx_complete(dev, napi);
2919 /* Re enable the Rx interrupts for the ring */
2920 writeq(0, &bar0->rx_traffic_mask);
2921 readl(&bar0->rx_traffic_mask);
2922 }
2923 return pkts_processed;
2880} 2924}
2881 2925
2882#ifdef CONFIG_NET_POLL_CONTROLLER 2926#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2918,7 +2962,7 @@ static void s2io_netpoll(struct net_device *dev)
2918 2962
2919 /* check for received packet and indicate up to network */ 2963 /* check for received packet and indicate up to network */
2920 for (i = 0; i < config->rx_ring_num; i++) 2964 for (i = 0; i < config->rx_ring_num; i++)
2921 rx_intr_handler(&mac_control->rings[i]); 2965 rx_intr_handler(&mac_control->rings[i], 0);
2922 2966
2923 for (i = 0; i < config->rx_ring_num; i++) { 2967 for (i = 0; i < config->rx_ring_num; i++) {
2924 if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { 2968 if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) {
@@ -2934,7 +2978,8 @@ static void s2io_netpoll(struct net_device *dev)
2934 2978
2935/** 2979/**
2936 * rx_intr_handler - Rx interrupt handler 2980 * rx_intr_handler - Rx interrupt handler
2937 * @nic: device private variable. 2981 * @ring_info: per ring structure.
2982 * @budget: budget for napi processing.
2938 * Description: 2983 * Description:
2939 * If the interrupt is because of a received frame or if the 2984 * If the interrupt is because of a received frame or if the
2940 * receive ring contains fresh as yet un-processed frames,this function is 2985 * receive ring contains fresh as yet un-processed frames,this function is
@@ -2942,15 +2987,15 @@ static void s2io_netpoll(struct net_device *dev)
2942 * stopped and sends the skb to the OSM's Rx handler and then increments 2987 * stopped and sends the skb to the OSM's Rx handler and then increments
2943 * the offset. 2988 * the offset.
2944 * Return Value: 2989 * Return Value:
2945 * NONE. 2990 * No. of napi packets processed.
2946 */ 2991 */
2947static void rx_intr_handler(struct ring_info *ring_data) 2992static int rx_intr_handler(struct ring_info *ring_data, int budget)
2948{ 2993{
2949 int get_block, put_block; 2994 int get_block, put_block;
2950 struct rx_curr_get_info get_info, put_info; 2995 struct rx_curr_get_info get_info, put_info;
2951 struct RxD_t *rxdp; 2996 struct RxD_t *rxdp;
2952 struct sk_buff *skb; 2997 struct sk_buff *skb;
2953 int pkt_cnt = 0; 2998 int pkt_cnt = 0, napi_pkts = 0;
2954 int i; 2999 int i;
2955 struct RxD1* rxdp1; 3000 struct RxD1* rxdp1;
2956 struct RxD3* rxdp3; 3001 struct RxD3* rxdp3;
@@ -2977,7 +3022,7 @@ static void rx_intr_handler(struct ring_info *ring_data)
2977 DBG_PRINT(ERR_DBG, "%s: The skb is ", 3022 DBG_PRINT(ERR_DBG, "%s: The skb is ",
2978 ring_data->dev->name); 3023 ring_data->dev->name);
2979 DBG_PRINT(ERR_DBG, "Null in Rx Intr\n"); 3024 DBG_PRINT(ERR_DBG, "Null in Rx Intr\n");
2980 return; 3025 return 0;
2981 } 3026 }
2982 if (ring_data->rxd_mode == RXD_MODE_1) { 3027 if (ring_data->rxd_mode == RXD_MODE_1) {
2983 rxdp1 = (struct RxD1*)rxdp; 3028 rxdp1 = (struct RxD1*)rxdp;
@@ -3014,9 +3059,10 @@ static void rx_intr_handler(struct ring_info *ring_data)
3014 rxdp = ring_data->rx_blocks[get_block].block_virt_addr; 3059 rxdp = ring_data->rx_blocks[get_block].block_virt_addr;
3015 } 3060 }
3016 3061
3017 if(ring_data->nic->config.napi){ 3062 if (ring_data->nic->config.napi) {
3018 ring_data->nic->pkts_to_process -= 1; 3063 budget--;
3019 if (!ring_data->nic->pkts_to_process) 3064 napi_pkts++;
3065 if (!budget)
3020 break; 3066 break;
3021 } 3067 }
3022 pkt_cnt++; 3068 pkt_cnt++;
@@ -3034,6 +3080,7 @@ static void rx_intr_handler(struct ring_info *ring_data)
3034 } 3080 }
3035 } 3081 }
3036 } 3082 }
3083 return(napi_pkts);
3037} 3084}
3038 3085
3039/** 3086/**
@@ -3730,14 +3777,19 @@ static void restore_xmsi_data(struct s2io_nic *nic)
3730{ 3777{
3731 struct XENA_dev_config __iomem *bar0 = nic->bar0; 3778 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3732 u64 val64; 3779 u64 val64;
3733 int i; 3780 int i, msix_index;
3781
3782
3783 if (nic->device_type == XFRAME_I_DEVICE)
3784 return;
3734 3785
3735 for (i=0; i < MAX_REQUESTED_MSI_X; i++) { 3786 for (i=0; i < MAX_REQUESTED_MSI_X; i++) {
3787 msix_index = (i) ? ((i-1) * 8 + 1): 0;
3736 writeq(nic->msix_info[i].addr, &bar0->xmsi_address); 3788 writeq(nic->msix_info[i].addr, &bar0->xmsi_address);
3737 writeq(nic->msix_info[i].data, &bar0->xmsi_data); 3789 writeq(nic->msix_info[i].data, &bar0->xmsi_data);
3738 val64 = (s2BIT(7) | s2BIT(15) | vBIT(i, 26, 6)); 3790 val64 = (s2BIT(7) | s2BIT(15) | vBIT(msix_index, 26, 6));
3739 writeq(val64, &bar0->xmsi_access); 3791 writeq(val64, &bar0->xmsi_access);
3740 if (wait_for_msix_trans(nic, i)) { 3792 if (wait_for_msix_trans(nic, msix_index)) {
3741 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); 3793 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__);
3742 continue; 3794 continue;
3743 } 3795 }
@@ -3748,13 +3800,17 @@ static void store_xmsi_data(struct s2io_nic *nic)
3748{ 3800{
3749 struct XENA_dev_config __iomem *bar0 = nic->bar0; 3801 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3750 u64 val64, addr, data; 3802 u64 val64, addr, data;
3751 int i; 3803 int i, msix_index;
3804
3805 if (nic->device_type == XFRAME_I_DEVICE)
3806 return;
3752 3807
3753 /* Store and display */ 3808 /* Store and display */
3754 for (i=0; i < MAX_REQUESTED_MSI_X; i++) { 3809 for (i=0; i < MAX_REQUESTED_MSI_X; i++) {
3755 val64 = (s2BIT(15) | vBIT(i, 26, 6)); 3810 msix_index = (i) ? ((i-1) * 8 + 1): 0;
3811 val64 = (s2BIT(15) | vBIT(msix_index, 26, 6));
3756 writeq(val64, &bar0->xmsi_access); 3812 writeq(val64, &bar0->xmsi_access);
3757 if (wait_for_msix_trans(nic, i)) { 3813 if (wait_for_msix_trans(nic, msix_index)) {
3758 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); 3814 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__);
3759 continue; 3815 continue;
3760 } 3816 }
@@ -3770,11 +3826,11 @@ static void store_xmsi_data(struct s2io_nic *nic)
3770static int s2io_enable_msi_x(struct s2io_nic *nic) 3826static int s2io_enable_msi_x(struct s2io_nic *nic)
3771{ 3827{
3772 struct XENA_dev_config __iomem *bar0 = nic->bar0; 3828 struct XENA_dev_config __iomem *bar0 = nic->bar0;
3773 u64 tx_mat, rx_mat; 3829 u64 rx_mat;
3774 u16 msi_control; /* Temp variable */ 3830 u16 msi_control; /* Temp variable */
3775 int ret, i, j, msix_indx = 1; 3831 int ret, i, j, msix_indx = 1;
3776 3832
3777 nic->entries = kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct msix_entry), 3833 nic->entries = kmalloc(nic->num_entries * sizeof(struct msix_entry),
3778 GFP_KERNEL); 3834 GFP_KERNEL);
3779 if (!nic->entries) { 3835 if (!nic->entries) {
3780 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \ 3836 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \
@@ -3783,10 +3839,12 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3783 return -ENOMEM; 3839 return -ENOMEM;
3784 } 3840 }
3785 nic->mac_control.stats_info->sw_stat.mem_allocated 3841 nic->mac_control.stats_info->sw_stat.mem_allocated
3786 += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3842 += (nic->num_entries * sizeof(struct msix_entry));
3843
3844 memset(nic->entries, 0, nic->num_entries * sizeof(struct msix_entry));
3787 3845
3788 nic->s2io_entries = 3846 nic->s2io_entries =
3789 kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct s2io_msix_entry), 3847 kmalloc(nic->num_entries * sizeof(struct s2io_msix_entry),
3790 GFP_KERNEL); 3848 GFP_KERNEL);
3791 if (!nic->s2io_entries) { 3849 if (!nic->s2io_entries) {
3792 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", 3850 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
@@ -3794,60 +3852,52 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3794 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3852 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
3795 kfree(nic->entries); 3853 kfree(nic->entries);
3796 nic->mac_control.stats_info->sw_stat.mem_freed 3854 nic->mac_control.stats_info->sw_stat.mem_freed
3797 += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3855 += (nic->num_entries * sizeof(struct msix_entry));
3798 return -ENOMEM; 3856 return -ENOMEM;
3799 } 3857 }
3800 nic->mac_control.stats_info->sw_stat.mem_allocated 3858 nic->mac_control.stats_info->sw_stat.mem_allocated
3801 += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3859 += (nic->num_entries * sizeof(struct s2io_msix_entry));
3802 3860 memset(nic->s2io_entries, 0,
3803 for (i=0; i< MAX_REQUESTED_MSI_X; i++) { 3861 nic->num_entries * sizeof(struct s2io_msix_entry));
3804 nic->entries[i].entry = i; 3862
3805 nic->s2io_entries[i].entry = i; 3863 nic->entries[0].entry = 0;
3864 nic->s2io_entries[0].entry = 0;
3865 nic->s2io_entries[0].in_use = MSIX_FLG;
3866 nic->s2io_entries[0].type = MSIX_ALARM_TYPE;
3867 nic->s2io_entries[0].arg = &nic->mac_control.fifos;
3868
3869 for (i = 1; i < nic->num_entries; i++) {
3870 nic->entries[i].entry = ((i - 1) * 8) + 1;
3871 nic->s2io_entries[i].entry = ((i - 1) * 8) + 1;
3806 nic->s2io_entries[i].arg = NULL; 3872 nic->s2io_entries[i].arg = NULL;
3807 nic->s2io_entries[i].in_use = 0; 3873 nic->s2io_entries[i].in_use = 0;
3808 } 3874 }
3809 3875
3810 tx_mat = readq(&bar0->tx_mat0_n[0]);
3811 for (i=0; i<nic->config.tx_fifo_num; i++, msix_indx++) {
3812 tx_mat |= TX_MAT_SET(i, msix_indx);
3813 nic->s2io_entries[msix_indx].arg = &nic->mac_control.fifos[i];
3814 nic->s2io_entries[msix_indx].type = MSIX_FIFO_TYPE;
3815 nic->s2io_entries[msix_indx].in_use = MSIX_FLG;
3816 }
3817 writeq(tx_mat, &bar0->tx_mat0_n[0]);
3818
3819 rx_mat = readq(&bar0->rx_mat); 3876 rx_mat = readq(&bar0->rx_mat);
3820 for (j = 0; j < nic->config.rx_ring_num; j++, msix_indx++) { 3877 for (j = 0; j < nic->config.rx_ring_num; j++) {
3821 rx_mat |= RX_MAT_SET(j, msix_indx); 3878 rx_mat |= RX_MAT_SET(j, msix_indx);
3822 nic->s2io_entries[msix_indx].arg 3879 nic->s2io_entries[j+1].arg = &nic->mac_control.rings[j];
3823 = &nic->mac_control.rings[j]; 3880 nic->s2io_entries[j+1].type = MSIX_RING_TYPE;
3824 nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE; 3881 nic->s2io_entries[j+1].in_use = MSIX_FLG;
3825 nic->s2io_entries[msix_indx].in_use = MSIX_FLG; 3882 msix_indx += 8;
3826 } 3883 }
3827 writeq(rx_mat, &bar0->rx_mat); 3884 writeq(rx_mat, &bar0->rx_mat);
3885 readq(&bar0->rx_mat);
3828 3886
3829 nic->avail_msix_vectors = 0; 3887 ret = pci_enable_msix(nic->pdev, nic->entries, nic->num_entries);
3830 ret = pci_enable_msix(nic->pdev, nic->entries, MAX_REQUESTED_MSI_X);
3831 /* We fail init if error or we get less vectors than min required */ 3888 /* We fail init if error or we get less vectors than min required */
3832 if (ret >= (nic->config.tx_fifo_num + nic->config.rx_ring_num + 1)) {
3833 nic->avail_msix_vectors = ret;
3834 ret = pci_enable_msix(nic->pdev, nic->entries, ret);
3835 }
3836 if (ret) { 3889 if (ret) {
3837 DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name); 3890 DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name);
3838 kfree(nic->entries); 3891 kfree(nic->entries);
3839 nic->mac_control.stats_info->sw_stat.mem_freed 3892 nic->mac_control.stats_info->sw_stat.mem_freed
3840 += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3893 += (nic->num_entries * sizeof(struct msix_entry));
3841 kfree(nic->s2io_entries); 3894 kfree(nic->s2io_entries);
3842 nic->mac_control.stats_info->sw_stat.mem_freed 3895 nic->mac_control.stats_info->sw_stat.mem_freed
3843 += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3896 += (nic->num_entries * sizeof(struct s2io_msix_entry));
3844 nic->entries = NULL; 3897 nic->entries = NULL;
3845 nic->s2io_entries = NULL; 3898 nic->s2io_entries = NULL;
3846 nic->avail_msix_vectors = 0;
3847 return -ENOMEM; 3899 return -ENOMEM;
3848 } 3900 }
3849 if (!nic->avail_msix_vectors)
3850 nic->avail_msix_vectors = MAX_REQUESTED_MSI_X;
3851 3901
3852 /* 3902 /*
3853 * To enable MSI-X, MSI also needs to be enabled, due to a bug 3903 * To enable MSI-X, MSI also needs to be enabled, due to a bug
@@ -3919,7 +3969,7 @@ static void remove_msix_isr(struct s2io_nic *sp)
3919 int i; 3969 int i;
3920 u16 msi_control; 3970 u16 msi_control;
3921 3971
3922 for (i = 0; i < MAX_REQUESTED_MSI_X; i++) { 3972 for (i = 0; i < sp->num_entries; i++) {
3923 if (sp->s2io_entries[i].in_use == 3973 if (sp->s2io_entries[i].in_use ==
3924 MSIX_REGISTERED_SUCCESS) { 3974 MSIX_REGISTERED_SUCCESS) {
3925 int vector = sp->entries[i].vector; 3975 int vector = sp->entries[i].vector;
@@ -3975,29 +4025,6 @@ static int s2io_open(struct net_device *dev)
3975 netif_carrier_off(dev); 4025 netif_carrier_off(dev);
3976 sp->last_link_state = 0; 4026 sp->last_link_state = 0;
3977 4027
3978 if (sp->config.intr_type == MSI_X) {
3979 int ret = s2io_enable_msi_x(sp);
3980
3981 if (!ret) {
3982 ret = s2io_test_msi(sp);
3983 /* rollback MSI-X, will re-enable during add_isr() */
3984 remove_msix_isr(sp);
3985 }
3986 if (ret) {
3987
3988 DBG_PRINT(ERR_DBG,
3989 "%s: MSI-X requested but failed to enable\n",
3990 dev->name);
3991 sp->config.intr_type = INTA;
3992 }
3993 }
3994
3995 /* NAPI doesn't work well with MSI(X) */
3996 if (sp->config.intr_type != INTA) {
3997 if(sp->config.napi)
3998 sp->config.napi = 0;
3999 }
4000
4001 /* Initialize H/W and enable interrupts */ 4028 /* Initialize H/W and enable interrupts */
4002 err = s2io_card_up(sp); 4029 err = s2io_card_up(sp);
4003 if (err) { 4030 if (err) {
@@ -4020,12 +4047,12 @@ hw_init_failed:
4020 if (sp->entries) { 4047 if (sp->entries) {
4021 kfree(sp->entries); 4048 kfree(sp->entries);
4022 sp->mac_control.stats_info->sw_stat.mem_freed 4049 sp->mac_control.stats_info->sw_stat.mem_freed
4023 += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 4050 += (sp->num_entries * sizeof(struct msix_entry));
4024 } 4051 }
4025 if (sp->s2io_entries) { 4052 if (sp->s2io_entries) {
4026 kfree(sp->s2io_entries); 4053 kfree(sp->s2io_entries);
4027 sp->mac_control.stats_info->sw_stat.mem_freed 4054 sp->mac_control.stats_info->sw_stat.mem_freed
4028 += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 4055 += (sp->num_entries * sizeof(struct s2io_msix_entry));
4029 } 4056 }
4030 } 4057 }
4031 return err; 4058 return err;
@@ -4327,40 +4354,65 @@ s2io_alarm_handle(unsigned long data)
4327 mod_timer(&sp->alarm_timer, jiffies + HZ / 2); 4354 mod_timer(&sp->alarm_timer, jiffies + HZ / 2);
4328} 4355}
4329 4356
4330static int s2io_chk_rx_buffers(struct ring_info *ring)
4331{
4332 if (fill_rx_buffers(ring) == -ENOMEM) {
4333 DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name);
4334 DBG_PRINT(INFO_DBG, " in Rx Intr!!\n");
4335 }
4336 return 0;
4337}
4338
4339static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id) 4357static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
4340{ 4358{
4341 struct ring_info *ring = (struct ring_info *)dev_id; 4359 struct ring_info *ring = (struct ring_info *)dev_id;
4342 struct s2io_nic *sp = ring->nic; 4360 struct s2io_nic *sp = ring->nic;
4361 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4362 struct net_device *dev = sp->dev;
4343 4363
4344 if (!is_s2io_card_up(sp)) 4364 if (unlikely(!is_s2io_card_up(sp)))
4345 return IRQ_HANDLED; 4365 return IRQ_HANDLED;
4346 4366
4347 rx_intr_handler(ring); 4367 if (sp->config.napi) {
4348 s2io_chk_rx_buffers(ring); 4368 u8 __iomem *addr = NULL;
4369 u8 val8 = 0;
4370
4371 addr = (u8 __iomem *)&bar0->xmsi_mask_reg;
4372 addr += (7 - ring->ring_no);
4373 val8 = (ring->ring_no == 0) ? 0x7f : 0xff;
4374 writeb(val8, addr);
4375 val8 = readb(addr);
4376 netif_rx_schedule(dev, &ring->napi);
4377 } else {
4378 rx_intr_handler(ring, 0);
4379 s2io_chk_rx_buffers(ring);
4380 }
4349 4381
4350 return IRQ_HANDLED; 4382 return IRQ_HANDLED;
4351} 4383}
4352 4384
4353static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id) 4385static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id)
4354{ 4386{
4355 struct fifo_info *fifo = (struct fifo_info *)dev_id; 4387 int i;
4356 struct s2io_nic *sp = fifo->nic; 4388 struct fifo_info *fifos = (struct fifo_info *)dev_id;
4389 struct s2io_nic *sp = fifos->nic;
4390 struct XENA_dev_config __iomem *bar0 = sp->bar0;
4391 struct config_param *config = &sp->config;
4392 u64 reason;
4357 4393
4358 if (!is_s2io_card_up(sp)) 4394 if (unlikely(!is_s2io_card_up(sp)))
4395 return IRQ_NONE;
4396
4397 reason = readq(&bar0->general_int_status);
4398 if (unlikely(reason == S2IO_MINUS_ONE))
4399 /* Nothing much can be done. Get out */
4359 return IRQ_HANDLED; 4400 return IRQ_HANDLED;
4360 4401
4361 tx_intr_handler(fifo); 4402 writeq(S2IO_MINUS_ONE, &bar0->general_int_mask);
4403
4404 if (reason & GEN_INTR_TXTRAFFIC)
4405 writeq(S2IO_MINUS_ONE, &bar0->tx_traffic_int);
4406
4407 for (i = 0; i < config->tx_fifo_num; i++)
4408 tx_intr_handler(&fifos[i]);
4409
4410 writeq(sp->general_int_mask, &bar0->general_int_mask);
4411 readl(&bar0->general_int_status);
4412
4362 return IRQ_HANDLED; 4413 return IRQ_HANDLED;
4363} 4414}
4415
4364static void s2io_txpic_intr_handle(struct s2io_nic *sp) 4416static void s2io_txpic_intr_handle(struct s2io_nic *sp)
4365{ 4417{
4366 struct XENA_dev_config __iomem *bar0 = sp->bar0; 4418 struct XENA_dev_config __iomem *bar0 = sp->bar0;
@@ -4762,14 +4814,10 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
4762 4814
4763 if (config->napi) { 4815 if (config->napi) {
4764 if (reason & GEN_INTR_RXTRAFFIC) { 4816 if (reason & GEN_INTR_RXTRAFFIC) {
4765 if (likely(netif_rx_schedule_prep(dev, 4817 netif_rx_schedule(dev, &sp->napi);
4766 &sp->napi))) { 4818 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_mask);
4767 __netif_rx_schedule(dev, &sp->napi); 4819 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int);
4768 writeq(S2IO_MINUS_ONE, 4820 readl(&bar0->rx_traffic_int);
4769 &bar0->rx_traffic_mask);
4770 } else
4771 writeq(S2IO_MINUS_ONE,
4772 &bar0->rx_traffic_int);
4773 } 4821 }
4774 } else { 4822 } else {
4775 /* 4823 /*
@@ -4781,7 +4829,7 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
4781 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); 4829 writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int);
4782 4830
4783 for (i = 0; i < config->rx_ring_num; i++) 4831 for (i = 0; i < config->rx_ring_num; i++)
4784 rx_intr_handler(&mac_control->rings[i]); 4832 rx_intr_handler(&mac_control->rings[i], 0);
4785 } 4833 }
4786 4834
4787 /* 4835 /*
@@ -6984,62 +7032,62 @@ static int s2io_add_isr(struct s2io_nic * sp)
6984 7032
6985 /* After proper initialization of H/W, register ISR */ 7033 /* After proper initialization of H/W, register ISR */
6986 if (sp->config.intr_type == MSI_X) { 7034 if (sp->config.intr_type == MSI_X) {
6987 int i, msix_tx_cnt=0,msix_rx_cnt=0; 7035 int i, msix_rx_cnt = 0;
6988 7036
6989 for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { 7037 for (i = 0; i < sp->num_entries; i++) {
6990 if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { 7038 if (sp->s2io_entries[i].in_use == MSIX_FLG) {
6991 sprintf(sp->desc[i], "%s:MSI-X-%d-TX", 7039 if (sp->s2io_entries[i].type ==
7040 MSIX_RING_TYPE) {
7041 sprintf(sp->desc[i], "%s:MSI-X-%d-RX",
7042 dev->name, i);
7043 err = request_irq(sp->entries[i].vector,
7044 s2io_msix_ring_handle, 0,
7045 sp->desc[i],
7046 sp->s2io_entries[i].arg);
7047 } else if (sp->s2io_entries[i].type ==
7048 MSIX_ALARM_TYPE) {
7049 sprintf(sp->desc[i], "%s:MSI-X-%d-TX",
6992 dev->name, i); 7050 dev->name, i);
6993 err = request_irq(sp->entries[i].vector, 7051 err = request_irq(sp->entries[i].vector,
6994 s2io_msix_fifo_handle, 0, sp->desc[i], 7052 s2io_msix_fifo_handle, 0,
6995 sp->s2io_entries[i].arg); 7053 sp->desc[i],
6996 /* If either data or addr is zero print it */ 7054 sp->s2io_entries[i].arg);
6997 if(!(sp->msix_info[i].addr && 7055
6998 sp->msix_info[i].data)) {
6999 DBG_PRINT(ERR_DBG, "%s @ Addr:0x%llx "
7000 "Data:0x%llx\n",sp->desc[i],
7001 (unsigned long long)
7002 sp->msix_info[i].addr,
7003 (unsigned long long)
7004 sp->msix_info[i].data);
7005 } else {
7006 msix_tx_cnt++;
7007 } 7056 }
7008 } else { 7057 /* if either data or addr is zero print it. */
7009 sprintf(sp->desc[i], "%s:MSI-X-%d-RX", 7058 if (!(sp->msix_info[i].addr &&
7010 dev->name, i);
7011 err = request_irq(sp->entries[i].vector,
7012 s2io_msix_ring_handle, 0, sp->desc[i],
7013 sp->s2io_entries[i].arg);
7014 /* If either data or addr is zero print it */
7015 if(!(sp->msix_info[i].addr &&
7016 sp->msix_info[i].data)) { 7059 sp->msix_info[i].data)) {
7017 DBG_PRINT(ERR_DBG, "%s @ Addr:0x%llx " 7060 DBG_PRINT(ERR_DBG,
7018 "Data:0x%llx\n",sp->desc[i], 7061 "%s @Addr:0x%llx Data:0x%llx\n",
7062 sp->desc[i],
7019 (unsigned long long) 7063 (unsigned long long)
7020 sp->msix_info[i].addr, 7064 sp->msix_info[i].addr,
7021 (unsigned long long) 7065 (unsigned long long)
7022 sp->msix_info[i].data); 7066 ntohl(sp->msix_info[i].data));
7023 } else { 7067 } else
7024 msix_rx_cnt++; 7068 msix_rx_cnt++;
7069 if (err) {
7070 remove_msix_isr(sp);
7071
7072 DBG_PRINT(ERR_DBG,
7073 "%s:MSI-X-%d registration "
7074 "failed\n", dev->name, i);
7075
7076 DBG_PRINT(ERR_DBG,
7077 "%s: Defaulting to INTA\n",
7078 dev->name);
7079 sp->config.intr_type = INTA;
7080 break;
7025 } 7081 }
7082 sp->s2io_entries[i].in_use =
7083 MSIX_REGISTERED_SUCCESS;
7026 } 7084 }
7027 if (err) {
7028 remove_msix_isr(sp);
7029 DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration "
7030 "failed\n", dev->name, i);
7031 DBG_PRINT(ERR_DBG, "%s: defaulting to INTA\n",
7032 dev->name);
7033 sp->config.intr_type = INTA;
7034 break;
7035 }
7036 sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS;
7037 } 7085 }
7038 if (!err) { 7086 if (!err) {
7039 printk(KERN_INFO "MSI-X-TX %d entries enabled\n",
7040 msix_tx_cnt);
7041 printk(KERN_INFO "MSI-X-RX %d entries enabled\n", 7087 printk(KERN_INFO "MSI-X-RX %d entries enabled\n",
7042 msix_rx_cnt); 7088 --msix_rx_cnt);
7089 DBG_PRINT(INFO_DBG, "MSI-X-TX entries enabled"
7090 " through alarm vector\n");
7043 } 7091 }
7044 } 7092 }
7045 if (sp->config.intr_type == INTA) { 7093 if (sp->config.intr_type == INTA) {
@@ -7080,8 +7128,15 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
7080 clear_bit(__S2IO_STATE_CARD_UP, &sp->state); 7128 clear_bit(__S2IO_STATE_CARD_UP, &sp->state);
7081 7129
7082 /* Disable napi */ 7130 /* Disable napi */
7083 if (config->napi) 7131 if (sp->config.napi) {
7084 napi_disable(&sp->napi); 7132 int off = 0;
7133 if (config->intr_type == MSI_X) {
7134 for (; off < sp->config.rx_ring_num; off++)
7135 napi_disable(&sp->mac_control.rings[off].napi);
7136 }
7137 else
7138 napi_disable(&sp->napi);
7139 }
7085 7140
7086 /* disable Tx and Rx traffic on the NIC */ 7141 /* disable Tx and Rx traffic on the NIC */
7087 if (do_io) 7142 if (do_io)
@@ -7173,8 +7228,15 @@ static int s2io_card_up(struct s2io_nic * sp)
7173 } 7228 }
7174 7229
7175 /* Initialise napi */ 7230 /* Initialise napi */
7176 if (config->napi) 7231 if (config->napi) {
7177 napi_enable(&sp->napi); 7232 int i;
7233 if (config->intr_type == MSI_X) {
7234 for (i = 0; i < sp->config.rx_ring_num; i++)
7235 napi_enable(&sp->mac_control.rings[i].napi);
7236 } else {
7237 napi_enable(&sp->napi);
7238 }
7239 }
7178 7240
7179 /* Maintain the state prior to the open */ 7241 /* Maintain the state prior to the open */
7180 if (sp->promisc_flg) 7242 if (sp->promisc_flg)
@@ -7217,7 +7279,7 @@ static int s2io_card_up(struct s2io_nic * sp)
7217 /* Enable select interrupts */ 7279 /* Enable select interrupts */
7218 en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS); 7280 en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS);
7219 if (sp->config.intr_type != INTA) 7281 if (sp->config.intr_type != INTA)
7220 en_dis_able_nic_intrs(sp, ENA_ALL_INTRS, DISABLE_INTRS); 7282 en_dis_able_nic_intrs(sp, TX_TRAFFIC_INTR, ENABLE_INTRS);
7221 else { 7283 else {
7222 interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; 7284 interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR;
7223 interruptible |= TX_PIC_INTR; 7285 interruptible |= TX_PIC_INTR;
@@ -7615,9 +7677,6 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
7615 rx_ring_num = MAX_RX_RINGS; 7677 rx_ring_num = MAX_RX_RINGS;
7616 } 7678 }
7617 7679
7618 if (*dev_intr_type != INTA)
7619 napi = 0;
7620
7621 if ((*dev_intr_type != INTA) && (*dev_intr_type != MSI_X)) { 7680 if ((*dev_intr_type != INTA) && (*dev_intr_type != MSI_X)) {
7622 DBG_PRINT(ERR_DBG, "s2io: Wrong intr_type requested. " 7681 DBG_PRINT(ERR_DBG, "s2io: Wrong intr_type requested. "
7623 "Defaulting to INTA\n"); 7682 "Defaulting to INTA\n");
@@ -7918,8 +7977,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7918 * will use eth_mac_addr() for dev->set_mac_address 7977 * will use eth_mac_addr() for dev->set_mac_address
7919 * mac address will be set every time dev->open() is called 7978 * mac address will be set every time dev->open() is called
7920 */ 7979 */
7921 netif_napi_add(dev, &sp->napi, s2io_poll, 32);
7922
7923#ifdef CONFIG_NET_POLL_CONTROLLER 7980#ifdef CONFIG_NET_POLL_CONTROLLER
7924 dev->poll_controller = s2io_netpoll; 7981 dev->poll_controller = s2io_netpoll;
7925#endif 7982#endif
@@ -7963,6 +8020,32 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7963 } 8020 }
7964 } 8021 }
7965 8022
8023 if (sp->config.intr_type == MSI_X) {
8024 sp->num_entries = config->rx_ring_num + 1;
8025 ret = s2io_enable_msi_x(sp);
8026
8027 if (!ret) {
8028 ret = s2io_test_msi(sp);
8029 /* rollback MSI-X, will re-enable during add_isr() */
8030 remove_msix_isr(sp);
8031 }
8032 if (ret) {
8033
8034 DBG_PRINT(ERR_DBG,
8035 "%s: MSI-X requested but failed to enable\n",
8036 dev->name);
8037 sp->config.intr_type = INTA;
8038 }
8039 }
8040
8041 if (config->intr_type == MSI_X) {
8042 for (i = 0; i < config->rx_ring_num ; i++)
8043 netif_napi_add(dev, &mac_control->rings[i].napi,
8044 s2io_poll_msix, 64);
8045 } else {
8046 netif_napi_add(dev, &sp->napi, s2io_poll_inta, 64);
8047 }
8048
7966 /* Not needed for Herc */ 8049 /* Not needed for Herc */
7967 if (sp->device_type & XFRAME_I_DEVICE) { 8050 if (sp->device_type & XFRAME_I_DEVICE) {
7968 /* 8051 /*
@@ -8013,6 +8096,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
8013 /* store mac addresses from CAM to s2io_nic structure */ 8096 /* store mac addresses from CAM to s2io_nic structure */
8014 do_s2io_store_unicast_mc(sp); 8097 do_s2io_store_unicast_mc(sp);
8015 8098
8099 /* Configure MSIX vector for number of rings configured plus one */
8100 if ((sp->device_type == XFRAME_II_DEVICE) &&
8101 (config->intr_type == MSI_X))
8102 sp->num_entries = config->rx_ring_num + 1;
8103
8016 /* Store the values of the MSIX table in the s2io_nic structure */ 8104 /* Store the values of the MSIX table in the s2io_nic structure */
8017 store_xmsi_data(sp); 8105 store_xmsi_data(sp);
8018 /* reset Nic and bring it to known state */ 8106 /* reset Nic and bring it to known state */
@@ -8078,8 +8166,14 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
8078 break; 8166 break;
8079 } 8167 }
8080 8168
8081 if (napi) 8169 switch (sp->config.napi) {
8170 case 0:
8171 DBG_PRINT(ERR_DBG, "%s: NAPI disabled\n", dev->name);
8172 break;
8173 case 1:
8082 DBG_PRINT(ERR_DBG, "%s: NAPI enabled\n", dev->name); 8174 DBG_PRINT(ERR_DBG, "%s: NAPI enabled\n", dev->name);
8175 break;
8176 }
8083 8177
8084 DBG_PRINT(ERR_DBG, "%s: Using %d Tx fifo(s)\n", dev->name, 8178 DBG_PRINT(ERR_DBG, "%s: Using %d Tx fifo(s)\n", dev->name,
8085 sp->config.tx_fifo_num); 8179 sp->config.tx_fifo_num);
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 0709ebae9139..4706f7f9acb6 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -706,7 +706,7 @@ struct ring_info {
706 /* per-ring buffer counter */ 706 /* per-ring buffer counter */
707 u32 rx_bufs_left; 707 u32 rx_bufs_left;
708 708
709 #define MAX_LRO_SESSIONS 32 709#define MAX_LRO_SESSIONS 32
710 struct lro lro0_n[MAX_LRO_SESSIONS]; 710 struct lro lro0_n[MAX_LRO_SESSIONS];
711 u8 lro; 711 u8 lro;
712 712
@@ -725,6 +725,11 @@ struct ring_info {
725 /* copy of sp->pdev pointer */ 725 /* copy of sp->pdev pointer */
726 struct pci_dev *pdev; 726 struct pci_dev *pdev;
727 727
728 /* Per ring napi struct */
729 struct napi_struct napi;
730
731 unsigned long interrupt_count;
732
728 /* 733 /*
729 * Place holders for the virtual and physical addresses of 734 * Place holders for the virtual and physical addresses of
730 * all the Rx Blocks 735 * all the Rx Blocks
@@ -841,7 +846,7 @@ struct usr_addr {
841 * Structure to keep track of the MSI-X vectors and the corresponding 846 * Structure to keep track of the MSI-X vectors and the corresponding
842 * argument registered against each vector 847 * argument registered against each vector
843 */ 848 */
844#define MAX_REQUESTED_MSI_X 17 849#define MAX_REQUESTED_MSI_X 9
845struct s2io_msix_entry 850struct s2io_msix_entry
846{ 851{
847 u16 vector; 852 u16 vector;
@@ -849,8 +854,8 @@ struct s2io_msix_entry
849 void *arg; 854 void *arg;
850 855
851 u8 type; 856 u8 type;
852#define MSIX_FIFO_TYPE 1 857#define MSIX_ALARM_TYPE 1
853#define MSIX_RING_TYPE 2 858#define MSIX_RING_TYPE 2
854 859
855 u8 in_use; 860 u8 in_use;
856#define MSIX_REGISTERED_SUCCESS 0xAA 861#define MSIX_REGISTERED_SUCCESS 0xAA
@@ -877,7 +882,6 @@ struct s2io_nic {
877 */ 882 */
878 int pkts_to_process; 883 int pkts_to_process;
879 struct net_device *dev; 884 struct net_device *dev;
880 struct napi_struct napi;
881 struct mac_info mac_control; 885 struct mac_info mac_control;
882 struct config_param config; 886 struct config_param config;
883 struct pci_dev *pdev; 887 struct pci_dev *pdev;
@@ -948,6 +952,7 @@ struct s2io_nic {
948 */ 952 */
949 u8 other_fifo_idx; 953 u8 other_fifo_idx;
950 954
955 struct napi_struct napi;
951 /* after blink, the adapter must be restored with original 956 /* after blink, the adapter must be restored with original
952 * values. 957 * values.
953 */ 958 */
@@ -962,6 +967,7 @@ struct s2io_nic {
962 unsigned long long start_time; 967 unsigned long long start_time;
963 struct vlan_group *vlgrp; 968 struct vlan_group *vlgrp;
964#define MSIX_FLG 0xA5 969#define MSIX_FLG 0xA5
970 int num_entries;
965 struct msix_entry *entries; 971 struct msix_entry *entries;
966 int msi_detected; 972 int msi_detected;
967 wait_queue_head_t msi_wait; 973 wait_queue_head_t msi_wait;
@@ -982,6 +988,7 @@ struct s2io_nic {
982 u16 lro_max_aggr_per_sess; 988 u16 lro_max_aggr_per_sess;
983 volatile unsigned long state; 989 volatile unsigned long state;
984 u64 general_int_mask; 990 u64 general_int_mask;
991
985#define VPD_STRING_LEN 80 992#define VPD_STRING_LEN 80
986 u8 product_name[VPD_STRING_LEN]; 993 u8 product_name[VPD_STRING_LEN];
987 u8 serial_num[VPD_STRING_LEN]; 994 u8 serial_num[VPD_STRING_LEN];
@@ -1103,7 +1110,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev);
1103static int init_shared_mem(struct s2io_nic *sp); 1110static int init_shared_mem(struct s2io_nic *sp);
1104static void free_shared_mem(struct s2io_nic *sp); 1111static void free_shared_mem(struct s2io_nic *sp);
1105static int init_nic(struct s2io_nic *nic); 1112static int init_nic(struct s2io_nic *nic);
1106static void rx_intr_handler(struct ring_info *ring_data); 1113static int rx_intr_handler(struct ring_info *ring_data, int budget);
1107static void tx_intr_handler(struct fifo_info *fifo_data); 1114static void tx_intr_handler(struct fifo_info *fifo_data);
1108static void s2io_handle_errors(void * dev_id); 1115static void s2io_handle_errors(void * dev_id);
1109 1116
@@ -1114,7 +1121,8 @@ static void s2io_set_multicast(struct net_device *dev);
1114static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp); 1121static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp);
1115static void s2io_link(struct s2io_nic * sp, int link); 1122static void s2io_link(struct s2io_nic * sp, int link);
1116static void s2io_reset(struct s2io_nic * sp); 1123static void s2io_reset(struct s2io_nic * sp);
1117static int s2io_poll(struct napi_struct *napi, int budget); 1124static int s2io_poll_msix(struct napi_struct *napi, int budget);
1125static int s2io_poll_inta(struct napi_struct *napi, int budget);
1118static void s2io_init_pci(struct s2io_nic * sp); 1126static void s2io_init_pci(struct s2io_nic * sp);
1119static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr); 1127static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr);
1120static void s2io_alarm_handle(unsigned long data); 1128static void s2io_alarm_handle(unsigned long data);
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 888b7dec9866..33bb18f810fb 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -179,8 +179,7 @@ enum sbmac_state {
179#define SBMAC_MAX_TXDESCR 256 179#define SBMAC_MAX_TXDESCR 256
180#define SBMAC_MAX_RXDESCR 256 180#define SBMAC_MAX_RXDESCR 256
181 181
182#define ETHER_ALIGN 2 182#define ETHER_ADDR_LEN 6
183#define ETHER_ADDR_LEN 6
184#define ENET_PACKET_SIZE 1518 183#define ENET_PACKET_SIZE 1518
185/*#define ENET_PACKET_SIZE 9216 */ 184/*#define ENET_PACKET_SIZE 9216 */
186 185
@@ -262,8 +261,6 @@ struct sbmac_softc {
262 spinlock_t sbm_lock; /* spin lock */ 261 spinlock_t sbm_lock; /* spin lock */
263 int sbm_devflags; /* current device flags */ 262 int sbm_devflags; /* current device flags */
264 263
265 int sbm_buffersize;
266
267 /* 264 /*
268 * Controller-specific things 265 * Controller-specific things
269 */ 266 */
@@ -305,10 +302,11 @@ struct sbmac_softc {
305static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan, 302static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
306 int txrx, int maxdescr); 303 int txrx, int maxdescr);
307static void sbdma_channel_start(struct sbmacdma *d, int rxtx); 304static void sbdma_channel_start(struct sbmacdma *d, int rxtx);
308static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *m); 305static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d,
306 struct sk_buff *m);
309static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m); 307static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m);
310static void sbdma_emptyring(struct sbmacdma *d); 308static void sbdma_emptyring(struct sbmacdma *d);
311static void sbdma_fillring(struct sbmacdma *d); 309static void sbdma_fillring(struct sbmac_softc *sc, struct sbmacdma *d);
312static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d, 310static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
313 int work_to_do, int poll); 311 int work_to_do, int poll);
314static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d, 312static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
@@ -777,16 +775,13 @@ static void sbdma_channel_stop(struct sbmacdma *d)
777 d->sbdma_remptr = NULL; 775 d->sbdma_remptr = NULL;
778} 776}
779 777
780static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) 778static inline void sbdma_align_skb(struct sk_buff *skb,
779 unsigned int power2, unsigned int offset)
781{ 780{
782 unsigned long addr; 781 unsigned char *addr = skb->data;
783 unsigned long newaddr; 782 unsigned char *newaddr = PTR_ALIGN(addr, power2);
784
785 addr = (unsigned long) skb->data;
786
787 newaddr = (addr + power2 - 1) & ~(power2 - 1);
788 783
789 skb_reserve(skb,newaddr-addr+offset); 784 skb_reserve(skb, newaddr - addr + offset);
790} 785}
791 786
792 787
@@ -797,7 +792,8 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset)
797 * this queues a buffer for inbound packets. 792 * this queues a buffer for inbound packets.
798 * 793 *
799 * Input parameters: 794 * Input parameters:
800 * d - DMA channel descriptor 795 * sc - softc structure
796 * d - DMA channel descriptor
801 * sb - sk_buff to add, or NULL if we should allocate one 797 * sb - sk_buff to add, or NULL if we should allocate one
802 * 798 *
803 * Return value: 799 * Return value:
@@ -806,8 +802,10 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset)
806 ********************************************************************* */ 802 ********************************************************************* */
807 803
808 804
809static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb) 805static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d,
806 struct sk_buff *sb)
810{ 807{
808 struct net_device *dev = sc->sbm_dev;
811 struct sbdmadscr *dsc; 809 struct sbdmadscr *dsc;
812 struct sbdmadscr *nextdsc; 810 struct sbdmadscr *nextdsc;
813 struct sk_buff *sb_new = NULL; 811 struct sk_buff *sb_new = NULL;
@@ -848,14 +846,16 @@ static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb)
848 */ 846 */
849 847
850 if (sb == NULL) { 848 if (sb == NULL) {
851 sb_new = dev_alloc_skb(ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN); 849 sb_new = netdev_alloc_skb(dev, ENET_PACKET_SIZE +
850 SMP_CACHE_BYTES * 2 +
851 NET_IP_ALIGN);
852 if (sb_new == NULL) { 852 if (sb_new == NULL) {
853 pr_info("%s: sk_buff allocation failed\n", 853 pr_info("%s: sk_buff allocation failed\n",
854 d->sbdma_eth->sbm_dev->name); 854 d->sbdma_eth->sbm_dev->name);
855 return -ENOBUFS; 855 return -ENOBUFS;
856 } 856 }
857 857
858 sbdma_align_skb(sb_new, SMP_CACHE_BYTES, ETHER_ALIGN); 858 sbdma_align_skb(sb_new, SMP_CACHE_BYTES, NET_IP_ALIGN);
859 } 859 }
860 else { 860 else {
861 sb_new = sb; 861 sb_new = sb;
@@ -874,10 +874,10 @@ static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb)
874 * Do not interrupt per DMA transfer. 874 * Do not interrupt per DMA transfer.
875 */ 875 */
876 dsc->dscr_a = virt_to_phys(sb_new->data) | 876 dsc->dscr_a = virt_to_phys(sb_new->data) |
877 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; 877 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize + NET_IP_ALIGN)) | 0;
878#else 878#else
879 dsc->dscr_a = virt_to_phys(sb_new->data) | 879 dsc->dscr_a = virt_to_phys(sb_new->data) |
880 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 880 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize + NET_IP_ALIGN)) |
881 M_DMA_DSCRA_INTERRUPT; 881 M_DMA_DSCRA_INTERRUPT;
882#endif 882#endif
883 883
@@ -1032,18 +1032,19 @@ static void sbdma_emptyring(struct sbmacdma *d)
1032 * with sk_buffs 1032 * with sk_buffs
1033 * 1033 *
1034 * Input parameters: 1034 * Input parameters:
1035 * d - DMA channel 1035 * sc - softc structure
1036 * d - DMA channel
1036 * 1037 *
1037 * Return value: 1038 * Return value:
1038 * nothing 1039 * nothing
1039 ********************************************************************* */ 1040 ********************************************************************* */
1040 1041
1041static void sbdma_fillring(struct sbmacdma *d) 1042static void sbdma_fillring(struct sbmac_softc *sc, struct sbmacdma *d)
1042{ 1043{
1043 int idx; 1044 int idx;
1044 1045
1045 for (idx = 0; idx < SBMAC_MAX_RXDESCR-1; idx++) { 1046 for (idx = 0; idx < SBMAC_MAX_RXDESCR - 1; idx++) {
1046 if (sbdma_add_rcvbuffer(d,NULL) != 0) 1047 if (sbdma_add_rcvbuffer(sc, d, NULL) != 0)
1047 break; 1048 break;
1048 } 1049 }
1049} 1050}
@@ -1159,10 +1160,11 @@ again:
1159 * packet and put it right back on the receive ring. 1160 * packet and put it right back on the receive ring.
1160 */ 1161 */
1161 1162
1162 if (unlikely (sbdma_add_rcvbuffer(d,NULL) == 1163 if (unlikely(sbdma_add_rcvbuffer(sc, d, NULL) ==
1163 -ENOBUFS)) { 1164 -ENOBUFS)) {
1164 dev->stats.rx_dropped++; 1165 dev->stats.rx_dropped++;
1165 sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ 1166 /* Re-add old buffer */
1167 sbdma_add_rcvbuffer(sc, d, sb);
1166 /* No point in continuing at the moment */ 1168 /* No point in continuing at the moment */
1167 printk(KERN_ERR "dropped packet (1)\n"); 1169 printk(KERN_ERR "dropped packet (1)\n");
1168 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); 1170 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr);
@@ -1212,7 +1214,7 @@ again:
1212 * put it back on the receive ring. 1214 * put it back on the receive ring.
1213 */ 1215 */
1214 dev->stats.rx_errors++; 1216 dev->stats.rx_errors++;
1215 sbdma_add_rcvbuffer(d,sb); 1217 sbdma_add_rcvbuffer(sc, d, sb);
1216 } 1218 }
1217 1219
1218 1220
@@ -1570,7 +1572,7 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1570 * Fill the receive ring 1572 * Fill the receive ring
1571 */ 1573 */
1572 1574
1573 sbdma_fillring(&(s->sbm_rxdma)); 1575 sbdma_fillring(s, &(s->sbm_rxdma));
1574 1576
1575 /* 1577 /*
1576 * Turn on the rest of the bits in the enable register 1578 * Turn on the rest of the bits in the enable register
@@ -2312,13 +2314,6 @@ static int sbmac_init(struct platform_device *pldev, long long base)
2312 dev->dev_addr[i] = eaddr[i]; 2314 dev->dev_addr[i] = eaddr[i];
2313 } 2315 }
2314 2316
2315
2316 /*
2317 * Init packet size
2318 */
2319
2320 sc->sbm_buffersize = ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN;
2321
2322 /* 2317 /*
2323 * Initialize context (get pointers to registers and stuff), then 2318 * Initialize context (get pointers to registers and stuff), then
2324 * allocate the memory for the descriptor tables. 2319 * allocate the memory for the descriptor tables.
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index f64a860029b7..61955f8d8011 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -953,9 +953,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
953 unsigned entry; 953 unsigned entry;
954 u32 tx_status; 954 u32 tx_status;
955 955
956 if (skb_padto(skb, ETH_ZLEN))
957 return NETDEV_TX_OK;
958
959 if (unlikely(skb->len > TX_BUF_SIZE)) { 956 if (unlikely(skb->len > TX_BUF_SIZE)) {
960 dev->stats.tx_dropped++; 957 dev->stats.tx_dropped++;
961 goto out; 958 goto out;
@@ -975,6 +972,11 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
975 skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); 972 skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE);
976 973
977 len = skb->len; 974 len = skb->len;
975 if (len < ETH_ZLEN) {
976 memset(priv->tx_bufs + entry * TX_BUF_SIZE + len,
977 0, ETH_ZLEN - len);
978 len = ETH_ZLEN;
979 }
978 980
979 wmb(); 981 wmb();
980 982
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 0f023447eafd..1d2daeec7ac1 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -1,5 +1,5 @@
1sfc-y += efx.o falcon.o tx.o rx.o falcon_xmac.o \ 1sfc-y += efx.o falcon.o tx.o rx.o falcon_xmac.o \
2 i2c-direct.o ethtool.o xfp_phy.o mdio_10g.o \ 2 i2c-direct.o selftest.o ethtool.o xfp_phy.o \
3 tenxpress.o boards.o sfe4001.o 3 mdio_10g.o tenxpress.o boards.o sfe4001.o
4 4
5obj-$(CONFIG_SFC) += sfc.o 5obj-$(CONFIG_SFC) += sfc.o
diff --git a/drivers/net/sfc/bitfield.h b/drivers/net/sfc/bitfield.h
index 2806201644cc..2c79d27404e0 100644
--- a/drivers/net/sfc/bitfield.h
+++ b/drivers/net/sfc/bitfield.h
@@ -483,7 +483,7 @@ typedef union efx_oword {
483#endif 483#endif
484 484
485#define EFX_SET_OWORD_FIELD_VER(efx, oword, field, value) do { \ 485#define EFX_SET_OWORD_FIELD_VER(efx, oword, field, value) do { \
486 if (FALCON_REV(efx) >= FALCON_REV_B0) { \ 486 if (falcon_rev(efx) >= FALCON_REV_B0) { \
487 EFX_SET_OWORD_FIELD((oword), field##_B0, (value)); \ 487 EFX_SET_OWORD_FIELD((oword), field##_B0, (value)); \
488 } else { \ 488 } else { \
489 EFX_SET_OWORD_FIELD((oword), field##_A1, (value)); \ 489 EFX_SET_OWORD_FIELD((oword), field##_A1, (value)); \
@@ -491,7 +491,7 @@ typedef union efx_oword {
491} while (0) 491} while (0)
492 492
493#define EFX_QWORD_FIELD_VER(efx, qword, field) \ 493#define EFX_QWORD_FIELD_VER(efx, qword, field) \
494 (FALCON_REV(efx) >= FALCON_REV_B0 ? \ 494 (falcon_rev(efx) >= FALCON_REV_B0 ? \
495 EFX_QWORD_FIELD((qword), field##_B0) : \ 495 EFX_QWORD_FIELD((qword), field##_B0) : \
496 EFX_QWORD_FIELD((qword), field##_A1)) 496 EFX_QWORD_FIELD((qword), field##_A1))
497 497
@@ -501,8 +501,5 @@ typedef union efx_oword {
501#define DMA_ADDR_T_WIDTH (8 * sizeof(dma_addr_t)) 501#define DMA_ADDR_T_WIDTH (8 * sizeof(dma_addr_t))
502#define EFX_DMA_TYPE_WIDTH(width) \ 502#define EFX_DMA_TYPE_WIDTH(width) \
503 (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH) 503 (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH)
504#define EFX_DMA_MAX_MASK ((DMA_ADDR_T_WIDTH == 64) ? \
505 ~((u64) 0) : ~((u32) 0))
506#define EFX_DMA_MASK(mask) ((mask) & EFX_DMA_MAX_MASK)
507 504
508#endif /* EFX_BITFIELD_H */ 505#endif /* EFX_BITFIELD_H */
diff --git a/drivers/net/sfc/boards.c b/drivers/net/sfc/boards.c
index eecaa6d58584..7fc0328dc055 100644
--- a/drivers/net/sfc/boards.c
+++ b/drivers/net/sfc/boards.c
@@ -27,10 +27,8 @@ static void blink_led_timer(unsigned long context)
27 struct efx_blinker *bl = &efx->board_info.blinker; 27 struct efx_blinker *bl = &efx->board_info.blinker;
28 efx->board_info.set_fault_led(efx, bl->state); 28 efx->board_info.set_fault_led(efx, bl->state);
29 bl->state = !bl->state; 29 bl->state = !bl->state;
30 if (bl->resubmit) { 30 if (bl->resubmit)
31 bl->timer.expires = jiffies + BLINK_INTERVAL; 31 mod_timer(&bl->timer, jiffies + BLINK_INTERVAL);
32 add_timer(&bl->timer);
33 }
34} 32}
35 33
36static void board_blink(struct efx_nic *efx, int blink) 34static void board_blink(struct efx_nic *efx, int blink)
@@ -44,8 +42,7 @@ static void board_blink(struct efx_nic *efx, int blink)
44 blinker->state = 0; 42 blinker->state = 0;
45 setup_timer(&blinker->timer, blink_led_timer, 43 setup_timer(&blinker->timer, blink_led_timer,
46 (unsigned long)efx); 44 (unsigned long)efx);
47 blinker->timer.expires = jiffies + BLINK_INTERVAL; 45 mod_timer(&blinker->timer, jiffies + BLINK_INTERVAL);
48 add_timer(&blinker->timer);
49 } else { 46 } else {
50 blinker->resubmit = 0; 47 blinker->resubmit = 0;
51 if (blinker->timer.function) 48 if (blinker->timer.function)
diff --git a/drivers/net/sfc/boards.h b/drivers/net/sfc/boards.h
index f56341d428e1..695764dc2e64 100644
--- a/drivers/net/sfc/boards.h
+++ b/drivers/net/sfc/boards.h
@@ -22,5 +22,7 @@ enum efx_board_type {
22extern int efx_set_board_info(struct efx_nic *efx, u16 revision_info); 22extern int efx_set_board_info(struct efx_nic *efx, u16 revision_info);
23extern int sfe4001_poweron(struct efx_nic *efx); 23extern int sfe4001_poweron(struct efx_nic *efx);
24extern void sfe4001_poweroff(struct efx_nic *efx); 24extern void sfe4001_poweroff(struct efx_nic *efx);
25/* Are we putting the PHY into flash config mode */
26extern unsigned int sfe4001_phy_flash_cfg;
25 27
26#endif 28#endif
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 59edcf793c19..449760642e31 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -199,11 +199,12 @@ static inline int efx_process_channel(struct efx_channel *channel, int rx_quota)
199 */ 199 */
200static inline void efx_channel_processed(struct efx_channel *channel) 200static inline void efx_channel_processed(struct efx_channel *channel)
201{ 201{
202 /* Write to EVQ_RPTR_REG. If a new event arrived in a race 202 /* The interrupt handler for this channel may set work_pending
203 * with finishing processing, a new interrupt will be raised. 203 * as soon as we acknowledge the events we've seen. Make sure
204 */ 204 * it's cleared before then. */
205 channel->work_pending = 0; 205 channel->work_pending = 0;
206 smp_wmb(); /* Ensure channel updated before any new interrupt. */ 206 smp_wmb();
207
207 falcon_eventq_read_ack(channel); 208 falcon_eventq_read_ack(channel);
208} 209}
209 210
@@ -265,7 +266,7 @@ void efx_process_channel_now(struct efx_channel *channel)
265 napi_disable(&channel->napi_str); 266 napi_disable(&channel->napi_str);
266 267
267 /* Poll the channel */ 268 /* Poll the channel */
268 (void) efx_process_channel(channel, efx->type->evq_size); 269 efx_process_channel(channel, efx->type->evq_size);
269 270
270 /* Ack the eventq. This may cause an interrupt to be generated 271 /* Ack the eventq. This may cause an interrupt to be generated
271 * when they are reenabled */ 272 * when they are reenabled */
@@ -317,26 +318,6 @@ static void efx_remove_eventq(struct efx_channel *channel)
317 * 318 *
318 *************************************************************************/ 319 *************************************************************************/
319 320
320/* Setup per-NIC RX buffer parameters.
321 * Calculate the rx buffer allocation parameters required to support
322 * the current MTU, including padding for header alignment and overruns.
323 */
324static void efx_calc_rx_buffer_params(struct efx_nic *efx)
325{
326 unsigned int order, len;
327
328 len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
329 EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
330 efx->type->rx_buffer_padding);
331
332 /* Calculate page-order */
333 for (order = 0; ((1u << order) * PAGE_SIZE) < len; ++order)
334 ;
335
336 efx->rx_buffer_len = len;
337 efx->rx_buffer_order = order;
338}
339
340static int efx_probe_channel(struct efx_channel *channel) 321static int efx_probe_channel(struct efx_channel *channel)
341{ 322{
342 struct efx_tx_queue *tx_queue; 323 struct efx_tx_queue *tx_queue;
@@ -387,7 +368,14 @@ static int efx_init_channels(struct efx_nic *efx)
387 struct efx_channel *channel; 368 struct efx_channel *channel;
388 int rc = 0; 369 int rc = 0;
389 370
390 efx_calc_rx_buffer_params(efx); 371 /* Calculate the rx buffer allocation parameters required to
372 * support the current MTU, including padding for header
373 * alignment and overruns.
374 */
375 efx->rx_buffer_len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
376 EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
377 efx->type->rx_buffer_padding);
378 efx->rx_buffer_order = get_order(efx->rx_buffer_len);
391 379
392 /* Initialise the channels */ 380 /* Initialise the channels */
393 efx_for_each_channel(channel, efx) { 381 efx_for_each_channel(channel, efx) {
@@ -440,9 +428,12 @@ static void efx_start_channel(struct efx_channel *channel)
440 netif_napi_add(channel->napi_dev, &channel->napi_str, 428 netif_napi_add(channel->napi_dev, &channel->napi_str,
441 efx_poll, napi_weight); 429 efx_poll, napi_weight);
442 430
431 /* The interrupt handler for this channel may set work_pending
432 * as soon as we enable it. Make sure it's cleared before
433 * then. Similarly, make sure it sees the enabled flag set. */
443 channel->work_pending = 0; 434 channel->work_pending = 0;
444 channel->enabled = 1; 435 channel->enabled = 1;
445 smp_wmb(); /* ensure channel updated before first interrupt */ 436 smp_wmb();
446 437
447 napi_enable(&channel->napi_str); 438 napi_enable(&channel->napi_str);
448 439
@@ -704,7 +695,7 @@ static void efx_stop_port(struct efx_nic *efx)
704 mutex_unlock(&efx->mac_lock); 695 mutex_unlock(&efx->mac_lock);
705 696
706 /* Serialise against efx_set_multicast_list() */ 697 /* Serialise against efx_set_multicast_list() */
707 if (NET_DEV_REGISTERED(efx)) { 698 if (efx_dev_registered(efx)) {
708 netif_tx_lock_bh(efx->net_dev); 699 netif_tx_lock_bh(efx->net_dev);
709 netif_tx_unlock_bh(efx->net_dev); 700 netif_tx_unlock_bh(efx->net_dev);
710 } 701 }
@@ -791,22 +782,23 @@ static int efx_init_io(struct efx_nic *efx)
791 efx->membase = ioremap_nocache(efx->membase_phys, 782 efx->membase = ioremap_nocache(efx->membase_phys,
792 efx->type->mem_map_size); 783 efx->type->mem_map_size);
793 if (!efx->membase) { 784 if (!efx->membase) {
794 EFX_ERR(efx, "could not map memory BAR %d at %lx+%x\n", 785 EFX_ERR(efx, "could not map memory BAR %d at %llx+%x\n",
795 efx->type->mem_bar, efx->membase_phys, 786 efx->type->mem_bar,
787 (unsigned long long)efx->membase_phys,
796 efx->type->mem_map_size); 788 efx->type->mem_map_size);
797 rc = -ENOMEM; 789 rc = -ENOMEM;
798 goto fail4; 790 goto fail4;
799 } 791 }
800 EFX_LOG(efx, "memory BAR %u at %lx+%x (virtual %p)\n", 792 EFX_LOG(efx, "memory BAR %u at %llx+%x (virtual %p)\n",
801 efx->type->mem_bar, efx->membase_phys, efx->type->mem_map_size, 793 efx->type->mem_bar, (unsigned long long)efx->membase_phys,
802 efx->membase); 794 efx->type->mem_map_size, efx->membase);
803 795
804 return 0; 796 return 0;
805 797
806 fail4: 798 fail4:
807 release_mem_region(efx->membase_phys, efx->type->mem_map_size); 799 release_mem_region(efx->membase_phys, efx->type->mem_map_size);
808 fail3: 800 fail3:
809 efx->membase_phys = 0UL; 801 efx->membase_phys = 0;
810 fail2: 802 fail2:
811 pci_disable_device(efx->pci_dev); 803 pci_disable_device(efx->pci_dev);
812 fail1: 804 fail1:
@@ -824,7 +816,7 @@ static void efx_fini_io(struct efx_nic *efx)
824 816
825 if (efx->membase_phys) { 817 if (efx->membase_phys) {
826 pci_release_region(efx->pci_dev, efx->type->mem_bar); 818 pci_release_region(efx->pci_dev, efx->type->mem_bar);
827 efx->membase_phys = 0UL; 819 efx->membase_phys = 0;
828 } 820 }
829 821
830 pci_disable_device(efx->pci_dev); 822 pci_disable_device(efx->pci_dev);
@@ -1043,7 +1035,7 @@ static void efx_start_all(struct efx_nic *efx)
1043 return; 1035 return;
1044 if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT)) 1036 if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT))
1045 return; 1037 return;
1046 if (NET_DEV_REGISTERED(efx) && !netif_running(efx->net_dev)) 1038 if (efx_dev_registered(efx) && !netif_running(efx->net_dev))
1047 return; 1039 return;
1048 1040
1049 /* Mark the port as enabled so port reconfigurations can start, then 1041 /* Mark the port as enabled so port reconfigurations can start, then
@@ -1073,9 +1065,8 @@ static void efx_flush_all(struct efx_nic *efx)
1073 cancel_delayed_work_sync(&efx->monitor_work); 1065 cancel_delayed_work_sync(&efx->monitor_work);
1074 1066
1075 /* Ensure that all RX slow refills are complete. */ 1067 /* Ensure that all RX slow refills are complete. */
1076 efx_for_each_rx_queue(rx_queue, efx) { 1068 efx_for_each_rx_queue(rx_queue, efx)
1077 cancel_delayed_work_sync(&rx_queue->work); 1069 cancel_delayed_work_sync(&rx_queue->work);
1078 }
1079 1070
1080 /* Stop scheduled port reconfigurations */ 1071 /* Stop scheduled port reconfigurations */
1081 cancel_work_sync(&efx->reconfigure_work); 1072 cancel_work_sync(&efx->reconfigure_work);
@@ -1101,9 +1092,10 @@ static void efx_stop_all(struct efx_nic *efx)
1101 falcon_disable_interrupts(efx); 1092 falcon_disable_interrupts(efx);
1102 if (efx->legacy_irq) 1093 if (efx->legacy_irq)
1103 synchronize_irq(efx->legacy_irq); 1094 synchronize_irq(efx->legacy_irq);
1104 efx_for_each_channel_with_interrupt(channel, efx) 1095 efx_for_each_channel_with_interrupt(channel, efx) {
1105 if (channel->irq) 1096 if (channel->irq)
1106 synchronize_irq(channel->irq); 1097 synchronize_irq(channel->irq);
1098 }
1107 1099
1108 /* Stop all NAPI processing and synchronous rx refills */ 1100 /* Stop all NAPI processing and synchronous rx refills */
1109 efx_for_each_channel(channel, efx) 1101 efx_for_each_channel(channel, efx)
@@ -1125,7 +1117,7 @@ static void efx_stop_all(struct efx_nic *efx)
1125 /* Stop the kernel transmit interface late, so the watchdog 1117 /* Stop the kernel transmit interface late, so the watchdog
1126 * timer isn't ticking over the flush */ 1118 * timer isn't ticking over the flush */
1127 efx_stop_queue(efx); 1119 efx_stop_queue(efx);
1128 if (NET_DEV_REGISTERED(efx)) { 1120 if (efx_dev_registered(efx)) {
1129 netif_tx_lock_bh(efx->net_dev); 1121 netif_tx_lock_bh(efx->net_dev);
1130 netif_tx_unlock_bh(efx->net_dev); 1122 netif_tx_unlock_bh(efx->net_dev);
1131 } 1123 }
@@ -1344,13 +1336,17 @@ static int efx_net_stop(struct net_device *net_dev)
1344 return 0; 1336 return 0;
1345} 1337}
1346 1338
1347/* Context: process, dev_base_lock held, non-blocking. */ 1339/* Context: process, dev_base_lock or RTNL held, non-blocking. */
1348static struct net_device_stats *efx_net_stats(struct net_device *net_dev) 1340static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
1349{ 1341{
1350 struct efx_nic *efx = net_dev->priv; 1342 struct efx_nic *efx = net_dev->priv;
1351 struct efx_mac_stats *mac_stats = &efx->mac_stats; 1343 struct efx_mac_stats *mac_stats = &efx->mac_stats;
1352 struct net_device_stats *stats = &net_dev->stats; 1344 struct net_device_stats *stats = &net_dev->stats;
1353 1345
1346 /* Update stats if possible, but do not wait if another thread
1347 * is updating them (or resetting the NIC); slightly stale
1348 * stats are acceptable.
1349 */
1354 if (!spin_trylock(&efx->stats_lock)) 1350 if (!spin_trylock(&efx->stats_lock))
1355 return stats; 1351 return stats;
1356 if (efx->state == STATE_RUNNING) { 1352 if (efx->state == STATE_RUNNING) {
@@ -1494,7 +1490,7 @@ static void efx_set_multicast_list(struct net_device *net_dev)
1494static int efx_netdev_event(struct notifier_block *this, 1490static int efx_netdev_event(struct notifier_block *this,
1495 unsigned long event, void *ptr) 1491 unsigned long event, void *ptr)
1496{ 1492{
1497 struct net_device *net_dev = (struct net_device *)ptr; 1493 struct net_device *net_dev = ptr;
1498 1494
1499 if (net_dev->open == efx_net_open && event == NETDEV_CHANGENAME) { 1495 if (net_dev->open == efx_net_open && event == NETDEV_CHANGENAME) {
1500 struct efx_nic *efx = net_dev->priv; 1496 struct efx_nic *efx = net_dev->priv;
@@ -1563,7 +1559,7 @@ static void efx_unregister_netdev(struct efx_nic *efx)
1563 efx_for_each_tx_queue(tx_queue, efx) 1559 efx_for_each_tx_queue(tx_queue, efx)
1564 efx_release_tx_buffers(tx_queue); 1560 efx_release_tx_buffers(tx_queue);
1565 1561
1566 if (NET_DEV_REGISTERED(efx)) { 1562 if (efx_dev_registered(efx)) {
1567 strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name)); 1563 strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name));
1568 unregister_netdev(efx->net_dev); 1564 unregister_netdev(efx->net_dev);
1569 } 1565 }
@@ -1688,7 +1684,7 @@ static int efx_reset(struct efx_nic *efx)
1688 if (method == RESET_TYPE_DISABLE) { 1684 if (method == RESET_TYPE_DISABLE) {
1689 /* Reinitialise the device anyway so the driver unload sequence 1685 /* Reinitialise the device anyway so the driver unload sequence
1690 * can talk to the external SRAM */ 1686 * can talk to the external SRAM */
1691 (void) falcon_init_nic(efx); 1687 falcon_init_nic(efx);
1692 rc = -EIO; 1688 rc = -EIO;
1693 goto fail4; 1689 goto fail4;
1694 } 1690 }
@@ -1873,6 +1869,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
1873 tx_queue->queue = i; 1869 tx_queue->queue = i;
1874 tx_queue->buffer = NULL; 1870 tx_queue->buffer = NULL;
1875 tx_queue->channel = &efx->channel[0]; /* for safety */ 1871 tx_queue->channel = &efx->channel[0]; /* for safety */
1872 tx_queue->tso_headers_free = NULL;
1876 } 1873 }
1877 for (i = 0; i < EFX_MAX_RX_QUEUES; i++) { 1874 for (i = 0; i < EFX_MAX_RX_QUEUES; i++) {
1878 rx_queue = &efx->rx_queue[i]; 1875 rx_queue = &efx->rx_queue[i];
@@ -2071,7 +2068,8 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2071 net_dev = alloc_etherdev(sizeof(*efx)); 2068 net_dev = alloc_etherdev(sizeof(*efx));
2072 if (!net_dev) 2069 if (!net_dev)
2073 return -ENOMEM; 2070 return -ENOMEM;
2074 net_dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA; 2071 net_dev->features |= (NETIF_F_IP_CSUM | NETIF_F_SG |
2072 NETIF_F_HIGHDMA | NETIF_F_TSO);
2075 if (lro) 2073 if (lro)
2076 net_dev->features |= NETIF_F_LRO; 2074 net_dev->features |= NETIF_F_LRO;
2077 efx = net_dev->priv; 2075 efx = net_dev->priv;
diff --git a/drivers/net/sfc/enum.h b/drivers/net/sfc/enum.h
index 43663a4619da..c53290d08e2b 100644
--- a/drivers/net/sfc/enum.h
+++ b/drivers/net/sfc/enum.h
@@ -10,6 +10,55 @@
10#ifndef EFX_ENUM_H 10#ifndef EFX_ENUM_H
11#define EFX_ENUM_H 11#define EFX_ENUM_H
12 12
13/**
14 * enum efx_loopback_mode - loopback modes
15 * @LOOPBACK_NONE: no loopback
16 * @LOOPBACK_XGMII: loopback within MAC at XGMII level
17 * @LOOPBACK_XGXS: loopback within MAC at XGXS level
18 * @LOOPBACK_XAUI: loopback within MAC at XAUI level
19 * @LOOPBACK_PHYXS: loopback within PHY at PHYXS level
20 * @LOOPBACK_PCS: loopback within PHY at PCS level
21 * @LOOPBACK_PMAPMD: loopback within PHY at PMAPMD level
22 * @LOOPBACK_NETWORK: reflecting loopback (even further than furthest!)
23 */
24/* Please keep in order and up-to-date w.r.t the following two #defines */
25enum efx_loopback_mode {
26 LOOPBACK_NONE = 0,
27 LOOPBACK_MAC = 1,
28 LOOPBACK_XGMII = 2,
29 LOOPBACK_XGXS = 3,
30 LOOPBACK_XAUI = 4,
31 LOOPBACK_PHY = 5,
32 LOOPBACK_PHYXS = 6,
33 LOOPBACK_PCS = 7,
34 LOOPBACK_PMAPMD = 8,
35 LOOPBACK_NETWORK = 9,
36 LOOPBACK_MAX
37};
38
39#define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD
40
41extern const char *efx_loopback_mode_names[];
42#define LOOPBACK_MODE_NAME(mode) \
43 STRING_TABLE_LOOKUP(mode, efx_loopback_mode)
44#define LOOPBACK_MODE(efx) \
45 LOOPBACK_MODE_NAME(efx->loopback_mode)
46
47/* These loopbacks occur within the controller */
48#define LOOPBACKS_10G_INTERNAL ((1 << LOOPBACK_XGMII)| \
49 (1 << LOOPBACK_XGXS) | \
50 (1 << LOOPBACK_XAUI))
51
52#define LOOPBACK_MASK(_efx) \
53 (1 << (_efx)->loopback_mode)
54
55#define LOOPBACK_INTERNAL(_efx) \
56 ((LOOPBACKS_10G_INTERNAL & LOOPBACK_MASK(_efx)) ? 1 : 0)
57
58#define LOOPBACK_OUT_OF(_from, _to, _mask) \
59 (((LOOPBACK_MASK(_from) & (_mask)) && \
60 ((LOOPBACK_MASK(_to) & (_mask)) == 0)) ? 1 : 0)
61
13/*****************************************************************************/ 62/*****************************************************************************/
14 63
15/** 64/**
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index ad541badbd98..e2c75d101610 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -12,12 +12,26 @@
12#include <linux/ethtool.h> 12#include <linux/ethtool.h>
13#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
14#include "net_driver.h" 14#include "net_driver.h"
15#include "selftest.h"
15#include "efx.h" 16#include "efx.h"
16#include "ethtool.h" 17#include "ethtool.h"
17#include "falcon.h" 18#include "falcon.h"
18#include "gmii.h" 19#include "gmii.h"
19#include "mac.h" 20#include "mac.h"
20 21
22const char *efx_loopback_mode_names[] = {
23 [LOOPBACK_NONE] = "NONE",
24 [LOOPBACK_MAC] = "MAC",
25 [LOOPBACK_XGMII] = "XGMII",
26 [LOOPBACK_XGXS] = "XGXS",
27 [LOOPBACK_XAUI] = "XAUI",
28 [LOOPBACK_PHY] = "PHY",
29 [LOOPBACK_PHYXS] = "PHY(XS)",
30 [LOOPBACK_PCS] = "PHY(PCS)",
31 [LOOPBACK_PMAPMD] = "PHY(PMAPMD)",
32 [LOOPBACK_NETWORK] = "NETWORK",
33};
34
21static int efx_ethtool_set_tx_csum(struct net_device *net_dev, u32 enable); 35static int efx_ethtool_set_tx_csum(struct net_device *net_dev, u32 enable);
22 36
23struct ethtool_string { 37struct ethtool_string {
@@ -217,23 +231,179 @@ static void efx_ethtool_get_drvinfo(struct net_device *net_dev,
217 strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); 231 strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info));
218} 232}
219 233
234/**
235 * efx_fill_test - fill in an individual self-test entry
236 * @test_index: Index of the test
237 * @strings: Ethtool strings, or %NULL
238 * @data: Ethtool test results, or %NULL
239 * @test: Pointer to test result (used only if data != %NULL)
240 * @unit_format: Unit name format (e.g. "channel\%d")
241 * @unit_id: Unit id (e.g. 0 for "channel0")
242 * @test_format: Test name format (e.g. "loopback.\%s.tx.sent")
243 * @test_id: Test id (e.g. "PHY" for "loopback.PHY.tx_sent")
244 *
245 * Fill in an individual self-test entry.
246 */
247static void efx_fill_test(unsigned int test_index,
248 struct ethtool_string *strings, u64 *data,
249 int *test, const char *unit_format, int unit_id,
250 const char *test_format, const char *test_id)
251{
252 struct ethtool_string unit_str, test_str;
253
254 /* Fill data value, if applicable */
255 if (data)
256 data[test_index] = *test;
257
258 /* Fill string, if applicable */
259 if (strings) {
260 snprintf(unit_str.name, sizeof(unit_str.name),
261 unit_format, unit_id);
262 snprintf(test_str.name, sizeof(test_str.name),
263 test_format, test_id);
264 snprintf(strings[test_index].name,
265 sizeof(strings[test_index].name),
266 "%-9s%-17s", unit_str.name, test_str.name);
267 }
268}
269
270#define EFX_PORT_NAME "port%d", 0
271#define EFX_CHANNEL_NAME(_channel) "channel%d", _channel->channel
272#define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->queue
273#define EFX_RX_QUEUE_NAME(_rx_queue) "rxq%d", _rx_queue->queue
274#define EFX_LOOPBACK_NAME(_mode, _counter) \
275 "loopback.%s." _counter, LOOPBACK_MODE_NAME(mode)
276
277/**
278 * efx_fill_loopback_test - fill in a block of loopback self-test entries
279 * @efx: Efx NIC
280 * @lb_tests: Efx loopback self-test results structure
281 * @mode: Loopback test mode
282 * @test_index: Starting index of the test
283 * @strings: Ethtool strings, or %NULL
284 * @data: Ethtool test results, or %NULL
285 */
286static int efx_fill_loopback_test(struct efx_nic *efx,
287 struct efx_loopback_self_tests *lb_tests,
288 enum efx_loopback_mode mode,
289 unsigned int test_index,
290 struct ethtool_string *strings, u64 *data)
291{
292 struct efx_tx_queue *tx_queue;
293
294 efx_for_each_tx_queue(tx_queue, efx) {
295 efx_fill_test(test_index++, strings, data,
296 &lb_tests->tx_sent[tx_queue->queue],
297 EFX_TX_QUEUE_NAME(tx_queue),
298 EFX_LOOPBACK_NAME(mode, "tx_sent"));
299 efx_fill_test(test_index++, strings, data,
300 &lb_tests->tx_done[tx_queue->queue],
301 EFX_TX_QUEUE_NAME(tx_queue),
302 EFX_LOOPBACK_NAME(mode, "tx_done"));
303 }
304 efx_fill_test(test_index++, strings, data,
305 &lb_tests->rx_good,
306 EFX_PORT_NAME,
307 EFX_LOOPBACK_NAME(mode, "rx_good"));
308 efx_fill_test(test_index++, strings, data,
309 &lb_tests->rx_bad,
310 EFX_PORT_NAME,
311 EFX_LOOPBACK_NAME(mode, "rx_bad"));
312
313 return test_index;
314}
315
316/**
317 * efx_ethtool_fill_self_tests - get self-test details
318 * @efx: Efx NIC
319 * @tests: Efx self-test results structure, or %NULL
320 * @strings: Ethtool strings, or %NULL
321 * @data: Ethtool test results, or %NULL
322 */
323static int efx_ethtool_fill_self_tests(struct efx_nic *efx,
324 struct efx_self_tests *tests,
325 struct ethtool_string *strings,
326 u64 *data)
327{
328 struct efx_channel *channel;
329 unsigned int n = 0;
330 enum efx_loopback_mode mode;
331
332 /* Interrupt */
333 efx_fill_test(n++, strings, data, &tests->interrupt,
334 "core", 0, "interrupt", NULL);
335
336 /* Event queues */
337 efx_for_each_channel(channel, efx) {
338 efx_fill_test(n++, strings, data,
339 &tests->eventq_dma[channel->channel],
340 EFX_CHANNEL_NAME(channel),
341 "eventq.dma", NULL);
342 efx_fill_test(n++, strings, data,
343 &tests->eventq_int[channel->channel],
344 EFX_CHANNEL_NAME(channel),
345 "eventq.int", NULL);
346 efx_fill_test(n++, strings, data,
347 &tests->eventq_poll[channel->channel],
348 EFX_CHANNEL_NAME(channel),
349 "eventq.poll", NULL);
350 }
351
352 /* PHY presence */
353 efx_fill_test(n++, strings, data, &tests->phy_ok,
354 EFX_PORT_NAME, "phy_ok", NULL);
355
356 /* Loopback tests */
357 efx_fill_test(n++, strings, data, &tests->loopback_speed,
358 EFX_PORT_NAME, "loopback.speed", NULL);
359 efx_fill_test(n++, strings, data, &tests->loopback_full_duplex,
360 EFX_PORT_NAME, "loopback.full_duplex", NULL);
361 for (mode = LOOPBACK_NONE; mode < LOOPBACK_TEST_MAX; mode++) {
362 if (!(efx->loopback_modes & (1 << mode)))
363 continue;
364 n = efx_fill_loopback_test(efx,
365 &tests->loopback[mode], mode, n,
366 strings, data);
367 }
368
369 return n;
370}
371
220static int efx_ethtool_get_stats_count(struct net_device *net_dev) 372static int efx_ethtool_get_stats_count(struct net_device *net_dev)
221{ 373{
222 return EFX_ETHTOOL_NUM_STATS; 374 return EFX_ETHTOOL_NUM_STATS;
223} 375}
224 376
377static int efx_ethtool_self_test_count(struct net_device *net_dev)
378{
379 struct efx_nic *efx = net_dev->priv;
380
381 return efx_ethtool_fill_self_tests(efx, NULL, NULL, NULL);
382}
383
225static void efx_ethtool_get_strings(struct net_device *net_dev, 384static void efx_ethtool_get_strings(struct net_device *net_dev,
226 u32 string_set, u8 *strings) 385 u32 string_set, u8 *strings)
227{ 386{
387 struct efx_nic *efx = net_dev->priv;
228 struct ethtool_string *ethtool_strings = 388 struct ethtool_string *ethtool_strings =
229 (struct ethtool_string *)strings; 389 (struct ethtool_string *)strings;
230 int i; 390 int i;
231 391
232 if (string_set == ETH_SS_STATS) 392 switch (string_set) {
393 case ETH_SS_STATS:
233 for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) 394 for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++)
234 strncpy(ethtool_strings[i].name, 395 strncpy(ethtool_strings[i].name,
235 efx_ethtool_stats[i].name, 396 efx_ethtool_stats[i].name,
236 sizeof(ethtool_strings[i].name)); 397 sizeof(ethtool_strings[i].name));
398 break;
399 case ETH_SS_TEST:
400 efx_ethtool_fill_self_tests(efx, NULL,
401 ethtool_strings, NULL);
402 break;
403 default:
404 /* No other string sets */
405 break;
406 }
237} 407}
238 408
239static void efx_ethtool_get_stats(struct net_device *net_dev, 409static void efx_ethtool_get_stats(struct net_device *net_dev,
@@ -272,6 +442,22 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
272 } 442 }
273} 443}
274 444
445static int efx_ethtool_set_tso(struct net_device *net_dev, u32 enable)
446{
447 int rc;
448
449 /* Our TSO requires TX checksumming, so force TX checksumming
450 * on when TSO is enabled.
451 */
452 if (enable) {
453 rc = efx_ethtool_set_tx_csum(net_dev, 1);
454 if (rc)
455 return rc;
456 }
457
458 return ethtool_op_set_tso(net_dev, enable);
459}
460
275static int efx_ethtool_set_tx_csum(struct net_device *net_dev, u32 enable) 461static int efx_ethtool_set_tx_csum(struct net_device *net_dev, u32 enable)
276{ 462{
277 struct efx_nic *efx = net_dev->priv; 463 struct efx_nic *efx = net_dev->priv;
@@ -283,6 +469,15 @@ static int efx_ethtool_set_tx_csum(struct net_device *net_dev, u32 enable)
283 469
284 efx_flush_queues(efx); 470 efx_flush_queues(efx);
285 471
472 /* Our TSO requires TX checksumming, so disable TSO when
473 * checksumming is disabled
474 */
475 if (!enable) {
476 rc = efx_ethtool_set_tso(net_dev, 0);
477 if (rc)
478 return rc;
479 }
480
286 return 0; 481 return 0;
287} 482}
288 483
@@ -305,6 +500,64 @@ static u32 efx_ethtool_get_rx_csum(struct net_device *net_dev)
305 return efx->rx_checksum_enabled; 500 return efx->rx_checksum_enabled;
306} 501}
307 502
503static void efx_ethtool_self_test(struct net_device *net_dev,
504 struct ethtool_test *test, u64 *data)
505{
506 struct efx_nic *efx = net_dev->priv;
507 struct efx_self_tests efx_tests;
508 int offline, already_up;
509 int rc;
510
511 ASSERT_RTNL();
512 if (efx->state != STATE_RUNNING) {
513 rc = -EIO;
514 goto fail1;
515 }
516
517 /* We need rx buffers and interrupts. */
518 already_up = (efx->net_dev->flags & IFF_UP);
519 if (!already_up) {
520 rc = dev_open(efx->net_dev);
521 if (rc) {
522 EFX_ERR(efx, "failed opening device.\n");
523 goto fail2;
524 }
525 }
526
527 memset(&efx_tests, 0, sizeof(efx_tests));
528 offline = (test->flags & ETH_TEST_FL_OFFLINE);
529
530 /* Perform online self tests first */
531 rc = efx_online_test(efx, &efx_tests);
532 if (rc)
533 goto out;
534
535 /* Perform offline tests only if online tests passed */
536 if (offline) {
537 /* Stop the kernel from sending packets during the test. */
538 efx_stop_queue(efx);
539 rc = efx_flush_queues(efx);
540 if (!rc)
541 rc = efx_offline_test(efx, &efx_tests,
542 efx->loopback_modes);
543 efx_wake_queue(efx);
544 }
545
546 out:
547 if (!already_up)
548 dev_close(efx->net_dev);
549
550 EFX_LOG(efx, "%s all %sline self-tests\n",
551 rc == 0 ? "passed" : "failed", offline ? "off" : "on");
552
553 fail2:
554 fail1:
555 /* Fill ethtool results structures */
556 efx_ethtool_fill_self_tests(efx, &efx_tests, NULL, data);
557 if (rc)
558 test->flags |= ETH_TEST_FL_FAILED;
559}
560
308/* Restart autonegotiation */ 561/* Restart autonegotiation */
309static int efx_ethtool_nway_reset(struct net_device *net_dev) 562static int efx_ethtool_nway_reset(struct net_device *net_dev)
310{ 563{
@@ -451,8 +704,12 @@ struct ethtool_ops efx_ethtool_ops = {
451 .set_tx_csum = efx_ethtool_set_tx_csum, 704 .set_tx_csum = efx_ethtool_set_tx_csum,
452 .get_sg = ethtool_op_get_sg, 705 .get_sg = ethtool_op_get_sg,
453 .set_sg = ethtool_op_set_sg, 706 .set_sg = ethtool_op_set_sg,
707 .get_tso = ethtool_op_get_tso,
708 .set_tso = efx_ethtool_set_tso,
454 .get_flags = ethtool_op_get_flags, 709 .get_flags = ethtool_op_get_flags,
455 .set_flags = ethtool_op_set_flags, 710 .set_flags = ethtool_op_set_flags,
711 .self_test_count = efx_ethtool_self_test_count,
712 .self_test = efx_ethtool_self_test,
456 .get_strings = efx_ethtool_get_strings, 713 .get_strings = efx_ethtool_get_strings,
457 .phys_id = efx_ethtool_phys_id, 714 .phys_id = efx_ethtool_phys_id,
458 .get_stats_count = efx_ethtool_get_stats_count, 715 .get_stats_count = efx_ethtool_get_stats_count,
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 46db549ce580..790db89db345 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -116,17 +116,8 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold");
116 ************************************************************************** 116 **************************************************************************
117 */ 117 */
118 118
119/* DMA address mask (up to 46-bit, avoiding compiler warnings) 119/* DMA address mask */
120 * 120#define FALCON_DMA_MASK DMA_BIT_MASK(46)
121 * Note that it is possible to have a platform with 64-bit longs and
122 * 32-bit DMA addresses, or vice versa. EFX_DMA_MASK takes care of the
123 * platform DMA mask.
124 */
125#if BITS_PER_LONG == 64
126#define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffUL)
127#else
128#define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffULL)
129#endif
130 121
131/* TX DMA length mask (13-bit) */ 122/* TX DMA length mask (13-bit) */
132#define FALCON_TX_DMA_MASK (4096 - 1) 123#define FALCON_TX_DMA_MASK (4096 - 1)
@@ -145,7 +136,7 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold");
145#define PCI_EXP_LNKSTA_LNK_WID_LBN 4 136#define PCI_EXP_LNKSTA_LNK_WID_LBN 4
146 137
147#define FALCON_IS_DUAL_FUNC(efx) \ 138#define FALCON_IS_DUAL_FUNC(efx) \
148 (FALCON_REV(efx) < FALCON_REV_B0) 139 (falcon_rev(efx) < FALCON_REV_B0)
149 140
150/************************************************************************** 141/**************************************************************************
151 * 142 *
@@ -465,7 +456,7 @@ int falcon_init_tx(struct efx_tx_queue *tx_queue)
465 TX_DESCQ_TYPE, 0, 456 TX_DESCQ_TYPE, 0,
466 TX_NON_IP_DROP_DIS_B0, 1); 457 TX_NON_IP_DROP_DIS_B0, 1);
467 458
468 if (FALCON_REV(efx) >= FALCON_REV_B0) { 459 if (falcon_rev(efx) >= FALCON_REV_B0) {
469 int csum = !(efx->net_dev->features & NETIF_F_IP_CSUM); 460 int csum = !(efx->net_dev->features & NETIF_F_IP_CSUM);
470 EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_IP_CHKSM_DIS_B0, csum); 461 EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_IP_CHKSM_DIS_B0, csum);
471 EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_TCP_CHKSM_DIS_B0, csum); 462 EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_TCP_CHKSM_DIS_B0, csum);
@@ -474,7 +465,7 @@ int falcon_init_tx(struct efx_tx_queue *tx_queue)
474 falcon_write_table(efx, &tx_desc_ptr, efx->type->txd_ptr_tbl_base, 465 falcon_write_table(efx, &tx_desc_ptr, efx->type->txd_ptr_tbl_base,
475 tx_queue->queue); 466 tx_queue->queue);
476 467
477 if (FALCON_REV(efx) < FALCON_REV_B0) { 468 if (falcon_rev(efx) < FALCON_REV_B0) {
478 efx_oword_t reg; 469 efx_oword_t reg;
479 470
480 BUG_ON(tx_queue->queue >= 128); /* HW limit */ 471 BUG_ON(tx_queue->queue >= 128); /* HW limit */
@@ -635,7 +626,7 @@ int falcon_init_rx(struct efx_rx_queue *rx_queue)
635 efx_oword_t rx_desc_ptr; 626 efx_oword_t rx_desc_ptr;
636 struct efx_nic *efx = rx_queue->efx; 627 struct efx_nic *efx = rx_queue->efx;
637 int rc; 628 int rc;
638 int is_b0 = FALCON_REV(efx) >= FALCON_REV_B0; 629 int is_b0 = falcon_rev(efx) >= FALCON_REV_B0;
639 int iscsi_digest_en = is_b0; 630 int iscsi_digest_en = is_b0;
640 631
641 EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n", 632 EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n",
@@ -742,8 +733,10 @@ void falcon_fini_rx(struct efx_rx_queue *rx_queue)
742 continue; 733 continue;
743 break; 734 break;
744 } 735 }
745 if (rc) 736 if (rc) {
746 EFX_ERR(efx, "failed to flush rx queue %d\n", rx_queue->queue); 737 EFX_ERR(efx, "failed to flush rx queue %d\n", rx_queue->queue);
738 efx_schedule_reset(efx, RESET_TYPE_INVISIBLE);
739 }
747 740
748 /* Remove RX descriptor ring from card */ 741 /* Remove RX descriptor ring from card */
749 EFX_ZERO_OWORD(rx_desc_ptr); 742 EFX_ZERO_OWORD(rx_desc_ptr);
@@ -822,10 +815,10 @@ static inline void falcon_handle_tx_event(struct efx_channel *channel,
822 tx_ev_q_label = EFX_QWORD_FIELD(*event, TX_EV_Q_LABEL); 815 tx_ev_q_label = EFX_QWORD_FIELD(*event, TX_EV_Q_LABEL);
823 tx_queue = &efx->tx_queue[tx_ev_q_label]; 816 tx_queue = &efx->tx_queue[tx_ev_q_label];
824 817
825 if (NET_DEV_REGISTERED(efx)) 818 if (efx_dev_registered(efx))
826 netif_tx_lock(efx->net_dev); 819 netif_tx_lock(efx->net_dev);
827 falcon_notify_tx_desc(tx_queue); 820 falcon_notify_tx_desc(tx_queue);
828 if (NET_DEV_REGISTERED(efx)) 821 if (efx_dev_registered(efx))
829 netif_tx_unlock(efx->net_dev); 822 netif_tx_unlock(efx->net_dev);
830 } else if (EFX_QWORD_FIELD(*event, TX_EV_PKT_ERR) && 823 } else if (EFX_QWORD_FIELD(*event, TX_EV_PKT_ERR) &&
831 EFX_WORKAROUND_10727(efx)) { 824 EFX_WORKAROUND_10727(efx)) {
@@ -884,7 +877,7 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
884 RX_EV_TCP_UDP_CHKSUM_ERR); 877 RX_EV_TCP_UDP_CHKSUM_ERR);
885 rx_ev_eth_crc_err = EFX_QWORD_FIELD(*event, RX_EV_ETH_CRC_ERR); 878 rx_ev_eth_crc_err = EFX_QWORD_FIELD(*event, RX_EV_ETH_CRC_ERR);
886 rx_ev_frm_trunc = EFX_QWORD_FIELD(*event, RX_EV_FRM_TRUNC); 879 rx_ev_frm_trunc = EFX_QWORD_FIELD(*event, RX_EV_FRM_TRUNC);
887 rx_ev_drib_nib = ((FALCON_REV(efx) >= FALCON_REV_B0) ? 880 rx_ev_drib_nib = ((falcon_rev(efx) >= FALCON_REV_B0) ?
888 0 : EFX_QWORD_FIELD(*event, RX_EV_DRIB_NIB)); 881 0 : EFX_QWORD_FIELD(*event, RX_EV_DRIB_NIB));
889 rx_ev_pause_frm = EFX_QWORD_FIELD(*event, RX_EV_PAUSE_FRM_ERR); 882 rx_ev_pause_frm = EFX_QWORD_FIELD(*event, RX_EV_PAUSE_FRM_ERR);
890 883
@@ -1065,7 +1058,7 @@ static void falcon_handle_global_event(struct efx_channel *channel,
1065 EFX_QWORD_FIELD(*event, XG_PHY_INTR)) 1058 EFX_QWORD_FIELD(*event, XG_PHY_INTR))
1066 is_phy_event = 1; 1059 is_phy_event = 1;
1067 1060
1068 if ((FALCON_REV(efx) >= FALCON_REV_B0) && 1061 if ((falcon_rev(efx) >= FALCON_REV_B0) &&
1069 EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0)) 1062 EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0))
1070 is_phy_event = 1; 1063 is_phy_event = 1;
1071 1064
@@ -1129,6 +1122,7 @@ static void falcon_handle_driver_event(struct efx_channel *channel,
1129 case RX_RECOVERY_EV_DECODE: 1122 case RX_RECOVERY_EV_DECODE:
1130 EFX_ERR(efx, "channel %d seen DRIVER RX_RESET event. " 1123 EFX_ERR(efx, "channel %d seen DRIVER RX_RESET event. "
1131 "Resetting.\n", channel->channel); 1124 "Resetting.\n", channel->channel);
1125 atomic_inc(&efx->rx_reset);
1132 efx_schedule_reset(efx, 1126 efx_schedule_reset(efx,
1133 EFX_WORKAROUND_6555(efx) ? 1127 EFX_WORKAROUND_6555(efx) ?
1134 RESET_TYPE_RX_RECOVERY : 1128 RESET_TYPE_RX_RECOVERY :
@@ -1404,7 +1398,7 @@ static inline void falcon_irq_ack_a1(struct efx_nic *efx)
1404static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx) 1398static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx)
1405{ 1399{
1406 struct falcon_nic_data *nic_data = efx->nic_data; 1400 struct falcon_nic_data *nic_data = efx->nic_data;
1407 efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; 1401 efx_oword_t *int_ker = efx->irq_status.addr;
1408 efx_oword_t fatal_intr; 1402 efx_oword_t fatal_intr;
1409 int error, mem_perr; 1403 int error, mem_perr;
1410 static int n_int_errors; 1404 static int n_int_errors;
@@ -1450,8 +1444,8 @@ out:
1450 */ 1444 */
1451static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) 1445static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id)
1452{ 1446{
1453 struct efx_nic *efx = (struct efx_nic *)dev_id; 1447 struct efx_nic *efx = dev_id;
1454 efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; 1448 efx_oword_t *int_ker = efx->irq_status.addr;
1455 struct efx_channel *channel; 1449 struct efx_channel *channel;
1456 efx_dword_t reg; 1450 efx_dword_t reg;
1457 u32 queues; 1451 u32 queues;
@@ -1488,8 +1482,8 @@ static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id)
1488 1482
1489static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) 1483static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id)
1490{ 1484{
1491 struct efx_nic *efx = (struct efx_nic *)dev_id; 1485 struct efx_nic *efx = dev_id;
1492 efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; 1486 efx_oword_t *int_ker = efx->irq_status.addr;
1493 struct efx_channel *channel; 1487 struct efx_channel *channel;
1494 int syserr; 1488 int syserr;
1495 int queues; 1489 int queues;
@@ -1541,9 +1535,9 @@ static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id)
1541 */ 1535 */
1542static irqreturn_t falcon_msi_interrupt(int irq, void *dev_id) 1536static irqreturn_t falcon_msi_interrupt(int irq, void *dev_id)
1543{ 1537{
1544 struct efx_channel *channel = (struct efx_channel *)dev_id; 1538 struct efx_channel *channel = dev_id;
1545 struct efx_nic *efx = channel->efx; 1539 struct efx_nic *efx = channel->efx;
1546 efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; 1540 efx_oword_t *int_ker = efx->irq_status.addr;
1547 int syserr; 1541 int syserr;
1548 1542
1549 efx->last_irq_cpu = raw_smp_processor_id(); 1543 efx->last_irq_cpu = raw_smp_processor_id();
@@ -1571,7 +1565,7 @@ static void falcon_setup_rss_indir_table(struct efx_nic *efx)
1571 unsigned long offset; 1565 unsigned long offset;
1572 efx_dword_t dword; 1566 efx_dword_t dword;
1573 1567
1574 if (FALCON_REV(efx) < FALCON_REV_B0) 1568 if (falcon_rev(efx) < FALCON_REV_B0)
1575 return; 1569 return;
1576 1570
1577 for (offset = RX_RSS_INDIR_TBL_B0; 1571 for (offset = RX_RSS_INDIR_TBL_B0;
@@ -1594,7 +1588,7 @@ int falcon_init_interrupt(struct efx_nic *efx)
1594 1588
1595 if (!EFX_INT_MODE_USE_MSI(efx)) { 1589 if (!EFX_INT_MODE_USE_MSI(efx)) {
1596 irq_handler_t handler; 1590 irq_handler_t handler;
1597 if (FALCON_REV(efx) >= FALCON_REV_B0) 1591 if (falcon_rev(efx) >= FALCON_REV_B0)
1598 handler = falcon_legacy_interrupt_b0; 1592 handler = falcon_legacy_interrupt_b0;
1599 else 1593 else
1600 handler = falcon_legacy_interrupt_a1; 1594 handler = falcon_legacy_interrupt_a1;
@@ -1635,12 +1629,13 @@ void falcon_fini_interrupt(struct efx_nic *efx)
1635 efx_oword_t reg; 1629 efx_oword_t reg;
1636 1630
1637 /* Disable MSI/MSI-X interrupts */ 1631 /* Disable MSI/MSI-X interrupts */
1638 efx_for_each_channel_with_interrupt(channel, efx) 1632 efx_for_each_channel_with_interrupt(channel, efx) {
1639 if (channel->irq) 1633 if (channel->irq)
1640 free_irq(channel->irq, channel); 1634 free_irq(channel->irq, channel);
1635 }
1641 1636
1642 /* ACK legacy interrupt */ 1637 /* ACK legacy interrupt */
1643 if (FALCON_REV(efx) >= FALCON_REV_B0) 1638 if (falcon_rev(efx) >= FALCON_REV_B0)
1644 falcon_read(efx, &reg, INT_ISR0_B0); 1639 falcon_read(efx, &reg, INT_ISR0_B0);
1645 else 1640 else
1646 falcon_irq_ack_a1(efx); 1641 falcon_irq_ack_a1(efx);
@@ -1731,7 +1726,8 @@ void falcon_drain_tx_fifo(struct efx_nic *efx)
1731 efx_oword_t temp; 1726 efx_oword_t temp;
1732 int count; 1727 int count;
1733 1728
1734 if (FALCON_REV(efx) < FALCON_REV_B0) 1729 if ((falcon_rev(efx) < FALCON_REV_B0) ||
1730 (efx->loopback_mode != LOOPBACK_NONE))
1735 return; 1731 return;
1736 1732
1737 falcon_read(efx, &temp, MAC0_CTRL_REG_KER); 1733 falcon_read(efx, &temp, MAC0_CTRL_REG_KER);
@@ -1783,7 +1779,7 @@ void falcon_deconfigure_mac_wrapper(struct efx_nic *efx)
1783{ 1779{
1784 efx_oword_t temp; 1780 efx_oword_t temp;
1785 1781
1786 if (FALCON_REV(efx) < FALCON_REV_B0) 1782 if (falcon_rev(efx) < FALCON_REV_B0)
1787 return; 1783 return;
1788 1784
1789 /* Isolate the MAC -> RX */ 1785 /* Isolate the MAC -> RX */
@@ -1821,7 +1817,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
1821 MAC_SPEED, link_speed); 1817 MAC_SPEED, link_speed);
1822 /* On B0, MAC backpressure can be disabled and packets get 1818 /* On B0, MAC backpressure can be disabled and packets get
1823 * discarded. */ 1819 * discarded. */
1824 if (FALCON_REV(efx) >= FALCON_REV_B0) { 1820 if (falcon_rev(efx) >= FALCON_REV_B0) {
1825 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1821 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0,
1826 !efx->link_up); 1822 !efx->link_up);
1827 } 1823 }
@@ -1839,7 +1835,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
1839 EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc); 1835 EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc);
1840 1836
1841 /* Unisolate the MAC -> RX */ 1837 /* Unisolate the MAC -> RX */
1842 if (FALCON_REV(efx) >= FALCON_REV_B0) 1838 if (falcon_rev(efx) >= FALCON_REV_B0)
1843 EFX_SET_OWORD_FIELD(reg, RX_INGR_EN_B0, 1); 1839 EFX_SET_OWORD_FIELD(reg, RX_INGR_EN_B0, 1);
1844 falcon_write(efx, &reg, RX_CFG_REG_KER); 1840 falcon_write(efx, &reg, RX_CFG_REG_KER);
1845} 1841}
@@ -1854,7 +1850,7 @@ int falcon_dma_stats(struct efx_nic *efx, unsigned int done_offset)
1854 return 0; 1850 return 0;
1855 1851
1856 /* Statistics fetch will fail if the MAC is in TX drain */ 1852 /* Statistics fetch will fail if the MAC is in TX drain */
1857 if (FALCON_REV(efx) >= FALCON_REV_B0) { 1853 if (falcon_rev(efx) >= FALCON_REV_B0) {
1858 efx_oword_t temp; 1854 efx_oword_t temp;
1859 falcon_read(efx, &temp, MAC0_CTRL_REG_KER); 1855 falcon_read(efx, &temp, MAC0_CTRL_REG_KER);
1860 if (EFX_OWORD_FIELD(temp, TXFIFO_DRAIN_EN_B0)) 1856 if (EFX_OWORD_FIELD(temp, TXFIFO_DRAIN_EN_B0))
@@ -1938,7 +1934,7 @@ static int falcon_gmii_wait(struct efx_nic *efx)
1938static void falcon_mdio_write(struct net_device *net_dev, int phy_id, 1934static void falcon_mdio_write(struct net_device *net_dev, int phy_id,
1939 int addr, int value) 1935 int addr, int value)
1940{ 1936{
1941 struct efx_nic *efx = (struct efx_nic *)net_dev->priv; 1937 struct efx_nic *efx = net_dev->priv;
1942 unsigned int phy_id2 = phy_id & FALCON_PHY_ID_ID_MASK; 1938 unsigned int phy_id2 = phy_id & FALCON_PHY_ID_ID_MASK;
1943 efx_oword_t reg; 1939 efx_oword_t reg;
1944 1940
@@ -2006,7 +2002,7 @@ static void falcon_mdio_write(struct net_device *net_dev, int phy_id,
2006 * could be read, -1 will be returned. */ 2002 * could be read, -1 will be returned. */
2007static int falcon_mdio_read(struct net_device *net_dev, int phy_id, int addr) 2003static int falcon_mdio_read(struct net_device *net_dev, int phy_id, int addr)
2008{ 2004{
2009 struct efx_nic *efx = (struct efx_nic *)net_dev->priv; 2005 struct efx_nic *efx = net_dev->priv;
2010 unsigned int phy_addr = phy_id & FALCON_PHY_ID_ID_MASK; 2006 unsigned int phy_addr = phy_id & FALCON_PHY_ID_ID_MASK;
2011 efx_oword_t reg; 2007 efx_oword_t reg;
2012 int value = -1; 2008 int value = -1;
@@ -2091,6 +2087,8 @@ static int falcon_probe_phy(struct efx_nic *efx)
2091 efx->phy_type); 2087 efx->phy_type);
2092 return -1; 2088 return -1;
2093 } 2089 }
2090
2091 efx->loopback_modes = LOOPBACKS_10G_INTERNAL | efx->phy_op->loopbacks;
2094 return 0; 2092 return 0;
2095} 2093}
2096 2094
@@ -2109,7 +2107,7 @@ int falcon_probe_port(struct efx_nic *efx)
2109 falcon_init_mdio(&efx->mii); 2107 falcon_init_mdio(&efx->mii);
2110 2108
2111 /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */ 2109 /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */
2112 if (FALCON_REV(efx) >= FALCON_REV_B0) 2110 if (falcon_rev(efx) >= FALCON_REV_B0)
2113 efx->flow_control = EFX_FC_RX | EFX_FC_TX; 2111 efx->flow_control = EFX_FC_RX | EFX_FC_TX;
2114 else 2112 else
2115 efx->flow_control = EFX_FC_RX; 2113 efx->flow_control = EFX_FC_RX;
@@ -2369,7 +2367,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx)
2369 return -ENODEV; 2367 return -ENODEV;
2370 } 2368 }
2371 2369
2372 switch (FALCON_REV(efx)) { 2370 switch (falcon_rev(efx)) {
2373 case FALCON_REV_A0: 2371 case FALCON_REV_A0:
2374 case 0xff: 2372 case 0xff:
2375 EFX_ERR(efx, "Falcon rev A0 not supported\n"); 2373 EFX_ERR(efx, "Falcon rev A0 not supported\n");
@@ -2395,7 +2393,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx)
2395 break; 2393 break;
2396 2394
2397 default: 2395 default:
2398 EFX_ERR(efx, "Unknown Falcon rev %d\n", FALCON_REV(efx)); 2396 EFX_ERR(efx, "Unknown Falcon rev %d\n", falcon_rev(efx));
2399 return -ENODEV; 2397 return -ENODEV;
2400 } 2398 }
2401 2399
@@ -2415,7 +2413,7 @@ int falcon_probe_nic(struct efx_nic *efx)
2415 2413
2416 /* Allocate storage for hardware specific data */ 2414 /* Allocate storage for hardware specific data */
2417 nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); 2415 nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL);
2418 efx->nic_data = (void *) nic_data; 2416 efx->nic_data = nic_data;
2419 2417
2420 /* Determine number of ports etc. */ 2418 /* Determine number of ports etc. */
2421 rc = falcon_probe_nic_variant(efx); 2419 rc = falcon_probe_nic_variant(efx);
@@ -2468,14 +2466,12 @@ int falcon_probe_nic(struct efx_nic *efx)
2468 fail5: 2466 fail5:
2469 falcon_free_buffer(efx, &efx->irq_status); 2467 falcon_free_buffer(efx, &efx->irq_status);
2470 fail4: 2468 fail4:
2471 /* fall-thru */
2472 fail3: 2469 fail3:
2473 if (nic_data->pci_dev2) { 2470 if (nic_data->pci_dev2) {
2474 pci_dev_put(nic_data->pci_dev2); 2471 pci_dev_put(nic_data->pci_dev2);
2475 nic_data->pci_dev2 = NULL; 2472 nic_data->pci_dev2 = NULL;
2476 } 2473 }
2477 fail2: 2474 fail2:
2478 /* fall-thru */
2479 fail1: 2475 fail1:
2480 kfree(efx->nic_data); 2476 kfree(efx->nic_data);
2481 return rc; 2477 return rc;
@@ -2487,13 +2483,10 @@ int falcon_probe_nic(struct efx_nic *efx)
2487 */ 2483 */
2488int falcon_init_nic(struct efx_nic *efx) 2484int falcon_init_nic(struct efx_nic *efx)
2489{ 2485{
2490 struct falcon_nic_data *data;
2491 efx_oword_t temp; 2486 efx_oword_t temp;
2492 unsigned thresh; 2487 unsigned thresh;
2493 int rc; 2488 int rc;
2494 2489
2495 data = (struct falcon_nic_data *)efx->nic_data;
2496
2497 /* Set up the address region register. This is only needed 2490 /* Set up the address region register. This is only needed
2498 * for the B0 FPGA, but since we are just pushing in the 2491 * for the B0 FPGA, but since we are just pushing in the
2499 * reset defaults this may as well be unconditional. */ 2492 * reset defaults this may as well be unconditional. */
@@ -2560,7 +2553,7 @@ int falcon_init_nic(struct efx_nic *efx)
2560 2553
2561 /* Set number of RSS queues for receive path. */ 2554 /* Set number of RSS queues for receive path. */
2562 falcon_read(efx, &temp, RX_FILTER_CTL_REG); 2555 falcon_read(efx, &temp, RX_FILTER_CTL_REG);
2563 if (FALCON_REV(efx) >= FALCON_REV_B0) 2556 if (falcon_rev(efx) >= FALCON_REV_B0)
2564 EFX_SET_OWORD_FIELD(temp, NUM_KER, 0); 2557 EFX_SET_OWORD_FIELD(temp, NUM_KER, 0);
2565 else 2558 else
2566 EFX_SET_OWORD_FIELD(temp, NUM_KER, efx->rss_queues - 1); 2559 EFX_SET_OWORD_FIELD(temp, NUM_KER, efx->rss_queues - 1);
@@ -2598,7 +2591,7 @@ int falcon_init_nic(struct efx_nic *efx)
2598 /* Prefetch threshold 2 => fetch when descriptor cache half empty */ 2591 /* Prefetch threshold 2 => fetch when descriptor cache half empty */
2599 EFX_SET_OWORD_FIELD(temp, TX_PREF_THRESHOLD, 2); 2592 EFX_SET_OWORD_FIELD(temp, TX_PREF_THRESHOLD, 2);
2600 /* Squash TX of packets of 16 bytes or less */ 2593 /* Squash TX of packets of 16 bytes or less */
2601 if (FALCON_REV(efx) >= FALCON_REV_B0 && EFX_WORKAROUND_9141(efx)) 2594 if (falcon_rev(efx) >= FALCON_REV_B0 && EFX_WORKAROUND_9141(efx))
2602 EFX_SET_OWORD_FIELD(temp, TX_FLUSH_MIN_LEN_EN_B0, 1); 2595 EFX_SET_OWORD_FIELD(temp, TX_FLUSH_MIN_LEN_EN_B0, 1);
2603 falcon_write(efx, &temp, TX_CFG2_REG_KER); 2596 falcon_write(efx, &temp, TX_CFG2_REG_KER);
2604 2597
@@ -2615,7 +2608,7 @@ int falcon_init_nic(struct efx_nic *efx)
2615 if (EFX_WORKAROUND_7575(efx)) 2608 if (EFX_WORKAROUND_7575(efx))
2616 EFX_SET_OWORD_FIELD_VER(efx, temp, RX_USR_BUF_SIZE, 2609 EFX_SET_OWORD_FIELD_VER(efx, temp, RX_USR_BUF_SIZE,
2617 (3 * 4096) / 32); 2610 (3 * 4096) / 32);
2618 if (FALCON_REV(efx) >= FALCON_REV_B0) 2611 if (falcon_rev(efx) >= FALCON_REV_B0)
2619 EFX_SET_OWORD_FIELD(temp, RX_INGR_EN_B0, 1); 2612 EFX_SET_OWORD_FIELD(temp, RX_INGR_EN_B0, 1);
2620 2613
2621 /* RX FIFO flow control thresholds */ 2614 /* RX FIFO flow control thresholds */
@@ -2631,7 +2624,7 @@ int falcon_init_nic(struct efx_nic *efx)
2631 falcon_write(efx, &temp, RX_CFG_REG_KER); 2624 falcon_write(efx, &temp, RX_CFG_REG_KER);
2632 2625
2633 /* Set destination of both TX and RX Flush events */ 2626 /* Set destination of both TX and RX Flush events */
2634 if (FALCON_REV(efx) >= FALCON_REV_B0) { 2627 if (falcon_rev(efx) >= FALCON_REV_B0) {
2635 EFX_POPULATE_OWORD_1(temp, FLS_EVQ_ID, 0); 2628 EFX_POPULATE_OWORD_1(temp, FLS_EVQ_ID, 0);
2636 falcon_write(efx, &temp, DP_CTRL_REG); 2629 falcon_write(efx, &temp, DP_CTRL_REG);
2637 } 2630 }
@@ -2645,7 +2638,7 @@ void falcon_remove_nic(struct efx_nic *efx)
2645 2638
2646 falcon_free_buffer(efx, &efx->irq_status); 2639 falcon_free_buffer(efx, &efx->irq_status);
2647 2640
2648 (void) falcon_reset_hw(efx, RESET_TYPE_ALL); 2641 falcon_reset_hw(efx, RESET_TYPE_ALL);
2649 2642
2650 /* Release the second function after the reset */ 2643 /* Release the second function after the reset */
2651 if (nic_data->pci_dev2) { 2644 if (nic_data->pci_dev2) {
diff --git a/drivers/net/sfc/falcon.h b/drivers/net/sfc/falcon.h
index 6117403b0c03..492f9bc28840 100644
--- a/drivers/net/sfc/falcon.h
+++ b/drivers/net/sfc/falcon.h
@@ -23,7 +23,10 @@ enum falcon_revision {
23 FALCON_REV_B0 = 2, 23 FALCON_REV_B0 = 2,
24}; 24};
25 25
26#define FALCON_REV(efx) ((efx)->pci_dev->revision) 26static inline int falcon_rev(struct efx_nic *efx)
27{
28 return efx->pci_dev->revision;
29}
27 30
28extern struct efx_nic_type falcon_a_nic_type; 31extern struct efx_nic_type falcon_a_nic_type;
29extern struct efx_nic_type falcon_b_nic_type; 32extern struct efx_nic_type falcon_b_nic_type;
diff --git a/drivers/net/sfc/falcon_hwdefs.h b/drivers/net/sfc/falcon_hwdefs.h
index 0485a63eaff6..6d003114eeab 100644
--- a/drivers/net/sfc/falcon_hwdefs.h
+++ b/drivers/net/sfc/falcon_hwdefs.h
@@ -636,6 +636,14 @@
636#define XX_HIDRVA_WIDTH 1 636#define XX_HIDRVA_WIDTH 1
637#define XX_LODRVA_LBN 8 637#define XX_LODRVA_LBN 8
638#define XX_LODRVA_WIDTH 1 638#define XX_LODRVA_WIDTH 1
639#define XX_LPBKD_LBN 3
640#define XX_LPBKD_WIDTH 1
641#define XX_LPBKC_LBN 2
642#define XX_LPBKC_WIDTH 1
643#define XX_LPBKB_LBN 1
644#define XX_LPBKB_WIDTH 1
645#define XX_LPBKA_LBN 0
646#define XX_LPBKA_WIDTH 1
639 647
640#define XX_TXDRV_CTL_REG_MAC 0x12 648#define XX_TXDRV_CTL_REG_MAC 0x12
641#define XX_DEQD_LBN 28 649#define XX_DEQD_LBN 28
@@ -656,8 +664,14 @@
656#define XX_DTXA_WIDTH 4 664#define XX_DTXA_WIDTH 4
657 665
658/* XAUI XGXS core status register */ 666/* XAUI XGXS core status register */
659#define XX_FORCE_SIG_DECODE_FORCED 0xff
660#define XX_CORE_STAT_REG_MAC 0x16 667#define XX_CORE_STAT_REG_MAC 0x16
668#define XX_FORCE_SIG_LBN 24
669#define XX_FORCE_SIG_WIDTH 8
670#define XX_FORCE_SIG_DECODE_FORCED 0xff
671#define XX_XGXS_LB_EN_LBN 23
672#define XX_XGXS_LB_EN_WIDTH 1
673#define XX_XGMII_LB_EN_LBN 22
674#define XX_XGMII_LB_EN_WIDTH 1
661#define XX_ALIGN_DONE_LBN 20 675#define XX_ALIGN_DONE_LBN 20
662#define XX_ALIGN_DONE_WIDTH 1 676#define XX_ALIGN_DONE_WIDTH 1
663#define XX_SYNC_STAT_LBN 16 677#define XX_SYNC_STAT_LBN 16
@@ -1111,7 +1125,7 @@ struct falcon_nvconfig_board_v2 {
1111 u8 port1_phy_type; 1125 u8 port1_phy_type;
1112 __le16 asic_sub_revision; 1126 __le16 asic_sub_revision;
1113 __le16 board_revision; 1127 __le16 board_revision;
1114} __attribute__ ((packed)); 1128} __packed;
1115 1129
1116#define NVCONFIG_BASE 0x300 1130#define NVCONFIG_BASE 0x300
1117#define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C 1131#define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C
@@ -1130,6 +1144,6 @@ struct falcon_nvconfig {
1130 __le16 board_struct_ver; 1144 __le16 board_struct_ver;
1131 __le16 board_checksum; 1145 __le16 board_checksum;
1132 struct falcon_nvconfig_board_v2 board_v2; 1146 struct falcon_nvconfig_board_v2 board_v2;
1133} __attribute__ ((packed)); 1147} __packed;
1134 1148
1135#endif /* EFX_FALCON_HWDEFS_H */ 1149#endif /* EFX_FALCON_HWDEFS_H */
diff --git a/drivers/net/sfc/falcon_io.h b/drivers/net/sfc/falcon_io.h
index ea08184ddfa9..6670cdfc41ab 100644
--- a/drivers/net/sfc/falcon_io.h
+++ b/drivers/net/sfc/falcon_io.h
@@ -56,14 +56,27 @@
56#define FALCON_USE_QWORD_IO 1 56#define FALCON_USE_QWORD_IO 1
57#endif 57#endif
58 58
59#define _falcon_writeq(efx, value, reg) \ 59#ifdef FALCON_USE_QWORD_IO
60 __raw_writeq((__force u64) (value), (efx)->membase + (reg)) 60static inline void _falcon_writeq(struct efx_nic *efx, __le64 value,
61#define _falcon_writel(efx, value, reg) \ 61 unsigned int reg)
62 __raw_writel((__force u32) (value), (efx)->membase + (reg)) 62{
63#define _falcon_readq(efx, reg) \ 63 __raw_writeq((__force u64)value, efx->membase + reg);
64 ((__force __le64) __raw_readq((efx)->membase + (reg))) 64}
65#define _falcon_readl(efx, reg) \ 65static inline __le64 _falcon_readq(struct efx_nic *efx, unsigned int reg)
66 ((__force __le32) __raw_readl((efx)->membase + (reg))) 66{
67 return (__force __le64)__raw_readq(efx->membase + reg);
68}
69#endif
70
71static inline void _falcon_writel(struct efx_nic *efx, __le32 value,
72 unsigned int reg)
73{
74 __raw_writel((__force u32)value, efx->membase + reg);
75}
76static inline __le32 _falcon_readl(struct efx_nic *efx, unsigned int reg)
77{
78 return (__force __le32)__raw_readl(efx->membase + reg);
79}
67 80
68/* Writes to a normal 16-byte Falcon register, locking as appropriate. */ 81/* Writes to a normal 16-byte Falcon register, locking as appropriate. */
69static inline void falcon_write(struct efx_nic *efx, efx_oword_t *value, 82static inline void falcon_write(struct efx_nic *efx, efx_oword_t *value,
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index aa7521b24a5d..55c0d9760be8 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -32,7 +32,7 @@
32 (FALCON_XMAC_REGBANK + ((mac_reg) * FALCON_XMAC_REG_SIZE)) 32 (FALCON_XMAC_REGBANK + ((mac_reg) * FALCON_XMAC_REG_SIZE))
33 33
34void falcon_xmac_writel(struct efx_nic *efx, 34void falcon_xmac_writel(struct efx_nic *efx,
35 efx_dword_t *value, unsigned int mac_reg) 35 efx_dword_t *value, unsigned int mac_reg)
36{ 36{
37 efx_oword_t temp; 37 efx_oword_t temp;
38 38
@@ -69,6 +69,10 @@ static int falcon_reset_xmac(struct efx_nic *efx)
69 udelay(10); 69 udelay(10);
70 } 70 }
71 71
72 /* This often fails when DSP is disabled, ignore it */
73 if (sfe4001_phy_flash_cfg != 0)
74 return 0;
75
72 EFX_ERR(efx, "timed out waiting for XMAC core reset\n"); 76 EFX_ERR(efx, "timed out waiting for XMAC core reset\n");
73 return -ETIMEDOUT; 77 return -ETIMEDOUT;
74} 78}
@@ -217,13 +221,13 @@ static int falcon_xgmii_status(struct efx_nic *efx)
217{ 221{
218 efx_dword_t reg; 222 efx_dword_t reg;
219 223
220 if (FALCON_REV(efx) < FALCON_REV_B0) 224 if (falcon_rev(efx) < FALCON_REV_B0)
221 return 1; 225 return 1;
222 226
223 /* The ISR latches, so clear it and re-read */ 227 /* The ISR latches, so clear it and re-read */
224 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0); 228 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0);
225 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0); 229 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0);
226 230
227 if (EFX_DWORD_FIELD(reg, XM_LCLFLT) || 231 if (EFX_DWORD_FIELD(reg, XM_LCLFLT) ||
228 EFX_DWORD_FIELD(reg, XM_RMTFLT)) { 232 EFX_DWORD_FIELD(reg, XM_RMTFLT)) {
229 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg)); 233 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg));
@@ -237,7 +241,7 @@ static void falcon_mask_status_intr(struct efx_nic *efx, int enable)
237{ 241{
238 efx_dword_t reg; 242 efx_dword_t reg;
239 243
240 if (FALCON_REV(efx) < FALCON_REV_B0) 244 if ((falcon_rev(efx) < FALCON_REV_B0) || LOOPBACK_INTERNAL(efx))
241 return; 245 return;
242 246
243 /* Flush the ISR */ 247 /* Flush the ISR */
@@ -284,6 +288,9 @@ int falcon_xaui_link_ok(struct efx_nic *efx)
284 efx_dword_t reg; 288 efx_dword_t reg;
285 int align_done, sync_status, link_ok = 0; 289 int align_done, sync_status, link_ok = 0;
286 290
291 if (LOOPBACK_INTERNAL(efx))
292 return 1;
293
287 /* Read link status */ 294 /* Read link status */
288 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC); 295 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC);
289 296
@@ -374,6 +381,61 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
374 falcon_xmac_writel(efx, &reg, XM_ADR_HI_REG_MAC); 381 falcon_xmac_writel(efx, &reg, XM_ADR_HI_REG_MAC);
375} 382}
376 383
384static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
385{
386 efx_dword_t reg;
387 int xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS) ? 1 : 0;
388 int xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI) ? 1 : 0;
389 int xgmii_loopback =
390 (efx->loopback_mode == LOOPBACK_XGMII) ? 1 : 0;
391
392 /* XGXS block is flaky and will need to be reset if moving
393 * into our out of XGMII, XGXS or XAUI loopbacks. */
394 if (EFX_WORKAROUND_5147(efx)) {
395 int old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback;
396 int reset_xgxs;
397
398 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC);
399 old_xgxs_loopback = EFX_DWORD_FIELD(reg, XX_XGXS_LB_EN);
400 old_xgmii_loopback = EFX_DWORD_FIELD(reg, XX_XGMII_LB_EN);
401
402 falcon_xmac_readl(efx, &reg, XX_SD_CTL_REG_MAC);
403 old_xaui_loopback = EFX_DWORD_FIELD(reg, XX_LPBKA);
404
405 /* The PHY driver may have turned XAUI off */
406 reset_xgxs = ((xgxs_loopback != old_xgxs_loopback) ||
407 (xaui_loopback != old_xaui_loopback) ||
408 (xgmii_loopback != old_xgmii_loopback));
409 if (reset_xgxs) {
410 falcon_xmac_readl(efx, &reg, XX_PWR_RST_REG_MAC);
411 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1);
412 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1);
413 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC);
414 udelay(1);
415 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 0);
416 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 0);
417 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC);
418 udelay(1);
419 }
420 }
421
422 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC);
423 EFX_SET_DWORD_FIELD(reg, XX_FORCE_SIG,
424 (xgxs_loopback || xaui_loopback) ?
425 XX_FORCE_SIG_DECODE_FORCED : 0);
426 EFX_SET_DWORD_FIELD(reg, XX_XGXS_LB_EN, xgxs_loopback);
427 EFX_SET_DWORD_FIELD(reg, XX_XGMII_LB_EN, xgmii_loopback);
428 falcon_xmac_writel(efx, &reg, XX_CORE_STAT_REG_MAC);
429
430 falcon_xmac_readl(efx, &reg, XX_SD_CTL_REG_MAC);
431 EFX_SET_DWORD_FIELD(reg, XX_LPBKD, xaui_loopback);
432 EFX_SET_DWORD_FIELD(reg, XX_LPBKC, xaui_loopback);
433 EFX_SET_DWORD_FIELD(reg, XX_LPBKB, xaui_loopback);
434 EFX_SET_DWORD_FIELD(reg, XX_LPBKA, xaui_loopback);
435 falcon_xmac_writel(efx, &reg, XX_SD_CTL_REG_MAC);
436}
437
438
377/* Try and bring the Falcon side of the Falcon-Phy XAUI link fails 439/* Try and bring the Falcon side of the Falcon-Phy XAUI link fails
378 * to come back up. Bash it until it comes back up */ 440 * to come back up. Bash it until it comes back up */
379static int falcon_check_xaui_link_up(struct efx_nic *efx) 441static int falcon_check_xaui_link_up(struct efx_nic *efx)
@@ -382,7 +444,8 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx)
382 tries = EFX_WORKAROUND_5147(efx) ? 5 : 1; 444 tries = EFX_WORKAROUND_5147(efx) ? 5 : 1;
383 max_tries = tries; 445 max_tries = tries;
384 446
385 if (efx->phy_type == PHY_TYPE_NONE) 447 if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
448 (efx->phy_type == PHY_TYPE_NONE))
386 return 0; 449 return 0;
387 450
388 while (tries) { 451 while (tries) {
@@ -391,12 +454,12 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx)
391 454
392 EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n", 455 EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n",
393 __func__, tries); 456 __func__, tries);
394 (void) falcon_reset_xaui(efx); 457 falcon_reset_xaui(efx);
395 udelay(200); 458 udelay(200);
396 tries--; 459 tries--;
397 } 460 }
398 461
399 EFX_ERR(efx, "Failed to bring XAUI link back up in %d tries!\n", 462 EFX_LOG(efx, "Failed to bring XAUI link back up in %d tries!\n",
400 max_tries); 463 max_tries);
401 return 0; 464 return 0;
402} 465}
@@ -408,8 +471,13 @@ void falcon_reconfigure_xmac(struct efx_nic *efx)
408 falcon_mask_status_intr(efx, 0); 471 falcon_mask_status_intr(efx, 0);
409 472
410 falcon_deconfigure_mac_wrapper(efx); 473 falcon_deconfigure_mac_wrapper(efx);
474
475 efx->tx_disabled = LOOPBACK_INTERNAL(efx);
411 efx->phy_op->reconfigure(efx); 476 efx->phy_op->reconfigure(efx);
477
478 falcon_reconfigure_xgxs_core(efx);
412 falcon_reconfigure_xmac_core(efx); 479 falcon_reconfigure_xmac_core(efx);
480
413 falcon_reconfigure_mac_wrapper(efx); 481 falcon_reconfigure_mac_wrapper(efx);
414 482
415 /* Ensure XAUI link is up */ 483 /* Ensure XAUI link is up */
@@ -491,18 +559,20 @@ void falcon_update_stats_xmac(struct efx_nic *efx)
491 (mac_stats->rx_bytes - mac_stats->rx_good_bytes); 559 (mac_stats->rx_bytes - mac_stats->rx_good_bytes);
492} 560}
493 561
494#define EFX_XAUI_RETRAIN_MAX 8
495
496int falcon_check_xmac(struct efx_nic *efx) 562int falcon_check_xmac(struct efx_nic *efx)
497{ 563{
498 unsigned xaui_link_ok; 564 unsigned xaui_link_ok;
499 int rc; 565 int rc;
500 566
567 if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
568 (efx->phy_type == PHY_TYPE_NONE))
569 return 0;
570
501 falcon_mask_status_intr(efx, 0); 571 falcon_mask_status_intr(efx, 0);
502 xaui_link_ok = falcon_xaui_link_ok(efx); 572 xaui_link_ok = falcon_xaui_link_ok(efx);
503 573
504 if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok) 574 if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok)
505 (void) falcon_reset_xaui(efx); 575 falcon_reset_xaui(efx);
506 576
507 /* Call the PHY check_hw routine */ 577 /* Call the PHY check_hw routine */
508 rc = efx->phy_op->check_hw(efx); 578 rc = efx->phy_op->check_hw(efx);
@@ -569,7 +639,7 @@ int falcon_xmac_set_pause(struct efx_nic *efx, enum efx_fc_type flow_control)
569 reset = ((flow_control & EFX_FC_TX) && 639 reset = ((flow_control & EFX_FC_TX) &&
570 !(efx->flow_control & EFX_FC_TX)); 640 !(efx->flow_control & EFX_FC_TX));
571 if (EFX_WORKAROUND_11482(efx) && reset) { 641 if (EFX_WORKAROUND_11482(efx) && reset) {
572 if (FALCON_REV(efx) >= FALCON_REV_B0) { 642 if (falcon_rev(efx) >= FALCON_REV_B0) {
573 /* Recover by resetting the EM block */ 643 /* Recover by resetting the EM block */
574 if (efx->link_up) 644 if (efx->link_up)
575 falcon_drain_tx_fifo(efx); 645 falcon_drain_tx_fifo(efx);
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index dc06bb0aa575..c4f540e93b79 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -44,6 +44,9 @@ static int mdio_clause45_check_mmd(struct efx_nic *efx, int mmd,
44 int status; 44 int status;
45 int phy_id = efx->mii.phy_id; 45 int phy_id = efx->mii.phy_id;
46 46
47 if (LOOPBACK_INTERNAL(efx))
48 return 0;
49
47 /* Read MMD STATUS2 to check it is responding. */ 50 /* Read MMD STATUS2 to check it is responding. */
48 status = mdio_clause45_read(efx, phy_id, mmd, MDIO_MMDREG_STAT2); 51 status = mdio_clause45_read(efx, phy_id, mmd, MDIO_MMDREG_STAT2);
49 if (((status >> MDIO_MMDREG_STAT2_PRESENT_LBN) & 52 if (((status >> MDIO_MMDREG_STAT2_PRESENT_LBN) &
@@ -164,6 +167,22 @@ int mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
164 int mmd = 0; 167 int mmd = 0;
165 int good; 168 int good;
166 169
170 /* If the port is in loopback, then we should only consider a subset
171 * of mmd's */
172 if (LOOPBACK_INTERNAL(efx))
173 return 1;
174 else if (efx->loopback_mode == LOOPBACK_NETWORK)
175 return 0;
176 else if (efx->loopback_mode == LOOPBACK_PHYXS)
177 mmd_mask &= ~(MDIO_MMDREG_DEVS0_PHYXS |
178 MDIO_MMDREG_DEVS0_PCS |
179 MDIO_MMDREG_DEVS0_PMAPMD);
180 else if (efx->loopback_mode == LOOPBACK_PCS)
181 mmd_mask &= ~(MDIO_MMDREG_DEVS0_PCS |
182 MDIO_MMDREG_DEVS0_PMAPMD);
183 else if (efx->loopback_mode == LOOPBACK_PMAPMD)
184 mmd_mask &= ~MDIO_MMDREG_DEVS0_PMAPMD;
185
167 while (mmd_mask) { 186 while (mmd_mask) {
168 if (mmd_mask & 1) { 187 if (mmd_mask & 1) {
169 /* Double reads because link state is latched, and a 188 /* Double reads because link state is latched, and a
@@ -182,6 +201,65 @@ int mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
182 return ok; 201 return ok;
183} 202}
184 203
204void mdio_clause45_transmit_disable(struct efx_nic *efx)
205{
206 int phy_id = efx->mii.phy_id;
207 int ctrl1, ctrl2;
208
209 ctrl1 = ctrl2 = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
210 MDIO_MMDREG_TXDIS);
211 if (efx->tx_disabled)
212 ctrl2 |= (1 << MDIO_MMDREG_TXDIS_GLOBAL_LBN);
213 else
214 ctrl1 &= ~(1 << MDIO_MMDREG_TXDIS_GLOBAL_LBN);
215 if (ctrl1 != ctrl2)
216 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
217 MDIO_MMDREG_TXDIS, ctrl2);
218}
219
220void mdio_clause45_phy_reconfigure(struct efx_nic *efx)
221{
222 int phy_id = efx->mii.phy_id;
223 int ctrl1, ctrl2;
224
225 /* Handle (with debouncing) PMA/PMD loopback */
226 ctrl1 = ctrl2 = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
227 MDIO_MMDREG_CTRL1);
228
229 if (efx->loopback_mode == LOOPBACK_PMAPMD)
230 ctrl2 |= (1 << MDIO_PMAPMD_CTRL1_LBACK_LBN);
231 else
232 ctrl2 &= ~(1 << MDIO_PMAPMD_CTRL1_LBACK_LBN);
233
234 if (ctrl1 != ctrl2)
235 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
236 MDIO_MMDREG_CTRL1, ctrl2);
237
238 /* Handle (with debouncing) PCS loopback */
239 ctrl1 = ctrl2 = mdio_clause45_read(efx, phy_id, MDIO_MMD_PCS,
240 MDIO_MMDREG_CTRL1);
241 if (efx->loopback_mode == LOOPBACK_PCS)
242 ctrl2 |= (1 << MDIO_MMDREG_CTRL1_LBACK_LBN);
243 else
244 ctrl2 &= ~(1 << MDIO_MMDREG_CTRL1_LBACK_LBN);
245
246 if (ctrl1 != ctrl2)
247 mdio_clause45_write(efx, phy_id, MDIO_MMD_PCS,
248 MDIO_MMDREG_CTRL1, ctrl2);
249
250 /* Handle (with debouncing) PHYXS network loopback */
251 ctrl1 = ctrl2 = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS,
252 MDIO_MMDREG_CTRL1);
253 if (efx->loopback_mode == LOOPBACK_NETWORK)
254 ctrl2 |= (1 << MDIO_MMDREG_CTRL1_LBACK_LBN);
255 else
256 ctrl2 &= ~(1 << MDIO_MMDREG_CTRL1_LBACK_LBN);
257
258 if (ctrl1 != ctrl2)
259 mdio_clause45_write(efx, phy_id, MDIO_MMD_PHYXS,
260 MDIO_MMDREG_CTRL1, ctrl2);
261}
262
185/** 263/**
186 * mdio_clause45_get_settings - Read (some of) the PHY settings over MDIO. 264 * mdio_clause45_get_settings - Read (some of) the PHY settings over MDIO.
187 * @efx: Efx NIC 265 * @efx: Efx NIC
diff --git a/drivers/net/sfc/mdio_10g.h b/drivers/net/sfc/mdio_10g.h
index 2214b6d820a7..cb99f3f4491c 100644
--- a/drivers/net/sfc/mdio_10g.h
+++ b/drivers/net/sfc/mdio_10g.h
@@ -44,11 +44,16 @@
44#define MDIO_MMDREG_DEVS1 (6) 44#define MDIO_MMDREG_DEVS1 (6)
45#define MDIO_MMDREG_CTRL2 (7) 45#define MDIO_MMDREG_CTRL2 (7)
46#define MDIO_MMDREG_STAT2 (8) 46#define MDIO_MMDREG_STAT2 (8)
47#define MDIO_MMDREG_TXDIS (9)
47 48
48/* Bits in MMDREG_CTRL1 */ 49/* Bits in MMDREG_CTRL1 */
49/* Reset */ 50/* Reset */
50#define MDIO_MMDREG_CTRL1_RESET_LBN (15) 51#define MDIO_MMDREG_CTRL1_RESET_LBN (15)
51#define MDIO_MMDREG_CTRL1_RESET_WIDTH (1) 52#define MDIO_MMDREG_CTRL1_RESET_WIDTH (1)
53/* Loopback */
54/* Loopback bit for WIS, PCS, PHYSX and DTEXS */
55#define MDIO_MMDREG_CTRL1_LBACK_LBN (14)
56#define MDIO_MMDREG_CTRL1_LBACK_WIDTH (1)
52 57
53/* Bits in MMDREG_STAT1 */ 58/* Bits in MMDREG_STAT1 */
54#define MDIO_MMDREG_STAT1_FAULT_LBN (7) 59#define MDIO_MMDREG_STAT1_FAULT_LBN (7)
@@ -56,6 +61,9 @@
56/* Link state */ 61/* Link state */
57#define MDIO_MMDREG_STAT1_LINK_LBN (2) 62#define MDIO_MMDREG_STAT1_LINK_LBN (2)
58#define MDIO_MMDREG_STAT1_LINK_WIDTH (1) 63#define MDIO_MMDREG_STAT1_LINK_WIDTH (1)
64/* Low power ability */
65#define MDIO_MMDREG_STAT1_LPABLE_LBN (1)
66#define MDIO_MMDREG_STAT1_LPABLE_WIDTH (1)
59 67
60/* Bits in ID reg */ 68/* Bits in ID reg */
61#define MDIO_ID_REV(_id32) (_id32 & 0xf) 69#define MDIO_ID_REV(_id32) (_id32 & 0xf)
@@ -76,6 +84,14 @@
76#define MDIO_MMDREG_STAT2_PRESENT_LBN (14) 84#define MDIO_MMDREG_STAT2_PRESENT_LBN (14)
77#define MDIO_MMDREG_STAT2_PRESENT_WIDTH (2) 85#define MDIO_MMDREG_STAT2_PRESENT_WIDTH (2)
78 86
87/* Bits in MMDREG_TXDIS */
88#define MDIO_MMDREG_TXDIS_GLOBAL_LBN (0)
89#define MDIO_MMDREG_TXDIS_GLOBAL_WIDTH (1)
90
91/* MMD-specific bits, ordered by MMD, then register */
92#define MDIO_PMAPMD_CTRL1_LBACK_LBN (0)
93#define MDIO_PMAPMD_CTRL1_LBACK_WIDTH (1)
94
79/* PMA type (4 bits) */ 95/* PMA type (4 bits) */
80#define MDIO_PMAPMD_CTRL2_10G_CX4 (0x0) 96#define MDIO_PMAPMD_CTRL2_10G_CX4 (0x0)
81#define MDIO_PMAPMD_CTRL2_10G_EW (0x1) 97#define MDIO_PMAPMD_CTRL2_10G_EW (0x1)
@@ -95,7 +111,7 @@
95#define MDIO_PMAPMD_CTRL2_10_BT (0xf) 111#define MDIO_PMAPMD_CTRL2_10_BT (0xf)
96#define MDIO_PMAPMD_CTRL2_TYPE_MASK (0xf) 112#define MDIO_PMAPMD_CTRL2_TYPE_MASK (0xf)
97 113
98/* /\* PHY XGXS lane state *\/ */ 114/* PHY XGXS lane state */
99#define MDIO_PHYXS_LANE_STATE (0x18) 115#define MDIO_PHYXS_LANE_STATE (0x18)
100#define MDIO_PHYXS_LANE_ALIGNED_LBN (12) 116#define MDIO_PHYXS_LANE_ALIGNED_LBN (12)
101 117
@@ -217,6 +233,12 @@ int mdio_clause45_check_mmds(struct efx_nic *efx,
217extern int mdio_clause45_links_ok(struct efx_nic *efx, 233extern int mdio_clause45_links_ok(struct efx_nic *efx,
218 unsigned int mmd_mask); 234 unsigned int mmd_mask);
219 235
236/* Generic transmit disable support though PMAPMD */
237extern void mdio_clause45_transmit_disable(struct efx_nic *efx);
238
239/* Generic part of reconfigure: set/clear loopback bits */
240extern void mdio_clause45_phy_reconfigure(struct efx_nic *efx);
241
220/* Read (some of) the PHY settings over MDIO */ 242/* Read (some of) the PHY settings over MDIO */
221extern void mdio_clause45_get_settings(struct efx_nic *efx, 243extern void mdio_clause45_get_settings(struct efx_nic *efx,
222 struct ethtool_cmd *ecmd); 244 struct ethtool_cmd *ecmd);
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index c505482c2520..5e20e7551dae 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -42,7 +42,7 @@
42#ifndef EFX_DRIVER_NAME 42#ifndef EFX_DRIVER_NAME
43#define EFX_DRIVER_NAME "sfc" 43#define EFX_DRIVER_NAME "sfc"
44#endif 44#endif
45#define EFX_DRIVER_VERSION "2.2.0136" 45#define EFX_DRIVER_VERSION "2.2"
46 46
47#ifdef EFX_ENABLE_DEBUG 47#ifdef EFX_ENABLE_DEBUG
48#define EFX_BUG_ON_PARANOID(x) BUG_ON(x) 48#define EFX_BUG_ON_PARANOID(x) BUG_ON(x)
@@ -52,28 +52,19 @@
52#define EFX_WARN_ON_PARANOID(x) do {} while (0) 52#define EFX_WARN_ON_PARANOID(x) do {} while (0)
53#endif 53#endif
54 54
55#define NET_DEV_REGISTERED(efx) \
56 ((efx)->net_dev->reg_state == NETREG_REGISTERED)
57
58/* Include net device name in log messages if it has been registered.
59 * Use efx->name not efx->net_dev->name so that races with (un)registration
60 * are harmless.
61 */
62#define NET_DEV_NAME(efx) (NET_DEV_REGISTERED(efx) ? (efx)->name : "")
63
64/* Un-rate-limited logging */ 55/* Un-rate-limited logging */
65#define EFX_ERR(efx, fmt, args...) \ 56#define EFX_ERR(efx, fmt, args...) \
66dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, NET_DEV_NAME(efx), ##args) 57dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, efx_dev_name(efx), ##args)
67 58
68#define EFX_INFO(efx, fmt, args...) \ 59#define EFX_INFO(efx, fmt, args...) \
69dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, NET_DEV_NAME(efx), ##args) 60dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, efx_dev_name(efx), ##args)
70 61
71#ifdef EFX_ENABLE_DEBUG 62#ifdef EFX_ENABLE_DEBUG
72#define EFX_LOG(efx, fmt, args...) \ 63#define EFX_LOG(efx, fmt, args...) \
73dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) 64dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)
74#else 65#else
75#define EFX_LOG(efx, fmt, args...) \ 66#define EFX_LOG(efx, fmt, args...) \
76dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) 67dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)
77#endif 68#endif
78 69
79#define EFX_TRACE(efx, fmt, args...) do {} while (0) 70#define EFX_TRACE(efx, fmt, args...) do {} while (0)
@@ -90,11 +81,6 @@ do {if (net_ratelimit()) EFX_INFO(efx, fmt, ##args); } while (0)
90#define EFX_LOG_RL(efx, fmt, args...) \ 81#define EFX_LOG_RL(efx, fmt, args...) \
91do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0) 82do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0)
92 83
93/* Kernel headers may redefine inline anyway */
94#ifndef inline
95#define inline inline __attribute__ ((always_inline))
96#endif
97
98/************************************************************************** 84/**************************************************************************
99 * 85 *
100 * Efx data structures 86 * Efx data structures
@@ -134,6 +120,8 @@ struct efx_special_buffer {
134 * Set only on the final fragment of a packet; %NULL for all other 120 * Set only on the final fragment of a packet; %NULL for all other
135 * fragments. When this fragment completes, then we can free this 121 * fragments. When this fragment completes, then we can free this
136 * skb. 122 * skb.
123 * @tsoh: The associated TSO header structure, or %NULL if this
124 * buffer is not a TSO header.
137 * @dma_addr: DMA address of the fragment. 125 * @dma_addr: DMA address of the fragment.
138 * @len: Length of this fragment. 126 * @len: Length of this fragment.
139 * This field is zero when the queue slot is empty. 127 * This field is zero when the queue slot is empty.
@@ -144,6 +132,7 @@ struct efx_special_buffer {
144 */ 132 */
145struct efx_tx_buffer { 133struct efx_tx_buffer {
146 const struct sk_buff *skb; 134 const struct sk_buff *skb;
135 struct efx_tso_header *tsoh;
147 dma_addr_t dma_addr; 136 dma_addr_t dma_addr;
148 unsigned short len; 137 unsigned short len;
149 unsigned char continuation; 138 unsigned char continuation;
@@ -187,6 +176,13 @@ struct efx_tx_buffer {
187 * variable indicates that the queue is full. This is to 176 * variable indicates that the queue is full. This is to
188 * avoid cache-line ping-pong between the xmit path and the 177 * avoid cache-line ping-pong between the xmit path and the
189 * completion path. 178 * completion path.
179 * @tso_headers_free: A list of TSO headers allocated for this TX queue
180 * that are not in use, and so available for new TSO sends. The list
181 * is protected by the TX queue lock.
182 * @tso_bursts: Number of times TSO xmit invoked by kernel
183 * @tso_long_headers: Number of packets with headers too long for standard
184 * blocks
185 * @tso_packets: Number of packets via the TSO xmit path
190 */ 186 */
191struct efx_tx_queue { 187struct efx_tx_queue {
192 /* Members which don't change on the fast path */ 188 /* Members which don't change on the fast path */
@@ -206,6 +202,10 @@ struct efx_tx_queue {
206 unsigned int insert_count ____cacheline_aligned_in_smp; 202 unsigned int insert_count ____cacheline_aligned_in_smp;
207 unsigned int write_count; 203 unsigned int write_count;
208 unsigned int old_read_count; 204 unsigned int old_read_count;
205 struct efx_tso_header *tso_headers_free;
206 unsigned int tso_bursts;
207 unsigned int tso_long_headers;
208 unsigned int tso_packets;
209}; 209};
210 210
211/** 211/**
@@ -434,6 +434,9 @@ struct efx_board {
434 struct efx_blinker blinker; 434 struct efx_blinker blinker;
435}; 435};
436 436
437#define STRING_TABLE_LOOKUP(val, member) \
438 member ## _names[val]
439
437enum efx_int_mode { 440enum efx_int_mode {
438 /* Be careful if altering to correct macro below */ 441 /* Be careful if altering to correct macro below */
439 EFX_INT_MODE_MSIX = 0, 442 EFX_INT_MODE_MSIX = 0,
@@ -506,6 +509,7 @@ enum efx_fc_type {
506 * @check_hw: Check hardware 509 * @check_hw: Check hardware
507 * @reset_xaui: Reset XAUI side of PHY for (software sequenced reset) 510 * @reset_xaui: Reset XAUI side of PHY for (software sequenced reset)
508 * @mmds: MMD presence mask 511 * @mmds: MMD presence mask
512 * @loopbacks: Supported loopback modes mask
509 */ 513 */
510struct efx_phy_operations { 514struct efx_phy_operations {
511 int (*init) (struct efx_nic *efx); 515 int (*init) (struct efx_nic *efx);
@@ -515,6 +519,7 @@ struct efx_phy_operations {
515 int (*check_hw) (struct efx_nic *efx); 519 int (*check_hw) (struct efx_nic *efx);
516 void (*reset_xaui) (struct efx_nic *efx); 520 void (*reset_xaui) (struct efx_nic *efx);
517 int mmds; 521 int mmds;
522 unsigned loopbacks;
518}; 523};
519 524
520/* 525/*
@@ -653,7 +658,6 @@ union efx_multicast_hash {
653 * @phy_op: PHY interface 658 * @phy_op: PHY interface
654 * @phy_data: PHY private data (including PHY-specific stats) 659 * @phy_data: PHY private data (including PHY-specific stats)
655 * @mii: PHY interface 660 * @mii: PHY interface
656 * @phy_powered: PHY power state
657 * @tx_disabled: PHY transmitter turned off 661 * @tx_disabled: PHY transmitter turned off
658 * @link_up: Link status 662 * @link_up: Link status
659 * @link_options: Link options (MII/GMII format) 663 * @link_options: Link options (MII/GMII format)
@@ -662,6 +666,9 @@ union efx_multicast_hash {
662 * @multicast_hash: Multicast hash table 666 * @multicast_hash: Multicast hash table
663 * @flow_control: Flow control flags - separate RX/TX so can't use link_options 667 * @flow_control: Flow control flags - separate RX/TX so can't use link_options
664 * @reconfigure_work: work item for dealing with PHY events 668 * @reconfigure_work: work item for dealing with PHY events
669 * @loopback_mode: Loopback status
670 * @loopback_modes: Supported loopback mode bitmask
671 * @loopback_selftest: Offline self-test private state
665 * 672 *
666 * The @priv field of the corresponding &struct net_device points to 673 * The @priv field of the corresponding &struct net_device points to
667 * this. 674 * this.
@@ -674,7 +681,7 @@ struct efx_nic {
674 struct workqueue_struct *workqueue; 681 struct workqueue_struct *workqueue;
675 struct work_struct reset_work; 682 struct work_struct reset_work;
676 struct delayed_work monitor_work; 683 struct delayed_work monitor_work;
677 unsigned long membase_phys; 684 resource_size_t membase_phys;
678 void __iomem *membase; 685 void __iomem *membase;
679 spinlock_t biu_lock; 686 spinlock_t biu_lock;
680 enum efx_int_mode interrupt_mode; 687 enum efx_int_mode interrupt_mode;
@@ -698,7 +705,7 @@ struct efx_nic {
698 705
699 unsigned n_rx_nodesc_drop_cnt; 706 unsigned n_rx_nodesc_drop_cnt;
700 707
701 void *nic_data; 708 struct falcon_nic_data *nic_data;
702 709
703 struct mutex mac_lock; 710 struct mutex mac_lock;
704 int port_enabled; 711 int port_enabled;
@@ -721,6 +728,7 @@ struct efx_nic {
721 struct efx_phy_operations *phy_op; 728 struct efx_phy_operations *phy_op;
722 void *phy_data; 729 void *phy_data;
723 struct mii_if_info mii; 730 struct mii_if_info mii;
731 unsigned tx_disabled;
724 732
725 int link_up; 733 int link_up;
726 unsigned int link_options; 734 unsigned int link_options;
@@ -732,8 +740,26 @@ struct efx_nic {
732 struct work_struct reconfigure_work; 740 struct work_struct reconfigure_work;
733 741
734 atomic_t rx_reset; 742 atomic_t rx_reset;
743 enum efx_loopback_mode loopback_mode;
744 unsigned int loopback_modes;
745
746 void *loopback_selftest;
735}; 747};
736 748
749static inline int efx_dev_registered(struct efx_nic *efx)
750{
751 return efx->net_dev->reg_state == NETREG_REGISTERED;
752}
753
754/* Net device name, for inclusion in log messages if it has been registered.
755 * Use efx->name not efx->net_dev->name so that races with (un)registration
756 * are harmless.
757 */
758static inline const char *efx_dev_name(struct efx_nic *efx)
759{
760 return efx_dev_registered(efx) ? efx->name : "";
761}
762
737/** 763/**
738 * struct efx_nic_type - Efx device type definition 764 * struct efx_nic_type - Efx device type definition
739 * @mem_bar: Memory BAR number 765 * @mem_bar: Memory BAR number
@@ -769,7 +795,7 @@ struct efx_nic_type {
769 unsigned int txd_ring_mask; 795 unsigned int txd_ring_mask;
770 unsigned int rxd_ring_mask; 796 unsigned int rxd_ring_mask;
771 unsigned int evq_size; 797 unsigned int evq_size;
772 dma_addr_t max_dma_mask; 798 u64 max_dma_mask;
773 unsigned int tx_dma_mask; 799 unsigned int tx_dma_mask;
774 unsigned bug5391_mask; 800 unsigned bug5391_mask;
775 801
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index 551299b462ae..601b001437c0 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -19,6 +19,7 @@
19#include "rx.h" 19#include "rx.h"
20#include "efx.h" 20#include "efx.h"
21#include "falcon.h" 21#include "falcon.h"
22#include "selftest.h"
22#include "workarounds.h" 23#include "workarounds.h"
23 24
24/* Number of RX descriptors pushed at once. */ 25/* Number of RX descriptors pushed at once. */
@@ -85,14 +86,17 @@ static unsigned int rx_refill_limit = 95;
85 */ 86 */
86#define EFX_RXD_HEAD_ROOM 2 87#define EFX_RXD_HEAD_ROOM 2
87 88
88/* Macros for zero-order pages (potentially) containing multiple RX buffers */ 89static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf)
89#define RX_DATA_OFFSET(_data) \ 90{
90 (((unsigned long) (_data)) & (PAGE_SIZE-1)) 91 /* Offset is always within one page, so we don't need to consider
91#define RX_BUF_OFFSET(_rx_buf) \ 92 * the page order.
92 RX_DATA_OFFSET((_rx_buf)->data) 93 */
93 94 return (__force unsigned long) buf->data & (PAGE_SIZE - 1);
94#define RX_PAGE_SIZE(_efx) \ 95}
95 (PAGE_SIZE * (1u << (_efx)->rx_buffer_order)) 96static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
97{
98 return PAGE_SIZE << efx->rx_buffer_order;
99}
96 100
97 101
98/************************************************************************** 102/**************************************************************************
@@ -105,7 +109,7 @@ static unsigned int rx_refill_limit = 95;
105static int efx_lro_get_skb_hdr(struct sk_buff *skb, void **ip_hdr, 109static int efx_lro_get_skb_hdr(struct sk_buff *skb, void **ip_hdr,
106 void **tcpudp_hdr, u64 *hdr_flags, void *priv) 110 void **tcpudp_hdr, u64 *hdr_flags, void *priv)
107{ 111{
108 struct efx_channel *channel = (struct efx_channel *)priv; 112 struct efx_channel *channel = priv;
109 struct iphdr *iph; 113 struct iphdr *iph;
110 struct tcphdr *th; 114 struct tcphdr *th;
111 115
@@ -130,12 +134,12 @@ static int efx_get_frag_hdr(struct skb_frag_struct *frag, void **mac_hdr,
130 void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags, 134 void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags,
131 void *priv) 135 void *priv)
132{ 136{
133 struct efx_channel *channel = (struct efx_channel *)priv; 137 struct efx_channel *channel = priv;
134 struct ethhdr *eh; 138 struct ethhdr *eh;
135 struct iphdr *iph; 139 struct iphdr *iph;
136 140
137 /* We support EtherII and VLAN encapsulated IPv4 */ 141 /* We support EtherII and VLAN encapsulated IPv4 */
138 eh = (struct ethhdr *)(page_address(frag->page) + frag->page_offset); 142 eh = page_address(frag->page) + frag->page_offset;
139 *mac_hdr = eh; 143 *mac_hdr = eh;
140 144
141 if (eh->h_proto == htons(ETH_P_IP)) { 145 if (eh->h_proto == htons(ETH_P_IP)) {
@@ -268,7 +272,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
268 return -ENOMEM; 272 return -ENOMEM;
269 273
270 dma_addr = pci_map_page(efx->pci_dev, rx_buf->page, 274 dma_addr = pci_map_page(efx->pci_dev, rx_buf->page,
271 0, RX_PAGE_SIZE(efx), 275 0, efx_rx_buf_size(efx),
272 PCI_DMA_FROMDEVICE); 276 PCI_DMA_FROMDEVICE);
273 277
274 if (unlikely(pci_dma_mapping_error(dma_addr))) { 278 if (unlikely(pci_dma_mapping_error(dma_addr))) {
@@ -279,14 +283,14 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
279 283
280 rx_queue->buf_page = rx_buf->page; 284 rx_queue->buf_page = rx_buf->page;
281 rx_queue->buf_dma_addr = dma_addr; 285 rx_queue->buf_dma_addr = dma_addr;
282 rx_queue->buf_data = ((char *) page_address(rx_buf->page) + 286 rx_queue->buf_data = (page_address(rx_buf->page) +
283 EFX_PAGE_IP_ALIGN); 287 EFX_PAGE_IP_ALIGN);
284 } 288 }
285 289
286 offset = RX_DATA_OFFSET(rx_queue->buf_data);
287 rx_buf->len = bytes; 290 rx_buf->len = bytes;
288 rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
289 rx_buf->data = rx_queue->buf_data; 291 rx_buf->data = rx_queue->buf_data;
292 offset = efx_rx_buf_offset(rx_buf);
293 rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
290 294
291 /* Try to pack multiple buffers per page */ 295 /* Try to pack multiple buffers per page */
292 if (efx->rx_buffer_order == 0) { 296 if (efx->rx_buffer_order == 0) {
@@ -294,7 +298,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
294 rx_queue->buf_data += ((bytes + 0x1ff) & ~0x1ff); 298 rx_queue->buf_data += ((bytes + 0x1ff) & ~0x1ff);
295 offset += ((bytes + 0x1ff) & ~0x1ff); 299 offset += ((bytes + 0x1ff) & ~0x1ff);
296 300
297 space = RX_PAGE_SIZE(efx) - offset; 301 space = efx_rx_buf_size(efx) - offset;
298 if (space >= bytes) { 302 if (space >= bytes) {
299 /* Refs dropped on kernel releasing each skb */ 303 /* Refs dropped on kernel releasing each skb */
300 get_page(rx_queue->buf_page); 304 get_page(rx_queue->buf_page);
@@ -343,7 +347,8 @@ static inline void efx_unmap_rx_buffer(struct efx_nic *efx,
343 EFX_BUG_ON_PARANOID(rx_buf->skb); 347 EFX_BUG_ON_PARANOID(rx_buf->skb);
344 if (rx_buf->unmap_addr) { 348 if (rx_buf->unmap_addr) {
345 pci_unmap_page(efx->pci_dev, rx_buf->unmap_addr, 349 pci_unmap_page(efx->pci_dev, rx_buf->unmap_addr,
346 RX_PAGE_SIZE(efx), PCI_DMA_FROMDEVICE); 350 efx_rx_buf_size(efx),
351 PCI_DMA_FROMDEVICE);
347 rx_buf->unmap_addr = 0; 352 rx_buf->unmap_addr = 0;
348 } 353 }
349 } else if (likely(rx_buf->skb)) { 354 } else if (likely(rx_buf->skb)) {
@@ -399,9 +404,10 @@ static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue,
399 return 0; 404 return 0;
400 405
401 /* Record minimum fill level */ 406 /* Record minimum fill level */
402 if (unlikely(fill_level < rx_queue->min_fill)) 407 if (unlikely(fill_level < rx_queue->min_fill)) {
403 if (fill_level) 408 if (fill_level)
404 rx_queue->min_fill = fill_level; 409 rx_queue->min_fill = fill_level;
410 }
405 411
406 /* Acquire RX add lock. If this lock is contended, then a fast 412 /* Acquire RX add lock. If this lock is contended, then a fast
407 * fill must already be in progress (e.g. in the refill 413 * fill must already be in progress (e.g. in the refill
@@ -551,7 +557,7 @@ static inline void efx_rx_packet_lro(struct efx_channel *channel,
551 struct skb_frag_struct frags; 557 struct skb_frag_struct frags;
552 558
553 frags.page = rx_buf->page; 559 frags.page = rx_buf->page;
554 frags.page_offset = RX_BUF_OFFSET(rx_buf); 560 frags.page_offset = efx_rx_buf_offset(rx_buf);
555 frags.size = rx_buf->len; 561 frags.size = rx_buf->len;
556 562
557 lro_receive_frags(lro_mgr, &frags, rx_buf->len, 563 lro_receive_frags(lro_mgr, &frags, rx_buf->len,
@@ -596,7 +602,7 @@ static inline struct sk_buff *efx_rx_mk_skb(struct efx_rx_buffer *rx_buf,
596 if (unlikely(rx_buf->len > hdr_len)) { 602 if (unlikely(rx_buf->len > hdr_len)) {
597 struct skb_frag_struct *frag = skb_shinfo(skb)->frags; 603 struct skb_frag_struct *frag = skb_shinfo(skb)->frags;
598 frag->page = rx_buf->page; 604 frag->page = rx_buf->page;
599 frag->page_offset = RX_BUF_OFFSET(rx_buf) + hdr_len; 605 frag->page_offset = efx_rx_buf_offset(rx_buf) + hdr_len;
600 frag->size = skb->len - hdr_len; 606 frag->size = skb->len - hdr_len;
601 skb_shinfo(skb)->nr_frags = 1; 607 skb_shinfo(skb)->nr_frags = 1;
602 skb->data_len = frag->size; 608 skb->data_len = frag->size;
@@ -683,6 +689,15 @@ void __efx_rx_packet(struct efx_channel *channel,
683 struct sk_buff *skb; 689 struct sk_buff *skb;
684 int lro = efx->net_dev->features & NETIF_F_LRO; 690 int lro = efx->net_dev->features & NETIF_F_LRO;
685 691
692 /* If we're in loopback test, then pass the packet directly to the
693 * loopback layer, and free the rx_buf here
694 */
695 if (unlikely(efx->loopback_selftest)) {
696 efx_loopback_rx_packet(efx, rx_buf->data, rx_buf->len);
697 efx_free_rx_buffer(efx, rx_buf);
698 goto done;
699 }
700
686 if (rx_buf->skb) { 701 if (rx_buf->skb) {
687 prefetch(skb_shinfo(rx_buf->skb)); 702 prefetch(skb_shinfo(rx_buf->skb));
688 703
@@ -736,7 +751,6 @@ void __efx_rx_packet(struct efx_channel *channel,
736 /* Update allocation strategy method */ 751 /* Update allocation strategy method */
737 channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB; 752 channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB;
738 753
739 /* fall-thru */
740done: 754done:
741 efx->net_dev->last_rx = jiffies; 755 efx->net_dev->last_rx = jiffies;
742} 756}
@@ -842,7 +856,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
842 /* For a page that is part-way through splitting into RX buffers */ 856 /* For a page that is part-way through splitting into RX buffers */
843 if (rx_queue->buf_page != NULL) { 857 if (rx_queue->buf_page != NULL) {
844 pci_unmap_page(rx_queue->efx->pci_dev, rx_queue->buf_dma_addr, 858 pci_unmap_page(rx_queue->efx->pci_dev, rx_queue->buf_dma_addr,
845 RX_PAGE_SIZE(rx_queue->efx), PCI_DMA_FROMDEVICE); 859 efx_rx_buf_size(rx_queue->efx),
860 PCI_DMA_FROMDEVICE);
846 __free_pages(rx_queue->buf_page, 861 __free_pages(rx_queue->buf_page,
847 rx_queue->efx->rx_buffer_order); 862 rx_queue->efx->rx_buffer_order);
848 rx_queue->buf_page = NULL; 863 rx_queue->buf_page = NULL;
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
new file mode 100644
index 000000000000..3b2de9fe7f27
--- /dev/null
+++ b/drivers/net/sfc/selftest.c
@@ -0,0 +1,719 @@
1/****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
4 * Copyright 2006-2008 Solarflare Communications Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
9 */
10
11#include <linux/netdevice.h>
12#include <linux/module.h>
13#include <linux/delay.h>
14#include <linux/kernel_stat.h>
15#include <linux/pci.h>
16#include <linux/ethtool.h>
17#include <linux/ip.h>
18#include <linux/in.h>
19#include <linux/udp.h>
20#include <linux/rtnetlink.h>
21#include <asm/io.h>
22#include "net_driver.h"
23#include "ethtool.h"
24#include "efx.h"
25#include "falcon.h"
26#include "selftest.h"
27#include "boards.h"
28#include "workarounds.h"
29#include "mac.h"
30
31/*
32 * Loopback test packet structure
33 *
34 * The self-test should stress every RSS vector, and unfortunately
35 * Falcon only performs RSS on TCP/UDP packets.
36 */
37struct efx_loopback_payload {
38 struct ethhdr header;
39 struct iphdr ip;
40 struct udphdr udp;
41 __be16 iteration;
42 const char msg[64];
43} __attribute__ ((packed));
44
45/* Loopback test source MAC address */
46static const unsigned char payload_source[ETH_ALEN] = {
47 0x00, 0x0f, 0x53, 0x1b, 0x1b, 0x1b,
48};
49
50static const char *payload_msg =
51 "Hello world! This is an Efx loopback test in progress!";
52
53/**
54 * efx_selftest_state - persistent state during a selftest
55 * @flush: Drop all packets in efx_loopback_rx_packet
56 * @packet_count: Number of packets being used in this test
57 * @skbs: An array of skbs transmitted
58 * @rx_good: RX good packet count
59 * @rx_bad: RX bad packet count
60 * @payload: Payload used in tests
61 */
62struct efx_selftest_state {
63 int flush;
64 int packet_count;
65 struct sk_buff **skbs;
66 atomic_t rx_good;
67 atomic_t rx_bad;
68 struct efx_loopback_payload payload;
69};
70
71/**************************************************************************
72 *
73 * Configurable values
74 *
75 **************************************************************************/
76
77/* Level of loopback testing
78 *
79 * The maximum packet burst length is 16**(n-1), i.e.
80 *
81 * - Level 0 : no packets
82 * - Level 1 : 1 packet
83 * - Level 2 : 17 packets (1 * 1 packet, 1 * 16 packets)
84 * - Level 3 : 273 packets (1 * 1 packet, 1 * 16 packet, 1 * 256 packets)
85 *
86 */
87static unsigned int loopback_test_level = 3;
88
89/**************************************************************************
90 *
91 * Interrupt and event queue testing
92 *
93 **************************************************************************/
94
95/* Test generation and receipt of interrupts */
96static int efx_test_interrupts(struct efx_nic *efx,
97 struct efx_self_tests *tests)
98{
99 struct efx_channel *channel;
100
101 EFX_LOG(efx, "testing interrupts\n");
102 tests->interrupt = -1;
103
104 /* Reset interrupt flag */
105 efx->last_irq_cpu = -1;
106 smp_wmb();
107
108 /* ACK each interrupting event queue. Receiving an interrupt due to
109 * traffic before a test event is raised is considered a pass */
110 efx_for_each_channel_with_interrupt(channel, efx) {
111 if (channel->work_pending)
112 efx_process_channel_now(channel);
113 if (efx->last_irq_cpu >= 0)
114 goto success;
115 }
116
117 falcon_generate_interrupt(efx);
118
119 /* Wait for arrival of test interrupt. */
120 EFX_LOG(efx, "waiting for test interrupt\n");
121 schedule_timeout_uninterruptible(HZ / 10);
122 if (efx->last_irq_cpu >= 0)
123 goto success;
124
125 EFX_ERR(efx, "timed out waiting for interrupt\n");
126 return -ETIMEDOUT;
127
128 success:
129 EFX_LOG(efx, "test interrupt (mode %d) seen on CPU%d\n",
130 efx->interrupt_mode, efx->last_irq_cpu);
131 tests->interrupt = 1;
132 return 0;
133}
134
135/* Test generation and receipt of non-interrupting events */
136static int efx_test_eventq(struct efx_channel *channel,
137 struct efx_self_tests *tests)
138{
139 unsigned int magic;
140
141 /* Channel specific code, limited to 20 bits */
142 magic = (0x00010150 + channel->channel);
143 EFX_LOG(channel->efx, "channel %d testing event queue with code %x\n",
144 channel->channel, magic);
145
146 tests->eventq_dma[channel->channel] = -1;
147 tests->eventq_int[channel->channel] = 1; /* fake pass */
148 tests->eventq_poll[channel->channel] = 1; /* fake pass */
149
150 /* Reset flag and zero magic word */
151 channel->efx->last_irq_cpu = -1;
152 channel->eventq_magic = 0;
153 smp_wmb();
154
155 falcon_generate_test_event(channel, magic);
156 udelay(1);
157
158 efx_process_channel_now(channel);
159 if (channel->eventq_magic != magic) {
160 EFX_ERR(channel->efx, "channel %d failed to see test event\n",
161 channel->channel);
162 return -ETIMEDOUT;
163 } else {
164 tests->eventq_dma[channel->channel] = 1;
165 }
166
167 return 0;
168}
169
170/* Test generation and receipt of interrupting events */
171static int efx_test_eventq_irq(struct efx_channel *channel,
172 struct efx_self_tests *tests)
173{
174 unsigned int magic, count;
175
176 /* Channel specific code, limited to 20 bits */
177 magic = (0x00010150 + channel->channel);
178 EFX_LOG(channel->efx, "channel %d testing event queue with code %x\n",
179 channel->channel, magic);
180
181 tests->eventq_dma[channel->channel] = -1;
182 tests->eventq_int[channel->channel] = -1;
183 tests->eventq_poll[channel->channel] = -1;
184
185 /* Reset flag and zero magic word */
186 channel->efx->last_irq_cpu = -1;
187 channel->eventq_magic = 0;
188 smp_wmb();
189
190 falcon_generate_test_event(channel, magic);
191
192 /* Wait for arrival of interrupt */
193 count = 0;
194 do {
195 schedule_timeout_uninterruptible(HZ / 100);
196
197 if (channel->work_pending)
198 efx_process_channel_now(channel);
199
200 if (channel->eventq_magic == magic)
201 goto eventq_ok;
202 } while (++count < 2);
203
204 EFX_ERR(channel->efx, "channel %d timed out waiting for event queue\n",
205 channel->channel);
206
207 /* See if interrupt arrived */
208 if (channel->efx->last_irq_cpu >= 0) {
209 EFX_ERR(channel->efx, "channel %d saw interrupt on CPU%d "
210 "during event queue test\n", channel->channel,
211 raw_smp_processor_id());
212 tests->eventq_int[channel->channel] = 1;
213 }
214
215 /* Check to see if event was received even if interrupt wasn't */
216 efx_process_channel_now(channel);
217 if (channel->eventq_magic == magic) {
218 EFX_ERR(channel->efx, "channel %d event was generated, but "
219 "failed to trigger an interrupt\n", channel->channel);
220 tests->eventq_dma[channel->channel] = 1;
221 }
222
223 return -ETIMEDOUT;
224 eventq_ok:
225 EFX_LOG(channel->efx, "channel %d event queue passed\n",
226 channel->channel);
227 tests->eventq_dma[channel->channel] = 1;
228 tests->eventq_int[channel->channel] = 1;
229 tests->eventq_poll[channel->channel] = 1;
230 return 0;
231}
232
233/**************************************************************************
234 *
235 * PHY testing
236 *
237 **************************************************************************/
238
239/* Check PHY presence by reading the PHY ID registers */
240static int efx_test_phy(struct efx_nic *efx,
241 struct efx_self_tests *tests)
242{
243 u16 physid1, physid2;
244 struct mii_if_info *mii = &efx->mii;
245 struct net_device *net_dev = efx->net_dev;
246
247 if (efx->phy_type == PHY_TYPE_NONE)
248 return 0;
249
250 EFX_LOG(efx, "testing PHY presence\n");
251 tests->phy_ok = -1;
252
253 physid1 = mii->mdio_read(net_dev, mii->phy_id, MII_PHYSID1);
254 physid2 = mii->mdio_read(net_dev, mii->phy_id, MII_PHYSID2);
255
256 if ((physid1 != 0x0000) && (physid1 != 0xffff) &&
257 (physid2 != 0x0000) && (physid2 != 0xffff)) {
258 EFX_LOG(efx, "found MII PHY %d ID 0x%x:%x\n",
259 mii->phy_id, physid1, physid2);
260 tests->phy_ok = 1;
261 return 0;
262 }
263
264 EFX_ERR(efx, "no MII PHY present with ID %d\n", mii->phy_id);
265 return -ENODEV;
266}
267
268/**************************************************************************
269 *
270 * Loopback testing
271 * NB Only one loopback test can be executing concurrently.
272 *
273 **************************************************************************/
274
275/* Loopback test RX callback
276 * This is called for each received packet during loopback testing.
277 */
278void efx_loopback_rx_packet(struct efx_nic *efx,
279 const char *buf_ptr, int pkt_len)
280{
281 struct efx_selftest_state *state = efx->loopback_selftest;
282 struct efx_loopback_payload *received;
283 struct efx_loopback_payload *payload;
284
285 BUG_ON(!buf_ptr);
286
287 /* If we are just flushing, then drop the packet */
288 if ((state == NULL) || state->flush)
289 return;
290
291 payload = &state->payload;
292
293 received = (struct efx_loopback_payload *) buf_ptr;
294 received->ip.saddr = payload->ip.saddr;
295 received->ip.check = payload->ip.check;
296
297 /* Check that header exists */
298 if (pkt_len < sizeof(received->header)) {
299 EFX_ERR(efx, "saw runt RX packet (length %d) in %s loopback "
300 "test\n", pkt_len, LOOPBACK_MODE(efx));
301 goto err;
302 }
303
304 /* Check that the ethernet header exists */
305 if (memcmp(&received->header, &payload->header, ETH_HLEN) != 0) {
306 EFX_ERR(efx, "saw non-loopback RX packet in %s loopback test\n",
307 LOOPBACK_MODE(efx));
308 goto err;
309 }
310
311 /* Check packet length */
312 if (pkt_len != sizeof(*payload)) {
313 EFX_ERR(efx, "saw incorrect RX packet length %d (wanted %d) in "
314 "%s loopback test\n", pkt_len, (int)sizeof(*payload),
315 LOOPBACK_MODE(efx));
316 goto err;
317 }
318
319 /* Check that IP header matches */
320 if (memcmp(&received->ip, &payload->ip, sizeof(payload->ip)) != 0) {
321 EFX_ERR(efx, "saw corrupted IP header in %s loopback test\n",
322 LOOPBACK_MODE(efx));
323 goto err;
324 }
325
326 /* Check that msg and padding matches */
327 if (memcmp(&received->msg, &payload->msg, sizeof(received->msg)) != 0) {
328 EFX_ERR(efx, "saw corrupted RX packet in %s loopback test\n",
329 LOOPBACK_MODE(efx));
330 goto err;
331 }
332
333 /* Check that iteration matches */
334 if (received->iteration != payload->iteration) {
335 EFX_ERR(efx, "saw RX packet from iteration %d (wanted %d) in "
336 "%s loopback test\n", ntohs(received->iteration),
337 ntohs(payload->iteration), LOOPBACK_MODE(efx));
338 goto err;
339 }
340
341 /* Increase correct RX count */
342 EFX_TRACE(efx, "got loopback RX in %s loopback test\n",
343 LOOPBACK_MODE(efx));
344
345 atomic_inc(&state->rx_good);
346 return;
347
348 err:
349#ifdef EFX_ENABLE_DEBUG
350 if (atomic_read(&state->rx_bad) == 0) {
351 EFX_ERR(efx, "received packet:\n");
352 print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1,
353 buf_ptr, pkt_len, 0);
354 EFX_ERR(efx, "expected packet:\n");
355 print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1,
356 &state->payload, sizeof(state->payload), 0);
357 }
358#endif
359 atomic_inc(&state->rx_bad);
360}
361
362/* Initialise an efx_selftest_state for a new iteration */
363static void efx_iterate_state(struct efx_nic *efx)
364{
365 struct efx_selftest_state *state = efx->loopback_selftest;
366 struct net_device *net_dev = efx->net_dev;
367 struct efx_loopback_payload *payload = &state->payload;
368
369 /* Initialise the layerII header */
370 memcpy(&payload->header.h_dest, net_dev->dev_addr, ETH_ALEN);
371 memcpy(&payload->header.h_source, &payload_source, ETH_ALEN);
372 payload->header.h_proto = htons(ETH_P_IP);
373
374 /* saddr set later and used as incrementing count */
375 payload->ip.daddr = htonl(INADDR_LOOPBACK);
376 payload->ip.ihl = 5;
377 payload->ip.check = htons(0xdead);
378 payload->ip.tot_len = htons(sizeof(*payload) - sizeof(struct ethhdr));
379 payload->ip.version = IPVERSION;
380 payload->ip.protocol = IPPROTO_UDP;
381
382 /* Initialise udp header */
383 payload->udp.source = 0;
384 payload->udp.len = htons(sizeof(*payload) - sizeof(struct ethhdr) -
385 sizeof(struct iphdr));
386 payload->udp.check = 0; /* checksum ignored */
387
388 /* Fill out payload */
389 payload->iteration = htons(ntohs(payload->iteration) + 1);
390 memcpy(&payload->msg, payload_msg, sizeof(payload_msg));
391
392 /* Fill out remaining state members */
393 atomic_set(&state->rx_good, 0);
394 atomic_set(&state->rx_bad, 0);
395 smp_wmb();
396}
397
398static int efx_tx_loopback(struct efx_tx_queue *tx_queue)
399{
400 struct efx_nic *efx = tx_queue->efx;
401 struct efx_selftest_state *state = efx->loopback_selftest;
402 struct efx_loopback_payload *payload;
403 struct sk_buff *skb;
404 int i, rc;
405
406 /* Transmit N copies of buffer */
407 for (i = 0; i < state->packet_count; i++) {
408 /* Allocate an skb, holding an extra reference for
409 * transmit completion counting */
410 skb = alloc_skb(sizeof(state->payload), GFP_KERNEL);
411 if (!skb)
412 return -ENOMEM;
413 state->skbs[i] = skb;
414 skb_get(skb);
415
416 /* Copy the payload in, incrementing the source address to
417 * exercise the rss vectors */
418 payload = ((struct efx_loopback_payload *)
419 skb_put(skb, sizeof(state->payload)));
420 memcpy(payload, &state->payload, sizeof(state->payload));
421 payload->ip.saddr = htonl(INADDR_LOOPBACK | (i << 2));
422
423 /* Ensure everything we've written is visible to the
424 * interrupt handler. */
425 smp_wmb();
426
427 if (efx_dev_registered(efx))
428 netif_tx_lock_bh(efx->net_dev);
429 rc = efx_xmit(efx, tx_queue, skb);
430 if (efx_dev_registered(efx))
431 netif_tx_unlock_bh(efx->net_dev);
432
433 if (rc != NETDEV_TX_OK) {
434 EFX_ERR(efx, "TX queue %d could not transmit packet %d "
435 "of %d in %s loopback test\n", tx_queue->queue,
436 i + 1, state->packet_count, LOOPBACK_MODE(efx));
437
438 /* Defer cleaning up the other skbs for the caller */
439 kfree_skb(skb);
440 return -EPIPE;
441 }
442 }
443
444 return 0;
445}
446
447static int efx_rx_loopback(struct efx_tx_queue *tx_queue,
448 struct efx_loopback_self_tests *lb_tests)
449{
450 struct efx_nic *efx = tx_queue->efx;
451 struct efx_selftest_state *state = efx->loopback_selftest;
452 struct sk_buff *skb;
453 int tx_done = 0, rx_good, rx_bad;
454 int i, rc = 0;
455
456 if (efx_dev_registered(efx))
457 netif_tx_lock_bh(efx->net_dev);
458
459 /* Count the number of tx completions, and decrement the refcnt. Any
460 * skbs not already completed will be free'd when the queue is flushed */
461 for (i=0; i < state->packet_count; i++) {
462 skb = state->skbs[i];
463 if (skb && !skb_shared(skb))
464 ++tx_done;
465 dev_kfree_skb_any(skb);
466 }
467
468 if (efx_dev_registered(efx))
469 netif_tx_unlock_bh(efx->net_dev);
470
471 /* Check TX completion and received packet counts */
472 rx_good = atomic_read(&state->rx_good);
473 rx_bad = atomic_read(&state->rx_bad);
474 if (tx_done != state->packet_count) {
475 /* Don't free the skbs; they will be picked up on TX
476 * overflow or channel teardown.
477 */
478 EFX_ERR(efx, "TX queue %d saw only %d out of an expected %d "
479 "TX completion events in %s loopback test\n",
480 tx_queue->queue, tx_done, state->packet_count,
481 LOOPBACK_MODE(efx));
482 rc = -ETIMEDOUT;
483 /* Allow to fall through so we see the RX errors as well */
484 }
485
486 /* We may always be up to a flush away from our desired packet total */
487 if (rx_good != state->packet_count) {
488 EFX_LOG(efx, "TX queue %d saw only %d out of an expected %d "
489 "received packets in %s loopback test\n",
490 tx_queue->queue, rx_good, state->packet_count,
491 LOOPBACK_MODE(efx));
492 rc = -ETIMEDOUT;
493 /* Fall through */
494 }
495
496 /* Update loopback test structure */
497 lb_tests->tx_sent[tx_queue->queue] += state->packet_count;
498 lb_tests->tx_done[tx_queue->queue] += tx_done;
499 lb_tests->rx_good += rx_good;
500 lb_tests->rx_bad += rx_bad;
501
502 return rc;
503}
504
505static int
506efx_test_loopback(struct efx_tx_queue *tx_queue,
507 struct efx_loopback_self_tests *lb_tests)
508{
509 struct efx_nic *efx = tx_queue->efx;
510 struct efx_selftest_state *state = efx->loopback_selftest;
511 struct efx_channel *channel;
512 int i, rc = 0;
513
514 for (i = 0; i < loopback_test_level; i++) {
515 /* Determine how many packets to send */
516 state->packet_count = (efx->type->txd_ring_mask + 1) / 3;
517 state->packet_count = min(1 << (i << 2), state->packet_count);
518 state->skbs = kzalloc(sizeof(state->skbs[0]) *
519 state->packet_count, GFP_KERNEL);
520 if (!state->skbs)
521 return -ENOMEM;
522 state->flush = 0;
523
524 EFX_LOG(efx, "TX queue %d testing %s loopback with %d "
525 "packets\n", tx_queue->queue, LOOPBACK_MODE(efx),
526 state->packet_count);
527
528 efx_iterate_state(efx);
529 rc = efx_tx_loopback(tx_queue);
530
531 /* NAPI polling is not enabled, so process channels synchronously */
532 schedule_timeout_uninterruptible(HZ / 50);
533 efx_for_each_channel_with_interrupt(channel, efx) {
534 if (channel->work_pending)
535 efx_process_channel_now(channel);
536 }
537
538 rc |= efx_rx_loopback(tx_queue, lb_tests);
539 kfree(state->skbs);
540
541 if (rc) {
542 /* Wait a while to ensure there are no packets
543 * floating around after a failure. */
544 schedule_timeout_uninterruptible(HZ / 10);
545 return rc;
546 }
547 }
548
549 EFX_LOG(efx, "TX queue %d passed %s loopback test with a burst length "
550 "of %d packets\n", tx_queue->queue, LOOPBACK_MODE(efx),
551 state->packet_count);
552
553 return rc;
554}
555
556static int efx_test_loopbacks(struct efx_nic *efx,
557 struct efx_self_tests *tests,
558 unsigned int loopback_modes)
559{
560 struct efx_selftest_state *state = efx->loopback_selftest;
561 struct ethtool_cmd ecmd, ecmd_loopback;
562 struct efx_tx_queue *tx_queue;
563 enum efx_loopback_mode old_mode, mode;
564 int count, rc = 0, link_up;
565
566 rc = efx_ethtool_get_settings(efx->net_dev, &ecmd);
567 if (rc) {
568 EFX_ERR(efx, "could not get GMII settings\n");
569 return rc;
570 }
571 old_mode = efx->loopback_mode;
572
573 /* Disable autonegotiation for the purposes of loopback */
574 memcpy(&ecmd_loopback, &ecmd, sizeof(ecmd_loopback));
575 if (ecmd_loopback.autoneg == AUTONEG_ENABLE) {
576 ecmd_loopback.autoneg = AUTONEG_DISABLE;
577 ecmd_loopback.duplex = DUPLEX_FULL;
578 ecmd_loopback.speed = SPEED_10000;
579 }
580
581 rc = efx_ethtool_set_settings(efx->net_dev, &ecmd_loopback);
582 if (rc) {
583 EFX_ERR(efx, "could not disable autonegotiation\n");
584 goto out;
585 }
586 tests->loopback_speed = ecmd_loopback.speed;
587 tests->loopback_full_duplex = ecmd_loopback.duplex;
588
589 /* Test all supported loopback modes */
590 for (mode = LOOPBACK_NONE; mode < LOOPBACK_TEST_MAX; mode++) {
591 if (!(loopback_modes & (1 << mode)))
592 continue;
593
594 /* Move the port into the specified loopback mode. */
595 state->flush = 1;
596 efx->loopback_mode = mode;
597 efx_reconfigure_port(efx);
598
599 /* Wait for the PHY to signal the link is up */
600 count = 0;
601 do {
602 struct efx_channel *channel = &efx->channel[0];
603
604 falcon_check_xmac(efx);
605 schedule_timeout_uninterruptible(HZ / 10);
606 if (channel->work_pending)
607 efx_process_channel_now(channel);
608 /* Wait for PHY events to be processed */
609 flush_workqueue(efx->workqueue);
610 rmb();
611
612 /* efx->link_up can be 1 even if the XAUI link is down,
613 * (bug5762). Usually, it's not worth bothering with the
614 * difference, but for selftests, we need that extra
615 * guarantee that the link is really, really, up.
616 */
617 link_up = efx->link_up;
618 if (!falcon_xaui_link_ok(efx))
619 link_up = 0;
620
621 } while ((++count < 20) && !link_up);
622
623 /* The link should now be up. If it isn't, there is no point
624 * in attempting a loopback test */
625 if (!link_up) {
626 EFX_ERR(efx, "loopback %s never came up\n",
627 LOOPBACK_MODE(efx));
628 rc = -EIO;
629 goto out;
630 }
631
632 EFX_LOG(efx, "link came up in %s loopback in %d iterations\n",
633 LOOPBACK_MODE(efx), count);
634
635 /* Test every TX queue */
636 efx_for_each_tx_queue(tx_queue, efx) {
637 rc |= efx_test_loopback(tx_queue,
638 &tests->loopback[mode]);
639 if (rc)
640 goto out;
641 }
642 }
643
644 out:
645 /* Take out of loopback and restore PHY settings */
646 state->flush = 1;
647 efx->loopback_mode = old_mode;
648 efx_ethtool_set_settings(efx->net_dev, &ecmd);
649
650 return rc;
651}
652
653/**************************************************************************
654 *
655 * Entry points
656 *
657 *************************************************************************/
658
659/* Online (i.e. non-disruptive) testing
660 * This checks interrupt generation, event delivery and PHY presence. */
661int efx_online_test(struct efx_nic *efx, struct efx_self_tests *tests)
662{
663 struct efx_channel *channel;
664 int rc = 0;
665
666 EFX_LOG(efx, "performing online self-tests\n");
667
668 rc |= efx_test_interrupts(efx, tests);
669 efx_for_each_channel(channel, efx) {
670 if (channel->has_interrupt)
671 rc |= efx_test_eventq_irq(channel, tests);
672 else
673 rc |= efx_test_eventq(channel, tests);
674 }
675 rc |= efx_test_phy(efx, tests);
676
677 if (rc)
678 EFX_ERR(efx, "failed online self-tests\n");
679
680 return rc;
681}
682
683/* Offline (i.e. disruptive) testing
684 * This checks MAC and PHY loopback on the specified port. */
685int efx_offline_test(struct efx_nic *efx,
686 struct efx_self_tests *tests, unsigned int loopback_modes)
687{
688 struct efx_selftest_state *state;
689 int rc = 0;
690
691 EFX_LOG(efx, "performing offline self-tests\n");
692
693 /* Create a selftest_state structure to hold state for the test */
694 state = kzalloc(sizeof(*state), GFP_KERNEL);
695 if (state == NULL) {
696 rc = -ENOMEM;
697 goto out;
698 }
699
700 /* Set the port loopback_selftest member. From this point on
701 * all received packets will be dropped. Mark the state as
702 * "flushing" so all inflight packets are dropped */
703 BUG_ON(efx->loopback_selftest);
704 state->flush = 1;
705 efx->loopback_selftest = state;
706
707 rc = efx_test_loopbacks(efx, tests, loopback_modes);
708
709 efx->loopback_selftest = NULL;
710 wmb();
711 kfree(state);
712
713 out:
714 if (rc)
715 EFX_ERR(efx, "failed offline self-tests\n");
716
717 return rc;
718}
719
diff --git a/drivers/net/sfc/selftest.h b/drivers/net/sfc/selftest.h
new file mode 100644
index 000000000000..f6999c2b622d
--- /dev/null
+++ b/drivers/net/sfc/selftest.h
@@ -0,0 +1,50 @@
1/****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
4 * Copyright 2006-2008 Solarflare Communications Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
9 */
10
11#ifndef EFX_SELFTEST_H
12#define EFX_SELFTEST_H
13
14#include "net_driver.h"
15
16/*
17 * Self tests
18 */
19
20struct efx_loopback_self_tests {
21 int tx_sent[EFX_MAX_TX_QUEUES];
22 int tx_done[EFX_MAX_TX_QUEUES];
23 int rx_good;
24 int rx_bad;
25};
26
27/* Efx self test results
28 * For fields which are not counters, 1 indicates success and -1
29 * indicates failure.
30 */
31struct efx_self_tests {
32 int interrupt;
33 int eventq_dma[EFX_MAX_CHANNELS];
34 int eventq_int[EFX_MAX_CHANNELS];
35 int eventq_poll[EFX_MAX_CHANNELS];
36 int phy_ok;
37 int loopback_speed;
38 int loopback_full_duplex;
39 struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX];
40};
41
42extern void efx_loopback_rx_packet(struct efx_nic *efx,
43 const char *buf_ptr, int pkt_len);
44extern int efx_online_test(struct efx_nic *efx,
45 struct efx_self_tests *tests);
46extern int efx_offline_test(struct efx_nic *efx,
47 struct efx_self_tests *tests,
48 unsigned int loopback_modes);
49
50#endif /* EFX_SELFTEST_H */
diff --git a/drivers/net/sfc/sfe4001.c b/drivers/net/sfc/sfe4001.c
index 11fa9fb8f48b..66a0d1442aba 100644
--- a/drivers/net/sfc/sfe4001.c
+++ b/drivers/net/sfc/sfe4001.c
@@ -116,20 +116,29 @@ void sfe4001_poweroff(struct efx_nic *efx)
116 116
117 /* Turn off all power rails */ 117 /* Turn off all power rails */
118 out = 0xff; 118 out = 0xff;
119 (void) efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); 119 efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1);
120 120
121 /* Disable port 1 outputs on IO expander */ 121 /* Disable port 1 outputs on IO expander */
122 cfg = 0xff; 122 cfg = 0xff;
123 (void) efx_i2c_write(i2c, PCA9539, P1_CONFIG, &cfg, 1); 123 efx_i2c_write(i2c, PCA9539, P1_CONFIG, &cfg, 1);
124 124
125 /* Disable port 0 outputs on IO expander */ 125 /* Disable port 0 outputs on IO expander */
126 cfg = 0xff; 126 cfg = 0xff;
127 (void) efx_i2c_write(i2c, PCA9539, P0_CONFIG, &cfg, 1); 127 efx_i2c_write(i2c, PCA9539, P0_CONFIG, &cfg, 1);
128 128
129 /* Clear any over-temperature alert */ 129 /* Clear any over-temperature alert */
130 (void) efx_i2c_read(i2c, MAX6647, RSL, &in, 1); 130 efx_i2c_read(i2c, MAX6647, RSL, &in, 1);
131} 131}
132 132
133/* The P0_EN_3V3X line on SFE4001 boards (from A2 onward) is connected
134 * to the FLASH_CFG_1 input on the DSP. We must keep it high at power-
135 * up to allow writing the flash (done through MDIO from userland).
136 */
137unsigned int sfe4001_phy_flash_cfg;
138module_param_named(phy_flash_cfg, sfe4001_phy_flash_cfg, uint, 0444);
139MODULE_PARM_DESC(phy_flash_cfg,
140 "Force PHY to enter flash configuration mode");
141
133/* This board uses an I2C expander to provider power to the PHY, which needs to 142/* This board uses an I2C expander to provider power to the PHY, which needs to
134 * be turned on before the PHY can be used. 143 * be turned on before the PHY can be used.
135 * Context: Process context, rtnl lock held 144 * Context: Process context, rtnl lock held
@@ -203,6 +212,8 @@ int sfe4001_poweron(struct efx_nic *efx)
203 out = 0xff & ~((1 << P0_EN_1V2_LBN) | (1 << P0_EN_2V5_LBN) | 212 out = 0xff & ~((1 << P0_EN_1V2_LBN) | (1 << P0_EN_2V5_LBN) |
204 (1 << P0_EN_3V3X_LBN) | (1 << P0_EN_5V_LBN) | 213 (1 << P0_EN_3V3X_LBN) | (1 << P0_EN_5V_LBN) |
205 (1 << P0_X_TRST_LBN)); 214 (1 << P0_X_TRST_LBN));
215 if (sfe4001_phy_flash_cfg)
216 out |= 1 << P0_EN_3V3X_LBN;
206 217
207 rc = efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); 218 rc = efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1);
208 if (rc) 219 if (rc)
@@ -226,6 +237,9 @@ int sfe4001_poweron(struct efx_nic *efx)
226 if (in & (1 << P1_AFE_PWD_LBN)) 237 if (in & (1 << P1_AFE_PWD_LBN))
227 goto done; 238 goto done;
228 239
240 /* DSP doesn't look powered in flash config mode */
241 if (sfe4001_phy_flash_cfg)
242 goto done;
229 } while (++count < 20); 243 } while (++count < 20);
230 244
231 EFX_INFO(efx, "timed out waiting for power\n"); 245 EFX_INFO(efx, "timed out waiting for power\n");
@@ -239,14 +253,14 @@ done:
239fail3: 253fail3:
240 /* Turn off all power rails */ 254 /* Turn off all power rails */
241 out = 0xff; 255 out = 0xff;
242 (void) efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); 256 efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1);
243 /* Disable port 1 outputs on IO expander */ 257 /* Disable port 1 outputs on IO expander */
244 out = 0xff; 258 out = 0xff;
245 (void) efx_i2c_write(i2c, PCA9539, P1_CONFIG, &out, 1); 259 efx_i2c_write(i2c, PCA9539, P1_CONFIG, &out, 1);
246fail2: 260fail2:
247 /* Disable port 0 outputs on IO expander */ 261 /* Disable port 0 outputs on IO expander */
248 out = 0xff; 262 out = 0xff;
249 (void) efx_i2c_write(i2c, PCA9539, P0_CONFIG, &out, 1); 263 efx_i2c_write(i2c, PCA9539, P0_CONFIG, &out, 1);
250fail1: 264fail1:
251 return rc; 265 return rc;
252} 266}
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index a2e9f79e47b1..c0146061c326 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -24,6 +24,11 @@
24 MDIO_MMDREG_DEVS0_PCS | \ 24 MDIO_MMDREG_DEVS0_PCS | \
25 MDIO_MMDREG_DEVS0_PHYXS) 25 MDIO_MMDREG_DEVS0_PHYXS)
26 26
27#define TENXPRESS_LOOPBACKS ((1 << LOOPBACK_PHYXS) | \
28 (1 << LOOPBACK_PCS) | \
29 (1 << LOOPBACK_PMAPMD) | \
30 (1 << LOOPBACK_NETWORK))
31
27/* We complain if we fail to see the link partner as 10G capable this many 32/* We complain if we fail to see the link partner as 10G capable this many
28 * times in a row (must be > 1 as sampling the autoneg. registers is racy) 33 * times in a row (must be > 1 as sampling the autoneg. registers is racy)
29 */ 34 */
@@ -72,6 +77,10 @@
72#define PMA_PMD_BIST_RXD_LBN (1) 77#define PMA_PMD_BIST_RXD_LBN (1)
73#define PMA_PMD_BIST_AFE_LBN (0) 78#define PMA_PMD_BIST_AFE_LBN (0)
74 79
80/* Special Software reset register */
81#define PMA_PMD_EXT_CTRL_REG 49152
82#define PMA_PMD_EXT_SSR_LBN 15
83
75#define BIST_MAX_DELAY (1000) 84#define BIST_MAX_DELAY (1000)
76#define BIST_POLL_DELAY (10) 85#define BIST_POLL_DELAY (10)
77 86
@@ -86,6 +95,11 @@
86#define PCS_TEST_SELECT_REG 0xd807 /* PRM 10.5.8 */ 95#define PCS_TEST_SELECT_REG 0xd807 /* PRM 10.5.8 */
87#define CLK312_EN_LBN 3 96#define CLK312_EN_LBN 3
88 97
98/* PHYXS registers */
99#define PHYXS_TEST1 (49162)
100#define LOOPBACK_NEAR_LBN (8)
101#define LOOPBACK_NEAR_WIDTH (1)
102
89/* Boot status register */ 103/* Boot status register */
90#define PCS_BOOT_STATUS_REG (0xd000) 104#define PCS_BOOT_STATUS_REG (0xd000)
91#define PCS_BOOT_FATAL_ERR_LBN (0) 105#define PCS_BOOT_FATAL_ERR_LBN (0)
@@ -106,7 +120,9 @@ MODULE_PARM_DESC(crc_error_reset_threshold,
106 120
107struct tenxpress_phy_data { 121struct tenxpress_phy_data {
108 enum tenxpress_state state; 122 enum tenxpress_state state;
123 enum efx_loopback_mode loopback_mode;
109 atomic_t bad_crc_count; 124 atomic_t bad_crc_count;
125 int tx_disabled;
110 int bad_lp_tries; 126 int bad_lp_tries;
111}; 127};
112 128
@@ -195,14 +211,18 @@ static int tenxpress_phy_init(struct efx_nic *efx)
195 int rc = 0; 211 int rc = 0;
196 212
197 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); 213 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
214 if (!phy_data)
215 return -ENOMEM;
198 efx->phy_data = phy_data; 216 efx->phy_data = phy_data;
199 217
200 tenxpress_set_state(efx, TENXPRESS_STATUS_NORMAL); 218 tenxpress_set_state(efx, TENXPRESS_STATUS_NORMAL);
201 219
202 rc = mdio_clause45_wait_reset_mmds(efx, 220 if (!sfe4001_phy_flash_cfg) {
203 TENXPRESS_REQUIRED_DEVS); 221 rc = mdio_clause45_wait_reset_mmds(efx,
204 if (rc < 0) 222 TENXPRESS_REQUIRED_DEVS);
205 goto fail; 223 if (rc < 0)
224 goto fail;
225 }
206 226
207 rc = mdio_clause45_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); 227 rc = mdio_clause45_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0);
208 if (rc < 0) 228 if (rc < 0)
@@ -225,6 +245,35 @@ static int tenxpress_phy_init(struct efx_nic *efx)
225 return rc; 245 return rc;
226} 246}
227 247
248static int tenxpress_special_reset(struct efx_nic *efx)
249{
250 int rc, reg;
251
252 EFX_TRACE(efx, "%s\n", __func__);
253
254 /* Initiate reset */
255 reg = mdio_clause45_read(efx, efx->mii.phy_id,
256 MDIO_MMD_PMAPMD, PMA_PMD_EXT_CTRL_REG);
257 reg |= (1 << PMA_PMD_EXT_SSR_LBN);
258 mdio_clause45_write(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD,
259 PMA_PMD_EXT_CTRL_REG, reg);
260
261 msleep(200);
262
263 /* Wait for the blocks to come out of reset */
264 rc = mdio_clause45_wait_reset_mmds(efx,
265 TENXPRESS_REQUIRED_DEVS);
266 if (rc < 0)
267 return rc;
268
269 /* Try and reconfigure the device */
270 rc = tenxpress_init(efx);
271 if (rc < 0)
272 return rc;
273
274 return 0;
275}
276
228static void tenxpress_set_bad_lp(struct efx_nic *efx, int bad_lp) 277static void tenxpress_set_bad_lp(struct efx_nic *efx, int bad_lp)
229{ 278{
230 struct tenxpress_phy_data *pd = efx->phy_data; 279 struct tenxpress_phy_data *pd = efx->phy_data;
@@ -299,11 +348,46 @@ static int tenxpress_link_ok(struct efx_nic *efx, int check_lp)
299 return ok; 348 return ok;
300} 349}
301 350
351static void tenxpress_phyxs_loopback(struct efx_nic *efx)
352{
353 int phy_id = efx->mii.phy_id;
354 int ctrl1, ctrl2;
355
356 ctrl1 = ctrl2 = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS,
357 PHYXS_TEST1);
358 if (efx->loopback_mode == LOOPBACK_PHYXS)
359 ctrl2 |= (1 << LOOPBACK_NEAR_LBN);
360 else
361 ctrl2 &= ~(1 << LOOPBACK_NEAR_LBN);
362 if (ctrl1 != ctrl2)
363 mdio_clause45_write(efx, phy_id, MDIO_MMD_PHYXS,
364 PHYXS_TEST1, ctrl2);
365}
366
302static void tenxpress_phy_reconfigure(struct efx_nic *efx) 367static void tenxpress_phy_reconfigure(struct efx_nic *efx)
303{ 368{
369 struct tenxpress_phy_data *phy_data = efx->phy_data;
370 int loop_change = LOOPBACK_OUT_OF(phy_data, efx,
371 TENXPRESS_LOOPBACKS);
372
304 if (!tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL)) 373 if (!tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL))
305 return; 374 return;
306 375
376 /* When coming out of transmit disable, coming out of low power
377 * mode, or moving out of any PHY internal loopback mode,
378 * perform a special software reset */
379 if ((phy_data->tx_disabled && !efx->tx_disabled) ||
380 loop_change) {
381 tenxpress_special_reset(efx);
382 falcon_reset_xaui(efx);
383 }
384
385 mdio_clause45_transmit_disable(efx);
386 mdio_clause45_phy_reconfigure(efx);
387 tenxpress_phyxs_loopback(efx);
388
389 phy_data->tx_disabled = efx->tx_disabled;
390 phy_data->loopback_mode = efx->loopback_mode;
307 efx->link_up = tenxpress_link_ok(efx, 0); 391 efx->link_up = tenxpress_link_ok(efx, 0);
308 efx->link_options = GM_LPA_10000FULL; 392 efx->link_options = GM_LPA_10000FULL;
309} 393}
@@ -431,4 +515,5 @@ struct efx_phy_operations falcon_tenxpress_phy_ops = {
431 .clear_interrupt = tenxpress_phy_clear_interrupt, 515 .clear_interrupt = tenxpress_phy_clear_interrupt,
432 .reset_xaui = tenxpress_reset_xaui, 516 .reset_xaui = tenxpress_reset_xaui,
433 .mmds = TENXPRESS_REQUIRED_DEVS, 517 .mmds = TENXPRESS_REQUIRED_DEVS,
518 .loopbacks = TENXPRESS_LOOPBACKS,
434}; 519};
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index fbb866b2185e..5cdd082ab8f6 100644
--- a/drivers/net/sfc/tx.c
+++ b/drivers/net/sfc/tx.c
@@ -82,6 +82,46 @@ static inline void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
82 } 82 }
83} 83}
84 84
85/**
86 * struct efx_tso_header - a DMA mapped buffer for packet headers
87 * @next: Linked list of free ones.
88 * The list is protected by the TX queue lock.
89 * @dma_unmap_len: Length to unmap for an oversize buffer, or 0.
90 * @dma_addr: The DMA address of the header below.
91 *
92 * This controls the memory used for a TSO header. Use TSOH_DATA()
93 * to find the packet header data. Use TSOH_SIZE() to calculate the
94 * total size required for a given packet header length. TSO headers
95 * in the free list are exactly %TSOH_STD_SIZE bytes in size.
96 */
97struct efx_tso_header {
98 union {
99 struct efx_tso_header *next;
100 size_t unmap_len;
101 };
102 dma_addr_t dma_addr;
103};
104
105static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
106 const struct sk_buff *skb);
107static void efx_fini_tso(struct efx_tx_queue *tx_queue);
108static void efx_tsoh_heap_free(struct efx_tx_queue *tx_queue,
109 struct efx_tso_header *tsoh);
110
111static inline void efx_tsoh_free(struct efx_tx_queue *tx_queue,
112 struct efx_tx_buffer *buffer)
113{
114 if (buffer->tsoh) {
115 if (likely(!buffer->tsoh->unmap_len)) {
116 buffer->tsoh->next = tx_queue->tso_headers_free;
117 tx_queue->tso_headers_free = buffer->tsoh;
118 } else {
119 efx_tsoh_heap_free(tx_queue, buffer->tsoh);
120 }
121 buffer->tsoh = NULL;
122 }
123}
124
85 125
86/* 126/*
87 * Add a socket buffer to a TX queue 127 * Add a socket buffer to a TX queue
@@ -114,6 +154,9 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
114 154
115 EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count); 155 EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count);
116 156
157 if (skb_shinfo((struct sk_buff *)skb)->gso_size)
158 return efx_enqueue_skb_tso(tx_queue, skb);
159
117 /* Get size of the initial fragment */ 160 /* Get size of the initial fragment */
118 len = skb_headlen(skb); 161 len = skb_headlen(skb);
119 162
@@ -166,6 +209,8 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
166 insert_ptr = (tx_queue->insert_count & 209 insert_ptr = (tx_queue->insert_count &
167 efx->type->txd_ring_mask); 210 efx->type->txd_ring_mask);
168 buffer = &tx_queue->buffer[insert_ptr]; 211 buffer = &tx_queue->buffer[insert_ptr];
212 efx_tsoh_free(tx_queue, buffer);
213 EFX_BUG_ON_PARANOID(buffer->tsoh);
169 EFX_BUG_ON_PARANOID(buffer->skb); 214 EFX_BUG_ON_PARANOID(buffer->skb);
170 EFX_BUG_ON_PARANOID(buffer->len); 215 EFX_BUG_ON_PARANOID(buffer->len);
171 EFX_BUG_ON_PARANOID(buffer->continuation != 1); 216 EFX_BUG_ON_PARANOID(buffer->continuation != 1);
@@ -342,7 +387,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
342 if (unlikely(tx_queue->stopped)) { 387 if (unlikely(tx_queue->stopped)) {
343 fill_level = tx_queue->insert_count - tx_queue->read_count; 388 fill_level = tx_queue->insert_count - tx_queue->read_count;
344 if (fill_level < EFX_NETDEV_TX_THRESHOLD(tx_queue)) { 389 if (fill_level < EFX_NETDEV_TX_THRESHOLD(tx_queue)) {
345 EFX_BUG_ON_PARANOID(!NET_DEV_REGISTERED(efx)); 390 EFX_BUG_ON_PARANOID(!efx_dev_registered(efx));
346 391
347 /* Do this under netif_tx_lock(), to avoid racing 392 /* Do this under netif_tx_lock(), to avoid racing
348 * with efx_xmit(). */ 393 * with efx_xmit(). */
@@ -432,6 +477,9 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue)
432 477
433 efx_release_tx_buffers(tx_queue); 478 efx_release_tx_buffers(tx_queue);
434 479
480 /* Free up TSO header cache */
481 efx_fini_tso(tx_queue);
482
435 /* Release queue's stop on port, if any */ 483 /* Release queue's stop on port, if any */
436 if (tx_queue->stopped) { 484 if (tx_queue->stopped) {
437 tx_queue->stopped = 0; 485 tx_queue->stopped = 0;
@@ -450,3 +498,622 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue)
450} 498}
451 499
452 500
501/* Efx TCP segmentation acceleration.
502 *
503 * Why? Because by doing it here in the driver we can go significantly
504 * faster than the GSO.
505 *
506 * Requires TX checksum offload support.
507 */
508
509/* Number of bytes inserted at the start of a TSO header buffer,
510 * similar to NET_IP_ALIGN.
511 */
512#if defined(__i386__) || defined(__x86_64__)
513#define TSOH_OFFSET 0
514#else
515#define TSOH_OFFSET NET_IP_ALIGN
516#endif
517
518#define TSOH_BUFFER(tsoh) ((u8 *)(tsoh + 1) + TSOH_OFFSET)
519
520/* Total size of struct efx_tso_header, buffer and padding */
521#define TSOH_SIZE(hdr_len) \
522 (sizeof(struct efx_tso_header) + TSOH_OFFSET + hdr_len)
523
524/* Size of blocks on free list. Larger blocks must be allocated from
525 * the heap.
526 */
527#define TSOH_STD_SIZE 128
528
529#define PTR_DIFF(p1, p2) ((u8 *)(p1) - (u8 *)(p2))
530#define ETH_HDR_LEN(skb) (skb_network_header(skb) - (skb)->data)
531#define SKB_TCP_OFF(skb) PTR_DIFF(tcp_hdr(skb), (skb)->data)
532#define SKB_IPV4_OFF(skb) PTR_DIFF(ip_hdr(skb), (skb)->data)
533
534/**
535 * struct tso_state - TSO state for an SKB
536 * @remaining_len: Bytes of data we've yet to segment
537 * @seqnum: Current sequence number
538 * @packet_space: Remaining space in current packet
539 * @ifc: Input fragment cursor.
540 * Where we are in the current fragment of the incoming SKB. These
541 * values get updated in place when we split a fragment over
542 * multiple packets.
543 * @p: Parameters.
544 * These values are set once at the start of the TSO send and do
545 * not get changed as the routine progresses.
546 *
547 * The state used during segmentation. It is put into this data structure
548 * just to make it easy to pass into inline functions.
549 */
550struct tso_state {
551 unsigned remaining_len;
552 unsigned seqnum;
553 unsigned packet_space;
554
555 struct {
556 /* DMA address of current position */
557 dma_addr_t dma_addr;
558 /* Remaining length */
559 unsigned int len;
560 /* DMA address and length of the whole fragment */
561 unsigned int unmap_len;
562 dma_addr_t unmap_addr;
563 struct page *page;
564 unsigned page_off;
565 } ifc;
566
567 struct {
568 /* The number of bytes of header */
569 unsigned int header_length;
570
571 /* The number of bytes to put in each outgoing segment. */
572 int full_packet_size;
573
574 /* Current IPv4 ID, host endian. */
575 unsigned ipv4_id;
576 } p;
577};
578
579
580/*
581 * Verify that our various assumptions about sk_buffs and the conditions
582 * under which TSO will be attempted hold true.
583 */
584static inline void efx_tso_check_safe(const struct sk_buff *skb)
585{
586 EFX_BUG_ON_PARANOID(skb->protocol != htons(ETH_P_IP));
587 EFX_BUG_ON_PARANOID(((struct ethhdr *)skb->data)->h_proto !=
588 skb->protocol);
589 EFX_BUG_ON_PARANOID(ip_hdr(skb)->protocol != IPPROTO_TCP);
590 EFX_BUG_ON_PARANOID((PTR_DIFF(tcp_hdr(skb), skb->data)
591 + (tcp_hdr(skb)->doff << 2u)) >
592 skb_headlen(skb));
593}
594
595
596/*
597 * Allocate a page worth of efx_tso_header structures, and string them
598 * into the tx_queue->tso_headers_free linked list. Return 0 or -ENOMEM.
599 */
600static int efx_tsoh_block_alloc(struct efx_tx_queue *tx_queue)
601{
602
603 struct pci_dev *pci_dev = tx_queue->efx->pci_dev;
604 struct efx_tso_header *tsoh;
605 dma_addr_t dma_addr;
606 u8 *base_kva, *kva;
607
608 base_kva = pci_alloc_consistent(pci_dev, PAGE_SIZE, &dma_addr);
609 if (base_kva == NULL) {
610 EFX_ERR(tx_queue->efx, "Unable to allocate page for TSO"
611 " headers\n");
612 return -ENOMEM;
613 }
614
615 /* pci_alloc_consistent() allocates pages. */
616 EFX_BUG_ON_PARANOID(dma_addr & (PAGE_SIZE - 1u));
617
618 for (kva = base_kva; kva < base_kva + PAGE_SIZE; kva += TSOH_STD_SIZE) {
619 tsoh = (struct efx_tso_header *)kva;
620 tsoh->dma_addr = dma_addr + (TSOH_BUFFER(tsoh) - base_kva);
621 tsoh->next = tx_queue->tso_headers_free;
622 tx_queue->tso_headers_free = tsoh;
623 }
624
625 return 0;
626}
627
628
629/* Free up a TSO header, and all others in the same page. */
630static void efx_tsoh_block_free(struct efx_tx_queue *tx_queue,
631 struct efx_tso_header *tsoh,
632 struct pci_dev *pci_dev)
633{
634 struct efx_tso_header **p;
635 unsigned long base_kva;
636 dma_addr_t base_dma;
637
638 base_kva = (unsigned long)tsoh & PAGE_MASK;
639 base_dma = tsoh->dma_addr & PAGE_MASK;
640
641 p = &tx_queue->tso_headers_free;
642 while (*p != NULL) {
643 if (((unsigned long)*p & PAGE_MASK) == base_kva)
644 *p = (*p)->next;
645 else
646 p = &(*p)->next;
647 }
648
649 pci_free_consistent(pci_dev, PAGE_SIZE, (void *)base_kva, base_dma);
650}
651
652static struct efx_tso_header *
653efx_tsoh_heap_alloc(struct efx_tx_queue *tx_queue, size_t header_len)
654{
655 struct efx_tso_header *tsoh;
656
657 tsoh = kmalloc(TSOH_SIZE(header_len), GFP_ATOMIC | GFP_DMA);
658 if (unlikely(!tsoh))
659 return NULL;
660
661 tsoh->dma_addr = pci_map_single(tx_queue->efx->pci_dev,
662 TSOH_BUFFER(tsoh), header_len,
663 PCI_DMA_TODEVICE);
664 if (unlikely(pci_dma_mapping_error(tsoh->dma_addr))) {
665 kfree(tsoh);
666 return NULL;
667 }
668
669 tsoh->unmap_len = header_len;
670 return tsoh;
671}
672
673static void
674efx_tsoh_heap_free(struct efx_tx_queue *tx_queue, struct efx_tso_header *tsoh)
675{
676 pci_unmap_single(tx_queue->efx->pci_dev,
677 tsoh->dma_addr, tsoh->unmap_len,
678 PCI_DMA_TODEVICE);
679 kfree(tsoh);
680}
681
682/**
683 * efx_tx_queue_insert - push descriptors onto the TX queue
684 * @tx_queue: Efx TX queue
685 * @dma_addr: DMA address of fragment
686 * @len: Length of fragment
687 * @skb: Only non-null for end of last segment
688 * @end_of_packet: True if last fragment in a packet
689 * @unmap_addr: DMA address of fragment for unmapping
690 * @unmap_len: Only set this in last segment of a fragment
691 *
692 * Push descriptors onto the TX queue. Return 0 on success or 1 if
693 * @tx_queue full.
694 */
695static int efx_tx_queue_insert(struct efx_tx_queue *tx_queue,
696 dma_addr_t dma_addr, unsigned len,
697 const struct sk_buff *skb, int end_of_packet,
698 dma_addr_t unmap_addr, unsigned unmap_len)
699{
700 struct efx_tx_buffer *buffer;
701 struct efx_nic *efx = tx_queue->efx;
702 unsigned dma_len, fill_level, insert_ptr, misalign;
703 int q_space;
704
705 EFX_BUG_ON_PARANOID(len <= 0);
706
707 fill_level = tx_queue->insert_count - tx_queue->old_read_count;
708 /* -1 as there is no way to represent all descriptors used */
709 q_space = efx->type->txd_ring_mask - 1 - fill_level;
710
711 while (1) {
712 if (unlikely(q_space-- <= 0)) {
713 /* It might be that completions have happened
714 * since the xmit path last checked. Update
715 * the xmit path's copy of read_count.
716 */
717 ++tx_queue->stopped;
718 /* This memory barrier protects the change of
719 * stopped from the access of read_count. */
720 smp_mb();
721 tx_queue->old_read_count =
722 *(volatile unsigned *)&tx_queue->read_count;
723 fill_level = (tx_queue->insert_count
724 - tx_queue->old_read_count);
725 q_space = efx->type->txd_ring_mask - 1 - fill_level;
726 if (unlikely(q_space-- <= 0))
727 return 1;
728 smp_mb();
729 --tx_queue->stopped;
730 }
731
732 insert_ptr = tx_queue->insert_count & efx->type->txd_ring_mask;
733 buffer = &tx_queue->buffer[insert_ptr];
734 ++tx_queue->insert_count;
735
736 EFX_BUG_ON_PARANOID(tx_queue->insert_count -
737 tx_queue->read_count >
738 efx->type->txd_ring_mask);
739
740 efx_tsoh_free(tx_queue, buffer);
741 EFX_BUG_ON_PARANOID(buffer->len);
742 EFX_BUG_ON_PARANOID(buffer->unmap_len);
743 EFX_BUG_ON_PARANOID(buffer->skb);
744 EFX_BUG_ON_PARANOID(buffer->continuation != 1);
745 EFX_BUG_ON_PARANOID(buffer->tsoh);
746
747 buffer->dma_addr = dma_addr;
748
749 /* Ensure we do not cross a boundary unsupported by H/W */
750 dma_len = (~dma_addr & efx->type->tx_dma_mask) + 1;
751
752 misalign = (unsigned)dma_addr & efx->type->bug5391_mask;
753 if (misalign && dma_len + misalign > 512)
754 dma_len = 512 - misalign;
755
756 /* If there is enough space to send then do so */
757 if (dma_len >= len)
758 break;
759
760 buffer->len = dma_len; /* Don't set the other members */
761 dma_addr += dma_len;
762 len -= dma_len;
763 }
764
765 EFX_BUG_ON_PARANOID(!len);
766 buffer->len = len;
767 buffer->skb = skb;
768 buffer->continuation = !end_of_packet;
769 buffer->unmap_addr = unmap_addr;
770 buffer->unmap_len = unmap_len;
771 return 0;
772}
773
774
775/*
776 * Put a TSO header into the TX queue.
777 *
778 * This is special-cased because we know that it is small enough to fit in
779 * a single fragment, and we know it doesn't cross a page boundary. It
780 * also allows us to not worry about end-of-packet etc.
781 */
782static inline void efx_tso_put_header(struct efx_tx_queue *tx_queue,
783 struct efx_tso_header *tsoh, unsigned len)
784{
785 struct efx_tx_buffer *buffer;
786
787 buffer = &tx_queue->buffer[tx_queue->insert_count &
788 tx_queue->efx->type->txd_ring_mask];
789 efx_tsoh_free(tx_queue, buffer);
790 EFX_BUG_ON_PARANOID(buffer->len);
791 EFX_BUG_ON_PARANOID(buffer->unmap_len);
792 EFX_BUG_ON_PARANOID(buffer->skb);
793 EFX_BUG_ON_PARANOID(buffer->continuation != 1);
794 EFX_BUG_ON_PARANOID(buffer->tsoh);
795 buffer->len = len;
796 buffer->dma_addr = tsoh->dma_addr;
797 buffer->tsoh = tsoh;
798
799 ++tx_queue->insert_count;
800}
801
802
803/* Remove descriptors put into a tx_queue. */
804static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
805{
806 struct efx_tx_buffer *buffer;
807
808 /* Work backwards until we hit the original insert pointer value */
809 while (tx_queue->insert_count != tx_queue->write_count) {
810 --tx_queue->insert_count;
811 buffer = &tx_queue->buffer[tx_queue->insert_count &
812 tx_queue->efx->type->txd_ring_mask];
813 efx_tsoh_free(tx_queue, buffer);
814 EFX_BUG_ON_PARANOID(buffer->skb);
815 buffer->len = 0;
816 buffer->continuation = 1;
817 if (buffer->unmap_len) {
818 pci_unmap_page(tx_queue->efx->pci_dev,
819 buffer->unmap_addr,
820 buffer->unmap_len, PCI_DMA_TODEVICE);
821 buffer->unmap_len = 0;
822 }
823 }
824}
825
826
827/* Parse the SKB header and initialise state. */
828static inline void tso_start(struct tso_state *st, const struct sk_buff *skb)
829{
830 /* All ethernet/IP/TCP headers combined size is TCP header size
831 * plus offset of TCP header relative to start of packet.
832 */
833 st->p.header_length = ((tcp_hdr(skb)->doff << 2u)
834 + PTR_DIFF(tcp_hdr(skb), skb->data));
835 st->p.full_packet_size = (st->p.header_length
836 + skb_shinfo(skb)->gso_size);
837
838 st->p.ipv4_id = ntohs(ip_hdr(skb)->id);
839 st->seqnum = ntohl(tcp_hdr(skb)->seq);
840
841 EFX_BUG_ON_PARANOID(tcp_hdr(skb)->urg);
842 EFX_BUG_ON_PARANOID(tcp_hdr(skb)->syn);
843 EFX_BUG_ON_PARANOID(tcp_hdr(skb)->rst);
844
845 st->packet_space = st->p.full_packet_size;
846 st->remaining_len = skb->len - st->p.header_length;
847}
848
849
850/**
851 * tso_get_fragment - record fragment details and map for DMA
852 * @st: TSO state
853 * @efx: Efx NIC
854 * @data: Pointer to fragment data
855 * @len: Length of fragment
856 *
857 * Record fragment details and map for DMA. Return 0 on success, or
858 * -%ENOMEM if DMA mapping fails.
859 */
860static inline int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
861 int len, struct page *page, int page_off)
862{
863
864 st->ifc.unmap_addr = pci_map_page(efx->pci_dev, page, page_off,
865 len, PCI_DMA_TODEVICE);
866 if (likely(!pci_dma_mapping_error(st->ifc.unmap_addr))) {
867 st->ifc.unmap_len = len;
868 st->ifc.len = len;
869 st->ifc.dma_addr = st->ifc.unmap_addr;
870 st->ifc.page = page;
871 st->ifc.page_off = page_off;
872 return 0;
873 }
874 return -ENOMEM;
875}
876
877
878/**
879 * tso_fill_packet_with_fragment - form descriptors for the current fragment
880 * @tx_queue: Efx TX queue
881 * @skb: Socket buffer
882 * @st: TSO state
883 *
884 * Form descriptors for the current fragment, until we reach the end
885 * of fragment or end-of-packet. Return 0 on success, 1 if not enough
886 * space in @tx_queue.
887 */
888static inline int tso_fill_packet_with_fragment(struct efx_tx_queue *tx_queue,
889 const struct sk_buff *skb,
890 struct tso_state *st)
891{
892
893 int n, end_of_packet, rc;
894
895 if (st->ifc.len == 0)
896 return 0;
897 if (st->packet_space == 0)
898 return 0;
899
900 EFX_BUG_ON_PARANOID(st->ifc.len <= 0);
901 EFX_BUG_ON_PARANOID(st->packet_space <= 0);
902
903 n = min(st->ifc.len, st->packet_space);
904
905 st->packet_space -= n;
906 st->remaining_len -= n;
907 st->ifc.len -= n;
908 st->ifc.page_off += n;
909 end_of_packet = st->remaining_len == 0 || st->packet_space == 0;
910
911 rc = efx_tx_queue_insert(tx_queue, st->ifc.dma_addr, n,
912 st->remaining_len ? NULL : skb,
913 end_of_packet, st->ifc.unmap_addr,
914 st->ifc.len ? 0 : st->ifc.unmap_len);
915
916 st->ifc.dma_addr += n;
917
918 return rc;
919}
920
921
922/**
923 * tso_start_new_packet - generate a new header and prepare for the new packet
924 * @tx_queue: Efx TX queue
925 * @skb: Socket buffer
926 * @st: TSO state
927 *
928 * Generate a new header and prepare for the new packet. Return 0 on
929 * success, or -1 if failed to alloc header.
930 */
931static inline int tso_start_new_packet(struct efx_tx_queue *tx_queue,
932 const struct sk_buff *skb,
933 struct tso_state *st)
934{
935 struct efx_tso_header *tsoh;
936 struct iphdr *tsoh_iph;
937 struct tcphdr *tsoh_th;
938 unsigned ip_length;
939 u8 *header;
940
941 /* Allocate a DMA-mapped header buffer. */
942 if (likely(TSOH_SIZE(st->p.header_length) <= TSOH_STD_SIZE)) {
943 if (tx_queue->tso_headers_free == NULL) {
944 if (efx_tsoh_block_alloc(tx_queue))
945 return -1;
946 }
947 EFX_BUG_ON_PARANOID(!tx_queue->tso_headers_free);
948 tsoh = tx_queue->tso_headers_free;
949 tx_queue->tso_headers_free = tsoh->next;
950 tsoh->unmap_len = 0;
951 } else {
952 tx_queue->tso_long_headers++;
953 tsoh = efx_tsoh_heap_alloc(tx_queue, st->p.header_length);
954 if (unlikely(!tsoh))
955 return -1;
956 }
957
958 header = TSOH_BUFFER(tsoh);
959 tsoh_th = (struct tcphdr *)(header + SKB_TCP_OFF(skb));
960 tsoh_iph = (struct iphdr *)(header + SKB_IPV4_OFF(skb));
961
962 /* Copy and update the headers. */
963 memcpy(header, skb->data, st->p.header_length);
964
965 tsoh_th->seq = htonl(st->seqnum);
966 st->seqnum += skb_shinfo(skb)->gso_size;
967 if (st->remaining_len > skb_shinfo(skb)->gso_size) {
968 /* This packet will not finish the TSO burst. */
969 ip_length = st->p.full_packet_size - ETH_HDR_LEN(skb);
970 tsoh_th->fin = 0;
971 tsoh_th->psh = 0;
972 } else {
973 /* This packet will be the last in the TSO burst. */
974 ip_length = (st->p.header_length - ETH_HDR_LEN(skb)
975 + st->remaining_len);
976 tsoh_th->fin = tcp_hdr(skb)->fin;
977 tsoh_th->psh = tcp_hdr(skb)->psh;
978 }
979 tsoh_iph->tot_len = htons(ip_length);
980
981 /* Linux leaves suitable gaps in the IP ID space for us to fill. */
982 tsoh_iph->id = htons(st->p.ipv4_id);
983 st->p.ipv4_id++;
984
985 st->packet_space = skb_shinfo(skb)->gso_size;
986 ++tx_queue->tso_packets;
987
988 /* Form a descriptor for this header. */
989 efx_tso_put_header(tx_queue, tsoh, st->p.header_length);
990
991 return 0;
992}
993
994
995/**
996 * efx_enqueue_skb_tso - segment and transmit a TSO socket buffer
997 * @tx_queue: Efx TX queue
998 * @skb: Socket buffer
999 *
1000 * Context: You must hold netif_tx_lock() to call this function.
1001 *
1002 * Add socket buffer @skb to @tx_queue, doing TSO or return != 0 if
1003 * @skb was not enqueued. In all cases @skb is consumed. Return
1004 * %NETDEV_TX_OK or %NETDEV_TX_BUSY.
1005 */
1006static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
1007 const struct sk_buff *skb)
1008{
1009 int frag_i, rc, rc2 = NETDEV_TX_OK;
1010 struct tso_state state;
1011 skb_frag_t *f;
1012
1013 /* Verify TSO is safe - these checks should never fail. */
1014 efx_tso_check_safe(skb);
1015
1016 EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count);
1017
1018 tso_start(&state, skb);
1019
1020 /* Assume that skb header area contains exactly the headers, and
1021 * all payload is in the frag list.
1022 */
1023 if (skb_headlen(skb) == state.p.header_length) {
1024 /* Grab the first payload fragment. */
1025 EFX_BUG_ON_PARANOID(skb_shinfo(skb)->nr_frags < 1);
1026 frag_i = 0;
1027 f = &skb_shinfo(skb)->frags[frag_i];
1028 rc = tso_get_fragment(&state, tx_queue->efx,
1029 f->size, f->page, f->page_offset);
1030 if (rc)
1031 goto mem_err;
1032 } else {
1033 /* It may look like this code fragment assumes that the
1034 * skb->data portion does not cross a page boundary, but
1035 * that is not the case. It is guaranteed to be direct
1036 * mapped memory, and therefore is physically contiguous,
1037 * and so DMA will work fine. kmap_atomic() on this region
1038 * will just return the direct mapping, so that will work
1039 * too.
1040 */
1041 int page_off = (unsigned long)skb->data & (PAGE_SIZE - 1);
1042 int hl = state.p.header_length;
1043 rc = tso_get_fragment(&state, tx_queue->efx,
1044 skb_headlen(skb) - hl,
1045 virt_to_page(skb->data), page_off + hl);
1046 if (rc)
1047 goto mem_err;
1048 frag_i = -1;
1049 }
1050
1051 if (tso_start_new_packet(tx_queue, skb, &state) < 0)
1052 goto mem_err;
1053
1054 while (1) {
1055 rc = tso_fill_packet_with_fragment(tx_queue, skb, &state);
1056 if (unlikely(rc))
1057 goto stop;
1058
1059 /* Move onto the next fragment? */
1060 if (state.ifc.len == 0) {
1061 if (++frag_i >= skb_shinfo(skb)->nr_frags)
1062 /* End of payload reached. */
1063 break;
1064 f = &skb_shinfo(skb)->frags[frag_i];
1065 rc = tso_get_fragment(&state, tx_queue->efx,
1066 f->size, f->page, f->page_offset);
1067 if (rc)
1068 goto mem_err;
1069 }
1070
1071 /* Start at new packet? */
1072 if (state.packet_space == 0 &&
1073 tso_start_new_packet(tx_queue, skb, &state) < 0)
1074 goto mem_err;
1075 }
1076
1077 /* Pass off to hardware */
1078 falcon_push_buffers(tx_queue);
1079
1080 tx_queue->tso_bursts++;
1081 return NETDEV_TX_OK;
1082
1083 mem_err:
1084 EFX_ERR(tx_queue->efx, "Out of memory for TSO headers, or PCI mapping"
1085 " error\n");
1086 dev_kfree_skb_any((struct sk_buff *)skb);
1087 goto unwind;
1088
1089 stop:
1090 rc2 = NETDEV_TX_BUSY;
1091
1092 /* Stop the queue if it wasn't stopped before. */
1093 if (tx_queue->stopped == 1)
1094 efx_stop_queue(tx_queue->efx);
1095
1096 unwind:
1097 efx_enqueue_unwind(tx_queue);
1098 return rc2;
1099}
1100
1101
1102/*
1103 * Free up all TSO datastructures associated with tx_queue. This
1104 * routine should be called only once the tx_queue is both empty and
1105 * will no longer be used.
1106 */
1107static void efx_fini_tso(struct efx_tx_queue *tx_queue)
1108{
1109 unsigned i;
1110
1111 if (tx_queue->buffer) {
1112 for (i = 0; i <= tx_queue->efx->type->txd_ring_mask; ++i)
1113 efx_tsoh_free(tx_queue, &tx_queue->buffer[i]);
1114 }
1115
1116 while (tx_queue->tso_headers_free != NULL)
1117 efx_tsoh_block_free(tx_queue, tx_queue->tso_headers_free,
1118 tx_queue->efx->pci_dev);
1119}
diff --git a/drivers/net/sfc/workarounds.h b/drivers/net/sfc/workarounds.h
index dca62f190198..35ab19c27f8d 100644
--- a/drivers/net/sfc/workarounds.h
+++ b/drivers/net/sfc/workarounds.h
@@ -16,7 +16,7 @@
16 */ 16 */
17 17
18#define EFX_WORKAROUND_ALWAYS(efx) 1 18#define EFX_WORKAROUND_ALWAYS(efx) 1
19#define EFX_WORKAROUND_FALCON_A(efx) (FALCON_REV(efx) <= FALCON_REV_A1) 19#define EFX_WORKAROUND_FALCON_A(efx) (falcon_rev(efx) <= FALCON_REV_A1)
20 20
21/* XAUI resets if link not detected */ 21/* XAUI resets if link not detected */
22#define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS 22#define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c
index 66dd5bf1eaa9..f3684ad28887 100644
--- a/drivers/net/sfc/xfp_phy.c
+++ b/drivers/net/sfc/xfp_phy.c
@@ -24,6 +24,10 @@
24 MDIO_MMDREG_DEVS0_PMAPMD | \ 24 MDIO_MMDREG_DEVS0_PMAPMD | \
25 MDIO_MMDREG_DEVS0_PHYXS) 25 MDIO_MMDREG_DEVS0_PHYXS)
26 26
27#define XFP_LOOPBACKS ((1 << LOOPBACK_PCS) | \
28 (1 << LOOPBACK_PMAPMD) | \
29 (1 << LOOPBACK_NETWORK))
30
27/****************************************************************************/ 31/****************************************************************************/
28/* Quake-specific MDIO registers */ 32/* Quake-specific MDIO registers */
29#define MDIO_QUAKE_LED0_REG (0xD006) 33#define MDIO_QUAKE_LED0_REG (0xD006)
@@ -35,6 +39,10 @@ void xfp_set_led(struct efx_nic *p, int led, int mode)
35 mode); 39 mode);
36} 40}
37 41
42struct xfp_phy_data {
43 int tx_disabled;
44};
45
38#define XFP_MAX_RESET_TIME 500 46#define XFP_MAX_RESET_TIME 500
39#define XFP_RESET_WAIT 10 47#define XFP_RESET_WAIT 10
40 48
@@ -72,18 +80,33 @@ static int xfp_reset_phy(struct efx_nic *efx)
72 80
73static int xfp_phy_init(struct efx_nic *efx) 81static int xfp_phy_init(struct efx_nic *efx)
74{ 82{
83 struct xfp_phy_data *phy_data;
75 u32 devid = mdio_clause45_read_id(efx, MDIO_MMD_PHYXS); 84 u32 devid = mdio_clause45_read_id(efx, MDIO_MMD_PHYXS);
76 int rc; 85 int rc;
77 86
87 phy_data = kzalloc(sizeof(struct xfp_phy_data), GFP_KERNEL);
88 if (!phy_data)
89 return -ENOMEM;
90 efx->phy_data = phy_data;
91
78 EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision" 92 EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision"
79 " %x)\n", devid, MDIO_ID_OUI(devid), MDIO_ID_MODEL(devid), 93 " %x)\n", devid, MDIO_ID_OUI(devid), MDIO_ID_MODEL(devid),
80 MDIO_ID_REV(devid)); 94 MDIO_ID_REV(devid));
81 95
96 phy_data->tx_disabled = efx->tx_disabled;
97
82 rc = xfp_reset_phy(efx); 98 rc = xfp_reset_phy(efx);
83 99
84 EFX_INFO(efx, "XFP: PHY init %s.\n", 100 EFX_INFO(efx, "XFP: PHY init %s.\n",
85 rc ? "failed" : "successful"); 101 rc ? "failed" : "successful");
102 if (rc < 0)
103 goto fail;
86 104
105 return 0;
106
107 fail:
108 kfree(efx->phy_data);
109 efx->phy_data = NULL;
87 return rc; 110 return rc;
88} 111}
89 112
@@ -110,6 +133,16 @@ static int xfp_phy_check_hw(struct efx_nic *efx)
110 133
111static void xfp_phy_reconfigure(struct efx_nic *efx) 134static void xfp_phy_reconfigure(struct efx_nic *efx)
112{ 135{
136 struct xfp_phy_data *phy_data = efx->phy_data;
137
138 /* Reset the PHY when moving from tx off to tx on */
139 if (phy_data->tx_disabled && !efx->tx_disabled)
140 xfp_reset_phy(efx);
141
142 mdio_clause45_transmit_disable(efx);
143 mdio_clause45_phy_reconfigure(efx);
144
145 phy_data->tx_disabled = efx->tx_disabled;
113 efx->link_up = xfp_link_ok(efx); 146 efx->link_up = xfp_link_ok(efx);
114 efx->link_options = GM_LPA_10000FULL; 147 efx->link_options = GM_LPA_10000FULL;
115} 148}
@@ -119,6 +152,10 @@ static void xfp_phy_fini(struct efx_nic *efx)
119{ 152{
120 /* Clobber the LED if it was blinking */ 153 /* Clobber the LED if it was blinking */
121 efx->board_info.blink(efx, 0); 154 efx->board_info.blink(efx, 0);
155
156 /* Free the context block */
157 kfree(efx->phy_data);
158 efx->phy_data = NULL;
122} 159}
123 160
124struct efx_phy_operations falcon_xfp_phy_ops = { 161struct efx_phy_operations falcon_xfp_phy_ops = {
@@ -129,4 +166,5 @@ struct efx_phy_operations falcon_xfp_phy_ops = {
129 .clear_interrupt = xfp_phy_clear_interrupt, 166 .clear_interrupt = xfp_phy_clear_interrupt,
130 .reset_xaui = efx_port_dummy_op_void, 167 .reset_xaui = efx_port_dummy_op_void,
131 .mmds = XFP_REQUIRED_DEVS, 168 .mmds = XFP_REQUIRED_DEVS,
169 .loopbacks = XFP_LOOPBACKS,
132}; 170};
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index f226bcac7d17..62436b3a18c6 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1159,17 +1159,9 @@ static int sky2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1159} 1159}
1160 1160
1161#ifdef SKY2_VLAN_TAG_USED 1161#ifdef SKY2_VLAN_TAG_USED
1162static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) 1162static void sky2_set_vlan_mode(struct sky2_hw *hw, u16 port, bool onoff)
1163{ 1163{
1164 struct sky2_port *sky2 = netdev_priv(dev); 1164 if (onoff) {
1165 struct sky2_hw *hw = sky2->hw;
1166 u16 port = sky2->port;
1167
1168 netif_tx_lock_bh(dev);
1169 napi_disable(&hw->napi);
1170
1171 sky2->vlgrp = grp;
1172 if (grp) {
1173 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), 1165 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1174 RX_VLAN_STRIP_ON); 1166 RX_VLAN_STRIP_ON);
1175 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), 1167 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
@@ -1180,6 +1172,19 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
1180 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), 1172 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1181 TX_VLAN_TAG_OFF); 1173 TX_VLAN_TAG_OFF);
1182 } 1174 }
1175}
1176
1177static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
1178{
1179 struct sky2_port *sky2 = netdev_priv(dev);
1180 struct sky2_hw *hw = sky2->hw;
1181 u16 port = sky2->port;
1182
1183 netif_tx_lock_bh(dev);
1184 napi_disable(&hw->napi);
1185
1186 sky2->vlgrp = grp;
1187 sky2_set_vlan_mode(hw, port, grp != NULL);
1183 1188
1184 sky2_read32(hw, B0_Y2_SP_LISR); 1189 sky2_read32(hw, B0_Y2_SP_LISR);
1185 napi_enable(&hw->napi); 1190 napi_enable(&hw->napi);
@@ -1418,6 +1423,10 @@ static int sky2_up(struct net_device *dev)
1418 sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, 1423 sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map,
1419 TX_RING_SIZE - 1); 1424 TX_RING_SIZE - 1);
1420 1425
1426#ifdef SKY2_VLAN_TAG_USED
1427 sky2_set_vlan_mode(hw, port, sky2->vlgrp != NULL);
1428#endif
1429
1421 err = sky2_rx_start(sky2); 1430 err = sky2_rx_start(sky2);
1422 if (err) 1431 if (err)
1423 goto err_out; 1432 goto err_out;
@@ -4395,7 +4404,9 @@ static int sky2_resume(struct pci_dev *pdev)
4395 if (err) { 4404 if (err) {
4396 printk(KERN_ERR PFX "%s: could not up: %d\n", 4405 printk(KERN_ERR PFX "%s: could not up: %d\n",
4397 dev->name, err); 4406 dev->name, err);
4407 rtnl_lock();
4398 dev_close(dev); 4408 dev_close(dev);
4409 rtnl_unlock();
4399 goto out; 4410 goto out;
4400 } 4411 }
4401 } 4412 }
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 7bb3ba9bcbd8..c0a5eea20007 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1966,13 +1966,13 @@ struct sky2_status_le {
1966struct tx_ring_info { 1966struct tx_ring_info {
1967 struct sk_buff *skb; 1967 struct sk_buff *skb;
1968 DECLARE_PCI_UNMAP_ADDR(mapaddr); 1968 DECLARE_PCI_UNMAP_ADDR(mapaddr);
1969 DECLARE_PCI_UNMAP_ADDR(maplen); 1969 DECLARE_PCI_UNMAP_LEN(maplen);
1970}; 1970};
1971 1971
1972struct rx_ring_info { 1972struct rx_ring_info {
1973 struct sk_buff *skb; 1973 struct sk_buff *skb;
1974 dma_addr_t data_addr; 1974 dma_addr_t data_addr;
1975 DECLARE_PCI_UNMAP_ADDR(data_size); 1975 DECLARE_PCI_UNMAP_LEN(data_size);
1976 dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT]; 1976 dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
1977}; 1977};
1978 1978
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 4e2800205189..e2ee91a6ae7e 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -136,7 +136,6 @@ struct smc911x_local {
136 136
137 /* work queue */ 137 /* work queue */
138 struct work_struct phy_configure; 138 struct work_struct phy_configure;
139 int work_pending;
140 139
141 int tx_throttle; 140 int tx_throttle;
142 spinlock_t lock; 141 spinlock_t lock;
@@ -960,11 +959,11 @@ static void smc911x_phy_configure(struct work_struct *work)
960 * We should not be called if phy_type is zero. 959 * We should not be called if phy_type is zero.
961 */ 960 */
962 if (lp->phy_type == 0) 961 if (lp->phy_type == 0)
963 goto smc911x_phy_configure_exit_nolock; 962 return;
964 963
965 if (smc911x_phy_reset(dev, phyaddr)) { 964 if (smc911x_phy_reset(dev, phyaddr)) {
966 printk("%s: PHY reset timed out\n", dev->name); 965 printk("%s: PHY reset timed out\n", dev->name);
967 goto smc911x_phy_configure_exit_nolock; 966 return;
968 } 967 }
969 spin_lock_irqsave(&lp->lock, flags); 968 spin_lock_irqsave(&lp->lock, flags);
970 969
@@ -1033,8 +1032,6 @@ static void smc911x_phy_configure(struct work_struct *work)
1033 1032
1034smc911x_phy_configure_exit: 1033smc911x_phy_configure_exit:
1035 spin_unlock_irqrestore(&lp->lock, flags); 1034 spin_unlock_irqrestore(&lp->lock, flags);
1036smc911x_phy_configure_exit_nolock:
1037 lp->work_pending = 0;
1038} 1035}
1039 1036
1040/* 1037/*
@@ -1356,11 +1353,8 @@ static void smc911x_timeout(struct net_device *dev)
1356 * smc911x_phy_configure() calls msleep() which calls schedule_timeout() 1353 * smc911x_phy_configure() calls msleep() which calls schedule_timeout()
1357 * which calls schedule(). Hence we use a work queue. 1354 * which calls schedule(). Hence we use a work queue.
1358 */ 1355 */
1359 if (lp->phy_type != 0) { 1356 if (lp->phy_type != 0)
1360 if (schedule_work(&lp->phy_configure)) { 1357 schedule_work(&lp->phy_configure);
1361 lp->work_pending = 1;
1362 }
1363 }
1364 1358
1365 /* We can accept TX packets again */ 1359 /* We can accept TX packets again */
1366 dev->trans_start = jiffies; 1360 dev->trans_start = jiffies;
@@ -1531,16 +1525,8 @@ static int smc911x_close(struct net_device *dev)
1531 if (lp->phy_type != 0) { 1525 if (lp->phy_type != 0) {
1532 /* We need to ensure that no calls to 1526 /* We need to ensure that no calls to
1533 * smc911x_phy_configure are pending. 1527 * smc911x_phy_configure are pending.
1534
1535 * flush_scheduled_work() cannot be called because we
1536 * are running with the netlink semaphore held (from
1537 * devinet_ioctl()) and the pending work queue
1538 * contains linkwatch_event() (scheduled by
1539 * netif_carrier_off() above). linkwatch_event() also
1540 * wants the netlink semaphore.
1541 */ 1528 */
1542 while (lp->work_pending) 1529 cancel_work_sync(&lp->phy_configure);
1543 schedule();
1544 smc911x_phy_powerdown(dev, lp->mii.phy_id); 1530 smc911x_phy_powerdown(dev, lp->mii.phy_id);
1545 } 1531 }
1546 1532
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index a188e33484e6..f2051b209da2 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1016,15 +1016,8 @@ static void smc_phy_powerdown(struct net_device *dev)
1016 1016
1017 /* We need to ensure that no calls to smc_phy_configure are 1017 /* We need to ensure that no calls to smc_phy_configure are
1018 pending. 1018 pending.
1019
1020 flush_scheduled_work() cannot be called because we are
1021 running with the netlink semaphore held (from
1022 devinet_ioctl()) and the pending work queue contains
1023 linkwatch_event() (scheduled by netif_carrier_off()
1024 above). linkwatch_event() also wants the netlink semaphore.
1025 */ 1019 */
1026 while(lp->work_pending) 1020 cancel_work_sync(&lp->phy_configure);
1027 yield();
1028 1021
1029 bmcr = smc_phy_read(dev, phy, MII_BMCR); 1022 bmcr = smc_phy_read(dev, phy, MII_BMCR);
1030 smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN); 1023 smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN);
@@ -1161,7 +1154,6 @@ static void smc_phy_configure(struct work_struct *work)
1161smc_phy_configure_exit: 1154smc_phy_configure_exit:
1162 SMC_SELECT_BANK(lp, 2); 1155 SMC_SELECT_BANK(lp, 2);
1163 spin_unlock_irq(&lp->lock); 1156 spin_unlock_irq(&lp->lock);
1164 lp->work_pending = 0;
1165} 1157}
1166 1158
1167/* 1159/*
@@ -1389,11 +1381,8 @@ static void smc_timeout(struct net_device *dev)
1389 * smc_phy_configure() calls msleep() which calls schedule_timeout() 1381 * smc_phy_configure() calls msleep() which calls schedule_timeout()
1390 * which calls schedule(). Hence we use a work queue. 1382 * which calls schedule(). Hence we use a work queue.
1391 */ 1383 */
1392 if (lp->phy_type != 0) { 1384 if (lp->phy_type != 0)
1393 if (schedule_work(&lp->phy_configure)) { 1385 schedule_work(&lp->phy_configure);
1394 lp->work_pending = 1;
1395 }
1396 }
1397 1386
1398 /* We can accept TX packets again */ 1387 /* We can accept TX packets again */
1399 dev->trans_start = jiffies; 1388 dev->trans_start = jiffies;
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 69e97a1cb1c4..8606818653f8 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -93,14 +93,14 @@
93#define SMC_insw(a, r, p, l) insw ((unsigned long *)((a) + (r)), p, l) 93#define SMC_insw(a, r, p, l) insw ((unsigned long *)((a) + (r)), p, l)
94# endif 94# endif
95/* check if the mac in reg is valid */ 95/* check if the mac in reg is valid */
96#define SMC_GET_MAC_ADDR(addr) \ 96#define SMC_GET_MAC_ADDR(lp, addr) \
97 do { \ 97 do { \
98 unsigned int __v; \ 98 unsigned int __v; \
99 __v = SMC_inw(ioaddr, ADDR0_REG); \ 99 __v = SMC_inw(ioaddr, ADDR0_REG(lp)); \
100 addr[0] = __v; addr[1] = __v >> 8; \ 100 addr[0] = __v; addr[1] = __v >> 8; \
101 __v = SMC_inw(ioaddr, ADDR1_REG); \ 101 __v = SMC_inw(ioaddr, ADDR1_REG(lp)); \
102 addr[2] = __v; addr[3] = __v >> 8; \ 102 addr[2] = __v; addr[3] = __v >> 8; \
103 __v = SMC_inw(ioaddr, ADDR2_REG); \ 103 __v = SMC_inw(ioaddr, ADDR2_REG(lp)); \
104 addr[4] = __v; addr[5] = __v >> 8; \ 104 addr[4] = __v; addr[5] = __v >> 8; \
105 if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) { \ 105 if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) { \
106 random_ether_addr(addr); \ 106 random_ether_addr(addr); \
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index f8d46134daca..359452a06c67 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -250,6 +250,9 @@ struct net_device * __init sun3lance_probe(int unit)
250 static int found; 250 static int found;
251 int err = -ENODEV; 251 int err = -ENODEV;
252 252
253 if (!MACH_IS_SUN3 && !MACH_IS_SUN3X)
254 return ERR_PTR(-ENODEV);
255
253 /* check that this machine has an onboard lance */ 256 /* check that this machine has an onboard lance */
254 switch(idprom->id_machtype) { 257 switch(idprom->id_machtype) {
255 case SM_SUN3|SM_3_50: 258 case SM_SUN3|SM_3_50:
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index b4e7f30ea4e8..1aa425be3067 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -111,7 +111,7 @@ static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigne
111 struct hme_tx_logent *tlp; 111 struct hme_tx_logent *tlp;
112 unsigned long flags; 112 unsigned long flags;
113 113
114 save_and_cli(flags); 114 local_irq_save(flags);
115 tlp = &tx_log[txlog_cur_entry]; 115 tlp = &tx_log[txlog_cur_entry];
116 tlp->tstamp = (unsigned int)jiffies; 116 tlp->tstamp = (unsigned int)jiffies;
117 tlp->tx_new = hp->tx_new; 117 tlp->tx_new = hp->tx_new;
@@ -119,7 +119,7 @@ static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigne
119 tlp->action = a; 119 tlp->action = a;
120 tlp->status = s; 120 tlp->status = s;
121 txlog_cur_entry = (txlog_cur_entry + 1) & (TX_LOG_LEN - 1); 121 txlog_cur_entry = (txlog_cur_entry + 1) & (TX_LOG_LEN - 1);
122 restore_flags(flags); 122 local_irq_restore(flags);
123} 123}
124static __inline__ void tx_dump_log(void) 124static __inline__ void tx_dump_log(void)
125{ 125{
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 07b3f77e7626..cc4bde852542 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.92" 67#define DRV_MODULE_VERSION "3.92.1"
68#define DRV_MODULE_RELDATE "May 2, 2008" 68#define DRV_MODULE_RELDATE "June 9, 2008"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -1295,6 +1295,21 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1295 GRC_LCLCTRL_GPIO_OUTPUT0 | 1295 GRC_LCLCTRL_GPIO_OUTPUT0 |
1296 GRC_LCLCTRL_GPIO_OUTPUT1), 1296 GRC_LCLCTRL_GPIO_OUTPUT1),
1297 100); 1297 100);
1298 } else if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) {
1299 /* The 5761 non-e device swaps GPIO 0 and GPIO 2. */
1300 u32 grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 |
1301 GRC_LCLCTRL_GPIO_OE1 |
1302 GRC_LCLCTRL_GPIO_OE2 |
1303 GRC_LCLCTRL_GPIO_OUTPUT0 |
1304 GRC_LCLCTRL_GPIO_OUTPUT1 |
1305 tp->grc_local_ctrl;
1306 tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100);
1307
1308 grc_local_ctrl |= GRC_LCLCTRL_GPIO_OUTPUT2;
1309 tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100);
1310
1311 grc_local_ctrl &= ~GRC_LCLCTRL_GPIO_OUTPUT0;
1312 tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100);
1298 } else { 1313 } else {
1299 u32 no_gpio2; 1314 u32 no_gpio2;
1300 u32 grc_local_ctrl = 0; 1315 u32 grc_local_ctrl = 0;
@@ -3168,8 +3183,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
3168 err |= tg3_readphy(tp, MII_BMCR, &bmcr); 3183 err |= tg3_readphy(tp, MII_BMCR, &bmcr);
3169 3184
3170 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset && 3185 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset &&
3171 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && 3186 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) {
3172 tp->link_config.flowctrl == tp->link_config.active_flowctrl) {
3173 /* do nothing, just check for link up at the end */ 3187 /* do nothing, just check for link up at the end */
3174 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) { 3188 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) {
3175 u32 adv, new_adv; 3189 u32 adv, new_adv;
@@ -8599,7 +8613,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
8599 (cmd->speed == SPEED_1000)) 8613 (cmd->speed == SPEED_1000))
8600 return -EINVAL; 8614 return -EINVAL;
8601 else if ((cmd->speed == SPEED_1000) && 8615 else if ((cmd->speed == SPEED_1000) &&
8602 (tp->tg3_flags2 & TG3_FLAG_10_100_ONLY)) 8616 (tp->tg3_flags & TG3_FLAG_10_100_ONLY))
8603 return -EINVAL; 8617 return -EINVAL;
8604 8618
8605 tg3_full_lock(tp, 0); 8619 tg3_full_lock(tp, 0);
@@ -11768,6 +11782,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11768 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) 11782 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
11769 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; 11783 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
11770 11784
11785 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) {
11786 /* Turn off the debug UART. */
11787 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
11788 if (tp->tg3_flags2 & TG3_FLG2_IS_NIC)
11789 /* Keep VMain power. */
11790 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE0 |
11791 GRC_LCLCTRL_GPIO_OUTPUT0;
11792 }
11793
11771 /* Force the chip into D0. */ 11794 /* Force the chip into D0. */
11772 err = tg3_set_power_state(tp, PCI_D0); 11795 err = tg3_set_power_state(tp, PCI_D0);
11773 if (err) { 11796 if (err) {
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h
index b880cba0f6fd..74cf8e1a181b 100644
--- a/drivers/net/tokenring/3c359.h
+++ b/drivers/net/tokenring/3c359.h
@@ -264,7 +264,7 @@ struct xl_private {
264 u16 asb; 264 u16 asb;
265 265
266 u8 __iomem *xl_mmio; 266 u8 __iomem *xl_mmio;
267 char *xl_card_name; 267 const char *xl_card_name;
268 struct pci_dev *pdev ; 268 struct pci_dev *pdev ;
269 269
270 spinlock_t xl_lock ; 270 spinlock_t xl_lock ;
diff --git a/drivers/net/tokenring/olympic.h b/drivers/net/tokenring/olympic.h
index c91956310fb2..10fbba08978f 100644
--- a/drivers/net/tokenring/olympic.h
+++ b/drivers/net/tokenring/olympic.h
@@ -254,7 +254,7 @@ struct olympic_private {
254 u8 __iomem *olympic_mmio; 254 u8 __iomem *olympic_mmio;
255 u8 __iomem *olympic_lap; 255 u8 __iomem *olympic_lap;
256 struct pci_dev *pdev ; 256 struct pci_dev *pdev ;
257 char *olympic_card_name ; 257 const char *olympic_card_name;
258 258
259 spinlock_t olympic_lock ; 259 spinlock_t olympic_lock ;
260 260
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index f9d13fa05d64..af8d2c436efd 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -731,7 +731,7 @@ static void tulip_down (struct net_device *dev)
731 void __iomem *ioaddr = tp->base_addr; 731 void __iomem *ioaddr = tp->base_addr;
732 unsigned long flags; 732 unsigned long flags;
733 733
734 flush_scheduled_work(); 734 cancel_work_sync(&tp->media_work);
735 735
736#ifdef CONFIG_TULIP_NAPI 736#ifdef CONFIG_TULIP_NAPI
737 napi_disable(&tp->napi); 737 napi_disable(&tp->napi);
@@ -1729,12 +1729,15 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
1729 if (!dev) 1729 if (!dev)
1730 return -EINVAL; 1730 return -EINVAL;
1731 1731
1732 if (netif_running(dev)) 1732 if (!netif_running(dev))
1733 tulip_down(dev); 1733 goto save_state;
1734
1735 tulip_down(dev);
1734 1736
1735 netif_device_detach(dev); 1737 netif_device_detach(dev);
1736 free_irq(dev->irq, dev); 1738 free_irq(dev->irq, dev);
1737 1739
1740save_state:
1738 pci_save_state(pdev); 1741 pci_save_state(pdev);
1739 pci_disable_device(pdev); 1742 pci_disable_device(pdev);
1740 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1743 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1754,6 +1757,9 @@ static int tulip_resume(struct pci_dev *pdev)
1754 pci_set_power_state(pdev, PCI_D0); 1757 pci_set_power_state(pdev, PCI_D0);
1755 pci_restore_state(pdev); 1758 pci_restore_state(pdev);
1756 1759
1760 if (!netif_running(dev))
1761 return 0;
1762
1757 if ((retval = pci_enable_device(pdev))) { 1763 if ((retval = pci_enable_device(pdev))) {
1758 printk (KERN_ERR "tulip: pci_enable_device failed in resume\n"); 1764 printk (KERN_ERR "tulip: pci_enable_device failed in resume\n");
1759 return retval; 1765 return retval;
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 2511ca7a12aa..e9e628621639 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -225,6 +225,9 @@ static void uli526x_set_filter_mode(struct net_device *);
225static const struct ethtool_ops netdev_ethtool_ops; 225static const struct ethtool_ops netdev_ethtool_ops;
226static u16 read_srom_word(long, int); 226static u16 read_srom_word(long, int);
227static irqreturn_t uli526x_interrupt(int, void *); 227static irqreturn_t uli526x_interrupt(int, void *);
228#ifdef CONFIG_NET_POLL_CONTROLLER
229static void uli526x_poll(struct net_device *dev);
230#endif
228static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); 231static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long);
229static void allocate_rx_buffer(struct uli526x_board_info *); 232static void allocate_rx_buffer(struct uli526x_board_info *);
230static void update_cr6(u32, unsigned long); 233static void update_cr6(u32, unsigned long);
@@ -339,6 +342,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
339 dev->get_stats = &uli526x_get_stats; 342 dev->get_stats = &uli526x_get_stats;
340 dev->set_multicast_list = &uli526x_set_filter_mode; 343 dev->set_multicast_list = &uli526x_set_filter_mode;
341 dev->ethtool_ops = &netdev_ethtool_ops; 344 dev->ethtool_ops = &netdev_ethtool_ops;
345#ifdef CONFIG_NET_POLL_CONTROLLER
346 dev->poll_controller = &uli526x_poll;
347#endif
342 spin_lock_init(&db->lock); 348 spin_lock_init(&db->lock);
343 349
344 350
@@ -681,8 +687,9 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id)
681 db->cr5_data = inl(ioaddr + DCR5); 687 db->cr5_data = inl(ioaddr + DCR5);
682 outl(db->cr5_data, ioaddr + DCR5); 688 outl(db->cr5_data, ioaddr + DCR5);
683 if ( !(db->cr5_data & 0x180c1) ) { 689 if ( !(db->cr5_data & 0x180c1) ) {
684 spin_unlock_irqrestore(&db->lock, flags); 690 /* Restore CR7 to enable interrupt mask */
685 outl(db->cr7_data, ioaddr + DCR7); 691 outl(db->cr7_data, ioaddr + DCR7);
692 spin_unlock_irqrestore(&db->lock, flags);
686 return IRQ_HANDLED; 693 return IRQ_HANDLED;
687 } 694 }
688 695
@@ -715,6 +722,13 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id)
715 return IRQ_HANDLED; 722 return IRQ_HANDLED;
716} 723}
717 724
725#ifdef CONFIG_NET_POLL_CONTROLLER
726static void uli526x_poll(struct net_device *dev)
727{
728 /* ISR grabs the irqsave lock, so this should be safe */
729 uli526x_interrupt(dev->irq, dev);
730}
731#endif
718 732
719/* 733/*
720 * Free TX resource after TX complete 734 * Free TX resource after TX complete
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index ca0bdac07a78..fb0b918e5ccb 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -237,7 +237,7 @@ static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth,
237 skb->dev = ugeth->dev; 237 skb->dev = ugeth->dev;
238 238
239 out_be32(&((struct qe_bd __iomem *)bd)->buf, 239 out_be32(&((struct qe_bd __iomem *)bd)->buf,
240 dma_map_single(NULL, 240 dma_map_single(&ugeth->dev->dev,
241 skb->data, 241 skb->data,
242 ugeth->ug_info->uf_info.max_rx_buf_length + 242 ugeth->ug_info->uf_info.max_rx_buf_length +
243 UCC_GETH_RX_DATA_BUF_ALIGNMENT, 243 UCC_GETH_RX_DATA_BUF_ALIGNMENT,
@@ -2158,7 +2158,7 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
2158 continue; 2158 continue;
2159 for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { 2159 for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) {
2160 if (ugeth->tx_skbuff[i][j]) { 2160 if (ugeth->tx_skbuff[i][j]) {
2161 dma_unmap_single(NULL, 2161 dma_unmap_single(&ugeth->dev->dev,
2162 in_be32(&((struct qe_bd __iomem *)bd)->buf), 2162 in_be32(&((struct qe_bd __iomem *)bd)->buf),
2163 (in_be32((u32 __iomem *)bd) & 2163 (in_be32((u32 __iomem *)bd) &
2164 BD_LENGTH_MASK), 2164 BD_LENGTH_MASK),
@@ -2186,7 +2186,7 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
2186 bd = ugeth->p_rx_bd_ring[i]; 2186 bd = ugeth->p_rx_bd_ring[i];
2187 for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { 2187 for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) {
2188 if (ugeth->rx_skbuff[i][j]) { 2188 if (ugeth->rx_skbuff[i][j]) {
2189 dma_unmap_single(NULL, 2189 dma_unmap_single(&ugeth->dev->dev,
2190 in_be32(&((struct qe_bd __iomem *)bd)->buf), 2190 in_be32(&((struct qe_bd __iomem *)bd)->buf),
2191 ugeth->ug_info-> 2191 ugeth->ug_info->
2192 uf_info.max_rx_buf_length + 2192 uf_info.max_rx_buf_length +
@@ -3406,7 +3406,8 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3406 3406
3407 /* set up the buffer descriptor */ 3407 /* set up the buffer descriptor */
3408 out_be32(&((struct qe_bd __iomem *)bd)->buf, 3408 out_be32(&((struct qe_bd __iomem *)bd)->buf,
3409 dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE)); 3409 dma_map_single(&ugeth->dev->dev, skb->data,
3410 skb->len, DMA_TO_DEVICE));
3410 3411
3411 /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */ 3412 /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */
3412 3413
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 299b7f176950..f5839c4a5cbd 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -73,6 +73,7 @@ static char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = {
73 "tx-frames-ok", 73 "tx-frames-ok",
74 "tx-excessive-differ-frames", 74 "tx-excessive-differ-frames",
75 "tx-256-511-frames", 75 "tx-256-511-frames",
76 "tx-512-1023-frames",
76 "tx-1024-1518-frames", 77 "tx-1024-1518-frames",
77 "tx-jumbo-frames", 78 "tx-jumbo-frames",
78}; 79};
@@ -308,7 +309,7 @@ static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
308 buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN; 309 buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN;
309 } 310 }
310 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) 311 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX)
311 memcpy(buf, tx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN * 312 memcpy(buf, rx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN *
312 ETH_GSTRING_LEN); 313 ETH_GSTRING_LEN);
313} 314}
314 315
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index dc6f097062df..37ecf845edfe 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1440,6 +1440,10 @@ static const struct usb_device_id products [] = {
1440 // Belkin F5D5055 1440 // Belkin F5D5055
1441 USB_DEVICE(0x050d, 0x5055), 1441 USB_DEVICE(0x050d, 0x5055),
1442 .driver_info = (unsigned long) &ax88178_info, 1442 .driver_info = (unsigned long) &ax88178_info,
1443}, {
1444 // Apple USB Ethernet Adapter
1445 USB_DEVICE(0x05ac, 0x1402),
1446 .driver_info = (unsigned long) &ax88772_info,
1443}, 1447},
1444 { }, // END 1448 { }, // END
1445}; 1449};
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 76752d84a30f..22c17bbacb69 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -423,7 +423,10 @@ static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
423 423
424 catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6; 424 catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6;
425 tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr; 425 tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr;
426 *((u16*)tx_buf) = (catc->is_f5u011) ? cpu_to_be16((u16)skb->len) : cpu_to_le16((u16)skb->len); 426 if (catc->is_f5u011)
427 *(__be16 *)tx_buf = cpu_to_be16(skb->len);
428 else
429 *(__le16 *)tx_buf = cpu_to_le16(skb->len);
427 skb_copy_from_linear_data(skb, tx_buf + 2, skb->len); 430 skb_copy_from_linear_data(skb, tx_buf + 2, skb->len);
428 catc->tx_ptr += skb->len + 2; 431 catc->tx_ptr += skb->len + 2;
429 432
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index 0ec7936cbe21..c66b9c324f54 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -218,7 +218,7 @@ static const struct driver_info blob_info = {
218/*-------------------------------------------------------------------------*/ 218/*-------------------------------------------------------------------------*/
219 219
220#ifndef HAVE_HARDWARE 220#ifndef HAVE_HARDWARE
221#error You need to configure some hardware for this driver 221#warning You need to configure some hardware for this driver
222#endif 222#endif
223 223
224/* 224/*
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 0dcfc0310264..7c66b052f55a 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -706,7 +706,7 @@ static void kaweth_kill_urbs(struct kaweth_device *kaweth)
706 usb_kill_urb(kaweth->rx_urb); 706 usb_kill_urb(kaweth->rx_urb);
707 usb_kill_urb(kaweth->tx_urb); 707 usb_kill_urb(kaweth->tx_urb);
708 708
709 flush_scheduled_work(); 709 cancel_delayed_work_sync(&kaweth->lowmem_work);
710 710
711 /* a scheduled work may have resubmitted, 711 /* a scheduled work may have resubmitted,
712 we hit them again */ 712 we hit them again */
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 21a7785cb8b6..ae467f182c40 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -194,7 +194,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
194 dev_dbg(&info->control->dev, 194 dev_dbg(&info->control->dev,
195 "rndis response error, code %d\n", retval); 195 "rndis response error, code %d\n", retval);
196 } 196 }
197 msleep(2); 197 msleep(20);
198 } 198 }
199 dev_dbg(&info->control->dev, "rndis response timeout\n"); 199 dev_dbg(&info->control->dev, "rndis response timeout\n");
200 return -ETIMEDOUT; 200 return -ETIMEDOUT;
@@ -283,8 +283,8 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
283 struct rndis_set_c *set_c; 283 struct rndis_set_c *set_c;
284 struct rndis_halt *halt; 284 struct rndis_halt *halt;
285 } u; 285 } u;
286 u32 tmp, phym_unspec; 286 u32 tmp;
287 __le32 *phym; 287 __le32 phym_unspec, *phym;
288 int reply_len; 288 int reply_len;
289 unsigned char *bp; 289 unsigned char *bp;
290 290
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index f926b5ab3d09..4452306d5328 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -44,9 +44,16 @@ struct virtnet_info
44 /* The skb we couldn't send because buffers were full. */ 44 /* The skb we couldn't send because buffers were full. */
45 struct sk_buff *last_xmit_skb; 45 struct sk_buff *last_xmit_skb;
46 46
47 /* If we need to free in a timer, this is it. */
48 struct timer_list xmit_free_timer;
49
47 /* Number of input buffers, and max we've ever had. */ 50 /* Number of input buffers, and max we've ever had. */
48 unsigned int num, max; 51 unsigned int num, max;
49 52
53 /* For cleaning up after transmission. */
54 struct tasklet_struct tasklet;
55 bool free_in_tasklet;
56
50 /* Receive & send queues. */ 57 /* Receive & send queues. */
51 struct sk_buff_head recv; 58 struct sk_buff_head recv;
52 struct sk_buff_head send; 59 struct sk_buff_head send;
@@ -68,8 +75,13 @@ static void skb_xmit_done(struct virtqueue *svq)
68 75
69 /* Suppress further interrupts. */ 76 /* Suppress further interrupts. */
70 svq->vq_ops->disable_cb(svq); 77 svq->vq_ops->disable_cb(svq);
71 /* We were waiting for more output buffers. */ 78
79 /* We were probably waiting for more output buffers. */
72 netif_wake_queue(vi->dev); 80 netif_wake_queue(vi->dev);
81
82 /* Make sure we re-xmit last_xmit_skb: if there are no more packets
83 * queued, start_xmit won't be called. */
84 tasklet_schedule(&vi->tasklet);
73} 85}
74 86
75static void receive_skb(struct net_device *dev, struct sk_buff *skb, 87static void receive_skb(struct net_device *dev, struct sk_buff *skb,
@@ -86,9 +98,7 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb,
86 BUG_ON(len > MAX_PACKET_LEN); 98 BUG_ON(len > MAX_PACKET_LEN);
87 99
88 skb_trim(skb, len); 100 skb_trim(skb, len);
89 skb->protocol = eth_type_trans(skb, dev); 101
90 pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
91 ntohs(skb->protocol), skb->len, skb->pkt_type);
92 dev->stats.rx_bytes += skb->len; 102 dev->stats.rx_bytes += skb->len;
93 dev->stats.rx_packets++; 103 dev->stats.rx_packets++;
94 104
@@ -98,6 +108,10 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb,
98 goto frame_err; 108 goto frame_err;
99 } 109 }
100 110
111 skb->protocol = eth_type_trans(skb, dev);
112 pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
113 ntohs(skb->protocol), skb->len, skb->pkt_type);
114
101 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { 115 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
102 pr_debug("GSO!\n"); 116 pr_debug("GSO!\n");
103 switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { 117 switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
@@ -230,9 +244,25 @@ static void free_old_xmit_skbs(struct virtnet_info *vi)
230 } 244 }
231} 245}
232 246
247/* If the virtio transport doesn't always notify us when all in-flight packets
248 * are consumed, we fall back to using this function on a timer to free them. */
249static void xmit_free(unsigned long data)
250{
251 struct virtnet_info *vi = (void *)data;
252
253 netif_tx_lock(vi->dev);
254
255 free_old_xmit_skbs(vi);
256
257 if (!skb_queue_empty(&vi->send))
258 mod_timer(&vi->xmit_free_timer, jiffies + (HZ/10));
259
260 netif_tx_unlock(vi->dev);
261}
262
233static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb) 263static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
234{ 264{
235 int num; 265 int num, err;
236 struct scatterlist sg[2+MAX_SKB_FRAGS]; 266 struct scatterlist sg[2+MAX_SKB_FRAGS];
237 struct virtio_net_hdr *hdr; 267 struct virtio_net_hdr *hdr;
238 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; 268 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
@@ -275,7 +305,25 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
275 vnet_hdr_to_sg(sg, skb); 305 vnet_hdr_to_sg(sg, skb);
276 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; 306 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
277 307
278 return vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); 308 err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb);
309 if (!err && !vi->free_in_tasklet)
310 mod_timer(&vi->xmit_free_timer, jiffies + (HZ/10));
311
312 return err;
313}
314
315static void xmit_tasklet(unsigned long data)
316{
317 struct virtnet_info *vi = (void *)data;
318
319 netif_tx_lock_bh(vi->dev);
320 if (vi->last_xmit_skb && xmit_skb(vi, vi->last_xmit_skb) == 0) {
321 vi->svq->vq_ops->kick(vi->svq);
322 vi->last_xmit_skb = NULL;
323 }
324 if (vi->free_in_tasklet)
325 free_old_xmit_skbs(vi);
326 netif_tx_unlock_bh(vi->dev);
279} 327}
280 328
281static int start_xmit(struct sk_buff *skb, struct net_device *dev) 329static int start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -287,21 +335,25 @@ again:
287 free_old_xmit_skbs(vi); 335 free_old_xmit_skbs(vi);
288 336
289 /* If we has a buffer left over from last time, send it now. */ 337 /* If we has a buffer left over from last time, send it now. */
290 if (vi->last_xmit_skb) { 338 if (unlikely(vi->last_xmit_skb)) {
291 if (xmit_skb(vi, vi->last_xmit_skb) != 0) { 339 if (xmit_skb(vi, vi->last_xmit_skb) != 0) {
292 /* Drop this skb: we only queue one. */ 340 /* Drop this skb: we only queue one. */
293 vi->dev->stats.tx_dropped++; 341 vi->dev->stats.tx_dropped++;
294 kfree_skb(skb); 342 kfree_skb(skb);
343 skb = NULL;
295 goto stop_queue; 344 goto stop_queue;
296 } 345 }
297 vi->last_xmit_skb = NULL; 346 vi->last_xmit_skb = NULL;
298 } 347 }
299 348
300 /* Put new one in send queue and do transmit */ 349 /* Put new one in send queue and do transmit */
301 __skb_queue_head(&vi->send, skb); 350 if (likely(skb)) {
302 if (xmit_skb(vi, skb) != 0) { 351 __skb_queue_head(&vi->send, skb);
303 vi->last_xmit_skb = skb; 352 if (xmit_skb(vi, skb) != 0) {
304 goto stop_queue; 353 vi->last_xmit_skb = skb;
354 skb = NULL;
355 goto stop_queue;
356 }
305 } 357 }
306done: 358done:
307 vi->svq->vq_ops->kick(vi->svq); 359 vi->svq->vq_ops->kick(vi->svq);
@@ -411,6 +463,10 @@ static int virtnet_probe(struct virtio_device *vdev)
411 vi->vdev = vdev; 463 vi->vdev = vdev;
412 vdev->priv = vi; 464 vdev->priv = vi;
413 465
466 /* If they give us a callback when all buffers are done, we don't need
467 * the timer. */
468 vi->free_in_tasklet = virtio_has_feature(vdev,VIRTIO_F_NOTIFY_ON_EMPTY);
469
414 /* We expect two virtqueues, receive then send. */ 470 /* We expect two virtqueues, receive then send. */
415 vi->rvq = vdev->config->find_vq(vdev, 0, skb_recv_done); 471 vi->rvq = vdev->config->find_vq(vdev, 0, skb_recv_done);
416 if (IS_ERR(vi->rvq)) { 472 if (IS_ERR(vi->rvq)) {
@@ -428,6 +484,11 @@ static int virtnet_probe(struct virtio_device *vdev)
428 skb_queue_head_init(&vi->recv); 484 skb_queue_head_init(&vi->recv);
429 skb_queue_head_init(&vi->send); 485 skb_queue_head_init(&vi->send);
430 486
487 tasklet_init(&vi->tasklet, xmit_tasklet, (unsigned long)vi);
488
489 if (!vi->free_in_tasklet)
490 setup_timer(&vi->xmit_free_timer, xmit_free, (unsigned long)vi);
491
431 err = register_netdev(dev); 492 err = register_netdev(dev);
432 if (err) { 493 if (err) {
433 pr_debug("virtio_net: registering device failed\n"); 494 pr_debug("virtio_net: registering device failed\n");
@@ -465,13 +526,15 @@ static void virtnet_remove(struct virtio_device *vdev)
465 /* Stop all the virtqueues. */ 526 /* Stop all the virtqueues. */
466 vdev->config->reset(vdev); 527 vdev->config->reset(vdev);
467 528
529 if (!vi->free_in_tasklet)
530 del_timer_sync(&vi->xmit_free_timer);
531
468 /* Free our skbs in send and recv queues, if any. */ 532 /* Free our skbs in send and recv queues, if any. */
469 while ((skb = __skb_dequeue(&vi->recv)) != NULL) { 533 while ((skb = __skb_dequeue(&vi->recv)) != NULL) {
470 kfree_skb(skb); 534 kfree_skb(skb);
471 vi->num--; 535 vi->num--;
472 } 536 }
473 while ((skb = __skb_dequeue(&vi->send)) != NULL) 537 __skb_queue_purge(&vi->send);
474 kfree_skb(skb);
475 538
476 BUG_ON(vi->num != 0); 539 BUG_ON(vi->num != 0);
477 540
@@ -489,7 +552,7 @@ static struct virtio_device_id id_table[] = {
489static unsigned int features[] = { 552static unsigned int features[] = {
490 VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, 553 VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC,
491 VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, 554 VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6,
492 VIRTIO_NET_F_HOST_ECN, 555 VIRTIO_NET_F_HOST_ECN, VIRTIO_F_NOTIFY_ON_EMPTY,
493}; 556};
494 557
495static struct virtio_driver virtio_net = { 558static struct virtio_driver virtio_net = {
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 8005dd16fb4e..d5140aed7b79 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -150,11 +150,9 @@ config HDLC_FR
150 150
151config HDLC_PPP 151config HDLC_PPP
152 tristate "Synchronous Point-to-Point Protocol (PPP) support" 152 tristate "Synchronous Point-to-Point Protocol (PPP) support"
153 depends on HDLC && BROKEN 153 depends on HDLC
154 help 154 help
155 Generic HDLC driver supporting PPP over WAN connections. 155 Generic HDLC driver supporting PPP over WAN connections.
156 This module is currently broken and will cause a kernel panic
157 when a device configured in PPP mode is activated.
158 156
159 It will be replaced by new PPP implementation in Linux 2.6.26. 157 It will be replaced by new PPP implementation in Linux 2.6.26.
160 158
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 45ddfc9763cc..b0fce1387eaf 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -629,7 +629,7 @@ static void sppp_channel_init(struct channel_data *chan)
629 d->base_addr = chan->cosa->datareg; 629 d->base_addr = chan->cosa->datareg;
630 d->irq = chan->cosa->irq; 630 d->irq = chan->cosa->irq;
631 d->dma = chan->cosa->dma; 631 d->dma = chan->cosa->dma;
632 d->priv = chan; 632 d->ml_priv = chan;
633 sppp_attach(&chan->pppdev); 633 sppp_attach(&chan->pppdev);
634 if (register_netdev(d)) { 634 if (register_netdev(d)) {
635 printk(KERN_WARNING "%s: register_netdev failed.\n", d->name); 635 printk(KERN_WARNING "%s: register_netdev failed.\n", d->name);
@@ -650,7 +650,7 @@ static void sppp_channel_delete(struct channel_data *chan)
650 650
651static int cosa_sppp_open(struct net_device *d) 651static int cosa_sppp_open(struct net_device *d)
652{ 652{
653 struct channel_data *chan = d->priv; 653 struct channel_data *chan = d->ml_priv;
654 int err; 654 int err;
655 unsigned long flags; 655 unsigned long flags;
656 656
@@ -690,7 +690,7 @@ static int cosa_sppp_open(struct net_device *d)
690 690
691static int cosa_sppp_tx(struct sk_buff *skb, struct net_device *dev) 691static int cosa_sppp_tx(struct sk_buff *skb, struct net_device *dev)
692{ 692{
693 struct channel_data *chan = dev->priv; 693 struct channel_data *chan = dev->ml_priv;
694 694
695 netif_stop_queue(dev); 695 netif_stop_queue(dev);
696 696
@@ -701,7 +701,7 @@ static int cosa_sppp_tx(struct sk_buff *skb, struct net_device *dev)
701 701
702static void cosa_sppp_timeout(struct net_device *dev) 702static void cosa_sppp_timeout(struct net_device *dev)
703{ 703{
704 struct channel_data *chan = dev->priv; 704 struct channel_data *chan = dev->ml_priv;
705 705
706 if (test_bit(RXBIT, &chan->cosa->rxtx)) { 706 if (test_bit(RXBIT, &chan->cosa->rxtx)) {
707 chan->stats.rx_errors++; 707 chan->stats.rx_errors++;
@@ -720,7 +720,7 @@ static void cosa_sppp_timeout(struct net_device *dev)
720 720
721static int cosa_sppp_close(struct net_device *d) 721static int cosa_sppp_close(struct net_device *d)
722{ 722{
723 struct channel_data *chan = d->priv; 723 struct channel_data *chan = d->ml_priv;
724 unsigned long flags; 724 unsigned long flags;
725 725
726 netif_stop_queue(d); 726 netif_stop_queue(d);
@@ -800,7 +800,7 @@ static int sppp_tx_done(struct channel_data *chan, int size)
800 800
801static struct net_device_stats *cosa_net_stats(struct net_device *dev) 801static struct net_device_stats *cosa_net_stats(struct net_device *dev)
802{ 802{
803 struct channel_data *chan = dev->priv; 803 struct channel_data *chan = dev->ml_priv;
804 return &chan->stats; 804 return &chan->stats;
805} 805}
806 806
@@ -1217,7 +1217,7 @@ static int cosa_sppp_ioctl(struct net_device *dev, struct ifreq *ifr,
1217 int cmd) 1217 int cmd)
1218{ 1218{
1219 int rv; 1219 int rv;
1220 struct channel_data *chan = dev->priv; 1220 struct channel_data *chan = dev->ml_priv;
1221 rv = cosa_ioctl_common(chan->cosa, chan, cmd, (unsigned long)ifr->ifr_data); 1221 rv = cosa_ioctl_common(chan->cosa, chan, cmd, (unsigned long)ifr->ifr_data);
1222 if (rv == -ENOIOCTLCMD) { 1222 if (rv == -ENOIOCTLCMD) {
1223 return sppp_do_ioctl(dev, ifr, cmd); 1223 return sppp_do_ioctl(dev, ifr, cmd);
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 9a83c9d5b8cf..7f984895b0d5 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -43,8 +43,7 @@ static const char* version = "HDLC support module revision 1.22";
43 43
44#undef DEBUG_LINK 44#undef DEBUG_LINK
45 45
46static struct hdlc_proto *first_proto = NULL; 46static struct hdlc_proto *first_proto;
47
48 47
49static int hdlc_change_mtu(struct net_device *dev, int new_mtu) 48static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
50{ 49{
@@ -314,21 +313,25 @@ void detach_hdlc_protocol(struct net_device *dev)
314 313
315void register_hdlc_protocol(struct hdlc_proto *proto) 314void register_hdlc_protocol(struct hdlc_proto *proto)
316{ 315{
316 rtnl_lock();
317 proto->next = first_proto; 317 proto->next = first_proto;
318 first_proto = proto; 318 first_proto = proto;
319 rtnl_unlock();
319} 320}
320 321
321 322
322void unregister_hdlc_protocol(struct hdlc_proto *proto) 323void unregister_hdlc_protocol(struct hdlc_proto *proto)
323{ 324{
324 struct hdlc_proto **p = &first_proto; 325 struct hdlc_proto **p;
325 while (*p) { 326
326 if (*p == proto) { 327 rtnl_lock();
327 *p = proto->next; 328 p = &first_proto;
328 return; 329 while (*p != proto) {
329 } 330 BUG_ON(!*p);
330 p = &((*p)->next); 331 p = &((*p)->next);
331 } 332 }
333 *p = proto->next;
334 rtnl_unlock();
332} 335}
333 336
334 337
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 7133c688cf20..762d21c1c703 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -56,6 +56,7 @@ struct cisco_state {
56 cisco_proto settings; 56 cisco_proto settings;
57 57
58 struct timer_list timer; 58 struct timer_list timer;
59 spinlock_t lock;
59 unsigned long last_poll; 60 unsigned long last_poll;
60 int up; 61 int up;
61 int request_sent; 62 int request_sent;
@@ -158,6 +159,7 @@ static int cisco_rx(struct sk_buff *skb)
158{ 159{
159 struct net_device *dev = skb->dev; 160 struct net_device *dev = skb->dev;
160 hdlc_device *hdlc = dev_to_hdlc(dev); 161 hdlc_device *hdlc = dev_to_hdlc(dev);
162 struct cisco_state *st = state(hdlc);
161 struct hdlc_header *data = (struct hdlc_header*)skb->data; 163 struct hdlc_header *data = (struct hdlc_header*)skb->data;
162 struct cisco_packet *cisco_data; 164 struct cisco_packet *cisco_data;
163 struct in_device *in_dev; 165 struct in_device *in_dev;
@@ -220,11 +222,12 @@ static int cisco_rx(struct sk_buff *skb)
220 goto rx_error; 222 goto rx_error;
221 223
222 case CISCO_KEEPALIVE_REQ: 224 case CISCO_KEEPALIVE_REQ:
223 state(hdlc)->rxseq = ntohl(cisco_data->par1); 225 spin_lock(&st->lock);
224 if (state(hdlc)->request_sent && 226 st->rxseq = ntohl(cisco_data->par1);
225 ntohl(cisco_data->par2) == state(hdlc)->txseq) { 227 if (st->request_sent &&
226 state(hdlc)->last_poll = jiffies; 228 ntohl(cisco_data->par2) == st->txseq) {
227 if (!state(hdlc)->up) { 229 st->last_poll = jiffies;
230 if (!st->up) {
228 u32 sec, min, hrs, days; 231 u32 sec, min, hrs, days;
229 sec = ntohl(cisco_data->time) / 1000; 232 sec = ntohl(cisco_data->time) / 1000;
230 min = sec / 60; sec -= min * 60; 233 min = sec / 60; sec -= min * 60;
@@ -232,12 +235,12 @@ static int cisco_rx(struct sk_buff *skb)
232 days = hrs / 24; hrs -= days * 24; 235 days = hrs / 24; hrs -= days * 24;
233 printk(KERN_INFO "%s: Link up (peer " 236 printk(KERN_INFO "%s: Link up (peer "
234 "uptime %ud%uh%um%us)\n", 237 "uptime %ud%uh%um%us)\n",
235 dev->name, days, hrs, 238 dev->name, days, hrs, min, sec);
236 min, sec);
237 netif_dormant_off(dev); 239 netif_dormant_off(dev);
238 state(hdlc)->up = 1; 240 st->up = 1;
239 } 241 }
240 } 242 }
243 spin_unlock(&st->lock);
241 244
242 dev_kfree_skb_any(skb); 245 dev_kfree_skb_any(skb);
243 return NET_RX_SUCCESS; 246 return NET_RX_SUCCESS;
@@ -261,24 +264,25 @@ static void cisco_timer(unsigned long arg)
261{ 264{
262 struct net_device *dev = (struct net_device *)arg; 265 struct net_device *dev = (struct net_device *)arg;
263 hdlc_device *hdlc = dev_to_hdlc(dev); 266 hdlc_device *hdlc = dev_to_hdlc(dev);
267 struct cisco_state *st = state(hdlc);
264 268
265 if (state(hdlc)->up && 269 spin_lock(&st->lock);
266 time_after(jiffies, state(hdlc)->last_poll + 270 if (st->up &&
267 state(hdlc)->settings.timeout * HZ)) { 271 time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) {
268 state(hdlc)->up = 0; 272 st->up = 0;
269 printk(KERN_INFO "%s: Link down\n", dev->name); 273 printk(KERN_INFO "%s: Link down\n", dev->name);
270 netif_dormant_on(dev); 274 netif_dormant_on(dev);
271 } 275 }
272 276
273 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, 277 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq),
274 htonl(++state(hdlc)->txseq), 278 htonl(st->rxseq));
275 htonl(state(hdlc)->rxseq)); 279 st->request_sent = 1;
276 state(hdlc)->request_sent = 1; 280 spin_unlock(&st->lock);
277 state(hdlc)->timer.expires = jiffies + 281
278 state(hdlc)->settings.interval * HZ; 282 st->timer.expires = jiffies + st->settings.interval * HZ;
279 state(hdlc)->timer.function = cisco_timer; 283 st->timer.function = cisco_timer;
280 state(hdlc)->timer.data = arg; 284 st->timer.data = arg;
281 add_timer(&state(hdlc)->timer); 285 add_timer(&st->timer);
282} 286}
283 287
284 288
@@ -286,15 +290,20 @@ static void cisco_timer(unsigned long arg)
286static void cisco_start(struct net_device *dev) 290static void cisco_start(struct net_device *dev)
287{ 291{
288 hdlc_device *hdlc = dev_to_hdlc(dev); 292 hdlc_device *hdlc = dev_to_hdlc(dev);
289 state(hdlc)->up = 0; 293 struct cisco_state *st = state(hdlc);
290 state(hdlc)->request_sent = 0; 294 unsigned long flags;
291 state(hdlc)->txseq = state(hdlc)->rxseq = 0; 295
292 296 spin_lock_irqsave(&st->lock, flags);
293 init_timer(&state(hdlc)->timer); 297 st->up = 0;
294 state(hdlc)->timer.expires = jiffies + HZ; /*First poll after 1s*/ 298 st->request_sent = 0;
295 state(hdlc)->timer.function = cisco_timer; 299 st->txseq = st->rxseq = 0;
296 state(hdlc)->timer.data = (unsigned long)dev; 300 spin_unlock_irqrestore(&st->lock, flags);
297 add_timer(&state(hdlc)->timer); 301
302 init_timer(&st->timer);
303 st->timer.expires = jiffies + HZ; /* First poll after 1 s */
304 st->timer.function = cisco_timer;
305 st->timer.data = (unsigned long)dev;
306 add_timer(&st->timer);
298} 307}
299 308
300 309
@@ -302,10 +311,16 @@ static void cisco_start(struct net_device *dev)
302static void cisco_stop(struct net_device *dev) 311static void cisco_stop(struct net_device *dev)
303{ 312{
304 hdlc_device *hdlc = dev_to_hdlc(dev); 313 hdlc_device *hdlc = dev_to_hdlc(dev);
305 del_timer_sync(&state(hdlc)->timer); 314 struct cisco_state *st = state(hdlc);
315 unsigned long flags;
316
317 del_timer_sync(&st->timer);
318
319 spin_lock_irqsave(&st->lock, flags);
306 netif_dormant_on(dev); 320 netif_dormant_on(dev);
307 state(hdlc)->up = 0; 321 st->up = 0;
308 state(hdlc)->request_sent = 0; 322 st->request_sent = 0;
323 spin_unlock_irqrestore(&st->lock, flags);
309} 324}
310 325
311 326
@@ -367,6 +382,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
367 return result; 382 return result;
368 383
369 memcpy(&state(hdlc)->settings, &new_settings, size); 384 memcpy(&state(hdlc)->settings, &new_settings, size);
385 spin_lock_init(&state(hdlc)->lock);
370 dev->hard_start_xmit = hdlc->xmit; 386 dev->hard_start_xmit = hdlc->xmit;
371 dev->header_ops = &cisco_header_ops; 387 dev->header_ops = &cisco_header_ops;
372 dev->type = ARPHRD_CISCO; 388 dev->type = ARPHRD_CISCO;
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 10396d9686f4..00308337928e 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -45,7 +45,7 @@ static int ppp_open(struct net_device *dev)
45 int (*old_ioctl)(struct net_device *, struct ifreq *, int); 45 int (*old_ioctl)(struct net_device *, struct ifreq *, int);
46 int result; 46 int result;
47 47
48 dev->priv = &state(hdlc)->syncppp_ptr; 48 dev->ml_priv = &state(hdlc)->syncppp_ptr;
49 state(hdlc)->syncppp_ptr = &state(hdlc)->pppdev; 49 state(hdlc)->syncppp_ptr = &state(hdlc)->pppdev;
50 state(hdlc)->pppdev.dev = dev; 50 state(hdlc)->pppdev.dev = dev;
51 51
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 83dbc924fcb5..f3065d3473fd 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -75,7 +75,7 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb)
75 75
76static int hostess_open(struct net_device *d) 76static int hostess_open(struct net_device *d)
77{ 77{
78 struct sv11_device *sv11=d->priv; 78 struct sv11_device *sv11=d->ml_priv;
79 int err = -1; 79 int err = -1;
80 80
81 /* 81 /*
@@ -128,7 +128,7 @@ static int hostess_open(struct net_device *d)
128 128
129static int hostess_close(struct net_device *d) 129static int hostess_close(struct net_device *d)
130{ 130{
131 struct sv11_device *sv11=d->priv; 131 struct sv11_device *sv11=d->ml_priv;
132 /* 132 /*
133 * Discard new frames 133 * Discard new frames
134 */ 134 */
@@ -159,14 +159,14 @@ static int hostess_close(struct net_device *d)
159 159
160static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd) 160static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
161{ 161{
162 /* struct sv11_device *sv11=d->priv; 162 /* struct sv11_device *sv11=d->ml_priv;
163 z8530_ioctl(d,&sv11->sync.chanA,ifr,cmd) */ 163 z8530_ioctl(d,&sv11->sync.chanA,ifr,cmd) */
164 return sppp_do_ioctl(d, ifr,cmd); 164 return sppp_do_ioctl(d, ifr,cmd);
165} 165}
166 166
167static struct net_device_stats *hostess_get_stats(struct net_device *d) 167static struct net_device_stats *hostess_get_stats(struct net_device *d)
168{ 168{
169 struct sv11_device *sv11=d->priv; 169 struct sv11_device *sv11=d->ml_priv;
170 if(sv11) 170 if(sv11)
171 return z8530_get_stats(&sv11->sync.chanA); 171 return z8530_get_stats(&sv11->sync.chanA);
172 else 172 else
@@ -179,7 +179,7 @@ static struct net_device_stats *hostess_get_stats(struct net_device *d)
179 179
180static int hostess_queue_xmit(struct sk_buff *skb, struct net_device *d) 180static int hostess_queue_xmit(struct sk_buff *skb, struct net_device *d)
181{ 181{
182 struct sv11_device *sv11=d->priv; 182 struct sv11_device *sv11=d->ml_priv;
183 return z8530_queue_xmit(&sv11->sync.chanA, skb); 183 return z8530_queue_xmit(&sv11->sync.chanA, skb);
184} 184}
185 185
@@ -325,6 +325,7 @@ static struct sv11_device *sv11_init(int iobase, int irq)
325 /* 325 /*
326 * Initialise the PPP components 326 * Initialise the PPP components
327 */ 327 */
328 d->ml_priv = sv;
328 sppp_attach(&sv->netdev); 329 sppp_attach(&sv->netdev);
329 330
330 /* 331 /*
@@ -333,7 +334,6 @@ static struct sv11_device *sv11_init(int iobase, int irq)
333 334
334 d->base_addr = iobase; 335 d->base_addr = iobase;
335 d->irq = irq; 336 d->irq = irq;
336 d->priv = sv;
337 337
338 if(register_netdev(d)) 338 if(register_netdev(d))
339 { 339 {
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 6635ecef36e5..62133cee446a 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -891,6 +891,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
891 891
892 /* Initialize the sppp layer */ 892 /* Initialize the sppp layer */
893 /* An ioctl can cause a subsequent detach for raw frame interface */ 893 /* An ioctl can cause a subsequent detach for raw frame interface */
894 dev->ml_priv = sc;
894 sc->if_type = LMC_PPP; 895 sc->if_type = LMC_PPP;
895 sc->check = 0xBEAFCAFE; 896 sc->check = 0xBEAFCAFE;
896 dev->base_addr = pci_resource_start(pdev, 0); 897 dev->base_addr = pci_resource_start(pdev, 0);
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 11276bf3149f..44a89df1b8bf 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -241,6 +241,7 @@ static inline struct slvl_device *slvl_alloc(int iobase, int irq)
241 return NULL; 241 return NULL;
242 242
243 sv = d->priv; 243 sv = d->priv;
244 d->ml_priv = sv;
244 sv->if_ptr = &sv->pppdev; 245 sv->if_ptr = &sv->pppdev;
245 sv->pppdev.dev = d; 246 sv->pppdev.dev = d;
246 d->base_addr = iobase; 247 d->base_addr = iobase;
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 45f47c1c0a35..32019fb878d8 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2668,6 +2668,7 @@ static struct net_device *init_wifidev(struct airo_info *ai,
2668 dev->irq = ethdev->irq; 2668 dev->irq = ethdev->irq;
2669 dev->base_addr = ethdev->base_addr; 2669 dev->base_addr = ethdev->base_addr;
2670 dev->wireless_data = ethdev->wireless_data; 2670 dev->wireless_data = ethdev->wireless_data;
2671 SET_NETDEV_DEV(dev, ethdev->dev.parent);
2671 memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); 2672 memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len);
2672 err = register_netdev(dev); 2673 err = register_netdev(dev);
2673 if (err<0) { 2674 if (err<0) {
@@ -2904,7 +2905,7 @@ EXPORT_SYMBOL(init_airo_card);
2904 2905
2905static int waitbusy (struct airo_info *ai) { 2906static int waitbusy (struct airo_info *ai) {
2906 int delay = 0; 2907 int delay = 0;
2907 while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) & (delay < 10000)) { 2908 while ((IN4500(ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) {
2908 udelay (10); 2909 udelay (10);
2909 if ((++delay % 20) == 0) 2910 if ((++delay % 20) == 0)
2910 OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); 2911 OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY);
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 4e5c8fc35200..635b9ac9aaa1 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1787,6 +1787,8 @@ ath5k_tasklet_rx(unsigned long data)
1787 1787
1788 spin_lock(&sc->rxbuflock); 1788 spin_lock(&sc->rxbuflock);
1789 do { 1789 do {
1790 rxs.flag = 0;
1791
1790 if (unlikely(list_empty(&sc->rxbuf))) { 1792 if (unlikely(list_empty(&sc->rxbuf))) {
1791 ATH5K_WARN(sc, "empty rx buf pool\n"); 1793 ATH5K_WARN(sc, "empty rx buf pool\n");
1792 break; 1794 break;
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 5fb1ae6ad3e2..77990b56860b 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -4119,6 +4119,7 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah,
4119 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, 4119 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1,
4120 AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); 4120 AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP);
4121 rs->rs_status = 0; 4121 rs->rs_status = 0;
4122 rs->rs_phyerr = 0;
4122 4123
4123 /* 4124 /*
4124 * Key table status 4125 * Key table status
@@ -4145,7 +4146,7 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah,
4145 if (rx_status->rx_status_1 & 4146 if (rx_status->rx_status_1 &
4146 AR5K_5210_RX_DESC_STATUS1_PHY_ERROR) { 4147 AR5K_5210_RX_DESC_STATUS1_PHY_ERROR) {
4147 rs->rs_status |= AR5K_RXERR_PHY; 4148 rs->rs_status |= AR5K_RXERR_PHY;
4148 rs->rs_phyerr = AR5K_REG_MS(rx_status->rx_status_1, 4149 rs->rs_phyerr |= AR5K_REG_MS(rx_status->rx_status_1,
4149 AR5K_5210_RX_DESC_STATUS1_PHY_ERROR); 4150 AR5K_5210_RX_DESC_STATUS1_PHY_ERROR);
4150 } 4151 }
4151 4152
@@ -4193,6 +4194,7 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah,
4193 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, 4194 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1,
4194 AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); 4195 AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP);
4195 rs->rs_status = 0; 4196 rs->rs_status = 0;
4197 rs->rs_phyerr = 0;
4196 4198
4197 /* 4199 /*
4198 * Key table status 4200 * Key table status
@@ -4215,7 +4217,7 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah,
4215 if (rx_status->rx_status_1 & 4217 if (rx_status->rx_status_1 &
4216 AR5K_5212_RX_DESC_STATUS1_PHY_ERROR) { 4218 AR5K_5212_RX_DESC_STATUS1_PHY_ERROR) {
4217 rs->rs_status |= AR5K_RXERR_PHY; 4219 rs->rs_status |= AR5K_RXERR_PHY;
4218 rs->rs_phyerr = AR5K_REG_MS(rx_err->rx_error_1, 4220 rs->rs_phyerr |= AR5K_REG_MS(rx_err->rx_error_1,
4219 AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE); 4221 AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE);
4220 } 4222 }
4221 4223
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index ef2da4023d68..438e63ecccf1 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -47,6 +47,7 @@
47#include <linux/string.h> 47#include <linux/string.h>
48#include <linux/ctype.h> 48#include <linux/ctype.h>
49#include <linux/timer.h> 49#include <linux/timer.h>
50#include <asm/byteorder.h>
50#include <asm/io.h> 51#include <asm/io.h>
51#include <asm/system.h> 52#include <asm/system.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
@@ -60,7 +61,6 @@
60#include <linux/delay.h> 61#include <linux/delay.h>
61#include <linux/wireless.h> 62#include <linux/wireless.h>
62#include <net/iw_handler.h> 63#include <net/iw_handler.h>
63#include <linux/byteorder/generic.h>
64#include <linux/crc32.h> 64#include <linux/crc32.h>
65#include <linux/proc_fs.h> 65#include <linux/proc_fs.h>
66#include <linux/device.h> 66#include <linux/device.h>
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index f51b2d9b085b..1fa043d1802c 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -1,6 +1,6 @@
1config B43 1config B43
2 tristate "Broadcom 43xx wireless support (mac80211 stack)" 2 tristate "Broadcom 43xx wireless support (mac80211 stack)"
3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA
4 select SSB 4 select SSB
5 select FW_LOADER 5 select FW_LOADER
6 select HW_RANDOM 6 select HW_RANDOM
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 37783cdd301a..dfa4bdd5597c 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -737,6 +737,7 @@ struct b43_wl {
737 struct ieee80211_tx_control beacon_txctl; 737 struct ieee80211_tx_control beacon_txctl;
738 bool beacon0_uploaded; 738 bool beacon0_uploaded;
739 bool beacon1_uploaded; 739 bool beacon1_uploaded;
740 bool beacon_templates_virgin; /* Never wrote the templates? */
740 struct work_struct beacon_update_trigger; 741 struct work_struct beacon_update_trigger;
741 742
742 /* The current QOS parameters for the 4 queues. 743 /* The current QOS parameters for the 4 queues.
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 8fdba9415c04..6c3d9ea0a9f8 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1544,6 +1544,30 @@ static void b43_write_probe_resp_template(struct b43_wldev *dev,
1544 kfree(probe_resp_data); 1544 kfree(probe_resp_data);
1545} 1545}
1546 1546
1547static void b43_upload_beacon0(struct b43_wldev *dev)
1548{
1549 struct b43_wl *wl = dev->wl;
1550
1551 if (wl->beacon0_uploaded)
1552 return;
1553 b43_write_beacon_template(dev, 0x68, 0x18);
1554 /* FIXME: Probe resp upload doesn't really belong here,
1555 * but we don't use that feature anyway. */
1556 b43_write_probe_resp_template(dev, 0x268, 0x4A,
1557 &__b43_ratetable[3]);
1558 wl->beacon0_uploaded = 1;
1559}
1560
1561static void b43_upload_beacon1(struct b43_wldev *dev)
1562{
1563 struct b43_wl *wl = dev->wl;
1564
1565 if (wl->beacon1_uploaded)
1566 return;
1567 b43_write_beacon_template(dev, 0x468, 0x1A);
1568 wl->beacon1_uploaded = 1;
1569}
1570
1547static void handle_irq_beacon(struct b43_wldev *dev) 1571static void handle_irq_beacon(struct b43_wldev *dev)
1548{ 1572{
1549 struct b43_wl *wl = dev->wl; 1573 struct b43_wl *wl = dev->wl;
@@ -1568,24 +1592,27 @@ static void handle_irq_beacon(struct b43_wldev *dev)
1568 return; 1592 return;
1569 } 1593 }
1570 1594
1571 if (!beacon0_valid) { 1595 if (unlikely(wl->beacon_templates_virgin)) {
1572 if (!wl->beacon0_uploaded) { 1596 /* We never uploaded a beacon before.
1573 b43_write_beacon_template(dev, 0x68, 0x18); 1597 * Upload both templates now, but only mark one valid. */
1574 b43_write_probe_resp_template(dev, 0x268, 0x4A, 1598 wl->beacon_templates_virgin = 0;
1575 &__b43_ratetable[3]); 1599 b43_upload_beacon0(dev);
1576 wl->beacon0_uploaded = 1; 1600 b43_upload_beacon1(dev);
1577 }
1578 cmd = b43_read32(dev, B43_MMIO_MACCMD); 1601 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1579 cmd |= B43_MACCMD_BEACON0_VALID; 1602 cmd |= B43_MACCMD_BEACON0_VALID;
1580 b43_write32(dev, B43_MMIO_MACCMD, cmd); 1603 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1581 } else if (!beacon1_valid) { 1604 } else {
1582 if (!wl->beacon1_uploaded) { 1605 if (!beacon0_valid) {
1583 b43_write_beacon_template(dev, 0x468, 0x1A); 1606 b43_upload_beacon0(dev);
1584 wl->beacon1_uploaded = 1; 1607 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1608 cmd |= B43_MACCMD_BEACON0_VALID;
1609 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1610 } else if (!beacon1_valid) {
1611 b43_upload_beacon1(dev);
1612 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1613 cmd |= B43_MACCMD_BEACON1_VALID;
1614 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1585 } 1615 }
1586 cmd = b43_read32(dev, B43_MMIO_MACCMD);
1587 cmd |= B43_MACCMD_BEACON1_VALID;
1588 b43_write32(dev, B43_MMIO_MACCMD, cmd);
1589 } 1616 }
1590} 1617}
1591 1618
@@ -4073,6 +4100,9 @@ static int b43_op_start(struct ieee80211_hw *hw)
4073 wl->filter_flags = 0; 4100 wl->filter_flags = 0;
4074 wl->radiotap_enabled = 0; 4101 wl->radiotap_enabled = 0;
4075 b43_qos_clear(wl); 4102 b43_qos_clear(wl);
4103 wl->beacon0_uploaded = 0;
4104 wl->beacon1_uploaded = 0;
4105 wl->beacon_templates_virgin = 1;
4076 4106
4077 /* First register RFkill. 4107 /* First register RFkill.
4078 * LEDs that are registered later depend on it. */ 4108 * LEDs that are registered later depend on it. */
@@ -4241,7 +4271,9 @@ static void b43_chip_reset(struct work_struct *work)
4241 goto out; 4271 goto out;
4242 } 4272 }
4243 } 4273 }
4244 out: 4274out:
4275 if (err)
4276 wl->current_dev = NULL; /* Failed to init the dev. */
4245 mutex_unlock(&wl->mutex); 4277 mutex_unlock(&wl->mutex);
4246 if (err) 4278 if (err)
4247 b43err(wl, "Controller restart FAILED\n"); 4279 b43err(wl, "Controller restart FAILED\n");
@@ -4382,9 +4414,11 @@ static void b43_one_core_detach(struct ssb_device *dev)
4382 struct b43_wldev *wldev; 4414 struct b43_wldev *wldev;
4383 struct b43_wl *wl; 4415 struct b43_wl *wl;
4384 4416
4417 /* Do not cancel ieee80211-workqueue based work here.
4418 * See comment in b43_remove(). */
4419
4385 wldev = ssb_get_drvdata(dev); 4420 wldev = ssb_get_drvdata(dev);
4386 wl = wldev->wl; 4421 wl = wldev->wl;
4387 cancel_work_sync(&wldev->restart_work);
4388 b43_debugfs_remove_device(wldev); 4422 b43_debugfs_remove_device(wldev);
4389 b43_wireless_core_detach(wldev); 4423 b43_wireless_core_detach(wldev);
4390 list_del(&wldev->list); 4424 list_del(&wldev->list);
@@ -4569,6 +4603,10 @@ static void b43_remove(struct ssb_device *dev)
4569 struct b43_wl *wl = ssb_get_devtypedata(dev); 4603 struct b43_wl *wl = ssb_get_devtypedata(dev);
4570 struct b43_wldev *wldev = ssb_get_drvdata(dev); 4604 struct b43_wldev *wldev = ssb_get_drvdata(dev);
4571 4605
4606 /* We must cancel any work here before unregistering from ieee80211,
4607 * as the ieee80211 unreg will destroy the workqueue. */
4608 cancel_work_sync(&wldev->restart_work);
4609
4572 B43_WARN_ON(!wl); 4610 B43_WARN_ON(!wl);
4573 if (wl->current_dev == wldev) 4611 if (wl->current_dev == wldev)
4574 ieee80211_unregister_hw(wl->hw); 4612 ieee80211_unregister_hw(wl->hw);
diff --git a/drivers/net/wireless/b43legacy/Kconfig b/drivers/net/wireless/b43legacy/Kconfig
index 13c65faf0247..aef2298d37ac 100644
--- a/drivers/net/wireless/b43legacy/Kconfig
+++ b/drivers/net/wireless/b43legacy/Kconfig
@@ -1,6 +1,6 @@
1config B43LEGACY 1config B43LEGACY
2 tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" 2 tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)"
3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 3 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA
4 select SSB 4 select SSB
5 select FW_LOADER 5 select FW_LOADER
6 select HW_RANDOM 6 select HW_RANDOM
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 14a5eea2573e..204077c13870 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3039,7 +3039,6 @@ static void b43legacy_set_pretbtt(struct b43legacy_wldev *dev)
3039/* Locking: wl->mutex */ 3039/* Locking: wl->mutex */
3040static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) 3040static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
3041{ 3041{
3042 struct b43legacy_wl *wl = dev->wl;
3043 struct b43legacy_phy *phy = &dev->phy; 3042 struct b43legacy_phy *phy = &dev->phy;
3044 u32 macctl; 3043 u32 macctl;
3045 3044
@@ -3054,12 +3053,6 @@ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
3054 macctl |= B43legacy_MACCTL_PSM_JMP0; 3053 macctl |= B43legacy_MACCTL_PSM_JMP0;
3055 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); 3054 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
3056 3055
3057 mutex_unlock(&wl->mutex);
3058 /* Must unlock as it would otherwise deadlock. No races here.
3059 * Cancel possibly pending workqueues. */
3060 cancel_work_sync(&dev->restart_work);
3061 mutex_lock(&wl->mutex);
3062
3063 b43legacy_leds_exit(dev); 3056 b43legacy_leds_exit(dev);
3064 b43legacy_rng_exit(dev->wl); 3057 b43legacy_rng_exit(dev->wl);
3065 b43legacy_pio_free(dev); 3058 b43legacy_pio_free(dev);
@@ -3486,6 +3479,8 @@ static void b43legacy_chip_reset(struct work_struct *work)
3486 } 3479 }
3487 } 3480 }
3488out: 3481out:
3482 if (err)
3483 wl->current_dev = NULL; /* Failed to init the dev. */
3489 mutex_unlock(&wl->mutex); 3484 mutex_unlock(&wl->mutex);
3490 if (err) 3485 if (err)
3491 b43legacyerr(wl, "Controller restart FAILED\n"); 3486 b43legacyerr(wl, "Controller restart FAILED\n");
@@ -3618,9 +3613,11 @@ static void b43legacy_one_core_detach(struct ssb_device *dev)
3618 struct b43legacy_wldev *wldev; 3613 struct b43legacy_wldev *wldev;
3619 struct b43legacy_wl *wl; 3614 struct b43legacy_wl *wl;
3620 3615
3616 /* Do not cancel ieee80211-workqueue based work here.
3617 * See comment in b43legacy_remove(). */
3618
3621 wldev = ssb_get_drvdata(dev); 3619 wldev = ssb_get_drvdata(dev);
3622 wl = wldev->wl; 3620 wl = wldev->wl;
3623 cancel_work_sync(&wldev->restart_work);
3624 b43legacy_debugfs_remove_device(wldev); 3621 b43legacy_debugfs_remove_device(wldev);
3625 b43legacy_wireless_core_detach(wldev); 3622 b43legacy_wireless_core_detach(wldev);
3626 list_del(&wldev->list); 3623 list_del(&wldev->list);
@@ -3789,6 +3786,10 @@ static void b43legacy_remove(struct ssb_device *dev)
3789 struct b43legacy_wl *wl = ssb_get_devtypedata(dev); 3786 struct b43legacy_wl *wl = ssb_get_devtypedata(dev);
3790 struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); 3787 struct b43legacy_wldev *wldev = ssb_get_drvdata(dev);
3791 3788
3789 /* We must cancel any work here before unregistering from ieee80211,
3790 * as the ieee80211 unreg will destroy the workqueue. */
3791 cancel_work_sync(&wldev->restart_work);
3792
3792 B43legacy_WARN_ON(!wl); 3793 B43legacy_WARN_ON(!wl);
3793 if (wl->current_dev == wldev) 3794 if (wl->current_dev == wldev)
3794 ieee80211_unregister_hw(wl->hw); 3795 ieee80211_unregister_hw(wl->hw);
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 437a9bcc9bd3..ed4317a17cbb 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -833,6 +833,7 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
833 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), 833 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
834 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), 834 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
835/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */ 835/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */
836 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
836 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 837 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
837 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 838 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
838 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), 839 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 7be68db6f300..cdf90c40f11b 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3276,11 +3276,6 @@ while (0)
3276 } 3276 }
3277 printk(KERN_INFO "%s: Registered netdevice %s\n", dev_info, dev->name); 3277 printk(KERN_INFO "%s: Registered netdevice %s\n", dev_info, dev->name);
3278 3278
3279#ifndef PRISM2_NO_PROCFS_DEBUG
3280 create_proc_read_entry("registers", 0, local->proc,
3281 prism2_registers_proc_read, local);
3282#endif /* PRISM2_NO_PROCFS_DEBUG */
3283
3284 hostap_init_data(local); 3279 hostap_init_data(local);
3285 return dev; 3280 return dev;
3286 3281
@@ -3307,6 +3302,10 @@ static int hostap_hw_ready(struct net_device *dev)
3307 netif_carrier_off(local->ddev); 3302 netif_carrier_off(local->ddev);
3308 } 3303 }
3309 hostap_init_proc(local); 3304 hostap_init_proc(local);
3305#ifndef PRISM2_NO_PROCFS_DEBUG
3306 create_proc_read_entry("registers", 0, local->proc,
3307 prism2_registers_proc_read, local);
3308#endif /* PRISM2_NO_PROCFS_DEBUG */
3310 hostap_init_ap_proc(local); 3309 hostap_init_ap_proc(local);
3311 return 0; 3310 return 0;
3312 } 3311 }
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 20d387f6658c..f7aec9309d04 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -682,7 +682,13 @@ static int prism2_close(struct net_device *dev)
682 netif_device_detach(dev); 682 netif_device_detach(dev);
683 } 683 }
684 684
685 flush_scheduled_work(); 685 cancel_work_sync(&local->reset_queue);
686 cancel_work_sync(&local->set_multicast_list_queue);
687 cancel_work_sync(&local->set_tim_queue);
688#ifndef PRISM2_NO_STATION_MODES
689 cancel_work_sync(&local->info_queue);
690#endif
691 cancel_work_sync(&local->comms_qual_update);
686 692
687 module_put(local->hw_module); 693 module_put(local->hw_module);
688 694
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index fa87c5c2ae0b..6e704608947c 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1753,6 +1753,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1753 1753
1754 if (priv->workqueue) { 1754 if (priv->workqueue) {
1755 cancel_delayed_work(&priv->request_scan); 1755 cancel_delayed_work(&priv->request_scan);
1756 cancel_delayed_work(&priv->request_direct_scan);
1757 cancel_delayed_work(&priv->request_passive_scan);
1756 cancel_delayed_work(&priv->scan_event); 1758 cancel_delayed_work(&priv->scan_event);
1757 } 1759 }
1758 queue_work(priv->workqueue, &priv->down); 1760 queue_work(priv->workqueue, &priv->down);
@@ -2005,6 +2007,8 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
2005 wake_up_interruptible(&priv->wait_command_queue); 2007 wake_up_interruptible(&priv->wait_command_queue);
2006 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 2008 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING);
2007 cancel_delayed_work(&priv->request_scan); 2009 cancel_delayed_work(&priv->request_scan);
2010 cancel_delayed_work(&priv->request_direct_scan);
2011 cancel_delayed_work(&priv->request_passive_scan);
2008 cancel_delayed_work(&priv->scan_event); 2012 cancel_delayed_work(&priv->scan_event);
2009 schedule_work(&priv->link_down); 2013 schedule_work(&priv->link_down);
2010 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); 2014 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ);
@@ -4712,6 +4716,12 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4712 priv->status &= ~STATUS_SCAN_FORCED; 4716 priv->status &= ~STATUS_SCAN_FORCED;
4713#endif /* CONFIG_IPW2200_MONITOR */ 4717#endif /* CONFIG_IPW2200_MONITOR */
4714 4718
4719 /* Do queued direct scans first */
4720 if (priv->status & STATUS_DIRECT_SCAN_PENDING) {
4721 queue_delayed_work(priv->workqueue,
4722 &priv->request_direct_scan, 0);
4723 }
4724
4715 if (!(priv->status & (STATUS_ASSOCIATED | 4725 if (!(priv->status & (STATUS_ASSOCIATED |
4716 STATUS_ASSOCIATING | 4726 STATUS_ASSOCIATING |
4717 STATUS_ROAMING | 4727 STATUS_ROAMING |
@@ -6267,7 +6277,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
6267 } 6277 }
6268} 6278}
6269 6279
6270static int ipw_request_scan_helper(struct ipw_priv *priv, int type) 6280static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct)
6271{ 6281{
6272 struct ipw_scan_request_ext scan; 6282 struct ipw_scan_request_ext scan;
6273 int err = 0, scan_type; 6283 int err = 0, scan_type;
@@ -6278,22 +6288,31 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type)
6278 6288
6279 mutex_lock(&priv->mutex); 6289 mutex_lock(&priv->mutex);
6280 6290
6291 if (direct && (priv->direct_scan_ssid_len == 0)) {
6292 IPW_DEBUG_HC("Direct scan requested but no SSID to scan for\n");
6293 priv->status &= ~STATUS_DIRECT_SCAN_PENDING;
6294 goto done;
6295 }
6296
6281 if (priv->status & STATUS_SCANNING) { 6297 if (priv->status & STATUS_SCANNING) {
6282 IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); 6298 IPW_DEBUG_HC("Concurrent scan requested. Queuing.\n");
6283 priv->status |= STATUS_SCAN_PENDING; 6299 priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING :
6300 STATUS_SCAN_PENDING;
6284 goto done; 6301 goto done;
6285 } 6302 }
6286 6303
6287 if (!(priv->status & STATUS_SCAN_FORCED) && 6304 if (!(priv->status & STATUS_SCAN_FORCED) &&
6288 priv->status & STATUS_SCAN_ABORTING) { 6305 priv->status & STATUS_SCAN_ABORTING) {
6289 IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); 6306 IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n");
6290 priv->status |= STATUS_SCAN_PENDING; 6307 priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING :
6308 STATUS_SCAN_PENDING;
6291 goto done; 6309 goto done;
6292 } 6310 }
6293 6311
6294 if (priv->status & STATUS_RF_KILL_MASK) { 6312 if (priv->status & STATUS_RF_KILL_MASK) {
6295 IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); 6313 IPW_DEBUG_HC("Queuing scan due to RF Kill activation\n");
6296 priv->status |= STATUS_SCAN_PENDING; 6314 priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING :
6315 STATUS_SCAN_PENDING;
6297 goto done; 6316 goto done;
6298 } 6317 }
6299 6318
@@ -6321,6 +6340,7 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type)
6321 cpu_to_le16(20); 6340 cpu_to_le16(20);
6322 6341
6323 scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); 6342 scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120);
6343 scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20);
6324 6344
6325#ifdef CONFIG_IPW2200_MONITOR 6345#ifdef CONFIG_IPW2200_MONITOR
6326 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 6346 if (priv->ieee->iw_mode == IW_MODE_MONITOR) {
@@ -6360,13 +6380,23 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type)
6360 cpu_to_le16(2000); 6380 cpu_to_le16(2000);
6361 } else { 6381 } else {
6362#endif /* CONFIG_IPW2200_MONITOR */ 6382#endif /* CONFIG_IPW2200_MONITOR */
6363 /* If we are roaming, then make this a directed scan for the 6383 /* Honor direct scans first, otherwise if we are roaming make
6364 * current network. Otherwise, ensure that every other scan 6384 * this a direct scan for the current network. Finally,
6365 * is a fast channel hop scan */ 6385 * ensure that every other scan is a fast channel hop scan */
6366 if ((priv->status & STATUS_ROAMING) 6386 if (direct) {
6367 || (!(priv->status & STATUS_ASSOCIATED) 6387 err = ipw_send_ssid(priv, priv->direct_scan_ssid,
6368 && (priv->config & CFG_STATIC_ESSID) 6388 priv->direct_scan_ssid_len);
6369 && (le32_to_cpu(scan.full_scan_index) % 2))) { 6389 if (err) {
6390 IPW_DEBUG_HC("Attempt to send SSID command "
6391 "failed\n");
6392 goto done;
6393 }
6394
6395 scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN;
6396 } else if ((priv->status & STATUS_ROAMING)
6397 || (!(priv->status & STATUS_ASSOCIATED)
6398 && (priv->config & CFG_STATIC_ESSID)
6399 && (le32_to_cpu(scan.full_scan_index) % 2))) {
6370 err = ipw_send_ssid(priv, priv->essid, priv->essid_len); 6400 err = ipw_send_ssid(priv, priv->essid, priv->essid_len);
6371 if (err) { 6401 if (err) {
6372 IPW_DEBUG_HC("Attempt to send SSID command " 6402 IPW_DEBUG_HC("Attempt to send SSID command "
@@ -6391,7 +6421,12 @@ send_request:
6391 } 6421 }
6392 6422
6393 priv->status |= STATUS_SCANNING; 6423 priv->status |= STATUS_SCANNING;
6394 priv->status &= ~STATUS_SCAN_PENDING; 6424 if (direct) {
6425 priv->status &= ~STATUS_DIRECT_SCAN_PENDING;
6426 priv->direct_scan_ssid_len = 0;
6427 } else
6428 priv->status &= ~STATUS_SCAN_PENDING;
6429
6395 queue_delayed_work(priv->workqueue, &priv->scan_check, 6430 queue_delayed_work(priv->workqueue, &priv->scan_check,
6396 IPW_SCAN_CHECK_WATCHDOG); 6431 IPW_SCAN_CHECK_WATCHDOG);
6397done: 6432done:
@@ -6402,15 +6437,22 @@ done:
6402static void ipw_request_passive_scan(struct work_struct *work) 6437static void ipw_request_passive_scan(struct work_struct *work)
6403{ 6438{
6404 struct ipw_priv *priv = 6439 struct ipw_priv *priv =
6405 container_of(work, struct ipw_priv, request_passive_scan); 6440 container_of(work, struct ipw_priv, request_passive_scan.work);
6406 ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE); 6441 ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE, 0);
6407} 6442}
6408 6443
6409static void ipw_request_scan(struct work_struct *work) 6444static void ipw_request_scan(struct work_struct *work)
6410{ 6445{
6411 struct ipw_priv *priv = 6446 struct ipw_priv *priv =
6412 container_of(work, struct ipw_priv, request_scan.work); 6447 container_of(work, struct ipw_priv, request_scan.work);
6413 ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE); 6448 ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 0);
6449}
6450
6451static void ipw_request_direct_scan(struct work_struct *work)
6452{
6453 struct ipw_priv *priv =
6454 container_of(work, struct ipw_priv, request_direct_scan.work);
6455 ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 1);
6414} 6456}
6415 6457
6416static void ipw_bg_abort_scan(struct work_struct *work) 6458static void ipw_bg_abort_scan(struct work_struct *work)
@@ -7558,8 +7600,31 @@ static int ipw_associate(void *data)
7558 priv->ieee->iw_mode == IW_MODE_ADHOC && 7600 priv->ieee->iw_mode == IW_MODE_ADHOC &&
7559 priv->config & CFG_ADHOC_CREATE && 7601 priv->config & CFG_ADHOC_CREATE &&
7560 priv->config & CFG_STATIC_ESSID && 7602 priv->config & CFG_STATIC_ESSID &&
7561 priv->config & CFG_STATIC_CHANNEL && 7603 priv->config & CFG_STATIC_CHANNEL) {
7562 !list_empty(&priv->ieee->network_free_list)) { 7604 /* Use oldest network if the free list is empty */
7605 if (list_empty(&priv->ieee->network_free_list)) {
7606 struct ieee80211_network *oldest = NULL;
7607 struct ieee80211_network *target;
7608 DECLARE_MAC_BUF(mac);
7609
7610 list_for_each_entry(target, &priv->ieee->network_list, list) {
7611 if ((oldest == NULL) ||
7612 (target->last_scanned < oldest->last_scanned))
7613 oldest = target;
7614 }
7615
7616 /* If there are no more slots, expire the oldest */
7617 list_del(&oldest->list);
7618 target = oldest;
7619 IPW_DEBUG_ASSOC("Expired '%s' (%s) from "
7620 "network list.\n",
7621 escape_essid(target->ssid,
7622 target->ssid_len),
7623 print_mac(mac, target->bssid));
7624 list_add_tail(&target->list,
7625 &priv->ieee->network_free_list);
7626 }
7627
7563 element = priv->ieee->network_free_list.next; 7628 element = priv->ieee->network_free_list.next;
7564 network = list_entry(element, struct ieee80211_network, list); 7629 network = list_entry(element, struct ieee80211_network, list);
7565 ipw_adhoc_create(priv, network); 7630 ipw_adhoc_create(priv, network);
@@ -9454,99 +9519,38 @@ static int ipw_wx_get_retry(struct net_device *dev,
9454 return 0; 9519 return 0;
9455} 9520}
9456 9521
9457static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid,
9458 int essid_len)
9459{
9460 struct ipw_scan_request_ext scan;
9461 int err = 0, scan_type;
9462
9463 if (!(priv->status & STATUS_INIT) ||
9464 (priv->status & STATUS_EXIT_PENDING))
9465 return 0;
9466
9467 mutex_lock(&priv->mutex);
9468
9469 if (priv->status & STATUS_RF_KILL_MASK) {
9470 IPW_DEBUG_HC("Aborting scan due to RF kill activation\n");
9471 priv->status |= STATUS_SCAN_PENDING;
9472 goto done;
9473 }
9474
9475 IPW_DEBUG_HC("starting request direct scan!\n");
9476
9477 if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) {
9478 /* We should not sleep here; otherwise we will block most
9479 * of the system (for instance, we hold rtnl_lock when we
9480 * get here).
9481 */
9482 err = -EAGAIN;
9483 goto done;
9484 }
9485 memset(&scan, 0, sizeof(scan));
9486
9487 if (priv->config & CFG_SPEED_SCAN)
9488 scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =
9489 cpu_to_le16(30);
9490 else
9491 scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =
9492 cpu_to_le16(20);
9493
9494 scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] =
9495 cpu_to_le16(20);
9496 scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120);
9497 scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20);
9498
9499 scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee));
9500
9501 err = ipw_send_ssid(priv, essid, essid_len);
9502 if (err) {
9503 IPW_DEBUG_HC("Attempt to send SSID command failed\n");
9504 goto done;
9505 }
9506 scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN;
9507
9508 ipw_add_scan_channels(priv, &scan, scan_type);
9509
9510 err = ipw_send_scan_request_ext(priv, &scan);
9511 if (err) {
9512 IPW_DEBUG_HC("Sending scan command failed: %08X\n", err);
9513 goto done;
9514 }
9515
9516 priv->status |= STATUS_SCANNING;
9517
9518 done:
9519 mutex_unlock(&priv->mutex);
9520 return err;
9521}
9522
9523static int ipw_wx_set_scan(struct net_device *dev, 9522static int ipw_wx_set_scan(struct net_device *dev,
9524 struct iw_request_info *info, 9523 struct iw_request_info *info,
9525 union iwreq_data *wrqu, char *extra) 9524 union iwreq_data *wrqu, char *extra)
9526{ 9525{
9527 struct ipw_priv *priv = ieee80211_priv(dev); 9526 struct ipw_priv *priv = ieee80211_priv(dev);
9528 struct iw_scan_req *req = (struct iw_scan_req *)extra; 9527 struct iw_scan_req *req = (struct iw_scan_req *)extra;
9528 struct delayed_work *work = NULL;
9529 9529
9530 mutex_lock(&priv->mutex); 9530 mutex_lock(&priv->mutex);
9531
9531 priv->user_requested_scan = 1; 9532 priv->user_requested_scan = 1;
9532 mutex_unlock(&priv->mutex);
9533 9533
9534 if (wrqu->data.length == sizeof(struct iw_scan_req)) { 9534 if (wrqu->data.length == sizeof(struct iw_scan_req)) {
9535 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { 9535 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
9536 ipw_request_direct_scan(priv, req->essid, 9536 int len = min((int)req->essid_len,
9537 req->essid_len); 9537 (int)sizeof(priv->direct_scan_ssid));
9538 return 0; 9538 memcpy(priv->direct_scan_ssid, req->essid, len);
9539 } 9539 priv->direct_scan_ssid_len = len;
9540 if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { 9540 work = &priv->request_direct_scan;
9541 queue_work(priv->workqueue, 9541 } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) {
9542 &priv->request_passive_scan); 9542 work = &priv->request_passive_scan;
9543 return 0;
9544 } 9543 }
9544 } else {
9545 /* Normal active broadcast scan */
9546 work = &priv->request_scan;
9545 } 9547 }
9546 9548
9549 mutex_unlock(&priv->mutex);
9550
9547 IPW_DEBUG_WX("Start scan\n"); 9551 IPW_DEBUG_WX("Start scan\n");
9548 9552
9549 queue_delayed_work(priv->workqueue, &priv->request_scan, 0); 9553 queue_delayed_work(priv->workqueue, work, 0);
9550 9554
9551 return 0; 9555 return 0;
9552} 9556}
@@ -10708,6 +10712,8 @@ static void ipw_link_up(struct ipw_priv *priv)
10708 } 10712 }
10709 10713
10710 cancel_delayed_work(&priv->request_scan); 10714 cancel_delayed_work(&priv->request_scan);
10715 cancel_delayed_work(&priv->request_direct_scan);
10716 cancel_delayed_work(&priv->request_passive_scan);
10711 cancel_delayed_work(&priv->scan_event); 10717 cancel_delayed_work(&priv->scan_event);
10712 ipw_reset_stats(priv); 10718 ipw_reset_stats(priv);
10713 /* Ensure the rate is updated immediately */ 10719 /* Ensure the rate is updated immediately */
@@ -10738,6 +10744,8 @@ static void ipw_link_down(struct ipw_priv *priv)
10738 10744
10739 /* Cancel any queued work ... */ 10745 /* Cancel any queued work ... */
10740 cancel_delayed_work(&priv->request_scan); 10746 cancel_delayed_work(&priv->request_scan);
10747 cancel_delayed_work(&priv->request_direct_scan);
10748 cancel_delayed_work(&priv->request_passive_scan);
10741 cancel_delayed_work(&priv->adhoc_check); 10749 cancel_delayed_work(&priv->adhoc_check);
10742 cancel_delayed_work(&priv->gather_stats); 10750 cancel_delayed_work(&priv->gather_stats);
10743 10751
@@ -10777,8 +10785,9 @@ static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
10777 INIT_WORK(&priv->up, ipw_bg_up); 10785 INIT_WORK(&priv->up, ipw_bg_up);
10778 INIT_WORK(&priv->down, ipw_bg_down); 10786 INIT_WORK(&priv->down, ipw_bg_down);
10779 INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan); 10787 INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan);
10788 INIT_DELAYED_WORK(&priv->request_direct_scan, ipw_request_direct_scan);
10789 INIT_DELAYED_WORK(&priv->request_passive_scan, ipw_request_passive_scan);
10780 INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event); 10790 INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event);
10781 INIT_WORK(&priv->request_passive_scan, ipw_request_passive_scan);
10782 INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats); 10791 INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats);
10783 INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan); 10792 INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan);
10784 INIT_WORK(&priv->roam, ipw_bg_roam); 10793 INIT_WORK(&priv->roam, ipw_bg_roam);
@@ -11584,6 +11593,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11584 priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit; 11593 priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit;
11585 11594
11586 priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR; 11595 priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
11596 SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
11587 11597
11588 rc = register_netdev(priv->prom_net_dev); 11598 rc = register_netdev(priv->prom_net_dev);
11589 if (rc) { 11599 if (rc) {
@@ -11811,6 +11821,8 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11811 cancel_delayed_work(&priv->adhoc_check); 11821 cancel_delayed_work(&priv->adhoc_check);
11812 cancel_delayed_work(&priv->gather_stats); 11822 cancel_delayed_work(&priv->gather_stats);
11813 cancel_delayed_work(&priv->request_scan); 11823 cancel_delayed_work(&priv->request_scan);
11824 cancel_delayed_work(&priv->request_direct_scan);
11825 cancel_delayed_work(&priv->request_passive_scan);
11814 cancel_delayed_work(&priv->scan_event); 11826 cancel_delayed_work(&priv->scan_event);
11815 cancel_delayed_work(&priv->rf_kill); 11827 cancel_delayed_work(&priv->rf_kill);
11816 cancel_delayed_work(&priv->scan_check); 11828 cancel_delayed_work(&priv->scan_check);
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index cd3295b66dd6..d4ab28b73b32 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -1037,6 +1037,7 @@ struct ipw_cmd { /* XXX */
1037#define STATUS_DISASSOC_PENDING (1<<12) 1037#define STATUS_DISASSOC_PENDING (1<<12)
1038#define STATUS_STATE_PENDING (1<<13) 1038#define STATUS_STATE_PENDING (1<<13)
1039 1039
1040#define STATUS_DIRECT_SCAN_PENDING (1<<19)
1040#define STATUS_SCAN_PENDING (1<<20) 1041#define STATUS_SCAN_PENDING (1<<20)
1041#define STATUS_SCANNING (1<<21) 1042#define STATUS_SCANNING (1<<21)
1042#define STATUS_SCAN_ABORTING (1<<22) 1043#define STATUS_SCAN_ABORTING (1<<22)
@@ -1292,6 +1293,8 @@ struct ipw_priv {
1292 struct iw_public_data wireless_data; 1293 struct iw_public_data wireless_data;
1293 1294
1294 int user_requested_scan; 1295 int user_requested_scan;
1296 u8 direct_scan_ssid[IW_ESSID_MAX_SIZE];
1297 u8 direct_scan_ssid_len;
1295 1298
1296 struct workqueue_struct *workqueue; 1299 struct workqueue_struct *workqueue;
1297 1300
@@ -1301,8 +1304,9 @@ struct ipw_priv {
1301 struct work_struct system_config; 1304 struct work_struct system_config;
1302 struct work_struct rx_replenish; 1305 struct work_struct rx_replenish;
1303 struct delayed_work request_scan; 1306 struct delayed_work request_scan;
1307 struct delayed_work request_direct_scan;
1308 struct delayed_work request_passive_scan;
1304 struct delayed_work scan_event; 1309 struct delayed_work scan_event;
1305 struct work_struct request_passive_scan;
1306 struct work_struct adapter_restart; 1310 struct work_struct adapter_restart;
1307 struct delayed_work rf_kill; 1311 struct delayed_work rf_kill;
1308 struct work_struct up; 1312 struct work_struct up;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index d200d08fb086..8b1528e52d43 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -229,14 +229,15 @@ static int iwl3945_led_register_led(struct iwl3945_priv *priv,
229 led->led_dev.brightness_set = iwl3945_led_brightness_set; 229 led->led_dev.brightness_set = iwl3945_led_brightness_set;
230 led->led_dev.default_trigger = trigger; 230 led->led_dev.default_trigger = trigger;
231 231
232 led->priv = priv;
233 led->type = type;
234
232 ret = led_classdev_register(device, &led->led_dev); 235 ret = led_classdev_register(device, &led->led_dev);
233 if (ret) { 236 if (ret) {
234 IWL_ERROR("Error: failed to register led handler.\n"); 237 IWL_ERROR("Error: failed to register led handler.\n");
235 return ret; 238 return ret;
236 } 239 }
237 240
238 led->priv = priv;
239 led->type = type;
240 led->registered = 1; 241 led->registered = 1;
241 242
242 if (set_led && led->led_on) 243 if (set_led && led->led_on)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index d3406830c8e3..62a3d8f8563e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -666,7 +666,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
666 rx_status.flag = 0; 666 rx_status.flag = 0;
667 rx_status.mactime = le64_to_cpu(rx_end->timestamp); 667 rx_status.mactime = le64_to_cpu(rx_end->timestamp);
668 rx_status.freq = 668 rx_status.freq =
669 ieee80211_frequency_to_channel(le16_to_cpu(rx_hdr->channel)); 669 ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel));
670 rx_status.band = (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? 670 rx_status.band = (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
671 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; 671 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
672 672
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index b608e1ca8b40..3a7f0cb710ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -163,8 +163,8 @@ struct iwl4965_lq_sta {
163 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; 163 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
164#endif 164#endif
165 struct iwl4965_rate dbg_fixed; 165 struct iwl4965_rate dbg_fixed;
166 struct iwl_priv *drv;
167#endif 166#endif
167 struct iwl_priv *drv;
168}; 168};
169 169
170static void rs_rate_scale_perform(struct iwl_priv *priv, 170static void rs_rate_scale_perform(struct iwl_priv *priv,
@@ -1162,7 +1162,6 @@ static s32 rs_get_best_rate(struct iwl_priv *priv,
1162 1162
1163 /* Higher rate not available, use the original */ 1163 /* Higher rate not available, use the original */
1164 } else { 1164 } else {
1165 new_rate = rate;
1166 break; 1165 break;
1167 } 1166 }
1168 } 1167 }
@@ -2009,7 +2008,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2009 * 2) Not just finishing up a search 2008 * 2) Not just finishing up a search
2010 * 3) Allowing a new search 2009 * 3) Allowing a new search
2011 */ 2010 */
2012 if (!update_lq && !done_search && !lq_sta->stay_in_tbl) { 2011 if (!update_lq && !done_search && !lq_sta->stay_in_tbl && window->counter) {
2013 /* Save current throughput to compare with "search" throughput*/ 2012 /* Save current throughput to compare with "search" throughput*/
2014 lq_sta->last_tpt = current_tpt; 2013 lq_sta->last_tpt = current_tpt;
2015 2014
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 17f629fb96ff..bf19eb8aafd0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3978,7 +3978,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3978 3978
3979 rx_status.mactime = le64_to_cpu(rx_start->timestamp); 3979 rx_status.mactime = le64_to_cpu(rx_start->timestamp);
3980 rx_status.freq = 3980 rx_status.freq =
3981 ieee80211_frequency_to_channel(le16_to_cpu(rx_start->channel)); 3981 ieee80211_channel_to_frequency(le16_to_cpu(rx_start->channel));
3982 rx_status.band = (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? 3982 rx_status.band = (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
3983 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; 3983 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
3984 rx_status.rate_idx = 3984 rx_status.rate_idx =
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 6328b9593877..8124fd9b1353 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1842,6 +1842,9 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
1842 1842
1843 spin_lock_irqsave(&priv->driver_lock, flags); 1843 spin_lock_irqsave(&priv->driver_lock, flags);
1844 1844
1845 /* We don't get a response on the sleep-confirmation */
1846 priv->dnld_sent = DNLD_RES_RECEIVED;
1847
1845 /* If nothing to do, go back to sleep (?) */ 1848 /* If nothing to do, go back to sleep (?) */
1846 if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) 1849 if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx])
1847 priv->psstate = PS_STATE_SLEEP; 1850 priv->psstate = PS_STATE_SLEEP;
@@ -1904,12 +1907,12 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
1904 1907
1905 lbs_deb_enter(LBS_DEB_HOST); 1908 lbs_deb_enter(LBS_DEB_HOST);
1906 1909
1910 spin_lock_irqsave(&priv->driver_lock, flags);
1907 if (priv->dnld_sent) { 1911 if (priv->dnld_sent) {
1908 allowed = 0; 1912 allowed = 0;
1909 lbs_deb_host("dnld_sent was set\n"); 1913 lbs_deb_host("dnld_sent was set\n");
1910 } 1914 }
1911 1915
1912 spin_lock_irqsave(&priv->driver_lock, flags);
1913 /* In-progress command? */ 1916 /* In-progress command? */
1914 if (priv->cur_cmd) { 1917 if (priv->cur_cmd) {
1915 allowed = 0; 1918 allowed = 0;
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index ad2fabca9116..0aa0ce3b2c42 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -312,8 +312,8 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
312 if (tlv_type != TLV_TYPE_BCNMISS) 312 if (tlv_type != TLV_TYPE_BCNMISS)
313 tlv->freq = freq; 313 tlv->freq = freq;
314 314
315 /* The command header, the event mask, and the one TLV */ 315 /* The command header, the action, the event mask, and one TLV */
316 events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 2 + sizeof(*tlv)); 316 events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 4 + sizeof(*tlv));
317 317
318 ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); 318 ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events);
319 319
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index dcfdb404678b..688d60de55cb 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -73,8 +73,8 @@ out:
73 return ret; 73 return ret;
74} 74}
75 75
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, u64 * data) 77 struct ethtool_stats *stats, uint64_t *data)
78{ 78{
79 struct lbs_private *priv = dev->priv; 79 struct lbs_private *priv = dev->priv;
80 struct cmd_ds_mesh_access mesh_access; 80 struct cmd_ds_mesh_access mesh_access;
@@ -83,12 +83,12 @@ static void lbs_ethtool_get_stats(struct net_device * dev,
83 lbs_deb_enter(LBS_DEB_ETHTOOL); 83 lbs_deb_enter(LBS_DEB_ETHTOOL);
84 84
85 /* Get Mesh Statistics */ 85 /* Get Mesh Statistics */
86 ret = lbs_prepare_and_send_command(priv, 86 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
87 CMD_MESH_ACCESS, CMD_ACT_MESH_GET_STATS,
88 CMD_OPTION_WAITFORRSP, 0, &mesh_access);
89 87
90 if (ret) 88 if (ret) {
89 memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t)));
91 return; 90 return;
91 }
92 92
93 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); 93 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
94 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); 94 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
@@ -111,19 +111,18 @@ static void lbs_ethtool_get_stats(struct net_device * dev,
111 lbs_deb_enter(LBS_DEB_ETHTOOL); 111 lbs_deb_enter(LBS_DEB_ETHTOOL);
112} 112}
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 switch (sset) { 116 struct lbs_private *priv = dev->priv;
117 case ETH_SS_STATS: 117
118 if (sset == ETH_SS_STATS && dev == priv->mesh_dev)
118 return MESH_STATS_NUM; 119 return MESH_STATS_NUM;
119 default: 120
120 return -EOPNOTSUPP; 121 return -EOPNOTSUPP;
121 }
122} 122}
123 123
124static void lbs_ethtool_get_strings(struct net_device *dev, 124static void lbs_ethtool_get_strings(struct net_device *dev,
125 u32 stringset, 125 uint32_t stringset, uint8_t *s)
126 u8 * s)
127{ 126{
128 int i; 127 int i;
129 128
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 406f54d40956..acfc4bfcc262 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -732,8 +732,8 @@ static int lbs_thread(void *data)
732 lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n", 732 lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n",
733 priv->currenttxskb, priv->dnld_sent); 733 priv->currenttxskb, priv->dnld_sent);
734 734
735 spin_lock_irq(&priv->driver_lock);
736 /* Process any pending command response */ 735 /* Process any pending command response */
736 spin_lock_irq(&priv->driver_lock);
737 resp_idx = priv->resp_idx; 737 resp_idx = priv->resp_idx;
738 if (priv->resp_len[resp_idx]) { 738 if (priv->resp_len[resp_idx]) {
739 spin_unlock_irq(&priv->driver_lock); 739 spin_unlock_irq(&priv->driver_lock);
@@ -756,6 +756,7 @@ static int lbs_thread(void *data)
756 priv->nr_retries = 0; 756 priv->nr_retries = 0;
757 } else { 757 } else {
758 priv->cur_cmd = NULL; 758 priv->cur_cmd = NULL;
759 priv->dnld_sent = DNLD_RES_RECEIVED;
759 lbs_pr_info("requeueing command %x due to timeout (#%d)\n", 760 lbs_pr_info("requeueing command %x due to timeout (#%d)\n",
760 le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries); 761 le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries);
761 762
@@ -1564,6 +1565,7 @@ static int lbs_add_rtap(struct lbs_private *priv)
1564 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; 1565 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit;
1565 rtap_dev->set_multicast_list = lbs_set_multicast_list; 1566 rtap_dev->set_multicast_list = lbs_set_multicast_list;
1566 rtap_dev->priv = priv; 1567 rtap_dev->priv = priv;
1568 SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent);
1567 1569
1568 ret = register_netdev(rtap_dev); 1570 ret = register_netdev(rtap_dev);
1569 if (ret) { 1571 if (ret) {
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 8b7f5768a103..1c216e015f64 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -461,6 +461,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
461 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */ 461 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */
462 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */ 462 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */
463 PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */ 463 PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */
464 PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), /* SpeedStream Wireless Adapter */
464 PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */ 465 PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */
465 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */ 466 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */
466 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */ 467 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 98ddbb3b3273..1610a7308c1d 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -49,6 +49,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
49 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ 49 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */
50 50
51 /* Version 2 devices (3887) */ 51 /* Version 2 devices (3887) */
52 {USB_DEVICE(0x0471, 0x1230)}, /* Philips CPWUA054/00 */
52 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ 53 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
53 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ 54 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
54 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ 55 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
index 04c2638d75ad..9196825ed1b5 100644
--- a/drivers/net/wireless/prism54/islpci_dev.c
+++ b/drivers/net/wireless/prism54/islpci_dev.c
@@ -388,8 +388,15 @@ islpci_open(struct net_device *ndev)
388 388
389 netif_start_queue(ndev); 389 netif_start_queue(ndev);
390 390
391 /* Turn off carrier unless we know we have associated */ 391 /* Turn off carrier if in STA or Ad-hoc mode. It will be turned on
392 netif_carrier_off(ndev); 392 * once the firmware receives a trap of being associated
393 * (GEN_OID_LINKSTATE). In other modes (AP or WDS or monitor) we
394 * should just leave the carrier on as its expected the firmware
395 * won't send us a trigger. */
396 if (priv->iw_mode == IW_MODE_INFRA || priv->iw_mode == IW_MODE_ADHOC)
397 netif_carrier_off(ndev);
398 else
399 netif_carrier_on(ndev);
393 400
394 return 0; 401 return 0;
395} 402}
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index d0b1fb15c709..18c9931e3267 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -116,6 +116,7 @@ MODULE_PARM_DESC(workaround_interval,
116#define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b) 116#define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b)
117#define OID_802_11_ADD_KEY ccpu2(0x0d01011d) 117#define OID_802_11_ADD_KEY ccpu2(0x0d01011d)
118#define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e) 118#define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e)
119#define OID_802_11_ASSOCIATION_INFORMATION ccpu2(0x0d01011f)
119#define OID_802_11_PMKID ccpu2(0x0d010123) 120#define OID_802_11_PMKID ccpu2(0x0d010123)
120#define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203) 121#define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203)
121#define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204) 122#define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204)
@@ -271,6 +272,26 @@ struct ndis_config_param {
271 __le32 value_length; 272 __le32 value_length;
272} __attribute__((packed)); 273} __attribute__((packed));
273 274
275struct ndis_80211_assoc_info {
276 __le32 length;
277 __le16 req_ies;
278 struct req_ie {
279 __le16 capa;
280 __le16 listen_interval;
281 u8 cur_ap_address[6];
282 } req_ie;
283 __le32 req_ie_length;
284 __le32 offset_req_ies;
285 __le16 resp_ies;
286 struct resp_ie {
287 __le16 capa;
288 __le16 status_code;
289 __le16 assoc_id;
290 } resp_ie;
291 __le32 resp_ie_length;
292 __le32 offset_resp_ies;
293} __attribute__((packed));
294
274/* these have to match what is in wpa_supplicant */ 295/* these have to match what is in wpa_supplicant */
275enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; 296enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP };
276enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, 297enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
@@ -674,6 +695,12 @@ static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN])
674 return ret; 695 return ret;
675} 696}
676 697
698static int get_association_info(struct usbnet *usbdev,
699 struct ndis_80211_assoc_info *info, int len)
700{
701 return rndis_query_oid(usbdev, OID_802_11_ASSOCIATION_INFORMATION,
702 info, &len);
703}
677 704
678static int is_associated(struct usbnet *usbdev) 705static int is_associated(struct usbnet *usbdev)
679{ 706{
@@ -2182,11 +2209,40 @@ static void rndis_wext_worker(struct work_struct *work)
2182 struct usbnet *usbdev = priv->usbdev; 2209 struct usbnet *usbdev = priv->usbdev;
2183 union iwreq_data evt; 2210 union iwreq_data evt;
2184 unsigned char bssid[ETH_ALEN]; 2211 unsigned char bssid[ETH_ALEN];
2185 int ret; 2212 struct ndis_80211_assoc_info *info;
2213 int assoc_size = sizeof(*info) + IW_CUSTOM_MAX + 32;
2214 int ret, offset;
2186 2215
2187 if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) { 2216 if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) {
2188 ret = get_bssid(usbdev, bssid); 2217 info = kzalloc(assoc_size, GFP_KERNEL);
2218 if (!info)
2219 goto get_bssid;
2220
2221 /* Get association info IEs from device and send them back to
2222 * userspace. */
2223 ret = get_association_info(usbdev, info, assoc_size);
2224 if (!ret) {
2225 evt.data.length = le32_to_cpu(info->req_ie_length);
2226 if (evt.data.length > 0) {
2227 offset = le32_to_cpu(info->offset_req_ies);
2228 wireless_send_event(usbdev->net,
2229 IWEVASSOCREQIE, &evt,
2230 (char *)info + offset);
2231 }
2232
2233 evt.data.length = le32_to_cpu(info->resp_ie_length);
2234 if (evt.data.length > 0) {
2235 offset = le32_to_cpu(info->offset_resp_ies);
2236 wireless_send_event(usbdev->net,
2237 IWEVASSOCRESPIE, &evt,
2238 (char *)info + offset);
2239 }
2240 }
2241
2242 kfree(info);
2189 2243
2244get_bssid:
2245 ret = get_bssid(usbdev, bssid);
2190 if (!ret) { 2246 if (!ret) {
2191 evt.data.flags = 0; 2247 evt.data.flags = 0;
2192 evt.data.length = 0; 2248 evt.data.length = 0;
@@ -2414,6 +2470,11 @@ static int bcm4320_early_init(struct usbnet *dev)
2414 else if (priv->param_power_save > 2) 2470 else if (priv->param_power_save > 2)
2415 priv->param_power_save = 2; 2471 priv->param_power_save = 2;
2416 2472
2473 if (priv->param_power_output < 0)
2474 priv->param_power_output = 0;
2475 else if (priv->param_power_output > 3)
2476 priv->param_power_output = 3;
2477
2417 if (priv->param_roamtrigger < -80) 2478 if (priv->param_roamtrigger < -80)
2418 priv->param_roamtrigger = -80; 2479 priv->param_roamtrigger = -80;
2419 else if (priv->param_roamtrigger > -60) 2480 else if (priv->param_roamtrigger > -60)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 57bdc153952f..611d98320593 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -328,6 +328,11 @@ static inline int rt2x00_get_link_ant_rssi(struct link *link)
328 return DEFAULT_RSSI; 328 return DEFAULT_RSSI;
329} 329}
330 330
331static inline void rt2x00_reset_link_ant_rssi(struct link *link)
332{
333 link->ant.rssi_ant = 0;
334}
335
331static inline int rt2x00_get_link_ant_rssi_history(struct link *link, 336static inline int rt2x00_get_link_ant_rssi_history(struct link *link,
332 enum antenna ant) 337 enum antenna ant)
333{ 338{
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index a9930a03f450..48608e8cc8b4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -129,6 +129,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
129 */ 129 */
130 rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA); 130 rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA);
131 rt2x00lib_reset_link_tuner(rt2x00dev); 131 rt2x00lib_reset_link_tuner(rt2x00dev);
132 rt2x00_reset_link_ant_rssi(&rt2x00dev->link);
132 133
133 rt2x00dev->link.ant.active.rx = libconf.ant.rx; 134 rt2x00dev->link.ant.active.rx = libconf.ant.rx;
134 rt2x00dev->link.ant.active.tx = libconf.ant.tx; 135 rt2x00dev->link.ant.active.tx = libconf.ant.tx;
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 8d8657fb64dd..2673d568bcac 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -483,9 +483,9 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
483 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) 483 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
484 return; 484 return;
485 485
486 ieee80211_iterate_active_interfaces(rt2x00dev->hw, 486 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw,
487 rt2x00lib_beacondone_iter, 487 rt2x00lib_beacondone_iter,
488 rt2x00dev); 488 rt2x00dev);
489 489
490 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); 490 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work);
491} 491}
@@ -507,7 +507,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
507 * Update TX statistics. 507 * Update TX statistics.
508 */ 508 */
509 rt2x00dev->link.qual.tx_success += success; 509 rt2x00dev->link.qual.tx_success += success;
510 rt2x00dev->link.qual.tx_failed += txdesc->retry + fail; 510 rt2x00dev->link.qual.tx_failed += fail;
511 511
512 /* 512 /*
513 * Initialize TX status 513 * Initialize TX status
@@ -1032,8 +1032,10 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1032 * Initialize the device. 1032 * Initialize the device.
1033 */ 1033 */
1034 status = rt2x00dev->ops->lib->initialize(rt2x00dev); 1034 status = rt2x00dev->ops->lib->initialize(rt2x00dev);
1035 if (status) 1035 if (status) {
1036 goto exit; 1036 rt2x00queue_uninitialize(rt2x00dev);
1037 return status;
1038 }
1037 1039
1038 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); 1040 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
1039 1041
@@ -1043,11 +1045,6 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1043 rt2x00rfkill_register(rt2x00dev); 1045 rt2x00rfkill_register(rt2x00dev);
1044 1046
1045 return 0; 1047 return 0;
1046
1047exit:
1048 rt2x00lib_uninitialize(rt2x00dev);
1049
1050 return status;
1051} 1048}
1052 1049
1053int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) 1050int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index c206b5092070..87e280a21971 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -93,6 +93,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
93 */ 93 */
94 if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { 94 if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) {
95 ieee80211_stop_queues(hw); 95 ieee80211_stop_queues(hw);
96 dev_kfree_skb_any(skb);
96 return NETDEV_TX_OK; 97 return NETDEV_TX_OK;
97 } 98 }
98 99
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 7867ec64bd2c..971af2546b59 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -314,13 +314,14 @@ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)
314 if (status) { 314 if (status) {
315 ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", 315 ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n",
316 pci_dev->irq, status); 316 pci_dev->irq, status);
317 return status; 317 goto exit;
318 } 318 }
319 319
320 return 0; 320 return 0;
321 321
322exit: 322exit:
323 rt2x00pci_uninitialize(rt2x00dev); 323 queue_for_each(rt2x00dev, queue)
324 rt2x00pci_free_queue_dma(rt2x00dev, queue);
324 325
325 return status; 326 return status;
326} 327}
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index ae12dcdd3c24..14bc7b281659 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2366,6 +2366,7 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2366{ 2366{
2367 struct rt2x00_dev *rt2x00dev = hw->priv; 2367 struct rt2x00_dev *rt2x00dev = hw->priv;
2368 struct rt2x00_intf *intf = vif_to_intf(control->vif); 2368 struct rt2x00_intf *intf = vif_to_intf(control->vif);
2369 struct queue_entry_priv_pci_tx *priv_tx;
2369 struct skb_frame_desc *skbdesc; 2370 struct skb_frame_desc *skbdesc;
2370 unsigned int beacon_base; 2371 unsigned int beacon_base;
2371 u32 reg; 2372 u32 reg;
@@ -2373,21 +2374,8 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2373 if (unlikely(!intf->beacon)) 2374 if (unlikely(!intf->beacon))
2374 return -ENOBUFS; 2375 return -ENOBUFS;
2375 2376
2376 /* 2377 priv_tx = intf->beacon->priv_data;
2377 * We need to append the descriptor in front of the 2378 memset(priv_tx->desc, 0, intf->beacon->queue->desc_size);
2378 * beacon frame.
2379 */
2380 if (skb_headroom(skb) < intf->beacon->queue->desc_size) {
2381 if (pskb_expand_head(skb, intf->beacon->queue->desc_size,
2382 0, GFP_ATOMIC))
2383 return -ENOMEM;
2384 }
2385
2386 /*
2387 * Add the descriptor in front of the skb.
2388 */
2389 skb_push(skb, intf->beacon->queue->desc_size);
2390 memset(skb->data, 0, intf->beacon->queue->desc_size);
2391 2379
2392 /* 2380 /*
2393 * Fill in skb descriptor 2381 * Fill in skb descriptor
@@ -2395,9 +2383,9 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2395 skbdesc = get_skb_frame_desc(skb); 2383 skbdesc = get_skb_frame_desc(skb);
2396 memset(skbdesc, 0, sizeof(*skbdesc)); 2384 memset(skbdesc, 0, sizeof(*skbdesc));
2397 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED; 2385 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED;
2398 skbdesc->data = skb->data + intf->beacon->queue->desc_size; 2386 skbdesc->data = skb->data;
2399 skbdesc->data_len = skb->len - intf->beacon->queue->desc_size; 2387 skbdesc->data_len = skb->len;
2400 skbdesc->desc = skb->data; 2388 skbdesc->desc = priv_tx->desc;
2401 skbdesc->desc_len = intf->beacon->queue->desc_size; 2389 skbdesc->desc_len = intf->beacon->queue->desc_size;
2402 skbdesc->entry = intf->beacon; 2390 skbdesc->entry = intf->beacon;
2403 2391
@@ -2425,7 +2413,10 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2425 */ 2413 */
2426 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); 2414 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx);
2427 rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, 2415 rt2x00pci_register_multiwrite(rt2x00dev, beacon_base,
2428 skb->data, skb->len); 2416 skbdesc->desc, skbdesc->desc_len);
2417 rt2x00pci_register_multiwrite(rt2x00dev,
2418 beacon_base + skbdesc->desc_len,
2419 skbdesc->data, skbdesc->data_len);
2429 rt61pci_kick_tx_queue(rt2x00dev, control->queue); 2420 rt61pci_kick_tx_queue(rt2x00dev, control->queue);
2430 2421
2431 return 0; 2422 return 0;
@@ -2490,7 +2481,7 @@ static const struct data_queue_desc rt61pci_queue_tx = {
2490 2481
2491static const struct data_queue_desc rt61pci_queue_bcn = { 2482static const struct data_queue_desc rt61pci_queue_bcn = {
2492 .entry_num = 4 * BEACON_ENTRIES, 2483 .entry_num = 4 * BEACON_ENTRIES,
2493 .data_size = MGMT_FRAME_SIZE, 2484 .data_size = 0, /* No DMA required for beacons */
2494 .desc_size = TXINFO_SIZE, 2485 .desc_size = TXINFO_SIZE,
2495 .priv_size = sizeof(struct queue_entry_priv_pci_tx), 2486 .priv_size = sizeof(struct queue_entry_priv_pci_tx),
2496}; 2487};
diff --git a/drivers/net/wireless/rtl8180_grf5101.c b/drivers/net/wireless/rtl8180_grf5101.c
index 5d47935dbac3..947ee55f18b2 100644
--- a/drivers/net/wireless/rtl8180_grf5101.c
+++ b/drivers/net/wireless/rtl8180_grf5101.c
@@ -88,7 +88,7 @@ static void grf5101_rf_set_channel(struct ieee80211_hw *dev,
88 write_grf5101(dev, 0x0B, chan); 88 write_grf5101(dev, 0x0B, chan);
89 write_grf5101(dev, 0x07, 0x1000); 89 write_grf5101(dev, 0x07, 0x1000);
90 90
91 grf5101_write_phy_antenna(dev, chan); 91 grf5101_write_phy_antenna(dev, channel);
92} 92}
93 93
94static void grf5101_rf_stop(struct ieee80211_hw *dev) 94static void grf5101_rf_stop(struct ieee80211_hw *dev)
diff --git a/drivers/net/wireless/rtl8180_max2820.c b/drivers/net/wireless/rtl8180_max2820.c
index a34dfd382b6d..6c825fd7f3b6 100644
--- a/drivers/net/wireless/rtl8180_max2820.c
+++ b/drivers/net/wireless/rtl8180_max2820.c
@@ -78,7 +78,8 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev,
78 struct ieee80211_conf *conf) 78 struct ieee80211_conf *conf)
79{ 79{
80 struct rtl8180_priv *priv = dev->priv; 80 struct rtl8180_priv *priv = dev->priv;
81 int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 81 int channel = conf ?
82 ieee80211_frequency_to_channel(conf->channel->center_freq) : 1;
82 unsigned int chan_idx = channel - 1; 83 unsigned int chan_idx = channel - 1;
83 u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; 84 u32 txpw = priv->channels[chan_idx].hw_value & 0xFF;
84 u32 chan = max2820_chan[chan_idx]; 85 u32 chan = max2820_chan[chan_idx];
@@ -87,7 +88,7 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev,
87 * sa2400, for MAXIM we do this directly from BB */ 88 * sa2400, for MAXIM we do this directly from BB */
88 rtl8180_write_phy(dev, 3, txpw); 89 rtl8180_write_phy(dev, 3, txpw);
89 90
90 max2820_write_phy_antenna(dev, chan); 91 max2820_write_phy_antenna(dev, channel);
91 write_max2820(dev, 3, chan); 92 write_max2820(dev, 3, chan);
92} 93}
93 94
diff --git a/drivers/net/wireless/rtl8180_sa2400.c b/drivers/net/wireless/rtl8180_sa2400.c
index 0311b4ea124c..cea4e0ccb92d 100644
--- a/drivers/net/wireless/rtl8180_sa2400.c
+++ b/drivers/net/wireless/rtl8180_sa2400.c
@@ -86,7 +86,7 @@ static void sa2400_rf_set_channel(struct ieee80211_hw *dev,
86 86
87 write_sa2400(dev, 7, txpw); 87 write_sa2400(dev, 7, txpw);
88 88
89 sa2400_write_phy_antenna(dev, chan); 89 sa2400_write_phy_antenna(dev, channel);
90 90
91 write_sa2400(dev, 0, chan); 91 write_sa2400(dev, 0, chan);
92 write_sa2400(dev, 1, 0xbb50); 92 write_sa2400(dev, 1, 0xbb50);
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index d5787b37e1fb..9223ada5f00e 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -92,6 +92,7 @@ static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr,
92 u8 data[4]; 92 u8 data[4];
93 struct usb_ctrlrequest dr; 93 struct usb_ctrlrequest dr;
94 } *buf; 94 } *buf;
95 int rc;
95 96
96 buf = kmalloc(sizeof(*buf), GFP_ATOMIC); 97 buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
97 if (!buf) 98 if (!buf)
@@ -116,7 +117,11 @@ static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr,
116 usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0), 117 usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0),
117 (unsigned char *)dr, buf, len, 118 (unsigned char *)dr, buf, len,
118 rtl8187_iowrite_async_cb, buf); 119 rtl8187_iowrite_async_cb, buf);
119 usb_submit_urb(urb, GFP_ATOMIC); 120 rc = usb_submit_urb(urb, GFP_ATOMIC);
121 if (rc < 0) {
122 kfree(buf);
123 usb_free_urb(urb);
124 }
120} 125}
121 126
122static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv, 127static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv,
@@ -169,6 +174,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
169 struct urb *urb; 174 struct urb *urb;
170 __le16 rts_dur = 0; 175 __le16 rts_dur = 0;
171 u32 flags; 176 u32 flags;
177 int rc;
172 178
173 urb = usb_alloc_urb(0, GFP_ATOMIC); 179 urb = usb_alloc_urb(0, GFP_ATOMIC);
174 if (!urb) { 180 if (!urb) {
@@ -208,7 +214,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
208 info->dev = dev; 214 info->dev = dev;
209 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2), 215 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2),
210 hdr, skb->len, rtl8187_tx_cb, skb); 216 hdr, skb->len, rtl8187_tx_cb, skb);
211 usb_submit_urb(urb, GFP_ATOMIC); 217 rc = usb_submit_urb(urb, GFP_ATOMIC);
218 if (rc < 0) {
219 usb_free_urb(urb);
220 kfree_skb(skb);
221 }
212 222
213 return 0; 223 return 0;
214} 224}
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 5dd23c93497d..883af891ebfb 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2611,7 +2611,7 @@ static int strip_open(struct tty_struct *tty)
2611 * We need a write method. 2611 * We need a write method.
2612 */ 2612 */
2613 2613
2614 if (tty->ops->write == NULL) 2614 if (tty->ops->write == NULL || tty->ops->set_termios == NULL)
2615 return -EOPNOTSUPP; 2615 return -EOPNOTSUPP;
2616 2616
2617 /* 2617 /*
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index 03384a43186b..49ae97003952 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -908,9 +908,9 @@ static void wv_psa_show(psa_t * p)
908 p->psa_call_code[3], p->psa_call_code[4], p->psa_call_code[5], 908 p->psa_call_code[3], p->psa_call_code[4], p->psa_call_code[5],
909 p->psa_call_code[6], p->psa_call_code[7]); 909 p->psa_call_code[6], p->psa_call_code[7]);
910#ifdef DEBUG_SHOW_UNUSED 910#ifdef DEBUG_SHOW_UNUSED
911 printk(KERN_DEBUG "psa_reserved[]: %02X:%02X:%02X:%02X\n", 911 printk(KERN_DEBUG "psa_reserved[]: %02X:%02X\n",
912 p->psa_reserved[0], 912 p->psa_reserved[0],
913 p->psa_reserved[1], p->psa_reserved[2], p->psa_reserved[3]); 913 p->psa_reserved[1]);
914#endif /* DEBUG_SHOW_UNUSED */ 914#endif /* DEBUG_SHOW_UNUSED */
915 printk(KERN_DEBUG "psa_conf_status: %d, ", p->psa_conf_status); 915 printk(KERN_DEBUG "psa_conf_status: %d, ", p->psa_conf_status);
916 printk("psa_crc: 0x%02x%02x, ", p->psa_crc[0], p->psa_crc[1]); 916 printk("psa_crc: 0x%02x%02x, ", p->psa_crc[0], p->psa_crc[1]);
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index baf74015751c..b584c0ecc62d 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -1074,11 +1074,9 @@ wv_psa_show(psa_t * p)
1074 p->psa_call_code[6], 1074 p->psa_call_code[6],
1075 p->psa_call_code[7]); 1075 p->psa_call_code[7]);
1076#ifdef DEBUG_SHOW_UNUSED 1076#ifdef DEBUG_SHOW_UNUSED
1077 printk(KERN_DEBUG "psa_reserved[]: %02X:%02X:%02X:%02X\n", 1077 printk(KERN_DEBUG "psa_reserved[]: %02X:%02X\n",
1078 p->psa_reserved[0], 1078 p->psa_reserved[0],
1079 p->psa_reserved[1], 1079 p->psa_reserved[1]);
1080 p->psa_reserved[2],
1081 p->psa_reserved[3]);
1082#endif /* DEBUG_SHOW_UNUSED */ 1080#endif /* DEBUG_SHOW_UNUSED */
1083 printk(KERN_DEBUG "psa_conf_status: %d, ", p->psa_conf_status); 1081 printk(KERN_DEBUG "psa_conf_status: %d, ", p->psa_conf_status);
1084 printk("psa_crc: 0x%02x%02x, ", p->psa_crc[0], p->psa_crc[1]); 1082 printk("psa_crc: 0x%02x%02x, ", p->psa_crc[0], p->psa_crc[1]);
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 69c45ca99051..418606ac1c3b 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -719,7 +719,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)
719 fc = le16_to_cpu(*((__le16 *) buffer)); 719 fc = le16_to_cpu(*((__le16 *) buffer));
720 720
721 is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 721 is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
722 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA); 722 (fc & IEEE80211_STYPE_QOS_DATA);
723 is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 723 is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
724 (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); 724 (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
725 need_padding = is_qos ^ is_4addr; 725 need_padding = is_qos ^ is_4addr;
@@ -805,7 +805,7 @@ void zd_process_intr(struct work_struct *work)
805 u16 int_status; 805 u16 int_status;
806 struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); 806 struct zd_mac *mac = container_of(work, struct zd_mac, process_intr);
807 807
808 int_status = le16_to_cpu(*(u16 *)(mac->intr_buffer+4)); 808 int_status = le16_to_cpu(*(__le16 *)(mac->intr_buffer+4));
809 if (int_status & INT_CFG_NEXT_BCN) { 809 if (int_status & INT_CFG_NEXT_BCN) {
810 if (net_ratelimit()) 810 if (net_ratelimit())
811 dev_dbg_f(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n"); 811 dev_dbg_f(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n");
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 5316074f39f0..8941f5eb96c2 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -342,7 +342,7 @@ static inline void handle_regs_int(struct urb *urb)
342 ZD_ASSERT(in_interrupt()); 342 ZD_ASSERT(in_interrupt());
343 spin_lock(&intr->lock); 343 spin_lock(&intr->lock);
344 344
345 int_num = le16_to_cpu(*(u16 *)(urb->transfer_buffer+2)); 345 int_num = le16_to_cpu(*(__le16 *)(urb->transfer_buffer+2));
346 if (int_num == CR_INTERRUPT) { 346 if (int_num == CR_INTERRUPT) {
347 struct zd_mac *mac = zd_hw_mac(zd_usb_to_hw(urb->context)); 347 struct zd_mac *mac = zd_hw_mac(zd_usb_to_hw(urb->context));
348 memcpy(&mac->intr_buffer, urb->transfer_buffer, 348 memcpy(&mac->intr_buffer, urb->transfer_buffer,
@@ -889,9 +889,13 @@ static void tx_urb_complete(struct urb *urb)
889 } 889 }
890free_urb: 890free_urb:
891 skb = (struct sk_buff *)urb->context; 891 skb = (struct sk_buff *)urb->context;
892 zd_mac_tx_to_dev(skb, urb->status); 892 /*
893 * grab 'usb' pointer before handing off the skb (since
894 * it might be freed by zd_mac_tx_to_dev or mac80211)
895 */
893 cb = (struct zd_tx_skb_control_block *)skb->cb; 896 cb = (struct zd_tx_skb_control_block *)skb->cb;
894 usb = &zd_hw_mac(cb->hw)->chip.usb; 897 usb = &zd_hw_mac(cb->hw)->chip.usb;
898 zd_mac_tx_to_dev(skb, urb->status);
895 free_tx_urb(usb, urb); 899 free_tx_urb(usb, urb);
896 tx_dec_submitted_urbs(usb); 900 tx_dec_submitted_urbs(usb);
897 return; 901 return;
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 8bddff150c70..d26f69b0184f 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -946,8 +946,7 @@ err:
946 work_done++; 946 work_done++;
947 } 947 }
948 948
949 while ((skb = __skb_dequeue(&errq))) 949 __skb_queue_purge(&errq);
950 kfree_skb(skb);
951 950
952 work_done -= handle_incoming_queue(dev, &rxq); 951 work_done -= handle_incoming_queue(dev, &rxq);
953 952
@@ -1079,8 +1078,7 @@ static void xennet_release_rx_bufs(struct netfront_info *np)
1079 } 1078 }
1080 } 1079 }
1081 1080
1082 while ((skb = __skb_dequeue(&free_list)) != NULL) 1081 __skb_queue_purge(&free_list);
1083 dev_kfree_skb(skb);
1084 1082
1085 spin_unlock_bh(&np->rx_lock); 1083 spin_unlock_bh(&np->rx_lock);
1086} 1084}
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9bd7c4a31253..23ffb7c0caf2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -65,6 +65,9 @@ struct property *of_find_property(const struct device_node *np,
65{ 65{
66 struct property *pp; 66 struct property *pp;
67 67
68 if (!np)
69 return NULL;
70
68 read_lock(&devtree_lock); 71 read_lock(&devtree_lock);
69 for (pp = np->properties; pp != 0; pp = pp->next) { 72 for (pp = np->properties; pp != 0; pp = pp->next) {
70 if (of_prop_cmp(pp->name, name) == 0) { 73 if (of_prop_cmp(pp->name, name) == 0) {
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 715a44471617..b2ccdcbeb896 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -21,7 +21,6 @@ struct i2c_driver_device {
21}; 21};
22 22
23static struct i2c_driver_device i2c_devices[] = { 23static struct i2c_driver_device i2c_devices[] = {
24 { "dallas,ds1374", "rtc-ds1374" },
25}; 24};
26 25
27static int of_find_i2c_driver(struct device_node *node, 26static int of_find_i2c_driver(struct device_node *node,
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index efcbf4b4579f..2450b3a393ff 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -27,7 +27,7 @@
27#include "buffer_sync.h" 27#include "buffer_sync.h"
28#include "oprof.h" 28#include "oprof.h"
29 29
30DEFINE_PER_CPU_SHARED_ALIGNED(struct oprofile_cpu_buffer, cpu_buffer); 30DEFINE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer);
31 31
32static void wq_sync_buffer(struct work_struct *work); 32static void wq_sync_buffer(struct work_struct *work);
33 33
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index 13588174311d..c3e366b52261 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -46,7 +46,7 @@ struct oprofile_cpu_buffer {
46 unsigned long sample_invalid_eip; 46 unsigned long sample_invalid_eip;
47 int cpu; 47 int cpu;
48 struct delayed_work work; 48 struct delayed_work work;
49} ____cacheline_aligned; 49};
50 50
51DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); 51DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer);
52 52
diff --git a/drivers/parisc/asp.c b/drivers/parisc/asp.c
index 558420bc9f88..821369135369 100644
--- a/drivers/parisc/asp.c
+++ b/drivers/parisc/asp.c
@@ -88,7 +88,7 @@ asp_init_chip(struct parisc_device *dev)
88 ret = -EBUSY; 88 ret = -EBUSY;
89 dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ); 89 dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ);
90 if (dev->irq < 0) { 90 if (dev->irq < 0) {
91 printk(KERN_ERR "%s(): cannot get GSC irq\n", __FUNCTION__); 91 printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__);
92 goto out; 92 goto out;
93 } 93 }
94 94
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 07d2a8d4498f..b30e38f3a50d 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -359,7 +359,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
359 BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE); 359 BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE);
360 360
361 DBG_RES("%s() size: %d pages_needed %d\n", 361 DBG_RES("%s() size: %d pages_needed %d\n",
362 __FUNCTION__, size, pages_needed); 362 __func__, size, pages_needed);
363 363
364 /* 364 /*
365 ** "seek and ye shall find"...praying never hurts either... 365 ** "seek and ye shall find"...praying never hurts either...
@@ -395,16 +395,16 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
395#endif 395#endif
396 } else { 396 } else {
397 panic("%s: %s() Too many pages to map. pages_needed: %u\n", 397 panic("%s: %s() Too many pages to map. pages_needed: %u\n",
398 __FILE__, __FUNCTION__, pages_needed); 398 __FILE__, __func__, pages_needed);
399 } 399 }
400 400
401 panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__, 401 panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__,
402 __FUNCTION__); 402 __func__);
403 403
404resource_found: 404resource_found:
405 405
406 DBG_RES("%s() res_idx %d res_hint: %d\n", 406 DBG_RES("%s() res_idx %d res_hint: %d\n",
407 __FUNCTION__, res_idx, ioc->res_hint); 407 __func__, res_idx, ioc->res_hint);
408 408
409#ifdef CCIO_SEARCH_TIME 409#ifdef CCIO_SEARCH_TIME
410 { 410 {
@@ -450,7 +450,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
450 BUG_ON(pages_mapped > BITS_PER_LONG); 450 BUG_ON(pages_mapped > BITS_PER_LONG);
451 451
452 DBG_RES("%s(): res_idx: %d pages_mapped %d\n", 452 DBG_RES("%s(): res_idx: %d pages_mapped %d\n",
453 __FUNCTION__, res_idx, pages_mapped); 453 __func__, res_idx, pages_mapped);
454 454
455#ifdef CCIO_MAP_STATS 455#ifdef CCIO_MAP_STATS
456 ioc->used_pages -= pages_mapped; 456 ioc->used_pages -= pages_mapped;
@@ -474,7 +474,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
474#endif 474#endif
475 } else { 475 } else {
476 panic("%s:%s() Too many pages to unmap.\n", __FILE__, 476 panic("%s:%s() Too many pages to unmap.\n", __FILE__,
477 __FUNCTION__); 477 __func__);
478 } 478 }
479} 479}
480 480
@@ -775,7 +775,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
775 pdir_start = &(ioc->pdir_base[idx]); 775 pdir_start = &(ioc->pdir_base[idx]);
776 776
777 DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n", 777 DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n",
778 __FUNCTION__, addr, (long)iovp | offset, size); 778 __func__, addr, (long)iovp | offset, size);
779 779
780 /* If not cacheline aligned, force SAFE_DMA on the whole mess */ 780 /* If not cacheline aligned, force SAFE_DMA on the whole mess */
781 if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES)) 781 if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES))
@@ -820,7 +820,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
820 ioc = GET_IOC(dev); 820 ioc = GET_IOC(dev);
821 821
822 DBG_RUN("%s() iovp 0x%lx/%x\n", 822 DBG_RUN("%s() iovp 0x%lx/%x\n",
823 __FUNCTION__, (long)iova, size); 823 __func__, (long)iova, size);
824 824
825 iova ^= offset; /* clear offset bits */ 825 iova ^= offset; /* clear offset bits */
826 size += offset; 826 size += offset;
@@ -922,7 +922,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
922 BUG_ON(!dev); 922 BUG_ON(!dev);
923 ioc = GET_IOC(dev); 923 ioc = GET_IOC(dev);
924 924
925 DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents); 925 DBG_RUN_SG("%s() START %d entries\n", __func__, nents);
926 926
927 /* Fast path single entry scatterlists. */ 927 /* Fast path single entry scatterlists. */
928 if (nents == 1) { 928 if (nents == 1) {
@@ -966,7 +966,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
966 966
967 BUG_ON(coalesced != filled); 967 BUG_ON(coalesced != filled);
968 968
969 DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled); 969 DBG_RUN_SG("%s() DONE %d mappings\n", __func__, filled);
970 970
971 for (i = 0; i < filled; i++) 971 for (i = 0; i < filled; i++)
972 current_len += sg_dma_len(sglist + i); 972 current_len += sg_dma_len(sglist + i);
@@ -995,7 +995,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
995 ioc = GET_IOC(dev); 995 ioc = GET_IOC(dev);
996 996
997 DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", 997 DBG_RUN_SG("%s() START %d entries, %08lx,%x\n",
998 __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length); 998 __func__, nents, sg_virt_addr(sglist), sglist->length);
999 999
1000#ifdef CCIO_MAP_STATS 1000#ifdef CCIO_MAP_STATS
1001 ioc->usg_calls++; 1001 ioc->usg_calls++;
@@ -1011,7 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1011 ++sglist; 1011 ++sglist;
1012 } 1012 }
1013 1013
1014 DBG_RUN_SG("%s() DONE (nents %d)\n", __FUNCTION__, nents); 1014 DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
1015} 1015}
1016 1016
1017static struct hppa_dma_ops ccio_ops = { 1017static struct hppa_dma_ops ccio_ops = {
@@ -1225,7 +1225,7 @@ static int
1225ccio_get_iotlb_size(struct parisc_device *dev) 1225ccio_get_iotlb_size(struct parisc_device *dev)
1226{ 1226{
1227 if (dev->spa_shift == 0) { 1227 if (dev->spa_shift == 0) {
1228 panic("%s() : Can't determine I/O TLB size.\n", __FUNCTION__); 1228 panic("%s() : Can't determine I/O TLB size.\n", __func__);
1229 } 1229 }
1230 return (1 << dev->spa_shift); 1230 return (1 << dev->spa_shift);
1231} 1231}
@@ -1315,7 +1315,7 @@ ccio_ioc_init(struct ioc *ioc)
1315 BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT)); 1315 BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT));
1316 1316
1317 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", 1317 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n",
1318 __FUNCTION__, ioc->ioc_regs, 1318 __func__, ioc->ioc_regs,
1319 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1319 (unsigned long) num_physpages >> (20 - PAGE_SHIFT),
1320 iova_space_size>>20, 1320 iova_space_size>>20,
1321 iov_order + PAGE_SHIFT); 1321 iov_order + PAGE_SHIFT);
@@ -1323,7 +1323,7 @@ ccio_ioc_init(struct ioc *ioc)
1323 ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, 1323 ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
1324 get_order(ioc->pdir_size)); 1324 get_order(ioc->pdir_size));
1325 if(NULL == ioc->pdir_base) { 1325 if(NULL == ioc->pdir_base) {
1326 panic("%s() could not allocate I/O Page Table\n", __FUNCTION__); 1326 panic("%s() could not allocate I/O Page Table\n", __func__);
1327 } 1327 }
1328 memset(ioc->pdir_base, 0, ioc->pdir_size); 1328 memset(ioc->pdir_base, 0, ioc->pdir_size);
1329 1329
@@ -1332,12 +1332,12 @@ ccio_ioc_init(struct ioc *ioc)
1332 1332
1333 /* resource map size dictated by pdir_size */ 1333 /* resource map size dictated by pdir_size */
1334 ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3; 1334 ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
1335 DBG_INIT("%s() res_size 0x%x\n", __FUNCTION__, ioc->res_size); 1335 DBG_INIT("%s() res_size 0x%x\n", __func__, ioc->res_size);
1336 1336
1337 ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, 1337 ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
1338 get_order(ioc->res_size)); 1338 get_order(ioc->res_size));
1339 if(NULL == ioc->res_map) { 1339 if(NULL == ioc->res_map) {
1340 panic("%s() could not allocate resource map\n", __FUNCTION__); 1340 panic("%s() could not allocate resource map\n", __func__);
1341 } 1341 }
1342 memset(ioc->res_map, 0, ioc->res_size); 1342 memset(ioc->res_map, 0, ioc->res_size);
1343 1343
@@ -1409,7 +1409,7 @@ ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr)
1409 result = insert_resource(&iomem_resource, res); 1409 result = insert_resource(&iomem_resource, res);
1410 if (result < 0) { 1410 if (result < 0) {
1411 printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n", 1411 printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n",
1412 __FUNCTION__, res->start, res->end); 1412 __func__, res->start, res->end);
1413 } 1413 }
1414} 1414}
1415 1415
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index d9c6322a721b..fd56128525d1 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -180,7 +180,7 @@ static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where,
180 void __iomem *base_addr = d->hba.base_addr; 180 void __iomem *base_addr = d->hba.base_addr;
181 unsigned long flags; 181 unsigned long flags;
182 182
183 DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where, 183 DBG("%s: %p, %d, %d, %d\n", __func__, base_addr, devfn, where,
184 size); 184 size);
185 spin_lock_irqsave(&d->dinosaur_pen, flags); 185 spin_lock_irqsave(&d->dinosaur_pen, flags);
186 186
@@ -215,7 +215,7 @@ static int dino_cfg_write(struct pci_bus *bus, unsigned int devfn, int where,
215 void __iomem *base_addr = d->hba.base_addr; 215 void __iomem *base_addr = d->hba.base_addr;
216 unsigned long flags; 216 unsigned long flags;
217 217
218 DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where, 218 DBG("%s: %p, %d, %d, %d\n", __func__, base_addr, devfn, where,
219 size); 219 size);
220 spin_lock_irqsave(&d->dinosaur_pen, flags); 220 spin_lock_irqsave(&d->dinosaur_pen, flags);
221 221
@@ -301,7 +301,7 @@ static void dino_disable_irq(unsigned int irq)
301 struct dino_device *dino_dev = irq_desc[irq].chip_data; 301 struct dino_device *dino_dev = irq_desc[irq].chip_data;
302 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); 302 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
303 303
304 DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); 304 DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq);
305 305
306 /* Clear the matching bit in the IMR register */ 306 /* Clear the matching bit in the IMR register */
307 dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq)); 307 dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq));
@@ -314,7 +314,7 @@ static void dino_enable_irq(unsigned int irq)
314 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); 314 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
315 u32 tmp; 315 u32 tmp;
316 316
317 DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); 317 DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq);
318 318
319 /* 319 /*
320 ** clear pending IRQ bits 320 ** clear pending IRQ bits
@@ -340,7 +340,7 @@ static void dino_enable_irq(unsigned int irq)
340 tmp = __raw_readl(dino_dev->hba.base_addr+DINO_ILR); 340 tmp = __raw_readl(dino_dev->hba.base_addr+DINO_ILR);
341 if (tmp & DINO_MASK_IRQ(local_irq)) { 341 if (tmp & DINO_MASK_IRQ(local_irq)) {
342 DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n", 342 DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n",
343 __FUNCTION__, tmp); 343 __func__, tmp);
344 gsc_writel(dino_dev->txn_data, dino_dev->txn_addr); 344 gsc_writel(dino_dev->txn_data, dino_dev->txn_addr);
345 } 345 }
346} 346}
@@ -388,7 +388,7 @@ ilr_again:
388 int local_irq = __ffs(mask); 388 int local_irq = __ffs(mask);
389 int irq = dino_dev->global_irq[local_irq]; 389 int irq = dino_dev->global_irq[local_irq];
390 DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", 390 DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n",
391 __FUNCTION__, irq, intr_dev, mask); 391 __func__, irq, intr_dev, mask);
392 __do_IRQ(irq); 392 __do_IRQ(irq);
393 mask &= ~(1 << local_irq); 393 mask &= ~(1 << local_irq);
394 } while (mask); 394 } while (mask);
@@ -566,7 +566,7 @@ dino_fixup_bus(struct pci_bus *bus)
566 int port_base = HBA_PORT_BASE(dino_dev->hba.hba_num); 566 int port_base = HBA_PORT_BASE(dino_dev->hba.hba_num);
567 567
568 DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", 568 DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n",
569 __FUNCTION__, bus, bus->secondary, 569 __func__, bus, bus->secondary,
570 bus->bridge->platform_data); 570 bus->bridge->platform_data);
571 571
572 /* Firmware doesn't set up card-mode dino, so we have to */ 572 /* Firmware doesn't set up card-mode dino, so we have to */
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index 1b3e3fd12d95..f7d088b897ee 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -112,7 +112,7 @@ static void gsc_asic_disable_irq(unsigned int irq)
112 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); 112 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
113 u32 imr; 113 u32 imr;
114 114
115 DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __FUNCTION__, irq, 115 DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq,
116 irq_dev->name, imr); 116 irq_dev->name, imr);
117 117
118 /* Disable the IRQ line by clearing the bit in the IMR */ 118 /* Disable the IRQ line by clearing the bit in the IMR */
@@ -127,7 +127,7 @@ static void gsc_asic_enable_irq(unsigned int irq)
127 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); 127 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
128 u32 imr; 128 u32 imr;
129 129
130 DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __FUNCTION__, irq, 130 DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq,
131 irq_dev->name, imr); 131 irq_dev->name, imr);
132 132
133 /* Enable the IRQ line by setting the bit in the IMR */ 133 /* Enable the IRQ line by setting the bit in the IMR */
diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c
index cb3d28176129..bee510098ce8 100644
--- a/drivers/parisc/lasi.c
+++ b/drivers/parisc/lasi.c
@@ -193,7 +193,7 @@ lasi_init_chip(struct parisc_device *dev)
193 dev->irq = gsc_alloc_irq(&gsc_irq); 193 dev->irq = gsc_alloc_irq(&gsc_irq);
194 if (dev->irq < 0) { 194 if (dev->irq < 0) {
195 printk(KERN_ERR "%s(): cannot get GSC irq\n", 195 printk(KERN_ERR "%s(): cannot get GSC irq\n",
196 __FUNCTION__); 196 __func__);
197 kfree(lasi); 197 kfree(lasi);
198 return -EBUSY; 198 return -EBUSY;
199 } 199 }
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 66ce61048361..a28c8946deaa 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -377,12 +377,12 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int
377 /* original - Generate config cycle on broken elroy 377 /* original - Generate config cycle on broken elroy
378 with risk we will miss PCI bus errors. */ 378 with risk we will miss PCI bus errors. */
379 *data = lba_rd_cfg(d, tok, pos, size); 379 *data = lba_rd_cfg(d, tok, pos, size);
380 DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __FUNCTION__, tok, pos, *data); 380 DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __func__, tok, pos, *data);
381 return 0; 381 return 0;
382 } 382 }
383 383
384 if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { 384 if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) {
385 DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __FUNCTION__, tok, pos); 385 DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __func__, tok, pos);
386 /* either don't want to look or know device isn't present. */ 386 /* either don't want to look or know device isn't present. */
387 *data = ~0U; 387 *data = ~0U;
388 return(0); 388 return(0);
@@ -398,7 +398,7 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int
398 case 2: *data = READ_REG16(data_reg + (pos & 2)); break; 398 case 2: *data = READ_REG16(data_reg + (pos & 2)); break;
399 case 4: *data = READ_REG32(data_reg); break; 399 case 4: *data = READ_REG32(data_reg); break;
400 } 400 }
401 DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos, *data); 401 DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __func__, tok, pos, *data);
402 return 0; 402 return 0;
403} 403}
404 404
@@ -441,16 +441,16 @@ static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int
441 if (!LBA_SKIP_PROBE(d)) { 441 if (!LBA_SKIP_PROBE(d)) {
442 /* Original Workaround */ 442 /* Original Workaround */
443 lba_wr_cfg(d, tok, pos, (u32) data, size); 443 lba_wr_cfg(d, tok, pos, (u32) data, size);
444 DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __FUNCTION__, tok, pos,data); 444 DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __func__, tok, pos,data);
445 return 0; 445 return 0;
446 } 446 }
447 447
448 if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { 448 if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) {
449 DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __FUNCTION__, tok, pos,data); 449 DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __func__, tok, pos,data);
450 return 1; /* New Workaround */ 450 return 1; /* New Workaround */
451 } 451 }
452 452
453 DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __FUNCTION__, tok, pos, data); 453 DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __func__, tok, pos, data);
454 454
455 /* Basic Algorithm */ 455 /* Basic Algorithm */
456 LBA_CFG_ADDR_SETUP(d, tok | pos); 456 LBA_CFG_ADDR_SETUP(d, tok | pos);
@@ -521,7 +521,7 @@ static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, i
521 if ((pos > 255) || (devfn > 255)) 521 if ((pos > 255) || (devfn > 255))
522 return -EINVAL; 522 return -EINVAL;
523 523
524 DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __FUNCTION__, tok, pos, data); 524 DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __func__, tok, pos, data);
525 525
526 LBA_CFG_TR4_ADDR_SETUP(d, tok | pos); 526 LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
527 switch(size) { 527 switch(size) {
@@ -890,7 +890,7 @@ LBA_PORT_IN(32, 0)
890#define LBA_PORT_OUT(size, mask) \ 890#define LBA_PORT_OUT(size, mask) \
891static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \ 891static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \
892{ \ 892{ \
893 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, d, addr, val); \ 893 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __func__, d, addr, val); \
894 WRITE_REG##size(val, astro_iop_base + addr); \ 894 WRITE_REG##size(val, astro_iop_base + addr); \
895 if (LBA_DEV(d)->hw_rev < 3) \ 895 if (LBA_DEV(d)->hw_rev < 3) \
896 lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \ 896 lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \
@@ -932,7 +932,7 @@ static struct pci_port_ops lba_astro_port_ops = {
932static u##size lba_pat_in##size (struct pci_hba_data *l, u16 addr) \ 932static u##size lba_pat_in##size (struct pci_hba_data *l, u16 addr) \
933{ \ 933{ \
934 u##size t; \ 934 u##size t; \
935 DBG_PORT("%s(0x%p, 0x%x) ->", __FUNCTION__, l, addr); \ 935 DBG_PORT("%s(0x%p, 0x%x) ->", __func__, l, addr); \
936 t = READ_REG##size(PIOP_TO_GMMIO(LBA_DEV(l), addr)); \ 936 t = READ_REG##size(PIOP_TO_GMMIO(LBA_DEV(l), addr)); \
937 DBG_PORT(" 0x%x\n", t); \ 937 DBG_PORT(" 0x%x\n", t); \
938 return (t); \ 938 return (t); \
@@ -948,7 +948,7 @@ LBA_PORT_IN(32, 0)
948static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ 948static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \
949{ \ 949{ \
950 void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ 950 void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \
951 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ 951 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __func__, l, addr, val); \
952 WRITE_REG##size(val, where); \ 952 WRITE_REG##size(val, where); \
953 /* flush the I/O down to the elroy at least */ \ 953 /* flush the I/O down to the elroy at least */ \
954 lba_t32 = READ_U32(l->base_addr + LBA_FUNC_ID); \ 954 lba_t32 = READ_U32(l->base_addr + LBA_FUNC_ID); \
@@ -1584,7 +1584,7 @@ void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
1584 WARN_ON((ibase & 0x001fffff) != 0); 1584 WARN_ON((ibase & 0x001fffff) != 0);
1585 WARN_ON((imask & 0x001fffff) != 0); 1585 WARN_ON((imask & 0x001fffff) != 0);
1586 1586
1587 DBG("%s() ibase 0x%x imask 0x%x\n", __FUNCTION__, ibase, imask); 1587 DBG("%s() ibase 0x%x imask 0x%x\n", __func__, ibase, imask);
1588 WRITE_REG32( imask, base_addr + LBA_IMASK); 1588 WRITE_REG32( imask, base_addr + LBA_IMASK);
1589 WRITE_REG32( ibase, base_addr + LBA_IBASE); 1589 WRITE_REG32( ibase, base_addr + LBA_IBASE);
1590 iounmap(base_addr); 1590 iounmap(base_addr);
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 703b85edb004..f9b12664f9fb 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -569,7 +569,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
569 569
570 default: 570 default:
571 printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n", 571 printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n",
572 __FUNCTION__, lcd_info.model); 572 __func__, lcd_info.model);
573 return 1; 573 return 1;
574 } 574 }
575 575
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index afc849bd3f58..bc73b96346ff 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -384,7 +384,7 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev,
384 } 384 }
385 mask = RESMAP_MASK(bits_wanted) >> bitshiftcnt; 385 mask = RESMAP_MASK(bits_wanted) >> bitshiftcnt;
386 386
387 DBG_RES("%s() o %ld %p", __FUNCTION__, o, res_ptr); 387 DBG_RES("%s() o %ld %p", __func__, o, res_ptr);
388 while(res_ptr < res_end) 388 while(res_ptr < res_end)
389 { 389 {
390 DBG_RES(" %p %lx %lx\n", res_ptr, mask, *res_ptr); 390 DBG_RES(" %p %lx %lx\n", res_ptr, mask, *res_ptr);
@@ -454,7 +454,7 @@ sba_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
454#endif 454#endif
455 455
456 DBG_RES("%s(%x) %d -> %lx hint %x/%x\n", 456 DBG_RES("%s(%x) %d -> %lx hint %x/%x\n",
457 __FUNCTION__, size, pages_needed, pide, 457 __func__, size, pages_needed, pide,
458 (uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map), 458 (uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map),
459 ioc->res_bitshift ); 459 ioc->res_bitshift );
460 460
@@ -497,7 +497,7 @@ sba_free_range(struct ioc *ioc, dma_addr_t iova, size_t size)
497 unsigned long m = RESMAP_MASK(bits_not_wanted) >> (pide & (BITS_PER_LONG - 1)); 497 unsigned long m = RESMAP_MASK(bits_not_wanted) >> (pide & (BITS_PER_LONG - 1));
498 498
499 DBG_RES("%s( ,%x,%x) %x/%lx %x %p %lx\n", 499 DBG_RES("%s( ,%x,%x) %x/%lx %x %p %lx\n",
500 __FUNCTION__, (uint) iova, size, 500 __func__, (uint) iova, size,
501 bits_not_wanted, m, pide, res_ptr, *res_ptr); 501 bits_not_wanted, m, pide, res_ptr, *res_ptr);
502 502
503#ifdef SBA_COLLECT_STATS 503#ifdef SBA_COLLECT_STATS
@@ -740,7 +740,7 @@ sba_map_single(struct device *dev, void *addr, size_t size,
740 iovp = (dma_addr_t) pide << IOVP_SHIFT; 740 iovp = (dma_addr_t) pide << IOVP_SHIFT;
741 741
742 DBG_RUN("%s() 0x%p -> 0x%lx\n", 742 DBG_RUN("%s() 0x%p -> 0x%lx\n",
743 __FUNCTION__, addr, (long) iovp | offset); 743 __func__, addr, (long) iovp | offset);
744 744
745 pdir_start = &(ioc->pdir_base[pide]); 745 pdir_start = &(ioc->pdir_base[pide]);
746 746
@@ -798,7 +798,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
798 unsigned long flags; 798 unsigned long flags;
799 dma_addr_t offset; 799 dma_addr_t offset;
800 800
801 DBG_RUN("%s() iovp 0x%lx/%x\n", __FUNCTION__, (long) iova, size); 801 DBG_RUN("%s() iovp 0x%lx/%x\n", __func__, (long) iova, size);
802 802
803 ioc = GET_IOC(dev); 803 ioc = GET_IOC(dev);
804 offset = iova & ~IOVP_MASK; 804 offset = iova & ~IOVP_MASK;
@@ -937,7 +937,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
937 int coalesced, filled = 0; 937 int coalesced, filled = 0;
938 unsigned long flags; 938 unsigned long flags;
939 939
940 DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents); 940 DBG_RUN_SG("%s() START %d entries\n", __func__, nents);
941 941
942 ioc = GET_IOC(dev); 942 ioc = GET_IOC(dev);
943 943
@@ -998,7 +998,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
998 998
999 spin_unlock_irqrestore(&ioc->res_lock, flags); 999 spin_unlock_irqrestore(&ioc->res_lock, flags);
1000 1000
1001 DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled); 1001 DBG_RUN_SG("%s() DONE %d mappings\n", __func__, filled);
1002 1002
1003 return filled; 1003 return filled;
1004} 1004}
@@ -1023,7 +1023,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1023#endif 1023#endif
1024 1024
1025 DBG_RUN_SG("%s() START %d entries, %p,%x\n", 1025 DBG_RUN_SG("%s() START %d entries, %p,%x\n",
1026 __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length); 1026 __func__, nents, sg_virt_addr(sglist), sglist->length);
1027 1027
1028 ioc = GET_IOC(dev); 1028 ioc = GET_IOC(dev);
1029 1029
@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1047 ++sglist; 1047 ++sglist;
1048 } 1048 }
1049 1049
1050 DBG_RUN_SG("%s() DONE (nents %d)\n", __FUNCTION__, nents); 1050 DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
1051 1051
1052#ifdef ASSERT_PDIR_SANITY 1052#ifdef ASSERT_PDIR_SANITY
1053 spin_lock_irqsave(&ioc->res_lock, flags); 1053 spin_lock_irqsave(&ioc->res_lock, flags);
@@ -1118,7 +1118,7 @@ sba_alloc_pdir(unsigned int pdir_size)
1118 pdir_base = __get_free_pages(GFP_KERNEL, pdir_order); 1118 pdir_base = __get_free_pages(GFP_KERNEL, pdir_order);
1119 if (NULL == (void *) pdir_base) { 1119 if (NULL == (void *) pdir_base) {
1120 panic("%s() could not allocate I/O Page Table\n", 1120 panic("%s() could not allocate I/O Page Table\n",
1121 __FUNCTION__); 1121 __func__);
1122 } 1122 }
1123 1123
1124 /* If this is not PA8700 (PCX-W2) 1124 /* If this is not PA8700 (PCX-W2)
@@ -1261,7 +1261,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1261 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); 1261 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64);
1262 1262
1263 DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", 1263 DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n",
1264 __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20, 1264 __func__, ioc->ioc_hpa, iova_space_size >> 20,
1265 iov_order + PAGE_SHIFT); 1265 iov_order + PAGE_SHIFT);
1266 1266
1267 ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL, 1267 ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL,
@@ -1272,7 +1272,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1272 memset(ioc->pdir_base, 0, ioc->pdir_size); 1272 memset(ioc->pdir_base, 0, ioc->pdir_size);
1273 1273
1274 DBG_INIT("%s() pdir %p size %x\n", 1274 DBG_INIT("%s() pdir %p size %x\n",
1275 __FUNCTION__, ioc->pdir_base, ioc->pdir_size); 1275 __func__, ioc->pdir_base, ioc->pdir_size);
1276 1276
1277#ifdef SBA_HINT_SUPPORT 1277#ifdef SBA_HINT_SUPPORT
1278 ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; 1278 ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
@@ -1354,7 +1354,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1354 1354
1355 if (agp_found && sba_reserve_agpgart) { 1355 if (agp_found && sba_reserve_agpgart) {
1356 printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n", 1356 printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n",
1357 __FUNCTION__, (iova_space_size/2) >> 20); 1357 __func__, (iova_space_size/2) >> 20);
1358 ioc->pdir_size /= 2; 1358 ioc->pdir_size /= 2;
1359 ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE; 1359 ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE;
1360 } 1360 }
@@ -1406,7 +1406,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1406 ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64); 1406 ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64);
1407 1407
1408 DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", 1408 DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",
1409 __FUNCTION__, 1409 __func__,
1410 ioc->ioc_hpa, 1410 ioc->ioc_hpa,
1411 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1411 (unsigned long) num_physpages >> (20 - PAGE_SHIFT),
1412 iova_space_size>>20, 1412 iova_space_size>>20,
@@ -1415,7 +1415,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1415 ioc->pdir_base = sba_alloc_pdir(pdir_size); 1415 ioc->pdir_base = sba_alloc_pdir(pdir_size);
1416 1416
1417 DBG_INIT("%s() pdir %p size %x\n", 1417 DBG_INIT("%s() pdir %p size %x\n",
1418 __FUNCTION__, ioc->pdir_base, pdir_size); 1418 __func__, ioc->pdir_base, pdir_size);
1419 1419
1420#ifdef SBA_HINT_SUPPORT 1420#ifdef SBA_HINT_SUPPORT
1421 /* FIXME : DMA HINTs not used */ 1421 /* FIXME : DMA HINTs not used */
@@ -1443,7 +1443,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1443#endif 1443#endif
1444 1444
1445 DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n", 1445 DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n",
1446 __FUNCTION__, ioc->ibase, ioc->imask); 1446 __func__, ioc->ibase, ioc->imask);
1447 1447
1448 /* 1448 /*
1449 ** FIXME: Hint registers are programmed with default hint 1449 ** FIXME: Hint registers are programmed with default hint
@@ -1470,7 +1470,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1470 1470
1471 ioc->ibase = 0; /* used by SBA_IOVA and related macros */ 1471 ioc->ibase = 0; /* used by SBA_IOVA and related macros */
1472 1472
1473 DBG_INIT("%s() DONE\n", __FUNCTION__); 1473 DBG_INIT("%s() DONE\n", __func__);
1474} 1474}
1475 1475
1476 1476
@@ -1544,7 +1544,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa,
1544 if (!IS_PLUTO(sba_dev->dev)) { 1544 if (!IS_PLUTO(sba_dev->dev)) {
1545 ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); 1545 ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL);
1546 DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", 1546 DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->",
1547 __FUNCTION__, sba_dev->sba_hpa, ioc_ctl); 1547 __func__, sba_dev->sba_hpa, ioc_ctl);
1548 ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE); 1548 ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE);
1549 ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC; 1549 ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC;
1550 /* j6700 v1.6 firmware sets 0x294f */ 1550 /* j6700 v1.6 firmware sets 0x294f */
@@ -1675,7 +1675,7 @@ sba_common_init(struct sba_device *sba_dev)
1675 1675
1676 res_size >>= 3; /* convert bit count to byte count */ 1676 res_size >>= 3; /* convert bit count to byte count */
1677 DBG_INIT("%s() res_size 0x%x\n", 1677 DBG_INIT("%s() res_size 0x%x\n",
1678 __FUNCTION__, res_size); 1678 __func__, res_size);
1679 1679
1680 sba_dev->ioc[i].res_size = res_size; 1680 sba_dev->ioc[i].res_size = res_size;
1681 sba_dev->ioc[i].res_map = (char *) __get_free_pages(GFP_KERNEL, get_order(res_size)); 1681 sba_dev->ioc[i].res_map = (char *) __get_free_pages(GFP_KERNEL, get_order(res_size));
@@ -1688,7 +1688,7 @@ sba_common_init(struct sba_device *sba_dev)
1688 if (NULL == sba_dev->ioc[i].res_map) 1688 if (NULL == sba_dev->ioc[i].res_map)
1689 { 1689 {
1690 panic("%s:%s() could not allocate resource map\n", 1690 panic("%s:%s() could not allocate resource map\n",
1691 __FILE__, __FUNCTION__ ); 1691 __FILE__, __func__ );
1692 } 1692 }
1693 1693
1694 memset(sba_dev->ioc[i].res_map, 0, res_size); 1694 memset(sba_dev->ioc[i].res_map, 0, res_size);
@@ -1725,7 +1725,7 @@ sba_common_init(struct sba_device *sba_dev)
1725#endif 1725#endif
1726 1726
1727 DBG_INIT("%s() %d res_map %x %p\n", 1727 DBG_INIT("%s() %d res_map %x %p\n",
1728 __FUNCTION__, i, res_size, sba_dev->ioc[i].res_map); 1728 __func__, i, res_size, sba_dev->ioc[i].res_map);
1729 } 1729 }
1730 1730
1731 spin_lock_init(&sba_dev->sba_lock); 1731 spin_lock_init(&sba_dev->sba_lock);
diff --git a/drivers/parisc/wax.c b/drivers/parisc/wax.c
index 813c2c24ab1e..892a83bbe73d 100644
--- a/drivers/parisc/wax.c
+++ b/drivers/parisc/wax.c
@@ -93,7 +93,7 @@ wax_init_chip(struct parisc_device *dev)
93 dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ); 93 dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ);
94 if (dev->irq < 0) { 94 if (dev->irq < 0) {
95 printk(KERN_ERR "%s(): cannot get GSC irq\n", 95 printk(KERN_ERR "%s(): cannot get GSC irq\n",
96 __FUNCTION__); 96 __func__);
97 kfree(wax); 97 kfree(wax);
98 return -EBUSY; 98 return -EBUSY;
99 } 99 }
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index 925ba16355ce..a11021e8ce37 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -619,6 +619,7 @@ static struct hotplug_slot *get_slot_from_name (const char *name)
619int pci_hp_register (struct hotplug_slot *slot) 619int pci_hp_register (struct hotplug_slot *slot)
620{ 620{
621 int result; 621 int result;
622 struct hotplug_slot *tmp;
622 623
623 if (slot == NULL) 624 if (slot == NULL)
624 return -ENODEV; 625 return -ENODEV;
@@ -630,7 +631,11 @@ int pci_hp_register (struct hotplug_slot *slot)
630 return -EINVAL; 631 return -EINVAL;
631 } 632 }
632 633
633 /* this can fail if we have already registered a slot with the same name */ 634 /* Check if we have already registered a slot with the same name. */
635 tmp = get_slot_from_name(slot->name);
636 if (tmp)
637 return -EEXIST;
638
634 slot->kobj.kset = pci_hotplug_slots_kset; 639 slot->kobj.kset = pci_hotplug_slots_kset;
635 result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, 640 result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL,
636 "%s", slot->name); 641 "%s", slot->name);
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 8264a7680435..79c9ddaad3fb 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -97,6 +97,7 @@ struct controller {
97 u8 cap_base; 97 u8 cap_base;
98 struct timer_list poll_timer; 98 struct timer_list poll_timer;
99 volatile int cmd_busy; 99 volatile int cmd_busy;
100 unsigned int no_cmd_complete:1;
100}; 101};
101 102
102#define INT_BUTTON_IGNORE 0 103#define INT_BUTTON_IGNORE 0
@@ -135,6 +136,7 @@ struct controller {
135#define PWR_LED_PRSN 0x00000010 136#define PWR_LED_PRSN 0x00000010
136#define HP_SUPR_RM_SUP 0x00000020 137#define HP_SUPR_RM_SUP 0x00000020
137#define EMI_PRSN 0x00020000 138#define EMI_PRSN 0x00020000
139#define NO_CMD_CMPL_SUP 0x00040000
138 140
139#define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) 141#define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN)
140#define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) 142#define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN)
@@ -143,13 +145,14 @@ struct controller {
143#define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) 145#define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN)
144#define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) 146#define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP)
145#define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) 147#define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN)
148#define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & NO_CMD_CMPL_SUP)
146 149
147extern int pciehp_sysfs_enable_slot(struct slot *slot); 150extern int pciehp_sysfs_enable_slot(struct slot *slot);
148extern int pciehp_sysfs_disable_slot(struct slot *slot); 151extern int pciehp_sysfs_disable_slot(struct slot *slot);
149extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); 152extern u8 pciehp_handle_attention_button(struct slot *p_slot);
150extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); 153 extern u8 pciehp_handle_switch_change(struct slot *p_slot);
151extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); 154extern u8 pciehp_handle_presence_change(struct slot *p_slot);
152extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); 155extern u8 pciehp_handle_power_fault(struct slot *p_slot);
153extern int pciehp_configure_device(struct slot *p_slot); 156extern int pciehp_configure_device(struct slot *p_slot);
154extern int pciehp_unconfigure_device(struct slot *p_slot); 157extern int pciehp_unconfigure_device(struct slot *p_slot);
155extern void pciehp_queue_pushbutton_work(struct work_struct *work); 158extern void pciehp_queue_pushbutton_work(struct work_struct *work);
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 43d8ddb2d679..48a2ed378914 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -254,7 +254,11 @@ static int init_slots(struct controller *ctrl)
254 slot->hp_slot, slot->number, ctrl->slot_device_offset); 254 slot->hp_slot, slot->number, ctrl->slot_device_offset);
255 retval = pci_hp_register(hotplug_slot); 255 retval = pci_hp_register(hotplug_slot);
256 if (retval) { 256 if (retval) {
257 err ("pci_hp_register failed with error %d\n", retval); 257 err("pci_hp_register failed with error %d\n", retval);
258 if (retval == -EEXIST)
259 err("Failed to register slot because of name "
260 "collision. Try \'pciehp_slot_with_bus\' "
261 "module option.\n");
258 goto error_info; 262 goto error_info;
259 } 263 }
260 /* create additional sysfs entries */ 264 /* create additional sysfs entries */
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 0a7aa628e955..96a5d55a4983 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -55,16 +55,13 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
55 return 0; 55 return 0;
56} 56}
57 57
58u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) 58u8 pciehp_handle_attention_button(struct slot *p_slot)
59{ 59{
60 struct slot *p_slot;
61 u32 event_type; 60 u32 event_type;
62 61
63 /* Attention Button Change */ 62 /* Attention Button Change */
64 dbg("pciehp: Attention button interrupt received.\n"); 63 dbg("pciehp: Attention button interrupt received.\n");
65 64
66 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
67
68 /* 65 /*
69 * Button pressed - See if need to TAKE ACTION!!! 66 * Button pressed - See if need to TAKE ACTION!!!
70 */ 67 */
@@ -76,18 +73,15 @@ u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
76 return 0; 73 return 0;
77} 74}
78 75
79u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) 76u8 pciehp_handle_switch_change(struct slot *p_slot)
80{ 77{
81 struct slot *p_slot;
82 u8 getstatus; 78 u8 getstatus;
83 u32 event_type; 79 u32 event_type;
84 80
85 /* Switch Change */ 81 /* Switch Change */
86 dbg("pciehp: Switch interrupt received.\n"); 82 dbg("pciehp: Switch interrupt received.\n");
87 83
88 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
89 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 84 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
90
91 if (getstatus) { 85 if (getstatus) {
92 /* 86 /*
93 * Switch opened 87 * Switch opened
@@ -107,17 +101,14 @@ u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
107 return 1; 101 return 1;
108} 102}
109 103
110u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) 104u8 pciehp_handle_presence_change(struct slot *p_slot)
111{ 105{
112 struct slot *p_slot;
113 u32 event_type; 106 u32 event_type;
114 u8 presence_save; 107 u8 presence_save;
115 108
116 /* Presence Change */ 109 /* Presence Change */
117 dbg("pciehp: Presence/Notify input change.\n"); 110 dbg("pciehp: Presence/Notify input change.\n");
118 111
119 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
120
121 /* Switch is open, assume a presence change 112 /* Switch is open, assume a presence change
122 * Save the presence state 113 * Save the presence state
123 */ 114 */
@@ -141,16 +132,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
141 return 1; 132 return 1;
142} 133}
143 134
144u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) 135u8 pciehp_handle_power_fault(struct slot *p_slot)
145{ 136{
146 struct slot *p_slot;
147 u32 event_type; 137 u32 event_type;
148 138
149 /* power fault */ 139 /* power fault */
150 dbg("pciehp: Power fault interrupt received.\n"); 140 dbg("pciehp: Power fault interrupt received.\n");
151 141
152 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
153
154 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 142 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) {
155 /* 143 /*
156 * power fault Cleared 144 * power fault Cleared
@@ -163,7 +151,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
163 */ 151 */
164 info("Power fault on Slot(%s)\n", p_slot->name); 152 info("Power fault on Slot(%s)\n", p_slot->name);
165 event_type = INT_POWER_FAULT; 153 event_type = INT_POWER_FAULT;
166 info("power fault bit %x set\n", hp_slot); 154 info("power fault bit %x set\n", 0);
167 } 155 }
168 156
169 queue_interrupt_event(p_slot, event_type); 157 queue_interrupt_event(p_slot, event_type);
@@ -186,6 +174,13 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
186 } 174 }
187 } 175 }
188 176
177 /*
178 * After turning power off, we must wait for at least 1 second
179 * before taking any action that relies on power having been
180 * removed from the slot/adapter.
181 */
182 msleep(1000);
183
189 if (PWR_LED(ctrl)) 184 if (PWR_LED(ctrl))
190 pslot->hpc_ops->green_led_off(pslot); 185 pslot->hpc_ops->green_led_off(pslot);
191 186
@@ -289,6 +284,13 @@ static int remove_board(struct slot *p_slot)
289 } 284 }
290 } 285 }
291 286
287 /*
288 * After turning power off, we must wait for at least 1 second
289 * before taking any action that relies on power having been
290 * removed from the slot/adapter.
291 */
292 msleep(1000);
293
292 if (PWR_LED(ctrl)) 294 if (PWR_LED(ctrl))
293 /* turn off Green LED */ 295 /* turn off Green LED */
294 p_slot->hpc_ops->green_led_off(p_slot); 296 p_slot->hpc_ops->green_led_off(p_slot);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 891f81a0400c..79f104963166 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -247,14 +247,38 @@ static inline void pciehp_free_irq(struct controller *ctrl)
247 free_irq(ctrl->pci_dev->irq, ctrl); 247 free_irq(ctrl->pci_dev->irq, ctrl);
248} 248}
249 249
250static inline int pcie_wait_cmd(struct controller *ctrl) 250static inline int pcie_poll_cmd(struct controller *ctrl)
251{
252 u16 slot_status;
253 int timeout = 1000;
254
255 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status))
256 if (slot_status & CMD_COMPLETED)
257 goto completed;
258 for (timeout = 1000; timeout > 0; timeout -= 100) {
259 msleep(100);
260 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status))
261 if (slot_status & CMD_COMPLETED)
262 goto completed;
263 }
264 return 0; /* timeout */
265
266completed:
267 pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
268 return timeout;
269}
270
271static inline int pcie_wait_cmd(struct controller *ctrl, int poll)
251{ 272{
252 int retval = 0; 273 int retval = 0;
253 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; 274 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000;
254 unsigned long timeout = msecs_to_jiffies(msecs); 275 unsigned long timeout = msecs_to_jiffies(msecs);
255 int rc; 276 int rc;
256 277
257 rc = wait_event_interruptible_timeout(ctrl->queue, 278 if (poll)
279 rc = pcie_poll_cmd(ctrl);
280 else
281 rc = wait_event_interruptible_timeout(ctrl->queue,
258 !ctrl->cmd_busy, timeout); 282 !ctrl->cmd_busy, timeout);
259 if (!rc) 283 if (!rc)
260 dbg("Command not completed in 1000 msec\n"); 284 dbg("Command not completed in 1000 msec\n");
@@ -286,12 +310,28 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
286 goto out; 310 goto out;
287 } 311 }
288 312
289 if ((slot_status & CMD_COMPLETED) == CMD_COMPLETED ) { 313 if (slot_status & CMD_COMPLETED) {
290 /* After 1 sec and CMD_COMPLETED still not set, just 314 if (!ctrl->no_cmd_complete) {
291 proceed forward to issue the next command according 315 /*
292 to spec. Just print out the error message */ 316 * After 1 sec and CMD_COMPLETED still not set, just
293 dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", 317 * proceed forward to issue the next command according
294 __func__); 318 * to spec. Just print out the error message.
319 */
320 dbg("%s: CMD_COMPLETED not clear after 1 sec.\n",
321 __func__);
322 } else if (!NO_CMD_CMPL(ctrl)) {
323 /*
324 * This controller semms to notify of command completed
325 * event even though it supports none of power
326 * controller, attention led, power led and EMI.
327 */
328 dbg("%s: Unexpected CMD_COMPLETED. Need to wait for "
329 "command completed event.\n", __func__);
330 ctrl->no_cmd_complete = 0;
331 } else {
332 dbg("%s: Unexpected CMD_COMPLETED. Maybe the "
333 "controller is broken.\n", __func__);
334 }
295 } 335 }
296 336
297 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 337 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl);
@@ -315,8 +355,18 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
315 /* 355 /*
316 * Wait for command completion. 356 * Wait for command completion.
317 */ 357 */
318 if (!retval) 358 if (!retval && !ctrl->no_cmd_complete) {
319 retval = pcie_wait_cmd(ctrl); 359 int poll = 0;
360 /*
361 * if hotplug interrupt is not enabled or command
362 * completed interrupt is not enabled, we need to poll
363 * command completed event.
364 */
365 if (!(slot_ctrl & HP_INTR_ENABLE) ||
366 !(slot_ctrl & CMD_CMPL_INTR_ENABLE))
367 poll = 1;
368 retval = pcie_wait_cmd(ctrl, poll);
369 }
320 out: 370 out:
321 mutex_unlock(&ctrl->ctrl_lock); 371 mutex_unlock(&ctrl->ctrl_lock);
322 return retval; 372 return retval;
@@ -704,13 +754,6 @@ static int hpc_power_off_slot(struct slot * slot)
704 } 754 }
705 dbg("%s: SLOTCTRL %x write cmd %x\n", 755 dbg("%s: SLOTCTRL %x write cmd %x\n",
706 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); 756 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
707
708 /*
709 * After turning power off, we must wait for at least 1 second
710 * before taking any action that relies on power having been
711 * removed from the slot/adapter.
712 */
713 msleep(1000);
714 out: 757 out:
715 if (changed) 758 if (changed)
716 pcie_unmask_bad_dllp(ctrl); 759 pcie_unmask_bad_dllp(ctrl);
@@ -722,6 +765,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
722{ 765{
723 struct controller *ctrl = (struct controller *)dev_id; 766 struct controller *ctrl = (struct controller *)dev_id;
724 u16 detected, intr_loc; 767 u16 detected, intr_loc;
768 struct slot *p_slot;
725 769
726 /* 770 /*
727 * In order to guarantee that all interrupt events are 771 * In order to guarantee that all interrupt events are
@@ -756,21 +800,38 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
756 wake_up_interruptible(&ctrl->queue); 800 wake_up_interruptible(&ctrl->queue);
757 } 801 }
758 802
803 if (!(intr_loc & ~CMD_COMPLETED))
804 return IRQ_HANDLED;
805
806 /*
807 * Return without handling events if this handler routine is
808 * called before controller initialization is done. This may
809 * happen if hotplug event or another interrupt that shares
810 * the IRQ with pciehp arrives before slot initialization is
811 * done after interrupt handler is registered.
812 *
813 * FIXME - Need more structural fixes. We need to be ready to
814 * handle the event before installing interrupt handler.
815 */
816 p_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
817 if (!p_slot || !p_slot->hpc_ops)
818 return IRQ_HANDLED;
819
759 /* Check MRL Sensor Changed */ 820 /* Check MRL Sensor Changed */
760 if (intr_loc & MRL_SENS_CHANGED) 821 if (intr_loc & MRL_SENS_CHANGED)
761 pciehp_handle_switch_change(0, ctrl); 822 pciehp_handle_switch_change(p_slot);
762 823
763 /* Check Attention Button Pressed */ 824 /* Check Attention Button Pressed */
764 if (intr_loc & ATTN_BUTTN_PRESSED) 825 if (intr_loc & ATTN_BUTTN_PRESSED)
765 pciehp_handle_attention_button(0, ctrl); 826 pciehp_handle_attention_button(p_slot);
766 827
767 /* Check Presence Detect Changed */ 828 /* Check Presence Detect Changed */
768 if (intr_loc & PRSN_DETECT_CHANGED) 829 if (intr_loc & PRSN_DETECT_CHANGED)
769 pciehp_handle_presence_change(0, ctrl); 830 pciehp_handle_presence_change(p_slot);
770 831
771 /* Check Power Fault Detected */ 832 /* Check Power Fault Detected */
772 if (intr_loc & PWR_FAULT_DETECTED) 833 if (intr_loc & PWR_FAULT_DETECTED)
773 pciehp_handle_power_fault(0, ctrl); 834 pciehp_handle_power_fault(p_slot);
774 835
775 return IRQ_HANDLED; 836 return IRQ_HANDLED;
776} 837}
@@ -1028,6 +1089,12 @@ static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
1028static int pcie_init_hardware_part1(struct controller *ctrl, 1089static int pcie_init_hardware_part1(struct controller *ctrl,
1029 struct pcie_device *dev) 1090 struct pcie_device *dev)
1030{ 1091{
1092 /* Clear all remaining event bits in Slot Status register */
1093 if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) {
1094 err("%s: Cannot write to SLOTSTATUS register\n", __func__);
1095 return -1;
1096 }
1097
1031 /* Mask Hot-plug Interrupt Enable */ 1098 /* Mask Hot-plug Interrupt Enable */
1032 if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { 1099 if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) {
1033 err("%s: Cannot mask hotplug interrupt enable\n", __func__); 1100 err("%s: Cannot mask hotplug interrupt enable\n", __func__);
@@ -1040,16 +1107,6 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev)
1040{ 1107{
1041 u16 cmd, mask; 1108 u16 cmd, mask;
1042 1109
1043 /*
1044 * We need to clear all events before enabling hotplug interrupt
1045 * notification mechanism in order for hotplug controler to
1046 * generate interrupts.
1047 */
1048 if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) {
1049 err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__);
1050 return -1;
1051 }
1052
1053 cmd = PRSN_DETECT_ENABLE; 1110 cmd = PRSN_DETECT_ENABLE;
1054 if (ATTN_BUTTN(ctrl)) 1111 if (ATTN_BUTTN(ctrl))
1055 cmd |= ATTN_BUTTN_ENABLE; 1112 cmd |= ATTN_BUTTN_ENABLE;
@@ -1116,6 +1173,7 @@ static inline void dbg_ctrl(struct controller *ctrl)
1116 dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); 1173 dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no");
1117 dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); 1174 dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no");
1118 dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); 1175 dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no");
1176 dbg(" Comamnd Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes");
1119 pciehp_readw(ctrl, SLOTSTATUS, &reg16); 1177 pciehp_readw(ctrl, SLOTSTATUS, &reg16);
1120 dbg("Slot Status : 0x%04x\n", reg16); 1178 dbg("Slot Status : 0x%04x\n", reg16);
1121 pciehp_readw(ctrl, SLOTSTATUS, &reg16); 1179 pciehp_readw(ctrl, SLOTSTATUS, &reg16);
@@ -1147,6 +1205,15 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev)
1147 mutex_init(&ctrl->ctrl_lock); 1205 mutex_init(&ctrl->ctrl_lock);
1148 init_waitqueue_head(&ctrl->queue); 1206 init_waitqueue_head(&ctrl->queue);
1149 dbg_ctrl(ctrl); 1207 dbg_ctrl(ctrl);
1208 /*
1209 * Controller doesn't notify of command completion if the "No
1210 * Command Completed Support" bit is set in Slot Capability
1211 * register or the controller supports none of power
1212 * controller, attention led, power led and EMI.
1213 */
1214 if (NO_CMD_CMPL(ctrl) ||
1215 !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl)))
1216 ctrl->no_cmd_complete = 1;
1150 1217
1151 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", 1218 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n",
1152 pdev->vendor, pdev->device, 1219 pdev->vendor, pdev->device,
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c
index e32148a8fa12..779c5db71be4 100644
--- a/drivers/pci/hotplug/rpadlpar_sysfs.c
+++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
@@ -18,8 +18,12 @@
18#include "rpadlpar.h" 18#include "rpadlpar.h"
19 19
20#define DLPAR_KOBJ_NAME "control" 20#define DLPAR_KOBJ_NAME "control"
21#define ADD_SLOT_ATTR_NAME "add_slot" 21
22#define REMOVE_SLOT_ATTR_NAME "remove_slot" 22/* Those two have no quotes because they are passed to __ATTR() which
23 * stringifies the argument (yuck !)
24 */
25#define ADD_SLOT_ATTR_NAME add_slot
26#define REMOVE_SLOT_ATTR_NAME remove_slot
23 27
24#define MAX_DRC_NAME_LEN 64 28#define MAX_DRC_NAME_LEN 64
25 29
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 1648076600fc..97848654652a 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -162,6 +162,10 @@ static int init_slots(struct controller *ctrl)
162 retval = pci_hp_register(slot->hotplug_slot); 162 retval = pci_hp_register(slot->hotplug_slot);
163 if (retval) { 163 if (retval) {
164 err("pci_hp_register failed with error %d\n", retval); 164 err("pci_hp_register failed with error %d\n", retval);
165 if (retval == -EEXIST)
166 err("Failed to register slot because of name "
167 "collision. Try \'shpchp_slot_with_bus\' "
168 "module option.\n");
165 goto error_info; 169 goto error_info;
166 } 170 }
167 171
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 1fd8bb765702..66c0fd21894b 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -49,7 +49,7 @@
49 49
50#define DEFAULT_DOMAIN_ADDRESS_WIDTH 48 50#define DEFAULT_DOMAIN_ADDRESS_WIDTH 48
51 51
52#define DMAR_OPERATION_TIMEOUT (HZ*60) /* 1m */ 52#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */
53 53
54#define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1) 54#define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1)
55 55
@@ -490,12 +490,12 @@ static int iommu_alloc_root_entry(struct intel_iommu *iommu)
490 490
491#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ 491#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \
492{\ 492{\
493 unsigned long start_time = jiffies;\ 493 cycles_t start_time = get_cycles();\
494 while (1) {\ 494 while (1) {\
495 sts = op (iommu->reg + offset);\ 495 sts = op (iommu->reg + offset);\
496 if (cond)\ 496 if (cond)\
497 break;\ 497 break;\
498 if (time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT))\ 498 if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\
499 panic("DMAR hardware is malfunctioning\n");\ 499 panic("DMAR hardware is malfunctioning\n");\
500 cpu_relax();\ 500 cpu_relax();\
501 }\ 501 }\
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 72f7476930c8..9d6fc8e6285d 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -19,8 +19,31 @@
19#include <linux/pci-acpi.h> 19#include <linux/pci-acpi.h>
20#include "pci.h" 20#include "pci.h"
21 21
22static u32 ctrlset_buf[3] = {0, 0, 0}; 22struct acpi_osc_data {
23static u32 global_ctrlsets = 0; 23 acpi_handle handle;
24 u32 ctrlset_buf[3];
25 u32 global_ctrlsets;
26 struct list_head sibiling;
27};
28static LIST_HEAD(acpi_osc_data_list);
29
30static struct acpi_osc_data *acpi_get_osc_data(acpi_handle handle)
31{
32 struct acpi_osc_data *data;
33
34 list_for_each_entry(data, &acpi_osc_data_list, sibiling) {
35 if (data->handle == handle)
36 return data;
37 }
38 data = kzalloc(sizeof(*data), GFP_KERNEL);
39 if (!data)
40 return NULL;
41 INIT_LIST_HEAD(&data->sibiling);
42 data->handle = handle;
43 list_add_tail(&data->sibiling, &acpi_osc_data_list);
44 return data;
45}
46
24static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; 47static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66};
25 48
26static acpi_status 49static acpi_status
@@ -37,8 +60,27 @@ acpi_query_osc (
37 union acpi_object *out_obj; 60 union acpi_object *out_obj;
38 u32 osc_dw0; 61 u32 osc_dw0;
39 acpi_status *ret_status = (acpi_status *)retval; 62 acpi_status *ret_status = (acpi_status *)retval;
63 struct acpi_osc_data *osc_data;
64 u32 flags = (unsigned long)context, temp;
65 acpi_handle tmp;
66
67 status = acpi_get_handle(handle, "_OSC", &tmp);
68 if (ACPI_FAILURE(status))
69 return status;
70
71 osc_data = acpi_get_osc_data(handle);
72 if (!osc_data) {
73 printk(KERN_ERR "acpi osc data array is full\n");
74 return AE_ERROR;
75 }
76
77 osc_data->ctrlset_buf[OSC_SUPPORT_TYPE] |= (flags & OSC_SUPPORT_MASKS);
78
79 /* do _OSC query for all possible controls */
80 temp = osc_data->ctrlset_buf[OSC_CONTROL_TYPE];
81 osc_data->ctrlset_buf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
82 osc_data->ctrlset_buf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS;
40 83
41
42 /* Setting up input parameters */ 84 /* Setting up input parameters */
43 input.count = 4; 85 input.count = 4;
44 input.pointer = in_params; 86 input.pointer = in_params;
@@ -51,13 +93,11 @@ acpi_query_osc (
51 in_params[2].integer.value = 3; 93 in_params[2].integer.value = 3;
52 in_params[3].type = ACPI_TYPE_BUFFER; 94 in_params[3].type = ACPI_TYPE_BUFFER;
53 in_params[3].buffer.length = 12; 95 in_params[3].buffer.length = 12;
54 in_params[3].buffer.pointer = (u8 *)context; 96 in_params[3].buffer.pointer = (u8 *)osc_data->ctrlset_buf;
55 97
56 status = acpi_evaluate_object(handle, "_OSC", &input, &output); 98 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
57 if (ACPI_FAILURE (status)) { 99 if (ACPI_FAILURE(status))
58 *ret_status = status; 100 goto out_nofree;
59 return status;
60 }
61 out_obj = output.pointer; 101 out_obj = output.pointer;
62 102
63 if (out_obj->type != ACPI_TYPE_BUFFER) { 103 if (out_obj->type != ACPI_TYPE_BUFFER) {
@@ -76,7 +116,8 @@ acpi_query_osc (
76 printk(KERN_DEBUG "_OSC invalid revision\n"); 116 printk(KERN_DEBUG "_OSC invalid revision\n");
77 if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { 117 if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) {
78 /* Update Global Control Set */ 118 /* Update Global Control Set */
79 global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8)); 119 osc_data->global_ctrlsets =
120 *((u32 *)(out_obj->buffer.pointer + 8));
80 status = AE_OK; 121 status = AE_OK;
81 goto query_osc_out; 122 goto query_osc_out;
82 } 123 }
@@ -85,12 +126,21 @@ acpi_query_osc (
85 } 126 }
86 127
87 /* Update Global Control Set */ 128 /* Update Global Control Set */
88 global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8)); 129 osc_data->global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8));
89 status = AE_OK; 130 status = AE_OK;
90 131
91query_osc_out: 132query_osc_out:
92 kfree(output.pointer); 133 kfree(output.pointer);
134out_nofree:
93 *ret_status = status; 135 *ret_status = status;
136
137 osc_data->ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE;
138 osc_data->ctrlset_buf[OSC_CONTROL_TYPE] = temp;
139 if (ACPI_FAILURE(status)) {
140 /* no osc support at all */
141 osc_data->ctrlset_buf[OSC_SUPPORT_TYPE] = 0;
142 }
143
94 return status; 144 return status;
95} 145}
96 146
@@ -165,28 +215,15 @@ run_osc_out:
165 **/ 215 **/
166acpi_status __pci_osc_support_set(u32 flags, const char *hid) 216acpi_status __pci_osc_support_set(u32 flags, const char *hid)
167{ 217{
168 u32 temp; 218 acpi_status retval = AE_NOT_FOUND;
169 acpi_status retval;
170 219
171 if (!(flags & OSC_SUPPORT_MASKS)) { 220 if (!(flags & OSC_SUPPORT_MASKS)) {
172 return AE_TYPE; 221 return AE_TYPE;
173 } 222 }
174 ctrlset_buf[OSC_SUPPORT_TYPE] |= (flags & OSC_SUPPORT_MASKS);
175
176 /* do _OSC query for all possible controls */
177 temp = ctrlset_buf[OSC_CONTROL_TYPE];
178 ctrlset_buf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
179 ctrlset_buf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS;
180 acpi_get_devices(hid, 223 acpi_get_devices(hid,
181 acpi_query_osc, 224 acpi_query_osc,
182 ctrlset_buf, 225 (void *)(unsigned long)flags,
183 (void **) &retval ); 226 (void **) &retval );
184 ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE;
185 ctrlset_buf[OSC_CONTROL_TYPE] = temp;
186 if (ACPI_FAILURE(retval)) {
187 /* no osc support at all */
188 ctrlset_buf[OSC_SUPPORT_TYPE] = 0;
189 }
190 return AE_OK; 227 return AE_OK;
191} 228}
192 229
@@ -201,19 +238,31 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
201{ 238{
202 acpi_status status; 239 acpi_status status;
203 u32 ctrlset; 240 u32 ctrlset;
241 acpi_handle tmp;
242 struct acpi_osc_data *osc_data;
243
244 status = acpi_get_handle(handle, "_OSC", &tmp);
245 if (ACPI_FAILURE(status))
246 return status;
247
248 osc_data = acpi_get_osc_data(handle);
249 if (!osc_data) {
250 printk(KERN_ERR "acpi osc data array is full\n");
251 return AE_ERROR;
252 }
204 253
205 ctrlset = (flags & OSC_CONTROL_MASKS); 254 ctrlset = (flags & OSC_CONTROL_MASKS);
206 if (!ctrlset) { 255 if (!ctrlset) {
207 return AE_TYPE; 256 return AE_TYPE;
208 } 257 }
209 if (ctrlset_buf[OSC_SUPPORT_TYPE] && 258 if (osc_data->ctrlset_buf[OSC_SUPPORT_TYPE] &&
210 ((global_ctrlsets & ctrlset) != ctrlset)) { 259 ((osc_data->global_ctrlsets & ctrlset) != ctrlset)) {
211 return AE_SUPPORT; 260 return AE_SUPPORT;
212 } 261 }
213 ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset; 262 osc_data->ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset;
214 status = acpi_run_osc(handle, ctrlset_buf); 263 status = acpi_run_osc(handle, osc_data->ctrlset_buf);
215 if (ACPI_FAILURE (status)) { 264 if (ACPI_FAILURE (status)) {
216 ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset; 265 osc_data->ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset;
217 } 266 }
218 267
219 return status; 268 return status;
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 72cf61ed8f96..e1637bd82b8e 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -181,7 +181,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
181 any need to change it. */ 181 any need to change it. */
182 struct mempolicy *oldpol; 182 struct mempolicy *oldpol;
183 cpumask_t oldmask = current->cpus_allowed; 183 cpumask_t oldmask = current->cpus_allowed;
184 int node = pcibus_to_node(dev->bus); 184 int node = dev_to_node(&dev->dev);
185 185
186 if (node >= 0) { 186 if (node >= 0) {
187 node_to_cpumask_ptr(nodecpumask, node); 187 node_to_cpumask_ptr(nodecpumask, node);
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 271d41cc05ab..6f3c7446c329 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -489,13 +489,13 @@ pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr,
489 * @kobj: kobject for mapping 489 * @kobj: kobject for mapping
490 * @attr: struct bin_attribute for the file being mapped 490 * @attr: struct bin_attribute for the file being mapped
491 * @vma: struct vm_area_struct passed into the mmap 491 * @vma: struct vm_area_struct passed into the mmap
492 * @write_combine: 1 for write_combine mapping
492 * 493 *
493 * Use the regular PCI mapping routines to map a PCI resource into userspace. 494 * Use the regular PCI mapping routines to map a PCI resource into userspace.
494 * FIXME: write combining? maybe automatic for prefetchable regions?
495 */ 495 */
496static int 496static int
497pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, 497pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
498 struct vm_area_struct *vma) 498 struct vm_area_struct *vma, int write_combine)
499{ 499{
500 struct pci_dev *pdev = to_pci_dev(container_of(kobj, 500 struct pci_dev *pdev = to_pci_dev(container_of(kobj,
501 struct device, kobj)); 501 struct device, kobj));
@@ -518,7 +518,21 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
518 vma->vm_pgoff += start >> PAGE_SHIFT; 518 vma->vm_pgoff += start >> PAGE_SHIFT;
519 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; 519 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
520 520
521 return pci_mmap_page_range(pdev, vma, mmap_type, 0); 521 return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
522}
523
524static int
525pci_mmap_resource_uc(struct kobject *kobj, struct bin_attribute *attr,
526 struct vm_area_struct *vma)
527{
528 return pci_mmap_resource(kobj, attr, vma, 0);
529}
530
531static int
532pci_mmap_resource_wc(struct kobject *kobj, struct bin_attribute *attr,
533 struct vm_area_struct *vma)
534{
535 return pci_mmap_resource(kobj, attr, vma, 1);
522} 536}
523 537
524/** 538/**
@@ -541,9 +555,46 @@ pci_remove_resource_files(struct pci_dev *pdev)
541 sysfs_remove_bin_file(&pdev->dev.kobj, res_attr); 555 sysfs_remove_bin_file(&pdev->dev.kobj, res_attr);
542 kfree(res_attr); 556 kfree(res_attr);
543 } 557 }
558
559 res_attr = pdev->res_attr_wc[i];
560 if (res_attr) {
561 sysfs_remove_bin_file(&pdev->dev.kobj, res_attr);
562 kfree(res_attr);
563 }
544 } 564 }
545} 565}
546 566
567static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
568{
569 /* allocate attribute structure, piggyback attribute name */
570 int name_len = write_combine ? 13 : 10;
571 struct bin_attribute *res_attr;
572 int retval;
573
574 res_attr = kzalloc(sizeof(*res_attr) + name_len, GFP_ATOMIC);
575 if (res_attr) {
576 char *res_attr_name = (char *)(res_attr + 1);
577
578 if (write_combine) {
579 pdev->res_attr_wc[num] = res_attr;
580 sprintf(res_attr_name, "resource%d_wc", num);
581 res_attr->mmap = pci_mmap_resource_wc;
582 } else {
583 pdev->res_attr[num] = res_attr;
584 sprintf(res_attr_name, "resource%d", num);
585 res_attr->mmap = pci_mmap_resource_uc;
586 }
587 res_attr->attr.name = res_attr_name;
588 res_attr->attr.mode = S_IRUSR | S_IWUSR;
589 res_attr->size = pci_resource_len(pdev, num);
590 res_attr->private = &pdev->resource[num];
591 retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr);
592 } else
593 retval = -ENOMEM;
594
595 return retval;
596}
597
547/** 598/**
548 * pci_create_resource_files - create resource files in sysfs for @dev 599 * pci_create_resource_files - create resource files in sysfs for @dev
549 * @dev: dev in question 600 * @dev: dev in question
@@ -557,31 +608,19 @@ static int pci_create_resource_files(struct pci_dev *pdev)
557 608
558 /* Expose the PCI resources from this device as files */ 609 /* Expose the PCI resources from this device as files */
559 for (i = 0; i < PCI_ROM_RESOURCE; i++) { 610 for (i = 0; i < PCI_ROM_RESOURCE; i++) {
560 struct bin_attribute *res_attr;
561 611
562 /* skip empty resources */ 612 /* skip empty resources */
563 if (!pci_resource_len(pdev, i)) 613 if (!pci_resource_len(pdev, i))
564 continue; 614 continue;
565 615
566 /* allocate attribute structure, piggyback attribute name */ 616 retval = pci_create_attr(pdev, i, 0);
567 res_attr = kzalloc(sizeof(*res_attr) + 10, GFP_ATOMIC); 617 /* for prefetchable resources, create a WC mappable file */
568 if (res_attr) { 618 if (!retval && pdev->resource[i].flags & IORESOURCE_PREFETCH)
569 char *res_attr_name = (char *)(res_attr + 1); 619 retval = pci_create_attr(pdev, i, 1);
570 620
571 pdev->res_attr[i] = res_attr; 621 if (retval) {
572 sprintf(res_attr_name, "resource%d", i); 622 pci_remove_resource_files(pdev);
573 res_attr->attr.name = res_attr_name; 623 return retval;
574 res_attr->attr.mode = S_IRUSR | S_IWUSR;
575 res_attr->size = pci_resource_len(pdev, i);
576 res_attr->mmap = pci_mmap_resource;
577 res_attr->private = &pdev->resource[i];
578 retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr);
579 if (retval) {
580 pci_remove_resource_files(pdev);
581 return retval;
582 }
583 } else {
584 return -ENOMEM;
585 } 624 }
586 } 625 }
587 return 0; 626 return 0;
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 61fedb2448b6..f82495583e63 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -506,6 +506,23 @@ static void free_link_state(struct pci_dev *pdev)
506 pdev->link_state = NULL; 506 pdev->link_state = NULL;
507} 507}
508 508
509static int pcie_aspm_sanity_check(struct pci_dev *pdev)
510{
511 struct pci_dev *child_dev;
512 int child_pos;
513
514 /*
515 * Some functions in a slot might not all be PCIE functions, very
516 * strange. Disable ASPM for the whole slot
517 */
518 list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
519 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
520 if (!child_pos)
521 return -EINVAL;
522 }
523 return 0;
524}
525
509/* 526/*
510 * pcie_aspm_init_link_state: Initiate PCI express link state. 527 * pcie_aspm_init_link_state: Initiate PCI express link state.
511 * It is called after the pcie and its children devices are scaned. 528 * It is called after the pcie and its children devices are scaned.
@@ -526,6 +543,9 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
526 if (list_empty(&pdev->subordinate->devices)) 543 if (list_empty(&pdev->subordinate->devices))
527 goto out; 544 goto out;
528 545
546 if (pcie_aspm_sanity_check(pdev))
547 goto out;
548
529 mutex_lock(&aspm_lock); 549 mutex_lock(&aspm_lock);
530 550
531 link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); 551 link_state = kzalloc(sizeof(*link_state), GFP_KERNEL);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index afd914ebe215..dabb563f51d9 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1503,8 +1503,7 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f
1503 (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { 1503 (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) {
1504#ifdef DEBUG 1504#ifdef DEBUG
1505 dev_dbg(&dev->dev, "calling "); 1505 dev_dbg(&dev->dev, "calling ");
1506 print_fn_descriptor_symbol("%s()\n", 1506 print_fn_descriptor_symbol("%s\n", f->hook);
1507 (unsigned long) f->hook);
1508#endif 1507#endif
1509 f->hook(dev); 1508 f->hook(dev);
1510 } 1509 }
@@ -1826,6 +1825,7 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
1826 } 1825 }
1827} 1826}
1828DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); 1827DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk);
1828DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk);
1829 1829
1830static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) 1830static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
1831{ 1831{
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 0a6cea1316b4..52d0aa8c2e7a 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -352,6 +352,7 @@ static struct of_device_id electra_cf_match[] = {
352 }, 352 },
353 {}, 353 {},
354}; 354};
355MODULE_DEVICE_TABLE(of, electra_cf_match);
355 356
356static struct of_platform_driver electra_cf_driver = { 357static struct of_platform_driver electra_cf_driver = {
357 .name = (char *)driver_name, 358 .name = (char *)driver_name,
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 4fe7c58f57e9..886dac823ed6 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -19,6 +19,7 @@ void pnp_remove_card(struct pnp_card *card);
19int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); 19int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
20void pnp_remove_card_device(struct pnp_dev *dev); 20void pnp_remove_card_device(struct pnp_dev *dev);
21 21
22struct pnp_option *pnp_build_option(int priority);
22struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev); 23struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
23struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, 24struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
24 int priority); 25 int priority);
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 5d9301de1778..5695a79f3a52 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -424,7 +424,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
424 start = simple_strtoul(buf, &buf, 0); 424 start = simple_strtoul(buf, &buf, 0);
425 pnp_res = pnp_add_irq_resource(dev, start, 0); 425 pnp_res = pnp_add_irq_resource(dev, start, 0);
426 if (pnp_res) 426 if (pnp_res)
427 nirq++; 427 pnp_res->index = nirq++;
428 continue; 428 continue;
429 } 429 }
430 if (!strnicmp(buf, "dma", 3)) { 430 if (!strnicmp(buf, "dma", 3)) {
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 0201c8adfda7..46c791adb894 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -50,15 +50,17 @@ static int irq_flags(int triggering, int polarity, int shareable)
50 flags = IORESOURCE_IRQ_HIGHEDGE; 50 flags = IORESOURCE_IRQ_HIGHEDGE;
51 } 51 }
52 52
53 if (shareable) 53 if (shareable == ACPI_SHARED)
54 flags |= IORESOURCE_IRQ_SHAREABLE; 54 flags |= IORESOURCE_IRQ_SHAREABLE;
55 55
56 return flags; 56 return flags;
57} 57}
58 58
59static void decode_irq_flags(int flag, int *triggering, int *polarity) 59static void decode_irq_flags(struct pnp_dev *dev, int flags, int *triggering,
60 int *polarity, int *shareable)
60{ 61{
61 switch (flag) { 62 switch (flags & (IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL |
63 IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE)) {
62 case IORESOURCE_IRQ_LOWLEVEL: 64 case IORESOURCE_IRQ_LOWLEVEL:
63 *triggering = ACPI_LEVEL_SENSITIVE; 65 *triggering = ACPI_LEVEL_SENSITIVE;
64 *polarity = ACPI_ACTIVE_LOW; 66 *polarity = ACPI_ACTIVE_LOW;
@@ -75,7 +77,18 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity)
75 *triggering = ACPI_EDGE_SENSITIVE; 77 *triggering = ACPI_EDGE_SENSITIVE;
76 *polarity = ACPI_ACTIVE_HIGH; 78 *polarity = ACPI_ACTIVE_HIGH;
77 break; 79 break;
80 default:
81 dev_err(&dev->dev, "can't encode invalid IRQ mode %#x\n",
82 flags);
83 *triggering = ACPI_EDGE_SENSITIVE;
84 *polarity = ACPI_ACTIVE_HIGH;
85 break;
78 } 86 }
87
88 if (flags & IORESOURCE_IRQ_SHAREABLE)
89 *shareable = ACPI_SHARED;
90 else
91 *shareable = ACPI_EXCLUSIVE;
79} 92}
80 93
81static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, 94static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
@@ -742,6 +755,9 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
742 if (pnpacpi_supported_resource(res)) { 755 if (pnpacpi_supported_resource(res)) {
743 (*resource)->type = res->type; 756 (*resource)->type = res->type;
744 (*resource)->length = sizeof(struct acpi_resource); 757 (*resource)->length = sizeof(struct acpi_resource);
758 if (res->type == ACPI_RESOURCE_TYPE_IRQ)
759 (*resource)->data.irq.descriptor_length =
760 res->data.irq.descriptor_length;
745 (*resource)++; 761 (*resource)++;
746 } 762 }
747 763
@@ -788,22 +804,21 @@ static void pnpacpi_encode_irq(struct pnp_dev *dev,
788 struct resource *p) 804 struct resource *p)
789{ 805{
790 struct acpi_resource_irq *irq = &resource->data.irq; 806 struct acpi_resource_irq *irq = &resource->data.irq;
791 int triggering, polarity; 807 int triggering, polarity, shareable;
792 808
793 decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); 809 decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable);
794 irq->triggering = triggering; 810 irq->triggering = triggering;
795 irq->polarity = polarity; 811 irq->polarity = polarity;
796 if (triggering == ACPI_EDGE_SENSITIVE) 812 irq->sharable = shareable;
797 irq->sharable = ACPI_EXCLUSIVE;
798 else
799 irq->sharable = ACPI_SHARED;
800 irq->interrupt_count = 1; 813 irq->interrupt_count = 1;
801 irq->interrupts[0] = p->start; 814 irq->interrupts[0] = p->start;
802 815
803 dev_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start, 816 dev_dbg(&dev->dev, " encode irq %d %s %s %s (%d-byte descriptor)\n",
817 (int) p->start,
804 triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge", 818 triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge",
805 polarity == ACPI_ACTIVE_LOW ? "low" : "high", 819 polarity == ACPI_ACTIVE_LOW ? "low" : "high",
806 irq->sharable == ACPI_SHARED ? "shared" : "exclusive"); 820 irq->sharable == ACPI_SHARED ? "shared" : "exclusive",
821 irq->descriptor_length);
807} 822}
808 823
809static void pnpacpi_encode_ext_irq(struct pnp_dev *dev, 824static void pnpacpi_encode_ext_irq(struct pnp_dev *dev,
@@ -811,16 +826,13 @@ static void pnpacpi_encode_ext_irq(struct pnp_dev *dev,
811 struct resource *p) 826 struct resource *p)
812{ 827{
813 struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq; 828 struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq;
814 int triggering, polarity; 829 int triggering, polarity, shareable;
815 830
816 decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); 831 decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable);
817 extended_irq->producer_consumer = ACPI_CONSUMER; 832 extended_irq->producer_consumer = ACPI_CONSUMER;
818 extended_irq->triggering = triggering; 833 extended_irq->triggering = triggering;
819 extended_irq->polarity = polarity; 834 extended_irq->polarity = polarity;
820 if (triggering == ACPI_EDGE_SENSITIVE) 835 extended_irq->sharable = shareable;
821 extended_irq->sharable = ACPI_EXCLUSIVE;
822 else
823 extended_irq->sharable = ACPI_SHARED;
824 extended_irq->interrupt_count = 1; 836 extended_irq->interrupt_count = 1;
825 extended_irq->interrupts[0] = p->start; 837 extended_irq->interrupts[0] = p->start;
826 838
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index d049a2279fea..1ff3bb585ab2 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -111,6 +111,113 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
111 dev_info(&dev->dev, "SB audio device quirk - increased port range\n"); 111 dev_info(&dev->dev, "SB audio device quirk - increased port range\n");
112} 112}
113 113
114static struct pnp_option *quirk_isapnp_mpu_options(struct pnp_dev *dev)
115{
116 struct pnp_option *head = NULL;
117 struct pnp_option *prev = NULL;
118 struct pnp_option *res;
119
120 /*
121 * Build a functional IRQ-less variant of each MPU option.
122 */
123
124 for (res = dev->dependent; res; res = res->next) {
125 struct pnp_option *curr;
126 struct pnp_port *port;
127 struct pnp_port *copy;
128
129 port = res->port;
130 if (!port || !res->irq)
131 continue;
132
133 copy = pnp_alloc(sizeof *copy);
134 if (!copy)
135 break;
136
137 copy->min = port->min;
138 copy->max = port->max;
139 copy->align = port->align;
140 copy->size = port->size;
141 copy->flags = port->flags;
142
143 curr = pnp_build_option(PNP_RES_PRIORITY_FUNCTIONAL);
144 if (!curr) {
145 kfree(copy);
146 break;
147 }
148 curr->port = copy;
149
150 if (prev)
151 prev->next = curr;
152 else
153 head = curr;
154 prev = curr;
155 }
156 if (head)
157 dev_info(&dev->dev, "adding IRQ-less MPU options\n");
158
159 return head;
160}
161
162static void quirk_ad1815_mpu_resources(struct pnp_dev *dev)
163{
164 struct pnp_option *res;
165 struct pnp_irq *irq;
166
167 /*
168 * Distribute the independent IRQ over the dependent options
169 */
170
171 res = dev->independent;
172 if (!res)
173 return;
174
175 irq = res->irq;
176 if (!irq || irq->next)
177 return;
178
179 res = dev->dependent;
180 if (!res)
181 return;
182
183 while (1) {
184 struct pnp_irq *copy;
185
186 copy = pnp_alloc(sizeof *copy);
187 if (!copy)
188 break;
189
190 memcpy(copy->map, irq->map, sizeof copy->map);
191 copy->flags = irq->flags;
192
193 copy->next = res->irq; /* Yes, this is NULL */
194 res->irq = copy;
195
196 if (!res->next)
197 break;
198 res = res->next;
199 }
200 kfree(irq);
201
202 res->next = quirk_isapnp_mpu_options(dev);
203
204 res = dev->independent;
205 res->irq = NULL;
206}
207
208static void quirk_isapnp_mpu_resources(struct pnp_dev *dev)
209{
210 struct pnp_option *res;
211
212 res = dev->dependent;
213 if (!res)
214 return;
215
216 while (res->next)
217 res = res->next;
218
219 res->next = quirk_isapnp_mpu_options(dev);
220}
114 221
115#include <linux/pci.h> 222#include <linux/pci.h>
116 223
@@ -179,7 +286,7 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
179 pci_name(pdev), i, 286 pci_name(pdev), i,
180 (unsigned long long) pci_start, 287 (unsigned long long) pci_start,
181 (unsigned long long) pci_end); 288 (unsigned long long) pci_end);
182 res->flags = 0; 289 res->flags |= IORESOURCE_DISABLED;
183 } 290 }
184 } 291 }
185 } 292 }
@@ -205,6 +312,11 @@ static struct pnp_fixup pnp_fixups[] = {
205 {"CTL0043", quirk_sb16audio_resources}, 312 {"CTL0043", quirk_sb16audio_resources},
206 {"CTL0044", quirk_sb16audio_resources}, 313 {"CTL0044", quirk_sb16audio_resources},
207 {"CTL0045", quirk_sb16audio_resources}, 314 {"CTL0045", quirk_sb16audio_resources},
315 /* Add IRQ-less MPU options */
316 {"ADS7151", quirk_ad1815_mpu_resources},
317 {"ADS7181", quirk_isapnp_mpu_resources},
318 {"AZT0002", quirk_isapnp_mpu_resources},
319 /* PnP resources that might overlap PCI BARs */
208 {"PNP0c01", quirk_system_pci_resources}, 320 {"PNP0c01", quirk_system_pci_resources},
209 {"PNP0c02", quirk_system_pci_resources}, 321 {"PNP0c02", quirk_system_pci_resources},
210 {""} 322 {""}
@@ -212,20 +324,15 @@ static struct pnp_fixup pnp_fixups[] = {
212 324
213void pnp_fixup_device(struct pnp_dev *dev) 325void pnp_fixup_device(struct pnp_dev *dev)
214{ 326{
215 int i = 0; 327 struct pnp_fixup *f;
216 void (*quirk)(struct pnp_dev *);
217
218 while (*pnp_fixups[i].id) {
219 if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
220 quirk = pnp_fixups[i].quirk_function;
221 328
329 for (f = pnp_fixups; *f->id; f++) {
330 if (!compare_pnp_id(dev->id, f->id))
331 continue;
222#ifdef DEBUG 332#ifdef DEBUG
223 dev_dbg(&dev->dev, "calling "); 333 dev_dbg(&dev->dev, "%s: calling ", f->id);
224 print_fn_descriptor_symbol("%s()\n", 334 print_fn_descriptor_symbol("%s\n", f->quirk_function);
225 (unsigned long) *quirk);
226#endif 335#endif
227 (*quirk)(dev); 336 f->quirk_function(dev);
228 }
229 i++;
230 } 337 }
231} 338}
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 2041620d5682..390b50096e30 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -28,7 +28,7 @@ static int pnp_reserve_mem[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some
28 * option registration 28 * option registration
29 */ 29 */
30 30
31static struct pnp_option *pnp_build_option(int priority) 31struct pnp_option *pnp_build_option(int priority)
32{ 32{
33 struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option)); 33 struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
34 34
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
index 3eba85ed729c..95b076c18c07 100644
--- a/drivers/pnp/support.c
+++ b/drivers/pnp/support.c
@@ -45,10 +45,10 @@ void pnp_eisa_id_to_string(u32 id, char *str)
45 str[0] = 'A' + ((id >> 26) & 0x3f) - 1; 45 str[0] = 'A' + ((id >> 26) & 0x3f) - 1;
46 str[1] = 'A' + ((id >> 21) & 0x1f) - 1; 46 str[1] = 'A' + ((id >> 21) & 0x1f) - 1;
47 str[2] = 'A' + ((id >> 16) & 0x1f) - 1; 47 str[2] = 'A' + ((id >> 16) & 0x1f) - 1;
48 str[3] = hex_asc((id >> 12) & 0xf); 48 str[3] = hex_asc_hi(id >> 8);
49 str[4] = hex_asc((id >> 8) & 0xf); 49 str[4] = hex_asc_lo(id >> 8);
50 str[5] = hex_asc((id >> 4) & 0xf); 50 str[5] = hex_asc_hi(id);
51 str[6] = hex_asc((id >> 0) & 0xf); 51 str[6] = hex_asc_lo(id);
52 str[7] = '\0'; 52 str[7] = '\0';
53} 53}
54 54
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 9c2496dbeee4..cf4e07b01d48 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -81,7 +81,7 @@ static void reserve_resources_of_dev(struct pnp_dev *dev)
81 } 81 }
82 82
83 for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { 83 for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
84 if (res->flags & IORESOURCE_UNSET) 84 if (res->flags & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
85 continue; 85 continue;
86 86
87 reserve_range(dev, res->start, res->end, 0); 87 reserve_range(dev, res->start, res->end, 0);
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 138dd76ee347..af1633eb3b70 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -91,15 +91,13 @@ int power_supply_register(struct device *parent, struct power_supply *psy)
91{ 91{
92 int rc = 0; 92 int rc = 0;
93 93
94 psy->dev = device_create(power_supply_class, parent, 0, 94 psy->dev = device_create_drvdata(power_supply_class, parent, 0,
95 "%s", psy->name); 95 psy, "%s", psy->name);
96 if (IS_ERR(psy->dev)) { 96 if (IS_ERR(psy->dev)) {
97 rc = PTR_ERR(psy->dev); 97 rc = PTR_ERR(psy->dev);
98 goto dev_create_failed; 98 goto dev_create_failed;
99 } 99 }
100 100
101 dev_set_drvdata(psy->dev, psy);
102
103 INIT_WORK(&psy->changed_work, power_supply_changed_work); 101 INIT_WORK(&psy->changed_work, power_supply_changed_work);
104 102
105 rc = power_supply_create_attrs(psy); 103 rc = power_supply_create_attrs(psy);
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index c444d6b10c58..49215da5249b 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -201,7 +201,7 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
201 201
202 dev_dbg(dev, "uevent\n"); 202 dev_dbg(dev, "uevent\n");
203 203
204 if (!psy) { 204 if (!psy || !psy->dev) {
205 dev_dbg(dev, "No power supply yet\n"); 205 dev_dbg(dev, "No power supply yet\n");
206 return ret; 206 return ret;
207 } 207 }
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6cc2c0330230..4949dc4859be 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -256,6 +256,17 @@ config RTC_DRV_S35390A
256 This driver can also be built as a module. If so the module 256 This driver can also be built as a module. If so the module
257 will be called rtc-s35390a. 257 will be called rtc-s35390a.
258 258
259config RTC_DRV_FM3130
260 tristate "Ramtron FM3130"
261 help
262 If you say Y here you will get support for the
263 Ramtron FM3130 RTC chips.
264 Ramtron FM3130 is a chip with two separate devices inside,
265 RTC clock and FRAM. This driver provides only RTC functionality.
266
267 This driver can also be built as a module. If so the module
268 will be called rtc-fm3130.
269
259endif # I2C 270endif # I2C
260 271
261comment "SPI RTC drivers" 272comment "SPI RTC drivers"
@@ -534,4 +545,12 @@ config RTC_DRV_RS5C313
534 help 545 help
535 If you say yes here you get support for the Ricoh RS5C313 RTC chips. 546 If you say yes here you get support for the Ricoh RS5C313 RTC chips.
536 547
548config RTC_DRV_PPC
549 tristate "PowerPC machine dependent RTC support"
550 depends on PPC_MERGE
551 help
552 The PowerPC kernel has machine-specific functions for accessing
553 the RTC. This exposes that functionality through the generic RTC
554 class.
555
537endif # RTC_CLASS 556endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 872f1218ff9f..b6e14d51670b 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o
31obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o 31obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o
32obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o 32obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o
33obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o 33obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
34obj-$(CONFIG_RTC_DRV_FM3130) += rtc-fm3130.o
34obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o 35obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o
35obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o 36obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o
36obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o 37obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o
@@ -41,6 +42,7 @@ obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
41obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o 42obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
42obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 43obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
43obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o 44obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
45obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
44obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o 46obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
45obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o 47obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
46obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o 48obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 42244f14b41c..2ef8cdfda4a7 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -94,8 +94,11 @@ static int at32_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
94{ 94{
95 struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); 95 struct rtc_at32ap700x *rtc = dev_get_drvdata(dev);
96 96
97 spin_lock_irq(&rtc->lock);
97 rtc_time_to_tm(rtc->alarm_time, &alrm->time); 98 rtc_time_to_tm(rtc->alarm_time, &alrm->time);
98 alrm->pending = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0; 99 alrm->enabled = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0;
100 alrm->pending = rtc_readl(rtc, ISR) & RTC_BIT(ISR_TOPI) ? 1 : 0;
101 spin_unlock_irq(&rtc->lock);
99 102
100 return 0; 103 return 0;
101} 104}
@@ -119,7 +122,7 @@ static int at32_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
119 spin_lock_irq(&rtc->lock); 122 spin_lock_irq(&rtc->lock);
120 rtc->alarm_time = alarm_unix_time; 123 rtc->alarm_time = alarm_unix_time;
121 rtc_writel(rtc, TOP, rtc->alarm_time); 124 rtc_writel(rtc, TOP, rtc->alarm_time);
122 if (alrm->pending) 125 if (alrm->enabled)
123 rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL) 126 rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL)
124 | RTC_BIT(CTRL_TOPEN)); 127 | RTC_BIT(CTRL_TOPEN));
125 else 128 else
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index d060a06ce05b..d7bb9bac71df 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -905,19 +905,7 @@ static struct pnp_driver cmos_pnp_driver = {
905 .resume = cmos_pnp_resume, 905 .resume = cmos_pnp_resume,
906}; 906};
907 907
908static int __init cmos_init(void) 908#endif /* CONFIG_PNP */
909{
910 return pnp_register_driver(&cmos_pnp_driver);
911}
912module_init(cmos_init);
913
914static void __exit cmos_exit(void)
915{
916 pnp_unregister_driver(&cmos_pnp_driver);
917}
918module_exit(cmos_exit);
919
920#else /* no PNP */
921 909
922/*----------------------------------------------------------------*/ 910/*----------------------------------------------------------------*/
923 911
@@ -958,20 +946,33 @@ static struct platform_driver cmos_platform_driver = {
958 946
959static int __init cmos_init(void) 947static int __init cmos_init(void)
960{ 948{
949#ifdef CONFIG_PNP
950 if (pnp_platform_devices)
951 return pnp_register_driver(&cmos_pnp_driver);
952 else
953 return platform_driver_probe(&cmos_platform_driver,
954 cmos_platform_probe);
955#else
961 return platform_driver_probe(&cmos_platform_driver, 956 return platform_driver_probe(&cmos_platform_driver,
962 cmos_platform_probe); 957 cmos_platform_probe);
958#endif /* CONFIG_PNP */
963} 959}
964module_init(cmos_init); 960module_init(cmos_init);
965 961
966static void __exit cmos_exit(void) 962static void __exit cmos_exit(void)
967{ 963{
964#ifdef CONFIG_PNP
965 if (pnp_platform_devices)
966 pnp_unregister_driver(&cmos_pnp_driver);
967 else
968 platform_driver_unregister(&cmos_platform_driver);
969#else
968 platform_driver_unregister(&cmos_platform_driver); 970 platform_driver_unregister(&cmos_platform_driver);
971#endif /* CONFIG_PNP */
969} 972}
970module_exit(cmos_exit); 973module_exit(cmos_exit);
971 974
972 975
973#endif /* !PNP */
974
975MODULE_AUTHOR("David Brownell"); 976MODULE_AUTHOR("David Brownell");
976MODULE_DESCRIPTION("Driver for PC-style 'CMOS' RTCs"); 977MODULE_DESCRIPTION("Driver for PC-style 'CMOS' RTCs");
977MODULE_LICENSE("GPL"); 978MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index fa2d2f8b3f4d..640acd20fdde 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -42,7 +42,7 @@
42#define DS1374_REG_TCR 0x09 /* Trickle Charge */ 42#define DS1374_REG_TCR 0x09 /* Trickle Charge */
43 43
44static const struct i2c_device_id ds1374_id[] = { 44static const struct i2c_device_id ds1374_id[] = {
45 { "rtc-ds1374", 0 }, 45 { "ds1374", 0 },
46 { } 46 { }
47}; 47};
48MODULE_DEVICE_TABLE(i2c, ds1374_id); 48MODULE_DEVICE_TABLE(i2c, ds1374_id);
diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c
new file mode 100644
index 000000000000..11644c8fca82
--- /dev/null
+++ b/drivers/rtc/rtc-fm3130.c
@@ -0,0 +1,501 @@
1/*
2 * rtc-fm3130.c - RTC driver for Ramtron FM3130 I2C chip.
3 *
4 * Copyright (C) 2008 Sergey Lapin
5 * Based on ds1307 driver by James Chapman and David Brownell
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/i2c.h>
14#include <linux/rtc.h>
15#include <linux/bcd.h>
16
17#define FM3130_RTC_CONTROL (0x0)
18#define FM3130_CAL_CONTROL (0x1)
19#define FM3130_RTC_SECONDS (0x2)
20#define FM3130_RTC_MINUTES (0x3)
21#define FM3130_RTC_HOURS (0x4)
22#define FM3130_RTC_DAY (0x5)
23#define FM3130_RTC_DATE (0x6)
24#define FM3130_RTC_MONTHS (0x7)
25#define FM3130_RTC_YEARS (0x8)
26
27#define FM3130_ALARM_SECONDS (0x9)
28#define FM3130_ALARM_MINUTES (0xa)
29#define FM3130_ALARM_HOURS (0xb)
30#define FM3130_ALARM_DATE (0xc)
31#define FM3130_ALARM_MONTHS (0xd)
32#define FM3130_ALARM_WP_CONTROL (0xe)
33
34#define FM3130_CAL_CONTROL_BIT_nOSCEN (1 << 7) /* Osciallator enabled */
35#define FM3130_RTC_CONTROL_BIT_LB (1 << 7) /* Low battery */
36#define FM3130_RTC_CONTROL_BIT_AF (1 << 6) /* Alarm flag */
37#define FM3130_RTC_CONTROL_BIT_CF (1 << 5) /* Century overflow */
38#define FM3130_RTC_CONTROL_BIT_POR (1 << 4) /* Power on reset */
39#define FM3130_RTC_CONTROL_BIT_AEN (1 << 3) /* Alarm enable */
40#define FM3130_RTC_CONTROL_BIT_CAL (1 << 2) /* Calibration mode */
41#define FM3130_RTC_CONTROL_BIT_WRITE (1 << 1) /* W=1 -> write mode W=0 normal */
42#define FM3130_RTC_CONTROL_BIT_READ (1 << 0) /* R=1 -> read mode R=0 normal */
43
44#define FM3130_CLOCK_REGS 7
45#define FM3130_ALARM_REGS 5
46
47struct fm3130 {
48 u8 reg_addr_time;
49 u8 reg_addr_alarm;
50 u8 regs[15];
51 struct i2c_msg msg[4];
52 struct i2c_client *client;
53 struct rtc_device *rtc;
54 int data_valid;
55 int alarm;
56};
57static const struct i2c_device_id fm3130_id[] = {
58 { "fm3130-rtc", 0 },
59 { }
60};
61MODULE_DEVICE_TABLE(i2c, fm3130_id);
62
63#define FM3130_MODE_NORMAL 0
64#define FM3130_MODE_WRITE 1
65#define FM3130_MODE_READ 2
66
67static void fm3130_rtc_mode(struct device *dev, int mode)
68{
69 struct fm3130 *fm3130 = dev_get_drvdata(dev);
70
71 fm3130->regs[FM3130_RTC_CONTROL] =
72 i2c_smbus_read_byte_data(fm3130->client, FM3130_RTC_CONTROL);
73 switch (mode) {
74 case FM3130_MODE_NORMAL:
75 fm3130->regs[FM3130_RTC_CONTROL] &=
76 ~(FM3130_RTC_CONTROL_BIT_WRITE |
77 FM3130_RTC_CONTROL_BIT_READ);
78 break;
79 case FM3130_MODE_WRITE:
80 fm3130->regs[FM3130_RTC_CONTROL] |= FM3130_RTC_CONTROL_BIT_WRITE;
81 break;
82 case FM3130_MODE_READ:
83 fm3130->regs[FM3130_RTC_CONTROL] |= FM3130_RTC_CONTROL_BIT_READ;
84 break;
85 default:
86 dev_dbg(dev, "invalid mode %d\n", mode);
87 break;
88 }
89 /* Checking for alarm */
90 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_AF) {
91 fm3130->alarm = 1;
92 fm3130->regs[FM3130_RTC_CONTROL] &= ~FM3130_RTC_CONTROL_BIT_AF;
93 }
94 i2c_smbus_write_byte_data(fm3130->client,
95 FM3130_RTC_CONTROL, fm3130->regs[FM3130_RTC_CONTROL]);
96}
97
98static int fm3130_get_time(struct device *dev, struct rtc_time *t)
99{
100 struct fm3130 *fm3130 = dev_get_drvdata(dev);
101 int tmp;
102
103 if (!fm3130->data_valid) {
104 /* We have invalid data in RTC, probably due
105 to battery faults or other problems. Return EIO
106 for now, it will allow us to set data later insted
107 of error during probing which disables device */
108 return -EIO;
109 }
110 fm3130_rtc_mode(dev, FM3130_MODE_READ);
111
112 /* read the RTC date and time registers all at once */
113 tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
114 fm3130->msg, 2);
115 if (tmp != 2) {
116 dev_err(dev, "%s error %d\n", "read", tmp);
117 return -EIO;
118 }
119
120 fm3130_rtc_mode(dev, FM3130_MODE_NORMAL);
121
122 dev_dbg(dev, "%s: %02x %02x %02x %02x %02x %02x %02x %02x"
123 "%02x %02x %02x %02x %02x %02x %02x\n",
124 "read",
125 fm3130->regs[0], fm3130->regs[1],
126 fm3130->regs[2], fm3130->regs[3],
127 fm3130->regs[4], fm3130->regs[5],
128 fm3130->regs[6], fm3130->regs[7],
129 fm3130->regs[8], fm3130->regs[9],
130 fm3130->regs[0xa], fm3130->regs[0xb],
131 fm3130->regs[0xc], fm3130->regs[0xd],
132 fm3130->regs[0xe]);
133
134 t->tm_sec = BCD2BIN(fm3130->regs[FM3130_RTC_SECONDS] & 0x7f);
135 t->tm_min = BCD2BIN(fm3130->regs[FM3130_RTC_MINUTES] & 0x7f);
136 tmp = fm3130->regs[FM3130_RTC_HOURS] & 0x3f;
137 t->tm_hour = BCD2BIN(tmp);
138 t->tm_wday = BCD2BIN(fm3130->regs[FM3130_RTC_DAY] & 0x07) - 1;
139 t->tm_mday = BCD2BIN(fm3130->regs[FM3130_RTC_DATE] & 0x3f);
140 tmp = fm3130->regs[FM3130_RTC_MONTHS] & 0x1f;
141 t->tm_mon = BCD2BIN(tmp) - 1;
142
143 /* assume 20YY not 19YY, and ignore CF bit */
144 t->tm_year = BCD2BIN(fm3130->regs[FM3130_RTC_YEARS]) + 100;
145
146 dev_dbg(dev, "%s secs=%d, mins=%d, "
147 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
148 "read", t->tm_sec, t->tm_min,
149 t->tm_hour, t->tm_mday,
150 t->tm_mon, t->tm_year, t->tm_wday);
151
152 /* initial clock setting can be undefined */
153 return rtc_valid_tm(t);
154}
155
156
157static int fm3130_set_time(struct device *dev, struct rtc_time *t)
158{
159 struct fm3130 *fm3130 = dev_get_drvdata(dev);
160 int tmp, i;
161 u8 *buf = fm3130->regs;
162
163 dev_dbg(dev, "%s secs=%d, mins=%d, "
164 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
165 "write", t->tm_sec, t->tm_min,
166 t->tm_hour, t->tm_mday,
167 t->tm_mon, t->tm_year, t->tm_wday);
168
169 /* first register addr */
170 buf[FM3130_RTC_SECONDS] = BIN2BCD(t->tm_sec);
171 buf[FM3130_RTC_MINUTES] = BIN2BCD(t->tm_min);
172 buf[FM3130_RTC_HOURS] = BIN2BCD(t->tm_hour);
173 buf[FM3130_RTC_DAY] = BIN2BCD(t->tm_wday + 1);
174 buf[FM3130_RTC_DATE] = BIN2BCD(t->tm_mday);
175 buf[FM3130_RTC_MONTHS] = BIN2BCD(t->tm_mon + 1);
176
177 /* assume 20YY not 19YY */
178 tmp = t->tm_year - 100;
179 buf[FM3130_RTC_YEARS] = BIN2BCD(tmp);
180
181 dev_dbg(dev, "%s: %02x %02x %02x %02x %02x %02x %02x"
182 "%02x %02x %02x %02x %02x %02x %02x %02x\n",
183 "write", buf[0], buf[1], buf[2], buf[3],
184 buf[4], buf[5], buf[6], buf[7],
185 buf[8], buf[9], buf[0xa], buf[0xb],
186 buf[0xc], buf[0xd], buf[0xe]);
187
188 fm3130_rtc_mode(dev, FM3130_MODE_WRITE);
189
190 /* Writing time registers, we don't support multibyte transfers */
191 for (i = 0; i < FM3130_CLOCK_REGS; i++) {
192 i2c_smbus_write_byte_data(fm3130->client,
193 FM3130_RTC_SECONDS + i,
194 fm3130->regs[FM3130_RTC_SECONDS + i]);
195 }
196
197 fm3130_rtc_mode(dev, FM3130_MODE_NORMAL);
198
199 /* We assume here that data are valid once written */
200 if (!fm3130->data_valid)
201 fm3130->data_valid = 1;
202 return 0;
203}
204
205static int fm3130_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
206{
207 struct fm3130 *fm3130 = dev_get_drvdata(dev);
208 int tmp;
209 struct rtc_time *tm = &alrm->time;
210 /* read the RTC alarm registers all at once */
211 tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
212 &fm3130->msg[2], 2);
213 if (tmp != 2) {
214 dev_err(dev, "%s error %d\n", "read", tmp);
215 return -EIO;
216 }
217 dev_dbg(dev, "alarm read %02x %02x %02x %02x %02x\n",
218 fm3130->regs[FM3130_ALARM_SECONDS],
219 fm3130->regs[FM3130_ALARM_MINUTES],
220 fm3130->regs[FM3130_ALARM_HOURS],
221 fm3130->regs[FM3130_ALARM_DATE],
222 fm3130->regs[FM3130_ALARM_MONTHS]);
223
224
225 tm->tm_sec = BCD2BIN(fm3130->regs[FM3130_ALARM_SECONDS] & 0x7F);
226 tm->tm_min = BCD2BIN(fm3130->regs[FM3130_ALARM_MINUTES] & 0x7F);
227 tm->tm_hour = BCD2BIN(fm3130->regs[FM3130_ALARM_HOURS] & 0x3F);
228 tm->tm_mday = BCD2BIN(fm3130->regs[FM3130_ALARM_DATE] & 0x3F);
229 tm->tm_mon = BCD2BIN(fm3130->regs[FM3130_ALARM_MONTHS] & 0x1F);
230 if (tm->tm_mon > 0)
231 tm->tm_mon -= 1; /* RTC is 1-12, tm_mon is 0-11 */
232 dev_dbg(dev, "%s secs=%d, mins=%d, "
233 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
234 "read alarm", tm->tm_sec, tm->tm_min,
235 tm->tm_hour, tm->tm_mday,
236 tm->tm_mon, tm->tm_year, tm->tm_wday);
237
238 return 0;
239}
240
241static int fm3130_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
242{
243 struct fm3130 *fm3130 = dev_get_drvdata(dev);
244 struct rtc_time *tm = &alrm->time;
245 int i;
246
247 dev_dbg(dev, "%s secs=%d, mins=%d, "
248 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
249 "write alarm", tm->tm_sec, tm->tm_min,
250 tm->tm_hour, tm->tm_mday,
251 tm->tm_mon, tm->tm_year, tm->tm_wday);
252
253 if (tm->tm_sec != -1)
254 fm3130->regs[FM3130_ALARM_SECONDS] =
255 BIN2BCD(tm->tm_sec) | 0x80;
256
257 if (tm->tm_min != -1)
258 fm3130->regs[FM3130_ALARM_MINUTES] =
259 BIN2BCD(tm->tm_min) | 0x80;
260
261 if (tm->tm_hour != -1)
262 fm3130->regs[FM3130_ALARM_HOURS] =
263 BIN2BCD(tm->tm_hour) | 0x80;
264
265 if (tm->tm_mday != -1)
266 fm3130->regs[FM3130_ALARM_DATE] =
267 BIN2BCD(tm->tm_mday) | 0x80;
268
269 if (tm->tm_mon != -1)
270 fm3130->regs[FM3130_ALARM_MONTHS] =
271 BIN2BCD(tm->tm_mon + 1) | 0x80;
272
273 dev_dbg(dev, "alarm write %02x %02x %02x %02x %02x\n",
274 fm3130->regs[FM3130_ALARM_SECONDS],
275 fm3130->regs[FM3130_ALARM_MINUTES],
276 fm3130->regs[FM3130_ALARM_HOURS],
277 fm3130->regs[FM3130_ALARM_DATE],
278 fm3130->regs[FM3130_ALARM_MONTHS]);
279 /* Writing time registers, we don't support multibyte transfers */
280 for (i = 0; i < FM3130_ALARM_REGS; i++) {
281 i2c_smbus_write_byte_data(fm3130->client,
282 FM3130_ALARM_SECONDS + i,
283 fm3130->regs[FM3130_ALARM_SECONDS + i]);
284 }
285 fm3130->regs[FM3130_RTC_CONTROL] =
286 i2c_smbus_read_byte_data(fm3130->client, FM3130_RTC_CONTROL);
287 /* Checking for alarm */
288 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_AF) {
289 fm3130->alarm = 1;
290 fm3130->regs[FM3130_RTC_CONTROL] &= ~FM3130_RTC_CONTROL_BIT_AF;
291 }
292 if (alrm->enabled) {
293 i2c_smbus_write_byte_data(fm3130->client, FM3130_RTC_CONTROL,
294 (fm3130->regs[FM3130_RTC_CONTROL] &
295 ~(FM3130_RTC_CONTROL_BIT_CAL)) |
296 FM3130_RTC_CONTROL_BIT_AEN);
297 } else {
298 i2c_smbus_write_byte_data(fm3130->client, FM3130_RTC_CONTROL,
299 fm3130->regs[FM3130_RTC_CONTROL] &
300 ~(FM3130_RTC_CONTROL_BIT_AEN));
301 }
302 return 0;
303}
304
305static const struct rtc_class_ops fm3130_rtc_ops = {
306 .read_time = fm3130_get_time,
307 .set_time = fm3130_set_time,
308 .read_alarm = fm3130_read_alarm,
309 .set_alarm = fm3130_set_alarm,
310};
311
312static struct i2c_driver fm3130_driver;
313
314static int __devinit fm3130_probe(struct i2c_client *client,
315 const struct i2c_device_id *id)
316{
317 struct fm3130 *fm3130;
318 int err = -ENODEV;
319 int tmp;
320 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
321
322 if (!i2c_check_functionality(adapter,
323 I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
324 return -EIO;
325
326 fm3130 = kzalloc(sizeof(struct fm3130), GFP_KERNEL);
327
328 if (!fm3130)
329 return -ENOMEM;
330
331 fm3130->client = client;
332 i2c_set_clientdata(client, fm3130);
333 fm3130->reg_addr_time = FM3130_RTC_SECONDS;
334 fm3130->reg_addr_alarm = FM3130_ALARM_SECONDS;
335
336 /* Messages to read time */
337 fm3130->msg[0].addr = client->addr;
338 fm3130->msg[0].flags = 0;
339 fm3130->msg[0].len = 1;
340 fm3130->msg[0].buf = &fm3130->reg_addr_time;
341
342 fm3130->msg[1].addr = client->addr;
343 fm3130->msg[1].flags = I2C_M_RD;
344 fm3130->msg[1].len = FM3130_CLOCK_REGS;
345 fm3130->msg[1].buf = &fm3130->regs[FM3130_RTC_SECONDS];
346
347 /* Messages to read alarm */
348 fm3130->msg[2].addr = client->addr;
349 fm3130->msg[2].flags = 0;
350 fm3130->msg[2].len = 1;
351 fm3130->msg[2].buf = &fm3130->reg_addr_alarm;
352
353 fm3130->msg[3].addr = client->addr;
354 fm3130->msg[3].flags = I2C_M_RD;
355 fm3130->msg[3].len = FM3130_ALARM_REGS;
356 fm3130->msg[3].buf = &fm3130->regs[FM3130_ALARM_SECONDS];
357
358 fm3130->data_valid = 0;
359
360 tmp = i2c_transfer(adapter, fm3130->msg, 4);
361 if (tmp != 4) {
362 pr_debug("read error %d\n", tmp);
363 err = -EIO;
364 goto exit_free;
365 }
366
367 fm3130->regs[FM3130_RTC_CONTROL] =
368 i2c_smbus_read_byte_data(client, FM3130_RTC_CONTROL);
369 fm3130->regs[FM3130_CAL_CONTROL] =
370 i2c_smbus_read_byte_data(client, FM3130_CAL_CONTROL);
371
372 /* Checking for alarm */
373 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_AF) {
374 fm3130->alarm = 1;
375 fm3130->regs[FM3130_RTC_CONTROL] &= ~FM3130_RTC_CONTROL_BIT_AF;
376 }
377
378 /* Disabling calibration mode */
379 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL)
380 i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
381 fm3130->regs[FM3130_RTC_CONTROL] &
382 ~(FM3130_RTC_CONTROL_BIT_CAL));
383 dev_warn(&client->dev, "Disabling calibration mode!\n");
384
385 /* Disabling read and write modes */
386 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_WRITE ||
387 fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ)
388 i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
389 fm3130->regs[FM3130_RTC_CONTROL] &
390 ~(FM3130_RTC_CONTROL_BIT_READ |
391 FM3130_RTC_CONTROL_BIT_WRITE));
392 dev_warn(&client->dev, "Disabling READ or WRITE mode!\n");
393
394 /* oscillator off? turn it on, so clock can tick. */
395 if (fm3130->regs[FM3130_CAL_CONTROL] & FM3130_CAL_CONTROL_BIT_nOSCEN)
396 i2c_smbus_write_byte_data(client, FM3130_CAL_CONTROL,
397 fm3130->regs[FM3130_CAL_CONTROL] &
398 ~(FM3130_CAL_CONTROL_BIT_nOSCEN));
399
400 /* oscillator fault? clear flag, and warn */
401 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_LB)
402 dev_warn(&client->dev, "Low battery!\n");
403
404 /* oscillator fault? clear flag, and warn */
405 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_POR) {
406 i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
407 fm3130->regs[FM3130_RTC_CONTROL] &
408 ~FM3130_RTC_CONTROL_BIT_POR);
409 dev_warn(&client->dev, "SET TIME!\n");
410 }
411 /* ACS is controlled by alarm */
412 i2c_smbus_write_byte_data(client, FM3130_ALARM_WP_CONTROL, 0x80);
413
414 /* TODO */
415 /* TODO need to sanity check alarm */
416 tmp = fm3130->regs[FM3130_RTC_SECONDS];
417 tmp = BCD2BIN(tmp & 0x7f);
418 if (tmp > 60)
419 goto exit_bad;
420 tmp = BCD2BIN(fm3130->regs[FM3130_RTC_MINUTES] & 0x7f);
421 if (tmp > 60)
422 goto exit_bad;
423
424 tmp = BCD2BIN(fm3130->regs[FM3130_RTC_DATE] & 0x3f);
425 if (tmp == 0 || tmp > 31)
426 goto exit_bad;
427
428 tmp = BCD2BIN(fm3130->regs[FM3130_RTC_MONTHS] & 0x1f);
429 if (tmp == 0 || tmp > 12)
430 goto exit_bad;
431
432 tmp = fm3130->regs[FM3130_RTC_HOURS];
433
434 fm3130->data_valid = 1;
435
436exit_bad:
437 if (!fm3130->data_valid)
438 dev_dbg(&client->dev,
439 "%s: %02x %02x %02x %02x %02x %02x %02x %02x"
440 "%02x %02x %02x %02x %02x %02x %02x\n",
441 "bogus registers",
442 fm3130->regs[0], fm3130->regs[1],
443 fm3130->regs[2], fm3130->regs[3],
444 fm3130->regs[4], fm3130->regs[5],
445 fm3130->regs[6], fm3130->regs[7],
446 fm3130->regs[8], fm3130->regs[9],
447 fm3130->regs[0xa], fm3130->regs[0xb],
448 fm3130->regs[0xc], fm3130->regs[0xd],
449 fm3130->regs[0xe]);
450
451 /* We won't bail out here because we just got invalid data.
452 Time setting from u-boot doesn't work anyway */
453 fm3130->rtc = rtc_device_register(client->name, &client->dev,
454 &fm3130_rtc_ops, THIS_MODULE);
455 if (IS_ERR(fm3130->rtc)) {
456 err = PTR_ERR(fm3130->rtc);
457 dev_err(&client->dev,
458 "unable to register the class device\n");
459 goto exit_free;
460 }
461 return 0;
462exit_free:
463 kfree(fm3130);
464 return err;
465}
466
467static int __devexit fm3130_remove(struct i2c_client *client)
468{
469 struct fm3130 *fm3130 = i2c_get_clientdata(client);
470
471 rtc_device_unregister(fm3130->rtc);
472 kfree(fm3130);
473 return 0;
474}
475
476static struct i2c_driver fm3130_driver = {
477 .driver = {
478 .name = "rtc-fm3130",
479 .owner = THIS_MODULE,
480 },
481 .probe = fm3130_probe,
482 .remove = __devexit_p(fm3130_remove),
483 .id_table = fm3130_id,
484};
485
486static int __init fm3130_init(void)
487{
488 return i2c_add_driver(&fm3130_driver);
489}
490module_init(fm3130_init);
491
492static void __exit fm3130_exit(void)
493{
494 i2c_del_driver(&fm3130_driver);
495}
496module_exit(fm3130_exit);
497
498MODULE_DESCRIPTION("RTC driver for FM3130");
499MODULE_AUTHOR("Sergey Lapin <slapin@ossfans.org>");
500MODULE_LICENSE("GPL");
501
diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
index ba795a4db1e9..9f996ec881ce 100644
--- a/drivers/rtc/rtc-lib.c
+++ b/drivers/rtc/rtc-lib.c
@@ -51,7 +51,7 @@ EXPORT_SYMBOL(rtc_year_days);
51 */ 51 */
52void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) 52void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
53{ 53{
54 register int days, month, year; 54 unsigned int days, month, year;
55 55
56 days = time / 86400; 56 days = time / 86400;
57 time -= days * 86400; 57 time -= days * 86400;
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 316bfaa80872..a3e0880b38fb 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/kernel.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/string.h> 20#include <linux/string.h>
20#include <linux/i2c.h> 21#include <linux/i2c.h>
@@ -803,6 +804,7 @@ static int m41t80_probe(struct i2c_client *client,
803 804
804#ifdef CONFIG_RTC_DRV_M41T80_WDT 805#ifdef CONFIG_RTC_DRV_M41T80_WDT
805 if (clientdata->features & M41T80_FEATURE_HT) { 806 if (clientdata->features & M41T80_FEATURE_HT) {
807 save_client = client;
806 rc = misc_register(&wdt_dev); 808 rc = misc_register(&wdt_dev);
807 if (rc) 809 if (rc)
808 goto exit; 810 goto exit;
@@ -811,7 +813,6 @@ static int m41t80_probe(struct i2c_client *client,
811 misc_deregister(&wdt_dev); 813 misc_deregister(&wdt_dev);
812 goto exit; 814 goto exit;
813 } 815 }
814 save_client = client;
815 } 816 }
816#endif 817#endif
817 return 0; 818 return 0;
diff --git a/drivers/rtc/rtc-ppc.c b/drivers/rtc/rtc-ppc.c
new file mode 100644
index 000000000000..c8e97e25ef7e
--- /dev/null
+++ b/drivers/rtc/rtc-ppc.c
@@ -0,0 +1,69 @@
1/*
2 * RTC driver for ppc_md RTC functions
3 *
4 * © 2007 Red Hat, Inc.
5 *
6 * Author: David Woodhouse <dwmw2@infradead.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13
14#include <linux/module.h>
15#include <linux/err.h>
16#include <linux/rtc.h>
17#include <linux/platform_device.h>
18#include <asm/machdep.h>
19
20static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
21{
22 ppc_md.get_rtc_time(tm);
23 return 0;
24}
25
26static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
27{
28 return ppc_md.set_rtc_time(tm);
29}
30
31static const struct rtc_class_ops ppc_rtc_ops = {
32 .set_time = ppc_rtc_set_time,
33 .read_time = ppc_rtc_read_time,
34};
35
36static struct rtc_device *rtc;
37static struct platform_device *ppc_rtc_pdev;
38
39static int __init ppc_rtc_init(void)
40{
41 if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
42 return -ENODEV;
43
44 ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
45 if (IS_ERR(ppc_rtc_pdev))
46 return PTR_ERR(ppc_rtc_pdev);
47
48 rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
49 &ppc_rtc_ops, THIS_MODULE);
50 if (IS_ERR(rtc)) {
51 platform_device_unregister(ppc_rtc_pdev);
52 return PTR_ERR(rtc);
53 }
54
55 return 0;
56}
57
58static void __exit ppc_rtc_exit(void)
59{
60 rtc_device_unregister(rtc);
61 platform_device_unregister(ppc_rtc_pdev);
62}
63
64module_init(ppc_rtc_init);
65module_exit(ppc_rtc_exit);
66
67MODULE_LICENSE("GPL");
68MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
69MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index ac6d4d3218b3..1a4025683362 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -63,6 +63,7 @@ static void dasd_return_cqr_cb(struct dasd_ccw_req *, void *);
63 */ 63 */
64static wait_queue_head_t dasd_init_waitq; 64static wait_queue_head_t dasd_init_waitq;
65static wait_queue_head_t dasd_flush_wq; 65static wait_queue_head_t dasd_flush_wq;
66static wait_queue_head_t generic_waitq;
66 67
67/* 68/*
68 * Allocate memory for a new device structure. 69 * Allocate memory for a new device structure.
@@ -925,6 +926,8 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
925 struct dasd_ccw_req *cqr; 926 struct dasd_ccw_req *cqr;
926 struct dasd_device *device; 927 struct dasd_device *device;
927 928
929 if (!intparm)
930 return;
928 cqr = (struct dasd_ccw_req *) intparm; 931 cqr = (struct dasd_ccw_req *) intparm;
929 if (cqr->status != DASD_CQR_IN_IO) { 932 if (cqr->status != DASD_CQR_IN_IO) {
930 MESSAGE(KERN_DEBUG, 933 MESSAGE(KERN_DEBUG,
@@ -976,17 +979,16 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
976 if (IS_ERR(irb)) { 979 if (IS_ERR(irb)) {
977 switch (PTR_ERR(irb)) { 980 switch (PTR_ERR(irb)) {
978 case -EIO: 981 case -EIO:
979 dasd_handle_killed_request(cdev, intparm);
980 break; 982 break;
981 case -ETIMEDOUT: 983 case -ETIMEDOUT:
982 printk(KERN_WARNING"%s(%s): request timed out\n", 984 printk(KERN_WARNING"%s(%s): request timed out\n",
983 __func__, cdev->dev.bus_id); 985 __func__, cdev->dev.bus_id);
984 //FIXME - dasd uses own timeout interface...
985 break; 986 break;
986 default: 987 default:
987 printk(KERN_WARNING"%s(%s): unknown error %ld\n", 988 printk(KERN_WARNING"%s(%s): unknown error %ld\n",
988 __func__, cdev->dev.bus_id, PTR_ERR(irb)); 989 __func__, cdev->dev.bus_id, PTR_ERR(irb));
989 } 990 }
991 dasd_handle_killed_request(cdev, intparm);
990 return; 992 return;
991 } 993 }
992 994
@@ -1150,11 +1152,15 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
1150 struct list_head *l, *n; 1152 struct list_head *l, *n;
1151 struct dasd_ccw_req *cqr; 1153 struct dasd_ccw_req *cqr;
1152 struct dasd_block *block; 1154 struct dasd_block *block;
1155 void (*callback)(struct dasd_ccw_req *, void *data);
1156 void *callback_data;
1153 1157
1154 list_for_each_safe(l, n, final_queue) { 1158 list_for_each_safe(l, n, final_queue) {
1155 cqr = list_entry(l, struct dasd_ccw_req, devlist); 1159 cqr = list_entry(l, struct dasd_ccw_req, devlist);
1156 list_del_init(&cqr->devlist); 1160 list_del_init(&cqr->devlist);
1157 block = cqr->block; 1161 block = cqr->block;
1162 callback = cqr->callback;
1163 callback_data = cqr->callback_data;
1158 if (block) 1164 if (block)
1159 spin_lock_bh(&block->queue_lock); 1165 spin_lock_bh(&block->queue_lock);
1160 switch (cqr->status) { 1166 switch (cqr->status) {
@@ -1175,7 +1181,7 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
1175 BUG(); 1181 BUG();
1176 } 1182 }
1177 if (cqr->callback != NULL) 1183 if (cqr->callback != NULL)
1178 (cqr->callback)(cqr, cqr->callback_data); 1184 (callback)(cqr, callback_data);
1179 if (block) 1185 if (block)
1180 spin_unlock_bh(&block->queue_lock); 1186 spin_unlock_bh(&block->queue_lock);
1181 } 1187 }
@@ -1405,17 +1411,15 @@ static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
1405 */ 1411 */
1406int dasd_sleep_on(struct dasd_ccw_req *cqr) 1412int dasd_sleep_on(struct dasd_ccw_req *cqr)
1407{ 1413{
1408 wait_queue_head_t wait_q;
1409 struct dasd_device *device; 1414 struct dasd_device *device;
1410 int rc; 1415 int rc;
1411 1416
1412 device = cqr->startdev; 1417 device = cqr->startdev;
1413 1418
1414 init_waitqueue_head (&wait_q);
1415 cqr->callback = dasd_wakeup_cb; 1419 cqr->callback = dasd_wakeup_cb;
1416 cqr->callback_data = (void *) &wait_q; 1420 cqr->callback_data = (void *) &generic_waitq;
1417 dasd_add_request_tail(cqr); 1421 dasd_add_request_tail(cqr);
1418 wait_event(wait_q, _wait_for_wakeup(cqr)); 1422 wait_event(generic_waitq, _wait_for_wakeup(cqr));
1419 1423
1420 /* Request status is either done or failed. */ 1424 /* Request status is either done or failed. */
1421 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; 1425 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
@@ -1428,20 +1432,18 @@ int dasd_sleep_on(struct dasd_ccw_req *cqr)
1428 */ 1432 */
1429int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr) 1433int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr)
1430{ 1434{
1431 wait_queue_head_t wait_q;
1432 struct dasd_device *device; 1435 struct dasd_device *device;
1433 int rc; 1436 int rc;
1434 1437
1435 device = cqr->startdev; 1438 device = cqr->startdev;
1436 init_waitqueue_head (&wait_q);
1437 cqr->callback = dasd_wakeup_cb; 1439 cqr->callback = dasd_wakeup_cb;
1438 cqr->callback_data = (void *) &wait_q; 1440 cqr->callback_data = (void *) &generic_waitq;
1439 dasd_add_request_tail(cqr); 1441 dasd_add_request_tail(cqr);
1440 rc = wait_event_interruptible(wait_q, _wait_for_wakeup(cqr)); 1442 rc = wait_event_interruptible(generic_waitq, _wait_for_wakeup(cqr));
1441 if (rc == -ERESTARTSYS) { 1443 if (rc == -ERESTARTSYS) {
1442 dasd_cancel_req(cqr); 1444 dasd_cancel_req(cqr);
1443 /* wait (non-interruptible) for final status */ 1445 /* wait (non-interruptible) for final status */
1444 wait_event(wait_q, _wait_for_wakeup(cqr)); 1446 wait_event(generic_waitq, _wait_for_wakeup(cqr));
1445 } 1447 }
1446 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; 1448 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
1447 return rc; 1449 return rc;
@@ -1465,7 +1467,6 @@ static inline int _dasd_term_running_cqr(struct dasd_device *device)
1465 1467
1466int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) 1468int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
1467{ 1469{
1468 wait_queue_head_t wait_q;
1469 struct dasd_device *device; 1470 struct dasd_device *device;
1470 int rc; 1471 int rc;
1471 1472
@@ -1477,9 +1478,8 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
1477 return rc; 1478 return rc;
1478 } 1479 }
1479 1480
1480 init_waitqueue_head (&wait_q);
1481 cqr->callback = dasd_wakeup_cb; 1481 cqr->callback = dasd_wakeup_cb;
1482 cqr->callback_data = (void *) &wait_q; 1482 cqr->callback_data = (void *) &generic_waitq;
1483 cqr->status = DASD_CQR_QUEUED; 1483 cqr->status = DASD_CQR_QUEUED;
1484 list_add(&cqr->devlist, &device->ccw_queue); 1484 list_add(&cqr->devlist, &device->ccw_queue);
1485 1485
@@ -1488,7 +1488,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
1488 1488
1489 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 1489 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1490 1490
1491 wait_event(wait_q, _wait_for_wakeup(cqr)); 1491 wait_event(generic_waitq, _wait_for_wakeup(cqr));
1492 1492
1493 /* Request status is either done or failed. */ 1493 /* Request status is either done or failed. */
1494 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; 1494 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
@@ -2429,6 +2429,7 @@ static int __init dasd_init(void)
2429 2429
2430 init_waitqueue_head(&dasd_init_waitq); 2430 init_waitqueue_head(&dasd_init_waitq);
2431 init_waitqueue_head(&dasd_flush_wq); 2431 init_waitqueue_head(&dasd_flush_wq);
2432 init_waitqueue_head(&generic_waitq);
2432 2433
2433 /* register 'common' DASD debug area, used for all DBF_XXX calls */ 2434 /* register 'common' DASD debug area, used for all DBF_XXX calls */
2434 dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long)); 2435 dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long));
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index f4fb40257348..d774e79476fe 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -86,10 +86,10 @@ static DEFINE_SPINLOCK(dasd_devmap_lock);
86static struct list_head dasd_hashlists[256]; 86static struct list_head dasd_hashlists[256];
87int dasd_max_devindex; 87int dasd_max_devindex;
88 88
89static struct dasd_devmap *dasd_add_busid(char *, int); 89static struct dasd_devmap *dasd_add_busid(const char *, int);
90 90
91static inline int 91static inline int
92dasd_hash_busid(char *bus_id) 92dasd_hash_busid(const char *bus_id)
93{ 93{
94 int hash, i; 94 int hash, i;
95 95
@@ -394,7 +394,7 @@ dasd_parse(void)
394 * devices. 394 * devices.
395 */ 395 */
396static struct dasd_devmap * 396static struct dasd_devmap *
397dasd_add_busid(char *bus_id, int features) 397dasd_add_busid(const char *bus_id, int features)
398{ 398{
399 struct dasd_devmap *devmap, *new, *tmp; 399 struct dasd_devmap *devmap, *new, *tmp;
400 int hash; 400 int hash;
@@ -430,7 +430,7 @@ dasd_add_busid(char *bus_id, int features)
430 * Find devmap for device with given bus_id. 430 * Find devmap for device with given bus_id.
431 */ 431 */
432static struct dasd_devmap * 432static struct dasd_devmap *
433dasd_find_busid(char *bus_id) 433dasd_find_busid(const char *bus_id)
434{ 434{
435 struct dasd_devmap *devmap, *tmp; 435 struct dasd_devmap *devmap, *tmp;
436 int hash; 436 int hash;
@@ -452,7 +452,7 @@ dasd_find_busid(char *bus_id)
452 * Check if busid has been added to the list of dasd ranges. 452 * Check if busid has been added to the list of dasd ranges.
453 */ 453 */
454int 454int
455dasd_busid_known(char *bus_id) 455dasd_busid_known(const char *bus_id)
456{ 456{
457 return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0; 457 return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0;
458} 458}
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 6c624bf44617..fb2f931cf844 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -598,7 +598,7 @@ struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *);
598struct dasd_device *dasd_device_from_devindex(int); 598struct dasd_device *dasd_device_from_devindex(int);
599 599
600int dasd_parse(void); 600int dasd_parse(void);
601int dasd_busid_known(char *); 601int dasd_busid_known(const char *);
602 602
603/* externals in dasd_gendisk.c */ 603/* externals in dasd_gendisk.c */
604int dasd_gendisk_init(void); 604int dasd_gendisk_init(void);
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 0d98f1ff2edd..848ef7e8523f 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -549,7 +549,6 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view,
549 struct raw3270_request *rq) 549 struct raw3270_request *rq)
550{ 550{
551 unsigned long flags; 551 unsigned long flags;
552 wait_queue_head_t wq;
553 int rc; 552 int rc;
554 553
555#ifdef CONFIG_TN3270_CONSOLE 554#ifdef CONFIG_TN3270_CONSOLE
@@ -566,20 +565,20 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view,
566 return rq->rc; 565 return rq->rc;
567 } 566 }
568#endif 567#endif
569 init_waitqueue_head(&wq);
570 rq->callback = raw3270_wake_init; 568 rq->callback = raw3270_wake_init;
571 rq->callback_data = &wq; 569 rq->callback_data = &raw3270_wait_queue;
572 spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); 570 spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags);
573 rc = __raw3270_start(rp, view, rq); 571 rc = __raw3270_start(rp, view, rq);
574 spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags); 572 spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags);
575 if (rc) 573 if (rc)
576 return rc; 574 return rc;
577 /* Now wait for the completion. */ 575 /* Now wait for the completion. */
578 rc = wait_event_interruptible(wq, raw3270_request_final(rq)); 576 rc = wait_event_interruptible(raw3270_wait_queue,
577 raw3270_request_final(rq));
579 if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */ 578 if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */
580 raw3270_halt_io(view->dev, rq); 579 raw3270_halt_io(view->dev, rq);
581 /* No wait for the halt to complete. */ 580 /* No wait for the halt to complete. */
582 wait_event(wq, raw3270_request_final(rq)); 581 wait_event(raw3270_wait_queue, raw3270_request_final(rq));
583 return -ERESTARTSYS; 582 return -ERESTARTSYS;
584 } 583 }
585 return rq->rc; 584 return rq->rc;
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index 9e784d5f7f57..ad05a87bc480 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -40,7 +40,7 @@ static void sclp_cpu_capability_notify(struct work_struct *work)
40 put_online_cpus(); 40 put_online_cpus();
41} 41}
42 42
43static void sclp_cpu_change_notify(struct work_struct *work) 43static void __ref sclp_cpu_change_notify(struct work_struct *work)
44{ 44{
45 smp_rescan_cpus(); 45 smp_rescan_cpus();
46} 46}
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 35707c04e613..3e577f655b18 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -71,9 +71,6 @@ static struct list_head sclp_vt220_outqueue;
71/* Number of requests in outqueue */ 71/* Number of requests in outqueue */
72static int sclp_vt220_outqueue_count; 72static int sclp_vt220_outqueue_count;
73 73
74/* Wait queue used to delay write requests while we've run out of buffers */
75static wait_queue_head_t sclp_vt220_waitq;
76
77/* Timer used for delaying write requests to merge subsequent messages into 74/* Timer used for delaying write requests to merge subsequent messages into
78 * a single buffer */ 75 * a single buffer */
79static struct timer_list sclp_vt220_timer; 76static struct timer_list sclp_vt220_timer;
@@ -133,7 +130,6 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request)
133 } while (request && __sclp_vt220_emit(request)); 130 } while (request && __sclp_vt220_emit(request));
134 if (request == NULL && sclp_vt220_flush_later) 131 if (request == NULL && sclp_vt220_flush_later)
135 sclp_vt220_emit_current(); 132 sclp_vt220_emit_current();
136 wake_up(&sclp_vt220_waitq);
137 /* Check if the tty needs a wake up call */ 133 /* Check if the tty needs a wake up call */
138 if (sclp_vt220_tty != NULL) { 134 if (sclp_vt220_tty != NULL) {
139 tty_wakeup(sclp_vt220_tty); 135 tty_wakeup(sclp_vt220_tty);
@@ -383,7 +379,7 @@ sclp_vt220_timeout(unsigned long data)
383 */ 379 */
384static int 380static int
385__sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, 381__sclp_vt220_write(const unsigned char *buf, int count, int do_schedule,
386 int convertlf, int may_schedule) 382 int convertlf, int may_fail)
387{ 383{
388 unsigned long flags; 384 unsigned long flags;
389 void *page; 385 void *page;
@@ -395,15 +391,14 @@ __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule,
395 overall_written = 0; 391 overall_written = 0;
396 spin_lock_irqsave(&sclp_vt220_lock, flags); 392 spin_lock_irqsave(&sclp_vt220_lock, flags);
397 do { 393 do {
398 /* Create a sclp output buffer if none exists yet */ 394 /* Create an sclp output buffer if none exists yet */
399 if (sclp_vt220_current_request == NULL) { 395 if (sclp_vt220_current_request == NULL) {
400 while (list_empty(&sclp_vt220_empty)) { 396 while (list_empty(&sclp_vt220_empty)) {
401 spin_unlock_irqrestore(&sclp_vt220_lock, flags); 397 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
402 if (in_interrupt() || !may_schedule) 398 if (may_fail)
403 sclp_sync_wait(); 399 goto out;
404 else 400 else
405 wait_event(sclp_vt220_waitq, 401 sclp_sync_wait();
406 !list_empty(&sclp_vt220_empty));
407 spin_lock_irqsave(&sclp_vt220_lock, flags); 402 spin_lock_irqsave(&sclp_vt220_lock, flags);
408 } 403 }
409 page = (void *) sclp_vt220_empty.next; 404 page = (void *) sclp_vt220_empty.next;
@@ -437,6 +432,7 @@ __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule,
437 add_timer(&sclp_vt220_timer); 432 add_timer(&sclp_vt220_timer);
438 } 433 }
439 spin_unlock_irqrestore(&sclp_vt220_lock, flags); 434 spin_unlock_irqrestore(&sclp_vt220_lock, flags);
435out:
440 return overall_written; 436 return overall_written;
441} 437}
442 438
@@ -520,19 +516,11 @@ sclp_vt220_close(struct tty_struct *tty, struct file *filp)
520 * character to the tty device. If the kernel uses this routine, 516 * character to the tty device. If the kernel uses this routine,
521 * it must call the flush_chars() routine (if defined) when it is 517 * it must call the flush_chars() routine (if defined) when it is
522 * done stuffing characters into the driver. 518 * done stuffing characters into the driver.
523 *
524 * NOTE: include/linux/tty_driver.h specifies that a character should be
525 * ignored if there is no room in the queue. This driver implements a different
526 * semantic in that it will block when there is no more room left.
527 *
528 * FIXME: putchar can currently be called from BH and other non blocking
529 * handlers so this semantic isn't a good idea.
530 */ 519 */
531static int 520static int
532sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch) 521sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch)
533{ 522{
534 __sclp_vt220_write(&ch, 1, 0, 0, 1); 523 return __sclp_vt220_write(&ch, 1, 0, 0, 1);
535 return 1;
536} 524}
537 525
538/* 526/*
@@ -653,7 +641,6 @@ static int __init __sclp_vt220_init(void)
653 spin_lock_init(&sclp_vt220_lock); 641 spin_lock_init(&sclp_vt220_lock);
654 INIT_LIST_HEAD(&sclp_vt220_empty); 642 INIT_LIST_HEAD(&sclp_vt220_empty);
655 INIT_LIST_HEAD(&sclp_vt220_outqueue); 643 INIT_LIST_HEAD(&sclp_vt220_outqueue);
656 init_waitqueue_head(&sclp_vt220_waitq);
657 init_timer(&sclp_vt220_timer); 644 init_timer(&sclp_vt220_timer);
658 sclp_vt220_current_request = NULL; 645 sclp_vt220_current_request = NULL;
659 sclp_vt220_buffered_chars = 0; 646 sclp_vt220_buffered_chars = 0;
@@ -786,6 +773,7 @@ sclp_vt220_con_init(void)
786{ 773{
787 int rc; 774 int rc;
788 775
776 INIT_LIST_HEAD(&sclp_vt220_register.list);
789 if (!CONSOLE_IS_SCLP) 777 if (!CONSOLE_IS_SCLP)
790 return 0; 778 return 0;
791 rc = __sclp_vt220_init(); 779 rc = __sclp_vt220_init();
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index dddf8d62c153..d0d565a05dfe 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -231,6 +231,9 @@ struct tape_device {
231 /* Request queue. */ 231 /* Request queue. */
232 struct list_head req_queue; 232 struct list_head req_queue;
233 233
234 /* Request wait queue. */
235 wait_queue_head_t wait_queue;
236
234 /* Each tape device has (currently) two minor numbers. */ 237 /* Each tape device has (currently) two minor numbers. */
235 int first_minor; 238 int first_minor;
236 239
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 8246ef3ab095..42ce7915fc5d 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -1598,7 +1598,7 @@ tape_3590_setup_device(struct tape_device *device)
1598 rc = tape_3590_read_dev_chars(device, rdc_data); 1598 rc = tape_3590_read_dev_chars(device, rdc_data);
1599 if (rc) { 1599 if (rc) {
1600 DBF_LH(3, "Read device characteristics failed!\n"); 1600 DBF_LH(3, "Read device characteristics failed!\n");
1601 goto fail_kmalloc; 1601 goto fail_rdc_data;
1602 } 1602 }
1603 rc = tape_std_assign(device); 1603 rc = tape_std_assign(device);
1604 if (rc) 1604 if (rc)
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index ddc4a114e7f4..95da72bc17e8 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -179,11 +179,11 @@ tapeblock_requeue(struct work_struct *work) {
179 tapeblock_end_request(req, -EIO); 179 tapeblock_end_request(req, -EIO);
180 continue; 180 continue;
181 } 181 }
182 blkdev_dequeue_request(req);
183 nr_queued++;
182 spin_unlock_irq(&device->blk_data.request_queue_lock); 184 spin_unlock_irq(&device->blk_data.request_queue_lock);
183 rc = tapeblock_start_request(device, req); 185 rc = tapeblock_start_request(device, req);
184 spin_lock_irq(&device->blk_data.request_queue_lock); 186 spin_lock_irq(&device->blk_data.request_queue_lock);
185 blkdev_dequeue_request(req);
186 nr_queued++;
187 } 187 }
188 spin_unlock_irq(&device->blk_data.request_queue_lock); 188 spin_unlock_irq(&device->blk_data.request_queue_lock);
189 atomic_set(&device->blk_data.requeue_scheduled, 0); 189 atomic_set(&device->blk_data.requeue_scheduled, 0);
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 7ad8cf157641..c20e3c548343 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -76,32 +76,9 @@ const char *tape_op_verbose[TO_SIZE] =
76 [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", 76 [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
77}; 77};
78 78
79static int 79static int devid_to_int(struct ccw_dev_id *dev_id)
80busid_to_int(char *bus_id)
81{ 80{
82 int dec; 81 return dev_id->devno + (dev_id->ssid << 16);
83 int d;
84 char * s;
85
86 for(s = bus_id, d = 0; *s != '\0' && *s != '.'; s++)
87 d = (d * 10) + (*s - '0');
88 dec = d;
89 for(s++, d = 0; *s != '\0' && *s != '.'; s++)
90 d = (d * 10) + (*s - '0');
91 dec = (dec << 8) + d;
92
93 for(s++; *s != '\0'; s++) {
94 if (*s >= '0' && *s <= '9') {
95 d = *s - '0';
96 } else if (*s >= 'a' && *s <= 'f') {
97 d = *s - 'a' + 10;
98 } else {
99 d = *s - 'A' + 10;
100 }
101 dec = (dec << 4) + d;
102 }
103
104 return dec;
105} 82}
106 83
107/* 84/*
@@ -472,6 +449,7 @@ tape_alloc_device(void)
472 INIT_LIST_HEAD(&device->req_queue); 449 INIT_LIST_HEAD(&device->req_queue);
473 INIT_LIST_HEAD(&device->node); 450 INIT_LIST_HEAD(&device->node);
474 init_waitqueue_head(&device->state_change_wq); 451 init_waitqueue_head(&device->state_change_wq);
452 init_waitqueue_head(&device->wait_queue);
475 device->tape_state = TS_INIT; 453 device->tape_state = TS_INIT;
476 device->medium_state = MS_UNKNOWN; 454 device->medium_state = MS_UNKNOWN;
477 *device->modeset_byte = 0; 455 *device->modeset_byte = 0;
@@ -551,6 +529,7 @@ tape_generic_probe(struct ccw_device *cdev)
551{ 529{
552 struct tape_device *device; 530 struct tape_device *device;
553 int ret; 531 int ret;
532 struct ccw_dev_id dev_id;
554 533
555 device = tape_alloc_device(); 534 device = tape_alloc_device();
556 if (IS_ERR(device)) 535 if (IS_ERR(device))
@@ -565,7 +544,8 @@ tape_generic_probe(struct ccw_device *cdev)
565 cdev->dev.driver_data = device; 544 cdev->dev.driver_data = device;
566 cdev->handler = __tape_do_irq; 545 cdev->handler = __tape_do_irq;
567 device->cdev = cdev; 546 device->cdev = cdev;
568 device->cdev_id = busid_to_int(cdev->dev.bus_id); 547 ccw_device_get_id(cdev, &dev_id);
548 device->cdev_id = devid_to_int(&dev_id);
569 PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); 549 PRINT_INFO("tape device %s found\n", cdev->dev.bus_id);
570 return ret; 550 return ret;
571} 551}
@@ -975,21 +955,19 @@ __tape_wake_up(struct tape_request *request, void *data)
975int 955int
976tape_do_io(struct tape_device *device, struct tape_request *request) 956tape_do_io(struct tape_device *device, struct tape_request *request)
977{ 957{
978 wait_queue_head_t wq;
979 int rc; 958 int rc;
980 959
981 init_waitqueue_head(&wq);
982 spin_lock_irq(get_ccwdev_lock(device->cdev)); 960 spin_lock_irq(get_ccwdev_lock(device->cdev));
983 /* Setup callback */ 961 /* Setup callback */
984 request->callback = __tape_wake_up; 962 request->callback = __tape_wake_up;
985 request->callback_data = &wq; 963 request->callback_data = &device->wait_queue;
986 /* Add request to request queue and try to start it. */ 964 /* Add request to request queue and try to start it. */
987 rc = __tape_start_request(device, request); 965 rc = __tape_start_request(device, request);
988 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 966 spin_unlock_irq(get_ccwdev_lock(device->cdev));
989 if (rc) 967 if (rc)
990 return rc; 968 return rc;
991 /* Request added to the queue. Wait for its completion. */ 969 /* Request added to the queue. Wait for its completion. */
992 wait_event(wq, (request->callback == NULL)); 970 wait_event(device->wait_queue, (request->callback == NULL));
993 /* Get rc from request */ 971 /* Get rc from request */
994 return request->rc; 972 return request->rc;
995} 973}
@@ -1010,20 +988,19 @@ int
1010tape_do_io_interruptible(struct tape_device *device, 988tape_do_io_interruptible(struct tape_device *device,
1011 struct tape_request *request) 989 struct tape_request *request)
1012{ 990{
1013 wait_queue_head_t wq;
1014 int rc; 991 int rc;
1015 992
1016 init_waitqueue_head(&wq);
1017 spin_lock_irq(get_ccwdev_lock(device->cdev)); 993 spin_lock_irq(get_ccwdev_lock(device->cdev));
1018 /* Setup callback */ 994 /* Setup callback */
1019 request->callback = __tape_wake_up_interruptible; 995 request->callback = __tape_wake_up_interruptible;
1020 request->callback_data = &wq; 996 request->callback_data = &device->wait_queue;
1021 rc = __tape_start_request(device, request); 997 rc = __tape_start_request(device, request);
1022 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 998 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1023 if (rc) 999 if (rc)
1024 return rc; 1000 return rc;
1025 /* Request added to the queue. Wait for its completion. */ 1001 /* Request added to the queue. Wait for its completion. */
1026 rc = wait_event_interruptible(wq, (request->callback == NULL)); 1002 rc = wait_event_interruptible(device->wait_queue,
1003 (request->callback == NULL));
1027 if (rc != -ERESTARTSYS) 1004 if (rc != -ERESTARTSYS)
1028 /* Request finished normally. */ 1005 /* Request finished normally. */
1029 return request->rc; 1006 return request->rc;
@@ -1036,7 +1013,7 @@ tape_do_io_interruptible(struct tape_device *device,
1036 /* Wait for the interrupt that acknowledges the halt. */ 1013 /* Wait for the interrupt that acknowledges the halt. */
1037 do { 1014 do {
1038 rc = wait_event_interruptible( 1015 rc = wait_event_interruptible(
1039 wq, 1016 device->wait_queue,
1040 (request->callback == NULL) 1017 (request->callback == NULL)
1041 ); 1018 );
1042 } while (rc == -ERESTARTSYS); 1019 } while (rc == -ERESTARTSYS);
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index d364e0bfae12..2c2428cc05d8 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -762,10 +762,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
762 device_unregister(dev); 762 device_unregister(dev);
763 return ret; 763 return ret;
764 } 764 }
765 priv->class_device = device_create(vmlogrdr_class, dev, 765 priv->class_device = device_create_drvdata(vmlogrdr_class, dev,
766 MKDEV(vmlogrdr_major, 766 MKDEV(vmlogrdr_major,
767 priv->minor_num), 767 priv->minor_num),
768 "%s", dev->bus_id); 768 priv, "%s", dev->bus_id);
769 if (IS_ERR(priv->class_device)) { 769 if (IS_ERR(priv->class_device)) {
770 ret = PTR_ERR(priv->class_device); 770 ret = PTR_ERR(priv->class_device);
771 priv->class_device=NULL; 771 priv->class_device=NULL;
@@ -773,7 +773,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
773 device_unregister(dev); 773 device_unregister(dev);
774 return ret; 774 return ret;
775 } 775 }
776 dev->driver_data = priv;
777 priv->device = dev; 776 priv->device = dev;
778 return 0; 777 return 0;
779} 778}
@@ -858,7 +857,7 @@ static int __init vmlogrdr_init(void)
858 for (i=0; i < MAXMINOR; ++i ) { 857 for (i=0; i < MAXMINOR; ++i ) {
859 sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL); 858 sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL);
860 if (!sys_ser[i].buffer) { 859 if (!sys_ser[i].buffer) {
861 rc = ENOMEM; 860 rc = -ENOMEM;
862 break; 861 break;
863 } 862 }
864 sys_ser[i].current_position = sys_ser[i].buffer; 863 sys_ser[i].current_position = sys_ser[i].buffer;
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index 9c21b8f43f9b..0bfcbbe375c4 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -19,7 +19,6 @@
19 19
20#include <asm/cio.h> 20#include <asm/cio.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/cio.h>
23 22
24#include "blacklist.h" 23#include "blacklist.h"
25#include "cio.h" 24#include "cio.h"
@@ -98,8 +97,8 @@ static int pure_hex(char **cp, unsigned int *val, int min_digit,
98 return 0; 97 return 0;
99} 98}
100 99
101static int parse_busid(char *str, int *cssid, int *ssid, int *devno, 100static int parse_busid(char *str, unsigned int *cssid, unsigned int *ssid,
102 int msgtrigger) 101 unsigned int *devno, int msgtrigger)
103{ 102{
104 char *str_work; 103 char *str_work;
105 int val, rc, ret; 104 int val, rc, ret;
@@ -149,7 +148,7 @@ out:
149static int blacklist_parse_parameters(char *str, range_action action, 148static int blacklist_parse_parameters(char *str, range_action action,
150 int msgtrigger) 149 int msgtrigger)
151{ 150{
152 int from_cssid, to_cssid, from_ssid, to_ssid, from, to; 151 unsigned int from_cssid, to_cssid, from_ssid, to_ssid, from, to;
153 int rc, totalrc; 152 int rc, totalrc;
154 char *parm; 153 char *parm;
155 range_action ra; 154 range_action ra;
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 82c6a2d45128..b32d7eb3d81a 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -576,12 +576,14 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
576 err = -ENODEV; 576 err = -ENODEV;
577 goto out; 577 goto out;
578 } 578 }
579 if (cio_is_console(sch->schid)) 579 if (cio_is_console(sch->schid)) {
580 sch->opm = 0xff; 580 sch->opm = 0xff;
581 else 581 sch->isc = 1;
582 } else {
582 sch->opm = chp_get_sch_opm(sch); 583 sch->opm = chp_get_sch_opm(sch);
584 sch->isc = 3;
585 }
583 sch->lpm = sch->schib.pmcw.pam & sch->opm; 586 sch->lpm = sch->schib.pmcw.pam & sch->opm;
584 sch->isc = 3;
585 587
586 CIO_MSG_EVENT(6, "Detected device %04x on subchannel 0.%x.%04X " 588 CIO_MSG_EVENT(6, "Detected device %04x on subchannel 0.%x.%04X "
587 "- PIM = %02X, PAM = %02X, POM = %02X\n", 589 "- PIM = %02X, PAM = %02X, POM = %02X\n",
@@ -704,9 +706,9 @@ void wait_cons_dev(void)
704 if (!console_subchannel_in_use) 706 if (!console_subchannel_in_use)
705 return; 707 return;
706 708
707 /* disable all but isc 7 (console device) */ 709 /* disable all but isc 1 (console device) */
708 __ctl_store (save_cr6, 6, 6); 710 __ctl_store (save_cr6, 6, 6);
709 cr6 = 0x01000000; 711 cr6 = 0x40000000;
710 __ctl_load (cr6, 6, 6); 712 __ctl_load (cr6, 6, 6);
711 713
712 do { 714 do {
@@ -788,11 +790,11 @@ cio_probe_console(void)
788 } 790 }
789 791
790 /* 792 /*
791 * enable console I/O-interrupt subclass 7 793 * enable console I/O-interrupt subclass 1
792 */ 794 */
793 ctl_set_bit(6, 24); 795 ctl_set_bit(6, 30);
794 console_subchannel.isc = 7; 796 console_subchannel.isc = 1;
795 console_subchannel.schib.pmcw.isc = 7; 797 console_subchannel.schib.pmcw.isc = 1;
796 console_subchannel.schib.pmcw.intparm = 798 console_subchannel.schib.pmcw.intparm =
797 (u32)(addr_t)&console_subchannel; 799 (u32)(addr_t)&console_subchannel;
798 ret = cio_modify(&console_subchannel); 800 ret = cio_modify(&console_subchannel);
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index ba559053402e..5cf7be008e98 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -243,16 +243,10 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func)
243 /* Setup sense path group id channel program. */ 243 /* Setup sense path group id channel program. */
244 cdev->private->pgid[0].inf.fc = func; 244 cdev->private->pgid[0].inf.fc = func;
245 ccw = cdev->private->iccws; 245 ccw = cdev->private->iccws;
246 if (!cdev->private->flags.pgid_single) { 246 if (cdev->private->flags.pgid_single)
247 cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH;
248 ccw->cmd_code = CCW_CMD_SUSPEND_RECONN;
249 ccw->cda = 0;
250 ccw->count = 0;
251 ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC;
252 ccw++;
253 } else
254 cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH; 247 cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH;
255 248 else
249 cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH;
256 ccw->cmd_code = CCW_CMD_SET_PGID; 250 ccw->cmd_code = CCW_CMD_SET_PGID;
257 ccw->cda = (__u32) __pa (&cdev->private->pgid[0]); 251 ccw->cda = (__u32) __pa (&cdev->private->pgid[0]);
258 ccw->count = sizeof (struct pgid); 252 ccw->count = sizeof (struct pgid);
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 47a7e6200b26..5ab34340919b 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -31,11 +31,6 @@
31 */ 31 */
32static void *kvm_devices; 32static void *kvm_devices;
33 33
34/*
35 * Unique numbering for kvm devices.
36 */
37static unsigned int dev_index;
38
39struct kvm_device { 34struct kvm_device {
40 struct virtio_device vdev; 35 struct virtio_device vdev;
41 struct kvm_device_desc *desc; 36 struct kvm_device_desc *desc;
@@ -78,27 +73,32 @@ static unsigned desc_size(const struct kvm_device_desc *desc)
78 + desc->config_len; 73 + desc->config_len;
79} 74}
80 75
81/* 76/* This gets the device's feature bits. */
82 * This tests (and acknowleges) a feature bit. 77static u32 kvm_get_features(struct virtio_device *vdev)
83 */
84static bool kvm_feature(struct virtio_device *vdev, unsigned fbit)
85{ 78{
79 unsigned int i;
80 u32 features = 0;
86 struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; 81 struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
87 u8 *features; 82 u8 *in_features = kvm_vq_features(desc);
88 83
89 if (fbit / 8 > desc->feature_len) 84 for (i = 0; i < min(desc->feature_len * 8, 32); i++)
90 return false; 85 if (in_features[i / 8] & (1 << (i % 8)))
86 features |= (1 << i);
87 return features;
88}
91 89
92 features = kvm_vq_features(desc); 90static void kvm_set_features(struct virtio_device *vdev, u32 features)
93 if (!(features[fbit / 8] & (1 << (fbit % 8)))) 91{
94 return false; 92 unsigned int i;
93 struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
94 /* Second half of bitmap is features we accept. */
95 u8 *out_features = kvm_vq_features(desc) + desc->feature_len;
95 96
96 /* 97 memset(out_features, 0, desc->feature_len);
97 * We set the matching bit in the other half of the bitmap to tell the 98 for (i = 0; i < min(desc->feature_len * 8, 32); i++) {
98 * Host we want to use this feature. 99 if (features & (1 << i))
99 */ 100 out_features[i / 8] |= (1 << (i % 8));
100 features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8)); 101 }
101 return true;
102} 102}
103 103
104/* 104/*
@@ -221,7 +221,8 @@ static void kvm_del_vq(struct virtqueue *vq)
221 * The config ops structure as defined by virtio config 221 * The config ops structure as defined by virtio config
222 */ 222 */
223static struct virtio_config_ops kvm_vq_configspace_ops = { 223static struct virtio_config_ops kvm_vq_configspace_ops = {
224 .feature = kvm_feature, 224 .get_features = kvm_get_features,
225 .set_features = kvm_set_features,
225 .get = kvm_get, 226 .get = kvm_get,
226 .set = kvm_set, 227 .set = kvm_set,
227 .get_status = kvm_get_status, 228 .get_status = kvm_get_status,
@@ -244,26 +245,25 @@ static struct device kvm_root = {
244 * adds a new device and register it with virtio 245 * adds a new device and register it with virtio
245 * appropriate drivers are loaded by the device model 246 * appropriate drivers are loaded by the device model
246 */ 247 */
247static void add_kvm_device(struct kvm_device_desc *d) 248static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset)
248{ 249{
249 struct kvm_device *kdev; 250 struct kvm_device *kdev;
250 251
251 kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); 252 kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
252 if (!kdev) { 253 if (!kdev) {
253 printk(KERN_EMERG "Cannot allocate kvm dev %u\n", 254 printk(KERN_EMERG "Cannot allocate kvm dev %u type %u\n",
254 dev_index++); 255 offset, d->type);
255 return; 256 return;
256 } 257 }
257 258
258 kdev->vdev.dev.parent = &kvm_root; 259 kdev->vdev.dev.parent = &kvm_root;
259 kdev->vdev.index = dev_index++;
260 kdev->vdev.id.device = d->type; 260 kdev->vdev.id.device = d->type;
261 kdev->vdev.config = &kvm_vq_configspace_ops; 261 kdev->vdev.config = &kvm_vq_configspace_ops;
262 kdev->desc = d; 262 kdev->desc = d;
263 263
264 if (register_virtio_device(&kdev->vdev) != 0) { 264 if (register_virtio_device(&kdev->vdev) != 0) {
265 printk(KERN_ERR "Failed to register kvm device %u\n", 265 printk(KERN_ERR "Failed to register kvm device %u type %u\n",
266 kdev->vdev.index); 266 offset, d->type);
267 kfree(kdev); 267 kfree(kdev);
268 } 268 }
269} 269}
@@ -283,7 +283,7 @@ static void scan_devices(void)
283 if (d->type == 0) 283 if (d->type == 0)
284 break; 284 break;
285 285
286 add_kvm_device(d); 286 add_kvm_device(d, i);
287 } 287 }
288} 288}
289 289
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 436bf1f6d4a6..9a71dae223e8 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -290,9 +290,6 @@ int qeth_set_large_send(struct qeth_card *card,
290 card->dev->features |= NETIF_F_TSO | NETIF_F_SG | 290 card->dev->features |= NETIF_F_TSO | NETIF_F_SG |
291 NETIF_F_HW_CSUM; 291 NETIF_F_HW_CSUM;
292 } else { 292 } else {
293 PRINT_WARN("TSO not supported on %s. "
294 "large_send set to 'no'.\n",
295 card->dev->name);
296 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG | 293 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG |
297 NETIF_F_HW_CSUM); 294 NETIF_F_HW_CSUM);
298 card->options.large_send = QETH_LARGE_SEND_NO; 295 card->options.large_send = QETH_LARGE_SEND_NO;
@@ -1407,12 +1404,6 @@ static void qeth_init_func_level(struct qeth_card *card)
1407 } 1404 }
1408} 1405}
1409 1406
1410static inline __u16 qeth_raw_devno_from_bus_id(char *id)
1411{
1412 id += (strlen(id) - 4);
1413 return (__u16) simple_strtoul(id, &id, 16);
1414}
1415
1416static int qeth_idx_activate_get_answer(struct qeth_channel *channel, 1407static int qeth_idx_activate_get_answer(struct qeth_channel *channel,
1417 void (*idx_reply_cb)(struct qeth_channel *, 1408 void (*idx_reply_cb)(struct qeth_channel *,
1418 struct qeth_cmd_buffer *)) 1409 struct qeth_cmd_buffer *))
@@ -1439,7 +1430,7 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel,
1439 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); 1430 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
1440 1431
1441 if (rc) { 1432 if (rc) {
1442 PRINT_ERR("Error2 in activating channel rc=%d\n", rc); 1433 QETH_DBF_MESSAGE(2, "Error2 in activating channel rc=%d\n", rc);
1443 QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); 1434 QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc);
1444 atomic_set(&channel->irq_pending, 0); 1435 atomic_set(&channel->irq_pending, 0);
1445 wake_up(&card->wait_q); 1436 wake_up(&card->wait_q);
@@ -1468,6 +1459,7 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel,
1468 __u16 temp; 1459 __u16 temp;
1469 __u8 tmp; 1460 __u8 tmp;
1470 int rc; 1461 int rc;
1462 struct ccw_dev_id temp_devid;
1471 1463
1472 card = CARD_FROM_CDEV(channel->ccwdev); 1464 card = CARD_FROM_CDEV(channel->ccwdev);
1473 1465
@@ -1494,8 +1486,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel,
1494 &card->token.issuer_rm_w, QETH_MPC_TOKEN_LENGTH); 1486 &card->token.issuer_rm_w, QETH_MPC_TOKEN_LENGTH);
1495 memcpy(QETH_IDX_ACT_FUNC_LEVEL(iob->data), 1487 memcpy(QETH_IDX_ACT_FUNC_LEVEL(iob->data),
1496 &card->info.func_level, sizeof(__u16)); 1488 &card->info.func_level, sizeof(__u16));
1497 temp = qeth_raw_devno_from_bus_id(CARD_DDEV_ID(card)); 1489 ccw_device_get_id(CARD_DDEV(card), &temp_devid);
1498 memcpy(QETH_IDX_ACT_QDIO_DEV_CUA(iob->data), &temp, 2); 1490 memcpy(QETH_IDX_ACT_QDIO_DEV_CUA(iob->data), &temp_devid.devno, 2);
1499 temp = (card->info.cula << 8) + card->info.unit_addr2; 1491 temp = (card->info.cula << 8) + card->info.unit_addr2;
1500 memcpy(QETH_IDX_ACT_QDIO_DEV_REALADDR(iob->data), &temp, 2); 1492 memcpy(QETH_IDX_ACT_QDIO_DEV_REALADDR(iob->data), &temp, 2);
1501 1493
@@ -1508,7 +1500,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel,
1508 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); 1500 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
1509 1501
1510 if (rc) { 1502 if (rc) {
1511 PRINT_ERR("Error1 in activating channel. rc=%d\n", rc); 1503 QETH_DBF_MESSAGE(2, "Error1 in activating channel. rc=%d\n",
1504 rc);
1512 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); 1505 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
1513 atomic_set(&channel->irq_pending, 0); 1506 atomic_set(&channel->irq_pending, 0);
1514 wake_up(&card->wait_q); 1507 wake_up(&card->wait_q);
@@ -1658,7 +1651,6 @@ int qeth_send_control_data(struct qeth_card *card, int len,
1658 1651
1659 reply = qeth_alloc_reply(card); 1652 reply = qeth_alloc_reply(card);
1660 if (!reply) { 1653 if (!reply) {
1661 PRINT_WARN("Could not alloc qeth_reply!\n");
1662 return -ENOMEM; 1654 return -ENOMEM;
1663 } 1655 }
1664 reply->callback = reply_cb; 1656 reply->callback = reply_cb;
@@ -2612,15 +2604,9 @@ void qeth_queue_input_buffer(struct qeth_card *card, int index)
2612 if (newcount < count) { 2604 if (newcount < count) {
2613 /* we are in memory shortage so we switch back to 2605 /* we are in memory shortage so we switch back to
2614 traditional skb allocation and drop packages */ 2606 traditional skb allocation and drop packages */
2615 if (!atomic_read(&card->force_alloc_skb) &&
2616 net_ratelimit())
2617 PRINT_WARN("Switch to alloc skb\n");
2618 atomic_set(&card->force_alloc_skb, 3); 2607 atomic_set(&card->force_alloc_skb, 3);
2619 count = newcount; 2608 count = newcount;
2620 } else { 2609 } else {
2621 if ((atomic_read(&card->force_alloc_skb) == 1) &&
2622 net_ratelimit())
2623 PRINT_WARN("Switch to sg\n");
2624 atomic_add_unless(&card->force_alloc_skb, -1, 0); 2610 atomic_add_unless(&card->force_alloc_skb, -1, 0);
2625 } 2611 }
2626 2612
@@ -3034,7 +3020,7 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr,
3034 elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE) 3020 elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE)
3035 + skb->len) >> PAGE_SHIFT); 3021 + skb->len) >> PAGE_SHIFT);
3036 if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { 3022 if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) {
3037 PRINT_ERR("Invalid size of IP packet " 3023 QETH_DBF_MESSAGE(2, "Invalid size of IP packet "
3038 "(Number=%d / Length=%d). Discarded.\n", 3024 "(Number=%d / Length=%d). Discarded.\n",
3039 (elements_needed+elems), skb->len); 3025 (elements_needed+elems), skb->len);
3040 return 0; 3026 return 0;
@@ -3247,8 +3233,6 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
3247 * free buffers) to handle eddp context */ 3233 * free buffers) to handle eddp context */
3248 if (qeth_eddp_check_buffers_for_context(queue, ctx) 3234 if (qeth_eddp_check_buffers_for_context(queue, ctx)
3249 < 0) { 3235 < 0) {
3250 if (net_ratelimit())
3251 PRINT_WARN("eddp tx_dropped 1\n");
3252 rc = -EBUSY; 3236 rc = -EBUSY;
3253 goto out; 3237 goto out;
3254 } 3238 }
@@ -3260,7 +3244,6 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
3260 tmp = qeth_eddp_fill_buffer(queue, ctx, 3244 tmp = qeth_eddp_fill_buffer(queue, ctx,
3261 queue->next_buf_to_fill); 3245 queue->next_buf_to_fill);
3262 if (tmp < 0) { 3246 if (tmp < 0) {
3263 PRINT_ERR("eddp tx_dropped 2\n");
3264 rc = -EBUSY; 3247 rc = -EBUSY;
3265 goto out; 3248 goto out;
3266 } 3249 }
@@ -3602,8 +3585,6 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata)
3602 3585
3603 if ((!qeth_adp_supported(card, IPA_SETADP_SET_SNMP_CONTROL)) && 3586 if ((!qeth_adp_supported(card, IPA_SETADP_SET_SNMP_CONTROL)) &&
3604 (!card->options.layer2)) { 3587 (!card->options.layer2)) {
3605 PRINT_WARN("SNMP Query MIBS not supported "
3606 "on %s!\n", QETH_CARD_IFNAME(card));
3607 return -EOPNOTSUPP; 3588 return -EOPNOTSUPP;
3608 } 3589 }
3609 /* skip 4 bytes (data_len struct member) to get req_len */ 3590 /* skip 4 bytes (data_len struct member) to get req_len */
@@ -3634,7 +3615,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata)
3634 rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len, 3615 rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len,
3635 qeth_snmp_command_cb, (void *)&qinfo); 3616 qeth_snmp_command_cb, (void *)&qinfo);
3636 if (rc) 3617 if (rc)
3637 PRINT_WARN("SNMP command failed on %s: (0x%x)\n", 3618 QETH_DBF_MESSAGE(2, "SNMP command failed on %s: (0x%x)\n",
3638 QETH_CARD_IFNAME(card), rc); 3619 QETH_CARD_IFNAME(card), rc);
3639 else { 3620 else {
3640 if (copy_to_user(udata, qinfo.udata, qinfo.udata_len)) 3621 if (copy_to_user(udata, qinfo.udata, qinfo.udata_len))
@@ -3807,8 +3788,8 @@ retry:
3807 if (mpno) 3788 if (mpno)
3808 mpno = min(mpno - 1, QETH_MAX_PORTNO); 3789 mpno = min(mpno - 1, QETH_MAX_PORTNO);
3809 if (card->info.portno > mpno) { 3790 if (card->info.portno > mpno) {
3810 PRINT_ERR("Device %s does not offer port number %d \n.", 3791 QETH_DBF_MESSAGE(2, "Device %s does not offer port number %d"
3811 CARD_BUS_ID(card), card->info.portno); 3792 "\n.", CARD_BUS_ID(card), card->info.portno);
3812 rc = -ENODEV; 3793 rc = -ENODEV;
3813 goto out; 3794 goto out;
3814 } 3795 }
@@ -3985,8 +3966,6 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card,
3985 return skb; 3966 return skb;
3986no_mem: 3967no_mem:
3987 if (net_ratelimit()) { 3968 if (net_ratelimit()) {
3988 PRINT_WARN("No memory for packet received on %s.\n",
3989 QETH_CARD_IFNAME(card));
3990 QETH_DBF_TEXT(TRACE, 2, "noskbmem"); 3969 QETH_DBF_TEXT(TRACE, 2, "noskbmem");
3991 QETH_DBF_TEXT_(TRACE, 2, "%s", CARD_BUS_ID(card)); 3970 QETH_DBF_TEXT_(TRACE, 2, "%s", CARD_BUS_ID(card));
3992 } 3971 }
@@ -4004,15 +3983,17 @@ static void qeth_unregister_dbf_views(void)
4004 } 3983 }
4005} 3984}
4006 3985
4007void qeth_dbf_longtext(enum qeth_dbf_names dbf_nix, int level, char *text, ...) 3986void qeth_dbf_longtext(enum qeth_dbf_names dbf_nix, int level, char *fmt, ...)
4008{ 3987{
4009 char dbf_txt_buf[32]; 3988 char dbf_txt_buf[32];
3989 va_list args;
4010 3990
4011 if (level > (qeth_dbf[dbf_nix].id)->level) 3991 if (level > (qeth_dbf[dbf_nix].id)->level)
4012 return; 3992 return;
4013 snprintf(dbf_txt_buf, sizeof(dbf_txt_buf), text); 3993 va_start(args, fmt);
3994 vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args);
3995 va_end(args);
4014 debug_text_event(qeth_dbf[dbf_nix].id, level, dbf_txt_buf); 3996 debug_text_event(qeth_dbf[dbf_nix].id, level, dbf_txt_buf);
4015
4016} 3997}
4017EXPORT_SYMBOL_GPL(qeth_dbf_longtext); 3998EXPORT_SYMBOL_GPL(qeth_dbf_longtext);
4018 3999
diff --git a/drivers/s390/net/qeth_core_offl.c b/drivers/s390/net/qeth_core_offl.c
index 822df8362856..452874e89740 100644
--- a/drivers/s390/net/qeth_core_offl.c
+++ b/drivers/s390/net/qeth_core_offl.c
@@ -122,8 +122,8 @@ int qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue,
122 if (element == 0) 122 if (element == 0)
123 return -EBUSY; 123 return -EBUSY;
124 else { 124 else {
125 PRINT_WARN("could only partially fill eddp " 125 QETH_DBF_MESSAGE(2, "could only partially fill"
126 "buffer!\n"); 126 "eddp buffer!\n");
127 goto out; 127 goto out;
128 } 128 }
129 } 129 }
@@ -143,8 +143,6 @@ int qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue,
143 if (must_refcnt) { 143 if (must_refcnt) {
144 must_refcnt = 0; 144 must_refcnt = 0;
145 if (qeth_eddp_buf_ref_context(buf, ctx)) { 145 if (qeth_eddp_buf_ref_context(buf, ctx)) {
146 PRINT_WARN("no memory to create eddp context "
147 "reference\n");
148 goto out_check; 146 goto out_check;
149 } 147 }
150 } 148 }
diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 08a50f057284..c26e842ad905 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -129,7 +129,6 @@ static ssize_t qeth_dev_portno_store(struct device *dev,
129 129
130 portno = simple_strtoul(buf, &tmp, 16); 130 portno = simple_strtoul(buf, &tmp, 16);
131 if (portno > QETH_MAX_PORTNO) { 131 if (portno > QETH_MAX_PORTNO) {
132 PRINT_WARN("portno 0x%X is out of range\n", portno);
133 return -EINVAL; 132 return -EINVAL;
134 } 133 }
135 134
@@ -223,8 +222,6 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev,
223 * if though we have to permit priority queueing 222 * if though we have to permit priority queueing
224 */ 223 */
225 if (card->qdio.no_out_queues == 1) { 224 if (card->qdio.no_out_queues == 1) {
226 PRINT_WARN("Priority queueing disabled due "
227 "to hardware limitations!\n");
228 card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT; 225 card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT;
229 return -EPERM; 226 return -EPERM;
230 } 227 }
@@ -250,7 +247,6 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev,
250 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING; 247 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
251 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; 248 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
252 } else { 249 } else {
253 PRINT_WARN("Unknown queueing type '%s'\n", tmp);
254 return -EINVAL; 250 return -EINVAL;
255 } 251 }
256 return count; 252 return count;
@@ -291,9 +287,6 @@ static ssize_t qeth_dev_bufcnt_store(struct device *dev,
291 ((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt); 287 ((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt);
292 if (old_cnt != cnt) { 288 if (old_cnt != cnt) {
293 rc = qeth_realloc_buffer_pool(card, cnt); 289 rc = qeth_realloc_buffer_pool(card, cnt);
294 if (rc)
295 PRINT_WARN("Error (%d) while setting "
296 "buffer count.\n", rc);
297 } 290 }
298 return count; 291 return count;
299} 292}
@@ -355,7 +348,6 @@ static ssize_t qeth_dev_performance_stats_store(struct device *dev,
355 card->perf_stats.initial_rx_packets = card->stats.rx_packets; 348 card->perf_stats.initial_rx_packets = card->stats.rx_packets;
356 card->perf_stats.initial_tx_packets = card->stats.tx_packets; 349 card->perf_stats.initial_tx_packets = card->stats.tx_packets;
357 } else { 350 } else {
358 PRINT_WARN("performance_stats: write 0 or 1 to this file!\n");
359 return -EINVAL; 351 return -EINVAL;
360 } 352 }
361 return count; 353 return count;
@@ -399,7 +391,6 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
399 newdis = QETH_DISCIPLINE_LAYER2; 391 newdis = QETH_DISCIPLINE_LAYER2;
400 break; 392 break;
401 default: 393 default:
402 PRINT_WARN("layer2: write 0 or 1 to this file!\n");
403 return -EINVAL; 394 return -EINVAL;
404 } 395 }
405 396
@@ -463,7 +454,6 @@ static ssize_t qeth_dev_large_send_store(struct device *dev,
463 } else if (!strcmp(tmp, "TSO")) { 454 } else if (!strcmp(tmp, "TSO")) {
464 type = QETH_LARGE_SEND_TSO; 455 type = QETH_LARGE_SEND_TSO;
465 } else { 456 } else {
466 PRINT_WARN("large_send: invalid mode %s!\n", tmp);
467 return -EINVAL; 457 return -EINVAL;
468 } 458 }
469 if (card->options.large_send == type) 459 if (card->options.large_send == type)
@@ -503,8 +493,6 @@ static ssize_t qeth_dev_blkt_store(struct qeth_card *card,
503 if (i <= max_value) { 493 if (i <= max_value) {
504 *value = i; 494 *value = i;
505 } else { 495 } else {
506 PRINT_WARN("blkt total time: write values between"
507 " 0 and %d to this file!\n", max_value);
508 return -EINVAL; 496 return -EINVAL;
509 } 497 }
510 return count; 498 return count;
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 86ec50ddae13..f682f7b14480 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -101,19 +101,16 @@ static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no)
101{ 101{
102 struct qeth_card *card; 102 struct qeth_card *card;
103 struct net_device *ndev; 103 struct net_device *ndev;
104 unsigned char *readno; 104 __u16 temp_dev_no;
105 __u16 temp_dev_no, card_dev_no;
106 char *endp;
107 unsigned long flags; 105 unsigned long flags;
106 struct ccw_dev_id read_devid;
108 107
109 ndev = NULL; 108 ndev = NULL;
110 memcpy(&temp_dev_no, read_dev_no, 2); 109 memcpy(&temp_dev_no, read_dev_no, 2);
111 read_lock_irqsave(&qeth_core_card_list.rwlock, flags); 110 read_lock_irqsave(&qeth_core_card_list.rwlock, flags);
112 list_for_each_entry(card, &qeth_core_card_list.list, list) { 111 list_for_each_entry(card, &qeth_core_card_list.list, list) {
113 readno = CARD_RDEV_ID(card); 112 ccw_device_get_id(CARD_RDEV(card), &read_devid);
114 readno += (strlen(readno) - 4); 113 if (read_devid.devno == temp_dev_no) {
115 card_dev_no = simple_strtoul(readno, &endp, 16);
116 if (card_dev_no == temp_dev_no) {
117 ndev = card->dev; 114 ndev = card->dev;
118 break; 115 break;
119 } 116 }
@@ -134,14 +131,14 @@ static int qeth_l2_send_setgroupmac_cb(struct qeth_card *card,
134 mac = &cmd->data.setdelmac.mac[0]; 131 mac = &cmd->data.setdelmac.mac[0];
135 /* MAC already registered, needed in couple/uncouple case */ 132 /* MAC already registered, needed in couple/uncouple case */
136 if (cmd->hdr.return_code == 0x2005) { 133 if (cmd->hdr.return_code == 0x2005) {
137 PRINT_WARN("Group MAC %02x:%02x:%02x:%02x:%02x:%02x " \ 134 QETH_DBF_MESSAGE(2, "Group MAC %02x:%02x:%02x:%02x:%02x:%02x "
138 "already existing on %s \n", 135 "already existing on %s \n",
139 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], 136 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
140 QETH_CARD_IFNAME(card)); 137 QETH_CARD_IFNAME(card));
141 cmd->hdr.return_code = 0; 138 cmd->hdr.return_code = 0;
142 } 139 }
143 if (cmd->hdr.return_code) 140 if (cmd->hdr.return_code)
144 PRINT_ERR("Could not set group MAC " \ 141 QETH_DBF_MESSAGE(2, "Could not set group MAC "
145 "%02x:%02x:%02x:%02x:%02x:%02x on %s: %x\n", 142 "%02x:%02x:%02x:%02x:%02x:%02x on %s: %x\n",
146 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], 143 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
147 QETH_CARD_IFNAME(card), cmd->hdr.return_code); 144 QETH_CARD_IFNAME(card), cmd->hdr.return_code);
@@ -166,7 +163,7 @@ static int qeth_l2_send_delgroupmac_cb(struct qeth_card *card,
166 cmd = (struct qeth_ipa_cmd *) data; 163 cmd = (struct qeth_ipa_cmd *) data;
167 mac = &cmd->data.setdelmac.mac[0]; 164 mac = &cmd->data.setdelmac.mac[0];
168 if (cmd->hdr.return_code) 165 if (cmd->hdr.return_code)
169 PRINT_ERR("Could not delete group MAC " \ 166 QETH_DBF_MESSAGE(2, "Could not delete group MAC "
170 "%02x:%02x:%02x:%02x:%02x:%02x on %s: %x\n", 167 "%02x:%02x:%02x:%02x:%02x:%02x on %s: %x\n",
171 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], 168 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
172 QETH_CARD_IFNAME(card), cmd->hdr.return_code); 169 QETH_CARD_IFNAME(card), cmd->hdr.return_code);
@@ -186,10 +183,8 @@ static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac)
186 183
187 mc = kmalloc(sizeof(struct qeth_mc_mac), GFP_ATOMIC); 184 mc = kmalloc(sizeof(struct qeth_mc_mac), GFP_ATOMIC);
188 185
189 if (!mc) { 186 if (!mc)
190 PRINT_ERR("no mem vor mc mac address\n");
191 return; 187 return;
192 }
193 188
194 memcpy(mc->mc_addr, mac, OSA_ADDR_LEN); 189 memcpy(mc->mc_addr, mac, OSA_ADDR_LEN);
195 mc->mc_addrlen = OSA_ADDR_LEN; 190 mc->mc_addrlen = OSA_ADDR_LEN;
@@ -280,7 +275,7 @@ static int qeth_l2_send_setdelvlan_cb(struct qeth_card *card,
280 QETH_DBF_TEXT(TRACE, 2, "L2sdvcb"); 275 QETH_DBF_TEXT(TRACE, 2, "L2sdvcb");
281 cmd = (struct qeth_ipa_cmd *) data; 276 cmd = (struct qeth_ipa_cmd *) data;
282 if (cmd->hdr.return_code) { 277 if (cmd->hdr.return_code) {
283 PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " 278 QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on %s: 0x%x. "
284 "Continuing\n", cmd->data.setdelvlan.vlan_id, 279 "Continuing\n", cmd->data.setdelvlan.vlan_id,
285 QETH_CARD_IFNAME(card), cmd->hdr.return_code); 280 QETH_CARD_IFNAME(card), cmd->hdr.return_code);
286 QETH_DBF_TEXT_(TRACE, 2, "L2VL%4x", cmd->hdr.command); 281 QETH_DBF_TEXT_(TRACE, 2, "L2VL%4x", cmd->hdr.command);
@@ -333,8 +328,6 @@ static void qeth_l2_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
333 spin_lock_bh(&card->vlanlock); 328 spin_lock_bh(&card->vlanlock);
334 list_add_tail(&id->list, &card->vid_list); 329 list_add_tail(&id->list, &card->vid_list);
335 spin_unlock_bh(&card->vlanlock); 330 spin_unlock_bh(&card->vlanlock);
336 } else {
337 PRINT_ERR("no memory for vid\n");
338 } 331 }
339} 332}
340 333
@@ -550,16 +543,15 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
550 543
551 rc = qeth_query_setadapterparms(card); 544 rc = qeth_query_setadapterparms(card);
552 if (rc) { 545 if (rc) {
553 PRINT_WARN("could not query adapter parameters on device %s: " 546 QETH_DBF_MESSAGE(2, "could not query adapter parameters on "
554 "x%x\n", CARD_BUS_ID(card), rc); 547 "device %s: x%x\n", CARD_BUS_ID(card), rc);
555 } 548 }
556 549
557 if (card->info.guestlan) { 550 if (card->info.guestlan) {
558 rc = qeth_setadpparms_change_macaddr(card); 551 rc = qeth_setadpparms_change_macaddr(card);
559 if (rc) { 552 if (rc) {
560 PRINT_WARN("couldn't get MAC address on " 553 QETH_DBF_MESSAGE(2, "couldn't get MAC address on "
561 "device %s: x%x\n", 554 "device %s: x%x\n", CARD_BUS_ID(card), rc);
562 CARD_BUS_ID(card), rc);
563 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); 555 QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
564 return rc; 556 return rc;
565 } 557 }
@@ -585,8 +577,6 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
585 } 577 }
586 578
587 if (card->info.type == QETH_CARD_TYPE_OSN) { 579 if (card->info.type == QETH_CARD_TYPE_OSN) {
588 PRINT_WARN("Setting MAC address on %s is not supported.\n",
589 dev->name);
590 QETH_DBF_TEXT(TRACE, 3, "setmcOSN"); 580 QETH_DBF_TEXT(TRACE, 3, "setmcOSN");
591 return -EOPNOTSUPP; 581 return -EOPNOTSUPP;
592 } 582 }
@@ -666,7 +656,7 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
666 ctx = qeth_eddp_create_context(card, new_skb, hdr, 656 ctx = qeth_eddp_create_context(card, new_skb, hdr,
667 skb->sk->sk_protocol); 657 skb->sk->sk_protocol);
668 if (ctx == NULL) { 658 if (ctx == NULL) {
669 PRINT_WARN("could not create eddp context\n"); 659 QETH_DBF_MESSAGE(2, "could not create eddp context\n");
670 goto tx_drop; 660 goto tx_drop;
671 } 661 }
672 } else { 662 } else {
@@ -731,6 +721,7 @@ tx_drop:
731 if ((new_skb != skb) && new_skb) 721 if ((new_skb != skb) && new_skb)
732 dev_kfree_skb_any(new_skb); 722 dev_kfree_skb_any(new_skb);
733 dev_kfree_skb_any(skb); 723 dev_kfree_skb_any(skb);
724 netif_wake_queue(dev);
734 return NETDEV_TX_OK; 725 return NETDEV_TX_OK;
735} 726}
736 727
@@ -1155,7 +1146,7 @@ static int qeth_osn_send_control_data(struct qeth_card *card, int len,
1155 (addr_t) iob, 0, 0); 1146 (addr_t) iob, 0, 0);
1156 spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); 1147 spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags);
1157 if (rc) { 1148 if (rc) {
1158 PRINT_WARN("qeth_osn_send_control_data: " 1149 QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: "
1159 "ccw_device_start rc = %i\n", rc); 1150 "ccw_device_start rc = %i\n", rc);
1160 QETH_DBF_TEXT_(TRACE, 2, " err%d", rc); 1151 QETH_DBF_TEXT_(TRACE, 2, " err%d", rc);
1161 qeth_release_buffer(iob->channel, iob); 1152 qeth_release_buffer(iob->channel, iob);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 94a8ead64ed4..999552c83bbe 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -311,7 +311,6 @@ static struct qeth_ipaddr *qeth_l3_get_addr_buffer(
311 311
312 addr = kzalloc(sizeof(struct qeth_ipaddr), GFP_ATOMIC); 312 addr = kzalloc(sizeof(struct qeth_ipaddr), GFP_ATOMIC);
313 if (addr == NULL) { 313 if (addr == NULL) {
314 PRINT_WARN("Not enough memory to add address\n");
315 return NULL; 314 return NULL;
316 } 315 }
317 addr->type = QETH_IP_TYPE_NORMAL; 316 addr->type = QETH_IP_TYPE_NORMAL;
@@ -649,15 +648,6 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card,
649 } 648 }
650 } 649 }
651out_inval: 650out_inval:
652 PRINT_WARN("Routing type '%s' not supported for interface %s.\n"
653 "Router status set to 'no router'.\n",
654 ((*type == PRIMARY_ROUTER)? "primary router" :
655 (*type == SECONDARY_ROUTER)? "secondary router" :
656 (*type == PRIMARY_CONNECTOR)? "primary connector" :
657 (*type == SECONDARY_CONNECTOR)? "secondary connector" :
658 (*type == MULTICAST_ROUTER)? "multicast router" :
659 "unknown"),
660 card->dev->name);
661 *type = NO_ROUTER; 651 *type = NO_ROUTER;
662} 652}
663 653
@@ -674,9 +664,9 @@ int qeth_l3_setrouting_v4(struct qeth_card *card)
674 QETH_PROT_IPV4); 664 QETH_PROT_IPV4);
675 if (rc) { 665 if (rc) {
676 card->options.route4.type = NO_ROUTER; 666 card->options.route4.type = NO_ROUTER;
677 PRINT_WARN("Error (0x%04x) while setting routing type on %s. " 667 QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type"
678 "Type set to 'no router'.\n", 668 " on %s. Type set to 'no router'.\n", rc,
679 rc, QETH_CARD_IFNAME(card)); 669 QETH_CARD_IFNAME(card));
680 } 670 }
681 return rc; 671 return rc;
682} 672}
@@ -697,9 +687,9 @@ int qeth_l3_setrouting_v6(struct qeth_card *card)
697 QETH_PROT_IPV6); 687 QETH_PROT_IPV6);
698 if (rc) { 688 if (rc) {
699 card->options.route6.type = NO_ROUTER; 689 card->options.route6.type = NO_ROUTER;
700 PRINT_WARN("Error (0x%04x) while setting routing type on %s. " 690 QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type"
701 "Type set to 'no router'.\n", 691 " on %s. Type set to 'no router'.\n", rc,
702 rc, QETH_CARD_IFNAME(card)); 692 QETH_CARD_IFNAME(card));
703 } 693 }
704#endif 694#endif
705 return rc; 695 return rc;
@@ -737,7 +727,6 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card,
737 if (!memcmp(ipatoe->addr, new->addr, 727 if (!memcmp(ipatoe->addr, new->addr,
738 (ipatoe->proto == QETH_PROT_IPV4)? 4:16) && 728 (ipatoe->proto == QETH_PROT_IPV4)? 4:16) &&
739 (ipatoe->mask_bits == new->mask_bits)) { 729 (ipatoe->mask_bits == new->mask_bits)) {
740 PRINT_WARN("ipato entry already exists!\n");
741 rc = -EEXIST; 730 rc = -EEXIST;
742 break; 731 break;
743 } 732 }
@@ -802,7 +791,6 @@ int qeth_l3_add_vipa(struct qeth_card *card, enum qeth_prot_versions proto,
802 rc = -EEXIST; 791 rc = -EEXIST;
803 spin_unlock_irqrestore(&card->ip_lock, flags); 792 spin_unlock_irqrestore(&card->ip_lock, flags);
804 if (rc) { 793 if (rc) {
805 PRINT_WARN("Cannot add VIPA. Address already exists!\n");
806 return rc; 794 return rc;
807 } 795 }
808 if (!qeth_l3_add_ip(card, ipaddr)) 796 if (!qeth_l3_add_ip(card, ipaddr))
@@ -867,7 +855,6 @@ int qeth_l3_add_rxip(struct qeth_card *card, enum qeth_prot_versions proto,
867 rc = -EEXIST; 855 rc = -EEXIST;
868 spin_unlock_irqrestore(&card->ip_lock, flags); 856 spin_unlock_irqrestore(&card->ip_lock, flags);
869 if (rc) { 857 if (rc) {
870 PRINT_WARN("Cannot add RXIP. Address already exists!\n");
871 return rc; 858 return rc;
872 } 859 }
873 if (!qeth_l3_add_ip(card, ipaddr)) 860 if (!qeth_l3_add_ip(card, ipaddr))
@@ -1020,23 +1007,23 @@ static int qeth_l3_setadapter_hstr(struct qeth_card *card)
1020 IPA_SETADP_SET_BROADCAST_MODE, 1007 IPA_SETADP_SET_BROADCAST_MODE,
1021 card->options.broadcast_mode); 1008 card->options.broadcast_mode);
1022 if (rc) 1009 if (rc)
1023 PRINT_WARN("couldn't set broadcast mode on " 1010 QETH_DBF_MESSAGE(2, "couldn't set broadcast mode on "
1024 "device %s: x%x\n", 1011 "device %s: x%x\n",
1025 CARD_BUS_ID(card), rc); 1012 CARD_BUS_ID(card), rc);
1026 rc = qeth_l3_send_setadp_mode(card, 1013 rc = qeth_l3_send_setadp_mode(card,
1027 IPA_SETADP_ALTER_MAC_ADDRESS, 1014 IPA_SETADP_ALTER_MAC_ADDRESS,
1028 card->options.macaddr_mode); 1015 card->options.macaddr_mode);
1029 if (rc) 1016 if (rc)
1030 PRINT_WARN("couldn't set macaddr mode on " 1017 QETH_DBF_MESSAGE(2, "couldn't set macaddr mode on "
1031 "device %s: x%x\n", CARD_BUS_ID(card), rc); 1018 "device %s: x%x\n", CARD_BUS_ID(card), rc);
1032 return rc; 1019 return rc;
1033 } 1020 }
1034 if (card->options.broadcast_mode == QETH_TR_BROADCAST_LOCAL) 1021 if (card->options.broadcast_mode == QETH_TR_BROADCAST_LOCAL)
1035 PRINT_WARN("set adapter parameters not available " 1022 QETH_DBF_MESSAGE(2, "set adapter parameters not available "
1036 "to set broadcast mode, using ALLRINGS " 1023 "to set broadcast mode, using ALLRINGS "
1037 "on device %s:\n", CARD_BUS_ID(card)); 1024 "on device %s:\n", CARD_BUS_ID(card));
1038 if (card->options.macaddr_mode == QETH_TR_MACADDR_CANONICAL) 1025 if (card->options.macaddr_mode == QETH_TR_MACADDR_CANONICAL)
1039 PRINT_WARN("set adapter parameters not available " 1026 QETH_DBF_MESSAGE(2, "set adapter parameters not available "
1040 "to set macaddr mode, using NONCANONICAL " 1027 "to set macaddr mode, using NONCANONICAL "
1041 "on device %s:\n", CARD_BUS_ID(card)); 1028 "on device %s:\n", CARD_BUS_ID(card));
1042 return 0; 1029 return 0;
@@ -2070,7 +2057,7 @@ static struct qeth_card *qeth_l3_get_card_from_dev(struct net_device *dev)
2070 card = netdev_priv(dev); 2057 card = netdev_priv(dev);
2071 else if (rc == QETH_VLAN_CARD) 2058 else if (rc == QETH_VLAN_CARD)
2072 card = netdev_priv(vlan_dev_info(dev)->real_dev); 2059 card = netdev_priv(vlan_dev_info(dev)->real_dev);
2073 if (card->options.layer2) 2060 if (card && card->options.layer2)
2074 card = NULL; 2061 card = NULL;
2075 QETH_DBF_TEXT_(TRACE, 4, "%d", rc); 2062 QETH_DBF_TEXT_(TRACE, 4, "%d", rc);
2076 return card ; 2063 return card ;
@@ -2182,8 +2169,6 @@ static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries)
2182 if (card->info.guestlan) 2169 if (card->info.guestlan)
2183 return -EOPNOTSUPP; 2170 return -EOPNOTSUPP;
2184 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { 2171 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) {
2185 PRINT_WARN("ARP processing not supported "
2186 "on %s!\n", QETH_CARD_IFNAME(card));
2187 return -EOPNOTSUPP; 2172 return -EOPNOTSUPP;
2188 } 2173 }
2189 rc = qeth_l3_send_simple_setassparms(card, IPA_ARP_PROCESSING, 2174 rc = qeth_l3_send_simple_setassparms(card, IPA_ARP_PROCESSING,
@@ -2191,8 +2176,8 @@ static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries)
2191 no_entries); 2176 no_entries);
2192 if (rc) { 2177 if (rc) {
2193 tmp = rc; 2178 tmp = rc;
2194 PRINT_WARN("Could not set number of ARP entries on %s: " 2179 QETH_DBF_MESSAGE(2, "Could not set number of ARP entries on "
2195 "%s (0x%x/%d)\n", QETH_CARD_IFNAME(card), 2180 "%s: %s (0x%x/%d)\n", QETH_CARD_IFNAME(card),
2196 qeth_l3_arp_get_error_cause(&rc), tmp, tmp); 2181 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2197 } 2182 }
2198 return rc; 2183 return rc;
@@ -2260,9 +2245,6 @@ static int qeth_l3_arp_query_cb(struct qeth_card *card,
2260 qdata->no_entries * uentry_size){ 2245 qdata->no_entries * uentry_size){
2261 QETH_DBF_TEXT_(TRACE, 4, "qaer3%i", -ENOMEM); 2246 QETH_DBF_TEXT_(TRACE, 4, "qaer3%i", -ENOMEM);
2262 cmd->hdr.return_code = -ENOMEM; 2247 cmd->hdr.return_code = -ENOMEM;
2263 PRINT_WARN("query ARP user space buffer is too small for "
2264 "the returned number of ARP entries. "
2265 "Aborting query!\n");
2266 goto out_error; 2248 goto out_error;
2267 } 2249 }
2268 QETH_DBF_TEXT_(TRACE, 4, "anore%i", 2250 QETH_DBF_TEXT_(TRACE, 4, "anore%i",
@@ -2324,8 +2306,6 @@ static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata)
2324 2306
2325 if (!qeth_is_supported(card,/*IPA_QUERY_ARP_ADDR_INFO*/ 2307 if (!qeth_is_supported(card,/*IPA_QUERY_ARP_ADDR_INFO*/
2326 IPA_ARP_PROCESSING)) { 2308 IPA_ARP_PROCESSING)) {
2327 PRINT_WARN("ARP processing not supported "
2328 "on %s!\n", QETH_CARD_IFNAME(card));
2329 return -EOPNOTSUPP; 2309 return -EOPNOTSUPP;
2330 } 2310 }
2331 /* get size of userspace buffer and mask_bits -> 6 bytes */ 2311 /* get size of userspace buffer and mask_bits -> 6 bytes */
@@ -2344,7 +2324,7 @@ static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata)
2344 qeth_l3_arp_query_cb, (void *)&qinfo); 2324 qeth_l3_arp_query_cb, (void *)&qinfo);
2345 if (rc) { 2325 if (rc) {
2346 tmp = rc; 2326 tmp = rc;
2347 PRINT_WARN("Error while querying ARP cache on %s: %s " 2327 QETH_DBF_MESSAGE(2, "Error while querying ARP cache on %s: %s "
2348 "(0x%x/%d)\n", QETH_CARD_IFNAME(card), 2328 "(0x%x/%d)\n", QETH_CARD_IFNAME(card),
2349 qeth_l3_arp_get_error_cause(&rc), tmp, tmp); 2329 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2350 if (copy_to_user(udata, qinfo.udata, 4)) 2330 if (copy_to_user(udata, qinfo.udata, 4))
@@ -2375,8 +2355,6 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
2375 if (card->info.guestlan) 2355 if (card->info.guestlan)
2376 return -EOPNOTSUPP; 2356 return -EOPNOTSUPP;
2377 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { 2357 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) {
2378 PRINT_WARN("ARP processing not supported "
2379 "on %s!\n", QETH_CARD_IFNAME(card));
2380 return -EOPNOTSUPP; 2358 return -EOPNOTSUPP;
2381 } 2359 }
2382 2360
@@ -2391,10 +2369,9 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
2391 if (rc) { 2369 if (rc) {
2392 tmp = rc; 2370 tmp = rc;
2393 qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf); 2371 qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
2394 PRINT_WARN("Could not add ARP entry for address %s on %s: " 2372 QETH_DBF_MESSAGE(2, "Could not add ARP entry for address %s "
2395 "%s (0x%x/%d)\n", 2373 "on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card),
2396 buf, QETH_CARD_IFNAME(card), 2374 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2397 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2398 } 2375 }
2399 return rc; 2376 return rc;
2400} 2377}
@@ -2417,8 +2394,6 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card,
2417 if (card->info.guestlan) 2394 if (card->info.guestlan)
2418 return -EOPNOTSUPP; 2395 return -EOPNOTSUPP;
2419 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { 2396 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) {
2420 PRINT_WARN("ARP processing not supported "
2421 "on %s!\n", QETH_CARD_IFNAME(card));
2422 return -EOPNOTSUPP; 2397 return -EOPNOTSUPP;
2423 } 2398 }
2424 memcpy(buf, entry, 12); 2399 memcpy(buf, entry, 12);
@@ -2433,10 +2408,9 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card,
2433 tmp = rc; 2408 tmp = rc;
2434 memset(buf, 0, 16); 2409 memset(buf, 0, 16);
2435 qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf); 2410 qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
2436 PRINT_WARN("Could not delete ARP entry for address %s on %s: " 2411 QETH_DBF_MESSAGE(2, "Could not delete ARP entry for address %s"
2437 "%s (0x%x/%d)\n", 2412 " on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card),
2438 buf, QETH_CARD_IFNAME(card), 2413 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2439 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2440 } 2414 }
2441 return rc; 2415 return rc;
2442} 2416}
@@ -2456,16 +2430,14 @@ static int qeth_l3_arp_flush_cache(struct qeth_card *card)
2456 if (card->info.guestlan || (card->info.type == QETH_CARD_TYPE_IQD)) 2430 if (card->info.guestlan || (card->info.type == QETH_CARD_TYPE_IQD))
2457 return -EOPNOTSUPP; 2431 return -EOPNOTSUPP;
2458 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { 2432 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) {
2459 PRINT_WARN("ARP processing not supported "
2460 "on %s!\n", QETH_CARD_IFNAME(card));
2461 return -EOPNOTSUPP; 2433 return -EOPNOTSUPP;
2462 } 2434 }
2463 rc = qeth_l3_send_simple_setassparms(card, IPA_ARP_PROCESSING, 2435 rc = qeth_l3_send_simple_setassparms(card, IPA_ARP_PROCESSING,
2464 IPA_CMD_ASS_ARP_FLUSH_CACHE, 0); 2436 IPA_CMD_ASS_ARP_FLUSH_CACHE, 0);
2465 if (rc) { 2437 if (rc) {
2466 tmp = rc; 2438 tmp = rc;
2467 PRINT_WARN("Could not flush ARP cache on %s: %s (0x%x/%d)\n", 2439 QETH_DBF_MESSAGE(2, "Could not flush ARP cache on %s: %s "
2468 QETH_CARD_IFNAME(card), 2440 "(0x%x/%d)\n", QETH_CARD_IFNAME(card),
2469 qeth_l3_arp_get_error_cause(&rc), tmp, tmp); 2441 qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
2470 } 2442 }
2471 return rc; 2443 return rc;
@@ -2724,7 +2696,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2724 ctx = qeth_eddp_create_context(card, new_skb, hdr, 2696 ctx = qeth_eddp_create_context(card, new_skb, hdr,
2725 skb->sk->sk_protocol); 2697 skb->sk->sk_protocol);
2726 if (ctx == NULL) { 2698 if (ctx == NULL) {
2727 PRINT_WARN("could not create eddp context\n"); 2699 QETH_DBF_MESSAGE(2, "could not create eddp context\n");
2728 goto tx_drop; 2700 goto tx_drop;
2729 } 2701 }
2730 } else { 2702 } else {
@@ -2792,6 +2764,7 @@ tx_drop:
2792 if ((new_skb != skb) && new_skb) 2764 if ((new_skb != skb) && new_skb)
2793 dev_kfree_skb_any(new_skb); 2765 dev_kfree_skb_any(new_skb);
2794 dev_kfree_skb_any(skb); 2766 dev_kfree_skb_any(skb);
2767 netif_wake_queue(dev);
2795 return NETDEV_TX_OK; 2768 return NETDEV_TX_OK;
2796} 2769}
2797 2770
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index 08f51fd902c4..ac1993708ae9 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -85,7 +85,6 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card,
85 } else if (!strcmp(tmp, "multicast_router")) { 85 } else if (!strcmp(tmp, "multicast_router")) {
86 route->type = MULTICAST_ROUTER; 86 route->type = MULTICAST_ROUTER;
87 } else { 87 } else {
88 PRINT_WARN("Invalid routing type '%s'.\n", tmp);
89 return -EINVAL; 88 return -EINVAL;
90 } 89 }
91 if (((card->state == CARD_STATE_SOFTSETUP) || 90 if (((card->state == CARD_STATE_SOFTSETUP) ||
@@ -137,9 +136,6 @@ static ssize_t qeth_l3_dev_route6_store(struct device *dev,
137 return -EINVAL; 136 return -EINVAL;
138 137
139 if (!qeth_is_supported(card, IPA_IPV6)) { 138 if (!qeth_is_supported(card, IPA_IPV6)) {
140 PRINT_WARN("IPv6 not supported for interface %s.\n"
141 "Routing status no changed.\n",
142 QETH_CARD_IFNAME(card));
143 return -ENOTSUPP; 139 return -ENOTSUPP;
144 } 140 }
145 141
@@ -179,7 +175,6 @@ static ssize_t qeth_l3_dev_fake_broadcast_store(struct device *dev,
179 if ((i == 0) || (i == 1)) 175 if ((i == 0) || (i == 1))
180 card->options.fake_broadcast = i; 176 card->options.fake_broadcast = i;
181 else { 177 else {
182 PRINT_WARN("fake_broadcast: write 0 or 1 to this file!\n");
183 return -EINVAL; 178 return -EINVAL;
184 } 179 }
185 return count; 180 return count;
@@ -220,7 +215,6 @@ static ssize_t qeth_l3_dev_broadcast_mode_store(struct device *dev,
220 215
221 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) || 216 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
222 (card->info.link_type == QETH_LINK_TYPE_LANE_TR))) { 217 (card->info.link_type == QETH_LINK_TYPE_LANE_TR))) {
223 PRINT_WARN("Device is not a tokenring device!\n");
224 return -EINVAL; 218 return -EINVAL;
225 } 219 }
226 220
@@ -233,8 +227,6 @@ static ssize_t qeth_l3_dev_broadcast_mode_store(struct device *dev,
233 card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS; 227 card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS;
234 return count; 228 return count;
235 } else { 229 } else {
236 PRINT_WARN("broadcast_mode: invalid mode %s!\n",
237 tmp);
238 return -EINVAL; 230 return -EINVAL;
239 } 231 }
240 return count; 232 return count;
@@ -275,7 +267,6 @@ static ssize_t qeth_l3_dev_canonical_macaddr_store(struct device *dev,
275 267
276 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) || 268 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
277 (card->info.link_type == QETH_LINK_TYPE_LANE_TR))) { 269 (card->info.link_type == QETH_LINK_TYPE_LANE_TR))) {
278 PRINT_WARN("Device is not a tokenring device!\n");
279 return -EINVAL; 270 return -EINVAL;
280 } 271 }
281 272
@@ -285,7 +276,6 @@ static ssize_t qeth_l3_dev_canonical_macaddr_store(struct device *dev,
285 QETH_TR_MACADDR_CANONICAL : 276 QETH_TR_MACADDR_CANONICAL :
286 QETH_TR_MACADDR_NONCANONICAL; 277 QETH_TR_MACADDR_NONCANONICAL;
287 else { 278 else {
288 PRINT_WARN("canonical_macaddr: write 0 or 1 to this file!\n");
289 return -EINVAL; 279 return -EINVAL;
290 } 280 }
291 return count; 281 return count;
@@ -327,7 +317,6 @@ static ssize_t qeth_l3_dev_checksum_store(struct device *dev,
327 else if (!strcmp(tmp, "no_checksumming")) 317 else if (!strcmp(tmp, "no_checksumming"))
328 card->options.checksum_type = NO_CHECKSUMMING; 318 card->options.checksum_type = NO_CHECKSUMMING;
329 else { 319 else {
330 PRINT_WARN("Unknown checksumming type '%s'\n", tmp);
331 return -EINVAL; 320 return -EINVAL;
332 } 321 }
333 return count; 322 return count;
@@ -382,8 +371,6 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev,
382 } else if (!strcmp(tmp, "0")) { 371 } else if (!strcmp(tmp, "0")) {
383 card->ipato.enabled = 0; 372 card->ipato.enabled = 0;
384 } else { 373 } else {
385 PRINT_WARN("ipato_enable: write 0, 1 or 'toggle' to "
386 "this file\n");
387 return -EINVAL; 374 return -EINVAL;
388 } 375 }
389 return count; 376 return count;
@@ -422,8 +409,6 @@ static ssize_t qeth_l3_dev_ipato_invert4_store(struct device *dev,
422 } else if (!strcmp(tmp, "0")) { 409 } else if (!strcmp(tmp, "0")) {
423 card->ipato.invert4 = 0; 410 card->ipato.invert4 = 0;
424 } else { 411 } else {
425 PRINT_WARN("ipato_invert4: write 0, 1 or 'toggle' to "
426 "this file\n");
427 return -EINVAL; 412 return -EINVAL;
428 } 413 }
429 return count; 414 return count;
@@ -486,13 +471,10 @@ static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto,
486 /* get address string */ 471 /* get address string */
487 end = strchr(start, '/'); 472 end = strchr(start, '/');
488 if (!end || (end - start >= 40)) { 473 if (!end || (end - start >= 40)) {
489 PRINT_WARN("Invalid format for ipato_addx/delx. "
490 "Use <ip addr>/<mask bits>\n");
491 return -EINVAL; 474 return -EINVAL;
492 } 475 }
493 strncpy(buffer, start, end - start); 476 strncpy(buffer, start, end - start);
494 if (qeth_l3_string_to_ipaddr(buffer, proto, addr)) { 477 if (qeth_l3_string_to_ipaddr(buffer, proto, addr)) {
495 PRINT_WARN("Invalid IP address format!\n");
496 return -EINVAL; 478 return -EINVAL;
497 } 479 }
498 start = end + 1; 480 start = end + 1;
@@ -500,7 +482,6 @@ static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto,
500 if (!strlen(start) || 482 if (!strlen(start) ||
501 (tmp == start) || 483 (tmp == start) ||
502 (*mask_bits > ((proto == QETH_PROT_IPV4) ? 32 : 128))) { 484 (*mask_bits > ((proto == QETH_PROT_IPV4) ? 32 : 128))) {
503 PRINT_WARN("Invalid mask bits for ipato_addx/delx !\n");
504 return -EINVAL; 485 return -EINVAL;
505 } 486 }
506 return 0; 487 return 0;
@@ -520,7 +501,6 @@ static ssize_t qeth_l3_dev_ipato_add_store(const char *buf, size_t count,
520 501
521 ipatoe = kzalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL); 502 ipatoe = kzalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL);
522 if (!ipatoe) { 503 if (!ipatoe) {
523 PRINT_WARN("No memory to allocate ipato entry\n");
524 return -ENOMEM; 504 return -ENOMEM;
525 } 505 }
526 ipatoe->proto = proto; 506 ipatoe->proto = proto;
@@ -609,8 +589,6 @@ static ssize_t qeth_l3_dev_ipato_invert6_store(struct device *dev,
609 } else if (!strcmp(tmp, "0")) { 589 } else if (!strcmp(tmp, "0")) {
610 card->ipato.invert6 = 0; 590 card->ipato.invert6 = 0;
611 } else { 591 } else {
612 PRINT_WARN("ipato_invert6: write 0, 1 or 'toggle' to "
613 "this file\n");
614 return -EINVAL; 592 return -EINVAL;
615 } 593 }
616 return count; 594 return count;
@@ -724,7 +702,6 @@ static int qeth_l3_parse_vipae(const char *buf, enum qeth_prot_versions proto,
724 u8 *addr) 702 u8 *addr)
725{ 703{
726 if (qeth_l3_string_to_ipaddr(buf, proto, addr)) { 704 if (qeth_l3_string_to_ipaddr(buf, proto, addr)) {
727 PRINT_WARN("Invalid IP address format!\n");
728 return -EINVAL; 705 return -EINVAL;
729 } 706 }
730 return 0; 707 return 0;
@@ -891,7 +868,6 @@ static int qeth_l3_parse_rxipe(const char *buf, enum qeth_prot_versions proto,
891 u8 *addr) 868 u8 *addr)
892{ 869{
893 if (qeth_l3_string_to_ipaddr(buf, proto, addr)) { 870 if (qeth_l3_string_to_ipaddr(buf, proto, addr)) {
894 PRINT_WARN("Invalid IP address format!\n");
895 return -EINVAL; 871 return -EINVAL;
896 } 872 }
897 return 0; 873 return 0;
diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c
index 5080f343ad74..5bfbe7659830 100644
--- a/drivers/s390/s390mach.c
+++ b/drivers/s390/s390mach.c
@@ -207,6 +207,7 @@ s390_handle_mcck(void)
207 do_exit(SIGSEGV); 207 do_exit(SIGSEGV);
208 } 208 }
209} 209}
210EXPORT_SYMBOL_GPL(s390_handle_mcck);
210 211
211/* 212/*
212 * returns 0 if all registers could be validated 213 * returns 0 if all registers could be validated
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
index b87037ec9805..03c966059471 100644
--- a/drivers/sbus/char/bpp.c
+++ b/drivers/sbus/char/bpp.c
@@ -869,7 +869,7 @@ static void probeLptPort(unsigned idx)
869 instances[idx].mode = COMPATIBILITY; 869 instances[idx].mode = COMPATIBILITY;
870 instances[idx].run_length = 0; 870 instances[idx].run_length = 0;
871 instances[idx].run_flag = 0; 871 instances[idx].run_flag = 0;
872 if (!request_region(lpAddr,3, dev_name)) return; 872 if (!request_region(lpAddr,3, bpp_dev_name)) return;
873 873
874 /* 874 /*
875 * First, make sure the instance exists. Do this by writing to 875 * First, make sure the instance exists. Do this by writing to
@@ -1021,7 +1021,7 @@ static int __init bpp_init(void)
1021 if (rc == 0) 1021 if (rc == 0)
1022 return -ENODEV; 1022 return -ENODEV;
1023 1023
1024 rc = register_chrdev(BPP_MAJOR, dev_name, &bpp_fops); 1024 rc = register_chrdev(BPP_MAJOR, bpp_dev_name, &bpp_fops);
1025 if (rc < 0) 1025 if (rc < 0)
1026 return rc; 1026 return rc;
1027 1027
@@ -1037,7 +1037,7 @@ static void __exit bpp_cleanup(void)
1037{ 1037{
1038 unsigned idx; 1038 unsigned idx;
1039 1039
1040 unregister_chrdev(BPP_MAJOR, dev_name); 1040 unregister_chrdev(BPP_MAJOR, bpp_dev_name);
1041 1041
1042 for (idx = 0; idx < BPP_NO; idx++) { 1042 for (idx = 0; idx < BPP_NO; idx++) {
1043 if (instances[idx].present) 1043 if (instances[idx].present)
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index b31faeccb9cd..867f6fd5c2c0 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1278 error = 0; 1278 error = 0;
1279 /* Check for command packet errors */ 1279 /* Check for command packet errors */
1280 if (full_command_packet->command.newcommand.status != 0) { 1280 if (full_command_packet->command.newcommand.status != 0) {
1281 if (tw_dev->srb[request_id] != 0) { 1281 if (tw_dev->srb[request_id] != NULL) {
1282 error = twa_fill_sense(tw_dev, request_id, 1, 1); 1282 error = twa_fill_sense(tw_dev, request_id, 1, 1);
1283 } else { 1283 } else {
1284 /* Skip ioctl error prints */ 1284 /* Skip ioctl error prints */
@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1290 1290
1291 /* Check for correct state */ 1291 /* Check for correct state */
1292 if (tw_dev->state[request_id] != TW_S_POSTED) { 1292 if (tw_dev->state[request_id] != TW_S_POSTED) {
1293 if (tw_dev->srb[request_id] != 0) { 1293 if (tw_dev->srb[request_id] != NULL) {
1294 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted"); 1294 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted");
1295 TW_CLEAR_ALL_INTERRUPTS(tw_dev); 1295 TW_CLEAR_ALL_INTERRUPTS(tw_dev);
1296 goto twa_interrupt_bail; 1296 goto twa_interrupt_bail;
@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1298 } 1298 }
1299 1299
1300 /* Check for internal command completion */ 1300 /* Check for internal command completion */
1301 if (tw_dev->srb[request_id] == 0) { 1301 if (tw_dev->srb[request_id] == NULL) {
1302 if (request_id != tw_dev->chrdev_request_id) { 1302 if (request_id != tw_dev->chrdev_request_id) {
1303 if (twa_aen_complete(tw_dev, request_id)) 1303 if (twa_aen_complete(tw_dev, request_id))
1304 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt"); 1304 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt");
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index f5215fd4b73d..0899cb61e3dd 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup *setup)
3582 if (i == ARRAY_SIZE(ports)) 3582 if (i == ARRAY_SIZE(ports))
3583 return 0; 3583 return 0;
3584 3584
3585 if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) { 3585 if (!request_region(setup->io_port, IO_RANGE, "aha152x")) {
3586 printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port); 3586 printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port);
3587 return 0; 3587 return 0;
3588 } 3588 }
@@ -3830,7 +3830,7 @@ static int __init aha152x_init(void)
3830 iounmap(p); 3830 iounmap(p);
3831 } 3831 }
3832 if (!ok && setup_count == 0) 3832 if (!ok && setup_count == 0)
3833 return 0; 3833 return -ENODEV;
3834 3834
3835 printk(KERN_INFO "aha152x: BIOS test: passed, "); 3835 printk(KERN_INFO "aha152x: BIOS test: passed, ");
3836#else 3836#else
@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void)
3842 if ((setup_count == 1) && (setup[0].io_port == ports[i])) 3842 if ((setup_count == 1) && (setup[0].io_port == ports[i]))
3843 continue; 3843 continue;
3844 3844
3845 if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) { 3845 if (!request_region(ports[i], IO_RANGE, "aha152x")) {
3846 printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]); 3846 printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]);
3847 continue; 3847 continue;
3848 } 3848 }
@@ -3909,14 +3909,14 @@ static int __init aha152x_init(void)
3909#endif 3909#endif
3910 } 3910 }
3911 3911
3912 return 1; 3912 return 0;
3913} 3913}
3914 3914
3915static void __exit aha152x_exit(void) 3915static void __exit aha152x_exit(void)
3916{ 3916{
3917 struct aha152x_hostdata *hd; 3917 struct aha152x_hostdata *hd, *tmp;
3918 3918
3919 list_for_each_entry(hd, &aha152x_host_list, host_list) { 3919 list_for_each_entry_safe(hd, tmp, &aha152x_host_list, host_list) {
3920 struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata); 3920 struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
3921 3921
3922 aha152x_release(shost); 3922 aha152x_release(shost);
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index db6de5e6afb3..7d311541c76c 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
747 dev->quhd[c] = 0; 747 dev->quhd[c] = 0;
748 } 748 }
749 workreq = dev->quereq[c][dev->quhd[c]]; 749 workreq = dev->quereq[c][dev->quhd[c]];
750 if (dev->id[c][scmd_id(workreq)].curr_req == 0) { 750 if (dev->id[c][scmd_id(workreq)].curr_req == NULL) {
751 dev->id[c][scmd_id(workreq)].curr_req = workreq; 751 dev->id[c][scmd_id(workreq)].curr_req = workreq;
752 dev->last_cmd[c] = scmd_id(workreq); 752 dev->last_cmd[c] = scmd_id(workreq);
753 goto cmd_subp; 753 goto cmd_subp;
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 75c84d7b9ce8..c4b938bc30d3 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -910,9 +910,9 @@ static int ch_probe(struct device *dev)
910 ch->minor = minor; 910 ch->minor = minor;
911 sprintf(ch->name,"ch%d",ch->minor); 911 sprintf(ch->name,"ch%d",ch->minor);
912 912
913 class_dev = device_create(ch_sysfs_class, dev, 913 class_dev = device_create_drvdata(ch_sysfs_class, dev,
914 MKDEV(SCSI_CHANGER_MAJOR,ch->minor), 914 MKDEV(SCSI_CHANGER_MAJOR, ch->minor),
915 "s%s", ch->name); 915 ch, "s%s", ch->name);
916 if (IS_ERR(class_dev)) { 916 if (IS_ERR(class_dev)) {
917 printk(KERN_WARNING "ch%d: device_create failed\n", 917 printk(KERN_WARNING "ch%d: device_create failed\n",
918 ch->minor); 918 ch->minor);
@@ -926,7 +926,6 @@ static int ch_probe(struct device *dev)
926 if (init) 926 if (init)
927 ch_init_elem(ch); 927 ch_init_elem(ch);
928 928
929 dev_set_drvdata(dev, ch);
930 sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); 929 sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name);
931 930
932 return 0; 931 return 0;
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 8e2e964af668..46771d4c81bd 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -550,7 +550,6 @@ static int __init gdth_search_isa(ulong32 bios_adr)
550#endif /* CONFIG_ISA */ 550#endif /* CONFIG_ISA */
551 551
552#ifdef CONFIG_PCI 552#ifdef CONFIG_PCI
553static bool gdth_pci_registered;
554 553
555static bool gdth_search_vortex(ushort device) 554static bool gdth_search_vortex(ushort device)
556{ 555{
@@ -3724,6 +3723,8 @@ static void gdth_log_event(gdth_evt_data *dvr, char *buffer)
3724} 3723}
3725 3724
3726#ifdef GDTH_STATISTICS 3725#ifdef GDTH_STATISTICS
3726static unchar gdth_timer_running;
3727
3727static void gdth_timeout(ulong data) 3728static void gdth_timeout(ulong data)
3728{ 3729{
3729 ulong32 i; 3730 ulong32 i;
@@ -3731,7 +3732,10 @@ static void gdth_timeout(ulong data)
3731 gdth_ha_str *ha; 3732 gdth_ha_str *ha;
3732 ulong flags; 3733 ulong flags;
3733 3734
3734 BUG_ON(list_empty(&gdth_instances)); 3735 if(unlikely(list_empty(&gdth_instances))) {
3736 gdth_timer_running = 0;
3737 return;
3738 }
3735 3739
3736 ha = list_first_entry(&gdth_instances, gdth_ha_str, list); 3740 ha = list_first_entry(&gdth_instances, gdth_ha_str, list);
3737 spin_lock_irqsave(&ha->smp_lock, flags); 3741 spin_lock_irqsave(&ha->smp_lock, flags);
@@ -3751,6 +3755,22 @@ static void gdth_timeout(ulong data)
3751 add_timer(&gdth_timer); 3755 add_timer(&gdth_timer);
3752 spin_unlock_irqrestore(&ha->smp_lock, flags); 3756 spin_unlock_irqrestore(&ha->smp_lock, flags);
3753} 3757}
3758
3759static void gdth_timer_init(void)
3760{
3761 if (gdth_timer_running)
3762 return;
3763 gdth_timer_running = 1;
3764 TRACE2(("gdth_detect(): Initializing timer !\n"));
3765 gdth_timer.expires = jiffies + HZ;
3766 gdth_timer.data = 0L;
3767 gdth_timer.function = gdth_timeout;
3768 add_timer(&gdth_timer);
3769}
3770#else
3771static inline void gdth_timer_init(void)
3772{
3773}
3754#endif 3774#endif
3755 3775
3756static void __init internal_setup(char *str,int *ints) 3776static void __init internal_setup(char *str,int *ints)
@@ -4735,6 +4755,7 @@ static int __init gdth_isa_probe_one(ulong32 isa_bios)
4735 if (error) 4755 if (error)
4736 goto out_free_coal_stat; 4756 goto out_free_coal_stat;
4737 list_add_tail(&ha->list, &gdth_instances); 4757 list_add_tail(&ha->list, &gdth_instances);
4758 gdth_timer_init();
4738 4759
4739 scsi_scan_host(shp); 4760 scsi_scan_host(shp);
4740 4761
@@ -4865,6 +4886,7 @@ static int __init gdth_eisa_probe_one(ushort eisa_slot)
4865 if (error) 4886 if (error)
4866 goto out_free_coal_stat; 4887 goto out_free_coal_stat;
4867 list_add_tail(&ha->list, &gdth_instances); 4888 list_add_tail(&ha->list, &gdth_instances);
4889 gdth_timer_init();
4868 4890
4869 scsi_scan_host(shp); 4891 scsi_scan_host(shp);
4870 4892
@@ -5011,6 +5033,7 @@ static int gdth_pci_probe_one(gdth_pci_str *pcistr,
5011 list_add_tail(&ha->list, &gdth_instances); 5033 list_add_tail(&ha->list, &gdth_instances);
5012 5034
5013 pci_set_drvdata(ha->pdev, ha); 5035 pci_set_drvdata(ha->pdev, ha);
5036 gdth_timer_init();
5014 5037
5015 scsi_scan_host(shp); 5038 scsi_scan_host(shp);
5016 5039
@@ -5110,6 +5133,7 @@ static int __init gdth_init(void)
5110 /* initializations */ 5133 /* initializations */
5111 gdth_polling = TRUE; 5134 gdth_polling = TRUE;
5112 gdth_clear_events(); 5135 gdth_clear_events();
5136 init_timer(&gdth_timer);
5113 5137
5114 /* As default we do not probe for EISA or ISA controllers */ 5138 /* As default we do not probe for EISA or ISA controllers */
5115 if (probe_eisa_isa) { 5139 if (probe_eisa_isa) {
@@ -5132,23 +5156,17 @@ static int __init gdth_init(void)
5132 5156
5133#ifdef CONFIG_PCI 5157#ifdef CONFIG_PCI
5134 /* scanning for PCI controllers */ 5158 /* scanning for PCI controllers */
5135 if (pci_register_driver(&gdth_pci_driver) == 0) 5159 if (pci_register_driver(&gdth_pci_driver)) {
5136 gdth_pci_registered = true; 5160 gdth_ha_str *ha;
5161
5162 list_for_each_entry(ha, &gdth_instances, list)
5163 gdth_remove_one(ha);
5164 return -ENODEV;
5165 }
5137#endif /* CONFIG_PCI */ 5166#endif /* CONFIG_PCI */
5138 5167
5139 TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count)); 5168 TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count));
5140 5169
5141 if (list_empty(&gdth_instances))
5142 return -ENODEV;
5143
5144#ifdef GDTH_STATISTICS
5145 TRACE2(("gdth_detect(): Initializing timer !\n"));
5146 init_timer(&gdth_timer);
5147 gdth_timer.expires = jiffies + HZ;
5148 gdth_timer.data = 0L;
5149 gdth_timer.function = gdth_timeout;
5150 add_timer(&gdth_timer);
5151#endif
5152 major = register_chrdev(0,"gdth", &gdth_fops); 5170 major = register_chrdev(0,"gdth", &gdth_fops);
5153 register_reboot_notifier(&gdth_notifier); 5171 register_reboot_notifier(&gdth_notifier);
5154 gdth_polling = FALSE; 5172 gdth_polling = FALSE;
@@ -5167,8 +5185,7 @@ static void __exit gdth_exit(void)
5167#endif 5185#endif
5168 5186
5169#ifdef CONFIG_PCI 5187#ifdef CONFIG_PCI
5170 if (gdth_pci_registered) 5188 pci_unregister_driver(&gdth_pci_driver);
5171 pci_unregister_driver(&gdth_pci_driver);
5172#endif 5189#endif
5173 5190
5174 list_for_each_entry(ha, &gdth_instances, list) 5191 list_for_each_entry(ha, &gdth_instances, list)
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index aaa48e0c8ed0..da876d3924be 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
444 if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) { 444 if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) {
445 printk(KERN_ERR "scsi%d: pci resource invalid\n", 445 printk(KERN_ERR "scsi%d: pci resource invalid\n",
446 hba->host->host_no); 446 hba->host->host_no);
447 return 0; 447 return NULL;
448 } 448 }
449 449
450 mem_base_phy = pci_resource_start(pcidev, index); 450 mem_base_phy = pci_resource_start(pcidev, index);
@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
454 if (!mem_base_virt) { 454 if (!mem_base_virt) {
455 printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n", 455 printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n",
456 hba->host->host_no); 456 hba->host->host_no);
457 return 0; 457 return NULL;
458 } 458 }
459 return mem_base_virt; 459 return mem_base_virt;
460} 460}
@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct hptiop_hba *hba)
476static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba) 476static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba)
477{ 477{
478 hba->u.mv.regs = hptiop_map_pci_bar(hba, 0); 478 hba->u.mv.regs = hptiop_map_pci_bar(hba, 0);
479 if (hba->u.mv.regs == 0) 479 if (hba->u.mv.regs == NULL)
480 return -1; 480 return -1;
481 481
482 hba->u.mv.mu = hptiop_map_pci_bar(hba, 2); 482 hba->u.mv.mu = hptiop_map_pci_bar(hba, 2);
483 if (hba->u.mv.mu == 0) { 483 if (hba->u.mv.mu == NULL) {
484 iounmap(hba->u.mv.regs); 484 iounmap(hba->u.mv.regs);
485 return -1; 485 return -1;
486 } 486 }
@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev *pcidev)
1210 1210
1211static struct hptiop_adapter_ops hptiop_itl_ops = { 1211static struct hptiop_adapter_ops hptiop_itl_ops = {
1212 .iop_wait_ready = iop_wait_ready_itl, 1212 .iop_wait_ready = iop_wait_ready_itl,
1213 .internal_memalloc = 0, 1213 .internal_memalloc = NULL,
1214 .internal_memfree = 0, 1214 .internal_memfree = NULL,
1215 .map_pci_bar = hptiop_map_pci_bar_itl, 1215 .map_pci_bar = hptiop_map_pci_bar_itl,
1216 .unmap_pci_bar = hptiop_unmap_pci_bar_itl, 1216 .unmap_pci_bar = hptiop_unmap_pci_bar_itl,
1217 .enable_intr = hptiop_enable_intr_itl, 1217 .enable_intr = hptiop_enable_intr_itl,
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index ccfd8aca3765..5d23368a1bce 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1348,7 +1348,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
1348 1348
1349 del_timer(&evt_struct->timer); 1349 del_timer(&evt_struct->timer);
1350 1350
1351 if (crq->status != VIOSRP_OK && evt_struct->cmnd) 1351 if ((crq->status != VIOSRP_OK && crq->status != VIOSRP_OK2) && evt_struct->cmnd)
1352 evt_struct->cmnd->result = DID_ERROR << 16; 1352 evt_struct->cmnd->result = DID_ERROR << 16;
1353 if (evt_struct->done) 1353 if (evt_struct->done)
1354 evt_struct->done(evt_struct); 1354 evt_struct->done(evt_struct);
diff --git a/drivers/scsi/ibmvscsi/viosrp.h b/drivers/scsi/ibmvscsi/viosrp.h
index 4c4aadb3e405..204604501ad8 100644
--- a/drivers/scsi/ibmvscsi/viosrp.h
+++ b/drivers/scsi/ibmvscsi/viosrp.h
@@ -65,7 +65,8 @@ enum viosrp_crq_status {
65 VIOSRP_VIOLATES_MAX_XFER = 0x2, 65 VIOSRP_VIOLATES_MAX_XFER = 0x2,
66 VIOSRP_PARTNER_PANIC = 0x3, 66 VIOSRP_PARTNER_PANIC = 0x3,
67 VIOSRP_DEVICE_BUSY = 0x8, 67 VIOSRP_DEVICE_BUSY = 0x8,
68 VIOSRP_ADAPTER_FAIL = 0x10 68 VIOSRP_ADAPTER_FAIL = 0x10,
69 VIOSRP_OK2 = 0x99,
69}; 70};
70 71
71struct viosrp_crq { 72struct viosrp_crq {
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 010c1b9b178c..b43bf1d60dac 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -730,7 +730,9 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
730 if (iscsi_recv_pdu(conn->cls_conn, hdr, data, 730 if (iscsi_recv_pdu(conn->cls_conn, hdr, data,
731 datalen)) 731 datalen))
732 rc = ISCSI_ERR_CONN_FAILED; 732 rc = ISCSI_ERR_CONN_FAILED;
733 } 733 } else
734 mod_timer(&conn->transport_timer,
735 jiffies + conn->recv_timeout);
734 iscsi_free_mgmt_task(conn, mtask); 736 iscsi_free_mgmt_task(conn, mtask);
735 break; 737 break;
736 default: 738 default:
@@ -1453,19 +1455,20 @@ static void iscsi_check_transport_timeouts(unsigned long data)
1453{ 1455{
1454 struct iscsi_conn *conn = (struct iscsi_conn *)data; 1456 struct iscsi_conn *conn = (struct iscsi_conn *)data;
1455 struct iscsi_session *session = conn->session; 1457 struct iscsi_session *session = conn->session;
1456 unsigned long timeout, next_timeout = 0, last_recv; 1458 unsigned long recv_timeout, next_timeout = 0, last_recv;
1457 1459
1458 spin_lock(&session->lock); 1460 spin_lock(&session->lock);
1459 if (session->state != ISCSI_STATE_LOGGED_IN) 1461 if (session->state != ISCSI_STATE_LOGGED_IN)
1460 goto done; 1462 goto done;
1461 1463
1462 timeout = conn->recv_timeout; 1464 recv_timeout = conn->recv_timeout;
1463 if (!timeout) 1465 if (!recv_timeout)
1464 goto done; 1466 goto done;
1465 1467
1466 timeout *= HZ; 1468 recv_timeout *= HZ;
1467 last_recv = conn->last_recv; 1469 last_recv = conn->last_recv;
1468 if (time_before_eq(last_recv + timeout + (conn->ping_timeout * HZ), 1470 if (conn->ping_mtask &&
1471 time_before_eq(conn->last_ping + (conn->ping_timeout * HZ),
1469 jiffies)) { 1472 jiffies)) {
1470 iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs " 1473 iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs "
1471 "expired, last rx %lu, last ping %lu, " 1474 "expired, last rx %lu, last ping %lu, "
@@ -1476,15 +1479,13 @@ static void iscsi_check_transport_timeouts(unsigned long data)
1476 return; 1479 return;
1477 } 1480 }
1478 1481
1479 if (time_before_eq(last_recv + timeout, jiffies)) { 1482 if (time_before_eq(last_recv + recv_timeout, jiffies)) {
1480 if (time_before_eq(conn->last_ping, last_recv)) { 1483 /* send a ping to try to provoke some traffic */
1481 /* send a ping to try to provoke some traffic */ 1484 debug_scsi("Sending nopout as ping on conn %p\n", conn);
1482 debug_scsi("Sending nopout as ping on conn %p\n", conn); 1485 iscsi_send_nopout(conn, NULL);
1483 iscsi_send_nopout(conn, NULL); 1486 next_timeout = conn->last_ping + (conn->ping_timeout * HZ);
1484 }
1485 next_timeout = last_recv + timeout + (conn->ping_timeout * HZ);
1486 } else 1487 } else
1487 next_timeout = last_recv + timeout; 1488 next_timeout = last_recv + recv_timeout;
1488 1489
1489 debug_scsi("Setting next tmo %lu\n", next_timeout); 1490 debug_scsi("Setting next tmo %lu\n", next_timeout);
1490 mod_timer(&conn->transport_timer, next_timeout); 1491 mod_timer(&conn->transport_timer, next_timeout);
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index cd37bd69a115..887682a24e36 100644
--- a/drivers/scsi/mac_esp.c
+++ b/drivers/scsi/mac_esp.c
@@ -650,7 +650,7 @@ static void __exit mac_esp_exit(void)
650 650
651MODULE_DESCRIPTION("Mac ESP SCSI driver"); 651MODULE_DESCRIPTION("Mac ESP SCSI driver");
652MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); 652MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>");
653MODULE_LICENSE("GPLv2"); 653MODULE_LICENSE("GPL v2");
654MODULE_VERSION(DRV_VERSION); 654MODULE_VERSION(DRV_VERSION);
655 655
656module_init(mac_esp_init); 656module_init(mac_esp_init);
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 31f7aec44d90..243d8becd30f 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5695,13 +5695,12 @@ static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * S
5695 struct device *osst_member; 5695 struct device *osst_member;
5696 int err; 5696 int err;
5697 5697
5698 osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); 5698 osst_member = device_create_drvdata(osst_sysfs_class, device, dev, STp, "%s", name);
5699 if (IS_ERR(osst_member)) { 5699 if (IS_ERR(osst_member)) {
5700 printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); 5700 printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name);
5701 return PTR_ERR(osst_member); 5701 return PTR_ERR(osst_member);
5702 } 5702 }
5703 5703
5704 dev_set_drvdata(osst_member, STp);
5705 err = device_create_file(osst_member, &dev_attr_ADR_rev); 5704 err = device_create_file(osst_member, &dev_attr_ADR_rev);
5706 if (err) 5705 if (err)
5707 goto err_out; 5706 goto err_out;
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index fa060932d2b4..3754ab87f89a 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -2007,7 +2007,7 @@ qla1280_set_defaults(struct scsi_qla_host *ha)
2007 nv->bus[bus].config_2.req_ack_active_negation = 1; 2007 nv->bus[bus].config_2.req_ack_active_negation = 1;
2008 nv->bus[bus].config_2.data_line_active_negation = 1; 2008 nv->bus[bus].config_2.data_line_active_negation = 1;
2009 nv->bus[bus].selection_timeout = 250; 2009 nv->bus[bus].selection_timeout = 250;
2010 nv->bus[bus].max_queue_depth = 256; 2010 nv->bus[bus].max_queue_depth = 32;
2011 2011
2012 if (IS_ISP1040(ha)) { 2012 if (IS_ISP1040(ha)) {
2013 nv->bus[bus].bus_reset_delay = 3; 2013 nv->bus[bus].bus_reset_delay = 3;
@@ -2051,7 +2051,7 @@ qla1280_config_target(struct scsi_qla_host *ha, int bus, int target)
2051 status = qla1280_mailbox_command(ha, 0x0f, mb); 2051 status = qla1280_mailbox_command(ha, 0x0f, mb);
2052 2052
2053 /* Save Tag queuing enable flag. */ 2053 /* Save Tag queuing enable flag. */
2054 flag = (BIT_0 << target) & mb[0]; 2054 flag = (BIT_0 << target);
2055 if (nv->bus[bus].target[target].parameter.tag_queuing) 2055 if (nv->bus[bus].target[target].parameter.tag_queuing)
2056 ha->bus_settings[bus].qtag_enables |= flag; 2056 ha->bus_settings[bus].qtag_enables |= flag;
2057 2057
@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
2811 2811
2812 /* Check for room in outstanding command list. */ 2812 /* Check for room in outstanding command list. */
2813 for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS && 2813 for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS &&
2814 ha->outstanding_cmds[cnt] != 0; cnt++); 2814 ha->outstanding_cmds[cnt] != NULL; cnt++);
2815 2815
2816 if (cnt >= MAX_OUTSTANDING_COMMANDS) { 2816 if (cnt >= MAX_OUTSTANDING_COMMANDS) {
2817 status = 1; 2817 status = 1;
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 287690853caf..8dd88fc1244a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -70,6 +70,9 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj,
70 case 2: 70 case 2:
71 qla2x00_alloc_fw_dump(ha); 71 qla2x00_alloc_fw_dump(ha);
72 break; 72 break;
73 case 3:
74 qla2x00_system_error(ha);
75 break;
73 } 76 }
74 return (count); 77 return (count);
75} 78}
@@ -886,9 +889,13 @@ qla2x00_get_host_speed(struct Scsi_Host *shost)
886static void 889static void
887qla2x00_get_host_port_type(struct Scsi_Host *shost) 890qla2x00_get_host_port_type(struct Scsi_Host *shost)
888{ 891{
889 scsi_qla_host_t *ha = to_qla_parent(shost_priv(shost)); 892 scsi_qla_host_t *ha = shost_priv(shost);
890 uint32_t port_type = FC_PORTTYPE_UNKNOWN; 893 uint32_t port_type = FC_PORTTYPE_UNKNOWN;
891 894
895 if (ha->parent) {
896 fc_host_port_type(shost) = FC_PORTTYPE_NPIV;
897 return;
898 }
892 switch (ha->current_topology) { 899 switch (ha->current_topology) {
893 case ISP_CFG_NL: 900 case ISP_CFG_NL:
894 port_type = FC_PORTTYPE_LPORT; 901 port_type = FC_PORTTYPE_LPORT;
@@ -1172,10 +1179,10 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1172 qla24xx_disable_vp(vha); 1179 qla24xx_disable_vp(vha);
1173 qla24xx_deallocate_vp_id(vha); 1180 qla24xx_deallocate_vp_id(vha);
1174 1181
1175 down(&ha->vport_sem); 1182 mutex_lock(&ha->vport_lock);
1176 ha->cur_vport_count--; 1183 ha->cur_vport_count--;
1177 clear_bit(vha->vp_idx, ha->vp_idx_map); 1184 clear_bit(vha->vp_idx, ha->vp_idx_map);
1178 up(&ha->vport_sem); 1185 mutex_unlock(&ha->vport_lock);
1179 1186
1180 kfree(vha->node_name); 1187 kfree(vha->node_name);
1181 kfree(vha->port_name); 1188 kfree(vha->port_name);
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 299eccf6cabd..8dd600013bd1 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2457,7 +2457,7 @@ typedef struct scsi_qla_host {
2457#define MBX_INTR_WAIT 2 2457#define MBX_INTR_WAIT 2
2458#define MBX_UPDATE_FLASH_ACTIVE 3 2458#define MBX_UPDATE_FLASH_ACTIVE 3
2459 2459
2460 struct semaphore vport_sem; /* Virtual port synchronization */ 2460 struct mutex vport_lock; /* Virtual port synchronization */
2461 struct completion mbx_cmd_comp; /* Serialize mbx access */ 2461 struct completion mbx_cmd_comp; /* Serialize mbx access */
2462 struct completion mbx_intr_comp; /* Used for completion notification */ 2462 struct completion mbx_intr_comp; /* Used for completion notification */
2463 2463
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index f8827068d30f..9b4bebee6879 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -228,6 +228,9 @@ extern int qla24xx_abort_target(struct fc_port *, unsigned int);
228extern int qla24xx_lun_reset(struct fc_port *, unsigned int); 228extern int qla24xx_lun_reset(struct fc_port *, unsigned int);
229 229
230extern int 230extern int
231qla2x00_system_error(scsi_qla_host_t *);
232
233extern int
231qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t); 234qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);
232 235
233extern int 236extern int
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index e9bae27737d1..92fafbdbbaab 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -34,7 +34,11 @@ qla2x00_debounce_register(volatile uint16_t __iomem *addr)
34static inline void 34static inline void
35qla2x00_poll(scsi_qla_host_t *ha) 35qla2x00_poll(scsi_qla_host_t *ha)
36{ 36{
37 unsigned long flags;
38
39 local_irq_save(flags);
37 ha->isp_ops->intr_handler(0, ha); 40 ha->isp_ops->intr_handler(0, ha);
41 local_irq_restore(flags);
38} 42}
39 43
40static __inline__ scsi_qla_host_t * 44static __inline__ scsi_qla_host_t *
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 5d9a64a7879b..ec63b79f900a 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -272,8 +272,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
272 uint32_t rscn_entry, host_pid; 272 uint32_t rscn_entry, host_pid;
273 uint8_t rscn_queue_index; 273 uint8_t rscn_queue_index;
274 unsigned long flags; 274 unsigned long flags;
275 scsi_qla_host_t *vha;
276 int i;
277 275
278 /* Setup to process RIO completion. */ 276 /* Setup to process RIO completion. */
279 handle_cnt = 0; 277 handle_cnt = 0;
@@ -544,18 +542,10 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
544 break; 542 break;
545 543
546 case MBA_PORT_UPDATE: /* Port database update */ 544 case MBA_PORT_UPDATE: /* Port database update */
547 if ((ha->flags.npiv_supported) && (ha->num_vhosts)) { 545 /* Only handle SCNs for our Vport index. */
548 for_each_mapped_vp_idx(ha, i) { 546 if (ha->parent && ha->vp_idx != (mb[3] & 0xff))
549 list_for_each_entry(vha, &ha->vp_list, 547 break;
550 vp_list) { 548
551 if ((mb[3] & 0xff)
552 == vha->vp_idx) {
553 ha = vha;
554 break;
555 }
556 }
557 }
558 }
559 /* 549 /*
560 * If PORT UPDATE is global (recieved LIP_OCCURED/LIP_RESET 550 * If PORT UPDATE is global (recieved LIP_OCCURED/LIP_RESET
561 * event etc. earlier indicating loop is down) then process 551 * event etc. earlier indicating loop is down) then process
@@ -590,18 +580,12 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
590 break; 580 break;
591 581
592 case MBA_RSCN_UPDATE: /* State Change Registration */ 582 case MBA_RSCN_UPDATE: /* State Change Registration */
593 if ((ha->flags.npiv_supported) && (ha->num_vhosts)) { 583 /* Check if the Vport has issued a SCR */
594 for_each_mapped_vp_idx(ha, i) { 584 if (ha->parent && test_bit(VP_SCR_NEEDED, &ha->vp_flags))
595 list_for_each_entry(vha, &ha->vp_list, 585 break;
596 vp_list) { 586 /* Only handle SCNs for our Vport index. */
597 if ((mb[3] & 0xff) 587 if (ha->parent && ha->vp_idx != (mb[3] & 0xff))
598 == vha->vp_idx) { 588 break;
599 ha = vha;
600 break;
601 }
602 }
603 }
604 }
605 589
606 DEBUG2(printk("scsi(%ld): Asynchronous RSCR UPDATE.\n", 590 DEBUG2(printk("scsi(%ld): Asynchronous RSCR UPDATE.\n",
607 ha->host_no)); 591 ha->host_no));
@@ -1132,25 +1116,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1132 break; 1116 break;
1133 1117
1134 qla2x00_handle_sense(sp, sense_data, sense_len); 1118 qla2x00_handle_sense(sp, sense_data, sense_len);
1135
1136 /*
1137 * In case of a Underrun condition, set both the lscsi
1138 * status and the completion status to appropriate
1139 * values.
1140 */
1141 if (resid &&
1142 ((unsigned)(scsi_bufflen(cp) - resid) <
1143 cp->underflow)) {
1144 DEBUG2(qla_printk(KERN_INFO, ha,
1145 "scsi(%ld:%d:%d:%d): Mid-layer underflow "
1146 "detected (%x of %x bytes)...returning "
1147 "error status.\n", ha->host_no,
1148 cp->device->channel, cp->device->id,
1149 cp->device->lun, resid,
1150 scsi_bufflen(cp)));
1151
1152 cp->result = DID_ERROR << 16 | lscsi_status;
1153 }
1154 } else { 1119 } else {
1155 /* 1120 /*
1156 * If RISC reports underrun and target does not report 1121 * If RISC reports underrun and target does not report
@@ -1639,12 +1604,12 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
1639 ha = dev_id; 1604 ha = dev_id;
1640 reg = &ha->iobase->isp24; 1605 reg = &ha->iobase->isp24;
1641 1606
1642 spin_lock(&ha->hardware_lock); 1607 spin_lock_irq(&ha->hardware_lock);
1643 1608
1644 qla24xx_process_response_queue(ha); 1609 qla24xx_process_response_queue(ha);
1645 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT); 1610 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
1646 1611
1647 spin_unlock(&ha->hardware_lock); 1612 spin_unlock_irq(&ha->hardware_lock);
1648 1613
1649 return IRQ_HANDLED; 1614 return IRQ_HANDLED;
1650} 1615}
@@ -1663,7 +1628,7 @@ qla24xx_msix_default(int irq, void *dev_id)
1663 reg = &ha->iobase->isp24; 1628 reg = &ha->iobase->isp24;
1664 status = 0; 1629 status = 0;
1665 1630
1666 spin_lock(&ha->hardware_lock); 1631 spin_lock_irq(&ha->hardware_lock);
1667 do { 1632 do {
1668 stat = RD_REG_DWORD(&reg->host_status); 1633 stat = RD_REG_DWORD(&reg->host_status);
1669 if (stat & HSRX_RISC_PAUSED) { 1634 if (stat & HSRX_RISC_PAUSED) {
@@ -1716,7 +1681,7 @@ qla24xx_msix_default(int irq, void *dev_id)
1716 } 1681 }
1717 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT); 1682 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
1718 } while (0); 1683 } while (0);
1719 spin_unlock(&ha->hardware_lock); 1684 spin_unlock_irq(&ha->hardware_lock);
1720 1685
1721 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 1686 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
1722 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 1687 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 210060420809..250d2f604397 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2303,8 +2303,6 @@ qla24xx_lun_reset(struct fc_port *fcport, unsigned int l)
2303 return __qla24xx_issue_tmf("Lun", TCF_LUN_RESET, fcport, l); 2303 return __qla24xx_issue_tmf("Lun", TCF_LUN_RESET, fcport, l);
2304} 2304}
2305 2305
2306#if 0
2307
2308int 2306int
2309qla2x00_system_error(scsi_qla_host_t *ha) 2307qla2x00_system_error(scsi_qla_host_t *ha)
2310{ 2308{
@@ -2312,7 +2310,7 @@ qla2x00_system_error(scsi_qla_host_t *ha)
2312 mbx_cmd_t mc; 2310 mbx_cmd_t mc;
2313 mbx_cmd_t *mcp = &mc; 2311 mbx_cmd_t *mcp = &mc;
2314 2312
2315 if (!IS_FWI2_CAPABLE(ha)) 2313 if (!IS_QLA23XX(ha) && !IS_FWI2_CAPABLE(ha))
2316 return QLA_FUNCTION_FAILED; 2314 return QLA_FUNCTION_FAILED;
2317 2315
2318 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); 2316 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
@@ -2334,8 +2332,6 @@ qla2x00_system_error(scsi_qla_host_t *ha)
2334 return rval; 2332 return rval;
2335} 2333}
2336 2334
2337#endif /* 0 */
2338
2339/** 2335/**
2340 * qla2x00_set_serdes_params() - 2336 * qla2x00_set_serdes_params() -
2341 * @ha: HA context 2337 * @ha: HA context
@@ -2508,7 +2504,7 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *ha, dma_addr_t fce_dma,
2508 if (mb) 2504 if (mb)
2509 memcpy(mb, mcp->mb, 8 * sizeof(*mb)); 2505 memcpy(mb, mcp->mb, 8 * sizeof(*mb));
2510 if (dwords) 2506 if (dwords)
2511 *dwords = mcp->mb[6]; 2507 *dwords = buffers;
2512 } 2508 }
2513 2509
2514 return rval; 2510 return rval;
@@ -2807,9 +2803,9 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
2807 */ 2803 */
2808 map = (vp_index - 1) / 8; 2804 map = (vp_index - 1) / 8;
2809 pos = (vp_index - 1) & 7; 2805 pos = (vp_index - 1) & 7;
2810 down(&ha->vport_sem); 2806 mutex_lock(&ha->vport_lock);
2811 vce->vp_idx_map[map] |= 1 << pos; 2807 vce->vp_idx_map[map] |= 1 << pos;
2812 up(&ha->vport_sem); 2808 mutex_unlock(&ha->vport_lock);
2813 2809
2814 rval = qla2x00_issue_iocb(ha, vce, vce_dma, 0); 2810 rval = qla2x00_issue_iocb(ha, vce, vce_dma, 0);
2815 if (rval != QLA_SUCCESS) { 2811 if (rval != QLA_SUCCESS) {
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index f2b04979e5f0..62a3ad6e8ecb 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -32,12 +32,12 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
32 scsi_qla_host_t *ha = vha->parent; 32 scsi_qla_host_t *ha = vha->parent;
33 33
34 /* Find an empty slot and assign an vp_id */ 34 /* Find an empty slot and assign an vp_id */
35 down(&ha->vport_sem); 35 mutex_lock(&ha->vport_lock);
36 vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1); 36 vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1);
37 if (vp_id > ha->max_npiv_vports) { 37 if (vp_id > ha->max_npiv_vports) {
38 DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n", 38 DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n",
39 vp_id, ha->max_npiv_vports)); 39 vp_id, ha->max_npiv_vports));
40 up(&ha->vport_sem); 40 mutex_unlock(&ha->vport_lock);
41 return vp_id; 41 return vp_id;
42 } 42 }
43 43
@@ -45,7 +45,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
45 ha->num_vhosts++; 45 ha->num_vhosts++;
46 vha->vp_idx = vp_id; 46 vha->vp_idx = vp_id;
47 list_add_tail(&vha->vp_list, &ha->vp_list); 47 list_add_tail(&vha->vp_list, &ha->vp_list);
48 up(&ha->vport_sem); 48 mutex_unlock(&ha->vport_lock);
49 return vp_id; 49 return vp_id;
50} 50}
51 51
@@ -55,12 +55,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
55 uint16_t vp_id; 55 uint16_t vp_id;
56 scsi_qla_host_t *ha = vha->parent; 56 scsi_qla_host_t *ha = vha->parent;
57 57
58 down(&ha->vport_sem); 58 mutex_lock(&ha->vport_lock);
59 vp_id = vha->vp_idx; 59 vp_id = vha->vp_idx;
60 ha->num_vhosts--; 60 ha->num_vhosts--;
61 clear_bit(vp_id, ha->vp_idx_map); 61 clear_bit(vp_id, ha->vp_idx_map);
62 list_del(&vha->vp_list); 62 list_del(&vha->vp_list);
63 up(&ha->vport_sem); 63 mutex_unlock(&ha->vport_lock);
64} 64}
65 65
66static scsi_qla_host_t * 66static scsi_qla_host_t *
@@ -145,9 +145,9 @@ qla24xx_enable_vp(scsi_qla_host_t *vha)
145 } 145 }
146 146
147 /* Initialize the new vport unless it is a persistent port */ 147 /* Initialize the new vport unless it is a persistent port */
148 down(&ha->vport_sem); 148 mutex_lock(&ha->vport_lock);
149 ret = qla24xx_modify_vp_config(vha); 149 ret = qla24xx_modify_vp_config(vha);
150 up(&ha->vport_sem); 150 mutex_unlock(&ha->vport_lock);
151 151
152 if (ret != QLA_SUCCESS) { 152 if (ret != QLA_SUCCESS) {
153 fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED); 153 fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED);
@@ -406,6 +406,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
406 INIT_LIST_HEAD(&vha->list); 406 INIT_LIST_HEAD(&vha->list);
407 INIT_LIST_HEAD(&vha->fcports); 407 INIT_LIST_HEAD(&vha->fcports);
408 INIT_LIST_HEAD(&vha->vp_fcports); 408 INIT_LIST_HEAD(&vha->vp_fcports);
409 INIT_LIST_HEAD(&vha->work_list);
409 410
410 vha->dpc_flags = 0L; 411 vha->dpc_flags = 0L;
411 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags); 412 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags);
@@ -437,10 +438,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
437 vha->flags.init_done = 1; 438 vha->flags.init_done = 1;
438 num_hosts++; 439 num_hosts++;
439 440
440 down(&ha->vport_sem); 441 mutex_lock(&ha->vport_lock);
441 set_bit(vha->vp_idx, ha->vp_idx_map); 442 set_bit(vha->vp_idx, ha->vp_idx_map);
442 ha->cur_vport_count++; 443 ha->cur_vport_count++;
443 up(&ha->vport_sem); 444 mutex_unlock(&ha->vport_lock);
444 445
445 return vha; 446 return vha;
446 447
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3223fd16bcfe..48eaa3bb5433 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -10,6 +10,7 @@
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/kthread.h> 12#include <linux/kthread.h>
13#include <linux/mutex.h>
13 14
14#include <scsi/scsi_tcq.h> 15#include <scsi/scsi_tcq.h>
15#include <scsi/scsicam.h> 16#include <scsi/scsicam.h>
@@ -1631,7 +1632,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1631 /* load the F/W, read paramaters, and init the H/W */ 1632 /* load the F/W, read paramaters, and init the H/W */
1632 ha->instance = num_hosts; 1633 ha->instance = num_hosts;
1633 1634
1634 init_MUTEX(&ha->vport_sem); 1635 mutex_init(&ha->vport_lock);
1635 init_completion(&ha->mbx_cmd_comp); 1636 init_completion(&ha->mbx_cmd_comp);
1636 complete(&ha->mbx_cmd_comp); 1637 complete(&ha->mbx_cmd_comp);
1637 init_completion(&ha->mbx_intr_comp); 1638 init_completion(&ha->mbx_intr_comp);
@@ -2156,13 +2157,14 @@ static int
2156qla2x00_post_work(struct scsi_qla_host *ha, struct qla_work_evt *e, int locked) 2157qla2x00_post_work(struct scsi_qla_host *ha, struct qla_work_evt *e, int locked)
2157{ 2158{
2158 unsigned long flags; 2159 unsigned long flags;
2160 scsi_qla_host_t *pha = to_qla_parent(ha);
2159 2161
2160 if (!locked) 2162 if (!locked)
2161 spin_lock_irqsave(&ha->hardware_lock, flags); 2163 spin_lock_irqsave(&pha->hardware_lock, flags);
2162 list_add_tail(&e->list, &ha->work_list); 2164 list_add_tail(&e->list, &ha->work_list);
2163 qla2xxx_wake_dpc(ha); 2165 qla2xxx_wake_dpc(ha);
2164 if (!locked) 2166 if (!locked)
2165 spin_unlock_irqrestore(&ha->hardware_lock, flags); 2167 spin_unlock_irqrestore(&pha->hardware_lock, flags);
2166 return QLA_SUCCESS; 2168 return QLA_SUCCESS;
2167} 2169}
2168 2170
@@ -2202,12 +2204,13 @@ static void
2202qla2x00_do_work(struct scsi_qla_host *ha) 2204qla2x00_do_work(struct scsi_qla_host *ha)
2203{ 2205{
2204 struct qla_work_evt *e; 2206 struct qla_work_evt *e;
2207 scsi_qla_host_t *pha = to_qla_parent(ha);
2205 2208
2206 spin_lock_irq(&ha->hardware_lock); 2209 spin_lock_irq(&pha->hardware_lock);
2207 while (!list_empty(&ha->work_list)) { 2210 while (!list_empty(&ha->work_list)) {
2208 e = list_entry(ha->work_list.next, struct qla_work_evt, list); 2211 e = list_entry(ha->work_list.next, struct qla_work_evt, list);
2209 list_del_init(&e->list); 2212 list_del_init(&e->list);
2210 spin_unlock_irq(&ha->hardware_lock); 2213 spin_unlock_irq(&pha->hardware_lock);
2211 2214
2212 switch (e->type) { 2215 switch (e->type) {
2213 case QLA_EVT_AEN: 2216 case QLA_EVT_AEN:
@@ -2221,9 +2224,9 @@ qla2x00_do_work(struct scsi_qla_host *ha)
2221 } 2224 }
2222 if (e->flags & QLA_EVT_FLAG_FREE) 2225 if (e->flags & QLA_EVT_FLAG_FREE)
2223 kfree(e); 2226 kfree(e);
2224 spin_lock_irq(&ha->hardware_lock); 2227 spin_lock_irq(&pha->hardware_lock);
2225 } 2228 }
2226 spin_unlock_irq(&ha->hardware_lock); 2229 spin_unlock_irq(&pha->hardware_lock);
2227} 2230}
2228 2231
2229/************************************************************************** 2232/**************************************************************************
@@ -2634,7 +2637,7 @@ qla2x00_timer(scsi_qla_host_t *ha)
2634#define FW_FILE_ISP24XX "ql2400_fw.bin" 2637#define FW_FILE_ISP24XX "ql2400_fw.bin"
2635#define FW_FILE_ISP25XX "ql2500_fw.bin" 2638#define FW_FILE_ISP25XX "ql2500_fw.bin"
2636 2639
2637static DECLARE_MUTEX(qla_fw_lock); 2640static DEFINE_MUTEX(qla_fw_lock);
2638 2641
2639static struct fw_blob qla_fw_blobs[FW_BLOBS] = { 2642static struct fw_blob qla_fw_blobs[FW_BLOBS] = {
2640 { .name = FW_FILE_ISP21XX, .segs = { 0x1000, 0 }, }, 2643 { .name = FW_FILE_ISP21XX, .segs = { 0x1000, 0 }, },
@@ -2665,7 +2668,7 @@ qla2x00_request_firmware(scsi_qla_host_t *ha)
2665 blob = &qla_fw_blobs[FW_ISP25XX]; 2668 blob = &qla_fw_blobs[FW_ISP25XX];
2666 } 2669 }
2667 2670
2668 down(&qla_fw_lock); 2671 mutex_lock(&qla_fw_lock);
2669 if (blob->fw) 2672 if (blob->fw)
2670 goto out; 2673 goto out;
2671 2674
@@ -2678,7 +2681,7 @@ qla2x00_request_firmware(scsi_qla_host_t *ha)
2678 } 2681 }
2679 2682
2680out: 2683out:
2681 up(&qla_fw_lock); 2684 mutex_unlock(&qla_fw_lock);
2682 return blob; 2685 return blob;
2683} 2686}
2684 2687
@@ -2687,11 +2690,11 @@ qla2x00_release_firmware(void)
2687{ 2690{
2688 int idx; 2691 int idx;
2689 2692
2690 down(&qla_fw_lock); 2693 mutex_lock(&qla_fw_lock);
2691 for (idx = 0; idx < FW_BLOBS; idx++) 2694 for (idx = 0; idx < FW_BLOBS; idx++)
2692 if (qla_fw_blobs[idx].fw) 2695 if (qla_fw_blobs[idx].fw)
2693 release_firmware(qla_fw_blobs[idx].fw); 2696 release_firmware(qla_fw_blobs[idx].fw);
2694 up(&qla_fw_lock); 2697 mutex_unlock(&qla_fw_lock);
2695} 2698}
2696 2699
2697static pci_ers_result_t 2700static pci_ers_result_t
@@ -2864,7 +2867,8 @@ qla2x00_module_init(void)
2864 return -ENODEV; 2867 return -ENODEV;
2865 } 2868 }
2866 2869
2867 printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n"); 2870 printk(KERN_INFO "QLogic Fibre Channel HBA Driver: %s\n",
2871 qla2x00_version_str);
2868 ret = pci_register_driver(&qla2xxx_pci_driver); 2872 ret = pci_register_driver(&qla2xxx_pci_driver);
2869 if (ret) { 2873 if (ret) {
2870 kmem_cache_destroy(srb_cachep); 2874 kmem_cache_destroy(srb_cachep);
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index afeae2bfe7eb..d058c8862b35 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.02.01-k2" 10#define QLA2XXX_VERSION "8.02.01-k4"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 2 13#define QLA_DRIVER_MINOR_VER 2
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 049103f1d16f..93d2b6714453 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -359,7 +359,12 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
359 359
360static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) 360static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
361{ 361{
362 struct scsi_device *sdev = to_scsi_device(dev); 362 struct scsi_device *sdev;
363
364 if (dev->type != &scsi_dev_type)
365 return 0;
366
367 sdev = to_scsi_device(dev);
363 368
364 add_uevent_var(env, "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type); 369 add_uevent_var(env, "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type);
365 return 0; 370 return 0;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index c9d7f721b9e2..ea0edd1b2e76 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1441,17 +1441,18 @@ sg_add(struct device *cl_dev, struct class_interface *cl_intf)
1441 if (sg_sysfs_valid) { 1441 if (sg_sysfs_valid) {
1442 struct device *sg_class_member; 1442 struct device *sg_class_member;
1443 1443
1444 sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, 1444 sg_class_member = device_create_drvdata(sg_sysfs_class,
1445 MKDEV(SCSI_GENERIC_MAJOR, 1445 cl_dev->parent,
1446 sdp->index), 1446 MKDEV(SCSI_GENERIC_MAJOR,
1447 "%s", disk->disk_name); 1447 sdp->index),
1448 sdp,
1449 "%s", disk->disk_name);
1448 if (IS_ERR(sg_class_member)) { 1450 if (IS_ERR(sg_class_member)) {
1449 printk(KERN_ERR "sg_add: " 1451 printk(KERN_ERR "sg_add: "
1450 "device_create failed\n"); 1452 "device_create failed\n");
1451 error = PTR_ERR(sg_class_member); 1453 error = PTR_ERR(sg_class_member);
1452 goto cdev_add_err; 1454 goto cdev_add_err;
1453 } 1455 }
1454 dev_set_drvdata(sg_class_member, sdp);
1455 error = sysfs_create_link(&scsidp->sdev_gendev.kobj, 1456 error = sysfs_create_link(&scsidp->sdev_gendev.kobj,
1456 &sg_class_member->kobj, "generic"); 1457 &sg_class_member->kobj, "generic");
1457 if (error) 1458 if (error)
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index e8db66ad0bde..6e5a5bb31311 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4424,17 +4424,19 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
4424 snprintf(name, 10, "%s%s%s", rew ? "n" : "", 4424 snprintf(name, 10, "%s%s%s", rew ? "n" : "",
4425 STp->disk->disk_name, st_formats[i]); 4425 STp->disk->disk_name, st_formats[i]);
4426 st_class_member = 4426 st_class_member =
4427 device_create(st_sysfs_class, &STp->device->sdev_gendev, 4427 device_create_drvdata(st_sysfs_class,
4428 MKDEV(SCSI_TAPE_MAJOR, 4428 &STp->device->sdev_gendev,
4429 TAPE_MINOR(dev_num, mode, rew)), 4429 MKDEV(SCSI_TAPE_MAJOR,
4430 "%s", name); 4430 TAPE_MINOR(dev_num,
4431 mode, rew)),
4432 &STp->modes[mode],
4433 "%s", name);
4431 if (IS_ERR(st_class_member)) { 4434 if (IS_ERR(st_class_member)) {
4432 printk(KERN_WARNING "st%d: device_create failed\n", 4435 printk(KERN_WARNING "st%d: device_create failed\n",
4433 dev_num); 4436 dev_num);
4434 error = PTR_ERR(st_class_member); 4437 error = PTR_ERR(st_class_member);
4435 goto out; 4438 goto out;
4436 } 4439 }
4437 dev_set_drvdata(st_class_member, &STp->modes[mode]);
4438 4440
4439 error = device_create_file(st_class_member, 4441 error = device_create_file(st_class_member,
4440 &dev_attr_defined); 4442 &dev_attr_defined);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index a1ca9b7bf2d5..1bc00b721e9d 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -93,7 +93,6 @@ static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS;
93#define CONFIG_HUB6 1 93#define CONFIG_HUB6 1
94 94
95#include <asm/serial.h> 95#include <asm/serial.h>
96
97/* 96/*
98 * SERIAL_PORT_DFNS tells us about built-in ports that have no 97 * SERIAL_PORT_DFNS tells us about built-in ports that have no
99 * standard enumeration mechanism. Platforms that can find all 98 * standard enumeration mechanism. Platforms that can find all
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 53fa19cf2f06..788c3559522d 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -2602,7 +2602,12 @@ static struct pci_device_id serial_pci_tbl[] = {
2602 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, 2602 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
2603 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */ 2603 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
2604 pbn_b2_2_115200 }, 2604 pbn_b2_2_115200 },
2605 2605 /*
2606 * IntaShield IS-400
2607 */
2608 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
2609 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
2610 pbn_b2_4_115200 },
2606 /* 2611 /*
2607 * Perle PCI-RAS cards 2612 * Perle PCI-RAS cards
2608 */ 2613 */
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 36acbcca2d48..9bc42763623c 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -976,11 +976,15 @@ config SERIAL_68328_RTS_CTS
976 depends on SERIAL_68328 976 depends on SERIAL_68328
977 977
978config SERIAL_COLDFIRE 978config SERIAL_COLDFIRE
979 bool "ColdFire serial support" 979 bool "ColdFire serial support (DEPRECATED)"
980 depends on COLDFIRE 980 depends on COLDFIRE
981 help 981 help
982 This driver supports the built-in serial ports of the Motorola ColdFire 982 This driver supports the built-in serial ports of the Motorola ColdFire
983 family of CPUs. 983 family of CPUs.
984 This driver is deprecated because it supports only the old interface
985 for serial drivers and features like magic keys are not working.
986 Please switch to the new style driver because this driver will be
987 removed soon.
984 988
985config SERIAL_MCF 989config SERIAL_MCF
986 bool "Coldfire serial support (new style driver)" 990 bool "Coldfire serial support (new style driver)"
@@ -1357,7 +1361,7 @@ config SERIAL_SC26XX_CONSOLE
1357 1361
1358config SERIAL_BFIN_SPORT 1362config SERIAL_BFIN_SPORT
1359 tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)" 1363 tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)"
1360 depends on BFIN && EXPERIMENTAL 1364 depends on BLACKFIN && EXPERIMENTAL
1361 select SERIAL_CORE 1365 select SERIAL_CORE
1362 help 1366 help
1363 Enble support SPORT emulate UART on Blackfin series. 1367 Enble support SPORT emulate UART on Blackfin series.
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index c065a704a93a..42be8b01a40f 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1318,7 +1318,7 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
1318 * If the baud rate generator isn't running, the port wasn't 1318 * If the baud rate generator isn't running, the port wasn't
1319 * initialized by the boot loader. 1319 * initialized by the boot loader.
1320 */ 1320 */
1321 quot = UART_GET_BRGR(port); 1321 quot = UART_GET_BRGR(port) & ATMEL_US_CD;
1322 if (!quot) 1322 if (!quot)
1323 return; 1323 return;
1324 1324
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index d6b4ead693b7..f20952c43cb8 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -530,11 +530,7 @@ static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
530 if (uart->cts_pin < 0) 530 if (uart->cts_pin < 0)
531 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; 531 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
532 532
533# ifdef BF54x 533 if (UART_GET_CTS(uart))
534 if (UART_GET_MSR(uart) & CTS)
535# else
536 if (gpio_get_value(uart->cts_pin))
537# endif
538 return TIOCM_DSR | TIOCM_CAR; 534 return TIOCM_DSR | TIOCM_CAR;
539 else 535 else
540#endif 536#endif
@@ -549,17 +545,9 @@ static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
549 return; 545 return;
550 546
551 if (mctrl & TIOCM_RTS) 547 if (mctrl & TIOCM_RTS)
552# ifdef BF54x 548 UART_CLEAR_RTS(uart);
553 UART_PUT_MCR(uart, UART_GET_MCR(uart) & ~MRTS);
554# else
555 gpio_set_value(uart->rts_pin, 0);
556# endif
557 else 549 else
558# ifdef BF54x 550 UART_SET_RTS(uart);
559 UART_PUT_MCR(uart, UART_GET_MCR(uart) | MRTS);
560# else
561 gpio_set_value(uart->rts_pin, 1);
562# endif
563#endif 551#endif
564} 552}
565 553
@@ -752,11 +740,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
752 740
753 /* Disable UART */ 741 /* Disable UART */
754 ier = UART_GET_IER(uart); 742 ier = UART_GET_IER(uart);
755#ifdef CONFIG_BF54x 743 UART_DISABLE_INTS(uart);
756 UART_CLEAR_IER(uart, 0xF);
757#else
758 UART_PUT_IER(uart, 0);
759#endif
760 744
761 /* Set DLAB in LCR to Access DLL and DLH */ 745 /* Set DLAB in LCR to Access DLL and DLH */
762 UART_SET_DLAB(uart); 746 UART_SET_DLAB(uart);
@@ -771,11 +755,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
771 UART_PUT_LCR(uart, lcr); 755 UART_PUT_LCR(uart, lcr);
772 756
773 /* Enable UART */ 757 /* Enable UART */
774#ifdef CONFIG_BF54x 758 UART_ENABLE_INTS(uart, ier);
775 UART_SET_IER(uart, ier);
776#else
777 UART_PUT_IER(uart, ier);
778#endif
779 759
780 val = UART_GET_GCTL(uart); 760 val = UART_GET_GCTL(uart);
781 val |= UCEN; 761 val |= UCEN;
@@ -833,15 +813,15 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
833 * Enable the IrDA function if tty->ldisc.num is N_IRDA. 813 * Enable the IrDA function if tty->ldisc.num is N_IRDA.
834 * In other cases, disable IrDA function. 814 * In other cases, disable IrDA function.
835 */ 815 */
836static void bfin_set_ldisc(struct tty_struct *tty) 816static void bfin_serial_set_ldisc(struct uart_port *port)
837{ 817{
838 int line = tty->index; 818 int line = port->line;
839 unsigned short val; 819 unsigned short val;
840 820
841 if (line >= tty->driver->num) 821 if (line >= port->info->tty->driver->num)
842 return; 822 return;
843 823
844 switch (tty->ldisc.num) { 824 switch (port->info->tty->ldisc.num) {
845 case N_IRDA: 825 case N_IRDA:
846 val = UART_GET_GCTL(&bfin_serial_ports[line]); 826 val = UART_GET_GCTL(&bfin_serial_ports[line]);
847 val |= (IREN | RPOLC); 827 val |= (IREN | RPOLC);
@@ -866,6 +846,7 @@ static struct uart_ops bfin_serial_pops = {
866 .startup = bfin_serial_startup, 846 .startup = bfin_serial_startup,
867 .shutdown = bfin_serial_shutdown, 847 .shutdown = bfin_serial_shutdown,
868 .set_termios = bfin_serial_set_termios, 848 .set_termios = bfin_serial_set_termios,
849 .set_ldisc = bfin_serial_set_ldisc,
869 .type = bfin_serial_type, 850 .type = bfin_serial_type,
870 .release_port = bfin_serial_release_port, 851 .release_port = bfin_serial_release_port,
871 .request_port = bfin_serial_request_port, 852 .request_port = bfin_serial_request_port,
@@ -1206,7 +1187,6 @@ static int __init bfin_serial_init(void)
1206 1187
1207 ret = uart_register_driver(&bfin_serial_reg); 1188 ret = uart_register_driver(&bfin_serial_reg);
1208 if (ret == 0) { 1189 if (ret == 0) {
1209 bfin_serial_reg.tty_driver->set_ldisc = bfin_set_ldisc;
1210 ret = platform_driver_register(&bfin_serial_driver); 1190 ret = platform_driver_register(&bfin_serial_driver);
1211 if (ret) { 1191 if (ret) {
1212 pr_debug("uart register failed\n"); 1192 pr_debug("uart register failed\n");
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index f9fa237aa949..3e0366eab412 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -3808,7 +3808,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
3808 3808
3809 shutdown(info); 3809 shutdown(info);
3810 rs_flush_buffer(tty); 3810 rs_flush_buffer(tty);
3811 tty_ldisc_flush_buffer(tty); 3811 tty_ldisc_flush(tty);
3812 tty->closing = 0; 3812 tty->closing = 0;
3813 info->event = 0; 3813 info->event = 0;
3814 info->tty = 0; 3814 info->tty = 0;
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 43af40d59b8a..56007cc8a9b3 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -1,3 +1,4 @@
1#warning This driver is deprecated. Check Kconfig for details.
1/* 2/*
2 * mcfserial.c -- serial driver for ColdFire internal UARTS. 3 * mcfserial.c -- serial driver for ColdFire internal UARTS.
3 * 4 *
diff --git a/drivers/serial/sb1250-duart.c b/drivers/serial/sb1250-duart.c
index 2d6c08b3dbcf..f8e1447a022a 100644
--- a/drivers/serial/sb1250-duart.c
+++ b/drivers/serial/sb1250-duart.c
@@ -924,7 +924,7 @@ console_initcall(sbd_serial_console_init);
924 924
925static struct uart_driver sbd_reg = { 925static struct uart_driver sbd_reg = {
926 .owner = THIS_MODULE, 926 .owner = THIS_MODULE,
927 .driver_name = "serial", 927 .driver_name = "sb1250_duart",
928 .dev_name = "duart", 928 .dev_name = "duart",
929 .major = TTY_MAJOR, 929 .major = TTY_MAJOR,
930 .minor = SB1250_DUART_MINOR_BASE, 930 .minor = SB1250_DUART_MINOR_BASE,
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index eab032733790..c9b64e73c987 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1165,6 +1165,15 @@ out:
1165 return ret; 1165 return ret;
1166} 1166}
1167 1167
1168static void uart_set_ldisc(struct tty_struct *tty)
1169{
1170 struct uart_state *state = tty->driver_data;
1171 struct uart_port *port = state->port;
1172
1173 if (port->ops->set_ldisc)
1174 port->ops->set_ldisc(port);
1175}
1176
1168static void uart_set_termios(struct tty_struct *tty, 1177static void uart_set_termios(struct tty_struct *tty,
1169 struct ktermios *old_termios) 1178 struct ktermios *old_termios)
1170{ 1179{
@@ -2054,6 +2063,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
2054int uart_resume_port(struct uart_driver *drv, struct uart_port *port) 2063int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2055{ 2064{
2056 struct uart_state *state = drv->state + port->line; 2065 struct uart_state *state = drv->state + port->line;
2066 struct device *tty_dev;
2067 struct uart_match match = {port, drv};
2057 2068
2058 mutex_lock(&state->mutex); 2069 mutex_lock(&state->mutex);
2059 2070
@@ -2063,7 +2074,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2063 return 0; 2074 return 0;
2064 } 2075 }
2065 2076
2066 if (!port->suspended) { 2077 tty_dev = device_find_child(port->dev, &match, serial_match_port);
2078 if (!port->suspended && device_may_wakeup(tty_dev)) {
2067 disable_irq_wake(port->irq); 2079 disable_irq_wake(port->irq);
2068 mutex_unlock(&state->mutex); 2080 mutex_unlock(&state->mutex);
2069 return 0; 2081 return 0;
@@ -2285,6 +2297,7 @@ static const struct tty_operations uart_ops = {
2285 .unthrottle = uart_unthrottle, 2297 .unthrottle = uart_unthrottle,
2286 .send_xchar = uart_send_xchar, 2298 .send_xchar = uart_send_xchar,
2287 .set_termios = uart_set_termios, 2299 .set_termios = uart_set_termios,
2300 .set_ldisc = uart_set_ldisc,
2288 .stop = uart_stop, 2301 .stop = uart_stop,
2289 .start = uart_start, 2302 .start = uart_start,
2290 .hangup = uart_hangup, 2303 .hangup = uart_hangup,
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 8fdafc27fce8..ce6ee92b3a1b 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -184,15 +184,15 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count)
184 int h, l; 184 int h, l;
185 185
186 c = *p++; 186 c = *p++;
187 h = highhex(c); 187 h = hex_asc_hi(c);
188 l = lowhex(c); 188 l = hex_asc_lo(c);
189 put_char(port, h); 189 put_char(port, h);
190 put_char(port, l); 190 put_char(port, l);
191 checksum += h + l; 191 checksum += h + l;
192 } 192 }
193 put_char(port, '#'); 193 put_char(port, '#');
194 put_char(port, highhex(checksum)); 194 put_char(port, hex_asc_hi(checksum));
195 put_char(port, lowhex(checksum)); 195 put_char(port, hex_asc_lo(checksum));
196 } while (get_char(port) != '+'); 196 } while (get_char(port) != '+');
197 } else 197 } else
198#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ 198#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 145c0281495d..2847336742d7 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -499,7 +499,6 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig
499 } else 499 } else
500 spin_lock(&port->lock); 500 spin_lock(&port->lock);
501 501
502 spin_lock_irqsave(&port->lock, flags);
503 for (i = 0; i < n; i++) { 502 for (i = 0; i < n; i++) {
504 if (*s == '\n') 503 if (*s == '\n')
505 sunhv_console_putchar(port, '\r'); 504 sunhv_console_putchar(port, '\r');
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index 01917c433f17..566a8b42e05a 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -195,7 +195,7 @@ struct uart_qe_port {
195 195
196static struct uart_driver ucc_uart_driver = { 196static struct uart_driver ucc_uart_driver = {
197 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
198 .driver_name = "serial", 198 .driver_name = "ucc_uart",
199 .dev_name = "ttyQE", 199 .dev_name = "ttyQE",
200 .major = SERIAL_QE_MAJOR, 200 .major = SERIAL_QE_MAJOR,
201 .minor = SERIAL_QE_MINOR, 201 .minor = SERIAL_QE_MINOR,
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index fae9e8f3d092..66ec5d8808de 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -126,7 +126,6 @@ config SPI_MPC52xx_PSC
126config SPI_MPC83xx 126config SPI_MPC83xx
127 tristate "Freescale MPC83xx/QUICC Engine SPI controller" 127 tristate "Freescale MPC83xx/QUICC Engine SPI controller"
128 depends on SPI_MASTER && (PPC_83xx || QUICC_ENGINE) && EXPERIMENTAL 128 depends on SPI_MASTER && (PPC_83xx || QUICC_ENGINE) && EXPERIMENTAL
129 select SPI_BITBANG
130 help 129 help
131 This enables using the Freescale MPC83xx and QUICC Engine SPI 130 This enables using the Freescale MPC83xx and QUICC Engine SPI
132 controllers in master mode. 131 controllers in master mode.
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 90729469d481..681d62325d3d 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * MPC52xx SPC in SPI mode driver. 2 * MPC52xx PSC in SPI mode driver.
3 * 3 *
4 * Maintainer: Dragos Carp 4 * Maintainer: Dragos Carp
5 * 5 *
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 654bb58be630..0c452c46ab07 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1567,7 +1567,7 @@ static int pxa2xx_spi_resume(struct platform_device *pdev)
1567 int status = 0; 1567 int status = 0;
1568 1568
1569 /* Enable the SSP clock */ 1569 /* Enable the SSP clock */
1570 clk_disable(ssp->clk); 1570 clk_enable(ssp->clk);
1571 1571
1572 /* Start the queue running */ 1572 /* Start the queue running */
1573 status = start_queue(drv_data); 1573 status = start_queue(drv_data);
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 189f706b9e4b..6832da6f7109 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -49,6 +49,7 @@ struct mpc83xx_spi_reg {
49#define SPMODE_LEN(x) ((x) << 20) 49#define SPMODE_LEN(x) ((x) << 20)
50#define SPMODE_PM(x) ((x) << 16) 50#define SPMODE_PM(x) ((x) << 16)
51#define SPMODE_OP (1 << 14) 51#define SPMODE_OP (1 << 14)
52#define SPMODE_CG(x) ((x) << 7)
52 53
53/* 54/*
54 * Default for SPI Mode: 55 * Default for SPI Mode:
@@ -67,10 +68,6 @@ struct mpc83xx_spi_reg {
67 68
68/* SPI Controller driver's private data. */ 69/* SPI Controller driver's private data. */
69struct mpc83xx_spi { 70struct mpc83xx_spi {
70 /* bitbang has to be first */
71 struct spi_bitbang bitbang;
72 struct completion done;
73
74 struct mpc83xx_spi_reg __iomem *base; 71 struct mpc83xx_spi_reg __iomem *base;
75 72
76 /* rx & tx bufs from the spi_transfer */ 73 /* rx & tx bufs from the spi_transfer */
@@ -82,7 +79,7 @@ struct mpc83xx_spi {
82 u32(*get_tx) (struct mpc83xx_spi *); 79 u32(*get_tx) (struct mpc83xx_spi *);
83 80
84 unsigned int count; 81 unsigned int count;
85 u32 irq; 82 int irq;
86 83
87 unsigned nsecs; /* (clock cycle time)/2 */ 84 unsigned nsecs; /* (clock cycle time)/2 */
88 85
@@ -94,6 +91,25 @@ struct mpc83xx_spi {
94 91
95 void (*activate_cs) (u8 cs, u8 polarity); 92 void (*activate_cs) (u8 cs, u8 polarity);
96 void (*deactivate_cs) (u8 cs, u8 polarity); 93 void (*deactivate_cs) (u8 cs, u8 polarity);
94
95 u8 busy;
96
97 struct workqueue_struct *workqueue;
98 struct work_struct work;
99
100 struct list_head queue;
101 spinlock_t lock;
102
103 struct completion done;
104};
105
106struct spi_mpc83xx_cs {
107 /* functions to deal with different sized buffers */
108 void (*get_rx) (u32 rx_data, struct mpc83xx_spi *);
109 u32 (*get_tx) (struct mpc83xx_spi *);
110 u32 rx_shift; /* RX data reg shift when in qe mode */
111 u32 tx_shift; /* TX data reg shift when in qe mode */
112 u32 hw_mode; /* Holds HW mode register settings */
97}; 113};
98 114
99static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val) 115static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)
@@ -137,6 +153,7 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
137{ 153{
138 struct mpc83xx_spi *mpc83xx_spi; 154 struct mpc83xx_spi *mpc83xx_spi;
139 u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0; 155 u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0;
156 struct spi_mpc83xx_cs *cs = spi->controller_state;
140 157
141 mpc83xx_spi = spi_master_get_devdata(spi->master); 158 mpc83xx_spi = spi_master_get_devdata(spi->master);
142 159
@@ -147,50 +164,26 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
147 164
148 if (value == BITBANG_CS_ACTIVE) { 165 if (value == BITBANG_CS_ACTIVE) {
149 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); 166 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
150 u32 len = spi->bits_per_word;
151 u8 pm;
152 167
153 if (len == 32) 168 mpc83xx_spi->rx_shift = cs->rx_shift;
154 len = 0; 169 mpc83xx_spi->tx_shift = cs->tx_shift;
155 else 170 mpc83xx_spi->get_rx = cs->get_rx;
156 len = len - 1; 171 mpc83xx_spi->get_tx = cs->get_tx;
157 172
158 /* mask out bits we are going to set */ 173 if (cs->hw_mode != regval) {
159 regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH 174 unsigned long flags;
160 | SPMODE_LEN(0xF) | SPMODE_DIV16 175 void *tmp_ptr = &mpc83xx_spi->base->mode;
161 | SPMODE_PM(0xF) | SPMODE_REV | SPMODE_LOOP); 176
162 177 regval = cs->hw_mode;
163 if (spi->mode & SPI_CPHA) 178 /* Turn off IRQs locally to minimize time that
164 regval |= SPMODE_CP_BEGIN_EDGECLK; 179 * SPI is disabled
165 if (spi->mode & SPI_CPOL) 180 */
166 regval |= SPMODE_CI_INACTIVEHIGH; 181 local_irq_save(flags);
167 if (!(spi->mode & SPI_LSB_FIRST)) 182 /* Turn off SPI unit prior changing mode */
168 regval |= SPMODE_REV; 183 mpc83xx_spi_write_reg(tmp_ptr, regval & ~SPMODE_ENABLE);
169 if (spi->mode & SPI_LOOP) 184 mpc83xx_spi_write_reg(tmp_ptr, regval);
170 regval |= SPMODE_LOOP; 185 local_irq_restore(flags);
171
172 regval |= SPMODE_LEN(len);
173
174 if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) {
175 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64) - 1;
176 if (pm > 0x0f) {
177 dev_err(&spi->dev, "Requested speed is too "
178 "low: %d Hz. Will use %d Hz instead.\n",
179 spi->max_speed_hz,
180 mpc83xx_spi->spibrg / 1024);
181 pm = 0x0f;
182 }
183 regval |= SPMODE_PM(pm) | SPMODE_DIV16;
184 } else {
185 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);
186 if (pm)
187 pm--;
188 regval |= SPMODE_PM(pm);
189 } 186 }
190
191 /* Turn off SPI unit prior changing mode */
192 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
193 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
194 if (mpc83xx_spi->activate_cs) 187 if (mpc83xx_spi->activate_cs)
195 mpc83xx_spi->activate_cs(spi->chip_select, pol); 188 mpc83xx_spi->activate_cs(spi->chip_select, pol);
196 } 189 }
@@ -201,8 +194,9 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
201{ 194{
202 struct mpc83xx_spi *mpc83xx_spi; 195 struct mpc83xx_spi *mpc83xx_spi;
203 u32 regval; 196 u32 regval;
204 u8 bits_per_word; 197 u8 bits_per_word, pm;
205 u32 hz; 198 u32 hz;
199 struct spi_mpc83xx_cs *cs = spi->controller_state;
206 200
207 mpc83xx_spi = spi_master_get_devdata(spi->master); 201 mpc83xx_spi = spi_master_get_devdata(spi->master);
208 202
@@ -223,61 +217,191 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
223 || ((bits_per_word > 16) && (bits_per_word != 32))) 217 || ((bits_per_word > 16) && (bits_per_word != 32)))
224 return -EINVAL; 218 return -EINVAL;
225 219
226 mpc83xx_spi->rx_shift = 0; 220 if (!hz)
227 mpc83xx_spi->tx_shift = 0; 221 hz = spi->max_speed_hz;
222
223 cs->rx_shift = 0;
224 cs->tx_shift = 0;
228 if (bits_per_word <= 8) { 225 if (bits_per_word <= 8) {
229 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; 226 cs->get_rx = mpc83xx_spi_rx_buf_u8;
230 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; 227 cs->get_tx = mpc83xx_spi_tx_buf_u8;
231 if (mpc83xx_spi->qe_mode) { 228 if (mpc83xx_spi->qe_mode) {
232 mpc83xx_spi->rx_shift = 16; 229 cs->rx_shift = 16;
233 mpc83xx_spi->tx_shift = 24; 230 cs->tx_shift = 24;
234 } 231 }
235 } else if (bits_per_word <= 16) { 232 } else if (bits_per_word <= 16) {
236 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16; 233 cs->get_rx = mpc83xx_spi_rx_buf_u16;
237 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16; 234 cs->get_tx = mpc83xx_spi_tx_buf_u16;
238 if (mpc83xx_spi->qe_mode) { 235 if (mpc83xx_spi->qe_mode) {
239 mpc83xx_spi->rx_shift = 16; 236 cs->rx_shift = 16;
240 mpc83xx_spi->tx_shift = 16; 237 cs->tx_shift = 16;
241 } 238 }
242 } else if (bits_per_word <= 32) { 239 } else if (bits_per_word <= 32) {
243 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32; 240 cs->get_rx = mpc83xx_spi_rx_buf_u32;
244 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32; 241 cs->get_tx = mpc83xx_spi_tx_buf_u32;
245 } else 242 } else
246 return -EINVAL; 243 return -EINVAL;
247 244
248 if (mpc83xx_spi->qe_mode && spi->mode & SPI_LSB_FIRST) { 245 if (mpc83xx_spi->qe_mode && spi->mode & SPI_LSB_FIRST) {
249 mpc83xx_spi->tx_shift = 0; 246 cs->tx_shift = 0;
250 if (bits_per_word <= 8) 247 if (bits_per_word <= 8)
251 mpc83xx_spi->rx_shift = 8; 248 cs->rx_shift = 8;
252 else 249 else
253 mpc83xx_spi->rx_shift = 0; 250 cs->rx_shift = 0;
254 } 251 }
255 252
256 /* nsecs = (clock period)/2 */ 253 mpc83xx_spi->rx_shift = cs->rx_shift;
257 if (!hz) 254 mpc83xx_spi->tx_shift = cs->tx_shift;
258 hz = spi->max_speed_hz; 255 mpc83xx_spi->get_rx = cs->get_rx;
259 mpc83xx_spi->nsecs = (1000000000 / 2) / hz; 256 mpc83xx_spi->get_tx = cs->get_tx;
260 if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000)
261 return -EINVAL;
262 257
263 if (bits_per_word == 32) 258 if (bits_per_word == 32)
264 bits_per_word = 0; 259 bits_per_word = 0;
265 else 260 else
266 bits_per_word = bits_per_word - 1; 261 bits_per_word = bits_per_word - 1;
267 262
268 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
269
270 /* mask out bits we are going to set */ 263 /* mask out bits we are going to set */
271 regval &= ~(SPMODE_LEN(0xF) | SPMODE_REV); 264 cs->hw_mode &= ~(SPMODE_LEN(0xF) | SPMODE_DIV16
272 regval |= SPMODE_LEN(bits_per_word); 265 | SPMODE_PM(0xF));
273 if (!(spi->mode & SPI_LSB_FIRST)) 266
274 regval |= SPMODE_REV; 267 cs->hw_mode |= SPMODE_LEN(bits_per_word);
268
269 if ((mpc83xx_spi->spibrg / hz) >= 64) {
270 pm = mpc83xx_spi->spibrg / (hz * 64) - 1;
271 if (pm > 0x0f) {
272 dev_err(&spi->dev, "Requested speed is too "
273 "low: %d Hz. Will use %d Hz instead.\n",
274 hz, mpc83xx_spi->spibrg / 1024);
275 pm = 0x0f;
276 }
277 cs->hw_mode |= SPMODE_PM(pm) | SPMODE_DIV16;
278 } else {
279 pm = mpc83xx_spi->spibrg / (hz * 4);
280 if (pm)
281 pm--;
282 cs->hw_mode |= SPMODE_PM(pm);
283 }
284 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
285 if (cs->hw_mode != regval) {
286 unsigned long flags;
287 void *tmp_ptr = &mpc83xx_spi->base->mode;
288
289 regval = cs->hw_mode;
290 /* Turn off IRQs locally to minimize time
291 * that SPI is disabled
292 */
293 local_irq_save(flags);
294 /* Turn off SPI unit prior changing mode */
295 mpc83xx_spi_write_reg(tmp_ptr, regval & ~SPMODE_ENABLE);
296 mpc83xx_spi_write_reg(tmp_ptr, regval);
297 local_irq_restore(flags);
298 }
299 return 0;
300}
275 301
276 /* Turn off SPI unit prior changing mode */ 302static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
277 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0); 303{
278 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); 304 struct mpc83xx_spi *mpc83xx_spi;
305 u32 word, len, bits_per_word;
279 306
280 return 0; 307 mpc83xx_spi = spi_master_get_devdata(spi->master);
308
309 mpc83xx_spi->tx = t->tx_buf;
310 mpc83xx_spi->rx = t->rx_buf;
311 bits_per_word = spi->bits_per_word;
312 if (t->bits_per_word)
313 bits_per_word = t->bits_per_word;
314 len = t->len;
315 if (bits_per_word > 8)
316 len /= 2;
317 if (bits_per_word > 16)
318 len /= 2;
319 mpc83xx_spi->count = len;
320 INIT_COMPLETION(mpc83xx_spi->done);
321
322 /* enable rx ints */
323 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);
324
325 /* transmit word */
326 word = mpc83xx_spi->get_tx(mpc83xx_spi);
327 mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);
328
329 wait_for_completion(&mpc83xx_spi->done);
330
331 /* disable rx ints */
332 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
333
334 return mpc83xx_spi->count;
335}
336
337static void mpc83xx_spi_work(struct work_struct *work)
338{
339 struct mpc83xx_spi *mpc83xx_spi =
340 container_of(work, struct mpc83xx_spi, work);
341
342 spin_lock_irq(&mpc83xx_spi->lock);
343 mpc83xx_spi->busy = 1;
344 while (!list_empty(&mpc83xx_spi->queue)) {
345 struct spi_message *m;
346 struct spi_device *spi;
347 struct spi_transfer *t = NULL;
348 unsigned cs_change;
349 int status, nsecs = 50;
350
351 m = container_of(mpc83xx_spi->queue.next,
352 struct spi_message, queue);
353 list_del_init(&m->queue);
354 spin_unlock_irq(&mpc83xx_spi->lock);
355
356 spi = m->spi;
357 cs_change = 1;
358 status = 0;
359 list_for_each_entry(t, &m->transfers, transfer_list) {
360 if (t->bits_per_word || t->speed_hz) {
361 /* Don't allow changes if CS is active */
362 status = -EINVAL;
363
364 if (cs_change)
365 status = mpc83xx_spi_setup_transfer(spi, t);
366 if (status < 0)
367 break;
368 }
369
370 if (cs_change)
371 mpc83xx_spi_chipselect(spi, BITBANG_CS_ACTIVE);
372 cs_change = t->cs_change;
373 if (t->len)
374 status = mpc83xx_spi_bufs(spi, t);
375 if (status) {
376 status = -EMSGSIZE;
377 break;
378 }
379 m->actual_length += t->len;
380
381 if (t->delay_usecs)
382 udelay(t->delay_usecs);
383
384 if (cs_change) {
385 ndelay(nsecs);
386 mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
387 ndelay(nsecs);
388 }
389 }
390
391 m->status = status;
392 m->complete(m->context);
393
394 if (status || !cs_change) {
395 ndelay(nsecs);
396 mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
397 }
398
399 mpc83xx_spi_setup_transfer(spi, NULL);
400
401 spin_lock_irq(&mpc83xx_spi->lock);
402 }
403 mpc83xx_spi->busy = 0;
404 spin_unlock_irq(&mpc83xx_spi->lock);
281} 405}
282 406
283/* the spi->mode bits understood by this driver: */ 407/* the spi->mode bits understood by this driver: */
@@ -286,9 +410,10 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
286 410
287static int mpc83xx_spi_setup(struct spi_device *spi) 411static int mpc83xx_spi_setup(struct spi_device *spi)
288{ 412{
289 struct spi_bitbang *bitbang;
290 struct mpc83xx_spi *mpc83xx_spi; 413 struct mpc83xx_spi *mpc83xx_spi;
291 int retval; 414 int retval;
415 u32 hw_mode;
416 struct spi_mpc83xx_cs *cs = spi->controller_state;
292 417
293 if (spi->mode & ~MODEBITS) { 418 if (spi->mode & ~MODEBITS) {
294 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n", 419 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
@@ -299,63 +424,56 @@ static int mpc83xx_spi_setup(struct spi_device *spi)
299 if (!spi->max_speed_hz) 424 if (!spi->max_speed_hz)
300 return -EINVAL; 425 return -EINVAL;
301 426
302 bitbang = spi_master_get_devdata(spi->master); 427 if (!cs) {
428 cs = kzalloc(sizeof *cs, GFP_KERNEL);
429 if (!cs)
430 return -ENOMEM;
431 spi->controller_state = cs;
432 }
303 mpc83xx_spi = spi_master_get_devdata(spi->master); 433 mpc83xx_spi = spi_master_get_devdata(spi->master);
304 434
305 if (!spi->bits_per_word) 435 if (!spi->bits_per_word)
306 spi->bits_per_word = 8; 436 spi->bits_per_word = 8;
307 437
438 hw_mode = cs->hw_mode; /* Save orginal settings */
439 cs->hw_mode = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
440 /* mask out bits we are going to set */
441 cs->hw_mode &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
442 | SPMODE_REV | SPMODE_LOOP);
443
444 if (spi->mode & SPI_CPHA)
445 cs->hw_mode |= SPMODE_CP_BEGIN_EDGECLK;
446 if (spi->mode & SPI_CPOL)
447 cs->hw_mode |= SPMODE_CI_INACTIVEHIGH;
448 if (!(spi->mode & SPI_LSB_FIRST))
449 cs->hw_mode |= SPMODE_REV;
450 if (spi->mode & SPI_LOOP)
451 cs->hw_mode |= SPMODE_LOOP;
452
308 retval = mpc83xx_spi_setup_transfer(spi, NULL); 453 retval = mpc83xx_spi_setup_transfer(spi, NULL);
309 if (retval < 0) 454 if (retval < 0) {
455 cs->hw_mode = hw_mode; /* Restore settings */
310 return retval; 456 return retval;
457 }
311 458
312 dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", 459 dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u Hz\n",
313 __func__, spi->mode & (SPI_CPOL | SPI_CPHA), 460 __func__, spi->mode & (SPI_CPOL | SPI_CPHA),
314 spi->bits_per_word, 2 * mpc83xx_spi->nsecs); 461 spi->bits_per_word, spi->max_speed_hz);
315 462#if 0 /* Don't think this is needed */
316 /* NOTE we _need_ to call chipselect() early, ideally with adapter 463 /* NOTE we _need_ to call chipselect() early, ideally with adapter
317 * setup, unless the hardware defaults cooperate to avoid confusion 464 * setup, unless the hardware defaults cooperate to avoid confusion
318 * between normal (active low) and inverted chipselects. 465 * between normal (active low) and inverted chipselects.
319 */ 466 */
320 467
321 /* deselect chip (low or high) */ 468 /* deselect chip (low or high) */
322 spin_lock(&bitbang->lock); 469 spin_lock(&mpc83xx_spi->lock);
323 if (!bitbang->busy) { 470 if (!mpc83xx_spi->busy)
324 bitbang->chipselect(spi, BITBANG_CS_INACTIVE); 471 mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
325 ndelay(mpc83xx_spi->nsecs); 472 spin_unlock(&mpc83xx_spi->lock);
326 } 473#endif
327 spin_unlock(&bitbang->lock);
328
329 return 0; 474 return 0;
330} 475}
331 476
332static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
333{
334 struct mpc83xx_spi *mpc83xx_spi;
335 u32 word;
336
337 mpc83xx_spi = spi_master_get_devdata(spi->master);
338
339 mpc83xx_spi->tx = t->tx_buf;
340 mpc83xx_spi->rx = t->rx_buf;
341 mpc83xx_spi->count = t->len;
342 INIT_COMPLETION(mpc83xx_spi->done);
343
344 /* enable rx ints */
345 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);
346
347 /* transmit word */
348 word = mpc83xx_spi->get_tx(mpc83xx_spi);
349 mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);
350
351 wait_for_completion(&mpc83xx_spi->done);
352
353 /* disable rx ints */
354 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
355
356 return t->len - mpc83xx_spi->count;
357}
358
359irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data) 477irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data)
360{ 478{
361 struct mpc83xx_spi *mpc83xx_spi = context_data; 479 struct mpc83xx_spi *mpc83xx_spi = context_data;
@@ -395,6 +513,28 @@ irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data)
395 513
396 return ret; 514 return ret;
397} 515}
516static int mpc83xx_spi_transfer(struct spi_device *spi,
517 struct spi_message *m)
518{
519 struct mpc83xx_spi *mpc83xx_spi = spi_master_get_devdata(spi->master);
520 unsigned long flags;
521
522 m->actual_length = 0;
523 m->status = -EINPROGRESS;
524
525 spin_lock_irqsave(&mpc83xx_spi->lock, flags);
526 list_add_tail(&m->queue, &mpc83xx_spi->queue);
527 queue_work(mpc83xx_spi->workqueue, &mpc83xx_spi->work);
528 spin_unlock_irqrestore(&mpc83xx_spi->lock, flags);
529
530 return 0;
531}
532
533
534static void mpc83xx_spi_cleanup(struct spi_device *spi)
535{
536 kfree(spi->controller_state);
537}
398 538
399static int __init mpc83xx_spi_probe(struct platform_device *dev) 539static int __init mpc83xx_spi_probe(struct platform_device *dev)
400{ 540{
@@ -426,11 +566,11 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
426 ret = -ENODEV; 566 ret = -ENODEV;
427 goto free_master; 567 goto free_master;
428 } 568 }
569 master->setup = mpc83xx_spi_setup;
570 master->transfer = mpc83xx_spi_transfer;
571 master->cleanup = mpc83xx_spi_cleanup;
572
429 mpc83xx_spi = spi_master_get_devdata(master); 573 mpc83xx_spi = spi_master_get_devdata(master);
430 mpc83xx_spi->bitbang.master = spi_master_get(master);
431 mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
432 mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
433 mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
434 mpc83xx_spi->activate_cs = pdata->activate_cs; 574 mpc83xx_spi->activate_cs = pdata->activate_cs;
435 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; 575 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
436 mpc83xx_spi->qe_mode = pdata->qe_mode; 576 mpc83xx_spi->qe_mode = pdata->qe_mode;
@@ -445,7 +585,6 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
445 mpc83xx_spi->tx_shift = 24; 585 mpc83xx_spi->tx_shift = 24;
446 } 586 }
447 587
448 mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup;
449 init_completion(&mpc83xx_spi->done); 588 init_completion(&mpc83xx_spi->done);
450 589
451 mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1); 590 mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1);
@@ -483,11 +622,21 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
483 regval |= SPMODE_OP; 622 regval |= SPMODE_OP;
484 623
485 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); 624 mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
625 spin_lock_init(&mpc83xx_spi->lock);
626 init_completion(&mpc83xx_spi->done);
627 INIT_WORK(&mpc83xx_spi->work, mpc83xx_spi_work);
628 INIT_LIST_HEAD(&mpc83xx_spi->queue);
486 629
487 ret = spi_bitbang_start(&mpc83xx_spi->bitbang); 630 mpc83xx_spi->workqueue = create_singlethread_workqueue(
488 631 master->dev.parent->bus_id);
489 if (ret != 0) 632 if (mpc83xx_spi->workqueue == NULL) {
633 ret = -EBUSY;
490 goto free_irq; 634 goto free_irq;
635 }
636
637 ret = spi_register_master(master);
638 if (ret < 0)
639 goto unreg_master;
491 640
492 printk(KERN_INFO 641 printk(KERN_INFO
493 "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n", 642 "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n",
@@ -495,6 +644,8 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
495 644
496 return ret; 645 return ret;
497 646
647unreg_master:
648 destroy_workqueue(mpc83xx_spi->workqueue);
498free_irq: 649free_irq:
499 free_irq(mpc83xx_spi->irq, mpc83xx_spi); 650 free_irq(mpc83xx_spi->irq, mpc83xx_spi);
500unmap_io: 651unmap_io:
@@ -515,10 +666,12 @@ static int __exit mpc83xx_spi_remove(struct platform_device *dev)
515 master = platform_get_drvdata(dev); 666 master = platform_get_drvdata(dev);
516 mpc83xx_spi = spi_master_get_devdata(master); 667 mpc83xx_spi = spi_master_get_devdata(master);
517 668
518 spi_bitbang_stop(&mpc83xx_spi->bitbang); 669 flush_workqueue(mpc83xx_spi->workqueue);
670 destroy_workqueue(mpc83xx_spi->workqueue);
671 spi_unregister_master(master);
672
519 free_irq(mpc83xx_spi->irq, mpc83xx_spi); 673 free_irq(mpc83xx_spi->irq, mpc83xx_spi);
520 iounmap(mpc83xx_spi->base); 674 iounmap(mpc83xx_spi->base);
521 spi_master_put(mpc83xx_spi->bitbang.master);
522 675
523 return 0; 676 return 0;
524} 677}
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index b3518ca9f04e..799337f7fde1 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -25,6 +25,7 @@
25#include <linux/ioctl.h> 25#include <linux/ioctl.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/err.h>
28#include <linux/list.h> 29#include <linux/list.h>
29#include <linux/errno.h> 30#include <linux/errno.h>
30#include <linux/mutex.h> 31#include <linux/mutex.h>
@@ -67,10 +68,12 @@ static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG];
67 | SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP) 68 | SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP)
68 69
69struct spidev_data { 70struct spidev_data {
70 struct device dev; 71 dev_t devt;
72 spinlock_t spi_lock;
71 struct spi_device *spi; 73 struct spi_device *spi;
72 struct list_head device_entry; 74 struct list_head device_entry;
73 75
76 /* buffer is NULL unless this device is open (users > 0) */
74 struct mutex buf_lock; 77 struct mutex buf_lock;
75 unsigned users; 78 unsigned users;
76 u8 *buffer; 79 u8 *buffer;
@@ -85,12 +88,75 @@ MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");
85 88
86/*-------------------------------------------------------------------------*/ 89/*-------------------------------------------------------------------------*/
87 90
91/*
92 * We can't use the standard synchronous wrappers for file I/O; we
93 * need to protect against async removal of the underlying spi_device.
94 */
95static void spidev_complete(void *arg)
96{
97 complete(arg);
98}
99
100static ssize_t
101spidev_sync(struct spidev_data *spidev, struct spi_message *message)
102{
103 DECLARE_COMPLETION_ONSTACK(done);
104 int status;
105
106 message->complete = spidev_complete;
107 message->context = &done;
108
109 spin_lock_irq(&spidev->spi_lock);
110 if (spidev->spi == NULL)
111 status = -ESHUTDOWN;
112 else
113 status = spi_async(spidev->spi, message);
114 spin_unlock_irq(&spidev->spi_lock);
115
116 if (status == 0) {
117 wait_for_completion(&done);
118 status = message->status;
119 if (status == 0)
120 status = message->actual_length;
121 }
122 return status;
123}
124
125static inline ssize_t
126spidev_sync_write(struct spidev_data *spidev, size_t len)
127{
128 struct spi_transfer t = {
129 .tx_buf = spidev->buffer,
130 .len = len,
131 };
132 struct spi_message m;
133
134 spi_message_init(&m);
135 spi_message_add_tail(&t, &m);
136 return spidev_sync(spidev, &m);
137}
138
139static inline ssize_t
140spidev_sync_read(struct spidev_data *spidev, size_t len)
141{
142 struct spi_transfer t = {
143 .rx_buf = spidev->buffer,
144 .len = len,
145 };
146 struct spi_message m;
147
148 spi_message_init(&m);
149 spi_message_add_tail(&t, &m);
150 return spidev_sync(spidev, &m);
151}
152
153/*-------------------------------------------------------------------------*/
154
88/* Read-only message with current device setup */ 155/* Read-only message with current device setup */
89static ssize_t 156static ssize_t
90spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) 157spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
91{ 158{
92 struct spidev_data *spidev; 159 struct spidev_data *spidev;
93 struct spi_device *spi;
94 ssize_t status = 0; 160 ssize_t status = 0;
95 161
96 /* chipselect only toggles at start or end of operation */ 162 /* chipselect only toggles at start or end of operation */
@@ -98,10 +164,9 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
98 return -EMSGSIZE; 164 return -EMSGSIZE;
99 165
100 spidev = filp->private_data; 166 spidev = filp->private_data;
101 spi = spidev->spi;
102 167
103 mutex_lock(&spidev->buf_lock); 168 mutex_lock(&spidev->buf_lock);
104 status = spi_read(spi, spidev->buffer, count); 169 status = spidev_sync_read(spidev, count);
105 if (status == 0) { 170 if (status == 0) {
106 unsigned long missing; 171 unsigned long missing;
107 172
@@ -122,7 +187,6 @@ spidev_write(struct file *filp, const char __user *buf,
122 size_t count, loff_t *f_pos) 187 size_t count, loff_t *f_pos)
123{ 188{
124 struct spidev_data *spidev; 189 struct spidev_data *spidev;
125 struct spi_device *spi;
126 ssize_t status = 0; 190 ssize_t status = 0;
127 unsigned long missing; 191 unsigned long missing;
128 192
@@ -131,12 +195,11 @@ spidev_write(struct file *filp, const char __user *buf,
131 return -EMSGSIZE; 195 return -EMSGSIZE;
132 196
133 spidev = filp->private_data; 197 spidev = filp->private_data;
134 spi = spidev->spi;
135 198
136 mutex_lock(&spidev->buf_lock); 199 mutex_lock(&spidev->buf_lock);
137 missing = copy_from_user(spidev->buffer, buf, count); 200 missing = copy_from_user(spidev->buffer, buf, count);
138 if (missing == 0) { 201 if (missing == 0) {
139 status = spi_write(spi, spidev->buffer, count); 202 status = spidev_sync_write(spidev, count);
140 if (status == 0) 203 if (status == 0)
141 status = count; 204 status = count;
142 } else 205 } else
@@ -153,7 +216,6 @@ static int spidev_message(struct spidev_data *spidev,
153 struct spi_transfer *k_xfers; 216 struct spi_transfer *k_xfers;
154 struct spi_transfer *k_tmp; 217 struct spi_transfer *k_tmp;
155 struct spi_ioc_transfer *u_tmp; 218 struct spi_ioc_transfer *u_tmp;
156 struct spi_device *spi = spidev->spi;
157 unsigned n, total; 219 unsigned n, total;
158 u8 *buf; 220 u8 *buf;
159 int status = -EFAULT; 221 int status = -EFAULT;
@@ -215,7 +277,7 @@ static int spidev_message(struct spidev_data *spidev,
215 spi_message_add_tail(k_tmp, &msg); 277 spi_message_add_tail(k_tmp, &msg);
216 } 278 }
217 279
218 status = spi_sync(spi, &msg); 280 status = spidev_sync(spidev, &msg);
219 if (status < 0) 281 if (status < 0)
220 goto done; 282 goto done;
221 283
@@ -269,8 +331,16 @@ spidev_ioctl(struct inode *inode, struct file *filp,
269 if (err) 331 if (err)
270 return -EFAULT; 332 return -EFAULT;
271 333
334 /* guard against device removal before, or while,
335 * we issue this ioctl.
336 */
272 spidev = filp->private_data; 337 spidev = filp->private_data;
273 spi = spidev->spi; 338 spin_lock_irq(&spidev->spi_lock);
339 spi = spi_dev_get(spidev->spi);
340 spin_unlock_irq(&spidev->spi_lock);
341
342 if (spi == NULL)
343 return -ESHUTDOWN;
274 344
275 switch (cmd) { 345 switch (cmd) {
276 /* read requests */ 346 /* read requests */
@@ -356,8 +426,10 @@ spidev_ioctl(struct inode *inode, struct file *filp,
356 default: 426 default:
357 /* segmented and/or full-duplex I/O request */ 427 /* segmented and/or full-duplex I/O request */
358 if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0)) 428 if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0))
359 || _IOC_DIR(cmd) != _IOC_WRITE) 429 || _IOC_DIR(cmd) != _IOC_WRITE) {
360 return -ENOTTY; 430 retval = -ENOTTY;
431 break;
432 }
361 433
362 tmp = _IOC_SIZE(cmd); 434 tmp = _IOC_SIZE(cmd);
363 if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) { 435 if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) {
@@ -385,6 +457,7 @@ spidev_ioctl(struct inode *inode, struct file *filp,
385 kfree(ioc); 457 kfree(ioc);
386 break; 458 break;
387 } 459 }
460 spi_dev_put(spi);
388 return retval; 461 return retval;
389} 462}
390 463
@@ -396,7 +469,7 @@ static int spidev_open(struct inode *inode, struct file *filp)
396 mutex_lock(&device_list_lock); 469 mutex_lock(&device_list_lock);
397 470
398 list_for_each_entry(spidev, &device_list, device_entry) { 471 list_for_each_entry(spidev, &device_list, device_entry) {
399 if (spidev->dev.devt == inode->i_rdev) { 472 if (spidev->devt == inode->i_rdev) {
400 status = 0; 473 status = 0;
401 break; 474 break;
402 } 475 }
@@ -429,10 +502,22 @@ static int spidev_release(struct inode *inode, struct file *filp)
429 mutex_lock(&device_list_lock); 502 mutex_lock(&device_list_lock);
430 spidev = filp->private_data; 503 spidev = filp->private_data;
431 filp->private_data = NULL; 504 filp->private_data = NULL;
505
506 /* last close? */
432 spidev->users--; 507 spidev->users--;
433 if (!spidev->users) { 508 if (!spidev->users) {
509 int dofree;
510
434 kfree(spidev->buffer); 511 kfree(spidev->buffer);
435 spidev->buffer = NULL; 512 spidev->buffer = NULL;
513
514 /* ... after we unbound from the underlying device? */
515 spin_lock_irq(&spidev->spi_lock);
516 dofree = (spidev->spi == NULL);
517 spin_unlock_irq(&spidev->spi_lock);
518
519 if (dofree)
520 kfree(spidev);
436 } 521 }
437 mutex_unlock(&device_list_lock); 522 mutex_unlock(&device_list_lock);
438 523
@@ -459,19 +544,7 @@ static struct file_operations spidev_fops = {
459 * It also simplifies memory management. 544 * It also simplifies memory management.
460 */ 545 */
461 546
462static void spidev_classdev_release(struct device *dev) 547static struct class *spidev_class;
463{
464 struct spidev_data *spidev;
465
466 spidev = container_of(dev, struct spidev_data, dev);
467 kfree(spidev);
468}
469
470static struct class spidev_class = {
471 .name = "spidev",
472 .owner = THIS_MODULE,
473 .dev_release = spidev_classdev_release,
474};
475 548
476/*-------------------------------------------------------------------------*/ 549/*-------------------------------------------------------------------------*/
477 550
@@ -488,6 +561,7 @@ static int spidev_probe(struct spi_device *spi)
488 561
489 /* Initialize the driver data */ 562 /* Initialize the driver data */
490 spidev->spi = spi; 563 spidev->spi = spi;
564 spin_lock_init(&spidev->spi_lock);
491 mutex_init(&spidev->buf_lock); 565 mutex_init(&spidev->buf_lock);
492 566
493 INIT_LIST_HEAD(&spidev->device_entry); 567 INIT_LIST_HEAD(&spidev->device_entry);
@@ -498,20 +572,20 @@ static int spidev_probe(struct spi_device *spi)
498 mutex_lock(&device_list_lock); 572 mutex_lock(&device_list_lock);
499 minor = find_first_zero_bit(minors, N_SPI_MINORS); 573 minor = find_first_zero_bit(minors, N_SPI_MINORS);
500 if (minor < N_SPI_MINORS) { 574 if (minor < N_SPI_MINORS) {
501 spidev->dev.parent = &spi->dev; 575 struct device *dev;
502 spidev->dev.class = &spidev_class; 576
503 spidev->dev.devt = MKDEV(SPIDEV_MAJOR, minor); 577 spidev->devt = MKDEV(SPIDEV_MAJOR, minor);
504 snprintf(spidev->dev.bus_id, sizeof spidev->dev.bus_id, 578 dev = device_create(spidev_class, &spi->dev, spidev->devt,
505 "spidev%d.%d", 579 "spidev%d.%d",
506 spi->master->bus_num, spi->chip_select); 580 spi->master->bus_num, spi->chip_select);
507 status = device_register(&spidev->dev); 581 status = IS_ERR(dev) ? PTR_ERR(dev) : 0;
508 } else { 582 } else {
509 dev_dbg(&spi->dev, "no minor number available!\n"); 583 dev_dbg(&spi->dev, "no minor number available!\n");
510 status = -ENODEV; 584 status = -ENODEV;
511 } 585 }
512 if (status == 0) { 586 if (status == 0) {
513 set_bit(minor, minors); 587 set_bit(minor, minors);
514 dev_set_drvdata(&spi->dev, spidev); 588 spi_set_drvdata(spi, spidev);
515 list_add(&spidev->device_entry, &device_list); 589 list_add(&spidev->device_entry, &device_list);
516 } 590 }
517 mutex_unlock(&device_list_lock); 591 mutex_unlock(&device_list_lock);
@@ -524,15 +598,21 @@ static int spidev_probe(struct spi_device *spi)
524 598
525static int spidev_remove(struct spi_device *spi) 599static int spidev_remove(struct spi_device *spi)
526{ 600{
527 struct spidev_data *spidev = dev_get_drvdata(&spi->dev); 601 struct spidev_data *spidev = spi_get_drvdata(spi);
528 602
529 mutex_lock(&device_list_lock); 603 /* make sure ops on existing fds can abort cleanly */
604 spin_lock_irq(&spidev->spi_lock);
605 spidev->spi = NULL;
606 spi_set_drvdata(spi, NULL);
607 spin_unlock_irq(&spidev->spi_lock);
530 608
609 /* prevent new opens */
610 mutex_lock(&device_list_lock);
531 list_del(&spidev->device_entry); 611 list_del(&spidev->device_entry);
532 dev_set_drvdata(&spi->dev, NULL); 612 device_destroy(spidev_class, spidev->devt);
533 clear_bit(MINOR(spidev->dev.devt), minors); 613 clear_bit(MINOR(spidev->devt), minors);
534 device_unregister(&spidev->dev); 614 if (spidev->users == 0)
535 615 kfree(spidev);
536 mutex_unlock(&device_list_lock); 616 mutex_unlock(&device_list_lock);
537 617
538 return 0; 618 return 0;
@@ -568,15 +648,15 @@ static int __init spidev_init(void)
568 if (status < 0) 648 if (status < 0)
569 return status; 649 return status;
570 650
571 status = class_register(&spidev_class); 651 spidev_class = class_create(THIS_MODULE, "spidev");
572 if (status < 0) { 652 if (IS_ERR(spidev_class)) {
573 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name); 653 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
574 return status; 654 return PTR_ERR(spidev_class);
575 } 655 }
576 656
577 status = spi_register_driver(&spidev_spi); 657 status = spi_register_driver(&spidev_spi);
578 if (status < 0) { 658 if (status < 0) {
579 class_unregister(&spidev_class); 659 class_destroy(spidev_class);
580 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name); 660 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
581 } 661 }
582 return status; 662 return status;
@@ -586,7 +666,7 @@ module_init(spidev_init);
586static void __exit spidev_exit(void) 666static void __exit spidev_exit(void)
587{ 667{
588 spi_unregister_driver(&spidev_spi); 668 spi_unregister_driver(&spidev_spi);
589 class_unregister(&spidev_class); 669 class_destroy(spidev_class);
590 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name); 670 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
591} 671}
592module_exit(spidev_exit); 672module_exit(spidev_exit);
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 75def13e797d..d28c53868093 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -537,12 +537,12 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
537 int err = 0; 537 int err = 0;
538 u32 tmp; 538 u32 tmp;
539 539
540 might_sleep();
541
542 if (!pdev) 540 if (!pdev)
543 goto out; 541 goto out;
544 bus = pdev->bus; 542 bus = pdev->bus;
545 543
544 might_sleep_if(pdev->id.coreid != SSB_DEV_PCI);
545
546 /* Enable interrupts for this device. */ 546 /* Enable interrupts for this device. */
547 if (bus->host_pci && 547 if (bus->host_pci &&
548 ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) { 548 ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) {
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 55cc7b80422a..0a12e90ad416 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -649,15 +649,14 @@ int __uio_register_device(struct module *owner,
649 if (ret) 649 if (ret)
650 goto err_get_minor; 650 goto err_get_minor;
651 651
652 idev->dev = device_create(uio_class->class, parent, 652 idev->dev = device_create_drvdata(uio_class->class, parent,
653 MKDEV(uio_major, idev->minor), 653 MKDEV(uio_major, idev->minor), idev,
654 "uio%d", idev->minor); 654 "uio%d", idev->minor);
655 if (IS_ERR(idev->dev)) { 655 if (IS_ERR(idev->dev)) {
656 printk(KERN_ERR "UIO: device register failed\n"); 656 printk(KERN_ERR "UIO: device register failed\n");
657 ret = PTR_ERR(idev->dev); 657 ret = PTR_ERR(idev->dev);
658 goto err_device_create; 658 goto err_device_create;
659 } 659 }
660 dev_set_drvdata(idev->dev, idev);
661 660
662 ret = uio_dev_add_attributes(idev); 661 ret = uio_dev_add_attributes(idev);
663 if (ret) 662 if (ret)
diff --git a/drivers/usb/c67x00/c67x00-ll-hpi.c b/drivers/usb/c67x00/c67x00-ll-hpi.c
index f3430b372f09..a9636f43bca2 100644
--- a/drivers/usb/c67x00/c67x00-ll-hpi.c
+++ b/drivers/usb/c67x00/c67x00-ll-hpi.c
@@ -23,6 +23,7 @@
23 23
24#include <asm/byteorder.h> 24#include <asm/byteorder.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/jiffies.h>
26#include <linux/usb/c67x00.h> 27#include <linux/usb/c67x00.h>
27#include "c67x00.h" 28#include "c67x00.h"
28 29
@@ -119,7 +120,7 @@ static void hpi_write_word(struct c67x00_device *dev, u16 reg, u16 value)
119 * Only data is little endian, addr has cpu endianess 120 * Only data is little endian, addr has cpu endianess
120 */ 121 */
121static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, 122static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr,
122 u16 *data, u16 count) 123 __le16 *data, u16 count)
123{ 124{
124 unsigned long flags; 125 unsigned long flags;
125 int i; 126 int i;
@@ -128,7 +129,7 @@ static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr,
128 129
129 hpi_write_reg(dev, HPI_ADDR, addr); 130 hpi_write_reg(dev, HPI_ADDR, addr);
130 for (i = 0; i < count; i++) 131 for (i = 0; i < count; i++)
131 hpi_write_reg(dev, HPI_DATA, cpu_to_le16(*data++)); 132 hpi_write_reg(dev, HPI_DATA, le16_to_cpu(*data++));
132 133
133 spin_unlock_irqrestore(&dev->hpi.lock, flags); 134 spin_unlock_irqrestore(&dev->hpi.lock, flags);
134} 135}
@@ -137,7 +138,7 @@ static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr,
137 * Only data is little endian, addr has cpu endianess 138 * Only data is little endian, addr has cpu endianess
138 */ 139 */
139static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr, 140static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr,
140 u16 *data, u16 count) 141 __le16 *data, u16 count)
141{ 142{
142 unsigned long flags; 143 unsigned long flags;
143 int i; 144 int i;
@@ -145,7 +146,7 @@ static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr,
145 spin_lock_irqsave(&dev->hpi.lock, flags); 146 spin_lock_irqsave(&dev->hpi.lock, flags);
146 hpi_write_reg(dev, HPI_ADDR, addr); 147 hpi_write_reg(dev, HPI_ADDR, addr);
147 for (i = 0; i < count; i++) 148 for (i = 0; i < count; i++)
148 *data++ = le16_to_cpu(hpi_read_reg(dev, HPI_DATA)); 149 *data++ = cpu_to_le16(hpi_read_reg(dev, HPI_DATA));
149 150
150 spin_unlock_irqrestore(&dev->hpi.lock, flags); 151 spin_unlock_irqrestore(&dev->hpi.lock, flags);
151} 152}
@@ -424,7 +425,7 @@ void c67x00_ll_write_mem_le16(struct c67x00_device *dev, u16 addr,
424 len--; 425 len--;
425 } 426 }
426 427
427 hpi_write_words_le16(dev, addr, (u16 *)buf, len / 2); 428 hpi_write_words_le16(dev, addr, (__le16 *)buf, len / 2);
428 buf += len & ~0x01; 429 buf += len & ~0x01;
429 addr += len & ~0x01; 430 addr += len & ~0x01;
430 len &= 0x01; 431 len &= 0x01;
@@ -455,7 +456,7 @@ void c67x00_ll_read_mem_le16(struct c67x00_device *dev, u16 addr,
455 len--; 456 len--;
456 } 457 }
457 458
458 hpi_read_words_le16(dev, addr, (u16 *)buf, len / 2); 459 hpi_read_words_le16(dev, addr, (__le16 *)buf, len / 2);
459 buf += len & ~0x01; 460 buf += len & ~0x01;
460 addr += len & ~0x01; 461 addr += len & ~0x01;
461 len &= 0x01; 462 len &= 0x01;
diff --git a/drivers/usb/class/Kconfig b/drivers/usb/class/Kconfig
index 3a9102d2591b..66f17ed88cb5 100644
--- a/drivers/usb/class/Kconfig
+++ b/drivers/usb/class/Kconfig
@@ -29,3 +29,14 @@ config USB_PRINTER
29 To compile this driver as a module, choose M here: the 29 To compile this driver as a module, choose M here: the
30 module will be called usblp. 30 module will be called usblp.
31 31
32config USB_WDM
33 tristate "USB Wireless Device Management support"
34 depends on USB
35 ---help---
36 This driver supports the WMC Device Management functionality
37 of cell phones compliant to the CDC WMC specification. You can use
38 AT commands over this device.
39
40 To compile this driver as a module, choose M here: the
41 module will be called cdc-wdm.
42
diff --git a/drivers/usb/class/Makefile b/drivers/usb/class/Makefile
index cc391e6c2af8..535d59a30600 100644
--- a/drivers/usb/class/Makefile
+++ b/drivers/usb/class/Makefile
@@ -5,3 +5,4 @@
5 5
6obj-$(CONFIG_USB_ACM) += cdc-acm.o 6obj-$(CONFIG_USB_ACM) += cdc-acm.o
7obj-$(CONFIG_USB_PRINTER) += usblp.o 7obj-$(CONFIG_USB_PRINTER) += usblp.o
8obj-$(CONFIG_USB_WDM) += cdc-wdm.o
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index cefe7f2c6f75..63c34043b4d9 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1248,6 +1248,9 @@ static struct usb_device_id acm_ids[] = {
1248 { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */ 1248 { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */
1249 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1249 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1250 }, 1250 },
1251 { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */
1252 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1253 },
1251 1254
1252 /* control interfaces with various AT-command sets */ 1255 /* control interfaces with various AT-command sets */
1253 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 1256 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
new file mode 100644
index 000000000000..731db051070a
--- /dev/null
+++ b/drivers/usb/class/cdc-wdm.c
@@ -0,0 +1,740 @@
1/*
2 * cdc-wdm.c
3 *
4 * This driver supports USB CDC WCM Device Management.
5 *
6 * Copyright (c) 2007-2008 Oliver Neukum
7 *
8 * Some code taken from cdc-acm.c
9 *
10 * Released under the GPLv2.
11 *
12 * Many thanks to Carl Nordbeck
13 */
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/slab.h>
17#include <linux/module.h>
18#include <linux/smp_lock.h>
19#include <linux/mutex.h>
20#include <linux/uaccess.h>
21#include <linux/bitops.h>
22#include <linux/poll.h>
23#include <linux/usb.h>
24#include <linux/usb/cdc.h>
25#include <asm/byteorder.h>
26#include <asm/unaligned.h>
27
28/*
29 * Version Information
30 */
31#define DRIVER_VERSION "v0.02"
32#define DRIVER_AUTHOR "Oliver Neukum"
33
34static struct usb_device_id wdm_ids[] = {
35 {
36 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
37 USB_DEVICE_ID_MATCH_INT_SUBCLASS,
38 .bInterfaceClass = USB_CLASS_COMM,
39 .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM
40 },
41 { }
42};
43
44#define WDM_MINOR_BASE 176
45
46
47#define WDM_IN_USE 1
48#define WDM_DISCONNECTING 2
49#define WDM_RESULT 3
50#define WDM_READ 4
51#define WDM_INT_STALL 5
52#define WDM_POLL_RUNNING 6
53
54
55#define WDM_MAX 16
56
57
58static DEFINE_MUTEX(wdm_mutex);
59
60/* --- method tables --- */
61
62struct wdm_device {
63 u8 *inbuf; /* buffer for response */
64 u8 *outbuf; /* buffer for command */
65 u8 *sbuf; /* buffer for status */
66 u8 *ubuf; /* buffer for copy to user space */
67
68 struct urb *command;
69 struct urb *response;
70 struct urb *validity;
71 struct usb_interface *intf;
72 struct usb_ctrlrequest *orq;
73 struct usb_ctrlrequest *irq;
74 spinlock_t iuspin;
75
76 unsigned long flags;
77 u16 bufsize;
78 u16 wMaxCommand;
79 u16 wMaxPacketSize;
80 u16 bMaxPacketSize0;
81 __le16 inum;
82 int reslength;
83 int length;
84 int read;
85 int count;
86 dma_addr_t shandle;
87 dma_addr_t ihandle;
88 struct mutex wlock;
89 struct mutex rlock;
90 wait_queue_head_t wait;
91 struct work_struct rxwork;
92 int werr;
93 int rerr;
94};
95
96static struct usb_driver wdm_driver;
97
98/* --- callbacks --- */
99static void wdm_out_callback(struct urb *urb)
100{
101 struct wdm_device *desc;
102 desc = urb->context;
103 spin_lock(&desc->iuspin);
104 desc->werr = urb->status;
105 spin_unlock(&desc->iuspin);
106 clear_bit(WDM_IN_USE, &desc->flags);
107 kfree(desc->outbuf);
108 wake_up(&desc->wait);
109}
110
111static void wdm_in_callback(struct urb *urb)
112{
113 struct wdm_device *desc = urb->context;
114 int status = urb->status;
115
116 spin_lock(&desc->iuspin);
117
118 if (status) {
119 switch (status) {
120 case -ENOENT:
121 dev_dbg(&desc->intf->dev,
122 "nonzero urb status received: -ENOENT");
123 break;
124 case -ECONNRESET:
125 dev_dbg(&desc->intf->dev,
126 "nonzero urb status received: -ECONNRESET");
127 break;
128 case -ESHUTDOWN:
129 dev_dbg(&desc->intf->dev,
130 "nonzero urb status received: -ESHUTDOWN");
131 break;
132 case -EPIPE:
133 err("nonzero urb status received: -EPIPE");
134 break;
135 default:
136 err("Unexpected error %d", status);
137 break;
138 }
139 }
140
141 desc->rerr = status;
142 desc->reslength = urb->actual_length;
143 memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength);
144 desc->length += desc->reslength;
145 wake_up(&desc->wait);
146
147 set_bit(WDM_READ, &desc->flags);
148 spin_unlock(&desc->iuspin);
149}
150
151static void wdm_int_callback(struct urb *urb)
152{
153 int rv = 0;
154 int status = urb->status;
155 struct wdm_device *desc;
156 struct usb_ctrlrequest *req;
157 struct usb_cdc_notification *dr;
158
159 desc = urb->context;
160 req = desc->irq;
161 dr = (struct usb_cdc_notification *)desc->sbuf;
162
163 if (status) {
164 switch (status) {
165 case -ESHUTDOWN:
166 case -ENOENT:
167 case -ECONNRESET:
168 return; /* unplug */
169 case -EPIPE:
170 set_bit(WDM_INT_STALL, &desc->flags);
171 err("Stall on int endpoint");
172 goto sw; /* halt is cleared in work */
173 default:
174 err("nonzero urb status received: %d", status);
175 break;
176 }
177 }
178
179 if (urb->actual_length < sizeof(struct usb_cdc_notification)) {
180 err("wdm_int_callback - %d bytes", urb->actual_length);
181 goto exit;
182 }
183
184 switch (dr->bNotificationType) {
185 case USB_CDC_NOTIFY_RESPONSE_AVAILABLE:
186 dev_dbg(&desc->intf->dev,
187 "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d",
188 dr->wIndex, dr->wLength);
189 break;
190
191 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
192
193 dev_dbg(&desc->intf->dev,
194 "NOTIFY_NETWORK_CONNECTION %s network",
195 dr->wValue ? "connected to" : "disconnected from");
196 goto exit;
197 default:
198 clear_bit(WDM_POLL_RUNNING, &desc->flags);
199 err("unknown notification %d received: index %d len %d",
200 dr->bNotificationType, dr->wIndex, dr->wLength);
201 goto exit;
202 }
203
204 req->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
205 req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE;
206 req->wValue = 0;
207 req->wIndex = desc->inum;
208 req->wLength = cpu_to_le16(desc->bMaxPacketSize0);
209
210 usb_fill_control_urb(
211 desc->response,
212 interface_to_usbdev(desc->intf),
213 /* using common endpoint 0 */
214 usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0),
215 (unsigned char *)req,
216 desc->inbuf,
217 desc->bMaxPacketSize0,
218 wdm_in_callback,
219 desc
220 );
221 desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
222 spin_lock(&desc->iuspin);
223 clear_bit(WDM_READ, &desc->flags);
224 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) {
225 rv = usb_submit_urb(desc->response, GFP_ATOMIC);
226 dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d",
227 __func__, rv);
228 }
229 spin_unlock(&desc->iuspin);
230 if (rv < 0) {
231 if (rv == -EPERM)
232 return;
233 if (rv == -ENOMEM) {
234sw:
235 rv = schedule_work(&desc->rxwork);
236 if (rv)
237 err("Cannot schedule work");
238 }
239 }
240exit:
241 rv = usb_submit_urb(urb, GFP_ATOMIC);
242 if (rv)
243 err("%s - usb_submit_urb failed with result %d",
244 __func__, rv);
245
246}
247
248static void kill_urbs(struct wdm_device *desc)
249{
250 usb_kill_urb(desc->command);
251 usb_kill_urb(desc->validity);
252 usb_kill_urb(desc->response);
253}
254
255static void free_urbs(struct wdm_device *desc)
256{
257 usb_free_urb(desc->validity);
258 usb_free_urb(desc->response);
259 usb_free_urb(desc->command);
260}
261
262static void cleanup(struct wdm_device *desc)
263{
264 usb_buffer_free(interface_to_usbdev(desc->intf),
265 desc->wMaxPacketSize,
266 desc->sbuf,
267 desc->validity->transfer_dma);
268 usb_buffer_free(interface_to_usbdev(desc->intf),
269 desc->wMaxPacketSize,
270 desc->inbuf,
271 desc->response->transfer_dma);
272 kfree(desc->orq);
273 kfree(desc->irq);
274 kfree(desc->ubuf);
275 free_urbs(desc);
276 kfree(desc);
277}
278
279static ssize_t wdm_write
280(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
281{
282 u8 *buf;
283 int rv = -EMSGSIZE, r, we;
284 struct wdm_device *desc = file->private_data;
285 struct usb_ctrlrequest *req;
286
287 if (count > desc->wMaxCommand)
288 count = desc->wMaxCommand;
289
290 spin_lock_irq(&desc->iuspin);
291 we = desc->werr;
292 desc->werr = 0;
293 spin_unlock_irq(&desc->iuspin);
294 if (we < 0)
295 return -EIO;
296
297 r = mutex_lock_interruptible(&desc->wlock); /* concurrent writes */
298 rv = -ERESTARTSYS;
299 if (r)
300 goto outnl;
301
302 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE,
303 &desc->flags));
304 if (r < 0)
305 goto out;
306
307 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
308 rv = -ENODEV;
309 goto out;
310 }
311
312 desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
313 if (!buf) {
314 rv = -ENOMEM;
315 goto out;
316 }
317
318 r = copy_from_user(buf, buffer, count);
319 if (r > 0) {
320 kfree(buf);
321 rv = -EFAULT;
322 goto out;
323 }
324
325 req = desc->orq;
326 usb_fill_control_urb(
327 desc->command,
328 interface_to_usbdev(desc->intf),
329 /* using common endpoint 0 */
330 usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0),
331 (unsigned char *)req,
332 buf,
333 count,
334 wdm_out_callback,
335 desc
336 );
337
338 req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS |
339 USB_RECIP_INTERFACE);
340 req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND;
341 req->wValue = 0;
342 req->wIndex = desc->inum;
343 req->wLength = cpu_to_le16(count);
344 set_bit(WDM_IN_USE, &desc->flags);
345
346 rv = usb_submit_urb(desc->command, GFP_KERNEL);
347 if (rv < 0) {
348 kfree(buf);
349 clear_bit(WDM_IN_USE, &desc->flags);
350 } else {
351 dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
352 req->wIndex);
353 }
354out:
355 mutex_unlock(&desc->wlock);
356outnl:
357 return rv < 0 ? rv : count;
358}
359
360static ssize_t wdm_read
361(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
362{
363 int rv, cntr;
364 int i = 0;
365 struct wdm_device *desc = file->private_data;
366
367
368 rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */
369 if (rv < 0)
370 return -ERESTARTSYS;
371
372 if (desc->length == 0) {
373 desc->read = 0;
374retry:
375 i++;
376 rv = wait_event_interruptible(desc->wait,
377 test_bit(WDM_READ, &desc->flags));
378
379 if (rv < 0) {
380 rv = -ERESTARTSYS;
381 goto err;
382 }
383
384 spin_lock_irq(&desc->iuspin);
385
386 if (desc->rerr) { /* read completed, error happened */
387 int t = desc->rerr;
388 desc->rerr = 0;
389 spin_unlock_irq(&desc->iuspin);
390 err("reading had resulted in %d", t);
391 rv = -EIO;
392 goto err;
393 }
394 /*
395 * recheck whether we've lost the race
396 * against the completion handler
397 */
398 if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */
399 spin_unlock_irq(&desc->iuspin);
400 goto retry;
401 }
402 if (!desc->reslength) { /* zero length read */
403 spin_unlock_irq(&desc->iuspin);
404 goto retry;
405 }
406 clear_bit(WDM_READ, &desc->flags);
407 spin_unlock_irq(&desc->iuspin);
408 }
409
410 cntr = count > desc->length ? desc->length : count;
411 rv = copy_to_user(buffer, desc->ubuf, cntr);
412 if (rv > 0) {
413 rv = -EFAULT;
414 goto err;
415 }
416
417 for (i = 0; i < desc->length - cntr; i++)
418 desc->ubuf[i] = desc->ubuf[i + cntr];
419
420 desc->length -= cntr;
421 rv = cntr;
422
423err:
424 mutex_unlock(&desc->rlock);
425 if (rv < 0)
426 err("wdm_read: exit error");
427 return rv;
428}
429
430static int wdm_flush(struct file *file, fl_owner_t id)
431{
432 struct wdm_device *desc = file->private_data;
433
434 wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
435 if (desc->werr < 0)
436 err("Error in flush path: %d", desc->werr);
437
438 return desc->werr;
439}
440
441static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
442{
443 struct wdm_device *desc = file->private_data;
444 unsigned long flags;
445 unsigned int mask = 0;
446
447 spin_lock_irqsave(&desc->iuspin, flags);
448 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
449 mask = POLLERR;
450 spin_unlock_irqrestore(&desc->iuspin, flags);
451 goto desc_out;
452 }
453 if (test_bit(WDM_READ, &desc->flags))
454 mask = POLLIN | POLLRDNORM;
455 if (desc->rerr || desc->werr)
456 mask |= POLLERR;
457 if (!test_bit(WDM_IN_USE, &desc->flags))
458 mask |= POLLOUT | POLLWRNORM;
459 spin_unlock_irqrestore(&desc->iuspin, flags);
460
461 poll_wait(file, &desc->wait, wait);
462
463desc_out:
464 return mask;
465}
466
467static int wdm_open(struct inode *inode, struct file *file)
468{
469 int minor = iminor(inode);
470 int rv = -ENODEV;
471 struct usb_interface *intf;
472 struct wdm_device *desc;
473
474 mutex_lock(&wdm_mutex);
475 intf = usb_find_interface(&wdm_driver, minor);
476 if (!intf)
477 goto out;
478
479 desc = usb_get_intfdata(intf);
480 if (test_bit(WDM_DISCONNECTING, &desc->flags))
481 goto out;
482
483 desc->count++;
484 file->private_data = desc;
485
486 rv = usb_submit_urb(desc->validity, GFP_KERNEL);
487
488 if (rv < 0) {
489 desc->count--;
490 err("Error submitting int urb - %d", rv);
491 goto out;
492 }
493 rv = 0;
494
495out:
496 mutex_unlock(&wdm_mutex);
497 return rv;
498}
499
500static int wdm_release(struct inode *inode, struct file *file)
501{
502 struct wdm_device *desc = file->private_data;
503
504 mutex_lock(&wdm_mutex);
505 desc->count--;
506 if (!desc->count) {
507 dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
508 kill_urbs(desc);
509 }
510 mutex_unlock(&wdm_mutex);
511 return 0;
512}
513
514static const struct file_operations wdm_fops = {
515 .owner = THIS_MODULE,
516 .read = wdm_read,
517 .write = wdm_write,
518 .open = wdm_open,
519 .flush = wdm_flush,
520 .release = wdm_release,
521 .poll = wdm_poll
522};
523
524static struct usb_class_driver wdm_class = {
525 .name = "cdc-wdm%d",
526 .fops = &wdm_fops,
527 .minor_base = WDM_MINOR_BASE,
528};
529
530/* --- error handling --- */
531static void wdm_rxwork(struct work_struct *work)
532{
533 struct wdm_device *desc = container_of(work, struct wdm_device, rxwork);
534 unsigned long flags;
535 int rv;
536
537 spin_lock_irqsave(&desc->iuspin, flags);
538 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
539 spin_unlock_irqrestore(&desc->iuspin, flags);
540 } else {
541 spin_unlock_irqrestore(&desc->iuspin, flags);
542 rv = usb_submit_urb(desc->response, GFP_KERNEL);
543 if (rv < 0 && rv != -EPERM) {
544 spin_lock_irqsave(&desc->iuspin, flags);
545 if (!test_bit(WDM_DISCONNECTING, &desc->flags))
546 schedule_work(&desc->rxwork);
547 spin_unlock_irqrestore(&desc->iuspin, flags);
548 }
549 }
550}
551
552/* --- hotplug --- */
553
554static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
555{
556 int rv = -EINVAL;
557 struct usb_device *udev = interface_to_usbdev(intf);
558 struct wdm_device *desc;
559 struct usb_host_interface *iface;
560 struct usb_endpoint_descriptor *ep;
561 struct usb_cdc_dmm_desc *dmhd;
562 u8 *buffer = intf->altsetting->extra;
563 int buflen = intf->altsetting->extralen;
564 u16 maxcom = 0;
565
566 if (!buffer)
567 goto out;
568
569 while (buflen > 0) {
570 if (buffer [1] != USB_DT_CS_INTERFACE) {
571 err("skipping garbage");
572 goto next_desc;
573 }
574
575 switch (buffer [2]) {
576 case USB_CDC_HEADER_TYPE:
577 break;
578 case USB_CDC_DMM_TYPE:
579 dmhd = (struct usb_cdc_dmm_desc *)buffer;
580 maxcom = le16_to_cpu(dmhd->wMaxCommand);
581 dev_dbg(&intf->dev,
582 "Finding maximum buffer length: %d", maxcom);
583 break;
584 default:
585 err("Ignoring extra header, type %d, length %d",
586 buffer[2], buffer[0]);
587 break;
588 }
589next_desc:
590 buflen -= buffer[0];
591 buffer += buffer[0];
592 }
593
594 rv = -ENOMEM;
595 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL);
596 if (!desc)
597 goto out;
598 mutex_init(&desc->wlock);
599 mutex_init(&desc->rlock);
600 spin_lock_init(&desc->iuspin);
601 init_waitqueue_head(&desc->wait);
602 desc->wMaxCommand = maxcom;
603 desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber);
604 desc->intf = intf;
605 INIT_WORK(&desc->rxwork, wdm_rxwork);
606
607 iface = &intf->altsetting[0];
608 ep = &iface->endpoint[0].desc;
609 if (!usb_endpoint_is_int_in(ep)) {
610 rv = -EINVAL;
611 goto err;
612 }
613
614 desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize);
615 desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0;
616
617 desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
618 if (!desc->orq)
619 goto err;
620 desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
621 if (!desc->irq)
622 goto err;
623
624 desc->validity = usb_alloc_urb(0, GFP_KERNEL);
625 if (!desc->validity)
626 goto err;
627
628 desc->response = usb_alloc_urb(0, GFP_KERNEL);
629 if (!desc->response)
630 goto err;
631
632 desc->command = usb_alloc_urb(0, GFP_KERNEL);
633 if (!desc->command)
634 goto err;
635
636 desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL);
637 if (!desc->ubuf)
638 goto err;
639
640 desc->sbuf = usb_buffer_alloc(interface_to_usbdev(intf),
641 desc->wMaxPacketSize,
642 GFP_KERNEL,
643 &desc->validity->transfer_dma);
644 if (!desc->sbuf)
645 goto err;
646
647 desc->inbuf = usb_buffer_alloc(interface_to_usbdev(intf),
648 desc->bMaxPacketSize0,
649 GFP_KERNEL,
650 &desc->response->transfer_dma);
651 if (!desc->inbuf)
652 goto err2;
653
654 usb_fill_int_urb(
655 desc->validity,
656 interface_to_usbdev(intf),
657 usb_rcvintpipe(interface_to_usbdev(intf), ep->bEndpointAddress),
658 desc->sbuf,
659 desc->wMaxPacketSize,
660 wdm_int_callback,
661 desc,
662 ep->bInterval
663 );
664 desc->validity->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
665
666 usb_set_intfdata(intf, desc);
667 rv = usb_register_dev(intf, &wdm_class);
668 dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n",
669 intf->minor - WDM_MINOR_BASE);
670 if (rv < 0)
671 goto err;
672out:
673 return rv;
674err2:
675 usb_buffer_free(interface_to_usbdev(desc->intf),
676 desc->wMaxPacketSize,
677 desc->sbuf,
678 desc->validity->transfer_dma);
679err:
680 free_urbs(desc);
681 kfree(desc->ubuf);
682 kfree(desc->orq);
683 kfree(desc->irq);
684 kfree(desc);
685 return rv;
686}
687
688static void wdm_disconnect(struct usb_interface *intf)
689{
690 struct wdm_device *desc;
691 unsigned long flags;
692
693 usb_deregister_dev(intf, &wdm_class);
694 mutex_lock(&wdm_mutex);
695 desc = usb_get_intfdata(intf);
696
697 /* the spinlock makes sure no new urbs are generated in the callbacks */
698 spin_lock_irqsave(&desc->iuspin, flags);
699 set_bit(WDM_DISCONNECTING, &desc->flags);
700 set_bit(WDM_READ, &desc->flags);
701 clear_bit(WDM_IN_USE, &desc->flags);
702 spin_unlock_irqrestore(&desc->iuspin, flags);
703 cancel_work_sync(&desc->rxwork);
704 kill_urbs(desc);
705 wake_up_all(&desc->wait);
706 if (!desc->count)
707 cleanup(desc);
708 mutex_unlock(&wdm_mutex);
709}
710
711static struct usb_driver wdm_driver = {
712 .name = "cdc_wdm",
713 .probe = wdm_probe,
714 .disconnect = wdm_disconnect,
715 .id_table = wdm_ids,
716};
717
718/* --- low level module stuff --- */
719
720static int __init wdm_init(void)
721{
722 int rv;
723
724 rv = usb_register(&wdm_driver);
725
726 return rv;
727}
728
729static void __exit wdm_exit(void)
730{
731 usb_deregister(&wdm_driver);
732}
733
734module_init(wdm_init);
735module_exit(wdm_exit);
736
737MODULE_AUTHOR(DRIVER_AUTHOR);
738MODULE_DESCRIPTION("USB Abstract Control Model driver for "
739 "USB WCM Device Management");
740MODULE_LICENSE("GPL");
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 99e5a68a3f12..fae55a31e26d 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -156,6 +156,10 @@ static struct attribute *ep_dev_attrs[] = {
156static struct attribute_group ep_dev_attr_grp = { 156static struct attribute_group ep_dev_attr_grp = {
157 .attrs = ep_dev_attrs, 157 .attrs = ep_dev_attrs,
158}; 158};
159static struct attribute_group *ep_dev_groups[] = {
160 &ep_dev_attr_grp,
161 NULL
162};
159 163
160static int usb_endpoint_major_init(void) 164static int usb_endpoint_major_init(void)
161{ 165{
@@ -298,6 +302,7 @@ int usb_create_ep_files(struct device *parent,
298 302
299 ep_dev->desc = &endpoint->desc; 303 ep_dev->desc = &endpoint->desc;
300 ep_dev->udev = udev; 304 ep_dev->udev = udev;
305 ep_dev->dev.groups = ep_dev_groups;
301 ep_dev->dev.devt = MKDEV(usb_endpoint_major, ep_dev->minor); 306 ep_dev->dev.devt = MKDEV(usb_endpoint_major, ep_dev->minor);
302 ep_dev->dev.class = ep_class->class; 307 ep_dev->dev.class = ep_class->class;
303 ep_dev->dev.parent = parent; 308 ep_dev->dev.parent = parent;
@@ -309,9 +314,6 @@ int usb_create_ep_files(struct device *parent,
309 retval = device_register(&ep_dev->dev); 314 retval = device_register(&ep_dev->dev);
310 if (retval) 315 if (retval)
311 goto error_chrdev; 316 goto error_chrdev;
312 retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
313 if (retval)
314 goto error_group;
315 317
316 /* create the symlink to the old-style "ep_XX" directory */ 318 /* create the symlink to the old-style "ep_XX" directory */
317 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); 319 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress);
@@ -322,8 +324,6 @@ int usb_create_ep_files(struct device *parent,
322 return retval; 324 return retval;
323 325
324error_link: 326error_link:
325 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
326error_group:
327 device_unregister(&ep_dev->dev); 327 device_unregister(&ep_dev->dev);
328 destroy_endpoint_class(); 328 destroy_endpoint_class();
329 return retval; 329 return retval;
@@ -348,7 +348,6 @@ void usb_remove_ep_files(struct usb_host_endpoint *endpoint)
348 348
349 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); 349 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress);
350 sysfs_remove_link(&ep_dev->dev.parent->kobj, name); 350 sysfs_remove_link(&ep_dev->dev.parent->kobj, name);
351 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
352 device_unregister(&ep_dev->dev); 351 device_unregister(&ep_dev->dev);
353 endpoint->ep_dev = NULL; 352 endpoint->ep_dev = NULL;
354 destroy_endpoint_class(); 353 destroy_endpoint_class();
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index c1cb94e9f242..7e912f21fd36 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -155,9 +155,6 @@ static int generic_probe(struct usb_device *udev)
155{ 155{
156 int err, c; 156 int err, c;
157 157
158 /* put device-specific files into sysfs */
159 usb_create_sysfs_dev_files(udev);
160
161 /* Choose and set the configuration. This registers the interfaces 158 /* Choose and set the configuration. This registers the interfaces
162 * with the driver core and lets interface drivers bind to them. 159 * with the driver core and lets interface drivers bind to them.
163 */ 160 */
@@ -189,8 +186,6 @@ static void generic_disconnect(struct usb_device *udev)
189 * unconfigure the device */ 186 * unconfigure the device */
190 if (udev->actconfig) 187 if (udev->actconfig)
191 usb_set_configuration(udev, -1); 188 usb_set_configuration(udev, -1);
192
193 usb_remove_sysfs_dev_files(udev);
194} 189}
195 190
196#ifdef CONFIG_PM 191#ifdef CONFIG_PM
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index bf10e9c4195e..09a53e7f3327 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -818,12 +818,12 @@ static int usb_register_bus(struct usb_bus *bus)
818 set_bit (busnum, busmap.busmap); 818 set_bit (busnum, busmap.busmap);
819 bus->busnum = busnum; 819 bus->busnum = busnum;
820 820
821 bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0), 821 bus->dev = device_create_drvdata(usb_host_class, bus->controller,
822 "usb_host%d", busnum); 822 MKDEV(0, 0), bus,
823 "usb_host%d", busnum);
823 result = PTR_ERR(bus->dev); 824 result = PTR_ERR(bus->dev);
824 if (IS_ERR(bus->dev)) 825 if (IS_ERR(bus->dev))
825 goto error_create_class_dev; 826 goto error_create_class_dev;
826 dev_set_drvdata(bus->dev, bus);
827 827
828 /* Add it to the local list of buses */ 828 /* Add it to the local list of buses */
829 list_add (&bus->bus_list, &usb_bus_list); 829 list_add (&bus->bus_list, &usb_bus_list);
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 1e4b81e9eb50..a0bf5df6cb6f 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -213,6 +213,8 @@ struct hc_driver {
213 213
214 /* force handover of high-speed port to full-speed companion */ 214 /* force handover of high-speed port to full-speed companion */
215 void (*relinquish_port)(struct usb_hcd *, int); 215 void (*relinquish_port)(struct usb_hcd *, int);
216 /* has a port been handed over to a companion? */
217 int (*port_handed_over)(struct usb_hcd *, int);
216}; 218};
217 219
218extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 220extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index eb57fcc701d7..94789be54ca3 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -644,6 +644,48 @@ static void hub_stop(struct usb_hub *hub)
644 644
645#ifdef CONFIG_PM 645#ifdef CONFIG_PM
646 646
647/* Try to identify which devices need USB-PERSIST handling */
648static int persistent_device(struct usb_device *udev)
649{
650 int i;
651 int retval;
652 struct usb_host_config *actconfig;
653
654 /* Explicitly not marked persistent? */
655 if (!udev->persist_enabled)
656 return 0;
657
658 /* No active config? */
659 actconfig = udev->actconfig;
660 if (!actconfig)
661 return 0;
662
663 /* FIXME! We should check whether it's open here or not! */
664
665 /*
666 * Check that all the interface drivers have a
667 * 'reset_resume' entrypoint
668 */
669 retval = 0;
670 for (i = 0; i < actconfig->desc.bNumInterfaces; i++) {
671 struct usb_interface *intf;
672 struct usb_driver *driver;
673
674 intf = actconfig->interface[i];
675 if (!intf->dev.driver)
676 continue;
677 driver = to_usb_driver(intf->dev.driver);
678 if (!driver->reset_resume)
679 return 0;
680 /*
681 * We have at least one driver, and that one
682 * has a reset_resume method.
683 */
684 retval = 1;
685 }
686 return retval;
687}
688
647static void hub_restart(struct usb_hub *hub, int type) 689static void hub_restart(struct usb_hub *hub, int type)
648{ 690{
649 struct usb_device *hdev = hub->hdev; 691 struct usb_device *hdev = hub->hdev;
@@ -689,8 +731,8 @@ static void hub_restart(struct usb_hub *hub, int type)
689 * turn off the various status changes to prevent 731 * turn off the various status changes to prevent
690 * khubd from disconnecting it later. 732 * khubd from disconnecting it later.
691 */ 733 */
692 if (udev->persist_enabled && status == 0 && 734 if (status == 0 && !(portstatus & USB_PORT_STAT_ENABLE) &&
693 !(portstatus & USB_PORT_STAT_ENABLE)) { 735 persistent_device(udev)) {
694 if (portchange & USB_PORT_STAT_C_ENABLE) 736 if (portchange & USB_PORT_STAT_C_ENABLE)
695 clear_port_feature(hub->hdev, port1, 737 clear_port_feature(hub->hdev, port1,
696 USB_PORT_FEAT_C_ENABLE); 738 USB_PORT_FEAT_C_ENABLE);
@@ -1326,6 +1368,12 @@ void usb_disconnect(struct usb_device **pdev)
1326 1368
1327 usb_unlock_device(udev); 1369 usb_unlock_device(udev);
1328 1370
1371 /* Remove the device-specific files from sysfs. This must be
1372 * done with udev unlocked, because some of the attribute
1373 * routines try to acquire the device lock.
1374 */
1375 usb_remove_sysfs_dev_files(udev);
1376
1329 /* Unregister the device. The device driver is responsible 1377 /* Unregister the device. The device driver is responsible
1330 * for removing the device files from usbfs and sysfs and for 1378 * for removing the device files from usbfs and sysfs and for
1331 * de-configuring the device. 1379 * de-configuring the device.
@@ -1541,6 +1589,9 @@ int usb_new_device(struct usb_device *udev)
1541 goto fail; 1589 goto fail;
1542 } 1590 }
1543 1591
1592 /* put device-specific files into sysfs */
1593 usb_create_sysfs_dev_files(udev);
1594
1544 /* Tell the world! */ 1595 /* Tell the world! */
1545 announce_device(udev); 1596 announce_device(udev);
1546 return err; 1597 return err;
@@ -2744,7 +2795,11 @@ loop:
2744 if ((status == -ENOTCONN) || (status == -ENOTSUPP)) 2795 if ((status == -ENOTCONN) || (status == -ENOTSUPP))
2745 break; 2796 break;
2746 } 2797 }
2747 dev_err(hub_dev, "unable to enumerate USB device on port %d\n", port1); 2798 if (hub->hdev->parent ||
2799 !hcd->driver->port_handed_over ||
2800 !(hcd->driver->port_handed_over)(hcd, port1))
2801 dev_err(hub_dev, "unable to enumerate USB device on port %d\n",
2802 port1);
2748 2803
2749done: 2804done:
2750 hub_port_disable(hub, port1, 1); 2805 hub_port_disable(hub, port1, 1);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 3e69266e1f4d..fe47d145255a 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1607,6 +1607,7 @@ free_interfaces:
1607 intf->dev.driver = NULL; 1607 intf->dev.driver = NULL;
1608 intf->dev.bus = &usb_bus_type; 1608 intf->dev.bus = &usb_bus_type;
1609 intf->dev.type = &usb_if_device_type; 1609 intf->dev.type = &usb_if_device_type;
1610 intf->dev.groups = usb_interface_groups;
1610 intf->dev.dma_mask = dev->dev.dma_mask; 1611 intf->dev.dma_mask = dev->dev.dma_mask;
1611 device_initialize(&intf->dev); 1612 device_initialize(&intf->dev);
1612 mark_quiesced(intf); 1613 mark_quiesced(intf);
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 2e2019390290..3da1ab4b389d 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -47,6 +47,10 @@ static const struct usb_device_id usb_quirk_list[] = {
47 /* Edirol SD-20 */ 47 /* Edirol SD-20 */
48 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, 48 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
49 49
50 /* Avision AV600U */
51 { USB_DEVICE(0x0638, 0x0a13), .driver_info =
52 USB_QUIRK_STRING_FETCH_255 },
53
50 /* M-Systems Flash Disk Pioneers */ 54 /* M-Systems Flash Disk Pioneers */
51 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, 55 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
52 56
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 5b20a60de8ba..5e1f5d55bf04 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -538,6 +538,46 @@ static struct attribute_group dev_attr_grp = {
538 .attrs = dev_attrs, 538 .attrs = dev_attrs,
539}; 539};
540 540
541/* When modifying this list, be sure to modify dev_string_attrs_are_visible()
542 * accordingly.
543 */
544static struct attribute *dev_string_attrs[] = {
545 &dev_attr_manufacturer.attr,
546 &dev_attr_product.attr,
547 &dev_attr_serial.attr,
548 NULL
549};
550
551static mode_t dev_string_attrs_are_visible(struct kobject *kobj,
552 struct attribute *a, int n)
553{
554 struct usb_device *udev = to_usb_device(
555 container_of(kobj, struct device, kobj));
556
557 if (a == &dev_attr_manufacturer.attr) {
558 if (udev->manufacturer == NULL)
559 return 0;
560 } else if (a == &dev_attr_product.attr) {
561 if (udev->product == NULL)
562 return 0;
563 } else if (a == &dev_attr_serial.attr) {
564 if (udev->serial == NULL)
565 return 0;
566 }
567 return a->mode;
568}
569
570static struct attribute_group dev_string_attr_grp = {
571 .attrs = dev_string_attrs,
572 .is_visible = dev_string_attrs_are_visible,
573};
574
575struct attribute_group *usb_device_groups[] = {
576 &dev_attr_grp,
577 &dev_string_attr_grp,
578 NULL
579};
580
541/* Binary descriptors */ 581/* Binary descriptors */
542 582
543static ssize_t 583static ssize_t
@@ -548,35 +588,33 @@ read_descriptors(struct kobject *kobj, struct bin_attribute *attr,
548 container_of(kobj, struct device, kobj)); 588 container_of(kobj, struct device, kobj));
549 size_t nleft = count; 589 size_t nleft = count;
550 size_t srclen, n; 590 size_t srclen, n;
591 int cfgno;
592 void *src;
551 593
552 usb_lock_device(udev); 594 /* The binary attribute begins with the device descriptor.
553 595 * Following that are the raw descriptor entries for all the
554 /* The binary attribute begins with the device descriptor */ 596 * configurations (config plus subsidiary descriptors).
555 srclen = sizeof(struct usb_device_descriptor);
556 if (off < srclen) {
557 n = min_t(size_t, nleft, srclen - off);
558 memcpy(buf, off + (char *) &udev->descriptor, n);
559 nleft -= n;
560 buf += n;
561 off = 0;
562 } else {
563 off -= srclen;
564 }
565
566 /* Then follows the raw descriptor entry for the current
567 * configuration (config plus subsidiary descriptors).
568 */ 597 */
569 if (udev->actconfig) { 598 for (cfgno = -1; cfgno < udev->descriptor.bNumConfigurations &&
570 int cfgno = udev->actconfig - udev->config; 599 nleft > 0; ++cfgno) {
571 600 if (cfgno < 0) {
572 srclen = __le16_to_cpu(udev->actconfig->desc.wTotalLength); 601 src = &udev->descriptor;
602 srclen = sizeof(struct usb_device_descriptor);
603 } else {
604 src = udev->rawdescriptors[cfgno];
605 srclen = __le16_to_cpu(udev->config[cfgno].desc.
606 wTotalLength);
607 }
573 if (off < srclen) { 608 if (off < srclen) {
574 n = min_t(size_t, nleft, srclen - off); 609 n = min(nleft, srclen - (size_t) off);
575 memcpy(buf, off + udev->rawdescriptors[cfgno], n); 610 memcpy(buf, src + off, n);
576 nleft -= n; 611 nleft -= n;
612 buf += n;
613 off = 0;
614 } else {
615 off -= srclen;
577 } 616 }
578 } 617 }
579 usb_unlock_device(udev);
580 return count - nleft; 618 return count - nleft;
581} 619}
582 620
@@ -591,10 +629,9 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
591 struct device *dev = &udev->dev; 629 struct device *dev = &udev->dev;
592 int retval; 630 int retval;
593 631
594 retval = sysfs_create_group(&dev->kobj, &dev_attr_grp); 632 /* Unforunately these attributes cannot be created before
595 if (retval) 633 * the uevent is broadcast.
596 return retval; 634 */
597
598 retval = device_create_bin_file(dev, &dev_bin_attr_descriptors); 635 retval = device_create_bin_file(dev, &dev_bin_attr_descriptors);
599 if (retval) 636 if (retval)
600 goto error; 637 goto error;
@@ -607,21 +644,6 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
607 if (retval) 644 if (retval)
608 goto error; 645 goto error;
609 646
610 if (udev->manufacturer) {
611 retval = device_create_file(dev, &dev_attr_manufacturer);
612 if (retval)
613 goto error;
614 }
615 if (udev->product) {
616 retval = device_create_file(dev, &dev_attr_product);
617 if (retval)
618 goto error;
619 }
620 if (udev->serial) {
621 retval = device_create_file(dev, &dev_attr_serial);
622 if (retval)
623 goto error;
624 }
625 retval = usb_create_ep_files(dev, &udev->ep0, udev); 647 retval = usb_create_ep_files(dev, &udev->ep0, udev);
626 if (retval) 648 if (retval)
627 goto error; 649 goto error;
@@ -636,13 +658,9 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev)
636 struct device *dev = &udev->dev; 658 struct device *dev = &udev->dev;
637 659
638 usb_remove_ep_files(&udev->ep0); 660 usb_remove_ep_files(&udev->ep0);
639 device_remove_file(dev, &dev_attr_manufacturer);
640 device_remove_file(dev, &dev_attr_product);
641 device_remove_file(dev, &dev_attr_serial);
642 remove_power_attributes(dev); 661 remove_power_attributes(dev);
643 remove_persist_attributes(dev); 662 remove_persist_attributes(dev);
644 device_remove_bin_file(dev, &dev_bin_attr_descriptors); 663 device_remove_bin_file(dev, &dev_bin_attr_descriptors);
645 sysfs_remove_group(&dev->kobj, &dev_attr_grp);
646} 664}
647 665
648/* Interface Accociation Descriptor fields */ 666/* Interface Accociation Descriptor fields */
@@ -688,17 +706,15 @@ static ssize_t show_interface_string(struct device *dev,
688 struct device_attribute *attr, char *buf) 706 struct device_attribute *attr, char *buf)
689{ 707{
690 struct usb_interface *intf; 708 struct usb_interface *intf;
691 struct usb_device *udev; 709 char *string;
692 int len;
693 710
694 intf = to_usb_interface(dev); 711 intf = to_usb_interface(dev);
695 udev = interface_to_usbdev(intf); 712 string = intf->cur_altsetting->string;
696 len = snprintf(buf, 256, "%s", intf->cur_altsetting->string); 713 barrier(); /* The altsetting might change! */
697 if (len < 0) 714
715 if (!string)
698 return 0; 716 return 0;
699 buf[len] = '\n'; 717 return sprintf(buf, "%s\n", string);
700 buf[len+1] = 0;
701 return len+1;
702} 718}
703static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); 719static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL);
704 720
@@ -727,18 +743,6 @@ static ssize_t show_modalias(struct device *dev,
727} 743}
728static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); 744static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
729 745
730static struct attribute *intf_assoc_attrs[] = {
731 &dev_attr_iad_bFirstInterface.attr,
732 &dev_attr_iad_bInterfaceCount.attr,
733 &dev_attr_iad_bFunctionClass.attr,
734 &dev_attr_iad_bFunctionSubClass.attr,
735 &dev_attr_iad_bFunctionProtocol.attr,
736 NULL,
737};
738static struct attribute_group intf_assoc_attr_grp = {
739 .attrs = intf_assoc_attrs,
740};
741
742static struct attribute *intf_attrs[] = { 746static struct attribute *intf_attrs[] = {
743 &dev_attr_bInterfaceNumber.attr, 747 &dev_attr_bInterfaceNumber.attr,
744 &dev_attr_bAlternateSetting.attr, 748 &dev_attr_bAlternateSetting.attr,
@@ -753,6 +757,37 @@ static struct attribute_group intf_attr_grp = {
753 .attrs = intf_attrs, 757 .attrs = intf_attrs,
754}; 758};
755 759
760static struct attribute *intf_assoc_attrs[] = {
761 &dev_attr_iad_bFirstInterface.attr,
762 &dev_attr_iad_bInterfaceCount.attr,
763 &dev_attr_iad_bFunctionClass.attr,
764 &dev_attr_iad_bFunctionSubClass.attr,
765 &dev_attr_iad_bFunctionProtocol.attr,
766 NULL,
767};
768
769static mode_t intf_assoc_attrs_are_visible(struct kobject *kobj,
770 struct attribute *a, int n)
771{
772 struct usb_interface *intf = to_usb_interface(
773 container_of(kobj, struct device, kobj));
774
775 if (intf->intf_assoc == NULL)
776 return 0;
777 return a->mode;
778}
779
780static struct attribute_group intf_assoc_attr_grp = {
781 .attrs = intf_assoc_attrs,
782 .is_visible = intf_assoc_attrs_are_visible,
783};
784
785struct attribute_group *usb_interface_groups[] = {
786 &intf_attr_grp,
787 &intf_assoc_attr_grp,
788 NULL
789};
790
756static inline void usb_create_intf_ep_files(struct usb_interface *intf, 791static inline void usb_create_intf_ep_files(struct usb_interface *intf,
757 struct usb_device *udev) 792 struct usb_device *udev)
758{ 793{
@@ -777,23 +812,21 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
777 812
778int usb_create_sysfs_intf_files(struct usb_interface *intf) 813int usb_create_sysfs_intf_files(struct usb_interface *intf)
779{ 814{
780 struct device *dev = &intf->dev;
781 struct usb_device *udev = interface_to_usbdev(intf); 815 struct usb_device *udev = interface_to_usbdev(intf);
782 struct usb_host_interface *alt = intf->cur_altsetting; 816 struct usb_host_interface *alt = intf->cur_altsetting;
783 int retval; 817 int retval;
784 818
785 if (intf->sysfs_files_created) 819 if (intf->sysfs_files_created)
786 return 0; 820 return 0;
787 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp);
788 if (retval)
789 return retval;
790 821
822 /* The interface string may be present in some altsettings
823 * and missing in others. Hence its attribute cannot be created
824 * before the uevent is broadcast.
825 */
791 if (alt->string == NULL) 826 if (alt->string == NULL)
792 alt->string = usb_cache_string(udev, alt->desc.iInterface); 827 alt->string = usb_cache_string(udev, alt->desc.iInterface);
793 if (alt->string) 828 if (alt->string)
794 retval = device_create_file(dev, &dev_attr_interface); 829 retval = device_create_file(&intf->dev, &dev_attr_interface);
795 if (intf->intf_assoc)
796 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp);
797 usb_create_intf_ep_files(intf, udev); 830 usb_create_intf_ep_files(intf, udev);
798 intf->sysfs_files_created = 1; 831 intf->sysfs_files_created = 1;
799 return 0; 832 return 0;
@@ -807,7 +840,5 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf)
807 return; 840 return;
808 usb_remove_intf_ep_files(intf); 841 usb_remove_intf_ep_files(intf);
809 device_remove_file(dev, &dev_attr_interface); 842 device_remove_file(dev, &dev_attr_interface);
810 sysfs_remove_group(&dev->kobj, &intf_attr_grp);
811 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp);
812 intf->sysfs_files_created = 0; 843 intf->sysfs_files_created = 0;
813} 844}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 1f0db51190cc..325774375837 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -291,6 +291,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
291 device_initialize(&dev->dev); 291 device_initialize(&dev->dev);
292 dev->dev.bus = &usb_bus_type; 292 dev->dev.bus = &usb_bus_type;
293 dev->dev.type = &usb_device_type; 293 dev->dev.type = &usb_device_type;
294 dev->dev.groups = usb_device_groups;
294 dev->dev.dma_mask = bus->controller->dma_mask; 295 dev->dev.dma_mask = bus->controller->dma_mask;
295 set_dev_node(&dev->dev, dev_to_node(bus->controller)); 296 set_dev_node(&dev->dev, dev_to_node(bus->controller));
296 dev->state = USB_STATE_ATTACHED; 297 dev->state = USB_STATE_ATTACHED;
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 1bf8ccb9c58d..1a8bc21c335e 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -130,6 +130,10 @@ static inline int is_active(const struct usb_interface *f)
130/* for labeling diagnostics */ 130/* for labeling diagnostics */
131extern const char *usbcore_name; 131extern const char *usbcore_name;
132 132
133/* sysfs stuff */
134extern struct attribute_group *usb_device_groups[];
135extern struct attribute_group *usb_interface_groups[];
136
133/* usbfs stuff */ 137/* usbfs stuff */
134extern struct mutex usbfs_mutex; 138extern struct mutex usbfs_mutex;
135extern struct usb_driver usbfs_driver; 139extern struct usb_driver usbfs_driver;
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index ce337cb5d137..f261d2a9a5f0 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -3251,7 +3251,7 @@ static int udc_pci_probe(
3251 /* pci setup */ 3251 /* pci setup */
3252 if (pci_enable_device(pdev) < 0) { 3252 if (pci_enable_device(pdev) < 0) {
3253 kfree(dev); 3253 kfree(dev);
3254 dev = 0; 3254 dev = NULL;
3255 retval = -ENODEV; 3255 retval = -ENODEV;
3256 goto finished; 3256 goto finished;
3257 } 3257 }
@@ -3264,7 +3264,7 @@ static int udc_pci_probe(
3264 if (!request_mem_region(resource, len, name)) { 3264 if (!request_mem_region(resource, len, name)) {
3265 dev_dbg(&pdev->dev, "pci device used already\n"); 3265 dev_dbg(&pdev->dev, "pci device used already\n");
3266 kfree(dev); 3266 kfree(dev);
3267 dev = 0; 3267 dev = NULL;
3268 retval = -EBUSY; 3268 retval = -EBUSY;
3269 goto finished; 3269 goto finished;
3270 } 3270 }
@@ -3274,7 +3274,7 @@ static int udc_pci_probe(
3274 if (dev->virt_addr == NULL) { 3274 if (dev->virt_addr == NULL) {
3275 dev_dbg(&pdev->dev, "start address cannot be mapped\n"); 3275 dev_dbg(&pdev->dev, "start address cannot be mapped\n");
3276 kfree(dev); 3276 kfree(dev);
3277 dev = 0; 3277 dev = NULL;
3278 retval = -EFAULT; 3278 retval = -EFAULT;
3279 goto finished; 3279 goto finished;
3280 } 3280 }
@@ -3282,7 +3282,7 @@ static int udc_pci_probe(
3282 if (!pdev->irq) { 3282 if (!pdev->irq) {
3283 dev_err(&dev->pdev->dev, "irq not set\n"); 3283 dev_err(&dev->pdev->dev, "irq not set\n");
3284 kfree(dev); 3284 kfree(dev);
3285 dev = 0; 3285 dev = NULL;
3286 retval = -ENODEV; 3286 retval = -ENODEV;
3287 goto finished; 3287 goto finished;
3288 } 3288 }
@@ -3290,7 +3290,7 @@ static int udc_pci_probe(
3290 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { 3290 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) {
3291 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); 3291 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq);
3292 kfree(dev); 3292 kfree(dev);
3293 dev = 0; 3293 dev = NULL;
3294 retval = -EBUSY; 3294 retval = -EBUSY;
3295 goto finished; 3295 goto finished;
3296 } 3296 }
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index e756023362c2..07e5a0b5dcda 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -649,7 +649,13 @@ static int usba_ep_disable(struct usb_ep *_ep)
649 649
650 if (!ep->desc) { 650 if (!ep->desc) {
651 spin_unlock_irqrestore(&udc->lock, flags); 651 spin_unlock_irqrestore(&udc->lock, flags);
652 DBG(DBG_ERR, "ep_disable: %s not enabled\n", ep->ep.name); 652 /* REVISIT because this driver disables endpoints in
653 * reset_all_endpoints() before calling disconnect(),
654 * most gadget drivers would trigger this non-error ...
655 */
656 if (udc->gadget.speed != USB_SPEED_UNKNOWN)
657 DBG(DBG_ERR, "ep_disable: %s not enabled\n",
658 ep->ep.name);
653 return -EINVAL; 659 return -EINVAL;
654 } 660 }
655 ep->desc = NULL; 661 ep->desc = NULL;
@@ -1032,8 +1038,6 @@ static struct usba_udc the_udc = {
1032 .release = nop_release, 1038 .release = nop_release,
1033 }, 1039 },
1034 }, 1040 },
1035
1036 .lock = SPIN_LOCK_UNLOCKED,
1037}; 1041};
1038 1042
1039/* 1043/*
@@ -1052,6 +1056,12 @@ static void reset_all_endpoints(struct usba_udc *udc)
1052 request_complete(ep, req, -ECONNRESET); 1056 request_complete(ep, req, -ECONNRESET);
1053 } 1057 }
1054 1058
1059 /* NOTE: normally, the next call to the gadget driver is in
1060 * charge of disabling endpoints... usually disconnect().
1061 * The exception would be entering a high speed test mode.
1062 *
1063 * FIXME remove this code ... and retest thoroughly.
1064 */
1055 list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { 1065 list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
1056 if (ep->desc) { 1066 if (ep->desc) {
1057 spin_unlock(&udc->lock); 1067 spin_unlock(&udc->lock);
@@ -1219,7 +1229,7 @@ static inline bool feature_is_ep_halt(struct usb_ctrlrequest *crq)
1219static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep, 1229static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep,
1220 struct usb_ctrlrequest *crq) 1230 struct usb_ctrlrequest *crq)
1221{ 1231{
1222 int retval = 0;; 1232 int retval = 0;
1223 1233
1224 switch (crq->bRequest) { 1234 switch (crq->bRequest) {
1225 case USB_REQ_GET_STATUS: { 1235 case USB_REQ_GET_STATUS: {
@@ -1693,6 +1703,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
1693 usba_writel(udc, INT_CLR, USBA_END_OF_RESET); 1703 usba_writel(udc, INT_CLR, USBA_END_OF_RESET);
1694 reset_all_endpoints(udc); 1704 reset_all_endpoints(udc);
1695 1705
1706 if (udc->gadget.speed != USB_SPEED_UNKNOWN
1707 && udc->driver->disconnect) {
1708 udc->gadget.speed = USB_SPEED_UNKNOWN;
1709 spin_unlock(&udc->lock);
1710 udc->driver->disconnect(&udc->gadget);
1711 spin_lock(&udc->lock);
1712 }
1713
1696 if (status & USBA_HIGH_SPEED) { 1714 if (status & USBA_HIGH_SPEED) {
1697 DBG(DBG_BUS, "High-speed bus reset detected\n"); 1715 DBG(DBG_BUS, "High-speed bus reset detected\n");
1698 udc->gadget.speed = USB_SPEED_HIGH; 1716 udc->gadget.speed = USB_SPEED_HIGH;
@@ -1716,9 +1734,13 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
1716 | USBA_DET_SUSPEND 1734 | USBA_DET_SUSPEND
1717 | USBA_END_OF_RESUME)); 1735 | USBA_END_OF_RESUME));
1718 1736
1737 /*
1738 * Unclear why we hit this irregularly, e.g. in usbtest,
1739 * but it's clearly harmless...
1740 */
1719 if (!(usba_ep_readl(ep0, CFG) & USBA_EPT_MAPPED)) 1741 if (!(usba_ep_readl(ep0, CFG) & USBA_EPT_MAPPED))
1720 dev_warn(&udc->pdev->dev, 1742 dev_dbg(&udc->pdev->dev,
1721 "WARNING: EP0 configuration is invalid!\n"); 1743 "ODD: EP0 configuration is invalid!\n");
1722 } 1744 }
1723 1745
1724 spin_unlock(&udc->lock); 1746 spin_unlock(&udc->lock);
@@ -1751,9 +1773,11 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
1751 reset_all_endpoints(udc); 1773 reset_all_endpoints(udc);
1752 toggle_bias(0); 1774 toggle_bias(0);
1753 usba_writel(udc, CTRL, USBA_DISABLE_MASK); 1775 usba_writel(udc, CTRL, USBA_DISABLE_MASK);
1754 spin_unlock(&udc->lock); 1776 if (udc->driver->disconnect) {
1755 udc->driver->disconnect(&udc->gadget); 1777 spin_unlock(&udc->lock);
1756 spin_lock(&udc->lock); 1778 udc->driver->disconnect(&udc->gadget);
1779 spin_lock(&udc->lock);
1780 }
1757 } 1781 }
1758 udc->vbus_prev = vbus; 1782 udc->vbus_prev = vbus;
1759 } 1783 }
@@ -1825,7 +1849,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1825 1849
1826 if (!udc->pdev) 1850 if (!udc->pdev)
1827 return -ENODEV; 1851 return -ENODEV;
1828 if (driver != udc->driver) 1852 if (driver != udc->driver || !driver->unbind)
1829 return -EINVAL; 1853 return -EINVAL;
1830 1854
1831 if (udc->vbus_pin != -1) 1855 if (udc->vbus_pin != -1)
@@ -1840,6 +1864,9 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1840 toggle_bias(0); 1864 toggle_bias(0);
1841 usba_writel(udc, CTRL, USBA_DISABLE_MASK); 1865 usba_writel(udc, CTRL, USBA_DISABLE_MASK);
1842 1866
1867 if (udc->driver->disconnect)
1868 udc->driver->disconnect(&udc->gadget);
1869
1843 driver->unbind(&udc->gadget); 1870 driver->unbind(&udc->gadget);
1844 udc->gadget.dev.driver = NULL; 1871 udc->gadget.dev.driver = NULL;
1845 udc->driver = NULL; 1872 udc->driver = NULL;
@@ -1879,6 +1906,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1879 goto err_get_hclk; 1906 goto err_get_hclk;
1880 } 1907 }
1881 1908
1909 spin_lock_init(&udc->lock);
1882 udc->pdev = pdev; 1910 udc->pdev = pdev;
1883 udc->pclk = pclk; 1911 udc->pclk = pclk;
1884 udc->hclk = hclk; 1912 udc->hclk = hclk;
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 651b82701394..18687543d7fa 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -1627,7 +1627,9 @@ static int reset_queues(struct fsl_udc *udc)
1627 udc_reset_ep_queue(udc, pipe); 1627 udc_reset_ep_queue(udc, pipe);
1628 1628
1629 /* report disconnect; the driver is already quiesced */ 1629 /* report disconnect; the driver is already quiesced */
1630 spin_unlock(&udc->lock);
1630 udc->driver->disconnect(&udc->gadget); 1631 udc->driver->disconnect(&udc->gadget);
1632 spin_lock(&udc->lock);
1631 1633
1632 return 0; 1634 return 0;
1633} 1635}
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 75eba202f737..e02bfd4df3a6 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1526,7 +1526,8 @@ static void udc_disable(struct pxa_udc *udc)
1526 1526
1527 ep0_idle(udc); 1527 ep0_idle(udc);
1528 udc->gadget.speed = USB_SPEED_UNKNOWN; 1528 udc->gadget.speed = USB_SPEED_UNKNOWN;
1529 udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); 1529 if (udc->mach->udc_command)
1530 udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
1530} 1531}
1531 1532
1532/** 1533/**
@@ -1546,7 +1547,6 @@ static __init void udc_init_data(struct pxa_udc *dev)
1546 INIT_LIST_HEAD(&dev->gadget.ep0->ep_list); 1547 INIT_LIST_HEAD(&dev->gadget.ep0->ep_list);
1547 dev->udc_usb_ep[0].pxa_ep = &dev->pxa_ep[0]; 1548 dev->udc_usb_ep[0].pxa_ep = &dev->pxa_ep[0];
1548 ep0_idle(dev); 1549 ep0_idle(dev);
1549 strcpy(dev->dev->bus_id, "");
1550 1550
1551 /* PXA endpoints init */ 1551 /* PXA endpoints init */
1552 for (i = 0; i < NR_PXA_ENDPOINTS; i++) { 1552 for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
@@ -1746,13 +1746,10 @@ static void handle_ep0_ctrl_req(struct pxa_udc *udc,
1746 ep_err(ep, "wrong to have extra bytes for setup : 0x%08x\n", i); 1746 ep_err(ep, "wrong to have extra bytes for setup : 0x%08x\n", i);
1747 } 1747 }
1748 1748
1749 le16_to_cpus(&u.r.wValue);
1750 le16_to_cpus(&u.r.wIndex);
1751 le16_to_cpus(&u.r.wLength);
1752
1753 ep_dbg(ep, "SETUP %02x.%02x v%04x i%04x l%04x\n", 1749 ep_dbg(ep, "SETUP %02x.%02x v%04x i%04x l%04x\n",
1754 u.r.bRequestType, u.r.bRequest, 1750 u.r.bRequestType, u.r.bRequest,
1755 u.r.wValue, u.r.wIndex, u.r.wLength); 1751 le16_to_cpu(u.r.wValue), le16_to_cpu(u.r.wIndex),
1752 le16_to_cpu(u.r.wLength));
1756 if (unlikely(have_extrabytes)) 1753 if (unlikely(have_extrabytes))
1757 goto stall; 1754 goto stall;
1758 1755
@@ -2296,7 +2293,8 @@ static void pxa_udc_shutdown(struct platform_device *_dev)
2296{ 2293{
2297 struct pxa_udc *udc = platform_get_drvdata(_dev); 2294 struct pxa_udc *udc = platform_get_drvdata(_dev);
2298 2295
2299 udc_disable(udc); 2296 if (udc_readl(udc, UDCCR) & UDCCR_UDE)
2297 udc_disable(udc);
2300} 2298}
2301 2299
2302#ifdef CONFIG_PM 2300#ifdef CONFIG_PM
@@ -2361,9 +2359,8 @@ static int pxa_udc_resume(struct platform_device *_dev)
2361 * Upon exit from sleep mode and before clearing OTGPH, 2359 * Upon exit from sleep mode and before clearing OTGPH,
2362 * Software must configure the USB OTG pad, UDC, and UHC 2360 * Software must configure the USB OTG pad, UDC, and UHC
2363 * to the state they were in before entering sleep mode. 2361 * to the state they were in before entering sleep mode.
2364 *
2365 * Should be : PSSR |= PSSR_OTGPH;
2366 */ 2362 */
2363 PSSR |= PSSR_OTGPH;
2367 2364
2368 return 0; 2365 return 0;
2369} 2366}
@@ -2387,6 +2384,9 @@ static struct platform_driver udc_driver = {
2387 2384
2388static int __init udc_init(void) 2385static int __init udc_init(void)
2389{ 2386{
2387 if (!cpu_is_pxa27x())
2388 return -ENODEV;
2389
2390 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); 2390 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
2391 return platform_driver_probe(&udc_driver, pxa_udc_probe); 2391 return platform_driver_probe(&udc_driver, pxa_udc_probe);
2392} 2392}
diff --git a/drivers/usb/gadget/pxa27x_udc.h b/drivers/usb/gadget/pxa27x_udc.h
index 1d1b7936ee11..97453db924ff 100644
--- a/drivers/usb/gadget/pxa27x_udc.h
+++ b/drivers/usb/gadget/pxa27x_udc.h
@@ -484,4 +484,12 @@ static inline struct pxa_udc *to_gadget_udc(struct usb_gadget *gadget)
484#define ep_warn(ep, fmt, arg...) \ 484#define ep_warn(ep, fmt, arg...) \
485 dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg) 485 dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg)
486 486
487/*
488 * Cannot include pxa-regs.h, as register names are similar.
489 * So PSSR is redefined here. This should be removed once UDC registers will
490 * be gone from pxa-regs.h.
491 */
492#define PSSR __REG(0x40F00004) /* Power Manager Sleep Status */
493#define PSSR_OTGPH (1 << 6) /* OTG Peripheral Hold */
494
487#endif /* __LINUX_USB_GADGET_PXA27X_H */ 495#endif /* __LINUX_USB_GADGET_PXA27X_H */
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 54cdd6f94034..fa019fa73334 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -14,7 +14,6 @@
14 * This software is distributed under the terms of the GNU General 14 * This software is distributed under the terms of the GNU General
15 * Public License ("GPL") as published by the Free Software Foundation, 15 * Public License ("GPL") as published by the Free Software Foundation,
16 * either version 2 of that License or (at your option) any later version. 16 * either version 2 of that License or (at your option) any later version.
17 *
18 */ 17 */
19 18
20#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -33,7 +32,7 @@
33/* Defines */ 32/* Defines */
34 33
35#define GS_VERSION_STR "v2.2" 34#define GS_VERSION_STR "v2.2"
36#define GS_VERSION_NUM 0x0202 35#define GS_VERSION_NUM 0x2200
37 36
38#define GS_LONG_NAME "Gadget Serial" 37#define GS_LONG_NAME "Gadget Serial"
39#define GS_SHORT_NAME "g_serial" 38#define GS_SHORT_NAME "g_serial"
@@ -41,7 +40,11 @@
41#define GS_MAJOR 127 40#define GS_MAJOR 127
42#define GS_MINOR_START 0 41#define GS_MINOR_START 0
43 42
44#define GS_NUM_PORTS 16 43/* REVISIT only one port is supported for now;
44 * see gs_{send,recv}_packet() ... no multiplexing,
45 * and no support for multiple ACM devices.
46 */
47#define GS_NUM_PORTS 1
45 48
46#define GS_NUM_CONFIGS 1 49#define GS_NUM_CONFIGS 1
47#define GS_NO_CONFIG_ID 0 50#define GS_NO_CONFIG_ID 0
@@ -65,6 +68,9 @@
65 68
66#define GS_DEFAULT_USE_ACM 0 69#define GS_DEFAULT_USE_ACM 0
67 70
71/* 9600-8-N-1 ... matches init_termios.c_cflag and defaults
72 * expected by "usbser.sys" on MS-Windows.
73 */
68#define GS_DEFAULT_DTE_RATE 9600 74#define GS_DEFAULT_DTE_RATE 9600
69#define GS_DEFAULT_DATA_BITS 8 75#define GS_DEFAULT_DATA_BITS 8
70#define GS_DEFAULT_PARITY USB_CDC_NO_PARITY 76#define GS_DEFAULT_PARITY USB_CDC_NO_PARITY
@@ -107,10 +113,6 @@ static int debug = 1;
107#define GS_NOTIFY_MAXPACKET 8 113#define GS_NOTIFY_MAXPACKET 8
108 114
109 115
110/* Structures */
111
112struct gs_dev;
113
114/* circular buffer */ 116/* circular buffer */
115struct gs_buf { 117struct gs_buf {
116 unsigned int buf_size; 118 unsigned int buf_size;
@@ -119,12 +121,6 @@ struct gs_buf {
119 char *buf_put; 121 char *buf_put;
120}; 122};
121 123
122/* list of requests */
123struct gs_req_entry {
124 struct list_head re_entry;
125 struct usb_request *re_req;
126};
127
128/* the port structure holds info for each port, one for each minor number */ 124/* the port structure holds info for each port, one for each minor number */
129struct gs_port { 125struct gs_port {
130 struct gs_dev *port_dev; /* pointer to device struct */ 126 struct gs_dev *port_dev; /* pointer to device struct */
@@ -164,26 +160,7 @@ struct gs_dev {
164 160
165/* Functions */ 161/* Functions */
166 162
167/* module */ 163/* tty driver internals */
168static int __init gs_module_init(void);
169static void __exit gs_module_exit(void);
170
171/* tty driver */
172static int gs_open(struct tty_struct *tty, struct file *file);
173static void gs_close(struct tty_struct *tty, struct file *file);
174static int gs_write(struct tty_struct *tty,
175 const unsigned char *buf, int count);
176static int gs_put_char(struct tty_struct *tty, unsigned char ch);
177static void gs_flush_chars(struct tty_struct *tty);
178static int gs_write_room(struct tty_struct *tty);
179static int gs_chars_in_buffer(struct tty_struct *tty);
180static void gs_throttle(struct tty_struct * tty);
181static void gs_unthrottle(struct tty_struct * tty);
182static void gs_break(struct tty_struct *tty, int break_state);
183static int gs_ioctl(struct tty_struct *tty, struct file *file,
184 unsigned int cmd, unsigned long arg);
185static void gs_set_termios(struct tty_struct *tty, struct ktermios *old);
186
187static int gs_send(struct gs_dev *dev); 164static int gs_send(struct gs_dev *dev);
188static int gs_send_packet(struct gs_dev *dev, char *packet, 165static int gs_send_packet(struct gs_dev *dev, char *packet,
189 unsigned int size); 166 unsigned int size);
@@ -192,19 +169,7 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet,
192static void gs_read_complete(struct usb_ep *ep, struct usb_request *req); 169static void gs_read_complete(struct usb_ep *ep, struct usb_request *req);
193static void gs_write_complete(struct usb_ep *ep, struct usb_request *req); 170static void gs_write_complete(struct usb_ep *ep, struct usb_request *req);
194 171
195/* gadget driver */ 172/* gadget driver internals */
196static int gs_bind(struct usb_gadget *gadget);
197static void gs_unbind(struct usb_gadget *gadget);
198static int gs_setup(struct usb_gadget *gadget,
199 const struct usb_ctrlrequest *ctrl);
200static int gs_setup_standard(struct usb_gadget *gadget,
201 const struct usb_ctrlrequest *ctrl);
202static int gs_setup_class(struct usb_gadget *gadget,
203 const struct usb_ctrlrequest *ctrl);
204static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req);
205static void gs_setup_complete_set_line_coding(struct usb_ep *ep,
206 struct usb_request *req);
207static void gs_disconnect(struct usb_gadget *gadget);
208static int gs_set_config(struct gs_dev *dev, unsigned config); 173static int gs_set_config(struct gs_dev *dev, unsigned config);
209static void gs_reset_config(struct gs_dev *dev); 174static void gs_reset_config(struct gs_dev *dev);
210static int gs_build_config_buf(u8 *buf, struct usb_gadget *g, 175static int gs_build_config_buf(u8 *buf, struct usb_gadget *g,
@@ -214,10 +179,6 @@ static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len,
214 gfp_t kmalloc_flags); 179 gfp_t kmalloc_flags);
215static void gs_free_req(struct usb_ep *ep, struct usb_request *req); 180static void gs_free_req(struct usb_ep *ep, struct usb_request *req);
216 181
217static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len,
218 gfp_t kmalloc_flags);
219static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req);
220
221static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags); 182static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags);
222static void gs_free_ports(struct gs_dev *dev); 183static void gs_free_ports(struct gs_dev *dev);
223 184
@@ -232,62 +193,15 @@ static unsigned int gs_buf_put(struct gs_buf *gb, const char *buf,
232static unsigned int gs_buf_get(struct gs_buf *gb, char *buf, 193static unsigned int gs_buf_get(struct gs_buf *gb, char *buf,
233 unsigned int count); 194 unsigned int count);
234 195
235/* external functions */
236extern int net2280_set_fifo_mode(struct usb_gadget *gadget, int mode);
237
238 196
239/* Globals */ 197/* Globals */
240 198
241static struct gs_dev *gs_device; 199static struct gs_dev *gs_device;
242 200
243static const char *EP_IN_NAME;
244static const char *EP_OUT_NAME;
245static const char *EP_NOTIFY_NAME;
246
247static struct mutex gs_open_close_lock[GS_NUM_PORTS]; 201static struct mutex gs_open_close_lock[GS_NUM_PORTS];
248 202
249static unsigned int read_q_size = GS_DEFAULT_READ_Q_SIZE;
250static unsigned int write_q_size = GS_DEFAULT_WRITE_Q_SIZE;
251
252static unsigned int write_buf_size = GS_DEFAULT_WRITE_BUF_SIZE;
253
254static unsigned int use_acm = GS_DEFAULT_USE_ACM;
255
256
257/* tty driver struct */
258static const struct tty_operations gs_tty_ops = {
259 .open = gs_open,
260 .close = gs_close,
261 .write = gs_write,
262 .put_char = gs_put_char,
263 .flush_chars = gs_flush_chars,
264 .write_room = gs_write_room,
265 .ioctl = gs_ioctl,
266 .set_termios = gs_set_termios,
267 .throttle = gs_throttle,
268 .unthrottle = gs_unthrottle,
269 .break_ctl = gs_break,
270 .chars_in_buffer = gs_chars_in_buffer,
271};
272static struct tty_driver *gs_tty_driver;
273
274/* gadget driver struct */
275static struct usb_gadget_driver gs_gadget_driver = {
276#ifdef CONFIG_USB_GADGET_DUALSPEED
277 .speed = USB_SPEED_HIGH,
278#else
279 .speed = USB_SPEED_FULL,
280#endif /* CONFIG_USB_GADGET_DUALSPEED */
281 .function = GS_LONG_NAME,
282 .bind = gs_bind,
283 .unbind = gs_unbind,
284 .setup = gs_setup,
285 .disconnect = gs_disconnect,
286 .driver = {
287 .name = GS_SHORT_NAME,
288 },
289};
290 203
204/*-------------------------------------------------------------------------*/
291 205
292/* USB descriptors */ 206/* USB descriptors */
293 207
@@ -304,7 +218,6 @@ static char manufacturer[50];
304static struct usb_string gs_strings[] = { 218static struct usb_string gs_strings[] = {
305 { GS_MANUFACTURER_STR_ID, manufacturer }, 219 { GS_MANUFACTURER_STR_ID, manufacturer },
306 { GS_PRODUCT_STR_ID, GS_LONG_NAME }, 220 { GS_PRODUCT_STR_ID, GS_LONG_NAME },
307 { GS_SERIAL_STR_ID, "0" },
308 { GS_BULK_CONFIG_STR_ID, "Gadget Serial Bulk" }, 221 { GS_BULK_CONFIG_STR_ID, "Gadget Serial Bulk" },
309 { GS_ACM_CONFIG_STR_ID, "Gadget Serial CDC ACM" }, 222 { GS_ACM_CONFIG_STR_ID, "Gadget Serial CDC ACM" },
310 { GS_CONTROL_STR_ID, "Gadget Serial Control" }, 223 { GS_CONTROL_STR_ID, "Gadget Serial Control" },
@@ -327,7 +240,6 @@ static struct usb_device_descriptor gs_device_desc = {
327 .idProduct = __constant_cpu_to_le16(GS_PRODUCT_ID), 240 .idProduct = __constant_cpu_to_le16(GS_PRODUCT_ID),
328 .iManufacturer = GS_MANUFACTURER_STR_ID, 241 .iManufacturer = GS_MANUFACTURER_STR_ID,
329 .iProduct = GS_PRODUCT_STR_ID, 242 .iProduct = GS_PRODUCT_STR_ID,
330 .iSerialNumber = GS_SERIAL_STR_ID,
331 .bNumConfigurations = GS_NUM_CONFIGS, 243 .bNumConfigurations = GS_NUM_CONFIGS,
332}; 244};
333 245
@@ -364,7 +276,7 @@ static const struct usb_interface_descriptor gs_bulk_interface_desc = {
364 .bDescriptorType = USB_DT_INTERFACE, 276 .bDescriptorType = USB_DT_INTERFACE,
365 .bInterfaceNumber = GS_BULK_INTERFACE_ID, 277 .bInterfaceNumber = GS_BULK_INTERFACE_ID,
366 .bNumEndpoints = 2, 278 .bNumEndpoints = 2,
367 .bInterfaceClass = USB_CLASS_CDC_DATA, 279 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
368 .bInterfaceSubClass = 0, 280 .bInterfaceSubClass = 0,
369 .bInterfaceProtocol = 0, 281 .bInterfaceProtocol = 0,
370 .iInterface = GS_DATA_STR_ID, 282 .iInterface = GS_DATA_STR_ID,
@@ -521,6 +433,8 @@ static const struct usb_descriptor_header *gs_acm_highspeed_function[] = {
521}; 433};
522 434
523 435
436/*-------------------------------------------------------------------------*/
437
524/* Module */ 438/* Module */
525MODULE_DESCRIPTION(GS_LONG_NAME); 439MODULE_DESCRIPTION(GS_LONG_NAME);
526MODULE_AUTHOR("Al Borchers"); 440MODULE_AUTHOR("Al Borchers");
@@ -531,84 +445,23 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
531MODULE_PARM_DESC(debug, "Enable debugging, 0=off, 1=on"); 445MODULE_PARM_DESC(debug, "Enable debugging, 0=off, 1=on");
532#endif 446#endif
533 447
448static unsigned int read_q_size = GS_DEFAULT_READ_Q_SIZE;
534module_param(read_q_size, uint, S_IRUGO); 449module_param(read_q_size, uint, S_IRUGO);
535MODULE_PARM_DESC(read_q_size, "Read request queue size, default=32"); 450MODULE_PARM_DESC(read_q_size, "Read request queue size, default=32");
536 451
452static unsigned int write_q_size = GS_DEFAULT_WRITE_Q_SIZE;
537module_param(write_q_size, uint, S_IRUGO); 453module_param(write_q_size, uint, S_IRUGO);
538MODULE_PARM_DESC(write_q_size, "Write request queue size, default=32"); 454MODULE_PARM_DESC(write_q_size, "Write request queue size, default=32");
539 455
456static unsigned int write_buf_size = GS_DEFAULT_WRITE_BUF_SIZE;
540module_param(write_buf_size, uint, S_IRUGO); 457module_param(write_buf_size, uint, S_IRUGO);
541MODULE_PARM_DESC(write_buf_size, "Write buffer size, default=8192"); 458MODULE_PARM_DESC(write_buf_size, "Write buffer size, default=8192");
542 459
460static unsigned int use_acm = GS_DEFAULT_USE_ACM;
543module_param(use_acm, uint, S_IRUGO); 461module_param(use_acm, uint, S_IRUGO);
544MODULE_PARM_DESC(use_acm, "Use CDC ACM, 0=no, 1=yes, default=no"); 462MODULE_PARM_DESC(use_acm, "Use CDC ACM, 0=no, 1=yes, default=no");
545 463
546module_init(gs_module_init); 464/*-------------------------------------------------------------------------*/
547module_exit(gs_module_exit);
548
549/*
550* gs_module_init
551*
552* Register as a USB gadget driver and a tty driver.
553*/
554static int __init gs_module_init(void)
555{
556 int i;
557 int retval;
558
559 retval = usb_gadget_register_driver(&gs_gadget_driver);
560 if (retval) {
561 pr_err("gs_module_init: cannot register gadget driver, "
562 "ret=%d\n", retval);
563 return retval;
564 }
565
566 gs_tty_driver = alloc_tty_driver(GS_NUM_PORTS);
567 if (!gs_tty_driver)
568 return -ENOMEM;
569 gs_tty_driver->owner = THIS_MODULE;
570 gs_tty_driver->driver_name = GS_SHORT_NAME;
571 gs_tty_driver->name = "ttygs";
572 gs_tty_driver->major = GS_MAJOR;
573 gs_tty_driver->minor_start = GS_MINOR_START;
574 gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
575 gs_tty_driver->subtype = SERIAL_TYPE_NORMAL;
576 gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
577 gs_tty_driver->init_termios = tty_std_termios;
578 gs_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
579 tty_set_operations(gs_tty_driver, &gs_tty_ops);
580
581 for (i=0; i < GS_NUM_PORTS; i++)
582 mutex_init(&gs_open_close_lock[i]);
583
584 retval = tty_register_driver(gs_tty_driver);
585 if (retval) {
586 usb_gadget_unregister_driver(&gs_gadget_driver);
587 put_tty_driver(gs_tty_driver);
588 pr_err("gs_module_init: cannot register tty driver, "
589 "ret=%d\n", retval);
590 return retval;
591 }
592
593 pr_info("gs_module_init: %s %s loaded\n",
594 GS_LONG_NAME, GS_VERSION_STR);
595 return 0;
596}
597
598/*
599* gs_module_exit
600*
601* Unregister as a tty driver and a USB gadget driver.
602*/
603static void __exit gs_module_exit(void)
604{
605 tty_unregister_driver(gs_tty_driver);
606 put_tty_driver(gs_tty_driver);
607 usb_gadget_unregister_driver(&gs_gadget_driver);
608
609 pr_info("gs_module_exit: %s %s unloaded\n",
610 GS_LONG_NAME, GS_VERSION_STR);
611}
612 465
613/* TTY Driver */ 466/* TTY Driver */
614 467
@@ -753,15 +606,15 @@ exit_unlock_dev:
753 * gs_close 606 * gs_close
754 */ 607 */
755 608
756#define GS_WRITE_FINISHED_EVENT_SAFELY(p) \ 609static int gs_write_finished_event_safely(struct gs_port *p)
757({ \ 610{
758 int cond; \ 611 int cond;
759 \ 612
760 spin_lock_irq(&(p)->port_lock); \ 613 spin_lock_irq(&(p)->port_lock);
761 cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); \ 614 cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf);
762 spin_unlock_irq(&(p)->port_lock); \ 615 spin_unlock_irq(&(p)->port_lock);
763 cond; \ 616 return cond;
764}) 617}
765 618
766static void gs_close(struct tty_struct *tty, struct file *file) 619static void gs_close(struct tty_struct *tty, struct file *file)
767{ 620{
@@ -807,7 +660,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
807 if (gs_buf_data_avail(port->port_write_buf) > 0) { 660 if (gs_buf_data_avail(port->port_write_buf) > 0) {
808 spin_unlock_irq(&port->port_lock); 661 spin_unlock_irq(&port->port_lock);
809 wait_event_interruptible_timeout(port->port_write_wait, 662 wait_event_interruptible_timeout(port->port_write_wait,
810 GS_WRITE_FINISHED_EVENT_SAFELY(port), 663 gs_write_finished_event_safely(port),
811 GS_CLOSE_TIMEOUT * HZ); 664 GS_CLOSE_TIMEOUT * HZ);
812 spin_lock_irq(&port->port_lock); 665 spin_lock_irq(&port->port_lock);
813 } 666 }
@@ -1065,6 +918,23 @@ static void gs_set_termios(struct tty_struct *tty, struct ktermios *old)
1065{ 918{
1066} 919}
1067 920
921static const struct tty_operations gs_tty_ops = {
922 .open = gs_open,
923 .close = gs_close,
924 .write = gs_write,
925 .put_char = gs_put_char,
926 .flush_chars = gs_flush_chars,
927 .write_room = gs_write_room,
928 .ioctl = gs_ioctl,
929 .set_termios = gs_set_termios,
930 .throttle = gs_throttle,
931 .unthrottle = gs_unthrottle,
932 .break_ctl = gs_break,
933 .chars_in_buffer = gs_chars_in_buffer,
934};
935
936/*-------------------------------------------------------------------------*/
937
1068/* 938/*
1069* gs_send 939* gs_send
1070* 940*
@@ -1080,7 +950,6 @@ static int gs_send(struct gs_dev *dev)
1080 unsigned long flags; 950 unsigned long flags;
1081 struct usb_ep *ep; 951 struct usb_ep *ep;
1082 struct usb_request *req; 952 struct usb_request *req;
1083 struct gs_req_entry *req_entry;
1084 953
1085 if (dev == NULL) { 954 if (dev == NULL) {
1086 pr_err("gs_send: NULL device pointer\n"); 955 pr_err("gs_send: NULL device pointer\n");
@@ -1093,10 +962,8 @@ static int gs_send(struct gs_dev *dev)
1093 962
1094 while(!list_empty(&dev->dev_req_list)) { 963 while(!list_empty(&dev->dev_req_list)) {
1095 964
1096 req_entry = list_entry(dev->dev_req_list.next, 965 req = list_entry(dev->dev_req_list.next,
1097 struct gs_req_entry, re_entry); 966 struct usb_request, list);
1098
1099 req = req_entry->re_req;
1100 967
1101 len = gs_send_packet(dev, req->buf, ep->maxpacket); 968 len = gs_send_packet(dev, req->buf, ep->maxpacket);
1102 969
@@ -1106,7 +973,7 @@ static int gs_send(struct gs_dev *dev)
1106 *((unsigned char *)req->buf), 973 *((unsigned char *)req->buf),
1107 *((unsigned char *)req->buf+1), 974 *((unsigned char *)req->buf+1),
1108 *((unsigned char *)req->buf+2)); 975 *((unsigned char *)req->buf+2));
1109 list_del(&req_entry->re_entry); 976 list_del(&req->list);
1110 req->length = len; 977 req->length = len;
1111 spin_unlock_irqrestore(&dev->dev_lock, flags); 978 spin_unlock_irqrestore(&dev->dev_lock, flags);
1112 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) { 979 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) {
@@ -1289,7 +1156,6 @@ requeue:
1289static void gs_write_complete(struct usb_ep *ep, struct usb_request *req) 1156static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
1290{ 1157{
1291 struct gs_dev *dev = ep->driver_data; 1158 struct gs_dev *dev = ep->driver_data;
1292 struct gs_req_entry *gs_req = req->context;
1293 1159
1294 if (dev == NULL) { 1160 if (dev == NULL) {
1295 pr_err("gs_write_complete: NULL device pointer\n"); 1161 pr_err("gs_write_complete: NULL device pointer\n");
@@ -1300,13 +1166,8 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
1300 case 0: 1166 case 0:
1301 /* normal completion */ 1167 /* normal completion */
1302requeue: 1168requeue:
1303 if (gs_req == NULL) {
1304 pr_err("gs_write_complete: NULL request pointer\n");
1305 return;
1306 }
1307
1308 spin_lock(&dev->dev_lock); 1169 spin_lock(&dev->dev_lock);
1309 list_add(&gs_req->re_entry, &dev->dev_req_list); 1170 list_add(&req->list, &dev->dev_req_list);
1310 spin_unlock(&dev->dev_lock); 1171 spin_unlock(&dev->dev_lock);
1311 1172
1312 gs_send(dev); 1173 gs_send(dev);
@@ -1328,9 +1189,39 @@ requeue:
1328 } 1189 }
1329} 1190}
1330 1191
1192/*-------------------------------------------------------------------------*/
1193
1331/* Gadget Driver */ 1194/* Gadget Driver */
1332 1195
1333/* 1196/*
1197 * gs_unbind
1198 *
1199 * Called on module unload. Frees the control request and device
1200 * structure.
1201 */
1202static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget)
1203{
1204 struct gs_dev *dev = get_gadget_data(gadget);
1205
1206 gs_device = NULL;
1207
1208 /* read/write requests already freed, only control request remains */
1209 if (dev != NULL) {
1210 if (dev->dev_ctrl_req != NULL) {
1211 gs_free_req(gadget->ep0, dev->dev_ctrl_req);
1212 dev->dev_ctrl_req = NULL;
1213 }
1214 gs_reset_config(dev);
1215 gs_free_ports(dev);
1216 kfree(dev);
1217 set_gadget_data(gadget, NULL);
1218 }
1219
1220 pr_info("gs_unbind: %s %s unbound\n", GS_LONG_NAME,
1221 GS_VERSION_STR);
1222}
1223
1224/*
1334 * gs_bind 1225 * gs_bind
1335 * 1226 *
1336 * Called on module load. Allocates and initializes the device 1227 * Called on module load. Allocates and initializes the device
@@ -1362,19 +1253,23 @@ static int __init gs_bind(struct usb_gadget *gadget)
1362 __constant_cpu_to_le16(GS_VERSION_NUM|0x0099); 1253 __constant_cpu_to_le16(GS_VERSION_NUM|0x0099);
1363 } 1254 }
1364 1255
1256 dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL);
1257 if (dev == NULL)
1258 return -ENOMEM;
1259
1365 usb_ep_autoconfig_reset(gadget); 1260 usb_ep_autoconfig_reset(gadget);
1366 1261
1367 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_in_desc); 1262 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_in_desc);
1368 if (!ep) 1263 if (!ep)
1369 goto autoconf_fail; 1264 goto autoconf_fail;
1370 EP_IN_NAME = ep->name; 1265 dev->dev_in_ep = ep;
1371 ep->driver_data = ep; /* claim the endpoint */ 1266 ep->driver_data = dev; /* claim the endpoint */
1372 1267
1373 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_out_desc); 1268 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_out_desc);
1374 if (!ep) 1269 if (!ep)
1375 goto autoconf_fail; 1270 goto autoconf_fail;
1376 EP_OUT_NAME = ep->name; 1271 dev->dev_out_ep = ep;
1377 ep->driver_data = ep; /* claim the endpoint */ 1272 ep->driver_data = dev; /* claim the endpoint */
1378 1273
1379 if (use_acm) { 1274 if (use_acm) {
1380 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc); 1275 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc);
@@ -1384,8 +1279,8 @@ static int __init gs_bind(struct usb_gadget *gadget)
1384 } 1279 }
1385 gs_device_desc.idProduct = __constant_cpu_to_le16( 1280 gs_device_desc.idProduct = __constant_cpu_to_le16(
1386 GS_CDC_PRODUCT_ID), 1281 GS_CDC_PRODUCT_ID),
1387 EP_NOTIFY_NAME = ep->name; 1282 dev->dev_notify_ep = ep;
1388 ep->driver_data = ep; /* claim the endpoint */ 1283 ep->driver_data = dev; /* claim the endpoint */
1389 } 1284 }
1390 1285
1391 gs_device_desc.bDeviceClass = use_acm 1286 gs_device_desc.bDeviceClass = use_acm
@@ -1415,9 +1310,7 @@ static int __init gs_bind(struct usb_gadget *gadget)
1415 gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP; 1310 gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
1416 } 1311 }
1417 1312
1418 gs_device = dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL); 1313 gs_device = dev;
1419 if (dev == NULL)
1420 return -ENOMEM;
1421 1314
1422 snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s", 1315 snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s",
1423 init_utsname()->sysname, init_utsname()->release, 1316 init_utsname()->sysname, init_utsname()->release,
@@ -1441,8 +1334,6 @@ static int __init gs_bind(struct usb_gadget *gadget)
1441 gs_unbind(gadget); 1334 gs_unbind(gadget);
1442 return -ENOMEM; 1335 return -ENOMEM;
1443 } 1336 }
1444 dev->dev_ctrl_req->complete = gs_setup_complete;
1445
1446 gadget->ep0->driver_data = dev; 1337 gadget->ep0->driver_data = dev;
1447 1338
1448 pr_info("gs_bind: %s %s bound\n", 1339 pr_info("gs_bind: %s %s bound\n",
@@ -1451,99 +1342,11 @@ static int __init gs_bind(struct usb_gadget *gadget)
1451 return 0; 1342 return 0;
1452 1343
1453autoconf_fail: 1344autoconf_fail:
1345 kfree(dev);
1454 pr_err("gs_bind: cannot autoconfigure on %s\n", gadget->name); 1346 pr_err("gs_bind: cannot autoconfigure on %s\n", gadget->name);
1455 return -ENODEV; 1347 return -ENODEV;
1456} 1348}
1457 1349
1458/*
1459 * gs_unbind
1460 *
1461 * Called on module unload. Frees the control request and device
1462 * structure.
1463 */
1464static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget)
1465{
1466 struct gs_dev *dev = get_gadget_data(gadget);
1467
1468 gs_device = NULL;
1469
1470 /* read/write requests already freed, only control request remains */
1471 if (dev != NULL) {
1472 if (dev->dev_ctrl_req != NULL) {
1473 gs_free_req(gadget->ep0, dev->dev_ctrl_req);
1474 dev->dev_ctrl_req = NULL;
1475 }
1476 gs_free_ports(dev);
1477 if (dev->dev_notify_ep)
1478 usb_ep_disable(dev->dev_notify_ep);
1479 if (dev->dev_in_ep)
1480 usb_ep_disable(dev->dev_in_ep);
1481 if (dev->dev_out_ep)
1482 usb_ep_disable(dev->dev_out_ep);
1483 kfree(dev);
1484 set_gadget_data(gadget, NULL);
1485 }
1486
1487 pr_info("gs_unbind: %s %s unbound\n", GS_LONG_NAME,
1488 GS_VERSION_STR);
1489}
1490
1491/*
1492 * gs_setup
1493 *
1494 * Implements all the control endpoint functionality that's not
1495 * handled in hardware or the hardware driver.
1496 *
1497 * Returns the size of the data sent to the host, or a negative
1498 * error number.
1499 */
1500static int gs_setup(struct usb_gadget *gadget,
1501 const struct usb_ctrlrequest *ctrl)
1502{
1503 int ret = -EOPNOTSUPP;
1504 struct gs_dev *dev = get_gadget_data(gadget);
1505 struct usb_request *req = dev->dev_ctrl_req;
1506 u16 wIndex = le16_to_cpu(ctrl->wIndex);
1507 u16 wValue = le16_to_cpu(ctrl->wValue);
1508 u16 wLength = le16_to_cpu(ctrl->wLength);
1509
1510 req->complete = gs_setup_complete;
1511
1512 switch (ctrl->bRequestType & USB_TYPE_MASK) {
1513 case USB_TYPE_STANDARD:
1514 ret = gs_setup_standard(gadget,ctrl);
1515 break;
1516
1517 case USB_TYPE_CLASS:
1518 ret = gs_setup_class(gadget,ctrl);
1519 break;
1520
1521 default:
1522 pr_err("gs_setup: unknown request, type=%02x, request=%02x, "
1523 "value=%04x, index=%04x, length=%d\n",
1524 ctrl->bRequestType, ctrl->bRequest,
1525 wValue, wIndex, wLength);
1526 break;
1527 }
1528
1529 /* respond with data transfer before status phase? */
1530 if (ret >= 0) {
1531 req->length = ret;
1532 req->zero = ret < wLength
1533 && (ret % gadget->ep0->maxpacket) == 0;
1534 ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
1535 if (ret < 0) {
1536 pr_err("gs_setup: cannot queue response, ret=%d\n",
1537 ret);
1538 req->status = 0;
1539 gs_setup_complete(gadget->ep0, req);
1540 }
1541 }
1542
1543 /* device either stalls (ret < 0) or reports success */
1544 return ret;
1545}
1546
1547static int gs_setup_standard(struct usb_gadget *gadget, 1350static int gs_setup_standard(struct usb_gadget *gadget,
1548 const struct usb_ctrlrequest *ctrl) 1351 const struct usb_ctrlrequest *ctrl)
1549{ 1352{
@@ -1673,6 +1476,42 @@ set_interface_done:
1673 return ret; 1476 return ret;
1674} 1477}
1675 1478
1479static void gs_setup_complete_set_line_coding(struct usb_ep *ep,
1480 struct usb_request *req)
1481{
1482 struct gs_dev *dev = ep->driver_data;
1483 struct gs_port *port = dev->dev_port[0]; /* ACM only has one port */
1484
1485 switch (req->status) {
1486 case 0:
1487 /* normal completion */
1488 if (req->actual != sizeof(port->port_line_coding))
1489 usb_ep_set_halt(ep);
1490 else if (port) {
1491 struct usb_cdc_line_coding *value = req->buf;
1492
1493 /* REVISIT: we currently just remember this data.
1494 * If we change that, (a) validate it first, then
1495 * (b) update whatever hardware needs updating.
1496 */
1497 spin_lock(&port->port_lock);
1498 port->port_line_coding = *value;
1499 spin_unlock(&port->port_lock);
1500 }
1501 break;
1502
1503 case -ESHUTDOWN:
1504 /* disconnect */
1505 gs_free_req(ep, req);
1506 break;
1507
1508 default:
1509 /* unexpected */
1510 break;
1511 }
1512 return;
1513}
1514
1676static int gs_setup_class(struct usb_gadget *gadget, 1515static int gs_setup_class(struct usb_gadget *gadget,
1677 const struct usb_ctrlrequest *ctrl) 1516 const struct usb_ctrlrequest *ctrl)
1678{ 1517{
@@ -1734,52 +1573,72 @@ static int gs_setup_class(struct usb_gadget *gadget,
1734 return ret; 1573 return ret;
1735} 1574}
1736 1575
1737static void gs_setup_complete_set_line_coding(struct usb_ep *ep, 1576/*
1738 struct usb_request *req) 1577 * gs_setup_complete
1578 */
1579static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req)
1739{ 1580{
1740 struct gs_dev *dev = ep->driver_data; 1581 if (req->status || req->actual != req->length) {
1741 struct gs_port *port = dev->dev_port[0]; /* ACM only has one port */ 1582 pr_err("gs_setup_complete: status error, status=%d, "
1583 "actual=%d, length=%d\n",
1584 req->status, req->actual, req->length);
1585 }
1586}
1742 1587
1743 switch (req->status) { 1588/*
1744 case 0: 1589 * gs_setup
1745 /* normal completion */ 1590 *
1746 if (req->actual != sizeof(port->port_line_coding)) 1591 * Implements all the control endpoint functionality that's not
1747 usb_ep_set_halt(ep); 1592 * handled in hardware or the hardware driver.
1748 else if (port) { 1593 *
1749 struct usb_cdc_line_coding *value = req->buf; 1594 * Returns the size of the data sent to the host, or a negative
1595 * error number.
1596 */
1597static int gs_setup(struct usb_gadget *gadget,
1598 const struct usb_ctrlrequest *ctrl)
1599{
1600 int ret = -EOPNOTSUPP;
1601 struct gs_dev *dev = get_gadget_data(gadget);
1602 struct usb_request *req = dev->dev_ctrl_req;
1603 u16 wIndex = le16_to_cpu(ctrl->wIndex);
1604 u16 wValue = le16_to_cpu(ctrl->wValue);
1605 u16 wLength = le16_to_cpu(ctrl->wLength);
1750 1606
1751 /* REVISIT: we currently just remember this data. 1607 req->complete = gs_setup_complete;
1752 * If we change that, (a) validate it first, then 1608
1753 * (b) update whatever hardware needs updating. 1609 switch (ctrl->bRequestType & USB_TYPE_MASK) {
1754 */ 1610 case USB_TYPE_STANDARD:
1755 spin_lock(&port->port_lock); 1611 ret = gs_setup_standard(gadget, ctrl);
1756 port->port_line_coding = *value;
1757 spin_unlock(&port->port_lock);
1758 }
1759 break; 1612 break;
1760 1613
1761 case -ESHUTDOWN: 1614 case USB_TYPE_CLASS:
1762 /* disconnect */ 1615 ret = gs_setup_class(gadget, ctrl);
1763 gs_free_req(ep, req);
1764 break; 1616 break;
1765 1617
1766 default: 1618 default:
1767 /* unexpected */ 1619 pr_err("gs_setup: unknown request, type=%02x, request=%02x, "
1620 "value=%04x, index=%04x, length=%d\n",
1621 ctrl->bRequestType, ctrl->bRequest,
1622 wValue, wIndex, wLength);
1768 break; 1623 break;
1769 } 1624 }
1770 return;
1771}
1772 1625
1773/* 1626 /* respond with data transfer before status phase? */
1774 * gs_setup_complete 1627 if (ret >= 0) {
1775 */ 1628 req->length = ret;
1776static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req) 1629 req->zero = ret < wLength
1777{ 1630 && (ret % gadget->ep0->maxpacket) == 0;
1778 if (req->status || req->actual != req->length) { 1631 ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
1779 pr_err("gs_setup_complete: status error, status=%d, " 1632 if (ret < 0) {
1780 "actual=%d, length=%d\n", 1633 pr_err("gs_setup: cannot queue response, ret=%d\n",
1781 req->status, req->actual, req->length); 1634 ret);
1635 req->status = 0;
1636 gs_setup_complete(gadget->ep0, req);
1637 }
1782 } 1638 }
1639
1640 /* device either stalls (ret < 0) or reports success */
1641 return ret;
1783} 1642}
1784 1643
1785/* 1644/*
@@ -1811,6 +1670,23 @@ static void gs_disconnect(struct usb_gadget *gadget)
1811 pr_info("gs_disconnect: %s disconnected\n", GS_LONG_NAME); 1670 pr_info("gs_disconnect: %s disconnected\n", GS_LONG_NAME);
1812} 1671}
1813 1672
1673static struct usb_gadget_driver gs_gadget_driver = {
1674#ifdef CONFIG_USB_GADGET_DUALSPEED
1675 .speed = USB_SPEED_HIGH,
1676#else
1677 .speed = USB_SPEED_FULL,
1678#endif /* CONFIG_USB_GADGET_DUALSPEED */
1679 .function = GS_LONG_NAME,
1680 .bind = gs_bind,
1681 .unbind = gs_unbind,
1682 .setup = gs_setup,
1683 .disconnect = gs_disconnect,
1684 .driver = {
1685 .name = GS_SHORT_NAME,
1686 .owner = THIS_MODULE,
1687 },
1688};
1689
1814/* 1690/*
1815 * gs_set_config 1691 * gs_set_config
1816 * 1692 *
@@ -1826,9 +1702,8 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1826 int ret = 0; 1702 int ret = 0;
1827 struct usb_gadget *gadget = dev->dev_gadget; 1703 struct usb_gadget *gadget = dev->dev_gadget;
1828 struct usb_ep *ep; 1704 struct usb_ep *ep;
1829 struct usb_endpoint_descriptor *ep_desc; 1705 struct usb_endpoint_descriptor *out, *in, *notify;
1830 struct usb_request *req; 1706 struct usb_request *req;
1831 struct gs_req_entry *req_entry;
1832 1707
1833 if (dev == NULL) { 1708 if (dev == NULL) {
1834 pr_err("gs_set_config: NULL device pointer\n"); 1709 pr_err("gs_set_config: NULL device pointer\n");
@@ -1846,86 +1721,62 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1846 case GS_BULK_CONFIG_ID: 1721 case GS_BULK_CONFIG_ID:
1847 if (use_acm) 1722 if (use_acm)
1848 return -EINVAL; 1723 return -EINVAL;
1849 /* device specific optimizations */
1850 if (gadget_is_net2280(gadget))
1851 net2280_set_fifo_mode(gadget, 1);
1852 break; 1724 break;
1853 case GS_ACM_CONFIG_ID: 1725 case GS_ACM_CONFIG_ID:
1854 if (!use_acm) 1726 if (!use_acm)
1855 return -EINVAL; 1727 return -EINVAL;
1856 /* device specific optimizations */
1857 if (gadget_is_net2280(gadget))
1858 net2280_set_fifo_mode(gadget, 1);
1859 break; 1728 break;
1860 default: 1729 default:
1861 return -EINVAL; 1730 return -EINVAL;
1862 } 1731 }
1863 1732
1864 dev->dev_config = config; 1733 in = choose_ep_desc(gadget,
1865 1734 &gs_highspeed_in_desc,
1866 gadget_for_each_ep(ep, gadget) { 1735 &gs_fullspeed_in_desc);
1867 1736 out = choose_ep_desc(gadget,
1868 if (EP_NOTIFY_NAME 1737 &gs_highspeed_out_desc,
1869 && strcmp(ep->name, EP_NOTIFY_NAME) == 0) { 1738 &gs_fullspeed_out_desc);
1870 ep_desc = choose_ep_desc(gadget, 1739 notify = dev->dev_notify_ep
1740 ? choose_ep_desc(gadget,
1871 &gs_highspeed_notify_desc, 1741 &gs_highspeed_notify_desc,
1872 &gs_fullspeed_notify_desc); 1742 &gs_fullspeed_notify_desc)
1873 ret = usb_ep_enable(ep,ep_desc); 1743 : NULL;
1874 if (ret == 0) {
1875 ep->driver_data = dev;
1876 dev->dev_notify_ep = ep;
1877 dev->dev_notify_ep_desc = ep_desc;
1878 } else {
1879 pr_err("gs_set_config: cannot enable NOTIFY "
1880 "endpoint %s, ret=%d\n",
1881 ep->name, ret);
1882 goto exit_reset_config;
1883 }
1884 }
1885
1886 else if (strcmp(ep->name, EP_IN_NAME) == 0) {
1887 ep_desc = choose_ep_desc(gadget,
1888 &gs_highspeed_in_desc,
1889 &gs_fullspeed_in_desc);
1890 ret = usb_ep_enable(ep,ep_desc);
1891 if (ret == 0) {
1892 ep->driver_data = dev;
1893 dev->dev_in_ep = ep;
1894 dev->dev_in_ep_desc = ep_desc;
1895 } else {
1896 pr_err("gs_set_config: cannot enable IN "
1897 "endpoint %s, ret=%d\n",
1898 ep->name, ret);
1899 goto exit_reset_config;
1900 }
1901 }
1902 1744
1903 else if (strcmp(ep->name, EP_OUT_NAME) == 0) { 1745 ret = usb_ep_enable(dev->dev_in_ep, in);
1904 ep_desc = choose_ep_desc(gadget, 1746 if (ret == 0) {
1905 &gs_highspeed_out_desc, 1747 dev->dev_in_ep_desc = in;
1906 &gs_fullspeed_out_desc); 1748 } else {
1907 ret = usb_ep_enable(ep,ep_desc); 1749 pr_debug("%s: cannot enable %s %s, ret=%d\n",
1908 if (ret == 0) { 1750 __func__, "IN", dev->dev_in_ep->name, ret);
1909 ep->driver_data = dev; 1751 return ret;
1910 dev->dev_out_ep = ep; 1752 }
1911 dev->dev_out_ep_desc = ep_desc;
1912 } else {
1913 pr_err("gs_set_config: cannot enable OUT "
1914 "endpoint %s, ret=%d\n",
1915 ep->name, ret);
1916 goto exit_reset_config;
1917 }
1918 }
1919 1753
1754 ret = usb_ep_enable(dev->dev_out_ep, out);
1755 if (ret == 0) {
1756 dev->dev_out_ep_desc = out;
1757 } else {
1758 pr_debug("%s: cannot enable %s %s, ret=%d\n",
1759 __func__, "OUT", dev->dev_out_ep->name, ret);
1760fail0:
1761 usb_ep_disable(dev->dev_in_ep);
1762 return ret;
1920 } 1763 }
1921 1764
1922 if (dev->dev_in_ep == NULL || dev->dev_out_ep == NULL 1765 if (notify) {
1923 || (config != GS_BULK_CONFIG_ID && dev->dev_notify_ep == NULL)) { 1766 ret = usb_ep_enable(dev->dev_notify_ep, notify);
1924 pr_err("gs_set_config: cannot find endpoints\n"); 1767 if (ret == 0) {
1925 ret = -ENODEV; 1768 dev->dev_notify_ep_desc = notify;
1926 goto exit_reset_config; 1769 } else {
1770 pr_debug("%s: cannot enable %s %s, ret=%d\n",
1771 __func__, "NOTIFY",
1772 dev->dev_notify_ep->name, ret);
1773 usb_ep_disable(dev->dev_out_ep);
1774 goto fail0;
1775 }
1927 } 1776 }
1928 1777
1778 dev->dev_config = config;
1779
1929 /* allocate and queue read requests */ 1780 /* allocate and queue read requests */
1930 ep = dev->dev_out_ep; 1781 ep = dev->dev_out_ep;
1931 for (i=0; i<read_q_size && ret == 0; i++) { 1782 for (i=0; i<read_q_size && ret == 0; i++) {
@@ -1946,9 +1797,10 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1946 /* allocate write requests, and put on free list */ 1797 /* allocate write requests, and put on free list */
1947 ep = dev->dev_in_ep; 1798 ep = dev->dev_in_ep;
1948 for (i=0; i<write_q_size; i++) { 1799 for (i=0; i<write_q_size; i++) {
1949 if ((req_entry=gs_alloc_req_entry(ep, ep->maxpacket, GFP_ATOMIC))) { 1800 req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC);
1950 req_entry->re_req->complete = gs_write_complete; 1801 if (req) {
1951 list_add(&req_entry->re_entry, &dev->dev_req_list); 1802 req->complete = gs_write_complete;
1803 list_add(&req->list, &dev->dev_req_list);
1952 } else { 1804 } else {
1953 pr_err("gs_set_config: cannot allocate " 1805 pr_err("gs_set_config: cannot allocate "
1954 "write requests\n"); 1806 "write requests\n");
@@ -1986,7 +1838,7 @@ exit_reset_config:
1986 */ 1838 */
1987static void gs_reset_config(struct gs_dev *dev) 1839static void gs_reset_config(struct gs_dev *dev)
1988{ 1840{
1989 struct gs_req_entry *req_entry; 1841 struct usb_request *req;
1990 1842
1991 if (dev == NULL) { 1843 if (dev == NULL) {
1992 pr_err("gs_reset_config: NULL device pointer\n"); 1844 pr_err("gs_reset_config: NULL device pointer\n");
@@ -2000,26 +1852,18 @@ static void gs_reset_config(struct gs_dev *dev)
2000 1852
2001 /* free write requests on the free list */ 1853 /* free write requests on the free list */
2002 while(!list_empty(&dev->dev_req_list)) { 1854 while(!list_empty(&dev->dev_req_list)) {
2003 req_entry = list_entry(dev->dev_req_list.next, 1855 req = list_entry(dev->dev_req_list.next,
2004 struct gs_req_entry, re_entry); 1856 struct usb_request, list);
2005 list_del(&req_entry->re_entry); 1857 list_del(&req->list);
2006 gs_free_req_entry(dev->dev_in_ep, req_entry); 1858 gs_free_req(dev->dev_in_ep, req);
2007 } 1859 }
2008 1860
2009 /* disable endpoints, forcing completion of pending i/o; */ 1861 /* disable endpoints, forcing completion of pending i/o; */
2010 /* completion handlers free their requests in this case */ 1862 /* completion handlers free their requests in this case */
2011 if (dev->dev_notify_ep) { 1863 if (dev->dev_notify_ep)
2012 usb_ep_disable(dev->dev_notify_ep); 1864 usb_ep_disable(dev->dev_notify_ep);
2013 dev->dev_notify_ep = NULL; 1865 usb_ep_disable(dev->dev_in_ep);
2014 } 1866 usb_ep_disable(dev->dev_out_ep);
2015 if (dev->dev_in_ep) {
2016 usb_ep_disable(dev->dev_in_ep);
2017 dev->dev_in_ep = NULL;
2018 }
2019 if (dev->dev_out_ep) {
2020 usb_ep_disable(dev->dev_out_ep);
2021 dev->dev_out_ep = NULL;
2022 }
2023} 1867}
2024 1868
2025/* 1869/*
@@ -2113,46 +1957,6 @@ static void gs_free_req(struct usb_ep *ep, struct usb_request *req)
2113} 1957}
2114 1958
2115/* 1959/*
2116 * gs_alloc_req_entry
2117 *
2118 * Allocates a request and its buffer, using the given
2119 * endpoint, buffer len, and kmalloc flags.
2120 */
2121static struct gs_req_entry *
2122gs_alloc_req_entry(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags)
2123{
2124 struct gs_req_entry *req;
2125
2126 req = kmalloc(sizeof(struct gs_req_entry), kmalloc_flags);
2127 if (req == NULL)
2128 return NULL;
2129
2130 req->re_req = gs_alloc_req(ep, len, kmalloc_flags);
2131 if (req->re_req == NULL) {
2132 kfree(req);
2133 return NULL;
2134 }
2135
2136 req->re_req->context = req;
2137
2138 return req;
2139}
2140
2141/*
2142 * gs_free_req_entry
2143 *
2144 * Frees a request and its buffer.
2145 */
2146static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req)
2147{
2148 if (ep != NULL && req != NULL) {
2149 if (req->re_req != NULL)
2150 gs_free_req(ep, req->re_req);
2151 kfree(req);
2152 }
2153}
2154
2155/*
2156 * gs_alloc_ports 1960 * gs_alloc_ports
2157 * 1961 *
2158 * Allocate all ports and set the gs_dev struct to point to them. 1962 * Allocate all ports and set the gs_dev struct to point to them.
@@ -2233,6 +2037,8 @@ static void gs_free_ports(struct gs_dev *dev)
2233 } 2037 }
2234} 2038}
2235 2039
2040/*-------------------------------------------------------------------------*/
2041
2236/* Circular Buffer */ 2042/* Circular Buffer */
2237 2043
2238/* 2044/*
@@ -2393,3 +2199,77 @@ gs_buf_get(struct gs_buf *gb, char *buf, unsigned int count)
2393 2199
2394 return count; 2200 return count;
2395} 2201}
2202
2203/*-------------------------------------------------------------------------*/
2204
2205static struct tty_driver *gs_tty_driver;
2206
2207/*
2208 * gs_module_init
2209 *
2210 * Register as a USB gadget driver and a tty driver.
2211 */
2212static int __init gs_module_init(void)
2213{
2214 int i;
2215 int retval;
2216
2217 retval = usb_gadget_register_driver(&gs_gadget_driver);
2218 if (retval) {
2219 pr_err("gs_module_init: cannot register gadget driver, "
2220 "ret=%d\n", retval);
2221 return retval;
2222 }
2223
2224 gs_tty_driver = alloc_tty_driver(GS_NUM_PORTS);
2225 if (!gs_tty_driver)
2226 return -ENOMEM;
2227 gs_tty_driver->owner = THIS_MODULE;
2228 gs_tty_driver->driver_name = GS_SHORT_NAME;
2229 gs_tty_driver->name = "ttygs";
2230 gs_tty_driver->major = GS_MAJOR;
2231 gs_tty_driver->minor_start = GS_MINOR_START;
2232 gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
2233 gs_tty_driver->subtype = SERIAL_TYPE_NORMAL;
2234 gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
2235 gs_tty_driver->init_termios = tty_std_termios;
2236 /* must match GS_DEFAULT_DTE_RATE and friends */
2237 gs_tty_driver->init_termios.c_cflag =
2238 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
2239 gs_tty_driver->init_termios.c_ispeed = GS_DEFAULT_DTE_RATE;
2240 gs_tty_driver->init_termios.c_ospeed = GS_DEFAULT_DTE_RATE;
2241 tty_set_operations(gs_tty_driver, &gs_tty_ops);
2242
2243 for (i = 0; i < GS_NUM_PORTS; i++)
2244 mutex_init(&gs_open_close_lock[i]);
2245
2246 retval = tty_register_driver(gs_tty_driver);
2247 if (retval) {
2248 usb_gadget_unregister_driver(&gs_gadget_driver);
2249 put_tty_driver(gs_tty_driver);
2250 pr_err("gs_module_init: cannot register tty driver, "
2251 "ret=%d\n", retval);
2252 return retval;
2253 }
2254
2255 pr_info("gs_module_init: %s %s loaded\n",
2256 GS_LONG_NAME, GS_VERSION_STR);
2257 return 0;
2258}
2259module_init(gs_module_init);
2260
2261/*
2262 * gs_module_exit
2263 *
2264 * Unregister as a tty driver and a USB gadget driver.
2265 */
2266static void __exit gs_module_exit(void)
2267{
2268 tty_unregister_driver(gs_tty_driver);
2269 put_tty_driver(gs_tty_driver);
2270 usb_gadget_unregister_driver(&gs_gadget_driver);
2271
2272 pr_info("gs_module_exit: %s %s unloaded\n",
2273 GS_LONG_NAME, GS_VERSION_STR);
2274}
2275module_exit(gs_module_exit);
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 1ef6df395e0c..228797e54f9c 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -300,8 +300,8 @@ config USB_R8A66597_HCD
300 module will be called r8a66597-hcd. 300 module will be called r8a66597-hcd.
301 301
302config SUPERH_ON_CHIP_R8A66597 302config SUPERH_ON_CHIP_R8A66597
303 boolean "Enable SuperH on-chip USB like the R8A66597" 303 boolean "Enable SuperH on-chip R8A66597 USB"
304 depends on USB_R8A66597_HCD && CPU_SUBTYPE_SH7366 304 depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723)
305 help 305 help
306 Renesas SuperH processor has USB like the R8A66597. 306 This driver enables support for the on-chip R8A66597 in the
307 This driver supported processor is SH7366. 307 SH7366 and SH7723 processors.
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 8b5f991e949c..08a4335401a9 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -223,6 +223,7 @@ static const struct hc_driver ehci_au1xxx_hc_driver = {
223 .bus_suspend = ehci_bus_suspend, 223 .bus_suspend = ehci_bus_suspend,
224 .bus_resume = ehci_bus_resume, 224 .bus_resume = ehci_bus_resume,
225 .relinquish_port = ehci_relinquish_port, 225 .relinquish_port = ehci_relinquish_port,
226 .port_handed_over = ehci_port_handed_over,
226}; 227};
227 228
228/*-------------------------------------------------------------------------*/ 229/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 6d9bed6c1f48..7370d6187c64 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -269,7 +269,7 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
269 if (retval) 269 if (retval)
270 return retval; 270 return retval;
271 271
272 ehci->is_tdi_rh_tt = 1; 272 hcd->has_tt = 1;
273 273
274 ehci->sbrn = 0x20; 274 ehci->sbrn = 0x20;
275 275
@@ -295,10 +295,6 @@ static const struct hc_driver ehci_fsl_hc_driver = {
295 */ 295 */
296 .reset = ehci_fsl_setup, 296 .reset = ehci_fsl_setup,
297 .start = ehci_run, 297 .start = ehci_run,
298#ifdef CONFIG_PM
299 .suspend = ehci_bus_suspend,
300 .resume = ehci_bus_resume,
301#endif
302 .stop = ehci_stop, 298 .stop = ehci_stop,
303 .shutdown = ehci_shutdown, 299 .shutdown = ehci_shutdown,
304 300
@@ -322,6 +318,7 @@ static const struct hc_driver ehci_fsl_hc_driver = {
322 .bus_suspend = ehci_bus_suspend, 318 .bus_suspend = ehci_bus_suspend,
323 .bus_resume = ehci_bus_resume, 319 .bus_resume = ehci_bus_resume,
324 .relinquish_port = ehci_relinquish_port, 320 .relinquish_port = ehci_relinquish_port,
321 .port_handed_over = ehci_port_handed_over,
325}; 322};
326 323
327static int ehci_fsl_drv_probe(struct platform_device *pdev) 324static int ehci_fsl_drv_probe(struct platform_device *pdev)
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 382587c4457c..740835bb8575 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -609,7 +609,7 @@ static int ehci_hub_control (
609 } 609 }
610 break; 610 break;
611 case USB_PORT_FEAT_C_SUSPEND: 611 case USB_PORT_FEAT_C_SUSPEND:
612 /* we auto-clear this feature */ 612 clear_bit(wIndex, &ehci->port_c_suspend);
613 break; 613 break;
614 case USB_PORT_FEAT_POWER: 614 case USB_PORT_FEAT_POWER:
615 if (HCS_PPC (ehci->hcs_params)) 615 if (HCS_PPC (ehci->hcs_params))
@@ -688,7 +688,7 @@ static int ehci_hub_control (
688 /* resume completed? */ 688 /* resume completed? */
689 else if (time_after_eq(jiffies, 689 else if (time_after_eq(jiffies,
690 ehci->reset_done[wIndex])) { 690 ehci->reset_done[wIndex])) {
691 status |= 1 << USB_PORT_FEAT_C_SUSPEND; 691 set_bit(wIndex, &ehci->port_c_suspend);
692 ehci->reset_done[wIndex] = 0; 692 ehci->reset_done[wIndex] = 0;
693 693
694 /* stop resume signaling */ 694 /* stop resume signaling */
@@ -765,6 +765,8 @@ static int ehci_hub_control (
765 status |= 1 << USB_PORT_FEAT_RESET; 765 status |= 1 << USB_PORT_FEAT_RESET;
766 if (temp & PORT_POWER) 766 if (temp & PORT_POWER)
767 status |= 1 << USB_PORT_FEAT_POWER; 767 status |= 1 << USB_PORT_FEAT_POWER;
768 if (test_bit(wIndex, &ehci->port_c_suspend))
769 status |= 1 << USB_PORT_FEAT_C_SUSPEND;
768 770
769#ifndef VERBOSE_DEBUG 771#ifndef VERBOSE_DEBUG
770 if (status & ~0xffff) /* only if wPortChange is interesting */ 772 if (status & ~0xffff) /* only if wPortChange is interesting */
@@ -875,3 +877,13 @@ static void ehci_relinquish_port(struct usb_hcd *hcd, int portnum)
875 set_owner(ehci, --portnum, PORT_OWNER); 877 set_owner(ehci, --portnum, PORT_OWNER);
876} 878}
877 879
880static int ehci_port_handed_over(struct usb_hcd *hcd, int portnum)
881{
882 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
883 u32 __iomem *reg;
884
885 if (ehci_is_TDI(ehci))
886 return 0;
887 reg = &ehci->regs->port_status[portnum - 1];
888 return ehci_readl(ehci, reg) & PORT_OWNER;
889}
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
index 601c8795a854..9d042f220097 100644
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -26,7 +26,7 @@ static int ixp4xx_ehci_init(struct usb_hcd *hcd)
26 + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); 26 + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
27 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); 27 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
28 28
29 ehci->is_tdi_rh_tt = 1; 29 hcd->has_tt = 1;
30 ehci_reset(ehci); 30 ehci_reset(ehci);
31 31
32 retval = ehci_init(hcd); 32 retval = ehci_init(hcd);
@@ -58,6 +58,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = {
58 .bus_suspend = ehci_bus_suspend, 58 .bus_suspend = ehci_bus_suspend,
59 .bus_resume = ehci_bus_resume, 59 .bus_resume = ehci_bus_resume,
60#endif 60#endif
61 .relinquish_port = ehci_relinquish_port,
62 .port_handed_over = ehci_port_handed_over,
61}; 63};
62 64
63static int ixp4xx_ehci_probe(struct platform_device *pdev) 65static int ixp4xx_ehci_probe(struct platform_device *pdev)
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index d187d0313742..ab625f0ba1d9 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -115,6 +115,8 @@ static int ehci_orion_setup(struct usb_hcd *hcd)
115 if (retval) 115 if (retval)
116 return retval; 116 return retval;
117 117
118 hcd->has_tt = 1;
119
118 ehci_reset(ehci); 120 ehci_reset(ehci);
119 ehci_port_power(ehci, 0); 121 ehci_port_power(ehci, 0);
120 122
@@ -137,10 +139,6 @@ static const struct hc_driver ehci_orion_hc_driver = {
137 */ 139 */
138 .reset = ehci_orion_setup, 140 .reset = ehci_orion_setup,
139 .start = ehci_run, 141 .start = ehci_run,
140#ifdef CONFIG_PM
141 .suspend = ehci_bus_suspend,
142 .resume = ehci_bus_resume,
143#endif
144 .stop = ehci_stop, 142 .stop = ehci_stop,
145 .shutdown = ehci_shutdown, 143 .shutdown = ehci_shutdown,
146 144
@@ -163,6 +161,8 @@ static const struct hc_driver ehci_orion_hc_driver = {
163 .hub_control = ehci_hub_control, 161 .hub_control = ehci_hub_control,
164 .bus_suspend = ehci_bus_suspend, 162 .bus_suspend = ehci_bus_suspend,
165 .bus_resume = ehci_bus_resume, 163 .bus_resume = ehci_bus_resume,
164 .relinquish_port = ehci_relinquish_port,
165 .port_handed_over = ehci_port_handed_over,
166}; 166};
167 167
168static void __init 168static void __init
@@ -248,7 +248,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
248 ehci->regs = hcd->regs + 0x100 + 248 ehci->regs = hcd->regs + 0x100 +
249 HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); 249 HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
250 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); 250 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
251 ehci->is_tdi_rh_tt = 1; 251 hcd->has_tt = 1;
252 ehci->sbrn = 0x20; 252 ehci->sbrn = 0x20;
253 253
254 /* 254 /*
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 5bb7f6bb13f3..c46a58f9181d 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -129,7 +129,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
129 switch (pdev->vendor) { 129 switch (pdev->vendor) {
130 case PCI_VENDOR_ID_TDI: 130 case PCI_VENDOR_ID_TDI:
131 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 131 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
132 ehci->is_tdi_rh_tt = 1;
133 hcd->has_tt = 1; 132 hcd->has_tt = 1;
134 tdi_reset(ehci); 133 tdi_reset(ehci);
135 } 134 }
@@ -379,7 +378,8 @@ static const struct hc_driver ehci_pci_hc_driver = {
379 .hub_control = ehci_hub_control, 378 .hub_control = ehci_hub_control,
380 .bus_suspend = ehci_bus_suspend, 379 .bus_suspend = ehci_bus_suspend,
381 .bus_resume = ehci_bus_resume, 380 .bus_resume = ehci_bus_resume,
382 .relinquish_port = ehci_relinquish_port, 381 .relinquish_port = ehci_relinquish_port,
382 .port_handed_over = ehci_port_handed_over,
383}; 383};
384 384
385/*-------------------------------------------------------------------------*/ 385/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index ee305b1f99ff..b018deed2e8f 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -76,6 +76,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = {
76 .bus_suspend = ehci_bus_suspend, 76 .bus_suspend = ehci_bus_suspend,
77 .bus_resume = ehci_bus_resume, 77 .bus_resume = ehci_bus_resume,
78#endif 78#endif
79 .relinquish_port = ehci_relinquish_port,
80 .port_handed_over = ehci_port_handed_over,
79}; 81};
80 82
81 83
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c
index 6c76036783a1..529590eb4037 100644
--- a/drivers/usb/host/ehci-ppc-soc.c
+++ b/drivers/usb/host/ehci-ppc-soc.c
@@ -163,6 +163,7 @@ static const struct hc_driver ehci_ppc_soc_hc_driver = {
163 .bus_suspend = ehci_bus_suspend, 163 .bus_suspend = ehci_bus_suspend,
164 .bus_resume = ehci_bus_resume, 164 .bus_resume = ehci_bus_resume,
165 .relinquish_port = ehci_relinquish_port, 165 .relinquish_port = ehci_relinquish_port,
166 .port_handed_over = ehci_port_handed_over,
166}; 167};
167 168
168static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) 169static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev)
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 69782221bcf3..37e6abeb794c 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -73,6 +73,7 @@ static const struct hc_driver ps3_ehci_hc_driver = {
73 .bus_resume = ehci_bus_resume, 73 .bus_resume = ehci_bus_resume,
74#endif 74#endif
75 .relinquish_port = ehci_relinquish_port, 75 .relinquish_port = ehci_relinquish_port,
76 .port_handed_over = ehci_port_handed_over,
76}; 77};
77 78
78static int ps3_ehci_probe(struct ps3_system_bus_device *dev) 79static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index be575e46eac3..b7853c8bac0f 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1349,18 +1349,27 @@ iso_stream_schedule (
1349 /* when's the last uframe this urb could start? */ 1349 /* when's the last uframe this urb could start? */
1350 max = now + mod; 1350 max = now + mod;
1351 1351
1352 /* typical case: reuse current schedule. stream is still active, 1352 /* Typical case: reuse current schedule, stream is still active.
1353 * and no gaps from host falling behind (irq delays etc) 1353 * Hopefully there are no gaps from the host falling behind
1354 * (irq delays etc), but if there are we'll take the next
1355 * slot in the schedule, implicitly assuming URB_ISO_ASAP.
1354 */ 1356 */
1355 if (likely (!list_empty (&stream->td_list))) { 1357 if (likely (!list_empty (&stream->td_list))) {
1356 start = stream->next_uframe; 1358 start = stream->next_uframe;
1357 if (start < now) 1359 if (start < now)
1358 start += mod; 1360 start += mod;
1359 if (likely ((start + sched->span) < max)) 1361
1360 goto ready; 1362 /* Fell behind (by up to twice the slop amount)? */
1361 /* else fell behind; someday, try to reschedule */ 1363 if (start >= max - 2 * 8 * SCHEDULE_SLOP)
1362 status = -EL2NSYNC; 1364 start += stream->interval * DIV_ROUND_UP(
1363 goto fail; 1365 max - start, stream->interval) - mod;
1366
1367 /* Tried to schedule too far into the future? */
1368 if (unlikely((start + sched->span) >= max)) {
1369 status = -EFBIG;
1370 goto fail;
1371 }
1372 goto ready;
1364 } 1373 }
1365 1374
1366 /* need to schedule; when's the next (u)frame we could start? 1375 /* need to schedule; when's the next (u)frame we could start?
@@ -1613,6 +1622,9 @@ itd_complete (
1613 } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { 1622 } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) {
1614 desc->status = 0; 1623 desc->status = 0;
1615 desc->actual_length = EHCI_ITD_LENGTH (t); 1624 desc->actual_length = EHCI_ITD_LENGTH (t);
1625 } else {
1626 /* URB was too late */
1627 desc->status = -EXDEV;
1616 } 1628 }
1617 } 1629 }
1618 1630
@@ -2095,7 +2107,7 @@ done:
2095static void 2107static void
2096scan_periodic (struct ehci_hcd *ehci) 2108scan_periodic (struct ehci_hcd *ehci)
2097{ 2109{
2098 unsigned frame, clock, now_uframe, mod; 2110 unsigned now_uframe, frame, clock, clock_frame, mod;
2099 unsigned modified; 2111 unsigned modified;
2100 2112
2101 mod = ehci->periodic_size << 3; 2113 mod = ehci->periodic_size << 3;
@@ -2111,6 +2123,7 @@ scan_periodic (struct ehci_hcd *ehci)
2111 else 2123 else
2112 clock = now_uframe + mod - 1; 2124 clock = now_uframe + mod - 1;
2113 clock %= mod; 2125 clock %= mod;
2126 clock_frame = clock >> 3;
2114 2127
2115 for (;;) { 2128 for (;;) {
2116 union ehci_shadow q, *q_p; 2129 union ehci_shadow q, *q_p;
@@ -2157,22 +2170,26 @@ restart:
2157 case Q_TYPE_ITD: 2170 case Q_TYPE_ITD:
2158 /* If this ITD is still active, leave it for 2171 /* If this ITD is still active, leave it for
2159 * later processing ... check the next entry. 2172 * later processing ... check the next entry.
2173 * No need to check for activity unless the
2174 * frame is current.
2160 */ 2175 */
2161 rmb (); 2176 if (frame == clock_frame && live) {
2162 for (uf = 0; uf < 8 && live; uf++) { 2177 rmb();
2163 if (0 == (q.itd->hw_transaction [uf] 2178 for (uf = 0; uf < 8; uf++) {
2164 & ITD_ACTIVE(ehci))) 2179 if (q.itd->hw_transaction[uf] &
2165 continue; 2180 ITD_ACTIVE(ehci))
2166 incomplete = true; 2181 break;
2167 q_p = &q.itd->itd_next; 2182 }
2168 hw_p = &q.itd->hw_next; 2183 if (uf < 8) {
2169 type = Q_NEXT_TYPE(ehci, 2184 incomplete = true;
2185 q_p = &q.itd->itd_next;
2186 hw_p = &q.itd->hw_next;
2187 type = Q_NEXT_TYPE(ehci,
2170 q.itd->hw_next); 2188 q.itd->hw_next);
2171 q = *q_p; 2189 q = *q_p;
2172 break; 2190 break;
2191 }
2173 } 2192 }
2174 if (uf < 8 && live)
2175 break;
2176 2193
2177 /* Take finished ITDs out of the schedule 2194 /* Take finished ITDs out of the schedule
2178 * and process them: recycle, maybe report 2195 * and process them: recycle, maybe report
@@ -2189,9 +2206,12 @@ restart:
2189 case Q_TYPE_SITD: 2206 case Q_TYPE_SITD:
2190 /* If this SITD is still active, leave it for 2207 /* If this SITD is still active, leave it for
2191 * later processing ... check the next entry. 2208 * later processing ... check the next entry.
2209 * No need to check for activity unless the
2210 * frame is current.
2192 */ 2211 */
2193 if ((q.sitd->hw_results & SITD_ACTIVE(ehci)) 2212 if (frame == clock_frame && live &&
2194 && live) { 2213 (q.sitd->hw_results &
2214 SITD_ACTIVE(ehci))) {
2195 incomplete = true; 2215 incomplete = true;
2196 q_p = &q.sitd->sitd_next; 2216 q_p = &q.sitd->sitd_next;
2197 hw_p = &q.sitd->hw_next; 2217 hw_p = &q.sitd->hw_next;
@@ -2260,6 +2280,7 @@ restart:
2260 2280
2261 /* rescan the rest of this frame, then ... */ 2281 /* rescan the rest of this frame, then ... */
2262 clock = now; 2282 clock = now;
2283 clock_frame = clock >> 3;
2263 } else { 2284 } else {
2264 now_uframe++; 2285 now_uframe++;
2265 now_uframe %= mod; 2286 now_uframe %= mod;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index bf92d209a1a9..35a03095757e 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -97,6 +97,8 @@ struct ehci_hcd { /* one per controller */
97 dedicated to the companion controller */ 97 dedicated to the companion controller */
98 unsigned long owned_ports; /* which ports are 98 unsigned long owned_ports; /* which ports are
99 owned by the companion during a bus suspend */ 99 owned by the companion during a bus suspend */
100 unsigned long port_c_suspend; /* which ports have
101 the change-suspend feature turned on */
100 102
101 /* per-HC memory pools (could be per-bus, but ...) */ 103 /* per-HC memory pools (could be per-bus, but ...) */
102 struct dma_pool *qh_pool; /* qh per active urb */ 104 struct dma_pool *qh_pool; /* qh per active urb */
@@ -112,7 +114,6 @@ struct ehci_hcd { /* one per controller */
112 u32 command; 114 u32 command;
113 115
114 /* SILICON QUIRKS */ 116 /* SILICON QUIRKS */
115 unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */
116 unsigned no_selective_suspend:1; 117 unsigned no_selective_suspend:1;
117 unsigned has_fsl_port_bug:1; /* FreeScale */ 118 unsigned has_fsl_port_bug:1; /* FreeScale */
118 unsigned big_endian_mmio:1; 119 unsigned big_endian_mmio:1;
@@ -678,7 +679,7 @@ struct ehci_fstn {
678 * needed (mostly in root hub code). 679 * needed (mostly in root hub code).
679 */ 680 */
680 681
681#define ehci_is_TDI(e) ((e)->is_tdi_rh_tt) 682#define ehci_is_TDI(e) (ehci_to_hcd(e)->has_tt)
682 683
683/* Returns the speed of a device attached to a port on the root hub. */ 684/* Returns the speed of a device attached to a port on the root hub. */
684static inline unsigned int 685static inline unsigned int
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 4ba96c1e060c..65aa5ecf569a 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -988,7 +988,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
988 * This did not trigger for a long time now. 988 * This did not trigger for a long time now.
989 */ 989 */
990 printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " 990 printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: "
991 "%d of %d done: %08x cur: %08x\n", qtd, 991 "%d of %zu done: %08x cur: %08x\n", qtd,
992 urb, qh, PTD_XFERRED_LENGTH(dw3), 992 urb, qh, PTD_XFERRED_LENGTH(dw3),
993 qtd->length, done_map, 993 qtd->length, done_map,
994 (1 << queue_entry)); 994 (1 << queue_entry));
@@ -1088,7 +1088,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
1088 } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) { 1088 } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) {
1089 /* short BULK received */ 1089 /* short BULK received */
1090 1090
1091 printk(KERN_ERR "short bulk, %d instead %d\n", length, 1091 printk(KERN_ERR "short bulk, %d instead %zu\n", length,
1092 qtd->length); 1092 qtd->length);
1093 if (urb->transfer_flags & URB_SHORT_NOT_OK) { 1093 if (urb->transfer_flags & URB_SHORT_NOT_OK) {
1094 urb->status = -EREMOTEIO; 1094 urb->status = -EREMOTEIO;
@@ -2207,14 +2207,14 @@ struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq,
2207 goto err_put; 2207 goto err_put;
2208 } 2208 }
2209 2209
2210 ret = usb_add_hcd(hcd, irq, irqflags);
2211 if (ret)
2212 goto err_unmap;
2213
2214 hcd->irq = irq; 2210 hcd->irq = irq;
2215 hcd->rsrc_start = res_start; 2211 hcd->rsrc_start = res_start;
2216 hcd->rsrc_len = res_len; 2212 hcd->rsrc_len = res_len;
2217 2213
2214 ret = usb_add_hcd(hcd, irq, irqflags);
2215 if (ret)
2216 goto err_unmap;
2217
2218 return hcd; 2218 return hcd;
2219 2219
2220err_unmap: 2220err_unmap:
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index 73fb2a38f1e4..c9db3fe98726 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -104,8 +104,8 @@ static u32 nxp_pci_io_base;
104static u32 iolength; 104static u32 iolength;
105static u32 pci_mem_phy0; 105static u32 pci_mem_phy0;
106static u32 length; 106static u32 length;
107static u8 *chip_addr; 107static u8 __iomem *chip_addr;
108static u8 *iobase; 108static u8 __iomem *iobase;
109 109
110static int __devinit isp1761_pci_probe(struct pci_dev *dev, 110static int __devinit isp1761_pci_probe(struct pci_dev *dev,
111 const struct pci_device_id *id) 111 const struct pci_device_id *id)
@@ -256,7 +256,7 @@ static struct pci_driver isp1761_pci_driver = {
256 256
257static int __init isp1760_init(void) 257static int __init isp1760_init(void)
258{ 258{
259 int ret; 259 int ret = -ENODEV;
260 260
261 init_kmem_once(); 261 init_kmem_once();
262 262
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index 77204f001b9a..e899a77dfb83 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -90,7 +90,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
90 struct device *dev = &pdev->dev; 90 struct device *dev = &pdev->dev;
91 struct resource *res, *mem; 91 struct resource *res, *mem;
92 int retval, irq; 92 int retval, irq;
93 struct usb_hcd *hcd = 0; 93 struct usb_hcd *hcd = NULL;
94 94
95 irq = retval = platform_get_irq(pdev, 0); 95 irq = retval = platform_get_irq(pdev, 0);
96 if (retval < 0) 96 if (retval < 0)
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index a53db1d4e07a..001789c9a11a 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -269,3 +269,15 @@ config USB_TEST
269 See <http://www.linux-usb.org/usbtest/> for more information, 269 See <http://www.linux-usb.org/usbtest/> for more information,
270 including sample test device firmware and "how to use it". 270 including sample test device firmware and "how to use it".
271 271
272config USB_ISIGHTFW
273 tristate "iSight firmware loading support"
274 depends on USB
275 select FW_LOADER
276 help
277 This driver loads firmware for USB Apple iSight cameras, allowing
278 them to be driven by the USB video class driver available at
279 http://linux-uvc.berlios.de
280
281 The firmware for this driver must be extracted from the MacOS
282 driver beforehand. Tools for doing so are available at
283 http://bersace03.free.fr
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index b68e6b774f1a..aba091cb5ec0 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_EMI62) += emi62.o
14obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o 14obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o
15obj-$(CONFIG_USB_IDMOUSE) += idmouse.o 15obj-$(CONFIG_USB_IDMOUSE) += idmouse.o
16obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o 16obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o
17obj-$(CONFIG_USB_ISIGHTFW) += isight_firmware.o
17obj-$(CONFIG_USB_LCD) += usblcd.o 18obj-$(CONFIG_USB_LCD) += usblcd.o
18obj-$(CONFIG_USB_LD) += ldusb.o 19obj-$(CONFIG_USB_LD) += ldusb.o
19obj-$(CONFIG_USB_LED) += usbled.o 20obj-$(CONFIG_USB_LED) += usbled.o
diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c
new file mode 100644
index 000000000000..9f30aa1f8a5d
--- /dev/null
+++ b/drivers/usb/misc/isight_firmware.c
@@ -0,0 +1,140 @@
1/*
2 * Driver for loading USB isight firmware
3 *
4 * Copyright (C) 2008 Matthew Garrett <mjg@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation, version 2.
9 *
10 * The USB isight cameras in recent Apples are roughly compatible with the USB
11 * video class specification, and can be driven by uvcvideo. However, they
12 * need firmware to be loaded beforehand. After firmware loading, the device
13 * detaches from the USB bus and reattaches with a new device ID. It can then
14 * be claimed by the uvc driver.
15 *
16 * The firmware is non-free and must be extracted by the user. Tools to do this
17 * are available at http://bersace03.free.fr/ift/
18 *
19 * The isight firmware loading was reverse engineered by Johannes Berg
20 * <johannes@sipsolutions.de>, and this driver is based on code by Ronald
21 * Bultje <rbultje@ronald.bitfreak.net>
22 */
23
24#include <linux/usb.h>
25#include <linux/firmware.h>
26#include <linux/errno.h>
27#include <linux/module.h>
28
29static struct usb_device_id id_table[] = {
30 {USB_DEVICE(0x05ac, 0x8300)},
31 {},
32};
33
34MODULE_DEVICE_TABLE(usb, id_table);
35
36static int isight_firmware_load(struct usb_interface *intf,
37 const struct usb_device_id *id)
38{
39 struct usb_device *dev = interface_to_usbdev(intf);
40 int llen, len, req, ret = 0;
41 const struct firmware *firmware;
42 unsigned char *buf = kmalloc(50, GFP_KERNEL);
43 unsigned char data[4];
44 u8 *ptr;
45
46 if (!buf)
47 return -ENOMEM;
48
49 if (request_firmware(&firmware, "isight.fw", &dev->dev) != 0) {
50 printk(KERN_ERR "Unable to load isight firmware\n");
51 return -ENODEV;
52 }
53
54 ptr = firmware->data;
55
56 if (usb_control_msg
57 (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\1", 1,
58 300) != 1) {
59 printk(KERN_ERR
60 "Failed to initialise isight firmware loader\n");
61 ret = -ENODEV;
62 goto out;
63 }
64
65 while (ptr+4 <= firmware->data+firmware->size) {
66 memcpy(data, ptr, 4);
67 len = (data[0] << 8 | data[1]);
68 req = (data[2] << 8 | data[3]);
69 ptr += 4;
70
71 if (len == 0x8001)
72 break; /* success */
73 else if (len == 0)
74 continue;
75
76 for (; len > 0; req += 50) {
77 llen = min(len, 50);
78 len -= llen;
79 if (ptr+llen > firmware->data+firmware->size) {
80 printk(KERN_ERR
81 "Malformed isight firmware");
82 ret = -ENODEV;
83 goto out;
84 }
85 memcpy(buf, ptr, llen);
86
87 ptr += llen;
88
89 if (usb_control_msg
90 (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, req, 0,
91 buf, llen, 300) != llen) {
92 printk(KERN_ERR
93 "Failed to load isight firmware\n");
94 kfree(buf);
95 ret = -ENODEV;
96 goto out;
97 }
98
99 }
100 }
101
102 if (usb_control_msg
103 (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1,
104 300) != 1) {
105 printk(KERN_ERR "isight firmware loading completion failed\n");
106 ret = -ENODEV;
107 }
108
109out:
110 kfree(buf);
111 release_firmware(firmware);
112 return ret;
113}
114
115static void isight_firmware_disconnect(struct usb_interface *intf)
116{
117}
118
119static struct usb_driver isight_firmware_driver = {
120 .name = "isight_firmware",
121 .probe = isight_firmware_load,
122 .disconnect = isight_firmware_disconnect,
123 .id_table = id_table,
124};
125
126static int __init isight_firmware_init(void)
127{
128 return usb_register(&isight_firmware_driver);
129}
130
131static void __exit isight_firmware_exit(void)
132{
133 usb_deregister(&isight_firmware_driver);
134}
135
136module_init(isight_firmware_init);
137module_exit(isight_firmware_exit);
138
139MODULE_LICENSE("GPL");
140MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 7aafd53fbcab..189a9db03509 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -63,9 +63,6 @@
63#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 63#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
64#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 64#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
65 65
66#define USB_VENDOR_ID_MICROCHIP 0x04d8
67#define USB_DEVICE_ID_PICDEM 0x000c
68
69#ifdef CONFIG_USB_DYNAMIC_MINORS 66#ifdef CONFIG_USB_DYNAMIC_MINORS
70#define USB_LD_MINOR_BASE 0 67#define USB_LD_MINOR_BASE 0
71#else 68#else
@@ -92,7 +89,6 @@ static struct usb_device_id ld_usb_table [] = {
92 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, 89 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
93 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 90 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
94 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, 91 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) },
95 { USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) },
96 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, 92 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) },
97 { } /* Terminating entry */ 93 { } /* Terminating entry */
98}; 94};
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c
index 24230c638b8e..4cfa25b0f44e 100644
--- a/drivers/usb/misc/phidgetkit.c
+++ b/drivers/usb/misc/phidgetkit.c
@@ -595,14 +595,14 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic
595 } while(value); 595 } while(value);
596 kit->dev_no = bit; 596 kit->dev_no = bit;
597 597
598 kit->dev = device_create(phidget_class, &kit->udev->dev, 0, 598 kit->dev = device_create_drvdata(phidget_class, &kit->udev->dev,
599 "interfacekit%d", kit->dev_no); 599 MKDEV(0, 0), kit,
600 "interfacekit%d", kit->dev_no);
600 if (IS_ERR(kit->dev)) { 601 if (IS_ERR(kit->dev)) {
601 rc = PTR_ERR(kit->dev); 602 rc = PTR_ERR(kit->dev);
602 kit->dev = NULL; 603 kit->dev = NULL;
603 goto out; 604 goto out;
604 } 605 }
605 dev_set_drvdata(kit->dev, kit);
606 606
607 if (usb_submit_urb(kit->irq, GFP_KERNEL)) { 607 if (usb_submit_urb(kit->irq, GFP_KERNEL)) {
608 rc = -EIO; 608 rc = -EIO;
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c
index f0113c17cc5a..9b4696f21b22 100644
--- a/drivers/usb/misc/phidgetmotorcontrol.c
+++ b/drivers/usb/misc/phidgetmotorcontrol.c
@@ -365,16 +365,15 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic
365 } while(value); 365 } while(value);
366 mc->dev_no = bit; 366 mc->dev_no = bit;
367 367
368 mc->dev = device_create(phidget_class, &mc->udev->dev, 0, 368 mc->dev = device_create_drvdata(phidget_class, &mc->udev->dev,
369 "motorcontrol%d", mc->dev_no); 369 MKDEV(0, 0), mc,
370 "motorcontrol%d", mc->dev_no);
370 if (IS_ERR(mc->dev)) { 371 if (IS_ERR(mc->dev)) {
371 rc = PTR_ERR(mc->dev); 372 rc = PTR_ERR(mc->dev);
372 mc->dev = NULL; 373 mc->dev = NULL;
373 goto out; 374 goto out;
374 } 375 }
375 376
376 dev_set_drvdata(mc->dev, mc);
377
378 if (usb_submit_urb(mc->irq, GFP_KERNEL)) { 377 if (usb_submit_urb(mc->irq, GFP_KERNEL)) {
379 rc = -EIO; 378 rc = -EIO;
380 goto out; 379 goto out;
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c
index 7d590c09434a..1ca7ddb41d4d 100644
--- a/drivers/usb/misc/phidgetservo.c
+++ b/drivers/usb/misc/phidgetservo.c
@@ -275,14 +275,14 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id)
275 } while (value); 275 } while (value);
276 dev->dev_no = bit; 276 dev->dev_no = bit;
277 277
278 dev->dev = device_create(phidget_class, &dev->udev->dev, 0, 278 dev->dev = device_create_drvdata(phidget_class, &dev->udev->dev,
279 "servo%d", dev->dev_no); 279 MKDEV(0, 0), dev,
280 "servo%d", dev->dev_no);
280 if (IS_ERR(dev->dev)) { 281 if (IS_ERR(dev->dev)) {
281 rc = PTR_ERR(dev->dev); 282 rc = PTR_ERR(dev->dev);
282 dev->dev = NULL; 283 dev->dev = NULL;
283 goto out; 284 goto out;
284 } 285 }
285 dev_set_drvdata(dev->dev, dev);
286 286
287 servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; 287 servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1;
288 288
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 742be3c35947..054dedd28127 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -856,6 +856,11 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
856 struct urb *u; 856 struct urb *u;
857 struct usb_ctrlrequest req; 857 struct usb_ctrlrequest req;
858 struct subcase *reqp; 858 struct subcase *reqp;
859
860 /* sign of this variable means:
861 * -: tested code must return this (negative) error code
862 * +: tested code may return this (negative too) error code
863 */
859 int expected = 0; 864 int expected = 0;
860 865
861 /* requests here are mostly expected to succeed on any 866 /* requests here are mostly expected to succeed on any
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 2cffec85ee7e..9ba64ccc1359 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -447,6 +447,15 @@ config USB_SERIAL_MOS7840
447 To compile this driver as a module, choose M here: the 447 To compile this driver as a module, choose M here: the
448 module will be called mos7840. If unsure, choose N. 448 module will be called mos7840. If unsure, choose N.
449 449
450config USB_SERIAL_MOTOROLA
451 tristate "USB Motorola Phone modem driver"
452 ---help---
453 Say Y here if you want to use a Motorola phone with a USB
454 connector as a modem link.
455
456 To compile this driver as a module, choose M here: the
457 module will be called moto_modem. If unsure, choose N.
458
450config USB_SERIAL_NAVMAN 459config USB_SERIAL_NAVMAN
451 tristate "USB Navman GPS device" 460 tristate "USB Navman GPS device"
452 help 461 help
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 756859510d8c..17a762ab6769 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o
39obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o 39obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o
40obj-$(CONFIG_USB_SERIAL_MOS7720) += mos7720.o 40obj-$(CONFIG_USB_SERIAL_MOS7720) += mos7720.o
41obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o 41obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o
42obj-$(CONFIG_USB_SERIAL_MOTOROLA) += moto_modem.o
42obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o 43obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o
43obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o 44obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o
44obj-$(CONFIG_USB_SERIAL_OPTION) += option.o 45obj-$(CONFIG_USB_SERIAL_OPTION) += option.o
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index ba28fdc9ccd2..1f7c86bd8297 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -28,6 +28,7 @@ static int debug;
28 28
29static struct usb_device_id id_table [] = { 29static struct usb_device_id id_table [] = {
30 { USB_DEVICE(0x4348, 0x5523) }, 30 { USB_DEVICE(0x4348, 0x5523) },
31 { USB_DEVICE(0x1a86, 0x7523) },
31 { }, 32 { },
32}; 33};
33MODULE_DEVICE_TABLE(usb, id_table); 34MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 5b349ece7247..5234e7a3bd2c 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -174,8 +174,270 @@ static struct usb_device_id id_table_combined [] = {
174 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, 174 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) },
175 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 175 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
176 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 176 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
177 { USB_DEVICE(MTXORB_VK_VID, MTXORB_VK_PID), 177 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0100_PID) },
178 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0101_PID) },
179 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0102_PID) },
180 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0103_PID) },
181 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0104_PID) },
182 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0105_PID) },
183 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0106_PID) },
184 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0107_PID) },
185 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0108_PID) },
186 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0109_PID) },
187 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010A_PID) },
188 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010B_PID) },
189 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010C_PID) },
190 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010D_PID) },
191 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010E_PID) },
192 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010F_PID) },
193 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0110_PID) },
194 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0111_PID) },
195 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0112_PID) },
196 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0113_PID) },
197 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0114_PID) },
198 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0115_PID) },
199 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0116_PID) },
200 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0117_PID) },
201 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0118_PID) },
202 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0119_PID) },
203 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011A_PID) },
204 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011B_PID) },
205 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011C_PID) },
206 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011D_PID) },
207 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011E_PID) },
208 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011F_PID) },
209 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0120_PID) },
210 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0121_PID) },
211 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0122_PID) },
212 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0123_PID) },
213 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0124_PID) },
214 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0125_PID) },
215 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0126_PID) },
216 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0127_PID),
178 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 217 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
218 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0128_PID) },
219 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0129_PID) },
220 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012A_PID) },
221 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012B_PID) },
222 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012C_PID),
223 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
224 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012D_PID) },
225 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012E_PID) },
226 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012F_PID) },
227 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0130_PID) },
228 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0131_PID) },
229 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0132_PID) },
230 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0133_PID) },
231 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0134_PID) },
232 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0135_PID) },
233 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0136_PID) },
234 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0137_PID) },
235 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0138_PID) },
236 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0139_PID) },
237 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013A_PID) },
238 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013B_PID) },
239 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013C_PID) },
240 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013D_PID) },
241 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013E_PID) },
242 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013F_PID) },
243 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0140_PID) },
244 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0141_PID) },
245 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0142_PID) },
246 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0143_PID) },
247 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0144_PID) },
248 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0145_PID) },
249 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0146_PID) },
250 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0147_PID) },
251 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0148_PID) },
252 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0149_PID) },
253 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014A_PID) },
254 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014B_PID) },
255 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014C_PID) },
256 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014D_PID) },
257 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014E_PID) },
258 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014F_PID) },
259 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0150_PID) },
260 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0151_PID) },
261 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0152_PID) },
262 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0153_PID),
263 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
264 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0154_PID),
265 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
266 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0155_PID),
267 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
268 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0156_PID),
269 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
270 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0157_PID),
271 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
272 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0158_PID),
273 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
274 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0159_PID) },
275 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015A_PID) },
276 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015B_PID) },
277 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015C_PID) },
278 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015D_PID) },
279 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015E_PID) },
280 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015F_PID) },
281 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0160_PID) },
282 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0161_PID) },
283 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0162_PID) },
284 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0163_PID) },
285 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0164_PID) },
286 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0165_PID) },
287 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0166_PID) },
288 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0167_PID) },
289 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0168_PID) },
290 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0169_PID) },
291 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016A_PID) },
292 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016B_PID) },
293 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016C_PID) },
294 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016D_PID) },
295 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016E_PID) },
296 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016F_PID) },
297 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0170_PID) },
298 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0171_PID) },
299 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0172_PID) },
300 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0173_PID) },
301 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0174_PID) },
302 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0175_PID) },
303 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0176_PID) },
304 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0177_PID) },
305 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0178_PID) },
306 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0179_PID) },
307 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017A_PID) },
308 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017B_PID) },
309 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017C_PID) },
310 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017D_PID) },
311 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017E_PID) },
312 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017F_PID) },
313 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0180_PID) },
314 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0181_PID) },
315 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0182_PID) },
316 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0183_PID) },
317 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0184_PID) },
318 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0185_PID) },
319 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0186_PID) },
320 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0187_PID) },
321 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0188_PID) },
322 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0189_PID) },
323 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018A_PID) },
324 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018B_PID) },
325 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018C_PID) },
326 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018D_PID) },
327 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018E_PID) },
328 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018F_PID) },
329 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0190_PID) },
330 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0191_PID) },
331 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0192_PID) },
332 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0193_PID) },
333 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0194_PID) },
334 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0195_PID) },
335 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0196_PID) },
336 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0197_PID) },
337 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0198_PID) },
338 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0199_PID) },
339 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019A_PID) },
340 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019B_PID) },
341 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019C_PID) },
342 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019D_PID) },
343 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019E_PID) },
344 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019F_PID) },
345 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A0_PID) },
346 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A1_PID) },
347 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A2_PID) },
348 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A3_PID) },
349 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A4_PID) },
350 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A5_PID) },
351 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A6_PID) },
352 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A7_PID) },
353 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A8_PID) },
354 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A9_PID) },
355 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AA_PID) },
356 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AB_PID) },
357 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AC_PID) },
358 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AD_PID) },
359 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AE_PID) },
360 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AF_PID) },
361 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B0_PID) },
362 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B1_PID) },
363 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B2_PID) },
364 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B3_PID) },
365 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B4_PID) },
366 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B5_PID) },
367 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B6_PID) },
368 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B7_PID) },
369 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B8_PID) },
370 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B9_PID) },
371 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BA_PID) },
372 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BB_PID) },
373 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BC_PID) },
374 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BD_PID) },
375 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BE_PID) },
376 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BF_PID) },
377 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C0_PID) },
378 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C1_PID) },
379 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C2_PID) },
380 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C3_PID) },
381 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C4_PID) },
382 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C5_PID) },
383 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C6_PID) },
384 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C7_PID) },
385 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C8_PID) },
386 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C9_PID) },
387 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CA_PID) },
388 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CB_PID) },
389 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CC_PID) },
390 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CD_PID) },
391 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CE_PID) },
392 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CF_PID) },
393 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D0_PID) },
394 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D1_PID) },
395 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D2_PID) },
396 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D3_PID) },
397 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D4_PID) },
398 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D5_PID) },
399 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D6_PID) },
400 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D7_PID) },
401 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D8_PID) },
402 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D9_PID) },
403 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DA_PID) },
404 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DB_PID) },
405 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DC_PID) },
406 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DD_PID) },
407 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DE_PID) },
408 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DF_PID) },
409 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E0_PID) },
410 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E1_PID) },
411 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E2_PID) },
412 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E3_PID) },
413 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E4_PID) },
414 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E5_PID) },
415 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E6_PID) },
416 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E7_PID) },
417 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E8_PID) },
418 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E9_PID) },
419 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EA_PID) },
420 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EB_PID) },
421 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EC_PID) },
422 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01ED_PID) },
423 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EE_PID) },
424 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EF_PID) },
425 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F0_PID) },
426 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F1_PID) },
427 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F2_PID) },
428 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F3_PID) },
429 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F4_PID) },
430 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F5_PID) },
431 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F6_PID) },
432 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F7_PID) },
433 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F8_PID) },
434 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F9_PID) },
435 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FA_PID) },
436 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FB_PID) },
437 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FC_PID) },
438 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FD_PID) },
439 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FE_PID) },
440 { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FF_PID) },
179 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 441 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
180 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 442 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
181 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, 443 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
@@ -374,6 +636,7 @@ static struct usb_device_id id_table_combined [] = {
374 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 636 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
375 { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), 637 { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
376 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 638 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
639 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
377 { }, /* Optional parameter entry */ 640 { }, /* Optional parameter entry */
378 { } /* Terminating entry */ 641 { } /* Terminating entry */
379}; 642};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 504edf8c3a3f..06e0ecabb3eb 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -114,11 +114,268 @@
114#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ 114#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */
115 115
116/* 116/*
117 * The following are the values for the Matrix Orbital VK204-25-USB 117 * The following are the values for the Matrix Orbital FTDI Range
118 * display, which use the FT232RL. 118 * Anything in this range will use an FT232RL.
119 */ 119 */
120#define MTXORB_VK_VID 0x1b3d 120#define MTXORB_VID 0x1B3D
121#define MTXORB_VK_PID 0x0158 121#define MTXORB_FTDI_RANGE_0100_PID 0x0100
122#define MTXORB_FTDI_RANGE_0101_PID 0x0101
123#define MTXORB_FTDI_RANGE_0102_PID 0x0102
124#define MTXORB_FTDI_RANGE_0103_PID 0x0103
125#define MTXORB_FTDI_RANGE_0104_PID 0x0104
126#define MTXORB_FTDI_RANGE_0105_PID 0x0105
127#define MTXORB_FTDI_RANGE_0106_PID 0x0106
128#define MTXORB_FTDI_RANGE_0107_PID 0x0107
129#define MTXORB_FTDI_RANGE_0108_PID 0x0108
130#define MTXORB_FTDI_RANGE_0109_PID 0x0109
131#define MTXORB_FTDI_RANGE_010A_PID 0x010A
132#define MTXORB_FTDI_RANGE_010B_PID 0x010B
133#define MTXORB_FTDI_RANGE_010C_PID 0x010C
134#define MTXORB_FTDI_RANGE_010D_PID 0x010D
135#define MTXORB_FTDI_RANGE_010E_PID 0x010E
136#define MTXORB_FTDI_RANGE_010F_PID 0x010F
137#define MTXORB_FTDI_RANGE_0110_PID 0x0110
138#define MTXORB_FTDI_RANGE_0111_PID 0x0111
139#define MTXORB_FTDI_RANGE_0112_PID 0x0112
140#define MTXORB_FTDI_RANGE_0113_PID 0x0113
141#define MTXORB_FTDI_RANGE_0114_PID 0x0114
142#define MTXORB_FTDI_RANGE_0115_PID 0x0115
143#define MTXORB_FTDI_RANGE_0116_PID 0x0116
144#define MTXORB_FTDI_RANGE_0117_PID 0x0117
145#define MTXORB_FTDI_RANGE_0118_PID 0x0118
146#define MTXORB_FTDI_RANGE_0119_PID 0x0119
147#define MTXORB_FTDI_RANGE_011A_PID 0x011A
148#define MTXORB_FTDI_RANGE_011B_PID 0x011B
149#define MTXORB_FTDI_RANGE_011C_PID 0x011C
150#define MTXORB_FTDI_RANGE_011D_PID 0x011D
151#define MTXORB_FTDI_RANGE_011E_PID 0x011E
152#define MTXORB_FTDI_RANGE_011F_PID 0x011F
153#define MTXORB_FTDI_RANGE_0120_PID 0x0120
154#define MTXORB_FTDI_RANGE_0121_PID 0x0121
155#define MTXORB_FTDI_RANGE_0122_PID 0x0122
156#define MTXORB_FTDI_RANGE_0123_PID 0x0123
157#define MTXORB_FTDI_RANGE_0124_PID 0x0124
158#define MTXORB_FTDI_RANGE_0125_PID 0x0125
159#define MTXORB_FTDI_RANGE_0126_PID 0x0126
160#define MTXORB_FTDI_RANGE_0127_PID 0x0127
161#define MTXORB_FTDI_RANGE_0128_PID 0x0128
162#define MTXORB_FTDI_RANGE_0129_PID 0x0129
163#define MTXORB_FTDI_RANGE_012A_PID 0x012A
164#define MTXORB_FTDI_RANGE_012B_PID 0x012B
165#define MTXORB_FTDI_RANGE_012C_PID 0x012C
166#define MTXORB_FTDI_RANGE_012D_PID 0x012D
167#define MTXORB_FTDI_RANGE_012E_PID 0x012E
168#define MTXORB_FTDI_RANGE_012F_PID 0x012F
169#define MTXORB_FTDI_RANGE_0130_PID 0x0130
170#define MTXORB_FTDI_RANGE_0131_PID 0x0131
171#define MTXORB_FTDI_RANGE_0132_PID 0x0132
172#define MTXORB_FTDI_RANGE_0133_PID 0x0133
173#define MTXORB_FTDI_RANGE_0134_PID 0x0134
174#define MTXORB_FTDI_RANGE_0135_PID 0x0135
175#define MTXORB_FTDI_RANGE_0136_PID 0x0136
176#define MTXORB_FTDI_RANGE_0137_PID 0x0137
177#define MTXORB_FTDI_RANGE_0138_PID 0x0138
178#define MTXORB_FTDI_RANGE_0139_PID 0x0139
179#define MTXORB_FTDI_RANGE_013A_PID 0x013A
180#define MTXORB_FTDI_RANGE_013B_PID 0x013B
181#define MTXORB_FTDI_RANGE_013C_PID 0x013C
182#define MTXORB_FTDI_RANGE_013D_PID 0x013D
183#define MTXORB_FTDI_RANGE_013E_PID 0x013E
184#define MTXORB_FTDI_RANGE_013F_PID 0x013F
185#define MTXORB_FTDI_RANGE_0140_PID 0x0140
186#define MTXORB_FTDI_RANGE_0141_PID 0x0141
187#define MTXORB_FTDI_RANGE_0142_PID 0x0142
188#define MTXORB_FTDI_RANGE_0143_PID 0x0143
189#define MTXORB_FTDI_RANGE_0144_PID 0x0144
190#define MTXORB_FTDI_RANGE_0145_PID 0x0145
191#define MTXORB_FTDI_RANGE_0146_PID 0x0146
192#define MTXORB_FTDI_RANGE_0147_PID 0x0147
193#define MTXORB_FTDI_RANGE_0148_PID 0x0148
194#define MTXORB_FTDI_RANGE_0149_PID 0x0149
195#define MTXORB_FTDI_RANGE_014A_PID 0x014A
196#define MTXORB_FTDI_RANGE_014B_PID 0x014B
197#define MTXORB_FTDI_RANGE_014C_PID 0x014C
198#define MTXORB_FTDI_RANGE_014D_PID 0x014D
199#define MTXORB_FTDI_RANGE_014E_PID 0x014E
200#define MTXORB_FTDI_RANGE_014F_PID 0x014F
201#define MTXORB_FTDI_RANGE_0150_PID 0x0150
202#define MTXORB_FTDI_RANGE_0151_PID 0x0151
203#define MTXORB_FTDI_RANGE_0152_PID 0x0152
204#define MTXORB_FTDI_RANGE_0153_PID 0x0153
205#define MTXORB_FTDI_RANGE_0154_PID 0x0154
206#define MTXORB_FTDI_RANGE_0155_PID 0x0155
207#define MTXORB_FTDI_RANGE_0156_PID 0x0156
208#define MTXORB_FTDI_RANGE_0157_PID 0x0157
209#define MTXORB_FTDI_RANGE_0158_PID 0x0158
210#define MTXORB_FTDI_RANGE_0159_PID 0x0159
211#define MTXORB_FTDI_RANGE_015A_PID 0x015A
212#define MTXORB_FTDI_RANGE_015B_PID 0x015B
213#define MTXORB_FTDI_RANGE_015C_PID 0x015C
214#define MTXORB_FTDI_RANGE_015D_PID 0x015D
215#define MTXORB_FTDI_RANGE_015E_PID 0x015E
216#define MTXORB_FTDI_RANGE_015F_PID 0x015F
217#define MTXORB_FTDI_RANGE_0160_PID 0x0160
218#define MTXORB_FTDI_RANGE_0161_PID 0x0161
219#define MTXORB_FTDI_RANGE_0162_PID 0x0162
220#define MTXORB_FTDI_RANGE_0163_PID 0x0163
221#define MTXORB_FTDI_RANGE_0164_PID 0x0164
222#define MTXORB_FTDI_RANGE_0165_PID 0x0165
223#define MTXORB_FTDI_RANGE_0166_PID 0x0166
224#define MTXORB_FTDI_RANGE_0167_PID 0x0167
225#define MTXORB_FTDI_RANGE_0168_PID 0x0168
226#define MTXORB_FTDI_RANGE_0169_PID 0x0169
227#define MTXORB_FTDI_RANGE_016A_PID 0x016A
228#define MTXORB_FTDI_RANGE_016B_PID 0x016B
229#define MTXORB_FTDI_RANGE_016C_PID 0x016C
230#define MTXORB_FTDI_RANGE_016D_PID 0x016D
231#define MTXORB_FTDI_RANGE_016E_PID 0x016E
232#define MTXORB_FTDI_RANGE_016F_PID 0x016F
233#define MTXORB_FTDI_RANGE_0170_PID 0x0170
234#define MTXORB_FTDI_RANGE_0171_PID 0x0171
235#define MTXORB_FTDI_RANGE_0172_PID 0x0172
236#define MTXORB_FTDI_RANGE_0173_PID 0x0173
237#define MTXORB_FTDI_RANGE_0174_PID 0x0174
238#define MTXORB_FTDI_RANGE_0175_PID 0x0175
239#define MTXORB_FTDI_RANGE_0176_PID 0x0176
240#define MTXORB_FTDI_RANGE_0177_PID 0x0177
241#define MTXORB_FTDI_RANGE_0178_PID 0x0178
242#define MTXORB_FTDI_RANGE_0179_PID 0x0179
243#define MTXORB_FTDI_RANGE_017A_PID 0x017A
244#define MTXORB_FTDI_RANGE_017B_PID 0x017B
245#define MTXORB_FTDI_RANGE_017C_PID 0x017C
246#define MTXORB_FTDI_RANGE_017D_PID 0x017D
247#define MTXORB_FTDI_RANGE_017E_PID 0x017E
248#define MTXORB_FTDI_RANGE_017F_PID 0x017F
249#define MTXORB_FTDI_RANGE_0180_PID 0x0180
250#define MTXORB_FTDI_RANGE_0181_PID 0x0181
251#define MTXORB_FTDI_RANGE_0182_PID 0x0182
252#define MTXORB_FTDI_RANGE_0183_PID 0x0183
253#define MTXORB_FTDI_RANGE_0184_PID 0x0184
254#define MTXORB_FTDI_RANGE_0185_PID 0x0185
255#define MTXORB_FTDI_RANGE_0186_PID 0x0186
256#define MTXORB_FTDI_RANGE_0187_PID 0x0187
257#define MTXORB_FTDI_RANGE_0188_PID 0x0188
258#define MTXORB_FTDI_RANGE_0189_PID 0x0189
259#define MTXORB_FTDI_RANGE_018A_PID 0x018A
260#define MTXORB_FTDI_RANGE_018B_PID 0x018B
261#define MTXORB_FTDI_RANGE_018C_PID 0x018C
262#define MTXORB_FTDI_RANGE_018D_PID 0x018D
263#define MTXORB_FTDI_RANGE_018E_PID 0x018E
264#define MTXORB_FTDI_RANGE_018F_PID 0x018F
265#define MTXORB_FTDI_RANGE_0190_PID 0x0190
266#define MTXORB_FTDI_RANGE_0191_PID 0x0191
267#define MTXORB_FTDI_RANGE_0192_PID 0x0192
268#define MTXORB_FTDI_RANGE_0193_PID 0x0193
269#define MTXORB_FTDI_RANGE_0194_PID 0x0194
270#define MTXORB_FTDI_RANGE_0195_PID 0x0195
271#define MTXORB_FTDI_RANGE_0196_PID 0x0196
272#define MTXORB_FTDI_RANGE_0197_PID 0x0197
273#define MTXORB_FTDI_RANGE_0198_PID 0x0198
274#define MTXORB_FTDI_RANGE_0199_PID 0x0199
275#define MTXORB_FTDI_RANGE_019A_PID 0x019A
276#define MTXORB_FTDI_RANGE_019B_PID 0x019B
277#define MTXORB_FTDI_RANGE_019C_PID 0x019C
278#define MTXORB_FTDI_RANGE_019D_PID 0x019D
279#define MTXORB_FTDI_RANGE_019E_PID 0x019E
280#define MTXORB_FTDI_RANGE_019F_PID 0x019F
281#define MTXORB_FTDI_RANGE_01A0_PID 0x01A0
282#define MTXORB_FTDI_RANGE_01A1_PID 0x01A1
283#define MTXORB_FTDI_RANGE_01A2_PID 0x01A2
284#define MTXORB_FTDI_RANGE_01A3_PID 0x01A3
285#define MTXORB_FTDI_RANGE_01A4_PID 0x01A4
286#define MTXORB_FTDI_RANGE_01A5_PID 0x01A5
287#define MTXORB_FTDI_RANGE_01A6_PID 0x01A6
288#define MTXORB_FTDI_RANGE_01A7_PID 0x01A7
289#define MTXORB_FTDI_RANGE_01A8_PID 0x01A8
290#define MTXORB_FTDI_RANGE_01A9_PID 0x01A9
291#define MTXORB_FTDI_RANGE_01AA_PID 0x01AA
292#define MTXORB_FTDI_RANGE_01AB_PID 0x01AB
293#define MTXORB_FTDI_RANGE_01AC_PID 0x01AC
294#define MTXORB_FTDI_RANGE_01AD_PID 0x01AD
295#define MTXORB_FTDI_RANGE_01AE_PID 0x01AE
296#define MTXORB_FTDI_RANGE_01AF_PID 0x01AF
297#define MTXORB_FTDI_RANGE_01B0_PID 0x01B0
298#define MTXORB_FTDI_RANGE_01B1_PID 0x01B1
299#define MTXORB_FTDI_RANGE_01B2_PID 0x01B2
300#define MTXORB_FTDI_RANGE_01B3_PID 0x01B3
301#define MTXORB_FTDI_RANGE_01B4_PID 0x01B4
302#define MTXORB_FTDI_RANGE_01B5_PID 0x01B5
303#define MTXORB_FTDI_RANGE_01B6_PID 0x01B6
304#define MTXORB_FTDI_RANGE_01B7_PID 0x01B7
305#define MTXORB_FTDI_RANGE_01B8_PID 0x01B8
306#define MTXORB_FTDI_RANGE_01B9_PID 0x01B9
307#define MTXORB_FTDI_RANGE_01BA_PID 0x01BA
308#define MTXORB_FTDI_RANGE_01BB_PID 0x01BB
309#define MTXORB_FTDI_RANGE_01BC_PID 0x01BC
310#define MTXORB_FTDI_RANGE_01BD_PID 0x01BD
311#define MTXORB_FTDI_RANGE_01BE_PID 0x01BE
312#define MTXORB_FTDI_RANGE_01BF_PID 0x01BF
313#define MTXORB_FTDI_RANGE_01C0_PID 0x01C0
314#define MTXORB_FTDI_RANGE_01C1_PID 0x01C1
315#define MTXORB_FTDI_RANGE_01C2_PID 0x01C2
316#define MTXORB_FTDI_RANGE_01C3_PID 0x01C3
317#define MTXORB_FTDI_RANGE_01C4_PID 0x01C4
318#define MTXORB_FTDI_RANGE_01C5_PID 0x01C5
319#define MTXORB_FTDI_RANGE_01C6_PID 0x01C6
320#define MTXORB_FTDI_RANGE_01C7_PID 0x01C7
321#define MTXORB_FTDI_RANGE_01C8_PID 0x01C8
322#define MTXORB_FTDI_RANGE_01C9_PID 0x01C9
323#define MTXORB_FTDI_RANGE_01CA_PID 0x01CA
324#define MTXORB_FTDI_RANGE_01CB_PID 0x01CB
325#define MTXORB_FTDI_RANGE_01CC_PID 0x01CC
326#define MTXORB_FTDI_RANGE_01CD_PID 0x01CD
327#define MTXORB_FTDI_RANGE_01CE_PID 0x01CE
328#define MTXORB_FTDI_RANGE_01CF_PID 0x01CF
329#define MTXORB_FTDI_RANGE_01D0_PID 0x01D0
330#define MTXORB_FTDI_RANGE_01D1_PID 0x01D1
331#define MTXORB_FTDI_RANGE_01D2_PID 0x01D2
332#define MTXORB_FTDI_RANGE_01D3_PID 0x01D3
333#define MTXORB_FTDI_RANGE_01D4_PID 0x01D4
334#define MTXORB_FTDI_RANGE_01D5_PID 0x01D5
335#define MTXORB_FTDI_RANGE_01D6_PID 0x01D6
336#define MTXORB_FTDI_RANGE_01D7_PID 0x01D7
337#define MTXORB_FTDI_RANGE_01D8_PID 0x01D8
338#define MTXORB_FTDI_RANGE_01D9_PID 0x01D9
339#define MTXORB_FTDI_RANGE_01DA_PID 0x01DA
340#define MTXORB_FTDI_RANGE_01DB_PID 0x01DB
341#define MTXORB_FTDI_RANGE_01DC_PID 0x01DC
342#define MTXORB_FTDI_RANGE_01DD_PID 0x01DD
343#define MTXORB_FTDI_RANGE_01DE_PID 0x01DE
344#define MTXORB_FTDI_RANGE_01DF_PID 0x01DF
345#define MTXORB_FTDI_RANGE_01E0_PID 0x01E0
346#define MTXORB_FTDI_RANGE_01E1_PID 0x01E1
347#define MTXORB_FTDI_RANGE_01E2_PID 0x01E2
348#define MTXORB_FTDI_RANGE_01E3_PID 0x01E3
349#define MTXORB_FTDI_RANGE_01E4_PID 0x01E4
350#define MTXORB_FTDI_RANGE_01E5_PID 0x01E5
351#define MTXORB_FTDI_RANGE_01E6_PID 0x01E6
352#define MTXORB_FTDI_RANGE_01E7_PID 0x01E7
353#define MTXORB_FTDI_RANGE_01E8_PID 0x01E8
354#define MTXORB_FTDI_RANGE_01E9_PID 0x01E9
355#define MTXORB_FTDI_RANGE_01EA_PID 0x01EA
356#define MTXORB_FTDI_RANGE_01EB_PID 0x01EB
357#define MTXORB_FTDI_RANGE_01EC_PID 0x01EC
358#define MTXORB_FTDI_RANGE_01ED_PID 0x01ED
359#define MTXORB_FTDI_RANGE_01EE_PID 0x01EE
360#define MTXORB_FTDI_RANGE_01EF_PID 0x01EF
361#define MTXORB_FTDI_RANGE_01F0_PID 0x01F0
362#define MTXORB_FTDI_RANGE_01F1_PID 0x01F1
363#define MTXORB_FTDI_RANGE_01F2_PID 0x01F2
364#define MTXORB_FTDI_RANGE_01F3_PID 0x01F3
365#define MTXORB_FTDI_RANGE_01F4_PID 0x01F4
366#define MTXORB_FTDI_RANGE_01F5_PID 0x01F5
367#define MTXORB_FTDI_RANGE_01F6_PID 0x01F6
368#define MTXORB_FTDI_RANGE_01F7_PID 0x01F7
369#define MTXORB_FTDI_RANGE_01F8_PID 0x01F8
370#define MTXORB_FTDI_RANGE_01F9_PID 0x01F9
371#define MTXORB_FTDI_RANGE_01FA_PID 0x01FA
372#define MTXORB_FTDI_RANGE_01FB_PID 0x01FB
373#define MTXORB_FTDI_RANGE_01FC_PID 0x01FC
374#define MTXORB_FTDI_RANGE_01FD_PID 0x01FD
375#define MTXORB_FTDI_RANGE_01FE_PID 0x01FE
376#define MTXORB_FTDI_RANGE_01FF_PID 0x01FF
377
378
122 379
123/* Interbiometrics USB I/O Board */ 380/* Interbiometrics USB I/O Board */
124/* Developed for Interbiometrics by Rudolf Gugler */ 381/* Developed for Interbiometrics by Rudolf Gugler */
@@ -592,6 +849,12 @@
592#define FIC_NEO1973_DEBUG_PID 0x5118 849#define FIC_NEO1973_DEBUG_PID 0x5118
593 850
594/* 851/*
852 * RATOC REX-USB60F
853 */
854#define RATOC_VENDOR_ID 0x0584
855#define RATOC_PRODUCT_ID_USB60F 0xb020
856
857/*
595 * BmRequestType: 1100 0000b 858 * BmRequestType: 1100 0000b
596 * bRequest: FTDI_E2_READ 859 * bRequest: FTDI_E2_READ
597 * wValue: 0 860 * wValue: 0
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c
new file mode 100644
index 000000000000..2e8e05462ef7
--- /dev/null
+++ b/drivers/usb/serial/moto_modem.c
@@ -0,0 +1,70 @@
1/*
2 * Motorola USB Phone driver
3 *
4 * Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * {sigh}
11 * Mororola should be using the CDC ACM USB spec, but instead
12 * they try to just "do their own thing"... This driver should handle a
13 * few phones in which a basic "dumb serial connection" is needed to be
14 * able to get a connection through to them.
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/tty.h>
20#include <linux/module.h>
21#include <linux/usb.h>
22#include <linux/usb/serial.h>
23
24static struct usb_device_id id_table [] = {
25 { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */
26 { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Mororola phone */
27 { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */
28 { },
29};
30MODULE_DEVICE_TABLE(usb, id_table);
31
32static struct usb_driver moto_driver = {
33 .name = "moto-modem",
34 .probe = usb_serial_probe,
35 .disconnect = usb_serial_disconnect,
36 .id_table = id_table,
37 .no_dynamic_id = 1,
38};
39
40static struct usb_serial_driver moto_device = {
41 .driver = {
42 .owner = THIS_MODULE,
43 .name = "moto-modem",
44 },
45 .id_table = id_table,
46 .num_ports = 1,
47};
48
49static int __init moto_init(void)
50{
51 int retval;
52
53 retval = usb_serial_register(&moto_device);
54 if (retval)
55 return retval;
56 retval = usb_register(&moto_driver);
57 if (retval)
58 usb_serial_deregister(&moto_device);
59 return retval;
60}
61
62static void __exit moto_exit(void)
63{
64 usb_deregister(&moto_driver);
65 usb_serial_deregister(&moto_device);
66}
67
68module_init(moto_init);
69module_exit(moto_exit);
70MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e4be2d442b1e..43cfde83a93b 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -154,8 +154,6 @@ static int option_send_setup(struct usb_serial_port *port);
154#define NOVATELWIRELESS_PRODUCT_MC727 0x4100 154#define NOVATELWIRELESS_PRODUCT_MC727 0x4100
155#define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 155#define NOVATELWIRELESS_PRODUCT_MC950D 0x4400
156 156
157#define NOVATELWIRELESS_PRODUCT_U727 0x5010
158
159/* FUTURE NOVATEL PRODUCTS */ 157/* FUTURE NOVATEL PRODUCTS */
160#define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000 158#define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000
161#define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000 159#define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000
@@ -184,6 +182,10 @@ static int option_send_setup(struct usb_serial_port *port);
184#define AXESSTEL_VENDOR_ID 0x1726 182#define AXESSTEL_VENDOR_ID 0x1726
185#define AXESSTEL_PRODUCT_MV110H 0x1000 183#define AXESSTEL_PRODUCT_MV110H 0x1000
186 184
185#define ONDA_VENDOR_ID 0x19d2
186#define ONDA_PRODUCT_MSA501HS 0x0001
187#define ONDA_PRODUCT_ET502HS 0x0002
188
187#define BANDRICH_VENDOR_ID 0x1A8D 189#define BANDRICH_VENDOR_ID 0x1A8D
188#define BANDRICH_PRODUCT_C100_1 0x1002 190#define BANDRICH_PRODUCT_C100_1 0x1002
189#define BANDRICH_PRODUCT_C100_2 0x1003 191#define BANDRICH_PRODUCT_C100_2 0x1003
@@ -195,6 +197,9 @@ static int option_send_setup(struct usb_serial_port *port);
195 197
196#define MAXON_VENDOR_ID 0x16d8 198#define MAXON_VENDOR_ID 0x16d8
197 199
200#define TELIT_VENDOR_ID 0x1bc7
201#define TELIT_PRODUCT_UC864E 0x1003
202
198static struct usb_device_id option_ids[] = { 203static struct usb_device_id option_ids[] = {
199 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 204 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
200 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 205 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -231,25 +236,25 @@ static struct usb_device_id option_ids[] = {
231 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) }, 236 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) },
232 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, 237 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) },
233 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, 238 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
234 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 239 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
235 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, 240 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
236 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, 241 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
237 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401) }, 242 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) },
238 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403) }, 243 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) },
239 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405) }, 244 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) },
240 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406) }, 245 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) },
241 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408) }, 246 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) },
242 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409) }, 247 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) },
243 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410) }, 248 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) },
244 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411) }, 249 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) },
245 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412) }, 250 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) },
246 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413) }, 251 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413, 0xff, 0xff, 0xff) },
247 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414) }, 252 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414, 0xff, 0xff, 0xff) },
248 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415) }, 253 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415, 0xff, 0xff, 0xff) },
249 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416) }, 254 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416, 0xff, 0xff, 0xff) },
250 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417) }, 255 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) },
251 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418) }, 256 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) },
252 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419) }, 257 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) },
253 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, 258 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
254 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ 259 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */
255 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ 260 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */
@@ -269,7 +274,6 @@ static struct usb_device_id option_ids[] = {
269 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */ 274 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */
270 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */ 275 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */
271 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ 276 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */
272 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel U727 */
273 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */ 277 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */
274 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */ 278 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */
275 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */ 279 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */
@@ -293,14 +297,18 @@ static struct usb_device_id option_ids[] = {
293 { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */ 297 { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
294 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */ 298 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
295 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */ 299 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
300 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
296 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 301 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
297 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 302 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
298 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, 303 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
304 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) },
305 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) },
299 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, 306 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) },
300 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, 307 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
301 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, 308 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
302 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ 309 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
303 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ 310 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
311 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
304 { } /* Terminating entry */ 312 { } /* Terminating entry */
305}; 313};
306MODULE_DEVICE_TABLE(usb, option_ids); 314MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index c605fb68f807..103195abd417 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -56,6 +56,7 @@ static struct usb_device_id id_table [] = {
56 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, 56 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) },
57 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, 57 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) },
58 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, 58 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) },
59 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
59 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 60 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
60 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, 61 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
61 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 62 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
@@ -66,7 +67,6 @@ static struct usb_device_id id_table [] = {
66 { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, 67 { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) },
67 { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, 68 { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
68 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, 69 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
69 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
70 { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, 70 { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
71 { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, 71 { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
72 { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, 72 { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 10cf872e5ecb..cff160abb130 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -14,6 +14,7 @@
14#define PL2303_PRODUCT_ID_PHAROS 0xaaa0 14#define PL2303_PRODUCT_ID_PHAROS 0xaaa0
15#define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 15#define PL2303_PRODUCT_ID_RSAQ3 0xaaa2
16#define PL2303_PRODUCT_ID_ALDIGA 0x0611 16#define PL2303_PRODUCT_ID_ALDIGA 0x0611
17#define PL2303_PRODUCT_ID_MMX 0x0612
17 18
18#define ATEN_VENDOR_ID 0x0557 19#define ATEN_VENDOR_ID 0x0557
19#define ATEN_VENDOR_ID2 0x0547 20#define ATEN_VENDOR_ID2 0x0547
@@ -36,7 +37,6 @@
36 37
37#define RATOC_VENDOR_ID 0x0584 38#define RATOC_VENDOR_ID 0x0584
38#define RATOC_PRODUCT_ID 0xb000 39#define RATOC_PRODUCT_ID 0xb000
39#define RATOC_PRODUCT_ID_USB60F 0xb020
40 40
41#define TRIPP_VENDOR_ID 0x2478 41#define TRIPP_VENDOR_ID 0x2478
42#define TRIPP_PRODUCT_ID 0x2008 42#define TRIPP_PRODUCT_ID 0x2008
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index a0ed889230aa..45fe3663fa7f 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -401,6 +401,14 @@ UNUSUAL_DEV( 0x04a5, 0x3010, 0x0100, 0x0100,
401 US_SC_DEVICE, US_PR_DEVICE, NULL, 401 US_SC_DEVICE, US_PR_DEVICE, NULL,
402 US_FL_IGNORE_RESIDUE ), 402 US_FL_IGNORE_RESIDUE ),
403 403
404#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
405UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999,
406 "Cypress",
407 "Cypress AT2LP",
408 US_SC_CYP_ATACB, US_PR_DEVICE, NULL,
409 0),
410#endif
411
404/* Reported by Simon Levitt <simon@whattf.com> 412/* Reported by Simon Levitt <simon@whattf.com>
405 * This entry needs Sub and Proto fields */ 413 * This entry needs Sub and Proto fields */
406UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100, 414UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100,
@@ -539,17 +547,6 @@ UNUSUAL_DEV( 0x04e6, 0x0101, 0x0200, 0x0200,
539 "CD-RW Device", 547 "CD-RW Device",
540 US_SC_8020, US_PR_CB, NULL, 0), 548 US_SC_8020, US_PR_CB, NULL, 0),
541 549
542/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
543 * Device uses standards-violating 32-byte Bulk Command Block Wrappers and
544 * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011.
545 */
546
547UNUSUAL_DEV( 0x04fc, 0x80c2, 0x0100, 0x0100,
548 "Kobian Mercury",
549 "Binocam DCB-132",
550 US_SC_DEVICE, US_PR_DEVICE, NULL,
551 US_FL_BULK32),
552
553#ifdef CONFIG_USB_STORAGE_USBAT 550#ifdef CONFIG_USB_STORAGE_USBAT
554UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999, 551UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999,
555 "Shuttle/SCM", 552 "Shuttle/SCM",
@@ -565,6 +562,16 @@ UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220,
565 US_SC_DEVICE, US_PR_DEVICE, NULL, 562 US_SC_DEVICE, US_PR_DEVICE, NULL,
566 US_FL_MAX_SECTORS_64), 563 US_FL_MAX_SECTORS_64),
567 564
565/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
566 * Device uses standards-violating 32-byte Bulk Command Block Wrappers and
567 * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011.
568 */
569UNUSUAL_DEV( 0x04fc, 0x80c2, 0x0100, 0x0100,
570 "Kobian Mercury",
571 "Binocam DCB-132",
572 US_SC_DEVICE, US_PR_DEVICE, NULL,
573 US_FL_BULK32),
574
568/* Reported by Bob Sass <rls@vectordb.com> -- only rev 1.33 tested */ 575/* Reported by Bob Sass <rls@vectordb.com> -- only rev 1.33 tested */
569UNUSUAL_DEV( 0x050d, 0x0115, 0x0133, 0x0133, 576UNUSUAL_DEV( 0x050d, 0x0115, 0x0133, 0x0133,
570 "Belkin", 577 "Belkin",
@@ -1304,6 +1311,16 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
1304 US_SC_DEVICE, US_PR_DEVICE, NULL, 1311 US_SC_DEVICE, US_PR_DEVICE, NULL,
1305 US_FL_IGNORE_DEVICE ), 1312 US_FL_IGNORE_DEVICE ),
1306 1313
1314/* Reported by F. Aben <f.aben@option.com>
1315 * This device (wrongly) has a vendor-specific device descriptor.
1316 * The entry is needed so usb-storage can bind to it's mass-storage
1317 * interface as an interface driver */
1318UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0000,
1319 "Option",
1320 "GI 0401 SD-Card",
1321 US_SC_DEVICE, US_PR_DEVICE, NULL,
1322 0 ),
1323
1307#ifdef CONFIG_USB_STORAGE_ISD200 1324#ifdef CONFIG_USB_STORAGE_ISD200
1308UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1325UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1309 "ATI", 1326 "ATI",
@@ -1361,13 +1378,6 @@ UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff,
1361 US_SC_DEVICE, US_PR_DEVICE, NULL, 1378 US_SC_DEVICE, US_PR_DEVICE, NULL,
1362 US_FL_FIX_INQUIRY), 1379 US_FL_FIX_INQUIRY),
1363 1380
1364/* Reported by Rohan Hart <rohan.hart17@gmail.com> */
1365UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010,
1366 "INTOVA",
1367 "Pixtreme",
1368 US_SC_DEVICE, US_PR_DEVICE, NULL,
1369 US_FL_FIX_CAPACITY ),
1370
1371/* 1381/*
1372 * Entry for Jenoptik JD 5200z3 1382 * Entry for Jenoptik JD 5200z3
1373 * 1383 *
@@ -1512,7 +1522,7 @@ UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000,
1512 "Sony Ericsson", 1522 "Sony Ericsson",
1513 "M600i", 1523 "M600i",
1514 US_SC_DEVICE, US_PR_DEVICE, NULL, 1524 US_SC_DEVICE, US_PR_DEVICE, NULL,
1515 US_FL_FIX_CAPACITY ), 1525 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
1516 1526
1517/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> 1527/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu>
1518 * Tested on hardware version 1.10. 1528 * Tested on hardware version 1.10.
@@ -1684,6 +1694,16 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
1684 US_SC_DEVICE, US_PR_DEVICE, NULL, 1694 US_SC_DEVICE, US_PR_DEVICE, NULL,
1685 US_FL_IGNORE_RESIDUE ), 1695 US_FL_IGNORE_RESIDUE ),
1686 1696
1697/* Reported by Mauro Andreolini <andreoli@weblab.ing.unimo.it>
1698 * This entry is needed to bypass the ZeroCD mechanism
1699 * and to properly load as a modem device.
1700 */
1701UNUSUAL_DEV( 0x19d2, 0x2000, 0x0000, 0x0000,
1702 "Onda ET502HS",
1703 "USB MMC Storage",
1704 US_SC_DEVICE, US_PR_DEVICE, NULL,
1705 US_FL_IGNORE_DEVICE),
1706
1687/* patch submitted by Davide Perini <perini.davide@dpsoftware.org> 1707/* patch submitted by Davide Perini <perini.davide@dpsoftware.org>
1688 * and Renato Perini <rperini@email.it> 1708 * and Renato Perini <rperini@email.it>
1689 */ 1709 */
@@ -1696,10 +1716,12 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
1696/* 1716/*
1697 * Patch by Pete Zaitcev <zaitcev@redhat.com> 1717 * Patch by Pete Zaitcev <zaitcev@redhat.com>
1698 * Report by Mark Patton. Red Hat bz#208928. 1718 * Report by Mark Patton. Red Hat bz#208928.
1719 * Added support for rev 0x0002 (Motorola ROKR W5)
1720 * by Javier Smaldone <javier@smaldone.com.ar>
1699 */ 1721 */
1700UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001, 1722UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002,
1701 "Motorola", 1723 "Motorola",
1702 "RAZR V3i", 1724 "RAZR V3i/ROKR W5",
1703 US_SC_DEVICE, US_PR_DEVICE, NULL, 1725 US_SC_DEVICE, US_PR_DEVICE, NULL,
1704 US_FL_FIX_CAPACITY), 1726 US_FL_FIX_CAPACITY),
1705 1727
@@ -1721,6 +1743,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1721 US_SC_DEVICE, US_PR_DEVICE, NULL, 1743 US_SC_DEVICE, US_PR_DEVICE, NULL,
1722 US_FL_GO_SLOW ), 1744 US_FL_GO_SLOW ),
1723 1745
1746/* Reported by Rohan Hart <rohan.hart17@gmail.com> */
1747UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010,
1748 "INTOVA",
1749 "Pixtreme",
1750 US_SC_DEVICE, US_PR_DEVICE, NULL,
1751 US_FL_FIX_CAPACITY ),
1752
1724/* 1753/*
1725 * David Härdeman <david@2gen.com> 1754 * David Härdeman <david@2gen.com>
1726 * The key makes the SCSI stack print confusing (but harmless) messages 1755 * The key makes the SCSI stack print confusing (but harmless) messages
@@ -1745,14 +1774,6 @@ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
1745 US_SC_DEVICE, US_PR_DEVICE, NULL, 1774 US_SC_DEVICE, US_PR_DEVICE, NULL,
1746 US_FL_CAPACITY_HEURISTICS), 1775 US_FL_CAPACITY_HEURISTICS),
1747 1776
1748#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
1749UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999,
1750 "Cypress",
1751 "Cypress AT2LP",
1752 US_SC_CYP_ATACB, US_PR_BULK, NULL,
1753 0),
1754#endif
1755
1756/* Control/Bulk transport for all SubClass values */ 1777/* Control/Bulk transport for all SubClass values */
1757USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR), 1778USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR),
1758USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR), 1779USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR),
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index bb1dadaa4a23..002b61b4f0f6 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -171,7 +171,6 @@ config FB_SYS_FOPS
171config FB_DEFERRED_IO 171config FB_DEFERRED_IO
172 bool 172 bool
173 depends on FB 173 depends on FB
174 default y
175 174
176config FB_METRONOME 175config FB_METRONOME
177 tristate 176 tristate
@@ -628,11 +627,9 @@ config FB_MAC
628 select FB_CFB_IMAGEBLIT 627 select FB_CFB_IMAGEBLIT
629 select FB_MACMODES 628 select FB_MACMODES
630 629
631# bool ' Apple DAFB display support' CONFIG_FB_DAFB
632config FB_HP300 630config FB_HP300
633 bool 631 bool
634 depends on (FB = y) && HP300 632 depends on (FB = y) && DIO
635 select FB_CFB_FILLRECT
636 select FB_CFB_IMAGEBLIT 633 select FB_CFB_IMAGEBLIT
637 default y 634 default y
638 635
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c
index e6492c1048bf..05a328c11a8b 100644
--- a/drivers/video/amifb.c
+++ b/drivers/video/amifb.c
@@ -2261,7 +2261,7 @@ int __init amifb_init(void)
2261 amifb_setup(option); 2261 amifb_setup(option);
2262#endif 2262#endif
2263 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) 2263 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO))
2264 return -ENXIO; 2264 return -ENODEV;
2265 2265
2266 /* 2266 /*
2267 * We request all registers starting from bplpt[0] 2267 * We request all registers starting from bplpt[0]
@@ -2333,7 +2333,7 @@ default_chipset:
2333 strcat(fb_info.fix.id, "Unknown"); 2333 strcat(fb_info.fix.id, "Unknown");
2334 goto default_chipset; 2334 goto default_chipset;
2335#else /* CONFIG_FB_AMIGA_OCS */ 2335#else /* CONFIG_FB_AMIGA_OCS */
2336 err = -ENXIO; 2336 err = -ENODEV;
2337 goto amifb_error; 2337 goto amifb_error;
2338#endif /* CONFIG_FB_AMIGA_OCS */ 2338#endif /* CONFIG_FB_AMIGA_OCS */
2339 break; 2339 break;
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 8ffdf3578768..b004036d4087 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -441,14 +441,15 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
441 441
442 value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock)); 442 value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock));
443 443
444 value = (value / 2) - 1; 444 if (value < 2) {
445 dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n", value);
446
447 if (value <= 0) {
448 dev_notice(info->device, "Bypassing pixel clock divider\n"); 445 dev_notice(info->device, "Bypassing pixel clock divider\n");
449 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS); 446 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
450 } else { 447 } else {
451 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, value << ATMEL_LCDC_CLKVAL_OFFSET); 448 value = (value / 2) - 1;
449 dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n",
450 value);
451 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1,
452 value << ATMEL_LCDC_CLKVAL_OFFSET);
452 info->var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1))); 453 info->var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1)));
453 dev_dbg(info->device, " updated pixclk: %lu KHz\n", 454 dev_dbg(info->device, " updated pixclk: %lu KHz\n",
454 PICOS2KHZ(info->var.pixclock)); 455 PICOS2KHZ(info->var.pixclock));
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index e4bcf5376a99..bd4ac0bafecb 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3356,7 +3356,7 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *i
3356 3356
3357 info->fix.mmio_start = raddr; 3357 info->fix.mmio_start = raddr;
3358 par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); 3358 par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
3359 if (par->ati_regbase == 0) 3359 if (par->ati_regbase == NULL)
3360 return -ENOMEM; 3360 return -ENOMEM;
3361 3361
3362 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; 3362 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00;
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 72cd0d2f14ec..400e9264e456 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2277,8 +2277,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
2277 do { 2277 do {
2278 rinfo->fb_base = ioremap (rinfo->fb_base_phys, 2278 rinfo->fb_base = ioremap (rinfo->fb_base_phys,
2279 rinfo->mapped_vram); 2279 rinfo->mapped_vram);
2280 } while ( rinfo->fb_base == 0 && 2280 } while (rinfo->fb_base == NULL &&
2281 ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) ); 2281 ((rinfo->mapped_vram /= 2) >= MIN_MAPPED_VRAM));
2282 2282
2283 if (rinfo->fb_base == NULL) { 2283 if (rinfo->fb_base == NULL) {
2284 printk (KERN_ERR "radeonfb (%s): cannot map FB\n", 2284 printk (KERN_ERR "radeonfb (%s): cannot map FB\n",
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 35ac9d956b3d..c14b2435d23e 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -2432,9 +2432,9 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
2432 info->screen_size = board_size; 2432 info->screen_size = board_size;
2433 cinfo->unmap = cirrusfb_pci_unmap; 2433 cinfo->unmap = cirrusfb_pci_unmap;
2434 2434
2435 printk(KERN_INFO " RAM (%lu kB) at 0xx%lx, ", 2435 printk(KERN_INFO "RAM (%lu kB) at 0x%lx, Cirrus "
2436 info->screen_size >> 10, board_addr); 2436 "Logic chipset on PCI bus\n",
2437 printk(KERN_INFO "Cirrus Logic chipset on PCI bus\n"); 2437 info->screen_size >> 10, board_addr);
2438 pci_set_drvdata(pdev, info); 2438 pci_set_drvdata(pdev, info);
2439 2439
2440 ret = cirrusfb_register(info); 2440 ret = cirrusfb_register(info);
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index ad31983b43eb..97aff8db10bf 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -1853,6 +1853,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1853 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1853 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1854 struct display *p = &fb_display[vc->vc_num]; 1854 struct display *p = &fb_display[vc->vc_num];
1855 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; 1855 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
1856 unsigned short saved_ec;
1857 int ret;
1856 1858
1857 if (fbcon_is_inactive(vc, info)) 1859 if (fbcon_is_inactive(vc, info))
1858 return -EINVAL; 1860 return -EINVAL;
@@ -1865,6 +1867,11 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1865 * whole screen (prevents flicker). 1867 * whole screen (prevents flicker).
1866 */ 1868 */
1867 1869
1870 saved_ec = vc->vc_video_erase_char;
1871 vc->vc_video_erase_char = vc->vc_scrl_erase_char;
1872
1873 ret = 0;
1874
1868 switch (dir) { 1875 switch (dir) {
1869 case SM_UP: 1876 case SM_UP:
1870 if (count > vc->vc_rows) /* Maximum realistic size */ 1877 if (count > vc->vc_rows) /* Maximum realistic size */
@@ -1883,7 +1890,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1883 (b - count)), 1890 (b - count)),
1884 vc->vc_scrl_erase_char, 1891 vc->vc_scrl_erase_char,
1885 vc->vc_size_row * count); 1892 vc->vc_size_row * count);
1886 return 1; 1893 ret = 1;
1887 break; 1894 break;
1888 1895
1889 case SCROLL_WRAP_MOVE: 1896 case SCROLL_WRAP_MOVE:
@@ -1955,7 +1962,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1955 (b - count)), 1962 (b - count)),
1956 vc->vc_scrl_erase_char, 1963 vc->vc_scrl_erase_char,
1957 vc->vc_size_row * count); 1964 vc->vc_size_row * count);
1958 return 1; 1965 ret = 1;
1966 break;
1959 } 1967 }
1960 break; 1968 break;
1961 1969
@@ -1974,7 +1982,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1974 t), 1982 t),
1975 vc->vc_scrl_erase_char, 1983 vc->vc_scrl_erase_char,
1976 vc->vc_size_row * count); 1984 vc->vc_size_row * count);
1977 return 1; 1985 ret = 1;
1978 break; 1986 break;
1979 1987
1980 case SCROLL_WRAP_MOVE: 1988 case SCROLL_WRAP_MOVE:
@@ -2044,10 +2052,13 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
2044 t), 2052 t),
2045 vc->vc_scrl_erase_char, 2053 vc->vc_scrl_erase_char,
2046 vc->vc_size_row * count); 2054 vc->vc_size_row * count);
2047 return 1; 2055 ret = 1;
2056 break;
2048 } 2057 }
2058 break;
2049 } 2059 }
2050 return 0; 2060 vc->vc_video_erase_char = saved_ec;
2061 return ret;
2051} 2062}
2052 2063
2053 2064
@@ -2264,9 +2275,7 @@ static int fbcon_switch(struct vc_data *vc)
2264 * in fb_set_var() 2275 * in fb_set_var()
2265 */ 2276 */
2266 info->var.activate = var.activate; 2277 info->var.activate = var.activate;
2267 var.yoffset = info->var.yoffset; 2278 var.vmode |= info->var.vmode & ~FB_VMODE_MASK;
2268 var.xoffset = info->var.xoffset;
2269 var.vmode = info->var.vmode;
2270 fb_set_var(info, &var); 2279 fb_set_var(info, &var);
2271 ops->var = info->var; 2280 ops->var = info->var;
2272 2281
@@ -2507,6 +2516,9 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2507 c = vc->vc_video_erase_char; 2516 c = vc->vc_video_erase_char;
2508 vc->vc_video_erase_char = 2517 vc->vc_video_erase_char =
2509 ((c & 0xfe00) >> 1) | (c & 0xff); 2518 ((c & 0xfe00) >> 1) | (c & 0xff);
2519 c = vc->vc_def_color;
2520 vc->vc_scrl_erase_char =
2521 ((c & 0xFE00) >> 1) | (c & 0xFF);
2510 vc->vc_attr >>= 1; 2522 vc->vc_attr >>= 1;
2511 } 2523 }
2512 } else if (!vc->vc_hi_font_mask && cnt == 512) { 2524 } else if (!vc->vc_hi_font_mask && cnt == 512) {
@@ -2537,9 +2549,14 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2537 if (vc->vc_can_do_color) { 2549 if (vc->vc_can_do_color) {
2538 vc->vc_video_erase_char = 2550 vc->vc_video_erase_char =
2539 ((c & 0xff00) << 1) | (c & 0xff); 2551 ((c & 0xff00) << 1) | (c & 0xff);
2552 c = vc->vc_def_color;
2553 vc->vc_scrl_erase_char =
2554 ((c & 0xFF00) << 1) | (c & 0xFF);
2540 vc->vc_attr <<= 1; 2555 vc->vc_attr <<= 1;
2541 } else 2556 } else {
2542 vc->vc_video_erase_char = c & ~0x100; 2557 vc->vc_video_erase_char = c & ~0x100;
2558 vc->vc_scrl_erase_char = c & ~0x100;
2559 }
2543 } 2560 }
2544 2561
2545 } 2562 }
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
index 35477177bef4..6ef800bdf482 100644
--- a/drivers/video/display/display-sysfs.c
+++ b/drivers/video/display/display-sysfs.c
@@ -26,6 +26,7 @@
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/idr.h> 27#include <linux/idr.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/kdev_t.h>
29 30
30static ssize_t display_show_name(struct device *dev, 31static ssize_t display_show_name(struct device *dev,
31 struct device_attribute *attr, char *buf) 32 struct device_attribute *attr, char *buf)
@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver,
152 mutex_unlock(&allocated_dsp_lock); 153 mutex_unlock(&allocated_dsp_lock);
153 154
154 if (!ret) { 155 if (!ret) {
155 new_dev->dev = device_create(display_class, parent, 0, 156 new_dev->dev = device_create_drvdata(display_class,
156 "display%d", new_dev->idx); 157 parent,
158 MKDEV(0,0),
159 new_dev,
160 "display%d",
161 new_dev->idx);
157 if (!IS_ERR(new_dev->dev)) { 162 if (!IS_ERR(new_dev->dev)) {
158 dev_set_drvdata(new_dev->dev, new_dev);
159 new_dev->parent = parent; 163 new_dev->parent = parent;
160 new_dev->driver = driver; 164 new_dev->driver = driver;
161 mutex_init(&new_dev->lock); 165 mutex_init(&new_dev->lock);
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c
index b083ea7e9c69..606da043f4b4 100644
--- a/drivers/video/dnfb.c
+++ b/drivers/video/dnfb.c
@@ -284,6 +284,9 @@ int __init dnfb_init(void)
284{ 284{
285 int ret; 285 int ret;
286 286
287 if (!MACH_IS_APOLLO)
288 return -ENODEV;
289
287 if (fb_get_options("dnfb", NULL)) 290 if (fb_get_options("dnfb", NULL))
288 return -ENODEV; 291 return -ENODEV;
289 292
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index b50bb03cb5ab..0a2785361ca3 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1320,7 +1320,7 @@ static void free_irq_local(int irq)
1320 * Power management hooks. Note that we won't be called from IRQ context, 1320 * Power management hooks. Note that we won't be called from IRQ context,
1321 * unlike the blank functions above, so we may sleep. 1321 * unlike the blank functions above, so we may sleep.
1322 */ 1322 */
1323static int fsl_diu_suspend(struct of_device *dev, pm_message_t state) 1323static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state)
1324{ 1324{
1325 struct fsl_diu_data *machine_data; 1325 struct fsl_diu_data *machine_data;
1326 1326
@@ -1330,7 +1330,7 @@ static int fsl_diu_suspend(struct of_device *dev, pm_message_t state)
1330 return 0; 1330 return 0;
1331} 1331}
1332 1332
1333static int fsl_diu_resume(struct of_device *dev) 1333static int fsl_diu_resume(struct of_device *ofdev)
1334{ 1334{
1335 struct fsl_diu_data *machine_data; 1335 struct fsl_diu_data *machine_data;
1336 1336
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c
index cd9d4cc26954..aaef9165ec9b 100644
--- a/drivers/video/geode/lxfb_ops.c
+++ b/drivers/video/geode/lxfb_ops.c
@@ -63,54 +63,32 @@ static const struct {
63 { 0x00014284, 19688 }, 63 { 0x00014284, 19688 },
64 { 0x00011104, 20400 }, 64 { 0x00011104, 20400 },
65 { 0x00016363, 23625 }, 65 { 0x00016363, 23625 },
66 { 0x00015303, 24380 },
67 { 0x000031AC, 24923 }, 66 { 0x000031AC, 24923 },
68 { 0x0000215D, 25175 }, 67 { 0x0000215D, 25175 },
69 { 0x00001087, 27000 }, 68 { 0x00001087, 27000 },
70 { 0x0000216C, 28322 }, 69 { 0x0000216C, 28322 },
71 { 0x0000218D, 28560 }, 70 { 0x0000218D, 28560 },
72 { 0x00010041, 29913 },
73 { 0x000010C9, 31200 }, 71 { 0x000010C9, 31200 },
74 { 0x00003147, 31500 }, 72 { 0x00003147, 31500 },
75 { 0x000141A1, 32400 },
76 { 0x000010A7, 33032 }, 73 { 0x000010A7, 33032 },
77 { 0x00012182, 33375 },
78 { 0x000141B1, 33750 },
79 { 0x00002159, 35112 }, 74 { 0x00002159, 35112 },
80 { 0x00004249, 35500 }, 75 { 0x00004249, 35500 },
81 { 0x00000057, 36000 }, 76 { 0x00000057, 36000 },
82 { 0x000141E1, 37125 },
83 { 0x0000219A, 37889 }, 77 { 0x0000219A, 37889 },
84 { 0x00002158, 39168 }, 78 { 0x00002158, 39168 },
85 { 0x00000045, 40000 }, 79 { 0x00000045, 40000 },
86 { 0x000131A1, 40500 },
87 { 0x00010061, 42301 },
88 { 0x00000089, 43163 }, 80 { 0x00000089, 43163 },
89 { 0x00012151, 43875 },
90 { 0x000010E7, 44900 }, 81 { 0x000010E7, 44900 },
91 { 0x00002136, 45720 }, 82 { 0x00002136, 45720 },
92 { 0x000152E1, 47250 },
93 { 0x00010071, 48000 },
94 { 0x00003207, 49500 }, 83 { 0x00003207, 49500 },
95 { 0x00002187, 50000 }, 84 { 0x00002187, 50000 },
96 { 0x00014291, 50625 },
97 { 0x00011101, 51188 },
98 { 0x00017481, 54563 },
99 { 0x00004286, 56250 }, 85 { 0x00004286, 56250 },
100 { 0x00014170, 57375 },
101 { 0x00016210, 58500 },
102 { 0x000010E5, 60065 }, 86 { 0x000010E5, 60065 },
103 { 0x00013140, 62796 },
104 { 0x00004214, 65000 }, 87 { 0x00004214, 65000 },
105 { 0x00016250, 65250 },
106 { 0x00001105, 68179 }, 88 { 0x00001105, 68179 },
107 { 0x000141C0, 69600 },
108 { 0x00015220, 70160 },
109 { 0x00010050, 72000 },
110 { 0x000031E4, 74250 }, 89 { 0x000031E4, 74250 },
111 { 0x00003183, 75000 }, 90 { 0x00003183, 75000 },
112 { 0x00004284, 78750 }, 91 { 0x00004284, 78750 },
113 { 0x00012130, 80052 },
114 { 0x00001104, 81600 }, 92 { 0x00001104, 81600 },
115 { 0x00006363, 94500 }, 93 { 0x00006363, 94500 },
116 { 0x00005303, 97520 }, 94 { 0x00005303, 97520 },
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index fb9e67228543..c18880d9db1f 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -279,7 +279,7 @@ static void hga_blank(int blank_mode)
279 279
280static int __init hga_card_detect(void) 280static int __init hga_card_detect(void)
281{ 281{
282 int count=0; 282 int count = 0;
283 void __iomem *p, *q; 283 void __iomem *p, *q;
284 unsigned short p_save, q_save; 284 unsigned short p_save, q_save;
285 285
@@ -303,20 +303,18 @@ static int __init hga_card_detect(void)
303 writew(0x55aa, p); if (readw(p) == 0x55aa) count++; 303 writew(0x55aa, p); if (readw(p) == 0x55aa) count++;
304 writew(p_save, p); 304 writew(p_save, p);
305 305
306 if (count != 2) { 306 if (count != 2)
307 return 0; 307 goto error;
308 }
309 308
310 /* Ok, there is definitely a card registering at the correct 309 /* Ok, there is definitely a card registering at the correct
311 * memory location, so now we do an I/O port test. 310 * memory location, so now we do an I/O port test.
312 */ 311 */
313 312
314 if (!test_hga_b(0x66, 0x0f)) { /* cursor low register */ 313 if (!test_hga_b(0x66, 0x0f)) /* cursor low register */
315 return 0; 314 goto error;
316 } 315
317 if (!test_hga_b(0x99, 0x0f)) { /* cursor low register */ 316 if (!test_hga_b(0x99, 0x0f)) /* cursor low register */
318 return 0; 317 goto error;
319 }
320 318
321 /* See if the card is a Hercules, by checking whether the vsync 319 /* See if the card is a Hercules, by checking whether the vsync
322 * bit of the status register is changing. This test lasts for 320 * bit of the status register is changing. This test lasts for
@@ -331,7 +329,7 @@ static int __init hga_card_detect(void)
331 } 329 }
332 330
333 if (p_save == q_save) 331 if (p_save == q_save)
334 return 0; 332 goto error;
335 333
336 switch (inb_p(HGA_STATUS_PORT) & 0x70) { 334 switch (inb_p(HGA_STATUS_PORT) & 0x70) {
337 case 0x10: 335 case 0x10:
@@ -348,6 +346,12 @@ static int __init hga_card_detect(void)
348 break; 346 break;
349 } 347 }
350 return 1; 348 return 1;
349error:
350 if (release_io_ports)
351 release_region(0x3b0, 12);
352 if (release_io_port)
353 release_region(0x3bf, 1);
354 return 0;
351} 355}
352 356
353/** 357/**
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c
index 2eb4fb159084..b8ebff1e8493 100644
--- a/drivers/video/hpfb.c
+++ b/drivers/video/hpfb.c
@@ -382,7 +382,7 @@ int __init hpfb_init(void)
382#define INTFBPADDR 0x560000 382#define INTFBPADDR 0x560000
383 383
384 if (!MACH_IS_HP300) 384 if (!MACH_IS_HP300)
385 return -ENXIO; 385 return -ENODEV;
386 386
387 if (fb_get_options("hpfb", NULL)) 387 if (fb_get_options("hpfb", NULL))
388 return -ENODEV; 388 return -ENODEV;
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index 8bc46e930340..13fea61d6ae4 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -17,8 +17,8 @@
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/of_device.h> 19#include <linux/of_device.h>
20#include <linux/io.h>
20 21
21#include <asm/io.h>
22#include <asm/fbio.h> 22#include <asm/fbio.h>
23 23
24#include "sbuslib.h" 24#include "sbuslib.h"
@@ -33,7 +33,6 @@ static int leo_blank(int, struct fb_info *);
33 33
34static int leo_mmap(struct fb_info *, struct vm_area_struct *); 34static int leo_mmap(struct fb_info *, struct vm_area_struct *);
35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); 35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long);
36static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *);
37 36
38/* 37/*
39 * Frame buffer operations 38 * Frame buffer operations
@@ -43,7 +42,6 @@ static struct fb_ops leo_ops = {
43 .owner = THIS_MODULE, 42 .owner = THIS_MODULE,
44 .fb_setcolreg = leo_setcolreg, 43 .fb_setcolreg = leo_setcolreg,
45 .fb_blank = leo_blank, 44 .fb_blank = leo_blank,
46 .fb_pan_display = leo_pan_display,
47 .fb_fillrect = cfb_fillrect, 45 .fb_fillrect = cfb_fillrect,
48 .fb_copyarea = cfb_copyarea, 46 .fb_copyarea = cfb_copyarea,
49 .fb_imageblit = cfb_imageblit, 47 .fb_imageblit = cfb_imageblit,
@@ -78,7 +76,7 @@ static struct fb_ops leo_ops = {
78#define LEO_CUR_TYPE_CMAP 0x00000050 76#define LEO_CUR_TYPE_CMAP 0x00000050
79 77
80struct leo_cursor { 78struct leo_cursor {
81 u8 xxx0[16]; 79 u8 xxx0[16];
82 u32 cur_type; 80 u32 cur_type;
83 u32 cur_misc; 81 u32 cur_misc;
84 u32 cur_cursxy; 82 u32 cur_cursxy;
@@ -105,7 +103,7 @@ struct leo_lx_krn {
105 103
106struct leo_lc_ss0_krn { 104struct leo_lc_ss0_krn {
107 u32 misc; 105 u32 misc;
108 u8 xxx0[0x800-4]; 106 u8 xxx0[0x800-4];
109 u32 rev; 107 u32 rev;
110}; 108};
111 109
@@ -116,7 +114,7 @@ struct leo_lc_ss0_usr {
116 u32 fontt; 114 u32 fontt;
117 u32 extent; 115 u32 extent;
118 u32 src; 116 u32 src;
119 u32 dst; 117 u32 dst;
120 u32 copy; 118 u32 copy;
121 u32 fill; 119 u32 fill;
122}; 120};
@@ -129,8 +127,8 @@ struct leo_lc_ss1_usr {
129 u8 unknown; 127 u8 unknown;
130}; 128};
131 129
132struct leo_ld { 130struct leo_ld_ss0 {
133 u8 xxx0[0xe00]; 131 u8 xxx0[0xe00];
134 u32 csr; 132 u32 csr;
135 u32 wid; 133 u32 wid;
136 u32 wmask; 134 u32 wmask;
@@ -144,13 +142,13 @@ struct leo_ld {
144 u32 src; /* Copy/Scroll (SS0 only) */ 142 u32 src; /* Copy/Scroll (SS0 only) */
145 u32 dst; /* Copy/Scroll/Fill (SS0 only) */ 143 u32 dst; /* Copy/Scroll/Fill (SS0 only) */
146 u32 extent; /* Copy/Scroll/Fill size (SS0 only) */ 144 u32 extent; /* Copy/Scroll/Fill size (SS0 only) */
147 u32 xxx1[3]; 145 u32 xxx1[3];
148 u32 setsem; /* SS1 only */ 146 u32 setsem; /* SS1 only */
149 u32 clrsem; /* SS1 only */ 147 u32 clrsem; /* SS1 only */
150 u32 clrpick; /* SS1 only */ 148 u32 clrpick; /* SS1 only */
151 u32 clrdat; /* SS1 only */ 149 u32 clrdat; /* SS1 only */
152 u32 alpha; /* SS1 only */ 150 u32 alpha; /* SS1 only */
153 u8 xxx2[0x2c]; 151 u8 xxx2[0x2c];
154 u32 winbg; 152 u32 winbg;
155 u32 planemask; 153 u32 planemask;
156 u32 rop; 154 u32 rop;
@@ -199,11 +197,12 @@ struct leo_par {
199static void leo_wait(struct leo_lx_krn __iomem *lx_krn) 197static void leo_wait(struct leo_lx_krn __iomem *lx_krn)
200{ 198{
201 int i; 199 int i;
202 200
203 for (i = 0; 201 for (i = 0;
204 (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000; 202 (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) &&
203 i < 300000;
205 i++) 204 i++)
206 udelay (1); /* Busy wait at most 0.3 sec */ 205 udelay(1); /* Busy wait at most 0.3 sec */
207 return; 206 return;
208} 207}
209 208
@@ -221,7 +220,7 @@ static int leo_setcolreg(unsigned regno,
221 unsigned transp, struct fb_info *info) 220 unsigned transp, struct fb_info *info)
222{ 221{
223 struct leo_par *par = (struct leo_par *) info->par; 222 struct leo_par *par = (struct leo_par *) info->par;
224 struct leo_lx_krn __iomem *lx_krn = par->lx_krn; 223 struct leo_lx_krn __iomem *lx_krn = par->lx_krn;
225 unsigned long flags; 224 unsigned long flags;
226 u32 val; 225 u32 val;
227 int i; 226 int i;
@@ -408,7 +407,7 @@ static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl)
408 leo_wait(lx_krn); 407 leo_wait(lx_krn);
409 408
410 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { 409 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) {
411 switch(wi->wi_type) { 410 switch (wi->wi_type) {
412 case FB_WID_DBL_8: 411 case FB_WID_DBL_8:
413 j = (wi->wi_index & 0xf) + 0x40; 412 j = (wi->wi_index & 0xf) + 0x40;
414 break; 413 break;
@@ -453,13 +452,12 @@ static void leo_init_wids(struct fb_info *info)
453 wi.wi_index = 1; 452 wi.wi_index = 1;
454 wi.wi_values [0] = 0x30; 453 wi.wi_values [0] = 0x30;
455 leo_wid_put(info, &wl); 454 leo_wid_put(info, &wl);
456
457} 455}
458 456
459static void leo_switch_from_graph(struct fb_info *info) 457static void leo_switch_from_graph(struct fb_info *info)
460{ 458{
461 struct leo_par *par = (struct leo_par *) info->par; 459 struct leo_par *par = (struct leo_par *) info->par;
462 struct leo_ld __iomem *ss = (struct leo_ld __iomem *) par->ld_ss0; 460 struct leo_ld_ss0 __iomem *ss = par->ld_ss0;
463 unsigned long flags; 461 unsigned long flags;
464 u32 val; 462 u32 val;
465 463
@@ -485,19 +483,13 @@ static void leo_switch_from_graph(struct fb_info *info)
485 val = sbus_readl(&par->lc_ss0_usr->csr); 483 val = sbus_readl(&par->lc_ss0_usr->csr);
486 } while (val & 0x20000000); 484 } while (val & 0x20000000);
487 485
488 spin_unlock_irqrestore(&par->lock, flags); 486 /* setup screen buffer for cfb_* functions */
489} 487 sbus_writel(1, &ss->wid);
490 488 sbus_writel(0x00ffffff, &ss->planemask);
491static int leo_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) 489 sbus_writel(0x310b90, &ss->rop);
492{ 490 sbus_writel(0, &par->lc_ss0_usr->addrspace);
493 /* We just use this to catch switches out of
494 * graphics mode.
495 */
496 leo_switch_from_graph(info);
497 491
498 if (var->xoffset || var->yoffset || var->vmode) 492 spin_unlock_irqrestore(&par->lock, flags);
499 return -EINVAL;
500 return 0;
501} 493}
502 494
503static void leo_init_hw(struct fb_info *info) 495static void leo_init_hw(struct fb_info *info)
@@ -542,7 +534,8 @@ static void leo_unmap_regs(struct of_device *op, struct fb_info *info,
542 of_iounmap(&op->resource[0], info->screen_base, 0x800000); 534 of_iounmap(&op->resource[0], info->screen_base, 0x800000);
543} 535}
544 536
545static int __devinit leo_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit leo_probe(struct of_device *op,
538 const struct of_device_id *match)
546{ 539{
547 struct device_node *dp = op->node; 540 struct device_node *dp = op->node;
548 struct fb_info *info; 541 struct fb_info *info;
@@ -594,8 +587,9 @@ static int __devinit leo_probe(struct of_device *op, const struct of_device_id *
594 !info->screen_base) 587 !info->screen_base)
595 goto out_unmap_regs; 588 goto out_unmap_regs;
596 589
597 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; 590 info->flags = FBINFO_DEFAULT;
598 info->fbops = &leo_ops; 591 info->fbops = &leo_ops;
592 info->pseudo_palette = par->clut_data;
599 593
600 leo_init_wids(info); 594 leo_init_wids(info);
601 leo_init_hw(info); 595 leo_init_hw(info);
@@ -649,7 +643,7 @@ static int __devexit leo_remove(struct of_device *op)
649 643
650static struct of_device_id leo_match[] = { 644static struct of_device_id leo_match[] = {
651 { 645 {
652 .name = "leo", 646 .name = "SUNW,leo",
653 }, 647 },
654 {}, 648 {},
655}; 649};
diff --git a/drivers/video/logo/Kconfig b/drivers/video/logo/Kconfig
index 9de1c114f809..39ac49e0682c 100644
--- a/drivers/video/logo/Kconfig
+++ b/drivers/video/logo/Kconfig
@@ -27,6 +27,16 @@ config LOGO_LINUX_CLUT224
27 bool "Standard 224-color Linux logo" 27 bool "Standard 224-color Linux logo"
28 default y 28 default y
29 29
30config LOGO_BLACKFIN_VGA16
31 bool "16-colour Blackfin Processor Linux logo"
32 depends on BLACKFIN
33 default y
34
35config LOGO_BLACKFIN_CLUT224
36 bool "224-colour Blackfin Processor Linux logo"
37 depends on BLACKFIN
38 default y
39
30config LOGO_DEC_CLUT224 40config LOGO_DEC_CLUT224
31 bool "224-color Digital Equipment Corporation Linux logo" 41 bool "224-color Digital Equipment Corporation Linux logo"
32 depends on MACH_DECSTATION || ALPHA 42 depends on MACH_DECSTATION || ALPHA
diff --git a/drivers/video/logo/Makefile b/drivers/video/logo/Makefile
index a5fc4edf84e6..b91251d1fe41 100644
--- a/drivers/video/logo/Makefile
+++ b/drivers/video/logo/Makefile
@@ -4,6 +4,8 @@ obj-$(CONFIG_LOGO) += logo.o
4obj-$(CONFIG_LOGO_LINUX_MONO) += logo_linux_mono.o 4obj-$(CONFIG_LOGO_LINUX_MONO) += logo_linux_mono.o
5obj-$(CONFIG_LOGO_LINUX_VGA16) += logo_linux_vga16.o 5obj-$(CONFIG_LOGO_LINUX_VGA16) += logo_linux_vga16.o
6obj-$(CONFIG_LOGO_LINUX_CLUT224) += logo_linux_clut224.o 6obj-$(CONFIG_LOGO_LINUX_CLUT224) += logo_linux_clut224.o
7obj-$(CONFIG_LOGO_BLACKFIN_CLUT224) += logo_blackfin_clut224.o
8obj-$(CONFIG_LOGO_BLACKFIN_VGA16) += logo_blackfin_vga16.o
7obj-$(CONFIG_LOGO_DEC_CLUT224) += logo_dec_clut224.o 9obj-$(CONFIG_LOGO_DEC_CLUT224) += logo_dec_clut224.o
8obj-$(CONFIG_LOGO_MAC_CLUT224) += logo_mac_clut224.o 10obj-$(CONFIG_LOGO_MAC_CLUT224) += logo_mac_clut224.o
9obj-$(CONFIG_LOGO_PARISC_CLUT224) += logo_parisc_clut224.o 11obj-$(CONFIG_LOGO_PARISC_CLUT224) += logo_parisc_clut224.o
diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
index fc72684aae5a..2e85a2b52d05 100644
--- a/drivers/video/logo/logo.c
+++ b/drivers/video/logo/logo.c
@@ -24,6 +24,8 @@
24extern const struct linux_logo logo_linux_mono; 24extern const struct linux_logo logo_linux_mono;
25extern const struct linux_logo logo_linux_vga16; 25extern const struct linux_logo logo_linux_vga16;
26extern const struct linux_logo logo_linux_clut224; 26extern const struct linux_logo logo_linux_clut224;
27extern const struct linux_logo logo_blackfin_vga16;
28extern const struct linux_logo logo_blackfin_clut224;
27extern const struct linux_logo logo_dec_clut224; 29extern const struct linux_logo logo_dec_clut224;
28extern const struct linux_logo logo_mac_clut224; 30extern const struct linux_logo logo_mac_clut224;
29extern const struct linux_logo logo_parisc_clut224; 31extern const struct linux_logo logo_parisc_clut224;
@@ -65,6 +67,10 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
65 /* Generic Linux logo */ 67 /* Generic Linux logo */
66 logo = &logo_linux_vga16; 68 logo = &logo_linux_vga16;
67#endif 69#endif
70#ifdef CONFIG_LOGO_BLACKFIN_VGA16
71 /* Blackfin processor logo */
72 logo = &logo_blackfin_vga16;
73#endif
68#ifdef CONFIG_LOGO_SUPERH_VGA16 74#ifdef CONFIG_LOGO_SUPERH_VGA16
69 /* SuperH Linux logo */ 75 /* SuperH Linux logo */
70 logo = &logo_superh_vga16; 76 logo = &logo_superh_vga16;
@@ -76,6 +82,10 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
76 /* Generic Linux logo */ 82 /* Generic Linux logo */
77 logo = &logo_linux_clut224; 83 logo = &logo_linux_clut224;
78#endif 84#endif
85#ifdef CONFIG_LOGO_BLACKFIN_CLUT224
86 /* Blackfin Linux logo */
87 logo = &logo_blackfin_clut224;
88#endif
79#ifdef CONFIG_LOGO_DEC_CLUT224 89#ifdef CONFIG_LOGO_DEC_CLUT224
80 /* DEC Linux logo on MIPS/MIPS64 or ALPHA */ 90 /* DEC Linux logo on MIPS/MIPS64 or ALPHA */
81 logo = &logo_dec_clut224; 91 logo = &logo_dec_clut224;
diff --git a/drivers/video/logo/logo_blackfin_clut224.ppm b/drivers/video/logo/logo_blackfin_clut224.ppm
new file mode 100644
index 000000000000..dc9a50a14477
--- /dev/null
+++ b/drivers/video/logo/logo_blackfin_clut224.ppm
@@ -0,0 +1,1127 @@
1P3
2# This was generated by the GIMP & Netpbm tools
3# gimp linux_bf.svg (create 80x80 save as linux_bf.ppm)
4# pnmquant 224 linux_bf.ppm | pnmnoraw > logo_blackfin_clut224.ppm
5#
680 80
7255
80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
141 1 1 3 3 3 4 6 6 6 6 6 4 6 6 3 3 3
150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
210 0 0 0 0 0
220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
270 0 0 0 0 0 0 0 0 2 2 2 10 10 10 26 26 27
2844 44 45 66 66 66 78 81 81 78 81 81 75 75 76 60 60 60
2939 39 39 20 20 20 6 6 6 1 1 1 0 0 0 0 0 0
300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
350 0 0 0 0 0
360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
410 0 0 2 2 2 14 14 14 47 47 47 84 84 84 75 75 76
4247 47 47 12 12 12 0 0 0 0 0 0 0 0 0 20 20 20
4353 54 54 81 81 82 74 74 74 31 31 31 6 6 6 0 0 0
440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
490 0 0 0 0 0
500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
554 4 4 34 34 35 84 84 84 60 60 60 4 4 4 0 0 0
560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
570 0 0 0 0 0 17 18 18 75 75 76 66 66 66 17 18 18
581 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
630 0 0 0 0 0
640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3
6942 42 43 84 84 84 8 8 8 0 0 0 0 0 0 0 0 0
700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
710 3 3 36 40 40 10 16 16 0 0 0 31 31 31 84 84 84
7229 29 30 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0
730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
770 0 0 0 0 0
780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
820 0 0 0 0 0 0 0 0 0 0 0 1 1 1 26 27 27
8384 84 84 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0
840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8515 19 19 114 115 115 110 114 114 44 46 46 0 0 0 12 12 12
8690 87 86 24 24 24 1 1 1 0 0 0 0 0 0 0 0 0
870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
910 0 0 0 0 0
920 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
960 0 0 0 0 0 0 0 0 0 0 0 8 8 8 75 75 76
9714 14 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9930 40 40 133 133 133 129 130 130 78 85 85 23 31 30 0 0 0
10019 19 19 78 81 81 13 13 13 0 0 0 0 0 0 0 0 0
1010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1050 0 0 0 0 0
1060 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1100 0 0 0 0 0 0 0 0 0 0 0 26 27 27 81 81 82
1110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11336 40 40 89 90 91 55 63 63 23 31 30 4 6 6 0 0 0
1140 0 0 60 60 60 47 47 47 2 2 2 0 0 0 0 0 0
1150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1190 0 0 0 0 0
1200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1240 0 0 0 0 0 0 0 0 2 2 2 53 54 54 34 34 35
1250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1274 10 10 7 9 9 0 0 0 0 0 0 0 0 0 0 0 0
1280 0 0 1 1 1 84 84 84 13 13 13 0 0 0 0 0 0
1290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1330 0 0 0 0 0
1340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1380 0 0 0 0 0 0 0 0 4 6 6 78 81 81 2 2 2
1390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1420 0 0 0 0 0 65 64 64 36 36 36 0 0 0 0 0 0
1430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1470 0 0 0 0 0
1480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1520 0 0 0 0 0 0 0 0 10 11 11 81 81 82 0 0 0
1530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1560 0 0 0 0 0 12 12 12 67 70 70 4 4 4 0 0 0
1570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1610 0 0 0 0 0
1620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1660 0 0 0 0 0 0 0 0 16 16 16 81 81 82 0 0 0
1670 0 0 0 0 0 4 10 10 44 50 50 18 21 21 0 0 0
1680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1690 1 1 78 85 85 120 121 122 7 9 9 0 0 0 0 0 0
1700 0 0 0 0 0 0 0 0 82 82 81 12 12 12 0 0 0
1710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1750 0 0 0 0 0
1760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1800 0 0 0 0 0 0 0 0 19 19 19 81 81 82 0 0 0
1810 0 0 2 2 2 8 8 8 55 63 63 108 110 110 52 58 58
1820 0 0 0 0 0 0 0 0 0 0 0 42 42 43 129 130 130
183140 142 143 114 115 115 110 114 114 129 130 130 0 0 0 0 0 0
1840 0 0 0 0 0 0 0 0 75 75 76 24 24 24 0 0 0
1850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1890 0 0 0 0 0
1900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1910 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1920 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1940 0 0 0 0 0 0 0 0 19 19 19 74 74 74 0 0 0
1954 6 6 167 168 167 196 196 197 196 196 197 61 65 66 78 85 85
1960 0 0 0 0 0 0 0 0 118 118 118 202 202 203 219 219 219
197219 219 219 214 214 215 187 187 188 78 85 85 29 33 34 0 0 0
1980 0 0 0 0 0 0 0 0 60 60 60 39 39 39 0 0 0
1990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2030 0 0 0 0 0
2040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2060 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2080 0 0 0 0 0 0 0 0 19 19 19 72 71 71 0 0 0
209185 185 184 244 245 245 250 251 252 251 251 252 247 248 249 36 36 36
2100 0 0 0 0 0 13 13 13 243 243 241 252 252 252 253 253 253
211253 253 253 252 252 252 247 247 246 193 193 194 0 0 0 0 0 0
2120 0 0 0 0 0 0 0 0 42 42 43 50 51 51 1 1 1
2130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2170 0 0 0 0 0
2180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2220 0 0 0 0 0 0 0 0 19 19 19 78 81 81 0 0 0
223247 247 246 193 193 194 95 97 97 193 193 194 255 255 255 237 237 238
2240 0 0 0 0 0 202 202 203 255 255 255 247 247 246 108 107 107
22582 85 86 167 168 167 255 255 255 248 248 249 0 0 0 0 0 0
2260 0 0 0 0 0 0 0 0 34 34 35 56 56 56 2 2 2
2270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2310 0 0 0 0 0
2320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2360 0 0 0 0 0 0 0 0 19 19 19 78 81 81 0 0 0
237250 250 251 50 51 51 153 154 155 150 151 151 244 245 245 244 245 245
23844 50 50 84 89 89 153 154 155 255 255 255 140 142 143 0 0 0
239149 149 150 156 155 156 237 237 238 254 254 254 67 70 70 0 0 0
2400 0 0 0 0 0 0 0 0 39 39 39 47 47 47 1 1 1
2410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2450 0 0 0 0 0
2460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2500 0 0 0 0 0 0 0 0 19 19 19 81 81 82 0 0 0
251248 248 249 34 34 35 72 71 71 165 165 165 202 202 203 244 245 245
25210 16 16 82 85 86 89 90 91 255 255 255 95 97 97 0 0 0
2530 0 0 53 54 54 177 177 174 255 255 255 127 127 126 0 0 0
2540 0 0 0 0 0 0 0 0 39 39 39 36 36 36 0 0 0
2550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2590 0 0 0 0 0
2600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2640 0 0 0 0 0 0 0 0 14 14 14 78 81 81 0 0 0
265243 243 243 89 90 91 0 0 0 36 40 40 201 147 55 241 205 27
266241 205 27 241 205 27 241 205 27 238 192 33 108 110 110 0 0 0
2670 0 0 0 0 0 191 190 190 254 254 254 34 34 35 0 0 0
2680 0 0 0 0 0 0 0 0 42 42 43 42 42 43 0 0 0
2690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2730 0 0 0 0 0
2740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2780 0 0 0 0 0 0 0 0 10 10 10 75 75 76 0 0 0
279202 202 203 218 217 217 21 19 17 230 165 41 199 129 48 213 157 40
280244 212 23 243 206 27 180 121 62 243 206 27 244 209 25 226 179 40
28115 10 7 103 103 103 254 254 254 251 251 252 0 0 0 0 0 0
2820 0 0 0 0 0 0 0 0 17 18 18 58 58 58 2 2 2
2830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2870 0 0 0 0 0
2880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2910 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2920 0 0 0 0 0 0 0 0 9 9 9 84 84 84 0 0 0
2930 0 0 226 226 219 213 157 40 244 209 25 245 211 23 245 211 23
294245 214 38 245 214 38 245 211 23 245 211 23 245 211 23 244 212 23
295244 212 23 241 205 27 226 179 40 196 196 197 0 0 0 0 0 0
2960 0 0 0 0 0 0 0 0 0 0 0 74 74 74 4 6 6
2970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3010 0 0 0 0 0
3020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3060 0 0 0 0 0 0 0 0 7 7 7 84 84 84 0 0 0
30754 42 32 213 157 40 243 206 27 245 211 23 245 211 23 245 211 23
308245 215 41 245 214 35 245 211 23 245 211 23 245 214 35 245 215 41
309245 214 35 245 211 23 245 211 23 238 204 29 0 0 0 0 0 0
3100 0 0 0 0 0 0 0 0 0 0 0 81 81 82 12 12 12
3110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3150 0 0 0 0 0
3160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3200 0 0 0 0 0 0 0 0 4 6 6 74 74 74 0 0 0
321201 147 55 241 205 27 245 211 23 245 211 23 245 211 23 245 213 29
322245 214 38 245 211 23 245 211 23 245 214 35 245 215 41 245 215 41
323245 213 29 142 83 36 142 83 36 244 209 25 1 1 1 0 0 0
3240 0 0 0 0 0 0 0 0 0 0 0 74 74 74 25 25 26
3250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3290 0 0 0 0 0
3300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3340 0 0 0 0 0 0 0 0 4 4 4 72 71 71 6 6 6
335213 157 40 244 209 25 245 211 23 245 211 23 245 211 23 245 213 29
336244 212 23 245 211 23 245 214 35 245 215 41 245 215 41 245 213 29
337142 83 36 142 83 36 238 192 33 241 205 27 0 0 0 0 0 0
3380 0 0 0 0 0 0 0 0 0 0 0 44 44 44 49 50 50
3392 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3430 0 0 0 0 0
3440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3480 0 0 0 0 0 0 0 0 3 3 3 65 64 64 17 18 18
349199 129 48 199 129 48 245 211 23 245 211 23 245 211 23 245 211 23
350245 211 23 244 212 23 245 214 38 245 214 38 142 83 36 142 83 36
351142 83 36 245 211 23 244 210 23 230 165 41 0 0 0 0 0 0
35278 81 81 114 115 115 73 79 79 0 0 0 3 3 3 81 81 82
3539 9 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3570 0 0 0 0 0
3580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3620 0 0 0 0 0 0 0 0 1 1 1 49 50 50 29 29 30
36390 87 86 199 129 48 173 101 51 173 101 51 245 211 23 245 211 23
364245 211 23 230 165 41 142 83 36 142 83 36 142 83 36 245 211 23
365244 210 23 241 205 27 230 165 41 175 173 165 3 3 3 0 0 0
36644 46 46 118 118 118 118 118 118 108 110 110 0 0 0 75 75 76
36728 28 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3710 0 0 0 0 0
3720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3760 0 0 0 0 0 0 0 0 1 1 1 52 53 53 26 26 27
377118 118 118 175 173 165 199 129 48 173 101 51 173 101 51 173 101 51
378173 101 51 142 83 36 173 101 51 245 211 23 244 209 25 238 204 29
379213 157 40 214 196 166 227 227 227 214 214 215 120 121 122 0 0 0
3800 0 0 108 110 110 118 118 118 118 118 118 0 0 0 23 23 23
38166 66 66 4 6 6 0 0 0 0 0 0 0 0 0 0 0 0
3820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3850 0 0 0 0 0
3860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3900 0 0 0 0 0 0 0 0 7 7 7 75 75 76 4 4 4
391127 127 126 205 205 205 181 181 181 199 129 48 226 179 40 244 209 25
392244 209 25 244 209 25 243 206 27 238 192 33 213 157 40 187 166 103
393234 234 234 248 248 249 251 252 252 248 248 249 214 214 215 0 0 0
3940 0 0 0 0 0 103 103 103 100 103 103 0 0 0 0 0 0
39578 81 81 24 24 24 0 0 0 0 0 0 0 0 0 0 0 0
3960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3990 0 0 0 0 0
4000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4040 0 0 0 0 0 0 0 0 26 27 27 82 82 81 0 0 0
405146 146 147 234 234 234 222 221 221 178 178 179 180 121 62 213 157 40
406213 157 40 213 157 40 201 147 55 180 121 62 219 219 219 243 243 241
407253 253 253 255 255 255 255 255 255 255 255 255 250 250 251 120 121 122
4080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
40920 20 20 72 71 71 8 8 8 0 0 0 0 0 0 0 0 0
4100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4130 0 0 0 0 0
4140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4180 0 0 0 0 0 10 10 10 75 75 76 22 22 22 0 0 0
419205 205 205 253 253 253 247 248 249 212 211 212 178 178 179 161 161 162
420165 165 165 181 181 181 205 205 205 227 227 227 244 245 245 254 254 254
421255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 239 239 240
4220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4230 0 0 67 70 70 39 39 39 2 2 2 0 0 0 0 0 0
4240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4270 0 0 0 0 0
4280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4320 0 0 4 4 4 50 51 51 60 60 60 0 0 0 16 16 16
433249 250 251 255 255 255 255 255 255 240 240 240 209 210 210 193 193 194
434200 200 197 212 211 212 231 231 231 246 247 248 255 255 255 255 255 255
435255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 253 253 253
436153 154 155 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4370 0 0 3 3 3 84 84 84 20 20 20 0 0 0 0 0 0
4380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4410 0 0 0 0 0
4420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4462 2 2 33 33 34 81 81 82 0 0 0 0 0 0 231 231 231
447255 255 255 255 255 255 255 255 255 253 253 253 234 234 234 222 221 221
448227 227 227 237 237 238 250 250 251 255 255 255 255 255 255 255 255 255
449255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
450240 240 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4510 0 0 0 0 0 26 27 27 72 71 71 8 8 8 0 0 0
4520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4550 0 0 0 0 0
4560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
46021 21 22 84 84 84 7 7 7 0 0 0 150 151 151 252 252 252
461255 255 255 255 255 255 255 255 255 255 255 255 252 252 252 244 245 245
462246 247 248 253 253 253 255 255 255 255 255 255 255 255 255 255 255 255
463255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
464251 251 252 9 9 9 0 0 0 0 0 0 0 0 0 0 0 0
4650 0 0 0 0 0 0 0 0 65 64 64 47 47 47 3 3 3
4660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4690 0 0 0 0 0
4700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 12 12
47475 75 76 26 26 27 0 0 0 1 1 1 239 239 240 255 255 255
475255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
476255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
477255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
478255 255 255 202 202 203 0 0 0 0 0 0 0 0 0 0 0 0
4790 0 0 0 0 0 0 0 0 0 0 0 84 84 84 28 28 29
4801 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4830 0 0 0 0 0
4840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4870 0 0 0 0 0 0 0 0 0 0 0 4 4 4 55 55 55
48860 60 60 0 0 0 0 0 0 95 97 97 248 248 249 255 255 255
489255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
490255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
491255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
492255 255 255 244 245 245 0 0 0 0 0 0 0 0 0 0 0 0
4930 0 0 0 0 0 0 0 0 0 0 0 14 14 14 82 82 81
49415 15 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4970 0 0 0 0 0
4980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5010 0 0 0 0 0 0 0 0 1 1 1 29 29 30 84 84 84
5020 0 0 0 0 0 0 0 0 156 155 156 247 247 246 255 255 255
503255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
504255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
505255 255 255 255 255 255 247 247 246 240 240 240 232 232 233 232 232 233
506243 243 243 253 253 253 53 54 54 0 0 0 0 0 0 0 0 0
5070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 44 44
50860 60 60 6 6 6 0 0 0 0 0 0 0 0 0 0 0 0
5090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5110 0 0 0 0 0
5120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5150 0 0 0 0 0 0 0 0 10 10 10 81 81 82 14 14 14
5160 0 0 0 0 0 6 6 6 150 151 151 214 214 215 250 251 252
517255 255 255 255 255 255 255 255 255 246 247 248 218 217 217 214 214 215
518218 217 217 244 245 245 255 255 255 255 255 255 255 255 255 250 248 249
519232 232 233 214 214 215 196 196 197 182 183 184 181 181 181 181 181 181
520187 187 188 240 240 240 232 232 233 0 0 0 0 0 0 0 0 0
5210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
52278 81 81 34 34 35 1 1 1 0 0 0 0 0 0 0 0 0
5230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5250 0 0 0 0 0
5260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5290 0 0 0 0 0 1 1 1 39 39 39 74 74 74 0 0 0
5300 0 0 0 0 0 60 60 60 161 161 162 200 200 197 229 229 230
531251 251 252 255 255 255 255 255 255 255 255 255 243 243 241 214 214 215
532248 248 249 255 255 255 255 255 255 255 255 255 255 255 255 254 254 254
533239 239 240 214 214 215 193 193 194 182 183 184 178 178 179 176 177 177
534176 177 177 182 183 184 248 248 249 14 14 14 0 0 0 61 65 66
53510 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
53610 10 10 84 84 84 13 13 13 0 0 0 0 0 0 0 0 0
5370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5390 0 0 0 0 0
5400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5430 0 0 0 0 0 10 11 11 82 82 81 7 7 7 0 0 0
5440 0 0 0 0 0 165 165 165 229 229 230 249 250 251 254 254 254
545255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
546255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
547255 255 255 255 255 255 253 253 253 240 240 240 227 227 227 205 205 205
548181 181 181 176 177 177 191 190 190 227 227 227 0 0 0 44 50 50
54984 89 89 61 65 66 0 0 0 0 0 0 0 0 0 0 0 0
5500 0 0 58 58 58 49 50 50 3 3 3 0 0 0 0 0 0
5510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5530 0 0 0 0 0
5540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5570 0 0 1 1 1 36 36 36 66 66 66 0 0 0 29 33 34
5580 3 3 26 27 27 234 234 234 254 254 254 255 255 255 255 255 255
559255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
560254 254 254 253 253 254 252 253 253 253 253 254 253 254 254 253 254 254
561254 254 254 255 255 255 255 255 255 255 255 255 255 255 255 251 251 252
562227 227 227 187 187 188 176 177 177 222 221 221 13 13 13 0 0 0
56312 15 14 73 79 79 36 40 40 0 0 0 0 0 0 0 0 0
5640 0 0 1 1 1 90 87 86 17 18 18 0 0 0 0 0 0
5650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5670 0 0 0 0 0
5680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5710 0 0 7 7 7 78 81 81 12 12 12 23 31 30 52 58 58
5720 0 0 209 210 210 253 253 253 255 255 255 255 255 255 255 255 255
573255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 254 254
574251 251 252 150 151 151 103 103 103 129 130 130 196 196 197 250 250 251
575252 252 253 254 254 254 255 255 255 255 255 255 255 255 255 255 255 255
576255 255 255 240 240 240 193 193 194 196 196 197 229 229 230 0 0 0
5770 0 0 4 10 10 30 40 40 0 3 3 0 0 0 0 0 0
5780 0 0 0 0 0 47 47 47 53 54 54 3 3 3 0 0 0
5790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5810 0 0 0 0 0
5820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5850 0 0 23 23 23 81 81 82 0 0 0 52 58 58 36 40 40
58642 42 43 250 250 251 255 255 255 255 255 255 255 255 255 255 255 255
587255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 254 254
588227 227 227 7 7 7 7 7 7 7 7 7 7 7 7 44 44 45
589156 155 156 249 250 251 253 253 253 254 254 254 255 255 255 255 255 255
590255 255 255 255 255 255 247 247 246 222 221 221 239 239 240 0 0 0
59130 40 40 44 50 50 23 31 30 29 33 34 0 0 0 0 0 0
5920 0 0 0 0 0 0 0 0 90 87 86 16 16 16 0 0 0
5930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5950 0 0 0 0 0
5960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5992 2 2 50 51 51 42 42 43 29 33 34 52 58 58 0 0 0
600232 232 233 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
601255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 254 254
602250 251 252 44 44 44 7 7 7 7 7 7 7 7 7 7 7 7
6037 7 7 56 56 56 209 210 210 252 252 253 254 254 254 255 255 255
604255 255 255 255 255 255 255 255 255 254 253 253 249 250 251 146 146 147
60536 40 40 44 50 50 36 40 40 67 70 70 61 65 66 0 0 0
6060 0 0 0 0 0 0 0 0 55 55 55 44 44 45 1 1 1
6070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6090 0 0 0 0 0
6100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
61310 10 10 81 81 82 1 1 1 52 58 58 44 50 50 52 53 53
614251 251 252 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
615255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 254 254
616253 253 253 187 187 188 8 8 8 7 7 7 7 7 7 7 7 7
6177 7 7 7 7 7 19 19 19 178 178 179 252 252 253 254 254 254
618255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 237 237 238
61910 16 16 30 40 40 0 3 3 23 31 30 84 89 89 0 0 0
6200 0 0 0 0 0 0 0 0 3 3 3 81 81 82 9 9 9
6210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6230 0 0 0 0 0
6240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
62729 29 30 72 71 71 10 16 16 52 58 58 0 0 0 222 221 221
628255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
629255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
630254 254 254 251 251 252 95 97 97 7 7 7 7 7 7 7 7 7
6317 7 7 7 7 7 7 7 7 10 10 10 161 161 162 251 252 252
632254 254 254 255 255 255 255 255 255 255 255 255 255 255 255 248 248 249
6330 0 0 0 0 0 0 0 0 0 0 0 84 89 89 0 3 3
6340 0 0 0 0 0 0 0 0 0 0 0 74 74 74 26 27 27
6350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6370 0 0 0 0 0
6380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4
64165 64 64 20 20 20 20 25 25 30 40 40 0 0 0 247 247 246
642255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
643255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
644255 255 255 253 253 254 222 221 221 9 9 9 7 7 7 7 7 7
6457 7 7 7 7 7 7 7 7 7 7 7 8 8 8 149 149 150
646252 252 253 254 254 254 255 255 255 255 255 255 255 255 255 252 252 252
6470 0 0 0 0 0 0 0 0 0 0 0 73 79 79 12 15 14
6480 0 0 0 0 0 0 0 0 0 0 0 36 36 36 58 58 58
6493 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6510 0 0 0 0 0
6520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20 20 20
65574 74 74 0 0 0 4 10 10 4 10 10 36 36 36 252 252 252
656255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
657255 255 255 255 255 255 255 255 255 227 227 227 253 253 253 255 255 255
658255 255 255 254 254 254 250 251 252 65 64 64 7 7 7 7 7 7
6597 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8
660146 146 147 251 252 252 254 254 254 255 255 255 255 255 255 253 254 254
6610 0 0 0 0 0 0 0 0 0 0 0 52 58 58 10 16 16
6620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 82 82 81
6639 9 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6650 0 0 0 0 0
6660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6680 0 0 0 0 0 0 0 0 0 0 0 4 6 6 65 64 64
66925 25 25 0 3 3 30 40 40 0 0 0 187 187 188 254 254 254
670255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
671255 255 255 255 255 255 255 255 255 193 193 194 253 252 252 255 255 255
672255 255 255 255 255 255 252 253 253 129 130 130 7 7 7 7 7 7
6737 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
6748 8 8 149 149 150 252 252 253 254 254 254 255 255 255 254 254 254
67552 53 53 0 0 0 0 0 0 0 0 0 20 25 25 2 5 4
6760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 81 81 82
67720 20 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6790 0 0 0 0 0
6800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6820 0 0 0 0 0 0 0 0 0 0 0 26 26 27 81 81 82
6830 0 0 18 21 21 73 79 79 0 0 0 237 237 238 255 255 255
684255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
685255 255 255 255 255 255 255 255 255 182 183 184 255 255 255 255 255 255
686255 255 255 255 255 255 253 253 253 176 177 177 7 7 7 7 7 7
6877 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
6887 7 7 8 8 8 153 154 155 251 252 252 254 254 254 255 255 255
689150 151 151 0 0 0 0 0 0 0 0 0 20 25 25 0 0 0
6900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 65 64 64
69133 33 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6920 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6930 0 0 0 0 0
6940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6960 0 0 0 0 0 0 0 0 6 6 6 67 70 70 20 20 20
6970 0 0 23 31 30 82 85 86 0 0 0 247 247 246 255 255 255
698255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
699255 255 255 255 255 255 255 255 255 182 183 184 255 255 255 255 255 255
700255 255 255 255 255 255 253 254 254 214 214 215 7 7 7 7 7 7
7017 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
7027 7 7 7 7 7 8 8 8 156 155 156 252 252 253 254 254 254
703167 168 167 0 0 0 0 0 0 0 0 0 67 70 70 0 0 0
7040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 47 47
70544 44 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7060 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7070 0 0 0 0 0
7080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7100 0 0 0 0 0 0 0 0 21 21 22 75 75 76 0 0 0
7110 0 0 29 33 34 84 89 89 0 0 0 248 248 249 255 255 255
712255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
713255 255 255 255 255 255 248 248 249 181 181 181 255 255 255 255 255 255
714255 255 255 255 255 255 254 254 254 240 240 240 7 7 7 7 7 7
7157 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
7167 7 7 7 7 7 7 7 7 8 8 8 161 161 162 251 252 252
717185 185 184 4 4 4 0 0 0 10 11 11 100 103 103 0 0 0
7180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 36 36 36
71955 55 55 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0
7200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7210 0 0 0 0 0
7220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7240 0 0 0 0 0 0 0 0 33 33 34 50 51 51 0 0 0
7250 0 0 9 11 11 82 85 86 10 16 16 248 248 249 255 255 255
726255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
727255 255 255 255 255 255 245 244 245 179 180 181 255 255 255 255 255 255
728255 255 255 255 255 255 254 254 254 251 252 252 20 20 20 7 7 7
7297 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
7307 7 7 7 7 7 7 7 7 7 7 7 10 10 10 161 161 162
731205 205 205 17 18 18 0 0 0 95 97 97 78 81 81 0 0 0
7320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 36 36 36
73353 54 54 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
7340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7350 0 0 0 0 0
7360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7380 0 0 0 0 0 0 0 0 31 31 31 58 58 58 0 0 0
7390 0 0 0 0 0 67 70 70 78 81 81 248 248 249 255 255 255
740255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
741255 255 255 255 255 255 234 234 234 179 180 181 255 255 255 255 255 255
742255 255 255 255 255 255 254 254 254 251 252 252 23 23 23 7 7 7
7437 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
74410 11 11 84 84 84 161 161 162 209 210 210 229 229 230 237 237 238
745202 202 203 26 26 27 9 11 11 44 50 50 0 0 0 4 6 6
7460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 52 53 53
74739 39 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7490 0 0 0 0 0
7500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7520 0 0 0 0 0 0 0 0 23 23 23 78 81 81 213 157 40
753243 206 27 243 206 27 54 42 32 73 79 79 222 221 221 255 255 255
754255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
755255 255 255 255 255 255 238 238 236 178 178 179 255 255 255 255 255 255
756255 255 255 255 255 255 254 254 254 251 252 253 36 36 36 7 7 7
7577 7 7 7 7 7 7 7 7 7 7 7 7 7 7 84 84 84
758222 221 221 251 252 252 252 253 253 253 253 253 253 254 254 252 252 253
759146 146 147 140 142 143 156 155 156 110 114 114 26 27 27 82 85 86
76084 89 89 95 97 97 36 40 40 0 0 0 0 0 0 74 74 74
76123 23 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7630 0 0 0 0 0
7640 0 0 0 0 0 0 0 0 0 0 0 2 2 2 14 14 14
76524 24 24 26 26 27 26 26 27 26 26 27 25 25 26 21 21 22
7667 7 7 0 0 0 1 1 1 34 34 35 238 192 33 244 210 23
767244 212 23 244 212 23 244 210 23 88 79 47 200 200 197 254 254 254
768255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
769255 255 255 255 255 255 244 245 245 179 180 181 255 255 255 255 255 255
770255 255 255 255 255 255 254 254 254 252 252 253 36 36 36 7 7 7
7717 7 7 7 7 7 7 7 7 8 8 8 149 149 150 251 251 252
772252 252 253 253 253 253 253 253 253 250 248 249 239 223 156 239 223 156
773120 121 122 182 183 184 176 177 177 120 121 122 33 33 34 3 3 3
7740 0 0 67 70 70 146 146 147 20 25 25 1 1 1 82 82 81
7759 9 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7770 0 0 0 0 0
7780 0 0 0 0 0 0 0 0 0 0 0 19 19 19 89 90 91
779146 146 147 150 151 151 150 151 151 150 151 151 150 151 151 129 130 130
78058 58 58 6 6 6 14 14 14 201 147 55 245 211 23 245 213 29
781245 214 35 245 215 41 245 213 29 244 210 23 142 83 36 232 232 233
782254 254 254 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
783255 255 255 255 255 255 255 255 255 185 185 184 255 255 255 255 255 255
784255 255 255 255 255 255 254 254 254 251 252 252 50 51 51 7 7 7
7857 7 7 7 7 7 7 7 7 146 146 147 251 252 252 252 253 253
786251 252 253 239 239 240 171 168 154 129 130 130 137 136 134 175 173 165
787221 218 200 65 64 64 22 22 22 186 186 187 114 115 115 26 26 27
7882 2 2 0 0 0 61 65 66 31 33 27 238 192 33 108 96 91
7899 9 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7910 0 0 0 0 0
7920 0 0 0 0 0 0 0 0 2 2 2 52 53 53 178 178 179
79321 21 22 7 7 7 7 7 7 7 7 7 7 7 7 118 118 118
794137 136 134 36 36 36 65 64 64 243 206 27 244 212 23 245 215 41
795245 215 41 245 215 41 245 215 41 244 209 25 244 209 25 1 1 1
796219 219 219 253 253 253 255 255 255 255 255 255 255 255 255 255 255 255
797255 255 255 255 255 255 255 255 255 214 214 215 255 255 255 255 255 255
798255 255 255 255 255 255 254 254 254 252 252 253 50 51 51 7 7 7
7997 7 7 7 7 7 84 84 84 250 251 252 252 253 253 251 251 252
800167 168 167 22 22 22 7 7 7 7 7 7 7 7 7 7 7 7
8017 7 7 7 7 7 7 7 7 34 34 35 187 187 188 103 103 103
80229 29 30 3 3 3 7 9 9 238 204 29 245 215 41 245 214 35
80328 28 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8050 0 0 0 0 0
8060 0 0 0 0 0 0 0 0 7 7 7 90 87 86 178 178 179
8077 7 7 7 7 7 7 7 7 7 7 7 7 7 7 16 16 16
808193 193 194 133 133 133 187 166 103 245 218 76 245 218 76 245 216 51
809245 216 51 245 218 76 246 224 96 245 218 76 245 218 76 245 218 76
81025 25 25 186 186 187 252 252 252 254 254 254 254 254 254 253 254 254
811254 254 254 254 254 254 254 254 254 246 247 248 254 254 254 253 254 254
812254 254 254 254 254 254 253 254 254 251 252 252 36 36 36 7 7 7
8137 7 7 20 20 20 229 229 230 253 253 253 252 253 253 178 178 179
81410 10 10 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
8157 7 7 7 7 7 7 7 7 7 7 7 42 42 43 196 196 197
816118 118 118 33 33 34 238 204 29 245 215 41 245 215 41 245 215 41
81749 50 50 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
8180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8190 0 0 0 0 0
8200 0 0 0 0 0 0 0 0 17 18 18 120 121 122 137 136 134
8217 7 7 7 7 7 34 34 35 20 20 20 7 7 7 7 7 7
822202 202 203 209 206 202 193 187 162 193 187 162 248 234 156 245 218 76
823245 218 76 248 234 156 193 187 162 193 187 162 193 187 162 214 196 166
824240 219 129 95 97 97 196 196 197 186 186 187 187 187 188 196 196 197
825252 252 253 251 252 253 212 211 212 187 187 188 196 196 197 251 252 252
826218 217 217 187 187 188 191 190 190 250 251 252 24 24 24 7 7 7
8277 7 7 110 114 114 252 252 253 253 254 254 250 251 252 89 90 91
82889 90 91 129 130 130 127 127 126 44 44 44 7 7 7 7 7 7
8297 7 7 7 7 7 7 7 7 7 7 7 7 7 7 49 50 50
830202 202 203 214 196 166 245 216 51 245 214 38 245 214 35 245 214 38
83158 58 58 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0
8320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8330 0 0 0 0 0
8340 0 0 0 0 0 0 0 0 31 31 31 156 155 156 82 82 81
8357 7 7 10 10 10 237 237 238 66 66 66 7 7 7 25 25 25
836247 248 249 81 81 82 7 7 7 31 31 31 247 237 174 245 218 76
837246 226 108 200 200 197 7 7 7 7 7 7 7 7 7 137 136 134
838247 237 174 193 193 194 72 71 71 7 7 7 7 7 7 8 8 8
839196 196 197 250 251 252 67 70 70 7 7 7 84 84 84 244 245 245
84047 47 47 7 7 7 118 118 118 249 250 251 12 12 12 7 7 7
8419 9 9 218 217 217 253 253 253 254 254 254 252 253 253 251 251 252
842249 250 251 237 237 238 95 97 97 9 9 9 15 15 15 95 97 97
84347 47 47 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
84466 66 66 240 230 197 246 226 108 245 214 38 245 211 23 244 212 23
84565 64 64 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0
8460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8470 0 0 0 0 0
8480 0 0 0 0 0 2 2 2 52 53 53 185 185 184 25 25 25
8497 7 7 60 60 60 240 240 240 14 14 14 7 7 7 84 84 84
850247 248 249 23 23 23 7 7 7 94 91 88 248 234 156 245 218 76
851248 234 156 127 127 126 7 7 7 7 7 7 7 7 7 167 168 167
852251 248 240 65 64 64 7 7 7 7 7 7 7 7 7 7 7 7
85384 84 84 243 243 243 15 15 15 7 7 7 140 142 143 146 146 147
8547 7 7 33 33 34 237 237 238 243 243 243 21 21 22 120 121 122
855218 217 217 252 252 253 254 254 254 253 253 254 252 253 253 251 252 252
856247 248 249 72 71 71 7 7 7 58 58 58 222 221 221 248 248 249
85775 75 76 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
8587 7 7 82 82 81 246 239 193 246 226 108 245 216 51 245 214 38
859238 192 33 21 21 22 1 1 1 0 0 0 0 0 0 0 0 0
8600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8610 0 0 0 0 0
8620 0 0 0 0 0 8 8 8 90 87 86 182 183 184 7 7 7
8637 7 7 120 121 122 187 187 188 7 7 7 7 7 7 146 146 147
864205 205 205 7 7 7 7 7 7 153 153 148 240 219 129 246 224 96
865246 239 193 39 39 39 60 60 60 108 110 110 7 7 7 202 202 203
866227 227 227 7 7 7 7 7 7 205 205 205 89 90 91 7 7 7
867120 121 122 193 193 194 7 7 7 7 7 7 186 186 187 25 25 25
8687 7 7 167 168 167 251 251 252 243 243 243 214 214 215 250 251 252
869251 252 253 254 254 254 253 253 253 219 219 219 140 140 139 140 140 139
870118 118 118 7 7 7 52 53 53 237 237 238 247 247 246 176 177 177
8718 8 8 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
8727 7 7 7 7 7 95 97 97 246 239 193 246 226 108 245 216 51
873245 214 38 201 147 55 31 31 31 103 103 103 103 103 103 72 71 71
8740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8750 0 0 0 0 0
8760 0 0 0 0 0 17 18 18 127 127 126 140 140 139 7 7 7
8777 7 7 17 18 18 17 18 18 7 7 7 95 97 97 244 245 245
878146 146 147 7 7 7 7 7 7 200 200 197 246 226 108 240 219 129
879194 194 184 7 7 7 140 140 139 89 90 91 7 7 7 232 232 233
880165 165 165 7 7 7 31 31 31 249 250 251 39 39 39 7 7 7
881176 177 177 133 133 133 7 7 7 22 22 22 108 110 110 7 7 7
88272 71 71 251 252 252 252 253 253 250 251 252 247 248 249 205 205 205
883251 252 253 254 254 254 252 252 253 84 84 84 7 7 7 7 7 7
8847 7 7 7 7 7 140 142 143 247 248 249 140 140 139 14 14 14
8857 7 7 7 7 7 7 7 7 7 7 7 7 7 7 16 16 16
88614 14 14 7 7 7 7 7 7 114 115 115 246 239 193 246 224 96
887245 216 51 245 216 51 243 235 220 176 177 177 185 185 184 229 229 230
88847 47 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8890 0 0 0 0 0
8900 0 0 0 0 0 31 31 31 156 155 156 90 87 86 7 7 7
8917 7 7 7 7 7 7 7 7 31 31 31 243 243 241 247 247 246
89284 84 84 7 7 7 26 27 27 246 239 193 246 226 108 248 234 156
893108 110 110 7 7 7 212 211 212 44 44 44 22 22 22 249 250 251
894108 107 107 7 7 7 89 90 91 238 238 236 114 115 115 118 118 118
895231 231 231 75 75 76 7 7 7 34 34 35 10 11 11 12 12 12
896214 214 215 253 253 253 253 253 253 200 200 197 31 31 31 103 103 103
897252 252 253 252 253 253 218 217 217 9 9 9 7 7 7 7 7 7
8987 7 7 7 7 7 25 25 25 39 39 39 7 7 7 7 7 7
8997 7 7 7 7 7 7 7 7 7 7 7 103 103 103 234 234 234
900181 181 181 7 7 7 7 7 7 7 7 7 133 133 133 247 237 174
901246 224 96 246 226 108 185 185 184 177 177 174 153 154 155 181 181 181
902140 140 139 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9030 0 0 0 0 0
9040 0 0 1 1 1 49 50 50 186 186 187 28 28 28 7 7 7
90512 12 12 22 22 22 7 7 7 7 7 7 108 107 107 247 247 246
90625 25 25 7 7 7 90 87 86 247 237 174 246 226 108 246 239 193
90728 28 28 44 44 44 237 237 238 9 9 9 53 54 54 249 250 251
90849 50 50 7 7 7 153 153 148 249 241 199 214 196 166 185 185 184
909229 229 230 19 19 19 7 7 7 7 7 7 7 7 7 103 103 103
910251 252 253 254 254 254 253 253 253 150 151 151 7 7 7 187 187 188
911252 252 253 251 251 252 103 103 103 7 7 7 7 7 7 7 7 7
9127 7 7 23 23 23 17 18 18 7 7 7 7 7 7 7 7 7
9137 7 7 7 7 7 12 12 12 153 153 148 246 239 193 249 241 199
914161 161 162 9 9 9 84 84 84 108 110 110 25 25 25 153 153 148
915247 237 174 246 224 96 218 217 217 165 165 165 182 183 184 193 193 194
916114 115 115 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9170 0 0 0 0 0
9180 0 0 4 4 4 74 74 74 181 181 181 7 7 7 7 7 7
919110 114 114 200 200 197 7 7 7 7 7 7 60 60 60 209 210 210
9207 7 7 7 7 7 146 146 147 248 234 156 248 234 156 177 177 174
9217 7 7 118 118 118 193 193 194 7 7 7 84 84 84 232 232 233
9228 8 8 7 7 7 209 210 210 221 218 200 193 187 162 219 219 219
923200 200 197 7 7 7 7 7 7 7 7 7 7 7 7 95 97 97
924251 252 252 254 254 254 252 253 253 118 118 118 29 29 30 247 248 249
925252 252 253 227 227 227 16 16 16 7 7 7 7 7 7 7 7 7
926100 103 103 218 217 217 219 218 214 7 7 7 7 7 7 7 7 7
9277 7 7 21 21 22 185 185 184 246 239 193 248 234 156 240 230 197
92860 60 60 194 194 184 246 239 193 249 241 199 137 136 134 10 10 10
929171 168 154 248 234 156 248 234 156 226 226 219 209 210 210 249 241 199
93028 28 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9310 0 0 0 0 0
9320 0 0 13 13 13 108 110 110 146 146 147 7 7 7 7 7 7
933167 168 167 140 140 139 7 7 7 7 7 7 120 121 122 146 146 147
9347 7 7 7 7 7 194 194 184 240 219 129 247 237 174 95 97 97
9357 7 7 95 97 97 90 87 86 7 7 7 118 118 118 176 177 177
9367 7 7 28 28 28 248 248 249 44 44 45 7 7 7 167 168 167
937140 140 139 7 7 7 36 36 36 74 74 74 7 7 7 65 64 64
938251 252 253 254 254 254 251 252 252 81 81 82 108 110 110 251 252 252
939251 251 252 127 127 126 7 7 7 7 7 7 8 8 8 140 140 139
940181 181 181 140 140 139 221 218 200 7 7 7 7 7 7 7 7 7
94134 34 35 209 210 210 231 231 231 246 239 193 247 237 174 194 194 184
942227 227 227 249 241 199 240 219 129 248 234 156 153 153 148 7 7 7
94313 13 13 185 185 184 248 234 156 245 218 76 245 216 51 245 214 38
94431 31 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9450 0 0 0 0 0
9460 0 0 31 31 31 153 154 155 89 90 91 7 7 7 8 8 8
947232 232 233 82 82 81 7 7 7 7 7 7 179 180 181 89 90 91
9487 7 7 24 24 24 243 235 220 248 234 156 240 230 197 20 20 20
9497 7 7 7 7 7 7 7 7 7 7 7 149 149 150 118 118 118
9507 7 7 90 87 86 229 229 230 7 7 7 7 7 7 229 229 230
95182 82 81 7 7 7 95 97 97 100 103 103 7 7 7 34 34 35
952251 252 252 253 253 254 251 251 252 47 47 47 193 193 194 251 252 252
953239 239 240 23 23 23 7 7 7 13 13 13 165 165 165 234 234 234
954149 149 150 146 114 101 200 200 197 7 7 7 7 7 7 52 53 53
955227 227 227 167 168 167 16 16 16 214 196 166 248 234 156 243 235 220
956219 219 219 156 155 156 247 237 174 246 239 193 75 75 76 7 7 7
95760 60 60 227 227 227 243 235 220 240 219 129 245 218 76 245 213 29
95816 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9590 0 0 0 0 0
9601 1 1 49 50 50 185 185 184 33 33 34 7 7 7 10 11 11
96156 56 56 16 16 16 7 7 7 10 10 10 237 237 238 26 27 27
9627 7 7 55 55 55 185 185 184 221 218 200 167 168 167 7 7 7
96320 20 20 39 39 39 10 11 11 7 7 7 181 181 181 58 58 58
9647 7 7 103 103 103 133 133 133 7 7 7 44 44 44 247 248 249
96524 24 24 7 7 7 156 155 156 129 130 130 7 7 7 9 9 9
966244 245 245 252 253 253 237 237 238 34 34 35 248 248 249 251 251 252
967161 161 162 7 7 7 24 24 24 187 187 188 212 211 212 67 70 70
968187 187 188 173 170 143 209 206 202 10 10 10 95 97 97 237 237 238
969129 130 130 8 8 8 89 90 91 246 239 193 247 237 174 177 177 174
97017 18 18 137 136 134 249 241 199 219 218 214 10 10 10 95 97 97
971243 243 243 150 151 151 31 31 31 221 218 200 240 219 129 53 54 54
9723 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9730 0 0 0 0 0
9744 4 4 72 71 71 182 183 184 7 7 7 7 7 7 7 7 7
9757 7 7 7 7 7 12 12 12 161 161 162 209 210 210 7 7 7
9767 7 7 7 7 7 7 7 7 187 187 188 82 82 81 7 7 7
977146 146 147 247 248 249 17 18 18 7 7 7 212 211 212 47 47 47
9787 7 7 7 7 7 7 7 7 8 8 8 146 146 147 205 205 205
9797 7 7 7 7 7 214 214 215 156 155 156 7 7 7 7 7 7
980218 217 217 251 252 252 186 186 187 110 114 114 249 250 251 248 248 249
98175 75 76 34 34 35 205 205 205 129 130 130 16 16 16 7 7 7
982156 155 156 214 196 166 240 230 197 243 243 241 227 227 227 74 74 74
9837 7 7 29 29 30 226 226 219 249 241 199 175 173 165 14 14 14
9849 9 9 221 218 200 246 239 193 153 153 148 146 146 147 246 247 248
985110 114 114 7 7 7 7 7 7 42 42 43 193 193 194 95 97 97
98619 19 19 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
9870 0 0 0 0 0
9886 6 6 84 84 84 140 142 143 7 7 7 7 7 7 7 7 7
9897 7 7 20 20 20 177 177 174 249 241 199 149 149 150 7 7 7
9907 7 7 7 7 7 10 11 11 226 226 219 13 13 13 8 8 8
991219 218 214 219 218 214 7 7 7 8 8 8 238 238 236 200 200 197
99213 13 13 7 7 7 13 13 13 161 161 162 243 235 220 146 146 147
9937 7 7 29 29 30 232 232 233 176 177 177 7 7 7 7 7 7
994182 183 184 237 237 238 129 130 130 167 168 167 176 177 177 202 202 203
99510 11 11 95 97 97 44 44 45 7 7 7 7 7 7 7 7 7
99675 75 76 226 226 219 243 235 220 156 155 156 24 24 24 7 7 7
9977 7 7 176 177 177 247 247 246 200 200 197 17 18 18 7 7 7
99849 50 50 246 239 193 248 234 156 251 248 240 239 239 240 84 84 84
9997 7 7 7 7 7 7 7 7 7 7 7 60 60 60 187 187 188
100084 84 84 14 14 14 0 0 0 0 0 0 0 0 0 0 0 0
10010 0 0 0 0 0
10024 4 4 53 54 54 137 136 134 156 155 156 161 161 162 161 161 162
1003167 168 167 239 223 156 240 219 129 246 226 108 239 223 156 239 223 156
1004239 223 156 239 223 156 214 196 166 239 223 156 193 187 162 193 187 162
1005248 234 156 239 223 156 193 187 162 193 187 162 248 234 156 248 234 156
1006214 196 166 193 187 162 214 196 166 248 234 156 240 219 129 214 196 166
1007193 187 162 193 187 162 171 168 154 146 146 147 137 136 134 137 136 134
1008161 161 162 209 210 210 65 64 64 202 202 203 179 180 181 140 140 139
10097 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10107 7 7 60 60 60 39 39 39 7 7 7 7 7 7 7 7 7
101166 66 66 249 250 251 202 202 203 16 16 16 7 7 7 7 7 7
101223 23 23 243 235 220 246 239 193 226 226 219 52 53 53 7 7 7
10137 7 7 7 7 7 7 7 7 7 7 7 7 7 7 75 75 76
1014176 177 177 66 66 66 9 9 9 0 0 0 0 0 0 0 0 0
10150 0 0 0 0 0
10160 0 0 10 10 10 28 28 29 34 34 35 36 36 36 36 36 36
101744 44 45 146 114 101 241 207 50 241 207 50 241 207 50 241 211 63
1018241 211 63 241 211 63 241 211 63 241 211 63 241 211 63 245 216 51
1019245 216 51 245 216 51 241 211 63 241 211 63 245 216 51 241 211 63
1020245 218 76 245 218 76 245 216 51 245 215 41 245 214 38 241 207 50
1021241 211 63 201 147 55 88 79 47 29 29 30 34 34 35 42 42 43
1022103 103 103 191 190 190 75 75 76 196 196 197 200 200 197 65 64 64
10237 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10247 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
102590 87 86 146 146 147 19 19 19 7 7 7 7 7 7 7 7 7
10267 7 7 90 87 86 140 140 139 31 31 31 7 7 7 7 7 7
10277 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
1028103 103 103 161 161 162 53 54 54 7 7 7 0 0 0 0 0 0
10290 0 0 0 0 0
10300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10310 0 0 12 12 12 50 51 51 146 114 101 180 121 62 199 129 48
1032201 147 55 213 157 40 213 157 40 230 165 41 226 179 40 226 179 40
1033238 192 33 241 205 27 244 209 25 244 210 23 244 212 23 245 211 23
1034245 211 23 245 211 23 245 211 23 244 209 25 238 204 29 226 179 40
1035213 157 40 199 129 48 54 42 32 0 0 0 4 6 6 44 44 45
1036150 151 151 129 130 130 137 136 134 205 205 205 202 202 203 8 8 8
10377 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10387 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10397 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10407 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10417 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10427 7 7 129 130 130 146 146 147 47 47 47 4 4 4 0 0 0
10430 0 0 0 0 0
10440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10450 0 0 0 0 0 2 2 2 12 12 12 28 28 29 49 50 50
104674 74 74 108 96 91 180 121 62 180 121 62 199 129 48 201 147 55
1047213 157 40 230 165 41 226 179 40 238 192 33 241 205 27 241 205 27
1048243 206 27 243 206 27 241 205 27 238 204 29 226 179 40 213 157 40
1049199 129 48 199 129 48 21 19 17 65 64 64 103 103 103 167 168 167
1050202 202 203 24 24 24 193 193 194 229 229 230 140 140 139 7 7 7
10517 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10527 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10537 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10547 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10557 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10567 7 7 8 8 8 156 155 156 133 133 133 36 36 36 3 3 3
10570 0 0 0 0 0
10580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
10604 4 4 10 11 11 21 21 22 39 39 39 60 60 60 108 96 91
1061180 121 62 199 129 48 199 129 48 213 157 40 230 165 41 226 179 40
1062226 179 40 226 179 40 226 179 40 226 179 40 213 157 40 199 129 48
1063180 121 62 99 91 79 72 71 71 56 56 56 129 130 130 167 168 167
106421 21 22 17 18 18 231 231 231 229 229 230 52 53 53 7 7 7
10657 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10667 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10677 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10687 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10697 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10707 7 7 7 7 7 13 13 13 176 177 177 120 121 122 33 33 34
10712 2 2 0 0 0
10720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10740 0 0 0 0 0 0 0 0 0 0 0 2 2 2 8 8 8
107521 21 22 47 47 47 99 91 79 180 121 62 199 129 48 199 129 48
1076201 147 55 213 157 40 213 157 40 201 147 55 199 129 48 180 121 62
107799 91 79 26 26 27 9 9 9 60 60 60 186 186 187 31 31 31
10787 7 7 60 60 60 243 243 243 209 210 210 7 7 7 7 7 7
10797 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10807 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10817 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10827 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10837 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
10847 7 7 7 7 7 7 7 7 26 27 27 193 193 194 108 110 110
108522 22 22 0 0 0
10860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10890 0 0 1 1 1 8 8 8 24 24 24 58 58 58 108 96 91
1090180 121 62 180 121 62 180 121 62 180 121 62 180 121 62 72 71 71
109115 15 15 0 0 0 4 6 6 75 75 76 156 155 156 24 24 24
109224 24 24 108 107 107 232 232 233 137 136 134 24 24 24 24 24 24
109324 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24
109424 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24
109524 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24
109624 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24
109724 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24
109824 24 24 24 24 24 24 24 24 24 24 24 58 58 58 176 177 177
109960 60 60 3 3 3
11000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11030 0 0 0 0 0 0 0 0 0 0 0 2 2 2 12 12 12
110426 27 27 44 44 44 55 55 55 50 51 51 29 29 30 8 8 8
11050 0 0 0 0 0 3 3 3 47 47 47 127 127 126 150 151 151
1106150 151 151 140 142 143 129 130 130 140 142 143 150 151 151 150 151 151
1107150 151 151 150 151 151 150 151 151 150 151 151 150 151 151 150 151 151
1108150 151 151 150 151 151 153 154 155 161 161 162 165 165 165 167 168 167
1109177 177 174 167 168 167 161 161 162 156 155 156 150 151 151 150 151 151
1110150 151 151 150 151 151 150 151 151 150 151 151 150 151 151 150 151 151
1111150 151 151 150 151 151 150 151 151 150 151 151 150 151 151 150 151 151
1112150 151 151 150 151 151 150 151 151 150 151 151 149 149 150 127 127 126
111344 44 45 2 2 2
11140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11180 0 0 0 0 0 2 2 2 1 1 1 0 0 0 0 0 0
11190 0 0 0 0 0 0 0 0 7 7 7 21 21 22 25 25 26
112025 25 26 24 24 24 20 20 20 23 23 24 25 25 26 26 26 27
112126 26 27 26 26 27 26 26 27 26 26 27 26 26 27 26 26 27
112226 26 27 26 26 27 26 26 27 26 26 27 26 26 27 26 27 27
112328 28 29 26 27 27 26 26 27 26 26 27 26 26 27 26 26 27
112426 26 27 26 26 27 26 26 27 26 26 27 26 26 27 26 26 27
112526 26 27 26 26 27 26 26 27 26 26 27 26 26 27 26 26 27
112626 26 27 26 26 27 26 26 27 26 26 27 25 25 26 21 21 22
11277 7 7 0 0 0
diff --git a/drivers/video/logo/logo_blackfin_vga16.ppm b/drivers/video/logo/logo_blackfin_vga16.ppm
new file mode 100644
index 000000000000..1352b02a9d93
--- /dev/null
+++ b/drivers/video/logo/logo_blackfin_vga16.ppm
@@ -0,0 +1,1127 @@
1P3
2# This was generated by the GIMP & Netpbm tools
3# gimp linux_bf.svg (create 80x80 save as linux_bf.ppm)
4# ppmquant -mapfile clut_vga16.ppm linux_bf.ppm | pnmnoraw > logo_blackfin_vga16.ppm
5#
680 80
7255
80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
210 0 0 0 0 0
220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2885 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85
290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
350 0 0 0 0 0
360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
410 0 0 0 0 0 0 0 0 85 85 85 85 85 85 85 85 85
4285 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4385 85 85 85 85 85 85 85 85 0 0 0 0 0 0 0 0 0
440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
490 0 0 0 0 0
500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
550 0 0 0 0 0 85 85 85 85 85 85 0 0 0 0 0 0
560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
570 0 0 0 0 0 0 0 0 85 85 85 85 85 85 0 0 0
580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
630 0 0 0 0 0
640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
690 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
770 0 0 0 0 0
780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8385 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
850 0 0 85 85 85 85 85 85 85 85 85 0 0 0 0 0 0
8685 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
910 0 0 0 0 0
920 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
990 0 0 170 170 170 170 170 170 85 85 85 0 0 0 0 0 0
1000 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
1010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1050 0 0 0 0 0
1060 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
1110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1130 0 0 85 85 85 85 85 85 0 0 0 0 0 0 0 0 0
1140 0 0 85 85 85 85 85 85 0 0 0 0 0 0 0 0 0
1150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1190 0 0 0 0 0
1200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1240 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
1250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1280 0 0 0 0 0 85 85 85 0 0 0 0 0 0 0 0 0
1290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1330 0 0 0 0 0
1340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1380 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
1390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1420 0 0 0 0 0 85 85 85 0 0 0 0 0 0 0 0 0
1430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1470 0 0 0 0 0
1480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1520 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
1530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1560 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
1570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1610 0 0 0 0 0
1620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1660 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
1670 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
1680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1690 0 0 85 85 85 85 85 85 0 0 0 0 0 0 0 0 0
1700 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
1710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1750 0 0 0 0 0
1760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1800 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
1810 0 0 0 0 0 0 0 0 85 85 85 85 85 85 85 85 85
1820 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 170 170
183170 170 170 85 85 85 85 85 85 170 170 170 0 0 0 0 0 0
1840 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
1850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1890 0 0 0 0 0
1900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1910 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1920 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1940 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
1950 0 0 170 170 170 170 170 170 170 170 170 85 85 85 85 85 85
1960 0 0 0 0 0 0 0 0 85 85 85 170 170 170 255 255 255
197255 255 255 255 255 255 170 170 170 85 85 85 0 0 0 0 0 0
1980 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
1990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2030 0 0 0 0 0
2040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2060 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2080 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
209170 170 170 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0
2100 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255
211255 255 255 255 255 255 255 255 255 170 170 170 0 0 0 0 0 0
2120 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
2130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2170 0 0 0 0 0
2180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2220 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
223255 255 255 170 170 170 85 85 85 170 170 170 255 255 255 255 255 255
2240 0 0 0 0 0 170 170 170 255 255 255 255 255 255 85 85 85
22585 85 85 170 170 170 255 255 255 255 255 255 0 0 0 0 0 0
2260 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
2270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2310 0 0 0 0 0
2320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2360 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
237255 255 255 85 85 85 170 170 170 170 170 170 255 255 255 255 255 255
23885 85 85 85 85 85 170 170 170 255 255 255 170 170 170 0 0 0
239170 170 170 170 170 170 255 255 255 255 255 255 85 85 85 0 0 0
2400 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
2410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2450 0 0 0 0 0
2460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2500 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
251255 255 255 0 0 0 85 85 85 170 170 170 170 170 170 255 255 255
2520 0 0 85 85 85 85 85 85 255 255 255 85 85 85 0 0 0
2530 0 0 85 85 85 170 170 170 255 255 255 85 85 85 0 0 0
2540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2590 0 0 0 0 0
2600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2640 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
265255 255 255 85 85 85 0 0 0 0 0 0 255 85 85 255 255 85
266255 255 85 255 255 85 255 255 85 255 255 85 85 85 85 0 0 0
2670 0 0 0 0 0 170 170 170 255 255 255 0 0 0 0 0 0
2680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2730 0 0 0 0 0
2740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2780 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
279170 170 170 255 255 255 0 0 0 255 85 85 170 85 0 170 85 0
280255 255 85 255 255 85 170 85 0 255 255 85 255 255 85 255 255 85
2810 0 0 85 85 85 255 255 255 255 255 255 0 0 0 0 0 0
2820 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
2830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2870 0 0 0 0 0
2880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2910 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2920 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
2930 0 0 255 255 255 255 85 85 255 255 85 255 255 85 255 255 85
294255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
295255 255 85 255 255 85 255 255 85 170 170 170 0 0 0 0 0 0
2960 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
2970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3010 0 0 0 0 0
3020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3060 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
3070 0 0 255 85 85 255 255 85 255 255 85 255 255 85 255 255 85
308255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
309255 255 85 255 255 85 255 255 85 255 255 85 0 0 0 0 0 0
3100 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
3110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3150 0 0 0 0 0
3160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3200 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
321170 85 0 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
322255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
323255 255 85 170 85 0 85 85 85 255 255 85 0 0 0 0 0 0
3240 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
3250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3290 0 0 0 0 0
3300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3340 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
335255 85 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
336255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
337170 85 0 85 85 85 255 255 85 255 255 85 0 0 0 0 0 0
3380 0 0 0 0 0 0 0 0 0 0 0 85 85 85 85 85 85
3390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3430 0 0 0 0 0
3440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3480 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
349170 85 0 170 85 0 255 255 85 255 255 85 255 255 85 255 255 85
350255 255 85 255 255 85 255 255 85 255 255 85 170 85 0 170 85 0
351170 85 0 255 255 85 255 255 85 255 85 85 0 0 0 0 0 0
35285 85 85 85 85 85 85 85 85 0 0 0 0 0 0 85 85 85
3530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3570 0 0 0 0 0
3580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3620 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
36385 85 85 170 85 0 170 85 0 170 85 0 255 255 85 255 255 85
364255 255 85 255 85 85 170 85 0 170 85 0 170 85 0 255 255 85
365255 255 85 255 255 85 255 85 85 170 170 170 0 0 0 0 0 0
36685 85 85 85 85 85 85 85 85 85 85 85 0 0 0 85 85 85
3670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3710 0 0 0 0 0
3720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3760 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
37785 85 85 170 170 170 170 85 0 170 85 0 170 85 0 170 85 0
378170 85 0 170 85 0 170 85 0 255 255 85 255 255 85 255 255 85
379255 85 85 170 170 170 255 255 255 255 255 255 85 85 85 0 0 0
3800 0 0 85 85 85 85 85 85 85 85 85 0 0 0 0 0 0
38185 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3850 0 0 0 0 0
3860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3900 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
391170 170 170 170 170 170 170 170 170 170 85 0 255 255 85 255 255 85
392255 255 85 255 255 85 255 255 85 255 255 85 255 85 85 170 170 170
393255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0
3940 0 0 0 0 0 85 85 85 85 85 85 0 0 0 0 0 0
39585 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3990 0 0 0 0 0
4000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4040 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
405170 170 170 255 255 255 255 255 255 170 170 170 170 85 0 255 85 85
406255 85 85 255 85 85 255 85 85 255 85 85 255 255 255 255 255 255
407255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 85 85 85
4080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4090 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
4100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4130 0 0 0 0 0
4140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4180 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
419170 170 170 255 255 255 255 255 255 170 170 170 170 170 170 170 170 170
420170 170 170 170 170 170 170 170 170 255 255 255 255 255 255 255 255 255
421255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
4220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4230 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
4240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4270 0 0 0 0 0
4280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4310 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4320 0 0 0 0 0 85 85 85 85 85 85 0 0 0 0 0 0
433255 255 255 255 255 255 255 255 255 255 255 255 170 170 170 170 170 170
434170 170 170 170 170 170 255 255 255 255 255 255 255 255 255 255 255 255
435255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
436170 170 170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4370 0 0 0 0 0 85 85 85 0 0 0 0 0 0 0 0 0
4380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4410 0 0 0 0 0
4420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4460 0 0 0 0 0 85 85 85 0 0 0 0 0 0 255 255 255
447255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
448255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
449255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
450255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4510 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
4520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4550 0 0 0 0 0
4560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4600 0 0 85 85 85 0 0 0 0 0 0 170 170 170 255 255 255
461255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
462255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
463255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
464255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4650 0 0 0 0 0 0 0 0 85 85 85 85 85 85 0 0 0
4660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4690 0 0 0 0 0
4700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
47485 85 85 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255
475255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
476255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
477255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
478255 255 255 170 170 170 0 0 0 0 0 0 0 0 0 0 0 0
4790 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
4800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4830 0 0 0 0 0
4840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
48885 85 85 0 0 0 0 0 0 85 85 85 255 255 255 255 255 255
489255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
490255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
491255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
492255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
4930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
4940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4970 0 0 0 0 0
4980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
5020 0 0 0 0 0 0 0 0 170 170 170 255 255 255 255 255 255
503255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
504255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
505255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
506255 255 255 255 255 255 85 85 85 0 0 0 0 0 0 0 0 0
5070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
50885 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5110 0 0 0 0 0
5120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5150 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
5160 0 0 0 0 0 0 0 0 170 170 170 255 255 255 255 255 255
517255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
518255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
519255 255 255 255 255 255 170 170 170 170 170 170 170 170 170 170 170 170
520170 170 170 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0
5210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
52285 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5250 0 0 0 0 0
5260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5290 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
5300 0 0 0 0 0 85 85 85 170 170 170 170 170 170 255 255 255
531255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
532255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
533255 255 255 255 255 255 170 170 170 170 170 170 170 170 170 170 170 170
534170 170 170 170 170 170 255 255 255 0 0 0 0 0 0 85 85 85
5350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5360 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
5370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5390 0 0 0 0 0
5400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5430 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
5440 0 0 0 0 0 170 170 170 255 255 255 255 255 255 255 255 255
545255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
546255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
547255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 170 170 170
548170 170 170 170 170 170 170 170 170 255 255 255 0 0 0 85 85 85
54985 85 85 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
5500 0 0 85 85 85 85 85 85 0 0 0 0 0 0 0 0 0
5510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5530 0 0 0 0 0
5540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5570 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
5580 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255
559255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
560255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
561255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
562255 255 255 170 170 170 170 170 170 255 255 255 0 0 0 0 0 0
5630 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
5640 0 0 0 0 0 85 85 85 0 0 0 0 0 0 0 0 0
5650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5670 0 0 0 0 0
5680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5710 0 0 0 0 0 85 85 85 0 0 0 0 0 0 85 85 85
5720 0 0 170 170 170 255 255 255 255 255 255 255 255 255 255 255 255
573255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
574255 255 255 170 170 170 85 85 85 170 170 170 170 170 170 255 255 255
575255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
576255 255 255 255 255 255 170 170 170 170 170 170 255 255 255 0 0 0
5770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5780 0 0 0 0 0 85 85 85 85 85 85 0 0 0 0 0 0
5790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5810 0 0 0 0 0
5820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5840 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5850 0 0 0 0 0 85 85 85 0 0 0 85 85 85 0 0 0
5860 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
587255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
588255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
589170 170 170 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
590255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0
5910 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
5920 0 0 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
5930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5950 0 0 0 0 0
5960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5990 0 0 85 85 85 0 0 0 0 0 0 85 85 85 0 0 0
600255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
601255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
602255 255 255 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
6030 0 0 85 85 85 170 170 170 255 255 255 255 255 255 255 255 255
604255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 170 170 170
6050 0 0 85 85 85 0 0 0 85 85 85 85 85 85 0 0 0
6060 0 0 0 0 0 0 0 0 85 85 85 85 85 85 0 0 0
6070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6090 0 0 0 0 0
6100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6130 0 0 85 85 85 0 0 0 85 85 85 85 85 85 85 85 85
614255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
615255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
616255 255 255 170 170 170 0 0 0 0 0 0 0 0 0 0 0 0
6170 0 0 0 0 0 0 0 0 170 170 170 255 255 255 255 255 255
618255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
6190 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6200 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6230 0 0 0 0 0
6240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6270 0 0 85 85 85 0 0 0 85 85 85 0 0 0 255 255 255
628255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
629255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
630255 255 255 255 255 255 85 85 85 0 0 0 0 0 0 0 0 0
6310 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255
632255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
6330 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6340 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6370 0 0 0 0 0
6380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64185 85 85 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255
642255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
643255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
644255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0
6450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 170 170 170
646255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
6470 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
6490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6510 0 0 0 0 0
6520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
65585 85 85 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255
656255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
657255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
658255 255 255 255 255 255 255 255 255 85 85 85 0 0 0 0 0 0
6590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
660170 170 170 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
6610 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
6630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6650 0 0 0 0 0
6660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
6690 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255
670255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
671255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
672255 255 255 255 255 255 255 255 255 170 170 170 0 0 0 0 0 0
6730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6740 0 0 170 170 170 255 255 255 255 255 255 255 255 255 255 255 255
67585 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
6770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6790 0 0 0 0 0
6800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
6830 0 0 0 0 0 85 85 85 0 0 0 255 255 255 255 255 255
684255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
685255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
686255 255 255 255 255 255 255 255 255 170 170 170 0 0 0 0 0 0
6870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6880 0 0 0 0 0 170 170 170 255 255 255 255 255 255 255 255 255
689170 170 170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
6910 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6920 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6930 0 0 0 0 0
6940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6960 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
6970 0 0 0 0 0 85 85 85 0 0 0 255 255 255 255 255 255
698255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
699255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
700255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
7010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7020 0 0 0 0 0 0 0 0 170 170 170 255 255 255 255 255 255
703170 170 170 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
7040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
70585 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7060 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7070 0 0 0 0 0
7080 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7100 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
7110 0 0 0 0 0 85 85 85 0 0 0 255 255 255 255 255 255
712255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
713255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
714255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
7150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7160 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255
717170 170 170 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
7180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
71985 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7210 0 0 0 0 0
7220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7240 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
7250 0 0 0 0 0 85 85 85 0 0 0 255 255 255 255 255 255
726255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
727255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
728255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
7290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 170 170 170
731170 170 170 0 0 0 0 0 0 85 85 85 85 85 85 0 0 0
7320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
73385 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7350 0 0 0 0 0
7360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7380 0 0 0 0 0 0 0 0 0 0 0 85 85 85 0 0 0
7390 0 0 0 0 0 85 85 85 85 85 85 255 255 255 255 255 255
740255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
741255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
742255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
7430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7440 0 0 85 85 85 170 170 170 170 170 170 255 255 255 255 255 255
745170 170 170 0 0 0 0 0 0 85 85 85 0 0 0 0 0 0
7460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
7470 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7490 0 0 0 0 0
7500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7520 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 85 0
753255 255 85 255 255 85 0 0 0 85 85 85 255 255 255 255 255 255
754255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
755255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
756255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
7570 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
758255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
759170 170 170 170 170 170 170 170 170 85 85 85 0 0 0 85 85 85
76085 85 85 85 85 85 0 0 0 0 0 0 0 0 0 85 85 85
7610 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7620 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7630 0 0 0 0 0
7640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7660 0 0 0 0 0 0 0 0 0 0 0 255 255 85 255 255 85
767255 255 85 255 255 85 255 255 85 85 85 85 170 170 170 255 255 255
768255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
769255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
770255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
7710 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255
772255 255 255 255 255 255 255 255 255 255 255 255 255 255 85 170 170 170
77385 85 85 170 170 170 170 170 170 85 85 85 0 0 0 0 0 0
7740 0 0 85 85 85 170 170 170 0 0 0 0 0 0 85 85 85
7750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7770 0 0 0 0 0
7780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
779170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
78085 85 85 0 0 0 0 0 0 170 85 0 255 255 85 255 255 85
781255 255 85 255 255 85 255 255 85 255 255 85 170 85 0 255 255 255
782255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
783255 255 255 255 255 255 255 255 255 170 170 170 255 255 255 255 255 255
784255 255 255 255 255 255 255 255 255 255 255 255 85 85 85 0 0 0
7850 0 0 0 0 0 0 0 0 170 170 170 255 255 255 255 255 255
786255 255 255 255 255 255 170 170 170 170 170 170 170 170 170 170 170 170
787255 255 255 85 85 85 0 0 0 170 170 170 85 85 85 0 0 0
7880 0 0 0 0 0 85 85 85 0 0 0 255 255 85 85 85 85
7890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7900 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7910 0 0 0 0 0
7920 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 170 170
7930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
794170 170 170 0 0 0 85 85 85 255 255 85 255 255 85 255 255 85
795255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 0 0 0
796255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
797255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
798255 255 255 255 255 255 255 255 255 255 255 255 85 85 85 0 0 0
7990 0 0 0 0 0 85 85 85 255 255 255 255 255 255 255 255 255
800170 170 170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8010 0 0 0 0 0 0 0 0 0 0 0 170 170 170 85 85 85
8020 0 0 0 0 0 0 0 0 255 255 85 255 255 85 255 255 85
8030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8040 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8050 0 0 0 0 0
8060 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 170 170
8070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
808170 170 170 170 170 170 255 255 85 255 255 85 255 255 85 255 255 85
809255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
8100 0 0 170 170 170 255 255 255 255 255 255 255 255 255 255 255 255
811255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
812255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0
8130 0 0 0 0 0 255 255 255 255 255 255 255 255 255 170 170 170
8140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 170 170 170
81685 85 85 0 0 0 255 255 85 255 255 85 255 255 85 255 255 85
81785 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8190 0 0 0 0 0
8200 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 170 170
8210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
822170 170 170 170 170 170 170 170 170 170 170 170 255 255 85 255 255 85
823255 255 85 255 255 85 170 170 170 170 170 170 170 170 170 170 170 170
824255 255 85 85 85 85 170 170 170 170 170 170 170 170 170 170 170 170
825255 255 255 255 255 255 170 170 170 170 170 170 170 170 170 255 255 255
826255 255 255 170 170 170 170 170 170 255 255 255 0 0 0 0 0 0
8270 0 0 85 85 85 255 255 255 255 255 255 255 255 255 85 85 85
82885 85 85 170 170 170 170 170 170 85 85 85 0 0 0 0 0 0
8290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
830170 170 170 170 170 170 255 255 85 255 255 85 255 255 85 255 255 85
83185 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8330 0 0 0 0 0
8340 0 0 0 0 0 0 0 0 0 0 0 170 170 170 85 85 85
8350 0 0 0 0 0 255 255 255 85 85 85 0 0 0 0 0 0
836255 255 255 85 85 85 0 0 0 0 0 0 255 255 255 255 255 85
837255 255 85 170 170 170 0 0 0 0 0 0 0 0 0 170 170 170
838255 255 255 170 170 170 85 85 85 0 0 0 0 0 0 0 0 0
839170 170 170 255 255 255 85 85 85 0 0 0 85 85 85 255 255 255
84085 85 85 0 0 0 85 85 85 255 255 255 0 0 0 0 0 0
8410 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
842255 255 255 255 255 255 85 85 85 0 0 0 0 0 0 85 85 85
84385 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
84485 85 85 255 255 255 255 255 85 255 255 85 255 255 85 255 255 85
84585 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8460 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8470 0 0 0 0 0
8480 0 0 0 0 0 0 0 0 85 85 85 170 170 170 0 0 0
8490 0 0 85 85 85 255 255 255 0 0 0 0 0 0 85 85 85
850255 255 255 0 0 0 0 0 0 85 85 85 255 255 85 255 255 85
851255 255 85 85 85 85 0 0 0 0 0 0 0 0 0 170 170 170
852255 255 255 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
85385 85 85 255 255 255 0 0 0 0 0 0 170 170 170 170 170 170
8540 0 0 0 0 0 255 255 255 255 255 255 0 0 0 85 85 85
855255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
856255 255 255 85 85 85 0 0 0 85 85 85 255 255 255 255 255 255
85785 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8580 0 0 85 85 85 255 255 255 255 255 85 255 255 85 255 255 85
859255 255 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8610 0 0 0 0 0
8620 0 0 0 0 0 0 0 0 85 85 85 170 170 170 0 0 0
8630 0 0 85 85 85 170 170 170 0 0 0 0 0 0 170 170 170
864170 170 170 0 0 0 0 0 0 170 170 170 255 255 85 255 255 85
865255 255 255 0 0 0 85 85 85 85 85 85 0 0 0 170 170 170
866255 255 255 0 0 0 0 0 0 170 170 170 85 85 85 0 0 0
86785 85 85 170 170 170 0 0 0 0 0 0 170 170 170 0 0 0
8680 0 0 170 170 170 255 255 255 255 255 255 255 255 255 255 255 255
869255 255 255 255 255 255 255 255 255 255 255 255 170 170 170 170 170 170
87085 85 85 0 0 0 85 85 85 255 255 255 255 255 255 170 170 170
8710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8720 0 0 0 0 0 85 85 85 255 255 255 255 255 85 255 255 85
873255 255 85 170 85 0 0 0 0 85 85 85 85 85 85 85 85 85
8740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8750 0 0 0 0 0
8760 0 0 0 0 0 0 0 0 85 85 85 170 170 170 0 0 0
8770 0 0 0 0 0 0 0 0 0 0 0 85 85 85 255 255 255
878170 170 170 0 0 0 0 0 0 170 170 170 255 255 85 255 255 85
879170 170 170 0 0 0 170 170 170 85 85 85 0 0 0 255 255 255
880170 170 170 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0
881170 170 170 170 170 170 0 0 0 0 0 0 85 85 85 0 0 0
88285 85 85 255 255 255 255 255 255 255 255 255 255 255 255 170 170 170
883255 255 255 255 255 255 255 255 255 85 85 85 0 0 0 0 0 0
8840 0 0 0 0 0 170 170 170 255 255 255 170 170 170 0 0 0
8850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8860 0 0 0 0 0 0 0 0 85 85 85 255 255 255 255 255 85
887255 255 85 255 255 85 255 255 255 170 170 170 170 170 170 255 255 255
88885 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8890 0 0 0 0 0
8900 0 0 0 0 0 0 0 0 170 170 170 85 85 85 0 0 0
8910 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255
89285 85 85 0 0 0 0 0 0 255 255 255 255 255 85 255 255 85
89385 85 85 0 0 0 255 255 255 85 85 85 0 0 0 255 255 255
89485 85 85 0 0 0 85 85 85 255 255 255 85 85 85 85 85 85
895255 255 255 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
896255 255 255 255 255 255 255 255 255 170 170 170 0 0 0 85 85 85
897255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0
8980 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8990 0 0 0 0 0 0 0 0 0 0 0 85 85 85 255 255 255
900170 170 170 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255
901255 255 85 255 255 85 170 170 170 170 170 170 170 170 170 170 170 170
902170 170 170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9030 0 0 0 0 0
9040 0 0 0 0 0 85 85 85 170 170 170 0 0 0 0 0 0
9050 0 0 0 0 0 0 0 0 0 0 0 85 85 85 255 255 255
9060 0 0 0 0 0 85 85 85 255 255 85 255 255 85 255 255 255
9070 0 0 85 85 85 255 255 255 0 0 0 85 85 85 255 255 255
90885 85 85 0 0 0 170 170 170 255 255 255 170 170 170 170 170 170
909255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
910255 255 255 255 255 255 255 255 255 170 170 170 0 0 0 170 170 170
911255 255 255 255 255 255 85 85 85 0 0 0 0 0 0 0 0 0
9120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9130 0 0 0 0 0 0 0 0 170 170 170 255 255 255 255 255 255
914170 170 170 0 0 0 85 85 85 85 85 85 0 0 0 170 170 170
915255 255 85 255 255 85 255 255 255 170 170 170 170 170 170 170 170 170
91685 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9170 0 0 0 0 0
9180 0 0 0 0 0 85 85 85 170 170 170 0 0 0 0 0 0
91985 85 85 170 170 170 0 0 0 0 0 0 85 85 85 170 170 170
9200 0 0 0 0 0 170 170 170 255 255 85 255 255 85 170 170 170
9210 0 0 85 85 85 170 170 170 0 0 0 85 85 85 255 255 255
9220 0 0 0 0 0 170 170 170 170 170 170 170 170 170 255 255 255
923170 170 170 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
924255 255 255 255 255 255 255 255 255 85 85 85 0 0 0 255 255 255
925255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
92685 85 85 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0
9270 0 0 0 0 0 170 170 170 255 255 255 255 255 85 255 255 255
92885 85 85 170 170 170 255 255 255 255 255 255 170 170 170 0 0 0
929170 170 170 255 255 85 255 255 85 255 255 255 170 170 170 255 255 255
9300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9310 0 0 0 0 0
9320 0 0 0 0 0 85 85 85 170 170 170 0 0 0 0 0 0
933170 170 170 170 170 170 0 0 0 0 0 0 85 85 85 170 170 170
9340 0 0 0 0 0 170 170 170 255 255 85 255 255 255 85 85 85
9350 0 0 85 85 85 85 85 85 0 0 0 85 85 85 170 170 170
9360 0 0 0 0 0 255 255 255 85 85 85 0 0 0 170 170 170
937170 170 170 0 0 0 0 0 0 85 85 85 0 0 0 85 85 85
938255 255 255 255 255 255 255 255 255 85 85 85 85 85 85 255 255 255
939255 255 255 85 85 85 0 0 0 0 0 0 0 0 0 170 170 170
940170 170 170 170 170 170 255 255 255 0 0 0 0 0 0 0 0 0
9410 0 0 170 170 170 255 255 255 255 255 255 255 255 85 170 170 170
942255 255 255 255 255 255 255 255 85 255 255 85 170 170 170 0 0 0
9430 0 0 170 170 170 255 255 85 255 255 85 255 255 85 255 255 85
9440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9450 0 0 0 0 0
9460 0 0 0 0 0 170 170 170 85 85 85 0 0 0 0 0 0
947255 255 255 85 85 85 0 0 0 0 0 0 170 170 170 85 85 85
9480 0 0 0 0 0 255 255 255 255 255 85 255 255 255 0 0 0
9490 0 0 0 0 0 0 0 0 0 0 0 170 170 170 85 85 85
9500 0 0 85 85 85 255 255 255 0 0 0 0 0 0 255 255 255
95185 85 85 0 0 0 85 85 85 85 85 85 0 0 0 0 0 0
952255 255 255 255 255 255 255 255 255 85 85 85 170 170 170 255 255 255
953255 255 255 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255
954170 170 170 85 85 85 170 170 170 0 0 0 0 0 0 85 85 85
955255 255 255 170 170 170 0 0 0 170 170 170 255 255 85 255 255 255
956255 255 255 170 170 170 255 255 255 255 255 255 85 85 85 0 0 0
95785 85 85 255 255 255 255 255 255 255 255 85 255 255 85 255 255 85
9580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9590 0 0 0 0 0
9600 0 0 85 85 85 170 170 170 0 0 0 0 0 0 0 0 0
96185 85 85 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0
9620 0 0 85 85 85 170 170 170 255 255 255 170 170 170 0 0 0
9630 0 0 0 0 0 0 0 0 0 0 0 170 170 170 85 85 85
9640 0 0 85 85 85 170 170 170 0 0 0 85 85 85 255 255 255
9650 0 0 0 0 0 170 170 170 170 170 170 0 0 0 0 0 0
966255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255 255 255
967170 170 170 0 0 0 0 0 0 170 170 170 255 255 255 85 85 85
968170 170 170 170 170 170 170 170 170 0 0 0 85 85 85 255 255 255
969170 170 170 0 0 0 85 85 85 255 255 255 255 255 85 170 170 170
9700 0 0 170 170 170 255 255 255 255 255 255 0 0 0 85 85 85
971255 255 255 170 170 170 0 0 0 170 170 170 255 255 85 85 85 85
9720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9730 0 0 0 0 0
9740 0 0 85 85 85 170 170 170 0 0 0 0 0 0 0 0 0
9750 0 0 0 0 0 0 0 0 170 170 170 170 170 170 0 0 0
9760 0 0 0 0 0 0 0 0 170 170 170 85 85 85 0 0 0
977170 170 170 255 255 255 0 0 0 0 0 0 170 170 170 85 85 85
9780 0 0 0 0 0 0 0 0 0 0 0 170 170 170 170 170 170
9790 0 0 0 0 0 255 255 255 170 170 170 0 0 0 0 0 0
980255 255 255 255 255 255 170 170 170 85 85 85 255 255 255 255 255 255
98185 85 85 0 0 0 170 170 170 170 170 170 0 0 0 0 0 0
982170 170 170 170 170 170 255 255 255 255 255 255 255 255 255 85 85 85
9830 0 0 0 0 0 255 255 255 255 255 255 170 170 170 0 0 0
9840 0 0 170 170 170 255 255 255 170 170 170 170 170 170 255 255 255
98585 85 85 0 0 0 0 0 0 0 0 0 170 170 170 85 85 85
9860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9870 0 0 0 0 0
9880 0 0 85 85 85 170 170 170 0 0 0 0 0 0 0 0 0
9890 0 0 0 0 0 170 170 170 255 255 255 170 170 170 0 0 0
9900 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0
991255 255 255 255 255 255 0 0 0 0 0 0 255 255 255 170 170 170
9920 0 0 0 0 0 0 0 0 170 170 170 255 255 255 170 170 170
9930 0 0 0 0 0 255 255 255 170 170 170 0 0 0 0 0 0
994170 170 170 255 255 255 170 170 170 170 170 170 170 170 170 170 170 170
9950 0 0 85 85 85 85 85 85 0 0 0 0 0 0 0 0 0
99685 85 85 255 255 255 255 255 255 170 170 170 0 0 0 0 0 0
9970 0 0 170 170 170 255 255 255 170 170 170 0 0 0 0 0 0
99885 85 85 255 255 255 255 255 85 255 255 255 255 255 255 85 85 85
9990 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 170 170
100085 85 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10010 0 0 0 0 0
10020 0 0 85 85 85 170 170 170 170 170 170 170 170 170 170 170 170
1003170 170 170 170 170 170 255 255 85 255 255 85 255 255 85 170 170 170
1004170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1005255 255 85 170 170 170 170 170 170 170 170 170 255 255 85 255 255 85
1006170 170 170 170 170 170 170 170 170 255 255 85 255 255 85 170 170 170
1007170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1008170 170 170 170 170 170 85 85 85 170 170 170 170 170 170 170 170 170
10090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10100 0 0 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
101185 85 85 255 255 255 170 170 170 0 0 0 0 0 0 0 0 0
10120 0 0 255 255 255 255 255 255 255 255 255 85 85 85 0 0 0
10130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
1014170 170 170 85 85 85 0 0 0 0 0 0 0 0 0 0 0 0
10150 0 0 0 0 0
10160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
101785 85 85 85 85 85 255 255 85 255 255 85 255 255 85 255 255 85
1018255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
1019255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
1020255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
1021255 255 85 255 85 85 85 85 85 0 0 0 0 0 0 0 0 0
102285 85 85 170 170 170 85 85 85 170 170 170 170 170 170 85 85 85
10230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
102585 85 85 170 170 170 0 0 0 0 0 0 0 0 0 0 0 0
10260 0 0 85 85 85 170 170 170 0 0 0 0 0 0 0 0 0
10270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
102885 85 85 170 170 170 85 85 85 0 0 0 0 0 0 0 0 0
10290 0 0 0 0 0
10300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10310 0 0 0 0 0 85 85 85 85 85 85 170 85 0 170 85 0
1032170 85 0 255 85 85 255 85 85 255 85 85 255 255 85 255 255 85
1033255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
1034255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 255 85
1035255 85 85 170 85 0 85 85 85 0 0 0 0 0 0 85 85 85
1036170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 0 0 0
10370 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10380 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10420 0 0 170 170 170 170 170 170 85 85 85 0 0 0 0 0 0
10430 0 0 0 0 0
10440 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 85 85
104685 85 85 85 85 85 170 85 0 170 85 0 170 85 0 170 85 0
1047255 85 85 255 85 85 255 255 85 255 255 85 255 255 85 255 255 85
1048255 255 85 255 255 85 255 255 85 255 255 85 255 255 85 255 85 85
1049170 85 0 170 85 0 0 0 0 85 85 85 85 85 85 170 170 170
1050170 170 170 0 0 0 170 170 170 255 255 255 170 170 170 0 0 0
10510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10530 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10560 0 0 0 0 0 170 170 170 170 170 170 0 0 0 0 0 0
10570 0 0 0 0 0
10580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10590 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10600 0 0 0 0 0 0 0 0 0 0 0 85 85 85 85 85 85
1061170 85 0 170 85 0 170 85 0 255 85 85 255 85 85 255 255 85
1062255 255 85 255 255 85 255 255 85 255 255 85 255 85 85 170 85 0
1063170 85 0 85 85 85 85 85 85 85 85 85 170 170 170 170 170 170
10640 0 0 0 0 0 255 255 255 255 255 255 85 85 85 0 0 0
10650 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10670 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10700 0 0 0 0 0 0 0 0 170 170 170 85 85 85 0 0 0
10710 0 0 0 0 0
10720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10750 0 0 85 85 85 85 85 85 170 85 0 170 85 0 170 85 0
1076170 85 0 255 85 85 255 85 85 255 85 85 170 85 0 170 85 0
107785 85 85 0 0 0 0 0 0 85 85 85 170 170 170 0 0 0
10780 0 0 85 85 85 255 255 255 170 170 170 0 0 0 0 0 0
10790 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10810 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10820 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10830 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10840 0 0 0 0 0 0 0 0 0 0 0 170 170 170 85 85 85
10850 0 0 0 0 0
10860 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10870 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10880 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10890 0 0 0 0 0 0 0 0 0 0 0 85 85 85 85 85 85
1090170 85 0 170 85 0 170 85 0 170 85 0 170 85 0 85 85 85
10910 0 0 0 0 0 0 0 0 85 85 85 170 170 170 0 0 0
10920 0 0 85 85 85 255 255 255 170 170 170 0 0 0 0 0 0
10930 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10940 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10950 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10960 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10970 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10980 0 0 0 0 0 0 0 0 0 0 0 85 85 85 170 170 170
109985 85 85 0 0 0
11000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11020 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11040 0 0 85 85 85 85 85 85 85 85 85 0 0 0 0 0 0
11050 0 0 0 0 0 0 0 0 85 85 85 85 85 85 170 170 170
1106170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1107170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1108170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1109170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1110170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1111170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
1112170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 85 85 85
111385 85 85 0 0 0
11140 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11230 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11270 0 0 0 0 0
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index f3107ad7e545..95883236c0cd 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -200,7 +200,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags,
200 virt->vaddr = ioremap_nocache(phys, size); 200 virt->vaddr = ioremap_nocache(phys, size);
201 else 201 else
202 virt->vaddr = ioremap(phys, size); 202 virt->vaddr = ioremap(phys, size);
203 return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */ 203 return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */
204} 204}
205 205
206static inline void mga_iounmap(vaddr_t va) { 206static inline void mga_iounmap(vaddr_t va) {
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 473562191586..d3c3af53a290 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -28,6 +28,7 @@
28#endif 28#endif
29 29
30const char *fb_mode_option; 30const char *fb_mode_option;
31EXPORT_SYMBOL_GPL(fb_mode_option);
31 32
32 /* 33 /*
33 * Standard video mode definitions (taken from XFree86) 34 * Standard video mode definitions (taken from XFree86)
@@ -590,6 +591,7 @@ done:
590 "", (margins) ? " with margins" : "", (interlace) ? 591 "", (margins) ? " with margins" : "", (interlace) ?
591 " interlaced" : ""); 592 " interlaced" : "");
592 593
594 memset(&cvt_mode, 0, sizeof(cvt_mode));
593 cvt_mode.xres = xres; 595 cvt_mode.xres = xres;
594 cvt_mode.yres = yres; 596 cvt_mode.yres = yres;
595 cvt_mode.refresh = (refresh) ? refresh : 60; 597 cvt_mode.refresh = (refresh) ? refresh : 60;
diff --git a/drivers/video/pnx4008/pnxrgbfb.c b/drivers/video/pnx4008/pnxrgbfb.c
index 685761a0732c..4db6b48a8715 100644
--- a/drivers/video/pnx4008/pnxrgbfb.c
+++ b/drivers/video/pnx4008/pnxrgbfb.c
@@ -100,7 +100,6 @@ static int rgbfb_remove(struct platform_device *pdev)
100 fb_dealloc_cmap(&info->cmap); 100 fb_dealloc_cmap(&info->cmap);
101 framebuffer_release(info); 101 framebuffer_release(info);
102 platform_set_drvdata(pdev, NULL); 102 platform_set_drvdata(pdev, NULL);
103 kfree(info);
104 } 103 }
105 104
106 pnx4008_free_dum_channel(channel_owned, pdev->id); 105 pnx4008_free_dum_channel(channel_owned, pdev->id);
@@ -168,23 +167,21 @@ static int __devinit rgbfb_probe(struct platform_device *pdev)
168 167
169 ret = fb_alloc_cmap(&info->cmap, 256, 0); 168 ret = fb_alloc_cmap(&info->cmap, 256, 0);
170 if (ret < 0) 169 if (ret < 0)
171 goto err2; 170 goto err1;
172 171
173 ret = register_framebuffer(info); 172 ret = register_framebuffer(info);
174 if (ret < 0) 173 if (ret < 0)
175 goto err3; 174 goto err2;
176 platform_set_drvdata(pdev, info); 175 platform_set_drvdata(pdev, info);
177 176
178 return 0; 177 return 0;
179 178
180err3:
181 fb_dealloc_cmap(&info->cmap);
182err2: 179err2:
183 framebuffer_release(info); 180 fb_dealloc_cmap(&info->cmap);
184err1: 181err1:
185 pnx4008_free_dum_channel(channel_owned, pdev->id); 182 pnx4008_free_dum_channel(channel_owned, pdev->id);
186err0: 183err0:
187 kfree(info); 184 framebuffer_release(info);
188err: 185err:
189 return ret; 186 return ret;
190} 187}
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 48aea39c35a5..7dcda187d9ba 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -355,9 +355,8 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
355 } 355 }
356 356
357#ifdef CONFIG_CPU_FREQ 357#ifdef CONFIG_CPU_FREQ
358 pr_debug("pxafb: dma period = %d ps, clock = %d kHz\n", 358 pr_debug("pxafb: dma period = %d ps\n",
359 pxafb_display_dma_period(var), 359 pxafb_display_dma_period(var));
360 get_clk_frequency_khz(0));
361#endif 360#endif
362 361
363 return 0; 362 return 0;
@@ -574,8 +573,8 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal,
574 dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off; 573 dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off;
575 fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off; 574 fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off;
576 } else { 575 } else {
577 pal_desc = &fbi->dma_buff->pal_desc[dma]; 576 pal_desc = &fbi->dma_buff->pal_desc[pal];
578 pal_desc_off = offsetof(struct pxafb_dma_buff, dma_desc[pal]); 577 pal_desc_off = offsetof(struct pxafb_dma_buff, pal_desc[pal]);
579 578
580 pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE; 579 pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE;
581 pal_desc->fidr = 0; 580 pal_desc->fidr = 0;
@@ -1277,6 +1276,8 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi)
1277 fbi->dma_buff_phys = fbi->map_dma; 1276 fbi->dma_buff_phys = fbi->map_dma;
1278 fbi->palette_cpu = (u16 *) fbi->dma_buff->palette; 1277 fbi->palette_cpu = (u16 *) fbi->dma_buff->palette;
1279 1278
1279 pr_debug("pxafb: palette_mem_size = 0x%08lx\n", fbi->palette_size*sizeof(u16));
1280
1280#ifdef CONFIG_FB_PXA_SMARTPANEL 1281#ifdef CONFIG_FB_PXA_SMARTPANEL
1281 fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff; 1282 fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff;
1282 fbi->n_smart_cmds = 0; 1283 fbi->n_smart_cmds = 0;
@@ -1352,7 +1353,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
1352 struct pxafb_info *fbi; 1353 struct pxafb_info *fbi;
1353 void *addr; 1354 void *addr;
1354 struct pxafb_mach_info *inf = dev->platform_data; 1355 struct pxafb_mach_info *inf = dev->platform_data;
1355 struct pxafb_mode_info *mode = inf->modes;
1356 1356
1357 /* Alloc the pxafb_info and pseudo_palette in one step */ 1357 /* Alloc the pxafb_info and pseudo_palette in one step */
1358 fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); 1358 fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL);
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 13b38cbbe4cf..f0598961c6b0 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -1,75 +1,15 @@
1/* 1/* linux/drivers/video/s3c2410fb.c
2 * linux/drivers/video/s3c2410fb.c 2 * Copyright (c) 2004,2005 Arnaud Patard
3 * Copyright (c) Arnaud Patard, Ben Dooks 3 * Copyright (c) 2004-2008 Ben Dooks
4 *
5 * S3C2410 LCD Framebuffer Driver
4 * 6 *
5 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive for 8 * License. See the file COPYING in the main directory of this archive for
7 * more details. 9 * more details.
8 * 10 *
9 * S3C2410 LCD Controller Frame Buffer Driver 11 * Driver based on skeletonfb.c, sa1100fb.c and others.
10 * based on skeletonfb.c, sa1100fb.c and others 12*/
11 *
12 * ChangeLog
13 * 2005-04-07: Arnaud Patard <arnaud.patard@rtp-net.org>
14 * - u32 state -> pm_message_t state
15 * - S3C2410_{VA,SZ}_LCD -> S3C24XX
16 *
17 * 2005-03-15: Arnaud Patard <arnaud.patard@rtp-net.org>
18 * - Removed the ioctl
19 * - use readl/writel instead of __raw_writel/__raw_readl
20 *
21 * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org>
22 * - Added the possibility to set on or off the
23 * debugging messages
24 * - Replaced 0 and 1 by on or off when reading the
25 * /sys files
26 *
27 * 2005-03-23: Ben Dooks <ben-linux@fluff.org>
28 * - added non 16bpp modes
29 * - updated platform information for range of x/y/bpp
30 * - add code to ensure palette is written correctly
31 * - add pixel clock divisor control
32 *
33 * 2004-11-11: Arnaud Patard <arnaud.patard@rtp-net.org>
34 * - Removed the use of currcon as it no more exists
35 * - Added LCD power sysfs interface
36 *
37 * 2004-11-03: Ben Dooks <ben-linux@fluff.org>
38 * - minor cleanups
39 * - add suspend/resume support
40 * - s3c2410fb_setcolreg() not valid in >8bpp modes
41 * - removed last CONFIG_FB_S3C2410_FIXED
42 * - ensure lcd controller stopped before cleanup
43 * - added sysfs interface for backlight power
44 * - added mask for gpio configuration
45 * - ensured IRQs disabled during GPIO configuration
46 * - disable TPAL before enabling video
47 *
48 * 2004-09-20: Arnaud Patard <arnaud.patard@rtp-net.org>
49 * - Suppress command line options
50 *
51 * 2004-09-15: Arnaud Patard <arnaud.patard@rtp-net.org>
52 * - code cleanup
53 *
54 * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org>
55 * - Renamed from h1940fb.c to s3c2410fb.c
56 * - Add support for different devices
57 * - Backlight support
58 *
59 * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at>
60 * - added clock (de-)allocation code
61 * - added fixem fbmem option
62 *
63 * 2004-07-27: Arnaud Patard <arnaud.patard@rtp-net.org>
64 * - code cleanup
65 * - added a forgotten return in h1940fb_init
66 *
67 * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at>
68 * - code cleanup and extended debugging
69 *
70 * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org>
71 * - First version
72 */
73 13
74#include <linux/module.h> 14#include <linux/module.h>
75#include <linux/kernel.h> 15#include <linux/kernel.h>
@@ -580,6 +520,27 @@ static int s3c2410fb_setcolreg(unsigned regno,
580 return 0; 520 return 0;
581} 521}
582 522
523/* s3c2410fb_lcd_enable
524 *
525 * shutdown the lcd controller
526 */
527static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable)
528{
529 unsigned long flags;
530
531 local_irq_save(flags);
532
533 if (enable)
534 fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID;
535 else
536 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
537
538 writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
539
540 local_irq_restore(flags);
541}
542
543
583/* 544/*
584 * s3c2410fb_blank 545 * s3c2410fb_blank
585 * @blank_mode: the blank mode we want. 546 * @blank_mode: the blank mode we want.
@@ -589,9 +550,6 @@ static int s3c2410fb_setcolreg(unsigned regno,
589 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a 550 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a
590 * video mode which doesn't support it. Implements VESA suspend 551 * video mode which doesn't support it. Implements VESA suspend
591 * and powerdown modes on hardware that supports disabling hsync/vsync: 552 * and powerdown modes on hardware that supports disabling hsync/vsync:
592 * blank_mode == 2: suspend vsync
593 * blank_mode == 3: suspend hsync
594 * blank_mode == 4: powerdown
595 * 553 *
596 * Returns negative errno on error, or zero on success. 554 * Returns negative errno on error, or zero on success.
597 * 555 *
@@ -605,6 +563,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info)
605 563
606 tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; 564 tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL;
607 565
566 if (blank_mode == FB_BLANK_POWERDOWN) {
567 s3c2410fb_lcd_enable(fbi, 0);
568 } else {
569 s3c2410fb_lcd_enable(fbi, 1);
570 }
571
608 if (blank_mode == FB_BLANK_UNBLANK) 572 if (blank_mode == FB_BLANK_UNBLANK)
609 writel(0x0, tpal_reg); 573 writel(0x0, tpal_reg);
610 else { 574 else {
@@ -948,7 +912,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev,
948 } 912 }
949 913
950 /* create device files */ 914 /* create device files */
951 device_create_file(&pdev->dev, &dev_attr_debug); 915 ret = device_create_file(&pdev->dev, &dev_attr_debug);
916 if (ret) {
917 printk(KERN_ERR "failed to add debug attribute\n");
918 }
952 919
953 printk(KERN_INFO "fb%d: %s frame buffer device\n", 920 printk(KERN_INFO "fb%d: %s frame buffer device\n",
954 fbinfo->node, fbinfo->fix.id); 921 fbinfo->node, fbinfo->fix.id);
@@ -983,21 +950,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev)
983 return s3c24xxfb_probe(pdev, DRV_S3C2412); 950 return s3c24xxfb_probe(pdev, DRV_S3C2412);
984} 951}
985 952
986/* s3c2410fb_stop_lcd
987 *
988 * shutdown the lcd controller
989 */
990static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi)
991{
992 unsigned long flags;
993
994 local_irq_save(flags);
995
996 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
997 writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
998
999 local_irq_restore(flags);
1000}
1001 953
1002/* 954/*
1003 * Cleanup 955 * Cleanup
@@ -1010,7 +962,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
1010 962
1011 unregister_framebuffer(fbinfo); 963 unregister_framebuffer(fbinfo);
1012 964
1013 s3c2410fb_stop_lcd(info); 965 s3c2410fb_lcd_enable(info, 0);
1014 msleep(1); 966 msleep(1);
1015 967
1016 s3c2410fb_unmap_video_memory(fbinfo); 968 s3c2410fb_unmap_video_memory(fbinfo);
@@ -1043,7 +995,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
1043 struct fb_info *fbinfo = platform_get_drvdata(dev); 995 struct fb_info *fbinfo = platform_get_drvdata(dev);
1044 struct s3c2410fb_info *info = fbinfo->par; 996 struct s3c2410fb_info *info = fbinfo->par;
1045 997
1046 s3c2410fb_stop_lcd(info); 998 s3c2410fb_lcd_enable(info, 0);
1047 999
1048 /* sleep before disabling the clock, we need to ensure 1000 /* sleep before disabling the clock, we need to ensure
1049 * the LCD DMA engine is not going to get back on the bus 1001 * the LCD DMA engine is not going to get back on the bus
@@ -1118,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, "
1118 "Ben Dooks <ben-linux@fluff.org>"); 1070 "Ben Dooks <ben-linux@fluff.org>");
1119MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); 1071MODULE_DESCRIPTION("Framebuffer driver for the s3c2410");
1120MODULE_LICENSE("GPL"); 1072MODULE_LICENSE("GPL");
1073MODULE_ALIAS("platform:s3c2410-lcd");
1074MODULE_ALIAS("platform:s3c2412-lcd");
diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h
index dbb73b95e2ef..9a6ba3e9d1b8 100644
--- a/drivers/video/s3c2410fb.h
+++ b/drivers/video/s3c2410fb.h
@@ -1,26 +1,14 @@
1/* 1/*
2 * linux/drivers/video/s3c2410fb.h 2 * linux/drivers/video/s3c2410fb.h
3 * Copyright (c) Arnaud Patard 3 * Copyright (c) 2004 Arnaud Patard
4 *
5 * S3C2410 LCD Framebuffer Driver
4 * 6 *
5 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive for 8 * License. See the file COPYING in the main directory of this archive for
7 * more details. 9 * more details.
8 * 10 *
9 * S3C2410 LCD Controller Frame Buffer Driver 11*/
10 * based on skeletonfb.c, sa1100fb.h
11 *
12 * ChangeLog
13 *
14 * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org>
15 * - Moved dprintk to s3c2410fb.c
16 *
17 * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org>
18 * - Renamed from h1940fb.h to s3c2410fb.h
19 * - Changed h1940 to s3c2410
20 *
21 * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org>
22 * - First version
23 */
24 12
25#ifndef __S3C2410FB_H 13#ifndef __S3C2410FB_H
26#define __S3C2410FB_H 14#define __S3C2410FB_H
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 73803624c131..b9343844cd1f 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -5787,7 +5787,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5787 } else { 5787 } else {
5788 struct sis_video_info *countvideo = card_list; 5788 struct sis_video_info *countvideo = card_list;
5789 ivideo->cardnumber = 1; 5789 ivideo->cardnumber = 1;
5790 while((countvideo = countvideo->next) != 0) 5790 while((countvideo = countvideo->next) != NULL)
5791 ivideo->cardnumber++; 5791 ivideo->cardnumber++;
5792 } 5792 }
5793 5793
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 742b5c656d66..15d4a768b1f6 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -663,14 +663,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
663 sm501fb_sync_regs(fbi); 663 sm501fb_sync_regs(fbi);
664 mdelay(10); 664 mdelay(10);
665 665
666 if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { 666 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
667 control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ 667 control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */
668 writel(control, ctrl_reg); 668 writel(control, ctrl_reg);
669 sm501fb_sync_regs(fbi); 669 sm501fb_sync_regs(fbi);
670 mdelay(10); 670 mdelay(10);
671 } 671 }
672 672
673 if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { 673 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
674 control |= SM501_DC_PANEL_CONTROL_FPEN; 674 control |= SM501_DC_PANEL_CONTROL_FPEN;
675 writel(control, ctrl_reg); 675 writel(control, ctrl_reg);
676 sm501fb_sync_regs(fbi); 676 sm501fb_sync_regs(fbi);
@@ -678,14 +678,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
678 } 678 }
679 } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { 679 } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) {
680 /* disable panel power */ 680 /* disable panel power */
681 if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { 681 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
682 control &= ~SM501_DC_PANEL_CONTROL_FPEN; 682 control &= ~SM501_DC_PANEL_CONTROL_FPEN;
683 writel(control, ctrl_reg); 683 writel(control, ctrl_reg);
684 sm501fb_sync_regs(fbi); 684 sm501fb_sync_regs(fbi);
685 mdelay(10); 685 mdelay(10);
686 } 686 }
687 687
688 if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { 688 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
689 control &= ~SM501_DC_PANEL_CONTROL_BIAS; 689 control &= ~SM501_DC_PANEL_CONTROL_BIAS;
690 writel(control, ctrl_reg); 690 writel(control, ctrl_reg);
691 sm501fb_sync_regs(fbi); 691 sm501fb_sync_regs(fbi);
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index bd54cd0de39a..beefab2992c0 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -27,7 +27,6 @@
27#define VERSION "0.7.8-NEWAPI" 27#define VERSION "0.7.8-NEWAPI"
28 28
29struct tridentfb_par { 29struct tridentfb_par {
30 int vclk; /* in MHz */
31 void __iomem *io_virt; /* iospace virtual memory address */ 30 void __iomem *io_virt; /* iospace virtual memory address */
32}; 31};
33 32
@@ -669,27 +668,26 @@ static void set_screen_start(int base)
669 (read3X4(CRTHiOrd) & 0xF8) | ((base & 0xE0000) >> 17)); 668 (read3X4(CRTHiOrd) & 0xF8) | ((base & 0xE0000) >> 17));
670} 669}
671 670
672/* Use 20.12 fixed-point for NTSC value and frequency calculation */
673#define calc_freq(n, m, k) ( ((unsigned long)0xE517 * (n + 8) / ((m + 2) * (1 << k))) >> 12 )
674
675/* Set dotclock frequency */ 671/* Set dotclock frequency */
676static void set_vclk(int freq) 672static void set_vclk(unsigned long freq)
677{ 673{
678 int m, n, k; 674 int m, n, k;
679 int f, fi, d, di; 675 unsigned long f, fi, d, di;
680 unsigned char lo = 0, hi = 0; 676 unsigned char lo = 0, hi = 0;
681 677
682 d = 20; 678 d = 20000;
683 for (k = 2; k >= 0; k--) 679 for (k = 2; k >= 0; k--)
684 for (m = 0; m < 63; m++) 680 for (m = 0; m < 63; m++)
685 for (n = 0; n < 128; n++) { 681 for (n = 0; n < 128; n++) {
686 fi = calc_freq(n, m, k); 682 fi = ((14318l * (n + 8)) / (m + 2)) >> k;
687 if ((di = abs(fi - freq)) < d) { 683 if ((di = abs(fi - freq)) < d) {
688 d = di; 684 d = di;
689 f = fi; 685 f = fi;
690 lo = n; 686 lo = n;
691 hi = (k << 6) | m; 687 hi = (k << 6) | m;
692 } 688 }
689 if (fi > freq)
690 break;
693 } 691 }
694 if (chip3D) { 692 if (chip3D) {
695 write3C4(ClockHigh, hi); 693 write3C4(ClockHigh, hi);
@@ -888,6 +886,8 @@ static int tridentfb_set_par(struct fb_info *info)
888 struct fb_var_screeninfo *var = &info->var; 886 struct fb_var_screeninfo *var = &info->var;
889 int bpp = var->bits_per_pixel; 887 int bpp = var->bits_per_pixel;
890 unsigned char tmp; 888 unsigned char tmp;
889 unsigned long vclk;
890
891 debug("enter\n"); 891 debug("enter\n");
892 hdispend = var->xres / 8 - 1; 892 hdispend = var->xres / 8 - 1;
893 hsyncstart = (var->xres + var->right_margin) / 8; 893 hsyncstart = (var->xres + var->right_margin) / 8;
@@ -905,7 +905,6 @@ static int tridentfb_set_par(struct fb_info *info)
905 vblankstart = var->yres; 905 vblankstart = var->yres;
906 vblankend = vtotal + 2; 906 vblankend = vtotal + 2;
907 907
908 enable_mmio();
909 crtc_unlock(); 908 crtc_unlock();
910 write3CE(CyberControl, 8); 909 write3CE(CyberControl, 8);
911 910
@@ -1015,11 +1014,11 @@ static int tridentfb_set_par(struct fb_info *info)
1015 write3X4(Performance, 0x92); 1014 write3X4(Performance, 0x92);
1016 write3X4(PCIReg, 0x07); /* MMIO & PCI read and write burst enable */ 1015 write3X4(PCIReg, 0x07); /* MMIO & PCI read and write burst enable */
1017 1016
1018 /* convert from picoseconds to MHz */ 1017 /* convert from picoseconds to kHz */
1019 par->vclk = 1000000 / info->var.pixclock; 1018 vclk = PICOS2KHZ(info->var.pixclock);
1020 if (bpp == 32) 1019 if (bpp == 32)
1021 par->vclk *= 2; 1020 vclk *= 2;
1022 set_vclk(par->vclk); 1021 set_vclk(vclk);
1023 1022
1024 write3C4(0, 3); 1023 write3C4(0, 3);
1025 write3C4(1, 1); /* set char clock 8 dots wide */ 1024 write3C4(1, 1); /* set char clock 8 dots wide */
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 13866789b356..7084e7e146c0 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -2,6 +2,9 @@
2#include <linux/spinlock.h> 2#include <linux/spinlock.h>
3#include <linux/virtio_config.h> 3#include <linux/virtio_config.h>
4 4
5/* Unique numbering for virtio devices. */
6static unsigned int dev_index;
7
5static ssize_t device_show(struct device *_d, 8static ssize_t device_show(struct device *_d,
6 struct device_attribute *attr, char *buf) 9 struct device_attribute *attr, char *buf)
7{ 10{
@@ -121,9 +124,9 @@ static int virtio_dev_probe(struct device *_d)
121 if (err) 124 if (err)
122 add_status(dev, VIRTIO_CONFIG_S_FAILED); 125 add_status(dev, VIRTIO_CONFIG_S_FAILED);
123 else { 126 else {
124 add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
125 /* They should never have set feature bits beyond 32 */ 127 /* They should never have set feature bits beyond 32 */
126 dev->config->set_features(dev, dev->features[0]); 128 dev->config->set_features(dev, dev->features[0]);
129 add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
127 } 130 }
128 return err; 131 return err;
129} 132}
@@ -166,7 +169,10 @@ int register_virtio_device(struct virtio_device *dev)
166 int err; 169 int err;
167 170
168 dev->dev.bus = &virtio_bus; 171 dev->dev.bus = &virtio_bus;
169 sprintf(dev->dev.bus_id, "%u", dev->index); 172
173 /* Assign a unique device index and hence name. */
174 dev->index = dev_index++;
175 sprintf(dev->dev.bus_id, "virtio%u", dev->index);
170 176
171 /* We always start by resetting the device, in case a previous 177 /* We always start by resetting the device, in case a previous
172 * driver messed it up. This also tests that code path a little. */ 178 * driver messed it up. This also tests that code path a little. */
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 27e9fc9117cd..eae7236310e4 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -78,9 +78,6 @@ static struct device virtio_pci_root = {
78 .bus_id = "virtio-pci", 78 .bus_id = "virtio-pci",
79}; 79};
80 80
81/* Unique numbering for devices under the kvm root */
82static unsigned int dev_index;
83
84/* Convert a generic virtio device to our structure */ 81/* Convert a generic virtio device to our structure */
85static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) 82static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
86{ 83{
@@ -325,10 +322,6 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
325 if (vp_dev == NULL) 322 if (vp_dev == NULL)
326 return -ENOMEM; 323 return -ENOMEM;
327 324
328 snprintf(vp_dev->vdev.dev.bus_id, BUS_ID_SIZE, "virtio%d", dev_index);
329 vp_dev->vdev.index = dev_index;
330 dev_index++;
331
332 vp_dev->vdev.dev.parent = &virtio_pci_root; 325 vp_dev->vdev.dev.parent = &virtio_pci_root;
333 vp_dev->vdev.config = &virtio_pci_config_ops; 326 vp_dev->vdev.config = &virtio_pci_config_ops;
334 vp_dev->pci_dev = pci_dev; 327 vp_dev->pci_dev = pci_dev;
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 937a49d6772c..72bf8bc09014 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -227,7 +227,6 @@ static bool vring_enable_cb(struct virtqueue *_vq)
227 struct vring_virtqueue *vq = to_vvq(_vq); 227 struct vring_virtqueue *vq = to_vvq(_vq);
228 228
229 START_USE(vq); 229 START_USE(vq);
230 BUG_ON(!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT));
231 230
232 /* We optimistically turn back on interrupts, then check if there was 231 /* We optimistically turn back on interrupts, then check if there was
233 * more to do. */ 232 * more to do. */
@@ -254,13 +253,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
254 if (unlikely(vq->broken)) 253 if (unlikely(vq->broken))
255 return IRQ_HANDLED; 254 return IRQ_HANDLED;
256 255
257 /* Other side may have missed us turning off the interrupt,
258 * but we should preserve disable semantic for virtio users. */
259 if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) {
260 pr_debug("virtqueue interrupt after disable for %p\n", vq);
261 return IRQ_HANDLED;
262 }
263
264 pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); 256 pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
265 if (vq->vq.callback) 257 if (vq->vq.callback)
266 vq->vq.callback(&vq->vq); 258 vq->vq.callback(&vq->vq);
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 254d115cafab..ccb78f66c2b6 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -295,6 +295,19 @@ config ALIM7101_WDT
295 295
296 Most people will say N. 296 Most people will say N.
297 297
298config GEODE_WDT
299 tristate "AMD Geode CS5535/CS5536 Watchdog"
300 depends on MGEODE_LX
301 help
302 This driver enables a watchdog capability built into the
303 CS5535/CS5536 companion chips for the AMD Geode GX and LX
304 processors. This watchdog watches your kernel to make sure
305 it doesn't freeze, and if it does, it reboots your computer after
306 a certain amount of time.
307
308 You can compile this driver directly into the kernel, or use
309 it as a module. The module will be called geodewdt.
310
298config SC520_WDT 311config SC520_WDT
299 tristate "AMD Elan SC520 processor Watchdog" 312 tristate "AMD Elan SC520 processor Watchdog"
300 depends on X86 313 depends on X86
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index f3fb170fe5c6..25b352b664d9 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
59obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o 59obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
60obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o 60obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
61obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o 61obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
62obj-$(CONFIG_GEODE_WDT) += geodewdt.o
62obj-$(CONFIG_SC520_WDT) += sc520_wdt.o 63obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
63obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o 64obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
64obj-$(CONFIG_IB700_WDT) += ib700wdt.o 65obj-$(CONFIG_IB700_WDT) += ib700wdt.o
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 1237113dc14a..03b3e3d91e7c 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -29,7 +29,8 @@
29 29
30#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) 30#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
31#define stampit() stamp("here i am") 31#define stampit() stamp("here i am")
32#define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); }) 32#define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); })
33#define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); })
33 34
34#define WATCHDOG_NAME "bfin-wdt" 35#define WATCHDOG_NAME "bfin-wdt"
35#define PFX WATCHDOG_NAME ": " 36#define PFX WATCHDOG_NAME ": "
@@ -377,20 +378,6 @@ static int bfin_wdt_resume(struct platform_device *pdev)
377# define bfin_wdt_resume NULL 378# define bfin_wdt_resume NULL
378#endif 379#endif
379 380
380static struct platform_device bfin_wdt_device = {
381 .name = WATCHDOG_NAME,
382 .id = -1,
383};
384
385static struct platform_driver bfin_wdt_driver = {
386 .driver = {
387 .name = WATCHDOG_NAME,
388 .owner = THIS_MODULE,
389 },
390 .suspend = bfin_wdt_suspend,
391 .resume = bfin_wdt_resume,
392};
393
394static const struct file_operations bfin_wdt_fops = { 381static const struct file_operations bfin_wdt_fops = {
395 .owner = THIS_MODULE, 382 .owner = THIS_MODULE,
396 .llseek = no_llseek, 383 .llseek = no_llseek,
@@ -418,11 +405,67 @@ static struct notifier_block bfin_wdt_notifier = {
418}; 405};
419 406
420/** 407/**
421 * bfin_wdt_init - Initialize module 408 * bfin_wdt_probe - Initialize module
422 * 409 *
423 * Registers the device and notifier handler. Actual device 410 * Registers the misc device and notifier handler. Actual device
424 * initialization is handled by bfin_wdt_open(). 411 * initialization is handled by bfin_wdt_open().
425 */ 412 */
413static int __devinit bfin_wdt_probe(struct platform_device *pdev)
414{
415 int ret;
416
417 ret = register_reboot_notifier(&bfin_wdt_notifier);
418 if (ret) {
419 pr_devinit(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
420 return ret;
421 }
422
423 ret = misc_register(&bfin_wdt_miscdev);
424 if (ret) {
425 pr_devinit(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
426 WATCHDOG_MINOR, ret);
427 unregister_reboot_notifier(&bfin_wdt_notifier);
428 return ret;
429 }
430
431 pr_devinit(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n",
432 timeout, nowayout);
433
434 return 0;
435}
436
437/**
438 * bfin_wdt_remove - Initialize module
439 *
440 * Unregisters the misc device and notifier handler. Actual device
441 * deinitialization is handled by bfin_wdt_close().
442 */
443static int __devexit bfin_wdt_remove(struct platform_device *pdev)
444{
445 misc_deregister(&bfin_wdt_miscdev);
446 unregister_reboot_notifier(&bfin_wdt_notifier);
447 return 0;
448}
449
450static struct platform_device *bfin_wdt_device;
451
452static struct platform_driver bfin_wdt_driver = {
453 .probe = bfin_wdt_probe,
454 .remove = __devexit_p(bfin_wdt_remove),
455 .suspend = bfin_wdt_suspend,
456 .resume = bfin_wdt_resume,
457 .driver = {
458 .name = WATCHDOG_NAME,
459 .owner = THIS_MODULE,
460 },
461};
462
463/**
464 * bfin_wdt_init - Initialize module
465 *
466 * Checks the module params and registers the platform device & driver.
467 * Real work is in the platform probe function.
468 */
426static int __init bfin_wdt_init(void) 469static int __init bfin_wdt_init(void)
427{ 470{
428 int ret; 471 int ret;
@@ -436,44 +479,32 @@ static int __init bfin_wdt_init(void)
436 /* Since this is an on-chip device and needs no board-specific 479 /* Since this is an on-chip device and needs no board-specific
437 * resources, we'll handle all the platform device stuff here. 480 * resources, we'll handle all the platform device stuff here.
438 */ 481 */
439 ret = platform_device_register(&bfin_wdt_device); 482 ret = platform_driver_register(&bfin_wdt_driver);
440 if (ret)
441 return ret;
442
443 ret = platform_driver_probe(&bfin_wdt_driver, NULL);
444 if (ret)
445 return ret;
446
447 ret = register_reboot_notifier(&bfin_wdt_notifier);
448 if (ret) { 483 if (ret) {
449 pr_init(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); 484 pr_init(KERN_ERR PFX "unable to register driver\n");
450 return ret; 485 return ret;
451 } 486 }
452 487
453 ret = misc_register(&bfin_wdt_miscdev); 488 bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, -1, NULL, 0);
454 if (ret) { 489 if (IS_ERR(bfin_wdt_device)) {
455 pr_init(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", 490 pr_init(KERN_ERR PFX "unable to register device\n");
456 WATCHDOG_MINOR, ret); 491 platform_driver_unregister(&bfin_wdt_driver);
457 unregister_reboot_notifier(&bfin_wdt_notifier); 492 return PTR_ERR(bfin_wdt_device);
458 return ret;
459 } 493 }
460 494
461 pr_init(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n",
462 timeout, nowayout);
463
464 return 0; 495 return 0;
465} 496}
466 497
467/** 498/**
468 * bfin_wdt_exit - Deinitialize module 499 * bfin_wdt_exit - Deinitialize module
469 * 500 *
470 * Unregisters the device and notifier handler. Actual device 501 * Back out the platform device & driver steps. Real work is in the
471 * deinitialization is handled by bfin_wdt_close(). 502 * platform remove function.
472 */ 503 */
473static void __exit bfin_wdt_exit(void) 504static void __exit bfin_wdt_exit(void)
474{ 505{
475 misc_deregister(&bfin_wdt_miscdev); 506 platform_device_unregister(bfin_wdt_device);
476 unregister_reboot_notifier(&bfin_wdt_notifier); 507 platform_driver_unregister(&bfin_wdt_driver);
477} 508}
478 509
479module_init(bfin_wdt_init); 510module_init(bfin_wdt_init);
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index d362f5bf658a..c1ba0db48501 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -1,12 +1,10 @@
1/* 1/*
2 * drivers/char/watchdog/booke_wdt.c
3 *
4 * Watchdog timer for PowerPC Book-E systems 2 * Watchdog timer for PowerPC Book-E systems
5 * 3 *
6 * Author: Matthew McClintock 4 * Author: Matthew McClintock
7 * Maintainer: Kumar Gala <galak@kernel.crashing.org> 5 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
8 * 6 *
9 * Copyright 2005 Freescale Semiconductor Inc. 7 * Copyright 2005, 2008 Freescale Semiconductor Inc.
10 * 8 *
11 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -16,6 +14,7 @@
16 14
17#include <linux/module.h> 15#include <linux/module.h>
18#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/smp.h>
19#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
20#include <linux/notifier.h> 19#include <linux/notifier.h>
21#include <linux/watchdog.h> 20#include <linux/watchdog.h>
@@ -38,7 +37,7 @@
38#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ 37#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
39#endif /* for timing information */ 38#endif /* for timing information */
40 39
41u32 booke_wdt_enabled = 0; 40u32 booke_wdt_enabled;
42u32 booke_wdt_period = WDT_PERIOD_DEFAULT; 41u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
43 42
44#ifdef CONFIG_FSL_BOOKE 43#ifdef CONFIG_FSL_BOOKE
@@ -47,33 +46,31 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
47#define WDTP(x) (TCR_WP(x)) 46#define WDTP(x) (TCR_WP(x))
48#endif 47#endif
49 48
50/* 49static DEFINE_SPINLOCK(booke_wdt_lock);
51 * booke_wdt_ping: 50
52 */ 51static void __booke_wdt_ping(void *data)
53static __inline__ void booke_wdt_ping(void)
54{ 52{
55 mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); 53 mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
56} 54}
57 55
58/* 56static void booke_wdt_ping(void)
59 * booke_wdt_enable: 57{
60 */ 58 on_each_cpu(__booke_wdt_ping, NULL, 0, 0);
61static __inline__ void booke_wdt_enable(void) 59}
60
61static void __booke_wdt_enable(void *data)
62{ 62{
63 u32 val; 63 u32 val;
64 64
65 /* clear status before enabling watchdog */ 65 /* clear status before enabling watchdog */
66 booke_wdt_ping(); 66 __booke_wdt_ping(NULL);
67 val = mfspr(SPRN_TCR); 67 val = mfspr(SPRN_TCR);
68 val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); 68 val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));
69 69
70 mtspr(SPRN_TCR, val); 70 mtspr(SPRN_TCR, val);
71} 71}
72 72
73/* 73static ssize_t booke_wdt_write(struct file *file, const char __user *buf,
74 * booke_wdt_write:
75 */
76static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
77 size_t count, loff_t *ppos) 74 size_t count, loff_t *ppos)
78{ 75{
79 booke_wdt_ping(); 76 booke_wdt_ping();
@@ -81,15 +78,11 @@ static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
81} 78}
82 79
83static struct watchdog_info ident = { 80static struct watchdog_info ident = {
84 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, 81 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
85 .firmware_version = 0, 82 .identity = "PowerPC Book-E Watchdog",
86 .identity = "PowerPC Book-E Watchdog",
87}; 83};
88 84
89/* 85static int booke_wdt_ioctl(struct inode *inode, struct file *file,
90 * booke_wdt_ioctl:
91 */
92static int booke_wdt_ioctl (struct inode *inode, struct file *file,
93 unsigned int cmd, unsigned long arg) 86 unsigned int cmd, unsigned long arg)
94{ 87{
95 u32 tmp = 0; 88 u32 tmp = 0;
@@ -97,7 +90,7 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
97 90
98 switch (cmd) { 91 switch (cmd) {
99 case WDIOC_GETSUPPORT: 92 case WDIOC_GETSUPPORT:
100 if (copy_to_user ((struct watchdog_info __user *) arg, &ident, 93 if (copy_to_user((struct watchdog_info __user *)arg, &ident,
101 sizeof(struct watchdog_info))) 94 sizeof(struct watchdog_info)))
102 return -EFAULT; 95 return -EFAULT;
103 case WDIOC_GETSTATUS: 96 case WDIOC_GETSTATUS:
@@ -132,33 +125,33 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
132 125
133 return 0; 126 return 0;
134} 127}
135/* 128
136 * booke_wdt_open: 129static int booke_wdt_open(struct inode *inode, struct file *file)
137 */
138static int booke_wdt_open (struct inode *inode, struct file *file)
139{ 130{
131 spin_lock(&booke_wdt_lock);
140 if (booke_wdt_enabled == 0) { 132 if (booke_wdt_enabled == 0) {
141 booke_wdt_enabled = 1; 133 booke_wdt_enabled = 1;
142 booke_wdt_enable(); 134 on_each_cpu(__booke_wdt_enable, NULL, 0, 0);
143 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", 135 printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled "
144 booke_wdt_period); 136 "(wdt_period=%d)\n", booke_wdt_period);
145 } 137 }
138 spin_unlock(&booke_wdt_lock);
146 139
147 return nonseekable_open(inode, file); 140 return nonseekable_open(inode, file);
148} 141}
149 142
150static const struct file_operations booke_wdt_fops = { 143static const struct file_operations booke_wdt_fops = {
151 .owner = THIS_MODULE, 144 .owner = THIS_MODULE,
152 .llseek = no_llseek, 145 .llseek = no_llseek,
153 .write = booke_wdt_write, 146 .write = booke_wdt_write,
154 .ioctl = booke_wdt_ioctl, 147 .ioctl = booke_wdt_ioctl,
155 .open = booke_wdt_open, 148 .open = booke_wdt_open,
156}; 149};
157 150
158static struct miscdevice booke_wdt_miscdev = { 151static struct miscdevice booke_wdt_miscdev = {
159 .minor = WATCHDOG_MINOR, 152 .minor = WATCHDOG_MINOR,
160 .name = "watchdog", 153 .name = "watchdog",
161 .fops = &booke_wdt_fops, 154 .fops = &booke_wdt_fops,
162}; 155};
163 156
164static void __exit booke_wdt_exit(void) 157static void __exit booke_wdt_exit(void)
@@ -166,28 +159,27 @@ static void __exit booke_wdt_exit(void)
166 misc_deregister(&booke_wdt_miscdev); 159 misc_deregister(&booke_wdt_miscdev);
167} 160}
168 161
169/*
170 * booke_wdt_init:
171 */
172static int __init booke_wdt_init(void) 162static int __init booke_wdt_init(void)
173{ 163{
174 int ret = 0; 164 int ret = 0;
175 165
176 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); 166 printk(KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n");
177 ident.firmware_version = cur_cpu_spec->pvr_value; 167 ident.firmware_version = cur_cpu_spec->pvr_value;
178 168
179 ret = misc_register(&booke_wdt_miscdev); 169 ret = misc_register(&booke_wdt_miscdev);
180 if (ret) { 170 if (ret) {
181 printk (KERN_CRIT "Cannot register miscdev on minor=%d (err=%d)\n", 171 printk(KERN_CRIT "Cannot register miscdev on minor=%d: %d\n",
182 WATCHDOG_MINOR, ret); 172 WATCHDOG_MINOR, ret);
183 return ret; 173 return ret;
184 } 174 }
185 175
176 spin_lock(&booke_wdt_lock);
186 if (booke_wdt_enabled == 1) { 177 if (booke_wdt_enabled == 1) {
187 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", 178 printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled "
188 booke_wdt_period); 179 "(wdt_period=%d)\n", booke_wdt_period);
189 booke_wdt_enable(); 180 on_each_cpu(__booke_wdt_enable, NULL, 0, 0);
190 } 181 }
182 spin_unlock(&booke_wdt_lock);
191 183
192 return ret; 184 return ret;
193} 185}
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
new file mode 100644
index 000000000000..30d09cbbad94
--- /dev/null
+++ b/drivers/watchdog/geodewdt.c
@@ -0,0 +1,308 @@
1/* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip
2 *
3 * Copyright (C) 2006-2007, Advanced Micro Devices, Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11
12#include <linux/module.h>
13#include <linux/moduleparam.h>
14#include <linux/types.h>
15#include <linux/miscdevice.h>
16#include <linux/watchdog.h>
17#include <linux/fs.h>
18#include <linux/platform_device.h>
19#include <linux/reboot.h>
20
21#include <asm/uaccess.h>
22#include <asm/geode.h>
23
24#define GEODEWDT_HZ 500
25#define GEODEWDT_SCALE 6
26#define GEODEWDT_MAX_SECONDS 131
27
28#define WDT_FLAGS_OPEN 1
29#define WDT_FLAGS_ORPHAN 2
30
31#define DRV_NAME "geodewdt"
32#define WATCHDOG_NAME "Geode GX/LX WDT"
33#define WATCHDOG_TIMEOUT 60
34
35static int timeout = WATCHDOG_TIMEOUT;
36module_param(timeout, int, 0);
37MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=131, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
38
39static int nowayout = WATCHDOG_NOWAYOUT;
40module_param(nowayout, int, 0);
41MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
42
43static struct platform_device *geodewdt_platform_device;
44static unsigned long wdt_flags;
45static int wdt_timer;
46static int safe_close;
47
48static void geodewdt_ping(void)
49{
50 /* Stop the counter */
51 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
52
53 /* Reset the counter */
54 geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
55
56 /* Enable the counter */
57 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
58}
59
60static void geodewdt_disable(void)
61{
62 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
63 geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
64}
65
66static int geodewdt_set_heartbeat(int val)
67{
68 if (val < 1 || val > GEODEWDT_MAX_SECONDS)
69 return -EINVAL;
70
71 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
72 geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ);
73 geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
74 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
75
76 timeout = val;
77 return 0;
78}
79
80static int
81geodewdt_open(struct inode *inode, struct file *file)
82{
83 if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags))
84 return -EBUSY;
85
86 if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags))
87 __module_get(THIS_MODULE);
88
89 geodewdt_ping();
90 return nonseekable_open(inode, file);
91}
92
93static int
94geodewdt_release(struct inode *inode, struct file *file)
95{
96 if (safe_close) {
97 geodewdt_disable();
98 module_put(THIS_MODULE);
99 }
100 else {
101 printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n");
102 geodewdt_ping();
103
104 set_bit(WDT_FLAGS_ORPHAN, &wdt_flags);
105 }
106
107 clear_bit(WDT_FLAGS_OPEN, &wdt_flags);
108 safe_close = 0;
109 return 0;
110}
111
112static ssize_t
113geodewdt_write(struct file *file, const char __user *data, size_t len,
114 loff_t *ppos)
115{
116 if(len) {
117 if (!nowayout) {
118 size_t i;
119 safe_close = 0;
120
121 for (i = 0; i != len; i++) {
122 char c;
123
124 if (get_user(c, data + i))
125 return -EFAULT;
126
127 if (c == 'V')
128 safe_close = 1;
129 }
130 }
131
132 geodewdt_ping();
133 }
134 return len;
135}
136
137static int
138geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
139 unsigned long arg)
140{
141 void __user *argp = (void __user *)arg;
142 int __user *p = argp;
143 int interval;
144
145 static struct watchdog_info ident = {
146 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING
147 | WDIOF_MAGICCLOSE,
148 .firmware_version = 1,
149 .identity = WATCHDOG_NAME,
150 };
151
152 switch(cmd) {
153 case WDIOC_GETSUPPORT:
154 return copy_to_user(argp, &ident,
155 sizeof(ident)) ? -EFAULT : 0;
156 break;
157
158 case WDIOC_GETSTATUS:
159 case WDIOC_GETBOOTSTATUS:
160 return put_user(0, p);
161
162 case WDIOC_KEEPALIVE:
163 geodewdt_ping();
164 return 0;
165
166 case WDIOC_SETTIMEOUT:
167 if (get_user(interval, p))
168 return -EFAULT;
169
170 if (geodewdt_set_heartbeat(interval))
171 return -EINVAL;
172
173/* Fall through */
174
175 case WDIOC_GETTIMEOUT:
176 return put_user(timeout, p);
177
178 case WDIOC_SETOPTIONS:
179 {
180 int options, ret = -EINVAL;
181
182 if (get_user(options, p))
183 return -EFAULT;
184
185 if (options & WDIOS_DISABLECARD) {
186 geodewdt_disable();
187 ret = 0;
188 }
189
190 if (options & WDIOS_ENABLECARD) {
191 geodewdt_ping();
192 ret = 0;
193 }
194
195 return ret;
196 }
197 default:
198 return -ENOTTY;
199 }
200
201 return 0;
202}
203
204static const struct file_operations geodewdt_fops = {
205 .owner = THIS_MODULE,
206 .llseek = no_llseek,
207 .write = geodewdt_write,
208 .ioctl = geodewdt_ioctl,
209 .open = geodewdt_open,
210 .release = geodewdt_release,
211};
212
213static struct miscdevice geodewdt_miscdev = {
214 .minor = WATCHDOG_MINOR,
215 .name = "watchdog",
216 .fops = &geodewdt_fops
217};
218
219static int __devinit
220geodewdt_probe(struct platform_device *dev)
221{
222 int ret, timer;
223
224 timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
225
226 if (timer == -1) {
227 printk(KERN_ERR "geodewdt: No timers were available\n");
228 return -ENODEV;
229 }
230
231 wdt_timer = timer;
232
233 /* Set up the timer */
234
235 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP,
236 GEODEWDT_SCALE | (3 << 8));
237
238 /* Set up comparator 2 to reset when the event fires */
239 geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1);
240
241 /* Set up the initial timeout */
242
243 geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2,
244 timeout * GEODEWDT_HZ);
245
246 ret = misc_register(&geodewdt_miscdev);
247
248 return ret;
249}
250
251static int __devexit
252geodewdt_remove(struct platform_device *dev)
253{
254 misc_deregister(&geodewdt_miscdev);
255 return 0;
256}
257
258static void
259geodewdt_shutdown(struct platform_device *dev)
260{
261 geodewdt_disable();
262}
263
264static struct platform_driver geodewdt_driver = {
265 .probe = geodewdt_probe,
266 .remove = __devexit_p(geodewdt_remove),
267 .shutdown = geodewdt_shutdown,
268 .driver = {
269 .owner = THIS_MODULE,
270 .name = DRV_NAME,
271 },
272};
273
274static int __init
275geodewdt_init(void)
276{
277 int ret;
278
279 ret = platform_driver_register(&geodewdt_driver);
280 if (ret)
281 return ret;
282
283 geodewdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
284 if (IS_ERR(geodewdt_platform_device)) {
285 ret = PTR_ERR(geodewdt_platform_device);
286 goto err;
287 }
288
289 return 0;
290err:
291 platform_driver_unregister(&geodewdt_driver);
292 return ret;
293}
294
295static void __exit
296geodewdt_exit(void)
297{
298 platform_device_unregister(geodewdt_platform_device);
299 platform_driver_unregister(&geodewdt_driver);
300}
301
302module_init(geodewdt_init);
303module_exit(geodewdt_exit);
304
305MODULE_AUTHOR("Advanced Micro Devices, Inc");
306MODULE_DESCRIPTION("Geode GX/LX Watchdog Driver");
307MODULE_LICENSE("GPL");
308MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 6483d1066b95..6a63535fc04d 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -418,23 +418,20 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
418 static unsigned long rom_pl; 418 static unsigned long rom_pl;
419 static int die_nmi_called; 419 static int die_nmi_called;
420 420
421 if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) 421 if (ulReason == DIE_NMI || ulReason == DIE_NMI_IPI) {
422 return NOTIFY_OK; 422 spin_lock_irqsave(&rom_lock, rom_pl);
423 423 if (!die_nmi_called)
424 spin_lock_irqsave(&rom_lock, rom_pl); 424 asminline_call(&cmn_regs, cru_rom_addr);
425 if (!die_nmi_called) 425 die_nmi_called = 1;
426 asminline_call(&cmn_regs, cru_rom_addr); 426 spin_unlock_irqrestore(&rom_lock, rom_pl);
427 die_nmi_called = 1; 427 if (cmn_regs.u1.ral != 0) {
428 spin_unlock_irqrestore(&rom_lock, rom_pl); 428 panic("An NMI occurred, please see the Integrated "
429 if (cmn_regs.u1.ral == 0) { 429 "Management Log for details.\n");
430 printk(KERN_WARNING "hpwdt: An NMI occurred, " 430 }
431 "but unable to determine source.\n");
432 } else {
433 panic("An NMI occurred, please see the Integrated "
434 "Management Log for details.\n");
435 } 431 }
436 432
437 return NOTIFY_STOP; 433 die_nmi_called = 0;
434 return NOTIFY_DONE;
438} 435}
439 436
440/* 437/*
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index a0e6809e369f..95ba985bd341 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -41,9 +41,10 @@
41 * 82801HH (ICH8DH) : document number 313056-003, 313057-009, 41 * 82801HH (ICH8DH) : document number 313056-003, 313057-009,
42 * 82801HO (ICH8DO) : document number 313056-003, 313057-009, 42 * 82801HO (ICH8DO) : document number 313056-003, 313057-009,
43 * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, 43 * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009,
44 * 82801IB (ICH9) : document number 316972-001, 316973-001, 44 * 82801IB (ICH9) : document number 316972-001, 316973-006,
45 * 82801IR (ICH9R) : document number 316972-001, 316973-001, 45 * 82801IR (ICH9R) : document number 316972-001, 316973-006,
46 * 82801IH (ICH9DH) : document number 316972-001, 316973-001, 46 * 82801IH (ICH9DH) : document number 316972-001, 316973-006,
47 * 82801IO (ICH9DO) : document number 316972-001, 316973-006,
47 * 6300ESB (6300ESB) : document number 300641-003, 300884-010, 48 * 6300ESB (6300ESB) : document number 300641-003, 300884-010,
48 * 631xESB (631xESB) : document number 313082-001, 313075-005, 49 * 631xESB (631xESB) : document number 313082-001, 313075-005,
49 * 632xESB (632xESB) : document number 313082-001, 313075-005 50 * 632xESB (632xESB) : document number 313082-001, 313075-005
@@ -55,8 +56,8 @@
55 56
56/* Module and version information */ 57/* Module and version information */
57#define DRV_NAME "iTCO_wdt" 58#define DRV_NAME "iTCO_wdt"
58#define DRV_VERSION "1.02" 59#define DRV_VERSION "1.03"
59#define DRV_RELDATE "26-Jul-2007" 60#define DRV_RELDATE "30-Apr-2008"
60#define PFX DRV_NAME ": " 61#define PFX DRV_NAME ": "
61 62
62/* Includes */ 63/* Includes */
@@ -104,6 +105,7 @@ enum iTCO_chipsets {
104 TCO_ICH9, /* ICH9 */ 105 TCO_ICH9, /* ICH9 */
105 TCO_ICH9R, /* ICH9R */ 106 TCO_ICH9R, /* ICH9R */
106 TCO_ICH9DH, /* ICH9DH */ 107 TCO_ICH9DH, /* ICH9DH */
108 TCO_ICH9DO, /* ICH9DO */
107 TCO_631XESB, /* 631xESB/632xESB */ 109 TCO_631XESB, /* 631xESB/632xESB */
108}; 110};
109 111
@@ -136,6 +138,7 @@ static struct {
136 {"ICH9", 2}, 138 {"ICH9", 2},
137 {"ICH9R", 2}, 139 {"ICH9R", 2},
138 {"ICH9DH", 2}, 140 {"ICH9DH", 2},
141 {"ICH9DO", 2},
139 {"631xESB/632xESB", 2}, 142 {"631xESB/632xESB", 2},
140 {NULL,0} 143 {NULL,0}
141}; 144};
@@ -181,6 +184,7 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
181 { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, 184 { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )},
182 { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, 185 { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )},
183 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, 186 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )},
187 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4, TCO_ICH9DO )},
184 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, 188 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)},
185 { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, 189 { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)},
186 { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, 190 { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)},
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index c622a0e6c9ae..528b882420b6 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -44,6 +44,7 @@
44#define WATCHDOG_NAME "w83697hf/hg WDT" 44#define WATCHDOG_NAME "w83697hf/hg WDT"
45#define PFX WATCHDOG_NAME ": " 45#define PFX WATCHDOG_NAME ": "
46#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ 46#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
47#define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */
47 48
48static unsigned long wdt_is_open; 49static unsigned long wdt_is_open;
49static char expect_close; 50static char expect_close;
@@ -56,12 +57,16 @@ MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect)
56 57
57static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ 58static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
58module_param(timeout, int, 0); 59module_param(timeout, int, 0);
59MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 60MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
60 61
61static int nowayout = WATCHDOG_NOWAYOUT; 62static int nowayout = WATCHDOG_NOWAYOUT;
62module_param(nowayout, int, 0); 63module_param(nowayout, int, 0);
63MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 64MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
64 65
66static int early_disable = WATCHDOG_EARLY_DISABLE;
67module_param(early_disable, int, 0);
68MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")");
69
65/* 70/*
66 * Kernel methods. 71 * Kernel methods.
67 */ 72 */
@@ -140,7 +145,7 @@ w83697hf_init(void)
140 w83697hf_deselect_wdt(); 145 w83697hf_deselect_wdt();
141} 146}
142 147
143static int 148static void
144wdt_ping(void) 149wdt_ping(void)
145{ 150{
146 spin_lock(&io_lock); 151 spin_lock(&io_lock);
@@ -150,10 +155,9 @@ wdt_ping(void)
150 155
151 w83697hf_deselect_wdt(); 156 w83697hf_deselect_wdt();
152 spin_unlock(&io_lock); 157 spin_unlock(&io_lock);
153 return 0;
154} 158}
155 159
156static int 160static void
157wdt_enable(void) 161wdt_enable(void)
158{ 162{
159 spin_lock(&io_lock); 163 spin_lock(&io_lock);
@@ -164,10 +168,9 @@ wdt_enable(void)
164 168
165 w83697hf_deselect_wdt(); 169 w83697hf_deselect_wdt();
166 spin_unlock(&io_lock); 170 spin_unlock(&io_lock);
167 return 0;
168} 171}
169 172
170static int 173static void
171wdt_disable(void) 174wdt_disable(void)
172{ 175{
173 spin_lock(&io_lock); 176 spin_lock(&io_lock);
@@ -178,7 +181,22 @@ wdt_disable(void)
178 181
179 w83697hf_deselect_wdt(); 182 w83697hf_deselect_wdt();
180 spin_unlock(&io_lock); 183 spin_unlock(&io_lock);
181 return 0; 184}
185
186static unsigned char
187wdt_running(void)
188{
189 unsigned char t;
190
191 spin_lock(&io_lock);
192 w83697hf_select_wdt();
193
194 t = w83697hf_get_reg(0xF4); /* Read timer */
195
196 w83697hf_deselect_wdt();
197 spin_unlock(&io_lock);
198
199 return t;
182} 200}
183 201
184static int 202static int
@@ -397,7 +415,11 @@ wdt_init(void)
397 } 415 }
398 416
399 w83697hf_init(); 417 w83697hf_init();
400 wdt_disable(); /* Disable watchdog until first use */ 418 if (early_disable) {
419 if (wdt_running())
420 printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n");
421 wdt_disable();
422 }
401 423
402 if (wdt_set_heartbeat(timeout)) { 424 if (wdt_set_heartbeat(timeout)) {
403 wdt_set_heartbeat(WATCHDOG_TIMEOUT); 425 wdt_set_heartbeat(WATCHDOG_TIMEOUT);
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 26e07df783b9..c3bbd6af996d 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -22,6 +22,21 @@
22 22
23#include <linux/list.h> 23#include <linux/list.h>
24 24
25/**
26 * struct v9fs_dentry - 9p private data stored in dentry d_fsdata
27 * @lock: protects the fidlist
28 * @fidlist: list of FIDs currently associated with this dentry
29 *
30 * This structure defines the 9p private data associated with
31 * a particular dentry. In particular, this private data is used
32 * to lookup which 9P FID handle should be used for a particular VFS
33 * operation. FID handles are associated with dentries instead of
34 * inodes in order to more closely map functionality to the Plan 9
35 * expected behavior for FID reclaimation and tracking.
36 *
37 * See Also: Mapping FIDs to Linux VFS model in
38 * Design and Implementation of the Linux 9P File System documentation
39 */
25struct v9fs_dentry { 40struct v9fs_dentry {
26 spinlock_t lock; /* protect fidlist */ 41 spinlock_t lock; /* protect fidlist */
27 struct list_head fidlist; 42 struct list_head fidlist;
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 9b0f0222e8bb..047c791427aa 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -71,19 +71,19 @@ static match_table_t tokens = {
71 71
72/** 72/**
73 * v9fs_parse_options - parse mount options into session structure 73 * v9fs_parse_options - parse mount options into session structure
74 * @options: options string passed from mount
75 * @v9ses: existing v9fs session information 74 * @v9ses: existing v9fs session information
76 * 75 *
76 * Return 0 upon success, -ERRNO upon failure.
77 */ 77 */
78 78
79static void v9fs_parse_options(struct v9fs_session_info *v9ses) 79static int v9fs_parse_options(struct v9fs_session_info *v9ses)
80{ 80{
81 char *options; 81 char *options;
82 substring_t args[MAX_OPT_ARGS]; 82 substring_t args[MAX_OPT_ARGS];
83 char *p; 83 char *p;
84 int option = 0; 84 int option = 0;
85 char *s, *e; 85 char *s, *e;
86 int ret; 86 int ret = 0;
87 87
88 /* setup defaults */ 88 /* setup defaults */
89 v9ses->afid = ~0; 89 v9ses->afid = ~0;
@@ -91,19 +91,26 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
91 v9ses->cache = 0; 91 v9ses->cache = 0;
92 92
93 if (!v9ses->options) 93 if (!v9ses->options)
94 return; 94 return 0;
95 95
96 options = kstrdup(v9ses->options, GFP_KERNEL); 96 options = kstrdup(v9ses->options, GFP_KERNEL);
97 if (!options) {
98 P9_DPRINTK(P9_DEBUG_ERROR,
99 "failed to allocate copy of option string\n");
100 return -ENOMEM;
101 }
102
97 while ((p = strsep(&options, ",")) != NULL) { 103 while ((p = strsep(&options, ",")) != NULL) {
98 int token; 104 int token;
99 if (!*p) 105 if (!*p)
100 continue; 106 continue;
101 token = match_token(p, tokens, args); 107 token = match_token(p, tokens, args);
102 if (token < Opt_uname) { 108 if (token < Opt_uname) {
103 ret = match_int(&args[0], &option); 109 int r = match_int(&args[0], &option);
104 if (ret < 0) { 110 if (r < 0) {
105 P9_DPRINTK(P9_DEBUG_ERROR, 111 P9_DPRINTK(P9_DEBUG_ERROR,
106 "integer field, but no integer?\n"); 112 "integer field, but no integer?\n");
113 ret = r;
107 continue; 114 continue;
108 } 115 }
109 } 116 }
@@ -125,10 +132,10 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
125 v9ses->afid = option; 132 v9ses->afid = option;
126 break; 133 break;
127 case Opt_uname: 134 case Opt_uname:
128 match_strcpy(v9ses->uname, &args[0]); 135 match_strlcpy(v9ses->uname, &args[0], PATH_MAX);
129 break; 136 break;
130 case Opt_remotename: 137 case Opt_remotename:
131 match_strcpy(v9ses->aname, &args[0]); 138 match_strlcpy(v9ses->aname, &args[0], PATH_MAX);
132 break; 139 break;
133 case Opt_nodevmap: 140 case Opt_nodevmap:
134 v9ses->nodev = 1; 141 v9ses->nodev = 1;
@@ -139,6 +146,13 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
139 146
140 case Opt_access: 147 case Opt_access:
141 s = match_strdup(&args[0]); 148 s = match_strdup(&args[0]);
149 if (!s) {
150 P9_DPRINTK(P9_DEBUG_ERROR,
151 "failed to allocate copy"
152 " of option argument\n");
153 ret = -ENOMEM;
154 break;
155 }
142 v9ses->flags &= ~V9FS_ACCESS_MASK; 156 v9ses->flags &= ~V9FS_ACCESS_MASK;
143 if (strcmp(s, "user") == 0) 157 if (strcmp(s, "user") == 0)
144 v9ses->flags |= V9FS_ACCESS_USER; 158 v9ses->flags |= V9FS_ACCESS_USER;
@@ -158,6 +172,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
158 } 172 }
159 } 173 }
160 kfree(options); 174 kfree(options);
175 return ret;
161} 176}
162 177
163/** 178/**
@@ -173,6 +188,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
173{ 188{
174 int retval = -EINVAL; 189 int retval = -EINVAL;
175 struct p9_fid *fid; 190 struct p9_fid *fid;
191 int rc;
176 192
177 v9ses->uname = __getname(); 193 v9ses->uname = __getname();
178 if (!v9ses->uname) 194 if (!v9ses->uname)
@@ -190,8 +206,21 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
190 v9ses->uid = ~0; 206 v9ses->uid = ~0;
191 v9ses->dfltuid = V9FS_DEFUID; 207 v9ses->dfltuid = V9FS_DEFUID;
192 v9ses->dfltgid = V9FS_DEFGID; 208 v9ses->dfltgid = V9FS_DEFGID;
193 v9ses->options = kstrdup(data, GFP_KERNEL); 209 if (data) {
194 v9fs_parse_options(v9ses); 210 v9ses->options = kstrdup(data, GFP_KERNEL);
211 if (!v9ses->options) {
212 P9_DPRINTK(P9_DEBUG_ERROR,
213 "failed to allocate copy of option string\n");
214 retval = -ENOMEM;
215 goto error;
216 }
217 }
218
219 rc = v9fs_parse_options(v9ses);
220 if (rc < 0) {
221 retval = rc;
222 goto error;
223 }
195 224
196 v9ses->clnt = p9_client_create(dev_name, v9ses->options); 225 v9ses->clnt = p9_client_create(dev_name, v9ses->options);
197 226
@@ -233,7 +262,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
233 return fid; 262 return fid;
234 263
235error: 264error:
236 v9fs_session_close(v9ses);
237 return ERR_PTR(retval); 265 return ERR_PTR(retval);
238} 266}
239 267
@@ -256,9 +284,12 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
256} 284}
257 285
258/** 286/**
259 * v9fs_session_cancel - mark transport as disconnected 287 * v9fs_session_cancel - terminate a session
260 * and cancel all pending requests. 288 * @v9ses: session to terminate
289 *
290 * mark transport as disconnected and cancel all pending requests.
261 */ 291 */
292
262void v9fs_session_cancel(struct v9fs_session_info *v9ses) { 293void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
263 P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses); 294 P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
264 p9_client_disconnect(v9ses->clnt); 295 p9_client_disconnect(v9ses->clnt);
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 7d3a1018db52..a7d567192998 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -21,18 +21,69 @@
21 * 21 *
22 */ 22 */
23 23
24/* 24/**
25 * Session structure provides information for an opened session 25 * enum p9_session_flags - option flags for each 9P session
26 * 26 * @V9FS_EXTENDED: whether or not to use 9P2000.u extensions
27 */ 27 * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy
28 * @V9FS_ACCESS_USER: a new attach will be issued for every user (default)
29 * @V9FS_ACCESS_ANY: use a single attach for all users
30 * @V9FS_ACCESS_MASK: bit mask of different ACCESS options
31 *
32 * Session flags reflect options selected by users at mount time
33 */
34enum p9_session_flags {
35 V9FS_EXTENDED = 0x01,
36 V9FS_ACCESS_SINGLE = 0x02,
37 V9FS_ACCESS_USER = 0x04,
38 V9FS_ACCESS_ANY = 0x06,
39 V9FS_ACCESS_MASK = 0x06,
40};
41
42/* possible values of ->cache */
43/**
44 * enum p9_cache_modes - user specified cache preferences
45 * @CACHE_NONE: do not cache data, dentries, or directory contents (default)
46 * @CACHE_LOOSE: cache data, dentries, and directory contents w/no consistency
47 *
48 * eventually support loose, tight, time, session, default always none
49 */
50
51enum p9_cache_modes {
52 CACHE_NONE,
53 CACHE_LOOSE,
54};
55
56/**
57 * struct v9fs_session_info - per-instance session information
58 * @flags: session options of type &p9_session_flags
59 * @nodev: set to 1 to disable device mapping
60 * @debug: debug level
61 * @afid: authentication handle
62 * @cache: cache mode of type &p9_cache_modes
63 * @options: copy of options string given by user
64 * @uname: string user name to mount hierarchy as
65 * @aname: mount specifier for remote hierarchy
66 * @maxdata: maximum data to be sent/recvd per protocol message
67 * @dfltuid: default numeric userid to mount hierarchy as
68 * @dfltgid: default numeric groupid to mount hierarchy as
69 * @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy
70 * @clnt: reference to 9P network client instantiated for this session
71 * @debugfs_dir: reference to debugfs_dir which can be used for add'l debug
72 *
73 * This structure holds state for each session instance established during
74 * a sys_mount() .
75 *
76 * Bugs: there seems to be a lot of state which could be condensed and/or
77 * removed.
78 */
28 79
29struct v9fs_session_info { 80struct v9fs_session_info {
30 /* options */ 81 /* options */
31 unsigned char flags; /* session flags */ 82 unsigned char flags;
32 unsigned char nodev; /* set to 1 if no disable device mapping */ 83 unsigned char nodev;
33 unsigned short debug; /* debug level */ 84 unsigned short debug;
34 unsigned int afid; /* authentication fid */ 85 unsigned int afid;
35 unsigned int cache; /* cache mode */ 86 unsigned int cache;
36 87
37 char *options; /* copy of mount options */ 88 char *options; /* copy of mount options */
38 char *uname; /* user name to mount as */ 89 char *uname; /* user name to mount as */
@@ -45,22 +96,6 @@ struct v9fs_session_info {
45 struct dentry *debugfs_dir; 96 struct dentry *debugfs_dir;
46}; 97};
47 98
48/* session flags */
49enum {
50 V9FS_EXTENDED = 0x01, /* 9P2000.u */
51 V9FS_ACCESS_MASK = 0x06, /* access mask */
52 V9FS_ACCESS_SINGLE = 0x02, /* only one user can access the files */
53 V9FS_ACCESS_USER = 0x04, /* attache per user */
54 V9FS_ACCESS_ANY = 0x06, /* use the same attach for all users */
55};
56
57/* possible values of ->cache */
58/* eventually support loose, tight, time, session, default always none */
59enum {
60 CACHE_NONE, /* default */
61 CACHE_LOOSE, /* no consistency */
62};
63
64extern struct dentry *v9fs_debugfs_root; 99extern struct dentry *v9fs_debugfs_root;
65 100
66struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, 101struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 6248f0e727a3..97d3aed57983 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -43,7 +43,7 @@
43/** 43/**
44 * v9fs_vfs_readpage - read an entire page in from 9P 44 * v9fs_vfs_readpage - read an entire page in from 9P
45 * 45 *
46 * @file: file being read 46 * @filp: file being read
47 * @page: structure to page 47 * @page: structure to page
48 * 48 *
49 */ 49 */
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 0924d4477da3..88e3787c6ea9 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -60,7 +60,7 @@ static inline int dt_type(struct p9_stat *mistat)
60 60
61/** 61/**
62 * v9fs_dir_readdir - read a directory 62 * v9fs_dir_readdir - read a directory
63 * @filep: opened file structure 63 * @filp: opened file structure
64 * @dirent: directory structure ??? 64 * @dirent: directory structure ???
65 * @filldir: function to populate directory structure ??? 65 * @filldir: function to populate directory structure ???
66 * 66 *
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index a616fff8906d..0d55affe37d4 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -90,10 +90,11 @@ int v9fs_file_open(struct inode *inode, struct file *file)
90 90
91/** 91/**
92 * v9fs_file_lock - lock a file (or directory) 92 * v9fs_file_lock - lock a file (or directory)
93 * @inode: inode to be opened 93 * @filp: file to be locked
94 * @file: file being opened 94 * @cmd: lock command
95 * @fl: file lock structure
95 * 96 *
96 * XXX - this looks like a local only lock, we should extend into 9P 97 * Bugs: this looks like a local only lock, we should extend into 9P
97 * by using open exclusive 98 * by using open exclusive
98 */ 99 */
99 100
@@ -118,7 +119,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
118 119
119/** 120/**
120 * v9fs_file_read - read from a file 121 * v9fs_file_read - read from a file
121 * @filep: file pointer to read 122 * @filp: file pointer to read
122 * @data: data buffer to read data into 123 * @data: data buffer to read data into
123 * @count: size of buffer 124 * @count: size of buffer
124 * @offset: offset at which to read data 125 * @offset: offset at which to read data
@@ -142,7 +143,7 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count,
142 143
143/** 144/**
144 * v9fs_file_write - write to a file 145 * v9fs_file_write - write to a file
145 * @filep: file pointer to write 146 * @filp: file pointer to write
146 * @data: data buffer to write data from 147 * @data: data buffer to write data from
147 * @count: size of buffer 148 * @count: size of buffer
148 * @offset: offset at which to write data 149 * @offset: offset at which to write data
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 6a28842052ea..40fa807bd929 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -129,6 +129,12 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode)
129 return res; 129 return res;
130} 130}
131 131
132/**
133 * v9fs_uflags2omode- convert posix open flags to plan 9 mode bits
134 * @uflags: flags to convert
135 *
136 */
137
132int v9fs_uflags2omode(int uflags) 138int v9fs_uflags2omode(int uflags)
133{ 139{
134 int ret; 140 int ret;
@@ -312,6 +318,14 @@ error:
312} 318}
313*/ 319*/
314 320
321/**
322 * v9fs_inode_from_fid - populate an inode by issuing a attribute request
323 * @v9ses: session information
324 * @fid: fid to issue attribute request for
325 * @sb: superblock on which to create inode
326 *
327 */
328
315static struct inode * 329static struct inode *
316v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, 330v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
317 struct super_block *sb) 331 struct super_block *sb)
@@ -384,9 +398,12 @@ v9fs_open_created(struct inode *inode, struct file *file)
384 398
385/** 399/**
386 * v9fs_create - Create a file 400 * v9fs_create - Create a file
401 * @v9ses: session information
402 * @dir: directory that dentry is being created in
387 * @dentry: dentry that is being created 403 * @dentry: dentry that is being created
388 * @perm: create permissions 404 * @perm: create permissions
389 * @mode: open mode 405 * @mode: open mode
406 * @extension: 9p2000.u extension string to support devices, etc.
390 * 407 *
391 */ 408 */
392static struct p9_fid * 409static struct p9_fid *
@@ -461,7 +478,7 @@ error:
461 478
462/** 479/**
463 * v9fs_vfs_create - VFS hook to create files 480 * v9fs_vfs_create - VFS hook to create files
464 * @inode: directory inode that is being created 481 * @dir: directory inode that is being created
465 * @dentry: dentry that is being deleted 482 * @dentry: dentry that is being deleted
466 * @mode: create permissions 483 * @mode: create permissions
467 * @nd: path information 484 * @nd: path information
@@ -519,7 +536,7 @@ error:
519 536
520/** 537/**
521 * v9fs_vfs_mkdir - VFS mkdir hook to create a directory 538 * v9fs_vfs_mkdir - VFS mkdir hook to create a directory
522 * @inode: inode that is being unlinked 539 * @dir: inode that is being unlinked
523 * @dentry: dentry that is being unlinked 540 * @dentry: dentry that is being unlinked
524 * @mode: mode for new directory 541 * @mode: mode for new directory
525 * 542 *
@@ -703,9 +720,9 @@ done:
703 720
704/** 721/**
705 * v9fs_vfs_getattr - retrieve file metadata 722 * v9fs_vfs_getattr - retrieve file metadata
706 * @mnt - mount information 723 * @mnt: mount information
707 * @dentry - file to get attributes on 724 * @dentry: file to get attributes on
708 * @stat - metadata structure to populate 725 * @stat: metadata structure to populate
709 * 726 *
710 */ 727 */
711 728
@@ -928,7 +945,7 @@ done:
928/** 945/**
929 * v9fs_vfs_readlink - read a symlink's location 946 * v9fs_vfs_readlink - read a symlink's location
930 * @dentry: dentry for symlink 947 * @dentry: dentry for symlink
931 * @buf: buffer to load symlink location into 948 * @buffer: buffer to load symlink location into
932 * @buflen: length of buffer 949 * @buflen: length of buffer
933 * 950 *
934 */ 951 */
@@ -996,10 +1013,12 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
996 * v9fs_vfs_put_link - release a symlink path 1013 * v9fs_vfs_put_link - release a symlink path
997 * @dentry: dentry for symlink 1014 * @dentry: dentry for symlink
998 * @nd: nameidata 1015 * @nd: nameidata
1016 * @p: unused
999 * 1017 *
1000 */ 1018 */
1001 1019
1002static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) 1020static void
1021v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
1003{ 1022{
1004 char *s = nd_get_link(nd); 1023 char *s = nd_get_link(nd);
1005 1024
@@ -1008,6 +1027,15 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void
1008 __putname(s); 1027 __putname(s);
1009} 1028}
1010 1029
1030/**
1031 * v9fs_vfs_mkspecial - create a special file
1032 * @dir: inode to create special file in
1033 * @dentry: dentry to create
1034 * @mode: mode to create special file
1035 * @extension: 9p2000.u format extension string representing special file
1036 *
1037 */
1038
1011static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, 1039static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1012 int mode, const char *extension) 1040 int mode, const char *extension)
1013{ 1041{
@@ -1037,7 +1065,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1037 * @dentry: dentry for symlink 1065 * @dentry: dentry for symlink
1038 * @symname: symlink data 1066 * @symname: symlink data
1039 * 1067 *
1040 * See 9P2000.u RFC for more information 1068 * See Also: 9P2000.u RFC for more information
1041 * 1069 *
1042 */ 1070 */
1043 1071
@@ -1058,10 +1086,6 @@ v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1058 * 1086 *
1059 */ 1087 */
1060 1088
1061/* XXX - lots of code dup'd from symlink and creates,
1062 * figure out a better reuse strategy
1063 */
1064
1065static int 1089static int
1066v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, 1090v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1067 struct dentry *dentry) 1091 struct dentry *dentry)
@@ -1098,7 +1122,7 @@ clunk_fid:
1098 * @dir: inode destination for new link 1122 * @dir: inode destination for new link
1099 * @dentry: dentry for file 1123 * @dentry: dentry for file
1100 * @mode: mode for creation 1124 * @mode: mode for creation
1101 * @dev_t: device associated with special file 1125 * @rdev: device associated with special file
1102 * 1126 *
1103 */ 1127 */
1104 1128
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index a452ac67fc94..bf59c3960494 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -75,6 +75,7 @@ static int v9fs_set_super(struct super_block *s, void *data)
75 * v9fs_fill_super - populate superblock with info 75 * v9fs_fill_super - populate superblock with info
76 * @sb: superblock 76 * @sb: superblock
77 * @v9ses: session information 77 * @v9ses: session information
78 * @flags: flags propagated from v9fs_get_sb()
78 * 79 *
79 */ 80 */
80 81
@@ -127,29 +128,26 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
127 fid = v9fs_session_init(v9ses, dev_name, data); 128 fid = v9fs_session_init(v9ses, dev_name, data);
128 if (IS_ERR(fid)) { 129 if (IS_ERR(fid)) {
129 retval = PTR_ERR(fid); 130 retval = PTR_ERR(fid);
130 fid = NULL; 131 goto close_session;
131 kfree(v9ses);
132 v9ses = NULL;
133 goto error;
134 } 132 }
135 133
136 st = p9_client_stat(fid); 134 st = p9_client_stat(fid);
137 if (IS_ERR(st)) { 135 if (IS_ERR(st)) {
138 retval = PTR_ERR(st); 136 retval = PTR_ERR(st);
139 goto error; 137 goto clunk_fid;
140 } 138 }
141 139
142 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 140 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
143 if (IS_ERR(sb)) { 141 if (IS_ERR(sb)) {
144 retval = PTR_ERR(sb); 142 retval = PTR_ERR(sb);
145 goto error; 143 goto free_stat;
146 } 144 }
147 v9fs_fill_super(sb, v9ses, flags); 145 v9fs_fill_super(sb, v9ses, flags);
148 146
149 inode = v9fs_get_inode(sb, S_IFDIR | mode); 147 inode = v9fs_get_inode(sb, S_IFDIR | mode);
150 if (IS_ERR(inode)) { 148 if (IS_ERR(inode)) {
151 retval = PTR_ERR(inode); 149 retval = PTR_ERR(inode);
152 goto error; 150 goto release_sb;
153 } 151 }
154 152
155 inode->i_uid = uid; 153 inode->i_uid = uid;
@@ -158,7 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
158 root = d_alloc_root(inode); 156 root = d_alloc_root(inode);
159 if (!root) { 157 if (!root) {
160 retval = -ENOMEM; 158 retval = -ENOMEM;
161 goto error; 159 goto release_sb;
162 } 160 }
163 161
164 sb->s_root = root; 162 sb->s_root = root;
@@ -169,21 +167,22 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
169 167
170 return simple_set_mnt(mnt, sb); 168 return simple_set_mnt(mnt, sb);
171 169
172error: 170release_sb:
173 kfree(st);
174 if (fid)
175 p9_client_clunk(fid);
176
177 if (v9ses) {
178 v9fs_session_close(v9ses);
179 kfree(v9ses);
180 }
181
182 if (sb) { 171 if (sb) {
183 up_write(&sb->s_umount); 172 up_write(&sb->s_umount);
184 deactivate_super(sb); 173 deactivate_super(sb);
185 } 174 }
186 175
176free_stat:
177 kfree(st);
178
179clunk_fid:
180 p9_client_clunk(fid);
181
182close_session:
183 v9fs_session_close(v9ses);
184 kfree(v9ses);
185
187 return retval; 186 return retval;
188} 187}
189 188
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 55e8ee1900a5..3263084eef9e 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -42,7 +42,7 @@ config BINFMT_ELF_FDPIC
42 42
43config BINFMT_FLAT 43config BINFMT_FLAT
44 bool "Kernel support for flat binaries" 44 bool "Kernel support for flat binaries"
45 depends on !MMU 45 depends on !MMU && (!FRV || BROKEN)
46 help 46 help
47 Support uClinux FLAT format binaries. 47 Support uClinux FLAT format binaries.
48 48
diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index a78d5b236bb1..587ef5123cd8 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -8,7 +8,7 @@
8 * along with this program; if not, write to the Free Software 8 * along with this program; if not, write to the Free Software
9 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 9 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10 * 10 *
11 * Authors: David Woodhouse <dwmw2@cambridge.redhat.com> 11 * Authors: David Woodhouse <dwmw2@infradead.org>
12 * David Howells <dhowells@redhat.com> 12 * David Howells <dhowells@redhat.com>
13 * 13 *
14 */ 14 */
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 08db82e1343a..bb47217f6a18 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -8,7 +8,7 @@
8 * along with this program; if not, write to the Free Software 8 * along with this program; if not, write to the Free Software
9 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 9 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10 * 10 *
11 * Authors: David Woodhouse <dwmw2@cambridge.redhat.com> 11 * Authors: David Woodhouse <dwmw2@infradead.org>
12 * David Howells <dhowells@redhat.com> 12 * David Howells <dhowells@redhat.com>
13 * 13 *
14 */ 14 */
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 4b572b801d8d..7e3faeef6818 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -10,7 +10,7 @@
10 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 10 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
11 * 11 *
12 * Authors: David Howells <dhowells@redhat.com> 12 * Authors: David Howells <dhowells@redhat.com>
13 * David Woodhouse <dwmw2@redhat.com> 13 * David Woodhouse <dwmw2@infradead.org>
14 * 14 *
15 */ 15 */
16 16
diff --git a/fs/aio.c b/fs/aio.c
index b5253e77eb2f..0fb3117ddd93 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -591,10 +591,6 @@ static void use_mm(struct mm_struct *mm)
591 atomic_inc(&mm->mm_count); 591 atomic_inc(&mm->mm_count);
592 tsk->mm = mm; 592 tsk->mm = mm;
593 tsk->active_mm = mm; 593 tsk->active_mm = mm;
594 /*
595 * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise
596 * it won't work. Update it accordingly if you change it here
597 */
598 switch_mm(active_mm, mm, tsk); 594 switch_mm(active_mm, mm, tsk);
599 task_unlock(tsk); 595 task_unlock(tsk);
600 596
diff --git a/fs/befs/endian.h b/fs/befs/endian.h
index e254a20869f4..6cb84d896d05 100644
--- a/fs/befs/endian.h
+++ b/fs/befs/endian.h
@@ -9,7 +9,7 @@
9#ifndef LINUX_BEFS_ENDIAN 9#ifndef LINUX_BEFS_ENDIAN
10#define LINUX_BEFS_ENDIAN 10#define LINUX_BEFS_ENDIAN
11 11
12#include <linux/byteorder/generic.h> 12#include <asm/byteorder.h>
13 13
14static inline u64 14static inline u64
15fs64_to_cpu(const struct super_block *sb, fs64 n) 15fs64_to_cpu(const struct super_block *sb, fs64 n)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b25707fee2cc..0fa95b198e6e 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
256 return -EFAULT; 256 return -EFAULT;
257 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); 257 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
258 if (!len || len > MAX_ARG_STRLEN) 258 if (!len || len > MAX_ARG_STRLEN)
259 return 0; 259 return -EINVAL;
260 p += len; 260 p += len;
261 } 261 }
262 if (__put_user(0, argv)) 262 if (__put_user(0, argv))
@@ -268,7 +268,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
268 return -EFAULT; 268 return -EFAULT;
269 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); 269 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
270 if (!len || len > MAX_ARG_STRLEN) 270 if (!len || len > MAX_ARG_STRLEN)
271 return 0; 271 return -EINVAL;
272 p += len; 272 p += len;
273 } 273 }
274 if (__put_user(0, envp)) 274 if (__put_user(0, envp))
@@ -1900,7 +1900,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
1900 /* alloc memory for large data structures: too large to be on stack */ 1900 /* alloc memory for large data structures: too large to be on stack */
1901 elf = kmalloc(sizeof(*elf), GFP_KERNEL); 1901 elf = kmalloc(sizeof(*elf), GFP_KERNEL);
1902 if (!elf) 1902 if (!elf)
1903 goto cleanup; 1903 goto out;
1904 1904
1905 segs = current->mm->map_count; 1905 segs = current->mm->map_count;
1906#ifdef ELF_CORE_EXTRA_PHDRS 1906#ifdef ELF_CORE_EXTRA_PHDRS
@@ -2034,8 +2034,9 @@ end_coredump:
2034 set_fs(fs); 2034 set_fs(fs);
2035 2035
2036cleanup: 2036cleanup:
2037 kfree(elf);
2038 free_note_info(&info); 2037 free_note_info(&info);
2038 kfree(elf);
2039out:
2039 return has_dumped; 2040 return has_dumped;
2040} 2041}
2041 2042
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index ddd35d873391..d051a32e6270 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -390,7 +390,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
390 } 390 }
391 391
392 /* expand the stack mapping to use up the entire allocation granule */ 392 /* expand the stack mapping to use up the entire allocation granule */
393 fullsize = ksize((char *) current->mm->start_brk); 393 fullsize = kobjsize((char *) current->mm->start_brk);
394 if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size, 394 if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size,
395 fullsize, 0, 0))) 395 fullsize, 0, 0)))
396 stack_size = fullsize; 396 stack_size = fullsize;
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 3b40d45a3a16..2cb1acda3a82 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -548,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm,
548 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); 548 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
549 /* Remap to use all availabe slack region space */ 549 /* Remap to use all availabe slack region space */
550 if (realdatastart && (realdatastart < (unsigned long)-4096)) { 550 if (realdatastart && (realdatastart < (unsigned long)-4096)) {
551 reallen = ksize((void *)realdatastart); 551 reallen = kobjsize((void *)realdatastart);
552 if (reallen > len) { 552 if (reallen > len) {
553 realdatastart = do_mremap(realdatastart, len, 553 realdatastart = do_mremap(realdatastart, len,
554 reallen, MREMAP_FIXED, realdatastart); 554 reallen, MREMAP_FIXED, realdatastart);
@@ -600,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm,
600 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); 600 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
601 /* Remap to use all availabe slack region space */ 601 /* Remap to use all availabe slack region space */
602 if (textpos && (textpos < (unsigned long) -4096)) { 602 if (textpos && (textpos < (unsigned long) -4096)) {
603 reallen = ksize((void *)textpos); 603 reallen = kobjsize((void *)textpos);
604 if (reallen > len) { 604 if (reallen > len) {
605 textpos = do_mremap(textpos, len, reallen, 605 textpos = do_mremap(textpos, len, reallen,
606 MREMAP_FIXED, textpos); 606 MREMAP_FIXED, textpos);
@@ -683,7 +683,7 @@ static int load_flat_file(struct linux_binprm * bprm,
683 */ 683 */
684 current->mm->start_brk = datapos + data_len + bss_len; 684 current->mm->start_brk = datapos + data_len + bss_len;
685 current->mm->brk = (current->mm->start_brk + 3) & ~3; 685 current->mm->brk = (current->mm->start_brk + 3) & ~3;
686 current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len; 686 current->mm->context.end_brk = memp + kobjsize((void *) memp) - stack_len;
687 } 687 }
688 688
689 if (flags & FLAT_FLAG_KTRACE) 689 if (flags & FLAT_FLAG_KTRACE)
@@ -790,7 +790,7 @@ static int load_flat_file(struct linux_binprm * bprm,
790 790
791 /* zero the BSS, BRK and stack areas */ 791 /* zero the BSS, BRK and stack areas */
792 memset((void*)(datapos + data_len), 0, bss_len + 792 memset((void*)(datapos + data_len), 0, bss_len +
793 (memp + ksize((void *) memp) - stack_len - /* end brk */ 793 (memp + kobjsize((void *) memp) - stack_len - /* end brk */
794 libinfo->lib_list[id].start_brk) + /* start brk */ 794 libinfo->lib_list[id].start_brk) + /* start brk */
795 stack_len); 795 stack_len);
796 796
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 7d822fae7765..470c10ceb0fb 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -12,6 +12,7 @@
12#include <linux/kmod.h> 12#include <linux/kmod.h>
13#include <linux/major.h> 13#include <linux/major.h>
14#include <linux/smp_lock.h> 14#include <linux/smp_lock.h>
15#include <linux/device_cgroup.h>
15#include <linux/highmem.h> 16#include <linux/highmem.h>
16#include <linux/blkdev.h> 17#include <linux/blkdev.h>
17#include <linux/module.h> 18#include <linux/module.h>
@@ -928,9 +929,14 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
928{ 929{
929 struct module *owner = NULL; 930 struct module *owner = NULL;
930 struct gendisk *disk; 931 struct gendisk *disk;
931 int ret = -ENXIO; 932 int ret;
932 int part; 933 int part;
933 934
935 ret = devcgroup_inode_permission(bdev->bd_inode, file->f_mode);
936 if (ret != 0)
937 return ret;
938
939 ret = -ENXIO;
934 file->f_mapping = bdev->bd_inode->i_mapping; 940 file->f_mapping = bdev->bd_inode->i_mapping;
935 lock_kernel(); 941 lock_kernel();
936 disk = get_gendisk(bdev->bd_dev, &part); 942 disk = get_gendisk(bdev->bd_dev, &part);
diff --git a/fs/cifs/AUTHORS b/fs/cifs/AUTHORS
index 8848e4dfa026..9c136d7803d9 100644
--- a/fs/cifs/AUTHORS
+++ b/fs/cifs/AUTHORS
@@ -36,6 +36,7 @@ Miklos Szeredi
36Kazeon team for various fixes especially for 2.4 version. 36Kazeon team for various fixes especially for 2.4 version.
37Asser Ferno (Change Notify support) 37Asser Ferno (Change Notify support)
38Shaggy (Dave Kleikamp) for inumerable small fs suggestions and some good cleanup 38Shaggy (Dave Kleikamp) for inumerable small fs suggestions and some good cleanup
39Igor Mammedov (DFS support)
39 40
40Test case and Bug Report contributors 41Test case and Bug Report contributors
41------------------------------------- 42-------------------------------------
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 8355e918fddf..1f3465201fdf 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,5 +1,12 @@
1Version 1.53 1Version 1.53
2------------ 2------------
3DFS support added (Microsoft Distributed File System client support needed
4for referrals which enable a hierarchical name space among servers).
5Disable temporary caching of mode bits to servers which do not support
6storing of mode (e.g. Windows servers, when client mounts without cifsacl
7mount option) and add new "dynperm" mount option to enable temporary caching
8of mode (enable old behavior). Fix hang on mount caused when server crashes
9tcp session during negotiate protocol.
3 10
4Version 1.52 11Version 1.52
5------------ 12------------
@@ -12,7 +19,8 @@ Add ability to modify cifs acls for handling chmod (when mounted with
12cifsacl flag). Fix prefixpath path separator so we can handle mounts 19cifsacl flag). Fix prefixpath path separator so we can handle mounts
13with prefixpaths longer than one directory (one path component) when 20with prefixpaths longer than one directory (one path component) when
14mounted to Windows servers. Fix slow file open when cifsacl 21mounted to Windows servers. Fix slow file open when cifsacl
15enabled. 22enabled. Fix memory leak in FindNext when the SMB call returns -EBADF.
23
16 24
17Version 1.51 25Version 1.51
18------------ 26------------
diff --git a/fs/cifs/README b/fs/cifs/README
index 621aa1a85971..2bd6fe556f88 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -483,6 +483,11 @@ A partial list of the supported mount options follows:
483 sign Must use packet signing (helps avoid unwanted data modification 483 sign Must use packet signing (helps avoid unwanted data modification
484 by intermediate systems in the route). Note that signing 484 by intermediate systems in the route). Note that signing
485 does not work with lanman or plaintext authentication. 485 does not work with lanman or plaintext authentication.
486 seal Must seal (encrypt) all data on this mounted share before
487 sending on the network. Requires support for Unix Extensions.
488 Note that this differs from the sign mount option in that it
489 causes encryption of data sent over this mounted share but other
490 shares mounted to the same server are unaffected.
486 sec Security mode. Allowed values are: 491 sec Security mode. Allowed values are:
487 none attempt to connection as a null user (no name) 492 none attempt to connection as a null user (no name)
488 krb5 Use Kerberos version 5 authentication 493 krb5 Use Kerberos version 5 authentication
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index 92c9feac440f..5aff46c61e52 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -1,4 +1,4 @@
1Version 1.52 January 3, 2008 1Version 1.53 May 20, 2008
2 2
3A Partial List of Missing Features 3A Partial List of Missing Features
4================================== 4==================================
@@ -20,20 +20,21 @@ d) Cleanup now unneeded SessSetup code in
20fs/cifs/connect.c and add back in NTLMSSP code if any servers 20fs/cifs/connect.c and add back in NTLMSSP code if any servers
21need it 21need it
22 22
23e) ms-dfs and ms-dfs host name resolution cleanup 23e) fix NTLMv2 signing when two mounts with different users to same
24
25f) fix NTLMv2 signing when two mounts with different users to same
26server. 24server.
27 25
28g) Directory entry caching relies on a 1 second timer, rather than 26f) Directory entry caching relies on a 1 second timer, rather than
29using FindNotify or equivalent. - (started) 27using FindNotify or equivalent. - (started)
30 28
31h) quota support (needs minor kernel change since quota calls 29g) quota support (needs minor kernel change since quota calls
32to make it to network filesystems or deviceless filesystems) 30to make it to network filesystems or deviceless filesystems)
33 31
34i) investigate sync behavior (including syncpage) and check 32h) investigate sync behavior (including syncpage) and check
35for proper behavior of intr/nointr 33for proper behavior of intr/nointr
36 34
35i) improve support for very old servers (OS/2 and Win9x for example)
36Including support for changing the time remotely (utimes command).
37
37j) hook lower into the sockets api (as NFS/SunRPC does) to avoid the 38j) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
38extra copy in/out of the socket buffers in some cases. 39extra copy in/out of the socket buffers in some cases.
39 40
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index cb52cbbe45ff..f58e41d3ba48 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -186,6 +186,11 @@ asn1_length_decode(struct asn1_ctx *ctx, unsigned int *def, unsigned int *len)
186 } 186 }
187 } 187 }
188 } 188 }
189
190 /* don't trust len bigger than ctx buffer */
191 if (*len > ctx->end - ctx->pointer)
192 return 0;
193
189 return 1; 194 return 1;
190} 195}
191 196
@@ -203,6 +208,10 @@ asn1_header_decode(struct asn1_ctx *ctx,
203 if (!asn1_length_decode(ctx, &def, &len)) 208 if (!asn1_length_decode(ctx, &def, &len))
204 return 0; 209 return 0;
205 210
211 /* primitive shall be definite, indefinite shall be constructed */
212 if (*con == ASN1_PRI && !def)
213 return 0;
214
206 if (def) 215 if (def)
207 *eoc = ctx->pointer + len; 216 *eoc = ctx->pointer + len;
208 else 217 else
@@ -389,6 +398,11 @@ asn1_oid_decode(struct asn1_ctx *ctx,
389 unsigned long *optr; 398 unsigned long *optr;
390 399
391 size = eoc - ctx->pointer + 1; 400 size = eoc - ctx->pointer + 1;
401
402 /* first subid actually encodes first two subids */
403 if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
404 return 0;
405
392 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); 406 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
393 if (*oid == NULL) 407 if (*oid == NULL)
394 return 0; 408 return 0;
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index f6fdecf6598c..d82374c9e329 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -219,53 +219,6 @@ static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
219 219
220} 220}
221 221
222static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
223{
224 char *full_path = NULL;
225 char *search_path;
226 char *tmp_path;
227 size_t l_max_len;
228 struct cifs_sb_info *cifs_sb;
229
230 if (dentry->d_inode == NULL)
231 return NULL;
232
233 cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
234
235 if (cifs_sb->tcon == NULL)
236 return NULL;
237
238 search_path = build_path_from_dentry(dentry);
239 if (search_path == NULL)
240 return NULL;
241
242 if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) {
243 int i;
244 /* we should use full path name for correct working with DFS */
245 l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) +
246 strnlen(search_path, MAX_PATHCONF) + 1;
247 tmp_path = kmalloc(l_max_len, GFP_KERNEL);
248 if (tmp_path == NULL) {
249 kfree(search_path);
250 return NULL;
251 }
252 strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
253 tmp_path[l_max_len-1] = 0;
254 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
255 for (i = 0; i < l_max_len; i++) {
256 if (tmp_path[i] == '\\')
257 tmp_path[i] = '/';
258 }
259 strncat(tmp_path, search_path, l_max_len - strlen(tmp_path));
260
261 full_path = tmp_path;
262 kfree(search_path);
263 } else {
264 full_path = search_path;
265 }
266 return full_path;
267}
268
269static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd, 222static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
270 struct list_head *mntlist) 223 struct list_head *mntlist)
271{ 224{
@@ -333,7 +286,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
333 goto out_err; 286 goto out_err;
334 } 287 }
335 288
336 full_path = build_full_dfs_path_from_dentry(dentry); 289 full_path = build_path_from_dentry(dentry);
337 if (full_path == NULL) { 290 if (full_path == NULL) {
338 rc = -ENOMEM; 291 rc = -ENOMEM;
339 goto out_err; 292 goto out_err;
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
index 8ad2330ba061..877c85409f1f 100644
--- a/fs/cifs/cifs_fs_sb.h
+++ b/fs/cifs/cifs_fs_sb.h
@@ -30,6 +30,7 @@
30#define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */ 30#define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */
31#define CIFS_MOUNT_OVERR_UID 0x400 /* override uid returned from server */ 31#define CIFS_MOUNT_OVERR_UID 0x400 /* override uid returned from server */
32#define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */ 32#define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */
33#define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */
33 34
34struct cifs_sb_info { 35struct cifs_sb_info {
35 struct cifsTconInfo *tcon; /* primary mount */ 36 struct cifsTconInfo *tcon; /* primary mount */
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
index 6653e29637a7..7013aaff6aed 100644
--- a/fs/cifs/cifs_spnego.c
+++ b/fs/cifs/cifs_spnego.c
@@ -119,6 +119,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
119 dp = description + strlen(description); 119 dp = description + strlen(description);
120 sprintf(dp, ";uid=0x%x", sesInfo->linux_uid); 120 sprintf(dp, ";uid=0x%x", sesInfo->linux_uid);
121 121
122 dp = description + strlen(description);
123 sprintf(dp, ";user=%s", sesInfo->userName);
124
122 cFYI(1, ("key description = %s", description)); 125 cFYI(1, ("key description = %s", description));
123 spnego_key = request_key(&cifs_spnego_key_type, description, ""); 126 spnego_key = request_key(&cifs_spnego_key_type, description, "");
124 127
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 427a7c695896..86b4d5f405ae 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/cifsfs.c 2 * fs/cifs/cifsfs.c
3 * 3 *
4 * Copyright (C) International Business Machines Corp., 2002,2007 4 * Copyright (C) International Business Machines Corp., 2002,2008
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * Common Internet FileSystem (CIFS) client 7 * Common Internet FileSystem (CIFS) client
@@ -97,9 +97,6 @@ cifs_read_super(struct super_block *sb, void *data,
97{ 97{
98 struct inode *inode; 98 struct inode *inode;
99 struct cifs_sb_info *cifs_sb; 99 struct cifs_sb_info *cifs_sb;
100#ifdef CONFIG_CIFS_DFS_UPCALL
101 int len;
102#endif
103 int rc = 0; 100 int rc = 0;
104 101
105 /* BB should we make this contingent on mount parm? */ 102 /* BB should we make this contingent on mount parm? */
@@ -117,15 +114,17 @@ cifs_read_super(struct super_block *sb, void *data,
117 * complex operation (mount), and in case of fail 114 * complex operation (mount), and in case of fail
118 * just exit instead of doing mount and attempting 115 * just exit instead of doing mount and attempting
119 * undo it if this copy fails?*/ 116 * undo it if this copy fails?*/
120 len = strlen(data); 117 if (data) {
121 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); 118 int len = strlen(data);
122 if (cifs_sb->mountdata == NULL) { 119 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL);
123 kfree(sb->s_fs_info); 120 if (cifs_sb->mountdata == NULL) {
124 sb->s_fs_info = NULL; 121 kfree(sb->s_fs_info);
125 return -ENOMEM; 122 sb->s_fs_info = NULL;
123 return -ENOMEM;
124 }
125 strncpy(cifs_sb->mountdata, data, len + 1);
126 cifs_sb->mountdata[len] = '\0';
126 } 127 }
127 strncpy(cifs_sb->mountdata, data, len + 1);
128 cifs_sb->mountdata[len] = '\0';
129#endif 128#endif
130 129
131 rc = cifs_mount(sb, cifs_sb, data, devname); 130 rc = cifs_mount(sb, cifs_sb, data, devname);
@@ -353,9 +352,41 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
353 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) || 352 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) ||
354 !(cifs_sb->tcon->unix_ext)) 353 !(cifs_sb->tcon->unix_ext))
355 seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); 354 seq_printf(s, ",gid=%d", cifs_sb->mnt_gid);
355 if (!cifs_sb->tcon->unix_ext) {
356 seq_printf(s, ",file_mode=0%o,dir_mode=0%o",
357 cifs_sb->mnt_file_mode,
358 cifs_sb->mnt_dir_mode);
359 }
360 if (cifs_sb->tcon->seal)
361 seq_printf(s, ",seal");
362 if (cifs_sb->tcon->nocase)
363 seq_printf(s, ",nocase");
364 if (cifs_sb->tcon->retry)
365 seq_printf(s, ",hard");
356 } 366 }
357 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) 367 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
358 seq_printf(s, ",posixpaths"); 368 seq_printf(s, ",posixpaths");
369 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)
370 seq_printf(s, ",setuids");
371 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
372 seq_printf(s, ",serverino");
373 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
374 seq_printf(s, ",directio");
375 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
376 seq_printf(s, ",nouser_xattr");
377 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
378 seq_printf(s, ",mapchars");
379 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)
380 seq_printf(s, ",sfu");
381 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
382 seq_printf(s, ",nobrl");
383 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
384 seq_printf(s, ",cifsacl");
385 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)
386 seq_printf(s, ",dynperm");
387 if (m->mnt_sb->s_flags & MS_POSIXACL)
388 seq_printf(s, ",acl");
389
359 seq_printf(s, ",rsize=%d", cifs_sb->rsize); 390 seq_printf(s, ",rsize=%d", cifs_sb->rsize);
360 seq_printf(s, ",wsize=%d", cifs_sb->wsize); 391 seq_printf(s, ",wsize=%d", cifs_sb->wsize);
361 } 392 }
@@ -657,7 +688,7 @@ const struct file_operations cifs_file_ops = {
657 .splice_read = generic_file_splice_read, 688 .splice_read = generic_file_splice_read,
658 .llseek = cifs_llseek, 689 .llseek = cifs_llseek,
659#ifdef CONFIG_CIFS_POSIX 690#ifdef CONFIG_CIFS_POSIX
660 .ioctl = cifs_ioctl, 691 .unlocked_ioctl = cifs_ioctl,
661#endif /* CONFIG_CIFS_POSIX */ 692#endif /* CONFIG_CIFS_POSIX */
662 693
663#ifdef CONFIG_CIFS_EXPERIMENTAL 694#ifdef CONFIG_CIFS_EXPERIMENTAL
@@ -677,7 +708,7 @@ const struct file_operations cifs_file_direct_ops = {
677 .flush = cifs_flush, 708 .flush = cifs_flush,
678 .splice_read = generic_file_splice_read, 709 .splice_read = generic_file_splice_read,
679#ifdef CONFIG_CIFS_POSIX 710#ifdef CONFIG_CIFS_POSIX
680 .ioctl = cifs_ioctl, 711 .unlocked_ioctl = cifs_ioctl,
681#endif /* CONFIG_CIFS_POSIX */ 712#endif /* CONFIG_CIFS_POSIX */
682 .llseek = cifs_llseek, 713 .llseek = cifs_llseek,
683#ifdef CONFIG_CIFS_EXPERIMENTAL 714#ifdef CONFIG_CIFS_EXPERIMENTAL
@@ -697,7 +728,7 @@ const struct file_operations cifs_file_nobrl_ops = {
697 .splice_read = generic_file_splice_read, 728 .splice_read = generic_file_splice_read,
698 .llseek = cifs_llseek, 729 .llseek = cifs_llseek,
699#ifdef CONFIG_CIFS_POSIX 730#ifdef CONFIG_CIFS_POSIX
700 .ioctl = cifs_ioctl, 731 .unlocked_ioctl = cifs_ioctl,
701#endif /* CONFIG_CIFS_POSIX */ 732#endif /* CONFIG_CIFS_POSIX */
702 733
703#ifdef CONFIG_CIFS_EXPERIMENTAL 734#ifdef CONFIG_CIFS_EXPERIMENTAL
@@ -716,7 +747,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
716 .flush = cifs_flush, 747 .flush = cifs_flush,
717 .splice_read = generic_file_splice_read, 748 .splice_read = generic_file_splice_read,
718#ifdef CONFIG_CIFS_POSIX 749#ifdef CONFIG_CIFS_POSIX
719 .ioctl = cifs_ioctl, 750 .unlocked_ioctl = cifs_ioctl,
720#endif /* CONFIG_CIFS_POSIX */ 751#endif /* CONFIG_CIFS_POSIX */
721 .llseek = cifs_llseek, 752 .llseek = cifs_llseek,
722#ifdef CONFIG_CIFS_EXPERIMENTAL 753#ifdef CONFIG_CIFS_EXPERIMENTAL
@@ -731,7 +762,7 @@ const struct file_operations cifs_dir_ops = {
731#ifdef CONFIG_CIFS_EXPERIMENTAL 762#ifdef CONFIG_CIFS_EXPERIMENTAL
732 .dir_notify = cifs_dir_notify, 763 .dir_notify = cifs_dir_notify,
733#endif /* CONFIG_CIFS_EXPERIMENTAL */ 764#endif /* CONFIG_CIFS_EXPERIMENTAL */
734 .ioctl = cifs_ioctl, 765 .unlocked_ioctl = cifs_ioctl,
735}; 766};
736 767
737static void 768static void
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index cd1301a09b3b..25a6cbd15529 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -95,8 +95,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
95 size_t, int); 95 size_t, int);
96extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); 96extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
97extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); 97extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
98extern int cifs_ioctl(struct inode *inode, struct file *filep, 98extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
99 unsigned int command, unsigned long arg);
100 99
101#ifdef CONFIG_CIFS_EXPERIMENTAL 100#ifdef CONFIG_CIFS_EXPERIMENTAL
102extern const struct export_operations cifs_export_ops; 101extern const struct export_operations cifs_export_ops;
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index b7d9f698e63e..9cfcf326ead3 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -281,6 +281,7 @@ struct cifsTconInfo {
281 bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ 281 bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */
282 bool retry:1; 282 bool retry:1;
283 bool nocase:1; 283 bool nocase:1;
284 bool seal:1; /* transport encryption for this mounted share */
284 bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol 285 bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol
285 for this mount even if server would support */ 286 for this mount even if server would support */
286 /* BB add field for back pointer to sb struct(s)? */ 287 /* BB add field for back pointer to sb struct(s)? */
@@ -332,7 +333,6 @@ struct cifsFileInfo {
332 bool messageMode:1; /* for pipes: message vs byte mode */ 333 bool messageMode:1; /* for pipes: message vs byte mode */
333 atomic_t wrtPending; /* handle in use - defer close */ 334 atomic_t wrtPending; /* handle in use - defer close */
334 struct semaphore fh_sem; /* prevents reopen race after dead ses*/ 335 struct semaphore fh_sem; /* prevents reopen race after dead ses*/
335 char *search_resume_name; /* BB removeme BB */
336 struct cifs_search_info srch_inf; 336 struct cifs_search_info srch_inf;
337}; 337};
338 338
@@ -625,7 +625,7 @@ GLOBAL_EXTERN atomic_t tcpSesAllocCount;
625GLOBAL_EXTERN atomic_t tcpSesReconnectCount; 625GLOBAL_EXTERN atomic_t tcpSesReconnectCount;
626GLOBAL_EXTERN atomic_t tconInfoReconnectCount; 626GLOBAL_EXTERN atomic_t tconInfoReconnectCount;
627 627
628/* Various Debug counters to remove someday (BB) */ 628/* Various Debug counters */
629GLOBAL_EXTERN atomic_t bufAllocCount; /* current number allocated */ 629GLOBAL_EXTERN atomic_t bufAllocCount; /* current number allocated */
630#ifdef CONFIG_CIFS_STATS2 630#ifdef CONFIG_CIFS_STATS2
631GLOBAL_EXTERN atomic_t totBufAllocCount; /* total allocated over all time */ 631GLOBAL_EXTERN atomic_t totBufAllocCount; /* total allocated over all time */
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index a0d26b540d4e..0f327c224da3 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -79,6 +79,19 @@
79#define TRANS2_GET_DFS_REFERRAL 0x10 79#define TRANS2_GET_DFS_REFERRAL 0x10
80#define TRANS2_REPORT_DFS_INCOSISTENCY 0x11 80#define TRANS2_REPORT_DFS_INCOSISTENCY 0x11
81 81
82/* SMB Transact (Named Pipe) subcommand codes */
83#define TRANS_SET_NMPIPE_STATE 0x0001
84#define TRANS_RAW_READ_NMPIPE 0x0011
85#define TRANS_QUERY_NMPIPE_STATE 0x0021
86#define TRANS_QUERY_NMPIPE_INFO 0x0022
87#define TRANS_PEEK_NMPIPE 0x0023
88#define TRANS_TRANSACT_NMPIPE 0x0026
89#define TRANS_RAW_WRITE_NMPIPE 0x0031
90#define TRANS_READ_NMPIPE 0x0036
91#define TRANS_WRITE_NMPIPE 0x0037
92#define TRANS_WAIT_NMPIPE 0x0053
93#define TRANS_CALL_NMPIPE 0x0054
94
82/* NT Transact subcommand codes */ 95/* NT Transact subcommand codes */
83#define NT_TRANSACT_CREATE 0x01 96#define NT_TRANSACT_CREATE 0x01
84#define NT_TRANSACT_IOCTL 0x02 97#define NT_TRANSACT_IOCTL 0x02
@@ -328,18 +341,20 @@
328#define CREATE_COMPLETE_IF_OPLK 0x00000100 /* should be zero */ 341#define CREATE_COMPLETE_IF_OPLK 0x00000100 /* should be zero */
329#define CREATE_NO_EA_KNOWLEDGE 0x00000200 342#define CREATE_NO_EA_KNOWLEDGE 0x00000200
330#define CREATE_EIGHT_DOT_THREE 0x00000400 /* doc says this is obsolete 343#define CREATE_EIGHT_DOT_THREE 0x00000400 /* doc says this is obsolete
331 open for recovery flag - should 344 "open for recovery" flag - should
332 be zero */ 345 be zero in any case */
346#define CREATE_OPEN_FOR_RECOVERY 0x00000400
333#define CREATE_RANDOM_ACCESS 0x00000800 347#define CREATE_RANDOM_ACCESS 0x00000800
334#define CREATE_DELETE_ON_CLOSE 0x00001000 348#define CREATE_DELETE_ON_CLOSE 0x00001000
335#define CREATE_OPEN_BY_ID 0x00002000 349#define CREATE_OPEN_BY_ID 0x00002000
336#define CREATE_OPEN_BACKUP_INTN 0x00004000 350#define CREATE_OPEN_BACKUP_INTENT 0x00004000
337#define CREATE_NO_COMPRESSION 0x00008000 351#define CREATE_NO_COMPRESSION 0x00008000
338#define CREATE_RESERVE_OPFILTER 0x00100000 /* should be zero */ 352#define CREATE_RESERVE_OPFILTER 0x00100000 /* should be zero */
339#define OPEN_REPARSE_POINT 0x00200000 353#define OPEN_REPARSE_POINT 0x00200000
340#define OPEN_NO_RECALL 0x00400000 354#define OPEN_NO_RECALL 0x00400000
341#define OPEN_FREE_SPACE_QUERY 0x00800000 /* should be zero */ 355#define OPEN_FREE_SPACE_QUERY 0x00800000 /* should be zero */
342#define CREATE_OPTIONS_MASK 0x007FFFFF 356#define CREATE_OPTIONS_MASK 0x007FFFFF
357#define CREATE_OPTION_READONLY 0x10000000
343#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ 358#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */
344 359
345/* ImpersonationLevel flags */ 360/* ImpersonationLevel flags */
@@ -721,7 +736,6 @@ typedef struct smb_com_tconx_rsp_ext {
721#define SMB_CSC_CACHE_AUTO_REINT 0x0004 736#define SMB_CSC_CACHE_AUTO_REINT 0x0004
722#define SMB_CSC_CACHE_VDO 0x0008 737#define SMB_CSC_CACHE_VDO 0x0008
723#define SMB_CSC_NO_CACHING 0x000C 738#define SMB_CSC_NO_CACHING 0x000C
724
725#define SMB_UNIQUE_FILE_NAME 0x0010 739#define SMB_UNIQUE_FILE_NAME 0x0010
726#define SMB_EXTENDED_SIGNATURES 0x0020 740#define SMB_EXTENDED_SIGNATURES 0x0020
727 741
@@ -805,7 +819,7 @@ typedef struct smb_com_findclose_req {
805#define ICOUNT_MASK 0x00FF 819#define ICOUNT_MASK 0x00FF
806#define PIPE_READ_MODE 0x0100 820#define PIPE_READ_MODE 0x0100
807#define NAMED_PIPE_TYPE 0x0400 821#define NAMED_PIPE_TYPE 0x0400
808#define PIPE_END_POINT 0x0800 822#define PIPE_END_POINT 0x4000
809#define BLOCKING_NAMED_PIPE 0x8000 823#define BLOCKING_NAMED_PIPE 0x8000
810 824
811typedef struct smb_com_open_req { /* also handles create */ 825typedef struct smb_com_open_req { /* also handles create */
@@ -1903,19 +1917,26 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
1903 char RequestFileName[1]; 1917 char RequestFileName[1];
1904} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; 1918} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
1905 1919
1920#define DFS_VERSION cpu_to_le16(0x0003)
1921
1922/* DFS server target type */
1923#define DFS_TYPE_LINK 0x0000 /* also for sysvol targets */
1924#define DFS_TYPE_ROOT 0x0001
1925
1926/* Referral Entry Flags */
1927#define DFS_NAME_LIST_REF 0x0200
1928
1906typedef struct dfs_referral_level_3 { 1929typedef struct dfs_referral_level_3 {
1907 __le16 VersionNumber; 1930 __le16 VersionNumber;
1908 __le16 ReferralSize; 1931 __le16 Size;
1909 __le16 ServerType; /* 0x0001 = CIFS server */ 1932 __le16 ServerType; /* 0x0001 = root targets; 0x0000 = link targets */
1910 __le16 ReferralFlags; /* or proximity - not clear which since it is 1933 __le16 ReferralEntryFlags; /* 0x0200 bit set only for domain
1911 always set to zero - SNIA spec says 0x01 1934 or DC referral responce */
1912 means strip off PathConsumed chars before 1935 __le32 TimeToLive;
1913 submitting RequestFileName to remote node */
1914 __le16 TimeToLive;
1915 __le16 Proximity;
1916 __le16 DfsPathOffset; 1936 __le16 DfsPathOffset;
1917 __le16 DfsAlternatePathOffset; 1937 __le16 DfsAlternatePathOffset;
1918 __le16 NetworkAddressOffset; 1938 __le16 NetworkAddressOffset; /* offset of the link target */
1939 __le16 ServiceSiteGuid;
1919} __attribute__((packed)) REFERRAL3; 1940} __attribute__((packed)) REFERRAL3;
1920 1941
1921typedef struct smb_com_transaction_get_dfs_refer_rsp { 1942typedef struct smb_com_transaction_get_dfs_refer_rsp {
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index d481f6c5a2be..b9f5e935f821 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -93,7 +93,7 @@ extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
93 93
94extern int cifs_get_inode_info(struct inode **pinode, 94extern int cifs_get_inode_info(struct inode **pinode,
95 const unsigned char *search_path, 95 const unsigned char *search_path,
96 FILE_ALL_INFO * pfile_info, 96 FILE_ALL_INFO *pfile_info,
97 struct super_block *sb, int xid, const __u16 *pfid); 97 struct super_block *sb, int xid, const __u16 *pfid);
98extern int cifs_get_inode_info_unix(struct inode **pinode, 98extern int cifs_get_inode_info_unix(struct inode **pinode,
99 const unsigned char *search_path, 99 const unsigned char *search_path,
@@ -130,7 +130,7 @@ extern int CIFSFindClose(const int, struct cifsTconInfo *tcon,
130 130
131extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, 131extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
132 const unsigned char *searchName, 132 const unsigned char *searchName,
133 FILE_ALL_INFO * findData, 133 FILE_ALL_INFO *findData,
134 int legacy /* whether to use old info level */, 134 int legacy /* whether to use old info level */,
135 const struct nls_table *nls_codepage, int remap); 135 const struct nls_table *nls_codepage, int remap);
136extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, 136extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
@@ -141,18 +141,15 @@ extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
141extern int CIFSSMBUnixQPathInfo(const int xid, 141extern int CIFSSMBUnixQPathInfo(const int xid,
142 struct cifsTconInfo *tcon, 142 struct cifsTconInfo *tcon,
143 const unsigned char *searchName, 143 const unsigned char *searchName,
144 FILE_UNIX_BASIC_INFO * pFindData, 144 FILE_UNIX_BASIC_INFO *pFindData,
145 const struct nls_table *nls_codepage, int remap); 145 const struct nls_table *nls_codepage, int remap);
146 146
147extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, 147extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
148 const unsigned char *searchName, 148 const unsigned char *searchName,
149 unsigned char **targetUNCs, 149 struct dfs_info3_param **target_nodes,
150 unsigned int *number_of_UNC_in_array, 150 unsigned int *number_of_nodes_in_array,
151 const struct nls_table *nls_codepage, int remap); 151 const struct nls_table *nls_codepage, int remap);
152 152
153extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
154 const char *old_path,
155 const struct nls_table *nls_codepage, int remap);
156extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, 153extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
157 const char *old_path, 154 const char *old_path,
158 const struct nls_table *nls_codepage, 155 const struct nls_table *nls_codepage,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index cfd9750852b3..4511b708f0f3 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -81,6 +81,40 @@ static struct {
81#endif /* CONFIG_CIFS_WEAK_PW_HASH */ 81#endif /* CONFIG_CIFS_WEAK_PW_HASH */
82#endif /* CIFS_POSIX */ 82#endif /* CIFS_POSIX */
83 83
84/* Allocates buffer into dst and copies smb string from src to it.
85 * caller is responsible for freeing dst if function returned 0.
86 * returns:
87 * on success - 0
88 * on failure - errno
89 */
90static int
91cifs_strncpy_to_host(char **dst, const char *src, const int maxlen,
92 const bool is_unicode, const struct nls_table *nls_codepage)
93{
94 int plen;
95
96 if (is_unicode) {
97 plen = UniStrnlen((wchar_t *)src, maxlen);
98 *dst = kmalloc(plen + 2, GFP_KERNEL);
99 if (!*dst)
100 goto cifs_strncpy_to_host_ErrExit;
101 cifs_strfromUCS_le(*dst, (__le16 *)src, plen, nls_codepage);
102 } else {
103 plen = strnlen(src, maxlen);
104 *dst = kmalloc(plen + 2, GFP_KERNEL);
105 if (!*dst)
106 goto cifs_strncpy_to_host_ErrExit;
107 strncpy(*dst, src, plen);
108 }
109 (*dst)[plen] = 0;
110 (*dst)[plen+1] = 0; /* harmless for ASCII case, needed for Unicode */
111 return 0;
112
113cifs_strncpy_to_host_ErrExit:
114 cERROR(1, ("Failed to allocate buffer for string\n"));
115 return -ENOMEM;
116}
117
84 118
85/* Mark as invalid, all open files on tree connections since they 119/* Mark as invalid, all open files on tree connections since they
86 were closed when session to server was lost */ 120 were closed when session to server was lost */
@@ -1166,6 +1200,20 @@ static __u16 convert_disposition(int disposition)
1166 return ofun; 1200 return ofun;
1167} 1201}
1168 1202
1203static int
1204access_flags_to_smbopen_mode(const int access_flags)
1205{
1206 int masked_flags = access_flags & (GENERIC_READ | GENERIC_WRITE);
1207
1208 if (masked_flags == GENERIC_READ)
1209 return SMBOPEN_READ;
1210 else if (masked_flags == GENERIC_WRITE)
1211 return SMBOPEN_WRITE;
1212
1213 /* just go for read/write */
1214 return SMBOPEN_READWRITE;
1215}
1216
1169int 1217int
1170SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, 1218SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
1171 const char *fileName, const int openDisposition, 1219 const char *fileName, const int openDisposition,
@@ -1207,13 +1255,7 @@ OldOpenRetry:
1207 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); 1255 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK);
1208 1256
1209 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); 1257 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO);
1210 /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ 1258 pSMB->Mode = cpu_to_le16(access_flags_to_smbopen_mode(access_flags));
1211 /* 0 = read
1212 1 = write
1213 2 = rw
1214 3 = execute
1215 */
1216 pSMB->Mode = cpu_to_le16(2);
1217 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */ 1259 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */
1218 /* set file as system file if special file such 1260 /* set file as system file if special file such
1219 as fifo and server expecting SFU style and 1261 as fifo and server expecting SFU style and
@@ -1224,11 +1266,8 @@ OldOpenRetry:
1224 else /* BB FIXME BB */ 1266 else /* BB FIXME BB */
1225 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); 1267 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/);
1226 1268
1227 /* if ((omode & S_IWUGO) == 0) 1269 if (create_options & CREATE_OPTION_READONLY)
1228 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ 1270 pSMB->FileAttributes |= cpu_to_le16(ATTR_READONLY);
1229 /* Above line causes problems due to vfs splitting create into two
1230 pieces - need to set mode after file created not while it is
1231 being created */
1232 1271
1233 /* BB FIXME BB */ 1272 /* BB FIXME BB */
1234/* pSMB->CreateOptions = cpu_to_le32(create_options & 1273/* pSMB->CreateOptions = cpu_to_le32(create_options &
@@ -1250,7 +1289,7 @@ OldOpenRetry:
1250 } else { 1289 } else {
1251 /* BB verify if wct == 15 */ 1290 /* BB verify if wct == 15 */
1252 1291
1253/* *pOplock = pSMBr->OplockLevel; */ /* BB take from action field BB */ 1292/* *pOplock = pSMBr->OplockLevel; */ /* BB take from action field*/
1254 1293
1255 *netfid = pSMBr->Fid; /* cifs fid stays in le */ 1294 *netfid = pSMBr->Fid; /* cifs fid stays in le */
1256 /* Let caller know file was created so we can set the mode. */ 1295 /* Let caller know file was created so we can set the mode. */
@@ -1331,17 +1370,16 @@ openRetry:
1331 pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM); 1370 pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM);
1332 else 1371 else
1333 pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); 1372 pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL);
1373
1334 /* XP does not handle ATTR_POSIX_SEMANTICS */ 1374 /* XP does not handle ATTR_POSIX_SEMANTICS */
1335 /* but it helps speed up case sensitive checks for other 1375 /* but it helps speed up case sensitive checks for other
1336 servers such as Samba */ 1376 servers such as Samba */
1337 if (tcon->ses->capabilities & CAP_UNIX) 1377 if (tcon->ses->capabilities & CAP_UNIX)
1338 pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS); 1378 pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS);
1339 1379
1340 /* if ((omode & S_IWUGO) == 0) 1380 if (create_options & CREATE_OPTION_READONLY)
1341 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ 1381 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);
1342 /* Above line causes problems due to vfs splitting create into two 1382
1343 pieces - need to set mode after file created not while it is
1344 being created */
1345 pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); 1383 pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL);
1346 pSMB->CreateDisposition = cpu_to_le32(openDisposition); 1384 pSMB->CreateDisposition = cpu_to_le32(openDisposition);
1347 pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); 1385 pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK);
@@ -1690,7 +1728,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1690{ 1728{
1691 int rc = 0; 1729 int rc = 0;
1692 LOCK_REQ *pSMB = NULL; 1730 LOCK_REQ *pSMB = NULL;
1693 LOCK_RSP *pSMBr = NULL; 1731/* LOCK_RSP *pSMBr = NULL; */ /* No response data other than rc to parse */
1694 int bytes_returned; 1732 int bytes_returned;
1695 int timeout = 0; 1733 int timeout = 0;
1696 __u16 count; 1734 __u16 count;
@@ -1701,8 +1739,6 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1701 if (rc) 1739 if (rc)
1702 return rc; 1740 return rc;
1703 1741
1704 pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */
1705
1706 if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { 1742 if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
1707 timeout = CIFS_ASYNC_OP; /* no response expected */ 1743 timeout = CIFS_ASYNC_OP; /* no response expected */
1708 pSMB->Timeout = 0; 1744 pSMB->Timeout = 0;
@@ -1736,7 +1772,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1736 1772
1737 if (waitFlag) { 1773 if (waitFlag) {
1738 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB, 1774 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
1739 (struct smb_hdr *) pSMBr, &bytes_returned); 1775 (struct smb_hdr *) pSMB, &bytes_returned);
1740 cifs_small_buf_release(pSMB); 1776 cifs_small_buf_release(pSMB);
1741 } else { 1777 } else {
1742 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *)pSMB, 1778 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *)pSMB,
@@ -1771,7 +1807,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1771 cFYI(1, ("Posix Lock")); 1807 cFYI(1, ("Posix Lock"));
1772 1808
1773 if (pLockData == NULL) 1809 if (pLockData == NULL)
1774 return EINVAL; 1810 return -EINVAL;
1775 1811
1776 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); 1812 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
1777 1813
@@ -1948,7 +1984,7 @@ renameRetry:
1948 /* protocol requires ASCII signature byte on Unicode string */ 1984 /* protocol requires ASCII signature byte on Unicode string */
1949 pSMB->OldFileName[name_len + 1] = 0x00; 1985 pSMB->OldFileName[name_len + 1] = 0x00;
1950 name_len2 = 1986 name_len2 =
1951 cifsConvertToUCS((__le16 *) &pSMB->OldFileName[name_len + 2], 1987 cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
1952 toName, PATH_MAX, nls_codepage, remap); 1988 toName, PATH_MAX, nls_codepage, remap);
1953 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1989 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1954 name_len2 *= 2; /* convert to bytes */ 1990 name_len2 *= 2; /* convert to bytes */
@@ -2121,8 +2157,7 @@ copyRetry:
2121 cFYI(1, ("Send error in copy = %d with %d files copied", 2157 cFYI(1, ("Send error in copy = %d with %d files copied",
2122 rc, le16_to_cpu(pSMBr->CopyCount))); 2158 rc, le16_to_cpu(pSMBr->CopyCount)));
2123 } 2159 }
2124 if (pSMB) 2160 cifs_buf_release(pSMB);
2125 cifs_buf_release(pSMB);
2126 2161
2127 if (rc == -EAGAIN) 2162 if (rc == -EAGAIN)
2128 goto copyRetry; 2163 goto copyRetry;
@@ -2211,8 +2246,7 @@ createSymLinkRetry:
2211 if (rc) 2246 if (rc)
2212 cFYI(1, ("Send error in SetPathInfo create symlink = %d", rc)); 2247 cFYI(1, ("Send error in SetPathInfo create symlink = %d", rc));
2213 2248
2214 if (pSMB) 2249 cifs_buf_release(pSMB);
2215 cifs_buf_release(pSMB);
2216 2250
2217 if (rc == -EAGAIN) 2251 if (rc == -EAGAIN)
2218 goto createSymLinkRetry; 2252 goto createSymLinkRetry;
@@ -2929,7 +2963,8 @@ setAclRetry:
2929 } 2963 }
2930 params = 6 + name_len; 2964 params = 6 + name_len;
2931 pSMB->MaxParameterCount = cpu_to_le16(2); 2965 pSMB->MaxParameterCount = cpu_to_le16(2);
2932 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ 2966 /* BB find max SMB size from sess */
2967 pSMB->MaxDataCount = cpu_to_le16(1000);
2933 pSMB->MaxSetupCount = 0; 2968 pSMB->MaxSetupCount = 0;
2934 pSMB->Reserved = 0; 2969 pSMB->Reserved = 0;
2935 pSMB->Flags = 0; 2970 pSMB->Flags = 0;
@@ -3326,7 +3361,8 @@ QPathInfoRetry:
3326 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 3361 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
3327 pSMB->TotalDataCount = 0; 3362 pSMB->TotalDataCount = 0;
3328 pSMB->MaxParameterCount = cpu_to_le16(2); 3363 pSMB->MaxParameterCount = cpu_to_le16(2);
3329 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 3364 /* BB find exact max SMB PDU from sess structure BB */
3365 pSMB->MaxDataCount = cpu_to_le16(4000);
3330 pSMB->MaxSetupCount = 0; 3366 pSMB->MaxSetupCount = 0;
3331 pSMB->Reserved = 0; 3367 pSMB->Reserved = 0;
3332 pSMB->Flags = 0; 3368 pSMB->Flags = 0;
@@ -3392,7 +3428,7 @@ QPathInfoRetry:
3392int 3428int
3393CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, 3429CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
3394 const unsigned char *searchName, 3430 const unsigned char *searchName,
3395 FILE_UNIX_BASIC_INFO * pFindData, 3431 FILE_UNIX_BASIC_INFO *pFindData,
3396 const struct nls_table *nls_codepage, int remap) 3432 const struct nls_table *nls_codepage, int remap)
3397{ 3433{
3398/* SMB_QUERY_FILE_UNIX_BASIC */ 3434/* SMB_QUERY_FILE_UNIX_BASIC */
@@ -3683,6 +3719,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
3683 if (rc) { 3719 if (rc) {
3684 if (rc == -EBADF) { 3720 if (rc == -EBADF) {
3685 psrch_inf->endOfSearch = true; 3721 psrch_inf->endOfSearch = true;
3722 cifs_buf_release(pSMB);
3686 rc = 0; /* search probably was closed at end of search*/ 3723 rc = 0; /* search probably was closed at end of search*/
3687 } else 3724 } else
3688 cFYI(1, ("FindNext returned = %d", rc)); 3725 cFYI(1, ("FindNext returned = %d", rc));
@@ -3860,25 +3897,112 @@ GetInodeNumOut:
3860 return rc; 3897 return rc;
3861} 3898}
3862 3899
3900/* parses DFS refferal V3 structure
3901 * caller is responsible for freeing target_nodes
3902 * returns:
3903 * on success - 0
3904 * on failure - errno
3905 */
3906static int
3907parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3908 unsigned int *num_of_nodes,
3909 struct dfs_info3_param **target_nodes,
3910 const struct nls_table *nls_codepage)
3911{
3912 int i, rc = 0;
3913 char *data_end;
3914 bool is_unicode;
3915 struct dfs_referral_level_3 *ref;
3916
3917 is_unicode = pSMBr->hdr.Flags2 & SMBFLG2_UNICODE;
3918 *num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals);
3919
3920 if (*num_of_nodes < 1) {
3921 cERROR(1, ("num_referrals: must be at least > 0,"
3922 "but we get num_referrals = %d\n", *num_of_nodes));
3923 rc = -EINVAL;
3924 goto parse_DFS_referrals_exit;
3925 }
3926
3927 ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals);
3928 if (ref->VersionNumber != cpu_to_le16(3)) {
3929 cERROR(1, ("Referrals of V%d version are not supported,"
3930 "should be V3", le16_to_cpu(ref->VersionNumber)));
3931 rc = -EINVAL;
3932 goto parse_DFS_referrals_exit;
3933 }
3934
3935 /* get the upper boundary of the resp buffer */
3936 data_end = (char *)(&(pSMBr->PathConsumed)) +
3937 le16_to_cpu(pSMBr->t2.DataCount);
3938
3939 cFYI(1, ("num_referrals: %d dfs flags: 0x%x ... \n",
3940 *num_of_nodes,
3941 le16_to_cpu(pSMBr->DFSFlags)));
3942
3943 *target_nodes = kzalloc(sizeof(struct dfs_info3_param) *
3944 *num_of_nodes, GFP_KERNEL);
3945 if (*target_nodes == NULL) {
3946 cERROR(1, ("Failed to allocate buffer for target_nodes\n"));
3947 rc = -ENOMEM;
3948 goto parse_DFS_referrals_exit;
3949 }
3950
3951 /* collect neccessary data from referrals */
3952 for (i = 0; i < *num_of_nodes; i++) {
3953 char *temp;
3954 int max_len;
3955 struct dfs_info3_param *node = (*target_nodes)+i;
3956
3957 node->flags = le16_to_cpu(pSMBr->DFSFlags);
3958 node->path_consumed = le16_to_cpu(pSMBr->PathConsumed);
3959 node->server_type = le16_to_cpu(ref->ServerType);
3960 node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags);
3961
3962 /* copy DfsPath */
3963 temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset);
3964 max_len = data_end - temp;
3965 rc = cifs_strncpy_to_host(&(node->path_name), temp,
3966 max_len, is_unicode, nls_codepage);
3967 if (rc)
3968 goto parse_DFS_referrals_exit;
3969
3970 /* copy link target UNC */
3971 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset);
3972 max_len = data_end - temp;
3973 rc = cifs_strncpy_to_host(&(node->node_name), temp,
3974 max_len, is_unicode, nls_codepage);
3975 if (rc)
3976 goto parse_DFS_referrals_exit;
3977
3978 ref += le16_to_cpu(ref->Size);
3979 }
3980
3981parse_DFS_referrals_exit:
3982 if (rc) {
3983 free_dfs_info_array(*target_nodes, *num_of_nodes);
3984 *target_nodes = NULL;
3985 *num_of_nodes = 0;
3986 }
3987 return rc;
3988}
3989
3863int 3990int
3864CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, 3991CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
3865 const unsigned char *searchName, 3992 const unsigned char *searchName,
3866 unsigned char **targetUNCs, 3993 struct dfs_info3_param **target_nodes,
3867 unsigned int *number_of_UNC_in_array, 3994 unsigned int *num_of_nodes,
3868 const struct nls_table *nls_codepage, int remap) 3995 const struct nls_table *nls_codepage, int remap)
3869{ 3996{
3870/* TRANS2_GET_DFS_REFERRAL */ 3997/* TRANS2_GET_DFS_REFERRAL */
3871 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; 3998 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL;
3872 TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL; 3999 TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL;
3873 struct dfs_referral_level_3 *referrals = NULL;
3874 int rc = 0; 4000 int rc = 0;
3875 int bytes_returned; 4001 int bytes_returned;
3876 int name_len; 4002 int name_len;
3877 unsigned int i;
3878 char *temp;
3879 __u16 params, byte_count; 4003 __u16 params, byte_count;
3880 *number_of_UNC_in_array = 0; 4004 *num_of_nodes = 0;
3881 *targetUNCs = NULL; 4005 *target_nodes = NULL;
3882 4006
3883 cFYI(1, ("In GetDFSRefer the path %s", searchName)); 4007 cFYI(1, ("In GetDFSRefer the path %s", searchName));
3884 if (ses == NULL) 4008 if (ses == NULL)
@@ -3925,7 +4049,8 @@ getDFSRetry:
3925 pSMB->DataCount = 0; 4049 pSMB->DataCount = 0;
3926 pSMB->DataOffset = 0; 4050 pSMB->DataOffset = 0;
3927 pSMB->MaxParameterCount = 0; 4051 pSMB->MaxParameterCount = 0;
3928 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 4052 /* BB find exact max SMB PDU from sess structure BB */
4053 pSMB->MaxDataCount = cpu_to_le16(4000);
3929 pSMB->MaxSetupCount = 0; 4054 pSMB->MaxSetupCount = 0;
3930 pSMB->Reserved = 0; 4055 pSMB->Reserved = 0;
3931 pSMB->Flags = 0; 4056 pSMB->Flags = 0;
@@ -3947,103 +4072,26 @@ getDFSRetry:
3947 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 4072 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
3948 if (rc) { 4073 if (rc) {
3949 cFYI(1, ("Send error in GetDFSRefer = %d", rc)); 4074 cFYI(1, ("Send error in GetDFSRefer = %d", rc));
3950 } else { /* decode response */ 4075 goto GetDFSRefExit;
3951/* BB Add logic to parse referrals here */ 4076 }
3952 rc = validate_t2((struct smb_t2_rsp *)pSMBr); 4077 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
3953 4078
3954 /* BB Also check if enough total bytes returned? */ 4079 /* BB Also check if enough total bytes returned? */
3955 if (rc || (pSMBr->ByteCount < 17)) 4080 if (rc || (pSMBr->ByteCount < 17)) {
3956 rc = -EIO; /* bad smb */ 4081 rc = -EIO; /* bad smb */
3957 else { 4082 goto GetDFSRefExit;
3958 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 4083 }
3959 __u16 data_count = le16_to_cpu(pSMBr->t2.DataCount);
3960 4084
3961 cFYI(1, 4085 cFYI(1, ("Decoding GetDFSRefer response BCC: %d Offset %d",
3962 ("Decoding GetDFSRefer response BCC: %d Offset %d", 4086 pSMBr->ByteCount,
3963 pSMBr->ByteCount, data_offset)); 4087 le16_to_cpu(pSMBr->t2.DataOffset)));
3964 referrals =
3965 (struct dfs_referral_level_3 *)
3966 (8 /* sizeof start of data block */ +
3967 data_offset +
3968 (char *) &pSMBr->hdr.Protocol);
3969 cFYI(1, ("num_referrals: %d dfs flags: 0x%x ... \n"
3970 "for referral one refer size: 0x%x srv "
3971 "type: 0x%x refer flags: 0x%x ttl: 0x%x",
3972 le16_to_cpu(pSMBr->NumberOfReferrals),
3973 le16_to_cpu(pSMBr->DFSFlags),
3974 le16_to_cpu(referrals->ReferralSize),
3975 le16_to_cpu(referrals->ServerType),
3976 le16_to_cpu(referrals->ReferralFlags),
3977 le16_to_cpu(referrals->TimeToLive)));
3978 /* BB This field is actually two bytes in from start of
3979 data block so we could do safety check that DataBlock
3980 begins at address of pSMBr->NumberOfReferrals */
3981 *number_of_UNC_in_array =
3982 le16_to_cpu(pSMBr->NumberOfReferrals);
3983
3984 /* BB Fix below so can return more than one referral */
3985 if (*number_of_UNC_in_array > 1)
3986 *number_of_UNC_in_array = 1;
3987
3988 /* get the length of the strings describing refs */
3989 name_len = 0;
3990 for (i = 0; i < *number_of_UNC_in_array; i++) {
3991 /* make sure that DfsPathOffset not past end */
3992 __u16 offset =
3993 le16_to_cpu(referrals->DfsPathOffset);
3994 if (offset > data_count) {
3995 /* if invalid referral, stop here and do
3996 not try to copy any more */
3997 *number_of_UNC_in_array = i;
3998 break;
3999 }
4000 temp = ((char *)referrals) + offset;
4001 4088
4002 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { 4089 /* parse returned result into more usable form */
4003 name_len += UniStrnlen((wchar_t *)temp, 4090 rc = parse_DFS_referrals(pSMBr, num_of_nodes,
4004 data_count); 4091 target_nodes, nls_codepage);
4005 } else {
4006 name_len += strnlen(temp, data_count);
4007 }
4008 referrals++;
4009 /* BB add check that referral pointer does
4010 not fall off end PDU */
4011 }
4012 /* BB add check for name_len bigger than bcc */
4013 *targetUNCs =
4014 kmalloc(name_len+1+(*number_of_UNC_in_array),
4015 GFP_KERNEL);
4016 if (*targetUNCs == NULL) {
4017 rc = -ENOMEM;
4018 goto GetDFSRefExit;
4019 }
4020 /* copy the ref strings */
4021 referrals = (struct dfs_referral_level_3 *)
4022 (8 /* sizeof data hdr */ + data_offset +
4023 (char *) &pSMBr->hdr.Protocol);
4024
4025 for (i = 0; i < *number_of_UNC_in_array; i++) {
4026 temp = ((char *)referrals) +
4027 le16_to_cpu(referrals->DfsPathOffset);
4028 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
4029 cifs_strfromUCS_le(*targetUNCs,
4030 (__le16 *) temp,
4031 name_len,
4032 nls_codepage);
4033 } else {
4034 strncpy(*targetUNCs, temp, name_len);
4035 }
4036 /* BB update target_uncs pointers */
4037 referrals++;
4038 }
4039 temp = *targetUNCs;
4040 temp[name_len] = 0;
4041 }
4042 4092
4043 }
4044GetDFSRefExit: 4093GetDFSRefExit:
4045 if (pSMB) 4094 cifs_buf_release(pSMB);
4046 cifs_buf_release(pSMB);
4047 4095
4048 if (rc == -EAGAIN) 4096 if (rc == -EAGAIN)
4049 goto getDFSRetry; 4097 goto getDFSRetry;
@@ -4233,7 +4281,8 @@ QFSAttributeRetry:
4233 params = 2; /* level */ 4281 params = 2; /* level */
4234 pSMB->TotalDataCount = 0; 4282 pSMB->TotalDataCount = 0;
4235 pSMB->MaxParameterCount = cpu_to_le16(2); 4283 pSMB->MaxParameterCount = cpu_to_le16(2);
4236 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4284 /* BB find exact max SMB PDU from sess structure BB */
4285 pSMB->MaxDataCount = cpu_to_le16(1000);
4237 pSMB->MaxSetupCount = 0; 4286 pSMB->MaxSetupCount = 0;
4238 pSMB->Reserved = 0; 4287 pSMB->Reserved = 0;
4239 pSMB->Flags = 0; 4288 pSMB->Flags = 0;
@@ -4302,7 +4351,8 @@ QFSDeviceRetry:
4302 params = 2; /* level */ 4351 params = 2; /* level */
4303 pSMB->TotalDataCount = 0; 4352 pSMB->TotalDataCount = 0;
4304 pSMB->MaxParameterCount = cpu_to_le16(2); 4353 pSMB->MaxParameterCount = cpu_to_le16(2);
4305 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4354 /* BB find exact max SMB PDU from sess structure BB */
4355 pSMB->MaxDataCount = cpu_to_le16(1000);
4306 pSMB->MaxSetupCount = 0; 4356 pSMB->MaxSetupCount = 0;
4307 pSMB->Reserved = 0; 4357 pSMB->Reserved = 0;
4308 pSMB->Flags = 0; 4358 pSMB->Flags = 0;
@@ -4373,7 +4423,8 @@ QFSUnixRetry:
4373 pSMB->DataCount = 0; 4423 pSMB->DataCount = 0;
4374 pSMB->DataOffset = 0; 4424 pSMB->DataOffset = 0;
4375 pSMB->MaxParameterCount = cpu_to_le16(2); 4425 pSMB->MaxParameterCount = cpu_to_le16(2);
4376 pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ 4426 /* BB find exact max SMB PDU from sess structure BB */
4427 pSMB->MaxDataCount = cpu_to_le16(100);
4377 pSMB->MaxSetupCount = 0; 4428 pSMB->MaxSetupCount = 0;
4378 pSMB->Reserved = 0; 4429 pSMB->Reserved = 0;
4379 pSMB->Flags = 0; 4430 pSMB->Flags = 0;
@@ -4448,7 +4499,8 @@ SETFSUnixRetry:
4448 offset = param_offset + params; 4499 offset = param_offset + params;
4449 4500
4450 pSMB->MaxParameterCount = cpu_to_le16(4); 4501 pSMB->MaxParameterCount = cpu_to_le16(4);
4451 pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ 4502 /* BB find exact max SMB PDU from sess structure BB */
4503 pSMB->MaxDataCount = cpu_to_le16(100);
4452 pSMB->SetupCount = 1; 4504 pSMB->SetupCount = 1;
4453 pSMB->Reserved3 = 0; 4505 pSMB->Reserved3 = 0;
4454 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION); 4506 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION);
@@ -4516,7 +4568,8 @@ QFSPosixRetry:
4516 pSMB->DataCount = 0; 4568 pSMB->DataCount = 0;
4517 pSMB->DataOffset = 0; 4569 pSMB->DataOffset = 0;
4518 pSMB->MaxParameterCount = cpu_to_le16(2); 4570 pSMB->MaxParameterCount = cpu_to_le16(2);
4519 pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ 4571 /* BB find exact max SMB PDU from sess structure BB */
4572 pSMB->MaxDataCount = cpu_to_le16(100);
4520 pSMB->MaxSetupCount = 0; 4573 pSMB->MaxSetupCount = 0;
4521 pSMB->Reserved = 0; 4574 pSMB->Reserved = 0;
4522 pSMB->Flags = 0; 4575 pSMB->Flags = 0;
@@ -4706,7 +4759,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4706 4759
4707 count = sizeof(struct file_end_of_file_info); 4760 count = sizeof(struct file_end_of_file_info);
4708 pSMB->MaxParameterCount = cpu_to_le16(2); 4761 pSMB->MaxParameterCount = cpu_to_le16(2);
4709 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ 4762 /* BB find exact max SMB PDU from sess structure BB */
4763 pSMB->MaxDataCount = cpu_to_le16(1000);
4710 pSMB->SetupCount = 1; 4764 pSMB->SetupCount = 1;
4711 pSMB->Reserved3 = 0; 4765 pSMB->Reserved3 = 0;
4712 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); 4766 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
@@ -4793,7 +4847,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4793 4847
4794 count = sizeof(FILE_BASIC_INFO); 4848 count = sizeof(FILE_BASIC_INFO);
4795 pSMB->MaxParameterCount = cpu_to_le16(2); 4849 pSMB->MaxParameterCount = cpu_to_le16(2);
4796 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ 4850 /* BB find max SMB PDU from sess */
4851 pSMB->MaxDataCount = cpu_to_le16(1000);
4797 pSMB->SetupCount = 1; 4852 pSMB->SetupCount = 1;
4798 pSMB->Reserved3 = 0; 4853 pSMB->Reserved3 = 0;
4799 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); 4854 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
@@ -4860,7 +4915,8 @@ SetTimesRetry:
4860 params = 6 + name_len; 4915 params = 6 + name_len;
4861 count = sizeof(FILE_BASIC_INFO); 4916 count = sizeof(FILE_BASIC_INFO);
4862 pSMB->MaxParameterCount = cpu_to_le16(2); 4917 pSMB->MaxParameterCount = cpu_to_le16(2);
4863 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4918 /* BB find max SMB PDU from sess structure BB */
4919 pSMB->MaxDataCount = cpu_to_le16(1000);
4864 pSMB->MaxSetupCount = 0; 4920 pSMB->MaxSetupCount = 0;
4865 pSMB->Reserved = 0; 4921 pSMB->Reserved = 0;
4866 pSMB->Flags = 0; 4922 pSMB->Flags = 0;
@@ -4990,7 +5046,8 @@ setPermsRetry:
4990 params = 6 + name_len; 5046 params = 6 + name_len;
4991 count = sizeof(FILE_UNIX_BASIC_INFO); 5047 count = sizeof(FILE_UNIX_BASIC_INFO);
4992 pSMB->MaxParameterCount = cpu_to_le16(2); 5048 pSMB->MaxParameterCount = cpu_to_le16(2);
4993 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 5049 /* BB find max SMB PDU from sess structure BB */
5050 pSMB->MaxDataCount = cpu_to_le16(1000);
4994 pSMB->MaxSetupCount = 0; 5051 pSMB->MaxSetupCount = 0;
4995 pSMB->Reserved = 0; 5052 pSMB->Reserved = 0;
4996 pSMB->Flags = 0; 5053 pSMB->Flags = 0;
@@ -5055,8 +5112,7 @@ setPermsRetry:
5055 if (rc) 5112 if (rc)
5056 cFYI(1, ("SetPathInfo (perms) returned %d", rc)); 5113 cFYI(1, ("SetPathInfo (perms) returned %d", rc));
5057 5114
5058 if (pSMB) 5115 cifs_buf_release(pSMB);
5059 cifs_buf_release(pSMB);
5060 if (rc == -EAGAIN) 5116 if (rc == -EAGAIN)
5061 goto setPermsRetry; 5117 goto setPermsRetry;
5062 return rc; 5118 return rc;
@@ -5173,7 +5229,8 @@ QAllEAsRetry:
5173 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 5229 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
5174 pSMB->TotalDataCount = 0; 5230 pSMB->TotalDataCount = 0;
5175 pSMB->MaxParameterCount = cpu_to_le16(2); 5231 pSMB->MaxParameterCount = cpu_to_le16(2);
5176 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 5232 /* BB find exact max SMB PDU from sess structure BB */
5233 pSMB->MaxDataCount = cpu_to_le16(4000);
5177 pSMB->MaxSetupCount = 0; 5234 pSMB->MaxSetupCount = 0;
5178 pSMB->Reserved = 0; 5235 pSMB->Reserved = 0;
5179 pSMB->Flags = 0; 5236 pSMB->Flags = 0;
@@ -5277,8 +5334,7 @@ QAllEAsRetry:
5277 } 5334 }
5278 } 5335 }
5279 } 5336 }
5280 if (pSMB) 5337 cifs_buf_release(pSMB);
5281 cifs_buf_release(pSMB);
5282 if (rc == -EAGAIN) 5338 if (rc == -EAGAIN)
5283 goto QAllEAsRetry; 5339 goto QAllEAsRetry;
5284 5340
@@ -5321,7 +5377,8 @@ QEARetry:
5321 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 5377 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
5322 pSMB->TotalDataCount = 0; 5378 pSMB->TotalDataCount = 0;
5323 pSMB->MaxParameterCount = cpu_to_le16(2); 5379 pSMB->MaxParameterCount = cpu_to_le16(2);
5324 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 5380 /* BB find exact max SMB PDU from sess structure BB */
5381 pSMB->MaxDataCount = cpu_to_le16(4000);
5325 pSMB->MaxSetupCount = 0; 5382 pSMB->MaxSetupCount = 0;
5326 pSMB->Reserved = 0; 5383 pSMB->Reserved = 0;
5327 pSMB->Flags = 0; 5384 pSMB->Flags = 0;
@@ -5426,8 +5483,7 @@ QEARetry:
5426 } 5483 }
5427 } 5484 }
5428 } 5485 }
5429 if (pSMB) 5486 cifs_buf_release(pSMB);
5430 cifs_buf_release(pSMB);
5431 if (rc == -EAGAIN) 5487 if (rc == -EAGAIN)
5432 goto QEARetry; 5488 goto QEARetry;
5433 5489
@@ -5479,7 +5535,8 @@ SetEARetry:
5479 5535
5480 count = sizeof(*parm_data) + ea_value_len + name_len; 5536 count = sizeof(*parm_data) + ea_value_len + name_len;
5481 pSMB->MaxParameterCount = cpu_to_le16(2); 5537 pSMB->MaxParameterCount = cpu_to_le16(2);
5482 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ 5538 /* BB find max SMB PDU from sess */
5539 pSMB->MaxDataCount = cpu_to_le16(1000);
5483 pSMB->MaxSetupCount = 0; 5540 pSMB->MaxSetupCount = 0;
5484 pSMB->Reserved = 0; 5541 pSMB->Reserved = 0;
5485 pSMB->Flags = 0; 5542 pSMB->Flags = 0;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 791ca5c1a116..e8fa46c7cff2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -60,7 +60,7 @@ struct smb_vol {
60 char *domainname; 60 char *domainname;
61 char *UNC; 61 char *UNC;
62 char *UNCip; 62 char *UNCip;
63 char *in6_addr; /* ipv6 address as human readable form of in6_addr */ 63 char *in6_addr; /* ipv6 address as human readable form of in6_addr */
64 char *iocharset; /* local code page for mapping to and from Unicode */ 64 char *iocharset; /* local code page for mapping to and from Unicode */
65 char source_rfc1001_name[16]; /* netbios name of client */ 65 char source_rfc1001_name[16]; /* netbios name of client */
66 char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */ 66 char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */
@@ -75,19 +75,21 @@ struct smb_vol {
75 bool setuids:1; 75 bool setuids:1;
76 bool override_uid:1; 76 bool override_uid:1;
77 bool override_gid:1; 77 bool override_gid:1;
78 bool dynperm:1;
78 bool noperm:1; 79 bool noperm:1;
79 bool no_psx_acl:1; /* set if posix acl support should be disabled */ 80 bool no_psx_acl:1; /* set if posix acl support should be disabled */
80 bool cifs_acl:1; 81 bool cifs_acl:1;
81 bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ 82 bool no_xattr:1; /* set if xattr (EA) support should be disabled*/
82 bool server_ino:1; /* use inode numbers from server ie UniqueId */ 83 bool server_ino:1; /* use inode numbers from server ie UniqueId */
83 bool direct_io:1; 84 bool direct_io:1;
84 bool remap:1; /* set to remap seven reserved chars in filenames */ 85 bool remap:1; /* set to remap seven reserved chars in filenames */
85 bool posix_paths:1; /* unset to not ask for posix pathnames. */ 86 bool posix_paths:1; /* unset to not ask for posix pathnames. */
86 bool no_linux_ext:1; 87 bool no_linux_ext:1;
87 bool sfu_emul:1; 88 bool sfu_emul:1;
88 bool nullauth:1; /* attempt to authenticate with null user */ 89 bool nullauth:1; /* attempt to authenticate with null user */
89 unsigned nocase; /* request case insensitive filenames */ 90 bool nocase:1; /* request case insensitive filenames */
90 unsigned nobrl; /* disable sending byte range locks to srv */ 91 bool nobrl:1; /* disable sending byte range locks to srv */
92 bool seal:1; /* request transport encryption on share */
91 unsigned int rsize; 93 unsigned int rsize;
92 unsigned int wsize; 94 unsigned int wsize;
93 unsigned int sockopt; 95 unsigned int sockopt;
@@ -348,7 +350,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
348 int reconnect; 350 int reconnect;
349 351
350 current->flags |= PF_MEMALLOC; 352 current->flags |= PF_MEMALLOC;
351 server->tsk = current; /* save process info to wake at shutdown */
352 cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); 353 cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current)));
353 write_lock(&GlobalSMBSeslock); 354 write_lock(&GlobalSMBSeslock);
354 atomic_inc(&tcpSesAllocCount); 355 atomic_inc(&tcpSesAllocCount);
@@ -651,10 +652,21 @@ multi_t2_fnd:
651 652
652 spin_lock(&GlobalMid_Lock); 653 spin_lock(&GlobalMid_Lock);
653 server->tcpStatus = CifsExiting; 654 server->tcpStatus = CifsExiting;
654 server->tsk = NULL; 655 spin_unlock(&GlobalMid_Lock);
656 wake_up_all(&server->response_q);
657
658 /* don't exit until kthread_stop is called */
659 set_current_state(TASK_UNINTERRUPTIBLE);
660 while (!kthread_should_stop()) {
661 schedule();
662 set_current_state(TASK_UNINTERRUPTIBLE);
663 }
664 set_current_state(TASK_RUNNING);
665
655 /* check if we have blocked requests that need to free */ 666 /* check if we have blocked requests that need to free */
656 /* Note that cifs_max_pending is normally 50, but 667 /* Note that cifs_max_pending is normally 50, but
657 can be set at module install time to as little as two */ 668 can be set at module install time to as little as two */
669 spin_lock(&GlobalMid_Lock);
658 if (atomic_read(&server->inFlight) >= cifs_max_pending) 670 if (atomic_read(&server->inFlight) >= cifs_max_pending)
659 atomic_set(&server->inFlight, cifs_max_pending - 1); 671 atomic_set(&server->inFlight, cifs_max_pending - 1);
660 /* We do not want to set the max_pending too low or we 672 /* We do not want to set the max_pending too low or we
@@ -1237,6 +1249,10 @@ cifs_parse_mount_options(char *options, const char *devname,
1237 vol->setuids = 1; 1249 vol->setuids = 1;
1238 } else if (strnicmp(data, "nosetuids", 9) == 0) { 1250 } else if (strnicmp(data, "nosetuids", 9) == 0) {
1239 vol->setuids = 0; 1251 vol->setuids = 0;
1252 } else if (strnicmp(data, "dynperm", 7) == 0) {
1253 vol->dynperm = true;
1254 } else if (strnicmp(data, "nodynperm", 9) == 0) {
1255 vol->dynperm = false;
1240 } else if (strnicmp(data, "nohard", 6) == 0) { 1256 } else if (strnicmp(data, "nohard", 6) == 0) {
1241 vol->retry = 0; 1257 vol->retry = 0;
1242 } else if (strnicmp(data, "nosoft", 6) == 0) { 1258 } else if (strnicmp(data, "nosoft", 6) == 0) {
@@ -1259,8 +1275,12 @@ cifs_parse_mount_options(char *options, const char *devname,
1259 vol->no_psx_acl = 1; 1275 vol->no_psx_acl = 1;
1260 } else if (strnicmp(data, "sign", 4) == 0) { 1276 } else if (strnicmp(data, "sign", 4) == 0) {
1261 vol->secFlg |= CIFSSEC_MUST_SIGN; 1277 vol->secFlg |= CIFSSEC_MUST_SIGN;
1262/* } else if (strnicmp(data, "seal",4) == 0) { 1278 } else if (strnicmp(data, "seal", 4) == 0) {
1263 vol->secFlg |= CIFSSEC_MUST_SEAL; */ 1279 /* we do not do the following in secFlags because seal
1280 is a per tree connection (mount) not a per socket
1281 or per-smb connection option in the protocol */
1282 /* vol->secFlg |= CIFSSEC_MUST_SEAL; */
1283 vol->seal = 1;
1264 } else if (strnicmp(data, "direct", 6) == 0) { 1284 } else if (strnicmp(data, "direct", 6) == 0) {
1265 vol->direct_io = 1; 1285 vol->direct_io = 1;
1266 } else if (strnicmp(data, "forcedirectio", 13) == 0) { 1286 } else if (strnicmp(data, "forcedirectio", 13) == 0) {
@@ -1318,42 +1338,43 @@ cifs_parse_mount_options(char *options, const char *devname,
1318 1338
1319static struct cifsSesInfo * 1339static struct cifsSesInfo *
1320cifs_find_tcp_session(struct in_addr *target_ip_addr, 1340cifs_find_tcp_session(struct in_addr *target_ip_addr,
1321 struct in6_addr *target_ip6_addr, 1341 struct in6_addr *target_ip6_addr,
1322 char *userName, struct TCP_Server_Info **psrvTcp) 1342 char *userName, struct TCP_Server_Info **psrvTcp)
1323{ 1343{
1324 struct list_head *tmp; 1344 struct list_head *tmp;
1325 struct cifsSesInfo *ses; 1345 struct cifsSesInfo *ses;
1346
1326 *psrvTcp = NULL; 1347 *psrvTcp = NULL;
1327 read_lock(&GlobalSMBSeslock);
1328 1348
1349 read_lock(&GlobalSMBSeslock);
1329 list_for_each(tmp, &GlobalSMBSessionList) { 1350 list_for_each(tmp, &GlobalSMBSessionList) {
1330 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 1351 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
1331 if (ses->server) { 1352 if (!ses->server)
1332 if ((target_ip_addr && 1353 continue;
1333 (ses->server->addr.sockAddr.sin_addr.s_addr 1354
1334 == target_ip_addr->s_addr)) || (target_ip6_addr 1355 if (target_ip_addr &&
1335 && memcmp(&ses->server->addr.sockAddr6.sin6_addr, 1356 ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr)
1336 target_ip6_addr, sizeof(*target_ip6_addr)))) { 1357 continue;
1337 /* BB lock server and tcp session and increment 1358 else if (target_ip6_addr &&
1338 use count here?? */ 1359 memcmp(&ses->server->addr.sockAddr6.sin6_addr,
1339 1360 target_ip6_addr, sizeof(*target_ip6_addr)))
1340 /* found a match on the TCP session */ 1361 continue;
1341 *psrvTcp = ses->server; 1362 /* BB lock server and tcp session; increment use count here?? */
1342 1363
1343 /* BB check if reconnection needed */ 1364 /* found a match on the TCP session */
1344 if (strncmp 1365 *psrvTcp = ses->server;
1345 (ses->userName, userName, 1366
1346 MAX_USERNAME_SIZE) == 0){ 1367 /* BB check if reconnection needed */
1347 read_unlock(&GlobalSMBSeslock); 1368 if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE) == 0) {
1348 /* Found exact match on both TCP and 1369 read_unlock(&GlobalSMBSeslock);
1349 SMB sessions */ 1370 /* Found exact match on both TCP and
1350 return ses; 1371 SMB sessions */
1351 } 1372 return ses;
1352 }
1353 } 1373 }
1354 /* else tcp and smb sessions need reconnection */ 1374 /* else tcp and smb sessions need reconnection */
1355 } 1375 }
1356 read_unlock(&GlobalSMBSeslock); 1376 read_unlock(&GlobalSMBSeslock);
1377
1357 return NULL; 1378 return NULL;
1358} 1379}
1359 1380
@@ -1404,34 +1425,12 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName)
1404} 1425}
1405 1426
1406int 1427int
1407connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
1408 const char *old_path, const struct nls_table *nls_codepage,
1409 int remap)
1410{
1411 struct dfs_info3_param *referrals = NULL;
1412 unsigned int num_referrals;
1413 int rc = 0;
1414
1415 rc = get_dfs_path(xid, pSesInfo, old_path, nls_codepage,
1416 &num_referrals, &referrals, remap);
1417
1418 /* BB Add in code to: if valid refrl, if not ip address contact
1419 the helper that resolves tcp names, mount to it, try to
1420 tcon to it unmount it if fail */
1421
1422 kfree(referrals);
1423
1424 return rc;
1425}
1426
1427int
1428get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path, 1428get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
1429 const struct nls_table *nls_codepage, unsigned int *pnum_referrals, 1429 const struct nls_table *nls_codepage, unsigned int *pnum_referrals,
1430 struct dfs_info3_param **preferrals, int remap) 1430 struct dfs_info3_param **preferrals, int remap)
1431{ 1431{
1432 char *temp_unc; 1432 char *temp_unc;
1433 int rc = 0; 1433 int rc = 0;
1434 unsigned char *targetUNCs;
1435 1434
1436 *pnum_referrals = 0; 1435 *pnum_referrals = 0;
1437 *preferrals = NULL; 1436 *preferrals = NULL;
@@ -1454,7 +1453,7 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
1454 kfree(temp_unc); 1453 kfree(temp_unc);
1455 } 1454 }
1456 if (rc == 0) 1455 if (rc == 0)
1457 rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, &targetUNCs, 1456 rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals,
1458 pnum_referrals, nls_codepage, remap); 1457 pnum_referrals, nls_codepage, remap);
1459 /* BB map targetUNCs to dfs_info3 structures, here or 1458 /* BB map targetUNCs to dfs_info3 structures, here or
1460 in CIFSGetDFSRefer BB */ 1459 in CIFSGetDFSRefer BB */
@@ -1805,7 +1804,7 @@ convert_delimiter(char *path, char delim)
1805 if (path == NULL) 1804 if (path == NULL)
1806 return; 1805 return;
1807 1806
1808 if (delim == '/') 1807 if (delim == '/')
1809 old_delim = '\\'; 1808 old_delim = '\\';
1810 else 1809 else
1811 old_delim = '/'; 1810 old_delim = '/';
@@ -2115,11 +2114,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2115 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; 2114 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID;
2116 if (volume_info.override_gid) 2115 if (volume_info.override_gid)
2117 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; 2116 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID;
2117 if (volume_info.dynperm)
2118 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM;
2118 if (volume_info.direct_io) { 2119 if (volume_info.direct_io) {
2119 cFYI(1, ("mounting share using direct i/o")); 2120 cFYI(1, ("mounting share using direct i/o"));
2120 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; 2121 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;
2121 } 2122 }
2122 2123
2124 if ((volume_info.cifs_acl) && (volume_info.dynperm))
2125 cERROR(1, ("mount option dynperm ignored if cifsacl "
2126 "mount option supported"));
2127
2123 tcon = 2128 tcon =
2124 find_unc(sin_server.sin_addr.s_addr, volume_info.UNC, 2129 find_unc(sin_server.sin_addr.s_addr, volume_info.UNC,
2125 volume_info.username); 2130 volume_info.username);
@@ -2131,6 +2136,9 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2131 for the retry flag is used */ 2136 for the retry flag is used */
2132 tcon->retry = volume_info.retry; 2137 tcon->retry = volume_info.retry;
2133 tcon->nocase = volume_info.nocase; 2138 tcon->nocase = volume_info.nocase;
2139 if (tcon->seal != volume_info.seal)
2140 cERROR(1, ("transport encryption setting "
2141 "conflicts with existing tid"));
2134 } else { 2142 } else {
2135 tcon = tconInfoAlloc(); 2143 tcon = tconInfoAlloc();
2136 if (tcon == NULL) 2144 if (tcon == NULL)
@@ -2144,10 +2152,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2144 if ((strchr(volume_info.UNC + 3, '\\') == NULL) 2152 if ((strchr(volume_info.UNC + 3, '\\') == NULL)
2145 && (strchr(volume_info.UNC + 3, '/') == 2153 && (strchr(volume_info.UNC + 3, '/') ==
2146 NULL)) { 2154 NULL)) {
2147 rc = connect_to_dfs_path(xid, pSesInfo, 2155/* rc = connect_to_dfs_path(xid, pSesInfo,
2148 "", cifs_sb->local_nls, 2156 "", cifs_sb->local_nls,
2149 cifs_sb->mnt_cifs_flags & 2157 cifs_sb->mnt_cifs_flags &
2150 CIFS_MOUNT_MAP_SPECIAL_CHR); 2158 CIFS_MOUNT_MAP_SPECIAL_CHR);*/
2159 cFYI(1, ("DFS root not supported"));
2151 rc = -ENODEV; 2160 rc = -ENODEV;
2152 goto out; 2161 goto out;
2153 } else { 2162 } else {
@@ -2163,6 +2172,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2163 atomic_inc(&pSesInfo->inUse); 2172 atomic_inc(&pSesInfo->inUse);
2164 tcon->retry = volume_info.retry; 2173 tcon->retry = volume_info.retry;
2165 tcon->nocase = volume_info.nocase; 2174 tcon->nocase = volume_info.nocase;
2175 tcon->seal = volume_info.seal;
2166 } 2176 }
2167 } 2177 }
2168 } 2178 }
@@ -2186,15 +2196,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2186 srvTcp->tcpStatus = CifsExiting; 2196 srvTcp->tcpStatus = CifsExiting;
2187 spin_unlock(&GlobalMid_Lock); 2197 spin_unlock(&GlobalMid_Lock);
2188 if (srvTcp->tsk) { 2198 if (srvTcp->tsk) {
2189 struct task_struct *tsk;
2190 /* If we could verify that kthread_stop would 2199 /* If we could verify that kthread_stop would
2191 always wake up processes blocked in 2200 always wake up processes blocked in
2192 tcp in recv_mesg then we could remove the 2201 tcp in recv_mesg then we could remove the
2193 send_sig call */ 2202 send_sig call */
2194 force_sig(SIGKILL, srvTcp->tsk); 2203 force_sig(SIGKILL, srvTcp->tsk);
2195 tsk = srvTcp->tsk; 2204 kthread_stop(srvTcp->tsk);
2196 if (tsk)
2197 kthread_stop(tsk);
2198 } 2205 }
2199 } 2206 }
2200 /* If find_unc succeeded then rc == 0 so we can not end */ 2207 /* If find_unc succeeded then rc == 0 so we can not end */
@@ -2210,23 +2217,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2210 if ((temp_rc == -ESHUTDOWN) && 2217 if ((temp_rc == -ESHUTDOWN) &&
2211 (pSesInfo->server) && 2218 (pSesInfo->server) &&
2212 (pSesInfo->server->tsk)) { 2219 (pSesInfo->server->tsk)) {
2213 struct task_struct *tsk;
2214 force_sig(SIGKILL, 2220 force_sig(SIGKILL,
2215 pSesInfo->server->tsk); 2221 pSesInfo->server->tsk);
2216 tsk = pSesInfo->server->tsk; 2222 kthread_stop(pSesInfo->server->tsk);
2217 if (tsk)
2218 kthread_stop(tsk);
2219 } 2223 }
2220 } else { 2224 } else {
2221 cFYI(1, ("No session or bad tcon")); 2225 cFYI(1, ("No session or bad tcon"));
2222 if ((pSesInfo->server) && 2226 if ((pSesInfo->server) &&
2223 (pSesInfo->server->tsk)) { 2227 (pSesInfo->server->tsk)) {
2224 struct task_struct *tsk;
2225 force_sig(SIGKILL, 2228 force_sig(SIGKILL,
2226 pSesInfo->server->tsk); 2229 pSesInfo->server->tsk);
2227 tsk = pSesInfo->server->tsk; 2230 kthread_stop(pSesInfo->server->tsk);
2228 if (tsk)
2229 kthread_stop(tsk);
2230 } 2231 }
2231 } 2232 }
2232 sesInfoFree(pSesInfo); 2233 sesInfoFree(pSesInfo);
@@ -2313,9 +2314,10 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2313 user = ses->userName; 2314 user = ses->userName;
2314 domain = ses->domainName; 2315 domain = ses->domainName;
2315 smb_buffer = cifs_buf_get(); 2316 smb_buffer = cifs_buf_get();
2316 if (smb_buffer == NULL) { 2317
2318 if (smb_buffer == NULL)
2317 return -ENOMEM; 2319 return -ENOMEM;
2318 } 2320
2319 smb_buffer_response = smb_buffer; 2321 smb_buffer_response = smb_buffer;
2320 pSMBr = pSMB = (SESSION_SETUP_ANDX *) smb_buffer; 2322 pSMBr = pSMB = (SESSION_SETUP_ANDX *) smb_buffer;
2321 2323
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 6ed775986be9..fb69c1fa85c9 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -49,18 +49,25 @@ build_path_from_dentry(struct dentry *direntry)
49 struct dentry *temp; 49 struct dentry *temp;
50 int namelen; 50 int namelen;
51 int pplen; 51 int pplen;
52 int dfsplen;
52 char *full_path; 53 char *full_path;
53 char dirsep; 54 char dirsep;
55 struct cifs_sb_info *cifs_sb;
54 56
55 if (direntry == NULL) 57 if (direntry == NULL)
56 return NULL; /* not much we can do if dentry is freed and 58 return NULL; /* not much we can do if dentry is freed and
57 we need to reopen the file after it was closed implicitly 59 we need to reopen the file after it was closed implicitly
58 when the server crashed */ 60 when the server crashed */
59 61
60 dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb)); 62 cifs_sb = CIFS_SB(direntry->d_sb);
61 pplen = CIFS_SB(direntry->d_sb)->prepathlen; 63 dirsep = CIFS_DIR_SEP(cifs_sb);
64 pplen = cifs_sb->prepathlen;
65 if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS))
66 dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1);
67 else
68 dfsplen = 0;
62cifs_bp_rename_retry: 69cifs_bp_rename_retry:
63 namelen = pplen; 70 namelen = pplen + dfsplen;
64 for (temp = direntry; !IS_ROOT(temp);) { 71 for (temp = direntry; !IS_ROOT(temp);) {
65 namelen += (1 + temp->d_name.len); 72 namelen += (1 + temp->d_name.len);
66 temp = temp->d_parent; 73 temp = temp->d_parent;
@@ -91,7 +98,7 @@ cifs_bp_rename_retry:
91 return NULL; 98 return NULL;
92 } 99 }
93 } 100 }
94 if (namelen != pplen) { 101 if (namelen != pplen + dfsplen) {
95 cERROR(1, 102 cERROR(1,
96 ("did not end path lookup where expected namelen is %d", 103 ("did not end path lookup where expected namelen is %d",
97 namelen)); 104 namelen));
@@ -107,7 +114,18 @@ cifs_bp_rename_retry:
107 since the '\' is a valid posix character so we can not switch 114 since the '\' is a valid posix character so we can not switch
108 those safely to '/' if any are found in the middle of the prepath */ 115 those safely to '/' if any are found in the middle of the prepath */
109 /* BB test paths to Windows with '/' in the midst of prepath */ 116 /* BB test paths to Windows with '/' in the midst of prepath */
110 strncpy(full_path, CIFS_SB(direntry->d_sb)->prepath, pplen); 117
118 if (dfsplen) {
119 strncpy(full_path, cifs_sb->tcon->treeName, dfsplen);
120 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
121 int i;
122 for (i = 0; i < dfsplen; i++) {
123 if (full_path[i] == '\\')
124 full_path[i] = '/';
125 }
126 }
127 }
128 strncpy(full_path + dfsplen, CIFS_SB(direntry->d_sb)->prepath, pplen);
111 return full_path; 129 return full_path;
112} 130}
113 131
@@ -119,6 +137,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
119{ 137{
120 int rc = -ENOENT; 138 int rc = -ENOENT;
121 int xid; 139 int xid;
140 int create_options = CREATE_NOT_DIR;
122 int oplock = 0; 141 int oplock = 0;
123 int desiredAccess = GENERIC_READ | GENERIC_WRITE; 142 int desiredAccess = GENERIC_READ | GENERIC_WRITE;
124 __u16 fileHandle; 143 __u16 fileHandle;
@@ -176,9 +195,19 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
176 FreeXid(xid); 195 FreeXid(xid);
177 return -ENOMEM; 196 return -ENOMEM;
178 } 197 }
198
199 mode &= ~current->fs->umask;
200
201 /*
202 * if we're not using unix extensions, see if we need to set
203 * ATTR_READONLY on the create call
204 */
205 if (!pTcon->unix_ext && (mode & S_IWUGO) == 0)
206 create_options |= CREATE_OPTION_READONLY;
207
179 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 208 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
180 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, 209 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
181 desiredAccess, CREATE_NOT_DIR, 210 desiredAccess, create_options,
182 &fileHandle, &oplock, buf, cifs_sb->local_nls, 211 &fileHandle, &oplock, buf, cifs_sb->local_nls,
183 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 212 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
184 else 213 else
@@ -187,7 +216,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
187 if (rc == -EIO) { 216 if (rc == -EIO) {
188 /* old server, retry the open legacy style */ 217 /* old server, retry the open legacy style */
189 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, 218 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
190 desiredAccess, CREATE_NOT_DIR, 219 desiredAccess, create_options,
191 &fileHandle, &oplock, buf, cifs_sb->local_nls, 220 &fileHandle, &oplock, buf, cifs_sb->local_nls,
192 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 221 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
193 } 222 }
@@ -197,7 +226,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
197 /* If Open reported that we actually created a file 226 /* If Open reported that we actually created a file
198 then we now have to set the mode if possible */ 227 then we now have to set the mode if possible */
199 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 228 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
200 mode &= ~current->fs->umask;
201 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 229 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
202 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, 230 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
203 (__u64)current->fsuid, 231 (__u64)current->fsuid,
@@ -232,7 +260,9 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
232 buf, inode->i_sb, xid, 260 buf, inode->i_sb, xid,
233 &fileHandle); 261 &fileHandle);
234 if (newinode) { 262 if (newinode) {
235 newinode->i_mode = mode; 263 if (cifs_sb->mnt_cifs_flags &
264 CIFS_MOUNT_DYNPERM)
265 newinode->i_mode = mode;
236 if ((oplock & CIFS_CREATE_ACTION) && 266 if ((oplock & CIFS_CREATE_ACTION) &&
237 (cifs_sb->mnt_cifs_flags & 267 (cifs_sb->mnt_cifs_flags &
238 CIFS_MOUNT_SET_UID)) { 268 CIFS_MOUNT_SET_UID)) {
@@ -580,7 +610,7 @@ static int cifs_ci_compare(struct dentry *dentry, struct qstr *a,
580 * case take precedence. If a is not a negative dentry, this 610 * case take precedence. If a is not a negative dentry, this
581 * should have no side effects 611 * should have no side effects
582 */ 612 */
583 memcpy(a->name, b->name, a->len); 613 memcpy((void *)a->name, b->name, a->len);
584 return 0; 614 return 0;
585 } 615 }
586 return 1; 616 return 1;
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c
index 939e256f8497..f730ef35499e 100644
--- a/fs/cifs/dns_resolve.c
+++ b/fs/cifs/dns_resolve.c
@@ -134,10 +134,6 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
134 rkey = request_key(&key_type_dns_resolver, name, ""); 134 rkey = request_key(&key_type_dns_resolver, name, "");
135 if (!IS_ERR(rkey)) { 135 if (!IS_ERR(rkey)) {
136 data = rkey->payload.data; 136 data = rkey->payload.data;
137 cFYI(1, ("%s: resolved: %s to %s", __func__,
138 rkey->description,
139 *ip_addr
140 ));
141 } else { 137 } else {
142 cERROR(1, ("%s: unable to resolve: %s", __func__, name)); 138 cERROR(1, ("%s: unable to resolve: %s", __func__, name));
143 goto out; 139 goto out;
@@ -150,6 +146,11 @@ skip_upcall:
150 if (*ip_addr) { 146 if (*ip_addr) {
151 memcpy(*ip_addr, data, len); 147 memcpy(*ip_addr, data, len);
152 (*ip_addr)[len] = '\0'; 148 (*ip_addr)[len] = '\0';
149 if (!IS_ERR(rkey))
150 cFYI(1, ("%s: resolved: %s to %s", __func__,
151 name,
152 *ip_addr
153 ));
153 rc = 0; 154 rc = 0;
154 } else { 155 } else {
155 rc = -ENOMEM; 156 rc = -ENOMEM;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 31a0a33b9d95..0aac824371a5 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -75,7 +75,11 @@ static inline int cifs_convert_flags(unsigned int flags)
75 return (GENERIC_READ | GENERIC_WRITE); 75 return (GENERIC_READ | GENERIC_WRITE);
76 } 76 }
77 77
78 return 0x20197; 78 return (READ_CONTROL | FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES |
79 FILE_WRITE_EA | FILE_APPEND_DATA | FILE_WRITE_DATA |
80 FILE_READ_DATA);
81
82
79} 83}
80 84
81static inline int cifs_get_disposition(unsigned int flags) 85static inline int cifs_get_disposition(unsigned int flags)
@@ -542,7 +546,6 @@ int cifs_close(struct inode *inode, struct file *file)
542 msleep(timeout); 546 msleep(timeout);
543 timeout *= 8; 547 timeout *= 8;
544 } 548 }
545 kfree(pSMBFile->search_resume_name);
546 kfree(file->private_data); 549 kfree(file->private_data);
547 file->private_data = NULL; 550 file->private_data = NULL;
548 } else 551 } else
@@ -601,12 +604,6 @@ int cifs_closedir(struct inode *inode, struct file *file)
601 else 604 else
602 cifs_buf_release(ptmp); 605 cifs_buf_release(ptmp);
603 } 606 }
604 ptmp = pCFileStruct->search_resume_name;
605 if (ptmp) {
606 cFYI(1, ("closedir free resume name"));
607 pCFileStruct->search_resume_name = NULL;
608 kfree(ptmp);
609 }
610 kfree(file->private_data); 607 kfree(file->private_data);
611 file->private_data = NULL; 608 file->private_data = NULL;
612 } 609 }
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 0d9d2e6d7af6..722be543ceec 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -161,118 +161,115 @@ static void cifs_unix_info_to_inode(struct inode *inode,
161 spin_unlock(&inode->i_lock); 161 spin_unlock(&inode->i_lock);
162} 162}
163 163
164static const unsigned char *cifs_get_search_path(struct cifs_sb_info *cifs_sb,
165 const char *search_path)
166{
167 int tree_len;
168 int path_len;
169 int i;
170 char *tmp_path;
171 struct cifsTconInfo *pTcon = cifs_sb->tcon;
172
173 if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS))
174 return search_path;
175
176 /* use full path name for working with DFS */
177 tree_len = strnlen(pTcon->treeName, MAX_TREE_SIZE + 1);
178 path_len = strnlen(search_path, MAX_PATHCONF);
179 164
180 tmp_path = kmalloc(tree_len+path_len+1, GFP_KERNEL); 165/*
181 if (tmp_path == NULL) 166 * Needed to setup inode data for the directory which is the
182 return search_path; 167 * junction to the new submount (ie to setup the fake directory
168 * which represents a DFS referral)
169 */
170static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat,
171 struct super_block *sb)
172{
173 struct inode *pinode = NULL;
174
175 memset(pfnd_dat, 0, sizeof(FILE_UNIX_BASIC_INFO));
176
177/* __le64 pfnd_dat->EndOfFile = cpu_to_le64(0);
178 __le64 pfnd_dat->NumOfBytes = cpu_to_le64(0);
179 __u64 UniqueId = 0; */
180 pfnd_dat->LastStatusChange =
181 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
182 pfnd_dat->LastAccessTime =
183 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
184 pfnd_dat->LastModificationTime =
185 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
186 pfnd_dat->Type = cpu_to_le32(UNIX_DIR);
187 pfnd_dat->Permissions = cpu_to_le64(S_IXUGO | S_IRWXU);
188 pfnd_dat->Nlinks = cpu_to_le64(2);
189 if (sb->s_root)
190 pinode = sb->s_root->d_inode;
191 if (pinode == NULL)
192 return;
183 193
184 strncpy(tmp_path, pTcon->treeName, tree_len); 194 /* fill in default values for the remaining based on root
185 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) 195 inode since we can not query the server for this inode info */
186 for (i = 0; i < tree_len; i++) { 196 pfnd_dat->DevMajor = cpu_to_le64(MAJOR(pinode->i_rdev));
187 if (tmp_path[i] == '\\') 197 pfnd_dat->DevMinor = cpu_to_le64(MINOR(pinode->i_rdev));
188 tmp_path[i] = '/'; 198 pfnd_dat->Uid = cpu_to_le64(pinode->i_uid);
189 } 199 pfnd_dat->Gid = cpu_to_le64(pinode->i_gid);
190 strncpy(tmp_path+tree_len, search_path, path_len);
191 tmp_path[tree_len+path_len] = 0;
192 return tmp_path;
193} 200}
194 201
195int cifs_get_inode_info_unix(struct inode **pinode, 202int cifs_get_inode_info_unix(struct inode **pinode,
196 const unsigned char *search_path, struct super_block *sb, int xid) 203 const unsigned char *full_path, struct super_block *sb, int xid)
197{ 204{
198 int rc = 0; 205 int rc = 0;
199 FILE_UNIX_BASIC_INFO findData; 206 FILE_UNIX_BASIC_INFO find_data;
200 struct cifsTconInfo *pTcon; 207 struct cifsTconInfo *pTcon;
201 struct inode *inode; 208 struct inode *inode;
202 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 209 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
203 const unsigned char *full_path;
204 bool is_dfs_referral = false; 210 bool is_dfs_referral = false;
211 struct cifsInodeInfo *cifsInfo;
212 __u64 num_of_bytes;
213 __u64 end_of_file;
205 214
206 pTcon = cifs_sb->tcon; 215 pTcon = cifs_sb->tcon;
207 cFYI(1, ("Getting info on %s", search_path)); 216 cFYI(1, ("Getting info on %s", full_path));
208 217
209 full_path = cifs_get_search_path(cifs_sb, search_path);
210
211try_again_CIFSSMBUnixQPathInfo:
212 /* could have done a find first instead but this returns more info */ 218 /* could have done a find first instead but this returns more info */
213 rc = CIFSSMBUnixQPathInfo(xid, pTcon, full_path, &findData, 219 rc = CIFSSMBUnixQPathInfo(xid, pTcon, full_path, &find_data,
214 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 220 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
215 CIFS_MOUNT_MAP_SPECIAL_CHR); 221 CIFS_MOUNT_MAP_SPECIAL_CHR);
216/* dump_mem("\nUnixQPathInfo return data", &findData,
217 sizeof(findData)); */
218 if (rc) { 222 if (rc) {
219 if (rc == -EREMOTE && !is_dfs_referral) { 223 if (rc == -EREMOTE && !is_dfs_referral) {
220 is_dfs_referral = true; 224 is_dfs_referral = true;
221 if (full_path != search_path) { 225 cFYI(DBG2, ("DFS ref"));
222 kfree(full_path); 226 /* for DFS, server does not give us real inode data */
223 full_path = search_path; 227 fill_fake_finddataunix(&find_data, sb);
224 } 228 rc = 0;
225 goto try_again_CIFSSMBUnixQPathInfo;
226 } 229 }
227 goto cgiiu_exit; 230 }
228 } else { 231 num_of_bytes = le64_to_cpu(find_data.NumOfBytes);
229 struct cifsInodeInfo *cifsInfo; 232 end_of_file = le64_to_cpu(find_data.EndOfFile);
230 __u64 num_of_bytes = le64_to_cpu(findData.NumOfBytes);
231 __u64 end_of_file = le64_to_cpu(findData.EndOfFile);
232 233
233 /* get new inode */ 234 /* get new inode */
235 if (*pinode == NULL) {
236 *pinode = new_inode(sb);
234 if (*pinode == NULL) { 237 if (*pinode == NULL) {
235 *pinode = new_inode(sb); 238 rc = -ENOMEM;
236 if (*pinode == NULL) { 239 goto cgiiu_exit;
237 rc = -ENOMEM;
238 goto cgiiu_exit;
239 }
240 /* Is an i_ino of zero legal? */
241 /* Are there sanity checks we can use to ensure that
242 the server is really filling in that field? */
243 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
244 (*pinode)->i_ino =
245 (unsigned long)findData.UniqueId;
246 } /* note ino incremented to unique num in new_inode */
247 if (sb->s_flags & MS_NOATIME)
248 (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME;
249
250 insert_inode_hash(*pinode);
251 } 240 }
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;
252 247
253 inode = *pinode; 248 if (sb->s_flags & MS_NOATIME)
254 cifsInfo = CIFS_I(inode); 249 (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME;
255 250
256 cFYI(1, ("Old time %ld", cifsInfo->time)); 251 insert_inode_hash(*pinode);
257 cifsInfo->time = jiffies; 252 }
258 cFYI(1, ("New time %ld", cifsInfo->time));
259 /* this is ok to set on every inode revalidate */
260 atomic_set(&cifsInfo->inUse, 1);
261 253
262 cifs_unix_info_to_inode(inode, &findData, 0); 254 inode = *pinode;
255 cifsInfo = CIFS_I(inode);
263 256
257 cFYI(1, ("Old time %ld", cifsInfo->time));
258 cifsInfo->time = jiffies;
259 cFYI(1, ("New time %ld", cifsInfo->time));
260 /* this is ok to set on every inode revalidate */
261 atomic_set(&cifsInfo->inUse, 1);
264 262
265 if (num_of_bytes < end_of_file) 263 cifs_unix_info_to_inode(inode, &find_data, 0);
266 cFYI(1, ("allocation size less than end of file"));
267 cFYI(1, ("Size %ld and blocks %llu",
268 (unsigned long) inode->i_size,
269 (unsigned long long)inode->i_blocks));
270 264
271 cifs_set_ops(inode, is_dfs_referral); 265 if (num_of_bytes < end_of_file)
272 } 266 cFYI(1, ("allocation size less than end of file"));
267 cFYI(1, ("Size %ld and blocks %llu",
268 (unsigned long) inode->i_size,
269 (unsigned long long)inode->i_blocks));
270
271 cifs_set_ops(inode, is_dfs_referral);
273cgiiu_exit: 272cgiiu_exit:
274 if (full_path != search_path)
275 kfree(full_path);
276 return rc; 273 return rc;
277} 274}
278 275
@@ -379,21 +376,52 @@ static int get_sfu_mode(struct inode *inode,
379#endif 376#endif
380} 377}
381 378
379/*
380 * Needed to setup inode data for the directory which is the
381 * junction to the new submount (ie to setup the fake directory
382 * which represents a DFS referral)
383 */
384static void fill_fake_finddata(FILE_ALL_INFO *pfnd_dat,
385 struct super_block *sb)
386{
387 memset(pfnd_dat, 0, sizeof(FILE_ALL_INFO));
388
389/* __le64 pfnd_dat->AllocationSize = cpu_to_le64(0);
390 __le64 pfnd_dat->EndOfFile = cpu_to_le64(0);
391 __u8 pfnd_dat->DeletePending = 0;
392 __u8 pfnd_data->Directory = 0;
393 __le32 pfnd_dat->EASize = 0;
394 __u64 pfnd_dat->IndexNumber = 0;
395 __u64 pfnd_dat->IndexNumber1 = 0; */
396 pfnd_dat->CreationTime =
397 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
398 pfnd_dat->LastAccessTime =
399 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
400 pfnd_dat->LastWriteTime =
401 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
402 pfnd_dat->ChangeTime =
403 cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
404 pfnd_dat->Attributes = cpu_to_le32(ATTR_DIRECTORY);
405 pfnd_dat->NumberOfLinks = cpu_to_le32(2);
406}
407
382int cifs_get_inode_info(struct inode **pinode, 408int cifs_get_inode_info(struct inode **pinode,
383 const unsigned char *search_path, FILE_ALL_INFO *pfindData, 409 const unsigned char *full_path, FILE_ALL_INFO *pfindData,
384 struct super_block *sb, int xid, const __u16 *pfid) 410 struct super_block *sb, int xid, const __u16 *pfid)
385{ 411{
386 int rc = 0; 412 int rc = 0;
413 __u32 attr;
414 struct cifsInodeInfo *cifsInfo;
387 struct cifsTconInfo *pTcon; 415 struct cifsTconInfo *pTcon;
388 struct inode *inode; 416 struct inode *inode;
389 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 417 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
390 const unsigned char *full_path = NULL;
391 char *buf = NULL; 418 char *buf = NULL;
392 bool adjustTZ = false; 419 bool adjustTZ = false;
393 bool is_dfs_referral = false; 420 bool is_dfs_referral = false;
421 umode_t default_mode;
394 422
395 pTcon = cifs_sb->tcon; 423 pTcon = cifs_sb->tcon;
396 cFYI(1, ("Getting info on %s", search_path)); 424 cFYI(1, ("Getting info on %s", full_path));
397 425
398 if ((pfindData == NULL) && (*pinode != NULL)) { 426 if ((pfindData == NULL) && (*pinode != NULL)) {
399 if (CIFS_I(*pinode)->clientCanCacheRead) { 427 if (CIFS_I(*pinode)->clientCanCacheRead) {
@@ -409,9 +437,6 @@ int cifs_get_inode_info(struct inode **pinode,
409 return -ENOMEM; 437 return -ENOMEM;
410 pfindData = (FILE_ALL_INFO *)buf; 438 pfindData = (FILE_ALL_INFO *)buf;
411 439
412 full_path = cifs_get_search_path(cifs_sb, search_path);
413
414try_again_CIFSSMBQPathInfo:
415 /* could do find first instead but this returns more info */ 440 /* could do find first instead but this returns more info */
416 rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData, 441 rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData,
417 0 /* not legacy */, 442 0 /* not legacy */,
@@ -429,178 +454,163 @@ try_again_CIFSSMBQPathInfo:
429 } 454 }
430 } 455 }
431 /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ 456 /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
432 if (rc) { 457 if (rc == -EREMOTE) {
433 if (rc == -EREMOTE && !is_dfs_referral) { 458 is_dfs_referral = true;
434 is_dfs_referral = true; 459 fill_fake_finddata(pfindData, sb);
435 if (full_path != search_path) { 460 rc = 0;
436 kfree(full_path); 461 } else if (rc)
437 full_path = search_path;
438 }
439 goto try_again_CIFSSMBQPathInfo;
440 }
441 goto cgii_exit; 462 goto cgii_exit;
442 } else {
443 struct cifsInodeInfo *cifsInfo;
444 __u32 attr = le32_to_cpu(pfindData->Attributes);
445
446 /* get new inode */
447 if (*pinode == NULL) {
448 *pinode = new_inode(sb);
449 if (*pinode == NULL) {
450 rc = -ENOMEM;
451 goto cgii_exit;
452 }
453 /* Is an i_ino of zero legal? Can we use that to check
454 if the server supports returning inode numbers? Are
455 there other sanity checks we can use to ensure that
456 the server is really filling in that field? */
457
458 /* We can not use the IndexNumber field by default from
459 Windows or Samba (in ALL_INFO buf) but we can request
460 it explicitly. It may not be unique presumably if
461 the server has multiple devices mounted under one
462 share */
463 463
464 /* There may be higher info levels that work but are 464 attr = le32_to_cpu(pfindData->Attributes);
465 there Windows server or network appliances for which
466 IndexNumber field is not guaranteed unique? */
467 465
468 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { 466 /* get new inode */
469 int rc1 = 0; 467 if (*pinode == NULL) {
470 __u64 inode_num; 468 *pinode = new_inode(sb);
471 469 if (*pinode == NULL) {
472 rc1 = CIFSGetSrvInodeNumber(xid, pTcon, 470 rc = -ENOMEM;
473 search_path, &inode_num, 471 goto cgii_exit;
472 }
473 /* Is an i_ino of zero legal? Can we use that to check
474 if the server supports returning inode numbers? Are
475 there other sanity checks we can use to ensure that
476 the server is really filling in that field? */
477
478 /* We can not use the IndexNumber field by default from
479 Windows or Samba (in ALL_INFO buf) but we can request
480 it explicitly. It may not be unique presumably if
481 the server has multiple devices mounted under one share */
482
483 /* There may be higher info levels that work but are
484 there Windows server or network appliances for which
485 IndexNumber field is not guaranteed unique? */
486
487 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
488 int rc1 = 0;
489 __u64 inode_num;
490
491 rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
492 full_path, &inode_num,
474 cifs_sb->local_nls, 493 cifs_sb->local_nls,
475 cifs_sb->mnt_cifs_flags & 494 cifs_sb->mnt_cifs_flags &
476 CIFS_MOUNT_MAP_SPECIAL_CHR); 495 CIFS_MOUNT_MAP_SPECIAL_CHR);
477 if (rc1) { 496 if (rc1) {
478 cFYI(1, ("GetSrvInodeNum rc %d", rc1)); 497 cFYI(1, ("GetSrvInodeNum rc %d", rc1));
479 /* BB EOPNOSUPP disable SERVER_INUM? */ 498 /* BB EOPNOSUPP disable SERVER_INUM? */
480 } else /* do we need cast or hash to ino? */ 499 } else /* do we need cast or hash to ino? */
481 (*pinode)->i_ino = inode_num; 500 (*pinode)->i_ino = inode_num;
482 } /* else ino incremented to unique num in new_inode*/ 501 } /* else ino incremented to unique num in new_inode*/
483 if (sb->s_flags & MS_NOATIME) 502 if (sb->s_flags & MS_NOATIME)
484 (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; 503 (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME;
485 insert_inode_hash(*pinode); 504 insert_inode_hash(*pinode);
486 } 505 }
487 inode = *pinode; 506 inode = *pinode;
488 cifsInfo = CIFS_I(inode); 507 cifsInfo = CIFS_I(inode);
489 cifsInfo->cifsAttrs = attr; 508 cifsInfo->cifsAttrs = attr;
490 cFYI(1, ("Old time %ld", cifsInfo->time)); 509 cFYI(1, ("Old time %ld", cifsInfo->time));
491 cifsInfo->time = jiffies; 510 cifsInfo->time = jiffies;
492 cFYI(1, ("New time %ld", cifsInfo->time)); 511 cFYI(1, ("New time %ld", cifsInfo->time));
493 512
494 /* blksize needs to be multiple of two. So safer to default to 513 /* blksize needs to be multiple of two. So safer to default to
495 blksize and blkbits set in superblock so 2**blkbits and blksize 514 blksize and blkbits set in superblock so 2**blkbits and blksize
496 will match rather than setting to: 515 will match rather than setting to:
497 (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ 516 (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/
498 517
499 /* Linux can not store file creation time so ignore it */ 518 /* Linux can not store file creation time so ignore it */
500 if (pfindData->LastAccessTime) 519 if (pfindData->LastAccessTime)
501 inode->i_atime = cifs_NTtimeToUnix 520 inode->i_atime = cifs_NTtimeToUnix
502 (le64_to_cpu(pfindData->LastAccessTime)); 521 (le64_to_cpu(pfindData->LastAccessTime));
503 else /* do not need to use current_fs_time - time not stored */ 522 else /* do not need to use current_fs_time - time not stored */
504 inode->i_atime = CURRENT_TIME; 523 inode->i_atime = CURRENT_TIME;
505 inode->i_mtime = 524 inode->i_mtime =
506 cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); 525 cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime));
507 inode->i_ctime = 526 inode->i_ctime =
508 cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); 527 cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
509 cFYI(0, ("Attributes came in as 0x%x", attr)); 528 cFYI(DBG2, ("Attributes came in as 0x%x", attr));
510 if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) { 529 if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) {
511 inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj; 530 inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj;
512 inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj; 531 inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj;
513 } 532 }
514 533
515 /* set default mode. will override for dirs below */ 534 /* get default inode mode */
516 if (atomic_read(&cifsInfo->inUse) == 0) 535 if (attr & ATTR_DIRECTORY)
517 /* new inode, can safely set these fields */ 536 default_mode = cifs_sb->mnt_dir_mode;
518 inode->i_mode = cifs_sb->mnt_file_mode; 537 else
519 else /* since we set the inode type below we need to mask off 538 default_mode = cifs_sb->mnt_file_mode;
520 to avoid strange results if type changes and both 539
521 get orred in */ 540 /* set permission bits */
541 if (atomic_read(&cifsInfo->inUse) == 0 ||
542 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0)
543 inode->i_mode = default_mode;
544 else {
545 /* just reenable write bits if !ATTR_READONLY */
546 if ((inode->i_mode & S_IWUGO) == 0 &&
547 (attr & ATTR_READONLY) == 0)
548 inode->i_mode |= (S_IWUGO & default_mode);
522 inode->i_mode &= ~S_IFMT; 549 inode->i_mode &= ~S_IFMT;
523/* if (attr & ATTR_REPARSE) */ 550 }
524 /* We no longer handle these as symlinks because we could not 551 /* clear write bits if ATTR_READONLY is set */
525 follow them due to the absolute path with drive letter */ 552 if (attr & ATTR_READONLY)
526 if (attr & ATTR_DIRECTORY) { 553 inode->i_mode &= ~S_IWUGO;
527 /* override default perms since we do not do byte range locking 554
528 on dirs */ 555 /* set inode type */
529 inode->i_mode = cifs_sb->mnt_dir_mode; 556 if ((attr & ATTR_SYSTEM) &&
530 inode->i_mode |= S_IFDIR; 557 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) {
531 } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && 558 /* no need to fix endianness on 0 */
532 (cifsInfo->cifsAttrs & ATTR_SYSTEM) && 559 if (pfindData->EndOfFile == 0)
533 /* No need to le64 convert size of zero */
534 (pfindData->EndOfFile == 0)) {
535 inode->i_mode = cifs_sb->mnt_file_mode;
536 inode->i_mode |= S_IFIFO; 560 inode->i_mode |= S_IFIFO;
537/* BB Finish for SFU style symlinks and devices */ 561 else if (decode_sfu_inode(inode,
538 } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && 562 le64_to_cpu(pfindData->EndOfFile),
539 (cifsInfo->cifsAttrs & ATTR_SYSTEM)) { 563 full_path, cifs_sb, xid))
540 if (decode_sfu_inode(inode, 564 cFYI(1, ("unknown SFU file type\n"));
541 le64_to_cpu(pfindData->EndOfFile), 565 } else {
542 search_path, 566 if (attr & ATTR_DIRECTORY)
543 cifs_sb, xid)) 567 inode->i_mode |= S_IFDIR;
544 cFYI(1, ("Unrecognized sfu inode type")); 568 else
545
546 cFYI(1, ("sfu mode 0%o", inode->i_mode));
547 } else {
548 inode->i_mode |= S_IFREG; 569 inode->i_mode |= S_IFREG;
549 /* treat the dos attribute of read-only as read-only 570 }
550 mode e.g. 555 */
551 if (cifsInfo->cifsAttrs & ATTR_READONLY)
552 inode->i_mode &= ~(S_IWUGO);
553 else if ((inode->i_mode & S_IWUGO) == 0)
554 /* the ATTR_READONLY flag may have been */
555 /* changed on server -- set any w bits */
556 /* allowed by mnt_file_mode */
557 inode->i_mode |= (S_IWUGO &
558 cifs_sb->mnt_file_mode);
559 /* BB add code here -
560 validate if device or weird share or device type? */
561 }
562 571
563 spin_lock(&inode->i_lock); 572 spin_lock(&inode->i_lock);
564 if (is_size_safe_to_change(cifsInfo, 573 if (is_size_safe_to_change(cifsInfo,
565 le64_to_cpu(pfindData->EndOfFile))) { 574 le64_to_cpu(pfindData->EndOfFile))) {
566 /* can not safely shrink the file size here if the 575 /* can not safely shrink the file size here if the
567 client is writing to it due to potential races */ 576 client is writing to it due to potential races */
568 i_size_write(inode, le64_to_cpu(pfindData->EndOfFile)); 577 i_size_write(inode, le64_to_cpu(pfindData->EndOfFile));
569 578
570 /* 512 bytes (2**9) is the fake blocksize that must be 579 /* 512 bytes (2**9) is the fake blocksize that must be
571 used for this calculation */ 580 used for this calculation */
572 inode->i_blocks = (512 - 1 + le64_to_cpu( 581 inode->i_blocks = (512 - 1 + le64_to_cpu(
573 pfindData->AllocationSize)) >> 9; 582 pfindData->AllocationSize)) >> 9;
574 } 583 }
575 spin_unlock(&inode->i_lock); 584 spin_unlock(&inode->i_lock);
576 585
577 inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); 586 inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks);
578 587
579 /* BB fill in uid and gid here? with help from winbind? 588 /* BB fill in uid and gid here? with help from winbind?
580 or retrieve from NTFS stream extended attribute */ 589 or retrieve from NTFS stream extended attribute */
581#ifdef CONFIG_CIFS_EXPERIMENTAL 590#ifdef CONFIG_CIFS_EXPERIMENTAL
582 /* fill in 0777 bits from ACL */ 591 /* fill in 0777 bits from ACL */
583 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { 592 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
584 cFYI(1, ("Getting mode bits from ACL")); 593 cFYI(1, ("Getting mode bits from ACL"));
585 acl_to_uid_mode(inode, search_path, pfid); 594 acl_to_uid_mode(inode, full_path, pfid);
586 } 595 }
587#endif 596#endif
588 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { 597 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
589 /* fill in remaining high mode bits e.g. SUID, VTX */ 598 /* fill in remaining high mode bits e.g. SUID, VTX */
590 get_sfu_mode(inode, search_path, cifs_sb, xid); 599 get_sfu_mode(inode, full_path, cifs_sb, xid);
591 } else if (atomic_read(&cifsInfo->inUse) == 0) { 600 } else if (atomic_read(&cifsInfo->inUse) == 0) {
592 inode->i_uid = cifs_sb->mnt_uid; 601 inode->i_uid = cifs_sb->mnt_uid;
593 inode->i_gid = cifs_sb->mnt_gid; 602 inode->i_gid = cifs_sb->mnt_gid;
594 /* set so we do not keep refreshing these fields with 603 /* set so we do not keep refreshing these fields with
595 bad data after user has changed them in memory */ 604 bad data after user has changed them in memory */
596 atomic_set(&cifsInfo->inUse, 1); 605 atomic_set(&cifsInfo->inUse, 1);
597 }
598
599 cifs_set_ops(inode, is_dfs_referral);
600 } 606 }
607
608 cifs_set_ops(inode, is_dfs_referral);
609
610
611
612
601cgii_exit: 613cgii_exit:
602 if (full_path != search_path)
603 kfree(full_path);
604 kfree(buf); 614 kfree(buf);
605 return rc; 615 return rc;
606} 616}
@@ -974,8 +984,8 @@ mkdir_get_info:
974 * failed to get it from the server or was set bogus */ 984 * failed to get it from the server or was set bogus */
975 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) 985 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2))
976 direntry->d_inode->i_nlink = 2; 986 direntry->d_inode->i_nlink = 2;
987 mode &= ~current->fs->umask;
977 if (pTcon->unix_ext) { 988 if (pTcon->unix_ext) {
978 mode &= ~current->fs->umask;
979 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 989 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
980 CIFSSMBUnixSetPerms(xid, pTcon, full_path, 990 CIFSSMBUnixSetPerms(xid, pTcon, full_path,
981 mode, 991 mode,
@@ -994,12 +1004,22 @@ mkdir_get_info:
994 CIFS_MOUNT_MAP_SPECIAL_CHR); 1004 CIFS_MOUNT_MAP_SPECIAL_CHR);
995 } 1005 }
996 } else { 1006 } else {
997 /* BB to be implemented via Windows secrty descriptors 1007 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) &&
998 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, 1008 (mode & S_IWUGO) == 0) {
999 -1, -1, local_nls); */ 1009 FILE_BASIC_INFO pInfo;
1010 memset(&pInfo, 0, sizeof(pInfo));
1011 pInfo.Attributes = cpu_to_le32(ATTR_READONLY);
1012 CIFSSMBSetTimes(xid, pTcon, full_path,
1013 &pInfo, cifs_sb->local_nls,
1014 cifs_sb->mnt_cifs_flags &
1015 CIFS_MOUNT_MAP_SPECIAL_CHR);
1016 }
1000 if (direntry->d_inode) { 1017 if (direntry->d_inode) {
1001 direntry->d_inode->i_mode = mode; 1018 if (cifs_sb->mnt_cifs_flags &
1002 direntry->d_inode->i_mode |= S_IFDIR; 1019 CIFS_MOUNT_DYNPERM)
1020 direntry->d_inode->i_mode =
1021 (mode | S_IFDIR);
1022
1003 if (cifs_sb->mnt_cifs_flags & 1023 if (cifs_sb->mnt_cifs_flags &
1004 CIFS_MOUNT_SET_UID) { 1024 CIFS_MOUNT_SET_UID) {
1005 direntry->d_inode->i_uid = 1025 direntry->d_inode->i_uid =
@@ -1408,18 +1428,19 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1408 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1428 __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
1409 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1429 __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
1410 struct cifsInodeInfo *cifsInode; 1430 struct cifsInodeInfo *cifsInode;
1431 struct inode *inode = direntry->d_inode;
1411 1432
1412 xid = GetXid(); 1433 xid = GetXid();
1413 1434
1414 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", 1435 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x",
1415 direntry->d_name.name, attrs->ia_valid)); 1436 direntry->d_name.name, attrs->ia_valid));
1416 1437
1417 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1438 cifs_sb = CIFS_SB(inode->i_sb);
1418 pTcon = cifs_sb->tcon; 1439 pTcon = cifs_sb->tcon;
1419 1440
1420 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { 1441 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
1421 /* check if we have permission to change attrs */ 1442 /* check if we have permission to change attrs */
1422 rc = inode_change_ok(direntry->d_inode, attrs); 1443 rc = inode_change_ok(inode, attrs);
1423 if (rc < 0) { 1444 if (rc < 0) {
1424 FreeXid(xid); 1445 FreeXid(xid);
1425 return rc; 1446 return rc;
@@ -1432,7 +1453,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1432 FreeXid(xid); 1453 FreeXid(xid);
1433 return -ENOMEM; 1454 return -ENOMEM;
1434 } 1455 }
1435 cifsInode = CIFS_I(direntry->d_inode); 1456 cifsInode = CIFS_I(inode);
1436 1457
1437 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { 1458 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) {
1438 /* 1459 /*
@@ -1443,9 +1464,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1443 will be truncated anyway? Also, should we error out here if 1464 will be truncated anyway? Also, should we error out here if
1444 the flush returns error? 1465 the flush returns error?
1445 */ 1466 */
1446 rc = filemap_write_and_wait(direntry->d_inode->i_mapping); 1467 rc = filemap_write_and_wait(inode->i_mapping);
1447 if (rc != 0) { 1468 if (rc != 0) {
1448 CIFS_I(direntry->d_inode)->write_behind_rc = rc; 1469 cifsInode->write_behind_rc = rc;
1449 rc = 0; 1470 rc = 0;
1450 } 1471 }
1451 } 1472 }
@@ -1494,8 +1515,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1494 int oplock = 0; 1515 int oplock = 0;
1495 1516
1496 rc = SMBLegacyOpen(xid, pTcon, full_path, 1517 rc = SMBLegacyOpen(xid, pTcon, full_path,
1497 FILE_OPEN, 1518 FILE_OPEN, GENERIC_WRITE,
1498 SYNCHRONIZE | FILE_WRITE_ATTRIBUTES,
1499 CREATE_NOT_DIR, &netfid, &oplock, 1519 CREATE_NOT_DIR, &netfid, &oplock,
1500 NULL, cifs_sb->local_nls, 1520 NULL, cifs_sb->local_nls,
1501 cifs_sb->mnt_cifs_flags & 1521 cifs_sb->mnt_cifs_flags &
@@ -1521,19 +1541,31 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1521 */ 1541 */
1522 1542
1523 if (rc == 0) { 1543 if (rc == 0) {
1524 rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); 1544 rc = cifs_vmtruncate(inode, attrs->ia_size);
1525 cifs_truncate_page(direntry->d_inode->i_mapping, 1545 cifs_truncate_page(inode->i_mapping, inode->i_size);
1526 direntry->d_inode->i_size);
1527 } else 1546 } else
1528 goto cifs_setattr_exit; 1547 goto cifs_setattr_exit;
1529 } 1548 }
1530 if (attrs->ia_valid & ATTR_UID) { 1549
1531 cFYI(1, ("UID changed to %d", attrs->ia_uid)); 1550 /*
1532 uid = attrs->ia_uid; 1551 * Without unix extensions we can't send ownership changes to the
1533 } 1552 * server, so silently ignore them. This is consistent with how
1534 if (attrs->ia_valid & ATTR_GID) { 1553 * local DOS/Windows filesystems behave (VFAT, NTFS, etc). With
1535 cFYI(1, ("GID changed to %d", attrs->ia_gid)); 1554 * CIFSACL support + proper Windows to Unix idmapping, we may be
1536 gid = attrs->ia_gid; 1555 * able to support this in the future.
1556 */
1557 if (!pTcon->unix_ext &&
1558 !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) {
1559 attrs->ia_valid &= ~(ATTR_UID | ATTR_GID);
1560 } else {
1561 if (attrs->ia_valid & ATTR_UID) {
1562 cFYI(1, ("UID changed to %d", attrs->ia_uid));
1563 uid = attrs->ia_uid;
1564 }
1565 if (attrs->ia_valid & ATTR_GID) {
1566 cFYI(1, ("GID changed to %d", attrs->ia_gid));
1567 gid = attrs->ia_gid;
1568 }
1537 } 1569 }
1538 1570
1539 time_buf.Attributes = 0; 1571 time_buf.Attributes = 0;
@@ -1543,7 +1575,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1543 attrs->ia_valid &= ~ATTR_MODE; 1575 attrs->ia_valid &= ~ATTR_MODE;
1544 1576
1545 if (attrs->ia_valid & ATTR_MODE) { 1577 if (attrs->ia_valid & ATTR_MODE) {
1546 cFYI(1, ("Mode changed to 0x%x", attrs->ia_mode)); 1578 cFYI(1, ("Mode changed to 0%o", attrs->ia_mode));
1547 mode = attrs->ia_mode; 1579 mode = attrs->ia_mode;
1548 } 1580 }
1549 1581
@@ -1557,19 +1589,19 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1557 rc = 0; 1589 rc = 0;
1558#ifdef CONFIG_CIFS_EXPERIMENTAL 1590#ifdef CONFIG_CIFS_EXPERIMENTAL
1559 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) 1591 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
1560 rc = mode_to_acl(direntry->d_inode, full_path, mode); 1592 rc = mode_to_acl(inode, full_path, mode);
1561 else if ((mode & S_IWUGO) == 0) { 1593 else
1562#else
1563 if ((mode & S_IWUGO) == 0) {
1564#endif 1594#endif
1565 /* not writeable */ 1595 if (((mode & S_IWUGO) == 0) &&
1566 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { 1596 (cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
1567 set_dosattr = true; 1597 set_dosattr = true;
1568 time_buf.Attributes = 1598 time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs |
1569 cpu_to_le32(cifsInode->cifsAttrs | 1599 ATTR_READONLY);
1570 ATTR_READONLY); 1600 /* fix up mode if we're not using dynperm */
1571 } 1601 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0)
1572 } else if (cifsInode->cifsAttrs & ATTR_READONLY) { 1602 attrs->ia_mode = inode->i_mode & ~S_IWUGO;
1603 } else if ((mode & S_IWUGO) &&
1604 (cifsInode->cifsAttrs & ATTR_READONLY)) {
1573 /* If file is readonly on server, we would 1605 /* If file is readonly on server, we would
1574 not be able to write to it - so if any write 1606 not be able to write to it - so if any write
1575 bit is enabled for user or group or other we 1607 bit is enabled for user or group or other we
@@ -1580,6 +1612,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1580 /* Windows ignores set to zero */ 1612 /* Windows ignores set to zero */
1581 if (time_buf.Attributes == 0) 1613 if (time_buf.Attributes == 0)
1582 time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); 1614 time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL);
1615
1616 /* reset local inode permissions to normal */
1617 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
1618 attrs->ia_mode &= ~(S_IALLUGO);
1619 if (S_ISDIR(inode->i_mode))
1620 attrs->ia_mode |=
1621 cifs_sb->mnt_dir_mode;
1622 else
1623 attrs->ia_mode |=
1624 cifs_sb->mnt_file_mode;
1625 }
1626 } else if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
1627 /* ignore mode change - ATTR_READONLY hasn't changed */
1628 attrs->ia_valid &= ~ATTR_MODE;
1583 } 1629 }
1584 } 1630 }
1585 1631
@@ -1665,7 +1711,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1665 /* do not need local check to inode_check_ok since the server does 1711 /* do not need local check to inode_check_ok since the server does
1666 that */ 1712 that */
1667 if (!rc) 1713 if (!rc)
1668 rc = inode_setattr(direntry->d_inode, attrs); 1714 rc = inode_setattr(inode, attrs);
1669cifs_setattr_exit: 1715cifs_setattr_exit:
1670 kfree(full_path); 1716 kfree(full_path);
1671 FreeXid(xid); 1717 FreeXid(xid);
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 5c792df13d62..0088a5b52564 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -30,9 +30,9 @@
30 30
31#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) 31#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
32 32
33int cifs_ioctl(struct inode *inode, struct file *filep, 33long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
34 unsigned int command, unsigned long arg)
35{ 34{
35 struct inode *inode = filep->f_dentry->d_inode;
36 int rc = -ENOTTY; /* strange error - but the precedent */ 36 int rc = -ENOTTY; /* strange error - but the precedent */
37 int xid; 37 int xid;
38 struct cifs_sb_info *cifs_sb; 38 struct cifs_sb_info *cifs_sb;
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 1c2c3ce5020b..63f644000ce5 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -234,7 +234,6 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
234 struct cifs_sb_info *cifs_sb; 234 struct cifs_sb_info *cifs_sb;
235 struct cifsTconInfo *pTcon; 235 struct cifsTconInfo *pTcon;
236 char *full_path = NULL; 236 char *full_path = NULL;
237 char *tmp_path = NULL;
238 char *tmpbuffer; 237 char *tmpbuffer;
239 int len; 238 int len;
240 __u16 fid; 239 __u16 fid;
@@ -295,45 +294,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
295 cFYI(1, ("Error closing junction point " 294 cFYI(1, ("Error closing junction point "
296 "(open for ioctl)")); 295 "(open for ioctl)"));
297 } 296 }
298 /* BB unwind this long, nested function, or remove BB */ 297 /* If it is a DFS junction earlier we would have gotten
299 if (rc == -EIO) { 298 PATH_NOT_COVERED returned from server so we do
300 /* Query if DFS Junction */ 299 not need to request the DFS info here */
301 unsigned int num_referrals = 0;
302 struct dfs_info3_param *refs = NULL;
303 tmp_path =
304 kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1,
305 GFP_KERNEL);
306 if (tmp_path) {
307 strncpy(tmp_path, pTcon->treeName,
308 MAX_TREE_SIZE);
309 strncat(tmp_path, full_path,
310 MAX_PATHCONF);
311 rc = get_dfs_path(xid, pTcon->ses,
312 tmp_path,
313 cifs_sb->local_nls,
314 &num_referrals, &refs,
315 cifs_sb->mnt_cifs_flags &
316 CIFS_MOUNT_MAP_SPECIAL_CHR);
317 cFYI(1, ("Get DFS for %s rc = %d ",
318 tmp_path, rc));
319 if ((num_referrals == 0) && (rc == 0))
320 rc = -EACCES;
321 else {
322 cFYI(1, ("num referral: %d",
323 num_referrals));
324 if (refs && refs->path_name) {
325 strncpy(tmpbuffer,
326 refs->path_name,
327 len-1);
328 }
329 }
330 kfree(refs);
331 kfree(tmp_path);
332}
333 /* BB add code like else decode referrals
334 then memcpy to tmpbuffer and free referrals
335 string array BB */
336 }
337 } 300 }
338 } 301 }
339 /* BB Anything else to do to handle recursive links? */ 302 /* BB Anything else to do to handle recursive links? */
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 1d69b8014e0b..4b17f8fe3157 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -519,8 +519,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
519 pnotify = (struct file_notify_information *) 519 pnotify = (struct file_notify_information *)
520 ((char *)&pSMBr->hdr.Protocol + data_offset); 520 ((char *)&pSMBr->hdr.Protocol + data_offset);
521 cFYI(1, ("dnotify on %s Action: 0x%x", 521 cFYI(1, ("dnotify on %s Action: 0x%x",
522 pnotify->FileName, 522 pnotify->FileName, pnotify->Action));
523 pnotify->Action)); /* BB removeme BB */
524 /* cifs_dump_mem("Rcvd notify Data: ",buf, 523 /* cifs_dump_mem("Rcvd notify Data: ",buf,
525 sizeof(struct smb_hdr)+60); */ 524 sizeof(struct smb_hdr)+60); */
526 return true; 525 return true;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 00f4cff400b3..8703d68f5b20 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -141,11 +141,11 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst)
141 int ret = 0; 141 int ret = 0;
142 142
143 /* calculate length by finding first slash or NULL */ 143 /* calculate length by finding first slash or NULL */
144 if (address_family == AF_INET) { 144 if (address_family == AF_INET)
145 ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); 145 ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL);
146 } else if (address_family == AF_INET6) { 146 else if (address_family == AF_INET6)
147 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); 147 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
148 } 148
149 cFYI(DBG2, ("address conversion returned %d for %s", ret, cp)); 149 cFYI(DBG2, ("address conversion returned %d for %s", ret, cp));
150 if (ret > 0) 150 if (ret > 0)
151 ret = 1; 151 ret = 1;
diff --git a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h
index 7170a9b70f1e..c377d8065d99 100644
--- a/fs/cifs/ntlmssp.h
+++ b/fs/cifs/ntlmssp.h
@@ -64,7 +64,7 @@ typedef struct _SECURITY_BUFFER {
64} __attribute__((packed)) SECURITY_BUFFER; 64} __attribute__((packed)) SECURITY_BUFFER;
65 65
66typedef struct _NEGOTIATE_MESSAGE { 66typedef struct _NEGOTIATE_MESSAGE {
67 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; 67 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
68 __le32 MessageType; /* 1 */ 68 __le32 MessageType; /* 1 */
69 __le32 NegotiateFlags; 69 __le32 NegotiateFlags;
70 SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ 70 SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */
@@ -74,7 +74,7 @@ typedef struct _NEGOTIATE_MESSAGE {
74} __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; 74} __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE;
75 75
76typedef struct _CHALLENGE_MESSAGE { 76typedef struct _CHALLENGE_MESSAGE {
77 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; 77 __u8 Signature[sizeof(NTLMSSP_SIGNATURE)];
78 __le32 MessageType; /* 2 */ 78 __le32 MessageType; /* 2 */
79 SECURITY_BUFFER TargetName; 79 SECURITY_BUFFER TargetName;
80 __le32 NegotiateFlags; 80 __le32 NegotiateFlags;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 34ec32100c72..83f306954883 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -132,6 +132,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
132 __u32 attr; 132 __u32 attr;
133 __u64 allocation_size; 133 __u64 allocation_size;
134 __u64 end_of_file; 134 __u64 end_of_file;
135 umode_t default_mode;
135 136
136 /* save mtime and size */ 137 /* save mtime and size */
137 local_mtime = tmp_inode->i_mtime; 138 local_mtime = tmp_inode->i_mtime;
@@ -187,48 +188,54 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
187 if (atomic_read(&cifsInfo->inUse) == 0) { 188 if (atomic_read(&cifsInfo->inUse) == 0) {
188 tmp_inode->i_uid = cifs_sb->mnt_uid; 189 tmp_inode->i_uid = cifs_sb->mnt_uid;
189 tmp_inode->i_gid = cifs_sb->mnt_gid; 190 tmp_inode->i_gid = cifs_sb->mnt_gid;
190 /* set default mode. will override for dirs below */ 191 }
191 tmp_inode->i_mode = cifs_sb->mnt_file_mode; 192
192 } else { 193 if (attr & ATTR_DIRECTORY)
193 /* mask off the type bits since it gets set 194 default_mode = cifs_sb->mnt_dir_mode;
194 below and we do not want to get two type 195 else
195 bits set */ 196 default_mode = cifs_sb->mnt_file_mode;
197
198 /* set initial permissions */
199 if ((atomic_read(&cifsInfo->inUse) == 0) ||
200 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0)
201 tmp_inode->i_mode = default_mode;
202 else {
203 /* just reenable write bits if !ATTR_READONLY */
204 if ((tmp_inode->i_mode & S_IWUGO) == 0 &&
205 (attr & ATTR_READONLY) == 0)
206 tmp_inode->i_mode |= (S_IWUGO & default_mode);
207
196 tmp_inode->i_mode &= ~S_IFMT; 208 tmp_inode->i_mode &= ~S_IFMT;
197 } 209 }
198 210
199 if (attr & ATTR_DIRECTORY) { 211 /* clear write bits if ATTR_READONLY is set */
200 *pobject_type = DT_DIR; 212 if (attr & ATTR_READONLY)
201 /* override default perms since we do not lock dirs */ 213 tmp_inode->i_mode &= ~S_IWUGO;
202 if (atomic_read(&cifsInfo->inUse) == 0) 214
203 tmp_inode->i_mode = cifs_sb->mnt_dir_mode; 215 /* set inode type */
204 tmp_inode->i_mode |= S_IFDIR; 216 if ((attr & ATTR_SYSTEM) &&
205 } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && 217 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) {
206 (attr & ATTR_SYSTEM)) {
207 if (end_of_file == 0) { 218 if (end_of_file == 0) {
208 *pobject_type = DT_FIFO;
209 tmp_inode->i_mode |= S_IFIFO; 219 tmp_inode->i_mode |= S_IFIFO;
220 *pobject_type = DT_FIFO;
210 } else { 221 } else {
211 /* rather than get the type here, we mark the 222 /*
212 inode as needing revalidate and get the real type 223 * trying to get the type can be slow, so just call
213 (blk vs chr vs. symlink) later ie in lookup */ 224 * this a regular file for now, and mark for reval
214 *pobject_type = DT_REG; 225 */
215 tmp_inode->i_mode |= S_IFREG; 226 tmp_inode->i_mode |= S_IFREG;
227 *pobject_type = DT_REG;
216 cifsInfo->time = 0; 228 cifsInfo->time = 0;
217 } 229 }
218/* we no longer mark these because we could not follow them */
219/* } else if (attr & ATTR_REPARSE) {
220 *pobject_type = DT_LNK;
221 tmp_inode->i_mode |= S_IFLNK; */
222 } else { 230 } else {
223 *pobject_type = DT_REG; 231 if (attr & ATTR_DIRECTORY) {
224 tmp_inode->i_mode |= S_IFREG; 232 tmp_inode->i_mode |= S_IFDIR;
225 if (attr & ATTR_READONLY) 233 *pobject_type = DT_DIR;
226 tmp_inode->i_mode &= ~(S_IWUGO); 234 } else {
227 else if ((tmp_inode->i_mode & S_IWUGO) == 0) 235 tmp_inode->i_mode |= S_IFREG;
228 /* the ATTR_READONLY flag may have been changed on */ 236 *pobject_type = DT_REG;
229 /* server -- set any w bits allowed by mnt_file_mode */ 237 }
230 tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode); 238 }
231 } /* could add code here - to validate if device or weird share type? */
232 239
233 /* can not fill in nlink here as in qpathinfo version and Unx search */ 240 /* can not fill in nlink here as in qpathinfo version and Unx search */
234 if (atomic_read(&cifsInfo->inUse) == 0) 241 if (atomic_read(&cifsInfo->inUse) == 0)
@@ -670,10 +677,11 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
670 (index_to_find < first_entry_in_buffer)) { 677 (index_to_find < first_entry_in_buffer)) {
671 /* close and restart search */ 678 /* close and restart search */
672 cFYI(1, ("search backing up - close and restart search")); 679 cFYI(1, ("search backing up - close and restart search"));
673 cifsFile->invalidHandle = true; 680 if (!cifsFile->srch_inf.endOfSearch &&
674 CIFSFindClose(xid, pTcon, cifsFile->netfid); 681 !cifsFile->invalidHandle) {
675 kfree(cifsFile->search_resume_name); 682 cifsFile->invalidHandle = true;
676 cifsFile->search_resume_name = NULL; 683 CIFSFindClose(xid, pTcon, cifsFile->netfid);
684 }
677 if (cifsFile->srch_inf.ntwrk_buf_start) { 685 if (cifsFile->srch_inf.ntwrk_buf_start) {
678 cFYI(1, ("freeing SMB ff cache buf on search rewind")); 686 cFYI(1, ("freeing SMB ff cache buf on search rewind"));
679 if (cifsFile->srch_inf.smallBuf) 687 if (cifsFile->srch_inf.smallBuf)
@@ -1040,9 +1048,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
1040 } /* else { 1048 } /* else {
1041 cifsFile->invalidHandle = true; 1049 cifsFile->invalidHandle = true;
1042 CIFSFindClose(xid, pTcon, cifsFile->netfid); 1050 CIFSFindClose(xid, pTcon, cifsFile->netfid);
1043 } 1051 } */
1044 kfree(cifsFile->search_resume_name);
1045 cifsFile->search_resume_name = NULL; */
1046 1052
1047 rc = find_cifs_entry(xid, pTcon, file, 1053 rc = find_cifs_entry(xid, pTcon, file,
1048 &current_entry, &num_to_fill); 1054 &current_entry, &num_to_fill);
diff --git a/fs/compat.c b/fs/compat.c
index 332a869d2c53..ed43e17a5dc6 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1405,7 +1405,7 @@ int compat_do_execve(char * filename,
1405 /* execve success */ 1405 /* execve success */
1406 security_bprm_free(bprm); 1406 security_bprm_free(bprm);
1407 acct_update_integrals(current); 1407 acct_update_integrals(current);
1408 kfree(bprm); 1408 free_bprm(bprm);
1409 return retval; 1409 return retval;
1410 } 1410 }
1411 1411
@@ -1424,7 +1424,7 @@ out_file:
1424 } 1424 }
1425 1425
1426out_kfree: 1426out_kfree:
1427 kfree(bprm); 1427 free_bprm(bprm);
1428 1428
1429out_ret: 1429out_ret:
1430 return retval; 1430 return retval;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 7c1e5e5cccd8..637018c891ef 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -50,6 +50,7 @@
50#include <linux/pagemap.h> 50#include <linux/pagemap.h>
51#include <linux/idr.h> 51#include <linux/idr.h>
52#include <linux/file.h> 52#include <linux/file.h>
53#include <linux/mutex.h>
53#include <linux/sctp.h> 54#include <linux/sctp.h>
54#include <net/sctp/user.h> 55#include <net/sctp/user.h>
55 56
@@ -138,7 +139,7 @@ static struct workqueue_struct *recv_workqueue;
138static struct workqueue_struct *send_workqueue; 139static struct workqueue_struct *send_workqueue;
139 140
140static DEFINE_IDR(connections_idr); 141static DEFINE_IDR(connections_idr);
141static DECLARE_MUTEX(connections_lock); 142static DEFINE_MUTEX(connections_lock);
142static int max_nodeid; 143static int max_nodeid;
143static struct kmem_cache *con_cache; 144static struct kmem_cache *con_cache;
144 145
@@ -205,9 +206,9 @@ static struct connection *nodeid2con(int nodeid, gfp_t allocation)
205{ 206{
206 struct connection *con; 207 struct connection *con;
207 208
208 down(&connections_lock); 209 mutex_lock(&connections_lock);
209 con = __nodeid2con(nodeid, allocation); 210 con = __nodeid2con(nodeid, allocation);
210 up(&connections_lock); 211 mutex_unlock(&connections_lock);
211 212
212 return con; 213 return con;
213} 214}
@@ -218,15 +219,15 @@ static struct connection *assoc2con(int assoc_id)
218 int i; 219 int i;
219 struct connection *con; 220 struct connection *con;
220 221
221 down(&connections_lock); 222 mutex_lock(&connections_lock);
222 for (i=0; i<=max_nodeid; i++) { 223 for (i=0; i<=max_nodeid; i++) {
223 con = __nodeid2con(i, 0); 224 con = __nodeid2con(i, 0);
224 if (con && con->sctp_assoc == assoc_id) { 225 if (con && con->sctp_assoc == assoc_id) {
225 up(&connections_lock); 226 mutex_unlock(&connections_lock);
226 return con; 227 return con;
227 } 228 }
228 } 229 }
229 up(&connections_lock); 230 mutex_unlock(&connections_lock);
230 return NULL; 231 return NULL;
231} 232}
232 233
@@ -381,7 +382,7 @@ static void sctp_init_failed(void)
381 int i; 382 int i;
382 struct connection *con; 383 struct connection *con;
383 384
384 down(&connections_lock); 385 mutex_lock(&connections_lock);
385 for (i=1; i<=max_nodeid; i++) { 386 for (i=1; i<=max_nodeid; i++) {
386 con = __nodeid2con(i, 0); 387 con = __nodeid2con(i, 0);
387 if (!con) 388 if (!con)
@@ -393,7 +394,7 @@ static void sctp_init_failed(void)
393 } 394 }
394 } 395 }
395 } 396 }
396 up(&connections_lock); 397 mutex_unlock(&connections_lock);
397} 398}
398 399
399/* Something happened to an association */ 400/* Something happened to an association */
@@ -930,7 +931,7 @@ out_err:
930 * errors we try again until the max number of retries is reached. 931 * errors we try again until the max number of retries is reached.
931 */ 932 */
932 if (result != -EHOSTUNREACH && result != -ENETUNREACH && 933 if (result != -EHOSTUNREACH && result != -ENETUNREACH &&
933 result != -ENETDOWN && result != EINVAL 934 result != -ENETDOWN && result != -EINVAL
934 && result != -EPROTONOSUPPORT) { 935 && result != -EPROTONOSUPPORT) {
935 lowcomms_connect_sock(con); 936 lowcomms_connect_sock(con);
936 result = 0; 937 result = 0;
@@ -1417,7 +1418,7 @@ void dlm_lowcomms_stop(void)
1417 /* Set all the flags to prevent any 1418 /* Set all the flags to prevent any
1418 socket activity. 1419 socket activity.
1419 */ 1420 */
1420 down(&connections_lock); 1421 mutex_lock(&connections_lock);
1421 for (i = 0; i <= max_nodeid; i++) { 1422 for (i = 0; i <= max_nodeid; i++) {
1422 con = __nodeid2con(i, 0); 1423 con = __nodeid2con(i, 0);
1423 if (con) { 1424 if (con) {
@@ -1426,11 +1427,11 @@ void dlm_lowcomms_stop(void)
1426 con->sock->sk->sk_user_data = NULL; 1427 con->sock->sk->sk_user_data = NULL;
1427 } 1428 }
1428 } 1429 }
1429 up(&connections_lock); 1430 mutex_unlock(&connections_lock);
1430 1431
1431 work_stop(); 1432 work_stop();
1432 1433
1433 down(&connections_lock); 1434 mutex_lock(&connections_lock);
1434 clean_writequeues(); 1435 clean_writequeues();
1435 1436
1436 for (i = 0; i <= max_nodeid; i++) { 1437 for (i = 0; i <= max_nodeid; i++) {
@@ -1443,7 +1444,7 @@ void dlm_lowcomms_stop(void)
1443 } 1444 }
1444 } 1445 }
1445 max_nodeid = 0; 1446 max_nodeid = 0;
1446 up(&connections_lock); 1447 mutex_unlock(&connections_lock);
1447 kmem_cache_destroy(con_cache); 1448 kmem_cache_destroy(con_cache);
1448 idr_init(&connections_idr); 1449 idr_init(&connections_idr);
1449} 1450}
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c
index 714593621f4f..18bda83cc892 100644
--- a/fs/dlm/netlink.c
+++ b/fs/dlm/netlink.c
@@ -95,7 +95,7 @@ int __init dlm_netlink_init(void)
95 return rv; 95 return rv;
96} 96}
97 97
98void __exit dlm_netlink_exit(void) 98void dlm_netlink_exit(void)
99{ 99{
100 genl_unregister_ops(&family, &dlm_nl_ops); 100 genl_unregister_ops(&family, &dlm_nl_ops);
101 genl_unregister_family(&family); 101 genl_unregister_family(&family);
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index d6d6e370f89c..78878c5781ca 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -379,7 +379,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
379 struct plock_xop *xop; 379 struct plock_xop *xop;
380 xop = (struct plock_xop *)op; 380 xop = (struct plock_xop *)op;
381 if (xop->callback) 381 if (xop->callback)
382 count = dlm_plock_callback(op); 382 dlm_plock_callback(op);
383 else 383 else
384 wake_up(&recv_wq); 384 wake_up(&recv_wq);
385 } else 385 } else
diff --git a/fs/dquot.c b/fs/dquot.c
index dfba1623cccb..5ac77da19959 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1491,6 +1491,16 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1491 1491
1492 /* We need to serialize quota_off() for device */ 1492 /* We need to serialize quota_off() for device */
1493 mutex_lock(&dqopt->dqonoff_mutex); 1493 mutex_lock(&dqopt->dqonoff_mutex);
1494
1495 /*
1496 * Skip everything if there's nothing to do. We have to do this because
1497 * sometimes we are called when fill_super() failed and calling
1498 * sync_fs() in such cases does no good.
1499 */
1500 if (!sb_any_quota_enabled(sb) && !sb_any_quota_suspended(sb)) {
1501 mutex_unlock(&dqopt->dqonoff_mutex);
1502 return 0;
1503 }
1494 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1504 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1495 toputinode[cnt] = NULL; 1505 toputinode[cnt] = NULL;
1496 if (type != -1 && cnt != type) 1506 if (type != -1 && cnt != type)
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index cd62d75b2cc0..e2832bc7869a 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1906,9 +1906,9 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
1906 goto out; 1906 goto out;
1907 } 1907 }
1908 } 1908 }
1909 mutex_unlock(&key_tfm_list_mutex);
1910 (*tfm) = key_tfm->key_tfm; 1909 (*tfm) = key_tfm->key_tfm;
1911 (*tfm_mutex) = &key_tfm->key_tfm_mutex; 1910 (*tfm_mutex) = &key_tfm->key_tfm_mutex;
1912out: 1911out:
1912 mutex_unlock(&key_tfm_list_mutex);
1913 return rc; 1913 return rc;
1914} 1914}
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 951ee33a022d..c15c25745e05 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -660,8 +660,6 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
660int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key, 660int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key,
661 struct ecryptfs_auth_tok **auth_tok, 661 struct ecryptfs_auth_tok **auth_tok,
662 char *sig); 662 char *sig);
663int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start,
664 int num_zeros);
665int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, 663int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
666 loff_t offset, size_t size); 664 loff_t offset, size_t size);
667int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, 665int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 0a1397335a8e..c92cc1c00aae 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -37,17 +37,11 @@ static struct dentry *lock_parent(struct dentry *dentry)
37{ 37{
38 struct dentry *dir; 38 struct dentry *dir;
39 39
40 dir = dget(dentry->d_parent); 40 dir = dget_parent(dentry);
41 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT); 41 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT);
42 return dir; 42 return dir;
43} 43}
44 44
45static void unlock_parent(struct dentry *dentry)
46{
47 mutex_unlock(&(dentry->d_parent->d_inode->i_mutex));
48 dput(dentry->d_parent);
49}
50
51static void unlock_dir(struct dentry *dir) 45static void unlock_dir(struct dentry *dir)
52{ 46{
53 mutex_unlock(&dir->d_inode->i_mutex); 47 mutex_unlock(&dir->d_inode->i_mutex);
@@ -426,8 +420,9 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
426 int rc = 0; 420 int rc = 0;
427 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); 421 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
428 struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir); 422 struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir);
423 struct dentry *lower_dir_dentry;
429 424
430 lock_parent(lower_dentry); 425 lower_dir_dentry = lock_parent(lower_dentry);
431 rc = vfs_unlink(lower_dir_inode, lower_dentry); 426 rc = vfs_unlink(lower_dir_inode, lower_dentry);
432 if (rc) { 427 if (rc) {
433 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); 428 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
@@ -439,7 +434,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
439 dentry->d_inode->i_ctime = dir->i_ctime; 434 dentry->d_inode->i_ctime = dir->i_ctime;
440 d_drop(dentry); 435 d_drop(dentry);
441out_unlock: 436out_unlock:
442 unlock_parent(lower_dentry); 437 unlock_dir(lower_dir_dentry);
443 return rc; 438 return rc;
444} 439}
445 440
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 788995efd1d3..50c994a249a5 100644
--- a/fs/ecryptfs/miscdev.c
+++ b/fs/ecryptfs/miscdev.c
@@ -243,7 +243,6 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,
243 struct ecryptfs_daemon *daemon; 243 struct ecryptfs_daemon *daemon;
244 struct ecryptfs_msg_ctx *msg_ctx; 244 struct ecryptfs_msg_ctx *msg_ctx;
245 size_t packet_length_size; 245 size_t packet_length_size;
246 u32 counter_nbo;
247 char packet_length[3]; 246 char packet_length[3];
248 size_t i; 247 size_t i;
249 size_t total_length; 248 size_t total_length;
@@ -257,12 +256,14 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,
257 mutex_lock(&daemon->mux); 256 mutex_lock(&daemon->mux);
258 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) { 257 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
259 rc = 0; 258 rc = 0;
259 mutex_unlock(&ecryptfs_daemon_hash_mux);
260 printk(KERN_WARNING "%s: Attempt to read from zombified " 260 printk(KERN_WARNING "%s: Attempt to read from zombified "
261 "daemon\n", __func__); 261 "daemon\n", __func__);
262 goto out_unlock_daemon; 262 goto out_unlock_daemon;
263 } 263 }
264 if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) { 264 if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) {
265 rc = 0; 265 rc = 0;
266 mutex_unlock(&ecryptfs_daemon_hash_mux);
266 goto out_unlock_daemon; 267 goto out_unlock_daemon;
267 } 268 }
268 /* This daemon will not go away so long as this flag is set */ 269 /* This daemon will not go away so long as this flag is set */
@@ -326,20 +327,18 @@ check_list:
326 "pending message\n", __func__, count, total_length); 327 "pending message\n", __func__, count, total_length);
327 goto out_unlock_msg_ctx; 328 goto out_unlock_msg_ctx;
328 } 329 }
329 i = 0; 330 rc = -EFAULT;
330 buf[i++] = msg_ctx->type; 331 if (put_user(msg_ctx->type, buf))
331 counter_nbo = cpu_to_be32(msg_ctx->counter); 332 goto out_unlock_msg_ctx;
332 memcpy(&buf[i], (char *)&counter_nbo, 4); 333 if (put_user(cpu_to_be32(msg_ctx->counter), (__be32 __user *)(buf + 1)))
333 i += 4; 334 goto out_unlock_msg_ctx;
335 i = 5;
334 if (msg_ctx->msg) { 336 if (msg_ctx->msg) {
335 memcpy(&buf[i], packet_length, packet_length_size); 337 if (copy_to_user(&buf[i], packet_length, packet_length_size))
338 goto out_unlock_msg_ctx;
336 i += packet_length_size; 339 i += packet_length_size;
337 rc = copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size); 340 if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size))
338 if (rc) {
339 printk(KERN_ERR "%s: copy_to_user returned error "
340 "[%d]\n", __func__, rc);
341 goto out_unlock_msg_ctx; 341 goto out_unlock_msg_ctx;
342 }
343 i += msg_ctx->msg_size; 342 i += msg_ctx->msg_size;
344 } 343 }
345 rc = i; 344 rc = i;
@@ -450,7 +449,8 @@ static ssize_t
450ecryptfs_miscdev_write(struct file *file, const char __user *buf, 449ecryptfs_miscdev_write(struct file *file, const char __user *buf,
451 size_t count, loff_t *ppos) 450 size_t count, loff_t *ppos)
452{ 451{
453 u32 counter_nbo, seq; 452 __be32 counter_nbo;
453 u32 seq;
454 size_t packet_size, packet_size_length, i; 454 size_t packet_size, packet_size_length, i;
455 ssize_t sz = 0; 455 ssize_t sz = 0;
456 char *data; 456 char *data;
@@ -483,7 +483,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
483 count); 483 count);
484 goto out_free; 484 goto out_free;
485 } 485 }
486 memcpy((char *)&counter_nbo, &data[i], 4); 486 memcpy(&counter_nbo, &data[i], 4);
487 seq = be32_to_cpu(counter_nbo); 487 seq = be32_to_cpu(counter_nbo);
488 i += 4; 488 i += 4;
489 rc = ecryptfs_parse_packet_length(&data[i], &packet_size, 489 rc = ecryptfs_parse_packet_length(&data[i], &packet_size,
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
index ebf55150be56..75c2ea9fee35 100644
--- a/fs/ecryptfs/read_write.c
+++ b/fs/ecryptfs/read_write.c
@@ -157,20 +157,6 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
157 ecryptfs_page_idx, rc); 157 ecryptfs_page_idx, rc);
158 goto out; 158 goto out;
159 } 159 }
160 if (start_offset_in_page) {
161 /* Read in the page from the lower
162 * into the eCryptfs inode page cache,
163 * decrypting */
164 rc = ecryptfs_decrypt_page(ecryptfs_page);
165 if (rc) {
166 printk(KERN_ERR "%s: Error decrypting "
167 "page; rc = [%d]\n",
168 __func__, rc);
169 ClearPageUptodate(ecryptfs_page);
170 page_cache_release(ecryptfs_page);
171 goto out;
172 }
173 }
174 ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); 160 ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0);
175 161
176 /* 162 /*
@@ -349,14 +335,6 @@ int ecryptfs_read(char *data, loff_t offset, size_t size,
349 ecryptfs_page_idx, rc); 335 ecryptfs_page_idx, rc);
350 goto out; 336 goto out;
351 } 337 }
352 rc = ecryptfs_decrypt_page(ecryptfs_page);
353 if (rc) {
354 printk(KERN_ERR "%s: Error decrypting "
355 "page; rc = [%d]\n", __func__, rc);
356 ClearPageUptodate(ecryptfs_page);
357 page_cache_release(ecryptfs_page);
358 goto out;
359 }
360 ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); 338 ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0);
361 memcpy((data + data_offset), 339 memcpy((data + data_offset),
362 ((char *)ecryptfs_page_virt + start_offset_in_page), 340 ((char *)ecryptfs_page_virt + start_offset_in_page),
diff --git a/fs/exec.c b/fs/exec.c
index aeaa9791d8be..9448f1b50b4a 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -736,7 +736,7 @@ static int exec_mmap(struct mm_struct *mm)
736 tsk->active_mm = mm; 736 tsk->active_mm = mm;
737 activate_mm(active_mm, mm); 737 activate_mm(active_mm, mm);
738 task_unlock(tsk); 738 task_unlock(tsk);
739 mm_update_next_owner(mm); 739 mm_update_next_owner(old_mm);
740 arch_pick_mmap_layout(mm); 740 arch_pick_mmap_layout(mm);
741 if (old_mm) { 741 if (old_mm) {
742 up_read(&old_mm->mmap_sem); 742 up_read(&old_mm->mmap_sem);
@@ -860,6 +860,7 @@ static int de_thread(struct task_struct *tsk)
860 860
861no_thread_group: 861no_thread_group:
862 exit_itimers(sig); 862 exit_itimers(sig);
863 flush_itimer_signals();
863 if (leader) 864 if (leader)
864 release_task(leader); 865 release_task(leader);
865 866
@@ -1251,6 +1252,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1251 1252
1252EXPORT_SYMBOL(search_binary_handler); 1253EXPORT_SYMBOL(search_binary_handler);
1253 1254
1255void free_bprm(struct linux_binprm *bprm)
1256{
1257 free_arg_pages(bprm);
1258 kfree(bprm);
1259}
1260
1254/* 1261/*
1255 * sys_execve() executes a new program. 1262 * sys_execve() executes a new program.
1256 */ 1263 */
@@ -1320,17 +1327,15 @@ int do_execve(char * filename,
1320 retval = search_binary_handler(bprm,regs); 1327 retval = search_binary_handler(bprm,regs);
1321 if (retval >= 0) { 1328 if (retval >= 0) {
1322 /* execve success */ 1329 /* execve success */
1323 free_arg_pages(bprm);
1324 security_bprm_free(bprm); 1330 security_bprm_free(bprm);
1325 acct_update_integrals(current); 1331 acct_update_integrals(current);
1326 kfree(bprm); 1332 free_bprm(bprm);
1327 if (displaced) 1333 if (displaced)
1328 put_files_struct(displaced); 1334 put_files_struct(displaced);
1329 return retval; 1335 return retval;
1330 } 1336 }
1331 1337
1332out: 1338out:
1333 free_arg_pages(bprm);
1334 if (bprm->security) 1339 if (bprm->security)
1335 security_bprm_free(bprm); 1340 security_bprm_free(bprm);
1336 1341
@@ -1344,7 +1349,7 @@ out_file:
1344 fput(bprm->file); 1349 fput(bprm->file);
1345 } 1350 }
1346out_kfree: 1351out_kfree:
1347 kfree(bprm); 1352 free_bprm(bprm);
1348 1353
1349out_files: 1354out_files:
1350 if (displaced) 1355 if (displaced)
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 28cfd0b40527..77278e947e94 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -580,7 +580,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
580 } 580 }
581 581
582 blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count; 582 blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count;
583 data = (__le32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count; 583 data = (__le32 *)dind->b_data + (EXT3_SB(sb)->s_gdb_count %
584 EXT3_ADDR_PER_BLOCK(sb));
584 end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb); 585 end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb);
585 586
586 /* Get each reserved primary GDT block and verify it holds backups */ 587 /* Get each reserved primary GDT block and verify it holds backups */
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index d4a4f0e9ff69..175414ac2210 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1000,6 +1000,11 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
1000 i.value = NULL; 1000 i.value = NULL;
1001 error = ext3_xattr_block_set(handle, inode, &i, &bs); 1001 error = ext3_xattr_block_set(handle, inode, &i, &bs);
1002 } else if (error == -ENOSPC) { 1002 } else if (error == -ENOSPC) {
1003 if (EXT3_I(inode)->i_file_acl && !bs.s.base) {
1004 error = ext3_xattr_block_find(inode, &i, &bs);
1005 if (error)
1006 goto cleanup;
1007 }
1003 error = ext3_xattr_block_set(handle, inode, &i, &bs); 1008 error = ext3_xattr_block_set(handle, inode, &i, &bs);
1004 if (error) 1009 if (error)
1005 goto cleanup; 1010 goto cleanup;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index da994374ec3b..9cc80b9cc8d8 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -43,6 +43,46 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
43 43
44} 44}
45 45
46static int ext4_block_in_group(struct super_block *sb, ext4_fsblk_t block,
47 ext4_group_t block_group)
48{
49 ext4_group_t actual_group;
50 ext4_get_group_no_and_offset(sb, block, &actual_group, 0);
51 if (actual_group == block_group)
52 return 1;
53 return 0;
54}
55
56static int ext4_group_used_meta_blocks(struct super_block *sb,
57 ext4_group_t block_group)
58{
59 ext4_fsblk_t tmp;
60 struct ext4_sb_info *sbi = EXT4_SB(sb);
61 /* block bitmap, inode bitmap, and inode table blocks */
62 int used_blocks = sbi->s_itb_per_group + 2;
63
64 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
65 struct ext4_group_desc *gdp;
66 struct buffer_head *bh;
67
68 gdp = ext4_get_group_desc(sb, block_group, &bh);
69 if (!ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp),
70 block_group))
71 used_blocks--;
72
73 if (!ext4_block_in_group(sb, ext4_inode_bitmap(sb, gdp),
74 block_group))
75 used_blocks--;
76
77 tmp = ext4_inode_table(sb, gdp);
78 for (; tmp < ext4_inode_table(sb, gdp) +
79 sbi->s_itb_per_group; tmp++) {
80 if (!ext4_block_in_group(sb, tmp, block_group))
81 used_blocks -= 1;
82 }
83 }
84 return used_blocks;
85}
46/* Initializes an uninitialized block bitmap if given, and returns the 86/* Initializes an uninitialized block bitmap if given, and returns the
47 * number of blocks free in the group. */ 87 * number of blocks free in the group. */
48unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, 88unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
@@ -105,20 +145,34 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
105 free_blocks = group_blocks - bit_max; 145 free_blocks = group_blocks - bit_max;
106 146
107 if (bh) { 147 if (bh) {
108 ext4_fsblk_t start; 148 ext4_fsblk_t start, tmp;
149 int flex_bg = 0;
109 150
110 for (bit = 0; bit < bit_max; bit++) 151 for (bit = 0; bit < bit_max; bit++)
111 ext4_set_bit(bit, bh->b_data); 152 ext4_set_bit(bit, bh->b_data);
112 153
113 start = ext4_group_first_block_no(sb, block_group); 154 start = ext4_group_first_block_no(sb, block_group);
114 155
115 /* Set bits for block and inode bitmaps, and inode table */ 156 if (EXT4_HAS_INCOMPAT_FEATURE(sb,
116 ext4_set_bit(ext4_block_bitmap(sb, gdp) - start, bh->b_data); 157 EXT4_FEATURE_INCOMPAT_FLEX_BG))
117 ext4_set_bit(ext4_inode_bitmap(sb, gdp) - start, bh->b_data); 158 flex_bg = 1;
118 for (bit = (ext4_inode_table(sb, gdp) - start),
119 bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
120 ext4_set_bit(bit, bh->b_data);
121 159
160 /* Set bits for block and inode bitmaps, and inode table */
161 tmp = ext4_block_bitmap(sb, gdp);
162 if (!flex_bg || ext4_block_in_group(sb, tmp, block_group))
163 ext4_set_bit(tmp - start, bh->b_data);
164
165 tmp = ext4_inode_bitmap(sb, gdp);
166 if (!flex_bg || ext4_block_in_group(sb, tmp, block_group))
167 ext4_set_bit(tmp - start, bh->b_data);
168
169 tmp = ext4_inode_table(sb, gdp);
170 for (; tmp < ext4_inode_table(sb, gdp) +
171 sbi->s_itb_per_group; tmp++) {
172 if (!flex_bg ||
173 ext4_block_in_group(sb, tmp, block_group))
174 ext4_set_bit(tmp - start, bh->b_data);
175 }
122 /* 176 /*
123 * Also if the number of blocks within the group is 177 * Also if the number of blocks within the group is
124 * less than the blocksize * 8 ( which is the size 178 * less than the blocksize * 8 ( which is the size
@@ -126,8 +180,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
126 */ 180 */
127 mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data); 181 mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data);
128 } 182 }
129 183 return free_blocks - ext4_group_used_meta_blocks(sb, block_group);
130 return free_blocks - sbi->s_itb_per_group - 2;
131} 184}
132 185
133 186
@@ -287,11 +340,11 @@ read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
287 (int)block_group, (unsigned long long)bitmap_blk); 340 (int)block_group, (unsigned long long)bitmap_blk);
288 return NULL; 341 return NULL;
289 } 342 }
290 if (!ext4_valid_block_bitmap(sb, desc, block_group, bh)) { 343 ext4_valid_block_bitmap(sb, desc, block_group, bh);
291 put_bh(bh); 344 /*
292 return NULL; 345 * file system mounted not to panic on error,
293 } 346 * continue with corrupt bitmap
294 347 */
295 return bh; 348 return bh;
296} 349}
297/* 350/*
@@ -1770,7 +1823,12 @@ allocated:
1770 "Allocating block in system zone - " 1823 "Allocating block in system zone - "
1771 "blocks from %llu, length %lu", 1824 "blocks from %llu, length %lu",
1772 ret_block, num); 1825 ret_block, num);
1773 goto out; 1826 /*
1827 * claim_block marked the blocks we allocated
1828 * as in use. So we may want to selectively
1829 * mark some of the blocks as free
1830 */
1831 goto retry_alloc;
1774 } 1832 }
1775 1833
1776 performed_allocation = 1; 1834 performed_allocation = 1;
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index fbec2ef93797..c9900aade150 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2639,8 +2639,7 @@ static int ext4_mb_init_per_dev_proc(struct super_block *sb)
2639 struct proc_dir_entry *proc; 2639 struct proc_dir_entry *proc;
2640 char devname[64]; 2640 char devname[64];
2641 2641
2642 snprintf(devname, sizeof(devname) - 1, "%s", 2642 bdevname(sb->s_bdev, devname);
2643 bdevname(sb->s_bdev, devname));
2644 sbi->s_mb_proc = proc_mkdir(devname, proc_root_ext4); 2643 sbi->s_mb_proc = proc_mkdir(devname, proc_root_ext4);
2645 2644
2646 MB_PROC_HANDLER(EXT4_MB_STATS_NAME, stats); 2645 MB_PROC_HANDLER(EXT4_MB_STATS_NAME, stats);
@@ -2674,8 +2673,7 @@ static int ext4_mb_destroy_per_dev_proc(struct super_block *sb)
2674 if (sbi->s_mb_proc == NULL) 2673 if (sbi->s_mb_proc == NULL)
2675 return -EINVAL; 2674 return -EINVAL;
2676 2675
2677 snprintf(devname, sizeof(devname) - 1, "%s", 2676 bdevname(sb->s_bdev, devname);
2678 bdevname(sb->s_bdev, devname));
2679 remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_mb_proc); 2677 remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_mb_proc);
2680 remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_mb_proc); 2678 remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_mb_proc);
2681 remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_mb_proc); 2679 remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_mb_proc);
@@ -2738,7 +2736,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2738 struct ext4_sb_info *sbi; 2736 struct ext4_sb_info *sbi;
2739 struct super_block *sb; 2737 struct super_block *sb;
2740 ext4_fsblk_t block; 2738 ext4_fsblk_t block;
2741 int err; 2739 int err, len;
2742 2740
2743 BUG_ON(ac->ac_status != AC_STATUS_FOUND); 2741 BUG_ON(ac->ac_status != AC_STATUS_FOUND);
2744 BUG_ON(ac->ac_b_ex.fe_len <= 0); 2742 BUG_ON(ac->ac_b_ex.fe_len <= 0);
@@ -2747,8 +2745,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2747 sbi = EXT4_SB(sb); 2745 sbi = EXT4_SB(sb);
2748 es = sbi->s_es; 2746 es = sbi->s_es;
2749 2747
2750 ext4_debug("using block group %lu(%d)\n", ac->ac_b_ex.fe_group,
2751 gdp->bg_free_blocks_count);
2752 2748
2753 err = -EIO; 2749 err = -EIO;
2754 bitmap_bh = read_block_bitmap(sb, ac->ac_b_ex.fe_group); 2750 bitmap_bh = read_block_bitmap(sb, ac->ac_b_ex.fe_group);
@@ -2764,6 +2760,9 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2764 if (!gdp) 2760 if (!gdp)
2765 goto out_err; 2761 goto out_err;
2766 2762
2763 ext4_debug("using block group %lu(%d)\n", ac->ac_b_ex.fe_group,
2764 gdp->bg_free_blocks_count);
2765
2767 err = ext4_journal_get_write_access(handle, gdp_bh); 2766 err = ext4_journal_get_write_access(handle, gdp_bh);
2768 if (err) 2767 if (err)
2769 goto out_err; 2768 goto out_err;
@@ -2772,14 +2771,27 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2772 + ac->ac_b_ex.fe_start 2771 + ac->ac_b_ex.fe_start
2773 + le32_to_cpu(es->s_first_data_block); 2772 + le32_to_cpu(es->s_first_data_block);
2774 2773
2775 if (block == ext4_block_bitmap(sb, gdp) || 2774 len = ac->ac_b_ex.fe_len;
2776 block == ext4_inode_bitmap(sb, gdp) || 2775 if (in_range(ext4_block_bitmap(sb, gdp), block, len) ||
2777 in_range(block, ext4_inode_table(sb, gdp), 2776 in_range(ext4_inode_bitmap(sb, gdp), block, len) ||
2778 EXT4_SB(sb)->s_itb_per_group)) { 2777 in_range(block, ext4_inode_table(sb, gdp),
2779 2778 EXT4_SB(sb)->s_itb_per_group) ||
2779 in_range(block + len - 1, ext4_inode_table(sb, gdp),
2780 EXT4_SB(sb)->s_itb_per_group)) {
2780 ext4_error(sb, __func__, 2781 ext4_error(sb, __func__,
2781 "Allocating block in system zone - block = %llu", 2782 "Allocating block in system zone - block = %llu",
2782 block); 2783 block);
2784 /* File system mounted not to panic on error
2785 * Fix the bitmap and repeat the block allocation
2786 * We leak some of the blocks here.
2787 */
2788 mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group),
2789 bitmap_bh->b_data, ac->ac_b_ex.fe_start,
2790 ac->ac_b_ex.fe_len);
2791 err = ext4_journal_dirty_metadata(handle, bitmap_bh);
2792 if (!err)
2793 err = -EAGAIN;
2794 goto out_err;
2783 } 2795 }
2784#ifdef AGGRESSIVE_CHECK 2796#ifdef AGGRESSIVE_CHECK
2785 { 2797 {
@@ -2882,12 +2894,11 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
2882 if (size < i_size_read(ac->ac_inode)) 2894 if (size < i_size_read(ac->ac_inode))
2883 size = i_size_read(ac->ac_inode); 2895 size = i_size_read(ac->ac_inode);
2884 2896
2885 /* max available blocks in a free group */ 2897 /* max size of free chunks */
2886 max = EXT4_BLOCKS_PER_GROUP(ac->ac_sb) - 1 - 1 - 2898 max = 2 << bsbits;
2887 EXT4_SB(ac->ac_sb)->s_itb_per_group;
2888 2899
2889#define NRL_CHECK_SIZE(req, size, max,bits) \ 2900#define NRL_CHECK_SIZE(req, size, max, chunk_size) \
2890 (req <= (size) || max <= ((size) >> bits)) 2901 (req <= (size) || max <= (chunk_size))
2891 2902
2892 /* first, try to predict filesize */ 2903 /* first, try to predict filesize */
2893 /* XXX: should this table be tunable? */ 2904 /* XXX: should this table be tunable? */
@@ -2906,16 +2917,16 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
2906 size = 512 * 1024; 2917 size = 512 * 1024;
2907 } else if (size <= 1024 * 1024) { 2918 } else if (size <= 1024 * 1024) {
2908 size = 1024 * 1024; 2919 size = 1024 * 1024;
2909 } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, bsbits)) { 2920 } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) {
2910 start_off = ((loff_t)ac->ac_o_ex.fe_logical >> 2921 start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
2911 (20 - bsbits)) << 20; 2922 (21 - bsbits)) << 21;
2912 size = 1024 * 1024; 2923 size = 2 * 1024 * 1024;
2913 } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, bsbits)) { 2924 } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) {
2914 start_off = ((loff_t)ac->ac_o_ex.fe_logical >> 2925 start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
2915 (22 - bsbits)) << 22; 2926 (22 - bsbits)) << 22;
2916 size = 4 * 1024 * 1024; 2927 size = 4 * 1024 * 1024;
2917 } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len, 2928 } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len,
2918 (8<<20)>>bsbits, max, bsbits)) { 2929 (8<<20)>>bsbits, max, 8 * 1024)) {
2919 start_off = ((loff_t)ac->ac_o_ex.fe_logical >> 2930 start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
2920 (23 - bsbits)) << 23; 2931 (23 - bsbits)) << 23;
2921 size = 8 * 1024 * 1024; 2932 size = 8 * 1024 * 1024;
@@ -3084,8 +3095,7 @@ static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac,
3084static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac, 3095static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
3085 struct ext4_prealloc_space *pa) 3096 struct ext4_prealloc_space *pa)
3086{ 3097{
3087 unsigned len = ac->ac_o_ex.fe_len; 3098 unsigned int len = ac->ac_o_ex.fe_len;
3088
3089 ext4_get_group_no_and_offset(ac->ac_sb, pa->pa_pstart, 3099 ext4_get_group_no_and_offset(ac->ac_sb, pa->pa_pstart,
3090 &ac->ac_b_ex.fe_group, 3100 &ac->ac_b_ex.fe_group,
3091 &ac->ac_b_ex.fe_start); 3101 &ac->ac_b_ex.fe_start);
@@ -4035,7 +4045,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4035 4045
4036 ac->ac_op = EXT4_MB_HISTORY_ALLOC; 4046 ac->ac_op = EXT4_MB_HISTORY_ALLOC;
4037 ext4_mb_normalize_request(ac, ar); 4047 ext4_mb_normalize_request(ac, ar);
4038
4039repeat: 4048repeat:
4040 /* allocate space in core */ 4049 /* allocate space in core */
4041 ext4_mb_regular_allocator(ac); 4050 ext4_mb_regular_allocator(ac);
@@ -4049,10 +4058,21 @@ repeat:
4049 } 4058 }
4050 4059
4051 if (likely(ac->ac_status == AC_STATUS_FOUND)) { 4060 if (likely(ac->ac_status == AC_STATUS_FOUND)) {
4052 ext4_mb_mark_diskspace_used(ac, handle); 4061 *errp = ext4_mb_mark_diskspace_used(ac, handle);
4053 *errp = 0; 4062 if (*errp == -EAGAIN) {
4054 block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); 4063 ac->ac_b_ex.fe_group = 0;
4055 ar->len = ac->ac_b_ex.fe_len; 4064 ac->ac_b_ex.fe_start = 0;
4065 ac->ac_b_ex.fe_len = 0;
4066 ac->ac_status = AC_STATUS_CONTINUE;
4067 goto repeat;
4068 } else if (*errp) {
4069 ac->ac_b_ex.fe_len = 0;
4070 ar->len = 0;
4071 ext4_mb_show_ac(ac);
4072 } else {
4073 block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex);
4074 ar->len = ac->ac_b_ex.fe_len;
4075 }
4056 } else { 4076 } else {
4057 freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len); 4077 freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len);
4058 if (freed) 4078 if (freed)
@@ -4239,6 +4259,8 @@ do_more:
4239 ext4_error(sb, __func__, 4259 ext4_error(sb, __func__,
4240 "Freeing blocks in system zone - " 4260 "Freeing blocks in system zone - "
4241 "Block = %lu, count = %lu", block, count); 4261 "Block = %lu, count = %lu", block, count);
4262 /* err = 0. ext4_std_error should be a no op */
4263 goto error_return;
4242 } 4264 }
4243 4265
4244 BUFFER_TRACE(bitmap_bh, "getting write access"); 4266 BUFFER_TRACE(bitmap_bh, "getting write access");
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 9f086a6a472b..9ecb92f68543 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -563,7 +563,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
563 } 563 }
564 564
565 blk = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + EXT4_SB(sb)->s_gdb_count; 565 blk = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + EXT4_SB(sb)->s_gdb_count;
566 data = (__le32 *)dind->b_data + EXT4_SB(sb)->s_gdb_count; 566 data = (__le32 *)dind->b_data + (EXT4_SB(sb)->s_gdb_count %
567 EXT4_ADDR_PER_BLOCK(sb));
567 end = (__le32 *)dind->b_data + EXT4_ADDR_PER_BLOCK(sb); 568 end = (__le32 *)dind->b_data + EXT4_ADDR_PER_BLOCK(sb);
568 569
569 /* Get each reserved primary GDT block and verify it holds backups */ 570 /* Get each reserved primary GDT block and verify it holds backups */
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 52dd0679a4e2..cb96f127c366 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -671,6 +671,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
671 unsigned long def_mount_opts; 671 unsigned long def_mount_opts;
672 struct super_block *sb = vfs->mnt_sb; 672 struct super_block *sb = vfs->mnt_sb;
673 struct ext4_sb_info *sbi = EXT4_SB(sb); 673 struct ext4_sb_info *sbi = EXT4_SB(sb);
674 journal_t *journal = sbi->s_journal;
674 struct ext4_super_block *es = sbi->s_es; 675 struct ext4_super_block *es = sbi->s_es;
675 676
676 def_mount_opts = le32_to_cpu(es->s_default_mount_opts); 677 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
@@ -729,8 +730,15 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
729 seq_printf(seq, ",commit=%u", 730 seq_printf(seq, ",commit=%u",
730 (unsigned) (sbi->s_commit_interval / HZ)); 731 (unsigned) (sbi->s_commit_interval / HZ));
731 } 732 }
732 if (test_opt(sb, BARRIER)) 733 /*
733 seq_puts(seq, ",barrier=1"); 734 * We're changing the default of barrier mount option, so
735 * let's always display its mount state so it's clear what its
736 * status is.
737 */
738 seq_puts(seq, ",barrier=");
739 seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
740 if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
741 seq_puts(seq, ",journal_async_commit");
734 if (test_opt(sb, NOBH)) 742 if (test_opt(sb, NOBH))
735 seq_puts(seq, ",nobh"); 743 seq_puts(seq, ",nobh");
736 if (!test_opt(sb, EXTENTS)) 744 if (!test_opt(sb, EXTENTS))
@@ -979,7 +987,7 @@ static int parse_options (char *options, struct super_block *sb,
979 int data_opt = 0; 987 int data_opt = 0;
980 int option; 988 int option;
981#ifdef CONFIG_QUOTA 989#ifdef CONFIG_QUOTA
982 int qtype; 990 int qtype, qfmt;
983 char *qname; 991 char *qname;
984#endif 992#endif
985 993
@@ -1162,9 +1170,11 @@ static int parse_options (char *options, struct super_block *sb,
1162 case Opt_grpjquota: 1170 case Opt_grpjquota:
1163 qtype = GRPQUOTA; 1171 qtype = GRPQUOTA;
1164set_qf_name: 1172set_qf_name:
1165 if (sb_any_quota_enabled(sb)) { 1173 if ((sb_any_quota_enabled(sb) ||
1174 sb_any_quota_suspended(sb)) &&
1175 !sbi->s_qf_names[qtype]) {
1166 printk(KERN_ERR 1176 printk(KERN_ERR
1167 "EXT4-fs: Cannot change journalled " 1177 "EXT4-fs: Cannot change journaled "
1168 "quota options when quota turned on.\n"); 1178 "quota options when quota turned on.\n");
1169 return 0; 1179 return 0;
1170 } 1180 }
@@ -1200,9 +1210,11 @@ set_qf_name:
1200 case Opt_offgrpjquota: 1210 case Opt_offgrpjquota:
1201 qtype = GRPQUOTA; 1211 qtype = GRPQUOTA;
1202clear_qf_name: 1212clear_qf_name:
1203 if (sb_any_quota_enabled(sb)) { 1213 if ((sb_any_quota_enabled(sb) ||
1214 sb_any_quota_suspended(sb)) &&
1215 sbi->s_qf_names[qtype]) {
1204 printk(KERN_ERR "EXT4-fs: Cannot change " 1216 printk(KERN_ERR "EXT4-fs: Cannot change "
1205 "journalled quota options when " 1217 "journaled quota options when "
1206 "quota turned on.\n"); 1218 "quota turned on.\n");
1207 return 0; 1219 return 0;
1208 } 1220 }
@@ -1213,10 +1225,20 @@ clear_qf_name:
1213 sbi->s_qf_names[qtype] = NULL; 1225 sbi->s_qf_names[qtype] = NULL;
1214 break; 1226 break;
1215 case Opt_jqfmt_vfsold: 1227 case Opt_jqfmt_vfsold:
1216 sbi->s_jquota_fmt = QFMT_VFS_OLD; 1228 qfmt = QFMT_VFS_OLD;
1217 break; 1229 goto set_qf_format;
1218 case Opt_jqfmt_vfsv0: 1230 case Opt_jqfmt_vfsv0:
1219 sbi->s_jquota_fmt = QFMT_VFS_V0; 1231 qfmt = QFMT_VFS_V0;
1232set_qf_format:
1233 if ((sb_any_quota_enabled(sb) ||
1234 sb_any_quota_suspended(sb)) &&
1235 sbi->s_jquota_fmt != qfmt) {
1236 printk(KERN_ERR "EXT4-fs: Cannot change "
1237 "journaled quota options when "
1238 "quota turned on.\n");
1239 return 0;
1240 }
1241 sbi->s_jquota_fmt = qfmt;
1220 break; 1242 break;
1221 case Opt_quota: 1243 case Opt_quota:
1222 case Opt_usrquota: 1244 case Opt_usrquota:
@@ -1241,6 +1263,9 @@ clear_qf_name:
1241 case Opt_quota: 1263 case Opt_quota:
1242 case Opt_usrquota: 1264 case Opt_usrquota:
1243 case Opt_grpquota: 1265 case Opt_grpquota:
1266 printk(KERN_ERR
1267 "EXT4-fs: quota options not supported.\n");
1268 break;
1244 case Opt_usrjquota: 1269 case Opt_usrjquota:
1245 case Opt_grpjquota: 1270 case Opt_grpjquota:
1246 case Opt_offusrjquota: 1271 case Opt_offusrjquota:
@@ -1248,7 +1273,7 @@ clear_qf_name:
1248 case Opt_jqfmt_vfsold: 1273 case Opt_jqfmt_vfsold:
1249 case Opt_jqfmt_vfsv0: 1274 case Opt_jqfmt_vfsv0:
1250 printk(KERN_ERR 1275 printk(KERN_ERR
1251 "EXT4-fs: journalled quota options not " 1276 "EXT4-fs: journaled quota options not "
1252 "supported.\n"); 1277 "supported.\n");
1253 break; 1278 break;
1254 case Opt_noquota: 1279 case Opt_noquota:
@@ -1333,14 +1358,14 @@ clear_qf_name:
1333 } 1358 }
1334 1359
1335 if (!sbi->s_jquota_fmt) { 1360 if (!sbi->s_jquota_fmt) {
1336 printk(KERN_ERR "EXT4-fs: journalled quota format " 1361 printk(KERN_ERR "EXT4-fs: journaled quota format "
1337 "not specified.\n"); 1362 "not specified.\n");
1338 return 0; 1363 return 0;
1339 } 1364 }
1340 } else { 1365 } else {
1341 if (sbi->s_jquota_fmt) { 1366 if (sbi->s_jquota_fmt) {
1342 printk(KERN_ERR "EXT4-fs: journalled quota format " 1367 printk(KERN_ERR "EXT4-fs: journaled quota format "
1343 "specified with no journalling " 1368 "specified with no journaling "
1344 "enabled.\n"); 1369 "enabled.\n");
1345 return 0; 1370 return 0;
1346 } 1371 }
@@ -1581,7 +1606,7 @@ static void ext4_orphan_cleanup (struct super_block * sb,
1581 int ret = ext4_quota_on_mount(sb, i); 1606 int ret = ext4_quota_on_mount(sb, i);
1582 if (ret < 0) 1607 if (ret < 0)
1583 printk(KERN_ERR 1608 printk(KERN_ERR
1584 "EXT4-fs: Cannot turn on journalled " 1609 "EXT4-fs: Cannot turn on journaled "
1585 "quota: error %d\n", ret); 1610 "quota: error %d\n", ret);
1586 } 1611 }
1587 } 1612 }
@@ -1890,6 +1915,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1890 sbi->s_resgid = le16_to_cpu(es->s_def_resgid); 1915 sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
1891 1916
1892 set_opt(sbi->s_mount_opt, RESERVATION); 1917 set_opt(sbi->s_mount_opt, RESERVATION);
1918 set_opt(sbi->s_mount_opt, BARRIER);
1893 1919
1894 /* 1920 /*
1895 * turn on extents feature by default in ext4 filesystem 1921 * turn on extents feature by default in ext4 filesystem
@@ -2172,6 +2198,29 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
2172 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { 2198 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) {
2173 if (ext4_load_journal(sb, es, journal_devnum)) 2199 if (ext4_load_journal(sb, es, journal_devnum))
2174 goto failed_mount3; 2200 goto failed_mount3;
2201 if (!(sb->s_flags & MS_RDONLY) &&
2202 EXT4_SB(sb)->s_journal->j_failed_commit) {
2203 printk(KERN_CRIT "EXT4-fs error (device %s): "
2204 "ext4_fill_super: Journal transaction "
2205 "%u is corrupt\n", sb->s_id,
2206 EXT4_SB(sb)->s_journal->j_failed_commit);
2207 if (test_opt (sb, ERRORS_RO)) {
2208 printk (KERN_CRIT
2209 "Mounting filesystem read-only\n");
2210 sb->s_flags |= MS_RDONLY;
2211 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
2212 es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
2213 }
2214 if (test_opt(sb, ERRORS_PANIC)) {
2215 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
2216 es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
2217 ext4_commit_super(sb, es, 1);
2218 printk(KERN_CRIT
2219 "EXT4-fs (device %s): mount failed\n",
2220 sb->s_id);
2221 goto failed_mount4;
2222 }
2223 }
2175 } else if (journal_inum) { 2224 } else if (journal_inum) {
2176 if (ext4_create_journal(sb, es, journal_inum)) 2225 if (ext4_create_journal(sb, es, journal_inum))
2177 goto failed_mount3; 2226 goto failed_mount3;
@@ -3106,7 +3155,7 @@ static int ext4_release_dquot(struct dquot *dquot)
3106 3155
3107static int ext4_mark_dquot_dirty(struct dquot *dquot) 3156static int ext4_mark_dquot_dirty(struct dquot *dquot)
3108{ 3157{
3109 /* Are we journalling quotas? */ 3158 /* Are we journaling quotas? */
3110 if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || 3159 if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
3111 EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { 3160 EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
3112 dquot_mark_dquot_dirty(dquot); 3161 dquot_mark_dquot_dirty(dquot);
@@ -3153,23 +3202,42 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3153 3202
3154 if (!test_opt(sb, QUOTA)) 3203 if (!test_opt(sb, QUOTA))
3155 return -EINVAL; 3204 return -EINVAL;
3156 /* Not journalling quota? */ 3205 /* When remounting, no checks are needed and in fact, path is NULL */
3157 if ((!EXT4_SB(sb)->s_qf_names[USRQUOTA] && 3206 if (remount)
3158 !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) || remount)
3159 return vfs_quota_on(sb, type, format_id, path, remount); 3207 return vfs_quota_on(sb, type, format_id, path, remount);
3208
3160 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 3209 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
3161 if (err) 3210 if (err)
3162 return err; 3211 return err;
3212
3163 /* Quotafile not on the same filesystem? */ 3213 /* Quotafile not on the same filesystem? */
3164 if (nd.path.mnt->mnt_sb != sb) { 3214 if (nd.path.mnt->mnt_sb != sb) {
3165 path_put(&nd.path); 3215 path_put(&nd.path);
3166 return -EXDEV; 3216 return -EXDEV;
3167 } 3217 }
3168 /* Quotafile not of fs root? */ 3218 /* Journaling quota? */
3169 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 3219 if (EXT4_SB(sb)->s_qf_names[type]) {
3170 printk(KERN_WARNING 3220 /* Quotafile not of fs root? */
3171 "EXT4-fs: Quota file not on filesystem root. " 3221 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
3172 "Journalled quota will not work.\n"); 3222 printk(KERN_WARNING
3223 "EXT4-fs: Quota file not on filesystem root. "
3224 "Journaled quota will not work.\n");
3225 }
3226
3227 /*
3228 * When we journal data on quota file, we have to flush journal to see
3229 * all updates to the file when we bypass pagecache...
3230 */
3231 if (ext4_should_journal_data(nd.path.dentry->d_inode)) {
3232 /*
3233 * We don't need to lock updates but journal_flush() could
3234 * otherwise be livelocked...
3235 */
3236 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
3237 jbd2_journal_flush(EXT4_SB(sb)->s_journal);
3238 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
3239 }
3240
3173 path_put(&nd.path); 3241 path_put(&nd.path);
3174 return vfs_quota_on(sb, type, format_id, path, remount); 3242 return vfs_quota_on(sb, type, format_id, path, remount);
3175} 3243}
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 3fbc2c6c3d0e..ff08633f398e 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1009,6 +1009,11 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
1009 i.value = NULL; 1009 i.value = NULL;
1010 error = ext4_xattr_block_set(handle, inode, &i, &bs); 1010 error = ext4_xattr_block_set(handle, inode, &i, &bs);
1011 } else if (error == -ENOSPC) { 1011 } else if (error == -ENOSPC) {
1012 if (EXT4_I(inode)->i_file_acl && !bs.s.base) {
1013 error = ext4_xattr_block_find(inode, &i, &bs);
1014 if (error)
1015 goto cleanup;
1016 }
1012 error = ext4_xattr_block_set(handle, inode, &i, &bs); 1017 error = ext4_xattr_block_set(handle, inode, &i, &bs);
1013 if (error) 1018 if (error)
1014 goto cleanup; 1019 goto cleanup;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 27cc1164ec36..771326b8047e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -257,26 +257,34 @@ int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
257} 257}
258EXPORT_SYMBOL_GPL(fat_getattr); 258EXPORT_SYMBOL_GPL(fat_getattr);
259 259
260static int fat_check_mode(const struct msdos_sb_info *sbi, struct inode *inode, 260static int fat_sanitize_mode(const struct msdos_sb_info *sbi,
261 mode_t mode) 261 struct inode *inode, umode_t *mode_ptr)
262{ 262{
263 mode_t mask, req = mode & ~S_IFMT; 263 mode_t mask, perm;
264 264
265 if (S_ISREG(mode)) 265 /*
266 * Note, the basic check is already done by a caller of
267 * (attr->ia_mode & ~MSDOS_VALID_MODE)
268 */
269
270 if (S_ISREG(inode->i_mode))
266 mask = sbi->options.fs_fmask; 271 mask = sbi->options.fs_fmask;
267 else 272 else
268 mask = sbi->options.fs_dmask; 273 mask = sbi->options.fs_dmask;
269 274
275 perm = *mode_ptr & ~(S_IFMT | mask);
276
270 /* 277 /*
271 * Of the r and x bits, all (subject to umask) must be present. Of the 278 * Of the r and x bits, all (subject to umask) must be present. Of the
272 * w bits, either all (subject to umask) or none must be present. 279 * w bits, either all (subject to umask) or none must be present.
273 */ 280 */
274 req &= ~mask; 281 if ((perm & (S_IRUGO | S_IXUGO)) != (inode->i_mode & (S_IRUGO|S_IXUGO)))
275 if ((req & (S_IRUGO | S_IXUGO)) != (inode->i_mode & (S_IRUGO|S_IXUGO)))
276 return -EPERM; 282 return -EPERM;
277 if ((req & S_IWUGO) && ((req & S_IWUGO) != (S_IWUGO & ~mask))) 283 if ((perm & S_IWUGO) && ((perm & S_IWUGO) != (S_IWUGO & ~mask)))
278 return -EPERM; 284 return -EPERM;
279 285
286 *mode_ptr &= S_IFMT | perm;
287
280 return 0; 288 return 0;
281} 289}
282 290
@@ -299,7 +307,7 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
299{ 307{
300 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); 308 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
301 struct inode *inode = dentry->d_inode; 309 struct inode *inode = dentry->d_inode;
302 int mask, error = 0; 310 int error = 0;
303 unsigned int ia_valid; 311 unsigned int ia_valid;
304 312
305 lock_kernel(); 313 lock_kernel();
@@ -332,12 +340,13 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
332 error = 0; 340 error = 0;
333 goto out; 341 goto out;
334 } 342 }
343
335 if (((attr->ia_valid & ATTR_UID) && 344 if (((attr->ia_valid & ATTR_UID) &&
336 (attr->ia_uid != sbi->options.fs_uid)) || 345 (attr->ia_uid != sbi->options.fs_uid)) ||
337 ((attr->ia_valid & ATTR_GID) && 346 ((attr->ia_valid & ATTR_GID) &&
338 (attr->ia_gid != sbi->options.fs_gid)) || 347 (attr->ia_gid != sbi->options.fs_gid)) ||
339 ((attr->ia_valid & ATTR_MODE) && 348 ((attr->ia_valid & ATTR_MODE) &&
340 fat_check_mode(sbi, inode, attr->ia_mode) < 0)) 349 (attr->ia_mode & ~MSDOS_VALID_MODE)))
341 error = -EPERM; 350 error = -EPERM;
342 351
343 if (error) { 352 if (error) {
@@ -346,15 +355,16 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
346 goto out; 355 goto out;
347 } 356 }
348 357
349 error = inode_setattr(inode, attr); 358 /*
350 if (error) 359 * We don't return -EPERM here. Yes, strange, but this is too
351 goto out; 360 * old behavior.
361 */
362 if (attr->ia_valid & ATTR_MODE) {
363 if (fat_sanitize_mode(sbi, inode, &attr->ia_mode) < 0)
364 attr->ia_valid &= ~ATTR_MODE;
365 }
352 366
353 if (S_ISDIR(inode->i_mode)) 367 error = inode_setattr(inode, attr);
354 mask = sbi->options.fs_dmask;
355 else
356 mask = sbi->options.fs_fmask;
357 inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask);
358out: 368out:
359 unlock_kernel(); 369 unlock_kernel();
360 return error; 370 return error;
diff --git a/fs/file.c b/fs/file.c
index 4c6f0ea12c41..7b3887e054d0 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -26,6 +26,8 @@ struct fdtable_defer {
26}; 26};
27 27
28int sysctl_nr_open __read_mostly = 1024*1024; 28int sysctl_nr_open __read_mostly = 1024*1024;
29int sysctl_nr_open_min = BITS_PER_LONG;
30int sysctl_nr_open_max = 1024 * 1024; /* raised later */
29 31
30/* 32/*
31 * We use this list to defer free fdtables that have vmalloced 33 * We use this list to defer free fdtables that have vmalloced
@@ -119,8 +121,6 @@ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
119 unsigned int cpy, set; 121 unsigned int cpy, set;
120 122
121 BUG_ON(nfdt->max_fds < ofdt->max_fds); 123 BUG_ON(nfdt->max_fds < ofdt->max_fds);
122 if (ofdt->max_fds == 0)
123 return;
124 124
125 cpy = ofdt->max_fds * sizeof(struct file *); 125 cpy = ofdt->max_fds * sizeof(struct file *);
126 set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *); 126 set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *);
@@ -261,6 +261,139 @@ int expand_files(struct files_struct *files, int nr)
261 return expand_fdtable(files, nr); 261 return expand_fdtable(files, nr);
262} 262}
263 263
264static int count_open_files(struct fdtable *fdt)
265{
266 int size = fdt->max_fds;
267 int i;
268
269 /* Find the last open fd */
270 for (i = size/(8*sizeof(long)); i > 0; ) {
271 if (fdt->open_fds->fds_bits[--i])
272 break;
273 }
274 i = (i+1) * 8 * sizeof(long);
275 return i;
276}
277
278/*
279 * Allocate a new files structure and copy contents from the
280 * passed in files structure.
281 * errorp will be valid only when the returned files_struct is NULL.
282 */
283struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
284{
285 struct files_struct *newf;
286 struct file **old_fds, **new_fds;
287 int open_files, size, i;
288 struct fdtable *old_fdt, *new_fdt;
289
290 *errorp = -ENOMEM;
291 newf = kmem_cache_alloc(files_cachep, GFP_KERNEL);
292 if (!newf)
293 goto out;
294
295 atomic_set(&newf->count, 1);
296
297 spin_lock_init(&newf->file_lock);
298 newf->next_fd = 0;
299 new_fdt = &newf->fdtab;
300 new_fdt->max_fds = NR_OPEN_DEFAULT;
301 new_fdt->close_on_exec = (fd_set *)&newf->close_on_exec_init;
302 new_fdt->open_fds = (fd_set *)&newf->open_fds_init;
303 new_fdt->fd = &newf->fd_array[0];
304 INIT_RCU_HEAD(&new_fdt->rcu);
305 new_fdt->next = NULL;
306
307 spin_lock(&oldf->file_lock);
308 old_fdt = files_fdtable(oldf);
309 open_files = count_open_files(old_fdt);
310
311 /*
312 * Check whether we need to allocate a larger fd array and fd set.
313 */
314 while (unlikely(open_files > new_fdt->max_fds)) {
315 spin_unlock(&oldf->file_lock);
316
317 if (new_fdt != &newf->fdtab) {
318 free_fdarr(new_fdt);
319 free_fdset(new_fdt);
320 kfree(new_fdt);
321 }
322
323 new_fdt = alloc_fdtable(open_files - 1);
324 if (!new_fdt) {
325 *errorp = -ENOMEM;
326 goto out_release;
327 }
328
329 /* beyond sysctl_nr_open; nothing to do */
330 if (unlikely(new_fdt->max_fds < open_files)) {
331 free_fdarr(new_fdt);
332 free_fdset(new_fdt);
333 kfree(new_fdt);
334 *errorp = -EMFILE;
335 goto out_release;
336 }
337
338 /*
339 * Reacquire the oldf lock and a pointer to its fd table
340 * who knows it may have a new bigger fd table. We need
341 * the latest pointer.
342 */
343 spin_lock(&oldf->file_lock);
344 old_fdt = files_fdtable(oldf);
345 open_files = count_open_files(old_fdt);
346 }
347
348 old_fds = old_fdt->fd;
349 new_fds = new_fdt->fd;
350
351 memcpy(new_fdt->open_fds->fds_bits,
352 old_fdt->open_fds->fds_bits, open_files/8);
353 memcpy(new_fdt->close_on_exec->fds_bits,
354 old_fdt->close_on_exec->fds_bits, open_files/8);
355
356 for (i = open_files; i != 0; i--) {
357 struct file *f = *old_fds++;
358 if (f) {
359 get_file(f);
360 } else {
361 /*
362 * The fd may be claimed in the fd bitmap but not yet
363 * instantiated in the files array if a sibling thread
364 * is partway through open(). So make sure that this
365 * fd is available to the new process.
366 */
367 FD_CLR(open_files - i, new_fdt->open_fds);
368 }
369 rcu_assign_pointer(*new_fds++, f);
370 }
371 spin_unlock(&oldf->file_lock);
372
373 /* compute the remainder to be cleared */
374 size = (new_fdt->max_fds - open_files) * sizeof(struct file *);
375
376 /* This is long word aligned thus could use a optimized version */
377 memset(new_fds, 0, size);
378
379 if (new_fdt->max_fds > open_files) {
380 int left = (new_fdt->max_fds-open_files)/8;
381 int start = open_files / (8 * sizeof(unsigned long));
382
383 memset(&new_fdt->open_fds->fds_bits[start], 0, left);
384 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
385 }
386
387 rcu_assign_pointer(newf->fdt, new_fdt);
388
389 return newf;
390
391out_release:
392 kmem_cache_free(files_cachep, newf);
393out:
394 return NULL;
395}
396
264static void __devinit fdtable_defer_list_init(int cpu) 397static void __devinit fdtable_defer_list_init(int cpu)
265{ 398{
266 struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu); 399 struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu);
@@ -274,4 +407,19 @@ void __init files_defer_init(void)
274 int i; 407 int i;
275 for_each_possible_cpu(i) 408 for_each_possible_cpu(i)
276 fdtable_defer_list_init(i); 409 fdtable_defer_list_init(i);
410 sysctl_nr_open_max = min((size_t)INT_MAX, ~(size_t)0/sizeof(void *)) &
411 -BITS_PER_LONG;
277} 412}
413
414struct files_struct init_files = {
415 .count = ATOMIC_INIT(1),
416 .fdt = &init_files.fdtab,
417 .fdtab = {
418 .max_fds = NR_OPEN_DEFAULT,
419 .fd = &init_files.fd_array[0],
420 .close_on_exec = (fd_set *)&init_files.close_on_exec_init,
421 .open_fds = (fd_set *)&init_files.open_fds_init,
422 .rcu = RCU_HEAD_INIT,
423 },
424 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
425};
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f28cf8b46f80..8092f0d9fd1f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -804,6 +804,8 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
804 if (offset == PAGE_CACHE_SIZE) 804 if (offset == PAGE_CACHE_SIZE)
805 offset = 0; 805 offset = 0;
806 806
807 if (!fc->big_writes)
808 break;
807 } while (iov_iter_count(ii) && count < fc->max_write && 809 } while (iov_iter_count(ii) && count < fc->max_write &&
808 req->num_pages < FUSE_MAX_PAGES_PER_REQ && offset == 0); 810 req->num_pages < FUSE_MAX_PAGES_PER_REQ && offset == 0);
809 811
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index dadffa21a206..bae948657c4f 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -404,6 +404,9 @@ struct fuse_conn {
404 /** Is bmap not implemented by fs? */ 404 /** Is bmap not implemented by fs? */
405 unsigned no_bmap : 1; 405 unsigned no_bmap : 1;
406 406
407 /** Do multi-page cached writes */
408 unsigned big_writes : 1;
409
407 /** The number of requests waiting for completion */ 410 /** The number of requests waiting for completion */
408 atomic_t num_waiting; 411 atomic_t num_waiting;
409 412
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 79b615873838..43e99513334a 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -488,7 +488,12 @@ static struct fuse_conn *new_conn(struct super_block *sb)
488 err = bdi_init(&fc->bdi); 488 err = bdi_init(&fc->bdi);
489 if (err) 489 if (err)
490 goto error_kfree; 490 goto error_kfree;
491 err = bdi_register_dev(&fc->bdi, fc->dev); 491 if (sb->s_bdev) {
492 err = bdi_register(&fc->bdi, NULL, "%u:%u-fuseblk",
493 MAJOR(fc->dev), MINOR(fc->dev));
494 } else {
495 err = bdi_register_dev(&fc->bdi, fc->dev);
496 }
492 if (err) 497 if (err)
493 goto error_bdi_destroy; 498 goto error_bdi_destroy;
494 /* 499 /*
@@ -576,6 +581,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
576 fc->no_lock = 1; 581 fc->no_lock = 1;
577 if (arg->flags & FUSE_ATOMIC_O_TRUNC) 582 if (arg->flags & FUSE_ATOMIC_O_TRUNC)
578 fc->atomic_o_trunc = 1; 583 fc->atomic_o_trunc = 1;
584 if (arg->flags & FUSE_BIG_WRITES)
585 fc->big_writes = 1;
579 } else { 586 } else {
580 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 587 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
581 fc->no_lock = 1; 588 fc->no_lock = 1;
@@ -599,7 +606,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
599 arg->major = FUSE_KERNEL_VERSION; 606 arg->major = FUSE_KERNEL_VERSION;
600 arg->minor = FUSE_KERNEL_MINOR_VERSION; 607 arg->minor = FUSE_KERNEL_MINOR_VERSION;
601 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 608 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
602 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC; 609 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC |
610 FUSE_BIG_WRITES;
603 req->in.h.opcode = FUSE_INIT; 611 req->in.h.opcode = FUSE_INIT;
604 req->in.numargs = 1; 612 req->in.numargs = 1;
605 req->in.args[0].size = sizeof(*arg); 613 req->in.args[0].size = sizeof(*arg);
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index d31badadef8f..07d84d16cda4 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -249,7 +249,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
249 struct gfs2_inode *ip = gl->gl_object; 249 struct gfs2_inode *ip = gl->gl_object;
250 int error = 0; 250 int error = 0;
251 251
252 if (!ip) 252 if (!ip || (gh->gh_flags & GL_SKIP))
253 return 0; 253 return 0;
254 254
255 if (test_bit(GIF_INVALID, &ip->i_flags)) { 255 if (test_bit(GIF_INVALID, &ip->i_flags)) {
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 9c2c0b90b22a..eabe5eac41da 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -236,6 +236,7 @@ enum {
236 GIF_INVALID = 0, 236 GIF_INVALID = 0,
237 GIF_QD_LOCKED = 1, 237 GIF_QD_LOCKED = 1,
238 GIF_SW_PAGED = 3, 238 GIF_SW_PAGED = 3,
239 GIF_USER = 4, /* user inode, not metadata addr space */
239}; 240};
240 241
241struct gfs2_dinode_host { 242struct gfs2_dinode_host {
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 3a9ef526c308..09453d057e41 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -47,8 +47,7 @@ static int iget_test(struct inode *inode, void *opaque)
47 struct gfs2_inode *ip = GFS2_I(inode); 47 struct gfs2_inode *ip = GFS2_I(inode);
48 u64 *no_addr = opaque; 48 u64 *no_addr = opaque;
49 49
50 if (ip->i_no_addr == *no_addr && 50 if (ip->i_no_addr == *no_addr && test_bit(GIF_USER, &ip->i_flags))
51 inode->i_private != NULL)
52 return 1; 51 return 1;
53 52
54 return 0; 53 return 0;
@@ -61,6 +60,7 @@ static int iget_set(struct inode *inode, void *opaque)
61 60
62 inode->i_ino = (unsigned long)*no_addr; 61 inode->i_ino = (unsigned long)*no_addr;
63 ip->i_no_addr = *no_addr; 62 ip->i_no_addr = *no_addr;
63 set_bit(GIF_USER, &ip->i_flags);
64 return 0; 64 return 0;
65} 65}
66 66
@@ -86,7 +86,7 @@ static int iget_skip_test(struct inode *inode, void *opaque)
86 struct gfs2_inode *ip = GFS2_I(inode); 86 struct gfs2_inode *ip = GFS2_I(inode);
87 struct gfs2_skip_data *data = opaque; 87 struct gfs2_skip_data *data = opaque;
88 88
89 if (ip->i_no_addr == data->no_addr && inode->i_private != NULL){ 89 if (ip->i_no_addr == data->no_addr && test_bit(GIF_USER, &ip->i_flags)){
90 if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)){ 90 if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)){
91 data->skipped = 1; 91 data->skipped = 1;
92 return 0; 92 return 0;
@@ -105,6 +105,7 @@ static int iget_skip_set(struct inode *inode, void *opaque)
105 return 1; 105 return 1;
106 inode->i_ino = (unsigned long)(data->no_addr); 106 inode->i_ino = (unsigned long)(data->no_addr);
107 ip->i_no_addr = data->no_addr; 107 ip->i_no_addr = data->no_addr;
108 set_bit(GIF_USER, &ip->i_flags);
108 return 0; 109 return 0;
109} 110}
110 111
@@ -166,7 +167,7 @@ void gfs2_set_iop(struct inode *inode)
166 * Returns: A VFS inode, or an error 167 * Returns: A VFS inode, or an error
167 */ 168 */
168 169
169struct inode *gfs2_inode_lookup(struct super_block *sb, 170struct inode *gfs2_inode_lookup(struct super_block *sb,
170 unsigned int type, 171 unsigned int type,
171 u64 no_addr, 172 u64 no_addr,
172 u64 no_formal_ino, int skip_freeing) 173 u64 no_formal_ino, int skip_freeing)
@@ -187,7 +188,6 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,
187 188
188 if (inode->i_state & I_NEW) { 189 if (inode->i_state & I_NEW) {
189 struct gfs2_sbd *sdp = GFS2_SB(inode); 190 struct gfs2_sbd *sdp = GFS2_SB(inode);
190 inode->i_private = ip;
191 ip->i_no_formal_ino = no_formal_ino; 191 ip->i_no_formal_ino = no_formal_ino;
192 192
193 error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); 193 error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 85aea27b4a86..78d75f892f82 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 * 4 *
5 * This copyrighted material is made available to anyone wishing to use, 5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions 6 * modify, copy, or redistribute it subject to the terms and conditions
@@ -69,13 +69,15 @@ static const struct address_space_operations aspace_aops = {
69struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) 69struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp)
70{ 70{
71 struct inode *aspace; 71 struct inode *aspace;
72 struct gfs2_inode *ip;
72 73
73 aspace = new_inode(sdp->sd_vfs); 74 aspace = new_inode(sdp->sd_vfs);
74 if (aspace) { 75 if (aspace) {
75 mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); 76 mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS);
76 aspace->i_mapping->a_ops = &aspace_aops; 77 aspace->i_mapping->a_ops = &aspace_aops;
77 aspace->i_size = ~0ULL; 78 aspace->i_size = ~0ULL;
78 aspace->i_private = NULL; 79 ip = GFS2_I(aspace);
80 clear_bit(GIF_USER, &ip->i_flags);
79 insert_inode_hash(aspace); 81 insert_inode_hash(aspace);
80 } 82 }
81 return aspace; 83 return aspace;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ef9c6c4f80f6..b2028c82e8d1 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -142,8 +142,8 @@ static int init_names(struct gfs2_sbd *sdp, int silent)
142 if (!table[0]) 142 if (!table[0])
143 table = sdp->sd_vfs->s_id; 143 table = sdp->sd_vfs->s_id;
144 144
145 snprintf(sdp->sd_proto_name, GFS2_FSNAME_LEN, "%s", proto); 145 strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
146 snprintf(sdp->sd_table_name, GFS2_FSNAME_LEN, "%s", table); 146 strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
147 147
148 table = sdp->sd_table_name; 148 table = sdp->sd_table_name;
149 while ((table = strchr(table, '/'))) 149 while ((table = strchr(table, '/')))
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index 2278c68b7e35..0b7cc920eb89 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 * 4 *
5 * This copyrighted material is made available to anyone wishing to use, 5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions 6 * modify, copy, or redistribute it subject to the terms and conditions
@@ -52,7 +52,7 @@ static int gfs2_write_inode(struct inode *inode, int sync)
52 struct gfs2_inode *ip = GFS2_I(inode); 52 struct gfs2_inode *ip = GFS2_I(inode);
53 53
54 /* Check this is a "normal" inode */ 54 /* Check this is a "normal" inode */
55 if (inode->i_private) { 55 if (test_bit(GIF_USER, &ip->i_flags)) {
56 if (current->flags & PF_MEMALLOC) 56 if (current->flags & PF_MEMALLOC)
57 return 0; 57 return 0;
58 if (sync) 58 if (sync)
@@ -297,8 +297,9 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
297 */ 297 */
298static void gfs2_drop_inode(struct inode *inode) 298static void gfs2_drop_inode(struct inode *inode)
299{ 299{
300 if (inode->i_private && inode->i_nlink) { 300 struct gfs2_inode *ip = GFS2_I(inode);
301 struct gfs2_inode *ip = GFS2_I(inode); 301
302 if (test_bit(GIF_USER, &ip->i_flags) && inode->i_nlink) {
302 struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; 303 struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl;
303 if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) 304 if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags))
304 clear_nlink(inode); 305 clear_nlink(inode);
@@ -314,12 +315,13 @@ static void gfs2_drop_inode(struct inode *inode)
314 315
315static void gfs2_clear_inode(struct inode *inode) 316static void gfs2_clear_inode(struct inode *inode)
316{ 317{
318 struct gfs2_inode *ip = GFS2_I(inode);
319
317 /* This tells us its a "real" inode and not one which only 320 /* This tells us its a "real" inode and not one which only
318 * serves to contain an address space (see rgrp.c, meta_io.c) 321 * serves to contain an address space (see rgrp.c, meta_io.c)
319 * which therefore doesn't have its own glocks. 322 * which therefore doesn't have its own glocks.
320 */ 323 */
321 if (inode->i_private) { 324 if (test_bit(GIF_USER, &ip->i_flags)) {
322 struct gfs2_inode *ip = GFS2_I(inode);
323 ip->i_gl->gl_object = NULL; 325 ip->i_gl->gl_object = NULL;
324 gfs2_glock_schedule_for_reclaim(ip->i_gl); 326 gfs2_glock_schedule_for_reclaim(ip->i_gl);
325 gfs2_glock_put(ip->i_gl); 327 gfs2_glock_put(ip->i_gl);
@@ -419,7 +421,7 @@ static void gfs2_delete_inode(struct inode *inode)
419 struct gfs2_holder gh; 421 struct gfs2_holder gh;
420 int error; 422 int error;
421 423
422 if (!inode->i_private) 424 if (!test_bit(GIF_USER, &ip->i_flags))
423 goto out; 425 goto out;
424 426
425 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 427 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 7e8f0b1d6c6e..6387523a3153 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1495,7 +1495,7 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n)
1495 1495
1496 al->al_alloced += *n; 1496 al->al_alloced += *n;
1497 1497
1498 gfs2_statfs_change(sdp, 0, -*n, 0); 1498 gfs2_statfs_change(sdp, 0, -(s64)*n, 0);
1499 gfs2_quota_change(ip, *n, ip->i_inode.i_uid, ip->i_inode.i_gid); 1499 gfs2_quota_change(ip, *n, ip->i_inode.i_uid, ip->i_inode.i_gid);
1500 1500
1501 spin_lock(&sdp->sd_rindex_spin); 1501 spin_lock(&sdp->sd_rindex_spin);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index d53b2af91c25..67e1c8b467c4 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -65,6 +65,8 @@ static int hfsplus_releasepage(struct page *page, gfp_t mask)
65 BUG(); 65 BUG();
66 return 0; 66 return 0;
67 } 67 }
68 if (!tree)
69 return 0;
68 if (tree->node_size >= PAGE_CACHE_SIZE) { 70 if (tree->node_size >= PAGE_CACHE_SIZE) {
69 nidx = page->index >> (tree->node_size_shift - PAGE_CACHE_SHIFT); 71 nidx = page->index >> (tree->node_size_shift - PAGE_CACHE_SHIFT);
70 spin_lock(&tree->hash_lock); 72 spin_lock(&tree->hash_lock);
diff --git a/fs/hppfs/Makefile b/fs/hppfs/Makefile
index 6890433f7595..3a982bd975d2 100644
--- a/fs/hppfs/Makefile
+++ b/fs/hppfs/Makefile
@@ -1,9 +1,6 @@
1# 1#
2# Copyright (C) 2002, 2003 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6hppfs-objs := hppfs_kern.o
7
8obj-y =
9obj-$(CONFIG_HPPFS) += hppfs.o 6obj-$(CONFIG_HPPFS) += hppfs.o
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs.c
index 8601d8ef3b55..65077aa90f0a 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs.c
@@ -33,7 +33,7 @@ struct hppfs_private {
33}; 33};
34 34
35struct hppfs_inode_info { 35struct hppfs_inode_info {
36 struct dentry *proc_dentry; 36 struct dentry *proc_dentry;
37 struct inode vfs_inode; 37 struct inode vfs_inode;
38}; 38};
39 39
@@ -52,7 +52,7 @@ static int is_pid(struct dentry *dentry)
52 int i; 52 int i;
53 53
54 sb = dentry->d_sb; 54 sb = dentry->d_sb;
55 if ((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root)) 55 if (dentry->d_parent != sb->s_root)
56 return 0; 56 return 0;
57 57
58 for (i = 0; i < dentry->d_name.len; i++) { 58 for (i = 0; i < dentry->d_name.len; i++) {
@@ -136,7 +136,7 @@ static int file_removed(struct dentry *dentry, const char *file)
136} 136}
137 137
138static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, 138static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
139 struct nameidata *nd) 139 struct nameidata *nd)
140{ 140{
141 struct dentry *proc_dentry, *new, *parent; 141 struct dentry *proc_dentry, *new, *parent;
142 struct inode *inode; 142 struct inode *inode;
@@ -254,6 +254,8 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
254 int err; 254 int err;
255 255
256 if (hppfs->contents != NULL) { 256 if (hppfs->contents != NULL) {
257 int rem;
258
257 if (*ppos >= hppfs->len) 259 if (*ppos >= hppfs->len)
258 return 0; 260 return 0;
259 261
@@ -267,8 +269,10 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
267 269
268 if (off + count > hppfs->len) 270 if (off + count > hppfs->len)
269 count = hppfs->len - off; 271 count = hppfs->len - off;
270 copy_to_user(buf, &data->contents[off], count); 272 rem = copy_to_user(buf, &data->contents[off], count);
271 *ppos += count; 273 *ppos += count - rem;
274 if (rem > 0)
275 return -EFAULT;
272 } else if (hppfs->host_fd != -1) { 276 } else if (hppfs->host_fd != -1) {
273 err = os_seek_file(hppfs->host_fd, *ppos); 277 err = os_seek_file(hppfs->host_fd, *ppos);
274 if (err) { 278 if (err) {
@@ -285,21 +289,15 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
285 return count; 289 return count;
286} 290}
287 291
288static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len, 292static ssize_t hppfs_write(struct file *file, const char __user *buf,
289 loff_t *ppos) 293 size_t len, loff_t *ppos)
290{ 294{
291 struct hppfs_private *data = file->private_data; 295 struct hppfs_private *data = file->private_data;
292 struct file *proc_file = data->proc_file; 296 struct file *proc_file = data->proc_file;
293 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); 297 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
294 int err;
295 298
296 write = proc_file->f_path.dentry->d_inode->i_fop->write; 299 write = proc_file->f_path.dentry->d_inode->i_fop->write;
297 300 return (*write)(proc_file, buf, len, ppos);
298 proc_file->f_pos = file->f_pos;
299 err = (*write)(proc_file, buf, len, &proc_file->f_pos);
300 file->f_pos = proc_file->f_pos;
301
302 return err;
303} 301}
304 302
305static int open_host_sock(char *host_file, int *filter_out) 303static int open_host_sock(char *host_file, int *filter_out)
@@ -357,7 +355,7 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
357 355
358 if (filter) { 356 if (filter) {
359 while ((n = read_proc(proc_file, data->contents, 357 while ((n = read_proc(proc_file, data->contents,
360 sizeof(data->contents), NULL, 0)) > 0) 358 sizeof(data->contents), NULL, 0)) > 0)
361 os_write_file(fd, data->contents, n); 359 os_write_file(fd, data->contents, n);
362 err = os_shutdown_socket(fd, 0, 1); 360 err = os_shutdown_socket(fd, 0, 1);
363 if (err) { 361 if (err) {
@@ -429,8 +427,8 @@ static int file_mode(int fmode)
429static int hppfs_open(struct inode *inode, struct file *file) 427static int hppfs_open(struct inode *inode, struct file *file)
430{ 428{
431 struct hppfs_private *data; 429 struct hppfs_private *data;
432 struct dentry *proc_dentry;
433 struct vfsmount *proc_mnt; 430 struct vfsmount *proc_mnt;
431 struct dentry *proc_dentry;
434 char *host_file; 432 char *host_file;
435 int err, fd, type, filter; 433 int err, fd, type, filter;
436 434
@@ -492,8 +490,8 @@ static int hppfs_open(struct inode *inode, struct file *file)
492static int hppfs_dir_open(struct inode *inode, struct file *file) 490static int hppfs_dir_open(struct inode *inode, struct file *file)
493{ 491{
494 struct hppfs_private *data; 492 struct hppfs_private *data;
495 struct dentry *proc_dentry;
496 struct vfsmount *proc_mnt; 493 struct vfsmount *proc_mnt;
494 struct dentry *proc_dentry;
497 int err; 495 int err;
498 496
499 err = -ENOMEM; 497 err = -ENOMEM;
@@ -620,6 +618,9 @@ static struct inode *hppfs_alloc_inode(struct super_block *sb)
620 618
621void hppfs_delete_inode(struct inode *ino) 619void hppfs_delete_inode(struct inode *ino)
622{ 620{
621 dput(HPPFS_I(ino)->proc_dentry);
622 mntput(ino->i_sb->s_fs_info);
623
623 clear_inode(ino); 624 clear_inode(ino);
624} 625}
625 626
@@ -628,69 +629,46 @@ static void hppfs_destroy_inode(struct inode *inode)
628 kfree(HPPFS_I(inode)); 629 kfree(HPPFS_I(inode));
629} 630}
630 631
631static void hppfs_put_super(struct super_block *sb)
632{
633 mntput(sb->s_fs_info);
634}
635
636static const struct super_operations hppfs_sbops = { 632static const struct super_operations hppfs_sbops = {
637 .alloc_inode = hppfs_alloc_inode, 633 .alloc_inode = hppfs_alloc_inode,
638 .destroy_inode = hppfs_destroy_inode, 634 .destroy_inode = hppfs_destroy_inode,
639 .delete_inode = hppfs_delete_inode, 635 .delete_inode = hppfs_delete_inode,
640 .statfs = hppfs_statfs, 636 .statfs = hppfs_statfs,
641 .put_super = hppfs_put_super,
642}; 637};
643 638
644static int hppfs_readlink(struct dentry *dentry, char __user *buffer, 639static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
645 int buflen) 640 int buflen)
646{ 641{
647 struct file *proc_file;
648 struct dentry *proc_dentry; 642 struct dentry *proc_dentry;
649 struct vfsmount *proc_mnt;
650 int ret;
651 643
652 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 644 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
653 proc_mnt = dentry->d_sb->s_fs_info; 645 return proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer,
654 646 buflen);
655 proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
656 if (IS_ERR(proc_file))
657 return PTR_ERR(proc_file);
658
659 ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);
660
661 fput(proc_file);
662
663 return ret;
664} 647}
665 648
666static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) 649static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
667{ 650{
668 struct file *proc_file;
669 struct dentry *proc_dentry; 651 struct dentry *proc_dentry;
670 struct vfsmount *proc_mnt;
671 void *ret;
672 652
673 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 653 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
674 proc_mnt = dentry->d_sb->s_fs_info;
675
676 proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
677 if (IS_ERR(proc_file))
678 return proc_file;
679
680 ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
681 654
682 fput(proc_file); 655 return proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
656}
683 657
684 return ret; 658int hppfs_permission(struct inode *inode, int mask, struct nameidata *nd)
659{
660 return generic_permission(inode, mask, NULL);
685} 661}
686 662
687static const struct inode_operations hppfs_dir_iops = { 663static const struct inode_operations hppfs_dir_iops = {
688 .lookup = hppfs_lookup, 664 .lookup = hppfs_lookup,
665 .permission = hppfs_permission,
689}; 666};
690 667
691static const struct inode_operations hppfs_link_iops = { 668static const struct inode_operations hppfs_link_iops = {
692 .readlink = hppfs_readlink, 669 .readlink = hppfs_readlink,
693 .follow_link = hppfs_follow_link, 670 .follow_link = hppfs_follow_link,
671 .permission = hppfs_permission,
694}; 672};
695 673
696static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) 674static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
@@ -712,7 +690,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
712 inode->i_fop = &hppfs_file_fops; 690 inode->i_fop = &hppfs_file_fops;
713 } 691 }
714 692
715 HPPFS_I(inode)->proc_dentry = dentry; 693 HPPFS_I(inode)->proc_dentry = dget(dentry);
716 694
717 inode->i_uid = proc_ino->i_uid; 695 inode->i_uid = proc_ino->i_uid;
718 inode->i_gid = proc_ino->i_gid; 696 inode->i_gid = proc_ino->i_gid;
@@ -725,7 +703,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
725 inode->i_size = proc_ino->i_size; 703 inode->i_size = proc_ino->i_size;
726 inode->i_blocks = proc_ino->i_blocks; 704 inode->i_blocks = proc_ino->i_blocks;
727 705
728 return 0; 706 return inode;
729} 707}
730 708
731static int hppfs_fill_super(struct super_block *sb, void *d, int silent) 709static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index cd931ef1f000..5a8ca61498ca 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -470,7 +470,9 @@ void journal_commit_transaction(journal_t *journal)
470 * transaction! Now comes the tricky part: we need to write out 470 * transaction! Now comes the tricky part: we need to write out
471 * metadata. Loop over the transaction's entire buffer list: 471 * metadata. Loop over the transaction's entire buffer list:
472 */ 472 */
473 spin_lock(&journal->j_state_lock);
473 commit_transaction->t_state = T_COMMIT; 474 commit_transaction->t_state = T_COMMIT;
475 spin_unlock(&journal->j_state_lock);
474 476
475 J_ASSERT(commit_transaction->t_nr_buffers <= 477 J_ASSERT(commit_transaction->t_nr_buffers <=
476 commit_transaction->t_outstanding_credits); 478 commit_transaction->t_outstanding_credits);
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index e0139786f717..a2ed72f7ceee 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -168,6 +168,7 @@ static int journal_submit_commit_record(journal_t *journal,
168 spin_unlock(&journal->j_state_lock); 168 spin_unlock(&journal->j_state_lock);
169 169
170 /* And try again, without the barrier */ 170 /* And try again, without the barrier */
171 lock_buffer(bh);
171 set_buffer_uptodate(bh); 172 set_buffer_uptodate(bh);
172 set_buffer_dirty(bh); 173 set_buffer_dirty(bh);
173 ret = submit_bh(WRITE, bh); 174 ret = submit_bh(WRITE, bh);
@@ -560,7 +561,9 @@ void jbd2_journal_commit_transaction(journal_t *journal)
560 * transaction! Now comes the tricky part: we need to write out 561 * transaction! Now comes the tricky part: we need to write out
561 * metadata. Loop over the transaction's entire buffer list: 562 * metadata. Loop over the transaction's entire buffer list:
562 */ 563 */
564 spin_lock(&journal->j_state_lock);
563 commit_transaction->t_state = T_COMMIT; 565 commit_transaction->t_state = T_COMMIT;
566 spin_unlock(&journal->j_state_lock);
564 567
565 stats.u.run.rs_logging = jiffies; 568 stats.u.run.rs_logging = jiffies;
566 stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing, 569 stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing,
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 53632e3e8457..2e24567c4a79 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -901,7 +901,7 @@ static void jbd2_stats_proc_init(journal_t *journal)
901{ 901{
902 char name[BDEVNAME_SIZE]; 902 char name[BDEVNAME_SIZE];
903 903
904 snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name)); 904 bdevname(journal->j_dev, name);
905 journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats); 905 journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats);
906 if (journal->j_proc_entry) { 906 if (journal->j_proc_entry) {
907 proc_create_data("history", S_IRUGO, journal->j_proc_entry, 907 proc_create_data("history", S_IRUGO, journal->j_proc_entry,
@@ -915,7 +915,7 @@ static void jbd2_stats_proc_exit(journal_t *journal)
915{ 915{
916 char name[BDEVNAME_SIZE]; 916 char name[BDEVNAME_SIZE];
917 917
918 snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name)); 918 bdevname(journal->j_dev, name);
919 remove_proc_entry("info", journal->j_proc_entry); 919 remove_proc_entry("info", journal->j_proc_entry);
920 remove_proc_entry("history", journal->j_proc_entry); 920 remove_proc_entry("history", journal->j_proc_entry);
921 remove_proc_entry(name, proc_jbd2_stats); 921 remove_proc_entry(name, proc_jbd2_stats);
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 5d0405a9e7ca..058f50f65b76 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -344,6 +344,7 @@ static int calc_chksums(journal_t *journal, struct buffer_head *bh,
344 *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data, 344 *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data,
345 obh->b_size); 345 obh->b_size);
346 } 346 }
347 put_bh(obh);
347 } 348 }
348 return 0; 349 return 0;
349} 350}
@@ -610,9 +611,8 @@ static int do_one_pass(journal_t *journal,
610 chksum_err = chksum_seen = 0; 611 chksum_err = chksum_seen = 0;
611 612
612 if (info->end_transaction) { 613 if (info->end_transaction) {
613 printk(KERN_ERR "JBD: Transaction %u " 614 journal->j_failed_commit =
614 "found to be corrupt.\n", 615 info->end_transaction;
615 next_commit_ID - 1);
616 brelse(bh); 616 brelse(bh);
617 break; 617 break;
618 } 618 }
@@ -643,10 +643,8 @@ static int do_one_pass(journal_t *journal,
643 643
644 if (!JBD2_HAS_INCOMPAT_FEATURE(journal, 644 if (!JBD2_HAS_INCOMPAT_FEATURE(journal,
645 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){ 645 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){
646 printk(KERN_ERR 646 journal->j_failed_commit =
647 "JBD: Transaction %u " 647 next_commit_ID;
648 "found to be corrupt.\n",
649 next_commit_ID);
650 brelse(bh); 648 brelse(bh);
651 break; 649 break;
652 } 650 }
diff --git a/fs/libfs.c b/fs/libfs.c
index b004dfadd891..892d41cb3382 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -528,6 +528,23 @@ ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos,
528 return count; 528 return count;
529} 529}
530 530
531ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
532 const void *from, size_t available)
533{
534 loff_t pos = *ppos;
535
536 if (pos < 0)
537 return -EINVAL;
538 if (pos >= available)
539 return 0;
540 if (count > available - pos)
541 count = available - pos;
542 memcpy(to, from + pos, count);
543 *ppos = pos + count;
544
545 return count;
546}
547
531/* 548/*
532 * Transaction based IO. 549 * Transaction based IO.
533 * The file expects a single write which triggers the transaction, and then 550 * The file expects a single write which triggers the transaction, and then
@@ -800,6 +817,7 @@ EXPORT_SYMBOL(simple_statfs);
800EXPORT_SYMBOL(simple_sync_file); 817EXPORT_SYMBOL(simple_sync_file);
801EXPORT_SYMBOL(simple_unlink); 818EXPORT_SYMBOL(simple_unlink);
802EXPORT_SYMBOL(simple_read_from_buffer); 819EXPORT_SYMBOL(simple_read_from_buffer);
820EXPORT_SYMBOL(memory_read_from_buffer);
803EXPORT_SYMBOL(simple_transaction_get); 821EXPORT_SYMBOL(simple_transaction_get);
804EXPORT_SYMBOL(simple_transaction_read); 822EXPORT_SYMBOL(simple_transaction_read);
805EXPORT_SYMBOL(simple_transaction_release); 823EXPORT_SYMBOL(simple_transaction_release);
diff --git a/fs/namei.c b/fs/namei.c
index 32fd9655485b..c7e43536c49a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2003,18 +2003,22 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir)
2003 if (IS_ERR(dentry)) 2003 if (IS_ERR(dentry))
2004 goto fail; 2004 goto fail;
2005 2005
2006 if (dentry->d_inode)
2007 goto eexist;
2006 /* 2008 /*
2007 * Special case - lookup gave negative, but... we had foo/bar/ 2009 * Special case - lookup gave negative, but... we had foo/bar/
2008 * From the vfs_mknod() POV we just have a negative dentry - 2010 * From the vfs_mknod() POV we just have a negative dentry -
2009 * all is fine. Let's be bastards - you had / on the end, you've 2011 * all is fine. Let's be bastards - you had / on the end, you've
2010 * been asking for (non-existent) directory. -ENOENT for you. 2012 * been asking for (non-existent) directory. -ENOENT for you.
2011 */ 2013 */
2012 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode) 2014 if (unlikely(!is_dir && nd->last.name[nd->last.len])) {
2013 goto enoent; 2015 dput(dentry);
2016 dentry = ERR_PTR(-ENOENT);
2017 }
2014 return dentry; 2018 return dentry;
2015enoent: 2019eexist:
2016 dput(dentry); 2020 dput(dentry);
2017 dentry = ERR_PTR(-ENOENT); 2021 dentry = ERR_PTR(-EEXIST);
2018fail: 2022fail:
2019 return dentry; 2023 return dentry;
2020} 2024}
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 5606ae3d72d3..c1e7c8300629 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -182,7 +182,7 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp)
182 if (clp == NULL) 182 if (clp == NULL)
183 return SVC_DROP; 183 return SVC_DROP;
184 184
185 dprintk("%s: %s NFSv4 callback!\n", __FUNCTION__, 185 dprintk("%s: %s NFSv4 callback!\n", __func__,
186 svc_print_addr(rqstp, buf, sizeof(buf))); 186 svc_print_addr(rqstp, buf, sizeof(buf)));
187 nfs_put_client(clp); 187 nfs_put_client(clp);
188 188
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 15f7785048d3..f7e83e23cf9f 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -57,7 +57,7 @@ out_iput:
57out_putclient: 57out_putclient:
58 nfs_put_client(clp); 58 nfs_put_client(clp);
59out: 59out:
60 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(res->status)); 60 dprintk("%s: exit with status = %d\n", __func__, ntohl(res->status));
61 return res->status; 61 return res->status;
62} 62}
63 63
@@ -98,6 +98,6 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
98 nfs_put_client(prev); 98 nfs_put_client(prev);
99 } while (clp != NULL); 99 } while (clp != NULL);
100out: 100out:
101 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(res)); 101 dprintk("%s: exit with status = %d\n", __func__, ntohl(res));
102 return res; 102 return res;
103} 103}
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 13619d24f023..dd0ef34b5845 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -141,7 +141,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
141 /* We do not like overly long tags! */ 141 /* We do not like overly long tags! */
142 if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) { 142 if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) {
143 printk("NFSv4 CALLBACK %s: client sent tag of length %u\n", 143 printk("NFSv4 CALLBACK %s: client sent tag of length %u\n",
144 __FUNCTION__, hdr->taglen); 144 __func__, hdr->taglen);
145 return htonl(NFS4ERR_RESOURCE); 145 return htonl(NFS4ERR_RESOURCE);
146 } 146 }
147 p = read_buf(xdr, 12); 147 p = read_buf(xdr, 12);
@@ -151,7 +151,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
151 /* Check minor version is zero. */ 151 /* Check minor version is zero. */
152 if (minor_version != 0) { 152 if (minor_version != 0) {
153 printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n", 153 printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n",
154 __FUNCTION__, minor_version); 154 __func__, minor_version);
155 return htonl(NFS4ERR_MINOR_VERS_MISMATCH); 155 return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
156 } 156 }
157 hdr->callback_ident = ntohl(*p++); 157 hdr->callback_ident = ntohl(*p++);
@@ -179,7 +179,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
179 args->addr = svc_addr(rqstp); 179 args->addr = svc_addr(rqstp);
180 status = decode_bitmap(xdr, args->bitmap); 180 status = decode_bitmap(xdr, args->bitmap);
181out: 181out:
182 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); 182 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
183 return status; 183 return status;
184} 184}
185 185
@@ -200,7 +200,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr,
200 args->truncate = ntohl(*p); 200 args->truncate = ntohl(*p);
201 status = decode_fh(xdr, &args->fh); 201 status = decode_fh(xdr, &args->fh);
202out: 202out:
203 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); 203 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
204 return status; 204 return status;
205} 205}
206 206
@@ -349,7 +349,7 @@ static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
349 status = encode_attr_mtime(xdr, res->bitmap, &res->mtime); 349 status = encode_attr_mtime(xdr, res->bitmap, &res->mtime);
350 *savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1))); 350 *savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1)));
351out: 351out:
352 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); 352 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
353 return status; 353 return status;
354} 354}
355 355
@@ -363,7 +363,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
363 long maxlen; 363 long maxlen;
364 __be32 res; 364 __be32 res;
365 365
366 dprintk("%s: start\n", __FUNCTION__); 366 dprintk("%s: start\n", __func__);
367 status = decode_op_hdr(xdr_in, &op_nr); 367 status = decode_op_hdr(xdr_in, &op_nr);
368 if (likely(status == 0)) { 368 if (likely(status == 0)) {
369 switch (op_nr) { 369 switch (op_nr) {
@@ -392,7 +392,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
392 status = res; 392 status = res;
393 if (op->encode_res != NULL && status == 0) 393 if (op->encode_res != NULL && status == 0)
394 status = op->encode_res(rqstp, xdr_out, resp); 394 status = op->encode_res(rqstp, xdr_out, resp);
395 dprintk("%s: done, status = %d\n", __FUNCTION__, ntohl(status)); 395 dprintk("%s: done, status = %d\n", __func__, ntohl(status));
396 return status; 396 return status;
397} 397}
398 398
@@ -401,37 +401,37 @@ static __be32 process_op(struct svc_rqst *rqstp,
401 */ 401 */
402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) 402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp)
403{ 403{
404 struct cb_compound_hdr_arg hdr_arg; 404 struct cb_compound_hdr_arg hdr_arg = { 0 };
405 struct cb_compound_hdr_res hdr_res; 405 struct cb_compound_hdr_res hdr_res = { NULL };
406 struct xdr_stream xdr_in, xdr_out; 406 struct xdr_stream xdr_in, xdr_out;
407 __be32 *p; 407 __be32 *p;
408 __be32 status; 408 __be32 status;
409 unsigned int nops = 1; 409 unsigned int nops = 0;
410 410
411 dprintk("%s: start\n", __FUNCTION__); 411 dprintk("%s: start\n", __func__);
412 412
413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); 413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base);
414 414
415 p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); 415 p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len);
416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p); 416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p);
417 417
418 decode_compound_hdr_arg(&xdr_in, &hdr_arg); 418 status = decode_compound_hdr_arg(&xdr_in, &hdr_arg);
419 if (status == __constant_htonl(NFS4ERR_RESOURCE))
420 return rpc_garbage_args;
421
419 hdr_res.taglen = hdr_arg.taglen; 422 hdr_res.taglen = hdr_arg.taglen;
420 hdr_res.tag = hdr_arg.tag; 423 hdr_res.tag = hdr_arg.tag;
421 hdr_res.nops = NULL; 424 if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0)
422 encode_compound_hdr_res(&xdr_out, &hdr_res); 425 return rpc_system_err;
423 426
424 for (;;) { 427 while (status == 0 && nops != hdr_arg.nops) {
425 status = process_op(rqstp, &xdr_in, argp, &xdr_out, resp); 428 status = process_op(rqstp, &xdr_in, argp, &xdr_out, resp);
426 if (status != 0)
427 break;
428 if (nops == hdr_arg.nops)
429 break;
430 nops++; 429 nops++;
431 } 430 }
431
432 *hdr_res.status = status; 432 *hdr_res.status = status;
433 *hdr_res.nops = htonl(nops); 433 *hdr_res.nops = htonl(nops);
434 dprintk("%s: done, status = %u\n", __FUNCTION__, ntohl(status)); 434 dprintk("%s: done, status = %u\n", __func__, ntohl(status));
435 return rpc_success; 435 return rpc_success;
436} 436}
437 437
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 89ac5bb0401c..f2a092ca69b5 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -488,7 +488,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp,
488 clnt = rpc_create(&args); 488 clnt = rpc_create(&args);
489 if (IS_ERR(clnt)) { 489 if (IS_ERR(clnt)) {
490 dprintk("%s: cannot create RPC client. Error = %ld\n", 490 dprintk("%s: cannot create RPC client. Error = %ld\n",
491 __FUNCTION__, PTR_ERR(clnt)); 491 __func__, PTR_ERR(clnt));
492 return PTR_ERR(clnt); 492 return PTR_ERR(clnt);
493 } 493 }
494 494
@@ -576,7 +576,7 @@ static int nfs_init_server_rpcclient(struct nfs_server *server,
576 576
577 server->client = rpc_clone_client(clp->cl_rpcclient); 577 server->client = rpc_clone_client(clp->cl_rpcclient);
578 if (IS_ERR(server->client)) { 578 if (IS_ERR(server->client)) {
579 dprintk("%s: couldn't create rpc_client!\n", __FUNCTION__); 579 dprintk("%s: couldn't create rpc_client!\n", __func__);
580 return PTR_ERR(server->client); 580 return PTR_ERR(server->client);
581 } 581 }
582 582
@@ -590,7 +590,7 @@ static int nfs_init_server_rpcclient(struct nfs_server *server,
590 590
591 auth = rpcauth_create(pseudoflavour, server->client); 591 auth = rpcauth_create(pseudoflavour, server->client);
592 if (IS_ERR(auth)) { 592 if (IS_ERR(auth)) {
593 dprintk("%s: couldn't create credcache!\n", __FUNCTION__); 593 dprintk("%s: couldn't create credcache!\n", __func__);
594 return PTR_ERR(auth); 594 return PTR_ERR(auth);
595 } 595 }
596 } 596 }
@@ -985,7 +985,7 @@ static int nfs4_init_client(struct nfs_client *clp,
985 error = nfs_idmap_new(clp); 985 error = nfs_idmap_new(clp);
986 if (error < 0) { 986 if (error < 0) {
987 dprintk("%s: failed to create idmapper. Error = %d\n", 987 dprintk("%s: failed to create idmapper. Error = %d\n",
988 __FUNCTION__, error); 988 __func__, error);
989 goto error; 989 goto error;
990 } 990 }
991 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); 991 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 00a5e4405e16..cc563cfa6940 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -60,7 +60,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_
60 switch (status) { 60 switch (status) {
61 default: 61 default:
62 printk(KERN_ERR "%s: unhandled error %d.\n", 62 printk(KERN_ERR "%s: unhandled error %d.\n",
63 __FUNCTION__, status); 63 __func__, status);
64 case -NFS4ERR_EXPIRED: 64 case -NFS4ERR_EXPIRED:
65 /* kill_proc(fl->fl_pid, SIGLOST, 1); */ 65 /* kill_proc(fl->fl_pid, SIGLOST, 1); */
66 case -NFS4ERR_STALE_CLIENTID: 66 case -NFS4ERR_STALE_CLIENTID:
@@ -186,7 +186,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
186 */ 186 */
187 dfprintk(FILE, "%s: server %s handed out " 187 dfprintk(FILE, "%s: server %s handed out "
188 "a duplicate delegation!\n", 188 "a duplicate delegation!\n",
189 __FUNCTION__, clp->cl_hostname); 189 __func__, clp->cl_hostname);
190 if (delegation->type <= nfsi->delegation->type) { 190 if (delegation->type <= nfsi->delegation->type) {
191 freeme = delegation; 191 freeme = delegation;
192 delegation = NULL; 192 delegation = NULL;
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index f288b3ecab4a..58d43daec084 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -180,7 +180,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
180 int error; 180 int error;
181 181
182 dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n", 182 dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n",
183 __FUNCTION__, (long long)desc->entry->cookie, 183 __func__, (long long)desc->entry->cookie,
184 page->index); 184 page->index);
185 185
186 again: 186 again:
@@ -256,7 +256,7 @@ int find_dirent(nfs_readdir_descriptor_t *desc)
256 256
257 while((status = dir_decode(desc)) == 0) { 257 while((status = dir_decode(desc)) == 0) {
258 dfprintk(DIRCACHE, "NFS: %s: examining cookie %Lu\n", 258 dfprintk(DIRCACHE, "NFS: %s: examining cookie %Lu\n",
259 __FUNCTION__, (unsigned long long)entry->cookie); 259 __func__, (unsigned long long)entry->cookie);
260 if (entry->prev_cookie == *desc->dir_cookie) 260 if (entry->prev_cookie == *desc->dir_cookie)
261 break; 261 break;
262 if (loop_count++ > 200) { 262 if (loop_count++ > 200) {
@@ -315,7 +315,7 @@ int find_dirent_page(nfs_readdir_descriptor_t *desc)
315 int status; 315 int status;
316 316
317 dfprintk(DIRCACHE, "NFS: %s: searching page %ld for target %Lu\n", 317 dfprintk(DIRCACHE, "NFS: %s: searching page %ld for target %Lu\n",
318 __FUNCTION__, desc->page_index, 318 __func__, desc->page_index,
319 (long long) *desc->dir_cookie); 319 (long long) *desc->dir_cookie);
320 320
321 /* If we find the page in the page_cache, we cannot be sure 321 /* If we find the page in the page_cache, we cannot be sure
@@ -339,7 +339,7 @@ int find_dirent_page(nfs_readdir_descriptor_t *desc)
339 if (status < 0) 339 if (status < 0)
340 dir_page_release(desc); 340 dir_page_release(desc);
341 out: 341 out:
342 dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __FUNCTION__, status); 342 dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __func__, status);
343 return status; 343 return status;
344} 344}
345 345
@@ -380,7 +380,7 @@ int readdir_search_pagecache(nfs_readdir_descriptor_t *desc)
380 } 380 }
381 } 381 }
382 382
383 dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __FUNCTION__, res); 383 dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __func__, res);
384 return res; 384 return res;
385} 385}
386 386
@@ -506,7 +506,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
506 desc->entry->eof = 0; 506 desc->entry->eof = 0;
507 out: 507 out:
508 dfprintk(DIRCACHE, "NFS: %s: returns %d\n", 508 dfprintk(DIRCACHE, "NFS: %s: returns %d\n",
509 __FUNCTION__, status); 509 __func__, status);
510 return status; 510 return status;
511 out_release: 511 out_release:
512 dir_page_release(desc); 512 dir_page_release(desc);
@@ -780,7 +780,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
780 780
781 if (is_bad_inode(inode)) { 781 if (is_bad_inode(inode)) {
782 dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", 782 dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n",
783 __FUNCTION__, dentry->d_parent->d_name.name, 783 __func__, dentry->d_parent->d_name.name,
784 dentry->d_name.name); 784 dentry->d_name.name);
785 goto out_bad; 785 goto out_bad;
786 } 786 }
@@ -808,7 +808,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
808 unlock_kernel(); 808 unlock_kernel();
809 dput(parent); 809 dput(parent);
810 dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n", 810 dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n",
811 __FUNCTION__, dentry->d_parent->d_name.name, 811 __func__, dentry->d_parent->d_name.name,
812 dentry->d_name.name); 812 dentry->d_name.name);
813 return 1; 813 return 1;
814out_zap_parent: 814out_zap_parent:
@@ -827,7 +827,7 @@ out_zap_parent:
827 unlock_kernel(); 827 unlock_kernel();
828 dput(parent); 828 dput(parent);
829 dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n", 829 dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n",
830 __FUNCTION__, dentry->d_parent->d_name.name, 830 __func__, dentry->d_parent->d_name.name,
831 dentry->d_name.name); 831 dentry->d_name.name);
832 return 0; 832 return 0;
833} 833}
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 3536b01164f9..d84a3d8f32af 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -526,7 +526,7 @@ static int do_vfs_lock(struct file *file, struct file_lock *fl)
526 if (res < 0) 526 if (res < 0)
527 dprintk(KERN_WARNING "%s: VFS is out of sync with lock manager" 527 dprintk(KERN_WARNING "%s: VFS is out of sync with lock manager"
528 " - error %d!\n", 528 " - error %d!\n",
529 __FUNCTION__, res); 529 __func__, res);
530 return res; 530 return res;
531} 531}
532 532
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 5cb3345eb694..596c5d8e86f4 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -541,8 +541,7 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait)
541 } 541 }
542 if (ctx->cred != NULL) 542 if (ctx->cred != NULL)
543 put_rpccred(ctx->cred); 543 put_rpccred(ctx->cred);
544 dput(ctx->path.dentry); 544 path_put(&ctx->path);
545 mntput(ctx->path.mnt);
546 kfree(ctx); 545 kfree(ctx);
547} 546}
548 547
@@ -707,6 +706,13 @@ int nfs_attribute_timeout(struct inode *inode)
707 706
708 if (nfs_have_delegation(inode, FMODE_READ)) 707 if (nfs_have_delegation(inode, FMODE_READ))
709 return 0; 708 return 0;
709 /*
710 * Special case: if the attribute timeout is set to 0, then always
711 * treat the cache as having expired (unless holding
712 * a delegation).
713 */
714 if (nfsi->attrtimeo == 0)
715 return 1;
710 return !time_in_range(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo); 716 return !time_in_range(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo);
711} 717}
712 718
@@ -995,7 +1001,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
995 unsigned long now = jiffies; 1001 unsigned long now = jiffies;
996 1002
997 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", 1003 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
998 __FUNCTION__, inode->i_sb->s_id, inode->i_ino, 1004 __func__, inode->i_sb->s_id, inode->i_ino,
999 atomic_read(&inode->i_count), fattr->valid); 1005 atomic_read(&inode->i_count), fattr->valid);
1000 1006
1001 if (nfsi->fileid != fattr->fileid) 1007 if (nfsi->fileid != fattr->fileid)
@@ -1119,7 +1125,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1119 * Big trouble! The inode has become a different object. 1125 * Big trouble! The inode has become a different object.
1120 */ 1126 */
1121 printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", 1127 printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n",
1122 __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode); 1128 __func__, inode->i_ino, inode->i_mode, fattr->mode);
1123 out_err: 1129 out_err:
1124 /* 1130 /*
1125 * No need to worry about unhashing the dentry, as the 1131 * No need to worry about unhashing the dentry, as the
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index af4d0f1e402c..2f285ef76399 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -106,7 +106,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
106 dprintk("--> nfs_follow_mountpoint()\n"); 106 dprintk("--> nfs_follow_mountpoint()\n");
107 107
108 BUG_ON(IS_ROOT(dentry)); 108 BUG_ON(IS_ROOT(dentry));
109 dprintk("%s: enter\n", __FUNCTION__); 109 dprintk("%s: enter\n", __func__);
110 dput(nd->path.dentry); 110 dput(nd->path.dentry);
111 nd->path.dentry = dget(dentry); 111 nd->path.dentry = dget(dentry);
112 112
@@ -137,13 +137,12 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
137 goto out_follow; 137 goto out_follow;
138 goto out_err; 138 goto out_err;
139 } 139 }
140 mntput(nd->path.mnt); 140 path_put(&nd->path);
141 dput(nd->path.dentry);
142 nd->path.mnt = mnt; 141 nd->path.mnt = mnt;
143 nd->path.dentry = dget(mnt->mnt_root); 142 nd->path.dentry = dget(mnt->mnt_root);
144 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); 143 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
145out: 144out:
146 dprintk("%s: done, returned %d\n", __FUNCTION__, err); 145 dprintk("%s: done, returned %d\n", __func__, err);
147 146
148 dprintk("<-- nfs_follow_mountpoint() = %d\n", err); 147 dprintk("<-- nfs_follow_mountpoint() = %d\n", err);
149 return ERR_PTR(err); 148 return ERR_PTR(err);
@@ -230,7 +229,7 @@ static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
230 229
231 dprintk("--> nfs_do_submount()\n"); 230 dprintk("--> nfs_do_submount()\n");
232 231
233 dprintk("%s: submounting on %s/%s\n", __FUNCTION__, 232 dprintk("%s: submounting on %s/%s\n", __func__,
234 dentry->d_parent->d_name.name, 233 dentry->d_parent->d_name.name,
235 dentry->d_name.name); 234 dentry->d_name.name);
236 if (page == NULL) 235 if (page == NULL)
@@ -243,7 +242,7 @@ static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
243free_page: 242free_page:
244 free_page((unsigned long)page); 243 free_page((unsigned long)page);
245out: 244out:
246 dprintk("%s: done\n", __FUNCTION__); 245 dprintk("%s: done\n", __func__);
247 246
248 dprintk("<-- nfs_do_submount() = %p\n", mnt); 247 dprintk("<-- nfs_do_submount() = %p\n", mnt);
249 return mnt; 248 return mnt;
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 549dbce714a4..c3523ad03ed1 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -63,15 +63,15 @@ do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle,
63 }; 63 };
64 int status; 64 int status;
65 65
66 dprintk("%s: call fsinfo\n", __FUNCTION__); 66 dprintk("%s: call fsinfo\n", __func__);
67 nfs_fattr_init(info->fattr); 67 nfs_fattr_init(info->fattr);
68 status = rpc_call_sync(client, &msg, 0); 68 status = rpc_call_sync(client, &msg, 0);
69 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); 69 dprintk("%s: reply fsinfo: %d\n", __func__, status);
70 if (!(info->fattr->valid & NFS_ATTR_FATTR)) { 70 if (!(info->fattr->valid & NFS_ATTR_FATTR)) {
71 msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR]; 71 msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR];
72 msg.rpc_resp = info->fattr; 72 msg.rpc_resp = info->fattr;
73 status = rpc_call_sync(client, &msg, 0); 73 status = rpc_call_sync(client, &msg, 0);
74 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); 74 dprintk("%s: reply getattr: %d\n", __func__, status);
75 } 75 }
76 return status; 76 return status;
77} 77}
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index bd1b9d663fb9..ea790645fda6 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -206,7 +206,6 @@ struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp);
206 206
207extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); 207extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *);
208extern void nfs4_put_state_owner(struct nfs4_state_owner *); 208extern void nfs4_put_state_owner(struct nfs4_state_owner *);
209extern void nfs4_drop_state_owner(struct nfs4_state_owner *);
210extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 209extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
211extern void nfs4_put_open_state(struct nfs4_state *); 210extern void nfs4_put_open_state(struct nfs4_state *);
212extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); 211extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t);
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 5f9ba41ed5bf..b112857301f7 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -86,7 +86,7 @@ static int nfs4_validate_fspath(const struct vfsmount *mnt_parent,
86 86
87 if (strncmp(path, fs_path, strlen(fs_path)) != 0) { 87 if (strncmp(path, fs_path, strlen(fs_path)) != 0) {
88 dprintk("%s: path %s does not begin with fsroot %s\n", 88 dprintk("%s: path %s does not begin with fsroot %s\n",
89 __FUNCTION__, path, fs_path); 89 __func__, path, fs_path);
90 return -ENOENT; 90 return -ENOENT;
91 } 91 }
92 92
@@ -134,7 +134,7 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
134 if (locations == NULL || locations->nlocations <= 0) 134 if (locations == NULL || locations->nlocations <= 0)
135 goto out; 135 goto out;
136 136
137 dprintk("%s: referral at %s/%s\n", __FUNCTION__, 137 dprintk("%s: referral at %s/%s\n", __func__,
138 dentry->d_parent->d_name.name, dentry->d_name.name); 138 dentry->d_parent->d_name.name, dentry->d_name.name);
139 139
140 page = (char *) __get_free_page(GFP_USER); 140 page = (char *) __get_free_page(GFP_USER);
@@ -204,7 +204,7 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
204out: 204out:
205 free_page((unsigned long) page); 205 free_page((unsigned long) page);
206 free_page((unsigned long) page2); 206 free_page((unsigned long) page2);
207 dprintk("%s: done\n", __FUNCTION__); 207 dprintk("%s: done\n", __func__);
208 return mnt; 208 return mnt;
209} 209}
210 210
@@ -223,7 +223,7 @@ struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentr
223 int err; 223 int err;
224 224
225 /* BUG_ON(IS_ROOT(dentry)); */ 225 /* BUG_ON(IS_ROOT(dentry)); */
226 dprintk("%s: enter\n", __FUNCTION__); 226 dprintk("%s: enter\n", __func__);
227 227
228 page = alloc_page(GFP_KERNEL); 228 page = alloc_page(GFP_KERNEL);
229 if (page == NULL) 229 if (page == NULL)
@@ -238,7 +238,7 @@ struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentr
238 238
239 parent = dget_parent(dentry); 239 parent = dget_parent(dentry);
240 dprintk("%s: getting locations for %s/%s\n", 240 dprintk("%s: getting locations for %s/%s\n",
241 __FUNCTION__, parent->d_name.name, dentry->d_name.name); 241 __func__, parent->d_name.name, dentry->d_name.name);
242 242
243 err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page); 243 err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page);
244 dput(parent); 244 dput(parent);
@@ -252,6 +252,6 @@ out_free:
252 __free_page(page); 252 __free_page(page);
253 kfree(fs_locations); 253 kfree(fs_locations);
254out: 254out:
255 dprintk("%s: done\n", __FUNCTION__); 255 dprintk("%s: done\n", __func__);
256 return mnt; 256 return mnt;
257} 257}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index dbc09271af02..1293e0acd82b 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -73,7 +73,7 @@ int nfs4_map_errors(int err)
73{ 73{
74 if (err < -1000) { 74 if (err < -1000) {
75 dprintk("%s could not handle NFSv4 error %d\n", 75 dprintk("%s could not handle NFSv4 error %d\n",
76 __FUNCTION__, -err); 76 __func__, -err);
77 return -EIO; 77 return -EIO;
78 } 78 }
79 return err; 79 return err;
@@ -306,8 +306,7 @@ static void nfs4_opendata_free(struct kref *kref)
306 nfs4_put_open_state(p->state); 306 nfs4_put_open_state(p->state);
307 nfs4_put_state_owner(p->owner); 307 nfs4_put_state_owner(p->owner);
308 dput(p->dir); 308 dput(p->dir);
309 dput(p->path.dentry); 309 path_put(&p->path);
310 mntput(p->path.mnt);
311 kfree(p); 310 kfree(p);
312} 311}
313 312
@@ -1210,8 +1209,7 @@ static void nfs4_free_closedata(void *data)
1210 nfs4_put_open_state(calldata->state); 1209 nfs4_put_open_state(calldata->state);
1211 nfs_free_seqid(calldata->arg.seqid); 1210 nfs_free_seqid(calldata->arg.seqid);
1212 nfs4_put_state_owner(sp); 1211 nfs4_put_state_owner(sp);
1213 dput(calldata->path.dentry); 1212 path_put(&calldata->path);
1214 mntput(calldata->path.mnt);
1215 kfree(calldata); 1213 kfree(calldata);
1216} 1214}
1217 1215
@@ -1578,7 +1576,7 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct
1578 goto out; 1576 goto out;
1579 /* Make sure server returned a different fsid for the referral */ 1577 /* Make sure server returned a different fsid for the referral */
1580 if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { 1578 if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) {
1581 dprintk("%s: server did not return a different fsid for a referral at %s\n", __FUNCTION__, name->name); 1579 dprintk("%s: server did not return a different fsid for a referral at %s\n", __func__, name->name);
1582 status = -EIO; 1580 status = -EIO;
1583 goto out; 1581 goto out;
1584 } 1582 }
@@ -2211,7 +2209,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2211 }; 2209 };
2212 int status; 2210 int status;
2213 2211
2214 dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __FUNCTION__, 2212 dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__,
2215 dentry->d_parent->d_name.name, 2213 dentry->d_parent->d_name.name,
2216 dentry->d_name.name, 2214 dentry->d_name.name,
2217 (unsigned long long)cookie); 2215 (unsigned long long)cookie);
@@ -2223,7 +2221,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2223 2221
2224 nfs_invalidate_atime(dir); 2222 nfs_invalidate_atime(dir);
2225 2223
2226 dprintk("%s: returns %d\n", __FUNCTION__, status); 2224 dprintk("%s: returns %d\n", __func__, status);
2227 return status; 2225 return status;
2228} 2226}
2229 2227
@@ -3342,7 +3340,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
3342 struct nfs4_lockdata *data = calldata; 3340 struct nfs4_lockdata *data = calldata;
3343 struct nfs4_state *state = data->lsp->ls_state; 3341 struct nfs4_state *state = data->lsp->ls_state;
3344 3342
3345 dprintk("%s: begin!\n", __FUNCTION__); 3343 dprintk("%s: begin!\n", __func__);
3346 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) 3344 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3347 return; 3345 return;
3348 /* Do we need to do an open_to_lock_owner? */ 3346 /* Do we need to do an open_to_lock_owner? */
@@ -3356,14 +3354,14 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
3356 data->arg.new_lock_owner = 0; 3354 data->arg.new_lock_owner = 0;
3357 data->timestamp = jiffies; 3355 data->timestamp = jiffies;
3358 rpc_call_start(task); 3356 rpc_call_start(task);
3359 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); 3357 dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status);
3360} 3358}
3361 3359
3362static void nfs4_lock_done(struct rpc_task *task, void *calldata) 3360static void nfs4_lock_done(struct rpc_task *task, void *calldata)
3363{ 3361{
3364 struct nfs4_lockdata *data = calldata; 3362 struct nfs4_lockdata *data = calldata;
3365 3363
3366 dprintk("%s: begin!\n", __FUNCTION__); 3364 dprintk("%s: begin!\n", __func__);
3367 3365
3368 data->rpc_status = task->tk_status; 3366 data->rpc_status = task->tk_status;
3369 if (RPC_ASSASSINATED(task)) 3367 if (RPC_ASSASSINATED(task))
@@ -3381,14 +3379,14 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
3381 renew_lease(NFS_SERVER(data->ctx->path.dentry->d_inode), data->timestamp); 3379 renew_lease(NFS_SERVER(data->ctx->path.dentry->d_inode), data->timestamp);
3382 } 3380 }
3383out: 3381out:
3384 dprintk("%s: done, ret = %d!\n", __FUNCTION__, data->rpc_status); 3382 dprintk("%s: done, ret = %d!\n", __func__, data->rpc_status);
3385} 3383}
3386 3384
3387static void nfs4_lock_release(void *calldata) 3385static void nfs4_lock_release(void *calldata)
3388{ 3386{
3389 struct nfs4_lockdata *data = calldata; 3387 struct nfs4_lockdata *data = calldata;
3390 3388
3391 dprintk("%s: begin!\n", __FUNCTION__); 3389 dprintk("%s: begin!\n", __func__);
3392 nfs_free_seqid(data->arg.open_seqid); 3390 nfs_free_seqid(data->arg.open_seqid);
3393 if (data->cancelled != 0) { 3391 if (data->cancelled != 0) {
3394 struct rpc_task *task; 3392 struct rpc_task *task;
@@ -3396,13 +3394,13 @@ static void nfs4_lock_release(void *calldata)
3396 data->arg.lock_seqid); 3394 data->arg.lock_seqid);
3397 if (!IS_ERR(task)) 3395 if (!IS_ERR(task))
3398 rpc_put_task(task); 3396 rpc_put_task(task);
3399 dprintk("%s: cancelling lock!\n", __FUNCTION__); 3397 dprintk("%s: cancelling lock!\n", __func__);
3400 } else 3398 } else
3401 nfs_free_seqid(data->arg.lock_seqid); 3399 nfs_free_seqid(data->arg.lock_seqid);
3402 nfs4_put_lock_state(data->lsp); 3400 nfs4_put_lock_state(data->lsp);
3403 put_nfs_open_context(data->ctx); 3401 put_nfs_open_context(data->ctx);
3404 kfree(data); 3402 kfree(data);
3405 dprintk("%s: done!\n", __FUNCTION__); 3403 dprintk("%s: done!\n", __func__);
3406} 3404}
3407 3405
3408static const struct rpc_call_ops nfs4_lock_ops = { 3406static const struct rpc_call_ops nfs4_lock_ops = {
@@ -3428,7 +3426,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3428 }; 3426 };
3429 int ret; 3427 int ret;
3430 3428
3431 dprintk("%s: begin!\n", __FUNCTION__); 3429 dprintk("%s: begin!\n", __func__);
3432 data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file), 3430 data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file),
3433 fl->fl_u.nfs4_fl.owner); 3431 fl->fl_u.nfs4_fl.owner);
3434 if (data == NULL) 3432 if (data == NULL)
@@ -3451,7 +3449,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3451 } else 3449 } else
3452 data->cancelled = 1; 3450 data->cancelled = 1;
3453 rpc_put_task(task); 3451 rpc_put_task(task);
3454 dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret); 3452 dprintk("%s: done, ret = %d!\n", __func__, ret);
3455 return ret; 3453 return ret;
3456} 3454}
3457 3455
@@ -3527,7 +3525,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
3527 /* Note: we always want to sleep here! */ 3525 /* Note: we always want to sleep here! */
3528 request->fl_flags = fl_flags | FL_SLEEP; 3526 request->fl_flags = fl_flags | FL_SLEEP;
3529 if (do_vfs_lock(request->fl_file, request) < 0) 3527 if (do_vfs_lock(request->fl_file, request) < 0)
3530 printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __FUNCTION__); 3528 printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __func__);
3531out_unlock: 3529out_unlock:
3532 up_read(&clp->cl_sem); 3530 up_read(&clp->cl_sem);
3533out: 3531out:
@@ -3665,12 +3663,12 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
3665 }; 3663 };
3666 int status; 3664 int status;
3667 3665
3668 dprintk("%s: start\n", __FUNCTION__); 3666 dprintk("%s: start\n", __func__);
3669 nfs_fattr_init(&fs_locations->fattr); 3667 nfs_fattr_init(&fs_locations->fattr);
3670 fs_locations->server = server; 3668 fs_locations->server = server;
3671 fs_locations->nlocations = 0; 3669 fs_locations->nlocations = 0;
3672 status = rpc_call_sync(server->client, &msg, 0); 3670 status = rpc_call_sync(server->client, &msg, 0);
3673 dprintk("%s: returned status = %d\n", __FUNCTION__, status); 3671 dprintk("%s: returned status = %d\n", __func__, status);
3674 return status; 3672 return status;
3675} 3673}
3676 3674
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 5e2e4af1a0e6..3305acbbe2ae 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -66,7 +66,7 @@ nfs4_renew_state(struct work_struct *work)
66 unsigned long last, now; 66 unsigned long last, now;
67 67
68 down_read(&clp->cl_sem); 68 down_read(&clp->cl_sem);
69 dprintk("%s: start\n", __FUNCTION__); 69 dprintk("%s: start\n", __func__);
70 /* Are there any active superblocks? */ 70 /* Are there any active superblocks? */
71 if (list_empty(&clp->cl_superblocks)) 71 if (list_empty(&clp->cl_superblocks))
72 goto out; 72 goto out;
@@ -92,17 +92,17 @@ nfs4_renew_state(struct work_struct *work)
92 spin_lock(&clp->cl_lock); 92 spin_lock(&clp->cl_lock);
93 } else 93 } else
94 dprintk("%s: failed to call renewd. Reason: lease not expired \n", 94 dprintk("%s: failed to call renewd. Reason: lease not expired \n",
95 __FUNCTION__); 95 __func__);
96 if (timeout < 5 * HZ) /* safeguard */ 96 if (timeout < 5 * HZ) /* safeguard */
97 timeout = 5 * HZ; 97 timeout = 5 * HZ;
98 dprintk("%s: requeueing work. Lease period = %ld\n", 98 dprintk("%s: requeueing work. Lease period = %ld\n",
99 __FUNCTION__, (timeout + HZ - 1) / HZ); 99 __func__, (timeout + HZ - 1) / HZ);
100 cancel_delayed_work(&clp->cl_renewd); 100 cancel_delayed_work(&clp->cl_renewd);
101 schedule_delayed_work(&clp->cl_renewd, timeout); 101 schedule_delayed_work(&clp->cl_renewd, timeout);
102 spin_unlock(&clp->cl_lock); 102 spin_unlock(&clp->cl_lock);
103out: 103out:
104 up_read(&clp->cl_sem); 104 up_read(&clp->cl_sem);
105 dprintk("%s: done\n", __FUNCTION__); 105 dprintk("%s: done\n", __func__);
106} 106}
107 107
108/* Must be called with clp->cl_sem locked for writes */ 108/* Must be called with clp->cl_sem locked for writes */
@@ -117,7 +117,7 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
117 if (timeout < 5 * HZ) 117 if (timeout < 5 * HZ)
118 timeout = 5 * HZ; 118 timeout = 5 * HZ;
119 dprintk("%s: requeueing work. Lease period = %ld\n", 119 dprintk("%s: requeueing work. Lease period = %ld\n",
120 __FUNCTION__, (timeout + HZ - 1) / HZ); 120 __func__, (timeout + HZ - 1) / HZ);
121 cancel_delayed_work(&clp->cl_renewd); 121 cancel_delayed_work(&clp->cl_renewd);
122 schedule_delayed_work(&clp->cl_renewd, timeout); 122 schedule_delayed_work(&clp->cl_renewd, timeout);
123 set_bit(NFS_CS_RENEWD, &clp->cl_res_state); 123 set_bit(NFS_CS_RENEWD, &clp->cl_res_state);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 46eb624e4f16..856a8934f610 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -282,7 +282,7 @@ nfs4_alloc_state_owner(void)
282 return sp; 282 return sp;
283} 283}
284 284
285void 285static void
286nfs4_drop_state_owner(struct nfs4_state_owner *sp) 286nfs4_drop_state_owner(struct nfs4_state_owner *sp)
287{ 287{
288 if (!RB_EMPTY_NODE(&sp->so_client_node)) { 288 if (!RB_EMPTY_NODE(&sp->so_client_node)) {
@@ -828,7 +828,7 @@ static int nfs4_reclaim_locks(struct nfs4_state_recovery_ops *ops, struct nfs4_s
828 switch (status) { 828 switch (status) {
829 default: 829 default:
830 printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", 830 printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n",
831 __FUNCTION__, status); 831 __func__, status);
832 case -NFS4ERR_EXPIRED: 832 case -NFS4ERR_EXPIRED:
833 case -NFS4ERR_NO_GRACE: 833 case -NFS4ERR_NO_GRACE:
834 case -NFS4ERR_RECLAIM_BAD: 834 case -NFS4ERR_RECLAIM_BAD:
@@ -869,14 +869,14 @@ static int nfs4_reclaim_open_state(struct nfs4_state_recovery_ops *ops, struct n
869 list_for_each_entry(lock, &state->lock_states, ls_locks) { 869 list_for_each_entry(lock, &state->lock_states, ls_locks) {
870 if (!(lock->ls_flags & NFS_LOCK_INITIALIZED)) 870 if (!(lock->ls_flags & NFS_LOCK_INITIALIZED))
871 printk("%s: Lock reclaim failed!\n", 871 printk("%s: Lock reclaim failed!\n",
872 __FUNCTION__); 872 __func__);
873 } 873 }
874 continue; 874 continue;
875 } 875 }
876 switch (status) { 876 switch (status) {
877 default: 877 default:
878 printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", 878 printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n",
879 __FUNCTION__, status); 879 __func__, status);
880 case -ENOENT: 880 case -ENOENT:
881 case -NFS4ERR_RECLAIM_BAD: 881 case -NFS4ERR_RECLAIM_BAD:
882 case -NFS4ERR_RECLAIM_CONFLICT: 882 case -NFS4ERR_RECLAIM_CONFLICT:
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 5a2d64927b35..b916297d2334 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1831,7 +1831,7 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
1831 xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, 1831 xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
1832 args->pgbase, args->count); 1832 args->pgbase, args->count);
1833 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n", 1833 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
1834 __FUNCTION__, replen, args->pages, 1834 __func__, replen, args->pages,
1835 args->pgbase, args->count); 1835 args->pgbase, args->count);
1836 1836
1837out: 1837out:
@@ -2192,9 +2192,9 @@ out:
2192 p = xdr_inline_decode(xdr, nbytes); \ 2192 p = xdr_inline_decode(xdr, nbytes); \
2193 if (unlikely(!p)) { \ 2193 if (unlikely(!p)) { \
2194 dprintk("nfs: %s: prematurely hit end of receive" \ 2194 dprintk("nfs: %s: prematurely hit end of receive" \
2195 " buffer\n", __FUNCTION__); \ 2195 " buffer\n", __func__); \
2196 dprintk("nfs: %s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \ 2196 dprintk("nfs: %s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \
2197 __FUNCTION__, xdr->p, nbytes, xdr->end); \ 2197 __func__, xdr->p, nbytes, xdr->end); \
2198 return -EIO; \ 2198 return -EIO; \
2199 } \ 2199 } \
2200} while (0) 2200} while (0)
@@ -2306,12 +2306,12 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2306 READ_BUF(4); 2306 READ_BUF(4);
2307 READ32(*type); 2307 READ32(*type);
2308 if (*type < NF4REG || *type > NF4NAMEDATTR) { 2308 if (*type < NF4REG || *type > NF4NAMEDATTR) {
2309 dprintk("%s: bad type %d\n", __FUNCTION__, *type); 2309 dprintk("%s: bad type %d\n", __func__, *type);
2310 return -EIO; 2310 return -EIO;
2311 } 2311 }
2312 bitmap[0] &= ~FATTR4_WORD0_TYPE; 2312 bitmap[0] &= ~FATTR4_WORD0_TYPE;
2313 } 2313 }
2314 dprintk("%s: type=0%o\n", __FUNCTION__, nfs_type2fmt[*type].nfs2type); 2314 dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type].nfs2type);
2315 return 0; 2315 return 0;
2316} 2316}
2317 2317
@@ -2327,7 +2327,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
2327 READ64(*change); 2327 READ64(*change);
2328 bitmap[0] &= ~FATTR4_WORD0_CHANGE; 2328 bitmap[0] &= ~FATTR4_WORD0_CHANGE;
2329 } 2329 }
2330 dprintk("%s: change attribute=%Lu\n", __FUNCTION__, 2330 dprintk("%s: change attribute=%Lu\n", __func__,
2331 (unsigned long long)*change); 2331 (unsigned long long)*change);
2332 return 0; 2332 return 0;
2333} 2333}
@@ -2344,7 +2344,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *
2344 READ64(*size); 2344 READ64(*size);
2345 bitmap[0] &= ~FATTR4_WORD0_SIZE; 2345 bitmap[0] &= ~FATTR4_WORD0_SIZE;
2346 } 2346 }
2347 dprintk("%s: file size=%Lu\n", __FUNCTION__, (unsigned long long)*size); 2347 dprintk("%s: file size=%Lu\n", __func__, (unsigned long long)*size);
2348 return 0; 2348 return 0;
2349} 2349}
2350 2350
@@ -2360,7 +2360,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui
2360 READ32(*res); 2360 READ32(*res);
2361 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; 2361 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT;
2362 } 2362 }
2363 dprintk("%s: link support=%s\n", __FUNCTION__, *res == 0 ? "false" : "true"); 2363 dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true");
2364 return 0; 2364 return 0;
2365} 2365}
2366 2366
@@ -2376,7 +2376,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
2376 READ32(*res); 2376 READ32(*res);
2377 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; 2377 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT;
2378 } 2378 }
2379 dprintk("%s: symlink support=%s\n", __FUNCTION__, *res == 0 ? "false" : "true"); 2379 dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true");
2380 return 0; 2380 return 0;
2381} 2381}
2382 2382
@@ -2394,7 +2394,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs
2394 READ64(fsid->minor); 2394 READ64(fsid->minor);
2395 bitmap[0] &= ~FATTR4_WORD0_FSID; 2395 bitmap[0] &= ~FATTR4_WORD0_FSID;
2396 } 2396 }
2397 dprintk("%s: fsid=(0x%Lx/0x%Lx)\n", __FUNCTION__, 2397 dprintk("%s: fsid=(0x%Lx/0x%Lx)\n", __func__,
2398 (unsigned long long)fsid->major, 2398 (unsigned long long)fsid->major,
2399 (unsigned long long)fsid->minor); 2399 (unsigned long long)fsid->minor);
2400 return 0; 2400 return 0;
@@ -2412,7 +2412,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint
2412 READ32(*res); 2412 READ32(*res);
2413 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; 2413 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME;
2414 } 2414 }
2415 dprintk("%s: file size=%u\n", __FUNCTION__, (unsigned int)*res); 2415 dprintk("%s: file size=%u\n", __func__, (unsigned int)*res);
2416 return 0; 2416 return 0;
2417} 2417}
2418 2418
@@ -2428,7 +2428,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint
2428 READ32(*res); 2428 READ32(*res);
2429 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; 2429 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT;
2430 } 2430 }
2431 dprintk("%s: ACLs supported=%u\n", __FUNCTION__, (unsigned int)*res); 2431 dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res);
2432 return 0; 2432 return 0;
2433} 2433}
2434 2434
@@ -2444,7 +2444,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
2444 READ64(*fileid); 2444 READ64(*fileid);
2445 bitmap[0] &= ~FATTR4_WORD0_FILEID; 2445 bitmap[0] &= ~FATTR4_WORD0_FILEID;
2446 } 2446 }
2447 dprintk("%s: fileid=%Lu\n", __FUNCTION__, (unsigned long long)*fileid); 2447 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid);
2448 return 0; 2448 return 0;
2449} 2449}
2450 2450
@@ -2460,7 +2460,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma
2460 READ64(*fileid); 2460 READ64(*fileid);
2461 bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; 2461 bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
2462 } 2462 }
2463 dprintk("%s: fileid=%Lu\n", __FUNCTION__, (unsigned long long)*fileid); 2463 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid);
2464 return 0; 2464 return 0;
2465} 2465}
2466 2466
@@ -2477,7 +2477,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
2477 READ64(*res); 2477 READ64(*res);
2478 bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; 2478 bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL;
2479 } 2479 }
2480 dprintk("%s: files avail=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2480 dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res);
2481 return status; 2481 return status;
2482} 2482}
2483 2483
@@ -2494,7 +2494,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
2494 READ64(*res); 2494 READ64(*res);
2495 bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; 2495 bitmap[0] &= ~FATTR4_WORD0_FILES_FREE;
2496 } 2496 }
2497 dprintk("%s: files free=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2497 dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res);
2498 return status; 2498 return status;
2499} 2499}
2500 2500
@@ -2511,7 +2511,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2511 READ64(*res); 2511 READ64(*res);
2512 bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; 2512 bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL;
2513 } 2513 }
2514 dprintk("%s: files total=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2514 dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res);
2515 return status; 2515 return status;
2516} 2516}
2517 2517
@@ -2569,7 +2569,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2569 status = 0; 2569 status = 0;
2570 if (unlikely(!(bitmap[0] & FATTR4_WORD0_FS_LOCATIONS))) 2570 if (unlikely(!(bitmap[0] & FATTR4_WORD0_FS_LOCATIONS)))
2571 goto out; 2571 goto out;
2572 dprintk("%s: fsroot ", __FUNCTION__); 2572 dprintk("%s: fsroot ", __func__);
2573 status = decode_pathname(xdr, &res->fs_path); 2573 status = decode_pathname(xdr, &res->fs_path);
2574 if (unlikely(status != 0)) 2574 if (unlikely(status != 0))
2575 goto out; 2575 goto out;
@@ -2586,7 +2586,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2586 READ32(m); 2586 READ32(m);
2587 2587
2588 loc->nservers = 0; 2588 loc->nservers = 0;
2589 dprintk("%s: servers ", __FUNCTION__); 2589 dprintk("%s: servers ", __func__);
2590 while (loc->nservers < m) { 2590 while (loc->nservers < m) {
2591 struct nfs4_string *server = &loc->servers[loc->nservers]; 2591 struct nfs4_string *server = &loc->servers[loc->nservers];
2592 status = decode_opaque_inline(xdr, &server->len, &server->data); 2592 status = decode_opaque_inline(xdr, &server->len, &server->data);
@@ -2599,7 +2599,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2599 unsigned int i; 2599 unsigned int i;
2600 dprintk("%s: using first %u of %u servers " 2600 dprintk("%s: using first %u of %u servers "
2601 "returned for location %u\n", 2601 "returned for location %u\n",
2602 __FUNCTION__, 2602 __func__,
2603 NFS4_FS_LOCATION_MAXSERVERS, 2603 NFS4_FS_LOCATION_MAXSERVERS,
2604 m, res->nlocations); 2604 m, res->nlocations);
2605 for (i = loc->nservers; i < m; i++) { 2605 for (i = loc->nservers; i < m; i++) {
@@ -2618,7 +2618,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2618 res->nlocations++; 2618 res->nlocations++;
2619 } 2619 }
2620out: 2620out:
2621 dprintk("%s: fs_locations done, error = %d\n", __FUNCTION__, status); 2621 dprintk("%s: fs_locations done, error = %d\n", __func__, status);
2622 return status; 2622 return status;
2623out_eio: 2623out_eio:
2624 status = -EIO; 2624 status = -EIO;
@@ -2638,7 +2638,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin
2638 READ64(*res); 2638 READ64(*res);
2639 bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; 2639 bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE;
2640 } 2640 }
2641 dprintk("%s: maxfilesize=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2641 dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res);
2642 return status; 2642 return status;
2643} 2643}
2644 2644
@@ -2655,7 +2655,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2655 READ32(*maxlink); 2655 READ32(*maxlink);
2656 bitmap[0] &= ~FATTR4_WORD0_MAXLINK; 2656 bitmap[0] &= ~FATTR4_WORD0_MAXLINK;
2657 } 2657 }
2658 dprintk("%s: maxlink=%u\n", __FUNCTION__, *maxlink); 2658 dprintk("%s: maxlink=%u\n", __func__, *maxlink);
2659 return status; 2659 return status;
2660} 2660}
2661 2661
@@ -2672,7 +2672,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2672 READ32(*maxname); 2672 READ32(*maxname);
2673 bitmap[0] &= ~FATTR4_WORD0_MAXNAME; 2673 bitmap[0] &= ~FATTR4_WORD0_MAXNAME;
2674 } 2674 }
2675 dprintk("%s: maxname=%u\n", __FUNCTION__, *maxname); 2675 dprintk("%s: maxname=%u\n", __func__, *maxname);
2676 return status; 2676 return status;
2677} 2677}
2678 2678
@@ -2693,7 +2693,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2693 *res = (uint32_t)maxread; 2693 *res = (uint32_t)maxread;
2694 bitmap[0] &= ~FATTR4_WORD0_MAXREAD; 2694 bitmap[0] &= ~FATTR4_WORD0_MAXREAD;
2695 } 2695 }
2696 dprintk("%s: maxread=%lu\n", __FUNCTION__, (unsigned long)*res); 2696 dprintk("%s: maxread=%lu\n", __func__, (unsigned long)*res);
2697 return status; 2697 return status;
2698} 2698}
2699 2699
@@ -2714,7 +2714,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32
2714 *res = (uint32_t)maxwrite; 2714 *res = (uint32_t)maxwrite;
2715 bitmap[0] &= ~FATTR4_WORD0_MAXWRITE; 2715 bitmap[0] &= ~FATTR4_WORD0_MAXWRITE;
2716 } 2716 }
2717 dprintk("%s: maxwrite=%lu\n", __FUNCTION__, (unsigned long)*res); 2717 dprintk("%s: maxwrite=%lu\n", __func__, (unsigned long)*res);
2718 return status; 2718 return status;
2719} 2719}
2720 2720
@@ -2731,7 +2731,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2731 *mode &= ~S_IFMT; 2731 *mode &= ~S_IFMT;
2732 bitmap[1] &= ~FATTR4_WORD1_MODE; 2732 bitmap[1] &= ~FATTR4_WORD1_MODE;
2733 } 2733 }
2734 dprintk("%s: file mode=0%o\n", __FUNCTION__, (unsigned int)*mode); 2734 dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode);
2735 return 0; 2735 return 0;
2736} 2736}
2737 2737
@@ -2747,7 +2747,7 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t
2747 READ32(*nlink); 2747 READ32(*nlink);
2748 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; 2748 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS;
2749 } 2749 }
2750 dprintk("%s: nlink=%u\n", __FUNCTION__, (unsigned int)*nlink); 2750 dprintk("%s: nlink=%u\n", __func__, (unsigned int)*nlink);
2751 return 0; 2751 return 0;
2752} 2752}
2753 2753
@@ -2766,13 +2766,13 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
2766 if (len < XDR_MAX_NETOBJ) { 2766 if (len < XDR_MAX_NETOBJ) {
2767 if (nfs_map_name_to_uid(clp, (char *)p, len, uid) != 0) 2767 if (nfs_map_name_to_uid(clp, (char *)p, len, uid) != 0)
2768 dprintk("%s: nfs_map_name_to_uid failed!\n", 2768 dprintk("%s: nfs_map_name_to_uid failed!\n",
2769 __FUNCTION__); 2769 __func__);
2770 } else 2770 } else
2771 dprintk("%s: name too long (%u)!\n", 2771 dprintk("%s: name too long (%u)!\n",
2772 __FUNCTION__, len); 2772 __func__, len);
2773 bitmap[1] &= ~FATTR4_WORD1_OWNER; 2773 bitmap[1] &= ~FATTR4_WORD1_OWNER;
2774 } 2774 }
2775 dprintk("%s: uid=%d\n", __FUNCTION__, (int)*uid); 2775 dprintk("%s: uid=%d\n", __func__, (int)*uid);
2776 return 0; 2776 return 0;
2777} 2777}
2778 2778
@@ -2791,13 +2791,13 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
2791 if (len < XDR_MAX_NETOBJ) { 2791 if (len < XDR_MAX_NETOBJ) {
2792 if (nfs_map_group_to_gid(clp, (char *)p, len, gid) != 0) 2792 if (nfs_map_group_to_gid(clp, (char *)p, len, gid) != 0)
2793 dprintk("%s: nfs_map_group_to_gid failed!\n", 2793 dprintk("%s: nfs_map_group_to_gid failed!\n",
2794 __FUNCTION__); 2794 __func__);
2795 } else 2795 } else
2796 dprintk("%s: name too long (%u)!\n", 2796 dprintk("%s: name too long (%u)!\n",
2797 __FUNCTION__, len); 2797 __func__, len);
2798 bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP; 2798 bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP;
2799 } 2799 }
2800 dprintk("%s: gid=%d\n", __FUNCTION__, (int)*gid); 2800 dprintk("%s: gid=%d\n", __func__, (int)*gid);
2801 return 0; 2801 return 0;
2802} 2802}
2803 2803
@@ -2820,7 +2820,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
2820 *rdev = tmp; 2820 *rdev = tmp;
2821 bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; 2821 bitmap[1] &= ~ FATTR4_WORD1_RAWDEV;
2822 } 2822 }
2823 dprintk("%s: rdev=(0x%x:0x%x)\n", __FUNCTION__, major, minor); 2823 dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor);
2824 return 0; 2824 return 0;
2825} 2825}
2826 2826
@@ -2837,7 +2837,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
2837 READ64(*res); 2837 READ64(*res);
2838 bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; 2838 bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL;
2839 } 2839 }
2840 dprintk("%s: space avail=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2840 dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res);
2841 return status; 2841 return status;
2842} 2842}
2843 2843
@@ -2854,7 +2854,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
2854 READ64(*res); 2854 READ64(*res);
2855 bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; 2855 bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE;
2856 } 2856 }
2857 dprintk("%s: space free=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2857 dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res);
2858 return status; 2858 return status;
2859} 2859}
2860 2860
@@ -2871,7 +2871,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2871 READ64(*res); 2871 READ64(*res);
2872 bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; 2872 bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL;
2873 } 2873 }
2874 dprintk("%s: space total=%Lu\n", __FUNCTION__, (unsigned long long)*res); 2874 dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res);
2875 return status; 2875 return status;
2876} 2876}
2877 2877
@@ -2887,7 +2887,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint
2887 READ64(*used); 2887 READ64(*used);
2888 bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; 2888 bitmap[1] &= ~FATTR4_WORD1_SPACE_USED;
2889 } 2889 }
2890 dprintk("%s: space used=%Lu\n", __FUNCTION__, 2890 dprintk("%s: space used=%Lu\n", __func__,
2891 (unsigned long long)*used); 2891 (unsigned long long)*used);
2892 return 0; 2892 return 0;
2893} 2893}
@@ -2918,7 +2918,7 @@ static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, str
2918 status = decode_attr_time(xdr, time); 2918 status = decode_attr_time(xdr, time);
2919 bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS; 2919 bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS;
2920 } 2920 }
2921 dprintk("%s: atime=%ld\n", __FUNCTION__, (long)time->tv_sec); 2921 dprintk("%s: atime=%ld\n", __func__, (long)time->tv_sec);
2922 return status; 2922 return status;
2923} 2923}
2924 2924
@@ -2934,7 +2934,7 @@ static int decode_attr_time_metadata(struct xdr_stream *xdr, uint32_t *bitmap, s
2934 status = decode_attr_time(xdr, time); 2934 status = decode_attr_time(xdr, time);
2935 bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; 2935 bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA;
2936 } 2936 }
2937 dprintk("%s: ctime=%ld\n", __FUNCTION__, (long)time->tv_sec); 2937 dprintk("%s: ctime=%ld\n", __func__, (long)time->tv_sec);
2938 return status; 2938 return status;
2939} 2939}
2940 2940
@@ -2950,7 +2950,7 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str
2950 status = decode_attr_time(xdr, time); 2950 status = decode_attr_time(xdr, time);
2951 bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY; 2951 bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY;
2952 } 2952 }
2953 dprintk("%s: mtime=%ld\n", __FUNCTION__, (long)time->tv_sec); 2953 dprintk("%s: mtime=%ld\n", __func__, (long)time->tv_sec);
2954 return status; 2954 return status;
2955} 2955}
2956 2956
@@ -2962,7 +2962,7 @@ static int verify_attr_len(struct xdr_stream *xdr, __be32 *savep, uint32_t attrl
2962 if (unlikely(attrwords != nwords)) { 2962 if (unlikely(attrwords != nwords)) {
2963 dprintk("%s: server returned incorrect attribute length: " 2963 dprintk("%s: server returned incorrect attribute length: "
2964 "%u %c %u\n", 2964 "%u %c %u\n",
2965 __FUNCTION__, 2965 __func__,
2966 attrwords << 2, 2966 attrwords << 2,
2967 (attrwords < nwords) ? '<' : '>', 2967 (attrwords < nwords) ? '<' : '>',
2968 nwords << 2); 2968 nwords << 2);
@@ -3067,7 +3067,7 @@ static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_re
3067 goto xdr_error; 3067 goto xdr_error;
3068 status = verify_attr_len(xdr, savep, attrlen); 3068 status = verify_attr_len(xdr, savep, attrlen);
3069xdr_error: 3069xdr_error:
3070 dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); 3070 dprintk("%s: xdr returned %d!\n", __func__, -status);
3071 return status; 3071 return status;
3072} 3072}
3073 3073
@@ -3100,7 +3100,7 @@ static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat)
3100 3100
3101 status = verify_attr_len(xdr, savep, attrlen); 3101 status = verify_attr_len(xdr, savep, attrlen);
3102xdr_error: 3102xdr_error:
3103 dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); 3103 dprintk("%s: xdr returned %d!\n", __func__, -status);
3104 return status; 3104 return status;
3105} 3105}
3106 3106
@@ -3125,7 +3125,7 @@ static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf
3125 3125
3126 status = verify_attr_len(xdr, savep, attrlen); 3126 status = verify_attr_len(xdr, savep, attrlen);
3127xdr_error: 3127xdr_error:
3128 dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); 3128 dprintk("%s: xdr returned %d!\n", __func__, -status);
3129 return status; 3129 return status;
3130} 3130}
3131 3131
@@ -3193,7 +3193,7 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons
3193 if ((status = verify_attr_len(xdr, savep, attrlen)) == 0) 3193 if ((status = verify_attr_len(xdr, savep, attrlen)) == 0)
3194 fattr->valid = NFS_ATTR_FATTR | NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4; 3194 fattr->valid = NFS_ATTR_FATTR | NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4;
3195xdr_error: 3195xdr_error:
3196 dprintk("%s: xdr returned %d\n", __FUNCTION__, -status); 3196 dprintk("%s: xdr returned %d\n", __func__, -status);
3197 return status; 3197 return status;
3198} 3198}
3199 3199
@@ -3226,7 +3226,7 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
3226 3226
3227 status = verify_attr_len(xdr, savep, attrlen); 3227 status = verify_attr_len(xdr, savep, attrlen);
3228xdr_error: 3228xdr_error:
3229 dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); 3229 dprintk("%s: xdr returned %d!\n", __func__, -status);
3230 return status; 3230 return status;
3231} 3231}
3232 3232
@@ -3418,7 +3418,7 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
3418 3418
3419 return decode_delegation(xdr, res); 3419 return decode_delegation(xdr, res);
3420xdr_error: 3420xdr_error:
3421 dprintk("%s: Bitmap too large! Length = %u\n", __FUNCTION__, bmlen); 3421 dprintk("%s: Bitmap too large! Length = %u\n", __func__, bmlen);
3422 return -EIO; 3422 return -EIO;
3423} 3423}
3424 3424
@@ -3575,7 +3575,7 @@ short_pkt:
3575 * the call was successful, but incomplete. The caller can retry the 3575 * the call was successful, but incomplete. The caller can retry the
3576 * readdir starting at the last cookie. 3576 * readdir starting at the last cookie.
3577 */ 3577 */
3578 dprintk("%s: short packet at entry %d\n", __FUNCTION__, nr); 3578 dprintk("%s: short packet at entry %d\n", __func__, nr);
3579 entry[0] = entry[1] = 0; 3579 entry[0] = entry[1] = 0;
3580 if (nr) 3580 if (nr)
3581 goto out; 3581 goto out;
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 5ccf7faee19c..03599bfe81cf 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -63,17 +63,17 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
63 }; 63 };
64 int status; 64 int status;
65 65
66 dprintk("%s: call getattr\n", __FUNCTION__); 66 dprintk("%s: call getattr\n", __func__);
67 nfs_fattr_init(fattr); 67 nfs_fattr_init(fattr);
68 status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0); 68 status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
69 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); 69 dprintk("%s: reply getattr: %d\n", __func__, status);
70 if (status) 70 if (status)
71 return status; 71 return status;
72 dprintk("%s: call statfs\n", __FUNCTION__); 72 dprintk("%s: call statfs\n", __func__);
73 msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS]; 73 msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS];
74 msg.rpc_resp = &fsinfo; 74 msg.rpc_resp = &fsinfo;
75 status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0); 75 status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
76 dprintk("%s: reply statfs: %d\n", __FUNCTION__, status); 76 dprintk("%s: reply statfs: %d\n", __func__, status);
77 if (status) 77 if (status)
78 return status; 78 return status;
79 info->rtmax = NFS_MAXDATA; 79 info->rtmax = NFS_MAXDATA;
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 16f57e0af999..40d17987d0e8 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -329,7 +329,7 @@ int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data)
329{ 329{
330 int status; 330 int status;
331 331
332 dprintk("NFS: %s: %5u, (status %d)\n", __FUNCTION__, task->tk_pid, 332 dprintk("NFS: %s: %5u, (status %d)\n", __func__, task->tk_pid,
333 task->tk_status); 333 task->tk_status);
334 334
335 status = NFS_PROTO(data->inode)->read_done(task, data); 335 status = NFS_PROTO(data->inode)->read_done(task, data);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 7226a506f3ca..2a4a024a4e7b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -405,7 +405,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
405 return 0; 405 return 0;
406 406
407 out_err: 407 out_err:
408 dprintk("%s: statfs error = %d\n", __FUNCTION__, -error); 408 dprintk("%s: statfs error = %d\n", __func__, -error);
409 unlock_kernel(); 409 unlock_kernel();
410 return error; 410 return error;
411} 411}
@@ -2015,6 +2015,10 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
2015 goto error_splat_super; 2015 goto error_splat_super;
2016 } 2016 }
2017 2017
2018 error = security_sb_set_mnt_opts(s, &data.lsm_opts);
2019 if (error)
2020 goto error_splat_root;
2021
2018 s->s_flags |= MS_ACTIVE; 2022 s->s_flags |= MS_ACTIVE;
2019 mnt->mnt_sb = s; 2023 mnt->mnt_sb = s;
2020 mnt->mnt_root = mntroot; 2024 mnt->mnt_root = mntroot;
@@ -2031,6 +2035,8 @@ out_free:
2031 nfs_free_server(server); 2035 nfs_free_server(server);
2032 goto out; 2036 goto out;
2033 2037
2038error_splat_root:
2039 dput(mntroot);
2034error_splat_super: 2040error_splat_super:
2035 up_write(&s->s_umount); 2041 up_write(&s->s_umount);
2036 deactivate_super(s); 2042 deactivate_super(s);
@@ -2114,6 +2120,8 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2114 mnt->mnt_sb = s; 2120 mnt->mnt_sb = s;
2115 mnt->mnt_root = mntroot; 2121 mnt->mnt_root = mntroot;
2116 2122
2123 security_sb_clone_mnt_opts(data->sb, s);
2124
2117 dprintk("<-- nfs4_xdev_get_sb() = 0\n"); 2125 dprintk("<-- nfs4_xdev_get_sb() = 0\n");
2118 return 0; 2126 return 0;
2119 2127
@@ -2197,6 +2205,8 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
2197 mnt->mnt_sb = s; 2205 mnt->mnt_sb = s;
2198 mnt->mnt_root = mntroot; 2206 mnt->mnt_root = mntroot;
2199 2207
2208 security_sb_clone_mnt_opts(data->sb, s);
2209
2200 dprintk("<-- nfs4_referral_get_sb() = 0\n"); 2210 dprintk("<-- nfs4_referral_get_sb() = 0\n");
2201 return 0; 2211 return 0;
2202 2212
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 1ade11d1ba07..6d8ace3e3259 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -415,7 +415,7 @@ nfs_dirty_request(struct nfs_page *req)
415 415
416 if (page == NULL || test_bit(PG_NEED_COMMIT, &req->wb_flags)) 416 if (page == NULL || test_bit(PG_NEED_COMMIT, &req->wb_flags))
417 return 0; 417 return 0;
418 return !PageWriteback(req->wb_page); 418 return !PageWriteback(page);
419} 419}
420 420
421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 0b3ffa9840c2..4d4760e687c3 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -419,9 +419,9 @@ static int do_probe_callback(void *data)
419out_release_client: 419out_release_client:
420 rpc_shutdown_client(client); 420 rpc_shutdown_client(client);
421out_err: 421out_err:
422 put_nfs4_client(clp);
423 dprintk("NFSD: warning: no callback path to client %.*s\n", 422 dprintk("NFSD: warning: no callback path to client %.*s\n",
424 (int)clp->cl_name.len, clp->cl_name.data); 423 (int)clp->cl_name.len, clp->cl_name.data);
424 put_nfs4_client(clp);
425 return status; 425 return status;
426} 426}
427 427
diff --git a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c
index 9101807dc81a..e2f72ca98037 100644
--- a/fs/ntfs/upcase.c
+++ b/fs/ntfs/upcase.c
@@ -77,11 +77,10 @@ ntfschar *generate_default_upcase(void)
77 uc[i] = cpu_to_le16(i); 77 uc[i] = cpu_to_le16(i);
78 for (r = 0; uc_run_table[r][0]; r++) 78 for (r = 0; uc_run_table[r][0]; r++)
79 for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) 79 for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++)
80 uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) + 80 le16_add_cpu(&uc[i], uc_run_table[r][2]);
81 uc_run_table[r][2]);
82 for (r = 0; uc_dup_table[r][0]; r++) 81 for (r = 0; uc_dup_table[r][0]; r++)
83 for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) 82 for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2)
84 uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); 83 le16_add_cpu(&uc[i + 1], -1);
85 for (r = 0; uc_word_table[r][0]; r++) 84 for (r = 0; uc_word_table[r][0]; r++)
86 uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]); 85 uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]);
87 return uc; 86 return uc;
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 41f84c92094f..10bfb466e068 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -2788,7 +2788,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
2788 BUG_ON(index >= le16_to_cpu(el->l_next_free_rec)); 2788 BUG_ON(index >= le16_to_cpu(el->l_next_free_rec));
2789 left_rec = &el->l_recs[index]; 2789 left_rec = &el->l_recs[index];
2790 2790
2791 if (index == le16_to_cpu(el->l_next_free_rec - 1) && 2791 if (index == le16_to_cpu(el->l_next_free_rec) - 1 &&
2792 le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) { 2792 le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) {
2793 /* we meet with a cross extent block merge. */ 2793 /* we meet with a cross extent block merge. */
2794 ret = ocfs2_get_right_path(inode, left_path, &right_path); 2794 ret = ocfs2_get_right_path(inode, left_path, &right_path);
@@ -2802,7 +2802,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
2802 BUG_ON(next_free <= 0); 2802 BUG_ON(next_free <= 0);
2803 right_rec = &right_el->l_recs[0]; 2803 right_rec = &right_el->l_recs[0];
2804 if (ocfs2_is_empty_extent(right_rec)) { 2804 if (ocfs2_is_empty_extent(right_rec)) {
2805 BUG_ON(le16_to_cpu(next_free) <= 1); 2805 BUG_ON(next_free <= 1);
2806 right_rec = &right_el->l_recs[1]; 2806 right_rec = &right_el->l_recs[1];
2807 } 2807 }
2808 2808
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 1e44ad14881a..a27d61581bd6 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -142,53 +142,43 @@ static void o2net_idle_timer(unsigned long data);
142static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); 142static void o2net_sc_postpone_idle(struct o2net_sock_container *sc);
143static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); 143static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc);
144 144
145static void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype,
146 u32 msgkey, struct task_struct *task, u8 node)
147{
148#ifdef CONFIG_DEBUG_FS 145#ifdef CONFIG_DEBUG_FS
146void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype,
147 u32 msgkey, struct task_struct *task, u8 node)
148{
149 INIT_LIST_HEAD(&nst->st_net_debug_item); 149 INIT_LIST_HEAD(&nst->st_net_debug_item);
150 nst->st_task = task; 150 nst->st_task = task;
151 nst->st_msg_type = msgtype; 151 nst->st_msg_type = msgtype;
152 nst->st_msg_key = msgkey; 152 nst->st_msg_key = msgkey;
153 nst->st_node = node; 153 nst->st_node = node;
154#endif
155} 154}
156 155
157static void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) 156void o2net_set_nst_sock_time(struct o2net_send_tracking *nst)
158{ 157{
159#ifdef CONFIG_DEBUG_FS
160 do_gettimeofday(&nst->st_sock_time); 158 do_gettimeofday(&nst->st_sock_time);
161#endif
162} 159}
163 160
164static void o2net_set_nst_send_time(struct o2net_send_tracking *nst) 161void o2net_set_nst_send_time(struct o2net_send_tracking *nst)
165{ 162{
166#ifdef CONFIG_DEBUG_FS
167 do_gettimeofday(&nst->st_send_time); 163 do_gettimeofday(&nst->st_send_time);
168#endif
169} 164}
170 165
171static void o2net_set_nst_status_time(struct o2net_send_tracking *nst) 166void o2net_set_nst_status_time(struct o2net_send_tracking *nst)
172{ 167{
173#ifdef CONFIG_DEBUG_FS
174 do_gettimeofday(&nst->st_status_time); 168 do_gettimeofday(&nst->st_status_time);
175#endif
176} 169}
177 170
178static void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, 171void o2net_set_nst_sock_container(struct o2net_send_tracking *nst,
179 struct o2net_sock_container *sc) 172 struct o2net_sock_container *sc)
180{ 173{
181#ifdef CONFIG_DEBUG_FS
182 nst->st_sc = sc; 174 nst->st_sc = sc;
183#endif
184} 175}
185 176
186static void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id) 177void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id)
187{ 178{
188#ifdef CONFIG_DEBUG_FS
189 nst->st_id = msg_id; 179 nst->st_id = msg_id;
190#endif
191} 180}
181#endif /* CONFIG_DEBUG_FS */
192 182
193static inline int o2net_reconnect_delay(void) 183static inline int o2net_reconnect_delay(void)
194{ 184{
diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h
index a705d5d19036..fd6179eb26d4 100644
--- a/fs/ocfs2/cluster/tcp.h
+++ b/fs/ocfs2/cluster/tcp.h
@@ -128,23 +128,23 @@ void o2net_debug_del_nst(struct o2net_send_tracking *nst);
128void o2net_debug_add_sc(struct o2net_sock_container *sc); 128void o2net_debug_add_sc(struct o2net_sock_container *sc);
129void o2net_debug_del_sc(struct o2net_sock_container *sc); 129void o2net_debug_del_sc(struct o2net_sock_container *sc);
130#else 130#else
131static int o2net_debugfs_init(void) 131static inline int o2net_debugfs_init(void)
132{ 132{
133 return 0; 133 return 0;
134} 134}
135static void o2net_debugfs_exit(void) 135static inline void o2net_debugfs_exit(void)
136{ 136{
137} 137}
138static void o2net_debug_add_nst(struct o2net_send_tracking *nst) 138static inline void o2net_debug_add_nst(struct o2net_send_tracking *nst)
139{ 139{
140} 140}
141static void o2net_debug_del_nst(struct o2net_send_tracking *nst) 141static inline void o2net_debug_del_nst(struct o2net_send_tracking *nst)
142{ 142{
143} 143}
144static void o2net_debug_add_sc(struct o2net_sock_container *sc) 144static inline void o2net_debug_add_sc(struct o2net_sock_container *sc)
145{ 145{
146} 146}
147static void o2net_debug_del_sc(struct o2net_sock_container *sc) 147static inline void o2net_debug_del_sc(struct o2net_sock_container *sc)
148{ 148{
149} 149}
150#endif /* CONFIG_DEBUG_FS */ 150#endif /* CONFIG_DEBUG_FS */
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h
index 8d58cfe410b1..18307ff81b77 100644
--- a/fs/ocfs2/cluster/tcp_internal.h
+++ b/fs/ocfs2/cluster/tcp_internal.h
@@ -224,10 +224,42 @@ struct o2net_send_tracking {
224 struct timeval st_send_time; 224 struct timeval st_send_time;
225 struct timeval st_status_time; 225 struct timeval st_status_time;
226}; 226};
227
228void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype,
229 u32 msgkey, struct task_struct *task, u8 node);
230void o2net_set_nst_sock_time(struct o2net_send_tracking *nst);
231void o2net_set_nst_send_time(struct o2net_send_tracking *nst);
232void o2net_set_nst_status_time(struct o2net_send_tracking *nst);
233void o2net_set_nst_sock_container(struct o2net_send_tracking *nst,
234 struct o2net_sock_container *sc);
235void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id);
236
227#else 237#else
228struct o2net_send_tracking { 238struct o2net_send_tracking {
229 u32 dummy; 239 u32 dummy;
230}; 240};
241
242static inline void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype,
243 u32 msgkey, struct task_struct *task, u8 node)
244{
245}
246static inline void o2net_set_nst_sock_time(struct o2net_send_tracking *nst)
247{
248}
249static inline void o2net_set_nst_send_time(struct o2net_send_tracking *nst)
250{
251}
252static inline void o2net_set_nst_status_time(struct o2net_send_tracking *nst)
253{
254}
255static inline void o2net_set_nst_sock_container(struct o2net_send_tracking *nst,
256 struct o2net_sock_container *sc)
257{
258}
259static inline void o2net_set_nst_msg_id(struct o2net_send_tracking *nst,
260 u32 msg_id)
261{
262}
231#endif /* CONFIG_DEBUG_FS */ 263#endif /* CONFIG_DEBUG_FS */
232 264
233#endif /* O2CLUSTER_TCP_INTERNAL_H */ 265#endif /* O2CLUSTER_TCP_INTERNAL_H */
diff --git a/fs/ocfs2/dlm/dlmdebug.h b/fs/ocfs2/dlm/dlmdebug.h
index d34a62a3a625..8c686d22f9c7 100644
--- a/fs/ocfs2/dlm/dlmdebug.h
+++ b/fs/ocfs2/dlm/dlmdebug.h
@@ -60,25 +60,25 @@ void dlm_destroy_debugfs_root(void);
60 60
61#else 61#else
62 62
63static int dlm_debug_init(struct dlm_ctxt *dlm) 63static inline int dlm_debug_init(struct dlm_ctxt *dlm)
64{ 64{
65 return 0; 65 return 0;
66} 66}
67static void dlm_debug_shutdown(struct dlm_ctxt *dlm) 67static inline void dlm_debug_shutdown(struct dlm_ctxt *dlm)
68{ 68{
69} 69}
70static int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm) 70static inline int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm)
71{ 71{
72 return 0; 72 return 0;
73} 73}
74static void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm) 74static inline void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm)
75{ 75{
76} 76}
77static int dlm_create_debugfs_root(void) 77static inline int dlm_create_debugfs_root(void)
78{ 78{
79 return 0; 79 return 0;
80} 80}
81static void dlm_destroy_debugfs_root(void) 81static inline void dlm_destroy_debugfs_root(void)
82{ 82{
83} 83}
84 84
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index b503772cd0ec..6b97d11f6bf8 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -61,7 +61,7 @@
61 * negotiated by the client. The client negotiates based on the maximum 61 * negotiated by the client. The client negotiates based on the maximum
62 * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major 62 * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major
63 * number from the "SETV" message must match 63 * number from the "SETV" message must match
64 * user_stack.sp_proto->lp_max_version.pv_major, and the minor number 64 * ocfs2_user_plugin.sp_proto->lp_max_version.pv_major, and the minor number
65 * must be less than or equal to ...->lp_max_version.pv_minor. 65 * must be less than or equal to ...->lp_max_version.pv_minor.
66 * 66 *
67 * Once this information has been set, mounts will be allowed. From this 67 * Once this information has been set, mounts will be allowed. From this
@@ -153,7 +153,7 @@ union ocfs2_control_message {
153 struct ocfs2_control_message_down u_down; 153 struct ocfs2_control_message_down u_down;
154}; 154};
155 155
156static struct ocfs2_stack_plugin user_stack; 156static struct ocfs2_stack_plugin ocfs2_user_plugin;
157 157
158static atomic_t ocfs2_control_opened; 158static atomic_t ocfs2_control_opened;
159static int ocfs2_control_this_node = -1; 159static int ocfs2_control_this_node = -1;
@@ -399,7 +399,7 @@ static int ocfs2_control_do_setversion_msg(struct file *file,
399 char *ptr = NULL; 399 char *ptr = NULL;
400 struct ocfs2_control_private *p = file->private_data; 400 struct ocfs2_control_private *p = file->private_data;
401 struct ocfs2_protocol_version *max = 401 struct ocfs2_protocol_version *max =
402 &user_stack.sp_proto->lp_max_version; 402 &ocfs2_user_plugin.sp_proto->lp_max_version;
403 403
404 if (ocfs2_control_get_handshake_state(file) != 404 if (ocfs2_control_get_handshake_state(file) !=
405 OCFS2_CONTROL_HANDSHAKE_PROTOCOL) 405 OCFS2_CONTROL_HANDSHAKE_PROTOCOL)
@@ -680,7 +680,7 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
680 struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg); 680 struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg);
681 int status = lksb->sb_status; 681 int status = lksb->sb_status;
682 682
683 BUG_ON(user_stack.sp_proto == NULL); 683 BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
684 684
685 /* 685 /*
686 * For now we're punting on the issue of other non-standard errors 686 * For now we're punting on the issue of other non-standard errors
@@ -693,16 +693,16 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
693 */ 693 */
694 694
695 if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) 695 if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL)
696 user_stack.sp_proto->lp_unlock_ast(astarg, 0); 696 ocfs2_user_plugin.sp_proto->lp_unlock_ast(astarg, 0);
697 else 697 else
698 user_stack.sp_proto->lp_lock_ast(astarg); 698 ocfs2_user_plugin.sp_proto->lp_lock_ast(astarg);
699} 699}
700 700
701static void fsdlm_blocking_ast_wrapper(void *astarg, int level) 701static void fsdlm_blocking_ast_wrapper(void *astarg, int level)
702{ 702{
703 BUG_ON(user_stack.sp_proto == NULL); 703 BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
704 704
705 user_stack.sp_proto->lp_blocking_ast(astarg, level); 705 ocfs2_user_plugin.sp_proto->lp_blocking_ast(astarg, level);
706} 706}
707 707
708static int user_dlm_lock(struct ocfs2_cluster_connection *conn, 708static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
@@ -838,7 +838,7 @@ static int user_cluster_this_node(unsigned int *this_node)
838 return 0; 838 return 0;
839} 839}
840 840
841static struct ocfs2_stack_operations user_stack_ops = { 841static struct ocfs2_stack_operations ocfs2_user_plugin_ops = {
842 .connect = user_cluster_connect, 842 .connect = user_cluster_connect,
843 .disconnect = user_cluster_disconnect, 843 .disconnect = user_cluster_disconnect,
844 .this_node = user_cluster_this_node, 844 .this_node = user_cluster_this_node,
@@ -849,20 +849,20 @@ static struct ocfs2_stack_operations user_stack_ops = {
849 .dump_lksb = user_dlm_dump_lksb, 849 .dump_lksb = user_dlm_dump_lksb,
850}; 850};
851 851
852static struct ocfs2_stack_plugin user_stack = { 852static struct ocfs2_stack_plugin ocfs2_user_plugin = {
853 .sp_name = "user", 853 .sp_name = "user",
854 .sp_ops = &user_stack_ops, 854 .sp_ops = &ocfs2_user_plugin_ops,
855 .sp_owner = THIS_MODULE, 855 .sp_owner = THIS_MODULE,
856}; 856};
857 857
858 858
859static int __init user_stack_init(void) 859static int __init ocfs2_user_plugin_init(void)
860{ 860{
861 int rc; 861 int rc;
862 862
863 rc = ocfs2_control_init(); 863 rc = ocfs2_control_init();
864 if (!rc) { 864 if (!rc) {
865 rc = ocfs2_stack_glue_register(&user_stack); 865 rc = ocfs2_stack_glue_register(&ocfs2_user_plugin);
866 if (rc) 866 if (rc)
867 ocfs2_control_exit(); 867 ocfs2_control_exit();
868 } 868 }
@@ -870,14 +870,14 @@ static int __init user_stack_init(void)
870 return rc; 870 return rc;
871} 871}
872 872
873static void __exit user_stack_exit(void) 873static void __exit ocfs2_user_plugin_exit(void)
874{ 874{
875 ocfs2_stack_glue_unregister(&user_stack); 875 ocfs2_stack_glue_unregister(&ocfs2_user_plugin);
876 ocfs2_control_exit(); 876 ocfs2_control_exit();
877} 877}
878 878
879MODULE_AUTHOR("Oracle"); 879MODULE_AUTHOR("Oracle");
880MODULE_DESCRIPTION("ocfs2 driver for userspace cluster stacks"); 880MODULE_DESCRIPTION("ocfs2 driver for userspace cluster stacks");
881MODULE_LICENSE("GPL"); 881MODULE_LICENSE("GPL");
882module_init(user_stack_init); 882module_init(ocfs2_user_plugin_init);
883module_exit(user_stack_exit); 883module_exit(ocfs2_user_plugin_exit);
diff --git a/fs/proc/array.c b/fs/proc/array.c
index dca997a93bff..797d775e0354 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -288,7 +288,7 @@ static void render_cap_t(struct seq_file *m, const char *header,
288 seq_printf(m, "%s", header); 288 seq_printf(m, "%s", header);
289 CAP_FOR_EACH_U32(__capi) { 289 CAP_FOR_EACH_U32(__capi) {
290 seq_printf(m, "%08x", 290 seq_printf(m, "%08x",
291 a->cap[(_LINUX_CAPABILITY_U32S-1) - __capi]); 291 a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
292 } 292 }
293 seq_printf(m, "\n"); 293 seq_printf(m, "\n");
294} 294}
@@ -298,6 +298,7 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
298 render_cap_t(m, "CapInh:\t", &p->cap_inheritable); 298 render_cap_t(m, "CapInh:\t", &p->cap_inheritable);
299 render_cap_t(m, "CapPrm:\t", &p->cap_permitted); 299 render_cap_t(m, "CapPrm:\t", &p->cap_permitted);
300 render_cap_t(m, "CapEff:\t", &p->cap_effective); 300 render_cap_t(m, "CapEff:\t", &p->cap_effective);
301 render_cap_t(m, "CapBnd:\t", &p->cap_bset);
301} 302}
302 303
303static inline void task_context_switch_counts(struct seq_file *m, 304static inline void task_context_switch_counts(struct seq_file *m,
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 808cbdc193d3..3b455371e7ff 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -127,6 +127,25 @@ struct pid_entry {
127 NULL, &proc_single_file_operations, \ 127 NULL, &proc_single_file_operations, \
128 { .proc_show = &proc_##OTYPE } ) 128 { .proc_show = &proc_##OTYPE } )
129 129
130/*
131 * Count the number of hardlinks for the pid_entry table, excluding the .
132 * and .. links.
133 */
134static unsigned int pid_entry_count_dirs(const struct pid_entry *entries,
135 unsigned int n)
136{
137 unsigned int i;
138 unsigned int count;
139
140 count = 0;
141 for (i = 0; i < n; ++i) {
142 if (S_ISDIR(entries[i].mode))
143 ++count;
144 }
145
146 return count;
147}
148
130int maps_protect; 149int maps_protect;
131EXPORT_SYMBOL(maps_protect); 150EXPORT_SYMBOL(maps_protect);
132 151
@@ -2441,7 +2460,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2441 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2460 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
2442#ifdef CONFIG_AUDITSYSCALL 2461#ifdef CONFIG_AUDITSYSCALL
2443 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2462 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
2444 REG("sessionid", S_IRUSR, sessionid), 2463 REG("sessionid", S_IRUGO, sessionid),
2445#endif 2464#endif
2446#ifdef CONFIG_FAULT_INJECTION 2465#ifdef CONFIG_FAULT_INJECTION
2447 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), 2466 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
@@ -2585,10 +2604,9 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
2585 inode->i_op = &proc_tgid_base_inode_operations; 2604 inode->i_op = &proc_tgid_base_inode_operations;
2586 inode->i_fop = &proc_tgid_base_operations; 2605 inode->i_fop = &proc_tgid_base_operations;
2587 inode->i_flags|=S_IMMUTABLE; 2606 inode->i_flags|=S_IMMUTABLE;
2588 inode->i_nlink = 5; 2607
2589#ifdef CONFIG_SECURITY 2608 inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff,
2590 inode->i_nlink += 1; 2609 ARRAY_SIZE(tgid_base_stuff));
2591#endif
2592 2610
2593 dentry->d_op = &pid_dentry_operations; 2611 dentry->d_op = &pid_dentry_operations;
2594 2612
@@ -2816,10 +2834,9 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
2816 inode->i_op = &proc_tid_base_inode_operations; 2834 inode->i_op = &proc_tid_base_inode_operations;
2817 inode->i_fop = &proc_tid_base_operations; 2835 inode->i_fop = &proc_tid_base_operations;
2818 inode->i_flags|=S_IMMUTABLE; 2836 inode->i_flags|=S_IMMUTABLE;
2819 inode->i_nlink = 4; 2837
2820#ifdef CONFIG_SECURITY 2838 inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff,
2821 inode->i_nlink += 1; 2839 ARRAY_SIZE(tid_base_stuff));
2822#endif
2823 2840
2824 dentry->d_op = &pid_dentry_operations; 2841 dentry->d_op = &pid_dentry_operations;
2825 2842
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 6f4e8dc97da1..b08d10017911 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -425,7 +425,8 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
425 } 425 }
426 } 426 }
427 unlock_new_inode(inode); 427 unlock_new_inode(inode);
428 } 428 } else
429 module_put(de->owner);
429 return inode; 430 return inode;
430 431
431out_ino: 432out_ino:
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 74a323d2b850..7e277f2ad466 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -139,7 +139,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
139#define K(x) ((x) << (PAGE_SHIFT - 10)) 139#define K(x) ((x) << (PAGE_SHIFT - 10))
140 si_meminfo(&i); 140 si_meminfo(&i);
141 si_swapinfo(&i); 141 si_swapinfo(&i);
142 committed = atomic_read(&vm_committed_space); 142 committed = atomic_long_read(&vm_committed_space);
143 allowed = ((totalram_pages - hugetlb_total_pages()) 143 allowed = ((totalram_pages - hugetlb_total_pages())
144 * sysctl_overcommit_ratio / 100) + total_swap_pages; 144 * sysctl_overcommit_ratio / 100) + total_swap_pages;
145 145
@@ -716,7 +716,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
716 pfn = src / KPMSIZE; 716 pfn = src / KPMSIZE;
717 count = min_t(size_t, count, (max_pfn * KPMSIZE) - src); 717 count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
718 if (src & KPMMASK || count & KPMMASK) 718 if (src & KPMMASK || count & KPMMASK)
719 return -EIO; 719 return -EINVAL;
720 720
721 while (count > 0) { 721 while (count > 0) {
722 ppage = NULL; 722 ppage = NULL;
@@ -726,7 +726,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
726 if (!ppage) 726 if (!ppage)
727 pcount = 0; 727 pcount = 0;
728 else 728 else
729 pcount = atomic_read(&ppage->_count); 729 pcount = page_mapcount(ppage);
730 730
731 if (put_user(pcount, out++)) { 731 if (put_user(pcount, out++)) {
732 ret = -EFAULT; 732 ret = -EFAULT;
@@ -782,7 +782,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
782 pfn = src / KPMSIZE; 782 pfn = src / KPMSIZE;
783 count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src); 783 count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
784 if (src & KPMMASK || count & KPMMASK) 784 if (src & KPMMASK || count & KPMMASK)
785 return -EIO; 785 return -EINVAL;
786 786
787 while (count > 0) { 787 while (count > 0) {
788 ppage = NULL; 788 ppage = NULL;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 88717c0f941b..ab8ccc9d14ff 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -315,9 +315,9 @@ struct mem_size_stats {
315}; 315};
316 316
317static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 317static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
318 void *private) 318 struct mm_walk *walk)
319{ 319{
320 struct mem_size_stats *mss = private; 320 struct mem_size_stats *mss = walk->private;
321 struct vm_area_struct *vma = mss->vma; 321 struct vm_area_struct *vma = mss->vma;
322 pte_t *pte, ptent; 322 pte_t *pte, ptent;
323 spinlock_t *ptl; 323 spinlock_t *ptl;
@@ -365,19 +365,21 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
365 return 0; 365 return 0;
366} 366}
367 367
368static struct mm_walk smaps_walk = { .pmd_entry = smaps_pte_range };
369
370static int show_smap(struct seq_file *m, void *v) 368static int show_smap(struct seq_file *m, void *v)
371{ 369{
372 struct vm_area_struct *vma = v; 370 struct vm_area_struct *vma = v;
373 struct mem_size_stats mss; 371 struct mem_size_stats mss;
374 int ret; 372 int ret;
373 struct mm_walk smaps_walk = {
374 .pmd_entry = smaps_pte_range,
375 .mm = vma->vm_mm,
376 .private = &mss,
377 };
375 378
376 memset(&mss, 0, sizeof mss); 379 memset(&mss, 0, sizeof mss);
377 mss.vma = vma; 380 mss.vma = vma;
378 if (vma->vm_mm && !is_vm_hugetlb_page(vma)) 381 if (vma->vm_mm && !is_vm_hugetlb_page(vma))
379 walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end, 382 walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk);
380 &smaps_walk, &mss);
381 383
382 ret = show_map(m, v); 384 ret = show_map(m, v);
383 if (ret) 385 if (ret)
@@ -426,9 +428,9 @@ const struct file_operations proc_smaps_operations = {
426}; 428};
427 429
428static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, 430static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
429 unsigned long end, void *private) 431 unsigned long end, struct mm_walk *walk)
430{ 432{
431 struct vm_area_struct *vma = private; 433 struct vm_area_struct *vma = walk->private;
432 pte_t *pte, ptent; 434 pte_t *pte, ptent;
433 spinlock_t *ptl; 435 spinlock_t *ptl;
434 struct page *page; 436 struct page *page;
@@ -452,8 +454,6 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
452 return 0; 454 return 0;
453} 455}
454 456
455static struct mm_walk clear_refs_walk = { .pmd_entry = clear_refs_pte_range };
456
457static ssize_t clear_refs_write(struct file *file, const char __user *buf, 457static ssize_t clear_refs_write(struct file *file, const char __user *buf,
458 size_t count, loff_t *ppos) 458 size_t count, loff_t *ppos)
459{ 459{
@@ -476,11 +476,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
476 return -ESRCH; 476 return -ESRCH;
477 mm = get_task_mm(task); 477 mm = get_task_mm(task);
478 if (mm) { 478 if (mm) {
479 static struct mm_walk clear_refs_walk;
480 memset(&clear_refs_walk, 0, sizeof(clear_refs_walk));
481 clear_refs_walk.pmd_entry = clear_refs_pte_range;
482 clear_refs_walk.mm = mm;
479 down_read(&mm->mmap_sem); 483 down_read(&mm->mmap_sem);
480 for (vma = mm->mmap; vma; vma = vma->vm_next) 484 for (vma = mm->mmap; vma; vma = vma->vm_next) {
485 clear_refs_walk.private = vma;
481 if (!is_vm_hugetlb_page(vma)) 486 if (!is_vm_hugetlb_page(vma))
482 walk_page_range(mm, vma->vm_start, vma->vm_end, 487 walk_page_range(vma->vm_start, vma->vm_end,
483 &clear_refs_walk, vma); 488 &clear_refs_walk);
489 }
484 flush_tlb_mm(mm); 490 flush_tlb_mm(mm);
485 up_read(&mm->mmap_sem); 491 up_read(&mm->mmap_sem);
486 mmput(mm); 492 mmput(mm);
@@ -496,7 +502,7 @@ const struct file_operations proc_clear_refs_operations = {
496}; 502};
497 503
498struct pagemapread { 504struct pagemapread {
499 char __user *out, *end; 505 u64 __user *out, *end;
500}; 506};
501 507
502#define PM_ENTRY_BYTES sizeof(u64) 508#define PM_ENTRY_BYTES sizeof(u64)
@@ -519,28 +525,18 @@ struct pagemapread {
519static int add_to_pagemap(unsigned long addr, u64 pfn, 525static int add_to_pagemap(unsigned long addr, u64 pfn,
520 struct pagemapread *pm) 526 struct pagemapread *pm)
521{ 527{
522 /*
523 * Make sure there's room in the buffer for an
524 * entire entry. Otherwise, only copy part of
525 * the pfn.
526 */
527 if (pm->out + PM_ENTRY_BYTES >= pm->end) {
528 if (copy_to_user(pm->out, &pfn, pm->end - pm->out))
529 return -EFAULT;
530 pm->out = pm->end;
531 return PM_END_OF_BUFFER;
532 }
533
534 if (put_user(pfn, pm->out)) 528 if (put_user(pfn, pm->out))
535 return -EFAULT; 529 return -EFAULT;
536 pm->out += PM_ENTRY_BYTES; 530 pm->out++;
531 if (pm->out >= pm->end)
532 return PM_END_OF_BUFFER;
537 return 0; 533 return 0;
538} 534}
539 535
540static int pagemap_pte_hole(unsigned long start, unsigned long end, 536static int pagemap_pte_hole(unsigned long start, unsigned long end,
541 void *private) 537 struct mm_walk *walk)
542{ 538{
543 struct pagemapread *pm = private; 539 struct pagemapread *pm = walk->private;
544 unsigned long addr; 540 unsigned long addr;
545 int err = 0; 541 int err = 0;
546 for (addr = start; addr < end; addr += PAGE_SIZE) { 542 for (addr = start; addr < end; addr += PAGE_SIZE) {
@@ -557,24 +553,45 @@ static u64 swap_pte_to_pagemap_entry(pte_t pte)
557 return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT); 553 return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT);
558} 554}
559 555
556static unsigned long pte_to_pagemap_entry(pte_t pte)
557{
558 unsigned long pme = 0;
559 if (is_swap_pte(pte))
560 pme = PM_PFRAME(swap_pte_to_pagemap_entry(pte))
561 | PM_PSHIFT(PAGE_SHIFT) | PM_SWAP;
562 else if (pte_present(pte))
563 pme = PM_PFRAME(pte_pfn(pte))
564 | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT;
565 return pme;
566}
567
560static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 568static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
561 void *private) 569 struct mm_walk *walk)
562{ 570{
563 struct pagemapread *pm = private; 571 struct vm_area_struct *vma;
572 struct pagemapread *pm = walk->private;
564 pte_t *pte; 573 pte_t *pte;
565 int err = 0; 574 int err = 0;
566 575
576 /* find the first VMA at or above 'addr' */
577 vma = find_vma(walk->mm, addr);
567 for (; addr != end; addr += PAGE_SIZE) { 578 for (; addr != end; addr += PAGE_SIZE) {
568 u64 pfn = PM_NOT_PRESENT; 579 u64 pfn = PM_NOT_PRESENT;
569 pte = pte_offset_map(pmd, addr); 580
570 if (is_swap_pte(*pte)) 581 /* check to see if we've left 'vma' behind
571 pfn = PM_PFRAME(swap_pte_to_pagemap_entry(*pte)) 582 * and need a new, higher one */
572 | PM_PSHIFT(PAGE_SHIFT) | PM_SWAP; 583 if (vma && (addr >= vma->vm_end))
573 else if (pte_present(*pte)) 584 vma = find_vma(walk->mm, addr);
574 pfn = PM_PFRAME(pte_pfn(*pte)) 585
575 | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT; 586 /* check that 'vma' actually covers this address,
576 /* unmap so we're not in atomic when we copy to userspace */ 587 * and that it isn't a huge page vma */
577 pte_unmap(pte); 588 if (vma && (vma->vm_start <= addr) &&
589 !is_vm_hugetlb_page(vma)) {
590 pte = pte_offset_map(pmd, addr);
591 pfn = pte_to_pagemap_entry(*pte);
592 /* unmap before userspace copy */
593 pte_unmap(pte);
594 }
578 err = add_to_pagemap(addr, pfn, pm); 595 err = add_to_pagemap(addr, pfn, pm);
579 if (err) 596 if (err)
580 return err; 597 return err;
@@ -634,7 +651,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
634 651
635 ret = -EINVAL; 652 ret = -EINVAL;
636 /* file position must be aligned */ 653 /* file position must be aligned */
637 if (*ppos % PM_ENTRY_BYTES) 654 if ((*ppos % PM_ENTRY_BYTES) || (count % PM_ENTRY_BYTES))
638 goto out_task; 655 goto out_task;
639 656
640 ret = 0; 657 ret = 0;
@@ -664,8 +681,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
664 goto out_pages; 681 goto out_pages;
665 } 682 }
666 683
667 pm.out = buf; 684 pm.out = (u64 *)buf;
668 pm.end = buf + count; 685 pm.end = (u64 *)(buf + count);
669 686
670 if (!ptrace_may_attach(task)) { 687 if (!ptrace_may_attach(task)) {
671 ret = -EIO; 688 ret = -EIO;
@@ -685,14 +702,14 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
685 * user buffer is tracked in "pm", and the walk 702 * user buffer is tracked in "pm", and the walk
686 * will stop when we hit the end of the buffer. 703 * will stop when we hit the end of the buffer.
687 */ 704 */
688 ret = walk_page_range(mm, start_vaddr, end_vaddr, 705 ret = walk_page_range(start_vaddr, end_vaddr,
689 &pagemap_walk, &pm); 706 &pagemap_walk);
690 if (ret == PM_END_OF_BUFFER) 707 if (ret == PM_END_OF_BUFFER)
691 ret = 0; 708 ret = 0;
692 /* don't need mmap_sem for these, but this looks cleaner */ 709 /* don't need mmap_sem for these, but this looks cleaner */
693 *ppos += pm.out - buf; 710 *ppos += (char *)pm.out - buf;
694 if (!ret) 711 if (!ret)
695 ret = pm.out - buf; 712 ret = (char *)pm.out - buf;
696 } 713 }
697 714
698out_pages: 715out_pages:
diff --git a/fs/splice.c b/fs/splice.c
index 78150038b584..aa5f6f60b305 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -58,8 +58,8 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe,
58 */ 58 */
59 wait_on_page_writeback(page); 59 wait_on_page_writeback(page);
60 60
61 if (PagePrivate(page)) 61 if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL))
62 try_to_release_page(page, GFP_KERNEL); 62 goto out_unlock;
63 63
64 /* 64 /*
65 * If we succeeded in removing the mapping, set LRU flag 65 * If we succeeded in removing the mapping, set LRU flag
@@ -75,6 +75,7 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe,
75 * Raced with truncate or failed to remove page from current 75 * Raced with truncate or failed to remove page from current
76 * address space, unlock and return failure. 76 * address space, unlock and return failure.
77 */ 77 */
78out_unlock:
78 unlock_page(page); 79 unlock_page(page);
79 return 1; 80 return 1;
80} 81}
@@ -983,7 +984,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
983 984
984 while (len) { 985 while (len) {
985 size_t read_len; 986 size_t read_len;
986 loff_t pos = sd->pos; 987 loff_t pos = sd->pos, prev_pos = pos;
987 988
988 ret = do_splice_to(in, &pos, pipe, len, flags); 989 ret = do_splice_to(in, &pos, pipe, len, flags);
989 if (unlikely(ret <= 0)) 990 if (unlikely(ret <= 0))
@@ -998,15 +999,19 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
998 * could get stuck data in the internal pipe: 999 * could get stuck data in the internal pipe:
999 */ 1000 */
1000 ret = actor(pipe, sd); 1001 ret = actor(pipe, sd);
1001 if (unlikely(ret <= 0)) 1002 if (unlikely(ret <= 0)) {
1003 sd->pos = prev_pos;
1002 goto out_release; 1004 goto out_release;
1005 }
1003 1006
1004 bytes += ret; 1007 bytes += ret;
1005 len -= ret; 1008 len -= ret;
1006 sd->pos = pos; 1009 sd->pos = pos;
1007 1010
1008 if (ret < read_len) 1011 if (ret < read_len) {
1012 sd->pos = prev_pos + ret;
1009 goto out_release; 1013 goto out_release;
1014 }
1010 } 1015 }
1011 1016
1012done: 1017done:
@@ -1072,7 +1077,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
1072 1077
1073 ret = splice_direct_to_actor(in, &sd, direct_splice_actor); 1078 ret = splice_direct_to_actor(in, &sd, direct_splice_actor);
1074 if (ret > 0) 1079 if (ret > 0)
1075 *ppos += ret; 1080 *ppos = sd.pos;
1076 1081
1077 return ret; 1082 return ret;
1078} 1083}
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index a1c3a1fab7f0..8c0e4b92574f 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -419,12 +419,8 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
419 */ 419 */
420int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) 420int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
421{ 421{
422 if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) { 422 if (sysfs_find_dirent(acxt->parent_sd, sd->s_name))
423 printk(KERN_WARNING "sysfs: duplicate filename '%s' "
424 "can not be created\n", sd->s_name);
425 WARN_ON(1);
426 return -EEXIST; 423 return -EEXIST;
427 }
428 424
429 sd->s_parent = sysfs_get(acxt->parent_sd); 425 sd->s_parent = sysfs_get(acxt->parent_sd);
430 426
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
index 244a1aaa940e..11c035168ea6 100644
--- a/fs/ufs/ufs.h
+++ b/fs/ufs/ufs.h
@@ -107,7 +107,6 @@ extern struct inode * ufs_new_inode (struct inode *, int);
107 107
108/* inode.c */ 108/* inode.c */
109extern struct inode *ufs_iget(struct super_block *, unsigned long); 109extern struct inode *ufs_iget(struct super_block *, unsigned long);
110extern void ufs_put_inode (struct inode *);
111extern int ufs_write_inode (struct inode *, int); 110extern int ufs_write_inode (struct inode *, int);
112extern int ufs_sync_inode (struct inode *); 111extern int ufs_sync_inode (struct inode *);
113extern void ufs_delete_inode (struct inode *); 112extern void ufs_delete_inode (struct inode *);
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 5105015a75ad..98e0e86093b4 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -387,6 +387,8 @@ _xfs_buf_lookup_pages(
387 if (unlikely(page == NULL)) { 387 if (unlikely(page == NULL)) {
388 if (flags & XBF_READ_AHEAD) { 388 if (flags & XBF_READ_AHEAD) {
389 bp->b_page_count = i; 389 bp->b_page_count = i;
390 for (i = 0; i < bp->b_page_count; i++)
391 unlock_page(bp->b_pages[i]);
390 return -ENOMEM; 392 return -ENOMEM;
391 } 393 }
392 394
@@ -416,17 +418,24 @@ _xfs_buf_lookup_pages(
416 ASSERT(!PagePrivate(page)); 418 ASSERT(!PagePrivate(page));
417 if (!PageUptodate(page)) { 419 if (!PageUptodate(page)) {
418 page_count--; 420 page_count--;
419 if (blocksize < PAGE_CACHE_SIZE && !PagePrivate(page)) { 421 if (blocksize >= PAGE_CACHE_SIZE) {
422 if (flags & XBF_READ)
423 bp->b_flags |= _XBF_PAGE_LOCKED;
424 } else if (!PagePrivate(page)) {
420 if (test_page_region(page, offset, nbytes)) 425 if (test_page_region(page, offset, nbytes))
421 page_count++; 426 page_count++;
422 } 427 }
423 } 428 }
424 429
425 unlock_page(page);
426 bp->b_pages[i] = page; 430 bp->b_pages[i] = page;
427 offset = 0; 431 offset = 0;
428 } 432 }
429 433
434 if (!(bp->b_flags & _XBF_PAGE_LOCKED)) {
435 for (i = 0; i < bp->b_page_count; i++)
436 unlock_page(bp->b_pages[i]);
437 }
438
430 if (page_count == bp->b_page_count) 439 if (page_count == bp->b_page_count)
431 bp->b_flags |= XBF_DONE; 440 bp->b_flags |= XBF_DONE;
432 441
@@ -746,6 +755,7 @@ xfs_buf_associate_memory(
746 bp->b_count_desired = len; 755 bp->b_count_desired = len;
747 bp->b_buffer_length = buflen; 756 bp->b_buffer_length = buflen;
748 bp->b_flags |= XBF_MAPPED; 757 bp->b_flags |= XBF_MAPPED;
758 bp->b_flags &= ~_XBF_PAGE_LOCKED;
749 759
750 return 0; 760 return 0;
751} 761}
@@ -1093,8 +1103,10 @@ _xfs_buf_ioend(
1093 xfs_buf_t *bp, 1103 xfs_buf_t *bp,
1094 int schedule) 1104 int schedule)
1095{ 1105{
1096 if (atomic_dec_and_test(&bp->b_io_remaining) == 1) 1106 if (atomic_dec_and_test(&bp->b_io_remaining) == 1) {
1107 bp->b_flags &= ~_XBF_PAGE_LOCKED;
1097 xfs_buf_ioend(bp, schedule); 1108 xfs_buf_ioend(bp, schedule);
1109 }
1098} 1110}
1099 1111
1100STATIC void 1112STATIC void
@@ -1125,6 +1137,9 @@ xfs_buf_bio_end_io(
1125 1137
1126 if (--bvec >= bio->bi_io_vec) 1138 if (--bvec >= bio->bi_io_vec)
1127 prefetchw(&bvec->bv_page->flags); 1139 prefetchw(&bvec->bv_page->flags);
1140
1141 if (bp->b_flags & _XBF_PAGE_LOCKED)
1142 unlock_page(page);
1128 } while (bvec >= bio->bi_io_vec); 1143 } while (bvec >= bio->bi_io_vec);
1129 1144
1130 _xfs_buf_ioend(bp, 1); 1145 _xfs_buf_ioend(bp, 1);
@@ -1163,7 +1178,8 @@ _xfs_buf_ioapply(
1163 * filesystem block size is not smaller than the page size. 1178 * filesystem block size is not smaller than the page size.
1164 */ 1179 */
1165 if ((bp->b_buffer_length < PAGE_CACHE_SIZE) && 1180 if ((bp->b_buffer_length < PAGE_CACHE_SIZE) &&
1166 (bp->b_flags & XBF_READ) && 1181 ((bp->b_flags & (XBF_READ|_XBF_PAGE_LOCKED)) ==
1182 (XBF_READ|_XBF_PAGE_LOCKED)) &&
1167 (blocksize >= PAGE_CACHE_SIZE)) { 1183 (blocksize >= PAGE_CACHE_SIZE)) {
1168 bio = bio_alloc(GFP_NOIO, 1); 1184 bio = bio_alloc(GFP_NOIO, 1);
1169 1185
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 841d7883528d..f948ec7ba9a4 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -66,6 +66,25 @@ typedef enum {
66 _XBF_PAGES = (1 << 18), /* backed by refcounted pages */ 66 _XBF_PAGES = (1 << 18), /* backed by refcounted pages */
67 _XBF_RUN_QUEUES = (1 << 19),/* run block device task queue */ 67 _XBF_RUN_QUEUES = (1 << 19),/* run block device task queue */
68 _XBF_DELWRI_Q = (1 << 21), /* buffer on delwri queue */ 68 _XBF_DELWRI_Q = (1 << 21), /* buffer on delwri queue */
69
70 /*
71 * Special flag for supporting metadata blocks smaller than a FSB.
72 *
73 * In this case we can have multiple xfs_buf_t on a single page and
74 * need to lock out concurrent xfs_buf_t readers as they only
75 * serialise access to the buffer.
76 *
77 * If the FSB size >= PAGE_CACHE_SIZE case, we have no serialisation
78 * between reads of the page. Hence we can have one thread read the
79 * page and modify it, but then race with another thread that thinks
80 * the page is not up-to-date and hence reads it again.
81 *
82 * The result is that the first modifcation to the page is lost.
83 * This sort of AGF/AGI reading race can happen when unlinking inodes
84 * that require truncation and results in the AGI unlinked list
85 * modifications being lost.
86 */
87 _XBF_PAGE_LOCKED = (1 << 22),
69} xfs_buf_flags_t; 88} xfs_buf_flags_t;
70 89
71typedef enum { 90typedef enum {
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 65e78c13d4ae..5f60363b9343 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -184,19 +184,24 @@ xfs_file_release(
184 return -xfs_release(XFS_I(inode)); 184 return -xfs_release(XFS_I(inode));
185} 185}
186 186
187/*
188 * We ignore the datasync flag here because a datasync is effectively
189 * identical to an fsync. That is, datasync implies that we need to write
190 * only the metadata needed to be able to access the data that is written
191 * if we crash after the call completes. Hence if we are writing beyond
192 * EOF we have to log the inode size change as well, which makes it a
193 * full fsync. If we don't write beyond EOF, the inode core will be
194 * clean in memory and so we don't need to log the inode, just like
195 * fsync.
196 */
187STATIC int 197STATIC int
188xfs_file_fsync( 198xfs_file_fsync(
189 struct file *filp, 199 struct file *filp,
190 struct dentry *dentry, 200 struct dentry *dentry,
191 int datasync) 201 int datasync)
192{ 202{
193 int flags = FSYNC_WAIT;
194
195 if (datasync)
196 flags |= FSYNC_DATA;
197 xfs_iflags_clear(XFS_I(dentry->d_inode), XFS_ITRUNCATED); 203 xfs_iflags_clear(XFS_I(dentry->d_inode), XFS_ITRUNCATED);
198 return -xfs_fsync(XFS_I(dentry->d_inode), flags, 204 return -xfs_fsync(XFS_I(dentry->d_inode));
199 (xfs_off_t)0, (xfs_off_t)-1);
200} 205}
201 206
202/* 207/*
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 9d73cb5c0fc7..25eb2a9e8d9b 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -230,14 +230,6 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
230#define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */ 230#define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */
231 231
232/* 232/*
233 * Flags to vop_fsync/reclaim.
234 */
235#define FSYNC_NOWAIT 0 /* asynchronous flush */
236#define FSYNC_WAIT 0x1 /* synchronous fsync or forced reclaim */
237#define FSYNC_INVAL 0x2 /* flush and invalidate cached data */
238#define FSYNC_DATA 0x4 /* synchronous fsync of data only */
239
240/*
241 * Tracking vnode activity. 233 * Tracking vnode activity.
242 */ 234 */
243#if defined(XFS_INODE_TRACE) 235#if defined(XFS_INODE_TRACE)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index cf0bb9c1d621..e569bf5d6cf0 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2974,6 +2974,7 @@ xfs_iflush_cluster(
2974 xfs_mount_t *mp = ip->i_mount; 2974 xfs_mount_t *mp = ip->i_mount;
2975 xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino); 2975 xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino);
2976 unsigned long first_index, mask; 2976 unsigned long first_index, mask;
2977 unsigned long inodes_per_cluster;
2977 int ilist_size; 2978 int ilist_size;
2978 xfs_inode_t **ilist; 2979 xfs_inode_t **ilist;
2979 xfs_inode_t *iq; 2980 xfs_inode_t *iq;
@@ -2985,8 +2986,9 @@ xfs_iflush_cluster(
2985 ASSERT(pag->pagi_inodeok); 2986 ASSERT(pag->pagi_inodeok);
2986 ASSERT(pag->pag_ici_init); 2987 ASSERT(pag->pag_ici_init);
2987 2988
2988 ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *); 2989 inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog;
2989 ilist = kmem_alloc(ilist_size, KM_MAYFAIL); 2990 ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *);
2991 ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS);
2990 if (!ilist) 2992 if (!ilist)
2991 return 0; 2993 return 0;
2992 2994
@@ -2995,8 +2997,7 @@ xfs_iflush_cluster(
2995 read_lock(&pag->pag_ici_lock); 2997 read_lock(&pag->pag_ici_lock);
2996 /* really need a gang lookup range call here */ 2998 /* really need a gang lookup range call here */
2997 nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)ilist, 2999 nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)ilist,
2998 first_index, 3000 first_index, inodes_per_cluster);
2999 XFS_INODE_CLUSTER_SIZE(mp));
3000 if (nr_found == 0) 3001 if (nr_found == 0)
3001 goto out_free; 3002 goto out_free;
3002 3003
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 70702a60b4bb..e475e3717eb3 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -856,18 +856,14 @@ xfs_readlink(
856/* 856/*
857 * xfs_fsync 857 * xfs_fsync
858 * 858 *
859 * This is called to sync the inode and its data out to disk. 859 * This is called to sync the inode and its data out to disk. We need to hold
860 * We need to hold the I/O lock while flushing the data, and 860 * the I/O lock while flushing the data, and the inode lock while flushing the
861 * the inode lock while flushing the inode. The inode lock CANNOT 861 * inode. The inode lock CANNOT be held while flushing the data, so acquire
862 * be held while flushing the data, so acquire after we're done 862 * after we're done with that.
863 * with that.
864 */ 863 */
865int 864int
866xfs_fsync( 865xfs_fsync(
867 xfs_inode_t *ip, 866 xfs_inode_t *ip)
868 int flag,
869 xfs_off_t start,
870 xfs_off_t stop)
871{ 867{
872 xfs_trans_t *tp; 868 xfs_trans_t *tp;
873 int error; 869 int error;
@@ -875,103 +871,79 @@ xfs_fsync(
875 871
876 xfs_itrace_entry(ip); 872 xfs_itrace_entry(ip);
877 873
878 ASSERT(start >= 0 && stop >= -1);
879
880 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) 874 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
881 return XFS_ERROR(EIO); 875 return XFS_ERROR(EIO);
882 876
883 if (flag & FSYNC_DATA) 877 /* capture size updates in I/O completion before writing the inode. */
884 filemap_fdatawait(vn_to_inode(XFS_ITOV(ip))->i_mapping); 878 error = filemap_fdatawait(vn_to_inode(XFS_ITOV(ip))->i_mapping);
879 if (error)
880 return XFS_ERROR(error);
885 881
886 /* 882 /*
887 * We always need to make sure that the required inode state 883 * We always need to make sure that the required inode state is safe on
888 * is safe on disk. The vnode might be clean but because 884 * disk. The vnode might be clean but we still might need to force the
889 * of committed transactions that haven't hit the disk yet. 885 * log because of committed transactions that haven't hit the disk yet.
890 * Likewise, there could be unflushed non-transactional 886 * Likewise, there could be unflushed non-transactional changes to the
891 * changes to the inode core that have to go to disk. 887 * inode core that have to go to disk and this requires us to issue
888 * a synchronous transaction to capture these changes correctly.
892 * 889 *
893 * The following code depends on one assumption: that 890 * This code relies on the assumption that if the update_* fields
894 * any transaction that changes an inode logs the core 891 * of the inode are clear and the inode is unpinned then it is clean
895 * because it has to change some field in the inode core 892 * and no action is required.
896 * (typically nextents or nblocks). That assumption
897 * implies that any transactions against an inode will
898 * catch any non-transactional updates. If inode-altering
899 * transactions exist that violate this assumption, the
900 * code breaks. Right now, it figures that if the involved
901 * update_* field is clear and the inode is unpinned, the
902 * inode is clean. Either it's been flushed or it's been
903 * committed and the commit has hit the disk unpinning the inode.
904 * (Note that xfs_inode_item_format() called at commit clears
905 * the update_* fields.)
906 */ 893 */
907 xfs_ilock(ip, XFS_ILOCK_SHARED); 894 xfs_ilock(ip, XFS_ILOCK_SHARED);
908 895
909 /* If we are flushing data then we care about update_size 896 if (!(ip->i_update_size || ip->i_update_core)) {
910 * being set, otherwise we care about update_core
911 */
912 if ((flag & FSYNC_DATA) ?
913 (ip->i_update_size == 0) :
914 (ip->i_update_core == 0)) {
915 /* 897 /*
916 * Timestamps/size haven't changed since last inode 898 * Timestamps/size haven't changed since last inode flush or
917 * flush or inode transaction commit. That means 899 * inode transaction commit. That means either nothing got
918 * either nothing got written or a transaction 900 * written or a transaction committed which caught the updates.
919 * committed which caught the updates. If the 901 * If the latter happened and the transaction hasn't hit the
920 * latter happened and the transaction hasn't 902 * disk yet, the inode will be still be pinned. If it is,
921 * hit the disk yet, the inode will be still 903 * force the log.
922 * be pinned. If it is, force the log.
923 */ 904 */
924 905
925 xfs_iunlock(ip, XFS_ILOCK_SHARED); 906 xfs_iunlock(ip, XFS_ILOCK_SHARED);
926 907
927 if (xfs_ipincount(ip)) { 908 if (xfs_ipincount(ip)) {
928 _xfs_log_force(ip->i_mount, (xfs_lsn_t)0, 909 error = _xfs_log_force(ip->i_mount, (xfs_lsn_t)0,
929 XFS_LOG_FORCE | 910 XFS_LOG_FORCE | XFS_LOG_SYNC,
930 ((flag & FSYNC_WAIT)
931 ? XFS_LOG_SYNC : 0),
932 &log_flushed); 911 &log_flushed);
933 } else { 912 } else {
934 /* 913 /*
935 * If the inode is not pinned and nothing 914 * If the inode is not pinned and nothing has changed
936 * has changed we don't need to flush the 915 * we don't need to flush the cache.
937 * cache.
938 */ 916 */
939 changed = 0; 917 changed = 0;
940 } 918 }
941 error = 0;
942 } else { 919 } else {
943 /* 920 /*
944 * Kick off a transaction to log the inode 921 * Kick off a transaction to log the inode core to get the
945 * core to get the updates. Make it 922 * updates. The sync transaction will also force the log.
946 * sync if FSYNC_WAIT is passed in (which
947 * is done by everybody but specfs). The
948 * sync transaction will also force the log.
949 */ 923 */
950 xfs_iunlock(ip, XFS_ILOCK_SHARED); 924 xfs_iunlock(ip, XFS_ILOCK_SHARED);
951 tp = xfs_trans_alloc(ip->i_mount, XFS_TRANS_FSYNC_TS); 925 tp = xfs_trans_alloc(ip->i_mount, XFS_TRANS_FSYNC_TS);
952 if ((error = xfs_trans_reserve(tp, 0, 926 error = xfs_trans_reserve(tp, 0,
953 XFS_FSYNC_TS_LOG_RES(ip->i_mount), 927 XFS_FSYNC_TS_LOG_RES(ip->i_mount), 0, 0, 0);
954 0, 0, 0))) { 928 if (error) {
955 xfs_trans_cancel(tp, 0); 929 xfs_trans_cancel(tp, 0);
956 return error; 930 return error;
957 } 931 }
958 xfs_ilock(ip, XFS_ILOCK_EXCL); 932 xfs_ilock(ip, XFS_ILOCK_EXCL);
959 933
960 /* 934 /*
961 * Note - it's possible that we might have pushed 935 * Note - it's possible that we might have pushed ourselves out
962 * ourselves out of the way during trans_reserve 936 * of the way during trans_reserve which would flush the inode.
963 * which would flush the inode. But there's no 937 * But there's no guarantee that the inode buffer has actually
964 * guarantee that the inode buffer has actually 938 * gone out yet (it's delwri). Plus the buffer could be pinned
965 * gone out yet (it's delwri). Plus the buffer 939 * anyway if it's part of an inode in another recent
966 * could be pinned anyway if it's part of an 940 * transaction. So we play it safe and fire off the
967 * inode in another recent transaction. So we 941 * transaction anyway.
968 * play it safe and fire off the transaction anyway.
969 */ 942 */
970 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 943 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
971 xfs_trans_ihold(tp, ip); 944 xfs_trans_ihold(tp, ip);
972 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 945 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
973 if (flag & FSYNC_WAIT) 946 xfs_trans_set_sync(tp);
974 xfs_trans_set_sync(tp);
975 error = _xfs_trans_commit(tp, 0, &log_flushed); 947 error = _xfs_trans_commit(tp, 0, &log_flushed);
976 948
977 xfs_iunlock(ip, XFS_ILOCK_EXCL); 949 xfs_iunlock(ip, XFS_ILOCK_EXCL);
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 8abe8f186e20..57335ba4ce53 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -18,8 +18,7 @@ int xfs_open(struct xfs_inode *ip);
18int xfs_setattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags, 18int xfs_setattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags,
19 struct cred *credp); 19 struct cred *credp);
20int xfs_readlink(struct xfs_inode *ip, char *link); 20int xfs_readlink(struct xfs_inode *ip, char *link);
21int xfs_fsync(struct xfs_inode *ip, int flag, xfs_off_t start, 21int xfs_fsync(struct xfs_inode *ip);
22 xfs_off_t stop);
23int xfs_release(struct xfs_inode *ip); 22int xfs_release(struct xfs_inode *ip);
24int xfs_inactive(struct xfs_inode *ip); 23int xfs_inactive(struct xfs_inode *ip);
25int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, 24int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 06480bcabfdc..06ebb6ef72aa 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -319,6 +319,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
319#endif /* CONFIG_CPU_FREQ */ 319#endif /* CONFIG_CPU_FREQ */
320 320
321/* in processor_throttling.c */ 321/* in processor_throttling.c */
322int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
322int acpi_processor_get_throttling_info(struct acpi_processor *pr); 323int acpi_processor_get_throttling_info(struct acpi_processor *pr);
323extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 324extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
324extern struct file_operations acpi_processor_throttling_fops; 325extern struct file_operations acpi_processor_throttling_fops;
diff --git a/include/asm-alpha/barrier.h b/include/asm-alpha/barrier.h
index 384dc08d6f53..ac78eba909bc 100644
--- a/include/asm-alpha/barrier.h
+++ b/include/asm-alpha/barrier.h
@@ -24,7 +24,7 @@ __asm__ __volatile__("mb": : :"memory")
24#define smp_mb() barrier() 24#define smp_mb() barrier()
25#define smp_rmb() barrier() 25#define smp_rmb() barrier()
26#define smp_wmb() barrier() 26#define smp_wmb() barrier()
27#define smp_read_barrier_depends() barrier() 27#define smp_read_barrier_depends() do { } while (0)
28#endif 28#endif
29 29
30#define set_mb(var, value) \ 30#define set_mb(var, value) \
diff --git a/include/asm-alpha/param.h b/include/asm-alpha/param.h
index 0982f1d39499..e691ecfedb2c 100644
--- a/include/asm-alpha/param.h
+++ b/include/asm-alpha/param.h
@@ -5,8 +5,12 @@
5 hardware ignores reprogramming. We also need userland buy-in to the 5 hardware ignores reprogramming. We also need userland buy-in to the
6 change in HZ, since this is visible in the wait4 resources etc. */ 6 change in HZ, since this is visible in the wait4 resources etc. */
7 7
8#ifdef __KERNEL__
8#define HZ CONFIG_HZ 9#define HZ CONFIG_HZ
9#define USER_HZ HZ 10#define USER_HZ HZ
11#else
12#define HZ 1024
13#endif
10 14
11#define EXEC_PAGESIZE 8192 15#define EXEC_PAGESIZE 8192
12 16
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index 05ce5fba43e3..3f0c59f6d8aa 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -287,17 +287,34 @@ extern inline pte_t pte_mkspecial(pte_t pte) { return pte; }
287#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 287#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
288#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) 288#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
289 289
290/*
291 * The smp_read_barrier_depends() in the following functions are required to
292 * order the load of *dir (the pointer in the top level page table) with any
293 * subsequent load of the returned pmd_t *ret (ret is data dependent on *dir).
294 *
295 * If this ordering is not enforced, the CPU might load an older value of
296 * *ret, which may be uninitialized data. See mm/memory.c:__pte_alloc for
297 * more details.
298 *
299 * Note that we never change the mm->pgd pointer after the task is running, so
300 * pgd_offset does not require such a barrier.
301 */
302
290/* Find an entry in the second-level page table.. */ 303/* Find an entry in the second-level page table.. */
291extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) 304extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
292{ 305{
293 return (pmd_t *) pgd_page_vaddr(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); 306 pmd_t *ret = (pmd_t *) pgd_page_vaddr(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1));
307 smp_read_barrier_depends(); /* see above */
308 return ret;
294} 309}
295 310
296/* Find an entry in the third-level page table.. */ 311/* Find an entry in the third-level page table.. */
297extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) 312extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address)
298{ 313{
299 return (pte_t *) pmd_page_vaddr(*dir) 314 pte_t *ret = (pte_t *) pmd_page_vaddr(*dir)
300 + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); 315 + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1));
316 smp_read_barrier_depends(); /* see above */
317 return ret;
301} 318}
302 319
303#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) 320#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr))
diff --git a/include/asm-arm/arch-at91/io.h b/include/asm-arm/arch-at91/io.h
index 80073fd36b8e..f8beaa228467 100644
--- a/include/asm-arm/arch-at91/io.h
+++ b/include/asm-arm/arch-at91/io.h
@@ -21,8 +21,6 @@
21#ifndef __ASM_ARCH_IO_H 21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H 22#define __ASM_ARCH_IO_H
23 23
24#include <asm/io.h>
25
26#define IO_SPACE_LIMIT 0xFFFFFFFF 24#define IO_SPACE_LIMIT 0xFFFFFFFF
27 25
28#define __io(a) ((void __iomem *)(a)) 26#define __io(a) ((void __iomem *)(a))
diff --git a/include/asm-arm/arch-omap/board-palmte.h b/include/asm-arm/arch-omap/board-palmte.h
index cd22035a7160..6fac2c8935be 100644
--- a/include/asm-arm/arch-omap/board-palmte.h
+++ b/include/asm-arm/arch-omap/board-palmte.h
@@ -14,8 +14,6 @@
14#ifndef __OMAP_BOARD_PALMTE_H 14#ifndef __OMAP_BOARD_PALMTE_H
15#define __OMAP_BOARD_PALMTE_H 15#define __OMAP_BOARD_PALMTE_H
16 16
17#include <asm/arch/gpio.h>
18
19#define PALMTE_USBDETECT_GPIO 0 17#define PALMTE_USBDETECT_GPIO 0
20#define PALMTE_USB_OR_DC_GPIO 1 18#define PALMTE_USB_OR_DC_GPIO 1
21#define PALMTE_TSC_GPIO 4 19#define PALMTE_TSC_GPIO 4
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
index 57523bdb642b..12a5e4de9518 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -73,6 +73,8 @@ struct clk {
73#endif 73#endif
74}; 74};
75 75
76struct cpufreq_frequency_table;
77
76struct clk_functions { 78struct clk_functions {
77 int (*clk_enable)(struct clk *clk); 79 int (*clk_enable)(struct clk *clk);
78 void (*clk_disable)(struct clk *clk); 80 void (*clk_disable)(struct clk *clk);
@@ -83,6 +85,9 @@ struct clk_functions {
83 void (*clk_allow_idle)(struct clk *clk); 85 void (*clk_allow_idle)(struct clk *clk);
84 void (*clk_deny_idle)(struct clk *clk); 86 void (*clk_deny_idle)(struct clk *clk);
85 void (*clk_disable_unused)(struct clk *clk); 87 void (*clk_disable_unused)(struct clk *clk);
88#ifdef CONFIG_CPU_FREQ
89 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **);
90#endif
86}; 91};
87 92
88extern unsigned int mpurate; 93extern unsigned int mpurate;
diff --git a/include/asm-arm/arch-omap/common.h b/include/asm-arm/arch-omap/common.h
index 224e009e5296..36a3b62d4d8d 100644
--- a/include/asm-arm/arch-omap/common.h
+++ b/include/asm-arm/arch-omap/common.h
@@ -47,4 +47,8 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
47} 47}
48#endif 48#endif
49 49
50void omap2_set_globals_242x(void);
51void omap2_set_globals_243x(void);
52void omap2_set_globals_343x(void);
53
50#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ 54#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/include/asm-arm/arch-omap/control.h b/include/asm-arm/arch-omap/control.h
index 9944bb5d5330..59c0686f8be7 100644
--- a/include/asm-arm/arch-omap/control.h
+++ b/include/asm-arm/arch-omap/control.h
@@ -80,7 +80,7 @@
80#define OMAP24XX_CONTROL_SEC_TAP (OMAP2_CONTROL_GENERAL + 0x0064) 80#define OMAP24XX_CONTROL_SEC_TAP (OMAP2_CONTROL_GENERAL + 0x0064)
81#define OMAP24XX_CONTROL_OCM_PUB_RAM_ADD (OMAP2_CONTROL_GENERAL + 0x006c) 81#define OMAP24XX_CONTROL_OCM_PUB_RAM_ADD (OMAP2_CONTROL_GENERAL + 0x006c)
82#define OMAP24XX_CONTROL_EXT_SEC_RAM_START_ADD (OMAP2_CONTROL_GENERAL + 0x0070) 82#define OMAP24XX_CONTROL_EXT_SEC_RAM_START_ADD (OMAP2_CONTROL_GENERAL + 0x0070)
83#define OMAP24XX_CONTROL_EXT_SEC_RAM_STOP_ADD (OMAP2_CONTROL_GENERAL + 0x0074 83#define OMAP24XX_CONTROL_EXT_SEC_RAM_STOP_ADD (OMAP2_CONTROL_GENERAL + 0x0074)
84#define OMAP24XX_CONTROL_SEC_STATUS (OMAP2_CONTROL_GENERAL + 0x0080) 84#define OMAP24XX_CONTROL_SEC_STATUS (OMAP2_CONTROL_GENERAL + 0x0080)
85#define OMAP24XX_CONTROL_SEC_ERR_STATUS (OMAP2_CONTROL_GENERAL + 0x0084) 85#define OMAP24XX_CONTROL_SEC_ERR_STATUS (OMAP2_CONTROL_GENERAL + 0x0084)
86#define OMAP24XX_CONTROL_STATUS (OMAP2_CONTROL_GENERAL + 0x0088) 86#define OMAP24XX_CONTROL_STATUS (OMAP2_CONTROL_GENERAL + 0x0088)
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
index 74cd57221c8e..369093a45fcf 100644
--- a/include/asm-arm/arch-omap/entry-macro.S
+++ b/include/asm-arm/arch-omap/entry-macro.S
@@ -8,6 +8,7 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h> 10#include <asm/hardware.h>
11#include <asm/arch/io.h>
11#include <asm/arch/irqs.h> 12#include <asm/arch/irqs.h>
12 13
13#if defined(CONFIG_ARCH_OMAP1) 14#if defined(CONFIG_ARCH_OMAP1)
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
index 86621a04cd8f..5ee6a49864c3 100644
--- a/include/asm-arm/arch-omap/gpio.h
+++ b/include/asm-arm/arch-omap/gpio.h
@@ -26,7 +26,6 @@
26#ifndef __ASM_ARCH_OMAP_GPIO_H 26#ifndef __ASM_ARCH_OMAP_GPIO_H
27#define __ASM_ARCH_OMAP_GPIO_H 27#define __ASM_ARCH_OMAP_GPIO_H
28 28
29#include <asm/hardware.h>
30#include <asm/arch/irqs.h> 29#include <asm/arch/irqs.h>
31#include <asm/io.h> 30#include <asm/io.h>
32 31
diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
index da572092e255..91d85b3417b7 100644
--- a/include/asm-arm/arch-omap/hardware.h
+++ b/include/asm-arm/arch-omap/hardware.h
@@ -41,7 +41,6 @@
41#include <asm/types.h> 41#include <asm/types.h>
42#include <asm/arch/cpu.h> 42#include <asm/arch/cpu.h>
43#endif 43#endif
44#include <asm/arch/io.h>
45#include <asm/arch/serial.h> 44#include <asm/arch/serial.h>
46 45
47/* 46/*
diff --git a/include/asm-arm/arch-omap/mmc.h b/include/asm-arm/arch-omap/mmc.h
index c9588f49eb52..7cfc5f258560 100644
--- a/include/asm-arm/arch-omap/mmc.h
+++ b/include/asm-arm/arch-omap/mmc.h
@@ -15,21 +15,16 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
17 17
18#include <asm/arch/board.h>
19
18#define OMAP_MMC_MAX_SLOTS 2 20#define OMAP_MMC_MAX_SLOTS 2
19 21
20struct omap_mmc_platform_data { 22struct omap_mmc_platform_data {
21 struct omap_mmc_conf conf; 23 struct omap_mmc_conf conf;
22 24
23 unsigned enabled:1;
24 /* number of slots on board */ 25 /* number of slots on board */
25 unsigned nr_slots:2; 26 unsigned nr_slots:2;
26 /* nomux means "standard" muxing is wrong on this board, and that 27
27 * board-specific code handled it before common init logic.
28 */
29 unsigned nomux:1;
30 /* 4 wire signaling is optional, and is only used for SD/SDIO and
31 * MMCv4 */
32 unsigned wire4:1;
33 /* set if your board has components or wiring that limits the 28 /* set if your board has components or wiring that limits the
34 * maximum frequency on the MMC bus */ 29 * maximum frequency on the MMC bus */
35 unsigned int max_freq; 30 unsigned int max_freq;
@@ -40,6 +35,11 @@ struct omap_mmc_platform_data {
40 * not supported */ 35 * not supported */
41 int (* init)(struct device *dev); 36 int (* init)(struct device *dev);
42 void (* cleanup)(struct device *dev); 37 void (* cleanup)(struct device *dev);
38 void (* shutdown)(struct device *dev);
39
40 /* To handle board related suspend/resume functionality for MMC */
41 int (*suspend)(struct device *dev, int slot);
42 int (*resume)(struct device *dev, int slot);
43 43
44 struct omap_mmc_slot_data { 44 struct omap_mmc_slot_data {
45 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode); 45 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
@@ -56,13 +56,19 @@ struct omap_mmc_platform_data {
56 56
57 const char *name; 57 const char *name;
58 u32 ocr_mask; 58 u32 ocr_mask;
59
60 /* Card detection IRQs */
61 int card_detect_irq;
62 int (* card_detect)(int irq);
63
64 unsigned int ban_openended:1;
65
59 } slots[OMAP_MMC_MAX_SLOTS]; 66 } slots[OMAP_MMC_MAX_SLOTS];
60}; 67};
61 68
62extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info); 69extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info);
63 70
64/* called from board-specific card detection service routine */ 71/* called from board-specific card detection service routine */
65extern void omap_mmc_notify_card_detect(struct device *dev, int slot, int detected);
66extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed); 72extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
67 73
68#endif 74#endif
diff --git a/include/asm-arm/arch-pxa/mfp-pxa27x.h b/include/asm-arm/arch-pxa/mfp-pxa27x.h
index eb6eaa174f8d..bc73ab84167c 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa27x.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa27x.h
@@ -112,6 +112,7 @@
112#define GPIO57_nIOIS16 MFP_CFG_IN(GPIO57, AF1) 112#define GPIO57_nIOIS16 MFP_CFG_IN(GPIO57, AF1)
113#define GPIO56_nPWAIT MFP_CFG_IN(GPIO56, AF1) 113#define GPIO56_nPWAIT MFP_CFG_IN(GPIO56, AF1)
114#define GPIO79_PSKTSEL MFP_CFG_OUT(GPIO79, AF1, DRIVE_HIGH) 114#define GPIO79_PSKTSEL MFP_CFG_OUT(GPIO79, AF1, DRIVE_HIGH)
115#define GPIO104_PSKTSEL MFP_CFG_OUT(GPIO104, AF1, DRIVE_HIGH)
115 116
116/* I2C */ 117/* I2C */
117#define GPIO117_I2C_SCL MFP_CFG_IN(GPIO117, AF1) 118#define GPIO117_I2C_SCL MFP_CFG_IN(GPIO117, AF1)
diff --git a/include/asm-arm/arch-pxa/pxa2xx-gpio.h b/include/asm-arm/arch-pxa/pxa2xx-gpio.h
index 763313c5e6be..b81cd63cb2eb 100644
--- a/include/asm-arm/arch-pxa/pxa2xx-gpio.h
+++ b/include/asm-arm/arch-pxa/pxa2xx-gpio.h
@@ -134,7 +134,11 @@
134#define GPIO93_CIF_DD_6 93 /* Camera data pin 6 */ 134#define GPIO93_CIF_DD_6 93 /* Camera data pin 6 */
135#define GPIO94_CIF_DD_5 94 /* Camera data pin 5 */ 135#define GPIO94_CIF_DD_5 94 /* Camera data pin 5 */
136#define GPIO95_CIF_DD_4 95 /* Camera data pin 4 */ 136#define GPIO95_CIF_DD_4 95 /* Camera data pin 4 */
137#define GPIO96_FFRXD 96 /* FFUART recieve */
138#define GPIO98_FFRTS 98 /* FFUART request to send */
137#define GPIO98_CIF_DD_0 98 /* Camera data pin 0 */ 139#define GPIO98_CIF_DD_0 98 /* Camera data pin 0 */
140#define GPIO99_FFTXD 99 /* FFUART transmit data */
141#define GPIO100_FFCTS 100 /* FFUART Clear to send */
138#define GPIO102_nPCE_1 102 /* PCMCIA (PXA27x) */ 142#define GPIO102_nPCE_1 102 /* PCMCIA (PXA27x) */
139#define GPIO103_CIF_DD_3 103 /* Camera data pin 3 */ 143#define GPIO103_CIF_DD_3 103 /* Camera data pin 3 */
140#define GPIO104_CIF_DD_2 104 /* Camera data pin 2 */ 144#define GPIO104_CIF_DD_2 104 /* Camera data pin 2 */
@@ -316,6 +320,8 @@
316#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT) 320#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT)
317#define GPIO85_CIF_LV_MD (85 | GPIO_ALT_FN_3_IN) 321#define GPIO85_CIF_LV_MD (85 | GPIO_ALT_FN_3_IN)
318#define GPIO86_nPCE_1_MD (86 | GPIO_ALT_FN_1_OUT) 322#define GPIO86_nPCE_1_MD (86 | GPIO_ALT_FN_1_OUT)
323#define GPIO88_USBH1_PWR_MD (88 | GPIO_ALT_FN_1_IN)
324#define GPIO89_USBH1_PEN_MD (89 | GPIO_ALT_FN_2_OUT)
319#define GPIO90_CIF_DD_4_MD (90 | GPIO_ALT_FN_3_IN) 325#define GPIO90_CIF_DD_4_MD (90 | GPIO_ALT_FN_3_IN)
320#define GPIO91_CIF_DD_5_MD (91 | GPIO_ALT_FN_3_IN) 326#define GPIO91_CIF_DD_5_MD (91 | GPIO_ALT_FN_3_IN)
321#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT) 327#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT)
@@ -324,8 +330,11 @@
324#define GPIO95_CIF_DD_4_MD (95 | GPIO_ALT_FN_2_IN) 330#define GPIO95_CIF_DD_4_MD (95 | GPIO_ALT_FN_2_IN)
325#define GPIO95_KP_MKIN6_MD (95 | GPIO_ALT_FN_3_IN) 331#define GPIO95_KP_MKIN6_MD (95 | GPIO_ALT_FN_3_IN)
326#define GPIO96_KP_DKIN3_MD (96 | GPIO_ALT_FN_1_IN) 332#define GPIO96_KP_DKIN3_MD (96 | GPIO_ALT_FN_1_IN)
333#define GPIO96_FFRXD_MD (96 | GPIO_ALT_FN_3_IN)
327#define GPIO97_KP_MKIN3_MD (97 | GPIO_ALT_FN_3_IN) 334#define GPIO97_KP_MKIN3_MD (97 | GPIO_ALT_FN_3_IN)
328#define GPIO98_CIF_DD_0_MD (98 | GPIO_ALT_FN_2_IN) 335#define GPIO98_CIF_DD_0_MD (98 | GPIO_ALT_FN_2_IN)
336#define GPIO98_FFRTS_MD (98 | GPIO_ALT_FN_3_OUT)
337#define GPIO99_FFTXD_MD (99 | GPIO_ALT_FN_3_OUT)
329#define GPIO100_KP_MKIN0_MD (100 | GPIO_ALT_FN_1_IN) 338#define GPIO100_KP_MKIN0_MD (100 | GPIO_ALT_FN_1_IN)
330#define GPIO101_KP_MKIN1_MD (101 | GPIO_ALT_FN_1_IN) 339#define GPIO101_KP_MKIN1_MD (101 | GPIO_ALT_FN_1_IN)
331#define GPIO102_nPCE_1_MD (102 | GPIO_ALT_FN_1_OUT) 340#define GPIO102_nPCE_1_MD (102 | GPIO_ALT_FN_1_OUT)
diff --git a/include/asm-arm/arch-pxa/regs-lcd.h b/include/asm-arm/arch-pxa/regs-lcd.h
index f762493f5141..3ba464c913a5 100644
--- a/include/asm-arm/arch-pxa/regs-lcd.h
+++ b/include/asm-arm/arch-pxa/regs-lcd.h
@@ -1,5 +1,8 @@
1#ifndef __ASM_ARCH_REGS_LCD_H 1#ifndef __ASM_ARCH_REGS_LCD_H
2#define __ASM_ARCH_REGS_LCD_H 2#define __ASM_ARCH_REGS_LCD_H
3
4#include <asm/arch/bitfield.h>
5
3/* 6/*
4 * LCD Controller Registers and Bits Definitions 7 * LCD Controller Registers and Bits Definitions
5 */ 8 */
@@ -69,7 +72,7 @@
69#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */ 72#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */
70#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */ 73#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */
71#define LCCR0_PDD_S 12 74#define LCCR0_PDD_S 12
72#define LCCR0_BM (1 << 20) /* Branch mask */ 75#define LCCR0_BM (1 << 20) /* Branch mask */
73#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */ 76#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
74#define LCCR0_LCDT (1 << 22) /* LCD panel type */ 77#define LCCR0_LCDT (1 << 22) /* LCD panel type */
75#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */ 78#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
diff --git a/include/asm-arm/arch-sa1100/collie.h b/include/asm-arm/arch-sa1100/collie.h
index 14a344aa3cc7..762eba535813 100644
--- a/include/asm-arm/arch-sa1100/collie.h
+++ b/include/asm-arm/arch-sa1100/collie.h
@@ -34,9 +34,12 @@
34 34
35#define COLLIE_GPIO_ON_KEY GPIO_GPIO (0) 35#define COLLIE_GPIO_ON_KEY GPIO_GPIO (0)
36#define COLLIE_GPIO_AC_IN GPIO_GPIO (1) 36#define COLLIE_GPIO_AC_IN GPIO_GPIO (1)
37#define COLLIE_GPIO_SDIO_INT GPIO_GPIO (11)
37#define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14) 38#define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14)
38#define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15) 39#define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15)
39#define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16) 40#define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16)
41#define COLLIE_GPIO_nMIC_ON GPIO_GPIO (17)
42#define COLLIE_GPIO_nREMOCON_ON GPIO_GPIO (18)
40#define COLLIE_GPIO_CO GPIO_GPIO (20) 43#define COLLIE_GPIO_CO GPIO_GPIO (20)
41#define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21) 44#define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21)
42#define COLLIE_GPIO_CF_CD GPIO_GPIO (22) 45#define COLLIE_GPIO_CF_CD GPIO_GPIO (22)
@@ -49,6 +52,7 @@
49 52
50#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0 53#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0
51#define COLLIE_IRQ_GPIO_AC_IN IRQ_GPIO1 54#define COLLIE_IRQ_GPIO_AC_IN IRQ_GPIO1
55#define COLLIE_IRQ_GPIO_SDIO_IRQ IRQ_GPIO11
52#define COLLIE_IRQ_GPIO_CF_IRQ IRQ_GPIO14 56#define COLLIE_IRQ_GPIO_CF_IRQ IRQ_GPIO14
53#define COLLIE_IRQ_GPIO_nREMOCON_INT IRQ_GPIO15 57#define COLLIE_IRQ_GPIO_nREMOCON_INT IRQ_GPIO15
54#define COLLIE_IRQ_GPIO_CO IRQ_GPIO20 58#define COLLIE_IRQ_GPIO_CO IRQ_GPIO20
diff --git a/include/asm-arm/arch-sa1100/irqs.h b/include/asm-arm/arch-sa1100/irqs.h
index d7940683efb1..7bf80484bb77 100644
--- a/include/asm-arm/arch-sa1100/irqs.h
+++ b/include/asm-arm/arch-sa1100/irqs.h
@@ -141,7 +141,7 @@
141#define IRQ_LOCOMO_LT (IRQ_BOARD_END + 17) 141#define IRQ_LOCOMO_LT (IRQ_BOARD_END + 17)
142#define IRQ_LOCOMO_SPI_RFR (IRQ_BOARD_END + 18) 142#define IRQ_LOCOMO_SPI_RFR (IRQ_BOARD_END + 18)
143#define IRQ_LOCOMO_SPI_RFW (IRQ_BOARD_END + 19) 143#define IRQ_LOCOMO_SPI_RFW (IRQ_BOARD_END + 19)
144#define IRQ_LOCOMO_SPI_OVRN (IRQ_BOARD_END + 20) 144#define IRQ_LOCOMO_SPI_REND (IRQ_BOARD_END + 20)
145#define IRQ_LOCOMO_SPI_TEND (IRQ_BOARD_END + 21) 145#define IRQ_LOCOMO_SPI_TEND (IRQ_BOARD_END + 21)
146 146
147/* 147/*
diff --git a/include/asm-arm/hardware/locomo.h b/include/asm-arm/hardware/locomo.h
index adab77780ed3..fb0645de6f31 100644
--- a/include/asm-arm/hardware/locomo.h
+++ b/include/asm-arm/hardware/locomo.h
@@ -58,6 +58,11 @@
58#define LOCOMO_SPIMD 0x00 /* SPI mode setting */ 58#define LOCOMO_SPIMD 0x00 /* SPI mode setting */
59#define LOCOMO_SPICT 0x04 /* SPI mode control */ 59#define LOCOMO_SPICT 0x04 /* SPI mode control */
60#define LOCOMO_SPIST 0x08 /* SPI status */ 60#define LOCOMO_SPIST 0x08 /* SPI status */
61#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */
62#define LOCOMO_SPI_REND (1 << 2) /* Receive end bit */
63#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */
64#define LOCOMO_SPI_RFR (1) /* read buffer bit */
65
61#define LOCOMO_SPIIS 0x10 /* SPI interrupt status */ 66#define LOCOMO_SPIIS 0x10 /* SPI interrupt status */
62#define LOCOMO_SPIWE 0x14 /* SPI interrupt status write enable */ 67#define LOCOMO_SPIWE 0x14 /* SPI interrupt status write enable */
63#define LOCOMO_SPIIE 0x18 /* SPI interrupt enable */ 68#define LOCOMO_SPIIE 0x18 /* SPI interrupt enable */
@@ -66,16 +71,12 @@
66#define LOCOMO_SPIRD 0x24 /* SPI receive data read */ 71#define LOCOMO_SPIRD 0x24 /* SPI receive data read */
67#define LOCOMO_SPITS 0x28 /* SPI transfer data shift */ 72#define LOCOMO_SPITS 0x28 /* SPI transfer data shift */
68#define LOCOMO_SPIRS 0x2C /* SPI receive data shift */ 73#define LOCOMO_SPIRS 0x2C /* SPI receive data shift */
69#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */
70#define LOCOMO_SPI_OVRN (1 << 2) /* Over Run bit */
71#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */
72#define LOCOMO_SPI_RFR (1) /* read buffer bit */
73 74
74/* GPIO */ 75/* GPIO */
75#define LOCOMO_GPD 0x90 /* GPIO direction */ 76#define LOCOMO_GPD 0x90 /* GPIO direction */
76#define LOCOMO_GPE 0x94 /* GPIO input enable */ 77#define LOCOMO_GPE 0x94 /* GPIO input enable */
77#define LOCOMO_GPL 0x98 /* GPIO level */ 78#define LOCOMO_GPL 0x98 /* GPIO level */
78#define LOCOMO_GPO 0x9c /* GPIO out data setteing */ 79#define LOCOMO_GPO 0x9c /* GPIO out data setting */
79#define LOCOMO_GRIE 0xa0 /* GPIO rise detection */ 80#define LOCOMO_GRIE 0xa0 /* GPIO rise detection */
80#define LOCOMO_GFIE 0xa4 /* GPIO fall detection */ 81#define LOCOMO_GFIE 0xa4 /* GPIO fall detection */
81#define LOCOMO_GIS 0xa8 /* GPIO edge detection status */ 82#define LOCOMO_GIS 0xa8 /* GPIO edge detection status */
@@ -96,6 +97,9 @@
96#define LOCOMO_GPIO_DAC_SDATA LOCOMO_GPIO(10) 97#define LOCOMO_GPIO_DAC_SDATA LOCOMO_GPIO(10)
97#define LOCOMO_GPIO_DAC_SCK LOCOMO_GPIO(11) 98#define LOCOMO_GPIO_DAC_SCK LOCOMO_GPIO(11)
98#define LOCOMO_GPIO_DAC_SLOAD LOCOMO_GPIO(12) 99#define LOCOMO_GPIO_DAC_SLOAD LOCOMO_GPIO(12)
100#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13)
101#define LOCOMO_GPIO_WRITE_PROT LOCOMO_GPIO(14)
102#define LOCOMO_GPIO_CARD_POWER LOCOMO_GPIO(15)
99 103
100/* Start the definitions of the devices. Each device has an initial 104/* Start the definitions of the devices. Each device has an initial
101 * base address and a series of offsets from that base address. */ 105 * base address and a series of offsets from that base address. */
@@ -122,7 +126,7 @@
122/* Audio controller */ 126/* Audio controller */
123#define LOCOMO_AUDIO 0x54 127#define LOCOMO_AUDIO 0x54
124#define LOCOMO_ACC 0x00 /* Audio clock */ 128#define LOCOMO_ACC 0x00 /* Audio clock */
125#define LOCOMO_PAIF 0x7C /* PCM audio interface */ 129#define LOCOMO_PAIF 0xD0 /* PCM audio interface */
126/* Audio clock */ 130/* Audio clock */
127#define LOCOMO_ACC_XON 0x80 131#define LOCOMO_ACC_XON 0x80
128#define LOCOMO_ACC_XEN 0x40 132#define LOCOMO_ACC_XEN 0x40
@@ -162,7 +166,7 @@ extern struct bus_type locomo_bus_type;
162#define LOCOMO_DEVID_AUDIO 3 166#define LOCOMO_DEVID_AUDIO 3
163#define LOCOMO_DEVID_LED 4 167#define LOCOMO_DEVID_LED 4
164#define LOCOMO_DEVID_UART 5 168#define LOCOMO_DEVID_UART 5
165#define LOCOMO_DEVID_SPI 6 169#define LOCOMO_DEVID_SPI 6
166 170
167struct locomo_dev { 171struct locomo_dev {
168 struct device dev; 172 struct device dev;
@@ -204,7 +208,6 @@ int locomo_gpio_read_level(struct device *dev, unsigned int bits);
204int locomo_gpio_read_output(struct device *dev, unsigned int bits); 208int locomo_gpio_read_output(struct device *dev, unsigned int bits);
205void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set); 209void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
206 210
207
208/* M62332 control function */ 211/* M62332 control function */
209void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel); 212void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
210 213
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 5c22b0112106..8e05bdb5f12f 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -179,10 +179,10 @@ typedef unsigned long pgprot_t;
179 179
180#endif /* STRICT_MM_TYPECHECKS */ 180#endif /* STRICT_MM_TYPECHECKS */
181 181
182typedef struct page *pgtable_t;
183
184#endif /* CONFIG_MMU */ 182#endif /* CONFIG_MMU */
185 183
184typedef struct page *pgtable_t;
185
186#include <asm/memory.h> 186#include <asm/memory.h>
187 187
188#endif /* !__ASSEMBLY__ */ 188#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-arm/pgtable-nommu.h b/include/asm-arm/pgtable-nommu.h
index 2e5868bbe03b..386fcc10a973 100644
--- a/include/asm-arm/pgtable-nommu.h
+++ b/include/asm-arm/pgtable-nommu.h
@@ -16,7 +16,6 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/io.h>
20 19
21/* 20/*
22 * Trivial page table functions. 21 * Trivial page table functions.
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 800ba5254daf..2b41ebbfa7ff 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -142,7 +142,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
142} 142}
143 143
144/* write_can_lock - would write_trylock() succeed? */ 144/* write_can_lock - would write_trylock() succeed? */
145#define __raw_write_can_lock(x) ((x)->lock == 0x80000000) 145#define __raw_write_can_lock(x) ((x)->lock == 0)
146 146
147/* 147/*
148 * Read locks are a bit more hairy: 148 * Read locks are a bit more hairy:
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 6335de9a2bb3..514af792a598 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -48,20 +48,6 @@
48#define CPUID_TCM 2 48#define CPUID_TCM 2
49#define CPUID_TLBTYPE 3 49#define CPUID_TLBTYPE 3
50 50
51#ifdef CONFIG_CPU_CP15
52#define read_cpuid(reg) \
53 ({ \
54 unsigned int __val; \
55 asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \
56 : "=r" (__val) \
57 : \
58 : "cc"); \
59 __val; \
60 })
61#else
62#define read_cpuid(reg) (processor_id)
63#endif
64
65/* 51/*
66 * This is used to ensure the compiler did actually allocate the register we 52 * This is used to ensure the compiler did actually allocate the register we
67 * asked it for some inline assembly sequences. Apparently we can't trust 53 * asked it for some inline assembly sequences. Apparently we can't trust
@@ -78,6 +64,21 @@
78#include <linux/stringify.h> 64#include <linux/stringify.h>
79#include <linux/irqflags.h> 65#include <linux/irqflags.h>
80 66
67#ifdef CONFIG_CPU_CP15
68#define read_cpuid(reg) \
69 ({ \
70 unsigned int __val; \
71 asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \
72 : "=r" (__val) \
73 : \
74 : "cc"); \
75 __val; \
76 })
77#else
78extern unsigned int processor_id;
79#define read_cpuid(reg) (processor_id)
80#endif
81
81/* 82/*
82 * The CPU ID never changes at run time, so we might as well tell the 83 * The CPU ID never changes at run time, so we might as well tell the
83 * compiler that it's constant. Use this function to read the CPU ID 84 * compiler that it's constant. Use this function to read the CPU ID
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 716df7c85923..76033831eb35 100644
--- a/include/asm-blackfin/bfin-global.h
+++ b/include/asm-blackfin/bfin-global.h
@@ -37,7 +37,9 @@
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <linux/types.h> 38#include <linux/types.h>
39 39
40#if defined(CONFIG_DMA_UNCACHED_2M) 40#if defined(CONFIG_DMA_UNCACHED_4M)
41# define DMA_UNCACHED_REGION (4 * 1024 * 1024)
42#elif defined(CONFIG_DMA_UNCACHED_2M)
41# define DMA_UNCACHED_REGION (2 * 1024 * 1024) 43# define DMA_UNCACHED_REGION (2 * 1024 * 1024)
42#elif defined(CONFIG_DMA_UNCACHED_1M) 44#elif defined(CONFIG_DMA_UNCACHED_1M)
43# define DMA_UNCACHED_REGION (1024 * 1024) 45# define DMA_UNCACHED_REGION (1024 * 1024)
@@ -103,13 +105,6 @@ extern int sram_free(const void*);
103extern void *sram_alloc_with_lsl(size_t, unsigned long); 105extern void *sram_alloc_with_lsl(size_t, unsigned long);
104extern int sram_free_with_lsl(const void*); 106extern int sram_free_with_lsl(const void*);
105 107
106extern void led_on(int);
107extern void led_off(int);
108extern void led_toggle(int);
109extern void led_disp_num(int);
110extern void led_toggle_num(int);
111extern void init_leds(void);
112
113extern const char bfin_board_name[]; 108extern const char bfin_board_name[];
114extern unsigned long wall_jiffies; 109extern unsigned long wall_jiffies;
115 110
diff --git a/include/asm-blackfin/checksum.h b/include/asm-blackfin/checksum.h
index 2638f2586d2f..6f6af2b8e9e0 100644
--- a/include/asm-blackfin/checksum.h
+++ b/include/asm-blackfin/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); 18__wsum csum_partial(const void *buff, int len, __wsum sum);
19 19
20/* 20/*
21 * the same as csum_partial, but copies from src while it 21 * the same as csum_partial, but copies from src while it
@@ -25,8 +25,8 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, 28__wsum csum_partial_copy(const void *src, void *dst,
29 int len, int sum); 29 int len, __wsum sum);
30 30
31/* 31/*
32 * the same as csum_partial_copy, but copies from user space. 32 * the same as csum_partial_copy, but copies from user space.
@@ -35,20 +35,19 @@ unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst,
35 * better 64-bit) boundary 35 * better 64-bit) boundary
36 */ 36 */
37 37
38extern unsigned int csum_partial_copy_from_user(const unsigned char *src, 38extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
39 unsigned char *dst, int len, 39 int len, __wsum sum, int *csum_err);
40 int sum, int *csum_err);
41 40
42#define csum_partial_copy_nocheck(src, dst, len, sum) \ 41#define csum_partial_copy_nocheck(src, dst, len, sum) \
43 csum_partial_copy((src), (dst), (len), (sum)) 42 csum_partial_copy((src), (dst), (len), (sum))
44 43
45unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl); 44__sum16 ip_fast_csum(unsigned char *iph, unsigned int ihl);
46 45
47/* 46/*
48 * Fold a partial checksum 47 * Fold a partial checksum
49 */ 48 */
50 49
51static inline unsigned int csum_fold(unsigned int sum) 50static inline __sum16 csum_fold(__wsum sum)
52{ 51{
53 while (sum >> 16) 52 while (sum >> 16)
54 sum = (sum & 0xffff) + (sum >> 16); 53 sum = (sum & 0xffff) + (sum >> 16);
@@ -60,9 +59,9 @@ static inline unsigned int csum_fold(unsigned int sum)
60 * returns a 16-bit checksum, already complemented 59 * returns a 16-bit checksum, already complemented
61 */ 60 */
62 61
63static inline unsigned int 62static inline __wsum
64csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 63csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
65 unsigned short proto, unsigned int sum) 64 unsigned short proto, __wsum sum)
66{ 65{
67 66
68 __asm__ ("%0 = %0 + %1;\n\t" 67 __asm__ ("%0 = %0 + %1;\n\t"
@@ -84,9 +83,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
84 return (sum); 83 return (sum);
85} 84}
86 85
87static inline unsigned short int 86static inline __sum16
88csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 87csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
89 unsigned short proto, unsigned int sum) 88 unsigned short proto, __wsum sum)
90{ 89{
91 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 90 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
92} 91}
@@ -96,6 +95,6 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
96 * in icmp.c 95 * in icmp.c
97 */ 96 */
98 97
99extern unsigned short ip_compute_csum(const unsigned char *buff, int len); 98extern __sum16 ip_compute_csum(const void *buff, int len);
100 99
101#endif /* _BFIN_CHECKSUM_H */ 100#endif /* _BFIN_CHECKSUM_H */
diff --git a/include/asm-blackfin/gpio.h b/include/asm-blackfin/gpio.h
index 27ff532a806c..ff95e9d88342 100644
--- a/include/asm-blackfin/gpio.h
+++ b/include/asm-blackfin/gpio.h
@@ -437,7 +437,6 @@ void gpio_set_value(unsigned gpio, int arg);
437int gpio_get_value(unsigned gpio); 437int gpio_get_value(unsigned gpio);
438 438
439#ifndef BF548_FAMILY 439#ifndef BF548_FAMILY
440#define gpio_get_value(gpio) get_gpio_data(gpio)
441#define gpio_set_value(gpio, value) set_gpio_data(gpio, value) 440#define gpio_set_value(gpio, value) set_gpio_data(gpio, value)
442#endif 441#endif
443 442
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index 574fe56989d1..cbbf7ffdbbff 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -117,10 +117,12 @@ static inline unsigned int readl(const volatile void __iomem *addr)
117 117
118extern void outsb(unsigned long port, const void *addr, unsigned long count); 118extern void outsb(unsigned long port, const void *addr, unsigned long count);
119extern void outsw(unsigned long port, const void *addr, unsigned long count); 119extern void outsw(unsigned long port, const void *addr, unsigned long count);
120extern void outsw_8(unsigned long port, const void *addr, unsigned long count);
120extern void outsl(unsigned long port, const void *addr, unsigned long count); 121extern void outsl(unsigned long port, const void *addr, unsigned long count);
121 122
122extern void insb(unsigned long port, void *addr, unsigned long count); 123extern void insb(unsigned long port, void *addr, unsigned long count);
123extern void insw(unsigned long port, void *addr, unsigned long count); 124extern void insw(unsigned long port, void *addr, unsigned long count);
125extern void insw_8(unsigned long port, void *addr, unsigned long count);
124extern void insl(unsigned long port, void *addr, unsigned long count); 126extern void insl(unsigned long port, void *addr, unsigned long count);
125extern void insl_16(unsigned long port, void *addr, unsigned long count); 127extern void insl_16(unsigned long port, void *addr, unsigned long count);
126 128
diff --git a/include/asm-blackfin/mach-bf527/anomaly.h b/include/asm-blackfin/mach-bf527/anomaly.h
index 735fa02fafb2..4725268a5ada 100644
--- a/include/asm-blackfin/mach-bf527/anomaly.h
+++ b/include/asm-blackfin/mach-bf527/anomaly.h
@@ -15,12 +15,16 @@
15 15
16/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */ 16/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */
17#define ANOMALY_05000074 (1) 17#define ANOMALY_05000074 (1)
18/* DMA_RUN Bit Is Not Valid after a Peripheral Receive Channel DMA Stops */
19#define ANOMALY_05000119 (1)
18/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */ 20/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */
19#define ANOMALY_05000122 (1) 21#define ANOMALY_05000122 (1)
20/* Spurious Hardware Error from an Access in the Shadow of a Conditional Branch */ 22/* Spurious Hardware Error from an Access in the Shadow of a Conditional Branch */
21#define ANOMALY_05000245 (1) 23#define ANOMALY_05000245 (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)
26/* Errors when SSYNC, CSYNC, or Loads to LT, LB and LC Registers Are Interrupted */
27#define ANOMALY_05000312 (1)
24/* Incorrect Access of OTP_STATUS During otp_write() Function */ 28/* Incorrect Access of OTP_STATUS During otp_write() Function */
25#define ANOMALY_05000328 (1) 29#define ANOMALY_05000328 (1)
26/* Disallowed Configuration Prevents Subsequent Allowed Configuration on Host DMA Port */ 30/* Disallowed Configuration Prevents Subsequent Allowed Configuration on Host DMA Port */
@@ -92,7 +96,6 @@
92#define ANOMALY_05000266 (0) 96#define ANOMALY_05000266 (0)
93#define ANOMALY_05000273 (0) 97#define ANOMALY_05000273 (0)
94#define ANOMALY_05000311 (0) 98#define ANOMALY_05000311 (0)
95#define ANOMALY_05000312 (0)
96#define ANOMALY_05000323 (0) 99#define ANOMALY_05000323 (0)
97#define ANOMALY_05000363 (0) 100#define ANOMALY_05000363 (0)
98 101
diff --git a/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h
index 26e3c8076b4e..96bd09e31e36 100644
--- a/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h
@@ -53,6 +53,12 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin)
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61
56#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 62#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS)
57# define CONFIG_SERIAL_BFIN_CTSRTS 63# define CONFIG_SERIAL_BFIN_CTSRTS
58 64
diff --git a/include/asm-blackfin/mach-bf527/blackfin.h b/include/asm-blackfin/mach-bf527/blackfin.h
index 2891727b6176..297821e2d79a 100644
--- a/include/asm-blackfin/mach-bf527/blackfin.h
+++ b/include/asm-blackfin/mach-bf527/blackfin.h
@@ -39,22 +39,22 @@
39#include "defBF522.h" 39#include "defBF522.h"
40#include "anomaly.h" 40#include "anomaly.h"
41 41
42#if defined(CONFIG_BF527) 42#if defined(CONFIG_BF527) || defined(CONFIG_BF526)
43#include "defBF527.h" 43#include "defBF527.h"
44#endif 44#endif
45 45
46#if defined(CONFIG_BF525) 46#if defined(CONFIG_BF525) || defined(CONFIG_BF524)
47#include "defBF525.h" 47#include "defBF525.h"
48#endif 48#endif
49 49
50#if !defined(__ASSEMBLY__) 50#if !defined(__ASSEMBLY__)
51#include "cdefBF522.h" 51#include "cdefBF522.h"
52 52
53#if defined(CONFIG_BF527) 53#if defined(CONFIG_BF527) || defined(CONFIG_BF526)
54#include "cdefBF527.h" 54#include "cdefBF527.h"
55#endif 55#endif
56 56
57#if defined(CONFIG_BF525) 57#if defined(CONFIG_BF525) || defined(CONFIG_BF524)
58#include "cdefBF525.h" 58#include "cdefBF525.h"
59#endif 59#endif
60#endif 60#endif
diff --git a/include/asm-blackfin/mach-bf533/anomaly.h b/include/asm-blackfin/mach-bf533/anomaly.h
index 5a6dcc5fa36c..8f7ea112fd3a 100644
--- a/include/asm-blackfin/mach-bf533/anomaly.h
+++ b/include/asm-blackfin/mach-bf533/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-2007 Analog Devices Inc. 5 * Copyright (C) 2004-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -176,6 +176,21 @@
176#define ANOMALY_05000315 (1) 176#define ANOMALY_05000315 (1)
177/* Internal Voltage Regulator Values of 1.05V, 1.10V and 1.15V Not Allowed for LQFP Packages */ 177/* Internal Voltage Regulator Values of 1.05V, 1.10V and 1.15V Not Allowed for LQFP Packages */
178#define ANOMALY_05000319 (ANOMALY_BF531 || ANOMALY_BF532) 178#define ANOMALY_05000319 (ANOMALY_BF531 || ANOMALY_BF532)
179/* Serial Port (SPORT) Multichannel Transmit Failure when Channel 0 Is Disabled */
180#define ANOMALY_05000357 (1)
181/* UART Break Signal Issues */
182#define ANOMALY_05000363 (__SILICON_REVISION__ < 5)
183/* PPI Underflow Error Goes Undetected in ITU-R 656 Mode */
184#define ANOMALY_05000366 (1)
185/* Possible RETS Register Corruption when Subroutine Is under 5 Cycles in Duration */
186#define ANOMALY_05000371 (1)
187/* PPI Does Not Start Properly In Specific Mode */
188#define ANOMALY_05000400 (__SILICON_REVISION__ >= 5)
189/* SSYNC Stalls Processor when Executed from Non-Cacheable Memory */
190#define ANOMALY_05000402 (__SILICON_REVISION__ >= 5)
191/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */
192#define ANOMALY_05000403 (1)
193
179 194
180/* These anomalies have been "phased" out of analog.com anomaly sheets and are 195/* These anomalies have been "phased" out of analog.com anomaly sheets and are
181 * here to show running on older silicon just isn't feasible. 196 * here to show running on older silicon just isn't feasible.
@@ -249,20 +264,6 @@
249#define ANOMALY_05000192 (__SILICON_REVISION__ < 3) 264#define ANOMALY_05000192 (__SILICON_REVISION__ < 3)
250/* Internal Voltage Regulator may not start up */ 265/* Internal Voltage Regulator may not start up */
251#define ANOMALY_05000206 (__SILICON_REVISION__ < 3) 266#define ANOMALY_05000206 (__SILICON_REVISION__ < 3)
252/* Serial Port (SPORT) Multichannel Transmit Failure when Channel 0 Is Disabled */
253#define ANOMALY_05000357 (1)
254/* UART Break Signal Issues */
255#define ANOMALY_05000363 (__SILICON_REVISION__ < 5)
256/* PPI Underflow Error Goes Undetected in ITU-R 656 Mode */
257#define ANOMALY_05000366 (1)
258/* Possible RETS Register Corruption when Subroutine Is under 5 Cycles in Duration */
259#define ANOMALY_05000371 (1)
260/* PPI Does Not Start Properly In Specific Mode */
261#define ANOMALY_05000400 (__SILICON_REVISION__ == 5)
262/* SSYNC Stalls Processor when Executed from Non-Cacheable Memory */
263#define ANOMALY_05000402 (__SILICON_REVISION__ == 5)
264/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */
265#define ANOMALY_05000403 (1)
266 267
267/* Anomalies that don't exist on this proc */ 268/* Anomalies that don't exist on this proc */
268#define ANOMALY_05000266 (0) 269#define ANOMALY_05000266 (0)
diff --git a/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h
index d016603b6615..e924569ad1d8 100644
--- a/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h
@@ -53,6 +53,12 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin)
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61
56#ifdef CONFIG_BFIN_UART0_CTSRTS 62#ifdef CONFIG_BFIN_UART0_CTSRTS
57# define CONFIG_SERIAL_BFIN_CTSRTS 63# define CONFIG_SERIAL_BFIN_CTSRTS
58# ifndef CONFIG_UART0_CTS_PIN 64# ifndef CONFIG_UART0_CTS_PIN
diff --git a/include/asm-blackfin/mach-bf537/anomaly.h b/include/asm-blackfin/mach-bf537/anomaly.h
index a6b08facb242..8460ab9c324f 100644
--- a/include/asm-blackfin/mach-bf537/anomaly.h
+++ b/include/asm-blackfin/mach-bf537/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-2007 Analog Devices Inc. 5 * Copyright (C) 2004-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
@@ -132,8 +132,8 @@
132#define ANOMALY_05000322 (1) 132#define ANOMALY_05000322 (1)
133/* Ethernet MAC MDIO Reads Do Not Meet IEEE Specification */ 133/* Ethernet MAC MDIO Reads Do Not Meet IEEE Specification */
134#define ANOMALY_05000341 (__SILICON_REVISION__ >= 3) 134#define ANOMALY_05000341 (__SILICON_REVISION__ >= 3)
135/* New Feature: UART Remains Enabled after UART Boot (Not Available on Older Silicon) */ 135/* New Feature: UART Remains Enabled after UART Boot */
136#define ANOMALY_05000350 (__SILICON_REVISION__ < 3) 136#define ANOMALY_05000350 (__SILICON_REVISION__ >= 3)
137/* Regulator Programming Blocked when Hibernate Wakeup Source Remains Active */ 137/* Regulator Programming Blocked when Hibernate Wakeup Source Remains Active */
138#define ANOMALY_05000355 (1) 138#define ANOMALY_05000355 (1)
139/* Serial Port (SPORT) Multichannel Transmit Failure when Channel 0 Is Disabled */ 139/* Serial Port (SPORT) Multichannel Transmit Failure when Channel 0 Is Disabled */
@@ -145,12 +145,10 @@
145/* Possible RETS Register Corruption when Subroutine Is under 5 Cycles in Duration */ 145/* Possible RETS Register Corruption when Subroutine Is under 5 Cycles in Duration */
146#define ANOMALY_05000371 (1) 146#define ANOMALY_05000371 (1)
147/* SSYNC Stalls Processor when Executed from Non-Cacheable Memory */ 147/* SSYNC Stalls Processor when Executed from Non-Cacheable Memory */
148#define ANOMALY_05000402 (__SILICON_REVISION__ >= 3) 148#define ANOMALY_05000402 (__SILICON_REVISION__ >= 5)
149/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */ 149/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */
150#define ANOMALY_05000403 (1) 150#define ANOMALY_05000403 (1)
151 151
152
153
154/* Anomalies that don't exist on this proc */ 152/* Anomalies that don't exist on this proc */
155#define ANOMALY_05000125 (0) 153#define ANOMALY_05000125 (0)
156#define ANOMALY_05000158 (0) 154#define ANOMALY_05000158 (0)
diff --git a/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h
index f79d1a0e9129..41d7b6490bb1 100644
--- a/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h
@@ -53,6 +53,12 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin)
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61
56#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 62#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS)
57# define CONFIG_SERIAL_BFIN_CTSRTS 63# define CONFIG_SERIAL_BFIN_CTSRTS
58 64
diff --git a/include/asm-blackfin/mach-bf548/anomaly.h b/include/asm-blackfin/mach-bf548/anomaly.h
index 49d3cebc5293..3ad59655881a 100644
--- a/include/asm-blackfin/mach-bf548/anomaly.h
+++ b/include/asm-blackfin/mach-bf548/anomaly.h
@@ -75,6 +75,8 @@
75#define ANOMALY_05000365 (1) 75#define ANOMALY_05000365 (1)
76/* Addressing Conflict between Boot ROM and Asynchronous Memory */ 76/* Addressing Conflict between Boot ROM and Asynchronous Memory */
77#define ANOMALY_05000369 (1) 77#define ANOMALY_05000369 (1)
78/* Possible RETS Register Corruption when Subroutine Is under 5 Cycles in Duration */
79#define ANOMALY_05000371 (1)
78/* Mobile DDR Operation Not Functional */ 80/* Mobile DDR Operation Not Functional */
79#define ANOMALY_05000377 (1) 81#define ANOMALY_05000377 (1)
80/* Security/Authentication Speedpath Causes Authentication To Fail To Initiate */ 82/* Security/Authentication Speedpath Causes Authentication To Fail To Initiate */
diff --git a/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h
index 5eb46a77d919..59b4ad4e5b4a 100644
--- a/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h
@@ -57,6 +57,12 @@
57#define UART_SET_DLAB(uart) /* MMRs not muxed on BF54x */ 57#define UART_SET_DLAB(uart) /* MMRs not muxed on BF54x */
58#define UART_CLEAR_DLAB(uart) /* MMRs not muxed on BF54x */ 58#define UART_CLEAR_DLAB(uart) /* MMRs not muxed on BF54x */
59 59
60#define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS)
61#define UART_SET_RTS(x) (UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS))
62#define UART_CLEAR_RTS(x) (UART_PUT_MCR(x, UART_GET_MCR(x) & ~MRTS))
63#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v)
64#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF)
65
60#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 66#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS)
61# define CONFIG_SERIAL_BFIN_CTSRTS 67# define CONFIG_SERIAL_BFIN_CTSRTS
62 68
diff --git a/include/asm-blackfin/mach-bf561/anomaly.h b/include/asm-blackfin/mach-bf561/anomaly.h
index 82157caa96a2..5c5d7d7d695f 100644
--- a/include/asm-blackfin/mach-bf561/anomaly.h
+++ b/include/asm-blackfin/mach-bf561/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-2007 Analog Devices Inc. 5 * Copyright (C) 2004-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
diff --git a/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h
index 7a9628769296..30d90b580f18 100644
--- a/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h
@@ -53,6 +53,12 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin)
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61
56#ifdef CONFIG_BFIN_UART0_CTSRTS 62#ifdef CONFIG_BFIN_UART0_CTSRTS
57# define CONFIG_SERIAL_BFIN_CTSRTS 63# define CONFIG_SERIAL_BFIN_CTSRTS
58# ifndef CONFIG_UART0_CTS_PIN 64# ifndef CONFIG_UART0_CTS_PIN
diff --git a/include/asm-blackfin/mach-bf561/dma.h b/include/asm-blackfin/mach-bf561/dma.h
index 21d982003e75..8bc46cd89a02 100644
--- a/include/asm-blackfin/mach-bf561/dma.h
+++ b/include/asm-blackfin/mach-bf561/dma.h
@@ -25,11 +25,11 @@
25#define CH_MEM_STREAM1_SRC 27 /* RX */ 25#define CH_MEM_STREAM1_SRC 27 /* RX */
26#define CH_MEM_STREAM2_DEST 28 26#define CH_MEM_STREAM2_DEST 28
27#define CH_MEM_STREAM2_SRC 29 27#define CH_MEM_STREAM2_SRC 29
28#define CH_MEM_STREAM3_SRC 30 28#define CH_MEM_STREAM3_DEST 30
29#define CH_MEM_STREAM3_DEST 31 29#define CH_MEM_STREAM3_SRC 31
30#define CH_IMEM_STREAM0_DEST 32 30#define CH_IMEM_STREAM0_DEST 32
31#define CH_IMEM_STREAM0_SRC 33 31#define CH_IMEM_STREAM0_SRC 33
32#define CH_IMEM_STREAM1_SRC 34 32#define CH_IMEM_STREAM1_DEST 34
33#define CH_IMEM_STREAM1_DEST 35 33#define CH_IMEM_STREAM1_SRC 35
34 34
35#endif 35#endif
diff --git a/include/asm-blackfin/serial.h b/include/asm-blackfin/serial.h
new file mode 100644
index 000000000000..994dd869558c
--- /dev/null
+++ b/include/asm-blackfin/serial.h
@@ -0,0 +1,5 @@
1/*
2 * include/asm-blackfin/serial.h
3 */
4
5#define SERIAL_EXTRA_IRQ_FLAGS IRQF_TRIGGER_HIGH
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h
index 9b1689850187..269da09ff637 100644
--- a/include/asm-frv/checksum.h
+++ b/include/asm-frv/checksum.h
@@ -75,7 +75,7 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
75 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp) 75 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp)
76 : "0" (sum), "1" (iph), "2" (ihl), "3" (4), 76 : "0" (sum), "1" (iph), "2" (ihl), "3" (4),
77 "m"(*(volatile struct { int _[100]; } *)iph) 77 "m"(*(volatile struct { int _[100]; } *)iph)
78 : "icc0", "icc1" 78 : "icc0", "icc1", "memory"
79 ); 79 );
80 80
81 return (__force __sum16)~sum; 81 return (__force __sum16)~sum;
diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h
index 734a1d0583b6..2947764fc0e0 100644
--- a/include/asm-frv/mem-layout.h
+++ b/include/asm-frv/mem-layout.h
@@ -31,6 +31,13 @@
31 31
32#define PAGE_MASK (~(PAGE_SIZE-1)) 32#define PAGE_MASK (~(PAGE_SIZE-1))
33 33
34/*
35 * the slab must be aligned such that load- and store-double instructions don't
36 * fault if used
37 */
38#define ARCH_KMALLOC_MINALIGN 8
39#define ARCH_SLAB_MINALIGN 8
40
34/*****************************************************************************/ 41/*****************************************************************************/
35/* 42/*
36 * virtual memory layout from kernel's point of view 43 * virtual memory layout from kernel's point of view
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index cb307f8a6b48..d3a12a9079f7 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -179,7 +179,7 @@ do { \
179#define mb() asm volatile ("membar" : : :"memory") 179#define mb() asm volatile ("membar" : : :"memory")
180#define rmb() asm volatile ("membar" : : :"memory") 180#define rmb() asm volatile ("membar" : : :"memory")
181#define wmb() asm volatile ("membar" : : :"memory") 181#define wmb() asm volatile ("membar" : : :"memory")
182#define read_barrier_depends() barrier() 182#define read_barrier_depends() do { } while (0)
183 183
184#ifdef CONFIG_SMP 184#ifdef CONFIG_SMP
185#define smp_mb() mb() 185#define smp_mb() mb()
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index ecf675a59d21..6be061d09da9 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,8 +1,12 @@
1#ifndef _ASM_GENERIC_GPIO_H 1#ifndef _ASM_GENERIC_GPIO_H
2#define _ASM_GENERIC_GPIO_H 2#define _ASM_GENERIC_GPIO_H
3 3
4#include <linux/types.h>
5
4#ifdef CONFIG_HAVE_GPIO_LIB 6#ifdef CONFIG_HAVE_GPIO_LIB
5 7
8#include <linux/compiler.h>
9
6/* Platforms may implement their GPIO interface with library code, 10/* Platforms may implement their GPIO interface with library code,
7 * at a small performance cost for non-inlined operations and some 11 * at a small performance cost for non-inlined operations and some
8 * extra memory (for code and for per-GPIO table entries). 12 * extra memory (for code and for per-GPIO table entries).
@@ -74,7 +78,7 @@ struct gpio_chip {
74 78
75extern const char *gpiochip_is_requested(struct gpio_chip *chip, 79extern const char *gpiochip_is_requested(struct gpio_chip *chip,
76 unsigned offset); 80 unsigned offset);
77extern int __init __must_check gpiochip_reserve(int start, int ngpio); 81extern int __must_check gpiochip_reserve(int start, int ngpio);
78 82
79/* add/remove chips */ 83/* add/remove chips */
80extern int gpiochip_add(struct gpio_chip *chip); 84extern int gpiochip_add(struct gpio_chip *chip);
diff --git a/include/asm-h8300/cacheflush.h b/include/asm-h8300/cacheflush.h
index 71210d141b64..5ffdca217b95 100644
--- a/include/asm-h8300/cacheflush.h
+++ b/include/asm-h8300/cacheflush.h
@@ -3,7 +3,7 @@
3 */ 3 */
4 4
5#ifndef _ASM_H8300_CACHEFLUSH_H 5#ifndef _ASM_H8300_CACHEFLUSH_H
6#define _AMS_H8300_CACHEFLUSH_H 6#define _ASM_H8300_CACHEFLUSH_H
7 7
8/* 8/*
9 * Cache handling functions 9 * Cache handling functions
diff --git a/include/asm-h8300/param.h b/include/asm-h8300/param.h
index 04f64f100379..1c72fb8080ff 100644
--- a/include/asm-h8300/param.h
+++ b/include/asm-h8300/param.h
@@ -1,14 +1,12 @@
1#ifndef _H8300_PARAM_H 1#ifndef _H8300_PARAM_H
2#define _H8300_PARAM_H 2#define _H8300_PARAM_H
3 3
4
5#ifndef HZ
6#define HZ CONFIG_HZ
7#endif
8
9#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#define HZ CONFIG_HZ
10#define USER_HZ HZ 6#define USER_HZ HZ
11#define CLOCKS_PER_SEC (USER_HZ) 7#define CLOCKS_PER_SEC (USER_HZ)
8#else
9#define HZ 100
12#endif 10#endif
13 11
14#define EXEC_PAGESIZE 4096 12#define EXEC_PAGESIZE 4096
diff --git a/include/asm-ia64/kvm.h b/include/asm-ia64/kvm.h
index eb2d3559d089..3f6a090cbd9a 100644
--- a/include/asm-ia64/kvm.h
+++ b/include/asm-ia64/kvm.h
@@ -22,14 +22,13 @@
22 */ 22 */
23 23
24#include <asm/types.h> 24#include <asm/types.h>
25#include <asm/fpu.h>
26 25
27#include <linux/ioctl.h> 26#include <linux/ioctl.h>
28 27
29/* Architectural interrupt line count. */ 28/* Architectural interrupt line count. */
30#define KVM_NR_INTERRUPTS 256 29#define KVM_NR_INTERRUPTS 256
31 30
32#define KVM_IOAPIC_NUM_PINS 24 31#define KVM_IOAPIC_NUM_PINS 48
33 32
34struct kvm_ioapic_state { 33struct kvm_ioapic_state {
35 __u64 base_address; 34 __u64 base_address;
@@ -61,6 +60,13 @@ struct kvm_ioapic_state {
61 60
62#define KVM_CONTEXT_SIZE 8*1024 61#define KVM_CONTEXT_SIZE 8*1024
63 62
63struct kvm_fpreg {
64 union {
65 unsigned long bits[2];
66 long double __dummy; /* force 16-byte alignment */
67 } u;
68};
69
64union context { 70union context {
65 /* 8K size */ 71 /* 8K size */
66 char dummy[KVM_CONTEXT_SIZE]; 72 char dummy[KVM_CONTEXT_SIZE];
@@ -77,7 +83,7 @@ union context {
77 unsigned long ibr[8]; 83 unsigned long ibr[8];
78 unsigned long dbr[8]; 84 unsigned long dbr[8];
79 unsigned long pkr[8]; 85 unsigned long pkr[8];
80 struct ia64_fpreg fr[128]; 86 struct kvm_fpreg fr[128];
81 }; 87 };
82}; 88};
83 89
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 9f020eb825c5..0721a5e8271e 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -126,6 +126,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
126# include <asm/machvec_hpzx1_swiotlb.h> 126# include <asm/machvec_hpzx1_swiotlb.h>
127# elif defined (CONFIG_IA64_SGI_SN2) 127# elif defined (CONFIG_IA64_SGI_SN2)
128# include <asm/machvec_sn2.h> 128# include <asm/machvec_sn2.h>
129# elif defined (CONFIG_IA64_SGI_UV)
130# include <asm/machvec_uv.h>
129# elif defined (CONFIG_IA64_GENERIC) 131# elif defined (CONFIG_IA64_GENERIC)
130 132
131# ifdef MACHVEC_PLATFORM_HEADER 133# ifdef MACHVEC_PLATFORM_HEADER
diff --git a/include/asm-ia64/machvec_uv.h b/include/asm-ia64/machvec_uv.h
new file mode 100644
index 000000000000..2931447f3813
--- /dev/null
+++ b/include/asm-ia64/machvec_uv.h
@@ -0,0 +1,26 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI UV Core Functions
7 *
8 * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#ifndef _ASM_IA64_MACHVEC_UV_H
12#define _ASM_IA64_MACHVEC_UV_H
13
14extern ia64_mv_setup_t uv_setup;
15
16/*
17 * This stuff has dual use!
18 *
19 * For a generic kernel, the macros are used to initialize the
20 * platform's machvec structure. When compiling a non-generic kernel,
21 * the macros are used directly.
22 */
23#define platform_name "uv"
24#define platform_setup uv_setup
25
26#endif /* _ASM_IA64_MACHVEC_UV_H */
diff --git a/include/asm-ia64/patch.h b/include/asm-ia64/patch.h
index a71543084fb4..295fe6ab4584 100644
--- a/include/asm-ia64/patch.h
+++ b/include/asm-ia64/patch.h
@@ -21,6 +21,7 @@ extern void ia64_patch_imm60 (u64 insn_addr, u64 val); /* patch "brl" w/ip-rel
21extern void ia64_patch_mckinley_e9 (unsigned long start, unsigned long end); 21extern void ia64_patch_mckinley_e9 (unsigned long start, unsigned long end);
22extern void ia64_patch_vtop (unsigned long start, unsigned long end); 22extern void ia64_patch_vtop (unsigned long start, unsigned long end);
23extern void ia64_patch_phys_stack_reg(unsigned long val); 23extern void ia64_patch_phys_stack_reg(unsigned long val);
24extern void ia64_patch_rse (unsigned long start, unsigned long end);
24extern void ia64_patch_gate (void); 25extern void ia64_patch_gate (void);
25 26
26#endif /* _ASM_IA64_PATCH_H */ 27#endif /* _ASM_IA64_PATCH_H */
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h
index 4b2a8d40ebc5..15f8dcfe6eee 100644
--- a/include/asm-ia64/ptrace.h
+++ b/include/asm-ia64/ptrace.h
@@ -76,7 +76,7 @@
76# define KERNEL_STACK_SIZE_ORDER 0 76# define KERNEL_STACK_SIZE_ORDER 0
77#endif 77#endif
78 78
79#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + IA64_THREAD_INFO_SIZE + 15) & ~15) 79#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + IA64_THREAD_INFO_SIZE + 31) & ~31)
80#define IA64_STK_OFFSET ((1 << KERNEL_STACK_SIZE_ORDER)*PAGE_SIZE) 80#define IA64_STK_OFFSET ((1 << KERNEL_STACK_SIZE_ORDER)*PAGE_SIZE)
81 81
82#define KERNEL_STACK_SIZE IA64_STK_OFFSET 82#define KERNEL_STACK_SIZE IA64_STK_OFFSET
diff --git a/include/asm-ia64/sections.h b/include/asm-ia64/sections.h
index dc42a359894f..7286e4a9fe84 100644
--- a/include/asm-ia64/sections.h
+++ b/include/asm-ia64/sections.h
@@ -10,6 +10,7 @@
10 10
11extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[]; 11extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
12extern char __start___vtop_patchlist[], __end___vtop_patchlist[]; 12extern char __start___vtop_patchlist[], __end___vtop_patchlist[];
13extern char __start___rse_patchlist[], __end___rse_patchlist[];
13extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[]; 14extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[];
14extern char __start___phys_stack_reg_patchlist[], __end___phys_stack_reg_patchlist[]; 15extern char __start___phys_stack_reg_patchlist[], __end___phys_stack_reg_patchlist[];
15extern char __start_gate_section[]; 16extern char __start_gate_section[];
diff --git a/include/asm-ia64/uv/uv_hub.h b/include/asm-ia64/uv/uv_hub.h
new file mode 100644
index 000000000000..f607018af4a1
--- /dev/null
+++ b/include/asm-ia64/uv/uv_hub.h
@@ -0,0 +1,309 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI UV architectural definitions
7 *
8 * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#ifndef __ASM_IA64_UV_HUB_H__
12#define __ASM_IA64_UV_HUB_H__
13
14#include <linux/numa.h>
15#include <linux/percpu.h>
16#include <asm/types.h>
17#include <asm/percpu.h>
18
19
20/*
21 * Addressing Terminology
22 *
23 * M - The low M bits of a physical address represent the offset
24 * into the blade local memory. RAM memory on a blade is physically
25 * contiguous (although various IO spaces may punch holes in
26 * it)..
27 *
28 * N - Number of bits in the node portion of a socket physical
29 * address.
30 *
31 * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of
32 * routers always have low bit of 1, C/MBricks have low bit
33 * equal to 0. Most addressing macros that target UV hub chips
34 * right shift the NASID by 1 to exclude the always-zero bit.
35 * NASIDs contain up to 15 bits.
36 *
37 * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead
38 * of nasids.
39 *
40 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
41 * of the nasid for socket usage.
42 *
43 *
44 * NumaLink Global Physical Address Format:
45 * +--------------------------------+---------------------+
46 * |00..000| GNODE | NodeOffset |
47 * +--------------------------------+---------------------+
48 * |<-------53 - M bits --->|<--------M bits ----->
49 *
50 * M - number of node offset bits (35 .. 40)
51 *
52 *
53 * Memory/UV-HUB Processor Socket Address Format:
54 * +----------------+---------------+---------------------+
55 * |00..000000000000| PNODE | NodeOffset |
56 * +----------------+---------------+---------------------+
57 * <--- N bits --->|<--------M bits ----->
58 *
59 * M - number of node offset bits (35 .. 40)
60 * N - number of PNODE bits (0 .. 10)
61 *
62 * Note: M + N cannot currently exceed 44 (x86_64) or 46 (IA64).
63 * The actual values are configuration dependent and are set at
64 * boot time. M & N values are set by the hardware/BIOS at boot.
65 */
66
67
68/*
69 * Maximum number of bricks in all partitions and in all coherency domains.
70 * This is the total number of bricks accessible in the numalink fabric. It
71 * includes all C & M bricks. Routers are NOT included.
72 *
73 * This value is also the value of the maximum number of non-router NASIDs
74 * in the numalink fabric.
75 *
76 * NOTE: a brick may contain 1 or 2 OS nodes. Don't get these confused.
77 */
78#define UV_MAX_NUMALINK_BLADES 16384
79
80/*
81 * Maximum number of C/Mbricks within a software SSI (hardware may support
82 * more).
83 */
84#define UV_MAX_SSI_BLADES 1
85
86/*
87 * The largest possible NASID of a C or M brick (+ 2)
88 */
89#define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_NODES * 2)
90
91/*
92 * The following defines attributes of the HUB chip. These attributes are
93 * frequently referenced and are kept in the per-cpu data areas of each cpu.
94 * They are kept together in a struct to minimize cache misses.
95 */
96struct uv_hub_info_s {
97 unsigned long global_mmr_base;
98 unsigned long gpa_mask;
99 unsigned long gnode_upper;
100 unsigned long lowmem_remap_top;
101 unsigned long lowmem_remap_base;
102 unsigned short pnode;
103 unsigned short pnode_mask;
104 unsigned short coherency_domain_number;
105 unsigned short numa_blade_id;
106 unsigned char blade_processor_id;
107 unsigned char m_val;
108 unsigned char n_val;
109};
110DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
111#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
112#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
113
114/*
115 * Local & Global MMR space macros.
116 * Note: macros are intended to be used ONLY by inline functions
117 * in this file - not by other kernel code.
118 * n - NASID (full 15-bit global nasid)
119 * g - GNODE (full 15-bit global nasid, right shifted 1)
120 * p - PNODE (local part of nsids, right shifted 1)
121 */
122#define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
123#define UV_PNODE_TO_NASID(p) (((p) << 1) | uv_hub_info->gnode_upper)
124
125#define UV_LOCAL_MMR_BASE 0xf4000000UL
126#define UV_GLOBAL_MMR32_BASE 0xf8000000UL
127#define UV_GLOBAL_MMR64_BASE (uv_hub_info->global_mmr_base)
128
129#define UV_GLOBAL_MMR32_PNODE_SHIFT 15
130#define UV_GLOBAL_MMR64_PNODE_SHIFT 26
131
132#define UV_GLOBAL_MMR32_PNODE_BITS(p) ((p) << (UV_GLOBAL_MMR32_PNODE_SHIFT))
133
134#define UV_GLOBAL_MMR64_PNODE_BITS(p) \
135 ((unsigned long)(p) << UV_GLOBAL_MMR64_PNODE_SHIFT)
136
137/*
138 * Macros for converting between kernel virtual addresses, socket local physical
139 * addresses, and UV global physical addresses.
140 * Note: use the standard __pa() & __va() macros for converting
141 * between socket virtual and socket physical addresses.
142 */
143
144/* socket phys RAM --> UV global physical address */
145static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
146{
147 if (paddr < uv_hub_info->lowmem_remap_top)
148 paddr += uv_hub_info->lowmem_remap_base;
149 return paddr | uv_hub_info->gnode_upper;
150}
151
152
153/* socket virtual --> UV global physical address */
154static inline unsigned long uv_gpa(void *v)
155{
156 return __pa(v) | uv_hub_info->gnode_upper;
157}
158
159/* socket virtual --> UV global physical address */
160static inline void *uv_vgpa(void *v)
161{
162 return (void *)uv_gpa(v);
163}
164
165/* UV global physical address --> socket virtual */
166static inline void *uv_va(unsigned long gpa)
167{
168 return __va(gpa & uv_hub_info->gpa_mask);
169}
170
171/* pnode, offset --> socket virtual */
172static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
173{
174 return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset);
175}
176
177
178/*
179 * Access global MMRs using the low memory MMR32 space. This region supports
180 * faster MMR access but not all MMRs are accessible in this space.
181 */
182static inline unsigned long *uv_global_mmr32_address(int pnode,
183 unsigned long offset)
184{
185 return __va(UV_GLOBAL_MMR32_BASE |
186 UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset);
187}
188
189static inline void uv_write_global_mmr32(int pnode, unsigned long offset,
190 unsigned long val)
191{
192 *uv_global_mmr32_address(pnode, offset) = val;
193}
194
195static inline unsigned long uv_read_global_mmr32(int pnode,
196 unsigned long offset)
197{
198 return *uv_global_mmr32_address(pnode, offset);
199}
200
201/*
202 * Access Global MMR space using the MMR space located at the top of physical
203 * memory.
204 */
205static inline unsigned long *uv_global_mmr64_address(int pnode,
206 unsigned long offset)
207{
208 return __va(UV_GLOBAL_MMR64_BASE |
209 UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset);
210}
211
212static inline void uv_write_global_mmr64(int pnode, unsigned long offset,
213 unsigned long val)
214{
215 *uv_global_mmr64_address(pnode, offset) = val;
216}
217
218static inline unsigned long uv_read_global_mmr64(int pnode,
219 unsigned long offset)
220{
221 return *uv_global_mmr64_address(pnode, offset);
222}
223
224/*
225 * Access hub local MMRs. Faster than using global space but only local MMRs
226 * are accessible.
227 */
228static inline unsigned long *uv_local_mmr_address(unsigned long offset)
229{
230 return __va(UV_LOCAL_MMR_BASE | offset);
231}
232
233static inline unsigned long uv_read_local_mmr(unsigned long offset)
234{
235 return *uv_local_mmr_address(offset);
236}
237
238static inline void uv_write_local_mmr(unsigned long offset, unsigned long val)
239{
240 *uv_local_mmr_address(offset) = val;
241}
242
243/*
244 * Structures and definitions for converting between cpu, node, pnode, and blade
245 * numbers.
246 */
247
248/* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */
249static inline int uv_blade_processor_id(void)
250{
251 return smp_processor_id();
252}
253
254/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
255static inline int uv_numa_blade_id(void)
256{
257 return 0;
258}
259
260/* Convert a cpu number to the the UV blade number */
261static inline int uv_cpu_to_blade_id(int cpu)
262{
263 return 0;
264}
265
266/* Convert linux node number to the UV blade number */
267static inline int uv_node_to_blade_id(int nid)
268{
269 return 0;
270}
271
272/* Convert a blade id to the PNODE of the blade */
273static inline int uv_blade_to_pnode(int bid)
274{
275 return 0;
276}
277
278/* Determine the number of possible cpus on a blade */
279static inline int uv_blade_nr_possible_cpus(int bid)
280{
281 return num_possible_cpus();
282}
283
284/* Determine the number of online cpus on a blade */
285static inline int uv_blade_nr_online_cpus(int bid)
286{
287 return num_online_cpus();
288}
289
290/* Convert a cpu id to the PNODE of the blade containing the cpu */
291static inline int uv_cpu_to_pnode(int cpu)
292{
293 return 0;
294}
295
296/* Convert a linux node number to the PNODE of the blade */
297static inline int uv_node_to_pnode(int nid)
298{
299 return 0;
300}
301
302/* Maximum possible number of blades */
303static inline int uv_num_possible_blades(void)
304{
305 return 1;
306}
307
308#endif /* __ASM_IA64_UV_HUB__ */
309
diff --git a/include/asm-ia64/uv/uv_mmrs.h b/include/asm-ia64/uv/uv_mmrs.h
new file mode 100644
index 000000000000..1cc1dbb0182f
--- /dev/null
+++ b/include/asm-ia64/uv/uv_mmrs.h
@@ -0,0 +1,266 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI UV MMR definitions
7 *
8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#ifndef __ASM_IA64_UV_MMRS__
12#define __ASM_IA64_UV_MMRS__
13
14/*
15 * AUTO GENERATED - Do not edit
16 */
17
18 #define UV_MMR_ENABLE (1UL << 63)
19
20/* ========================================================================= */
21/* UVH_NODE_ID */
22/* ========================================================================= */
23#define UVH_NODE_ID 0x0UL
24
25#define UVH_NODE_ID_FORCE1_SHFT 0
26#define UVH_NODE_ID_FORCE1_MASK 0x0000000000000001UL
27#define UVH_NODE_ID_MANUFACTURER_SHFT 1
28#define UVH_NODE_ID_MANUFACTURER_MASK 0x0000000000000ffeUL
29#define UVH_NODE_ID_PART_NUMBER_SHFT 12
30#define UVH_NODE_ID_PART_NUMBER_MASK 0x000000000ffff000UL
31#define UVH_NODE_ID_REVISION_SHFT 28
32#define UVH_NODE_ID_REVISION_MASK 0x00000000f0000000UL
33#define UVH_NODE_ID_NODE_ID_SHFT 32
34#define UVH_NODE_ID_NODE_ID_MASK 0x00007fff00000000UL
35#define UVH_NODE_ID_NODES_PER_BIT_SHFT 48
36#define UVH_NODE_ID_NODES_PER_BIT_MASK 0x007f000000000000UL
37#define UVH_NODE_ID_NI_PORT_SHFT 56
38#define UVH_NODE_ID_NI_PORT_MASK 0x0f00000000000000UL
39
40union uvh_node_id_u {
41 unsigned long v;
42 struct uvh_node_id_s {
43 unsigned long force1 : 1; /* RO */
44 unsigned long manufacturer : 11; /* RO */
45 unsigned long part_number : 16; /* RO */
46 unsigned long revision : 4; /* RO */
47 unsigned long node_id : 15; /* RW */
48 unsigned long rsvd_47 : 1; /* */
49 unsigned long nodes_per_bit : 7; /* RW */
50 unsigned long rsvd_55 : 1; /* */
51 unsigned long ni_port : 4; /* RO */
52 unsigned long rsvd_60_63 : 4; /* */
53 } s;
54};
55
56/* ========================================================================= */
57/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR */
58/* ========================================================================= */
59#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR 0x16000d0UL
60
61#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT 24
62#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_MASK 0x00003fffff000000UL
63
64union uvh_rh_gam_alias210_redirect_config_0_mmr_u {
65 unsigned long v;
66 struct uvh_rh_gam_alias210_redirect_config_0_mmr_s {
67 unsigned long rsvd_0_23 : 24; /* */
68 unsigned long dest_base : 22; /* RW */
69 unsigned long rsvd_46_63: 18; /* */
70 } s;
71};
72
73/* ========================================================================= */
74/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR */
75/* ========================================================================= */
76#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR 0x16000e0UL
77
78#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR_DEST_BASE_SHFT 24
79#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR_DEST_BASE_MASK 0x00003fffff000000UL
80
81union uvh_rh_gam_alias210_redirect_config_1_mmr_u {
82 unsigned long v;
83 struct uvh_rh_gam_alias210_redirect_config_1_mmr_s {
84 unsigned long rsvd_0_23 : 24; /* */
85 unsigned long dest_base : 22; /* RW */
86 unsigned long rsvd_46_63: 18; /* */
87 } s;
88};
89
90/* ========================================================================= */
91/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR */
92/* ========================================================================= */
93#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR 0x16000f0UL
94
95#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR_DEST_BASE_SHFT 24
96#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR_DEST_BASE_MASK 0x00003fffff000000UL
97
98union uvh_rh_gam_alias210_redirect_config_2_mmr_u {
99 unsigned long v;
100 struct uvh_rh_gam_alias210_redirect_config_2_mmr_s {
101 unsigned long rsvd_0_23 : 24; /* */
102 unsigned long dest_base : 22; /* RW */
103 unsigned long rsvd_46_63: 18; /* */
104 } s;
105};
106
107/* ========================================================================= */
108/* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */
109/* ========================================================================= */
110#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL
111
112#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT 28
113#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffff0000000UL
114#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_GR4_SHFT 46
115#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_GR4_MASK 0x0000400000000000UL
116#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_N_GRU_SHFT 52
117#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_N_GRU_MASK 0x00f0000000000000UL
118#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63
119#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL
120
121union uvh_rh_gam_gru_overlay_config_mmr_u {
122 unsigned long v;
123 struct uvh_rh_gam_gru_overlay_config_mmr_s {
124 unsigned long rsvd_0_27: 28; /* */
125 unsigned long base : 18; /* RW */
126 unsigned long gr4 : 1; /* RW */
127 unsigned long rsvd_47_51: 5; /* */
128 unsigned long n_gru : 4; /* RW */
129 unsigned long rsvd_56_62: 7; /* */
130 unsigned long enable : 1; /* RW */
131 } s;
132};
133
134/* ========================================================================= */
135/* UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR */
136/* ========================================================================= */
137#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR 0x1600028UL
138
139#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_BASE_SHFT 26
140#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffffc000000UL
141#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_DUAL_HUB_SHFT 46
142#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_DUAL_HUB_MASK 0x0000400000000000UL
143#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63
144#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL
145
146union uvh_rh_gam_mmr_overlay_config_mmr_u {
147 unsigned long v;
148 struct uvh_rh_gam_mmr_overlay_config_mmr_s {
149 unsigned long rsvd_0_25: 26; /* */
150 unsigned long base : 20; /* RW */
151 unsigned long dual_hub : 1; /* RW */
152 unsigned long rsvd_47_62: 16; /* */
153 unsigned long enable : 1; /* RW */
154 } s;
155};
156
157/* ========================================================================= */
158/* UVH_RTC */
159/* ========================================================================= */
160#define UVH_RTC 0x28000UL
161
162#define UVH_RTC_REAL_TIME_CLOCK_SHFT 0
163#define UVH_RTC_REAL_TIME_CLOCK_MASK 0x00ffffffffffffffUL
164
165union uvh_rtc_u {
166 unsigned long v;
167 struct uvh_rtc_s {
168 unsigned long real_time_clock : 56; /* RW */
169 unsigned long rsvd_56_63 : 8; /* */
170 } s;
171};
172
173/* ========================================================================= */
174/* UVH_SI_ADDR_MAP_CONFIG */
175/* ========================================================================= */
176#define UVH_SI_ADDR_MAP_CONFIG 0xc80000UL
177
178#define UVH_SI_ADDR_MAP_CONFIG_M_SKT_SHFT 0
179#define UVH_SI_ADDR_MAP_CONFIG_M_SKT_MASK 0x000000000000003fUL
180#define UVH_SI_ADDR_MAP_CONFIG_N_SKT_SHFT 8
181#define UVH_SI_ADDR_MAP_CONFIG_N_SKT_MASK 0x0000000000000f00UL
182
183union uvh_si_addr_map_config_u {
184 unsigned long v;
185 struct uvh_si_addr_map_config_s {
186 unsigned long m_skt : 6; /* RW */
187 unsigned long rsvd_6_7: 2; /* */
188 unsigned long n_skt : 4; /* RW */
189 unsigned long rsvd_12_63: 52; /* */
190 } s;
191};
192
193/* ========================================================================= */
194/* UVH_SI_ALIAS0_OVERLAY_CONFIG */
195/* ========================================================================= */
196#define UVH_SI_ALIAS0_OVERLAY_CONFIG 0xc80008UL
197
198#define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_SHFT 24
199#define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
200#define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_SHFT 48
201#define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
202#define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_SHFT 63
203#define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
204
205union uvh_si_alias0_overlay_config_u {
206 unsigned long v;
207 struct uvh_si_alias0_overlay_config_s {
208 unsigned long rsvd_0_23: 24; /* */
209 unsigned long base : 8; /* RW */
210 unsigned long rsvd_32_47: 16; /* */
211 unsigned long m_alias : 5; /* RW */
212 unsigned long rsvd_53_62: 10; /* */
213 unsigned long enable : 1; /* RW */
214 } s;
215};
216
217/* ========================================================================= */
218/* UVH_SI_ALIAS1_OVERLAY_CONFIG */
219/* ========================================================================= */
220#define UVH_SI_ALIAS1_OVERLAY_CONFIG 0xc80010UL
221
222#define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_SHFT 24
223#define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
224#define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_SHFT 48
225#define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
226#define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_SHFT 63
227#define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
228
229union uvh_si_alias1_overlay_config_u {
230 unsigned long v;
231 struct uvh_si_alias1_overlay_config_s {
232 unsigned long rsvd_0_23: 24; /* */
233 unsigned long base : 8; /* RW */
234 unsigned long rsvd_32_47: 16; /* */
235 unsigned long m_alias : 5; /* RW */
236 unsigned long rsvd_53_62: 10; /* */
237 unsigned long enable : 1; /* RW */
238 } s;
239};
240
241/* ========================================================================= */
242/* UVH_SI_ALIAS2_OVERLAY_CONFIG */
243/* ========================================================================= */
244#define UVH_SI_ALIAS2_OVERLAY_CONFIG 0xc80018UL
245
246#define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_SHFT 24
247#define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
248#define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_SHFT 48
249#define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
250#define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_SHFT 63
251#define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
252
253union uvh_si_alias2_overlay_config_u {
254 unsigned long v;
255 struct uvh_si_alias2_overlay_config_s {
256 unsigned long rsvd_0_23: 24; /* */
257 unsigned long base : 8; /* RW */
258 unsigned long rsvd_32_47: 16; /* */
259 unsigned long m_alias : 5; /* RW */
260 unsigned long rsvd_53_62: 10; /* */
261 unsigned long enable : 1; /* RW */
262 } s;
263};
264
265
266#endif /* __ASM_IA64_UV_MMRS__ */
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h
index bd8c83765a5c..1c7047bea200 100644
--- a/include/asm-m32r/uaccess.h
+++ b/include/asm-m32r/uaccess.h
@@ -14,6 +14,7 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/thread_info.h> 15#include <linux/thread_info.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/setup.h>
17 18
18#define VERIFY_READ 0 19#define VERIFY_READ 0
19#define VERIFY_WRITE 1 20#define VERIFY_WRITE 1
@@ -106,7 +107,6 @@ static inline void set_fs(mm_segment_t s)
106#else 107#else
107static inline int access_ok(int type, const void *addr, unsigned long size) 108static inline int access_ok(int type, const void *addr, unsigned long size)
108{ 109{
109 extern unsigned long memory_start, memory_end;
110 unsigned long val = (unsigned long)addr; 110 unsigned long val = (unsigned long)addr;
111 111
112 return ((val >= memory_start) && ((val + size) < memory_end)); 112 return ((val >= memory_start) && ((val + size) < memory_end));
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 83d1f286230b..3e8106442d5a 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -410,8 +410,49 @@ static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
410 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr)); 410 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
411 return (p - addr) * 32 + res; 411 return (p - addr) * 32 + res;
412} 412}
413#define ext2_find_next_bit(addr, size, off) \ 413
414 generic_find_next_le_bit((unsigned long *)(addr), (size), (off)) 414static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
415{
416 const unsigned long *p = vaddr, *addr = vaddr;
417 int res;
418
419 if (!size)
420 return 0;
421
422 size = (size >> 5) + ((size & 31) > 0);
423 while (*p++ == 0UL) {
424 if (--size == 0)
425 return (p - addr) << 5;
426 }
427
428 --p;
429 for (res = 0; res < 32; res++)
430 if (ext2_test_bit(res, p))
431 break;
432 return (p - addr) * 32 + res;
433}
434
435static inline int ext2_find_next_bit(const void *vaddr, unsigned size,
436 unsigned offset)
437{
438 const unsigned long *addr = vaddr;
439 const unsigned long *p = addr + (offset >> 5);
440 int bit = offset & 31UL, res;
441
442 if (offset >= size)
443 return size;
444
445 if (bit) {
446 /* Look for one in first longword */
447 for (res = bit; res < 32; res++)
448 if (ext2_test_bit(res, p))
449 return (p - addr) * 32 + res;
450 p++;
451 }
452 /* No set bit yet, search remaining full bytes for a set bit */
453 res = ext2_find_first_bit(p, size - 32 * (p - addr));
454 return (p - addr) * 32 + res;
455}
415 456
416#endif /* __KERNEL__ */ 457#endif /* __KERNEL__ */
417 458
diff --git a/include/asm-m68k/bug.h b/include/asm-m68k/bug.h
index 7b60776cc966..e5b528deb8a8 100644
--- a/include/asm-m68k/bug.h
+++ b/include/asm-m68k/bug.h
@@ -7,7 +7,7 @@
7#ifndef CONFIG_SUN3 7#ifndef CONFIG_SUN3
8#define BUG() do { \ 8#define BUG() do { \
9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
10 asm volatile("illegal"); \ 10 __builtin_trap(); \
11} while (0) 11} while (0)
12#else 12#else
13#define BUG() do { \ 13#define BUG() do { \
@@ -17,7 +17,7 @@
17#endif 17#endif
18#else 18#else
19#define BUG() do { \ 19#define BUG() do { \
20 asm volatile("illegal"); \ 20 __builtin_trap(); \
21} while (0) 21} while (0)
22#endif 22#endif
23 23
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index baf4f9b8acfc..657187f0c7c2 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -91,20 +91,20 @@ extern unsigned long gg2_isa_base;
91#undef MULTI_ISA 91#undef MULTI_ISA
92#endif 92#endif
93 93
94#define Q40_ISA (1) 94#define ISA_TYPE_Q40 (1)
95#define GG2_ISA (2) 95#define ISA_TYPE_GG2 (2)
96#define AG_ISA (3) 96#define ISA_TYPE_AG (3)
97 97
98#if defined(CONFIG_Q40) && !defined(MULTI_ISA) 98#if defined(CONFIG_Q40) && !defined(MULTI_ISA)
99#define ISA_TYPE Q40_ISA 99#define ISA_TYPE ISA_TYPE_Q40
100#define ISA_SEX 0 100#define ISA_SEX 0
101#endif 101#endif
102#if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA) 102#if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA)
103#define ISA_TYPE AG_ISA 103#define ISA_TYPE ISA_TYPE_AG
104#define ISA_SEX 1 104#define ISA_SEX 1
105#endif 105#endif
106#if defined(CONFIG_GG2) && !defined(MULTI_ISA) 106#if defined(CONFIG_GG2) && !defined(MULTI_ISA)
107#define ISA_TYPE GG2_ISA 107#define ISA_TYPE ISA_TYPE_GG2
108#define ISA_SEX 0 108#define ISA_SEX 0
109#endif 109#endif
110 110
@@ -126,13 +126,13 @@ static inline u8 __iomem *isa_itb(unsigned long addr)
126 switch(ISA_TYPE) 126 switch(ISA_TYPE)
127 { 127 {
128#ifdef CONFIG_Q40 128#ifdef CONFIG_Q40
129 case Q40_ISA: return (u8 __iomem *)Q40_ISA_IO_B(addr); 129 case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_IO_B(addr);
130#endif 130#endif
131#ifdef CONFIG_GG2 131#ifdef CONFIG_GG2
132 case GG2_ISA: return (u8 __iomem *)GG2_ISA_IO_B(addr); 132 case ISA_TYPE_GG2: return (u8 __iomem *)GG2_ISA_IO_B(addr);
133#endif 133#endif
134#ifdef CONFIG_AMIGA_PCMCIA 134#ifdef CONFIG_AMIGA_PCMCIA
135 case AG_ISA: return (u8 __iomem *)AG_ISA_IO_B(addr); 135 case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
136#endif 136#endif
137 default: return NULL; /* avoid warnings, just in case */ 137 default: return NULL; /* avoid warnings, just in case */
138 } 138 }
@@ -142,13 +142,13 @@ static inline u16 __iomem *isa_itw(unsigned long addr)
142 switch(ISA_TYPE) 142 switch(ISA_TYPE)
143 { 143 {
144#ifdef CONFIG_Q40 144#ifdef CONFIG_Q40
145 case Q40_ISA: return (u16 __iomem *)Q40_ISA_IO_W(addr); 145 case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_IO_W(addr);
146#endif 146#endif
147#ifdef CONFIG_GG2 147#ifdef CONFIG_GG2
148 case GG2_ISA: return (u16 __iomem *)GG2_ISA_IO_W(addr); 148 case ISA_TYPE_GG2: return (u16 __iomem *)GG2_ISA_IO_W(addr);
149#endif 149#endif
150#ifdef CONFIG_AMIGA_PCMCIA 150#ifdef CONFIG_AMIGA_PCMCIA
151 case AG_ISA: return (u16 __iomem *)AG_ISA_IO_W(addr); 151 case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
152#endif 152#endif
153 default: return NULL; /* avoid warnings, just in case */ 153 default: return NULL; /* avoid warnings, just in case */
154 } 154 }
@@ -158,7 +158,7 @@ static inline u32 __iomem *isa_itl(unsigned long addr)
158 switch(ISA_TYPE) 158 switch(ISA_TYPE)
159 { 159 {
160#ifdef CONFIG_AMIGA_PCMCIA 160#ifdef CONFIG_AMIGA_PCMCIA
161 case AG_ISA: return (u32 __iomem *)AG_ISA_IO_W(addr); 161 case ISA_TYPE_AG: return (u32 __iomem *)AG_ISA_IO_W(addr);
162#endif 162#endif
163 default: return 0; /* avoid warnings, just in case */ 163 default: return 0; /* avoid warnings, just in case */
164 } 164 }
@@ -168,13 +168,13 @@ static inline u8 __iomem *isa_mtb(unsigned long addr)
168 switch(ISA_TYPE) 168 switch(ISA_TYPE)
169 { 169 {
170#ifdef CONFIG_Q40 170#ifdef CONFIG_Q40
171 case Q40_ISA: return (u8 __iomem *)Q40_ISA_MEM_B(addr); 171 case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
172#endif 172#endif
173#ifdef CONFIG_GG2 173#ifdef CONFIG_GG2
174 case GG2_ISA: return (u8 __iomem *)GG2_ISA_MEM_B(addr); 174 case ISA_TYPE_GG2: return (u8 __iomem *)GG2_ISA_MEM_B(addr);
175#endif 175#endif
176#ifdef CONFIG_AMIGA_PCMCIA 176#ifdef CONFIG_AMIGA_PCMCIA
177 case AG_ISA: return (u8 __iomem *)addr; 177 case ISA_TYPE_AG: return (u8 __iomem *)addr;
178#endif 178#endif
179 default: return NULL; /* avoid warnings, just in case */ 179 default: return NULL; /* avoid warnings, just in case */
180 } 180 }
@@ -184,13 +184,13 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
184 switch(ISA_TYPE) 184 switch(ISA_TYPE)
185 { 185 {
186#ifdef CONFIG_Q40 186#ifdef CONFIG_Q40
187 case Q40_ISA: return (u16 __iomem *)Q40_ISA_MEM_W(addr); 187 case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
188#endif 188#endif
189#ifdef CONFIG_GG2 189#ifdef CONFIG_GG2
190 case GG2_ISA: return (u16 __iomem *)GG2_ISA_MEM_W(addr); 190 case ISA_TYPE_GG2: return (u16 __iomem *)GG2_ISA_MEM_W(addr);
191#endif 191#endif
192#ifdef CONFIG_AMIGA_PCMCIA 192#ifdef CONFIG_AMIGA_PCMCIA
193 case AG_ISA: return (u16 __iomem *)addr; 193 case ISA_TYPE_AG: return (u16 __iomem *)addr;
194#endif 194#endif
195 default: return NULL; /* avoid warnings, just in case */ 195 default: return NULL; /* avoid warnings, just in case */
196 } 196 }
@@ -218,13 +218,13 @@ static inline void isa_delay(void)
218 switch(ISA_TYPE) 218 switch(ISA_TYPE)
219 { 219 {
220#ifdef CONFIG_Q40 220#ifdef CONFIG_Q40
221 case Q40_ISA: isa_outb(0,0x80); break; 221 case ISA_TYPE_Q40: isa_outb(0,0x80); break;
222#endif 222#endif
223#ifdef CONFIG_GG2 223#ifdef CONFIG_GG2
224 case GG2_ISA: break; 224 case ISA_TYPE_GG2: break;
225#endif 225#endif
226#ifdef CONFIG_AMIGA_PCMCIA 226#ifdef CONFIG_AMIGA_PCMCIA
227 case AG_ISA: break; 227 case ISA_TYPE_AG: break;
228#endif 228#endif
229 default: break; /* avoid warnings */ 229 default: break; /* avoid warnings */
230 } 230 }
diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h
index 2a8853cd6554..4dfb3952b375 100644
--- a/include/asm-m68k/setup.h
+++ b/include/asm-m68k/setup.h
@@ -248,7 +248,7 @@ extern unsigned long m68k_machtype;
248#ifndef __ASSEMBLY__ 248#ifndef __ASSEMBLY__
249extern unsigned long m68k_cputype; 249extern unsigned long m68k_cputype;
250extern unsigned long m68k_fputype; 250extern unsigned long m68k_fputype;
251extern unsigned long m68k_mmutype; /* Not really used yet */ 251extern unsigned long m68k_mmutype;
252#ifdef CONFIG_VME 252#ifdef CONFIG_VME
253extern unsigned long vme_brdtype; 253extern unsigned long vme_brdtype;
254#endif 254#endif
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index 5c1264cf0c65..7107f3fbdbb6 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -14,7 +14,11 @@
14#define VERIFY_WRITE 1 14#define VERIFY_WRITE 1
15 15
16/* We let the MMU do all checking */ 16/* We let the MMU do all checking */
17#define access_ok(type,addr,size) 1 17static inline int access_ok(int type, const void __user *addr,
18 unsigned long size)
19{
20 return 1;
21}
18 22
19/* 23/*
20 * The exception table consists of pairs of addresses: the first is the 24 * The exception table consists of pairs of addresses: the first is the
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index c2bd126c3b4e..642724734eba 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -558,11 +558,13 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
558 __clear_bit(nr, addr); 558 __clear_bit(nr, addr);
559} 559}
560 560
561#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
562
561/* 563/*
562 * Return the bit position (0..63) of the most significant 1 bit in a word 564 * Return the bit position (0..63) of the most significant 1 bit in a word
563 * Returns -1 if no 1 bit exists 565 * Returns -1 if no 1 bit exists
564 */ 566 */
565static inline int __ilog2(unsigned long x) 567static inline unsigned long __fls(unsigned long x)
566{ 568{
567 int lz; 569 int lz;
568 570
@@ -591,13 +593,6 @@ static inline int __ilog2(unsigned long x)
591 return 63 - lz; 593 return 63 - lz;
592} 594}
593 595
594static inline unsigned long __fls(unsigned long x)
595{
596 return __ilog2(x);
597}
598
599#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
600
601/* 596/*
602 * __ffs - find first bit in word. 597 * __ffs - find first bit in word.
603 * @word: The word to search 598 * @word: The word to search
@@ -607,7 +602,7 @@ static inline unsigned long __fls(unsigned long x)
607 */ 602 */
608static inline unsigned long __ffs(unsigned long word) 603static inline unsigned long __ffs(unsigned long word)
609{ 604{
610 return __ilog2(word & -word); 605 return __fls(word & -word);
611} 606}
612 607
613/* 608/*
@@ -654,6 +649,7 @@ static inline int ffs(int word)
654#else 649#else
655 650
656#include <asm-generic/bitops/__ffs.h> 651#include <asm-generic/bitops/__ffs.h>
652#include <asm-generic/bitops/__fls.h>
657#include <asm-generic/bitops/ffs.h> 653#include <asm-generic/bitops/ffs.h>
658#include <asm-generic/bitops/fls.h> 654#include <asm-generic/bitops/fls.h>
659#include <asm-generic/bitops/fls64.h> 655#include <asm-generic/bitops/fls64.h>
diff --git a/include/asm-mips/compiler.h b/include/asm-mips/compiler.h
index aa6b876bbd78..71f5c5cfc58a 100644
--- a/include/asm-mips/compiler.h
+++ b/include/asm-mips/compiler.h
@@ -9,10 +9,10 @@
9#define _ASM_COMPILER_H 9#define _ASM_COMPILER_H
10 10
11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
12#define GCC_IMM_ASM "n" 12#define GCC_IMM_ASM() "n"
13#define GCC_REG_ACCUM "$0" 13#define GCC_REG_ACCUM "$0"
14#else 14#else
15#define GCC_IMM_ASM "rn" 15#define GCC_IMM_ASM() "rn"
16#define GCC_REG_ACCUM "accum" 16#define GCC_REG_ACCUM "accum"
17#endif 17#endif
18 18
diff --git a/include/asm-mips/gic.h b/include/asm-mips/gic.h
index 01b2f92dc33d..3a492f225f00 100644
--- a/include/asm-mips/gic.h
+++ b/include/asm-mips/gic.h
@@ -330,7 +330,7 @@
330 330
331#define GIC_SH_RMASK_OFS 0x0300 331#define GIC_SH_RMASK_OFS 0x0300
332#define GIC_CLR_INTR_MASK(intr, val) \ 332#define GIC_CLR_INTR_MASK(intr, val) \
333 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)) 333 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
334 334
335/* Register Map for Local Section */ 335/* Register Map for Local Section */
336#define GIC_VPE_CTL_OFS 0x0000 336#define GIC_VPE_CTL_OFS 0x0000
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index a05555165d05..1b5064dac007 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -40,8 +40,8 @@
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/types.h> 41#include <linux/types.h>
42 42
43#include <asm/io.h> 43#include <linux/io.h>
44#include <asm/irq.h> 44#include <linux/irq.h>
45 45
46/* cpu pipeline flush */ 46/* cpu pipeline flush */
47void static inline au_sync(void) 47void static inline au_sync(void)
@@ -63,32 +63,32 @@ void static inline au_sync_delay(int ms)
63 63
64void static inline au_writeb(u8 val, unsigned long reg) 64void static inline au_writeb(u8 val, unsigned long reg)
65{ 65{
66 *(volatile u8 *)(reg) = val; 66 *(volatile u8 *)reg = val;
67} 67}
68 68
69void static inline au_writew(u16 val, unsigned long reg) 69void static inline au_writew(u16 val, unsigned long reg)
70{ 70{
71 *(volatile u16 *)(reg) = val; 71 *(volatile u16 *)reg = val;
72} 72}
73 73
74void static inline au_writel(u32 val, unsigned long reg) 74void static inline au_writel(u32 val, unsigned long reg)
75{ 75{
76 *(volatile u32 *)(reg) = val; 76 *(volatile u32 *)reg = val;
77} 77}
78 78
79static inline u8 au_readb(unsigned long reg) 79static inline u8 au_readb(unsigned long reg)
80{ 80{
81 return (*(volatile u8 *)reg); 81 return *(volatile u8 *)reg;
82} 82}
83 83
84static inline u16 au_readw(unsigned long reg) 84static inline u16 au_readw(unsigned long reg)
85{ 85{
86 return (*(volatile u16 *)reg); 86 return *(volatile u16 *)reg;
87} 87}
88 88
89static inline u32 au_readl(unsigned long reg) 89static inline u32 au_readl(unsigned long reg)
90{ 90{
91 return (*(volatile u32 *)reg); 91 return *(volatile u32 *)reg;
92} 92}
93 93
94 94
@@ -117,76 +117,77 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
117#endif /* !defined (_LANGUAGE_ASSEMBLY) */ 117#endif /* !defined (_LANGUAGE_ASSEMBLY) */
118 118
119/* 119/*
120 * SDRAM Register Offsets 120 * SDRAM register offsets
121 */ 121 */
122#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 122#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
123#define MEM_SDMODE0 (0x0000) 123 defined(CONFIG_SOC_AU1100)
124#define MEM_SDMODE1 (0x0004) 124#define MEM_SDMODE0 0x0000
125#define MEM_SDMODE2 (0x0008) 125#define MEM_SDMODE1 0x0004
126#define MEM_SDADDR0 (0x000C) 126#define MEM_SDMODE2 0x0008
127#define MEM_SDADDR1 (0x0010) 127#define MEM_SDADDR0 0x000C
128#define MEM_SDADDR2 (0x0014) 128#define MEM_SDADDR1 0x0010
129#define MEM_SDREFCFG (0x0018) 129#define MEM_SDADDR2 0x0014
130#define MEM_SDPRECMD (0x001C) 130#define MEM_SDREFCFG 0x0018
131#define MEM_SDAUTOREF (0x0020) 131#define MEM_SDPRECMD 0x001C
132#define MEM_SDWRMD0 (0x0024) 132#define MEM_SDAUTOREF 0x0020
133#define MEM_SDWRMD1 (0x0028) 133#define MEM_SDWRMD0 0x0024
134#define MEM_SDWRMD2 (0x002C) 134#define MEM_SDWRMD1 0x0028
135#define MEM_SDSLEEP (0x0030) 135#define MEM_SDWRMD2 0x002C
136#define MEM_SDSMCKE (0x0034) 136#define MEM_SDSLEEP 0x0030
137#define MEM_SDSMCKE 0x0034
137 138
138/* 139/*
139 * MEM_SDMODE register content definitions 140 * MEM_SDMODE register content definitions
140 */ 141 */
141#define MEM_SDMODE_F (1<<22) 142#define MEM_SDMODE_F (1 << 22)
142#define MEM_SDMODE_SR (1<<21) 143#define MEM_SDMODE_SR (1 << 21)
143#define MEM_SDMODE_BS (1<<20) 144#define MEM_SDMODE_BS (1 << 20)
144#define MEM_SDMODE_RS (3<<18) 145#define MEM_SDMODE_RS (3 << 18)
145#define MEM_SDMODE_CS (7<<15) 146#define MEM_SDMODE_CS (7 << 15)
146#define MEM_SDMODE_TRAS (15<<11) 147#define MEM_SDMODE_TRAS (15 << 11)
147#define MEM_SDMODE_TMRD (3<<9) 148#define MEM_SDMODE_TMRD (3 << 9)
148#define MEM_SDMODE_TWR (3<<7) 149#define MEM_SDMODE_TWR (3 << 7)
149#define MEM_SDMODE_TRP (3<<5) 150#define MEM_SDMODE_TRP (3 << 5)
150#define MEM_SDMODE_TRCD (3<<3) 151#define MEM_SDMODE_TRCD (3 << 3)
151#define MEM_SDMODE_TCL (7<<0) 152#define MEM_SDMODE_TCL (7 << 0)
152 153
153#define MEM_SDMODE_BS_2Bank (0<<20) 154#define MEM_SDMODE_BS_2Bank (0 << 20)
154#define MEM_SDMODE_BS_4Bank (1<<20) 155#define MEM_SDMODE_BS_4Bank (1 << 20)
155#define MEM_SDMODE_RS_11Row (0<<18) 156#define MEM_SDMODE_RS_11Row (0 << 18)
156#define MEM_SDMODE_RS_12Row (1<<18) 157#define MEM_SDMODE_RS_12Row (1 << 18)
157#define MEM_SDMODE_RS_13Row (2<<18) 158#define MEM_SDMODE_RS_13Row (2 << 18)
158#define MEM_SDMODE_RS_N(N) ((N)<<18) 159#define MEM_SDMODE_RS_N(N) ((N) << 18)
159#define MEM_SDMODE_CS_7Col (0<<15) 160#define MEM_SDMODE_CS_7Col (0 << 15)
160#define MEM_SDMODE_CS_8Col (1<<15) 161#define MEM_SDMODE_CS_8Col (1 << 15)
161#define MEM_SDMODE_CS_9Col (2<<15) 162#define MEM_SDMODE_CS_9Col (2 << 15)
162#define MEM_SDMODE_CS_10Col (3<<15) 163#define MEM_SDMODE_CS_10Col (3 << 15)
163#define MEM_SDMODE_CS_11Col (4<<15) 164#define MEM_SDMODE_CS_11Col (4 << 15)
164#define MEM_SDMODE_CS_N(N) ((N)<<15) 165#define MEM_SDMODE_CS_N(N) ((N) << 15)
165#define MEM_SDMODE_TRAS_N(N) ((N)<<11) 166#define MEM_SDMODE_TRAS_N(N) ((N) << 11)
166#define MEM_SDMODE_TMRD_N(N) ((N)<<9) 167#define MEM_SDMODE_TMRD_N(N) ((N) << 9)
167#define MEM_SDMODE_TWR_N(N) ((N)<<7) 168#define MEM_SDMODE_TWR_N(N) ((N) << 7)
168#define MEM_SDMODE_TRP_N(N) ((N)<<5) 169#define MEM_SDMODE_TRP_N(N) ((N) << 5)
169#define MEM_SDMODE_TRCD_N(N) ((N)<<3) 170#define MEM_SDMODE_TRCD_N(N) ((N) << 3)
170#define MEM_SDMODE_TCL_N(N) ((N)<<0) 171#define MEM_SDMODE_TCL_N(N) ((N) << 0)
171 172
172/* 173/*
173 * MEM_SDADDR register contents definitions 174 * MEM_SDADDR register contents definitions
174 */ 175 */
175#define MEM_SDADDR_E (1<<20) 176#define MEM_SDADDR_E (1 << 20)
176#define MEM_SDADDR_CSBA (0x03FF<<10) 177#define MEM_SDADDR_CSBA (0x03FF << 10)
177#define MEM_SDADDR_CSMASK (0x03FF<<0) 178#define MEM_SDADDR_CSMASK (0x03FF << 0)
178#define MEM_SDADDR_CSBA_N(N) ((N)&(0x03FF<<22)>>12) 179#define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
179#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF<<22)>>22) 180#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
180 181
181/* 182/*
182 * MEM_SDREFCFG register content definitions 183 * MEM_SDREFCFG register content definitions
183 */ 184 */
184#define MEM_SDREFCFG_TRC (15<<28) 185#define MEM_SDREFCFG_TRC (15 << 28)
185#define MEM_SDREFCFG_TRPM (3<<26) 186#define MEM_SDREFCFG_TRPM (3 << 26)
186#define MEM_SDREFCFG_E (1<<25) 187#define MEM_SDREFCFG_E (1 << 25)
187#define MEM_SDREFCFG_RE (0x1ffffff<<0) 188#define MEM_SDREFCFG_RE (0x1ffffff << 0)
188#define MEM_SDREFCFG_TRC_N(N) ((N)<<MEM_SDREFCFG_TRC) 189#define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
189#define MEM_SDREFCFG_TRPM_N(N) ((N)<<MEM_SDREFCFG_TRPM) 190#define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
190#define MEM_SDREFCFG_REF_N(N) (N) 191#define MEM_SDREFCFG_REF_N(N) (N)
191#endif 192#endif
192 193
@@ -199,25 +200,25 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
199/***********************************************************************/ 200/***********************************************************************/
200 201
201#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) 202#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
202#define MEM_SDMODE0 (0x0800) 203#define MEM_SDMODE0 0x0800
203#define MEM_SDMODE1 (0x0808) 204#define MEM_SDMODE1 0x0808
204#define MEM_SDMODE2 (0x0810) 205#define MEM_SDMODE2 0x0810
205#define MEM_SDADDR0 (0x0820) 206#define MEM_SDADDR0 0x0820
206#define MEM_SDADDR1 (0x0828) 207#define MEM_SDADDR1 0x0828
207#define MEM_SDADDR2 (0x0830) 208#define MEM_SDADDR2 0x0830
208#define MEM_SDCONFIGA (0x0840) 209#define MEM_SDCONFIGA 0x0840
209#define MEM_SDCONFIGB (0x0848) 210#define MEM_SDCONFIGB 0x0848
210#define MEM_SDSTAT (0x0850) 211#define MEM_SDSTAT 0x0850
211#define MEM_SDERRADDR (0x0858) 212#define MEM_SDERRADDR 0x0858
212#define MEM_SDSTRIDE0 (0x0860) 213#define MEM_SDSTRIDE0 0x0860
213#define MEM_SDSTRIDE1 (0x0868) 214#define MEM_SDSTRIDE1 0x0868
214#define MEM_SDSTRIDE2 (0x0870) 215#define MEM_SDSTRIDE2 0x0870
215#define MEM_SDWRMD0 (0x0880) 216#define MEM_SDWRMD0 0x0880
216#define MEM_SDWRMD1 (0x0888) 217#define MEM_SDWRMD1 0x0888
217#define MEM_SDWRMD2 (0x0890) 218#define MEM_SDWRMD2 0x0890
218#define MEM_SDPRECMD (0x08C0) 219#define MEM_SDPRECMD 0x08C0
219#define MEM_SDAUTOREF (0x08C8) 220#define MEM_SDAUTOREF 0x08C8
220#define MEM_SDSREF (0x08D0) 221#define MEM_SDSREF 0x08D0
221#define MEM_SDSLEEP MEM_SDSREF 222#define MEM_SDSLEEP MEM_SDSREF
222 223
223#endif 224#endif
@@ -256,9 +257,9 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
256#define SSI0_PHYS_ADDR 0x11600000 257#define SSI0_PHYS_ADDR 0x11600000
257#define SSI1_PHYS_ADDR 0x11680000 258#define SSI1_PHYS_ADDR 0x11680000
258#define SYS_PHYS_ADDR 0x11900000 259#define SYS_PHYS_ADDR 0x11900000
259#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 260#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
260#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 261#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
261#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 262#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
262#endif 263#endif
263 264
264/********************************************************************/ 265/********************************************************************/
@@ -290,13 +291,13 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
290#define UART3_PHYS_ADDR 0x11400000 291#define UART3_PHYS_ADDR 0x11400000
291#define GPIO2_PHYS_ADDR 0x11700000 292#define GPIO2_PHYS_ADDR 0x11700000
292#define SYS_PHYS_ADDR 0x11900000 293#define SYS_PHYS_ADDR 0x11900000
293#define PCI_MEM_PHYS_ADDR 0x400000000ULL 294#define PCI_MEM_PHYS_ADDR 0x400000000ULL
294#define PCI_IO_PHYS_ADDR 0x500000000ULL 295#define PCI_IO_PHYS_ADDR 0x500000000ULL
295#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL 296#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
296#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL 297#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
297#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 298#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
298#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 299#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
299#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 300#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
300#endif 301#endif
301 302
302/********************************************************************/ 303/********************************************************************/
@@ -333,9 +334,9 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
333#define GPIO2_PHYS_ADDR 0x11700000 334#define GPIO2_PHYS_ADDR 0x11700000
334#define SYS_PHYS_ADDR 0x11900000 335#define SYS_PHYS_ADDR 0x11900000
335#define LCD_PHYS_ADDR 0x15000000 336#define LCD_PHYS_ADDR 0x15000000
336#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 337#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
337#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 338#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
338#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 339#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
339#endif 340#endif
340 341
341/***********************************************************************/ 342/***********************************************************************/
@@ -360,17 +361,17 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
360#define SYS_PHYS_ADDR 0x11900000 361#define SYS_PHYS_ADDR 0x11900000
361#define DDMA_PHYS_ADDR 0x14002000 362#define DDMA_PHYS_ADDR 0x14002000
362#define PE_PHYS_ADDR 0x14008000 363#define PE_PHYS_ADDR 0x14008000
363#define PSC0_PHYS_ADDR 0x11A00000 364#define PSC0_PHYS_ADDR 0x11A00000
364#define PSC1_PHYS_ADDR 0x11B00000 365#define PSC1_PHYS_ADDR 0x11B00000
365#define PSC2_PHYS_ADDR 0x10A00000 366#define PSC2_PHYS_ADDR 0x10A00000
366#define PSC3_PHYS_ADDR 0x10B00000 367#define PSC3_PHYS_ADDR 0x10B00000
367#define PCI_MEM_PHYS_ADDR 0x400000000ULL 368#define PCI_MEM_PHYS_ADDR 0x400000000ULL
368#define PCI_IO_PHYS_ADDR 0x500000000ULL 369#define PCI_IO_PHYS_ADDR 0x500000000ULL
369#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL 370#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
370#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL 371#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
371#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 372#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
372#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 373#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
373#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 374#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
374#endif 375#endif
375 376
376/***********************************************************************/ 377/***********************************************************************/
@@ -397,122 +398,121 @@ extern struct au1xxx_irqmap au1xxx_irq_map[];
397#define SWCNT_PHYS_ADDR 0x1110010C 398#define SWCNT_PHYS_ADDR 0x1110010C
398#define MAEFE_PHYS_ADDR 0x14012000 399#define MAEFE_PHYS_ADDR 0x14012000
399#define MAEBE_PHYS_ADDR 0x14010000 400#define MAEBE_PHYS_ADDR 0x14010000
400#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL 401#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
401#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL 402#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
402#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL 403#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
403#endif 404#endif
404 405
405
406/* Static Bus Controller */ 406/* Static Bus Controller */
407#define MEM_STCFG0 0xB4001000 407#define MEM_STCFG0 0xB4001000
408#define MEM_STTIME0 0xB4001004 408#define MEM_STTIME0 0xB4001004
409#define MEM_STADDR0 0xB4001008 409#define MEM_STADDR0 0xB4001008
410 410
411#define MEM_STCFG1 0xB4001010 411#define MEM_STCFG1 0xB4001010
412#define MEM_STTIME1 0xB4001014 412#define MEM_STTIME1 0xB4001014
413#define MEM_STADDR1 0xB4001018 413#define MEM_STADDR1 0xB4001018
414 414
415#define MEM_STCFG2 0xB4001020 415#define MEM_STCFG2 0xB4001020
416#define MEM_STTIME2 0xB4001024 416#define MEM_STTIME2 0xB4001024
417#define MEM_STADDR2 0xB4001028 417#define MEM_STADDR2 0xB4001028
418 418
419#define MEM_STCFG3 0xB4001030 419#define MEM_STCFG3 0xB4001030
420#define MEM_STTIME3 0xB4001034 420#define MEM_STTIME3 0xB4001034
421#define MEM_STADDR3 0xB4001038 421#define MEM_STADDR3 0xB4001038
422 422
423#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) 423#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
424#define MEM_STNDCTL 0xB4001100 424#define MEM_STNDCTL 0xB4001100
425#define MEM_STSTAT 0xB4001104 425#define MEM_STSTAT 0xB4001104
426 426
427#define MEM_STNAND_CMD (0x0) 427#define MEM_STNAND_CMD 0x0
428#define MEM_STNAND_ADDR (0x4) 428#define MEM_STNAND_ADDR 0x4
429#define MEM_STNAND_DATA (0x20) 429#define MEM_STNAND_DATA 0x20
430#endif 430#endif
431 431
432/* Interrupt Controller 0 */ 432/* Interrupt Controller 0 */
433#define IC0_CFG0RD 0xB0400040 433#define IC0_CFG0RD 0xB0400040
434#define IC0_CFG0SET 0xB0400040 434#define IC0_CFG0SET 0xB0400040
435#define IC0_CFG0CLR 0xB0400044 435#define IC0_CFG0CLR 0xB0400044
436 436
437#define IC0_CFG1RD 0xB0400048 437#define IC0_CFG1RD 0xB0400048
438#define IC0_CFG1SET 0xB0400048 438#define IC0_CFG1SET 0xB0400048
439#define IC0_CFG1CLR 0xB040004C 439#define IC0_CFG1CLR 0xB040004C
440 440
441#define IC0_CFG2RD 0xB0400050 441#define IC0_CFG2RD 0xB0400050
442#define IC0_CFG2SET 0xB0400050 442#define IC0_CFG2SET 0xB0400050
443#define IC0_CFG2CLR 0xB0400054 443#define IC0_CFG2CLR 0xB0400054
444 444
445#define IC0_REQ0INT 0xB0400054 445#define IC0_REQ0INT 0xB0400054
446#define IC0_SRCRD 0xB0400058 446#define IC0_SRCRD 0xB0400058
447#define IC0_SRCSET 0xB0400058 447#define IC0_SRCSET 0xB0400058
448#define IC0_SRCCLR 0xB040005C 448#define IC0_SRCCLR 0xB040005C
449#define IC0_REQ1INT 0xB040005C 449#define IC0_REQ1INT 0xB040005C
450 450
451#define IC0_ASSIGNRD 0xB0400060 451#define IC0_ASSIGNRD 0xB0400060
452#define IC0_ASSIGNSET 0xB0400060 452#define IC0_ASSIGNSET 0xB0400060
453#define IC0_ASSIGNCLR 0xB0400064 453#define IC0_ASSIGNCLR 0xB0400064
454 454
455#define IC0_WAKERD 0xB0400068 455#define IC0_WAKERD 0xB0400068
456#define IC0_WAKESET 0xB0400068 456#define IC0_WAKESET 0xB0400068
457#define IC0_WAKECLR 0xB040006C 457#define IC0_WAKECLR 0xB040006C
458 458
459#define IC0_MASKRD 0xB0400070 459#define IC0_MASKRD 0xB0400070
460#define IC0_MASKSET 0xB0400070 460#define IC0_MASKSET 0xB0400070
461#define IC0_MASKCLR 0xB0400074 461#define IC0_MASKCLR 0xB0400074
462 462
463#define IC0_RISINGRD 0xB0400078 463#define IC0_RISINGRD 0xB0400078
464#define IC0_RISINGCLR 0xB0400078 464#define IC0_RISINGCLR 0xB0400078
465#define IC0_FALLINGRD 0xB040007C 465#define IC0_FALLINGRD 0xB040007C
466#define IC0_FALLINGCLR 0xB040007C 466#define IC0_FALLINGCLR 0xB040007C
467 467
468#define IC0_TESTBIT 0xB0400080 468#define IC0_TESTBIT 0xB0400080
469 469
470/* Interrupt Controller 1 */ 470/* Interrupt Controller 1 */
471#define IC1_CFG0RD 0xB1800040 471#define IC1_CFG0RD 0xB1800040
472#define IC1_CFG0SET 0xB1800040 472#define IC1_CFG0SET 0xB1800040
473#define IC1_CFG0CLR 0xB1800044 473#define IC1_CFG0CLR 0xB1800044
474 474
475#define IC1_CFG1RD 0xB1800048 475#define IC1_CFG1RD 0xB1800048
476#define IC1_CFG1SET 0xB1800048 476#define IC1_CFG1SET 0xB1800048
477#define IC1_CFG1CLR 0xB180004C 477#define IC1_CFG1CLR 0xB180004C
478 478
479#define IC1_CFG2RD 0xB1800050 479#define IC1_CFG2RD 0xB1800050
480#define IC1_CFG2SET 0xB1800050 480#define IC1_CFG2SET 0xB1800050
481#define IC1_CFG2CLR 0xB1800054 481#define IC1_CFG2CLR 0xB1800054
482 482
483#define IC1_REQ0INT 0xB1800054 483#define IC1_REQ0INT 0xB1800054
484#define IC1_SRCRD 0xB1800058 484#define IC1_SRCRD 0xB1800058
485#define IC1_SRCSET 0xB1800058 485#define IC1_SRCSET 0xB1800058
486#define IC1_SRCCLR 0xB180005C 486#define IC1_SRCCLR 0xB180005C
487#define IC1_REQ1INT 0xB180005C 487#define IC1_REQ1INT 0xB180005C
488 488
489#define IC1_ASSIGNRD 0xB1800060 489#define IC1_ASSIGNRD 0xB1800060
490#define IC1_ASSIGNSET 0xB1800060 490#define IC1_ASSIGNSET 0xB1800060
491#define IC1_ASSIGNCLR 0xB1800064 491#define IC1_ASSIGNCLR 0xB1800064
492 492
493#define IC1_WAKERD 0xB1800068 493#define IC1_WAKERD 0xB1800068
494#define IC1_WAKESET 0xB1800068 494#define IC1_WAKESET 0xB1800068
495#define IC1_WAKECLR 0xB180006C 495#define IC1_WAKECLR 0xB180006C
496 496
497#define IC1_MASKRD 0xB1800070 497#define IC1_MASKRD 0xB1800070
498#define IC1_MASKSET 0xB1800070 498#define IC1_MASKSET 0xB1800070
499#define IC1_MASKCLR 0xB1800074 499#define IC1_MASKCLR 0xB1800074
500 500
501#define IC1_RISINGRD 0xB1800078 501#define IC1_RISINGRD 0xB1800078
502#define IC1_RISINGCLR 0xB1800078 502#define IC1_RISINGCLR 0xB1800078
503#define IC1_FALLINGRD 0xB180007C 503#define IC1_FALLINGRD 0xB180007C
504#define IC1_FALLINGCLR 0xB180007C 504#define IC1_FALLINGCLR 0xB180007C
505 505
506#define IC1_TESTBIT 0xB1800080 506#define IC1_TESTBIT 0xB1800080
507 507
508/* Interrupt Configuration Modes */ 508/* Interrupt Configuration Modes */
509#define INTC_INT_DISABLED 0 509#define INTC_INT_DISABLED 0x0
510#define INTC_INT_RISE_EDGE 0x1 510#define INTC_INT_RISE_EDGE 0x1
511#define INTC_INT_FALL_EDGE 0x2 511#define INTC_INT_FALL_EDGE 0x2
512#define INTC_INT_RISE_AND_FALL_EDGE 0x3 512#define INTC_INT_RISE_AND_FALL_EDGE 0x3
513#define INTC_INT_HIGH_LEVEL 0x5 513#define INTC_INT_HIGH_LEVEL 0x5
514#define INTC_INT_LOW_LEVEL 0x6 514#define INTC_INT_LOW_LEVEL 0x6
515#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7 515#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
516 516
517/* Interrupt Numbers */ 517/* Interrupt Numbers */
518/* Au1000 */ 518/* Au1000 */
@@ -579,18 +579,18 @@ enum soc_au1000_ints {
579 AU1000_GPIO_31, 579 AU1000_GPIO_31,
580}; 580};
581 581
582#define UART0_ADDR 0xB1100000 582#define UART0_ADDR 0xB1100000
583#define UART1_ADDR 0xB1200000 583#define UART1_ADDR 0xB1200000
584#define UART2_ADDR 0xB1300000 584#define UART2_ADDR 0xB1300000
585#define UART3_ADDR 0xB1400000 585#define UART3_ADDR 0xB1400000
586 586
587#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap 587#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
588#define USB_HOST_CONFIG 0xB017fffc 588#define USB_HOST_CONFIG 0xB017FFFC
589 589
590#define AU1000_ETH0_BASE 0xB0500000 590#define AU1000_ETH0_BASE 0xB0500000
591#define AU1000_ETH1_BASE 0xB0510000 591#define AU1000_ETH1_BASE 0xB0510000
592#define AU1000_MAC0_ENABLE 0xB0520000 592#define AU1000_MAC0_ENABLE 0xB0520000
593#define AU1000_MAC1_ENABLE 0xB0520004 593#define AU1000_MAC1_ENABLE 0xB0520004
594#define NUM_ETH_INTERFACES 2 594#define NUM_ETH_INTERFACES 2
595#endif /* CONFIG_SOC_AU1000 */ 595#endif /* CONFIG_SOC_AU1000 */
596 596
@@ -662,16 +662,16 @@ enum soc_au1500_ints {
662#define INTC AU1000_PCI_INTC 662#define INTC AU1000_PCI_INTC
663#define INTD AU1000_PCI_INTD 663#define INTD AU1000_PCI_INTD
664 664
665#define UART0_ADDR 0xB1100000 665#define UART0_ADDR 0xB1100000
666#define UART3_ADDR 0xB1400000 666#define UART3_ADDR 0xB1400000
667 667
668#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap 668#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
669#define USB_HOST_CONFIG 0xB017fffc 669#define USB_HOST_CONFIG 0xB017fffc
670 670
671#define AU1500_ETH0_BASE 0xB1500000 671#define AU1500_ETH0_BASE 0xB1500000
672#define AU1500_ETH1_BASE 0xB1510000 672#define AU1500_ETH1_BASE 0xB1510000
673#define AU1500_MAC0_ENABLE 0xB1520000 673#define AU1500_MAC0_ENABLE 0xB1520000
674#define AU1500_MAC1_ENABLE 0xB1520004 674#define AU1500_MAC1_ENABLE 0xB1520004
675#define NUM_ETH_INTERFACES 2 675#define NUM_ETH_INTERFACES 2
676#endif /* CONFIG_SOC_AU1500 */ 676#endif /* CONFIG_SOC_AU1500 */
677 677
@@ -739,15 +739,15 @@ enum soc_au1100_ints {
739 AU1000_GPIO_31, 739 AU1000_GPIO_31,
740}; 740};
741 741
742#define UART0_ADDR 0xB1100000 742#define UART0_ADDR 0xB1100000
743#define UART1_ADDR 0xB1200000 743#define UART1_ADDR 0xB1200000
744#define UART3_ADDR 0xB1400000 744#define UART3_ADDR 0xB1400000
745 745
746#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap 746#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
747#define USB_HOST_CONFIG 0xB017fffc 747#define USB_HOST_CONFIG 0xB017FFFC
748 748
749#define AU1100_ETH0_BASE 0xB0500000 749#define AU1100_ETH0_BASE 0xB0500000
750#define AU1100_MAC0_ENABLE 0xB0520000 750#define AU1100_MAC0_ENABLE 0xB0520000
751#define NUM_ETH_INTERFACES 1 751#define NUM_ETH_INTERFACES 1
752#endif /* CONFIG_SOC_AU1100 */ 752#endif /* CONFIG_SOC_AU1100 */
753 753
@@ -826,18 +826,18 @@ enum soc_au1550_ints {
826#define INTC AU1550_PCI_INTC 826#define INTC AU1550_PCI_INTC
827#define INTD AU1550_PCI_INTD 827#define INTD AU1550_PCI_INTD
828 828
829#define UART0_ADDR 0xB1100000 829#define UART0_ADDR 0xB1100000
830#define UART1_ADDR 0xB1200000 830#define UART1_ADDR 0xB1200000
831#define UART3_ADDR 0xB1400000 831#define UART3_ADDR 0xB1400000
832 832
833#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap 833#define USB_OHCI_BASE 0x14020000 /* phys addr for ioremap */
834#define USB_OHCI_LEN 0x00060000 834#define USB_OHCI_LEN 0x00060000
835#define USB_HOST_CONFIG 0xB4027ffc 835#define USB_HOST_CONFIG 0xB4027ffc
836 836
837#define AU1550_ETH0_BASE 0xB0500000 837#define AU1550_ETH0_BASE 0xB0500000
838#define AU1550_ETH1_BASE 0xB0510000 838#define AU1550_ETH1_BASE 0xB0510000
839#define AU1550_MAC0_ENABLE 0xB0520000 839#define AU1550_MAC0_ENABLE 0xB0520000
840#define AU1550_MAC1_ENABLE 0xB0520004 840#define AU1550_MAC1_ENABLE 0xB0520004
841#define NUM_ETH_INTERFACES 2 841#define NUM_ETH_INTERFACES 2
842#endif /* CONFIG_SOC_AU1550 */ 842#endif /* CONFIG_SOC_AU1550 */
843 843
@@ -911,32 +911,32 @@ enum soc_au1200_ints {
911 AU1000_GPIO_31, 911 AU1000_GPIO_31,
912}; 912};
913 913
914#define UART0_ADDR 0xB1100000 914#define UART0_ADDR 0xB1100000
915#define UART1_ADDR 0xB1200000 915#define UART1_ADDR 0xB1200000
916 916
917#define USB_UOC_BASE 0x14020020 917#define USB_UOC_BASE 0x14020020
918#define USB_UOC_LEN 0x20 918#define USB_UOC_LEN 0x20
919#define USB_OHCI_BASE 0x14020100 919#define USB_OHCI_BASE 0x14020100
920#define USB_OHCI_LEN 0x100 920#define USB_OHCI_LEN 0x100
921#define USB_EHCI_BASE 0x14020200 921#define USB_EHCI_BASE 0x14020200
922#define USB_EHCI_LEN 0x100 922#define USB_EHCI_LEN 0x100
923#define USB_UDC_BASE 0x14022000 923#define USB_UDC_BASE 0x14022000
924#define USB_UDC_LEN 0x2000 924#define USB_UDC_LEN 0x2000
925#define USB_MSR_BASE 0xB4020000 925#define USB_MSR_BASE 0xB4020000
926#define USB_MSR_MCFG 4 926#define USB_MSR_MCFG 4
927#define USBMSRMCFG_OMEMEN 0 927#define USBMSRMCFG_OMEMEN 0
928#define USBMSRMCFG_OBMEN 1 928#define USBMSRMCFG_OBMEN 1
929#define USBMSRMCFG_EMEMEN 2 929#define USBMSRMCFG_EMEMEN 2
930#define USBMSRMCFG_EBMEN 3 930#define USBMSRMCFG_EBMEN 3
931#define USBMSRMCFG_DMEMEN 4 931#define USBMSRMCFG_DMEMEN 4
932#define USBMSRMCFG_DBMEN 5 932#define USBMSRMCFG_DBMEN 5
933#define USBMSRMCFG_GMEMEN 6 933#define USBMSRMCFG_GMEMEN 6
934#define USBMSRMCFG_OHCCLKEN 16 934#define USBMSRMCFG_OHCCLKEN 16
935#define USBMSRMCFG_EHCCLKEN 17 935#define USBMSRMCFG_EHCCLKEN 17
936#define USBMSRMCFG_UDCCLKEN 18 936#define USBMSRMCFG_UDCCLKEN 18
937#define USBMSRMCFG_PHYPLLEN 19 937#define USBMSRMCFG_PHYPLLEN 19
938#define USBMSRMCFG_RDCOMB 30 938#define USBMSRMCFG_RDCOMB 30
939#define USBMSRMCFG_PFEN 31 939#define USBMSRMCFG_PFEN 31
940 940
941#endif /* CONFIG_SOC_AU1200 */ 941#endif /* CONFIG_SOC_AU1200 */
942 942
@@ -949,259 +949,258 @@ enum soc_au1200_ints {
949#define INTX 0xFF /* not valid */ 949#define INTX 0xFF /* not valid */
950 950
951/* Programmable Counters 0 and 1 */ 951/* Programmable Counters 0 and 1 */
952#define SYS_BASE 0xB1900000 952#define SYS_BASE 0xB1900000
953#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14) 953#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
954# define SYS_CNTRL_E1S (1<<23) 954# define SYS_CNTRL_E1S (1 << 23)
955# define SYS_CNTRL_T1S (1<<20) 955# define SYS_CNTRL_T1S (1 << 20)
956# define SYS_CNTRL_M21 (1<<19) 956# define SYS_CNTRL_M21 (1 << 19)
957# define SYS_CNTRL_M11 (1<<18) 957# define SYS_CNTRL_M11 (1 << 18)
958# define SYS_CNTRL_M01 (1<<17) 958# define SYS_CNTRL_M01 (1 << 17)
959# define SYS_CNTRL_C1S (1<<16) 959# define SYS_CNTRL_C1S (1 << 16)
960# define SYS_CNTRL_BP (1<<14) 960# define SYS_CNTRL_BP (1 << 14)
961# define SYS_CNTRL_EN1 (1<<13) 961# define SYS_CNTRL_EN1 (1 << 13)
962# define SYS_CNTRL_BT1 (1<<12) 962# define SYS_CNTRL_BT1 (1 << 12)
963# define SYS_CNTRL_EN0 (1<<11) 963# define SYS_CNTRL_EN0 (1 << 11)
964# define SYS_CNTRL_BT0 (1<<10) 964# define SYS_CNTRL_BT0 (1 << 10)
965# define SYS_CNTRL_E0 (1<<8) 965# define SYS_CNTRL_E0 (1 << 8)
966# define SYS_CNTRL_E0S (1<<7) 966# define SYS_CNTRL_E0S (1 << 7)
967# define SYS_CNTRL_32S (1<<5) 967# define SYS_CNTRL_32S (1 << 5)
968# define SYS_CNTRL_T0S (1<<4) 968# define SYS_CNTRL_T0S (1 << 4)
969# define SYS_CNTRL_M20 (1<<3) 969# define SYS_CNTRL_M20 (1 << 3)
970# define SYS_CNTRL_M10 (1<<2) 970# define SYS_CNTRL_M10 (1 << 2)
971# define SYS_CNTRL_M00 (1<<1) 971# define SYS_CNTRL_M00 (1 << 1)
972# define SYS_CNTRL_C0S (1<<0) 972# define SYS_CNTRL_C0S (1 << 0)
973 973
974/* Programmable Counter 0 Registers */ 974/* Programmable Counter 0 Registers */
975#define SYS_TOYTRIM (SYS_BASE + 0) 975#define SYS_TOYTRIM (SYS_BASE + 0)
976#define SYS_TOYWRITE (SYS_BASE + 4) 976#define SYS_TOYWRITE (SYS_BASE + 4)
977#define SYS_TOYMATCH0 (SYS_BASE + 8) 977#define SYS_TOYMATCH0 (SYS_BASE + 8)
978#define SYS_TOYMATCH1 (SYS_BASE + 0xC) 978#define SYS_TOYMATCH1 (SYS_BASE + 0xC)
979#define SYS_TOYMATCH2 (SYS_BASE + 0x10) 979#define SYS_TOYMATCH2 (SYS_BASE + 0x10)
980#define SYS_TOYREAD (SYS_BASE + 0x40) 980#define SYS_TOYREAD (SYS_BASE + 0x40)
981 981
982/* Programmable Counter 1 Registers */ 982/* Programmable Counter 1 Registers */
983#define SYS_RTCTRIM (SYS_BASE + 0x44) 983#define SYS_RTCTRIM (SYS_BASE + 0x44)
984#define SYS_RTCWRITE (SYS_BASE + 0x48) 984#define SYS_RTCWRITE (SYS_BASE + 0x48)
985#define SYS_RTCMATCH0 (SYS_BASE + 0x4C) 985#define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
986#define SYS_RTCMATCH1 (SYS_BASE + 0x50) 986#define SYS_RTCMATCH1 (SYS_BASE + 0x50)
987#define SYS_RTCMATCH2 (SYS_BASE + 0x54) 987#define SYS_RTCMATCH2 (SYS_BASE + 0x54)
988#define SYS_RTCREAD (SYS_BASE + 0x58) 988#define SYS_RTCREAD (SYS_BASE + 0x58)
989 989
990/* I2S Controller */ 990/* I2S Controller */
991#define I2S_DATA 0xB1000000 991#define I2S_DATA 0xB1000000
992# define I2S_DATA_MASK (0xffffff) 992# define I2S_DATA_MASK 0xffffff
993#define I2S_CONFIG 0xB1000004 993#define I2S_CONFIG 0xB1000004
994# define I2S_CONFIG_XU (1<<25) 994# define I2S_CONFIG_XU (1 << 25)
995# define I2S_CONFIG_XO (1<<24) 995# define I2S_CONFIG_XO (1 << 24)
996# define I2S_CONFIG_RU (1<<23) 996# define I2S_CONFIG_RU (1 << 23)
997# define I2S_CONFIG_RO (1<<22) 997# define I2S_CONFIG_RO (1 << 22)
998# define I2S_CONFIG_TR (1<<21) 998# define I2S_CONFIG_TR (1 << 21)
999# define I2S_CONFIG_TE (1<<20) 999# define I2S_CONFIG_TE (1 << 20)
1000# define I2S_CONFIG_TF (1<<19) 1000# define I2S_CONFIG_TF (1 << 19)
1001# define I2S_CONFIG_RR (1<<18) 1001# define I2S_CONFIG_RR (1 << 18)
1002# define I2S_CONFIG_RE (1<<17) 1002# define I2S_CONFIG_RE (1 << 17)
1003# define I2S_CONFIG_RF (1<<16) 1003# define I2S_CONFIG_RF (1 << 16)
1004# define I2S_CONFIG_PD (1<<11) 1004# define I2S_CONFIG_PD (1 << 11)
1005# define I2S_CONFIG_LB (1<<10) 1005# define I2S_CONFIG_LB (1 << 10)
1006# define I2S_CONFIG_IC (1<<9) 1006# define I2S_CONFIG_IC (1 << 9)
1007# define I2S_CONFIG_FM_BIT 7 1007# define I2S_CONFIG_FM_BIT 7
1008# define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT) 1008# define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
1009# define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT) 1009# define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
1010# define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT) 1010# define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
1011# define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT) 1011# define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
1012# define I2S_CONFIG_TN (1<<6) 1012# define I2S_CONFIG_TN (1 << 6)
1013# define I2S_CONFIG_RN (1<<5) 1013# define I2S_CONFIG_RN (1 << 5)
1014# define I2S_CONFIG_SZ_BIT 0 1014# define I2S_CONFIG_SZ_BIT 0
1015# define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT) 1015# define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
1016 1016
1017#define I2S_CONTROL 0xB1000008 1017#define I2S_CONTROL 0xB1000008
1018# define I2S_CONTROL_D (1<<1) 1018# define I2S_CONTROL_D (1 << 1)
1019# define I2S_CONTROL_CE (1<<0) 1019# define I2S_CONTROL_CE (1 << 0)
1020 1020
1021/* USB Host Controller */ 1021/* USB Host Controller */
1022#ifndef USB_OHCI_LEN 1022#ifndef USB_OHCI_LEN
1023#define USB_OHCI_LEN 0x00100000 1023#define USB_OHCI_LEN 0x00100000
1024#endif 1024#endif
1025 1025
1026#ifndef CONFIG_SOC_AU1200 1026#ifndef CONFIG_SOC_AU1200
1027 1027
1028/* USB Device Controller */ 1028/* USB Device Controller */
1029#define USBD_EP0RD 0xB0200000 1029#define USBD_EP0RD 0xB0200000
1030#define USBD_EP0WR 0xB0200004 1030#define USBD_EP0WR 0xB0200004
1031#define USBD_EP2WR 0xB0200008 1031#define USBD_EP2WR 0xB0200008
1032#define USBD_EP3WR 0xB020000C 1032#define USBD_EP3WR 0xB020000C
1033#define USBD_EP4RD 0xB0200010 1033#define USBD_EP4RD 0xB0200010
1034#define USBD_EP5RD 0xB0200014 1034#define USBD_EP5RD 0xB0200014
1035#define USBD_INTEN 0xB0200018 1035#define USBD_INTEN 0xB0200018
1036#define USBD_INTSTAT 0xB020001C 1036#define USBD_INTSTAT 0xB020001C
1037# define USBDEV_INT_SOF (1<<12) 1037# define USBDEV_INT_SOF (1 << 12)
1038# define USBDEV_INT_HF_BIT 6 1038# define USBDEV_INT_HF_BIT 6
1039# define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT) 1039# define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
1040# define USBDEV_INT_CMPLT_BIT 0 1040# define USBDEV_INT_CMPLT_BIT 0
1041# define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT) 1041# define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
1042#define USBD_CONFIG 0xB0200020 1042#define USBD_CONFIG 0xB0200020
1043#define USBD_EP0CS 0xB0200024 1043#define USBD_EP0CS 0xB0200024
1044#define USBD_EP2CS 0xB0200028 1044#define USBD_EP2CS 0xB0200028
1045#define USBD_EP3CS 0xB020002C 1045#define USBD_EP3CS 0xB020002C
1046#define USBD_EP4CS 0xB0200030 1046#define USBD_EP4CS 0xB0200030
1047#define USBD_EP5CS 0xB0200034 1047#define USBD_EP5CS 0xB0200034
1048# define USBDEV_CS_SU (1<<14) 1048# define USBDEV_CS_SU (1 << 14)
1049# define USBDEV_CS_NAK (1<<13) 1049# define USBDEV_CS_NAK (1 << 13)
1050# define USBDEV_CS_ACK (1<<12) 1050# define USBDEV_CS_ACK (1 << 12)
1051# define USBDEV_CS_BUSY (1<<11) 1051# define USBDEV_CS_BUSY (1 << 11)
1052# define USBDEV_CS_TSIZE_BIT 1 1052# define USBDEV_CS_TSIZE_BIT 1
1053# define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT) 1053# define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
1054# define USBDEV_CS_STALL (1<<0) 1054# define USBDEV_CS_STALL (1 << 0)
1055#define USBD_EP0RDSTAT 0xB0200040 1055#define USBD_EP0RDSTAT 0xB0200040
1056#define USBD_EP0WRSTAT 0xB0200044 1056#define USBD_EP0WRSTAT 0xB0200044
1057#define USBD_EP2WRSTAT 0xB0200048 1057#define USBD_EP2WRSTAT 0xB0200048
1058#define USBD_EP3WRSTAT 0xB020004C 1058#define USBD_EP3WRSTAT 0xB020004C
1059#define USBD_EP4RDSTAT 0xB0200050 1059#define USBD_EP4RDSTAT 0xB0200050
1060#define USBD_EP5RDSTAT 0xB0200054 1060#define USBD_EP5RDSTAT 0xB0200054
1061# define USBDEV_FSTAT_FLUSH (1<<6) 1061# define USBDEV_FSTAT_FLUSH (1 << 6)
1062# define USBDEV_FSTAT_UF (1<<5) 1062# define USBDEV_FSTAT_UF (1 << 5)
1063# define USBDEV_FSTAT_OF (1<<4) 1063# define USBDEV_FSTAT_OF (1 << 4)
1064# define USBDEV_FSTAT_FCNT_BIT 0 1064# define USBDEV_FSTAT_FCNT_BIT 0
1065# define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT) 1065# define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
1066#define USBD_ENABLE 0xB0200058 1066#define USBD_ENABLE 0xB0200058
1067# define USBDEV_ENABLE (1<<1) 1067# define USBDEV_ENABLE (1 << 1)
1068# define USBDEV_CE (1<<0) 1068# define USBDEV_CE (1 << 0)
1069 1069
1070#endif /* !CONFIG_SOC_AU1200 */ 1070#endif /* !CONFIG_SOC_AU1200 */
1071 1071
1072/* Ethernet Controllers */ 1072/* Ethernet Controllers */
1073 1073
1074/* 4 byte offsets from AU1000_ETH_BASE */ 1074/* 4 byte offsets from AU1000_ETH_BASE */
1075#define MAC_CONTROL 0x0 1075#define MAC_CONTROL 0x0
1076# define MAC_RX_ENABLE (1<<2) 1076# define MAC_RX_ENABLE (1 << 2)
1077# define MAC_TX_ENABLE (1<<3) 1077# define MAC_TX_ENABLE (1 << 3)
1078# define MAC_DEF_CHECK (1<<5) 1078# define MAC_DEF_CHECK (1 << 5)
1079# define MAC_SET_BL(X) (((X)&0x3)<<6) 1079# define MAC_SET_BL(X) (((X) & 0x3) << 6)
1080# define MAC_AUTO_PAD (1<<8) 1080# define MAC_AUTO_PAD (1 << 8)
1081# define MAC_DISABLE_RETRY (1<<10) 1081# define MAC_DISABLE_RETRY (1 << 10)
1082# define MAC_DISABLE_BCAST (1<<11) 1082# define MAC_DISABLE_BCAST (1 << 11)
1083# define MAC_LATE_COL (1<<12) 1083# define MAC_LATE_COL (1 << 12)
1084# define MAC_HASH_MODE (1<<13) 1084# define MAC_HASH_MODE (1 << 13)
1085# define MAC_HASH_ONLY (1<<15) 1085# define MAC_HASH_ONLY (1 << 15)
1086# define MAC_PASS_ALL (1<<16) 1086# define MAC_PASS_ALL (1 << 16)
1087# define MAC_INVERSE_FILTER (1<<17) 1087# define MAC_INVERSE_FILTER (1 << 17)
1088# define MAC_PROMISCUOUS (1<<18) 1088# define MAC_PROMISCUOUS (1 << 18)
1089# define MAC_PASS_ALL_MULTI (1<<19) 1089# define MAC_PASS_ALL_MULTI (1 << 19)
1090# define MAC_FULL_DUPLEX (1<<20) 1090# define MAC_FULL_DUPLEX (1 << 20)
1091# define MAC_NORMAL_MODE 0 1091# define MAC_NORMAL_MODE 0
1092# define MAC_INT_LOOPBACK (1<<21) 1092# define MAC_INT_LOOPBACK (1 << 21)
1093# define MAC_EXT_LOOPBACK (1<<22) 1093# define MAC_EXT_LOOPBACK (1 << 22)
1094# define MAC_DISABLE_RX_OWN (1<<23) 1094# define MAC_DISABLE_RX_OWN (1 << 23)
1095# define MAC_BIG_ENDIAN (1<<30) 1095# define MAC_BIG_ENDIAN (1 << 30)
1096# define MAC_RX_ALL (1<<31) 1096# define MAC_RX_ALL (1 << 31)
1097#define MAC_ADDRESS_HIGH 0x4 1097#define MAC_ADDRESS_HIGH 0x4
1098#define MAC_ADDRESS_LOW 0x8 1098#define MAC_ADDRESS_LOW 0x8
1099#define MAC_MCAST_HIGH 0xC 1099#define MAC_MCAST_HIGH 0xC
1100#define MAC_MCAST_LOW 0x10 1100#define MAC_MCAST_LOW 0x10
1101#define MAC_MII_CNTRL 0x14 1101#define MAC_MII_CNTRL 0x14
1102# define MAC_MII_BUSY (1<<0) 1102# define MAC_MII_BUSY (1 << 0)
1103# define MAC_MII_READ 0 1103# define MAC_MII_READ 0
1104# define MAC_MII_WRITE (1<<1) 1104# define MAC_MII_WRITE (1 << 1)
1105# define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6) 1105# define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
1106# define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11) 1106# define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
1107#define MAC_MII_DATA 0x18 1107#define MAC_MII_DATA 0x18
1108#define MAC_FLOW_CNTRL 0x1C 1108#define MAC_FLOW_CNTRL 0x1C
1109# define MAC_FLOW_CNTRL_BUSY (1<<0) 1109# define MAC_FLOW_CNTRL_BUSY (1 << 0)
1110# define MAC_FLOW_CNTRL_ENABLE (1<<1) 1110# define MAC_FLOW_CNTRL_ENABLE (1 << 1)
1111# define MAC_PASS_CONTROL (1<<2) 1111# define MAC_PASS_CONTROL (1 << 2)
1112# define MAC_SET_PAUSE(X) (((X)&0xffff)<<16) 1112# define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
1113#define MAC_VLAN1_TAG 0x20 1113#define MAC_VLAN1_TAG 0x20
1114#define MAC_VLAN2_TAG 0x24 1114#define MAC_VLAN2_TAG 0x24
1115 1115
1116/* Ethernet Controller Enable */ 1116/* Ethernet Controller Enable */
1117 1117
1118# define MAC_EN_CLOCK_ENABLE (1<<0) 1118# define MAC_EN_CLOCK_ENABLE (1 << 0)
1119# define MAC_EN_RESET0 (1<<1) 1119# define MAC_EN_RESET0 (1 << 1)
1120# define MAC_EN_TOSS (0<<2) 1120# define MAC_EN_TOSS (0 << 2)
1121# define MAC_EN_CACHEABLE (1<<3) 1121# define MAC_EN_CACHEABLE (1 << 3)
1122# define MAC_EN_RESET1 (1<<4) 1122# define MAC_EN_RESET1 (1 << 4)
1123# define MAC_EN_RESET2 (1<<5) 1123# define MAC_EN_RESET2 (1 << 5)
1124# define MAC_DMA_RESET (1<<6) 1124# define MAC_DMA_RESET (1 << 6)
1125 1125
1126/* Ethernet Controller DMA Channels */ 1126/* Ethernet Controller DMA Channels */
1127 1127
1128#define MAC0_TX_DMA_ADDR 0xB4004000 1128#define MAC0_TX_DMA_ADDR 0xB4004000
1129#define MAC1_TX_DMA_ADDR 0xB4004200 1129#define MAC1_TX_DMA_ADDR 0xB4004200
1130/* offsets from MAC_TX_RING_ADDR address */ 1130/* offsets from MAC_TX_RING_ADDR address */
1131#define MAC_TX_BUFF0_STATUS 0x0 1131#define MAC_TX_BUFF0_STATUS 0x0
1132# define TX_FRAME_ABORTED (1<<0) 1132# define TX_FRAME_ABORTED (1 << 0)
1133# define TX_JAB_TIMEOUT (1<<1) 1133# define TX_JAB_TIMEOUT (1 << 1)
1134# define TX_NO_CARRIER (1<<2) 1134# define TX_NO_CARRIER (1 << 2)
1135# define TX_LOSS_CARRIER (1<<3) 1135# define TX_LOSS_CARRIER (1 << 3)
1136# define TX_EXC_DEF (1<<4) 1136# define TX_EXC_DEF (1 << 4)
1137# define TX_LATE_COLL_ABORT (1<<5) 1137# define TX_LATE_COLL_ABORT (1 << 5)
1138# define TX_EXC_COLL (1<<6) 1138# define TX_EXC_COLL (1 << 6)
1139# define TX_UNDERRUN (1<<7) 1139# define TX_UNDERRUN (1 << 7)
1140# define TX_DEFERRED (1<<8) 1140# define TX_DEFERRED (1 << 8)
1141# define TX_LATE_COLL (1<<9) 1141# define TX_LATE_COLL (1 << 9)
1142# define TX_COLL_CNT_MASK (0xF<<10) 1142# define TX_COLL_CNT_MASK (0xF << 10)
1143# define TX_PKT_RETRY (1<<31) 1143# define TX_PKT_RETRY (1 << 31)
1144#define MAC_TX_BUFF0_ADDR 0x4 1144#define MAC_TX_BUFF0_ADDR 0x4
1145# define TX_DMA_ENABLE (1<<0) 1145# define TX_DMA_ENABLE (1 << 0)
1146# define TX_T_DONE (1<<1) 1146# define TX_T_DONE (1 << 1)
1147# define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3) 1147# define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1148#define MAC_TX_BUFF0_LEN 0x8 1148#define MAC_TX_BUFF0_LEN 0x8
1149#define MAC_TX_BUFF1_STATUS 0x10 1149#define MAC_TX_BUFF1_STATUS 0x10
1150#define MAC_TX_BUFF1_ADDR 0x14 1150#define MAC_TX_BUFF1_ADDR 0x14
1151#define MAC_TX_BUFF1_LEN 0x18 1151#define MAC_TX_BUFF1_LEN 0x18
1152#define MAC_TX_BUFF2_STATUS 0x20 1152#define MAC_TX_BUFF2_STATUS 0x20
1153#define MAC_TX_BUFF2_ADDR 0x24 1153#define MAC_TX_BUFF2_ADDR 0x24
1154#define MAC_TX_BUFF2_LEN 0x28 1154#define MAC_TX_BUFF2_LEN 0x28
1155#define MAC_TX_BUFF3_STATUS 0x30 1155#define MAC_TX_BUFF3_STATUS 0x30
1156#define MAC_TX_BUFF3_ADDR 0x34 1156#define MAC_TX_BUFF3_ADDR 0x34
1157#define MAC_TX_BUFF3_LEN 0x38 1157#define MAC_TX_BUFF3_LEN 0x38
1158 1158
1159#define MAC0_RX_DMA_ADDR 0xB4004100 1159#define MAC0_RX_DMA_ADDR 0xB4004100
1160#define MAC1_RX_DMA_ADDR 0xB4004300 1160#define MAC1_RX_DMA_ADDR 0xB4004300
1161/* offsets from MAC_RX_RING_ADDR */ 1161/* offsets from MAC_RX_RING_ADDR */
1162#define MAC_RX_BUFF0_STATUS 0x0 1162#define MAC_RX_BUFF0_STATUS 0x0
1163# define RX_FRAME_LEN_MASK 0x3fff 1163# define RX_FRAME_LEN_MASK 0x3fff
1164# define RX_WDOG_TIMER (1<<14) 1164# define RX_WDOG_TIMER (1 << 14)
1165# define RX_RUNT (1<<15) 1165# define RX_RUNT (1 << 15)
1166# define RX_OVERLEN (1<<16) 1166# define RX_OVERLEN (1 << 16)
1167# define RX_COLL (1<<17) 1167# define RX_COLL (1 << 17)
1168# define RX_ETHER (1<<18) 1168# define RX_ETHER (1 << 18)
1169# define RX_MII_ERROR (1<<19) 1169# define RX_MII_ERROR (1 << 19)
1170# define RX_DRIBBLING (1<<20) 1170# define RX_DRIBBLING (1 << 20)
1171# define RX_CRC_ERROR (1<<21) 1171# define RX_CRC_ERROR (1 << 21)
1172# define RX_VLAN1 (1<<22) 1172# define RX_VLAN1 (1 << 22)
1173# define RX_VLAN2 (1<<23) 1173# define RX_VLAN2 (1 << 23)
1174# define RX_LEN_ERROR (1<<24) 1174# define RX_LEN_ERROR (1 << 24)
1175# define RX_CNTRL_FRAME (1<<25) 1175# define RX_CNTRL_FRAME (1 << 25)
1176# define RX_U_CNTRL_FRAME (1<<26) 1176# define RX_U_CNTRL_FRAME (1 << 26)
1177# define RX_MCAST_FRAME (1<<27) 1177# define RX_MCAST_FRAME (1 << 27)
1178# define RX_BCAST_FRAME (1<<28) 1178# define RX_BCAST_FRAME (1 << 28)
1179# define RX_FILTER_FAIL (1<<29) 1179# define RX_FILTER_FAIL (1 << 29)
1180# define RX_PACKET_FILTER (1<<30) 1180# define RX_PACKET_FILTER (1 << 30)
1181# define RX_MISSED_FRAME (1<<31) 1181# define RX_MISSED_FRAME (1 << 31)
1182 1182
1183# define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \ 1183# define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
1184 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \ 1184 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
1185 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME) 1185 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
1186#define MAC_RX_BUFF0_ADDR 0x4 1186#define MAC_RX_BUFF0_ADDR 0x4
1187# define RX_DMA_ENABLE (1<<0) 1187# define RX_DMA_ENABLE (1 << 0)
1188# define RX_T_DONE (1<<1) 1188# define RX_T_DONE (1 << 1)
1189# define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3) 1189# define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1190# define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0) 1190# define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
1191#define MAC_RX_BUFF1_STATUS 0x10 1191#define MAC_RX_BUFF1_STATUS 0x10
1192#define MAC_RX_BUFF1_ADDR 0x14 1192#define MAC_RX_BUFF1_ADDR 0x14
1193#define MAC_RX_BUFF2_STATUS 0x20 1193#define MAC_RX_BUFF2_STATUS 0x20
1194#define MAC_RX_BUFF2_ADDR 0x24 1194#define MAC_RX_BUFF2_ADDR 0x24
1195#define MAC_RX_BUFF3_STATUS 0x30 1195#define MAC_RX_BUFF3_STATUS 0x30
1196#define MAC_RX_BUFF3_ADDR 0x34 1196#define MAC_RX_BUFF3_ADDR 0x34
1197
1198 1197
1199/* UARTS 0-3 */ 1198/* UARTS 0-3 */
1200#define UART_BASE UART0_ADDR 1199#define UART_BASE UART0_ADDR
1201#ifdef CONFIG_SOC_AU1200 1200#ifdef CONFIG_SOC_AU1200
1202#define UART_DEBUG_BASE UART1_ADDR 1201#define UART_DEBUG_BASE UART1_ADDR
1203#else 1202#else
1204#define UART_DEBUG_BASE UART3_ADDR 1203#define UART_DEBUG_BASE UART3_ADDR
1205#endif 1204#endif
1206 1205
1207#define UART_RX 0 /* Receive buffer */ 1206#define UART_RX 0 /* Receive buffer */
@@ -1294,341 +1293,337 @@ enum soc_au1200_ints {
1294#define UART_MSR_DCTS 0x01 /* Delta CTS */ 1293#define UART_MSR_DCTS 0x01 /* Delta CTS */
1295#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ 1294#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
1296 1295
1297
1298
1299/* SSIO */ 1296/* SSIO */
1300#define SSI0_STATUS 0xB1600000 1297#define SSI0_STATUS 0xB1600000
1301# define SSI_STATUS_BF (1<<4) 1298# define SSI_STATUS_BF (1 << 4)
1302# define SSI_STATUS_OF (1<<3) 1299# define SSI_STATUS_OF (1 << 3)
1303# define SSI_STATUS_UF (1<<2) 1300# define SSI_STATUS_UF (1 << 2)
1304# define SSI_STATUS_D (1<<1) 1301# define SSI_STATUS_D (1 << 1)
1305# define SSI_STATUS_B (1<<0) 1302# define SSI_STATUS_B (1 << 0)
1306#define SSI0_INT 0xB1600004 1303#define SSI0_INT 0xB1600004
1307# define SSI_INT_OI (1<<3) 1304# define SSI_INT_OI (1 << 3)
1308# define SSI_INT_UI (1<<2) 1305# define SSI_INT_UI (1 << 2)
1309# define SSI_INT_DI (1<<1) 1306# define SSI_INT_DI (1 << 1)
1310#define SSI0_INT_ENABLE 0xB1600008 1307#define SSI0_INT_ENABLE 0xB1600008
1311# define SSI_INTE_OIE (1<<3) 1308# define SSI_INTE_OIE (1 << 3)
1312# define SSI_INTE_UIE (1<<2) 1309# define SSI_INTE_UIE (1 << 2)
1313# define SSI_INTE_DIE (1<<1) 1310# define SSI_INTE_DIE (1 << 1)
1314#define SSI0_CONFIG 0xB1600020 1311#define SSI0_CONFIG 0xB1600020
1315# define SSI_CONFIG_AO (1<<24) 1312# define SSI_CONFIG_AO (1 << 24)
1316# define SSI_CONFIG_DO (1<<23) 1313# define SSI_CONFIG_DO (1 << 23)
1317# define SSI_CONFIG_ALEN_BIT 20 1314# define SSI_CONFIG_ALEN_BIT 20
1318# define SSI_CONFIG_ALEN_MASK (0x7<<20) 1315# define SSI_CONFIG_ALEN_MASK (0x7 << 20)
1319# define SSI_CONFIG_DLEN_BIT 16 1316# define SSI_CONFIG_DLEN_BIT 16
1320# define SSI_CONFIG_DLEN_MASK (0x7<<16) 1317# define SSI_CONFIG_DLEN_MASK (0x7 << 16)
1321# define SSI_CONFIG_DD (1<<11) 1318# define SSI_CONFIG_DD (1 << 11)
1322# define SSI_CONFIG_AD (1<<10) 1319# define SSI_CONFIG_AD (1 << 10)
1323# define SSI_CONFIG_BM_BIT 8 1320# define SSI_CONFIG_BM_BIT 8
1324# define SSI_CONFIG_BM_MASK (0x3<<8) 1321# define SSI_CONFIG_BM_MASK (0x3 << 8)
1325# define SSI_CONFIG_CE (1<<7) 1322# define SSI_CONFIG_CE (1 << 7)
1326# define SSI_CONFIG_DP (1<<6) 1323# define SSI_CONFIG_DP (1 << 6)
1327# define SSI_CONFIG_DL (1<<5) 1324# define SSI_CONFIG_DL (1 << 5)
1328# define SSI_CONFIG_EP (1<<4) 1325# define SSI_CONFIG_EP (1 << 4)
1329#define SSI0_ADATA 0xB1600024 1326#define SSI0_ADATA 0xB1600024
1330# define SSI_AD_D (1<<24) 1327# define SSI_AD_D (1 << 24)
1331# define SSI_AD_ADDR_BIT 16 1328# define SSI_AD_ADDR_BIT 16
1332# define SSI_AD_ADDR_MASK (0xff<<16) 1329# define SSI_AD_ADDR_MASK (0xff << 16)
1333# define SSI_AD_DATA_BIT 0 1330# define SSI_AD_DATA_BIT 0
1334# define SSI_AD_DATA_MASK (0xfff<<0) 1331# define SSI_AD_DATA_MASK (0xfff << 0)
1335#define SSI0_CLKDIV 0xB1600028 1332#define SSI0_CLKDIV 0xB1600028
1336#define SSI0_CONTROL 0xB1600100 1333#define SSI0_CONTROL 0xB1600100
1337# define SSI_CONTROL_CD (1<<1) 1334# define SSI_CONTROL_CD (1 << 1)
1338# define SSI_CONTROL_E (1<<0) 1335# define SSI_CONTROL_E (1 << 0)
1339 1336
1340/* SSI1 */ 1337/* SSI1 */
1341#define SSI1_STATUS 0xB1680000 1338#define SSI1_STATUS 0xB1680000
1342#define SSI1_INT 0xB1680004 1339#define SSI1_INT 0xB1680004
1343#define SSI1_INT_ENABLE 0xB1680008 1340#define SSI1_INT_ENABLE 0xB1680008
1344#define SSI1_CONFIG 0xB1680020 1341#define SSI1_CONFIG 0xB1680020
1345#define SSI1_ADATA 0xB1680024 1342#define SSI1_ADATA 0xB1680024
1346#define SSI1_CLKDIV 0xB1680028 1343#define SSI1_CLKDIV 0xB1680028
1347#define SSI1_ENABLE 0xB1680100 1344#define SSI1_ENABLE 0xB1680100
1348 1345
1349/* 1346/*
1350 * Register content definitions 1347 * Register content definitions
1351 */ 1348 */
1352#define SSI_STATUS_BF (1<<4) 1349#define SSI_STATUS_BF (1 << 4)
1353#define SSI_STATUS_OF (1<<3) 1350#define SSI_STATUS_OF (1 << 3)
1354#define SSI_STATUS_UF (1<<2) 1351#define SSI_STATUS_UF (1 << 2)
1355#define SSI_STATUS_D (1<<1) 1352#define SSI_STATUS_D (1 << 1)
1356#define SSI_STATUS_B (1<<0) 1353#define SSI_STATUS_B (1 << 0)
1357 1354
1358/* SSI_INT */ 1355/* SSI_INT */
1359#define SSI_INT_OI (1<<3) 1356#define SSI_INT_OI (1 << 3)
1360#define SSI_INT_UI (1<<2) 1357#define SSI_INT_UI (1 << 2)
1361#define SSI_INT_DI (1<<1) 1358#define SSI_INT_DI (1 << 1)
1362 1359
1363/* SSI_INTEN */ 1360/* SSI_INTEN */
1364#define SSI_INTEN_OIE (1<<3) 1361#define SSI_INTEN_OIE (1 << 3)
1365#define SSI_INTEN_UIE (1<<2) 1362#define SSI_INTEN_UIE (1 << 2)
1366#define SSI_INTEN_DIE (1<<1) 1363#define SSI_INTEN_DIE (1 << 1)
1367 1364
1368#define SSI_CONFIG_AO (1<<24) 1365#define SSI_CONFIG_AO (1 << 24)
1369#define SSI_CONFIG_DO (1<<23) 1366#define SSI_CONFIG_DO (1 << 23)
1370#define SSI_CONFIG_ALEN (7<<20) 1367#define SSI_CONFIG_ALEN (7 << 20)
1371#define SSI_CONFIG_DLEN (15<<16) 1368#define SSI_CONFIG_DLEN (15 << 16)
1372#define SSI_CONFIG_DD (1<<11) 1369#define SSI_CONFIG_DD (1 << 11)
1373#define SSI_CONFIG_AD (1<<10) 1370#define SSI_CONFIG_AD (1 << 10)
1374#define SSI_CONFIG_BM (3<<8) 1371#define SSI_CONFIG_BM (3 << 8)
1375#define SSI_CONFIG_CE (1<<7) 1372#define SSI_CONFIG_CE (1 << 7)
1376#define SSI_CONFIG_DP (1<<6) 1373#define SSI_CONFIG_DP (1 << 6)
1377#define SSI_CONFIG_DL (1<<5) 1374#define SSI_CONFIG_DL (1 << 5)
1378#define SSI_CONFIG_EP (1<<4) 1375#define SSI_CONFIG_EP (1 << 4)
1379#define SSI_CONFIG_ALEN_N(N) ((N-1)<<20) 1376#define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
1380#define SSI_CONFIG_DLEN_N(N) ((N-1)<<16) 1377#define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
1381#define SSI_CONFIG_BM_HI (0<<8) 1378#define SSI_CONFIG_BM_HI (0 << 8)
1382#define SSI_CONFIG_BM_LO (1<<8) 1379#define SSI_CONFIG_BM_LO (1 << 8)
1383#define SSI_CONFIG_BM_CY (2<<8) 1380#define SSI_CONFIG_BM_CY (2 << 8)
1384 1381
1385#define SSI_ADATA_D (1<<24) 1382#define SSI_ADATA_D (1 << 24)
1386#define SSI_ADATA_ADDR (0xFF<<16) 1383#define SSI_ADATA_ADDR (0xFF << 16)
1387#define SSI_ADATA_DATA (0x0FFF) 1384#define SSI_ADATA_DATA 0x0FFF
1388#define SSI_ADATA_ADDR_N(N) (N<<16) 1385#define SSI_ADATA_ADDR_N(N) (N << 16)
1389 1386
1390#define SSI_ENABLE_CD (1<<1) 1387#define SSI_ENABLE_CD (1 << 1)
1391#define SSI_ENABLE_E (1<<0) 1388#define SSI_ENABLE_E (1 << 0)
1392
1393 1389
1394/* IrDA Controller */ 1390/* IrDA Controller */
1395#define IRDA_BASE 0xB0300000 1391#define IRDA_BASE 0xB0300000
1396#define IR_RING_PTR_STATUS (IRDA_BASE+0x00) 1392#define IR_RING_PTR_STATUS (IRDA_BASE + 0x00)
1397#define IR_RING_BASE_ADDR_H (IRDA_BASE+0x04) 1393#define IR_RING_BASE_ADDR_H (IRDA_BASE + 0x04)
1398#define IR_RING_BASE_ADDR_L (IRDA_BASE+0x08) 1394#define IR_RING_BASE_ADDR_L (IRDA_BASE + 0x08)
1399#define IR_RING_SIZE (IRDA_BASE+0x0C) 1395#define IR_RING_SIZE (IRDA_BASE + 0x0C)
1400#define IR_RING_PROMPT (IRDA_BASE+0x10) 1396#define IR_RING_PROMPT (IRDA_BASE + 0x10)
1401#define IR_RING_ADDR_CMPR (IRDA_BASE+0x14) 1397#define IR_RING_ADDR_CMPR (IRDA_BASE + 0x14)
1402#define IR_INT_CLEAR (IRDA_BASE+0x18) 1398#define IR_INT_CLEAR (IRDA_BASE + 0x18)
1403#define IR_CONFIG_1 (IRDA_BASE+0x20) 1399#define IR_CONFIG_1 (IRDA_BASE + 0x20)
1404# define IR_RX_INVERT_LED (1<<0) 1400# define IR_RX_INVERT_LED (1 << 0)
1405# define IR_TX_INVERT_LED (1<<1) 1401# define IR_TX_INVERT_LED (1 << 1)
1406# define IR_ST (1<<2) 1402# define IR_ST (1 << 2)
1407# define IR_SF (1<<3) 1403# define IR_SF (1 << 3)
1408# define IR_SIR (1<<4) 1404# define IR_SIR (1 << 4)
1409# define IR_MIR (1<<5) 1405# define IR_MIR (1 << 5)
1410# define IR_FIR (1<<6) 1406# define IR_FIR (1 << 6)
1411# define IR_16CRC (1<<7) 1407# define IR_16CRC (1 << 7)
1412# define IR_TD (1<<8) 1408# define IR_TD (1 << 8)
1413# define IR_RX_ALL (1<<9) 1409# define IR_RX_ALL (1 << 9)
1414# define IR_DMA_ENABLE (1<<10) 1410# define IR_DMA_ENABLE (1 << 10)
1415# define IR_RX_ENABLE (1<<11) 1411# define IR_RX_ENABLE (1 << 11)
1416# define IR_TX_ENABLE (1<<12) 1412# define IR_TX_ENABLE (1 << 12)
1417# define IR_LOOPBACK (1<<14) 1413# define IR_LOOPBACK (1 << 14)
1418# define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \ 1414# define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
1419 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC) 1415 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
1420#define IR_SIR_FLAGS (IRDA_BASE+0x24) 1416#define IR_SIR_FLAGS (IRDA_BASE + 0x24)
1421#define IR_ENABLE (IRDA_BASE+0x28) 1417#define IR_ENABLE (IRDA_BASE + 0x28)
1422# define IR_RX_STATUS (1<<9) 1418# define IR_RX_STATUS (1 << 9)
1423# define IR_TX_STATUS (1<<10) 1419# define IR_TX_STATUS (1 << 10)
1424#define IR_READ_PHY_CONFIG (IRDA_BASE+0x2C) 1420#define IR_READ_PHY_CONFIG (IRDA_BASE + 0x2C)
1425#define IR_WRITE_PHY_CONFIG (IRDA_BASE+0x30) 1421#define IR_WRITE_PHY_CONFIG (IRDA_BASE + 0x30)
1426#define IR_MAX_PKT_LEN (IRDA_BASE+0x34) 1422#define IR_MAX_PKT_LEN (IRDA_BASE + 0x34)
1427#define IR_RX_BYTE_CNT (IRDA_BASE+0x38) 1423#define IR_RX_BYTE_CNT (IRDA_BASE + 0x38)
1428#define IR_CONFIG_2 (IRDA_BASE+0x3C) 1424#define IR_CONFIG_2 (IRDA_BASE + 0x3C)
1429# define IR_MODE_INV (1<<0) 1425# define IR_MODE_INV (1 << 0)
1430# define IR_ONE_PIN (1<<1) 1426# define IR_ONE_PIN (1 << 1)
1431#define IR_INTERFACE_CONFIG (IRDA_BASE+0x40) 1427#define IR_INTERFACE_CONFIG (IRDA_BASE + 0x40)
1432 1428
1433/* GPIO */ 1429/* GPIO */
1434#define SYS_PINFUNC 0xB190002C 1430#define SYS_PINFUNC 0xB190002C
1435# define SYS_PF_USB (1<<15) /* 2nd USB device/host */ 1431# define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
1436# define SYS_PF_U3 (1<<14) /* GPIO23/U3TXD */ 1432# define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
1437# define SYS_PF_U2 (1<<13) /* GPIO22/U2TXD */ 1433# define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
1438# define SYS_PF_U1 (1<<12) /* GPIO21/U1TXD */ 1434# define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
1439# define SYS_PF_SRC (1<<11) /* GPIO6/SROMCKE */ 1435# define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
1440# define SYS_PF_CK5 (1<<10) /* GPIO3/CLK5 */ 1436# define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
1441# define SYS_PF_CK4 (1<<9) /* GPIO2/CLK4 */ 1437# define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
1442# define SYS_PF_IRF (1<<8) /* GPIO15/IRFIRSEL */ 1438# define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
1443# define SYS_PF_UR3 (1<<7) /* GPIO[14:9]/UART3 */ 1439# define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
1444# define SYS_PF_I2D (1<<6) /* GPIO8/I2SDI */ 1440# define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
1445# define SYS_PF_I2S (1<<5) /* I2S/GPIO[29:31] */ 1441# define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
1446# define SYS_PF_NI2 (1<<4) /* NI2/GPIO[24:28] */ 1442# define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
1447# define SYS_PF_U0 (1<<3) /* U0TXD/GPIO20 */ 1443# define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
1448# define SYS_PF_RD (1<<2) /* IRTXD/GPIO19 */ 1444# define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
1449# define SYS_PF_A97 (1<<1) /* AC97/SSL1 */ 1445# define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
1450# define SYS_PF_S0 (1<<0) /* SSI_0/GPIO[16:18] */ 1446# define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
1451 1447
1452/* Au1100 Only */ 1448/* Au1100 only */
1453# define SYS_PF_PC (1<<18) /* PCMCIA/GPIO[207:204] */ 1449# define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
1454# define SYS_PF_LCD (1<<17) /* extern lcd/GPIO[203:200] */ 1450# define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
1455# define SYS_PF_CS (1<<16) /* EXTCLK0/32khz to gpio2 */ 1451# define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
1456# define SYS_PF_EX0 (1<<9) /* gpio2/clock */ 1452# define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
1457 1453
1458/* Au1550 Only. Redefines lots of pins */ 1454/* Au1550 only. Redefines lots of pins */
1459# define SYS_PF_PSC2_MASK (7 << 17) 1455# define SYS_PF_PSC2_MASK (7 << 17)
1460# define SYS_PF_PSC2_AC97 (0) 1456# define SYS_PF_PSC2_AC97 0
1461# define SYS_PF_PSC2_SPI (0) 1457# define SYS_PF_PSC2_SPI 0
1462# define SYS_PF_PSC2_I2S (1 << 17) 1458# define SYS_PF_PSC2_I2S (1 << 17)
1463# define SYS_PF_PSC2_SMBUS (3 << 17) 1459# define SYS_PF_PSC2_SMBUS (3 << 17)
1464# define SYS_PF_PSC2_GPIO (7 << 17) 1460# define SYS_PF_PSC2_GPIO (7 << 17)
1465# define SYS_PF_PSC3_MASK (7 << 20) 1461# define SYS_PF_PSC3_MASK (7 << 20)
1466# define SYS_PF_PSC3_AC97 (0) 1462# define SYS_PF_PSC3_AC97 0
1467# define SYS_PF_PSC3_SPI (0) 1463# define SYS_PF_PSC3_SPI 0
1468# define SYS_PF_PSC3_I2S (1 << 20) 1464# define SYS_PF_PSC3_I2S (1 << 20)
1469# define SYS_PF_PSC3_SMBUS (3 << 20) 1465# define SYS_PF_PSC3_SMBUS (3 << 20)
1470# define SYS_PF_PSC3_GPIO (7 << 20) 1466# define SYS_PF_PSC3_GPIO (7 << 20)
1471# define SYS_PF_PSC1_S1 (1 << 1) 1467# define SYS_PF_PSC1_S1 (1 << 1)
1472# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2)) 1468# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
1473 1469
1474/* Au1200 Only */ 1470/* Au1200 only */
1475#ifdef CONFIG_SOC_AU1200 1471#ifdef CONFIG_SOC_AU1200
1476#define SYS_PINFUNC_DMA (1<<31) 1472#define SYS_PINFUNC_DMA (1 << 31)
1477#define SYS_PINFUNC_S0A (1<<30) 1473#define SYS_PINFUNC_S0A (1 << 30)
1478#define SYS_PINFUNC_S1A (1<<29) 1474#define SYS_PINFUNC_S1A (1 << 29)
1479#define SYS_PINFUNC_LP0 (1<<28) 1475#define SYS_PINFUNC_LP0 (1 << 28)
1480#define SYS_PINFUNC_LP1 (1<<27) 1476#define SYS_PINFUNC_LP1 (1 << 27)
1481#define SYS_PINFUNC_LD16 (1<<26) 1477#define SYS_PINFUNC_LD16 (1 << 26)
1482#define SYS_PINFUNC_LD8 (1<<25) 1478#define SYS_PINFUNC_LD8 (1 << 25)
1483#define SYS_PINFUNC_LD1 (1<<24) 1479#define SYS_PINFUNC_LD1 (1 << 24)
1484#define SYS_PINFUNC_LD0 (1<<23) 1480#define SYS_PINFUNC_LD0 (1 << 23)
1485#define SYS_PINFUNC_P1A (3<<21) 1481#define SYS_PINFUNC_P1A (3 << 21)
1486#define SYS_PINFUNC_P1B (1<<20) 1482#define SYS_PINFUNC_P1B (1 << 20)
1487#define SYS_PINFUNC_FS3 (1<<19) 1483#define SYS_PINFUNC_FS3 (1 << 19)
1488#define SYS_PINFUNC_P0A (3<<17) 1484#define SYS_PINFUNC_P0A (3 << 17)
1489#define SYS_PINFUNC_CS (1<<16) 1485#define SYS_PINFUNC_CS (1 << 16)
1490#define SYS_PINFUNC_CIM (1<<15) 1486#define SYS_PINFUNC_CIM (1 << 15)
1491#define SYS_PINFUNC_P1C (1<<14) 1487#define SYS_PINFUNC_P1C (1 << 14)
1492#define SYS_PINFUNC_U1T (1<<12) 1488#define SYS_PINFUNC_U1T (1 << 12)
1493#define SYS_PINFUNC_U1R (1<<11) 1489#define SYS_PINFUNC_U1R (1 << 11)
1494#define SYS_PINFUNC_EX1 (1<<10) 1490#define SYS_PINFUNC_EX1 (1 << 10)
1495#define SYS_PINFUNC_EX0 (1<<9) 1491#define SYS_PINFUNC_EX0 (1 << 9)
1496#define SYS_PINFUNC_U0R (1<<8) 1492#define SYS_PINFUNC_U0R (1 << 8)
1497#define SYS_PINFUNC_MC (1<<7) 1493#define SYS_PINFUNC_MC (1 << 7)
1498#define SYS_PINFUNC_S0B (1<<6) 1494#define SYS_PINFUNC_S0B (1 << 6)
1499#define SYS_PINFUNC_S0C (1<<5) 1495#define SYS_PINFUNC_S0C (1 << 5)
1500#define SYS_PINFUNC_P0B (1<<4) 1496#define SYS_PINFUNC_P0B (1 << 4)
1501#define SYS_PINFUNC_U0T (1<<3) 1497#define SYS_PINFUNC_U0T (1 << 3)
1502#define SYS_PINFUNC_S1B (1<<2) 1498#define SYS_PINFUNC_S1B (1 << 2)
1503#endif 1499#endif
1504 1500
1505#define SYS_TRIOUTRD 0xB1900100 1501#define SYS_TRIOUTRD 0xB1900100
1506#define SYS_TRIOUTCLR 0xB1900100 1502#define SYS_TRIOUTCLR 0xB1900100
1507#define SYS_OUTPUTRD 0xB1900108 1503#define SYS_OUTPUTRD 0xB1900108
1508#define SYS_OUTPUTSET 0xB1900108 1504#define SYS_OUTPUTSET 0xB1900108
1509#define SYS_OUTPUTCLR 0xB190010C 1505#define SYS_OUTPUTCLR 0xB190010C
1510#define SYS_PINSTATERD 0xB1900110 1506#define SYS_PINSTATERD 0xB1900110
1511#define SYS_PININPUTEN 0xB1900110 1507#define SYS_PININPUTEN 0xB1900110
1512 1508
1513/* GPIO2, Au1500, Au1550 only */ 1509/* GPIO2, Au1500, Au1550 only */
1514#define GPIO2_BASE 0xB1700000 1510#define GPIO2_BASE 0xB1700000
1515#define GPIO2_DIR (GPIO2_BASE + 0) 1511#define GPIO2_DIR (GPIO2_BASE + 0)
1516#define GPIO2_OUTPUT (GPIO2_BASE + 8) 1512#define GPIO2_OUTPUT (GPIO2_BASE + 8)
1517#define GPIO2_PINSTATE (GPIO2_BASE + 0xC) 1513#define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
1518#define GPIO2_INTENABLE (GPIO2_BASE + 0x10) 1514#define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
1519#define GPIO2_ENABLE (GPIO2_BASE + 0x14) 1515#define GPIO2_ENABLE (GPIO2_BASE + 0x14)
1520 1516
1521/* Power Management */ 1517/* Power Management */
1522#define SYS_SCRATCH0 0xB1900018 1518#define SYS_SCRATCH0 0xB1900018
1523#define SYS_SCRATCH1 0xB190001C 1519#define SYS_SCRATCH1 0xB190001C
1524#define SYS_WAKEMSK 0xB1900034 1520#define SYS_WAKEMSK 0xB1900034
1525#define SYS_ENDIAN 0xB1900038 1521#define SYS_ENDIAN 0xB1900038
1526#define SYS_POWERCTRL 0xB190003C 1522#define SYS_POWERCTRL 0xB190003C
1527#define SYS_WAKESRC 0xB190005C 1523#define SYS_WAKESRC 0xB190005C
1528#define SYS_SLPPWR 0xB1900078 1524#define SYS_SLPPWR 0xB1900078
1529#define SYS_SLEEP 0xB190007C 1525#define SYS_SLEEP 0xB190007C
1530 1526
1531/* Clock Controller */ 1527/* Clock Controller */
1532#define SYS_FREQCTRL0 0xB1900020 1528#define SYS_FREQCTRL0 0xB1900020
1533# define SYS_FC_FRDIV2_BIT 22 1529# define SYS_FC_FRDIV2_BIT 22
1534# define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT) 1530# define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
1535# define SYS_FC_FE2 (1<<21) 1531# define SYS_FC_FE2 (1 << 21)
1536# define SYS_FC_FS2 (1<<20) 1532# define SYS_FC_FS2 (1 << 20)
1537# define SYS_FC_FRDIV1_BIT 12 1533# define SYS_FC_FRDIV1_BIT 12
1538# define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT) 1534# define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
1539# define SYS_FC_FE1 (1<<11) 1535# define SYS_FC_FE1 (1 << 11)
1540# define SYS_FC_FS1 (1<<10) 1536# define SYS_FC_FS1 (1 << 10)
1541# define SYS_FC_FRDIV0_BIT 2 1537# define SYS_FC_FRDIV0_BIT 2
1542# define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT) 1538# define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
1543# define SYS_FC_FE0 (1<<1) 1539# define SYS_FC_FE0 (1 << 1)
1544# define SYS_FC_FS0 (1<<0) 1540# define SYS_FC_FS0 (1 << 0)
1545#define SYS_FREQCTRL1 0xB1900024 1541#define SYS_FREQCTRL1 0xB1900024
1546# define SYS_FC_FRDIV5_BIT 22 1542# define SYS_FC_FRDIV5_BIT 22
1547# define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT) 1543# define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
1548# define SYS_FC_FE5 (1<<21) 1544# define SYS_FC_FE5 (1 << 21)
1549# define SYS_FC_FS5 (1<<20) 1545# define SYS_FC_FS5 (1 << 20)
1550# define SYS_FC_FRDIV4_BIT 12 1546# define SYS_FC_FRDIV4_BIT 12
1551# define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT) 1547# define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
1552# define SYS_FC_FE4 (1<<11) 1548# define SYS_FC_FE4 (1 << 11)
1553# define SYS_FC_FS4 (1<<10) 1549# define SYS_FC_FS4 (1 << 10)
1554# define SYS_FC_FRDIV3_BIT 2 1550# define SYS_FC_FRDIV3_BIT 2
1555# define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT) 1551# define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
1556# define SYS_FC_FE3 (1<<1) 1552# define SYS_FC_FE3 (1 << 1)
1557# define SYS_FC_FS3 (1<<0) 1553# define SYS_FC_FS3 (1 << 0)
1558#define SYS_CLKSRC 0xB1900028 1554#define SYS_CLKSRC 0xB1900028
1559# define SYS_CS_ME1_BIT 27 1555# define SYS_CS_ME1_BIT 27
1560# define SYS_CS_ME1_MASK (0x7<<SYS_CS_ME1_BIT) 1556# define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
1561# define SYS_CS_DE1 (1<<26) 1557# define SYS_CS_DE1 (1 << 26)
1562# define SYS_CS_CE1 (1<<25) 1558# define SYS_CS_CE1 (1 << 25)
1563# define SYS_CS_ME0_BIT 22 1559# define SYS_CS_ME0_BIT 22
1564# define SYS_CS_ME0_MASK (0x7<<SYS_CS_ME0_BIT) 1560# define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
1565# define SYS_CS_DE0 (1<<21) 1561# define SYS_CS_DE0 (1 << 21)
1566# define SYS_CS_CE0 (1<<20) 1562# define SYS_CS_CE0 (1 << 20)
1567# define SYS_CS_MI2_BIT 17 1563# define SYS_CS_MI2_BIT 17
1568# define SYS_CS_MI2_MASK (0x7<<SYS_CS_MI2_BIT) 1564# define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
1569# define SYS_CS_DI2 (1<<16) 1565# define SYS_CS_DI2 (1 << 16)
1570# define SYS_CS_CI2 (1<<15) 1566# define SYS_CS_CI2 (1 << 15)
1571#ifdef CONFIG_SOC_AU1100 1567#ifdef CONFIG_SOC_AU1100
1572# define SYS_CS_ML_BIT 7 1568# define SYS_CS_ML_BIT 7
1573# define SYS_CS_ML_MASK (0x7<<SYS_CS_ML_BIT) 1569# define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
1574# define SYS_CS_DL (1<<6) 1570# define SYS_CS_DL (1 << 6)
1575# define SYS_CS_CL (1<<5) 1571# define SYS_CS_CL (1 << 5)
1576#else 1572#else
1577# define SYS_CS_MUH_BIT 12 1573# define SYS_CS_MUH_BIT 12
1578# define SYS_CS_MUH_MASK (0x7<<SYS_CS_MUH_BIT) 1574# define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
1579# define SYS_CS_DUH (1<<11) 1575# define SYS_CS_DUH (1 << 11)
1580# define SYS_CS_CUH (1<<10) 1576# define SYS_CS_CUH (1 << 10)
1581# define SYS_CS_MUD_BIT 7 1577# define SYS_CS_MUD_BIT 7
1582# define SYS_CS_MUD_MASK (0x7<<SYS_CS_MUD_BIT) 1578# define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
1583# define SYS_CS_DUD (1<<6) 1579# define SYS_CS_DUD (1 << 6)
1584# define SYS_CS_CUD (1<<5) 1580# define SYS_CS_CUD (1 << 5)
1585#endif 1581#endif
1586# define SYS_CS_MIR_BIT 2 1582# define SYS_CS_MIR_BIT 2
1587# define SYS_CS_MIR_MASK (0x7<<SYS_CS_MIR_BIT) 1583# define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
1588# define SYS_CS_DIR (1<<1) 1584# define SYS_CS_DIR (1 << 1)
1589# define SYS_CS_CIR (1<<0) 1585# define SYS_CS_CIR (1 << 0)
1590 1586
1591# define SYS_CS_MUX_AUX 0x1 1587# define SYS_CS_MUX_AUX 0x1
1592# define SYS_CS_MUX_FQ0 0x2 1588# define SYS_CS_MUX_FQ0 0x2
1593# define SYS_CS_MUX_FQ1 0x3 1589# define SYS_CS_MUX_FQ1 0x3
1594# define SYS_CS_MUX_FQ2 0x4 1590# define SYS_CS_MUX_FQ2 0x4
1595# define SYS_CS_MUX_FQ3 0x5 1591# define SYS_CS_MUX_FQ3 0x5
1596# define SYS_CS_MUX_FQ4 0x6 1592# define SYS_CS_MUX_FQ4 0x6
1597# define SYS_CS_MUX_FQ5 0x7 1593# define SYS_CS_MUX_FQ5 0x7
1598#define SYS_CPUPLL 0xB1900060 1594#define SYS_CPUPLL 0xB1900060
1599#define SYS_AUXPLL 0xB1900064 1595#define SYS_AUXPLL 0xB1900064
1600 1596
1601/* AC97 Controller */ 1597/* AC97 Controller */
1602#define AC97C_CONFIG 0xB0000000 1598#define AC97C_CONFIG 0xB0000000
1603# define AC97C_RECV_SLOTS_BIT 13 1599# define AC97C_RECV_SLOTS_BIT 13
1604# define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT) 1600# define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
1605# define AC97C_XMIT_SLOTS_BIT 3 1601# define AC97C_XMIT_SLOTS_BIT 3
1606# define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT) 1602# define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
1607# define AC97C_SG (1<<2) 1603# define AC97C_SG (1 << 2)
1608# define AC97C_SYNC (1<<1) 1604# define AC97C_SYNC (1 << 1)
1609# define AC97C_RESET (1<<0) 1605# define AC97C_RESET (1 << 0)
1610#define AC97C_STATUS 0xB0000004 1606#define AC97C_STATUS 0xB0000004
1611# define AC97C_XU (1<<11) 1607# define AC97C_XU (1 << 11)
1612# define AC97C_XO (1<<10) 1608# define AC97C_XO (1 << 10)
1613# define AC97C_RU (1<<9) 1609# define AC97C_RU (1 << 9)
1614# define AC97C_RO (1<<8) 1610# define AC97C_RO (1 << 8)
1615# define AC97C_READY (1<<7) 1611# define AC97C_READY (1 << 7)
1616# define AC97C_CP (1<<6) 1612# define AC97C_CP (1 << 6)
1617# define AC97C_TR (1<<5) 1613# define AC97C_TR (1 << 5)
1618# define AC97C_TE (1<<4) 1614# define AC97C_TE (1 << 4)
1619# define AC97C_TF (1<<3) 1615# define AC97C_TF (1 << 3)
1620# define AC97C_RR (1<<2) 1616# define AC97C_RR (1 << 2)
1621# define AC97C_RE (1<<1) 1617# define AC97C_RE (1 << 1)
1622# define AC97C_RF (1<<0) 1618# define AC97C_RF (1 << 0)
1623#define AC97C_DATA 0xB0000008 1619#define AC97C_DATA 0xB0000008
1624#define AC97C_CMD 0xB000000C 1620#define AC97C_CMD 0xB000000C
1625# define AC97C_WD_BIT 16 1621# define AC97C_WD_BIT 16
1626# define AC97C_READ (1<<7) 1622# define AC97C_READ (1 << 7)
1627# define AC97C_INDEX_MASK 0x7f 1623# define AC97C_INDEX_MASK 0x7f
1628#define AC97C_CNTRL 0xB0000010 1624#define AC97C_CNTRL 0xB0000010
1629# define AC97C_RS (1<<1) 1625# define AC97C_RS (1 << 1)
1630# define AC97C_CE (1<<0) 1626# define AC97C_CE (1 << 0)
1631
1632 1627
1633/* Secure Digital (SD) Controller */ 1628/* Secure Digital (SD) Controller */
1634#define SD0_XMIT_FIFO 0xB0600000 1629#define SD0_XMIT_FIFO 0xB0600000
@@ -1638,73 +1633,74 @@ enum soc_au1200_ints {
1638 1633
1639#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) 1634#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
1640/* Au1500 PCI Controller */ 1635/* Au1500 PCI Controller */
1641#define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr 1636#define Au1500_CFG_BASE 0xB4005000 /* virtual, KSEG1 addr */
1642#define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0) 1637#define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
1643#define Au1500_PCI_CFG (Au1500_CFG_BASE + 4) 1638#define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
1644# define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27)) 1639# define PCI_ERROR ((1 << 22) | (1 << 23) | (1 << 24) | \
1645#define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8) 1640 (1 << 25) | (1 << 26) | (1 << 27))
1646#define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC) 1641#define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
1647#define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10) 1642#define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
1648#define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14) 1643#define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
1644#define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
1649#define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18) 1645#define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
1650#define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C) 1646#define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
1651#define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20) 1647#define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
1652#define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100) 1648#define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
1653#define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104) 1649#define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
1654#define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108) 1650#define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
1655#define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C) 1651#define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
1656#define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110) 1652#define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
1657 1653
1658#define Au1500_PCI_HDR 0xB4005100 // virtual, kseg0 addr 1654#define Au1500_PCI_HDR 0xB4005100 /* virtual, KSEG1 addr */
1659 1655
1660/* All of our structures, like pci resource, have 32 bit members. 1656/*
1657 * All of our structures, like PCI resource, have 32-bit members.
1661 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's 1658 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
1662 * hard to store 0x4 0000 0000 in a 32 bit type. We require a small patch 1659 * hard to store 0x4 0000 0000 in a 32-bit type. We require a small patch
1663 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and 1660 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
1664 * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM 1661 * (u32)Au1500_PCI_MEM_END and change those to the full 36-bit PCI MEM
1665 * addresses. For PCI IO, it's simpler because we get to do the ioremap 1662 * addresses. For PCI I/O, it's simpler because we get to do the ioremap
1666 * ourselves and then adjust the device's resources. 1663 * ourselves and then adjust the device's resources.
1667 */ 1664 */
1668#define Au1500_EXT_CFG 0x600000000ULL 1665#define Au1500_EXT_CFG 0x600000000ULL
1669#define Au1500_EXT_CFG_TYPE1 0x680000000ULL 1666#define Au1500_EXT_CFG_TYPE1 0x680000000ULL
1670#define Au1500_PCI_IO_START 0x500000000ULL 1667#define Au1500_PCI_IO_START 0x500000000ULL
1671#define Au1500_PCI_IO_END 0x5000FFFFFULL 1668#define Au1500_PCI_IO_END 0x5000FFFFFULL
1672#define Au1500_PCI_MEM_START 0x440000000ULL 1669#define Au1500_PCI_MEM_START 0x440000000ULL
1673#define Au1500_PCI_MEM_END 0x44FFFFFFFULL 1670#define Au1500_PCI_MEM_END 0x44FFFFFFFULL
1674 1671
1675#define PCI_IO_START 0x00001000 1672#define PCI_IO_START 0x00001000
1676#define PCI_IO_END 0x000FFFFF 1673#define PCI_IO_END 0x000FFFFF
1677#define PCI_MEM_START 0x40000000 1674#define PCI_MEM_START 0x40000000
1678#define PCI_MEM_END 0x4FFFFFFF 1675#define PCI_MEM_END 0x4FFFFFFF
1679 1676
1680#define PCI_FIRST_DEVFN (0<<3) 1677#define PCI_FIRST_DEVFN (0 << 3)
1681#define PCI_LAST_DEVFN (19<<3) 1678#define PCI_LAST_DEVFN (19 << 3)
1682 1679
1683#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */ 1680#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
1684#define IOPORT_RESOURCE_END 0xffffffff 1681#define IOPORT_RESOURCE_END 0xffffffff
1685#define IOMEM_RESOURCE_START 0x10000000 1682#define IOMEM_RESOURCE_START 0x10000000
1686#define IOMEM_RESOURCE_END 0xffffffff 1683#define IOMEM_RESOURCE_END 0xffffffff
1687 1684
1688#else /* Au1000 and Au1100 and Au1200 */ 1685#else /* Au1000 and Au1100 and Au1200 */
1689 1686
1690/* don't allow any legacy ports probing */ 1687/* Don't allow any legacy ports probing */
1691#define IOPORT_RESOURCE_START 0x10000000 1688#define IOPORT_RESOURCE_START 0x10000000
1692#define IOPORT_RESOURCE_END 0xffffffff 1689#define IOPORT_RESOURCE_END 0xffffffff
1693#define IOMEM_RESOURCE_START 0x10000000 1690#define IOMEM_RESOURCE_START 0x10000000
1694#define IOMEM_RESOURCE_END 0xffffffff 1691#define IOMEM_RESOURCE_END 0xffffffff
1695 1692
1696#define PCI_IO_START 0 1693#define PCI_IO_START 0
1697#define PCI_IO_END 0 1694#define PCI_IO_END 0
1698#define PCI_MEM_START 0 1695#define PCI_MEM_START 0
1699#define PCI_MEM_END 0 1696#define PCI_MEM_END 0
1700#define PCI_FIRST_DEVFN 0 1697#define PCI_FIRST_DEVFN 0
1701#define PCI_LAST_DEVFN 0 1698#define PCI_LAST_DEVFN 0
1702 1699
1703#endif 1700#endif
1704 1701
1705#ifndef _LANGUAGE_ASSEMBLY 1702#ifndef _LANGUAGE_ASSEMBLY
1706typedef volatile struct 1703typedef volatile struct {
1707{
1708 /* 0x0000 */ u32 toytrim; 1704 /* 0x0000 */ u32 toytrim;
1709 /* 0x0004 */ u32 toywrite; 1705 /* 0x0004 */ u32 toywrite;
1710 /* 0x0008 */ u32 toymatch0; 1706 /* 0x0008 */ u32 toymatch0;
@@ -1746,13 +1742,14 @@ typedef volatile struct
1746 /* 0x010C */ u32 outputclr; 1742 /* 0x010C */ u32 outputclr;
1747 /* 0x0110 */ u32 pinstaterd; 1743 /* 0x0110 */ u32 pinstaterd;
1748#define pininputen pinstaterd 1744#define pininputen pinstaterd
1749
1750} AU1X00_SYS; 1745} AU1X00_SYS;
1751 1746
1752static AU1X00_SYS* const sys = (AU1X00_SYS *)SYS_BASE; 1747static AU1X00_SYS * const sys = (AU1X00_SYS *)SYS_BASE;
1753 1748
1754#endif 1749#endif
1755/* Processor information base on prid. 1750
1751/*
1752 * Processor information based on PRID.
1756 * Copied from PowerPC. 1753 * Copied from PowerPC.
1757 */ 1754 */
1758#ifndef _LANGUAGE_ASSEMBLY 1755#ifndef _LANGUAGE_ASSEMBLY
@@ -1767,9 +1764,8 @@ struct cpu_spec {
1767 unsigned char cpu_pll_wo; /* sys_cpupll reg. write-only */ 1764 unsigned char cpu_pll_wo; /* sys_cpupll reg. write-only */
1768}; 1765};
1769 1766
1770extern struct cpu_spec cpu_specs[]; 1767extern struct cpu_spec cpu_specs[];
1771extern struct cpu_spec *cur_cpu_spec[]; 1768extern struct cpu_spec *cur_cpu_spec[];
1772#endif 1769#endif
1773 1770
1774#endif 1771#endif
1775
diff --git a/include/asm-mips/mach-au1x00/au1000_dma.h b/include/asm-mips/mach-au1x00/au1000_dma.h
index 9f29520e8fb0..c333b4e1cd44 100644
--- a/include/asm-mips/mach-au1x00/au1000_dma.h
+++ b/include/asm-mips/mach-au1x00/au1000_dma.h
@@ -1,11 +1,10 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Defines for using and allocating dma channels on the Alchemy 3 * Defines for using and allocating DMA channels on the Alchemy
4 * Au1000 mips processor. 4 * Au1x00 MIPS processors.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * stevel@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -31,7 +30,7 @@
31#ifndef __ASM_AU1000_DMA_H 30#ifndef __ASM_AU1000_DMA_H
32#define __ASM_AU1000_DMA_H 31#define __ASM_AU1000_DMA_H
33 32
34#include <asm/io.h> /* need byte IO */ 33#include <linux/io.h> /* need byte IO */
35#include <linux/spinlock.h> /* And spinlocks */ 34#include <linux/spinlock.h> /* And spinlocks */
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <asm/system.h> 36#include <asm/system.h>
@@ -50,36 +49,36 @@
50#define DMA_DAH_MASK (0x0f << 20) 49#define DMA_DAH_MASK (0x0f << 20)
51#define DMA_DID_BIT 16 50#define DMA_DID_BIT 16
52#define DMA_DID_MASK (0x0f << DMA_DID_BIT) 51#define DMA_DID_MASK (0x0f << DMA_DID_BIT)
53#define DMA_DS (1<<15) 52#define DMA_DS (1 << 15)
54#define DMA_BE (1<<13) 53#define DMA_BE (1 << 13)
55#define DMA_DR (1<<12) 54#define DMA_DR (1 << 12)
56#define DMA_TS8 (1<<11) 55#define DMA_TS8 (1 << 11)
57#define DMA_DW_BIT 9 56#define DMA_DW_BIT 9
58#define DMA_DW_MASK (0x03 << DMA_DW_BIT) 57#define DMA_DW_MASK (0x03 << DMA_DW_BIT)
59#define DMA_DW8 (0 << DMA_DW_BIT) 58#define DMA_DW8 (0 << DMA_DW_BIT)
60#define DMA_DW16 (1 << DMA_DW_BIT) 59#define DMA_DW16 (1 << DMA_DW_BIT)
61#define DMA_DW32 (2 << DMA_DW_BIT) 60#define DMA_DW32 (2 << DMA_DW_BIT)
62#define DMA_NC (1<<8) 61#define DMA_NC (1 << 8)
63#define DMA_IE (1<<7) 62#define DMA_IE (1 << 7)
64#define DMA_HALT (1<<6) 63#define DMA_HALT (1 << 6)
65#define DMA_GO (1<<5) 64#define DMA_GO (1 << 5)
66#define DMA_AB (1<<4) 65#define DMA_AB (1 << 4)
67#define DMA_D1 (1<<3) 66#define DMA_D1 (1 << 3)
68#define DMA_BE1 (1<<2) 67#define DMA_BE1 (1 << 2)
69#define DMA_D0 (1<<1) 68#define DMA_D0 (1 << 1)
70#define DMA_BE0 (1<<0) 69#define DMA_BE0 (1 << 0)
71 70
72#define DMA_PERIPHERAL_ADDR 0x00000008 71#define DMA_PERIPHERAL_ADDR 0x00000008
73#define DMA_BUFFER0_START 0x0000000C 72#define DMA_BUFFER0_START 0x0000000C
74#define DMA_BUFFER1_START 0x00000014 73#define DMA_BUFFER1_START 0x00000014
75#define DMA_BUFFER0_COUNT 0x00000010 74#define DMA_BUFFER0_COUNT 0x00000010
76#define DMA_BUFFER1_COUNT 0x00000018 75#define DMA_BUFFER1_COUNT 0x00000018
77#define DMA_BAH_BIT 16 76#define DMA_BAH_BIT 16
78#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT) 77#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT)
79#define DMA_COUNT_BIT 0 78#define DMA_COUNT_BIT 0
80#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT) 79#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT)
81 80
82/* DMA Device ID's follow */ 81/* DMA Device IDs follow */
83enum { 82enum {
84 DMA_ID_UART0_TX = 0, 83 DMA_ID_UART0_TX = 0,
85 DMA_ID_UART0_RX, 84 DMA_ID_UART0_RX,
@@ -110,7 +109,8 @@ enum {
110}; 109};
111 110
112struct dma_chan { 111struct dma_chan {
113 int dev_id; // this channel is allocated if >=0, free otherwise 112 int dev_id; /* this channel is allocated if >= 0, */
113 /* free otherwise */
114 unsigned int io; 114 unsigned int io;
115 const char *dev_str; 115 const char *dev_str;
116 int irq; 116 int irq;
@@ -132,23 +132,23 @@ extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
132extern void dump_au1000_dma_channel(unsigned int dmanr); 132extern void dump_au1000_dma_channel(unsigned int dmanr);
133extern spinlock_t au1000_dma_spin_lock; 133extern spinlock_t au1000_dma_spin_lock;
134 134
135 135static inline struct dma_chan *get_dma_chan(unsigned int dmanr)
136static __inline__ struct dma_chan *get_dma_chan(unsigned int dmanr)
137{ 136{
138 if (dmanr >= NUM_AU1000_DMA_CHANNELS 137 if (dmanr >= NUM_AU1000_DMA_CHANNELS ||
139 || au1000_dma_table[dmanr].dev_id < 0) 138 au1000_dma_table[dmanr].dev_id < 0)
140 return NULL; 139 return NULL;
141 return &au1000_dma_table[dmanr]; 140 return &au1000_dma_table[dmanr];
142} 141}
143 142
144static __inline__ unsigned long claim_dma_lock(void) 143static inline unsigned long claim_dma_lock(void)
145{ 144{
146 unsigned long flags; 145 unsigned long flags;
146
147 spin_lock_irqsave(&au1000_dma_spin_lock, flags); 147 spin_lock_irqsave(&au1000_dma_spin_lock, flags);
148 return flags; 148 return flags;
149} 149}
150 150
151static __inline__ void release_dma_lock(unsigned long flags) 151static inline void release_dma_lock(unsigned long flags)
152{ 152{
153 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags); 153 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags);
154} 154}
@@ -156,48 +156,53 @@ static __inline__ void release_dma_lock(unsigned long flags)
156/* 156/*
157 * Set the DMA buffer enable bits in the mode register. 157 * Set the DMA buffer enable bits in the mode register.
158 */ 158 */
159static __inline__ void enable_dma_buffer0(unsigned int dmanr) 159static inline void enable_dma_buffer0(unsigned int dmanr)
160{ 160{
161 struct dma_chan *chan = get_dma_chan(dmanr); 161 struct dma_chan *chan = get_dma_chan(dmanr);
162
162 if (!chan) 163 if (!chan)
163 return; 164 return;
164 au_writel(DMA_BE0, chan->io + DMA_MODE_SET); 165 au_writel(DMA_BE0, chan->io + DMA_MODE_SET);
165} 166}
166static __inline__ void enable_dma_buffer1(unsigned int dmanr) 167
168static inline void enable_dma_buffer1(unsigned int dmanr)
167{ 169{
168 struct dma_chan *chan = get_dma_chan(dmanr); 170 struct dma_chan *chan = get_dma_chan(dmanr);
171
169 if (!chan) 172 if (!chan)
170 return; 173 return;
171 au_writel(DMA_BE1, chan->io + DMA_MODE_SET); 174 au_writel(DMA_BE1, chan->io + DMA_MODE_SET);
172} 175}
173static __inline__ void enable_dma_buffers(unsigned int dmanr) 176static inline void enable_dma_buffers(unsigned int dmanr)
174{ 177{
175 struct dma_chan *chan = get_dma_chan(dmanr); 178 struct dma_chan *chan = get_dma_chan(dmanr);
179
176 if (!chan) 180 if (!chan)
177 return; 181 return;
178 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET); 182 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET);
179} 183}
180 184
181static __inline__ void start_dma(unsigned int dmanr) 185static inline void start_dma(unsigned int dmanr)
182{ 186{
183 struct dma_chan *chan = get_dma_chan(dmanr); 187 struct dma_chan *chan = get_dma_chan(dmanr);
188
184 if (!chan) 189 if (!chan)
185 return; 190 return;
186
187 au_writel(DMA_GO, chan->io + DMA_MODE_SET); 191 au_writel(DMA_GO, chan->io + DMA_MODE_SET);
188} 192}
189 193
190#define DMA_HALT_POLL 0x5000 194#define DMA_HALT_POLL 0x5000
191 195
192static __inline__ void halt_dma(unsigned int dmanr) 196static inline void halt_dma(unsigned int dmanr)
193{ 197{
194 struct dma_chan *chan = get_dma_chan(dmanr); 198 struct dma_chan *chan = get_dma_chan(dmanr);
195 int i; 199 int i;
200
196 if (!chan) 201 if (!chan)
197 return; 202 return;
198
199 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR); 203 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR);
200 // poll the halt bit 204
205 /* Poll the halt bit */
201 for (i = 0; i < DMA_HALT_POLL; i++) 206 for (i = 0; i < DMA_HALT_POLL; i++)
202 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) 207 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT)
203 break; 208 break;
@@ -205,55 +210,57 @@ static __inline__ void halt_dma(unsigned int dmanr)
205 printk(KERN_INFO "halt_dma: HALT poll expired!\n"); 210 printk(KERN_INFO "halt_dma: HALT poll expired!\n");
206} 211}
207 212
208 213static inline void disable_dma(unsigned int dmanr)
209static __inline__ void disable_dma(unsigned int dmanr)
210{ 214{
211 struct dma_chan *chan = get_dma_chan(dmanr); 215 struct dma_chan *chan = get_dma_chan(dmanr);
216
212 if (!chan) 217 if (!chan)
213 return; 218 return;
214 219
215 halt_dma(dmanr); 220 halt_dma(dmanr);
216 221
217 // now we can disable the buffers 222 /* Now we can disable the buffers */
218 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR); 223 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR);
219} 224}
220 225
221static __inline__ int dma_halted(unsigned int dmanr) 226static inline int dma_halted(unsigned int dmanr)
222{ 227{
223 struct dma_chan *chan = get_dma_chan(dmanr); 228 struct dma_chan *chan = get_dma_chan(dmanr);
229
224 if (!chan) 230 if (!chan)
225 return 1; 231 return 1;
226 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0; 232 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0;
227} 233}
228 234
229/* initialize a DMA channel */ 235/* Initialize a DMA channel. */
230static __inline__ void init_dma(unsigned int dmanr) 236static inline void init_dma(unsigned int dmanr)
231{ 237{
232 struct dma_chan *chan = get_dma_chan(dmanr); 238 struct dma_chan *chan = get_dma_chan(dmanr);
233 u32 mode; 239 u32 mode;
240
234 if (!chan) 241 if (!chan)
235 return; 242 return;
236 243
237 disable_dma(dmanr); 244 disable_dma(dmanr);
238 245
239 // set device FIFO address 246 /* Set device FIFO address */
240 au_writel(CPHYSADDR(chan->fifo_addr), 247 au_writel(CPHYSADDR(chan->fifo_addr), chan->io + DMA_PERIPHERAL_ADDR);
241 chan->io + DMA_PERIPHERAL_ADDR);
242 248
243 mode = chan->mode | (chan->dev_id << DMA_DID_BIT); 249 mode = chan->mode | (chan->dev_id << DMA_DID_BIT);
244 if (chan->irq) 250 if (chan->irq)
245 mode |= DMA_IE; 251 mode |= DMA_IE;
246 252
247 au_writel(~mode, chan->io + DMA_MODE_CLEAR); 253 au_writel(~mode, chan->io + DMA_MODE_CLEAR);
248 au_writel(mode, chan->io + DMA_MODE_SET); 254 au_writel(mode, chan->io + DMA_MODE_SET);
249} 255}
250 256
251/* 257/*
252 * set mode for a specific DMA channel 258 * Set mode for a specific DMA channel
253 */ 259 */
254static __inline__ void set_dma_mode(unsigned int dmanr, unsigned int mode) 260static inline void set_dma_mode(unsigned int dmanr, unsigned int mode)
255{ 261{
256 struct dma_chan *chan = get_dma_chan(dmanr); 262 struct dma_chan *chan = get_dma_chan(dmanr);
263
257 if (!chan) 264 if (!chan)
258 return; 265 return;
259 /* 266 /*
@@ -266,36 +273,37 @@ static __inline__ void set_dma_mode(unsigned int dmanr, unsigned int mode)
266 chan->mode |= mode; 273 chan->mode |= mode;
267} 274}
268 275
269static __inline__ unsigned int get_dma_mode(unsigned int dmanr) 276static inline unsigned int get_dma_mode(unsigned int dmanr)
270{ 277{
271 struct dma_chan *chan = get_dma_chan(dmanr); 278 struct dma_chan *chan = get_dma_chan(dmanr);
279
272 if (!chan) 280 if (!chan)
273 return 0; 281 return 0;
274 return chan->mode; 282 return chan->mode;
275} 283}
276 284
277static __inline__ int get_dma_active_buffer(unsigned int dmanr) 285static inline int get_dma_active_buffer(unsigned int dmanr)
278{ 286{
279 struct dma_chan *chan = get_dma_chan(dmanr); 287 struct dma_chan *chan = get_dma_chan(dmanr);
288
280 if (!chan) 289 if (!chan)
281 return -1; 290 return -1;
282 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0; 291 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0;
283} 292}
284 293
285
286/* 294/*
287 * set the device FIFO address for a specific DMA channel - only 295 * Set the device FIFO address for a specific DMA channel - only
288 * applicable to GPO4 and GPO5. All the other devices have fixed 296 * applicable to GPO4 and GPO5. All the other devices have fixed
289 * FIFO addresses. 297 * FIFO addresses.
290 */ 298 */
291static __inline__ void set_dma_fifo_addr(unsigned int dmanr, 299static inline void set_dma_fifo_addr(unsigned int dmanr, unsigned int a)
292 unsigned int a)
293{ 300{
294 struct dma_chan *chan = get_dma_chan(dmanr); 301 struct dma_chan *chan = get_dma_chan(dmanr);
302
295 if (!chan) 303 if (!chan)
296 return; 304 return;
297 305
298 if (chan->mode & DMA_DS) /* second bank of device ids */ 306 if (chan->mode & DMA_DS) /* second bank of device IDs */
299 return; 307 return;
300 308
301 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05) 309 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05)
@@ -307,16 +315,19 @@ static __inline__ void set_dma_fifo_addr(unsigned int dmanr,
307/* 315/*
308 * Clear the DMA buffer done bits in the mode register. 316 * Clear the DMA buffer done bits in the mode register.
309 */ 317 */
310static __inline__ void clear_dma_done0(unsigned int dmanr) 318static inline void clear_dma_done0(unsigned int dmanr)
311{ 319{
312 struct dma_chan *chan = get_dma_chan(dmanr); 320 struct dma_chan *chan = get_dma_chan(dmanr);
321
313 if (!chan) 322 if (!chan)
314 return; 323 return;
315 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR); 324 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR);
316} 325}
317static __inline__ void clear_dma_done1(unsigned int dmanr) 326
327static inline void clear_dma_done1(unsigned int dmanr)
318{ 328{
319 struct dma_chan *chan = get_dma_chan(dmanr); 329 struct dma_chan *chan = get_dma_chan(dmanr);
330
320 if (!chan) 331 if (!chan)
321 return; 332 return;
322 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR); 333 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR);
@@ -325,16 +336,17 @@ static __inline__ void clear_dma_done1(unsigned int dmanr)
325/* 336/*
326 * This does nothing - not applicable to Au1000 DMA. 337 * This does nothing - not applicable to Au1000 DMA.
327 */ 338 */
328static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) 339static inline void set_dma_page(unsigned int dmanr, char pagenr)
329{ 340{
330} 341}
331 342
332/* 343/*
333 * Set Buffer 0 transfer address for specific DMA channel. 344 * Set Buffer 0 transfer address for specific DMA channel.
334 */ 345 */
335static __inline__ void set_dma_addr0(unsigned int dmanr, unsigned int a) 346static inline void set_dma_addr0(unsigned int dmanr, unsigned int a)
336{ 347{
337 struct dma_chan *chan = get_dma_chan(dmanr); 348 struct dma_chan *chan = get_dma_chan(dmanr);
349
338 if (!chan) 350 if (!chan)
339 return; 351 return;
340 au_writel(a, chan->io + DMA_BUFFER0_START); 352 au_writel(a, chan->io + DMA_BUFFER0_START);
@@ -343,9 +355,10 @@ static __inline__ void set_dma_addr0(unsigned int dmanr, unsigned int a)
343/* 355/*
344 * Set Buffer 1 transfer address for specific DMA channel. 356 * Set Buffer 1 transfer address for specific DMA channel.
345 */ 357 */
346static __inline__ void set_dma_addr1(unsigned int dmanr, unsigned int a) 358static inline void set_dma_addr1(unsigned int dmanr, unsigned int a)
347{ 359{
348 struct dma_chan *chan = get_dma_chan(dmanr); 360 struct dma_chan *chan = get_dma_chan(dmanr);
361
349 if (!chan) 362 if (!chan)
350 return; 363 return;
351 au_writel(a, chan->io + DMA_BUFFER1_START); 364 au_writel(a, chan->io + DMA_BUFFER1_START);
@@ -355,10 +368,10 @@ static __inline__ void set_dma_addr1(unsigned int dmanr, unsigned int a)
355/* 368/*
356 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel. 369 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel.
357 */ 370 */
358static __inline__ void set_dma_count0(unsigned int dmanr, 371static inline void set_dma_count0(unsigned int dmanr, unsigned int count)
359 unsigned int count)
360{ 372{
361 struct dma_chan *chan = get_dma_chan(dmanr); 373 struct dma_chan *chan = get_dma_chan(dmanr);
374
362 if (!chan) 375 if (!chan)
363 return; 376 return;
364 count &= DMA_COUNT_MASK; 377 count &= DMA_COUNT_MASK;
@@ -368,10 +381,10 @@ static __inline__ void set_dma_count0(unsigned int dmanr,
368/* 381/*
369 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel. 382 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel.
370 */ 383 */
371static __inline__ void set_dma_count1(unsigned int dmanr, 384static inline void set_dma_count1(unsigned int dmanr, unsigned int count)
372 unsigned int count)
373{ 385{
374 struct dma_chan *chan = get_dma_chan(dmanr); 386 struct dma_chan *chan = get_dma_chan(dmanr);
387
375 if (!chan) 388 if (!chan)
376 return; 389 return;
377 count &= DMA_COUNT_MASK; 390 count &= DMA_COUNT_MASK;
@@ -381,10 +394,10 @@ static __inline__ void set_dma_count1(unsigned int dmanr,
381/* 394/*
382 * Set both buffer transfer sizes (max 64k) for a specific DMA channel. 395 * Set both buffer transfer sizes (max 64k) for a specific DMA channel.
383 */ 396 */
384static __inline__ void set_dma_count(unsigned int dmanr, 397static inline void set_dma_count(unsigned int dmanr, unsigned int count)
385 unsigned int count)
386{ 398{
387 struct dma_chan *chan = get_dma_chan(dmanr); 399 struct dma_chan *chan = get_dma_chan(dmanr);
400
388 if (!chan) 401 if (!chan)
389 return; 402 return;
390 count &= DMA_COUNT_MASK; 403 count &= DMA_COUNT_MASK;
@@ -396,35 +409,36 @@ static __inline__ void set_dma_count(unsigned int dmanr,
396 * Returns which buffer has its done bit set in the mode register. 409 * Returns which buffer has its done bit set in the mode register.
397 * Returns -1 if neither or both done bits set. 410 * Returns -1 if neither or both done bits set.
398 */ 411 */
399static __inline__ unsigned int get_dma_buffer_done(unsigned int dmanr) 412static inline unsigned int get_dma_buffer_done(unsigned int dmanr)
400{ 413{
401 struct dma_chan *chan = get_dma_chan(dmanr); 414 struct dma_chan *chan = get_dma_chan(dmanr);
415
402 if (!chan) 416 if (!chan)
403 return 0; 417 return 0;
404 418 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
405 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
406} 419}
407 420
408 421
409/* 422/*
410 * Returns the DMA channel's Buffer Done IRQ number. 423 * Returns the DMA channel's Buffer Done IRQ number.
411 */ 424 */
412static __inline__ int get_dma_done_irq(unsigned int dmanr) 425static inline int get_dma_done_irq(unsigned int dmanr)
413{ 426{
414 struct dma_chan *chan = get_dma_chan(dmanr); 427 struct dma_chan *chan = get_dma_chan(dmanr);
428
415 if (!chan) 429 if (!chan)
416 return -1; 430 return -1;
417
418 return chan->irq; 431 return chan->irq;
419} 432}
420 433
421/* 434/*
422 * Get DMA residue count. Returns the number of _bytes_ left to transfer. 435 * Get DMA residue count. Returns the number of _bytes_ left to transfer.
423 */ 436 */
424static __inline__ int get_dma_residue(unsigned int dmanr) 437static inline int get_dma_residue(unsigned int dmanr)
425{ 438{
426 int curBufCntReg, count; 439 int curBufCntReg, count;
427 struct dma_chan *chan = get_dma_chan(dmanr); 440 struct dma_chan *chan = get_dma_chan(dmanr);
441
428 if (!chan) 442 if (!chan)
429 return 0; 443 return 0;
430 444
@@ -442,4 +456,3 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
442} 456}
443 457
444#endif /* __ASM_AU1000_DMA_H */ 458#endif /* __ASM_AU1000_DMA_H */
445
diff --git a/include/asm-mips/mach-au1x00/au1000_gpio.h b/include/asm-mips/mach-au1x00/au1000_gpio.h
index 298f92012e8e..d8c96fda5549 100644
--- a/include/asm-mips/mach-au1x00/au1000_gpio.h
+++ b/include/asm-mips/mach-au1x00/au1000_gpio.h
@@ -2,12 +2,12 @@
2 * FILE NAME au1000_gpio.h 2 * FILE NAME au1000_gpio.h
3 * 3 *
4 * BRIEF MODULE DESCRIPTION 4 * BRIEF MODULE DESCRIPTION
5 * API to Alchemy Au1000 GPIO device. 5 * API to Alchemy Au1xx0 GPIO device.
6 * 6 *
7 * Author: MontaVista Software, Inc. <source@mvista.com> 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Steve Longerbeam <stevel@mvista.com> 8 * Steve Longerbeam
9 * 9 *
10 * Copyright 2001 MontaVista Software Inc. 10 * Copyright 2001, 2008 MontaVista Software Inc.
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
@@ -37,12 +37,12 @@
37 37
38#define AU1000GPIO_IOC_MAGIC 'A' 38#define AU1000GPIO_IOC_MAGIC 'A'
39 39
40#define AU1000GPIO_IN _IOR (AU1000GPIO_IOC_MAGIC, 0, int) 40#define AU1000GPIO_IN _IOR(AU1000GPIO_IOC_MAGIC, 0, int)
41#define AU1000GPIO_SET _IOW (AU1000GPIO_IOC_MAGIC, 1, int) 41#define AU1000GPIO_SET _IOW(AU1000GPIO_IOC_MAGIC, 1, int)
42#define AU1000GPIO_CLEAR _IOW (AU1000GPIO_IOC_MAGIC, 2, int) 42#define AU1000GPIO_CLEAR _IOW(AU1000GPIO_IOC_MAGIC, 2, int)
43#define AU1000GPIO_OUT _IOW (AU1000GPIO_IOC_MAGIC, 3, int) 43#define AU1000GPIO_OUT _IOW(AU1000GPIO_IOC_MAGIC, 3, int)
44#define AU1000GPIO_TRISTATE _IOW (AU1000GPIO_IOC_MAGIC, 4, int) 44#define AU1000GPIO_TRISTATE _IOW(AU1000GPIO_IOC_MAGIC, 4, int)
45#define AU1000GPIO_AVAIL_MASK _IOR (AU1000GPIO_IOC_MAGIC, 5, int) 45#define AU1000GPIO_AVAIL_MASK _IOR(AU1000GPIO_IOC_MAGIC, 5, int)
46 46
47#ifdef __KERNEL__ 47#ifdef __KERNEL__
48extern u32 get_au1000_avail_gpio_mask(void); 48extern u32 get_au1000_avail_gpio_mask(void);
diff --git a/include/asm-mips/mach-au1x00/au1550_spi.h b/include/asm-mips/mach-au1x00/au1550_spi.h
index c2f0466523ec..40e6c489833a 100644
--- a/include/asm-mips/mach-au1x00/au1550_spi.h
+++ b/include/asm-mips/mach-au1x00/au1550_spi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * au1550_spi.h - au1550 psc spi controller driver - platform data struct 2 * au1550_spi.h - Au1550 PSC SPI controller driver - platform data structure
3 */ 3 */
4 4
5#ifndef _AU1550_SPI_H_ 5#ifndef _AU1550_SPI_H_
diff --git a/include/asm-mips/mach-au1x00/au1xxx.h b/include/asm-mips/mach-au1x00/au1xxx.h
index 947135941033..1b3655090ed3 100644
--- a/include/asm-mips/mach-au1x00/au1xxx.h
+++ b/include/asm-mips/mach-au1x00/au1xxx.h
@@ -23,10 +23,10 @@
23#ifndef _AU1XXX_H_ 23#ifndef _AU1XXX_H_
24#define _AU1XXX_H_ 24#define _AU1XXX_H_
25 25
26
27#include <asm/mach-au1x00/au1000.h> 26#include <asm/mach-au1x00/au1000.h>
28 27
29#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) 28#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \
29 defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550)
30#include <asm/mach-db1x00/db1x00.h> 30#include <asm/mach-db1x00/db1x00.h>
31 31
32#elif defined(CONFIG_MIPS_PB1550) 32#elif defined(CONFIG_MIPS_PB1550)
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
index 93d507cea518..44a67bf05dc1 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
@@ -28,17 +28,18 @@
28 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 29 */
30 30
31/* Specifics for the Au1xxx Descriptor-Based DMA Controllers, first 31/*
32 * seen in the AU1550 part. 32 * Specifics for the Au1xxx Descriptor-Based DMA Controller,
33 * first seen in the AU1550 part.
33 */ 34 */
34#ifndef _AU1000_DBDMA_H_ 35#ifndef _AU1000_DBDMA_H_
35#define _AU1000_DBDMA_H_ 36#define _AU1000_DBDMA_H_
36 37
37
38#ifndef _LANGUAGE_ASSEMBLY 38#ifndef _LANGUAGE_ASSEMBLY
39 39
40/* The DMA base addresses. 40/*
41 * The Channels are every 256 bytes (0x0100) from the channel 0 base. 41 * The DMA base addresses.
42 * The channels are every 256 bytes (0x0100) from the channel 0 base.
42 * Interrupt status/enable is bits 15:0 for channels 15 to zero. 43 * Interrupt status/enable is bits 15:0 for channels 15 to zero.
43 */ 44 */
44#define DDMA_GLOBAL_BASE 0xb4003000 45#define DDMA_GLOBAL_BASE 0xb4003000
@@ -51,16 +52,14 @@ typedef volatile struct dbdma_global {
51 u32 ddma_inten; 52 u32 ddma_inten;
52} dbdma_global_t; 53} dbdma_global_t;
53 54
54/* General Configuration. 55/* General Configuration. */
55*/
56#define DDMA_CONFIG_AF (1 << 2) 56#define DDMA_CONFIG_AF (1 << 2)
57#define DDMA_CONFIG_AH (1 << 1) 57#define DDMA_CONFIG_AH (1 << 1)
58#define DDMA_CONFIG_AL (1 << 0) 58#define DDMA_CONFIG_AL (1 << 0)
59 59
60#define DDMA_THROTTLE_EN (1 << 31) 60#define DDMA_THROTTLE_EN (1 << 31)
61 61
62/* The structure of a DMA Channel. 62/* The structure of a DMA Channel. */
63*/
64typedef volatile struct au1xxx_dma_channel { 63typedef volatile struct au1xxx_dma_channel {
65 u32 ddma_cfg; /* See below */ 64 u32 ddma_cfg; /* See below */
66 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */ 65 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */
@@ -69,8 +68,7 @@ typedef volatile struct au1xxx_dma_channel {
69 u32 ddma_irq; /* If bit 0 set, interrupt pending */ 68 u32 ddma_irq; /* If bit 0 set, interrupt pending */
70 u32 ddma_stat; /* See below */ 69 u32 ddma_stat; /* See below */
71 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */ 70 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */
72 /* Remainder, up to the 256 byte boundary, is reserved. 71 /* Remainder, up to the 256 byte boundary, is reserved. */
73 */
74} au1x_dma_chan_t; 72} au1x_dma_chan_t;
75 73
76#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */ 74#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */
@@ -84,7 +82,8 @@ typedef volatile struct au1xxx_dma_channel {
84#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */ 82#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */
85#define DDMA_CFG_EN (1 << 0) /* Channel enable */ 83#define DDMA_CFG_EN (1 << 0) /* Channel enable */
86 84
87/* Always set when descriptor processing done, regardless of 85/*
86 * Always set when descriptor processing done, regardless of
88 * interrupt enable state. Reflected in global intstat, don't 87 * interrupt enable state. Reflected in global intstat, don't
89 * clear this until global intstat is read/used. 88 * clear this until global intstat is read/used.
90 */ 89 */
@@ -94,7 +93,8 @@ typedef volatile struct au1xxx_dma_channel {
94#define DDMA_STAT_V (1 << 1) /* Descriptor valid */ 93#define DDMA_STAT_V (1 << 1) /* Descriptor valid */
95#define DDMA_STAT_H (1 << 0) /* Channel Halted */ 94#define DDMA_STAT_H (1 << 0) /* Channel Halted */
96 95
97/* "Standard" DDMA Descriptor. 96/*
97 * "Standard" DDMA Descriptor.
98 * Must be 32-byte aligned. 98 * Must be 32-byte aligned.
99 */ 99 */
100typedef volatile struct au1xxx_ddma_desc { 100typedef volatile struct au1xxx_ddma_desc {
@@ -106,8 +106,9 @@ typedef volatile struct au1xxx_ddma_desc {
106 u32 dscr_dest1; /* See below */ 106 u32 dscr_dest1; /* See below */
107 u32 dscr_stat; /* completion status */ 107 u32 dscr_stat; /* completion status */
108 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */ 108 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */
109 /* First 32bytes are HW specific!!! 109 /*
110 Lets have some SW data following.. make sure its 32bytes 110 * First 32 bytes are HW specific!!!
111 * Lets have some SW data following -- make sure it's 32 bytes.
111 */ 112 */
112 u32 sw_status; 113 u32 sw_status;
113 u32 sw_context; 114 u32 sw_context;
@@ -130,10 +131,9 @@ typedef volatile struct au1xxx_ddma_desc {
130#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */ 131#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */
131#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */ 132#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */
132 133
133#define SW_STATUS_INUSE (1<<0) 134#define SW_STATUS_INUSE (1 << 0)
134 135
135/* Command 0 device IDs. 136/* Command 0 device IDs. */
136*/
137#ifdef CONFIG_SOC_AU1550 137#ifdef CONFIG_SOC_AU1550
138#define DSCR_CMD0_UART0_TX 0 138#define DSCR_CMD0_UART0_TX 0
139#define DSCR_CMD0_UART0_RX 1 139#define DSCR_CMD0_UART0_RX 1
@@ -198,16 +198,15 @@ typedef volatile struct au1xxx_ddma_desc {
198#define DSCR_CMD0_THROTTLE 30 198#define DSCR_CMD0_THROTTLE 30
199#define DSCR_CMD0_ALWAYS 31 199#define DSCR_CMD0_ALWAYS 31
200#define DSCR_NDEV_IDS 32 200#define DSCR_NDEV_IDS 32
201/* THis macro is used to find/create custom device types */ 201/* This macro is used to find/create custom device types */
202#define DSCR_DEV2CUSTOM_ID(x, d) (((((x)&0xFFFF)<<8)|0x32000000)|((d)&0xFF)) 202#define DSCR_DEV2CUSTOM_ID(x, d) (((((x) & 0xFFFF) << 8) | 0x32000000) | \
203#define DSCR_CUSTOM2DEV_ID(x) ((x)&0xFF) 203 ((d) & 0xFF))
204 204#define DSCR_CUSTOM2DEV_ID(x) ((x) & 0xFF)
205 205
206#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25) 206#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25)
207#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20) 207#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20)
208 208
209/* Source/Destination transfer width. 209/* Source/Destination transfer width. */
210*/
211#define DSCR_CMD0_BYTE 0 210#define DSCR_CMD0_BYTE 0
212#define DSCR_CMD0_HALFWORD 1 211#define DSCR_CMD0_HALFWORD 1
213#define DSCR_CMD0_WORD 2 212#define DSCR_CMD0_WORD 2
@@ -215,16 +214,14 @@ typedef volatile struct au1xxx_ddma_desc {
215#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18) 214#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18)
216#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16) 215#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16)
217 216
218/* DDMA Descriptor Type. 217/* DDMA Descriptor Type. */
219*/
220#define DSCR_CMD0_STANDARD 0 218#define DSCR_CMD0_STANDARD 0
221#define DSCR_CMD0_LITERAL 1 219#define DSCR_CMD0_LITERAL 1
222#define DSCR_CMD0_CMP_BRANCH 2 220#define DSCR_CMD0_CMP_BRANCH 2
223 221
224#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13) 222#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13)
225 223
226/* Status Instruction. 224/* Status Instruction. */
227*/
228#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */ 225#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */
229#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */ 226#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */
230#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */ 227#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */
@@ -232,23 +229,20 @@ typedef volatile struct au1xxx_ddma_desc {
232 229
233#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0) 230#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0)
234 231
235/* Descriptor Command 1 232/* Descriptor Command 1. */
236*/
237#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */ 233#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */
238#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */ 234#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */
239#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */ 235#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */
240#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */ 236#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */
241 237
242/* Flag description. 238/* Flag description. */
243*/
244#define DSCR_CMD1_FL_MEM_STRIDE0 0 239#define DSCR_CMD1_FL_MEM_STRIDE0 0
245#define DSCR_CMD1_FL_MEM_STRIDE1 1 240#define DSCR_CMD1_FL_MEM_STRIDE1 1
246#define DSCR_CMD1_FL_MEM_STRIDE2 2 241#define DSCR_CMD1_FL_MEM_STRIDE2 2
247 242
248#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22) 243#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22)
249 244
250/* Source1, 1-dimensional stride. 245/* Source1, 1-dimensional stride. */
251*/
252#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */ 246#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */
253#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */ 247#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */
254#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */ 248#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */
@@ -256,8 +250,7 @@ typedef volatile struct au1xxx_ddma_desc {
256#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */ 250#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */
257#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0) 251#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0)
258 252
259/* Dest1, 1-dimensional stride. 253/* Dest1, 1-dimensional stride. */
260*/
261#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */ 254#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */
262#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */ 255#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */
263#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */ 256#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */
@@ -279,29 +272,27 @@ typedef volatile struct au1xxx_ddma_desc {
279#define DSCR_SRC1_SAM(x) (((x) & 3) << 28) 272#define DSCR_SRC1_SAM(x) (((x) & 3) << 28)
280#define DSCR_DEST1_DAM(x) (((x) & 3) << 28) 273#define DSCR_DEST1_DAM(x) (((x) & 3) << 28)
281 274
282/* The next descriptor pointer. 275/* The next descriptor pointer. */
283*/
284#define DSCR_NXTPTR_MASK (0x07ffffff) 276#define DSCR_NXTPTR_MASK (0x07ffffff)
285#define DSCR_NXTPTR(x) ((x) >> 5) 277#define DSCR_NXTPTR(x) ((x) >> 5)
286#define DSCR_GET_NXTPTR(x) ((x) << 5) 278#define DSCR_GET_NXTPTR(x) ((x) << 5)
287#define DSCR_NXTPTR_MS (1 << 27) 279#define DSCR_NXTPTR_MS (1 << 27)
288 280
289/* The number of DBDMA channels. 281/* The number of DBDMA channels. */
290*/
291#define NUM_DBDMA_CHANS 16 282#define NUM_DBDMA_CHANS 16
292 283
293/* 284/*
294 * Ddma API definitions 285 * DDMA API definitions
295 * FIXME: may not fit to this header file 286 * FIXME: may not fit to this header file
296 */ 287 */
297typedef struct dbdma_device_table { 288typedef struct dbdma_device_table {
298 u32 dev_id; 289 u32 dev_id;
299 u32 dev_flags; 290 u32 dev_flags;
300 u32 dev_tsize; 291 u32 dev_tsize;
301 u32 dev_devwidth; 292 u32 dev_devwidth;
302 u32 dev_physaddr; /* If FIFO */ 293 u32 dev_physaddr; /* If FIFO */
303 u32 dev_intlevel; 294 u32 dev_intlevel;
304 u32 dev_intpolarity; 295 u32 dev_intpolarity;
305} dbdev_tab_t; 296} dbdev_tab_t;
306 297
307 298
@@ -316,44 +307,41 @@ typedef struct dbdma_chan_config {
316 au1x_ddma_desc_t *chan_desc_base; 307 au1x_ddma_desc_t *chan_desc_base;
317 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr; 308 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
318 void *chan_callparam; 309 void *chan_callparam;
319 void (*chan_callback)(int, void *); 310 void (*chan_callback)(int, void *);
320} chan_tab_t; 311} chan_tab_t;
321 312
322#define DEV_FLAGS_INUSE (1 << 0) 313#define DEV_FLAGS_INUSE (1 << 0)
323#define DEV_FLAGS_ANYUSE (1 << 1) 314#define DEV_FLAGS_ANYUSE (1 << 1)
324#define DEV_FLAGS_OUT (1 << 2) 315#define DEV_FLAGS_OUT (1 << 2)
325#define DEV_FLAGS_IN (1 << 3) 316#define DEV_FLAGS_IN (1 << 3)
326#define DEV_FLAGS_BURSTABLE (1 << 4) 317#define DEV_FLAGS_BURSTABLE (1 << 4)
327#define DEV_FLAGS_SYNC (1 << 5) 318#define DEV_FLAGS_SYNC (1 << 5)
328/* end Ddma API definitions */ 319/* end DDMA API definitions */
329 320
330/* External functions for drivers to use. 321/*
331*/ 322 * External functions for drivers to use.
332/* Use this to allocate a dbdma channel. The device ids are one of the 323 * Use this to allocate a DBDMA channel. The device IDs are one of
333 * DSCR_CMD0 devices IDs, which is usually redefined to a more 324 * the DSCR_CMD0 devices IDs, which is usually redefined to a more
334 * meaningful name. The 'callback' is called during dma completion 325 * meaningful name. The 'callback' is called during DMA completion
335 * interrupt. 326 * interrupt.
336 */ 327 */
337extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, 328extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
338 void (*callback)(int, void *), void *callparam); 329 void (*callback)(int, void *),
330 void *callparam);
339 331
340#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS 332#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
341 333
342/* Set the device width of a in/out fifo. 334/* Set the device width of an in/out FIFO. */
343*/
344u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits); 335u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
345 336
346/* Allocate a ring of descriptors for dbdma. 337/* Allocate a ring of descriptors for DBDMA. */
347*/
348u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries); 338u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
349 339
350/* Put buffers on source/destination descriptors. 340/* Put buffers on source/destination descriptors. */
351*/
352u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags); 341u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags);
353u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags); 342u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags);
354 343
355/* Get a buffer from the destination descriptor. 344/* Get a buffer from the destination descriptor. */
356*/
357u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes); 345u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes);
358 346
359void au1xxx_dbdma_stop(u32 chanid); 347void au1xxx_dbdma_stop(u32 chanid);
@@ -364,29 +352,35 @@ u32 au1xxx_get_dma_residue(u32 chanid);
364void au1xxx_dbdma_chan_free(u32 chanid); 352void au1xxx_dbdma_chan_free(u32 chanid);
365void au1xxx_dbdma_dump(u32 chanid); 353void au1xxx_dbdma_dump(u32 chanid);
366 354
367u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr ); 355u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr);
368 356
369u32 au1xxx_ddma_add_device( dbdev_tab_t *dev ); 357u32 au1xxx_ddma_add_device(dbdev_tab_t *dev);
370void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp); 358extern void au1xxx_ddma_del_device(u32 devid);
359void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp);
371 360
372/* 361/*
373 Some compatibilty macros -- 362 * Some compatibilty macros -- needed to make changes to API
374 Needed to make changes to API without breaking existing drivers 363 * without breaking existing drivers.
375*/ 364 */
376#define au1xxx_dbdma_put_source(chanid, buf, nbytes)_au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE) 365#define au1xxx_dbdma_put_source(chanid, buf, nbytes) \
377#define au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags) 366 _au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE)
378#define put_source_flags(chanid, buf, nbytes, flags) au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) 367#define au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) \
379 368 _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags)
380 369#define put_source_flags(chanid, buf, nbytes, flags) \
381#define au1xxx_dbdma_put_dest(chanid, buf, nbytes) _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE) 370 au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags)
382#define au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags) 371
383#define put_dest_flags(chanid, buf, nbytes, flags) au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) 372#define au1xxx_dbdma_put_dest(chanid, buf, nbytes) \
373 _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE)
374#define au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) \
375 _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags)
376#define put_dest_flags(chanid, buf, nbytes, flags) \
377 au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags)
384 378
385/* 379/*
386 * Flags for the put_source/put_dest functions. 380 * Flags for the put_source/put_dest functions.
387 */ 381 */
388#define DDMA_FLAGS_IE (1<<0) 382#define DDMA_FLAGS_IE (1 << 0)
389#define DDMA_FLAGS_NOIE (1<<1) 383#define DDMA_FLAGS_NOIE (1 << 1)
390 384
391#endif /* _LANGUAGE_ASSEMBLY */ 385#endif /* _LANGUAGE_ASSEMBLY */
392#endif /* _AU1000_DBDMA_H_ */ 386#endif /* _AU1000_DBDMA_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index b493a5e46c63..60638b8969ba 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -31,167 +31,164 @@
31 */ 31 */
32 32
33#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 33#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
34 #define DMA_WAIT_TIMEOUT 100 34#define DMA_WAIT_TIMEOUT 100
35 #define NUM_DESCRIPTORS PRD_ENTRIES 35#define NUM_DESCRIPTORS PRD_ENTRIES
36#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */ 36#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */
37 #define NUM_DESCRIPTORS 2 37#define NUM_DESCRIPTORS 2
38#endif 38#endif
39 39
40#ifndef AU1XXX_ATA_RQSIZE 40#ifndef AU1XXX_ATA_RQSIZE
41 #define AU1XXX_ATA_RQSIZE 128 41#define AU1XXX_ATA_RQSIZE 128
42#endif 42#endif
43 43
44/* Disable Burstable-Support for DBDMA */ 44/* Disable Burstable-Support for DBDMA */
45#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 45#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
46 #define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 0 46#define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 0
47#endif 47#endif
48 48
49#ifdef CONFIG_PM 49#ifdef CONFIG_PM
50/* 50/*
51* This will enable the device to be powered up when write() or read() 51 * This will enable the device to be powered up when write() or read()
52* is called. If this is not defined, the driver will return -EBUSY. 52 * is called. If this is not defined, the driver will return -EBUSY.
53*/ 53 */
54#define WAKE_ON_ACCESS 1 54#define WAKE_ON_ACCESS 1
55 55
56typedef struct 56typedef struct {
57{ 57 spinlock_t lock; /* Used to block on state transitions */
58 spinlock_t lock; /* Used to block on state transitions */ 58 au1xxx_power_dev_t *dev; /* Power Managers device structure */
59 au1xxx_power_dev_t *dev; /* Power Managers device structure */ 59 unsigned stopped; /* Used to signal device is stopped */
60 unsigned stopped; /* USed to signaling device is stopped */
61} pm_state; 60} pm_state;
62#endif 61#endif
63 62
64 63typedef struct {
65typedef struct 64 u32 tx_dev_id, rx_dev_id, target_dev_id;
66{ 65 u32 tx_chan, rx_chan;
67 u32 tx_dev_id, rx_dev_id, target_dev_id; 66 void *tx_desc_head, *rx_desc_head;
68 u32 tx_chan, rx_chan; 67 ide_hwif_t *hwif;
69 void *tx_desc_head, *rx_desc_head;
70 ide_hwif_t *hwif;
71#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 68#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
72 ide_drive_t *drive; 69 ide_drive_t *drive;
73 struct dbdma_cmd *dma_table_cpu; 70 struct dbdma_cmd *dma_table_cpu;
74 dma_addr_t dma_table_dma; 71 dma_addr_t dma_table_dma;
75#endif 72#endif
76 int irq; 73 int irq;
77 u32 regbase; 74 u32 regbase;
78#ifdef CONFIG_PM 75#ifdef CONFIG_PM
79 pm_state pm; 76 pm_state pm;
80#endif 77#endif
81} _auide_hwif; 78} _auide_hwif;
82 79
83/******************************************************************************* 80/******************************************************************************/
84* PIO Mode timing calculation : * 81/* PIO Mode timing calculation : */
85* * 82/* */
86* Static Bus Spec ATA Spec * 83/* Static Bus Spec ATA Spec */
87* Tcsoe = t1 * 84/* Tcsoe = t1 */
88* Toecs = t9 * 85/* Toecs = t9 */
89* Twcs = t9 * 86/* Twcs = t9 */
90* Tcsh = t2i | t2 * 87/* Tcsh = t2i | t2 */
91* Tcsoff = t2i | t2 * 88/* Tcsoff = t2i | t2 */
92* Twp = t2 * 89/* Twp = t2 */
93* Tcsw = t1 * 90/* Tcsw = t1 */
94* Tpm = 0 * 91/* Tpm = 0 */
95* Ta = t1+t2 * 92/* Ta = t1+t2 */
96*******************************************************************************/ 93/******************************************************************************/
97 94
98#define TCSOE_MASK (0x07<<29) 95#define TCSOE_MASK (0x07 << 29)
99#define TOECS_MASK (0x07<<26) 96#define TOECS_MASK (0x07 << 26)
100#define TWCS_MASK (0x07<<28) 97#define TWCS_MASK (0x07 << 28)
101#define TCSH_MASK (0x0F<<24) 98#define TCSH_MASK (0x0F << 24)
102#define TCSOFF_MASK (0x07<<20) 99#define TCSOFF_MASK (0x07 << 20)
103#define TWP_MASK (0x3F<<14) 100#define TWP_MASK (0x3F << 14)
104#define TCSW_MASK (0x0F<<10) 101#define TCSW_MASK (0x0F << 10)
105#define TPM_MASK (0x0F<<6) 102#define TPM_MASK (0x0F << 6)
106#define TA_MASK (0x3F<<0) 103#define TA_MASK (0x3F << 0)
107#define TS_MASK (1<<8) 104#define TS_MASK (1 << 8)
108 105
109/* Timing parameters PIO mode 0 */ 106/* Timing parameters PIO mode 0 */
110#define SBC_IDE_PIO0_TCSOE (0x04<<29) 107#define SBC_IDE_PIO0_TCSOE (0x04 << 29)
111#define SBC_IDE_PIO0_TOECS (0x01<<26) 108#define SBC_IDE_PIO0_TOECS (0x01 << 26)
112#define SBC_IDE_PIO0_TWCS (0x02<<28) 109#define SBC_IDE_PIO0_TWCS (0x02 << 28)
113#define SBC_IDE_PIO0_TCSH (0x08<<24) 110#define SBC_IDE_PIO0_TCSH (0x08 << 24)
114#define SBC_IDE_PIO0_TCSOFF (0x07<<20) 111#define SBC_IDE_PIO0_TCSOFF (0x07 << 20)
115#define SBC_IDE_PIO0_TWP (0x10<<14) 112#define SBC_IDE_PIO0_TWP (0x10 << 14)
116#define SBC_IDE_PIO0_TCSW (0x04<<10) 113#define SBC_IDE_PIO0_TCSW (0x04 << 10)
117#define SBC_IDE_PIO0_TPM (0x0<<6) 114#define SBC_IDE_PIO0_TPM (0x00 << 6)
118#define SBC_IDE_PIO0_TA (0x15<<0) 115#define SBC_IDE_PIO0_TA (0x15 << 0)
119/* Timing parameters PIO mode 1 */ 116/* Timing parameters PIO mode 1 */
120#define SBC_IDE_PIO1_TCSOE (0x03<<29) 117#define SBC_IDE_PIO1_TCSOE (0x03 << 29)
121#define SBC_IDE_PIO1_TOECS (0x01<<26) 118#define SBC_IDE_PIO1_TOECS (0x01 << 26)
122#define SBC_IDE_PIO1_TWCS (0x01<<28) 119#define SBC_IDE_PIO1_TWCS (0x01 << 28)
123#define SBC_IDE_PIO1_TCSH (0x06<<24) 120#define SBC_IDE_PIO1_TCSH (0x06 << 24)
124#define SBC_IDE_PIO1_TCSOFF (0x06<<20) 121#define SBC_IDE_PIO1_TCSOFF (0x06 << 20)
125#define SBC_IDE_PIO1_TWP (0x08<<14) 122#define SBC_IDE_PIO1_TWP (0x08 << 14)
126#define SBC_IDE_PIO1_TCSW (0x03<<10) 123#define SBC_IDE_PIO1_TCSW (0x03 << 10)
127#define SBC_IDE_PIO1_TPM (0x00<<6) 124#define SBC_IDE_PIO1_TPM (0x00 << 6)
128#define SBC_IDE_PIO1_TA (0x0B<<0) 125#define SBC_IDE_PIO1_TA (0x0B << 0)
129/* Timing parameters PIO mode 2 */ 126/* Timing parameters PIO mode 2 */
130#define SBC_IDE_PIO2_TCSOE (0x05<<29) 127#define SBC_IDE_PIO2_TCSOE (0x05 << 29)
131#define SBC_IDE_PIO2_TOECS (0x01<<26) 128#define SBC_IDE_PIO2_TOECS (0x01 << 26)
132#define SBC_IDE_PIO2_TWCS (0x01<<28) 129#define SBC_IDE_PIO2_TWCS (0x01 << 28)
133#define SBC_IDE_PIO2_TCSH (0x07<<24) 130#define SBC_IDE_PIO2_TCSH (0x07 << 24)
134#define SBC_IDE_PIO2_TCSOFF (0x07<<20) 131#define SBC_IDE_PIO2_TCSOFF (0x07 << 20)
135#define SBC_IDE_PIO2_TWP (0x1F<<14) 132#define SBC_IDE_PIO2_TWP (0x1F << 14)
136#define SBC_IDE_PIO2_TCSW (0x05<<10) 133#define SBC_IDE_PIO2_TCSW (0x05 << 10)
137#define SBC_IDE_PIO2_TPM (0x00<<6) 134#define SBC_IDE_PIO2_TPM (0x00 << 6)
138#define SBC_IDE_PIO2_TA (0x22<<0) 135#define SBC_IDE_PIO2_TA (0x22 << 0)
139/* Timing parameters PIO mode 3 */ 136/* Timing parameters PIO mode 3 */
140#define SBC_IDE_PIO3_TCSOE (0x05<<29) 137#define SBC_IDE_PIO3_TCSOE (0x05 << 29)
141#define SBC_IDE_PIO3_TOECS (0x01<<26) 138#define SBC_IDE_PIO3_TOECS (0x01 << 26)
142#define SBC_IDE_PIO3_TWCS (0x01<<28) 139#define SBC_IDE_PIO3_TWCS (0x01 << 28)
143#define SBC_IDE_PIO3_TCSH (0x0D<<24) 140#define SBC_IDE_PIO3_TCSH (0x0D << 24)
144#define SBC_IDE_PIO3_TCSOFF (0x0D<<20) 141#define SBC_IDE_PIO3_TCSOFF (0x0D << 20)
145#define SBC_IDE_PIO3_TWP (0x15<<14) 142#define SBC_IDE_PIO3_TWP (0x15 << 14)
146#define SBC_IDE_PIO3_TCSW (0x05<<10) 143#define SBC_IDE_PIO3_TCSW (0x05 << 10)
147#define SBC_IDE_PIO3_TPM (0x00<<6) 144#define SBC_IDE_PIO3_TPM (0x00 << 6)
148#define SBC_IDE_PIO3_TA (0x1A<<0) 145#define SBC_IDE_PIO3_TA (0x1A << 0)
149/* Timing parameters PIO mode 4 */ 146/* Timing parameters PIO mode 4 */
150#define SBC_IDE_PIO4_TCSOE (0x04<<29) 147#define SBC_IDE_PIO4_TCSOE (0x04 << 29)
151#define SBC_IDE_PIO4_TOECS (0x01<<26) 148#define SBC_IDE_PIO4_TOECS (0x01 << 26)
152#define SBC_IDE_PIO4_TWCS (0x01<<28) 149#define SBC_IDE_PIO4_TWCS (0x01 << 28)
153#define SBC_IDE_PIO4_TCSH (0x04<<24) 150#define SBC_IDE_PIO4_TCSH (0x04 << 24)
154#define SBC_IDE_PIO4_TCSOFF (0x04<<20) 151#define SBC_IDE_PIO4_TCSOFF (0x04 << 20)
155#define SBC_IDE_PIO4_TWP (0x0D<<14) 152#define SBC_IDE_PIO4_TWP (0x0D << 14)
156#define SBC_IDE_PIO4_TCSW (0x03<<10) 153#define SBC_IDE_PIO4_TCSW (0x03 << 10)
157#define SBC_IDE_PIO4_TPM (0x00<<6) 154#define SBC_IDE_PIO4_TPM (0x00 << 6)
158#define SBC_IDE_PIO4_TA (0x12<<0) 155#define SBC_IDE_PIO4_TA (0x12 << 0)
159/* Timing parameters MDMA mode 0 */ 156/* Timing parameters MDMA mode 0 */
160#define SBC_IDE_MDMA0_TCSOE (0x03<<29) 157#define SBC_IDE_MDMA0_TCSOE (0x03 << 29)
161#define SBC_IDE_MDMA0_TOECS (0x01<<26) 158#define SBC_IDE_MDMA0_TOECS (0x01 << 26)
162#define SBC_IDE_MDMA0_TWCS (0x01<<28) 159#define SBC_IDE_MDMA0_TWCS (0x01 << 28)
163#define SBC_IDE_MDMA0_TCSH (0x07<<24) 160#define SBC_IDE_MDMA0_TCSH (0x07 << 24)
164#define SBC_IDE_MDMA0_TCSOFF (0x07<<20) 161#define SBC_IDE_MDMA0_TCSOFF (0x07 << 20)
165#define SBC_IDE_MDMA0_TWP (0x0C<<14) 162#define SBC_IDE_MDMA0_TWP (0x0C << 14)
166#define SBC_IDE_MDMA0_TCSW (0x03<<10) 163#define SBC_IDE_MDMA0_TCSW (0x03 << 10)
167#define SBC_IDE_MDMA0_TPM (0x00<<6) 164#define SBC_IDE_MDMA0_TPM (0x00 << 6)
168#define SBC_IDE_MDMA0_TA (0x0F<<0) 165#define SBC_IDE_MDMA0_TA (0x0F << 0)
169/* Timing parameters MDMA mode 1 */ 166/* Timing parameters MDMA mode 1 */
170#define SBC_IDE_MDMA1_TCSOE (0x05<<29) 167#define SBC_IDE_MDMA1_TCSOE (0x05 << 29)
171#define SBC_IDE_MDMA1_TOECS (0x01<<26) 168#define SBC_IDE_MDMA1_TOECS (0x01 << 26)
172#define SBC_IDE_MDMA1_TWCS (0x01<<28) 169#define SBC_IDE_MDMA1_TWCS (0x01 << 28)
173#define SBC_IDE_MDMA1_TCSH (0x05<<24) 170#define SBC_IDE_MDMA1_TCSH (0x05 << 24)
174#define SBC_IDE_MDMA1_TCSOFF (0x05<<20) 171#define SBC_IDE_MDMA1_TCSOFF (0x05 << 20)
175#define SBC_IDE_MDMA1_TWP (0x0F<<14) 172#define SBC_IDE_MDMA1_TWP (0x0F << 14)
176#define SBC_IDE_MDMA1_TCSW (0x05<<10) 173#define SBC_IDE_MDMA1_TCSW (0x05 << 10)
177#define SBC_IDE_MDMA1_TPM (0x00<<6) 174#define SBC_IDE_MDMA1_TPM (0x00 << 6)
178#define SBC_IDE_MDMA1_TA (0x15<<0) 175#define SBC_IDE_MDMA1_TA (0x15 << 0)
179/* Timing parameters MDMA mode 2 */ 176/* Timing parameters MDMA mode 2 */
180#define SBC_IDE_MDMA2_TCSOE (0x04<<29) 177#define SBC_IDE_MDMA2_TCSOE (0x04 << 29)
181#define SBC_IDE_MDMA2_TOECS (0x01<<26) 178#define SBC_IDE_MDMA2_TOECS (0x01 << 26)
182#define SBC_IDE_MDMA2_TWCS (0x01<<28) 179#define SBC_IDE_MDMA2_TWCS (0x01 << 28)
183#define SBC_IDE_MDMA2_TCSH (0x04<<24) 180#define SBC_IDE_MDMA2_TCSH (0x04 << 24)
184#define SBC_IDE_MDMA2_TCSOFF (0x04<<20) 181#define SBC_IDE_MDMA2_TCSOFF (0x04 << 20)
185#define SBC_IDE_MDMA2_TWP (0x0D<<14) 182#define SBC_IDE_MDMA2_TWP (0x0D << 14)
186#define SBC_IDE_MDMA2_TCSW (0x04<<10) 183#define SBC_IDE_MDMA2_TCSW (0x04 << 10)
187#define SBC_IDE_MDMA2_TPM (0x00<<6) 184#define SBC_IDE_MDMA2_TPM (0x00 << 6)
188#define SBC_IDE_MDMA2_TA (0x12<<0) 185#define SBC_IDE_MDMA2_TA (0x12 << 0)
189 186
190#define SBC_IDE_TIMING(mode) \ 187#define SBC_IDE_TIMING(mode) \
191 SBC_IDE_##mode##_TWCS | \ 188 (SBC_IDE_##mode##_TWCS | \
192 SBC_IDE_##mode##_TCSH | \ 189 SBC_IDE_##mode##_TCSH | \
193 SBC_IDE_##mode##_TCSOFF | \ 190 SBC_IDE_##mode##_TCSOFF | \
194 SBC_IDE_##mode##_TWP | \ 191 SBC_IDE_##mode##_TWP | \
195 SBC_IDE_##mode##_TCSW | \ 192 SBC_IDE_##mode##_TCSW | \
196 SBC_IDE_##mode##_TPM | \ 193 SBC_IDE_##mode##_TPM | \
197 SBC_IDE_##mode##_TA 194 SBC_IDE_##mode##_TA)
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
index 1bd4e27caf6b..dae4eca2417e 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_psc.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h
@@ -33,7 +33,6 @@
33#ifndef _AU1000_PSC_H_ 33#ifndef _AU1000_PSC_H_
34#define _AU1000_PSC_H_ 34#define _AU1000_PSC_H_
35 35
36
37/* The PSC base addresses. */ 36/* The PSC base addresses. */
38#ifdef CONFIG_SOC_AU1550 37#ifdef CONFIG_SOC_AU1550
39#define PSC0_BASE_ADDR 0xb1a00000 38#define PSC0_BASE_ADDR 0xb1a00000
@@ -47,8 +46,8 @@
47#define PSC1_BASE_ADDR 0xb1b00000 46#define PSC1_BASE_ADDR 0xb1b00000
48#endif 47#endif
49 48
50/* The PSC select and control registers are common to 49/*
51 * all protocols. 50 * The PSC select and control registers are common to all protocols.
52 */ 51 */
53#define PSC_SEL_OFFSET 0x00000000 52#define PSC_SEL_OFFSET 0x00000000
54#define PSC_CTRL_OFFSET 0x00000004 53#define PSC_CTRL_OFFSET 0x00000004
@@ -59,18 +58,17 @@
59#define PSC_SEL_CLK_SERCLK (2 << 4) 58#define PSC_SEL_CLK_SERCLK (2 << 4)
60 59
61#define PSC_SEL_PS_MASK 0x00000007 60#define PSC_SEL_PS_MASK 0x00000007
62#define PSC_SEL_PS_DISABLED (0) 61#define PSC_SEL_PS_DISABLED 0
63#define PSC_SEL_PS_SPIMODE (2) 62#define PSC_SEL_PS_SPIMODE 2
64#define PSC_SEL_PS_I2SMODE (3) 63#define PSC_SEL_PS_I2SMODE 3
65#define PSC_SEL_PS_AC97MODE (4) 64#define PSC_SEL_PS_AC97MODE 4
66#define PSC_SEL_PS_SMBUSMODE (5) 65#define PSC_SEL_PS_SMBUSMODE 5
67 66
68#define PSC_CTRL_DISABLE (0) 67#define PSC_CTRL_DISABLE 0
69#define PSC_CTRL_SUSPEND (2) 68#define PSC_CTRL_SUSPEND 2
70#define PSC_CTRL_ENABLE (3) 69#define PSC_CTRL_ENABLE 3
71 70
72/* AC97 Registers. 71/* AC97 Registers. */
73*/
74#define PSC_AC97CFG_OFFSET 0x00000008 72#define PSC_AC97CFG_OFFSET 0x00000008
75#define PSC_AC97MSK_OFFSET 0x0000000c 73#define PSC_AC97MSK_OFFSET 0x0000000c
76#define PSC_AC97PCR_OFFSET 0x00000010 74#define PSC_AC97PCR_OFFSET 0x00000010
@@ -95,8 +93,7 @@
95#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET) 93#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET)
96#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET) 94#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET)
97 95
98/* AC97 Config Register. 96/* AC97 Config Register. */
99*/
100#define PSC_AC97CFG_RT_MASK (3 << 30) 97#define PSC_AC97CFG_RT_MASK (3 << 30)
101#define PSC_AC97CFG_RT_FIFO1 (0 << 30) 98#define PSC_AC97CFG_RT_FIFO1 (0 << 30)
102#define PSC_AC97CFG_RT_FIFO2 (1 << 30) 99#define PSC_AC97CFG_RT_FIFO2 (1 << 30)
@@ -118,20 +115,19 @@
118#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1) 115#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
119#define PSC_AC97CFG_GE_ENABLE (1) 116#define PSC_AC97CFG_GE_ENABLE (1)
120 117
121/* Enable slots 3-12. 118/* Enable slots 3-12. */
122*/
123#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11)) 119#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
124#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1)) 120#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
125 121
126/* The word length equation is ((x) * 2) + 2, so choose 'x' appropriately. 122/*
123 * The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
127 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the 124 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the
128 * arithmetic in the macro. 125 * arithmetic in the macro.
129 */ 126 */
130#define PSC_AC97CFG_SET_LEN(x) (((((x)-2)/2) & 0xf) << 21) 127#define PSC_AC97CFG_SET_LEN(x) (((((x) - 2) / 2) & 0xf) << 21)
131#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2) 128#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
132 129
133/* AC97 Mask Register. 130/* AC97 Mask Register. */
134*/
135#define PSC_AC97MSK_GR (1 << 25) 131#define PSC_AC97MSK_GR (1 << 25)
136#define PSC_AC97MSK_CD (1 << 24) 132#define PSC_AC97MSK_CD (1 << 24)
137#define PSC_AC97MSK_RR (1 << 13) 133#define PSC_AC97MSK_RR (1 << 13)
@@ -148,8 +144,7 @@
148 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \ 144 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
149 PSC_AC97MSK_RD | PSC_AC97MSK_TD) 145 PSC_AC97MSK_RD | PSC_AC97MSK_TD)
150 146
151/* AC97 Protocol Control Register. 147/* AC97 Protocol Control Register. */
152*/
153#define PSC_AC97PCR_RC (1 << 6) 148#define PSC_AC97PCR_RC (1 << 6)
154#define PSC_AC97PCR_RP (1 << 5) 149#define PSC_AC97PCR_RP (1 << 5)
155#define PSC_AC97PCR_RS (1 << 4) 150#define PSC_AC97PCR_RS (1 << 4)
@@ -157,8 +152,7 @@
157#define PSC_AC97PCR_TP (1 << 1) 152#define PSC_AC97PCR_TP (1 << 1)
158#define PSC_AC97PCR_TS (1 << 0) 153#define PSC_AC97PCR_TS (1 << 0)
159 154
160/* AC97 Status register (read only). 155/* AC97 Status register (read only). */
161*/
162#define PSC_AC97STAT_CB (1 << 26) 156#define PSC_AC97STAT_CB (1 << 26)
163#define PSC_AC97STAT_CP (1 << 25) 157#define PSC_AC97STAT_CP (1 << 25)
164#define PSC_AC97STAT_CR (1 << 24) 158#define PSC_AC97STAT_CR (1 << 24)
@@ -174,8 +168,7 @@
174#define PSC_AC97STAT_DR (1 << 1) 168#define PSC_AC97STAT_DR (1 << 1)
175#define PSC_AC97STAT_SR (1 << 0) 169#define PSC_AC97STAT_SR (1 << 0)
176 170
177/* AC97 Event Register. 171/* AC97 Event Register. */
178*/
179#define PSC_AC97EVNT_GR (1 << 25) 172#define PSC_AC97EVNT_GR (1 << 25)
180#define PSC_AC97EVNT_CD (1 << 24) 173#define PSC_AC97EVNT_CD (1 << 24)
181#define PSC_AC97EVNT_RR (1 << 13) 174#define PSC_AC97EVNT_RR (1 << 13)
@@ -187,22 +180,18 @@
187#define PSC_AC97EVNT_RD (1 << 5) 180#define PSC_AC97EVNT_RD (1 << 5)
188#define PSC_AC97EVNT_TD (1 << 4) 181#define PSC_AC97EVNT_TD (1 << 4)
189 182
190/* CODEC Command Register. 183/* CODEC Command Register. */
191*/
192#define PSC_AC97CDC_RD (1 << 25) 184#define PSC_AC97CDC_RD (1 << 25)
193#define PSC_AC97CDC_ID_MASK (3 << 23) 185#define PSC_AC97CDC_ID_MASK (3 << 23)
194#define PSC_AC97CDC_INDX_MASK (0x7f << 16) 186#define PSC_AC97CDC_INDX_MASK (0x7f << 16)
195#define PSC_AC97CDC_ID(x) (((x) & 0x3) << 23) 187#define PSC_AC97CDC_ID(x) (((x) & 0x03) << 23)
196#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16) 188#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
197 189
198/* AC97 Reset Control Register. 190/* AC97 Reset Control Register. */
199*/
200#define PSC_AC97RST_RST (1 << 1) 191#define PSC_AC97RST_RST (1 << 1)
201#define PSC_AC97RST_SNC (1 << 0) 192#define PSC_AC97RST_SNC (1 << 0)
202 193
203 194/* PSC in I2S Mode. */
204/* PSC in I2S Mode.
205*/
206typedef struct psc_i2s { 195typedef struct psc_i2s {
207 u32 psc_sel; 196 u32 psc_sel;
208 u32 psc_ctrl; 197 u32 psc_ctrl;
@@ -215,8 +204,7 @@ typedef struct psc_i2s {
215 u32 psc_i2sudf; 204 u32 psc_i2sudf;
216} psc_i2s_t; 205} psc_i2s_t;
217 206
218/* I2S Config Register. 207/* I2S Config Register. */
219*/
220#define PSC_I2SCFG_RT_MASK (3 << 30) 208#define PSC_I2SCFG_RT_MASK (3 << 30)
221#define PSC_I2SCFG_RT_FIFO1 (0 << 30) 209#define PSC_I2SCFG_RT_FIFO1 (0 << 30)
222#define PSC_I2SCFG_RT_FIFO2 (1 << 30) 210#define PSC_I2SCFG_RT_FIFO2 (1 << 30)
@@ -247,8 +235,7 @@ typedef struct psc_i2s {
247#define PSC_I2SCFG_MLJ (1 << 10) 235#define PSC_I2SCFG_MLJ (1 << 10)
248#define PSC_I2SCFG_XM (1 << 9) 236#define PSC_I2SCFG_XM (1 << 9)
249 237
250/* The word length equation is simply LEN+1. 238/* The word length equation is simply LEN+1. */
251 */
252#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4) 239#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
253#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1) 240#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
254 241
@@ -256,8 +243,7 @@ typedef struct psc_i2s {
256#define PSC_I2SCFG_MLF (1 << 1) 243#define PSC_I2SCFG_MLF (1 << 1)
257#define PSC_I2SCFG_MS (1 << 0) 244#define PSC_I2SCFG_MS (1 << 0)
258 245
259/* I2S Mask Register. 246/* I2S Mask Register. */
260*/
261#define PSC_I2SMSK_RR (1 << 13) 247#define PSC_I2SMSK_RR (1 << 13)
262#define PSC_I2SMSK_RO (1 << 12) 248#define PSC_I2SMSK_RO (1 << 12)
263#define PSC_I2SMSK_RU (1 << 11) 249#define PSC_I2SMSK_RU (1 << 11)
@@ -271,8 +257,7 @@ typedef struct psc_i2s {
271 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \ 257 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
272 PSC_I2SMSK_RD | PSC_I2SMSK_TD) 258 PSC_I2SMSK_RD | PSC_I2SMSK_TD)
273 259
274/* I2S Protocol Control Register. 260/* I2S Protocol Control Register. */
275*/
276#define PSC_I2SPCR_RC (1 << 6) 261#define PSC_I2SPCR_RC (1 << 6)
277#define PSC_I2SPCR_RP (1 << 5) 262#define PSC_I2SPCR_RP (1 << 5)
278#define PSC_I2SPCR_RS (1 << 4) 263#define PSC_I2SPCR_RS (1 << 4)
@@ -280,8 +265,7 @@ typedef struct psc_i2s {
280#define PSC_I2SPCR_TP (1 << 1) 265#define PSC_I2SPCR_TP (1 << 1)
281#define PSC_I2SPCR_TS (1 << 0) 266#define PSC_I2SPCR_TS (1 << 0)
282 267
283/* I2S Status register (read only). 268/* I2S Status register (read only). */
284*/
285#define PSC_I2SSTAT_RF (1 << 13) 269#define PSC_I2SSTAT_RF (1 << 13)
286#define PSC_I2SSTAT_RE (1 << 12) 270#define PSC_I2SSTAT_RE (1 << 12)
287#define PSC_I2SSTAT_RR (1 << 11) 271#define PSC_I2SSTAT_RR (1 << 11)
@@ -294,8 +278,7 @@ typedef struct psc_i2s {
294#define PSC_I2SSTAT_DR (1 << 1) 278#define PSC_I2SSTAT_DR (1 << 1)
295#define PSC_I2SSTAT_SR (1 << 0) 279#define PSC_I2SSTAT_SR (1 << 0)
296 280
297/* I2S Event Register. 281/* I2S Event Register. */
298*/
299#define PSC_I2SEVNT_RR (1 << 13) 282#define PSC_I2SEVNT_RR (1 << 13)
300#define PSC_I2SEVNT_RO (1 << 12) 283#define PSC_I2SEVNT_RO (1 << 12)
301#define PSC_I2SEVNT_RU (1 << 11) 284#define PSC_I2SEVNT_RU (1 << 11)
@@ -305,8 +288,7 @@ typedef struct psc_i2s {
305#define PSC_I2SEVNT_RD (1 << 5) 288#define PSC_I2SEVNT_RD (1 << 5)
306#define PSC_I2SEVNT_TD (1 << 4) 289#define PSC_I2SEVNT_TD (1 << 4)
307 290
308/* PSC in SPI Mode. 291/* PSC in SPI Mode. */
309*/
310typedef struct psc_spi { 292typedef struct psc_spi {
311 u32 psc_sel; 293 u32 psc_sel;
312 u32 psc_ctrl; 294 u32 psc_ctrl;
@@ -318,8 +300,7 @@ typedef struct psc_spi {
318 u32 psc_spitxrx; 300 u32 psc_spitxrx;
319} psc_spi_t; 301} psc_spi_t;
320 302
321/* SPI Config Register. 303/* SPI Config Register. */
322*/
323#define PSC_SPICFG_RT_MASK (3 << 30) 304#define PSC_SPICFG_RT_MASK (3 << 30)
324#define PSC_SPICFG_RT_FIFO1 (0 << 30) 305#define PSC_SPICFG_RT_FIFO1 (0 << 30)
325#define PSC_SPICFG_RT_FIFO2 (1 << 30) 306#define PSC_SPICFG_RT_FIFO2 (1 << 30)
@@ -355,8 +336,7 @@ typedef struct psc_spi {
355#define PSC_SPICFG_MLF (1 << 1) 336#define PSC_SPICFG_MLF (1 << 1)
356#define PSC_SPICFG_MO (1 << 0) 337#define PSC_SPICFG_MO (1 << 0)
357 338
358/* SPI Mask Register. 339/* SPI Mask Register. */
359*/
360#define PSC_SPIMSK_MM (1 << 16) 340#define PSC_SPIMSK_MM (1 << 16)
361#define PSC_SPIMSK_RR (1 << 13) 341#define PSC_SPIMSK_RR (1 << 13)
362#define PSC_SPIMSK_RO (1 << 12) 342#define PSC_SPIMSK_RO (1 << 12)
@@ -371,16 +351,14 @@ typedef struct psc_spi {
371 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \ 351 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
372 PSC_SPIMSK_MD) 352 PSC_SPIMSK_MD)
373 353
374/* SPI Protocol Control Register. 354/* SPI Protocol Control Register. */
375*/
376#define PSC_SPIPCR_RC (1 << 6) 355#define PSC_SPIPCR_RC (1 << 6)
377#define PSC_SPIPCR_SP (1 << 5) 356#define PSC_SPIPCR_SP (1 << 5)
378#define PSC_SPIPCR_SS (1 << 4) 357#define PSC_SPIPCR_SS (1 << 4)
379#define PSC_SPIPCR_TC (1 << 2) 358#define PSC_SPIPCR_TC (1 << 2)
380#define PSC_SPIPCR_MS (1 << 0) 359#define PSC_SPIPCR_MS (1 << 0)
381 360
382/* SPI Status register (read only). 361/* SPI Status register (read only). */
383*/
384#define PSC_SPISTAT_RF (1 << 13) 362#define PSC_SPISTAT_RF (1 << 13)
385#define PSC_SPISTAT_RE (1 << 12) 363#define PSC_SPISTAT_RE (1 << 12)
386#define PSC_SPISTAT_RR (1 << 11) 364#define PSC_SPISTAT_RR (1 << 11)
@@ -393,8 +371,7 @@ typedef struct psc_spi {
393#define PSC_SPISTAT_DR (1 << 1) 371#define PSC_SPISTAT_DR (1 << 1)
394#define PSC_SPISTAT_SR (1 << 0) 372#define PSC_SPISTAT_SR (1 << 0)
395 373
396/* SPI Event Register. 374/* SPI Event Register. */
397*/
398#define PSC_SPIEVNT_MM (1 << 16) 375#define PSC_SPIEVNT_MM (1 << 16)
399#define PSC_SPIEVNT_RR (1 << 13) 376#define PSC_SPIEVNT_RR (1 << 13)
400#define PSC_SPIEVNT_RO (1 << 12) 377#define PSC_SPIEVNT_RO (1 << 12)
@@ -405,13 +382,11 @@ typedef struct psc_spi {
405#define PSC_SPIEVNT_SD (1 << 5) 382#define PSC_SPIEVNT_SD (1 << 5)
406#define PSC_SPIEVNT_MD (1 << 4) 383#define PSC_SPIEVNT_MD (1 << 4)
407 384
408/* Transmit register control. 385/* Transmit register control. */
409*/
410#define PSC_SPITXRX_LC (1 << 29) 386#define PSC_SPITXRX_LC (1 << 29)
411#define PSC_SPITXRX_SR (1 << 28) 387#define PSC_SPITXRX_SR (1 << 28)
412 388
413/* PSC in SMBus (I2C) Mode. 389/* PSC in SMBus (I2C) Mode. */
414*/
415typedef struct psc_smb { 390typedef struct psc_smb {
416 u32 psc_sel; 391 u32 psc_sel;
417 u32 psc_ctrl; 392 u32 psc_ctrl;
@@ -424,8 +399,7 @@ typedef struct psc_smb {
424 u32 psc_smbtmr; 399 u32 psc_smbtmr;
425} psc_smb_t; 400} psc_smb_t;
426 401
427/* SMBus Config Register. 402/* SMBus Config Register. */
428*/
429#define PSC_SMBCFG_RT_MASK (3 << 30) 403#define PSC_SMBCFG_RT_MASK (3 << 30)
430#define PSC_SMBCFG_RT_FIFO1 (0 << 30) 404#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
431#define PSC_SMBCFG_RT_FIFO2 (1 << 30) 405#define PSC_SMBCFG_RT_FIFO2 (1 << 30)
@@ -452,8 +426,7 @@ typedef struct psc_smb {
452 426
453#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1) 427#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
454 428
455/* SMBus Mask Register. 429/* SMBus Mask Register. */
456*/
457#define PSC_SMBMSK_DN (1 << 30) 430#define PSC_SMBMSK_DN (1 << 30)
458#define PSC_SMBMSK_AN (1 << 29) 431#define PSC_SMBMSK_AN (1 << 29)
459#define PSC_SMBMSK_AL (1 << 28) 432#define PSC_SMBMSK_AL (1 << 28)
@@ -471,13 +444,11 @@ typedef struct psc_smb {
471 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \ 444 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
472 PSC_SMBMSK_MD) 445 PSC_SMBMSK_MD)
473 446
474/* SMBus Protocol Control Register. 447/* SMBus Protocol Control Register. */
475*/
476#define PSC_SMBPCR_DC (1 << 2) 448#define PSC_SMBPCR_DC (1 << 2)
477#define PSC_SMBPCR_MS (1 << 0) 449#define PSC_SMBPCR_MS (1 << 0)
478 450
479/* SMBus Status register (read only). 451/* SMBus Status register (read only). */
480*/
481#define PSC_SMBSTAT_BB (1 << 28) 452#define PSC_SMBSTAT_BB (1 << 28)
482#define PSC_SMBSTAT_RF (1 << 13) 453#define PSC_SMBSTAT_RF (1 << 13)
483#define PSC_SMBSTAT_RE (1 << 12) 454#define PSC_SMBSTAT_RE (1 << 12)
@@ -491,8 +462,7 @@ typedef struct psc_smb {
491#define PSC_SMBSTAT_DR (1 << 1) 462#define PSC_SMBSTAT_DR (1 << 1)
492#define PSC_SMBSTAT_SR (1 << 0) 463#define PSC_SMBSTAT_SR (1 << 0)
493 464
494/* SMBus Event Register. 465/* SMBus Event Register. */
495*/
496#define PSC_SMBEVNT_DN (1 << 30) 466#define PSC_SMBEVNT_DN (1 << 30)
497#define PSC_SMBEVNT_AN (1 << 29) 467#define PSC_SMBEVNT_AN (1 << 29)
498#define PSC_SMBEVNT_AL (1 << 28) 468#define PSC_SMBEVNT_AL (1 << 28)
@@ -510,15 +480,13 @@ typedef struct psc_smb {
510 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \ 480 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
511 PSC_SMBEVNT_MD) 481 PSC_SMBEVNT_MD)
512 482
513/* Transmit register control. 483/* Transmit register control. */
514*/
515#define PSC_SMBTXRX_RSR (1 << 28) 484#define PSC_SMBTXRX_RSR (1 << 28)
516#define PSC_SMBTXRX_STP (1 << 29) 485#define PSC_SMBTXRX_STP (1 << 29)
517#define PSC_SMBTXRX_DATAMASK (0xff) 486#define PSC_SMBTXRX_DATAMASK 0xff
518 487
519/* SMBus protocol timers register. 488/* SMBus protocol timers register. */
520*/ 489#define PSC_SMBTMR_SET_TH(x) (((x) & 0x03) << 30)
521#define PSC_SMBTMR_SET_TH(x) (((x) & 0x3) << 30)
522#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25) 490#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
523#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20) 491#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
524#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15) 492#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
@@ -526,5 +494,4 @@ typedef struct psc_smb {
526#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5) 494#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
527#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0) 495#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
528 496
529
530#endif /* _AU1000_PSC_H_ */ 497#endif /* _AU1000_PSC_H_ */
diff --git a/include/asm-mips/mach-db1x00/db1200.h b/include/asm-mips/mach-db1x00/db1200.h
index eedd048a7261..27f26102b1bb 100644
--- a/include/asm-mips/mach-db1x00/db1200.h
+++ b/include/asm-mips/mach-db1x00/db1200.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * AMD Alchemy DB1200 Referrence Board 2 * AMD Alchemy DBAu1200 Reference Board
3 * Board Registers defines. 3 * Board register defines.
4 * 4 *
5 * ######################################################################## 5 * ########################################################################
6 * 6 *
@@ -27,26 +27,25 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <asm/mach-au1x00/au1xxx_psc.h> 28#include <asm/mach-au1x00/au1xxx_psc.h>
29 29
30// This is defined in au1000.h with bogus value 30#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
31#undef AU1X00_EXTERNAL_INT 31#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
32#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
32 34
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 35/*
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 36 * SPI and SMB are muxed on the DBAu1200 board.
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX 37 * Refer to board documentation.
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
37
38/* SPI and SMB are muxed on the Pb1200 board.
39 Refer to board documentation.
40 */ 38 */
41#define SPI_PSC_BASE PSC0_BASE_ADDR 39#define SPI_PSC_BASE PSC0_BASE_ADDR
42#define SMBUS_PSC_BASE PSC0_BASE_ADDR 40#define SMBUS_PSC_BASE PSC0_BASE_ADDR
43/* AC97 and I2S are muxed on the Pb1200 board. 41/*
44 Refer to board documentation. 42 * AC'97 and I2S are muxed on the DBAu1200 board.
43 * Refer to board documentation.
45 */ 44 */
46#define AC97_PSC_BASE PSC1_BASE_ADDR 45#define AC97_PSC_BASE PSC1_BASE_ADDR
47#define I2S_PSC_BASE PSC1_BASE_ADDR 46#define I2S_PSC_BASE PSC1_BASE_ADDR
48 47
49#define BCSR_KSEG1_ADDR 0xB9800000 48#define BCSR_KSEG1_ADDR 0xB9800000
50 49
51typedef volatile struct 50typedef volatile struct
52{ 51{
@@ -102,9 +101,9 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
102#define BCSR_STATUS_SWAPBOOT 0x0040 101#define BCSR_STATUS_SWAPBOOT 0x0040
103#define BCSR_STATUS_FLASHBUSY 0x0100 102#define BCSR_STATUS_FLASHBUSY 0x0100
104#define BCSR_STATUS_IDECBLID 0x0200 103#define BCSR_STATUS_IDECBLID 0x0200
105#define BCSR_STATUS_SD0WP 0x0400 104#define BCSR_STATUS_SD0WP 0x0400
106#define BCSR_STATUS_U0RXD 0x1000 105#define BCSR_STATUS_U0RXD 0x1000
107#define BCSR_STATUS_U1RXD 0x2000 106#define BCSR_STATUS_U1RXD 0x2000
108 107
109#define BCSR_SWITCHES_OCTAL 0x00FF 108#define BCSR_SWITCHES_OCTAL 0x00FF
110#define BCSR_SWITCHES_DIP_1 0x0080 109#define BCSR_SWITCHES_DIP_1 0x0080
@@ -122,8 +121,8 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
122#define BCSR_RESETS_DC 0x0004 121#define BCSR_RESETS_DC 0x0004
123#define BCSR_RESETS_IDE 0x0008 122#define BCSR_RESETS_IDE 0x0008
124#define BCSR_RESETS_TV 0x0010 123#define BCSR_RESETS_TV 0x0010
125/* not resets but in the same register */ 124/* Not resets but in the same register */
126#define BCSR_RESETS_PWMR1mUX 0x0800 125#define BCSR_RESETS_PWMR1MUX 0x0800
127#define BCSR_RESETS_PCS0MUX 0x1000 126#define BCSR_RESETS_PCS0MUX 0x1000
128#define BCSR_RESETS_PCS1MUX 0x2000 127#define BCSR_RESETS_PCS1MUX 0x2000
129#define BCSR_RESETS_SPISEL 0x4000 128#define BCSR_RESETS_SPISEL 0x4000
@@ -160,7 +159,7 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
160#define BCSR_INT_PC0STSCHG 0x0008 159#define BCSR_INT_PC0STSCHG 0x0008
161#define BCSR_INT_PC1 0x0010 160#define BCSR_INT_PC1 0x0010
162#define BCSR_INT_PC1STSCHG 0x0020 161#define BCSR_INT_PC1STSCHG 0x0020
163#define BCSR_INT_DC 0x0040 162#define BCSR_INT_DC 0x0040
164#define BCSR_INT_FLASHBUSY 0x0080 163#define BCSR_INT_FLASHBUSY 0x0080
165#define BCSR_INT_PC0INSERT 0x0100 164#define BCSR_INT_PC0INSERT 0x0100
166#define BCSR_INT_PC0EJECT 0x0200 165#define BCSR_INT_PC0EJECT 0x0200
@@ -179,10 +178,10 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
179#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1 178#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
180#define IDE_RQSIZE 128 179#define IDE_RQSIZE 128
181 180
182#define NAND_PHYS_ADDR 0x20000000 181#define NAND_PHYS_ADDR 0x20000000
183 182
184/* 183/*
185 * External Interrupts for Pb1200 as of 8/6/2004. 184 * External Interrupts for DBAu1200 as of 8/6/2004.
186 * Bit positions in the CPLD registers can be calculated by taking 185 * Bit positions in the CPLD registers can be calculated by taking
187 * the interrupt define and subtracting the DB1200_INT_BEGIN value. 186 * the interrupt define and subtracting the DB1200_INT_BEGIN value.
188 * 187 *
@@ -211,23 +210,21 @@ enum external_pb1200_ints {
211}; 210};
212 211
213 212
214/* For drivers/pcmcia/au1000_db1x00.c */ 213/*
215 214 * DBAu1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
216/* PCMCIA Db1x00 specific defines */ 215 */
217 216#define PCMCIA_MAX_SOCK 1
218#define PCMCIA_MAX_SOCK 1 217#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
219#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
220 218
221/* VPP/VCC */ 219/* VPP/VCC */
222#define SET_VCC_VPP(VCC, VPP, SLOT)\ 220#define SET_VCC_VPP(VCC, VPP, SLOT) \
223 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 221 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
224 222
225#define BOARD_PC0_INT DB1200_PC0_INT 223#define BOARD_PC0_INT DB1200_PC0_INT
226#define BOARD_PC1_INT DB1200_PC1_INT 224#define BOARD_PC1_INT DB1200_PC1_INT
227#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1<<(8+(2*SOCKET))) 225#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
228 226
229/* Nand chip select */ 227/* NAND chip select */
230#define NAND_CS 1 228#define NAND_CS 1
231 229
232#endif /* __ASM_DB1200_H */ 230#endif /* __ASM_DB1200_H */
233
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
index e7a88ba35833..612ae90dbcb8 100644
--- a/include/asm-mips/mach-db1x00/db1x00.h
+++ b/include/asm-mips/mach-db1x00/db1x00.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * AMD Alchemy DB1x00 Reference Boards 2 * AMD Alchemy DBAu1x00 Reference Boards
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 * 7 *
9 * ######################################################################## 8 * ########################################################################
@@ -32,26 +31,26 @@
32 31
33#ifdef CONFIG_MIPS_DB1550 32#ifdef CONFIG_MIPS_DB1550
34 33
35#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 34#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
36#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 35#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
37#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX 36#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
38#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX 37#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
39 38
40#define SPI_PSC_BASE PSC0_BASE_ADDR 39#define SPI_PSC_BASE PSC0_BASE_ADDR
41#define AC97_PSC_BASE PSC1_BASE_ADDR 40#define AC97_PSC_BASE PSC1_BASE_ADDR
42#define SMBUS_PSC_BASE PSC2_BASE_ADDR 41#define SMBUS_PSC_BASE PSC2_BASE_ADDR
43#define I2S_PSC_BASE PSC3_BASE_ADDR 42#define I2S_PSC_BASE PSC3_BASE_ADDR
44 43
45#define BCSR_KSEG1_ADDR 0xAF000000 44#define BCSR_KSEG1_ADDR 0xAF000000
46#define NAND_PHYS_ADDR 0x20000000 45#define NAND_PHYS_ADDR 0x20000000
47 46
48#else 47#else
49#define BCSR_KSEG1_ADDR 0xAE000000 48#define BCSR_KSEG1_ADDR 0xAE000000
50#endif 49#endif
51 50
52/* 51/*
53 * Overlay data structure of the Db1x00 board registers. 52 * Overlay data structure of the DBAu1x00 board registers.
54 * Registers located at physical 0E0000xx, KSEG1 0xAE0000xx 53 * Registers are located at physical 0E0000xx, KSEG1 0xAE0000xx.
55 */ 54 */
56typedef volatile struct 55typedef volatile struct
57{ 56{
@@ -138,18 +137,19 @@ typedef volatile struct
138 137
139#define BCSR_SWRESET_RESET 0x0080 138#define BCSR_SWRESET_RESET 0x0080
140 139
141/* PCMCIA Db1x00 specific defines */ 140/* PCMCIA DBAu1x00 specific defines */
142#define PCMCIA_MAX_SOCK 1 141#define PCMCIA_MAX_SOCK 1
143#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 142#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
144 143
145/* VPP/VCC */ 144/* VPP/VCC */
146#define SET_VCC_VPP(VCC, VPP, SLOT)\ 145#define SET_VCC_VPP(VCC, VPP, SLOT)\
147 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 146 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
148 147
149/* SD controller macros */
150/* 148/*
151 * Detect card. 149 * SD controller macros
152 */ 150 */
151
152/* Detect card. */
153#define mmc_card_inserted(_n_, _res_) \ 153#define mmc_card_inserted(_n_, _res_) \
154 do { \ 154 do { \
155 BCSR * const bcsr = (BCSR *)0xAE000000; \ 155 BCSR * const bcsr = (BCSR *)0xAE000000; \
@@ -176,10 +176,10 @@ typedef volatile struct
176 unsigned long mmc_pwr, mmc_wp, board_specific; \ 176 unsigned long mmc_pwr, mmc_wp, board_specific; \
177 if ((_n_)) { \ 177 if ((_n_)) { \
178 mmc_pwr = BCSR_BOARD_SD1_PWR; \ 178 mmc_pwr = BCSR_BOARD_SD1_PWR; \
179 mmc_wp = BCSR_BOARD_SD1_WP; \ 179 mmc_wp = BCSR_BOARD_SD1_WP; \
180 } else { \ 180 } else { \
181 mmc_pwr = BCSR_BOARD_SD0_PWR; \ 181 mmc_pwr = BCSR_BOARD_SD0_PWR; \
182 mmc_wp = BCSR_BOARD_SD0_WP; \ 182 mmc_wp = BCSR_BOARD_SD0_WP; \
183 } \ 183 } \
184 board_specific = au_readl((unsigned long)(&bcsr->specific)); \ 184 board_specific = au_readl((unsigned long)(&bcsr->specific)); \
185 if (!(board_specific & mmc_wp)) {/* low means card present */ \ 185 if (!(board_specific & mmc_wp)) {/* low means card present */ \
@@ -190,17 +190,19 @@ typedef volatile struct
190 } while (0) 190 } while (0)
191 191
192 192
193/* NAND defines */ 193/*
194/* Timing values as described in databook, * ns value stripped of 194 * NAND defines
195 *
196 * Timing values as described in databook, * ns value stripped of the
195 * lower 2 bits. 197 * lower 2 bits.
196 * These defines are here rather than an SOC1550 generic file because 198 * These defines are here rather than an Au1550 generic file because
197 * the parts chosen on another board may be different and may require 199 * the parts chosen on another board may be different and may require
198 * different timings. 200 * different timings.
199 */ 201 */
200#define NAND_T_H (18 >> 2) 202#define NAND_T_H (18 >> 2)
201#define NAND_T_PUL (30 >> 2) 203#define NAND_T_PUL (30 >> 2)
202#define NAND_T_SU (30 >> 2) 204#define NAND_T_SU (30 >> 2)
203#define NAND_T_WH (30 >> 2) 205#define NAND_T_WH (30 >> 2)
204 206
205/* Bitfield shift amounts */ 207/* Bitfield shift amounts */
206#define NAND_T_H_SHIFT 0 208#define NAND_T_H_SHIFT 0
@@ -208,16 +210,15 @@ typedef volatile struct
208#define NAND_T_SU_SHIFT 8 210#define NAND_T_SU_SHIFT 8
209#define NAND_T_WH_SHIFT 12 211#define NAND_T_WH_SHIFT 12
210 212
211#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \ 213#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
212 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \ 214 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
213 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \ 215 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
214 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT) 216 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
215#define NAND_CS 1 217#define NAND_CS 1
216 218
217/* should be done by yamon */ 219/* Should be done by YAMON */
218#define NAND_STCFG 0x00400005 /* 8-bit NAND */ 220#define NAND_STCFG 0x00400005 /* 8-bit NAND */
219#define NAND_STTIME 0x00007774 /* valid for 396MHz SD=2 only */ 221#define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
220#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */ 222#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
221 223
222#endif /* __ASM_DB1X00_H */ 224#endif /* __ASM_DB1X00_H */
223
diff --git a/include/asm-mips/mach-pb1x00/pb1000.h b/include/asm-mips/mach-pb1x00/pb1000.h
index b52e0e7ee3fb..6d1ff9060e44 100644
--- a/include/asm-mips/mach-pb1x00/pb1000.h
+++ b/include/asm-mips/mach-pb1x00/pb1000.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Alchemy Semi PB1000 Referrence Board 2 * Alchemy Semi Pb1000 Referrence Board
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * 6 *
8 * ######################################################################## 7 * ########################################################################
9 * 8 *
@@ -28,145 +27,61 @@
28#define __ASM_PB1000_H 27#define __ASM_PB1000_H
29 28
30/* PCMCIA PB1000 specific defines */ 29/* PCMCIA PB1000 specific defines */
31#define PCMCIA_MAX_SOCK 1 30#define PCMCIA_MAX_SOCK 1
32#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 31#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
33 32
34#define PB1000_PCR 0xBE000000 33#define PB1000_PCR 0xBE000000
35# define PCR_SLOT_0_VPP0 (1<<0) 34# define PCR_SLOT_0_VPP0 (1 << 0)
36# define PCR_SLOT_0_VPP1 (1<<1) 35# define PCR_SLOT_0_VPP1 (1 << 1)
37# define PCR_SLOT_0_VCC0 (1<<2) 36# define PCR_SLOT_0_VCC0 (1 << 2)
38# define PCR_SLOT_0_VCC1 (1<<3) 37# define PCR_SLOT_0_VCC1 (1 << 3)
39# define PCR_SLOT_0_RST (1<<4) 38# define PCR_SLOT_0_RST (1 << 4)
40 39# define PCR_SLOT_1_VPP0 (1 << 8)
41# define PCR_SLOT_1_VPP0 (1<<8) 40# define PCR_SLOT_1_VPP1 (1 << 9)
42# define PCR_SLOT_1_VPP1 (1<<9) 41# define PCR_SLOT_1_VCC0 (1 << 10)
43# define PCR_SLOT_1_VCC0 (1<<10) 42# define PCR_SLOT_1_VCC1 (1 << 11)
44# define PCR_SLOT_1_VCC1 (1<<11) 43# define PCR_SLOT_1_RST (1 << 12)
45# define PCR_SLOT_1_RST (1<<12) 44
46 45#define PB1000_MDR 0xBE000004
47#define PB1000_MDR 0xBE000004 46# define MDR_PI (1 << 5) /* PCMCIA int latch */
48# define MDR_PI (1<<5) /* pcmcia int latch */ 47# define MDR_EPI (1 << 14) /* enable PCMCIA int */
49# define MDR_EPI (1<<14) /* enable pcmcia int */ 48# define MDR_CPI (1 << 15) /* clear PCMCIA int */
50# define MDR_CPI (1<<15) /* clear pcmcia int */ 49
51 50#define PB1000_ACR1 0xBE000008
52#define PB1000_ACR1 0xBE000008 51# define ACR1_SLOT_0_CD1 (1 << 0) /* card detect 1 */
53# define ACR1_SLOT_0_CD1 (1<<0) /* card detect 1 */ 52# define ACR1_SLOT_0_CD2 (1 << 1) /* card detect 2 */
54# define ACR1_SLOT_0_CD2 (1<<1) /* card detect 2 */ 53# define ACR1_SLOT_0_READY (1 << 2) /* ready */
55# define ACR1_SLOT_0_READY (1<<2) /* ready */ 54# define ACR1_SLOT_0_STATUS (1 << 3) /* status change */
56# define ACR1_SLOT_0_STATUS (1<<3) /* status change */ 55# define ACR1_SLOT_0_VS1 (1 << 4) /* voltage sense 1 */
57# define ACR1_SLOT_0_VS1 (1<<4) /* voltage sense 1 */ 56# define ACR1_SLOT_0_VS2 (1 << 5) /* voltage sense 2 */
58# define ACR1_SLOT_0_VS2 (1<<5) /* voltage sense 2 */ 57# define ACR1_SLOT_0_INPACK (1 << 6) /* inpack pin status */
59# define ACR1_SLOT_0_INPACK (1<<6) /* inpack pin status */ 58# define ACR1_SLOT_1_CD1 (1 << 8) /* card detect 1 */
60# define ACR1_SLOT_1_CD1 (1<<8) /* card detect 1 */ 59# define ACR1_SLOT_1_CD2 (1 << 9) /* card detect 2 */
61# define ACR1_SLOT_1_CD2 (1<<9) /* card detect 2 */ 60# define ACR1_SLOT_1_READY (1 << 10) /* ready */
62# define ACR1_SLOT_1_READY (1<<10) /* ready */ 61# define ACR1_SLOT_1_STATUS (1 << 11) /* status change */
63# define ACR1_SLOT_1_STATUS (1<<11) /* status change */ 62# define ACR1_SLOT_1_VS1 (1 << 12) /* voltage sense 1 */
64# define ACR1_SLOT_1_VS1 (1<<12) /* voltage sense 1 */ 63# define ACR1_SLOT_1_VS2 (1 << 13) /* voltage sense 2 */
65# define ACR1_SLOT_1_VS2 (1<<13) /* voltage sense 2 */ 64# define ACR1_SLOT_1_INPACK (1 << 14) /* inpack pin status */
66# define ACR1_SLOT_1_INPACK (1<<14) /* inpack pin status */ 65
67 66#define CPLD_AUX0 0xBE00000C
68#define CPLD_AUX0 0xBE00000C 67#define CPLD_AUX1 0xBE000010
69#define CPLD_AUX1 0xBE000010 68#define CPLD_AUX2 0xBE000014
70#define CPLD_AUX2 0xBE000014
71 69
72/* Voltage levels */ 70/* Voltage levels */
73 71
74/* VPPEN1 - VPPEN0 */ 72/* VPPEN1 - VPPEN0 */
75#define VPP_GND ((0<<1) | (0<<0)) 73#define VPP_GND ((0 << 1) | (0 << 0))
76#define VPP_5V ((1<<1) | (0<<0)) 74#define VPP_5V ((1 << 1) | (0 << 0))
77#define VPP_3V ((0<<1) | (1<<0)) 75#define VPP_3V ((0 << 1) | (1 << 0))
78#define VPP_12V ((0<<1) | (1<<0)) 76#define VPP_12V ((0 << 1) | (1 << 0))
79#define VPP_HIZ ((1<<1) | (1<<0)) 77#define VPP_HIZ ((1 << 1) | (1 << 0))
80 78
81/* VCCEN1 - VCCEN0 */ 79/* VCCEN1 - VCCEN0 */
82#define VCC_3V ((0<<1) | (1<<0)) 80#define VCC_3V ((0 << 1) | (1 << 0))
83#define VCC_5V ((1<<1) | (0<<0)) 81#define VCC_5V ((1 << 1) | (0 << 0))
84#define VCC_HIZ ((0<<1) | (0<<0)) 82#define VCC_HIZ ((0 << 1) | (0 << 0))
85 83
86/* VPP/VCC */ 84/* VPP/VCC */
87#define SET_VCC_VPP(VCC, VPP, SLOT)\ 85#define SET_VCC_VPP(VCC, VPP, SLOT) \
88 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 86 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
89
90
91/* PCI PB1000 specific defines */
92/* The reason these defines are here instead of au1000.h is because
93 * the Au1000 does not have a PCI bus controller so the PCI implementation
94 * on the some of the older Pb1000 boards was very board specific.
95 */
96#define PCI_CONFIG_BASE 0xBA020000 /* the only external slot */
97
98#define SDRAM_DEVID 0xBA010000
99#define SDRAM_CMD 0xBA010004
100#define SDRAM_CLASS 0xBA010008
101#define SDRAM_MISC 0xBA01000C
102#define SDRAM_MBAR 0xBA010010
103
104#define PCI_IO_DATA_PORT 0xBA800000
105
106#define PCI_IO_ADDR 0xBE00001C
107#define PCI_INT_ACK 0xBBC00000
108#define PCI_IO_READ 0xBBC00020
109#define PCI_IO_WRITE 0xBBC00030
110
111#define PCI_BRIDGE_CONFIG 0xBE000018
112
113#define PCI_IO_START 0x10000000
114#define PCI_IO_END 0x1000ffff
115#define PCI_MEM_START 0x18000000
116#define PCI_MEM_END 0x18ffffff
117
118#define PCI_FIRST_DEVFN 0
119#define PCI_LAST_DEVFN 1
120
121static inline u8 au_pci_io_readb(u32 addr)
122{
123 writel(addr, PCI_IO_ADDR);
124 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
125 return (readl(PCI_IO_DATA_PORT) & 0xff);
126}
127
128static inline u16 au_pci_io_readw(u32 addr)
129{
130 writel(addr, PCI_IO_ADDR);
131 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
132 return (readl(PCI_IO_DATA_PORT) & 0xffff);
133}
134
135static inline u32 au_pci_io_readl(u32 addr)
136{
137 writel(addr, PCI_IO_ADDR);
138 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff), PCI_BRIDGE_CONFIG);
139 return readl(PCI_IO_DATA_PORT);
140}
141
142static inline void au_pci_io_writeb(u8 val, u32 addr)
143{
144 writel(addr, PCI_IO_ADDR);
145 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
146 writel(val, PCI_IO_DATA_PORT);
147}
148
149static inline void au_pci_io_writew(u16 val, u32 addr)
150{
151 writel(addr, PCI_IO_ADDR);
152 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
153 writel(val, PCI_IO_DATA_PORT);
154}
155
156static inline void au_pci_io_writel(u32 val, u32 addr)
157{
158 writel(addr, PCI_IO_ADDR);
159 writel(readl(PCI_BRIDGE_CONFIG) & 0xffffcfff, PCI_BRIDGE_CONFIG);
160 writel(val, PCI_IO_DATA_PORT);
161}
162
163static inline void set_sdram_extbyte(void)
164{
165 writel(readl(PCI_BRIDGE_CONFIG) & 0xffffff00, PCI_BRIDGE_CONFIG);
166}
167
168static inline void set_slot_extbyte(void)
169{
170 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffbf00) | 0x18, PCI_BRIDGE_CONFIG);
171}
172#endif /* __ASM_PB1000_H */ 87#endif /* __ASM_PB1000_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1100.h b/include/asm-mips/mach-pb1x00/pb1100.h
index 63aa3926b297..b1a60f1cbd02 100644
--- a/include/asm-mips/mach-pb1x00/pb1100.h
+++ b/include/asm-mips/mach-pb1x00/pb1100.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Alchemy Semi PB1100 Referrence Board 2 * Alchemy Semi Pb1100 Referrence Board
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * 6 *
8 * ######################################################################## 7 * ########################################################################
9 * 8 *
@@ -27,59 +26,60 @@
27#ifndef __ASM_PB1100_H 26#ifndef __ASM_PB1100_H
28#define __ASM_PB1100_H 27#define __ASM_PB1100_H
29 28
30#define PB1100_IDENT 0xAE000000 29#define PB1100_IDENT 0xAE000000
31#define BOARD_STATUS_REG 0xAE000004 30#define BOARD_STATUS_REG 0xAE000004
32# define PB1100_ROM_SEL (1<<15) 31# define PB1100_ROM_SEL (1 << 15)
33# define PB1100_ROM_SIZ (1<<14) 32# define PB1100_ROM_SIZ (1 << 14)
34# define PB1100_SWAP_BOOT (1<<13) 33# define PB1100_SWAP_BOOT (1 << 13)
35# define PB1100_FLASH_WP (1<<12) 34# define PB1100_FLASH_WP (1 << 12)
36# define PB1100_ROM_H_STS (1<<11) 35# define PB1100_ROM_H_STS (1 << 11)
37# define PB1100_ROM_L_STS (1<<10) 36# define PB1100_ROM_L_STS (1 << 10)
38# define PB1100_FLASH_H_STS (1<<9) 37# define PB1100_FLASH_H_STS (1 << 9)
39# define PB1100_FLASH_L_STS (1<<8) 38# define PB1100_FLASH_L_STS (1 << 8)
40# define PB1100_SRAM_SIZ (1<<7) 39# define PB1100_SRAM_SIZ (1 << 7)
41# define PB1100_TSC_BUSY (1<<6) 40# define PB1100_TSC_BUSY (1 << 6)
42# define PB1100_PCMCIA_VS_MASK (3<<4) 41# define PB1100_PCMCIA_VS_MASK (3 << 4)
43# define PB1100_RS232_CD (1<<3) 42# define PB1100_RS232_CD (1 << 3)
44# define PB1100_RS232_CTS (1<<2) 43# define PB1100_RS232_CTS (1 << 2)
45# define PB1100_RS232_DSR (1<<1) 44# define PB1100_RS232_DSR (1 << 1)
46# define PB1100_RS232_RI (1<<0) 45# define PB1100_RS232_RI (1 << 0)
47 46
48#define PB1100_IRDA_RS232 0xAE00000C 47#define PB1100_IRDA_RS232 0xAE00000C
49# define PB1100_IRDA_FULL (0<<14) /* full power */ 48# define PB1100_IRDA_FULL (0 << 14) /* full power */
50# define PB1100_IRDA_SHUTDOWN (1<<14) 49# define PB1100_IRDA_SHUTDOWN (1 << 14)
51# define PB1100_IRDA_TT (2<<14) /* 2/3 power */ 50# define PB1100_IRDA_TT (2 << 14) /* 2/3 power */
52# define PB1100_IRDA_OT (3<<14) /* 1/3 power */ 51# define PB1100_IRDA_OT (3 << 14) /* 1/3 power */
53# define PB1100_IRDA_FIR (1<<13) 52# define PB1100_IRDA_FIR (1 << 13)
54 53
55#define PCMCIA_BOARD_REG 0xAE000010 54#define PCMCIA_BOARD_REG 0xAE000010
56# define PB1100_SD_WP1_RO (1<<15) /* read only */ 55# define PB1100_SD_WP1_RO (1 << 15) /* read only */
57# define PB1100_SD_WP0_RO (1<<14) /* read only */ 56# define PB1100_SD_WP0_RO (1 << 14) /* read only */
58# define PB1100_SD_PWR1 (1<<11) /* applies power to SD1 */ 57# define PB1100_SD_PWR1 (1 << 11) /* applies power to SD1 */
59# define PB1100_SD_PWR0 (1<<10) /* applies power to SD0 */ 58# define PB1100_SD_PWR0 (1 << 10) /* applies power to SD0 */
60# define PB1100_SEL_SD_CONN1 (1<<9) 59# define PB1100_SEL_SD_CONN1 (1 << 9)
61# define PB1100_SEL_SD_CONN0 (1<<8) 60# define PB1100_SEL_SD_CONN0 (1 << 8)
62# define PC_DEASSERT_RST (1<<7) 61# define PC_DEASSERT_RST (1 << 7)
63# define PC_DRV_EN (1<<4) 62# define PC_DRV_EN (1 << 4)
64 63
65#define PB1100_G_CONTROL 0xAE000014 /* graphics control */ 64#define PB1100_G_CONTROL 0xAE000014 /* graphics control */
66 65
67#define PB1100_RST_VDDI 0xAE00001C 66#define PB1100_RST_VDDI 0xAE00001C
68# define PB1100_SOFT_RESET (1<<15) /* clear to reset the board */ 67# define PB1100_SOFT_RESET (1 << 15) /* clear to reset the board */
69# define PB1100_VDDI_MASK (0x1F) 68# define PB1100_VDDI_MASK 0x1F
70 69
71#define PB1100_LEDS 0xAE000018 70#define PB1100_LEDS 0xAE000018
72 71
73/* 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED. 72/*
74 * 7:0 is the LED Display's decimal points. 73 * 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED.
74 * 7:0 is the LED Display's decimal points.
75 */ 75 */
76#define PB1100_HEX_LED 0xAE000018 76#define PB1100_HEX_LED 0xAE000018
77 77
78/* PCMCIA PB1100 specific defines */ 78/* PCMCIA Pb1100 specific defines */
79#define PCMCIA_MAX_SOCK 0 79#define PCMCIA_MAX_SOCK 0
80#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 80#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
81 81
82/* VPP/VCC */ 82/* VPP/VCC */
83#define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0)) 83#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
84 84
85#endif /* __ASM_PB1100_H */ 85#endif /* __ASM_PB1100_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
index e2c6bcac3b42..c8618df88cb5 100644
--- a/include/asm-mips/mach-pb1x00/pb1200.h
+++ b/include/asm-mips/mach-pb1x00/pb1200.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * AMD Alchemy PB1200 Referrence Board 2 * AMD Alchemy Pb1200 Referrence Board
3 * Board Registers defines. 3 * Board Registers defines.
4 * 4 *
5 * ######################################################################## 5 * ########################################################################
@@ -27,21 +27,20 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <asm/mach-au1x00/au1xxx_psc.h> 28#include <asm/mach-au1x00/au1xxx_psc.h>
29 29
30// This is defined in au1000.h with bogus value 30#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
31#undef AU1X00_EXTERNAL_INT 31#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
32#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
32 34
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 35/*
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 36 * SPI and SMB are muxed on the Pb1200 board.
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX 37 * Refer to board documentation.
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
37
38/* SPI and SMB are muxed on the Pb1200 board.
39 Refer to board documentation.
40 */ 38 */
41#define SPI_PSC_BASE PSC0_BASE_ADDR 39#define SPI_PSC_BASE PSC0_BASE_ADDR
42#define SMBUS_PSC_BASE PSC0_BASE_ADDR 40#define SMBUS_PSC_BASE PSC0_BASE_ADDR
43/* AC97 and I2S are muxed on the Pb1200 board. 41/*
44 Refer to board documentation. 42 * AC97 and I2S are muxed on the Pb1200 board.
43 * Refer to board documentation.
45 */ 44 */
46#define AC97_PSC_BASE PSC1_BASE_ADDR 45#define AC97_PSC_BASE PSC1_BASE_ADDR
47#define I2S_PSC_BASE PSC1_BASE_ADDR 46#define I2S_PSC_BASE PSC1_BASE_ADDR
@@ -102,10 +101,10 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
102#define BCSR_STATUS_SWAPBOOT 0x0040 101#define BCSR_STATUS_SWAPBOOT 0x0040
103#define BCSR_STATUS_FLASHBUSY 0x0100 102#define BCSR_STATUS_FLASHBUSY 0x0100
104#define BCSR_STATUS_IDECBLID 0x0200 103#define BCSR_STATUS_IDECBLID 0x0200
105#define BCSR_STATUS_SD0WP 0x0400 104#define BCSR_STATUS_SD0WP 0x0400
106#define BCSR_STATUS_SD1WP 0x0800 105#define BCSR_STATUS_SD1WP 0x0800
107#define BCSR_STATUS_U0RXD 0x1000 106#define BCSR_STATUS_U0RXD 0x1000
108#define BCSR_STATUS_U1RXD 0x2000 107#define BCSR_STATUS_U1RXD 0x2000
109 108
110#define BCSR_SWITCHES_OCTAL 0x00FF 109#define BCSR_SWITCHES_OCTAL 0x00FF
111#define BCSR_SWITCHES_DIP_1 0x0080 110#define BCSR_SWITCHES_DIP_1 0x0080
@@ -123,11 +122,11 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
123#define BCSR_RESETS_DC 0x0004 122#define BCSR_RESETS_DC 0x0004
124#define BCSR_RESETS_IDE 0x0008 123#define BCSR_RESETS_IDE 0x0008
125/* not resets but in the same register */ 124/* not resets but in the same register */
126#define BCSR_RESETS_WSCFSM 0x0800 125#define BCSR_RESETS_WSCFSM 0x0800
127#define BCSR_RESETS_PCS0MUX 0x1000 126#define BCSR_RESETS_PCS0MUX 0x1000
128#define BCSR_RESETS_PCS1MUX 0x2000 127#define BCSR_RESETS_PCS1MUX 0x2000
129#define BCSR_RESETS_SPISEL 0x4000 128#define BCSR_RESETS_SPISEL 0x4000
130#define BCSR_RESETS_SD1MUX 0x8000 129#define BCSR_RESETS_SD1MUX 0x8000
131 130
132#define BCSR_PCMCIA_PC0VPP 0x0003 131#define BCSR_PCMCIA_PC0VPP 0x0003
133#define BCSR_PCMCIA_PC0VCC 0x000C 132#define BCSR_PCMCIA_PC0VCC 0x000C
@@ -163,7 +162,7 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
163#define BCSR_INT_PC0STSCHG 0x0008 162#define BCSR_INT_PC0STSCHG 0x0008
164#define BCSR_INT_PC1 0x0010 163#define BCSR_INT_PC1 0x0010
165#define BCSR_INT_PC1STSCHG 0x0020 164#define BCSR_INT_PC1STSCHG 0x0020
166#define BCSR_INT_DC 0x0040 165#define BCSR_INT_DC 0x0040
167#define BCSR_INT_FLASHBUSY 0x0080 166#define BCSR_INT_FLASHBUSY 0x0080
168#define BCSR_INT_PC0INSERT 0x0100 167#define BCSR_INT_PC0INSERT 0x0100
169#define BCSR_INT_PC0EJECT 0x0200 168#define BCSR_INT_PC0EJECT 0x0200
@@ -174,14 +173,6 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
174#define BCSR_INT_SD1INSERT 0x4000 173#define BCSR_INT_SD1INSERT 0x4000
175#define BCSR_INT_SD1EJECT 0x8000 174#define BCSR_INT_SD1EJECT 0x8000
176 175
177/* PCMCIA Db1x00 specific defines */
178#define PCMCIA_MAX_SOCK 1
179#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
180
181/* VPP/VCC */
182#define SET_VCC_VPP(VCC, VPP, SLOT)\
183 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
184
185#define SMC91C111_PHYS_ADDR 0x0D000300 176#define SMC91C111_PHYS_ADDR 0x0D000300
186#define SMC91C111_INT PB1200_ETH_INT 177#define SMC91C111_INT PB1200_ETH_INT
187 178
@@ -192,18 +183,19 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
192#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1 183#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
193#define IDE_RQSIZE 128 184#define IDE_RQSIZE 128
194 185
195#define NAND_PHYS_ADDR 0x1C000000 186#define NAND_PHYS_ADDR 0x1C000000
196 187
197/* Timing values as described in databook, * ns value stripped of 188/*
189 * Timing values as described in databook, * ns value stripped of
198 * lower 2 bits. 190 * lower 2 bits.
199 * These defines are here rather than an SOC1200 generic file because 191 * These defines are here rather than an Au1200 generic file because
200 * the parts chosen on another board may be different and may require 192 * the parts chosen on another board may be different and may require
201 * different timings. 193 * different timings.
202 */ 194 */
203#define NAND_T_H (18 >> 2) 195#define NAND_T_H (18 >> 2)
204#define NAND_T_PUL (30 >> 2) 196#define NAND_T_PUL (30 >> 2)
205#define NAND_T_SU (30 >> 2) 197#define NAND_T_SU (30 >> 2)
206#define NAND_T_WH (30 >> 2) 198#define NAND_T_WH (30 >> 2)
207 199
208/* Bitfield shift amounts */ 200/* Bitfield shift amounts */
209#define NAND_T_H_SHIFT 0 201#define NAND_T_H_SHIFT 0
@@ -211,11 +203,10 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
211#define NAND_T_SU_SHIFT 8 203#define NAND_T_SU_SHIFT 8
212#define NAND_T_WH_SHIFT 12 204#define NAND_T_WH_SHIFT 12
213 205
214#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \ 206#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
215 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \ 207 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
216 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \ 208 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
217 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT) 209 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
218
219 210
220/* 211/*
221 * External Interrupts for Pb1200 as of 8/6/2004. 212 * External Interrupts for Pb1200 as of 8/6/2004.
@@ -248,13 +239,21 @@ enum external_pb1200_ints {
248 PB1200_INT_END = PB1200_INT_BEGIN + 15 239 PB1200_INT_END = PB1200_INT_BEGIN + 15
249}; 240};
250 241
251/* For drivers/pcmcia/au1000_db1x00.c */ 242/*
252#define BOARD_PC0_INT PB1200_PC0_INT 243 * Pb1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
253#define BOARD_PC1_INT PB1200_PC1_INT 244 */
254#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1<<(8+(2*SOCKET))) 245#define PCMCIA_MAX_SOCK 1
246#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
255 247
256/* Nand chip select */ 248/* VPP/VCC */
249#define SET_VCC_VPP(VCC, VPP, SLOT) \
250 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
251
252#define BOARD_PC0_INT PB1200_PC0_INT
253#define BOARD_PC1_INT PB1200_PC1_INT
254#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
255
256/* NAND chip select */
257#define NAND_CS 1 257#define NAND_CS 1
258 258
259#endif /* __ASM_PB1200_H */ 259#endif /* __ASM_PB1200_H */
260
diff --git a/include/asm-mips/mach-pb1x00/pb1500.h b/include/asm-mips/mach-pb1x00/pb1500.h
index ff6d40c87a25..da51a2eb7b82 100644
--- a/include/asm-mips/mach-pb1x00/pb1500.h
+++ b/include/asm-mips/mach-pb1x00/pb1500.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Alchemy Semi PB1500 Referrence Board 2 * Alchemy Semi Pb1500 Referrence Board
3 * 3 *
4 * Copyright 2001 MontaVista Software Inc. 4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. 5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * ppopov@mvista.com or source@mvista.com
7 * 6 *
8 * ######################################################################## 7 * ########################################################################
9 * 8 *
@@ -27,25 +26,24 @@
27#ifndef __ASM_PB1500_H 26#ifndef __ASM_PB1500_H
28#define __ASM_PB1500_H 27#define __ASM_PB1500_H
29 28
29#define IDENT_BOARD_REG 0xAE000000
30#define BOARD_STATUS_REG 0xAE000004
31#define PCI_BOARD_REG 0xAE000010
32#define PCMCIA_BOARD_REG 0xAE000010
33# define PC_DEASSERT_RST 0x80
34# define PC_DRV_EN 0x10
35#define PB1500_G_CONTROL 0xAE000014
36#define PB1500_RST_VDDI 0xAE00001C
37#define PB1500_LEDS 0xAE000018
30 38
31#define IDENT_BOARD_REG 0xAE000000 39#define PB1500_HEX_LED 0xAF000004
32#define BOARD_STATUS_REG 0xAE000004 40#define PB1500_HEX_LED_BLANK 0xAF000008
33#define PCI_BOARD_REG 0xAE000010
34#define PCMCIA_BOARD_REG 0xAE000010
35 #define PC_DEASSERT_RST 0x80
36 #define PC_DRV_EN 0x10
37#define PB1500_G_CONTROL 0xAE000014
38#define PB1500_RST_VDDI 0xAE00001C
39#define PB1500_LEDS 0xAE000018
40 41
41#define PB1500_HEX_LED 0xAF000004 42/* PCMCIA Pb1500 specific defines */
42#define PB1500_HEX_LED_BLANK 0xAF000008 43#define PCMCIA_MAX_SOCK 0
43 44#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
44/* PCMCIA PB1500 specific defines */
45#define PCMCIA_MAX_SOCK 0
46#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
47 45
48/* VPP/VCC */ 46/* VPP/VCC */
49#define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0)) 47#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
50 48
51#endif /* __ASM_PB1500_H */ 49#endif /* __ASM_PB1500_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1550.h b/include/asm-mips/mach-pb1x00/pb1550.h
index c2ab0e2df4ae..6704a11497db 100644
--- a/include/asm-mips/mach-pb1x00/pb1550.h
+++ b/include/asm-mips/mach-pb1x00/pb1550.h
@@ -30,15 +30,15 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <asm/mach-au1x00/au1xxx_psc.h> 31#include <asm/mach-au1x00/au1xxx_psc.h>
32 32
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX 33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX 34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX 35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX 36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
37 37
38#define SPI_PSC_BASE PSC0_BASE_ADDR 38#define SPI_PSC_BASE PSC0_BASE_ADDR
39#define AC97_PSC_BASE PSC1_BASE_ADDR 39#define AC97_PSC_BASE PSC1_BASE_ADDR
40#define SMBUS_PSC_BASE PSC2_BASE_ADDR 40#define SMBUS_PSC_BASE PSC2_BASE_ADDR
41#define I2S_PSC_BASE PSC3_BASE_ADDR 41#define I2S_PSC_BASE PSC3_BASE_ADDR
42 42
43#define BCSR_PHYS_ADDR 0xAF000000 43#define BCSR_PHYS_ADDR 0xAF000000
44 44
@@ -129,12 +129,12 @@ static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
129#define BCSR_SYSTEM_POWEROFF 0x4000 129#define BCSR_SYSTEM_POWEROFF 0x4000
130#define BCSR_SYSTEM_RESET 0x8000 130#define BCSR_SYSTEM_RESET 0x8000
131 131
132#define PCMCIA_MAX_SOCK 1 132#define PCMCIA_MAX_SOCK 1
133#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) 133#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
134 134
135/* VPP/VCC */ 135/* VPP/VCC */
136#define SET_VCC_VPP(VCC, VPP, SLOT)\ 136#define SET_VCC_VPP(VCC, VPP, SLOT) \
137 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 137 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
138 138
139#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER) 139#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
140#define PB1550_BOTH_BANKS 140#define PB1550_BOTH_BANKS
@@ -144,16 +144,17 @@ static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
144#define PB1550_USER_ONLY 144#define PB1550_USER_ONLY
145#endif 145#endif
146 146
147/* Timing values as described in databook, * ns value stripped of 147/*
148 * Timing values as described in databook, * ns value stripped of
148 * lower 2 bits. 149 * lower 2 bits.
149 * These defines are here rather than an SOC1550 generic file because 150 * These defines are here rather than an SOC1550 generic file because
150 * the parts chosen on another board may be different and may require 151 * the parts chosen on another board may be different and may require
151 * different timings. 152 * different timings.
152 */ 153 */
153#define NAND_T_H (18 >> 2) 154#define NAND_T_H (18 >> 2)
154#define NAND_T_PUL (30 >> 2) 155#define NAND_T_PUL (30 >> 2)
155#define NAND_T_SU (30 >> 2) 156#define NAND_T_SU (30 >> 2)
156#define NAND_T_WH (30 >> 2) 157#define NAND_T_WH (30 >> 2)
157 158
158/* Bitfield shift amounts */ 159/* Bitfield shift amounts */
159#define NAND_T_H_SHIFT 0 160#define NAND_T_H_SHIFT 0
@@ -161,16 +162,16 @@ static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
161#define NAND_T_SU_SHIFT 8 162#define NAND_T_SU_SHIFT 8
162#define NAND_T_WH_SHIFT 12 163#define NAND_T_WH_SHIFT 12
163 164
164#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \ 165#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
165 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \ 166 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
166 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \ 167 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
167 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT) 168 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
168 169
169#define NAND_CS 1 170#define NAND_CS 1
170 171
171/* should be done by yamon */ 172/* Should be done by YAMON */
172#define NAND_STCFG 0x00400005 /* 8-bit NAND */ 173#define NAND_STCFG 0x00400005 /* 8-bit NAND */
173#define NAND_STTIME 0x00007774 /* valid for 396MHz SD=2 only */ 174#define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
174#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */ 175#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
175 176
176#endif /* __ASM_PB1550_H */ 177#endif /* __ASM_PB1550_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index aa17f658f73c..a46f8e258e6b 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -765,6 +765,9 @@ do { \
765#define read_c0_index() __read_32bit_c0_register($0, 0) 765#define read_c0_index() __read_32bit_c0_register($0, 0)
766#define write_c0_index(val) __write_32bit_c0_register($0, 0, val) 766#define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
767 767
768#define read_c0_random() __read_32bit_c0_register($1, 0)
769#define write_c0_random(val) __write_32bit_c0_register($1, 0, val)
770
768#define read_c0_entrylo0() __read_ulong_c0_register($2, 0) 771#define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
769#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val) 772#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
770 773
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 2f597eea4448..6a0edf72ffbc 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -239,9 +239,10 @@ static inline pte_t pte_mkdirty(pte_t pte)
239static inline pte_t pte_mkyoung(pte_t pte) 239static inline pte_t pte_mkyoung(pte_t pte)
240{ 240{
241 pte.pte_low |= _PAGE_ACCESSED; 241 pte.pte_low |= _PAGE_ACCESSED;
242 if (pte.pte_low & _PAGE_READ) 242 if (pte.pte_low & _PAGE_READ) {
243 pte.pte_low |= _PAGE_SILENT_READ; 243 pte.pte_low |= _PAGE_SILENT_READ;
244 pte.pte_high |= _PAGE_SILENT_READ; 244 pte.pte_high |= _PAGE_SILENT_READ;
245 }
245 return pte; 246 return pte;
246} 247}
247#else 248#else
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
index 65778c890a62..4ca3063ed2ce 100644
--- a/include/asm-mips/rtlx.h
+++ b/include/asm-mips/rtlx.h
@@ -3,7 +3,7 @@
3 * 3 *
4 */ 4 */
5 5
6#ifndef __ASM_RTLX_H 6#ifndef __ASM_RTLX_H_
7#define __ASM_RTLX_H_ 7#define __ASM_RTLX_H_
8 8
9#include <irq.h> 9#include <irq.h>
@@ -29,13 +29,13 @@ extern unsigned int rtlx_read_poll(int index, int can_sleep);
29extern unsigned int rtlx_write_poll(int index); 29extern unsigned int rtlx_write_poll(int index);
30 30
31enum rtlx_state { 31enum rtlx_state {
32 RTLX_STATE_UNUSED, 32 RTLX_STATE_UNUSED = 0,
33 RTLX_STATE_INITIALISED, 33 RTLX_STATE_INITIALISED,
34 RTLX_STATE_REMOTE_READY, 34 RTLX_STATE_REMOTE_READY,
35 RTLX_STATE_OPENED 35 RTLX_STATE_OPENED
36}; 36};
37 37
38#define RTLX_BUFFER_SIZE 1024 38#define RTLX_BUFFER_SIZE 2048
39 39
40/* each channel supports read and write. 40/* each channel supports read and write.
41 linux (vpe0) reads lx_buffer and writes rt_buffer 41 linux (vpe0) reads lx_buffer and writes rt_buffer
diff --git a/include/asm-mn10300/ipcbuf.h b/include/asm-mn10300/ipcbuf.h
index efbbef8d1c69..f6f63d448272 100644
--- a/include/asm-mn10300/ipcbuf.h
+++ b/include/asm-mn10300/ipcbuf.h
@@ -1,4 +1,4 @@
1#ifndef _ASM_IPCBUF_H_ 1#ifndef _ASM_IPCBUF_H
2#define _ASM_IPCBUF_H 2#define _ASM_IPCBUF_H
3 3
4/* 4/*
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
index 5587f0023881..ffb208840ecc 100644
--- a/include/asm-parisc/assembly.h
+++ b/include/asm-parisc/assembly.h
@@ -31,9 +31,8 @@
31#define STREGM std,ma 31#define STREGM std,ma
32#define SHRREG shrd 32#define SHRREG shrd
33#define SHLREG shld 33#define SHLREG shld
34#define ADDIB addib,*
35#define CMPB cmpb,*
36#define ANDCM andcm,* 34#define ANDCM andcm,*
35#define COND(x) * ## x
37#define RP_OFFSET 16 36#define RP_OFFSET 16
38#define FRAME_SIZE 128 37#define FRAME_SIZE 128
39#define CALLEE_REG_FRAME_SIZE 144 38#define CALLEE_REG_FRAME_SIZE 144
@@ -46,9 +45,8 @@
46#define STREGM stwm 45#define STREGM stwm
47#define SHRREG shr 46#define SHRREG shr
48#define SHLREG shlw 47#define SHLREG shlw
49#define ADDIB addib,
50#define CMPB cmpb,
51#define ANDCM andcm 48#define ANDCM andcm
49#define COND(x) x
52#define RP_OFFSET 20 50#define RP_OFFSET 20
53#define FRAME_SIZE 64 51#define FRAME_SIZE 64
54#define CALLEE_REG_FRAME_SIZE 128 52#define CALLEE_REG_FRAME_SIZE 128
diff --git a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h
index cc3ec1bd8919..e9639ccc3fce 100644
--- a/include/asm-parisc/checksum.h
+++ b/include/asm-parisc/checksum.h
@@ -65,7 +65,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
65"2:\n" 65"2:\n"
66 : "=r" (sum), "=r" (iph), "=r" (ihl) 66 : "=r" (sum), "=r" (iph), "=r" (ihl)
67 : "1" (iph), "2" (ihl) 67 : "1" (iph), "2" (ihl)
68 : "r19", "r20", "r21" ); 68 : "r19", "r20", "r21", "memory");
69 69
70 return (__force __sum16)sum; 70 return (__force __sum16)sum;
71} 71}
diff --git a/include/asm-parisc/ioctl.h b/include/asm-parisc/ioctl.h
index 68338d2bda4e..ec8efa02beda 100644
--- a/include/asm-parisc/ioctl.h
+++ b/include/asm-parisc/ioctl.h
@@ -32,21 +32,6 @@
32 * NOTE: This limits the max parameter size to 16kB -1 ! 32 * NOTE: This limits the max parameter size to 16kB -1 !
33 */ 33 */
34 34
35#define _IOC_NRBITS 8
36#define _IOC_TYPEBITS 8
37#define _IOC_SIZEBITS 14
38#define _IOC_DIRBITS 2
39
40#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
41#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
42#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
43#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
44
45#define _IOC_NRSHIFT 0
46#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
47#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
48#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
49
50/* 35/*
51 * Direction bits. 36 * Direction bits.
52 */ 37 */
@@ -54,40 +39,6 @@
54#define _IOC_WRITE 2U 39#define _IOC_WRITE 2U
55#define _IOC_READ 1U 40#define _IOC_READ 1U
56 41
57#define _IOC(dir,type,nr,size) \ 42#include <asm-generic/ioctl.h>
58 (((dir) << _IOC_DIRSHIFT) | \
59 ((type) << _IOC_TYPESHIFT) | \
60 ((nr) << _IOC_NRSHIFT) | \
61 ((size) << _IOC_SIZESHIFT))
62
63/* provoke compile error for invalid uses of size argument */
64extern unsigned int __invalid_size_argument_for_IOC;
65#define _IOC_TYPECHECK(t) \
66 ((sizeof(t) == sizeof(t[1]) && \
67 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
68 sizeof(t) : __invalid_size_argument_for_IOC)
69
70/* used to create numbers */
71#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
72#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
73#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
74#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
75#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
76#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
77#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
78
79/* used to decode ioctl numbers.. */
80#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
81#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
82#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
83#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
84
85/* ...and for the drivers/sound files... */
86
87#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
88#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
89#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
90#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
91#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
92 43
93#endif /* _ASM_PARISC_IOCTL_H */ 44#endif /* _ASM_PARISC_IOCTL_H */
diff --git a/include/asm-parisc/ioctls.h b/include/asm-parisc/ioctls.h
index ee84e4172c36..6747fad07a3e 100644
--- a/include/asm-parisc/ioctls.h
+++ b/include/asm-parisc/ioctls.h
@@ -46,6 +46,10 @@
46#define TIOCSBRK 0x5427 /* BSD compatibility */ 46#define TIOCSBRK 0x5427 /* BSD compatibility */
47#define TIOCCBRK 0x5428 /* BSD compatibility */ 47#define TIOCCBRK 0x5428 /* BSD compatibility */
48#define TIOCGSID _IOR('T', 20, int) /* Return the session ID of FD */ 48#define TIOCGSID _IOR('T', 20, int) /* Return the session ID of FD */
49#define TCGETS2 _IOR('T',0x2A, struct termios2)
50#define TCSETS2 _IOW('T',0x2B, struct termios2)
51#define TCSETSW2 _IOW('T',0x2C, struct termios2)
52#define TCSETSF2 _IOW('T',0x2D, struct termios2)
49#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 53#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
50#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 54#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
51 55
diff --git a/include/asm-parisc/termbits.h b/include/asm-parisc/termbits.h
index e847fe979684..d8bbc73b16b7 100644
--- a/include/asm-parisc/termbits.h
+++ b/include/asm-parisc/termbits.h
@@ -141,6 +141,7 @@ struct ktermios {
141#define HUPCL 0002000 141#define HUPCL 0002000
142#define CLOCAL 0004000 142#define CLOCAL 0004000
143#define CBAUDEX 0010000 143#define CBAUDEX 0010000
144#define BOTHER 0010000
144#define B57600 0010001 145#define B57600 0010001
145#define B115200 0010002 146#define B115200 0010002
146#define B230400 0010003 147#define B230400 0010003
@@ -156,10 +157,12 @@ struct ktermios {
156#define B3000000 0010015 157#define B3000000 0010015
157#define B3500000 0010016 158#define B3500000 0010016
158#define B4000000 0010017 159#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate (not used) */ 160#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */ 161#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */ 162#define CRTSCTS 020000000000 /* flow control */
162 163
164#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
165
163 166
164/* c_lflag bits */ 167/* c_lflag bits */
165#define ISIG 0000001 168#define ISIG 0000001
diff --git a/include/asm-parisc/termios.h b/include/asm-parisc/termios.h
index 5345b3420475..a2a57a4548af 100644
--- a/include/asm-parisc/termios.h
+++ b/include/asm-parisc/termios.h
@@ -80,8 +80,10 @@ struct termio {
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
81}) 81})
82 82
83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
85#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
86#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
85 87
86#endif /* __KERNEL__ */ 88#endif /* __KERNEL__ */
87 89
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index e0062d73db1c..89189488e286 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -100,7 +100,7 @@ static inline type name(const volatile type __iomem *addr) \
100{ \ 100{ \
101 type ret; \ 101 type ret; \
102 __asm__ __volatile__("sync;" insn ";twi 0,%0,0;isync" \ 102 __asm__ __volatile__("sync;" insn ";twi 0,%0,0;isync" \
103 : "=r" (ret) : "r" (addr), "m" (*addr)); \ 103 : "=r" (ret) : "r" (addr), "m" (*addr) : "memory"); \
104 return ret; \ 104 return ret; \
105} 105}
106 106
@@ -108,8 +108,8 @@ static inline type name(const volatile type __iomem *addr) \
108static inline void name(volatile type __iomem *addr, type val) \ 108static inline void name(volatile type __iomem *addr, type val) \
109{ \ 109{ \
110 __asm__ __volatile__("sync;" insn \ 110 __asm__ __volatile__("sync;" insn \
111 : "=m" (*addr) : "r" (val), "r" (addr)); \ 111 : "=m" (*addr) : "r" (val), "r" (addr) : "memory"); \
112 IO_SET_SYNC_FLAG(); \ 112 IO_SET_SYNC_FLAG(); \
113} 113}
114 114
115 115
@@ -333,7 +333,8 @@ static inline unsigned int name(unsigned int port) \
333 " .long 3b,5b\n" \ 333 " .long 3b,5b\n" \
334 ".previous" \ 334 ".previous" \
335 : "=&r" (x) \ 335 : "=&r" (x) \
336 : "r" (port + _IO_BASE)); \ 336 : "r" (port + _IO_BASE) \
337 : "memory"); \
337 return x; \ 338 return x; \
338} 339}
339 340
@@ -350,7 +351,8 @@ static inline void name(unsigned int val, unsigned int port) \
350 " .long 0b,2b\n" \ 351 " .long 0b,2b\n" \
351 " .long 1b,2b\n" \ 352 " .long 1b,2b\n" \
352 ".previous" \ 353 ".previous" \
353 : : "r" (val), "r" (port + _IO_BASE)); \ 354 : : "r" (val), "r" (port + _IO_BASE) \
355 : "memory"); \
354} 356}
355 357
356__do_in_asm(_rec_inb, "lbzx") 358__do_in_asm(_rec_inb, "lbzx")
diff --git a/include/asm-powerpc/kvm_ppc.h b/include/asm-powerpc/kvm_ppc.h
index b35a7e3ef978..5a21115228af 100644
--- a/include/asm-powerpc/kvm_ppc.h
+++ b/include/asm-powerpc/kvm_ppc.h
@@ -57,6 +57,7 @@ extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
57 57
58extern int kvmppc_emulate_instruction(struct kvm_run *run, 58extern int kvmppc_emulate_instruction(struct kvm_run *run,
59 struct kvm_vcpu *vcpu); 59 struct kvm_vcpu *vcpu);
60extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
60 61
61extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, 62extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn,
62 u64 asid, u32 flags); 63 u64 asid, u32 flags);
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index 0dff76776044..39c5c5f62bf5 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -177,6 +177,7 @@ extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
177extern int mmu_linear_psize; 177extern int mmu_linear_psize;
178extern int mmu_virtual_psize; 178extern int mmu_virtual_psize;
179extern int mmu_vmalloc_psize; 179extern int mmu_vmalloc_psize;
180extern int mmu_vmemmap_psize;
180extern int mmu_io_psize; 181extern int mmu_io_psize;
181extern int mmu_kernel_ssize; 182extern int mmu_kernel_ssize;
182extern int mmu_highuser_ssize; 183extern int mmu_highuser_ssize;
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index 943c5a3fac8a..a4d0f876b427 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -428,12 +428,11 @@ extern void mpic_init(struct mpic *mpic);
428 */ 428 */
429 429
430 430
431/* Change/Read the priority of an interrupt. Default is 8 for irqs and 431/* Change the priority of an interrupt. Default is 8 for irqs and
432 * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the 432 * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the
433 * IPI number is then the offset'ed (linux irq number mapped to the IPI) 433 * IPI number is then the offset'ed (linux irq number mapped to the IPI)
434 */ 434 */
435extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri); 435extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri);
436extern unsigned int mpic_irq_get_priority(unsigned int irq);
437 436
438/* Setup a non-boot CPU */ 437/* Setup a non-boot CPU */
439extern void mpic_setup_this_cpu(void); 438extern void mpic_setup_this_cpu(void);
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h
index 27f18695f7d6..cc6a43ba41d0 100644
--- a/include/asm-powerpc/pgtable-ppc64.h
+++ b/include/asm-powerpc/pgtable-ppc64.h
@@ -65,15 +65,15 @@
65 65
66#define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START)) 66#define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START))
67#define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET)) 67#define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET))
68#define VMEMMAP_REGION_ID (0xfUL)
68#define USER_REGION_ID (0UL) 69#define USER_REGION_ID (0UL)
69 70
70/* 71/*
71 * Defines the address of the vmemap area, in the top 16th of the 72 * Defines the address of the vmemap area, in its own region
72 * kernel region.
73 */ 73 */
74#define VMEMMAP_BASE (ASM_CONST(CONFIG_KERNEL_START) + \ 74#define VMEMMAP_BASE (VMEMMAP_REGION_ID << REGION_SHIFT)
75 (0xfUL << (REGION_SHIFT - 4))) 75#define vmemmap ((struct page *)VMEMMAP_BASE)
76#define vmemmap ((struct page *)VMEMMAP_BASE) 76
77 77
78/* 78/*
79 * Common bits in a linux-style PTE. These match the bits in the 79 * Common bits in a linux-style PTE. These match the bits in the
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index 8e798e3758bc..1a0736f8803f 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -380,7 +380,7 @@ static inline unsigned long __copy_from_user_inatomic(void *to,
380 const void __user *from, unsigned long n) 380 const void __user *from, unsigned long n)
381{ 381{
382 if (__builtin_constant_p(n) && (n <= 8)) { 382 if (__builtin_constant_p(n) && (n <= 8)) {
383 unsigned long ret; 383 unsigned long ret = 1;
384 384
385 switch (n) { 385 switch (n) {
386 case 1: 386 case 1:
@@ -406,7 +406,7 @@ static inline unsigned long __copy_to_user_inatomic(void __user *to,
406 const void *from, unsigned long n) 406 const void *from, unsigned long n)
407{ 407{
408 if (__builtin_constant_p(n) && (n <= 8)) { 408 if (__builtin_constant_p(n) && (n <= 8)) {
409 unsigned long ret; 409 unsigned long ret = 1;
410 410
411 switch (n) { 411 switch (n) {
412 case 1: 412 case 1:
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index 0593cb889d45..70ebd333c55b 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -178,7 +178,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
178 178
179} 179}
180 180
181extern inline void * xchg_ptr(void * m, void * val) 181static inline void * xchg_ptr(void * m, void * val)
182{ 182{
183 return (void *) xchg_u32(m, (unsigned long) val); 183 return (void *) xchg_u32(m, (unsigned long) val);
184} 184}
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h
index 335baf4fc64f..9450ce6e32de 100644
--- a/include/asm-s390/debug.h
+++ b/include/asm-s390/debug.h
@@ -120,10 +120,10 @@ debug_entry_t* debug_exception_common(debug_info_t* id, int level,
120 120
121/* Debug Feature API: */ 121/* Debug Feature API: */
122 122
123debug_info_t* debug_register(char* name, int pages, int nr_areas, 123debug_info_t *debug_register(const char *name, int pages, int nr_areas,
124 int buf_size); 124 int buf_size);
125 125
126debug_info_t *debug_register_mode(char *name, int pages, int nr_areas, 126debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas,
127 int buf_size, mode_t mode, uid_t uid, 127 int buf_size, mode_t mode, uid_t uid,
128 gid_t gid); 128 gid_t gid);
129 129
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index e0d4500d5f95..819e7d99ca0c 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -315,14 +315,14 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
315 asm volatile( \ 315 asm volatile( \
316 " lctlg %1,%2,0(%0)\n" \ 316 " lctlg %1,%2,0(%0)\n" \
317 : : "a" (&array), "i" (low), "i" (high), \ 317 : : "a" (&array), "i" (low), "i" (high), \
318 "m" (*(addrtype *)(array))); \ 318 "m" (*(addrtype *)(&array))); \
319 }) 319 })
320 320
321#define __ctl_store(array, low, high) ({ \ 321#define __ctl_store(array, low, high) ({ \
322 typedef struct { char _[sizeof(array)]; } addrtype; \ 322 typedef struct { char _[sizeof(array)]; } addrtype; \
323 asm volatile( \ 323 asm volatile( \
324 " stctg %2,%3,0(%1)\n" \ 324 " stctg %2,%3,0(%1)\n" \
325 : "=m" (*(addrtype *)(array)) \ 325 : "=m" (*(addrtype *)(&array)) \
326 : "a" (&array), "i" (low), "i" (high)); \ 326 : "a" (&array), "i" (low), "i" (high)); \
327 }) 327 })
328 328
@@ -333,14 +333,14 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
333 asm volatile( \ 333 asm volatile( \
334 " lctl %1,%2,0(%0)\n" \ 334 " lctl %1,%2,0(%0)\n" \
335 : : "a" (&array), "i" (low), "i" (high), \ 335 : : "a" (&array), "i" (low), "i" (high), \
336 "m" (*(addrtype *)(array))); \ 336 "m" (*(addrtype *)(&array))); \
337}) 337})
338 338
339#define __ctl_store(array, low, high) ({ \ 339#define __ctl_store(array, low, high) ({ \
340 typedef struct { char _[sizeof(array)]; } addrtype; \ 340 typedef struct { char _[sizeof(array)]; } addrtype; \
341 asm volatile( \ 341 asm volatile( \
342 " stctl %2,%3,0(%1)\n" \ 342 " stctl %2,%3,0(%1)\n" \
343 : "=m" (*(addrtype *)(array)) \ 343 : "=m" (*(addrtype *)(&array)) \
344 : "a" (&array), "i" (low), "i" (high)); \ 344 : "a" (&array), "i" (low), "i" (high)); \
345 }) 345 })
346 346
diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h
index 78dda038dd47..41c547656130 100644
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -10,9 +10,9 @@
10#define _S390_TYPES_H 10#define _S390_TYPES_H
11 11
12#ifndef __s390x__ 12#ifndef __s390x__
13# include <asm-generic/int-l64.h>
14#else
15# include <asm-generic/int-ll64.h> 13# include <asm-generic/int-ll64.h>
14#else
15# include <asm-generic/int-l64.h>
16#endif 16#endif
17 17
18#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
@@ -40,7 +40,13 @@ typedef __signed__ long saddr_t;
40 40
41#ifndef __ASSEMBLY__ 41#ifndef __ASSEMBLY__
42 42
43typedef u64 dma64_addr_t;
44#ifdef __s390x__
45/* DMA addresses come in 32-bit and 64-bit flavours. */
46typedef u64 dma_addr_t;
47#else
43typedef u32 dma_addr_t; 48typedef u32 dma_addr_t;
49#endif
44 50
45#ifndef __s390x__ 51#ifndef __s390x__
46typedef union { 52typedef union {
diff --git a/include/asm-sh/checksum_32.h b/include/asm-sh/checksum_32.h
index 4bc8357e8892..14b7ac2f0a07 100644
--- a/include/asm-sh/checksum_32.h
+++ b/include/asm-sh/checksum_32.h
@@ -109,7 +109,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
109 will assume they contain their original values. */ 109 will assume they contain their original values. */
110 : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (__dummy0), "=&z" (__dummy1) 110 : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (__dummy0), "=&z" (__dummy1)
111 : "1" (iph), "2" (ihl) 111 : "1" (iph), "2" (ihl)
112 : "t"); 112 : "t", "memory");
113 113
114 return csum_fold(sum); 114 return csum_fold(sum);
115} 115}
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 4bc8cb187d11..24e42078f36f 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -66,18 +66,4 @@ extern int setjmp(jmp_buf __jmpb);
66/* Forced breakpoint */ 66/* Forced breakpoint */
67#define breakpoint() __asm__ __volatile__("trapa #0x3c") 67#define breakpoint() __asm__ __volatile__("trapa #0x3c")
68 68
69/* Taken from sh-stub.c of GDB 4.18 */
70static const char hexchars[] = "0123456789abcdef";
71
72/* Get high hex bits */
73static inline char highhex(const int x)
74{
75 return hexchars[(x >> 4) & 0xf];
76}
77
78/* Get low hex bits */
79static inline char lowhex(const int x)
80{
81 return hexchars[x & 0xf];
82}
83#endif 69#endif
diff --git a/include/asm-sparc/asi.h b/include/asm-sparc/asi.h
index 58c3754da926..158f9b00d43f 100644
--- a/include/asm-sparc/asi.h
+++ b/include/asm-sparc/asi.h
@@ -1,4 +1,3 @@
1/* $Id: asi.h,v 1.18 1998/03/09 14:04:46 jj Exp $ */
2#ifndef _SPARC_ASI_H 1#ifndef _SPARC_ASI_H
3#define _SPARC_ASI_H 2#define _SPARC_ASI_H
4 3
diff --git a/include/asm-sparc/auxio.h b/include/asm-sparc/auxio.h
index ee83aefb20dc..e552b8d68450 100644
--- a/include/asm-sparc/auxio.h
+++ b/include/asm-sparc/auxio.h
@@ -1,4 +1,4 @@
1/* $Id: auxio.h,v 1.18 1997/11/07 15:01:45 jj Exp $ 1/*
2 * auxio.h: Definitions and code for the Auxiliary I/O register. 2 * auxio.h: Definitions and code for the Auxiliary I/O register.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index cb3cefab6e09..68b98a7e6454 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -1,4 +1,4 @@
1/* $Id: bitops.h,v 1.67 2001/11/19 18:36:34 davem Exp $ 1/*
2 * bitops.h: Bit string operations on the Sparc. 2 * bitops.h: Bit string operations on the Sparc.
3 * 3 *
4 * Copyright 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/btfixup.h b/include/asm-sparc/btfixup.h
index c2868d0f60b6..08277e6fb4cd 100644
--- a/include/asm-sparc/btfixup.h
+++ b/include/asm-sparc/btfixup.h
@@ -1,4 +1,4 @@
1/* $Id: btfixup.h,v 1.4 1998/03/09 14:04:43 jj Exp $ 1/*
2 * asm-sparc/btfixup.h: Macros for boot time linking. 2 * asm-sparc/btfixup.h: Macros for boot time linking.
3 * 3 *
4 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 34518ea7bf1b..d044ddb5a3cf 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -1,4 +1,3 @@
1/* $Id: checksum.h,v 1.33 2002/02/01 22:01:05 davem Exp $ */
2#ifndef __SPARC_CHECKSUM_H 1#ifndef __SPARC_CHECKSUM_H
3#define __SPARC_CHECKSUM_H 2#define __SPARC_CHECKSUM_H
4 3
diff --git a/include/asm-sparc/clock.h b/include/asm-sparc/clock.h
index e708e6b50d2b..2cf99dadec56 100644
--- a/include/asm-sparc/clock.h
+++ b/include/asm-sparc/clock.h
@@ -1,4 +1,4 @@
1/* $Id: clock.h,v 1.3 1995/11/25 02:31:25 davem Exp $ 1/*
2 * clock.h: Definitions for clock operations on the Sparc. 2 * clock.h: Definitions for clock operations on the Sparc.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/contregs.h b/include/asm-sparc/contregs.h
index 0e05afe02d44..48fa8a4ef357 100644
--- a/include/asm-sparc/contregs.h
+++ b/include/asm-sparc/contregs.h
@@ -1,4 +1,3 @@
1/* $Id: contregs.h,v 1.8 2000/12/28 22:49:11 davem Exp $ */
2#ifndef _SPARC_CONTREGS_H 1#ifndef _SPARC_CONTREGS_H
3#define _SPARC_CONTREGS_H 2#define _SPARC_CONTREGS_H
4 3
diff --git a/include/asm-sparc/cypress.h b/include/asm-sparc/cypress.h
index 99599533efbc..95e9772ea394 100644
--- a/include/asm-sparc/cypress.h
+++ b/include/asm-sparc/cypress.h
@@ -1,4 +1,4 @@
1/* $Id: cypress.h,v 1.6 1996/08/29 09:48:09 davem Exp $ 1/*
2 * cypress.h: Cypress module specific definitions and defines. 2 * cypress.h: Cypress module specific definitions and defines.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/delay.h b/include/asm-sparc/delay.h
index 48aa70eef997..bc9aba2bead6 100644
--- a/include/asm-sparc/delay.h
+++ b/include/asm-sparc/delay.h
@@ -1,4 +1,4 @@
1/* $Id: delay.h,v 1.11 2001/01/01 01:46:15 davem Exp $ 1/*
2 * delay.h: Linux delay routines on the Sparc. 2 * delay.h: Linux delay routines on the Sparc.
3 * 3 *
4 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu). 4 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu).
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h
index 54652887c127..491f85d662df 100644
--- a/include/asm-sparc/ebus.h
+++ b/include/asm-sparc/ebus.h
@@ -1,4 +1,4 @@
1/* $Id: ebus.h,v 1.2 1999/09/11 23:05:55 zaitcev Exp $ 1/*
2 * ebus.h: PCI to Ebus pseudo driver software state. 2 * ebus.h: PCI to Ebus pseudo driver software state.
3 * 3 *
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/include/asm-sparc/ecc.h b/include/asm-sparc/ecc.h
index 8e27ceccb76d..ccb84b66fef1 100644
--- a/include/asm-sparc/ecc.h
+++ b/include/asm-sparc/ecc.h
@@ -1,4 +1,4 @@
1/* $Id: ecc.h,v 1.3 1996/04/25 06:12:57 davem Exp $ 1/*
2 * ecc.h: Definitions and defines for the external cache/memory 2 * ecc.h: Definitions and defines for the external cache/memory
3 * controller on the sun4m. 3 * controller on the sun4m.
4 * 4 *
diff --git a/include/asm-sparc/eeprom.h b/include/asm-sparc/eeprom.h
index a8ff7496ddf5..e17beeceb405 100644
--- a/include/asm-sparc/eeprom.h
+++ b/include/asm-sparc/eeprom.h
@@ -1,4 +1,4 @@
1/* $Id: eeprom.h,v 1.3 1995/11/25 02:31:38 davem Exp $ 1/*
2 * eeprom.h: Definitions for the Sun eeprom. 2 * eeprom.h: Definitions for the Sun eeprom.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
index d2516eed3a38..d043f80bc2fd 100644
--- a/include/asm-sparc/elf.h
+++ b/include/asm-sparc/elf.h
@@ -1,4 +1,3 @@
1/* $Id: elf.h,v 1.22 2000/07/12 01:27:08 davem Exp $ */
2#ifndef __ASMSPARC_ELF_H 1#ifndef __ASMSPARC_ELF_H
3#define __ASMSPARC_ELF_H 2#define __ASMSPARC_ELF_H
4 3
diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h
index 5ec546349fc8..07bd2d80257f 100644
--- a/include/asm-sparc/fcntl.h
+++ b/include/asm-sparc/fcntl.h
@@ -1,4 +1,3 @@
1/* $Id: fcntl.h,v 1.16 2001/09/20 00:35:33 davem Exp $ */
2#ifndef _SPARC_FCNTL_H 1#ifndef _SPARC_FCNTL_H
3#define _SPARC_FCNTL_H 2#define _SPARC_FCNTL_H
4 3
diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h
index e6532c3e09c9..7c35491a8b53 100644
--- a/include/asm-sparc/head.h
+++ b/include/asm-sparc/head.h
@@ -1,4 +1,3 @@
1/* $Id: head.h,v 1.39 2000/05/26 22:18:45 ecd Exp $ */
2#ifndef __SPARC_HEAD_H 1#ifndef __SPARC_HEAD_H
3#define __SPARC_HEAD_H 2#define __SPARC_HEAD_H
4 3
diff --git a/include/asm-sparc/idprom.h b/include/asm-sparc/idprom.h
index 59083ed85232..41adb417a4e5 100644
--- a/include/asm-sparc/idprom.h
+++ b/include/asm-sparc/idprom.h
@@ -1,4 +1,4 @@
1/* $Id: idprom.h,v 1.6 1996/08/04 10:35:07 ecd Exp $ 1/*
2 * idprom.h: Macros and defines for idprom routines 2 * idprom.h: Macros and defines for idprom routines
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index 243bf8e9a058..3a3e7bdb06b3 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -1,6 +1,3 @@
1/*
2 * $Id: io.h,v 1.30 2001/12/21 01:23:21 davem Exp $
3 */
4#ifndef __SPARC_IO_H 1#ifndef __SPARC_IO_H
5#define __SPARC_IO_H 2#define __SPARC_IO_H
6 3
diff --git a/include/asm-sparc/ioctl.h b/include/asm-sparc/ioctl.h
index e6fc4de19940..7d6bd51321b9 100644
--- a/include/asm-sparc/ioctl.h
+++ b/include/asm-sparc/ioctl.h
@@ -1,4 +1,3 @@
1/* $Id: ioctl.h,v 1.6 1999/12/01 23:58:36 davem Exp $ */
2#ifndef _SPARC_IOCTL_H 1#ifndef _SPARC_IOCTL_H
3#define _SPARC_IOCTL_H 2#define _SPARC_IOCTL_H
4 3
diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h
index 631f15ffef73..f69fe7d84b3c 100644
--- a/include/asm-sparc/kdebug.h
+++ b/include/asm-sparc/kdebug.h
@@ -1,4 +1,4 @@
1/* $Id: kdebug.h,v 1.11 2000/06/04 06:23:53 anton Exp $ 1/*
2 * kdebug.h: Defines and definitions for debugging the Linux kernel 2 * kdebug.h: Defines and definitions for debugging the Linux kernel
3 * under various kernel debuggers. 3 * under various kernel debuggers.
4 * 4 *
diff --git a/include/asm-sparc/machines.h b/include/asm-sparc/machines.h
index d831350f5428..d6c6bf836206 100644
--- a/include/asm-sparc/machines.h
+++ b/include/asm-sparc/machines.h
@@ -1,4 +1,4 @@
1/* $Id: machines.h,v 1.4 1995/11/25 02:31:58 davem Exp $ 1/*
2 * machines.h: Defines for taking apart the machine type value in the 2 * machines.h: Defines for taking apart the machine type value in the
3 * idprom and determining the kind of machine we are on. 3 * idprom and determining the kind of machine we are on.
4 * 4 *
diff --git a/include/asm-sparc/mbus.h b/include/asm-sparc/mbus.h
index ecacdf4075d7..bb5ae614b166 100644
--- a/include/asm-sparc/mbus.h
+++ b/include/asm-sparc/mbus.h
@@ -1,4 +1,4 @@
1/* $Id: mbus.h,v 1.9 1997/06/24 15:48:12 jj Exp $ 1/*
2 * mbus.h: Various defines for MBUS modules. 2 * mbus.h: Various defines for MBUS modules.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/memreg.h b/include/asm-sparc/memreg.h
index 5fb95c828da6..845ad2b39183 100644
--- a/include/asm-sparc/memreg.h
+++ b/include/asm-sparc/memreg.h
@@ -1,4 +1,3 @@
1/* $Id: memreg.h,v 1.8 1996/08/29 09:48:23 davem Exp $ */
2#ifndef _SPARC_MEMREG_H 1#ifndef _SPARC_MEMREG_H
3#define _SPARC_MEMREG_H 2#define _SPARC_MEMREG_H
4/* memreg.h: Definitions of the values found in the synchronous 3/* memreg.h: Definitions of the values found in the synchronous
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h
index e18be984c01d..fdfbbf0a4736 100644
--- a/include/asm-sparc/mman.h
+++ b/include/asm-sparc/mman.h
@@ -1,4 +1,3 @@
1/* $Id: mman.h,v 1.9 2000/03/15 02:44:23 davem Exp $ */
2#ifndef __SPARC_MMAN_H__ 1#ifndef __SPARC_MMAN_H__
3#define __SPARC_MMAN_H__ 2#define __SPARC_MMAN_H__
4 3
@@ -24,9 +23,8 @@
24 23
25#ifdef __KERNEL__ 24#ifdef __KERNEL__
26#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
27#define arch_mmap_check sparc_mmap_check 26#define arch_mmap_check(addr,len,flags) sparc_mmap_check(addr,len)
28int sparc_mmap_check(unsigned long addr, unsigned long len, 27int sparc_mmap_check(unsigned long addr, unsigned long len);
29 unsigned long flags);
30#endif 28#endif
31#endif 29#endif
32 30
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
index 958d0513a6d4..29aad11b8f00 100644
--- a/include/asm-sparc/mostek.h
+++ b/include/asm-sparc/mostek.h
@@ -1,4 +1,4 @@
1/* $Id: mostek.h,v 1.13 2001/01/11 15:07:09 davem Exp $ 1/*
2 * mostek.h: Describes the various Mostek time of day clock registers. 2 * mostek.h: Describes the various Mostek time of day clock registers.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/mpmbox.h b/include/asm-sparc/mpmbox.h
index 0e1bc5801d8a..f8423039b242 100644
--- a/include/asm-sparc/mpmbox.h
+++ b/include/asm-sparc/mpmbox.h
@@ -1,4 +1,4 @@
1/* $Id: mpmbox.h,v 1.4 1996/04/25 06:13:19 davem Exp $ 1/*
2 * mpmbox.h: Interface and defines for the OpenProm mailbox 2 * mpmbox.h: Interface and defines for the OpenProm mailbox
3 * facilities for MP machines under Linux. 3 * facilities for MP machines under Linux.
4 * 4 *
diff --git a/include/asm-sparc/msi.h b/include/asm-sparc/msi.h
index ff72cbd946a4..724ca5667052 100644
--- a/include/asm-sparc/msi.h
+++ b/include/asm-sparc/msi.h
@@ -1,4 +1,4 @@
1/* $Id: msi.h,v 1.3 1996/08/29 09:48:25 davem Exp $ 1/*
2 * msi.h: Defines specific to the MBus - Sbus - Interface. 2 * msi.h: Defines specific to the MBus - Sbus - Interface.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/mxcc.h b/include/asm-sparc/mxcc.h
index 128fe9708135..c0517bd05bde 100644
--- a/include/asm-sparc/mxcc.h
+++ b/include/asm-sparc/mxcc.h
@@ -1,4 +1,4 @@
1/* $Id: mxcc.h,v 1.7 1997/04/20 14:11:46 ecd Exp $ 1/*
2 * mxcc.h: Definitions of the Viking MXCC registers 2 * mxcc.h: Definitions of the Viking MXCC registers
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h
index 618344d89cc4..0646102fb020 100644
--- a/include/asm-sparc/namei.h
+++ b/include/asm-sparc/namei.h
@@ -1,4 +1,4 @@
1/* $Id: namei.h,v 1.16 2000/04/13 00:55:54 davem Exp $ 1/*
2 * linux/include/asm-sparc/namei.h 2 * linux/include/asm-sparc/namei.h
3 * 3 *
4 * Routines to handle famous /usr/gnemul/s*. 4 * Routines to handle famous /usr/gnemul/s*.
diff --git a/include/asm-sparc/obio.h b/include/asm-sparc/obio.h
index 47854a2a12cf..1a7544ceb574 100644
--- a/include/asm-sparc/obio.h
+++ b/include/asm-sparc/obio.h
@@ -1,4 +1,4 @@
1/* $Id: obio.h,v 1.4 1998/03/09 14:04:55 jj Exp $ 1/*
2 * obio.h: Some useful locations in 0xFXXXXXXXX PA obio space on sun4d. 2 * obio.h: Some useful locations in 0xFXXXXXXXX PA obio space on sun4d.
3 * 3 *
4 * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz> 4 * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz>
diff --git a/include/asm-sparc/openprom.h b/include/asm-sparc/openprom.h
index 12929a20f536..ed4b6bc2b102 100644
--- a/include/asm-sparc/openprom.h
+++ b/include/asm-sparc/openprom.h
@@ -1,4 +1,3 @@
1/* $Id: openprom.h,v 1.24 2000/06/04 06:23:53 anton Exp $ */
2#ifndef __SPARC_OPENPROM_H 1#ifndef __SPARC_OPENPROM_H
3#define __SPARC_OPENPROM_H 2#define __SPARC_OPENPROM_H
4 3
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h
index 7becc846544a..61c3ca6a8ac3 100644
--- a/include/asm-sparc/oplib.h
+++ b/include/asm-sparc/oplib.h
@@ -1,4 +1,4 @@
1/* $Id: oplib.h,v 1.23 2001/12/21 00:54:31 davem Exp $ 1/*
2 * oplib.h: Describes the interface and available routines in the 2 * oplib.h: Describes the interface and available routines in the
3 * Linux Prom library. 3 * Linux Prom library.
4 * 4 *
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 1625a8c3e0d2..6aa9e4c910cf 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -1,4 +1,4 @@
1/* $Id: page.h,v 1.55 2000/10/30 21:01:41 davem Exp $ 1/*
2 * page.h: Various defines and such for MMU operations on the Sparc for 2 * page.h: Various defines and such for MMU operations on the Sparc for
3 * the Linux kernel. 3 * the Linux kernel.
4 * 4 *
diff --git a/include/asm-sparc/param.h b/include/asm-sparc/param.h
index 86ba59af9d2c..9836d9a3cb9a 100644
--- a/include/asm-sparc/param.h
+++ b/include/asm-sparc/param.h
@@ -1,4 +1,3 @@
1/* $Id: param.h,v 1.4 2000/10/30 21:01:41 davem Exp $ */
2#ifndef _ASMSPARC_PARAM_H 1#ifndef _ASMSPARC_PARAM_H
3#define _ASMSPARC_PARAM_H 2#define _ASMSPARC_PARAM_H
4 3
diff --git a/include/asm-sparc/pbm.h b/include/asm-sparc/pbm.h
index fedd9c6e875c..458a4916d14d 100644
--- a/include/asm-sparc/pbm.h
+++ b/include/asm-sparc/pbm.h
@@ -1,4 +1,4 @@
1/* $Id: pbm.h,v 1.3 1999/12/20 17:06:35 zaitcev Exp $ 1/*
2 * 2 *
3 * pbm.h: PCI bus module pseudo driver software state 3 * pbm.h: PCI bus module pseudo driver software state
4 * Adopted from sparc64 by V. Roganov and G. Raiko 4 * Adopted from sparc64 by V. Roganov and G. Raiko
diff --git a/include/asm-sparc/pcic.h b/include/asm-sparc/pcic.h
index dedea14d87c8..f20ef562b265 100644
--- a/include/asm-sparc/pcic.h
+++ b/include/asm-sparc/pcic.h
@@ -1,4 +1,4 @@
1/* $Id: pcic.h,v 1.4 1999/11/17 07:34:20 zaitcev Exp $ 1/*
2 * pcic.h: JavaEngine 1 specific PCI definitions. 2 * pcic.h: JavaEngine 1 specific PCI definitions.
3 * 3 *
4 * Copyright (C) 1998 V. Roganov and G. Raiko 4 * Copyright (C) 1998 V. Roganov and G. Raiko
diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h
index 6292cd00e5af..681582d26969 100644
--- a/include/asm-sparc/pgalloc.h
+++ b/include/asm-sparc/pgalloc.h
@@ -1,4 +1,3 @@
1/* $Id: pgalloc.h,v 1.16 2001/12/21 04:56:17 davem Exp $ */
2#ifndef _SPARC_PGALLOC_H 1#ifndef _SPARC_PGALLOC_H
3#define _SPARC_PGALLOC_H 2#define _SPARC_PGALLOC_H
4 3
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index d84af6d95f5c..60512296b2ca 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -1,4 +1,3 @@
1/* $Id: pgtable.h,v 1.110 2001/12/21 04:56:17 davem Exp $ */
2#ifndef _SPARC_PGTABLE_H 1#ifndef _SPARC_PGTABLE_H
3#define _SPARC_PGTABLE_H 2#define _SPARC_PGTABLE_H
4 3
diff --git a/include/asm-sparc/pgtsrmmu.h b/include/asm-sparc/pgtsrmmu.h
index edeb9811e728..808555fc1d58 100644
--- a/include/asm-sparc/pgtsrmmu.h
+++ b/include/asm-sparc/pgtsrmmu.h
@@ -1,4 +1,4 @@
1/* $Id: pgtsrmmu.h,v 1.31 2000/07/16 21:48:52 anton Exp $ 1/*
2 * pgtsrmmu.h: SRMMU page table defines and code. 2 * pgtsrmmu.h: SRMMU page table defines and code.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/pgtsun4.h b/include/asm-sparc/pgtsun4.h
index 60bda107f206..5a0d661fb82e 100644
--- a/include/asm-sparc/pgtsun4.h
+++ b/include/asm-sparc/pgtsun4.h
@@ -1,4 +1,4 @@
1/* $Id: pgtsun4.h,v 1.5 2000/06/05 06:08:46 anton Exp $ 1/*
2 * pgtsun4.h: Sun4 specific pgtable.h defines and code. 2 * pgtsun4.h: Sun4 specific pgtable.h defines and code.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h
index f53b6dbc5fe3..aeb25e912179 100644
--- a/include/asm-sparc/pgtsun4c.h
+++ b/include/asm-sparc/pgtsun4c.h
@@ -1,4 +1,4 @@
1/* $Id: pgtsun4c.h,v 1.37 2000/06/05 06:08:46 anton Exp $ 1/*
2 * pgtsun4c.h: Sun4c specific pgtable.h defines and code. 2 * pgtsun4c.h: Sun4c specific pgtable.h defines and code.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/psr.h b/include/asm-sparc/psr.h
index 213970477a24..b8c0e5f0a66b 100644
--- a/include/asm-sparc/psr.h
+++ b/include/asm-sparc/psr.h
@@ -1,4 +1,4 @@
1/* $Id: psr.h,v 1.15 1997/10/04 08:54:22 ecd Exp $ 1/*
2 * psr.h: This file holds the macros for masking off various parts of 2 * psr.h: This file holds the macros for masking off various parts of
3 * the processor status register on the Sparc. This is valid 3 * the processor status register on the Sparc. This is valid
4 * for Version 8. On the V9 this is renamed to the PSTATE 4 * for Version 8. On the V9 this is renamed to the PSTATE
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h
index 6b5e6ce5043c..11f3bc2bb3f5 100644
--- a/include/asm-sparc/ptrace.h
+++ b/include/asm-sparc/ptrace.h
@@ -1,4 +1,3 @@
1/* $Id: ptrace.h,v 1.25 1997/03/04 16:27:25 jj Exp $ */
2#ifndef _SPARC_PTRACE_H 1#ifndef _SPARC_PTRACE_H
3#define _SPARC_PTRACE_H 2#define _SPARC_PTRACE_H
4 3
@@ -10,6 +9,8 @@
10 9
11#ifndef __ASSEMBLY__ 10#ifndef __ASSEMBLY__
12 11
12#include <linux/types.h>
13
13struct pt_regs { 14struct pt_regs {
14 unsigned long psr; 15 unsigned long psr;
15 unsigned long pc; 16 unsigned long pc;
diff --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h
index 0514c304e130..985948a41299 100644
--- a/include/asm-sparc/resource.h
+++ b/include/asm-sparc/resource.h
@@ -1,4 +1,4 @@
1/* $Id: resource.h,v 1.12 2000/09/23 02:09:21 davem Exp $ 1/*
2 * resource.h: Resource definitions. 2 * resource.h: Resource definitions.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/ross.h b/include/asm-sparc/ross.h
index f2c14b5080ed..ecb6e81786a6 100644
--- a/include/asm-sparc/ross.h
+++ b/include/asm-sparc/ross.h
@@ -1,4 +1,4 @@
1/* $Id: ross.h,v 1.13 1998/01/07 06:49:11 baccala Exp $ 1/*
2 * ross.h: Ross module specific definitions and defines. 2 * ross.h: Ross module specific definitions and defines.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/rtc.h b/include/asm-sparc/rtc.h
index f4f261dde699..f9ecb1fe2ecd 100644
--- a/include/asm-sparc/rtc.h
+++ b/include/asm-sparc/rtc.h
@@ -1,5 +1,4 @@
1/* $Id: rtc.h,v 1.2 1996/08/21 23:17:39 ecd Exp $ 1/*
2 *
3 * rtc.h: Definitions for access to the Mostek real time clock 2 * rtc.h: Definitions for access to the Mostek real time clock
4 * 3 *
5 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) 4 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
diff --git a/include/asm-sparc/sbi.h b/include/asm-sparc/sbi.h
index 86a603ac7b20..5eb7f1965d33 100644
--- a/include/asm-sparc/sbi.h
+++ b/include/asm-sparc/sbi.h
@@ -1,4 +1,4 @@
1/* $Id: sbi.h,v 1.2 1998/03/09 14:04:48 jj Exp $ 1/*
2 * sbi.h: SBI (Sbus Interface on sun4d) definitions 2 * sbi.h: SBI (Sbus Interface on sun4d) definitions
3 * 3 *
4 * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz> 4 * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz>
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index 27d076c46964..f1d2fe1c9a30 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -1,4 +1,4 @@
1/* $Id: sbus.h,v 1.22 2000/02/18 13:50:50 davem Exp $ 1/*
2 * sbus.h: Defines for the Sun SBus. 2 * sbus.h: Defines for the Sun SBus.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/scatterlist.h b/include/asm-sparc/scatterlist.h
index e08d3d775b08..c82609ca1d0f 100644
--- a/include/asm-sparc/scatterlist.h
+++ b/include/asm-sparc/scatterlist.h
@@ -1,4 +1,3 @@
1/* $Id: scatterlist.h,v 1.8 2001/12/17 07:05:15 davem Exp $ */
2#ifndef _SPARC_SCATTERLIST_H 1#ifndef _SPARC_SCATTERLIST_H
3#define _SPARC_SCATTERLIST_H 2#define _SPARC_SCATTERLIST_H
4 3
diff --git a/include/asm-sparc/shmparam.h b/include/asm-sparc/shmparam.h
index bb93a6f74a38..59a1243c12f3 100644
--- a/include/asm-sparc/shmparam.h
+++ b/include/asm-sparc/shmparam.h
@@ -1,4 +1,3 @@
1/* $Id: shmparam.h,v 1.6 1999/12/09 10:32:41 davem Exp $ */
2#ifndef _ASMSPARC_SHMPARAM_H 1#ifndef _ASMSPARC_SHMPARAM_H
3#define _ASMSPARC_SHMPARAM_H 2#define _ASMSPARC_SHMPARAM_H
4 3
diff --git a/include/asm-sparc/sigcontext.h b/include/asm-sparc/sigcontext.h
index 7fa2c7d01ab4..c5fb60dcbd75 100644
--- a/include/asm-sparc/sigcontext.h
+++ b/include/asm-sparc/sigcontext.h
@@ -1,4 +1,3 @@
1/* $Id: sigcontext.h,v 1.14 1999/09/06 08:22:05 jj Exp $ */
2#ifndef __SPARC_SIGCONTEXT_H 1#ifndef __SPARC_SIGCONTEXT_H
3#define __SPARC_SIGCONTEXT_H 2#define __SPARC_SIGCONTEXT_H
4 3
diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h
index 2c3ea8b22448..3c71af135c52 100644
--- a/include/asm-sparc/siginfo.h
+++ b/include/asm-sparc/siginfo.h
@@ -1,7 +1,3 @@
1/* $Id: siginfo.h,v 1.9 2002/02/08 03:57:18 davem Exp $
2 * siginfo.c:
3 */
4
5#ifndef _SPARC_SIGINFO_H 1#ifndef _SPARC_SIGINFO_H
6#define _SPARC_SIGINFO_H 2#define _SPARC_SIGINFO_H
7 3
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
index 94071c75701f..683657d6e685 100644
--- a/include/asm-sparc/signal.h
+++ b/include/asm-sparc/signal.h
@@ -1,4 +1,3 @@
1/* $Id: signal.h,v 1.35 1999/09/06 08:22:04 jj Exp $ */
2#ifndef _ASMSPARC_SIGNAL_H 1#ifndef _ASMSPARC_SIGNAL_H
3#define _ASMSPARC_SIGNAL_H 2#define _ASMSPARC_SIGNAL_H
4 3
diff --git a/include/asm-sparc/smpprim.h b/include/asm-sparc/smpprim.h
index e7b6d346ae10..eb849d862c64 100644
--- a/include/asm-sparc/smpprim.h
+++ b/include/asm-sparc/smpprim.h
@@ -1,4 +1,4 @@
1/* $Id: smpprim.h,v 1.5 1996/08/29 09:48:49 davem Exp $ 1/*
2 * smpprim.h: SMP locking primitives on the Sparc 2 * smpprim.h: SMP locking primitives on the Sparc
3 * 3 *
4 * God knows we won't be actually using this code for some time 4 * God knows we won't be actually using this code for some time
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index a00e15df227c..bf50d0c2d583 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -1,4 +1,3 @@
1/* $Id: socket.h,v 1.17 2001/06/13 16:25:03 davem Exp $ */
2#ifndef _ASM_SOCKET_H 1#ifndef _ASM_SOCKET_H
3#define _ASM_SOCKET_H 2#define _ASM_SOCKET_H
4 3
diff --git a/include/asm-sparc/stat.h b/include/asm-sparc/stat.h
index a5b4272f2894..2299e1d5d94c 100644
--- a/include/asm-sparc/stat.h
+++ b/include/asm-sparc/stat.h
@@ -1,4 +1,3 @@
1/* $Id: stat.h,v 1.12 2000/08/04 05:35:55 davem Exp $ */
2#ifndef _SPARC_STAT_H 1#ifndef _SPARC_STAT_H
3#define _SPARC_STAT_H 2#define _SPARC_STAT_H
4 3
diff --git a/include/asm-sparc/statfs.h b/include/asm-sparc/statfs.h
index d623f144247d..304520fa8863 100644
--- a/include/asm-sparc/statfs.h
+++ b/include/asm-sparc/statfs.h
@@ -1,4 +1,3 @@
1/* $Id: statfs.h,v 1.4 1996/06/07 00:41:05 ecd Exp $ */
2#ifndef _SPARC_STATFS_H 1#ifndef _SPARC_STATFS_H
3#define _SPARC_STATFS_H 2#define _SPARC_STATFS_H
4 3
diff --git a/include/asm-sparc/string.h b/include/asm-sparc/string.h
index cb1e923356c6..8d7c0dd4f299 100644
--- a/include/asm-sparc/string.h
+++ b/include/asm-sparc/string.h
@@ -1,4 +1,4 @@
1/* $Id: string.h,v 1.36 2001/12/21 00:54:31 davem Exp $ 1/*
2 * string.h: External definitions for optimized assembly string 2 * string.h: External definitions for optimized assembly string
3 * routines for the Linux Kernel. 3 * routines for the Linux Kernel.
4 * 4 *
diff --git a/include/asm-sparc/sun4paddr.h b/include/asm-sparc/sun4paddr.h
index d863bfd5f09a..d52985f19f42 100644
--- a/include/asm-sparc/sun4paddr.h
+++ b/include/asm-sparc/sun4paddr.h
@@ -1,4 +1,4 @@
1/* $Id: sun4paddr.h,v 1.3 1998/07/28 16:53:27 jj Exp $ 1/*
2 * sun4paddr.h: Various physical addresses on sun4 machines 2 * sun4paddr.h: Various physical addresses on sun4 machines
3 * 3 *
4 * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au) 4 * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au)
diff --git a/include/asm-sparc/sunbpp.h b/include/asm-sparc/sunbpp.h
index 568db79b730d..92ee1a8ff3a2 100644
--- a/include/asm-sparc/sunbpp.h
+++ b/include/asm-sparc/sunbpp.h
@@ -1,4 +1,4 @@
1/* $Id: sunbpp.h,v 1.1 1999/08/08 14:09:49 shadow Exp $ 1/*
2 * include/asm-sparc/sunbpp.h 2 * include/asm-sparc/sunbpp.h
3 */ 3 */
4 4
diff --git a/include/asm-sparc/sysen.h b/include/asm-sparc/sysen.h
index 692fa6f2296a..6af34abde6e7 100644
--- a/include/asm-sparc/sysen.h
+++ b/include/asm-sparc/sysen.h
@@ -1,4 +1,4 @@
1/* $Id: sysen.h,v 1.3 1995/11/25 02:32:58 davem Exp $ 1/*
2 * sysen.h: Bit fields within the "System Enable" register accessed via 2 * sysen.h: Bit fields within the "System Enable" register accessed via
3 * the ASI_CONTROL address space at address AC_SYSENABLE. 3 * the ASI_CONTROL address space at address AC_SYSENABLE.
4 * 4 *
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h
index 733d40504e1e..f7b4409c35ff 100644
--- a/include/asm-sparc/termios.h
+++ b/include/asm-sparc/termios.h
@@ -1,4 +1,3 @@
1/* $Id: termios.h,v 1.32 2001/06/01 08:12:11 davem Exp $ */
2#ifndef _SPARC_TERMIOS_H 1#ifndef _SPARC_TERMIOS_H
3#define _SPARC_TERMIOS_H 2#define _SPARC_TERMIOS_H
4 3
diff --git a/include/asm-sparc/timer.h b/include/asm-sparc/timer.h
index cb1fa1d1f184..d909565f9410 100644
--- a/include/asm-sparc/timer.h
+++ b/include/asm-sparc/timer.h
@@ -1,4 +1,4 @@
1/* $Id: timer.h,v 1.21 1999/04/20 13:22:51 anton Exp $ 1/*
2 * timer.h: Definitions for the timer chips on the Sparc. 2 * timer.h: Definitions for the timer chips on the Sparc.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/traps.h b/include/asm-sparc/traps.h
index f62c7f878ee1..bebdbf8f43a8 100644
--- a/include/asm-sparc/traps.h
+++ b/include/asm-sparc/traps.h
@@ -1,4 +1,4 @@
1/* $Id: traps.h,v 1.9 1998/03/09 14:04:53 jj Exp $ 1/*
2 * traps.h: Format of entries for the Sparc trap table. 2 * traps.h: Format of entries for the Sparc trap table.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/tsunami.h b/include/asm-sparc/tsunami.h
index 887add5c466b..5bbd1d523baa 100644
--- a/include/asm-sparc/tsunami.h
+++ b/include/asm-sparc/tsunami.h
@@ -1,4 +1,4 @@
1/* $Id: tsunami.h,v 1.5 1996/08/29 09:49:03 davem Exp $ 1/*
2 * tsunami.h: Module specific definitions for Tsunami V8 Sparcs 2 * tsunami.h: Module specific definitions for Tsunami V8 Sparcs
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/turbosparc.h b/include/asm-sparc/turbosparc.h
index 31d2350a5818..17c73282db0a 100644
--- a/include/asm-sparc/turbosparc.h
+++ b/include/asm-sparc/turbosparc.h
@@ -1,4 +1,4 @@
1/* $Id: turbosparc.h,v 1.4 1998/08/16 16:02:42 ecd Exp $ 1/*
2 * turbosparc.h: Defines specific to the TurboSparc module. 2 * turbosparc.h: Defines specific to the TurboSparc module.
3 * This is SRMMU stuff. 3 * This is SRMMU stuff.
4 * 4 *
diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h
index 1b08ef860a66..07734f942405 100644
--- a/include/asm-sparc/types.h
+++ b/include/asm-sparc/types.h
@@ -1,4 +1,3 @@
1/* $Id: types.h,v 1.13 2001/12/21 01:22:59 davem Exp $ */
2#ifndef _SPARC_TYPES_H 1#ifndef _SPARC_TYPES_H
3#define _SPARC_TYPES_H 2#define _SPARC_TYPES_H
4 3
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
index 366b11696ee3..47d5619d43fa 100644
--- a/include/asm-sparc/uaccess.h
+++ b/include/asm-sparc/uaccess.h
@@ -1,4 +1,4 @@
1/* $Id: uaccess.h,v 1.24 2001/10/30 04:32:24 davem Exp $ 1/*
2 * uaccess.h: User space memore access functions. 2 * uaccess.h: User space memore access functions.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/vac-ops.h b/include/asm-sparc/vac-ops.h
index ab6f53b913ea..d10527611f11 100644
--- a/include/asm-sparc/vac-ops.h
+++ b/include/asm-sparc/vac-ops.h
@@ -1,4 +1,3 @@
1/* $Id: vac-ops.h,v 1.13 1998/01/30 10:59:59 jj Exp $ */
2#ifndef _SPARC_VAC_OPS_H 1#ifndef _SPARC_VAC_OPS_H
3#define _SPARC_VAC_OPS_H 2#define _SPARC_VAC_OPS_H
4 3
diff --git a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h
index 91097392c8cc..f6ca4779056c 100644
--- a/include/asm-sparc/vaddrs.h
+++ b/include/asm-sparc/vaddrs.h
@@ -1,4 +1,3 @@
1/* $Id: vaddrs.h,v 1.27 2001/07/04 00:18:18 davem Exp $ */
2#ifndef _SPARC_VADDRS_H 1#ifndef _SPARC_VADDRS_H
3#define _SPARC_VADDRS_H 2#define _SPARC_VADDRS_H
4 3
diff --git a/include/asm-sparc/viking.h b/include/asm-sparc/viking.h
index 7541da71b9d6..989930aeb093 100644
--- a/include/asm-sparc/viking.h
+++ b/include/asm-sparc/viking.h
@@ -1,4 +1,4 @@
1/* $Id: viking.h,v 1.19 1997/04/20 14:11:48 ecd Exp $ 1/*
2 * viking.h: Defines specific to the GNU/Viking MBUS module. 2 * viking.h: Defines specific to the GNU/Viking MBUS module.
3 * This is SRMMU stuff. 3 * This is SRMMU stuff.
4 * 4 *
diff --git a/include/asm-sparc/winmacro.h b/include/asm-sparc/winmacro.h
index 096f3d3d90c3..5b0a06dc3bcb 100644
--- a/include/asm-sparc/winmacro.h
+++ b/include/asm-sparc/winmacro.h
@@ -1,4 +1,4 @@
1/* $Id: winmacro.h,v 1.22 2000/05/09 17:40:15 davem Exp $ 1/*
2 * winmacro.h: Window loading-unloading macros. 2 * winmacro.h: Window loading-unloading macros.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/apb.h b/include/asm-sparc64/apb.h
index 80f0df289a66..8f3b57db810f 100644
--- a/include/asm-sparc64/apb.h
+++ b/include/asm-sparc64/apb.h
@@ -1,4 +1,4 @@
1/* $Id: apb.h,v 1.2 1998/04/01 20:41:49 ecd Exp $ 1/*
2 * apb.h: Advanced PCI Bridge Configuration Registers and Bits 2 * apb.h: Advanced PCI Bridge Configuration Registers and Bits
3 * 3 *
4 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
diff --git a/include/asm-sparc64/asi.h b/include/asm-sparc64/asi.h
index 662a21107ae6..bc57c405e7d3 100644
--- a/include/asm-sparc64/asi.h
+++ b/include/asm-sparc64/asi.h
@@ -1,4 +1,3 @@
1/* $Id: asi.h,v 1.5 2001/03/29 11:47:47 davem Exp $ */
2#ifndef _SPARC64_ASI_H 1#ifndef _SPARC64_ASI_H
3#define _SPARC64_ASI_H 2#define _SPARC64_ASI_H
4 3
diff --git a/include/asm-sparc64/auxio.h b/include/asm-sparc64/auxio.h
index 81a590a50a1f..c4100494c7a5 100644
--- a/include/asm-sparc64/auxio.h
+++ b/include/asm-sparc64/auxio.h
@@ -1,4 +1,4 @@
1/* $Id: auxio.h,v 1.3 2001/06/05 08:16:34 davem Exp $ 1/*
2 * auxio.h: Definitions and code for the Auxiliary I/O registers. 2 * auxio.h: Definitions and code for the Auxiliary I/O registers.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/bbc.h b/include/asm-sparc64/bbc.h
index 368fce4eedba..423a85800aae 100644
--- a/include/asm-sparc64/bbc.h
+++ b/include/asm-sparc64/bbc.h
@@ -1,4 +1,4 @@
1/* $Id: bbc.h,v 1.2 2001/03/26 23:47:18 davem Exp $ 1/*
2 * bbc.h: Defines for BootBus Controller found on UltraSPARC-III 2 * bbc.h: Defines for BootBus Controller found on UltraSPARC-III
3 * systems. 3 * systems.
4 * 4 *
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 11f9d8146cdf..bb87b8080220 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -1,4 +1,4 @@
1/* $Id: bitops.h,v 1.39 2002/01/30 01:40:00 davem Exp $ 1/*
2 * bitops.h: Bit string operations on the V9. 2 * bitops.h: Bit string operations on the V9.
3 * 3 *
4 * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/chafsr.h b/include/asm-sparc64/chafsr.h
index fd1688335ace..85c69b38220b 100644
--- a/include/asm-sparc64/chafsr.h
+++ b/include/asm-sparc64/chafsr.h
@@ -1,4 +1,3 @@
1/* $Id: chafsr.h,v 1.1 2001/03/28 10:56:34 davem Exp $ */
2#ifndef _SPARC64_CHAFSR_H 1#ifndef _SPARC64_CHAFSR_H
3#define _SPARC64_CHAFSR_H 2#define _SPARC64_CHAFSR_H
4 3
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h
index 70a006da7634..b290564c8ce0 100644
--- a/include/asm-sparc64/checksum.h
+++ b/include/asm-sparc64/checksum.h
@@ -1,4 +1,3 @@
1/* $Id: checksum.h,v 1.19 2002/02/09 19:49:31 davem Exp $ */
2#ifndef __SPARC64_CHECKSUM_H 1#ifndef __SPARC64_CHECKSUM_H
3#define __SPARC64_CHECKSUM_H 2#define __SPARC64_CHECKSUM_H
4 3
diff --git a/include/asm-sparc64/chmctrl.h b/include/asm-sparc64/chmctrl.h
index 53047f9f6423..859b4a4b0d30 100644
--- a/include/asm-sparc64/chmctrl.h
+++ b/include/asm-sparc64/chmctrl.h
@@ -1,4 +1,3 @@
1/* $Id: chmctrl.h,v 1.1 2001/03/29 11:43:28 davem Exp $ */
2#ifndef _SPARC64_CHMCTRL_H 1#ifndef _SPARC64_CHMCTRL_H
3#define _SPARC64_CHMCTRL_H 2#define _SPARC64_CHMCTRL_H
4 3
diff --git a/include/asm-sparc64/dcr.h b/include/asm-sparc64/dcr.h
index e9a3f305815d..620c9ba642e9 100644
--- a/include/asm-sparc64/dcr.h
+++ b/include/asm-sparc64/dcr.h
@@ -1,4 +1,3 @@
1/* $Id: dcr.h,v 1.4 2001/03/09 17:56:37 davem Exp $ */
2#ifndef _SPARC64_DCR_H 1#ifndef _SPARC64_DCR_H
3#define _SPARC64_DCR_H 2#define _SPARC64_DCR_H
4 3
diff --git a/include/asm-sparc64/display7seg.h b/include/asm-sparc64/display7seg.h
index 955a3502218e..c066a8964eab 100644
--- a/include/asm-sparc64/display7seg.h
+++ b/include/asm-sparc64/display7seg.h
@@ -1,4 +1,4 @@
1/* $Id: display7seg.h,v 1.2 2000/08/02 06:22:35 davem Exp $ 1/*
2 * 2 *
3 * display7seg - Driver interface for the 7-segment display 3 * display7seg - Driver interface for the 7-segment display
4 * present on Sun Microsystems CP1400 and CP1500 4 * present on Sun Microsystems CP1400 and CP1500
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h
index a9fd06183972..9d4c024bd3b3 100644
--- a/include/asm-sparc64/dma.h
+++ b/include/asm-sparc64/dma.h
@@ -1,4 +1,4 @@
1/* $Id: dma.h,v 1.21 2001/12/13 04:16:52 davem Exp $ 1/*
2 * include/asm-sparc64/dma.h 2 * include/asm-sparc64/dma.h
3 * 3 *
4 * Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu) 4 * Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 9c1c6db2a790..fcc62b97ced5 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -1,4 +1,4 @@
1/* $Id: ebus.h,v 1.10 2001/03/14 05:00:55 davem Exp $ 1/*
2 * ebus.h: PCI to Ebus pseudo driver software state. 2 * ebus.h: PCI to Ebus pseudo driver software state.
3 * 3 *
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 11c8e68d712a..0818a1308f4e 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -1,4 +1,3 @@
1/* $Id: elf.h,v 1.32 2002/02/09 19:49:31 davem Exp $ */
2#ifndef __ASM_SPARC64_ELF_H 1#ifndef __ASM_SPARC64_ELF_H
3#define __ASM_SPARC64_ELF_H 2#define __ASM_SPARC64_ELF_H
4 3
diff --git a/include/asm-sparc64/envctrl.h b/include/asm-sparc64/envctrl.h
index 53a6653815eb..a5668a082b14 100644
--- a/include/asm-sparc64/envctrl.h
+++ b/include/asm-sparc64/envctrl.h
@@ -1,4 +1,4 @@
1/* $Id: envctrl.h,v 1.3 2000/11/03 00:37:40 davem Exp $ 1/*
2 * 2 *
3 * envctrl.h: Definitions for access to the i2c environment 3 * envctrl.h: Definitions for access to the i2c environment
4 * monitoring on Ultrasparc systems. 4 * monitoring on Ultrasparc systems.
diff --git a/include/asm-sparc64/estate.h b/include/asm-sparc64/estate.h
index a719c3d2f6b1..520c08560d1b 100644
--- a/include/asm-sparc64/estate.h
+++ b/include/asm-sparc64/estate.h
@@ -1,4 +1,3 @@
1/* $Id: estate.h,v 1.1 2001/03/28 10:56:34 davem Exp $ */
2#ifndef _SPARC64_ESTATE_H 1#ifndef _SPARC64_ESTATE_H
3#define _SPARC64_ESTATE_H 2#define _SPARC64_ESTATE_H
4 3
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h
index 111f6b3b8925..8a09ca7aa2f2 100644
--- a/include/asm-sparc64/fcntl.h
+++ b/include/asm-sparc64/fcntl.h
@@ -1,4 +1,3 @@
1/* $Id: fcntl.h,v 1.12 2001/09/20 00:35:34 davem Exp $ */
2#ifndef _SPARC64_FCNTL_H 1#ifndef _SPARC64_FCNTL_H
3#define _SPARC64_FCNTL_H 2#define _SPARC64_FCNTL_H
4 3
diff --git a/include/asm-sparc64/fhc.h b/include/asm-sparc64/fhc.h
index 9e7f1b0d78b9..ddffcdfbc984 100644
--- a/include/asm-sparc64/fhc.h
+++ b/include/asm-sparc64/fhc.h
@@ -1,4 +1,4 @@
1/* $Id: fhc.h,v 1.5 1999/09/21 14:39:29 davem Exp $ 1/*
2 * fhc.h: Structures for central/fhc pseudo driver on Sunfire/Starfire/Wildfire. 2 * fhc.h: Structures for central/fhc pseudo driver on Sunfire/Starfire/Wildfire.
3 * 3 *
4 * Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com)
diff --git a/include/asm-sparc64/head.h b/include/asm-sparc64/head.h
index 67960a751f4d..10e9dabc4c41 100644
--- a/include/asm-sparc64/head.h
+++ b/include/asm-sparc64/head.h
@@ -1,4 +1,3 @@
1/* $Id: head.h,v 1.30 1997/08/08 08:34:33 jj Exp $ */
2#ifndef _SPARC64_HEAD_H 1#ifndef _SPARC64_HEAD_H
3#define _SPARC64_HEAD_H 2#define _SPARC64_HEAD_H
4 3
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
index c5fdabe0b42d..1282676da1cd 100644
--- a/include/asm-sparc64/ide.h
+++ b/include/asm-sparc64/ide.h
@@ -1,4 +1,4 @@
1/* $Id: ide.h,v 1.21 2001/09/25 20:21:48 kanoj Exp $ 1/*
2 * ide.h: Ultra/PCI specific IDE glue. 2 * ide.h: Ultra/PCI specific IDE glue.
3 * 3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/idprom.h b/include/asm-sparc64/idprom.h
index 77fbf987385f..a363fa0a112a 100644
--- a/include/asm-sparc64/idprom.h
+++ b/include/asm-sparc64/idprom.h
@@ -1,4 +1,4 @@
1/* $Id: idprom.h,v 1.2 1997/04/04 00:50:16 davem Exp $ 1/*
2 * idprom.h: Macros and defines for idprom routines 2 * idprom.h: Macros and defines for idprom routines
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index c299b853b5ba..3158960f3eb5 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -24,7 +24,8 @@ static inline u8 _inb(unsigned long addr)
24 24
25 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_inb */" 25 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_inb */"
26 : "=r" (ret) 26 : "=r" (ret)
27 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 27 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
28 : "memory");
28 29
29 return ret; 30 return ret;
30} 31}
@@ -35,7 +36,8 @@ static inline u16 _inw(unsigned long addr)
35 36
36 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_inw */" 37 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_inw */"
37 : "=r" (ret) 38 : "=r" (ret)
38 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 39 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
40 : "memory");
39 41
40 return ret; 42 return ret;
41} 43}
@@ -46,7 +48,8 @@ static inline u32 _inl(unsigned long addr)
46 48
47 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_inl */" 49 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_inl */"
48 : "=r" (ret) 50 : "=r" (ret)
49 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 51 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
52 : "memory");
50 53
51 return ret; 54 return ret;
52} 55}
@@ -55,21 +58,24 @@ static inline void _outb(u8 b, unsigned long addr)
55{ 58{
56 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_outb */" 59 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_outb */"
57 : /* no outputs */ 60 : /* no outputs */
58 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 61 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
62 : "memory");
59} 63}
60 64
61static inline void _outw(u16 w, unsigned long addr) 65static inline void _outw(u16 w, unsigned long addr)
62{ 66{
63 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_outw */" 67 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_outw */"
64 : /* no outputs */ 68 : /* no outputs */
65 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 69 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
70 : "memory");
66} 71}
67 72
68static inline void _outl(u32 l, unsigned long addr) 73static inline void _outl(u32 l, unsigned long addr)
69{ 74{
70 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_outl */" 75 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_outl */"
71 : /* no outputs */ 76 : /* no outputs */
72 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 77 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
78 : "memory");
73} 79}
74 80
75#define inb(__addr) (_inb((unsigned long)(__addr))) 81#define inb(__addr) (_inb((unsigned long)(__addr)))
@@ -128,7 +134,8 @@ static inline u8 _readb(const volatile void __iomem *addr)
128 134
129 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_readb */" 135 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_readb */"
130 : "=r" (ret) 136 : "=r" (ret)
131 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 137 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
138 : "memory");
132 return ret; 139 return ret;
133} 140}
134 141
@@ -137,7 +144,8 @@ static inline u16 _readw(const volatile void __iomem *addr)
137 144
138 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_readw */" 145 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_readw */"
139 : "=r" (ret) 146 : "=r" (ret)
140 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 147 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
148 : "memory");
141 149
142 return ret; 150 return ret;
143} 151}
@@ -147,7 +155,8 @@ static inline u32 _readl(const volatile void __iomem *addr)
147 155
148 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_readl */" 156 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_readl */"
149 : "=r" (ret) 157 : "=r" (ret)
150 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 158 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
159 : "memory");
151 160
152 return ret; 161 return ret;
153} 162}
@@ -157,7 +166,8 @@ static inline u64 _readq(const volatile void __iomem *addr)
157 166
158 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_readq */" 167 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_readq */"
159 : "=r" (ret) 168 : "=r" (ret)
160 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 169 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
170 : "memory");
161 171
162 return ret; 172 return ret;
163} 173}
@@ -166,28 +176,32 @@ static inline void _writeb(u8 b, volatile void __iomem *addr)
166{ 176{
167 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */" 177 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */"
168 : /* no outputs */ 178 : /* no outputs */
169 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 179 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
180 : "memory");
170} 181}
171 182
172static inline void _writew(u16 w, volatile void __iomem *addr) 183static inline void _writew(u16 w, volatile void __iomem *addr)
173{ 184{
174 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */" 185 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */"
175 : /* no outputs */ 186 : /* no outputs */
176 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 187 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
188 : "memory");
177} 189}
178 190
179static inline void _writel(u32 l, volatile void __iomem *addr) 191static inline void _writel(u32 l, volatile void __iomem *addr)
180{ 192{
181 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */" 193 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */"
182 : /* no outputs */ 194 : /* no outputs */
183 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 195 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
196 : "memory");
184} 197}
185 198
186static inline void _writeq(u64 q, volatile void __iomem *addr) 199static inline void _writeq(u64 q, volatile void __iomem *addr)
187{ 200{
188 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" 201 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */"
189 : /* no outputs */ 202 : /* no outputs */
190 : "Jr" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 203 : "Jr" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
204 : "memory");
191} 205}
192 206
193#define readb(__addr) _readb(__addr) 207#define readb(__addr) _readb(__addr)
@@ -299,7 +313,8 @@ static inline u8 _sbus_readb(const volatile void __iomem *addr)
299 313
300 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* sbus_readb */" 314 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* sbus_readb */"
301 : "=r" (ret) 315 : "=r" (ret)
302 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 316 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
317 : "memory");
303 318
304 return ret; 319 return ret;
305} 320}
@@ -310,7 +325,8 @@ static inline u16 _sbus_readw(const volatile void __iomem *addr)
310 325
311 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* sbus_readw */" 326 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* sbus_readw */"
312 : "=r" (ret) 327 : "=r" (ret)
313 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 328 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
329 : "memory");
314 330
315 return ret; 331 return ret;
316} 332}
@@ -321,7 +337,8 @@ static inline u32 _sbus_readl(const volatile void __iomem *addr)
321 337
322 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* sbus_readl */" 338 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* sbus_readl */"
323 : "=r" (ret) 339 : "=r" (ret)
324 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 340 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
341 : "memory");
325 342
326 return ret; 343 return ret;
327} 344}
@@ -332,7 +349,8 @@ static inline u64 _sbus_readq(const volatile void __iomem *addr)
332 349
333 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* sbus_readq */" 350 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* sbus_readq */"
334 : "=r" (ret) 351 : "=r" (ret)
335 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 352 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
353 : "memory");
336 354
337 return ret; 355 return ret;
338} 356}
@@ -341,28 +359,32 @@ static inline void _sbus_writeb(u8 b, volatile void __iomem *addr)
341{ 359{
342 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* sbus_writeb */" 360 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* sbus_writeb */"
343 : /* no outputs */ 361 : /* no outputs */
344 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 362 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
363 : "memory");
345} 364}
346 365
347static inline void _sbus_writew(u16 w, volatile void __iomem *addr) 366static inline void _sbus_writew(u16 w, volatile void __iomem *addr)
348{ 367{
349 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* sbus_writew */" 368 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* sbus_writew */"
350 : /* no outputs */ 369 : /* no outputs */
351 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 370 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
371 : "memory");
352} 372}
353 373
354static inline void _sbus_writel(u32 l, volatile void __iomem *addr) 374static inline void _sbus_writel(u32 l, volatile void __iomem *addr)
355{ 375{
356 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* sbus_writel */" 376 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* sbus_writel */"
357 : /* no outputs */ 377 : /* no outputs */
358 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 378 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
379 : "memory");
359} 380}
360 381
361static inline void _sbus_writeq(u64 l, volatile void __iomem *addr) 382static inline void _sbus_writeq(u64 l, volatile void __iomem *addr)
362{ 383{
363 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* sbus_writeq */" 384 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* sbus_writeq */"
364 : /* no outputs */ 385 : /* no outputs */
365 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 386 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
387 : "memory");
366} 388}
367 389
368#define sbus_readb(__addr) _sbus_readb(__addr) 390#define sbus_readb(__addr) _sbus_readb(__addr)
diff --git a/include/asm-sparc64/ioctl.h b/include/asm-sparc64/ioctl.h
index 253d0b57b316..d634c21b4724 100644
--- a/include/asm-sparc64/ioctl.h
+++ b/include/asm-sparc64/ioctl.h
@@ -1,4 +1,3 @@
1/* $Id: ioctl.h,v 1.2 1998/10/15 05:40:38 jj Exp $ */
2#ifndef _SPARC64_IOCTL_H 1#ifndef _SPARC64_IOCTL_H
3#define _SPARC64_IOCTL_H 2#define _SPARC64_IOCTL_H
4 3
diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h
index c1be40647c99..94d1b75e512b 100644
--- a/include/asm-sparc64/ioctls.h
+++ b/include/asm-sparc64/ioctls.h
@@ -1,4 +1,3 @@
1/* $Id: ioctls.h,v 1.7 1998/02/23 02:49:41 davem Exp $ */
2#ifndef _ASM_SPARC64_IOCTLS_H 1#ifndef _ASM_SPARC64_IOCTLS_H
3#define _ASM_SPARC64_IOCTLS_H 2#define _ASM_SPARC64_IOCTLS_H
4 3
diff --git a/include/asm-sparc64/lsu.h b/include/asm-sparc64/lsu.h
index 79f109840c39..7190f8de90a0 100644
--- a/include/asm-sparc64/lsu.h
+++ b/include/asm-sparc64/lsu.h
@@ -1,4 +1,3 @@
1/* $Id: lsu.h,v 1.2 1997/04/04 00:50:22 davem Exp $ */
2#ifndef _SPARC64_LSU_H 1#ifndef _SPARC64_LSU_H
3#define _SPARC64_LSU_H 2#define _SPARC64_LSU_H
4 3
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
index e584563b56eb..d2ae67cd1bdc 100644
--- a/include/asm-sparc64/mman.h
+++ b/include/asm-sparc64/mman.h
@@ -1,4 +1,3 @@
1/* $Id: mman.h,v 1.2 2000/03/15 02:44:26 davem Exp $ */
2#ifndef __SPARC64_MMAN_H__ 1#ifndef __SPARC64_MMAN_H__
3#define __SPARC64_MMAN_H__ 2#define __SPARC64_MMAN_H__
4 3
@@ -24,9 +23,8 @@
24 23
25#ifdef __KERNEL__ 24#ifdef __KERNEL__
26#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
27#define arch_mmap_check sparc64_mmap_check 26#define arch_mmap_check(addr,len,flags) sparc64_mmap_check(addr,len)
28int sparc64_mmap_check(unsigned long addr, unsigned long len, 27int sparc64_mmap_check(unsigned long addr, unsigned long len);
29 unsigned long flags);
30#endif 28#endif
31#endif 29#endif
32 30
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 9fc225ed5500..5693ab482606 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -1,4 +1,3 @@
1/* $Id: mmu_context.h,v 1.54 2002/02/09 19:49:31 davem Exp $ */
2#ifndef __SPARC64_MMU_CONTEXT_H 1#ifndef __SPARC64_MMU_CONTEXT_H
3#define __SPARC64_MMU_CONTEXT_H 2#define __SPARC64_MMU_CONTEXT_H
4 3
diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h
index 275161f21213..cbc1b4c06891 100644
--- a/include/asm-sparc64/namei.h
+++ b/include/asm-sparc64/namei.h
@@ -1,4 +1,4 @@
1/* $Id: namei.h,v 1.17 2000/04/13 00:55:54 davem Exp $ 1/*
2 * linux/include/asm-sparc64/namei.h 2 * linux/include/asm-sparc64/namei.h
3 * 3 *
4 * Routines to handle famous /usr/gnemul/s*. 4 * Routines to handle famous /usr/gnemul/s*.
diff --git a/include/asm-sparc64/openprom.h b/include/asm-sparc64/openprom.h
index 26ec046715c8..b69e4a8c9170 100644
--- a/include/asm-sparc64/openprom.h
+++ b/include/asm-sparc64/openprom.h
@@ -1,4 +1,3 @@
1/* $Id: openprom.h,v 1.9 2001/03/16 10:22:02 davem Exp $ */
2#ifndef __SPARC64_OPENPROM_H 1#ifndef __SPARC64_OPENPROM_H
3#define __SPARC64_OPENPROM_H 2#define __SPARC64_OPENPROM_H
4 3
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 618117def0dc..93f0881b766e 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -1,5 +1,3 @@
1/* $Id: page.h,v 1.39 2002/02/09 19:49:31 davem Exp $ */
2
3#ifndef _SPARC64_PAGE_H 1#ifndef _SPARC64_PAGE_H
4#define _SPARC64_PAGE_H 2#define _SPARC64_PAGE_H
5 3
diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
index 3ee2d406373b..326de104d014 100644
--- a/include/asm-sparc64/pgalloc.h
+++ b/include/asm-sparc64/pgalloc.h
@@ -1,4 +1,3 @@
1/* $Id: pgalloc.h,v 1.30 2001/12/21 04:56:17 davem Exp $ */
2#ifndef _SPARC64_PGALLOC_H 1#ifndef _SPARC64_PGALLOC_H
3#define _SPARC64_PGALLOC_H 2#define _SPARC64_PGALLOC_H
4 3
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 0e200e7acec7..b87017747b5d 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -1,4 +1,4 @@
1/* $Id: pgtable.h,v 1.156 2002/02/09 19:49:31 davem Exp $ 1/*
2 * pgtable.h: SpitFire page table operations. 2 * pgtable.h: SpitFire page table operations.
3 * 3 *
4 * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/pil.h b/include/asm-sparc64/pil.h
index 2f5d126f7163..eaac842d88c3 100644
--- a/include/asm-sparc64/pil.h
+++ b/include/asm-sparc64/pil.h
@@ -1,4 +1,3 @@
1/* $Id: pil.h,v 1.1 2002/01/23 11:27:36 davem Exp $ */
2#ifndef _SPARC64_PIL_H 1#ifndef _SPARC64_PIL_H
3#define _SPARC64_PIL_H 2#define _SPARC64_PIL_H
4 3
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index 885b6a1dcae4..26b4e5255761 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -1,4 +1,4 @@
1/* $Id: processor.h,v 1.83 2002/02/10 06:04:33 davem Exp $ 1/*
2 * include/asm-sparc64/processor.h 2 * include/asm-sparc64/processor.h
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/psrcompat.h b/include/asm-sparc64/psrcompat.h
index 3614ca04753f..44b6327dbbf5 100644
--- a/include/asm-sparc64/psrcompat.h
+++ b/include/asm-sparc64/psrcompat.h
@@ -1,4 +1,3 @@
1/* $Id: psrcompat.h,v 1.5 1998/10/06 09:28:39 jj Exp $ */
2#ifndef _SPARC64_PSRCOMPAT_H 1#ifndef _SPARC64_PSRCOMPAT_H
3#define _SPARC64_PSRCOMPAT_H 2#define _SPARC64_PSRCOMPAT_H
4 3
diff --git a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h
index 949aebaf991d..a26a53777bb0 100644
--- a/include/asm-sparc64/pstate.h
+++ b/include/asm-sparc64/pstate.h
@@ -1,4 +1,3 @@
1/* $Id: pstate.h,v 1.6 1997/06/25 07:39:45 jj Exp $ */
2#ifndef _SPARC64_PSTATE_H 1#ifndef _SPARC64_PSTATE_H
3#define _SPARC64_PSTATE_H 2#define _SPARC64_PSTATE_H
4 3
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
index 90972a5ada59..b163da79bb6d 100644
--- a/include/asm-sparc64/ptrace.h
+++ b/include/asm-sparc64/ptrace.h
@@ -128,6 +128,17 @@ struct sparc_trapf {
128 128
129#ifdef __KERNEL__ 129#ifdef __KERNEL__
130 130
131struct global_reg_snapshot {
132 unsigned long tstate;
133 unsigned long tpc;
134 unsigned long tnpc;
135 unsigned long o7;
136 unsigned long i7;
137 struct thread_info *thread;
138 unsigned long pad1;
139 unsigned long pad2;
140};
141
131#define __ARCH_WANT_COMPAT_SYS_PTRACE 142#define __ARCH_WANT_COMPAT_SYS_PTRACE
132 143
133#define force_successful_syscall_return() \ 144#define force_successful_syscall_return() \
@@ -295,6 +306,20 @@ extern void __show_regs(struct pt_regs *);
295#define SF_XARG5 0x58 306#define SF_XARG5 0x58
296#define SF_XXARG 0x5c 307#define SF_XXARG 0x5c
297 308
309#ifdef __KERNEL__
310
311/* global_reg_snapshot offsets */
312#define GR_SNAP_TSTATE 0x00
313#define GR_SNAP_TPC 0x08
314#define GR_SNAP_TNPC 0x10
315#define GR_SNAP_O7 0x18
316#define GR_SNAP_I7 0x20
317#define GR_SNAP_THREAD 0x28
318#define GR_SNAP_PAD1 0x30
319#define GR_SNAP_PAD2 0x38
320
321#endif /* __KERNEL__ */
322
298/* Stuff for the ptrace system call */ 323/* Stuff for the ptrace system call */
299#define PTRACE_SPARC_DETACH 11 324#define PTRACE_SPARC_DETACH 11
300#define PTRACE_GETREGS 12 325#define PTRACE_GETREGS 12
diff --git a/include/asm-sparc64/reg.h b/include/asm-sparc64/reg.h
index fc68f90181b3..77aa4804a60d 100644
--- a/include/asm-sparc64/reg.h
+++ b/include/asm-sparc64/reg.h
@@ -1,4 +1,4 @@
1/* $Id: reg.h,v 1.6 1999/09/06 08:22:10 jj Exp $ 1/*
2 * linux/asm-sparc64/reg.h 2 * linux/asm-sparc64/reg.h
3 * Layout of the registers as expected by gdb on the Sparc 3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in 4 * we should replace the user.h definitions with those in
diff --git a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h
index aa469795a6b0..4f08fb5e4ca4 100644
--- a/include/asm-sparc64/resource.h
+++ b/include/asm-sparc64/resource.h
@@ -1,4 +1,4 @@
1/* $Id: resource.h,v 1.8 2000/09/23 02:09:21 davem Exp $ 1/*
2 * resource.h: Resource definitions. 2 * resource.h: Resource definitions.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/rtc.h b/include/asm-sparc64/rtc.h
index cb17334595c9..f9ecb1fe2ecd 100644
--- a/include/asm-sparc64/rtc.h
+++ b/include/asm-sparc64/rtc.h
@@ -1,5 +1,4 @@
1/* $Id: rtc.h,v 1.1 1996/12/26 14:22:35 davem Exp $ 1/*
2 *
3 * rtc.h: Definitions for access to the Mostek real time clock 2 * rtc.h: Definitions for access to the Mostek real time clock
4 * 3 *
5 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) 4 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
diff --git a/include/asm-sparc64/rwsem.h b/include/asm-sparc64/rwsem.h
index 1294b7ce5d06..1dc129ac2feb 100644
--- a/include/asm-sparc64/rwsem.h
+++ b/include/asm-sparc64/rwsem.h
@@ -1,4 +1,4 @@
1/* $Id: rwsem.h,v 1.5 2001/11/18 00:12:56 davem Exp $ 1/*
2 * rwsem.h: R/W semaphores implemented using CAS 2 * rwsem.h: R/W semaphores implemented using CAS
3 * 3 *
4 * Written by David S. Miller (davem@redhat.com), 2001. 4 * Written by David S. Miller (davem@redhat.com), 2001.
diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h
index 6df23f070b1a..81bd058f9382 100644
--- a/include/asm-sparc64/scatterlist.h
+++ b/include/asm-sparc64/scatterlist.h
@@ -1,4 +1,3 @@
1/* $Id: scatterlist.h,v 1.11 2001/12/17 07:05:15 davem Exp $ */
2#ifndef _SPARC64_SCATTERLIST_H 1#ifndef _SPARC64_SCATTERLIST_H
3#define _SPARC64_SCATTERLIST_H 2#define _SPARC64_SCATTERLIST_H
4 3
diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h
index 8c66fded8a32..1ed0d6701a9b 100644
--- a/include/asm-sparc64/shmparam.h
+++ b/include/asm-sparc64/shmparam.h
@@ -1,4 +1,3 @@
1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */
2#ifndef _ASMSPARC64_SHMPARAM_H 1#ifndef _ASMSPARC64_SHMPARAM_H
3#define _ASMSPARC64_SHMPARAM_H 2#define _ASMSPARC64_SHMPARAM_H
4 3
diff --git a/include/asm-sparc64/sigcontext.h b/include/asm-sparc64/sigcontext.h
index d8073373db8c..1c868d680cfc 100644
--- a/include/asm-sparc64/sigcontext.h
+++ b/include/asm-sparc64/sigcontext.h
@@ -1,4 +1,3 @@
1/* $Id: sigcontext.h,v 1.12 1999/09/06 08:22:09 jj Exp $ */
2#ifndef __SPARC64_SIGCONTEXT_H 1#ifndef __SPARC64_SIGCONTEXT_H
3#define __SPARC64_SIGCONTEXT_H 2#define __SPARC64_SIGCONTEXT_H
4 3
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
index c49f32d38707..2a7c7934ac0a 100644
--- a/include/asm-sparc64/signal.h
+++ b/include/asm-sparc64/signal.h
@@ -1,4 +1,3 @@
1/* $Id: signal.h,v 1.9 1999/09/06 08:22:11 jj Exp $ */
2#ifndef _ASMSPARC64_SIGNAL_H 1#ifndef _ASMSPARC64_SIGNAL_H
3#define _ASMSPARC64_SIGNAL_H 2#define _ASMSPARC64_SIGNAL_H
4 3
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 1c1c5ea5cea5..cd0311b2e19d 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -1,6 +1,6 @@
1/* smp.h: Sparc64 specific SMP stuff. 1/* smp.h: Sparc64 specific SMP stuff.
2 * 2 *
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1996, 2008 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#ifndef _SPARC64_SMP_H 6#ifndef _SPARC64_SMP_H
@@ -44,6 +44,8 @@ extern int hard_smp_processor_id(void);
44extern void smp_fill_in_sib_core_maps(void); 44extern void smp_fill_in_sib_core_maps(void);
45extern void cpu_play_dead(void); 45extern void cpu_play_dead(void);
46 46
47extern void smp_fetch_global_regs(void);
48
47#ifdef CONFIG_HOTPLUG_CPU 49#ifdef CONFIG_HOTPLUG_CPU
48extern int __cpu_disable(void); 50extern int __cpu_disable(void);
49extern void __cpu_die(unsigned int cpu); 51extern void __cpu_die(unsigned int cpu);
@@ -55,6 +57,7 @@ extern void __cpu_die(unsigned int cpu);
55 57
56#define hard_smp_processor_id() 0 58#define hard_smp_processor_id() 0
57#define smp_fill_in_sib_core_maps() do { } while (0) 59#define smp_fill_in_sib_core_maps() do { } while (0)
60#define smp_fetch_global_regs() do { } while (0)
58 61
59#endif /* !(CONFIG_SMP) */ 62#endif /* !(CONFIG_SMP) */
60 63
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 8cf071fae3eb..5af688f56716 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -1,4 +1,3 @@
1/* $Id: socket.h,v 1.10 2001/06/13 16:25:03 davem Exp $ */
2#ifndef _ASM_SOCKET_H 1#ifndef _ASM_SOCKET_H
3#define _ASM_SOCKET_H 2#define _ASM_SOCKET_H
4 3
diff --git a/include/asm-sparc64/starfire.h b/include/asm-sparc64/starfire.h
index 48b50b5e35b0..07bafd31e33c 100644
--- a/include/asm-sparc64/starfire.h
+++ b/include/asm-sparc64/starfire.h
@@ -1,4 +1,4 @@
1/* $Id: starfire.h,v 1.2 2001/07/04 00:18:18 davem Exp $ 1/*
2 * starfire.h: Group all starfire specific code together. 2 * starfire.h: Group all starfire specific code together.
3 * 3 *
4 * Copyright (C) 2000 Anton Blanchard (anton@samba.org) 4 * Copyright (C) 2000 Anton Blanchard (anton@samba.org)
diff --git a/include/asm-sparc64/stat.h b/include/asm-sparc64/stat.h
index 128c27e57f0b..9650fdea847f 100644
--- a/include/asm-sparc64/stat.h
+++ b/include/asm-sparc64/stat.h
@@ -1,4 +1,3 @@
1/* $Id: stat.h,v 1.7 2000/08/04 05:35:55 davem Exp $ */
2#ifndef _SPARC64_STAT_H 1#ifndef _SPARC64_STAT_H
3#define _SPARC64_STAT_H 2#define _SPARC64_STAT_H
4 3
diff --git a/include/asm-sparc64/statfs.h b/include/asm-sparc64/statfs.h
index 185b6c481b24..79b3c890a5fa 100644
--- a/include/asm-sparc64/statfs.h
+++ b/include/asm-sparc64/statfs.h
@@ -1,4 +1,3 @@
1/* $Id: statfs.h,v 1.2 1997/04/14 17:05:22 jj Exp $ */
2#ifndef _SPARC64_STATFS_H 1#ifndef _SPARC64_STATFS_H
3#define _SPARC64_STATFS_H 2#define _SPARC64_STATFS_H
4 3
diff --git a/include/asm-sparc64/string.h b/include/asm-sparc64/string.h
index c7d88622cb27..43161f2d17eb 100644
--- a/include/asm-sparc64/string.h
+++ b/include/asm-sparc64/string.h
@@ -1,4 +1,4 @@
1/* $Id: string.h,v 1.20 2001/09/27 04:36:24 kanoj Exp $ 1/*
2 * string.h: External definitions for optimized assembly string 2 * string.h: External definitions for optimized assembly string
3 * routines for the Linux Kernel. 3 * routines for the Linux Kernel.
4 * 4 *
diff --git a/include/asm-sparc64/sunbpp.h b/include/asm-sparc64/sunbpp.h
index b441cc9c426c..8e171b7a9f4f 100644
--- a/include/asm-sparc64/sunbpp.h
+++ b/include/asm-sparc64/sunbpp.h
@@ -1,4 +1,4 @@
1/* $Id: sunbpp.h,v 1.1 1999/08/13 06:21:44 shadow Exp $ 1/*
2 * include/asm-sparc64/sunbpp.h 2 * include/asm-sparc64/sunbpp.h
3 */ 3 */
4 4
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
index cacbea171ad7..1f5dab25dda5 100644
--- a/include/asm-sparc64/termios.h
+++ b/include/asm-sparc64/termios.h
@@ -1,4 +1,3 @@
1/* $Id: termios.h,v 1.11 2001/06/01 08:12:11 davem Exp $ */
2#ifndef _SPARC64_TERMIOS_H 1#ifndef _SPARC64_TERMIOS_H
3#define _SPARC64_TERMIOS_H 2#define _SPARC64_TERMIOS_H
4 3
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index 71e42d1a80d9..e5873e385306 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -38,7 +38,7 @@ struct thread_info {
38 struct task_struct *task; 38 struct task_struct *task;
39 unsigned long flags; 39 unsigned long flags;
40 __u8 fpsaved[7]; 40 __u8 fpsaved[7];
41 __u8 pad; 41 __u8 status;
42 unsigned long ksp; 42 unsigned long ksp;
43 43
44 /* D$ line 2 */ 44 /* D$ line 2 */
@@ -217,7 +217,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
217 * nop 217 * nop
218 */ 218 */
219#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 219#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
220#define TIF_RESTORE_SIGMASK 1 /* restore signal mask in do_signal() */ 220/* flags bit 1 is available */
221#define TIF_SIGPENDING 2 /* signal pending */ 221#define TIF_SIGPENDING 2 /* signal pending */
222#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 222#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
223#define TIF_PERFCTR 4 /* performance counters active */ 223#define TIF_PERFCTR 4 /* performance counters active */
@@ -244,14 +244,34 @@ register struct thread_info *current_thread_info_reg asm("g6");
244#define _TIF_32BIT (1<<TIF_32BIT) 244#define _TIF_32BIT (1<<TIF_32BIT)
245#define _TIF_SECCOMP (1<<TIF_SECCOMP) 245#define _TIF_SECCOMP (1<<TIF_SECCOMP)
246#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 246#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
247#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
248#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 247#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
249#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 248#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
250 249
251#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ 250#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
252 (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | \ 251 (_TIF_SIGPENDING | \
253 _TIF_NEED_RESCHED | _TIF_PERFCTR)) 252 _TIF_NEED_RESCHED | _TIF_PERFCTR))
254 253
254/*
255 * Thread-synchronous status.
256 *
257 * This is different from the flags in that nobody else
258 * ever touches our thread-synchronous status, so we don't
259 * have to worry about atomic accesses.
260 *
261 * Note that there are only 8 bits available.
262 */
263#define TS_RESTORE_SIGMASK 0x0001 /* restore signal mask in do_signal() */
264
265#ifndef __ASSEMBLY__
266#define HAVE_SET_RESTORE_SIGMASK 1
267static inline void set_restore_sigmask(void)
268{
269 struct thread_info *ti = current_thread_info();
270 ti->status |= TS_RESTORE_SIGMASK;
271 set_bit(TIF_SIGPENDING, &ti->flags);
272}
273#endif /* !__ASSEMBLY__ */
274
255#endif /* __KERNEL__ */ 275#endif /* __KERNEL__ */
256 276
257#endif /* _ASM_THREAD_INFO_H */ 277#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index 52d67d394107..0ba199587e07 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -1,4 +1,3 @@
1/* $Id: ttable.h,v 1.18 2002/02/09 19:49:32 davem Exp $ */
2#ifndef _SPARC64_TTABLE_H 1#ifndef _SPARC64_TTABLE_H
3#define _SPARC64_TTABLE_H 2#define _SPARC64_TTABLE_H
4 3
diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h
index 5dbe04f4044a..b27ccc85202f 100644
--- a/include/asm-sparc64/types.h
+++ b/include/asm-sparc64/types.h
@@ -1,4 +1,3 @@
1/* $Id: types.h,v 1.4 2001/10/09 02:24:35 davem Exp $ */
2#ifndef _SPARC64_TYPES_H 1#ifndef _SPARC64_TYPES_H
3#define _SPARC64_TYPES_H 2#define _SPARC64_TYPES_H
4 3
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
index d8547b87e730..5fcbaf68c3f6 100644
--- a/include/asm-sparc64/uaccess.h
+++ b/include/asm-sparc64/uaccess.h
@@ -1,4 +1,3 @@
1/* $Id: uaccess.h,v 1.35 2002/02/09 19:49:31 davem Exp $ */
2#ifndef _ASM_UACCESS_H 1#ifndef _ASM_UACCESS_H
3#define _ASM_UACCESS_H 2#define _ASM_UACCESS_H
4 3
diff --git a/include/asm-sparc64/uctx.h b/include/asm-sparc64/uctx.h
index 6eaf16ef23f6..dc937c75ffdd 100644
--- a/include/asm-sparc64/uctx.h
+++ b/include/asm-sparc64/uctx.h
@@ -1,4 +1,4 @@
1/* $Id: uctx.h,v 1.1 1997/06/18 16:51:58 davem Exp $ 1/*
2 * uctx.h: Sparc64 {set,get}context() register state layouts. 2 * uctx.h: Sparc64 {set,get}context() register state layouts.
3 * 3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/utrap.h b/include/asm-sparc64/utrap.h
index 81b0ebf3736c..e49e5c46ad68 100644
--- a/include/asm-sparc64/utrap.h
+++ b/include/asm-sparc64/utrap.h
@@ -1,4 +1,4 @@
1/* $Id: utrap.h,v 1.1 1997/10/14 16:21:31 jj Exp $ 1/*
2 * include/asm-sparc64/utrap.h 2 * include/asm-sparc64/utrap.h
3 * 3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
diff --git a/include/asm-sparc64/watchdog.h b/include/asm-sparc64/watchdog.h
index 4d5b03b60e4d..5baf2d3919cf 100644
--- a/include/asm-sparc64/watchdog.h
+++ b/include/asm-sparc64/watchdog.h
@@ -1,4 +1,4 @@
1/* $Id: watchdog.h,v 1.1 2001/01/18 04:47:44 davem Exp $ 1/*
2 * 2 *
3 * watchdog - Driver interface for the hardware watchdog timers 3 * watchdog - Driver interface for the hardware watchdog timers
4 * present on Sun Microsystems boardsets 4 * present on Sun Microsystems boardsets
diff --git a/include/asm-um/irq.h b/include/asm-um/irq.h
index de389a477cdd..4a2037f8204b 100644
--- a/include/asm-um/irq.h
+++ b/include/asm-um/irq.h
@@ -15,8 +15,9 @@
15#define SIGIO_WRITE_IRQ 11 15#define SIGIO_WRITE_IRQ 11
16#define TELNETD_IRQ 12 16#define TELNETD_IRQ 12
17#define XTERM_IRQ 13 17#define XTERM_IRQ 13
18#define RANDOM_IRQ 14
18 19
19#define LAST_IRQ XTERM_IRQ 20#define LAST_IRQ RANDOM_IRQ
20#define NR_IRQS (LAST_IRQ + 1) 21#define NR_IRQS (LAST_IRQ + 1)
21 22
22#endif 23#endif
diff --git a/include/asm-um/keyboard.h b/include/asm-um/keyboard.h
deleted file mode 100644
index ee2e2303d0e4..000000000000
--- a/include/asm-um/keyboard.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_KEYBOARD_H
2#define __UM_KEYBOARD_H
3
4#include "asm/arch/keyboard.h"
5
6#endif
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index 6686fc524ca1..54f42e8b0105 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -22,16 +22,10 @@ extern void force_flush_all(void);
22static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) 22static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
23{ 23{
24 /* 24 /*
25 * This is called by fs/exec.c and fs/aio.c. In the first case, for an 25 * This is called by fs/exec.c and sys_unshare()
26 * exec, we don't need to do anything as we're called from userspace 26 * when the new ->mm is used for the first time.
27 * and thus going to use a new host PID. In the second, we're called
28 * from a kernel thread, and thus need to go doing the mmap's on the
29 * host. Since they're very expensive, we want to avoid that as far as
30 * possible.
31 */ 27 */
32 if (old != new && (current->flags & PF_BORROWED_MM)) 28 __switch_mm(&new->context.id);
33 __switch_mm(&new->context.id);
34
35 arch_dup_mmap(old, new); 29 arch_dup_mmap(old, new);
36} 30}
37 31
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 381f96b1c825..916e1a61999f 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -7,16 +7,20 @@
7#ifndef __UM_PAGE_H 7#ifndef __UM_PAGE_H
8#define __UM_PAGE_H 8#define __UM_PAGE_H
9 9
10struct page; 10#include <linux/const.h>
11
12#include <linux/types.h>
13#include <asm/vm-flags.h>
14 11
15/* PAGE_SHIFT determines the page size */ 12/* PAGE_SHIFT determines the page size */
16#define PAGE_SHIFT 12 13#define PAGE_SHIFT 12
17#define PAGE_SIZE (1UL << PAGE_SHIFT) 14#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
18#define PAGE_MASK (~(PAGE_SIZE-1)) 15#define PAGE_MASK (~(PAGE_SIZE-1))
19 16
17#ifndef __ASSEMBLY__
18
19struct page;
20
21#include <linux/types.h>
22#include <asm/vm-flags.h>
23
20/* 24/*
21 * These are used to make use of C type-checking.. 25 * These are used to make use of C type-checking..
22 */ 26 */
@@ -120,4 +124,5 @@ extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
120#include <asm-generic/memory_model.h> 124#include <asm-generic/memory_model.h>
121#include <asm-generic/page.h> 125#include <asm-generic/page.h>
122 126
123#endif 127#endif /* __ASSEMBLY__ */
128#endif /* __UM_PAGE_H */
diff --git a/include/asm-um/param.h b/include/asm-um/param.h
index 4cd4a226f8c1..e44f4e60d16d 100644
--- a/include/asm-um/param.h
+++ b/include/asm-um/param.h
@@ -13,6 +13,8 @@
13#define HZ CONFIG_HZ 13#define HZ CONFIG_HZ
14#define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 14#define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ 15#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
16#else
17#define HZ 100
16#endif 18#endif
17 19
18#endif 20#endif
diff --git a/include/asm-v850/clinkage.h b/include/asm-v850/clinkage.h
index 2b622adccae5..c389691d6f86 100644
--- a/include/asm-v850/clinkage.h
+++ b/include/asm-v850/clinkage.h
@@ -11,7 +11,7 @@
11 * Written by Miles Bader <miles@gnu.org> 11 * Written by Miles Bader <miles@gnu.org>
12 */ 12 */
13 13
14#ifndef __CLINKAGE_H__ 14#ifndef __V850_CLINKAGE_H__
15#define __V850_CLINKAGE_H__ 15#define __V850_CLINKAGE_H__
16 16
17#include <asm/macrology.h> 17#include <asm/macrology.h>
diff --git a/include/asm-v850/param.h b/include/asm-v850/param.h
index 281832690290..4391f5fe0204 100644
--- a/include/asm-v850/param.h
+++ b/include/asm-v850/param.h
@@ -26,6 +26,8 @@
26# define HZ CONFIG_HZ 26# define HZ CONFIG_HZ
27# define USER_HZ 100 27# define USER_HZ 100
28# define CLOCKS_PER_SEC USER_HZ 28# define CLOCKS_PER_SEC USER_HZ
29#else
30# define HZ 100
29#endif 31#endif
30 32
31#endif /* __V850_PARAM_H__ */ 33#endif /* __V850_PARAM_H__ */
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
index 6b722d315936..37672f79dcc8 100644
--- a/include/asm-x86/i387.h
+++ b/include/asm-x86/i387.h
@@ -193,6 +193,8 @@ static inline int restore_i387(struct _fpstate __user *buf)
193 193
194#else /* CONFIG_X86_32 */ 194#else /* CONFIG_X86_32 */
195 195
196extern void finit(void);
197
196static inline void tolerant_fwait(void) 198static inline void tolerant_fwait(void)
197{ 199{
198 asm volatile("fnclex ; fwait"); 200 asm volatile("fnclex ; fwait");
diff --git a/include/asm-x86/kvm_x86_emulate.h b/include/asm-x86/kvm_x86_emulate.h
index d6337f941c98..b877bbd2d3a7 100644
--- a/include/asm-x86/kvm_x86_emulate.h
+++ b/include/asm-x86/kvm_x86_emulate.h
@@ -135,6 +135,7 @@ struct decode_cache {
135 u8 modrm_rm; 135 u8 modrm_rm;
136 u8 use_modrm_ea; 136 u8 use_modrm_ea;
137 unsigned long modrm_ea; 137 unsigned long modrm_ea;
138 void *modrm_ptr;
138 unsigned long modrm_val; 139 unsigned long modrm_val;
139 struct fetch_cache fetch; 140 struct fetch_cache fetch;
140}; 141};
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index b381f4a5a0bd..dc936dddf161 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -10,8 +10,16 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) 13#define __PHYSICAL_MASK ((phys_addr_t)(1ULL << __PHYSICAL_MASK_SHIFT) - 1)
14#define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK)) 14#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
15
16/* Cast PAGE_MASK to a signed type so that it is sign-extended if
17 virtual addresses are 32-bits but physical addresses are larger
18 (ie, 32-bit PAE). */
19#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
20
21/* PTE_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
22#define PTE_MASK ((pteval_t)PHYSICAL_PAGE_MASK)
15 23
16#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) 24#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
17#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) 25#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
@@ -24,9 +32,6 @@
24/* to align the pointer to the (next) page boundary */ 32/* to align the pointer to the (next) page boundary */
25#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 33#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
26 34
27#define __PHYSICAL_MASK _AT(phys_addr_t, (_AC(1,ULL) << __PHYSICAL_MASK_SHIFT) - 1)
28#define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
29
30#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
31#include <linux/types.h> 36#include <linux/types.h>
32#endif 37#endif
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h
index 8b4a9d44b7f4..c93dbb6c2624 100644
--- a/include/asm-x86/pgtable-3level.h
+++ b/include/asm-x86/pgtable-3level.h
@@ -120,9 +120,9 @@ static inline void pud_clear(pud_t *pudp)
120 write_cr3(pgd); 120 write_cr3(pgd);
121} 121}
122 122
123#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PAGE_MASK)) 123#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PTE_MASK))
124 124
125#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) 125#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_MASK))
126 126
127 127
128/* Find an entry in the second-level page table.. */ 128/* Find an entry in the second-level page table.. */
@@ -160,7 +160,7 @@ static inline int pte_none(pte_t pte)
160 160
161static inline unsigned long pte_pfn(pte_t pte) 161static inline unsigned long pte_pfn(pte_t pte)
162{ 162{
163 return (pte_val(pte) & ~_PAGE_NX) >> PAGE_SHIFT; 163 return (pte_val(pte) & PTE_MASK) >> PAGE_SHIFT;
164} 164}
165 165
166/* 166/*
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 801b31f71452..97c271b2910b 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -57,7 +57,9 @@
57#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \ 57#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \
58 _PAGE_DIRTY) 58 _PAGE_DIRTY)
59 59
60#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 60/* Set of bits not changed in pte_modify */
61#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_PCD | _PAGE_PWT | \
62 _PAGE_ACCESSED | _PAGE_DIRTY)
61 63
62#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) 64#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT)
63#define _PAGE_CACHE_WB (0) 65#define _PAGE_CACHE_WB (0)
@@ -288,13 +290,22 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
288 * Chop off the NX bit (if present), and add the NX portion of 290 * Chop off the NX bit (if present), and add the NX portion of
289 * the newprot (if present): 291 * the newprot (if present):
290 */ 292 */
291 val &= _PAGE_CHG_MASK & ~_PAGE_NX; 293 val &= _PAGE_CHG_MASK;
292 val |= pgprot_val(newprot) & __supported_pte_mask; 294 val |= pgprot_val(newprot) & (~_PAGE_CHG_MASK) & __supported_pte_mask;
293 295
294 return __pte(val); 296 return __pte(val);
295} 297}
296 298
297#define pte_pgprot(x) __pgprot(pte_val(x) & (0xfff | _PAGE_NX)) 299/* mprotect needs to preserve PAT bits when updating vm_page_prot */
300#define pgprot_modify pgprot_modify
301static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
302{
303 pgprotval_t preservebits = pgprot_val(oldprot) & _PAGE_CHG_MASK;
304 pgprotval_t addbits = pgprot_val(newprot);
305 return __pgprot(preservebits | addbits);
306}
307
308#define pte_pgprot(x) __pgprot(pte_val(x) & ~PTE_MASK)
298 309
299#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) 310#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
300 311
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index d7f0403bbecb..32ca03109a4c 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -88,7 +88,7 @@ extern unsigned long pg0[];
88/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ 88/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
89#define pmd_none(x) (!(unsigned long)pmd_val((x))) 89#define pmd_none(x) (!(unsigned long)pmd_val((x)))
90#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT) 90#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT)
91#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) 91#define pmd_bad(x) ((pmd_val(x) & (~PTE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
92 92
93#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 93#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
94 94
@@ -159,7 +159,7 @@ static inline int pud_large(pud_t pud) { return 0; }
159#define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT)) 159#define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
160 160
161#define pmd_page_vaddr(pmd) \ 161#define pmd_page_vaddr(pmd) \
162 ((unsigned long)__va(pmd_val((pmd)) & PAGE_MASK)) 162 ((unsigned long)__va(pmd_val((pmd)) & PTE_MASK))
163 163
164#if defined(CONFIG_HIGHPTE) 164#if defined(CONFIG_HIGHPTE)
165#define pte_offset_map(dir, address) \ 165#define pte_offset_map(dir, address) \
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index efe83dcbd412..1cc50d22d735 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -151,19 +151,19 @@ static inline void native_pgd_clear(pgd_t *pgd)
151 151
152#ifndef __ASSEMBLY__ 152#ifndef __ASSEMBLY__
153 153
154static inline unsigned long pgd_bad(pgd_t pgd) 154static inline int pgd_bad(pgd_t pgd)
155{ 155{
156 return pgd_val(pgd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); 156 return (pgd_val(pgd) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE;
157} 157}
158 158
159static inline unsigned long pud_bad(pud_t pud) 159static inline int pud_bad(pud_t pud)
160{ 160{
161 return pud_val(pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); 161 return (pud_val(pud) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE;
162} 162}
163 163
164static inline unsigned long pmd_bad(pmd_t pmd) 164static inline int pmd_bad(pmd_t pmd)
165{ 165{
166 return pmd_val(pmd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); 166 return (pmd_val(pmd) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE;
167} 167}
168 168
169#define pte_none(x) (!pte_val((x))) 169#define pte_none(x) (!pte_val((x)))
diff --git a/include/asm-x86/tlbflush.h b/include/asm-x86/tlbflush.h
index 0c0674d94255..35c76ceb9f40 100644
--- a/include/asm-x86/tlbflush.h
+++ b/include/asm-x86/tlbflush.h
@@ -22,12 +22,23 @@ static inline void __native_flush_tlb(void)
22 22
23static inline void __native_flush_tlb_global(void) 23static inline void __native_flush_tlb_global(void)
24{ 24{
25 unsigned long cr4 = read_cr4(); 25 unsigned long flags;
26 unsigned long cr4;
26 27
28 /*
29 * Read-modify-write to CR4 - protect it from preemption and
30 * from interrupts. (Use the raw variant because this code can
31 * be called from deep inside debugging code.)
32 */
33 raw_local_irq_save(flags);
34
35 cr4 = read_cr4();
27 /* clear PGE */ 36 /* clear PGE */
28 write_cr4(cr4 & ~X86_CR4_PGE); 37 write_cr4(cr4 & ~X86_CR4_PGE);
29 /* write old PGE again and flush TLBs */ 38 /* write old PGE again and flush TLBs */
30 write_cr4(cr4); 39 write_cr4(cr4);
40
41 raw_local_irq_restore(flags);
31} 42}
32 43
33static inline void __native_flush_tlb_single(unsigned long addr) 44static inline void __native_flush_tlb_single(unsigned long addr)
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
index 01799305f02a..baf3a4dce28c 100644
--- a/include/asm-x86/xen/page.h
+++ b/include/asm-x86/xen/page.h
@@ -127,7 +127,7 @@ static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
127 127
128static inline unsigned long pte_mfn(pte_t pte) 128static inline unsigned long pte_mfn(pte_t pte)
129{ 129{
130 return (pte.pte & ~_PAGE_NX) >> PAGE_SHIFT; 130 return (pte.pte & PTE_MASK) >> PAGE_SHIFT;
131} 131}
132 132
133static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot) 133static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
diff --git a/include/asm-xtensa/param.h b/include/asm-xtensa/param.h
index 82ad34d92d35..ba03d5aeab6b 100644
--- a/include/asm-xtensa/param.h
+++ b/include/asm-xtensa/param.h
@@ -15,6 +15,8 @@
15# define HZ CONFIG_HZ /* internal timer frequency */ 15# define HZ CONFIG_HZ /* internal timer frequency */
16# define USER_HZ 100 /* for user interfaces in "ticks" */ 16# define USER_HZ 100 /* for user interfaces in "ticks" */
17# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */ 17# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
18#else
19# define HZ 100
18#endif 20#endif
19 21
20#define EXEC_PAGESIZE 4096 22#define EXEC_PAGESIZE 4096
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b7d81b2a9041..93b98856007a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -92,7 +92,6 @@ header-y += if_slip.h
92header-y += if_strip.h 92header-y += if_strip.h
93header-y += if_tun.h 93header-y += if_tun.h
94header-y += if_tunnel.h 94header-y += if_tunnel.h
95header-y += in6.h
96header-y += in_route.h 95header-y += in_route.h
97header-y += ioctl.h 96header-y += ioctl.h
98header-y += ip6_tunnel.h 97header-y += ip6_tunnel.h
@@ -105,7 +104,6 @@ header-y += ixjuser.h
105header-y += jffs2.h 104header-y += jffs2.h
106header-y += keyctl.h 105header-y += keyctl.h
107header-y += limits.h 106header-y += limits.h
108header-y += dlm_plock.h
109header-y += magic.h 107header-y += magic.h
110header-y += major.h 108header-y += major.h
111header-y += matroxfb.h 109header-y += matroxfb.h
@@ -190,6 +188,7 @@ unifdef-y += cyclades.h
190unifdef-y += dccp.h 188unifdef-y += dccp.h
191unifdef-y += dirent.h 189unifdef-y += dirent.h
192unifdef-y += dlm.h 190unifdef-y += dlm.h
191unifdef-y += dlm_plock.h
193unifdef-y += edd.h 192unifdef-y += edd.h
194unifdef-y += elf.h 193unifdef-y += elf.h
195unifdef-y += elfcore.h 194unifdef-y += elfcore.h
@@ -236,6 +235,7 @@ unifdef-y += if_vlan.h
236unifdef-y += igmp.h 235unifdef-y += igmp.h
237unifdef-y += inet_diag.h 236unifdef-y += inet_diag.h
238unifdef-y += in.h 237unifdef-y += in.h
238unifdef-y += in6.h
239unifdef-y += inotify.h 239unifdef-y += inotify.h
240unifdef-y += input.h 240unifdef-y += input.h
241unifdef-y += ip.h 241unifdef-y += ip.h
diff --git a/include/linux/atm.h b/include/linux/atm.h
index 60136684e0af..c791ddd96939 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -16,14 +16,11 @@
16 * documentation. Do not change them. 16 * documentation. Do not change them.
17 */ 17 */
18 18
19#ifdef __KERNEL__
20#include <linux/socket.h>
21#include <linux/types.h>
22#endif
23#include <linux/compiler.h> 19#include <linux/compiler.h>
24#include <linux/atmapi.h> 20#include <linux/atmapi.h>
25#include <linux/atmsap.h> 21#include <linux/atmsap.h>
26#include <linux/atmioc.h> 22#include <linux/atmioc.h>
23#include <linux/types.h>
27 24
28 25
29/* general ATM constants */ 26/* general ATM constants */
@@ -212,7 +209,7 @@ struct sockaddr_atmsvc {
212 char pub[ATM_E164_LEN+1]; /* public address (E.164) */ 209 char pub[ATM_E164_LEN+1]; /* public address (E.164) */
213 /* unused addresses must be bzero'ed */ 210 /* unused addresses must be bzero'ed */
214 char lij_type; /* role in LIJ call; one of ATM_LIJ* */ 211 char lij_type; /* role in LIJ call; one of ATM_LIJ* */
215 uint32_t lij_id; /* LIJ call identifier */ 212 __u32 lij_id; /* LIJ call identifier */
216 } sas_addr __ATM_API_ALIGN; /* SVC address */ 213 } sas_addr __ATM_API_ALIGN; /* SVC address */
217}; 214};
218 215
diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h
index 18787f9b2f19..375638f8554b 100644
--- a/include/linux/atm_tcp.h
+++ b/include/linux/atm_tcp.h
@@ -8,11 +8,9 @@
8#define LINUX_ATM_TCP_H 8#define LINUX_ATM_TCP_H
9 9
10#include <linux/atmapi.h> 10#include <linux/atmapi.h>
11 11#include <linux/atm.h>
12#ifdef __KERNEL__
13#include <linux/types.h>
14#endif
15#include <linux/atmioc.h> 12#include <linux/atmioc.h>
13#include <linux/types.h>
16 14
17 15
18/* 16/*
@@ -20,9 +18,9 @@
20 */ 18 */
21 19
22struct atmtcp_hdr { 20struct atmtcp_hdr {
23 uint16_t vpi; 21 __u16 vpi;
24 uint16_t vci; 22 __u16 vci;
25 uint32_t length; /* ... of data part */ 23 __u32 length; /* ... of data part */
26}; 24};
27 25
28/* 26/*
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b512e48f6d8e..ee0ed48e8348 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -99,6 +99,7 @@ extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
99extern void compute_creds(struct linux_binprm *binprm); 99extern void compute_creds(struct linux_binprm *binprm);
100extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 100extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
101extern int set_binfmt(struct linux_binfmt *new); 101extern int set_binfmt(struct linux_binfmt *new);
102extern void free_bprm(struct linux_binprm *);
102 103
103#endif /* __KERNEL__ */ 104#endif /* __KERNEL__ */
104#endif /* _LINUX_BINFMTS_H */ 105#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 43b406def35f..1abfe664c444 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -110,7 +110,6 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
110 110
111extern int bitmap_scnprintf(char *buf, unsigned int len, 111extern int bitmap_scnprintf(char *buf, unsigned int len,
112 const unsigned long *src, int nbits); 112 const unsigned long *src, int nbits);
113extern int bitmap_scnprintf_len(unsigned int len);
114extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 113extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
115 unsigned long *dst, int nbits); 114 unsigned long *dst, int nbits);
116extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, 115extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h
index 05e540d6963a..7ffe03f4693d 100644
--- a/include/linux/bitrev.h
+++ b/include/linux/bitrev.h
@@ -10,6 +10,7 @@ static inline u8 bitrev8(u8 byte)
10 return byte_rev_table[byte]; 10 return byte_rev_table[byte];
11} 11}
12 12
13extern u16 bitrev16(u16 in);
13extern u32 bitrev32(u32 in); 14extern u32 bitrev32(u32 in);
14 15
15#endif /* _LINUX_BITREV_H */ 16#endif /* _LINUX_BITREV_H */
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index cfc3147e5cf9..e3ef903aae88 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -55,6 +55,7 @@ enum blktrace_act {
55enum blktrace_notify { 55enum blktrace_notify {
56 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ 56 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */
57 __BLK_TN_TIMESTAMP, /* include system clock */ 57 __BLK_TN_TIMESTAMP, /* include system clock */
58 __BLK_TN_MESSAGE, /* Character string message */
58}; 59};
59 60
60 61
@@ -79,6 +80,7 @@ enum blktrace_notify {
79 80
80#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) 81#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
81#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) 82#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
83#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
82 84
83#define BLK_IO_TRACE_MAGIC 0x65617400 85#define BLK_IO_TRACE_MAGIC 0x65617400
84#define BLK_IO_TRACE_VERSION 0x07 86#define BLK_IO_TRACE_VERSION 0x07
@@ -119,6 +121,7 @@ struct blk_trace {
119 int trace_state; 121 int trace_state;
120 struct rchan *rchan; 122 struct rchan *rchan;
121 unsigned long *sequence; 123 unsigned long *sequence;
124 unsigned char *msg_data;
122 u16 act_mask; 125 u16 act_mask;
123 u64 start_lba; 126 u64 start_lba;
124 u64 end_lba; 127 u64 end_lba;
@@ -149,7 +152,28 @@ extern void blk_trace_shutdown(struct request_queue *);
149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 152extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
150extern int do_blk_trace_setup(struct request_queue *q, 153extern int do_blk_trace_setup(struct request_queue *q,
151 char *name, dev_t dev, struct blk_user_trace_setup *buts); 154 char *name, dev_t dev, struct blk_user_trace_setup *buts);
155extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
152 156
157/**
158 * blk_add_trace_msg - Add a (simple) message to the blktrace stream
159 * @q: queue the io is for
160 * @fmt: format to print message in
161 * args... Variable argument list for format
162 *
163 * Description:
164 * Records a (simple) message onto the blktrace stream.
165 *
166 * NOTE: BLK_TN_MAX_MSG characters are output at most.
167 * NOTE: Can not use 'static inline' due to presence of var args...
168 *
169 **/
170#define blk_add_trace_msg(q, fmt, ...) \
171 do { \
172 struct blk_trace *bt = (q)->blk_trace; \
173 if (unlikely(bt)) \
174 __trace_note_message(bt, fmt, ##__VA_ARGS__); \
175 } while (0)
176#define BLK_TN_MAX_MSG 128
153 177
154/** 178/**
155 * blk_add_trace_rq - Add a trace for a request oriented action 179 * blk_add_trace_rq - Add a trace for a request oriented action
@@ -299,6 +323,8 @@ extern int blk_trace_remove(struct request_queue *q);
299#define blk_trace_setup(q, name, dev, arg) (-ENOTTY) 323#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
300#define blk_trace_startstop(q, start) (-ENOTTY) 324#define blk_trace_startstop(q, start) (-ENOTTY)
301#define blk_trace_remove(q) (-ENOTTY) 325#define blk_trace_remove(q) (-ENOTTY)
326#define blk_add_trace_msg(q, fmt, ...) do { } while (0)
327
302#endif /* CONFIG_BLK_DEV_IO_TRACE */ 328#endif /* CONFIG_BLK_DEV_IO_TRACE */
303#endif /* __KERNEL__ */ 329#endif /* __KERNEL__ */
304#endif 330#endif
diff --git a/include/linux/capability.h b/include/linux/capability.h
index f4ea0dd9a618..fa830f8de032 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -31,11 +31,11 @@ struct task_struct;
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330 31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1 32#define _LINUX_CAPABILITY_U32S_1 1
33 33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
35#define _LINUX_CAPABILITY_U32S_2 2 35#define _LINUX_CAPABILITY_U32S_2 2
36 36
37#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_2 37#define _LINUX_CAPABILITY_VERSION_3 0x20080522
38#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_2 38#define _LINUX_CAPABILITY_U32S_3 2
39 39
40typedef struct __user_cap_header_struct { 40typedef struct __user_cap_header_struct {
41 __u32 version; 41 __u32 version;
@@ -77,10 +77,23 @@ struct vfs_cap_data {
77 } data[VFS_CAP_U32]; 77 } data[VFS_CAP_U32];
78}; 78};
79 79
80#ifdef __KERNEL__ 80#ifndef __KERNEL__
81
82/*
83 * Backwardly compatible definition for source code - trapped in a
84 * 32-bit world. If you find you need this, please consider using
85 * libcap to untrap yourself...
86 */
87#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
88#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
89
90#else
91
92#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
93#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3
81 94
82typedef struct kernel_cap_struct { 95typedef struct kernel_cap_struct {
83 __u32 cap[_LINUX_CAPABILITY_U32S]; 96 __u32 cap[_KERNEL_CAPABILITY_U32S];
84} kernel_cap_t; 97} kernel_cap_t;
85 98
86#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 99#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
@@ -351,7 +364,7 @@ typedef struct kernel_cap_struct {
351 */ 364 */
352 365
353#define CAP_FOR_EACH_U32(__capi) \ 366#define CAP_FOR_EACH_U32(__capi) \
354 for (__capi = 0; __capi < _LINUX_CAPABILITY_U32S; ++__capi) 367 for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi)
355 368
356# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \ 369# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \
357 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \ 370 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \
@@ -361,7 +374,7 @@ typedef struct kernel_cap_struct {
361 374
362# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE)) 375# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE))
363 376
364#if _LINUX_CAPABILITY_U32S != 2 377#if _KERNEL_CAPABILITY_U32S != 2
365# error Fix up hand-coded capability macro initializers 378# error Fix up hand-coded capability macro initializers
366#else /* HAND-CODED capability initializers */ 379#else /* HAND-CODED capability initializers */
367 380
@@ -372,7 +385,7 @@ typedef struct kernel_cap_struct {
372# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ 385# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
373 CAP_FS_MASK_B1 } }) 386 CAP_FS_MASK_B1 } })
374 387
375#endif /* _LINUX_CAPABILITY_U32S != 2 */ 388#endif /* _KERNEL_CAPABILITY_U32S != 2 */
376 389
377#define CAP_INIT_INH_SET CAP_EMPTY_SET 390#define CAP_INIT_INH_SET CAP_EMPTY_SET
378 391
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 51e6b1e520e6..dcf77fa826b5 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -82,6 +82,7 @@ struct cpuidle_state_kobj {
82}; 82};
83 83
84struct cpuidle_device { 84struct cpuidle_device {
85 unsigned int registered:1;
85 unsigned int enabled:1; 86 unsigned int enabled:1;
86 unsigned int cpu; 87 unsigned int cpu;
87 88
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9650806fe2ea..5df3db58fcc6 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -289,13 +289,6 @@ static inline int __cpumask_scnprintf(char *buf, int len,
289 return bitmap_scnprintf(buf, len, srcp->bits, nbits); 289 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
290} 290}
291 291
292#define cpumask_scnprintf_len(len) \
293 __cpumask_scnprintf_len((len))
294static inline int __cpumask_scnprintf_len(int len)
295{
296 return bitmap_scnprintf_len(len);
297}
298
299#define cpumask_parse_user(ubuf, ulen, dst) \ 292#define cpumask_parse_user(ubuf, ulen, dst) \
300 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS) 293 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
301static inline int __cpumask_parse_user(const char __user *buf, int len, 294static inline int __cpumask_parse_user(const char __user *buf, int len,
diff --git a/include/linux/device.h b/include/linux/device.h
index 8c23e3dfe3ac..6a2d04c011bc 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -183,7 +183,6 @@ struct class {
183 struct module *owner; 183 struct module *owner;
184 184
185 struct kset subsys; 185 struct kset subsys;
186 struct list_head children;
187 struct list_head devices; 186 struct list_head devices;
188 struct list_head interfaces; 187 struct list_head interfaces;
189 struct kset class_dirs; 188 struct kset class_dirs;
@@ -386,6 +385,9 @@ static inline const char *dev_name(struct device *dev)
386 return dev->bus_id; 385 return dev->bus_id;
387} 386}
388 387
388extern int dev_set_name(struct device *dev, const char *name, ...)
389 __attribute__((format(printf, 2, 3)));
390
389#ifdef CONFIG_NUMA 391#ifdef CONFIG_NUMA
390static inline int dev_to_node(struct device *dev) 392static inline int dev_to_node(struct device *dev)
391{ 393{
@@ -450,9 +452,21 @@ extern int __must_check device_reprobe(struct device *dev);
450/* 452/*
451 * Easy functions for dynamically creating devices on the fly 453 * Easy functions for dynamically creating devices on the fly
452 */ 454 */
455extern struct device *device_create_vargs(struct class *cls,
456 struct device *parent,
457 dev_t devt,
458 void *drvdata,
459 const char *fmt,
460 va_list vargs);
453extern struct device *device_create(struct class *cls, struct device *parent, 461extern struct device *device_create(struct class *cls, struct device *parent,
454 dev_t devt, const char *fmt, ...) 462 dev_t devt, const char *fmt, ...)
455 __attribute__((format(printf, 4, 5))); 463 __attribute__((format(printf, 4, 5)));
464extern struct device *device_create_drvdata(struct class *cls,
465 struct device *parent,
466 dev_t devt,
467 void *drvdata,
468 const char *fmt, ...)
469 __attribute__((format(printf, 5, 6)));
456extern void device_destroy(struct class *cls, dev_t devt); 470extern void device_destroy(struct class *cls, dev_t devt);
457 471
458/* 472/*
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index a118f3c0b240..4aab6f12cfab 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -93,6 +93,7 @@ struct files_struct *get_files_struct(struct task_struct *);
93void put_files_struct(struct files_struct *fs); 93void put_files_struct(struct files_struct *fs);
94void reset_files_struct(struct files_struct *); 94void reset_files_struct(struct files_struct *);
95int unshare_files(struct files_struct **); 95int unshare_files(struct files_struct **);
96struct files_struct *dup_fd(struct files_struct *, int *);
96 97
97extern struct kmem_cache *files_cachep; 98extern struct kmem_cache *files_cachep;
98 99
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f413085f748e..d490779f18d9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2000,7 +2000,10 @@ extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
2000extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); 2000extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
2001extern void simple_release_fs(struct vfsmount **mount, int *count); 2001extern void simple_release_fs(struct vfsmount **mount, int *count);
2002 2002
2003extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t); 2003extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2004 loff_t *ppos, const void *from, size_t available);
2005extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
2006 const void *from, size_t available);
2004 2007
2005#ifdef CONFIG_MIGRATION 2008#ifdef CONFIG_MIGRATION
2006extern int buffer_migrate_page(struct address_space *, 2009extern int buffer_migrate_page(struct address_space *,
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 5c86f1196c3a..d48282197696 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -109,6 +109,7 @@ struct fuse_file_lock {
109#define FUSE_POSIX_LOCKS (1 << 1) 109#define FUSE_POSIX_LOCKS (1 << 1)
110#define FUSE_FILE_OPS (1 << 2) 110#define FUSE_FILE_OPS (1 << 2)
111#define FUSE_ATOMIC_O_TRUNC (1 << 3) 111#define FUSE_ATOMIC_O_TRUNC (1 << 3)
112#define FUSE_BIG_WRITES (1 << 5)
112 113
113/** 114/**
114 * Release flags 115 * Release flags
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e9874e7fcdf9..ae7aec3cabee 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -525,7 +525,7 @@ struct unixware_disklabel {
525#define ADDPART_FLAG_RAID 1 525#define ADDPART_FLAG_RAID 1
526#define ADDPART_FLAG_WHOLEDISK 2 526#define ADDPART_FLAG_WHOLEDISK 2
527 527
528extern dev_t blk_lookup_devt(const char *name); 528extern dev_t blk_lookup_devt(const char *name, int part);
529extern char *disk_name (struct gendisk *hd, int part, char *buf); 529extern char *disk_name (struct gendisk *hd, int part, char *buf);
530 530
531extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 531extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
@@ -553,7 +553,7 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
553 553
554static inline void printk_all_partitions(void) { } 554static inline void printk_all_partitions(void) { }
555 555
556static inline dev_t blk_lookup_devt(const char *name) 556static inline dev_t blk_lookup_devt(const char *name, int part)
557{ 557{
558 dev_t devt = MKDEV(0, 0); 558 dev_t devt = MKDEV(0, 0);
559 return devt; 559 return devt;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 4987a84078ef..98be6c5762b9 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -8,6 +8,9 @@
8 8
9#else 9#else
10 10
11#include <linux/types.h>
12#include <linux/errno.h>
13
11/* 14/*
12 * Some platforms don't support the GPIO programming interface. 15 * Some platforms don't support the GPIO programming interface.
13 * 16 *
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 4ce3b7a979ba..fe56b86f2c67 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -2,8 +2,6 @@
2#define __HID_H 2#define __HID_H
3 3
4/* 4/*
5 * $Id: hid.h,v 1.24 2001/12/27 10:37:41 vojtech Exp $
6 *
7 * Copyright (c) 1999 Andreas Gal 5 * Copyright (c) 1999 Andreas Gal
8 * Copyright (c) 2000-2001 Vojtech Pavlik 6 * Copyright (c) 2000-2001 Vojtech Pavlik
9 * Copyright (c) 2006-2007 Jiri Kosina 7 * Copyright (c) 2006-2007 Jiri Kosina
@@ -285,6 +283,7 @@ struct hid_item {
285#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 283#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
286#define HID_QUIRK_MICROSOFT_KEYS 0x08000000 284#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
287#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 285#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
286#define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000
288 287
289/* 288/*
290 * Separate quirks for runtime report descriptor fixup 289 * Separate quirks for runtime report descriptor fixup
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index acbdae6d7ae1..a416b904ba90 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -2,8 +2,6 @@
2#define _HIDDEV_H 2#define _HIDDEV_H
3 3
4/* 4/*
5 * $Id: hiddev.h,v 1.2 2001/04/26 11:26:09 vojtech Exp $
6 *
7 * Copyright (c) 1999-2000 Vojtech Pavlik 5 * Copyright (c) 1999-2000 Vojtech Pavlik
8 * 6 *
9 * Sponsored by SuSE 7 * Sponsored by SuSE
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 6716ec808c5e..fb9af6a0fe9c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -155,8 +155,6 @@ struct i2c_driver {
155 * @driver: device's driver, hence pointer to access routines 155 * @driver: device's driver, hence pointer to access routines
156 * @dev: Driver model device node for the slave. 156 * @dev: Driver model device node for the slave.
157 * @irq: indicates the IRQ generated by this device (if any) 157 * @irq: indicates the IRQ generated by this device (if any)
158 * @driver_name: Identifies new-style driver used with this device; also
159 * used as the module name for hotplug/coldplug modprobe support.
160 * @list: list of active/busy clients (DEPRECATED) 158 * @list: list of active/busy clients (DEPRECATED)
161 * @released: used to synchronize client releases & detaches and references 159 * @released: used to synchronize client releases & detaches and references
162 * 160 *
@@ -174,7 +172,6 @@ struct i2c_client {
174 struct i2c_driver *driver; /* and our access routines */ 172 struct i2c_driver *driver; /* and our access routines */
175 struct device dev; /* the device structure */ 173 struct device dev; /* the device structure */
176 int irq; /* irq issued by device (or -1) */ 174 int irq; /* irq issued by device (or -1) */
177 char driver_name[KOBJ_NAME_LEN];
178 struct list_head list; /* DEPRECATED */ 175 struct list_head list; /* DEPRECATED */
179 struct completion released; 176 struct completion released;
180}; 177};
@@ -200,8 +197,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
200 197
201/** 198/**
202 * struct i2c_board_info - template for device creation 199 * struct i2c_board_info - template for device creation
203 * @driver_name: identifies the driver to be bound to the device 200 * @type: chip type, to initialize i2c_client.name
204 * @type: optional chip type information, to initialize i2c_client.name
205 * @flags: to initialize i2c_client.flags 201 * @flags: to initialize i2c_client.flags
206 * @addr: stored in i2c_client.addr 202 * @addr: stored in i2c_client.addr
207 * @platform_data: stored in i2c_client.dev.platform_data 203 * @platform_data: stored in i2c_client.dev.platform_data
@@ -220,7 +216,6 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
220 * with the adapter already known. 216 * with the adapter already known.
221 */ 217 */
222struct i2c_board_info { 218struct i2c_board_info {
223 char driver_name[KOBJ_NAME_LEN];
224 char type[I2C_NAME_SIZE]; 219 char type[I2C_NAME_SIZE];
225 unsigned short flags; 220 unsigned short flags;
226 unsigned short addr; 221 unsigned short addr;
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h
index ba8ea6e16476..0767a2a6b2f1 100644
--- a/include/linux/i2c/pcf857x.h
+++ b/include/linux/i2c/pcf857x.h
@@ -12,8 +12,7 @@
12 * @context: optional parameter passed to setup() and teardown() 12 * @context: optional parameter passed to setup() and teardown()
13 * 13 *
14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip, 14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
15 * the i2c_board_info used with the pcf875x driver must provide the 15 * the i2c_board_info used with the pcf875x driver must provide its
16 * chip "type" ("pcf8574", "pcf8574a", "pcf8575", "pcf8575c") and its
17 * platform_data (pointer to one of these structures) with at least 16 * platform_data (pointer to one of these structures) with at least
18 * the gpio_base value initialized. 17 * the gpio_base value initialized.
19 * 18 *
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b0135b0c3a04..9918772bf274 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -153,7 +153,7 @@ enum { ide_unknown, ide_generic, ide_pci,
153 ide_qd65xx, ide_umc8672, ide_ht6560b, 153 ide_qd65xx, ide_umc8672, ide_ht6560b,
154 ide_rz1000, ide_trm290, 154 ide_rz1000, ide_trm290,
155 ide_cmd646, ide_cy82c693, ide_4drives, 155 ide_cmd646, ide_cy82c693, ide_4drives,
156 ide_pmac, ide_etrax100, ide_acorn, 156 ide_pmac, ide_acorn,
157 ide_au1xxx, ide_palm3710 157 ide_au1xxx, ide_palm3710
158}; 158};
159 159
@@ -965,7 +965,6 @@ typedef struct ide_task_s {
965void ide_tf_dump(const char *, struct ide_taskfile *); 965void ide_tf_dump(const char *, struct ide_taskfile *);
966 966
967extern void SELECT_DRIVE(ide_drive_t *); 967extern void SELECT_DRIVE(ide_drive_t *);
968extern void SELECT_MASK(ide_drive_t *, int);
969 968
970extern int drive_is_ready(ide_drive_t *); 969extern int drive_is_ready(ide_drive_t *);
971 970
@@ -1058,8 +1057,8 @@ enum {
1058 IDE_HFLAG_NO_SET_MODE = (1 << 9), 1057 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1059 /* trust BIOS for programming chipset/device for DMA */ 1058 /* trust BIOS for programming chipset/device for DMA */
1060 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1059 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1061 /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */ 1060 /* host is CS5510/CS5520 */
1062 IDE_HFLAG_VDMA = (1 << 11), 1061 IDE_HFLAG_CS5520 = (1 << 11),
1063 /* ATAPI DMA is unsupported */ 1062 /* ATAPI DMA is unsupported */
1064 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1063 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
1065 /* set if host is a "non-bootable" controller */ 1064 /* set if host is a "non-bootable" controller */
@@ -1070,8 +1069,6 @@ enum {
1070 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1069 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1071 /* host uses MMIO */ 1070 /* host uses MMIO */
1072 IDE_HFLAG_MMIO = (1 << 16), 1071 IDE_HFLAG_MMIO = (1 << 16),
1073 /* host is CS5510/CS5520 */
1074 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1075 /* no LBA48 */ 1072 /* no LBA48 */
1076 IDE_HFLAG_NO_LBA48 = (1 << 17), 1073 IDE_HFLAG_NO_LBA48 = (1 << 17),
1077 /* no LBA48 DMA */ 1074 /* no LBA48 DMA */
@@ -1101,6 +1098,8 @@ enum {
1101 IDE_HFLAG_NO_IO_32BIT = (1 << 30), 1098 IDE_HFLAG_NO_IO_32BIT = (1 << 30),
1102 /* never unmask IRQs */ 1099 /* never unmask IRQs */
1103 IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), 1100 IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31),
1101 /* host uses VDMA (disabled for now) */
1102 IDE_HFLAG_VDMA = 0,
1104}; 1103};
1105 1104
1106#ifdef CONFIG_BLK_DEV_OFFBOARD 1105#ifdef CONFIG_BLK_DEV_OFFBOARD
diff --git a/include/linux/in_route.h b/include/linux/in_route.h
index 61f25c30a2a0..b261b8c915f0 100644
--- a/include/linux/in_route.h
+++ b/include/linux/in_route.h
@@ -10,19 +10,19 @@
10#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC 10#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC
11 11
12#define RTCF_NOTIFY 0x00010000 12#define RTCF_NOTIFY 0x00010000
13#define RTCF_DIRECTDST 0x00020000 13#define RTCF_DIRECTDST 0x00020000 /* unused */
14#define RTCF_REDIRECTED 0x00040000 14#define RTCF_REDIRECTED 0x00040000
15#define RTCF_TPROXY 0x00080000 15#define RTCF_TPROXY 0x00080000 /* unused */
16 16
17#define RTCF_FAST 0x00200000 17#define RTCF_FAST 0x00200000 /* unused */
18#define RTCF_MASQ 0x00400000 18#define RTCF_MASQ 0x00400000 /* unused */
19#define RTCF_SNAT 0x00800000 19#define RTCF_SNAT 0x00800000 /* unused */
20#define RTCF_DOREDIRECT 0x01000000 20#define RTCF_DOREDIRECT 0x01000000
21#define RTCF_DIRECTSRC 0x04000000 21#define RTCF_DIRECTSRC 0x04000000
22#define RTCF_DNAT 0x08000000 22#define RTCF_DNAT 0x08000000
23#define RTCF_BROADCAST 0x10000000 23#define RTCF_BROADCAST 0x10000000
24#define RTCF_MULTICAST 0x20000000 24#define RTCF_MULTICAST 0x20000000
25#define RTCF_REJECT 0x40000000 25#define RTCF_REJECT 0x40000000 /* unused */
26#define RTCF_LOCAL 0x80000000 26#define RTCF_LOCAL 0x80000000
27 27
28#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) 28#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT)
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 7009b0cdd06f..c6f51ad52d5b 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -117,7 +117,6 @@ struct in_ifaddr
117 __be32 ifa_address; 117 __be32 ifa_address;
118 __be32 ifa_mask; 118 __be32 ifa_mask;
119 __be32 ifa_broadcast; 119 __be32 ifa_broadcast;
120 __be32 ifa_anycast;
121 unsigned char ifa_scope; 120 unsigned char ifa_scope;
122 unsigned char ifa_flags; 121 unsigned char ifa_flags;
123 unsigned char ifa_prefixlen; 122 unsigned char ifa_prefixlen;
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index b24c2875aa05..9927a88674a3 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX__INIT_TASK_H 1#ifndef _LINUX__INIT_TASK_H
2#define _LINUX__INIT_TASK_H 2#define _LINUX__INIT_TASK_H
3 3
4#include <linux/fdtable.h>
5#include <linux/rcupdate.h> 4#include <linux/rcupdate.h>
6#include <linux/irqflags.h> 5#include <linux/irqflags.h>
7#include <linux/utsname.h> 6#include <linux/utsname.h>
@@ -12,27 +11,7 @@
12#include <linux/securebits.h> 11#include <linux/securebits.h>
13#include <net/net_namespace.h> 12#include <net/net_namespace.h>
14 13
15#define INIT_FDTABLE \ 14extern struct files_struct init_files;
16{ \
17 .max_fds = NR_OPEN_DEFAULT, \
18 .fd = &init_files.fd_array[0], \
19 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
20 .open_fds = (fd_set *)&init_files.open_fds_init, \
21 .rcu = RCU_HEAD_INIT, \
22 .next = NULL, \
23}
24
25#define INIT_FILES \
26{ \
27 .count = ATOMIC_INIT(1), \
28 .fdt = &init_files.fdtab, \
29 .fdtab = INIT_FDTABLE, \
30 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), \
31 .next_fd = 0, \
32 .close_on_exec_init = { { 0, } }, \
33 .open_fds_init = { { 0, } }, \
34 .fd_array = { NULL, } \
35}
36 15
37#define INIT_KIOCTX(name, which_mm) \ 16#define INIT_KIOCTX(name, which_mm) \
38{ \ 17{ \
diff --git a/include/linux/input.h b/include/linux/input.h
index 28a094fcfe20..e075c4b762fb 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -637,7 +637,9 @@ struct input_absinfo {
637#define SW_LID 0x00 /* set = lid shut */ 637#define SW_LID 0x00 /* set = lid shut */
638#define SW_TABLET_MODE 0x01 /* set = tablet mode */ 638#define SW_TABLET_MODE 0x01 /* set = tablet mode */
639#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ 639#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
640#define SW_RADIO 0x03 /* set = radio enabled */ 640#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
641 set = radio enabled */
642#define SW_RADIO SW_RFKILL_ALL /* deprecated */
641#define SW_MAX 0x0f 643#define SW_MAX 0x0f
642#define SW_CNT (SW_MAX+1) 644#define SW_CNT (SW_MAX+1)
643 645
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index d5d40a9f7929..c6801bffe76d 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -53,14 +53,14 @@ struct resource_list {
53#define IORESOURCE_AUTO 0x40000000 53#define IORESOURCE_AUTO 0x40000000
54#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 54#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
55 55
56/* ISA PnP IRQ specific bits (IORESOURCE_BITS) */ 56/* PnP IRQ specific bits (IORESOURCE_BITS) */
57#define IORESOURCE_IRQ_HIGHEDGE (1<<0) 57#define IORESOURCE_IRQ_HIGHEDGE (1<<0)
58#define IORESOURCE_IRQ_LOWEDGE (1<<1) 58#define IORESOURCE_IRQ_LOWEDGE (1<<1)
59#define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 59#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
60#define IORESOURCE_IRQ_LOWLEVEL (1<<3) 60#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
61#define IORESOURCE_IRQ_SHAREABLE (1<<4) 61#define IORESOURCE_IRQ_SHAREABLE (1<<4)
62 62
63/* ISA PnP DMA specific bits (IORESOURCE_BITS) */ 63/* PnP DMA specific bits (IORESOURCE_BITS) */
64#define IORESOURCE_DMA_TYPE_MASK (3<<0) 64#define IORESOURCE_DMA_TYPE_MASK (3<<0)
65#define IORESOURCE_DMA_8BIT (0<<0) 65#define IORESOURCE_DMA_8BIT (0<<0)
66#define IORESOURCE_DMA_8AND16BIT (1<<0) 66#define IORESOURCE_DMA_8AND16BIT (1<<0)
@@ -76,7 +76,7 @@ struct resource_list {
76#define IORESOURCE_DMA_TYPEB (2<<6) 76#define IORESOURCE_DMA_TYPEB (2<<6)
77#define IORESOURCE_DMA_TYPEF (3<<6) 77#define IORESOURCE_DMA_TYPEF (3<<6)
78 78
79/* ISA PnP memory I/O specific bits (IORESOURCE_BITS) */ 79/* PnP memory I/O specific bits (IORESOURCE_BITS) */
80#define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */ 80#define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */
81#define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */ 81#define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */
82#define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */ 82#define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 10b666b61add..cde056e08181 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -396,8 +396,10 @@ static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *op
396{ 396{
397 struct request_sock *req = reqsk_alloc(ops); 397 struct request_sock *req = reqsk_alloc(ops);
398 398
399 if (req != NULL) 399 if (req != NULL) {
400 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); 400 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
401 inet6_rsk(req)->pktopts = NULL;
402 }
401 403
402 return req; 404 return req;
403} 405}
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 05e2b307161a..d147f0f90360 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -919,6 +919,9 @@ struct journal_s
919 struct proc_dir_entry *j_proc_entry; 919 struct proc_dir_entry *j_proc_entry;
920 struct transaction_stats_s j_stats; 920 struct transaction_stats_s j_stats;
921 921
922 /* Failed journal commit ID */
923 unsigned int j_failed_commit;
924
922 /* 925 /*
923 * An opaque pointer to fs-private information. ext3 puts its 926 * An opaque pointer to fs-private information. ext3 puts its
924 * superblock pointer here 927 * superblock pointer here
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 82de2fb62cb7..00c1801099fa 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -83,16 +83,6 @@ __attribute__((format(printf,1,2)));
83static inline void __check_printsym_format(const char *fmt, ...) 83static inline void __check_printsym_format(const char *fmt, ...)
84{ 84{
85} 85}
86/* ia64 and ppc64 use function descriptors, which contain the real address */
87#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
88#define print_fn_descriptor_symbol(fmt, addr) \
89do { \
90 unsigned long *__faddr = (unsigned long*) addr; \
91 print_symbol(fmt, __faddr[0]); \
92} while (0)
93#else
94#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
95#endif
96 86
97static inline void print_symbol(const char *fmt, unsigned long addr) 87static inline void print_symbol(const char *fmt, unsigned long addr)
98{ 88{
@@ -101,6 +91,20 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
101 __builtin_extract_return_addr((void *)addr)); 91 __builtin_extract_return_addr((void *)addr));
102} 92}
103 93
94/*
95 * Pretty-print a function pointer.
96 *
97 * ia64 and ppc64 function pointers are really function descriptors,
98 * which contain a pointer the real address.
99 */
100static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
101{
102#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
103 addr = *(void **)addr;
104#endif
105 print_symbol(fmt, (unsigned long)addr);
106}
107
104#ifndef CONFIG_64BIT 108#ifndef CONFIG_64BIT
105#define print_ip_sym(ip) \ 109#define print_ip_sym(ip) \
106do { \ 110do { \
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4d46e299afb5..792bf0aa779b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -276,7 +276,17 @@ extern void print_hex_dump(const char *level, const char *prefix_str,
276 const void *buf, size_t len, bool ascii); 276 const void *buf, size_t len, bool ascii);
277extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 277extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
278 const void *buf, size_t len); 278 const void *buf, size_t len);
279#define hex_asc(x) "0123456789abcdef"[x] 279
280extern const char hex_asc[];
281#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
282#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
283
284static inline char *pack_hex_byte(char *buf, u8 byte)
285{
286 *buf++ = hex_asc_hi(byte);
287 *buf++ = hex_asc_lo(byte);
288 return buf;
289}
280 290
281#define pr_emerg(fmt, arg...) \ 291#define pr_emerg(fmt, arg...) \
282 printk(KERN_EMERG fmt, ##arg) 292 printk(KERN_EMERG fmt, ##arg)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 398978972b7a..092b1b25291d 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -297,7 +297,7 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn)
297 return (gpa_t)gfn << PAGE_SHIFT; 297 return (gpa_t)gfn << PAGE_SHIFT;
298} 298}
299 299
300static inline void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) 300static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
301{ 301{
302 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 302 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
303} 303}
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0f17643e0a6e..e57e5d08312d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -111,13 +111,10 @@ enum {
111 /* various global constants */ 111 /* various global constants */
112 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 112 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
113 LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ 113 LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */
114 ATA_MAX_PORTS = 8,
115 ATA_DEF_QUEUE = 1, 114 ATA_DEF_QUEUE = 1,
116 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 115 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
117 ATA_MAX_QUEUE = 32, 116 ATA_MAX_QUEUE = 32,
118 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 117 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
119 ATA_MAX_BUS = 2,
120 ATA_DEF_BUSY_WAIT = 10000,
121 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 118 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
122 119
123 ATAPI_MAX_DRAIN = 16 << 10, 120 ATAPI_MAX_DRAIN = 16 << 10,
@@ -341,7 +338,7 @@ enum {
341 ATA_EH_PMP_TRIES = 5, 338 ATA_EH_PMP_TRIES = 5,
342 ATA_EH_PMP_LINK_TRIES = 3, 339 ATA_EH_PMP_LINK_TRIES = 3,
343 340
344 SATA_PMP_SCR_TIMEOUT = 250, 341 SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */
345 342
346 /* Horkage types. May be set by libata or controller on drives 343 /* Horkage types. May be set by libata or controller on drives
347 (some horkage may be drive/controller pair dependant */ 344 (some horkage may be drive/controller pair dependant */
@@ -351,7 +348,7 @@ enum {
351 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 348 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
352 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ 349 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
353 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */ 350 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
354 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */ 351 ATA_HORKAGE_DISABLE = (1 << 5), /* Disable it */
355 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */ 352 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
356 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */ 353 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
357 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ 354 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */
@@ -821,8 +818,6 @@ struct ata_timing {
821 unsigned short udma; /* t2CYCTYP/2 */ 818 unsigned short udma; /* t2CYCTYP/2 */
822}; 819};
823 820
824#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
825
826/* 821/*
827 * Core layer - drivers/ata/libata-core.c 822 * Core layer - drivers/ata/libata-core.c
828 */ 823 */
@@ -1437,7 +1432,8 @@ extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1437extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); 1432extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1438extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); 1433extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1439extern u8 ata_sff_check_status(struct ata_port *ap); 1434extern u8 ata_sff_check_status(struct ata_port *ap);
1440extern u8 ata_sff_altstatus(struct ata_port *ap); 1435extern void ata_sff_pause(struct ata_port *ap);
1436extern void ata_sff_dma_pause(struct ata_port *ap);
1441extern int ata_sff_busy_sleep(struct ata_port *ap, 1437extern int ata_sff_busy_sleep(struct ata_port *ap,
1442 unsigned long timeout_pat, unsigned long timeout); 1438 unsigned long timeout_pat, unsigned long timeout);
1443extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); 1439extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline);
@@ -1498,19 +1494,6 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1498#endif /* CONFIG_PCI */ 1494#endif /* CONFIG_PCI */
1499 1495
1500/** 1496/**
1501 * ata_sff_pause - Flush writes and pause 400 nanoseconds.
1502 * @ap: Port to wait for.
1503 *
1504 * LOCKING:
1505 * Inherited from caller.
1506 */
1507static inline void ata_sff_pause(struct ata_port *ap)
1508{
1509 ata_sff_altstatus(ap);
1510 ndelay(400);
1511}
1512
1513/**
1514 * ata_sff_busy_wait - Wait for a port status register 1497 * ata_sff_busy_wait - Wait for a port status register
1515 * @ap: Port to wait for. 1498 * @ap: Port to wait for.
1516 * @bits: bits that must be clear 1499 * @bits: bits that must be clear
diff --git a/include/linux/math64.h b/include/linux/math64.h
index c1a5f81501ff..c87f1528703a 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -81,4 +81,25 @@ static inline s64 div_s64(s64 dividend, s32 divisor)
81} 81}
82#endif 82#endif
83 83
84u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);
85
86static __always_inline u32
87__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
88{
89 u32 ret = 0;
90
91 while (dividend >= divisor) {
92 /* The following asm() prevents the compiler from
93 optimising this loop into a modulo operation. */
94 asm("" : "+rm"(dividend));
95
96 dividend -= divisor;
97 ret++;
98 }
99
100 *remainder = dividend;
101
102 return ret;
103}
104
84#endif /* _LINUX_MATH64_H */ 105#endif /* _LINUX_MATH64_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 73e358612eaf..ea9f5ad9ec8e 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -77,14 +77,6 @@ extern int __add_pages(struct zone *zone, unsigned long start_pfn,
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn, 77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages); 78 unsigned long nr_pages);
79 79
80/*
81 * Walk through all memory which is registered as resource.
82 * arg is (start_pfn, nr_pages, private_arg_pointer)
83 */
84extern int walk_memory_resource(unsigned long start_pfn,
85 unsigned long nr_pages, void *arg,
86 int (*func)(unsigned long, unsigned long, void *));
87
88#ifdef CONFIG_NUMA 80#ifdef CONFIG_NUMA
89extern int memory_add_physaddr_to_nid(u64 start); 81extern int memory_add_physaddr_to_nid(u64 start);
90#else 82#else
@@ -199,6 +191,14 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
199 191
200#endif /* ! CONFIG_MEMORY_HOTPLUG */ 192#endif /* ! CONFIG_MEMORY_HOTPLUG */
201 193
194/*
195 * Walk through all memory which is registered as resource.
196 * arg is (start_pfn, nr_pages, private_arg_pointer)
197 */
198extern int walk_memory_resource(unsigned long start_pfn,
199 unsigned long nr_pages, void *arg,
200 int (*func)(unsigned long, unsigned long, void *));
201
202extern int add_memory(int nid, u64 start, u64 size); 202extern int add_memory(int nid, u64 start, u64 size);
203extern int arch_add_memory(int nid, u64 start, u64 size); 203extern int arch_add_memory(int nid, u64 start, u64 size);
204extern int remove_memory(u64 start, u64 size); 204extern int remove_memory(u64 start, u64 size);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c31a9cd2a30e..586a943cab01 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -760,16 +760,17 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
760 * (see walk_page_range for more details) 760 * (see walk_page_range for more details)
761 */ 761 */
762struct mm_walk { 762struct mm_walk {
763 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, void *); 763 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *);
764 int (*pud_entry)(pud_t *, unsigned long, unsigned long, void *); 764 int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *);
765 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, void *); 765 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
766 int (*pte_entry)(pte_t *, unsigned long, unsigned long, void *); 766 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
767 int (*pte_hole)(unsigned long, unsigned long, void *); 767 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
768 struct mm_struct *mm;
769 void *private;
768}; 770};
769 771
770int walk_page_range(const struct mm_struct *, unsigned long addr, 772int walk_page_range(unsigned long addr, unsigned long end,
771 unsigned long end, const struct mm_walk *walk, 773 struct mm_walk *walk);
772 void *private);
773void free_pgd_range(struct mmu_gather **tlb, unsigned long addr, 774void free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
774 unsigned long end, unsigned long floor, unsigned long ceiling); 775 unsigned long end, unsigned long floor, unsigned long ceiling);
775void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma, 776void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index eb7c16cc9559..02a27ae78539 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -226,8 +226,17 @@ struct mm_struct {
226 rwlock_t ioctx_list_lock; /* aio lock */ 226 rwlock_t ioctx_list_lock; /* aio lock */
227 struct kioctx *ioctx_list; 227 struct kioctx *ioctx_list;
228#ifdef CONFIG_MM_OWNER 228#ifdef CONFIG_MM_OWNER
229 struct task_struct *owner; /* The thread group leader that */ 229 /*
230 /* owns the mm_struct. */ 230 * "owner" points to a task that is regarded as the canonical
231 * user/owner of this mm. All of the following must be true in
232 * order for it to be changed:
233 *
234 * current == mm->owner
235 * current->mm != mm
236 * new_owner->mm == mm
237 * new_owner->alloc_lock is held
238 */
239 struct task_struct *owner;
231#endif 240#endif
232 241
233#ifdef CONFIG_PROC_FS 242#ifdef CONFIG_PROC_FS
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 87920a0852a3..dab8892e6ff1 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -17,14 +17,14 @@
17 17
18extern int sysctl_overcommit_memory; 18extern int sysctl_overcommit_memory;
19extern int sysctl_overcommit_ratio; 19extern int sysctl_overcommit_ratio;
20extern atomic_t vm_committed_space; 20extern atomic_long_t vm_committed_space;
21 21
22#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
23extern void vm_acct_memory(long pages); 23extern void vm_acct_memory(long pages);
24#else 24#else
25static inline void vm_acct_memory(long pages) 25static inline void vm_acct_memory(long pages)
26{ 26{
27 atomic_add(pages, &vm_committed_space); 27 atomic_long_add(pages, &vm_committed_space);
28} 28}
29#endif 29#endif
30 30
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index c463cd8a15a4..443bc7cd8c62 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -703,7 +703,7 @@ extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
703extern struct zone *next_zone(struct zone *zone); 703extern struct zone *next_zone(struct zone *zone);
704 704
705/** 705/**
706 * for_each_pgdat - helper macro to iterate over all nodes 706 * for_each_online_pgdat - helper macro to iterate over all online nodes
707 * @pgdat - pointer to a pg_data_t variable 707 * @pgdat - pointer to a pg_data_t variable
708 */ 708 */
709#define for_each_online_pgdat(pgdat) \ 709#define for_each_online_pgdat(pgdat) \
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d73eceaa7afb..69b2342d5ebb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -375,7 +375,8 @@ struct virtio_device_id {
375 375
376struct i2c_device_id { 376struct i2c_device_id {
377 char name[I2C_NAME_SIZE]; 377 char name[I2C_NAME_SIZE];
378 kernel_ulong_t driver_data; /* Data private to the driver */ 378 kernel_ulong_t driver_data /* Data private to the driver */
379 __attribute__((aligned(sizeof(kernel_ulong_t))));
379}; 380};
380 381
381 382
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index b03b27457413..81cd36b735b0 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -57,12 +57,6 @@
57#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ 57#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
59 59
60/* media of boot sector */
61static inline int fat_valid_media(u8 media)
62{
63 return 0xf8 <= media || media == 0xf0;
64}
65
66#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ 60#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
67 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) 61 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
68 62
@@ -334,6 +328,12 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
334#endif 328#endif
335} 329}
336 330
331/* media of boot sector */
332static inline int fat_valid_media(u8 media)
333{
334 return 0xf8 <= media || media == 0xf0;
335}
336
337/* fat/cache.c */ 337/* fat/cache.c */
338extern void fat_cache_inval_inode(struct inode *inode); 338extern void fat_cache_inval_inode(struct inode *inode);
339extern int fat_get_cluster(struct inode *inode, int cluster, 339extern int fat_get_cluster(struct inode *inode, int cluster,
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 6f3b8e79a991..56abf1558fdd 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -64,11 +64,11 @@ struct msginfo {
64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ 64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
65 65
66/* unused */ 66/* unused */
67#define MSGPOOL (MSGMNI * MSGMNB) /* size in bytes of message pool */ 67#define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */
68#define MSGTQL MSGMNB /* number of system message headers */ 68#define MSGTQL MSGMNB /* number of system message headers */
69#define MSGMAP MSGMNB /* number of entries in message map */ 69#define MSGMAP MSGMNB /* number of entries in message map */
70#define MSGSSZ 16 /* message segment size */ 70#define MSGSSZ 16 /* message segment size */
71#define __MSGSEG (MSGPOOL / MSGSSZ) /* max no. of segments */ 71#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */
72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) 72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
73 73
74#ifdef __KERNEL__ 74#ifdef __KERNEL__
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c42bc7f533a5..53ea3dc8b0e8 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/linux/mtd/nand.h 2 * linux/include/linux/mtd/nand.h
3 * 3 *
4 * Copyright (c) 2000 David Woodhouse <dwmw2@mvhi.com> 4 * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org>
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7c1d4466583b..f27fd2009334 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -93,14 +93,16 @@ struct wireless_dev;
93 * used. 93 * used.
94 */ 94 */
95 95
96#if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR) 96#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
97#define LL_MAX_HEADER 32 97# if defined(CONFIG_MAC80211_MESH)
98# define LL_MAX_HEADER 128
99# else
100# define LL_MAX_HEADER 96
101# endif
102#elif defined(CONFIG_TR)
103# define LL_MAX_HEADER 48
98#else 104#else
99#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 105# define LL_MAX_HEADER 32
100#define LL_MAX_HEADER 96
101#else
102#define LL_MAX_HEADER 48
103#endif
104#endif 106#endif
105 107
106#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \ 108#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
@@ -244,11 +246,16 @@ struct hh_cache
244 * 246 *
245 * We could use other alignment values, but we must maintain the 247 * We could use other alignment values, but we must maintain the
246 * relationship HH alignment <= LL alignment. 248 * relationship HH alignment <= LL alignment.
249 *
250 * LL_ALLOCATED_SPACE also takes into account the tailroom the device
251 * may need.
247 */ 252 */
248#define LL_RESERVED_SPACE(dev) \ 253#define LL_RESERVED_SPACE(dev) \
249 (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 254 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
250#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 255#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
251 ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 256 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
257#define LL_ALLOCATED_SPACE(dev) \
258 ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
252 259
253struct header_ops { 260struct header_ops {
254 int (*create) (struct sk_buff *skb, struct net_device *dev, 261 int (*create) (struct sk_buff *skb, struct net_device *dev,
@@ -567,6 +574,13 @@ struct net_device
567 unsigned short type; /* interface hardware type */ 574 unsigned short type; /* interface hardware type */
568 unsigned short hard_header_len; /* hardware hdr length */ 575 unsigned short hard_header_len; /* hardware hdr length */
569 576
577 /* extra head- and tailroom the hardware may need, but not in all cases
578 * can this be guaranteed, especially tailroom. Some cases also use
579 * LL_MAX_HEADER instead to allocate the skb.
580 */
581 unsigned short needed_headroom;
582 unsigned short needed_tailroom;
583
570 struct net_device *master; /* Pointer to master device of a group, 584 struct net_device *master; /* Pointer to master device of a group,
571 * which this device is member of. 585 * which this device is member of.
572 */ 586 */
@@ -715,6 +729,9 @@ struct net_device
715 struct net *nd_net; 729 struct net *nd_net;
716#endif 730#endif
717 731
732 /* mid-layer private */
733 void *ml_priv;
734
718 /* bridge stuff */ 735 /* bridge stuff */
719 struct net_bridge_port *br_port; 736 struct net_bridge_port *br_port;
720 /* macvlan */ 737 /* macvlan */
@@ -728,6 +745,9 @@ struct net_device
728 /* rtnetlink link ops */ 745 /* rtnetlink link ops */
729 const struct rtnl_link_ops *rtnl_link_ops; 746 const struct rtnl_link_ops *rtnl_link_ops;
730 747
748 /* VLAN feature mask */
749 unsigned long vlan_features;
750
731 /* for setting kernel sock attribute on TCP connection setup */ 751 /* for setting kernel sock attribute on TCP connection setup */
732#define GSO_MAX_SIZE 65536 752#define GSO_MAX_SIZE 65536
733 unsigned int gso_max_size; 753 unsigned int gso_max_size;
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index e4c66593b5c6..0c5eb7ed8b3f 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -3,7 +3,6 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/types.h>
7#include <linux/skbuff.h> 6#include <linux/skbuff.h>
8#include <linux/net.h> 7#include <linux/net.h>
9#include <linux/netdevice.h> 8#include <linux/netdevice.h>
@@ -14,6 +13,7 @@
14#include <linux/list.h> 13#include <linux/list.h>
15#include <net/net_namespace.h> 14#include <net/net_namespace.h>
16#endif 15#endif
16#include <linux/types.h>
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18 18
19/* Responses from hook functions. */ 19/* Responses from hook functions. */
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index dd9c97f2d436..590ac3d6d5d6 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -11,11 +11,11 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <linux/if.h> 13#include <linux/if.h>
14#include <linux/types.h>
15#include <linux/in.h> 14#include <linux/in.h>
16#include <linux/if_arp.h> 15#include <linux/if_arp.h>
17#include <linux/skbuff.h> 16#include <linux/skbuff.h>
18#endif 17#endif
18#include <linux/types.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/netfilter_arp.h> 20#include <linux/netfilter_arp.h>
21 21
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index bfc889f90276..092bd50581a9 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -17,11 +17,11 @@
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19#include <linux/if.h> 19#include <linux/if.h>
20#include <linux/types.h>
21#include <linux/in.h> 20#include <linux/in.h>
22#include <linux/ip.h> 21#include <linux/ip.h>
23#include <linux/skbuff.h> 22#include <linux/skbuff.h>
24#endif 23#endif
24#include <linux/types.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv4.h> 26#include <linux/netfilter_ipv4.h>
27 27
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index f2507dcc5750..1089e33cf633 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -17,11 +17,11 @@
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19#include <linux/if.h> 19#include <linux/if.h>
20#include <linux/types.h>
21#include <linux/in6.h> 20#include <linux/in6.h>
22#include <linux/ipv6.h> 21#include <linux/ipv6.h>
23#include <linux/skbuff.h> 22#include <linux/skbuff.h>
24#endif 23#endif
24#include <linux/types.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv6.h> 26#include <linux/netfilter_ipv6.h>
27 27
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 590cff32415d..f31debfac926 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -306,5 +306,29 @@ static inline void __ClearPageTail(struct page *page)
306} 306}
307 307
308#endif /* !PAGEFLAGS_EXTENDED */ 308#endif /* !PAGEFLAGS_EXTENDED */
309
310#define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
311 1 << PG_buddy | 1 << PG_writeback | \
312 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active)
313
314/*
315 * Flags checked in bad_page(). Pages on the free list should not have
316 * these flags set. It they are, there is a problem.
317 */
318#define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | 1 << PG_reclaim | 1 << PG_dirty)
319
320/*
321 * Flags checked when a page is freed. Pages being freed should not have
322 * these flags set. It they are, there is a problem.
323 */
324#define PAGE_FLAGS_CHECK_AT_FREE (PAGE_FLAGS | 1 << PG_reserved)
325
326/*
327 * Flags checked when a page is prepped for return by the page allocator.
328 * Pages being prepped should not have these flags set. It they are, there
329 * is a problem.
330 */
331#define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | 1 << PG_reserved | 1 << PG_dirty)
332
309#endif /* !__GENERATING_BOUNDS_H */ 333#endif /* !__GENERATING_BOUNDS_H */
310#endif /* PAGE_FLAGS_H */ 334#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/parser.h b/include/linux/parser.h
index 26b2bdfcaf06..7dcd05075756 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -29,5 +29,5 @@ int match_token(char *, match_table_t table, substring_t args[]);
29int match_int(substring_t *, int *result); 29int match_int(substring_t *, int *result);
30int match_octal(substring_t *, int *result); 30int match_octal(substring_t *, int *result);
31int match_hex(substring_t *, int *result); 31int match_hex(substring_t *, int *result);
32void match_strcpy(char *, const substring_t *); 32size_t match_strlcpy(char *, const substring_t *, size_t);
33char *match_strdup(const substring_t *); 33char *match_strdup(const substring_t *);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 509159bcd4e7..d18b1dd49fab 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -206,6 +206,7 @@ struct pci_dev {
206 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 206 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
207 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 207 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
208 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 208 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
209 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
209#ifdef CONFIG_PCI_MSI 210#ifdef CONFIG_PCI_MSI
210 struct list_head msi_list; 211 struct list_head msi_list;
211#endif 212#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cf6dbd759395..eafc9d6d2b35 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -716,6 +716,7 @@
716#define PCI_DEVICE_ID_HP_CISSA 0x3220 716#define PCI_DEVICE_ID_HP_CISSA 0x3220
717#define PCI_DEVICE_ID_HP_CISSC 0x3230 717#define PCI_DEVICE_ID_HP_CISSC 0x3230
718#define PCI_DEVICE_ID_HP_CISSD 0x3238 718#define PCI_DEVICE_ID_HP_CISSD 0x3238
719#define PCI_DEVICE_ID_HP_CISSE 0x323a
719#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 720#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
720 721
721#define PCI_VENDOR_ID_PCTECH 0x1042 722#define PCI_VENDOR_ID_PCTECH 0x1042
@@ -1761,6 +1762,7 @@
1761 1762
1762#define PCI_VENDOR_ID_INTASHIELD 0x135a 1763#define PCI_VENDOR_ID_INTASHIELD 0x135a
1763#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80 1764#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80
1765#define PCI_DEVICE_ID_INTASHIELD_IS400 0x0dc0
1764 1766
1765#define PCI_VENDOR_ID_QUATECH 0x135C 1767#define PCI_VENDOR_ID_QUATECH 0x135C
1766#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 1768#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
@@ -2383,6 +2385,9 @@
2383#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2385#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2384#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2386#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2385#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2387#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2388#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030
2389#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035
2390#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036
2386#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2391#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2387#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2392#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
2388#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 2393#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index d746a2abb322..4cdd393e71e1 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -13,8 +13,14 @@
13 __attribute__((__section__(".data.percpu"))) \ 13 __attribute__((__section__(".data.percpu"))) \
14 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name 14 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
15 15
16#ifdef MODULE
17#define SHARED_ALIGNED_SECTION ".data.percpu"
18#else
19#define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned"
20#endif
21
16#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ 22#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
17 __attribute__((__section__(".data.percpu.shared_aligned"))) \ 23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \
18 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ 24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
19 ____cacheline_aligned_in_smp 25 ____cacheline_aligned_in_smp
20#else 26#else
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9883bc942262..fff1d27ddb4c 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -9,6 +9,8 @@
9 9
10struct net; 10struct net;
11struct completion; 11struct completion;
12struct mm_struct;
13
12/* 14/*
13 * The proc filesystem constants/structures 15 * The proc filesystem constants/structures
14 */ 16 */
@@ -101,8 +103,6 @@ extern spinlock_t proc_subdir_lock;
101extern void proc_root_init(void); 103extern void proc_root_init(void);
102extern void proc_misc_init(void); 104extern void proc_misc_init(void);
103 105
104struct mm_struct;
105
106void proc_flush_task(struct task_struct *task); 106void proc_flush_task(struct task_struct *task);
107struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 107struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
108int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 108int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 47fbcba11850..78bfdea24a8e 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -262,7 +262,6 @@ int bitmap_create(mddev_t *mddev);
262void bitmap_flush(mddev_t *mddev); 262void bitmap_flush(mddev_t *mddev);
263void bitmap_destroy(mddev_t *mddev); 263void bitmap_destroy(mddev_t *mddev);
264 264
265char *file_path(struct file *file, char *buf, int count);
266void bitmap_print_sb(struct bitmap *bitmap); 265void bitmap_print_sb(struct bitmap *bitmap);
267void bitmap_update_sb(struct bitmap *bitmap); 266void bitmap_update_sb(struct bitmap *bitmap);
268 267
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 81a1a02d4566..b7386ae9d288 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -72,6 +72,8 @@
72 */ 72 */
73#define MD_PATCHLEVEL_VERSION 3 73#define MD_PATCHLEVEL_VERSION 3
74 74
75extern int mdp_major;
76
75extern int register_md_personality (struct mdk_personality *p); 77extern int register_md_personality (struct mdk_personality *p);
76extern int unregister_md_personality (struct mdk_personality *p); 78extern int unregister_md_personality (struct mdk_personality *p);
77extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 79extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 812ffa590cff..3dea9f545c8f 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -180,13 +180,15 @@ struct mddev_s
180 int sync_speed_min; 180 int sync_speed_min;
181 int sync_speed_max; 181 int sync_speed_max;
182 182
183 /* resync even though the same disks are shared among md-devices */
184 int parallel_resync;
185
183 int ok_start_degraded; 186 int ok_start_degraded;
184 /* recovery/resync flags 187 /* recovery/resync flags
185 * NEEDED: we might need to start a resync/recover 188 * NEEDED: we might need to start a resync/recover
186 * RUNNING: a thread is running, or about to be started 189 * RUNNING: a thread is running, or about to be started
187 * SYNC: actually doing a resync, not a recovery 190 * SYNC: actually doing a resync, not a recovery
188 * ERR: and IO error was detected - abort the resync/recovery 191 * INTR: resync needs to be aborted for some reason
189 * INTR: someone requested a (clean) early abort.
190 * DONE: thread is done and is waiting to be reaped 192 * DONE: thread is done and is waiting to be reaped
191 * REQUEST: user-space has requested a sync (used with SYNC) 193 * REQUEST: user-space has requested a sync (used with SYNC)
192 * CHECK: user-space request for for check-only, no repair 194 * CHECK: user-space request for for check-only, no repair
@@ -196,7 +198,6 @@ struct mddev_s
196 */ 198 */
197#define MD_RECOVERY_RUNNING 0 199#define MD_RECOVERY_RUNNING 0
198#define MD_RECOVERY_SYNC 1 200#define MD_RECOVERY_SYNC 1
199#define MD_RECOVERY_ERR 2
200#define MD_RECOVERY_INTR 3 201#define MD_RECOVERY_INTR 3
201#define MD_RECOVERY_DONE 4 202#define MD_RECOVERY_DONE 4
202#define MD_RECOVERY_NEEDED 5 203#define MD_RECOVERY_NEEDED 5
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 44c81c744538..b358c704d102 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -246,6 +246,7 @@ enum rt_class_t
246{ 246{
247 RT_TABLE_UNSPEC=0, 247 RT_TABLE_UNSPEC=0,
248/* User defined values */ 248/* User defined values */
249 RT_TABLE_COMPAT=252,
249 RT_TABLE_DEFAULT=253, 250 RT_TABLE_DEFAULT=253,
250 RT_TABLE_MAIN=254, 251 RT_TABLE_MAIN=254,
251 RT_TABLE_LOCAL=255, 252 RT_TABLE_LOCAL=255,
@@ -267,10 +268,10 @@ enum rtattr_type_t
267 RTA_PREFSRC, 268 RTA_PREFSRC,
268 RTA_METRICS, 269 RTA_METRICS,
269 RTA_MULTIPATH, 270 RTA_MULTIPATH,
270 RTA_PROTOINFO, 271 RTA_PROTOINFO, /* no longer used */
271 RTA_FLOW, 272 RTA_FLOW,
272 RTA_CACHEINFO, 273 RTA_CACHEINFO,
273 RTA_SESSION, 274 RTA_SESSION, /* no longer used */
274 RTA_MP_ALGO, /* no longer used */ 275 RTA_MP_ALGO, /* no longer used */
275 RTA_TABLE, 276 RTA_TABLE,
276 __RTA_MAX 277 __RTA_MAX
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4ab9f32f9238..c5d3f847ca8d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -766,7 +766,6 @@ struct sched_domain {
766 struct sched_domain *child; /* bottom domain must be null terminated */ 766 struct sched_domain *child; /* bottom domain must be null terminated */
767 struct sched_group *groups; /* the balancing groups of the domain */ 767 struct sched_group *groups; /* the balancing groups of the domain */
768 cpumask_t span; /* span of all CPUs in this domain */ 768 cpumask_t span; /* span of all CPUs in this domain */
769 int first_cpu; /* cache of the first cpu in this domain */
770 unsigned long min_interval; /* Minimum balance interval ms */ 769 unsigned long min_interval; /* Minimum balance interval ms */
771 unsigned long max_interval; /* Maximum balance interval ms */ 770 unsigned long max_interval; /* Maximum balance interval ms */
772 unsigned int busy_factor; /* less balancing by factor if busy */ 771 unsigned int busy_factor; /* less balancing by factor if busy */
@@ -1848,7 +1847,9 @@ extern void exit_thread(void);
1848extern void exit_files(struct task_struct *); 1847extern void exit_files(struct task_struct *);
1849extern void __cleanup_signal(struct signal_struct *); 1848extern void __cleanup_signal(struct signal_struct *);
1850extern void __cleanup_sighand(struct sighand_struct *); 1849extern void __cleanup_sighand(struct sighand_struct *);
1850
1851extern void exit_itimers(struct signal_struct *); 1851extern void exit_itimers(struct signal_struct *);
1852extern void flush_itimer_signals(void);
1852 1853
1853extern NORET_TYPE void do_group_exit(int); 1854extern NORET_TYPE void do_group_exit(int);
1854 1855
@@ -2025,9 +2026,22 @@ static inline int fatal_signal_pending(struct task_struct *p)
2025 return signal_pending(p) && __fatal_signal_pending(p); 2026 return signal_pending(p) && __fatal_signal_pending(p);
2026} 2027}
2027 2028
2029static inline int signal_pending_state(long state, struct task_struct *p)
2030{
2031 if (!(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
2032 return 0;
2033 if (!signal_pending(p))
2034 return 0;
2035
2036 if (state & (__TASK_STOPPED | __TASK_TRACED))
2037 return 0;
2038
2039 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
2040}
2041
2028static inline int need_resched(void) 2042static inline int need_resched(void)
2029{ 2043{
2030 return unlikely(test_tsk_need_resched(current)); 2044 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
2031} 2045}
2032 2046
2033/* 2047/*
@@ -2038,7 +2052,7 @@ static inline int need_resched(void)
2038 * cond_resched_softirq() will enable bhs before scheduling. 2052 * cond_resched_softirq() will enable bhs before scheduling.
2039 */ 2053 */
2040extern int _cond_resched(void); 2054extern int _cond_resched(void);
2041#ifdef CONFIG_PREEMPT 2055#ifdef CONFIG_PREEMPT_BKL
2042static inline int cond_resched(void) 2056static inline int cond_resched(void)
2043{ 2057{
2044 return 0; 2058 return 0;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index d32123ae08ad..d8f31de632c5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -192,6 +192,7 @@ struct uart_ops {
192 void (*shutdown)(struct uart_port *); 192 void (*shutdown)(struct uart_port *);
193 void (*set_termios)(struct uart_port *, struct ktermios *new, 193 void (*set_termios)(struct uart_port *, struct ktermios *new,
194 struct ktermios *old); 194 struct ktermios *old);
195 void (*set_ldisc)(struct uart_port *);
195 void (*pm)(struct uart_port *, unsigned int state, 196 void (*pm)(struct uart_port *, unsigned int state,
196 unsigned int oldstate); 197 unsigned int oldstate);
197 int (*set_wake)(struct uart_port *, unsigned int state); 198 int (*set_wake)(struct uart_port *, unsigned int state);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 805ed4b92f9a..c2ad35016599 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -276,6 +276,17 @@ static inline void *kzalloc(size_t size, gfp_t flags)
276 return kmalloc(size, flags | __GFP_ZERO); 276 return kmalloc(size, flags | __GFP_ZERO);
277} 277}
278 278
279/**
280 * kzalloc_node - allocate zeroed memory from a particular memory node.
281 * @size: how many bytes of memory are required.
282 * @flags: the type of memory to allocate (see kmalloc).
283 * @node: memory node from which to allocate
284 */
285static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
286{
287 return kmalloc_node(size, flags | __GFP_ZERO, node);
288}
289
279#ifdef CONFIG_SLABINFO 290#ifdef CONFIG_SLABINFO
280extern const struct seq_operations slabinfo_op; 291extern const struct seq_operations slabinfo_op;
281ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); 292ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
index bca134544700..95c1c39ba445 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -71,8 +71,8 @@ extern unsigned long sm501_gpio_get(struct device *dev,
71#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1) 71#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
72#define SM501FB_FLAG_USE_HWCURSOR (1<<2) 72#define SM501FB_FLAG_USE_HWCURSOR (1<<2)
73#define SM501FB_FLAG_USE_HWACCEL (1<<3) 73#define SM501FB_FLAG_USE_HWACCEL (1<<3)
74#define SM501FB_FLAG_PANEL_USE_FPEN (1<<4) 74#define SM501FB_FLAG_PANEL_NO_FPEN (1<<4)
75#define SM501FB_FLAG_PANEL_USE_VBIASEN (1<<5) 75#define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5)
76 76
77struct sm501_platdata_fbsub { 77struct sm501_platdata_fbsub {
78 struct fb_videomode *def_mode; 78 struct fb_videomode *def_mode;
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index e9bbe3ebd721..d5ca78b93a3b 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_SPI_MMC_SPI_H 1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H 2#define __LINUX_SPI_MMC_SPI_H
3 3
4#include <linux/interrupt.h>
5
4struct device; 6struct device;
5struct mmc_host; 7struct mmc_host;
6 8
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 01fbdf5fef22..942e38736901 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -100,7 +100,7 @@ extern char * nvram_get(const char *name);
100/* Get the device MAC address */ 100/* Get the device MAC address */
101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
102{ 102{
103#ifdef CONFIG_BCM947XX 103#ifdef CONFIG_BCM47XX
104 char *res = nvram_get("et0macaddr"); 104 char *res = nvram_get("et0macaddr");
105 if (res) 105 if (res)
106 memcpy(macaddr, res, 6); 106 memcpy(macaddr, res, 6);
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index c11bbcc081f9..05eb4664d0dd 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -71,7 +71,8 @@ extern atomic_t rdma_stat_sq_prod;
71 * completes. 71 * completes.
72 */ 72 */
73struct svc_rdma_op_ctxt { 73struct svc_rdma_op_ctxt {
74 struct svc_rdma_op_ctxt *next; 74 struct svc_rdma_op_ctxt *read_hdr;
75 struct list_head free_list;
75 struct xdr_buf arg; 76 struct xdr_buf arg;
76 struct list_head dto_q; 77 struct list_head dto_q;
77 enum ib_wr_opcode wr_op; 78 enum ib_wr_opcode wr_op;
@@ -85,7 +86,6 @@ struct svc_rdma_op_ctxt {
85 struct page *pages[RPCSVC_MAXPAGES]; 86 struct page *pages[RPCSVC_MAXPAGES];
86}; 87};
87 88
88#define RDMACTXT_F_READ_DONE 1
89#define RDMACTXT_F_LAST_CTXT 2 89#define RDMACTXT_F_LAST_CTXT 2
90 90
91struct svcxprt_rdma { 91struct svcxprt_rdma {
@@ -104,7 +104,8 @@ struct svcxprt_rdma {
104 104
105 struct ib_pd *sc_pd; 105 struct ib_pd *sc_pd;
106 106
107 struct svc_rdma_op_ctxt *sc_ctxt_head; 107 atomic_t sc_ctxt_used;
108 struct list_head sc_ctxt_free;
108 int sc_ctxt_cnt; 109 int sc_ctxt_cnt;
109 int sc_ctxt_bump; 110 int sc_ctxt_bump;
110 int sc_ctxt_max; 111 int sc_ctxt_max;
@@ -123,6 +124,7 @@ struct svcxprt_rdma {
123 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */ 124 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */
124 struct list_head sc_read_complete_q; 125 struct list_head sc_read_complete_q;
125 spinlock_t sc_read_complete_lock; 126 spinlock_t sc_read_complete_lock;
127 struct work_struct sc_work;
126}; 128};
127/* sc_flags */ 129/* sc_flags */
128#define RDMAXPRT_RQ_PENDING 1 130#define RDMAXPRT_RQ_PENDING 1
@@ -164,8 +166,8 @@ extern int svc_rdma_sendto(struct svc_rqst *);
164 166
165/* svc_rdma_transport.c */ 167/* svc_rdma_transport.c */
166extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *); 168extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *);
167extern int svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *, 169extern void svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
168 enum rpcrdma_errcode); 170 enum rpcrdma_errcode);
169struct page *svc_rdma_get_page(void); 171struct page *svc_rdma_get_page(void);
170extern int svc_rdma_post_recv(struct svcxprt_rdma *); 172extern int svc_rdma_post_recv(struct svcxprt_rdma *);
171extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); 173extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index d96d9b122304..b31b6b74aa28 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -239,11 +239,6 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
239 return (struct tcp_request_sock *)req; 239 return (struct tcp_request_sock *)req;
240} 240}
241 241
242struct tcp_deferred_accept_info {
243 struct sock *listen_sk;
244 struct request_sock *request;
245};
246
247struct tcp_sock { 242struct tcp_sock {
248 /* inet_connection_sock has to be the first member of tcp_sock */ 243 /* inet_connection_sock has to be the first member of tcp_sock */
249 struct inet_connection_sock inet_conn; 244 struct inet_connection_sock inet_conn;
@@ -355,7 +350,7 @@ struct tcp_sock {
355 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ 350 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
356 351
357 u16 advmss; /* Advertised MSS */ 352 u16 advmss; /* Advertised MSS */
358 u16 prior_ssthresh; /* ssthresh saved at recovery start */ 353 u32 prior_ssthresh; /* ssthresh saved at recovery start */
359 u32 lost_out; /* Lost packets */ 354 u32 lost_out; /* Lost packets */
360 u32 sacked_out; /* SACK'd packets */ 355 u32 sacked_out; /* SACK'd packets */
361 u32 fackets_out; /* FACK'd packets */ 356 u32 fackets_out; /* FACK'd packets */
@@ -379,8 +374,6 @@ struct tcp_sock {
379 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 374 unsigned int keepalive_intvl; /* time interval between keep alive probes */
380 int linger2; 375 int linger2;
381 376
382 struct tcp_deferred_accept_info defer_tcp_accept;
383
384 unsigned long last_synq_overflow; 377 unsigned long last_synq_overflow;
385 378
386 u32 tso_deferred; 379 u32 tso_deferred;
diff --git a/include/linux/time.h b/include/linux/time.h
index d32ef0ad4c0a..e15206a7e82e 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -6,6 +6,7 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7# include <linux/cache.h> 7# include <linux/cache.h>
8# include <linux/seqlock.h> 8# include <linux/seqlock.h>
9# include <linux/math64.h>
9#endif 10#endif
10 11
11#ifndef _STRUCT_TIMESPEC 12#ifndef _STRUCT_TIMESPEC
@@ -169,18 +170,13 @@ extern struct timeval ns_to_timeval(const s64 nsec);
169 * timespec_add_ns - Adds nanoseconds to a timespec 170 * timespec_add_ns - Adds nanoseconds to a timespec
170 * @a: pointer to timespec to be incremented 171 * @a: pointer to timespec to be incremented
171 * @ns: unsigned nanoseconds value to be added 172 * @ns: unsigned nanoseconds value to be added
173 *
174 * This must always be inlined because its used from the x86-64 vdso,
175 * which cannot call other kernel functions.
172 */ 176 */
173static inline void timespec_add_ns(struct timespec *a, u64 ns) 177static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
174{ 178{
175 ns += a->tv_nsec; 179 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
176 while(unlikely(ns >= NSEC_PER_SEC)) {
177 /* The following asm() prevents the compiler from
178 * optimising this loop into a modulo operation. */
179 asm("" : "+r"(ns));
180
181 ns -= NSEC_PER_SEC;
182 a->tv_sec++;
183 }
184 a->tv_nsec = ns; 180 a->tv_nsec = ns;
185} 181}
186#endif /* __KERNEL__ */ 182#endif /* __KERNEL__ */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 4bb7074a2c3a..24f3d2282e11 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -166,7 +166,9 @@ void arch_update_cpu_topology(void);
166 .busy_idx = 3, \ 166 .busy_idx = 3, \
167 .idle_idx = 3, \ 167 .idle_idx = 3, \
168 .flags = SD_LOAD_BALANCE \ 168 .flags = SD_LOAD_BALANCE \
169 | SD_SERIALIZE, \ 169 | SD_BALANCE_NEWIDLE \
170 | SD_WAKE_AFFINE \
171 | SD_SERIALIZE, \
170 .last_balance = jiffies, \ 172 .last_balance = jiffies, \
171 .balance_interval = 64, \ 173 .balance_interval = 64, \
172} 174}
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7f7121f9c968..324a3b231d40 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -36,7 +36,7 @@
36#define N_6PACK 7 36#define N_6PACK 7
37#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ 37#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
38#define N_R3964 9 /* Reserved for Simatic R3964 module */ 38#define N_R3964 9 /* Reserved for Simatic R3964 module */
39#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ 39#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */
40#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ 40#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
41#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */ 41#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */
42 /* cards about SMS messages */ 42 /* cards about SMS messages */
diff --git a/include/linux/types.h b/include/linux/types.h
index 9dc2346627b4..d4a9ce6e2760 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -197,8 +197,6 @@ typedef u64 resource_size_t;
197typedef u32 resource_size_t; 197typedef u32 resource_size_t;
198#endif 198#endif
199 199
200#endif /* __KERNEL__ */
201
202struct ustat { 200struct ustat {
203 __kernel_daddr_t f_tfree; 201 __kernel_daddr_t f_tfree;
204 __kernel_ino_t f_tinode; 202 __kernel_ino_t f_tinode;
@@ -206,4 +204,6 @@ struct ustat {
206 char f_fpack[6]; 204 char f_fpack[6];
207}; 205};
208 206
207#endif /* __KERNEL__ */
208
209#endif /* _LINUX_TYPES_H */ 209#endif /* _LINUX_TYPES_H */
diff --git a/include/linux/usb/association.h b/include/linux/usb/association.h
new file mode 100644
index 000000000000..07c5e3cf5898
--- /dev/null
+++ b/include/linux/usb/association.h
@@ -0,0 +1,150 @@
1/*
2 * Wireless USB - Cable Based Association
3 *
4 * Copyright (C) 2006 Intel Corporation
5 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
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 version
9 * 2 as published by the Free Software Foundation.
10 *
11 */
12#ifndef __LINUX_USB_ASSOCIATION_H
13#define __LINUX_USB_ASSOCIATION_H
14
15
16/*
17 * Association attributes
18 *
19 * Association Models Supplement to WUSB 1.0 T[3-1]
20 *
21 * Each field in the structures has it's ID, it's length and then the
22 * value. This is the actual definition of the field's ID and its
23 * length.
24 */
25struct wusb_am_attr {
26 __u8 id;
27 __u8 len;
28};
29
30/* Different fields defined by the spec */
31#define WUSB_AR_AssociationTypeId { .id = 0x0000, .len = 2 }
32#define WUSB_AR_AssociationSubTypeId { .id = 0x0001, .len = 2 }
33#define WUSB_AR_Length { .id = 0x0002, .len = 4 }
34#define WUSB_AR_AssociationStatus { .id = 0x0004, .len = 4 }
35#define WUSB_AR_LangID { .id = 0x0008, .len = 2 }
36#define WUSB_AR_DeviceFriendlyName { .id = 0x000b, .len = 64 } /* max */
37#define WUSB_AR_HostFriendlyName { .id = 0x000c, .len = 64 } /* max */
38#define WUSB_AR_CHID { .id = 0x1000, .len = 16 }
39#define WUSB_AR_CDID { .id = 0x1001, .len = 16 }
40#define WUSB_AR_ConnectionContext { .id = 0x1002, .len = 48 }
41#define WUSB_AR_BandGroups { .id = 0x1004, .len = 2 }
42
43/* CBAF Control Requests (AMS1.0[T4-1] */
44enum {
45 CBAF_REQ_GET_ASSOCIATION_INFORMATION = 0x01,
46 CBAF_REQ_GET_ASSOCIATION_REQUEST,
47 CBAF_REQ_SET_ASSOCIATION_RESPONSE
48};
49
50/*
51 * CBAF USB-interface defitions
52 *
53 * No altsettings, one optional interrupt endpoint.
54 */
55enum {
56 CBAF_IFACECLASS = 0xef,
57 CBAF_IFACESUBCLASS = 0x03,
58 CBAF_IFACEPROTOCOL = 0x01,
59};
60
61/* Association Information (AMS1.0[T4-3]) */
62struct wusb_cbaf_assoc_info {
63 __le16 Length;
64 __u8 NumAssociationRequests;
65 __le16 Flags;
66 __u8 AssociationRequestsArray[];
67} __attribute__((packed));
68
69/* Association Request (AMS1.0[T4-4]) */
70struct wusb_cbaf_assoc_request {
71 __u8 AssociationDataIndex;
72 __u8 Reserved;
73 __le16 AssociationTypeId;
74 __le16 AssociationSubTypeId;
75 __le32 AssociationTypeInfoSize;
76} __attribute__((packed));
77
78enum {
79 AR_TYPE_WUSB = 0x0001,
80 AR_TYPE_WUSB_RETRIEVE_HOST_INFO = 0x0000,
81 AR_TYPE_WUSB_ASSOCIATE = 0x0001,
82};
83
84/* Association Attribute header (AMS1.0[3.8]) */
85struct wusb_cbaf_attr_hdr {
86 __le16 id;
87 __le16 len;
88} __attribute__((packed));
89
90/* Host Info (AMS1.0[T4-7]) (yeah, more headers and fields...) */
91struct wusb_cbaf_host_info {
92 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
93 __le16 AssociationTypeId;
94 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
95 __le16 AssociationSubTypeId;
96 struct wusb_cbaf_attr_hdr CHID_hdr;
97 struct wusb_ckhdid CHID;
98 struct wusb_cbaf_attr_hdr LangID_hdr;
99 __le16 LangID;
100 struct wusb_cbaf_attr_hdr HostFriendlyName_hdr;
101 __u8 HostFriendlyName[];
102} __attribute__((packed));
103
104/* Device Info (AMS1.0[T4-8])
105 *
106 * I still don't get this tag'n'header stuff for each goddamn
107 * field...
108 */
109struct wusb_cbaf_device_info {
110 struct wusb_cbaf_attr_hdr Length_hdr;
111 __le32 Length;
112 struct wusb_cbaf_attr_hdr CDID_hdr;
113 struct wusb_ckhdid CDID;
114 struct wusb_cbaf_attr_hdr BandGroups_hdr;
115 __le16 BandGroups;
116 struct wusb_cbaf_attr_hdr LangID_hdr;
117 __le16 LangID;
118 struct wusb_cbaf_attr_hdr DeviceFriendlyName_hdr;
119 __u8 DeviceFriendlyName[];
120} __attribute__((packed));
121
122/* Connection Context; CC_DATA - Success case (AMS1.0[T4-9]) */
123struct wusb_cbaf_cc_data {
124 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
125 __le16 AssociationTypeId;
126 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
127 __le16 AssociationSubTypeId;
128 struct wusb_cbaf_attr_hdr Length_hdr;
129 __le32 Length;
130 struct wusb_cbaf_attr_hdr ConnectionContext_hdr;
131 struct wusb_ckhdid CHID;
132 struct wusb_ckhdid CDID;
133 struct wusb_ckhdid CK;
134 struct wusb_cbaf_attr_hdr BandGroups_hdr;
135 __le16 BandGroups;
136} __attribute__((packed));
137
138/* CC_DATA - Failure case (AMS1.0[T4-10]) */
139struct wusb_cbaf_cc_data_fail {
140 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
141 __le16 AssociationTypeId;
142 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
143 __le16 AssociationSubTypeId;
144 struct wusb_cbaf_attr_hdr Length_hdr;
145 __le16 Length;
146 struct wusb_cbaf_attr_hdr AssociationStatus_hdr;
147 __u32 AssociationStatus;
148} __attribute__((packed));
149
150#endif /* __LINUX_USB_ASSOCIATION_H */
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 71e52f2f6a38..ca228bb94218 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -130,6 +130,15 @@ struct usb_cdc_ether_desc {
130 __u8 bNumberPowerFilters; 130 __u8 bNumberPowerFilters;
131} __attribute__ ((packed)); 131} __attribute__ ((packed));
132 132
133/* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */
134struct usb_cdc_dmm_desc {
135 __u8 bFunctionLength;
136 __u8 bDescriptorType;
137 __u8 bDescriptorSubtype;
138 __u16 bcdVersion;
139 __le16 wMaxCommand;
140} __attribute__ ((packed));
141
133/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ 142/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */
134struct usb_cdc_mdlm_desc { 143struct usb_cdc_mdlm_desc {
135 __u8 bLength; 144 __u8 bLength;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c1411189ba6c..4a535ea1e123 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -865,9 +865,9 @@ struct v4l2_querymenu
865#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) 865#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
866#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) 866#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
867 867
868/* Deprecated, use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ 868/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
869#define V4L2_CID_HCENTER_DEPRECATED (V4L2_CID_BASE+22) 869#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
870#define V4L2_CID_VCENTER_DEPRECATED (V4L2_CID_BASE+23) 870#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
871 871
872#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) 872#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
873enum v4l2_power_line_frequency { 873enum v4l2_power_line_frequency {
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index d4695a3356d0..5f79a5f9de79 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -10,18 +10,19 @@
10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ 11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
12#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ 12#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
13#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
13 14
14struct virtio_blk_config 15struct virtio_blk_config
15{ 16{
16 /* The capacity (in 512-byte sectors). */ 17 /* The capacity (in 512-byte sectors). */
17 __le64 capacity; 18 __u64 capacity;
18 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ 19 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
19 __le32 size_max; 20 __u32 size_max;
20 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ 21 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
21 __le32 seg_max; 22 __u32 seg_max;
22 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ 23 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
23 struct virtio_blk_geometry { 24 struct virtio_blk_geometry {
24 __le16 cylinders; 25 __u16 cylinders;
25 __u8 heads; 26 __u8 heads;
26 __u8 sectors; 27 __u8 sectors;
27 } geometry; 28 } geometry;
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 50db245c81ad..f364bbf63c34 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -15,6 +15,10 @@
15/* We've given up on this device. */ 15/* We've given up on this device. */
16#define VIRTIO_CONFIG_S_FAILED 0x80 16#define VIRTIO_CONFIG_S_FAILED 0x80
17 17
18/* Do we get callbacks when the ring is completely used, even if we've
19 * suppressed them? */
20#define VIRTIO_F_NOTIFY_ON_EMPTY 24
21
18#ifdef __KERNEL__ 22#ifdef __KERNEL__
19#include <linux/virtio.h> 23#include <linux/virtio.h>
20 24
@@ -99,7 +103,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
99 * The return value is -ENOENT if the feature doesn't exist. Otherwise 103 * The return value is -ENOENT if the feature doesn't exist. Otherwise
100 * the config value is copied into whatever is pointed to by v. */ 104 * the config value is copied into whatever is pointed to by v. */
101#define virtio_config_val(vdev, fbit, offset, v) \ 105#define virtio_config_val(vdev, fbit, offset, v) \
102 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(v)) 106 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(*v))
103 107
104static inline int virtio_config_buf(struct virtio_device *vdev, 108static inline int virtio_config_buf(struct virtio_device *vdev,
105 unsigned int fbit, 109 unsigned int fbit,
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 9405aa6cdf26..38c0571820fb 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -38,7 +38,7 @@ struct virtio_net_hdr
38#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set 38#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
39 __u8 gso_type; 39 __u8 gso_type;
40 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ 40 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
41 __u16 gso_size; /* Bytes to append to gso_hdr_len per frame */ 41 __u16 gso_size; /* Bytes to append to hdr_len per frame */
42 __u16 csum_start; /* Position to start checksumming from */ 42 __u16 csum_start; /* Position to start checksumming from */
43 __u16 csum_offset; /* Offset after that to place checksum */ 43 __u16 csum_offset; /* Offset after that to place checksum */
44}; 44};
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h
new file mode 100644
index 000000000000..331afb6c9f62
--- /dev/null
+++ b/include/linux/virtio_rng.h
@@ -0,0 +1,8 @@
1#ifndef _LINUX_VIRTIO_RNG_H
2#define _LINUX_VIRTIO_RNG_H
3#include <linux/virtio_config.h>
4
5/* The ID for virtio_rng */
6#define VIRTIO_ID_RNG 4
7
8#endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 4d13732e9cf0..6f69968eab24 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -100,6 +100,7 @@
100#define WM9713_ADCSEL_Y 0x0004 /* Y measurement */ 100#define WM9713_ADCSEL_Y 0x0004 /* Y measurement */
101#define WM9713_ADCSEL_PRES 0x0008 /* Pressure measurement */ 101#define WM9713_ADCSEL_PRES 0x0008 /* Pressure measurement */
102#define WM9713_COO 0x0001 /* enable coordinate mode */ 102#define WM9713_COO 0x0001 /* enable coordinate mode */
103#define WM9713_45W 0x1000 /* set for 5 wire panel */
103#define WM9713_PDEN 0x0800 /* measure only when pen down */ 104#define WM9713_PDEN 0x0800 /* measure only when pen down */
104#define WM9713_ADCSEL_MASK 0x00fe /* ADC selection mask */ 105#define WM9713_ADCSEL_MASK 0x00fe /* ADC selection mask */
105#define WM9713_WAIT 0x0200 /* coordinate wait */ 106#define WM9713_WAIT 0x0200 /* coordinate wait */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index a807d2f86ee8..33f01ae08f76 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -40,7 +40,6 @@
40#define VFL_TYPE_VTX 3 40#define VFL_TYPE_VTX 3
41 41
42/* Video standard functions */ 42/* Video standard functions */
43extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
44extern char *v4l2_norm_to_name(v4l2_std_id id); 43extern char *v4l2_norm_to_name(v4l2_std_id id);
45extern int v4l2_video_std_construct(struct v4l2_standard *vs, 44extern int v4l2_video_std_construct(struct v4l2_standard *vs,
46 int id, char *name); 45 int id, char *name);
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 5b39a22533fe..874f1340d049 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -237,6 +237,9 @@ unsigned int videobuf_poll_stream(struct file *file,
237int videobuf_mmap_setup(struct videobuf_queue *q, 237int videobuf_mmap_setup(struct videobuf_queue *q,
238 unsigned int bcount, unsigned int bsize, 238 unsigned int bcount, unsigned int bsize,
239 enum v4l2_memory memory); 239 enum v4l2_memory memory);
240int __videobuf_mmap_setup(struct videobuf_queue *q,
241 unsigned int bcount, unsigned int bsize,
242 enum v4l2_memory memory);
240int videobuf_mmap_free(struct videobuf_queue *q); 243int videobuf_mmap_free(struct videobuf_queue *q);
241int videobuf_mmap_mapper(struct videobuf_queue *q, 244int videobuf_mmap_mapper(struct videobuf_queue *q,
242 struct vm_area_struct *vma); 245 struct vm_area_struct *vma);
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 585eb4496990..b3d3e27c6299 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -29,14 +29,31 @@
29 29
30#ifdef CONFIG_NET_9P_DEBUG 30#ifdef CONFIG_NET_9P_DEBUG
31 31
32#define P9_DEBUG_ERROR (1<<0) 32/**
33#define P9_DEBUG_9P (1<<2) 33 * enum p9_debug_flags - bits for mount time debug parameter
34#define P9_DEBUG_VFS (1<<3) 34 * @P9_DEBUG_ERROR: more verbose error messages including original error string
35#define P9_DEBUG_CONV (1<<4) 35 * @P9_DEBUG_9P: 9P protocol tracing
36#define P9_DEBUG_MUX (1<<5) 36 * @P9_DEBUG_VFS: VFS API tracing
37#define P9_DEBUG_TRANS (1<<6) 37 * @P9_DEBUG_CONV: protocol conversion tracing
38#define P9_DEBUG_SLABS (1<<7) 38 * @P9_DEBUG_MUX: trace management of concurrent transactions
39#define P9_DEBUG_FCALL (1<<8) 39 * @P9_DEBUG_TRANS: transport tracing
40 * @P9_DEBUG_SLABS: memory management tracing
41 * @P9_DEBUG_FCALL: verbose dump of protocol messages
42 *
43 * These flags are passed at mount time to turn on various levels of
44 * verbosity and tracing which will be output to the system logs.
45 */
46
47enum p9_debug_flags {
48 P9_DEBUG_ERROR = (1<<0),
49 P9_DEBUG_9P = (1<<2),
50 P9_DEBUG_VFS = (1<<3),
51 P9_DEBUG_CONV = (1<<4),
52 P9_DEBUG_MUX = (1<<5),
53 P9_DEBUG_TRANS = (1<<6),
54 P9_DEBUG_SLABS = (1<<7),
55 P9_DEBUG_FCALL = (1<<8),
56};
40 57
41extern unsigned int p9_debug_level; 58extern unsigned int p9_debug_level;
42 59
@@ -62,9 +79,47 @@ do { \
62 format , __FUNCTION__, task_pid_nr(current), ## arg); \ 79 format , __FUNCTION__, task_pid_nr(current), ## arg); \
63} while (0) 80} while (0)
64 81
82/**
83 * enum p9_msg_t - 9P message types
84 * @P9_TVERSION: version handshake request
85 * @P9_RVERSION: version handshake response
86 * @P9_TAUTH: request to establish authentication channel
87 * @P9_RAUTH: response with authentication information
88 * @P9_TATTACH: establish user access to file service
89 * @P9_RATTACH: response with top level handle to file hierarchy
90 * @P9_TERROR: not used
91 * @P9_RERROR: response for any failed request
92 * @P9_TFLUSH: request to abort a previous request
93 * @P9_RFLUSH: response when previous request has been cancelled
94 * @P9_TWALK: descend a directory hierarchy
95 * @P9_RWALK: response with new handle for position within hierarchy
96 * @P9_TOPEN: prepare a handle for I/O on an existing file
97 * @P9_ROPEN: response with file access information
98 * @P9_TCREATE: prepare a handle for I/O on a new file
99 * @P9_RCREATE: response with file access information
100 * @P9_TREAD: request to transfer data from a file or directory
101 * @P9_RREAD: response with data requested
102 * @P9_TWRITE: reuqest to transfer data to a file
103 * @P9_RWRITE: response with out much data was transfered to file
104 * @P9_TCLUNK: forget about a handle to an entity within the file system
105 * @P9_RCLUNK: response when server has forgotten about the handle
106 * @P9_TREMOVE: request to remove an entity from the hierarchy
107 * @P9_RREMOVE: response when server has removed the entity
108 * @P9_TSTAT: request file entity attributes
109 * @P9_RSTAT: response with file entity attributes
110 * @P9_TWSTAT: request to update file entity attributes
111 * @P9_RWSTAT: response when file entity attributes are updated
112 *
113 * There are 14 basic operations in 9P2000, paired as
114 * requests and responses. The one special case is ERROR
115 * as there is no @P9_TERROR request for clients to transmit to
116 * the server, but the server may respond to any other request
117 * with an @P9_RERROR.
118 *
119 * See Also: http://plan9.bell-labs.com/sys/man/5/INDEX.html
120 */
65 121
66/* Message Types */ 122enum p9_msg_t {
67enum {
68 P9_TVERSION = 100, 123 P9_TVERSION = 100,
69 P9_RVERSION, 124 P9_RVERSION,
70 P9_TAUTH = 102, 125 P9_TAUTH = 102,
@@ -95,30 +150,71 @@ enum {
95 P9_RWSTAT, 150 P9_RWSTAT,
96}; 151};
97 152
98/* open modes */ 153/**
99enum { 154 * enum p9_open_mode_t - 9P open modes
155 * @P9_OREAD: open file for reading only
156 * @P9_OWRITE: open file for writing only
157 * @P9_ORDWR: open file for reading or writing
158 * @P9_OEXEC: open file for execution
159 * @P9_OTRUNC: truncate file to zero-length before opening it
160 * @P9_OREXEC: close the file when an exec(2) system call is made
161 * @P9_ORCLOSE: remove the file when the file is closed
162 * @P9_OAPPEND: open the file and seek to the end
163 * @P9_OEXCL: only create a file, do not open it
164 *
165 * 9P open modes differ slightly from Posix standard modes.
166 * In particular, there are extra modes which specify different
167 * semantic behaviors than may be available on standard Posix
168 * systems. For example, @P9_OREXEC and @P9_ORCLOSE are modes that
169 * most likely will not be issued from the Linux VFS client, but may
170 * be supported by servers.
171 *
172 * See Also: http://plan9.bell-labs.com/magic/man2html/2/open
173 */
174
175enum p9_open_mode_t {
100 P9_OREAD = 0x00, 176 P9_OREAD = 0x00,
101 P9_OWRITE = 0x01, 177 P9_OWRITE = 0x01,
102 P9_ORDWR = 0x02, 178 P9_ORDWR = 0x02,
103 P9_OEXEC = 0x03, 179 P9_OEXEC = 0x03,
104 P9_OEXCL = 0x04,
105 P9_OTRUNC = 0x10, 180 P9_OTRUNC = 0x10,
106 P9_OREXEC = 0x20, 181 P9_OREXEC = 0x20,
107 P9_ORCLOSE = 0x40, 182 P9_ORCLOSE = 0x40,
108 P9_OAPPEND = 0x80, 183 P9_OAPPEND = 0x80,
109}; 184 P9_OEXCL = 0x1000,
110 185};
111/* permissions */ 186
112enum { 187/**
188 * enum p9_perm_t - 9P permissions
189 * @P9_DMDIR: mode bite for directories
190 * @P9_DMAPPEND: mode bit for is append-only
191 * @P9_DMEXCL: mode bit for excluse use (only one open handle allowed)
192 * @P9_DMMOUNT: mode bite for mount points
193 * @P9_DMAUTH: mode bit for authentication file
194 * @P9_DMTMP: mode bit for non-backed-up files
195 * @P9_DMSYMLINK: mode bit for symbolic links (9P2000.u)
196 * @P9_DMLINK: mode bit for hard-link (9P2000.u)
197 * @P9_DMDEVICE: mode bit for device files (9P2000.u)
198 * @P9_DMNAMEDPIPE: mode bit for named pipe (9P2000.u)
199 * @P9_DMSOCKET: mode bit for socket (9P2000.u)
200 * @P9_DMSETUID: mode bit for setuid (9P2000.u)
201 * @P9_DMSETGID: mode bit for setgid (9P2000.u)
202 * @P9_DMSETVTX: mode bit for sticky bit (9P2000.u)
203 *
204 * 9P permissions differ slightly from Posix standard modes.
205 *
206 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
207 */
208enum p9_perm_t {
113 P9_DMDIR = 0x80000000, 209 P9_DMDIR = 0x80000000,
114 P9_DMAPPEND = 0x40000000, 210 P9_DMAPPEND = 0x40000000,
115 P9_DMEXCL = 0x20000000, 211 P9_DMEXCL = 0x20000000,
116 P9_DMMOUNT = 0x10000000, 212 P9_DMMOUNT = 0x10000000,
117 P9_DMAUTH = 0x08000000, 213 P9_DMAUTH = 0x08000000,
118 P9_DMTMP = 0x04000000, 214 P9_DMTMP = 0x04000000,
215/* 9P2000.u extensions */
119 P9_DMSYMLINK = 0x02000000, 216 P9_DMSYMLINK = 0x02000000,
120 P9_DMLINK = 0x01000000, 217 P9_DMLINK = 0x01000000,
121 /* 9P2000.u extensions */
122 P9_DMDEVICE = 0x00800000, 218 P9_DMDEVICE = 0x00800000,
123 P9_DMNAMEDPIPE = 0x00200000, 219 P9_DMNAMEDPIPE = 0x00200000,
124 P9_DMSOCKET = 0x00100000, 220 P9_DMSOCKET = 0x00100000,
@@ -127,8 +223,26 @@ enum {
127 P9_DMSETVTX = 0x00010000, 223 P9_DMSETVTX = 0x00010000,
128}; 224};
129 225
130/* qid.types */ 226/**
131enum { 227 * enum p9_qid_t - QID types
228 * @P9_QTDIR: directory
229 * @P9_QTAPPEND: append-only
230 * @P9_QTEXCL: excluse use (only one open handle allowed)
231 * @P9_QTMOUNT: mount points
232 * @P9_QTAUTH: authentication file
233 * @P9_QTTMP: non-backed-up files
234 * @P9_QTSYMLINK: symbolic links (9P2000.u)
235 * @P9_QTLINK: hard-link (9P2000.u)
236 * @P9_QTFILE: normal files
237 *
238 * QID types are a subset of permissions - they are primarily
239 * used to differentiate semantics for a file system entity via
240 * a jump-table. Their value is also the most signifigant 16 bits
241 * of the permission_t
242 *
243 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
244 */
245enum p9_qid_t {
132 P9_QTDIR = 0x80, 246 P9_QTDIR = 0x80,
133 P9_QTAPPEND = 0x40, 247 P9_QTAPPEND = 0x40,
134 P9_QTEXCL = 0x20, 248 P9_QTEXCL = 0x20,
@@ -140,6 +254,7 @@ enum {
140 P9_QTFILE = 0x00, 254 P9_QTFILE = 0x00,
141}; 255};
142 256
257/* 9P Magic Numbers */
143#define P9_NOTAG (u16)(~0) 258#define P9_NOTAG (u16)(~0)
144#define P9_NOFID (u32)(~0) 259#define P9_NOFID (u32)(~0)
145#define P9_MAXWELEM 16 260#define P9_MAXWELEM 16
@@ -147,19 +262,69 @@ enum {
147/* ample room for Twrite/Rread header */ 262/* ample room for Twrite/Rread header */
148#define P9_IOHDRSZ 24 263#define P9_IOHDRSZ 24
149 264
265/**
266 * struct p9_str - length prefixed string type
267 * @len: length of the string
268 * @str: the string
269 *
270 * The protocol uses length prefixed strings for all
271 * string data, so we replicate that for our internal
272 * string members.
273 */
274
150struct p9_str { 275struct p9_str {
151 u16 len; 276 u16 len;
152 char *str; 277 char *str;
153}; 278};
154 279
155/* qids are the unique ID for a file (like an inode */ 280/**
281 * struct p9_qid - file system entity information
282 * @type: 8-bit type &p9_qid_t
283 * @version: 16-bit monotonically incrementing version number
284 * @path: 64-bit per-server-unique ID for a file system element
285 *
286 * qids are identifiers used by 9P servers to track file system
287 * entities. The type is used to differentiate semantics for operations
288 * on the entity (ie. read means something different on a directory than
289 * on a file). The path provides a server unique index for an entity
290 * (roughly analogous to an inode number), while the version is updated
291 * every time a file is modified and can be used to maintain cache
292 * coherency between clients and serves.
293 * Servers will often differentiate purely synthetic entities by setting
294 * their version to 0, signaling that they should never be cached and
295 * should be accessed synchronously.
296 *
297 * See Also://plan9.bell-labs.com/magic/man2html/2/stat
298 */
299
156struct p9_qid { 300struct p9_qid {
157 u8 type; 301 u8 type;
158 u32 version; 302 u32 version;
159 u64 path; 303 u64 path;
160}; 304};
161 305
162/* Plan 9 file metadata (stat) structure */ 306/**
307 * struct p9_stat - file system metadata information
308 * @size: length prefix for this stat structure instance
309 * @type: the type of the server (equivilent to a major number)
310 * @dev: the sub-type of the server (equivilent to a minor number)
311 * @qid: unique id from the server of type &p9_qid
312 * @mode: Plan 9 format permissions of type &p9_perm_t
313 * @atime: Last access/read time
314 * @mtime: Last modify/write time
315 * @length: file length
316 * @name: last element of path (aka filename) in type &p9_str
317 * @uid: owner name in type &p9_str
318 * @gid: group owner in type &p9_str
319 * @muid: last modifier in type &p9_str
320 * @extension: area used to encode extended UNIX support in type &p9_str
321 * @n_uid: numeric user id of owner (part of 9p2000.u extension)
322 * @n_gid: numeric group id (part of 9p2000.u extension)
323 * @n_muid: numeric user id of laster modifier (part of 9p2000.u extension)
324 *
325 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
326 */
327
163struct p9_stat { 328struct p9_stat {
164 u16 size; 329 u16 size;
165 u16 type; 330 u16 type;
@@ -179,10 +344,14 @@ struct p9_stat {
179 u32 n_muid; /* 9p2000.u extensions */ 344 u32 n_muid; /* 9p2000.u extensions */
180}; 345};
181 346
182/* file metadata (stat) structure used to create Twstat message 347/*
183 The is similar to p9_stat, but the strings don't point to 348 * file metadata (stat) structure used to create Twstat message
184 the same memory block and should be freed separately 349 * The is identical to &p9_stat, but the strings don't point to
185*/ 350 * the same memory block and should be freed separately
351 *
352 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
353 */
354
186struct p9_wstat { 355struct p9_wstat {
187 u16 size; 356 u16 size;
188 u16 type; 357 u16 type;
@@ -335,10 +504,20 @@ struct p9_twstat {
335struct p9_rwstat { 504struct p9_rwstat {
336}; 505};
337 506
338/* 507/**
339 * fcall is the primary packet structure 508 * struct p9_fcall - primary packet structure
340 * 509 * @size: prefixed length of the structure
341 */ 510 * @id: protocol operating identifier of type &p9_msg_t
511 * @tag: transaction id of the request
512 * @sdata: payload
513 * @params: per-operation parameters
514 *
515 * &p9_fcall represents the structure for all 9P RPC
516 * transactions. Requests are packaged into fcalls, and reponses
517 * must be extracted from them.
518 *
519 * See Also: http://plan9.bell-labs.com/magic/man2html/2/fcall
520 */
342 521
343struct p9_fcall { 522struct p9_fcall {
344 u32 size; 523 u32 size;
@@ -416,4 +595,5 @@ int p9_idpool_check(int id, struct p9_idpool *p);
416 595
417int p9_error_init(void); 596int p9_error_init(void);
418int p9_errstr2errno(char *, int); 597int p9_errstr2errno(char *, int);
598int p9_trans_fd_init(void);
419#endif /* NET_9P_H */ 599#endif /* NET_9P_H */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index e52f93d9ac5f..c936dd14de41 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -26,6 +26,23 @@
26#ifndef NET_9P_CLIENT_H 26#ifndef NET_9P_CLIENT_H
27#define NET_9P_CLIENT_H 27#define NET_9P_CLIENT_H
28 28
29/**
30 * struct p9_client - per client instance state
31 * @lock: protect @fidlist
32 * @msize: maximum data size negotiated by protocol
33 * @dotu: extension flags negotiated by protocol
34 * @trans_mod: module API instantiated with this client
35 * @trans: tranport instance state and API
36 * @conn: connection state information used by trans_fd
37 * @fidpool: fid handle accounting for session
38 * @fidlist: List of active fid handles
39 *
40 * The client structure is used to keep track of various per-client
41 * state that has been instantiated.
42 *
43 * Bugs: duplicated data and potentially unnecessary elements.
44 */
45
29struct p9_client { 46struct p9_client {
30 spinlock_t lock; /* protect client structure */ 47 spinlock_t lock; /* protect client structure */
31 int msize; 48 int msize;
@@ -38,6 +55,24 @@ struct p9_client {
38 struct list_head fidlist; 55 struct list_head fidlist;
39}; 56};
40 57
58/**
59 * struct p9_fid - file system entity handle
60 * @clnt: back pointer to instantiating &p9_client
61 * @fid: numeric identifier for this handle
62 * @mode: current mode of this fid (enum?)
63 * @qid: the &p9_qid server identifier this handle points to
64 * @iounit: the server reported maximum transaction size for this file
65 * @uid: the numeric uid of the local user who owns this handle
66 * @aux: transport specific information (unused?)
67 * @rdir_fpos: tracks offset of file position when reading directory contents
68 * @rdir_pos: (unused?)
69 * @rdir_fcall: holds response of last directory read request
70 * @flist: per-client-instance fid tracking
71 * @dlist: per-dentry fid tracking
72 *
73 * TODO: This needs lots of explanation.
74 */
75
41struct p9_fid { 76struct p9_fid {
42 struct p9_client *clnt; 77 struct p9_client *clnt;
43 u32 fid; 78 u32 fid;
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index d2209ae9d18b..0db3a4038dc0 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,12 +26,40 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29/**
30 * enum p9_trans_status - different states of underlying transports
31 * @Connected: transport is connected and healthy
32 * @Disconnected: transport has been disconnected
33 * @Hung: transport is connected by wedged
34 *
35 * This enumeration details the various states a transport
36 * instatiation can be in.
37 */
38
29enum p9_trans_status { 39enum p9_trans_status {
30 Connected, 40 Connected,
31 Disconnected, 41 Disconnected,
32 Hung, 42 Hung,
33}; 43};
34 44
45/**
46 * struct p9_trans - per-transport state and API
47 * @status: transport &p9_trans_status
48 * @msize: negotiated maximum packet size (duplicate from client)
49 * @extended: negotiated protocol extensions (duplicate from client)
50 * @priv: transport private data
51 * @close: member function to disconnect and close the transport
52 * @rpc: member function to issue a request to the transport
53 *
54 * This is the basic API for a transport instance. It is used as
55 * a handle by the client to issue requests. This interface is currently
56 * in flux during reorganization.
57 *
58 * Bugs: there is lots of duplicated data here and its not clear that
59 * the member functions need to be per-instance versus per transport
60 * module.
61 */
62
35struct p9_trans { 63struct p9_trans {
36 enum p9_trans_status status; 64 enum p9_trans_status status;
37 int msize; 65 int msize;
@@ -42,6 +70,21 @@ struct p9_trans {
42 struct p9_fcall **rc); 70 struct p9_fcall **rc);
43}; 71};
44 72
73/**
74 * struct p9_trans_module - transport module interface
75 * @list: used to maintain a list of currently available transports
76 * @name: the human-readable name of the transport
77 * @maxsize: transport provided maximum packet size
78 * @def: set if this transport should be considered the default
79 * @create: member function to create a new connection on this transport
80 *
81 * This is the basic API for a transport module which is registered by the
82 * transport module with the 9P core network module and used by the client
83 * to instantiate a new connection on a transport.
84 *
85 * Bugs: the transport module list isn't protected.
86 */
87
45struct p9_trans_module { 88struct p9_trans_module {
46 struct list_head list; 89 struct list_head list;
47 char *name; /* name of transport */ 90 char *name; /* name of transport */
@@ -53,5 +96,4 @@ struct p9_trans_module {
53void v9fs_register_trans(struct p9_trans_module *m); 96void v9fs_register_trans(struct p9_trans_module *m);
54struct p9_trans_module *v9fs_match_trans(const substring_t *name); 97struct p9_trans_module *v9fs_match_trans(const substring_t *name);
55struct p9_trans_module *v9fs_default_trans(void); 98struct p9_trans_module *v9fs_default_trans(void);
56
57#endif /* NET_9P_TRANSPORT_H */ 99#endif /* NET_9P_TRANSPORT_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 0a2f0372df31..bbd3d583c6e6 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -94,6 +94,28 @@ extern void addrconf_join_solict(struct net_device *dev,
94extern void addrconf_leave_solict(struct inet6_dev *idev, 94extern void addrconf_leave_solict(struct inet6_dev *idev,
95 struct in6_addr *addr); 95 struct in6_addr *addr);
96 96
97static inline unsigned long addrconf_timeout_fixup(u32 timeout,
98 unsigned unit)
99{
100 if (timeout == 0xffffffff)
101 return ~0UL;
102
103 /*
104 * Avoid arithmetic overflow.
105 * Assuming unit is constant and non-zero, this "if" statement
106 * will go away on 64bit archs.
107 */
108 if (0xfffffffe > LONG_MAX / unit && timeout > LONG_MAX / unit)
109 return LONG_MAX / unit;
110
111 return timeout;
112}
113
114static inline int addrconf_finite_timeout(unsigned long timeout)
115{
116 return ~timeout;
117}
118
97/* 119/*
98 * IPv6 Address Label subsystem (addrlabel.c) 120 * IPv6 Address Label subsystem (addrlabel.c)
99 */ 121 */
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index decdda546829..747c255d1df0 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -162,9 +162,9 @@ static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
162 * @skb: socket buffer the message is stored in 162 * @skb: socket buffer the message is stored in
163 * @hdr: generic netlink message header 163 * @hdr: generic netlink message header
164 */ 164 */
165static inline int genlmsg_cancel(struct sk_buff *skb, void *hdr) 165static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
166{ 166{
167 return nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); 167 nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
168} 168}
169 169
170/** 170/**
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index a42cd63d241a..9fabe5b38912 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -197,4 +197,14 @@ static inline int inet_iif(const struct sk_buff *skb)
197 return skb->rtable->rt_iif; 197 return skb->rtable->rt_iif;
198} 198}
199 199
200static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
201{
202 struct request_sock *req = reqsk_alloc(ops);
203
204 if (req != NULL)
205 inet_rsk(req)->opt = NULL;
206
207 return req;
208}
209
200#endif /* _INET_SOCK_H */ 210#endif /* _INET_SOCK_H */
diff --git a/include/net/irda/discovery.h b/include/net/irda/discovery.h
index e4efad1f9eff..0ce93398720d 100644
--- a/include/net/irda/discovery.h
+++ b/include/net/irda/discovery.h
@@ -57,9 +57,6 @@ typedef union {
57 __u8 byte[2]; 57 __u8 byte[2];
58} __u16_host_order; 58} __u16_host_order;
59 59
60/* Same purpose, different application */
61#define u16ho(array) (* ((__u16 *) array))
62
63/* Types of discovery */ 60/* Types of discovery */
64typedef enum { 61typedef enum {
65 DISCOVERY_LOG, /* What's in our discovery log */ 62 DISCOVERY_LOG, /* What's in our discovery log */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4a80d74975e8..dae3f9ec1154 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1594,13 +1594,16 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1594void ieee80211_scan_completed(struct ieee80211_hw *hw); 1594void ieee80211_scan_completed(struct ieee80211_hw *hw);
1595 1595
1596/** 1596/**
1597 * ieee80211_iterate_active_interfaces - iterate active interfaces 1597 * ieee80211_iterate_active_interfaces- iterate active interfaces
1598 * 1598 *
1599 * This function iterates over the interfaces associated with a given 1599 * This function iterates over the interfaces associated with a given
1600 * hardware that are currently active and calls the callback for them. 1600 * hardware that are currently active and calls the callback for them.
1601 * This function allows the iterator function to sleep, when the iterator
1602 * function is atomic @ieee80211_iterate_active_interfaces_atomic can
1603 * be used.
1601 * 1604 *
1602 * @hw: the hardware struct of which the interfaces should be iterated over 1605 * @hw: the hardware struct of which the interfaces should be iterated over
1603 * @iterator: the iterator function to call, cannot sleep 1606 * @iterator: the iterator function to call
1604 * @data: first argument of the iterator function 1607 * @data: first argument of the iterator function
1605 */ 1608 */
1606void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 1609void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
@@ -1609,6 +1612,24 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1609 void *data); 1612 void *data);
1610 1613
1611/** 1614/**
1615 * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces
1616 *
1617 * This function iterates over the interfaces associated with a given
1618 * hardware that are currently active and calls the callback for them.
1619 * This function requires the iterator callback function to be atomic,
1620 * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
1621 *
1622 * @hw: the hardware struct of which the interfaces should be iterated over
1623 * @iterator: the iterator function to call, cannot sleep
1624 * @data: first argument of the iterator function
1625 */
1626void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1627 void (*iterator)(void *data,
1628 u8 *mac,
1629 struct ieee80211_vif *vif),
1630 void *data);
1631
1632/**
1612 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 1633 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1613 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1634 * @hw: pointer as obtained from ieee80211_alloc_hw().
1614 * @ra: receiver address of the BA session recipient 1635 * @ra: receiver address of the BA session recipient
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 9c451ff2f4f4..a01b7c4dc763 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -129,6 +129,10 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
129 void __user *buffer, 129 void __user *buffer,
130 size_t *lenp, 130 size_t *lenp,
131 loff_t *ppos); 131 loff_t *ppos);
132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,
133 int nlen, void __user *oldval,
134 size_t __user *oldlenp,
135 void __user *newval, size_t newlen);
132#endif 136#endif
133 137
134extern void inet6_ifinfo_notify(int event, 138extern void inet6_ifinfo_notify(int event,
diff --git a/include/net/netlink.h b/include/net/netlink.h
index a5506c42f03c..dfc3701dfcc3 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -556,14 +556,12 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
556 * @skb: socket buffer the message is stored in 556 * @skb: socket buffer the message is stored in
557 * @mark: mark to trim to 557 * @mark: mark to trim to
558 * 558 *
559 * Trims the message to the provided mark. Returns -1. 559 * Trims the message to the provided mark.
560 */ 560 */
561static inline int nlmsg_trim(struct sk_buff *skb, const void *mark) 561static inline void nlmsg_trim(struct sk_buff *skb, const void *mark)
562{ 562{
563 if (mark) 563 if (mark)
564 skb_trim(skb, (unsigned char *) mark - skb->data); 564 skb_trim(skb, (unsigned char *) mark - skb->data);
565
566 return -1;
567} 565}
568 566
569/** 567/**
@@ -572,11 +570,11 @@ static inline int nlmsg_trim(struct sk_buff *skb, const void *mark)
572 * @nlh: netlink message header 570 * @nlh: netlink message header
573 * 571 *
574 * Removes the complete netlink message including all 572 * Removes the complete netlink message including all
575 * attributes from the socket buffer again. Returns -1. 573 * attributes from the socket buffer again.
576 */ 574 */
577static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) 575static inline void nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh)
578{ 576{
579 return nlmsg_trim(skb, nlh); 577 nlmsg_trim(skb, nlh);
580} 578}
581 579
582/** 580/**
@@ -772,12 +770,13 @@ static inline int __nla_parse_nested_compat(struct nlattr *tb[], int maxtype,
772 const struct nla_policy *policy, 770 const struct nla_policy *policy,
773 int len) 771 int len)
774{ 772{
775 if (nla_len(nla) < len) 773 int nested_len = nla_len(nla) - NLA_ALIGN(len);
776 return -1; 774
777 if (nla_len(nla) >= NLA_ALIGN(len) + sizeof(struct nlattr)) 775 if (nested_len < 0)
778 return nla_parse_nested(tb, maxtype, 776 return -EINVAL;
779 nla_data(nla) + NLA_ALIGN(len), 777 if (nested_len >= nla_attr_size(0))
780 policy); 778 return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
779 nested_len, policy);
781 memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); 780 memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
782 return 0; 781 return 0;
783} 782}
@@ -1079,11 +1078,11 @@ static inline int nla_nest_compat_end(struct sk_buff *skb, struct nlattr *start)
1079 * @start: container attribute 1078 * @start: container attribute
1080 * 1079 *
1081 * Removes the container attribute and including all nested 1080 * Removes the container attribute and including all nested
1082 * attributes. Returns -1. 1081 * attributes. Returns -EMSGSIZE
1083 */ 1082 */
1084static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) 1083static inline void nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
1085{ 1084{
1086 return nlmsg_trim(skb, start); 1085 nlmsg_trim(skb, start);
1087} 1086}
1088 1087
1089/** 1088/**
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b220b5f624de..0c96e7bed5db 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -115,8 +115,8 @@ struct request_sock_queue {
115 struct request_sock *rskq_accept_head; 115 struct request_sock *rskq_accept_head;
116 struct request_sock *rskq_accept_tail; 116 struct request_sock *rskq_accept_tail;
117 rwlock_t syn_wait_lock; 117 rwlock_t syn_wait_lock;
118 u16 rskq_defer_accept; 118 u8 rskq_defer_accept;
119 /* 2 bytes hole, try to pack */ 119 /* 3 bytes hole, try to pack */
120 struct listen_sock *listen_opt; 120 struct listen_sock *listen_opt;
121}; 121};
122 122
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0ce0443c5b79..7f25195f9855 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -548,7 +548,8 @@ struct sctp_af {
548 struct dst_entry *(*get_dst) (struct sctp_association *asoc, 548 struct dst_entry *(*get_dst) (struct sctp_association *asoc,
549 union sctp_addr *daddr, 549 union sctp_addr *daddr,
550 union sctp_addr *saddr); 550 union sctp_addr *saddr);
551 void (*get_saddr) (struct sctp_association *asoc, 551 void (*get_saddr) (struct sctp_sock *sk,
552 struct sctp_association *asoc,
552 struct dst_entry *dst, 553 struct dst_entry *dst,
553 union sctp_addr *daddr, 554 union sctp_addr *daddr,
554 union sctp_addr *saddr); 555 union sctp_addr *saddr);
@@ -587,6 +588,7 @@ struct sctp_af {
587 int (*is_ce) (const struct sk_buff *sk); 588 int (*is_ce) (const struct sk_buff *sk);
588 void (*seq_dump_addr)(struct seq_file *seq, 589 void (*seq_dump_addr)(struct seq_file *seq,
589 union sctp_addr *addr); 590 union sctp_addr *addr);
591 void (*ecn_capable)(struct sock *sk);
590 __u16 net_header_len; 592 __u16 net_header_len;
591 int sockaddr_len; 593 int sockaddr_len;
592 sa_family_t sa_family; 594 sa_family_t sa_family;
@@ -901,7 +903,10 @@ struct sctp_transport {
901 * calculation completes (i.e. the DATA chunk 903 * calculation completes (i.e. the DATA chunk
902 * is SACK'd) clear this flag. 904 * is SACK'd) clear this flag.
903 */ 905 */
904 int rto_pending; 906 __u8 rto_pending;
907
908 /* Flag to track the current fast recovery state */
909 __u8 fast_recovery;
905 910
906 /* 911 /*
907 * These are the congestion stats. 912 * These are the congestion stats.
@@ -920,6 +925,9 @@ struct sctp_transport {
920 /* Data that has been sent, but not acknowledged. */ 925 /* Data that has been sent, but not acknowledged. */
921 __u32 flight_size; 926 __u32 flight_size;
922 927
928 /* TSN marking the fast recovery exit point */
929 __u32 fast_recovery_exit;
930
923 /* Destination */ 931 /* Destination */
924 struct dst_entry *dst; 932 struct dst_entry *dst;
925 /* Source address. */ 933 /* Source address. */
@@ -1044,7 +1052,7 @@ void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
1044 struct sctp_sock *); 1052 struct sctp_sock *);
1045void sctp_transport_pmtu(struct sctp_transport *); 1053void sctp_transport_pmtu(struct sctp_transport *);
1046void sctp_transport_free(struct sctp_transport *); 1054void sctp_transport_free(struct sctp_transport *);
1047void sctp_transport_reset_timers(struct sctp_transport *); 1055void sctp_transport_reset_timers(struct sctp_transport *, int);
1048void sctp_transport_hold(struct sctp_transport *); 1056void sctp_transport_hold(struct sctp_transport *);
1049void sctp_transport_put(struct sctp_transport *); 1057void sctp_transport_put(struct sctp_transport *);
1050void sctp_transport_update_rto(struct sctp_transport *, __u32); 1058void sctp_transport_update_rto(struct sctp_transport *, __u32);
@@ -1134,6 +1142,9 @@ struct sctp_outq {
1134 /* How many unackd bytes do we have in-flight? */ 1142 /* How many unackd bytes do we have in-flight? */
1135 __u32 outstanding_bytes; 1143 __u32 outstanding_bytes;
1136 1144
1145 /* Are we doing fast-rtx on this queue */
1146 char fast_rtx;
1147
1137 /* Corked? */ 1148 /* Corked? */
1138 char cork; 1149 char cork;
1139 1150
diff --git a/include/net/syncppp.h b/include/net/syncppp.h
index 877efa434700..e43f4070d892 100644
--- a/include/net/syncppp.h
+++ b/include/net/syncppp.h
@@ -59,7 +59,7 @@ struct ppp_device
59 59
60static inline struct sppp *sppp_of(struct net_device *dev) 60static inline struct sppp *sppp_of(struct net_device *dev)
61{ 61{
62 struct ppp_device **ppp = dev->priv; 62 struct ppp_device **ppp = dev->ml_priv;
63 BUG_ON((*ppp)->dev != dev); 63 BUG_ON((*ppp)->dev != dev);
64 return &(*ppp)->sppp; 64 return &(*ppp)->sppp;
65} 65}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 633147cb6bbc..cf54034019d9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -139,7 +139,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
139#define MAX_TCP_KEEPINTVL 32767 139#define MAX_TCP_KEEPINTVL 32767
140#define MAX_TCP_KEEPCNT 127 140#define MAX_TCP_KEEPCNT 127
141#define MAX_TCP_SYNCNT 127 141#define MAX_TCP_SYNCNT 127
142#define MAX_TCP_ACCEPT_DEFERRED 65535
143 142
144#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */ 143#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
145 144
@@ -433,7 +432,6 @@ extern struct sk_buff * tcp_make_synack(struct sock *sk,
433 432
434extern int tcp_disconnect(struct sock *sk, int flags); 433extern int tcp_disconnect(struct sock *sk, int flags);
435 434
436extern void tcp_unhash(struct sock *sk);
437 435
438/* From syncookies.c */ 436/* From syncookies.c */
439extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 437extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 27394e0447d8..112934a3288d 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -40,7 +40,8 @@ extern int datagram_recv_ctl(struct sock *sk,
40 struct msghdr *msg, 40 struct msghdr *msg,
41 struct sk_buff *skb); 41 struct sk_buff *skb);
42 42
43extern int datagram_send_ctl(struct msghdr *msg, 43extern int datagram_send_ctl(struct net *net,
44 struct msghdr *msg,
44 struct flowi *fl, 45 struct flowi *fl,
45 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
46 int *hlimit, int *tclass); 47 int *hlimit, int *tclass);
diff --git a/include/net/udp.h b/include/net/udp.h
index 3e55a99b0ba3..ccce83707046 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -135,6 +135,7 @@ extern void udp_err(struct sk_buff *, u32);
135 135
136extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 136extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
137 struct msghdr *msg, size_t len); 137 struct msghdr *msg, size_t len);
138extern void udp_flush_pending_frames(struct sock *sk);
138 139
139extern int udp_rcv(struct sk_buff *skb); 140extern int udp_rcv(struct sk_buff *skb);
140extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 141extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 911a661b7278..31d30b1852e8 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -105,7 +105,6 @@ enum ib_device_cap_flags {
105 */ 105 */
106 IB_DEVICE_UD_IP_CSUM = (1<<18), 106 IB_DEVICE_UD_IP_CSUM = (1<<18),
107 IB_DEVICE_UD_TSO = (1<<19), 107 IB_DEVICE_UD_TSO = (1<<19),
108 IB_DEVICE_SEND_W_INV = (1<<21),
109}; 108};
110 109
111enum ib_atomic_cap { 110enum ib_atomic_cap {
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 049edc5e6461..9c309daf492b 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -505,6 +505,7 @@ struct snd_ac97 {
505 unsigned short pcmreg[3]; // PCM registers 505 unsigned short pcmreg[3]; // PCM registers
506 unsigned short codec_cfg[3]; // CODEC_CFG bits 506 unsigned short codec_cfg[3]; // CODEC_CFG bits
507 unsigned char swap_mic_linein; // AD1986/AD1986A only 507 unsigned char swap_mic_linein; // AD1986/AD1986A only
508 unsigned char lo_as_master; /* LO as master */
508 } ad18xx; 509 } ad18xx;
509 unsigned int dev_flags; /* device specific */ 510 unsigned int dev_flags; /* device specific */
510 } spec; 511 } spec;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e6ea6f750941..d3c8c033dff8 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -238,7 +238,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
238 struct snd_ctl_elem_info *uinfo); 238 struct snd_ctl_elem_info *uinfo);
239int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, 239int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
240 struct snd_ctl_elem_info *uinfo); 240 struct snd_ctl_elem_info *uinfo);
241#define snd_soc_info_bool_ext snd_ctl_boolean_mono 241#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
242int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, 242int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
243 struct snd_ctl_elem_value *ucontrol); 243 struct snd_ctl_elem_value *ucontrol);
244int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, 244int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
diff --git a/init/Kconfig b/init/Kconfig
index 6135d07f31ec..6199d1120900 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -13,6 +13,7 @@ config DEFCONFIG_LIST
13 default "/lib/modules/$UNAME_RELEASE/.config" 13 default "/lib/modules/$UNAME_RELEASE/.config"
14 default "/etc/kernel-config" 14 default "/etc/kernel-config"
15 default "/boot/config-$UNAME_RELEASE" 15 default "/boot/config-$UNAME_RELEASE"
16 default "$ARCH_DEFCONFIG"
16 default "arch/$ARCH/defconfig" 17 default "arch/$ARCH/defconfig"
17 18
18menu "General setup" 19menu "General setup"
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 3885e70e7759..660c1e50c91b 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -76,6 +76,7 @@ dev_t name_to_dev_t(char *name)
76 char s[32]; 76 char s[32];
77 char *p; 77 char *p;
78 dev_t res = 0; 78 dev_t res = 0;
79 int part;
79 80
80 if (strncmp(name, "/dev/", 5) != 0) { 81 if (strncmp(name, "/dev/", 5) != 0) {
81 unsigned maj, min; 82 unsigned maj, min;
@@ -106,7 +107,31 @@ dev_t name_to_dev_t(char *name)
106 for (p = s; *p; p++) 107 for (p = s; *p; p++)
107 if (*p == '/') 108 if (*p == '/')
108 *p = '!'; 109 *p = '!';
109 res = blk_lookup_devt(s); 110 res = blk_lookup_devt(s, 0);
111 if (res)
112 goto done;
113
114 /*
115 * try non-existant, but valid partition, which may only exist
116 * after revalidating the disk, like partitioned md devices
117 */
118 while (p > s && isdigit(p[-1]))
119 p--;
120 if (p == s || !*p || *p == '0')
121 goto fail;
122
123 /* try disk name without <part number> */
124 part = simple_strtoul(p, NULL, 10);
125 *p = '\0';
126 res = blk_lookup_devt(s, part);
127 if (res)
128 goto done;
129
130 /* try disk name without p<part number> */
131 if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
132 goto fail;
133 p[-1] = '\0';
134 res = blk_lookup_devt(s, part);
110 if (res) 135 if (res)
111 goto done; 136 goto done;
112 137
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 7473b0c59d4d..693d24694a6c 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -24,7 +24,6 @@ static struct {
24 24
25static int md_setup_ents __initdata; 25static int md_setup_ents __initdata;
26 26
27extern int mdp_major;
28/* 27/*
29 * Parse the command-line parameters given our kernel, but do not 28 * Parse the command-line parameters given our kernel, but do not
30 * actually try to invoke the MD device now; that is handled by 29 * actually try to invoke the MD device now; that is handled by
diff --git a/init/main.c b/init/main.c
index ddada7acf363..f7fb20021d48 100644
--- a/init/main.c
+++ b/init/main.c
@@ -693,55 +693,57 @@ static int __init initcall_debug_setup(char *str)
693} 693}
694__setup("initcall_debug", initcall_debug_setup); 694__setup("initcall_debug", initcall_debug_setup);
695 695
696extern initcall_t __initcall_start[], __initcall_end[]; 696static void __init do_one_initcall(initcall_t fn)
697
698static void __init do_initcalls(void)
699{ 697{
700 initcall_t *call;
701 int count = preempt_count(); 698 int count = preempt_count();
699 ktime_t t0, t1, delta;
700 char msgbuf[64];
701 int result;
702 702
703 for (call = __initcall_start; call < __initcall_end; call++) { 703 if (initcall_debug) {
704 ktime_t t0, t1, delta; 704 print_fn_descriptor_symbol("calling %s\n", fn);
705 char *msg = NULL; 705 t0 = ktime_get();
706 char msgbuf[40]; 706 }
707 int result;
708 707
709 if (initcall_debug) { 708 result = fn();
710 print_fn_descriptor_symbol("calling %s()\n",
711 (unsigned long) *call);
712 t0 = ktime_get();
713 }
714 709
715 result = (*call)(); 710 if (initcall_debug) {
711 t1 = ktime_get();
712 delta = ktime_sub(t1, t0);
716 713
717 if (initcall_debug) { 714 print_fn_descriptor_symbol("initcall %s", fn);
718 t1 = ktime_get(); 715 printk(" returned %d after %Ld msecs\n", result,
719 delta = ktime_sub(t1, t0); 716 (unsigned long long) delta.tv64 >> 20);
717 }
720 718
721 print_fn_descriptor_symbol("initcall %s()", 719 msgbuf[0] = 0;
722 (unsigned long) *call);
723 printk(" returned %d after %Ld msecs\n", result,
724 (unsigned long long) delta.tv64 >> 20);
725 }
726 720
727 if (result && result != -ENODEV && initcall_debug) { 721 if (result && result != -ENODEV && initcall_debug)
728 sprintf(msgbuf, "error code %d", result); 722 sprintf(msgbuf, "error code %d ", result);
729 msg = msgbuf; 723
730 } 724 if (preempt_count() != count) {
731 if (preempt_count() != count) { 725 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
732 msg = "preemption imbalance"; 726 preempt_count() = count;
733 preempt_count() = count; 727 }
734 } 728 if (irqs_disabled()) {
735 if (irqs_disabled()) { 729 strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
736 msg = "disabled interrupts"; 730 local_irq_enable();
737 local_irq_enable(); 731 }
738 } 732 if (msgbuf[0]) {
739 if (msg) { 733 print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
740 print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", 734 printk(" returned with %s\n", msgbuf);
741 (unsigned long) *call);
742 printk(" returned with %s\n", msg);
743 }
744 } 735 }
736}
737
738
739extern initcall_t __initcall_start[], __initcall_end[];
740
741static void __init do_initcalls(void)
742{
743 initcall_t *call;
744
745 for (call = __initcall_start; call < __initcall_end; call++)
746 do_one_initcall(*call);
745 747
746 /* Make sure there is no pending stuff from the initcall sequence */ 748 /* Make sure there is no pending stuff from the initcall sequence */
747 flush_scheduled_work(); 749 flush_scheduled_work();
diff --git a/ipc/msg.c b/ipc/msg.c
index 32494e8cc7a5..b4eee1c6101d 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -98,20 +98,15 @@ void recompute_msgmni(struct ipc_namespace *ns)
98 98
99 if (allowed < MSGMNI) { 99 if (allowed < MSGMNI) {
100 ns->msg_ctlmni = MSGMNI; 100 ns->msg_ctlmni = MSGMNI;
101 goto out_callback; 101 return;
102 } 102 }
103 103
104 if (allowed > IPCMNI / nb_ns) { 104 if (allowed > IPCMNI / nb_ns) {
105 ns->msg_ctlmni = IPCMNI / nb_ns; 105 ns->msg_ctlmni = IPCMNI / nb_ns;
106 goto out_callback; 106 return;
107 } 107 }
108 108
109 ns->msg_ctlmni = allowed; 109 ns->msg_ctlmni = allowed;
110
111out_callback:
112
113 printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n",
114 ns->msg_ctlmni, ns);
115} 110}
116 111
117void msg_init_ns(struct ipc_namespace *ns) 112void msg_init_ns(struct ipc_namespace *ns)
@@ -136,6 +131,10 @@ void msg_exit_ns(struct ipc_namespace *ns)
136void __init msg_init(void) 131void __init msg_init(void)
137{ 132{
138 msg_init_ns(&init_ipc_ns); 133 msg_init_ns(&init_ipc_ns);
134
135 printk(KERN_INFO "msgmni has been set to %d\n",
136 init_ipc_ns.msg_ctlmni);
137
139 ipc_init_proc_interface("sysvipc/msg", 138 ipc_init_proc_interface("sysvipc/msg",
140 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", 139 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
141 IPC_MSG_IDS, sysvipc_msg_proc_show); 140 IPC_MSG_IDS, sysvipc_msg_proc_show);
diff --git a/ipc/shm.c b/ipc/shm.c
index 554429ade079..790240cd067f 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -894,8 +894,6 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
894 if (!sfd) 894 if (!sfd)
895 goto out_put_dentry; 895 goto out_put_dentry;
896 896
897 err = -ENOMEM;
898
899 file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations); 897 file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
900 if (!file) 898 if (!file)
901 goto out_free; 899 goto out_free;
@@ -1060,16 +1058,16 @@ asmlinkage long sys_shmdt(char __user *shmaddr)
1060static int sysvipc_shm_proc_show(struct seq_file *s, void *it) 1058static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
1061{ 1059{
1062 struct shmid_kernel *shp = it; 1060 struct shmid_kernel *shp = it;
1063 char *format;
1064 1061
1065#define SMALL_STRING "%10d %10d %4o %10u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n" 1062#if BITS_PER_LONG <= 32
1066#define BIG_STRING "%10d %10d %4o %21u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n" 1063#define SIZE_SPEC "%10lu"
1064#else
1065#define SIZE_SPEC "%21lu"
1066#endif
1067 1067
1068 if (sizeof(size_t) <= sizeof(int)) 1068 return seq_printf(s,
1069 format = SMALL_STRING; 1069 "%10d %10d %4o " SIZE_SPEC " %5u %5u "
1070 else 1070 "%5lu %5u %5u %5u %5u %10lu %10lu %10lu\n",
1071 format = BIG_STRING;
1072 return seq_printf(s, format,
1073 shp->shm_perm.key, 1071 shp->shm_perm.key,
1074 shp->shm_perm.id, 1072 shp->shm_perm.id,
1075 shp->shm_perm.mode, 1073 shp->shm_perm.mode,
diff --git a/kernel/audit.c b/kernel/audit.c
index b7d3709cc452..e8692a5748c2 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -572,16 +572,17 @@ void audit_send_reply(int pid, int seq, int type, int done, int multi,
572 572
573 skb = audit_make_reply(pid, seq, type, done, multi, payload, size); 573 skb = audit_make_reply(pid, seq, type, done, multi, payload, size);
574 if (!skb) 574 if (!skb)
575 return; 575 goto out;
576 576
577 reply->pid = pid; 577 reply->pid = pid;
578 reply->skb = skb; 578 reply->skb = skb;
579 579
580 tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); 580 tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply");
581 if (IS_ERR(tsk)) { 581 if (!IS_ERR(tsk))
582 kfree(reply); 582 return;
583 kfree_skb(skb); 583 kfree_skb(skb);
584 } 584out:
585 kfree(reply);
585} 586}
586 587
587/* 588/*
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 9ef5e0aacc3c..f7921a2ecf16 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -172,10 +172,9 @@ static void insert_hash(struct audit_chunk *chunk)
172struct audit_chunk *audit_tree_lookup(const struct inode *inode) 172struct audit_chunk *audit_tree_lookup(const struct inode *inode)
173{ 173{
174 struct list_head *list = chunk_hash(inode); 174 struct list_head *list = chunk_hash(inode);
175 struct list_head *pos; 175 struct audit_chunk *p;
176 176
177 list_for_each_rcu(pos, list) { 177 list_for_each_entry_rcu(p, list, hash) {
178 struct audit_chunk *p = container_of(pos, struct audit_chunk, hash);
179 if (p->watch.inode == inode) { 178 if (p->watch.inode == inode) {
180 get_inotify_watch(&p->watch); 179 get_inotify_watch(&p->watch);
181 return p; 180 return p;
diff --git a/kernel/capability.c b/kernel/capability.c
index 39e8193b41ea..cfbe44299488 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -53,6 +53,69 @@ static void warn_legacy_capability_use(void)
53} 53}
54 54
55/* 55/*
56 * Version 2 capabilities worked fine, but the linux/capability.h file
57 * that accompanied their introduction encouraged their use without
58 * the necessary user-space source code changes. As such, we have
59 * created a version 3 with equivalent functionality to version 2, but
60 * with a header change to protect legacy source code from using
61 * version 2 when it wanted to use version 1. If your system has code
62 * that trips the following warning, it is using version 2 specific
63 * capabilities and may be doing so insecurely.
64 *
65 * The remedy is to either upgrade your version of libcap (to 2.10+,
66 * if the application is linked against it), or recompile your
67 * application with modern kernel headers and this warning will go
68 * away.
69 */
70
71static void warn_deprecated_v2(void)
72{
73 static int warned;
74
75 if (!warned) {
76 char name[sizeof(current->comm)];
77
78 printk(KERN_INFO "warning: `%s' uses deprecated v2"
79 " capabilities in a way that may be insecure.\n",
80 get_task_comm(name, current));
81 warned = 1;
82 }
83}
84
85/*
86 * Version check. Return the number of u32s in each capability flag
87 * array, or a negative value on error.
88 */
89static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy)
90{
91 __u32 version;
92
93 if (get_user(version, &header->version))
94 return -EFAULT;
95
96 switch (version) {
97 case _LINUX_CAPABILITY_VERSION_1:
98 warn_legacy_capability_use();
99 *tocopy = _LINUX_CAPABILITY_U32S_1;
100 break;
101 case _LINUX_CAPABILITY_VERSION_2:
102 warn_deprecated_v2();
103 /*
104 * fall through - v3 is otherwise equivalent to v2.
105 */
106 case _LINUX_CAPABILITY_VERSION_3:
107 *tocopy = _LINUX_CAPABILITY_U32S_3;
108 break;
109 default:
110 if (put_user((u32)_KERNEL_CAPABILITY_VERSION, &header->version))
111 return -EFAULT;
112 return -EINVAL;
113 }
114
115 return 0;
116}
117
118/*
56 * For sys_getproccap() and sys_setproccap(), any of the three 119 * For sys_getproccap() and sys_setproccap(), any of the three
57 * capability set pointers may be NULL -- indicating that that set is 120 * capability set pointers may be NULL -- indicating that that set is
58 * uninteresting and/or not to be changed. 121 * uninteresting and/or not to be changed.
@@ -71,27 +134,13 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
71{ 134{
72 int ret = 0; 135 int ret = 0;
73 pid_t pid; 136 pid_t pid;
74 __u32 version;
75 struct task_struct *target; 137 struct task_struct *target;
76 unsigned tocopy; 138 unsigned tocopy;
77 kernel_cap_t pE, pI, pP; 139 kernel_cap_t pE, pI, pP;
78 140
79 if (get_user(version, &header->version)) 141 ret = cap_validate_magic(header, &tocopy);
80 return -EFAULT; 142 if (ret != 0)
81 143 return ret;
82 switch (version) {
83 case _LINUX_CAPABILITY_VERSION_1:
84 warn_legacy_capability_use();
85 tocopy = _LINUX_CAPABILITY_U32S_1;
86 break;
87 case _LINUX_CAPABILITY_VERSION_2:
88 tocopy = _LINUX_CAPABILITY_U32S_2;
89 break;
90 default:
91 if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))
92 return -EFAULT;
93 return -EINVAL;
94 }
95 144
96 if (get_user(pid, &header->pid)) 145 if (get_user(pid, &header->pid))
97 return -EFAULT; 146 return -EFAULT;
@@ -118,7 +167,7 @@ out:
118 spin_unlock(&task_capability_lock); 167 spin_unlock(&task_capability_lock);
119 168
120 if (!ret) { 169 if (!ret) {
121 struct __user_cap_data_struct kdata[_LINUX_CAPABILITY_U32S]; 170 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
122 unsigned i; 171 unsigned i;
123 172
124 for (i = 0; i < tocopy; i++) { 173 for (i = 0; i < tocopy; i++) {
@@ -128,7 +177,7 @@ out:
128 } 177 }
129 178
130 /* 179 /*
131 * Note, in the case, tocopy < _LINUX_CAPABILITY_U32S, 180 * Note, in the case, tocopy < _KERNEL_CAPABILITY_U32S,
132 * we silently drop the upper capabilities here. This 181 * we silently drop the upper capabilities here. This
133 * has the effect of making older libcap 182 * has the effect of making older libcap
134 * implementations implicitly drop upper capability 183 * implementations implicitly drop upper capability
@@ -240,30 +289,16 @@ static inline int cap_set_all(kernel_cap_t *effective,
240 */ 289 */
241asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) 290asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
242{ 291{
243 struct __user_cap_data_struct kdata[_LINUX_CAPABILITY_U32S]; 292 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
244 unsigned i, tocopy; 293 unsigned i, tocopy;
245 kernel_cap_t inheritable, permitted, effective; 294 kernel_cap_t inheritable, permitted, effective;
246 __u32 version;
247 struct task_struct *target; 295 struct task_struct *target;
248 int ret; 296 int ret;
249 pid_t pid; 297 pid_t pid;
250 298
251 if (get_user(version, &header->version)) 299 ret = cap_validate_magic(header, &tocopy);
252 return -EFAULT; 300 if (ret != 0)
253 301 return ret;
254 switch (version) {
255 case _LINUX_CAPABILITY_VERSION_1:
256 warn_legacy_capability_use();
257 tocopy = _LINUX_CAPABILITY_U32S_1;
258 break;
259 case _LINUX_CAPABILITY_VERSION_2:
260 tocopy = _LINUX_CAPABILITY_U32S_2;
261 break;
262 default:
263 if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))
264 return -EFAULT;
265 return -EINVAL;
266 }
267 302
268 if (get_user(pid, &header->pid)) 303 if (get_user(pid, &header->pid))
269 return -EFAULT; 304 return -EFAULT;
@@ -281,7 +316,7 @@ asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
281 permitted.cap[i] = kdata[i].permitted; 316 permitted.cap[i] = kdata[i].permitted;
282 inheritable.cap[i] = kdata[i].inheritable; 317 inheritable.cap[i] = kdata[i].inheritable;
283 } 318 }
284 while (i < _LINUX_CAPABILITY_U32S) { 319 while (i < _KERNEL_CAPABILITY_U32S) {
285 effective.cap[i] = 0; 320 effective.cap[i] = 0;
286 permitted.cap[i] = 0; 321 permitted.cap[i] = 0;
287 inheritable.cap[i] = 0; 322 inheritable.cap[i] = 0;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index fbc6fc8949b4..15ac0e1e4f4d 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2903,7 +2903,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2903 cg = tsk->cgroups; 2903 cg = tsk->cgroups;
2904 parent = task_cgroup(tsk, subsys->subsys_id); 2904 parent = task_cgroup(tsk, subsys->subsys_id);
2905 2905
2906 snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "node_%d", tsk->pid); 2906 snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "%d", tsk->pid);
2907 2907
2908 /* Pin the hierarchy */ 2908 /* Pin the hierarchy */
2909 atomic_inc(&parent->root->sb->s_active); 2909 atomic_inc(&parent->root->sb->s_active);
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 86ea9e34e326..039baa4cd90c 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -797,8 +797,10 @@ static int update_cpumask(struct cpuset *cs, char *buf)
797 retval = cpulist_parse(buf, trialcs.cpus_allowed); 797 retval = cpulist_parse(buf, trialcs.cpus_allowed);
798 if (retval < 0) 798 if (retval < 0)
799 return retval; 799 return retval;
800
801 if (!cpus_subset(trialcs.cpus_allowed, cpu_online_map))
802 return -EINVAL;
800 } 803 }
801 cpus_and(trialcs.cpus_allowed, trialcs.cpus_allowed, cpu_online_map);
802 retval = validate_change(cs, &trialcs); 804 retval = validate_change(cs, &trialcs);
803 if (retval < 0) 805 if (retval < 0)
804 return retval; 806 return retval;
@@ -932,9 +934,11 @@ static int update_nodemask(struct cpuset *cs, char *buf)
932 retval = nodelist_parse(buf, trialcs.mems_allowed); 934 retval = nodelist_parse(buf, trialcs.mems_allowed);
933 if (retval < 0) 935 if (retval < 0)
934 goto done; 936 goto done;
937
938 if (!nodes_subset(trialcs.mems_allowed,
939 node_states[N_HIGH_MEMORY]))
940 return -EINVAL;
935 } 941 }
936 nodes_and(trialcs.mems_allowed, trialcs.mems_allowed,
937 node_states[N_HIGH_MEMORY]);
938 oldmem = cs->mems_allowed; 942 oldmem = cs->mems_allowed;
939 if (nodes_equal(oldmem, trialcs.mems_allowed)) { 943 if (nodes_equal(oldmem, trialcs.mems_allowed)) {
940 retval = 0; /* Too easy - nothing to do */ 944 retval = 0; /* Too easy - nothing to do */
diff --git a/kernel/exit.c b/kernel/exit.c
index 1510f78a0ffa..8f6185e69b69 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -126,6 +126,12 @@ static void __exit_signal(struct task_struct *tsk)
126 126
127 __unhash_process(tsk); 127 __unhash_process(tsk);
128 128
129 /*
130 * Do this under ->siglock, we can race with another thread
131 * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals.
132 */
133 flush_sigqueue(&tsk->pending);
134
129 tsk->signal = NULL; 135 tsk->signal = NULL;
130 tsk->sighand = NULL; 136 tsk->sighand = NULL;
131 spin_unlock(&sighand->siglock); 137 spin_unlock(&sighand->siglock);
@@ -133,7 +139,6 @@ static void __exit_signal(struct task_struct *tsk)
133 139
134 __cleanup_sighand(sighand); 140 __cleanup_sighand(sighand);
135 clear_tsk_thread_flag(tsk,TIF_SIGPENDING); 141 clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
136 flush_sigqueue(&tsk->pending);
137 if (sig) { 142 if (sig) {
138 flush_sigqueue(&sig->shared_pending); 143 flush_sigqueue(&sig->shared_pending);
139 taskstats_tgid_free(sig); 144 taskstats_tgid_free(sig);
diff --git a/kernel/fork.c b/kernel/fork.c
index 933e60ebccae..19908b26cf80 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -660,136 +660,6 @@ static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
660 return 0; 660 return 0;
661} 661}
662 662
663static int count_open_files(struct fdtable *fdt)
664{
665 int size = fdt->max_fds;
666 int i;
667
668 /* Find the last open fd */
669 for (i = size/(8*sizeof(long)); i > 0; ) {
670 if (fdt->open_fds->fds_bits[--i])
671 break;
672 }
673 i = (i+1) * 8 * sizeof(long);
674 return i;
675}
676
677static struct files_struct *alloc_files(void)
678{
679 struct files_struct *newf;
680 struct fdtable *fdt;
681
682 newf = kmem_cache_alloc(files_cachep, GFP_KERNEL);
683 if (!newf)
684 goto out;
685
686 atomic_set(&newf->count, 1);
687
688 spin_lock_init(&newf->file_lock);
689 newf->next_fd = 0;
690 fdt = &newf->fdtab;
691 fdt->max_fds = NR_OPEN_DEFAULT;
692 fdt->close_on_exec = (fd_set *)&newf->close_on_exec_init;
693 fdt->open_fds = (fd_set *)&newf->open_fds_init;
694 fdt->fd = &newf->fd_array[0];
695 INIT_RCU_HEAD(&fdt->rcu);
696 fdt->next = NULL;
697 rcu_assign_pointer(newf->fdt, fdt);
698out:
699 return newf;
700}
701
702/*
703 * Allocate a new files structure and copy contents from the
704 * passed in files structure.
705 * errorp will be valid only when the returned files_struct is NULL.
706 */
707static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
708{
709 struct files_struct *newf;
710 struct file **old_fds, **new_fds;
711 int open_files, size, i;
712 struct fdtable *old_fdt, *new_fdt;
713
714 *errorp = -ENOMEM;
715 newf = alloc_files();
716 if (!newf)
717 goto out;
718
719 spin_lock(&oldf->file_lock);
720 old_fdt = files_fdtable(oldf);
721 new_fdt = files_fdtable(newf);
722 open_files = count_open_files(old_fdt);
723
724 /*
725 * Check whether we need to allocate a larger fd array and fd set.
726 * Note: we're not a clone task, so the open count won't change.
727 */
728 if (open_files > new_fdt->max_fds) {
729 new_fdt->max_fds = 0;
730 spin_unlock(&oldf->file_lock);
731 spin_lock(&newf->file_lock);
732 *errorp = expand_files(newf, open_files-1);
733 spin_unlock(&newf->file_lock);
734 if (*errorp < 0)
735 goto out_release;
736 new_fdt = files_fdtable(newf);
737 /*
738 * Reacquire the oldf lock and a pointer to its fd table
739 * who knows it may have a new bigger fd table. We need
740 * the latest pointer.
741 */
742 spin_lock(&oldf->file_lock);
743 old_fdt = files_fdtable(oldf);
744 }
745
746 old_fds = old_fdt->fd;
747 new_fds = new_fdt->fd;
748
749 memcpy(new_fdt->open_fds->fds_bits,
750 old_fdt->open_fds->fds_bits, open_files/8);
751 memcpy(new_fdt->close_on_exec->fds_bits,
752 old_fdt->close_on_exec->fds_bits, open_files/8);
753
754 for (i = open_files; i != 0; i--) {
755 struct file *f = *old_fds++;
756 if (f) {
757 get_file(f);
758 } else {
759 /*
760 * The fd may be claimed in the fd bitmap but not yet
761 * instantiated in the files array if a sibling thread
762 * is partway through open(). So make sure that this
763 * fd is available to the new process.
764 */
765 FD_CLR(open_files - i, new_fdt->open_fds);
766 }
767 rcu_assign_pointer(*new_fds++, f);
768 }
769 spin_unlock(&oldf->file_lock);
770
771 /* compute the remainder to be cleared */
772 size = (new_fdt->max_fds - open_files) * sizeof(struct file *);
773
774 /* This is long word aligned thus could use a optimized version */
775 memset(new_fds, 0, size);
776
777 if (new_fdt->max_fds > open_files) {
778 int left = (new_fdt->max_fds-open_files)/8;
779 int start = open_files / (8 * sizeof(unsigned long));
780
781 memset(&new_fdt->open_fds->fds_bits[start], 0, left);
782 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
783 }
784
785 return newf;
786
787out_release:
788 kmem_cache_free(files_cachep, newf);
789out:
790 return NULL;
791}
792
793static int copy_files(unsigned long clone_flags, struct task_struct * tsk) 663static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
794{ 664{
795 struct files_struct *oldf, *newf; 665 struct files_struct *oldf, *newf;
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 39e31a036f5b..79e3c90113c2 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -52,6 +52,7 @@
52#include <asm/byteorder.h> 52#include <asm/byteorder.h>
53#include <asm/atomic.h> 53#include <asm/atomic.h>
54#include <asm/system.h> 54#include <asm/system.h>
55#include <asm/unaligned.h>
55 56
56static int kgdb_break_asap; 57static int kgdb_break_asap;
57 58
@@ -227,8 +228,6 @@ void __weak kgdb_disable_hw_debug(struct pt_regs *regs)
227 * GDB remote protocol parser: 228 * GDB remote protocol parser:
228 */ 229 */
229 230
230static const char hexchars[] = "0123456789abcdef";
231
232static int hex(char ch) 231static int hex(char ch)
233{ 232{
234 if ((ch >= 'a') && (ch <= 'f')) 233 if ((ch >= 'a') && (ch <= 'f'))
@@ -316,8 +315,8 @@ static void put_packet(char *buffer)
316 } 315 }
317 316
318 kgdb_io_ops->write_char('#'); 317 kgdb_io_ops->write_char('#');
319 kgdb_io_ops->write_char(hexchars[checksum >> 4]); 318 kgdb_io_ops->write_char(hex_asc_hi(checksum));
320 kgdb_io_ops->write_char(hexchars[checksum & 0xf]); 319 kgdb_io_ops->write_char(hex_asc_lo(checksum));
321 if (kgdb_io_ops->flush) 320 if (kgdb_io_ops->flush)
322 kgdb_io_ops->flush(); 321 kgdb_io_ops->flush();
323 322
@@ -346,14 +345,6 @@ static void put_packet(char *buffer)
346 } 345 }
347} 346}
348 347
349static char *pack_hex_byte(char *pkt, u8 byte)
350{
351 *pkt++ = hexchars[byte >> 4];
352 *pkt++ = hexchars[byte & 0xf];
353
354 return pkt;
355}
356
357/* 348/*
358 * Convert the memory pointed to by mem into hex, placing result in buf. 349 * Convert the memory pointed to by mem into hex, placing result in buf.
359 * Return a pointer to the last char put in buf (null). May return an error. 350 * Return a pointer to the last char put in buf (null). May return an error.
@@ -486,8 +477,8 @@ static void error_packet(char *pkt, int error)
486{ 477{
487 error = -error; 478 error = -error;
488 pkt[0] = 'E'; 479 pkt[0] = 'E';
489 pkt[1] = hexchars[(error / 10)]; 480 pkt[1] = hex_asc[(error / 10)];
490 pkt[2] = hexchars[(error % 10)]; 481 pkt[2] = hex_asc[(error % 10)];
491 pkt[3] = '\0'; 482 pkt[3] = '\0';
492} 483}
493 484
@@ -518,10 +509,7 @@ static void int_to_threadref(unsigned char *id, int value)
518 scan = (unsigned char *)id; 509 scan = (unsigned char *)id;
519 while (i--) 510 while (i--)
520 *scan++ = 0; 511 *scan++ = 0;
521 *scan++ = (value >> 24) & 0xff; 512 put_unaligned_be32(value, scan);
522 *scan++ = (value >> 16) & 0xff;
523 *scan++ = (value >> 8) & 0xff;
524 *scan++ = (value & 0xff);
525} 513}
526 514
527static struct task_struct *getthread(struct pt_regs *regs, int tid) 515static struct task_struct *getthread(struct pt_regs *regs, int tid)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1e0250cb9486..d4998f81e229 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -699,8 +699,9 @@ static int __register_kprobes(struct kprobe **kps, int num,
699 return -EINVAL; 699 return -EINVAL;
700 for (i = 0; i < num; i++) { 700 for (i = 0; i < num; i++) {
701 ret = __register_kprobe(kps[i], called_from); 701 ret = __register_kprobe(kps[i], called_from);
702 if (ret < 0 && i > 0) { 702 if (ret < 0) {
703 unregister_kprobes(kps, i); 703 if (i > 0)
704 unregister_kprobes(kps, i);
704 break; 705 break;
705 } 706 }
706 } 707 }
@@ -776,8 +777,9 @@ static int __register_jprobes(struct jprobe **jps, int num,
776 jp->kp.break_handler = longjmp_break_handler; 777 jp->kp.break_handler = longjmp_break_handler;
777 ret = __register_kprobe(&jp->kp, called_from); 778 ret = __register_kprobe(&jp->kp, called_from);
778 } 779 }
779 if (ret < 0 && i > 0) { 780 if (ret < 0) {
780 unregister_jprobes(jps, i); 781 if (i > 0)
782 unregister_jprobes(jps, i);
781 break; 783 break;
782 } 784 }
783 } 785 }
@@ -920,8 +922,9 @@ static int __register_kretprobes(struct kretprobe **rps, int num,
920 return -EINVAL; 922 return -EINVAL;
921 for (i = 0; i < num; i++) { 923 for (i = 0; i < num; i++) {
922 ret = __register_kretprobe(rps[i], called_from); 924 ret = __register_kretprobe(rps[i], called_from);
923 if (ret < 0 && i > 0) { 925 if (ret < 0) {
924 unregister_kretprobes(rps, i); 926 if (i > 0)
927 unregister_kretprobes(rps, i);
925 break; 928 break;
926 } 929 }
927 } 930 }
diff --git a/kernel/module.c b/kernel/module.c
index f5e9491ef7ac..5f80478b746d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1337,7 +1337,19 @@ out_unreg:
1337 kobject_put(&mod->mkobj.kobj); 1337 kobject_put(&mod->mkobj.kobj);
1338 return err; 1338 return err;
1339} 1339}
1340#endif 1340
1341static void mod_sysfs_fini(struct module *mod)
1342{
1343 kobject_put(&mod->mkobj.kobj);
1344}
1345
1346#else /* CONFIG_SYSFS */
1347
1348static void mod_sysfs_fini(struct module *mod)
1349{
1350}
1351
1352#endif /* CONFIG_SYSFS */
1341 1353
1342static void mod_kobject_remove(struct module *mod) 1354static void mod_kobject_remove(struct module *mod)
1343{ 1355{
@@ -1345,7 +1357,7 @@ static void mod_kobject_remove(struct module *mod)
1345 module_param_sysfs_remove(mod); 1357 module_param_sysfs_remove(mod);
1346 kobject_put(mod->mkobj.drivers_dir); 1358 kobject_put(mod->mkobj.drivers_dir);
1347 kobject_put(mod->holders_dir); 1359 kobject_put(mod->holders_dir);
1348 kobject_put(&mod->mkobj.kobj); 1360 mod_sysfs_fini(mod);
1349} 1361}
1350 1362
1351/* 1363/*
@@ -1780,7 +1792,7 @@ static struct module *load_module(void __user *umod,
1780 1792
1781 /* Sanity checks against insmoding binaries or wrong arch, 1793 /* Sanity checks against insmoding binaries or wrong arch,
1782 weird elf version */ 1794 weird elf version */
1783 if (memcmp(hdr->e_ident, ELFMAG, 4) != 0 1795 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
1784 || hdr->e_type != ET_REL 1796 || hdr->e_type != ET_REL
1785 || !elf_check_arch(hdr) 1797 || !elf_check_arch(hdr)
1786 || hdr->e_shentsize != sizeof(*sechdrs)) { 1798 || hdr->e_shentsize != sizeof(*sechdrs)) {
diff --git a/kernel/relay.c b/kernel/relay.c
index bc24dcdc570f..7de644cdec43 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -1191,7 +1191,7 @@ static ssize_t relay_file_splice_read(struct file *in,
1191 ret = 0; 1191 ret = 0;
1192 spliced = 0; 1192 spliced = 0;
1193 1193
1194 while (len) { 1194 while (len && !spliced) {
1195 ret = subbuf_splice_actor(in, ppos, pipe, len, flags, &nonpad_ret); 1195 ret = subbuf_splice_actor(in, ppos, pipe, len, flags, &nonpad_ret);
1196 if (ret < 0) 1196 if (ret < 0)
1197 break; 1197 break;
diff --git a/kernel/sched.c b/kernel/sched.c
index 8841a915545d..eaf6751e7612 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -136,7 +136,7 @@ static inline void sg_inc_cpu_power(struct sched_group *sg, u32 val)
136 136
137static inline int rt_policy(int policy) 137static inline int rt_policy(int policy)
138{ 138{
139 if (unlikely(policy == SCHED_FIFO) || unlikely(policy == SCHED_RR)) 139 if (unlikely(policy == SCHED_FIFO || policy == SCHED_RR))
140 return 1; 140 return 1;
141 return 0; 141 return 0;
142} 142}
@@ -312,12 +312,15 @@ static DEFINE_SPINLOCK(task_group_lock);
312#endif 312#endif
313 313
314/* 314/*
315 * A weight of 0, 1 or ULONG_MAX can cause arithmetics problems. 315 * A weight of 0 or 1 can cause arithmetics problems.
316 * A weight of a cfs_rq is the sum of weights of which entities
317 * are queued on this cfs_rq, so a weight of a entity should not be
318 * too large, so as the shares value of a task group.
316 * (The default weight is 1024 - so there's no practical 319 * (The default weight is 1024 - so there's no practical
317 * limitation from this.) 320 * limitation from this.)
318 */ 321 */
319#define MIN_SHARES 2 322#define MIN_SHARES 2
320#define MAX_SHARES (ULONG_MAX - 1) 323#define MAX_SHARES (1UL << 18)
321 324
322static int init_task_group_load = INIT_TASK_GROUP_LOAD; 325static int init_task_group_load = INIT_TASK_GROUP_LOAD;
323#endif 326#endif
@@ -398,43 +401,6 @@ struct cfs_rq {
398 */ 401 */
399 struct list_head leaf_cfs_rq_list; 402 struct list_head leaf_cfs_rq_list;
400 struct task_group *tg; /* group that "owns" this runqueue */ 403 struct task_group *tg; /* group that "owns" this runqueue */
401
402#ifdef CONFIG_SMP
403 unsigned long task_weight;
404 unsigned long shares;
405 /*
406 * We need space to build a sched_domain wide view of the full task
407 * group tree, in order to avoid depending on dynamic memory allocation
408 * during the load balancing we place this in the per cpu task group
409 * hierarchy. This limits the load balancing to one instance per cpu,
410 * but more should not be needed anyway.
411 */
412 struct aggregate_struct {
413 /*
414 * load = weight(cpus) * f(tg)
415 *
416 * Where f(tg) is the recursive weight fraction assigned to
417 * this group.
418 */
419 unsigned long load;
420
421 /*
422 * part of the group weight distributed to this span.
423 */
424 unsigned long shares;
425
426 /*
427 * The sum of all runqueue weights within this span.
428 */
429 unsigned long rq_weight;
430
431 /*
432 * Weight contributed by tasks; this is the part we can
433 * influence by moving tasks around.
434 */
435 unsigned long task_weight;
436 } aggregate;
437#endif
438#endif 404#endif
439}; 405};
440 406
@@ -1368,17 +1334,19 @@ static void __resched_task(struct task_struct *p, int tif_bit)
1368 */ 1334 */
1369#define SRR(x, y) (((x) + (1UL << ((y) - 1))) >> (y)) 1335#define SRR(x, y) (((x) + (1UL << ((y) - 1))) >> (y))
1370 1336
1371/*
1372 * delta *= weight / lw
1373 */
1374static unsigned long 1337static unsigned long
1375calc_delta_mine(unsigned long delta_exec, unsigned long weight, 1338calc_delta_mine(unsigned long delta_exec, unsigned long weight,
1376 struct load_weight *lw) 1339 struct load_weight *lw)
1377{ 1340{
1378 u64 tmp; 1341 u64 tmp;
1379 1342
1380 if (!lw->inv_weight) 1343 if (!lw->inv_weight) {
1381 lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2)/(lw->weight+1); 1344 if (BITS_PER_LONG > 32 && unlikely(lw->weight >= WMULT_CONST))
1345 lw->inv_weight = 1;
1346 else
1347 lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2)
1348 / (lw->weight+1);
1349 }
1382 1350
1383 tmp = (u64)delta_exec * weight; 1351 tmp = (u64)delta_exec * weight;
1384 /* 1352 /*
@@ -1393,6 +1361,12 @@ calc_delta_mine(unsigned long delta_exec, unsigned long weight,
1393 return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX); 1361 return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);
1394} 1362}
1395 1363
1364static inline unsigned long
1365calc_delta_fair(unsigned long delta_exec, struct load_weight *lw)
1366{
1367 return calc_delta_mine(delta_exec, NICE_0_LOAD, lw);
1368}
1369
1396static inline void update_load_add(struct load_weight *lw, unsigned long inc) 1370static inline void update_load_add(struct load_weight *lw, unsigned long inc)
1397{ 1371{
1398 lw->weight += inc; 1372 lw->weight += inc;
@@ -1505,326 +1479,6 @@ static unsigned long source_load(int cpu, int type);
1505static unsigned long target_load(int cpu, int type); 1479static unsigned long target_load(int cpu, int type);
1506static unsigned long cpu_avg_load_per_task(int cpu); 1480static unsigned long cpu_avg_load_per_task(int cpu);
1507static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd); 1481static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);
1508
1509#ifdef CONFIG_FAIR_GROUP_SCHED
1510
1511/*
1512 * Group load balancing.
1513 *
1514 * We calculate a few balance domain wide aggregate numbers; load and weight.
1515 * Given the pictures below, and assuming each item has equal weight:
1516 *
1517 * root 1 - thread
1518 * / | \ A - group
1519 * A 1 B
1520 * /|\ / \
1521 * C 2 D 3 4
1522 * | |
1523 * 5 6
1524 *
1525 * load:
1526 * A and B get 1/3-rd of the total load. C and D get 1/3-rd of A's 1/3-rd,
1527 * which equals 1/9-th of the total load.
1528 *
1529 * shares:
1530 * The weight of this group on the selected cpus.
1531 *
1532 * rq_weight:
1533 * Direct sum of all the cpu's their rq weight, e.g. A would get 3 while
1534 * B would get 2.
1535 *
1536 * task_weight:
1537 * Part of the rq_weight contributed by tasks; all groups except B would
1538 * get 1, B gets 2.
1539 */
1540
1541static inline struct aggregate_struct *
1542aggregate(struct task_group *tg, struct sched_domain *sd)
1543{
1544 return &tg->cfs_rq[sd->first_cpu]->aggregate;
1545}
1546
1547typedef void (*aggregate_func)(struct task_group *, struct sched_domain *);
1548
1549/*
1550 * Iterate the full tree, calling @down when first entering a node and @up when
1551 * leaving it for the final time.
1552 */
1553static
1554void aggregate_walk_tree(aggregate_func down, aggregate_func up,
1555 struct sched_domain *sd)
1556{
1557 struct task_group *parent, *child;
1558
1559 rcu_read_lock();
1560 parent = &root_task_group;
1561down:
1562 (*down)(parent, sd);
1563 list_for_each_entry_rcu(child, &parent->children, siblings) {
1564 parent = child;
1565 goto down;
1566
1567up:
1568 continue;
1569 }
1570 (*up)(parent, sd);
1571
1572 child = parent;
1573 parent = parent->parent;
1574 if (parent)
1575 goto up;
1576 rcu_read_unlock();
1577}
1578
1579/*
1580 * Calculate the aggregate runqueue weight.
1581 */
1582static
1583void aggregate_group_weight(struct task_group *tg, struct sched_domain *sd)
1584{
1585 unsigned long rq_weight = 0;
1586 unsigned long task_weight = 0;
1587 int i;
1588
1589 for_each_cpu_mask(i, sd->span) {
1590 rq_weight += tg->cfs_rq[i]->load.weight;
1591 task_weight += tg->cfs_rq[i]->task_weight;
1592 }
1593
1594 aggregate(tg, sd)->rq_weight = rq_weight;
1595 aggregate(tg, sd)->task_weight = task_weight;
1596}
1597
1598/*
1599 * Compute the weight of this group on the given cpus.
1600 */
1601static
1602void aggregate_group_shares(struct task_group *tg, struct sched_domain *sd)
1603{
1604 unsigned long shares = 0;
1605 int i;
1606
1607 for_each_cpu_mask(i, sd->span)
1608 shares += tg->cfs_rq[i]->shares;
1609
1610 if ((!shares && aggregate(tg, sd)->rq_weight) || shares > tg->shares)
1611 shares = tg->shares;
1612
1613 aggregate(tg, sd)->shares = shares;
1614}
1615
1616/*
1617 * Compute the load fraction assigned to this group, relies on the aggregate
1618 * weight and this group's parent's load, i.e. top-down.
1619 */
1620static
1621void aggregate_group_load(struct task_group *tg, struct sched_domain *sd)
1622{
1623 unsigned long load;
1624
1625 if (!tg->parent) {
1626 int i;
1627
1628 load = 0;
1629 for_each_cpu_mask(i, sd->span)
1630 load += cpu_rq(i)->load.weight;
1631
1632 } else {
1633 load = aggregate(tg->parent, sd)->load;
1634
1635 /*
1636 * shares is our weight in the parent's rq so
1637 * shares/parent->rq_weight gives our fraction of the load
1638 */
1639 load *= aggregate(tg, sd)->shares;
1640 load /= aggregate(tg->parent, sd)->rq_weight + 1;
1641 }
1642
1643 aggregate(tg, sd)->load = load;
1644}
1645
1646static void __set_se_shares(struct sched_entity *se, unsigned long shares);
1647
1648/*
1649 * Calculate and set the cpu's group shares.
1650 */
1651static void
1652__update_group_shares_cpu(struct task_group *tg, struct sched_domain *sd,
1653 int tcpu)
1654{
1655 int boost = 0;
1656 unsigned long shares;
1657 unsigned long rq_weight;
1658
1659 if (!tg->se[tcpu])
1660 return;
1661
1662 rq_weight = tg->cfs_rq[tcpu]->load.weight;
1663
1664 /*
1665 * If there are currently no tasks on the cpu pretend there is one of
1666 * average load so that when a new task gets to run here it will not
1667 * get delayed by group starvation.
1668 */
1669 if (!rq_weight) {
1670 boost = 1;
1671 rq_weight = NICE_0_LOAD;
1672 }
1673
1674 /*
1675 * \Sum shares * rq_weight
1676 * shares = -----------------------
1677 * \Sum rq_weight
1678 *
1679 */
1680 shares = aggregate(tg, sd)->shares * rq_weight;
1681 shares /= aggregate(tg, sd)->rq_weight + 1;
1682
1683 /*
1684 * record the actual number of shares, not the boosted amount.
1685 */
1686 tg->cfs_rq[tcpu]->shares = boost ? 0 : shares;
1687
1688 if (shares < MIN_SHARES)
1689 shares = MIN_SHARES;
1690 else if (shares > MAX_SHARES)
1691 shares = MAX_SHARES;
1692
1693 __set_se_shares(tg->se[tcpu], shares);
1694}
1695
1696/*
1697 * Re-adjust the weights on the cpu the task came from and on the cpu the
1698 * task went to.
1699 */
1700static void
1701__move_group_shares(struct task_group *tg, struct sched_domain *sd,
1702 int scpu, int dcpu)
1703{
1704 unsigned long shares;
1705
1706 shares = tg->cfs_rq[scpu]->shares + tg->cfs_rq[dcpu]->shares;
1707
1708 __update_group_shares_cpu(tg, sd, scpu);
1709 __update_group_shares_cpu(tg, sd, dcpu);
1710
1711 /*
1712 * ensure we never loose shares due to rounding errors in the
1713 * above redistribution.
1714 */
1715 shares -= tg->cfs_rq[scpu]->shares + tg->cfs_rq[dcpu]->shares;
1716 if (shares)
1717 tg->cfs_rq[dcpu]->shares += shares;
1718}
1719
1720/*
1721 * Because changing a group's shares changes the weight of the super-group
1722 * we need to walk up the tree and change all shares until we hit the root.
1723 */
1724static void
1725move_group_shares(struct task_group *tg, struct sched_domain *sd,
1726 int scpu, int dcpu)
1727{
1728 while (tg) {
1729 __move_group_shares(tg, sd, scpu, dcpu);
1730 tg = tg->parent;
1731 }
1732}
1733
1734static
1735void aggregate_group_set_shares(struct task_group *tg, struct sched_domain *sd)
1736{
1737 unsigned long shares = aggregate(tg, sd)->shares;
1738 int i;
1739
1740 for_each_cpu_mask(i, sd->span) {
1741 struct rq *rq = cpu_rq(i);
1742 unsigned long flags;
1743
1744 spin_lock_irqsave(&rq->lock, flags);
1745 __update_group_shares_cpu(tg, sd, i);
1746 spin_unlock_irqrestore(&rq->lock, flags);
1747 }
1748
1749 aggregate_group_shares(tg, sd);
1750
1751 /*
1752 * ensure we never loose shares due to rounding errors in the
1753 * above redistribution.
1754 */
1755 shares -= aggregate(tg, sd)->shares;
1756 if (shares) {
1757 tg->cfs_rq[sd->first_cpu]->shares += shares;
1758 aggregate(tg, sd)->shares += shares;
1759 }
1760}
1761
1762/*
1763 * Calculate the accumulative weight and recursive load of each task group
1764 * while walking down the tree.
1765 */
1766static
1767void aggregate_get_down(struct task_group *tg, struct sched_domain *sd)
1768{
1769 aggregate_group_weight(tg, sd);
1770 aggregate_group_shares(tg, sd);
1771 aggregate_group_load(tg, sd);
1772}
1773
1774/*
1775 * Rebalance the cpu shares while walking back up the tree.
1776 */
1777static
1778void aggregate_get_up(struct task_group *tg, struct sched_domain *sd)
1779{
1780 aggregate_group_set_shares(tg, sd);
1781}
1782
1783static DEFINE_PER_CPU(spinlock_t, aggregate_lock);
1784
1785static void __init init_aggregate(void)
1786{
1787 int i;
1788
1789 for_each_possible_cpu(i)
1790 spin_lock_init(&per_cpu(aggregate_lock, i));
1791}
1792
1793static int get_aggregate(struct sched_domain *sd)
1794{
1795 if (!spin_trylock(&per_cpu(aggregate_lock, sd->first_cpu)))
1796 return 0;
1797
1798 aggregate_walk_tree(aggregate_get_down, aggregate_get_up, sd);
1799 return 1;
1800}
1801
1802static void put_aggregate(struct sched_domain *sd)
1803{
1804 spin_unlock(&per_cpu(aggregate_lock, sd->first_cpu));
1805}
1806
1807static void cfs_rq_set_shares(struct cfs_rq *cfs_rq, unsigned long shares)
1808{
1809 cfs_rq->shares = shares;
1810}
1811
1812#else
1813
1814static inline void init_aggregate(void)
1815{
1816}
1817
1818static inline int get_aggregate(struct sched_domain *sd)
1819{
1820 return 0;
1821}
1822
1823static inline void put_aggregate(struct sched_domain *sd)
1824{
1825}
1826#endif
1827
1828#else /* CONFIG_SMP */ 1482#else /* CONFIG_SMP */
1829 1483
1830#ifdef CONFIG_FAIR_GROUP_SCHED 1484#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1845,14 +1499,26 @@ static void cfs_rq_set_shares(struct cfs_rq *cfs_rq, unsigned long shares)
1845 1499
1846#define sched_class_highest (&rt_sched_class) 1500#define sched_class_highest (&rt_sched_class)
1847 1501
1848static void inc_nr_running(struct rq *rq) 1502static inline void inc_load(struct rq *rq, const struct task_struct *p)
1503{
1504 update_load_add(&rq->load, p->se.load.weight);
1505}
1506
1507static inline void dec_load(struct rq *rq, const struct task_struct *p)
1508{
1509 update_load_sub(&rq->load, p->se.load.weight);
1510}
1511
1512static void inc_nr_running(struct task_struct *p, struct rq *rq)
1849{ 1513{
1850 rq->nr_running++; 1514 rq->nr_running++;
1515 inc_load(rq, p);
1851} 1516}
1852 1517
1853static void dec_nr_running(struct rq *rq) 1518static void dec_nr_running(struct task_struct *p, struct rq *rq)
1854{ 1519{
1855 rq->nr_running--; 1520 rq->nr_running--;
1521 dec_load(rq, p);
1856} 1522}
1857 1523
1858static void set_load_weight(struct task_struct *p) 1524static void set_load_weight(struct task_struct *p)
@@ -1944,7 +1610,7 @@ static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
1944 rq->nr_uninterruptible--; 1610 rq->nr_uninterruptible--;
1945 1611
1946 enqueue_task(rq, p, wakeup); 1612 enqueue_task(rq, p, wakeup);
1947 inc_nr_running(rq); 1613 inc_nr_running(p, rq);
1948} 1614}
1949 1615
1950/* 1616/*
@@ -1956,7 +1622,7 @@ static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
1956 rq->nr_uninterruptible++; 1622 rq->nr_uninterruptible++;
1957 1623
1958 dequeue_task(rq, p, sleep); 1624 dequeue_task(rq, p, sleep);
1959 dec_nr_running(rq); 1625 dec_nr_running(p, rq);
1960} 1626}
1961 1627
1962/** 1628/**
@@ -2609,7 +2275,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
2609 * management (if any): 2275 * management (if any):
2610 */ 2276 */
2611 p->sched_class->task_new(rq, p); 2277 p->sched_class->task_new(rq, p);
2612 inc_nr_running(rq); 2278 inc_nr_running(p, rq);
2613 } 2279 }
2614 check_preempt_curr(rq, p); 2280 check_preempt_curr(rq, p);
2615#ifdef CONFIG_SMP 2281#ifdef CONFIG_SMP
@@ -3600,12 +3266,9 @@ static int load_balance(int this_cpu, struct rq *this_rq,
3600 unsigned long imbalance; 3266 unsigned long imbalance;
3601 struct rq *busiest; 3267 struct rq *busiest;
3602 unsigned long flags; 3268 unsigned long flags;
3603 int unlock_aggregate;
3604 3269
3605 cpus_setall(*cpus); 3270 cpus_setall(*cpus);
3606 3271
3607 unlock_aggregate = get_aggregate(sd);
3608
3609 /* 3272 /*
3610 * When power savings policy is enabled for the parent domain, idle 3273 * When power savings policy is enabled for the parent domain, idle
3611 * sibling can pick up load irrespective of busy siblings. In this case, 3274 * sibling can pick up load irrespective of busy siblings. In this case,
@@ -3721,9 +3384,8 @@ redo:
3721 3384
3722 if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER && 3385 if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
3723 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE)) 3386 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
3724 ld_moved = -1; 3387 return -1;
3725 3388 return ld_moved;
3726 goto out;
3727 3389
3728out_balanced: 3390out_balanced:
3729 schedstat_inc(sd, lb_balanced[idle]); 3391 schedstat_inc(sd, lb_balanced[idle]);
@@ -3738,13 +3400,8 @@ out_one_pinned:
3738 3400
3739 if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER && 3401 if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
3740 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE)) 3402 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
3741 ld_moved = -1; 3403 return -1;
3742 else 3404 return 0;
3743 ld_moved = 0;
3744out:
3745 if (unlock_aggregate)
3746 put_aggregate(sd);
3747 return ld_moved;
3748} 3405}
3749 3406
3750/* 3407/*
@@ -4430,7 +4087,7 @@ static inline void schedule_debug(struct task_struct *prev)
4430 * schedule() atomically, we ignore that path for now. 4087 * schedule() atomically, we ignore that path for now.
4431 * Otherwise, whine if we are scheduling when we should not be. 4088 * Otherwise, whine if we are scheduling when we should not be.
4432 */ 4089 */
4433 if (unlikely(in_atomic_preempt_off()) && unlikely(!prev->exit_state)) 4090 if (unlikely(in_atomic_preempt_off() && !prev->exit_state))
4434 __schedule_bug(prev); 4091 __schedule_bug(prev);
4435 4092
4436 profile_hit(SCHED_PROFILING, __builtin_return_address(0)); 4093 profile_hit(SCHED_PROFILING, __builtin_return_address(0));
@@ -4510,12 +4167,10 @@ need_resched_nonpreemptible:
4510 clear_tsk_need_resched(prev); 4167 clear_tsk_need_resched(prev);
4511 4168
4512 if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { 4169 if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
4513 if (unlikely((prev->state & TASK_INTERRUPTIBLE) && 4170 if (unlikely(signal_pending_state(prev->state, prev)))
4514 signal_pending(prev))) {
4515 prev->state = TASK_RUNNING; 4171 prev->state = TASK_RUNNING;
4516 } else { 4172 else
4517 deactivate_task(rq, prev, 1); 4173 deactivate_task(rq, prev, 1);
4518 }
4519 switch_count = &prev->nvcsw; 4174 switch_count = &prev->nvcsw;
4520 } 4175 }
4521 4176
@@ -4931,8 +4586,10 @@ void set_user_nice(struct task_struct *p, long nice)
4931 goto out_unlock; 4586 goto out_unlock;
4932 } 4587 }
4933 on_rq = p->se.on_rq; 4588 on_rq = p->se.on_rq;
4934 if (on_rq) 4589 if (on_rq) {
4935 dequeue_task(rq, p, 0); 4590 dequeue_task(rq, p, 0);
4591 dec_load(rq, p);
4592 }
4936 4593
4937 p->static_prio = NICE_TO_PRIO(nice); 4594 p->static_prio = NICE_TO_PRIO(nice);
4938 set_load_weight(p); 4595 set_load_weight(p);
@@ -4942,6 +4599,7 @@ void set_user_nice(struct task_struct *p, long nice)
4942 4599
4943 if (on_rq) { 4600 if (on_rq) {
4944 enqueue_task(rq, p, 0); 4601 enqueue_task(rq, p, 0);
4602 inc_load(rq, p);
4945 /* 4603 /*
4946 * If the task increased its priority or is running and 4604 * If the task increased its priority or is running and
4947 * lowered its priority, then reschedule its CPU: 4605 * lowered its priority, then reschedule its CPU:
@@ -7316,7 +6974,6 @@ static int __build_sched_domains(const cpumask_t *cpu_map,
7316 SD_INIT(sd, ALLNODES); 6974 SD_INIT(sd, ALLNODES);
7317 set_domain_attribute(sd, attr); 6975 set_domain_attribute(sd, attr);
7318 sd->span = *cpu_map; 6976 sd->span = *cpu_map;
7319 sd->first_cpu = first_cpu(sd->span);
7320 cpu_to_allnodes_group(i, cpu_map, &sd->groups, tmpmask); 6977 cpu_to_allnodes_group(i, cpu_map, &sd->groups, tmpmask);
7321 p = sd; 6978 p = sd;
7322 sd_allnodes = 1; 6979 sd_allnodes = 1;
@@ -7327,7 +6984,6 @@ static int __build_sched_domains(const cpumask_t *cpu_map,
7327 SD_INIT(sd, NODE); 6984 SD_INIT(sd, NODE);
7328 set_domain_attribute(sd, attr); 6985 set_domain_attribute(sd, attr);
7329 sched_domain_node_span(cpu_to_node(i), &sd->span); 6986 sched_domain_node_span(cpu_to_node(i), &sd->span);
7330 sd->first_cpu = first_cpu(sd->span);
7331 sd->parent = p; 6987 sd->parent = p;
7332 if (p) 6988 if (p)
7333 p->child = sd; 6989 p->child = sd;
@@ -7339,7 +6995,6 @@ static int __build_sched_domains(const cpumask_t *cpu_map,
7339 SD_INIT(sd, CPU); 6995 SD_INIT(sd, CPU);
7340 set_domain_attribute(sd, attr); 6996 set_domain_attribute(sd, attr);
7341 sd->span = *nodemask; 6997 sd->span = *nodemask;
7342 sd->first_cpu = first_cpu(sd->span);
7343 sd->parent = p; 6998 sd->parent = p;
7344 if (p) 6999 if (p)
7345 p->child = sd; 7000 p->child = sd;
@@ -7351,7 +7006,6 @@ static int __build_sched_domains(const cpumask_t *cpu_map,
7351 SD_INIT(sd, MC); 7006 SD_INIT(sd, MC);
7352 set_domain_attribute(sd, attr); 7007 set_domain_attribute(sd, attr);
7353 sd->span = cpu_coregroup_map(i); 7008 sd->span = cpu_coregroup_map(i);
7354 sd->first_cpu = first_cpu(sd->span);
7355 cpus_and(sd->span, sd->span, *cpu_map); 7009 cpus_and(sd->span, sd->span, *cpu_map);
7356 sd->parent = p; 7010 sd->parent = p;
7357 p->child = sd; 7011 p->child = sd;
@@ -7364,7 +7018,6 @@ static int __build_sched_domains(const cpumask_t *cpu_map,
7364 SD_INIT(sd, SIBLING); 7018 SD_INIT(sd, SIBLING);
7365 set_domain_attribute(sd, attr); 7019 set_domain_attribute(sd, attr);
7366 sd->span = per_cpu(cpu_sibling_map, i); 7020 sd->span = per_cpu(cpu_sibling_map, i);
7367 sd->first_cpu = first_cpu(sd->span);
7368 cpus_and(sd->span, sd->span, *cpu_map); 7021 cpus_and(sd->span, sd->span, *cpu_map);
7369 sd->parent = p; 7022 sd->parent = p;
7370 p->child = sd; 7023 p->child = sd;
@@ -7568,8 +7221,8 @@ static int build_sched_domains(const cpumask_t *cpu_map)
7568 7221
7569static cpumask_t *doms_cur; /* current sched domains */ 7222static cpumask_t *doms_cur; /* current sched domains */
7570static int ndoms_cur; /* number of sched domains in 'doms_cur' */ 7223static int ndoms_cur; /* number of sched domains in 'doms_cur' */
7571static struct sched_domain_attr *dattr_cur; /* attribues of custom domains 7224static struct sched_domain_attr *dattr_cur;
7572 in 'doms_cur' */ 7225 /* attribues of custom domains in 'doms_cur' */
7573 7226
7574/* 7227/*
7575 * Special case: If a kmalloc of a doms_cur partition (array of 7228 * Special case: If a kmalloc of a doms_cur partition (array of
@@ -8034,7 +7687,6 @@ void __init sched_init(void)
8034 } 7687 }
8035 7688
8036#ifdef CONFIG_SMP 7689#ifdef CONFIG_SMP
8037 init_aggregate();
8038 init_defrootdomain(); 7690 init_defrootdomain();
8039#endif 7691#endif
8040 7692
@@ -8599,11 +8251,14 @@ void sched_move_task(struct task_struct *tsk)
8599#endif 8251#endif
8600 8252
8601#ifdef CONFIG_FAIR_GROUP_SCHED 8253#ifdef CONFIG_FAIR_GROUP_SCHED
8602static void __set_se_shares(struct sched_entity *se, unsigned long shares) 8254static void set_se_shares(struct sched_entity *se, unsigned long shares)
8603{ 8255{
8604 struct cfs_rq *cfs_rq = se->cfs_rq; 8256 struct cfs_rq *cfs_rq = se->cfs_rq;
8257 struct rq *rq = cfs_rq->rq;
8605 int on_rq; 8258 int on_rq;
8606 8259
8260 spin_lock_irq(&rq->lock);
8261
8607 on_rq = se->on_rq; 8262 on_rq = se->on_rq;
8608 if (on_rq) 8263 if (on_rq)
8609 dequeue_entity(cfs_rq, se, 0); 8264 dequeue_entity(cfs_rq, se, 0);
@@ -8613,17 +8268,8 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares)
8613 8268
8614 if (on_rq) 8269 if (on_rq)
8615 enqueue_entity(cfs_rq, se, 0); 8270 enqueue_entity(cfs_rq, se, 0);
8616}
8617 8271
8618static void set_se_shares(struct sched_entity *se, unsigned long shares) 8272 spin_unlock_irq(&rq->lock);
8619{
8620 struct cfs_rq *cfs_rq = se->cfs_rq;
8621 struct rq *rq = cfs_rq->rq;
8622 unsigned long flags;
8623
8624 spin_lock_irqsave(&rq->lock, flags);
8625 __set_se_shares(se, shares);
8626 spin_unlock_irqrestore(&rq->lock, flags);
8627} 8273}
8628 8274
8629static DEFINE_MUTEX(shares_mutex); 8275static DEFINE_MUTEX(shares_mutex);
@@ -8662,13 +8308,8 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
8662 * w/o tripping rebalance_share or load_balance_fair. 8308 * w/o tripping rebalance_share or load_balance_fair.
8663 */ 8309 */
8664 tg->shares = shares; 8310 tg->shares = shares;
8665 for_each_possible_cpu(i) { 8311 for_each_possible_cpu(i)
8666 /*
8667 * force a rebalance
8668 */
8669 cfs_rq_set_shares(tg->cfs_rq[i], 0);
8670 set_se_shares(tg->se[i], shares); 8312 set_se_shares(tg->se[i], shares);
8671 }
8672 8313
8673 /* 8314 /*
8674 * Enable load balance activity on this group, by inserting it back on 8315 * Enable load balance activity on this group, by inserting it back on
@@ -8986,7 +8627,7 @@ static u64 cpu_shares_read_u64(struct cgroup *cgrp, struct cftype *cft)
8986#endif 8627#endif
8987 8628
8988#ifdef CONFIG_RT_GROUP_SCHED 8629#ifdef CONFIG_RT_GROUP_SCHED
8989static ssize_t cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft, 8630static int cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft,
8990 s64 val) 8631 s64 val)
8991{ 8632{
8992 return sched_group_set_rt_runtime(cgroup_tg(cgrp), val); 8633 return sched_group_set_rt_runtime(cgroup_tg(cgrp), val);
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 9c597e37f7de..ce05271219ab 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -59,22 +59,26 @@ static inline struct sched_clock_data *cpu_sdc(int cpu)
59 return &per_cpu(sched_clock_data, cpu); 59 return &per_cpu(sched_clock_data, cpu);
60} 60}
61 61
62static __read_mostly int sched_clock_running;
63
62void sched_clock_init(void) 64void sched_clock_init(void)
63{ 65{
64 u64 ktime_now = ktime_to_ns(ktime_get()); 66 u64 ktime_now = ktime_to_ns(ktime_get());
65 u64 now = 0; 67 unsigned long now_jiffies = jiffies;
66 int cpu; 68 int cpu;
67 69
68 for_each_possible_cpu(cpu) { 70 for_each_possible_cpu(cpu) {
69 struct sched_clock_data *scd = cpu_sdc(cpu); 71 struct sched_clock_data *scd = cpu_sdc(cpu);
70 72
71 scd->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; 73 scd->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
72 scd->prev_jiffies = jiffies; 74 scd->prev_jiffies = now_jiffies;
73 scd->prev_raw = now; 75 scd->prev_raw = 0;
74 scd->tick_raw = now; 76 scd->tick_raw = 0;
75 scd->tick_gtod = ktime_now; 77 scd->tick_gtod = ktime_now;
76 scd->clock = ktime_now; 78 scd->clock = ktime_now;
77 } 79 }
80
81 sched_clock_running = 1;
78} 82}
79 83
80/* 84/*
@@ -136,6 +140,9 @@ u64 sched_clock_cpu(int cpu)
136 struct sched_clock_data *scd = cpu_sdc(cpu); 140 struct sched_clock_data *scd = cpu_sdc(cpu);
137 u64 now, clock; 141 u64 now, clock;
138 142
143 if (unlikely(!sched_clock_running))
144 return 0ull;
145
139 WARN_ON_ONCE(!irqs_disabled()); 146 WARN_ON_ONCE(!irqs_disabled());
140 now = sched_clock(); 147 now = sched_clock();
141 148
@@ -174,6 +181,9 @@ void sched_clock_tick(void)
174 struct sched_clock_data *scd = this_scd(); 181 struct sched_clock_data *scd = this_scd();
175 u64 now, now_gtod; 182 u64 now, now_gtod;
176 183
184 if (unlikely(!sched_clock_running))
185 return;
186
177 WARN_ON_ONCE(!irqs_disabled()); 187 WARN_ON_ONCE(!irqs_disabled());
178 188
179 now = sched_clock(); 189 now = sched_clock();
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 5f06118fbc31..8bb713040ac9 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -167,11 +167,6 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
167#endif 167#endif
168 SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over", 168 SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over",
169 cfs_rq->nr_spread_over); 169 cfs_rq->nr_spread_over);
170#ifdef CONFIG_FAIR_GROUP_SCHED
171#ifdef CONFIG_SMP
172 SEQ_printf(m, " .%-30s: %lu\n", "shares", cfs_rq->shares);
173#endif
174#endif
175} 170}
176 171
177static void print_cpu(struct seq_file *m, int cpu) 172static void print_cpu(struct seq_file *m, int cpu)
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index e24ecd39c4b8..08ae848b71d4 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -334,34 +334,6 @@ int sched_nr_latency_handler(struct ctl_table *table, int write,
334#endif 334#endif
335 335
336/* 336/*
337 * delta *= w / rw
338 */
339static inline unsigned long
340calc_delta_weight(unsigned long delta, struct sched_entity *se)
341{
342 for_each_sched_entity(se) {
343 delta = calc_delta_mine(delta,
344 se->load.weight, &cfs_rq_of(se)->load);
345 }
346
347 return delta;
348}
349
350/*
351 * delta *= rw / w
352 */
353static inline unsigned long
354calc_delta_fair(unsigned long delta, struct sched_entity *se)
355{
356 for_each_sched_entity(se) {
357 delta = calc_delta_mine(delta,
358 cfs_rq_of(se)->load.weight, &se->load);
359 }
360
361 return delta;
362}
363
364/*
365 * The idea is to set a period in which each task runs once. 337 * The idea is to set a period in which each task runs once.
366 * 338 *
367 * When there are too many tasks (sysctl_sched_nr_latency) we have to stretch 339 * When there are too many tasks (sysctl_sched_nr_latency) we have to stretch
@@ -390,54 +362,47 @@ static u64 __sched_period(unsigned long nr_running)
390 */ 362 */
391static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) 363static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
392{ 364{
393 return calc_delta_weight(__sched_period(cfs_rq->nr_running), se); 365 u64 slice = __sched_period(cfs_rq->nr_running);
366
367 for_each_sched_entity(se) {
368 cfs_rq = cfs_rq_of(se);
369
370 slice *= se->load.weight;
371 do_div(slice, cfs_rq->load.weight);
372 }
373
374
375 return slice;
394} 376}
395 377
396/* 378/*
397 * We calculate the vruntime slice of a to be inserted task 379 * We calculate the vruntime slice of a to be inserted task
398 * 380 *
399 * vs = s*rw/w = p 381 * vs = s/w = p/rw
400 */ 382 */
401static u64 sched_vslice_add(struct cfs_rq *cfs_rq, struct sched_entity *se) 383static u64 sched_vslice_add(struct cfs_rq *cfs_rq, struct sched_entity *se)
402{ 384{
403 unsigned long nr_running = cfs_rq->nr_running; 385 unsigned long nr_running = cfs_rq->nr_running;
386 unsigned long weight;
387 u64 vslice;
404 388
405 if (!se->on_rq) 389 if (!se->on_rq)
406 nr_running++; 390 nr_running++;
407 391
408 return __sched_period(nr_running); 392 vslice = __sched_period(nr_running);
409}
410
411/*
412 * The goal of calc_delta_asym() is to be asymmetrically around NICE_0_LOAD, in
413 * that it favours >=0 over <0.
414 *
415 * -20 |
416 * |
417 * 0 --------+-------
418 * .'
419 * 19 .'
420 *
421 */
422static unsigned long
423calc_delta_asym(unsigned long delta, struct sched_entity *se)
424{
425 struct load_weight lw = {
426 .weight = NICE_0_LOAD,
427 .inv_weight = 1UL << (WMULT_SHIFT-NICE_0_SHIFT)
428 };
429 393
430 for_each_sched_entity(se) { 394 for_each_sched_entity(se) {
431 struct load_weight *se_lw = &se->load; 395 cfs_rq = cfs_rq_of(se);
432 396
433 if (se->load.weight < NICE_0_LOAD) 397 weight = cfs_rq->load.weight;
434 se_lw = &lw; 398 if (!se->on_rq)
399 weight += se->load.weight;
435 400
436 delta = calc_delta_mine(delta, 401 vslice *= NICE_0_LOAD;
437 cfs_rq_of(se)->load.weight, se_lw); 402 do_div(vslice, weight);
438 } 403 }
439 404
440 return delta; 405 return vslice;
441} 406}
442 407
443/* 408/*
@@ -454,7 +419,11 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
454 419
455 curr->sum_exec_runtime += delta_exec; 420 curr->sum_exec_runtime += delta_exec;
456 schedstat_add(cfs_rq, exec_clock, delta_exec); 421 schedstat_add(cfs_rq, exec_clock, delta_exec);
457 delta_exec_weighted = calc_delta_fair(delta_exec, curr); 422 delta_exec_weighted = delta_exec;
423 if (unlikely(curr->load.weight != NICE_0_LOAD)) {
424 delta_exec_weighted = calc_delta_fair(delta_exec_weighted,
425 &curr->load);
426 }
458 curr->vruntime += delta_exec_weighted; 427 curr->vruntime += delta_exec_weighted;
459} 428}
460 429
@@ -541,27 +510,10 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
541 * Scheduling class queueing methods: 510 * Scheduling class queueing methods:
542 */ 511 */
543 512
544#if defined CONFIG_SMP && defined CONFIG_FAIR_GROUP_SCHED
545static void
546add_cfs_task_weight(struct cfs_rq *cfs_rq, unsigned long weight)
547{
548 cfs_rq->task_weight += weight;
549}
550#else
551static inline void
552add_cfs_task_weight(struct cfs_rq *cfs_rq, unsigned long weight)
553{
554}
555#endif
556
557static void 513static void
558account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se) 514account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
559{ 515{
560 update_load_add(&cfs_rq->load, se->load.weight); 516 update_load_add(&cfs_rq->load, se->load.weight);
561 if (!parent_entity(se))
562 inc_cpu_load(rq_of(cfs_rq), se->load.weight);
563 if (entity_is_task(se))
564 add_cfs_task_weight(cfs_rq, se->load.weight);
565 cfs_rq->nr_running++; 517 cfs_rq->nr_running++;
566 se->on_rq = 1; 518 se->on_rq = 1;
567 list_add(&se->group_node, &cfs_rq->tasks); 519 list_add(&se->group_node, &cfs_rq->tasks);
@@ -571,10 +523,6 @@ static void
571account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se) 523account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
572{ 524{
573 update_load_sub(&cfs_rq->load, se->load.weight); 525 update_load_sub(&cfs_rq->load, se->load.weight);
574 if (!parent_entity(se))
575 dec_cpu_load(rq_of(cfs_rq), se->load.weight);
576 if (entity_is_task(se))
577 add_cfs_task_weight(cfs_rq, -se->load.weight);
578 cfs_rq->nr_running--; 526 cfs_rq->nr_running--;
579 se->on_rq = 0; 527 se->on_rq = 0;
580 list_del_init(&se->group_node); 528 list_del_init(&se->group_node);
@@ -661,17 +609,8 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
661 609
662 if (!initial) { 610 if (!initial) {
663 /* sleeps upto a single latency don't count. */ 611 /* sleeps upto a single latency don't count. */
664 if (sched_feat(NEW_FAIR_SLEEPERS)) { 612 if (sched_feat(NEW_FAIR_SLEEPERS))
665 unsigned long thresh = sysctl_sched_latency; 613 vruntime -= sysctl_sched_latency;
666
667 /*
668 * convert the sleeper threshold into virtual time
669 */
670 if (sched_feat(NORMALIZED_SLEEPER))
671 thresh = calc_delta_fair(thresh, se);
672
673 vruntime -= thresh;
674 }
675 614
676 /* ensure we never gain time by being placed backwards. */ 615 /* ensure we never gain time by being placed backwards. */
677 vruntime = max_vruntime(se->vruntime, vruntime); 616 vruntime = max_vruntime(se->vruntime, vruntime);
@@ -1057,16 +996,27 @@ wake_affine(struct rq *rq, struct sched_domain *this_sd, struct rq *this_rq,
1057 struct task_struct *curr = this_rq->curr; 996 struct task_struct *curr = this_rq->curr;
1058 unsigned long tl = this_load; 997 unsigned long tl = this_load;
1059 unsigned long tl_per_task; 998 unsigned long tl_per_task;
999 int balanced;
1060 1000
1061 if (!(this_sd->flags & SD_WAKE_AFFINE)) 1001 if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
1062 return 0; 1002 return 0;
1063 1003
1064 /* 1004 /*
1005 * If sync wakeup then subtract the (maximum possible)
1006 * effect of the currently running task from the load
1007 * of the current CPU:
1008 */
1009 if (sync)
1010 tl -= current->se.load.weight;
1011
1012 balanced = 100*(tl + p->se.load.weight) <= imbalance*load;
1013
1014 /*
1065 * If the currently running task will sleep within 1015 * If the currently running task will sleep within
1066 * a reasonable amount of time then attract this newly 1016 * a reasonable amount of time then attract this newly
1067 * woken task: 1017 * woken task:
1068 */ 1018 */
1069 if (sync && curr->sched_class == &fair_sched_class) { 1019 if (sync && balanced && curr->sched_class == &fair_sched_class) {
1070 if (curr->se.avg_overlap < sysctl_sched_migration_cost && 1020 if (curr->se.avg_overlap < sysctl_sched_migration_cost &&
1071 p->se.avg_overlap < sysctl_sched_migration_cost) 1021 p->se.avg_overlap < sysctl_sched_migration_cost)
1072 return 1; 1022 return 1;
@@ -1075,16 +1025,8 @@ wake_affine(struct rq *rq, struct sched_domain *this_sd, struct rq *this_rq,
1075 schedstat_inc(p, se.nr_wakeups_affine_attempts); 1025 schedstat_inc(p, se.nr_wakeups_affine_attempts);
1076 tl_per_task = cpu_avg_load_per_task(this_cpu); 1026 tl_per_task = cpu_avg_load_per_task(this_cpu);
1077 1027
1078 /*
1079 * If sync wakeup then subtract the (maximum possible)
1080 * effect of the currently running task from the load
1081 * of the current CPU:
1082 */
1083 if (sync)
1084 tl -= current->se.load.weight;
1085
1086 if ((tl <= load && tl + target_load(prev_cpu, idx) <= tl_per_task) || 1028 if ((tl <= load && tl + target_load(prev_cpu, idx) <= tl_per_task) ||
1087 100*(tl + p->se.load.weight) <= imbalance*load) { 1029 balanced) {
1088 /* 1030 /*
1089 * This domain has SD_WAKE_AFFINE and 1031 * This domain has SD_WAKE_AFFINE and
1090 * p is cache cold in this domain, and 1032 * p is cache cold in this domain, and
@@ -1169,10 +1111,11 @@ static unsigned long wakeup_gran(struct sched_entity *se)
1169 unsigned long gran = sysctl_sched_wakeup_granularity; 1111 unsigned long gran = sysctl_sched_wakeup_granularity;
1170 1112
1171 /* 1113 /*
1172 * More easily preempt - nice tasks, while not making it harder for 1114 * More easily preempt - nice tasks, while not making
1173 * + nice tasks. 1115 * it harder for + nice tasks.
1174 */ 1116 */
1175 gran = calc_delta_asym(sysctl_sched_wakeup_granularity, se); 1117 if (unlikely(se->load.weight > NICE_0_LOAD))
1118 gran = calc_delta_fair(gran, &se->load);
1176 1119
1177 return gran; 1120 return gran;
1178} 1121}
@@ -1366,90 +1309,75 @@ static struct task_struct *load_balance_next_fair(void *arg)
1366 return __load_balance_iterator(cfs_rq, cfs_rq->balance_iterator); 1309 return __load_balance_iterator(cfs_rq, cfs_rq->balance_iterator);
1367} 1310}
1368 1311
1369static unsigned long 1312#ifdef CONFIG_FAIR_GROUP_SCHED
1370__load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest, 1313static int cfs_rq_best_prio(struct cfs_rq *cfs_rq)
1371 unsigned long max_load_move, struct sched_domain *sd,
1372 enum cpu_idle_type idle, int *all_pinned, int *this_best_prio,
1373 struct cfs_rq *cfs_rq)
1374{ 1314{
1375 struct rq_iterator cfs_rq_iterator; 1315 struct sched_entity *curr;
1316 struct task_struct *p;
1376 1317
1377 cfs_rq_iterator.start = load_balance_start_fair; 1318 if (!cfs_rq->nr_running || !first_fair(cfs_rq))
1378 cfs_rq_iterator.next = load_balance_next_fair; 1319 return MAX_PRIO;
1379 cfs_rq_iterator.arg = cfs_rq; 1320
1321 curr = cfs_rq->curr;
1322 if (!curr)
1323 curr = __pick_next_entity(cfs_rq);
1324
1325 p = task_of(curr);
1380 1326
1381 return balance_tasks(this_rq, this_cpu, busiest, 1327 return p->prio;
1382 max_load_move, sd, idle, all_pinned,
1383 this_best_prio, &cfs_rq_iterator);
1384} 1328}
1329#endif
1385 1330
1386#ifdef CONFIG_FAIR_GROUP_SCHED
1387static unsigned long 1331static unsigned long
1388load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest, 1332load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
1389 unsigned long max_load_move, 1333 unsigned long max_load_move,
1390 struct sched_domain *sd, enum cpu_idle_type idle, 1334 struct sched_domain *sd, enum cpu_idle_type idle,
1391 int *all_pinned, int *this_best_prio) 1335 int *all_pinned, int *this_best_prio)
1392{ 1336{
1337 struct cfs_rq *busy_cfs_rq;
1393 long rem_load_move = max_load_move; 1338 long rem_load_move = max_load_move;
1394 int busiest_cpu = cpu_of(busiest); 1339 struct rq_iterator cfs_rq_iterator;
1395 struct task_group *tg;
1396
1397 rcu_read_lock();
1398 list_for_each_entry(tg, &task_groups, list) {
1399 long imbalance;
1400 unsigned long this_weight, busiest_weight;
1401 long rem_load, max_load, moved_load;
1402
1403 /*
1404 * empty group
1405 */
1406 if (!aggregate(tg, sd)->task_weight)
1407 continue;
1408
1409 rem_load = rem_load_move * aggregate(tg, sd)->rq_weight;
1410 rem_load /= aggregate(tg, sd)->load + 1;
1411
1412 this_weight = tg->cfs_rq[this_cpu]->task_weight;
1413 busiest_weight = tg->cfs_rq[busiest_cpu]->task_weight;
1414 1340
1415 imbalance = (busiest_weight - this_weight) / 2; 1341 cfs_rq_iterator.start = load_balance_start_fair;
1342 cfs_rq_iterator.next = load_balance_next_fair;
1416 1343
1417 if (imbalance < 0) 1344 for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
1418 imbalance = busiest_weight; 1345#ifdef CONFIG_FAIR_GROUP_SCHED
1346 struct cfs_rq *this_cfs_rq;
1347 long imbalance;
1348 unsigned long maxload;
1419 1349
1420 max_load = max(rem_load, imbalance); 1350 this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu);
1421 moved_load = __load_balance_fair(this_rq, this_cpu, busiest,
1422 max_load, sd, idle, all_pinned, this_best_prio,
1423 tg->cfs_rq[busiest_cpu]);
1424 1351
1425 if (!moved_load) 1352 imbalance = busy_cfs_rq->load.weight - this_cfs_rq->load.weight;
1353 /* Don't pull if this_cfs_rq has more load than busy_cfs_rq */
1354 if (imbalance <= 0)
1426 continue; 1355 continue;
1427 1356
1428 move_group_shares(tg, sd, busiest_cpu, this_cpu); 1357 /* Don't pull more than imbalance/2 */
1358 imbalance /= 2;
1359 maxload = min(rem_load_move, imbalance);
1429 1360
1430 moved_load *= aggregate(tg, sd)->load; 1361 *this_best_prio = cfs_rq_best_prio(this_cfs_rq);
1431 moved_load /= aggregate(tg, sd)->rq_weight + 1; 1362#else
1363# define maxload rem_load_move
1364#endif
1365 /*
1366 * pass busy_cfs_rq argument into
1367 * load_balance_[start|next]_fair iterators
1368 */
1369 cfs_rq_iterator.arg = busy_cfs_rq;
1370 rem_load_move -= balance_tasks(this_rq, this_cpu, busiest,
1371 maxload, sd, idle, all_pinned,
1372 this_best_prio,
1373 &cfs_rq_iterator);
1432 1374
1433 rem_load_move -= moved_load; 1375 if (rem_load_move <= 0)
1434 if (rem_load_move < 0)
1435 break; 1376 break;
1436 } 1377 }
1437 rcu_read_unlock();
1438 1378
1439 return max_load_move - rem_load_move; 1379 return max_load_move - rem_load_move;
1440} 1380}
1441#else
1442static unsigned long
1443load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
1444 unsigned long max_load_move,
1445 struct sched_domain *sd, enum cpu_idle_type idle,
1446 int *all_pinned, int *this_best_prio)
1447{
1448 return __load_balance_fair(this_rq, this_cpu, busiest,
1449 max_load_move, sd, idle, all_pinned,
1450 this_best_prio, &busiest->cfs);
1451}
1452#endif
1453 1381
1454static int 1382static int
1455move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest, 1383move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 060e87b0cb1c..3432d573205d 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -513,8 +513,6 @@ static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
513 */ 513 */
514 for_each_sched_rt_entity(rt_se) 514 for_each_sched_rt_entity(rt_se)
515 enqueue_rt_entity(rt_se); 515 enqueue_rt_entity(rt_se);
516
517 inc_cpu_load(rq, p->se.load.weight);
518} 516}
519 517
520static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep) 518static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
@@ -534,8 +532,6 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
534 if (rt_rq && rt_rq->rt_nr_running) 532 if (rt_rq && rt_rq->rt_nr_running)
535 enqueue_rt_entity(rt_se); 533 enqueue_rt_entity(rt_se);
536 } 534 }
537
538 dec_cpu_load(rq, p->se.load.weight);
539} 535}
540 536
541/* 537/*
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 5bae2e0c3ff2..a38878e0e49d 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -67,6 +67,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
67 preempt_enable(); 67 preempt_enable();
68#endif 68#endif
69 } 69 }
70 kfree(mask_str);
70 return 0; 71 return 0;
71} 72}
72 73
diff --git a/kernel/signal.c b/kernel/signal.c
index 72bb4f51f963..6c0958e52ea7 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -231,6 +231,40 @@ void flush_signals(struct task_struct *t)
231 spin_unlock_irqrestore(&t->sighand->siglock, flags); 231 spin_unlock_irqrestore(&t->sighand->siglock, flags);
232} 232}
233 233
234static void __flush_itimer_signals(struct sigpending *pending)
235{
236 sigset_t signal, retain;
237 struct sigqueue *q, *n;
238
239 signal = pending->signal;
240 sigemptyset(&retain);
241
242 list_for_each_entry_safe(q, n, &pending->list, list) {
243 int sig = q->info.si_signo;
244
245 if (likely(q->info.si_code != SI_TIMER)) {
246 sigaddset(&retain, sig);
247 } else {
248 sigdelset(&signal, sig);
249 list_del_init(&q->list);
250 __sigqueue_free(q);
251 }
252 }
253
254 sigorsets(&pending->signal, &signal, &retain);
255}
256
257void flush_itimer_signals(void)
258{
259 struct task_struct *tsk = current;
260 unsigned long flags;
261
262 spin_lock_irqsave(&tsk->sighand->siglock, flags);
263 __flush_itimer_signals(&tsk->pending);
264 __flush_itimer_signals(&tsk->signal->shared_pending);
265 spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
266}
267
234void ignore_signals(struct task_struct *t) 268void ignore_signals(struct task_struct *t)
235{ 269{
236 int i; 270 int i;
@@ -1240,17 +1274,22 @@ void sigqueue_free(struct sigqueue *q)
1240 1274
1241 BUG_ON(!(q->flags & SIGQUEUE_PREALLOC)); 1275 BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
1242 /* 1276 /*
1243 * If the signal is still pending remove it from the 1277 * We must hold ->siglock while testing q->list
1244 * pending queue. We must hold ->siglock while testing 1278 * to serialize with collect_signal() or with
1245 * q->list to serialize with collect_signal(). 1279 * __exit_signal()->flush_sigqueue().
1246 */ 1280 */
1247 spin_lock_irqsave(lock, flags); 1281 spin_lock_irqsave(lock, flags);
1282 q->flags &= ~SIGQUEUE_PREALLOC;
1283 /*
1284 * If it is queued it will be freed when dequeued,
1285 * like the "regular" sigqueue.
1286 */
1248 if (!list_empty(&q->list)) 1287 if (!list_empty(&q->list))
1249 list_del_init(&q->list); 1288 q = NULL;
1250 spin_unlock_irqrestore(lock, flags); 1289 spin_unlock_irqrestore(lock, flags);
1251 1290
1252 q->flags &= ~SIGQUEUE_PREALLOC; 1291 if (q)
1253 __sigqueue_free(q); 1292 __sigqueue_free(q);
1254} 1293}
1255 1294
1256int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group) 1295int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group)
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 0101aeef7ed7..b7350bbfb076 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -62,8 +62,7 @@ static int stopmachine(void *cpu)
62 * help our sisters onto their CPUs. */ 62 * help our sisters onto their CPUs. */
63 if (!prepared && !irqs_disabled) 63 if (!prepared && !irqs_disabled)
64 yield(); 64 yield();
65 else 65 cpu_relax();
66 cpu_relax();
67 } 66 }
68 67
69 /* Ack: we are exiting. */ 68 /* Ack: we are exiting. */
@@ -106,8 +105,10 @@ static int stop_machine(void)
106 } 105 }
107 106
108 /* Wait for them all to come to life. */ 107 /* Wait for them all to come to life. */
109 while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads) 108 while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads) {
110 yield(); 109 yield();
110 cpu_relax();
111 }
111 112
112 /* If some failed, kill them all. */ 113 /* If some failed, kill them all. */
113 if (ret < 0) { 114 if (ret < 0) {
diff --git a/kernel/sys.c b/kernel/sys.c
index 895d2d4c9493..14e97282eb6c 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1652,7 +1652,7 @@ asmlinkage long sys_umask(int mask)
1652asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, 1652asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
1653 unsigned long arg4, unsigned long arg5) 1653 unsigned long arg4, unsigned long arg5)
1654{ 1654{
1655 long uninitialized_var(error); 1655 long error = 0;
1656 1656
1657 if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error)) 1657 if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error))
1658 return error; 1658 return error;
@@ -1701,9 +1701,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
1701 error = PR_TIMING_STATISTICAL; 1701 error = PR_TIMING_STATISTICAL;
1702 break; 1702 break;
1703 case PR_SET_TIMING: 1703 case PR_SET_TIMING:
1704 if (arg2 == PR_TIMING_STATISTICAL) 1704 if (arg2 != PR_TIMING_STATISTICAL)
1705 error = 0;
1706 else
1707 error = -EINVAL; 1705 error = -EINVAL;
1708 break; 1706 break;
1709 1707
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d7ffdc59816a..29116652dca8 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -81,6 +81,7 @@ extern int compat_log;
81extern int maps_protect; 81extern int maps_protect;
82extern int sysctl_stat_interval; 82extern int sysctl_stat_interval;
83extern int latencytop_enabled; 83extern int latencytop_enabled;
84extern int sysctl_nr_open_min, sysctl_nr_open_max;
84 85
85/* Constants used for minimum and maximum */ 86/* Constants used for minimum and maximum */
86#if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM) 87#if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
@@ -1190,7 +1191,9 @@ static struct ctl_table fs_table[] = {
1190 .data = &sysctl_nr_open, 1191 .data = &sysctl_nr_open,
1191 .maxlen = sizeof(int), 1192 .maxlen = sizeof(int),
1192 .mode = 0644, 1193 .mode = 0644,
1193 .proc_handler = &proc_dointvec, 1194 .proc_handler = &proc_dointvec_minmax,
1195 .extra1 = &sysctl_nr_open_min,
1196 .extra2 = &sysctl_nr_open_max,
1194 }, 1197 },
1195 { 1198 {
1196 .ctl_name = FS_DENTRY, 1199 .ctl_name = FS_DENTRY,
diff --git a/lib/bitmap.c b/lib/bitmap.c
index c4cb48f77f0c..482df94ea21e 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -316,22 +316,6 @@ int bitmap_scnprintf(char *buf, unsigned int buflen,
316EXPORT_SYMBOL(bitmap_scnprintf); 316EXPORT_SYMBOL(bitmap_scnprintf);
317 317
318/** 318/**
319 * bitmap_scnprintf_len - return buffer length needed to convert
320 * bitmap to an ASCII hex string.
321 * @len: number of bits to be converted
322 */
323int bitmap_scnprintf_len(unsigned int len)
324{
325 /* we need 9 chars per word for 32 bit words (8 hexdigits + sep/null) */
326 int bitslen = ALIGN(len, CHUNKSZ);
327 int wordlen = CHUNKSZ / 4;
328 int buflen = (bitslen / wordlen) * (wordlen + 1) * sizeof(char);
329
330 return buflen;
331}
332EXPORT_SYMBOL(bitmap_scnprintf_len);
333
334/**
335 * __bitmap_parse - convert an ASCII hex string into a bitmap. 319 * __bitmap_parse - convert an ASCII hex string into a bitmap.
336 * @buf: pointer to buffer containing string. 320 * @buf: pointer to buffer containing string.
337 * @buflen: buffer size in bytes. If string is smaller than this 321 * @buflen: buffer size in bytes. If string is smaller than this
diff --git a/lib/bitrev.c b/lib/bitrev.c
index 989aff73f881..3956203456d4 100644
--- a/lib/bitrev.c
+++ b/lib/bitrev.c
@@ -42,10 +42,11 @@ const u8 byte_rev_table[256] = {
42}; 42};
43EXPORT_SYMBOL_GPL(byte_rev_table); 43EXPORT_SYMBOL_GPL(byte_rev_table);
44 44
45static __always_inline u16 bitrev16(u16 x) 45u16 bitrev16(u16 x)
46{ 46{
47 return (bitrev8(x & 0xff) << 8) | bitrev8(x >> 8); 47 return (bitrev8(x & 0xff) << 8) | bitrev8(x >> 8);
48} 48}
49EXPORT_SYMBOL(bitrev16);
49 50
50/** 51/**
51 * bitrev32 - reverse the order of bits in a u32 value 52 * bitrev32 - reverse the order of bits in a u32 value
diff --git a/lib/div64.c b/lib/div64.c
index bb5bd0c0f030..a111eb8de9cf 100644
--- a/lib/div64.c
+++ b/lib/div64.c
@@ -98,3 +98,13 @@ EXPORT_SYMBOL(div64_u64);
98#endif 98#endif
99 99
100#endif /* BITS_PER_LONG == 32 */ 100#endif /* BITS_PER_LONG == 32 */
101
102/*
103 * Iterative div/mod for use when dividend is not expected to be much
104 * bigger than divisor.
105 */
106u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
107{
108 return __iter_div_u64_rem(dividend, divisor, remainder);
109}
110EXPORT_SYMBOL(iter_div_u64_rem);
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 343546550dc9..f07c0db81d26 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -12,6 +12,9 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14 14
15const char hex_asc[] = "0123456789abcdef";
16EXPORT_SYMBOL(hex_asc);
17
15/** 18/**
16 * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory 19 * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
17 * @buf: data blob to dump 20 * @buf: data blob to dump
@@ -93,8 +96,8 @@ void hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
93 for (j = 0; (j < rowsize) && (j < len) && (lx + 4) < linebuflen; 96 for (j = 0; (j < rowsize) && (j < len) && (lx + 4) < linebuflen;
94 j++) { 97 j++) {
95 ch = ptr[j]; 98 ch = ptr[j];
96 linebuf[lx++] = hex_asc(ch >> 4); 99 linebuf[lx++] = hex_asc_hi(ch);
97 linebuf[lx++] = hex_asc(ch & 0x0f); 100 linebuf[lx++] = hex_asc_lo(ch);
98 linebuf[lx++] = ' '; 101 linebuf[lx++] = ' ';
99 } 102 }
100 ascii_column = 3 * rowsize + 2; 103 ascii_column = 3 * rowsize + 2;
diff --git a/lib/lmb.c b/lib/lmb.c
index 83287d3869a3..5d7b9286503e 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -19,31 +19,43 @@
19 19
20struct lmb lmb; 20struct lmb lmb;
21 21
22static int lmb_debug;
23
24static int __init early_lmb(char *p)
25{
26 if (p && strstr(p, "debug"))
27 lmb_debug = 1;
28 return 0;
29}
30early_param("lmb", early_lmb);
31
22void lmb_dump_all(void) 32void lmb_dump_all(void)
23{ 33{
24#ifdef DEBUG
25 unsigned long i; 34 unsigned long i;
26 35
27 pr_debug("lmb_dump_all:\n"); 36 if (!lmb_debug)
28 pr_debug(" memory.cnt = 0x%lx\n", lmb.memory.cnt); 37 return;
29 pr_debug(" memory.size = 0x%llx\n", 38
39 pr_info("lmb_dump_all:\n");
40 pr_info(" memory.cnt = 0x%lx\n", lmb.memory.cnt);
41 pr_info(" memory.size = 0x%llx\n",
30 (unsigned long long)lmb.memory.size); 42 (unsigned long long)lmb.memory.size);
31 for (i=0; i < lmb.memory.cnt ;i++) { 43 for (i=0; i < lmb.memory.cnt ;i++) {
32 pr_debug(" memory.region[0x%x].base = 0x%llx\n", 44 pr_info(" memory.region[0x%lx].base = 0x%llx\n",
33 i, (unsigned long long)lmb.memory.region[i].base); 45 i, (unsigned long long)lmb.memory.region[i].base);
34 pr_debug(" .size = 0x%llx\n", 46 pr_info(" .size = 0x%llx\n",
35 (unsigned long long)lmb.memory.region[i].size); 47 (unsigned long long)lmb.memory.region[i].size);
36 } 48 }
37 49
38 pr_debug(" reserved.cnt = 0x%lx\n", lmb.reserved.cnt); 50 pr_info(" reserved.cnt = 0x%lx\n", lmb.reserved.cnt);
39 pr_debug(" reserved.size = 0x%lx\n", lmb.reserved.size); 51 pr_info(" reserved.size = 0x%llx\n",
52 (unsigned long long)lmb.memory.size);
40 for (i=0; i < lmb.reserved.cnt ;i++) { 53 for (i=0; i < lmb.reserved.cnt ;i++) {
41 pr_debug(" reserved.region[0x%x].base = 0x%llx\n", 54 pr_info(" reserved.region[0x%lx].base = 0x%llx\n",
42 i, (unsigned long long)lmb.reserved.region[i].base); 55 i, (unsigned long long)lmb.reserved.region[i].base);
43 pr_debug(" .size = 0x%llx\n", 56 pr_info(" .size = 0x%llx\n",
44 (unsigned long long)lmb.reserved.region[i].size); 57 (unsigned long long)lmb.reserved.region[i].size);
45 } 58 }
46#endif /* DEBUG */
47} 59}
48 60
49static unsigned long lmb_addrs_overlap(u64 base1, u64 size1, u64 base2, 61static unsigned long lmb_addrs_overlap(u64 base1, u64 size1, u64 base2,
@@ -286,8 +298,7 @@ static u64 __init lmb_alloc_nid_unreserved(u64 start, u64 end,
286 j = lmb_overlaps_region(&lmb.reserved, base, size); 298 j = lmb_overlaps_region(&lmb.reserved, base, size);
287 if (j < 0) { 299 if (j < 0) {
288 /* this area isn't reserved, take it */ 300 /* this area isn't reserved, take it */
289 if (lmb_add_region(&lmb.reserved, base, 301 if (lmb_add_region(&lmb.reserved, base, size) < 0)
290 lmb_align_up(size, align)) < 0)
291 base = ~(u64)0; 302 base = ~(u64)0;
292 return base; 303 return base;
293 } 304 }
@@ -333,6 +344,10 @@ u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
333 struct lmb_region *mem = &lmb.memory; 344 struct lmb_region *mem = &lmb.memory;
334 int i; 345 int i;
335 346
347 BUG_ON(0 == size);
348
349 size = lmb_align_up(size, align);
350
336 for (i = 0; i < mem->cnt; i++) { 351 for (i = 0; i < mem->cnt; i++) {
337 u64 ret = lmb_alloc_nid_region(&mem->region[i], 352 u64 ret = lmb_alloc_nid_region(&mem->region[i],
338 nid_range, 353 nid_range,
@@ -370,6 +385,8 @@ u64 __init __lmb_alloc_base(u64 size, u64 align, u64 max_addr)
370 385
371 BUG_ON(0 == size); 386 BUG_ON(0 == size);
372 387
388 size = lmb_align_up(size, align);
389
373 /* On some platforms, make sure we allocate lowmem */ 390 /* On some platforms, make sure we allocate lowmem */
374 /* Note that LMB_REAL_LIMIT may be LMB_ALLOC_ANYWHERE */ 391 /* Note that LMB_REAL_LIMIT may be LMB_ALLOC_ANYWHERE */
375 if (max_addr == LMB_ALLOC_ANYWHERE) 392 if (max_addr == LMB_ALLOC_ANYWHERE)
@@ -393,8 +410,7 @@ u64 __init __lmb_alloc_base(u64 size, u64 align, u64 max_addr)
393 j = lmb_overlaps_region(&lmb.reserved, base, size); 410 j = lmb_overlaps_region(&lmb.reserved, base, size);
394 if (j < 0) { 411 if (j < 0) {
395 /* this area isn't reserved, take it */ 412 /* this area isn't reserved, take it */
396 if (lmb_add_region(&lmb.reserved, base, 413 if (lmb_add_region(&lmb.reserved, base, size) < 0)
397 lmb_align_up(size, align)) < 0)
398 return 0; 414 return 0;
399 return base; 415 return base;
400 } 416 }
diff --git a/lib/parser.c b/lib/parser.c
index 703c8c13b346..4f0cbc03e0e8 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -182,18 +182,25 @@ int match_hex(substring_t *s, int *result)
182} 182}
183 183
184/** 184/**
185 * match_strcpy: - copies the characters from a substring_t to a string 185 * match_strlcpy: - Copy the characters from a substring_t to a sized buffer
186 * @to: string to copy characters to. 186 * @dest: where to copy to
187 * @s: &substring_t to copy 187 * @src: &substring_t to copy
188 * @size: size of destination buffer
188 * 189 *
189 * Description: Copies the set of characters represented by the given 190 * Description: Copy the characters in &substring_t @src to the
190 * &substring_t @s to the c-style string @to. Caller guarantees that @to is 191 * c-style string @dest. Copy no more than @size - 1 characters, plus
191 * large enough to hold the characters of @s. 192 * the terminating NUL. Return length of @src.
192 */ 193 */
193void match_strcpy(char *to, const substring_t *s) 194size_t match_strlcpy(char *dest, const substring_t *src, size_t size)
194{ 195{
195 memcpy(to, s->from, s->to - s->from); 196 size_t ret = src->to - src->from;
196 to[s->to - s->from] = '\0'; 197
198 if (size) {
199 size_t len = ret >= size ? size - 1 : ret;
200 memcpy(dest, src->from, len);
201 dest[len] = '\0';
202 }
203 return ret;
197} 204}
198 205
199/** 206/**
@@ -206,9 +213,10 @@ void match_strcpy(char *to, const substring_t *s)
206 */ 213 */
207char *match_strdup(const substring_t *s) 214char *match_strdup(const substring_t *s)
208{ 215{
209 char *p = kmalloc(s->to - s->from + 1, GFP_KERNEL); 216 size_t sz = s->to - s->from + 1;
217 char *p = kmalloc(sz, GFP_KERNEL);
210 if (p) 218 if (p)
211 match_strcpy(p, s); 219 match_strlcpy(p, s, sz);
212 return p; 220 return p;
213} 221}
214 222
@@ -216,5 +224,5 @@ EXPORT_SYMBOL(match_token);
216EXPORT_SYMBOL(match_int); 224EXPORT_SYMBOL(match_int);
217EXPORT_SYMBOL(match_octal); 225EXPORT_SYMBOL(match_octal);
218EXPORT_SYMBOL(match_hex); 226EXPORT_SYMBOL(match_hex);
219EXPORT_SYMBOL(match_strcpy); 227EXPORT_SYMBOL(match_strlcpy);
220EXPORT_SYMBOL(match_strdup); 228EXPORT_SYMBOL(match_strdup);
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index bd521716ab1a..169a2f8dabcc 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -88,6 +88,57 @@ static inline gfp_t root_gfp_mask(struct radix_tree_root *root)
88 return root->gfp_mask & __GFP_BITS_MASK; 88 return root->gfp_mask & __GFP_BITS_MASK;
89} 89}
90 90
91static inline void tag_set(struct radix_tree_node *node, unsigned int tag,
92 int offset)
93{
94 __set_bit(offset, node->tags[tag]);
95}
96
97static inline void tag_clear(struct radix_tree_node *node, unsigned int tag,
98 int offset)
99{
100 __clear_bit(offset, node->tags[tag]);
101}
102
103static inline int tag_get(struct radix_tree_node *node, unsigned int tag,
104 int offset)
105{
106 return test_bit(offset, node->tags[tag]);
107}
108
109static inline void root_tag_set(struct radix_tree_root *root, unsigned int tag)
110{
111 root->gfp_mask |= (__force gfp_t)(1 << (tag + __GFP_BITS_SHIFT));
112}
113
114static inline void root_tag_clear(struct radix_tree_root *root, unsigned int tag)
115{
116 root->gfp_mask &= (__force gfp_t)~(1 << (tag + __GFP_BITS_SHIFT));
117}
118
119static inline void root_tag_clear_all(struct radix_tree_root *root)
120{
121 root->gfp_mask &= __GFP_BITS_MASK;
122}
123
124static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag)
125{
126 return (__force unsigned)root->gfp_mask & (1 << (tag + __GFP_BITS_SHIFT));
127}
128
129/*
130 * Returns 1 if any slot in the node has this tag set.
131 * Otherwise returns 0.
132 */
133static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag)
134{
135 int idx;
136 for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) {
137 if (node->tags[tag][idx])
138 return 1;
139 }
140 return 0;
141}
91/* 142/*
92 * This assumes that the caller has performed appropriate preallocation, and 143 * This assumes that the caller has performed appropriate preallocation, and
93 * that the caller has pinned this thread of control to the current CPU. 144 * that the caller has pinned this thread of control to the current CPU.
@@ -124,6 +175,17 @@ static void radix_tree_node_rcu_free(struct rcu_head *head)
124{ 175{
125 struct radix_tree_node *node = 176 struct radix_tree_node *node =
126 container_of(head, struct radix_tree_node, rcu_head); 177 container_of(head, struct radix_tree_node, rcu_head);
178
179 /*
180 * must only free zeroed nodes into the slab. radix_tree_shrink
181 * can leave us with a non-NULL entry in the first slot, so clear
182 * that here to make sure.
183 */
184 tag_clear(node, 0, 0);
185 tag_clear(node, 1, 0);
186 node->slots[0] = NULL;
187 node->count = 0;
188
127 kmem_cache_free(radix_tree_node_cachep, node); 189 kmem_cache_free(radix_tree_node_cachep, node);
128} 190}
129 191
@@ -165,59 +227,6 @@ out:
165} 227}
166EXPORT_SYMBOL(radix_tree_preload); 228EXPORT_SYMBOL(radix_tree_preload);
167 229
168static inline void tag_set(struct radix_tree_node *node, unsigned int tag,
169 int offset)
170{
171 __set_bit(offset, node->tags[tag]);
172}
173
174static inline void tag_clear(struct radix_tree_node *node, unsigned int tag,
175 int offset)
176{
177 __clear_bit(offset, node->tags[tag]);
178}
179
180static inline int tag_get(struct radix_tree_node *node, unsigned int tag,
181 int offset)
182{
183 return test_bit(offset, node->tags[tag]);
184}
185
186static inline void root_tag_set(struct radix_tree_root *root, unsigned int tag)
187{
188 root->gfp_mask |= (__force gfp_t)(1 << (tag + __GFP_BITS_SHIFT));
189}
190
191
192static inline void root_tag_clear(struct radix_tree_root *root, unsigned int tag)
193{
194 root->gfp_mask &= (__force gfp_t)~(1 << (tag + __GFP_BITS_SHIFT));
195}
196
197static inline void root_tag_clear_all(struct radix_tree_root *root)
198{
199 root->gfp_mask &= __GFP_BITS_MASK;
200}
201
202static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag)
203{
204 return (__force unsigned)root->gfp_mask & (1 << (tag + __GFP_BITS_SHIFT));
205}
206
207/*
208 * Returns 1 if any slot in the node has this tag set.
209 * Otherwise returns 0.
210 */
211static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag)
212{
213 int idx;
214 for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) {
215 if (node->tags[tag][idx])
216 return 1;
217 }
218 return 0;
219}
220
221/* 230/*
222 * Return the maximum key which can be store into a 231 * Return the maximum key which can be store into a
223 * radix tree with height HEIGHT. 232 * radix tree with height HEIGHT.
@@ -930,11 +939,6 @@ static inline void radix_tree_shrink(struct radix_tree_root *root)
930 newptr = radix_tree_ptr_to_indirect(newptr); 939 newptr = radix_tree_ptr_to_indirect(newptr);
931 root->rnode = newptr; 940 root->rnode = newptr;
932 root->height--; 941 root->height--;
933 /* must only free zeroed nodes into the slab */
934 tag_clear(to_free, 0, 0);
935 tag_clear(to_free, 1, 0);
936 to_free->slots[0] = NULL;
937 to_free->count = 0;
938 radix_tree_node_free(to_free); 942 radix_tree_node_free(to_free);
939 } 943 }
940} 944}
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 7c4f9e097095..f2e574dbc300 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -172,30 +172,22 @@ postcore_initcall(bdi_class_init);
172int bdi_register(struct backing_dev_info *bdi, struct device *parent, 172int bdi_register(struct backing_dev_info *bdi, struct device *parent,
173 const char *fmt, ...) 173 const char *fmt, ...)
174{ 174{
175 char *name;
176 va_list args; 175 va_list args;
177 int ret = 0; 176 int ret = 0;
178 struct device *dev; 177 struct device *dev;
179 178
180 va_start(args, fmt); 179 va_start(args, fmt);
181 name = kvasprintf(GFP_KERNEL, fmt, args); 180 dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args);
182 va_end(args); 181 va_end(args);
183
184 if (!name)
185 return -ENOMEM;
186
187 dev = device_create(bdi_class, parent, MKDEV(0, 0), name);
188 if (IS_ERR(dev)) { 182 if (IS_ERR(dev)) {
189 ret = PTR_ERR(dev); 183 ret = PTR_ERR(dev);
190 goto exit; 184 goto exit;
191 } 185 }
192 186
193 bdi->dev = dev; 187 bdi->dev = dev;
194 dev_set_drvdata(bdi->dev, bdi); 188 bdi_debug_register(bdi, dev_name(dev));
195 bdi_debug_register(bdi, name);
196 189
197exit: 190exit:
198 kfree(name);
199 return ret; 191 return ret;
200} 192}
201EXPORT_SYMBOL(bdi_register); 193EXPORT_SYMBOL(bdi_register);
diff --git a/mm/filemap.c b/mm/filemap.c
index 2dead9adf8b7..1e6a7d34874f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1461,6 +1461,11 @@ page_not_uptodate:
1461 */ 1461 */
1462 ClearPageError(page); 1462 ClearPageError(page);
1463 error = mapping->a_ops->readpage(file, page); 1463 error = mapping->a_ops->readpage(file, page);
1464 if (!error) {
1465 wait_on_page_locked(page);
1466 if (!PageUptodate(page))
1467 error = -EIO;
1468 }
1464 page_cache_release(page); 1469 page_cache_release(page);
1465 1470
1466 if (!error || error == AOP_TRUNCATED_PAGE) 1471 if (!error || error == AOP_TRUNCATED_PAGE)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index bbf953eeb58b..ab171274ef21 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -785,7 +785,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
785 continue; 785 continue;
786 786
787 spin_lock(&dst->page_table_lock); 787 spin_lock(&dst->page_table_lock);
788 spin_lock(&src->page_table_lock); 788 spin_lock_nested(&src->page_table_lock, SINGLE_DEPTH_NESTING);
789 if (!huge_pte_none(huge_ptep_get(src_pte))) { 789 if (!huge_pte_none(huge_ptep_get(src_pte))) {
790 if (cow) 790 if (cow)
791 huge_ptep_set_wrprotect(src, addr, src_pte); 791 huge_ptep_set_wrprotect(src, addr, src_pte);
diff --git a/mm/memory.c b/mm/memory.c
index 48c122d42ed7..19e0ae9beecb 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -311,6 +311,21 @@ int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address)
311 if (!new) 311 if (!new)
312 return -ENOMEM; 312 return -ENOMEM;
313 313
314 /*
315 * Ensure all pte setup (eg. pte page lock and page clearing) are
316 * visible before the pte is made visible to other CPUs by being
317 * put into page tables.
318 *
319 * The other side of the story is the pointer chasing in the page
320 * table walking code (when walking the page table without locking;
321 * ie. most of the time). Fortunately, these data accesses consist
322 * of a chain of data-dependent loads, meaning most CPUs (alpha
323 * being the notable exception) will already guarantee loads are
324 * seen in-order. See the alpha page table accessors for the
325 * smp_read_barrier_depends() barriers in page table walking code.
326 */
327 smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */
328
314 spin_lock(&mm->page_table_lock); 329 spin_lock(&mm->page_table_lock);
315 if (!pmd_present(*pmd)) { /* Has another populated it ? */ 330 if (!pmd_present(*pmd)) { /* Has another populated it ? */
316 mm->nr_ptes++; 331 mm->nr_ptes++;
@@ -329,6 +344,8 @@ int __pte_alloc_kernel(pmd_t *pmd, unsigned long address)
329 if (!new) 344 if (!new)
330 return -ENOMEM; 345 return -ENOMEM;
331 346
347 smp_wmb(); /* See comment in __pte_alloc */
348
332 spin_lock(&init_mm.page_table_lock); 349 spin_lock(&init_mm.page_table_lock);
333 if (!pmd_present(*pmd)) { /* Has another populated it ? */ 350 if (!pmd_present(*pmd)) { /* Has another populated it ? */
334 pmd_populate_kernel(&init_mm, pmd, new); 351 pmd_populate_kernel(&init_mm, pmd, new);
@@ -2278,8 +2295,6 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2278 vmf.flags = flags; 2295 vmf.flags = flags;
2279 vmf.page = NULL; 2296 vmf.page = NULL;
2280 2297
2281 BUG_ON(vma->vm_flags & VM_PFNMAP);
2282
2283 ret = vma->vm_ops->fault(vma, &vmf); 2298 ret = vma->vm_ops->fault(vma, &vmf);
2284 if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) 2299 if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))
2285 return ret; 2300 return ret;
@@ -2619,6 +2634,8 @@ int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
2619 if (!new) 2634 if (!new)
2620 return -ENOMEM; 2635 return -ENOMEM;
2621 2636
2637 smp_wmb(); /* See comment in __pte_alloc */
2638
2622 spin_lock(&mm->page_table_lock); 2639 spin_lock(&mm->page_table_lock);
2623 if (pgd_present(*pgd)) /* Another has populated it */ 2640 if (pgd_present(*pgd)) /* Another has populated it */
2624 pud_free(mm, new); 2641 pud_free(mm, new);
@@ -2640,6 +2657,8 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
2640 if (!new) 2657 if (!new)
2641 return -ENOMEM; 2658 return -ENOMEM;
2642 2659
2660 smp_wmb(); /* See comment in __pte_alloc */
2661
2643 spin_lock(&mm->page_table_lock); 2662 spin_lock(&mm->page_table_lock);
2644#ifndef __ARCH_HAS_4LEVEL_HACK 2663#ifndef __ARCH_HAS_4LEVEL_HACK
2645 if (pud_present(*pud)) /* Another has populated it */ 2664 if (pud_present(*pud)) /* Another has populated it */
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b17dca7249f8..833f854eabe5 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -159,21 +159,58 @@ void register_page_bootmem_info_node(struct pglist_data *pgdat)
159} 159}
160#endif /* !CONFIG_SPARSEMEM_VMEMMAP */ 160#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
161 161
162static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
163 unsigned long end_pfn)
164{
165 unsigned long old_zone_end_pfn;
166
167 zone_span_writelock(zone);
168
169 old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
170 if (start_pfn < zone->zone_start_pfn)
171 zone->zone_start_pfn = start_pfn;
172
173 zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
174 zone->zone_start_pfn;
175
176 zone_span_writeunlock(zone);
177}
178
179static void grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn,
180 unsigned long end_pfn)
181{
182 unsigned long old_pgdat_end_pfn =
183 pgdat->node_start_pfn + pgdat->node_spanned_pages;
184
185 if (start_pfn < pgdat->node_start_pfn)
186 pgdat->node_start_pfn = start_pfn;
187
188 pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
189 pgdat->node_start_pfn;
190}
191
162static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) 192static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
163{ 193{
164 struct pglist_data *pgdat = zone->zone_pgdat; 194 struct pglist_data *pgdat = zone->zone_pgdat;
165 int nr_pages = PAGES_PER_SECTION; 195 int nr_pages = PAGES_PER_SECTION;
166 int nid = pgdat->node_id; 196 int nid = pgdat->node_id;
167 int zone_type; 197 int zone_type;
198 unsigned long flags;
168 199
169 zone_type = zone - pgdat->node_zones; 200 zone_type = zone - pgdat->node_zones;
170 if (!zone->wait_table) { 201 if (!zone->wait_table) {
171 int ret = 0; 202 int ret;
203
172 ret = init_currently_empty_zone(zone, phys_start_pfn, 204 ret = init_currently_empty_zone(zone, phys_start_pfn,
173 nr_pages, MEMMAP_HOTPLUG); 205 nr_pages, MEMMAP_HOTPLUG);
174 if (ret < 0) 206 if (ret)
175 return ret; 207 return ret;
176 } 208 }
209 pgdat_resize_lock(zone->zone_pgdat, &flags);
210 grow_zone_span(zone, phys_start_pfn, phys_start_pfn + nr_pages);
211 grow_pgdat_span(zone->zone_pgdat, phys_start_pfn,
212 phys_start_pfn + nr_pages);
213 pgdat_resize_unlock(zone->zone_pgdat, &flags);
177 memmap_init_zone(nr_pages, nid, zone_type, 214 memmap_init_zone(nr_pages, nid, zone_type,
178 phys_start_pfn, MEMMAP_HOTPLUG); 215 phys_start_pfn, MEMMAP_HOTPLUG);
179 return 0; 216 return 0;
@@ -299,36 +336,6 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
299} 336}
300EXPORT_SYMBOL_GPL(__remove_pages); 337EXPORT_SYMBOL_GPL(__remove_pages);
301 338
302static void grow_zone_span(struct zone *zone,
303 unsigned long start_pfn, unsigned long end_pfn)
304{
305 unsigned long old_zone_end_pfn;
306
307 zone_span_writelock(zone);
308
309 old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
310 if (start_pfn < zone->zone_start_pfn)
311 zone->zone_start_pfn = start_pfn;
312
313 zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
314 zone->zone_start_pfn;
315
316 zone_span_writeunlock(zone);
317}
318
319static void grow_pgdat_span(struct pglist_data *pgdat,
320 unsigned long start_pfn, unsigned long end_pfn)
321{
322 unsigned long old_pgdat_end_pfn =
323 pgdat->node_start_pfn + pgdat->node_spanned_pages;
324
325 if (start_pfn < pgdat->node_start_pfn)
326 pgdat->node_start_pfn = start_pfn;
327
328 pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
329 pgdat->node_start_pfn;
330}
331
332void online_page(struct page *page) 339void online_page(struct page *page)
333{ 340{
334 totalram_pages++; 341 totalram_pages++;
@@ -367,7 +374,6 @@ static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
367 374
368int online_pages(unsigned long pfn, unsigned long nr_pages) 375int online_pages(unsigned long pfn, unsigned long nr_pages)
369{ 376{
370 unsigned long flags;
371 unsigned long onlined_pages = 0; 377 unsigned long onlined_pages = 0;
372 struct zone *zone; 378 struct zone *zone;
373 int need_zonelists_rebuild = 0; 379 int need_zonelists_rebuild = 0;
@@ -395,11 +401,6 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
395 * memory_block->state_mutex. 401 * memory_block->state_mutex.
396 */ 402 */
397 zone = page_zone(pfn_to_page(pfn)); 403 zone = page_zone(pfn_to_page(pfn));
398 pgdat_resize_lock(zone->zone_pgdat, &flags);
399 grow_zone_span(zone, pfn, pfn + nr_pages);
400 grow_pgdat_span(zone->zone_pgdat, pfn, pfn + nr_pages);
401 pgdat_resize_unlock(zone->zone_pgdat, &flags);
402
403 /* 404 /*
404 * If this zone is not populated, then it is not in zonelist. 405 * If this zone is not populated, then it is not in zonelist.
405 * This means the page allocator ignores this zone. 406 * This means the page allocator ignores this zone.
@@ -408,8 +409,15 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
408 if (!populated_zone(zone)) 409 if (!populated_zone(zone))
409 need_zonelists_rebuild = 1; 410 need_zonelists_rebuild = 1;
410 411
411 walk_memory_resource(pfn, nr_pages, &onlined_pages, 412 ret = walk_memory_resource(pfn, nr_pages, &onlined_pages,
412 online_pages_range); 413 online_pages_range);
414 if (ret) {
415 printk(KERN_DEBUG "online_pages %lx at %lx failed\n",
416 nr_pages, pfn);
417 memory_notify(MEM_CANCEL_ONLINE, &arg);
418 return ret;
419 }
420
413 zone->present_pages += onlined_pages; 421 zone->present_pages += onlined_pages;
414 zone->zone_pgdat->node_present_pages += onlined_pages; 422 zone->zone_pgdat->node_present_pages += onlined_pages;
415 423
diff --git a/mm/mmap.c b/mm/mmap.c
index fac66337da2a..3354fdd83d4b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -80,7 +80,7 @@ EXPORT_SYMBOL(vm_get_page_prot);
80int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ 80int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
81int sysctl_overcommit_ratio = 50; /* default is 50% */ 81int sysctl_overcommit_ratio = 50; /* default is 50% */
82int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; 82int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
83atomic_t vm_committed_space = ATOMIC_INIT(0); 83atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0);
84 84
85/* 85/*
86 * Check that a process has enough memory to allocate a new virtual 86 * Check that a process has enough memory to allocate a new virtual
@@ -177,7 +177,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
177 * cast `allowed' as a signed long because vm_committed_space 177 * cast `allowed' as a signed long because vm_committed_space
178 * sometimes has a negative value 178 * sometimes has a negative value
179 */ 179 */
180 if (atomic_read(&vm_committed_space) < (long)allowed) 180 if (atomic_long_read(&vm_committed_space) < (long)allowed)
181 return 0; 181 return 0;
182error: 182error:
183 vm_unacct_memory(pages); 183 vm_unacct_memory(pages);
@@ -245,10 +245,16 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
245 unsigned long rlim, retval; 245 unsigned long rlim, retval;
246 unsigned long newbrk, oldbrk; 246 unsigned long newbrk, oldbrk;
247 struct mm_struct *mm = current->mm; 247 struct mm_struct *mm = current->mm;
248 unsigned long min_brk;
248 249
249 down_write(&mm->mmap_sem); 250 down_write(&mm->mmap_sem);
250 251
251 if (brk < mm->start_brk) 252#ifdef CONFIG_COMPAT_BRK
253 min_brk = mm->end_code;
254#else
255 min_brk = mm->start_brk;
256#endif
257 if (brk < min_brk)
252 goto out; 258 goto out;
253 259
254 /* 260 /*
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 4de546899dc1..a5bf31c27375 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -26,6 +26,13 @@
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
28 28
29#ifndef pgprot_modify
30static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
31{
32 return newprot;
33}
34#endif
35
29static void change_pte_range(struct mm_struct *mm, pmd_t *pmd, 36static void change_pte_range(struct mm_struct *mm, pmd_t *pmd,
30 unsigned long addr, unsigned long end, pgprot_t newprot, 37 unsigned long addr, unsigned long end, pgprot_t newprot,
31 int dirty_accountable) 38 int dirty_accountable)
@@ -192,7 +199,9 @@ success:
192 * held in write mode. 199 * held in write mode.
193 */ 200 */
194 vma->vm_flags = newflags; 201 vma->vm_flags = newflags;
195 vma->vm_page_prot = vm_get_page_prot(newflags); 202 vma->vm_page_prot = pgprot_modify(vma->vm_page_prot,
203 vm_get_page_prot(newflags));
204
196 if (vma_wants_writenotify(vma)) { 205 if (vma_wants_writenotify(vma)) {
197 vma->vm_page_prot = vm_get_page_prot(newflags & ~VM_SHARED); 206 vma->vm_page_prot = vm_get_page_prot(newflags & ~VM_SHARED);
198 dirty_accountable = 1; 207 dirty_accountable = 1;
diff --git a/mm/nommu.c b/mm/nommu.c
index ef8c62cec697..4462b6a3fcb9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -39,7 +39,7 @@ struct page *mem_map;
39unsigned long max_mapnr; 39unsigned long max_mapnr;
40unsigned long num_physpages; 40unsigned long num_physpages;
41unsigned long askedalloc, realalloc; 41unsigned long askedalloc, realalloc;
42atomic_t vm_committed_space = ATOMIC_INIT(0); 42atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0);
43int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ 43int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
44int sysctl_overcommit_ratio = 50; /* default is 50% */ 44int sysctl_overcommit_ratio = 50; /* default is 50% */
45int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; 45int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
@@ -109,16 +109,23 @@ unsigned int kobjsize(const void *objp)
109 * If the object we have should not have ksize performed on it, 109 * If the object we have should not have ksize performed on it,
110 * return size of 0 110 * return size of 0
111 */ 111 */
112 if (!objp || (unsigned long)objp >= memory_end || !((page = virt_to_page(objp)))) 112 if (!objp || !virt_addr_valid(objp))
113 return 0; 113 return 0;
114 114
115 page = virt_to_head_page(objp);
116
117 /*
118 * If the allocator sets PageSlab, we know the pointer came from
119 * kmalloc().
120 */
115 if (PageSlab(page)) 121 if (PageSlab(page))
116 return ksize(objp); 122 return ksize(objp);
117 123
118 BUG_ON(page->index < 0); 124 /*
119 BUG_ON(page->index >= MAX_ORDER); 125 * The ksize() function is only guaranteed to work for pointers
120 126 * returned by kmalloc(). So handle arbitrary pointers here.
121 return (PAGE_SIZE << page->index); 127 */
128 return PAGE_SIZE << compound_order(page);
122} 129}
123 130
124/* 131/*
@@ -1410,7 +1417,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
1410 * cast `allowed' as a signed long because vm_committed_space 1417 * cast `allowed' as a signed long because vm_committed_space
1411 * sometimes has a negative value 1418 * sometimes has a negative value
1412 */ 1419 */
1413 if (atomic_read(&vm_committed_space) < (long)allowed) 1420 if (atomic_long_read(&vm_committed_space) < (long)allowed)
1414 return 0; 1421 return 0;
1415error: 1422error:
1416 vm_unacct_memory(pages); 1423 vm_unacct_memory(pages);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bdd5c432c426..2f552955a02f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -237,16 +237,7 @@ static void bad_page(struct page *page)
237 printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n" 237 printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n"
238 KERN_EMERG "Backtrace:\n"); 238 KERN_EMERG "Backtrace:\n");
239 dump_stack(); 239 dump_stack();
240 page->flags &= ~(1 << PG_lru | 240 page->flags &= ~PAGE_FLAGS_CLEAR_WHEN_BAD;
241 1 << PG_private |
242 1 << PG_locked |
243 1 << PG_active |
244 1 << PG_dirty |
245 1 << PG_reclaim |
246 1 << PG_slab |
247 1 << PG_swapcache |
248 1 << PG_writeback |
249 1 << PG_buddy );
250 set_page_count(page, 0); 241 set_page_count(page, 0);
251 reset_page_mapcount(page); 242 reset_page_mapcount(page);
252 page->mapping = NULL; 243 page->mapping = NULL;
@@ -463,16 +454,7 @@ static inline int free_pages_check(struct page *page)
463 (page->mapping != NULL) | 454 (page->mapping != NULL) |
464 (page_get_page_cgroup(page) != NULL) | 455 (page_get_page_cgroup(page) != NULL) |
465 (page_count(page) != 0) | 456 (page_count(page) != 0) |
466 (page->flags & ( 457 (page->flags & PAGE_FLAGS_CHECK_AT_FREE)))
467 1 << PG_lru |
468 1 << PG_private |
469 1 << PG_locked |
470 1 << PG_active |
471 1 << PG_slab |
472 1 << PG_swapcache |
473 1 << PG_writeback |
474 1 << PG_reserved |
475 1 << PG_buddy ))))
476 bad_page(page); 458 bad_page(page);
477 if (PageDirty(page)) 459 if (PageDirty(page))
478 __ClearPageDirty(page); 460 __ClearPageDirty(page);
@@ -616,17 +598,7 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags)
616 (page->mapping != NULL) | 598 (page->mapping != NULL) |
617 (page_get_page_cgroup(page) != NULL) | 599 (page_get_page_cgroup(page) != NULL) |
618 (page_count(page) != 0) | 600 (page_count(page) != 0) |
619 (page->flags & ( 601 (page->flags & PAGE_FLAGS_CHECK_AT_PREP)))
620 1 << PG_lru |
621 1 << PG_private |
622 1 << PG_locked |
623 1 << PG_active |
624 1 << PG_dirty |
625 1 << PG_slab |
626 1 << PG_swapcache |
627 1 << PG_writeback |
628 1 << PG_reserved |
629 1 << PG_buddy ))))
630 bad_page(page); 602 bad_page(page);
631 603
632 /* 604 /*
@@ -1396,6 +1368,9 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order,
1396 1368
1397 (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask, 1369 (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask,
1398 &preferred_zone); 1370 &preferred_zone);
1371 if (!preferred_zone)
1372 return NULL;
1373
1399 classzone_idx = zone_idx(preferred_zone); 1374 classzone_idx = zone_idx(preferred_zone);
1400 1375
1401zonelist_scan: 1376zonelist_scan:
@@ -2804,7 +2779,7 @@ int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages)
2804 alloc_size = zone->wait_table_hash_nr_entries 2779 alloc_size = zone->wait_table_hash_nr_entries
2805 * sizeof(wait_queue_head_t); 2780 * sizeof(wait_queue_head_t);
2806 2781
2807 if (system_state == SYSTEM_BOOTING) { 2782 if (!slab_is_available()) {
2808 zone->wait_table = (wait_queue_head_t *) 2783 zone->wait_table = (wait_queue_head_t *)
2809 alloc_bootmem_node(pgdat, alloc_size); 2784 alloc_bootmem_node(pgdat, alloc_size);
2810 } else { 2785 } else {
@@ -2862,8 +2837,6 @@ __meminit int init_currently_empty_zone(struct zone *zone,
2862 2837
2863 zone->zone_start_pfn = zone_start_pfn; 2838 zone->zone_start_pfn = zone_start_pfn;
2864 2839
2865 memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn);
2866
2867 zone_init_free_lists(zone); 2840 zone_init_free_lists(zone);
2868 2841
2869 return 0; 2842 return 0;
@@ -3380,7 +3353,8 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
3380 * is used by this zone for memmap. This affects the watermark 3353 * is used by this zone for memmap. This affects the watermark
3381 * and per-cpu initialisations 3354 * and per-cpu initialisations
3382 */ 3355 */
3383 memmap_pages = (size * sizeof(struct page)) >> PAGE_SHIFT; 3356 memmap_pages =
3357 PAGE_ALIGN(size * sizeof(struct page)) >> PAGE_SHIFT;
3384 if (realsize >= memmap_pages) { 3358 if (realsize >= memmap_pages) {
3385 realsize -= memmap_pages; 3359 realsize -= memmap_pages;
3386 printk(KERN_DEBUG 3360 printk(KERN_DEBUG
@@ -3433,6 +3407,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
3433 ret = init_currently_empty_zone(zone, zone_start_pfn, 3407 ret = init_currently_empty_zone(zone, zone_start_pfn,
3434 size, MEMMAP_EARLY); 3408 size, MEMMAP_EARLY);
3435 BUG_ON(ret); 3409 BUG_ON(ret);
3410 memmap_init(size, nid, j, zone_start_pfn);
3436 zone_start_pfn += size; 3411 zone_start_pfn += size;
3437 } 3412 }
3438} 3413}
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index 0afd2387e507..d5878bed7841 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -3,14 +3,14 @@
3#include <linux/sched.h> 3#include <linux/sched.h>
4 4
5static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 5static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
6 const struct mm_walk *walk, void *private) 6 struct mm_walk *walk)
7{ 7{
8 pte_t *pte; 8 pte_t *pte;
9 int err = 0; 9 int err = 0;
10 10
11 pte = pte_offset_map(pmd, addr); 11 pte = pte_offset_map(pmd, addr);
12 for (;;) { 12 for (;;) {
13 err = walk->pte_entry(pte, addr, addr + PAGE_SIZE, private); 13 err = walk->pte_entry(pte, addr, addr + PAGE_SIZE, walk);
14 if (err) 14 if (err)
15 break; 15 break;
16 addr += PAGE_SIZE; 16 addr += PAGE_SIZE;
@@ -24,7 +24,7 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
24} 24}
25 25
26static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, 26static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
27 const struct mm_walk *walk, void *private) 27 struct mm_walk *walk)
28{ 28{
29 pmd_t *pmd; 29 pmd_t *pmd;
30 unsigned long next; 30 unsigned long next;
@@ -35,15 +35,15 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
35 next = pmd_addr_end(addr, end); 35 next = pmd_addr_end(addr, end);
36 if (pmd_none_or_clear_bad(pmd)) { 36 if (pmd_none_or_clear_bad(pmd)) {
37 if (walk->pte_hole) 37 if (walk->pte_hole)
38 err = walk->pte_hole(addr, next, private); 38 err = walk->pte_hole(addr, next, walk);
39 if (err) 39 if (err)
40 break; 40 break;
41 continue; 41 continue;
42 } 42 }
43 if (walk->pmd_entry) 43 if (walk->pmd_entry)
44 err = walk->pmd_entry(pmd, addr, next, private); 44 err = walk->pmd_entry(pmd, addr, next, walk);
45 if (!err && walk->pte_entry) 45 if (!err && walk->pte_entry)
46 err = walk_pte_range(pmd, addr, next, walk, private); 46 err = walk_pte_range(pmd, addr, next, walk);
47 if (err) 47 if (err)
48 break; 48 break;
49 } while (pmd++, addr = next, addr != end); 49 } while (pmd++, addr = next, addr != end);
@@ -52,7 +52,7 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
52} 52}
53 53
54static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end, 54static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
55 const struct mm_walk *walk, void *private) 55 struct mm_walk *walk)
56{ 56{
57 pud_t *pud; 57 pud_t *pud;
58 unsigned long next; 58 unsigned long next;
@@ -63,15 +63,15 @@ static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
63 next = pud_addr_end(addr, end); 63 next = pud_addr_end(addr, end);
64 if (pud_none_or_clear_bad(pud)) { 64 if (pud_none_or_clear_bad(pud)) {
65 if (walk->pte_hole) 65 if (walk->pte_hole)
66 err = walk->pte_hole(addr, next, private); 66 err = walk->pte_hole(addr, next, walk);
67 if (err) 67 if (err)
68 break; 68 break;
69 continue; 69 continue;
70 } 70 }
71 if (walk->pud_entry) 71 if (walk->pud_entry)
72 err = walk->pud_entry(pud, addr, next, private); 72 err = walk->pud_entry(pud, addr, next, walk);
73 if (!err && (walk->pmd_entry || walk->pte_entry)) 73 if (!err && (walk->pmd_entry || walk->pte_entry))
74 err = walk_pmd_range(pud, addr, next, walk, private); 74 err = walk_pmd_range(pud, addr, next, walk);
75 if (err) 75 if (err)
76 break; 76 break;
77 } while (pud++, addr = next, addr != end); 77 } while (pud++, addr = next, addr != end);
@@ -85,15 +85,15 @@ static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
85 * @addr: starting address 85 * @addr: starting address
86 * @end: ending address 86 * @end: ending address
87 * @walk: set of callbacks to invoke for each level of the tree 87 * @walk: set of callbacks to invoke for each level of the tree
88 * @private: private data passed to the callback function
89 * 88 *
90 * Recursively walk the page table for the memory area in a VMA, 89 * Recursively walk the page table for the memory area in a VMA,
91 * calling supplied callbacks. Callbacks are called in-order (first 90 * calling supplied callbacks. Callbacks are called in-order (first
92 * PGD, first PUD, first PMD, first PTE, second PTE... second PMD, 91 * PGD, first PUD, first PMD, first PTE, second PTE... second PMD,
93 * etc.). If lower-level callbacks are omitted, walking depth is reduced. 92 * etc.). If lower-level callbacks are omitted, walking depth is reduced.
94 * 93 *
95 * Each callback receives an entry pointer, the start and end of the 94 * Each callback receives an entry pointer and the start and end of the
96 * associated range, and a caller-supplied private data pointer. 95 * associated range, and a copy of the original mm_walk for access to
96 * the ->private or ->mm fields.
97 * 97 *
98 * No locks are taken, but the bottom level iterator will map PTE 98 * No locks are taken, but the bottom level iterator will map PTE
99 * directories from highmem if necessary. 99 * directories from highmem if necessary.
@@ -101,9 +101,8 @@ static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
101 * If any callback returns a non-zero value, the walk is aborted and 101 * If any callback returns a non-zero value, the walk is aborted and
102 * the return value is propagated back to the caller. Otherwise 0 is returned. 102 * the return value is propagated back to the caller. Otherwise 0 is returned.
103 */ 103 */
104int walk_page_range(const struct mm_struct *mm, 104int walk_page_range(unsigned long addr, unsigned long end,
105 unsigned long addr, unsigned long end, 105 struct mm_walk *walk)
106 const struct mm_walk *walk, void *private)
107{ 106{
108 pgd_t *pgd; 107 pgd_t *pgd;
109 unsigned long next; 108 unsigned long next;
@@ -112,21 +111,24 @@ int walk_page_range(const struct mm_struct *mm,
112 if (addr >= end) 111 if (addr >= end)
113 return err; 112 return err;
114 113
115 pgd = pgd_offset(mm, addr); 114 if (!walk->mm)
115 return -EINVAL;
116
117 pgd = pgd_offset(walk->mm, addr);
116 do { 118 do {
117 next = pgd_addr_end(addr, end); 119 next = pgd_addr_end(addr, end);
118 if (pgd_none_or_clear_bad(pgd)) { 120 if (pgd_none_or_clear_bad(pgd)) {
119 if (walk->pte_hole) 121 if (walk->pte_hole)
120 err = walk->pte_hole(addr, next, private); 122 err = walk->pte_hole(addr, next, walk);
121 if (err) 123 if (err)
122 break; 124 break;
123 continue; 125 continue;
124 } 126 }
125 if (walk->pgd_entry) 127 if (walk->pgd_entry)
126 err = walk->pgd_entry(pgd, addr, next, private); 128 err = walk->pgd_entry(pgd, addr, next, walk);
127 if (!err && 129 if (!err &&
128 (walk->pud_entry || walk->pmd_entry || walk->pte_entry)) 130 (walk->pud_entry || walk->pmd_entry || walk->pte_entry))
129 err = walk_pud_range(pgd, addr, next, walk, private); 131 err = walk_pud_range(pgd, addr, next, walk);
130 if (err) 132 if (err)
131 break; 133 break;
132 } while (pgd++, addr = next, addr != end); 134 } while (pgd++, addr = next, addr != end);
diff --git a/mm/pdflush.c b/mm/pdflush.c
index 1c96cfc9e040..9d834aa4b979 100644
--- a/mm/pdflush.c
+++ b/mm/pdflush.c
@@ -207,7 +207,6 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0)
207 207
208 spin_lock_irqsave(&pdflush_lock, flags); 208 spin_lock_irqsave(&pdflush_lock, flags);
209 if (list_empty(&pdflush_list)) { 209 if (list_empty(&pdflush_list)) {
210 spin_unlock_irqrestore(&pdflush_lock, flags);
211 ret = -1; 210 ret = -1;
212 } else { 211 } else {
213 struct pdflush_work *pdf; 212 struct pdflush_work *pdf;
@@ -219,8 +218,9 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0)
219 pdf->fn = fn; 218 pdf->fn = fn;
220 pdf->arg0 = arg0; 219 pdf->arg0 = arg0;
221 wake_up_process(pdf->who); 220 wake_up_process(pdf->who);
222 spin_unlock_irqrestore(&pdflush_lock, flags);
223 } 221 }
222 spin_unlock_irqrestore(&pdflush_lock, flags);
223
224 return ret; 224 return ret;
225} 225}
226 226
diff --git a/mm/slob.c b/mm/slob.c
index 6038cbadf796..a3ad6671adf1 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
469 return ZERO_SIZE_PTR; 469 return ZERO_SIZE_PTR;
470 470
471 m = slob_alloc(size + align, gfp, align, node); 471 m = slob_alloc(size + align, gfp, align, node);
472 if (m) 472 if (!m)
473 *m = size; 473 return NULL;
474 *m = size;
474 return (void *)m + align; 475 return (void *)m + align;
475 } else { 476 } else {
476 void *ret; 477 void *ret;
diff --git a/mm/slub.c b/mm/slub.c
index a505a828ef41..0987d1cd943c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2726,9 +2726,10 @@ size_t ksize(const void *object)
2726 2726
2727 page = virt_to_head_page(object); 2727 page = virt_to_head_page(object);
2728 2728
2729 if (unlikely(!PageSlab(page))) 2729 if (unlikely(!PageSlab(page))) {
2730 WARN_ON(!PageCompound(page));
2730 return PAGE_SIZE << compound_order(page); 2731 return PAGE_SIZE << compound_order(page);
2731 2732 }
2732 s = page->slab; 2733 s = page->slab;
2733 2734
2734#ifdef CONFIG_SLUB_DEBUG 2735#ifdef CONFIG_SLUB_DEBUG
diff --git a/mm/swap.c b/mm/swap.c
index 91e194445a5e..45c9f25a8a3b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -503,7 +503,7 @@ void vm_acct_memory(long pages)
503 local = &__get_cpu_var(committed_space); 503 local = &__get_cpu_var(committed_space);
504 *local += pages; 504 *local += pages;
505 if (*local > ACCT_THRESHOLD || *local < -ACCT_THRESHOLD) { 505 if (*local > ACCT_THRESHOLD || *local < -ACCT_THRESHOLD) {
506 atomic_add(*local, &vm_committed_space); 506 atomic_long_add(*local, &vm_committed_space);
507 *local = 0; 507 *local = 0;
508 } 508 }
509 preempt_enable(); 509 preempt_enable();
@@ -520,7 +520,7 @@ static int cpu_swap_callback(struct notifier_block *nfb,
520 520
521 committed = &per_cpu(committed_space, (long)hcpu); 521 committed = &per_cpu(committed_space, (long)hcpu);
522 if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { 522 if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
523 atomic_add(*committed, &vm_committed_space); 523 atomic_long_add(*committed, &vm_committed_space);
524 *committed = 0; 524 *committed = 0;
525 drain_cpu_pagevecs((long)hcpu); 525 drain_cpu_pagevecs((long)hcpu);
526 } 526 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9a29901ad3b3..967d30ccd92b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1307,7 +1307,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
1307 struct scan_control *sc) 1307 struct scan_control *sc)
1308{ 1308{
1309 int priority; 1309 int priority;
1310 int ret = 0; 1310 unsigned long ret = 0;
1311 unsigned long total_scanned = 0; 1311 unsigned long total_scanned = 0;
1312 unsigned long nr_reclaimed = 0; 1312 unsigned long nr_reclaimed = 0;
1313 struct reclaim_state *reclaim_state = current->reclaim_state; 1313 struct reclaim_state *reclaim_state = current->reclaim_state;
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 1a32130b958c..db9eabb2c5b3 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -41,7 +41,9 @@ static void sum_vm_events(unsigned long *ret, cpumask_t *cpumask)
41*/ 41*/
42void all_vm_events(unsigned long *ret) 42void all_vm_events(unsigned long *ret)
43{ 43{
44 get_online_cpus();
44 sum_vm_events(ret, &cpu_online_map); 45 sum_vm_events(ret, &cpu_online_map);
46 put_online_cpus();
45} 47}
46EXPORT_SYMBOL_GPL(all_vm_events); 48EXPORT_SYMBOL_GPL(all_vm_events);
47 49
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 2a739adaa92b..ab2225da0ee2 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -382,6 +382,18 @@ static void vlan_sync_address(struct net_device *dev,
382 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); 382 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
383} 383}
384 384
385static void vlan_transfer_features(struct net_device *dev,
386 struct net_device *vlandev)
387{
388 unsigned long old_features = vlandev->features;
389
390 vlandev->features &= ~dev->vlan_features;
391 vlandev->features |= dev->features & dev->vlan_features;
392
393 if (old_features != vlandev->features)
394 netdev_features_change(vlandev);
395}
396
385static void __vlan_device_event(struct net_device *dev, unsigned long event) 397static void __vlan_device_event(struct net_device *dev, unsigned long event)
386{ 398{
387 switch (event) { 399 switch (event) {
@@ -410,10 +422,8 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
410 int i, flgs; 422 int i, flgs;
411 struct net_device *vlandev; 423 struct net_device *vlandev;
412 424
413 if (is_vlan_dev(dev)) { 425 if (is_vlan_dev(dev))
414 __vlan_device_event(dev, event); 426 __vlan_device_event(dev, event);
415 goto out;
416 }
417 427
418 grp = __vlan_find_group(dev); 428 grp = __vlan_find_group(dev);
419 if (!grp) 429 if (!grp)
@@ -450,6 +460,18 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
450 } 460 }
451 break; 461 break;
452 462
463 case NETDEV_FEAT_CHANGE:
464 /* Propagate device features to underlying device */
465 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
466 vlandev = vlan_group_get_device(grp, i);
467 if (!vlandev)
468 continue;
469
470 vlan_transfer_features(dev, vlandev);
471 }
472
473 break;
474
453 case NETDEV_DOWN: 475 case NETDEV_DOWN:
454 /* Put all VLANs for this dev in the down state too. */ 476 /* Put all VLANs for this dev in the down state too. */
455 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 477 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index c961f0826005..5d055c242ed8 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -663,6 +663,8 @@ static int vlan_dev_init(struct net_device *dev)
663 (1<<__LINK_STATE_DORMANT))) | 663 (1<<__LINK_STATE_DORMANT))) |
664 (1<<__LINK_STATE_PRESENT); 664 (1<<__LINK_STATE_PRESENT);
665 665
666 dev->features |= real_dev->features & real_dev->vlan_features;
667
666 /* ipv6 shared card related stuff */ 668 /* ipv6 shared card related stuff */
667 dev->dev_id = real_dev->dev_id; 669 dev->dev_id = real_dev->dev_id;
668 670
diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index bafc50c9e6ff..ff34c5acc130 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -13,16 +13,6 @@ menuconfig NET_9P
13 13
14 If unsure, say N. 14 If unsure, say N.
15 15
16config NET_9P_FD
17 depends on NET_9P
18 default y if NET_9P
19 tristate "9P File Descriptor Transports (Experimental)"
20 help
21 This builds support for file descriptor transports for 9p
22 which includes support for TCP/IP, named pipes, or passed
23 file descriptors. TCP/IP is the default transport for 9p,
24 so if you are going to use 9p, you'll likely want this.
25
26config NET_9P_VIRTIO 16config NET_9P_VIRTIO
27 depends on NET_9P && EXPERIMENTAL && VIRTIO 17 depends on NET_9P && EXPERIMENTAL && VIRTIO
28 tristate "9P Virtio Transport (Experimental)" 18 tristate "9P Virtio Transport (Experimental)"
diff --git a/net/9p/Makefile b/net/9p/Makefile
index 8a1051101898..519219480db1 100644
--- a/net/9p/Makefile
+++ b/net/9p/Makefile
@@ -1,5 +1,4 @@
1obj-$(CONFIG_NET_9P) := 9pnet.o 1obj-$(CONFIG_NET_9P) := 9pnet.o
2obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
3obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o 2obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
4 3
59pnet-objs := \ 49pnet-objs := \
@@ -9,8 +8,6 @@ obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
9 error.o \ 8 error.o \
10 fcprint.o \ 9 fcprint.o \
11 util.o \ 10 util.o \
12
139pnet_fd-objs := \
14 trans_fd.o \ 11 trans_fd.o \
15 12
169pnet_virtio-objs := \ 139pnet_virtio-objs := \
diff --git a/net/9p/client.c b/net/9p/client.c
index 84e087e24146..2ffe40cf2f01 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -64,21 +64,30 @@ static match_table_t tokens = {
64 * @options: options string passed from mount 64 * @options: options string passed from mount
65 * @v9ses: existing v9fs session information 65 * @v9ses: existing v9fs session information
66 * 66 *
67 * Return 0 upon success, -ERRNO upon failure
67 */ 68 */
68 69
69static void parse_opts(char *options, struct p9_client *clnt) 70static int parse_opts(char *opts, struct p9_client *clnt)
70{ 71{
72 char *options;
71 char *p; 73 char *p;
72 substring_t args[MAX_OPT_ARGS]; 74 substring_t args[MAX_OPT_ARGS];
73 int option; 75 int option;
74 int ret; 76 int ret = 0;
75 77
76 clnt->trans_mod = v9fs_default_trans(); 78 clnt->trans_mod = v9fs_default_trans();
77 clnt->dotu = 1; 79 clnt->dotu = 1;
78 clnt->msize = 8192; 80 clnt->msize = 8192;
79 81
80 if (!options) 82 if (!opts)
81 return; 83 return 0;
84
85 options = kstrdup(opts, GFP_KERNEL);
86 if (!options) {
87 P9_DPRINTK(P9_DEBUG_ERROR,
88 "failed to allocate copy of option string\n");
89 return -ENOMEM;
90 }
82 91
83 while ((p = strsep(&options, ",")) != NULL) { 92 while ((p = strsep(&options, ",")) != NULL) {
84 int token; 93 int token;
@@ -86,10 +95,11 @@ static void parse_opts(char *options, struct p9_client *clnt)
86 continue; 95 continue;
87 token = match_token(p, tokens, args); 96 token = match_token(p, tokens, args);
88 if (token < Opt_trans) { 97 if (token < Opt_trans) {
89 ret = match_int(&args[0], &option); 98 int r = match_int(&args[0], &option);
90 if (ret < 0) { 99 if (r < 0) {
91 P9_DPRINTK(P9_DEBUG_ERROR, 100 P9_DPRINTK(P9_DEBUG_ERROR,
92 "integer field, but no integer?\n"); 101 "integer field, but no integer?\n");
102 ret = r;
93 continue; 103 continue;
94 } 104 }
95 } 105 }
@@ -107,6 +117,8 @@ static void parse_opts(char *options, struct p9_client *clnt)
107 continue; 117 continue;
108 } 118 }
109 } 119 }
120 kfree(options);
121 return ret;
110} 122}
111 123
112 124
@@ -138,16 +150,20 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
138 if (!clnt) 150 if (!clnt)
139 return ERR_PTR(-ENOMEM); 151 return ERR_PTR(-ENOMEM);
140 152
153 clnt->trans = NULL;
141 spin_lock_init(&clnt->lock); 154 spin_lock_init(&clnt->lock);
142 INIT_LIST_HEAD(&clnt->fidlist); 155 INIT_LIST_HEAD(&clnt->fidlist);
143 clnt->fidpool = p9_idpool_create(); 156 clnt->fidpool = p9_idpool_create();
144 if (!clnt->fidpool) { 157 if (IS_ERR(clnt->fidpool)) {
145 err = PTR_ERR(clnt->fidpool); 158 err = PTR_ERR(clnt->fidpool);
146 clnt->fidpool = NULL; 159 clnt->fidpool = NULL;
147 goto error; 160 goto error;
148 } 161 }
149 162
150 parse_opts(options, clnt); 163 err = parse_opts(options, clnt);
164 if (err < 0)
165 goto error;
166
151 if (clnt->trans_mod == NULL) { 167 if (clnt->trans_mod == NULL) {
152 err = -EPROTONOSUPPORT; 168 err = -EPROTONOSUPPORT;
153 P9_DPRINTK(P9_DEBUG_ERROR, 169 P9_DPRINTK(P9_DEBUG_ERROR,
diff --git a/net/9p/conv.c b/net/9p/conv.c
index 3fe35d532c87..44547201f5bc 100644
--- a/net/9p/conv.c
+++ b/net/9p/conv.c
@@ -197,7 +197,7 @@ static void buf_get_qid(struct cbuf *bufp, struct p9_qid *qid)
197 197
198/** 198/**
199 * p9_size_wstat - calculate the size of a variable length stat struct 199 * p9_size_wstat - calculate the size of a variable length stat struct
200 * @stat: metadata (stat) structure 200 * @wstat: metadata (stat) structure
201 * @dotu: non-zero if 9P2000.u 201 * @dotu: non-zero if 9P2000.u
202 * 202 *
203 */ 203 */
@@ -511,6 +511,12 @@ p9_create_common(struct cbuf *bufp, u32 size, u8 id)
511 return fc; 511 return fc;
512} 512}
513 513
514/**
515 * p9_set_tag - set the tag field of an &p9_fcall structure
516 * @fc: fcall structure to set tag within
517 * @tag: tag id to set
518 */
519
514void p9_set_tag(struct p9_fcall *fc, u16 tag) 520void p9_set_tag(struct p9_fcall *fc, u16 tag)
515{ 521{
516 fc->tag = tag; 522 fc->tag = tag;
@@ -518,6 +524,12 @@ void p9_set_tag(struct p9_fcall *fc, u16 tag)
518} 524}
519EXPORT_SYMBOL(p9_set_tag); 525EXPORT_SYMBOL(p9_set_tag);
520 526
527/**
528 * p9_create_tversion - allocates and creates a T_VERSION request
529 * @msize: requested maximum data size
530 * @version: version string to negotiate
531 *
532 */
521struct p9_fcall *p9_create_tversion(u32 msize, char *version) 533struct p9_fcall *p9_create_tversion(u32 msize, char *version)
522{ 534{
523 int size; 535 int size;
@@ -542,6 +554,16 @@ error:
542} 554}
543EXPORT_SYMBOL(p9_create_tversion); 555EXPORT_SYMBOL(p9_create_tversion);
544 556
557/**
558 * p9_create_tauth - allocates and creates a T_AUTH request
559 * @afid: handle to use for authentication protocol
560 * @uname: user name attempting to authenticate
561 * @aname: mount specifier for remote server
562 * @n_uname: numeric id for user attempting to authneticate
563 * @dotu: 9P2000.u extension flag
564 *
565 */
566
545struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname, 567struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname,
546 u32 n_uname, int dotu) 568 u32 n_uname, int dotu)
547{ 569{
@@ -580,6 +602,18 @@ error:
580} 602}
581EXPORT_SYMBOL(p9_create_tauth); 603EXPORT_SYMBOL(p9_create_tauth);
582 604
605/**
606 * p9_create_tattach - allocates and creates a T_ATTACH request
607 * @fid: handle to use for the new mount point
608 * @afid: handle to use for authentication protocol
609 * @uname: user name attempting to attach
610 * @aname: mount specifier for remote server
611 * @n_uname: numeric id for user attempting to attach
612 * @n_uname: numeric id for user attempting to attach
613 * @dotu: 9P2000.u extension flag
614 *
615 */
616
583struct p9_fcall * 617struct p9_fcall *
584p9_create_tattach(u32 fid, u32 afid, char *uname, char *aname, 618p9_create_tattach(u32 fid, u32 afid, char *uname, char *aname,
585 u32 n_uname, int dotu) 619 u32 n_uname, int dotu)
@@ -616,6 +650,12 @@ error:
616} 650}
617EXPORT_SYMBOL(p9_create_tattach); 651EXPORT_SYMBOL(p9_create_tattach);
618 652
653/**
654 * p9_create_tflush - allocates and creates a T_FLUSH request
655 * @oldtag: tag id for the transaction we are attempting to cancel
656 *
657 */
658
619struct p9_fcall *p9_create_tflush(u16 oldtag) 659struct p9_fcall *p9_create_tflush(u16 oldtag)
620{ 660{
621 int size; 661 int size;
@@ -639,6 +679,15 @@ error:
639} 679}
640EXPORT_SYMBOL(p9_create_tflush); 680EXPORT_SYMBOL(p9_create_tflush);
641 681
682/**
683 * p9_create_twalk - allocates and creates a T_FLUSH request
684 * @fid: handle we are traversing from
685 * @newfid: a new handle for this transaction
686 * @nwname: number of path elements to traverse
687 * @wnames: array of path elements
688 *
689 */
690
642struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname, 691struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname,
643 char **wnames) 692 char **wnames)
644{ 693{
@@ -677,6 +726,13 @@ error:
677} 726}
678EXPORT_SYMBOL(p9_create_twalk); 727EXPORT_SYMBOL(p9_create_twalk);
679 728
729/**
730 * p9_create_topen - allocates and creates a T_OPEN request
731 * @fid: handle we are trying to open
732 * @mode: what mode we are trying to open the file in
733 *
734 */
735
680struct p9_fcall *p9_create_topen(u32 fid, u8 mode) 736struct p9_fcall *p9_create_topen(u32 fid, u8 mode)
681{ 737{
682 int size; 738 int size;
@@ -701,6 +757,19 @@ error:
701} 757}
702EXPORT_SYMBOL(p9_create_topen); 758EXPORT_SYMBOL(p9_create_topen);
703 759
760/**
761 * p9_create_tcreate - allocates and creates a T_CREATE request
762 * @fid: handle of directory we are trying to create in
763 * @name: name of the file we are trying to create
764 * @perm: permissions for the file we are trying to create
765 * @mode: what mode we are trying to open the file in
766 * @extension: 9p2000.u extension string (for special files)
767 * @dotu: 9p2000.u enabled flag
768 *
769 * Note: Plan 9 create semantics include opening the resulting file
770 * which is why mode is included.
771 */
772
704struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, 773struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
705 char *extension, int dotu) 774 char *extension, int dotu)
706{ 775{
@@ -736,6 +805,13 @@ error:
736} 805}
737EXPORT_SYMBOL(p9_create_tcreate); 806EXPORT_SYMBOL(p9_create_tcreate);
738 807
808/**
809 * p9_create_tread - allocates and creates a T_READ request
810 * @fid: handle of the file we are trying to read
811 * @offset: offset to start reading from
812 * @count: how many bytes to read
813 */
814
739struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count) 815struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count)
740{ 816{
741 int size; 817 int size;
@@ -761,6 +837,17 @@ error:
761} 837}
762EXPORT_SYMBOL(p9_create_tread); 838EXPORT_SYMBOL(p9_create_tread);
763 839
840/**
841 * p9_create_twrite - allocates and creates a T_WRITE request from the kernel
842 * @fid: handle of the file we are trying to write
843 * @offset: offset to start writing at
844 * @count: how many bytes to write
845 * @data: data to write
846 *
847 * This function will create a requst with data buffers from the kernel
848 * such as the page cache.
849 */
850
764struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count, 851struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count,
765 const char *data) 852 const char *data)
766{ 853{
@@ -794,6 +881,16 @@ error:
794} 881}
795EXPORT_SYMBOL(p9_create_twrite); 882EXPORT_SYMBOL(p9_create_twrite);
796 883
884/**
885 * p9_create_twrite_u - allocates and creates a T_WRITE request from userspace
886 * @fid: handle of the file we are trying to write
887 * @offset: offset to start writing at
888 * @count: how many bytes to write
889 * @data: data to write
890 *
891 * This function will create a request with data buffers from userspace
892 */
893
797struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count, 894struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count,
798 const char __user *data) 895 const char __user *data)
799{ 896{
@@ -827,6 +924,14 @@ error:
827} 924}
828EXPORT_SYMBOL(p9_create_twrite_u); 925EXPORT_SYMBOL(p9_create_twrite_u);
829 926
927/**
928 * p9_create_tclunk - allocate a request to forget about a file handle
929 * @fid: handle of the file we closing or forgetting about
930 *
931 * clunk is used both to close open files and to discard transient handles
932 * which may be created during meta-data operations and hierarchy traversal.
933 */
934
830struct p9_fcall *p9_create_tclunk(u32 fid) 935struct p9_fcall *p9_create_tclunk(u32 fid)
831{ 936{
832 int size; 937 int size;
@@ -850,6 +955,12 @@ error:
850} 955}
851EXPORT_SYMBOL(p9_create_tclunk); 956EXPORT_SYMBOL(p9_create_tclunk);
852 957
958/**
959 * p9_create_tremove - allocate and create a request to remove a file
960 * @fid: handle of the file or directory we are removing
961 *
962 */
963
853struct p9_fcall *p9_create_tremove(u32 fid) 964struct p9_fcall *p9_create_tremove(u32 fid)
854{ 965{
855 int size; 966 int size;
@@ -873,6 +984,12 @@ error:
873} 984}
874EXPORT_SYMBOL(p9_create_tremove); 985EXPORT_SYMBOL(p9_create_tremove);
875 986
987/**
988 * p9_create_tstat - allocate and populate a request for attributes
989 * @fid: handle of the file or directory we are trying to get the attributes of
990 *
991 */
992
876struct p9_fcall *p9_create_tstat(u32 fid) 993struct p9_fcall *p9_create_tstat(u32 fid)
877{ 994{
878 int size; 995 int size;
@@ -896,6 +1013,14 @@ error:
896} 1013}
897EXPORT_SYMBOL(p9_create_tstat); 1014EXPORT_SYMBOL(p9_create_tstat);
898 1015
1016/**
1017 * p9_create_tstat - allocate and populate a request to change attributes
1018 * @fid: handle of the file or directory we are trying to change
1019 * @wstat: &p9_stat structure with attributes we wish to set
1020 * @dotu: 9p2000.u enabled flag
1021 *
1022 */
1023
899struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat, 1024struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat,
900 int dotu) 1025 int dotu)
901{ 1026{
@@ -922,3 +1047,4 @@ error:
922 return fc; 1047 return fc;
923} 1048}
924EXPORT_SYMBOL(p9_create_twstat); 1049EXPORT_SYMBOL(p9_create_twstat);
1050
diff --git a/net/9p/error.c b/net/9p/error.c
index 64104b9cb422..fdebe4314062 100644
--- a/net/9p/error.c
+++ b/net/9p/error.c
@@ -33,6 +33,13 @@
33#include <linux/errno.h> 33#include <linux/errno.h>
34#include <net/9p/9p.h> 34#include <net/9p/9p.h>
35 35
36/**
37 * struct errormap - map string errors from Plan 9 to Linux numeric ids
38 * @name: string sent over 9P
39 * @val: numeric id most closely representing @name
40 * @namelen: length of string
41 * @list: hash-table list for string lookup
42 */
36struct errormap { 43struct errormap {
37 char *name; 44 char *name;
38 int val; 45 int val;
@@ -177,8 +184,7 @@ static struct errormap errmap[] = {
177}; 184};
178 185
179/** 186/**
180 * p9_error_init - preload 187 * p9_error_init - preload mappings into hash list
181 * @errstr: error string
182 * 188 *
183 */ 189 */
184 190
@@ -206,6 +212,7 @@ EXPORT_SYMBOL(p9_error_init);
206/** 212/**
207 * errstr2errno - convert error string to error number 213 * errstr2errno - convert error string to error number
208 * @errstr: error string 214 * @errstr: error string
215 * @len: length of error string
209 * 216 *
210 */ 217 */
211 218
@@ -230,8 +237,8 @@ int p9_errstr2errno(char *errstr, int len)
230 if (errno == 0) { 237 if (errno == 0) {
231 /* TODO: if error isn't found, add it dynamically */ 238 /* TODO: if error isn't found, add it dynamically */
232 errstr[len] = 0; 239 errstr[len] = 0;
233 printk(KERN_ERR "%s: errstr :%s: not found\n", __func__, 240 printk(KERN_ERR "%s: server reported unknown error %s\n",
234 errstr); 241 __func__, errstr);
235 errno = 1; 242 errno = 1;
236 } 243 }
237 244
diff --git a/net/9p/fcprint.c b/net/9p/fcprint.c
index 40244fbd9b0d..53dd8e28dd8a 100644
--- a/net/9p/fcprint.c
+++ b/net/9p/fcprint.c
@@ -142,6 +142,14 @@ p9_printdata(char *buf, int buflen, u8 *data, int datalen)
142 return p9_dumpdata(buf, buflen, data, datalen < 16?datalen:16); 142 return p9_dumpdata(buf, buflen, data, datalen < 16?datalen:16);
143} 143}
144 144
145/**
146 * p9_printfcall - decode and print a protocol structure into a buffer
147 * @buf: buffer to deposit decoded structure into
148 * @buflen: available space in buffer
149 * @fc: protocol rpc structure of type &p9_fcall
150 * @extended: whether or not session is operating with extended protocol
151 */
152
145int 153int
146p9_printfcall(char *buf, int buflen, struct p9_fcall *fc, int extended) 154p9_printfcall(char *buf, int buflen, struct p9_fcall *fc, int extended)
147{ 155{
diff --git a/net/9p/mod.c b/net/9p/mod.c
index c285aab2af04..bdee1fb7cc62 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -39,9 +39,6 @@ module_param_named(debug, p9_debug_level, uint, 0);
39MODULE_PARM_DESC(debug, "9P debugging level"); 39MODULE_PARM_DESC(debug, "9P debugging level");
40#endif 40#endif
41 41
42extern int p9_mux_global_init(void);
43extern void p9_mux_global_exit(void);
44
45/* 42/*
46 * Dynamic Transport Registration Routines 43 * Dynamic Transport Registration Routines
47 * 44 *
@@ -52,7 +49,7 @@ static struct p9_trans_module *v9fs_default_transport;
52 49
53/** 50/**
54 * v9fs_register_trans - register a new transport with 9p 51 * v9fs_register_trans - register a new transport with 9p
55 * @m - structure describing the transport module and entry points 52 * @m: structure describing the transport module and entry points
56 * 53 *
57 */ 54 */
58void v9fs_register_trans(struct p9_trans_module *m) 55void v9fs_register_trans(struct p9_trans_module *m)
@@ -65,7 +62,7 @@ EXPORT_SYMBOL(v9fs_register_trans);
65 62
66/** 63/**
67 * v9fs_match_trans - match transport versus registered transports 64 * v9fs_match_trans - match transport versus registered transports
68 * @arg: string identifying transport 65 * @name: string identifying transport
69 * 66 *
70 */ 67 */
71struct p9_trans_module *v9fs_match_trans(const substring_t *name) 68struct p9_trans_module *v9fs_match_trans(const substring_t *name)
@@ -110,6 +107,7 @@ static int __init init_p9(void)
110 107
111 p9_error_init(); 108 p9_error_init();
112 printk(KERN_INFO "Installing 9P2000 support\n"); 109 printk(KERN_INFO "Installing 9P2000 support\n");
110 p9_trans_fd_init();
113 111
114 return ret; 112 return ret;
115} 113}
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index f624dff76852..4507f744f44e 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -47,12 +47,29 @@
47#define SCHED_TIMEOUT 10 47#define SCHED_TIMEOUT 10
48#define MAXPOLLWADDR 2 48#define MAXPOLLWADDR 2
49 49
50/**
51 * struct p9_fd_opts - per-transport options
52 * @rfd: file descriptor for reading (trans=fd)
53 * @wfd: file descriptor for writing (trans=fd)
54 * @port: port to connect to (trans=tcp)
55 *
56 */
57
50struct p9_fd_opts { 58struct p9_fd_opts {
51 int rfd; 59 int rfd;
52 int wfd; 60 int wfd;
53 u16 port; 61 u16 port;
54}; 62};
55 63
64
65/**
66 * struct p9_trans_fd - transport state
67 * @rd: reference to file to read from
68 * @wr: reference of file to write to
69 * @conn: connection state reference
70 *
71 */
72
56struct p9_trans_fd { 73struct p9_trans_fd {
57 struct file *rd; 74 struct file *rd;
58 struct file *wr; 75 struct file *wr;
@@ -90,10 +107,24 @@ enum {
90}; 107};
91 108
92struct p9_req; 109struct p9_req;
93
94typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a); 110typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a);
111
112/**
113 * struct p9_req - fd mux encoding of an rpc transaction
114 * @lock: protects req_list
115 * @tag: numeric tag for rpc transaction
116 * @tcall: request &p9_fcall structure
117 * @rcall: response &p9_fcall structure
118 * @err: error state
119 * @cb: callback for when response is received
120 * @cba: argument to pass to callback
121 * @flush: flag to indicate RPC has been flushed
122 * @req_list: list link for higher level objects to chain requests
123 *
124 */
125
95struct p9_req { 126struct p9_req {
96 spinlock_t lock; /* protect request structure */ 127 spinlock_t lock;
97 int tag; 128 int tag;
98 struct p9_fcall *tcall; 129 struct p9_fcall *tcall;
99 struct p9_fcall *rcall; 130 struct p9_fcall *rcall;
@@ -104,7 +135,39 @@ struct p9_req {
104 struct list_head req_list; 135 struct list_head req_list;
105}; 136};
106 137
107struct p9_mux_poll_task; 138struct p9_mux_poll_task {
139 struct task_struct *task;
140 struct list_head mux_list;
141 int muxnum;
142};
143
144/**
145 * struct p9_conn - fd mux connection state information
146 * @lock: protects mux_list (?)
147 * @mux_list: list link for mux to manage multiple connections (?)
148 * @poll_task: task polling on this connection
149 * @msize: maximum size for connection (dup)
150 * @extended: 9p2000.u flag (dup)
151 * @trans: reference to transport instance for this connection
152 * @tagpool: id accounting for transactions
153 * @err: error state
154 * @equeue: event wait_q (?)
155 * @req_list: accounting for requests which have been sent
156 * @unsent_req_list: accounting for requests that haven't been sent
157 * @rcall: current response &p9_fcall structure
158 * @rpos: read position in current frame
159 * @rbuf: current read buffer
160 * @wpos: write position for current frame
161 * @wsize: amount of data to write for current frame
162 * @wbuf: current write buffer
163 * @poll_wait: array of wait_q's for various worker threads
164 * @poll_waddr: ????
165 * @pt: poll state
166 * @rq: current read work
167 * @wq: current write work
168 * @wsched: ????
169 *
170 */
108 171
109struct p9_conn { 172struct p9_conn {
110 spinlock_t lock; /* protect lock structure */ 173 spinlock_t lock; /* protect lock structure */
@@ -132,11 +195,16 @@ struct p9_conn {
132 unsigned long wsched; 195 unsigned long wsched;
133}; 196};
134 197
135struct p9_mux_poll_task { 198/**
136 struct task_struct *task; 199 * struct p9_mux_rpc - fd mux rpc accounting structure
137 struct list_head mux_list; 200 * @m: connection this request was issued on
138 int muxnum; 201 * @err: error state
139}; 202 * @tcall: request &p9_fcall
203 * @rcall: response &p9_fcall
204 * @wqueue: wait queue that client is blocked on for this rpc
205 *
206 * Bug: isn't this information duplicated elsewhere like &p9_req
207 */
140 208
141struct p9_mux_rpc { 209struct p9_mux_rpc {
142 struct p9_conn *m; 210 struct p9_conn *m;
@@ -207,10 +275,12 @@ static void p9_mux_put_tag(struct p9_conn *m, u16 tag)
207 275
208/** 276/**
209 * p9_mux_calc_poll_procs - calculates the number of polling procs 277 * p9_mux_calc_poll_procs - calculates the number of polling procs
210 * based on the number of mounted v9fs filesystems. 278 * @muxnum: number of mounts
211 * 279 *
280 * Calculation is based on the number of mounted v9fs filesystems.
212 * The current implementation returns sqrt of the number of mounts. 281 * The current implementation returns sqrt of the number of mounts.
213 */ 282 */
283
214static int p9_mux_calc_poll_procs(int muxnum) 284static int p9_mux_calc_poll_procs(int muxnum)
215{ 285{
216 int n; 286 int n;
@@ -331,12 +401,11 @@ static void p9_mux_poll_stop(struct p9_conn *m)
331 401
332/** 402/**
333 * p9_conn_create - allocate and initialize the per-session mux data 403 * p9_conn_create - allocate and initialize the per-session mux data
334 * Creates the polling task if this is the first session. 404 * @trans: transport structure
335 * 405 *
336 * @trans - transport structure 406 * Note: Creates the polling task if this is the first session.
337 * @msize - maximum message size
338 * @extended - extended flag
339 */ 407 */
408
340static struct p9_conn *p9_conn_create(struct p9_trans *trans) 409static struct p9_conn *p9_conn_create(struct p9_trans *trans)
341{ 410{
342 int i, n; 411 int i, n;
@@ -406,7 +475,10 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
406 475
407/** 476/**
408 * p9_mux_destroy - cancels all pending requests and frees mux resources 477 * p9_mux_destroy - cancels all pending requests and frees mux resources
478 * @m: mux to destroy
479 *
409 */ 480 */
481
410static void p9_conn_destroy(struct p9_conn *m) 482static void p9_conn_destroy(struct p9_conn *m)
411{ 483{
412 P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m, 484 P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m,
@@ -429,9 +501,14 @@ static void p9_conn_destroy(struct p9_conn *m)
429} 501}
430 502
431/** 503/**
432 * p9_pollwait - called by files poll operation to add v9fs-poll task 504 * p9_pollwait - add poll task to the wait queue
433 * to files wait queue 505 * @filp: file pointer being polled
506 * @wait_address: wait_q to block on
507 * @p: poll state
508 *
509 * called by files poll operation to add v9fs-poll task to files wait queue
434 */ 510 */
511
435static void 512static void
436p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p) 513p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p)
437{ 514{
@@ -462,7 +539,10 @@ p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p)
462 539
463/** 540/**
464 * p9_poll_mux - polls a mux and schedules read or write works if necessary 541 * p9_poll_mux - polls a mux and schedules read or write works if necessary
542 * @m: connection to poll
543 *
465 */ 544 */
545
466static void p9_poll_mux(struct p9_conn *m) 546static void p9_poll_mux(struct p9_conn *m)
467{ 547{
468 int n; 548 int n;
@@ -499,9 +579,14 @@ static void p9_poll_mux(struct p9_conn *m)
499} 579}
500 580
501/** 581/**
502 * p9_poll_proc - polls all v9fs transports for new events and queues 582 * p9_poll_proc - poll worker thread
503 * the appropriate work to the work queue 583 * @a: thread state and arguments
584 *
585 * polls all v9fs transports for new events and queues the appropriate
586 * work to the work queue
587 *
504 */ 588 */
589
505static int p9_poll_proc(void *a) 590static int p9_poll_proc(void *a)
506{ 591{
507 struct p9_conn *m, *mtmp; 592 struct p9_conn *m, *mtmp;
@@ -527,7 +612,10 @@ static int p9_poll_proc(void *a)
527 612
528/** 613/**
529 * p9_write_work - called when a transport can send some data 614 * p9_write_work - called when a transport can send some data
615 * @work: container for work to be done
616 *
530 */ 617 */
618
531static void p9_write_work(struct work_struct *work) 619static void p9_write_work(struct work_struct *work)
532{ 620{
533 int n, err; 621 int n, err;
@@ -638,7 +726,10 @@ static void process_request(struct p9_conn *m, struct p9_req *req)
638 726
639/** 727/**
640 * p9_read_work - called when there is some data to be read from a transport 728 * p9_read_work - called when there is some data to be read from a transport
729 * @work: container of work to be done
730 *
641 */ 731 */
732
642static void p9_read_work(struct work_struct *work) 733static void p9_read_work(struct work_struct *work)
643{ 734{
644 int n, err; 735 int n, err;
@@ -793,7 +884,9 @@ error:
793 * @tc: request to be sent 884 * @tc: request to be sent
794 * @cb: callback function to call when response is received 885 * @cb: callback function to call when response is received
795 * @cba: parameter to pass to the callback function 886 * @cba: parameter to pass to the callback function
887 *
796 */ 888 */
889
797static struct p9_req *p9_send_request(struct p9_conn *m, 890static struct p9_req *p9_send_request(struct p9_conn *m,
798 struct p9_fcall *tc, 891 struct p9_fcall *tc,
799 p9_conn_req_callback cb, void *cba) 892 p9_conn_req_callback cb, void *cba)
@@ -961,10 +1054,12 @@ p9_conn_rpc_cb(struct p9_req *req, void *a)
961/** 1054/**
962 * p9_fd_rpc- sends 9P request and waits until a response is available. 1055 * p9_fd_rpc- sends 9P request and waits until a response is available.
963 * The function can be interrupted. 1056 * The function can be interrupted.
964 * @m: mux data 1057 * @t: transport data
965 * @tc: request to be sent 1058 * @tc: request to be sent
966 * @rc: pointer where a pointer to the response is stored 1059 * @rc: pointer where a pointer to the response is stored
1060 *
967 */ 1061 */
1062
968int 1063int
969p9_fd_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc) 1064p9_fd_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc)
970{ 1065{
@@ -1041,8 +1136,10 @@ p9_fd_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc)
1041 * @m: mux data 1136 * @m: mux data
1042 * @tc: request to be sent 1137 * @tc: request to be sent
1043 * @cb: callback function to be called when response arrives 1138 * @cb: callback function to be called when response arrives
1044 * @cba: value to pass to the callback function 1139 * @a: value to pass to the callback function
1140 *
1045 */ 1141 */
1142
1046int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc, 1143int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
1047 p9_conn_req_callback cb, void *a) 1144 p9_conn_req_callback cb, void *a)
1048{ 1145{
@@ -1065,7 +1162,9 @@ int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
1065 * p9_conn_cancel - cancel all pending requests with error 1162 * p9_conn_cancel - cancel all pending requests with error
1066 * @m: mux data 1163 * @m: mux data
1067 * @err: error code 1164 * @err: error code
1165 *
1068 */ 1166 */
1167
1069void p9_conn_cancel(struct p9_conn *m, int err) 1168void p9_conn_cancel(struct p9_conn *m, int err)
1070{ 1169{
1071 struct p9_req *req, *rtmp; 1170 struct p9_req *req, *rtmp;
@@ -1097,35 +1196,46 @@ void p9_conn_cancel(struct p9_conn *m, int err)
1097} 1196}
1098 1197
1099/** 1198/**
1100 * v9fs_parse_options - parse mount options into session structure 1199 * parse_options - parse mount options into session structure
1101 * @options: options string passed from mount 1200 * @options: options string passed from mount
1102 * @v9ses: existing v9fs session information 1201 * @opts: transport-specific structure to parse options into
1103 * 1202 *
1203 * Returns 0 upon success, -ERRNO upon failure
1104 */ 1204 */
1105 1205
1106static void parse_opts(char *options, struct p9_fd_opts *opts) 1206static int parse_opts(char *params, struct p9_fd_opts *opts)
1107{ 1207{
1108 char *p; 1208 char *p;
1109 substring_t args[MAX_OPT_ARGS]; 1209 substring_t args[MAX_OPT_ARGS];
1110 int option; 1210 int option;
1211 char *options;
1111 int ret; 1212 int ret;
1112 1213
1113 opts->port = P9_PORT; 1214 opts->port = P9_PORT;
1114 opts->rfd = ~0; 1215 opts->rfd = ~0;
1115 opts->wfd = ~0; 1216 opts->wfd = ~0;
1116 1217
1117 if (!options) 1218 if (!params)
1118 return; 1219 return 0;
1220
1221 options = kstrdup(params, GFP_KERNEL);
1222 if (!options) {
1223 P9_DPRINTK(P9_DEBUG_ERROR,
1224 "failed to allocate copy of option string\n");
1225 return -ENOMEM;
1226 }
1119 1227
1120 while ((p = strsep(&options, ",")) != NULL) { 1228 while ((p = strsep(&options, ",")) != NULL) {
1121 int token; 1229 int token;
1230 int r;
1122 if (!*p) 1231 if (!*p)
1123 continue; 1232 continue;
1124 token = match_token(p, tokens, args); 1233 token = match_token(p, tokens, args);
1125 ret = match_int(&args[0], &option); 1234 r = match_int(&args[0], &option);
1126 if (ret < 0) { 1235 if (r < 0) {
1127 P9_DPRINTK(P9_DEBUG_ERROR, 1236 P9_DPRINTK(P9_DEBUG_ERROR,
1128 "integer field, but no integer?\n"); 1237 "integer field, but no integer?\n");
1238 ret = r;
1129 continue; 1239 continue;
1130 } 1240 }
1131 switch (token) { 1241 switch (token) {
@@ -1142,6 +1252,8 @@ static void parse_opts(char *options, struct p9_fd_opts *opts)
1142 continue; 1252 continue;
1143 } 1253 }
1144 } 1254 }
1255 kfree(options);
1256 return 0;
1145} 1257}
1146 1258
1147static int p9_fd_open(struct p9_trans *trans, int rfd, int wfd) 1259static int p9_fd_open(struct p9_trans *trans, int rfd, int wfd)
@@ -1193,11 +1305,12 @@ static int p9_socket_open(struct p9_trans *trans, struct socket *csocket)
1193 1305
1194/** 1306/**
1195 * p9_fd_read- read from a fd 1307 * p9_fd_read- read from a fd
1196 * @v9ses: session information 1308 * @trans: transport instance state
1197 * @v: buffer to receive data into 1309 * @v: buffer to receive data into
1198 * @len: size of receive buffer 1310 * @len: size of receive buffer
1199 * 1311 *
1200 */ 1312 */
1313
1201static int p9_fd_read(struct p9_trans *trans, void *v, int len) 1314static int p9_fd_read(struct p9_trans *trans, void *v, int len)
1202{ 1315{
1203 int ret; 1316 int ret;
@@ -1220,11 +1333,12 @@ static int p9_fd_read(struct p9_trans *trans, void *v, int len)
1220 1333
1221/** 1334/**
1222 * p9_fd_write - write to a socket 1335 * p9_fd_write - write to a socket
1223 * @v9ses: session information 1336 * @trans: transport instance state
1224 * @v: buffer to send data from 1337 * @v: buffer to send data from
1225 * @len: size of send buffer 1338 * @len: size of send buffer
1226 * 1339 *
1227 */ 1340 */
1341
1228static int p9_fd_write(struct p9_trans *trans, void *v, int len) 1342static int p9_fd_write(struct p9_trans *trans, void *v, int len)
1229{ 1343{
1230 int ret; 1344 int ret;
@@ -1296,6 +1410,7 @@ end:
1296 * @trans: private socket structure 1410 * @trans: private socket structure
1297 * 1411 *
1298 */ 1412 */
1413
1299static void p9_fd_close(struct p9_trans *trans) 1414static void p9_fd_close(struct p9_trans *trans)
1300{ 1415{
1301 struct p9_trans_fd *ts; 1416 struct p9_trans_fd *ts;
@@ -1318,6 +1433,23 @@ static void p9_fd_close(struct p9_trans *trans)
1318 kfree(ts); 1433 kfree(ts);
1319} 1434}
1320 1435
1436/*
1437 * stolen from NFS - maybe should be made a generic function?
1438 */
1439static inline int valid_ipaddr4(const char *buf)
1440{
1441 int rc, count, in[4];
1442
1443 rc = sscanf(buf, "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]);
1444 if (rc != 4)
1445 return -EINVAL;
1446 for (count = 0; count < 4; count++) {
1447 if (in[count] > 255)
1448 return -EINVAL;
1449 }
1450 return 0;
1451}
1452
1321static struct p9_trans * 1453static struct p9_trans *
1322p9_trans_create_tcp(const char *addr, char *args, int msize, unsigned char dotu) 1454p9_trans_create_tcp(const char *addr, char *args, int msize, unsigned char dotu)
1323{ 1455{
@@ -1328,7 +1460,12 @@ p9_trans_create_tcp(const char *addr, char *args, int msize, unsigned char dotu)
1328 struct p9_fd_opts opts; 1460 struct p9_fd_opts opts;
1329 struct p9_trans_fd *p; 1461 struct p9_trans_fd *p;
1330 1462
1331 parse_opts(args, &opts); 1463 err = parse_opts(args, &opts);
1464 if (err < 0)
1465 return ERR_PTR(err);
1466
1467 if (valid_ipaddr4(addr) < 0)
1468 return ERR_PTR(-EINVAL);
1332 1469
1333 csocket = NULL; 1470 csocket = NULL;
1334 trans = kmalloc(sizeof(struct p9_trans), GFP_KERNEL); 1471 trans = kmalloc(sizeof(struct p9_trans), GFP_KERNEL);
@@ -1508,7 +1645,7 @@ static struct p9_trans_module p9_fd_trans = {
1508 .create = p9_trans_create_fd, 1645 .create = p9_trans_create_fd,
1509}; 1646};
1510 1647
1511static int __init p9_trans_fd_init(void) 1648int p9_trans_fd_init(void)
1512{ 1649{
1513 int ret = p9_mux_global_init(); 1650 int ret = p9_mux_global_init();
1514 if (ret) { 1651 if (ret) {
@@ -1522,9 +1659,4 @@ static int __init p9_trans_fd_init(void)
1522 1659
1523 return 0; 1660 return 0;
1524} 1661}
1525 1662EXPORT_SYMBOL(p9_trans_fd_init);
1526module_init(p9_trans_fd_init);
1527
1528MODULE_AUTHOR("Latchesar Ionkov <lucho@ionkov.net>");
1529MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>");
1530MODULE_LICENSE("GPL");
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index de7a9f532edc..42adc052b149 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -49,29 +49,75 @@
49#define VIRTQUEUE_NUM 128 49#define VIRTQUEUE_NUM 128
50 50
51/* a single mutex to manage channel initialization and attachment */ 51/* a single mutex to manage channel initialization and attachment */
52static DECLARE_MUTEX(virtio_9p_lock); 52static DEFINE_MUTEX(virtio_9p_lock);
53/* global which tracks highest initialized channel */ 53/* global which tracks highest initialized channel */
54static int chan_index; 54static int chan_index;
55 55
56#define P9_INIT_MAXTAG 16 56#define P9_INIT_MAXTAG 16
57 57
58#define REQ_STATUS_IDLE 0 58
59#define REQ_STATUS_SENT 1 59/**
60#define REQ_STATUS_RCVD 2 60 * enum p9_req_status_t - virtio request status
61#define REQ_STATUS_FLSH 3 61 * @REQ_STATUS_IDLE: request slot unused
62 * @REQ_STATUS_SENT: request sent to server
63 * @REQ_STATUS_RCVD: response received from server
64 * @REQ_STATUS_FLSH: request has been flushed
65 *
66 * The @REQ_STATUS_IDLE state is used to mark a request slot as unused
67 * but use is actually tracked by the idpool structure which handles tag
68 * id allocation.
69 *
70 */
71
72enum p9_req_status_t {
73 REQ_STATUS_IDLE,
74 REQ_STATUS_SENT,
75 REQ_STATUS_RCVD,
76 REQ_STATUS_FLSH,
77};
78
79/**
80 * struct p9_req_t - virtio request slots
81 * @status: status of this request slot
82 * @wq: wait_queue for the client to block on for this request
83 *
84 * The virtio transport uses an array to track outstanding requests
85 * instead of a list. While this may incurr overhead during initial
86 * allocation or expansion, it makes request lookup much easier as the
87 * tag id is a index into an array. (We use tag+1 so that we can accomodate
88 * the -1 tag for the T_VERSION request).
89 * This also has the nice effect of only having to allocate wait_queues
90 * once, instead of constantly allocating and freeing them. Its possible
91 * other resources could benefit from this scheme as well.
92 *
93 */
62 94
63struct p9_req_t { 95struct p9_req_t {
64 int status; 96 int status;
65 wait_queue_head_t *wq; 97 wait_queue_head_t *wq;
66}; 98};
67 99
68/* We keep all per-channel information in a structure. 100/**
101 * struct virtio_chan - per-instance transport information
102 * @initialized: whether the channel is initialized
103 * @inuse: whether the channel is in use
104 * @lock: protects multiple elements within this structure
105 * @vdev: virtio dev associated with this channel
106 * @vq: virtio queue associated with this channel
107 * @tagpool: accounting for tag ids (and request slots)
108 * @reqs: array of request slots
109 * @max_tag: current number of request_slots allocated
110 * @sg: scatter gather list which is used to pack a request (protected?)
111 *
112 * We keep all per-channel information in a structure.
69 * This structure is allocated within the devices dev->mem space. 113 * This structure is allocated within the devices dev->mem space.
70 * A pointer to the structure will get put in the transport private. 114 * A pointer to the structure will get put in the transport private.
115 *
71 */ 116 */
117
72static struct virtio_chan { 118static struct virtio_chan {
73 bool initialized; /* channel is initialized */ 119 bool initialized;
74 bool inuse; /* channel is in use */ 120 bool inuse;
75 121
76 spinlock_t lock; 122 spinlock_t lock;
77 123
@@ -86,7 +132,19 @@ static struct virtio_chan {
86 struct scatterlist sg[VIRTQUEUE_NUM]; 132 struct scatterlist sg[VIRTQUEUE_NUM];
87} channels[MAX_9P_CHAN]; 133} channels[MAX_9P_CHAN];
88 134
89/* Lookup requests by tag */ 135/**
136 * p9_lookup_tag - Lookup requests by tag
137 * @c: virtio channel to lookup tag within
138 * @tag: numeric id for transaction
139 *
140 * this is a simple array lookup, but will grow the
141 * request_slots as necessary to accomodate transaction
142 * ids which did not previously have a slot.
143 *
144 * Bugs: there is currently no upper limit on request slots set
145 * here, but that should be constrained by the id accounting.
146 */
147
90static struct p9_req_t *p9_lookup_tag(struct virtio_chan *c, u16 tag) 148static struct p9_req_t *p9_lookup_tag(struct virtio_chan *c, u16 tag)
91{ 149{
92 /* This looks up the original request by tag so we know which 150 /* This looks up the original request by tag so we know which
@@ -130,11 +188,20 @@ static unsigned int rest_of_page(void *data)
130 return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE); 188 return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE);
131} 189}
132 190
191/**
192 * p9_virtio_close - reclaim resources of a channel
193 * @trans: transport state
194 *
195 * This reclaims a channel by freeing its resources and
196 * reseting its inuse flag.
197 *
198 */
199
133static void p9_virtio_close(struct p9_trans *trans) 200static void p9_virtio_close(struct p9_trans *trans)
134{ 201{
135 struct virtio_chan *chan = trans->priv; 202 struct virtio_chan *chan = trans->priv;
136 int count; 203 int count;
137 unsigned int flags; 204 unsigned long flags;
138 205
139 spin_lock_irqsave(&chan->lock, flags); 206 spin_lock_irqsave(&chan->lock, flags);
140 p9_idpool_destroy(chan->tagpool); 207 p9_idpool_destroy(chan->tagpool);
@@ -144,13 +211,26 @@ static void p9_virtio_close(struct p9_trans *trans)
144 chan->max_tag = 0; 211 chan->max_tag = 0;
145 spin_unlock_irqrestore(&chan->lock, flags); 212 spin_unlock_irqrestore(&chan->lock, flags);
146 213
147 down(&virtio_9p_lock); 214 mutex_lock(&virtio_9p_lock);
148 chan->inuse = false; 215 chan->inuse = false;
149 up(&virtio_9p_lock); 216 mutex_unlock(&virtio_9p_lock);
150 217
151 kfree(trans); 218 kfree(trans);
152} 219}
153 220
221/**
222 * req_done - callback which signals activity from the server
223 * @vq: virtio queue activity was received on
224 *
225 * This notifies us that the server has triggered some activity
226 * on the virtio channel - most likely a response to request we
227 * sent. Figure out which requests now have responses and wake up
228 * those threads.
229 *
230 * Bugs: could do with some additional sanity checking, but appears to work.
231 *
232 */
233
154static void req_done(struct virtqueue *vq) 234static void req_done(struct virtqueue *vq)
155{ 235{
156 struct virtio_chan *chan = vq->vdev->priv; 236 struct virtio_chan *chan = vq->vdev->priv;
@@ -169,6 +249,20 @@ static void req_done(struct virtqueue *vq)
169 spin_unlock_irqrestore(&chan->lock, flags); 249 spin_unlock_irqrestore(&chan->lock, flags);
170} 250}
171 251
252/**
253 * pack_sg_list - pack a scatter gather list from a linear buffer
254 * @sg: scatter/gather list to pack into
255 * @start: which segment of the sg_list to start at
256 * @limit: maximum segment to pack data to
257 * @data: data to pack into scatter/gather list
258 * @count: amount of data to pack into the scatter/gather list
259 *
260 * sg_lists have multiple segments of various sizes. This will pack
261 * arbitrary data into an existing scatter gather list, segmenting the
262 * data as necessary within constraints.
263 *
264 */
265
172static int 266static int
173pack_sg_list(struct scatterlist *sg, int start, int limit, char *data, 267pack_sg_list(struct scatterlist *sg, int start, int limit, char *data,
174 int count) 268 int count)
@@ -189,6 +283,14 @@ pack_sg_list(struct scatterlist *sg, int start, int limit, char *data,
189 return index-start; 283 return index-start;
190} 284}
191 285
286/**
287 * p9_virtio_rpc - issue a request and wait for a response
288 * @t: transport state
289 * @tc: &p9_fcall request to transmit
290 * @rc: &p9_fcall to put reponse into
291 *
292 */
293
192static int 294static int
193p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc) 295p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc)
194{ 296{
@@ -263,16 +365,26 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc)
263 return 0; 365 return 0;
264} 366}
265 367
368/**
369 * p9_virtio_probe - probe for existence of 9P virtio channels
370 * @vdev: virtio device to probe
371 *
372 * This probes for existing virtio channels. At present only
373 * a single channel is in use, so in the future more work may need
374 * to be done here.
375 *
376 */
377
266static int p9_virtio_probe(struct virtio_device *vdev) 378static int p9_virtio_probe(struct virtio_device *vdev)
267{ 379{
268 int err; 380 int err;
269 struct virtio_chan *chan; 381 struct virtio_chan *chan;
270 int index; 382 int index;
271 383
272 down(&virtio_9p_lock); 384 mutex_lock(&virtio_9p_lock);
273 index = chan_index++; 385 index = chan_index++;
274 chan = &channels[index]; 386 chan = &channels[index];
275 up(&virtio_9p_lock); 387 mutex_unlock(&virtio_9p_lock);
276 388
277 if (chan_index > MAX_9P_CHAN) { 389 if (chan_index > MAX_9P_CHAN) {
278 printk(KERN_ERR "9p: virtio: Maximum channels exceeded\n"); 390 printk(KERN_ERR "9p: virtio: Maximum channels exceeded\n");
@@ -301,17 +413,34 @@ static int p9_virtio_probe(struct virtio_device *vdev)
301out_free_vq: 413out_free_vq:
302 vdev->config->del_vq(chan->vq); 414 vdev->config->del_vq(chan->vq);
303fail: 415fail:
304 down(&virtio_9p_lock); 416 mutex_lock(&virtio_9p_lock);
305 chan_index--; 417 chan_index--;
306 up(&virtio_9p_lock); 418 mutex_unlock(&virtio_9p_lock);
307 return err; 419 return err;
308} 420}
309 421
310/* This sets up a transport channel for 9p communication. Right now 422
423/**
424 * p9_virtio_create - allocate a new virtio channel
425 * @devname: string identifying the channel to connect to (unused)
426 * @args: args passed from sys_mount() for per-transport options (unused)
427 * @msize: requested maximum packet size
428 * @extended: 9p2000.u enabled flag
429 *
430 * This sets up a transport channel for 9p communication. Right now
311 * we only match the first available channel, but eventually we couldlook up 431 * we only match the first available channel, but eventually we couldlook up
312 * alternate channels by matching devname versus a virtio_config entry. 432 * alternate channels by matching devname versus a virtio_config entry.
313 * We use a simple reference count mechanism to ensure that only a single 433 * We use a simple reference count mechanism to ensure that only a single
314 * mount has a channel open at a time. */ 434 * mount has a channel open at a time.
435 *
436 * Bugs: doesn't allow identification of a specific channel
437 * to allocate, channels are allocated sequentially. This was
438 * a pragmatic decision to get things rolling, but ideally some
439 * way of identifying the channel to attach to would be nice
440 * if we are going to support multiple channels.
441 *
442 */
443
315static struct p9_trans * 444static struct p9_trans *
316p9_virtio_create(const char *devname, char *args, int msize, 445p9_virtio_create(const char *devname, char *args, int msize,
317 unsigned char extended) 446 unsigned char extended)
@@ -320,7 +449,7 @@ p9_virtio_create(const char *devname, char *args, int msize,
320 struct virtio_chan *chan = channels; 449 struct virtio_chan *chan = channels;
321 int index = 0; 450 int index = 0;
322 451
323 down(&virtio_9p_lock); 452 mutex_lock(&virtio_9p_lock);
324 while (index < MAX_9P_CHAN) { 453 while (index < MAX_9P_CHAN) {
325 if (chan->initialized && !chan->inuse) { 454 if (chan->initialized && !chan->inuse) {
326 chan->inuse = true; 455 chan->inuse = true;
@@ -330,7 +459,7 @@ p9_virtio_create(const char *devname, char *args, int msize,
330 chan = &channels[index]; 459 chan = &channels[index];
331 } 460 }
332 } 461 }
333 up(&virtio_9p_lock); 462 mutex_unlock(&virtio_9p_lock);
334 463
335 if (index >= MAX_9P_CHAN) { 464 if (index >= MAX_9P_CHAN) {
336 printk(KERN_ERR "9p: no channels available\n"); 465 printk(KERN_ERR "9p: no channels available\n");
@@ -360,6 +489,12 @@ p9_virtio_create(const char *devname, char *args, int msize,
360 return trans; 489 return trans;
361} 490}
362 491
492/**
493 * p9_virtio_remove - clean up resources associated with a virtio device
494 * @vdev: virtio device to remove
495 *
496 */
497
363static void p9_virtio_remove(struct virtio_device *vdev) 498static void p9_virtio_remove(struct virtio_device *vdev)
364{ 499{
365 struct virtio_chan *chan = vdev->priv; 500 struct virtio_chan *chan = vdev->priv;
diff --git a/net/9p/util.c b/net/9p/util.c
index ef7215565d88..958fc58cd1ff 100644
--- a/net/9p/util.c
+++ b/net/9p/util.c
@@ -32,11 +32,23 @@
32#include <linux/idr.h> 32#include <linux/idr.h>
33#include <net/9p/9p.h> 33#include <net/9p/9p.h>
34 34
35/**
36 * struct p9_idpool - per-connection accounting for tag idpool
37 * @lock: protects the pool
38 * @pool: idr to allocate tag id from
39 *
40 */
41
35struct p9_idpool { 42struct p9_idpool {
36 spinlock_t lock; 43 spinlock_t lock;
37 struct idr pool; 44 struct idr pool;
38}; 45};
39 46
47/**
48 * p9_idpool_create - create a new per-connection id pool
49 *
50 */
51
40struct p9_idpool *p9_idpool_create(void) 52struct p9_idpool *p9_idpool_create(void)
41{ 53{
42 struct p9_idpool *p; 54 struct p9_idpool *p;
@@ -52,6 +64,11 @@ struct p9_idpool *p9_idpool_create(void)
52} 64}
53EXPORT_SYMBOL(p9_idpool_create); 65EXPORT_SYMBOL(p9_idpool_create);
54 66
67/**
68 * p9_idpool_destroy - create a new per-connection id pool
69 * @p: idpool to destory
70 */
71
55void p9_idpool_destroy(struct p9_idpool *p) 72void p9_idpool_destroy(struct p9_idpool *p)
56{ 73{
57 idr_destroy(&p->pool); 74 idr_destroy(&p->pool);
@@ -61,9 +78,9 @@ EXPORT_SYMBOL(p9_idpool_destroy);
61 78
62/** 79/**
63 * p9_idpool_get - allocate numeric id from pool 80 * p9_idpool_get - allocate numeric id from pool
64 * @p - pool to allocate from 81 * @p: pool to allocate from
65 * 82 *
66 * XXX - This seems to be an awful generic function, should it be in idr.c with 83 * Bugs: This seems to be an awful generic function, should it be in idr.c with
67 * the lock included in struct idr? 84 * the lock included in struct idr?
68 */ 85 */
69 86
@@ -71,7 +88,7 @@ int p9_idpool_get(struct p9_idpool *p)
71{ 88{
72 int i = 0; 89 int i = 0;
73 int error; 90 int error;
74 unsigned int flags; 91 unsigned long flags;
75 92
76retry: 93retry:
77 if (idr_pre_get(&p->pool, GFP_KERNEL) == 0) 94 if (idr_pre_get(&p->pool, GFP_KERNEL) == 0)
@@ -94,15 +111,16 @@ EXPORT_SYMBOL(p9_idpool_get);
94 111
95/** 112/**
96 * p9_idpool_put - release numeric id from pool 113 * p9_idpool_put - release numeric id from pool
97 * @p - pool to allocate from 114 * @id: numeric id which is being released
115 * @p: pool to release id into
98 * 116 *
99 * XXX - This seems to be an awful generic function, should it be in idr.c with 117 * Bugs: This seems to be an awful generic function, should it be in idr.c with
100 * the lock included in struct idr? 118 * the lock included in struct idr?
101 */ 119 */
102 120
103void p9_idpool_put(int id, struct p9_idpool *p) 121void p9_idpool_put(int id, struct p9_idpool *p)
104{ 122{
105 unsigned int flags; 123 unsigned long flags;
106 spin_lock_irqsave(&p->lock, flags); 124 spin_lock_irqsave(&p->lock, flags);
107 idr_remove(&p->pool, id); 125 idr_remove(&p->pool, id);
108 spin_unlock_irqrestore(&p->lock, flags); 126 spin_unlock_irqrestore(&p->lock, flags);
@@ -111,11 +129,13 @@ EXPORT_SYMBOL(p9_idpool_put);
111 129
112/** 130/**
113 * p9_idpool_check - check if the specified id is available 131 * p9_idpool_check - check if the specified id is available
114 * @id - id to check 132 * @id: id to check
115 * @p - pool 133 * @p: pool to check
116 */ 134 */
135
117int p9_idpool_check(int id, struct p9_idpool *p) 136int p9_idpool_check(int id, struct p9_idpool *p)
118{ 137{
119 return idr_find(&p->pool, id) != NULL; 138 return idr_find(&p->pool, id) != NULL;
120} 139}
121EXPORT_SYMBOL(p9_idpool_check); 140EXPORT_SYMBOL(p9_idpool_check);
141
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index d8f215733175..034aa10a5198 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -64,20 +64,15 @@ void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
64 64
65void ax25_requeue_frames(ax25_cb *ax25) 65void ax25_requeue_frames(ax25_cb *ax25)
66{ 66{
67 struct sk_buff *skb, *skb_prev = NULL; 67 struct sk_buff *skb;
68 68
69 /* 69 /*
70 * Requeue all the un-ack-ed frames on the output queue to be picked 70 * Requeue all the un-ack-ed frames on the output queue to be picked
71 * up by ax25_kick called from the timer. This arrangement handles the 71 * up by ax25_kick called from the timer. This arrangement handles the
72 * possibility of an empty output queue. 72 * possibility of an empty output queue.
73 */ 73 */
74 while ((skb = skb_dequeue(&ax25->ack_queue)) != NULL) { 74 while ((skb = skb_dequeue_tail(&ax25->ack_queue)) != NULL)
75 if (skb_prev == NULL) 75 skb_queue_head(&ax25->write_queue, skb);
76 skb_queue_head(&ax25->write_queue, skb);
77 else
78 skb_append(skb_prev, skb, &ax25->write_queue);
79 skb_prev = skb;
80 }
81} 76}
82 77
83/* 78/*
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index eb62558e9b09..0c2c93735e93 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -423,8 +423,8 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
423 423
424 rfcomm_dlc_lock(d); 424 rfcomm_dlc_lock(d);
425 d->state = BT_CLOSED; 425 d->state = BT_CLOSED;
426 rfcomm_dlc_unlock(d);
427 d->state_change(d, err); 426 d->state_change(d, err);
427 rfcomm_dlc_unlock(d);
428 428
429 skb_queue_purge(&d->tx_queue); 429 skb_queue_purge(&d->tx_queue);
430 rfcomm_dlc_unlink(d); 430 rfcomm_dlc_unlink(d);
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index c3f749abb2d0..c9191871c1e0 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -566,11 +566,22 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
566 if (dlc->state == BT_CLOSED) { 566 if (dlc->state == BT_CLOSED) {
567 if (!dev->tty) { 567 if (!dev->tty) {
568 if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { 568 if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
569 if (rfcomm_dev_get(dev->id) == NULL) 569 /* Drop DLC lock here to avoid deadlock
570 * 1. rfcomm_dev_get will take rfcomm_dev_lock
571 * but in rfcomm_dev_add there's lock order:
572 * rfcomm_dev_lock -> dlc lock
573 * 2. rfcomm_dev_put will deadlock if it's
574 * the last reference
575 */
576 rfcomm_dlc_unlock(dlc);
577 if (rfcomm_dev_get(dev->id) == NULL) {
578 rfcomm_dlc_lock(dlc);
570 return; 579 return;
580 }
571 581
572 rfcomm_dev_del(dev); 582 rfcomm_dev_del(dev);
573 rfcomm_dev_put(dev); 583 rfcomm_dev_put(dev);
584 rfcomm_dlc_lock(dlc);
574 } 585 }
575 } else 586 } else
576 tty_hangup(dev->tty); 587 tty_hangup(dev->tty);
diff --git a/net/core/dev.c b/net/core/dev.c
index a1607bc0cd4c..582963077877 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -903,7 +903,11 @@ int dev_change_name(struct net_device *dev, char *newname)
903 strlcpy(dev->name, newname, IFNAMSIZ); 903 strlcpy(dev->name, newname, IFNAMSIZ);
904 904
905rollback: 905rollback:
906 device_rename(&dev->dev, dev->name); 906 err = device_rename(&dev->dev, dev->name);
907 if (err) {
908 memcpy(dev->name, oldname, IFNAMSIZ);
909 return err;
910 }
907 911
908 write_lock_bh(&dev_base_lock); 912 write_lock_bh(&dev_base_lock);
909 hlist_del(&dev->name_hlist); 913 hlist_del(&dev->name_hlist);
@@ -3137,7 +3141,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
3137 * Load in the correct multicast list now the flags have changed. 3141 * Load in the correct multicast list now the flags have changed.
3138 */ 3142 */
3139 3143
3140 if (dev->change_rx_flags && (dev->flags ^ flags) & IFF_MULTICAST) 3144 if (dev->change_rx_flags && (old_flags ^ flags) & IFF_MULTICAST)
3141 dev->change_rx_flags(dev, IFF_MULTICAST); 3145 dev->change_rx_flags(dev, IFF_MULTICAST);
3142 3146
3143 dev_set_rx_mode(dev); 3147 dev_set_rx_mode(dev);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 5d9d7130bd6e..65f01f71b3f3 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1714,7 +1714,8 @@ static int neightbl_fill_parms(struct sk_buff *skb, struct neigh_parms *parms)
1714 return nla_nest_end(skb, nest); 1714 return nla_nest_end(skb, nest);
1715 1715
1716nla_put_failure: 1716nla_put_failure:
1717 return nla_nest_cancel(skb, nest); 1717 nla_nest_cancel(skb, nest);
1718 return -EMSGSIZE;
1718} 1719}
1719 1720
1720static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, 1721static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,
@@ -2057,9 +2058,9 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh,
2057 goto nla_put_failure; 2058 goto nla_put_failure;
2058 } 2059 }
2059 2060
2060 ci.ndm_used = now - neigh->used; 2061 ci.ndm_used = jiffies_to_clock_t(now - neigh->used);
2061 ci.ndm_confirmed = now - neigh->confirmed; 2062 ci.ndm_confirmed = jiffies_to_clock_t(now - neigh->confirmed);
2062 ci.ndm_updated = now - neigh->updated; 2063 ci.ndm_updated = jiffies_to_clock_t(now - neigh->updated);
2063 ci.ndm_refcnt = atomic_read(&neigh->refcnt) - 1; 2064 ci.ndm_refcnt = atomic_read(&neigh->refcnt) - 1;
2064 read_unlock_bh(&neigh->lock); 2065 read_unlock_bh(&neigh->lock);
2065 2066
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index b04d643fc3c7..8fb134da0346 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -419,7 +419,7 @@ static void arp_reply(struct sk_buff *skb)
419 return; 419 return;
420 420
421 size = arp_hdr_len(skb->dev); 421 size = arp_hdr_len(skb->dev);
422 send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev), 422 send_skb = find_skb(np, size + LL_ALLOCATED_SPACE(np->dev),
423 LL_RESERVED_SPACE(np->dev)); 423 LL_RESERVED_SPACE(np->dev));
424 424
425 if (!send_skb) 425 if (!send_skb)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 8dca21110493..fdf537707e51 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -390,6 +390,7 @@ struct pktgen_thread {
390 int cpu; 390 int cpu;
391 391
392 wait_queue_head_t queue; 392 wait_queue_head_t queue;
393 struct completion start_done;
393}; 394};
394 395
395#define REMOVE 1 396#define REMOVE 1
@@ -3414,6 +3415,7 @@ static int pktgen_thread_worker(void *arg)
3414 BUG_ON(smp_processor_id() != cpu); 3415 BUG_ON(smp_processor_id() != cpu);
3415 3416
3416 init_waitqueue_head(&t->queue); 3417 init_waitqueue_head(&t->queue);
3418 complete(&t->start_done);
3417 3419
3418 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current)); 3420 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current));
3419 3421
@@ -3615,6 +3617,7 @@ static int __init pktgen_create_thread(int cpu)
3615 INIT_LIST_HEAD(&t->if_list); 3617 INIT_LIST_HEAD(&t->if_list);
3616 3618
3617 list_add_tail(&t->th_list, &pktgen_threads); 3619 list_add_tail(&t->th_list, &pktgen_threads);
3620 init_completion(&t->start_done);
3618 3621
3619 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); 3622 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
3620 if (IS_ERR(p)) { 3623 if (IS_ERR(p)) {
@@ -3639,6 +3642,7 @@ static int __init pktgen_create_thread(int cpu)
3639 } 3642 }
3640 3643
3641 wake_up_process(p); 3644 wake_up_process(p);
3645 wait_for_completion(&t->start_done);
3642 3646
3643 return 0; 3647 return 0;
3644} 3648}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index cf857c4dc7b1..a9a77216310e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -498,7 +498,8 @@ int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics)
498 return nla_nest_end(skb, mx); 498 return nla_nest_end(skb, mx);
499 499
500nla_put_failure: 500nla_put_failure:
501 return nla_nest_cancel(skb, mx); 501 nla_nest_cancel(skb, mx);
502 return -EMSGSIZE;
502} 503}
503 504
504int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id, 505int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5c459f2b7985..1e556d312117 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1445,6 +1445,7 @@ done:
1445 1445
1446 if (spd.nr_pages) { 1446 if (spd.nr_pages) {
1447 int ret; 1447 int ret;
1448 struct sock *sk = __skb->sk;
1448 1449
1449 /* 1450 /*
1450 * Drop the socket lock, otherwise we have reverse 1451 * Drop the socket lock, otherwise we have reverse
@@ -1455,9 +1456,9 @@ done:
1455 * we call into ->sendpage() with the i_mutex lock held 1456 * we call into ->sendpage() with the i_mutex lock held
1456 * and networking will grab the socket lock. 1457 * and networking will grab the socket lock.
1457 */ 1458 */
1458 release_sock(__skb->sk); 1459 release_sock(sk);
1459 ret = splice_to_pipe(pipe, &spd); 1460 ret = splice_to_pipe(pipe, &spd);
1460 lock_sock(__skb->sk); 1461 lock_sock(sk);
1461 return ret; 1462 return ret;
1462 } 1463 }
1463 1464
diff --git a/net/core/sock.c b/net/core/sock.c
index fa76f04fa9c6..88094cb09c06 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -270,7 +270,7 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
270 int err = 0; 270 int err = 0;
271 int skb_len; 271 int skb_len;
272 272
273 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces 273 /* Cast sk->rcvbuf to unsigned... It's pointless, but reduces
274 number of warnings when compiling with -W --ANK 274 number of warnings when compiling with -W --ANK
275 */ 275 */
276 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= 276 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
diff --git a/net/core/user_dma.c b/net/core/user_dma.c
index 0ad1cd57bc39..c77aff9c6eb3 100644
--- a/net/core/user_dma.c
+++ b/net/core/user_dma.c
@@ -75,7 +75,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
75 75
76 end = start + skb_shinfo(skb)->frags[i].size; 76 end = start + skb_shinfo(skb)->frags[i].size;
77 copy = end - offset; 77 copy = end - offset;
78 if ((copy = end - offset) > 0) { 78 if (copy > 0) {
79 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 79 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
80 struct page *page = frag->page; 80 struct page *page = frag->page;
81 81
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 6de4bd195d28..1e8be246ad15 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -290,12 +290,12 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
290 290
291 while (1) { 291 while (1) {
292 const u8 len = dccp_ackvec_len(av, index); 292 const u8 len = dccp_ackvec_len(av, index);
293 const u8 state = dccp_ackvec_state(av, index); 293 const u8 av_state = dccp_ackvec_state(av, index);
294 /* 294 /*
295 * valid packets not yet in av_buf have a reserved 295 * valid packets not yet in av_buf have a reserved
296 * entry, with a len equal to 0. 296 * entry, with a len equal to 0.
297 */ 297 */
298 if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && 298 if (av_state == DCCP_ACKVEC_STATE_NOT_RECEIVED &&
299 len == 0 && delta == 0) { /* Found our 299 len == 0 && delta == 0) { /* Found our
300 reserved seat! */ 300 reserved seat! */
301 dccp_pr_debug("Found %llu reserved seat!\n", 301 dccp_pr_debug("Found %llu reserved seat!\n",
@@ -325,31 +325,6 @@ out_duplicate:
325 return -EILSEQ; 325 return -EILSEQ;
326} 326}
327 327
328#ifdef CONFIG_IP_DCCP_DEBUG
329void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len)
330{
331 dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len,
332 (unsigned long long)ackno);
333
334 while (len--) {
335 const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6;
336 const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK;
337
338 dccp_pr_debug_cat("%d,%d|", state, rl);
339 ++vector;
340 }
341
342 dccp_pr_debug_cat("\n");
343}
344
345void dccp_ackvec_print(const struct dccp_ackvec *av)
346{
347 dccp_ackvector_print(av->av_buf_ackno,
348 av->av_buf + av->av_buf_head,
349 av->av_vec_len);
350}
351#endif
352
353static void dccp_ackvec_throw_record(struct dccp_ackvec *av, 328static void dccp_ackvec_throw_record(struct dccp_ackvec *av,
354 struct dccp_ackvec_record *avr) 329 struct dccp_ackvec_record *avr)
355{ 330{
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index cd61dea2eea1..a1929f33d703 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -159,8 +159,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
159 } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld) 159 } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld)
160 - (s64)hctx->ccid3hctx_rtt >= 0) { 160 - (s64)hctx->ccid3hctx_rtt >= 0) {
161 161
162 hctx->ccid3hctx_x = 162 hctx->ccid3hctx_x = min(2 * hctx->ccid3hctx_x, min_rate);
163 max(min(2 * hctx->ccid3hctx_x, min_rate), 163 hctx->ccid3hctx_x = max(hctx->ccid3hctx_x,
164 scaled_div(((__u64)hctx->ccid3hctx_s) << 6, 164 scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
165 hctx->ccid3hctx_rtt)); 165 hctx->ccid3hctx_rtt));
166 hctx->ccid3hctx_t_ld = now; 166 hctx->ccid3hctx_t_ld = now;
@@ -193,22 +193,17 @@ static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len)
193 193
194/* 194/*
195 * Update Window Counter using the algorithm from [RFC 4342, 8.1]. 195 * Update Window Counter using the algorithm from [RFC 4342, 8.1].
196 * The algorithm is not applicable if RTT < 4 microseconds. 196 * As elsewhere, RTT > 0 is assumed by using dccp_sample_rtt().
197 */ 197 */
198static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx, 198static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx,
199 ktime_t now) 199 ktime_t now)
200{ 200{
201 u32 quarter_rtts; 201 u32 delta = ktime_us_delta(now, hctx->ccid3hctx_t_last_win_count),
202 202 quarter_rtts = (4 * delta) / hctx->ccid3hctx_rtt;
203 if (unlikely(hctx->ccid3hctx_rtt < 4)) /* avoid divide-by-zero */
204 return;
205
206 quarter_rtts = ktime_us_delta(now, hctx->ccid3hctx_t_last_win_count);
207 quarter_rtts /= hctx->ccid3hctx_rtt / 4;
208 203
209 if (quarter_rtts > 0) { 204 if (quarter_rtts > 0) {
210 hctx->ccid3hctx_t_last_win_count = now; 205 hctx->ccid3hctx_t_last_win_count = now;
211 hctx->ccid3hctx_last_win_count += min_t(u32, quarter_rtts, 5); 206 hctx->ccid3hctx_last_win_count += min(quarter_rtts, 5U);
212 hctx->ccid3hctx_last_win_count &= 0xF; /* mod 16 */ 207 hctx->ccid3hctx_last_win_count &= 0xF; /* mod 16 */
213 } 208 }
214} 209}
@@ -334,8 +329,14 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
334 hctx->ccid3hctx_x = rfc3390_initial_rate(sk); 329 hctx->ccid3hctx_x = rfc3390_initial_rate(sk);
335 hctx->ccid3hctx_t_ld = now; 330 hctx->ccid3hctx_t_ld = now;
336 } else { 331 } else {
337 /* Sender does not have RTT sample: X_pps = 1 pkt/sec */ 332 /*
338 hctx->ccid3hctx_x = hctx->ccid3hctx_s; 333 * Sender does not have RTT sample:
334 * - set fallback RTT (RFC 4340, 3.4) since a RTT value
335 * is needed in several parts (e.g. window counter);
336 * - set sending rate X_pps = 1pps as per RFC 3448, 4.2.
337 */
338 hctx->ccid3hctx_rtt = DCCP_FALLBACK_RTT;
339 hctx->ccid3hctx_x = hctx->ccid3hctx_s;
339 hctx->ccid3hctx_x <<= 6; 340 hctx->ccid3hctx_x <<= 6;
340 } 341 }
341 ccid3_update_send_interval(hctx); 342 ccid3_update_send_interval(hctx);
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c
index d1dfbb8de64c..97ecec0a8e76 100644
--- a/net/dccp/ccids/lib/tfrc.c
+++ b/net/dccp/ccids/lib/tfrc.c
@@ -14,14 +14,6 @@ module_param(tfrc_debug, bool, 0444);
14MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); 14MODULE_PARM_DESC(tfrc_debug, "Enable debug messages");
15#endif 15#endif
16 16
17extern int tfrc_tx_packet_history_init(void);
18extern void tfrc_tx_packet_history_exit(void);
19extern int tfrc_rx_packet_history_init(void);
20extern void tfrc_rx_packet_history_exit(void);
21
22extern int tfrc_li_init(void);
23extern void tfrc_li_exit(void);
24
25static int __init tfrc_module_init(void) 17static int __init tfrc_module_init(void)
26{ 18{
27 int rc = tfrc_li_init(); 19 int rc = tfrc_li_init();
diff --git a/net/dccp/ccids/lib/tfrc.h b/net/dccp/ccids/lib/tfrc.h
index 1fb1187bbf1c..ed9857527acf 100644
--- a/net/dccp/ccids/lib/tfrc.h
+++ b/net/dccp/ccids/lib/tfrc.h
@@ -15,7 +15,7 @@
15 * (at your option) any later version. 15 * (at your option) any later version.
16 */ 16 */
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/div64.h> 18#include <linux/math64.h>
19#include "../../dccp.h" 19#include "../../dccp.h"
20/* internal includes that this module exports: */ 20/* internal includes that this module exports: */
21#include "loss_interval.h" 21#include "loss_interval.h"
@@ -29,21 +29,19 @@ extern int tfrc_debug;
29#endif 29#endif
30 30
31/* integer-arithmetic divisions of type (a * 1000000)/b */ 31/* integer-arithmetic divisions of type (a * 1000000)/b */
32static inline u64 scaled_div(u64 a, u32 b) 32static inline u64 scaled_div(u64 a, u64 b)
33{ 33{
34 BUG_ON(b==0); 34 BUG_ON(b==0);
35 a *= 1000000; 35 return div64_u64(a * 1000000, b);
36 do_div(a, b);
37 return a;
38} 36}
39 37
40static inline u32 scaled_div32(u64 a, u32 b) 38static inline u32 scaled_div32(u64 a, u64 b)
41{ 39{
42 u64 result = scaled_div(a, b); 40 u64 result = scaled_div(a, b);
43 41
44 if (result > UINT_MAX) { 42 if (result > UINT_MAX) {
45 DCCP_CRIT("Overflow: a(%llu)/b(%u) > ~0U", 43 DCCP_CRIT("Overflow: %llu/%llu > UINT_MAX",
46 (unsigned long long)a, b); 44 (unsigned long long)a, (unsigned long long)b);
47 return UINT_MAX; 45 return UINT_MAX;
48 } 46 }
49 return result; 47 return result;
@@ -58,7 +56,14 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight)
58 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval; 56 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval;
59} 57}
60 58
61extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); 59extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
62extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); 60extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
63 61
62extern int tfrc_tx_packet_history_init(void);
63extern void tfrc_tx_packet_history_exit(void);
64extern int tfrc_rx_packet_history_init(void);
65extern void tfrc_rx_packet_history_exit(void);
66
67extern int tfrc_li_init(void);
68extern void tfrc_li_exit(void);
64#endif /* _TFRC_H_ */ 69#endif /* _TFRC_H_ */
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index e4e64b76c10c..2f20a29cffe4 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -661,7 +661,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
661 661
662EXPORT_SYMBOL_GPL(tfrc_calc_x); 662EXPORT_SYMBOL_GPL(tfrc_calc_x);
663 663
664/* 664/**
665 * tfrc_calc_x_reverse_lookup - try to find p given f(p) 665 * tfrc_calc_x_reverse_lookup - try to find p given f(p)
666 * 666 *
667 * @fvalue: function value to match, scaled by 1000000 667 * @fvalue: function value to match, scaled by 1000000
@@ -676,11 +676,11 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue)
676 676
677 /* Error cases. */ 677 /* Error cases. */
678 if (fvalue < tfrc_calc_x_lookup[0][1]) { 678 if (fvalue < tfrc_calc_x_lookup[0][1]) {
679 DCCP_WARN("fvalue %d smaller than resolution\n", fvalue); 679 DCCP_WARN("fvalue %u smaller than resolution\n", fvalue);
680 return tfrc_calc_x_lookup[0][1]; 680 return TFRC_SMALLEST_P;
681 } 681 }
682 if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) { 682 if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) {
683 DCCP_WARN("fvalue %d exceeds bounds!\n", fvalue); 683 DCCP_WARN("fvalue %u exceeds bounds!\n", fvalue);
684 return 1000000; 684 return 1000000;
685 } 685 }
686 686
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index b348dd70c685..37d27bcb361f 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -589,7 +589,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
589 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) 589 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
590 goto drop; 590 goto drop;
591 591
592 req = reqsk_alloc(&dccp_request_sock_ops); 592 req = inet_reqsk_alloc(&dccp_request_sock_ops);
593 if (req == NULL) 593 if (req == NULL)
594 goto drop; 594 goto drop;
595 595
@@ -605,7 +605,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
605 ireq = inet_rsk(req); 605 ireq = inet_rsk(req);
606 ireq->loc_addr = ip_hdr(skb)->daddr; 606 ireq->loc_addr = ip_hdr(skb)->daddr;
607 ireq->rmt_addr = ip_hdr(skb)->saddr; 607 ireq->rmt_addr = ip_hdr(skb)->saddr;
608 ireq->opt = NULL;
609 608
610 /* 609 /*
611 * Step 3: Process LISTEN state 610 * Step 3: Process LISTEN state
@@ -739,8 +738,8 @@ int dccp_invalid_packet(struct sk_buff *skb)
739 * If P.type is not Data, Ack, or DataAck and P.X == 0 (the packet 738 * If P.type is not Data, Ack, or DataAck and P.X == 0 (the packet
740 * has short sequence numbers), drop packet and return 739 * has short sequence numbers), drop packet and return
741 */ 740 */
742 if (dh->dccph_type >= DCCP_PKT_DATA && 741 if ((dh->dccph_type < DCCP_PKT_DATA ||
743 dh->dccph_type <= DCCP_PKT_DATAACK && dh->dccph_x == 0) { 742 dh->dccph_type > DCCP_PKT_DATAACK) && dh->dccph_x == 0) {
744 DCCP_WARN("P.type (%s) not Data || [Data]Ack, while P.X == 0\n", 743 DCCP_WARN("P.type (%s) not Data || [Data]Ack, while P.X == 0\n",
745 dccp_packet_name(dh->dccph_type)); 744 dccp_packet_name(dh->dccph_type));
746 return 1; 745 return 1;
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 9b1129bb7ece..f7fe2a572d7b 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -421,7 +421,6 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
421 ireq6 = inet6_rsk(req); 421 ireq6 = inet6_rsk(req);
422 ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr); 422 ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr);
423 ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr); 423 ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr);
424 ireq6->pktopts = NULL;
425 424
426 if (ipv6_opt_accepted(sk, skb) || 425 if (ipv6_opt_accepted(sk, skb) ||
427 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || 426 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 33ad48321b08..66dca5bba858 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -165,12 +165,12 @@ out_free:
165 /* See dccp_v4_conn_request */ 165 /* See dccp_v4_conn_request */
166 newdmsk->dccpms_sequence_window = req->rcv_wnd; 166 newdmsk->dccpms_sequence_window = req->rcv_wnd;
167 167
168 newdp->dccps_gar = newdp->dccps_isr = dreq->dreq_isr; 168 newdp->dccps_gar = newdp->dccps_iss = dreq->dreq_iss;
169 dccp_update_gsr(newsk, dreq->dreq_isr);
170
171 newdp->dccps_iss = dreq->dreq_iss;
172 dccp_update_gss(newsk, dreq->dreq_iss); 169 dccp_update_gss(newsk, dreq->dreq_iss);
173 170
171 newdp->dccps_isr = dreq->dreq_isr;
172 dccp_update_gsr(newsk, dreq->dreq_isr);
173
174 /* 174 /*
175 * SWL and AWL are initially adjusted so that they are not less than 175 * SWL and AWL are initially adjusted so that they are not less than
176 * the initial Sequence Numbers received and sent, respectively: 176 * the initial Sequence Numbers received and sent, respectively:
diff --git a/net/dccp/options.c b/net/dccp/options.c
index d2a84a2fecee..43bc24e761d0 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -107,9 +107,11 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
107 * 107 *
108 * CCID-specific options are ignored during connection setup, as 108 * CCID-specific options are ignored during connection setup, as
109 * negotiation may still be in progress (see RFC 4340, 10.3). 109 * negotiation may still be in progress (see RFC 4340, 10.3).
110 * The same applies to Ack Vectors, as these depend on the CCID.
110 * 111 *
111 */ 112 */
112 if (dreq != NULL && opt >= 128) 113 if (dreq != NULL && (opt >= 128 ||
114 opt == DCCPO_ACK_VECTOR_0 || opt == DCCPO_ACK_VECTOR_1))
113 goto ignore_option; 115 goto ignore_option;
114 116
115 switch (opt) { 117 switch (opt) {
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 1f8a9b64c083..fe20068c5d8e 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -508,6 +508,7 @@ void dccp_send_ack(struct sock *sk)
508 508
509EXPORT_SYMBOL_GPL(dccp_send_ack); 509EXPORT_SYMBOL_GPL(dccp_send_ack);
510 510
511#if 0
511/* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */ 512/* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */
512void dccp_send_delayed_ack(struct sock *sk) 513void dccp_send_delayed_ack(struct sock *sk)
513{ 514{
@@ -538,6 +539,7 @@ void dccp_send_delayed_ack(struct sock *sk)
538 icsk->icsk_ack.timeout = timeout; 539 icsk->icsk_ack.timeout = timeout;
539 sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout); 540 sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout);
540} 541}
542#endif
541 543
542void dccp_send_sync(struct sock *sk, const u64 ackno, 544void dccp_send_sync(struct sock *sk, const u64 ackno,
543 const enum dccp_pkt_type pkt_type) 545 const enum dccp_pkt_type pkt_type)
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 0bcdc9250279..81368a7f5379 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -42,7 +42,7 @@ static int bufsize = 64 * 1024;
42 42
43static const char procname[] = "dccpprobe"; 43static const char procname[] = "dccpprobe";
44 44
45struct { 45static struct {
46 struct kfifo *fifo; 46 struct kfifo *fifo;
47 spinlock_t lock; 47 spinlock_t lock;
48 wait_queue_head_t wait; 48 wait_queue_head_t wait;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 68d154480043..7c9bb13b1539 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -340,7 +340,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
340 340
341 dev_hold(dev); 341 dev_hold(dev);
342 342
343 skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev), 343 skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev),
344 msg->msg_flags & MSG_DONTWAIT, &err); 344 msg->msg_flags & MSG_DONTWAIT, &err);
345 if (skb==NULL) 345 if (skb==NULL)
346 goto out_unlock; 346 goto out_unlock;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 68b72a7a1806..9b539fa9fe18 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -570,7 +570,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
570 * Allocate a buffer 570 * Allocate a buffer
571 */ 571 */
572 572
573 skb = alloc_skb(arp_hdr_len(dev) + LL_RESERVED_SPACE(dev), GFP_ATOMIC); 573 skb = alloc_skb(arp_hdr_len(dev) + LL_ALLOCATED_SPACE(dev), GFP_ATOMIC);
574 if (skb == NULL) 574 if (skb == NULL)
575 return NULL; 575 return NULL;
576 576
@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq,
1288 struct neighbour *n) 1288 struct neighbour *n)
1289{ 1289{
1290 char hbuffer[HBUFFERLEN]; 1290 char hbuffer[HBUFFERLEN];
1291 const char hexbuf[] = "0123456789ABCDEF";
1292 int k, j; 1291 int k, j;
1293 char tbuf[16]; 1292 char tbuf[16];
1294 struct net_device *dev = n->dev; 1293 struct net_device *dev = n->dev;
@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq,
1302 else { 1301 else {
1303#endif 1302#endif
1304 for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) { 1303 for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) {
1305 hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15]; 1304 hbuffer[k++] = hex_asc_hi(n->ha[j]);
1306 hbuffer[k++] = hexbuf[n->ha[j] & 15]; 1305 hbuffer[k++] = hex_asc_lo(n->ha[j]);
1307 hbuffer[k++] = ':'; 1306 hbuffer[k++] = ':';
1308 } 1307 }
1309 hbuffer[--k] = 0; 1308 hbuffer[--k] = 0;
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 05afb576d935..2c0e4572cc90 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -338,7 +338,7 @@ static int cipso_v4_cache_check(const unsigned char *key,
338 return -ENOENT; 338 return -ENOENT;
339 339
340 hash = cipso_v4_map_cache_hash(key, key_len); 340 hash = cipso_v4_map_cache_hash(key, key_len);
341 bkt = hash & (CIPSO_V4_CACHE_BUCKETBITS - 1); 341 bkt = hash & (CIPSO_V4_CACHE_BUCKETS - 1);
342 spin_lock_bh(&cipso_v4_cache[bkt].lock); 342 spin_lock_bh(&cipso_v4_cache[bkt].lock);
343 list_for_each_entry(entry, &cipso_v4_cache[bkt].list, list) { 343 list_for_each_entry(entry, &cipso_v4_cache[bkt].list, list) {
344 if (entry->hash == hash && 344 if (entry->hash == hash &&
@@ -417,7 +417,7 @@ int cipso_v4_cache_add(const struct sk_buff *skb,
417 atomic_inc(&secattr->cache->refcount); 417 atomic_inc(&secattr->cache->refcount);
418 entry->lsm_data = secattr->cache; 418 entry->lsm_data = secattr->cache;
419 419
420 bkt = entry->hash & (CIPSO_V4_CACHE_BUCKETBITS - 1); 420 bkt = entry->hash & (CIPSO_V4_CACHE_BUCKETS - 1);
421 spin_lock_bh(&cipso_v4_cache[bkt].lock); 421 spin_lock_bh(&cipso_v4_cache[bkt].lock);
422 if (cipso_v4_cache[bkt].size < cipso_v4_cache_bucketsize) { 422 if (cipso_v4_cache[bkt].size < cipso_v4_cache_bucketsize) {
423 list_add(&entry->list, &cipso_v4_cache[bkt].list); 423 list_add(&entry->list, &cipso_v4_cache[bkt].list);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 6848e4760f34..79a7ef6209ff 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -90,7 +90,6 @@ static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
90 [IFA_LOCAL] = { .type = NLA_U32 }, 90 [IFA_LOCAL] = { .type = NLA_U32 },
91 [IFA_ADDRESS] = { .type = NLA_U32 }, 91 [IFA_ADDRESS] = { .type = NLA_U32 },
92 [IFA_BROADCAST] = { .type = NLA_U32 }, 92 [IFA_BROADCAST] = { .type = NLA_U32 },
93 [IFA_ANYCAST] = { .type = NLA_U32 },
94 [IFA_LABEL] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, 93 [IFA_LABEL] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 },
95}; 94};
96 95
@@ -536,9 +535,6 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh)
536 if (tb[IFA_BROADCAST]) 535 if (tb[IFA_BROADCAST])
537 ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]); 536 ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]);
538 537
539 if (tb[IFA_ANYCAST])
540 ifa->ifa_anycast = nla_get_be32(tb[IFA_ANYCAST]);
541
542 if (tb[IFA_LABEL]) 538 if (tb[IFA_LABEL])
543 nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); 539 nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
544 else 540 else
@@ -745,7 +741,6 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
745 break; 741 break;
746 inet_del_ifa(in_dev, ifap, 0); 742 inet_del_ifa(in_dev, ifap, 0);
747 ifa->ifa_broadcast = 0; 743 ifa->ifa_broadcast = 0;
748 ifa->ifa_anycast = 0;
749 ifa->ifa_scope = 0; 744 ifa->ifa_scope = 0;
750 } 745 }
751 746
@@ -1113,7 +1108,6 @@ static inline size_t inet_nlmsg_size(void)
1113 + nla_total_size(4) /* IFA_ADDRESS */ 1108 + nla_total_size(4) /* IFA_ADDRESS */
1114 + nla_total_size(4) /* IFA_LOCAL */ 1109 + nla_total_size(4) /* IFA_LOCAL */
1115 + nla_total_size(4) /* IFA_BROADCAST */ 1110 + nla_total_size(4) /* IFA_BROADCAST */
1116 + nla_total_size(4) /* IFA_ANYCAST */
1117 + nla_total_size(IFNAMSIZ); /* IFA_LABEL */ 1111 + nla_total_size(IFNAMSIZ); /* IFA_LABEL */
1118} 1112}
1119 1113
@@ -1143,9 +1137,6 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
1143 if (ifa->ifa_broadcast) 1137 if (ifa->ifa_broadcast)
1144 NLA_PUT_BE32(skb, IFA_BROADCAST, ifa->ifa_broadcast); 1138 NLA_PUT_BE32(skb, IFA_BROADCAST, ifa->ifa_broadcast);
1145 1139
1146 if (ifa->ifa_anycast)
1147 NLA_PUT_BE32(skb, IFA_ANYCAST, ifa->ifa_anycast);
1148
1149 if (ifa->ifa_label[0]) 1140 if (ifa->ifa_label[0])
1150 NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); 1141 NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label);
1151 1142
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 0f1557a4ac7a..0b2ac6a3d903 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -506,7 +506,6 @@ const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = {
506 [RTA_PREFSRC] = { .type = NLA_U32 }, 506 [RTA_PREFSRC] = { .type = NLA_U32 },
507 [RTA_METRICS] = { .type = NLA_NESTED }, 507 [RTA_METRICS] = { .type = NLA_NESTED },
508 [RTA_MULTIPATH] = { .len = sizeof(struct rtnexthop) }, 508 [RTA_MULTIPATH] = { .len = sizeof(struct rtnexthop) },
509 [RTA_PROTOINFO] = { .type = NLA_U32 },
510 [RTA_FLOW] = { .type = NLA_U32 }, 509 [RTA_FLOW] = { .type = NLA_U32 },
511}; 510};
512 511
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 3b83c34019fc..0d4d72827e4b 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -960,7 +960,10 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
960 rtm->rtm_dst_len = dst_len; 960 rtm->rtm_dst_len = dst_len;
961 rtm->rtm_src_len = 0; 961 rtm->rtm_src_len = 0;
962 rtm->rtm_tos = tos; 962 rtm->rtm_tos = tos;
963 rtm->rtm_table = tb_id; 963 if (tb_id < 256)
964 rtm->rtm_table = tb_id;
965 else
966 rtm->rtm_table = RT_TABLE_COMPAT;
964 NLA_PUT_U32(skb, RTA_TABLE, tb_id); 967 NLA_PUT_U32(skb, RTA_TABLE, tb_id);
965 rtm->rtm_type = type; 968 rtm->rtm_type = type;
966 rtm->rtm_flags = fi->fib_flags; 969 rtm->rtm_flags = fi->fib_flags;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 6250f4239b61..2769dc4a4c84 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -292,7 +292,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
292 struct iphdr *pip; 292 struct iphdr *pip;
293 struct igmpv3_report *pig; 293 struct igmpv3_report *pig;
294 294
295 skb = alloc_skb(size + LL_RESERVED_SPACE(dev), GFP_ATOMIC); 295 skb = alloc_skb(size + LL_ALLOCATED_SPACE(dev), GFP_ATOMIC);
296 if (skb == NULL) 296 if (skb == NULL)
297 return NULL; 297 return NULL;
298 298
@@ -653,7 +653,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
653 return -1; 653 return -1;
654 } 654 }
655 655
656 skb=alloc_skb(IGMP_SIZE+LL_RESERVED_SPACE(dev), GFP_ATOMIC); 656 skb=alloc_skb(IGMP_SIZE+LL_ALLOCATED_SPACE(dev), GFP_ATOMIC);
657 if (skb == NULL) { 657 if (skb == NULL) {
658 ip_rt_put(rt); 658 ip_rt_put(rt);
659 return -1; 659 return -1;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 828ea211ff21..045e799d3e1d 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -419,7 +419,8 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
419 struct inet_connection_sock *icsk = inet_csk(parent); 419 struct inet_connection_sock *icsk = inet_csk(parent);
420 struct request_sock_queue *queue = &icsk->icsk_accept_queue; 420 struct request_sock_queue *queue = &icsk->icsk_accept_queue;
421 struct listen_sock *lopt = queue->listen_opt; 421 struct listen_sock *lopt = queue->listen_opt;
422 int thresh = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries; 422 int max_retries = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries;
423 int thresh = max_retries;
423 unsigned long now = jiffies; 424 unsigned long now = jiffies;
424 struct request_sock **reqp, *req; 425 struct request_sock **reqp, *req;
425 int i, budget; 426 int i, budget;
@@ -455,6 +456,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
455 } 456 }
456 } 457 }
457 458
459 if (queue->rskq_defer_accept)
460 max_retries = queue->rskq_defer_accept;
461
458 budget = 2 * (lopt->nr_table_entries / (timeout / interval)); 462 budget = 2 * (lopt->nr_table_entries / (timeout / interval));
459 i = lopt->clock_hand; 463 i = lopt->clock_hand;
460 464
@@ -462,8 +466,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
462 reqp=&lopt->syn_table[i]; 466 reqp=&lopt->syn_table[i];
463 while ((req = *reqp) != NULL) { 467 while ((req = *reqp) != NULL) {
464 if (time_after_eq(now, req->expires)) { 468 if (time_after_eq(now, req->expires)) {
465 if (req->retrans < thresh && 469 if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) &&
466 !req->rsk_ops->rtx_syn_ack(parent, req)) { 470 (inet_rsk(req)->acked ||
471 !req->rsk_ops->rtx_syn_ack(parent, req))) {
467 unsigned long timeo; 472 unsigned long timeo;
468 473
469 if (req->retrans++ == 0) 474 if (req->retrans++ == 0)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2ada033406de..4342cba4ff82 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -313,9 +313,8 @@ static void ipgre_tunnel_uninit(struct net_device *dev)
313 313
314static void ipgre_err(struct sk_buff *skb, u32 info) 314static void ipgre_err(struct sk_buff *skb, u32 info)
315{ 315{
316#ifndef I_WISH_WORLD_WERE_PERFECT
317 316
318/* It is not :-( All the routers (except for Linux) return only 317/* All the routers (except for Linux) return only
319 8 bytes of packet payload. It means, that precise relaying of 318 8 bytes of packet payload. It means, that precise relaying of
320 ICMP in the real Internet is absolutely infeasible. 319 ICMP in the real Internet is absolutely infeasible.
321 320
@@ -398,149 +397,6 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
398out: 397out:
399 read_unlock(&ipgre_lock); 398 read_unlock(&ipgre_lock);
400 return; 399 return;
401#else
402 struct iphdr *iph = (struct iphdr*)dp;
403 struct iphdr *eiph;
404 __be16 *p = (__be16*)(dp+(iph->ihl<<2));
405 const int type = icmp_hdr(skb)->type;
406 const int code = icmp_hdr(skb)->code;
407 int rel_type = 0;
408 int rel_code = 0;
409 __be32 rel_info = 0;
410 __u32 n = 0;
411 __be16 flags;
412 int grehlen = (iph->ihl<<2) + 4;
413 struct sk_buff *skb2;
414 struct flowi fl;
415 struct rtable *rt;
416
417 if (p[1] != htons(ETH_P_IP))
418 return;
419
420 flags = p[0];
421 if (flags&(GRE_CSUM|GRE_KEY|GRE_SEQ|GRE_ROUTING|GRE_VERSION)) {
422 if (flags&(GRE_VERSION|GRE_ROUTING))
423 return;
424 if (flags&GRE_CSUM)
425 grehlen += 4;
426 if (flags&GRE_KEY)
427 grehlen += 4;
428 if (flags&GRE_SEQ)
429 grehlen += 4;
430 }
431 if (len < grehlen + sizeof(struct iphdr))
432 return;
433 eiph = (struct iphdr*)(dp + grehlen);
434
435 switch (type) {
436 default:
437 return;
438 case ICMP_PARAMETERPROB:
439 n = ntohl(icmp_hdr(skb)->un.gateway) >> 24;
440 if (n < (iph->ihl<<2))
441 return;
442
443 /* So... This guy found something strange INSIDE encapsulated
444 packet. Well, he is fool, but what can we do ?
445 */
446 rel_type = ICMP_PARAMETERPROB;
447 n -= grehlen;
448 rel_info = htonl(n << 24);
449 break;
450
451 case ICMP_DEST_UNREACH:
452 switch (code) {
453 case ICMP_SR_FAILED:
454 case ICMP_PORT_UNREACH:
455 /* Impossible event. */
456 return;
457 case ICMP_FRAG_NEEDED:
458 /* And it is the only really necessary thing :-) */
459 n = ntohs(icmp_hdr(skb)->un.frag.mtu);
460 if (n < grehlen+68)
461 return;
462 n -= grehlen;
463 /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */
464 if (n > ntohs(eiph->tot_len))
465 return;
466 rel_info = htonl(n);
467 break;
468 default:
469 /* All others are translated to HOST_UNREACH.
470 rfc2003 contains "deep thoughts" about NET_UNREACH,
471 I believe, it is just ether pollution. --ANK
472 */
473 rel_type = ICMP_DEST_UNREACH;
474 rel_code = ICMP_HOST_UNREACH;
475 break;
476 }
477 break;
478 case ICMP_TIME_EXCEEDED:
479 if (code != ICMP_EXC_TTL)
480 return;
481 break;
482 }
483
484 /* Prepare fake skb to feed it to icmp_send */
485 skb2 = skb_clone(skb, GFP_ATOMIC);
486 if (skb2 == NULL)
487 return;
488 dst_release(skb2->dst);
489 skb2->dst = NULL;
490 skb_pull(skb2, skb->data - (u8*)eiph);
491 skb_reset_network_header(skb2);
492
493 /* Try to guess incoming interface */
494 memset(&fl, 0, sizeof(fl));
495 fl.fl4_dst = eiph->saddr;
496 fl.fl4_tos = RT_TOS(eiph->tos);
497 fl.proto = IPPROTO_GRE;
498 if (ip_route_output_key(dev_net(skb->dev), &rt, &fl)) {
499 kfree_skb(skb2);
500 return;
501 }
502 skb2->dev = rt->u.dst.dev;
503
504 /* route "incoming" packet */
505 if (rt->rt_flags&RTCF_LOCAL) {
506 ip_rt_put(rt);
507 rt = NULL;
508 fl.fl4_dst = eiph->daddr;
509 fl.fl4_src = eiph->saddr;
510 fl.fl4_tos = eiph->tos;
511 if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) ||
512 rt->u.dst.dev->type != ARPHRD_IPGRE) {
513 ip_rt_put(rt);
514 kfree_skb(skb2);
515 return;
516 }
517 } else {
518 ip_rt_put(rt);
519 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) ||
520 skb2->dst->dev->type != ARPHRD_IPGRE) {
521 kfree_skb(skb2);
522 return;
523 }
524 }
525
526 /* change mtu on this route */
527 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
528 if (n > dst_mtu(skb2->dst)) {
529 kfree_skb(skb2);
530 return;
531 }
532 skb2->dst->ops->update_pmtu(skb2->dst, n);
533 } else if (type == ICMP_TIME_EXCEEDED) {
534 struct ip_tunnel *t = netdev_priv(skb2->dev);
535 if (t->parms.iph.ttl) {
536 rel_type = ICMP_DEST_UNREACH;
537 rel_code = ICMP_HOST_UNREACH;
538 }
539 }
540
541 icmp_send(skb2, rel_type, rel_code, rel_info);
542 kfree_skb(skb2);
543#endif
544} 400}
545 401
546static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) 402static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 89dee4346f60..ed45037ce9be 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -710,14 +710,14 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
710 struct net_device *dev = d->dev; 710 struct net_device *dev = d->dev;
711 struct sk_buff *skb; 711 struct sk_buff *skb;
712 struct bootp_pkt *b; 712 struct bootp_pkt *b;
713 int hh_len = LL_RESERVED_SPACE(dev);
714 struct iphdr *h; 713 struct iphdr *h;
715 714
716 /* Allocate packet */ 715 /* Allocate packet */
717 skb = alloc_skb(sizeof(struct bootp_pkt) + hh_len + 15, GFP_KERNEL); 716 skb = alloc_skb(sizeof(struct bootp_pkt) + LL_ALLOCATED_SPACE(dev) + 15,
717 GFP_KERNEL);
718 if (!skb) 718 if (!skb)
719 return; 719 return;
720 skb_reserve(skb, hh_len); 720 skb_reserve(skb, LL_RESERVED_SPACE(dev));
721 b = (struct bootp_pkt *) skb_put(skb, sizeof(struct bootp_pkt)); 721 b = (struct bootp_pkt *) skb_put(skb, sizeof(struct bootp_pkt));
722 memset(b, 0, sizeof(struct bootp_pkt)); 722 memset(b, 0, sizeof(struct bootp_pkt));
723 723
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 149111f08e8d..af5cb53da5cc 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -278,9 +278,8 @@ static void ipip_tunnel_uninit(struct net_device *dev)
278 278
279static int ipip_err(struct sk_buff *skb, u32 info) 279static int ipip_err(struct sk_buff *skb, u32 info)
280{ 280{
281#ifndef I_WISH_WORLD_WERE_PERFECT
282 281
283/* It is not :-( All the routers (except for Linux) return only 282/* All the routers (except for Linux) return only
284 8 bytes of packet payload. It means, that precise relaying of 283 8 bytes of packet payload. It means, that precise relaying of
285 ICMP in the real Internet is absolutely infeasible. 284 ICMP in the real Internet is absolutely infeasible.
286 */ 285 */
@@ -337,133 +336,6 @@ static int ipip_err(struct sk_buff *skb, u32 info)
337out: 336out:
338 read_unlock(&ipip_lock); 337 read_unlock(&ipip_lock);
339 return err; 338 return err;
340#else
341 struct iphdr *iph = (struct iphdr*)dp;
342 int hlen = iph->ihl<<2;
343 struct iphdr *eiph;
344 const int type = icmp_hdr(skb)->type;
345 const int code = icmp_hdr(skb)->code;
346 int rel_type = 0;
347 int rel_code = 0;
348 __be32 rel_info = 0;
349 __u32 n = 0;
350 struct sk_buff *skb2;
351 struct flowi fl;
352 struct rtable *rt;
353
354 if (len < hlen + sizeof(struct iphdr))
355 return 0;
356 eiph = (struct iphdr*)(dp + hlen);
357
358 switch (type) {
359 default:
360 return 0;
361 case ICMP_PARAMETERPROB:
362 n = ntohl(icmp_hdr(skb)->un.gateway) >> 24;
363 if (n < hlen)
364 return 0;
365
366 /* So... This guy found something strange INSIDE encapsulated
367 packet. Well, he is fool, but what can we do ?
368 */
369 rel_type = ICMP_PARAMETERPROB;
370 rel_info = htonl((n - hlen) << 24);
371 break;
372
373 case ICMP_DEST_UNREACH:
374 switch (code) {
375 case ICMP_SR_FAILED:
376 case ICMP_PORT_UNREACH:
377 /* Impossible event. */
378 return 0;
379 case ICMP_FRAG_NEEDED:
380 /* And it is the only really necessary thing :-) */
381 n = ntohs(icmp_hdr(skb)->un.frag.mtu);
382 if (n < hlen+68)
383 return 0;
384 n -= hlen;
385 /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */
386 if (n > ntohs(eiph->tot_len))
387 return 0;
388 rel_info = htonl(n);
389 break;
390 default:
391 /* All others are translated to HOST_UNREACH.
392 rfc2003 contains "deep thoughts" about NET_UNREACH,
393 I believe, it is just ether pollution. --ANK
394 */
395 rel_type = ICMP_DEST_UNREACH;
396 rel_code = ICMP_HOST_UNREACH;
397 break;
398 }
399 break;
400 case ICMP_TIME_EXCEEDED:
401 if (code != ICMP_EXC_TTL)
402 return 0;
403 break;
404 }
405
406 /* Prepare fake skb to feed it to icmp_send */
407 skb2 = skb_clone(skb, GFP_ATOMIC);
408 if (skb2 == NULL)
409 return 0;
410 dst_release(skb2->dst);
411 skb2->dst = NULL;
412 skb_pull(skb2, skb->data - (u8*)eiph);
413 skb_reset_network_header(skb2);
414
415 /* Try to guess incoming interface */
416 memset(&fl, 0, sizeof(fl));
417 fl.fl4_daddr = eiph->saddr;
418 fl.fl4_tos = RT_TOS(eiph->tos);
419 fl.proto = IPPROTO_IPIP;
420 if (ip_route_output_key(dev_net(skb->dev), &rt, &key)) {
421 kfree_skb(skb2);
422 return 0;
423 }
424 skb2->dev = rt->u.dst.dev;
425
426 /* route "incoming" packet */
427 if (rt->rt_flags&RTCF_LOCAL) {
428 ip_rt_put(rt);
429 rt = NULL;
430 fl.fl4_daddr = eiph->daddr;
431 fl.fl4_src = eiph->saddr;
432 fl.fl4_tos = eiph->tos;
433 if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) ||
434 rt->u.dst.dev->type != ARPHRD_TUNNEL) {
435 ip_rt_put(rt);
436 kfree_skb(skb2);
437 return 0;
438 }
439 } else {
440 ip_rt_put(rt);
441 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) ||
442 skb2->dst->dev->type != ARPHRD_TUNNEL) {
443 kfree_skb(skb2);
444 return 0;
445 }
446 }
447
448 /* change mtu on this route */
449 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
450 if (n > dst_mtu(skb2->dst)) {
451 kfree_skb(skb2);
452 return 0;
453 }
454 skb2->dst->ops->update_pmtu(skb2->dst, n);
455 } else if (type == ICMP_TIME_EXCEEDED) {
456 struct ip_tunnel *t = netdev_priv(skb2->dev);
457 if (t->parms.iph.ttl) {
458 rel_type = ICMP_DEST_UNREACH;
459 rel_code = ICMP_HOST_UNREACH;
460 }
461 }
462
463 icmp_send(skb2, rel_type, rel_code, rel_info);
464 kfree_skb(skb2);
465 return 0;
466#endif
467} 339}
468 340
469static inline void ipip_ecn_decapsulate(const struct iphdr *outer_iph, 341static inline void ipip_ecn_decapsulate(const struct iphdr *outer_iph,
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index 5daefad3d193..7750c97fde7b 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -232,6 +232,11 @@ static unsigned char asn1_length_decode(struct asn1_ctx *ctx,
232 } 232 }
233 } 233 }
234 } 234 }
235
236 /* don't trust len bigger than ctx buffer */
237 if (*len > ctx->end - ctx->pointer)
238 return 0;
239
235 return 1; 240 return 1;
236} 241}
237 242
@@ -250,6 +255,10 @@ static unsigned char asn1_header_decode(struct asn1_ctx *ctx,
250 if (!asn1_length_decode(ctx, &def, &len)) 255 if (!asn1_length_decode(ctx, &def, &len))
251 return 0; 256 return 0;
252 257
258 /* primitive shall be definite, indefinite shall be constructed */
259 if (*con == ASN1_PRI && !def)
260 return 0;
261
253 if (def) 262 if (def)
254 *eoc = ctx->pointer + len; 263 *eoc = ctx->pointer + len;
255 else 264 else
@@ -434,6 +443,11 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx,
434 unsigned long *optr; 443 unsigned long *optr;
435 444
436 size = eoc - ctx->pointer + 1; 445 size = eoc - ctx->pointer + 1;
446
447 /* first subid actually encodes first two subids */
448 if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
449 return 0;
450
437 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); 451 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
438 if (*oid == NULL) { 452 if (*oid == NULL) {
439 if (net_ratelimit()) 453 if (net_ratelimit())
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 11d7f753a820..e7e091d365ff 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -322,7 +322,6 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
322 unsigned int flags) 322 unsigned int flags)
323{ 323{
324 struct inet_sock *inet = inet_sk(sk); 324 struct inet_sock *inet = inet_sk(sk);
325 int hh_len;
326 struct iphdr *iph; 325 struct iphdr *iph;
327 struct sk_buff *skb; 326 struct sk_buff *skb;
328 unsigned int iphlen; 327 unsigned int iphlen;
@@ -336,13 +335,12 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
336 if (flags&MSG_PROBE) 335 if (flags&MSG_PROBE)
337 goto out; 336 goto out;
338 337
339 hh_len = LL_RESERVED_SPACE(rt->u.dst.dev); 338 skb = sock_alloc_send_skb(sk,
340 339 length + LL_ALLOCATED_SPACE(rt->u.dst.dev) + 15,
341 skb = sock_alloc_send_skb(sk, length+hh_len+15, 340 flags & MSG_DONTWAIT, &err);
342 flags&MSG_DONTWAIT, &err);
343 if (skb == NULL) 341 if (skb == NULL)
344 goto error; 342 goto error;
345 skb_reserve(skb, hh_len); 343 skb_reserve(skb, LL_RESERVED_SPACE(rt->u.dst.dev));
346 344
347 skb->priority = sk->sk_priority; 345 skb->priority = sk->sk_priority;
348 skb->mark = sk->sk_mark; 346 skb->mark = sk->sk_mark;
@@ -610,6 +608,14 @@ static void raw_close(struct sock *sk, long timeout)
610 sk_common_release(sk); 608 sk_common_release(sk);
611} 609}
612 610
611static int raw_destroy(struct sock *sk)
612{
613 lock_sock(sk);
614 ip_flush_pending_frames(sk);
615 release_sock(sk);
616 return 0;
617}
618
613/* This gets rid of all the nasties in af_inet. -DaveM */ 619/* This gets rid of all the nasties in af_inet. -DaveM */
614static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) 620static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
615{ 621{
@@ -822,6 +828,7 @@ struct proto raw_prot = {
822 .name = "RAW", 828 .name = "RAW",
823 .owner = THIS_MODULE, 829 .owner = THIS_MODULE,
824 .close = raw_close, 830 .close = raw_close,
831 .destroy = raw_destroy,
825 .connect = ip4_datagram_connect, 832 .connect = ip4_datagram_connect,
826 .disconnect = udp_disconnect, 833 .disconnect = udp_disconnect,
827 .ioctl = raw_ioctl, 834 .ioctl = raw_ioctl,
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 92f90ae46f4a..96be336064fb 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -160,7 +160,7 @@ static struct dst_ops ipv4_dst_ops = {
160 .negative_advice = ipv4_negative_advice, 160 .negative_advice = ipv4_negative_advice,
161 .link_failure = ipv4_link_failure, 161 .link_failure = ipv4_link_failure,
162 .update_pmtu = ip_rt_update_pmtu, 162 .update_pmtu = ip_rt_update_pmtu,
163 .local_out = ip_local_out, 163 .local_out = __ip_local_out,
164 .entry_size = sizeof(struct rtable), 164 .entry_size = sizeof(struct rtable),
165 .entries = ATOMIC_INIT(0), 165 .entries = ATOMIC_INIT(0),
166}; 166};
@@ -1792,7 +1792,7 @@ static int __mkroute_input(struct sk_buff *skb,
1792 if (err) 1792 if (err)
1793 flags |= RTCF_DIRECTSRC; 1793 flags |= RTCF_DIRECTSRC;
1794 1794
1795 if (out_dev == in_dev && err && !(flags & RTCF_MASQ) && 1795 if (out_dev == in_dev && err &&
1796 (IN_DEV_SHARED_MEDIA(out_dev) || 1796 (IN_DEV_SHARED_MEDIA(out_dev) ||
1797 inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) 1797 inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
1798 flags |= RTCF_DOREDIRECT; 1798 flags |= RTCF_DOREDIRECT;
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 73ba98921d64..d182a2a26291 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -285,7 +285,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
285 cookie_check_timestamp(&tcp_opt); 285 cookie_check_timestamp(&tcp_opt);
286 286
287 ret = NULL; 287 ret = NULL;
288 req = reqsk_alloc(&tcp_request_sock_ops); /* for safety */ 288 req = inet_reqsk_alloc(&tcp_request_sock_ops); /* for safety */
289 if (!req) 289 if (!req)
290 goto out; 290 goto out;
291 291
@@ -301,7 +301,6 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
301 ireq->rmt_port = th->source; 301 ireq->rmt_port = th->source;
302 ireq->loc_addr = ip_hdr(skb)->daddr; 302 ireq->loc_addr = ip_hdr(skb)->daddr;
303 ireq->rmt_addr = ip_hdr(skb)->saddr; 303 ireq->rmt_addr = ip_hdr(skb)->saddr;
304 ireq->opt = NULL;
305 ireq->snd_wscale = tcp_opt.snd_wscale; 304 ireq->snd_wscale = tcp_opt.snd_wscale;
306 ireq->rcv_wscale = tcp_opt.rcv_wscale; 305 ireq->rcv_wscale = tcp_opt.rcv_wscale;
307 ireq->sack_ok = tcp_opt.sack_ok; 306 ireq->sack_ok = tcp_opt.sack_ok;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index f88653138621..fc54a48fde1e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1227,7 +1227,14 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1227 copied += used; 1227 copied += used;
1228 offset += used; 1228 offset += used;
1229 } 1229 }
1230 if (offset != skb->len) 1230 /*
1231 * If recv_actor drops the lock (e.g. TCP splice
1232 * receive) the skb pointer might be invalid when
1233 * getting here: tcp_collapse might have deleted it
1234 * while aggregating skbs from the socket queue.
1235 */
1236 skb = tcp_recv_skb(sk, seq-1, &offset);
1237 if (!skb || (offset+1 != skb->len))
1231 break; 1238 break;
1232 } 1239 }
1233 if (tcp_hdr(skb)->fin) { 1240 if (tcp_hdr(skb)->fin) {
@@ -2105,12 +2112,15 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2105 break; 2112 break;
2106 2113
2107 case TCP_DEFER_ACCEPT: 2114 case TCP_DEFER_ACCEPT:
2108 if (val < 0) { 2115 icsk->icsk_accept_queue.rskq_defer_accept = 0;
2109 err = -EINVAL; 2116 if (val > 0) {
2110 } else { 2117 /* Translate value in seconds to number of
2111 if (val > MAX_TCP_ACCEPT_DEFERRED) 2118 * retransmits */
2112 val = MAX_TCP_ACCEPT_DEFERRED; 2119 while (icsk->icsk_accept_queue.rskq_defer_accept < 32 &&
2113 icsk->icsk_accept_queue.rskq_defer_accept = val; 2120 val > ((TCP_TIMEOUT_INIT / HZ) <<
2121 icsk->icsk_accept_queue.rskq_defer_accept))
2122 icsk->icsk_accept_queue.rskq_defer_accept++;
2123 icsk->icsk_accept_queue.rskq_defer_accept++;
2114 } 2124 }
2115 break; 2125 break;
2116 2126
@@ -2292,7 +2302,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
2292 val = (val ? : sysctl_tcp_fin_timeout) / HZ; 2302 val = (val ? : sysctl_tcp_fin_timeout) / HZ;
2293 break; 2303 break;
2294 case TCP_DEFER_ACCEPT: 2304 case TCP_DEFER_ACCEPT:
2295 val = icsk->icsk_accept_queue.rskq_defer_accept; 2305 val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 :
2306 ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1));
2296 break; 2307 break;
2297 case TCP_WINDOW_CLAMP: 2308 case TCP_WINDOW_CLAMP:
2298 val = tp->window_clamp; 2309 val = tp->window_clamp;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 26c936930e92..cad73b7dfef0 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1392,9 +1392,9 @@ static struct sk_buff *tcp_maybe_skipping_dsack(struct sk_buff *skb,
1392 1392
1393 if (before(next_dup->start_seq, skip_to_seq)) { 1393 if (before(next_dup->start_seq, skip_to_seq)) {
1394 skb = tcp_sacktag_skip(skb, sk, next_dup->start_seq, fack_count); 1394 skb = tcp_sacktag_skip(skb, sk, next_dup->start_seq, fack_count);
1395 tcp_sacktag_walk(skb, sk, NULL, 1395 skb = tcp_sacktag_walk(skb, sk, NULL,
1396 next_dup->start_seq, next_dup->end_seq, 1396 next_dup->start_seq, next_dup->end_seq,
1397 1, fack_count, reord, flag); 1397 1, fack_count, reord, flag);
1398 } 1398 }
1399 1399
1400 return skb; 1400 return skb;
@@ -1842,9 +1842,16 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
1842 TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; 1842 TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS;
1843 } 1843 }
1844 1844
1845 /* Don't lost mark skbs that were fwd transmitted after RTO */ 1845 /* Marking forward transmissions that were made after RTO lost
1846 if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) && 1846 * can cause unnecessary retransmissions in some scenarios,
1847 !after(TCP_SKB_CB(skb)->end_seq, tp->frto_highmark)) { 1847 * SACK blocks will mitigate that in some but not in all cases.
1848 * We used to not mark them but it was causing break-ups with
1849 * receivers that do only in-order receival.
1850 *
1851 * TODO: we could detect presence of such receiver and select
1852 * different behavior per flow.
1853 */
1854 if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) {
1848 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 1855 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
1849 tp->lost_out += tcp_skb_pcount(skb); 1856 tp->lost_out += tcp_skb_pcount(skb);
1850 } 1857 }
@@ -1860,7 +1867,7 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
1860 tp->reordering = min_t(unsigned int, tp->reordering, 1867 tp->reordering = min_t(unsigned int, tp->reordering,
1861 sysctl_tcp_reordering); 1868 sysctl_tcp_reordering);
1862 tcp_set_ca_state(sk, TCP_CA_Loss); 1869 tcp_set_ca_state(sk, TCP_CA_Loss);
1863 tp->high_seq = tp->frto_highmark; 1870 tp->high_seq = tp->snd_nxt;
1864 TCP_ECN_queue_cwr(tp); 1871 TCP_ECN_queue_cwr(tp);
1865 1872
1866 tcp_clear_retrans_hints_partial(tp); 1873 tcp_clear_retrans_hints_partial(tp);
@@ -2476,28 +2483,34 @@ static inline void tcp_complete_cwr(struct sock *sk)
2476 tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); 2483 tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR);
2477} 2484}
2478 2485
2486static void tcp_try_keep_open(struct sock *sk)
2487{
2488 struct tcp_sock *tp = tcp_sk(sk);
2489 int state = TCP_CA_Open;
2490
2491 if (tcp_left_out(tp) || tp->retrans_out || tp->undo_marker)
2492 state = TCP_CA_Disorder;
2493
2494 if (inet_csk(sk)->icsk_ca_state != state) {
2495 tcp_set_ca_state(sk, state);
2496 tp->high_seq = tp->snd_nxt;
2497 }
2498}
2499
2479static void tcp_try_to_open(struct sock *sk, int flag) 2500static void tcp_try_to_open(struct sock *sk, int flag)
2480{ 2501{
2481 struct tcp_sock *tp = tcp_sk(sk); 2502 struct tcp_sock *tp = tcp_sk(sk);
2482 2503
2483 tcp_verify_left_out(tp); 2504 tcp_verify_left_out(tp);
2484 2505
2485 if (tp->retrans_out == 0) 2506 if (!tp->frto_counter && tp->retrans_out == 0)
2486 tp->retrans_stamp = 0; 2507 tp->retrans_stamp = 0;
2487 2508
2488 if (flag & FLAG_ECE) 2509 if (flag & FLAG_ECE)
2489 tcp_enter_cwr(sk, 1); 2510 tcp_enter_cwr(sk, 1);
2490 2511
2491 if (inet_csk(sk)->icsk_ca_state != TCP_CA_CWR) { 2512 if (inet_csk(sk)->icsk_ca_state != TCP_CA_CWR) {
2492 int state = TCP_CA_Open; 2513 tcp_try_keep_open(sk);
2493
2494 if (tcp_left_out(tp) || tp->retrans_out || tp->undo_marker)
2495 state = TCP_CA_Disorder;
2496
2497 if (inet_csk(sk)->icsk_ca_state != state) {
2498 tcp_set_ca_state(sk, state);
2499 tp->high_seq = tp->snd_nxt;
2500 }
2501 tcp_moderate_cwnd(tp); 2514 tcp_moderate_cwnd(tp);
2502 } else { 2515 } else {
2503 tcp_cwnd_down(sk, flag); 2516 tcp_cwnd_down(sk, flag);
@@ -3303,8 +3316,11 @@ no_queue:
3303 return 1; 3316 return 1;
3304 3317
3305old_ack: 3318old_ack:
3306 if (TCP_SKB_CB(skb)->sacked) 3319 if (TCP_SKB_CB(skb)->sacked) {
3307 tcp_sacktag_write_queue(sk, skb, prior_snd_una); 3320 tcp_sacktag_write_queue(sk, skb, prior_snd_una);
3321 if (icsk->icsk_ca_state == TCP_CA_Open)
3322 tcp_try_keep_open(sk);
3323 }
3308 3324
3309uninteresting_ack: 3325uninteresting_ack:
3310 SOCK_DEBUG(sk, "Ack %u out of %u:%u\n", ack, tp->snd_una, tp->snd_nxt); 3326 SOCK_DEBUG(sk, "Ack %u out of %u:%u\n", ack, tp->snd_una, tp->snd_nxt);
@@ -4525,49 +4541,6 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th)
4525 } 4541 }
4526} 4542}
4527 4543
4528static int tcp_defer_accept_check(struct sock *sk)
4529{
4530 struct tcp_sock *tp = tcp_sk(sk);
4531
4532 if (tp->defer_tcp_accept.request) {
4533 int queued_data = tp->rcv_nxt - tp->copied_seq;
4534 int hasfin = !skb_queue_empty(&sk->sk_receive_queue) ?
4535 tcp_hdr((struct sk_buff *)
4536 sk->sk_receive_queue.prev)->fin : 0;
4537
4538 if (queued_data && hasfin)
4539 queued_data--;
4540
4541 if (queued_data &&
4542 tp->defer_tcp_accept.listen_sk->sk_state == TCP_LISTEN) {
4543 if (sock_flag(sk, SOCK_KEEPOPEN)) {
4544 inet_csk_reset_keepalive_timer(sk,
4545 keepalive_time_when(tp));
4546 } else {
4547 inet_csk_delete_keepalive_timer(sk);
4548 }
4549
4550 inet_csk_reqsk_queue_add(
4551 tp->defer_tcp_accept.listen_sk,
4552 tp->defer_tcp_accept.request,
4553 sk);
4554
4555 tp->defer_tcp_accept.listen_sk->sk_data_ready(
4556 tp->defer_tcp_accept.listen_sk, 0);
4557
4558 sock_put(tp->defer_tcp_accept.listen_sk);
4559 sock_put(sk);
4560 tp->defer_tcp_accept.listen_sk = NULL;
4561 tp->defer_tcp_accept.request = NULL;
4562 } else if (hasfin ||
4563 tp->defer_tcp_accept.listen_sk->sk_state != TCP_LISTEN) {
4564 tcp_reset(sk);
4565 return -1;
4566 }
4567 }
4568 return 0;
4569}
4570
4571static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen) 4544static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen)
4572{ 4545{
4573 struct tcp_sock *tp = tcp_sk(sk); 4546 struct tcp_sock *tp = tcp_sk(sk);
@@ -4928,8 +4901,6 @@ step5:
4928 4901
4929 tcp_data_snd_check(sk); 4902 tcp_data_snd_check(sk);
4930 tcp_ack_snd_check(sk); 4903 tcp_ack_snd_check(sk);
4931
4932 tcp_defer_accept_check(sk);
4933 return 0; 4904 return 0;
4934 4905
4935csum_error: 4906csum_error:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index cd601a866c2f..97a230026e13 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1285,7 +1285,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1285 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) 1285 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
1286 goto drop; 1286 goto drop;
1287 1287
1288 req = reqsk_alloc(&tcp_request_sock_ops); 1288 req = inet_reqsk_alloc(&tcp_request_sock_ops);
1289 if (!req) 1289 if (!req)
1290 goto drop; 1290 goto drop;
1291 1291
@@ -1918,14 +1918,6 @@ int tcp_v4_destroy_sock(struct sock *sk)
1918 sk->sk_sndmsg_page = NULL; 1918 sk->sk_sndmsg_page = NULL;
1919 } 1919 }
1920 1920
1921 if (tp->defer_tcp_accept.request) {
1922 reqsk_free(tp->defer_tcp_accept.request);
1923 sock_put(tp->defer_tcp_accept.listen_sk);
1924 sock_put(sk);
1925 tp->defer_tcp_accept.listen_sk = NULL;
1926 tp->defer_tcp_accept.request = NULL;
1927 }
1928
1929 atomic_dec(&tcp_sockets_allocated); 1921 atomic_dec(&tcp_sockets_allocated);
1930 1922
1931 return 0; 1923 return 0;
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 019c8c16e5cc..8245247a6ceb 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -571,8 +571,10 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
571 does sequence test, SYN is truncated, and thus we consider 571 does sequence test, SYN is truncated, and thus we consider
572 it a bare ACK. 572 it a bare ACK.
573 573
574 Both ends (listening sockets) accept the new incoming 574 If icsk->icsk_accept_queue.rskq_defer_accept, we silently drop this
575 connection and try to talk to each other. 8-) 575 bare ACK. Otherwise, we create an established connection. Both
576 ends (listening sockets) accept the new incoming connection and try
577 to talk to each other. 8-)
576 578
577 Note: This case is both harmless, and rare. Possibility is about the 579 Note: This case is both harmless, and rare. Possibility is about the
578 same as us discovering intelligent life on another plant tomorrow. 580 same as us discovering intelligent life on another plant tomorrow.
@@ -640,6 +642,13 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
640 if (!(flg & TCP_FLAG_ACK)) 642 if (!(flg & TCP_FLAG_ACK))
641 return NULL; 643 return NULL;
642 644
645 /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */
646 if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept &&
647 TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
648 inet_rsk(req)->acked = 1;
649 return NULL;
650 }
651
643 /* OK, ACK is valid, create big socket and 652 /* OK, ACK is valid, create big socket and
644 * feed this segment to it. It will repeat all 653 * feed this segment to it. It will repeat all
645 * the tests. THIS SEGMENT MUST MOVE SOCKET TO 654 * the tests. THIS SEGMENT MUST MOVE SOCKET TO
@@ -678,24 +687,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
678 inet_csk_reqsk_queue_unlink(sk, req, prev); 687 inet_csk_reqsk_queue_unlink(sk, req, prev);
679 inet_csk_reqsk_queue_removed(sk, req); 688 inet_csk_reqsk_queue_removed(sk, req);
680 689
681 if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && 690 inet_csk_reqsk_queue_add(sk, req, child);
682 TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
683
684 /* the accept queue handling is done is est recv slow
685 * path so lets make sure to start there
686 */
687 tcp_sk(child)->pred_flags = 0;
688 sock_hold(sk);
689 sock_hold(child);
690 tcp_sk(child)->defer_tcp_accept.listen_sk = sk;
691 tcp_sk(child)->defer_tcp_accept.request = req;
692
693 inet_csk_reset_keepalive_timer(child,
694 inet_csk(sk)->icsk_accept_queue.rskq_defer_accept * HZ);
695 } else {
696 inet_csk_reqsk_queue_add(sk, req, child);
697 }
698
699 return child; 691 return child;
700 692
701 listen_overflow: 693 listen_overflow:
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index debf23581606..ad993ecb4810 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1836,7 +1836,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1836{ 1836{
1837 struct tcp_sock *tp = tcp_sk(sk); 1837 struct tcp_sock *tp = tcp_sk(sk);
1838 struct inet_connection_sock *icsk = inet_csk(sk); 1838 struct inet_connection_sock *icsk = inet_csk(sk);
1839 unsigned int cur_mss = tcp_current_mss(sk, 0); 1839 unsigned int cur_mss;
1840 int err; 1840 int err;
1841 1841
1842 /* Inconslusive MTU probe */ 1842 /* Inconslusive MTU probe */
@@ -1858,6 +1858,11 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1858 return -ENOMEM; 1858 return -ENOMEM;
1859 } 1859 }
1860 1860
1861 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk))
1862 return -EHOSTUNREACH; /* Routing failure or similar. */
1863
1864 cur_mss = tcp_current_mss(sk, 0);
1865
1861 /* If receiver has shrunk his window, and skb is out of 1866 /* If receiver has shrunk his window, and skb is out of
1862 * new window, do not retransmit it. The exception is the 1867 * new window, do not retransmit it. The exception is the
1863 * case, when window is shrunk to zero. In this case 1868 * case, when window is shrunk to zero. In this case
@@ -1884,9 +1889,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1884 (sysctl_tcp_retrans_collapse != 0)) 1889 (sysctl_tcp_retrans_collapse != 0))
1885 tcp_retrans_try_collapse(sk, skb, cur_mss); 1890 tcp_retrans_try_collapse(sk, skb, cur_mss);
1886 1891
1887 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk))
1888 return -EHOSTUNREACH; /* Routing failure or similar. */
1889
1890 /* Some Solaris stacks overoptimize and ignore the FIN on a 1892 /* Some Solaris stacks overoptimize and ignore the FIN on a
1891 * retransmit when old data is attached. So strip it off 1893 * retransmit when old data is attached. So strip it off
1892 * since it is cheap to do so and saves bytes on the network. 1894 * since it is cheap to do so and saves bytes on the network.
@@ -2129,6 +2131,8 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority)
2129 TCP_SKB_CB(skb)->when = tcp_time_stamp; 2131 TCP_SKB_CB(skb)->when = tcp_time_stamp;
2130 if (tcp_transmit_skb(sk, skb, 0, priority)) 2132 if (tcp_transmit_skb(sk, skb, 0, priority))
2131 NET_INC_STATS(LINUX_MIB_TCPABORTFAILED); 2133 NET_INC_STATS(LINUX_MIB_TCPABORTFAILED);
2134
2135 TCP_INC_STATS(TCP_MIB_OUTRSTS);
2132} 2136}
2133 2137
2134/* WARNING: This routine must only be called when we have already sent 2138/* WARNING: This routine must only be called when we have already sent
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 4de68cf5f2aa..63ed9d6830e7 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -489,11 +489,6 @@ static void tcp_keepalive_timer (unsigned long data)
489 goto death; 489 goto death;
490 } 490 }
491 491
492 if (tp->defer_tcp_accept.request && sk->sk_state == TCP_ESTABLISHED) {
493 tcp_send_active_reset(sk, GFP_ATOMIC);
494 goto death;
495 }
496
497 if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE) 492 if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE)
498 goto out; 493 goto out;
499 494
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index d3b709a6f264..cb1f0e83830b 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -97,7 +97,7 @@ static int tunnel64_rcv(struct sk_buff *skb)
97{ 97{
98 struct xfrm_tunnel *handler; 98 struct xfrm_tunnel *handler;
99 99
100 if (!pskb_may_pull(skb, sizeof(struct iphdr))) 100 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
101 goto drop; 101 goto drop;
102 102
103 for (handler = tunnel64_handlers; handler; handler = handler->next) 103 for (handler = tunnel64_handlers; handler; handler = handler->next)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index db1cb7c96d63..56fcda3694ba 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -420,7 +420,7 @@ void udp_err(struct sk_buff *skb, u32 info)
420/* 420/*
421 * Throw away all pending data and cancel the corking. Socket is locked. 421 * Throw away all pending data and cancel the corking. Socket is locked.
422 */ 422 */
423static void udp_flush_pending_frames(struct sock *sk) 423void udp_flush_pending_frames(struct sock *sk)
424{ 424{
425 struct udp_sock *up = udp_sk(sk); 425 struct udp_sock *up = udp_sk(sk);
426 426
@@ -430,6 +430,7 @@ static void udp_flush_pending_frames(struct sock *sk)
430 ip_flush_pending_frames(sk); 430 ip_flush_pending_frames(sk);
431 } 431 }
432} 432}
433EXPORT_SYMBOL(udp_flush_pending_frames);
433 434
434/** 435/**
435 * udp4_hwcsum_outgoing - handle outgoing HW checksumming 436 * udp4_hwcsum_outgoing - handle outgoing HW checksumming
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e591e09e5e4e..147588f4c7c0 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -731,8 +731,13 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
731 onlink = -1; 731 onlink = -1;
732 732
733 spin_lock(&ifa->lock); 733 spin_lock(&ifa->lock);
734 lifetime = min_t(unsigned long, 734
735 ifa->valid_lft, 0x7fffffffUL/HZ); 735 lifetime = addrconf_timeout_fixup(ifa->valid_lft, HZ);
736 /*
737 * Note: Because this address is
738 * not permanent, lifetime <
739 * LONG_MAX / HZ here.
740 */
736 if (time_before(expires, 741 if (time_before(expires,
737 ifa->tstamp + lifetime * HZ)) 742 ifa->tstamp + lifetime * HZ))
738 expires = ifa->tstamp + lifetime * HZ; 743 expires = ifa->tstamp + lifetime * HZ;
@@ -1722,7 +1727,6 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1722 __u32 valid_lft; 1727 __u32 valid_lft;
1723 __u32 prefered_lft; 1728 __u32 prefered_lft;
1724 int addr_type; 1729 int addr_type;
1725 unsigned long rt_expires;
1726 struct inet6_dev *in6_dev; 1730 struct inet6_dev *in6_dev;
1727 1731
1728 pinfo = (struct prefix_info *) opt; 1732 pinfo = (struct prefix_info *) opt;
@@ -1764,41 +1768,49 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1764 * 2) Configure prefixes with the auto flag set 1768 * 2) Configure prefixes with the auto flag set
1765 */ 1769 */
1766 1770
1767 /* Avoid arithmetic overflow. Really, we could
1768 save rt_expires in seconds, likely valid_lft,
1769 but it would require division in fib gc, that it
1770 not good.
1771 */
1772 if (valid_lft >= 0x7FFFFFFF/HZ)
1773 rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ);
1774 else
1775 rt_expires = valid_lft * HZ;
1776
1777 /*
1778 * We convert this (in jiffies) to clock_t later.
1779 * Avoid arithmetic overflow there as well.
1780 * Overflow can happen only if HZ < USER_HZ.
1781 */
1782 if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ)
1783 rt_expires = 0x7FFFFFFF / USER_HZ;
1784
1785 if (pinfo->onlink) { 1771 if (pinfo->onlink) {
1786 struct rt6_info *rt; 1772 struct rt6_info *rt;
1773 unsigned long rt_expires;
1774
1775 /* Avoid arithmetic overflow. Really, we could
1776 * save rt_expires in seconds, likely valid_lft,
1777 * but it would require division in fib gc, that it
1778 * not good.
1779 */
1780 if (HZ > USER_HZ)
1781 rt_expires = addrconf_timeout_fixup(valid_lft, HZ);
1782 else
1783 rt_expires = addrconf_timeout_fixup(valid_lft, USER_HZ);
1784
1785 if (addrconf_finite_timeout(rt_expires))
1786 rt_expires *= HZ;
1787
1787 rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL, 1788 rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL,
1788 dev->ifindex, 1); 1789 dev->ifindex, 1);
1789 1790
1790 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1791 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
1791 if (rt->rt6i_flags&RTF_EXPIRES) { 1792 /* Autoconf prefix route */
1792 if (valid_lft == 0) { 1793 if (valid_lft == 0) {
1793 ip6_del_rt(rt); 1794 ip6_del_rt(rt);
1794 rt = NULL; 1795 rt = NULL;
1795 } else { 1796 } else if (addrconf_finite_timeout(rt_expires)) {
1796 rt->rt6i_expires = jiffies + rt_expires; 1797 /* not infinity */
1797 } 1798 rt->rt6i_expires = jiffies + rt_expires;
1799 rt->rt6i_flags |= RTF_EXPIRES;
1800 } else {
1801 rt->rt6i_flags &= ~RTF_EXPIRES;
1802 rt->rt6i_expires = 0;
1798 } 1803 }
1799 } else if (valid_lft) { 1804 } else if (valid_lft) {
1805 clock_t expires = 0;
1806 int flags = RTF_ADDRCONF | RTF_PREFIX_RT;
1807 if (addrconf_finite_timeout(rt_expires)) {
1808 /* not infinity */
1809 flags |= RTF_EXPIRES;
1810 expires = jiffies_to_clock_t(rt_expires);
1811 }
1800 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, 1812 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
1801 dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); 1813 dev, expires, flags);
1802 } 1814 }
1803 if (rt) 1815 if (rt)
1804 dst_release(&rt->u.dst); 1816 dst_release(&rt->u.dst);
@@ -2014,17 +2026,22 @@ err_exit:
2014 * Manual configuration of address on an interface 2026 * Manual configuration of address on an interface
2015 */ 2027 */
2016static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, 2028static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
2017 int plen, __u8 ifa_flags, __u32 prefered_lft, 2029 unsigned int plen, __u8 ifa_flags, __u32 prefered_lft,
2018 __u32 valid_lft) 2030 __u32 valid_lft)
2019{ 2031{
2020 struct inet6_ifaddr *ifp; 2032 struct inet6_ifaddr *ifp;
2021 struct inet6_dev *idev; 2033 struct inet6_dev *idev;
2022 struct net_device *dev; 2034 struct net_device *dev;
2023 int scope; 2035 int scope;
2024 u32 flags = RTF_EXPIRES; 2036 u32 flags;
2037 clock_t expires;
2038 unsigned long timeout;
2025 2039
2026 ASSERT_RTNL(); 2040 ASSERT_RTNL();
2027 2041
2042 if (plen > 128)
2043 return -EINVAL;
2044
2028 /* check the lifetime */ 2045 /* check the lifetime */
2029 if (!valid_lft || prefered_lft > valid_lft) 2046 if (!valid_lft || prefered_lft > valid_lft)
2030 return -EINVAL; 2047 return -EINVAL;
@@ -2038,17 +2055,23 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
2038 2055
2039 scope = ipv6_addr_scope(pfx); 2056 scope = ipv6_addr_scope(pfx);
2040 2057
2041 if (valid_lft == INFINITY_LIFE_TIME) { 2058 timeout = addrconf_timeout_fixup(valid_lft, HZ);
2042 ifa_flags |= IFA_F_PERMANENT; 2059 if (addrconf_finite_timeout(timeout)) {
2060 expires = jiffies_to_clock_t(timeout * HZ);
2061 valid_lft = timeout;
2062 flags = RTF_EXPIRES;
2063 } else {
2064 expires = 0;
2043 flags = 0; 2065 flags = 0;
2044 } else if (valid_lft >= 0x7FFFFFFF/HZ) 2066 ifa_flags |= IFA_F_PERMANENT;
2045 valid_lft = 0x7FFFFFFF/HZ; 2067 }
2046 2068
2047 if (prefered_lft == 0) 2069 timeout = addrconf_timeout_fixup(prefered_lft, HZ);
2048 ifa_flags |= IFA_F_DEPRECATED; 2070 if (addrconf_finite_timeout(timeout)) {
2049 else if ((prefered_lft >= 0x7FFFFFFF/HZ) && 2071 if (timeout == 0)
2050 (prefered_lft != INFINITY_LIFE_TIME)) 2072 ifa_flags |= IFA_F_DEPRECATED;
2051 prefered_lft = 0x7FFFFFFF/HZ; 2073 prefered_lft = timeout;
2074 }
2052 2075
2053 ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); 2076 ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags);
2054 2077
@@ -2060,7 +2083,7 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
2060 spin_unlock_bh(&ifp->lock); 2083 spin_unlock_bh(&ifp->lock);
2061 2084
2062 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 2085 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev,
2063 jiffies_to_clock_t(valid_lft * HZ), flags); 2086 expires, flags);
2064 /* 2087 /*
2065 * Note that section 3.1 of RFC 4429 indicates 2088 * Note that section 3.1 of RFC 4429 indicates
2066 * that the Optimistic flag should not be set for 2089 * that the Optimistic flag should not be set for
@@ -2076,12 +2099,15 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
2076} 2099}
2077 2100
2078static int inet6_addr_del(struct net *net, int ifindex, struct in6_addr *pfx, 2101static int inet6_addr_del(struct net *net, int ifindex, struct in6_addr *pfx,
2079 int plen) 2102 unsigned int plen)
2080{ 2103{
2081 struct inet6_ifaddr *ifp; 2104 struct inet6_ifaddr *ifp;
2082 struct inet6_dev *idev; 2105 struct inet6_dev *idev;
2083 struct net_device *dev; 2106 struct net_device *dev;
2084 2107
2108 if (plen > 128)
2109 return -EINVAL;
2110
2085 dev = __dev_get_by_index(net, ifindex); 2111 dev = __dev_get_by_index(net, ifindex);
2086 if (!dev) 2112 if (!dev)
2087 return -ENODEV; 2113 return -ENODEV;
@@ -3148,22 +3174,30 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
3148static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, 3174static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
3149 u32 prefered_lft, u32 valid_lft) 3175 u32 prefered_lft, u32 valid_lft)
3150{ 3176{
3151 u32 flags = RTF_EXPIRES; 3177 u32 flags;
3178 clock_t expires;
3179 unsigned long timeout;
3152 3180
3153 if (!valid_lft || (prefered_lft > valid_lft)) 3181 if (!valid_lft || (prefered_lft > valid_lft))
3154 return -EINVAL; 3182 return -EINVAL;
3155 3183
3156 if (valid_lft == INFINITY_LIFE_TIME) { 3184 timeout = addrconf_timeout_fixup(valid_lft, HZ);
3157 ifa_flags |= IFA_F_PERMANENT; 3185 if (addrconf_finite_timeout(timeout)) {
3186 expires = jiffies_to_clock_t(timeout * HZ);
3187 valid_lft = timeout;
3188 flags = RTF_EXPIRES;
3189 } else {
3190 expires = 0;
3158 flags = 0; 3191 flags = 0;
3159 } else if (valid_lft >= 0x7FFFFFFF/HZ) 3192 ifa_flags |= IFA_F_PERMANENT;
3160 valid_lft = 0x7FFFFFFF/HZ; 3193 }
3161 3194
3162 if (prefered_lft == 0) 3195 timeout = addrconf_timeout_fixup(prefered_lft, HZ);
3163 ifa_flags |= IFA_F_DEPRECATED; 3196 if (addrconf_finite_timeout(timeout)) {
3164 else if ((prefered_lft >= 0x7FFFFFFF/HZ) && 3197 if (timeout == 0)
3165 (prefered_lft != INFINITY_LIFE_TIME)) 3198 ifa_flags |= IFA_F_DEPRECATED;
3166 prefered_lft = 0x7FFFFFFF/HZ; 3199 prefered_lft = timeout;
3200 }
3167 3201
3168 spin_lock_bh(&ifp->lock); 3202 spin_lock_bh(&ifp->lock);
3169 ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags; 3203 ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags;
@@ -3176,7 +3210,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
3176 ipv6_ifa_notify(0, ifp); 3210 ipv6_ifa_notify(0, ifp);
3177 3211
3178 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev, 3212 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev,
3179 jiffies_to_clock_t(valid_lft * HZ), flags); 3213 expires, flags);
3180 addrconf_verify(0); 3214 addrconf_verify(0);
3181 3215
3182 return 0; 3216 return 0;
@@ -4242,7 +4276,7 @@ static void addrconf_sysctl_register(struct inet6_dev *idev)
4242 neigh_sysctl_register(idev->dev, idev->nd_parms, NET_IPV6, 4276 neigh_sysctl_register(idev->dev, idev->nd_parms, NET_IPV6,
4243 NET_IPV6_NEIGH, "ipv6", 4277 NET_IPV6_NEIGH, "ipv6",
4244 &ndisc_ifinfo_sysctl_change, 4278 &ndisc_ifinfo_sysctl_change,
4245 NULL); 4279 ndisc_ifinfo_sysctl_strategy);
4246 __addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name, 4280 __addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name,
4247 idev->dev->ifindex, idev, &idev->cnf); 4281 idev->dev->ifindex, idev, &idev->cnf);
4248} 4282}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 3c6aafb02183..e84b3fd17fb4 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -191,7 +191,7 @@ lookup_protocol:
191 np->mcast_hops = -1; 191 np->mcast_hops = -1;
192 np->mc_loop = 1; 192 np->mc_loop = 1;
193 np->pmtudisc = IPV6_PMTUDISC_WANT; 193 np->pmtudisc = IPV6_PMTUDISC_WANT;
194 np->ipv6only = init_net.ipv6.sysctl.bindv6only; 194 np->ipv6only = net->ipv6.sysctl.bindv6only;
195 195
196 /* Init the ipv4 part of the socket since we can have sockets 196 /* Init the ipv4 part of the socket since we can have sockets
197 * using v6 API for ipv4. 197 * using v6 API for ipv4.
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 94fa6ae77cfe..0f0f94a40335 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -496,7 +496,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
496 return 0; 496 return 0;
497} 497}
498 498
499int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, 499int datagram_send_ctl(struct net *net,
500 struct msghdr *msg, struct flowi *fl,
500 struct ipv6_txoptions *opt, 501 struct ipv6_txoptions *opt,
501 int *hlimit, int *tclass) 502 int *hlimit, int *tclass)
502{ 503{
@@ -509,7 +510,6 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
509 510
510 for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { 511 for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
511 int addr_type; 512 int addr_type;
512 struct net_device *dev = NULL;
513 513
514 if (!CMSG_OK(msg, cmsg)) { 514 if (!CMSG_OK(msg, cmsg)) {
515 err = -EINVAL; 515 err = -EINVAL;
@@ -522,6 +522,9 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
522 switch (cmsg->cmsg_type) { 522 switch (cmsg->cmsg_type) {
523 case IPV6_PKTINFO: 523 case IPV6_PKTINFO:
524 case IPV6_2292PKTINFO: 524 case IPV6_2292PKTINFO:
525 {
526 struct net_device *dev = NULL;
527
525 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) { 528 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) {
526 err = -EINVAL; 529 err = -EINVAL;
527 goto exit_f; 530 goto exit_f;
@@ -535,32 +538,32 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
535 fl->oif = src_info->ipi6_ifindex; 538 fl->oif = src_info->ipi6_ifindex;
536 } 539 }
537 540
538 addr_type = ipv6_addr_type(&src_info->ipi6_addr); 541 addr_type = __ipv6_addr_type(&src_info->ipi6_addr);
539 542
540 if (addr_type == IPV6_ADDR_ANY) 543 if (fl->oif) {
541 break; 544 dev = dev_get_by_index(net, fl->oif);
545 if (!dev)
546 return -ENODEV;
547 } else if (addr_type & IPV6_ADDR_LINKLOCAL)
548 return -EINVAL;
542 549
543 if (addr_type & IPV6_ADDR_LINKLOCAL) { 550 if (addr_type != IPV6_ADDR_ANY) {
544 if (!src_info->ipi6_ifindex) 551 int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
545 return -EINVAL; 552 if (!ipv6_chk_addr(net, &src_info->ipi6_addr,
546 else { 553 strict ? dev : NULL, 0))
547 dev = dev_get_by_index(&init_net, src_info->ipi6_ifindex); 554 err = -EINVAL;
548 if (!dev) 555 else
549 return -ENODEV; 556 ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr);
550 }
551 }
552 if (!ipv6_chk_addr(&init_net, &src_info->ipi6_addr,
553 dev, 0)) {
554 if (dev)
555 dev_put(dev);
556 err = -EINVAL;
557 goto exit_f;
558 } 557 }
558
559 if (dev) 559 if (dev)
560 dev_put(dev); 560 dev_put(dev);
561 561
562 ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr); 562 if (err)
563 goto exit_f;
564
563 break; 565 break;
566 }
564 567
565 case IPV6_FLOWINFO: 568 case IPV6_FLOWINFO:
566 if (cmsg->cmsg_len < CMSG_LEN(4)) { 569 if (cmsg->cmsg_len < CMSG_LEN(4)) {
@@ -702,6 +705,11 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
702 } 705 }
703 706
704 *hlimit = *(int *)CMSG_DATA(cmsg); 707 *hlimit = *(int *)CMSG_DATA(cmsg);
708 if (*hlimit < -1 || *hlimit > 0xff) {
709 err = -EINVAL;
710 goto exit_f;
711 }
712
705 break; 713 break;
706 714
707 case IPV6_TCLASS: 715 case IPV6_TCLASS:
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index eb7a940310f4..37a4e777e347 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -354,7 +354,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
354 msg.msg_control = (void*)(fl->opt+1); 354 msg.msg_control = (void*)(fl->opt+1);
355 flowi.oif = 0; 355 flowi.oif = 0;
356 356
357 err = datagram_send_ctl(&msg, &flowi, fl->opt, &junk, &junk); 357 err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk, &junk);
358 if (err) 358 if (err)
359 goto done; 359 goto done;
360 err = -EINVAL; 360 err = -EINVAL;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 0af2e055f883..48cdce9c696c 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -780,7 +780,7 @@ slow_path:
780 * Allocate buffer. 780 * Allocate buffer.
781 */ 781 */
782 782
783 if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { 783 if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
784 NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); 784 NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
785 IP6_INC_STATS(ip6_dst_idev(skb->dst), 785 IP6_INC_STATS(ip6_dst_idev(skb->dst),
786 IPSTATS_MIB_FRAGFAILS); 786 IPSTATS_MIB_FRAGFAILS);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 2de3c464fe75..14796181e8b5 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -197,7 +197,7 @@ static int ip6mr_vif_seq_show(struct seq_file *seq, void *v)
197 const char *name = vif->dev ? vif->dev->name : "none"; 197 const char *name = vif->dev ? vif->dev->name : "none";
198 198
199 seq_printf(seq, 199 seq_printf(seq,
200 "%2Zd %-10s %8ld %7ld %8ld %7ld %05X\n", 200 "%2td %-10s %8ld %7ld %8ld %7ld %05X\n",
201 vif - vif6_table, 201 vif - vif6_table,
202 name, vif->bytes_in, vif->pkt_in, 202 name, vif->bytes_in, vif->pkt_in,
203 vif->bytes_out, vif->pkt_out, 203 vif->bytes_out, vif->pkt_out,
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 56d55fecf8ec..c042ce19bd14 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -67,7 +67,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *))
67 67
68 /* RA packet may be delivered ONLY to IPPROTO_RAW socket */ 68 /* RA packet may be delivered ONLY to IPPROTO_RAW socket */
69 if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW) 69 if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW)
70 return -EINVAL; 70 return -ENOPROTOOPT;
71 71
72 new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; 72 new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL;
73 73
@@ -161,9 +161,17 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
161 struct ipv6_txoptions *opt; 161 struct ipv6_txoptions *opt;
162 struct sk_buff *pktopt; 162 struct sk_buff *pktopt;
163 163
164 if (sk->sk_protocol != IPPROTO_UDP && 164 if (sk->sk_type == SOCK_RAW)
165 sk->sk_protocol != IPPROTO_UDPLITE && 165 break;
166 sk->sk_protocol != IPPROTO_TCP) 166
167 if (sk->sk_protocol == IPPROTO_UDP ||
168 sk->sk_protocol == IPPROTO_UDPLITE) {
169 struct udp_sock *up = udp_sk(sk);
170 if (up->pending == AF_INET6) {
171 retv = -EBUSY;
172 break;
173 }
174 } else if (sk->sk_protocol != IPPROTO_TCP)
167 break; 175 break;
168 176
169 if (sk->sk_state != TCP_ESTABLISHED) { 177 if (sk->sk_state != TCP_ESTABLISHED) {
@@ -416,7 +424,7 @@ sticky_done:
416 msg.msg_controllen = optlen; 424 msg.msg_controllen = optlen;
417 msg.msg_control = (void*)(opt+1); 425 msg.msg_control = (void*)(opt+1);
418 426
419 retv = datagram_send_ctl(&msg, &fl, opt, &junk, &junk); 427 retv = datagram_send_ctl(net, &msg, &fl, opt, &junk, &junk);
420 if (retv) 428 if (retv)
421 goto done; 429 goto done;
422update: 430update:
@@ -438,7 +446,7 @@ done:
438 446
439 case IPV6_MULTICAST_HOPS: 447 case IPV6_MULTICAST_HOPS:
440 if (sk->sk_type == SOCK_STREAM) 448 if (sk->sk_type == SOCK_STREAM)
441 goto e_inval; 449 break;
442 if (optlen < sizeof(int)) 450 if (optlen < sizeof(int))
443 goto e_inval; 451 goto e_inval;
444 if (val > 255 || val < -1) 452 if (val > 255 || val < -1)
@@ -450,13 +458,15 @@ done:
450 case IPV6_MULTICAST_LOOP: 458 case IPV6_MULTICAST_LOOP:
451 if (optlen < sizeof(int)) 459 if (optlen < sizeof(int))
452 goto e_inval; 460 goto e_inval;
461 if (val != valbool)
462 goto e_inval;
453 np->mc_loop = valbool; 463 np->mc_loop = valbool;
454 retv = 0; 464 retv = 0;
455 break; 465 break;
456 466
457 case IPV6_MULTICAST_IF: 467 case IPV6_MULTICAST_IF:
458 if (sk->sk_type == SOCK_STREAM) 468 if (sk->sk_type == SOCK_STREAM)
459 goto e_inval; 469 break;
460 if (optlen < sizeof(int)) 470 if (optlen < sizeof(int))
461 goto e_inval; 471 goto e_inval;
462 472
@@ -832,7 +842,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
832 len = min_t(unsigned int, len, ipv6_optlen(hdr)); 842 len = min_t(unsigned int, len, ipv6_optlen(hdr));
833 if (copy_to_user(optval, hdr, len)) 843 if (copy_to_user(optval, hdr, len))
834 return -EFAULT; 844 return -EFAULT;
835 return ipv6_optlen(hdr); 845 return len;
836} 846}
837 847
838static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, 848static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
@@ -852,7 +862,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
852 if (sk->sk_protocol != IPPROTO_UDP && 862 if (sk->sk_protocol != IPPROTO_UDP &&
853 sk->sk_protocol != IPPROTO_UDPLITE && 863 sk->sk_protocol != IPPROTO_UDPLITE &&
854 sk->sk_protocol != IPPROTO_TCP) 864 sk->sk_protocol != IPPROTO_TCP)
855 return -EINVAL; 865 return -ENOPROTOOPT;
856 if (sk->sk_state != TCP_ESTABLISHED) 866 if (sk->sk_state != TCP_ESTABLISHED)
857 return -ENOTCONN; 867 return -ENOTCONN;
858 val = sk->sk_family; 868 val = sk->sk_family;
@@ -866,6 +876,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
866 return -EINVAL; 876 return -EINVAL;
867 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) 877 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0)))
868 return -EFAULT; 878 return -EFAULT;
879 if (gsf.gf_group.ss_family != AF_INET6)
880 return -EADDRNOTAVAIL;
869 lock_sock(sk); 881 lock_sock(sk);
870 err = ip6_mc_msfget(sk, &gsf, 882 err = ip6_mc_msfget(sk, &gsf,
871 (struct group_filter __user *)optval, optlen); 883 (struct group_filter __user *)optval, optlen);
@@ -975,6 +987,9 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
975 len = ipv6_getsockopt_sticky(sk, np->opt, 987 len = ipv6_getsockopt_sticky(sk, np->opt,
976 optname, optval, len); 988 optname, optval, len);
977 release_sock(sk); 989 release_sock(sk);
990 /* check if ipv6_getsockopt_sticky() returns err code */
991 if (len < 0)
992 return len;
978 return put_user(len, optlen); 993 return put_user(len, optlen);
979 } 994 }
980 995
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 54f91efdae58..fd632dd7f98d 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1411,7 +1411,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1411 IPV6_TLV_PADN, 0 }; 1411 IPV6_TLV_PADN, 0 };
1412 1412
1413 /* we assume size > sizeof(ra) here */ 1413 /* we assume size > sizeof(ra) here */
1414 skb = sock_alloc_send_skb(sk, size + LL_RESERVED_SPACE(dev), 1, &err); 1414 skb = sock_alloc_send_skb(sk, size + LL_ALLOCATED_SPACE(dev), 1, &err);
1415 1415
1416 if (!skb) 1416 if (!skb)
1417 return NULL; 1417 return NULL;
@@ -1790,7 +1790,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1790 payload_len = len + sizeof(ra); 1790 payload_len = len + sizeof(ra);
1791 full_len = sizeof(struct ipv6hdr) + payload_len; 1791 full_len = sizeof(struct ipv6hdr) + payload_len;
1792 1792
1793 skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err); 1793 skb = sock_alloc_send_skb(sk, LL_ALLOCATED_SPACE(dev) + full_len, 1, &err);
1794 1794
1795 if (skb == NULL) { 1795 if (skb == NULL) {
1796 rcu_read_lock(); 1796 rcu_read_lock();
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 2c74885f8355..282fdb31f8ed 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -479,7 +479,7 @@ static void __ndisc_send(struct net_device *dev,
479 479
480 skb = sock_alloc_send_skb(sk, 480 skb = sock_alloc_send_skb(sk,
481 (MAX_HEADER + sizeof(struct ipv6hdr) + 481 (MAX_HEADER + sizeof(struct ipv6hdr) +
482 len + LL_RESERVED_SPACE(dev)), 482 len + LL_ALLOCATED_SPACE(dev)),
483 1, &err); 483 1, &err);
484 if (!skb) { 484 if (!skb) {
485 ND_PRINTK0(KERN_ERR 485 ND_PRINTK0(KERN_ERR
@@ -1521,7 +1521,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1521 1521
1522 buff = sock_alloc_send_skb(sk, 1522 buff = sock_alloc_send_skb(sk,
1523 (MAX_HEADER + sizeof(struct ipv6hdr) + 1523 (MAX_HEADER + sizeof(struct ipv6hdr) +
1524 len + LL_RESERVED_SPACE(dev)), 1524 len + LL_ALLOCATED_SPACE(dev)),
1525 1, &err); 1525 1, &err);
1526 if (buff == NULL) { 1526 if (buff == NULL) {
1527 ND_PRINTK0(KERN_ERR 1527 ND_PRINTK0(KERN_ERR
@@ -1727,10 +1727,10 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
1727 return ret; 1727 return ret;
1728} 1728}
1729 1729
1730static int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, 1730int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,
1731 int nlen, void __user *oldval, 1731 int nlen, void __user *oldval,
1732 size_t __user *oldlenp, 1732 size_t __user *oldlenp,
1733 void __user *newval, size_t newlen) 1733 void __user *newval, size_t newlen)
1734{ 1734{
1735 struct net_device *dev = ctl->extra1; 1735 struct net_device *dev = ctl->extra1;
1736 struct inet6_dev *idev; 1736 struct inet6_dev *idev;
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 2dccad48058c..e65e26e210ee 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -209,7 +209,9 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
209 arg.dst = dst; 209 arg.dst = dst;
210 hash = ip6qhashfn(id, src, dst); 210 hash = ip6qhashfn(id, src, dst);
211 211
212 local_bh_disable();
212 q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash); 213 q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash);
214 local_bh_enable();
213 if (q == NULL) 215 if (q == NULL)
214 goto oom; 216 goto oom;
215 217
@@ -638,10 +640,10 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
638 goto ret_orig; 640 goto ret_orig;
639 } 641 }
640 642
641 spin_lock(&fq->q.lock); 643 spin_lock_bh(&fq->q.lock);
642 644
643 if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) { 645 if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) {
644 spin_unlock(&fq->q.lock); 646 spin_unlock_bh(&fq->q.lock);
645 pr_debug("Can't insert skb to queue\n"); 647 pr_debug("Can't insert skb to queue\n");
646 fq_put(fq); 648 fq_put(fq);
647 goto ret_orig; 649 goto ret_orig;
@@ -653,7 +655,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
653 if (ret_skb == NULL) 655 if (ret_skb == NULL)
654 pr_debug("Can't reassemble fragmented packets\n"); 656 pr_debug("Can't reassemble fragmented packets\n");
655 } 657 }
656 spin_unlock(&fq->q.lock); 658 spin_unlock_bh(&fq->q.lock);
657 659
658 fq_put(fq); 660 fq_put(fq);
659 return ret_skb; 661 return ret_skb;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 396f0ea11090..3aee12310d94 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -609,7 +609,6 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
609 struct ipv6_pinfo *np = inet6_sk(sk); 609 struct ipv6_pinfo *np = inet6_sk(sk);
610 struct ipv6hdr *iph; 610 struct ipv6hdr *iph;
611 struct sk_buff *skb; 611 struct sk_buff *skb;
612 unsigned int hh_len;
613 int err; 612 int err;
614 613
615 if (length > rt->u.dst.dev->mtu) { 614 if (length > rt->u.dst.dev->mtu) {
@@ -619,13 +618,12 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
619 if (flags&MSG_PROBE) 618 if (flags&MSG_PROBE)
620 goto out; 619 goto out;
621 620
622 hh_len = LL_RESERVED_SPACE(rt->u.dst.dev); 621 skb = sock_alloc_send_skb(sk,
623 622 length + LL_ALLOCATED_SPACE(rt->u.dst.dev) + 15,
624 skb = sock_alloc_send_skb(sk, length+hh_len+15, 623 flags & MSG_DONTWAIT, &err);
625 flags&MSG_DONTWAIT, &err);
626 if (skb == NULL) 624 if (skb == NULL)
627 goto error; 625 goto error;
628 skb_reserve(skb, hh_len); 626 skb_reserve(skb, LL_RESERVED_SPACE(rt->u.dst.dev));
629 627
630 skb->priority = sk->sk_priority; 628 skb->priority = sk->sk_priority;
631 skb->mark = sk->sk_mark; 629 skb->mark = sk->sk_mark;
@@ -815,7 +813,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
815 memset(opt, 0, sizeof(struct ipv6_txoptions)); 813 memset(opt, 0, sizeof(struct ipv6_txoptions));
816 opt->tot_len = sizeof(struct ipv6_txoptions); 814 opt->tot_len = sizeof(struct ipv6_txoptions);
817 815
818 err = datagram_send_ctl(msg, &fl, opt, &hlimit, &tclass); 816 err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, &tclass);
819 if (err < 0) { 817 if (err < 0) {
820 fl6_sock_release(flowlabel); 818 fl6_sock_release(flowlabel);
821 return err; 819 return err;
@@ -1166,6 +1164,15 @@ static void rawv6_close(struct sock *sk, long timeout)
1166 sk_common_release(sk); 1164 sk_common_release(sk);
1167} 1165}
1168 1166
1167static int raw6_destroy(struct sock *sk)
1168{
1169 lock_sock(sk);
1170 ip6_flush_pending_frames(sk);
1171 release_sock(sk);
1172
1173 return inet6_destroy_sock(sk);
1174}
1175
1169static int rawv6_init_sk(struct sock *sk) 1176static int rawv6_init_sk(struct sock *sk)
1170{ 1177{
1171 struct raw6_sock *rp = raw6_sk(sk); 1178 struct raw6_sock *rp = raw6_sk(sk);
@@ -1189,11 +1196,11 @@ struct proto rawv6_prot = {
1189 .name = "RAWv6", 1196 .name = "RAWv6",
1190 .owner = THIS_MODULE, 1197 .owner = THIS_MODULE,
1191 .close = rawv6_close, 1198 .close = rawv6_close,
1199 .destroy = raw6_destroy,
1192 .connect = ip6_datagram_connect, 1200 .connect = ip6_datagram_connect,
1193 .disconnect = udp_disconnect, 1201 .disconnect = udp_disconnect,
1194 .ioctl = rawv6_ioctl, 1202 .ioctl = rawv6_ioctl,
1195 .init = rawv6_init_sk, 1203 .init = rawv6_init_sk,
1196 .destroy = inet6_destroy_sock,
1197 .setsockopt = rawv6_setsockopt, 1204 .setsockopt = rawv6_setsockopt,
1198 .getsockopt = rawv6_getsockopt, 1205 .getsockopt = rawv6_getsockopt,
1199 .sendmsg = rawv6_sendmsg, 1206 .sendmsg = rawv6_sendmsg,
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 12bba0880345..d1f3e19b06c7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -109,7 +109,7 @@ static struct dst_ops ip6_dst_ops_template = {
109 .negative_advice = ip6_negative_advice, 109 .negative_advice = ip6_negative_advice,
110 .link_failure = ip6_link_failure, 110 .link_failure = ip6_link_failure,
111 .update_pmtu = ip6_rt_update_pmtu, 111 .update_pmtu = ip6_rt_update_pmtu,
112 .local_out = ip6_local_out, 112 .local_out = __ip6_local_out,
113 .entry_size = sizeof(struct rt6_info), 113 .entry_size = sizeof(struct rt6_info),
114 .entries = ATOMIC_INIT(0), 114 .entries = ATOMIC_INIT(0),
115}; 115};
@@ -446,7 +446,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
446 struct route_info *rinfo = (struct route_info *) opt; 446 struct route_info *rinfo = (struct route_info *) opt;
447 struct in6_addr prefix_buf, *prefix; 447 struct in6_addr prefix_buf, *prefix;
448 unsigned int pref; 448 unsigned int pref;
449 u32 lifetime; 449 unsigned long lifetime;
450 struct rt6_info *rt; 450 struct rt6_info *rt;
451 451
452 if (len < sizeof(struct route_info)) { 452 if (len < sizeof(struct route_info)) {
@@ -472,13 +472,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
472 if (pref == ICMPV6_ROUTER_PREF_INVALID) 472 if (pref == ICMPV6_ROUTER_PREF_INVALID)
473 pref = ICMPV6_ROUTER_PREF_MEDIUM; 473 pref = ICMPV6_ROUTER_PREF_MEDIUM;
474 474
475 lifetime = ntohl(rinfo->lifetime); 475 lifetime = addrconf_timeout_fixup(ntohl(rinfo->lifetime), HZ);
476 if (lifetime == 0xffffffff) {
477 /* infinity */
478 } else if (lifetime > 0x7fffffff/HZ) {
479 /* Avoid arithmetic overflow */
480 lifetime = 0x7fffffff/HZ - 1;
481 }
482 476
483 if (rinfo->length == 3) 477 if (rinfo->length == 3)
484 prefix = (struct in6_addr *)rinfo->prefix; 478 prefix = (struct in6_addr *)rinfo->prefix;
@@ -506,7 +500,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
506 (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); 500 (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
507 501
508 if (rt) { 502 if (rt) {
509 if (lifetime == 0xffffffff) { 503 if (!addrconf_finite_timeout(lifetime)) {
510 rt->rt6i_flags &= ~RTF_EXPIRES; 504 rt->rt6i_flags &= ~RTF_EXPIRES;
511 } else { 505 } else {
512 rt->rt6i_expires = jiffies + HZ * lifetime; 506 rt->rt6i_expires = jiffies + HZ * lifetime;
@@ -1106,7 +1100,9 @@ int ip6_route_add(struct fib6_config *cfg)
1106 } 1100 }
1107 1101
1108 rt->u.dst.obsolete = -1; 1102 rt->u.dst.obsolete = -1;
1109 rt->rt6i_expires = jiffies + clock_t_to_jiffies(cfg->fc_expires); 1103 rt->rt6i_expires = (cfg->fc_flags & RTF_EXPIRES) ?
1104 jiffies + clock_t_to_jiffies(cfg->fc_expires) :
1105 0;
1110 1106
1111 if (cfg->fc_protocol == RTPROT_UNSPEC) 1107 if (cfg->fc_protocol == RTPROT_UNSPEC)
1112 cfg->fc_protocol = RTPROT_BOOT; 1108 cfg->fc_protocol = RTPROT_BOOT;
@@ -2200,7 +2196,13 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2200 2196
2201 NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); 2197 NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric);
2202 2198
2203 expires = rt->rt6i_expires ? rt->rt6i_expires - jiffies : 0; 2199 if (!(rt->rt6i_flags & RTF_EXPIRES))
2200 expires = 0;
2201 else if (rt->rt6i_expires - jiffies < INT_MAX)
2202 expires = rt->rt6i_expires - jiffies;
2203 else
2204 expires = INT_MAX;
2205
2204 if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, 2206 if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0,
2205 expires, rt->u.dst.error) < 0) 2207 expires, rt->u.dst.error) < 0)
2206 goto nla_put_failure; 2208 goto nla_put_failure;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 5a6fab95569f..3de6ffdaedf2 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -403,9 +403,8 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
403 403
404static int ipip6_err(struct sk_buff *skb, u32 info) 404static int ipip6_err(struct sk_buff *skb, u32 info)
405{ 405{
406#ifndef I_WISH_WORLD_WERE_PERFECT
407 406
408/* It is not :-( All the routers (except for Linux) return only 407/* All the routers (except for Linux) return only
409 8 bytes of packet payload. It means, that precise relaying of 408 8 bytes of packet payload. It means, that precise relaying of
410 ICMP in the real Internet is absolutely infeasible. 409 ICMP in the real Internet is absolutely infeasible.
411 */ 410 */
@@ -462,92 +461,6 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
462out: 461out:
463 read_unlock(&ipip6_lock); 462 read_unlock(&ipip6_lock);
464 return err; 463 return err;
465#else
466 struct iphdr *iph = (struct iphdr*)dp;
467 int hlen = iph->ihl<<2;
468 struct ipv6hdr *iph6;
469 const int type = icmp_hdr(skb)->type;
470 const int code = icmp_hdr(skb)->code;
471 int rel_type = 0;
472 int rel_code = 0;
473 int rel_info = 0;
474 struct sk_buff *skb2;
475 struct rt6_info *rt6i;
476
477 if (len < hlen + sizeof(struct ipv6hdr))
478 return;
479 iph6 = (struct ipv6hdr*)(dp + hlen);
480
481 switch (type) {
482 default:
483 return;
484 case ICMP_PARAMETERPROB:
485 if (icmp_hdr(skb)->un.gateway < hlen)
486 return;
487
488 /* So... This guy found something strange INSIDE encapsulated
489 packet. Well, he is fool, but what can we do ?
490 */
491 rel_type = ICMPV6_PARAMPROB;
492 rel_info = icmp_hdr(skb)->un.gateway - hlen;
493 break;
494
495 case ICMP_DEST_UNREACH:
496 switch (code) {
497 case ICMP_SR_FAILED:
498 case ICMP_PORT_UNREACH:
499 /* Impossible event. */
500 return;
501 case ICMP_FRAG_NEEDED:
502 /* Too complicated case ... */
503 return;
504 default:
505 /* All others are translated to HOST_UNREACH.
506 rfc2003 contains "deep thoughts" about NET_UNREACH,
507 I believe, it is just ether pollution. --ANK
508 */
509 rel_type = ICMPV6_DEST_UNREACH;
510 rel_code = ICMPV6_ADDR_UNREACH;
511 break;
512 }
513 break;
514 case ICMP_TIME_EXCEEDED:
515 if (code != ICMP_EXC_TTL)
516 return;
517 rel_type = ICMPV6_TIME_EXCEED;
518 rel_code = ICMPV6_EXC_HOPLIMIT;
519 break;
520 }
521
522 /* Prepare fake skb to feed it to icmpv6_send */
523 skb2 = skb_clone(skb, GFP_ATOMIC);
524 if (skb2 == NULL)
525 return 0;
526 dst_release(skb2->dst);
527 skb2->dst = NULL;
528 skb_pull(skb2, skb->data - (u8*)iph6);
529 skb_reset_network_header(skb2);
530
531 /* Try to guess incoming interface */
532 rt6i = rt6_lookup(dev_net(skb->dev), &iph6->saddr, NULL, NULL, 0);
533 if (rt6i && rt6i->rt6i_dev) {
534 skb2->dev = rt6i->rt6i_dev;
535
536 rt6i = rt6_lookup(dev_net(skb->dev),
537 &iph6->daddr, &iph6->saddr, NULL, 0);
538
539 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) {
540 struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev);
541 if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) {
542 rel_type = ICMPV6_DEST_UNREACH;
543 rel_code = ICMPV6_ADDR_UNREACH;
544 }
545 icmpv6_send(skb2, rel_type, rel_code, rel_info, skb2->dev);
546 }
547 }
548 kfree_skb(skb2);
549 return 0;
550#endif
551} 464}
552 465
553static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) 466static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 938ce4ecde55..3ecc1157994e 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -198,7 +198,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
198 ireq = inet_rsk(req); 198 ireq = inet_rsk(req);
199 ireq6 = inet6_rsk(req); 199 ireq6 = inet6_rsk(req);
200 treq = tcp_rsk(req); 200 treq = tcp_rsk(req);
201 ireq6->pktopts = NULL;
202 201
203 if (security_inet_conn_request(sk, skb, req)) { 202 if (security_inet_conn_request(sk, skb, req)) {
204 reqsk_free(req); 203 reqsk_free(req);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 715965f0fac0..cb46749d4c32 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1299,7 +1299,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1299 treq = inet6_rsk(req); 1299 treq = inet6_rsk(req);
1300 ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr); 1300 ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr);
1301 ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr); 1301 ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr);
1302 treq->pktopts = NULL;
1303 if (!want_cookie) 1302 if (!want_cookie)
1304 TCP_ECN_create_request(req, tcp_hdr(skb)); 1303 TCP_ECN_create_request(req, tcp_hdr(skb));
1305 1304
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c
index 6323921b40be..669f280989c3 100644
--- a/net/ipv6/tunnel6.c
+++ b/net/ipv6/tunnel6.c
@@ -109,7 +109,7 @@ static int tunnel46_rcv(struct sk_buff *skb)
109{ 109{
110 struct xfrm6_tunnel *handler; 110 struct xfrm6_tunnel *handler;
111 111
112 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 112 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
113 goto drop; 113 goto drop;
114 114
115 for (handler = tunnel46_handlers; handler; handler = handler->next) 115 for (handler = tunnel46_handlers; handler; handler = handler->next)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 1fd784f3e2ec..dd309626ae9a 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -534,7 +534,9 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
534{ 534{
535 struct udp_sock *up = udp_sk(sk); 535 struct udp_sock *up = udp_sk(sk);
536 536
537 if (up->pending) { 537 if (up->pending == AF_INET)
538 udp_flush_pending_frames(sk);
539 else if (up->pending) {
538 up->len = 0; 540 up->len = 0;
539 up->pending = 0; 541 up->pending = 0;
540 ip6_flush_pending_frames(sk); 542 ip6_flush_pending_frames(sk);
@@ -731,7 +733,7 @@ do_udp_sendmsg:
731 memset(opt, 0, sizeof(struct ipv6_txoptions)); 733 memset(opt, 0, sizeof(struct ipv6_txoptions));
732 opt->tot_len = sizeof(*opt); 734 opt->tot_len = sizeof(*opt);
733 735
734 err = datagram_send_ctl(msg, &fl, opt, &hlimit, &tclass); 736 err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, &tclass);
735 if (err < 0) { 737 if (err < 0) {
736 fl6_sock_release(flowlabel); 738 fl6_sock_release(flowlabel);
737 return err; 739 return err;
@@ -848,12 +850,14 @@ do_append_data:
848 } else { 850 } else {
849 dst_release(dst); 851 dst_release(dst);
850 } 852 }
853 dst = NULL;
851 } 854 }
852 855
853 if (err > 0) 856 if (err > 0)
854 err = np->recverr ? net_xmit_errno(err) : 0; 857 err = np->recverr ? net_xmit_errno(err) : 0;
855 release_sock(sk); 858 release_sock(sk);
856out: 859out:
860 dst_release(dst);
857 fl6_sock_release(flowlabel); 861 fl6_sock_release(flowlabel);
858 if (!err) 862 if (!err)
859 return len; 863 return len;
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index ae54b20d0470..3eb5bcc75f99 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1093,11 +1093,6 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
1093 1093
1094 init_waitqueue_head(&self->query_wait); 1094 init_waitqueue_head(&self->query_wait);
1095 1095
1096 /* Initialise networking socket struct */
1097 sock_init_data(sock, sk); /* Note : set sk->sk_refcnt to 1 */
1098 sk->sk_family = PF_IRDA;
1099 sk->sk_protocol = protocol;
1100
1101 switch (sock->type) { 1096 switch (sock->type) {
1102 case SOCK_STREAM: 1097 case SOCK_STREAM:
1103 sock->ops = &irda_stream_ops; 1098 sock->ops = &irda_stream_ops;
@@ -1124,13 +1119,20 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
1124 self->max_sdu_size_rx = TTP_SAR_UNBOUND; 1119 self->max_sdu_size_rx = TTP_SAR_UNBOUND;
1125 break; 1120 break;
1126 default: 1121 default:
1122 sk_free(sk);
1127 return -ESOCKTNOSUPPORT; 1123 return -ESOCKTNOSUPPORT;
1128 } 1124 }
1129 break; 1125 break;
1130 default: 1126 default:
1127 sk_free(sk);
1131 return -ESOCKTNOSUPPORT; 1128 return -ESOCKTNOSUPPORT;
1132 } 1129 }
1133 1130
1131 /* Initialise networking socket struct */
1132 sock_init_data(sock, sk); /* Note : set sk->sk_refcnt to 1 */
1133 sk->sk_family = PF_IRDA;
1134 sk->sk_protocol = protocol;
1135
1134 /* Register as a client with IrLMP */ 1136 /* Register as a client with IrLMP */
1135 self->ckey = irlmp_register_client(0, NULL, NULL, NULL); 1137 self->ckey = irlmp_register_client(0, NULL, NULL, NULL);
1136 self->mask.word = 0xffff; 1138 self->mask.word = 0xffff;
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index bfacef8b76f4..a6f99b5a1499 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -40,6 +40,8 @@
40 40
41#include <net/irda/discovery.h> 41#include <net/irda/discovery.h>
42 42
43#include <asm/unaligned.h>
44
43/* 45/*
44 * Function irlmp_add_discovery (cachelog, discovery) 46 * Function irlmp_add_discovery (cachelog, discovery)
45 * 47 *
@@ -87,7 +89,7 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new)
87 */ 89 */
88 hashbin_remove_this(cachelog, (irda_queue_t *) node); 90 hashbin_remove_this(cachelog, (irda_queue_t *) node);
89 /* Check if hints bits are unchanged */ 91 /* Check if hints bits are unchanged */
90 if(u16ho(node->data.hints) == u16ho(new->data.hints)) 92 if (get_unaligned((__u16 *)node->data.hints) == get_unaligned((__u16 *)new->data.hints))
91 /* Set time of first discovery for this node */ 93 /* Set time of first discovery for this node */
92 new->firststamp = node->firststamp; 94 new->firststamp = node->firststamp;
93 kfree(node); 95 kfree(node);
@@ -281,9 +283,9 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn,
281 /* Mask out the ones we don't want : 283 /* Mask out the ones we don't want :
282 * We want to match the discovery mask, and to get only 284 * We want to match the discovery mask, and to get only
283 * the most recent one (unless we want old ones) */ 285 * the most recent one (unless we want old ones) */
284 if ((u16ho(discovery->data.hints) & mask) && 286 if ((get_unaligned((__u16 *)discovery->data.hints) & mask) &&
285 ((old_entries) || 287 ((old_entries) ||
286 ((jiffies - discovery->firststamp) < j_timeout)) ) { 288 ((jiffies - discovery->firststamp) < j_timeout))) {
287 /* Create buffer as needed. 289 /* Create buffer as needed.
288 * As this function get called a lot and most time 290 * As this function get called a lot and most time
289 * we don't have anything to put in the log (we are 291 * we don't have anything to put in the log (we are
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 1f81f8e7c61d..7bf5b913828b 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -1062,7 +1062,8 @@ void irlmp_discovery_expiry(discinfo_t *expiries, int number)
1062 for(i = 0; i < number; i++) { 1062 for(i = 0; i < number; i++) {
1063 /* Check if we should notify client */ 1063 /* Check if we should notify client */
1064 if ((client->expir_callback) && 1064 if ((client->expir_callback) &&
1065 (client->hint_mask.word & u16ho(expiries[i].hints) 1065 (client->hint_mask.word &
1066 get_unaligned((__u16 *)expiries[i].hints)
1066 & 0x7f7f) ) 1067 & 0x7f7f) )
1067 client->expir_callback(&(expiries[i]), 1068 client->expir_callback(&(expiries[i]),
1068 EXPIRY_TIMEOUT, 1069 EXPIRY_TIMEOUT,
@@ -1086,7 +1087,7 @@ discovery_t *irlmp_get_discovery_response(void)
1086 1087
1087 IRDA_ASSERT(irlmp != NULL, return NULL;); 1088 IRDA_ASSERT(irlmp != NULL, return NULL;);
1088 1089
1089 u16ho(irlmp->discovery_rsp.data.hints) = irlmp->hints.word; 1090 put_unaligned(irlmp->hints.word, (__u16 *)irlmp->discovery_rsp.data.hints);
1090 1091
1091 /* 1092 /*
1092 * Set character set for device name (we use ASCII), and 1093 * Set character set for device name (we use ASCII), and
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index 75497e55927d..cf9a4b531a98 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -10,6 +10,7 @@
10 10
11#include "irnet_irda.h" /* Private header */ 11#include "irnet_irda.h" /* Private header */
12#include <linux/seq_file.h> 12#include <linux/seq_file.h>
13#include <asm/unaligned.h>
13 14
14/* 15/*
15 * PPP disconnect work: we need to make sure we're in 16 * PPP disconnect work: we need to make sure we're in
@@ -1673,7 +1674,7 @@ irnet_discovery_indication(discinfo_t * discovery,
1673 /* Notify the control channel */ 1674 /* Notify the control channel */
1674 irnet_post_event(NULL, IRNET_DISCOVER, 1675 irnet_post_event(NULL, IRNET_DISCOVER,
1675 discovery->saddr, discovery->daddr, discovery->info, 1676 discovery->saddr, discovery->daddr, discovery->info,
1676 u16ho(discovery->hints)); 1677 get_unaligned((__u16 *)discovery->hints));
1677 1678
1678 DEXIT(IRDA_OCB_TRACE, "\n"); 1679 DEXIT(IRDA_OCB_TRACE, "\n");
1679} 1680}
@@ -1704,7 +1705,7 @@ irnet_expiry_indication(discinfo_t * expiry,
1704 /* Notify the control channel */ 1705 /* Notify the control channel */
1705 irnet_post_event(NULL, IRNET_EXPIRE, 1706 irnet_post_event(NULL, IRNET_EXPIRE,
1706 expiry->saddr, expiry->daddr, expiry->info, 1707 expiry->saddr, expiry->daddr, expiry->info,
1707 u16ho(expiry->hints)); 1708 get_unaligned((__u16 *)expiry->hints));
1708 1709
1709 DEXIT(IRDA_OCB_TRACE, "\n"); 1710 DEXIT(IRDA_OCB_TRACE, "\n");
1710} 1711}
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 9e7236ff6bcc..7470e367272b 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1251,7 +1251,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
1251 x->sel.prefixlen_s = addr->sadb_address_prefixlen; 1251 x->sel.prefixlen_s = addr->sadb_address_prefixlen;
1252 } 1252 }
1253 1253
1254 if (x->props.mode == XFRM_MODE_TRANSPORT) 1254 if (!x->sel.family)
1255 x->sel.family = x->props.family; 1255 x->sel.family = x->props.family;
1256 1256
1257 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) { 1257 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) {
@@ -3030,6 +3030,9 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c)
3030 3030
3031static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) 3031static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c)
3032{ 3032{
3033 if (atomic_read(&pfkey_socks_nr) == 0)
3034 return 0;
3035
3033 switch (c->event) { 3036 switch (c->event) {
3034 case XFRM_MSG_EXPIRE: 3037 case XFRM_MSG_EXPIRE:
3035 return key_notify_sa_expire(x, c); 3038 return key_notify_sa_expire(x, c);
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index e2ddde755019..008de1fc42ca 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -286,12 +286,14 @@ void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
286 * 286 *
287 * Sends received pdus to the sap state machine. 287 * Sends received pdus to the sap state machine.
288 */ 288 */
289static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb) 289static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb,
290 struct sock *sk)
290{ 291{
291 struct llc_sap_state_ev *ev = llc_sap_ev(skb); 292 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
292 293
293 ev->type = LLC_SAP_EV_TYPE_PDU; 294 ev->type = LLC_SAP_EV_TYPE_PDU;
294 ev->reason = 0; 295 ev->reason = 0;
296 skb->sk = sk;
295 llc_sap_state_process(sap, skb); 297 llc_sap_state_process(sap, skb);
296} 298}
297 299
@@ -360,8 +362,7 @@ static void llc_sap_mcast(struct llc_sap *sap,
360 break; 362 break;
361 363
362 sock_hold(sk); 364 sock_hold(sk);
363 skb_set_owner_r(skb1, sk); 365 llc_sap_rcv(sap, skb1, sk);
364 llc_sap_rcv(sap, skb1);
365 sock_put(sk); 366 sock_put(sk);
366 } 367 }
367 read_unlock_bh(&sap->sk_list.lock); 368 read_unlock_bh(&sap->sk_list.lock);
@@ -381,8 +382,7 @@ void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb)
381 } else { 382 } else {
382 struct sock *sk = llc_lookup_dgram(sap, &laddr); 383 struct sock *sk = llc_lookup_dgram(sap, &laddr);
383 if (sk) { 384 if (sk) {
384 skb_set_owner_r(skb, sk); 385 llc_sap_rcv(sap, skb, sk);
385 llc_sap_rcv(sap, skb);
386 sock_put(sk); 386 sock_put(sk);
387 } else 387 } else
388 kfree_skb(skb); 388 kfree_skb(skb);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 699d97b8de5e..a9fce4afdf21 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -672,7 +672,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
672 if (params->vlan) { 672 if (params->vlan) {
673 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 673 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
674 674
675 if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN || 675 if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN &&
676 sdata->vif.type != IEEE80211_IF_TYPE_AP) 676 sdata->vif.type != IEEE80211_IF_TYPE_AP)
677 return -EINVAL; 677 return -EINVAL;
678 } else 678 } else
@@ -760,7 +760,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
760 if (params->vlan && params->vlan != sta->sdata->dev) { 760 if (params->vlan && params->vlan != sta->sdata->dev) {
761 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 761 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
762 762
763 if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN || 763 if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN &&
764 vlansdata->vif.type != IEEE80211_IF_TYPE_AP) { 764 vlansdata->vif.type != IEEE80211_IF_TYPE_AP) {
765 rcu_read_unlock(); 765 rcu_read_unlock();
766 return -EINVAL; 766 return -EINVAL;
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 879e7210458a..19efc3a6a932 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -255,14 +255,23 @@ void ieee80211_debugfs_key_remove(struct ieee80211_key *key)
255void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) 255void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
256{ 256{
257 char buf[50]; 257 char buf[50];
258 struct ieee80211_key *key;
258 259
259 if (!sdata->debugfsdir) 260 if (!sdata->debugfsdir)
260 return; 261 return;
261 262
262 sprintf(buf, "../keys/%d", sdata->default_key->debugfs.cnt); 263 /* this is running under the key lock */
263 sdata->debugfs.default_key = 264
264 debugfs_create_symlink("default_key", sdata->debugfsdir, buf); 265 key = sdata->default_key;
266 if (key) {
267 sprintf(buf, "../keys/%d", key->debugfs.cnt);
268 sdata->debugfs.default_key =
269 debugfs_create_symlink("default_key",
270 sdata->debugfsdir, buf);
271 } else
272 ieee80211_debugfs_key_remove_default(sdata);
265} 273}
274
266void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) 275void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata)
267{ 276{
268 if (!sdata) 277 if (!sdata)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c7314bf4bec2..006486b26726 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -899,7 +899,7 @@ extern const struct iw_handler_def ieee80211_iw_handler_def;
899 899
900 900
901/* ieee80211_ioctl.c */ 901/* ieee80211_ioctl.c */
902int ieee80211_set_freq(struct ieee80211_local *local, int freq); 902int ieee80211_set_freq(struct net_device *dev, int freq);
903/* ieee80211_sta.c */ 903/* ieee80211_sta.c */
904void ieee80211_sta_timer(unsigned long data); 904void ieee80211_sta_timer(unsigned long data);
905void ieee80211_sta_work(struct work_struct *work); 905void ieee80211_sta_work(struct work_struct *work);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 80954a512185..06e88a5a036d 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -54,6 +54,15 @@ int ieee80211_if_add(struct net_device *dev, const char *name,
54 if (!ndev) 54 if (!ndev)
55 return -ENOMEM; 55 return -ENOMEM;
56 56
57 ndev->needed_headroom = local->tx_headroom +
58 4*6 /* four MAC addresses */
59 + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
60 + 6 /* mesh */
61 + 8 /* rfc1042/bridge tunnel */
62 - ETH_HLEN /* ethernet hard_header_len */
63 + IEEE80211_ENCRYPT_HEADROOM;
64 ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
65
57 ret = dev_alloc_name(ndev, ndev->name); 66 ret = dev_alloc_name(ndev, ndev->name);
58 if (ret < 0) 67 if (ret < 0)
59 goto fail; 68 goto fail;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 915afadb0602..98c0b5e56ecc 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -511,6 +511,7 @@ static int ieee80211_stop(struct net_device *dev)
511 case IEEE80211_IF_TYPE_STA: 511 case IEEE80211_IF_TYPE_STA:
512 case IEEE80211_IF_TYPE_IBSS: 512 case IEEE80211_IF_TYPE_IBSS:
513 sdata->u.sta.state = IEEE80211_DISABLED; 513 sdata->u.sta.state = IEEE80211_DISABLED;
514 memset(sdata->u.sta.bssid, 0, ETH_ALEN);
514 del_timer_sync(&sdata->u.sta.timer); 515 del_timer_sync(&sdata->u.sta.timer);
515 /* 516 /*
516 * When we get here, the interface is marked down. 517 * When we get here, the interface is marked down.
@@ -1313,7 +1314,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1313 /* 1314 /*
1314 * Clear the TX filter mask for this STA when sending the next 1315 * Clear the TX filter mask for this STA when sending the next
1315 * packet. If the STA went to power save mode, this will happen 1316 * packet. If the STA went to power save mode, this will happen
1316 * happen when it wakes up for the next time. 1317 * when it wakes up for the next time.
1317 */ 1318 */
1318 sta->flags |= WLAN_STA_CLEAR_PS_FILT; 1319 sta->flags |= WLAN_STA_CLEAR_PS_FILT;
1319 1320
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index f76bc26ae4d2..697ef67f96b6 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -397,7 +397,7 @@ int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
397 put_unaligned(cpu_to_le32(sdata->u.sta.mesh_seqnum), &meshhdr->seqnum); 397 put_unaligned(cpu_to_le32(sdata->u.sta.mesh_seqnum), &meshhdr->seqnum);
398 sdata->u.sta.mesh_seqnum++; 398 sdata->u.sta.mesh_seqnum++;
399 399
400 return 5; 400 return 6;
401} 401}
402 402
403void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) 403void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 3df809222d1c..af0cd1e3e213 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -120,7 +120,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
120 *pos++ = WLAN_EID_PREP; 120 *pos++ = WLAN_EID_PREP;
121 break; 121 break;
122 default: 122 default:
123 kfree(skb); 123 kfree_skb(skb);
124 return -ENOTSUPP; 124 return -ENOTSUPP;
125 break; 125 break;
126 } 126 }
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 5845dc21ce85..99c2d360888e 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -158,19 +158,25 @@ int mesh_path_add(u8 *dst, struct net_device *dev)
158 if (atomic_add_unless(&sdata->u.sta.mpaths, 1, MESH_MAX_MPATHS) == 0) 158 if (atomic_add_unless(&sdata->u.sta.mpaths, 1, MESH_MAX_MPATHS) == 0)
159 return -ENOSPC; 159 return -ENOSPC;
160 160
161 read_lock(&pathtbl_resize_lock);
162
163 new_mpath = kzalloc(sizeof(struct mesh_path), GFP_KERNEL); 161 new_mpath = kzalloc(sizeof(struct mesh_path), GFP_KERNEL);
164 if (!new_mpath) { 162 if (!new_mpath) {
165 atomic_dec(&sdata->u.sta.mpaths); 163 atomic_dec(&sdata->u.sta.mpaths);
166 err = -ENOMEM; 164 err = -ENOMEM;
167 goto endadd2; 165 goto endadd2;
168 } 166 }
167 new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
168 if (!new_node) {
169 kfree(new_mpath);
170 atomic_dec(&sdata->u.sta.mpaths);
171 err = -ENOMEM;
172 goto endadd2;
173 }
174
175 read_lock(&pathtbl_resize_lock);
169 memcpy(new_mpath->dst, dst, ETH_ALEN); 176 memcpy(new_mpath->dst, dst, ETH_ALEN);
170 new_mpath->dev = dev; 177 new_mpath->dev = dev;
171 new_mpath->flags = 0; 178 new_mpath->flags = 0;
172 skb_queue_head_init(&new_mpath->frame_queue); 179 skb_queue_head_init(&new_mpath->frame_queue);
173 new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
174 new_node->mpath = new_mpath; 180 new_node->mpath = new_mpath;
175 new_mpath->timer.data = (unsigned long) new_mpath; 181 new_mpath->timer.data = (unsigned long) new_mpath;
176 new_mpath->timer.function = mesh_path_timer; 182 new_mpath->timer.function = mesh_path_timer;
@@ -202,7 +208,6 @@ int mesh_path_add(u8 *dst, struct net_device *dev)
202 208
203endadd: 209endadd:
204 spin_unlock(&mesh_paths->hashwlock[hash_idx]); 210 spin_unlock(&mesh_paths->hashwlock[hash_idx]);
205endadd2:
206 read_unlock(&pathtbl_resize_lock); 211 read_unlock(&pathtbl_resize_lock);
207 if (!err && grow) { 212 if (!err && grow) {
208 struct mesh_table *oldtbl, *newtbl; 213 struct mesh_table *oldtbl, *newtbl;
@@ -215,10 +220,12 @@ endadd2:
215 return -ENOMEM; 220 return -ENOMEM;
216 } 221 }
217 rcu_assign_pointer(mesh_paths, newtbl); 222 rcu_assign_pointer(mesh_paths, newtbl);
223 write_unlock(&pathtbl_resize_lock);
224
218 synchronize_rcu(); 225 synchronize_rcu();
219 mesh_table_free(oldtbl, false); 226 mesh_table_free(oldtbl, false);
220 write_unlock(&pathtbl_resize_lock);
221 } 227 }
228endadd2:
222 return err; 229 return err;
223} 230}
224 231
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a5e5c31c23ab..4d2b582dd055 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -44,7 +44,7 @@
44#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) 44#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ)
45#define IEEE80211_SCAN_INTERVAL (2 * HZ) 45#define IEEE80211_SCAN_INTERVAL (2 * HZ)
46#define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ) 46#define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ)
47#define IEEE80211_IBSS_JOIN_TIMEOUT (20 * HZ) 47#define IEEE80211_IBSS_JOIN_TIMEOUT (7 * HZ)
48 48
49#define IEEE80211_PROBE_DELAY (HZ / 33) 49#define IEEE80211_PROBE_DELAY (HZ / 33)
50#define IEEE80211_CHANNEL_TIME (HZ / 33) 50#define IEEE80211_CHANNEL_TIME (HZ / 33)
@@ -665,6 +665,26 @@ static void ieee80211_authenticate(struct net_device *dev,
665 mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT); 665 mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT);
666} 666}
667 667
668static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss,
669 struct ieee80211_supported_band *sband,
670 u64 *rates)
671{
672 int i, j, count;
673 *rates = 0;
674 count = 0;
675 for (i = 0; i < bss->supp_rates_len; i++) {
676 int rate = (bss->supp_rates[i] & 0x7F) * 5;
677
678 for (j = 0; j < sband->n_bitrates; j++)
679 if (sband->bitrates[j].bitrate == rate) {
680 *rates |= BIT(j);
681 count++;
682 break;
683 }
684 }
685
686 return count;
687}
668 688
669static void ieee80211_send_assoc(struct net_device *dev, 689static void ieee80211_send_assoc(struct net_device *dev,
670 struct ieee80211_if_sta *ifsta) 690 struct ieee80211_if_sta *ifsta)
@@ -673,11 +693,12 @@ static void ieee80211_send_assoc(struct net_device *dev,
673 struct sk_buff *skb; 693 struct sk_buff *skb;
674 struct ieee80211_mgmt *mgmt; 694 struct ieee80211_mgmt *mgmt;
675 u8 *pos, *ies; 695 u8 *pos, *ies;
676 int i, len; 696 int i, len, count, rates_len, supp_rates_len;
677 u16 capab; 697 u16 capab;
678 struct ieee80211_sta_bss *bss; 698 struct ieee80211_sta_bss *bss;
679 int wmm = 0; 699 int wmm = 0;
680 struct ieee80211_supported_band *sband; 700 struct ieee80211_supported_band *sband;
701 u64 rates = 0;
681 702
682 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 703 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
683 sizeof(*mgmt) + 200 + ifsta->extra_ie_len + 704 sizeof(*mgmt) + 200 + ifsta->extra_ie_len +
@@ -709,7 +730,17 @@ static void ieee80211_send_assoc(struct net_device *dev,
709 if (bss->wmm_ie) { 730 if (bss->wmm_ie) {
710 wmm = 1; 731 wmm = 1;
711 } 732 }
733
734 /* get all rates supported by the device and the AP as
735 * some APs don't like getting a superset of their rates
736 * in the association request (e.g. D-Link DAP 1353 in
737 * b-only mode) */
738 rates_len = ieee80211_compatible_rates(bss, sband, &rates);
739
712 ieee80211_rx_bss_put(dev, bss); 740 ieee80211_rx_bss_put(dev, bss);
741 } else {
742 rates = ~0;
743 rates_len = sband->n_bitrates;
713 } 744 }
714 745
715 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); 746 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
@@ -740,24 +771,36 @@ static void ieee80211_send_assoc(struct net_device *dev,
740 *pos++ = ifsta->ssid_len; 771 *pos++ = ifsta->ssid_len;
741 memcpy(pos, ifsta->ssid, ifsta->ssid_len); 772 memcpy(pos, ifsta->ssid, ifsta->ssid_len);
742 773
774 /* add all rates which were marked to be used above */
775 supp_rates_len = rates_len;
776 if (supp_rates_len > 8)
777 supp_rates_len = 8;
778
743 len = sband->n_bitrates; 779 len = sband->n_bitrates;
744 if (len > 8) 780 pos = skb_put(skb, supp_rates_len + 2);
745 len = 8;
746 pos = skb_put(skb, len + 2);
747 *pos++ = WLAN_EID_SUPP_RATES; 781 *pos++ = WLAN_EID_SUPP_RATES;
748 *pos++ = len; 782 *pos++ = supp_rates_len;
749 for (i = 0; i < len; i++) {
750 int rate = sband->bitrates[i].bitrate;
751 *pos++ = (u8) (rate / 5);
752 }
753 783
754 if (sband->n_bitrates > len) { 784 count = 0;
755 pos = skb_put(skb, sband->n_bitrates - len + 2); 785 for (i = 0; i < sband->n_bitrates; i++) {
756 *pos++ = WLAN_EID_EXT_SUPP_RATES; 786 if (BIT(i) & rates) {
757 *pos++ = sband->n_bitrates - len;
758 for (i = len; i < sband->n_bitrates; i++) {
759 int rate = sband->bitrates[i].bitrate; 787 int rate = sband->bitrates[i].bitrate;
760 *pos++ = (u8) (rate / 5); 788 *pos++ = (u8) (rate / 5);
789 if (++count == 8)
790 break;
791 }
792 }
793
794 if (count == 8) {
795 pos = skb_put(skb, rates_len - count + 2);
796 *pos++ = WLAN_EID_EXT_SUPP_RATES;
797 *pos++ = rates_len - count;
798
799 for (i++; i < sband->n_bitrates; i++) {
800 if (BIT(i) & rates) {
801 int rate = sband->bitrates[i].bitrate;
802 *pos++ = (u8) (rate / 5);
803 }
761 } 804 }
762 } 805 }
763 806
@@ -1282,7 +1325,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1282 1325
1283 /* prepare reordering buffer */ 1326 /* prepare reordering buffer */
1284 tid_agg_rx->reorder_buf = 1327 tid_agg_rx->reorder_buf =
1285 kmalloc(buf_size * sizeof(struct sk_buf *), GFP_ATOMIC); 1328 kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC);
1286 if (!tid_agg_rx->reorder_buf) { 1329 if (!tid_agg_rx->reorder_buf) {
1287 if (net_ratelimit()) 1330 if (net_ratelimit())
1288 printk(KERN_ERR "can not allocate reordering buffer " 1331 printk(KERN_ERR "can not allocate reordering buffer "
@@ -1291,7 +1334,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1291 goto end; 1334 goto end;
1292 } 1335 }
1293 memset(tid_agg_rx->reorder_buf, 0, 1336 memset(tid_agg_rx->reorder_buf, 0,
1294 buf_size * sizeof(struct sk_buf *)); 1337 buf_size * sizeof(struct sk_buff *));
1295 1338
1296 if (local->ops->ampdu_action) 1339 if (local->ops->ampdu_action)
1297 ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, 1340 ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START,
@@ -1571,7 +1614,7 @@ void sta_addba_resp_timer_expired(unsigned long data)
1571 * only one argument, and both sta_info and TID are needed, so init 1614 * only one argument, and both sta_info and TID are needed, so init
1572 * flow in sta_info_create gives the TID as data, while the timer_to_id 1615 * flow in sta_info_create gives the TID as data, while the timer_to_id
1573 * array gives the sta through container_of */ 1616 * array gives the sta through container_of */
1574 u16 tid = *(int *)data; 1617 u16 tid = *(u8 *)data;
1575 struct sta_info *temp_sta = container_of((void *)data, 1618 struct sta_info *temp_sta = container_of((void *)data,
1576 struct sta_info, timer_to_tid[tid]); 1619 struct sta_info, timer_to_tid[tid]);
1577 1620
@@ -1619,7 +1662,7 @@ timer_expired_exit:
1619void sta_rx_agg_session_timer_expired(unsigned long data) 1662void sta_rx_agg_session_timer_expired(unsigned long data)
1620{ 1663{
1621 /* not an elegant detour, but there is no choice as the timer passes 1664 /* not an elegant detour, but there is no choice as the timer passes
1622 * only one argument, and verious sta_info are needed here, so init 1665 * only one argument, and various sta_info are needed here, so init
1623 * flow in sta_info_create gives the TID as data, while the timer_to_id 1666 * flow in sta_info_create gives the TID as data, while the timer_to_id
1624 * array gives the sta through container_of */ 1667 * array gives the sta through container_of */
1625 u8 *ptid = (u8 *)data; 1668 u8 *ptid = (u8 *)data;
@@ -2293,6 +2336,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2293 u8 *pos; 2336 u8 *pos;
2294 struct ieee80211_sub_if_data *sdata; 2337 struct ieee80211_sub_if_data *sdata;
2295 struct ieee80211_supported_band *sband; 2338 struct ieee80211_supported_band *sband;
2339 union iwreq_data wrqu;
2296 2340
2297 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 2341 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
2298 2342
@@ -2315,13 +2359,10 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2315 sdata->drop_unencrypted = bss->capability & 2359 sdata->drop_unencrypted = bss->capability &
2316 WLAN_CAPABILITY_PRIVACY ? 1 : 0; 2360 WLAN_CAPABILITY_PRIVACY ? 1 : 0;
2317 2361
2318 res = ieee80211_set_freq(local, bss->freq); 2362 res = ieee80211_set_freq(dev, bss->freq);
2319 2363
2320 if (local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS) { 2364 if (res)
2321 printk(KERN_DEBUG "%s: IBSS not allowed on frequency " 2365 return res;
2322 "%d MHz\n", dev->name, local->oper_channel->center_freq);
2323 return -1;
2324 }
2325 2366
2326 /* Set beacon template */ 2367 /* Set beacon template */
2327 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); 2368 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
@@ -2436,7 +2477,9 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2436 ifsta->state = IEEE80211_IBSS_JOINED; 2477 ifsta->state = IEEE80211_IBSS_JOINED;
2437 mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); 2478 mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);
2438 2479
2439 ieee80211_rx_bss_put(dev, bss); 2480 memset(&wrqu, 0, sizeof(wrqu));
2481 memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN);
2482 wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
2440 2483
2441 return res; 2484 return res;
2442} 2485}
@@ -3410,21 +3453,17 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
3410 struct ieee80211_sta_bss *bss, *selected = NULL; 3453 struct ieee80211_sta_bss *bss, *selected = NULL;
3411 int top_rssi = 0, freq; 3454 int top_rssi = 0, freq;
3412 3455
3413 if (!(ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL |
3414 IEEE80211_STA_AUTO_BSSID_SEL | IEEE80211_STA_AUTO_CHANNEL_SEL))) {
3415 ifsta->state = IEEE80211_AUTHENTICATE;
3416 ieee80211_sta_reset_auth(dev, ifsta);
3417 return 0;
3418 }
3419
3420 spin_lock_bh(&local->sta_bss_lock); 3456 spin_lock_bh(&local->sta_bss_lock);
3421 freq = local->oper_channel->center_freq; 3457 freq = local->oper_channel->center_freq;
3422 list_for_each_entry(bss, &local->sta_bss_list, list) { 3458 list_for_each_entry(bss, &local->sta_bss_list, list) {
3423 if (!(bss->capability & WLAN_CAPABILITY_ESS)) 3459 if (!(bss->capability & WLAN_CAPABILITY_ESS))
3424 continue; 3460 continue;
3425 3461
3426 if (!!(bss->capability & WLAN_CAPABILITY_PRIVACY) ^ 3462 if ((ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL |
3427 !!sdata->default_key) 3463 IEEE80211_STA_AUTO_BSSID_SEL |
3464 IEEE80211_STA_AUTO_CHANNEL_SEL)) &&
3465 (!!(bss->capability & WLAN_CAPABILITY_PRIVACY) ^
3466 !!sdata->default_key))
3428 continue; 3467 continue;
3429 3468
3430 if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) && 3469 if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) &&
@@ -3449,7 +3488,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
3449 spin_unlock_bh(&local->sta_bss_lock); 3488 spin_unlock_bh(&local->sta_bss_lock);
3450 3489
3451 if (selected) { 3490 if (selected) {
3452 ieee80211_set_freq(local, selected->freq); 3491 ieee80211_set_freq(dev, selected->freq);
3453 if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) 3492 if (!(ifsta->flags & IEEE80211_STA_SSID_SET))
3454 ieee80211_sta_set_ssid(dev, selected->ssid, 3493 ieee80211_sta_set_ssid(dev, selected->ssid,
3455 selected->ssid_len); 3494 selected->ssid_len);
@@ -3484,6 +3523,7 @@ static int ieee80211_sta_create_ibss(struct net_device *dev,
3484 struct ieee80211_supported_band *sband; 3523 struct ieee80211_supported_band *sband;
3485 u8 bssid[ETH_ALEN], *pos; 3524 u8 bssid[ETH_ALEN], *pos;
3486 int i; 3525 int i;
3526 int ret;
3487 DECLARE_MAC_BUF(mac); 3527 DECLARE_MAC_BUF(mac);
3488 3528
3489#if 0 3529#if 0
@@ -3528,7 +3568,9 @@ static int ieee80211_sta_create_ibss(struct net_device *dev,
3528 *pos++ = (u8) (rate / 5); 3568 *pos++ = (u8) (rate / 5);
3529 } 3569 }
3530 3570
3531 return ieee80211_sta_join_ibss(dev, ifsta, bss); 3571 ret = ieee80211_sta_join_ibss(dev, ifsta, bss);
3572 ieee80211_rx_bss_put(dev, bss);
3573 return ret;
3532} 3574}
3533 3575
3534 3576
@@ -3576,10 +3618,13 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
3576 (bss = ieee80211_rx_bss_get(dev, bssid, 3618 (bss = ieee80211_rx_bss_get(dev, bssid,
3577 local->hw.conf.channel->center_freq, 3619 local->hw.conf.channel->center_freq,
3578 ifsta->ssid, ifsta->ssid_len))) { 3620 ifsta->ssid, ifsta->ssid_len))) {
3621 int ret;
3579 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" 3622 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s"
3580 " based on configured SSID\n", 3623 " based on configured SSID\n",
3581 dev->name, print_mac(mac, bssid)); 3624 dev->name, print_mac(mac, bssid));
3582 return ieee80211_sta_join_ibss(dev, ifsta, bss); 3625 ret = ieee80211_sta_join_ibss(dev, ifsta, bss);
3626 ieee80211_rx_bss_put(dev, bss);
3627 return ret;
3583 } 3628 }
3584#ifdef CONFIG_MAC80211_IBSS_DEBUG 3629#ifdef CONFIG_MAC80211_IBSS_DEBUG
3585 printk(KERN_DEBUG " did not try to join ibss\n"); 3630 printk(KERN_DEBUG " did not try to join ibss\n");
@@ -4056,18 +4101,17 @@ ieee80211_sta_scan_result(struct net_device *dev,
4056 4101
4057 memset(&iwe, 0, sizeof(iwe)); 4102 memset(&iwe, 0, sizeof(iwe));
4058 iwe.cmd = SIOCGIWFREQ; 4103 iwe.cmd = SIOCGIWFREQ;
4059 iwe.u.freq.m = bss->freq; 4104 iwe.u.freq.m = ieee80211_frequency_to_channel(bss->freq);
4060 iwe.u.freq.e = 6; 4105 iwe.u.freq.e = 0;
4061 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4106 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
4062 IW_EV_FREQ_LEN); 4107 IW_EV_FREQ_LEN);
4063 4108
4064 memset(&iwe, 0, sizeof(iwe)); 4109 memset(&iwe, 0, sizeof(iwe));
4065 iwe.cmd = SIOCGIWFREQ; 4110 iwe.cmd = SIOCGIWFREQ;
4066 iwe.u.freq.m = ieee80211_frequency_to_channel(bss->freq); 4111 iwe.u.freq.m = bss->freq;
4067 iwe.u.freq.e = 0; 4112 iwe.u.freq.e = 6;
4068 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4113 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
4069 IW_EV_FREQ_LEN); 4114 IW_EV_FREQ_LEN);
4070
4071 memset(&iwe, 0, sizeof(iwe)); 4115 memset(&iwe, 0, sizeof(iwe));
4072 iwe.cmd = IWEVQUAL; 4116 iwe.cmd = IWEVQUAL;
4073 iwe.u.qual.qual = bss->signal; 4117 iwe.u.qual.qual = bss->signal;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 02f436a86061..0941e5d6a522 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1091,7 +1091,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1091 u16 fc, hdrlen, ethertype; 1091 u16 fc, hdrlen, ethertype;
1092 u8 *payload; 1092 u8 *payload;
1093 u8 dst[ETH_ALEN]; 1093 u8 dst[ETH_ALEN];
1094 u8 src[ETH_ALEN]; 1094 u8 src[ETH_ALEN] __aligned(2);
1095 struct sk_buff *skb = rx->skb; 1095 struct sk_buff *skb = rx->skb;
1096 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1096 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1097 DECLARE_MAC_BUF(mac); 1097 DECLARE_MAC_BUF(mac);
@@ -1234,7 +1234,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1234 */ 1234 */
1235static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx) 1235static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx)
1236{ 1236{
1237 static const u8 pae_group_addr[ETH_ALEN] 1237 static const u8 pae_group_addr[ETH_ALEN] __aligned(2)
1238 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; 1238 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
1239 struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; 1239 struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data;
1240 1240
@@ -1305,11 +1305,11 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1305 if (is_multicast_ether_addr(skb->data)) { 1305 if (is_multicast_ether_addr(skb->data)) {
1306 if (*mesh_ttl > 0) { 1306 if (*mesh_ttl > 0) {
1307 xmit_skb = skb_copy(skb, GFP_ATOMIC); 1307 xmit_skb = skb_copy(skb, GFP_ATOMIC);
1308 if (!xmit_skb && net_ratelimit()) 1308 if (xmit_skb)
1309 xmit_skb->pkt_type = PACKET_OTHERHOST;
1310 else if (net_ratelimit())
1309 printk(KERN_DEBUG "%s: failed to clone " 1311 printk(KERN_DEBUG "%s: failed to clone "
1310 "multicast frame\n", dev->name); 1312 "multicast frame\n", dev->name);
1311 else
1312 xmit_skb->pkt_type = PACKET_OTHERHOST;
1313 } else 1313 } else
1314 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.sta, 1314 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.sta,
1315 dropped_frames_ttl); 1315 dropped_frames_ttl);
@@ -1395,7 +1395,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1395 padding = ((4 - subframe_len) & 0x3); 1395 padding = ((4 - subframe_len) & 0x3);
1396 /* the last MSDU has no padding */ 1396 /* the last MSDU has no padding */
1397 if (subframe_len > remaining) { 1397 if (subframe_len > remaining) {
1398 printk(KERN_DEBUG "%s: wrong buffer size", dev->name); 1398 printk(KERN_DEBUG "%s: wrong buffer size\n", dev->name);
1399 return RX_DROP_UNUSABLE; 1399 return RX_DROP_UNUSABLE;
1400 } 1400 }
1401 1401
@@ -1418,7 +1418,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1418 eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + 1418 eth = (struct ethhdr *) skb_pull(skb, ntohs(len) +
1419 padding); 1419 padding);
1420 if (!eth) { 1420 if (!eth) {
1421 printk(KERN_DEBUG "%s: wrong buffer size ", 1421 printk(KERN_DEBUG "%s: wrong buffer size\n",
1422 dev->name); 1422 dev->name);
1423 dev_kfree_skb(frame); 1423 dev_kfree_skb(frame);
1424 return RX_DROP_UNUSABLE; 1424 return RX_DROP_UNUSABLE;
@@ -1952,7 +1952,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1952 if (!skb_new) { 1952 if (!skb_new) {
1953 if (net_ratelimit()) 1953 if (net_ratelimit())
1954 printk(KERN_DEBUG "%s: failed to copy " 1954 printk(KERN_DEBUG "%s: failed to copy "
1955 "multicast frame for %s", 1955 "multicast frame for %s\n",
1956 wiphy_name(local->hw.wiphy), 1956 wiphy_name(local->hw.wiphy),
1957 prev->dev->name); 1957 prev->dev->name);
1958 continue; 1958 continue;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index f35eaea98e73..1d7dd54aacef 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1562,13 +1562,13 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1562 * be cloned. This could happen, e.g., with Linux bridge code passing 1562 * be cloned. This could happen, e.g., with Linux bridge code passing
1563 * us broadcast frames. */ 1563 * us broadcast frames. */
1564 1564
1565 if (head_need > 0 || skb_cloned(skb)) { 1565 if (head_need > 0 || skb_header_cloned(skb)) {
1566#if 0 1566#if 0
1567 printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes " 1567 printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes "
1568 "of headroom\n", dev->name, head_need); 1568 "of headroom\n", dev->name, head_need);
1569#endif 1569#endif
1570 1570
1571 if (skb_cloned(skb)) 1571 if (skb_header_cloned(skb))
1572 I802_DEBUG_INC(local->tx_expand_skb_head_cloned); 1572 I802_DEBUG_INC(local->tx_expand_skb_head_cloned);
1573 else 1573 else
1574 I802_DEBUG_INC(local->tx_expand_skb_head); 1574 I802_DEBUG_INC(local->tx_expand_skb_head);
@@ -1898,6 +1898,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1898 control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 1898 control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE;
1899 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; 1899 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
1900 control->flags |= IEEE80211_TXCTL_NO_ACK; 1900 control->flags |= IEEE80211_TXCTL_NO_ACK;
1901 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
1901 control->retry_limit = 1; 1902 control->retry_limit = 1;
1902 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; 1903 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT;
1903 } 1904 }
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index cc9f715c7bfc..4e97b266f907 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -34,11 +34,11 @@ void *mac80211_wiphy_privid = &mac80211_wiphy_privid;
34 34
35/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 35/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
36/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ 36/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
37const unsigned char rfc1042_header[] = 37const unsigned char rfc1042_header[] __aligned(2) =
38 { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 38 { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
39 39
40/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ 40/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
41const unsigned char bridge_tunnel_header[] = 41const unsigned char bridge_tunnel_header[] __aligned(2) =
42 { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; 42 { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
43 43
44 44
@@ -153,15 +153,15 @@ int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
153 /* 7.1.3.5a.2 */ 153 /* 7.1.3.5a.2 */
154 switch (ae) { 154 switch (ae) {
155 case 0: 155 case 0:
156 return 5; 156 return 6;
157 case 1: 157 case 1:
158 return 11; 158 return 12;
159 case 2: 159 case 2:
160 return 17; 160 return 18;
161 case 3: 161 case 3:
162 return 23; 162 return 24;
163 default: 163 default:
164 return 5; 164 return 6;
165 } 165 }
166} 166}
167 167
@@ -389,6 +389,41 @@ void ieee80211_iterate_active_interfaces(
389 struct ieee80211_local *local = hw_to_local(hw); 389 struct ieee80211_local *local = hw_to_local(hw);
390 struct ieee80211_sub_if_data *sdata; 390 struct ieee80211_sub_if_data *sdata;
391 391
392 rtnl_lock();
393
394 list_for_each_entry(sdata, &local->interfaces, list) {
395 switch (sdata->vif.type) {
396 case IEEE80211_IF_TYPE_INVALID:
397 case IEEE80211_IF_TYPE_MNTR:
398 case IEEE80211_IF_TYPE_VLAN:
399 continue;
400 case IEEE80211_IF_TYPE_AP:
401 case IEEE80211_IF_TYPE_STA:
402 case IEEE80211_IF_TYPE_IBSS:
403 case IEEE80211_IF_TYPE_WDS:
404 case IEEE80211_IF_TYPE_MESH_POINT:
405 break;
406 }
407 if (sdata->dev == local->mdev)
408 continue;
409 if (netif_running(sdata->dev))
410 iterator(data, sdata->dev->dev_addr,
411 &sdata->vif);
412 }
413
414 rtnl_unlock();
415}
416EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
417
418void ieee80211_iterate_active_interfaces_atomic(
419 struct ieee80211_hw *hw,
420 void (*iterator)(void *data, u8 *mac,
421 struct ieee80211_vif *vif),
422 void *data)
423{
424 struct ieee80211_local *local = hw_to_local(hw);
425 struct ieee80211_sub_if_data *sdata;
426
392 rcu_read_lock(); 427 rcu_read_lock();
393 428
394 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 429 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
@@ -413,4 +448,4 @@ void ieee80211_iterate_active_interfaces(
413 448
414 rcu_read_unlock(); 449 rcu_read_unlock();
415} 450}
416EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); 451EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_atomic);
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 76e1de1dc735..a8bb8e31b1ec 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -209,7 +209,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
209 range->num_frequency = c; 209 range->num_frequency = c;
210 210
211 IW_EVENT_CAPA_SET_KERNEL(range->event_capa); 211 IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
212 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
213 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); 212 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
214 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); 213 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
215 214
@@ -291,14 +290,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
291 return 0; 290 return 0;
292} 291}
293 292
294int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) 293int ieee80211_set_freq(struct net_device *dev, int freqMHz)
295{ 294{
296 int ret = -EINVAL; 295 int ret = -EINVAL;
297 struct ieee80211_channel *chan; 296 struct ieee80211_channel *chan;
297 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
298 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
298 299
299 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); 300 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
300 301
301 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { 302 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
303 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
304 chan->flags & IEEE80211_CHAN_NO_IBSS) {
305 printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
306 "%d MHz\n", dev->name, chan->center_freq);
307 return ret;
308 }
302 local->oper_channel = chan; 309 local->oper_channel = chan;
303 310
304 if (local->sta_sw_scanning || local->sta_hw_scanning) 311 if (local->sta_sw_scanning || local->sta_hw_scanning)
@@ -316,7 +323,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
316 struct iw_request_info *info, 323 struct iw_request_info *info,
317 struct iw_freq *freq, char *extra) 324 struct iw_freq *freq, char *extra)
318{ 325{
319 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
320 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 326 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
321 327
322 if (sdata->vif.type == IEEE80211_IF_TYPE_STA) 328 if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
@@ -330,14 +336,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
330 IEEE80211_STA_AUTO_CHANNEL_SEL; 336 IEEE80211_STA_AUTO_CHANNEL_SEL;
331 return 0; 337 return 0;
332 } else 338 } else
333 return ieee80211_set_freq(local, 339 return ieee80211_set_freq(dev,
334 ieee80211_channel_to_frequency(freq->m)); 340 ieee80211_channel_to_frequency(freq->m));
335 } else { 341 } else {
336 int i, div = 1000000; 342 int i, div = 1000000;
337 for (i = 0; i < freq->e; i++) 343 for (i = 0; i < freq->e; i++)
338 div /= 10; 344 div /= 10;
339 if (div > 0) 345 if (div > 0)
340 return ieee80211_set_freq(local, freq->m / div); 346 return ieee80211_set_freq(dev, freq->m / div);
341 else 347 else
342 return -EINVAL; 348 return -EINVAL;
343 } 349 }
@@ -490,9 +496,14 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
490 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 496 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
491 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 497 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
492 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 498 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
493 ap_addr->sa_family = ARPHRD_ETHER; 499 if (sdata->u.sta.state == IEEE80211_ASSOCIATED) {
494 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); 500 ap_addr->sa_family = ARPHRD_ETHER;
495 return 0; 501 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
502 return 0;
503 } else {
504 memset(&ap_addr->sa_data, 0, ETH_ALEN);
505 return 0;
506 }
496 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { 507 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
497 ap_addr->sa_family = ARPHRD_ETHER; 508 ap_addr->sa_family = ARPHRD_ETHER;
498 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); 509 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 64faa3dc488f..dc1598b86004 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -394,7 +394,8 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct nlattr *opt)
394 qd->handle); 394 qd->handle);
395 if (!q->queues[i]) { 395 if (!q->queues[i]) {
396 q->queues[i] = &noop_qdisc; 396 q->queues[i] = &noop_qdisc;
397 printk(KERN_ERR "%s child qdisc %i creation failed", dev->name, i); 397 printk(KERN_ERR "%s child qdisc %i creation failed\n",
398 dev->name, i);
398 } 399 }
399 } 400 }
400 401
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index c4b1799da5d7..662c1ccfee26 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -196,8 +196,6 @@ destroy_conntrack(struct nf_conntrack *nfct)
196 if (l4proto && l4proto->destroy) 196 if (l4proto && l4proto->destroy)
197 l4proto->destroy(ct); 197 l4proto->destroy(ct);
198 198
199 nf_ct_ext_destroy(ct);
200
201 rcu_read_unlock(); 199 rcu_read_unlock();
202 200
203 spin_lock_bh(&nf_conntrack_lock); 201 spin_lock_bh(&nf_conntrack_lock);
@@ -520,6 +518,7 @@ static void nf_conntrack_free_rcu(struct rcu_head *head)
520 518
521void nf_conntrack_free(struct nf_conn *ct) 519void nf_conntrack_free(struct nf_conn *ct)
522{ 520{
521 nf_ct_ext_destroy(ct);
523 call_rcu(&ct->rcu, nf_conntrack_free_rcu); 522 call_rcu(&ct->rcu, nf_conntrack_free_rcu);
524} 523}
525EXPORT_SYMBOL_GPL(nf_conntrack_free); 524EXPORT_SYMBOL_GPL(nf_conntrack_free);
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index e31beeb33b2b..e8f0dead267f 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -587,10 +587,10 @@ int __init nf_conntrack_expect_init(void)
587 return 0; 587 return 0;
588 588
589err3: 589err3:
590 kmem_cache_destroy(nf_ct_expect_cachep);
591err2:
590 nf_ct_free_hashtable(nf_ct_expect_hash, nf_ct_expect_vmalloc, 592 nf_ct_free_hashtable(nf_ct_expect_hash, nf_ct_expect_vmalloc,
591 nf_ct_expect_hsize); 593 nf_ct_expect_hsize);
592err2:
593 kmem_cache_destroy(nf_ct_expect_cachep);
594err1: 594err1:
595 return err; 595 return err;
596} 596}
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 16774ecd1c4e..0edefcfc5949 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -472,6 +472,9 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
472 goto nla_put_failure; 472 goto nla_put_failure;
473 nla_nest_end(skb, nest_parms); 473 nla_nest_end(skb, nest_parms);
474 474
475 if (ctnetlink_dump_id(skb, ct) < 0)
476 goto nla_put_failure;
477
475 if (events & IPCT_DESTROY) { 478 if (events & IPCT_DESTROY) {
476 if (ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL) < 0 || 479 if (ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL) < 0 ||
477 ctnetlink_dump_counters(skb, ct, IP_CT_DIR_REPLY) < 0) 480 ctnetlink_dump_counters(skb, ct, IP_CT_DIR_REPLY) < 0)
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index bc11d7092032..9fda6ee95a31 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -92,10 +92,6 @@ void nf_log_packet(int pf,
92 vsnprintf(prefix, sizeof(prefix), fmt, args); 92 vsnprintf(prefix, sizeof(prefix), fmt, args);
93 va_end(args); 93 va_end(args);
94 logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix); 94 logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix);
95 } else if (net_ratelimit()) {
96 printk(KERN_WARNING "nf_log_packet: can\'t log since "
97 "no backend logging module loaded in! Please either "
98 "load one, or disable logging explicitly\n");
99 } 95 }
100 rcu_read_unlock(); 96 rcu_read_unlock();
101} 97}
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 2e89a00df92c..70907f6baac3 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -73,7 +73,8 @@ connlimit_iphash6(const union nf_inet_addr *addr,
73static inline bool already_closed(const struct nf_conn *conn) 73static inline bool already_closed(const struct nf_conn *conn)
74{ 74{
75 if (nf_ct_protonum(conn) == IPPROTO_TCP) 75 if (nf_ct_protonum(conn) == IPPROTO_TCP)
76 return conn->proto.tcp.state == TCP_CONNTRACK_TIME_WAIT; 76 return conn->proto.tcp.state == TCP_CONNTRACK_TIME_WAIT ||
77 conn->proto.tcp.state == TCP_CONNTRACK_CLOSE;
77 else 78 else
78 return 0; 79 return 0;
79} 80}
diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
index 500528d60cd7..c63e9333c755 100644
--- a/net/netfilter/xt_iprange.c
+++ b/net/netfilter/xt_iprange.c
@@ -179,3 +179,5 @@ module_exit(iprange_mt_exit);
179MODULE_LICENSE("GPL"); 179MODULE_LICENSE("GPL");
180MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>, Jan Engelhardt <jengelh@computergmbh.de>"); 180MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>, Jan Engelhardt <jengelh@computergmbh.de>");
181MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching"); 181MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching");
182MODULE_ALIAS("ipt_iprange");
183MODULE_ALIAS("ip6t_iprange");
diff --git a/net/netlink/attr.c b/net/netlink/attr.c
index feb326f4a752..47bbf45ae5d7 100644
--- a/net/netlink/attr.c
+++ b/net/netlink/attr.c
@@ -400,13 +400,13 @@ void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
400 * @attrlen: length of attribute payload 400 * @attrlen: length of attribute payload
401 * @data: head of attribute payload 401 * @data: head of attribute payload
402 * 402 *
403 * Returns -1 if the tailroom of the skb is insufficient to store 403 * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
404 * the attribute header and payload. 404 * the attribute header and payload.
405 */ 405 */
406int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data) 406int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data)
407{ 407{
408 if (unlikely(skb_tailroom(skb) < nla_total_size(attrlen))) 408 if (unlikely(skb_tailroom(skb) < nla_total_size(attrlen)))
409 return -1; 409 return -EMSGSIZE;
410 410
411 __nla_put(skb, attrtype, attrlen, data); 411 __nla_put(skb, attrtype, attrlen, data);
412 return 0; 412 return 0;
@@ -418,13 +418,13 @@ int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data)
418 * @attrlen: length of attribute payload 418 * @attrlen: length of attribute payload
419 * @data: head of attribute payload 419 * @data: head of attribute payload
420 * 420 *
421 * Returns -1 if the tailroom of the skb is insufficient to store 421 * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
422 * the attribute payload. 422 * the attribute payload.
423 */ 423 */
424int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data) 424int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
425{ 425{
426 if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen))) 426 if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
427 return -1; 427 return -EMSGSIZE;
428 428
429 __nla_put_nohdr(skb, attrlen, data); 429 __nla_put_nohdr(skb, attrlen, data);
430 return 0; 430 return 0;
@@ -436,13 +436,13 @@ int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
436 * @attrlen: length of attribute payload 436 * @attrlen: length of attribute payload
437 * @data: head of attribute payload 437 * @data: head of attribute payload
438 * 438 *
439 * Returns -1 if the tailroom of the skb is insufficient to store 439 * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
440 * the attribute payload. 440 * the attribute payload.
441 */ 441 */
442int nla_append(struct sk_buff *skb, int attrlen, const void *data) 442int nla_append(struct sk_buff *skb, int attrlen, const void *data)
443{ 443{
444 if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen))) 444 if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
445 return -1; 445 return -EMSGSIZE;
446 446
447 memcpy(skb_put(skb, attrlen), data, attrlen); 447 memcpy(skb_put(skb, attrlen), data, attrlen);
448 return 0; 448 return 0;
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index d16929c9b4bc..f5aa23c3e886 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -554,7 +554,8 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
554 return genlmsg_end(skb, hdr); 554 return genlmsg_end(skb, hdr);
555 555
556nla_put_failure: 556nla_put_failure:
557 return genlmsg_cancel(skb, hdr); 557 genlmsg_cancel(skb, hdr);
558 return -EMSGSIZE;
558} 559}
559 560
560static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid, 561static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid,
@@ -590,7 +591,8 @@ static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid,
590 return genlmsg_end(skb, hdr); 591 return genlmsg_end(skb, hdr);
591 592
592nla_put_failure: 593nla_put_failure:
593 return genlmsg_cancel(skb, hdr); 594 genlmsg_cancel(skb, hdr);
595 return -EMSGSIZE;
594} 596}
595 597
596static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) 598static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 25070240d4ae..2cee87da4441 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -743,7 +743,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
743 if (len > dev->mtu+reserve) 743 if (len > dev->mtu+reserve)
744 goto out_unlock; 744 goto out_unlock;
745 745
746 skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev), 746 skb = sock_alloc_send_skb(sk, len + LL_ALLOCATED_SPACE(dev),
747 msg->msg_flags & MSG_DONTWAIT, &err); 747 msg->msg_flags & MSG_DONTWAIT, &err);
748 if (skb==NULL) 748 if (skb==NULL)
749 goto out_unlock; 749 goto out_unlock;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 1086df7478bc..9360fc81e8c7 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -220,7 +220,7 @@ replay:
220 tp = kzalloc(sizeof(*tp), GFP_KERNEL); 220 tp = kzalloc(sizeof(*tp), GFP_KERNEL);
221 if (tp == NULL) 221 if (tp == NULL)
222 goto errout; 222 goto errout;
223 err = -EINVAL; 223 err = -ENOENT;
224 tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]); 224 tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]);
225 if (tp_ops == NULL) { 225 if (tp_ops == NULL) {
226#ifdef CONFIG_KMOD 226#ifdef CONFIG_KMOD
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 0df911fd67b1..64465bacbe79 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -444,7 +444,8 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl,
444 return nla_nest_end(skb, opts); 444 return nla_nest_end(skb, opts);
445 445
446nla_put_failure: 446nla_put_failure:
447 return nla_nest_cancel(skb, opts); 447 nla_nest_cancel(skb, opts);
448 return -EMSGSIZE;
448} 449}
449 450
450static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) 451static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb)
@@ -466,7 +467,8 @@ static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb)
466 return nla_nest_end(skb, opts); 467 return nla_nest_end(skb, opts);
467 468
468nla_put_failure: 469nla_put_failure:
469 return nla_nest_cancel(skb, opts); 470 nla_nest_cancel(skb, opts);
471 return -EMSGSIZE;
470} 472}
471 473
472static const struct Qdisc_class_ops dsmark_class_ops = { 474static const struct Qdisc_class_ops dsmark_class_ops = {
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 3a9d226ff1e4..c89fba56db56 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -582,7 +582,8 @@ append_opt:
582 return nla_nest_end(skb, opts); 582 return nla_nest_end(skb, opts);
583 583
584nla_put_failure: 584nla_put_failure:
585 return nla_nest_cancel(skb, opts); 585 nla_nest_cancel(skb, opts);
586 return -EMSGSIZE;
586} 587}
587 588
588static void gred_destroy(struct Qdisc *sch) 589static void gred_destroy(struct Qdisc *sch)
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 87293d0db1d7..fdfaa3fcc16d 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1360,7 +1360,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
1360 1360
1361 nla_put_failure: 1361 nla_put_failure:
1362 nla_nest_cancel(skb, nest); 1362 nla_nest_cancel(skb, nest);
1363 return -1; 1363 return -EMSGSIZE;
1364} 1364}
1365 1365
1366static int 1366static int
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 3dcd493f4f4a..5c569853b9c0 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -281,7 +281,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
281 return nla_nest_end(skb, opts); 281 return nla_nest_end(skb, opts);
282 282
283nla_put_failure: 283nla_put_failure:
284 return nla_nest_cancel(skb, opts); 284 nla_nest_cancel(skb, opts);
285 return -EMSGSIZE;
285} 286}
286 287
287static int red_dump_stats(struct Qdisc *sch, struct gnet_dump *d) 288static int red_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index b4cd2b71953f..532634861db1 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1203,6 +1203,9 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
1203 struct list_head *head = &asoc->peer.transport_addr_list; 1203 struct list_head *head = &asoc->peer.transport_addr_list;
1204 struct list_head *pos; 1204 struct list_head *pos;
1205 1205
1206 if (asoc->peer.transport_count == 1)
1207 return;
1208
1206 /* Find the next transport in a round-robin fashion. */ 1209 /* Find the next transport in a round-robin fashion. */
1207 t = asoc->peer.retran_path; 1210 t = asoc->peer.retran_path;
1208 pos = &t->transports; 1211 pos = &t->transports;
@@ -1217,6 +1220,15 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
1217 1220
1218 t = list_entry(pos, struct sctp_transport, transports); 1221 t = list_entry(pos, struct sctp_transport, transports);
1219 1222
1223 /* We have exhausted the list, but didn't find any
1224 * other active transports. If so, use the next
1225 * transport.
1226 */
1227 if (t == asoc->peer.retran_path) {
1228 t = next;
1229 break;
1230 }
1231
1220 /* Try to find an active transport. */ 1232 /* Try to find an active transport. */
1221 1233
1222 if ((t->state == SCTP_ACTIVE) || 1234 if ((t->state == SCTP_ACTIVE) ||
@@ -1229,15 +1241,6 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
1229 if (!next) 1241 if (!next)
1230 next = t; 1242 next = t;
1231 } 1243 }
1232
1233 /* We have exhausted the list, but didn't find any
1234 * other active transports. If so, use the next
1235 * transport.
1236 */
1237 if (t == asoc->peer.retran_path) {
1238 t = next;
1239 break;
1240 }
1241 } 1244 }
1242 1245
1243 asoc->peer.retran_path = t; 1246 asoc->peer.retran_path = t;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index e45e44c60635..a2f4d4d51593 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -299,7 +299,8 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
299/* Fills in the source address(saddr) based on the destination address(daddr) 299/* Fills in the source address(saddr) based on the destination address(daddr)
300 * and asoc's bind address list. 300 * and asoc's bind address list.
301 */ 301 */
302static void sctp_v6_get_saddr(struct sctp_association *asoc, 302static void sctp_v6_get_saddr(struct sctp_sock *sk,
303 struct sctp_association *asoc,
303 struct dst_entry *dst, 304 struct dst_entry *dst,
304 union sctp_addr *daddr, 305 union sctp_addr *daddr,
305 union sctp_addr *saddr) 306 union sctp_addr *saddr)
@@ -318,7 +319,7 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
318 if (!asoc) { 319 if (!asoc) {
319 ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, 320 ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL,
320 &daddr->v6.sin6_addr, 321 &daddr->v6.sin6_addr,
321 inet6_sk(asoc->base.sk)->srcprefs, 322 inet6_sk(&sk->inet.sk)->srcprefs,
322 &saddr->v6.sin6_addr); 323 &saddr->v6.sin6_addr);
323 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n", 324 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n",
324 NIP6(saddr->v6.sin6_addr)); 325 NIP6(saddr->v6.sin6_addr));
@@ -726,6 +727,11 @@ static void sctp_v6_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr)
726 seq_printf(seq, NIP6_FMT " ", NIP6(addr->v6.sin6_addr)); 727 seq_printf(seq, NIP6_FMT " ", NIP6(addr->v6.sin6_addr));
727} 728}
728 729
730static void sctp_v6_ecn_capable(struct sock *sk)
731{
732 inet6_sk(sk)->tclass |= INET_ECN_ECT_0;
733}
734
729/* Initialize a PF_INET6 socket msg_name. */ 735/* Initialize a PF_INET6 socket msg_name. */
730static void sctp_inet6_msgname(char *msgname, int *addr_len) 736static void sctp_inet6_msgname(char *msgname, int *addr_len)
731{ 737{
@@ -996,6 +1002,7 @@ static struct sctp_af sctp_af_inet6 = {
996 .skb_iif = sctp_v6_skb_iif, 1002 .skb_iif = sctp_v6_skb_iif,
997 .is_ce = sctp_v6_is_ce, 1003 .is_ce = sctp_v6_is_ce,
998 .seq_dump_addr = sctp_v6_seq_dump_addr, 1004 .seq_dump_addr = sctp_v6_seq_dump_addr,
1005 .ecn_capable = sctp_v6_ecn_capable,
999 .net_header_len = sizeof(struct ipv6hdr), 1006 .net_header_len = sizeof(struct ipv6hdr),
1000 .sockaddr_len = sizeof(struct sockaddr_in6), 1007 .sockaddr_len = sizeof(struct sockaddr_in6),
1001#ifdef CONFIG_COMPAT 1008#ifdef CONFIG_COMPAT
diff --git a/net/sctp/output.c b/net/sctp/output.c
index cf4f9fb6819d..6d45bae93b46 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -548,7 +548,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
548 * Note: The works for IPv6 layer checks this bit too later 548 * Note: The works for IPv6 layer checks this bit too later
549 * in transmission. See IP6_ECN_flow_xmit(). 549 * in transmission. See IP6_ECN_flow_xmit().
550 */ 550 */
551 INET_ECN_xmit(nskb->sk); 551 (*tp->af_specific->ecn_capable)(nskb->sk);
552 552
553 /* Set up the IP options. */ 553 /* Set up the IP options. */
554 /* BUG: not implemented 554 /* BUG: not implemented
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 59edfd25a19c..ace6770e9048 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -208,6 +208,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
208 INIT_LIST_HEAD(&q->sacked); 208 INIT_LIST_HEAD(&q->sacked);
209 INIT_LIST_HEAD(&q->abandoned); 209 INIT_LIST_HEAD(&q->abandoned);
210 210
211 q->fast_rtx = 0;
211 q->outstanding_bytes = 0; 212 q->outstanding_bytes = 0;
212 q->empty = 1; 213 q->empty = 1;
213 q->cork = 0; 214 q->cork = 0;
@@ -500,6 +501,7 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
500 case SCTP_RTXR_FAST_RTX: 501 case SCTP_RTXR_FAST_RTX:
501 SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); 502 SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS);
502 sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX); 503 sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX);
504 q->fast_rtx = 1;
503 break; 505 break;
504 case SCTP_RTXR_PMTUD: 506 case SCTP_RTXR_PMTUD:
505 SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS); 507 SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS);
@@ -518,9 +520,15 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
518 * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by 520 * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by
519 * following the procedures outlined in C1 - C5. 521 * following the procedures outlined in C1 - C5.
520 */ 522 */
521 sctp_generate_fwdtsn(q, q->asoc->ctsn_ack_point); 523 if (reason == SCTP_RTXR_T3_RTX)
524 sctp_generate_fwdtsn(q, q->asoc->ctsn_ack_point);
522 525
523 error = sctp_outq_flush(q, /* rtx_timeout */ 1); 526 /* Flush the queues only on timeout, since fast_rtx is only
527 * triggered during sack processing and the queue
528 * will be flushed at the end.
529 */
530 if (reason != SCTP_RTXR_FAST_RTX)
531 error = sctp_outq_flush(q, /* rtx_timeout */ 1);
524 532
525 if (error) 533 if (error)
526 q->asoc->base.sk->sk_err = -error; 534 q->asoc->base.sk->sk_err = -error;
@@ -538,17 +546,23 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
538 int rtx_timeout, int *start_timer) 546 int rtx_timeout, int *start_timer)
539{ 547{
540 struct list_head *lqueue; 548 struct list_head *lqueue;
541 struct list_head *lchunk;
542 struct sctp_transport *transport = pkt->transport; 549 struct sctp_transport *transport = pkt->transport;
543 sctp_xmit_t status; 550 sctp_xmit_t status;
544 struct sctp_chunk *chunk, *chunk1; 551 struct sctp_chunk *chunk, *chunk1;
545 struct sctp_association *asoc; 552 struct sctp_association *asoc;
553 int fast_rtx;
546 int error = 0; 554 int error = 0;
555 int timer = 0;
556 int done = 0;
547 557
548 asoc = q->asoc; 558 asoc = q->asoc;
549 lqueue = &q->retransmit; 559 lqueue = &q->retransmit;
560 fast_rtx = q->fast_rtx;
550 561
551 /* RFC 2960 6.3.3 Handle T3-rtx Expiration 562 /* This loop handles time-out retransmissions, fast retransmissions,
563 * and retransmissions due to opening of whindow.
564 *
565 * RFC 2960 6.3.3 Handle T3-rtx Expiration
552 * 566 *
553 * E3) Determine how many of the earliest (i.e., lowest TSN) 567 * E3) Determine how many of the earliest (i.e., lowest TSN)
554 * outstanding DATA chunks for the address for which the 568 * outstanding DATA chunks for the address for which the
@@ -563,12 +577,12 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
563 * [Just to be painfully clear, if we are retransmitting 577 * [Just to be painfully clear, if we are retransmitting
564 * because a timeout just happened, we should send only ONE 578 * because a timeout just happened, we should send only ONE
565 * packet of retransmitted data.] 579 * packet of retransmitted data.]
580 *
581 * For fast retransmissions we also send only ONE packet. However,
582 * if we are just flushing the queue due to open window, we'll
583 * try to send as much as possible.
566 */ 584 */
567 lchunk = sctp_list_dequeue(lqueue); 585 list_for_each_entry_safe(chunk, chunk1, lqueue, transmitted_list) {
568
569 while (lchunk) {
570 chunk = list_entry(lchunk, struct sctp_chunk,
571 transmitted_list);
572 586
573 /* Make sure that Gap Acked TSNs are not retransmitted. A 587 /* Make sure that Gap Acked TSNs are not retransmitted. A
574 * simple approach is just to move such TSNs out of the 588 * simple approach is just to move such TSNs out of the
@@ -576,58 +590,60 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
576 * next chunk. 590 * next chunk.
577 */ 591 */
578 if (chunk->tsn_gap_acked) { 592 if (chunk->tsn_gap_acked) {
579 list_add_tail(lchunk, &transport->transmitted); 593 list_del(&chunk->transmitted_list);
580 lchunk = sctp_list_dequeue(lqueue); 594 list_add_tail(&chunk->transmitted_list,
595 &transport->transmitted);
581 continue; 596 continue;
582 } 597 }
583 598
599 /* If we are doing fast retransmit, ignore non-fast_rtransmit
600 * chunks
601 */
602 if (fast_rtx && !chunk->fast_retransmit)
603 continue;
604
584 /* Attempt to append this chunk to the packet. */ 605 /* Attempt to append this chunk to the packet. */
585 status = sctp_packet_append_chunk(pkt, chunk); 606 status = sctp_packet_append_chunk(pkt, chunk);
586 607
587 switch (status) { 608 switch (status) {
588 case SCTP_XMIT_PMTU_FULL: 609 case SCTP_XMIT_PMTU_FULL:
589 /* Send this packet. */ 610 /* Send this packet. */
590 if ((error = sctp_packet_transmit(pkt)) == 0) 611 error = sctp_packet_transmit(pkt);
591 *start_timer = 1;
592 612
593 /* If we are retransmitting, we should only 613 /* If we are retransmitting, we should only
594 * send a single packet. 614 * send a single packet.
595 */ 615 */
596 if (rtx_timeout) { 616 if (rtx_timeout || fast_rtx)
597 list_add(lchunk, lqueue); 617 done = 1;
598 lchunk = NULL;
599 }
600 618
601 /* Bundle lchunk in the next round. */ 619 /* Bundle next chunk in the next round. */
602 break; 620 break;
603 621
604 case SCTP_XMIT_RWND_FULL: 622 case SCTP_XMIT_RWND_FULL:
605 /* Send this packet. */ 623 /* Send this packet. */
606 if ((error = sctp_packet_transmit(pkt)) == 0) 624 error = sctp_packet_transmit(pkt);
607 *start_timer = 1;
608 625
609 /* Stop sending DATA as there is no more room 626 /* Stop sending DATA as there is no more room
610 * at the receiver. 627 * at the receiver.
611 */ 628 */
612 list_add(lchunk, lqueue); 629 done = 1;
613 lchunk = NULL;
614 break; 630 break;
615 631
616 case SCTP_XMIT_NAGLE_DELAY: 632 case SCTP_XMIT_NAGLE_DELAY:
617 /* Send this packet. */ 633 /* Send this packet. */
618 if ((error = sctp_packet_transmit(pkt)) == 0) 634 error = sctp_packet_transmit(pkt);
619 *start_timer = 1;
620 635
621 /* Stop sending DATA because of nagle delay. */ 636 /* Stop sending DATA because of nagle delay. */
622 list_add(lchunk, lqueue); 637 done = 1;
623 lchunk = NULL;
624 break; 638 break;
625 639
626 default: 640 default:
627 /* The append was successful, so add this chunk to 641 /* The append was successful, so add this chunk to
628 * the transmitted list. 642 * the transmitted list.
629 */ 643 */
630 list_add_tail(lchunk, &transport->transmitted); 644 list_del(&chunk->transmitted_list);
645 list_add_tail(&chunk->transmitted_list,
646 &transport->transmitted);
631 647
632 /* Mark the chunk as ineligible for fast retransmit 648 /* Mark the chunk as ineligible for fast retransmit
633 * after it is retransmitted. 649 * after it is retransmitted.
@@ -635,27 +651,44 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
635 if (chunk->fast_retransmit > 0) 651 if (chunk->fast_retransmit > 0)
636 chunk->fast_retransmit = -1; 652 chunk->fast_retransmit = -1;
637 653
638 *start_timer = 1; 654 /* Force start T3-rtx timer when fast retransmitting
639 q->empty = 0; 655 * the earliest outstanding TSN
656 */
657 if (!timer && fast_rtx &&
658 ntohl(chunk->subh.data_hdr->tsn) ==
659 asoc->ctsn_ack_point + 1)
660 timer = 2;
640 661
641 /* Retrieve a new chunk to bundle. */ 662 q->empty = 0;
642 lchunk = sctp_list_dequeue(lqueue);
643 break; 663 break;
644 } 664 }
645 665
646 /* If we are here due to a retransmit timeout or a fast 666 /* Set the timer if there were no errors */
647 * retransmit and if there are any chunks left in the retransmit 667 if (!error && !timer)
648 * queue that could not fit in the PMTU sized packet, they need 668 timer = 1;
649 * to be marked as ineligible for a subsequent fast retransmit. 669
650 */ 670 if (done)
651 if (rtx_timeout && !lchunk) { 671 break;
652 list_for_each_entry(chunk1, lqueue, transmitted_list) { 672 }
653 if (chunk1->fast_retransmit > 0) 673
654 chunk1->fast_retransmit = -1; 674 /* If we are here due to a retransmit timeout or a fast
655 } 675 * retransmit and if there are any chunks left in the retransmit
676 * queue that could not fit in the PMTU sized packet, they need
677 * to be marked as ineligible for a subsequent fast retransmit.
678 */
679 if (rtx_timeout || fast_rtx) {
680 list_for_each_entry(chunk1, lqueue, transmitted_list) {
681 if (chunk1->fast_retransmit > 0)
682 chunk1->fast_retransmit = -1;
656 } 683 }
657 } 684 }
658 685
686 *start_timer = timer;
687
688 /* Clear fast retransmit hint */
689 if (fast_rtx)
690 q->fast_rtx = 0;
691
659 return error; 692 return error;
660} 693}
661 694
@@ -862,7 +895,8 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
862 rtx_timeout, &start_timer); 895 rtx_timeout, &start_timer);
863 896
864 if (start_timer) 897 if (start_timer)
865 sctp_transport_reset_timers(transport); 898 sctp_transport_reset_timers(transport,
899 start_timer-1);
866 900
867 /* This can happen on COOKIE-ECHO resend. Only 901 /* This can happen on COOKIE-ECHO resend. Only
868 * one chunk can get bundled with a COOKIE-ECHO. 902 * one chunk can get bundled with a COOKIE-ECHO.
@@ -977,7 +1011,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
977 list_add_tail(&chunk->transmitted_list, 1011 list_add_tail(&chunk->transmitted_list,
978 &transport->transmitted); 1012 &transport->transmitted);
979 1013
980 sctp_transport_reset_timers(transport); 1014 sctp_transport_reset_timers(transport, start_timer-1);
981 1015
982 q->empty = 0; 1016 q->empty = 0;
983 1017
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 0ec234b762c2..b435a193c5df 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -470,11 +470,11 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
470 /* Walk through the bind address list and look for a bind 470 /* Walk through the bind address list and look for a bind
471 * address that matches the source address of the returned dst. 471 * address that matches the source address of the returned dst.
472 */ 472 */
473 sctp_v4_dst_saddr(&dst_saddr, dst, htons(bp->port));
473 rcu_read_lock(); 474 rcu_read_lock();
474 list_for_each_entry_rcu(laddr, &bp->address_list, list) { 475 list_for_each_entry_rcu(laddr, &bp->address_list, list) {
475 if (!laddr->valid || (laddr->state != SCTP_ADDR_SRC)) 476 if (!laddr->valid || (laddr->state != SCTP_ADDR_SRC))
476 continue; 477 continue;
477 sctp_v4_dst_saddr(&dst_saddr, dst, htons(bp->port));
478 if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a)) 478 if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a))
479 goto out_unlock; 479 goto out_unlock;
480 } 480 }
@@ -519,7 +519,8 @@ out:
519/* For v4, the source address is cached in the route entry(dst). So no need 519/* For v4, the source address is cached in the route entry(dst). So no need
520 * to cache it separately and hence this is an empty routine. 520 * to cache it separately and hence this is an empty routine.
521 */ 521 */
522static void sctp_v4_get_saddr(struct sctp_association *asoc, 522static void sctp_v4_get_saddr(struct sctp_sock *sk,
523 struct sctp_association *asoc,
523 struct dst_entry *dst, 524 struct dst_entry *dst,
524 union sctp_addr *daddr, 525 union sctp_addr *daddr,
525 union sctp_addr *saddr) 526 union sctp_addr *saddr)
@@ -616,6 +617,11 @@ static void sctp_v4_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr)
616 seq_printf(seq, "%d.%d.%d.%d ", NIPQUAD(addr->v4.sin_addr)); 617 seq_printf(seq, "%d.%d.%d.%d ", NIPQUAD(addr->v4.sin_addr));
617} 618}
618 619
620static void sctp_v4_ecn_capable(struct sock *sk)
621{
622 INET_ECN_xmit(sk);
623}
624
619/* Event handler for inet address addition/deletion events. 625/* Event handler for inet address addition/deletion events.
620 * The sctp_local_addr_list needs to be protocted by a spin lock since 626 * The sctp_local_addr_list needs to be protocted by a spin lock since
621 * multiple notifiers (say IPv4 and IPv6) may be running at the same 627 * multiple notifiers (say IPv4 and IPv6) may be running at the same
@@ -934,6 +940,7 @@ static struct sctp_af sctp_af_inet = {
934 .skb_iif = sctp_v4_skb_iif, 940 .skb_iif = sctp_v4_skb_iif,
935 .is_ce = sctp_v4_is_ce, 941 .is_ce = sctp_v4_is_ce,
936 .seq_dump_addr = sctp_v4_seq_dump_addr, 942 .seq_dump_addr = sctp_v4_seq_dump_addr,
943 .ecn_capable = sctp_v4_ecn_capable,
937 .net_header_len = sizeof(struct iphdr), 944 .net_header_len = sizeof(struct iphdr),
938 .sockaddr_len = sizeof(struct sockaddr_in), 945 .sockaddr_len = sizeof(struct sockaddr_in),
939#ifdef CONFIG_COMPAT 946#ifdef CONFIG_COMPAT
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 81b606424e12..bbc7107c86cf 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2418,7 +2418,8 @@ static int sctp_process_param(struct sctp_association *asoc,
2418 break; 2418 break;
2419 2419
2420 case SCTP_PARAM_IPV6_ADDRESS: 2420 case SCTP_PARAM_IPV6_ADDRESS:
2421 asoc->peer.ipv6_address = 1; 2421 if (PF_INET6 == asoc->base.sk->sk_family)
2422 asoc->peer.ipv6_address = 1;
2422 break; 2423 break;
2423 2424
2424 case SCTP_PARAM_HOST_NAME_ADDRESS: 2425 case SCTP_PARAM_HOST_NAME_ADDRESS:
@@ -2829,6 +2830,19 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2829 addr_param = (union sctp_addr_param *) 2830 addr_param = (union sctp_addr_param *)
2830 ((void *)asconf_param + sizeof(sctp_addip_param_t)); 2831 ((void *)asconf_param + sizeof(sctp_addip_param_t));
2831 2832
2833 switch (addr_param->v4.param_hdr.type) {
2834 case SCTP_PARAM_IPV6_ADDRESS:
2835 if (!asoc->peer.ipv6_address)
2836 return SCTP_ERROR_INV_PARAM;
2837 break;
2838 case SCTP_PARAM_IPV4_ADDRESS:
2839 if (!asoc->peer.ipv4_address)
2840 return SCTP_ERROR_INV_PARAM;
2841 break;
2842 default:
2843 return SCTP_ERROR_INV_PARAM;
2844 }
2845
2832 af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type)); 2846 af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type));
2833 if (unlikely(!af)) 2847 if (unlikely(!af))
2834 return SCTP_ERROR_INV_PARAM; 2848 return SCTP_ERROR_INV_PARAM;
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index f4938f6c5abe..3f34f61221ec 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -79,6 +79,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
79 peer->rttvar = 0; 79 peer->rttvar = 0;
80 peer->srtt = 0; 80 peer->srtt = 0;
81 peer->rto_pending = 0; 81 peer->rto_pending = 0;
82 peer->fast_recovery = 0;
82 83
83 peer->last_time_heard = jiffies; 84 peer->last_time_heard = jiffies;
84 peer->last_time_used = jiffies; 85 peer->last_time_used = jiffies;
@@ -190,7 +191,7 @@ static void sctp_transport_destroy(struct sctp_transport *transport)
190/* Start T3_rtx timer if it is not already running and update the heartbeat 191/* Start T3_rtx timer if it is not already running and update the heartbeat
191 * timer. This routine is called every time a DATA chunk is sent. 192 * timer. This routine is called every time a DATA chunk is sent.
192 */ 193 */
193void sctp_transport_reset_timers(struct sctp_transport *transport) 194void sctp_transport_reset_timers(struct sctp_transport *transport, int force)
194{ 195{
195 /* RFC 2960 6.3.2 Retransmission Timer Rules 196 /* RFC 2960 6.3.2 Retransmission Timer Rules
196 * 197 *
@@ -200,7 +201,7 @@ void sctp_transport_reset_timers(struct sctp_transport *transport)
200 * address. 201 * address.
201 */ 202 */
202 203
203 if (!timer_pending(&transport->T3_rtx_timer)) 204 if (force || !timer_pending(&transport->T3_rtx_timer))
204 if (!mod_timer(&transport->T3_rtx_timer, 205 if (!mod_timer(&transport->T3_rtx_timer,
205 jiffies + transport->rto)) 206 jiffies + transport->rto))
206 sctp_transport_hold(transport); 207 sctp_transport_hold(transport);
@@ -291,7 +292,7 @@ void sctp_transport_route(struct sctp_transport *transport,
291 if (saddr) 292 if (saddr)
292 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr)); 293 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
293 else 294 else
294 af->get_saddr(asoc, dst, daddr, &transport->saddr); 295 af->get_saddr(opt, asoc, dst, daddr, &transport->saddr);
295 296
296 transport->dst = dst; 297 transport->dst = dst;
297 if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) { 298 if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {
@@ -403,11 +404,16 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
403 cwnd = transport->cwnd; 404 cwnd = transport->cwnd;
404 flight_size = transport->flight_size; 405 flight_size = transport->flight_size;
405 406
407 /* See if we need to exit Fast Recovery first */
408 if (transport->fast_recovery &&
409 TSN_lte(transport->fast_recovery_exit, sack_ctsn))
410 transport->fast_recovery = 0;
411
406 /* The appropriate cwnd increase algorithm is performed if, and only 412 /* The appropriate cwnd increase algorithm is performed if, and only
407 * if the cumulative TSN has advanced and the congestion window is 413 * if the cumulative TSN whould advanced and the congestion window is
408 * being fully utilized. 414 * being fully utilized.
409 */ 415 */
410 if ((transport->asoc->ctsn_ack_point >= sack_ctsn) || 416 if (TSN_lte(sack_ctsn, transport->asoc->ctsn_ack_point) ||
411 (flight_size < cwnd)) 417 (flight_size < cwnd))
412 return; 418 return;
413 419
@@ -416,17 +422,23 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
416 pmtu = transport->asoc->pathmtu; 422 pmtu = transport->asoc->pathmtu;
417 423
418 if (cwnd <= ssthresh) { 424 if (cwnd <= ssthresh) {
419 /* RFC 2960 7.2.1, sctpimpguide-05 2.14.2 When cwnd is less 425 /* RFC 4960 7.2.1
420 * than or equal to ssthresh an SCTP endpoint MUST use the 426 * o When cwnd is less than or equal to ssthresh, an SCTP
421 * slow start algorithm to increase cwnd only if the current 427 * endpoint MUST use the slow-start algorithm to increase
422 * congestion window is being fully utilized and an incoming 428 * cwnd only if the current congestion window is being fully
423 * SACK advances the Cumulative TSN Ack Point. Only when these 429 * utilized, an incoming SACK advances the Cumulative TSN
424 * two conditions are met can the cwnd be increased otherwise 430 * Ack Point, and the data sender is not in Fast Recovery.
425 * the cwnd MUST not be increased. If these conditions are met 431 * Only when these three conditions are met can the cwnd be
426 * then cwnd MUST be increased by at most the lesser of 432 * increased; otherwise, the cwnd MUST not be increased.
427 * 1) the total size of the previously outstanding DATA 433 * If these conditions are met, then cwnd MUST be increased
428 * chunk(s) acknowledged, and 2) the destination's path MTU. 434 * by, at most, the lesser of 1) the total size of the
435 * previously outstanding DATA chunk(s) acknowledged, and
436 * 2) the destination's path MTU. This upper bound protects
437 * against the ACK-Splitting attack outlined in [SAVAGE99].
429 */ 438 */
439 if (transport->fast_recovery)
440 return;
441
430 if (bytes_acked > pmtu) 442 if (bytes_acked > pmtu)
431 cwnd += pmtu; 443 cwnd += pmtu;
432 else 444 else
@@ -502,6 +514,13 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
502 * cwnd = ssthresh 514 * cwnd = ssthresh
503 * partial_bytes_acked = 0 515 * partial_bytes_acked = 0
504 */ 516 */
517 if (transport->fast_recovery)
518 return;
519
520 /* Mark Fast recovery */
521 transport->fast_recovery = 1;
522 transport->fast_recovery_exit = transport->asoc->next_tsn - 1;
523
505 transport->ssthresh = max(transport->cwnd/2, 524 transport->ssthresh = max(transport->cwnd/2,
506 4*transport->asoc->pathmtu); 525 4*transport->asoc->pathmtu);
507 transport->cwnd = transport->ssthresh; 526 transport->cwnd = transport->ssthresh;
@@ -586,6 +605,7 @@ void sctp_transport_reset(struct sctp_transport *t)
586 t->flight_size = 0; 605 t->flight_size = 0;
587 t->error_count = 0; 606 t->error_count = 0;
588 t->rto_pending = 0; 607 t->rto_pending = 0;
608 t->fast_recovery = 0;
589 609
590 /* Initialize the state information for SFR-CACC */ 610 /* Initialize the state information for SFR-CACC */
591 t->cacc.changeover_active = 0; 611 t->cacc.changeover_active = 0;
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c
index d927d9f57412..744b79fdcb19 100644
--- a/net/sunrpc/auth_generic.c
+++ b/net/sunrpc/auth_generic.c
@@ -17,8 +17,8 @@
17# define RPCDBG_FACILITY RPCDBG_AUTH 17# define RPCDBG_FACILITY RPCDBG_AUTH
18#endif 18#endif
19 19
20#define RPC_ANONYMOUS_USERID ((uid_t)-2) 20#define RPC_MACHINE_CRED_USERID ((uid_t)0)
21#define RPC_ANONYMOUS_GROUPID ((gid_t)-2) 21#define RPC_MACHINE_CRED_GROUPID ((gid_t)0)
22 22
23struct generic_cred { 23struct generic_cred {
24 struct rpc_cred gc_base; 24 struct rpc_cred gc_base;
@@ -44,8 +44,8 @@ EXPORT_SYMBOL_GPL(rpc_lookup_cred);
44struct rpc_cred *rpc_lookup_machine_cred(void) 44struct rpc_cred *rpc_lookup_machine_cred(void)
45{ 45{
46 struct auth_cred acred = { 46 struct auth_cred acred = {
47 .uid = RPC_ANONYMOUS_USERID, 47 .uid = RPC_MACHINE_CRED_USERID,
48 .gid = RPC_ANONYMOUS_GROUPID, 48 .gid = RPC_MACHINE_CRED_GROUPID,
49 .machine_cred = 1, 49 .machine_cred = 1,
50 }; 50 };
51 51
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index d8e8d79a8451..e46c825f4954 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -6,30 +6,9 @@
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/fcntl.h>
10#include <linux/net.h>
11#include <linux/in.h>
12#include <linux/inet.h>
13#include <linux/udp.h>
14#include <linux/tcp.h>
15#include <linux/unistd.h>
16#include <linux/slab.h>
17#include <linux/netdevice.h>
18#include <linux/skbuff.h>
19#include <linux/file.h>
20#include <linux/freezer.h> 9#include <linux/freezer.h>
21#include <linux/kthread.h> 10#include <linux/kthread.h>
22#include <net/sock.h> 11#include <net/sock.h>
23#include <net/checksum.h>
24#include <net/ip.h>
25#include <net/ipv6.h>
26#include <net/tcp_states.h>
27#include <linux/uaccess.h>
28#include <asm/ioctls.h>
29
30#include <linux/sunrpc/types.h>
31#include <linux/sunrpc/clnt.h>
32#include <linux/sunrpc/xdr.h>
33#include <linux/sunrpc/stats.h> 12#include <linux/sunrpc/stats.h>
34#include <linux/sunrpc/svc_xprt.h> 13#include <linux/sunrpc/svc_xprt.h>
35 14
@@ -296,8 +275,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt)
296 if (!(xprt->xpt_flags & 275 if (!(xprt->xpt_flags &
297 ((1<<XPT_CONN)|(1<<XPT_DATA)|(1<<XPT_CLOSE)|(1<<XPT_DEFERRED)))) 276 ((1<<XPT_CONN)|(1<<XPT_DATA)|(1<<XPT_CLOSE)|(1<<XPT_DEFERRED))))
298 return; 277 return;
299 if (test_bit(XPT_DEAD, &xprt->xpt_flags))
300 return;
301 278
302 cpu = get_cpu(); 279 cpu = get_cpu();
303 pool = svc_pool_for_cpu(xprt->xpt_server, cpu); 280 pool = svc_pool_for_cpu(xprt->xpt_server, cpu);
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 3f30ee6006ae..f24800f2c098 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -278,7 +278,7 @@ static int ip_map_show(struct seq_file *m,
278 dom = im->m_client->h.name; 278 dom = im->m_client->h.name;
279 279
280 if (ipv6_addr_v4mapped(&addr)) { 280 if (ipv6_addr_v4mapped(&addr)) {
281 seq_printf(m, "%s" NIPQUAD_FMT "%s\n", 281 seq_printf(m, "%s " NIPQUAD_FMT " %s\n",
282 im->m_class, 282 im->m_class,
283 ntohl(addr.s6_addr32[3]) >> 24 & 0xff, 283 ntohl(addr.s6_addr32[3]) >> 24 & 0xff,
284 ntohl(addr.s6_addr32[3]) >> 16 & 0xff, 284 ntohl(addr.s6_addr32[3]) >> 16 & 0xff,
@@ -286,7 +286,7 @@ static int ip_map_show(struct seq_file *m,
286 ntohl(addr.s6_addr32[3]) >> 0 & 0xff, 286 ntohl(addr.s6_addr32[3]) >> 0 & 0xff,
287 dom); 287 dom);
288 } else { 288 } else {
289 seq_printf(m, "%s" NIP6_FMT "%s\n", 289 seq_printf(m, "%s " NIP6_FMT " %s\n",
290 im->m_class, NIP6(addr), dom); 290 im->m_class, NIP6(addr), dom);
291 } 291 }
292 return 0; 292 return 0;
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index c22d6b6f2db4..06ab4841537b 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -260,11 +260,16 @@ static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count)
260 * On our side, we need to read into a pagelist. The first page immediately 260 * On our side, we need to read into a pagelist. The first page immediately
261 * follows the RPC header. 261 * follows the RPC header.
262 * 262 *
263 * This function returns 1 to indicate success. The data is not yet in 263 * This function returns:
264 * 0 - No error and no read-list found.
265 *
266 * 1 - Successful read-list processing. The data is not yet in
264 * the pagelist and therefore the RPC request must be deferred. The 267 * the pagelist and therefore the RPC request must be deferred. The
265 * I/O completion will enqueue the transport again and 268 * I/O completion will enqueue the transport again and
266 * svc_rdma_recvfrom will complete the request. 269 * svc_rdma_recvfrom will complete the request.
267 * 270 *
271 * <0 - Error processing/posting read-list.
272 *
268 * NOTE: The ctxt must not be touched after the last WR has been posted 273 * NOTE: The ctxt must not be touched after the last WR has been posted
269 * because the I/O completion processing may occur on another 274 * because the I/O completion processing may occur on another
270 * processor and free / modify the context. Ne touche pas! 275 * processor and free / modify the context. Ne touche pas!
@@ -284,7 +289,6 @@ static int rdma_read_xdr(struct svcxprt_rdma *xprt,
284 u64 sgl_offset; 289 u64 sgl_offset;
285 struct rpcrdma_read_chunk *ch; 290 struct rpcrdma_read_chunk *ch;
286 struct svc_rdma_op_ctxt *ctxt = NULL; 291 struct svc_rdma_op_ctxt *ctxt = NULL;
287 struct svc_rdma_op_ctxt *head;
288 struct svc_rdma_op_ctxt *tmp_sge_ctxt; 292 struct svc_rdma_op_ctxt *tmp_sge_ctxt;
289 struct svc_rdma_op_ctxt *tmp_ch_ctxt; 293 struct svc_rdma_op_ctxt *tmp_ch_ctxt;
290 struct chunk_sge *ch_sge_ary; 294 struct chunk_sge *ch_sge_ary;
@@ -302,25 +306,19 @@ static int rdma_read_xdr(struct svcxprt_rdma *xprt,
302 ch_sge_ary = (struct chunk_sge *)tmp_ch_ctxt->sge; 306 ch_sge_ary = (struct chunk_sge *)tmp_ch_ctxt->sge;
303 307
304 svc_rdma_rcl_chunk_counts(ch, &ch_count, &byte_count); 308 svc_rdma_rcl_chunk_counts(ch, &ch_count, &byte_count);
309 if (ch_count > RPCSVC_MAXPAGES)
310 return -EINVAL;
305 sge_count = rdma_rcl_to_sge(xprt, rqstp, hdr_ctxt, rmsgp, 311 sge_count = rdma_rcl_to_sge(xprt, rqstp, hdr_ctxt, rmsgp,
306 sge, ch_sge_ary, 312 sge, ch_sge_ary,
307 ch_count, byte_count); 313 ch_count, byte_count);
308 head = svc_rdma_get_context(xprt);
309 sgl_offset = 0; 314 sgl_offset = 0;
310 ch_no = 0; 315 ch_no = 0;
311 316
312 for (ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; 317 for (ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
313 ch->rc_discrim != 0; ch++, ch_no++) { 318 ch->rc_discrim != 0; ch++, ch_no++) {
314next_sge: 319next_sge:
315 if (!ctxt) 320 ctxt = svc_rdma_get_context(xprt);
316 ctxt = head;
317 else {
318 ctxt->next = svc_rdma_get_context(xprt);
319 ctxt = ctxt->next;
320 }
321 ctxt->next = NULL;
322 ctxt->direction = DMA_FROM_DEVICE; 321 ctxt->direction = DMA_FROM_DEVICE;
323 clear_bit(RDMACTXT_F_READ_DONE, &ctxt->flags);
324 clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags); 322 clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
325 323
326 /* Prepare READ WR */ 324 /* Prepare READ WR */
@@ -347,20 +345,15 @@ next_sge:
347 * the client and the RPC needs to be enqueued. 345 * the client and the RPC needs to be enqueued.
348 */ 346 */
349 set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags); 347 set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
350 ctxt->next = hdr_ctxt; 348 ctxt->read_hdr = hdr_ctxt;
351 hdr_ctxt->next = head;
352 } 349 }
353 /* Post the read */ 350 /* Post the read */
354 err = svc_rdma_send(xprt, &read_wr); 351 err = svc_rdma_send(xprt, &read_wr);
355 if (err) { 352 if (err) {
356 printk(KERN_ERR "svcrdma: Error posting send = %d\n", 353 printk(KERN_ERR "svcrdma: Error %d posting RDMA_READ\n",
357 err); 354 err);
358 /* 355 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
359 * Break the circular list so free knows when 356 svc_rdma_put_context(ctxt, 0);
360 * to stop if the error happened to occur on
361 * the last read
362 */
363 ctxt->next = NULL;
364 goto out; 357 goto out;
365 } 358 }
366 atomic_inc(&rdma_stat_read); 359 atomic_inc(&rdma_stat_read);
@@ -371,7 +364,7 @@ next_sge:
371 goto next_sge; 364 goto next_sge;
372 } 365 }
373 sgl_offset = 0; 366 sgl_offset = 0;
374 err = 0; 367 err = 1;
375 } 368 }
376 369
377 out: 370 out:
@@ -389,25 +382,12 @@ next_sge:
389 while (rqstp->rq_resused) 382 while (rqstp->rq_resused)
390 rqstp->rq_respages[--rqstp->rq_resused] = NULL; 383 rqstp->rq_respages[--rqstp->rq_resused] = NULL;
391 384
392 if (err) { 385 return err;
393 printk(KERN_ERR "svcrdma : RDMA_READ error = %d\n", err);
394 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
395 /* Free the linked list of read contexts */
396 while (head != NULL) {
397 ctxt = head->next;
398 svc_rdma_put_context(head, 1);
399 head = ctxt;
400 }
401 return 0;
402 }
403
404 return 1;
405} 386}
406 387
407static int rdma_read_complete(struct svc_rqst *rqstp, 388static int rdma_read_complete(struct svc_rqst *rqstp,
408 struct svc_rdma_op_ctxt *data) 389 struct svc_rdma_op_ctxt *head)
409{ 390{
410 struct svc_rdma_op_ctxt *head = data->next;
411 int page_no; 391 int page_no;
412 int ret; 392 int ret;
413 393
@@ -433,21 +413,12 @@ static int rdma_read_complete(struct svc_rqst *rqstp,
433 rqstp->rq_arg.len = head->arg.len; 413 rqstp->rq_arg.len = head->arg.len;
434 rqstp->rq_arg.buflen = head->arg.buflen; 414 rqstp->rq_arg.buflen = head->arg.buflen;
435 415
416 /* Free the context */
417 svc_rdma_put_context(head, 0);
418
436 /* XXX: What should this be? */ 419 /* XXX: What should this be? */
437 rqstp->rq_prot = IPPROTO_MAX; 420 rqstp->rq_prot = IPPROTO_MAX;
438 421 svc_xprt_copy_addrs(rqstp, rqstp->rq_xprt);
439 /*
440 * Free the contexts we used to build the RDMA_READ. We have
441 * to be careful here because the context list uses the same
442 * next pointer used to chain the contexts associated with the
443 * RDMA_READ
444 */
445 data->next = NULL; /* terminate circular list */
446 do {
447 data = head->next;
448 svc_rdma_put_context(head, 0);
449 head = data;
450 } while (head != NULL);
451 422
452 ret = rqstp->rq_arg.head[0].iov_len 423 ret = rqstp->rq_arg.head[0].iov_len
453 + rqstp->rq_arg.page_len 424 + rqstp->rq_arg.page_len
@@ -457,8 +428,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp,
457 ret, rqstp->rq_arg.len, rqstp->rq_arg.head[0].iov_base, 428 ret, rqstp->rq_arg.len, rqstp->rq_arg.head[0].iov_base,
458 rqstp->rq_arg.head[0].iov_len); 429 rqstp->rq_arg.head[0].iov_len);
459 430
460 /* Indicate that we've consumed an RQ credit */
461 rqstp->rq_xprt_ctxt = rqstp->rq_xprt;
462 svc_xprt_received(rqstp->rq_xprt); 431 svc_xprt_received(rqstp->rq_xprt);
463 return ret; 432 return ret;
464} 433}
@@ -480,13 +449,6 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
480 449
481 dprintk("svcrdma: rqstp=%p\n", rqstp); 450 dprintk("svcrdma: rqstp=%p\n", rqstp);
482 451
483 /*
484 * The rq_xprt_ctxt indicates if we've consumed an RQ credit
485 * or not. It is used in the rdma xpo_release_rqst function to
486 * determine whether or not to return an RQ WQE to the RQ.
487 */
488 rqstp->rq_xprt_ctxt = NULL;
489
490 spin_lock_bh(&rdma_xprt->sc_read_complete_lock); 452 spin_lock_bh(&rdma_xprt->sc_read_complete_lock);
491 if (!list_empty(&rdma_xprt->sc_read_complete_q)) { 453 if (!list_empty(&rdma_xprt->sc_read_complete_q)) {
492 ctxt = list_entry(rdma_xprt->sc_read_complete_q.next, 454 ctxt = list_entry(rdma_xprt->sc_read_complete_q.next,
@@ -537,21 +499,22 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
537 /* If the request is invalid, reply with an error */ 499 /* If the request is invalid, reply with an error */
538 if (len < 0) { 500 if (len < 0) {
539 if (len == -ENOSYS) 501 if (len == -ENOSYS)
540 (void)svc_rdma_send_error(rdma_xprt, rmsgp, ERR_VERS); 502 svc_rdma_send_error(rdma_xprt, rmsgp, ERR_VERS);
541 goto close_out; 503 goto close_out;
542 } 504 }
543 505
544 /* Read read-list data. If we would need to wait, defer 506 /* Read read-list data. */
545 * it. Not that in this case, we don't return the RQ credit 507 ret = rdma_read_xdr(rdma_xprt, rmsgp, rqstp, ctxt);
546 * until after the read completes. 508 if (ret > 0) {
547 */ 509 /* read-list posted, defer until data received from client. */
548 if (rdma_read_xdr(rdma_xprt, rmsgp, rqstp, ctxt)) {
549 svc_xprt_received(xprt); 510 svc_xprt_received(xprt);
550 return 0; 511 return 0;
551 } 512 }
552 513 if (ret < 0) {
553 /* Indicate we've consumed an RQ credit */ 514 /* Post of read-list failed, free context. */
554 rqstp->rq_xprt_ctxt = rqstp->rq_xprt; 515 svc_rdma_put_context(ctxt, 1);
516 return 0;
517 }
555 518
556 ret = rqstp->rq_arg.head[0].iov_len 519 ret = rqstp->rq_arg.head[0].iov_len
557 + rqstp->rq_arg.page_len 520 + rqstp->rq_arg.page_len
@@ -569,11 +532,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
569 return ret; 532 return ret;
570 533
571 close_out: 534 close_out:
572 if (ctxt) { 535 if (ctxt)
573 svc_rdma_put_context(ctxt, 1); 536 svc_rdma_put_context(ctxt, 1);
574 /* Indicate we've consumed an RQ credit */
575 rqstp->rq_xprt_ctxt = rqstp->rq_xprt;
576 }
577 dprintk("svcrdma: transport %p is closing\n", xprt); 537 dprintk("svcrdma: transport %p is closing\n", xprt);
578 /* 538 /*
579 * Set the close bit and enqueue it. svc_recv will see the 539 * Set the close bit and enqueue it. svc_recv will see the
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 981f190c1b39..fb82b1b683f8 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -389,6 +389,17 @@ static int send_reply(struct svcxprt_rdma *rdma,
389 int page_no; 389 int page_no;
390 int ret; 390 int ret;
391 391
392 /* Post a recv buffer to handle another request. */
393 ret = svc_rdma_post_recv(rdma);
394 if (ret) {
395 printk(KERN_INFO
396 "svcrdma: could not post a receive buffer, err=%d."
397 "Closing transport %p.\n", ret, rdma);
398 set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
399 svc_rdma_put_context(ctxt, 0);
400 return -ENOTCONN;
401 }
402
392 /* Prepare the context */ 403 /* Prepare the context */
393 ctxt->pages[0] = page; 404 ctxt->pages[0] = page;
394 ctxt->count = 1; 405 ctxt->count = 1;
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index af408fc12634..e132509d1db0 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -103,8 +103,8 @@ static int rdma_bump_context_cache(struct svcxprt_rdma *xprt)
103 spin_lock_bh(&xprt->sc_ctxt_lock); 103 spin_lock_bh(&xprt->sc_ctxt_lock);
104 if (ctxt) { 104 if (ctxt) {
105 at_least_one = 1; 105 at_least_one = 1;
106 ctxt->next = xprt->sc_ctxt_head; 106 INIT_LIST_HEAD(&ctxt->free_list);
107 xprt->sc_ctxt_head = ctxt; 107 list_add(&ctxt->free_list, &xprt->sc_ctxt_free);
108 } else { 108 } else {
109 /* kmalloc failed...give up for now */ 109 /* kmalloc failed...give up for now */
110 xprt->sc_ctxt_cnt--; 110 xprt->sc_ctxt_cnt--;
@@ -123,7 +123,7 @@ struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
123 123
124 while (1) { 124 while (1) {
125 spin_lock_bh(&xprt->sc_ctxt_lock); 125 spin_lock_bh(&xprt->sc_ctxt_lock);
126 if (unlikely(xprt->sc_ctxt_head == NULL)) { 126 if (unlikely(list_empty(&xprt->sc_ctxt_free))) {
127 /* Try to bump my cache. */ 127 /* Try to bump my cache. */
128 spin_unlock_bh(&xprt->sc_ctxt_lock); 128 spin_unlock_bh(&xprt->sc_ctxt_lock);
129 129
@@ -136,12 +136,15 @@ struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
136 schedule_timeout_uninterruptible(msecs_to_jiffies(500)); 136 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
137 continue; 137 continue;
138 } 138 }
139 ctxt = xprt->sc_ctxt_head; 139 ctxt = list_entry(xprt->sc_ctxt_free.next,
140 xprt->sc_ctxt_head = ctxt->next; 140 struct svc_rdma_op_ctxt,
141 free_list);
142 list_del_init(&ctxt->free_list);
141 spin_unlock_bh(&xprt->sc_ctxt_lock); 143 spin_unlock_bh(&xprt->sc_ctxt_lock);
142 ctxt->xprt = xprt; 144 ctxt->xprt = xprt;
143 INIT_LIST_HEAD(&ctxt->dto_q); 145 INIT_LIST_HEAD(&ctxt->dto_q);
144 ctxt->count = 0; 146 ctxt->count = 0;
147 atomic_inc(&xprt->sc_ctxt_used);
145 break; 148 break;
146 } 149 }
147 return ctxt; 150 return ctxt;
@@ -159,14 +162,15 @@ void svc_rdma_put_context(struct svc_rdma_op_ctxt *ctxt, int free_pages)
159 put_page(ctxt->pages[i]); 162 put_page(ctxt->pages[i]);
160 163
161 for (i = 0; i < ctxt->count; i++) 164 for (i = 0; i < ctxt->count; i++)
162 dma_unmap_single(xprt->sc_cm_id->device->dma_device, 165 ib_dma_unmap_single(xprt->sc_cm_id->device,
163 ctxt->sge[i].addr, 166 ctxt->sge[i].addr,
164 ctxt->sge[i].length, 167 ctxt->sge[i].length,
165 ctxt->direction); 168 ctxt->direction);
169
166 spin_lock_bh(&xprt->sc_ctxt_lock); 170 spin_lock_bh(&xprt->sc_ctxt_lock);
167 ctxt->next = xprt->sc_ctxt_head; 171 list_add(&ctxt->free_list, &xprt->sc_ctxt_free);
168 xprt->sc_ctxt_head = ctxt;
169 spin_unlock_bh(&xprt->sc_ctxt_lock); 172 spin_unlock_bh(&xprt->sc_ctxt_lock);
173 atomic_dec(&xprt->sc_ctxt_used);
170} 174}
171 175
172/* ib_cq event handler */ 176/* ib_cq event handler */
@@ -228,23 +232,8 @@ static void dto_tasklet_func(unsigned long data)
228 list_del_init(&xprt->sc_dto_q); 232 list_del_init(&xprt->sc_dto_q);
229 spin_unlock_irqrestore(&dto_lock, flags); 233 spin_unlock_irqrestore(&dto_lock, flags);
230 234
231 if (test_and_clear_bit(RDMAXPRT_RQ_PENDING, &xprt->sc_flags)) { 235 rq_cq_reap(xprt);
232 ib_req_notify_cq(xprt->sc_rq_cq, IB_CQ_NEXT_COMP); 236 sq_cq_reap(xprt);
233 rq_cq_reap(xprt);
234 set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags);
235 /*
236 * If data arrived before established event,
237 * don't enqueue. This defers RPC I/O until the
238 * RDMA connection is complete.
239 */
240 if (!test_bit(RDMAXPRT_CONN_PENDING, &xprt->sc_flags))
241 svc_xprt_enqueue(&xprt->sc_xprt);
242 }
243
244 if (test_and_clear_bit(RDMAXPRT_SQ_PENDING, &xprt->sc_flags)) {
245 ib_req_notify_cq(xprt->sc_sq_cq, IB_CQ_NEXT_COMP);
246 sq_cq_reap(xprt);
247 }
248 237
249 svc_xprt_put(&xprt->sc_xprt); 238 svc_xprt_put(&xprt->sc_xprt);
250 spin_lock_irqsave(&dto_lock, flags); 239 spin_lock_irqsave(&dto_lock, flags);
@@ -263,11 +252,15 @@ static void rq_comp_handler(struct ib_cq *cq, void *cq_context)
263 struct svcxprt_rdma *xprt = cq_context; 252 struct svcxprt_rdma *xprt = cq_context;
264 unsigned long flags; 253 unsigned long flags;
265 254
255 /* Guard against unconditional flush call for destroyed QP */
256 if (atomic_read(&xprt->sc_xprt.xpt_ref.refcount)==0)
257 return;
258
266 /* 259 /*
267 * Set the bit regardless of whether or not it's on the list 260 * Set the bit regardless of whether or not it's on the list
268 * because it may be on the list already due to an SQ 261 * because it may be on the list already due to an SQ
269 * completion. 262 * completion.
270 */ 263 */
271 set_bit(RDMAXPRT_RQ_PENDING, &xprt->sc_flags); 264 set_bit(RDMAXPRT_RQ_PENDING, &xprt->sc_flags);
272 265
273 /* 266 /*
@@ -290,6 +283,8 @@ static void rq_comp_handler(struct ib_cq *cq, void *cq_context)
290 * 283 *
291 * Take all completing WC off the CQE and enqueue the associated DTO 284 * Take all completing WC off the CQE and enqueue the associated DTO
292 * context on the dto_q for the transport. 285 * context on the dto_q for the transport.
286 *
287 * Note that caller must hold a transport reference.
293 */ 288 */
294static void rq_cq_reap(struct svcxprt_rdma *xprt) 289static void rq_cq_reap(struct svcxprt_rdma *xprt)
295{ 290{
@@ -297,29 +292,47 @@ static void rq_cq_reap(struct svcxprt_rdma *xprt)
297 struct ib_wc wc; 292 struct ib_wc wc;
298 struct svc_rdma_op_ctxt *ctxt = NULL; 293 struct svc_rdma_op_ctxt *ctxt = NULL;
299 294
295 if (!test_and_clear_bit(RDMAXPRT_RQ_PENDING, &xprt->sc_flags))
296 return;
297
298 ib_req_notify_cq(xprt->sc_rq_cq, IB_CQ_NEXT_COMP);
300 atomic_inc(&rdma_stat_rq_poll); 299 atomic_inc(&rdma_stat_rq_poll);
301 300
302 spin_lock_bh(&xprt->sc_rq_dto_lock);
303 while ((ret = ib_poll_cq(xprt->sc_rq_cq, 1, &wc)) > 0) { 301 while ((ret = ib_poll_cq(xprt->sc_rq_cq, 1, &wc)) > 0) {
304 ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id; 302 ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id;
305 ctxt->wc_status = wc.status; 303 ctxt->wc_status = wc.status;
306 ctxt->byte_len = wc.byte_len; 304 ctxt->byte_len = wc.byte_len;
307 if (wc.status != IB_WC_SUCCESS) { 305 if (wc.status != IB_WC_SUCCESS) {
308 /* Close the transport */ 306 /* Close the transport */
307 dprintk("svcrdma: transport closing putting ctxt %p\n", ctxt);
309 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags); 308 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
310 svc_rdma_put_context(ctxt, 1); 309 svc_rdma_put_context(ctxt, 1);
310 svc_xprt_put(&xprt->sc_xprt);
311 continue; 311 continue;
312 } 312 }
313 spin_lock_bh(&xprt->sc_rq_dto_lock);
313 list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q); 314 list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q);
315 spin_unlock_bh(&xprt->sc_rq_dto_lock);
316 svc_xprt_put(&xprt->sc_xprt);
314 } 317 }
315 spin_unlock_bh(&xprt->sc_rq_dto_lock);
316 318
317 if (ctxt) 319 if (ctxt)
318 atomic_inc(&rdma_stat_rq_prod); 320 atomic_inc(&rdma_stat_rq_prod);
321
322 set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags);
323 /*
324 * If data arrived before established event,
325 * don't enqueue. This defers RPC I/O until the
326 * RDMA connection is complete.
327 */
328 if (!test_bit(RDMAXPRT_CONN_PENDING, &xprt->sc_flags))
329 svc_xprt_enqueue(&xprt->sc_xprt);
319} 330}
320 331
321/* 332/*
322 * Send Queue Completion Handler - potentially called on interrupt context. 333 * Send Queue Completion Handler - potentially called on interrupt context.
334 *
335 * Note that caller must hold a transport reference.
323 */ 336 */
324static void sq_cq_reap(struct svcxprt_rdma *xprt) 337static void sq_cq_reap(struct svcxprt_rdma *xprt)
325{ 338{
@@ -328,6 +341,11 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt)
328 struct ib_cq *cq = xprt->sc_sq_cq; 341 struct ib_cq *cq = xprt->sc_sq_cq;
329 int ret; 342 int ret;
330 343
344
345 if (!test_and_clear_bit(RDMAXPRT_SQ_PENDING, &xprt->sc_flags))
346 return;
347
348 ib_req_notify_cq(xprt->sc_sq_cq, IB_CQ_NEXT_COMP);
331 atomic_inc(&rdma_stat_sq_poll); 349 atomic_inc(&rdma_stat_sq_poll);
332 while ((ret = ib_poll_cq(cq, 1, &wc)) > 0) { 350 while ((ret = ib_poll_cq(cq, 1, &wc)) > 0) {
333 ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id; 351 ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id;
@@ -349,14 +367,16 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt)
349 367
350 case IB_WR_RDMA_READ: 368 case IB_WR_RDMA_READ:
351 if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { 369 if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) {
370 struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr;
371 BUG_ON(!read_hdr);
352 set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); 372 set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags);
353 set_bit(RDMACTXT_F_READ_DONE, &ctxt->flags);
354 spin_lock_bh(&xprt->sc_read_complete_lock); 373 spin_lock_bh(&xprt->sc_read_complete_lock);
355 list_add_tail(&ctxt->dto_q, 374 list_add_tail(&read_hdr->dto_q,
356 &xprt->sc_read_complete_q); 375 &xprt->sc_read_complete_q);
357 spin_unlock_bh(&xprt->sc_read_complete_lock); 376 spin_unlock_bh(&xprt->sc_read_complete_lock);
358 svc_xprt_enqueue(&xprt->sc_xprt); 377 svc_xprt_enqueue(&xprt->sc_xprt);
359 } 378 }
379 svc_rdma_put_context(ctxt, 0);
360 break; 380 break;
361 381
362 default: 382 default:
@@ -365,6 +385,7 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt)
365 wc.opcode, wc.status); 385 wc.opcode, wc.status);
366 break; 386 break;
367 } 387 }
388 svc_xprt_put(&xprt->sc_xprt);
368 } 389 }
369 390
370 if (ctxt) 391 if (ctxt)
@@ -376,11 +397,15 @@ static void sq_comp_handler(struct ib_cq *cq, void *cq_context)
376 struct svcxprt_rdma *xprt = cq_context; 397 struct svcxprt_rdma *xprt = cq_context;
377 unsigned long flags; 398 unsigned long flags;
378 399
400 /* Guard against unconditional flush call for destroyed QP */
401 if (atomic_read(&xprt->sc_xprt.xpt_ref.refcount)==0)
402 return;
403
379 /* 404 /*
380 * Set the bit regardless of whether or not it's on the list 405 * Set the bit regardless of whether or not it's on the list
381 * because it may be on the list already due to an RQ 406 * because it may be on the list already due to an RQ
382 * completion. 407 * completion.
383 */ 408 */
384 set_bit(RDMAXPRT_SQ_PENDING, &xprt->sc_flags); 409 set_bit(RDMAXPRT_SQ_PENDING, &xprt->sc_flags);
385 410
386 /* 411 /*
@@ -407,28 +432,29 @@ static void create_context_cache(struct svcxprt_rdma *xprt,
407 xprt->sc_ctxt_max = ctxt_max; 432 xprt->sc_ctxt_max = ctxt_max;
408 xprt->sc_ctxt_bump = ctxt_bump; 433 xprt->sc_ctxt_bump = ctxt_bump;
409 xprt->sc_ctxt_cnt = 0; 434 xprt->sc_ctxt_cnt = 0;
410 xprt->sc_ctxt_head = NULL; 435 atomic_set(&xprt->sc_ctxt_used, 0);
436
437 INIT_LIST_HEAD(&xprt->sc_ctxt_free);
411 for (i = 0; i < ctxt_count; i++) { 438 for (i = 0; i < ctxt_count; i++) {
412 ctxt = kmalloc(sizeof(*ctxt), GFP_KERNEL); 439 ctxt = kmalloc(sizeof(*ctxt), GFP_KERNEL);
413 if (ctxt) { 440 if (ctxt) {
414 ctxt->next = xprt->sc_ctxt_head; 441 INIT_LIST_HEAD(&ctxt->free_list);
415 xprt->sc_ctxt_head = ctxt; 442 list_add(&ctxt->free_list, &xprt->sc_ctxt_free);
416 xprt->sc_ctxt_cnt++; 443 xprt->sc_ctxt_cnt++;
417 } 444 }
418 } 445 }
419} 446}
420 447
421static void destroy_context_cache(struct svc_rdma_op_ctxt *ctxt) 448static void destroy_context_cache(struct svcxprt_rdma *xprt)
422{ 449{
423 struct svc_rdma_op_ctxt *next; 450 while (!list_empty(&xprt->sc_ctxt_free)) {
424 if (!ctxt) 451 struct svc_rdma_op_ctxt *ctxt;
425 return; 452 ctxt = list_entry(xprt->sc_ctxt_free.next,
426 453 struct svc_rdma_op_ctxt,
427 do { 454 free_list);
428 next = ctxt->next; 455 list_del_init(&ctxt->free_list);
429 kfree(ctxt); 456 kfree(ctxt);
430 ctxt = next; 457 }
431 } while (next);
432} 458}
433 459
434static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv, 460static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv,
@@ -465,7 +491,7 @@ static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv,
465 reqs + 491 reqs +
466 cma_xprt->sc_sq_depth + 492 cma_xprt->sc_sq_depth +
467 RPCRDMA_MAX_THREADS + 1); /* max */ 493 RPCRDMA_MAX_THREADS + 1); /* max */
468 if (!cma_xprt->sc_ctxt_head) { 494 if (list_empty(&cma_xprt->sc_ctxt_free)) {
469 kfree(cma_xprt); 495 kfree(cma_xprt);
470 return NULL; 496 return NULL;
471 } 497 }
@@ -520,7 +546,12 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
520 recv_wr.num_sge = ctxt->count; 546 recv_wr.num_sge = ctxt->count;
521 recv_wr.wr_id = (u64)(unsigned long)ctxt; 547 recv_wr.wr_id = (u64)(unsigned long)ctxt;
522 548
549 svc_xprt_get(&xprt->sc_xprt);
523 ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr); 550 ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr);
551 if (ret) {
552 svc_xprt_put(&xprt->sc_xprt);
553 svc_rdma_put_context(ctxt, 1);
554 }
524 return ret; 555 return ret;
525} 556}
526 557
@@ -539,6 +570,7 @@ static void handle_connect_req(struct rdma_cm_id *new_cma_id)
539{ 570{
540 struct svcxprt_rdma *listen_xprt = new_cma_id->context; 571 struct svcxprt_rdma *listen_xprt = new_cma_id->context;
541 struct svcxprt_rdma *newxprt; 572 struct svcxprt_rdma *newxprt;
573 struct sockaddr *sa;
542 574
543 /* Create a new transport */ 575 /* Create a new transport */
544 newxprt = rdma_create_xprt(listen_xprt->sc_xprt.xpt_server, 0); 576 newxprt = rdma_create_xprt(listen_xprt->sc_xprt.xpt_server, 0);
@@ -551,6 +583,12 @@ static void handle_connect_req(struct rdma_cm_id *new_cma_id)
551 dprintk("svcrdma: Creating newxprt=%p, cm_id=%p, listenxprt=%p\n", 583 dprintk("svcrdma: Creating newxprt=%p, cm_id=%p, listenxprt=%p\n",
552 newxprt, newxprt->sc_cm_id, listen_xprt); 584 newxprt, newxprt->sc_cm_id, listen_xprt);
553 585
586 /* Set the local and remote addresses in the transport */
587 sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr;
588 svc_xprt_set_remote(&newxprt->sc_xprt, sa, svc_addr_len(sa));
589 sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr;
590 svc_xprt_set_local(&newxprt->sc_xprt, sa, svc_addr_len(sa));
591
554 /* 592 /*
555 * Enqueue the new transport on the accept queue of the listening 593 * Enqueue the new transport on the accept queue of the listening
556 * transport 594 * transport
@@ -627,6 +665,7 @@ static int rdma_cma_handler(struct rdma_cm_id *cma_id,
627 if (xprt) { 665 if (xprt) {
628 set_bit(XPT_CLOSE, &xprt->xpt_flags); 666 set_bit(XPT_CLOSE, &xprt->xpt_flags);
629 svc_xprt_enqueue(xprt); 667 svc_xprt_enqueue(xprt);
668 svc_xprt_put(xprt);
630 } 669 }
631 break; 670 break;
632 case RDMA_CM_EVENT_DEVICE_REMOVAL: 671 case RDMA_CM_EVENT_DEVICE_REMOVAL:
@@ -661,31 +700,27 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
661 700
662 cma_xprt = rdma_create_xprt(serv, 1); 701 cma_xprt = rdma_create_xprt(serv, 1);
663 if (!cma_xprt) 702 if (!cma_xprt)
664 return ERR_PTR(ENOMEM); 703 return ERR_PTR(-ENOMEM);
665 xprt = &cma_xprt->sc_xprt; 704 xprt = &cma_xprt->sc_xprt;
666 705
667 listen_id = rdma_create_id(rdma_listen_handler, cma_xprt, RDMA_PS_TCP); 706 listen_id = rdma_create_id(rdma_listen_handler, cma_xprt, RDMA_PS_TCP);
668 if (IS_ERR(listen_id)) { 707 if (IS_ERR(listen_id)) {
669 svc_xprt_put(&cma_xprt->sc_xprt); 708 ret = PTR_ERR(listen_id);
670 dprintk("svcrdma: rdma_create_id failed = %ld\n", 709 dprintk("svcrdma: rdma_create_id failed = %d\n", ret);
671 PTR_ERR(listen_id)); 710 goto err0;
672 return (void *)listen_id;
673 } 711 }
712
674 ret = rdma_bind_addr(listen_id, sa); 713 ret = rdma_bind_addr(listen_id, sa);
675 if (ret) { 714 if (ret) {
676 rdma_destroy_id(listen_id);
677 svc_xprt_put(&cma_xprt->sc_xprt);
678 dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret); 715 dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);
679 return ERR_PTR(ret); 716 goto err1;
680 } 717 }
681 cma_xprt->sc_cm_id = listen_id; 718 cma_xprt->sc_cm_id = listen_id;
682 719
683 ret = rdma_listen(listen_id, RPCRDMA_LISTEN_BACKLOG); 720 ret = rdma_listen(listen_id, RPCRDMA_LISTEN_BACKLOG);
684 if (ret) { 721 if (ret) {
685 rdma_destroy_id(listen_id);
686 svc_xprt_put(&cma_xprt->sc_xprt);
687 dprintk("svcrdma: rdma_listen failed = %d\n", ret); 722 dprintk("svcrdma: rdma_listen failed = %d\n", ret);
688 return ERR_PTR(ret); 723 goto err1;
689 } 724 }
690 725
691 /* 726 /*
@@ -696,6 +731,12 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
696 svc_xprt_set_local(&cma_xprt->sc_xprt, sa, salen); 731 svc_xprt_set_local(&cma_xprt->sc_xprt, sa, salen);
697 732
698 return &cma_xprt->sc_xprt; 733 return &cma_xprt->sc_xprt;
734
735 err1:
736 rdma_destroy_id(listen_id);
737 err0:
738 kfree(cma_xprt);
739 return ERR_PTR(ret);
699} 740}
700 741
701/* 742/*
@@ -716,7 +757,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
716 struct rdma_conn_param conn_param; 757 struct rdma_conn_param conn_param;
717 struct ib_qp_init_attr qp_attr; 758 struct ib_qp_init_attr qp_attr;
718 struct ib_device_attr devattr; 759 struct ib_device_attr devattr;
719 struct sockaddr *sa;
720 int ret; 760 int ret;
721 int i; 761 int i;
722 762
@@ -826,7 +866,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
826 newxprt->sc_sq_depth = qp_attr.cap.max_send_wr; 866 newxprt->sc_sq_depth = qp_attr.cap.max_send_wr;
827 newxprt->sc_max_requests = qp_attr.cap.max_recv_wr; 867 newxprt->sc_max_requests = qp_attr.cap.max_recv_wr;
828 } 868 }
829 svc_xprt_get(&newxprt->sc_xprt);
830 newxprt->sc_qp = newxprt->sc_cm_id->qp; 869 newxprt->sc_qp = newxprt->sc_cm_id->qp;
831 870
832 /* Register all of physical memory */ 871 /* Register all of physical memory */
@@ -850,6 +889,13 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
850 /* Swap out the handler */ 889 /* Swap out the handler */
851 newxprt->sc_cm_id->event_handler = rdma_cma_handler; 890 newxprt->sc_cm_id->event_handler = rdma_cma_handler;
852 891
892 /*
893 * Arm the CQs for the SQ and RQ before accepting so we can't
894 * miss the first message
895 */
896 ib_req_notify_cq(newxprt->sc_sq_cq, IB_CQ_NEXT_COMP);
897 ib_req_notify_cq(newxprt->sc_rq_cq, IB_CQ_NEXT_COMP);
898
853 /* Accept Connection */ 899 /* Accept Connection */
854 set_bit(RDMAXPRT_CONN_PENDING, &newxprt->sc_flags); 900 set_bit(RDMAXPRT_CONN_PENDING, &newxprt->sc_flags);
855 memset(&conn_param, 0, sizeof conn_param); 901 memset(&conn_param, 0, sizeof conn_param);
@@ -886,58 +932,26 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
886 newxprt->sc_max_requests, 932 newxprt->sc_max_requests,
887 newxprt->sc_ord); 933 newxprt->sc_ord);
888 934
889 /* Set the local and remote addresses in the transport */
890 sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr;
891 svc_xprt_set_remote(&newxprt->sc_xprt, sa, svc_addr_len(sa));
892 sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr;
893 svc_xprt_set_local(&newxprt->sc_xprt, sa, svc_addr_len(sa));
894
895 ib_req_notify_cq(newxprt->sc_sq_cq, IB_CQ_NEXT_COMP);
896 ib_req_notify_cq(newxprt->sc_rq_cq, IB_CQ_NEXT_COMP);
897 return &newxprt->sc_xprt; 935 return &newxprt->sc_xprt;
898 936
899 errout: 937 errout:
900 dprintk("svcrdma: failure accepting new connection rc=%d.\n", ret); 938 dprintk("svcrdma: failure accepting new connection rc=%d.\n", ret);
901 /* Take a reference in case the DTO handler runs */ 939 /* Take a reference in case the DTO handler runs */
902 svc_xprt_get(&newxprt->sc_xprt); 940 svc_xprt_get(&newxprt->sc_xprt);
903 if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp)) { 941 if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp))
904 ib_destroy_qp(newxprt->sc_qp); 942 ib_destroy_qp(newxprt->sc_qp);
905 svc_xprt_put(&newxprt->sc_xprt);
906 }
907 rdma_destroy_id(newxprt->sc_cm_id); 943 rdma_destroy_id(newxprt->sc_cm_id);
908 /* This call to put will destroy the transport */ 944 /* This call to put will destroy the transport */
909 svc_xprt_put(&newxprt->sc_xprt); 945 svc_xprt_put(&newxprt->sc_xprt);
910 return NULL; 946 return NULL;
911} 947}
912 948
913/*
914 * Post an RQ WQE to the RQ when the rqst is being released. This
915 * effectively returns an RQ credit to the client. The rq_xprt_ctxt
916 * will be null if the request is deferred due to an RDMA_READ or the
917 * transport had no data ready (EAGAIN). Note that an RPC deferred in
918 * svc_process will still return the credit, this is because the data
919 * is copied and no longer consume a WQE/WC.
920 */
921static void svc_rdma_release_rqst(struct svc_rqst *rqstp) 949static void svc_rdma_release_rqst(struct svc_rqst *rqstp)
922{ 950{
923 int err;
924 struct svcxprt_rdma *rdma =
925 container_of(rqstp->rq_xprt, struct svcxprt_rdma, sc_xprt);
926 if (rqstp->rq_xprt_ctxt) {
927 BUG_ON(rqstp->rq_xprt_ctxt != rdma);
928 err = svc_rdma_post_recv(rdma);
929 if (err)
930 dprintk("svcrdma: failed to post an RQ WQE error=%d\n",
931 err);
932 }
933 rqstp->rq_xprt_ctxt = NULL;
934} 951}
935 952
936/* 953/*
937 * When connected, an svc_xprt has at least three references: 954 * When connected, an svc_xprt has at least two references:
938 *
939 * - A reference held by the QP. We still hold that here because this
940 * code deletes the QP and puts the reference.
941 * 955 *
942 * - A reference held by the cm_id between the ESTABLISHED and 956 * - A reference held by the cm_id between the ESTABLISHED and
943 * DISCONNECTED events. If the remote peer disconnected first, this 957 * DISCONNECTED events. If the remote peer disconnected first, this
@@ -946,7 +960,7 @@ static void svc_rdma_release_rqst(struct svc_rqst *rqstp)
946 * - A reference held by the svc_recv code that called this function 960 * - A reference held by the svc_recv code that called this function
947 * as part of close processing. 961 * as part of close processing.
948 * 962 *
949 * At a minimum two references should still be held. 963 * At a minimum one references should still be held.
950 */ 964 */
951static void svc_rdma_detach(struct svc_xprt *xprt) 965static void svc_rdma_detach(struct svc_xprt *xprt)
952{ 966{
@@ -956,23 +970,53 @@ static void svc_rdma_detach(struct svc_xprt *xprt)
956 970
957 /* Disconnect and flush posted WQE */ 971 /* Disconnect and flush posted WQE */
958 rdma_disconnect(rdma->sc_cm_id); 972 rdma_disconnect(rdma->sc_cm_id);
959
960 /* Destroy the QP if present (not a listener) */
961 if (rdma->sc_qp && !IS_ERR(rdma->sc_qp)) {
962 ib_destroy_qp(rdma->sc_qp);
963 svc_xprt_put(xprt);
964 }
965
966 /* Destroy the CM ID */
967 rdma_destroy_id(rdma->sc_cm_id);
968} 973}
969 974
970static void svc_rdma_free(struct svc_xprt *xprt) 975static void __svc_rdma_free(struct work_struct *work)
971{ 976{
972 struct svcxprt_rdma *rdma = (struct svcxprt_rdma *)xprt; 977 struct svcxprt_rdma *rdma =
978 container_of(work, struct svcxprt_rdma, sc_work);
973 dprintk("svcrdma: svc_rdma_free(%p)\n", rdma); 979 dprintk("svcrdma: svc_rdma_free(%p)\n", rdma);
980
974 /* We should only be called from kref_put */ 981 /* We should only be called from kref_put */
975 BUG_ON(atomic_read(&xprt->xpt_ref.refcount) != 0); 982 BUG_ON(atomic_read(&rdma->sc_xprt.xpt_ref.refcount) != 0);
983
984 /*
985 * Destroy queued, but not processed read completions. Note
986 * that this cleanup has to be done before destroying the
987 * cm_id because the device ptr is needed to unmap the dma in
988 * svc_rdma_put_context.
989 */
990 spin_lock_bh(&rdma->sc_read_complete_lock);
991 while (!list_empty(&rdma->sc_read_complete_q)) {
992 struct svc_rdma_op_ctxt *ctxt;
993 ctxt = list_entry(rdma->sc_read_complete_q.next,
994 struct svc_rdma_op_ctxt,
995 dto_q);
996 list_del_init(&ctxt->dto_q);
997 svc_rdma_put_context(ctxt, 1);
998 }
999 spin_unlock_bh(&rdma->sc_read_complete_lock);
1000
1001 /* Destroy queued, but not processed recv completions */
1002 spin_lock_bh(&rdma->sc_rq_dto_lock);
1003 while (!list_empty(&rdma->sc_rq_dto_q)) {
1004 struct svc_rdma_op_ctxt *ctxt;
1005 ctxt = list_entry(rdma->sc_rq_dto_q.next,
1006 struct svc_rdma_op_ctxt,
1007 dto_q);
1008 list_del_init(&ctxt->dto_q);
1009 svc_rdma_put_context(ctxt, 1);
1010 }
1011 spin_unlock_bh(&rdma->sc_rq_dto_lock);
1012
1013 /* Warn if we leaked a resource or under-referenced */
1014 WARN_ON(atomic_read(&rdma->sc_ctxt_used) != 0);
1015
1016 /* Destroy the QP if present (not a listener) */
1017 if (rdma->sc_qp && !IS_ERR(rdma->sc_qp))
1018 ib_destroy_qp(rdma->sc_qp);
1019
976 if (rdma->sc_sq_cq && !IS_ERR(rdma->sc_sq_cq)) 1020 if (rdma->sc_sq_cq && !IS_ERR(rdma->sc_sq_cq))
977 ib_destroy_cq(rdma->sc_sq_cq); 1021 ib_destroy_cq(rdma->sc_sq_cq);
978 1022
@@ -985,10 +1029,21 @@ static void svc_rdma_free(struct svc_xprt *xprt)
985 if (rdma->sc_pd && !IS_ERR(rdma->sc_pd)) 1029 if (rdma->sc_pd && !IS_ERR(rdma->sc_pd))
986 ib_dealloc_pd(rdma->sc_pd); 1030 ib_dealloc_pd(rdma->sc_pd);
987 1031
988 destroy_context_cache(rdma->sc_ctxt_head); 1032 /* Destroy the CM ID */
1033 rdma_destroy_id(rdma->sc_cm_id);
1034
1035 destroy_context_cache(rdma);
989 kfree(rdma); 1036 kfree(rdma);
990} 1037}
991 1038
1039static void svc_rdma_free(struct svc_xprt *xprt)
1040{
1041 struct svcxprt_rdma *rdma =
1042 container_of(xprt, struct svcxprt_rdma, sc_xprt);
1043 INIT_WORK(&rdma->sc_work, __svc_rdma_free);
1044 schedule_work(&rdma->sc_work);
1045}
1046
992static int svc_rdma_has_wspace(struct svc_xprt *xprt) 1047static int svc_rdma_has_wspace(struct svc_xprt *xprt)
993{ 1048{
994 struct svcxprt_rdma *rdma = 1049 struct svcxprt_rdma *rdma =
@@ -1018,7 +1073,7 @@ int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
1018 int ret; 1073 int ret;
1019 1074
1020 if (test_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags)) 1075 if (test_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags))
1021 return 0; 1076 return -ENOTCONN;
1022 1077
1023 BUG_ON(wr->send_flags != IB_SEND_SIGNALED); 1078 BUG_ON(wr->send_flags != IB_SEND_SIGNALED);
1024 BUG_ON(((struct svc_rdma_op_ctxt *)(unsigned long)wr->wr_id)->wr_op != 1079 BUG_ON(((struct svc_rdma_op_ctxt *)(unsigned long)wr->wr_id)->wr_op !=
@@ -1029,7 +1084,8 @@ int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
1029 if (xprt->sc_sq_depth == atomic_read(&xprt->sc_sq_count)) { 1084 if (xprt->sc_sq_depth == atomic_read(&xprt->sc_sq_count)) {
1030 spin_unlock_bh(&xprt->sc_lock); 1085 spin_unlock_bh(&xprt->sc_lock);
1031 atomic_inc(&rdma_stat_sq_starve); 1086 atomic_inc(&rdma_stat_sq_starve);
1032 /* See if we can reap some SQ WR */ 1087
1088 /* See if we can opportunistically reap SQ WR to make room */
1033 sq_cq_reap(xprt); 1089 sq_cq_reap(xprt);
1034 1090
1035 /* Wait until SQ WR available if SQ still full */ 1091 /* Wait until SQ WR available if SQ still full */
@@ -1041,22 +1097,25 @@ int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
1041 continue; 1097 continue;
1042 } 1098 }
1043 /* Bumped used SQ WR count and post */ 1099 /* Bumped used SQ WR count and post */
1100 svc_xprt_get(&xprt->sc_xprt);
1044 ret = ib_post_send(xprt->sc_qp, wr, &bad_wr); 1101 ret = ib_post_send(xprt->sc_qp, wr, &bad_wr);
1045 if (!ret) 1102 if (!ret)
1046 atomic_inc(&xprt->sc_sq_count); 1103 atomic_inc(&xprt->sc_sq_count);
1047 else 1104 else {
1105 svc_xprt_put(&xprt->sc_xprt);
1048 dprintk("svcrdma: failed to post SQ WR rc=%d, " 1106 dprintk("svcrdma: failed to post SQ WR rc=%d, "
1049 "sc_sq_count=%d, sc_sq_depth=%d\n", 1107 "sc_sq_count=%d, sc_sq_depth=%d\n",
1050 ret, atomic_read(&xprt->sc_sq_count), 1108 ret, atomic_read(&xprt->sc_sq_count),
1051 xprt->sc_sq_depth); 1109 xprt->sc_sq_depth);
1110 }
1052 spin_unlock_bh(&xprt->sc_lock); 1111 spin_unlock_bh(&xprt->sc_lock);
1053 break; 1112 break;
1054 } 1113 }
1055 return ret; 1114 return ret;
1056} 1115}
1057 1116
1058int svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, 1117void svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp,
1059 enum rpcrdma_errcode err) 1118 enum rpcrdma_errcode err)
1060{ 1119{
1061 struct ib_send_wr err_wr; 1120 struct ib_send_wr err_wr;
1062 struct ib_sge sge; 1121 struct ib_sge sge;
@@ -1094,9 +1153,8 @@ int svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp,
1094 /* Post It */ 1153 /* Post It */
1095 ret = svc_rdma_send(xprt, &err_wr); 1154 ret = svc_rdma_send(xprt, &err_wr);
1096 if (ret) { 1155 if (ret) {
1097 dprintk("svcrdma: Error posting send = %d\n", ret); 1156 dprintk("svcrdma: Error %d posting send for protocol error\n",
1157 ret);
1098 svc_rdma_put_context(ctxt, 1); 1158 svc_rdma_put_context(ctxt, 1);
1099 } 1159 }
1100
1101 return ret;
1102} 1160}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 2bdd4dddc0e1..fb75f265b39c 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -187,7 +187,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
187 return genlmsg_end(msg, hdr); 187 return genlmsg_end(msg, hdr);
188 188
189 nla_put_failure: 189 nla_put_failure:
190 return genlmsg_cancel(msg, hdr); 190 genlmsg_cancel(msg, hdr);
191 return -EMSGSIZE;
191} 192}
192 193
193static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) 194static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
@@ -273,7 +274,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags,
273 return genlmsg_end(msg, hdr); 274 return genlmsg_end(msg, hdr);
274 275
275 nla_put_failure: 276 nla_put_failure:
276 return genlmsg_cancel(msg, hdr); 277 genlmsg_cancel(msg, hdr);
278 return -EMSGSIZE;
277} 279}
278 280
279static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb) 281static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb)
@@ -928,7 +930,8 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
928 return genlmsg_end(msg, hdr); 930 return genlmsg_end(msg, hdr);
929 931
930 nla_put_failure: 932 nla_put_failure:
931 return genlmsg_cancel(msg, hdr); 933 genlmsg_cancel(msg, hdr);
934 return -EMSGSIZE;
932} 935}
933 936
934static int nl80211_dump_station(struct sk_buff *skb, 937static int nl80211_dump_station(struct sk_buff *skb,
@@ -1267,7 +1270,8 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq,
1267 return genlmsg_end(msg, hdr); 1270 return genlmsg_end(msg, hdr);
1268 1271
1269 nla_put_failure: 1272 nla_put_failure:
1270 return genlmsg_cancel(msg, hdr); 1273 genlmsg_cancel(msg, hdr);
1274 return -EMSGSIZE;
1271} 1275}
1272 1276
1273static int nl80211_dump_mpath(struct sk_buff *skb, 1277static int nl80211_dump_mpath(struct sk_buff *skb,
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index ac765dd9c7f5..23a2cc04b8cd 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -200,8 +200,8 @@ static struct xfrm_algo_desc aalg_list[] = {
200 } 200 }
201}, 201},
202{ 202{
203 .name = "hmac(ripemd160)", 203 .name = "hmac(rmd160)",
204 .compat = "ripemd160", 204 .compat = "rmd160",
205 205
206 .uinfo = { 206 .uinfo = {
207 .auth = { 207 .auth = {
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 09cd9c0c2d80..3f964db908a7 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -25,11 +25,11 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
25 struct dst_entry *dst = skb->dst; 25 struct dst_entry *dst = skb->dst;
26 int nhead = dst->header_len + LL_RESERVED_SPACE(dst->dev) 26 int nhead = dst->header_len + LL_RESERVED_SPACE(dst->dev)
27 - skb_headroom(skb); 27 - skb_headroom(skb);
28 int ntail = dst->dev->needed_tailroom - skb_tailroom(skb);
28 29
29 if (nhead > 0) 30 if (nhead > 0 || ntail > 0)
30 return pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); 31 return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC);
31 32
32 /* Check tail too... */
33 return 0; 33 return 0;
34} 34}
35 35
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index a1b0fbe3ea35..b976d9ed10e4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -50,19 +50,8 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
50 50
51 switch (type) { 51 switch (type) {
52 case XFRMA_ALG_AUTH: 52 case XFRMA_ALG_AUTH:
53 if (!algp->alg_key_len &&
54 strcmp(algp->alg_name, "digest_null") != 0)
55 return -EINVAL;
56 break;
57
58 case XFRMA_ALG_CRYPT: 53 case XFRMA_ALG_CRYPT:
59 if (!algp->alg_key_len &&
60 strcmp(algp->alg_name, "cipher_null") != 0)
61 return -EINVAL;
62 break;
63
64 case XFRMA_ALG_COMP: 54 case XFRMA_ALG_COMP:
65 /* Zero length keys are legal. */
66 break; 55 break;
67 56
68 default: 57 default:
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index a098a0454dc8..17092d6c7db3 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -43,7 +43,13 @@ _modpost: __modpost
43include include/config/auto.conf 43include include/config/auto.conf
44include scripts/Kbuild.include 44include scripts/Kbuild.include
45 45
46# When building external modules load the Kbuild file to retreive EXTRA_SYMBOLS info
46ifneq ($(KBUILD_EXTMOD),) 47ifneq ($(KBUILD_EXTMOD),)
48
49# set src + obj - they may be used when building the .mod.c file
50obj := $(KBUILD_EXTMOD)
51src := $(obj)
52
47# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS 53# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
48include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ 54include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
49 $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) 55 $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b6bbbcdc557e..6971bf078d13 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.18'; 12my $V = '0.19';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -115,6 +115,7 @@ our $Attribute = qr{
115 __kprobes| 115 __kprobes|
116 __(?:mem|cpu|dev|)(?:initdata|init) 116 __(?:mem|cpu|dev|)(?:initdata|init)
117 }x; 117 }x;
118our $Modifier;
118our $Inline = qr{inline|__always_inline|noinline}; 119our $Inline = qr{inline|__always_inline|noinline};
119our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; 120our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
120our $Lval = qr{$Ident(?:$Member)*}; 121our $Lval = qr{$Ident(?:$Member)*};
@@ -144,17 +145,17 @@ our $UTF8 = qr {
144 145
145our @typeList = ( 146our @typeList = (
146 qr{void}, 147 qr{void},
147 qr{char}, 148 qr{(?:unsigned\s+)?char},
148 qr{short}, 149 qr{(?:unsigned\s+)?short},
149 qr{int}, 150 qr{(?:unsigned\s+)?int},
150 qr{long}, 151 qr{(?:unsigned\s+)?long},
152 qr{(?:unsigned\s+)?long\s+int},
153 qr{(?:unsigned\s+)?long\s+long},
154 qr{(?:unsigned\s+)?long\s+long\s+int},
151 qr{unsigned}, 155 qr{unsigned},
152 qr{float}, 156 qr{float},
153 qr{double}, 157 qr{double},
154 qr{bool}, 158 qr{bool},
155 qr{long\s+int},
156 qr{long\s+long},
157 qr{long\s+long\s+int},
158 qr{(?:__)?(?:u|s|be|le)(?:8|16|32|64)}, 159 qr{(?:__)?(?:u|s|be|le)(?:8|16|32|64)},
159 qr{struct\s+$Ident}, 160 qr{struct\s+$Ident},
160 qr{union\s+$Ident}, 161 qr{union\s+$Ident},
@@ -163,26 +164,29 @@ our @typeList = (
163 qr{${Ident}_handler}, 164 qr{${Ident}_handler},
164 qr{${Ident}_handler_fn}, 165 qr{${Ident}_handler_fn},
165); 166);
167our @modifierList = (
168 qr{fastcall},
169);
166 170
167sub build_types { 171sub build_types {
172 my $mods = "(?: \n" . join("|\n ", @modifierList) . "\n)";
168 my $all = "(?: \n" . join("|\n ", @typeList) . "\n)"; 173 my $all = "(?: \n" . join("|\n ", @typeList) . "\n)";
169 $NonptrType = qr{ 174 $NonptrType = qr{
170 \b
171 (?:const\s+)? 175 (?:const\s+)?
172 (?:unsigned\s+)? 176 (?:$mods\s+)?
173 (?: 177 (?:
174 $all| 178 (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)|
175 (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\) 179 (?:${all}\b)
176 ) 180 )
177 (?:\s+$Sparse|\s+const)* 181 (?:\s+$Sparse|\s+const)*
178 \b
179 }x; 182 }x;
180 $Type = qr{ 183 $Type = qr{
181 \b$NonptrType\b 184 $NonptrType
182 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)? 185 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
183 (?:\s+$Inline|\s+$Sparse|\s+$Attribute)* 186 (?:\s+$Inline|\s+$Sparse|\s+$Attribute|\s+$mods)*
184 }x; 187 }x;
185 $Declare = qr{(?:$Storage\s+)?$Type}; 188 $Declare = qr{(?:$Storage\s+)?$Type};
189 $Modifier = qr{(?:$Attribute|$Sparse|$mods)};
186} 190}
187build_types(); 191build_types();
188 192
@@ -329,7 +333,7 @@ sub sanitise_line {
329 $off++; 333 $off++;
330 next; 334 next;
331 } 335 }
332 if (substr($line, $off, 2) eq $sanitise_quote) { 336 if (substr($line, $off, 2) eq '*/') {
333 $sanitise_quote = ''; 337 $sanitise_quote = '';
334 substr($res, $off, 2, "$;$;"); 338 substr($res, $off, 2, "$;$;");
335 $off++; 339 $off++;
@@ -366,14 +370,14 @@ sub sanitise_line {
366 } 370 }
367 371
368 # The pathname on a #include may be surrounded by '<' and '>'. 372 # The pathname on a #include may be surrounded by '<' and '>'.
369 if ($res =~ /^.#\s*include\s+\<(.*)\>/) { 373 if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) {
370 my $clean = 'X' x length($1); 374 my $clean = 'X' x length($1);
371 $res =~ s@\<.*\>@<$clean>@; 375 $res =~ s@\<.*\>@<$clean>@;
372 376
373 # The whole of a #error is a string. 377 # The whole of a #error is a string.
374 } elsif ($res =~ /^.#\s*(?:error|warning)\s+(.*)\b/) { 378 } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
375 my $clean = 'X' x length($1); 379 my $clean = 'X' x length($1);
376 $res =~ s@(#\s*(?:error|warning)\s+).*@$1$clean@; 380 $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
377 } 381 }
378 382
379 return $res; 383 return $res;
@@ -715,7 +719,7 @@ sub annotate_values {
715 print "DECLARE($1)\n" if ($dbg_values > 1); 719 print "DECLARE($1)\n" if ($dbg_values > 1);
716 $type = 'T'; 720 $type = 'T';
717 721
718 } elsif ($cur =~ /^(#\s*define\s*$Ident)(\(?)/o) { 722 } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) {
719 print "DEFINE($1,$2)\n" if ($dbg_values > 1); 723 print "DEFINE($1,$2)\n" if ($dbg_values > 1);
720 $av_preprocessor = 1; 724 $av_preprocessor = 1;
721 push(@av_paren_type, $type); 725 push(@av_paren_type, $type);
@@ -724,12 +728,12 @@ sub annotate_values {
724 } 728 }
725 $type = 'E'; 729 $type = 'E';
726 730
727 } elsif ($cur =~ /^(#\s*undef\s*$Ident)/o) { 731 } elsif ($cur =~ /^(\#\s*(?:undef\s*$Ident|include\b))/o) {
728 print "UNDEF($1)\n" if ($dbg_values > 1); 732 print "UNDEF($1)\n" if ($dbg_values > 1);
729 $av_preprocessor = 1; 733 $av_preprocessor = 1;
730 push(@av_paren_type, $type); 734 push(@av_paren_type, $type);
731 735
732 } elsif ($cur =~ /^(#\s*(?:ifdef|ifndef|if))/o) { 736 } elsif ($cur =~ /^(\#\s*(?:ifdef|ifndef|if))/o) {
733 print "PRE_START($1)\n" if ($dbg_values > 1); 737 print "PRE_START($1)\n" if ($dbg_values > 1);
734 $av_preprocessor = 1; 738 $av_preprocessor = 1;
735 739
@@ -737,7 +741,7 @@ sub annotate_values {
737 push(@av_paren_type, $type); 741 push(@av_paren_type, $type);
738 $type = 'E'; 742 $type = 'E';
739 743
740 } elsif ($cur =~ /^(#\s*(?:else|elif))/o) { 744 } elsif ($cur =~ /^(\#\s*(?:else|elif))/o) {
741 print "PRE_RESTART($1)\n" if ($dbg_values > 1); 745 print "PRE_RESTART($1)\n" if ($dbg_values > 1);
742 $av_preprocessor = 1; 746 $av_preprocessor = 1;
743 747
@@ -745,7 +749,7 @@ sub annotate_values {
745 749
746 $type = 'E'; 750 $type = 'E';
747 751
748 } elsif ($cur =~ /^(#\s*(?:endif))/o) { 752 } elsif ($cur =~ /^(\#\s*(?:endif))/o) {
749 print "PRE_END($1)\n" if ($dbg_values > 1); 753 print "PRE_END($1)\n" if ($dbg_values > 1);
750 754
751 $av_preprocessor = 1; 755 $av_preprocessor = 1;
@@ -837,14 +841,26 @@ sub annotate_values {
837sub possible { 841sub possible {
838 my ($possible, $line) = @_; 842 my ($possible, $line) = @_;
839 843
840 #print "CHECK<$possible>\n"; 844 print "CHECK<$possible> ($line)\n" if ($dbg_possible > 1);
841 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ && 845 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
842 $possible ne 'goto' && $possible ne 'return' && 846 $possible ne 'goto' && $possible ne 'return' &&
843 $possible ne 'struct' && $possible ne 'enum' &&
844 $possible ne 'case' && $possible ne 'else' && 847 $possible ne 'case' && $possible ne 'else' &&
845 $possible ne 'typedef') { 848 $possible ne 'asm' &&
846 warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible); 849 $possible !~ /^(typedef|struct|enum)\b/) {
847 push(@typeList, $possible); 850 # Check for modifiers.
851 $possible =~ s/\s*$Storage\s*//g;
852 $possible =~ s/\s*$Sparse\s*//g;
853 if ($possible =~ /^\s*$/) {
854
855 } elsif ($possible =~ /\s/) {
856 $possible =~ s/\s*$Type\s*//g;
857 warn "MODIFIER: $possible ($line)\n" if ($dbg_possible);
858 push(@modifierList, $possible);
859
860 } else {
861 warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible);
862 push(@typeList, $possible);
863 }
848 build_types(); 864 build_types();
849 } 865 }
850} 866}
@@ -949,6 +965,7 @@ sub process {
949 } else { 965 } else {
950 $realcnt=1+1; 966 $realcnt=1+1;
951 } 967 }
968 $in_comment = 0;
952 969
953 # Guestimate if this is a continuing comment. Run 970 # Guestimate if this is a continuing comment. Run
954 # the context looking for a comment "edge". If this 971 # the context looking for a comment "edge". If this
@@ -1117,7 +1134,9 @@ sub process {
1117 ERROR("trailing whitespace\n" . $herevet); 1134 ERROR("trailing whitespace\n" . $herevet);
1118 } 1135 }
1119#80 column limit 1136#80 column limit
1120 if ($line =~ /^\+/ && !($prevrawline=~/\/\*\*/) && $length > 80) { 1137 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
1138 $rawline !~ /^.\s*\*\s*\@$Ident\s/ && $length > 80)
1139 {
1121 WARN("line over 80 characters\n" . $herecurr); 1140 WARN("line over 80 characters\n" . $herecurr);
1122 } 1141 }
1123 1142
@@ -1159,18 +1178,20 @@ sub process {
1159 # Ignore functions being called 1178 # Ignore functions being called
1160 } elsif ($s =~ /^.\s*$Ident\s*\(/s) { 1179 } elsif ($s =~ /^.\s*$Ident\s*\(/s) {
1161 1180
1181 # declarations always start with types
1182 } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))\s*(?:;|=|,|\()/s) {
1183 my $type = $1;
1184 $type =~ s/\s+/ /g;
1185 possible($type, "A:" . $s);
1186
1162 # definitions in global scope can only start with types 1187 # definitions in global scope can only start with types
1163 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/s) { 1188 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/s) {
1164 possible($1, $s); 1189 possible($1, "B:" . $s);
1165
1166 # declarations always start with types
1167 } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:const\s+)?($Ident)\b(:?\s+$Sparse)?\s*\**\s*$Ident\s*(?:;|=|,)/s) {
1168 possible($1, $s);
1169 } 1190 }
1170 1191
1171 # any (foo ... *) is a pointer cast, and foo is a type 1192 # any (foo ... *) is a pointer cast, and foo is a type
1172 while ($s =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/sg) { 1193 while ($s =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/sg) {
1173 possible($1, $s); 1194 possible($1, "C:" . $s);
1174 } 1195 }
1175 1196
1176 # Check for any sort of function declaration. 1197 # Check for any sort of function declaration.
@@ -1184,9 +1205,9 @@ sub process {
1184 $ctx =~ s/\)[^\)]*$//; 1205 $ctx =~ s/\)[^\)]*$//;
1185 1206
1186 for my $arg (split(/\s*,\s*/, $ctx)) { 1207 for my $arg (split(/\s*,\s*/, $ctx)) {
1187 if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/ || $arg =~ /^($Ident)$/) { 1208 if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/s || $arg =~ /^($Ident)$/s) {
1188 1209
1189 possible($1, $s); 1210 possible($1, "D:" . $s);
1190 } 1211 }
1191 } 1212 }
1192 } 1213 }
@@ -1221,7 +1242,7 @@ sub process {
1221 1242
1222# if/while/etc brace do not go on next line, unless defining a do while loop, 1243# if/while/etc brace do not go on next line, unless defining a do while loop,
1223# or if that brace on the next line is for something else 1244# or if that brace on the next line is for something else
1224 if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.#/) { 1245 if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) {
1225 my $pre_ctx = "$1$2"; 1246 my $pre_ctx = "$1$2";
1226 1247
1227 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); 1248 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
@@ -1239,7 +1260,7 @@ sub process {
1239 1260
1240 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { 1261 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
1241 ERROR("that open brace { should be on the previous line\n" . 1262 ERROR("that open brace { should be on the previous line\n" .
1242 "$here\n$ctx\n$lines[$ctx_ln - 1]"); 1263 "$here\n$ctx\n$lines[$ctx_ln - 1]\n");
1243 } 1264 }
1244 if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ && 1265 if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ &&
1245 $ctx =~ /\)\s*\;\s*$/ && 1266 $ctx =~ /\)\s*\;\s*$/ &&
@@ -1248,7 +1269,7 @@ sub process {
1248 my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]); 1269 my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]);
1249 if ($nindent > $indent) { 1270 if ($nindent > $indent) {
1250 WARN("trailing semicolon indicates no statements, indent implies otherwise\n" . 1271 WARN("trailing semicolon indicates no statements, indent implies otherwise\n" .
1251 "$here\n$ctx\n$lines[$ctx_ln - 1]"); 1272 "$here\n$ctx\n$lines[$ctx_ln - 1]\n");
1252 } 1273 }
1253 } 1274 }
1254 } 1275 }
@@ -1284,7 +1305,7 @@ sub process {
1284# 1305#
1285 1306
1286# check for malformed paths in #include statements (uses RAW line) 1307# check for malformed paths in #include statements (uses RAW line)
1287 if ($rawline =~ m{^.#\s*include\s+[<"](.*)[">]}) { 1308 if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) {
1288 my $path = $1; 1309 my $path = $1;
1289 if ($path =~ m{//}) { 1310 if ($path =~ m{//}) {
1290 ERROR("malformed #include filename\n" . 1311 ERROR("malformed #include filename\n" .
@@ -1316,7 +1337,7 @@ sub process {
1316 } 1337 }
1317 1338
1318# check for external initialisers. 1339# check for external initialisers.
1319 if ($line =~ /^.$Type\s*$Ident\s*=\s*(0|NULL|false)\s*;/) { 1340 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) {
1320 ERROR("do not initialise externals to 0 or NULL\n" . 1341 ERROR("do not initialise externals to 0 or NULL\n" .
1321 $herecurr); 1342 $herecurr);
1322 } 1343 }
@@ -1330,6 +1351,7 @@ sub process {
1330# make sense. 1351# make sense.
1331 if ($line =~ /\btypedef\s/ && 1352 if ($line =~ /\btypedef\s/ &&
1332 $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ && 1353 $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ &&
1354 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
1333 $line !~ /\b__bitwise(?:__|)\b/) { 1355 $line !~ /\b__bitwise(?:__|)\b/) {
1334 WARN("do not add new typedefs\n" . $herecurr); 1356 WARN("do not add new typedefs\n" . $herecurr);
1335 } 1357 }
@@ -1388,8 +1410,8 @@ sub process {
1388 1410
1389# function brace can't be on same line, except for #defines of do while, 1411# function brace can't be on same line, except for #defines of do while,
1390# or if closed on same line 1412# or if closed on same line
1391 if (($line=~/$Type\s*[A-Za-z\d_]+\(.*\).*\s{/) and 1413 if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and
1392 !($line=~/\#define.*do\s{/) and !($line=~/}/)) { 1414 !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
1393 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr); 1415 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
1394 } 1416 }
1395 1417
@@ -1416,10 +1438,10 @@ sub process {
1416 # cpp #define statements have non-optional spaces, ie 1438 # cpp #define statements have non-optional spaces, ie
1417 # if there is a space between the name and the open 1439 # if there is a space between the name and the open
1418 # parenthesis it is simply not a parameter group. 1440 # parenthesis it is simply not a parameter group.
1419 } elsif ($ctx_before =~ /^.\#\s*define\s*$/) { 1441 } elsif ($ctx_before =~ /^.\s*\#\s*define\s*$/) {
1420 1442
1421 # cpp #elif statement condition may start with a ( 1443 # cpp #elif statement condition may start with a (
1422 } elsif ($ctx =~ /^.\#\s*elif\s*$/) { 1444 } elsif ($ctx =~ /^.\s*\#\s*elif\s*$/) {
1423 1445
1424 # If this whole things ends with a type its most 1446 # If this whole things ends with a type its most
1425 # likely a typedef for a function. 1447 # likely a typedef for a function.
@@ -1625,13 +1647,14 @@ sub process {
1625 ERROR("space prohibited before that close square bracket ']'\n" . $herecurr); 1647 ERROR("space prohibited before that close square bracket ']'\n" . $herecurr);
1626 } 1648 }
1627 1649
1628# check spacing on paretheses 1650# check spacing on parentheses
1629 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ && 1651 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
1630 $line !~ /for\s*\(\s+;/) { 1652 $line !~ /for\s*\(\s+;/) {
1631 ERROR("space prohibited after that open parenthesis '('\n" . $herecurr); 1653 ERROR("space prohibited after that open parenthesis '('\n" . $herecurr);
1632 } 1654 }
1633 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ && 1655 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
1634 $line !~ /for\s*\(.*;\s+\)/) { 1656 $line !~ /for\s*\(.*;\s+\)/ &&
1657 $line !~ /:\s+\)/) {
1635 ERROR("space prohibited before that close parenthesis ')'\n" . $herecurr); 1658 ERROR("space prohibited before that close parenthesis ')'\n" . $herecurr);
1636 } 1659 }
1637 1660
@@ -1641,6 +1664,23 @@ sub process {
1641 WARN("labels should not be indented\n" . $herecurr); 1664 WARN("labels should not be indented\n" . $herecurr);
1642 } 1665 }
1643 1666
1667# Return is not a function.
1668 if (defined($stat) && $stat =~ /^.\s*return(\s*)(\(.*);/s) {
1669 my $spacing = $1;
1670 my $value = $2;
1671
1672 # Flatten any parentheses and braces
1673 while ($value =~ s/\([^\(\)]*\)/1/) {
1674 }
1675
1676 if ($value =~ /^(?:$Ident|-?$Constant)$/) {
1677 ERROR("return is not a function, parentheses are not required\n" . $herecurr);
1678
1679 } elsif ($spacing !~ /\s+/) {
1680 ERROR("space required before the open parenthesis '('\n" . $herecurr);
1681 }
1682 }
1683
1644# Need a space before open parenthesis after if, while etc 1684# Need a space before open parenthesis after if, while etc
1645 if ($line=~/\b(if|while|for|switch)\(/) { 1685 if ($line=~/\b(if|while|for|switch)\(/) {
1646 ERROR("space required before the open parenthesis '('\n" . $herecurr); 1686 ERROR("space required before the open parenthesis '('\n" . $herecurr);
@@ -1660,7 +1700,7 @@ sub process {
1660 $s =~ s/\n.*//g; 1700 $s =~ s/\n.*//g;
1661 $s =~ s/$;//g; # Remove any comments 1701 $s =~ s/$;//g; # Remove any comments
1662 if (length($c) && $s !~ /^\s*({|;|)\s*\\*\s*$/ && 1702 if (length($c) && $s !~ /^\s*({|;|)\s*\\*\s*$/ &&
1663 $c !~ /^.\#\s*if/) 1703 $c !~ /^.\s*\#\s*if/)
1664 { 1704 {
1665 ERROR("trailing statements should be on next line\n" . $herecurr); 1705 ERROR("trailing statements should be on next line\n" . $herecurr);
1666 } 1706 }
@@ -1719,14 +1759,16 @@ sub process {
1719# } 1759# }
1720 1760
1721#no spaces allowed after \ in define 1761#no spaces allowed after \ in define
1722 if ($line=~/\#define.*\\\s$/) { 1762 if ($line=~/\#\s*define.*\\\s$/) {
1723 WARN("Whitepspace after \\ makes next lines useless\n" . $herecurr); 1763 WARN("Whitepspace after \\ makes next lines useless\n" . $herecurr);
1724 } 1764 }
1725 1765
1726#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) 1766#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
1727 if ($tree && $rawline =~ m{^.\#\s*include\s*\<asm\/(.*)\.h\>}) { 1767 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
1728 my $checkfile = "$root/include/linux/$1.h"; 1768 my $checkfile = "include/linux/$1.h";
1729 if (-f $checkfile && $1 ne 'irq') { 1769 if (-f "$root/$checkfile" && $realfile ne $checkfile &&
1770 $1 ne 'irq')
1771 {
1730 WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" . 1772 WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" .
1731 $herecurr); 1773 $herecurr);
1732 } 1774 }
@@ -1735,45 +1777,87 @@ sub process {
1735# multi-statement macros should be enclosed in a do while loop, grab the 1777# multi-statement macros should be enclosed in a do while loop, grab the
1736# first statement and ensure its the whole macro if its not enclosed 1778# first statement and ensure its the whole macro if its not enclosed
1737# in a known good container 1779# in a known good container
1738 if ($prevline =~ /\#define.*\\/ && 1780 if ($line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
1739 $prevline !~/(?:do\s+{|\(\{|\{)/ &&
1740 $line !~ /(?:do\s+{|\(\{|\{)/ &&
1741 $line !~ /^.\s*$Declare\s/) {
1742 # Grab the first statement, if that is the entire macro
1743 # its ok. This may start either on the #define line
1744 # or the one below.
1745 my $ln = $linenr; 1781 my $ln = $linenr;
1746 my $cnt = $realcnt; 1782 my $cnt = $realcnt;
1747 my $off = 0; 1783 my ($off, $dstat, $dcond, $rest);
1784 my $ctx = '';
1748 1785
1749 # If the macro starts on the define line start 1786 my $args = defined($1);
1750 # grabbing the statement after the identifier 1787
1751 $prevline =~ m{^(.#\s*define\s*$Ident(?:\([^\)]*\))?\s*)(.*)\\\s*$}; 1788 # Find the end of the macro and limit our statement
1752 ##print "1<$1> 2<$2>\n"; 1789 # search to that.
1753 if (defined $2 && $2 ne '') { 1790 while ($cnt > 0 && defined $lines[$ln - 1] &&
1754 $off = length($1); 1791 $lines[$ln - 1] =~ /^(?:-|..*\\$)/)
1755 $ln--; 1792 {
1756 $cnt++; 1793 $ctx .= $rawlines[$ln - 1] . "\n";
1757 while ($lines[$ln - 1] =~ /^-/) { 1794 $ln++;
1758 $ln--; 1795 $cnt--;
1759 $cnt++; 1796 }
1760 } 1797 $ctx .= $rawlines[$ln - 1];
1798
1799 ($dstat, $dcond, $ln, $cnt, $off) =
1800 ctx_statement_block($linenr, $ln - $linenr + 1, 0);
1801 #print "dstat<$dstat> dcond<$dcond> cnt<$cnt> off<$off>\n";
1802 #print "LINE<$lines[$ln]> len<" . length($lines[$ln]) . "\n";
1803
1804 # Extract the remainder of the define (if any) and
1805 # rip off surrounding spaces, and trailing \'s.
1806 $rest = '';
1807 if (defined $lines[$ln - 1] &&
1808 $off > length($lines[$ln - 1]))
1809 {
1810 $ln++;
1811 $cnt--;
1812 $off = 0;
1813 }
1814 while ($cnt > 0) {
1815 $rest .= substr($lines[$ln - 1], $off) . "\n";
1816 $ln++;
1817 $cnt--;
1818 $off = 0;
1819 }
1820 $rest =~ s/\\\n.//g;
1821 $rest =~ s/^\s*//s;
1822 $rest =~ s/\s*$//s;
1823
1824 # Clean up the original statement.
1825 if ($args) {
1826 substr($dstat, 0, length($dcond), '');
1827 } else {
1828 $dstat =~ s/^.\s*\#\s*define\s+$Ident\s*//;
1761 } 1829 }
1762 my @ctx = ctx_statement($ln, $cnt, $off); 1830 $dstat =~ s/\\\n.//g;
1763 my $ctx_ln = $ln + $#ctx + 1; 1831 $dstat =~ s/^\s*//s;
1764 my $ctx = join("\n", @ctx); 1832 $dstat =~ s/\s*$//s;
1765 1833
1766 # Pull in any empty extension lines. 1834 # Flatten any parentheses and braces
1767 while ($ctx =~ /\\$/ && 1835 while ($dstat =~ s/\([^\(\)]*\)/1/) {
1768 $lines[$ctx_ln - 1] =~ /^.\s*(?:\\)?$/) { 1836 }
1769 $ctx .= $lines[$ctx_ln - 1]; 1837 while ($dstat =~ s/\{[^\{\}]*\}/1/) {
1770 $ctx_ln++;
1771 } 1838 }
1772 1839
1773 if ($ctx =~ /\\$/) { 1840 my $exceptions = qr{
1774 if ($ctx =~ /;/) { 1841 $Declare|
1842 module_param_named|
1843 MODULE_PARAM_DESC|
1844 DECLARE_PER_CPU|
1845 DEFINE_PER_CPU|
1846 __typeof__\(
1847 }x;
1848 if ($rest ne '') {
1849 if ($rest !~ /while\s*\(/ &&
1850 $dstat !~ /$exceptions/)
1851 {
1775 ERROR("Macros with multiple statements should be enclosed in a do - while loop\n" . "$here\n$ctx\n"); 1852 ERROR("Macros with multiple statements should be enclosed in a do - while loop\n" . "$here\n$ctx\n");
1776 } else { 1853 }
1854
1855 } elsif ($ctx !~ /;/) {
1856 if ($dstat ne '' &&
1857 $dstat !~ /^(?:$Ident|-?$Constant)$/ &&
1858 $dstat !~ /$exceptions/ &&
1859 $dstat =~ /$Operators/)
1860 {
1777 ERROR("Macros with complex values should be enclosed in parenthesis\n" . "$here\n$ctx\n"); 1861 ERROR("Macros with complex values should be enclosed in parenthesis\n" . "$here\n$ctx\n");
1778 } 1862 }
1779 } 1863 }
@@ -1884,7 +1968,7 @@ sub process {
1884 1968
1885# don't include deprecated include files (uses RAW line) 1969# don't include deprecated include files (uses RAW line)
1886 for my $inc (@dep_includes) { 1970 for my $inc (@dep_includes) {
1887 if ($rawline =~ m@\#\s*include\s*\<$inc>@) { 1971 if ($rawline =~ m@^.\s*\#\s*include\s*\<$inc>@) {
1888 ERROR("Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr); 1972 ERROR("Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr);
1889 } 1973 }
1890 } 1974 }
@@ -1908,7 +1992,7 @@ sub process {
1908 } 1992 }
1909 1993
1910# warn about #if 0 1994# warn about #if 0
1911 if ($line =~ /^.#\s*if\s+0\b/) { 1995 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
1912 CHK("if this code is redundant consider removing it\n" . 1996 CHK("if this code is redundant consider removing it\n" .
1913 $herecurr); 1997 $herecurr);
1914 } 1998 }
@@ -1920,23 +2004,16 @@ sub process {
1920 WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev); 2004 WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev);
1921 } 2005 }
1922 } 2006 }
1923# check for needless usb_free_urb() checks
1924 if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {
1925 my $expr = $1;
1926 if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) {
1927 WARN("usb_free_urb(NULL) is safe this check is probabally not required\n" . $hereprev);
1928 }
1929 }
1930 2007
1931# warn about #ifdefs in C files 2008# warn about #ifdefs in C files
1932# if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { 2009# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
1933# print "#ifdef in C files should be avoided\n"; 2010# print "#ifdef in C files should be avoided\n";
1934# print "$herecurr"; 2011# print "$herecurr";
1935# $clean = 0; 2012# $clean = 0;
1936# } 2013# }
1937 2014
1938# warn about spacing in #ifdefs 2015# warn about spacing in #ifdefs
1939 if ($line =~ /^.#\s*(ifdef|ifndef|elif)\s\s+/) { 2016 if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) {
1940 ERROR("exactly one space required after that #$1\n" . $herecurr); 2017 ERROR("exactly one space required after that #$1\n" . $herecurr);
1941 } 2018 }
1942 2019
@@ -1955,7 +2032,7 @@ sub process {
1955 } 2032 }
1956 } 2033 }
1957# check of hardware specific defines 2034# check of hardware specific defines
1958 if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) { 2035 if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
1959 CHK("architecture specific defines should be avoided\n" . $herecurr); 2036 CHK("architecture specific defines should be avoided\n" . $herecurr);
1960 } 2037 }
1961 2038
@@ -1973,15 +2050,18 @@ sub process {
1973 2050
1974# check for new externs in .c files. 2051# check for new externs in .c files.
1975 if ($realfile =~ /\.c$/ && defined $stat && 2052 if ($realfile =~ /\.c$/ && defined $stat &&
1976 $stat =~ /^.\s*(?:extern\s+)?$Type\s+$Ident(\s*)\(/s) 2053 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
1977 { 2054 {
1978 my $paren_space = $1; 2055 my $function_name = $1;
2056 my $paren_space = $2;
1979 2057
1980 my $s = $stat; 2058 my $s = $stat;
1981 if (defined $cond) { 2059 if (defined $cond) {
1982 substr($s, 0, length($cond), ''); 2060 substr($s, 0, length($cond), '');
1983 } 2061 }
1984 if ($s =~ /^\s*;/) { 2062 if ($s =~ /^\s*;/ &&
2063 $function_name ne 'uninitialized_var')
2064 {
1985 WARN("externs should be avoided in .c files\n" . $herecurr); 2065 WARN("externs should be avoided in .c files\n" . $herecurr);
1986 } 2066 }
1987 2067
@@ -2030,8 +2110,8 @@ sub process {
2030# use of NR_CPUS is usually wrong 2110# use of NR_CPUS is usually wrong
2031# ignore definitions of NR_CPUS and usage to define arrays as likely right 2111# ignore definitions of NR_CPUS and usage to define arrays as likely right
2032 if ($line =~ /\bNR_CPUS\b/ && 2112 if ($line =~ /\bNR_CPUS\b/ &&
2033 $line !~ /^.#\s*if\b.*\bNR_CPUS\b/ && 2113 $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ &&
2034 $line !~ /^.#\s*define\b.*\bNR_CPUS\b/ && 2114 $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ &&
2035 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ && 2115 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
2036 $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ && 2116 $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ &&
2037 $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/) 2117 $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/)
diff --git a/scripts/decodecode b/scripts/decodecode
index 235d3938529d..235d3938529d 100644..100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 5d20a2e24cd1..ad2434b26970 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -108,6 +108,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
108 /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ 108 /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
109 else if (str[0] == '$') 109 else if (str[0] == '$')
110 return -1; 110 return -1;
111 /* exclude debugging symbols */
112 else if (stype == 'N')
113 return -1;
111 114
112 /* include the type field in the symbol name, so that it gets 115 /* include the type field in the symbol name, so that it gets
113 * compressed together */ 116 * compressed together */
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index f8e73c039dc8..3cc9f9369036 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -77,7 +77,7 @@ struct gstr str_new(void)
77{ 77{
78 struct gstr gs; 78 struct gstr gs;
79 gs.s = malloc(sizeof(char) * 64); 79 gs.s = malloc(sizeof(char) * 64);
80 gs.len = 16; 80 gs.len = 64;
81 strcpy(gs.s, "\0"); 81 strcpy(gs.s, "\0");
82 return gs; 82 return gs;
83} 83}
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 83cee18a02e9..88e3934a8b8c 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1556,7 +1556,9 @@ sub create_parameterlist($$$) {
1556 push_parameter($2, "$type $1", $file); 1556 push_parameter($2, "$type $1", $file);
1557 } 1557 }
1558 elsif ($param =~ m/(.*?):(\d+)/) { 1558 elsif ($param =~ m/(.*?):(\d+)/) {
1559 push_parameter($1, "$type:$2", $file) 1559 if ($type ne "") { # skip unnamed bit-fields
1560 push_parameter($1, "$type:$2", $file)
1561 }
1560 } 1562 }
1561 else { 1563 else {
1562 push_parameter($param, $type, $file); 1564 push_parameter($param, $type, $file);
diff --git a/scripts/mksysmap b/scripts/mksysmap
index 4390fab9f5bd..6e133a0bae7a 100644
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -32,6 +32,7 @@
32# For System.map filter away: 32# For System.map filter away:
33# a - local absolute symbols 33# a - local absolute symbols
34# U - undefined global symbols 34# U - undefined global symbols
35# N - debugging symbols
35# w - local weak symbols 36# w - local weak symbols
36 37
37# readprofile starts reading symbols when _stext is found, and 38# readprofile starts reading symbols when _stext is found, and
@@ -40,5 +41,5 @@
40# so we just ignore them to let readprofile continue to work. 41# so we just ignore them to let readprofile continue to work.
41# (At least sparc64 has __crc_ in the middle). 42# (At least sparc64 has __crc_ in the middle).
42 43
43$NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2 44$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2
44 45
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 757294b4f322..a07f91aac920 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -467,6 +467,25 @@ static void parse_elf_finish(struct elf_info *info)
467 release_file(info->hdr, info->size); 467 release_file(info->hdr, info->size);
468} 468}
469 469
470static int ignore_undef_symbol(struct elf_info *info, const char *symname)
471{
472 /* ignore __this_module, it will be resolved shortly */
473 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
474 return 1;
475 /* ignore global offset table */
476 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
477 return 1;
478 if (info->hdr->e_machine == EM_PPC)
479 /* Special register function linked on all modules during final link of .ko */
480 if (strncmp(symname, "_restgpr_", sizeof("_restgpr_") - 1) == 0 ||
481 strncmp(symname, "_savegpr_", sizeof("_savegpr_") - 1) == 0 ||
482 strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 ||
483 strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0)
484 return 1;
485 /* Do not ignore this symbol */
486 return 0;
487}
488
470#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" 489#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_"
471#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" 490#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_"
472 491
@@ -493,11 +512,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
493 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && 512 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
494 ELF_ST_BIND(sym->st_info) != STB_WEAK) 513 ELF_ST_BIND(sym->st_info) != STB_WEAK)
495 break; 514 break;
496 /* ignore global offset table */ 515 if (ignore_undef_symbol(info, symname))
497 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
498 break;
499 /* ignore __this_module, it will be resolved shortly */
500 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
501 break; 516 break;
502/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */ 517/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */
503#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER) 518#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)
@@ -721,7 +736,7 @@ static int check_section(const char *modname, const char *sec)
721 /* consume all digits */ 736 /* consume all digits */
722 while (*e && e != sec && isdigit(*e)) 737 while (*e && e != sec && isdigit(*e))
723 e--; 738 e--;
724 if (*e == '.') { 739 if (*e == '.' && !strstr(sec, ".linkonce")) {
725 warn("%s (%s): unexpected section name.\n" 740 warn("%s (%s): unexpected section name.\n"
726 "The (.[number]+) following section name are " 741 "The (.[number]+) following section name are "
727 "ld generated and not expected.\n" 742 "ld generated and not expected.\n"
diff --git a/scripts/ver_linux b/scripts/ver_linux
index ab69ecefedbd..7ac0e309be09 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -12,12 +12,9 @@ echo ' '
12uname -a 12uname -a
13echo ' ' 13echo ' '
14 14
15gcc --version 2>&1| head -n 1 | grep -v gcc | awk \ 15gcc -dumpversion 2>&1| awk \
16'NR==1{print "Gnu C ", $1}' 16'NR==1{print "Gnu C ", $1}'
17 17
18gcc --version 2>&1| grep gcc | awk \
19'NR==1{print "Gnu C ", $3}'
20
21make --version 2>&1 | awk -F, '{print $1}' | awk \ 18make --version 2>&1 | awk -F, '{print $1}' | awk \
22 '/GNU Make/{print "Gnu make ",$NF}' 19 '/GNU Make/{print "Gnu make ",$NF}'
23 20
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 4ea583689eec..baf348834b66 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -49,10 +49,14 @@ struct dev_cgroup {
49 spinlock_t lock; 49 spinlock_t lock;
50}; 50};
51 51
52static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s)
53{
54 return container_of(s, struct dev_cgroup, css);
55}
56
52static inline struct dev_cgroup *cgroup_to_devcgroup(struct cgroup *cgroup) 57static inline struct dev_cgroup *cgroup_to_devcgroup(struct cgroup *cgroup)
53{ 58{
54 return container_of(cgroup_subsys_state(cgroup, devices_subsys_id), 59 return css_to_devcgroup(cgroup_subsys_state(cgroup, devices_subsys_id));
55 struct dev_cgroup, css);
56} 60}
57 61
58struct cgroup_subsys devices_subsys; 62struct cgroup_subsys devices_subsys;
@@ -102,7 +106,7 @@ free_and_exit:
102static int dev_whitelist_add(struct dev_cgroup *dev_cgroup, 106static int dev_whitelist_add(struct dev_cgroup *dev_cgroup,
103 struct dev_whitelist_item *wh) 107 struct dev_whitelist_item *wh)
104{ 108{
105 struct dev_whitelist_item *whcopy; 109 struct dev_whitelist_item *whcopy, *walk;
106 110
107 whcopy = kmalloc(sizeof(*whcopy), GFP_KERNEL); 111 whcopy = kmalloc(sizeof(*whcopy), GFP_KERNEL);
108 if (!whcopy) 112 if (!whcopy)
@@ -110,7 +114,21 @@ static int dev_whitelist_add(struct dev_cgroup *dev_cgroup,
110 114
111 memcpy(whcopy, wh, sizeof(*whcopy)); 115 memcpy(whcopy, wh, sizeof(*whcopy));
112 spin_lock(&dev_cgroup->lock); 116 spin_lock(&dev_cgroup->lock);
113 list_add_tail(&whcopy->list, &dev_cgroup->whitelist); 117 list_for_each_entry(walk, &dev_cgroup->whitelist, list) {
118 if (walk->type != wh->type)
119 continue;
120 if (walk->major != wh->major)
121 continue;
122 if (walk->minor != wh->minor)
123 continue;
124
125 walk->access |= wh->access;
126 kfree(whcopy);
127 whcopy = NULL;
128 }
129
130 if (whcopy != NULL)
131 list_add_tail(&whcopy->list, &dev_cgroup->whitelist);
114 spin_unlock(&dev_cgroup->lock); 132 spin_unlock(&dev_cgroup->lock);
115 return 0; 133 return 0;
116} 134}
@@ -502,7 +520,6 @@ struct cgroup_subsys devices_subsys = {
502 520
503int devcgroup_inode_permission(struct inode *inode, int mask) 521int devcgroup_inode_permission(struct inode *inode, int mask)
504{ 522{
505 struct cgroup *cgroup;
506 struct dev_cgroup *dev_cgroup; 523 struct dev_cgroup *dev_cgroup;
507 struct dev_whitelist_item *wh; 524 struct dev_whitelist_item *wh;
508 525
@@ -511,8 +528,8 @@ int devcgroup_inode_permission(struct inode *inode, int mask)
511 return 0; 528 return 0;
512 if (!S_ISBLK(inode->i_mode) && !S_ISCHR(inode->i_mode)) 529 if (!S_ISBLK(inode->i_mode) && !S_ISCHR(inode->i_mode))
513 return 0; 530 return 0;
514 cgroup = task_cgroup(current, devices_subsys.subsys_id); 531 dev_cgroup = css_to_devcgroup(task_subsys_state(current,
515 dev_cgroup = cgroup_to_devcgroup(cgroup); 532 devices_subsys_id));
516 if (!dev_cgroup) 533 if (!dev_cgroup)
517 return 0; 534 return 0;
518 535
@@ -543,12 +560,11 @@ acc_check:
543 560
544int devcgroup_inode_mknod(int mode, dev_t dev) 561int devcgroup_inode_mknod(int mode, dev_t dev)
545{ 562{
546 struct cgroup *cgroup;
547 struct dev_cgroup *dev_cgroup; 563 struct dev_cgroup *dev_cgroup;
548 struct dev_whitelist_item *wh; 564 struct dev_whitelist_item *wh;
549 565
550 cgroup = task_cgroup(current, devices_subsys.subsys_id); 566 dev_cgroup = css_to_devcgroup(task_subsys_state(current,
551 dev_cgroup = cgroup_to_devcgroup(cgroup); 567 devices_subsys_id));
552 if (!dev_cgroup) 568 if (!dev_cgroup)
553 return 0; 569 return 0;
554 570
diff --git a/security/dummy.c b/security/dummy.c
index f50c6c3c32c9..b8916883b77f 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -27,6 +27,8 @@
27#include <linux/hugetlb.h> 27#include <linux/hugetlb.h>
28#include <linux/ptrace.h> 28#include <linux/ptrace.h>
29#include <linux/file.h> 29#include <linux/file.h>
30#include <linux/prctl.h>
31#include <linux/securebits.h>
30 32
31static int dummy_ptrace (struct task_struct *parent, struct task_struct *child) 33static int dummy_ptrace (struct task_struct *parent, struct task_struct *child)
32{ 34{
@@ -607,7 +609,27 @@ static int dummy_task_kill (struct task_struct *p, struct siginfo *info,
607static int dummy_task_prctl (int option, unsigned long arg2, unsigned long arg3, 609static int dummy_task_prctl (int option, unsigned long arg2, unsigned long arg3,
608 unsigned long arg4, unsigned long arg5, long *rc_p) 610 unsigned long arg4, unsigned long arg5, long *rc_p)
609{ 611{
610 return 0; 612 switch (option) {
613 case PR_CAPBSET_READ:
614 *rc_p = (cap_valid(arg2) ? 1 : -EINVAL);
615 break;
616 case PR_GET_KEEPCAPS:
617 *rc_p = issecure(SECURE_KEEP_CAPS);
618 break;
619 case PR_SET_KEEPCAPS:
620 if (arg2 > 1)
621 *rc_p = -EINVAL;
622 else if (arg2)
623 current->securebits |= issecure_mask(SECURE_KEEP_CAPS);
624 else
625 current->securebits &=
626 ~issecure_mask(SECURE_KEEP_CAPS);
627 break;
628 default:
629 return 0;
630 }
631
632 return 1;
611} 633}
612 634
613static void dummy_task_reparent_to_init (struct task_struct *p) 635static void dummy_task_reparent_to_init (struct task_struct *p)
diff --git a/security/keys/internal.h b/security/keys/internal.h
index 8c05587f5018..b39f5c2e2c4b 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -78,7 +78,6 @@ extern unsigned key_quota_maxbytes;
78 78
79extern struct rb_root key_serial_tree; 79extern struct rb_root key_serial_tree;
80extern spinlock_t key_serial_lock; 80extern spinlock_t key_serial_lock;
81extern struct semaphore key_alloc_sem;
82extern struct mutex key_construction_mutex; 81extern struct mutex key_construction_mutex;
83extern wait_queue_head_t request_key_conswq; 82extern wait_queue_head_t request_key_conswq;
84 83
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index b5c8f9237008..4a09293efa00 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1881,6 +1881,18 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
1881 final = sbsp->smk_default; 1881 final = sbsp->smk_default;
1882 1882
1883 /* 1883 /*
1884 * If this is the root inode the superblock
1885 * may be in the process of initialization.
1886 * If that is the case use the root value out
1887 * of the superblock.
1888 */
1889 if (opt_dentry->d_parent == opt_dentry) {
1890 isp->smk_inode = sbsp->smk_root;
1891 isp->smk_flags |= SMK_INODE_INSTANT;
1892 goto unlockandout;
1893 }
1894
1895 /*
1884 * This is pretty hackish. 1896 * This is pretty hackish.
1885 * Casey says that we shouldn't have to do 1897 * Casey says that we shouldn't have to do
1886 * file system specific code, but it does help 1898 * file system specific code, but it does help
diff --git a/sound/Kconfig b/sound/Kconfig
index b2a2db47aff5..4247406160e7 100644
--- a/sound/Kconfig
+++ b/sound/Kconfig
@@ -28,11 +28,6 @@ config SOUND
28 and read <file:Documentation/sound/oss/README.modules>; the module 28 and read <file:Documentation/sound/oss/README.modules>; the module
29 will be called soundcore. 29 will be called soundcore.
30 30
31 I'm told that even without a sound card, you can make your computer
32 say more than an occasional beep, by programming the PC speaker.
33 Kernel patches and supporting utilities to do that are in the pcsp
34 package, available at <ftp://ftp.infradead.org/pub/pcsp/>.
35
36source "sound/oss/dmasound/Kconfig" 31source "sound/oss/dmasound/Kconfig"
37 32
38if !M68K 33if !M68K
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 812f91b3de5b..6c8ab48c689a 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -259,8 +259,9 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
259 return minor; 259 return minor;
260 } 260 }
261 snd_minors[minor] = preg; 261 snd_minors[minor] = preg;
262 preg->dev = device_create(sound_class, device, MKDEV(major, minor), 262 preg->dev = device_create_drvdata(sound_class, device,
263 "%s", name); 263 MKDEV(major, minor),
264 private_data, "%s", name);
264 if (IS_ERR(preg->dev)) { 265 if (IS_ERR(preg->dev)) {
265 snd_minors[minor] = NULL; 266 snd_minors[minor] = NULL;
266 mutex_unlock(&sound_mutex); 267 mutex_unlock(&sound_mutex);
@@ -269,9 +270,6 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
269 return minor; 270 return minor;
270 } 271 }
271 272
272 if (preg->dev)
273 dev_set_drvdata(preg->dev, private_data);
274
275 mutex_unlock(&sound_mutex); 273 mutex_unlock(&sound_mutex);
276 return 0; 274 return 0;
277} 275}
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index 379bcb074463..602b58e3b55d 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -5,9 +5,10 @@ menu "Generic devices"
5 5
6 6
7config SND_PCSP 7config SND_PCSP
8 tristate "PC-Speaker support" 8 tristate "PC-Speaker support (READ HELP!)"
9 depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS 9 depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS
10 depends on INPUT 10 depends on INPUT
11 depends on EXPERIMENTAL
11 depends on SND 12 depends on SND
12 select SND_PCM 13 select SND_PCM
13 help 14 help
@@ -18,11 +19,21 @@ config SND_PCSP
18 19
19 You can compile this as a module which will be called snd-pcsp. 20 You can compile this as a module which will be called snd-pcsp.
20 21
22 WARNING: if you already have a soundcard, enabling this
23 driver may lead to a problem. Namely, it may get loaded
24 before the other sound driver of yours, making the
25 pc-speaker a default sound device. Which is likely not
26 what you want. To make this driver play nicely with other
27 sound driver, you can add this into your /etc/modprobe.conf:
28 options snd-pcsp index=2
29
21 You don't need this driver if you only want your pc-speaker to beep. 30 You don't need this driver if you only want your pc-speaker to beep.
22 You don't need this driver if you have a tablet piezo beeper 31 You don't need this driver if you have a tablet piezo beeper
23 in your PC instead of the real speaker. 32 in your PC instead of the real speaker.
24 33
25 It should not hurt to say Y or M here in all other cases. 34 Say N if you have a sound card.
35 Say M if you don't.
36 Say Y only if you really know what you do.
26 37
27config SND_MPU401_UART 38config SND_MPU401_UART
28 tristate 39 tristate
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index 54a1f9036c66..1899cf0685bc 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -96,7 +96,7 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
96 return -EINVAL; 96 return -EINVAL;
97 97
98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
99 pcsp_chip.timer.cb_mode = HRTIMER_CB_IRQSAFE; 99 pcsp_chip.timer.cb_mode = HRTIMER_CB_SOFTIRQ;
100 pcsp_chip.timer.function = pcsp_do_timer; 100 pcsp_chip.timer.function = pcsp_do_timer;
101 101
102 card = snd_card_new(index, id, THIS_MODULE, 0); 102 card = snd_card_new(index, id, THIS_MODULE, 0);
diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h
index f07cc1ee1fe7..1d661f795e8c 100644
--- a/sound/drivers/pcsp/pcsp.h
+++ b/sound/drivers/pcsp/pcsp.h
@@ -24,7 +24,8 @@ static DEFINE_SPINLOCK(i8253_lock);
24/* default timer freq for PC-Speaker: 18643 Hz */ 24/* default timer freq for PC-Speaker: 18643 Hz */
25#define DIV_18KHZ 64 25#define DIV_18KHZ 64
26#define MAX_DIV DIV_18KHZ 26#define MAX_DIV DIV_18KHZ
27#define CUR_DIV() (MAX_DIV >> chip->treble) 27#define CALC_DIV(d) (MAX_DIV >> (d))
28#define CUR_DIV() CALC_DIV(chip->treble)
28#define PCSP_MAX_TREBLE 1 29#define PCSP_MAX_TREBLE 1
29 30
30/* unfortunately, with hrtimers 37KHz does not work very well :( */ 31/* unfortunately, with hrtimers 37KHz does not work very well :( */
@@ -36,7 +37,8 @@ static DEFINE_SPINLOCK(i8253_lock);
36#define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1) 37#define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1)
37#define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV) 38#define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV)
38#define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble)) 39#define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble))
39#define PCSP_RATE() (PIT_TICK_RATE / CUR_DIV()) 40#define PCSP_CALC_RATE(i) (PIT_TICK_RATE / CALC_DIV(i))
41#define PCSP_RATE() PCSP_CALC_RATE(chip->treble)
40#define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE 42#define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE
41#define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE 43#define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE
42#define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1) 44#define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1)
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index ac6238e93513..e341f3f83b6a 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -9,7 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/moduleparam.h> 10#include <linux/moduleparam.h>
11#include <sound/pcm.h> 11#include <sound/pcm.h>
12#include <linux/interrupt.h>
13#include <asm/io.h> 12#include <asm/io.h>
14#include "pcsp.h" 13#include "pcsp.h"
15 14
@@ -18,36 +17,12 @@ module_param(nforce_wa, bool, 0444);
18MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " 17MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround "
19 "(expect bad sound)"); 18 "(expect bad sound)");
20 19
21static void pcsp_start_timer(unsigned long dummy) 20#define DMIX_WANTS_S16 1
22{
23 hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL);
24}
25
26/*
27 * We need the hrtimer_start as a tasklet to avoid
28 * the nasty locking problem. :(
29 * The problem:
30 * - The timer handler is called with the cpu_base->lock
31 * already held by hrtimer code.
32 * - snd_pcm_period_elapsed() takes the
33 * substream->self_group.lock.
34 * So far so good.
35 * But the snd_pcsp_trigger() is called with the
36 * substream->self_group.lock held, and it calls
37 * hrtimer_start(), which takes the cpu_base->lock.
38 * You see the problem. We have the code pathes
39 * which take two locks in a reverse order. This
40 * can deadlock and the lock validator complains.
41 * The only solution I could find was to move the
42 * hrtimer_start() into a tasklet. -stsp
43 */
44static DECLARE_TASKLET(pcsp_start_timer_tasklet, pcsp_start_timer, 0);
45 21
46enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) 22enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
47{ 23{
48 unsigned long flags;
49 unsigned char timer_cnt, val; 24 unsigned char timer_cnt, val;
50 int periods_elapsed; 25 int fmt_size, periods_elapsed;
51 u64 ns; 26 u64 ns;
52 size_t period_bytes, buffer_bytes; 27 size_t period_bytes, buffer_bytes;
53 struct snd_pcm_substream *substream; 28 struct snd_pcm_substream *substream;
@@ -64,9 +39,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
64 return HRTIMER_RESTART; 39 return HRTIMER_RESTART;
65 } 40 }
66 41
67 /* hrtimer calls us from both hardirq and softirq contexts, 42 spin_lock_irq(&chip->substream_lock);
68 * so irqsave :( */
69 spin_lock_irqsave(&chip->substream_lock, flags);
70 /* Takashi Iwai says regarding this extra lock: 43 /* Takashi Iwai says regarding this extra lock:
71 44
72 If the irq handler handles some data on the DMA buffer, it should 45 If the irq handler handles some data on the DMA buffer, it should
@@ -92,8 +65,11 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
92 goto exit_nr_unlock2; 65 goto exit_nr_unlock2;
93 66
94 runtime = substream->runtime; 67 runtime = substream->runtime;
95 /* assume it is u8 mono */ 68 fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3;
96 val = runtime->dma_area[chip->playback_ptr]; 69 /* assume it is mono! */
70 val = runtime->dma_area[chip->playback_ptr + fmt_size - 1];
71 if (snd_pcm_format_signed(runtime->format))
72 val ^= 0x80;
97 timer_cnt = val * CUR_DIV() / 256; 73 timer_cnt = val * CUR_DIV() / 256;
98 74
99 if (timer_cnt && chip->enable) { 75 if (timer_cnt && chip->enable) {
@@ -111,12 +87,14 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
111 87
112 period_bytes = snd_pcm_lib_period_bytes(substream); 88 period_bytes = snd_pcm_lib_period_bytes(substream);
113 buffer_bytes = snd_pcm_lib_buffer_bytes(substream); 89 buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
114 chip->playback_ptr += PCSP_INDEX_INC(); 90 chip->playback_ptr += PCSP_INDEX_INC() * fmt_size;
115 periods_elapsed = chip->playback_ptr - chip->period_ptr; 91 periods_elapsed = chip->playback_ptr - chip->period_ptr;
116 if (periods_elapsed < 0) { 92 if (periods_elapsed < 0) {
117 printk(KERN_WARNING "PCSP: playback_ptr inconsistent " 93#if PCSP_DEBUG
94 printk(KERN_INFO "PCSP: buffer_bytes mod period_bytes != 0 ? "
118 "(%zi %zi %zi)\n", 95 "(%zi %zi %zi)\n",
119 chip->playback_ptr, period_bytes, buffer_bytes); 96 chip->playback_ptr, period_bytes, buffer_bytes);
97#endif
120 periods_elapsed += buffer_bytes; 98 periods_elapsed += buffer_bytes;
121 } 99 }
122 periods_elapsed /= period_bytes; 100 periods_elapsed /= period_bytes;
@@ -132,7 +110,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
132 chip->period_ptr %= buffer_bytes; 110 chip->period_ptr %= buffer_bytes;
133 } 111 }
134 112
135 spin_unlock_irqrestore(&chip->substream_lock, flags); 113 spin_unlock_irq(&chip->substream_lock);
136 114
137 if (!atomic_read(&chip->timer_active)) 115 if (!atomic_read(&chip->timer_active))
138 return HRTIMER_NORESTART; 116 return HRTIMER_NORESTART;
@@ -146,7 +124,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
146exit_nr_unlock2: 124exit_nr_unlock2:
147 snd_pcm_stream_unlock(substream); 125 snd_pcm_stream_unlock(substream);
148exit_nr_unlock1: 126exit_nr_unlock1:
149 spin_unlock_irqrestore(&chip->substream_lock, flags); 127 spin_unlock_irq(&chip->substream_lock);
150 return HRTIMER_NORESTART; 128 return HRTIMER_NORESTART;
151} 129}
152 130
@@ -167,7 +145,7 @@ static void pcsp_start_playing(struct snd_pcsp *chip)
167 atomic_set(&chip->timer_active, 1); 145 atomic_set(&chip->timer_active, 1);
168 chip->thalf = 0; 146 chip->thalf = 0;
169 147
170 tasklet_schedule(&pcsp_start_timer_tasklet); 148 hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL);
171} 149}
172 150
173static void pcsp_stop_playing(struct snd_pcsp *chip) 151static void pcsp_stop_playing(struct snd_pcsp *chip)
@@ -270,7 +248,11 @@ static struct snd_pcm_hardware snd_pcsp_playback = {
270 .info = (SNDRV_PCM_INFO_INTERLEAVED | 248 .info = (SNDRV_PCM_INFO_INTERLEAVED |
271 SNDRV_PCM_INFO_HALF_DUPLEX | 249 SNDRV_PCM_INFO_HALF_DUPLEX |
272 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), 250 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
273 .formats = SNDRV_PCM_FMTBIT_U8, 251 .formats = (SNDRV_PCM_FMTBIT_U8
252#if DMIX_WANTS_S16
253 | SNDRV_PCM_FMTBIT_S16_LE
254#endif
255 ),
274 .rates = SNDRV_PCM_RATE_KNOT, 256 .rates = SNDRV_PCM_RATE_KNOT,
275 .rate_min = PCSP_DEFAULT_SRATE, 257 .rate_min = PCSP_DEFAULT_SRATE,
276 .rate_max = PCSP_DEFAULT_SRATE, 258 .rate_max = PCSP_DEFAULT_SRATE,
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c
index 64a695fef74e..caeb0f57fcca 100644
--- a/sound/drivers/pcsp/pcsp_mixer.c
+++ b/sound/drivers/pcsp/pcsp_mixer.c
@@ -50,7 +50,8 @@ static int pcsp_treble_info(struct snd_kcontrol *kcontrol,
50 uinfo->value.enumerated.items = chip->max_treble + 1; 50 uinfo->value.enumerated.items = chip->max_treble + 1;
51 if (uinfo->value.enumerated.item > chip->max_treble) 51 if (uinfo->value.enumerated.item > chip->max_treble)
52 uinfo->value.enumerated.item = chip->max_treble; 52 uinfo->value.enumerated.item = chip->max_treble;
53 sprintf(uinfo->value.enumerated.name, "%d", PCSP_RATE()); 53 sprintf(uinfo->value.enumerated.name, "%d",
54 PCSP_CALC_RATE(uinfo->value.enumerated.item));
54 return 0; 55 return 0;
55} 56}
56 57
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index 857008bb7167..3be2dc1025b5 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -79,7 +79,7 @@ config SOUND_TRIDENT
79 79
80config SOUND_MSNDCLAS 80config SOUND_MSNDCLAS
81 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey" 81 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey"
82 depends on SOUND_PRIME && (m || !STANDALONE) 82 depends on SOUND_PRIME && (m || !STANDALONE) && ISA
83 help 83 help
84 Say M here if you have a Turtle Beach MultiSound Classic, Tahiti or 84 Say M here if you have a Turtle Beach MultiSound Classic, Tahiti or
85 Monterey (not for the Pinnacle or Fiji). 85 Monterey (not for the Pinnacle or Fiji).
@@ -143,7 +143,7 @@ config MSNDCLAS_IO
143 143
144config SOUND_MSNDPIN 144config SOUND_MSNDPIN
145 tristate "Support for Turtle Beach MultiSound Pinnacle, Fiji" 145 tristate "Support for Turtle Beach MultiSound Pinnacle, Fiji"
146 depends on SOUND_PRIME && (m || !STANDALONE) 146 depends on SOUND_PRIME && (m || !STANDALONE) && ISA
147 help 147 help
148 Say M here if you have a Turtle Beach MultiSound Pinnacle or Fiji. 148 Say M here if you have a Turtle Beach MultiSound Pinnacle or Fiji.
149 See <file:Documentation/sound/oss/MultiSound> for important information 149 See <file:Documentation/sound/oss/MultiSound> for important information
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 2da89810ca10..1292dcee072d 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1971,6 +1971,9 @@ static int snd_ac97_ad1888_lohpsel_get(struct snd_kcontrol *kcontrol, struct snd
1971 1971
1972 val = ac97->regs[AC97_AD_MISC]; 1972 val = ac97->regs[AC97_AD_MISC];
1973 ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL); 1973 ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL);
1974 if (ac97->spec.ad18xx.lo_as_master)
1975 ucontrol->value.integer.value[0] =
1976 !ucontrol->value.integer.value[0];
1974 return 0; 1977 return 0;
1975} 1978}
1976 1979
@@ -1979,8 +1982,10 @@ static int snd_ac97_ad1888_lohpsel_put(struct snd_kcontrol *kcontrol, struct snd
1979 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 1982 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
1980 unsigned short val; 1983 unsigned short val;
1981 1984
1982 val = !ucontrol->value.integer.value[0] 1985 val = !ucontrol->value.integer.value[0];
1983 ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0; 1986 if (ac97->spec.ad18xx.lo_as_master)
1987 val = !val;
1988 val = val ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0;
1984 return snd_ac97_update_bits(ac97, AC97_AD_MISC, 1989 return snd_ac97_update_bits(ac97, AC97_AD_MISC,
1985 AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val); 1990 AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val);
1986} 1991}
@@ -2031,7 +2036,7 @@ static void ad1888_update_jacks(struct snd_ac97 *ac97)
2031{ 2036{
2032 unsigned short val = 0; 2037 unsigned short val = 0;
2033 /* clear LODIS if shared jack is to be used for Surround out */ 2038 /* clear LODIS if shared jack is to be used for Surround out */
2034 if (is_shared_linein(ac97)) 2039 if (!ac97->spec.ad18xx.lo_as_master && is_shared_linein(ac97))
2035 val |= (1 << 12); 2040 val |= (1 << 12);
2036 /* clear CLDIS if shared jack is to be used for C/LFE out */ 2041 /* clear CLDIS if shared jack is to be used for C/LFE out */
2037 if (is_shared_micin(ac97)) 2042 if (is_shared_micin(ac97))
@@ -2067,9 +2072,13 @@ static const struct snd_kcontrol_new snd_ac97_ad1888_controls[] = {
2067 2072
2068static int patch_ad1888_specific(struct snd_ac97 *ac97) 2073static int patch_ad1888_specific(struct snd_ac97 *ac97)
2069{ 2074{
2070 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */ 2075 if (!ac97->spec.ad18xx.lo_as_master) {
2071 snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Master Surround Playback"); 2076 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */
2072 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback"); 2077 snd_ac97_rename_vol_ctl(ac97, "Master Playback",
2078 "Master Surround Playback");
2079 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback",
2080 "Master Playback");
2081 }
2073 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls)); 2082 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls));
2074} 2083}
2075 2084
@@ -2088,16 +2097,27 @@ static int patch_ad1888(struct snd_ac97 * ac97)
2088 2097
2089 patch_ad1881(ac97); 2098 patch_ad1881(ac97);
2090 ac97->build_ops = &patch_ad1888_build_ops; 2099 ac97->build_ops = &patch_ad1888_build_ops;
2091 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */ 2100
2092 /* it seems that most vendors connect line-out connector to headphone out of AC'97 */ 2101 /*
2102 * LO can be used as a real line-out on some devices,
2103 * and we need to revert the front/surround mixer switches
2104 */
2105 if (ac97->subsystem_vendor == 0x1043 &&
2106 ac97->subsystem_device == 0x1193) /* ASUS A9T laptop */
2107 ac97->spec.ad18xx.lo_as_master = 1;
2108
2109 misc = snd_ac97_read(ac97, AC97_AD_MISC);
2093 /* AD-compatible mode */ 2110 /* AD-compatible mode */
2094 /* Stereo mutes enabled */ 2111 /* Stereo mutes enabled */
2095 misc = snd_ac97_read(ac97, AC97_AD_MISC); 2112 misc |= AC97_AD198X_MSPLT | AC97_AD198X_AC97NC;
2096 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc | 2113 if (!ac97->spec.ad18xx.lo_as_master)
2097 AC97_AD198X_LOSEL | 2114 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */
2098 AC97_AD198X_HPSEL | 2115 /* it seems that most vendors connect line-out connector to
2099 AC97_AD198X_MSPLT | 2116 * headphone out of AC'97
2100 AC97_AD198X_AC97NC); 2117 */
2118 misc |= AC97_AD198X_LOSEL | AC97_AD198X_HPSEL;
2119
2120 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc);
2101 ac97->flags |= AC97_STEREO_MUTES; 2121 ac97->flags |= AC97_STEREO_MUTES;
2102 return 0; 2122 return 0;
2103} 2123}
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index abde5b901884..548c9cc81af5 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1818,13 +1818,6 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1818 } 1818 }
1819 emu->port = pci_resource_start(pci, 0); 1819 emu->port = pci_resource_start(pci, 0);
1820 1820
1821 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED,
1822 "EMU10K1", emu)) {
1823 err = -EBUSY;
1824 goto error;
1825 }
1826 emu->irq = pci->irq;
1827
1828 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; 1821 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT;
1829 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 1822 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
1830 32 * 1024, &emu->ptb_pages) < 0) { 1823 32 * 1024, &emu->ptb_pages) < 0) {
@@ -1887,6 +1880,14 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1887 emu->fx8010.etram_pages.area = NULL; 1880 emu->fx8010.etram_pages.area = NULL;
1888 emu->fx8010.etram_pages.bytes = 0; 1881 emu->fx8010.etram_pages.bytes = 0;
1889 1882
1883 /* irq handler must be registered after I/O ports are activated */
1884 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED,
1885 "EMU10K1", emu)) {
1886 err = -EBUSY;
1887 goto error;
1888 }
1889 emu->irq = pci->irq;
1890
1890 /* 1891 /*
1891 * Init to 0x02109204 : 1892 * Init to 0x02109204 :
1892 * Clock accuracy = 0 (1000ppm) 1893 * Clock accuracy = 0 (1000ppm)
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index e0a605adde42..a99e86d74278 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2858,6 +2858,7 @@ static const char *ad1988_models[AD1988_MODEL_LAST] = {
2858static struct snd_pci_quirk ad1988_cfg_tbl[] = { 2858static struct snd_pci_quirk ad1988_cfg_tbl[] = {
2859 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), 2859 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
2860 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), 2860 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
2861 SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG),
2861 {} 2862 {}
2862}; 2863};
2863 2864
@@ -3643,33 +3644,17 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3643 { } /* end */ 3644 { } /* end */
3644}; 3645};
3645 3646
3646static struct hda_input_mux ad1884a_mobile_capture_source = {
3647 .num_items = 2,
3648 .items = {
3649 { "Mic", 0x1 }, /* port-C */
3650 { "Mix", 0x3 },
3651 },
3652};
3653
3654static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { 3647static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
3655 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3648 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3656 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3649 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
3657 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3650 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
3658 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3651 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
3659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
3660 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT),
3661 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), 3652 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
3662 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), 3653 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),
3663 HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), 3654 HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT),
3655 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT),
3664 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3656 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
3665 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 3657 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
3666 {
3667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3668 .name = "Capture Source",
3669 .info = ad198x_mux_enum_info,
3670 .get = ad198x_mux_enum_get,
3671 .put = ad198x_mux_enum_put,
3672 },
3673 { } /* end */ 3658 { } /* end */
3674}; 3659};
3675 3660
@@ -3686,14 +3671,31 @@ static void ad1884a_hp_automute(struct hda_codec *codec)
3686 present ? 0x00 : 0x02); 3671 present ? 0x00 : 0x02);
3687} 3672}
3688 3673
3674/* switch to external mic if plugged */
3675static void ad1884a_hp_automic(struct hda_codec *codec)
3676{
3677 unsigned int present;
3678
3679 present = snd_hda_codec_read(codec, 0x14, 0,
3680 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
3681 snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL,
3682 present ? 0 : 1);
3683}
3684
3689#define AD1884A_HP_EVENT 0x37 3685#define AD1884A_HP_EVENT 0x37
3686#define AD1884A_MIC_EVENT 0x36
3690 3687
3691/* unsolicited event for HP jack sensing */ 3688/* unsolicited event for HP jack sensing */
3692static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res) 3689static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res)
3693{ 3690{
3694 if ((res >> 26) != AD1884A_HP_EVENT) 3691 switch (res >> 26) {
3695 return; 3692 case AD1884A_HP_EVENT:
3696 ad1884a_hp_automute(codec); 3693 ad1884a_hp_automute(codec);
3694 break;
3695 case AD1884A_MIC_EVENT:
3696 ad1884a_hp_automic(codec);
3697 break;
3698 }
3697} 3699}
3698 3700
3699/* initialize jack-sensing, too */ 3701/* initialize jack-sensing, too */
@@ -3701,6 +3703,7 @@ static int ad1884a_hp_init(struct hda_codec *codec)
3701{ 3703{
3702 ad198x_init(codec); 3704 ad198x_init(codec);
3703 ad1884a_hp_automute(codec); 3705 ad1884a_hp_automute(codec);
3706 ad1884a_hp_automic(codec);
3704 return 0; 3707 return 0;
3705} 3708}
3706 3709
@@ -3714,10 +3717,15 @@ static struct hda_verb ad1884a_laptop_verbs[] = {
3714 /* Port-F pin */ 3717 /* Port-F pin */
3715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3719 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3720 /* Port-C pin - internal mic-in */
3721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3722 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
3723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
3717 /* analog mix */ 3724 /* analog mix */
3718 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 3725 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3719 /* unsolicited event for pin-sense */ 3726 /* unsolicited event for pin-sense */
3720 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, 3727 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
3728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT},
3721 { } /* end */ 3729 { } /* end */
3722}; 3730};
3723 3731
@@ -3877,7 +3885,6 @@ static int patch_ad1884a(struct hda_codec *codec)
3877 spec->mixers[0] = ad1884a_mobile_mixers; 3885 spec->mixers[0] = ad1884a_mobile_mixers;
3878 spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; 3886 spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs;
3879 spec->multiout.dig_out_nid = 0; 3887 spec->multiout.dig_out_nid = 0;
3880 spec->input_mux = &ad1884a_mobile_capture_source;
3881 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; 3888 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event;
3882 codec->patch_ops.init = ad1884a_hp_init; 3889 codec->patch_ops.init = ad1884a_hp_init;
3883 break; 3890 break;
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index c73ce074a6ea..6ef57fbfb6eb 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -611,6 +611,7 @@ static const char *cmi9880_models[CMI_MODELS] = {
611 611
612static struct snd_pci_quirk cmi9880_cfg_tbl[] = { 612static struct snd_pci_quirk cmi9880_cfg_tbl[] = {
613 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), 613 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG),
614 SND_PCI_QUIRK(0x1854, 0x002b, "LG LS75", CMI_MINIMAL),
614 SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG), 615 SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG),
615 {} /* terminator */ 616 {} /* terminator */
616}; 617};
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6d4df45e81e0..b0a2a262ece2 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -853,6 +853,7 @@ do_sku:
853 case 0x10ec0269: 853 case 0x10ec0269:
854 case 0x10ec0862: 854 case 0x10ec0862:
855 case 0x10ec0662: 855 case 0x10ec0662:
856 case 0x10ec0889:
856 snd_hda_codec_write(codec, 0x14, 0, 857 snd_hda_codec_write(codec, 0x14, 0,
857 AC_VERB_SET_EAPD_BTLENABLE, 2); 858 AC_VERB_SET_EAPD_BTLENABLE, 2);
858 snd_hda_codec_write(codec, 0x15, 0, 859 snd_hda_codec_write(codec, 0x15, 0,
@@ -877,6 +878,7 @@ do_sku:
877 case 0x10ec0883: 878 case 0x10ec0883:
878 case 0x10ec0885: 879 case 0x10ec0885:
879 case 0x10ec0888: 880 case 0x10ec0888:
881 case 0x10ec0889:
880 snd_hda_codec_write(codec, 0x20, 0, 882 snd_hda_codec_write(codec, 0x20, 0,
881 AC_VERB_SET_COEF_INDEX, 7); 883 AC_VERB_SET_COEF_INDEX, 7);
882 tmp = snd_hda_codec_read(codec, 0x20, 0, 884 tmp = snd_hda_codec_read(codec, 0x20, 0,
@@ -940,7 +942,6 @@ do_sku:
940 AC_VERB_SET_UNSOLICITED_ENABLE, 942 AC_VERB_SET_UNSOLICITED_ENABLE,
941 AC_USRSP_EN | ALC880_HP_EVENT); 943 AC_USRSP_EN | ALC880_HP_EVENT);
942 spec->unsol_event = alc_sku_unsol_event; 944 spec->unsol_event = alc_sku_unsol_event;
943 spec->init_hook = alc_sku_automute;
944} 945}
945 946
946/* 947/*
@@ -2981,7 +2982,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
2981 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ 2982 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2982 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), 2983 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2983 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), 2984 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2984 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), 2985 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
2985 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), 2986 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2986 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), 2987 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2987 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), 2988 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
@@ -7743,6 +7744,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
7743 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 7744 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7744 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 7745 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7745 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 7746 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7747 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7746 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 7748 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7747 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 7749 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7748 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 7750 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
@@ -8640,6 +8642,7 @@ static struct hda_verb alc262_sony_unsol_verbs[] = {
8640 8642
8641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 8643 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8645 {}
8643}; 8646};
8644 8647
8645/* mute/unmute internal speaker according to the hp jack and mute state */ 8648/* mute/unmute internal speaker according to the hp jack and mute state */
@@ -8757,35 +8760,39 @@ static struct hda_input_mux alc262_HP_D7000_capture_source = {
8757 }, 8760 },
8758}; 8761};
8759 8762
8760/* mute/unmute internal speaker according to the hp jack and mute state */ 8763/* mute/unmute internal speaker according to the hp jacks and mute state */
8761static void alc262_fujitsu_automute(struct hda_codec *codec, int force) 8764static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8762{ 8765{
8763 struct alc_spec *spec = codec->spec; 8766 struct alc_spec *spec = codec->spec;
8764 unsigned int mute; 8767 unsigned int mute;
8765 8768
8766 if (force || !spec->sense_updated) { 8769 if (force || !spec->sense_updated) {
8767 unsigned int present_int_hp, present_dock_hp; 8770 unsigned int present;
8768 /* need to execute and sync at first */ 8771 /* need to execute and sync at first */
8769 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); 8772 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8770 present_int_hp = snd_hda_codec_read(codec, 0x14, 0, 8773 /* check laptop HP jack */
8771 AC_VERB_GET_PIN_SENSE, 0); 8774 present = snd_hda_codec_read(codec, 0x14, 0,
8772 snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); 8775 AC_VERB_GET_PIN_SENSE, 0);
8773 present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, 8776 /* need to execute and sync at first */
8774 AC_VERB_GET_PIN_SENSE, 0); 8777 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8775 spec->jack_present = (present_int_hp & 0x80000000) != 0; 8778 /* check docking HP jack */
8776 spec->jack_present |= (present_dock_hp & 0x80000000) != 0; 8779 present |= snd_hda_codec_read(codec, 0x1b, 0,
8780 AC_VERB_GET_PIN_SENSE, 0);
8781 if (present & AC_PINSENSE_PRESENCE)
8782 spec->jack_present = 1;
8783 else
8784 spec->jack_present = 0;
8777 spec->sense_updated = 1; 8785 spec->sense_updated = 1;
8778 } 8786 }
8779 if (spec->jack_present) { 8787 /* unmute internal speaker only if both HPs are unplugged and
8780 /* mute internal speaker */ 8788 * master switch is on
8781 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8789 */
8782 HDA_AMP_MUTE, HDA_AMP_MUTE); 8790 if (spec->jack_present)
8783 } else { 8791 mute = HDA_AMP_MUTE;
8784 /* unmute internal speaker if necessary */ 8792 else
8785 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 8793 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8786 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8794 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8787 HDA_AMP_MUTE, mute); 8795 HDA_AMP_MUTE, mute);
8788 }
8789} 8796}
8790 8797
8791/* unsolicited event for HP jack sensing */ 8798/* unsolicited event for HP jack sensing */
@@ -8797,6 +8804,11 @@ static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8797 alc262_fujitsu_automute(codec, 1); 8804 alc262_fujitsu_automute(codec, 1);
8798} 8805}
8799 8806
8807static void alc262_fujitsu_init_hook(struct hda_codec *codec)
8808{
8809 alc262_fujitsu_automute(codec, 1);
8810}
8811
8800/* bind volumes of both NID 0x0c and 0x0d */ 8812/* bind volumes of both NID 0x0c and 0x0d */
8801static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { 8813static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8802 .ops = &snd_hda_bind_vol, 8814 .ops = &snd_hda_bind_vol,
@@ -9570,6 +9582,7 @@ static struct alc_config_preset alc262_presets[] = {
9570 .channel_mode = alc262_modes, 9582 .channel_mode = alc262_modes,
9571 .input_mux = &alc262_fujitsu_capture_source, 9583 .input_mux = &alc262_fujitsu_capture_source,
9572 .unsol_event = alc262_fujitsu_unsol_event, 9584 .unsol_event = alc262_fujitsu_unsol_event,
9585 .init_hook = alc262_fujitsu_init_hook,
9573 }, 9586 },
9574 [ALC262_HP_BPC] = { 9587 [ALC262_HP_BPC] = {
9575 .mixers = { alc262_HP_BPC_mixer }, 9588 .mixers = { alc262_HP_BPC_mixer },
@@ -10500,6 +10513,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
10500 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 10513 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10501 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 10514 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10502 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), 10515 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10516 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10503 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 10517 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10504 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), 10518 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10505 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), 10519 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 393f7fd2b1be..a4f44a00bae8 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -840,7 +840,7 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
840static struct snd_kcontrol_new stac925x_mixer[] = { 840static struct snd_kcontrol_new stac925x_mixer[] = {
841 STAC_INPUT_SOURCE(1), 841 STAC_INPUT_SOURCE(1),
842 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), 842 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
843 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT), 843 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
844 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), 844 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
845 { } /* end */ 845 { } /* end */
846}; 846};
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 52b1d81a26f7..e7e43524f8c7 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -447,6 +447,23 @@ static struct hda_pcm_stream vt1708_pcm_analog_playback = {
447 }, 447 },
448}; 448};
449 449
450static struct hda_pcm_stream vt1708_pcm_analog_s16_playback = {
451 .substreams = 1,
452 .channels_min = 2,
453 .channels_max = 8,
454 .nid = 0x10, /* NID to query formats and rates */
455 /* We got noisy outputs on the right channel on VT1708 when
456 * 24bit samples are used. Until any workaround is found,
457 * disable the 24bit format, so far.
458 */
459 .formats = SNDRV_PCM_FMTBIT_S16_LE,
460 .ops = {
461 .open = via_playback_pcm_open,
462 .prepare = via_playback_pcm_prepare,
463 .cleanup = via_playback_pcm_cleanup
464 },
465};
466
450static struct hda_pcm_stream vt1708_pcm_analog_capture = { 467static struct hda_pcm_stream vt1708_pcm_analog_capture = {
451 .substreams = 2, 468 .substreams = 2,
452 .channels_min = 2, 469 .channels_min = 2,
@@ -899,6 +916,9 @@ static int patch_vt1708(struct hda_codec *codec)
899 916
900 spec->stream_name_analog = "VT1708 Analog"; 917 spec->stream_name_analog = "VT1708 Analog";
901 spec->stream_analog_playback = &vt1708_pcm_analog_playback; 918 spec->stream_analog_playback = &vt1708_pcm_analog_playback;
919 /* disable 32bit format on VT1708 */
920 if (codec->vendor_id == 0x11061708)
921 spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback;
902 spec->stream_analog_capture = &vt1708_pcm_analog_capture; 922 spec->stream_analog_capture = &vt1708_pcm_analog_capture;
903 923
904 spec->stream_name_digital = "VT1708 Digital"; 924 spec->stream_name_digital = "VT1708 Digital";
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 630684f4a0bc..09b1661b8a3a 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -539,8 +539,8 @@ static const char *intercon[][3] = {
539 {"HPRCOM", NULL, "Right HP Com"}, 539 {"HPRCOM", NULL, "Right HP Com"},
540 540
541 /* Mono Output */ 541 /* Mono Output */
542 {"MONOLOUT", NULL, "Mono Out"}, 542 {"MONO_LOUT", NULL, "Mono Out"},
543 {"MONOLOUT", NULL, "Mono Out"}, 543 {"MONO_LOUT", NULL, "Mono Out"},
544 544
545 /* Left Input */ 545 /* Left Input */
546 {"Left Line1L Mux", "single-ended", "LINE1L"}, 546 {"Left Line1L Mux", "single-ended", "LINE1L"},
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index b2a11b0d2e4c..f588545698f3 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -416,7 +416,7 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd)
416 * to put data into its FIFO. Without it, ALSA starts 416 * to put data into its FIFO. Without it, ALSA starts
417 * to complain about overruns. 417 * to complain about overruns.
418 */ 418 */
419 msleep(1); 419 mdelay(1);
420 } 420 }
421 break; 421 break;
422 422
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index 83b1eb4e40f3..6533563a6011 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -188,8 +188,8 @@ static const char *audio_map[][3] = {
188static const char *spk_function[] = {"Off", "On"}; 188static const char *spk_function[] = {"Off", "On"};
189static const char *jack_function[] = {"Off", "Headphone"}; 189static const char *jack_function[] = {"Off", "Headphone"};
190static const struct soc_enum n810_enum[] = { 190static const struct soc_enum n810_enum[] = {
191 SOC_ENUM_SINGLE_EXT(2, spk_function), 191 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function),
192 SOC_ENUM_SINGLE_EXT(3, jack_function), 192 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(jack_function), jack_function),
193}; 193};
194 194
195static const struct snd_kcontrol_new aic33_n810_controls[] = { 195static const struct snd_kcontrol_new aic33_n810_controls[] = {
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index 478369bb38c3..b343818dbb96 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -341,8 +341,12 @@ snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
341 case MIDI_CTL_SOFT_PEDAL: 341 case MIDI_CTL_SOFT_PEDAL:
342#ifdef SNDRV_EMUX_USE_RAW_EFFECT 342#ifdef SNDRV_EMUX_USE_RAW_EFFECT
343 /* FIXME: this is an emulation */ 343 /* FIXME: this is an emulation */
344 snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, -160, 344 if (chan->control[type] >= 64)
345 snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, -160,
345 EMUX_FX_FLAG_ADD); 346 EMUX_FX_FLAG_ADD);
347 else
348 snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, 0,
349 EMUX_FX_FLAG_OFF);
346#endif 350#endif
347 break; 351 break;
348 352
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c
index e97d8b2ac16a..a972f77bd785 100644
--- a/sound/usb/caiaq/caiaq-device.c
+++ b/sound/usb/caiaq/caiaq-device.c
@@ -351,8 +351,8 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
351 dev = caiaqdev(card); 351 dev = caiaqdev(card);
352 dev->chip.dev = usb_dev; 352 dev->chip.dev = usb_dev;
353 dev->chip.card = card; 353 dev->chip.card = card;
354 dev->chip.usb_id = USB_ID(usb_dev->descriptor.idVendor, 354 dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor),
355 usb_dev->descriptor.idProduct); 355 le16_to_cpu(usb_dev->descriptor.idProduct));
356 spin_lock_init(&dev->spinlock); 356 spin_lock_init(&dev->spinlock);
357 snd_card_set_dev(card, &usb_dev->dev); 357 snd_card_set_dev(card, &usb_dev->dev);
358 358
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 4232fd75dd20..98778cb69c6e 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -45,7 +45,7 @@
45#else 45#else
46#define ioapic_debug(fmt, arg...) 46#define ioapic_debug(fmt, arg...)
47#endif 47#endif
48static void ioapic_deliver(struct kvm_ioapic *vioapic, int irq); 48static int ioapic_deliver(struct kvm_ioapic *vioapic, int irq);
49 49
50static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, 50static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
51 unsigned long addr, 51 unsigned long addr,
@@ -89,8 +89,8 @@ static void ioapic_service(struct kvm_ioapic *ioapic, unsigned int idx)
89 pent = &ioapic->redirtbl[idx]; 89 pent = &ioapic->redirtbl[idx];
90 90
91 if (!pent->fields.mask) { 91 if (!pent->fields.mask) {
92 ioapic_deliver(ioapic, idx); 92 int injected = ioapic_deliver(ioapic, idx);
93 if (pent->fields.trig_mode == IOAPIC_LEVEL_TRIG) 93 if (injected && pent->fields.trig_mode == IOAPIC_LEVEL_TRIG)
94 pent->fields.remote_irr = 1; 94 pent->fields.remote_irr = 1;
95 } 95 }
96 if (!pent->fields.trig_mode) 96 if (!pent->fields.trig_mode)
@@ -133,7 +133,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
133 } 133 }
134} 134}
135 135
136static void ioapic_inj_irq(struct kvm_ioapic *ioapic, 136static int ioapic_inj_irq(struct kvm_ioapic *ioapic,
137 struct kvm_vcpu *vcpu, 137 struct kvm_vcpu *vcpu,
138 u8 vector, u8 trig_mode, u8 delivery_mode) 138 u8 vector, u8 trig_mode, u8 delivery_mode)
139{ 139{
@@ -143,7 +143,7 @@ static void ioapic_inj_irq(struct kvm_ioapic *ioapic,
143 ASSERT((delivery_mode == IOAPIC_FIXED) || 143 ASSERT((delivery_mode == IOAPIC_FIXED) ||
144 (delivery_mode == IOAPIC_LOWEST_PRIORITY)); 144 (delivery_mode == IOAPIC_LOWEST_PRIORITY));
145 145
146 kvm_apic_set_irq(vcpu, vector, trig_mode); 146 return kvm_apic_set_irq(vcpu, vector, trig_mode);
147} 147}
148 148
149static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, 149static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
@@ -186,7 +186,7 @@ static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
186 return mask; 186 return mask;
187} 187}
188 188
189static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq) 189static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
190{ 190{
191 u8 dest = ioapic->redirtbl[irq].fields.dest_id; 191 u8 dest = ioapic->redirtbl[irq].fields.dest_id;
192 u8 dest_mode = ioapic->redirtbl[irq].fields.dest_mode; 192 u8 dest_mode = ioapic->redirtbl[irq].fields.dest_mode;
@@ -195,7 +195,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
195 u8 trig_mode = ioapic->redirtbl[irq].fields.trig_mode; 195 u8 trig_mode = ioapic->redirtbl[irq].fields.trig_mode;
196 u32 deliver_bitmask; 196 u32 deliver_bitmask;
197 struct kvm_vcpu *vcpu; 197 struct kvm_vcpu *vcpu;
198 int vcpu_id; 198 int vcpu_id, r = 0;
199 199
200 ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x " 200 ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x "
201 "vector=%x trig_mode=%x\n", 201 "vector=%x trig_mode=%x\n",
@@ -204,7 +204,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
204 deliver_bitmask = ioapic_get_delivery_bitmask(ioapic, dest, dest_mode); 204 deliver_bitmask = ioapic_get_delivery_bitmask(ioapic, dest, dest_mode);
205 if (!deliver_bitmask) { 205 if (!deliver_bitmask) {
206 ioapic_debug("no target on destination\n"); 206 ioapic_debug("no target on destination\n");
207 return; 207 return 0;
208 } 208 }
209 209
210 switch (delivery_mode) { 210 switch (delivery_mode) {
@@ -216,7 +216,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
216 vcpu = ioapic->kvm->vcpus[0]; 216 vcpu = ioapic->kvm->vcpus[0];
217#endif 217#endif
218 if (vcpu != NULL) 218 if (vcpu != NULL)
219 ioapic_inj_irq(ioapic, vcpu, vector, 219 r = ioapic_inj_irq(ioapic, vcpu, vector,
220 trig_mode, delivery_mode); 220 trig_mode, delivery_mode);
221 else 221 else
222 ioapic_debug("null lowest prio vcpu: " 222 ioapic_debug("null lowest prio vcpu: "
@@ -234,7 +234,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
234 deliver_bitmask &= ~(1 << vcpu_id); 234 deliver_bitmask &= ~(1 << vcpu_id);
235 vcpu = ioapic->kvm->vcpus[vcpu_id]; 235 vcpu = ioapic->kvm->vcpus[vcpu_id];
236 if (vcpu) { 236 if (vcpu) {
237 ioapic_inj_irq(ioapic, vcpu, vector, 237 r = ioapic_inj_irq(ioapic, vcpu, vector,
238 trig_mode, delivery_mode); 238 trig_mode, delivery_mode);
239 } 239 }
240 } 240 }
@@ -246,6 +246,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
246 delivery_mode); 246 delivery_mode);
247 break; 247 break;
248 } 248 }
249 return r;
249} 250}
250 251
251void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level) 252void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f7ba099049ea..2d29e260da3d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -758,25 +758,26 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
758 */ 758 */
759void kvm_vcpu_block(struct kvm_vcpu *vcpu) 759void kvm_vcpu_block(struct kvm_vcpu *vcpu)
760{ 760{
761 DECLARE_WAITQUEUE(wait, current); 761 DEFINE_WAIT(wait);
762 762
763 add_wait_queue(&vcpu->wq, &wait); 763 for (;;) {
764 764 prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
765 /* 765
766 * We will block until either an interrupt or a signal wakes us up 766 if (kvm_cpu_has_interrupt(vcpu))
767 */ 767 break;
768 while (!kvm_cpu_has_interrupt(vcpu) 768 if (kvm_cpu_has_pending_timer(vcpu))
769 && !kvm_cpu_has_pending_timer(vcpu) 769 break;
770 && !signal_pending(current) 770 if (kvm_arch_vcpu_runnable(vcpu))
771 && !kvm_arch_vcpu_runnable(vcpu)) { 771 break;
772 set_current_state(TASK_INTERRUPTIBLE); 772 if (signal_pending(current))
773 break;
774
773 vcpu_put(vcpu); 775 vcpu_put(vcpu);
774 schedule(); 776 schedule();
775 vcpu_load(vcpu); 777 vcpu_load(vcpu);
776 } 778 }
777 779
778 __set_current_state(TASK_RUNNING); 780 finish_wait(&vcpu->wq, &wait);
779 remove_wait_queue(&vcpu->wq, &wait);
780} 781}
781 782
782void kvm_resched(struct kvm_vcpu *vcpu) 783void kvm_resched(struct kvm_vcpu *vcpu)