aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-04-12 13:50:03 -0400
committerPaul Mackerras <paulus@samba.org>2007-04-12 13:50:03 -0400
commite049d1ca3094f3d1d94617f456a9961202f96e3a (patch)
treea30397ad22f2fbea268bd28fa69c60aad9dfa62a
parentedfac96a92b88d3b0b53e3f8231b74beee9ecd1d (diff)
parent80584ff3b99c36ead7e130e453b3a48b18072d18 (diff)
Merge branch 'linux-2.6' into for-2.6.22
-rw-r--r--Documentation/ABI/obsolete/dv13949
-rw-r--r--Documentation/cpusets.txt3
-rw-r--r--Documentation/crypto/api-intro.txt2
-rw-r--r--Documentation/feature-removal-schedule.txt19
-rw-r--r--Documentation/gpio.txt5
-rw-r--r--Documentation/kernel-parameters.txt19
-rw-r--r--Documentation/networking/ax25.txt18
-rw-r--r--Documentation/power/pci.txt17
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt4
-rw-r--r--Documentation/sparse.txt10
-rw-r--r--Documentation/sysrq.txt2
-rw-r--r--MAINTAINERS39
-rw-r--r--Makefile4
-rw-r--r--arch/arm/common/Kconfig1
-rw-r--r--arch/arm/kernel/dma.c1
-rw-r--r--arch/arm/kernel/setup.c7
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c8
-rw-r--r--arch/arm/mach-at91/gpio.c3
-rw-r--r--arch/arm/mach-imx/cpufreq.c15
-rw-r--r--arch/arm/mach-imx/generic.c9
-rw-r--r--arch/arm/mach-iop32x/Kconfig4
-rw-r--r--arch/arm/mach-iop32x/iq31244.c59
-rw-r--r--arch/arm/mach-ns9xxx/mach-cc9p9360dev.c2
-rw-r--r--arch/arm/mach-omap1/board-h2.c1
-rw-r--r--arch/arm/mach-omap2/clock.c1
-rw-r--r--arch/arm/mach-omap2/clock.h3
-rw-r--r--arch/arm/mach-pxa/tosa.c3
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c2
-rw-r--r--arch/arm/mach-s3c2443/irq.c2
-rw-r--r--arch/arm/mach-sa1100/generic.c4
-rw-r--r--arch/avr32/kernel/ptrace.c4
-rw-r--r--arch/avr32/kernel/traps.c52
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c2
-rw-r--r--arch/avr32/mach-at32ap/pio.c4
-rw-r--r--arch/avr32/mm/cache.c3
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c4
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c3
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/boot/video.S14
-rw-r--r--arch/i386/defconfig43
-rw-r--r--arch/i386/kernel/acpi/boot.c23
-rw-r--r--arch/i386/kernel/acpi/earlyquirk.c7
-rw-r--r--arch/i386/kernel/apic.c117
-rw-r--r--arch/i386/kernel/cpu/amd.c34
-rw-r--r--arch/i386/kernel/hpet.c70
-rw-r--r--arch/i386/kernel/i386_ksyms.c2
-rw-r--r--arch/i386/kernel/i8253.c10
-rw-r--r--arch/i386/kernel/io_apic.c2
-rw-r--r--arch/i386/kernel/microcode.c71
-rw-r--r--arch/i386/kernel/nmi.c137
-rw-r--r--arch/i386/kernel/smpboot.c16
-rw-r--r--arch/i386/kernel/tsc.c9
-rw-r--r--arch/i386/kernel/vmi.c40
-rw-r--r--arch/i386/lib/usercopy.c9
-rw-r--r--arch/i386/mm/highmem.c2
-rw-r--r--arch/i386/pci/common.c14
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/configs/tiger_defconfig263
-rw-r--r--arch/ia64/configs/zx1_defconfig344
-rw-r--r--arch/ia64/defconfig321
-rw-r--r--arch/ia64/kernel/asm-offsets.c1
-rw-r--r--arch/ia64/kernel/crash.c12
-rw-r--r--arch/ia64/kernel/efi.c12
-rw-r--r--arch/ia64/kernel/fsys.S105
-rw-r--r--arch/ia64/kernel/iosapic.c8
-rw-r--r--arch/ia64/kernel/mca.c8
-rw-r--r--arch/ia64/kernel/mca_drv.c65
-rw-r--r--arch/ia64/kernel/msi_ia64.c6
-rw-r--r--arch/ia64/kernel/ptrace.c1
-rw-r--r--arch/ia64/kernel/setup.c26
-rw-r--r--arch/ia64/kernel/smpboot.c17
-rw-r--r--arch/ia64/mm/contig.c30
-rw-r--r--arch/ia64/mm/discontig.c4
-rw-r--r--arch/ia64/mm/init.c18
-rw-r--r--arch/ia64/pci/pci.c7
-rw-r--r--arch/ia64/sn/kernel/bte_error.c6
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c44
-rw-r--r--arch/ia64/sn/kernel/io_init.c12
-rw-r--r--arch/ia64/sn/kernel/irq.c14
-rw-r--r--arch/ia64/sn/kernel/setup.c8
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c8
-rw-r--r--arch/mips/Kconfig26
-rw-r--r--arch/mips/arc/init.c6
-rw-r--r--arch/mips/configs/atlas_defconfig1
-rw-r--r--arch/mips/configs/bigsur_defconfig1
-rw-r--r--arch/mips/configs/capcella_defconfig1
-rw-r--r--arch/mips/configs/cobalt_defconfig1
-rw-r--r--arch/mips/configs/db1000_defconfig1
-rw-r--r--arch/mips/configs/db1100_defconfig1
-rw-r--r--arch/mips/configs/db1200_defconfig1
-rw-r--r--arch/mips/configs/db1500_defconfig1
-rw-r--r--arch/mips/configs/db1550_defconfig1
-rw-r--r--arch/mips/configs/ddb5477_defconfig1
-rw-r--r--arch/mips/configs/decstation_defconfig1
-rw-r--r--arch/mips/configs/e55_defconfig1
-rw-r--r--arch/mips/configs/emma2rh_defconfig1
-rw-r--r--arch/mips/configs/ev64120_defconfig1
-rw-r--r--arch/mips/configs/excite_defconfig1
-rw-r--r--arch/mips/configs/ip22_defconfig1
-rw-r--r--arch/mips/configs/ip27_defconfig1
-rw-r--r--arch/mips/configs/ip32_defconfig1
-rw-r--r--arch/mips/configs/jaguar-atx_defconfig1
-rw-r--r--arch/mips/configs/jazz_defconfig1
-rw-r--r--arch/mips/configs/jmr3927_defconfig1
-rw-r--r--arch/mips/configs/lasat200_defconfig1
-rw-r--r--arch/mips/configs/malta_defconfig1
-rw-r--r--arch/mips/configs/mipssim_defconfig1
-rw-r--r--arch/mips/configs/mpc30x_defconfig1
-rw-r--r--arch/mips/configs/ocelot_3_defconfig1
-rw-r--r--arch/mips/configs/ocelot_c_defconfig1
-rw-r--r--arch/mips/configs/ocelot_defconfig1
-rw-r--r--arch/mips/configs/ocelot_g_defconfig1
-rw-r--r--arch/mips/configs/pb1100_defconfig1
-rw-r--r--arch/mips/configs/pb1500_defconfig1
-rw-r--r--arch/mips/configs/pb1550_defconfig1
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig1
-rw-r--r--arch/mips/configs/pnx8550-stb810_defconfig1
-rw-r--r--arch/mips/configs/pnx8550-v2pci_defconfig1
-rw-r--r--arch/mips/configs/qemu_defconfig1
-rw-r--r--arch/mips/configs/rbhma4500_defconfig1
-rw-r--r--arch/mips/configs/rm200_defconfig1
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig1
-rw-r--r--arch/mips/configs/sead_defconfig1
-rw-r--r--arch/mips/configs/tb0226_defconfig1
-rw-r--r--arch/mips/configs/tb0229_defconfig1
-rw-r--r--arch/mips/configs/tb0287_defconfig1
-rw-r--r--arch/mips/configs/workpad_defconfig1
-rw-r--r--arch/mips/configs/wrppmc_defconfig1
-rw-r--r--arch/mips/configs/yosemite_defconfig1
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq.c2
-rw-r--r--arch/mips/dec/prom/init.c3
-rw-r--r--arch/mips/defconfig1
-rw-r--r--arch/mips/emma2rh/markeins/irq.c2
-rw-r--r--arch/mips/gt64120/ev64120/irq.c2
-rw-r--r--arch/mips/gt64120/momenco_ocelot/prom.c1
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c2
-rw-r--r--arch/mips/gt64120/wrppmc/irq.c2
-rw-r--r--arch/mips/jazz/irq.c2
-rw-r--r--arch/mips/jazz/jazzdma.c3
-rw-r--r--arch/mips/kernel/entry.S6
-rw-r--r--arch/mips/kernel/genex.S47
-rw-r--r--arch/mips/kernel/kspd.c22
-rw-r--r--arch/mips/kernel/linux32.c58
-rw-r--r--arch/mips/kernel/r2300_switch.S10
-rw-r--r--arch/mips/kernel/r4k_fpu.S16
-rw-r--r--arch/mips/kernel/r4k_switch.S10
-rw-r--r--arch/mips/kernel/rtlx.c104
-rw-r--r--arch/mips/kernel/signal-common.h3
-rw-r--r--arch/mips/kernel/signal.c75
-rw-r--r--arch/mips/kernel/signal32.c56
-rw-r--r--arch/mips/kernel/signal_n32.c6
-rw-r--r--arch/mips/kernel/smtc.c65
-rw-r--r--arch/mips/kernel/traps.c84
-rw-r--r--arch/mips/math-emu/kernel_linkage.c8
-rw-r--r--arch/mips/mips-boards/generic/init.c2
-rw-r--r--arch/mips/mm/c-r3k.c2
-rw-r--r--arch/mips/mm/cache.c16
-rw-r--r--arch/mips/mm/cerr-sb1.c9
-rw-r--r--arch/mips/mm/dma-default.c17
-rw-r--r--arch/mips/mm/fault.c6
-rw-r--r--arch/mips/mm/init.c6
-rw-r--r--arch/mips/mm/pg-sb1.c3
-rw-r--r--arch/mips/momentum/ocelot_c/irq.c2
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c22
-rw-r--r--arch/mips/pci/pci-bcm1480.c2
-rw-r--r--arch/mips/pci/pci-ev64120.c1
-rw-r--r--arch/mips/pci/pci-sb1250.c2
-rw-r--r--arch/mips/philips/pnx8550/common/int.c21
-rw-r--r--arch/mips/qemu/q-smp.c7
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c2
-rw-r--r--arch/mips/sibyte/Kconfig22
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c4
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c6
-rw-r--r--arch/mips/sibyte/sb1250/bcm1250_tbprof.c377
-rw-r--r--arch/mips/sibyte/sb1250/irq.c2
-rw-r--r--arch/mips/sibyte/sb1250/setup.c2
-rw-r--r--arch/mips/sibyte/swarm/setup.c18
-rw-r--r--arch/mips/sni/pcimt.c2
-rw-r--r--arch/mips/sni/pcit.c4
-rw-r--r--arch/mips/tx4927/common/tx4927_irq.c2
-rw-r--r--arch/powerpc/configs/cell_defconfig151
-rw-r--r--arch/powerpc/kernel/process.c9
-rw-r--r--arch/powerpc/kernel/udbg_16550.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c6
-rw-r--r--arch/powerpc/mm/hugetlbpage.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c8
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c81
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c24
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c20
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h6
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c62
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c2
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S41
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c2
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h16
-rw-r--r--arch/powerpc/sysdev/dcr.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c6
-rw-r--r--arch/s390/appldata/appldata_mem.c5
-rw-r--r--arch/s390/kernel/compat_wrapper.S17
-rw-r--r--arch/s390/kernel/debug.c2
-rw-r--r--arch/s390/kernel/early.c10
-rw-r--r--arch/s390/kernel/ipl.c9
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/s390/kernel/syscalls.S3
-rw-r--r--arch/sh/boards/renesas/r7780rp/Makefile2
-rw-r--r--arch/sh/boards/renesas/r7780rp/io.c233
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c24
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c26
-rw-r--r--arch/sh/configs/rts7751r2d_defconfig110
-rw-r--r--arch/sh/drivers/pci/pci-auto.c6
-rw-r--r--arch/sh/kernel/cpu/init.c20
-rw-r--r--arch/sh/kernel/cpu/sh2/entry.S1
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S5
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c13
-rw-r--r--arch/sh/kernel/entry-common.S2
-rw-r--r--arch/sh/kernel/io_generic.c3
-rw-r--r--arch/sh/kernel/irq.c15
-rw-r--r--arch/sh/kernel/process.c5
-rw-r--r--arch/sh/kernel/ptrace.c45
-rw-r--r--arch/sh/kernel/sh_ksyms.c3
-rw-r--r--arch/sh/kernel/signal.c4
-rw-r--r--arch/sh/kernel/vmlinux.lds.S3
-rw-r--r--arch/sh/mm/cache-sh4.c12
-rw-r--r--arch/sh/mm/cache-sh7705.c9
-rw-r--r--arch/sh/mm/pg-sh4.c22
-rw-r--r--arch/sh/mm/pg-sh7705.c31
-rw-r--r--arch/sh/mm/tlb-flush.c55
-rw-r--r--arch/sh/mm/tlb-sh3.c63
-rw-r--r--arch/sh/mm/tlb-sh4.c68
-rw-r--r--arch/sparc/kernel/process.c16
-rw-r--r--arch/sparc/kernel/systbls.S6
-rw-r--r--arch/sparc/kernel/traps.c6
-rw-r--r--arch/sparc/lib/atomic32.c2
-rw-r--r--arch/sparc/mm/init.c2
-rw-r--r--arch/sparc64/Kconfig14
-rw-r--r--arch/sparc64/defconfig10
-rw-r--r--arch/sparc64/kernel/ktlb.S8
-rw-r--r--arch/sparc64/kernel/process.c9
-rw-r--r--arch/sparc64/kernel/systbls.S9
-rw-r--r--arch/sparc64/kernel/tsb.S1
-rw-r--r--arch/sparc64/lib/NGbzero.S1
-rw-r--r--arch/sparc64/lib/NGmemcpy.S2
-rw-r--r--arch/sparc64/lib/NGpage.S2
-rw-r--r--arch/sparc64/mm/hugetlbpage.c3
-rw-r--r--arch/sparc64/mm/init.c30
-rw-r--r--arch/um/Kconfig2
-rw-r--r--arch/um/drivers/chan_kern.c12
-rw-r--r--arch/um/drivers/daemon_user.c17
-rw-r--r--arch/um/drivers/line.c6
-rw-r--r--arch/um/drivers/mcast_user.c10
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/drivers/ssl.c2
-rw-r--r--arch/um/drivers/stdio_console.c2
-rw-r--r--arch/um/drivers/ubd_kern.c13
-rw-r--r--arch/um/include/mconsole.h2
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h4
-rw-r--r--arch/um/kernel/irq.c1
-rw-r--r--arch/um/kernel/mem.c3
-rw-r--r--arch/um/os-Linux/process.c3
-rw-r--r--arch/um/os-Linux/signal.c5
-rw-r--r--arch/um/os-Linux/skas/mem.c10
-rw-r--r--arch/um/os-Linux/skas/process.c6
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c4
-rw-r--r--arch/um/scripts/Makefile.rules4
-rw-r--r--arch/um/sys-i386/delay.c11
-rw-r--r--arch/um/sys-i386/ldt.c3
-rw-r--r--arch/um/sys-x86_64/delay.c11
-rw-r--r--arch/um/sys-x86_64/syscalls.c6
-rw-r--r--arch/x86_64/boot/video.S14
-rw-r--r--arch/x86_64/defconfig53
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/ia32/ptrace32.c1
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c4
-rw-r--r--arch/x86_64/kernel/apic.c19
-rw-r--r--arch/x86_64/kernel/cpufreq/Kconfig1
-rw-r--r--arch/x86_64/kernel/e820.c2
-rw-r--r--arch/x86_64/kernel/early-quirks.c17
-rw-r--r--arch/x86_64/kernel/i8259.c6
-rw-r--r--arch/x86_64/kernel/mpparse.c4
-rw-r--r--arch/x86_64/kernel/nmi.c125
-rw-r--r--arch/x86_64/kernel/pci-gart.c2
-rw-r--r--arch/x86_64/kernel/process.c13
-rw-r--r--arch/x86_64/kernel/smpboot.c5
-rw-r--r--arch/x86_64/kernel/vsyscall.c2
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c1
-rw-r--r--block/elevator.c7
-rw-r--r--block/genhd.c2
-rw-r--r--block/ll_rw_blk.c6
-rw-r--r--crypto/scatterwalk.c12
-rw-r--r--crypto/tcrypt.c2
-rw-r--r--drivers/acpi/Kconfig12
-rw-r--r--drivers/acpi/blacklist.c10
-rw-r--r--drivers/acpi/ec.c40
-rw-r--r--drivers/acpi/events/evmisc.c33
-rw-r--r--drivers/acpi/events/evregion.c15
-rw-r--r--drivers/acpi/events/evxface.c6
-rw-r--r--drivers/acpi/executer/excreate.c5
-rw-r--r--drivers/acpi/executer/exsystem.c30
-rw-r--r--drivers/acpi/executer/exutils.c104
-rw-r--r--drivers/acpi/hardware/hwsleep.c5
-rw-r--r--drivers/acpi/ibm_acpi.c47
-rw-r--r--drivers/acpi/namespace/nseval.c11
-rw-r--r--drivers/acpi/namespace/nsinit.c7
-rw-r--r--drivers/acpi/namespace/nsxfeval.c11
-rw-r--r--drivers/acpi/power.c20
-rw-r--r--drivers/acpi/processor_idle.c3
-rw-r--r--drivers/acpi/resources/rscreate.c25
-rw-r--r--drivers/acpi/tables.c57
-rw-r--r--drivers/acpi/video.c38
-rw-r--r--drivers/ata/Kconfig2
-rw-r--r--drivers/ata/ahci.c21
-rw-r--r--drivers/ata/ata_piix.c11
-rw-r--r--drivers/ata/libata-acpi.c32
-rw-r--r--drivers/ata/libata-core.c67
-rw-r--r--drivers/ata/libata-eh.c96
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/pata_cs5520.c2
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c3
-rw-r--r--drivers/ata/pata_mpc52xx.c2
-rw-r--r--drivers/ata/pata_pdc202xx_old.c2
-rw-r--r--drivers/ata/sata_inic162x.c4
-rw-r--r--drivers/ata/sata_nv.c8
-rw-r--r--drivers/ata/sata_sil24.c1
-rw-r--r--drivers/ata/sata_sis.c2
-rw-r--r--drivers/atm/zatm.c4
-rw-r--r--drivers/base/core.c73
-rw-r--r--drivers/base/driver.c9
-rw-r--r--drivers/base/power/main.c6
-rw-r--r--drivers/block/cciss.c11
-rw-r--r--drivers/block/paride/pd.c8
-rw-r--r--drivers/char/Kconfig33
-rw-r--r--drivers/char/agp/intel-agp.c17
-rw-r--r--drivers/char/drm/Makefile2
-rw-r--r--drivers/char/drm/ffb_context.c544
-rw-r--r--drivers/char/drm/ffb_drv.c355
-rw-r--r--drivers/char/drm/ffb_drv.h379
-rw-r--r--drivers/char/ds1286.c9
-rw-r--r--drivers/char/generic_serial.c7
-rw-r--r--drivers/char/lcd.c5
-rw-r--r--drivers/char/tty_io.c5
-rw-r--r--drivers/char/vt.c21
-rw-r--r--drivers/char/vt_ioctl.c18
-rw-r--r--drivers/char/watchdog/Kconfig1
-rw-r--r--drivers/char/watchdog/machzwd.c24
-rw-r--r--drivers/clocksource/acpi_pm.c2
-rw-r--r--drivers/connector/connector.c22
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/dma/dmaengine.c18
-rw-r--r--drivers/eisa/pci_eisa.c4
-rw-r--r--drivers/hid/hid-core.c31
-rw-r--r--drivers/hwmon/Kconfig1
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c3
-rw-r--r--drivers/i2c/busses/i2c-i801.c25
-rw-r--r--drivers/i2c/chips/ds1374.c4
-rw-r--r--drivers/ide/Kconfig54
-rw-r--r--drivers/ide/Makefile1
-rw-r--r--drivers/ide/arm/icside.c13
-rw-r--r--drivers/ide/ide-cd.c9
-rw-r--r--drivers/ide/ide-dma.c2
-rw-r--r--drivers/ide/ide-io.c38
-rw-r--r--drivers/ide/ide-iops.c13
-rw-r--r--drivers/ide/ide.c43
-rw-r--r--drivers/ide/mips/au1xxx-ide.c3
-rw-r--r--drivers/ide/pci/Makefile1
-rw-r--r--drivers/ide/pci/cmd64x.c45
-rw-r--r--drivers/ide/pci/jmicron.c29
-rw-r--r--drivers/ide/pci/pdc202xx_new.c3
-rw-r--r--drivers/ide/pci/scc_pata.c (renamed from drivers/ide/ppc/scc_pata.c)0
-rw-r--r--drivers/ide/setup-pci.c5
-rw-r--r--drivers/ieee1394/Kconfig6
-rw-r--r--drivers/ieee1394/dv1394.c4
-rw-r--r--drivers/ieee1394/eth1394.c3
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--drivers/infiniband/core/ucma.c2
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c13
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c19
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_ev.c12
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c45
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.h33
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_qp.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h6
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c16
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c67
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_dma.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c16
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c11
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c13
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h1
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c17
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c40
-rw-r--r--drivers/input/serio/i8042.c10
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c1
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c4
-rw-r--r--drivers/isdn/gigaset/common.c6
-rw-r--r--drivers/isdn/gigaset/ev-layer.c4
-rw-r--r--drivers/isdn/gigaset/isocdata.c4
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c2
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
-rw-r--r--drivers/isdn/hisax/isar.c2
-rw-r--r--drivers/kvm/kvm_main.c4
-rw-r--r--drivers/kvm/mmu.c52
-rw-r--r--drivers/kvm/vmx.c47
-rw-r--r--drivers/md/linear.c2
-rw-r--r--drivers/md/md.c58
-rw-r--r--drivers/md/raid5.c19
-rw-r--r--drivers/media/common/ir-functions.c6
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c12
-rw-r--r--drivers/media/dvb/dvb-core/dvb_demux.c21
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c9
-rw-r--r--drivers/media/dvb/frontends/isl6421.c1
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c4
-rw-r--r--drivers/media/dvb/frontends/tda10086.c2
-rw-r--r--drivers/media/dvb/pluto2/pluto2.c22
-rw-r--r--drivers/media/radio/Kconfig2
-rw-r--r--drivers/media/video/msp3400-driver.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c6
-rw-r--r--drivers/media/video/saa7115.c2
-rw-r--r--drivers/media/video/tuner-core.c10
-rw-r--r--drivers/message/fusion/mptsas.c7
-rw-r--r--drivers/message/i2o/i2o_block.c12
-rw-r--r--drivers/mfd/sm501.c2
-rw-r--r--drivers/misc/asus-laptop.c2
-rw-r--r--drivers/misc/sony-laptop.c2
-rw-r--r--drivers/mmc/imxmmc.c13
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c2
-rw-r--r--drivers/mtd/maps/dilnetpc.c4
-rw-r--r--drivers/mtd/maps/esb2rom.c11
-rw-r--r--drivers/mtd/mtdconcat.c1
-rw-r--r--drivers/mtd/mtdpart.c7
-rw-r--r--drivers/mtd/nand/diskonchip.c2
-rw-r--r--drivers/mtd/nand/nand_base.c1
-rw-r--r--drivers/mtd/onenand/onenand_base.c77
-rw-r--r--drivers/net/3c59x.c28
-rw-r--r--drivers/net/Kconfig25
-rw-r--r--drivers/net/atl1/atl1_hw.c1
-rw-r--r--drivers/net/atl1/atl1_main.c14
-rw-r--r--drivers/net/b44.c2
-rw-r--r--drivers/net/bnx2.c38
-rw-r--r--drivers/net/cxgb3/common.h27
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c121
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c18
-rw-r--r--drivers/net/cxgb3/mc5.c3
-rw-r--r--drivers/net/cxgb3/regs.h32
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/cxgb3/t3_hw.c39
-rw-r--r--drivers/net/cxgb3/version.h5
-rw-r--r--drivers/net/cxgb3/xgmac.c191
-rw-r--r--drivers/net/ewrk3.c3
-rw-r--r--drivers/net/forcedeth.c8
-rw-r--r--drivers/net/ifb.c35
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/irda/pxaficp_ir.c30
-rw-r--r--drivers/net/mv643xx_eth.c28
-rw-r--r--drivers/net/myri10ge/myri10ge.c88
-rw-r--r--drivers/net/natsemi.c58
-rw-r--r--drivers/net/netxen/netxen_nic.h1
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c1
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c10
-rw-r--r--drivers/net/netxen/netxen_nic_init.c14
-rw-r--r--drivers/net/pci-skeleton.c4
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c4
-rw-r--r--drivers/net/ppp_generic.c3
-rwxr-xr-xdrivers/net/qla3xxx.c110
-rwxr-xr-xdrivers/net/qla3xxx.h3
-rw-r--r--drivers/net/r8169.c60
-rw-r--r--drivers/net/saa9730.c177
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/sc92031.c20
-rw-r--r--drivers/net/sis190.c1
-rw-r--r--drivers/net/skge.c215
-rw-r--r--drivers/net/skge.h6
-rw-r--r--drivers/net/sky2.c36
-rw-r--r--drivers/net/sun3lance.c16
-rw-r--r--drivers/net/sungem.c30
-rw-r--r--drivers/net/tg3.c136
-rw-r--r--drivers/net/tg3.h5
-rw-r--r--drivers/net/tokenring/ibmtr.c25
-rw-r--r--drivers/net/tulip/dmfe.c6
-rw-r--r--drivers/net/ucc_geth.c3
-rw-r--r--drivers/net/via-rhine.c32
-rw-r--r--drivers/net/wan/lmc/lmc_media.h65
-rw-r--r--drivers/net/wan/z85230.c2
-rw-r--r--drivers/net/wireless/airo.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c26
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c71
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_radio.c26
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c10
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c12
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al2230.c6
-rw-r--r--drivers/oprofile/event_buffer.c5
-rw-r--r--drivers/oprofile/oprofilefs.c5
-rw-r--r--drivers/pci/msi.c151
-rw-r--r--drivers/pci/pci.c29
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c6
-rw-r--r--drivers/pci/pcie/portdrv_pci.c8
-rw-r--r--drivers/pci/quirks.c18
-rw-r--r--drivers/pci/search.c2
-rw-r--r--drivers/pcmcia/au1000_generic.c2
-rw-r--r--drivers/pcmcia/omap_cf.c41
-rw-r--r--drivers/pnp/manager.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c120
-rw-r--r--drivers/pnp/system.c13
-rw-r--r--drivers/ps3/ps3av_cmd.c24
-rw-r--r--drivers/ps3/vuart.c4
-rw-r--r--drivers/rtc/rtc-cmos.c50
-rw-r--r--drivers/s390/block/dasd_diag.c10
-rw-r--r--drivers/s390/cio/ccwgroup.c18
-rw-r--r--drivers/s390/cio/device_status.c14
-rw-r--r--drivers/s390/cio/qdio.c26
-rw-r--r--drivers/s390/crypto/ap_bus.c58
-rw-r--r--drivers/s390/crypto/ap_bus.h1
-rw-r--r--drivers/s390/crypto/zcrypt_api.c12
-rw-r--r--drivers/s390/net/qeth.h2
-rw-r--r--drivers/scsi/gdth.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c5
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_sysfs.c14
-rw-r--r--drivers/serial/8250_pnp.c3
-rw-r--r--drivers/serial/sh-sci.c11
-rw-r--r--drivers/serial/sn_console.c52
-rw-r--r--drivers/spi/at25.c2
-rw-r--r--drivers/spi/atmel_spi.c2
-rw-r--r--drivers/spi/spi.c10
-rw-r--r--drivers/spi/spi_bitbang.c26
-rw-r--r--drivers/spi/spi_s3c24xx.c2
-rw-r--r--drivers/tc/zs.c1
-rw-r--r--drivers/usb/class/cdc-acm.c8
-rw-r--r--drivers/usb/class/usblp.c6
-rw-r--r--drivers/usb/core/devio.c13
-rw-r--r--drivers/usb/core/hub.c9
-rw-r--r--drivers/usb/core/message.c9
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/gadget/at91_udc.c6
-rw-r--r--drivers/usb/gadget/goku_udc.c29
-rw-r--r--drivers/usb/gadget/omap_udc.c103
-rw-r--r--drivers/usb/host/ehci-hcd.c1
-rw-r--r--drivers/usb/host/ehci-hub.c3
-rw-r--r--drivers/usb/host/uhci-debug.c26
-rw-r--r--drivers/usb/host/uhci-hcd.c3
-rw-r--r--drivers/usb/host/uhci-hub.c11
-rw-r--r--drivers/usb/host/uhci-q.c94
-rw-r--r--drivers/usb/misc/berry_charge.c2
-rw-r--r--drivers/usb/misc/ftdi-elan.c18
-rw-r--r--drivers/usb/net/dm9601.c12
-rw-r--r--drivers/usb/serial/airprime.c52
-rw-r--r--drivers/usb/serial/cp2101.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c96
-rw-r--r--drivers/usb/serial/ftdi_sio.h21
-rw-r--r--drivers/usb/serial/generic.c7
-rw-r--r--drivers/usb/serial/ipaq.c2
-rw-r--r--drivers/usb/serial/mos7720.c1
-rw-r--r--drivers/usb/serial/option.c15
-rw-r--r--drivers/usb/serial/usb-serial.c11
-rw-r--r--drivers/usb/storage/unusual_devs.h34
-rw-r--r--drivers/video/Kconfig6
-rw-r--r--drivers/video/backlight/locomolcd.c4
-rw-r--r--drivers/video/backlight/progear_bl.c4
-rw-r--r--drivers/video/bw2.c18
-rw-r--r--drivers/video/cg14.c5
-rw-r--r--drivers/video/cg3.c26
-rw-r--r--drivers/video/ffb.c84
-rw-r--r--drivers/video/riva/fbdev.c4
-rw-r--r--drivers/video/s3fb.c3
-rw-r--r--drivers/video/savage/savagefb_driver.c18
-rw-r--r--drivers/video/sstfb.c1
-rw-r--r--fs/9p/v9fs_vfs.h1
-rw-r--r--fs/9p/vfs_file.c4
-rw-r--r--fs/aio.c1
-rw-r--r--fs/binfmt_elf.c7
-rw-r--r--fs/binfmt_elf_fdpic.c17
-rw-r--r--fs/char_dev.c2
-rw-r--r--fs/cifs/CHANGES6
-rw-r--r--fs/cifs/cifspdu.h10
-rw-r--r--fs/cifs/inode.c21
-rw-r--r--fs/cifs/readdir.c4
-rw-r--r--fs/compat.c100
-rw-r--r--fs/compat_ioctl.c9
-rw-r--r--fs/configfs/dir.c27
-rw-r--r--fs/dlm/user.c1
-rw-r--r--fs/ecryptfs/dentry.c15
-rw-r--r--fs/ecryptfs/inode.c2
-rw-r--r--fs/ext3/inode.c85
-rw-r--r--fs/ext3/xattr.c3
-rw-r--r--fs/ext4/inode.c85
-rw-r--r--fs/fuse/dir.c5
-rw-r--r--fs/fuse/fuse_i.h5
-rw-r--r--fs/fuse/inode.c2
-rw-r--r--fs/gfs2/glock.c4
-rw-r--r--fs/gfs2/glops.c3
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/inode.c7
-rw-r--r--fs/gfs2/ops_address.c7
-rw-r--r--fs/gfs2/ops_export.c5
-rw-r--r--fs/gfs2/ops_fstype.c2
-rw-r--r--fs/gfs2/quota.c2
-rw-r--r--fs/gfs2/super.c1
-rw-r--r--fs/hostfs/hostfs_kern.c26
-rw-r--r--fs/jffs2/background.c8
-rw-r--r--fs/jffs2/readinode.c16
-rw-r--r--fs/jffs2/scan.c9
-rw-r--r--fs/jffs2/wbuf.c7
-rw-r--r--fs/nfs/inode.c3
-rw-r--r--fs/nfs/super.c4
-rw-r--r--fs/nfs/sysctl.c8
-rw-r--r--fs/nfs/write.c116
-rw-r--r--fs/nfsd/nfs3xdr.c6
-rw-r--r--fs/nfsd/nfs4acl.c2
-rw-r--r--fs/nfsd/nfs4state.c6
-rw-r--r--fs/nfsd/nfsfh.c1
-rw-r--r--fs/ocfs2/aops.c26
-rw-r--r--fs/ocfs2/cluster/heartbeat.c50
-rw-r--r--fs/ocfs2/cluster/heartbeat.h2
-rw-r--r--fs/ocfs2/cluster/tcp.c13
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c8
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c102
-rw-r--r--fs/ocfs2/dlm/dlmthread.c10
-rw-r--r--fs/ocfs2/heartbeat.c15
-rw-r--r--fs/partitions/Kconfig3
-rw-r--r--fs/partitions/check.c4
-rw-r--r--fs/proc/Makefile3
-rw-r--r--fs/proc/base.c21
-rw-r--r--fs/proc/internal.h4
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/smbfs/request.c1
-rw-r--r--fs/splice.c109
-rw-r--r--fs/sysfs/file.c64
-rw-r--r--fs/sysfs/inode.c10
-rw-r--r--fs/ufs/balloc.c86
-rw-r--r--fs/ufs/ialloc.c5
-rw-r--r--fs/ufs/inode.c36
-rw-r--r--fs/ufs/truncate.c38
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c4
-rw-r--r--include/acpi/acinterp.h6
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/asm-arm/arch-at91/gpio.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h17
-rw-r--r--include/asm-arm/arch-ixp4xx/ixp4xx-regs.h6
-rw-r--r--include/asm-arm/arch-lh7a40x/entry-macro.S12
-rw-r--r--include/asm-arm/arch-ns9xxx/clock.h10
-rw-r--r--include/asm-arm/arch-omap/gpio.h3
-rw-r--r--include/asm-arm/arch-pxa/gpio.h4
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h2
-rw-r--r--include/asm-arm/arch-s3c2410/gpio.h4
-rw-r--r--include/asm-arm/arch-sa1100/gpio.h2
-rw-r--r--include/asm-arm/atomic.h4
-rw-r--r--include/asm-arm/system.h34
-rw-r--r--include/asm-arm/unistd.h2
-rw-r--r--include/asm-avr32/Kbuild2
-rw-r--r--include/asm-avr32/arch-at32ap/gpio.h2
-rw-r--r--include/asm-avr32/dma-mapping.h18
-rw-r--r--include/asm-generic/pgtable.h2
-rw-r--r--include/asm-i386/apic.h1
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/elf.h10
-rw-r--r--include/asm-i386/msr.h2
-rw-r--r--include/asm-i386/nmi.h2
-rw-r--r--include/asm-i386/paravirt.h5
-rw-r--r--include/asm-i386/sync_bitops.h2
-rw-r--r--include/asm-i386/termbits.h2
-rw-r--r--include/asm-i386/vmi_time.h2
-rw-r--r--include/asm-ia64/kexec.h1
-rw-r--r--include/asm-ia64/machvec.h2
-rw-r--r--include/asm-ia64/mca.h2
-rw-r--r--include/asm-ia64/meminit.h1
-rw-r--r--include/asm-ia64/pal.h1
-rw-r--r--include/asm-ia64/pci.h3
-rw-r--r--include/asm-ia64/processor.h2
-rw-r--r--include/asm-ia64/sal.h5
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h5
-rw-r--r--include/asm-ia64/unwind.h2
-rw-r--r--include/asm-m32r/dma-mapping.h19
-rw-r--r--include/asm-m68k/dma-mapping.h2
-rw-r--r--include/asm-m68k/mc146818rtc.h1
-rw-r--r--include/asm-mips/atomic.h40
-rw-r--r--include/asm-mips/bitops.h24
-rw-r--r--include/asm-mips/cacheflush.h12
-rw-r--r--include/asm-mips/cpu-features.h3
-rw-r--r--include/asm-mips/cpu-info.h1
-rw-r--r--include/asm-mips/delay.h2
-rw-r--r--include/asm-mips/dma.h2
-rw-r--r--include/asm-mips/fpu.h54
-rw-r--r--include/asm-mips/hazards.h1
-rw-r--r--include/asm-mips/irqflags.h55
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h34
-rw-r--r--include/asm-mips/mach-ip27/dma-coherence.h5
-rw-r--r--include/asm-mips/mach-ip32/dma-coherence.h5
-rw-r--r--include/asm-mips/marvell.h1
-rw-r--r--include/asm-mips/pgtable-64.h2
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/rtlx.h4
-rw-r--r--include/asm-mips/sgiarcs.h2
-rw-r--r--include/asm-mips/sibyte/sb1250.h2
-rw-r--r--include/asm-mips/sibyte/trace_prof.h110
-rw-r--r--include/asm-mips/smtc_ipi.h16
-rw-r--r--include/asm-mips/system.h16
-rw-r--r--include/asm-mips/thread_info.h1
-rw-r--r--include/asm-powerpc/floppy.h2
-rw-r--r--include/asm-powerpc/hvcall.h14
-rw-r--r--include/asm-powerpc/immap_qe.h3
-rw-r--r--include/asm-powerpc/spu.h7
-rw-r--r--include/asm-powerpc/spu_csa.h4
-rw-r--r--include/asm-powerpc/systbl.h3
-rw-r--r--include/asm-powerpc/unistd.h3
-rw-r--r--include/asm-s390/checksum.h59
-rw-r--r--include/asm-s390/ipl.h5
-rw-r--r--include/asm-s390/unistd.h3
-rw-r--r--include/asm-sh/cache.h3
-rw-r--r--include/asm-sh/cacheflush.h3
-rw-r--r--include/asm-sh/cpu-sh3/cacheflush.h2
-rw-r--r--include/asm-sh/cpu-sh4/cacheflush.h2
-rw-r--r--include/asm-sh/hp6xx.h6
-rw-r--r--include/asm-sh/ioctls.h22
-rw-r--r--include/asm-sh/irq.h5
-rw-r--r--include/asm-sh/pgtable.h5
-rw-r--r--include/asm-sh/system.h1
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--include/asm-sh/unistd.h1
-rw-r--r--include/asm-sparc/a.out.h2
-rw-r--r--include/asm-sparc/dma-mapping.h15
-rw-r--r--include/asm-sparc/mostek.h2
-rw-r--r--include/asm-sparc/unistd.h16
-rw-r--r--include/asm-sparc64/a.out.h2
-rw-r--r--include/asm-sparc64/mostek.h2
-rw-r--r--include/asm-sparc64/parport.h11
-rw-r--r--include/asm-sparc64/tsb.h2
-rw-r--r--include/asm-sparc64/unistd.h17
-rw-r--r--include/asm-um/common.lds.S1
-rw-r--r--include/asm-um/delay.h17
-rw-r--r--include/asm-um/pgtable-2level.h8
-rw-r--r--include/asm-x86_64/apic.h1
-rw-r--r--include/asm-x86_64/hw_irq.h2
-rw-r--r--include/asm-x86_64/nmi.h2
-rw-r--r--include/asm-x86_64/proto.h2
-rw-r--r--include/asm-x86_64/smp.h3
-rw-r--r--include/asm-x86_64/uaccess.h4
-rw-r--r--include/linux/ata.h1
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/compat.h19
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/cpu.h4
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/hrtimer.h3
-rw-r--r--include/linux/ide.h3
-rw-r--r--include/linux/ipc.h9
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kdev_t.h2
-rw-r--r--include/linux/ktime.h6
-rw-r--r--include/linux/libata.h6
-rw-r--r--include/linux/lockdep.h2
-rw-r--r--include/linux/msi.h8
-rw-r--r--include/linux/mtd/mtd.h1
-rw-r--r--include/linux/mtd/onenand.h5
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/pipe_fs_i.h4
-rw-r--r--include/linux/raid/md_k.h1
-rw-r--r--include/linux/security.h8
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/spi/spi_bitbang.h1
-rw-r--r--include/linux/sysfs.h10
-rw-r--r--include/linux/ufs_fs.h8
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/linux/vt_kern.h1
-rw-r--r--include/linux/wireless.h21
-rw-r--r--include/media/saa7146_vv.h3
-rw-r--r--include/net/fib_rules.h1
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--include/net/iw_handler.h30
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/pkt_cls.h7
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--include/net/sctp/ulpqueue.h1
-rw-r--r--include/net/xfrm.h5
-rw-r--r--include/sound/version.h2
-rw-r--r--ipc/util.c7
-rw-r--r--kernel/auditsc.c24
-rw-r--r--kernel/cpu.c32
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/futex.c2
-rw-r--r--kernel/hrtimer.c30
-rw-r--r--kernel/irq/devres.c2
-rw-r--r--kernel/lockdep.c8
-rw-r--r--kernel/module.c24
-rw-r--r--kernel/power/console.c10
-rw-r--r--kernel/power/disk.c7
-rw-r--r--kernel/power/swsusp.c2
-rw-r--r--kernel/power/user.c9
-rw-r--r--kernel/sched.c36
-rw-r--r--kernel/sysctl.c3
-rw-r--r--kernel/time.c2
-rw-r--r--kernel/time/clockevents.c69
-rw-r--r--kernel/time/clocksource.c3
-rw-r--r--kernel/time/jiffies.c2
-rw-r--r--kernel/time/ntp.c30
-rw-r--r--kernel/time/tick-broadcast.c27
-rw-r--r--kernel/time/tick-common.c13
-rw-r--r--kernel/time/tick-internal.h11
-rw-r--r--kernel/time/tick-oneshot.c12
-rw-r--r--kernel/time/timer_list.c6
-rw-r--r--kernel/timer.c21
-rw-r--r--lib/kobject.c2
-rw-r--r--mm/backing-dev.c16
-rw-r--r--mm/bounce.c2
-rw-r--r--mm/filemap.c46
-rw-r--r--mm/filemap_xip.c48
-rw-r--r--mm/madvise.c22
-rw-r--r--mm/nommu.c28
-rw-r--r--mm/oom_kill.c2
-rw-r--r--mm/rmap.c4
-rw-r--r--mm/shmem.c132
-rw-r--r--mm/slab.c4
-rw-r--r--net/appletalk/ddp.c7
-rw-r--r--net/atm/clip.c9
-rw-r--r--net/ax25/Kconfig61
-rw-r--r--net/bluetooth/hci_sock.c4
-rw-r--r--net/bluetooth/hidp/core.c25
-rw-r--r--net/bridge/br_fdb.c4
-rw-r--r--net/bridge/br_if.c4
-rw-r--r--net/bridge/br_netfilter.c2
-rw-r--r--net/core/dev.c23
-rw-r--r--net/core/fib_rules.c34
-rw-r--r--net/core/neighbour.c14
-rw-r--r--net/core/rtnetlink.c3
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/core/sock.c2
-rw-r--r--net/core/wireless.c82
-rw-r--r--net/dccp/ccids/ccid3.c7
-rw-r--r--net/dccp/input.c21
-rw-r--r--net/dccp/output.c16
-rw-r--r--net/dccp/proto.c4
-rw-r--r--net/dccp/timer.c25
-rw-r--r--net/decnet/dn_fib.c5
-rw-r--r--net/decnet/dn_rules.c13
-rw-r--r--net/ieee80211/Kconfig6
-rw-r--r--net/ipv4/cipso_ipv4.c5
-rw-r--r--net/ipv4/devinet.c4
-rw-r--r--net/ipv4/fib_frontend.c5
-rw-r--r--net/ipv4/fib_rules.c14
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/fib_trie.c11
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c15
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_standalone.c14
-rw-r--r--net/ipv4/tcp.c13
-rw-r--r--net/ipv4/tcp_output.c6
-rw-r--r--net/ipv4/udp.c1
-rw-r--r--net/ipv4/xfrm4_mode_beet.c26
-rw-r--r--net/ipv6/addrconf.c9
-rw-r--r--net/ipv6/fib6_rules.c14
-rw-r--r--net/ipv6/ip6_fib.c8
-rw-r--r--net/ipv6/ip6_input.c8
-rw-r--r--net/ipv6/ipv6_sockglue.c14
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c1
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/route.c120
-rw-r--r--net/ipv6/tcp_ipv6.c1
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/ipv6/xfrm6_tunnel.c4
-rw-r--r--net/irda/irnet/irnet.h2
-rw-r--r--net/irda/irnet/irnet_irda.c34
-rw-r--r--net/irda/irttp.c1
-rw-r--r--net/key/af_key.c26
-rw-r--r--net/netfilter/Kconfig1
-rw-r--r--net/netfilter/nfnetlink_log.c4
-rw-r--r--net/rose/af_rose.c80
-rw-r--r--net/sched/Makefile1
-rw-r--r--net/sched/act_mirred.c2
-rw-r--r--net/sched/cls_basic.c17
-rw-r--r--net/sched/cls_route.c2
-rw-r--r--net/sched/cls_tcindex.c4
-rw-r--r--net/sched/sch_hfsc.c4
-rw-r--r--net/sched/sch_htb.c6
-rw-r--r--net/sctp/associola.c15
-rw-r--r--net/sctp/ipv6.c4
-rw-r--r--net/sctp/sm_statefuns.c20
-rw-r--r--net/sctp/transport.c32
-rw-r--r--net/sctp/ulpqueue.c2
-rw-r--r--net/socket.c7
-rw-r--r--net/sunrpc/svcsock.c4
-rw-r--r--net/wanrouter/af_wanpipe.c2600
-rw-r--r--net/x25/x25_forward.c88
-rw-r--r--net/xfrm/xfrm_policy.c20
-rw-r--r--net/xfrm/xfrm_state.c9
-rw-r--r--net/xfrm/xfrm_user.c26
-rw-r--r--scripts/basic/fixdep.c10
-rw-r--r--security/dummy.c2
-rw-r--r--security/selinux/hooks.c8
-rw-r--r--sound/oss/dmasound/dmasound_core.c20
-rw-r--r--sound/pci/ac97/ac97_patch.c13
-rw-r--r--sound/pci/hda/hda_intel.c17
-rw-r--r--sound/pci/hda/patch_analog.c41
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/pci/hda/patch_sigmatel.c30
-rw-r--r--sound/pci/intel8x0.c10
-rw-r--r--sound/soc/Kconfig2
-rw-r--r--sound/soc/at91/Kconfig3
-rw-r--r--sound/soc/pxa/Kconfig3
921 files changed, 9594 insertions, 9659 deletions
diff --git a/Documentation/ABI/obsolete/dv1394 b/Documentation/ABI/obsolete/dv1394
new file mode 100644
index 000000000000..2ee36864ca10
--- /dev/null
+++ b/Documentation/ABI/obsolete/dv1394
@@ -0,0 +1,9 @@
1What: dv1394 (a.k.a. "OHCI-DV I/O support" for FireWire)
2Contact: linux1394-devel@lists.sourceforge.net
3Description:
4 New application development should use raw1394 + userspace libraries
5 instead, notably libiec61883 which is functionally equivalent.
6
7Users:
8 ffmpeg/libavformat (used by a variety of media players)
9 dvgrab v1.x (replaced by dvgrab2 on top of raw1394 and resp. libraries)
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index 842f0d1ab216..f2c0a6842930 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -557,6 +557,9 @@ Set some flags:
557Add some cpus: 557Add some cpus:
558# /bin/echo 0-7 > cpus 558# /bin/echo 0-7 > cpus
559 559
560Add some mems:
561# /bin/echo 0-7 > mems
562
560Now attach your shell to this cpuset: 563Now attach your shell to this cpuset:
561# /bin/echo $$ > tasks 564# /bin/echo $$ > tasks
562 565
diff --git a/Documentation/crypto/api-intro.txt b/Documentation/crypto/api-intro.txt
index e41a79aa71ce..9b84b805ab75 100644
--- a/Documentation/crypto/api-intro.txt
+++ b/Documentation/crypto/api-intro.txt
@@ -60,7 +60,7 @@ Here's an example of how to use the API:
60 desc.tfm = tfm; 60 desc.tfm = tfm;
61 desc.flags = 0; 61 desc.flags = 0;
62 62
63 if (crypto_hash_digest(&desc, &sg, 2, result)) 63 if (crypto_hash_digest(&desc, sg, 2, result))
64 fail(); 64 fail();
65 65
66 crypto_free_hash(tfm); 66 crypto_free_hash(tfm);
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index c3b1430cf603..19b4c96b2a49 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -39,17 +39,6 @@ Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de>
39 39
40--------------------------- 40---------------------------
41 41
42What: dv1394 driver (CONFIG_IEEE1394_DV1394)
43When: June 2007
44Why: Replaced by raw1394 + userspace libraries, notably libiec61883. This
45 shift of application support has been indicated on www.linux1394.org
46 and developers' mailinglists for quite some time. Major applications
47 have been converted, with the exception of ffmpeg and hence xine.
48 Piped output of dvgrab2 is a partial equivalent to dv1394.
49Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de>
50
51---------------------------
52
53What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. 42What: Video4Linux API 1 ioctls and video_decoder.h from Video devices.
54When: December 2006 43When: December 2006
55Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 44Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6
@@ -316,3 +305,11 @@ Why: The option/code is
316Who: Johannes Berg <johannes@sipsolutions.net> 305Who: Johannes Berg <johannes@sipsolutions.net>
317 306
318--------------------------- 307---------------------------
308
309What: i8xx_tco watchdog driver
310When: in 2.6.22
311Why: the i8xx_tco watchdog driver has been replaced by the iTCO_wdt
312 watchdog driver.
313Who: Wim Van Sebroeck <wim@iguana.be>
314
315---------------------------
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index 576ce463cf44..989f1130f4f3 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -105,12 +105,15 @@ setting up a platform_device using the GPIO, is mark its direction:
105 105
106 /* set as input or output, returning 0 or negative errno */ 106 /* set as input or output, returning 0 or negative errno */
107 int gpio_direction_input(unsigned gpio); 107 int gpio_direction_input(unsigned gpio);
108 int gpio_direction_output(unsigned gpio); 108 int gpio_direction_output(unsigned gpio, int value);
109 109
110The return value is zero for success, else a negative errno. It should 110The return value is zero for success, else a negative errno. It should
111be checked, since the get/set calls don't have error returns and since 111be checked, since the get/set calls don't have error returns and since
112misconfiguration is possible. (These calls could sleep.) 112misconfiguration is possible. (These calls could sleep.)
113 113
114For output GPIOs, the value provided becomes the initial output value.
115This helps avoid signal glitching during system startup.
116
114Setting the direction can fail if the GPIO number is invalid, or when 117Setting the direction can fail if the GPIO number is invalid, or when
115that particular GPIO can't be used in that mode. It's generally a bad 118that particular GPIO can't be used in that mode. It's generally a bad
116idea to rely on boot firmware to have set the direction correctly, since 119idea to rely on boot firmware to have set the direction correctly, since
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 6e92ba61f7c0..12533a958c51 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -79,6 +79,7 @@ parameter is applicable:
79 Documentation/scsi/. 79 Documentation/scsi/.
80 SELINUX SELinux support is enabled. 80 SELINUX SELinux support is enabled.
81 SERIAL Serial support is enabled. 81 SERIAL Serial support is enabled.
82 SH SuperH architecture is enabled.
82 SMP The kernel is an SMP kernel. 83 SMP The kernel is an SMP kernel.
83 SPARC Sparc architecture is enabled. 84 SPARC Sparc architecture is enabled.
84 SWSUSP Software suspend is enabled. 85 SWSUSP Software suspend is enabled.
@@ -125,7 +126,8 @@ and is between 256 and 4096 characters. It is defined in the file
125 See header of drivers/scsi/53c7xx.c. 126 See header of drivers/scsi/53c7xx.c.
126 See also Documentation/scsi/ncr53c7xx.txt. 127 See also Documentation/scsi/ncr53c7xx.txt.
127 128
128 acpi= [HW,ACPI] Advanced Configuration and Power Interface 129 acpi= [HW,ACPI,X86-64,i386]
130 Advanced Configuration and Power Interface
129 Format: { force | off | ht | strict | noirq } 131 Format: { force | off | ht | strict | noirq }
130 force -- enable ACPI if default was off 132 force -- enable ACPI if default was off
131 off -- disable ACPI if default was on 133 off -- disable ACPI if default was on
@@ -136,6 +138,12 @@ and is between 256 and 4096 characters. It is defined in the file
136 138
137 See also Documentation/pm.txt, pci=noacpi 139 See also Documentation/pm.txt, pci=noacpi
138 140
141 acpi_apic_instance= [ACPI, IOAPIC]
142 Format: <int>
143 2: use 2nd APIC table, if available
144 1,0: use 1st APIC table
145 default: 0
146
139 acpi_sleep= [HW,ACPI] Sleep options 147 acpi_sleep= [HW,ACPI] Sleep options
140 Format: { s3_bios, s3_mode } 148 Format: { s3_bios, s3_mode }
141 See Documentation/power/video.txt 149 See Documentation/power/video.txt
@@ -485,7 +493,7 @@ and is between 256 and 4096 characters. It is defined in the file
485 493
486 dtc3181e= [HW,SCSI] 494 dtc3181e= [HW,SCSI]
487 495
488 earlyprintk= [IA-32,X86-64] 496 earlyprintk= [IA-32,X86-64,SH]
489 earlyprintk=vga 497 earlyprintk=vga
490 earlyprintk=serial[,ttySn[,baudrate]] 498 earlyprintk=serial[,ttySn[,baudrate]]
491 499
@@ -772,6 +780,9 @@ and is between 256 and 4096 characters. It is defined in the file
772 lapic [IA-32,APIC] Enable the local APIC even if BIOS 780 lapic [IA-32,APIC] Enable the local APIC even if BIOS
773 disabled it. 781 disabled it.
774 782
783 lapic_timer_c2_ok [IA-32,x86-64,APIC] trust the local apic timer in
784 C2 power state.
785
775 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip 786 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip
776 Format: addr:<io>,irq:<irq> 787 Format: addr:<io>,irq:<irq>
777 788
@@ -1115,6 +1126,8 @@ and is between 256 and 4096 characters. It is defined in the file
1115 1126
1116 nolapic [IA-32,APIC] Do not enable or use the local APIC. 1127 nolapic [IA-32,APIC] Do not enable or use the local APIC.
1117 1128
1129 nolapic_timer [IA-32,APIC] Do not use the local APIC timer.
1130
1118 noltlbs [PPC] Do not use large page/tlb entries for kernel 1131 noltlbs [PPC] Do not use large page/tlb entries for kernel
1119 lowmem mapping on PPC40x. 1132 lowmem mapping on PPC40x.
1120 1133
@@ -1784,7 +1797,7 @@ and is between 256 and 4096 characters. It is defined in the file
1784 usbhid.mousepoll= 1797 usbhid.mousepoll=
1785 [USBHID] The interval which mice are to be polled at. 1798 [USBHID] The interval which mice are to be polled at.
1786 1799
1787 vdso= [IA-32] 1800 vdso= [IA-32,SH]
1788 vdso=1: enable VDSO (default) 1801 vdso=1: enable VDSO (default)
1789 vdso=0: disable VDSO mapping 1802 vdso=0: disable VDSO mapping
1790 1803
diff --git a/Documentation/networking/ax25.txt b/Documentation/networking/ax25.txt
index 37c25b0925f0..8257dbf9be57 100644
--- a/Documentation/networking/ax25.txt
+++ b/Documentation/networking/ax25.txt
@@ -1,16 +1,10 @@
1To use the amateur radio protocols within Linux you will need to get a 1To use the amateur radio protocols within Linux you will need to get a
2suitable copy of the AX.25 Utilities. More detailed information about these 2suitable copy of the AX.25 Utilities. More detailed information about
3and associated programs can be found on http://zone.pspt.fi/~jsn/. 3AX.25, NET/ROM and ROSE, associated programs and and utilities can be
4 4found on http://www.linux-ax25.org.
5For more information about the AX.25, NET/ROM and ROSE protocol stacks, see
6the AX25-HOWTO written by Terry Dawson <terry@perf.no.itg.telstra.com.au>
7who is also the AX.25 Utilities maintainer.
8 5
9There is an active mailing list for discussing Linux amateur radio matters 6There is an active mailing list for discussing Linux amateur radio matters
10called linux-hams. To subscribe to it, send a message to 7called linux-hams@vger.kernel.org. To subscribe to it, send a message to
11majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body 8majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body
12of the message, the subject field is ignored. 9of the message, the subject field is ignored. You don't need to be
13 10subscribed to post but of course that means you might miss an answer.
14Jonathan G4KLX
15
16g4klx@g4klx.demon.co.uk
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index c750f9f2e76e..b6a3cbf7e846 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -102,31 +102,28 @@ pci_save_state
102-------------- 102--------------
103 103
104Usage: 104Usage:
105 pci_save_state(dev, buffer); 105 pci_save_state(struct pci_dev *dev);
106 106
107Description: 107Description:
108 Save first 64 bytes of PCI config space. Buffer must be allocated by 108 Save first 64 bytes of PCI config space, along with any additional
109 caller. 109 PCI-Express or PCI-X information.
110 110
111 111
112pci_restore_state 112pci_restore_state
113----------------- 113-----------------
114 114
115Usage: 115Usage:
116 pci_restore_state(dev, buffer); 116 pci_restore_state(struct pci_dev *dev);
117 117
118Description: 118Description:
119 Restore previously saved config space. (First 64 bytes only); 119 Restore previously saved config space.
120
121 If buffer is NULL, then restore what information we know about the
122 device from bootup: BARs and interrupt line.
123 120
124 121
125pci_set_power_state 122pci_set_power_state
126------------------- 123-------------------
127 124
128Usage: 125Usage:
129 pci_set_power_state(dev, state); 126 pci_set_power_state(struct pci_dev *dev, pci_power_t state);
130 127
131Description: 128Description:
132 Transition device to low power state using PCI PM Capabilities 129 Transition device to low power state using PCI PM Capabilities
@@ -142,7 +139,7 @@ pci_enable_wake
142--------------- 139---------------
143 140
144Usage: 141Usage:
145 pci_enable_wake(dev, state, enable); 142 pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
146 143
147Description: 144Description:
148 Enable device to generate PME# during low power state using PCI PM 145 Enable device to generate PME# during low power state using PCI PM
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index db398a6441c1..73e9a174b642 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -866,6 +866,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
866 basic 3-jack (default) 866 basic 3-jack (default)
867 hp HP nx6320 867 hp HP nx6320
868 thinkpad Lenovo Thinkpad T60/X60/Z60 868 thinkpad Lenovo Thinkpad T60/X60/Z60
869 toshiba Toshiba U205
869 870
870 AD1986A 871 AD1986A
871 6stack 6-jack, separate surrounds (default) 872 6stack 6-jack, separate surrounds (default)
@@ -906,7 +907,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
906 5stack D945 5stack + SPDIF 907 5stack D945 5stack + SPDIF
907 macmini Intel Mac Mini 908 macmini Intel Mac Mini
908 macbook Intel Mac Book 909 macbook Intel Mac Book
909 macbook-pro Intel Mac Book Pro 910 macbook-pro-v1 Intel Mac Book Pro 1st generation
911 macbook-pro Intel Mac Book Pro 2nd generation
910 912
911 STAC9202/9250/9251 913 STAC9202/9250/9251
912 ref Reference board, base config 914 ref Reference board, base config
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
index f9c99c9a54f9..1a3bdc27d95e 100644
--- a/Documentation/sparse.txt
+++ b/Documentation/sparse.txt
@@ -45,11 +45,15 @@ special.
45Getting sparse 45Getting sparse
46~~~~~~~~~~~~~~ 46~~~~~~~~~~~~~~
47 47
48With git, you can just get it from 48You can get latest released versions from the Sparse homepage at
49http://www.kernel.org/pub/linux/kernel/people/josh/sparse/
49 50
50 rsync://rsync.kernel.org/pub/scm/devel/sparse/sparse.git 51Alternatively, you can get snapshots of the latest development version
52of sparse using git to clone..
51 53
52and DaveJ has tar-balls at 54 git://git.kernel.org/pub/scm/linux/kernel/git/josh/sparse.git
55
56DaveJ has hourly generated tarballs of the git tree available at..
53 57
54 http://www.codemonkey.org.uk/projects/git-snapshots/sparse/ 58 http://www.codemonkey.org.uk/projects/git-snapshots/sparse/
55 59
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 452c0f152304..d43aa9d3c105 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -93,6 +93,8 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
93 93
94'p' - Will dump the current registers and flags to your console. 94'p' - Will dump the current registers and flags to your console.
95 95
96'q' - Will dump a list of all running timers.
97
96'r' - Turns off keyboard raw mode and sets it to XLATE. 98'r' - Turns off keyboard raw mode and sets it to XLATE.
97 99
98's' - Will attempt to sync all mounted filesystems. 100's' - Will attempt to sync all mounted filesystems.
diff --git a/MAINTAINERS b/MAINTAINERS
index 9993b9009415..ef84419ade3a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -198,10 +198,25 @@ L: linux-sound@vger.kernel.org
198W: http://www.stud.uni-karlsruhe.de/~uh1b/ 198W: http://www.stud.uni-karlsruhe.de/~uh1b/
199S: Maintained 199S: Maintained
200 200
201IPS SCSI RAID DRIVER
202P: Adaptec OEM Raid Solutions
203M: aacraid@adaptec.com
204L: linux-scsi@vger.kernel.org
205W: http://www.adaptec.com/
206S: Maintained
207
208DPT_I2O SCSI RAID DRIVER
209P: Adaptec OEM Raid Solutions
210M: aacraid@adaptec.com
211L: linux-scsi@vger.kernel.org
212W: http://www.adaptec.com/
213S: Maintained
214
201AACRAID SCSI RAID DRIVER 215AACRAID SCSI RAID DRIVER
202P: Adaptec OEM Raid Solutions 216P: Adaptec OEM Raid Solutions
217M: aacraid@adaptec.com
203L: linux-scsi@vger.kernel.org 218L: linux-scsi@vger.kernel.org
204W: http://linux.dell.com/storage.shtml 219W: http://www.adaptec.com/
205S: Supported 220S: Supported
206 221
207ACPI 222ACPI
@@ -1103,9 +1118,6 @@ W: http://lanana.org/docs/device-list/index.html
1103L: linux-kernel@vger.kernel.org 1118L: linux-kernel@vger.kernel.org
1104S: Maintained 1119S: Maintained
1105 1120
1106DEVICE FILESYSTEM
1107S: Obsolete
1108
1109DIGI INTL. EPCA DRIVER 1121DIGI INTL. EPCA DRIVER
1110P: Digi International, Inc 1122P: Digi International, Inc
1111M: Eng.Linux@digi.com 1123M: Eng.Linux@digi.com
@@ -1392,7 +1404,7 @@ M: hch@infradead.org
1392W: ftp://ftp.openlinux.org/pub/people/hch/vxfs 1404W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
1393S: Maintained 1405S: Maintained
1394 1406
1395FUJITSU FR-V PORT 1407FUJITSU FR-V (FRV) PORT
1396P: David Howells 1408P: David Howells
1397M: dhowells@redhat.com 1409M: dhowells@redhat.com
1398S: Maintained 1410S: Maintained
@@ -1588,12 +1600,6 @@ L: i2c@lm-sensors.org
1588T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/ 1600T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
1589S: Maintained 1601S: Maintained
1590 1602
1591I2O
1592P: Markus Lidel
1593M: markus.lidel@shadowconnect.com
1594W: http://i2o.shadowconnect.com/
1595S: Maintained
1596
1597i386 BOOT CODE 1603i386 BOOT CODE
1598P: Riley H. Williams 1604P: Riley H. Williams
1599M: Riley@Williams.Name 1605M: Riley@Williams.Name
@@ -2931,9 +2937,12 @@ L: linux-scsi@vger.kernel.org
2931S: Maintained 2937S: Maintained
2932 2938
2933SCTP PROTOCOL 2939SCTP PROTOCOL
2940P: Vlad Yasevich
2941M: vladislav.yasevich@hp.com
2934P: Sridhar Samudrala 2942P: Sridhar Samudrala
2935M: sri@us.ibm.com 2943M: sri@us.ibm.com
2936L: lksctp-developers@lists.sourceforge.net 2944L: lksctp-developers@lists.sourceforge.net
2945W: http://lksctp.sourceforge.net
2937S: Supported 2946S: Supported
2938 2947
2939SCx200 CPU SUPPORT 2948SCx200 CPU SUPPORT
@@ -3069,11 +3078,10 @@ L: netdev@vger.kernel.org
3069S: Maintained 3078S: Maintained
3070 3079
3071SONY VAIO CONTROL DEVICE DRIVER 3080SONY VAIO CONTROL DEVICE DRIVER
3072P: Stelian Pop
3073M: stelian@popies.net
3074P: Mattia Dongili 3081P: Mattia Dongili
3075M: malattia@linux.it 3082M: malattia@linux.it
3076W: http://popies.net/sonypi/ 3083L: linux-acpi@vger.kernel.org
3084W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
3077S: Maintained 3085S: Maintained
3078 3086
3079SOUND 3087SOUND
@@ -3106,6 +3114,9 @@ TPM DEVICE DRIVER
3106P: Kylene Hall 3114P: Kylene Hall
3107M: kjhall@us.ibm.com 3115M: kjhall@us.ibm.com
3108W: http://tpmdd.sourceforge.net 3116W: http://tpmdd.sourceforge.net
3117P: Marcel Selhorst
3118M: tpm@selhorst.net
3119W: http://www.prosec.rub.de/tpm/
3109L: tpmdd-devel@lists.sourceforge.net 3120L: tpmdd-devel@lists.sourceforge.net
3110S: Maintained 3121S: Maintained
3111 3122
diff --git a/Makefile b/Makefile
index 6393738fe968..6486af1ae69c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 21 3SUBLEVEL = 21
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc6
5NAME = Homicidal Dwarf Hamster 5NAME = Nocturnal Monster Puppy
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"
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 5e34ca6d38b6..3e073467caca 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -28,6 +28,7 @@ config SHARP_PARAM
28 28
29config SHARPSL_PM 29config SHARPSL_PM
30 bool 30 bool
31 select APM_EMULATION
31 32
32config SHARP_SCOOP 33config SHARP_SCOOP
33 bool 34 bool
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 5a0f4bc5da95..ba99a2035523 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -228,6 +228,7 @@ int dma_channel_active(dmach_t channel)
228{ 228{
229 return dma_chan[channel].active; 229 return dma_chan[channel].active;
230} 230}
231EXPORT_SYMBOL(dma_channel_active);
231 232
232void set_dma_page(dmach_t channel, char pagenr) 233void set_dma_page(dmach_t channel, char pagenr)
233{ 234{
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 03e37af315d7..0453dcc757b4 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -839,8 +839,11 @@ static int __init topology_init(void)
839{ 839{
840 int cpu; 840 int cpu;
841 841
842 for_each_possible_cpu(cpu) 842 for_each_possible_cpu(cpu) {
843 register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu); 843 struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu);
844 cpuinfo->cpu.hotpluggable = 1;
845 register_cpu(&cpuinfo->cpu, cpu);
846 }
844 847
845 return 0; 848 return 0;
846} 849}
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index f7d342ccbebf..40586e22cd38 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -320,16 +320,16 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
320 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 320 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
321 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 321 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
322 322
323 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) 323 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
324 | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); 324 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
325 325
326 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); 326 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
327 327
328 if (data->bus_width_16) 328 if (data->bus_width_16)
329 mode = AT91_SMC_DBW_16; 329 mode = AT91_SMC_DBW_16;
330 else 330 else
331 mode = AT91_SMC_DBW_8; 331 mode = AT91_SMC_DBW_8;
332 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); 332 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
333 333
334 /* enable pin */ 334 /* enable pin */
335 if (data->enable_pin) 335 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 44211a0af19a..ba4a1bb3ee40 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -215,13 +215,14 @@ int gpio_direction_input(unsigned pin)
215} 215}
216EXPORT_SYMBOL(gpio_direction_input); 216EXPORT_SYMBOL(gpio_direction_input);
217 217
218int gpio_direction_output(unsigned pin) 218int gpio_direction_output(unsigned pin, int value)
219{ 219{
220 void __iomem *pio = pin_to_controller(pin); 220 void __iomem *pio = pin_to_controller(pin);
221 unsigned mask = pin_to_mask(pin); 221 unsigned mask = pin_to_mask(pin);
222 222
223 if (!pio || !(__raw_readl(pio + PIO_PSR) & mask)) 223 if (!pio || !(__raw_readl(pio + PIO_PSR) & mask))
224 return -EINVAL; 224 return -EINVAL;
225 __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
225 __raw_writel(mask, pio + PIO_OER); 226 __raw_writel(mask, pio + PIO_OER);
226 return 0; 227 return 0;
227} 228}
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index 4f66e90db74f..7e70e0b0b989 100644
--- a/arch/arm/mach-imx/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -50,6 +50,7 @@
50#define CR_920T_ASYNC_MODE 0xC0000000 50#define CR_920T_ASYNC_MODE 0xC0000000
51 51
52static u32 mpctl0_at_boot; 52static u32 mpctl0_at_boot;
53static u32 bclk_div_at_boot;
53 54
54static void imx_set_async_mode(void) 55static void imx_set_async_mode(void)
55{ 56{
@@ -82,13 +83,13 @@ static void imx_set_mpctl0(u32 mpctl0)
82 * imx_compute_mpctl - compute new PLL parameters 83 * imx_compute_mpctl - compute new PLL parameters
83 * @new_mpctl: pointer to location assigned by new PLL control register value 84 * @new_mpctl: pointer to location assigned by new PLL control register value
84 * @cur_mpctl: current PLL control register parameters 85 * @cur_mpctl: current PLL control register parameters
86 * @f_ref: reference source frequency Hz
85 * @freq: required frequency in Hz 87 * @freq: required frequency in Hz
86 * @relation: is one of %CPUFREQ_RELATION_L (supremum) 88 * @relation: is one of %CPUFREQ_RELATION_L (supremum)
87 * and %CPUFREQ_RELATION_H (infimum) 89 * and %CPUFREQ_RELATION_H (infimum)
88 */ 90 */
89long imx_compute_mpctl(u32 *new_mpctl, u32 cur_mpctl, unsigned long freq, int relation) 91long imx_compute_mpctl(u32 *new_mpctl, u32 cur_mpctl, u32 f_ref, unsigned long freq, int relation)
90{ 92{
91 u32 f_ref = (CSCR & CSCR_SYSTEM_SEL) ? 16000000 : (CLK32 * 512);
92 u32 mfi; 93 u32 mfi;
93 u32 mfn; 94 u32 mfn;
94 u32 mfd; 95 u32 mfd;
@@ -182,7 +183,7 @@ static int imx_set_target(struct cpufreq_policy *policy,
182 unsigned long flags; 183 unsigned long flags;
183 long freq; 184 long freq;
184 long sysclk; 185 long sysclk;
185 unsigned int bclk_div = 1; 186 unsigned int bclk_div = bclk_div_at_boot;
186 187
187 /* 188 /*
188 * Some governors do not respects CPU and policy lower limits 189 * Some governors do not respects CPU and policy lower limits
@@ -202,8 +203,8 @@ static int imx_set_target(struct cpufreq_policy *policy,
202 203
203 sysclk = imx_get_system_clk(); 204 sysclk = imx_get_system_clk();
204 205
205 if (freq > sysclk + 1000000) { 206 if (freq > sysclk / bclk_div_at_boot + 1000000) {
206 freq = imx_compute_mpctl(&mpctl0, mpctl0_at_boot, freq, relation); 207 freq = imx_compute_mpctl(&mpctl0, mpctl0_at_boot, CLK32 * 512, freq, relation);
207 if (freq < 0) { 208 if (freq < 0) {
208 printk(KERN_WARNING "imx: target frequency %ld Hz cannot be set\n", freq); 209 printk(KERN_WARNING "imx: target frequency %ld Hz cannot be set\n", freq);
209 return -EINVAL; 210 return -EINVAL;
@@ -217,6 +218,8 @@ static int imx_set_target(struct cpufreq_policy *policy,
217 218
218 if(bclk_div > 16) 219 if(bclk_div > 16)
219 bclk_div = 16; 220 bclk_div = 16;
221 if(bclk_div < bclk_div_at_boot)
222 bclk_div = bclk_div_at_boot;
220 } 223 }
221 freq = (sysclk + bclk_div / 2) / bclk_div; 224 freq = (sysclk + bclk_div / 2) / bclk_div;
222 } 225 }
@@ -285,7 +288,7 @@ static struct cpufreq_driver imx_driver = {
285 288
286static int __init imx_cpufreq_init(void) 289static int __init imx_cpufreq_init(void)
287{ 290{
288 291 bclk_div_at_boot = __mfld2val(CSCR_BCLK_DIV, CSCR) + 1;
289 mpctl0_at_boot = 0; 292 mpctl0_at_boot = 0;
290 293
291 if((CSCR & CSCR_MPEN) && 294 if((CSCR & CSCR_MPEN) &&
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index b5aa49d00ca3..7a7fa51ec62c 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL(imx_gpio_mode);
102 * f = 2 * f_ref * -------------------- 102 * f = 2 * f_ref * --------------------
103 * pd + 1 103 * pd + 1
104 */ 104 */
105static unsigned int imx_decode_pll(unsigned int pll) 105static unsigned int imx_decode_pll(unsigned int pll, u32 f_ref)
106{ 106{
107 unsigned long long ll; 107 unsigned long long ll;
108 unsigned long quot; 108 unsigned long quot;
@@ -111,7 +111,6 @@ static unsigned int imx_decode_pll(unsigned int pll)
111 u32 mfn = pll & 0x3ff; 111 u32 mfn = pll & 0x3ff;
112 u32 mfd = (pll >> 16) & 0x3ff; 112 u32 mfd = (pll >> 16) & 0x3ff;
113 u32 pd = (pll >> 26) & 0xf; 113 u32 pd = (pll >> 26) & 0xf;
114 u32 f_ref = (CSCR & CSCR_SYSTEM_SEL) ? 16000000 : (CLK32 * 512);
115 114
116 mfi = mfi <= 5 ? 5 : mfi; 115 mfi = mfi <= 5 ? 5 : mfi;
117 116
@@ -124,13 +123,15 @@ static unsigned int imx_decode_pll(unsigned int pll)
124 123
125unsigned int imx_get_system_clk(void) 124unsigned int imx_get_system_clk(void)
126{ 125{
127 return imx_decode_pll(SPCTL0); 126 u32 f_ref = (CSCR & CSCR_SYSTEM_SEL) ? 16000000 : (CLK32 * 512);
127
128 return imx_decode_pll(SPCTL0, f_ref);
128} 129}
129EXPORT_SYMBOL(imx_get_system_clk); 130EXPORT_SYMBOL(imx_get_system_clk);
130 131
131unsigned int imx_get_mcu_clk(void) 132unsigned int imx_get_mcu_clk(void)
132{ 133{
133 return imx_decode_pll(MPCTL0); 134 return imx_decode_pll(MPCTL0, CLK32 * 512);
134} 135}
135EXPORT_SYMBOL(imx_get_mcu_clk); 136EXPORT_SYMBOL(imx_get_mcu_clk);
136 137
diff --git a/arch/arm/mach-iop32x/Kconfig b/arch/arm/mach-iop32x/Kconfig
index c072d94070da..9dd49cff21ff 100644
--- a/arch/arm/mach-iop32x/Kconfig
+++ b/arch/arm/mach-iop32x/Kconfig
@@ -4,6 +4,9 @@ menu "IOP32x Implementation Options"
4 4
5comment "IOP32x Platform Types" 5comment "IOP32x Platform Types"
6 6
7config MACH_EP80219
8 bool
9
7config MACH_GLANTANK 10config MACH_GLANTANK
8 bool "Enable support for the IO-Data GLAN Tank" 11 bool "Enable support for the IO-Data GLAN Tank"
9 help 12 help
@@ -19,6 +22,7 @@ config ARCH_IQ80321
19 22
20config ARCH_IQ31244 23config ARCH_IQ31244
21 bool "Enable support for EP80219/IQ31244" 24 bool "Enable support for EP80219/IQ31244"
25 select MACH_EP80219
22 help 26 help
23 Say Y here if you want to run your kernel on the Intel EP80219 27 Say Y here if you want to run your kernel on the Intel EP80219
24 evaluation kit for the Intel 80219 processor (a IOP321 variant) 28 evaluation kit for the Intel 80219 processor (a IOP321 variant)
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index 571ac35bc2c7..60e74309a458 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -39,22 +39,35 @@
39#include <asm/arch/time.h> 39#include <asm/arch/time.h>
40 40
41/* 41/*
42 * The EP80219 and IQ31244 use the same machine ID. To find out 42 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the
43 * which of the two we're running on, we look at the processor ID. 43 * same machine id, and the processor type was used to select board type.
44 * However this assumption breaks for an iq80219 board which is an iop219
45 * processor on an iq31244 board. The force_ep80219 flag has been added
46 * for old boot loaders using the iq31244 machine id for an ep80219 platform.
44 */ 47 */
48static int force_ep80219;
49
45static int is_80219(void) 50static int is_80219(void)
46{ 51{
47 extern int processor_id; 52 extern int processor_id;
48 return !!((processor_id & 0xffffffe0) == 0x69052e20); 53 return !!((processor_id & 0xffffffe0) == 0x69052e20);
49} 54}
50 55
56static int is_ep80219(void)
57{
58 if (machine_is_ep80219() || force_ep80219)
59 return 1;
60 else
61 return 0;
62}
63
51 64
52/* 65/*
53 * EP80219/IQ31244 timer tick configuration. 66 * EP80219/IQ31244 timer tick configuration.
54 */ 67 */
55static void __init iq31244_timer_init(void) 68static void __init iq31244_timer_init(void)
56{ 69{
57 if (is_80219()) { 70 if (is_ep80219()) {
58 /* 33.333 MHz crystal. */ 71 /* 33.333 MHz crystal. */
59 iop_init_time(200000000); 72 iop_init_time(200000000);
60 } else { 73 } else {
@@ -165,12 +178,18 @@ static struct hw_pci iq31244_pci __initdata = {
165 178
166static int __init iq31244_pci_init(void) 179static int __init iq31244_pci_init(void)
167{ 180{
168 if (machine_is_iq31244()) { 181 if (is_ep80219())
182 pci_common_init(&ep80219_pci);
183 else if (machine_is_iq31244()) {
169 if (is_80219()) { 184 if (is_80219()) {
170 pci_common_init(&ep80219_pci); 185 printk("note: iq31244 board type has been selected\n");
171 } else { 186 printk("note: to select ep80219 operation:\n");
172 pci_common_init(&iq31244_pci); 187 printk("\t1/ specify \"force_ep80219\" on the kernel"
188 " command line\n");
189 printk("\t2/ update boot loader to pass"
190 " the ep80219 id: %d\n", MACH_TYPE_EP80219);
173 } 191 }
192 pci_common_init(&iq31244_pci);
174 } 193 }
175 194
176 return 0; 195 return 0;
@@ -277,10 +296,18 @@ static void __init iq31244_init_machine(void)
277 platform_device_register(&iq31244_flash_device); 296 platform_device_register(&iq31244_flash_device);
278 platform_device_register(&iq31244_serial_device); 297 platform_device_register(&iq31244_serial_device);
279 298
280 if (is_80219()) 299 if (is_ep80219())
281 pm_power_off = ep80219_power_off; 300 pm_power_off = ep80219_power_off;
282} 301}
283 302
303static int __init force_ep80219_setup(char *str)
304{
305 force_ep80219 = 1;
306 return 1;
307}
308
309__setup("force_ep80219", force_ep80219_setup);
310
284MACHINE_START(IQ31244, "Intel IQ31244") 311MACHINE_START(IQ31244, "Intel IQ31244")
285 /* Maintainer: Intel Corp. */ 312 /* Maintainer: Intel Corp. */
286 .phys_io = IQ31244_UART, 313 .phys_io = IQ31244_UART,
@@ -291,3 +318,19 @@ MACHINE_START(IQ31244, "Intel IQ31244")
291 .timer = &iq31244_timer, 318 .timer = &iq31244_timer,
292 .init_machine = iq31244_init_machine, 319 .init_machine = iq31244_init_machine,
293MACHINE_END 320MACHINE_END
321
322/* There should have been an ep80219 machine identifier from the beginning.
323 * Boot roms older than March 2007 do not know the ep80219 machine id. Pass
324 * "force_ep80219" on the kernel command line, otherwise iq31244 operation
325 * will be selected.
326 */
327MACHINE_START(EP80219, "Intel EP80219")
328 /* Maintainer: Intel Corp. */
329 .phys_io = IQ31244_UART,
330 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
331 .boot_params = 0xa0000100,
332 .map_io = iq31244_map_io,
333 .init_irq = iop32x_init_irq,
334 .timer = &iq31244_timer,
335 .init_machine = iq31244_init_machine,
336MACHINE_END
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
index a193dd931512..760c9d0db7c3 100644
--- a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
+++ b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
@@ -32,7 +32,7 @@ static void __init mach_cc9p9360dev_init_machine(void)
32 board_a9m9750dev_init_machine(); 32 board_a9m9750dev_init_machine();
33} 33}
34 34
35MACHINE_START(CC9P9360DEV, "Connect Core 9P 9360 on an A9M9750 Devboard") 35MACHINE_START(CC9P9360DEV, "Digi ConnectCore 9P 9360 on an A9M9750 Devboard")
36 .map_io = mach_cc9p9360dev_map_io, 36 .map_io = mach_cc9p9360dev_map_io,
37 .init_irq = mach_cc9p9360dev_init_irq, 37 .init_irq = mach_cc9p9360dev_init_irq,
38 .init_machine = mach_cc9p9360dev_init_machine, 38 .init_machine = mach_cc9p9360dev_init_machine,
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 6e113078f7ab..ad519390dd58 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -27,6 +27,7 @@
27#include <linux/mtd/nand.h> 27#include <linux/mtd/nand.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/workqueue.h>
30 31
31#include <asm/hardware.h> 32#include <asm/hardware.h>
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 0de201c3d50b..5170481afeab 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -27,6 +27,7 @@
27 27
28#include <asm/arch/clock.h> 28#include <asm/arch/clock.h>
29#include <asm/arch/sram.h> 29#include <asm/arch/sram.h>
30#include <asm/div64.h>
30 31
31#include "prcm-regs.h" 32#include "prcm-regs.h"
32#include "memory.h" 33#include "memory.h"
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 8816f5a33a28..162978fd5359 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -1013,7 +1013,8 @@ static struct clk dss2_fck = { /* Alt clk used in power management */
1013 .name = "dss2_fck", 1013 .name = "dss2_fck",
1014 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */ 1014 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
1015 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 1015 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
1016 RATE_CKCTL | CM_CORE_SEL1 | RATE_FIXED, 1016 RATE_CKCTL | CM_CORE_SEL1 | RATE_FIXED |
1017 DELAYED_APP,
1017 .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, 1018 .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE,
1018 .enable_bit = 1, 1019 .enable_bit = 1,
1019 .src_offset = 13, 1020 .src_offset = 13,
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 7915a5a22865..72738771fb57 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -28,6 +28,7 @@
28#include <asm/hardware.h> 28#include <asm/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/arch/pxa-regs.h>
31#include <asm/arch/irda.h> 32#include <asm/arch/irda.h>
32#include <asm/arch/mmc.h> 33#include <asm/arch/mmc.h>
33#include <asm/arch/udc.h> 34#include <asm/arch/udc.h>
@@ -35,8 +36,6 @@
35#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38
39#include <asm/arch/pxa-regs.h>
40#include <asm/arch/tosa.h> 39#include <asm/arch/tosa.h>
41 40
42#include <asm/hardware/scoop.h> 41#include <asm/hardware/scoop.h>
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 01c60d0923cd..d052ab2d9377 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -202,7 +202,9 @@ static void __init h1940_map_io(void)
202 202
203 /* setup PM */ 203 /* setup PM */
204 204
205#ifdef CONFIG_PM_H1940
205 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); 206 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
207#endif
206 s3c2410_pm_init(); 208 s3c2410_pm_init();
207} 209}
208 210
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index 480ccde63fb4..ae1d0a81fd6a 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -224,7 +224,9 @@ static void __init rx3715_init_irq(void)
224 224
225static void __init rx3715_init_machine(void) 225static void __init rx3715_init_machine(void)
226{ 226{
227#ifdef CONFIG_PM_H1940
227 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); 228 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
229#endif
228 s3c2410_pm_init(); 230 s3c2410_pm_init();
229 231
230 s3c24xx_fb_set_platdata(&rx3715_lcdcfg); 232 s3c24xx_fb_set_platdata(&rx3715_lcdcfg);
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c2443/irq.c
index 7a45b6dcb73e..756573595b88 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c2443/irq.c
@@ -137,7 +137,7 @@ static struct irq_chip s3c2443_irq_lcd = {
137 137
138static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc) 138static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
139{ 139{
140 s3c2443_irq_demux(IRQ_S3C2443_DMA1, 6); 140 s3c2443_irq_demux(IRQ_S3C2443_DMA0, 6);
141} 141}
142 142
143#define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) 143#define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0))
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 192a5a26cf2b..9e13c8358ea7 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -27,6 +27,7 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/gpio.h>
30 31
31#include "generic.h" 32#include "generic.h"
32 33
@@ -153,7 +154,7 @@ int gpio_direction_input(unsigned gpio)
153 154
154EXPORT_SYMBOL(gpio_direction_input); 155EXPORT_SYMBOL(gpio_direction_input);
155 156
156int gpio_direction_output(unsigned gpio) 157int gpio_direction_output(unsigned gpio, int value)
157{ 158{
158 unsigned long flags; 159 unsigned long flags;
159 160
@@ -161,6 +162,7 @@ int gpio_direction_output(unsigned gpio)
161 return -EINVAL; 162 return -EINVAL;
162 163
163 local_irq_save(flags); 164 local_irq_save(flags);
165 gpio_set_value(gpio, value);
164 GPDR |= GPIO_GPIO(gpio); 166 GPDR |= GPIO_GPIO(gpio);
165 local_irq_restore(flags); 167 local_irq_restore(flags);
166 return 0; 168 return 0;
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c
index f2e81cd79002..6f4388f7c20b 100644
--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -313,7 +313,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
313 __mtdr(DBGREG_DC, dc); 313 __mtdr(DBGREG_DC, dc);
314 314
315 ti = current_thread_info(); 315 ti = current_thread_info();
316 ti->flags |= _TIF_BREAKPOINT; 316 set_ti_thread_flag(ti, TIF_BREAKPOINT);
317 317
318 /* The TLB miss handlers don't check thread flags */ 318 /* The TLB miss handlers don't check thread flags */
319 if ((regs->pc >= (unsigned long)&itlb_miss) 319 if ((regs->pc >= (unsigned long)&itlb_miss)
@@ -328,7 +328,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
328 * single step. 328 * single step.
329 */ 329 */
330 if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR) 330 if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR)
331 ti->flags |= TIF_SINGLE_STEP; 331 set_ti_thread_flag(ti, TIF_SINGLE_STEP);
332 } else { 332 } else {
333 panic("Unable to handle debug trap at pc = %08lx\n", 333 panic("Unable to handle debug trap at pc = %08lx\n",
334 regs->pc); 334 regs->pc);
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index 7e803f4d7a12..adc01a12d154 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -49,39 +49,45 @@ out:
49 return; 49 return;
50} 50}
51 51
52static inline int valid_stack_ptr(struct thread_info *tinfo, unsigned long p)
53{
54 return (p > (unsigned long)tinfo)
55 && (p < (unsigned long)tinfo + THREAD_SIZE - 3);
56}
57
52#ifdef CONFIG_FRAME_POINTER 58#ifdef CONFIG_FRAME_POINTER
53static inline void __show_trace(struct task_struct *tsk, unsigned long *sp, 59static inline void __show_trace(struct task_struct *tsk, unsigned long *sp,
54 struct pt_regs *regs) 60 struct pt_regs *regs)
55{ 61{
56 unsigned long __user *fp; 62 unsigned long lr, fp;
57 unsigned long __user *last_fp = NULL; 63 struct thread_info *tinfo;
58 64
59 if (regs) { 65 tinfo = (struct thread_info *)
60 fp = (unsigned long __user *)regs->r7; 66 ((unsigned long)sp & ~(THREAD_SIZE - 1));
61 } else if (tsk == current) { 67
62 register unsigned long __user *real_fp __asm__("r7"); 68 if (regs)
63 fp = real_fp; 69 fp = regs->r7;
64 } else { 70 else if (tsk == current)
65 fp = (unsigned long __user *)tsk->thread.cpu_context.r7; 71 asm("mov %0, r7" : "=r"(fp));
66 } 72 else
73 fp = tsk->thread.cpu_context.r7;
67 74
68 /* 75 /*
69 * Walk the stack until (a) we get an exception, (b) the frame 76 * Walk the stack as long as the frame pointer (a) is within
70 * pointer becomes zero, or (c) the frame pointer gets stuck 77 * the kernel stack of the task, and (b) it doesn't move
71 * at the same value. 78 * downwards.
72 */ 79 */
73 while (fp && fp != last_fp) { 80 while (valid_stack_ptr(tinfo, fp)) {
74 unsigned long lr, new_fp = 0; 81 unsigned long new_fp;
75
76 last_fp = fp;
77 if (__get_user(lr, fp))
78 break;
79 if (fp && __get_user(new_fp, fp + 1))
80 break;
81 fp = (unsigned long __user *)new_fp;
82 82
83 lr = *(unsigned long *)fp;
83 printk(" [<%08lx>] ", lr); 84 printk(" [<%08lx>] ", lr);
84 print_symbol("%s\n", lr); 85 print_symbol("%s\n", lr);
86
87 new_fp = *(unsigned long *)(fp + 4);
88 if (new_fp <= fp)
89 break;
90 fp = new_fp;
85 } 91 }
86 printk("\n"); 92 printk("\n");
87} 93}
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index bc235507c5c7..472703f90c22 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -752,7 +752,7 @@ static struct resource atmel_spi1_resource[] = {
752DEFINE_DEV(atmel_spi, 1); 752DEFINE_DEV(atmel_spi, 1);
753DEV_CLK(spi_clk, atmel_spi1, pba, 1); 753DEV_CLK(spi_clk, atmel_spi1, pba, 1);
754 754
755static void 755static void __init
756at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, 756at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b,
757 unsigned int n, const u8 *pins) 757 unsigned int n, const u8 *pins)
758{ 758{
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 9ba5654cde11..1eb99b814f5b 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -214,7 +214,7 @@ int gpio_direction_input(unsigned int gpio)
214} 214}
215EXPORT_SYMBOL(gpio_direction_input); 215EXPORT_SYMBOL(gpio_direction_input);
216 216
217int gpio_direction_output(unsigned int gpio) 217int gpio_direction_output(unsigned int gpio, int value)
218{ 218{
219 struct pio_device *pio; 219 struct pio_device *pio;
220 unsigned int pin; 220 unsigned int pin;
@@ -223,6 +223,8 @@ int gpio_direction_output(unsigned int gpio)
223 if (!pio) 223 if (!pio)
224 return -ENODEV; 224 return -ENODEV;
225 225
226 gpio_set_value(gpio, value);
227
226 pin = gpio & 0x1f; 228 pin = gpio & 0x1f;
227 pio_writel(pio, OER, 1 << pin); 229 pio_writel(pio, OER, 1 << pin);
228 230
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index fb13f72e9a02..8f7b1c3cd0f9 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -121,9 +121,8 @@ void flush_icache_range(unsigned long start, unsigned long end)
121void flush_icache_page(struct vm_area_struct *vma, struct page *page) 121void flush_icache_page(struct vm_area_struct *vma, struct page *page)
122{ 122{
123 if (vma->vm_flags & VM_EXEC) { 123 if (vma->vm_flags & VM_EXEC) {
124 void *v = kmap(page); 124 void *v = page_address(page);
125 __flush_icache_range((unsigned long)v, (unsigned long)v + PAGE_SIZE); 125 __flush_icache_range((unsigned long)v, (unsigned long)v + PAGE_SIZE);
126 kunmap(v);
127 } 126 }
128} 127}
129 128
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
index a2b9c60c2777..5b79a7a772d4 100644
--- a/arch/cris/arch-v32/drivers/pci/bios.c
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -100,7 +100,9 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
100 if ((err = pcibios_enable_resources(dev, mask)) < 0) 100 if ((err = pcibios_enable_resources(dev, mask)) < 0)
101 return err; 101 return err;
102 102
103 return pcibios_enable_irq(dev); 103 if (!dev->msi_enabled)
104 pcibios_enable_irq(dev);
105 return 0;
104} 106}
105 107
106int pcibios_assign_resources(void) 108int pcibios_assign_resources(void)
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index f7279d78995a..0b581e3cf7c7 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -466,6 +466,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
466 466
467 if ((err = pcibios_enable_resources(dev, mask)) < 0) 467 if ((err = pcibios_enable_resources(dev, mask)) < 0)
468 return err; 468 return err;
469 pcibios_enable_irq(dev); 469 if (!dev->msi_enabled)
470 pcibios_enable_irq(dev);
470 return 0; 471 return 0;
471} 472}
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 27e8453274e6..53d62373a524 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -220,7 +220,7 @@ config PARAVIRT
220 220
221config VMI 221config VMI
222 bool "VMI Paravirt-ops support" 222 bool "VMI Paravirt-ops support"
223 depends on PARAVIRT 223 depends on PARAVIRT && !COMPAT_VDSO
224 help 224 help
225 VMI provides a paravirtualized interface to the VMware ESX server 225 VMI provides a paravirtualized interface to the VMware ESX server
226 (it could be used by other hypervisors in theory too, but is not 226 (it could be used by other hypervisors in theory too, but is not
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 2c5b5cc55f79..8143c9516cb4 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -571,6 +571,16 @@ setr1: lodsw
571 jmp _m_s 571 jmp _m_s
572 572
573check_vesa: 573check_vesa:
574#ifdef CONFIG_FIRMWARE_EDID
575 leaw modelist+1024, %di
576 movw $0x4f00, %ax
577 int $0x10
578 cmpw $0x004f, %ax
579 jnz setbad
580
581 movw 4(%di), %ax
582 movw %ax, vbe_version
583#endif
574 leaw modelist+1024, %di 584 leaw modelist+1024, %di
575 subb $VIDEO_FIRST_VESA>>8, %bh 585 subb $VIDEO_FIRST_VESA>>8, %bh
576 movw %bx, %cx # Get mode information structure 586 movw %bx, %cx # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
1945 rep 1955 rep
1946 stosl 1956 stosl
1947 1957
1958 cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
1959 jl no_edid
1960
1948 pushw %es # save ES 1961 pushw %es # save ES
1949 xorw %di, %di # Report Capability 1962 xorw %di, %di # Report Capability
1950 pushw %di 1963 pushw %di
@@ -1987,6 +2000,7 @@ do_restore: .byte 0 # Screen contents altered during mode change
1987svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes 2000svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
1988graphic_mode: .byte 0 # Graphic mode with a linear frame buffer 2001graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
1989dac_size: .byte 6 # DAC bit depth 2002dac_size: .byte 6 # DAC bit depth
2003vbe_version: .word 0 # VBE bios version
1990 2004
1991# Status messages 2005# Status messages
1992keymsg: .ascii "Press <RETURN> to see video modes available, " 2006keymsg: .ascii "Press <RETURN> to see video modes available, "
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 5ae1e0bc8fd7..f4efd66e1ee5 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,10 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-git8 3# Linux kernel version: 2.6.21-rc3
4# Tue Feb 13 11:25:18 2007 4# Wed Mar 7 15:29:47 2007
5# 5#
6CONFIG_X86_32=y 6CONFIG_X86_32=y
7CONFIG_GENERIC_TIME=y 7CONFIG_GENERIC_TIME=y
8CONFIG_CLOCKSOURCE_WATCHDOG=y
9CONFIG_GENERIC_CLOCKEVENTS=y
10CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
8CONFIG_LOCKDEP_SUPPORT=y 11CONFIG_LOCKDEP_SUPPORT=y
9CONFIG_STACKTRACE_SUPPORT=y 12CONFIG_STACKTRACE_SUPPORT=y
10CONFIG_SEMAPHORE_SLEEPERS=y 13CONFIG_SEMAPHORE_SLEEPERS=y
@@ -34,6 +37,7 @@ CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SWAP=y 37CONFIG_SWAP=y
35CONFIG_SYSVIPC=y 38CONFIG_SYSVIPC=y
36# CONFIG_IPC_NS is not set 39# CONFIG_IPC_NS is not set
40CONFIG_SYSVIPC_SYSCTL=y
37CONFIG_POSIX_MQUEUE=y 41CONFIG_POSIX_MQUEUE=y
38# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 43# CONFIG_TASKSTATS is not set
@@ -44,6 +48,7 @@ CONFIG_IKCONFIG_PROC=y
44# CONFIG_CPUSETS is not set 48# CONFIG_CPUSETS is not set
45CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
51CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 52CONFIG_INITRAMFS_SOURCE=""
48CONFIG_CC_OPTIMIZE_FOR_SIZE=y 53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
49CONFIG_SYSCTL=y 54CONFIG_SYSCTL=y
@@ -103,6 +108,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
103# 108#
104# Processor type and features 109# Processor type and features
105# 110#
111# CONFIG_TICK_ONESHOT is not set
112# CONFIG_NO_HZ is not set
113# CONFIG_HIGH_RES_TIMERS is not set
106CONFIG_SMP=y 114CONFIG_SMP=y
107# CONFIG_X86_PC is not set 115# CONFIG_X86_PC is not set
108# CONFIG_X86_ELAN is not set 116# CONFIG_X86_ELAN is not set
@@ -235,10 +243,8 @@ CONFIG_ACPI_PROCFS=y
235CONFIG_ACPI_AC=y 243CONFIG_ACPI_AC=y
236CONFIG_ACPI_BATTERY=y 244CONFIG_ACPI_BATTERY=y
237CONFIG_ACPI_BUTTON=y 245CONFIG_ACPI_BUTTON=y
238# CONFIG_ACPI_HOTKEY is not set
239CONFIG_ACPI_FAN=y 246CONFIG_ACPI_FAN=y
240# CONFIG_ACPI_DOCK is not set 247# CONFIG_ACPI_DOCK is not set
241# CONFIG_ACPI_BAY is not set
242CONFIG_ACPI_PROCESSOR=y 248CONFIG_ACPI_PROCESSOR=y
243CONFIG_ACPI_THERMAL=y 249CONFIG_ACPI_THERMAL=y
244# CONFIG_ACPI_ASUS is not set 250# CONFIG_ACPI_ASUS is not set
@@ -289,6 +295,7 @@ CONFIG_X86_POWERNOW_K8_ACPI=y
289# CONFIG_X86_CPUFREQ_NFORCE2 is not set 295# CONFIG_X86_CPUFREQ_NFORCE2 is not set
290# CONFIG_X86_LONGRUN is not set 296# CONFIG_X86_LONGRUN is not set
291# CONFIG_X86_LONGHAUL is not set 297# CONFIG_X86_LONGHAUL is not set
298# CONFIG_X86_E_POWERSAVER is not set
292 299
293# 300#
294# shared options 301# shared options
@@ -368,7 +375,7 @@ CONFIG_IP_PNP_DHCP=y
368# CONFIG_INET_ESP is not set 375# CONFIG_INET_ESP is not set
369# CONFIG_INET_IPCOMP is not set 376# CONFIG_INET_IPCOMP is not set
370# CONFIG_INET_XFRM_TUNNEL is not set 377# CONFIG_INET_XFRM_TUNNEL is not set
371# CONFIG_INET_TUNNEL is not set 378CONFIG_INET_TUNNEL=y
372CONFIG_INET_XFRM_MODE_TRANSPORT=y 379CONFIG_INET_XFRM_MODE_TRANSPORT=y
373CONFIG_INET_XFRM_MODE_TUNNEL=y 380CONFIG_INET_XFRM_MODE_TUNNEL=y
374# CONFIG_INET_XFRM_MODE_BEET is not set 381# CONFIG_INET_XFRM_MODE_BEET is not set
@@ -470,7 +477,13 @@ CONFIG_FW_LOADER=y
470# 477#
471# Plug and Play support 478# Plug and Play support
472# 479#
473# CONFIG_PNP is not set 480CONFIG_PNP=y
481# CONFIG_PNP_DEBUG is not set
482
483#
484# Protocols
485#
486CONFIG_PNPACPI=y
474 487
475# 488#
476# Block devices 489# Block devices
@@ -490,7 +503,6 @@ CONFIG_BLK_DEV_RAM=y
490CONFIG_BLK_DEV_RAM_COUNT=16 503CONFIG_BLK_DEV_RAM_COUNT=16
491CONFIG_BLK_DEV_RAM_SIZE=4096 504CONFIG_BLK_DEV_RAM_SIZE=4096
492CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 505CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
493CONFIG_BLK_DEV_INITRD=y
494# CONFIG_CDROM_PKTCDVD is not set 506# CONFIG_CDROM_PKTCDVD is not set
495# CONFIG_ATA_OVER_ETH is not set 507# CONFIG_ATA_OVER_ETH is not set
496 508
@@ -500,6 +512,7 @@ CONFIG_BLK_DEV_INITRD=y
500# CONFIG_IBM_ASM is not set 512# CONFIG_IBM_ASM is not set
501# CONFIG_SGI_IOC4 is not set 513# CONFIG_SGI_IOC4 is not set
502# CONFIG_TIFM_CORE is not set 514# CONFIG_TIFM_CORE is not set
515# CONFIG_SONY_LAPTOP is not set
503 516
504# 517#
505# ATA/ATAPI/MFM/RLL support 518# ATA/ATAPI/MFM/RLL support
@@ -526,6 +539,7 @@ CONFIG_BLK_DEV_IDEACPI=y
526# 539#
527CONFIG_IDE_GENERIC=y 540CONFIG_IDE_GENERIC=y
528# CONFIG_BLK_DEV_CMD640 is not set 541# CONFIG_BLK_DEV_CMD640 is not set
542# CONFIG_BLK_DEV_IDEPNP is not set
529CONFIG_BLK_DEV_IDEPCI=y 543CONFIG_BLK_DEV_IDEPCI=y
530# CONFIG_IDEPCI_SHARE_IRQ is not set 544# CONFIG_IDEPCI_SHARE_IRQ is not set
531# CONFIG_BLK_DEV_OFFBOARD is not set 545# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -679,6 +693,7 @@ CONFIG_SATA_VIA=y
679# CONFIG_SATA_VITESSE is not set 693# CONFIG_SATA_VITESSE is not set
680# CONFIG_SATA_INIC162X is not set 694# CONFIG_SATA_INIC162X is not set
681CONFIG_SATA_INTEL_COMBINED=y 695CONFIG_SATA_INTEL_COMBINED=y
696CONFIG_SATA_ACPI=y
682# CONFIG_PATA_ALI is not set 697# CONFIG_PATA_ALI is not set
683# CONFIG_PATA_AMD is not set 698# CONFIG_PATA_AMD is not set
684# CONFIG_PATA_ARTOP is not set 699# CONFIG_PATA_ARTOP is not set
@@ -786,6 +801,7 @@ CONFIG_NETDEVICES=y
786# CONFIG_BONDING is not set 801# CONFIG_BONDING is not set
787# CONFIG_EQUALIZER is not set 802# CONFIG_EQUALIZER is not set
788# CONFIG_TUN is not set 803# CONFIG_TUN is not set
804# CONFIG_NET_SB1000 is not set
789 805
790# 806#
791# ARCnet devices 807# ARCnet devices
@@ -979,6 +995,7 @@ CONFIG_HW_CONSOLE=y
979CONFIG_SERIAL_8250=y 995CONFIG_SERIAL_8250=y
980CONFIG_SERIAL_8250_CONSOLE=y 996CONFIG_SERIAL_8250_CONSOLE=y
981CONFIG_SERIAL_8250_PCI=y 997CONFIG_SERIAL_8250_PCI=y
998CONFIG_SERIAL_8250_PNP=y
982CONFIG_SERIAL_8250_NR_UARTS=4 999CONFIG_SERIAL_8250_NR_UARTS=4
983CONFIG_SERIAL_8250_RUNTIME_UARTS=4 1000CONFIG_SERIAL_8250_RUNTIME_UARTS=4
984# CONFIG_SERIAL_8250_EXTENDED is not set 1001# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -1065,6 +1082,11 @@ CONFIG_HANGCHECK_TIMER=y
1065# CONFIG_HWMON_VID is not set 1082# CONFIG_HWMON_VID is not set
1066 1083
1067# 1084#
1085# Multifunction device drivers
1086#
1087# CONFIG_MFD_SM501 is not set
1088
1089#
1068# Multimedia devices 1090# Multimedia devices
1069# 1091#
1070# CONFIG_VIDEO_DEV is not set 1092# CONFIG_VIDEO_DEV is not set
@@ -1078,7 +1100,7 @@ CONFIG_HANGCHECK_TIMER=y
1078# 1100#
1079# Graphics support 1101# Graphics support
1080# 1102#
1081CONFIG_FIRMWARE_EDID=y 1103# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1082# CONFIG_FB is not set 1104# CONFIG_FB is not set
1083 1105
1084# 1106#
@@ -1089,7 +1111,6 @@ CONFIG_VGACON_SOFT_SCROLLBACK=y
1089CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128 1111CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128
1090CONFIG_VIDEO_SELECT=y 1112CONFIG_VIDEO_SELECT=y
1091CONFIG_DUMMY_CONSOLE=y 1113CONFIG_DUMMY_CONSOLE=y
1092# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1093 1114
1094# 1115#
1095# Sound 1116# Sound
@@ -1238,6 +1259,7 @@ CONFIG_USB_MON=y
1238# CONFIG_USB_RIO500 is not set 1259# CONFIG_USB_RIO500 is not set
1239# CONFIG_USB_LEGOTOWER is not set 1260# CONFIG_USB_LEGOTOWER is not set
1240# CONFIG_USB_LCD is not set 1261# CONFIG_USB_LCD is not set
1262# CONFIG_USB_BERRY_CHARGE is not set
1241# CONFIG_USB_LED is not set 1263# CONFIG_USB_LED is not set
1242# CONFIG_USB_CYPRESS_CY7C63 is not set 1264# CONFIG_USB_CYPRESS_CY7C63 is not set
1243# CONFIG_USB_CYTHERM is not set 1265# CONFIG_USB_CYTHERM is not set
@@ -1248,6 +1270,7 @@ CONFIG_USB_MON=y
1248# CONFIG_USB_SISUSBVGA is not set 1270# CONFIG_USB_SISUSBVGA is not set
1249# CONFIG_USB_LD is not set 1271# CONFIG_USB_LD is not set
1250# CONFIG_USB_TRANCEVIBRATOR is not set 1272# CONFIG_USB_TRANCEVIBRATOR is not set
1273# CONFIG_USB_IOWARRIOR is not set
1251# CONFIG_USB_TEST is not set 1274# CONFIG_USB_TEST is not set
1252 1275
1253# 1276#
@@ -1506,6 +1529,7 @@ CONFIG_DEBUG_KERNEL=y
1506CONFIG_LOG_BUF_SHIFT=18 1529CONFIG_LOG_BUF_SHIFT=18
1507CONFIG_DETECT_SOFTLOCKUP=y 1530CONFIG_DETECT_SOFTLOCKUP=y
1508# CONFIG_SCHEDSTATS is not set 1531# CONFIG_SCHEDSTATS is not set
1532# CONFIG_TIMER_STATS is not set
1509# CONFIG_DEBUG_SLAB is not set 1533# CONFIG_DEBUG_SLAB is not set
1510# CONFIG_DEBUG_RT_MUTEXES is not set 1534# CONFIG_DEBUG_RT_MUTEXES is not set
1511# CONFIG_RT_MUTEX_TESTER is not set 1535# CONFIG_RT_MUTEX_TESTER is not set
@@ -1525,6 +1549,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1525# CONFIG_FORCED_INLINING is not set 1549# CONFIG_FORCED_INLINING is not set
1526# CONFIG_RCU_TORTURE_TEST is not set 1550# CONFIG_RCU_TORTURE_TEST is not set
1527# CONFIG_LKDTM is not set 1551# CONFIG_LKDTM is not set
1552# CONFIG_FAULT_INJECTION is not set
1528CONFIG_EARLY_PRINTK=y 1553CONFIG_EARLY_PRINTK=y
1529CONFIG_DEBUG_STACKOVERFLOW=y 1554CONFIG_DEBUG_STACKOVERFLOW=y
1530# CONFIG_DEBUG_STACK_USAGE is not set 1555# CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index e5eb97a910ed..9ea5b8ecc7e1 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -1072,7 +1072,28 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1072 "ASUS A7V ACPI BIOS Revision 1007"), 1072 "ASUS A7V ACPI BIOS Revision 1007"),
1073 }, 1073 },
1074 }, 1074 },
1075 1075 {
1076 /*
1077 * Latest BIOS for IBM 600E (1.16) has bad pcinum
1078 * for LPC bridge, which is needed for the PCI
1079 * interrupt links to work. DSDT fix is in bug 5966.
1080 * 2645, 2646 model numbers are shared with 600/600E/600X
1081 */
1082 .callback = disable_acpi_irq,
1083 .ident = "IBM Thinkpad 600 Series 2645",
1084 .matches = {
1085 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1086 DMI_MATCH(DMI_BOARD_NAME, "2645"),
1087 },
1088 },
1089 {
1090 .callback = disable_acpi_irq,
1091 .ident = "IBM Thinkpad 600 Series 2646",
1092 .matches = {
1093 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1094 DMI_MATCH(DMI_BOARD_NAME, "2646"),
1095 },
1096 },
1076 /* 1097 /*
1077 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled 1098 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
1078 */ 1099 */
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c
index bf86f7662d8b..a7d22d9f3d7e 100644
--- a/arch/i386/kernel/acpi/earlyquirk.c
+++ b/arch/i386/kernel/acpi/earlyquirk.c
@@ -14,11 +14,8 @@
14 14
15#ifdef CONFIG_ACPI 15#ifdef CONFIG_ACPI
16 16
17static int nvidia_hpet_detected __initdata;
18
19static int __init nvidia_hpet_check(struct acpi_table_header *header) 17static int __init nvidia_hpet_check(struct acpi_table_header *header)
20{ 18{
21 nvidia_hpet_detected = 1;
22 return 0; 19 return 0;
23} 20}
24#endif 21#endif
@@ -29,9 +26,7 @@ static int __init check_bridge(int vendor, int device)
29 /* According to Nvidia all timer overrides are bogus unless HPET 26 /* According to Nvidia all timer overrides are bogus unless HPET
30 is enabled. */ 27 is enabled. */
31 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { 28 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
32 nvidia_hpet_detected = 0; 29 if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) {
33 acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check);
34 if (nvidia_hpet_detected == 0) {
35 acpi_skip_timer_override = 1; 30 acpi_skip_timer_override = 1;
36 printk(KERN_INFO "Nvidia board " 31 printk(KERN_INFO "Nvidia board "
37 "detected. Ignoring ACPI " 32 "detected. Ignoring ACPI "
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 2383bcf18c5d..93aa911646ad 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -28,6 +28,7 @@
28#include <linux/clockchips.h> 28#include <linux/clockchips.h>
29#include <linux/acpi_pmtmr.h> 29#include <linux/acpi_pmtmr.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/dmi.h>
31 32
32#include <asm/atomic.h> 33#include <asm/atomic.h>
33#include <asm/smp.h> 34#include <asm/smp.h>
@@ -61,6 +62,11 @@ static int enable_local_apic __initdata = 0;
61 62
62/* Local APIC timer verification ok */ 63/* Local APIC timer verification ok */
63static int local_apic_timer_verify_ok; 64static int local_apic_timer_verify_ok;
65/* Disable local APIC timer from the kernel commandline or via dmi quirk */
66static int local_apic_timer_disabled;
67/* Local APIC timer works in C2 */
68int local_apic_timer_c2_ok;
69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
64 70
65/* 71/*
66 * Debug level, exported for io_apic.c 72 * Debug level, exported for io_apic.c
@@ -338,6 +344,23 @@ void __init setup_boot_APIC_clock(void)
338 void (*real_handler)(struct clock_event_device *dev); 344 void (*real_handler)(struct clock_event_device *dev);
339 unsigned long deltaj; 345 unsigned long deltaj;
340 long delta, deltapm; 346 long delta, deltapm;
347 int pm_referenced = 0;
348
349 if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
350 local_apic_timer_disabled = 1;
351
352 /*
353 * The local apic timer can be disabled via the kernel
354 * commandline or from the test above. Register the lapic
355 * timer as a dummy clock event source on SMP systems, so the
356 * broadcast mechanism is used. On UP systems simply ignore it.
357 */
358 if (local_apic_timer_disabled) {
359 /* No broadcast on UP ! */
360 if (num_possible_cpus() > 1)
361 setup_APIC_timer();
362 return;
363 }
341 364
342 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n" 365 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
343 "calibrating APIC timer ...\n"); 366 "calibrating APIC timer ...\n");
@@ -357,7 +380,8 @@ void __init setup_boot_APIC_clock(void)
357 /* Let the interrupts run */ 380 /* Let the interrupts run */
358 local_irq_enable(); 381 local_irq_enable();
359 382
360 while(lapic_cal_loops <= LAPIC_CAL_LOOPS); 383 while (lapic_cal_loops <= LAPIC_CAL_LOOPS)
384 cpu_relax();
361 385
362 local_irq_disable(); 386 local_irq_disable();
363 387
@@ -394,6 +418,7 @@ void __init setup_boot_APIC_clock(void)
394 "%lu (%ld)\n", (unsigned long) res, delta); 418 "%lu (%ld)\n", (unsigned long) res, delta);
395 delta = (long) res; 419 delta = (long) res;
396 } 420 }
421 pm_referenced = 1;
397 } 422 }
398 423
399 /* Calculate the scaled math multiplication factor */ 424 /* Calculate the scaled math multiplication factor */
@@ -423,69 +448,43 @@ void __init setup_boot_APIC_clock(void)
423 calibration_result / (1000000 / HZ), 448 calibration_result / (1000000 / HZ),
424 calibration_result % (1000000 / HZ)); 449 calibration_result % (1000000 / HZ));
425 450
426
427 apic_printk(APIC_VERBOSE, "... verify APIC timer\n");
428
429 /*
430 * Setup the apic timer manually
431 */
432 local_apic_timer_verify_ok = 1; 451 local_apic_timer_verify_ok = 1;
433 levt->event_handler = lapic_cal_handler;
434 lapic_timer_setup(CLOCK_EVT_MODE_PERIODIC, levt);
435 lapic_cal_loops = -1;
436 452
437 /* Let the interrupts run */ 453 /* We trust the pm timer based calibration */
438 local_irq_enable(); 454 if (!pm_referenced) {
455 apic_printk(APIC_VERBOSE, "... verify APIC timer\n");
439 456
440 while(lapic_cal_loops <= LAPIC_CAL_LOOPS); 457 /*
458 * Setup the apic timer manually
459 */
460 levt->event_handler = lapic_cal_handler;
461 lapic_timer_setup(CLOCK_EVT_MODE_PERIODIC, levt);
462 lapic_cal_loops = -1;
441 463
442 local_irq_disable(); 464 /* Let the interrupts run */
465 local_irq_enable();
443 466
444 /* Stop the lapic timer */ 467 while(lapic_cal_loops <= LAPIC_CAL_LOOPS)
445 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, levt); 468 cpu_relax();
446 469
447 local_irq_enable(); 470 local_irq_disable();
448 471
449 /* Jiffies delta */ 472 /* Stop the lapic timer */
450 deltaj = lapic_cal_j2 - lapic_cal_j1; 473 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, levt);
451 apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj);
452 474
453 /* Check, if the PM timer is available */ 475 local_irq_enable();
454 deltapm = lapic_cal_pm2 - lapic_cal_pm1;
455 apic_printk(APIC_VERBOSE, "... PM timer delta = %ld\n", deltapm);
456 476
457 local_apic_timer_verify_ok = 0; 477 /* Jiffies delta */
478 deltaj = lapic_cal_j2 - lapic_cal_j1;
479 apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj);
458 480
459 if (deltapm) {
460 if (deltapm > (pm_100ms - pm_thresh) &&
461 deltapm < (pm_100ms + pm_thresh)) {
462 apic_printk(APIC_VERBOSE, "... PM timer result ok\n");
463 /* Check, if the jiffies result is consistent */
464 if (deltaj < LAPIC_CAL_LOOPS-2 ||
465 deltaj > LAPIC_CAL_LOOPS+2) {
466 /*
467 * Not sure, what we can do about this one.
468 * When high resultion timers are active
469 * and the lapic timer does not stop in C3
470 * we are fine. Otherwise more trouble might
471 * be waiting. -- tglx
472 */
473 printk(KERN_WARNING "Global event device %s "
474 "has wrong frequency "
475 "(%lu ticks instead of %d)\n",
476 global_clock_event->name, deltaj,
477 LAPIC_CAL_LOOPS);
478 }
479 local_apic_timer_verify_ok = 1;
480 }
481 } else {
482 /* Check, if the jiffies result is consistent */ 481 /* Check, if the jiffies result is consistent */
483 if (deltaj >= LAPIC_CAL_LOOPS-2 && 482 if (deltaj >= LAPIC_CAL_LOOPS-2 && deltaj <= LAPIC_CAL_LOOPS+2)
484 deltaj <= LAPIC_CAL_LOOPS+2) {
485 apic_printk(APIC_VERBOSE, "... jiffies result ok\n"); 483 apic_printk(APIC_VERBOSE, "... jiffies result ok\n");
486 local_apic_timer_verify_ok = 1; 484 else
487 } 485 local_apic_timer_verify_ok = 0;
488 } 486 } else
487 local_irq_enable();
489 488
490 if (!local_apic_timer_verify_ok) { 489 if (!local_apic_timer_verify_ok) {
491 printk(KERN_WARNING 490 printk(KERN_WARNING
@@ -1203,6 +1202,20 @@ static int __init parse_nolapic(char *arg)
1203} 1202}
1204early_param("nolapic", parse_nolapic); 1203early_param("nolapic", parse_nolapic);
1205 1204
1205static int __init parse_disable_lapic_timer(char *arg)
1206{
1207 local_apic_timer_disabled = 1;
1208 return 0;
1209}
1210early_param("nolapic_timer", parse_disable_lapic_timer);
1211
1212static int __init parse_lapic_timer_c2_ok(char *arg)
1213{
1214 local_apic_timer_c2_ok = 1;
1215 return 0;
1216}
1217early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1218
1206static int __init apic_set_verbosity(char *str) 1219static int __init apic_set_verbosity(char *str)
1207{ 1220{
1208 if (strcmp("debug", str) == 0) 1221 if (strcmp("debug", str) == 0)
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 41cfea57232b..2d47db482972 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -22,6 +22,37 @@
22extern void vide(void); 22extern void vide(void);
23__asm__(".align 4\nvide: ret"); 23__asm__(".align 4\nvide: ret");
24 24
25#define ENABLE_C1E_MASK 0x18000000
26#define CPUID_PROCESSOR_SIGNATURE 1
27#define CPUID_XFAM 0x0ff00000
28#define CPUID_XFAM_K8 0x00000000
29#define CPUID_XFAM_10H 0x00100000
30#define CPUID_XFAM_11H 0x00200000
31#define CPUID_XMOD 0x000f0000
32#define CPUID_XMOD_REV_F 0x00040000
33
34/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
35static __cpuinit int amd_apic_timer_broken(void)
36{
37 u32 lo, hi;
38 u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
39 switch (eax & CPUID_XFAM) {
40 case CPUID_XFAM_K8:
41 if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
42 break;
43 case CPUID_XFAM_10H:
44 case CPUID_XFAM_11H:
45 rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
46 if (lo & ENABLE_C1E_MASK)
47 return 1;
48 break;
49 default:
50 /* err on the side of caution */
51 return 1;
52 }
53 return 0;
54}
55
25static void __cpuinit init_amd(struct cpuinfo_x86 *c) 56static void __cpuinit init_amd(struct cpuinfo_x86 *c)
26{ 57{
27 u32 l, h; 58 u32 l, h;
@@ -241,6 +272,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
241 272
242 if (cpuid_eax(0x80000000) >= 0x80000006) 273 if (cpuid_eax(0x80000000) >= 0x80000006)
243 num_cache_leaves = 3; 274 num_cache_leaves = 3;
275
276 if (amd_apic_timer_broken())
277 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
244} 278}
245 279
246static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 280static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index f3ab61ee7498..17d73459fc5f 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -3,6 +3,8 @@
3#include <linux/errno.h> 3#include <linux/errno.h>
4#include <linux/hpet.h> 4#include <linux/hpet.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/sysdev.h>
7#include <linux/pm.h>
6 8
7#include <asm/hpet.h> 9#include <asm/hpet.h>
8#include <asm/io.h> 10#include <asm/io.h>
@@ -197,7 +199,7 @@ static int hpet_next_event(unsigned long delta,
197 cnt += delta; 199 cnt += delta;
198 hpet_writel(cnt, HPET_T0_CMP); 200 hpet_writel(cnt, HPET_T0_CMP);
199 201
200 return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0); 202 return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0) ? -ETIME : 0;
201} 203}
202 204
203/* 205/*
@@ -307,6 +309,7 @@ int __init hpet_enable(void)
307out_nohpet: 309out_nohpet:
308 iounmap(hpet_virt_address); 310 iounmap(hpet_virt_address);
309 hpet_virt_address = NULL; 311 hpet_virt_address = NULL;
312 boot_hpet_disable = 1;
310 return 0; 313 return 0;
311} 314}
312 315
@@ -521,3 +524,68 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
521 return IRQ_HANDLED; 524 return IRQ_HANDLED;
522} 525}
523#endif 526#endif
527
528
529/*
530 * Suspend/resume part
531 */
532
533#ifdef CONFIG_PM
534
535static int hpet_suspend(struct sys_device *sys_device, pm_message_t state)
536{
537 unsigned long cfg = hpet_readl(HPET_CFG);
538
539 cfg &= ~(HPET_CFG_ENABLE|HPET_CFG_LEGACY);
540 hpet_writel(cfg, HPET_CFG);
541
542 return 0;
543}
544
545static int hpet_resume(struct sys_device *sys_device)
546{
547 unsigned int id;
548
549 hpet_start_counter();
550
551 id = hpet_readl(HPET_ID);
552
553 if (id & HPET_ID_LEGSUP)
554 hpet_enable_int();
555
556 return 0;
557}
558
559static struct sysdev_class hpet_class = {
560 set_kset_name("hpet"),
561 .suspend = hpet_suspend,
562 .resume = hpet_resume,
563};
564
565static struct sys_device hpet_device = {
566 .id = 0,
567 .cls = &hpet_class,
568};
569
570
571static __init int hpet_register_sysfs(void)
572{
573 int err;
574
575 if (!is_hpet_capable())
576 return 0;
577
578 err = sysdev_class_register(&hpet_class);
579
580 if (!err) {
581 err = sysdev_register(&hpet_device);
582 if (err)
583 sysdev_class_unregister(&hpet_class);
584 }
585
586 return err;
587}
588
589device_initcall(hpet_register_sysfs);
590
591#endif
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
index e3d4b73bfdb0..4afe26e86260 100644
--- a/arch/i386/kernel/i386_ksyms.c
+++ b/arch/i386/kernel/i386_ksyms.c
@@ -28,3 +28,5 @@ EXPORT_SYMBOL(__read_lock_failed);
28#endif 28#endif
29 29
30EXPORT_SYMBOL(csum_partial); 30EXPORT_SYMBOL(csum_partial);
31
32EXPORT_SYMBOL(_proxy_pda);
diff --git a/arch/i386/kernel/i8253.c b/arch/i386/kernel/i8253.c
index 5cbb776b3089..10cef5ca8a5b 100644
--- a/arch/i386/kernel/i8253.c
+++ b/arch/i386/kernel/i8253.c
@@ -47,9 +47,17 @@ static void init_pit_timer(enum clock_event_mode mode,
47 outb(LATCH >> 8 , PIT_CH0); /* MSB */ 47 outb(LATCH >> 8 , PIT_CH0); /* MSB */
48 break; 48 break;
49 49
50 case CLOCK_EVT_MODE_ONESHOT: 50 /*
51 * Avoid unnecessary state transitions, as it confuses
52 * Geode / Cyrix based boxen.
53 */
51 case CLOCK_EVT_MODE_SHUTDOWN: 54 case CLOCK_EVT_MODE_SHUTDOWN:
55 if (evt->mode == CLOCK_EVT_MODE_UNUSED)
56 break;
52 case CLOCK_EVT_MODE_UNUSED: 57 case CLOCK_EVT_MODE_UNUSED:
58 if (evt->mode == CLOCK_EVT_MODE_SHUTDOWN)
59 break;
60 case CLOCK_EVT_MODE_ONESHOT:
53 /* One shot setup */ 61 /* One shot setup */
54 outb_p(0x38, PIT_MODE); 62 outb_p(0x38, PIT_MODE);
55 udelay(10); 63 udelay(10);
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index e4408ff4e674..b3ab8ffebd27 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -736,7 +736,7 @@ failed:
736 return 0; 736 return 0;
737} 737}
738 738
739int __init irqbalance_disable(char *str) 739int __devinit irqbalance_disable(char *str)
740{ 740{
741 irqbalance_disabled = 1; 741 irqbalance_disabled = 1;
742 return 1; 742 return 1;
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index b8f16633a6ec..cbe7ec8dbb9f 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -567,6 +567,53 @@ static int cpu_request_microcode(int cpu)
567 return error; 567 return error;
568} 568}
569 569
570static int apply_microcode_on_cpu(int cpu)
571{
572 struct cpuinfo_x86 *c = cpu_data + cpu;
573 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
574 cpumask_t old;
575 unsigned int val[2];
576 int err = 0;
577
578 if (!uci->mc)
579 return -EINVAL;
580
581 old = current->cpus_allowed;
582 set_cpus_allowed(current, cpumask_of_cpu(cpu));
583
584 /* Check if the microcode we have in memory matches the CPU */
585 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
586 cpu_has(c, X86_FEATURE_IA64) || uci->sig != cpuid_eax(0x00000001))
587 err = -EINVAL;
588
589 if (!err && ((c->x86_model >= 5) || (c->x86 > 6))) {
590 /* get processor flags from MSR 0x17 */
591 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
592 if (uci->pf != (1 << ((val[1] >> 18) & 7)))
593 err = -EINVAL;
594 }
595
596 if (!err) {
597 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
598 /* see notes above for revision 1.07. Apparent chip bug */
599 sync_core();
600 /* get the current revision from MSR 0x8B */
601 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
602 if (uci->rev != val[1])
603 err = -EINVAL;
604 }
605
606 if (!err)
607 apply_microcode(cpu);
608 else
609 printk(KERN_ERR "microcode: Could not apply microcode to CPU%d:"
610 " sig=0x%x, pf=0x%x, rev=0x%x\n",
611 cpu, uci->sig, uci->pf, uci->rev);
612
613 set_cpus_allowed(current, old);
614 return err;
615}
616
570static void microcode_init_cpu(int cpu) 617static void microcode_init_cpu(int cpu)
571{ 618{
572 cpumask_t old; 619 cpumask_t old;
@@ -577,7 +624,8 @@ static void microcode_init_cpu(int cpu)
577 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 624 set_cpus_allowed(current, cpumask_of_cpu(cpu));
578 mutex_lock(&microcode_mutex); 625 mutex_lock(&microcode_mutex);
579 collect_cpu_info(cpu); 626 collect_cpu_info(cpu);
580 if (uci->valid && system_state == SYSTEM_RUNNING) 627 if (uci->valid && system_state == SYSTEM_RUNNING &&
628 !suspend_cpu_hotplug)
581 cpu_request_microcode(cpu); 629 cpu_request_microcode(cpu);
582 mutex_unlock(&microcode_mutex); 630 mutex_unlock(&microcode_mutex);
583 set_cpus_allowed(current, old); 631 set_cpus_allowed(current, old);
@@ -663,13 +711,24 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
663 return 0; 711 return 0;
664 712
665 pr_debug("Microcode:CPU %d added\n", cpu); 713 pr_debug("Microcode:CPU %d added\n", cpu);
666 memset(uci, 0, sizeof(*uci)); 714 /* If suspend_cpu_hotplug is set, the system is resuming and we should
715 * use the data from before the suspend.
716 */
717 if (suspend_cpu_hotplug) {
718 err = apply_microcode_on_cpu(cpu);
719 if (err)
720 microcode_fini_cpu(cpu);
721 }
722 if (!uci->valid)
723 memset(uci, 0, sizeof(*uci));
667 724
668 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 725 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
669 if (err) 726 if (err)
670 return err; 727 return err;
671 728
672 microcode_init_cpu(cpu); 729 if (!uci->valid)
730 microcode_init_cpu(cpu);
731
673 return 0; 732 return 0;
674} 733}
675 734
@@ -680,7 +739,11 @@ static int mc_sysdev_remove(struct sys_device *sys_dev)
680 if (!cpu_online(cpu)) 739 if (!cpu_online(cpu))
681 return 0; 740 return 0;
682 pr_debug("Microcode:CPU %d removed\n", cpu); 741 pr_debug("Microcode:CPU %d removed\n", cpu);
683 microcode_fini_cpu(cpu); 742 /* If suspend_cpu_hotplug is set, the system is suspending and we should
743 * keep the microcode in memory for the resume.
744 */
745 if (!suspend_cpu_hotplug)
746 microcode_fini_cpu(cpu);
684 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 747 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
685 return 0; 748 return 0;
686} 749}
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 821df34d2b3a..a98ba88a8c0c 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -122,64 +122,129 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
122/* checks for a bit availability (hack for oprofile) */ 122/* checks for a bit availability (hack for oprofile) */
123int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 123int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
124{ 124{
125 int cpu;
125 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 126 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
126 127 for_each_possible_cpu (cpu) {
127 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 128 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
129 return 0;
130 }
131 return 1;
128} 132}
129 133
130/* checks the an msr for availability */ 134/* checks the an msr for availability */
131int avail_to_resrv_perfctr_nmi(unsigned int msr) 135int avail_to_resrv_perfctr_nmi(unsigned int msr)
132{ 136{
133 unsigned int counter; 137 unsigned int counter;
138 int cpu;
134 139
135 counter = nmi_perfctr_msr_to_bit(msr); 140 counter = nmi_perfctr_msr_to_bit(msr);
136 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 141 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
137 142
138 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 143 for_each_possible_cpu (cpu) {
144 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
145 return 0;
146 }
147 return 1;
139} 148}
140 149
141int reserve_perfctr_nmi(unsigned int msr) 150static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
142{ 151{
143 unsigned int counter; 152 unsigned int counter;
153 if (cpu < 0)
154 cpu = smp_processor_id();
144 155
145 counter = nmi_perfctr_msr_to_bit(msr); 156 counter = nmi_perfctr_msr_to_bit(msr);
146 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 157 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
147 158
148 if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 159 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
149 return 1; 160 return 1;
150 return 0; 161 return 0;
151} 162}
152 163
153void release_perfctr_nmi(unsigned int msr) 164static void __release_perfctr_nmi(int cpu, unsigned int msr)
154{ 165{
155 unsigned int counter; 166 unsigned int counter;
167 if (cpu < 0)
168 cpu = smp_processor_id();
156 169
157 counter = nmi_perfctr_msr_to_bit(msr); 170 counter = nmi_perfctr_msr_to_bit(msr);
158 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 171 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
159 172
160 clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 173 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu));
161} 174}
162 175
163int reserve_evntsel_nmi(unsigned int msr) 176int reserve_perfctr_nmi(unsigned int msr)
177{
178 int cpu, i;
179 for_each_possible_cpu (cpu) {
180 if (!__reserve_perfctr_nmi(cpu, msr)) {
181 for_each_possible_cpu (i) {
182 if (i >= cpu)
183 break;
184 __release_perfctr_nmi(i, msr);
185 }
186 return 0;
187 }
188 }
189 return 1;
190}
191
192void release_perfctr_nmi(unsigned int msr)
193{
194 int cpu;
195 for_each_possible_cpu (cpu) {
196 __release_perfctr_nmi(cpu, msr);
197 }
198}
199
200int __reserve_evntsel_nmi(int cpu, unsigned int msr)
164{ 201{
165 unsigned int counter; 202 unsigned int counter;
203 if (cpu < 0)
204 cpu = smp_processor_id();
166 205
167 counter = nmi_evntsel_msr_to_bit(msr); 206 counter = nmi_evntsel_msr_to_bit(msr);
168 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 207 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
169 208
170 if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0])) 209 if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
171 return 1; 210 return 1;
172 return 0; 211 return 0;
173} 212}
174 213
175void release_evntsel_nmi(unsigned int msr) 214static void __release_evntsel_nmi(int cpu, unsigned int msr)
176{ 215{
177 unsigned int counter; 216 unsigned int counter;
217 if (cpu < 0)
218 cpu = smp_processor_id();
178 219
179 counter = nmi_evntsel_msr_to_bit(msr); 220 counter = nmi_evntsel_msr_to_bit(msr);
180 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 221 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
181 222
182 clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0]); 223 clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
224}
225
226int reserve_evntsel_nmi(unsigned int msr)
227{
228 int cpu, i;
229 for_each_possible_cpu (cpu) {
230 if (!__reserve_evntsel_nmi(cpu, msr)) {
231 for_each_possible_cpu (i) {
232 if (i >= cpu)
233 break;
234 __release_evntsel_nmi(i, msr);
235 }
236 return 0;
237 }
238 }
239 return 1;
240}
241
242void release_evntsel_nmi(unsigned int msr)
243{
244 int cpu;
245 for_each_possible_cpu (cpu) {
246 __release_evntsel_nmi(cpu, msr);
247 }
183} 248}
184 249
185static __cpuinit inline int nmi_known_cpu(void) 250static __cpuinit inline int nmi_known_cpu(void)
@@ -245,14 +310,6 @@ static int __init check_nmi_watchdog(void)
245 unsigned int *prev_nmi_count; 310 unsigned int *prev_nmi_count;
246 int cpu; 311 int cpu;
247 312
248 /* Enable NMI watchdog for newer systems.
249 Probably safe on most older systems too, but let's be careful.
250 IBM ThinkPads use INT10 inside SMM and that allows early NMI inside SMM
251 which hangs the system. Disable watchdog for all thinkpads */
252 if (nmi_watchdog == NMI_DEFAULT && dmi_get_year(DMI_BIOS_DATE) >= 2004 &&
253 !dmi_name_in_vendors("ThinkPad"))
254 nmi_watchdog = NMI_LOCAL_APIC;
255
256 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 313 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT))
257 return 0; 314 return 0;
258 315
@@ -271,7 +328,7 @@ static int __init check_nmi_watchdog(void)
271 for_each_possible_cpu(cpu) 328 for_each_possible_cpu(cpu)
272 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; 329 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
273 local_irq_enable(); 330 local_irq_enable();
274 mdelay((10*1000)/nmi_hz); // wait 10 ticks 331 mdelay((20*1000)/nmi_hz); // wait 20 ticks
275 332
276 for_each_possible_cpu(cpu) { 333 for_each_possible_cpu(cpu) {
277#ifdef CONFIG_SMP 334#ifdef CONFIG_SMP
@@ -515,10 +572,10 @@ static int setup_k7_watchdog(void)
515 572
516 perfctr_msr = MSR_K7_PERFCTR0; 573 perfctr_msr = MSR_K7_PERFCTR0;
517 evntsel_msr = MSR_K7_EVNTSEL0; 574 evntsel_msr = MSR_K7_EVNTSEL0;
518 if (!reserve_perfctr_nmi(perfctr_msr)) 575 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
519 goto fail; 576 goto fail;
520 577
521 if (!reserve_evntsel_nmi(evntsel_msr)) 578 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
522 goto fail1; 579 goto fail1;
523 580
524 wrmsrl(perfctr_msr, 0UL); 581 wrmsrl(perfctr_msr, 0UL);
@@ -541,7 +598,7 @@ static int setup_k7_watchdog(void)
541 wd->check_bit = 1ULL<<63; 598 wd->check_bit = 1ULL<<63;
542 return 1; 599 return 1;
543fail1: 600fail1:
544 release_perfctr_nmi(perfctr_msr); 601 __release_perfctr_nmi(-1, perfctr_msr);
545fail: 602fail:
546 return 0; 603 return 0;
547} 604}
@@ -552,8 +609,8 @@ static void stop_k7_watchdog(void)
552 609
553 wrmsr(wd->evntsel_msr, 0, 0); 610 wrmsr(wd->evntsel_msr, 0, 0);
554 611
555 release_evntsel_nmi(wd->evntsel_msr); 612 __release_evntsel_nmi(-1, wd->evntsel_msr);
556 release_perfctr_nmi(wd->perfctr_msr); 613 __release_perfctr_nmi(-1, wd->perfctr_msr);
557} 614}
558 615
559#define P6_EVNTSEL0_ENABLE (1 << 22) 616#define P6_EVNTSEL0_ENABLE (1 << 22)
@@ -571,10 +628,10 @@ static int setup_p6_watchdog(void)
571 628
572 perfctr_msr = MSR_P6_PERFCTR0; 629 perfctr_msr = MSR_P6_PERFCTR0;
573 evntsel_msr = MSR_P6_EVNTSEL0; 630 evntsel_msr = MSR_P6_EVNTSEL0;
574 if (!reserve_perfctr_nmi(perfctr_msr)) 631 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
575 goto fail; 632 goto fail;
576 633
577 if (!reserve_evntsel_nmi(evntsel_msr)) 634 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
578 goto fail1; 635 goto fail1;
579 636
580 wrmsrl(perfctr_msr, 0UL); 637 wrmsrl(perfctr_msr, 0UL);
@@ -598,7 +655,7 @@ static int setup_p6_watchdog(void)
598 wd->check_bit = 1ULL<<39; 655 wd->check_bit = 1ULL<<39;
599 return 1; 656 return 1;
600fail1: 657fail1:
601 release_perfctr_nmi(perfctr_msr); 658 __release_perfctr_nmi(-1, perfctr_msr);
602fail: 659fail:
603 return 0; 660 return 0;
604} 661}
@@ -609,8 +666,8 @@ static void stop_p6_watchdog(void)
609 666
610 wrmsr(wd->evntsel_msr, 0, 0); 667 wrmsr(wd->evntsel_msr, 0, 0);
611 668
612 release_evntsel_nmi(wd->evntsel_msr); 669 __release_evntsel_nmi(-1, wd->evntsel_msr);
613 release_perfctr_nmi(wd->perfctr_msr); 670 __release_perfctr_nmi(-1, wd->perfctr_msr);
614} 671}
615 672
616/* Note that these events don't tick when the CPU idles. This means 673/* Note that these events don't tick when the CPU idles. This means
@@ -676,10 +733,10 @@ static int setup_p4_watchdog(void)
676 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 733 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
677 } 734 }
678 735
679 if (!reserve_perfctr_nmi(perfctr_msr)) 736 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
680 goto fail; 737 goto fail;
681 738
682 if (!reserve_evntsel_nmi(evntsel_msr)) 739 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
683 goto fail1; 740 goto fail1;
684 741
685 evntsel = P4_ESCR_EVENT_SELECT(0x3F) 742 evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -703,7 +760,7 @@ static int setup_p4_watchdog(void)
703 wd->check_bit = 1ULL<<39; 760 wd->check_bit = 1ULL<<39;
704 return 1; 761 return 1;
705fail1: 762fail1:
706 release_perfctr_nmi(perfctr_msr); 763 __release_perfctr_nmi(-1, perfctr_msr);
707fail: 764fail:
708 return 0; 765 return 0;
709} 766}
@@ -715,8 +772,8 @@ static void stop_p4_watchdog(void)
715 wrmsr(wd->cccr_msr, 0, 0); 772 wrmsr(wd->cccr_msr, 0, 0);
716 wrmsr(wd->evntsel_msr, 0, 0); 773 wrmsr(wd->evntsel_msr, 0, 0);
717 774
718 release_evntsel_nmi(wd->evntsel_msr); 775 __release_evntsel_nmi(-1, wd->evntsel_msr);
719 release_perfctr_nmi(wd->perfctr_msr); 776 __release_perfctr_nmi(-1, wd->perfctr_msr);
720} 777}
721 778
722#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 779#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -744,10 +801,10 @@ static int setup_intel_arch_watchdog(void)
744 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 801 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
745 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 802 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
746 803
747 if (!reserve_perfctr_nmi(perfctr_msr)) 804 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
748 goto fail; 805 goto fail;
749 806
750 if (!reserve_evntsel_nmi(evntsel_msr)) 807 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
751 goto fail1; 808 goto fail1;
752 809
753 wrmsrl(perfctr_msr, 0UL); 810 wrmsrl(perfctr_msr, 0UL);
@@ -772,7 +829,7 @@ static int setup_intel_arch_watchdog(void)
772 wd->check_bit = 1ULL << (eax.split.bit_width - 1); 829 wd->check_bit = 1ULL << (eax.split.bit_width - 1);
773 return 1; 830 return 1;
774fail1: 831fail1:
775 release_perfctr_nmi(perfctr_msr); 832 __release_perfctr_nmi(-1, perfctr_msr);
776fail: 833fail:
777 return 0; 834 return 0;
778} 835}
@@ -795,8 +852,8 @@ static void stop_intel_arch_watchdog(void)
795 return; 852 return;
796 853
797 wrmsr(wd->evntsel_msr, 0, 0); 854 wrmsr(wd->evntsel_msr, 0, 0);
798 release_evntsel_nmi(wd->evntsel_msr); 855 __release_evntsel_nmi(-1, wd->evntsel_msr);
799 release_perfctr_nmi(wd->perfctr_msr); 856 __release_perfctr_nmi(-1, wd->perfctr_msr);
800} 857}
801 858
802void setup_apic_nmi_watchdog (void *unused) 859void setup_apic_nmi_watchdog (void *unused)
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 9b0dd2744c82..4ff55e675576 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -45,6 +45,7 @@
45#include <linux/notifier.h> 45#include <linux/notifier.h>
46#include <linux/cpu.h> 46#include <linux/cpu.h>
47#include <linux/percpu.h> 47#include <linux/percpu.h>
48#include <linux/nmi.h>
48 49
49#include <linux/delay.h> 50#include <linux/delay.h>
50#include <linux/mc146818rtc.h> 51#include <linux/mc146818rtc.h>
@@ -1278,8 +1279,9 @@ void __cpu_die(unsigned int cpu)
1278 1279
1279int __cpuinit __cpu_up(unsigned int cpu) 1280int __cpuinit __cpu_up(unsigned int cpu)
1280{ 1281{
1282 unsigned long flags;
1281#ifdef CONFIG_HOTPLUG_CPU 1283#ifdef CONFIG_HOTPLUG_CPU
1282 int ret=0; 1284 int ret = 0;
1283 1285
1284 /* 1286 /*
1285 * We do warm boot only on cpus that had booted earlier 1287 * We do warm boot only on cpus that had booted earlier
@@ -1297,23 +1299,25 @@ int __cpuinit __cpu_up(unsigned int cpu)
1297 /* In case one didn't come up */ 1299 /* In case one didn't come up */
1298 if (!cpu_isset(cpu, cpu_callin_map)) { 1300 if (!cpu_isset(cpu, cpu_callin_map)) {
1299 printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); 1301 printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu);
1300 local_irq_enable();
1301 return -EIO; 1302 return -EIO;
1302 } 1303 }
1303 1304
1304 local_irq_enable();
1305
1306 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 1305 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
1307 /* Unleash the CPU! */ 1306 /* Unleash the CPU! */
1308 cpu_set(cpu, smp_commenced_mask); 1307 cpu_set(cpu, smp_commenced_mask);
1309 1308
1310 /* 1309 /*
1311 * Check TSC synchronization with the AP: 1310 * Check TSC synchronization with the AP (keep irqs disabled
1311 * while doing so):
1312 */ 1312 */
1313 local_irq_save(flags);
1313 check_tsc_sync_source(cpu); 1314 check_tsc_sync_source(cpu);
1315 local_irq_restore(flags);
1314 1316
1315 while (!cpu_isset(cpu, cpu_online_map)) 1317 while (!cpu_isset(cpu, cpu_online_map)) {
1316 cpu_relax(); 1318 cpu_relax();
1319 touch_nmi_watchdog();
1320 }
1317 1321
1318#ifdef CONFIG_X86_GENERICARCH 1322#ifdef CONFIG_X86_GENERICARCH
1319 if (num_online_cpus() > 8 && genapic == &apic_default) 1323 if (num_online_cpus() > 8 && genapic == &apic_default)
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 602660df455c..6cb8f5336732 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -18,6 +18,8 @@
18 18
19#include "mach_timer.h" 19#include "mach_timer.h"
20 20
21static int tsc_enabled;
22
21/* 23/*
22 * On some systems the TSC frequency does not 24 * On some systems the TSC frequency does not
23 * change with the cpu frequency. So we need 25 * change with the cpu frequency. So we need
@@ -105,7 +107,7 @@ unsigned long long sched_clock(void)
105 /* 107 /*
106 * Fall back to jiffies if there's no TSC available: 108 * Fall back to jiffies if there's no TSC available:
107 */ 109 */
108 if (unlikely(tsc_disable)) 110 if (unlikely(!tsc_enabled))
109 /* No locking but a rare wrong value is not a big deal: */ 111 /* No locking but a rare wrong value is not a big deal: */
110 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 112 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
111 113
@@ -283,6 +285,7 @@ void mark_tsc_unstable(void)
283{ 285{
284 if (!tsc_unstable) { 286 if (!tsc_unstable) {
285 tsc_unstable = 1; 287 tsc_unstable = 1;
288 tsc_enabled = 0;
286 /* Can be called before registration */ 289 /* Can be called before registration */
287 if (clocksource_tsc.mult) 290 if (clocksource_tsc.mult)
288 clocksource_change_rating(&clocksource_tsc, 0); 291 clocksource_change_rating(&clocksource_tsc, 0);
@@ -383,7 +386,9 @@ void __init tsc_init(void)
383 if (check_tsc_unstable()) { 386 if (check_tsc_unstable()) {
384 clocksource_tsc.rating = 0; 387 clocksource_tsc.rating = 0;
385 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 388 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
386 } 389 } else
390 tsc_enabled = 1;
391
387 clocksource_register(&clocksource_tsc); 392 clocksource_register(&clocksource_tsc);
388 393
389 return; 394 return;
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index fbf45fa08320..edc339fa5038 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -23,7 +23,6 @@
23 */ 23 */
24 24
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/license.h>
27#include <linux/cpu.h> 26#include <linux/cpu.h>
28#include <linux/bootmem.h> 27#include <linux/bootmem.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
@@ -48,7 +47,6 @@ typedef u64 __attribute__((regparm(2))) (VROMLONGFUNC)(int);
48 (((VROMLONGFUNC *)(rom->func)) (arg)) 47 (((VROMLONGFUNC *)(rom->func)) (arg))
49 48
50static struct vrom_header *vmi_rom; 49static struct vrom_header *vmi_rom;
51static int license_gplok;
52static int disable_pge; 50static int disable_pge;
53static int disable_pse; 51static int disable_pse;
54static int disable_sep; 52static int disable_sep;
@@ -71,6 +69,7 @@ struct {
71 void (*flush_tlb)(int); 69 void (*flush_tlb)(int);
72 void (*set_initial_ap_state)(int, int); 70 void (*set_initial_ap_state)(int, int);
73 void (*halt)(void); 71 void (*halt)(void);
72 void (*set_lazy_mode)(int mode);
74} vmi_ops; 73} vmi_ops;
75 74
76/* XXX move this to alternative.h */ 75/* XXX move this to alternative.h */
@@ -576,6 +575,26 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
576} 575}
577#endif 576#endif
578 577
578static void vmi_set_lazy_mode(int mode)
579{
580 static DEFINE_PER_CPU(int, lazy_mode);
581
582 if (!vmi_ops.set_lazy_mode)
583 return;
584
585 /* Modes should never nest or overlap */
586 BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE ||
587 mode == PARAVIRT_LAZY_FLUSH));
588
589 if (mode == PARAVIRT_LAZY_FLUSH) {
590 vmi_ops.set_lazy_mode(0);
591 vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode));
592 } else {
593 vmi_ops.set_lazy_mode(mode);
594 __get_cpu_var(lazy_mode) = mode;
595 }
596}
597
579static inline int __init check_vmi_rom(struct vrom_header *rom) 598static inline int __init check_vmi_rom(struct vrom_header *rom)
580{ 599{
581 struct pci_header *pci; 600 struct pci_header *pci;
@@ -629,13 +648,14 @@ static inline int __init check_vmi_rom(struct vrom_header *rom)
629 rom->api_version_maj, rom->api_version_min, 648 rom->api_version_maj, rom->api_version_min,
630 pci->rom_version_maj, pci->rom_version_min); 649 pci->rom_version_maj, pci->rom_version_min);
631 650
632 license_gplok = license_is_gpl_compatible(license); 651 /* Don't allow BSD/MIT here for now because we don't want to end up
633 if (!license_gplok) { 652 with any binary only shim layers */
634 printk(KERN_WARNING "VMI: ROM license '%s' taints kernel... " 653 if (strcmp(license, "GPL") && strcmp(license, "GPL v2")) {
635 "inlining disabled\n", 654 printk(KERN_WARNING "VMI: Non GPL license `%s' found for ROM. Not used.\n",
636 license); 655 license);
637 add_taint(TAINT_PROPRIETARY_MODULE); 656 return 0;
638 } 657 }
658
639 return 1; 659 return 1;
640} 660}
641 661
@@ -805,7 +825,7 @@ static inline int __init activate_vmi(void)
805 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); 825 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack);
806 para_fill(set_iopl_mask, SetIOPLMask); 826 para_fill(set_iopl_mask, SetIOPLMask);
807 para_fill(io_delay, IODelay); 827 para_fill(io_delay, IODelay);
808 para_fill(set_lazy_mode, SetLazyMode); 828 para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode);
809 829
810 /* user and kernel flush are just handled with different flags to FlushTLB */ 830 /* user and kernel flush are just handled with different flags to FlushTLB */
811 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB); 831 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB);
diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
index d22cfc9d656c..086b3726862a 100644
--- a/arch/i386/lib/usercopy.c
+++ b/arch/i386/lib/usercopy.c
@@ -10,6 +10,7 @@
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/backing-dev.h> 12#include <linux/backing-dev.h>
13#include <linux/interrupt.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14#include <asm/mmx.h> 15#include <asm/mmx.h>
15 16
@@ -719,6 +720,14 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from,
719#ifndef CONFIG_X86_WP_WORKS_OK 720#ifndef CONFIG_X86_WP_WORKS_OK
720 if (unlikely(boot_cpu_data.wp_works_ok == 0) && 721 if (unlikely(boot_cpu_data.wp_works_ok == 0) &&
721 ((unsigned long )to) < TASK_SIZE) { 722 ((unsigned long )to) < TASK_SIZE) {
723 /*
724 * When we are in an atomic section (see
725 * mm/filemap.c:file_read_actor), return the full
726 * length to take the slow path.
727 */
728 if (in_atomic())
729 return n;
730
722 /* 731 /*
723 * CPU does not honor the WP bit when writing 732 * CPU does not honor the WP bit when writing
724 * from supervisory mode, and due to preemption or SMP, 733 * from supervisory mode, and due to preemption or SMP,
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c
index bb2de1089add..ac70d09df7ee 100644
--- a/arch/i386/mm/highmem.c
+++ b/arch/i386/mm/highmem.c
@@ -42,6 +42,7 @@ void *kmap_atomic(struct page *page, enum km_type type)
42 42
43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
44 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 44 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
45 arch_flush_lazy_mmu_mode();
45 46
46 return (void*) vaddr; 47 return (void*) vaddr;
47} 48}
@@ -82,6 +83,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
82 idx = type + KM_TYPE_NR*smp_processor_id(); 83 idx = type + KM_TYPE_NR*smp_processor_id();
83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 84 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
84 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 85 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
86 arch_flush_lazy_mmu_mode();
85 87
86 return (void*) vaddr; 88 return (void*) vaddr;
87} 89}
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 1bb069372143..3f78d4d8ecf3 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -193,6 +193,14 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
193 }, 193 },
194 { 194 {
195 .callback = set_bf_sort, 195 .callback = set_bf_sort,
196 .ident = "Dell PowerEdge R900",
197 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
199 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
200 },
201 },
202 {
203 .callback = set_bf_sort,
196 .ident = "HP ProLiant BL20p G3", 204 .ident = "HP ProLiant BL20p G3",
197 .matches = { 205 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 206 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
@@ -426,11 +434,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
426 if ((err = pcibios_enable_resources(dev, mask)) < 0) 434 if ((err = pcibios_enable_resources(dev, mask)) < 0)
427 return err; 435 return err;
428 436
429 return pcibios_enable_irq(dev); 437 if (!dev->msi_enabled)
438 return pcibios_enable_irq(dev);
439 return 0;
430} 440}
431 441
432void pcibios_disable_device (struct pci_dev *dev) 442void pcibios_disable_device (struct pci_dev *dev)
433{ 443{
434 if (pcibios_disable_irq) 444 if (!dev->msi_enabled && pcibios_disable_irq)
435 pcibios_disable_irq(dev); 445 pcibios_disable_irq(dev);
436} 446}
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index d51f0f11f7f9..e19185d26554 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -13,6 +13,7 @@ config IA64
13 bool 13 bool
14 select PCI if (!IA64_HP_SIM) 14 select PCI if (!IA64_HP_SIM)
15 select ACPI if (!IA64_HP_SIM) 15 select ACPI if (!IA64_HP_SIM)
16 select PM if (!IA64_HP_SIM)
16 default y 17 default y
17 help 18 help
18 The Itanium Processor Family is Intel's 64-bit successor to 19 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 9d1cffb57cde..a1446931b401 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -1,8 +1,9 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc5 3# Linux kernel version: 2.6.21-rc3
4# Mon Feb 27 15:49:18 2006 4# Thu Mar 8 11:07:09 2007
5# 5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
6 7
7# 8#
8# Code maturity level options 9# Code maturity level options
@@ -18,16 +19,24 @@ CONFIG_LOCALVERSION=""
18CONFIG_LOCALVERSION_AUTO=y 19CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
22# CONFIG_IPC_NS is not set
23CONFIG_SYSVIPC_SYSCTL=y
21CONFIG_POSIX_MQUEUE=y 24CONFIG_POSIX_MQUEUE=y
22# CONFIG_BSD_PROCESS_ACCT is not set 25# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y 26# CONFIG_TASKSTATS is not set
27# CONFIG_UTS_NS is not set
24# CONFIG_AUDIT is not set 28# CONFIG_AUDIT is not set
25CONFIG_IKCONFIG=y 29CONFIG_IKCONFIG=y
26CONFIG_IKCONFIG_PROC=y 30CONFIG_IKCONFIG_PROC=y
27# CONFIG_CPUSETS is not set 31# CONFIG_CPUSETS is not set
32CONFIG_SYSFS_DEPRECATED=y
33# CONFIG_RELAY is not set
34CONFIG_BLK_DEV_INITRD=y
28CONFIG_INITRAMFS_SOURCE="" 35CONFIG_INITRAMFS_SOURCE=""
29CONFIG_CC_OPTIMIZE_FOR_SIZE=y 36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
37CONFIG_SYSCTL=y
30# CONFIG_EMBEDDED is not set 38# CONFIG_EMBEDDED is not set
39CONFIG_SYSCTL_SYSCALL=y
31CONFIG_KALLSYMS=y 40CONFIG_KALLSYMS=y
32CONFIG_KALLSYMS_ALL=y 41CONFIG_KALLSYMS_ALL=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set 42# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -39,11 +48,9 @@ CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 48CONFIG_FUTEX=y
40CONFIG_EPOLL=y 49CONFIG_EPOLL=y
41CONFIG_SHMEM=y 50CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 51CONFIG_SLAB=y
52CONFIG_VM_EVENT_COUNTERS=y
53CONFIG_RT_MUTEXES=y
47# CONFIG_TINY_SHMEM is not set 54# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 55CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 56# CONFIG_SLOB is not set
@@ -54,7 +61,6 @@ CONFIG_BASE_SMALL=0
54CONFIG_MODULES=y 61CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y 62CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set 63# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58CONFIG_MODVERSIONS=y 64CONFIG_MODVERSIONS=y
59CONFIG_MODULE_SRCVERSION_ALL=y 65CONFIG_MODULE_SRCVERSION_ALL=y
60CONFIG_KMOD=y 66CONFIG_KMOD=y
@@ -63,6 +69,8 @@ CONFIG_STOP_MACHINE=y
63# 69#
64# Block layer 70# Block layer
65# 71#
72CONFIG_BLOCK=y
73# CONFIG_BLK_DEV_IO_TRACE is not set
66 74
67# 75#
68# IO Schedulers 76# IO Schedulers
@@ -82,15 +90,20 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
82# 90#
83CONFIG_IA64=y 91CONFIG_IA64=y
84CONFIG_64BIT=y 92CONFIG_64BIT=y
93CONFIG_ZONE_DMA=y
85CONFIG_MMU=y 94CONFIG_MMU=y
86CONFIG_SWIOTLB=y 95CONFIG_SWIOTLB=y
87CONFIG_RWSEM_XCHGADD_ALGORITHM=y 96CONFIG_RWSEM_XCHGADD_ALGORITHM=y
97# CONFIG_ARCH_HAS_ILOG2_U32 is not set
98# CONFIG_ARCH_HAS_ILOG2_U64 is not set
99CONFIG_GENERIC_FIND_NEXT_BIT=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y 100CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_TIME_INTERPOLATION=y 101CONFIG_TIME_INTERPOLATION=y
102CONFIG_DMI=y
90CONFIG_EFI=y 103CONFIG_EFI=y
91CONFIG_GENERIC_IOMAP=y 104CONFIG_GENERIC_IOMAP=y
92CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 105CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
93CONFIG_DMA_IS_DMA32=y 106CONFIG_AUDIT_ARCH=y
94# CONFIG_IA64_GENERIC is not set 107# CONFIG_IA64_GENERIC is not set
95CONFIG_IA64_DIG=y 108CONFIG_IA64_DIG=y
96# CONFIG_IA64_HP_ZX1 is not set 109# CONFIG_IA64_HP_ZX1 is not set
@@ -107,6 +120,7 @@ CONFIG_PGTABLE_3=y
107# CONFIG_PGTABLE_4 is not set 120# CONFIG_PGTABLE_4 is not set
108# CONFIG_HZ_100 is not set 121# CONFIG_HZ_100 is not set
109CONFIG_HZ_250=y 122CONFIG_HZ_250=y
123# CONFIG_HZ_300 is not set
110# CONFIG_HZ_1000 is not set 124# CONFIG_HZ_1000 is not set
111CONFIG_HZ=250 125CONFIG_HZ=250
112CONFIG_IA64_L1_CACHE_SHIFT=7 126CONFIG_IA64_L1_CACHE_SHIFT=7
@@ -116,9 +130,10 @@ CONFIG_FORCE_MAX_ZONEORDER=17
116CONFIG_SMP=y 130CONFIG_SMP=y
117CONFIG_NR_CPUS=16 131CONFIG_NR_CPUS=16
118CONFIG_HOTPLUG_CPU=y 132CONFIG_HOTPLUG_CPU=y
133CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
134# CONFIG_SCHED_SMT is not set
119CONFIG_PERMIT_BSP_REMOVE=y 135CONFIG_PERMIT_BSP_REMOVE=y
120CONFIG_FORCE_CPEI_RETARGET=y 136CONFIG_FORCE_CPEI_RETARGET=y
121# CONFIG_SCHED_SMT is not set
122# CONFIG_PREEMPT is not set 137# CONFIG_PREEMPT is not set
123CONFIG_SELECT_MEMORY_MODEL=y 138CONFIG_SELECT_MEMORY_MODEL=y
124CONFIG_FLATMEM_MANUAL=y 139CONFIG_FLATMEM_MANUAL=y
@@ -128,10 +143,13 @@ CONFIG_FLATMEM=y
128CONFIG_FLAT_NODE_MEM_MAP=y 143CONFIG_FLAT_NODE_MEM_MAP=y
129# CONFIG_SPARSEMEM_STATIC is not set 144# CONFIG_SPARSEMEM_STATIC is not set
130CONFIG_SPLIT_PTLOCK_CPUS=4 145CONFIG_SPLIT_PTLOCK_CPUS=4
146CONFIG_RESOURCES_64BIT=y
147CONFIG_ZONE_DMA_FLAG=1
131CONFIG_ARCH_SELECT_MEMORY_MODEL=y 148CONFIG_ARCH_SELECT_MEMORY_MODEL=y
132CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 149CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
133CONFIG_ARCH_FLATMEM_ENABLE=y 150CONFIG_ARCH_FLATMEM_ENABLE=y
134CONFIG_ARCH_SPARSEMEM_ENABLE=y 151CONFIG_ARCH_SPARSEMEM_ENABLE=y
152CONFIG_ARCH_POPULATES_NODE_MAP=y
135CONFIG_VIRTUAL_MEM_MAP=y 153CONFIG_VIRTUAL_MEM_MAP=y
136CONFIG_HOLES_IN_ZONE=y 154CONFIG_HOLES_IN_ZONE=y
137CONFIG_IA32_SUPPORT=y 155CONFIG_IA32_SUPPORT=y
@@ -139,6 +157,9 @@ CONFIG_COMPAT=y
139CONFIG_IA64_MCA_RECOVERY=y 157CONFIG_IA64_MCA_RECOVERY=y
140CONFIG_PERFMON=y 158CONFIG_PERFMON=y
141CONFIG_IA64_PALINFO=y 159CONFIG_IA64_PALINFO=y
160# CONFIG_IA64_ESI is not set
161CONFIG_KEXEC=y
162# CONFIG_CRASH_DUMP is not set
142 163
143# 164#
144# Firmware Drivers 165# Firmware Drivers
@@ -154,13 +175,16 @@ CONFIG_BINFMT_MISC=m
154CONFIG_PM=y 175CONFIG_PM=y
155CONFIG_PM_LEGACY=y 176CONFIG_PM_LEGACY=y
156# CONFIG_PM_DEBUG is not set 177# CONFIG_PM_DEBUG is not set
178# CONFIG_PM_SYSFS_DEPRECATED is not set
157 179
158# 180#
159# ACPI (Advanced Configuration and Power Interface) Support 181# ACPI (Advanced Configuration and Power Interface) Support
160# 182#
161CONFIG_ACPI=y 183CONFIG_ACPI=y
184CONFIG_ACPI_PROCFS=y
162CONFIG_ACPI_BUTTON=m 185CONFIG_ACPI_BUTTON=m
163CONFIG_ACPI_FAN=m 186CONFIG_ACPI_FAN=m
187# CONFIG_ACPI_DOCK is not set
164CONFIG_ACPI_PROCESSOR=m 188CONFIG_ACPI_PROCESSOR=m
165CONFIG_ACPI_HOTPLUG_CPU=y 189CONFIG_ACPI_HOTPLUG_CPU=y
166CONFIG_ACPI_THERMAL=m 190CONFIG_ACPI_THERMAL=m
@@ -181,8 +205,8 @@ CONFIG_ACPI_CONTAINER=m
181# 205#
182CONFIG_PCI=y 206CONFIG_PCI=y
183CONFIG_PCI_DOMAINS=y 207CONFIG_PCI_DOMAINS=y
208# CONFIG_PCIEPORTBUS is not set
184# CONFIG_PCI_MSI is not set 209# CONFIG_PCI_MSI is not set
185CONFIG_PCI_LEGACY_PROC=y
186# CONFIG_PCI_DEBUG is not set 210# CONFIG_PCI_DEBUG is not set
187 211
188# 212#
@@ -212,6 +236,10 @@ CONFIG_NET=y
212CONFIG_PACKET=y 236CONFIG_PACKET=y
213# CONFIG_PACKET_MMAP is not set 237# CONFIG_PACKET_MMAP is not set
214CONFIG_UNIX=y 238CONFIG_UNIX=y
239CONFIG_XFRM=y
240# CONFIG_XFRM_USER is not set
241# CONFIG_XFRM_SUB_POLICY is not set
242# CONFIG_XFRM_MIGRATE is not set
215# CONFIG_NET_KEY is not set 243# CONFIG_NET_KEY is not set
216CONFIG_INET=y 244CONFIG_INET=y
217CONFIG_IP_MULTICAST=y 245CONFIG_IP_MULTICAST=y
@@ -226,12 +254,21 @@ CONFIG_SYN_COOKIES=y
226# CONFIG_INET_AH is not set 254# CONFIG_INET_AH is not set
227# CONFIG_INET_ESP is not set 255# CONFIG_INET_ESP is not set
228# CONFIG_INET_IPCOMP is not set 256# CONFIG_INET_IPCOMP is not set
257# CONFIG_INET_XFRM_TUNNEL is not set
229# CONFIG_INET_TUNNEL is not set 258# CONFIG_INET_TUNNEL is not set
259CONFIG_INET_XFRM_MODE_TRANSPORT=y
260CONFIG_INET_XFRM_MODE_TUNNEL=y
261CONFIG_INET_XFRM_MODE_BEET=y
230CONFIG_INET_DIAG=y 262CONFIG_INET_DIAG=y
231CONFIG_INET_TCP_DIAG=y 263CONFIG_INET_TCP_DIAG=y
232# CONFIG_TCP_CONG_ADVANCED is not set 264# CONFIG_TCP_CONG_ADVANCED is not set
233CONFIG_TCP_CONG_BIC=y 265CONFIG_TCP_CONG_CUBIC=y
266CONFIG_DEFAULT_TCP_CONG="cubic"
267# CONFIG_TCP_MD5SIG is not set
234# CONFIG_IPV6 is not set 268# CONFIG_IPV6 is not set
269# CONFIG_INET6_XFRM_TUNNEL is not set
270# CONFIG_INET6_TUNNEL is not set
271# CONFIG_NETWORK_SECMARK is not set
235# CONFIG_NETFILTER is not set 272# CONFIG_NETFILTER is not set
236 273
237# 274#
@@ -257,7 +294,6 @@ CONFIG_TCP_CONG_BIC=y
257# CONFIG_ATALK is not set 294# CONFIG_ATALK is not set
258# CONFIG_X25 is not set 295# CONFIG_X25 is not set
259# CONFIG_LAPB is not set 296# CONFIG_LAPB is not set
260# CONFIG_NET_DIVERT is not set
261# CONFIG_ECONET is not set 297# CONFIG_ECONET is not set
262# CONFIG_WAN_ROUTER is not set 298# CONFIG_WAN_ROUTER is not set
263 299
@@ -286,6 +322,8 @@ CONFIG_STANDALONE=y
286CONFIG_PREVENT_FIRMWARE_BUILD=y 322CONFIG_PREVENT_FIRMWARE_BUILD=y
287CONFIG_FW_LOADER=m 323CONFIG_FW_LOADER=m
288# CONFIG_DEBUG_DRIVER is not set 324# CONFIG_DEBUG_DRIVER is not set
325# CONFIG_DEBUG_DEVRES is not set
326# CONFIG_SYS_HYPERVISOR is not set
289 327
290# 328#
291# Connector - unified userspace <-> kernelspace linker 329# Connector - unified userspace <-> kernelspace linker
@@ -329,11 +367,17 @@ CONFIG_BLK_DEV_NBD=m
329CONFIG_BLK_DEV_RAM=y 367CONFIG_BLK_DEV_RAM=y
330CONFIG_BLK_DEV_RAM_COUNT=16 368CONFIG_BLK_DEV_RAM_COUNT=16
331CONFIG_BLK_DEV_RAM_SIZE=4096 369CONFIG_BLK_DEV_RAM_SIZE=4096
332CONFIG_BLK_DEV_INITRD=y 370CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
333# CONFIG_CDROM_PKTCDVD is not set 371# CONFIG_CDROM_PKTCDVD is not set
334# CONFIG_ATA_OVER_ETH is not set 372# CONFIG_ATA_OVER_ETH is not set
335 373
336# 374#
375# Misc devices
376#
377# CONFIG_SGI_IOC4 is not set
378# CONFIG_TIFM_CORE is not set
379
380#
337# ATA/ATAPI/MFM/RLL support 381# ATA/ATAPI/MFM/RLL support
338# 382#
339CONFIG_IDE=y 383CONFIG_IDE=y
@@ -350,6 +394,7 @@ CONFIG_BLK_DEV_IDECD=y
350# CONFIG_BLK_DEV_IDETAPE is not set 394# CONFIG_BLK_DEV_IDETAPE is not set
351CONFIG_BLK_DEV_IDEFLOPPY=y 395CONFIG_BLK_DEV_IDEFLOPPY=y
352CONFIG_BLK_DEV_IDESCSI=m 396CONFIG_BLK_DEV_IDESCSI=m
397# CONFIG_BLK_DEV_IDEACPI is not set
353# CONFIG_IDE_TASK_IOCTL is not set 398# CONFIG_IDE_TASK_IOCTL is not set
354 399
355# 400#
@@ -376,8 +421,10 @@ CONFIG_BLK_DEV_CMD64X=y
376# CONFIG_BLK_DEV_CS5530 is not set 421# CONFIG_BLK_DEV_CS5530 is not set
377# CONFIG_BLK_DEV_HPT34X is not set 422# CONFIG_BLK_DEV_HPT34X is not set
378# CONFIG_BLK_DEV_HPT366 is not set 423# CONFIG_BLK_DEV_HPT366 is not set
424# CONFIG_BLK_DEV_JMICRON is not set
379# CONFIG_BLK_DEV_SC1200 is not set 425# CONFIG_BLK_DEV_SC1200 is not set
380CONFIG_BLK_DEV_PIIX=y 426CONFIG_BLK_DEV_PIIX=y
427# CONFIG_BLK_DEV_IT8213 is not set
381# CONFIG_BLK_DEV_IT821X is not set 428# CONFIG_BLK_DEV_IT821X is not set
382# CONFIG_BLK_DEV_NS87415 is not set 429# CONFIG_BLK_DEV_NS87415 is not set
383# CONFIG_BLK_DEV_PDC202XX_OLD is not set 430# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -387,6 +434,7 @@ CONFIG_BLK_DEV_PIIX=y
387# CONFIG_BLK_DEV_SLC90E66 is not set 434# CONFIG_BLK_DEV_SLC90E66 is not set
388# CONFIG_BLK_DEV_TRM290 is not set 435# CONFIG_BLK_DEV_TRM290 is not set
389# CONFIG_BLK_DEV_VIA82CXXX is not set 436# CONFIG_BLK_DEV_VIA82CXXX is not set
437# CONFIG_BLK_DEV_TC86C001 is not set
390# CONFIG_IDE_ARM is not set 438# CONFIG_IDE_ARM is not set
391CONFIG_BLK_DEV_IDEDMA=y 439CONFIG_BLK_DEV_IDEDMA=y
392# CONFIG_IDEDMA_IVB is not set 440# CONFIG_IDEDMA_IVB is not set
@@ -398,6 +446,8 @@ CONFIG_IDEDMA_AUTO=y
398# 446#
399# CONFIG_RAID_ATTRS is not set 447# CONFIG_RAID_ATTRS is not set
400CONFIG_SCSI=y 448CONFIG_SCSI=y
449# CONFIG_SCSI_TGT is not set
450CONFIG_SCSI_NETLINK=y
401CONFIG_SCSI_PROC_FS=y 451CONFIG_SCSI_PROC_FS=y
402 452
403# 453#
@@ -417,14 +467,16 @@ CONFIG_CHR_DEV_SG=m
417# CONFIG_SCSI_MULTI_LUN is not set 467# CONFIG_SCSI_MULTI_LUN is not set
418# CONFIG_SCSI_CONSTANTS is not set 468# CONFIG_SCSI_CONSTANTS is not set
419# CONFIG_SCSI_LOGGING is not set 469# CONFIG_SCSI_LOGGING is not set
470# CONFIG_SCSI_SCAN_ASYNC is not set
420 471
421# 472#
422# SCSI Transport Attributes 473# SCSI Transports
423# 474#
424CONFIG_SCSI_SPI_ATTRS=y 475CONFIG_SCSI_SPI_ATTRS=y
425CONFIG_SCSI_FC_ATTRS=y 476CONFIG_SCSI_FC_ATTRS=y
426# CONFIG_SCSI_ISCSI_ATTRS is not set 477# CONFIG_SCSI_ISCSI_ATTRS is not set
427# CONFIG_SCSI_SAS_ATTRS is not set 478# CONFIG_SCSI_SAS_ATTRS is not set
479# CONFIG_SCSI_SAS_LIBSAS is not set
428 480
429# 481#
430# SCSI low-level drivers 482# SCSI low-level drivers
@@ -437,29 +489,36 @@ CONFIG_SCSI_FC_ATTRS=y
437# CONFIG_SCSI_AIC7XXX is not set 489# CONFIG_SCSI_AIC7XXX is not set
438# CONFIG_SCSI_AIC7XXX_OLD is not set 490# CONFIG_SCSI_AIC7XXX_OLD is not set
439# CONFIG_SCSI_AIC79XX is not set 491# CONFIG_SCSI_AIC79XX is not set
492# CONFIG_SCSI_AIC94XX is not set
493# CONFIG_SCSI_ARCMSR is not set
440# CONFIG_MEGARAID_NEWGEN is not set 494# CONFIG_MEGARAID_NEWGEN is not set
441# CONFIG_MEGARAID_LEGACY is not set 495# CONFIG_MEGARAID_LEGACY is not set
442# CONFIG_MEGARAID_SAS is not set 496# CONFIG_MEGARAID_SAS is not set
443# CONFIG_SCSI_SATA is not set 497# CONFIG_SCSI_HPTIOP is not set
444# CONFIG_SCSI_DMX3191D is not set 498# CONFIG_SCSI_DMX3191D is not set
445# CONFIG_SCSI_FUTURE_DOMAIN is not set 499# CONFIG_SCSI_FUTURE_DOMAIN is not set
446# CONFIG_SCSI_IPS is not set 500# CONFIG_SCSI_IPS is not set
447# CONFIG_SCSI_INITIO is not set 501# CONFIG_SCSI_INITIO is not set
448# CONFIG_SCSI_INIA100 is not set 502# CONFIG_SCSI_INIA100 is not set
503# CONFIG_SCSI_STEX is not set
449CONFIG_SCSI_SYM53C8XX_2=y 504CONFIG_SCSI_SYM53C8XX_2=y
450CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 505CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
451CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 506CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
452CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 507CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
453# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 508CONFIG_SCSI_SYM53C8XX_MMIO=y
454# CONFIG_SCSI_IPR is not set
455CONFIG_SCSI_QLOGIC_FC=y
456# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
457CONFIG_SCSI_QLOGIC_1280=y 509CONFIG_SCSI_QLOGIC_1280=y
458# CONFIG_SCSI_QLA_FC is not set 510# CONFIG_SCSI_QLA_FC is not set
511# CONFIG_SCSI_QLA_ISCSI is not set
459# CONFIG_SCSI_LPFC is not set 512# CONFIG_SCSI_LPFC is not set
460# CONFIG_SCSI_DC395x is not set 513# CONFIG_SCSI_DC395x is not set
461# CONFIG_SCSI_DC390T is not set 514# CONFIG_SCSI_DC390T is not set
462# CONFIG_SCSI_DEBUG is not set 515# CONFIG_SCSI_DEBUG is not set
516# CONFIG_SCSI_SRP is not set
517
518#
519# Serial ATA (prod) and Parallel ATA (experimental) drivers
520#
521# CONFIG_ATA is not set
463 522
464# 523#
465# Multi-device support (RAID and LVM) 524# Multi-device support (RAID and LVM)
@@ -470,11 +529,11 @@ CONFIG_MD_LINEAR=m
470CONFIG_MD_RAID0=m 529CONFIG_MD_RAID0=m
471CONFIG_MD_RAID1=m 530CONFIG_MD_RAID1=m
472# CONFIG_MD_RAID10 is not set 531# CONFIG_MD_RAID10 is not set
473CONFIG_MD_RAID5=m 532# CONFIG_MD_RAID456 is not set
474CONFIG_MD_RAID6=m
475CONFIG_MD_MULTIPATH=m 533CONFIG_MD_MULTIPATH=m
476# CONFIG_MD_FAULTY is not set 534# CONFIG_MD_FAULTY is not set
477CONFIG_BLK_DEV_DM=m 535CONFIG_BLK_DEV_DM=m
536# CONFIG_DM_DEBUG is not set
478CONFIG_DM_CRYPT=m 537CONFIG_DM_CRYPT=m
479CONFIG_DM_SNAPSHOT=m 538CONFIG_DM_SNAPSHOT=m
480CONFIG_DM_MIRROR=m 539CONFIG_DM_MIRROR=m
@@ -563,6 +622,7 @@ CONFIG_E100=m
563# CONFIG_EPIC100 is not set 622# CONFIG_EPIC100 is not set
564# CONFIG_SUNDANCE is not set 623# CONFIG_SUNDANCE is not set
565# CONFIG_VIA_RHINE is not set 624# CONFIG_VIA_RHINE is not set
625# CONFIG_SC92031 is not set
566 626
567# 627#
568# Ethernet (1000 Mbit) 628# Ethernet (1000 Mbit)
@@ -583,13 +643,18 @@ CONFIG_E1000=y
583# CONFIG_VIA_VELOCITY is not set 643# CONFIG_VIA_VELOCITY is not set
584CONFIG_TIGON3=y 644CONFIG_TIGON3=y
585# CONFIG_BNX2 is not set 645# CONFIG_BNX2 is not set
646# CONFIG_QLA3XXX is not set
647# CONFIG_ATL1 is not set
586 648
587# 649#
588# Ethernet (10000 Mbit) 650# Ethernet (10000 Mbit)
589# 651#
590# CONFIG_CHELSIO_T1 is not set 652# CONFIG_CHELSIO_T1 is not set
653# CONFIG_CHELSIO_T3 is not set
591# CONFIG_IXGB is not set 654# CONFIG_IXGB is not set
592# CONFIG_S2IO is not set 655# CONFIG_S2IO is not set
656# CONFIG_MYRI10GE is not set
657# CONFIG_NETXEN_NIC is not set
593 658
594# 659#
595# Token Ring devices 660# Token Ring devices
@@ -631,6 +696,7 @@ CONFIG_NET_POLL_CONTROLLER=y
631# Input device support 696# Input device support
632# 697#
633CONFIG_INPUT=y 698CONFIG_INPUT=y
699# CONFIG_INPUT_FF_MEMLESS is not set
634 700
635# 701#
636# Userland interfaces 702# Userland interfaces
@@ -653,6 +719,7 @@ CONFIG_KEYBOARD_ATKBD=y
653# CONFIG_KEYBOARD_LKKBD is not set 719# CONFIG_KEYBOARD_LKKBD is not set
654# CONFIG_KEYBOARD_XTKBD is not set 720# CONFIG_KEYBOARD_XTKBD is not set
655# CONFIG_KEYBOARD_NEWTON is not set 721# CONFIG_KEYBOARD_NEWTON is not set
722# CONFIG_KEYBOARD_STOWAWAY is not set
656CONFIG_INPUT_MOUSE=y 723CONFIG_INPUT_MOUSE=y
657CONFIG_MOUSE_PS2=y 724CONFIG_MOUSE_PS2=y
658# CONFIG_MOUSE_SERIAL is not set 725# CONFIG_MOUSE_SERIAL is not set
@@ -682,6 +749,7 @@ CONFIG_GAMEPORT=m
682CONFIG_VT=y 749CONFIG_VT=y
683CONFIG_VT_CONSOLE=y 750CONFIG_VT_CONSOLE=y
684CONFIG_HW_CONSOLE=y 751CONFIG_HW_CONSOLE=y
752# CONFIG_VT_HW_CONSOLE_BINDING is not set
685CONFIG_SERIAL_NONSTANDARD=y 753CONFIG_SERIAL_NONSTANDARD=y
686# CONFIG_COMPUTONE is not set 754# CONFIG_COMPUTONE is not set
687# CONFIG_ROCKETPORT is not set 755# CONFIG_ROCKETPORT is not set
@@ -689,12 +757,14 @@ CONFIG_SERIAL_NONSTANDARD=y
689# CONFIG_DIGIEPCA is not set 757# CONFIG_DIGIEPCA is not set
690# CONFIG_MOXA_INTELLIO is not set 758# CONFIG_MOXA_INTELLIO is not set
691# CONFIG_MOXA_SMARTIO is not set 759# CONFIG_MOXA_SMARTIO is not set
760# CONFIG_MOXA_SMARTIO_NEW is not set
692# CONFIG_ISI is not set 761# CONFIG_ISI is not set
693# CONFIG_SYNCLINKMP is not set 762# CONFIG_SYNCLINKMP is not set
694# CONFIG_SYNCLINK_GT is not set 763# CONFIG_SYNCLINK_GT is not set
695# CONFIG_N_HDLC is not set 764# CONFIG_N_HDLC is not set
696# CONFIG_SPECIALIX is not set 765# CONFIG_SPECIALIX is not set
697# CONFIG_SX is not set 766# CONFIG_SX is not set
767# CONFIG_RIO is not set
698# CONFIG_STALDRV is not set 768# CONFIG_STALDRV is not set
699 769
700# 770#
@@ -702,7 +772,8 @@ CONFIG_SERIAL_NONSTANDARD=y
702# 772#
703CONFIG_SERIAL_8250=y 773CONFIG_SERIAL_8250=y
704CONFIG_SERIAL_8250_CONSOLE=y 774CONFIG_SERIAL_8250_CONSOLE=y
705CONFIG_SERIAL_8250_ACPI=y 775CONFIG_SERIAL_8250_PCI=y
776CONFIG_SERIAL_8250_PNP=y
706CONFIG_SERIAL_8250_NR_UARTS=6 777CONFIG_SERIAL_8250_NR_UARTS=6
707CONFIG_SERIAL_8250_RUNTIME_UARTS=4 778CONFIG_SERIAL_8250_RUNTIME_UARTS=4
708CONFIG_SERIAL_8250_EXTENDED=y 779CONFIG_SERIAL_8250_EXTENDED=y
@@ -734,10 +805,6 @@ CONFIG_EFI_RTC=y
734# CONFIG_DTLK is not set 805# CONFIG_DTLK is not set
735# CONFIG_R3964 is not set 806# CONFIG_R3964 is not set
736# CONFIG_APPLICOM is not set 807# CONFIG_APPLICOM is not set
737
738#
739# Ftape, the floppy tape device driver
740#
741CONFIG_AGP=m 808CONFIG_AGP=m
742CONFIG_AGP_I460=m 809CONFIG_AGP_I460=m
743CONFIG_DRM=m 810CONFIG_DRM=m
@@ -759,7 +826,6 @@ CONFIG_HPET_MMAP=y
759# TPM devices 826# TPM devices
760# 827#
761# CONFIG_TCG_TPM is not set 828# CONFIG_TCG_TPM is not set
762# CONFIG_TELCLOCK is not set
763 829
764# 830#
765# I2C support 831# I2C support
@@ -782,16 +848,16 @@ CONFIG_HPET_MMAP=y
782# 848#
783CONFIG_HWMON=y 849CONFIG_HWMON=y
784# CONFIG_HWMON_VID is not set 850# CONFIG_HWMON_VID is not set
851# CONFIG_SENSORS_ABITUGURU is not set
785# CONFIG_SENSORS_F71805F is not set 852# CONFIG_SENSORS_F71805F is not set
853# CONFIG_SENSORS_PC87427 is not set
854# CONFIG_SENSORS_VT1211 is not set
786# CONFIG_HWMON_DEBUG_CHIP is not set 855# CONFIG_HWMON_DEBUG_CHIP is not set
787 856
788# 857#
789# Misc devices 858# Multifunction device drivers
790#
791
792#
793# Multimedia Capabilities Port drivers
794# 859#
860# CONFIG_MFD_SM501 is not set
795 861
796# 862#
797# Multimedia devices 863# Multimedia devices
@@ -802,16 +868,19 @@ CONFIG_HWMON=y
802# Digital Video Broadcasting Devices 868# Digital Video Broadcasting Devices
803# 869#
804# CONFIG_DVB is not set 870# CONFIG_DVB is not set
871# CONFIG_USB_DABUSB is not set
805 872
806# 873#
807# Graphics support 874# Graphics support
808# 875#
876# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
809# CONFIG_FB is not set 877# CONFIG_FB is not set
810 878
811# 879#
812# Console display driver support 880# Console display driver support
813# 881#
814CONFIG_VGA_CONSOLE=y 882CONFIG_VGA_CONSOLE=y
883# CONFIG_VGACON_SOFT_SCROLLBACK is not set
815CONFIG_DUMMY_CONSOLE=y 884CONFIG_DUMMY_CONSOLE=y
816 885
817# 886#
@@ -820,10 +889,17 @@ CONFIG_DUMMY_CONSOLE=y
820# CONFIG_SOUND is not set 889# CONFIG_SOUND is not set
821 890
822# 891#
892# HID Devices
893#
894CONFIG_HID=y
895# CONFIG_HID_DEBUG is not set
896
897#
823# USB support 898# USB support
824# 899#
825CONFIG_USB_ARCH_HAS_HCD=y 900CONFIG_USB_ARCH_HAS_HCD=y
826CONFIG_USB_ARCH_HAS_OHCI=y 901CONFIG_USB_ARCH_HAS_OHCI=y
902CONFIG_USB_ARCH_HAS_EHCI=y
827CONFIG_USB=y 903CONFIG_USB=y
828# CONFIG_USB_DEBUG is not set 904# CONFIG_USB_DEBUG is not set
829 905
@@ -831,7 +907,6 @@ CONFIG_USB=y
831# Miscellaneous USB options 907# Miscellaneous USB options
832# 908#
833CONFIG_USB_DEVICEFS=y 909CONFIG_USB_DEVICEFS=y
834# CONFIG_USB_BANDWIDTH is not set
835# CONFIG_USB_DYNAMIC_MINORS is not set 910# CONFIG_USB_DYNAMIC_MINORS is not set
836# CONFIG_USB_SUSPEND is not set 911# CONFIG_USB_SUSPEND is not set
837# CONFIG_USB_OTG is not set 912# CONFIG_USB_OTG is not set
@@ -842,9 +917,12 @@ CONFIG_USB_DEVICEFS=y
842CONFIG_USB_EHCI_HCD=m 917CONFIG_USB_EHCI_HCD=m
843# CONFIG_USB_EHCI_SPLIT_ISO is not set 918# CONFIG_USB_EHCI_SPLIT_ISO is not set
844# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 919# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
920# CONFIG_USB_EHCI_TT_NEWSCHED is not set
921# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
845# CONFIG_USB_ISP116X_HCD is not set 922# CONFIG_USB_ISP116X_HCD is not set
846CONFIG_USB_OHCI_HCD=m 923CONFIG_USB_OHCI_HCD=m
847# CONFIG_USB_OHCI_BIG_ENDIAN is not set 924# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
925# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
848CONFIG_USB_OHCI_LITTLE_ENDIAN=y 926CONFIG_USB_OHCI_LITTLE_ENDIAN=y
849CONFIG_USB_UHCI_HCD=y 927CONFIG_USB_UHCI_HCD=y
850# CONFIG_USB_SL811_HCD is not set 928# CONFIG_USB_SL811_HCD is not set
@@ -873,13 +951,13 @@ CONFIG_USB_STORAGE=m
873# CONFIG_USB_STORAGE_SDDR55 is not set 951# CONFIG_USB_STORAGE_SDDR55 is not set
874# CONFIG_USB_STORAGE_JUMPSHOT is not set 952# CONFIG_USB_STORAGE_JUMPSHOT is not set
875# CONFIG_USB_STORAGE_ALAUDA is not set 953# CONFIG_USB_STORAGE_ALAUDA is not set
954# CONFIG_USB_STORAGE_KARMA is not set
876# CONFIG_USB_LIBUSUAL is not set 955# CONFIG_USB_LIBUSUAL is not set
877 956
878# 957#
879# USB Input Devices 958# USB Input Devices
880# 959#
881CONFIG_USB_HID=y 960CONFIG_USB_HID=y
882CONFIG_USB_HIDINPUT=y
883# CONFIG_USB_HIDINPUT_POWERBOOK is not set 961# CONFIG_USB_HIDINPUT_POWERBOOK is not set
884# CONFIG_HID_FF is not set 962# CONFIG_HID_FF is not set
885# CONFIG_USB_HIDDEV is not set 963# CONFIG_USB_HIDDEV is not set
@@ -888,15 +966,14 @@ CONFIG_USB_HIDINPUT=y
888# CONFIG_USB_ACECAD is not set 966# CONFIG_USB_ACECAD is not set
889# CONFIG_USB_KBTAB is not set 967# CONFIG_USB_KBTAB is not set
890# CONFIG_USB_POWERMATE is not set 968# CONFIG_USB_POWERMATE is not set
891# CONFIG_USB_MTOUCH is not set 969# CONFIG_USB_TOUCHSCREEN is not set
892# CONFIG_USB_ITMTOUCH is not set
893# CONFIG_USB_EGALAX is not set
894# CONFIG_USB_YEALINK is not set 970# CONFIG_USB_YEALINK is not set
895# CONFIG_USB_XPAD is not set 971# CONFIG_USB_XPAD is not set
896# CONFIG_USB_ATI_REMOTE is not set 972# CONFIG_USB_ATI_REMOTE is not set
897# CONFIG_USB_ATI_REMOTE2 is not set 973# CONFIG_USB_ATI_REMOTE2 is not set
898# CONFIG_USB_KEYSPAN_REMOTE is not set 974# CONFIG_USB_KEYSPAN_REMOTE is not set
899# CONFIG_USB_APPLETOUCH is not set 975# CONFIG_USB_APPLETOUCH is not set
976# CONFIG_USB_GTCO is not set
900 977
901# 978#
902# USB Imaging devices 979# USB Imaging devices
@@ -905,21 +982,13 @@ CONFIG_USB_HIDINPUT=y
905# CONFIG_USB_MICROTEK is not set 982# CONFIG_USB_MICROTEK is not set
906 983
907# 984#
908# USB Multimedia devices
909#
910# CONFIG_USB_DABUSB is not set
911
912#
913# Video4Linux support is needed for USB Multimedia device support
914#
915
916#
917# USB Network Adapters 985# USB Network Adapters
918# 986#
919# CONFIG_USB_CATC is not set 987# CONFIG_USB_CATC is not set
920# CONFIG_USB_KAWETH is not set 988# CONFIG_USB_KAWETH is not set
921# CONFIG_USB_PEGASUS is not set 989# CONFIG_USB_PEGASUS is not set
922# CONFIG_USB_RTL8150 is not set 990# CONFIG_USB_RTL8150 is not set
991# CONFIG_USB_USBNET_MII is not set
923# CONFIG_USB_USBNET is not set 992# CONFIG_USB_USBNET is not set
924# CONFIG_USB_MON is not set 993# CONFIG_USB_MON is not set
925 994
@@ -937,17 +1006,23 @@ CONFIG_USB_HIDINPUT=y
937# 1006#
938# CONFIG_USB_EMI62 is not set 1007# CONFIG_USB_EMI62 is not set
939# CONFIG_USB_EMI26 is not set 1008# CONFIG_USB_EMI26 is not set
1009# CONFIG_USB_ADUTUX is not set
940# CONFIG_USB_AUERSWALD is not set 1010# CONFIG_USB_AUERSWALD is not set
941# CONFIG_USB_RIO500 is not set 1011# CONFIG_USB_RIO500 is not set
942# CONFIG_USB_LEGOTOWER is not set 1012# CONFIG_USB_LEGOTOWER is not set
943# CONFIG_USB_LCD is not set 1013# CONFIG_USB_LCD is not set
1014# CONFIG_USB_BERRY_CHARGE is not set
944# CONFIG_USB_LED is not set 1015# CONFIG_USB_LED is not set
1016# CONFIG_USB_CYPRESS_CY7C63 is not set
945# CONFIG_USB_CYTHERM is not set 1017# CONFIG_USB_CYTHERM is not set
946# CONFIG_USB_PHIDGETKIT is not set 1018# CONFIG_USB_PHIDGET is not set
947# CONFIG_USB_PHIDGETSERVO is not set
948# CONFIG_USB_IDMOUSE is not set 1019# CONFIG_USB_IDMOUSE is not set
1020# CONFIG_USB_FTDI_ELAN is not set
1021# CONFIG_USB_APPLEDISPLAY is not set
949# CONFIG_USB_SISUSBVGA is not set 1022# CONFIG_USB_SISUSBVGA is not set
950# CONFIG_USB_LD is not set 1023# CONFIG_USB_LD is not set
1024# CONFIG_USB_TRANCEVIBRATOR is not set
1025# CONFIG_USB_IOWARRIOR is not set
951# CONFIG_USB_TEST is not set 1026# CONFIG_USB_TEST is not set
952 1027
953# 1028#
@@ -965,15 +1040,55 @@ CONFIG_USB_HIDINPUT=y
965# CONFIG_MMC is not set 1040# CONFIG_MMC is not set
966 1041
967# 1042#
1043# LED devices
1044#
1045# CONFIG_NEW_LEDS is not set
1046
1047#
1048# LED drivers
1049#
1050
1051#
1052# LED Triggers
1053#
1054
1055#
968# InfiniBand support 1056# InfiniBand support
969# 1057#
970# CONFIG_INFINIBAND is not set 1058# CONFIG_INFINIBAND is not set
971 1059
972# 1060#
973# EDAC - error detection and reporting (RAS) 1061# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1062#
1063
1064#
1065# Real Time Clock
1066#
1067# CONFIG_RTC_CLASS is not set
1068
1069#
1070# DMA Engine support
1071#
1072# CONFIG_DMA_ENGINE is not set
1073
1074#
1075# DMA Clients
974# 1076#
975 1077
976# 1078#
1079# DMA Devices
1080#
1081
1082#
1083# Auxiliary Display support
1084#
1085
1086#
1087# Virtualization
1088#
1089# CONFIG_MSPEC is not set
1090
1091#
977# File systems 1092# File systems
978# 1093#
979CONFIG_EXT2_FS=y 1094CONFIG_EXT2_FS=y
@@ -985,6 +1100,7 @@ CONFIG_EXT3_FS=y
985CONFIG_EXT3_FS_XATTR=y 1100CONFIG_EXT3_FS_XATTR=y
986CONFIG_EXT3_FS_POSIX_ACL=y 1101CONFIG_EXT3_FS_POSIX_ACL=y
987CONFIG_EXT3_FS_SECURITY=y 1102CONFIG_EXT3_FS_SECURITY=y
1103# CONFIG_EXT4DEV_FS is not set
988CONFIG_JBD=y 1104CONFIG_JBD=y
989# CONFIG_JBD_DEBUG is not set 1105# CONFIG_JBD_DEBUG is not set
990CONFIG_FS_MBCACHE=y 1106CONFIG_FS_MBCACHE=y
@@ -997,15 +1113,16 @@ CONFIG_REISERFS_FS_SECURITY=y
997# CONFIG_JFS_FS is not set 1113# CONFIG_JFS_FS is not set
998CONFIG_FS_POSIX_ACL=y 1114CONFIG_FS_POSIX_ACL=y
999CONFIG_XFS_FS=y 1115CONFIG_XFS_FS=y
1000CONFIG_XFS_EXPORT=y
1001# CONFIG_XFS_QUOTA is not set 1116# CONFIG_XFS_QUOTA is not set
1002# CONFIG_XFS_SECURITY is not set 1117# CONFIG_XFS_SECURITY is not set
1003# CONFIG_XFS_POSIX_ACL is not set 1118# CONFIG_XFS_POSIX_ACL is not set
1004# CONFIG_XFS_RT is not set 1119# CONFIG_XFS_RT is not set
1120# CONFIG_GFS2_FS is not set
1005# CONFIG_OCFS2_FS is not set 1121# CONFIG_OCFS2_FS is not set
1006# CONFIG_MINIX_FS is not set 1122# CONFIG_MINIX_FS is not set
1007# CONFIG_ROMFS_FS is not set 1123# CONFIG_ROMFS_FS is not set
1008CONFIG_INOTIFY=y 1124CONFIG_INOTIFY=y
1125CONFIG_INOTIFY_USER=y
1009# CONFIG_QUOTA is not set 1126# CONFIG_QUOTA is not set
1010CONFIG_DNOTIFY=y 1127CONFIG_DNOTIFY=y
1011CONFIG_AUTOFS_FS=y 1128CONFIG_AUTOFS_FS=y
@@ -1038,12 +1155,13 @@ CONFIG_NTFS_FS=m
1038# 1155#
1039CONFIG_PROC_FS=y 1156CONFIG_PROC_FS=y
1040CONFIG_PROC_KCORE=y 1157CONFIG_PROC_KCORE=y
1158CONFIG_PROC_SYSCTL=y
1041CONFIG_SYSFS=y 1159CONFIG_SYSFS=y
1042CONFIG_TMPFS=y 1160CONFIG_TMPFS=y
1161# CONFIG_TMPFS_POSIX_ACL is not set
1043CONFIG_HUGETLBFS=y 1162CONFIG_HUGETLBFS=y
1044CONFIG_HUGETLB_PAGE=y 1163CONFIG_HUGETLB_PAGE=y
1045CONFIG_RAMFS=y 1164CONFIG_RAMFS=y
1046# CONFIG_RELAYFS_FS is not set
1047# CONFIG_CONFIGFS_FS is not set 1165# CONFIG_CONFIGFS_FS is not set
1048 1166
1049# 1167#
@@ -1078,7 +1196,7 @@ CONFIG_NFSD_V4=y
1078CONFIG_NFSD_TCP=y 1196CONFIG_NFSD_TCP=y
1079CONFIG_LOCKD=m 1197CONFIG_LOCKD=m
1080CONFIG_LOCKD_V4=y 1198CONFIG_LOCKD_V4=y
1081CONFIG_EXPORTFS=y 1199CONFIG_EXPORTFS=m
1082CONFIG_NFS_COMMON=y 1200CONFIG_NFS_COMMON=y
1083CONFIG_SUNRPC=m 1201CONFIG_SUNRPC=m
1084CONFIG_SUNRPC_GSS=m 1202CONFIG_SUNRPC_GSS=m
@@ -1089,7 +1207,9 @@ CONFIG_SMB_NLS_DEFAULT=y
1089CONFIG_SMB_NLS_REMOTE="cp437" 1207CONFIG_SMB_NLS_REMOTE="cp437"
1090CONFIG_CIFS=m 1208CONFIG_CIFS=m
1091# CONFIG_CIFS_STATS is not set 1209# CONFIG_CIFS_STATS is not set
1210# CONFIG_CIFS_WEAK_PW_HASH is not set
1092# CONFIG_CIFS_XATTR is not set 1211# CONFIG_CIFS_XATTR is not set
1212# CONFIG_CIFS_DEBUG2 is not set
1093# CONFIG_CIFS_EXPERIMENTAL is not set 1213# CONFIG_CIFS_EXPERIMENTAL is not set
1094# CONFIG_NCP_FS is not set 1214# CONFIG_NCP_FS is not set
1095# CONFIG_CODA_FS is not set 1215# CONFIG_CODA_FS is not set
@@ -1162,15 +1282,25 @@ CONFIG_NLS_KOI8_U=m
1162CONFIG_NLS_UTF8=m 1282CONFIG_NLS_UTF8=m
1163 1283
1164# 1284#
1285# Distributed Lock Manager
1286#
1287# CONFIG_DLM is not set
1288
1289#
1165# Library routines 1290# Library routines
1166# 1291#
1292CONFIG_BITREVERSE=y
1167# CONFIG_CRC_CCITT is not set 1293# CONFIG_CRC_CCITT is not set
1168# CONFIG_CRC16 is not set 1294# CONFIG_CRC16 is not set
1169CONFIG_CRC32=y 1295CONFIG_CRC32=y
1170# CONFIG_LIBCRC32C is not set 1296# CONFIG_LIBCRC32C is not set
1297CONFIG_PLIST=y
1298CONFIG_HAS_IOMEM=y
1299CONFIG_HAS_IOPORT=y
1171CONFIG_GENERIC_HARDIRQS=y 1300CONFIG_GENERIC_HARDIRQS=y
1172CONFIG_GENERIC_IRQ_PROBE=y 1301CONFIG_GENERIC_IRQ_PROBE=y
1173CONFIG_GENERIC_PENDING_IRQ=y 1302CONFIG_GENERIC_PENDING_IRQ=y
1303CONFIG_IRQ_PER_CPU=y
1174 1304
1175# 1305#
1176# Instrumentation Support 1306# Instrumentation Support
@@ -1182,21 +1312,31 @@ CONFIG_GENERIC_PENDING_IRQ=y
1182# Kernel hacking 1312# Kernel hacking
1183# 1313#
1184# CONFIG_PRINTK_TIME is not set 1314# CONFIG_PRINTK_TIME is not set
1315CONFIG_ENABLE_MUST_CHECK=y
1185CONFIG_MAGIC_SYSRQ=y 1316CONFIG_MAGIC_SYSRQ=y
1317# CONFIG_UNUSED_SYMBOLS is not set
1318# CONFIG_DEBUG_FS is not set
1319# CONFIG_HEADERS_CHECK is not set
1186CONFIG_DEBUG_KERNEL=y 1320CONFIG_DEBUG_KERNEL=y
1321# CONFIG_DEBUG_SHIRQ is not set
1187CONFIG_LOG_BUF_SHIFT=20 1322CONFIG_LOG_BUF_SHIFT=20
1188CONFIG_DETECT_SOFTLOCKUP=y 1323CONFIG_DETECT_SOFTLOCKUP=y
1189# CONFIG_SCHEDSTATS is not set 1324# CONFIG_SCHEDSTATS is not set
1325# CONFIG_TIMER_STATS is not set
1190# CONFIG_DEBUG_SLAB is not set 1326# CONFIG_DEBUG_SLAB is not set
1191CONFIG_DEBUG_MUTEXES=y 1327# CONFIG_DEBUG_RT_MUTEXES is not set
1328# CONFIG_RT_MUTEX_TESTER is not set
1192# CONFIG_DEBUG_SPINLOCK is not set 1329# CONFIG_DEBUG_SPINLOCK is not set
1330CONFIG_DEBUG_MUTEXES=y
1193# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1331# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1332# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1194# CONFIG_DEBUG_KOBJECT is not set 1333# CONFIG_DEBUG_KOBJECT is not set
1195# CONFIG_DEBUG_INFO is not set 1334# CONFIG_DEBUG_INFO is not set
1196# CONFIG_DEBUG_FS is not set
1197# CONFIG_DEBUG_VM is not set 1335# CONFIG_DEBUG_VM is not set
1336# CONFIG_DEBUG_LIST is not set
1198CONFIG_FORCED_INLINING=y 1337CONFIG_FORCED_INLINING=y
1199# CONFIG_RCU_TORTURE_TEST is not set 1338# CONFIG_RCU_TORTURE_TEST is not set
1339# CONFIG_FAULT_INJECTION is not set
1200CONFIG_IA64_GRANULE_16MB=y 1340CONFIG_IA64_GRANULE_16MB=y
1201# CONFIG_IA64_GRANULE_64MB is not set 1341# CONFIG_IA64_GRANULE_64MB is not set
1202# CONFIG_IA64_PRINT_HAZARDS is not set 1342# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1215,7 +1355,11 @@ CONFIG_SYSVIPC_COMPAT=y
1215# Cryptographic options 1355# Cryptographic options
1216# 1356#
1217CONFIG_CRYPTO=y 1357CONFIG_CRYPTO=y
1358CONFIG_CRYPTO_ALGAPI=y
1359CONFIG_CRYPTO_BLKCIPHER=m
1360CONFIG_CRYPTO_MANAGER=m
1218# CONFIG_CRYPTO_HMAC is not set 1361# CONFIG_CRYPTO_HMAC is not set
1362# CONFIG_CRYPTO_XCBC is not set
1219# CONFIG_CRYPTO_NULL is not set 1363# CONFIG_CRYPTO_NULL is not set
1220# CONFIG_CRYPTO_MD4 is not set 1364# CONFIG_CRYPTO_MD4 is not set
1221CONFIG_CRYPTO_MD5=y 1365CONFIG_CRYPTO_MD5=y
@@ -1224,7 +1368,13 @@ CONFIG_CRYPTO_MD5=y
1224# CONFIG_CRYPTO_SHA512 is not set 1368# CONFIG_CRYPTO_SHA512 is not set
1225# CONFIG_CRYPTO_WP512 is not set 1369# CONFIG_CRYPTO_WP512 is not set
1226# CONFIG_CRYPTO_TGR192 is not set 1370# CONFIG_CRYPTO_TGR192 is not set
1371# CONFIG_CRYPTO_GF128MUL is not set
1372CONFIG_CRYPTO_ECB=m
1373CONFIG_CRYPTO_CBC=m
1374CONFIG_CRYPTO_PCBC=m
1375# CONFIG_CRYPTO_LRW is not set
1227CONFIG_CRYPTO_DES=m 1376CONFIG_CRYPTO_DES=m
1377# CONFIG_CRYPTO_FCRYPT is not set
1228# CONFIG_CRYPTO_BLOWFISH is not set 1378# CONFIG_CRYPTO_BLOWFISH is not set
1229# CONFIG_CRYPTO_TWOFISH is not set 1379# CONFIG_CRYPTO_TWOFISH is not set
1230# CONFIG_CRYPTO_SERPENT is not set 1380# CONFIG_CRYPTO_SERPENT is not set
@@ -1238,6 +1388,7 @@ CONFIG_CRYPTO_DES=m
1238# CONFIG_CRYPTO_DEFLATE is not set 1388# CONFIG_CRYPTO_DEFLATE is not set
1239# CONFIG_CRYPTO_MICHAEL_MIC is not set 1389# CONFIG_CRYPTO_MICHAEL_MIC is not set
1240# CONFIG_CRYPTO_CRC32C is not set 1390# CONFIG_CRYPTO_CRC32C is not set
1391# CONFIG_CRYPTO_CAMELLIA is not set
1241# CONFIG_CRYPTO_TEST is not set 1392# CONFIG_CRYPTO_TEST is not set
1242 1393
1243# 1394#
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 949dc4670a0c..1c7955c16358 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -1,8 +1,9 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc5 3# Linux kernel version: 2.6.21-rc3
4# Mon Feb 27 15:55:36 2006 4# Thu Mar 8 11:04:20 2007
5# 5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
6 7
7# 8#
8# Code maturity level options 9# Code maturity level options
@@ -18,16 +19,24 @@ CONFIG_LOCALVERSION=""
18CONFIG_LOCALVERSION_AUTO=y 19CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
22# CONFIG_IPC_NS is not set
23CONFIG_SYSVIPC_SYSCTL=y
21# CONFIG_POSIX_MQUEUE is not set 24# CONFIG_POSIX_MQUEUE is not set
22CONFIG_BSD_PROCESS_ACCT=y 25CONFIG_BSD_PROCESS_ACCT=y
23# CONFIG_BSD_PROCESS_ACCT_V3 is not set 26# CONFIG_BSD_PROCESS_ACCT_V3 is not set
24CONFIG_SYSCTL=y 27# CONFIG_TASKSTATS is not set
28# CONFIG_UTS_NS is not set
25# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
26# CONFIG_IKCONFIG is not set 30# CONFIG_IKCONFIG is not set
27# CONFIG_CPUSETS is not set 31# CONFIG_CPUSETS is not set
32CONFIG_SYSFS_DEPRECATED=y
33# CONFIG_RELAY is not set
34CONFIG_BLK_DEV_INITRD=y
28CONFIG_INITRAMFS_SOURCE="" 35CONFIG_INITRAMFS_SOURCE=""
29CONFIG_CC_OPTIMIZE_FOR_SIZE=y 36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
37CONFIG_SYSCTL=y
30# CONFIG_EMBEDDED is not set 38# CONFIG_EMBEDDED is not set
39CONFIG_SYSCTL_SYSCALL=y
31CONFIG_KALLSYMS=y 40CONFIG_KALLSYMS=y
32# CONFIG_KALLSYMS_ALL is not set 41# CONFIG_KALLSYMS_ALL is not set
33# CONFIG_KALLSYMS_EXTRA_PASS is not set 42# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -39,11 +48,9 @@ CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 48CONFIG_FUTEX=y
40CONFIG_EPOLL=y 49CONFIG_EPOLL=y
41CONFIG_SHMEM=y 50CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 51CONFIG_SLAB=y
52CONFIG_VM_EVENT_COUNTERS=y
53CONFIG_RT_MUTEXES=y
47# CONFIG_TINY_SHMEM is not set 54# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 55CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 56# CONFIG_SLOB is not set
@@ -53,14 +60,16 @@ CONFIG_BASE_SMALL=0
53# 60#
54CONFIG_MODULES=y 61CONFIG_MODULES=y
55# CONFIG_MODULE_UNLOAD is not set 62# CONFIG_MODULE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57# CONFIG_MODVERSIONS is not set 63# CONFIG_MODVERSIONS is not set
58# CONFIG_MODULE_SRCVERSION_ALL is not set 64# CONFIG_MODULE_SRCVERSION_ALL is not set
59# CONFIG_KMOD is not set 65# CONFIG_KMOD is not set
66CONFIG_STOP_MACHINE=y
60 67
61# 68#
62# Block layer 69# Block layer
63# 70#
71CONFIG_BLOCK=y
72# CONFIG_BLK_DEV_IO_TRACE is not set
64 73
65# 74#
66# IO Schedulers 75# IO Schedulers
@@ -80,15 +89,19 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
80# 89#
81CONFIG_IA64=y 90CONFIG_IA64=y
82CONFIG_64BIT=y 91CONFIG_64BIT=y
92CONFIG_ZONE_DMA=y
83CONFIG_MMU=y 93CONFIG_MMU=y
84CONFIG_SWIOTLB=y
85CONFIG_RWSEM_XCHGADD_ALGORITHM=y 94CONFIG_RWSEM_XCHGADD_ALGORITHM=y
95# CONFIG_ARCH_HAS_ILOG2_U32 is not set
96# CONFIG_ARCH_HAS_ILOG2_U64 is not set
97CONFIG_GENERIC_FIND_NEXT_BIT=y
86CONFIG_GENERIC_CALIBRATE_DELAY=y 98CONFIG_GENERIC_CALIBRATE_DELAY=y
87CONFIG_TIME_INTERPOLATION=y 99CONFIG_TIME_INTERPOLATION=y
100CONFIG_DMI=y
88CONFIG_EFI=y 101CONFIG_EFI=y
89CONFIG_GENERIC_IOMAP=y 102CONFIG_GENERIC_IOMAP=y
90CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 103CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
91CONFIG_DMA_IS_DMA32=y 104CONFIG_AUDIT_ARCH=y
92# CONFIG_IA64_GENERIC is not set 105# CONFIG_IA64_GENERIC is not set
93# CONFIG_IA64_DIG is not set 106# CONFIG_IA64_DIG is not set
94CONFIG_IA64_HP_ZX1=y 107CONFIG_IA64_HP_ZX1=y
@@ -105,6 +118,7 @@ CONFIG_PGTABLE_3=y
105# CONFIG_PGTABLE_4 is not set 118# CONFIG_PGTABLE_4 is not set
106# CONFIG_HZ_100 is not set 119# CONFIG_HZ_100 is not set
107CONFIG_HZ_250=y 120CONFIG_HZ_250=y
121# CONFIG_HZ_300 is not set
108# CONFIG_HZ_1000 is not set 122# CONFIG_HZ_1000 is not set
109CONFIG_HZ=250 123CONFIG_HZ=250
110CONFIG_IA64_L1_CACHE_SHIFT=7 124CONFIG_IA64_L1_CACHE_SHIFT=7
@@ -113,8 +127,10 @@ CONFIG_IOSAPIC=y
113CONFIG_FORCE_MAX_ZONEORDER=17 127CONFIG_FORCE_MAX_ZONEORDER=17
114CONFIG_SMP=y 128CONFIG_SMP=y
115CONFIG_NR_CPUS=16 129CONFIG_NR_CPUS=16
116# CONFIG_HOTPLUG_CPU is not set 130CONFIG_HOTPLUG_CPU=y
131CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
117# CONFIG_SCHED_SMT is not set 132# CONFIG_SCHED_SMT is not set
133# CONFIG_PERMIT_BSP_REMOVE is not set
118# CONFIG_PREEMPT is not set 134# CONFIG_PREEMPT is not set
119CONFIG_SELECT_MEMORY_MODEL=y 135CONFIG_SELECT_MEMORY_MODEL=y
120CONFIG_FLATMEM_MANUAL=y 136CONFIG_FLATMEM_MANUAL=y
@@ -124,11 +140,14 @@ CONFIG_FLATMEM=y
124CONFIG_FLAT_NODE_MEM_MAP=y 140CONFIG_FLAT_NODE_MEM_MAP=y
125# CONFIG_SPARSEMEM_STATIC is not set 141# CONFIG_SPARSEMEM_STATIC is not set
126CONFIG_SPLIT_PTLOCK_CPUS=4 142CONFIG_SPLIT_PTLOCK_CPUS=4
143CONFIG_RESOURCES_64BIT=y
144CONFIG_ZONE_DMA_FLAG=1
127CONFIG_ARCH_SELECT_MEMORY_MODEL=y 145CONFIG_ARCH_SELECT_MEMORY_MODEL=y
128CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 146CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
129CONFIG_ARCH_FLATMEM_ENABLE=y 147CONFIG_ARCH_FLATMEM_ENABLE=y
130CONFIG_ARCH_SPARSEMEM_ENABLE=y 148CONFIG_ARCH_SPARSEMEM_ENABLE=y
131CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y 149CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
150CONFIG_ARCH_POPULATES_NODE_MAP=y
132CONFIG_VIRTUAL_MEM_MAP=y 151CONFIG_VIRTUAL_MEM_MAP=y
133CONFIG_HOLES_IN_ZONE=y 152CONFIG_HOLES_IN_ZONE=y
134CONFIG_IA32_SUPPORT=y 153CONFIG_IA32_SUPPORT=y
@@ -136,6 +155,9 @@ CONFIG_COMPAT=y
136CONFIG_IA64_MCA_RECOVERY=y 155CONFIG_IA64_MCA_RECOVERY=y
137CONFIG_PERFMON=y 156CONFIG_PERFMON=y
138CONFIG_IA64_PALINFO=y 157CONFIG_IA64_PALINFO=y
158# CONFIG_IA64_ESI is not set
159# CONFIG_KEXEC is not set
160CONFIG_CRASH_DUMP=y
139 161
140# 162#
141# Firmware Drivers 163# Firmware Drivers
@@ -151,21 +173,25 @@ CONFIG_BINFMT_MISC=y
151CONFIG_PM=y 173CONFIG_PM=y
152CONFIG_PM_LEGACY=y 174CONFIG_PM_LEGACY=y
153# CONFIG_PM_DEBUG is not set 175# CONFIG_PM_DEBUG is not set
176# CONFIG_PM_SYSFS_DEPRECATED is not set
154 177
155# 178#
156# ACPI (Advanced Configuration and Power Interface) Support 179# ACPI (Advanced Configuration and Power Interface) Support
157# 180#
158CONFIG_ACPI=y 181CONFIG_ACPI=y
182CONFIG_ACPI_PROCFS=y
159CONFIG_ACPI_BUTTON=y 183CONFIG_ACPI_BUTTON=y
160CONFIG_ACPI_FAN=y 184CONFIG_ACPI_FAN=y
185# CONFIG_ACPI_DOCK is not set
161CONFIG_ACPI_PROCESSOR=y 186CONFIG_ACPI_PROCESSOR=y
187CONFIG_ACPI_HOTPLUG_CPU=y
162CONFIG_ACPI_THERMAL=y 188CONFIG_ACPI_THERMAL=y
163CONFIG_ACPI_BLACKLIST_YEAR=0 189CONFIG_ACPI_BLACKLIST_YEAR=0
164# CONFIG_ACPI_DEBUG is not set 190# CONFIG_ACPI_DEBUG is not set
165CONFIG_ACPI_EC=y 191CONFIG_ACPI_EC=y
166CONFIG_ACPI_POWER=y 192CONFIG_ACPI_POWER=y
167CONFIG_ACPI_SYSTEM=y 193CONFIG_ACPI_SYSTEM=y
168# CONFIG_ACPI_CONTAINER is not set 194CONFIG_ACPI_CONTAINER=y
169 195
170# 196#
171# CPU Frequency scaling 197# CPU Frequency scaling
@@ -177,8 +203,8 @@ CONFIG_ACPI_SYSTEM=y
177# 203#
178CONFIG_PCI=y 204CONFIG_PCI=y
179CONFIG_PCI_DOMAINS=y 205CONFIG_PCI_DOMAINS=y
206# CONFIG_PCIEPORTBUS is not set
180# CONFIG_PCI_MSI is not set 207# CONFIG_PCI_MSI is not set
181CONFIG_PCI_LEGACY_PROC=y
182# CONFIG_PCI_DEBUG is not set 208# CONFIG_PCI_DEBUG is not set
183 209
184# 210#
@@ -208,6 +234,10 @@ CONFIG_NET=y
208CONFIG_PACKET=y 234CONFIG_PACKET=y
209# CONFIG_PACKET_MMAP is not set 235# CONFIG_PACKET_MMAP is not set
210CONFIG_UNIX=y 236CONFIG_UNIX=y
237CONFIG_XFRM=y
238# CONFIG_XFRM_USER is not set
239# CONFIG_XFRM_SUB_POLICY is not set
240# CONFIG_XFRM_MIGRATE is not set
211# CONFIG_NET_KEY is not set 241# CONFIG_NET_KEY is not set
212CONFIG_INET=y 242CONFIG_INET=y
213CONFIG_IP_MULTICAST=y 243CONFIG_IP_MULTICAST=y
@@ -222,17 +252,26 @@ CONFIG_IP_FIB_HASH=y
222# CONFIG_INET_AH is not set 252# CONFIG_INET_AH is not set
223# CONFIG_INET_ESP is not set 253# CONFIG_INET_ESP is not set
224# CONFIG_INET_IPCOMP is not set 254# CONFIG_INET_IPCOMP is not set
255# CONFIG_INET_XFRM_TUNNEL is not set
225# CONFIG_INET_TUNNEL is not set 256# CONFIG_INET_TUNNEL is not set
257CONFIG_INET_XFRM_MODE_TRANSPORT=y
258CONFIG_INET_XFRM_MODE_TUNNEL=y
259CONFIG_INET_XFRM_MODE_BEET=y
226CONFIG_INET_DIAG=y 260CONFIG_INET_DIAG=y
227CONFIG_INET_TCP_DIAG=y 261CONFIG_INET_TCP_DIAG=y
228# CONFIG_TCP_CONG_ADVANCED is not set 262# CONFIG_TCP_CONG_ADVANCED is not set
229CONFIG_TCP_CONG_BIC=y 263CONFIG_TCP_CONG_CUBIC=y
264CONFIG_DEFAULT_TCP_CONG="cubic"
265# CONFIG_TCP_MD5SIG is not set
230 266
231# 267#
232# IP: Virtual Server Configuration 268# IP: Virtual Server Configuration
233# 269#
234# CONFIG_IP_VS is not set 270# CONFIG_IP_VS is not set
235# CONFIG_IPV6 is not set 271# CONFIG_IPV6 is not set
272# CONFIG_INET6_XFRM_TUNNEL is not set
273# CONFIG_INET6_TUNNEL is not set
274# CONFIG_NETWORK_SECMARK is not set
236CONFIG_NETFILTER=y 275CONFIG_NETFILTER=y
237# CONFIG_NETFILTER_DEBUG is not set 276# CONFIG_NETFILTER_DEBUG is not set
238 277
@@ -240,14 +279,15 @@ CONFIG_NETFILTER=y
240# Core Netfilter Configuration 279# Core Netfilter Configuration
241# 280#
242# CONFIG_NETFILTER_NETLINK is not set 281# CONFIG_NETFILTER_NETLINK is not set
243# CONFIG_NF_CONNTRACK is not set 282# CONFIG_NF_CONNTRACK_ENABLED is not set
244# CONFIG_NETFILTER_XTABLES is not set 283# CONFIG_NETFILTER_XTABLES is not set
245 284
246# 285#
247# IP: Netfilter Configuration 286# IP: Netfilter Configuration
248# 287#
249# CONFIG_IP_NF_CONNTRACK is not set
250# CONFIG_IP_NF_QUEUE is not set 288# CONFIG_IP_NF_QUEUE is not set
289# CONFIG_IP_NF_IPTABLES is not set
290# CONFIG_IP_NF_ARPTABLES is not set
251 291
252# 292#
253# DCCP Configuration (EXPERIMENTAL) 293# DCCP Configuration (EXPERIMENTAL)
@@ -272,7 +312,6 @@ CONFIG_NETFILTER=y
272# CONFIG_ATALK is not set 312# CONFIG_ATALK is not set
273# CONFIG_X25 is not set 313# CONFIG_X25 is not set
274# CONFIG_LAPB is not set 314# CONFIG_LAPB is not set
275# CONFIG_NET_DIVERT is not set
276# CONFIG_ECONET is not set 315# CONFIG_ECONET is not set
277# CONFIG_WAN_ROUTER is not set 316# CONFIG_WAN_ROUTER is not set
278 317
@@ -285,6 +324,7 @@ CONFIG_NETFILTER=y
285# Network testing 324# Network testing
286# 325#
287# CONFIG_NET_PKTGEN is not set 326# CONFIG_NET_PKTGEN is not set
327# CONFIG_NET_TCPPROBE is not set
288# CONFIG_HAMRADIO is not set 328# CONFIG_HAMRADIO is not set
289# CONFIG_IRDA is not set 329# CONFIG_IRDA is not set
290# CONFIG_BT is not set 330# CONFIG_BT is not set
@@ -301,6 +341,8 @@ CONFIG_STANDALONE=y
301CONFIG_PREVENT_FIRMWARE_BUILD=y 341CONFIG_PREVENT_FIRMWARE_BUILD=y
302# CONFIG_FW_LOADER is not set 342# CONFIG_FW_LOADER is not set
303# CONFIG_DEBUG_DRIVER is not set 343# CONFIG_DEBUG_DRIVER is not set
344# CONFIG_DEBUG_DEVRES is not set
345# CONFIG_SYS_HYPERVISOR is not set
304 346
305# 347#
306# Connector - unified userspace <-> kernelspace linker 348# Connector - unified userspace <-> kernelspace linker
@@ -344,11 +386,17 @@ CONFIG_BLK_DEV_LOOP=y
344CONFIG_BLK_DEV_RAM=y 386CONFIG_BLK_DEV_RAM=y
345CONFIG_BLK_DEV_RAM_COUNT=16 387CONFIG_BLK_DEV_RAM_COUNT=16
346CONFIG_BLK_DEV_RAM_SIZE=4096 388CONFIG_BLK_DEV_RAM_SIZE=4096
347CONFIG_BLK_DEV_INITRD=y 389CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
348# CONFIG_CDROM_PKTCDVD is not set 390# CONFIG_CDROM_PKTCDVD is not set
349# CONFIG_ATA_OVER_ETH is not set 391# CONFIG_ATA_OVER_ETH is not set
350 392
351# 393#
394# Misc devices
395#
396# CONFIG_SGI_IOC4 is not set
397# CONFIG_TIFM_CORE is not set
398
399#
352# ATA/ATAPI/MFM/RLL support 400# ATA/ATAPI/MFM/RLL support
353# 401#
354CONFIG_IDE=y 402CONFIG_IDE=y
@@ -365,6 +413,7 @@ CONFIG_BLK_DEV_IDECD=y
365# CONFIG_BLK_DEV_IDETAPE is not set 413# CONFIG_BLK_DEV_IDETAPE is not set
366# CONFIG_BLK_DEV_IDEFLOPPY is not set 414# CONFIG_BLK_DEV_IDEFLOPPY is not set
367# CONFIG_BLK_DEV_IDESCSI is not set 415# CONFIG_BLK_DEV_IDESCSI is not set
416# CONFIG_BLK_DEV_IDEACPI is not set
368# CONFIG_IDE_TASK_IOCTL is not set 417# CONFIG_IDE_TASK_IOCTL is not set
369 418
370# 419#
@@ -390,8 +439,10 @@ CONFIG_BLK_DEV_CMD64X=y
390# CONFIG_BLK_DEV_CS5530 is not set 439# CONFIG_BLK_DEV_CS5530 is not set
391# CONFIG_BLK_DEV_HPT34X is not set 440# CONFIG_BLK_DEV_HPT34X is not set
392# CONFIG_BLK_DEV_HPT366 is not set 441# CONFIG_BLK_DEV_HPT366 is not set
442# CONFIG_BLK_DEV_JMICRON is not set
393# CONFIG_BLK_DEV_SC1200 is not set 443# CONFIG_BLK_DEV_SC1200 is not set
394# CONFIG_BLK_DEV_PIIX is not set 444# CONFIG_BLK_DEV_PIIX is not set
445# CONFIG_BLK_DEV_IT8213 is not set
395# CONFIG_BLK_DEV_IT821X is not set 446# CONFIG_BLK_DEV_IT821X is not set
396# CONFIG_BLK_DEV_NS87415 is not set 447# CONFIG_BLK_DEV_NS87415 is not set
397# CONFIG_BLK_DEV_PDC202XX_OLD is not set 448# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -401,6 +452,7 @@ CONFIG_BLK_DEV_CMD64X=y
401# CONFIG_BLK_DEV_SLC90E66 is not set 452# CONFIG_BLK_DEV_SLC90E66 is not set
402# CONFIG_BLK_DEV_TRM290 is not set 453# CONFIG_BLK_DEV_TRM290 is not set
403# CONFIG_BLK_DEV_VIA82CXXX is not set 454# CONFIG_BLK_DEV_VIA82CXXX is not set
455# CONFIG_BLK_DEV_TC86C001 is not set
404# CONFIG_IDE_ARM is not set 456# CONFIG_IDE_ARM is not set
405CONFIG_BLK_DEV_IDEDMA=y 457CONFIG_BLK_DEV_IDEDMA=y
406# CONFIG_IDEDMA_IVB is not set 458# CONFIG_IDEDMA_IVB is not set
@@ -412,6 +464,8 @@ CONFIG_BLK_DEV_IDEDMA=y
412# 464#
413# CONFIG_RAID_ATTRS is not set 465# CONFIG_RAID_ATTRS is not set
414CONFIG_SCSI=y 466CONFIG_SCSI=y
467# CONFIG_SCSI_TGT is not set
468CONFIG_SCSI_NETLINK=y
415CONFIG_SCSI_PROC_FS=y 469CONFIG_SCSI_PROC_FS=y
416 470
417# 471#
@@ -431,14 +485,16 @@ CONFIG_CHR_DEV_SG=y
431CONFIG_SCSI_MULTI_LUN=y 485CONFIG_SCSI_MULTI_LUN=y
432CONFIG_SCSI_CONSTANTS=y 486CONFIG_SCSI_CONSTANTS=y
433CONFIG_SCSI_LOGGING=y 487CONFIG_SCSI_LOGGING=y
488# CONFIG_SCSI_SCAN_ASYNC is not set
434 489
435# 490#
436# SCSI Transport Attributes 491# SCSI Transports
437# 492#
438CONFIG_SCSI_SPI_ATTRS=y 493CONFIG_SCSI_SPI_ATTRS=y
439CONFIG_SCSI_FC_ATTRS=y 494CONFIG_SCSI_FC_ATTRS=y
440# CONFIG_SCSI_ISCSI_ATTRS is not set 495# CONFIG_SCSI_ISCSI_ATTRS is not set
441# CONFIG_SCSI_SAS_ATTRS is not set 496# CONFIG_SCSI_SAS_ATTRS is not set
497# CONFIG_SCSI_SAS_LIBSAS is not set
442 498
443# 499#
444# SCSI low-level drivers 500# SCSI low-level drivers
@@ -451,28 +507,36 @@ CONFIG_SCSI_FC_ATTRS=y
451# CONFIG_SCSI_AIC7XXX is not set 507# CONFIG_SCSI_AIC7XXX is not set
452# CONFIG_SCSI_AIC7XXX_OLD is not set 508# CONFIG_SCSI_AIC7XXX_OLD is not set
453# CONFIG_SCSI_AIC79XX is not set 509# CONFIG_SCSI_AIC79XX is not set
510# CONFIG_SCSI_AIC94XX is not set
511# CONFIG_SCSI_ARCMSR is not set
454# CONFIG_MEGARAID_NEWGEN is not set 512# CONFIG_MEGARAID_NEWGEN is not set
455# CONFIG_MEGARAID_LEGACY is not set 513# CONFIG_MEGARAID_LEGACY is not set
456# CONFIG_MEGARAID_SAS is not set 514# CONFIG_MEGARAID_SAS is not set
457# CONFIG_SCSI_SATA is not set 515# CONFIG_SCSI_HPTIOP is not set
458# CONFIG_SCSI_DMX3191D is not set 516# CONFIG_SCSI_DMX3191D is not set
459# CONFIG_SCSI_FUTURE_DOMAIN is not set 517# CONFIG_SCSI_FUTURE_DOMAIN is not set
460# CONFIG_SCSI_IPS is not set 518# CONFIG_SCSI_IPS is not set
461# CONFIG_SCSI_INITIO is not set 519# CONFIG_SCSI_INITIO is not set
462# CONFIG_SCSI_INIA100 is not set 520# CONFIG_SCSI_INIA100 is not set
521# CONFIG_SCSI_STEX is not set
463CONFIG_SCSI_SYM53C8XX_2=y 522CONFIG_SCSI_SYM53C8XX_2=y
464CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 523CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
465CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 524CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
466CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 525CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
467# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 526CONFIG_SCSI_SYM53C8XX_MMIO=y
468# CONFIG_SCSI_IPR is not set
469# CONFIG_SCSI_QLOGIC_FC is not set
470CONFIG_SCSI_QLOGIC_1280=y 527CONFIG_SCSI_QLOGIC_1280=y
471# CONFIG_SCSI_QLA_FC is not set 528# CONFIG_SCSI_QLA_FC is not set
529# CONFIG_SCSI_QLA_ISCSI is not set
472# CONFIG_SCSI_LPFC is not set 530# CONFIG_SCSI_LPFC is not set
473# CONFIG_SCSI_DC395x is not set 531# CONFIG_SCSI_DC395x is not set
474# CONFIG_SCSI_DC390T is not set 532# CONFIG_SCSI_DC390T is not set
475# CONFIG_SCSI_DEBUG is not set 533# CONFIG_SCSI_DEBUG is not set
534# CONFIG_SCSI_SRP is not set
535
536#
537# Serial ATA (prod) and Parallel ATA (experimental) drivers
538#
539# CONFIG_ATA is not set
476 540
477# 541#
478# Multi-device support (RAID and LVM) 542# Multi-device support (RAID and LVM)
@@ -562,6 +626,7 @@ CONFIG_E100=y
562# CONFIG_EPIC100 is not set 626# CONFIG_EPIC100 is not set
563# CONFIG_SUNDANCE is not set 627# CONFIG_SUNDANCE is not set
564# CONFIG_VIA_RHINE is not set 628# CONFIG_VIA_RHINE is not set
629# CONFIG_SC92031 is not set
565 630
566# 631#
567# Ethernet (1000 Mbit) 632# Ethernet (1000 Mbit)
@@ -582,13 +647,18 @@ CONFIG_E1000=y
582# CONFIG_VIA_VELOCITY is not set 647# CONFIG_VIA_VELOCITY is not set
583CONFIG_TIGON3=y 648CONFIG_TIGON3=y
584# CONFIG_BNX2 is not set 649# CONFIG_BNX2 is not set
650# CONFIG_QLA3XXX is not set
651# CONFIG_ATL1 is not set
585 652
586# 653#
587# Ethernet (10000 Mbit) 654# Ethernet (10000 Mbit)
588# 655#
589# CONFIG_CHELSIO_T1 is not set 656# CONFIG_CHELSIO_T1 is not set
657# CONFIG_CHELSIO_T3 is not set
590# CONFIG_IXGB is not set 658# CONFIG_IXGB is not set
591# CONFIG_S2IO is not set 659# CONFIG_S2IO is not set
660# CONFIG_MYRI10GE is not set
661# CONFIG_NETXEN_NIC is not set
592 662
593# 663#
594# Token Ring devices 664# Token Ring devices
@@ -628,6 +698,7 @@ CONFIG_TIGON3=y
628# Input device support 698# Input device support
629# 699#
630CONFIG_INPUT=y 700CONFIG_INPUT=y
701# CONFIG_INPUT_FF_MEMLESS is not set
631 702
632# 703#
633# Userland interfaces 704# Userland interfaces
@@ -666,6 +737,7 @@ CONFIG_SERIO=y
666CONFIG_VT=y 737CONFIG_VT=y
667CONFIG_VT_CONSOLE=y 738CONFIG_VT_CONSOLE=y
668CONFIG_HW_CONSOLE=y 739CONFIG_HW_CONSOLE=y
740# CONFIG_VT_HW_CONSOLE_BINDING is not set
669# CONFIG_SERIAL_NONSTANDARD is not set 741# CONFIG_SERIAL_NONSTANDARD is not set
670 742
671# 743#
@@ -673,7 +745,8 @@ CONFIG_HW_CONSOLE=y
673# 745#
674CONFIG_SERIAL_8250=y 746CONFIG_SERIAL_8250=y
675CONFIG_SERIAL_8250_CONSOLE=y 747CONFIG_SERIAL_8250_CONSOLE=y
676CONFIG_SERIAL_8250_ACPI=y 748CONFIG_SERIAL_8250_PCI=y
749CONFIG_SERIAL_8250_PNP=y
677CONFIG_SERIAL_8250_NR_UARTS=8 750CONFIG_SERIAL_8250_NR_UARTS=8
678CONFIG_SERIAL_8250_RUNTIME_UARTS=4 751CONFIG_SERIAL_8250_RUNTIME_UARTS=4
679CONFIG_SERIAL_8250_EXTENDED=y 752CONFIG_SERIAL_8250_EXTENDED=y
@@ -705,10 +778,6 @@ CONFIG_EFI_RTC=y
705# CONFIG_DTLK is not set 778# CONFIG_DTLK is not set
706# CONFIG_R3964 is not set 779# CONFIG_R3964 is not set
707# CONFIG_APPLICOM is not set 780# CONFIG_APPLICOM is not set
708
709#
710# Ftape, the floppy tape device driver
711#
712CONFIG_AGP=y 781CONFIG_AGP=y
713CONFIG_AGP_HP_ZX1=y 782CONFIG_AGP_HP_ZX1=y
714CONFIG_DRM=y 783CONFIG_DRM=y
@@ -727,7 +796,6 @@ CONFIG_DRM_RADEON=y
727# TPM devices 796# TPM devices
728# 797#
729# CONFIG_TCG_TPM is not set 798# CONFIG_TCG_TPM is not set
730# CONFIG_TELCLOCK is not set
731 799
732# 800#
733# I2C support 801# I2C support
@@ -754,10 +822,11 @@ CONFIG_I2C_ALGOPCF=y
754# CONFIG_I2C_I810 is not set 822# CONFIG_I2C_I810 is not set
755# CONFIG_I2C_PIIX4 is not set 823# CONFIG_I2C_PIIX4 is not set
756# CONFIG_I2C_NFORCE2 is not set 824# CONFIG_I2C_NFORCE2 is not set
825# CONFIG_I2C_OCORES is not set
757# CONFIG_I2C_PARPORT_LIGHT is not set 826# CONFIG_I2C_PARPORT_LIGHT is not set
827# CONFIG_I2C_PASEMI is not set
758# CONFIG_I2C_PROSAVAGE is not set 828# CONFIG_I2C_PROSAVAGE is not set
759# CONFIG_I2C_SAVAGE4 is not set 829# CONFIG_I2C_SAVAGE4 is not set
760# CONFIG_SCx200_ACB is not set
761# CONFIG_I2C_SIS5595 is not set 830# CONFIG_I2C_SIS5595 is not set
762# CONFIG_I2C_SIS630 is not set 831# CONFIG_I2C_SIS630 is not set
763# CONFIG_I2C_SIS96X is not set 832# CONFIG_I2C_SIS96X is not set
@@ -776,9 +845,7 @@ CONFIG_I2C_ALGOPCF=y
776# CONFIG_SENSORS_PCF8574 is not set 845# CONFIG_SENSORS_PCF8574 is not set
777# CONFIG_SENSORS_PCA9539 is not set 846# CONFIG_SENSORS_PCA9539 is not set
778# CONFIG_SENSORS_PCF8591 is not set 847# CONFIG_SENSORS_PCF8591 is not set
779# CONFIG_SENSORS_RTC8564 is not set
780# CONFIG_SENSORS_MAX6875 is not set 848# CONFIG_SENSORS_MAX6875 is not set
781# CONFIG_RTC_X1205_I2C is not set
782# CONFIG_I2C_DEBUG_CORE is not set 849# CONFIG_I2C_DEBUG_CORE is not set
783# CONFIG_I2C_DEBUG_ALGO is not set 850# CONFIG_I2C_DEBUG_ALGO is not set
784# CONFIG_I2C_DEBUG_BUS is not set 851# CONFIG_I2C_DEBUG_BUS is not set
@@ -802,28 +869,31 @@ CONFIG_I2C_ALGOPCF=y
802# CONFIG_HWMON_VID is not set 869# CONFIG_HWMON_VID is not set
803 870
804# 871#
805# Misc devices 872# Multifunction device drivers
806#
807
808#
809# Multimedia Capabilities Port drivers
810# 873#
874# CONFIG_MFD_SM501 is not set
811 875
812# 876#
813# Multimedia devices 877# Multimedia devices
814# 878#
815CONFIG_VIDEO_DEV=y 879CONFIG_VIDEO_DEV=y
880CONFIG_VIDEO_V4L1=y
881CONFIG_VIDEO_V4L1_COMPAT=y
882CONFIG_VIDEO_V4L2=y
816 883
817# 884#
818# Video For Linux 885# Video Capture Adapters
819# 886#
820 887
821# 888#
822# Video Adapters 889# Video Capture Adapters
823# 890#
824# CONFIG_VIDEO_ADV_DEBUG is not set 891# CONFIG_VIDEO_ADV_DEBUG is not set
892CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
893# CONFIG_VIDEO_VIVI is not set
825# CONFIG_VIDEO_BT848 is not set 894# CONFIG_VIDEO_BT848 is not set
826# CONFIG_VIDEO_CPIA is not set 895# CONFIG_VIDEO_CPIA is not set
896# CONFIG_VIDEO_CPIA2 is not set
827# CONFIG_VIDEO_SAA5246A is not set 897# CONFIG_VIDEO_SAA5246A is not set
828# CONFIG_VIDEO_SAA5249 is not set 898# CONFIG_VIDEO_SAA5249 is not set
829# CONFIG_TUNER_3036 is not set 899# CONFIG_TUNER_3036 is not set
@@ -835,10 +905,27 @@ CONFIG_VIDEO_DEV=y
835# CONFIG_VIDEO_HEXIUM_ORION is not set 905# CONFIG_VIDEO_HEXIUM_ORION is not set
836# CONFIG_VIDEO_HEXIUM_GEMINI is not set 906# CONFIG_VIDEO_HEXIUM_GEMINI is not set
837# CONFIG_VIDEO_CX88 is not set 907# CONFIG_VIDEO_CX88 is not set
908# CONFIG_VIDEO_CAFE_CCIC is not set
909
910#
911# V4L USB devices
912#
913# CONFIG_VIDEO_PVRUSB2 is not set
838# CONFIG_VIDEO_EM28XX is not set 914# CONFIG_VIDEO_EM28XX is not set
915# CONFIG_VIDEO_USBVISION is not set
916# CONFIG_USB_VICAM is not set
917# CONFIG_USB_IBMCAM is not set
918# CONFIG_USB_KONICAWC is not set
919# CONFIG_USB_QUICKCAM_MESSENGER is not set
920# CONFIG_USB_ET61X251 is not set
839# CONFIG_VIDEO_OVCAMCHIP is not set 921# CONFIG_VIDEO_OVCAMCHIP is not set
840# CONFIG_VIDEO_AUDIO_DECODER is not set 922# CONFIG_USB_W9968CF is not set
841# CONFIG_VIDEO_DECODER is not set 923# CONFIG_USB_OV511 is not set
924# CONFIG_USB_SE401 is not set
925# CONFIG_USB_SN9C102 is not set
926# CONFIG_USB_STV680 is not set
927# CONFIG_USB_ZC0301 is not set
928# CONFIG_USB_PWC is not set
842 929
843# 930#
844# Radio Adapters 931# Radio Adapters
@@ -846,22 +933,35 @@ CONFIG_VIDEO_DEV=y
846# CONFIG_RADIO_GEMTEK_PCI is not set 933# CONFIG_RADIO_GEMTEK_PCI is not set
847# CONFIG_RADIO_MAXIRADIO is not set 934# CONFIG_RADIO_MAXIRADIO is not set
848# CONFIG_RADIO_MAESTRO is not set 935# CONFIG_RADIO_MAESTRO is not set
936# CONFIG_USB_DSBR is not set
849 937
850# 938#
851# Digital Video Broadcasting Devices 939# Digital Video Broadcasting Devices
852# 940#
853# CONFIG_DVB is not set 941# CONFIG_DVB is not set
942# CONFIG_USB_DABUSB is not set
854 943
855# 944#
856# Graphics support 945# Graphics support
857# 946#
947CONFIG_BACKLIGHT_LCD_SUPPORT=y
948CONFIG_BACKLIGHT_CLASS_DEVICE=y
949CONFIG_LCD_CLASS_DEVICE=m
858CONFIG_FB=y 950CONFIG_FB=y
951# CONFIG_FIRMWARE_EDID is not set
952CONFIG_FB_DDC=y
859CONFIG_FB_CFB_FILLRECT=y 953CONFIG_FB_CFB_FILLRECT=y
860CONFIG_FB_CFB_COPYAREA=y 954CONFIG_FB_CFB_COPYAREA=y
861CONFIG_FB_CFB_IMAGEBLIT=y 955CONFIG_FB_CFB_IMAGEBLIT=y
956# CONFIG_FB_SVGALIB is not set
862# CONFIG_FB_MACMODES is not set 957# CONFIG_FB_MACMODES is not set
958CONFIG_FB_BACKLIGHT=y
863CONFIG_FB_MODE_HELPERS=y 959CONFIG_FB_MODE_HELPERS=y
864# CONFIG_FB_TILEBLITTING is not set 960# CONFIG_FB_TILEBLITTING is not set
961
962#
963# Frambuffer hardware drivers
964#
865# CONFIG_FB_CIRRUS is not set 965# CONFIG_FB_CIRRUS is not set
866# CONFIG_FB_PM2 is not set 966# CONFIG_FB_PM2 is not set
867# CONFIG_FB_CYBER2000 is not set 967# CONFIG_FB_CYBER2000 is not set
@@ -871,12 +971,13 @@ CONFIG_FB_MODE_HELPERS=y
871# CONFIG_FB_NVIDIA is not set 971# CONFIG_FB_NVIDIA is not set
872# CONFIG_FB_RIVA is not set 972# CONFIG_FB_RIVA is not set
873# CONFIG_FB_MATROX is not set 973# CONFIG_FB_MATROX is not set
874# CONFIG_FB_RADEON_OLD is not set
875CONFIG_FB_RADEON=y 974CONFIG_FB_RADEON=y
876CONFIG_FB_RADEON_I2C=y 975CONFIG_FB_RADEON_I2C=y
976CONFIG_FB_RADEON_BACKLIGHT=y
877CONFIG_FB_RADEON_DEBUG=y 977CONFIG_FB_RADEON_DEBUG=y
878# CONFIG_FB_ATY128 is not set 978# CONFIG_FB_ATY128 is not set
879# CONFIG_FB_ATY is not set 979# CONFIG_FB_ATY is not set
980# CONFIG_FB_S3 is not set
880# CONFIG_FB_SAVAGE is not set 981# CONFIG_FB_SAVAGE is not set
881# CONFIG_FB_SIS is not set 982# CONFIG_FB_SIS is not set
882# CONFIG_FB_NEOMAGIC is not set 983# CONFIG_FB_NEOMAGIC is not set
@@ -890,6 +991,7 @@ CONFIG_FB_RADEON_DEBUG=y
890# Console display driver support 991# Console display driver support
891# 992#
892CONFIG_VGA_CONSOLE=y 993CONFIG_VGA_CONSOLE=y
994# CONFIG_VGACON_SOFT_SCROLLBACK is not set
893CONFIG_DUMMY_CONSOLE=y 995CONFIG_DUMMY_CONSOLE=y
894CONFIG_FRAMEBUFFER_CONSOLE=y 996CONFIG_FRAMEBUFFER_CONSOLE=y
895# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 997# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
@@ -904,7 +1006,6 @@ CONFIG_LOGO=y
904# CONFIG_LOGO_LINUX_MONO is not set 1006# CONFIG_LOGO_LINUX_MONO is not set
905# CONFIG_LOGO_LINUX_VGA16 is not set 1007# CONFIG_LOGO_LINUX_VGA16 is not set
906CONFIG_LOGO_LINUX_CLUT224=y 1008CONFIG_LOGO_LINUX_CLUT224=y
907# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
908 1009
909# 1010#
910# Sound 1011# Sound
@@ -924,9 +1025,11 @@ CONFIG_SND_SEQUENCER=y
924CONFIG_SND_OSSEMUL=y 1025CONFIG_SND_OSSEMUL=y
925CONFIG_SND_MIXER_OSS=y 1026CONFIG_SND_MIXER_OSS=y
926CONFIG_SND_PCM_OSS=y 1027CONFIG_SND_PCM_OSS=y
1028CONFIG_SND_PCM_OSS_PLUGINS=y
927CONFIG_SND_SEQUENCER_OSS=y 1029CONFIG_SND_SEQUENCER_OSS=y
928# CONFIG_SND_DYNAMIC_MINORS is not set 1030# CONFIG_SND_DYNAMIC_MINORS is not set
929CONFIG_SND_SUPPORT_OLD_API=y 1031CONFIG_SND_SUPPORT_OLD_API=y
1032CONFIG_SND_VERBOSE_PROCFS=y
930# CONFIG_SND_VERBOSE_PRINTK is not set 1033# CONFIG_SND_VERBOSE_PRINTK is not set
931# CONFIG_SND_DEBUG is not set 1034# CONFIG_SND_DEBUG is not set
932 1035
@@ -936,7 +1039,6 @@ CONFIG_SND_SUPPORT_OLD_API=y
936CONFIG_SND_MPU401_UART=y 1039CONFIG_SND_MPU401_UART=y
937CONFIG_SND_OPL3_LIB=y 1040CONFIG_SND_OPL3_LIB=y
938CONFIG_SND_AC97_CODEC=y 1041CONFIG_SND_AC97_CODEC=y
939CONFIG_SND_AC97_BUS=y
940# CONFIG_SND_DUMMY is not set 1042# CONFIG_SND_DUMMY is not set
941# CONFIG_SND_VIRMIDI is not set 1043# CONFIG_SND_VIRMIDI is not set
942# CONFIG_SND_MTPAV is not set 1044# CONFIG_SND_MTPAV is not set
@@ -947,6 +1049,7 @@ CONFIG_SND_AC97_BUS=y
947# PCI devices 1049# PCI devices
948# 1050#
949# CONFIG_SND_AD1889 is not set 1051# CONFIG_SND_AD1889 is not set
1052# CONFIG_SND_ALS300 is not set
950# CONFIG_SND_ALI5451 is not set 1053# CONFIG_SND_ALI5451 is not set
951# CONFIG_SND_ATIIXP is not set 1054# CONFIG_SND_ATIIXP is not set
952# CONFIG_SND_ATIIXP_MODEM is not set 1055# CONFIG_SND_ATIIXP_MODEM is not set
@@ -959,6 +1062,18 @@ CONFIG_SND_AC97_BUS=y
959# CONFIG_SND_CMIPCI is not set 1062# CONFIG_SND_CMIPCI is not set
960# CONFIG_SND_CS4281 is not set 1063# CONFIG_SND_CS4281 is not set
961# CONFIG_SND_CS46XX is not set 1064# CONFIG_SND_CS46XX is not set
1065# CONFIG_SND_DARLA20 is not set
1066# CONFIG_SND_GINA20 is not set
1067# CONFIG_SND_LAYLA20 is not set
1068# CONFIG_SND_DARLA24 is not set
1069# CONFIG_SND_GINA24 is not set
1070# CONFIG_SND_LAYLA24 is not set
1071# CONFIG_SND_MONA is not set
1072# CONFIG_SND_MIA is not set
1073# CONFIG_SND_ECHO3G is not set
1074# CONFIG_SND_INDIGO is not set
1075# CONFIG_SND_INDIGOIO is not set
1076# CONFIG_SND_INDIGODJ is not set
962# CONFIG_SND_EMU10K1 is not set 1077# CONFIG_SND_EMU10K1 is not set
963# CONFIG_SND_EMU10K1X is not set 1078# CONFIG_SND_EMU10K1X is not set
964# CONFIG_SND_ENS1370 is not set 1079# CONFIG_SND_ENS1370 is not set
@@ -966,7 +1081,7 @@ CONFIG_SND_AC97_BUS=y
966# CONFIG_SND_ES1938 is not set 1081# CONFIG_SND_ES1938 is not set
967# CONFIG_SND_ES1968 is not set 1082# CONFIG_SND_ES1968 is not set
968CONFIG_SND_FM801=y 1083CONFIG_SND_FM801=y
969CONFIG_SND_FM801_TEA575X=y 1084# CONFIG_SND_FM801_TEA575X_BOOL is not set
970# CONFIG_SND_HDA_INTEL is not set 1085# CONFIG_SND_HDA_INTEL is not set
971# CONFIG_SND_HDSP is not set 1086# CONFIG_SND_HDSP is not set
972# CONFIG_SND_HDSPM is not set 1087# CONFIG_SND_HDSPM is not set
@@ -979,6 +1094,7 @@ CONFIG_SND_FM801_TEA575X=y
979# CONFIG_SND_MIXART is not set 1094# CONFIG_SND_MIXART is not set
980# CONFIG_SND_NM256 is not set 1095# CONFIG_SND_NM256 is not set
981# CONFIG_SND_PCXHR is not set 1096# CONFIG_SND_PCXHR is not set
1097# CONFIG_SND_RIPTIDE is not set
982# CONFIG_SND_RME32 is not set 1098# CONFIG_SND_RME32 is not set
983# CONFIG_SND_RME96 is not set 1099# CONFIG_SND_RME96 is not set
984# CONFIG_SND_RME9652 is not set 1100# CONFIG_SND_RME9652 is not set
@@ -988,6 +1104,7 @@ CONFIG_SND_FM801_TEA575X=y
988# CONFIG_SND_VIA82XX_MODEM is not set 1104# CONFIG_SND_VIA82XX_MODEM is not set
989# CONFIG_SND_VX222 is not set 1105# CONFIG_SND_VX222 is not set
990# CONFIG_SND_YMFPCI is not set 1106# CONFIG_SND_YMFPCI is not set
1107# CONFIG_SND_AC97_POWER_SAVE is not set
991 1108
992# 1109#
993# USB devices 1110# USB devices
@@ -995,15 +1112,28 @@ CONFIG_SND_FM801_TEA575X=y
995# CONFIG_SND_USB_AUDIO is not set 1112# CONFIG_SND_USB_AUDIO is not set
996 1113
997# 1114#
1115# SoC audio support
1116#
1117# CONFIG_SND_SOC is not set
1118
1119#
998# Open Sound System 1120# Open Sound System
999# 1121#
1000# CONFIG_SOUND_PRIME is not set 1122# CONFIG_SOUND_PRIME is not set
1123CONFIG_AC97_BUS=y
1124
1125#
1126# HID Devices
1127#
1128CONFIG_HID=y
1129# CONFIG_HID_DEBUG is not set
1001 1130
1002# 1131#
1003# USB support 1132# USB support
1004# 1133#
1005CONFIG_USB_ARCH_HAS_HCD=y 1134CONFIG_USB_ARCH_HAS_HCD=y
1006CONFIG_USB_ARCH_HAS_OHCI=y 1135CONFIG_USB_ARCH_HAS_OHCI=y
1136CONFIG_USB_ARCH_HAS_EHCI=y
1007CONFIG_USB=y 1137CONFIG_USB=y
1008# CONFIG_USB_DEBUG is not set 1138# CONFIG_USB_DEBUG is not set
1009 1139
@@ -1011,7 +1141,6 @@ CONFIG_USB=y
1011# Miscellaneous USB options 1141# Miscellaneous USB options
1012# 1142#
1013# CONFIG_USB_DEVICEFS is not set 1143# CONFIG_USB_DEVICEFS is not set
1014CONFIG_USB_BANDWIDTH=y
1015# CONFIG_USB_DYNAMIC_MINORS is not set 1144# CONFIG_USB_DYNAMIC_MINORS is not set
1016# CONFIG_USB_SUSPEND is not set 1145# CONFIG_USB_SUSPEND is not set
1017# CONFIG_USB_OTG is not set 1146# CONFIG_USB_OTG is not set
@@ -1022,9 +1151,12 @@ CONFIG_USB_BANDWIDTH=y
1022CONFIG_USB_EHCI_HCD=y 1151CONFIG_USB_EHCI_HCD=y
1023# CONFIG_USB_EHCI_SPLIT_ISO is not set 1152# CONFIG_USB_EHCI_SPLIT_ISO is not set
1024# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1153# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1154# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1155# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
1025# CONFIG_USB_ISP116X_HCD is not set 1156# CONFIG_USB_ISP116X_HCD is not set
1026CONFIG_USB_OHCI_HCD=y 1157CONFIG_USB_OHCI_HCD=y
1027# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1158# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1159# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1028CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1160CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1029CONFIG_USB_UHCI_HCD=y 1161CONFIG_USB_UHCI_HCD=y
1030# CONFIG_USB_SL811_HCD is not set 1162# CONFIG_USB_SL811_HCD is not set
@@ -1032,7 +1164,6 @@ CONFIG_USB_UHCI_HCD=y
1032# 1164#
1033# USB Device Class drivers 1165# USB Device Class drivers
1034# 1166#
1035# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1036# CONFIG_USB_ACM is not set 1167# CONFIG_USB_ACM is not set
1037# CONFIG_USB_PRINTER is not set 1168# CONFIG_USB_PRINTER is not set
1038 1169
@@ -1054,13 +1185,13 @@ CONFIG_USB_STORAGE=y
1054# CONFIG_USB_STORAGE_SDDR55 is not set 1185# CONFIG_USB_STORAGE_SDDR55 is not set
1055# CONFIG_USB_STORAGE_JUMPSHOT is not set 1186# CONFIG_USB_STORAGE_JUMPSHOT is not set
1056# CONFIG_USB_STORAGE_ALAUDA is not set 1187# CONFIG_USB_STORAGE_ALAUDA is not set
1188# CONFIG_USB_STORAGE_KARMA is not set
1057# CONFIG_USB_LIBUSUAL is not set 1189# CONFIG_USB_LIBUSUAL is not set
1058 1190
1059# 1191#
1060# USB Input Devices 1192# USB Input Devices
1061# 1193#
1062CONFIG_USB_HID=y 1194CONFIG_USB_HID=y
1063CONFIG_USB_HIDINPUT=y
1064# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1195# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1065# CONFIG_HID_FF is not set 1196# CONFIG_HID_FF is not set
1066CONFIG_USB_HIDDEV=y 1197CONFIG_USB_HIDDEV=y
@@ -1069,15 +1200,14 @@ CONFIG_USB_HIDDEV=y
1069# CONFIG_USB_ACECAD is not set 1200# CONFIG_USB_ACECAD is not set
1070# CONFIG_USB_KBTAB is not set 1201# CONFIG_USB_KBTAB is not set
1071# CONFIG_USB_POWERMATE is not set 1202# CONFIG_USB_POWERMATE is not set
1072# CONFIG_USB_MTOUCH is not set 1203# CONFIG_USB_TOUCHSCREEN is not set
1073# CONFIG_USB_ITMTOUCH is not set
1074# CONFIG_USB_EGALAX is not set
1075# CONFIG_USB_YEALINK is not set 1204# CONFIG_USB_YEALINK is not set
1076# CONFIG_USB_XPAD is not set 1205# CONFIG_USB_XPAD is not set
1077# CONFIG_USB_ATI_REMOTE is not set 1206# CONFIG_USB_ATI_REMOTE is not set
1078# CONFIG_USB_ATI_REMOTE2 is not set 1207# CONFIG_USB_ATI_REMOTE2 is not set
1079# CONFIG_USB_KEYSPAN_REMOTE is not set 1208# CONFIG_USB_KEYSPAN_REMOTE is not set
1080# CONFIG_USB_APPLETOUCH is not set 1209# CONFIG_USB_APPLETOUCH is not set
1210# CONFIG_USB_GTCO is not set
1081 1211
1082# 1212#
1083# USB Imaging devices 1213# USB Imaging devices
@@ -1086,27 +1216,13 @@ CONFIG_USB_HIDDEV=y
1086# CONFIG_USB_MICROTEK is not set 1216# CONFIG_USB_MICROTEK is not set
1087 1217
1088# 1218#
1089# USB Multimedia devices
1090#
1091# CONFIG_USB_DABUSB is not set
1092# CONFIG_USB_VICAM is not set
1093# CONFIG_USB_DSBR is not set
1094# CONFIG_USB_ET61X251 is not set
1095# CONFIG_USB_IBMCAM is not set
1096# CONFIG_USB_KONICAWC is not set
1097# CONFIG_USB_OV511 is not set
1098# CONFIG_USB_SE401 is not set
1099# CONFIG_USB_SN9C102 is not set
1100# CONFIG_USB_STV680 is not set
1101# CONFIG_USB_PWC is not set
1102
1103#
1104# USB Network Adapters 1219# USB Network Adapters
1105# 1220#
1106# CONFIG_USB_CATC is not set 1221# CONFIG_USB_CATC is not set
1107# CONFIG_USB_KAWETH is not set 1222# CONFIG_USB_KAWETH is not set
1108# CONFIG_USB_PEGASUS is not set 1223# CONFIG_USB_PEGASUS is not set
1109# CONFIG_USB_RTL8150 is not set 1224# CONFIG_USB_RTL8150 is not set
1225# CONFIG_USB_USBNET_MII is not set
1110# CONFIG_USB_USBNET is not set 1226# CONFIG_USB_USBNET is not set
1111CONFIG_USB_MON=y 1227CONFIG_USB_MON=y
1112 1228
@@ -1124,17 +1240,23 @@ CONFIG_USB_MON=y
1124# 1240#
1125# CONFIG_USB_EMI62 is not set 1241# CONFIG_USB_EMI62 is not set
1126# CONFIG_USB_EMI26 is not set 1242# CONFIG_USB_EMI26 is not set
1243# CONFIG_USB_ADUTUX is not set
1127# CONFIG_USB_AUERSWALD is not set 1244# CONFIG_USB_AUERSWALD is not set
1128# CONFIG_USB_RIO500 is not set 1245# CONFIG_USB_RIO500 is not set
1129# CONFIG_USB_LEGOTOWER is not set 1246# CONFIG_USB_LEGOTOWER is not set
1130# CONFIG_USB_LCD is not set 1247# CONFIG_USB_LCD is not set
1248# CONFIG_USB_BERRY_CHARGE is not set
1131# CONFIG_USB_LED is not set 1249# CONFIG_USB_LED is not set
1250# CONFIG_USB_CYPRESS_CY7C63 is not set
1132# CONFIG_USB_CYTHERM is not set 1251# CONFIG_USB_CYTHERM is not set
1133# CONFIG_USB_PHIDGETKIT is not set 1252# CONFIG_USB_PHIDGET is not set
1134# CONFIG_USB_PHIDGETSERVO is not set
1135# CONFIG_USB_IDMOUSE is not set 1253# CONFIG_USB_IDMOUSE is not set
1254# CONFIG_USB_FTDI_ELAN is not set
1255# CONFIG_USB_APPLEDISPLAY is not set
1136# CONFIG_USB_SISUSBVGA is not set 1256# CONFIG_USB_SISUSBVGA is not set
1137# CONFIG_USB_LD is not set 1257# CONFIG_USB_LD is not set
1258# CONFIG_USB_TRANCEVIBRATOR is not set
1259# CONFIG_USB_IOWARRIOR is not set
1138 1260
1139# 1261#
1140# USB DSL modem support 1262# USB DSL modem support
@@ -1151,13 +1273,53 @@ CONFIG_USB_MON=y
1151# CONFIG_MMC is not set 1273# CONFIG_MMC is not set
1152 1274
1153# 1275#
1276# LED devices
1277#
1278# CONFIG_NEW_LEDS is not set
1279
1280#
1281# LED drivers
1282#
1283
1284#
1285# LED Triggers
1286#
1287
1288#
1154# InfiniBand support 1289# InfiniBand support
1155# 1290#
1156# CONFIG_INFINIBAND is not set 1291# CONFIG_INFINIBAND is not set
1157 1292
1158# 1293#
1159# EDAC - error detection and reporting (RAS) 1294# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1295#
1296
1297#
1298# Real Time Clock
1160# 1299#
1300# CONFIG_RTC_CLASS is not set
1301
1302#
1303# DMA Engine support
1304#
1305# CONFIG_DMA_ENGINE is not set
1306
1307#
1308# DMA Clients
1309#
1310
1311#
1312# DMA Devices
1313#
1314
1315#
1316# Auxiliary Display support
1317#
1318
1319#
1320# Virtualization
1321#
1322# CONFIG_MSPEC is not set
1161 1323
1162# 1324#
1163# File systems 1325# File systems
@@ -1171,6 +1333,7 @@ CONFIG_EXT3_FS=y
1171CONFIG_EXT3_FS_XATTR=y 1333CONFIG_EXT3_FS_XATTR=y
1172# CONFIG_EXT3_FS_POSIX_ACL is not set 1334# CONFIG_EXT3_FS_POSIX_ACL is not set
1173# CONFIG_EXT3_FS_SECURITY is not set 1335# CONFIG_EXT3_FS_SECURITY is not set
1336# CONFIG_EXT4DEV_FS is not set
1174CONFIG_JBD=y 1337CONFIG_JBD=y
1175# CONFIG_JBD_DEBUG is not set 1338# CONFIG_JBD_DEBUG is not set
1176CONFIG_FS_MBCACHE=y 1339CONFIG_FS_MBCACHE=y
@@ -1178,6 +1341,7 @@ CONFIG_FS_MBCACHE=y
1178# CONFIG_JFS_FS is not set 1341# CONFIG_JFS_FS is not set
1179# CONFIG_FS_POSIX_ACL is not set 1342# CONFIG_FS_POSIX_ACL is not set
1180# CONFIG_XFS_FS is not set 1343# CONFIG_XFS_FS is not set
1344# CONFIG_GFS2_FS is not set
1181# CONFIG_OCFS2_FS is not set 1345# CONFIG_OCFS2_FS is not set
1182# CONFIG_MINIX_FS is not set 1346# CONFIG_MINIX_FS is not set
1183# CONFIG_ROMFS_FS is not set 1347# CONFIG_ROMFS_FS is not set
@@ -1212,12 +1376,14 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1212# 1376#
1213CONFIG_PROC_FS=y 1377CONFIG_PROC_FS=y
1214CONFIG_PROC_KCORE=y 1378CONFIG_PROC_KCORE=y
1379CONFIG_PROC_VMCORE=y
1380CONFIG_PROC_SYSCTL=y
1215CONFIG_SYSFS=y 1381CONFIG_SYSFS=y
1216CONFIG_TMPFS=y 1382CONFIG_TMPFS=y
1383# CONFIG_TMPFS_POSIX_ACL is not set
1217CONFIG_HUGETLBFS=y 1384CONFIG_HUGETLBFS=y
1218CONFIG_HUGETLB_PAGE=y 1385CONFIG_HUGETLB_PAGE=y
1219CONFIG_RAMFS=y 1386CONFIG_RAMFS=y
1220# CONFIG_RELAYFS_FS is not set
1221# CONFIG_CONFIGFS_FS is not set 1387# CONFIG_CONFIGFS_FS is not set
1222 1388
1223# 1389#
@@ -1331,15 +1497,25 @@ CONFIG_NLS_KOI8_U=y
1331CONFIG_NLS_UTF8=y 1497CONFIG_NLS_UTF8=y
1332 1498
1333# 1499#
1500# Distributed Lock Manager
1501#
1502# CONFIG_DLM is not set
1503
1504#
1334# Library routines 1505# Library routines
1335# 1506#
1507CONFIG_BITREVERSE=y
1336# CONFIG_CRC_CCITT is not set 1508# CONFIG_CRC_CCITT is not set
1337# CONFIG_CRC16 is not set 1509# CONFIG_CRC16 is not set
1338CONFIG_CRC32=y 1510CONFIG_CRC32=y
1339# CONFIG_LIBCRC32C is not set 1511# CONFIG_LIBCRC32C is not set
1512CONFIG_PLIST=y
1513CONFIG_HAS_IOMEM=y
1514CONFIG_HAS_IOPORT=y
1340CONFIG_GENERIC_HARDIRQS=y 1515CONFIG_GENERIC_HARDIRQS=y
1341CONFIG_GENERIC_IRQ_PROBE=y 1516CONFIG_GENERIC_IRQ_PROBE=y
1342CONFIG_GENERIC_PENDING_IRQ=y 1517CONFIG_GENERIC_PENDING_IRQ=y
1518CONFIG_IRQ_PER_CPU=y
1343 1519
1344# 1520#
1345# Instrumentation Support 1521# Instrumentation Support
@@ -1351,21 +1527,32 @@ CONFIG_KPROBES=y
1351# Kernel hacking 1527# Kernel hacking
1352# 1528#
1353# CONFIG_PRINTK_TIME is not set 1529# CONFIG_PRINTK_TIME is not set
1530CONFIG_ENABLE_MUST_CHECK=y
1354CONFIG_MAGIC_SYSRQ=y 1531CONFIG_MAGIC_SYSRQ=y
1532# CONFIG_UNUSED_SYMBOLS is not set
1533# CONFIG_DEBUG_FS is not set
1534# CONFIG_HEADERS_CHECK is not set
1355CONFIG_DEBUG_KERNEL=y 1535CONFIG_DEBUG_KERNEL=y
1536# CONFIG_DEBUG_SHIRQ is not set
1356CONFIG_LOG_BUF_SHIFT=17 1537CONFIG_LOG_BUF_SHIFT=17
1357CONFIG_DETECT_SOFTLOCKUP=y 1538CONFIG_DETECT_SOFTLOCKUP=y
1358# CONFIG_SCHEDSTATS is not set 1539# CONFIG_SCHEDSTATS is not set
1540# CONFIG_TIMER_STATS is not set
1359# CONFIG_DEBUG_SLAB is not set 1541# CONFIG_DEBUG_SLAB is not set
1360CONFIG_DEBUG_MUTEXES=y 1542# CONFIG_DEBUG_RT_MUTEXES is not set
1543# CONFIG_RT_MUTEX_TESTER is not set
1361# CONFIG_DEBUG_SPINLOCK is not set 1544# CONFIG_DEBUG_SPINLOCK is not set
1545CONFIG_DEBUG_MUTEXES=y
1362# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1546# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1547# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1363# CONFIG_DEBUG_KOBJECT is not set 1548# CONFIG_DEBUG_KOBJECT is not set
1364# CONFIG_DEBUG_INFO is not set 1549# CONFIG_DEBUG_INFO is not set
1365# CONFIG_DEBUG_FS is not set
1366# CONFIG_DEBUG_VM is not set 1550# CONFIG_DEBUG_VM is not set
1551# CONFIG_DEBUG_LIST is not set
1367CONFIG_FORCED_INLINING=y 1552CONFIG_FORCED_INLINING=y
1368# CONFIG_RCU_TORTURE_TEST is not set 1553# CONFIG_RCU_TORTURE_TEST is not set
1554# CONFIG_LKDTM is not set
1555# CONFIG_FAULT_INJECTION is not set
1369CONFIG_IA64_GRANULE_16MB=y 1556CONFIG_IA64_GRANULE_16MB=y
1370# CONFIG_IA64_GRANULE_64MB is not set 1557# CONFIG_IA64_GRANULE_64MB is not set
1371CONFIG_IA64_PRINT_HAZARDS=y 1558CONFIG_IA64_PRINT_HAZARDS=y
@@ -1384,7 +1571,11 @@ CONFIG_SYSVIPC_COMPAT=y
1384# Cryptographic options 1571# Cryptographic options
1385# 1572#
1386CONFIG_CRYPTO=y 1573CONFIG_CRYPTO=y
1574CONFIG_CRYPTO_ALGAPI=y
1575CONFIG_CRYPTO_BLKCIPHER=y
1576CONFIG_CRYPTO_MANAGER=y
1387# CONFIG_CRYPTO_HMAC is not set 1577# CONFIG_CRYPTO_HMAC is not set
1578# CONFIG_CRYPTO_XCBC is not set
1388# CONFIG_CRYPTO_NULL is not set 1579# CONFIG_CRYPTO_NULL is not set
1389# CONFIG_CRYPTO_MD4 is not set 1580# CONFIG_CRYPTO_MD4 is not set
1390CONFIG_CRYPTO_MD5=y 1581CONFIG_CRYPTO_MD5=y
@@ -1393,7 +1584,13 @@ CONFIG_CRYPTO_MD5=y
1393# CONFIG_CRYPTO_SHA512 is not set 1584# CONFIG_CRYPTO_SHA512 is not set
1394# CONFIG_CRYPTO_WP512 is not set 1585# CONFIG_CRYPTO_WP512 is not set
1395# CONFIG_CRYPTO_TGR192 is not set 1586# CONFIG_CRYPTO_TGR192 is not set
1587# CONFIG_CRYPTO_GF128MUL is not set
1588CONFIG_CRYPTO_ECB=m
1589CONFIG_CRYPTO_CBC=y
1590CONFIG_CRYPTO_PCBC=m
1591# CONFIG_CRYPTO_LRW is not set
1396CONFIG_CRYPTO_DES=y 1592CONFIG_CRYPTO_DES=y
1593# CONFIG_CRYPTO_FCRYPT is not set
1397# CONFIG_CRYPTO_BLOWFISH is not set 1594# CONFIG_CRYPTO_BLOWFISH is not set
1398# CONFIG_CRYPTO_TWOFISH is not set 1595# CONFIG_CRYPTO_TWOFISH is not set
1399# CONFIG_CRYPTO_SERPENT is not set 1596# CONFIG_CRYPTO_SERPENT is not set
@@ -1407,6 +1604,7 @@ CONFIG_CRYPTO_DES=y
1407# CONFIG_CRYPTO_DEFLATE is not set 1604# CONFIG_CRYPTO_DEFLATE is not set
1408# CONFIG_CRYPTO_MICHAEL_MIC is not set 1605# CONFIG_CRYPTO_MICHAEL_MIC is not set
1409# CONFIG_CRYPTO_CRC32C is not set 1606# CONFIG_CRYPTO_CRC32C is not set
1607# CONFIG_CRYPTO_CAMELLIA is not set
1410# CONFIG_CRYPTO_TEST is not set 1608# CONFIG_CRYPTO_TEST is not set
1411 1609
1412# 1610#
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 9001b3fbaa32..153bfdc0182d 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -1,8 +1,9 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc5 3# Linux kernel version: 2.6.21-rc3
4# Mon Feb 27 16:02:28 2006 4# Thu Mar 8 11:01:03 2007
5# 5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
6 7
7# 8#
8# Code maturity level options 9# Code maturity level options
@@ -18,16 +19,24 @@ CONFIG_LOCALVERSION=""
18CONFIG_LOCALVERSION_AUTO=y 19CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
22# CONFIG_IPC_NS is not set
23CONFIG_SYSVIPC_SYSCTL=y
21CONFIG_POSIX_MQUEUE=y 24CONFIG_POSIX_MQUEUE=y
22# CONFIG_BSD_PROCESS_ACCT is not set 25# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y 26# CONFIG_TASKSTATS is not set
27# CONFIG_UTS_NS is not set
24# CONFIG_AUDIT is not set 28# CONFIG_AUDIT is not set
25CONFIG_IKCONFIG=y 29CONFIG_IKCONFIG=y
26CONFIG_IKCONFIG_PROC=y 30CONFIG_IKCONFIG_PROC=y
27# CONFIG_CPUSETS is not set 31# CONFIG_CPUSETS is not set
32CONFIG_SYSFS_DEPRECATED=y
33# CONFIG_RELAY is not set
34CONFIG_BLK_DEV_INITRD=y
28CONFIG_INITRAMFS_SOURCE="" 35CONFIG_INITRAMFS_SOURCE=""
29CONFIG_CC_OPTIMIZE_FOR_SIZE=y 36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
37CONFIG_SYSCTL=y
30# CONFIG_EMBEDDED is not set 38# CONFIG_EMBEDDED is not set
39CONFIG_SYSCTL_SYSCALL=y
31CONFIG_KALLSYMS=y 40CONFIG_KALLSYMS=y
32CONFIG_KALLSYMS_ALL=y 41CONFIG_KALLSYMS_ALL=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set 42# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -39,11 +48,9 @@ CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 48CONFIG_FUTEX=y
40CONFIG_EPOLL=y 49CONFIG_EPOLL=y
41CONFIG_SHMEM=y 50CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 51CONFIG_SLAB=y
52CONFIG_VM_EVENT_COUNTERS=y
53CONFIG_RT_MUTEXES=y
47# CONFIG_TINY_SHMEM is not set 54# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 55CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 56# CONFIG_SLOB is not set
@@ -54,7 +61,6 @@ CONFIG_BASE_SMALL=0
54CONFIG_MODULES=y 61CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y 62CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set 63# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58CONFIG_MODVERSIONS=y 64CONFIG_MODVERSIONS=y
59# CONFIG_MODULE_SRCVERSION_ALL is not set 65# CONFIG_MODULE_SRCVERSION_ALL is not set
60CONFIG_KMOD=y 66CONFIG_KMOD=y
@@ -63,6 +69,8 @@ CONFIG_STOP_MACHINE=y
63# 69#
64# Block layer 70# Block layer
65# 71#
72CONFIG_BLOCK=y
73# CONFIG_BLK_DEV_IO_TRACE is not set
66 74
67# 75#
68# IO Schedulers 76# IO Schedulers
@@ -82,15 +90,20 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
82# 90#
83CONFIG_IA64=y 91CONFIG_IA64=y
84CONFIG_64BIT=y 92CONFIG_64BIT=y
93CONFIG_ZONE_DMA=y
85CONFIG_MMU=y 94CONFIG_MMU=y
86CONFIG_SWIOTLB=y 95CONFIG_SWIOTLB=y
87CONFIG_RWSEM_XCHGADD_ALGORITHM=y 96CONFIG_RWSEM_XCHGADD_ALGORITHM=y
97# CONFIG_ARCH_HAS_ILOG2_U32 is not set
98# CONFIG_ARCH_HAS_ILOG2_U64 is not set
99CONFIG_GENERIC_FIND_NEXT_BIT=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y 100CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_TIME_INTERPOLATION=y 101CONFIG_TIME_INTERPOLATION=y
102CONFIG_DMI=y
90CONFIG_EFI=y 103CONFIG_EFI=y
91CONFIG_GENERIC_IOMAP=y 104CONFIG_GENERIC_IOMAP=y
92CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 105CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
93CONFIG_DMA_IS_DMA32=y 106CONFIG_AUDIT_ARCH=y
94CONFIG_IA64_GENERIC=y 107CONFIG_IA64_GENERIC=y
95# CONFIG_IA64_DIG is not set 108# CONFIG_IA64_DIG is not set
96# CONFIG_IA64_HP_ZX1 is not set 109# CONFIG_IA64_HP_ZX1 is not set
@@ -107,6 +120,7 @@ CONFIG_PGTABLE_3=y
107# CONFIG_PGTABLE_4 is not set 120# CONFIG_PGTABLE_4 is not set
108# CONFIG_HZ_100 is not set 121# CONFIG_HZ_100 is not set
109CONFIG_HZ_250=y 122CONFIG_HZ_250=y
123# CONFIG_HZ_300 is not set
110# CONFIG_HZ_1000 is not set 124# CONFIG_HZ_1000 is not set
111CONFIG_HZ=250 125CONFIG_HZ=250
112CONFIG_IA64_L1_CACHE_SHIFT=7 126CONFIG_IA64_L1_CACHE_SHIFT=7
@@ -116,9 +130,10 @@ CONFIG_IOSAPIC=y
116CONFIG_FORCE_MAX_ZONEORDER=17 130CONFIG_FORCE_MAX_ZONEORDER=17
117CONFIG_SMP=y 131CONFIG_SMP=y
118CONFIG_NR_CPUS=512 132CONFIG_NR_CPUS=512
119CONFIG_IA64_NR_NODES=256
120CONFIG_HOTPLUG_CPU=y 133CONFIG_HOTPLUG_CPU=y
134CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
121# CONFIG_SCHED_SMT is not set 135# CONFIG_SCHED_SMT is not set
136# CONFIG_PERMIT_BSP_REMOVE is not set
122# CONFIG_PREEMPT is not set 137# CONFIG_PREEMPT is not set
123CONFIG_SELECT_MEMORY_MODEL=y 138CONFIG_SELECT_MEMORY_MODEL=y
124# CONFIG_FLATMEM_MANUAL is not set 139# CONFIG_FLATMEM_MANUAL is not set
@@ -130,21 +145,34 @@ CONFIG_NEED_MULTIPLE_NODES=y
130# CONFIG_SPARSEMEM_STATIC is not set 145# CONFIG_SPARSEMEM_STATIC is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4 146CONFIG_SPLIT_PTLOCK_CPUS=4
132CONFIG_MIGRATION=y 147CONFIG_MIGRATION=y
148CONFIG_RESOURCES_64BIT=y
149CONFIG_ZONE_DMA_FLAG=1
133CONFIG_ARCH_SELECT_MEMORY_MODEL=y 150CONFIG_ARCH_SELECT_MEMORY_MODEL=y
134CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 151CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
135CONFIG_ARCH_FLATMEM_ENABLE=y 152CONFIG_ARCH_FLATMEM_ENABLE=y
136CONFIG_ARCH_SPARSEMEM_ENABLE=y 153CONFIG_ARCH_SPARSEMEM_ENABLE=y
137CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y 154CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
138CONFIG_NUMA=y 155CONFIG_NUMA=y
156CONFIG_NODES_SHIFT=10
157CONFIG_ARCH_POPULATES_NODE_MAP=y
139CONFIG_VIRTUAL_MEM_MAP=y 158CONFIG_VIRTUAL_MEM_MAP=y
140CONFIG_HOLES_IN_ZONE=y 159CONFIG_HOLES_IN_ZONE=y
141CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 160CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
161CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
142CONFIG_IA32_SUPPORT=y 162CONFIG_IA32_SUPPORT=y
143CONFIG_COMPAT=y 163CONFIG_COMPAT=y
144CONFIG_IA64_MCA_RECOVERY=y 164CONFIG_IA64_MCA_RECOVERY=y
145CONFIG_PERFMON=y 165CONFIG_PERFMON=y
146CONFIG_IA64_PALINFO=y 166CONFIG_IA64_PALINFO=y
147CONFIG_SGI_SN=y 167CONFIG_SGI_SN=y
168# CONFIG_IA64_ESI is not set
169
170#
171# SN Devices
172#
173CONFIG_SGI_IOC3=m
174CONFIG_KEXEC=y
175CONFIG_CRASH_DUMP=y
148 176
149# 177#
150# Firmware Drivers 178# Firmware Drivers
@@ -160,13 +188,16 @@ CONFIG_BINFMT_MISC=m
160CONFIG_PM=y 188CONFIG_PM=y
161CONFIG_PM_LEGACY=y 189CONFIG_PM_LEGACY=y
162# CONFIG_PM_DEBUG is not set 190# CONFIG_PM_DEBUG is not set
191# CONFIG_PM_SYSFS_DEPRECATED is not set
163 192
164# 193#
165# ACPI (Advanced Configuration and Power Interface) Support 194# ACPI (Advanced Configuration and Power Interface) Support
166# 195#
167CONFIG_ACPI=y 196CONFIG_ACPI=y
197CONFIG_ACPI_PROCFS=y
168CONFIG_ACPI_BUTTON=m 198CONFIG_ACPI_BUTTON=m
169CONFIG_ACPI_FAN=m 199CONFIG_ACPI_FAN=m
200# CONFIG_ACPI_DOCK is not set
170CONFIG_ACPI_PROCESSOR=m 201CONFIG_ACPI_PROCESSOR=m
171CONFIG_ACPI_HOTPLUG_CPU=y 202CONFIG_ACPI_HOTPLUG_CPU=y
172CONFIG_ACPI_THERMAL=m 203CONFIG_ACPI_THERMAL=m
@@ -188,8 +219,8 @@ CONFIG_ACPI_CONTAINER=m
188# 219#
189CONFIG_PCI=y 220CONFIG_PCI=y
190CONFIG_PCI_DOMAINS=y 221CONFIG_PCI_DOMAINS=y
222# CONFIG_PCIEPORTBUS is not set
191# CONFIG_PCI_MSI is not set 223# CONFIG_PCI_MSI is not set
192CONFIG_PCI_LEGACY_PROC=y
193# CONFIG_PCI_DEBUG is not set 224# CONFIG_PCI_DEBUG is not set
194 225
195# 226#
@@ -220,6 +251,10 @@ CONFIG_NET=y
220CONFIG_PACKET=y 251CONFIG_PACKET=y
221# CONFIG_PACKET_MMAP is not set 252# CONFIG_PACKET_MMAP is not set
222CONFIG_UNIX=y 253CONFIG_UNIX=y
254CONFIG_XFRM=y
255# CONFIG_XFRM_USER is not set
256# CONFIG_XFRM_SUB_POLICY is not set
257# CONFIG_XFRM_MIGRATE is not set
223# CONFIG_NET_KEY is not set 258# CONFIG_NET_KEY is not set
224CONFIG_INET=y 259CONFIG_INET=y
225CONFIG_IP_MULTICAST=y 260CONFIG_IP_MULTICAST=y
@@ -234,12 +269,21 @@ CONFIG_SYN_COOKIES=y
234# CONFIG_INET_AH is not set 269# CONFIG_INET_AH is not set
235# CONFIG_INET_ESP is not set 270# CONFIG_INET_ESP is not set
236# CONFIG_INET_IPCOMP is not set 271# CONFIG_INET_IPCOMP is not set
272# CONFIG_INET_XFRM_TUNNEL is not set
237# CONFIG_INET_TUNNEL is not set 273# CONFIG_INET_TUNNEL is not set
274CONFIG_INET_XFRM_MODE_TRANSPORT=y
275CONFIG_INET_XFRM_MODE_TUNNEL=y
276CONFIG_INET_XFRM_MODE_BEET=y
238CONFIG_INET_DIAG=y 277CONFIG_INET_DIAG=y
239CONFIG_INET_TCP_DIAG=y 278CONFIG_INET_TCP_DIAG=y
240# CONFIG_TCP_CONG_ADVANCED is not set 279# CONFIG_TCP_CONG_ADVANCED is not set
241CONFIG_TCP_CONG_BIC=y 280CONFIG_TCP_CONG_CUBIC=y
281CONFIG_DEFAULT_TCP_CONG="cubic"
282# CONFIG_TCP_MD5SIG is not set
242# CONFIG_IPV6 is not set 283# CONFIG_IPV6 is not set
284# CONFIG_INET6_XFRM_TUNNEL is not set
285# CONFIG_INET6_TUNNEL is not set
286# CONFIG_NETWORK_SECMARK is not set
243# CONFIG_NETFILTER is not set 287# CONFIG_NETFILTER is not set
244 288
245# 289#
@@ -265,7 +309,6 @@ CONFIG_TCP_CONG_BIC=y
265# CONFIG_ATALK is not set 309# CONFIG_ATALK is not set
266# CONFIG_X25 is not set 310# CONFIG_X25 is not set
267# CONFIG_LAPB is not set 311# CONFIG_LAPB is not set
268# CONFIG_NET_DIVERT is not set
269# CONFIG_ECONET is not set 312# CONFIG_ECONET is not set
270# CONFIG_WAN_ROUTER is not set 313# CONFIG_WAN_ROUTER is not set
271 314
@@ -294,6 +337,8 @@ CONFIG_STANDALONE=y
294CONFIG_PREVENT_FIRMWARE_BUILD=y 337CONFIG_PREVENT_FIRMWARE_BUILD=y
295CONFIG_FW_LOADER=m 338CONFIG_FW_LOADER=m
296# CONFIG_DEBUG_DRIVER is not set 339# CONFIG_DEBUG_DRIVER is not set
340# CONFIG_DEBUG_DEVRES is not set
341# CONFIG_SYS_HYPERVISOR is not set
297 342
298# 343#
299# Connector - unified userspace <-> kernelspace linker 344# Connector - unified userspace <-> kernelspace linker
@@ -337,11 +382,17 @@ CONFIG_BLK_DEV_NBD=m
337CONFIG_BLK_DEV_RAM=y 382CONFIG_BLK_DEV_RAM=y
338CONFIG_BLK_DEV_RAM_COUNT=16 383CONFIG_BLK_DEV_RAM_COUNT=16
339CONFIG_BLK_DEV_RAM_SIZE=4096 384CONFIG_BLK_DEV_RAM_SIZE=4096
340CONFIG_BLK_DEV_INITRD=y 385CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
341# CONFIG_CDROM_PKTCDVD is not set 386# CONFIG_CDROM_PKTCDVD is not set
342# CONFIG_ATA_OVER_ETH is not set 387# CONFIG_ATA_OVER_ETH is not set
343 388
344# 389#
390# Misc devices
391#
392CONFIG_SGI_IOC4=y
393# CONFIG_TIFM_CORE is not set
394
395#
345# ATA/ATAPI/MFM/RLL support 396# ATA/ATAPI/MFM/RLL support
346# 397#
347CONFIG_IDE=y 398CONFIG_IDE=y
@@ -358,6 +409,7 @@ CONFIG_BLK_DEV_IDECD=y
358# CONFIG_BLK_DEV_IDETAPE is not set 409# CONFIG_BLK_DEV_IDETAPE is not set
359CONFIG_BLK_DEV_IDEFLOPPY=y 410CONFIG_BLK_DEV_IDEFLOPPY=y
360CONFIG_BLK_DEV_IDESCSI=m 411CONFIG_BLK_DEV_IDESCSI=m
412# CONFIG_BLK_DEV_IDEACPI is not set
361# CONFIG_IDE_TASK_IOCTL is not set 413# CONFIG_IDE_TASK_IOCTL is not set
362 414
363# 415#
@@ -384,8 +436,10 @@ CONFIG_BLK_DEV_CMD64X=y
384# CONFIG_BLK_DEV_CS5530 is not set 436# CONFIG_BLK_DEV_CS5530 is not set
385# CONFIG_BLK_DEV_HPT34X is not set 437# CONFIG_BLK_DEV_HPT34X is not set
386# CONFIG_BLK_DEV_HPT366 is not set 438# CONFIG_BLK_DEV_HPT366 is not set
439# CONFIG_BLK_DEV_JMICRON is not set
387# CONFIG_BLK_DEV_SC1200 is not set 440# CONFIG_BLK_DEV_SC1200 is not set
388CONFIG_BLK_DEV_PIIX=y 441CONFIG_BLK_DEV_PIIX=y
442# CONFIG_BLK_DEV_IT8213 is not set
389# CONFIG_BLK_DEV_IT821X is not set 443# CONFIG_BLK_DEV_IT821X is not set
390# CONFIG_BLK_DEV_NS87415 is not set 444# CONFIG_BLK_DEV_NS87415 is not set
391# CONFIG_BLK_DEV_PDC202XX_OLD is not set 445# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -396,6 +450,7 @@ CONFIG_BLK_DEV_SGIIOC4=y
396# CONFIG_BLK_DEV_SLC90E66 is not set 450# CONFIG_BLK_DEV_SLC90E66 is not set
397# CONFIG_BLK_DEV_TRM290 is not set 451# CONFIG_BLK_DEV_TRM290 is not set
398# CONFIG_BLK_DEV_VIA82CXXX is not set 452# CONFIG_BLK_DEV_VIA82CXXX is not set
453# CONFIG_BLK_DEV_TC86C001 is not set
399# CONFIG_IDE_ARM is not set 454# CONFIG_IDE_ARM is not set
400CONFIG_BLK_DEV_IDEDMA=y 455CONFIG_BLK_DEV_IDEDMA=y
401# CONFIG_IDEDMA_IVB is not set 456# CONFIG_IDEDMA_IVB is not set
@@ -407,6 +462,8 @@ CONFIG_IDEDMA_AUTO=y
407# 462#
408# CONFIG_RAID_ATTRS is not set 463# CONFIG_RAID_ATTRS is not set
409CONFIG_SCSI=y 464CONFIG_SCSI=y
465# CONFIG_SCSI_TGT is not set
466CONFIG_SCSI_NETLINK=y
410CONFIG_SCSI_PROC_FS=y 467CONFIG_SCSI_PROC_FS=y
411 468
412# 469#
@@ -426,14 +483,16 @@ CONFIG_CHR_DEV_SG=m
426# CONFIG_SCSI_MULTI_LUN is not set 483# CONFIG_SCSI_MULTI_LUN is not set
427# CONFIG_SCSI_CONSTANTS is not set 484# CONFIG_SCSI_CONSTANTS is not set
428# CONFIG_SCSI_LOGGING is not set 485# CONFIG_SCSI_LOGGING is not set
486# CONFIG_SCSI_SCAN_ASYNC is not set
429 487
430# 488#
431# SCSI Transport Attributes 489# SCSI Transports
432# 490#
433CONFIG_SCSI_SPI_ATTRS=y 491CONFIG_SCSI_SPI_ATTRS=y
434CONFIG_SCSI_FC_ATTRS=y 492CONFIG_SCSI_FC_ATTRS=y
435# CONFIG_SCSI_ISCSI_ATTRS is not set 493# CONFIG_SCSI_ISCSI_ATTRS is not set
436# CONFIG_SCSI_SAS_ATTRS is not set 494# CONFIG_SCSI_SAS_ATTRS is not set
495# CONFIG_SCSI_SAS_LIBSAS is not set
437 496
438# 497#
439# SCSI low-level drivers 498# SCSI low-level drivers
@@ -446,43 +505,36 @@ CONFIG_SCSI_FC_ATTRS=y
446# CONFIG_SCSI_AIC7XXX is not set 505# CONFIG_SCSI_AIC7XXX is not set
447# CONFIG_SCSI_AIC7XXX_OLD is not set 506# CONFIG_SCSI_AIC7XXX_OLD is not set
448# CONFIG_SCSI_AIC79XX is not set 507# CONFIG_SCSI_AIC79XX is not set
508# CONFIG_SCSI_AIC94XX is not set
509# CONFIG_SCSI_ARCMSR is not set
449# CONFIG_MEGARAID_NEWGEN is not set 510# CONFIG_MEGARAID_NEWGEN is not set
450# CONFIG_MEGARAID_LEGACY is not set 511# CONFIG_MEGARAID_LEGACY is not set
451# CONFIG_MEGARAID_SAS is not set 512# CONFIG_MEGARAID_SAS is not set
452CONFIG_SCSI_SATA=y 513# CONFIG_SCSI_HPTIOP is not set
453# CONFIG_SCSI_SATA_AHCI is not set
454# CONFIG_SCSI_SATA_SVW is not set
455# CONFIG_SCSI_ATA_PIIX is not set
456# CONFIG_SCSI_SATA_MV is not set
457# CONFIG_SCSI_SATA_NV is not set
458# CONFIG_SCSI_PDC_ADMA is not set
459# CONFIG_SCSI_SATA_QSTOR is not set
460# CONFIG_SCSI_SATA_PROMISE is not set
461# CONFIG_SCSI_SATA_SX4 is not set
462# CONFIG_SCSI_SATA_SIL is not set
463# CONFIG_SCSI_SATA_SIL24 is not set
464# CONFIG_SCSI_SATA_SIS is not set
465# CONFIG_SCSI_SATA_ULI is not set
466# CONFIG_SCSI_SATA_VIA is not set
467CONFIG_SCSI_SATA_VITESSE=y
468# CONFIG_SCSI_DMX3191D is not set 514# CONFIG_SCSI_DMX3191D is not set
469# CONFIG_SCSI_FUTURE_DOMAIN is not set 515# CONFIG_SCSI_FUTURE_DOMAIN is not set
470# CONFIG_SCSI_IPS is not set 516# CONFIG_SCSI_IPS is not set
471# CONFIG_SCSI_INITIO is not set 517# CONFIG_SCSI_INITIO is not set
472# CONFIG_SCSI_INIA100 is not set 518# CONFIG_SCSI_INIA100 is not set
519# CONFIG_SCSI_STEX is not set
473CONFIG_SCSI_SYM53C8XX_2=y 520CONFIG_SCSI_SYM53C8XX_2=y
474CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 521CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
475CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 522CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
476CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 523CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
477# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 524CONFIG_SCSI_SYM53C8XX_MMIO=y
478# CONFIG_SCSI_IPR is not set
479# CONFIG_SCSI_QLOGIC_FC is not set
480CONFIG_SCSI_QLOGIC_1280=y 525CONFIG_SCSI_QLOGIC_1280=y
481# CONFIG_SCSI_QLA_FC is not set 526# CONFIG_SCSI_QLA_FC is not set
527# CONFIG_SCSI_QLA_ISCSI is not set
482# CONFIG_SCSI_LPFC is not set 528# CONFIG_SCSI_LPFC is not set
483# CONFIG_SCSI_DC395x is not set 529# CONFIG_SCSI_DC395x is not set
484# CONFIG_SCSI_DC390T is not set 530# CONFIG_SCSI_DC390T is not set
485# CONFIG_SCSI_DEBUG is not set 531# CONFIG_SCSI_DEBUG is not set
532# CONFIG_SCSI_SRP is not set
533
534#
535# Serial ATA (prod) and Parallel ATA (experimental) drivers
536#
537# CONFIG_ATA is not set
486 538
487# 539#
488# Multi-device support (RAID and LVM) 540# Multi-device support (RAID and LVM)
@@ -493,11 +545,11 @@ CONFIG_MD_LINEAR=m
493CONFIG_MD_RAID0=m 545CONFIG_MD_RAID0=m
494CONFIG_MD_RAID1=m 546CONFIG_MD_RAID1=m
495# CONFIG_MD_RAID10 is not set 547# CONFIG_MD_RAID10 is not set
496CONFIG_MD_RAID5=m 548# CONFIG_MD_RAID456 is not set
497CONFIG_MD_RAID6=m
498CONFIG_MD_MULTIPATH=m 549CONFIG_MD_MULTIPATH=m
499# CONFIG_MD_FAULTY is not set 550# CONFIG_MD_FAULTY is not set
500CONFIG_BLK_DEV_DM=m 551CONFIG_BLK_DEV_DM=m
552# CONFIG_DM_DEBUG is not set
501CONFIG_DM_CRYPT=m 553CONFIG_DM_CRYPT=m
502CONFIG_DM_SNAPSHOT=m 554CONFIG_DM_SNAPSHOT=m
503CONFIG_DM_MIRROR=m 555CONFIG_DM_MIRROR=m
@@ -587,6 +639,7 @@ CONFIG_E100=m
587# CONFIG_EPIC100 is not set 639# CONFIG_EPIC100 is not set
588# CONFIG_SUNDANCE is not set 640# CONFIG_SUNDANCE is not set
589# CONFIG_VIA_RHINE is not set 641# CONFIG_VIA_RHINE is not set
642# CONFIG_SC92031 is not set
590 643
591# 644#
592# Ethernet (1000 Mbit) 645# Ethernet (1000 Mbit)
@@ -607,13 +660,18 @@ CONFIG_E1000=y
607# CONFIG_VIA_VELOCITY is not set 660# CONFIG_VIA_VELOCITY is not set
608CONFIG_TIGON3=y 661CONFIG_TIGON3=y
609# CONFIG_BNX2 is not set 662# CONFIG_BNX2 is not set
663# CONFIG_QLA3XXX is not set
664# CONFIG_ATL1 is not set
610 665
611# 666#
612# Ethernet (10000 Mbit) 667# Ethernet (10000 Mbit)
613# 668#
614# CONFIG_CHELSIO_T1 is not set 669# CONFIG_CHELSIO_T1 is not set
670# CONFIG_CHELSIO_T3 is not set
615# CONFIG_IXGB is not set 671# CONFIG_IXGB is not set
616# CONFIG_S2IO is not set 672# CONFIG_S2IO is not set
673# CONFIG_MYRI10GE is not set
674# CONFIG_NETXEN_NIC is not set
617 675
618# 676#
619# Token Ring devices 677# Token Ring devices
@@ -655,6 +713,7 @@ CONFIG_NET_POLL_CONTROLLER=y
655# Input device support 713# Input device support
656# 714#
657CONFIG_INPUT=y 715CONFIG_INPUT=y
716# CONFIG_INPUT_FF_MEMLESS is not set
658 717
659# 718#
660# Userland interfaces 719# Userland interfaces
@@ -677,6 +736,7 @@ CONFIG_KEYBOARD_ATKBD=y
677# CONFIG_KEYBOARD_LKKBD is not set 736# CONFIG_KEYBOARD_LKKBD is not set
678# CONFIG_KEYBOARD_XTKBD is not set 737# CONFIG_KEYBOARD_XTKBD is not set
679# CONFIG_KEYBOARD_NEWTON is not set 738# CONFIG_KEYBOARD_NEWTON is not set
739# CONFIG_KEYBOARD_STOWAWAY is not set
680CONFIG_INPUT_MOUSE=y 740CONFIG_INPUT_MOUSE=y
681CONFIG_MOUSE_PS2=y 741CONFIG_MOUSE_PS2=y
682# CONFIG_MOUSE_SERIAL is not set 742# CONFIG_MOUSE_SERIAL is not set
@@ -706,6 +766,7 @@ CONFIG_GAMEPORT=m
706CONFIG_VT=y 766CONFIG_VT=y
707CONFIG_VT_CONSOLE=y 767CONFIG_VT_CONSOLE=y
708CONFIG_HW_CONSOLE=y 768CONFIG_HW_CONSOLE=y
769# CONFIG_VT_HW_CONSOLE_BINDING is not set
709CONFIG_SERIAL_NONSTANDARD=y 770CONFIG_SERIAL_NONSTANDARD=y
710# CONFIG_COMPUTONE is not set 771# CONFIG_COMPUTONE is not set
711# CONFIG_ROCKETPORT is not set 772# CONFIG_ROCKETPORT is not set
@@ -713,12 +774,14 @@ CONFIG_SERIAL_NONSTANDARD=y
713# CONFIG_DIGIEPCA is not set 774# CONFIG_DIGIEPCA is not set
714# CONFIG_MOXA_INTELLIO is not set 775# CONFIG_MOXA_INTELLIO is not set
715# CONFIG_MOXA_SMARTIO is not set 776# CONFIG_MOXA_SMARTIO is not set
777# CONFIG_MOXA_SMARTIO_NEW is not set
716# CONFIG_ISI is not set 778# CONFIG_ISI is not set
717# CONFIG_SYNCLINKMP is not set 779# CONFIG_SYNCLINKMP is not set
718# CONFIG_SYNCLINK_GT is not set 780# CONFIG_SYNCLINK_GT is not set
719# CONFIG_N_HDLC is not set 781# CONFIG_N_HDLC is not set
720# CONFIG_SPECIALIX is not set 782# CONFIG_SPECIALIX is not set
721# CONFIG_SX is not set 783# CONFIG_SX is not set
784# CONFIG_RIO is not set
722# CONFIG_STALDRV is not set 785# CONFIG_STALDRV is not set
723CONFIG_SGI_SNSC=y 786CONFIG_SGI_SNSC=y
724CONFIG_SGI_TIOCX=y 787CONFIG_SGI_TIOCX=y
@@ -729,7 +792,8 @@ CONFIG_SGI_MBCS=m
729# 792#
730CONFIG_SERIAL_8250=y 793CONFIG_SERIAL_8250=y
731CONFIG_SERIAL_8250_CONSOLE=y 794CONFIG_SERIAL_8250_CONSOLE=y
732CONFIG_SERIAL_8250_ACPI=y 795CONFIG_SERIAL_8250_PCI=y
796CONFIG_SERIAL_8250_PNP=y
733CONFIG_SERIAL_8250_NR_UARTS=6 797CONFIG_SERIAL_8250_NR_UARTS=6
734CONFIG_SERIAL_8250_RUNTIME_UARTS=4 798CONFIG_SERIAL_8250_RUNTIME_UARTS=4
735CONFIG_SERIAL_8250_EXTENDED=y 799CONFIG_SERIAL_8250_EXTENDED=y
@@ -764,10 +828,6 @@ CONFIG_EFI_RTC=y
764# CONFIG_DTLK is not set 828# CONFIG_DTLK is not set
765# CONFIG_R3964 is not set 829# CONFIG_R3964 is not set
766# CONFIG_APPLICOM is not set 830# CONFIG_APPLICOM is not set
767
768#
769# Ftape, the floppy tape device driver
770#
771CONFIG_AGP=m 831CONFIG_AGP=m
772CONFIG_AGP_I460=m 832CONFIG_AGP_I460=m
773CONFIG_AGP_HP_ZX1=m 833CONFIG_AGP_HP_ZX1=m
@@ -792,7 +852,6 @@ CONFIG_MMTIMER=y
792# TPM devices 852# TPM devices
793# 853#
794# CONFIG_TCG_TPM is not set 854# CONFIG_TCG_TPM is not set
795# CONFIG_TELCLOCK is not set
796 855
797# 856#
798# I2C support 857# I2C support
@@ -815,16 +874,16 @@ CONFIG_MMTIMER=y
815# 874#
816CONFIG_HWMON=y 875CONFIG_HWMON=y
817# CONFIG_HWMON_VID is not set 876# CONFIG_HWMON_VID is not set
877# CONFIG_SENSORS_ABITUGURU is not set
818# CONFIG_SENSORS_F71805F is not set 878# CONFIG_SENSORS_F71805F is not set
879# CONFIG_SENSORS_PC87427 is not set
880# CONFIG_SENSORS_VT1211 is not set
819# CONFIG_HWMON_DEBUG_CHIP is not set 881# CONFIG_HWMON_DEBUG_CHIP is not set
820 882
821# 883#
822# Misc devices 884# Multifunction device drivers
823#
824
825#
826# Multimedia Capabilities Port drivers
827# 885#
886# CONFIG_MFD_SM501 is not set
828 887
829# 888#
830# Multimedia devices 889# Multimedia devices
@@ -835,16 +894,19 @@ CONFIG_HWMON=y
835# Digital Video Broadcasting Devices 894# Digital Video Broadcasting Devices
836# 895#
837# CONFIG_DVB is not set 896# CONFIG_DVB is not set
897# CONFIG_USB_DABUSB is not set
838 898
839# 899#
840# Graphics support 900# Graphics support
841# 901#
902# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
842# CONFIG_FB is not set 903# CONFIG_FB is not set
843 904
844# 905#
845# Console display driver support 906# Console display driver support
846# 907#
847CONFIG_VGA_CONSOLE=y 908CONFIG_VGA_CONSOLE=y
909# CONFIG_VGACON_SOFT_SCROLLBACK is not set
848CONFIG_DUMMY_CONSOLE=y 910CONFIG_DUMMY_CONSOLE=y
849 911
850# 912#
@@ -865,9 +927,11 @@ CONFIG_SND_SEQ_DUMMY=m
865CONFIG_SND_OSSEMUL=y 927CONFIG_SND_OSSEMUL=y
866CONFIG_SND_MIXER_OSS=m 928CONFIG_SND_MIXER_OSS=m
867CONFIG_SND_PCM_OSS=m 929CONFIG_SND_PCM_OSS=m
930CONFIG_SND_PCM_OSS_PLUGINS=y
868CONFIG_SND_SEQUENCER_OSS=y 931CONFIG_SND_SEQUENCER_OSS=y
869# CONFIG_SND_DYNAMIC_MINORS is not set 932# CONFIG_SND_DYNAMIC_MINORS is not set
870CONFIG_SND_SUPPORT_OLD_API=y 933CONFIG_SND_SUPPORT_OLD_API=y
934CONFIG_SND_VERBOSE_PROCFS=y
871CONFIG_SND_VERBOSE_PRINTK=y 935CONFIG_SND_VERBOSE_PRINTK=y
872# CONFIG_SND_DEBUG is not set 936# CONFIG_SND_DEBUG is not set
873 937
@@ -877,7 +941,6 @@ CONFIG_SND_VERBOSE_PRINTK=y
877CONFIG_SND_MPU401_UART=m 941CONFIG_SND_MPU401_UART=m
878CONFIG_SND_OPL3_LIB=m 942CONFIG_SND_OPL3_LIB=m
879CONFIG_SND_AC97_CODEC=m 943CONFIG_SND_AC97_CODEC=m
880CONFIG_SND_AC97_BUS=m
881CONFIG_SND_DUMMY=m 944CONFIG_SND_DUMMY=m
882CONFIG_SND_VIRMIDI=m 945CONFIG_SND_VIRMIDI=m
883CONFIG_SND_MTPAV=m 946CONFIG_SND_MTPAV=m
@@ -888,6 +951,7 @@ CONFIG_SND_MPU401=m
888# PCI devices 951# PCI devices
889# 952#
890# CONFIG_SND_AD1889 is not set 953# CONFIG_SND_AD1889 is not set
954# CONFIG_SND_ALS300 is not set
891# CONFIG_SND_ALI5451 is not set 955# CONFIG_SND_ALI5451 is not set
892# CONFIG_SND_ATIIXP is not set 956# CONFIG_SND_ATIIXP is not set
893# CONFIG_SND_ATIIXP_MODEM is not set 957# CONFIG_SND_ATIIXP_MODEM is not set
@@ -901,6 +965,18 @@ CONFIG_SND_MPU401=m
901CONFIG_SND_CS4281=m 965CONFIG_SND_CS4281=m
902CONFIG_SND_CS46XX=m 966CONFIG_SND_CS46XX=m
903CONFIG_SND_CS46XX_NEW_DSP=y 967CONFIG_SND_CS46XX_NEW_DSP=y
968# CONFIG_SND_DARLA20 is not set
969# CONFIG_SND_GINA20 is not set
970# CONFIG_SND_LAYLA20 is not set
971# CONFIG_SND_DARLA24 is not set
972# CONFIG_SND_GINA24 is not set
973# CONFIG_SND_LAYLA24 is not set
974# CONFIG_SND_MONA is not set
975# CONFIG_SND_MIA is not set
976# CONFIG_SND_ECHO3G is not set
977# CONFIG_SND_INDIGO is not set
978# CONFIG_SND_INDIGOIO is not set
979# CONFIG_SND_INDIGODJ is not set
904CONFIG_SND_EMU10K1=m 980CONFIG_SND_EMU10K1=m
905# CONFIG_SND_EMU10K1X is not set 981# CONFIG_SND_EMU10K1X is not set
906# CONFIG_SND_ENS1370 is not set 982# CONFIG_SND_ENS1370 is not set
@@ -908,7 +984,7 @@ CONFIG_SND_EMU10K1=m
908# CONFIG_SND_ES1938 is not set 984# CONFIG_SND_ES1938 is not set
909# CONFIG_SND_ES1968 is not set 985# CONFIG_SND_ES1968 is not set
910CONFIG_SND_FM801=m 986CONFIG_SND_FM801=m
911# CONFIG_SND_FM801_TEA575X is not set 987# CONFIG_SND_FM801_TEA575X_BOOL is not set
912# CONFIG_SND_HDA_INTEL is not set 988# CONFIG_SND_HDA_INTEL is not set
913# CONFIG_SND_HDSP is not set 989# CONFIG_SND_HDSP is not set
914# CONFIG_SND_HDSPM is not set 990# CONFIG_SND_HDSPM is not set
@@ -921,6 +997,7 @@ CONFIG_SND_FM801=m
921# CONFIG_SND_MIXART is not set 997# CONFIG_SND_MIXART is not set
922# CONFIG_SND_NM256 is not set 998# CONFIG_SND_NM256 is not set
923# CONFIG_SND_PCXHR is not set 999# CONFIG_SND_PCXHR is not set
1000# CONFIG_SND_RIPTIDE is not set
924# CONFIG_SND_RME32 is not set 1001# CONFIG_SND_RME32 is not set
925# CONFIG_SND_RME96 is not set 1002# CONFIG_SND_RME96 is not set
926# CONFIG_SND_RME9652 is not set 1003# CONFIG_SND_RME9652 is not set
@@ -930,6 +1007,7 @@ CONFIG_SND_FM801=m
930# CONFIG_SND_VIA82XX_MODEM is not set 1007# CONFIG_SND_VIA82XX_MODEM is not set
931# CONFIG_SND_VX222 is not set 1008# CONFIG_SND_VX222 is not set
932# CONFIG_SND_YMFPCI is not set 1009# CONFIG_SND_YMFPCI is not set
1010# CONFIG_SND_AC97_POWER_SAVE is not set
933 1011
934# 1012#
935# USB devices 1013# USB devices
@@ -937,15 +1015,28 @@ CONFIG_SND_FM801=m
937# CONFIG_SND_USB_AUDIO is not set 1015# CONFIG_SND_USB_AUDIO is not set
938 1016
939# 1017#
1018# SoC audio support
1019#
1020# CONFIG_SND_SOC is not set
1021
1022#
940# Open Sound System 1023# Open Sound System
941# 1024#
942# CONFIG_SOUND_PRIME is not set 1025# CONFIG_SOUND_PRIME is not set
1026CONFIG_AC97_BUS=m
1027
1028#
1029# HID Devices
1030#
1031CONFIG_HID=y
1032# CONFIG_HID_DEBUG is not set
943 1033
944# 1034#
945# USB support 1035# USB support
946# 1036#
947CONFIG_USB_ARCH_HAS_HCD=y 1037CONFIG_USB_ARCH_HAS_HCD=y
948CONFIG_USB_ARCH_HAS_OHCI=y 1038CONFIG_USB_ARCH_HAS_OHCI=y
1039CONFIG_USB_ARCH_HAS_EHCI=y
949CONFIG_USB=m 1040CONFIG_USB=m
950# CONFIG_USB_DEBUG is not set 1041# CONFIG_USB_DEBUG is not set
951 1042
@@ -953,7 +1044,6 @@ CONFIG_USB=m
953# Miscellaneous USB options 1044# Miscellaneous USB options
954# 1045#
955CONFIG_USB_DEVICEFS=y 1046CONFIG_USB_DEVICEFS=y
956# CONFIG_USB_BANDWIDTH is not set
957# CONFIG_USB_DYNAMIC_MINORS is not set 1047# CONFIG_USB_DYNAMIC_MINORS is not set
958# CONFIG_USB_SUSPEND is not set 1048# CONFIG_USB_SUSPEND is not set
959# CONFIG_USB_OTG is not set 1049# CONFIG_USB_OTG is not set
@@ -964,9 +1054,12 @@ CONFIG_USB_DEVICEFS=y
964CONFIG_USB_EHCI_HCD=m 1054CONFIG_USB_EHCI_HCD=m
965# CONFIG_USB_EHCI_SPLIT_ISO is not set 1055# CONFIG_USB_EHCI_SPLIT_ISO is not set
966# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1056# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1057# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1058# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
967# CONFIG_USB_ISP116X_HCD is not set 1059# CONFIG_USB_ISP116X_HCD is not set
968CONFIG_USB_OHCI_HCD=m 1060CONFIG_USB_OHCI_HCD=m
969# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1061# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1062# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
970CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1063CONFIG_USB_OHCI_LITTLE_ENDIAN=y
971CONFIG_USB_UHCI_HCD=m 1064CONFIG_USB_UHCI_HCD=m
972# CONFIG_USB_SL811_HCD is not set 1065# CONFIG_USB_SL811_HCD is not set
@@ -974,7 +1067,6 @@ CONFIG_USB_UHCI_HCD=m
974# 1067#
975# USB Device Class drivers 1068# USB Device Class drivers
976# 1069#
977# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
978# CONFIG_USB_ACM is not set 1070# CONFIG_USB_ACM is not set
979# CONFIG_USB_PRINTER is not set 1071# CONFIG_USB_PRINTER is not set
980 1072
@@ -996,13 +1088,13 @@ CONFIG_USB_STORAGE=m
996# CONFIG_USB_STORAGE_SDDR55 is not set 1088# CONFIG_USB_STORAGE_SDDR55 is not set
997# CONFIG_USB_STORAGE_JUMPSHOT is not set 1089# CONFIG_USB_STORAGE_JUMPSHOT is not set
998# CONFIG_USB_STORAGE_ALAUDA is not set 1090# CONFIG_USB_STORAGE_ALAUDA is not set
1091# CONFIG_USB_STORAGE_KARMA is not set
999# CONFIG_USB_LIBUSUAL is not set 1092# CONFIG_USB_LIBUSUAL is not set
1000 1093
1001# 1094#
1002# USB Input Devices 1095# USB Input Devices
1003# 1096#
1004CONFIG_USB_HID=m 1097CONFIG_USB_HID=m
1005CONFIG_USB_HIDINPUT=y
1006# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1098# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1007# CONFIG_HID_FF is not set 1099# CONFIG_HID_FF is not set
1008# CONFIG_USB_HIDDEV is not set 1100# CONFIG_USB_HIDDEV is not set
@@ -1017,15 +1109,14 @@ CONFIG_USB_HIDINPUT=y
1017# CONFIG_USB_ACECAD is not set 1109# CONFIG_USB_ACECAD is not set
1018# CONFIG_USB_KBTAB is not set 1110# CONFIG_USB_KBTAB is not set
1019# CONFIG_USB_POWERMATE is not set 1111# CONFIG_USB_POWERMATE is not set
1020# CONFIG_USB_MTOUCH is not set 1112# CONFIG_USB_TOUCHSCREEN is not set
1021# CONFIG_USB_ITMTOUCH is not set
1022# CONFIG_USB_EGALAX is not set
1023# CONFIG_USB_YEALINK is not set 1113# CONFIG_USB_YEALINK is not set
1024# CONFIG_USB_XPAD is not set 1114# CONFIG_USB_XPAD is not set
1025# CONFIG_USB_ATI_REMOTE is not set 1115# CONFIG_USB_ATI_REMOTE is not set
1026# CONFIG_USB_ATI_REMOTE2 is not set 1116# CONFIG_USB_ATI_REMOTE2 is not set
1027# CONFIG_USB_KEYSPAN_REMOTE is not set 1117# CONFIG_USB_KEYSPAN_REMOTE is not set
1028# CONFIG_USB_APPLETOUCH is not set 1118# CONFIG_USB_APPLETOUCH is not set
1119# CONFIG_USB_GTCO is not set
1029 1120
1030# 1121#
1031# USB Imaging devices 1122# USB Imaging devices
@@ -1034,21 +1125,13 @@ CONFIG_USB_HIDINPUT=y
1034# CONFIG_USB_MICROTEK is not set 1125# CONFIG_USB_MICROTEK is not set
1035 1126
1036# 1127#
1037# USB Multimedia devices
1038#
1039# CONFIG_USB_DABUSB is not set
1040
1041#
1042# Video4Linux support is needed for USB Multimedia device support
1043#
1044
1045#
1046# USB Network Adapters 1128# USB Network Adapters
1047# 1129#
1048# CONFIG_USB_CATC is not set 1130# CONFIG_USB_CATC is not set
1049# CONFIG_USB_KAWETH is not set 1131# CONFIG_USB_KAWETH is not set
1050# CONFIG_USB_PEGASUS is not set 1132# CONFIG_USB_PEGASUS is not set
1051# CONFIG_USB_RTL8150 is not set 1133# CONFIG_USB_RTL8150 is not set
1134# CONFIG_USB_USBNET_MII is not set
1052# CONFIG_USB_USBNET is not set 1135# CONFIG_USB_USBNET is not set
1053CONFIG_USB_MON=y 1136CONFIG_USB_MON=y
1054 1137
@@ -1066,17 +1149,23 @@ CONFIG_USB_MON=y
1066# 1149#
1067# CONFIG_USB_EMI62 is not set 1150# CONFIG_USB_EMI62 is not set
1068# CONFIG_USB_EMI26 is not set 1151# CONFIG_USB_EMI26 is not set
1152# CONFIG_USB_ADUTUX is not set
1069# CONFIG_USB_AUERSWALD is not set 1153# CONFIG_USB_AUERSWALD is not set
1070# CONFIG_USB_RIO500 is not set 1154# CONFIG_USB_RIO500 is not set
1071# CONFIG_USB_LEGOTOWER is not set 1155# CONFIG_USB_LEGOTOWER is not set
1072# CONFIG_USB_LCD is not set 1156# CONFIG_USB_LCD is not set
1157# CONFIG_USB_BERRY_CHARGE is not set
1073# CONFIG_USB_LED is not set 1158# CONFIG_USB_LED is not set
1159# CONFIG_USB_CYPRESS_CY7C63 is not set
1074# CONFIG_USB_CYTHERM is not set 1160# CONFIG_USB_CYTHERM is not set
1075# CONFIG_USB_PHIDGETKIT is not set 1161# CONFIG_USB_PHIDGET is not set
1076# CONFIG_USB_PHIDGETSERVO is not set
1077# CONFIG_USB_IDMOUSE is not set 1162# CONFIG_USB_IDMOUSE is not set
1163# CONFIG_USB_FTDI_ELAN is not set
1164# CONFIG_USB_APPLEDISPLAY is not set
1078# CONFIG_USB_SISUSBVGA is not set 1165# CONFIG_USB_SISUSBVGA is not set
1079# CONFIG_USB_LD is not set 1166# CONFIG_USB_LD is not set
1167# CONFIG_USB_TRANCEVIBRATOR is not set
1168# CONFIG_USB_IOWARRIOR is not set
1080# CONFIG_USB_TEST is not set 1169# CONFIG_USB_TEST is not set
1081 1170
1082# 1171#
@@ -1094,26 +1183,65 @@ CONFIG_USB_MON=y
1094# CONFIG_MMC is not set 1183# CONFIG_MMC is not set
1095 1184
1096# 1185#
1186# LED devices
1187#
1188# CONFIG_NEW_LEDS is not set
1189
1190#
1191# LED drivers
1192#
1193
1194#
1195# LED Triggers
1196#
1197
1198#
1097# InfiniBand support 1199# InfiniBand support
1098# 1200#
1099CONFIG_INFINIBAND=m 1201CONFIG_INFINIBAND=m
1100# CONFIG_INFINIBAND_USER_MAD is not set 1202# CONFIG_INFINIBAND_USER_MAD is not set
1101# CONFIG_INFINIBAND_USER_ACCESS is not set 1203# CONFIG_INFINIBAND_USER_ACCESS is not set
1204CONFIG_INFINIBAND_ADDR_TRANS=y
1102CONFIG_INFINIBAND_MTHCA=m 1205CONFIG_INFINIBAND_MTHCA=m
1103# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1206CONFIG_INFINIBAND_MTHCA_DEBUG=y
1207# CONFIG_INFINIBAND_AMSO1100 is not set
1104CONFIG_INFINIBAND_IPOIB=m 1208CONFIG_INFINIBAND_IPOIB=m
1105# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1209# CONFIG_INFINIBAND_IPOIB_CM is not set
1210CONFIG_INFINIBAND_IPOIB_DEBUG=y
1211# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
1106# CONFIG_INFINIBAND_SRP is not set 1212# CONFIG_INFINIBAND_SRP is not set
1213# CONFIG_INFINIBAND_ISER is not set
1107 1214
1108# 1215#
1109# SN Devices 1216# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1217#
1218
1219#
1220# Real Time Clock
1221#
1222# CONFIG_RTC_CLASS is not set
1223
1224#
1225# DMA Engine support
1226#
1227# CONFIG_DMA_ENGINE is not set
1228
1229#
1230# DMA Clients
1231#
1232
1233#
1234# DMA Devices
1235#
1236
1237#
1238# Auxiliary Display support
1110# 1239#
1111CONFIG_SGI_IOC4=y
1112CONFIG_SGI_IOC3=m
1113 1240
1114# 1241#
1115# EDAC - error detection and reporting (RAS) 1242# Virtualization
1116# 1243#
1244# CONFIG_MSPEC is not set
1117 1245
1118# 1246#
1119# File systems 1247# File systems
@@ -1127,6 +1255,7 @@ CONFIG_EXT3_FS=y
1127CONFIG_EXT3_FS_XATTR=y 1255CONFIG_EXT3_FS_XATTR=y
1128CONFIG_EXT3_FS_POSIX_ACL=y 1256CONFIG_EXT3_FS_POSIX_ACL=y
1129CONFIG_EXT3_FS_SECURITY=y 1257CONFIG_EXT3_FS_SECURITY=y
1258# CONFIG_EXT4DEV_FS is not set
1130CONFIG_JBD=y 1259CONFIG_JBD=y
1131# CONFIG_JBD_DEBUG is not set 1260# CONFIG_JBD_DEBUG is not set
1132CONFIG_FS_MBCACHE=y 1261CONFIG_FS_MBCACHE=y
@@ -1139,15 +1268,16 @@ CONFIG_REISERFS_FS_SECURITY=y
1139# CONFIG_JFS_FS is not set 1268# CONFIG_JFS_FS is not set
1140CONFIG_FS_POSIX_ACL=y 1269CONFIG_FS_POSIX_ACL=y
1141CONFIG_XFS_FS=y 1270CONFIG_XFS_FS=y
1142CONFIG_XFS_EXPORT=y
1143# CONFIG_XFS_QUOTA is not set 1271# CONFIG_XFS_QUOTA is not set
1144# CONFIG_XFS_SECURITY is not set 1272# CONFIG_XFS_SECURITY is not set
1145# CONFIG_XFS_POSIX_ACL is not set 1273# CONFIG_XFS_POSIX_ACL is not set
1146# CONFIG_XFS_RT is not set 1274# CONFIG_XFS_RT is not set
1275# CONFIG_GFS2_FS is not set
1147# CONFIG_OCFS2_FS is not set 1276# CONFIG_OCFS2_FS is not set
1148# CONFIG_MINIX_FS is not set 1277# CONFIG_MINIX_FS is not set
1149# CONFIG_ROMFS_FS is not set 1278# CONFIG_ROMFS_FS is not set
1150CONFIG_INOTIFY=y 1279CONFIG_INOTIFY=y
1280CONFIG_INOTIFY_USER=y
1151# CONFIG_QUOTA is not set 1281# CONFIG_QUOTA is not set
1152CONFIG_DNOTIFY=y 1282CONFIG_DNOTIFY=y
1153CONFIG_AUTOFS_FS=y 1283CONFIG_AUTOFS_FS=y
@@ -1180,12 +1310,14 @@ CONFIG_NTFS_FS=m
1180# 1310#
1181CONFIG_PROC_FS=y 1311CONFIG_PROC_FS=y
1182CONFIG_PROC_KCORE=y 1312CONFIG_PROC_KCORE=y
1313CONFIG_PROC_VMCORE=y
1314CONFIG_PROC_SYSCTL=y
1183CONFIG_SYSFS=y 1315CONFIG_SYSFS=y
1184CONFIG_TMPFS=y 1316CONFIG_TMPFS=y
1317# CONFIG_TMPFS_POSIX_ACL is not set
1185CONFIG_HUGETLBFS=y 1318CONFIG_HUGETLBFS=y
1186CONFIG_HUGETLB_PAGE=y 1319CONFIG_HUGETLB_PAGE=y
1187CONFIG_RAMFS=y 1320CONFIG_RAMFS=y
1188# CONFIG_RELAYFS_FS is not set
1189# CONFIG_CONFIGFS_FS is not set 1321# CONFIG_CONFIGFS_FS is not set
1190 1322
1191# 1323#
@@ -1220,7 +1352,7 @@ CONFIG_NFSD_V4=y
1220CONFIG_NFSD_TCP=y 1352CONFIG_NFSD_TCP=y
1221CONFIG_LOCKD=m 1353CONFIG_LOCKD=m
1222CONFIG_LOCKD_V4=y 1354CONFIG_LOCKD_V4=y
1223CONFIG_EXPORTFS=y 1355CONFIG_EXPORTFS=m
1224CONFIG_NFS_COMMON=y 1356CONFIG_NFS_COMMON=y
1225CONFIG_SUNRPC=m 1357CONFIG_SUNRPC=m
1226CONFIG_SUNRPC_GSS=m 1358CONFIG_SUNRPC_GSS=m
@@ -1231,7 +1363,9 @@ CONFIG_SMB_NLS_DEFAULT=y
1231CONFIG_SMB_NLS_REMOTE="cp437" 1363CONFIG_SMB_NLS_REMOTE="cp437"
1232CONFIG_CIFS=m 1364CONFIG_CIFS=m
1233# CONFIG_CIFS_STATS is not set 1365# CONFIG_CIFS_STATS is not set
1366# CONFIG_CIFS_WEAK_PW_HASH is not set
1234# CONFIG_CIFS_XATTR is not set 1367# CONFIG_CIFS_XATTR is not set
1368# CONFIG_CIFS_DEBUG2 is not set
1235# CONFIG_CIFS_EXPERIMENTAL is not set 1369# CONFIG_CIFS_EXPERIMENTAL is not set
1236# CONFIG_NCP_FS is not set 1370# CONFIG_NCP_FS is not set
1237# CONFIG_CODA_FS is not set 1371# CONFIG_CODA_FS is not set
@@ -1304,15 +1438,25 @@ CONFIG_NLS_KOI8_U=m
1304CONFIG_NLS_UTF8=m 1438CONFIG_NLS_UTF8=m
1305 1439
1306# 1440#
1441# Distributed Lock Manager
1442#
1443# CONFIG_DLM is not set
1444
1445#
1307# Library routines 1446# Library routines
1308# 1447#
1448CONFIG_BITREVERSE=y
1309# CONFIG_CRC_CCITT is not set 1449# CONFIG_CRC_CCITT is not set
1310# CONFIG_CRC16 is not set 1450# CONFIG_CRC16 is not set
1311CONFIG_CRC32=y 1451CONFIG_CRC32=y
1312# CONFIG_LIBCRC32C is not set 1452# CONFIG_LIBCRC32C is not set
1453CONFIG_PLIST=y
1454CONFIG_HAS_IOMEM=y
1455CONFIG_HAS_IOPORT=y
1313CONFIG_GENERIC_HARDIRQS=y 1456CONFIG_GENERIC_HARDIRQS=y
1314CONFIG_GENERIC_IRQ_PROBE=y 1457CONFIG_GENERIC_IRQ_PROBE=y
1315CONFIG_GENERIC_PENDING_IRQ=y 1458CONFIG_GENERIC_PENDING_IRQ=y
1459CONFIG_IRQ_PER_CPU=y
1316 1460
1317# 1461#
1318# HP Simulator drivers 1462# HP Simulator drivers
@@ -1331,21 +1475,31 @@ CONFIG_GENERIC_PENDING_IRQ=y
1331# Kernel hacking 1475# Kernel hacking
1332# 1476#
1333# CONFIG_PRINTK_TIME is not set 1477# CONFIG_PRINTK_TIME is not set
1478CONFIG_ENABLE_MUST_CHECK=y
1334CONFIG_MAGIC_SYSRQ=y 1479CONFIG_MAGIC_SYSRQ=y
1480# CONFIG_UNUSED_SYMBOLS is not set
1481# CONFIG_DEBUG_FS is not set
1482# CONFIG_HEADERS_CHECK is not set
1335CONFIG_DEBUG_KERNEL=y 1483CONFIG_DEBUG_KERNEL=y
1484# CONFIG_DEBUG_SHIRQ is not set
1336CONFIG_LOG_BUF_SHIFT=20 1485CONFIG_LOG_BUF_SHIFT=20
1337CONFIG_DETECT_SOFTLOCKUP=y 1486CONFIG_DETECT_SOFTLOCKUP=y
1338# CONFIG_SCHEDSTATS is not set 1487# CONFIG_SCHEDSTATS is not set
1488# CONFIG_TIMER_STATS is not set
1339# CONFIG_DEBUG_SLAB is not set 1489# CONFIG_DEBUG_SLAB is not set
1340CONFIG_DEBUG_MUTEXES=y 1490# CONFIG_DEBUG_RT_MUTEXES is not set
1491# CONFIG_RT_MUTEX_TESTER is not set
1341# CONFIG_DEBUG_SPINLOCK is not set 1492# CONFIG_DEBUG_SPINLOCK is not set
1493CONFIG_DEBUG_MUTEXES=y
1342# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1494# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1495# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1343# CONFIG_DEBUG_KOBJECT is not set 1496# CONFIG_DEBUG_KOBJECT is not set
1344# CONFIG_DEBUG_INFO is not set 1497# CONFIG_DEBUG_INFO is not set
1345# CONFIG_DEBUG_FS is not set
1346# CONFIG_DEBUG_VM is not set 1498# CONFIG_DEBUG_VM is not set
1499# CONFIG_DEBUG_LIST is not set
1347CONFIG_FORCED_INLINING=y 1500CONFIG_FORCED_INLINING=y
1348# CONFIG_RCU_TORTURE_TEST is not set 1501# CONFIG_RCU_TORTURE_TEST is not set
1502# CONFIG_FAULT_INJECTION is not set
1349CONFIG_IA64_GRANULE_16MB=y 1503CONFIG_IA64_GRANULE_16MB=y
1350# CONFIG_IA64_GRANULE_64MB is not set 1504# CONFIG_IA64_GRANULE_64MB is not set
1351# CONFIG_IA64_PRINT_HAZARDS is not set 1505# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1364,7 +1518,11 @@ CONFIG_SYSVIPC_COMPAT=y
1364# Cryptographic options 1518# Cryptographic options
1365# 1519#
1366CONFIG_CRYPTO=y 1520CONFIG_CRYPTO=y
1521CONFIG_CRYPTO_ALGAPI=y
1522CONFIG_CRYPTO_BLKCIPHER=m
1523CONFIG_CRYPTO_MANAGER=m
1367# CONFIG_CRYPTO_HMAC is not set 1524# CONFIG_CRYPTO_HMAC is not set
1525# CONFIG_CRYPTO_XCBC is not set
1368# CONFIG_CRYPTO_NULL is not set 1526# CONFIG_CRYPTO_NULL is not set
1369# CONFIG_CRYPTO_MD4 is not set 1527# CONFIG_CRYPTO_MD4 is not set
1370CONFIG_CRYPTO_MD5=y 1528CONFIG_CRYPTO_MD5=y
@@ -1373,7 +1531,13 @@ CONFIG_CRYPTO_MD5=y
1373# CONFIG_CRYPTO_SHA512 is not set 1531# CONFIG_CRYPTO_SHA512 is not set
1374# CONFIG_CRYPTO_WP512 is not set 1532# CONFIG_CRYPTO_WP512 is not set
1375# CONFIG_CRYPTO_TGR192 is not set 1533# CONFIG_CRYPTO_TGR192 is not set
1534# CONFIG_CRYPTO_GF128MUL is not set
1535CONFIG_CRYPTO_ECB=m
1536CONFIG_CRYPTO_CBC=m
1537CONFIG_CRYPTO_PCBC=m
1538# CONFIG_CRYPTO_LRW is not set
1376CONFIG_CRYPTO_DES=m 1539CONFIG_CRYPTO_DES=m
1540# CONFIG_CRYPTO_FCRYPT is not set
1377# CONFIG_CRYPTO_BLOWFISH is not set 1541# CONFIG_CRYPTO_BLOWFISH is not set
1378# CONFIG_CRYPTO_TWOFISH is not set 1542# CONFIG_CRYPTO_TWOFISH is not set
1379# CONFIG_CRYPTO_SERPENT is not set 1543# CONFIG_CRYPTO_SERPENT is not set
@@ -1387,6 +1551,7 @@ CONFIG_CRYPTO_DES=m
1387# CONFIG_CRYPTO_DEFLATE is not set 1551# CONFIG_CRYPTO_DEFLATE is not set
1388# CONFIG_CRYPTO_MICHAEL_MIC is not set 1552# CONFIG_CRYPTO_MICHAEL_MIC is not set
1389# CONFIG_CRYPTO_CRC32C is not set 1553# CONFIG_CRYPTO_CRC32C is not set
1554# CONFIG_CRYPTO_CAMELLIA is not set
1390# CONFIG_CRYPTO_TEST is not set 1555# CONFIG_CRYPTO_TEST is not set
1391 1556
1392# 1557#
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 75a2a2c12258..2236fabbb3c6 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -35,6 +35,7 @@ void foo(void)
35 BLANK(); 35 BLANK();
36 36
37 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 37 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
38 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
38 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); 39 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
39 40
40 BLANK(); 41 BLANK();
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 5cdd2f5fa064..80a94e707827 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -21,9 +21,9 @@
21#include <asm/mca.h> 21#include <asm/mca.h>
22 22
23int kdump_status[NR_CPUS]; 23int kdump_status[NR_CPUS];
24atomic_t kdump_cpu_freezed; 24static atomic_t kdump_cpu_frozen;
25atomic_t kdump_in_progress; 25atomic_t kdump_in_progress;
26int kdump_on_init = 1; 26static int kdump_on_init = 1;
27 27
28static inline Elf64_Word 28static inline Elf64_Word
29*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data, 29*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
@@ -86,7 +86,7 @@ kdump_wait_cpu_freeze(void)
86 int cpu_num = num_online_cpus() - 1; 86 int cpu_num = num_online_cpus() - 1;
87 int timeout = 1000; 87 int timeout = 1000;
88 while(timeout-- > 0) { 88 while(timeout-- > 0) {
89 if (atomic_read(&kdump_cpu_freezed) == cpu_num) 89 if (atomic_read(&kdump_cpu_frozen) == cpu_num)
90 return 0; 90 return 0;
91 udelay(1000); 91 udelay(1000);
92 } 92 }
@@ -108,8 +108,8 @@ machine_crash_shutdown(struct pt_regs *pt)
108 kexec_disable_iosapic(); 108 kexec_disable_iosapic();
109#ifdef CONFIG_SMP 109#ifdef CONFIG_SMP
110 kdump_smp_send_stop(); 110 kdump_smp_send_stop();
111 /* not all cpu response to IPI, send INIT to freeze them */
111 if (kdump_wait_cpu_freeze() && kdump_on_init) { 112 if (kdump_wait_cpu_freeze() && kdump_on_init) {
112 //not all cpu response to IPI, send INIT to freeze them
113 kdump_smp_send_init(); 113 kdump_smp_send_init();
114 } 114 }
115#endif 115#endif
@@ -136,7 +136,7 @@ kdump_cpu_freeze(struct unw_frame_info *info, void *arg)
136 cpuid = smp_processor_id(); 136 cpuid = smp_processor_id();
137 crash_save_this_cpu(); 137 crash_save_this_cpu();
138 current->thread.ksp = (__u64)info->sw - 16; 138 current->thread.ksp = (__u64)info->sw - 16;
139 atomic_inc(&kdump_cpu_freezed); 139 atomic_inc(&kdump_cpu_frozen);
140 kdump_status[cpuid] = 1; 140 kdump_status[cpuid] = 1;
141 mb(); 141 mb();
142#ifdef CONFIG_HOTPLUG_CPU 142#ifdef CONFIG_HOTPLUG_CPU
@@ -164,7 +164,7 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)
164 164
165 nd = (struct ia64_mca_notify_die *)args->err; 165 nd = (struct ia64_mca_notify_die *)args->err;
166 /* Reason code 1 means machine check rendezous*/ 166 /* Reason code 1 means machine check rendezous*/
167 if ((val == DIE_INIT_MONARCH_ENTER || DIE_INIT_SLAVE_ENTER) && 167 if ((val == DIE_INIT_MONARCH_ENTER || val == DIE_INIT_SLAVE_ENTER) &&
168 nd->sos->rv_rc == 1) 168 nd->sos->rv_rc == 1)
169 return NOTIFY_DONE; 169 return NOTIFY_DONE;
170 170
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 4061593e5b17..f45f91d38cab 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -971,6 +971,11 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
971 if (!is_memory_available(md)) 971 if (!is_memory_available(md))
972 continue; 972 continue;
973 973
974#ifdef CONFIG_CRASH_DUMP
975 /* saved_max_pfn should ignore max_addr= command line arg */
976 if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT))
977 saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT);
978#endif
974 /* 979 /*
975 * Round ends inward to granule boundaries 980 * Round ends inward to granule boundaries
976 * Give trimmings to uncached allocator 981 * Give trimmings to uncached allocator
@@ -1010,11 +1015,6 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1010 } else 1015 } else
1011 ae = efi_md_end(md); 1016 ae = efi_md_end(md);
1012 1017
1013#ifdef CONFIG_CRASH_DUMP
1014 /* saved_max_pfn should ignore max_addr= command line arg */
1015 if (saved_max_pfn < (ae >> PAGE_SHIFT))
1016 saved_max_pfn = (ae >> PAGE_SHIFT);
1017#endif
1018 /* keep within max_addr= and min_addr= command line arg */ 1018 /* keep within max_addr= and min_addr= command line arg */
1019 as = max(as, min_addr); 1019 as = max(as, min_addr);
1020 ae = min(ae, max_addr); 1020 ae = min(ae, max_addr);
@@ -1142,7 +1142,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1142/* find a block of memory aligned to 64M exclude reserved regions 1142/* find a block of memory aligned to 64M exclude reserved regions
1143 rsvd_regions are sorted 1143 rsvd_regions are sorted
1144 */ 1144 */
1145unsigned long 1145unsigned long __init
1146kdump_find_rsvd_region (unsigned long size, 1146kdump_find_rsvd_region (unsigned long size,
1147 struct rsvd_region *r, int n) 1147 struct rsvd_region *r, int n)
1148{ 1148{
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 7a05b1cb2ad5..8589e84a27c6 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -10,6 +10,8 @@
10 * probably broke it along the way... ;-) 10 * probably broke it along the way... ;-)
11 * 13-Jul-04 clameter Implement fsys_clock_gettime and revise fsys_gettimeofday to make 11 * 13-Jul-04 clameter Implement fsys_clock_gettime and revise fsys_gettimeofday to make
12 * it capable of using memory based clocks without falling back to C code. 12 * it capable of using memory based clocks without falling back to C code.
13 * 08-Feb-07 Fenghua Yu Implement fsys_getcpu.
14 *
13 */ 15 */
14 16
15#include <asm/asmmacro.h> 17#include <asm/asmmacro.h>
@@ -505,6 +507,59 @@ EX(.fail_efault, (p15) st8 [r34]=r3)
505#endif 507#endif
506END(fsys_rt_sigprocmask) 508END(fsys_rt_sigprocmask)
507 509
510/*
511 * fsys_getcpu doesn't use the third parameter in this implementation. It reads
512 * current_thread_info()->cpu and corresponding node in cpu_to_node_map.
513 */
514ENTRY(fsys_getcpu)
515 .prologue
516 .altrp b6
517 .body
518 ;;
519 add r2=TI_FLAGS+IA64_TASK_SIZE,r16
520 tnat.nz p6,p0 = r32 // guard against NaT argument
521 add r3=TI_CPU+IA64_TASK_SIZE,r16
522 ;;
523 ld4 r3=[r3] // M r3 = thread_info->cpu
524 ld4 r2=[r2] // M r2 = thread_info->flags
525(p6) br.cond.spnt.few .fail_einval // B
526 ;;
527 tnat.nz p7,p0 = r33 // I guard against NaT argument
528(p7) br.cond.spnt.few .fail_einval // B
529#ifdef CONFIG_NUMA
530 movl r17=cpu_to_node_map
531 ;;
532EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
533EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
534 shladd r18=r3,1,r17
535 ;;
536 ld2 r20=[r18] // r20 = cpu_to_node_map[cpu]
537 and r2 = TIF_ALLWORK_MASK,r2
538 ;;
539 cmp.ne p8,p0=0,r2
540(p8) br.spnt.many fsys_fallback_syscall
541 ;;
542 ;;
543EX(.fail_efault, st4 [r32] = r3)
544EX(.fail_efault, st2 [r33] = r20)
545 mov r8=0
546 ;;
547#else
548EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
549EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
550 and r2 = TIF_ALLWORK_MASK,r2
551 ;;
552 cmp.ne p8,p0=0,r2
553(p8) br.spnt.many fsys_fallback_syscall
554 ;;
555EX(.fail_efault, st4 [r32] = r3)
556EX(.fail_efault, st2 [r33] = r0)
557 mov r8=0
558 ;;
559#endif
560 FSYS_RETURN
561END(fsys_getcpu)
562
508ENTRY(fsys_fallback_syscall) 563ENTRY(fsys_fallback_syscall)
509 .prologue 564 .prologue
510 .altrp b6 565 .altrp b6
@@ -878,6 +933,56 @@ fsyscall_table:
878 data8 0 // timer_delete 933 data8 0 // timer_delete
879 data8 0 // clock_settime 934 data8 0 // clock_settime
880 data8 fsys_clock_gettime // clock_gettime 935 data8 fsys_clock_gettime // clock_gettime
936 data8 0 // clock_getres // 1255
937 data8 0 // clock_nanosleep
938 data8 0 // fstatfs64
939 data8 0 // statfs64
940 data8 0 // mbind
941 data8 0 // get_mempolicy // 1260
942 data8 0 // set_mempolicy
943 data8 0 // mq_open
944 data8 0 // mq_unlink
945 data8 0 // mq_timedsend
946 data8 0 // mq_timedreceive // 1265
947 data8 0 // mq_notify
948 data8 0 // mq_getsetattr
949 data8 0 // kexec_load
950 data8 0 // vserver
951 data8 0 // waitid // 1270
952 data8 0 // add_key
953 data8 0 // request_key
954 data8 0 // keyctl
955 data8 0 // ioprio_set
956 data8 0 // ioprio_get // 1275
957 data8 0 // move_pages
958 data8 0 // inotify_init
959 data8 0 // inotify_add_watch
960 data8 0 // inotify_rm_watch
961 data8 0 // migrate_pages // 1280
962 data8 0 // openat
963 data8 0 // mkdirat
964 data8 0 // mknodat
965 data8 0 // fchownat
966 data8 0 // futimesat // 1285
967 data8 0 // newfstatat
968 data8 0 // unlinkat
969 data8 0 // renameat
970 data8 0 // linkat
971 data8 0 // symlinkat // 1290
972 data8 0 // readlinkat
973 data8 0 // fchmodat
974 data8 0 // faccessat
975 data8 0
976 data8 0 // 1295
977 data8 0 // unshare
978 data8 0 // splice
979 data8 0 // set_robust_list
980 data8 0 // get_robust_list
981 data8 0 // sync_file_range // 1300
982 data8 0 // tee
983 data8 0 // vmsplice
984 data8 0
985 data8 fsys_getcpu // getcpu // 1304
881 986
882 // fill in zeros for the remaining entries 987 // fill in zeros for the remaining entries
883 .zero: 988 .zero:
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index d6aab40c6416..dcfbf3e7a9ef 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -446,7 +446,7 @@ iosapic_end_level_irq (unsigned int irq)
446#define iosapic_disable_level_irq mask_irq 446#define iosapic_disable_level_irq mask_irq
447#define iosapic_ack_level_irq nop 447#define iosapic_ack_level_irq nop
448 448
449struct hw_interrupt_type irq_type_iosapic_level = { 449struct irq_chip irq_type_iosapic_level = {
450 .name = "IO-SAPIC-level", 450 .name = "IO-SAPIC-level",
451 .startup = iosapic_startup_level_irq, 451 .startup = iosapic_startup_level_irq,
452 .shutdown = iosapic_shutdown_level_irq, 452 .shutdown = iosapic_shutdown_level_irq,
@@ -454,6 +454,8 @@ struct hw_interrupt_type irq_type_iosapic_level = {
454 .disable = iosapic_disable_level_irq, 454 .disable = iosapic_disable_level_irq,
455 .ack = iosapic_ack_level_irq, 455 .ack = iosapic_ack_level_irq,
456 .end = iosapic_end_level_irq, 456 .end = iosapic_end_level_irq,
457 .mask = mask_irq,
458 .unmask = unmask_irq,
457 .set_affinity = iosapic_set_affinity 459 .set_affinity = iosapic_set_affinity
458}; 460};
459 461
@@ -493,7 +495,7 @@ iosapic_ack_edge_irq (unsigned int irq)
493#define iosapic_disable_edge_irq nop 495#define iosapic_disable_edge_irq nop
494#define iosapic_end_edge_irq nop 496#define iosapic_end_edge_irq nop
495 497
496struct hw_interrupt_type irq_type_iosapic_edge = { 498struct irq_chip irq_type_iosapic_edge = {
497 .name = "IO-SAPIC-edge", 499 .name = "IO-SAPIC-edge",
498 .startup = iosapic_startup_edge_irq, 500 .startup = iosapic_startup_edge_irq,
499 .shutdown = iosapic_disable_edge_irq, 501 .shutdown = iosapic_disable_edge_irq,
@@ -501,6 +503,8 @@ struct hw_interrupt_type irq_type_iosapic_edge = {
501 .disable = iosapic_disable_edge_irq, 503 .disable = iosapic_disable_edge_irq,
502 .ack = iosapic_ack_edge_irq, 504 .ack = iosapic_ack_edge_irq,
503 .end = iosapic_end_edge_irq, 505 .end = iosapic_end_edge_irq,
506 .mask = mask_irq,
507 .unmask = unmask_irq,
504 .set_affinity = iosapic_set_affinity 508 .set_affinity = iosapic_set_affinity
505}; 509};
506 510
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index a76add3e76a2..491687f84fb5 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1192,8 +1192,6 @@ void
1192ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw, 1192ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1193 struct ia64_sal_os_state *sos) 1193 struct ia64_sal_os_state *sos)
1194{ 1194{
1195 pal_processor_state_info_t *psp = (pal_processor_state_info_t *)
1196 &sos->proc_state_param;
1197 int recover, cpu = smp_processor_id(); 1195 int recover, cpu = smp_processor_id();
1198 struct task_struct *previous_current; 1196 struct task_struct *previous_current;
1199 struct ia64_mca_notify_die nd = 1197 struct ia64_mca_notify_die nd =
@@ -1223,10 +1221,8 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1223 /* Get the MCA error record and log it */ 1221 /* Get the MCA error record and log it */
1224 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA); 1222 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA);
1225 1223
1226 /* TLB error is only exist in this SAL error record */ 1224 /* MCA error recovery */
1227 recover = (psp->tc && !(psp->cc || psp->bc || psp->rc || psp->uc)) 1225 recover = (ia64_mca_ucmc_extension
1228 /* other error recovery */
1229 || (ia64_mca_ucmc_extension
1230 && ia64_mca_ucmc_extension( 1226 && ia64_mca_ucmc_extension(
1231 IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA), 1227 IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA),
1232 sos)); 1228 sos));
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index afc1403799c9..832cf1e647e8 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -602,11 +602,40 @@ recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx,
602 default: 602 default:
603 break; 603 break;
604 } 604 }
605 } else if (psp->cc && !psp->bc) { /* Cache error */
606 status = recover_from_read_error(slidx, peidx, pbci, sos);
605 } 607 }
606 608
607 return status; 609 return status;
608} 610}
609 611
612/*
613 * recover_from_tlb_check
614 * @peidx: pointer of index of processor error section
615 *
616 * Return value:
617 * 1 on Success / 0 on Failure
618 */
619static int
620recover_from_tlb_check(peidx_table_t *peidx)
621{
622 sal_log_mod_error_info_t *smei;
623 pal_tlb_check_info_t *ptci;
624
625 smei = (sal_log_mod_error_info_t *)peidx_tlb_check(peidx, 0);
626 ptci = (pal_tlb_check_info_t *)&(smei->check_info);
627
628 /*
629 * Look for signature of a duplicate TLB DTC entry, which is
630 * a SW bug and always fatal.
631 */
632 if (ptci->op == PAL_TLB_CHECK_OP_PURGE
633 && !(ptci->itr || ptci->dtc || ptci->itc))
634 return fatal_mca("Duplicate TLB entry");
635
636 return mca_recovered("TLB check recovered");
637}
638
610/** 639/**
611 * recover_from_processor_error 640 * recover_from_processor_error
612 * @platform: whether there are some platform error section or not 641 * @platform: whether there are some platform error section or not
@@ -618,13 +647,6 @@ recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx,
618 * Return value: 647 * Return value:
619 * 1 on Success / 0 on Failure 648 * 1 on Success / 0 on Failure
620 */ 649 */
621/*
622 * Later we try to recover when below all conditions are satisfied.
623 * 1. Only one processor error section is exist.
624 * 2. BUS_CHECK is exist and the others are not exist.(Except TLB_CHECK)
625 * 3. The entry of BUS_CHECK_INFO is 1.
626 * 4. "External bus error" flag is set and the others are not set.
627 */
628 650
629static int 651static int
630recover_from_processor_error(int platform, slidx_table_t *slidx, 652recover_from_processor_error(int platform, slidx_table_t *slidx,
@@ -652,38 +674,39 @@ recover_from_processor_error(int platform, slidx_table_t *slidx,
652 return fatal_mca("error not contained"); 674 return fatal_mca("error not contained");
653 675
654 /* 676 /*
677 * Look for recoverable TLB check
678 */
679 if (psp->tc && !(psp->cc || psp->bc || psp->rc || psp->uc))
680 return recover_from_tlb_check(peidx);
681
682 /*
655 * The cache check and bus check bits have four possible states 683 * The cache check and bus check bits have four possible states
656 * cc bc 684 * cc bc
657 * 0 0 Weird record, not recovered
658 * 1 0 Cache error, not recovered
659 * 0 1 I/O error, attempt recovery
660 * 1 1 Memory error, attempt recovery 685 * 1 1 Memory error, attempt recovery
686 * 1 0 Cache error, attempt recovery
687 * 0 1 I/O error, attempt recovery
688 * 0 0 Other error type, not recovered
661 */ 689 */
662 if (psp->bc == 0 || pbci == NULL) 690 if (psp->cc == 0 && (psp->bc == 0 || pbci == NULL))
663 return fatal_mca("No bus check"); 691 return fatal_mca("No cache or bus check");
664 692
665 /* 693 /*
666 * Sorry, we cannot handle so many. 694 * Cannot handle more than one bus check.
667 */ 695 */
668 if (peidx_bus_check_num(peidx) > 1) 696 if (peidx_bus_check_num(peidx) > 1)
669 return fatal_mca("Too many bus checks"); 697 return fatal_mca("Too many bus checks");
670 /* 698
671 * Well, here is only one bus error.
672 */
673 if (pbci->ib) 699 if (pbci->ib)
674 return fatal_mca("Internal Bus error"); 700 return fatal_mca("Internal Bus error");
675 if (pbci->cc)
676 return fatal_mca("Cache-cache error");
677 if (pbci->eb && pbci->bsi > 0) 701 if (pbci->eb && pbci->bsi > 0)
678 return fatal_mca("External bus check fatal status"); 702 return fatal_mca("External bus check fatal status");
679 703
680 /* 704 /*
681 * This is a local MCA and estimated as recoverble external bus error. 705 * This is a local MCA and estimated as a recoverble error.
682 * (e.g. a load from poisoned memory)
683 * This means "there are some platform errors".
684 */ 706 */
685 if (platform) 707 if (platform)
686 return recover_from_platform_error(slidx, peidx, pbci, sos); 708 return recover_from_platform_error(slidx, peidx, pbci, sos);
709
687 /* 710 /*
688 * On account of strange SAL error record, we cannot recover. 711 * On account of strange SAL error record, we cannot recover.
689 */ 712 */
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index e7220900ea14..c81080df70df 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -68,7 +68,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
68{ 68{
69 struct msi_msg msg; 69 struct msi_msg msg;
70 unsigned long dest_phys_id; 70 unsigned long dest_phys_id;
71 unsigned int irq, vector; 71 int irq, vector;
72 72
73 irq = create_irq(); 73 irq = create_irq();
74 if (irq < 0) 74 if (irq < 0)
@@ -76,7 +76,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
76 76
77 set_irq_msi(irq, desc); 77 set_irq_msi(irq, desc);
78 dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map)); 78 dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map));
79 vector = irq; 79 vector = irq_to_vector(irq);
80 80
81 msg.address_hi = 0; 81 msg.address_hi = 0;
82 msg.address_lo = 82 msg.address_lo =
@@ -110,7 +110,7 @@ static void ia64_ack_msi_irq(unsigned int irq)
110 110
111static int ia64_msi_retrigger_irq(unsigned int irq) 111static int ia64_msi_retrigger_irq(unsigned int irq)
112{ 112{
113 unsigned int vector = irq; 113 unsigned int vector = irq_to_vector(irq);
114 ia64_resend_irq(vector); 114 ia64_resend_irq(vector);
115 115
116 return 1; 116 return 1;
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 3f8918782e0c..00f803246948 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -1573,6 +1573,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1573 1573
1574 case PTRACE_DETACH: 1574 case PTRACE_DETACH:
1575 /* detach a process that was attached. */ 1575 /* detach a process that was attached. */
1576 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
1576 ret = ptrace_detach(child, data); 1577 ret = ptrace_detach(child, data);
1577 goto out_tsk; 1578 goto out_tsk;
1578 1579
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 7d6fe65c93f4..dc7dd7648ec5 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -91,8 +91,6 @@ static struct resource code_resource = {
91 .name = "Kernel code", 91 .name = "Kernel code",
92 .flags = IORESOURCE_BUSY | IORESOURCE_MEM 92 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
93}; 93};
94extern void efi_initialize_iomem_resources(struct resource *,
95 struct resource *);
96extern char _text[], _end[], _etext[]; 94extern char _text[], _end[], _etext[];
97 95
98unsigned long ia64_max_cacheline_size; 96unsigned long ia64_max_cacheline_size;
@@ -642,7 +640,7 @@ show_cpuinfo (struct seq_file *m, void *v)
642 "features : %s\n" 640 "features : %s\n"
643 "cpu number : %lu\n" 641 "cpu number : %lu\n"
644 "cpu regs : %u\n" 642 "cpu regs : %u\n"
645 "cpu MHz : %lu.%06lu\n" 643 "cpu MHz : %lu.%03lu\n"
646 "itc MHz : %lu.%06lu\n" 644 "itc MHz : %lu.%06lu\n"
647 "BogoMIPS : %lu.%02lu\n", 645 "BogoMIPS : %lu.%02lu\n",
648 cpunum, c->vendor, c->family, c->model, 646 cpunum, c->vendor, c->family, c->model,
@@ -694,12 +692,15 @@ struct seq_operations cpuinfo_op = {
694 .show = show_cpuinfo 692 .show = show_cpuinfo
695}; 693};
696 694
697static char brandname[128]; 695#define MAX_BRANDS 8
696static char brandname[MAX_BRANDS][128];
698 697
699static char * __cpuinit 698static char * __cpuinit
700get_model_name(__u8 family, __u8 model) 699get_model_name(__u8 family, __u8 model)
701{ 700{
701 static int overflow;
702 char brand[128]; 702 char brand[128];
703 int i;
703 704
704 memcpy(brand, "Unknown", 8); 705 memcpy(brand, "Unknown", 8);
705 if (ia64_pal_get_brand_info(brand)) { 706 if (ia64_pal_get_brand_info(brand)) {
@@ -711,12 +712,17 @@ get_model_name(__u8 family, __u8 model)
711 case 2: memcpy(brand, "Madison up to 9M cache", 23); break; 712 case 2: memcpy(brand, "Madison up to 9M cache", 23); break;
712 } 713 }
713 } 714 }
714 if (brandname[0] == '\0') 715 for (i = 0; i < MAX_BRANDS; i++)
715 return strcpy(brandname, brand); 716 if (strcmp(brandname[i], brand) == 0)
716 else if (strcmp(brandname, brand) == 0) 717 return brandname[i];
717 return brandname; 718 for (i = 0; i < MAX_BRANDS; i++)
718 else 719 if (brandname[i][0] == '\0')
719 return kstrdup(brand, GFP_KERNEL); 720 return strcpy(brandname[i], brand);
721 if (overflow++ == 0)
722 printk(KERN_ERR
723 "%s: Table overflow. Some processor model information will be missing\n",
724 __FUNCTION__);
725 return "Unknown";
720} 726}
721 727
722static void __cpuinit 728static void __cpuinit
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index b21ddecea943..ff7df439da6d 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -375,6 +375,7 @@ static void __devinit
375smp_callin (void) 375smp_callin (void)
376{ 376{
377 int cpuid, phys_id, itc_master; 377 int cpuid, phys_id, itc_master;
378 struct cpuinfo_ia64 *last_cpuinfo, *this_cpuinfo;
378 extern void ia64_init_itm(void); 379 extern void ia64_init_itm(void);
379 extern volatile int time_keeper_id; 380 extern volatile int time_keeper_id;
380 381
@@ -424,7 +425,21 @@ smp_callin (void)
424 * Get our bogomips. 425 * Get our bogomips.
425 */ 426 */
426 ia64_init_itm(); 427 ia64_init_itm();
427 calibrate_delay(); 428
429 /*
430 * Delay calibration can be skipped if new processor is identical to the
431 * previous processor.
432 */
433 last_cpuinfo = cpu_data(cpuid - 1);
434 this_cpuinfo = local_cpu_data;
435 if (last_cpuinfo->itc_freq != this_cpuinfo->itc_freq ||
436 last_cpuinfo->proc_freq != this_cpuinfo->proc_freq ||
437 last_cpuinfo->features != this_cpuinfo->features ||
438 last_cpuinfo->revision != this_cpuinfo->revision ||
439 last_cpuinfo->family != this_cpuinfo->family ||
440 last_cpuinfo->archrev != this_cpuinfo->archrev ||
441 last_cpuinfo->model != this_cpuinfo->model)
442 calibrate_delay();
428 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 443 local_cpu_data->loops_per_jiffy = loops_per_jiffy;
429 444
430#ifdef CONFIG_IA32_SUPPORT 445#ifdef CONFIG_IA32_SUPPORT
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index fb0f4698f5d0..44ce5ed9444c 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -97,26 +97,6 @@ void show_mem(void)
97unsigned long bootmap_start; 97unsigned long bootmap_start;
98 98
99/** 99/**
100 * find_max_pfn - adjust the maximum page number callback
101 * @start: start of range
102 * @end: end of range
103 * @arg: address of pointer to global max_pfn variable
104 *
105 * Passed as a callback function to efi_memmap_walk() to determine the highest
106 * available page frame number in the system.
107 */
108int
109find_max_pfn (unsigned long start, unsigned long end, void *arg)
110{
111 unsigned long *max_pfnp = arg, pfn;
112
113 pfn = (PAGE_ALIGN(end - 1) - PAGE_OFFSET) >> PAGE_SHIFT;
114 if (pfn > *max_pfnp)
115 *max_pfnp = pfn;
116 return 0;
117}
118
119/**
120 * find_bootmap_location - callback to find a memory area for the bootmap 100 * find_bootmap_location - callback to find a memory area for the bootmap
121 * @start: start of region 101 * @start: start of region
122 * @end: end of region 102 * @end: end of region
@@ -177,9 +157,10 @@ find_memory (void)
177 reserve_memory(); 157 reserve_memory();
178 158
179 /* first find highest page frame number */ 159 /* first find highest page frame number */
180 max_pfn = 0; 160 min_low_pfn = ~0UL;
181 efi_memmap_walk(find_max_pfn, &max_pfn); 161 max_low_pfn = 0;
182 162 efi_memmap_walk(find_max_min_low_pfn, NULL);
163 max_pfn = max_low_pfn;
183 /* how many bytes to cover all the pages */ 164 /* how many bytes to cover all the pages */
184 bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT; 165 bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT;
185 166
@@ -189,7 +170,8 @@ find_memory (void)
189 if (bootmap_start == ~0UL) 170 if (bootmap_start == ~0UL)
190 panic("Cannot find %ld bytes for bootmap\n", bootmap_size); 171 panic("Cannot find %ld bytes for bootmap\n", bootmap_size);
191 172
192 bootmap_size = init_bootmem(bootmap_start >> PAGE_SHIFT, max_pfn); 173 bootmap_size = init_bootmem_node(NODE_DATA(0),
174 (bootmap_start >> PAGE_SHIFT), 0, max_pfn);
193 175
194 /* Free all available memory, then mark bootmem-map as being in use. */ 176 /* Free all available memory, then mark bootmem-map as being in use. */
195 efi_memmap_walk(filter_rsvd_memory, free_bootmem); 177 efi_memmap_walk(filter_rsvd_memory, free_bootmem);
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 11a2d8825d89..872da7a2accd 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -88,9 +88,6 @@ static int __init build_node_maps(unsigned long start, unsigned long len,
88 bdp->node_low_pfn = max(epfn, bdp->node_low_pfn); 88 bdp->node_low_pfn = max(epfn, bdp->node_low_pfn);
89 } 89 }
90 90
91 min_low_pfn = min(min_low_pfn, bdp->node_boot_start>>PAGE_SHIFT);
92 max_low_pfn = max(max_low_pfn, bdp->node_low_pfn);
93
94 return 0; 91 return 0;
95} 92}
96 93
@@ -438,6 +435,7 @@ void __init find_memory(void)
438 /* These actually end up getting called by call_pernode_memory() */ 435 /* These actually end up getting called by call_pernode_memory() */
439 efi_memmap_walk(filter_rsvd_memory, build_node_maps); 436 efi_memmap_walk(filter_rsvd_memory, build_node_maps);
440 efi_memmap_walk(filter_rsvd_memory, find_pernode_space); 437 efi_memmap_walk(filter_rsvd_memory, find_pernode_space);
438 efi_memmap_walk(find_max_min_low_pfn, NULL);
441 439
442 for_each_online_node(node) 440 for_each_online_node(node)
443 if (mem_data[node].bootmem_data.node_low_pfn) { 441 if (mem_data[node].bootmem_data.node_low_pfn) {
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index f225dd72968b..4f36987eea72 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -155,7 +155,7 @@ ia64_set_rbs_bot (void)
155 155
156 if (stack_size > MAX_USER_STACK_SIZE) 156 if (stack_size > MAX_USER_STACK_SIZE)
157 stack_size = MAX_USER_STACK_SIZE; 157 stack_size = MAX_USER_STACK_SIZE;
158 current->thread.rbs_bot = STACK_TOP - stack_size; 158 current->thread.rbs_bot = PAGE_ALIGN(current->mm->start_stack - stack_size);
159} 159}
160 160
161/* 161/*
@@ -648,6 +648,22 @@ count_reserved_pages (u64 start, u64 end, void *arg)
648 return 0; 648 return 0;
649} 649}
650 650
651int
652find_max_min_low_pfn (unsigned long start, unsigned long end, void *arg)
653{
654 unsigned long pfn_start, pfn_end;
655#ifdef CONFIG_FLATMEM
656 pfn_start = (PAGE_ALIGN(__pa(start))) >> PAGE_SHIFT;
657 pfn_end = (PAGE_ALIGN(__pa(end - 1))) >> PAGE_SHIFT;
658#else
659 pfn_start = GRANULEROUNDDOWN(__pa(start)) >> PAGE_SHIFT;
660 pfn_end = GRANULEROUNDUP(__pa(end - 1)) >> PAGE_SHIFT;
661#endif
662 min_low_pfn = min(min_low_pfn, pfn_start);
663 max_low_pfn = max(max_low_pfn, pfn_end);
664 return 0;
665}
666
651/* 667/*
652 * Boot command-line option "nolwsys" can be used to disable the use of any light-weight 668 * Boot command-line option "nolwsys" can be used to disable the use of any light-weight
653 * system call handler. When this option is in effect, all fsyscalls will end up bubbling 669 * system call handler. When this option is in effect, all fsyscalls will end up bubbling
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 474d179966dc..0e83f3b419b5 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -557,14 +557,17 @@ pcibios_enable_device (struct pci_dev *dev, int mask)
557 if (ret < 0) 557 if (ret < 0)
558 return ret; 558 return ret;
559 559
560 return acpi_pci_irq_enable(dev); 560 if (!dev->msi_enabled)
561 return acpi_pci_irq_enable(dev);
562 return 0;
561} 563}
562 564
563void 565void
564pcibios_disable_device (struct pci_dev *dev) 566pcibios_disable_device (struct pci_dev *dev)
565{ 567{
566 BUG_ON(atomic_read(&dev->enable_cnt)); 568 BUG_ON(atomic_read(&dev->enable_cnt));
567 acpi_pci_irq_disable(dev); 569 if (!dev->msi_enabled)
570 acpi_pci_irq_disable(dev);
568} 571}
569 572
570void 573void
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c
index f1ec1370b3e3..b6fcf8164f2b 100644
--- a/arch/ia64/sn/kernel/bte_error.c
+++ b/arch/ia64/sn/kernel/bte_error.c
@@ -78,7 +78,7 @@ int shub1_bte_error_handler(unsigned long _nodepda)
78 * There are errors which still need to be cleaned up by 78 * There are errors which still need to be cleaned up by
79 * hubiio_crb_error_handler 79 * hubiio_crb_error_handler
80 */ 80 */
81 mod_timer(recovery_timer, HZ * 5); 81 mod_timer(recovery_timer, jiffies + (HZ * 5));
82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
83 smp_processor_id())); 83 smp_processor_id()));
84 return 1; 84 return 1;
@@ -95,7 +95,7 @@ int shub1_bte_error_handler(unsigned long _nodepda)
95 icrbd.ii_icrb0_d_regval = 95 icrbd.ii_icrb0_d_regval =
96 REMOTE_HUB_L(nasid, IIO_ICRB_D(i)); 96 REMOTE_HUB_L(nasid, IIO_ICRB_D(i));
97 if (icrbd.d_bteop) { 97 if (icrbd.d_bteop) {
98 mod_timer(recovery_timer, HZ * 5); 98 mod_timer(recovery_timer, jiffies + (HZ * 5));
99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n", 99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n",
100 err_nodepda, smp_processor_id(), 100 err_nodepda, smp_processor_id(),
101 i)); 101 i));
@@ -150,7 +150,7 @@ int shub2_bte_error_handler(unsigned long _nodepda)
150 status = BTE_LNSTAT_LOAD(bte); 150 status = BTE_LNSTAT_LOAD(bte);
151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY)) 151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY))
152 continue; 152 continue;
153 mod_timer(recovery_timer, HZ * 5); 153 mod_timer(recovery_timer, jiffies + (HZ * 5));
154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
155 smp_processor_id())); 155 smp_processor_id()));
156 return 1; 156 return 1;
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index 8c331ca6e5c9..c6216f454ffb 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -53,12 +53,15 @@ sal_ioif_init(u64 *result)
53} 53}
54 54
55/* 55/*
56 * sn_hubdev_add - The 'add' function of the acpi_sn_hubdev_driver. 56 * sn_acpi_hubdev_init() - This function is called by acpi_ns_get_device_callback()
57 * Called for every "SGIHUB" or "SGITIO" device defined 57 * for all SGIHUB and SGITIO acpi devices defined in the
58 * in the ACPI namespace. 58 * DSDT. It obtains the hubdev_info pointer from the
59 * ACPI vendor resource, which the PROM setup, and sets up the
60 * hubdev_info in the pda.
59 */ 61 */
60static int __init 62
61sn_hubdev_add(struct acpi_device *device) 63static acpi_status __init
64sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
62{ 65{
63 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 66 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
64 u64 addr; 67 u64 addr;
@@ -67,18 +70,19 @@ sn_hubdev_add(struct acpi_device *device)
67 int i; 70 int i;
68 u64 nasid; 71 u64 nasid;
69 struct acpi_resource *resource; 72 struct acpi_resource *resource;
70 int ret = 0;
71 acpi_status status; 73 acpi_status status;
72 struct acpi_resource_vendor_typed *vendor; 74 struct acpi_resource_vendor_typed *vendor;
73 extern void sn_common_hubdev_init(struct hubdev_info *); 75 extern void sn_common_hubdev_init(struct hubdev_info *);
74 76
75 status = acpi_get_vendor_resource(device->handle, METHOD_NAME__CRS, 77 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
76 &sn_uuid, &buffer); 78 &sn_uuid, &buffer);
77 if (ACPI_FAILURE(status)) { 79 if (ACPI_FAILURE(status)) {
78 printk(KERN_ERR 80 printk(KERN_ERR
79 "sn_hubdev_add: acpi_get_vendor_resource() failed: %d\n", 81 "sn_acpi_hubdev_init: acpi_get_vendor_resource() "
80 status); 82 "(0x%x) failed for: ", status);
81 return 1; 83 acpi_ns_print_node_pathname(handle, NULL);
84 printk("\n");
85 return AE_OK; /* Continue walking namespace */
82 } 86 }
83 87
84 resource = buffer.pointer; 88 resource = buffer.pointer;
@@ -86,9 +90,10 @@ sn_hubdev_add(struct acpi_device *device)
86 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != 90 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
87 sizeof(struct hubdev_info *)) { 91 sizeof(struct hubdev_info *)) {
88 printk(KERN_ERR 92 printk(KERN_ERR
89 "sn_hubdev_add: Invalid vendor data length: %d\n", 93 "sn_acpi_hubdev_init: Invalid vendor data length: %d for: ",
90 vendor->byte_length); 94 vendor->byte_length);
91 ret = 1; 95 acpi_ns_print_node_pathname(handle, NULL);
96 printk("\n");
92 goto exit; 97 goto exit;
93 } 98 }
94 99
@@ -103,7 +108,7 @@ sn_hubdev_add(struct acpi_device *device)
103 108
104exit: 109exit:
105 kfree(buffer.pointer); 110 kfree(buffer.pointer);
106 return ret; 111 return AE_OK; /* Continue walking namespace */
107} 112}
108 113
109/* 114/*
@@ -441,14 +446,6 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
441 446
442EXPORT_SYMBOL(sn_acpi_slot_fixup); 447EXPORT_SYMBOL(sn_acpi_slot_fixup);
443 448
444static struct acpi_driver acpi_sn_hubdev_driver = {
445 .name = "SGI HUBDEV Driver",
446 .ids = "SGIHUB,SGITIO",
447 .ops = {
448 .add = sn_hubdev_add,
449 },
450};
451
452 449
453/* 450/*
454 * sn_acpi_bus_fixup - Perform SN specific setup of software structs 451 * sn_acpi_bus_fixup - Perform SN specific setup of software structs
@@ -492,7 +489,10 @@ sn_io_acpi_init(void)
492 /* SN Altix does not follow the IOSAPIC IRQ routing model */ 489 /* SN Altix does not follow the IOSAPIC IRQ routing model */
493 acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; 490 acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
494 491
495 acpi_bus_register_driver(&acpi_sn_hubdev_driver); 492 /* Setup hubdev_info for all SGIHUB/SGITIO devices */
493 acpi_get_devices("SGIHUB", sn_acpi_hubdev_init, NULL, NULL);
494 acpi_get_devices("SGITIO", sn_acpi_hubdev_init, NULL, NULL);
495
496 status = sal_ioif_init(&result); 496 status = sal_ioif_init(&result);
497 if (status || result) 497 if (status || result)
498 panic("sal_ioif_init failed: [%lx] %s\n", 498 panic("sal_ioif_init failed: [%lx] %s\n",
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 600be3ebae05..6b10e5d28488 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -247,10 +247,18 @@ sn_io_slot_fixup(struct pci_dev *dev)
247 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; 247 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
248 dev->resource[idx].start = addr; 248 dev->resource[idx].start = addr;
249 dev->resource[idx].end = addr + size; 249 dev->resource[idx].end = addr + size;
250
251 /*
252 * if it's already in the device structure, remove it before
253 * inserting
254 */
255 if (dev->resource[idx].parent && dev->resource[idx].parent->child)
256 release_resource(&dev->resource[idx]);
257
250 if (dev->resource[idx].flags & IORESOURCE_IO) 258 if (dev->resource[idx].flags & IORESOURCE_IO)
251 dev->resource[idx].parent = &ioport_resource; 259 insert_resource(&ioport_resource, &dev->resource[idx]);
252 else 260 else
253 dev->resource[idx].parent = &iomem_resource; 261 insert_resource(&iomem_resource, &dev->resource[idx]);
254 /* If ROM, mark as shadowed in PROM */ 262 /* If ROM, mark as shadowed in PROM */
255 if (idx == PCI_ROM_RESOURCE) 263 if (idx == PCI_ROM_RESOURCE)
256 dev->resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY; 264 dev->resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 8c5bee01eaa2..8d2a1bfbfe7c 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -205,7 +205,17 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
205 (void)sn_retarget_vector(sn_irq_info, nasid, slice); 205 (void)sn_retarget_vector(sn_irq_info, nasid, slice);
206} 206}
207 207
208struct hw_interrupt_type irq_type_sn = { 208static void
209sn_mask_irq(unsigned int irq)
210{
211}
212
213static void
214sn_unmask_irq(unsigned int irq)
215{
216}
217
218struct irq_chip irq_type_sn = {
209 .name = "SN hub", 219 .name = "SN hub",
210 .startup = sn_startup_irq, 220 .startup = sn_startup_irq,
211 .shutdown = sn_shutdown_irq, 221 .shutdown = sn_shutdown_irq,
@@ -213,6 +223,8 @@ struct hw_interrupt_type irq_type_sn = {
213 .disable = sn_disable_irq, 223 .disable = sn_disable_irq,
214 .ack = sn_ack_irq, 224 .ack = sn_ack_irq,
215 .end = sn_end_irq, 225 .end = sn_end_irq,
226 .mask = sn_mask_irq,
227 .unmask = sn_unmask_irq,
216 .set_affinity = sn_set_affinity_irq 228 .set_affinity = sn_set_affinity_irq
217}; 229};
218 230
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 8571e52c2efd..a9bed5ca2ed8 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -348,8 +348,7 @@ sn_scan_pcdp(void)
348 continue; /* not PCI interconnect */ 348 continue; /* not PCI interconnect */
349 349
350 if (if_pci.translation & PCDP_PCI_TRANS_IOPORT) 350 if (if_pci.translation & PCDP_PCI_TRANS_IOPORT)
351 vga_console_iobase = 351 vga_console_iobase = if_pci.ioport_tra;
352 if_pci.ioport_tra | __IA64_UNCACHED_OFFSET;
353 352
354 if (if_pci.translation & PCDP_PCI_TRANS_MMIO) 353 if (if_pci.translation & PCDP_PCI_TRANS_MMIO)
355 vga_console_membase = 354 vga_console_membase =
@@ -397,6 +396,8 @@ void __init sn_setup(char **cmdline_p)
397 ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE); 396 ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
398 ia64_sn_set_os_feature(OSF_ACPI_ENABLE); 397 ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
399 398
399 /* Load the new DSDT and SSDT tables into the global table list. */
400 acpi_table_init();
400 401
401#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) 402#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
402 /* 403 /*
@@ -427,7 +428,8 @@ void __init sn_setup(char **cmdline_p)
427 * bus containing the VGA console. 428 * bus containing the VGA console.
428 */ 429 */
429 if (vga_console_iobase) { 430 if (vga_console_iobase) {
430 io_space[0].mmio_base = vga_console_iobase; 431 io_space[0].mmio_base =
432 (unsigned long) ioremap(vga_console_iobase, 0);
431 io_space[0].sparse = 0; 433 io_space[0].sparse = 0;
432 } 434 }
433 435
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 1ee977fb6ebb..95af40cb22f2 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -96,10 +96,14 @@ pcibr_dmamap_ate32(struct pcidev_info *info,
96 } 96 }
97 97
98 /* 98 /*
99 * If we're mapping for MSI, set the MSI bit in the ATE 99 * If we're mapping for MSI, set the MSI bit in the ATE. If it's a
100 * TIOCP based pci bus, we also need to set the PIO bit in the ATE.
100 */ 101 */
101 if (dma_flags & SN_DMA_MSI) 102 if (dma_flags & SN_DMA_MSI) {
102 ate |= PCI32_ATE_MSI; 103 ate |= PCI32_ATE_MSI;
104 if (IS_TIOCP_SOFT(pcibus_info))
105 ate |= PCI32_ATE_PIO;
106 }
103 107
104 ate_write(pcibus_info, ate_index, ate_count, ate); 108 ate_write(pcibus_info, ate_index, ate_count, ate);
105 109
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a1cd84f9b3bc..c78b14380b3e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -250,7 +250,7 @@ config LASAT
250 select R5000_CPU_SCACHE 250 select R5000_CPU_SCACHE
251 select SYS_HAS_CPU_R5000 251 select SYS_HAS_CPU_R5000
252 select SYS_SUPPORTS_32BIT_KERNEL 252 select SYS_SUPPORTS_32BIT_KERNEL
253 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 253 select SYS_SUPPORTS_64BIT_KERNEL if BROKEN
254 select SYS_SUPPORTS_LITTLE_ENDIAN 254 select SYS_SUPPORTS_LITTLE_ENDIAN
255 select GENERIC_HARDIRQS_NO__DO_IRQ 255 select GENERIC_HARDIRQS_NO__DO_IRQ
256 256
@@ -470,11 +470,6 @@ config MIPS_XXS1500
470 select SOC_AU1500 470 select SOC_AU1500
471 select SYS_SUPPORTS_LITTLE_ENDIAN 471 select SYS_SUPPORTS_LITTLE_ENDIAN
472 472
473config PNX8550_V2PCI
474 bool "Philips PNX8550 based Viper2-PCI board"
475 select PNX8550
476 select SYS_SUPPORTS_LITTLE_ENDIAN
477
478config PNX8550_JBS 473config PNX8550_JBS
479 bool "Philips PNX8550 based JBS board" 474 bool "Philips PNX8550 based JBS board"
480 select PNX8550 475 select PNX8550
@@ -547,6 +542,8 @@ config QEMU
547 select SYS_SUPPORTS_LITTLE_ENDIAN 542 select SYS_SUPPORTS_LITTLE_ENDIAN
548 select ARCH_SPARSEMEM_ENABLE 543 select ARCH_SPARSEMEM_ENABLE
549 select GENERIC_HARDIRQS_NO__DO_IRQ 544 select GENERIC_HARDIRQS_NO__DO_IRQ
545 select NR_CPUS_DEFAULT_1
546 select SYS_SUPPORTS_SMP
550 help 547 help
551 Qemu is a software emulator which among other architectures also 548 Qemu is a software emulator which among other architectures also
552 can simulate a MIPS32 4Kc system. This patch adds support for the 549 can simulate a MIPS32 4Kc system. This patch adds support for the
@@ -1564,6 +1561,7 @@ config MIPS_MT_SMP
1564 select CPU_MIPSR2_IRQ_VI 1561 select CPU_MIPSR2_IRQ_VI
1565 select CPU_MIPSR2_SRS 1562 select CPU_MIPSR2_SRS
1566 select MIPS_MT 1563 select MIPS_MT
1564 select NR_CPUS_DEFAULT_2
1567 select SMP 1565 select SMP
1568 select SYS_SUPPORTS_SMP 1566 select SYS_SUPPORTS_SMP
1569 help 1567 help
@@ -1578,7 +1576,6 @@ config MIPS_MT_SMTC
1578 select CPU_MIPSR2_IRQ_VI 1576 select CPU_MIPSR2_IRQ_VI
1579 select CPU_MIPSR2_SRS 1577 select CPU_MIPSR2_SRS
1580 select MIPS_MT 1578 select MIPS_MT
1581 select NR_CPUS_DEFAULT_2
1582 select NR_CPUS_DEFAULT_8 1579 select NR_CPUS_DEFAULT_8
1583 select SMP 1580 select SMP
1584 select SYS_SUPPORTS_SMP 1581 select SYS_SUPPORTS_SMP
@@ -1609,7 +1606,7 @@ config MIPS_MT_FPAFF
1609 1606
1610config MIPS_MT_SMTC_INSTANT_REPLAY 1607config MIPS_MT_SMTC_INSTANT_REPLAY
1611 bool "Low-latency Dispatch of Deferred SMTC IPIs" 1608 bool "Low-latency Dispatch of Deferred SMTC IPIs"
1612 depends on MIPS_MT_SMTC 1609 depends on MIPS_MT_SMTC && !PREEMPT
1613 default y 1610 default y
1614 help 1611 help
1615 SMTC pseudo-interrupts between TCs are deferred and queued 1612 SMTC pseudo-interrupts between TCs are deferred and queued
@@ -1810,6 +1807,9 @@ config SMP
1810config SYS_SUPPORTS_SMP 1807config SYS_SUPPORTS_SMP
1811 bool 1808 bool
1812 1809
1810config NR_CPUS_DEFAULT_1
1811 bool
1812
1813config NR_CPUS_DEFAULT_2 1813config NR_CPUS_DEFAULT_2
1814 bool 1814 bool
1815 1815
@@ -1830,8 +1830,9 @@ config NR_CPUS_DEFAULT_64
1830 1830
1831config NR_CPUS 1831config NR_CPUS
1832 int "Maximum number of CPUs (2-64)" 1832 int "Maximum number of CPUs (2-64)"
1833 range 2 64 1833 range 1 64 if NR_CPUS_DEFAULT_1
1834 depends on SMP 1834 depends on SMP
1835 default "1" if NR_CPUS_DEFAULT_1
1835 default "2" if NR_CPUS_DEFAULT_2 1836 default "2" if NR_CPUS_DEFAULT_2
1836 default "4" if NR_CPUS_DEFAULT_4 1837 default "4" if NR_CPUS_DEFAULT_4
1837 default "8" if NR_CPUS_DEFAULT_8 1838 default "8" if NR_CPUS_DEFAULT_8
@@ -1842,10 +1843,13 @@ config NR_CPUS
1842 This allows you to specify the maximum number of CPUs which this 1843 This allows you to specify the maximum number of CPUs which this
1843 kernel will support. The maximum supported value is 32 for 32-bit 1844 kernel will support. The maximum supported value is 32 for 32-bit
1844 kernel and 64 for 64-bit kernels; the minimum value which makes 1845 kernel and 64 for 64-bit kernels; the minimum value which makes
1845 sense is 2. 1846 sense is 1 for Qemu (useful only for kernel debugging purposes)
1847 and 2 for all others.
1846 1848
1847 This is purely to save memory - each supported CPU adds 1849 This is purely to save memory - each supported CPU adds
1848 approximately eight kilobytes to the kernel image. 1850 approximately eight kilobytes to the kernel image. For best
1851 performance should round up your number of processors to the next
1852 power of two.
1849 1853
1850# 1854#
1851# Timer Interrupt Frequency Configuration 1855# Timer Interrupt Frequency Configuration
diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c
index 0ac8f42d3752..e2f75b13312f 100644
--- a/arch/mips/arc/init.c
+++ b/arch/mips/arc/init.c
@@ -23,16 +23,16 @@ LONG *_prom_argv, *_prom_envp;
23void __init prom_init(void) 23void __init prom_init(void)
24{ 24{
25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK; 25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK;
26
26 romvec = ROMVECTOR; 27 romvec = ROMVECTOR;
27 ULONG cnt;
28 CHAR c;
29 28
30 prom_argc = fw_arg0; 29 prom_argc = fw_arg0;
31 _prom_argv = (LONG *) fw_arg1; 30 _prom_argv = (LONG *) fw_arg1;
32 _prom_envp = (LONG *) fw_arg2; 31 _prom_envp = (LONG *) fw_arg2;
33 32
34 if (pb->magic != 0x53435241) { 33 if (pb->magic != 0x53435241) {
35 printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", pb->magic); 34 printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n",
35 (unsigned long) pb->magic);
36 while(1) 36 while(1)
37 ; 37 ;
38 } 38 }
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
index 458894933a4c..39e251300c64 100644
--- a/arch/mips/configs/atlas_defconfig
+++ b/arch/mips/configs/atlas_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_ATLAS=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index aa05e294ea62..4713a13211ce 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index b2594fa556f3..5e7ae56b1f3c 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 9090a7aba6c1..ba593b510b76 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_COBALT=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 4cb8cf4255a2..0db6a8b37301 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_DB1000=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index d86dedf27fc4..162add97c5ef 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_DB1100=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index c24b6008345e..82801ec43e6a 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_DB1200=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index baad2c5223ba..545f23094e13 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_DB1500=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index c29fdab0423a..5bd3b4328e57 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_DB1550=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
index f4b316d2cd70..5b502a2013fb 100644
--- a/arch/mips/configs/ddb5477_defconfig
+++ b/arch/mips/configs/ddb5477_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45CONFIG_DDB5477=y 44CONFIG_DDB5477=y
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index 9c38e5c77761..4bbdab078ff1 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -39,7 +39,6 @@ CONFIG_MACH_DECSTATION=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 922af379aa41..b5714a6a5398 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/emma2rh_defconfig b/arch/mips/configs/emma2rh_defconfig
index c0db8f14713d..3044579f171a 100644
--- a/arch/mips/configs/emma2rh_defconfig
+++ b/arch/mips/configs/emma2rh_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
index ce088b36291d..c10e4e063226 100644
--- a/arch/mips/configs/ev64120_defconfig
+++ b/arch/mips/configs/ev64120_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_EV64120=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
index 82f204d080b7..460d7a26a8ba 100644
--- a/arch/mips/configs/excite_defconfig
+++ b/arch/mips/configs/excite_defconfig
@@ -40,7 +40,6 @@ CONFIG_BASLER_EXCITE=y
40# CONFIG_MOMENCO_OCELOT_C is not set 40# CONFIG_MOMENCO_OCELOT_C is not set
41# CONFIG_MOMENCO_OCELOT_G is not set 41# CONFIG_MOMENCO_OCELOT_G is not set
42# CONFIG_MIPS_XXS1500 is not set 42# CONFIG_MIPS_XXS1500 is not set
43# CONFIG_PNX8550_V2PCI is not set
44# CONFIG_PNX8550_JBS is not set 43# CONFIG_PNX8550_JBS is not set
45# CONFIG_PNX8550_STB810 is not set 44# CONFIG_PNX8550_STB810 is not set
46# CONFIG_DDB5477 is not set 45# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index cb81f13bd45a..7ec618f3c8b9 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 46f6ac4083b9..9ddc3eff4793 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index d9e5000d5329..8fc18809d5ff 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
index 57ef0c45a62b..083104daa2ca 100644
--- a/arch/mips/configs/jaguar-atx_defconfig
+++ b/arch/mips/configs/jaguar-atx_defconfig
@@ -39,7 +39,6 @@ CONFIG_MOMENCO_JAGUAR_ATX=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index 21d979f8326c..9331cb0a19b1 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -39,7 +39,6 @@ CONFIG_MACH_JAZZ=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 98b9fbc042f4..21a094752dab 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
index b3f767ff1c5a..fd4272c1458a 100644
--- a/arch/mips/configs/lasat200_defconfig
+++ b/arch/mips/configs/lasat200_defconfig
@@ -39,7 +39,6 @@ CONFIG_LASAT=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index a5f379d626d6..1f64d7632a03 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_MALTA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 5ff53e184912..a2db5c201216 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_SIM=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index 750e6445c613..ad5c0bf87b2b 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ocelot_3_defconfig b/arch/mips/configs/ocelot_3_defconfig
index 2febd0a7fba2..28547313ce13 100644
--- a/arch/mips/configs/ocelot_3_defconfig
+++ b/arch/mips/configs/ocelot_3_defconfig
@@ -39,7 +39,6 @@ CONFIG_MOMENCO_OCELOT_3=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
index b8f457300bbf..82ff6fc0cd41 100644
--- a/arch/mips/configs/ocelot_c_defconfig
+++ b/arch/mips/configs/ocelot_c_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39CONFIG_MOMENCO_OCELOT_C=y 39CONFIG_MOMENCO_OCELOT_C=y
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
index 8ade072271cd..15a027e00eec 100644
--- a/arch/mips/configs/ocelot_defconfig
+++ b/arch/mips/configs/ocelot_defconfig
@@ -39,7 +39,6 @@ CONFIG_MOMENCO_OCELOT=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/ocelot_g_defconfig b/arch/mips/configs/ocelot_g_defconfig
index d20a2216c11d..7078e6b3ea11 100644
--- a/arch/mips/configs/ocelot_g_defconfig
+++ b/arch/mips/configs/ocelot_g_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40CONFIG_MOMENCO_OCELOT_G=y 40CONFIG_MOMENCO_OCELOT_G=y
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 33fcc8133bc0..69678d99ae61 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_PB1100=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index e07c55dc8dc1..070672799dac 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_PB1500=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index df210dd22476..354e49b7a5f1 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_PB1550=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 106a1641c0b5..fae16c5ec521 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43CONFIG_PNX8550_JBS=y 42CONFIG_PNX8550_JBS=y
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/pnx8550-stb810_defconfig b/arch/mips/configs/pnx8550-stb810_defconfig
index 8caa2cd1aa7c..cd821e52181d 100644
--- a/arch/mips/configs/pnx8550-stb810_defconfig
+++ b/arch/mips/configs/pnx8550-stb810_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44CONFIG_PNX8550_STB810=y 43CONFIG_PNX8550_STB810=y
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig
index 43f1becec2a4..3d6c2d743502 100644
--- a/arch/mips/configs/pnx8550-v2pci_defconfig
+++ b/arch/mips/configs/pnx8550-v2pci_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42CONFIG_PNX8550_V2PCI=y
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index f68396d19f9a..8e8d03157954 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/rbhma4500_defconfig b/arch/mips/configs/rbhma4500_defconfig
index a6a824fcc874..29e0df9f4be0 100644
--- a/arch/mips/configs/rbhma4500_defconfig
+++ b/arch/mips/configs/rbhma4500_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index bee3702d501d..5593cde9f74c 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 3c891ed10141..6c4f09a381e2 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
index e31d964a053b..988b9cdef01f 100644
--- a/arch/mips/configs/sead_defconfig
+++ b/arch/mips/configs/sead_defconfig
@@ -39,7 +39,6 @@ CONFIG_MIPS_SEAD=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index 5771c1aee76a..b5be8b74d896 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
index a8eb4b182d34..1756d2bdf6b8 100644
--- a/arch/mips/configs/tb0229_defconfig
+++ b/arch/mips/configs/tb0229_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index c58afa2eac6b..8bb6be4342b6 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 2abbd6827720..8f019ffcc71b 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
index 44b6b7c1fdb6..52b48c0715d3 100644
--- a/arch/mips/configs/wrppmc_defconfig
+++ b/arch/mips/configs/wrppmc_defconfig
@@ -39,7 +39,6 @@ CONFIG_WR_PPMC=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index f24e1c6fc484..6824606309e5 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/ddb5xxx/ddb5477/irq.c b/arch/mips/ddb5xxx/ddb5477/irq.c
index 2b23234a5b95..faa4a506bf82 100644
--- a/arch/mips/ddb5xxx/ddb5477/irq.c
+++ b/arch/mips/ddb5xxx/ddb5477/irq.c
@@ -194,7 +194,7 @@ static void vrc5477_irq_dispatch(void)
194 194
195asmlinkage void plat_irq_dispatch(void) 195asmlinkage void plat_irq_dispatch(void)
196{ 196{
197 unsigned int pending = read_c0_cause() & read_c0_status(); 197 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
198 198
199 if (pending & STATUSF_IP7) 199 if (pending & STATUSF_IP7)
200 do_IRQ(CPU_IRQ_BASE + 7); 200 do_IRQ(CPU_IRQ_BASE + 7);
diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c
index bf2858071f1f..a217aafe59f6 100644
--- a/arch/mips/dec/prom/init.c
+++ b/arch/mips/dec/prom/init.c
@@ -103,9 +103,6 @@ void __init prom_init(void)
103 if (prom_is_rex(magic)) 103 if (prom_is_rex(magic))
104 rex_clear_cache(); 104 rex_clear_cache();
105 105
106 /* Register the early console. */
107 register_prom_console();
108
109 /* Were we compiled with the right CPU option? */ 106 /* Were we compiled with the right CPU option? */
110#if defined(CONFIG_CPU_R3000) 107#if defined(CONFIG_CPU_R3000)
111 if ((current_cpu_data.cputype == CPU_R4000SC) || 108 if ((current_cpu_data.cputype == CPU_R4000SC) ||
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index 8cb8f5919194..41211f8b7738 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -39,7 +39,6 @@ CONFIG_ZONE_DMA=y
39# CONFIG_MOMENCO_OCELOT_C is not set 39# CONFIG_MOMENCO_OCELOT_C is not set
40# CONFIG_MOMENCO_OCELOT_G is not set 40# CONFIG_MOMENCO_OCELOT_G is not set
41# CONFIG_MIPS_XXS1500 is not set 41# CONFIG_MIPS_XXS1500 is not set
42# CONFIG_PNX8550_V2PCI is not set
43# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
44# CONFIG_PNX8550_STB810 is not set 43# CONFIG_PNX8550_STB810 is not set
45# CONFIG_DDB5477 is not set 44# CONFIG_DDB5477 is not set
diff --git a/arch/mips/emma2rh/markeins/irq.c b/arch/mips/emma2rh/markeins/irq.c
index e26630026375..6bcf6a06367a 100644
--- a/arch/mips/emma2rh/markeins/irq.c
+++ b/arch/mips/emma2rh/markeins/irq.c
@@ -115,7 +115,7 @@ void __init arch_init_irq(void)
115 115
116asmlinkage void plat_irq_dispatch(void) 116asmlinkage void plat_irq_dispatch(void)
117{ 117{
118 unsigned int pending = read_c0_status() & read_c0_cause(); 118 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
119 119
120 if (pending & STATUSF_IP7) 120 if (pending & STATUSF_IP7)
121 do_IRQ(CPU_IRQ_BASE + 7); 121 do_IRQ(CPU_IRQ_BASE + 7);
diff --git a/arch/mips/gt64120/ev64120/irq.c b/arch/mips/gt64120/ev64120/irq.c
index 04572b9c9642..64e4c80b6139 100644
--- a/arch/mips/gt64120/ev64120/irq.c
+++ b/arch/mips/gt64120/ev64120/irq.c
@@ -48,7 +48,7 @@
48 48
49asmlinkage void plat_irq_dispatch(void) 49asmlinkage void plat_irq_dispatch(void)
50{ 50{
51 unsigned int pending = read_c0_status() & read_c0_cause(); 51 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
52 52
53 if (pending & STATUSF_IP4) /* int2 hardware line (timer) */ 53 if (pending & STATUSF_IP4) /* int2 hardware line (timer) */
54 do_IRQ(4); 54 do_IRQ(4);
diff --git a/arch/mips/gt64120/momenco_ocelot/prom.c b/arch/mips/gt64120/momenco_ocelot/prom.c
index 78f393b2afd9..c71c85276c74 100644
--- a/arch/mips/gt64120/momenco_ocelot/prom.c
+++ b/arch/mips/gt64120/momenco_ocelot/prom.c
@@ -32,7 +32,6 @@ void __init prom_init(void)
32 char **arg = (char **) fw_arg1; 32 char **arg = (char **) fw_arg1;
33 char **env = (char **) fw_arg2; 33 char **env = (char **) fw_arg2;
34 struct callvectors *cv = (struct callvectors *) fw_arg3; 34 struct callvectors *cv = (struct callvectors *) fw_arg3;
35 uint32_t tmp;
36 int i; 35 int i;
37 36
38 /* save the PROM vectors for debugging use */ 37 /* save the PROM vectors for debugging use */
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
index 94f94ebbda6c..98b6fb38096d 100644
--- a/arch/mips/gt64120/momenco_ocelot/setup.c
+++ b/arch/mips/gt64120/momenco_ocelot/setup.c
@@ -79,7 +79,7 @@ static char reset_reason;
79static void __init setup_l3cache(unsigned long size); 79static void __init setup_l3cache(unsigned long size);
80 80
81/* setup code for a handoff from a version 1 PMON 2000 PROM */ 81/* setup code for a handoff from a version 1 PMON 2000 PROM */
82void PMON_v1_setup() 82static void PMON_v1_setup(void)
83{ 83{
84 /* A wired TLB entry for the GT64120A and the serial port. The 84 /* A wired TLB entry for the GT64120A and the serial port. The
85 GT64120A is going to be hit on every IRQ anyway - there's 85 GT64120A is going to be hit on every IRQ anyway - there's
diff --git a/arch/mips/gt64120/wrppmc/irq.c b/arch/mips/gt64120/wrppmc/irq.c
index d3d96591780e..06177bf5b1d6 100644
--- a/arch/mips/gt64120/wrppmc/irq.c
+++ b/arch/mips/gt64120/wrppmc/irq.c
@@ -32,7 +32,7 @@
32 32
33asmlinkage void plat_irq_dispatch(void) 33asmlinkage void plat_irq_dispatch(void)
34{ 34{
35 unsigned int pending = read_c0_status() & read_c0_cause(); 35 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
36 36
37 if (pending & STATUSF_IP7) 37 if (pending & STATUSF_IP7)
38 do_IRQ(WRPPMC_MIPS_TIMER_IRQ); /* CPU Compare/Count internal timer */ 38 do_IRQ(WRPPMC_MIPS_TIMER_IRQ); /* CPU Compare/Count internal timer */
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 295892e4ce53..015cf4bb51dd 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -122,7 +122,7 @@ static void ll_local_dev(void)
122 122
123asmlinkage void plat_irq_dispatch(void) 123asmlinkage void plat_irq_dispatch(void)
124{ 124{
125 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM; 125 unsigned int pending = read_c0_cause() & read_c0_status();
126 126
127 if (pending & IE_IRQ5) 127 if (pending & IE_IRQ5)
128 write_c0_compare(0); 128 write_c0_compare(0);
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
index 46e421e14348..e8e0ffb9354d 100644
--- a/arch/mips/jazz/jazzdma.c
+++ b/arch/mips/jazz/jazzdma.c
@@ -67,7 +67,8 @@ void __init vdma_init(void)
67 * aligned and should be uncached to avoid cache flushing after every 67 * aligned and should be uncached to avoid cache flushing after every
68 * update. 68 * update.
69 */ 69 */
70 vdma_pagetable_start = alloc_bootmem_low_pages(VDMA_PGTBL_SIZE); 70 vdma_pagetable_start =
71 (unsigned long) alloc_bootmem_low_pages(VDMA_PGTBL_SIZE);
71 if (!vdma_pagetable_start) 72 if (!vdma_pagetable_start)
72 BUG(); 73 BUG();
73 dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE); 74 dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE);
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index 0b78fcbf044a..686249c5c328 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -121,7 +121,11 @@ FEXPORT(restore_partial) # restore partial frame
121 SAVE_AT 121 SAVE_AT
122 SAVE_TEMP 122 SAVE_TEMP
123 LONG_L v0, PT_STATUS(sp) 123 LONG_L v0, PT_STATUS(sp)
124 and v0, 1 124#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
125 and v0, ST0_IEP
126#else
127 and v0, ST0_IE
128#endif
125 beqz v0, 1f 129 beqz v0, 1f
126 jal trace_hardirqs_on 130 jal trace_hardirqs_on
127 b 2f 131 b 2f
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index aacd4a005c5f..297bd56c2347 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -128,6 +128,37 @@ handle_vcei:
128 128
129 .align 5 129 .align 5
130NESTED(handle_int, PT_SIZE, sp) 130NESTED(handle_int, PT_SIZE, sp)
131#ifdef CONFIG_TRACE_IRQFLAGS
132 /*
133 * Check to see if the interrupted code has just disabled
134 * interrupts and ignore this interrupt for now if so.
135 *
136 * local_irq_disable() disables interrupts and then calls
137 * trace_hardirqs_off() to track the state. If an interrupt is taken
138 * after interrupts are disabled but before the state is updated
139 * it will appear to restore_all that it is incorrectly returning with
140 * interrupts disabled
141 */
142 .set push
143 .set noat
144 mfc0 k0, CP0_STATUS
145#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
146 and k0, ST0_IEP
147 bnez k0, 1f
148
149 mfc0 k0, EP0_EPC
150 .set noreorder
151 j k0
152 rfe
153#else
154 and k0, ST0_IE
155 bnez k0, 1f
156
157 eret
158#endif
1591:
160 .set pop
161#endif
131 SAVE_ALL 162 SAVE_ALL
132 CLI 163 CLI
133 TRACE_IRQS_OFF 164 TRACE_IRQS_OFF
@@ -181,13 +212,13 @@ NESTED(except_vec_vi, 0, sp)
181 * during service by SMTC kernel, we also want to 212 * during service by SMTC kernel, we also want to
182 * pass the IM value to be cleared. 213 * pass the IM value to be cleared.
183 */ 214 */
184EXPORT(except_vec_vi_mori) 215FEXPORT(except_vec_vi_mori)
185 ori a0, $0, 0 216 ori a0, $0, 0
186#endif /* CONFIG_MIPS_MT_SMTC */ 217#endif /* CONFIG_MIPS_MT_SMTC */
187EXPORT(except_vec_vi_lui) 218FEXPORT(except_vec_vi_lui)
188 lui v0, 0 /* Patched */ 219 lui v0, 0 /* Patched */
189 j except_vec_vi_handler 220 j except_vec_vi_handler
190EXPORT(except_vec_vi_ori) 221FEXPORT(except_vec_vi_ori)
191 ori v0, 0 /* Patched */ 222 ori v0, 0 /* Patched */
192 .set pop 223 .set pop
193 END(except_vec_vi) 224 END(except_vec_vi)
@@ -220,7 +251,17 @@ NESTED(except_vec_vi_handler, 0, sp)
220 _ehb 251 _ehb
221#endif /* CONFIG_MIPS_MT_SMTC */ 252#endif /* CONFIG_MIPS_MT_SMTC */
222 CLI 253 CLI
254#ifdef CONFIG_TRACE_IRQFLAGS
255 move s0, v0
256#ifdef CONFIG_MIPS_MT_SMTC
257 move s1, a0
258#endif
223 TRACE_IRQS_OFF 259 TRACE_IRQS_OFF
260#ifdef CONFIG_MIPS_MT_SMTC
261 move a0, s1
262#endif
263 move v0, s0
264#endif
224 265
225 LONG_L s0, TI_REGS($28) 266 LONG_L s0, TI_REGS($28)
226 LONG_S sp, TI_REGS($28) 267 LONG_S sp, TI_REGS($28)
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 5929f883e46b..29eadd404fa5 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -70,6 +70,7 @@ static int sp_stopping = 0;
70#define MTSP_SYSCALL_GETTIME (MTSP_SYSCALL_BASE + 7) 70#define MTSP_SYSCALL_GETTIME (MTSP_SYSCALL_BASE + 7)
71#define MTSP_SYSCALL_PIPEFREQ (MTSP_SYSCALL_BASE + 8) 71#define MTSP_SYSCALL_PIPEFREQ (MTSP_SYSCALL_BASE + 8)
72#define MTSP_SYSCALL_GETTOD (MTSP_SYSCALL_BASE + 9) 72#define MTSP_SYSCALL_GETTOD (MTSP_SYSCALL_BASE + 9)
73#define MTSP_SYSCALL_IOCTL (MTSP_SYSCALL_BASE + 10)
73 74
74#define MTSP_O_RDONLY 0x0000 75#define MTSP_O_RDONLY 0x0000
75#define MTSP_O_WRONLY 0x0001 76#define MTSP_O_WRONLY 0x0001
@@ -110,7 +111,8 @@ struct apsp_table syscall_command_table[] = {
110 { MTSP_SYSCALL_CLOSE, __NR_close }, 111 { MTSP_SYSCALL_CLOSE, __NR_close },
111 { MTSP_SYSCALL_READ, __NR_read }, 112 { MTSP_SYSCALL_READ, __NR_read },
112 { MTSP_SYSCALL_WRITE, __NR_write }, 113 { MTSP_SYSCALL_WRITE, __NR_write },
113 { MTSP_SYSCALL_LSEEK32, __NR_lseek } 114 { MTSP_SYSCALL_LSEEK32, __NR_lseek },
115 { MTSP_SYSCALL_IOCTL, __NR_ioctl }
114}; 116};
115 117
116static int sp_syscall(int num, int arg0, int arg1, int arg2, int arg3) 118static int sp_syscall(int num, int arg0, int arg1, int arg2, int arg3)
@@ -189,6 +191,8 @@ void sp_work_handle_request(void)
189 struct mtsp_syscall_generic generic; 191 struct mtsp_syscall_generic generic;
190 struct mtsp_syscall_ret ret; 192 struct mtsp_syscall_ret ret;
191 struct kspd_notifications *n; 193 struct kspd_notifications *n;
194 unsigned long written;
195 mm_segment_t old_fs;
192 struct timeval tv; 196 struct timeval tv;
193 struct timezone tz; 197 struct timezone tz;
194 int cmd; 198 int cmd;
@@ -199,7 +203,11 @@ void sp_work_handle_request(void)
199 203
200 ret.retval = -1; 204 ret.retval = -1;
201 205
202 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall), 0)) { 206 old_fs = get_fs();
207 set_fs(KERNEL_DS);
208
209 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall))) {
210 set_fs(old_fs);
203 printk(KERN_ERR "Expected request but nothing to read\n"); 211 printk(KERN_ERR "Expected request but nothing to read\n");
204 return; 212 return;
205 } 213 }
@@ -207,7 +215,8 @@ void sp_work_handle_request(void)
207 size = sc.size; 215 size = sc.size;
208 216
209 if (size) { 217 if (size) {
210 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size, 0)) { 218 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size)) {
219 set_fs(old_fs);
211 printk(KERN_ERR "Expected request but nothing to read\n"); 220 printk(KERN_ERR "Expected request but nothing to read\n");
212 return; 221 return;
213 } 222 }
@@ -280,8 +289,11 @@ void sp_work_handle_request(void)
280 if (vpe_getuid(SP_VPE)) 289 if (vpe_getuid(SP_VPE))
281 sp_setfsuidgid( 0, 0); 290 sp_setfsuidgid( 0, 0);
282 291
283 if ((rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(struct mtsp_syscall_ret), 0)) 292 old_fs = get_fs();
284 < sizeof(struct mtsp_syscall_ret)) 293 set_fs(KERNEL_DS);
294 written = rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(ret));
295 set_fs(old_fs);
296 if (written < sizeof(ret))
285 printk("KSPD: sp_work_handle_request failed to send to SP\n"); 297 printk("KSPD: sp_work_handle_request failed to send to SP\n");
286} 298}
287 299
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 30d433f14f93..37849edd0645 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -311,6 +311,8 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
311 return ret; 311 return ret;
312} 312}
313 313
314#ifdef CONFIG_SYSVIPC
315
314asmlinkage long 316asmlinkage long
315sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) 317sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
316{ 318{
@@ -368,6 +370,16 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
368 return err; 370 return err;
369} 371}
370 372
373#else
374
375asmlinkage long
376sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
377{
378 return -ENOSYS;
379}
380
381#endif /* CONFIG_SYSVIPC */
382
371#ifdef CONFIG_MIPS32_N32 383#ifdef CONFIG_MIPS32_N32
372asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) 384asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg)
373{ 385{
@@ -564,49 +576,3 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
564 return do_fork(clone_flags, newsp, &regs, 0, 576 return do_fork(clone_flags, newsp, &regs, 0,
565 parent_tidptr, child_tidptr); 577 parent_tidptr, child_tidptr);
566} 578}
567
568/*
569 * Implement the event wait interface for the eventpoll file. It is the kernel
570 * part of the user space epoll_pwait(2).
571 */
572asmlinkage long compat_sys_epoll_pwait(int epfd,
573 struct epoll_event __user *events, int maxevents, int timeout,
574 const compat_sigset_t __user *sigmask, size_t sigsetsize)
575{
576 int error;
577 sigset_t ksigmask, sigsaved;
578
579 /*
580 * If the caller wants a certain signal mask to be set during the wait,
581 * we apply it here.
582 */
583 if (sigmask) {
584 if (sigsetsize != sizeof(sigset_t))
585 return -EINVAL;
586 if (!access_ok(VERIFY_READ, sigmask, sizeof(ksigmask)))
587 return -EFAULT;
588 if (__copy_conv_sigset_from_user(&ksigmask, sigmask))
589 return -EFAULT;
590 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
591 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
592 }
593
594 error = sys_epoll_wait(epfd, events, maxevents, timeout);
595
596 /*
597 * If we changed the signal mask, we need to restore the original one.
598 * In case we've got a signal while waiting, we do not restore the
599 * signal mask yet, and we allow do_signal() to deliver the signal on
600 * the way back to userspace, before the signal mask is restored.
601 */
602 if (sigmask) {
603 if (error == -EINTR) {
604 memcpy(&current->saved_sigmask, &sigsaved,
605 sizeof(sigsaved));
606 set_thread_flag(TIF_RESTORE_SIGMASK);
607 } else
608 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
609 }
610
611 return error;
612}
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 656bde2e11b1..28c2e2e6af73 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -49,8 +49,7 @@ LEAF(resume)
49#ifndef CONFIG_CPU_HAS_LLSC 49#ifndef CONFIG_CPU_HAS_LLSC
50 sw zero, ll_bit 50 sw zero, ll_bit
51#endif 51#endif
52 mfc0 t1, CP0_STATUS 52 mfc0 t2, CP0_STATUS
53 sw t1, THREAD_STATUS(a0)
54 cpu_save_nonscratch a0 53 cpu_save_nonscratch a0
55 sw ra, THREAD_REG31(a0) 54 sw ra, THREAD_REG31(a0)
56 55
@@ -60,8 +59,8 @@ LEAF(resume)
60 lw t3, TASK_THREAD_INFO(a0) 59 lw t3, TASK_THREAD_INFO(a0)
61 lw t0, TI_FLAGS(t3) 60 lw t0, TI_FLAGS(t3)
62 li t1, _TIF_USEDFPU 61 li t1, _TIF_USEDFPU
63 and t2, t0, t1 62 and t1, t0
64 beqz t2, 1f 63 beqz t1, 1f
65 nor t1, zero, t1 64 nor t1, zero, t1
66 65
67 and t0, t0, t1 66 and t0, t0, t1
@@ -74,10 +73,13 @@ LEAF(resume)
74 li t1, ~ST0_CU1 73 li t1, ~ST0_CU1
75 and t0, t0, t1 74 and t0, t0, t1
76 sw t0, ST_OFF(t3) 75 sw t0, ST_OFF(t3)
76 /* clear thread_struct CU1 bit */
77 and t2, t1
77 78
78 fpu_save_single a0, t0 # clobbers t0 79 fpu_save_single a0, t0 # clobbers t0
79 80
801: 811:
82 sw t2, THREAD_STATUS(a0)
81 /* 83 /*
82 * The order of restoring the registers takes care of the race 84 * The order of restoring the registers takes care of the race
83 * updating $28, $29 and kernelsp without disabling ints. 85 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 59c1577ecbb3..dbd42adc52ed 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -114,14 +114,6 @@ LEAF(_save_fp_context32)
114 */ 114 */
115LEAF(_restore_fp_context) 115LEAF(_restore_fp_context)
116 EX lw t0, SC_FPC_CSR(a0) 116 EX lw t0, SC_FPC_CSR(a0)
117
118 /* Fail if the CSR has exceptions pending */
119 srl t1, t0, 5
120 and t1, t0
121 andi t1, 0x1f << 7
122 bnez t1, fault
123 nop
124
125#ifdef CONFIG_64BIT 117#ifdef CONFIG_64BIT
126 EX ldc1 $f1, SC_FPREGS+8(a0) 118 EX ldc1 $f1, SC_FPREGS+8(a0)
127 EX ldc1 $f3, SC_FPREGS+24(a0) 119 EX ldc1 $f3, SC_FPREGS+24(a0)
@@ -165,14 +157,6 @@ LEAF(_restore_fp_context)
165LEAF(_restore_fp_context32) 157LEAF(_restore_fp_context32)
166 /* Restore an o32 sigcontext. */ 158 /* Restore an o32 sigcontext. */
167 EX lw t0, SC32_FPC_CSR(a0) 159 EX lw t0, SC32_FPC_CSR(a0)
168
169 /* Fail if the CSR has exceptions pending */
170 srl t1, t0, 5
171 and t1, t0
172 andi t1, 0x1f << 7
173 bnez t1, fault
174 nop
175
176 EX ldc1 $f0, SC32_FPREGS+0(a0) 160 EX ldc1 $f0, SC32_FPREGS+0(a0)
177 EX ldc1 $f2, SC32_FPREGS+16(a0) 161 EX ldc1 $f2, SC32_FPREGS+16(a0)
178 EX ldc1 $f4, SC32_FPREGS+32(a0) 162 EX ldc1 $f4, SC32_FPREGS+32(a0)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index cc566cf12246..c7698fd9955c 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -48,8 +48,7 @@
48#ifndef CONFIG_CPU_HAS_LLSC 48#ifndef CONFIG_CPU_HAS_LLSC
49 sw zero, ll_bit 49 sw zero, ll_bit
50#endif 50#endif
51 mfc0 t1, CP0_STATUS 51 mfc0 t2, CP0_STATUS
52 LONG_S t1, THREAD_STATUS(a0)
53 cpu_save_nonscratch a0 52 cpu_save_nonscratch a0
54 LONG_S ra, THREAD_REG31(a0) 53 LONG_S ra, THREAD_REG31(a0)
55 54
@@ -59,8 +58,8 @@
59 PTR_L t3, TASK_THREAD_INFO(a0) 58 PTR_L t3, TASK_THREAD_INFO(a0)
60 LONG_L t0, TI_FLAGS(t3) 59 LONG_L t0, TI_FLAGS(t3)
61 li t1, _TIF_USEDFPU 60 li t1, _TIF_USEDFPU
62 and t2, t0, t1 61 and t1, t0
63 beqz t2, 1f 62 beqz t1, 1f
64 nor t1, zero, t1 63 nor t1, zero, t1
65 64
66 and t0, t0, t1 65 and t0, t0, t1
@@ -73,10 +72,13 @@
73 li t1, ~ST0_CU1 72 li t1, ~ST0_CU1
74 and t0, t0, t1 73 and t0, t0, t1
75 LONG_S t0, ST_OFF(t3) 74 LONG_S t0, ST_OFF(t3)
75 /* clear thread_struct CU1 bit */
76 and t2, t1
76 77
77 fpu_save_double a0 t0 t1 # c0_status passed in t0 78 fpu_save_double a0 t0 t1 # c0_status passed in t0
78 # clobbers t1 79 # clobbers t1
791: 801:
81 LONG_S t2, THREAD_STATUS(a0)
80 82
81 /* 83 /*
82 * The order of restoring the registers takes care of the race 84 * The order of restoring the registers takes care of the race
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index e14ae09eda2b..e6e3047151a6 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -54,6 +54,7 @@ static struct chan_waitqueues {
54 wait_queue_head_t rt_queue; 54 wait_queue_head_t rt_queue;
55 wait_queue_head_t lx_queue; 55 wait_queue_head_t lx_queue;
56 atomic_t in_open; 56 atomic_t in_open;
57 struct mutex mutex;
57} channel_wqs[RTLX_CHANNELS]; 58} channel_wqs[RTLX_CHANNELS];
58 59
59static struct irqaction irq; 60static struct irqaction irq;
@@ -146,7 +147,7 @@ static void stopping(int vpe)
146 147
147int rtlx_open(int index, int can_sleep) 148int rtlx_open(int index, int can_sleep)
148{ 149{
149 volatile struct rtlx_info **p; 150 struct rtlx_info **p;
150 struct rtlx_channel *chan; 151 struct rtlx_channel *chan;
151 enum rtlx_state state; 152 enum rtlx_state state;
152 int ret = 0; 153 int ret = 0;
@@ -179,13 +180,24 @@ int rtlx_open(int index, int can_sleep)
179 } 180 }
180 } 181 }
181 182
183 smp_rmb();
182 if (*p == NULL) { 184 if (*p == NULL) {
183 if (can_sleep) { 185 if (can_sleep) {
184 __wait_event_interruptible(channel_wqs[index].lx_queue, 186 DEFINE_WAIT(wait);
185 *p != NULL, 187
186 ret); 188 for (;;) {
187 if (ret) 189 prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE);
190 smp_rmb();
191 if (*p != NULL)
192 break;
193 if (!signal_pending(current)) {
194 schedule();
195 continue;
196 }
197 ret = -ERESTARTSYS;
188 goto out_fail; 198 goto out_fail;
199 }
200 finish_wait(&channel_wqs[index].lx_queue, &wait);
189 } else { 201 } else {
190 printk(" *vpe_get_shared is NULL. " 202 printk(" *vpe_get_shared is NULL. "
191 "Has an SP program been loaded?\n"); 203 "Has an SP program been loaded?\n");
@@ -277,56 +289,52 @@ unsigned int rtlx_write_poll(int index)
277 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); 289 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size);
278} 290}
279 291
280static inline void copy_to(void *dst, void *src, size_t count, int user) 292ssize_t rtlx_read(int index, void __user *buff, size_t count, int user)
281{
282 if (user)
283 copy_to_user(dst, src, count);
284 else
285 memcpy(dst, src, count);
286}
287
288static inline void copy_from(void *dst, void *src, size_t count, int user)
289{ 293{
290 if (user) 294 size_t lx_write, fl = 0L;
291 copy_from_user(dst, src, count);
292 else
293 memcpy(dst, src, count);
294}
295
296ssize_t rtlx_read(int index, void *buff, size_t count, int user)
297{
298 size_t fl = 0L;
299 struct rtlx_channel *lx; 295 struct rtlx_channel *lx;
296 unsigned long failed;
300 297
301 if (rtlx == NULL) 298 if (rtlx == NULL)
302 return -ENOSYS; 299 return -ENOSYS;
303 300
304 lx = &rtlx->channel[index]; 301 lx = &rtlx->channel[index];
305 302
303 mutex_lock(&channel_wqs[index].mutex);
304 smp_rmb();
305 lx_write = lx->lx_write;
306
306 /* find out how much in total */ 307 /* find out how much in total */
307 count = min(count, 308 count = min(count,
308 (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read) 309 (size_t)(lx_write + lx->buffer_size - lx->lx_read)
309 % lx->buffer_size); 310 % lx->buffer_size);
310 311
311 /* then how much from the read pointer onwards */ 312 /* then how much from the read pointer onwards */
312 fl = min( count, (size_t)lx->buffer_size - lx->lx_read); 313 fl = min(count, (size_t)lx->buffer_size - lx->lx_read);
313 314
314 copy_to(buff, &lx->lx_buffer[lx->lx_read], fl, user); 315 failed = copy_to_user(buff, lx->lx_buffer + lx->lx_read, fl);
316 if (failed)
317 goto out;
315 318
316 /* and if there is anything left at the beginning of the buffer */ 319 /* and if there is anything left at the beginning of the buffer */
317 if ( count - fl ) 320 if (count - fl)
318 copy_to (buff + fl, lx->lx_buffer, count - fl, user); 321 failed = copy_to_user(buff + fl, lx->lx_buffer, count - fl);
319 322
320 /* update the index */ 323out:
321 lx->lx_read += count; 324 count -= failed;
322 lx->lx_read %= lx->buffer_size; 325
326 smp_wmb();
327 lx->lx_read = (lx->lx_read + count) % lx->buffer_size;
328 smp_wmb();
329 mutex_unlock(&channel_wqs[index].mutex);
323 330
324 return count; 331 return count;
325} 332}
326 333
327ssize_t rtlx_write(int index, void *buffer, size_t count, int user) 334ssize_t rtlx_write(int index, const void __user *buffer, size_t count, int user)
328{ 335{
329 struct rtlx_channel *rt; 336 struct rtlx_channel *rt;
337 size_t rt_read;
330 size_t fl; 338 size_t fl;
331 339
332 if (rtlx == NULL) 340 if (rtlx == NULL)
@@ -334,24 +342,35 @@ ssize_t rtlx_write(int index, void *buffer, size_t count, int user)
334 342
335 rt = &rtlx->channel[index]; 343 rt = &rtlx->channel[index];
336 344
345 mutex_lock(&channel_wqs[index].mutex);
346 smp_rmb();
347 rt_read = rt->rt_read;
348
337 /* total number of bytes to copy */ 349 /* total number of bytes to copy */
338 count = min(count, 350 count = min(count,
339 (size_t)write_spacefree(rt->rt_read, rt->rt_write, 351 (size_t)write_spacefree(rt_read, rt->rt_write, rt->buffer_size));
340 rt->buffer_size));
341 352
342 /* first bit from write pointer to the end of the buffer, or count */ 353 /* first bit from write pointer to the end of the buffer, or count */
343 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 354 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
344 355
345 copy_from (&rt->rt_buffer[rt->rt_write], buffer, fl, user); 356 failed = copy_from_user(rt->rt_buffer + rt->rt_write, buffer, fl);
357 if (failed)
358 goto out;
346 359
347 /* if there's any left copy to the beginning of the buffer */ 360 /* if there's any left copy to the beginning of the buffer */
348 if( count - fl ) 361 if (count - fl) {
349 copy_from (rt->rt_buffer, buffer + fl, count - fl, user); 362 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
363 }
364
365out:
366 count -= cailed;
350 367
351 rt->rt_write += count; 368 smp_wmb();
352 rt->rt_write %= rt->buffer_size; 369 rt->rt_write = (rt->rt_write + count) % rt->buffer_size;
370 smp_wmb();
371 mutex_unlock(&channel_wqs[index].mutex);
353 372
354 return(count); 373 return count;
355} 374}
356 375
357 376
@@ -403,7 +422,7 @@ static ssize_t file_read(struct file *file, char __user * buffer, size_t count,
403 return 0; // -EAGAIN makes cat whinge 422 return 0; // -EAGAIN makes cat whinge
404 } 423 }
405 424
406 return rtlx_read(minor, buffer, count, 1); 425 return rtlx_read(minor, buffer, count);
407} 426}
408 427
409static ssize_t file_write(struct file *file, const char __user * buffer, 428static ssize_t file_write(struct file *file, const char __user * buffer,
@@ -429,7 +448,7 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
429 return ret; 448 return ret;
430 } 449 }
431 450
432 return rtlx_write(minor, (void *)buffer, count, 1); 451 return rtlx_write(minor, buffer, count);
433} 452}
434 453
435static const struct file_operations rtlx_fops = { 454static const struct file_operations rtlx_fops = {
@@ -468,6 +487,7 @@ static int rtlx_module_init(void)
468 init_waitqueue_head(&channel_wqs[i].rt_queue); 487 init_waitqueue_head(&channel_wqs[i].rt_queue);
469 init_waitqueue_head(&channel_wqs[i].lx_queue); 488 init_waitqueue_head(&channel_wqs[i].lx_queue);
470 atomic_set(&channel_wqs[i].in_open, 0); 489 atomic_set(&channel_wqs[i].in_open, 0);
490 mutex_init(&channel_wqs[i].mutex);
471 491
472 dev = device_create(mt_class, NULL, MKDEV(major, i), 492 dev = device_create(mt_class, NULL, MKDEV(major, i),
473 "%s%d", module_name, i); 493 "%s%d", module_name, i);
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index fdbdbdc65b54..297dfcb97524 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -31,4 +31,7 @@ extern void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
31 */ 31 */
32extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall); 32extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall);
33 33
34/* Check and clear pending FPU exceptions in saved CSR */
35extern int fpcsr_pending(unsigned int __user *fpcsr);
36
34#endif /* __SIGNAL_COMMON_H */ 37#endif /* __SIGNAL_COMMON_H */
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index f091786187a6..8c3c5a5789b0 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -82,6 +82,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
82{ 82{
83 int err = 0; 83 int err = 0;
84 int i; 84 int i;
85 unsigned int used_math;
85 86
86 err |= __put_user(regs->cp0_epc, &sc->sc_pc); 87 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
87 88
@@ -104,26 +105,53 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
104 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); 105 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
105 } 106 }
106 107
107 err |= __put_user(!!used_math(), &sc->sc_used_math); 108 used_math = !!used_math();
109 err |= __put_user(used_math, &sc->sc_used_math);
108 110
109 if (used_math()) { 111 if (used_math) {
110 /* 112 /*
111 * Save FPU state to signal context. Signal handler 113 * Save FPU state to signal context. Signal handler
112 * will "inherit" current FPU state. 114 * will "inherit" current FPU state.
113 */ 115 */
114 preempt_disable(); 116 own_fpu(1);
115 117 enable_fp_in_kernel();
116 if (!is_fpu_owner()) {
117 own_fpu();
118 restore_fp(current);
119 }
120 err |= save_fp_context(sc); 118 err |= save_fp_context(sc);
121 119 disable_fp_in_kernel();
122 preempt_enable();
123 } 120 }
124 return err; 121 return err;
125} 122}
126 123
124int fpcsr_pending(unsigned int __user *fpcsr)
125{
126 int err, sig = 0;
127 unsigned int csr, enabled;
128
129 err = __get_user(csr, fpcsr);
130 enabled = FPU_CSR_UNI_X | ((csr & FPU_CSR_ALL_E) << 5);
131 /*
132 * If the signal handler set some FPU exceptions, clear it and
133 * send SIGFPE.
134 */
135 if (csr & enabled) {
136 csr &= ~enabled;
137 err |= __put_user(csr, fpcsr);
138 sig = SIGFPE;
139 }
140 return err ?: sig;
141}
142
143static int
144check_and_restore_fp_context(struct sigcontext __user *sc)
145{
146 int err, sig;
147
148 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
149 if (err > 0)
150 err = 0;
151 err |= restore_fp_context(sc);
152 return err ?: sig;
153}
154
127int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 155int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
128{ 156{
129 unsigned int used_math; 157 unsigned int used_math;
@@ -157,19 +185,18 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
157 err |= __get_user(used_math, &sc->sc_used_math); 185 err |= __get_user(used_math, &sc->sc_used_math);
158 conditional_used_math(used_math); 186 conditional_used_math(used_math);
159 187
160 preempt_disable(); 188 if (used_math) {
161
162 if (used_math()) {
163 /* restore fpu context if we have used it before */ 189 /* restore fpu context if we have used it before */
164 own_fpu(); 190 own_fpu(0);
165 err |= restore_fp_context(sc); 191 enable_fp_in_kernel();
192 if (!err)
193 err = check_and_restore_fp_context(sc);
194 disable_fp_in_kernel();
166 } else { 195 } else {
167 /* signal handler may have used FPU. Give it up. */ 196 /* signal handler may have used FPU. Give it up. */
168 lose_fpu(); 197 lose_fpu(0);
169 } 198 }
170 199
171 preempt_enable();
172
173 return err; 200 return err;
174} 201}
175 202
@@ -332,6 +359,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
332{ 359{
333 struct sigframe __user *frame; 360 struct sigframe __user *frame;
334 sigset_t blocked; 361 sigset_t blocked;
362 int sig;
335 363
336 frame = (struct sigframe __user *) regs.regs[29]; 364 frame = (struct sigframe __user *) regs.regs[29];
337 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 365 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -345,8 +373,11 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
345 recalc_sigpending(); 373 recalc_sigpending();
346 spin_unlock_irq(&current->sighand->siglock); 374 spin_unlock_irq(&current->sighand->siglock);
347 375
348 if (restore_sigcontext(&regs, &frame->sf_sc)) 376 sig = restore_sigcontext(&regs, &frame->sf_sc);
377 if (sig < 0)
349 goto badframe; 378 goto badframe;
379 else if (sig)
380 force_sig(sig, current);
350 381
351 /* 382 /*
352 * Don't let your children do this ... 383 * Don't let your children do this ...
@@ -368,6 +399,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
368 struct rt_sigframe __user *frame; 399 struct rt_sigframe __user *frame;
369 sigset_t set; 400 sigset_t set;
370 stack_t st; 401 stack_t st;
402 int sig;
371 403
372 frame = (struct rt_sigframe __user *) regs.regs[29]; 404 frame = (struct rt_sigframe __user *) regs.regs[29];
373 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 405 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -381,8 +413,11 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
381 recalc_sigpending(); 413 recalc_sigpending();
382 spin_unlock_irq(&current->sighand->siglock); 414 spin_unlock_irq(&current->sighand->siglock);
383 415
384 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext)) 416 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
417 if (sig < 0)
385 goto badframe; 418 goto badframe;
419 else if (sig)
420 force_sig(sig, current);
386 421
387 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) 422 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
388 goto badframe; 423 goto badframe;
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 19bbef001959..151fd2f0893a 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -181,6 +181,7 @@ static int setup_sigcontext32(struct pt_regs *regs,
181{ 181{
182 int err = 0; 182 int err = 0;
183 int i; 183 int i;
184 u32 used_math;
184 185
185 err |= __put_user(regs->cp0_epc, &sc->sc_pc); 186 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
186 187
@@ -200,26 +201,34 @@ static int setup_sigcontext32(struct pt_regs *regs,
200 err |= __put_user(mflo3(), &sc->sc_lo3); 201 err |= __put_user(mflo3(), &sc->sc_lo3);
201 } 202 }
202 203
203 err |= __put_user(!!used_math(), &sc->sc_used_math); 204 used_math = !!used_math();
205 err |= __put_user(used_math, &sc->sc_used_math);
204 206
205 if (used_math()) { 207 if (used_math) {
206 /* 208 /*
207 * Save FPU state to signal context. Signal handler 209 * Save FPU state to signal context. Signal handler
208 * will "inherit" current FPU state. 210 * will "inherit" current FPU state.
209 */ 211 */
210 preempt_disable(); 212 own_fpu(1);
211 213 enable_fp_in_kernel();
212 if (!is_fpu_owner()) {
213 own_fpu();
214 restore_fp(current);
215 }
216 err |= save_fp_context32(sc); 214 err |= save_fp_context32(sc);
217 215 disable_fp_in_kernel();
218 preempt_enable();
219 } 216 }
220 return err; 217 return err;
221} 218}
222 219
220static int
221check_and_restore_fp_context32(struct sigcontext32 __user *sc)
222{
223 int err, sig;
224
225 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
226 if (err > 0)
227 err = 0;
228 err |= restore_fp_context32(sc);
229 return err ?: sig;
230}
231
223static int restore_sigcontext32(struct pt_regs *regs, 232static int restore_sigcontext32(struct pt_regs *regs,
224 struct sigcontext32 __user *sc) 233 struct sigcontext32 __user *sc)
225{ 234{
@@ -250,19 +259,18 @@ static int restore_sigcontext32(struct pt_regs *regs,
250 err |= __get_user(used_math, &sc->sc_used_math); 259 err |= __get_user(used_math, &sc->sc_used_math);
251 conditional_used_math(used_math); 260 conditional_used_math(used_math);
252 261
253 preempt_disable(); 262 if (used_math) {
254
255 if (used_math()) {
256 /* restore fpu context if we have used it before */ 263 /* restore fpu context if we have used it before */
257 own_fpu(); 264 own_fpu(0);
258 err |= restore_fp_context32(sc); 265 enable_fp_in_kernel();
266 if (!err)
267 err = check_and_restore_fp_context32(sc);
268 disable_fp_in_kernel();
259 } else { 269 } else {
260 /* signal handler may have used FPU. Give it up. */ 270 /* signal handler may have used FPU. Give it up. */
261 lose_fpu(); 271 lose_fpu(0);
262 } 272 }
263 273
264 preempt_enable();
265
266 return err; 274 return err;
267} 275}
268 276
@@ -508,6 +516,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
508{ 516{
509 struct sigframe32 __user *frame; 517 struct sigframe32 __user *frame;
510 sigset_t blocked; 518 sigset_t blocked;
519 int sig;
511 520
512 frame = (struct sigframe32 __user *) regs.regs[29]; 521 frame = (struct sigframe32 __user *) regs.regs[29];
513 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 522 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -521,8 +530,11 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
521 recalc_sigpending(); 530 recalc_sigpending();
522 spin_unlock_irq(&current->sighand->siglock); 531 spin_unlock_irq(&current->sighand->siglock);
523 532
524 if (restore_sigcontext32(&regs, &frame->sf_sc)) 533 sig = restore_sigcontext32(&regs, &frame->sf_sc);
534 if (sig < 0)
525 goto badframe; 535 goto badframe;
536 else if (sig)
537 force_sig(sig, current);
526 538
527 /* 539 /*
528 * Don't let your children do this ... 540 * Don't let your children do this ...
@@ -545,6 +557,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
545 sigset_t set; 557 sigset_t set;
546 stack_t st; 558 stack_t st;
547 s32 sp; 559 s32 sp;
560 int sig;
548 561
549 frame = (struct rt_sigframe32 __user *) regs.regs[29]; 562 frame = (struct rt_sigframe32 __user *) regs.regs[29];
550 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 563 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -558,8 +571,11 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
558 recalc_sigpending(); 571 recalc_sigpending();
559 spin_unlock_irq(&current->sighand->siglock); 572 spin_unlock_irq(&current->sighand->siglock);
560 573
561 if (restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext)) 574 sig = restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext);
575 if (sig < 0)
562 goto badframe; 576 goto badframe;
577 else if (sig)
578 force_sig(sig, current);
563 579
564 /* The ucontext contains a stack32_t, so we must convert! */ 580 /* The ucontext contains a stack32_t, so we must convert! */
565 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 581 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ecf1f7ecaad9..a9202fa95987 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -127,6 +127,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
127 sigset_t set; 127 sigset_t set;
128 stack_t st; 128 stack_t st;
129 s32 sp; 129 s32 sp;
130 int sig;
130 131
131 frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; 132 frame = (struct rt_sigframe_n32 __user *) regs.regs[29];
132 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 133 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -140,8 +141,11 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
140 recalc_sigpending(); 141 recalc_sigpending();
141 spin_unlock_irq(&current->sighand->siglock); 142 spin_unlock_irq(&current->sighand->siglock);
142 143
143 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext)) 144 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
145 if (sig < 0)
144 goto badframe; 146 goto badframe;
147 else if (sig)
148 force_sig(sig, current);
145 149
146 /* The ucontext contains a stack32_t, so we must convert! */ 150 /* The ucontext contains a stack32_t, so we must convert! */
147 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 151 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index f253eda27fa3..5dcfab6b288e 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -4,6 +4,7 @@
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/interrupt.h> 6#include <linux/interrupt.h>
7#include <linux/kernel_stat.h>
7#include <linux/module.h> 8#include <linux/module.h>
8 9
9#include <asm/cpu.h> 10#include <asm/cpu.h>
@@ -14,6 +15,7 @@
14#include <asm/hazards.h> 15#include <asm/hazards.h>
15#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
16#include <asm/smp.h> 17#include <asm/smp.h>
18#include <asm/mips-boards/maltaint.h>
17#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
18#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
19#include <asm/time.h> 21#include <asm/time.h>
@@ -75,7 +77,7 @@ static struct smtc_ipi_q freeIPIq;
75 77
76void ipi_decode(struct smtc_ipi *); 78void ipi_decode(struct smtc_ipi *);
77static void post_direct_ipi(int cpu, struct smtc_ipi *pipi); 79static void post_direct_ipi(int cpu, struct smtc_ipi *pipi);
78static void setup_cross_vpe_interrupts(void); 80static void setup_cross_vpe_interrupts(unsigned int nvpe);
79void init_smtc_stats(void); 81void init_smtc_stats(void);
80 82
81/* Global SMTC Status */ 83/* Global SMTC Status */
@@ -168,7 +170,10 @@ __setup("tintq=", tintq);
168 170
169int imstuckcount[2][8]; 171int imstuckcount[2][8];
170/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */ 172/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */
171int vpemask[2][8] = {{0,1,1,0,0,0,0,1},{0,1,0,0,0,0,0,1}}; 173int vpemask[2][8] = {
174 {0, 0, 1, 0, 0, 0, 0, 1},
175 {0, 0, 0, 0, 0, 0, 0, 1}
176};
172int tcnoprog[NR_CPUS]; 177int tcnoprog[NR_CPUS];
173static atomic_t idle_hook_initialized = {0}; 178static atomic_t idle_hook_initialized = {0};
174static int clock_hang_reported[NR_CPUS]; 179static int clock_hang_reported[NR_CPUS];
@@ -501,8 +506,7 @@ void mipsmt_prepare_cpus(void)
501 506
502 /* If we have multiple VPEs running, set up the cross-VPE interrupt */ 507 /* If we have multiple VPEs running, set up the cross-VPE interrupt */
503 508
504 if (nvpe > 1) 509 setup_cross_vpe_interrupts(nvpe);
505 setup_cross_vpe_interrupts();
506 510
507 /* Set up queue of free IPI "messages". */ 511 /* Set up queue of free IPI "messages". */
508 nipi = NR_CPUS * IPIBUF_PER_CPU; 512 nipi = NR_CPUS * IPIBUF_PER_CPU;
@@ -607,7 +611,12 @@ void smtc_cpus_done(void)
607int setup_irq_smtc(unsigned int irq, struct irqaction * new, 611int setup_irq_smtc(unsigned int irq, struct irqaction * new,
608 unsigned long hwmask) 612 unsigned long hwmask)
609{ 613{
614 unsigned int vpe = current_cpu_data.vpe_id;
615
610 irq_hwmask[irq] = hwmask; 616 irq_hwmask[irq] = hwmask;
617#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
618 vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1;
619#endif
611 620
612 return setup_irq(irq, new); 621 return setup_irq(irq, new);
613} 622}
@@ -812,12 +821,15 @@ void ipi_decode(struct smtc_ipi *pipi)
812 smtc_ipi_nq(&freeIPIq, pipi); 821 smtc_ipi_nq(&freeIPIq, pipi);
813 switch (type_copy) { 822 switch (type_copy) {
814 case SMTC_CLOCK_TICK: 823 case SMTC_CLOCK_TICK:
824 irq_enter();
825 kstat_this_cpu.irqs[MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR]++;
815 /* Invoke Clock "Interrupt" */ 826 /* Invoke Clock "Interrupt" */
816 ipi_timer_latch[dest_copy] = 0; 827 ipi_timer_latch[dest_copy] = 0;
817#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG 828#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
818 clock_hang_reported[dest_copy] = 0; 829 clock_hang_reported[dest_copy] = 0;
819#endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */ 830#endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */
820 local_timer_interrupt(0, NULL); 831 local_timer_interrupt(0, NULL);
832 irq_exit();
821 break; 833 break;
822 case LINUX_SMP_IPI: 834 case LINUX_SMP_IPI:
823 switch ((int)arg_copy) { 835 switch ((int)arg_copy) {
@@ -965,8 +977,11 @@ static void ipi_irq_dispatch(void)
965 977
966static struct irqaction irq_ipi; 978static struct irqaction irq_ipi;
967 979
968static void setup_cross_vpe_interrupts(void) 980static void setup_cross_vpe_interrupts(unsigned int nvpe)
969{ 981{
982 if (nvpe < 1)
983 return;
984
970 if (!cpu_has_vint) 985 if (!cpu_has_vint)
971 panic("SMTC Kernel requires Vectored Interupt support"); 986 panic("SMTC Kernel requires Vectored Interupt support");
972 987
@@ -984,10 +999,17 @@ static void setup_cross_vpe_interrupts(void)
984 999
985/* 1000/*
986 * SMTC-specific hacks invoked from elsewhere in the kernel. 1001 * SMTC-specific hacks invoked from elsewhere in the kernel.
1002 *
1003 * smtc_ipi_replay is called from raw_local_irq_restore which is only ever
1004 * called with interrupts disabled. We do rely on interrupts being disabled
1005 * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would
1006 * result in a recursive call to raw_local_irq_restore().
987 */ 1007 */
988 1008
989void smtc_ipi_replay(void) 1009static void __smtc_ipi_replay(void)
990{ 1010{
1011 unsigned int cpu = smp_processor_id();
1012
991 /* 1013 /*
992 * To the extent that we've ever turned interrupts off, 1014 * To the extent that we've ever turned interrupts off,
993 * we may have accumulated deferred IPIs. This is subtle. 1015 * we may have accumulated deferred IPIs. This is subtle.
@@ -1002,17 +1024,30 @@ void smtc_ipi_replay(void)
1002 * is clear, and we'll handle it as a real pseudo-interrupt 1024 * is clear, and we'll handle it as a real pseudo-interrupt
1003 * and not a pseudo-pseudo interrupt. 1025 * and not a pseudo-pseudo interrupt.
1004 */ 1026 */
1005 if (IPIQ[smp_processor_id()].depth > 0) { 1027 if (IPIQ[cpu].depth > 0) {
1006 struct smtc_ipi *pipi; 1028 while (1) {
1007 extern void self_ipi(struct smtc_ipi *); 1029 struct smtc_ipi_q *q = &IPIQ[cpu];
1030 struct smtc_ipi *pipi;
1031 extern void self_ipi(struct smtc_ipi *);
1032
1033 spin_lock(&q->lock);
1034 pipi = __smtc_ipi_dq(q);
1035 spin_unlock(&q->lock);
1036 if (!pipi)
1037 break;
1008 1038
1009 while ((pipi = smtc_ipi_dq(&IPIQ[smp_processor_id()]))) {
1010 self_ipi(pipi); 1039 self_ipi(pipi);
1011 smtc_cpu_stats[smp_processor_id()].selfipis++; 1040 smtc_cpu_stats[cpu].selfipis++;
1012 } 1041 }
1013 } 1042 }
1014} 1043}
1015 1044
1045void smtc_ipi_replay(void)
1046{
1047 raw_local_irq_disable();
1048 __smtc_ipi_replay();
1049}
1050
1016EXPORT_SYMBOL(smtc_ipi_replay); 1051EXPORT_SYMBOL(smtc_ipi_replay);
1017 1052
1018void smtc_idle_loop_hook(void) 1053void smtc_idle_loop_hook(void)
@@ -1117,7 +1152,13 @@ void smtc_idle_loop_hook(void)
1117 * is in use, there should never be any. 1152 * is in use, there should never be any.
1118 */ 1153 */
1119#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY 1154#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
1120 smtc_ipi_replay(); 1155 {
1156 unsigned long flags;
1157
1158 local_irq_save(flags);
1159 __smtc_ipi_replay();
1160 local_irq_restore(flags);
1161 }
1121#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */ 1162#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
1122} 1163}
1123 1164
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 18f56a9dbcfa..7d76a85422b2 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -610,16 +610,6 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
610 if (fcr31 & FPU_CSR_UNI_X) { 610 if (fcr31 & FPU_CSR_UNI_X) {
611 int sig; 611 int sig;
612 612
613 preempt_disable();
614
615#ifdef CONFIG_PREEMPT
616 if (!is_fpu_owner()) {
617 /* We might lose fpu before disabling preempt... */
618 own_fpu();
619 BUG_ON(!used_math());
620 restore_fp(current);
621 }
622#endif
623 /* 613 /*
624 * Unimplemented operation exception. If we've got the full 614 * Unimplemented operation exception. If we've got the full
625 * software emulator on-board, let's use it... 615 * software emulator on-board, let's use it...
@@ -630,18 +620,12 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
630 * register operands before invoking the emulator, which seems 620 * register operands before invoking the emulator, which seems
631 * a bit extreme for what should be an infrequent event. 621 * a bit extreme for what should be an infrequent event.
632 */ 622 */
633 save_fp(current);
634 /* Ensure 'resume' not overwrite saved fp context again. */ 623 /* Ensure 'resume' not overwrite saved fp context again. */
635 lose_fpu(); 624 lose_fpu(1);
636
637 preempt_enable();
638 625
639 /* Run the emulator */ 626 /* Run the emulator */
640 sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1); 627 sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1);
641 628
642 preempt_disable();
643
644 own_fpu(); /* Using the FPU again. */
645 /* 629 /*
646 * We can't allow the emulated instruction to leave any of 630 * We can't allow the emulated instruction to leave any of
647 * the cause bit set in $fcr31. 631 * the cause bit set in $fcr31.
@@ -649,9 +633,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
649 current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; 633 current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
650 634
651 /* Restore the hardware register state */ 635 /* Restore the hardware register state */
652 restore_fp(current); 636 own_fpu(1); /* Using the FPU again. */
653
654 preempt_enable();
655 637
656 /* If something went wrong, signal */ 638 /* If something went wrong, signal */
657 if (sig) 639 if (sig)
@@ -775,12 +757,11 @@ asmlinkage void do_cpu(struct pt_regs *regs)
775{ 757{
776 unsigned int cpid; 758 unsigned int cpid;
777 759
778 die_if_kernel("do_cpu invoked from kernel context!", regs);
779
780 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; 760 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
781 761
782 switch (cpid) { 762 switch (cpid) {
783 case 0: 763 case 0:
764 die_if_kernel("do_cpu invoked from kernel context!", regs);
784 if (!cpu_has_llsc) 765 if (!cpu_has_llsc)
785 if (!simulate_llsc(regs)) 766 if (!simulate_llsc(regs))
786 return; 767 return;
@@ -791,21 +772,30 @@ asmlinkage void do_cpu(struct pt_regs *regs)
791 break; 772 break;
792 773
793 case 1: 774 case 1:
794 preempt_disable(); 775 if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL))
795 776 die_if_kernel("do_cpu invoked from kernel context!",
796 own_fpu(); 777 regs);
797 if (used_math()) { /* Using the FPU again. */ 778 if (used_math()) /* Using the FPU again. */
798 restore_fp(current); 779 own_fpu(1);
799 } else { /* First time FPU user. */ 780 else { /* First time FPU user. */
800 init_fpu(); 781 init_fpu();
801 set_used_math(); 782 set_used_math();
802 } 783 }
803 784
804 if (cpu_has_fpu) { 785 if (raw_cpu_has_fpu) {
805 preempt_enable(); 786 if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) {
787 local_irq_disable();
788 if (cpu_has_fpu)
789 regs->cp0_status |= ST0_CU1;
790 /*
791 * We must return without enabling
792 * interrupts to ensure keep FPU
793 * ownership until resume.
794 */
795 return;
796 }
806 } else { 797 } else {
807 int sig; 798 int sig;
808 preempt_enable();
809 sig = fpu_emulator_cop1Handler(regs, 799 sig = fpu_emulator_cop1Handler(regs,
810 &current->thread.fpu, 0); 800 &current->thread.fpu, 0);
811 if (sig) 801 if (sig)
@@ -1259,26 +1249,26 @@ static inline void mips_srs_init(void)
1259/* 1249/*
1260 * This is used by native signal handling 1250 * This is used by native signal handling
1261 */ 1251 */
1262asmlinkage int (*save_fp_context)(struct sigcontext *sc); 1252asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
1263asmlinkage int (*restore_fp_context)(struct sigcontext *sc); 1253asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
1264 1254
1265extern asmlinkage int _save_fp_context(struct sigcontext *sc); 1255extern asmlinkage int _save_fp_context(struct sigcontext __user *sc);
1266extern asmlinkage int _restore_fp_context(struct sigcontext *sc); 1256extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc);
1267 1257
1268extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc); 1258extern asmlinkage int fpu_emulator_save_context(struct sigcontext __user *sc);
1269extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc); 1259extern asmlinkage int fpu_emulator_restore_context(struct sigcontext __user *sc);
1270 1260
1271#ifdef CONFIG_SMP 1261#ifdef CONFIG_SMP
1272static int smp_save_fp_context(struct sigcontext *sc) 1262static int smp_save_fp_context(struct sigcontext __user *sc)
1273{ 1263{
1274 return cpu_has_fpu 1264 return raw_cpu_has_fpu
1275 ? _save_fp_context(sc) 1265 ? _save_fp_context(sc)
1276 : fpu_emulator_save_context(sc); 1266 : fpu_emulator_save_context(sc);
1277} 1267}
1278 1268
1279static int smp_restore_fp_context(struct sigcontext *sc) 1269static int smp_restore_fp_context(struct sigcontext __user *sc)
1280{ 1270{
1281 return cpu_has_fpu 1271 return raw_cpu_has_fpu
1282 ? _restore_fp_context(sc) 1272 ? _restore_fp_context(sc)
1283 : fpu_emulator_restore_context(sc); 1273 : fpu_emulator_restore_context(sc);
1284} 1274}
@@ -1306,14 +1296,14 @@ static inline void signal_init(void)
1306/* 1296/*
1307 * This is used by 32-bit signal stuff on the 64-bit kernel 1297 * This is used by 32-bit signal stuff on the 64-bit kernel
1308 */ 1298 */
1309asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc); 1299asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
1310asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc); 1300asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
1311 1301
1312extern asmlinkage int _save_fp_context32(struct sigcontext32 *sc); 1302extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc);
1313extern asmlinkage int _restore_fp_context32(struct sigcontext32 *sc); 1303extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc);
1314 1304
1315extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 *sc); 1305extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 __user *sc);
1316extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 *sc); 1306extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user *sc);
1317 1307
1318static inline void signal32_init(void) 1308static inline void signal32_init(void)
1319{ 1309{
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
index 5b3390f64917..ed49ef01ac53 100644
--- a/arch/mips/math-emu/kernel_linkage.c
+++ b/arch/mips/math-emu/kernel_linkage.c
@@ -51,7 +51,7 @@ void fpu_emulator_init_fpu(void)
51 * with appropriate macros from uaccess.h 51 * with appropriate macros from uaccess.h
52 */ 52 */
53 53
54int fpu_emulator_save_context(struct sigcontext *sc) 54int fpu_emulator_save_context(struct sigcontext __user *sc)
55{ 55{
56 int i; 56 int i;
57 int err = 0; 57 int err = 0;
@@ -65,7 +65,7 @@ int fpu_emulator_save_context(struct sigcontext *sc)
65 return err; 65 return err;
66} 66}
67 67
68int fpu_emulator_restore_context(struct sigcontext *sc) 68int fpu_emulator_restore_context(struct sigcontext __user *sc)
69{ 69{
70 int i; 70 int i;
71 int err = 0; 71 int err = 0;
@@ -84,7 +84,7 @@ int fpu_emulator_restore_context(struct sigcontext *sc)
84 * This is the o32 version 84 * This is the o32 version
85 */ 85 */
86 86
87int fpu_emulator_save_context32(struct sigcontext32 *sc) 87int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
88{ 88{
89 int i; 89 int i;
90 int err = 0; 90 int err = 0;
@@ -98,7 +98,7 @@ int fpu_emulator_save_context32(struct sigcontext32 *sc)
98 return err; 98 return err;
99} 99}
100 100
101int fpu_emulator_restore_context32(struct sigcontext32 *sc) 101int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
102{ 102{
103 int i; 103 int i;
104 int err = 0; 104 int err = 0;
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
index 1acdf091c258..88e9c2a7a2f9 100644
--- a/arch/mips/mips-boards/generic/init.c
+++ b/arch/mips/mips-boards/generic/init.c
@@ -145,7 +145,7 @@ static void __init console_config(void)
145 char parity = '\0', bits = '\0', flow = '\0'; 145 char parity = '\0', bits = '\0', flow = '\0';
146 char *s; 146 char *s;
147 147
148 if ((strstr(prom_getcmdline(), "console=ttyS")) == NULL) { 148 if ((strstr(prom_getcmdline(), "console=")) == NULL) {
149 s = prom_getenv("modetty0"); 149 s = prom_getenv("modetty0");
150 if (s) { 150 if (s) {
151 while (*s >= '0' && *s <= '9') 151 while (*s >= '0' && *s <= '9')
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index d1af42c2a52e..59868a1edf66 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -260,7 +260,7 @@ static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page,
260{ 260{
261} 261}
262 262
263static void local_r3k_flush_data_cache_page(unsigned long addr) 263static void local_r3k_flush_data_cache_page(void *addr)
264{ 264{
265} 265}
266 266
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 31819c58bffa..4e8f1b683376 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -3,7 +3,8 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 2003 by Ralf Baechle 6 * Copyright (C) 1994 - 2003, 07 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2007 MIPS Technologies, Inc.
7 */ 8 */
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
@@ -88,6 +89,19 @@ void __flush_dcache_page(struct page *page)
88 89
89EXPORT_SYMBOL(__flush_dcache_page); 90EXPORT_SYMBOL(__flush_dcache_page);
90 91
92void __flush_anon_page(struct page *page, unsigned long vmaddr)
93{
94 if (pages_do_alias((unsigned long)page_address(page), vmaddr)) {
95 void *kaddr;
96
97 kaddr = kmap_coherent(page, vmaddr);
98 flush_data_cache_page((unsigned long)kaddr);
99 kunmap_coherent(kaddr);
100 }
101}
102
103EXPORT_SYMBOL(__flush_anon_page);
104
91void __update_cache(struct vm_area_struct *vma, unsigned long address, 105void __update_cache(struct vm_area_struct *vma, unsigned long address,
92 pte_t pte) 106 pte_t pte)
93{ 107{
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index 11a916629d3b..4c72e650f9b6 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -177,8 +177,8 @@ extern void check_bus_watcher(void);
177 177
178asmlinkage void sb1_cache_error(void) 178asmlinkage void sb1_cache_error(void)
179{ 179{
180 uint64_t cerr_dpa;
181 uint32_t errctl, cerr_i, cerr_d, dpalo, dpahi, eepc, res; 180 uint32_t errctl, cerr_i, cerr_d, dpalo, dpahi, eepc, res;
181 unsigned long long cerr_dpa;
182 182
183#ifdef CONFIG_SIBYTE_BW_TRACE 183#ifdef CONFIG_SIBYTE_BW_TRACE
184 /* Freeze the trace buffer now */ 184 /* Freeze the trace buffer now */
@@ -329,8 +329,9 @@ static uint32_t extract_ic(unsigned short addr, int data)
329{ 329{
330 unsigned short way; 330 unsigned short way;
331 int valid; 331 int valid;
332 uint64_t taglo, va, tlo_tmp;
333 uint32_t taghi, taglolo, taglohi; 332 uint32_t taghi, taglolo, taglohi;
333 unsigned long long taglo, va;
334 uint64_t tlo_tmp;
334 uint8_t lru; 335 uint8_t lru;
335 int res = 0; 336 int res = 0;
336 337
@@ -484,8 +485,8 @@ static uint32_t extract_dc(unsigned short addr, int data)
484{ 485{
485 int valid, way; 486 int valid, way;
486 unsigned char state; 487 unsigned char state;
487 uint64_t taglo, pa;
488 uint32_t taghi, taglolo, taglohi; 488 uint32_t taghi, taglolo, taglohi;
489 unsigned long long taglo, pa;
489 uint8_t ecc, lru; 490 uint8_t ecc, lru;
490 int res = 0; 491 int res = 0;
491 492
@@ -535,8 +536,8 @@ static uint32_t extract_dc(unsigned short addr, int data)
535 } 536 }
536 537
537 if (data) { 538 if (data) {
538 uint64_t datalo;
539 uint32_t datalohi, datalolo, datahi; 539 uint32_t datalohi, datalolo, datahi;
540 unsigned long long datalo;
540 int offset; 541 int offset;
541 char bad_ecc = 0; 542 char bad_ecc = 0;
542 543
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index f503d02e403b..f0eb29917d9a 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -19,6 +19,13 @@
19 19
20#include <dma-coherence.h> 20#include <dma-coherence.h>
21 21
22static inline unsigned long dma_addr_to_virt(dma_addr_t dma_addr)
23{
24 unsigned long addr = plat_dma_addr_to_phys(dma_addr);
25
26 return (unsigned long)phys_to_virt(addr);
27}
28
22/* 29/*
23 * Warning on the terminology - Linux calls an uncached area coherent; 30 * Warning on the terminology - Linux calls an uncached area coherent;
24 * MIPS terminology calls memory areas with hardware maintained coherency 31 * MIPS terminology calls memory areas with hardware maintained coherency
@@ -140,7 +147,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
140 enum dma_data_direction direction) 147 enum dma_data_direction direction)
141{ 148{
142 if (cpu_is_noncoherent_r10000(dev)) 149 if (cpu_is_noncoherent_r10000(dev))
143 __dma_sync(plat_dma_addr_to_phys(dma_addr) + PAGE_OFFSET, size, 150 __dma_sync(dma_addr_to_virt(dma_addr), size,
144 direction); 151 direction);
145 152
146 plat_unmap_dma_mem(dma_addr); 153 plat_unmap_dma_mem(dma_addr);
@@ -234,7 +241,7 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
234 if (cpu_is_noncoherent_r10000(dev)) { 241 if (cpu_is_noncoherent_r10000(dev)) {
235 unsigned long addr; 242 unsigned long addr;
236 243
237 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 244 addr = dma_addr_to_virt(dma_handle);
238 __dma_sync(addr, size, direction); 245 __dma_sync(addr, size, direction);
239 } 246 }
240} 247}
@@ -249,7 +256,7 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
249 if (!plat_device_is_coherent(dev)) { 256 if (!plat_device_is_coherent(dev)) {
250 unsigned long addr; 257 unsigned long addr;
251 258
252 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 259 addr = dma_addr_to_virt(dma_handle);
253 __dma_sync(addr, size, direction); 260 __dma_sync(addr, size, direction);
254 } 261 }
255} 262}
@@ -264,7 +271,7 @@ void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
264 if (cpu_is_noncoherent_r10000(dev)) { 271 if (cpu_is_noncoherent_r10000(dev)) {
265 unsigned long addr; 272 unsigned long addr;
266 273
267 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 274 addr = dma_addr_to_virt(dma_handle);
268 __dma_sync(addr + offset, size, direction); 275 __dma_sync(addr + offset, size, direction);
269 } 276 }
270} 277}
@@ -279,7 +286,7 @@ void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
279 if (!plat_device_is_coherent(dev)) { 286 if (!plat_device_is_coherent(dev)) {
280 unsigned long addr; 287 unsigned long addr;
281 288
282 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 289 addr = dma_addr_to_virt(dma_handle);
283 __dma_sync(addr + offset, size, direction); 290 __dma_sync(addr + offset, size, direction);
284 } 291 }
285} 292}
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 6f90e7ef66ac..f9c595dceba9 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -42,7 +42,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
42 siginfo_t info; 42 siginfo_t info;
43 43
44#if 0 44#if 0
45 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", smp_processor_id(), 45 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(),
46 current->comm, current->pid, field, address, write, 46 current->comm, current->pid, field, address, write,
47 field, regs->cp0_epc); 47 field, regs->cp0_epc);
48#endif 48#endif
@@ -165,7 +165,7 @@ no_context:
165 165
166 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at " 166 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at "
167 "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n", 167 "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n",
168 smp_processor_id(), field, address, field, regs->cp0_epc, 168 raw_smp_processor_id(), field, address, field, regs->cp0_epc,
169 field, regs->regs[31]); 169 field, regs->regs[31]);
170 die("Oops", regs); 170 die("Oops", regs);
171 171
@@ -228,7 +228,7 @@ vmalloc_fault:
228 pmd_t *pmd, *pmd_k; 228 pmd_t *pmd, *pmd_k;
229 pte_t *pte_k; 229 pte_t *pte_k;
230 230
231 pgd = (pgd_t *) pgd_current[smp_processor_id()] + offset; 231 pgd = (pgd_t *) pgd_current[raw_smp_processor_id()] + offset;
232 pgd_k = init_mm.pgd + offset; 232 pgd_k = init_mm.pgd + offset;
233 233
234 if (!pgd_present(*pgd_k)) 234 if (!pgd_present(*pgd_k))
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index f08ae71c46ff..e9951c0e689f 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -123,7 +123,7 @@ static void __init kmap_coherent_init(void)
123static inline void kmap_coherent_init(void) {} 123static inline void kmap_coherent_init(void) {}
124#endif 124#endif
125 125
126static inline void *kmap_coherent(struct page *page, unsigned long addr) 126void *kmap_coherent(struct page *page, unsigned long addr)
127{ 127{
128 enum fixed_addresses idx; 128 enum fixed_addresses idx;
129 unsigned long vaddr, flags, entrylo; 129 unsigned long vaddr, flags, entrylo;
@@ -177,7 +177,7 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr)
177 177
178#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) 178#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
179 179
180static inline void kunmap_coherent(struct page *page) 180void kunmap_coherent(struct page *page)
181{ 181{
182#ifndef CONFIG_MIPS_MT_SMTC 182#ifndef CONFIG_MIPS_MT_SMTC
183 unsigned int wired; 183 unsigned int wired;
@@ -377,7 +377,7 @@ void __init paging_init(void)
377#ifdef CONFIG_FLATMEM 377#ifdef CONFIG_FLATMEM
378 free_area_init(zones_size); 378 free_area_init(zones_size);
379#else 379#else
380 pfn = 0; 380 pfn = min_low_pfn;
381 for (i = 0; i < MAX_NR_ZONES; i++) 381 for (i = 0; i < MAX_NR_ZONES; i++)
382 for (j = 0; j < zones_size[i]; j++, pfn++) 382 for (j = 0; j < zones_size[i]; j++, pfn++)
383 if (!page_is_ram(pfn)) 383 if (!page_is_ram(pfn))
diff --git a/arch/mips/mm/pg-sb1.c b/arch/mips/mm/pg-sb1.c
index fc3c7878fb45..adb37d0a30ea 100644
--- a/arch/mips/mm/pg-sb1.c
+++ b/arch/mips/mm/pg-sb1.c
@@ -218,8 +218,7 @@ void sb1_dma_init(void)
218 for (i = 0; i < DM_NUM_CHANNELS; i++) { 218 for (i = 0; i < DM_NUM_CHANNELS; i++) {
219 const u64 base_val = CPHYSADDR(&page_descr[i]) | 219 const u64 base_val = CPHYSADDR(&page_descr[i]) |
220 V_DM_DSCR_BASE_RINGSZ(1); 220 V_DM_DSCR_BASE_RINGSZ(1);
221 volatile void *base_reg = 221 void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
222 IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
223 222
224 __raw_writeq(base_val, base_reg); 223 __raw_writeq(base_val, base_reg);
225 __raw_writeq(base_val | M_DM_DSCR_BASE_RESET, base_reg); 224 __raw_writeq(base_val | M_DM_DSCR_BASE_RESET, base_reg);
diff --git a/arch/mips/momentum/ocelot_c/irq.c b/arch/mips/momentum/ocelot_c/irq.c
index 40472f7944d7..844d566c9de3 100644
--- a/arch/mips/momentum/ocelot_c/irq.c
+++ b/arch/mips/momentum/ocelot_c/irq.c
@@ -64,7 +64,7 @@ extern void ll_cpci_irq(void);
64 64
65asmlinkage void plat_irq_dispatch(void) 65asmlinkage void plat_irq_dispatch(void)
66{ 66{
67 unsigned int pending = read_c0_cause() & read_c0_status(); 67 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
68 68
69 if (pending & STATUSF_IP0) 69 if (pending & STATUSF_IP0)
70 do_IRQ(0); 70 do_IRQ(0);
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 9d08608aaa51..69a8bcfe72b2 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -74,13 +74,13 @@ static inline void w_c0_ ## r ## n(unsigned int value) \
74 74
75__define_perf_accessors(perfcntr, 0, 2) 75__define_perf_accessors(perfcntr, 0, 2)
76__define_perf_accessors(perfcntr, 1, 3) 76__define_perf_accessors(perfcntr, 1, 3)
77__define_perf_accessors(perfcntr, 2, 2) 77__define_perf_accessors(perfcntr, 2, 0)
78__define_perf_accessors(perfcntr, 3, 2) 78__define_perf_accessors(perfcntr, 3, 1)
79 79
80__define_perf_accessors(perfctrl, 0, 2) 80__define_perf_accessors(perfctrl, 0, 2)
81__define_perf_accessors(perfctrl, 1, 3) 81__define_perf_accessors(perfctrl, 1, 3)
82__define_perf_accessors(perfctrl, 2, 2) 82__define_perf_accessors(perfctrl, 2, 0)
83__define_perf_accessors(perfctrl, 3, 2) 83__define_perf_accessors(perfctrl, 3, 1)
84 84
85struct op_mips_model op_model_mipsxx_ops; 85struct op_mips_model op_model_mipsxx_ops;
86 86
@@ -97,7 +97,6 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr)
97 int i; 97 int i;
98 98
99 /* Compute the performance counter control word. */ 99 /* Compute the performance counter control word. */
100 /* For now count kernel and user mode */
101 for (i = 0; i < counters; i++) { 100 for (i = 0; i < counters; i++) {
102 reg.control[i] = 0; 101 reg.control[i] = 0;
103 reg.counter[i] = 0; 102 reg.counter[i] = 0;
@@ -234,9 +233,6 @@ static inline int n_counters(void)
234 counters = __n_counters(); 233 counters = __n_counters();
235 } 234 }
236 235
237#ifdef CONFIG_MIPS_MT_SMP
238 counters >> 1;
239#endif
240 return counters; 236 return counters;
241} 237}
242 238
@@ -270,6 +266,10 @@ static int __init mipsxx_init(void)
270 266
271 reset_counters(counters); 267 reset_counters(counters);
272 268
269#ifdef CONFIG_MIPS_MT_SMP
270 counters >>= 1;
271#endif
272
273 op_model_mipsxx_ops.num_counters = counters; 273 op_model_mipsxx_ops.num_counters = counters;
274 switch (current_cpu_data.cputype) { 274 switch (current_cpu_data.cputype) {
275 case CPU_20KC: 275 case CPU_20KC:
@@ -326,7 +326,11 @@ static int __init mipsxx_init(void)
326 326
327static void mipsxx_exit(void) 327static void mipsxx_exit(void)
328{ 328{
329 reset_counters(op_model_mipsxx_ops.num_counters); 329 int counters = op_model_mipsxx_ops.num_counters;
330#ifdef CONFIG_MIPS_MT_SMP
331 counters <<= 1;
332#endif
333 reset_counters(counters);
330 334
331 perf_irq = null_perf_irq; 335 perf_irq = null_perf_irq;
332} 336}
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index f6774f54cd3c..d7b9e1349f6d 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -216,7 +216,7 @@ static int __init bcm1480_pcibios_init(void)
216 /* 216 /*
217 * See if the PCI bus has been configured by the firmware. 217 * See if the PCI bus has been configured by the firmware.
218 */ 218 */
219 reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG)); 219 reg = __raw_readq(IOADDR(A_SCD_SYSTEM_CFG));
220 if (!(reg & M_BCM1480_SYS_PCI_HOST)) { 220 if (!(reg & M_BCM1480_SYS_PCI_HOST)) {
221 bcm1480_bus_status |= PCI_DEVICE_MODE; 221 bcm1480_bus_status |= PCI_DEVICE_MODE;
222 } else { 222 } else {
diff --git a/arch/mips/pci/pci-ev64120.c b/arch/mips/pci/pci-ev64120.c
index 9cd859ef1842..a84f594b5a18 100644
--- a/arch/mips/pci/pci-ev64120.c
+++ b/arch/mips/pci/pci-ev64120.c
@@ -1,4 +1,5 @@
1#include <linux/pci.h> 1#include <linux/pci.h>
2#include <asm/irq.h>
2 3
3int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 4int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
4{ 5{
diff --git a/arch/mips/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c
index 80f5e8c4bcd4..75c1246ced5f 100644
--- a/arch/mips/pci/pci-sb1250.c
+++ b/arch/mips/pci/pci-sb1250.c
@@ -228,7 +228,7 @@ static int __init sb1250_pcibios_init(void)
228 /* 228 /*
229 * See if the PCI bus has been configured by the firmware. 229 * See if the PCI bus has been configured by the firmware.
230 */ 230 */
231 reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG)); 231 reg = __raw_readq(IOADDR(A_SCD_SYSTEM_CFG));
232 if (!(reg & M_SYS_PCI_HOST)) { 232 if (!(reg & M_SYS_PCI_HOST)) {
233 sb1250_bus_status |= PCI_DEVICE_MODE; 233 sb1250_bus_status |= PCI_DEVICE_MODE;
234 } else { 234 } else {
diff --git a/arch/mips/philips/pnx8550/common/int.c b/arch/mips/philips/pnx8550/common/int.c
index d48665ebd33c..aad03429a5e3 100644
--- a/arch/mips/philips/pnx8550/common/int.c
+++ b/arch/mips/philips/pnx8550/common/int.c
@@ -83,16 +83,15 @@ static void timer_irqdispatch(int irq)
83 83
84asmlinkage void plat_irq_dispatch(void) 84asmlinkage void plat_irq_dispatch(void)
85{ 85{
86 unsigned int pending = read_c0_status() & read_c0_cause(); 86 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
87 87
88 if (pending & STATUSF_IP2) 88 if (pending & STATUSF_IP2)
89 hw0_irqdispatch(2); 89 hw0_irqdispatch(2);
90 else if (pending & STATUSF_IP7) { 90 else if (pending & STATUSF_IP7) {
91 if (read_c0_config7() & 0x01c0) 91 if (read_c0_config7() & 0x01c0)
92 timer_irqdispatch(7); 92 timer_irqdispatch(7);
93 } 93 } else
94 94 spurious_interrupt();
95 spurious_interrupt();
96} 95}
97 96
98static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask) 97static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask)
@@ -204,19 +203,7 @@ void __init arch_init_irq(void)
204 * Note, PCI INTA is active low on the bus, but inverted 203 * Note, PCI INTA is active low on the bus, but inverted
205 * in the GIC, so to us it's active high. 204 * in the GIC, so to us it's active high.
206 */ 205 */
207#ifdef CONFIG_PNX8550_V2PCI 206 PNX8550_GIC_REQ(i - PNX8550_INT_GIC_MIN) = 0x1E000000;
208 if (gic_int_line == (PNX8550_INT_GPIO0 - PNX8550_INT_GIC_MIN)) {
209 /* PCI INT through gpio 8, which is setup in
210 * pnx8550_setup.c and routed to GPIO
211 * Interrupt Level 0 (GPIO Connection 58).
212 * Set it active low. */
213
214 PNX8550_GIC_REQ(gic_int_line) = 0x1E020000;
215 } else
216#endif
217 {
218 PNX8550_GIC_REQ(i - PNX8550_INT_GIC_MIN) = 0x1E000000;
219 }
220 207
221 /* mask/priority is still 0 so we will not get any 208 /* mask/priority is still 0 so we will not get any
222 * interrupts until it is unmasked */ 209 * interrupts until it is unmasked */
diff --git a/arch/mips/qemu/q-smp.c b/arch/mips/qemu/q-smp.c
index 5a12354cd576..786bbfa214d1 100644
--- a/arch/mips/qemu/q-smp.c
+++ b/arch/mips/qemu/q-smp.c
@@ -46,3 +46,10 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
46void prom_boot_secondary(int cpu, struct task_struct *idle) 46void prom_boot_secondary(int cpu, struct task_struct *idle)
47{ 47{
48} 48}
49
50void __init plat_smp_setup(void)
51{
52}
53void __init plat_prepare_cpus(unsigned int max_cpus)
54{
55}
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index b454924aeb56..18348321795d 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -237,7 +237,7 @@ extern void indy_8254timer_irq(void);
237 237
238asmlinkage void plat_irq_dispatch(void) 238asmlinkage void plat_irq_dispatch(void)
239{ 239{
240 unsigned int pending = read_c0_cause(); 240 unsigned int pending = read_c0_status() & read_c0_cause();
241 241
242 /* 242 /*
243 * First we check for r4k counter/timer IRQ. 243 * First we check for r4k counter/timer IRQ.
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index 8c450d9e8696..fb9da9acf53f 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -454,7 +454,7 @@ static void ip32_irq5(void)
454 454
455asmlinkage void plat_irq_dispatch(void) 455asmlinkage void plat_irq_dispatch(void)
456{ 456{
457 unsigned int pending = read_c0_cause(); 457 unsigned int pending = read_c0_status() & read_c0_cause();
458 458
459 if (likely(pending & IE_IRQ0)) 459 if (likely(pending & IE_IRQ0))
460 ip32_irq0(); 460 ip32_irq0();
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index 67dac6204b6d..bdf24a7b5494 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -1,31 +1,35 @@
1config SIBYTE_SB1250 1config SIBYTE_SB1250
2 bool 2 bool
3 select HW_HAS_PCI 3 select HW_HAS_PCI
4 select SIBYTE_HAS_LDT 4 select SIBYTE_ENABLE_LDT_IF_PCI
5 select SIBYTE_SB1xxx_SOC 5 select SIBYTE_SB1xxx_SOC
6 select SYS_SUPPORTS_SMP 6 select SYS_SUPPORTS_SMP
7 7
8config SIBYTE_BCM1120 8config SIBYTE_BCM1120
9 bool 9 bool
10 select SIBYTE_BCM112X 10 select SIBYTE_BCM112X
11 select SIBYTE_HAS_ZBUS_PROFILING
11 select SIBYTE_SB1xxx_SOC 12 select SIBYTE_SB1xxx_SOC
12 13
13config SIBYTE_BCM1125 14config SIBYTE_BCM1125
14 bool 15 bool
15 select HW_HAS_PCI 16 select HW_HAS_PCI
16 select SIBYTE_BCM112X 17 select SIBYTE_BCM112X
18 select SIBYTE_HAS_ZBUS_PROFILING
17 select SIBYTE_SB1xxx_SOC 19 select SIBYTE_SB1xxx_SOC
18 20
19config SIBYTE_BCM1125H 21config SIBYTE_BCM1125H
20 bool 22 bool
21 select HW_HAS_PCI 23 select HW_HAS_PCI
22 select SIBYTE_BCM112X 24 select SIBYTE_BCM112X
23 select SIBYTE_HAS_LDT 25 select SIBYTE_ENABLE_LDT_IF_PCI
26 select SIBYTE_HAS_ZBUS_PROFILING
24 select SIBYTE_SB1xxx_SOC 27 select SIBYTE_SB1xxx_SOC
25 28
26config SIBYTE_BCM112X 29config SIBYTE_BCM112X
27 bool 30 bool
28 select SIBYTE_SB1xxx_SOC 31 select SIBYTE_SB1xxx_SOC
32 select SIBYTE_HAS_ZBUS_PROFILING
29 33
30config SIBYTE_BCM1x80 34config SIBYTE_BCM1x80
31 bool 35 bool
@@ -37,6 +41,7 @@ config SIBYTE_BCM1x55
37 bool 41 bool
38 select HW_HAS_PCI 42 select HW_HAS_PCI
39 select SIBYTE_SB1xxx_SOC 43 select SIBYTE_SB1xxx_SOC
44 select SIBYTE_HAS_ZBUS_PROFILING
40 select SYS_SUPPORTS_SMP 45 select SYS_SUPPORTS_SMP
41 46
42config SIBYTE_SB1xxx_SOC 47config SIBYTE_SB1xxx_SOC
@@ -95,8 +100,10 @@ config CPU_SB1_PASS_2
95 100
96config SIBYTE_HAS_LDT 101config SIBYTE_HAS_LDT
97 bool 102 bool
98 depends on PCI && (SIBYTE_SB1250 || SIBYTE_BCM1125H) 103
99 default y 104config SIBYTE_ENABLE_LDT_IF_PCI
105 bool
106 select SIBYTE_HAS_LDT if PCI
100 107
101config SIMULATION 108config SIMULATION
102 bool "Running under simulation" 109 bool "Running under simulation"
@@ -162,5 +169,8 @@ config SIBYTE_SB1250_PROF
162 depends on SIBYTE_SB1xxx_SOC 169 depends on SIBYTE_SB1xxx_SOC
163 170
164config SIBYTE_TBPROF 171config SIBYTE_TBPROF
165 bool "Support for ZBbus profiling" 172 tristate "Support for ZBbus profiling"
166 depends on SIBYTE_SB1xxx_SOC 173 depends on SIBYTE_HAS_ZBUS_PROFILING
174
175config SIBYTE_HAS_ZBUS_PROFILING
176 bool
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 20af0f1bb7bf..ba0c4b776c85 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -141,11 +141,11 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
141 unsigned long flags; 141 unsigned long flags;
142 unsigned int irq_dirty; 142 unsigned int irq_dirty;
143 143
144 i = first_cpu(mask); 144 if (cpus_weight(mask) != 1) {
145 if (next_cpu(i, mask) <= NR_CPUS) {
146 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq); 145 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
147 return; 146 return;
148 } 147 }
148 i = first_cpu(mask);
149 149
150 /* Convert logical CPU to physical CPU */ 150 /* Convert logical CPU to physical CPU */
151 cpu = cpu_logical_map(i); 151 cpu = cpu_logical_map(i);
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index bf328277c775..6eac36d1b8c8 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -34,21 +34,21 @@ extern void smp_call_function_interrupt(void);
34 * independent of board/firmware 34 * independent of board/firmware
35 */ 35 */
36 36
37static volatile void *mailbox_0_set_regs[] = { 37static void *mailbox_0_set_regs[] = {
38 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 38 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
39 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 39 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
40 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 40 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
41 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 41 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
42}; 42};
43 43
44static volatile void *mailbox_0_clear_regs[] = { 44static void *mailbox_0_clear_regs[] = {
45 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 45 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
46 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 46 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
47 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 47 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
48 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 48 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
49}; 49};
50 50
51static volatile void *mailbox_0_regs[] = { 51static void *mailbox_0_regs[] = {
52 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CPU), 52 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
53 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CPU), 53 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
54 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CPU), 54 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
diff --git a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
index 212547c57310..ea0ca131a3cf 100644
--- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
+++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or 2 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 3 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2 4 * as published by the Free Software Foundation; either version 2
@@ -14,10 +12,16 @@
14 * You should have received a copy of the GNU General Public License 12 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software 13 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
17 * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
18 * Copyright (C) 2007 MIPS Technologies, Inc.
19 * written by Ralf Baechle <ralf@linux-mips.org>
17 */ 20 */
18 21
19#define SBPROF_TB_DEBUG 0 22#undef DEBUG
20 23
24#include <linux/device.h>
21#include <linux/module.h> 25#include <linux/module.h>
22#include <linux/kernel.h> 26#include <linux/kernel.h>
23#include <linux/types.h> 27#include <linux/types.h>
@@ -27,24 +31,98 @@
27#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
28#include <linux/fs.h> 32#include <linux/fs.h>
29#include <linux/errno.h> 33#include <linux/errno.h>
30#include <linux/reboot.h> 34#include <linux/types.h>
31#include <linux/smp_lock.h>
32#include <linux/wait.h> 35#include <linux/wait.h>
33#include <asm/uaccess.h> 36
34#include <asm/io.h> 37#include <asm/io.h>
35#include <asm/sibyte/sb1250.h> 38#include <asm/sibyte/sb1250.h>
36#include <asm/sibyte/sb1250_regs.h> 39#include <asm/sibyte/sb1250_regs.h>
37#include <asm/sibyte/sb1250_scd.h> 40#include <asm/sibyte/sb1250_scd.h>
38#include <asm/sibyte/sb1250_int.h> 41#include <asm/sibyte/sb1250_int.h>
39#include <asm/sibyte/trace_prof.h> 42#include <asm/system.h>
43#include <asm/uaccess.h>
40 44
41#define DEVNAME "bcm1250_tbprof" 45#define SBPROF_TB_MAJOR 240
46
47typedef u64 tb_sample_t[6*256];
48
49enum open_status {
50 SB_CLOSED,
51 SB_OPENING,
52 SB_OPEN
53};
54
55struct sbprof_tb {
56 wait_queue_head_t tb_sync;
57 wait_queue_head_t tb_read;
58 struct mutex lock;
59 enum open_status open;
60 tb_sample_t *sbprof_tbbuf;
61 int next_tb_sample;
62
63 volatile int tb_enable;
64 volatile int tb_armed;
65
66};
42 67
43static struct sbprof_tb sbp; 68static struct sbprof_tb sbp;
44 69
70#define MAX_SAMPLE_BYTES (24*1024*1024)
71#define MAX_TBSAMPLE_BYTES (12*1024*1024)
72
73#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
74#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
75#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
76
77/* ioctls */
78#define SBPROF_ZBSTART _IOW('s', 0, int)
79#define SBPROF_ZBSTOP _IOW('s', 1, int)
80#define SBPROF_ZBWAITFULL _IOW('s', 2, int)
81
82/*
83 * Routines for using 40-bit SCD cycle counter
84 *
85 * Client responsible for either handling interrupts or making sure
86 * the cycles counter never saturates, e.g., by doing
87 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
88 */
89
90/*
91 * Configures SCD counter 0 to count ZCLKs starting from val;
92 * Configures SCD counters1,2,3 to count nothing.
93 * Must not be called while gathering ZBbus profiles.
94 */
95
96#define zclk_timer_init(val) \
97 __asm__ __volatile__ (".set push;" \
98 ".set mips64;" \
99 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
100 "sd %0, 0x10($8);" /* write val to counter0 */ \
101 "sd %1, 0($8);" /* config counter0 for zclks*/ \
102 ".set pop" \
103 : /* no outputs */ \
104 /* enable, counter0 */ \
105 : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
106 : /* modifies */ "$8" )
107
108
109/* Reads SCD counter 0 and puts result in value
110 unsigned long long val; */
111#define zclk_get(val) \
112 __asm__ __volatile__ (".set push;" \
113 ".set mips64;" \
114 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
115 "ld %0, 0x10($8);" /* write val to counter0 */ \
116 ".set pop" \
117 : /* outputs */ "=r"(val) \
118 : /* inputs */ \
119 : /* modifies */ "$8" )
120
121#define DEVNAME "bcm1250_tbprof"
122
45#define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES) 123#define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES)
46 124
47/************************************************************************ 125/*
48 * Support for ZBbus sampling using the trace buffer 126 * Support for ZBbus sampling using the trace buffer
49 * 127 *
50 * We use the SCD performance counter interrupt, caused by a Zclk counter 128 * We use the SCD performance counter interrupt, caused by a Zclk counter
@@ -54,30 +132,36 @@ static struct sbprof_tb sbp;
54 * overflow. 132 * overflow.
55 * 133 *
56 * We map the interrupt for trace_buffer_freeze to handle it on CPU 0. 134 * We map the interrupt for trace_buffer_freeze to handle it on CPU 0.
57 * 135 */
58 ************************************************************************/
59 136
60static u_int64_t tb_period; 137static u64 tb_period;
61 138
62static void arm_tb(void) 139static void arm_tb(void)
63{ 140{
64 u_int64_t scdperfcnt; 141 u64 scdperfcnt;
65 u_int64_t next = (1ULL << 40) - tb_period; 142 u64 next = (1ULL << 40) - tb_period;
66 u_int64_t tb_options = M_SCD_TRACE_CFG_FREEZE_FULL; 143 u64 tb_options = M_SCD_TRACE_CFG_FREEZE_FULL;
67 /* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to 144
68 trigger start of trace. XXX vary sampling period */ 145 /*
146 * Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to trigger
147 *start of trace. XXX vary sampling period
148 */
69 __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1)); 149 __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1));
70 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); 150 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG));
71 /* Unfortunately, in Pass 2 we must clear all counters to knock down 151
72 a previous interrupt request. This means that bus profiling 152 /*
73 requires ALL of the SCD perf counters. */ 153 * Unfortunately, in Pass 2 we must clear all counters to knock down a
154 * previous interrupt request. This means that bus profiling requires
155 * ALL of the SCD perf counters.
156 */
74 __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | 157 __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) |
75 // keep counters 0,2,3 as is 158 /* keep counters 0,2,3 as is */
76 M_SPC_CFG_ENABLE | // enable counting 159 M_SPC_CFG_ENABLE | /* enable counting */
77 M_SPC_CFG_CLEAR | // clear all counters 160 M_SPC_CFG_CLEAR | /* clear all counters */
78 V_SPC_CFG_SRC1(1), // counter 1 counts cycles 161 V_SPC_CFG_SRC1(1), /* counter 1 counts cycles */
79 IOADDR(A_SCD_PERF_CNT_CFG)); 162 IOADDR(A_SCD_PERF_CNT_CFG));
80 __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1)); 163 __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1));
164
81 /* Reset the trace buffer */ 165 /* Reset the trace buffer */
82 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); 166 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
83#if 0 && defined(M_SCD_TRACE_CFG_FORCECNT) 167#if 0 && defined(M_SCD_TRACE_CFG_FORCECNT)
@@ -91,43 +175,45 @@ static void arm_tb(void)
91static irqreturn_t sbprof_tb_intr(int irq, void *dev_id) 175static irqreturn_t sbprof_tb_intr(int irq, void *dev_id)
92{ 176{
93 int i; 177 int i;
94 DBG(printk(DEVNAME ": tb_intr\n")); 178
179 pr_debug(DEVNAME ": tb_intr\n");
180
95 if (sbp.next_tb_sample < MAX_TB_SAMPLES) { 181 if (sbp.next_tb_sample < MAX_TB_SAMPLES) {
96 /* XXX should use XKPHYS to make writes bypass L2 */ 182 /* XXX should use XKPHYS to make writes bypass L2 */
97 u_int64_t *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++]; 183 u64 *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++];
98 /* Read out trace */ 184 /* Read out trace */
99 __raw_writeq(M_SCD_TRACE_CFG_START_READ, 185 __raw_writeq(M_SCD_TRACE_CFG_START_READ,
100 IOADDR(A_SCD_TRACE_CFG)); 186 IOADDR(A_SCD_TRACE_CFG));
101 __asm__ __volatile__ ("sync" : : : "memory"); 187 __asm__ __volatile__ ("sync" : : : "memory");
102 /* Loop runs backwards because bundles are read out in reverse order */ 188 /* Loop runs backwards because bundles are read out in reverse order */
103 for (i = 256 * 6; i > 0; i -= 6) { 189 for (i = 256 * 6; i > 0; i -= 6) {
104 // Subscripts decrease to put bundle in the order 190 /* Subscripts decrease to put bundle in the order */
105 // t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi 191 /* t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi */
106 p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 192 p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
107 // read t2 hi 193 /* read t2 hi */
108 p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 194 p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
109 // read t2 lo 195 /* read t2 lo */
110 p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 196 p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
111 // read t1 hi 197 /* read t1 hi */
112 p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 198 p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
113 // read t1 lo 199 /* read t1 lo */
114 p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 200 p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
115 // read t0 hi 201 /* read t0 hi */
116 p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); 202 p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ));
117 // read t0 lo 203 /* read t0 lo */
118 } 204 }
119 if (!sbp.tb_enable) { 205 if (!sbp.tb_enable) {
120 DBG(printk(DEVNAME ": tb_intr shutdown\n")); 206 pr_debug(DEVNAME ": tb_intr shutdown\n");
121 __raw_writeq(M_SCD_TRACE_CFG_RESET, 207 __raw_writeq(M_SCD_TRACE_CFG_RESET,
122 IOADDR(A_SCD_TRACE_CFG)); 208 IOADDR(A_SCD_TRACE_CFG));
123 sbp.tb_armed = 0; 209 sbp.tb_armed = 0;
124 wake_up(&sbp.tb_sync); 210 wake_up(&sbp.tb_sync);
125 } else { 211 } else {
126 arm_tb(); // knock down current interrupt and get another one later 212 arm_tb(); /* knock down current interrupt and get another one later */
127 } 213 }
128 } else { 214 } else {
129 /* No more trace buffer samples */ 215 /* No more trace buffer samples */
130 DBG(printk(DEVNAME ": tb_intr full\n")); 216 pr_debug(DEVNAME ": tb_intr full\n");
131 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); 217 __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
132 sbp.tb_armed = 0; 218 sbp.tb_armed = 0;
133 if (!sbp.tb_enable) { 219 if (!sbp.tb_enable) {
@@ -135,6 +221,7 @@ static irqreturn_t sbprof_tb_intr(int irq, void *dev_id)
135 } 221 }
136 wake_up(&sbp.tb_read); 222 wake_up(&sbp.tb_read);
137 } 223 }
224
138 return IRQ_HANDLED; 225 return IRQ_HANDLED;
139} 226}
140 227
@@ -144,23 +231,30 @@ static irqreturn_t sbprof_pc_intr(int irq, void *dev_id)
144 return IRQ_NONE; 231 return IRQ_NONE;
145} 232}
146 233
147int sbprof_zbprof_start(struct file *filp) 234/*
235 * Requires: Already called zclk_timer_init with a value that won't
236 * saturate 40 bits. No subsequent use of SCD performance counters
237 * or trace buffer.
238 */
239
240static int sbprof_zbprof_start(struct file *filp)
148{ 241{
149 u_int64_t scdperfcnt; 242 u64 scdperfcnt;
243 int err;
150 244
151 if (sbp.tb_enable) 245 if (xchg(&sbp.tb_enable, 1))
152 return -EBUSY; 246 return -EBUSY;
153 247
154 DBG(printk(DEVNAME ": starting\n")); 248 pr_debug(DEVNAME ": starting\n");
155 249
156 sbp.tb_enable = 1;
157 sbp.next_tb_sample = 0; 250 sbp.next_tb_sample = 0;
158 filp->f_pos = 0; 251 filp->f_pos = 0;
159 252
160 if (request_irq 253 err = request_irq(K_INT_TRACE_FREEZE, sbprof_tb_intr, 0,
161 (K_INT_TRACE_FREEZE, sbprof_tb_intr, 0, DEVNAME " trace freeze", &sbp)) { 254 DEVNAME " trace freeze", &sbp);
255 if (err)
162 return -EBUSY; 256 return -EBUSY;
163 } 257
164 /* Make sure there isn't a perf-cnt interrupt waiting */ 258 /* Make sure there isn't a perf-cnt interrupt waiting */
165 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); 259 scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG));
166 /* Disable and clear counters, override SRC_1 */ 260 /* Disable and clear counters, override SRC_1 */
@@ -168,18 +262,21 @@ int sbprof_zbprof_start(struct file *filp)
168 M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1), 262 M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1),
169 IOADDR(A_SCD_PERF_CNT_CFG)); 263 IOADDR(A_SCD_PERF_CNT_CFG));
170 264
171 /* We grab this interrupt to prevent others from trying to use 265 /*
172 it, even though we don't want to service the interrupts 266 * We grab this interrupt to prevent others from trying to use it, even
173 (they only feed into the trace-on-interrupt mechanism) */ 267 * though we don't want to service the interrupts (they only feed into
174 if (request_irq 268 * the trace-on-interrupt mechanism)
175 (K_INT_PERF_CNT, sbprof_pc_intr, 0, DEVNAME " scd perfcnt", &sbp)) { 269 */
176 free_irq(K_INT_TRACE_FREEZE, &sbp); 270 err = request_irq(K_INT_PERF_CNT, sbprof_pc_intr, 0,
177 return -EBUSY; 271 DEVNAME " scd perfcnt", &sbp);
178 } 272 if (err)
179 273 goto out_free_irq;
180 /* I need the core to mask these, but the interrupt mapper to 274
181 pass them through. I am exploiting my knowledge that 275 /*
182 cp0_status masks out IP[5]. krw */ 276 * I need the core to mask these, but the interrupt mapper to pass them
277 * through. I am exploiting my knowledge that cp0_status masks out
278 * IP[5]. krw
279 */
183 __raw_writeq(K_INT_MAP_I3, 280 __raw_writeq(K_INT_MAP_I3,
184 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) + 281 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) +
185 (K_INT_PERF_CNT << 3))); 282 (K_INT_PERF_CNT << 3)));
@@ -201,7 +298,7 @@ int sbprof_zbprof_start(struct file *filp)
201 __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3)); 298 __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3));
202 299
203 /* Initialize Trace Event 0-7 */ 300 /* Initialize Trace Event 0-7 */
204 // when interrupt 301 /* when interrupt */
205 __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0)); 302 __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0));
206 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1)); 303 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1));
207 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2)); 304 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2));
@@ -212,10 +309,10 @@ int sbprof_zbprof_start(struct file *filp)
212 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7)); 309 __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7));
213 310
214 /* Initialize Trace Sequence 0-7 */ 311 /* Initialize Trace Sequence 0-7 */
215 // Start on event 0 (interrupt) 312 /* Start on event 0 (interrupt) */
216 __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff, 313 __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff,
217 IOADDR(A_SCD_TRACE_SEQUENCE_0)); 314 IOADDR(A_SCD_TRACE_SEQUENCE_0));
218 // dsamp when d used | asamp when a used 315 /* dsamp when d used | asamp when a used */
219 __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE | 316 __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE |
220 K_SCD_TRSEQ_TRIGGER_ALL, 317 K_SCD_TRSEQ_TRIGGER_ALL,
221 IOADDR(A_SCD_TRACE_SEQUENCE_1)); 318 IOADDR(A_SCD_TRACE_SEQUENCE_1));
@@ -232,33 +329,41 @@ int sbprof_zbprof_start(struct file *filp)
232 329
233 arm_tb(); 330 arm_tb();
234 331
235 DBG(printk(DEVNAME ": done starting\n")); 332 pr_debug(DEVNAME ": done starting\n");
236 333
237 return 0; 334 return 0;
335
336out_free_irq:
337 free_irq(K_INT_TRACE_FREEZE, &sbp);
338
339 return err;
238} 340}
239 341
240int sbprof_zbprof_stop(void) 342static int sbprof_zbprof_stop(void)
241{ 343{
242 DEFINE_WAIT(wait); 344 int err;
243 DBG(printk(DEVNAME ": stopping\n")); 345
346 pr_debug(DEVNAME ": stopping\n");
244 347
245 if (sbp.tb_enable) { 348 if (sbp.tb_enable) {
349 /*
350 * XXXKW there is a window here where the intr handler may run,
351 * see the disable, and do the wake_up before this sleep
352 * happens.
353 */
354 pr_debug(DEVNAME ": wait for disarm\n");
355 err = wait_event_interruptible(sbp.tb_sync, !sbp.tb_armed);
356 pr_debug(DEVNAME ": disarm complete, stat %d\n", err);
357
358 if (err)
359 return err;
360
246 sbp.tb_enable = 0; 361 sbp.tb_enable = 0;
247 /* XXXKW there is a window here where the intr handler
248 may run, see the disable, and do the wake_up before
249 this sleep happens. */
250 if (sbp.tb_armed) {
251 DBG(printk(DEVNAME ": wait for disarm\n"));
252 prepare_to_wait(&sbp.tb_sync, &wait, TASK_INTERRUPTIBLE);
253 schedule();
254 finish_wait(&sbp.tb_sync, &wait);
255 DBG(printk(DEVNAME ": disarm complete\n"));
256 }
257 free_irq(K_INT_TRACE_FREEZE, &sbp); 362 free_irq(K_INT_TRACE_FREEZE, &sbp);
258 free_irq(K_INT_PERF_CNT, &sbp); 363 free_irq(K_INT_PERF_CNT, &sbp);
259 } 364 }
260 365
261 DBG(printk(DEVNAME ": done stopping\n")); 366 pr_debug(DEVNAME ": done stopping\n");
262 367
263 return 0; 368 return 0;
264} 369}
@@ -268,42 +373,45 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp)
268 int minor; 373 int minor;
269 374
270 minor = iminor(inode); 375 minor = iminor(inode);
271 if (minor != 0) { 376 if (minor != 0)
272 return -ENODEV; 377 return -ENODEV;
273 } 378
274 if (sbp.open) { 379 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED)
275 return -EBUSY; 380 return -EBUSY;
276 }
277 381
278 memset(&sbp, 0, sizeof(struct sbprof_tb)); 382 memset(&sbp, 0, sizeof(struct sbprof_tb));
383
279 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); 384 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
280 if (!sbp.sbprof_tbbuf) { 385 if (!sbp.sbprof_tbbuf)
281 return -ENOMEM; 386 return -ENOMEM;
282 } 387
283 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); 388 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
284 init_waitqueue_head(&sbp.tb_sync); 389 init_waitqueue_head(&sbp.tb_sync);
285 init_waitqueue_head(&sbp.tb_read); 390 init_waitqueue_head(&sbp.tb_read);
286 sbp.open = 1; 391 mutex_init(&sbp.lock);
392
393 sbp.open = SB_OPEN;
287 394
288 return 0; 395 return 0;
289} 396}
290 397
291static int sbprof_tb_release(struct inode *inode, struct file *filp) 398static int sbprof_tb_release(struct inode *inode, struct file *filp)
292{ 399{
293 int minor; 400 int minor = iminor(inode);
294 401
295 minor = iminor(inode); 402 if (minor != 0 || !sbp.open)
296 if (minor != 0 || !sbp.open) {
297 return -ENODEV; 403 return -ENODEV;
298 }
299 404
300 if (sbp.tb_armed || sbp.tb_enable) { 405 mutex_lock(&sbp.lock);
406
407 if (sbp.tb_armed || sbp.tb_enable)
301 sbprof_zbprof_stop(); 408 sbprof_zbprof_stop();
302 }
303 409
304 vfree(sbp.sbprof_tbbuf); 410 vfree(sbp.sbprof_tbbuf);
305 sbp.open = 0; 411 sbp.open = 0;
306 412
413 mutex_unlock(&sbp.lock);
414
307 return 0; 415 return 0;
308} 416}
309 417
@@ -311,21 +419,35 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf,
311 size_t size, loff_t *offp) 419 size_t size, loff_t *offp)
312{ 420{
313 int cur_sample, sample_off, cur_count, sample_left; 421 int cur_sample, sample_off, cur_count, sample_left;
314 char *src;
315 int count = 0;
316 char *dest = buf;
317 long cur_off = *offp; 422 long cur_off = *offp;
423 char *dest = buf;
424 int count = 0;
425 char *src;
426
427 if (!access_ok(VERIFY_WRITE, buf, size))
428 return -EFAULT;
429
430 mutex_lock(&sbp.lock);
318 431
319 count = 0; 432 count = 0;
320 cur_sample = cur_off / TB_SAMPLE_SIZE; 433 cur_sample = cur_off / TB_SAMPLE_SIZE;
321 sample_off = cur_off % TB_SAMPLE_SIZE; 434 sample_off = cur_off % TB_SAMPLE_SIZE;
322 sample_left = TB_SAMPLE_SIZE - sample_off; 435 sample_left = TB_SAMPLE_SIZE - sample_off;
436
323 while (size && (cur_sample < sbp.next_tb_sample)) { 437 while (size && (cur_sample < sbp.next_tb_sample)) {
438 int err;
439
324 cur_count = size < sample_left ? size : sample_left; 440 cur_count = size < sample_left ? size : sample_left;
325 src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off); 441 src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off);
326 copy_to_user(dest, src, cur_count); 442 err = __copy_to_user(dest, src, cur_count);
327 DBG(printk(DEVNAME ": read from sample %d, %d bytes\n", 443 if (err) {
328 cur_sample, cur_count)); 444 *offp = cur_off + cur_count - err;
445 mutex_unlock(&sbp.lock);
446 return err;
447 }
448
449 pr_debug(DEVNAME ": read from sample %d, %d bytes\n",
450 cur_sample, cur_count);
329 size -= cur_count; 451 size -= cur_count;
330 sample_left -= cur_count; 452 sample_left -= cur_count;
331 if (!sample_left) { 453 if (!sample_left) {
@@ -339,37 +461,43 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf,
339 dest += cur_count; 461 dest += cur_count;
340 count += cur_count; 462 count += cur_count;
341 } 463 }
464
342 *offp = cur_off; 465 *offp = cur_off;
466 mutex_unlock(&sbp.lock);
343 467
344 return count; 468 return count;
345} 469}
346 470
347static long sbprof_tb_ioctl(struct file *filp, 471static long sbprof_tb_ioctl(struct file *filp, unsigned int command,
348 unsigned int command, 472 unsigned long arg)
349 unsigned long arg)
350{ 473{
351 int error = 0; 474 int error = 0;
352 475
353 lock_kernel();
354 switch (command) { 476 switch (command) {
355 case SBPROF_ZBSTART: 477 case SBPROF_ZBSTART:
478 mutex_lock(&sbp.lock);
356 error = sbprof_zbprof_start(filp); 479 error = sbprof_zbprof_start(filp);
480 mutex_unlock(&sbp.lock);
357 break; 481 break;
482
358 case SBPROF_ZBSTOP: 483 case SBPROF_ZBSTOP:
484 mutex_lock(&sbp.lock);
359 error = sbprof_zbprof_stop(); 485 error = sbprof_zbprof_stop();
486 mutex_unlock(&sbp.lock);
360 break; 487 break;
488
361 case SBPROF_ZBWAITFULL: 489 case SBPROF_ZBWAITFULL:
362 DEFINE_WAIT(wait); 490 error = wait_event_interruptible(sbp.tb_read, TB_FULL);
363 prepare_to_wait(&sbp.tb_read, &wait, TASK_INTERRUPTIBLE); 491 if (error)
364 schedule(); 492 break;
365 finish_wait(&sbp.tb_read, &wait); 493
366 /* XXXKW check if interrupted? */ 494 error = put_user(TB_FULL, (int *) arg);
367 return put_user(TB_FULL, (int *) arg); 495 break;
496
368 default: 497 default:
369 error = -EINVAL; 498 error = -EINVAL;
370 break; 499 break;
371 } 500 }
372 unlock_kernel();
373 501
374 return error; 502 return error;
375} 503}
@@ -384,23 +512,60 @@ static const struct file_operations sbprof_tb_fops = {
384 .mmap = NULL, 512 .mmap = NULL,
385}; 513};
386 514
515static struct class *tb_class;
516static struct device *tb_dev;
517
387static int __init sbprof_tb_init(void) 518static int __init sbprof_tb_init(void)
388{ 519{
520 struct device *dev;
521 struct class *tbc;
522 int err;
523
389 if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) { 524 if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) {
390 printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n", 525 printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n",
391 SBPROF_TB_MAJOR); 526 SBPROF_TB_MAJOR);
392 return -EIO; 527 return -EIO;
393 } 528 }
529
530 tbc = class_create(THIS_MODULE, "sb_tracebuffer");
531 if (IS_ERR(tbc)) {
532 err = PTR_ERR(tbc);
533 goto out_chrdev;
534 }
535
536 tb_class = tbc;
537
538 dev = device_create(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0), "tb");
539 if (IS_ERR(dev)) {
540 err = PTR_ERR(dev);
541 goto out_class;
542 }
543 tb_dev = dev;
544
394 sbp.open = 0; 545 sbp.open = 0;
395 tb_period = zbbus_mhz * 10000LL; 546 tb_period = zbbus_mhz * 10000LL;
396 printk(KERN_INFO DEVNAME ": initialized - tb_period = %lld\n", tb_period); 547 pr_info(DEVNAME ": initialized - tb_period = %lld\n", tb_period);
548
397 return 0; 549 return 0;
550
551out_class:
552 class_destroy(tb_class);
553out_chrdev:
554 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME);
555
556 return err;
398} 557}
399 558
400static void __exit sbprof_tb_cleanup(void) 559static void __exit sbprof_tb_cleanup(void)
401{ 560{
561 device_destroy(tb_class, MKDEV(SBPROF_TB_MAJOR, 0));
402 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME); 562 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME);
563 class_destroy(tb_class);
403} 564}
404 565
405module_init(sbprof_tb_init); 566module_init(sbprof_tb_init);
406module_exit(sbprof_tb_cleanup); 567module_exit(sbprof_tb_cleanup);
568
569MODULE_ALIAS_CHARDEV_MAJOR(SBPROF_TB_MAJOR);
570MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
571MODULE_LICENSE("GPL");
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 148239446e6e..0e6a13c0bd0e 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -421,7 +421,7 @@ asmlinkage void plat_irq_dispatch(void)
421 * blasting the high 32 bits. 421 * blasting the high 32 bits.
422 */ 422 */
423 423
424 pending = read_c0_cause() & read_c0_status(); 424 pending = read_c0_cause() & read_c0_status() & ST0_IM;
425 425
426#ifdef CONFIG_SIBYTE_SB1250_PROF 426#ifdef CONFIG_SIBYTE_SB1250_PROF
427 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */ 427 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index 1cb042eab720..87188f0f6fbe 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/module.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/reboot.h> 21#include <linux/reboot.h>
21#include <linux/string.h> 22#include <linux/string.h>
@@ -32,6 +33,7 @@ unsigned int soc_pass;
32unsigned int soc_type; 33unsigned int soc_type;
33unsigned int periph_rev; 34unsigned int periph_rev;
34unsigned int zbbus_mhz; 35unsigned int zbbus_mhz;
36EXPORT_SYMBOL(zbbus_mhz);
35 37
36static char *soc_str; 38static char *soc_str;
37static char *pass_str; 39static char *pass_str;
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index defa1f1452ad..83572d8f3e14 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -169,17 +169,19 @@ void __init plat_mem_setup(void)
169#define LEDS_PHYS MLEDS_PHYS 169#define LEDS_PHYS MLEDS_PHYS
170#endif 170#endif
171 171
172#define setled(index, c) \
173 ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
174void setleds(char *str) 172void setleds(char *str)
175{ 173{
174 void *reg;
176 int i; 175 int i;
176
177 for (i = 0; i < 4; i++) { 177 for (i = 0; i < 4; i++) {
178 if (!str[i]) { 178 reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
179 setled(i, ' '); 179
180 } else { 180 if (!str[i])
181 setled(i, str[i]); 181 writeb(' ', reg);
182 } 182 else
183 writeb(str[i], reg);
183 } 184 }
184} 185}
185#endif 186
187#endif /* LEDS_PHYS */
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 39e5b4abc555..8e8593b64f6a 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -333,7 +333,7 @@ static void pcimt_hwint3(void)
333 333
334static void sni_pcimt_hwint(void) 334static void sni_pcimt_hwint(void)
335{ 335{
336 u32 pending = (read_c0_cause() & read_c0_status()); 336 u32 pending = read_c0_cause() & read_c0_status();
337 337
338 if (pending & C_IRQ5) 338 if (pending & C_IRQ5)
339 do_IRQ (MIPS_CPU_IRQ_BASE + 7); 339 do_IRQ (MIPS_CPU_IRQ_BASE + 7);
diff --git a/arch/mips/sni/pcit.c b/arch/mips/sni/pcit.c
index 8d6b3d5b13a1..1dfc3f00bbd3 100644
--- a/arch/mips/sni/pcit.c
+++ b/arch/mips/sni/pcit.c
@@ -271,7 +271,7 @@ static void pcit_hwint0(void)
271 271
272static void sni_pcit_hwint(void) 272static void sni_pcit_hwint(void)
273{ 273{
274 u32 pending = (read_c0_cause() & read_c0_status()); 274 u32 pending = read_c0_cause() & read_c0_status();
275 275
276 if (pending & C_IRQ1) 276 if (pending & C_IRQ1)
277 pcit_hwint1(); 277 pcit_hwint1();
@@ -285,7 +285,7 @@ static void sni_pcit_hwint(void)
285 285
286static void sni_pcit_hwint_cplus(void) 286static void sni_pcit_hwint_cplus(void)
287{ 287{
288 u32 pending = (read_c0_cause() & read_c0_status()); 288 u32 pending = read_c0_cause() & read_c0_status();
289 289
290 if (pending & C_IRQ0) 290 if (pending & C_IRQ0)
291 pcit_hwint0(); 291 pcit_hwint0();
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index e7f3e5b84dcf..3d25d010f3d5 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -416,7 +416,7 @@ static int tx4927_irq_nested(void)
416 416
417asmlinkage void plat_irq_dispatch(void) 417asmlinkage void plat_irq_dispatch(void)
418{ 418{
419 unsigned int pending = read_c0_status() & read_c0_cause(); 419 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
420 420
421 if (pending & STATUSF_IP7) /* cpu timer */ 421 if (pending & STATUSF_IP7) /* cpu timer */
422 do_IRQ(TX4927_IRQ_CPU_TIMER); 422 do_IRQ(TX4927_IRQ_CPU_TIMER);
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index 24367319ce24..cf7e316ad4f6 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_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.20-rc5 3# Linux kernel version: 2.6.21-rc3
4# Mon Jan 22 22:12:56 2007 4# Fri Mar 9 23:34:53 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -61,6 +61,7 @@ CONFIG_LOCALVERSION_AUTO=y
61CONFIG_SWAP=y 61CONFIG_SWAP=y
62CONFIG_SYSVIPC=y 62CONFIG_SYSVIPC=y
63# CONFIG_IPC_NS is not set 63# CONFIG_IPC_NS is not set
64CONFIG_SYSVIPC_SYSCTL=y
64# CONFIG_POSIX_MQUEUE is not set 65# CONFIG_POSIX_MQUEUE is not set
65# CONFIG_BSD_PROCESS_ACCT is not set 66# CONFIG_BSD_PROCESS_ACCT is not set
66# CONFIG_TASKSTATS is not set 67# CONFIG_TASKSTATS is not set
@@ -71,6 +72,7 @@ CONFIG_IKCONFIG_PROC=y
71CONFIG_CPUSETS=y 72CONFIG_CPUSETS=y
72CONFIG_SYSFS_DEPRECATED=y 73CONFIG_SYSFS_DEPRECATED=y
73# CONFIG_RELAY is not set 74# CONFIG_RELAY is not set
75CONFIG_BLK_DEV_INITRD=y
74CONFIG_INITRAMFS_SOURCE="" 76CONFIG_INITRAMFS_SOURCE=""
75CONFIG_CC_OPTIMIZE_FOR_SIZE=y 77CONFIG_CC_OPTIMIZE_FOR_SIZE=y
76CONFIG_SYSCTL=y 78CONFIG_SYSCTL=y
@@ -133,6 +135,7 @@ CONFIG_PPC_MULTIPLATFORM=y
133# CONFIG_PPC_PSERIES is not set 135# CONFIG_PPC_PSERIES is not set
134# CONFIG_PPC_ISERIES is not set 136# CONFIG_PPC_ISERIES is not set
135# CONFIG_PPC_MPC52xx is not set 137# CONFIG_PPC_MPC52xx is not set
138# CONFIG_PPC_MPC5200 is not set
136# CONFIG_PPC_PMAC is not set 139# CONFIG_PPC_PMAC is not set
137# CONFIG_PPC_MAPLE is not set 140# CONFIG_PPC_MAPLE is not set
138# CONFIG_PPC_PASEMI is not set 141# CONFIG_PPC_PASEMI is not set
@@ -140,8 +143,10 @@ CONFIG_PPC_CELL=y
140CONFIG_PPC_CELL_NATIVE=y 143CONFIG_PPC_CELL_NATIVE=y
141CONFIG_PPC_IBM_CELL_BLADE=y 144CONFIG_PPC_IBM_CELL_BLADE=y
142CONFIG_PPC_PS3=y 145CONFIG_PPC_PS3=y
146CONFIG_PPC_CELLEB=y
143CONFIG_PPC_NATIVE=y 147CONFIG_PPC_NATIVE=y
144CONFIG_UDBG_RTAS_CONSOLE=y 148CONFIG_UDBG_RTAS_CONSOLE=y
149CONFIG_PPC_UDBG_BEAT=y
145# CONFIG_U3_DART is not set 150# CONFIG_U3_DART is not set
146CONFIG_PPC_RTAS=y 151CONFIG_PPC_RTAS=y
147# CONFIG_RTAS_ERROR_LOGGING is not set 152# CONFIG_RTAS_ERROR_LOGGING is not set
@@ -181,10 +186,13 @@ CONFIG_CBE_CPUFREQ=m
181# 186#
182# PS3 Platform Options 187# PS3 Platform Options
183# 188#
189# CONFIG_PS3_ADVANCED is not set
184CONFIG_PS3_HTAB_SIZE=20 190CONFIG_PS3_HTAB_SIZE=20
185# CONFIG_PS3_DYNAMIC_DMA is not set 191# CONFIG_PS3_DYNAMIC_DMA is not set
186CONFIG_PS3_USE_LPAR_ADDR=y 192CONFIG_PS3_USE_LPAR_ADDR=y
187CONFIG_PS3_VUART=y 193CONFIG_PS3_VUART=y
194CONFIG_PS3_PS3AV=y
195CONFIG_PS3_SYS_MANAGER=y
188 196
189# 197#
190# Kernel options 198# Kernel options
@@ -226,6 +234,7 @@ CONFIG_MEMORY_HOTPLUG_SPARSE=y
226CONFIG_SPLIT_PTLOCK_CPUS=4 234CONFIG_SPLIT_PTLOCK_CPUS=4
227CONFIG_MIGRATION=y 235CONFIG_MIGRATION=y
228CONFIG_RESOURCES_64BIT=y 236CONFIG_RESOURCES_64BIT=y
237CONFIG_ZONE_DMA_FLAG=1
229CONFIG_ARCH_MEMORY_PROBE=y 238CONFIG_ARCH_MEMORY_PROBE=y
230CONFIG_NODES_SPAN_OTHER_NODES=y 239CONFIG_NODES_SPAN_OTHER_NODES=y
231CONFIG_PPC_64K_PAGES=y 240CONFIG_PPC_64K_PAGES=y
@@ -239,6 +248,7 @@ CONFIG_ISA_DMA_API=y
239# 248#
240# Bus options 249# Bus options
241# 250#
251CONFIG_ZONE_DMA=y
242CONFIG_GENERIC_ISA_DMA=y 252CONFIG_GENERIC_ISA_DMA=y
243# CONFIG_MPIC_WEIRD is not set 253# CONFIG_MPIC_WEIRD is not set
244# CONFIG_PPC_I8259 is not set 254# CONFIG_PPC_I8259 is not set
@@ -274,6 +284,7 @@ CONFIG_UNIX=y
274CONFIG_XFRM=y 284CONFIG_XFRM=y
275# CONFIG_XFRM_USER is not set 285# CONFIG_XFRM_USER is not set
276# CONFIG_XFRM_SUB_POLICY is not set 286# CONFIG_XFRM_SUB_POLICY is not set
287# CONFIG_XFRM_MIGRATE is not set
277# CONFIG_NET_KEY is not set 288# CONFIG_NET_KEY is not set
278CONFIG_INET=y 289CONFIG_INET=y
279CONFIG_IP_MULTICAST=y 290CONFIG_IP_MULTICAST=y
@@ -340,6 +351,7 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m
340CONFIG_NETFILTER_XT_TARGET_MARK=m 351CONFIG_NETFILTER_XT_TARGET_MARK=m
341CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m 352CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
342CONFIG_NETFILTER_XT_TARGET_NFLOG=m 353CONFIG_NETFILTER_XT_TARGET_NFLOG=m
354CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
343CONFIG_NETFILTER_XT_MATCH_COMMENT=m 355CONFIG_NETFILTER_XT_MATCH_COMMENT=m
344CONFIG_NETFILTER_XT_MATCH_DCCP=m 356CONFIG_NETFILTER_XT_MATCH_DCCP=m
345CONFIG_NETFILTER_XT_MATCH_DSCP=m 357CONFIG_NETFILTER_XT_MATCH_DSCP=m
@@ -376,7 +388,6 @@ CONFIG_IP_NF_FILTER=m
376CONFIG_IP_NF_TARGET_REJECT=m 388CONFIG_IP_NF_TARGET_REJECT=m
377CONFIG_IP_NF_TARGET_LOG=m 389CONFIG_IP_NF_TARGET_LOG=m
378CONFIG_IP_NF_TARGET_ULOG=m 390CONFIG_IP_NF_TARGET_ULOG=m
379CONFIG_IP_NF_TARGET_TCPMSS=m
380CONFIG_IP_NF_MANGLE=m 391CONFIG_IP_NF_MANGLE=m
381CONFIG_IP_NF_TARGET_TOS=m 392CONFIG_IP_NF_TARGET_TOS=m
382CONFIG_IP_NF_TARGET_ECN=m 393CONFIG_IP_NF_TARGET_ECN=m
@@ -444,6 +455,7 @@ CONFIG_STANDALONE=y
444CONFIG_PREVENT_FIRMWARE_BUILD=y 455CONFIG_PREVENT_FIRMWARE_BUILD=y
445CONFIG_FW_LOADER=y 456CONFIG_FW_LOADER=y
446# CONFIG_DEBUG_DRIVER is not set 457# CONFIG_DEBUG_DRIVER is not set
458# CONFIG_DEBUG_DEVRES is not set
447# CONFIG_SYS_HYPERVISOR is not set 459# CONFIG_SYS_HYPERVISOR is not set
448 460
449# 461#
@@ -464,6 +476,7 @@ CONFIG_FW_LOADER=y
464# 476#
465# Plug and Play support 477# Plug and Play support
466# 478#
479# CONFIG_PNPACPI is not set
467 480
468# 481#
469# Block devices 482# Block devices
@@ -483,7 +496,6 @@ CONFIG_BLK_DEV_RAM=y
483CONFIG_BLK_DEV_RAM_COUNT=16 496CONFIG_BLK_DEV_RAM_COUNT=16
484CONFIG_BLK_DEV_RAM_SIZE=131072 497CONFIG_BLK_DEV_RAM_SIZE=131072
485CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 498CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
486CONFIG_BLK_DEV_INITRD=y
487# CONFIG_CDROM_PKTCDVD is not set 499# CONFIG_CDROM_PKTCDVD is not set
488# CONFIG_ATA_OVER_ETH is not set 500# CONFIG_ATA_OVER_ETH is not set
489 501
@@ -537,6 +549,7 @@ CONFIG_BLK_DEV_AEC62XX=y
537# CONFIG_BLK_DEV_JMICRON is not set 549# CONFIG_BLK_DEV_JMICRON is not set
538# CONFIG_BLK_DEV_SC1200 is not set 550# CONFIG_BLK_DEV_SC1200 is not set
539# CONFIG_BLK_DEV_PIIX is not set 551# CONFIG_BLK_DEV_PIIX is not set
552# CONFIG_BLK_DEV_IT8213 is not set
540# CONFIG_BLK_DEV_IT821X is not set 553# CONFIG_BLK_DEV_IT821X is not set
541# CONFIG_BLK_DEV_NS87415 is not set 554# CONFIG_BLK_DEV_NS87415 is not set
542# CONFIG_BLK_DEV_PDC202XX_OLD is not set 555# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -547,6 +560,8 @@ CONFIG_BLK_DEV_SIIMAGE=y
547# CONFIG_BLK_DEV_SLC90E66 is not set 560# CONFIG_BLK_DEV_SLC90E66 is not set
548# CONFIG_BLK_DEV_TRM290 is not set 561# CONFIG_BLK_DEV_TRM290 is not set
549# CONFIG_BLK_DEV_VIA82CXXX is not set 562# CONFIG_BLK_DEV_VIA82CXXX is not set
563# CONFIG_BLK_DEV_TC86C001 is not set
564CONFIG_BLK_DEV_IDE_CELLEB=y
550# CONFIG_IDE_ARM is not set 565# CONFIG_IDE_ARM is not set
551CONFIG_BLK_DEV_IDEDMA=y 566CONFIG_BLK_DEV_IDEDMA=y
552# CONFIG_IDEDMA_IVB is not set 567# CONFIG_IDEDMA_IVB is not set
@@ -557,7 +572,7 @@ CONFIG_IDEDMA_AUTO=y
557# SCSI device support 572# SCSI device support
558# 573#
559# CONFIG_RAID_ATTRS is not set 574# CONFIG_RAID_ATTRS is not set
560CONFIG_SCSI=m 575CONFIG_SCSI=y
561# CONFIG_SCSI_TGT is not set 576# CONFIG_SCSI_TGT is not set
562# CONFIG_SCSI_NETLINK is not set 577# CONFIG_SCSI_NETLINK is not set
563CONFIG_SCSI_PROC_FS=y 578CONFIG_SCSI_PROC_FS=y
@@ -565,12 +580,12 @@ CONFIG_SCSI_PROC_FS=y
565# 580#
566# SCSI support type (disk, tape, CD-ROM) 581# SCSI support type (disk, tape, CD-ROM)
567# 582#
568CONFIG_BLK_DEV_SD=m 583CONFIG_BLK_DEV_SD=y
569# CONFIG_CHR_DEV_ST is not set 584# CONFIG_CHR_DEV_ST is not set
570# CONFIG_CHR_DEV_OSST is not set 585# CONFIG_CHR_DEV_OSST is not set
571CONFIG_BLK_DEV_SR=m 586CONFIG_BLK_DEV_SR=m
572# CONFIG_BLK_DEV_SR_VENDOR is not set 587# CONFIG_BLK_DEV_SR_VENDOR is not set
573CONFIG_CHR_DEV_SG=m 588CONFIG_CHR_DEV_SG=y
574# CONFIG_CHR_DEV_SCH is not set 589# CONFIG_CHR_DEV_SCH is not set
575 590
576# 591#
@@ -587,7 +602,7 @@ CONFIG_CHR_DEV_SG=m
587# CONFIG_SCSI_SPI_ATTRS is not set 602# CONFIG_SCSI_SPI_ATTRS is not set
588# CONFIG_SCSI_FC_ATTRS is not set 603# CONFIG_SCSI_FC_ATTRS is not set
589# CONFIG_SCSI_ISCSI_ATTRS is not set 604# CONFIG_SCSI_ISCSI_ATTRS is not set
590# CONFIG_SCSI_SAS_ATTRS is not set 605CONFIG_SCSI_SAS_ATTRS=y
591# CONFIG_SCSI_SAS_LIBSAS is not set 606# CONFIG_SCSI_SAS_LIBSAS is not set
592 607
593# 608#
@@ -617,6 +632,7 @@ CONFIG_CHR_DEV_SG=m
617# CONFIG_SCSI_INIA100 is not set 632# CONFIG_SCSI_INIA100 is not set
618# CONFIG_SCSI_STEX is not set 633# CONFIG_SCSI_STEX is not set
619# CONFIG_SCSI_SYM53C8XX_2 is not set 634# CONFIG_SCSI_SYM53C8XX_2 is not set
635# CONFIG_SCSI_IPR is not set
620# CONFIG_SCSI_QLOGIC_1280 is not set 636# CONFIG_SCSI_QLOGIC_1280 is not set
621# CONFIG_SCSI_QLA_FC is not set 637# CONFIG_SCSI_QLA_FC is not set
622# CONFIG_SCSI_QLA_ISCSI is not set 638# CONFIG_SCSI_QLA_ISCSI is not set
@@ -629,7 +645,60 @@ CONFIG_CHR_DEV_SG=m
629# 645#
630# Serial ATA (prod) and Parallel ATA (experimental) drivers 646# Serial ATA (prod) and Parallel ATA (experimental) drivers
631# 647#
632# CONFIG_ATA is not set 648CONFIG_ATA=y
649# CONFIG_ATA_NONSTANDARD is not set
650# CONFIG_SATA_AHCI is not set
651# CONFIG_SATA_SVW is not set
652# CONFIG_ATA_PIIX is not set
653# CONFIG_SATA_MV is not set
654# CONFIG_SATA_NV is not set
655# CONFIG_PDC_ADMA is not set
656# CONFIG_SATA_QSTOR is not set
657CONFIG_SATA_PROMISE=y
658# CONFIG_SATA_SX4 is not set
659# CONFIG_SATA_SIL is not set
660# CONFIG_SATA_SIL24 is not set
661# CONFIG_SATA_SIS is not set
662# CONFIG_SATA_ULI is not set
663# CONFIG_SATA_VIA is not set
664# CONFIG_SATA_VITESSE is not set
665# CONFIG_SATA_INIC162X is not set
666# CONFIG_PATA_ALI is not set
667# CONFIG_PATA_AMD is not set
668# CONFIG_PATA_ARTOP is not set
669# CONFIG_PATA_ATIIXP is not set
670# CONFIG_PATA_CMD64X is not set
671# CONFIG_PATA_CS5520 is not set
672# CONFIG_PATA_CS5530 is not set
673# CONFIG_PATA_CYPRESS is not set
674# CONFIG_PATA_EFAR is not set
675# CONFIG_ATA_GENERIC is not set
676# CONFIG_PATA_HPT366 is not set
677# CONFIG_PATA_HPT37X is not set
678# CONFIG_PATA_HPT3X2N is not set
679# CONFIG_PATA_HPT3X3 is not set
680# CONFIG_PATA_IT821X is not set
681# CONFIG_PATA_IT8213 is not set
682# CONFIG_PATA_JMICRON is not set
683# CONFIG_PATA_TRIFLEX is not set
684# CONFIG_PATA_MARVELL is not set
685# CONFIG_PATA_MPIIX is not set
686# CONFIG_PATA_OLDPIIX is not set
687# CONFIG_PATA_NETCELL is not set
688# CONFIG_PATA_NS87410 is not set
689# CONFIG_PATA_OPTI is not set
690# CONFIG_PATA_OPTIDMA is not set
691# CONFIG_PATA_PDC_OLD is not set
692# CONFIG_PATA_RADISYS is not set
693# CONFIG_PATA_RZ1000 is not set
694# CONFIG_PATA_SC1200 is not set
695# CONFIG_PATA_SERVERWORKS is not set
696CONFIG_PATA_PDC2027X=m
697# CONFIG_PATA_SIL680 is not set
698# CONFIG_PATA_SIS is not set
699# CONFIG_PATA_VIA is not set
700# CONFIG_PATA_WINBOND is not set
701# CONFIG_PATA_SCC is not set
633 702
634# 703#
635# Multi-device support (RAID and LVM) 704# Multi-device support (RAID and LVM)
@@ -655,10 +724,12 @@ CONFIG_DM_MULTIPATH=m
655# 724#
656# Fusion MPT device support 725# Fusion MPT device support
657# 726#
658# CONFIG_FUSION is not set 727CONFIG_FUSION=y
659# CONFIG_FUSION_SPI is not set 728# CONFIG_FUSION_SPI is not set
660# CONFIG_FUSION_FC is not set 729# CONFIG_FUSION_FC is not set
661# CONFIG_FUSION_SAS is not set 730CONFIG_FUSION_SAS=y
731CONFIG_FUSION_MAX_SGE=128
732# CONFIG_FUSION_CTL is not set
662 733
663# 734#
664# IEEE 1394 (FireWire) support 735# IEEE 1394 (FireWire) support
@@ -732,15 +803,18 @@ CONFIG_TIGON3=y
732# CONFIG_BNX2 is not set 803# CONFIG_BNX2 is not set
733CONFIG_SPIDER_NET=y 804CONFIG_SPIDER_NET=y
734# CONFIG_QLA3XXX is not set 805# CONFIG_QLA3XXX is not set
806# CONFIG_ATL1 is not set
735 807
736# 808#
737# Ethernet (10000 Mbit) 809# Ethernet (10000 Mbit)
738# 810#
739# CONFIG_CHELSIO_T1 is not set 811# CONFIG_CHELSIO_T1 is not set
812# CONFIG_CHELSIO_T3 is not set
740# CONFIG_IXGB is not set 813# CONFIG_IXGB is not set
741# CONFIG_S2IO is not set 814# CONFIG_S2IO is not set
742# CONFIG_MYRI10GE is not set 815# CONFIG_MYRI10GE is not set
743# CONFIG_NETXEN_NIC is not set 816# CONFIG_NETXEN_NIC is not set
817# CONFIG_PASEMI_MAC is not set
744 818
745# 819#
746# Token Ring devices 820# Token Ring devices
@@ -853,16 +927,27 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
853# 927#
854CONFIG_SERIAL_CORE=y 928CONFIG_SERIAL_CORE=y
855CONFIG_SERIAL_CORE_CONSOLE=y 929CONFIG_SERIAL_CORE_CONSOLE=y
930CONFIG_SERIAL_TXX9=y
931CONFIG_HAS_TXX9_SERIAL=y
932CONFIG_SERIAL_TXX9_NR_UARTS=2
933CONFIG_SERIAL_TXX9_CONSOLE=y
856# CONFIG_SERIAL_JSM is not set 934# CONFIG_SERIAL_JSM is not set
935CONFIG_SERIAL_OF_PLATFORM=y
857CONFIG_UNIX98_PTYS=y 936CONFIG_UNIX98_PTYS=y
858# CONFIG_LEGACY_PTYS is not set 937# CONFIG_LEGACY_PTYS is not set
859CONFIG_HVC_DRIVER=y 938CONFIG_HVC_DRIVER=y
860CONFIG_HVC_RTAS=y 939CONFIG_HVC_RTAS=y
940# CONFIG_HVC_BEAT is not set
861 941
862# 942#
863# IPMI 943# IPMI
864# 944#
865# CONFIG_IPMI_HANDLER is not set 945CONFIG_IPMI_HANDLER=m
946# CONFIG_IPMI_PANIC_EVENT is not set
947CONFIG_IPMI_DEVICE_INTERFACE=m
948CONFIG_IPMI_SI=m
949CONFIG_IPMI_WATCHDOG=m
950CONFIG_IPMI_POWEROFF=m
866 951
867# 952#
868# Watchdog Cards 953# Watchdog Cards
@@ -874,7 +959,7 @@ CONFIG_WATCHDOG=y
874# Watchdog Device Drivers 959# Watchdog Device Drivers
875# 960#
876# CONFIG_SOFT_WATCHDOG is not set 961# CONFIG_SOFT_WATCHDOG is not set
877CONFIG_WATCHDOG_RTAS=y 962# CONFIG_WATCHDOG_RTAS is not set
878 963
879# 964#
880# PCI-based Watchdog Cards 965# PCI-based Watchdog Cards
@@ -929,6 +1014,7 @@ CONFIG_I2C_ALGOBIT=y
929# CONFIG_I2C_NFORCE2 is not set 1014# CONFIG_I2C_NFORCE2 is not set
930# CONFIG_I2C_OCORES is not set 1015# CONFIG_I2C_OCORES is not set
931# CONFIG_I2C_PARPORT_LIGHT is not set 1016# CONFIG_I2C_PARPORT_LIGHT is not set
1017# CONFIG_I2C_PASEMI is not set
932# CONFIG_I2C_PROSAVAGE is not set 1018# CONFIG_I2C_PROSAVAGE is not set
933# CONFIG_I2C_SAVAGE4 is not set 1019# CONFIG_I2C_SAVAGE4 is not set
934# CONFIG_I2C_SIS5595 is not set 1020# CONFIG_I2C_SIS5595 is not set
@@ -973,6 +1059,11 @@ CONFIG_I2C_ALGOBIT=y
973# CONFIG_HWMON_VID is not set 1059# CONFIG_HWMON_VID is not set
974 1060
975# 1061#
1062# Multifunction device drivers
1063#
1064# CONFIG_MFD_SM501 is not set
1065
1066#
976# Multimedia devices 1067# Multimedia devices
977# 1068#
978# CONFIG_VIDEO_DEV is not set 1069# CONFIG_VIDEO_DEV is not set
@@ -986,7 +1077,7 @@ CONFIG_I2C_ALGOBIT=y
986# 1077#
987# Graphics support 1078# Graphics support
988# 1079#
989CONFIG_FIRMWARE_EDID=y 1080# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
990# CONFIG_FB is not set 1081# CONFIG_FB is not set
991# CONFIG_FB_IBM_GXT4500 is not set 1082# CONFIG_FB_IBM_GXT4500 is not set
992 1083
@@ -995,7 +1086,6 @@ CONFIG_FIRMWARE_EDID=y
995# 1086#
996# CONFIG_VGA_CONSOLE is not set 1087# CONFIG_VGA_CONSOLE is not set
997CONFIG_DUMMY_CONSOLE=y 1088CONFIG_DUMMY_CONSOLE=y
998# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
999 1089
1000# 1090#
1001# Sound 1091# Sound
@@ -1006,6 +1096,7 @@ CONFIG_DUMMY_CONSOLE=y
1006# HID Devices 1096# HID Devices
1007# 1097#
1008CONFIG_HID=m 1098CONFIG_HID=m
1099# CONFIG_HID_DEBUG is not set
1009 1100
1010# 1101#
1011# USB support 1102# USB support
@@ -1020,9 +1111,7 @@ CONFIG_USB=m
1020# Miscellaneous USB options 1111# Miscellaneous USB options
1021# 1112#
1022CONFIG_USB_DEVICEFS=y 1113CONFIG_USB_DEVICEFS=y
1023# CONFIG_USB_BANDWIDTH is not set
1024# CONFIG_USB_DYNAMIC_MINORS is not set 1114# CONFIG_USB_DYNAMIC_MINORS is not set
1025# CONFIG_USB_MULTITHREAD_PROBE is not set
1026# CONFIG_USB_OTG is not set 1115# CONFIG_USB_OTG is not set
1027 1116
1028# 1117#
@@ -1032,9 +1121,15 @@ CONFIG_USB_EHCI_HCD=m
1032# CONFIG_USB_EHCI_SPLIT_ISO is not set 1121# CONFIG_USB_EHCI_SPLIT_ISO is not set
1033# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1122# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1034# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1123# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1124CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
1035# CONFIG_USB_ISP116X_HCD is not set 1125# CONFIG_USB_ISP116X_HCD is not set
1036CONFIG_USB_OHCI_HCD=m 1126CONFIG_USB_OHCI_HCD=m
1037# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1127CONFIG_USB_OHCI_HCD_PPC_OF=y
1128CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
1129# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
1130CONFIG_USB_OHCI_HCD_PCI=y
1131CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
1132CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
1038CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1133CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1039# CONFIG_USB_UHCI_HCD is not set 1134# CONFIG_USB_UHCI_HCD is not set
1040# CONFIG_USB_SL811_HCD is not set 1135# CONFIG_USB_SL811_HCD is not set
@@ -1088,6 +1183,7 @@ CONFIG_USB_STORAGE=m
1088# CONFIG_USB_ATI_REMOTE2 is not set 1183# CONFIG_USB_ATI_REMOTE2 is not set
1089# CONFIG_USB_KEYSPAN_REMOTE is not set 1184# CONFIG_USB_KEYSPAN_REMOTE is not set
1090# CONFIG_USB_APPLETOUCH is not set 1185# CONFIG_USB_APPLETOUCH is not set
1186# CONFIG_USB_GTCO is not set
1091 1187
1092# 1188#
1093# USB Imaging devices 1189# USB Imaging devices
@@ -1125,6 +1221,7 @@ CONFIG_USB_MON=y
1125# CONFIG_USB_RIO500 is not set 1221# CONFIG_USB_RIO500 is not set
1126# CONFIG_USB_LEGOTOWER is not set 1222# CONFIG_USB_LEGOTOWER is not set
1127# CONFIG_USB_LCD is not set 1223# CONFIG_USB_LCD is not set
1224# CONFIG_USB_BERRY_CHARGE is not set
1128# CONFIG_USB_LED is not set 1225# CONFIG_USB_LED is not set
1129# CONFIG_USB_CYPRESS_CY7C63 is not set 1226# CONFIG_USB_CYPRESS_CY7C63 is not set
1130# CONFIG_USB_CYTHERM is not set 1227# CONFIG_USB_CYTHERM is not set
@@ -1135,6 +1232,7 @@ CONFIG_USB_MON=y
1135# CONFIG_USB_SISUSBVGA is not set 1232# CONFIG_USB_SISUSBVGA is not set
1136# CONFIG_USB_LD is not set 1233# CONFIG_USB_LD is not set
1137# CONFIG_USB_TRANCEVIBRATOR is not set 1234# CONFIG_USB_TRANCEVIBRATOR is not set
1235# CONFIG_USB_IOWARRIOR is not set
1138# CONFIG_USB_TEST is not set 1236# CONFIG_USB_TEST is not set
1139 1237
1140# 1238#
@@ -1175,6 +1273,7 @@ CONFIG_INFINIBAND_MTHCA=m
1175CONFIG_INFINIBAND_MTHCA_DEBUG=y 1273CONFIG_INFINIBAND_MTHCA_DEBUG=y
1176# CONFIG_INFINIBAND_AMSO1100 is not set 1274# CONFIG_INFINIBAND_AMSO1100 is not set
1177CONFIG_INFINIBAND_IPOIB=m 1275CONFIG_INFINIBAND_IPOIB=m
1276# CONFIG_INFINIBAND_IPOIB_CM is not set
1178CONFIG_INFINIBAND_IPOIB_DEBUG=y 1277CONFIG_INFINIBAND_IPOIB_DEBUG=y
1179CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y 1278CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
1180# CONFIG_INFINIBAND_SRP is not set 1279# CONFIG_INFINIBAND_SRP is not set
@@ -1203,6 +1302,10 @@ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
1203# 1302#
1204 1303
1205# 1304#
1305# Auxiliary Display support
1306#
1307
1308#
1206# Virtualization 1309# Virtualization
1207# 1310#
1208 1311
@@ -1395,7 +1498,8 @@ CONFIG_TEXTSEARCH_KMP=m
1395CONFIG_TEXTSEARCH_BM=m 1498CONFIG_TEXTSEARCH_BM=m
1396CONFIG_TEXTSEARCH_FSM=m 1499CONFIG_TEXTSEARCH_FSM=m
1397CONFIG_PLIST=y 1500CONFIG_PLIST=y
1398CONFIG_IOMAP_COPY=y 1501CONFIG_HAS_IOMEM=y
1502CONFIG_HAS_IOPORT=y
1399 1503
1400# 1504#
1401# Instrumentation Support 1505# Instrumentation Support
@@ -1414,15 +1518,16 @@ CONFIG_MAGIC_SYSRQ=y
1414CONFIG_DEBUG_FS=y 1518CONFIG_DEBUG_FS=y
1415# CONFIG_HEADERS_CHECK is not set 1519# CONFIG_HEADERS_CHECK is not set
1416CONFIG_DEBUG_KERNEL=y 1520CONFIG_DEBUG_KERNEL=y
1521# CONFIG_DEBUG_SHIRQ is not set
1417CONFIG_LOG_BUF_SHIFT=15 1522CONFIG_LOG_BUF_SHIFT=15
1418CONFIG_DETECT_SOFTLOCKUP=y 1523# CONFIG_DETECT_SOFTLOCKUP is not set
1419# CONFIG_SCHEDSTATS is not set 1524# CONFIG_SCHEDSTATS is not set
1525# CONFIG_TIMER_STATS is not set
1420# CONFIG_DEBUG_SLAB is not set 1526# CONFIG_DEBUG_SLAB is not set
1421# CONFIG_DEBUG_RT_MUTEXES is not set 1527# CONFIG_DEBUG_RT_MUTEXES is not set
1422# CONFIG_RT_MUTEX_TESTER is not set 1528# CONFIG_RT_MUTEX_TESTER is not set
1423# CONFIG_DEBUG_SPINLOCK is not set 1529# CONFIG_DEBUG_SPINLOCK is not set
1424CONFIG_DEBUG_MUTEXES=y 1530CONFIG_DEBUG_MUTEXES=y
1425# CONFIG_DEBUG_RWSEMS is not set
1426CONFIG_DEBUG_SPINLOCK_SLEEP=y 1531CONFIG_DEBUG_SPINLOCK_SLEEP=y
1427# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1532# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1428# CONFIG_DEBUG_KOBJECT is not set 1533# CONFIG_DEBUG_KOBJECT is not set
@@ -1432,6 +1537,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1432# CONFIG_DEBUG_LIST is not set 1537# CONFIG_DEBUG_LIST is not set
1433# CONFIG_FORCED_INLINING is not set 1538# CONFIG_FORCED_INLINING is not set
1434# CONFIG_RCU_TORTURE_TEST is not set 1539# CONFIG_RCU_TORTURE_TEST is not set
1540# CONFIG_FAULT_INJECTION is not set
1435# CONFIG_DEBUG_STACKOVERFLOW is not set 1541# CONFIG_DEBUG_STACKOVERFLOW is not set
1436# CONFIG_DEBUG_STACK_USAGE is not set 1542# CONFIG_DEBUG_STACK_USAGE is not set
1437CONFIG_DEBUGGER=y 1543CONFIG_DEBUGGER=y
@@ -1469,8 +1575,10 @@ CONFIG_CRYPTO_SHA1=m
1469# CONFIG_CRYPTO_GF128MUL is not set 1575# CONFIG_CRYPTO_GF128MUL is not set
1470CONFIG_CRYPTO_ECB=m 1576CONFIG_CRYPTO_ECB=m
1471CONFIG_CRYPTO_CBC=m 1577CONFIG_CRYPTO_CBC=m
1578CONFIG_CRYPTO_PCBC=m
1472# CONFIG_CRYPTO_LRW is not set 1579# CONFIG_CRYPTO_LRW is not set
1473CONFIG_CRYPTO_DES=m 1580CONFIG_CRYPTO_DES=m
1581# CONFIG_CRYPTO_FCRYPT is not set
1474# CONFIG_CRYPTO_BLOWFISH is not set 1582# CONFIG_CRYPTO_BLOWFISH is not set
1475# CONFIG_CRYPTO_TWOFISH is not set 1583# CONFIG_CRYPTO_TWOFISH is not set
1476# CONFIG_CRYPTO_SERPENT is not set 1584# CONFIG_CRYPTO_SERPENT is not set
@@ -1484,6 +1592,7 @@ CONFIG_CRYPTO_DES=m
1484CONFIG_CRYPTO_DEFLATE=m 1592CONFIG_CRYPTO_DEFLATE=m
1485# CONFIG_CRYPTO_MICHAEL_MIC is not set 1593# CONFIG_CRYPTO_MICHAEL_MIC is not set
1486# CONFIG_CRYPTO_CRC32C is not set 1594# CONFIG_CRYPTO_CRC32C is not set
1595# CONFIG_CRYPTO_CAMELLIA is not set
1487# CONFIG_CRYPTO_TEST is not set 1596# CONFIG_CRYPTO_TEST is not set
1488 1597
1489# 1598#
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index d7d7602e348f..949092dccf44 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -465,8 +465,13 @@ void flush_thread(void)
465#ifdef CONFIG_PPC64 465#ifdef CONFIG_PPC64
466 struct thread_info *t = current_thread_info(); 466 struct thread_info *t = current_thread_info();
467 467
468 if (t->flags & _TIF_ABI_PENDING) 468 if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
469 t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); 469 clear_ti_thread_flag(t, TIF_ABI_PENDING);
470 if (test_ti_thread_flag(t, TIF_32BIT))
471 clear_ti_thread_flag(t, TIF_32BIT);
472 else
473 set_ti_thread_flag(t, TIF_32BIT);
474 }
470#endif 475#endif
471 476
472 discard_lazy_cpu_state(); 477 discard_lazy_cpu_state();
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index e738f93b42fe..a963f657222b 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -184,7 +184,7 @@ void udbg_pas_real_putc(char c)
184 184
185void udbg_init_pas_realmode(void) 185void udbg_init_pas_realmode(void)
186{ 186{
187 udbg_comport = (volatile struct NS16550 __iomem *)0xfcff03f8; 187 udbg_comport = (volatile struct NS16550 __iomem *)0xfcff03f8UL;
188 188
189 udbg_putc = udbg_pas_real_putc; 189 udbg_putc = udbg_pas_real_putc;
190 udbg_getc = NULL; 190 udbg_getc = NULL;
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index c0d2a694fa30..3c7fe2c65b5a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -685,6 +685,9 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
685 "non-cacheable mapping\n"); 685 "non-cacheable mapping\n");
686 psize = mmu_vmalloc_psize = MMU_PAGE_4K; 686 psize = mmu_vmalloc_psize = MMU_PAGE_4K;
687 } 687 }
688#ifdef CONFIG_SPE_BASE
689 spu_flush_all_slbs(mm);
690#endif
688 } 691 }
689 if (user_region) { 692 if (user_region) {
690 if (psize != get_paca()->context.user_psize) { 693 if (psize != get_paca()->context.user_psize) {
@@ -759,6 +762,9 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
759 mmu_psize_defs[MMU_PAGE_4K].sllp; 762 mmu_psize_defs[MMU_PAGE_4K].sllp;
760 get_paca()->context = mm->context; 763 get_paca()->context = mm->context;
761 slb_flush_and_rebolt(); 764 slb_flush_and_rebolt();
765#ifdef CONFIG_SPE_BASE
766 spu_flush_all_slbs(mm);
767#endif
762 } 768 }
763 } 769 }
764 if (mm->context.user_psize == MMU_PAGE_64K) 770 if (mm->context.user_psize == MMU_PAGE_64K)
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 8c77c791f87e..f6ffaaa7a5bf 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -24,6 +24,7 @@
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/cputable.h> 25#include <asm/cputable.h>
26#include <asm/tlb.h> 26#include <asm/tlb.h>
27#include <asm/spu.h>
27 28
28#include <linux/sysctl.h> 29#include <linux/sysctl.h>
29 30
@@ -513,6 +514,9 @@ int prepare_hugepage_range(unsigned long addr, unsigned long len, pgoff_t pgoff)
513 if ((addr + len) > 0x100000000UL) 514 if ((addr + len) > 0x100000000UL)
514 err = open_high_hpage_areas(current->mm, 515 err = open_high_hpage_areas(current->mm,
515 HTLB_AREA_MASK(addr, len)); 516 HTLB_AREA_MASK(addr, len));
517#ifdef CONFIG_SPE_BASE
518 spu_flush_all_slbs(current->mm);
519#endif
516 if (err) { 520 if (err) {
517 printk(KERN_DEBUG "prepare_hugepage_range(%lx, %lx)" 521 printk(KERN_DEBUG "prepare_hugepage_range(%lx, %lx)"
518 " failed (lowmask: 0x%04hx, highmask: 0x%04hx)\n", 522 " failed (lowmask: 0x%04hx, highmask: 0x%04hx)\n",
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index c75192567e55..fbfff95b4437 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -128,7 +128,7 @@ static void mpc52xx_main_mask(unsigned int virq)
128 128
129 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 129 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
130 130
131 io_be_setbit(&intr->main_mask, 15 - l2irq); 131 io_be_setbit(&intr->main_mask, 16 - l2irq);
132} 132}
133 133
134static void mpc52xx_main_unmask(unsigned int virq) 134static void mpc52xx_main_unmask(unsigned int virq)
@@ -141,7 +141,7 @@ static void mpc52xx_main_unmask(unsigned int virq)
141 141
142 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq); 142 pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
143 143
144 io_be_clrbit(&intr->main_mask, 15 - l2irq); 144 io_be_clrbit(&intr->main_mask, 16 - l2irq);
145} 145}
146 146
147static struct irq_chip mpc52xx_main_irqchip = { 147static struct irq_chip mpc52xx_main_irqchip = {
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index e5d819166874..8aa9a93e2aa2 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -55,9 +55,9 @@ static int mpc834x_usb_cfg(void)
55 struct device_node *np = NULL; 55 struct device_node *np = NULL;
56 int port0_is_dr = 0; 56 int port0_is_dr = 0;
57 57
58 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL) 58 if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr")) != NULL)
59 port0_is_dr = 1; 59 port0_is_dr = 1;
60 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){ 60 if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-mph")) != NULL){
61 if (port0_is_dr) { 61 if (port0_is_dr) {
62 printk(KERN_WARNING 62 printk(KERN_WARNING
63 "There is only one USB port on PB board! \n"); 63 "There is only one USB port on PB board! \n");
@@ -103,8 +103,8 @@ static int mpc834x_usb_cfg(void)
103 return -1; 103 return -1;
104 104
105 /* 105 /*
106 * if MDS board is plug into PIB board, 106 * if Processor Board is plugged into PIB board,
107 * force to use the PHY on MDS board 107 * force to use the PHY on Processor Board
108 */ 108 */
109 bcsr5 = in_8(bcsr_regs + 5); 109 bcsr5 = in_8(bcsr_regs + 5);
110 if (!(bcsr5 & BCSR5_INT_USB)) 110 if (!(bcsr5 & BCSR5_INT_USB))
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 124e2c595972..329fcd48669a 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -53,6 +53,7 @@ config MPC85xx
53 bool 53 bool
54 select PPC_UDBG_16550 54 select PPC_UDBG_16550
55 select PPC_INDIRECT_PCI 55 select PPC_INDIRECT_PCI
56 select SERIAL_8250_SHARE_IRQ if SERIAL_8250
56 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \ 57 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \
57 || MPC85xx_MDS || MPC8544_DS 58 || MPC85xx_MDS || MPC8544_DS
58 59
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index c43999a10deb..eba7a2641dce 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -38,8 +38,61 @@
38const struct spu_management_ops *spu_management_ops; 38const struct spu_management_ops *spu_management_ops;
39const struct spu_priv1_ops *spu_priv1_ops; 39const struct spu_priv1_ops *spu_priv1_ops;
40 40
41static struct list_head spu_list[MAX_NUMNODES];
42static LIST_HEAD(spu_full_list);
43static DEFINE_MUTEX(spu_mutex);
44static spinlock_t spu_list_lock = SPIN_LOCK_UNLOCKED;
45
41EXPORT_SYMBOL_GPL(spu_priv1_ops); 46EXPORT_SYMBOL_GPL(spu_priv1_ops);
42 47
48void spu_invalidate_slbs(struct spu *spu)
49{
50 struct spu_priv2 __iomem *priv2 = spu->priv2;
51
52 if (spu_mfc_sr1_get(spu) & MFC_STATE1_RELOCATE_MASK)
53 out_be64(&priv2->slb_invalidate_all_W, 0UL);
54}
55EXPORT_SYMBOL_GPL(spu_invalidate_slbs);
56
57/* This is called by the MM core when a segment size is changed, to
58 * request a flush of all the SPEs using a given mm
59 */
60void spu_flush_all_slbs(struct mm_struct *mm)
61{
62 struct spu *spu;
63 unsigned long flags;
64
65 spin_lock_irqsave(&spu_list_lock, flags);
66 list_for_each_entry(spu, &spu_full_list, full_list) {
67 if (spu->mm == mm)
68 spu_invalidate_slbs(spu);
69 }
70 spin_unlock_irqrestore(&spu_list_lock, flags);
71}
72
73/* The hack below stinks... try to do something better one of
74 * these days... Does it even work properly with NR_CPUS == 1 ?
75 */
76static inline void mm_needs_global_tlbie(struct mm_struct *mm)
77{
78 int nr = (NR_CPUS > 1) ? NR_CPUS : NR_CPUS + 1;
79
80 /* Global TLBIE broadcast required with SPEs. */
81 __cpus_setall(&mm->cpu_vm_mask, nr);
82}
83
84void spu_associate_mm(struct spu *spu, struct mm_struct *mm)
85{
86 unsigned long flags;
87
88 spin_lock_irqsave(&spu_list_lock, flags);
89 spu->mm = mm;
90 spin_unlock_irqrestore(&spu_list_lock, flags);
91 if (mm)
92 mm_needs_global_tlbie(mm);
93}
94EXPORT_SYMBOL_GPL(spu_associate_mm);
95
43static int __spu_trap_invalid_dma(struct spu *spu) 96static int __spu_trap_invalid_dma(struct spu *spu)
44{ 97{
45 pr_debug("%s\n", __FUNCTION__); 98 pr_debug("%s\n", __FUNCTION__);
@@ -74,6 +127,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
74 struct spu_priv2 __iomem *priv2 = spu->priv2; 127 struct spu_priv2 __iomem *priv2 = spu->priv2;
75 struct mm_struct *mm = spu->mm; 128 struct mm_struct *mm = spu->mm;
76 u64 esid, vsid, llp; 129 u64 esid, vsid, llp;
130 int psize;
77 131
78 pr_debug("%s\n", __FUNCTION__); 132 pr_debug("%s\n", __FUNCTION__);
79 133
@@ -90,22 +144,25 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
90 case USER_REGION_ID: 144 case USER_REGION_ID:
91#ifdef CONFIG_HUGETLB_PAGE 145#ifdef CONFIG_HUGETLB_PAGE
92 if (in_hugepage_area(mm->context, ea)) 146 if (in_hugepage_area(mm->context, ea))
93 llp = mmu_psize_defs[mmu_huge_psize].sllp; 147 psize = mmu_huge_psize;
94 else 148 else
95#endif 149#endif
96 llp = mmu_psize_defs[mmu_virtual_psize].sllp; 150 psize = mm->context.user_psize;
97 vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) | 151 vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) |
98 SLB_VSID_USER | llp; 152 SLB_VSID_USER;
99 break; 153 break;
100 case VMALLOC_REGION_ID: 154 case VMALLOC_REGION_ID:
101 llp = mmu_psize_defs[mmu_virtual_psize].sllp; 155 if (ea < VMALLOC_END)
156 psize = mmu_vmalloc_psize;
157 else
158 psize = mmu_io_psize;
102 vsid = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | 159 vsid = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) |
103 SLB_VSID_KERNEL | llp; 160 SLB_VSID_KERNEL;
104 break; 161 break;
105 case KERNEL_REGION_ID: 162 case KERNEL_REGION_ID:
106 llp = mmu_psize_defs[mmu_linear_psize].sllp; 163 psize = mmu_linear_psize;
107 vsid = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | 164 vsid = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) |
108 SLB_VSID_KERNEL | llp; 165 SLB_VSID_KERNEL;
109 break; 166 break;
110 default: 167 default:
111 /* Future: support kernel segments so that drivers 168 /* Future: support kernel segments so that drivers
@@ -114,9 +171,10 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
114 pr_debug("invalid region access at %016lx\n", ea); 171 pr_debug("invalid region access at %016lx\n", ea);
115 return 1; 172 return 1;
116 } 173 }
174 llp = mmu_psize_defs[psize].sllp;
117 175
118 out_be64(&priv2->slb_index_W, spu->slb_replace); 176 out_be64(&priv2->slb_index_W, spu->slb_replace);
119 out_be64(&priv2->slb_vsid_RW, vsid); 177 out_be64(&priv2->slb_vsid_RW, vsid | llp);
120 out_be64(&priv2->slb_esid_RW, esid); 178 out_be64(&priv2->slb_esid_RW, esid);
121 179
122 spu->slb_replace++; 180 spu->slb_replace++;
@@ -330,10 +388,6 @@ static void spu_free_irqs(struct spu *spu)
330 free_irq(spu->irqs[2], spu); 388 free_irq(spu->irqs[2], spu);
331} 389}
332 390
333static struct list_head spu_list[MAX_NUMNODES];
334static LIST_HEAD(spu_full_list);
335static DEFINE_MUTEX(spu_mutex);
336
337static void spu_init_channels(struct spu *spu) 391static void spu_init_channels(struct spu *spu)
338{ 392{
339 static const struct { 393 static const struct {
@@ -593,6 +647,7 @@ static int __init create_spu(void *data)
593 struct spu *spu; 647 struct spu *spu;
594 int ret; 648 int ret;
595 static int number; 649 static int number;
650 unsigned long flags;
596 651
597 ret = -ENOMEM; 652 ret = -ENOMEM;
598 spu = kzalloc(sizeof (*spu), GFP_KERNEL); 653 spu = kzalloc(sizeof (*spu), GFP_KERNEL);
@@ -620,8 +675,10 @@ static int __init create_spu(void *data)
620 goto out_free_irqs; 675 goto out_free_irqs;
621 676
622 mutex_lock(&spu_mutex); 677 mutex_lock(&spu_mutex);
678 spin_lock_irqsave(&spu_list_lock, flags);
623 list_add(&spu->list, &spu_list[spu->node]); 679 list_add(&spu->list, &spu_list[spu->node]);
624 list_add(&spu->full_list, &spu_full_list); 680 list_add(&spu->full_list, &spu_full_list);
681 spin_unlock_irqrestore(&spu_list_lock, flags);
625 mutex_unlock(&spu_mutex); 682 mutex_unlock(&spu_mutex);
626 683
627 goto out; 684 goto out;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index b00653d69c01..505266a568d4 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -63,8 +63,8 @@ static ssize_t
63spufs_mem_read(struct file *file, char __user *buffer, 63spufs_mem_read(struct file *file, char __user *buffer,
64 size_t size, loff_t *pos) 64 size_t size, loff_t *pos)
65{ 65{
66 int ret;
67 struct spu_context *ctx = file->private_data; 66 struct spu_context *ctx = file->private_data;
67 ssize_t ret;
68 68
69 spu_acquire(ctx); 69 spu_acquire(ctx);
70 ret = __spufs_mem_read(ctx, buffer, size, pos); 70 ret = __spufs_mem_read(ctx, buffer, size, pos);
@@ -74,25 +74,29 @@ spufs_mem_read(struct file *file, char __user *buffer,
74 74
75static ssize_t 75static ssize_t
76spufs_mem_write(struct file *file, const char __user *buffer, 76spufs_mem_write(struct file *file, const char __user *buffer,
77 size_t size, loff_t *pos) 77 size_t size, loff_t *ppos)
78{ 78{
79 struct spu_context *ctx = file->private_data; 79 struct spu_context *ctx = file->private_data;
80 char *local_store; 80 char *local_store;
81 loff_t pos = *ppos;
81 int ret; 82 int ret;
82 83
83 size = min_t(ssize_t, LS_SIZE - *pos, size); 84 if (pos < 0)
84 if (size <= 0) 85 return -EINVAL;
86 if (pos > LS_SIZE)
85 return -EFBIG; 87 return -EFBIG;
86 *pos += size; 88 if (size > LS_SIZE - pos)
89 size = LS_SIZE - pos;
87 90
88 spu_acquire(ctx); 91 spu_acquire(ctx);
89
90 local_store = ctx->ops->get_ls(ctx); 92 local_store = ctx->ops->get_ls(ctx);
91 ret = copy_from_user(local_store + *pos - size, 93 ret = copy_from_user(local_store + pos, buffer, size);
92 buffer, size) ? -EFAULT : size;
93
94 spu_release(ctx); 94 spu_release(ctx);
95 return ret; 95
96 if (ret)
97 return -EFAULT;
98 *ppos = pos + size;
99 return size;
96} 100}
97 101
98static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma, 102static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma,
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index 353a8fa07ab8..f95a611ca362 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -143,7 +143,7 @@ static inline int spu_run_init(struct spu_context *ctx, u32 * npc)
143 int ret; 143 int ret;
144 unsigned long runcntl = SPU_RUNCNTL_RUNNABLE; 144 unsigned long runcntl = SPU_RUNCNTL_RUNNABLE;
145 145
146 ret = spu_acquire_runnable(ctx, SPU_ACTIVATE_NOWAKE); 146 ret = spu_acquire_runnable(ctx, 0);
147 if (ret) 147 if (ret)
148 return ret; 148 return ret;
149 149
@@ -155,7 +155,7 @@ static inline int spu_run_init(struct spu_context *ctx, u32 * npc)
155 spu_release(ctx); 155 spu_release(ctx);
156 ret = spu_setup_isolated(ctx); 156 ret = spu_setup_isolated(ctx);
157 if (!ret) 157 if (!ret)
158 ret = spu_acquire_runnable(ctx, SPU_ACTIVATE_NOWAKE); 158 ret = spu_acquire_runnable(ctx, 0);
159 } 159 }
160 160
161 /* if userspace has set the runcntrl register (eg, to issue an 161 /* if userspace has set the runcntrl register (eg, to issue an
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2f25e68b4bac..39823cec0844 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -127,14 +127,6 @@ static void spu_remove_from_active_list(struct spu *spu)
127 mutex_unlock(&spu_prio->active_mutex[node]); 127 mutex_unlock(&spu_prio->active_mutex[node]);
128} 128}
129 129
130static inline void mm_needs_global_tlbie(struct mm_struct *mm)
131{
132 int nr = (NR_CPUS > 1) ? NR_CPUS : NR_CPUS + 1;
133
134 /* Global TLBIE broadcast required with SPEs. */
135 __cpus_setall(&mm->cpu_vm_mask, nr);
136}
137
138static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); 130static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
139 131
140static void spu_switch_notify(struct spu *spu, struct spu_context *ctx) 132static void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
@@ -167,8 +159,7 @@ static void spu_bind_context(struct spu *spu, struct spu_context *ctx)
167 ctx->spu = spu; 159 ctx->spu = spu;
168 ctx->ops = &spu_hw_ops; 160 ctx->ops = &spu_hw_ops;
169 spu->pid = current->pid; 161 spu->pid = current->pid;
170 spu->mm = ctx->owner; 162 spu_associate_mm(spu, ctx->owner);
171 mm_needs_global_tlbie(spu->mm);
172 spu->ibox_callback = spufs_ibox_callback; 163 spu->ibox_callback = spufs_ibox_callback;
173 spu->wbox_callback = spufs_wbox_callback; 164 spu->wbox_callback = spufs_wbox_callback;
174 spu->stop_callback = spufs_stop_callback; 165 spu->stop_callback = spufs_stop_callback;
@@ -205,7 +196,7 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
205 spu->stop_callback = NULL; 196 spu->stop_callback = NULL;
206 spu->mfc_callback = NULL; 197 spu->mfc_callback = NULL;
207 spu->dma_callback = NULL; 198 spu->dma_callback = NULL;
208 spu->mm = NULL; 199 spu_associate_mm(spu, NULL);
209 spu->pid = 0; 200 spu->pid = 0;
210 ctx->ops = &spu_backing_ops; 201 ctx->ops = &spu_backing_ops;
211 ctx->spu = NULL; 202 ctx->spu = NULL;
@@ -263,7 +254,6 @@ static void spu_prio_wait(struct spu_context *ctx)
263{ 254{
264 DEFINE_WAIT(wait); 255 DEFINE_WAIT(wait);
265 256
266 set_bit(SPU_SCHED_WAKE, &ctx->sched_flags);
267 prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE); 257 prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE);
268 if (!signal_pending(current)) { 258 if (!signal_pending(current)) {
269 mutex_unlock(&ctx->state_mutex); 259 mutex_unlock(&ctx->state_mutex);
@@ -272,7 +262,6 @@ static void spu_prio_wait(struct spu_context *ctx)
272 } 262 }
273 __set_current_state(TASK_RUNNING); 263 __set_current_state(TASK_RUNNING);
274 remove_wait_queue(&ctx->stop_wq, &wait); 264 remove_wait_queue(&ctx->stop_wq, &wait);
275 clear_bit(SPU_SCHED_WAKE, &ctx->sched_flags);
276} 265}
277 266
278/** 267/**
@@ -292,7 +281,7 @@ static void spu_reschedule(struct spu *spu)
292 best = sched_find_first_bit(spu_prio->bitmap); 281 best = sched_find_first_bit(spu_prio->bitmap);
293 if (best < MAX_PRIO) { 282 if (best < MAX_PRIO) {
294 struct spu_context *ctx = spu_grab_context(best); 283 struct spu_context *ctx = spu_grab_context(best);
295 if (ctx && test_bit(SPU_SCHED_WAKE, &ctx->sched_flags)) 284 if (ctx)
296 wake_up(&ctx->stop_wq); 285 wake_up(&ctx->stop_wq);
297 } 286 }
298 spin_unlock(&spu_prio->runq_lock); 287 spin_unlock(&spu_prio->runq_lock);
@@ -414,8 +403,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
414 } 403 }
415 404
416 spu_add_to_rq(ctx); 405 spu_add_to_rq(ctx);
417 if (!(flags & SPU_ACTIVATE_NOWAKE)) 406 spu_prio_wait(ctx);
418 spu_prio_wait(ctx);
419 spu_del_from_rq(ctx); 407 spu_del_from_rq(ctx);
420 } while (!signal_pending(current)); 408 } while (!signal_pending(current));
421 409
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 0c437891dfd5..5c4e47d69d79 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -41,7 +41,7 @@ struct spu_gang;
41 41
42/* ctx->sched_flags */ 42/* ctx->sched_flags */
43enum { 43enum {
44 SPU_SCHED_WAKE = 0, 44 SPU_SCHED_WAKE = 0, /* currently unused */
45}; 45};
46 46
47struct spu_context { 47struct spu_context {
@@ -191,9 +191,7 @@ void spu_forget(struct spu_context *ctx);
191int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); 191int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags);
192void spu_acquire_saved(struct spu_context *ctx); 192void spu_acquire_saved(struct spu_context *ctx);
193int spu_acquire_exclusive(struct spu_context *ctx); 193int spu_acquire_exclusive(struct spu_context *ctx);
194enum { 194
195 SPU_ACTIVATE_NOWAKE = 1,
196};
197int spu_activate(struct spu_context *ctx, unsigned long flags); 195int spu_activate(struct spu_context *ctx, unsigned long flags);
198void spu_deactivate(struct spu_context *ctx); 196void spu_deactivate(struct spu_context *ctx);
199void spu_yield(struct spu_context *ctx); 197void spu_yield(struct spu_context *ctx);
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index c08981ff7fc6..fd91c73de34e 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -468,26 +468,6 @@ static inline void wait_purge_complete(struct spu_state *csa, struct spu *spu)
468 MFC_CNTL_PURGE_DMA_COMPLETE); 468 MFC_CNTL_PURGE_DMA_COMPLETE);
469} 469}
470 470
471static inline void save_mfc_slbs(struct spu_state *csa, struct spu *spu)
472{
473 struct spu_priv2 __iomem *priv2 = spu->priv2;
474 int i;
475
476 /* Save, Step 29:
477 * If MFC_SR1[R]='1', save SLBs in CSA.
478 */
479 if (spu_mfc_sr1_get(spu) & MFC_STATE1_RELOCATE_MASK) {
480 csa->priv2.slb_index_W = in_be64(&priv2->slb_index_W);
481 for (i = 0; i < 8; i++) {
482 out_be64(&priv2->slb_index_W, i);
483 eieio();
484 csa->slb_esid_RW[i] = in_be64(&priv2->slb_esid_RW);
485 csa->slb_vsid_RW[i] = in_be64(&priv2->slb_vsid_RW);
486 eieio();
487 }
488 }
489}
490
491static inline void setup_mfc_sr1(struct spu_state *csa, struct spu *spu) 471static inline void setup_mfc_sr1(struct spu_state *csa, struct spu *spu)
492{ 472{
493 /* Save, Step 30: 473 /* Save, Step 30:
@@ -708,20 +688,6 @@ static inline void resume_mfc_queue(struct spu_state *csa, struct spu *spu)
708 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE); 688 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE);
709} 689}
710 690
711static inline void invalidate_slbs(struct spu_state *csa, struct spu *spu)
712{
713 struct spu_priv2 __iomem *priv2 = spu->priv2;
714
715 /* Save, Step 45:
716 * Restore, Step 19:
717 * If MFC_SR1[R]=1, write 0 to SLB_Invalidate_All.
718 */
719 if (spu_mfc_sr1_get(spu) & MFC_STATE1_RELOCATE_MASK) {
720 out_be64(&priv2->slb_invalidate_all_W, 0UL);
721 eieio();
722 }
723}
724
725static inline void get_kernel_slb(u64 ea, u64 slb[2]) 691static inline void get_kernel_slb(u64 ea, u64 slb[2])
726{ 692{
727 u64 llp; 693 u64 llp;
@@ -765,7 +731,7 @@ static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
765 * MFC_SR1[R]=1 (in other words, assume that 731 * MFC_SR1[R]=1 (in other words, assume that
766 * translation is desired by OS environment). 732 * translation is desired by OS environment).
767 */ 733 */
768 invalidate_slbs(csa, spu); 734 spu_invalidate_slbs(spu);
769 get_kernel_slb((unsigned long)&spu_save_code[0], code_slb); 735 get_kernel_slb((unsigned long)&spu_save_code[0], code_slb);
770 get_kernel_slb((unsigned long)csa->lscsa, lscsa_slb); 736 get_kernel_slb((unsigned long)csa->lscsa, lscsa_slb);
771 load_mfc_slb(spu, code_slb, 0); 737 load_mfc_slb(spu, code_slb, 0);
@@ -1718,27 +1684,6 @@ static inline void check_ppuint_mb_stat(struct spu_state *csa, struct spu *spu)
1718 } 1684 }
1719} 1685}
1720 1686
1721static inline void restore_mfc_slbs(struct spu_state *csa, struct spu *spu)
1722{
1723 struct spu_priv2 __iomem *priv2 = spu->priv2;
1724 int i;
1725
1726 /* Restore, Step 68:
1727 * If MFC_SR1[R]='1', restore SLBs from CSA.
1728 */
1729 if (csa->priv1.mfc_sr1_RW & MFC_STATE1_RELOCATE_MASK) {
1730 for (i = 0; i < 8; i++) {
1731 out_be64(&priv2->slb_index_W, i);
1732 eieio();
1733 out_be64(&priv2->slb_esid_RW, csa->slb_esid_RW[i]);
1734 out_be64(&priv2->slb_vsid_RW, csa->slb_vsid_RW[i]);
1735 eieio();
1736 }
1737 out_be64(&priv2->slb_index_W, csa->priv2.slb_index_W);
1738 eieio();
1739 }
1740}
1741
1742static inline void restore_mfc_sr1(struct spu_state *csa, struct spu *spu) 1687static inline void restore_mfc_sr1(struct spu_state *csa, struct spu *spu)
1743{ 1688{
1744 /* Restore, Step 69: 1689 /* Restore, Step 69:
@@ -1875,7 +1820,6 @@ static void save_csa(struct spu_state *prev, struct spu *spu)
1875 set_mfc_tclass_id(prev, spu); /* Step 26. */ 1820 set_mfc_tclass_id(prev, spu); /* Step 26. */
1876 purge_mfc_queue(prev, spu); /* Step 27. */ 1821 purge_mfc_queue(prev, spu); /* Step 27. */
1877 wait_purge_complete(prev, spu); /* Step 28. */ 1822 wait_purge_complete(prev, spu); /* Step 28. */
1878 save_mfc_slbs(prev, spu); /* Step 29. */
1879 setup_mfc_sr1(prev, spu); /* Step 30. */ 1823 setup_mfc_sr1(prev, spu); /* Step 30. */
1880 save_spu_npc(prev, spu); /* Step 31. */ 1824 save_spu_npc(prev, spu); /* Step 31. */
1881 save_spu_privcntl(prev, spu); /* Step 32. */ 1825 save_spu_privcntl(prev, spu); /* Step 32. */
@@ -1987,7 +1931,7 @@ static void harvest(struct spu_state *prev, struct spu *spu)
1987 reset_spu_privcntl(prev, spu); /* Step 16. */ 1931 reset_spu_privcntl(prev, spu); /* Step 16. */
1988 reset_spu_lslr(prev, spu); /* Step 17. */ 1932 reset_spu_lslr(prev, spu); /* Step 17. */
1989 setup_mfc_sr1(prev, spu); /* Step 18. */ 1933 setup_mfc_sr1(prev, spu); /* Step 18. */
1990 invalidate_slbs(prev, spu); /* Step 19. */ 1934 spu_invalidate_slbs(spu); /* Step 19. */
1991 reset_ch_part1(prev, spu); /* Step 20. */ 1935 reset_ch_part1(prev, spu); /* Step 20. */
1992 reset_ch_part2(prev, spu); /* Step 21. */ 1936 reset_ch_part2(prev, spu); /* Step 21. */
1993 enable_interrupts(prev, spu); /* Step 22. */ 1937 enable_interrupts(prev, spu); /* Step 22. */
@@ -2055,7 +1999,7 @@ static void restore_csa(struct spu_state *next, struct spu *spu)
2055 restore_spu_mb(next, spu); /* Step 65. */ 1999 restore_spu_mb(next, spu); /* Step 65. */
2056 check_ppu_mb_stat(next, spu); /* Step 66. */ 2000 check_ppu_mb_stat(next, spu); /* Step 66. */
2057 check_ppuint_mb_stat(next, spu); /* Step 67. */ 2001 check_ppuint_mb_stat(next, spu); /* Step 67. */
2058 restore_mfc_slbs(next, spu); /* Step 68. */ 2002 spu_invalidate_slbs(spu); /* Modified Step 68. */
2059 restore_mfc_sr1(next, spu); /* Step 69. */ 2003 restore_mfc_sr1(next, spu); /* Step 69. */
2060 restore_other_spu_access(next, spu); /* Step 70. */ 2004 restore_other_spu_access(next, spu); /* Step 70. */
2061 restore_spu_runcntl(next, spu); /* Step 71. */ 2005 restore_spu_runcntl(next, spu); /* Step 71. */
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 4587c1dfeda5..07819cd3ac44 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -77,7 +77,7 @@
77#define IOBMAP_L2E_V 0x80000000 77#define IOBMAP_L2E_V 0x80000000
78#define IOBMAP_L2E_V_CACHED 0xc0000000 78#define IOBMAP_L2E_V_CACHED 0xc0000000
79 79
80static u32 *iob; 80static u32 __iomem *iob;
81static u32 iob_l1_emptyval; 81static u32 iob_l1_emptyval;
82static u32 iob_l2_emptyval; 82static u32 iob_l2_emptyval;
83static u32 *iob_l2_base; 83static u32 *iob_l2_base;
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 5c7e38789897..c1427b3634ec 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -30,9 +30,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_PURR);
30 30
31/* 31/*
32 * postcall is performed immediately before function return which 32 * postcall is performed immediately before function return which
33 * allows liberal use of volatile registers. 33 * allows liberal use of volatile registers. We branch around this
34 * in early init (eg when populating the MMU hashtable) by using an
35 * unconditional cpu feature.
34 */ 36 */
35#define HCALL_INST_POSTCALL \ 37#define HCALL_INST_POSTCALL \
38BEGIN_FTR_SECTION; \
39 b 1f; \
40END_FTR_SECTION(0, 1); \
36 ld r4,STK_PARM(r3)(r1); /* validate opcode */ \ 41 ld r4,STK_PARM(r3)(r1); /* validate opcode */ \
37 cmpldi cr7,r4,MAX_HCALL_OPCODE; \ 42 cmpldi cr7,r4,MAX_HCALL_OPCODE; \
38 bgt- cr7,1f; \ 43 bgt- cr7,1f; \
@@ -123,6 +128,40 @@ _GLOBAL(plpar_hcall)
123 128
124 blr /* return r3 = status */ 129 blr /* return r3 = status */
125 130
131/*
132 * plpar_hcall_raw can be called in real mode. kexec/kdump need some
133 * hypervisor calls to be executed in real mode. So plpar_hcall_raw
134 * does not access the per cpu hypervisor call statistics variables,
135 * since these variables may not be present in the RMO region.
136 */
137_GLOBAL(plpar_hcall_raw)
138 HMT_MEDIUM
139
140 mfcr r0
141 stw r0,8(r1)
142
143 std r4,STK_PARM(r4)(r1) /* Save ret buffer */
144
145 mr r4,r5
146 mr r5,r6
147 mr r6,r7
148 mr r7,r8
149 mr r8,r9
150 mr r9,r10
151
152 HVSC /* invoke the hypervisor */
153
154 ld r12,STK_PARM(r4)(r1)
155 std r4, 0(r12)
156 std r5, 8(r12)
157 std r6, 16(r12)
158 std r7, 24(r12)
159
160 lwz r0,8(r1)
161 mtcrf 0xff,r0
162
163 blr /* return r3 = status */
164
126_GLOBAL(plpar_hcall9) 165_GLOBAL(plpar_hcall9)
127 HMT_MEDIUM 166 HMT_MEDIUM
128 167
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 7496005566ef..843ee9643211 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -378,7 +378,7 @@ static void pSeries_lpar_hptab_clear(void)
378 378
379 /* TODO: Use bulk call */ 379 /* TODO: Use bulk call */
380 for (i = 0; i < hpte_count; i++) 380 for (i = 0; i < hpte_count; i++)
381 plpar_pte_remove(0, i, 0, &dummy1, &dummy2); 381 plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2);
382} 382}
383 383
384/* 384/*
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 3eb7b294d92f..2e4d10c9eea8 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -78,6 +78,22 @@ static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
78 return rc; 78 return rc;
79} 79}
80 80
81/* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */
82static inline long plpar_pte_remove_raw(unsigned long flags, unsigned long ptex,
83 unsigned long avpn, unsigned long *old_pteh_ret,
84 unsigned long *old_ptel_ret)
85{
86 long rc;
87 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
88
89 rc = plpar_hcall_raw(H_REMOVE, retbuf, flags, ptex, avpn);
90
91 *old_pteh_ret = retbuf[0];
92 *old_ptel_ret = retbuf[1];
93
94 return rc;
95}
96
81static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, 97static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
82 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) 98 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
83{ 99{
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index dffeeaeca1d9..1fc5819e7d18 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -129,7 +129,7 @@ void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c)
129 129
130 if (h.token == NULL) 130 if (h.token == NULL)
131 return; 131 return;
132 h.token -= dcr_n * h.stride; 132 h.token += dcr_n * h.stride;
133 iounmap(h.token); 133 iounmap(h.token);
134 h.token = NULL; 134 h.token = NULL;
135} 135}
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index e3d71e083f35..43f6cc9d7ea0 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -251,13 +251,13 @@ static int qe_sdma_init(void)
251 251
252 /* allocate 2 internal temporary buffers (512 bytes size each) for 252 /* allocate 2 internal temporary buffers (512 bytes size each) for
253 * the SDMA */ 253 * the SDMA */
254 sdma_buf_offset = qe_muram_alloc(512 * 2, 64); 254 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
255 if (IS_MURAM_ERR(sdma_buf_offset)) 255 if (IS_MURAM_ERR(sdma_buf_offset))
256 return -ENOMEM; 256 return -ENOMEM;
257 257
258 out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK); 258 out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK);
259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | (0x1 >> 259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
260 QE_SDMR_CEN_SHIFT))); 260 (0x1 << QE_SDMR_CEN_SHIFT)));
261 261
262 return 0; 262 return 0;
263} 263}
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 4ca615788702..697eb30a68a3 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -117,7 +117,10 @@ static void appldata_get_mem_data(void *data)
117 mem_data->pgpgout = ev[PGPGOUT] >> 1; 117 mem_data->pgpgout = ev[PGPGOUT] >> 1;
118 mem_data->pswpin = ev[PSWPIN]; 118 mem_data->pswpin = ev[PSWPIN];
119 mem_data->pswpout = ev[PSWPOUT]; 119 mem_data->pswpout = ev[PSWPOUT];
120 mem_data->pgalloc = ev[PGALLOC_NORMAL] + ev[PGALLOC_DMA]; 120 mem_data->pgalloc = ev[PGALLOC_NORMAL];
121#ifdef CONFIG_ZONE_DMA
122 mem_data->pgalloc += ev[PGALLOC_DMA];
123#endif
121 mem_data->pgfault = ev[PGFAULT]; 124 mem_data->pgfault = ev[PGFAULT];
122 mem_data->pgmajfault = ev[PGMAJFAULT]; 125 mem_data->pgmajfault = ev[PGMAJFAULT];
123 126
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 97901296894e..32a69a18a796 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1665,3 +1665,20 @@ sys_getcpu_wrapper:
1665 llgtr %r3,%r3 # unsigned * 1665 llgtr %r3,%r3 # unsigned *
1666 llgtr %r4,%r4 # struct getcpu_cache * 1666 llgtr %r4,%r4 # struct getcpu_cache *
1667 jg sys_getcpu 1667 jg sys_getcpu
1668
1669 .globl compat_sys_epoll_pwait_wrapper
1670compat_sys_epoll_pwait_wrapper:
1671 lgfr %r2,%r2 # int
1672 llgtr %r3,%r3 # struct compat_epoll_event *
1673 lgfr %r4,%r4 # int
1674 lgfr %r5,%r5 # int
1675 llgtr %r6,%r6 # compat_sigset_t *
1676 llgf %r0,164(%r15) # compat_size_t
1677 stg %r0,160(%r15)
1678 jg compat_sys_epoll_pwait
1679
1680 .globl compat_sys_utimes_wrapper
1681compat_sys_utimes_wrapper:
1682 llgtr %r2,%r2 # char *
1683 llgtr %r3,%r3 # struct compat_timeval *
1684 jg compat_sys_utimes
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index eca3fe595ff4..dca6eaf82c80 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -268,7 +268,7 @@ debug_info_alloc(char *name, int pages_per_area, int nr_areas, int buf_size,
268 rc->level = level; 268 rc->level = level;
269 rc->buf_size = buf_size; 269 rc->buf_size = buf_size;
270 rc->entry_size = sizeof(debug_entry_t) + buf_size; 270 rc->entry_size = sizeof(debug_entry_t) + buf_size;
271 strlcpy(rc->name, name, sizeof(rc->name)-1); 271 strlcpy(rc->name, name, sizeof(rc->name));
272 memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *)); 272 memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *));
273 memset(rc->debugfs_entries, 0 ,DEBUG_MAX_VIEWS * 273 memset(rc->debugfs_entries, 0 ,DEBUG_MAX_VIEWS *
274 sizeof(struct dentry*)); 274 sizeof(struct dentry*));
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index afca1c6f4d21..5e47936573f2 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -141,9 +141,9 @@ static noinline __init void detect_machine_type(void)
141 machine_flags |= 4; 141 machine_flags |= 4;
142} 142}
143 143
144#ifdef CONFIG_64BIT
144static noinline __init int memory_fast_detect(void) 145static noinline __init int memory_fast_detect(void)
145{ 146{
146
147 unsigned long val0 = 0; 147 unsigned long val0 = 0;
148 unsigned long val1 = 0xc; 148 unsigned long val1 = 0xc;
149 int ret = -ENOSYS; 149 int ret = -ENOSYS;
@@ -161,9 +161,15 @@ static noinline __init int memory_fast_detect(void)
161 if (ret || val0 != val1) 161 if (ret || val0 != val1)
162 return -ENOSYS; 162 return -ENOSYS;
163 163
164 memory_chunk[0].size = val0; 164 memory_chunk[0].size = val0 + 1;
165 return 0; 165 return 0;
166} 166}
167#else
168static inline int memory_fast_detect(void)
169{
170 return -ENOSYS;
171}
172#endif
167 173
168#define ADDR2G (1UL << 31) 174#define ADDR2G (1UL << 31)
169 175
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index d125a4ead08d..f731185bf2bd 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -839,7 +839,7 @@ static int __init reipl_ccw_init(void)
839 } 839 }
840 reipl_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN; 840 reipl_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN;
841 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; 841 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
842 reipl_block_ccw->hdr.blk0_len = sizeof(reipl_block_ccw->ipl_info.ccw); 842 reipl_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN;
843 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; 843 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
844 /* check if read scp info worked and set loadparm */ 844 /* check if read scp info worked and set loadparm */
845 if (SCCB_VALID) 845 if (SCCB_VALID)
@@ -880,8 +880,7 @@ static int __init reipl_fcp_init(void)
880 } else { 880 } else {
881 reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; 881 reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
882 reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; 882 reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
883 reipl_block_fcp->hdr.blk0_len = 883 reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN;
884 sizeof(reipl_block_fcp->ipl_info.fcp);
885 reipl_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP; 884 reipl_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP;
886 reipl_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_IPL; 885 reipl_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_IPL;
887 } 886 }
@@ -930,7 +929,7 @@ static int __init dump_ccw_init(void)
930 } 929 }
931 dump_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN; 930 dump_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN;
932 dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; 931 dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
933 dump_block_ccw->hdr.blk0_len = sizeof(reipl_block_ccw->ipl_info.ccw); 932 dump_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN;
934 dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; 933 dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
935 dump_capabilities |= IPL_TYPE_CCW; 934 dump_capabilities |= IPL_TYPE_CCW;
936 return 0; 935 return 0;
@@ -954,7 +953,7 @@ static int __init dump_fcp_init(void)
954 } 953 }
955 dump_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; 954 dump_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
956 dump_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; 955 dump_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
957 dump_block_fcp->hdr.blk0_len = sizeof(dump_block_fcp->ipl_info.fcp); 956 dump_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN;
958 dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP; 957 dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP;
959 dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP; 958 dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP;
960 dump_capabilities |= IPL_TYPE_FCP; 959 dump_capabilities |= IPL_TYPE_FCP;
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 8af549e95730..993f35381496 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -167,7 +167,7 @@ static int __kprobes swap_instruction(void *aref)
167 * shall not cross any page boundaries (vmalloc area!) when writing 167 * shall not cross any page boundaries (vmalloc area!) when writing
168 * the new instruction. 168 * the new instruction.
169 */ 169 */
170 addr = (u32 *)ALIGN((unsigned long)args->ptr, 4); 170 addr = (u32 *)((unsigned long)args->ptr & -4UL);
171 if ((unsigned long)args->ptr & 2) 171 if ((unsigned long)args->ptr & 2)
172 instr = ((*addr) & 0xffff0000) | args->new; 172 instr = ((*addr) & 0xffff0000) | args->new;
173 else 173 else
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index a52c44455bf0..c774f1069e10 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -320,4 +320,5 @@ SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper) 320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper)
321NI_SYSCALL /* 310 sys_move_pages */ 321NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,sys_ni_syscall) 323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper)
324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile
index 3c93012e91a3..ed5f5a9a3b3e 100644
--- a/arch/sh/boards/renesas/r7780rp/Makefile
+++ b/arch/sh/boards/renesas/r7780rp/Makefile
@@ -2,6 +2,6 @@
2# Makefile for the R7780RP-1 specific parts of the kernel 2# Makefile for the R7780RP-1 specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
6 6
7obj-$(CONFIG_PUSH_SWITCH) += psw.o 7obj-$(CONFIG_PUSH_SWITCH) += psw.o
diff --git a/arch/sh/boards/renesas/r7780rp/io.c b/arch/sh/boards/renesas/r7780rp/io.c
deleted file mode 100644
index f74d2ffb3851..000000000000
--- a/arch/sh/boards/renesas/r7780rp/io.c
+++ /dev/null
@@ -1,233 +0,0 @@
1/*
2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
4 *
5 * I/O routine for Renesas Solutions Highlander R7780RP-1
6 *
7 * Initial version only to support LAN access; some
8 * placeholder code from io_r7780rp.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
10 */
11#include <linux/pci.h>
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/io.h>
15#include <asm/r7780rp.h>
16#include <asm/addrspace.h>
17
18static inline unsigned long port88796l(unsigned int port, int flag)
19{
20 unsigned long addr;
21
22 if (flag)
23 addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1);
24 else
25 addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1) + 0x1000;
26
27 return addr;
28}
29
30#if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE)
31#define CHECK_AX88796L_PORT(port) \
32 ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20)))
33#else
34#define CHECK_AX88796L_PORT(port) (0)
35#endif
36
37/*
38 * General outline: remap really low stuff [eventually] to SuperIO,
39 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
40 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
41 * should be way beyond the window, and is used w/o translation for
42 * compatibility.
43 */
44u8 r7780rp_inb(unsigned long port)
45{
46 if (CHECK_AX88796L_PORT(port))
47 return ctrl_inw(port88796l(port, 0)) & 0xff;
48 else if (is_pci_ioaddr(port))
49 return ctrl_inb(pci_ioaddr(port));
50
51 return ctrl_inw(port) & 0xff;
52}
53
54u8 r7780rp_inb_p(unsigned long port)
55{
56 u8 v;
57
58 if (CHECK_AX88796L_PORT(port))
59 v = ctrl_inw(port88796l(port, 0)) & 0xff;
60 else if (is_pci_ioaddr(port))
61 v = ctrl_inb(pci_ioaddr(port));
62 else
63 v = ctrl_inw(port) & 0xff;
64
65 ctrl_delay();
66
67 return v;
68}
69
70u16 r7780rp_inw(unsigned long port)
71{
72 if (is_pci_ioaddr(port))
73 return ctrl_inw(pci_ioaddr(port));
74
75 return ctrl_inw(port);
76}
77
78u32 r7780rp_inl(unsigned long port)
79{
80 if (is_pci_ioaddr(port))
81 return ctrl_inl(pci_ioaddr(port));
82
83 return ctrl_inl(port);
84}
85
86void r7780rp_outb(u8 value, unsigned long port)
87{
88 if (CHECK_AX88796L_PORT(port))
89 ctrl_outw(value, port88796l(port, 0));
90 else if (is_pci_ioaddr(port))
91 ctrl_outb(value, pci_ioaddr(port));
92 else
93 ctrl_outb(value, port);
94}
95
96void r7780rp_outb_p(u8 value, unsigned long port)
97{
98 if (CHECK_AX88796L_PORT(port))
99 ctrl_outw(value, port88796l(port, 0));
100 else if (is_pci_ioaddr(port))
101 ctrl_outb(value, pci_ioaddr(port));
102 else
103 ctrl_outb(value, port);
104
105 ctrl_delay();
106}
107
108void r7780rp_outw(u16 value, unsigned long port)
109{
110 if (is_pci_ioaddr(port))
111 ctrl_outw(value, pci_ioaddr(port));
112 else
113 ctrl_outw(value, port);
114}
115
116void r7780rp_outl(u32 value, unsigned long port)
117{
118 if (is_pci_ioaddr(port))
119 ctrl_outl(value, pci_ioaddr(port));
120 else
121 ctrl_outl(value, port);
122}
123
124void r7780rp_insb(unsigned long port, void *dst, unsigned long count)
125{
126 volatile u16 *p;
127 u8 *buf = dst;
128
129 if (CHECK_AX88796L_PORT(port)) {
130 p = (volatile u16 *)port88796l(port, 0);
131 while (count--)
132 *buf++ = *p & 0xff;
133 } else if (is_pci_ioaddr(port)) {
134 volatile u8 *bp = (volatile u8 *)pci_ioaddr(port);
135
136 while (count--)
137 *buf++ = *bp;
138 } else {
139 p = (volatile u16 *)port;
140 while (count--)
141 *buf++ = *p & 0xff;
142 }
143}
144
145void r7780rp_insw(unsigned long port, void *dst, unsigned long count)
146{
147 volatile u16 *p;
148 u16 *buf = dst;
149
150 if (CHECK_AX88796L_PORT(port))
151 p = (volatile u16 *)port88796l(port, 1);
152 else if (is_pci_ioaddr(port))
153 p = (volatile u16 *)pci_ioaddr(port);
154 else
155 p = (volatile u16 *)port;
156
157 while (count--)
158 *buf++ = *p;
159
160 flush_dcache_all();
161}
162
163void r7780rp_insl(unsigned long port, void *dst, unsigned long count)
164{
165 if (is_pci_ioaddr(port)) {
166 volatile u32 *p = (volatile u32 *)pci_ioaddr(port);
167 u32 *buf = dst;
168
169 while (count--)
170 *buf++ = *p;
171 }
172}
173
174void r7780rp_outsb(unsigned long port, const void *src, unsigned long count)
175{
176 volatile u16 *p;
177 const u8 *buf = src;
178
179 if (CHECK_AX88796L_PORT(port)) {
180 p = (volatile u16 *)port88796l(port, 0);
181 while (count--)
182 *p = *buf++;
183 } else if (is_pci_ioaddr(port)) {
184 volatile u8 *bp = (volatile u8 *)pci_ioaddr(port);
185
186 while (count--)
187 *bp = *buf++;
188 } else
189 while (count--)
190 ctrl_outb(*buf++, port);
191}
192
193void r7780rp_outsw(unsigned long port, const void *src, unsigned long count)
194{
195 volatile u16 *p;
196 const u16 *buf = src;
197
198 if (CHECK_AX88796L_PORT(port))
199 p = (volatile u16 *)port88796l(port, 1);
200 else if (is_pci_ioaddr(port))
201 p = (volatile u16 *)pci_ioaddr(port);
202 else
203 p = (volatile u16 *)port;
204
205 while (count--)
206 *p = *buf++;
207
208 flush_dcache_all();
209}
210
211void r7780rp_outsl(unsigned long port, const void *src, unsigned long count)
212{
213 const u32 *buf = src;
214 u32 *p;
215
216 if (is_pci_ioaddr(port))
217 p = (u32 *)pci_ioaddr(port);
218 else
219 p = (u32 *)port;
220
221 while (count--)
222 ctrl_outl(*buf++, (unsigned long)p);
223}
224
225void __iomem *r7780rp_ioport_map(unsigned long port, unsigned int size)
226{
227 if (CHECK_AX88796L_PORT(port))
228 return (void __iomem *)port88796l(port, size > 1);
229 else if (is_pci_ioaddr(port))
230 return (void __iomem *)pci_ioaddr(port);
231
232 return (void __iomem *)port;
233}
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index 0d74db9f1792..2faba6679e64 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -187,31 +187,7 @@ static void __init r7780rp_setup(char **cmdline_p)
187struct sh_machine_vector mv_r7780rp __initmv = { 187struct sh_machine_vector mv_r7780rp __initmv = {
188 .mv_name = "Highlander R7780RP-1", 188 .mv_name = "Highlander R7780RP-1",
189 .mv_setup = r7780rp_setup, 189 .mv_setup = r7780rp_setup,
190
191 .mv_nr_irqs = 109, 190 .mv_nr_irqs = 109,
192
193 .mv_inb = r7780rp_inb,
194 .mv_inw = r7780rp_inw,
195 .mv_inl = r7780rp_inl,
196 .mv_outb = r7780rp_outb,
197 .mv_outw = r7780rp_outw,
198 .mv_outl = r7780rp_outl,
199
200 .mv_inb_p = r7780rp_inb_p,
201 .mv_inw_p = r7780rp_inw,
202 .mv_inl_p = r7780rp_inl,
203 .mv_outb_p = r7780rp_outb_p,
204 .mv_outw_p = r7780rp_outw,
205 .mv_outl_p = r7780rp_outl,
206
207 .mv_insb = r7780rp_insb,
208 .mv_insw = r7780rp_insw,
209 .mv_insl = r7780rp_insl,
210 .mv_outsb = r7780rp_outsb,
211 .mv_outsw = r7780rp_outsw,
212 .mv_outsl = r7780rp_outsl,
213
214 .mv_ioport_map = r7780rp_ioport_map,
215 .mv_init_irq = init_r7780rp_IRQ, 191 .mv_init_irq = init_r7780rp_IRQ,
216}; 192};
217ALIAS_MV(r7780rp) 193ALIAS_MV(r7780rp)
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 44b42082a0af..593f26a85e9c 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -12,6 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/pata_platform.h> 13#include <linux/pata_platform.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/sm501.h>
15#include <linux/pm.h> 16#include <linux/pm.h>
16#include <asm/machvec.h> 17#include <asm/machvec.h>
17#include <asm/rts7751r2d.h> 18#include <asm/rts7751r2d.h>
@@ -111,10 +112,35 @@ static struct platform_device heartbeat_device = {
111 .resource = heartbeat_resources, 112 .resource = heartbeat_resources,
112}; 113};
113 114
115static struct resource sm501_resources[] = {
116 [0] = {
117 .start = 0x10000000,
118 .end = 0x13e00000 - 1,
119 .flags = IORESOURCE_MEM,
120 },
121 [1] = {
122 .start = 0x13e00000,
123 .end = 0x13ffffff,
124 .flags = IORESOURCE_MEM,
125 },
126 [2] = {
127 .start = 32,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static struct platform_device sm501_device = {
133 .name = "sm501",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(sm501_resources),
136 .resource = sm501_resources,
137};
138
114static struct platform_device *rts7751r2d_devices[] __initdata = { 139static struct platform_device *rts7751r2d_devices[] __initdata = {
115 &uart_device, 140 &uart_device,
116 &heartbeat_device, 141 &heartbeat_device,
117 &cf_ide_device, 142 &cf_ide_device,
143 &sm501_device,
118}; 144};
119 145
120static int __init rts7751r2d_devices_setup(void) 146static int __init rts7751r2d_devices_setup(void)
diff --git a/arch/sh/configs/rts7751r2d_defconfig b/arch/sh/configs/rts7751r2d_defconfig
index db6a02df5af6..a59bb78bd071 100644
--- a/arch/sh/configs/rts7751r2d_defconfig
+++ b/arch/sh/configs/rts7751r2d_defconfig
@@ -1,14 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.21-rc1
4# Thu Feb 15 17:17:29 2007 4# Thu Mar 1 16:42:40 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 8CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
12CONFIG_GENERIC_IRQ_PROBE=y 11CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 12CONFIG_GENERIC_CALIBRATE_DELAY=y
14# CONFIG_GENERIC_TIME is not set 13# CONFIG_GENERIC_TIME is not set
@@ -33,6 +32,7 @@ CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y 32CONFIG_SWAP=y
34CONFIG_SYSVIPC=y 33CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 34# CONFIG_IPC_NS is not set
35CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 36# CONFIG_POSIX_MQUEUE is not set
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
@@ -119,7 +119,6 @@ CONFIG_SH_RTS7751R2D=y
119# CONFIG_SH_SHMIN is not set 119# CONFIG_SH_SHMIN is not set
120# CONFIG_SH_7206_SOLUTION_ENGINE is not set 120# CONFIG_SH_7206_SOLUTION_ENGINE is not set
121# CONFIG_SH_7619_SOLUTION_ENGINE is not set 121# CONFIG_SH_7619_SOLUTION_ENGINE is not set
122# CONFIG_SH_ASDAP310 is not set
123# CONFIG_SH_UNKNOWN is not set 122# CONFIG_SH_UNKNOWN is not set
124 123
125# 124#
@@ -281,7 +280,7 @@ CONFIG_ZERO_PAGE_OFFSET=0x00010000
281CONFIG_BOOT_LINK_OFFSET=0x00800000 280CONFIG_BOOT_LINK_OFFSET=0x00800000
282# CONFIG_UBC_WAKEUP is not set 281# CONFIG_UBC_WAKEUP is not set
283CONFIG_CMDLINE_BOOL=y 282CONFIG_CMDLINE_BOOL=y
284CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 283CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1"
285 284
286# 285#
287# Bus options 286# Bus options
@@ -433,6 +432,7 @@ CONFIG_FW_LOADER=m
433# 432#
434# Plug and Play support 433# Plug and Play support
435# 434#
435# CONFIG_PNPACPI is not set
436 436
437# 437#
438# Block devices 438# Block devices
@@ -770,7 +770,26 @@ CONFIG_NET_WIRELESS=y
770# 770#
771# Input device support 771# Input device support
772# 772#
773# CONFIG_INPUT is not set 773CONFIG_INPUT=y
774# CONFIG_INPUT_FF_MEMLESS is not set
775
776#
777# Userland interfaces
778#
779# CONFIG_INPUT_MOUSEDEV is not set
780# CONFIG_INPUT_JOYDEV is not set
781# CONFIG_INPUT_TSDEV is not set
782# CONFIG_INPUT_EVDEV is not set
783# CONFIG_INPUT_EVBUG is not set
784
785#
786# Input Device Drivers
787#
788# CONFIG_INPUT_KEYBOARD is not set
789# CONFIG_INPUT_MOUSE is not set
790# CONFIG_INPUT_JOYSTICK is not set
791# CONFIG_INPUT_TOUCHSCREEN is not set
792# CONFIG_INPUT_MISC is not set
774 793
775# 794#
776# Hardware I/O ports 795# Hardware I/O ports
@@ -781,7 +800,10 @@ CONFIG_NET_WIRELESS=y
781# 800#
782# Character devices 801# Character devices
783# 802#
784# CONFIG_VT is not set 803CONFIG_VT=y
804CONFIG_VT_CONSOLE=y
805CONFIG_HW_CONSOLE=y
806CONFIG_VT_HW_CONSOLE_BINDING=y
785# CONFIG_SERIAL_NONSTANDARD is not set 807# CONFIG_SERIAL_NONSTANDARD is not set
786 808
787# 809#
@@ -857,6 +879,11 @@ CONFIG_HWMON=y
857# CONFIG_HWMON_DEBUG_CHIP is not set 879# CONFIG_HWMON_DEBUG_CHIP is not set
858 880
859# 881#
882# Multifunction device drivers
883#
884CONFIG_MFD_SM501=y
885
886#
860# Multimedia devices 887# Multimedia devices
861# 888#
862# CONFIG_VIDEO_DEV is not set 889# CONFIG_VIDEO_DEV is not set
@@ -869,9 +896,66 @@ CONFIG_HWMON=y
869# 896#
870# Graphics support 897# Graphics support
871# 898#
872CONFIG_FIRMWARE_EDID=y
873# CONFIG_FB is not set
874# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 899# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
900CONFIG_FB=y
901# CONFIG_FIRMWARE_EDID is not set
902# CONFIG_FB_DDC is not set
903CONFIG_FB_CFB_FILLRECT=y
904CONFIG_FB_CFB_COPYAREA=y
905CONFIG_FB_CFB_IMAGEBLIT=y
906# CONFIG_FB_SVGALIB is not set
907# CONFIG_FB_MACMODES is not set
908# CONFIG_FB_BACKLIGHT is not set
909# CONFIG_FB_MODE_HELPERS is not set
910# CONFIG_FB_TILEBLITTING is not set
911
912#
913# Frambuffer hardware drivers
914#
915# CONFIG_FB_CIRRUS is not set
916# CONFIG_FB_PM2 is not set
917# CONFIG_FB_CYBER2000 is not set
918# CONFIG_FB_ASILIANT is not set
919# CONFIG_FB_IMSTT is not set
920# CONFIG_FB_EPSON1355 is not set
921# CONFIG_FB_S1D13XXX is not set
922# CONFIG_FB_NVIDIA is not set
923# CONFIG_FB_RIVA is not set
924# CONFIG_FB_MATROX is not set
925# CONFIG_FB_RADEON is not set
926# CONFIG_FB_ATY128 is not set
927# CONFIG_FB_ATY is not set
928# CONFIG_FB_S3 is not set
929# CONFIG_FB_SAVAGE is not set
930# CONFIG_FB_SIS is not set
931# CONFIG_FB_NEOMAGIC is not set
932# CONFIG_FB_KYRO is not set
933# CONFIG_FB_3DFX is not set
934# CONFIG_FB_VOODOO1 is not set
935# CONFIG_FB_TRIDENT is not set
936CONFIG_FB_SM501=y
937# CONFIG_FB_VIRTUAL is not set
938
939#
940# Console display driver support
941#
942CONFIG_DUMMY_CONSOLE=y
943CONFIG_FRAMEBUFFER_CONSOLE=y
944# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
945# CONFIG_FONTS is not set
946CONFIG_FONT_8x8=y
947CONFIG_FONT_8x16=y
948
949#
950# Logo configuration
951#
952CONFIG_LOGO=y
953# CONFIG_LOGO_LINUX_MONO is not set
954# CONFIG_LOGO_LINUX_VGA16 is not set
955# CONFIG_LOGO_LINUX_CLUT224 is not set
956# CONFIG_LOGO_SUPERH_MONO is not set
957# CONFIG_LOGO_SUPERH_VGA16 is not set
958CONFIG_LOGO_SUPERH_CLUT224=y
875 959
876# 960#
877# Sound 961# Sound
@@ -985,6 +1069,12 @@ CONFIG_SOUND_PRIME=m
985CONFIG_AC97_BUS=m 1069CONFIG_AC97_BUS=m
986 1070
987# 1071#
1072# HID Devices
1073#
1074CONFIG_HID=y
1075# CONFIG_HID_DEBUG is not set
1076
1077#
988# USB support 1078# USB support
989# 1079#
990CONFIG_USB_ARCH_HAS_HCD=y 1080CONFIG_USB_ARCH_HAS_HCD=y
@@ -1237,7 +1327,7 @@ CONFIG_LOG_BUF_SHIFT=14
1237CONFIG_EARLY_SCIF_CONSOLE=y 1327CONFIG_EARLY_SCIF_CONSOLE=y
1238CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000 1328CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1239CONFIG_EARLY_PRINTK=y 1329CONFIG_EARLY_PRINTK=y
1240# CONFIG_KGDB is not set 1330# CONFIG_SH_KGDB is not set
1241 1331
1242# 1332#
1243# Security options 1333# Security options
diff --git a/arch/sh/drivers/pci/pci-auto.c b/arch/sh/drivers/pci/pci-auto.c
index ecf16344f94a..224e007736fb 100644
--- a/arch/sh/drivers/pci/pci-auto.c
+++ b/arch/sh/drivers/pci/pci-auto.c
@@ -214,6 +214,12 @@ retry:
214 continue; 214 continue;
215 } 215 }
216 216
217 if (bar_value < *lower_limit || (bar_value + bar_size) >= *upper_limit) {
218 DBG(" unavailable -- skipping, value %x size %x\n",
219 bar_value, bar_size);
220 continue;
221 }
222
217#ifdef CONFIG_PCI_AUTO_UPDATE_RESOURCES 223#ifdef CONFIG_PCI_AUTO_UPDATE_RESOURCES
218 /* Write it out and update our limit */ 224 /* Write it out and update our limit */
219 early_write_config_dword(hose, top_bus, current_bus, pci_devfn, 225 early_write_config_dword(hose, top_bus, current_bus, pci_devfn,
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index 4b339a640b13..726acfcb9b77 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * CPU init code 4 * CPU init code
5 * 5 *
6 * Copyright (C) 2002 - 2006 Paul Mundt 6 * Copyright (C) 2002 - 2007 Paul Mundt
7 * Copyright (C) 2003 Richard Curnow 7 * Copyright (C) 2003 Richard Curnow
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
@@ -48,8 +48,19 @@ static void __init cache_init(void)
48{ 48{
49 unsigned long ccr, flags; 49 unsigned long ccr, flags;
50 50
51 if (current_cpu_data.type == CPU_SH_NONE) 51 /* First setup the rest of the I-cache info */
52 panic("Unknown CPU"); 52 current_cpu_data.icache.entry_mask = current_cpu_data.icache.way_incr -
53 current_cpu_data.icache.linesz;
54
55 current_cpu_data.icache.way_size = current_cpu_data.icache.sets *
56 current_cpu_data.icache.linesz;
57
58 /* And the D-cache too */
59 current_cpu_data.dcache.entry_mask = current_cpu_data.dcache.way_incr -
60 current_cpu_data.dcache.linesz;
61
62 current_cpu_data.dcache.way_size = current_cpu_data.dcache.sets *
63 current_cpu_data.dcache.linesz;
53 64
54 jump_to_P2(); 65 jump_to_P2();
55 ccr = ctrl_inl(CCR); 66 ccr = ctrl_inl(CCR);
@@ -200,6 +211,9 @@ asmlinkage void __init sh_cpu_init(void)
200 /* First, probe the CPU */ 211 /* First, probe the CPU */
201 detect_cpu_and_cache_system(); 212 detect_cpu_and_cache_system();
202 213
214 if (current_cpu_data.type == CPU_SH_NONE)
215 panic("Unknown CPU");
216
203 /* Init the cache */ 217 /* Init the cache */
204 cache_init(); 218 cache_init();
205 219
diff --git a/arch/sh/kernel/cpu/sh2/entry.S b/arch/sh/kernel/cpu/sh2/entry.S
index 7f7d292f36ec..c16dc8fec489 100644
--- a/arch/sh/kernel/cpu/sh2/entry.S
+++ b/arch/sh/kernel/cpu/sh2/entry.S
@@ -165,6 +165,7 @@ ENTRY(exception_handler)
165 165
166interrupt_entry: 166interrupt_entry:
167 mov r9,r4 167 mov r9,r4
168 mov r15,r5
168 mov.l 6f,r9 169 mov.l 6f,r9
169 mov.l 7f,r8 170 mov.l 7f,r8
170 jmp @r8 171 jmp @r8
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index c19205b0f2c0..f3e827f29a46 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -514,13 +514,16 @@ skip_save:
514 514
515interrupt_exception: 515interrupt_exception:
516 mov.l 1f, r9 516 mov.l 1f, r9
517 mov.l 2f, r4
518 mov.l @r4, r4
517 jmp @r9 519 jmp @r9
518 nop 520 mov r15, r5
519 rts 521 rts
520 nop 522 nop
521 523
522 .align 2 524 .align 2
5231: .long do_IRQ 5251: .long do_IRQ
5262: .long INTEVT
524 527
525 .align 2 528 .align 2
526ENTRY(exception_none) 529ENTRY(exception_none)
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 9d28c88d2f9d..58950de2696d 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -195,13 +195,6 @@ int __init detect_cpu_and_cache_system(void)
195 195
196 } 196 }
197 197
198 /* Setup the rest of the I-cache info */
199 current_cpu_data.icache.entry_mask = current_cpu_data.icache.way_incr -
200 current_cpu_data.icache.linesz;
201
202 current_cpu_data.icache.way_size = current_cpu_data.icache.sets *
203 current_cpu_data.icache.linesz;
204
205 /* And the rest of the D-cache */ 198 /* And the rest of the D-cache */
206 if (current_cpu_data.dcache.ways > 1) { 199 if (current_cpu_data.dcache.ways > 1) {
207 size = sizes[(cvr >> 16) & 0xf]; 200 size = sizes[(cvr >> 16) & 0xf];
@@ -209,12 +202,6 @@ int __init detect_cpu_and_cache_system(void)
209 current_cpu_data.dcache.sets = (size >> 6); 202 current_cpu_data.dcache.sets = (size >> 6);
210 } 203 }
211 204
212 current_cpu_data.dcache.entry_mask = current_cpu_data.dcache.way_incr -
213 current_cpu_data.dcache.linesz;
214
215 current_cpu_data.dcache.way_size = current_cpu_data.dcache.sets *
216 current_cpu_data.dcache.linesz;
217
218 /* 205 /*
219 * Setup the L2 cache desc 206 * Setup the L2 cache desc
220 * 207 *
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index ab4ebb856c2a..b46728027195 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -224,7 +224,7 @@ work_resched:
224syscall_exit_work: 224syscall_exit_work:
225 ! r0: current_thread_info->flags 225 ! r0: current_thread_info->flags
226 ! r8: current_thread_info 226 ! r8: current_thread_info
227 tst #_TIF_SYSCALL_TRACE, r0 227 tst #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP, r0
228 bt/s work_pending 228 bt/s work_pending
229 tst #_TIF_NEED_RESCHED, r0 229 tst #_TIF_NEED_RESCHED, r0
230#ifdef CONFIG_TRACE_IRQFLAGS 230#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index 66626c03e1ee..771ea4230441 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -14,7 +14,6 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <asm/machvec.h> 16#include <asm/machvec.h>
17#include <asm/cacheflush.h>
18 17
19#ifdef CONFIG_CPU_SH3 18#ifdef CONFIG_CPU_SH3
20/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a 19/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a
@@ -96,7 +95,6 @@ void generic_insw(unsigned long port, void *dst, unsigned long count)
96 while (count--) 95 while (count--)
97 *buf++ = *port_addr; 96 *buf++ = *port_addr;
98 97
99 flush_dcache_all();
100 dummy_read(); 98 dummy_read();
101} 99}
102 100
@@ -171,7 +169,6 @@ void generic_outsw(unsigned long port, const void *src, unsigned long count)
171 while (count--) 169 while (count--)
172 *port_addr = *buf++; 170 *port_addr = *buf++;
173 171
174 flush_dcache_all();
175 dummy_read(); 172 dummy_read();
176} 173}
177 174
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 67be2b6e8cd1..9bdd8a00cd4a 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/io.h>
15#include <linux/irq.h> 14#include <linux/irq.h>
16#include <asm/processor.h> 15#include <asm/processor.h>
17#include <asm/uaccess.h> 16#include <asm/uaccess.h>
@@ -82,13 +81,9 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
82static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; 81static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
83#endif 82#endif
84 83
85asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, 84asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
86 unsigned long r6, unsigned long r7,
87 struct pt_regs __regs)
88{ 85{
89 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
90 struct pt_regs *old_regs = set_irq_regs(regs); 86 struct pt_regs *old_regs = set_irq_regs(regs);
91 int irq;
92#ifdef CONFIG_4KSTACKS 87#ifdef CONFIG_4KSTACKS
93 union irq_ctx *curctx, *irqctx; 88 union irq_ctx *curctx, *irqctx;
94#endif 89#endif
@@ -111,13 +106,7 @@ asmlinkage int do_IRQ(unsigned long r4, unsigned long r5,
111 } 106 }
112#endif 107#endif
113 108
114#ifdef CONFIG_CPU_HAS_INTEVT 109 irq = irq_demux(evt2irq(irq));
115 irq = evt2irq(ctrl_inl(INTEVT));
116#else
117 irq = r4;
118#endif
119
120 irq = irq_demux(irq);
121 110
122#ifdef CONFIG_4KSTACKS 111#ifdef CONFIG_4KSTACKS
123 curctx = (union irq_ctx *)current_thread_info(); 112 curctx = (union irq_ctx *)current_thread_info();
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 9d6a438b3eaf..e7607366ac4e 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -250,12 +250,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
250 childregs->regs[15] = usp; 250 childregs->regs[15] = usp;
251 ti->addr_limit = USER_DS; 251 ti->addr_limit = USER_DS;
252 } else { 252 } else {
253 childregs->regs[15] = (unsigned long)task_stack_page(p) + 253 childregs->regs[15] = (unsigned long)childregs;
254 THREAD_SIZE;
255 ti->addr_limit = KERNEL_DS; 254 ti->addr_limit = KERNEL_DS;
256 } 255 }
257 256
258 if (clone_flags & CLONE_SETTLS) 257 if (clone_flags & CLONE_SETTLS)
259 childregs->gbr = childregs->regs[0]; 258 childregs->gbr = childregs->regs[0];
260 259
261 childregs->regs[0] = 0; /* Set return value for child */ 260 childregs->regs[0] = 0; /* Set return value for child */
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index 04ca13a041c1..855f7246cfff 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -8,7 +8,6 @@
8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka 8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka
9 * 9 *
10 */ 10 */
11
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/sched.h> 12#include <linux/sched.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
@@ -20,8 +19,7 @@
20#include <linux/slab.h> 19#include <linux/slab.h>
21#include <linux/security.h> 20#include <linux/security.h>
22#include <linux/signal.h> 21#include <linux/signal.h>
23 22#include <linux/io.h>
24#include <asm/io.h>
25#include <asm/uaccess.h> 23#include <asm/uaccess.h>
26#include <asm/pgtable.h> 24#include <asm/pgtable.h>
27#include <asm/system.h> 25#include <asm/system.h>
@@ -59,6 +57,23 @@ static inline int put_stack_long(struct task_struct *task, int offset,
59 return 0; 57 return 0;
60} 58}
61 59
60static void ptrace_disable_singlestep(struct task_struct *child)
61{
62 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
63
64 /*
65 * Ensure the UBC is not programmed at the next context switch.
66 *
67 * Normally this is not needed but there are sequences such as
68 * singlestep, signal delivery, and continue that leave the
69 * ubc_pc non-zero leading to spurious SIGTRAPs.
70 */
71 if (child->thread.ubc_pc != 0) {
72 ubc_usercnt -= 1;
73 child->thread.ubc_pc = 0;
74 }
75}
76
62/* 77/*
63 * Called by kernel/ptrace.c when detaching.. 78 * Called by kernel/ptrace.c when detaching..
64 * 79 *
@@ -66,7 +81,7 @@ static inline int put_stack_long(struct task_struct *task, int offset,
66 */ 81 */
67void ptrace_disable(struct task_struct *child) 82void ptrace_disable(struct task_struct *child)
68{ 83{
69 /* nothing to do.. */ 84 ptrace_disable_singlestep(child);
70} 85}
71 86
72long arch_ptrace(struct task_struct *child, long request, long addr, long data) 87long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -76,7 +91,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
76 91
77 switch (request) { 92 switch (request) {
78 /* when I and D space are separate, these will need to be fixed. */ 93 /* when I and D space are separate, these will need to be fixed. */
79 case PTRACE_PEEKTEXT: /* read word at location addr. */ 94 case PTRACE_PEEKTEXT: /* read word at location addr. */
80 case PTRACE_PEEKDATA: { 95 case PTRACE_PEEKDATA: {
81 unsigned long tmp; 96 unsigned long tmp;
82 int copied; 97 int copied;
@@ -94,7 +109,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
94 unsigned long tmp; 109 unsigned long tmp;
95 110
96 ret = -EIO; 111 ret = -EIO;
97 if ((addr & 3) || addr < 0 || 112 if ((addr & 3) || addr < 0 ||
98 addr > sizeof(struct user) - 3) 113 addr > sizeof(struct user) - 3)
99 break; 114 break;
100 115
@@ -129,7 +144,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
129 144
130 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 145 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
131 ret = -EIO; 146 ret = -EIO;
132 if ((addr & 3) || addr < 0 || 147 if ((addr & 3) || addr < 0 ||
133 addr > sizeof(struct user) - 3) 148 addr > sizeof(struct user) - 3)
134 break; 149 break;
135 150
@@ -156,6 +171,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
156 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 171 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
157 else 172 else
158 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 173 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
174
175 ptrace_disable_singlestep(child);
176
159 child->exit_code = data; 177 child->exit_code = data;
160 wake_up_process(child); 178 wake_up_process(child);
161 ret = 0; 179 ret = 0;
@@ -163,14 +181,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
163 } 181 }
164 182
165/* 183/*
166 * make the child exit. Best I can do is send it a sigkill. 184 * make the child exit. Best I can do is send it a sigkill.
167 * perhaps it should be put in the status that it wants to 185 * perhaps it should be put in the status that it wants to
168 * exit. 186 * exit.
169 */ 187 */
170 case PTRACE_KILL: { 188 case PTRACE_KILL: {
171 ret = 0; 189 ret = 0;
172 if (child->exit_state == EXIT_ZOMBIE) /* already dead */ 190 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
173 break; 191 break;
192 ptrace_disable_singlestep(child);
174 child->exit_code = SIGKILL; 193 child->exit_code = SIGKILL;
175 wake_up_process(child); 194 wake_up_process(child);
176 break; 195 break;
@@ -196,6 +215,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
196 ubc_usercnt += 1; 215 ubc_usercnt += 1;
197 child->thread.ubc_pc = pc; 216 child->thread.ubc_pc = pc;
198 217
218 set_tsk_thread_flag(child, TIF_SINGLESTEP);
199 child->exit_code = data; 219 child->exit_code = data;
200 /* give it a chance to run. */ 220 /* give it a chance to run. */
201 wake_up_process(child); 221 wake_up_process(child);
@@ -248,14 +268,15 @@ asmlinkage void do_syscall_trace(void)
248{ 268{
249 struct task_struct *tsk = current; 269 struct task_struct *tsk = current;
250 270
251 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 271 if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
272 !test_thread_flag(TIF_SINGLESTEP))
252 return; 273 return;
253 if (!(tsk->ptrace & PT_PTRACED)) 274 if (!(tsk->ptrace & PT_PTRACED))
254 return; 275 return;
255 /* the 0x80 provides a way for the tracing parent to distinguish 276 /* the 0x80 provides a way for the tracing parent to distinguish
256 between a syscall stop and SIGTRAP delivery */ 277 between a syscall stop and SIGTRAP delivery */
257 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 278 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
258 ? 0x80 : 0)); 279 !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
259 280
260 /* 281 /*
261 * this isn't the same as continuing with a signal, but it will do 282 * this isn't the same as continuing with a signal, but it will do
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index fe1b276c97c6..6e0d10fac4a8 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -82,9 +82,6 @@ DECLARE_EXPORT(__movstr);
82DECLARE_EXPORT(__movmem_i4_even); 82DECLARE_EXPORT(__movmem_i4_even);
83DECLARE_EXPORT(__movmem_i4_odd); 83DECLARE_EXPORT(__movmem_i4_odd);
84DECLARE_EXPORT(__movmemSI12_i4); 84DECLARE_EXPORT(__movmemSI12_i4);
85DECLARE_EXPORT(__sdivsi3_i4i);
86DECLARE_EXPORT(__udiv_qrnnd_16);
87DECLARE_EXPORT(__udivsi3_i4i);
88#else /* GCC 3.x */ 85#else /* GCC 3.x */
89DECLARE_EXPORT(__movstr_i4_even); 86DECLARE_EXPORT(__movstr_i4_even);
90DECLARE_EXPORT(__movstr_i4_odd); 87DECLARE_EXPORT(__movstr_i4_odd);
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 32f10a03fbb5..9f39ef1f73da 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -589,6 +589,8 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
589 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 589 if (test_thread_flag(TIF_RESTORE_SIGMASK))
590 clear_thread_flag(TIF_RESTORE_SIGMASK); 590 clear_thread_flag(TIF_RESTORE_SIGMASK);
591 } 591 }
592
593 return;
592 } 594 }
593 595
594 no_signal: 596 no_signal:
@@ -598,7 +600,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
598 if (regs->regs[0] == -ERESTARTNOHAND || 600 if (regs->regs[0] == -ERESTARTNOHAND ||
599 regs->regs[0] == -ERESTARTSYS || 601 regs->regs[0] == -ERESTARTSYS ||
600 regs->regs[0] == -ERESTARTNOINTR) { 602 regs->regs[0] == -ERESTARTNOINTR) {
601 regs->regs[0] = save_r0; 603 regs->regs[0] = save_r0;
602 regs->pc -= 2; 604 regs->pc -= 2;
603 } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) { 605 } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) {
604 regs->pc -= 2; 606 regs->pc -= 2;
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 75de165867a0..78a6c09875b2 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -3,6 +3,7 @@
3 * Written by Niibe Yutaka 3 * Written by Niibe Yutaka
4 */ 4 */
5#include <asm/thread_info.h> 5#include <asm/thread_info.h>
6#include <asm/cache.h>
6#include <asm-generic/vmlinux.lds.h> 7#include <asm-generic/vmlinux.lds.h>
7 8
8#ifdef CONFIG_CPU_LITTLE_ENDIAN 9#ifdef CONFIG_CPU_LITTLE_ENDIAN
@@ -53,7 +54,7 @@ SECTIONS
53 . = ALIGN(PAGE_SIZE); 54 . = ALIGN(PAGE_SIZE);
54 .data.page_aligned : { *(.data.page_aligned) } 55 .data.page_aligned : { *(.data.page_aligned) }
55 56
56 . = ALIGN(32); 57 . = ALIGN(L1_CACHE_BYTES);
57 __per_cpu_start = .; 58 __per_cpu_start = .;
58 .data.percpu : { *(.data.percpu) } 59 .data.percpu : { *(.data.percpu) }
59 __per_cpu_end = .; 60 __per_cpu_end = .;
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index e0cd4b7f4aeb..981b04089055 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -237,20 +237,10 @@ static inline void flush_cache_4096(unsigned long start,
237/* 237/*
238 * Write back & invalidate the D-cache of the page. 238 * Write back & invalidate the D-cache of the page.
239 * (To avoid "alias" issues) 239 * (To avoid "alias" issues)
240 *
241 * This uses a lazy write-back on UP, which is explicitly
242 * disabled on SMP.
243 */ 240 */
244void flush_dcache_page(struct page *page) 241void flush_dcache_page(struct page *page)
245{ 242{
246#ifndef CONFIG_SMP 243 if (test_bit(PG_mapped, &page->flags)) {
247 struct address_space *mapping = page_mapping(page);
248
249 if (mapping && !mapping_mapped(mapping))
250 set_bit(PG_dcache_dirty, &page->flags);
251 else
252#endif
253 {
254 unsigned long phys = PHYSADDR(page_address(page)); 244 unsigned long phys = PHYSADDR(page_address(page));
255 unsigned long addr = CACHE_OC_ADDRESS_ARRAY; 245 unsigned long addr = CACHE_OC_ADDRESS_ARRAY;
256 int i, n; 246 int i, n;
diff --git a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c
index 31f8deb7a158..4896d7376926 100644
--- a/arch/sh/mm/cache-sh7705.c
+++ b/arch/sh/mm/cache-sh7705.c
@@ -3,11 +3,11 @@
3 * 3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka 4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2004 Alex Song 5 * Copyright (C) 2004 Alex Song
6 * Copyright (C) 2006 Paul Mundt
7 * 6 *
8 * 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
9 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 9 * for more details.
10 *
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mman.h> 13#include <linux/mman.h>
@@ -51,6 +51,7 @@ static inline void cache_wback_all(void)
51 51
52 if ((data & v) == v) 52 if ((data & v) == v)
53 ctrl_outl(data & ~v, addr); 53 ctrl_outl(data & ~v, addr);
54
54 } 55 }
55 56
56 addrstart += current_cpu_data.dcache.way_incr; 57 addrstart += current_cpu_data.dcache.way_incr;
@@ -127,11 +128,7 @@ static void __flush_dcache_page(unsigned long phys)
127 */ 128 */
128void flush_dcache_page(struct page *page) 129void flush_dcache_page(struct page *page)
129{ 130{
130 struct address_space *mapping = page_mapping(page); 131 if (test_bit(PG_mapped, &page->flags))
131
132 if (mapping && !mapping_mapped(mapping))
133 set_bit(PG_dcache_dirty, &page->flags);
134 else
135 __flush_dcache_page(PHYSADDR(page_address(page))); 132 __flush_dcache_page(PHYSADDR(page_address(page)));
136} 133}
137 134
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index 969efeceb928..df69da9ca69c 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -23,6 +23,7 @@ extern struct mutex p3map_mutex[];
23 */ 23 */
24void clear_user_page(void *to, unsigned long address, struct page *page) 24void clear_user_page(void *to, unsigned long address, struct page *page)
25{ 25{
26 __set_bit(PG_mapped, &page->flags);
26 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 27 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
27 clear_page(to); 28 clear_page(to);
28 else { 29 else {
@@ -58,6 +59,7 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
58void copy_user_page(void *to, void *from, unsigned long address, 59void copy_user_page(void *to, void *from, unsigned long address,
59 struct page *page) 60 struct page *page)
60{ 61{
62 __set_bit(PG_mapped, &page->flags);
61 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 63 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
62 copy_page(to, from); 64 copy_page(to, from);
63 else { 65 else {
@@ -82,3 +84,23 @@ void copy_user_page(void *to, void *from, unsigned long address,
82 mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); 84 mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
83 } 85 }
84} 86}
87
88/*
89 * For SH-4, we have our own implementation for ptep_get_and_clear
90 */
91inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
92{
93 pte_t pte = *ptep;
94
95 pte_clear(mm, addr, ptep);
96 if (!pte_not_present(pte)) {
97 unsigned long pfn = pte_pfn(pte);
98 if (pfn_valid(pfn)) {
99 struct page *page = pfn_to_page(pfn);
100 struct address_space *mapping = page_mapping(page);
101 if (!mapping || !mapping_writably_mapped(mapping))
102 __clear_bit(PG_mapped, &page->flags);
103 }
104 }
105 return pte;
106}
diff --git a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
index 887ab9d18ccd..a4b015f95a3a 100644
--- a/arch/sh/mm/pg-sh7705.c
+++ b/arch/sh/mm/pg-sh7705.c
@@ -7,7 +7,9 @@
7 * 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
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 *
10 */ 11 */
12
11#include <linux/init.h> 13#include <linux/init.h>
12#include <linux/mman.h> 14#include <linux/mman.h>
13#include <linux/mm.h> 15#include <linux/mm.h>
@@ -74,6 +76,7 @@ void clear_user_page(void *to, unsigned long address, struct page *pg)
74{ 76{
75 struct page *page = virt_to_page(to); 77 struct page *page = virt_to_page(to);
76 78
79 __set_bit(PG_mapped, &page->flags);
77 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) { 80 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
78 clear_page(to); 81 clear_page(to);
79 __flush_wback_region(to, PAGE_SIZE); 82 __flush_wback_region(to, PAGE_SIZE);
@@ -92,11 +95,12 @@ void clear_user_page(void *to, unsigned long address, struct page *pg)
92 * @from: P1 address 95 * @from: P1 address
93 * @address: U0 address to be mapped 96 * @address: U0 address to be mapped
94 */ 97 */
95void copy_user_page(void *to, void *from, unsigned long address, 98void copy_user_page(void *to, void *from, unsigned long address, struct page *pg)
96 struct page *pg)
97{ 99{
98 struct page *page = virt_to_page(to); 100 struct page *page = virt_to_page(to);
99 101
102
103 __set_bit(PG_mapped, &page->flags);
100 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) { 104 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
101 copy_page(to, from); 105 copy_page(to, from);
102 __flush_wback_region(to, PAGE_SIZE); 106 __flush_wback_region(to, PAGE_SIZE);
@@ -108,3 +112,26 @@ void copy_user_page(void *to, void *from, unsigned long address,
108 __flush_wback_region(to, PAGE_SIZE); 112 __flush_wback_region(to, PAGE_SIZE);
109 } 113 }
110} 114}
115
116/*
117 * For SH7705, we have our own implementation for ptep_get_and_clear
118 * Copied from pg-sh4.c
119 */
120inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
121{
122 pte_t pte = *ptep;
123
124 pte_clear(mm, addr, ptep);
125 if (!pte_not_present(pte)) {
126 unsigned long pfn = pte_pfn(pte);
127 if (pfn_valid(pfn)) {
128 struct page *page = pfn_to_page(pfn);
129 struct address_space *mapping = page_mapping(page);
130 if (!mapping || !mapping_writably_mapped(mapping))
131 __clear_bit(PG_mapped, &page->flags);
132 }
133 }
134
135 return pte;
136}
137
diff --git a/arch/sh/mm/tlb-flush.c b/arch/sh/mm/tlb-flush.c
index d2f7b4a2eb05..6f45c1f8a7fe 100644
--- a/arch/sh/mm/tlb-flush.c
+++ b/arch/sh/mm/tlb-flush.c
@@ -2,17 +2,15 @@
2 * TLB flushing operations for SH with an MMU. 2 * TLB flushing operations for SH with an MMU.
3 * 3 *
4 * Copyright (C) 1999 Niibe Yutaka 4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 - 2006 Paul Mundt 5 * Copyright (C) 2003 Paul Mundt
6 * 6 *
7 * 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
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/io.h>
13#include <asm/mmu_context.h> 12#include <asm/mmu_context.h>
14#include <asm/tlbflush.h> 13#include <asm/tlbflush.h>
15#include <asm/cacheflush.h>
16 14
17void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) 15void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
18{ 16{
@@ -140,54 +138,3 @@ void local_flush_tlb_all(void)
140 ctrl_barrier(); 138 ctrl_barrier();
141 local_irq_restore(flags); 139 local_irq_restore(flags);
142} 140}
143
144void update_mmu_cache(struct vm_area_struct *vma,
145 unsigned long address, pte_t pte)
146{
147 unsigned long flags;
148 unsigned long pteval;
149 unsigned long vpn;
150 struct page *page;
151 unsigned long pfn = pte_pfn(pte);
152 struct address_space *mapping;
153
154 if (!pfn_valid(pfn))
155 return;
156
157 page = pfn_to_page(pfn);
158 mapping = page_mapping(page);
159 if (mapping) {
160 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
161 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
162
163 if (dirty)
164 __flush_wback_region((void *)P1SEGADDR(phys),
165 PAGE_SIZE);
166 }
167
168 local_irq_save(flags);
169
170 /* Set PTEH register */
171 vpn = (address & MMU_VPN_MASK) | get_asid();
172 ctrl_outl(vpn, MMU_PTEH);
173
174 pteval = pte_val(pte);
175
176#ifdef CONFIG_CPU_HAS_PTEA
177 /* Set PTEA register */
178 /* TODO: make this look less hacky */
179 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA);
180#endif
181
182 /* Set PTEL register */
183 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
184#if defined(CONFIG_SH_WRITETHROUGH) && defined(CONFIG_CPU_SH4)
185 pteval |= _PAGE_WT;
186#endif
187 /* conveniently, we want all the software flags to be 0 anyway */
188 ctrl_outl(pteval, MMU_PTEL);
189
190 /* Load the TLB */
191 asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
192 local_irq_restore(flags);
193}
diff --git a/arch/sh/mm/tlb-sh3.c b/arch/sh/mm/tlb-sh3.c
index e5e76eb7ee09..7fbfd5a11ffa 100644
--- a/arch/sh/mm/tlb-sh3.c
+++ b/arch/sh/mm/tlb-sh3.c
@@ -8,9 +8,69 @@
8 * 8 *
9 * Released under the terms of the GNU GPL v2.0. 9 * Released under the terms of the GNU GPL v2.0.
10 */ 10 */
11#include <linux/io.h> 11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/string.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18#include <linux/mman.h>
19#include <linux/mm.h>
20#include <linux/smp.h>
21#include <linux/smp_lock.h>
22#include <linux/interrupt.h>
23
12#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/io.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
13#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/cacheflush.h>
30
31void update_mmu_cache(struct vm_area_struct * vma,
32 unsigned long address, pte_t pte)
33{
34 unsigned long flags;
35 unsigned long pteval;
36 unsigned long vpn;
37
38 /* Ptrace may call this routine. */
39 if (vma && current->active_mm != vma->vm_mm)
40 return;
41
42#if defined(CONFIG_SH7705_CACHE_32KB)
43 {
44 struct page *page = pte_page(pte);
45 unsigned long pfn = pte_pfn(pte);
46
47 if (pfn_valid(pfn) && !test_bit(PG_mapped, &page->flags)) {
48 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
49
50 __flush_wback_region((void *)P1SEGADDR(phys),
51 PAGE_SIZE);
52 __set_bit(PG_mapped, &page->flags);
53 }
54 }
55#endif
56
57 local_irq_save(flags);
58
59 /* Set PTEH register */
60 vpn = (address & MMU_VPN_MASK) | get_asid();
61 ctrl_outl(vpn, MMU_PTEH);
62
63 pteval = pte_val(pte);
64
65 /* Set PTEL register */
66 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
67 /* conveniently, we want all the software flags to be 0 anyway */
68 ctrl_outl(pteval, MMU_PTEL);
69
70 /* Load the TLB */
71 asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
72 local_irq_restore(flags);
73}
14 74
15void local_flush_tlb_one(unsigned long asid, unsigned long page) 75void local_flush_tlb_one(unsigned long asid, unsigned long page)
16{ 76{
@@ -34,3 +94,4 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
34 for (i = 0; i < ways; i++) 94 for (i = 0; i < ways; i++)
35 ctrl_outl(data, addr + (i << 8)); 95 ctrl_outl(data, addr + (i << 8));
36} 96}
97
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c
index 221e7095473d..f74cf667c8fa 100644
--- a/arch/sh/mm/tlb-sh4.c
+++ b/arch/sh/mm/tlb-sh4.c
@@ -8,9 +8,74 @@
8 * 8 *
9 * Released under the terms of the GNU GPL v2.0. 9 * Released under the terms of the GNU GPL v2.0.
10 */ 10 */
11#include <linux/io.h> 11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/string.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18#include <linux/mman.h>
19#include <linux/mm.h>
20#include <linux/smp.h>
21#include <linux/smp_lock.h>
22#include <linux/interrupt.h>
23
12#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/io.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
13#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/cacheflush.h>
30
31void update_mmu_cache(struct vm_area_struct * vma,
32 unsigned long address, pte_t pte)
33{
34 unsigned long flags;
35 unsigned long pteval;
36 unsigned long vpn;
37 struct page *page;
38 unsigned long pfn;
39
40 /* Ptrace may call this routine. */
41 if (vma && current->active_mm != vma->vm_mm)
42 return;
43
44 pfn = pte_pfn(pte);
45 if (pfn_valid(pfn)) {
46 page = pfn_to_page(pfn);
47 if (!test_bit(PG_mapped, &page->flags)) {
48 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
49 __flush_wback_region((void *)P1SEGADDR(phys), PAGE_SIZE);
50 __set_bit(PG_mapped, &page->flags);
51 }
52 }
53
54 local_irq_save(flags);
55
56 /* Set PTEH register */
57 vpn = (address & MMU_VPN_MASK) | get_asid();
58 ctrl_outl(vpn, MMU_PTEH);
59
60 pteval = pte_val(pte);
61
62 /* Set PTEA register */
63 if (cpu_data->flags & CPU_HAS_PTEA)
64 /* TODO: make this look less hacky */
65 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA);
66
67 /* Set PTEL register */
68 pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
69#ifdef CONFIG_SH_WRITETHROUGH
70 pteval |= _PAGE_WT;
71#endif
72 /* conveniently, we want all the software flags to be 0 anyway */
73 ctrl_outl(pteval, MMU_PTEL);
74
75 /* Load the TLB */
76 asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
77 local_irq_restore(flags);
78}
14 79
15void local_flush_tlb_one(unsigned long asid, unsigned long page) 80void local_flush_tlb_one(unsigned long asid, unsigned long page)
16{ 81{
@@ -28,3 +93,4 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
28 ctrl_outl(data, addr); 93 ctrl_outl(data, addr);
29 back_to_P1(); 94 back_to_P1();
30} 95}
96
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 113bd48a89bd..fc874e63a499 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -348,7 +348,7 @@ void exit_thread(void)
348#ifndef CONFIG_SMP 348#ifndef CONFIG_SMP
349 if(last_task_used_math == current) { 349 if(last_task_used_math == current) {
350#else 350#else
351 if(current_thread_info()->flags & _TIF_USEDFPU) { 351 if (test_thread_flag(TIF_USEDFPU)) {
352#endif 352#endif
353 /* Keep process from leaving FPU in a bogon state. */ 353 /* Keep process from leaving FPU in a bogon state. */
354 put_psr(get_psr() | PSR_EF); 354 put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
357#ifndef CONFIG_SMP 357#ifndef CONFIG_SMP
358 last_task_used_math = NULL; 358 last_task_used_math = NULL;
359#else 359#else
360 current_thread_info()->flags &= ~_TIF_USEDFPU; 360 clear_thread_flag(TIF_USEDFPU);
361#endif 361#endif
362 } 362 }
363} 363}
@@ -371,7 +371,7 @@ void flush_thread(void)
371#ifndef CONFIG_SMP 371#ifndef CONFIG_SMP
372 if(last_task_used_math == current) { 372 if(last_task_used_math == current) {
373#else 373#else
374 if(current_thread_info()->flags & _TIF_USEDFPU) { 374 if (test_thread_flag(TIF_USEDFPU)) {
375#endif 375#endif
376 /* Clean the fpu. */ 376 /* Clean the fpu. */
377 put_psr(get_psr() | PSR_EF); 377 put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
380#ifndef CONFIG_SMP 380#ifndef CONFIG_SMP
381 last_task_used_math = NULL; 381 last_task_used_math = NULL;
382#else 382#else
383 current_thread_info()->flags &= ~_TIF_USEDFPU; 383 clear_thread_flag(TIF_USEDFPU);
384#endif 384#endif
385 } 385 }
386 386
@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
466#ifndef CONFIG_SMP 466#ifndef CONFIG_SMP
467 if(last_task_used_math == current) { 467 if(last_task_used_math == current) {
468#else 468#else
469 if(current_thread_info()->flags & _TIF_USEDFPU) { 469 if (test_thread_flag(TIF_USEDFPU)) {
470#endif 470#endif
471 put_psr(get_psr() | PSR_EF); 471 put_psr(get_psr() | PSR_EF);
472 fpsave(&p->thread.float_regs[0], &p->thread.fsr, 472 fpsave(&p->thread.float_regs[0], &p->thread.fsr,
473 &p->thread.fpqueue[0], &p->thread.fpqdepth); 473 &p->thread.fpqueue[0], &p->thread.fpqdepth);
474#ifdef CONFIG_SMP 474#ifdef CONFIG_SMP
475 current_thread_info()->flags &= ~_TIF_USEDFPU; 475 clear_thread_flag(TIF_USEDFPU);
476#endif 476#endif
477 } 477 }
478 478
@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
609 return 1; 609 return 1;
610 } 610 }
611#ifdef CONFIG_SMP 611#ifdef CONFIG_SMP
612 if (current_thread_info()->flags & _TIF_USEDFPU) { 612 if (test_thread_flag(TIF_USEDFPU)) {
613 put_psr(get_psr() | PSR_EF); 613 put_psr(get_psr() | PSR_EF);
614 fpsave(&current->thread.float_regs[0], &current->thread.fsr, 614 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
615 &current->thread.fpqueue[0], &current->thread.fpqdepth); 615 &current->thread.fpqueue[0], &current->thread.fpqdepth);
616 if (regs != NULL) { 616 if (regs != NULL) {
617 regs->psr &= ~(PSR_EF); 617 regs->psr &= ~(PSR_EF);
618 current_thread_info()->flags &= ~(_TIF_USEDFPU); 618 clear_thread_flag(TIF_USEDFPU);
619 } 619 }
620 } 620 }
621#else 621#else
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index ea75ca569052..3a69778c8366 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -78,7 +78,8 @@ sys_call_table:
78/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 78/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
79/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 79/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
80/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 80/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
81/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages 81/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
82/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
82 83
83#ifdef CONFIG_SUNOS_EMUL 84#ifdef CONFIG_SUNOS_EMUL
84 /* Now the SunOS syscall table. */ 85 /* Now the SunOS syscall table. */
@@ -192,5 +193,8 @@ sunos_sys_table:
192 .long sunos_nosys, sunos_nosys, sunos_nosys 193 .long sunos_nosys, sunos_nosys, sunos_nosys
193 .long sunos_nosys 194 .long sunos_nosys
194/*300*/ .long sunos_nosys, sunos_nosys, sunos_nosys 195/*300*/ .long sunos_nosys, sunos_nosys, sunos_nosys
196 .long sunos_nosys, sunos_nosys, sunos_nosys
197 .long sunos_nosys, sunos_nosys, sunos_nosys
198 .long sunos_nosys
195 199
196#endif 200#endif
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 6a70d215fd04..527687afc1c4 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
259 } else { 259 } else {
260 fpload(&current->thread.float_regs[0], &current->thread.fsr); 260 fpload(&current->thread.float_regs[0], &current->thread.fsr);
261 } 261 }
262 current_thread_info()->flags |= _TIF_USEDFPU; 262 set_thread_flag(TIF_USEDFPU);
263#endif 263#endif
264} 264}
265 265
@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
290#ifndef CONFIG_SMP 290#ifndef CONFIG_SMP
291 if(!fpt) { 291 if(!fpt) {
292#else 292#else
293 if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) { 293 if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
294#endif 294#endif
295 fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth); 295 fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
296 regs->psr &= ~PSR_EF; 296 regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
333 /* nope, better SIGFPE the offending process... */ 333 /* nope, better SIGFPE the offending process... */
334 334
335#ifdef CONFIG_SMP 335#ifdef CONFIG_SMP
336 task_thread_info(fpt)->flags &= ~_TIF_USEDFPU; 336 clear_tsk_thread_flag(fpt, TIF_USEDFPU);
337#endif 337#endif
338 if(psr & PSR_PS) { 338 if(psr & PSR_PS) {
339 /* The first fsr store/load we tried trapped, 339 /* The first fsr store/load we tried trapped,
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index 53ddcd9d1e60..559335f4917d 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -52,6 +52,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
52 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 52 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
53 return ret; 53 return ret;
54} 54}
55EXPORT_SYMBOL(atomic_cmpxchg);
55 56
56int atomic_add_unless(atomic_t *v, int a, int u) 57int atomic_add_unless(atomic_t *v, int a, int u)
57{ 58{
@@ -65,6 +66,7 @@ int atomic_add_unless(atomic_t *v, int a, int u)
65 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 66 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
66 return ret != u; 67 return ret != u;
67} 68}
69EXPORT_SYMBOL(atomic_add_unless);
68 70
69/* Atomic operations are already serializing */ 71/* Atomic operations are already serializing */
70void atomic_set(atomic_t *v, int i) 72void atomic_set(atomic_t *v, int i)
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
index c85ddf312747..a532922e2e35 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -75,7 +75,7 @@ void show_mem(void)
75 printk("Free swap: %6ldkB\n", 75 printk("Free swap: %6ldkB\n",
76 nr_swap_pages << (PAGE_SHIFT-10)); 76 nr_swap_pages << (PAGE_SHIFT-10));
77 printk("%ld pages of RAM\n", totalram_pages); 77 printk("%ld pages of RAM\n", totalram_pages);
78 printk("%d free pages\n", nr_free_pages()); 78 printk("%ld free pages\n", nr_free_pages());
79#if 0 /* undefined pgtable_cache_size, pgd_cache_size */ 79#if 0 /* undefined pgtable_cache_size, pgd_cache_size */
80 printk("%ld pages in page table cache\n",pgtable_cache_size); 80 printk("%ld pages in page table cache\n",pgtable_cache_size);
81#ifndef CONFIG_SMP 81#ifndef CONFIG_SMP
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index f75a686ba644..1a6348b565fb 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -136,18 +136,6 @@ config SMP
136 136
137 If you don't know what to do here, say N. 137 If you don't know what to do here, say N.
138 138
139config PREEMPT
140 bool "Preemptible Kernel"
141 help
142 This option reduces the latency of the kernel when reacting to
143 real-time or interactive events by allowing a low priority process to
144 be preempted even if it is in kernel mode executing a system call.
145 This allows applications to run more reliably even when the system is
146 under load.
147
148 Say Y here if you are building a kernel for a desktop, embedded
149 or real-time system. Say N if you are unsure.
150
151config NR_CPUS 139config NR_CPUS
152 int "Maximum number of CPUs (2-64)" 140 int "Maximum number of CPUs (2-64)"
153 range 2 64 141 range 2 64
@@ -399,6 +387,8 @@ config SCHED_SMT
399 when dealing with UltraSPARC cpus at a cost of slightly increased 387 when dealing with UltraSPARC cpus at a cost of slightly increased
400 overhead in some places. If unsure say N here. 388 overhead in some places. If unsure say N here.
401 389
390source "kernel/Kconfig.preempt"
391
402config CMDLINE_BOOL 392config CMDLINE_BOOL
403 bool "Default bootloader kernel arguments" 393 bool "Default bootloader kernel arguments"
404 394
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 860b8b60526c..120c9c33b7a6 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.21-rc2 3# Linux kernel version: 2.6.21-rc4
4# Wed Feb 28 09:50:51 2007 4# Sat Mar 17 14:18:44 2007
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -50,6 +50,7 @@ CONFIG_POSIX_MQUEUE=y
50# CONFIG_IKCONFIG is not set 50# CONFIG_IKCONFIG is not set
51CONFIG_SYSFS_DEPRECATED=y 51CONFIG_SYSFS_DEPRECATED=y
52CONFIG_RELAY=y 52CONFIG_RELAY=y
53# CONFIG_BLK_DEV_INITRD is not set
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
54CONFIG_SYSCTL=y 55CONFIG_SYSCTL=y
55# CONFIG_EMBEDDED is not set 56# CONFIG_EMBEDDED is not set
@@ -108,7 +109,6 @@ CONFIG_GENERIC_HARDIRQS=y
108# General machine setup 109# General machine setup
109# 110#
110# CONFIG_SMP is not set 111# CONFIG_SMP is not set
111# CONFIG_PREEMPT is not set
112CONFIG_CPU_FREQ=y 112CONFIG_CPU_FREQ=y
113CONFIG_CPU_FREQ_TABLE=m 113CONFIG_CPU_FREQ_TABLE=m
114# CONFIG_CPU_FREQ_DEBUG is not set 114# CONFIG_CPU_FREQ_DEBUG is not set
@@ -165,6 +165,9 @@ CONFIG_BINFMT_ELF32=y
165CONFIG_BINFMT_ELF=y 165CONFIG_BINFMT_ELF=y
166CONFIG_BINFMT_MISC=m 166CONFIG_BINFMT_MISC=m
167CONFIG_SOLARIS_EMUL=y 167CONFIG_SOLARIS_EMUL=y
168# CONFIG_PREEMPT_NONE is not set
169CONFIG_PREEMPT_VOLUNTARY=y
170# CONFIG_PREEMPT is not set
168# CONFIG_CMDLINE_BOOL is not set 171# CONFIG_CMDLINE_BOOL is not set
169 172
170# 173#
@@ -340,7 +343,6 @@ CONFIG_BLK_DEV_NBD=m
340# CONFIG_BLK_DEV_SX8 is not set 343# CONFIG_BLK_DEV_SX8 is not set
341# CONFIG_BLK_DEV_UB is not set 344# CONFIG_BLK_DEV_UB is not set
342# CONFIG_BLK_DEV_RAM is not set 345# CONFIG_BLK_DEV_RAM is not set
343# CONFIG_BLK_DEV_INITRD is not set
344CONFIG_CDROM_PKTCDVD=m 346CONFIG_CDROM_PKTCDVD=m
345CONFIG_CDROM_PKTCDVD_BUFFERS=8 347CONFIG_CDROM_PKTCDVD_BUFFERS=8
346CONFIG_CDROM_PKTCDVD_WCACHE=y 348CONFIG_CDROM_PKTCDVD_WCACHE=y
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc64/kernel/ktlb.S
index e492db845ea3..d4024ac0d619 100644
--- a/arch/sparc64/kernel/ktlb.S
+++ b/arch/sparc64/kernel/ktlb.S
@@ -138,9 +138,15 @@ kvmap_dtlb_4v:
138 brgez,pn %g4, kvmap_dtlb_nonlinear 138 brgez,pn %g4, kvmap_dtlb_nonlinear
139 nop 139 nop
140 140
141#ifdef CONFIG_DEBUG_PAGEALLOC
142 /* Index through the base page size TSB even for linear
143 * mappings when using page allocation debugging.
144 */
145 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load)
146#else
141 /* Correct TAG_TARGET is already in %g6, check 4mb TSB. */ 147 /* Correct TAG_TARGET is already in %g6, check 4mb TSB. */
142 KERN_TSB4M_LOOKUP_TL1(%g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) 148 KERN_TSB4M_LOOKUP_TL1(%g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load)
143 149#endif
144 /* TSB entry address left in %g1, lookup linear PTE. 150 /* TSB entry address left in %g1, lookup linear PTE.
145 * Must preserve %g1 and %g6 (TAG). 151 * Must preserve %g1 and %g6 (TAG).
146 */ 152 */
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 7d75cd4eb297..b291060c25a6 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -413,8 +413,13 @@ void flush_thread(void)
413 struct thread_info *t = current_thread_info(); 413 struct thread_info *t = current_thread_info();
414 struct mm_struct *mm; 414 struct mm_struct *mm;
415 415
416 if (t->flags & _TIF_ABI_PENDING) 416 if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
417 t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); 417 clear_ti_thread_flag(t, TIF_ABI_PENDING);
418 if (test_ti_thread_flag(t, TIF_32BIT))
419 clear_ti_thread_flag(t, TIF_32BIT);
420 else
421 set_ti_thread_flag(t, TIF_32BIT);
422 }
418 423
419 mm = t->task->mm; 424 mm = t->task->mm;
420 if (mm) 425 if (mm)
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 948b7d2d5874..aaeb5e06735c 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -79,7 +79,8 @@ sys_call_table32:
79 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64 79 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
80/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 80/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
81 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 81 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
82/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages 82/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy
83 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait
83 84
84#endif /* CONFIG_COMPAT */ 85#endif /* CONFIG_COMPAT */
85 86
@@ -149,7 +150,8 @@ sys_call_table:
149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 150 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
150/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 151/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 152 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
152/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages 153/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
154 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
153 155
154#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 156#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
155 defined(CONFIG_SOLARIS_EMUL_MODULE) 157 defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -264,5 +266,8 @@ sunos_sys_table:
264 .word sunos_nosys, sunos_nosys, sunos_nosys 266 .word sunos_nosys, sunos_nosys, sunos_nosys
265 .word sunos_nosys 267 .word sunos_nosys
266/*300*/ .word sunos_nosys, sunos_nosys, sunos_nosys 268/*300*/ .word sunos_nosys, sunos_nosys, sunos_nosys
269 .word sunos_nosys, sunos_nosys, sunos_nosys
270 .word sunos_nosys, sunos_nosys, sunos_nosys
271 .word sunos_nosys
267 272
268#endif 273#endif
diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc64/kernel/tsb.S
index eedf94fa5664..10adb2fb8ffe 100644
--- a/arch/sparc64/kernel/tsb.S
+++ b/arch/sparc64/kernel/tsb.S
@@ -546,6 +546,7 @@ NGtsb_init:
546 subcc %o1, 0x100, %o1 546 subcc %o1, 0x100, %o1
547 bne,pt %xcc, 1b 547 bne,pt %xcc, 1b
548 add %o0, 0x100, %o0 548 add %o0, 0x100, %o0
549 membar #Sync
549 retl 550 retl
550 wr %g2, 0x0, %asi 551 wr %g2, 0x0, %asi
551 .size NGtsb_init, .-NGtsb_init 552 .size NGtsb_init, .-NGtsb_init
diff --git a/arch/sparc64/lib/NGbzero.S b/arch/sparc64/lib/NGbzero.S
index e86baece5cc8..f10e4529ee37 100644
--- a/arch/sparc64/lib/NGbzero.S
+++ b/arch/sparc64/lib/NGbzero.S
@@ -88,6 +88,7 @@ NGbzero_loop:
88 bne,pt %xcc, NGbzero_loop 88 bne,pt %xcc, NGbzero_loop
89 add %o0, 64, %o0 89 add %o0, 64, %o0
90 90
91 membar #Sync
91 wr %o4, 0x0, %asi 92 wr %o4, 0x0, %asi
92 brz,pn %o1, NGbzero_done 93 brz,pn %o1, NGbzero_done
93NGbzero_medium: 94NGbzero_medium:
diff --git a/arch/sparc64/lib/NGmemcpy.S b/arch/sparc64/lib/NGmemcpy.S
index 8e522b3dc095..66063a9a66b8 100644
--- a/arch/sparc64/lib/NGmemcpy.S
+++ b/arch/sparc64/lib/NGmemcpy.S
@@ -247,6 +247,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
247 /* fall through */ 247 /* fall through */
248 248
24960: 24960:
250 membar #Sync
251
250 /* %o2 contains any final bytes still needed to be copied 252 /* %o2 contains any final bytes still needed to be copied
251 * over. If anything is left, we copy it one byte at a time. 253 * over. If anything is left, we copy it one byte at a time.
252 */ 254 */
diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc64/lib/NGpage.S
index 7d7c3bb8dcbf..8ce3a0c9c537 100644
--- a/arch/sparc64/lib/NGpage.S
+++ b/arch/sparc64/lib/NGpage.S
@@ -41,6 +41,7 @@ NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
41 subcc %g7, 64, %g7 41 subcc %g7, 64, %g7
42 bne,pt %xcc, 1b 42 bne,pt %xcc, 1b
43 add %o0, 32, %o0 43 add %o0, 32, %o0
44 membar #Sync
44 retl 45 retl
45 nop 46 nop
46 47
@@ -63,6 +64,7 @@ NGclear_user_page: /* %o0=dest, %o1=vaddr */
63 subcc %g7, 64, %g7 64 subcc %g7, 64, %g7
64 bne,pt %xcc, 1b 65 bne,pt %xcc, 1b
65 add %o0, 32, %o0 66 add %o0, 32, %o0
67 membar #Sync
66 retl 68 retl
67 nop 69 nop
68 70
diff --git a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c
index 33fd0b265e70..00677b5e1d7d 100644
--- a/arch/sparc64/mm/hugetlbpage.c
+++ b/arch/sparc64/mm/hugetlbpage.c
@@ -248,6 +248,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
248 if (!pte_present(*ptep) && pte_present(entry)) 248 if (!pte_present(*ptep) && pte_present(entry))
249 mm->context.huge_pte_count++; 249 mm->context.huge_pte_count++;
250 250
251 addr &= HPAGE_MASK;
251 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { 252 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
252 set_pte_at(mm, addr, ptep, entry); 253 set_pte_at(mm, addr, ptep, entry);
253 ptep++; 254 ptep++;
@@ -266,6 +267,8 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
266 if (pte_present(entry)) 267 if (pte_present(entry))
267 mm->context.huge_pte_count--; 268 mm->context.huge_pte_count--;
268 269
270 addr &= HPAGE_MASK;
271
269 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { 272 for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
270 pte_clear(mm, addr, ptep); 273 pte_clear(mm, addr, ptep);
271 addr += PAGE_SIZE; 274 addr += PAGE_SIZE;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index b1a1ee0cc6bd..f146071a4b2a 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -59,8 +59,10 @@ unsigned long kern_linear_pte_xor[2] __read_mostly;
59 */ 59 */
60unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; 60unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)];
61 61
62#ifndef CONFIG_DEBUG_PAGEALLOC
62/* A special kernel TSB for 4MB and 256MB linear mappings. */ 63/* A special kernel TSB for 4MB and 256MB linear mappings. */
63struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES]; 64struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES];
65#endif
64 66
65#define MAX_BANKS 32 67#define MAX_BANKS 32
66 68
@@ -1301,7 +1303,12 @@ static void __init tsb_phys_patch(void)
1301} 1303}
1302 1304
1303/* Don't mark as init, we give this to the Hypervisor. */ 1305/* Don't mark as init, we give this to the Hypervisor. */
1304static struct hv_tsb_descr ktsb_descr[2]; 1306#ifndef CONFIG_DEBUG_PAGEALLOC
1307#define NUM_KTSB_DESCR 2
1308#else
1309#define NUM_KTSB_DESCR 1
1310#endif
1311static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR];
1305extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; 1312extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES];
1306 1313
1307static void __init sun4v_ktsb_init(void) 1314static void __init sun4v_ktsb_init(void)
@@ -1340,6 +1347,7 @@ static void __init sun4v_ktsb_init(void)
1340 ktsb_descr[0].tsb_base = ktsb_pa; 1347 ktsb_descr[0].tsb_base = ktsb_pa;
1341 ktsb_descr[0].resv = 0; 1348 ktsb_descr[0].resv = 0;
1342 1349
1350#ifndef CONFIG_DEBUG_PAGEALLOC
1343 /* Second KTSB for 4MB/256MB mappings. */ 1351 /* Second KTSB for 4MB/256MB mappings. */
1344 ktsb_pa = (kern_base + 1352 ktsb_pa = (kern_base +
1345 ((unsigned long)&swapper_4m_tsb[0] - KERNBASE)); 1353 ((unsigned long)&swapper_4m_tsb[0] - KERNBASE));
@@ -1352,6 +1360,7 @@ static void __init sun4v_ktsb_init(void)
1352 ktsb_descr[1].ctx_idx = 0; 1360 ktsb_descr[1].ctx_idx = 0;
1353 ktsb_descr[1].tsb_base = ktsb_pa; 1361 ktsb_descr[1].tsb_base = ktsb_pa;
1354 ktsb_descr[1].resv = 0; 1362 ktsb_descr[1].resv = 0;
1363#endif
1355} 1364}
1356 1365
1357void __cpuinit sun4v_ktsb_register(void) 1366void __cpuinit sun4v_ktsb_register(void)
@@ -1364,7 +1373,7 @@ void __cpuinit sun4v_ktsb_register(void)
1364 pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); 1373 pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE);
1365 1374
1366 func = HV_FAST_MMU_TSB_CTX0; 1375 func = HV_FAST_MMU_TSB_CTX0;
1367 arg0 = 2; 1376 arg0 = NUM_KTSB_DESCR;
1368 arg1 = pa; 1377 arg1 = pa;
1369 __asm__ __volatile__("ta %6" 1378 __asm__ __volatile__("ta %6"
1370 : "=&r" (func), "=&r" (arg0), "=&r" (arg1) 1379 : "=&r" (func), "=&r" (arg0), "=&r" (arg1)
@@ -1393,7 +1402,9 @@ void __init paging_init(void)
1393 1402
1394 /* Invalidate both kernel TSBs. */ 1403 /* Invalidate both kernel TSBs. */
1395 memset(swapper_tsb, 0x40, sizeof(swapper_tsb)); 1404 memset(swapper_tsb, 0x40, sizeof(swapper_tsb));
1405#ifndef CONFIG_DEBUG_PAGEALLOC
1396 memset(swapper_4m_tsb, 0x40, sizeof(swapper_4m_tsb)); 1406 memset(swapper_4m_tsb, 0x40, sizeof(swapper_4m_tsb));
1407#endif
1397 1408
1398 if (tlb_type == hypervisor) 1409 if (tlb_type == hypervisor)
1399 sun4v_pgprot_init(); 1410 sun4v_pgprot_init();
@@ -1725,8 +1736,13 @@ static void __init sun4u_pgprot_init(void)
1725 pg_iobits = (_PAGE_VALID | _PAGE_PRESENT_4U | __DIRTY_BITS_4U | 1736 pg_iobits = (_PAGE_VALID | _PAGE_PRESENT_4U | __DIRTY_BITS_4U |
1726 __ACCESS_BITS_4U | _PAGE_E_4U); 1737 __ACCESS_BITS_4U | _PAGE_E_4U);
1727 1738
1739#ifdef CONFIG_DEBUG_PAGEALLOC
1740 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZBITS_4U) ^
1741 0xfffff80000000000;
1742#else
1728 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4U) ^ 1743 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4U) ^
1729 0xfffff80000000000; 1744 0xfffff80000000000;
1745#endif
1730 kern_linear_pte_xor[0] |= (_PAGE_CP_4U | _PAGE_CV_4U | 1746 kern_linear_pte_xor[0] |= (_PAGE_CP_4U | _PAGE_CV_4U |
1731 _PAGE_P_4U | _PAGE_W_4U); 1747 _PAGE_P_4U | _PAGE_W_4U);
1732 1748
@@ -1769,13 +1785,23 @@ static void __init sun4v_pgprot_init(void)
1769 _PAGE_E = _PAGE_E_4V; 1785 _PAGE_E = _PAGE_E_4V;
1770 _PAGE_CACHE = _PAGE_CACHE_4V; 1786 _PAGE_CACHE = _PAGE_CACHE_4V;
1771 1787
1788#ifdef CONFIG_DEBUG_PAGEALLOC
1789 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZBITS_4V) ^
1790 0xfffff80000000000;
1791#else
1772 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^ 1792 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^
1773 0xfffff80000000000; 1793 0xfffff80000000000;
1794#endif
1774 kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V | 1795 kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V |
1775 _PAGE_P_4V | _PAGE_W_4V); 1796 _PAGE_P_4V | _PAGE_W_4V);
1776 1797
1798#ifdef CONFIG_DEBUG_PAGEALLOC
1799 kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZBITS_4V) ^
1800 0xfffff80000000000;
1801#else
1777 kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^ 1802 kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^
1778 0xfffff80000000000; 1803 0xfffff80000000000;
1804#endif
1779 kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V | 1805 kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V |
1780 _PAGE_P_4V | _PAGE_W_4V); 1806 _PAGE_P_4V | _PAGE_W_4V);
1781 1807
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index b3a21ba77cd2..354cc6b70530 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -44,7 +44,7 @@ config LOCKDEP_SUPPORT
44 44
45config STACKTRACE_SUPPORT 45config STACKTRACE_SUPPORT
46 bool 46 bool
47 default y 47 default n
48 48
49config GENERIC_CALIBRATE_DELAY 49config GENERIC_CALIBRATE_DELAY
50 bool 50 bool
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 7b8baf146acc..9fdfad649536 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -236,11 +236,11 @@ void free_irqs(void)
236 struct chan *chan; 236 struct chan *chan;
237 LIST_HEAD(list); 237 LIST_HEAD(list);
238 struct list_head *ele; 238 struct list_head *ele;
239 unsigned long flags;
239 240
240 spin_lock_irq(&irqs_to_free_lock); 241 spin_lock_irqsave(&irqs_to_free_lock, flags);
241 list_splice_init(&irqs_to_free, &list); 242 list_splice_init(&irqs_to_free, &list);
242 INIT_LIST_HEAD(&irqs_to_free); 243 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
243 spin_unlock_irq(&irqs_to_free_lock);
244 244
245 list_for_each(ele, &list){ 245 list_for_each(ele, &list){
246 chan = list_entry(ele, struct chan, free_list); 246 chan = list_entry(ele, struct chan, free_list);
@@ -255,13 +255,15 @@ void free_irqs(void)
255 255
256static void close_one_chan(struct chan *chan, int delay_free_irq) 256static void close_one_chan(struct chan *chan, int delay_free_irq)
257{ 257{
258 unsigned long flags;
259
258 if(!chan->opened) 260 if(!chan->opened)
259 return; 261 return;
260 262
261 if(delay_free_irq){ 263 if(delay_free_irq){
262 spin_lock_irq(&irqs_to_free_lock); 264 spin_lock_irqsave(&irqs_to_free_lock, flags);
263 list_add(&chan->free_list, &irqs_to_free); 265 list_add(&chan->free_list, &irqs_to_free);
264 spin_unlock_irq(&irqs_to_free_lock); 266 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
265 } 267 }
266 else { 268 else {
267 if(chan->input) 269 if(chan->input)
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 310af0f1e49e..021b82c7a759 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -56,30 +56,31 @@ static int connect_to_switch(struct daemon_data *pri)
56 56
57 pri->control = socket(AF_UNIX, SOCK_STREAM, 0); 57 pri->control = socket(AF_UNIX, SOCK_STREAM, 0);
58 if(pri->control < 0){ 58 if(pri->control < 0){
59 err = -errno;
59 printk("daemon_open : control socket failed, errno = %d\n", 60 printk("daemon_open : control socket failed, errno = %d\n",
60 errno); 61 -err);
61 return(-errno); 62 return err;
62 } 63 }
63 64
64 if(connect(pri->control, (struct sockaddr *) ctl_addr, 65 if(connect(pri->control, (struct sockaddr *) ctl_addr,
65 sizeof(*ctl_addr)) < 0){ 66 sizeof(*ctl_addr)) < 0){
66 printk("daemon_open : control connect failed, errno = %d\n",
67 errno);
68 err = -errno; 67 err = -errno;
68 printk("daemon_open : control connect failed, errno = %d\n",
69 -err);
69 goto out; 70 goto out;
70 } 71 }
71 72
72 fd = socket(AF_UNIX, SOCK_DGRAM, 0); 73 fd = socket(AF_UNIX, SOCK_DGRAM, 0);
73 if(fd < 0){ 74 if(fd < 0){
74 printk("daemon_open : data socket failed, errno = %d\n",
75 errno);
76 err = -errno; 75 err = -errno;
76 printk("daemon_open : data socket failed, errno = %d\n",
77 -err);
77 goto out; 78 goto out;
78 } 79 }
79 if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){ 80 if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){
80 printk("daemon_open : data bind failed, errno = %d\n",
81 errno);
82 err = -errno; 81 err = -errno;
82 printk("daemon_open : data bind failed, errno = %d\n",
83 -err);
83 goto out_close; 84 goto out_close;
84 } 85 }
85 86
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 01d4ab6b0ef1..f75d7b05c481 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -370,10 +370,10 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
370 struct tty_struct *tty = line->tty; 370 struct tty_struct *tty = line->tty;
371 int err; 371 int err;
372 372
373 /* Interrupts are enabled here because we registered the interrupt with 373 /* Interrupts are disabled here because we registered the interrupt with
374 * IRQF_DISABLED (see line_setup_irq).*/ 374 * IRQF_DISABLED (see line_setup_irq).*/
375 375
376 spin_lock_irq(&line->lock); 376 spin_lock(&line->lock);
377 err = flush_buffer(line); 377 err = flush_buffer(line);
378 if (err == 0) { 378 if (err == 0) {
379 return IRQ_NONE; 379 return IRQ_NONE;
@@ -381,7 +381,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
381 line->head = line->buffer; 381 line->head = line->buffer;
382 line->tail = line->buffer; 382 line->tail = line->buffer;
383 } 383 }
384 spin_unlock_irq(&line->lock); 384 spin_unlock(&line->lock);
385 385
386 if(tty == NULL) 386 if(tty == NULL)
387 return IRQ_NONE; 387 return IRQ_NONE;
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 8138f5ea1bf7..b827e82884c9 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -50,6 +50,14 @@ static void mcast_user_init(void *data, void *dev)
50 pri->dev = dev; 50 pri->dev = dev;
51} 51}
52 52
53static void mcast_remove(void *data)
54{
55 struct mcast_data *pri = data;
56
57 kfree(pri->mcast_addr);
58 pri->mcast_addr = NULL;
59}
60
53static int mcast_open(void *data) 61static int mcast_open(void *data)
54{ 62{
55 struct mcast_data *pri = data; 63 struct mcast_data *pri = data;
@@ -157,7 +165,7 @@ const struct net_user_info mcast_user_info = {
157 .init = mcast_user_init, 165 .init = mcast_user_init,
158 .open = mcast_open, 166 .open = mcast_open,
159 .close = mcast_close, 167 .close = mcast_close,
160 .remove = NULL, 168 .remove = mcast_remove,
161 .set_mtu = mcast_set_mtu, 169 .set_mtu = mcast_set_mtu,
162 .add_address = NULL, 170 .add_address = NULL,
163 .delete_address = NULL, 171 .delete_address = NULL,
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 178b2eff4a8c..65ad2932672c 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -615,6 +615,9 @@ void mconsole_remove(struct mc_request *req)
615 err_msg = NULL; 615 err_msg = NULL;
616 err = (*dev->remove)(n, &err_msg); 616 err = (*dev->remove)(n, &err_msg);
617 switch(err){ 617 switch(err){
618 case 0:
619 err_msg = "";
620 break;
618 case -ENODEV: 621 case -ENODEV:
619 if(err_msg == NULL) 622 if(err_msg == NULL)
620 err_msg = "Device doesn't exist"; 623 err_msg = "Device doesn't exist";
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index fc22b9bd9153..4b382a6e710f 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -179,7 +179,7 @@ static struct console ssl_cons = {
179 .write = ssl_console_write, 179 .write = ssl_console_write,
180 .device = ssl_console_device, 180 .device = ssl_console_device,
181 .setup = ssl_console_setup, 181 .setup = ssl_console_setup,
182 .flags = CON_PRINTBUFFER, 182 .flags = CON_PRINTBUFFER|CON_ANYTIME,
183 .index = -1, 183 .index = -1,
184}; 184};
185 185
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 7ff0b0fc37e7..76d1f1c980ef 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -153,7 +153,7 @@ static struct console stdiocons = {
153 .write = uml_console_write, 153 .write = uml_console_write,
154 .device = uml_console_device, 154 .device = uml_console_device,
155 .setup = uml_console_setup, 155 .setup = uml_console_setup,
156 .flags = CON_PRINTBUFFER, 156 .flags = CON_PRINTBUFFER|CON_ANYTIME,
157 .index = -1, 157 .index = -1,
158}; 158};
159 159
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index f98d26e51381..8bd9204ac1ab 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -109,10 +109,6 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
109 109
110static DEFINE_MUTEX(ubd_lock); 110static DEFINE_MUTEX(ubd_lock);
111 111
112/* XXX - this made sense in 2.4 days, now it's only used as a boolean, and
113 * probably it doesn't make sense even for that. */
114static int do_ubd;
115
116static int ubd_open(struct inode * inode, struct file * filp); 112static int ubd_open(struct inode * inode, struct file * filp);
117static int ubd_release(struct inode * inode, struct file * file); 113static int ubd_release(struct inode * inode, struct file * file);
118static int ubd_ioctl(struct inode * inode, struct file * file, 114static int ubd_ioctl(struct inode * inode, struct file * file,
@@ -169,6 +165,7 @@ struct ubd {
169 struct platform_device pdev; 165 struct platform_device pdev;
170 struct request_queue *queue; 166 struct request_queue *queue;
171 spinlock_t lock; 167 spinlock_t lock;
168 int active;
172}; 169};
173 170
174#define DEFAULT_COW { \ 171#define DEFAULT_COW { \
@@ -190,6 +187,7 @@ struct ubd {
190 .shared = 0, \ 187 .shared = 0, \
191 .cow = DEFAULT_COW, \ 188 .cow = DEFAULT_COW, \
192 .lock = SPIN_LOCK_UNLOCKED, \ 189 .lock = SPIN_LOCK_UNLOCKED, \
190 .active = 0, \
193} 191}
194 192
195/* Protected by ubd_lock */ 193/* Protected by ubd_lock */
@@ -507,7 +505,6 @@ static void ubd_handler(void)
507 struct ubd *dev; 505 struct ubd *dev;
508 int n; 506 int n;
509 507
510 do_ubd = 0;
511 n = os_read_file(thread_fd, &req, sizeof(req)); 508 n = os_read_file(thread_fd, &req, sizeof(req));
512 if(n != sizeof(req)){ 509 if(n != sizeof(req)){
513 printk(KERN_ERR "Pid %d - spurious interrupt in ubd_handler, " 510 printk(KERN_ERR "Pid %d - spurious interrupt in ubd_handler, "
@@ -517,6 +514,7 @@ static void ubd_handler(void)
517 514
518 rq = req.req; 515 rq = req.req;
519 dev = rq->rq_disk->private_data; 516 dev = rq->rq_disk->private_data;
517 dev->active = 0;
520 518
521 ubd_finish(rq, req.error); 519 ubd_finish(rq, req.error);
522 reactivate_fd(thread_fd, UBD_IRQ); 520 reactivate_fd(thread_fd, UBD_IRQ);
@@ -1081,11 +1079,12 @@ static void do_ubd_request(request_queue_t *q)
1081 } 1079 }
1082 } 1080 }
1083 else { 1081 else {
1084 if(do_ubd || (req = elv_next_request(q)) == NULL) 1082 struct ubd *dev = q->queuedata;
1083 if(dev->active || (req = elv_next_request(q)) == NULL)
1085 return; 1084 return;
1086 err = prepare_request(req, &io_req); 1085 err = prepare_request(req, &io_req);
1087 if(!err){ 1086 if(!err){
1088 do_ubd = 1; 1087 dev->active = 1;
1089 n = os_write_file(thread_fd, (char *) &io_req, 1088 n = os_write_file(thread_fd, (char *) &io_req,
1090 sizeof(io_req)); 1089 sizeof(io_req));
1091 if(n != sizeof(io_req)) 1090 if(n != sizeof(io_req))
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h
index 2666815b6af5..b282839c1625 100644
--- a/arch/um/include/mconsole.h
+++ b/arch/um/include/mconsole.h
@@ -12,6 +12,8 @@
12#define u32 uint32_t 12#define u32 uint32_t
13#endif 13#endif
14 14
15#include "sysdep/ptrace.h"
16
15#define MCONSOLE_MAGIC (0xcafebabe) 17#define MCONSOLE_MAGIC (0xcafebabe)
16#define MCONSOLE_MAX_DATA (512) 18#define MCONSOLE_MAX_DATA (512)
17#define MCONSOLE_VERSION 2 19#define MCONSOLE_VERSION 2
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 8629bd191492..5c74da410451 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -192,7 +192,9 @@ extern int os_process_parent(int pid);
192extern void os_stop_process(int pid); 192extern void os_stop_process(int pid);
193extern void os_kill_process(int pid, int reap_child); 193extern void os_kill_process(int pid, int reap_child);
194extern void os_kill_ptraced_process(int pid, int reap_child); 194extern void os_kill_ptraced_process(int pid, int reap_child);
195#ifdef UML_CONFIG_MODE_TT
195extern void os_usr1_process(int pid); 196extern void os_usr1_process(int pid);
197#endif
196extern long os_ptrace_ldt(long pid, long addr, long data); 198extern long os_ptrace_ldt(long pid, long addr, long data);
197 199
198extern int os_getpid(void); 200extern int os_getpid(void);
@@ -261,7 +263,6 @@ extern void block_signals(void);
261extern void unblock_signals(void); 263extern void unblock_signals(void);
262extern int get_signals(void); 264extern int get_signals(void);
263extern int set_signals(int enable); 265extern int set_signals(int enable);
264extern void os_usr1_signal(int on);
265 266
266/* trap.c */ 267/* trap.c */
267extern void os_fill_handlinfo(struct kern_handlers h); 268extern void os_fill_handlinfo(struct kern_handlers h);
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
index 66cb400c2c92..62403bd99661 100644
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -104,10 +104,6 @@ union uml_pt_regs {
104#endif 104#endif
105#ifdef UML_CONFIG_MODE_SKAS 105#ifdef UML_CONFIG_MODE_SKAS
106 struct skas_regs { 106 struct skas_regs {
107 /* x86_64 ptrace uses sizeof(user_regs_struct) as its register
108 * file size, while i386 uses FRAME_SIZE. Therefore, we need
109 * to use UM_FRAME_SIZE here instead of HOST_FRAME_SIZE.
110 */
111 unsigned long regs[MAX_REG_NR]; 107 unsigned long regs[MAX_REG_NR];
112 unsigned long fp[HOST_FP_SIZE]; 108 unsigned long fp[HOST_FP_SIZE];
113 struct faultinfo faultinfo; 109 struct faultinfo faultinfo;
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 50a288bb875a..dbf2f5bc842f 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -142,6 +142,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
142 .events = events, 142 .events = events,
143 .current_events = 0 } ); 143 .current_events = 0 } );
144 144
145 err = -EBUSY;
145 spin_lock_irqsave(&irq_lock, flags); 146 spin_lock_irqsave(&irq_lock, flags);
146 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { 147 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) {
147 if ((irq_fd->fd == fd) && (irq_fd->type == type)) { 148 if ((irq_fd->fd == fd) && (irq_fd->type == type)) {
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index e85d65deea0d..df7d662b98ce 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -64,8 +64,6 @@ static void setup_highmem(unsigned long highmem_start,
64 64
65void mem_init(void) 65void mem_init(void)
66{ 66{
67 max_low_pfn = (high_physmem - uml_physmem) >> PAGE_SHIFT;
68
69 /* clear the zero-page */ 67 /* clear the zero-page */
70 memset((void *) empty_zero_page, 0, PAGE_SIZE); 68 memset((void *) empty_zero_page, 0, PAGE_SIZE);
71 69
@@ -80,6 +78,7 @@ void mem_init(void)
80 78
81 /* this will put all low memory onto the freelists */ 79 /* this will put all low memory onto the freelists */
82 totalram_pages = free_all_bootmem(); 80 totalram_pages = free_all_bootmem();
81 max_low_pfn = totalram_pages;
83#ifdef CONFIG_HIGHMEM 82#ifdef CONFIG_HIGHMEM
84 totalhigh_pages = highmem >> PAGE_SHIFT; 83 totalhigh_pages = highmem >> PAGE_SHIFT;
85 totalram_pages += totalhigh_pages; 84 totalram_pages += totalhigh_pages;
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index c692a192957a..76bdd6712417 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -21,6 +21,7 @@
21#include "longjmp.h" 21#include "longjmp.h"
22#include "skas_ptrace.h" 22#include "skas_ptrace.h"
23#include "kern_constants.h" 23#include "kern_constants.h"
24#include "uml-config.h"
24 25
25#define ARBITRARY_ADDR -1 26#define ARBITRARY_ADDR -1
26#define FAILURE_PID -1 27#define FAILURE_PID -1
@@ -131,10 +132,12 @@ void os_kill_ptraced_process(int pid, int reap_child)
131 CATCH_EINTR(waitpid(pid, NULL, 0)); 132 CATCH_EINTR(waitpid(pid, NULL, 0));
132} 133}
133 134
135#ifdef UML_CONFIG_MODE_TT
134void os_usr1_process(int pid) 136void os_usr1_process(int pid)
135{ 137{
136 kill(pid, SIGUSR1); 138 kill(pid, SIGUSR1);
137} 139}
140#endif
138 141
139/* Don't use the glibc version, which caches the result in TLS. It misses some 142/* Don't use the glibc version, which caches the result in TLS. It misses some
140 * syscalls, and also breaks with clone(), which does not unshare the TLS. 143 * syscalls, and also breaks with clone(), which does not unshare the TLS.
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index b897e8592d77..266768629fee 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -243,8 +243,3 @@ int set_signals(int enable)
243 243
244 return ret; 244 return ret;
245} 245}
246
247void os_usr1_signal(int on)
248{
249 change_sig(SIGUSR1, on);
250}
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index b3c11cfa995a..9383e8751ae7 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -48,7 +48,7 @@ int multi_op_count = 0;
48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) 48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
49{ 49{
50 unsigned long regs[MAX_REG_NR]; 50 unsigned long regs[MAX_REG_NR];
51 int n; 51 int n, i;
52 long ret, offset; 52 long ret, offset;
53 unsigned long * data; 53 unsigned long * data;
54 unsigned long * syscall; 54 unsigned long * syscall;
@@ -66,9 +66,13 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
66 (unsigned long) &__syscall_stub_start); 66 (unsigned long) &__syscall_stub_start);
67 67
68 n = ptrace_setregs(pid, regs); 68 n = ptrace_setregs(pid, regs);
69 if(n < 0) 69 if(n < 0){
70 printk("Registers - \n");
71 for(i = 0; i < MAX_REG_NR; i++)
72 printk("\t%d\t0x%lx\n", i, regs[i]);
70 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", 73 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
71 n); 74 -n);
75 }
72 76
73 wait_stub_done(pid, 0, "do_syscall_stub"); 77 wait_stub_done(pid, 0, "do_syscall_stub");
74 78
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index dda06789bcb0..0564422c155f 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -67,7 +67,7 @@ void wait_stub_done(int pid, int sig, char * fname)
67 67
68 if((n < 0) || !WIFSTOPPED(status) || 68 if((n < 0) || !WIFSTOPPED(status) ||
69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ 69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
70 unsigned long regs[HOST_FRAME_SIZE]; 70 unsigned long regs[MAX_REG_NR];
71 71
72 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 72 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
73 printk("Failed to get registers from stub, " 73 printk("Failed to get registers from stub, "
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, char * fname)
76 int i; 76 int i;
77 77
78 printk("Stub registers -\n"); 78 printk("Stub registers -\n");
79 for(i = 0; i < HOST_FRAME_SIZE; i++) 79 for(i = 0; i < ARRAY_SIZE(regs); i++)
80 printk("\t%d - %lx\n", i, regs[i]); 80 printk("\t%d - %lx\n", i, regs[i]);
81 } 81 }
82 panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 82 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
@@ -328,7 +328,7 @@ void userspace(union uml_pt_regs *regs)
328int copy_context_skas0(unsigned long new_stack, int pid) 328int copy_context_skas0(unsigned long new_stack, int pid)
329{ 329{
330 int err; 330 int err;
331 unsigned long regs[HOST_FRAME_SIZE]; 331 unsigned long regs[MAX_REG_NR];
332 unsigned long fp_regs[HOST_FP_SIZE]; 332 unsigned long fp_regs[HOST_FP_SIZE];
333 unsigned long current_stack = current_stub_stack(); 333 unsigned long current_stack = current_stub_stack();
334 struct stub_data *data = (struct stub_data *) current_stack; 334 struct stub_data *data = (struct stub_data *) current_stack;
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 79cd93c8c5ed..84b44f9cd42a 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -15,7 +15,7 @@
15 15
16/* These are set once at boot time and not changed thereafter */ 16/* These are set once at boot time and not changed thereafter */
17 17
18static unsigned long exec_regs[HOST_FRAME_SIZE]; 18static unsigned long exec_regs[MAX_REG_NR];
19static unsigned long exec_fp_regs[HOST_FP_SIZE]; 19static unsigned long exec_fp_regs[HOST_FP_SIZE];
20static unsigned long exec_fpx_regs[HOST_XFP_SIZE]; 20static unsigned long exec_fpx_regs[HOST_XFP_SIZE];
21static int have_fpx_regs = 1; 21static int have_fpx_regs = 1;
@@ -101,6 +101,7 @@ void init_registers(int pid)
101{ 101{
102 int err; 102 int err;
103 103
104 memset(exec_regs, 0, sizeof(exec_regs));
104 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); 105 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
105 if(err) 106 if(err)
106 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", 107 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
@@ -124,7 +125,7 @@ void init_registers(int pid)
124 125
125void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 126void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
126{ 127{
127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 128 memcpy(regs, exec_regs, sizeof(exec_regs));
128 if(fp_regs != NULL) 129 if(fp_regs != NULL)
129 memcpy(fp_regs, exec_fp_regs, 130 memcpy(fp_regs, exec_fp_regs,
130 HOST_FP_SIZE * sizeof(unsigned long)); 131 HOST_FP_SIZE * sizeof(unsigned long));
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index a2d7e0c603f7..e6fc2179d1bc 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -14,7 +14,7 @@
14 14
15/* These are set once at boot time and not changed thereafter */ 15/* These are set once at boot time and not changed thereafter */
16 16
17static unsigned long exec_regs[HOST_FRAME_SIZE]; 17static unsigned long exec_regs[MAX_REG_NR];
18static unsigned long exec_fp_regs[HOST_FP_SIZE]; 18static unsigned long exec_fp_regs[HOST_FP_SIZE];
19 19
20void init_thread_registers(union uml_pt_regs *to) 20void init_thread_registers(union uml_pt_regs *to)
@@ -72,7 +72,7 @@ void init_registers(int pid)
72 72
73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
74{ 74{
75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 75 memcpy(regs, exec_regs, sizeof(exec_regs));
76 if(fp_regs != NULL) 76 if(fp_regs != NULL)
77 memcpy(fp_regs, exec_fp_regs, 77 memcpy(fp_regs, exec_fp_regs,
78 HOST_FP_SIZE * sizeof(unsigned long)); 78 HOST_FP_SIZE * sizeof(unsigned long));
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index 813077fb1e5b..a9a4b85ca516 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -10,7 +10,7 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
10$(USER_OBJS:.o=.%): \ 10$(USER_OBJS:.o=.%): \
11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(basetarget).o) 11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(basetarget).o)
12$(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 12$(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
13 -Dunix -D__unix__ -D__$(SUBARCH)__ 13 -Dunix -D__unix__ -D__$(SUBARCH)__ $(CF)
14 14
15# These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of 15# These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of
16# using it directly. 16# using it directly.
@@ -19,7 +19,7 @@ UNPROFILE_OBJS := $(foreach file,$(UNPROFILE_OBJS),$(obj)/$(file))
19$(UNPROFILE_OBJS:.o=.%): \ 19$(UNPROFILE_OBJS:.o=.%): \
20 c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(basetarget).o) 20 c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(basetarget).o)
21$(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 21$(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
22 -Dunix -D__unix__ -D__$(SUBARCH)__ 22 -Dunix -D__unix__ -D__$(SUBARCH)__ $(CF)
23 23
24# The stubs and unmap.o can't try to call mcount or update basic block data 24# The stubs and unmap.o can't try to call mcount or update basic block data
25define unprofile 25define unprofile
diff --git a/arch/um/sys-i386/delay.c b/arch/um/sys-i386/delay.c
index 2c11b9770e8b..d623e074f41d 100644
--- a/arch/um/sys-i386/delay.c
+++ b/arch/um/sys-i386/delay.c
@@ -27,14 +27,3 @@ void __udelay(unsigned long usecs)
27} 27}
28 28
29EXPORT_SYMBOL(__udelay); 29EXPORT_SYMBOL(__udelay);
30
31void __const_udelay(unsigned long usecs)
32{
33 int i, n;
34
35 n = (loops_per_jiffy * HZ * usecs) / MILLION;
36 for(i=0;i<n;i++)
37 cpu_relax();
38}
39
40EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 4a8b4202ef9e..a939a7ef0227 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -394,7 +394,8 @@ static short * host_ldt_entries = NULL;
394static void ldt_get_host_info(void) 394static void ldt_get_host_info(void)
395{ 395{
396 long ret; 396 long ret;
397 struct ldt_entry * ldt, *tmp; 397 struct ldt_entry * ldt;
398 short *tmp;
398 int i, size, k, order; 399 int i, size, k, order;
399 400
400 spin_lock(&host_ldt_lock); 401 spin_lock(&host_ldt_lock);
diff --git a/arch/um/sys-x86_64/delay.c b/arch/um/sys-x86_64/delay.c
index 137f4446b439..dee5be66da82 100644
--- a/arch/um/sys-x86_64/delay.c
+++ b/arch/um/sys-x86_64/delay.c
@@ -28,14 +28,3 @@ void __udelay(unsigned long usecs)
28} 28}
29 29
30EXPORT_SYMBOL(__udelay); 30EXPORT_SYMBOL(__udelay);
31
32void __const_udelay(unsigned long usecs)
33{
34 unsigned long i, n;
35
36 n = (loops_per_jiffy * HZ * usecs) / MILLION;
37 for(i=0;i<n;i++)
38 cpu_relax();
39}
40
41EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 01b91f9fa789..b3f6350cac44 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct *task, int code,
103 103
104 switch(code){ 104 switch(code){
105 case ARCH_SET_FS: 105 case ARCH_SET_FS:
106 current->thread.arch.fs = (unsigned long) ptr;
107 save_registers(pid, &current->thread.regs.regs);
108 break;
106 case ARCH_SET_GS: 109 case ARCH_SET_GS:
107 save_registers(pid, &current->thread.regs.regs); 110 save_registers(pid, &current->thread.regs.regs);
108 break; 111 break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
140 143
141void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) 144void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
142{ 145{
143 if(to->thread.arch.fs == 0) 146 if((to->thread.arch.fs == 0) || (to->mm == NULL))
144 return; 147 return;
145 148
146 arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); 149 arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
147} 150}
148
diff --git a/arch/x86_64/boot/video.S b/arch/x86_64/boot/video.S
index d6ff88f35135..6090516c9c7f 100644
--- a/arch/x86_64/boot/video.S
+++ b/arch/x86_64/boot/video.S
@@ -571,6 +571,16 @@ setr1: lodsw
571 jmp _m_s 571 jmp _m_s
572 572
573check_vesa: 573check_vesa:
574#ifdef CONFIG_FIRMWARE_EDID
575 leaw modelist+1024, %di
576 movw $0x4f00, %ax
577 int $0x10
578 cmpw $0x004f, %ax
579 jnz setbad
580
581 movw 4(%di), %ax
582 movw %ax, vbe_version
583#endif
574 leaw modelist+1024, %di 584 leaw modelist+1024, %di
575 subb $VIDEO_FIRST_VESA>>8, %bh 585 subb $VIDEO_FIRST_VESA>>8, %bh
576 movw %bx, %cx # Get mode information structure 586 movw %bx, %cx # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
1945 rep 1955 rep
1946 stosl 1956 stosl
1947 1957
1958 cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
1959 jl no_edid
1960
1948 pushw %es # save ES 1961 pushw %es # save ES
1949 xorw %di, %di # Report Capability 1962 xorw %di, %di # Report Capability
1950 pushw %di 1963 pushw %di
@@ -1987,6 +2000,7 @@ do_restore: .byte 0 # Screen contents altered during mode change
1987svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes 2000svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
1988graphic_mode: .byte 0 # Graphic mode with a linear frame buffer 2001graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
1989dac_size: .byte 6 # DAC bit depth 2002dac_size: .byte 6 # DAC bit depth
2003vbe_version: .word 0 # VBE bios version
1990 2004
1991# Status messages 2005# Status messages
1992keymsg: .ascii "Press <RETURN> to see video modes available, " 2006keymsg: .ascii "Press <RETURN> to see video modes available, "
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 293a4a4c609e..7a1e251e333d 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,11 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-git8 3# Linux kernel version: 2.6.21-rc3
4# Tue Feb 13 11:25:16 2007 4# Wed Mar 7 15:29:47 2007
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
8CONFIG_X86=y 8CONFIG_X86=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_TIME_VSYSCALL=y
9CONFIG_ZONE_DMA32=y 11CONFIG_ZONE_DMA32=y
10CONFIG_LOCKDEP_SUPPORT=y 12CONFIG_LOCKDEP_SUPPORT=y
11CONFIG_STACKTRACE_SUPPORT=y 13CONFIG_STACKTRACE_SUPPORT=y
@@ -43,6 +45,7 @@ CONFIG_LOCALVERSION_AUTO=y
43CONFIG_SWAP=y 45CONFIG_SWAP=y
44CONFIG_SYSVIPC=y 46CONFIG_SYSVIPC=y
45# CONFIG_IPC_NS is not set 47# CONFIG_IPC_NS is not set
48CONFIG_SYSVIPC_SYSCTL=y
46CONFIG_POSIX_MQUEUE=y 49CONFIG_POSIX_MQUEUE=y
47# CONFIG_BSD_PROCESS_ACCT is not set 50# CONFIG_BSD_PROCESS_ACCT is not set
48# CONFIG_TASKSTATS is not set 51# CONFIG_TASKSTATS is not set
@@ -53,6 +56,7 @@ CONFIG_IKCONFIG_PROC=y
53# CONFIG_CPUSETS is not set 56# CONFIG_CPUSETS is not set
54CONFIG_SYSFS_DEPRECATED=y 57CONFIG_SYSFS_DEPRECATED=y
55# CONFIG_RELAY is not set 58# CONFIG_RELAY is not set
59CONFIG_BLK_DEV_INITRD=y
56CONFIG_INITRAMFS_SOURCE="" 60CONFIG_INITRAMFS_SOURCE=""
57CONFIG_CC_OPTIMIZE_FOR_SIZE=y 61CONFIG_CC_OPTIMIZE_FOR_SIZE=y
58CONFIG_SYSCTL=y 62CONFIG_SYSCTL=y
@@ -114,11 +118,11 @@ CONFIG_X86_PC=y
114# CONFIG_X86_VSMP is not set 118# CONFIG_X86_VSMP is not set
115# CONFIG_MK8 is not set 119# CONFIG_MK8 is not set
116# CONFIG_MPSC is not set 120# CONFIG_MPSC is not set
117CONFIG_MCORE2=y 121# CONFIG_MCORE2 is not set
118# CONFIG_GENERIC_CPU is not set 122CONFIG_GENERIC_CPU=y
119CONFIG_X86_L1_CACHE_BYTES=64 123CONFIG_X86_L1_CACHE_BYTES=128
120CONFIG_X86_L1_CACHE_SHIFT=6 124CONFIG_X86_L1_CACHE_SHIFT=7
121CONFIG_X86_INTERNODE_CACHE_BYTES=64 125CONFIG_X86_INTERNODE_CACHE_BYTES=128
122CONFIG_X86_TSC=y 126CONFIG_X86_TSC=y
123CONFIG_X86_GOOD_APIC=y 127CONFIG_X86_GOOD_APIC=y
124# CONFIG_MICROCODE is not set 128# CONFIG_MICROCODE is not set
@@ -207,10 +211,8 @@ CONFIG_ACPI_PROCFS=y
207CONFIG_ACPI_AC=y 211CONFIG_ACPI_AC=y
208CONFIG_ACPI_BATTERY=y 212CONFIG_ACPI_BATTERY=y
209CONFIG_ACPI_BUTTON=y 213CONFIG_ACPI_BUTTON=y
210# CONFIG_ACPI_HOTKEY is not set
211CONFIG_ACPI_FAN=y 214CONFIG_ACPI_FAN=y
212# CONFIG_ACPI_DOCK is not set 215# CONFIG_ACPI_DOCK is not set
213# CONFIG_ACPI_BAY is not set
214CONFIG_ACPI_PROCESSOR=y 216CONFIG_ACPI_PROCESSOR=y
215CONFIG_ACPI_HOTPLUG_CPU=y 217CONFIG_ACPI_HOTPLUG_CPU=y
216CONFIG_ACPI_THERMAL=y 218CONFIG_ACPI_THERMAL=y
@@ -319,7 +321,7 @@ CONFIG_IP_PNP_DHCP=y
319# CONFIG_INET_ESP is not set 321# CONFIG_INET_ESP is not set
320# CONFIG_INET_IPCOMP is not set 322# CONFIG_INET_IPCOMP is not set
321# CONFIG_INET_XFRM_TUNNEL is not set 323# CONFIG_INET_XFRM_TUNNEL is not set
322# CONFIG_INET_TUNNEL is not set 324CONFIG_INET_TUNNEL=y
323# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 325# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
324# CONFIG_INET_XFRM_MODE_TUNNEL is not set 326# CONFIG_INET_XFRM_MODE_TUNNEL is not set
325# CONFIG_INET_XFRM_MODE_BEET is not set 327# CONFIG_INET_XFRM_MODE_BEET is not set
@@ -421,7 +423,13 @@ CONFIG_FW_LOADER=y
421# 423#
422# Plug and Play support 424# Plug and Play support
423# 425#
424# CONFIG_PNP is not set 426CONFIG_PNP=y
427# CONFIG_PNP_DEBUG is not set
428
429#
430# Protocols
431#
432CONFIG_PNPACPI=y
425 433
426# 434#
427# Block devices 435# Block devices
@@ -441,7 +449,6 @@ CONFIG_BLK_DEV_RAM=y
441CONFIG_BLK_DEV_RAM_COUNT=16 449CONFIG_BLK_DEV_RAM_COUNT=16
442CONFIG_BLK_DEV_RAM_SIZE=4096 450CONFIG_BLK_DEV_RAM_SIZE=4096
443CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 451CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
444CONFIG_BLK_DEV_INITRD=y
445# CONFIG_CDROM_PKTCDVD is not set 452# CONFIG_CDROM_PKTCDVD is not set
446# CONFIG_ATA_OVER_ETH is not set 453# CONFIG_ATA_OVER_ETH is not set
447 454
@@ -451,6 +458,7 @@ CONFIG_BLK_DEV_INITRD=y
451# CONFIG_IBM_ASM is not set 458# CONFIG_IBM_ASM is not set
452# CONFIG_SGI_IOC4 is not set 459# CONFIG_SGI_IOC4 is not set
453# CONFIG_TIFM_CORE is not set 460# CONFIG_TIFM_CORE is not set
461# CONFIG_SONY_LAPTOP is not set
454 462
455# 463#
456# ATA/ATAPI/MFM/RLL support 464# ATA/ATAPI/MFM/RLL support
@@ -477,6 +485,7 @@ CONFIG_BLK_DEV_IDEACPI=y
477# 485#
478CONFIG_IDE_GENERIC=y 486CONFIG_IDE_GENERIC=y
479# CONFIG_BLK_DEV_CMD640 is not set 487# CONFIG_BLK_DEV_CMD640 is not set
488# CONFIG_BLK_DEV_IDEPNP is not set
480CONFIG_BLK_DEV_IDEPCI=y 489CONFIG_BLK_DEV_IDEPCI=y
481# CONFIG_IDEPCI_SHARE_IRQ is not set 490# CONFIG_IDEPCI_SHARE_IRQ is not set
482# CONFIG_BLK_DEV_OFFBOARD is not set 491# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -623,6 +632,7 @@ CONFIG_SATA_VIA=y
623# CONFIG_SATA_VITESSE is not set 632# CONFIG_SATA_VITESSE is not set
624# CONFIG_SATA_INIC162X is not set 633# CONFIG_SATA_INIC162X is not set
625CONFIG_SATA_INTEL_COMBINED=y 634CONFIG_SATA_INTEL_COMBINED=y
635CONFIG_SATA_ACPI=y
626# CONFIG_PATA_ALI is not set 636# CONFIG_PATA_ALI is not set
627# CONFIG_PATA_AMD is not set 637# CONFIG_PATA_AMD is not set
628# CONFIG_PATA_ARTOP is not set 638# CONFIG_PATA_ARTOP is not set
@@ -726,6 +736,7 @@ CONFIG_NETDEVICES=y
726# CONFIG_BONDING is not set 736# CONFIG_BONDING is not set
727# CONFIG_EQUALIZER is not set 737# CONFIG_EQUALIZER is not set
728CONFIG_TUN=y 738CONFIG_TUN=y
739# CONFIG_NET_SB1000 is not set
729 740
730# 741#
731# ARCnet devices 742# ARCnet devices
@@ -920,6 +931,7 @@ CONFIG_HW_CONSOLE=y
920CONFIG_SERIAL_8250=y 931CONFIG_SERIAL_8250=y
921CONFIG_SERIAL_8250_CONSOLE=y 932CONFIG_SERIAL_8250_CONSOLE=y
922CONFIG_SERIAL_8250_PCI=y 933CONFIG_SERIAL_8250_PCI=y
934CONFIG_SERIAL_8250_PNP=y
923CONFIG_SERIAL_8250_NR_UARTS=4 935CONFIG_SERIAL_8250_NR_UARTS=4
924CONFIG_SERIAL_8250_RUNTIME_UARTS=4 936CONFIG_SERIAL_8250_RUNTIME_UARTS=4
925# CONFIG_SERIAL_8250_EXTENDED is not set 937# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -1001,6 +1013,7 @@ CONFIG_I2C_ISA=m
1001# CONFIG_I2C_NFORCE2 is not set 1013# CONFIG_I2C_NFORCE2 is not set
1002# CONFIG_I2C_OCORES is not set 1014# CONFIG_I2C_OCORES is not set
1003# CONFIG_I2C_PARPORT_LIGHT is not set 1015# CONFIG_I2C_PARPORT_LIGHT is not set
1016# CONFIG_I2C_PASEMI is not set
1004# CONFIG_I2C_PROSAVAGE is not set 1017# CONFIG_I2C_PROSAVAGE is not set
1005# CONFIG_I2C_SAVAGE4 is not set 1018# CONFIG_I2C_SAVAGE4 is not set
1006# CONFIG_I2C_SIS5595 is not set 1019# CONFIG_I2C_SIS5595 is not set
@@ -1047,6 +1060,7 @@ CONFIG_HWMON=y
1047# CONFIG_SENSORS_ADM1021 is not set 1060# CONFIG_SENSORS_ADM1021 is not set
1048# CONFIG_SENSORS_ADM1025 is not set 1061# CONFIG_SENSORS_ADM1025 is not set
1049# CONFIG_SENSORS_ADM1026 is not set 1062# CONFIG_SENSORS_ADM1026 is not set
1063# CONFIG_SENSORS_ADM1029 is not set
1050# CONFIG_SENSORS_ADM1031 is not set 1064# CONFIG_SENSORS_ADM1031 is not set
1051# CONFIG_SENSORS_ADM9240 is not set 1065# CONFIG_SENSORS_ADM9240 is not set
1052# CONFIG_SENSORS_K8TEMP is not set 1066# CONFIG_SENSORS_K8TEMP is not set
@@ -1090,6 +1104,11 @@ CONFIG_SENSORS_SMSC47B397=m
1090# CONFIG_HWMON_DEBUG_CHIP is not set 1104# CONFIG_HWMON_DEBUG_CHIP is not set
1091 1105
1092# 1106#
1107# Multifunction device drivers
1108#
1109# CONFIG_MFD_SM501 is not set
1110
1111#
1093# Multimedia devices 1112# Multimedia devices
1094# 1113#
1095# CONFIG_VIDEO_DEV is not set 1114# CONFIG_VIDEO_DEV is not set
@@ -1103,7 +1122,7 @@ CONFIG_SENSORS_SMSC47B397=m
1103# 1122#
1104# Graphics support 1123# Graphics support
1105# 1124#
1106# CONFIG_FIRMWARE_EDID is not set 1125# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1107# CONFIG_FB is not set 1126# CONFIG_FB is not set
1108 1127
1109# 1128#
@@ -1114,7 +1133,6 @@ CONFIG_VGACON_SOFT_SCROLLBACK=y
1114CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256 1133CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256
1115CONFIG_VIDEO_SELECT=y 1134CONFIG_VIDEO_SELECT=y
1116CONFIG_DUMMY_CONSOLE=y 1135CONFIG_DUMMY_CONSOLE=y
1117# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1118 1136
1119# 1137#
1120# Sound 1138# Sound
@@ -1130,9 +1148,8 @@ CONFIG_SOUND=y
1130# Open Sound System 1148# Open Sound System
1131# 1149#
1132CONFIG_SOUND_PRIME=y 1150CONFIG_SOUND_PRIME=y
1133CONFIG_OBSOLETE_OSS=y 1151# CONFIG_OBSOLETE_OSS is not set
1134# CONFIG_SOUND_BT878 is not set 1152# CONFIG_SOUND_BT878 is not set
1135# CONFIG_SOUND_ES1371 is not set
1136CONFIG_SOUND_ICH=y 1153CONFIG_SOUND_ICH=y
1137# CONFIG_SOUND_TRIDENT is not set 1154# CONFIG_SOUND_TRIDENT is not set
1138# CONFIG_SOUND_MSNDCLAS is not set 1155# CONFIG_SOUND_MSNDCLAS is not set
@@ -1263,6 +1280,7 @@ CONFIG_USB_MON=y
1263# CONFIG_USB_RIO500 is not set 1280# CONFIG_USB_RIO500 is not set
1264# CONFIG_USB_LEGOTOWER is not set 1281# CONFIG_USB_LEGOTOWER is not set
1265# CONFIG_USB_LCD is not set 1282# CONFIG_USB_LCD is not set
1283# CONFIG_USB_BERRY_CHARGE is not set
1266# CONFIG_USB_LED is not set 1284# CONFIG_USB_LED is not set
1267# CONFIG_USB_CYPRESS_CY7C63 is not set 1285# CONFIG_USB_CYPRESS_CY7C63 is not set
1268# CONFIG_USB_CYTHERM is not set 1286# CONFIG_USB_CYTHERM is not set
@@ -1273,6 +1291,7 @@ CONFIG_USB_MON=y
1273# CONFIG_USB_SISUSBVGA is not set 1291# CONFIG_USB_SISUSBVGA is not set
1274# CONFIG_USB_LD is not set 1292# CONFIG_USB_LD is not set
1275# CONFIG_USB_TRANCEVIBRATOR is not set 1293# CONFIG_USB_TRANCEVIBRATOR is not set
1294# CONFIG_USB_IOWARRIOR is not set
1276# CONFIG_USB_TEST is not set 1295# CONFIG_USB_TEST is not set
1277 1296
1278# 1297#
@@ -1538,6 +1557,7 @@ CONFIG_DEBUG_KERNEL=y
1538CONFIG_LOG_BUF_SHIFT=18 1557CONFIG_LOG_BUF_SHIFT=18
1539CONFIG_DETECT_SOFTLOCKUP=y 1558CONFIG_DETECT_SOFTLOCKUP=y
1540# CONFIG_SCHEDSTATS is not set 1559# CONFIG_SCHEDSTATS is not set
1560# CONFIG_TIMER_STATS is not set
1541# CONFIG_DEBUG_SLAB is not set 1561# CONFIG_DEBUG_SLAB is not set
1542# CONFIG_DEBUG_RT_MUTEXES is not set 1562# CONFIG_DEBUG_RT_MUTEXES is not set
1543# CONFIG_RT_MUTEX_TESTER is not set 1563# CONFIG_RT_MUTEX_TESTER is not set
@@ -1556,6 +1576,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1556# CONFIG_FORCED_INLINING is not set 1576# CONFIG_FORCED_INLINING is not set
1557# CONFIG_RCU_TORTURE_TEST is not set 1577# CONFIG_RCU_TORTURE_TEST is not set
1558# CONFIG_LKDTM is not set 1578# CONFIG_LKDTM is not set
1579# CONFIG_FAULT_INJECTION is not set
1559# CONFIG_DEBUG_RODATA is not set 1580# CONFIG_DEBUG_RODATA is not set
1560# CONFIG_IOMMU_DEBUG is not set 1581# CONFIG_IOMMU_DEBUG is not set
1561CONFIG_DEBUG_STACKOVERFLOW=y 1582CONFIG_DEBUG_STACKOVERFLOW=y
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index eda7a0d4dc15..796df6992f62 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -560,7 +560,7 @@ ia32_sys_call_table:
560 .quad sys_sched_yield 560 .quad sys_sched_yield
561 .quad sys_sched_get_priority_max 561 .quad sys_sched_get_priority_max
562 .quad sys_sched_get_priority_min /* 160 */ 562 .quad sys_sched_get_priority_min /* 160 */
563 .quad sys_sched_rr_get_interval 563 .quad sys32_sched_rr_get_interval
564 .quad compat_sys_nanosleep 564 .quad compat_sys_nanosleep
565 .quad sys_mremap 565 .quad sys_mremap
566 .quad sys_setresuid16 566 .quad sys_setresuid16
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
index 04566fe5de49..4de3a54318f4 100644
--- a/arch/x86_64/ia32/ptrace32.c
+++ b/arch/x86_64/ia32/ptrace32.c
@@ -243,6 +243,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
243 case PTRACE_SINGLESTEP: 243 case PTRACE_SINGLESTEP:
244 case PTRACE_DETACH: 244 case PTRACE_DETACH:
245 case PTRACE_SYSCALL: 245 case PTRACE_SYSCALL:
246 case PTRACE_OLDSETOPTIONS:
246 case PTRACE_SETOPTIONS: 247 case PTRACE_SETOPTIONS:
247 case PTRACE_SET_THREAD_AREA: 248 case PTRACE_SET_THREAD_AREA:
248 case PTRACE_GET_THREAD_AREA: 249 case PTRACE_GET_THREAD_AREA:
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
index 23178ce6c783..e1548fbe95ae 100644
--- a/arch/x86_64/kernel/acpi/sleep.c
+++ b/arch/x86_64/kernel/acpi/sleep.c
@@ -66,8 +66,10 @@ static void init_low_mapping(void)
66{ 66{
67 pgd_t *slot0 = pgd_offset(current->mm, 0UL); 67 pgd_t *slot0 = pgd_offset(current->mm, 0UL);
68 low_ptr = *slot0; 68 low_ptr = *slot0;
69 /* FIXME: We're playing with the current task's page tables here, which
70 * is potentially dangerous on SMP systems.
71 */
69 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET)); 72 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET));
70 WARN_ON(num_online_cpus() != 1);
71 local_flush_tlb(); 73 local_flush_tlb();
72} 74}
73 75
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 723417d924c0..bd3e45d47c37 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -47,6 +47,10 @@ int apic_calibrate_pmtmr __initdata;
47 47
48int disable_apic_timer __initdata; 48int disable_apic_timer __initdata;
49 49
50/* Local APIC timer works in C2? */
51int local_apic_timer_c2_ok;
52EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
53
50static struct resource *ioapic_resources; 54static struct resource *ioapic_resources;
51static struct resource lapic_resource = { 55static struct resource lapic_resource = {
52 .name = "Local APIC", 56 .name = "Local APIC",
@@ -930,9 +934,17 @@ EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
930 934
931void smp_send_timer_broadcast_ipi(void) 935void smp_send_timer_broadcast_ipi(void)
932{ 936{
937 int cpu = smp_processor_id();
933 cpumask_t mask; 938 cpumask_t mask;
934 939
935 cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask); 940 cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask);
941
942 if (cpu_isset(cpu, mask)) {
943 cpu_clear(cpu, mask);
944 add_pda(apic_timer_irqs, 1);
945 smp_local_timer_interrupt();
946 }
947
936 if (!cpus_empty(mask)) { 948 if (!cpus_empty(mask)) {
937 send_IPI_mask(mask, LOCAL_TIMER_VECTOR); 949 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
938 } 950 }
@@ -1192,6 +1204,13 @@ static __init int setup_nolapic(char *str)
1192} 1204}
1193early_param("nolapic", setup_nolapic); 1205early_param("nolapic", setup_nolapic);
1194 1206
1207static int __init parse_lapic_timer_c2_ok(char *arg)
1208{
1209 local_apic_timer_c2_ok = 1;
1210 return 0;
1211}
1212early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1213
1195static __init int setup_noapictimer(char *str) 1214static __init int setup_noapictimer(char *str)
1196{ 1215{
1197 if (str[0] != ' ' && str[0] != 0) 1216 if (str[0] != ' ' && str[0] != 0)
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig
index ced15d06f0f3..40acb67fb882 100644
--- a/arch/x86_64/kernel/cpufreq/Kconfig
+++ b/arch/x86_64/kernel/cpufreq/Kconfig
@@ -75,6 +75,7 @@ config X86_ACPI_CPUFREQ_PROC_INTF
75config X86_P4_CLOCKMOD 75config X86_P4_CLOCKMOD
76 tristate "Intel Pentium 4 clock modulation" 76 tristate "Intel Pentium 4 clock modulation"
77 depends on EMBEDDED 77 depends on EMBEDDED
78 select CPU_FREQ_TABLE
78 help 79 help
79 This adds the clock modulation driver for Intel Pentium 4 / XEON 80 This adds the clock modulation driver for Intel Pentium 4 / XEON
80 processors. When enabled it will lower CPU temperature by skipping 81 processors. When enabled it will lower CPU temperature by skipping
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 4651fd22b213..a490fabfcf47 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -662,7 +662,7 @@ static int __init parse_memmap_opt(char *p)
662} 662}
663early_param("memmap", parse_memmap_opt); 663early_param("memmap", parse_memmap_opt);
664 664
665void finish_e820_parsing(void) 665void __init finish_e820_parsing(void)
666{ 666{
667 if (userdef) { 667 if (userdef) {
668 printk(KERN_INFO "user-defined physical RAM map:\n"); 668 printk(KERN_INFO "user-defined physical RAM map:\n");
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c
index 8047ea8c2ab2..fede55a53995 100644
--- a/arch/x86_64/kernel/early-quirks.c
+++ b/arch/x86_64/kernel/early-quirks.c
@@ -16,7 +16,7 @@
16#include <asm/proto.h> 16#include <asm/proto.h>
17#include <asm/dma.h> 17#include <asm/dma.h>
18 18
19static void via_bugs(void) 19static void __init via_bugs(void)
20{ 20{
21#ifdef CONFIG_IOMMU 21#ifdef CONFIG_IOMMU
22 if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 22 if ((end_pfn > MAX_DMA32_PFN || force_iommu) &&
@@ -30,16 +30,13 @@ static void via_bugs(void)
30 30
31#ifdef CONFIG_ACPI 31#ifdef CONFIG_ACPI
32 32
33static int nvidia_hpet_detected __initdata;
34
35static int __init nvidia_hpet_check(struct acpi_table_header *header) 33static int __init nvidia_hpet_check(struct acpi_table_header *header)
36{ 34{
37 nvidia_hpet_detected = 1;
38 return 0; 35 return 0;
39} 36}
40#endif 37#endif
41 38
42static void nvidia_bugs(void) 39static void __init nvidia_bugs(void)
43{ 40{
44#ifdef CONFIG_ACPI 41#ifdef CONFIG_ACPI
45 /* 42 /*
@@ -52,11 +49,7 @@ static void nvidia_bugs(void)
52 if (acpi_use_timer_override) 49 if (acpi_use_timer_override)
53 return; 50 return;
54 51
55 nvidia_hpet_detected = 0; 52 if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) {
56 if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check))
57 return;
58
59 if (nvidia_hpet_detected == 0) {
60 acpi_skip_timer_override = 1; 53 acpi_skip_timer_override = 1;
61 printk(KERN_INFO "Nvidia board " 54 printk(KERN_INFO "Nvidia board "
62 "detected. Ignoring ACPI " 55 "detected. Ignoring ACPI "
@@ -69,7 +62,7 @@ static void nvidia_bugs(void)
69 62
70} 63}
71 64
72static void ati_bugs(void) 65static void __init ati_bugs(void)
73{ 66{
74 if (timer_over_8254 == 1) { 67 if (timer_over_8254 == 1) {
75 timer_over_8254 = 0; 68 timer_over_8254 = 0;
@@ -95,7 +88,7 @@ struct chipset {
95 void (*f)(void); 88 void (*f)(void);
96}; 89};
97 90
98static struct chipset early_qrk[] = { 91static struct chipset early_qrk[] __initdata = {
99 { PCI_VENDOR_ID_NVIDIA, nvidia_bugs }, 92 { PCI_VENDOR_ID_NVIDIA, nvidia_bugs },
100 { PCI_VENDOR_ID_VIA, via_bugs }, 93 { PCI_VENDOR_ID_VIA, via_bugs },
101 { PCI_VENDOR_ID_ATI, ati_bugs }, 94 { PCI_VENDOR_ID_ATI, ati_bugs },
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 21d95b747437..489426682772 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -45,7 +45,7 @@
45 45
46/* 46/*
47 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: 47 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
48 * (these are usually mapped to vectors 0x20-0x2f) 48 * (these are usually mapped to vectors 0x30-0x3f)
49 */ 49 */
50 50
51/* 51/*
@@ -299,7 +299,7 @@ void init_8259A(int auto_eoi)
299 * outb_p - this has to work on a wide range of PC hardware. 299 * outb_p - this has to work on a wide range of PC hardware.
300 */ 300 */
301 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */ 301 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */
302 outb_p(IRQ0_VECTOR, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */ 302 outb_p(IRQ0_VECTOR, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */
303 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */ 303 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */
304 if (auto_eoi) 304 if (auto_eoi)
305 outb_p(0x03, 0x21); /* master does Auto EOI */ 305 outb_p(0x03, 0x21); /* master does Auto EOI */
@@ -307,7 +307,7 @@ void init_8259A(int auto_eoi)
307 outb_p(0x01, 0x21); /* master expects normal EOI */ 307 outb_p(0x01, 0x21); /* master expects normal EOI */
308 308
309 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */ 309 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */
310 outb_p(IRQ8_VECTOR, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */ 310 outb_p(IRQ8_VECTOR, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */
311 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */ 311 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */
312 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode 312 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode
313 is to be investigated) */ 313 is to be investigated) */
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 50dd8bef850e..455aa0b932f0 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -60,9 +60,9 @@ unsigned long mp_lapic_addr = 0;
60/* Processor that is doing the boot up */ 60/* Processor that is doing the boot up */
61unsigned int boot_cpu_id = -1U; 61unsigned int boot_cpu_id = -1U;
62/* Internal processor count */ 62/* Internal processor count */
63unsigned int num_processors __initdata = 0; 63unsigned int num_processors __cpuinitdata = 0;
64 64
65unsigned disabled_cpus __initdata; 65unsigned disabled_cpus __cpuinitdata;
66 66
67/* Bitmask of physically existing CPUs */ 67/* Bitmask of physically existing CPUs */
68physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; 68physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 486f4c61a948..a90996c27dc8 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -108,64 +108,128 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
108/* checks for a bit availability (hack for oprofile) */ 108/* checks for a bit availability (hack for oprofile) */
109int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 109int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
110{ 110{
111 int cpu;
111 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 112 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
112 113 for_each_possible_cpu (cpu) {
113 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 114 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
115 return 0;
116 }
117 return 1;
114} 118}
115 119
116/* checks the an msr for availability */ 120/* checks the an msr for availability */
117int avail_to_resrv_perfctr_nmi(unsigned int msr) 121int avail_to_resrv_perfctr_nmi(unsigned int msr)
118{ 122{
119 unsigned int counter; 123 unsigned int counter;
124 int cpu;
120 125
121 counter = nmi_perfctr_msr_to_bit(msr); 126 counter = nmi_perfctr_msr_to_bit(msr);
122 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 127 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
123 128
124 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 129 for_each_possible_cpu (cpu) {
130 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
131 return 0;
132 }
133 return 1;
125} 134}
126 135
127int reserve_perfctr_nmi(unsigned int msr) 136static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
128{ 137{
129 unsigned int counter; 138 unsigned int counter;
139 if (cpu < 0)
140 cpu = smp_processor_id();
130 141
131 counter = nmi_perfctr_msr_to_bit(msr); 142 counter = nmi_perfctr_msr_to_bit(msr);
132 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 143 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
133 144
134 if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 145 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
135 return 1; 146 return 1;
136 return 0; 147 return 0;
137} 148}
138 149
139void release_perfctr_nmi(unsigned int msr) 150static void __release_perfctr_nmi(int cpu, unsigned int msr)
140{ 151{
141 unsigned int counter; 152 unsigned int counter;
153 if (cpu < 0)
154 cpu = smp_processor_id();
142 155
143 counter = nmi_perfctr_msr_to_bit(msr); 156 counter = nmi_perfctr_msr_to_bit(msr);
144 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 157 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
145 158
146 clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 159 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu));
147} 160}
148 161
149int reserve_evntsel_nmi(unsigned int msr) 162int reserve_perfctr_nmi(unsigned int msr)
163{
164 int cpu, i;
165 for_each_possible_cpu (cpu) {
166 if (!__reserve_perfctr_nmi(cpu, msr)) {
167 for_each_possible_cpu (i) {
168 if (i >= cpu)
169 break;
170 __release_perfctr_nmi(i, msr);
171 }
172 return 0;
173 }
174 }
175 return 1;
176}
177
178void release_perfctr_nmi(unsigned int msr)
179{
180 int cpu;
181 for_each_possible_cpu (cpu)
182 __release_perfctr_nmi(cpu, msr);
183}
184
185int __reserve_evntsel_nmi(int cpu, unsigned int msr)
150{ 186{
151 unsigned int counter; 187 unsigned int counter;
188 if (cpu < 0)
189 cpu = smp_processor_id();
152 190
153 counter = nmi_evntsel_msr_to_bit(msr); 191 counter = nmi_evntsel_msr_to_bit(msr);
154 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 192 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
155 193
156 if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner))) 194 if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
157 return 1; 195 return 1;
158 return 0; 196 return 0;
159} 197}
160 198
161void release_evntsel_nmi(unsigned int msr) 199static void __release_evntsel_nmi(int cpu, unsigned int msr)
162{ 200{
163 unsigned int counter; 201 unsigned int counter;
202 if (cpu < 0)
203 cpu = smp_processor_id();
164 204
165 counter = nmi_evntsel_msr_to_bit(msr); 205 counter = nmi_evntsel_msr_to_bit(msr);
166 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 206 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
167 207
168 clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)); 208 clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
209}
210
211int reserve_evntsel_nmi(unsigned int msr)
212{
213 int cpu, i;
214 for_each_possible_cpu (cpu) {
215 if (!__reserve_evntsel_nmi(cpu, msr)) {
216 for_each_possible_cpu (i) {
217 if (i >= cpu)
218 break;
219 __release_evntsel_nmi(i, msr);
220 }
221 return 0;
222 }
223 }
224 return 1;
225}
226
227void release_evntsel_nmi(unsigned int msr)
228{
229 int cpu;
230 for_each_possible_cpu (cpu) {
231 __release_evntsel_nmi(cpu, msr);
232 }
169} 233}
170 234
171static __cpuinit inline int nmi_known_cpu(void) 235static __cpuinit inline int nmi_known_cpu(void)
@@ -187,10 +251,7 @@ void nmi_watchdog_default(void)
187{ 251{
188 if (nmi_watchdog != NMI_DEFAULT) 252 if (nmi_watchdog != NMI_DEFAULT)
189 return; 253 return;
190 if (nmi_known_cpu()) 254 nmi_watchdog = NMI_NONE;
191 nmi_watchdog = NMI_LOCAL_APIC;
192 else
193 nmi_watchdog = NMI_IO_APIC;
194} 255}
195 256
196static int endflag __initdata = 0; 257static int endflag __initdata = 0;
@@ -256,7 +317,7 @@ int __init check_nmi_watchdog (void)
256 for (cpu = 0; cpu < NR_CPUS; cpu++) 317 for (cpu = 0; cpu < NR_CPUS; cpu++)
257 counts[cpu] = cpu_pda(cpu)->__nmi_count; 318 counts[cpu] = cpu_pda(cpu)->__nmi_count;
258 local_irq_enable(); 319 local_irq_enable();
259 mdelay((10*1000)/nmi_hz); // wait 10 ticks 320 mdelay((20*1000)/nmi_hz); // wait 20 ticks
260 321
261 for_each_online_cpu(cpu) { 322 for_each_online_cpu(cpu) {
262 if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled) 323 if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled)
@@ -475,10 +536,10 @@ static int setup_k7_watchdog(void)
475 536
476 perfctr_msr = MSR_K7_PERFCTR0; 537 perfctr_msr = MSR_K7_PERFCTR0;
477 evntsel_msr = MSR_K7_EVNTSEL0; 538 evntsel_msr = MSR_K7_EVNTSEL0;
478 if (!reserve_perfctr_nmi(perfctr_msr)) 539 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
479 goto fail; 540 goto fail;
480 541
481 if (!reserve_evntsel_nmi(evntsel_msr)) 542 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
482 goto fail1; 543 goto fail1;
483 544
484 /* Simulator may not support it */ 545 /* Simulator may not support it */
@@ -504,9 +565,9 @@ static int setup_k7_watchdog(void)
504 wd->check_bit = 1ULL<<63; 565 wd->check_bit = 1ULL<<63;
505 return 1; 566 return 1;
506fail2: 567fail2:
507 release_evntsel_nmi(evntsel_msr); 568 __release_evntsel_nmi(-1, evntsel_msr);
508fail1: 569fail1:
509 release_perfctr_nmi(perfctr_msr); 570 __release_perfctr_nmi(-1, perfctr_msr);
510fail: 571fail:
511 return 0; 572 return 0;
512} 573}
@@ -517,8 +578,8 @@ static void stop_k7_watchdog(void)
517 578
518 wrmsr(wd->evntsel_msr, 0, 0); 579 wrmsr(wd->evntsel_msr, 0, 0);
519 580
520 release_evntsel_nmi(wd->evntsel_msr); 581 __release_evntsel_nmi(-1, wd->evntsel_msr);
521 release_perfctr_nmi(wd->perfctr_msr); 582 __release_perfctr_nmi(-1, wd->perfctr_msr);
522} 583}
523 584
524/* Note that these events don't tick when the CPU idles. This means 585/* Note that these events don't tick when the CPU idles. This means
@@ -584,10 +645,10 @@ static int setup_p4_watchdog(void)
584 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 645 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
585 } 646 }
586 647
587 if (!reserve_perfctr_nmi(perfctr_msr)) 648 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
588 goto fail; 649 goto fail;
589 650
590 if (!reserve_evntsel_nmi(evntsel_msr)) 651 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
591 goto fail1; 652 goto fail1;
592 653
593 evntsel = P4_ESCR_EVENT_SELECT(0x3F) 654 evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -612,7 +673,7 @@ static int setup_p4_watchdog(void)
612 wd->check_bit = 1ULL<<39; 673 wd->check_bit = 1ULL<<39;
613 return 1; 674 return 1;
614fail1: 675fail1:
615 release_perfctr_nmi(perfctr_msr); 676 __release_perfctr_nmi(-1, perfctr_msr);
616fail: 677fail:
617 return 0; 678 return 0;
618} 679}
@@ -624,8 +685,8 @@ static void stop_p4_watchdog(void)
624 wrmsr(wd->cccr_msr, 0, 0); 685 wrmsr(wd->cccr_msr, 0, 0);
625 wrmsr(wd->evntsel_msr, 0, 0); 686 wrmsr(wd->evntsel_msr, 0, 0);
626 687
627 release_evntsel_nmi(wd->evntsel_msr); 688 __release_evntsel_nmi(-1, wd->evntsel_msr);
628 release_perfctr_nmi(wd->perfctr_msr); 689 __release_perfctr_nmi(-1, wd->perfctr_msr);
629} 690}
630 691
631#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 692#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -653,10 +714,10 @@ static int setup_intel_arch_watchdog(void)
653 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 714 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
654 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 715 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
655 716
656 if (!reserve_perfctr_nmi(perfctr_msr)) 717 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
657 goto fail; 718 goto fail;
658 719
659 if (!reserve_evntsel_nmi(evntsel_msr)) 720 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
660 goto fail1; 721 goto fail1;
661 722
662 wrmsrl(perfctr_msr, 0UL); 723 wrmsrl(perfctr_msr, 0UL);
@@ -683,7 +744,7 @@ static int setup_intel_arch_watchdog(void)
683 wd->check_bit = 1ULL << (eax.split.bit_width - 1); 744 wd->check_bit = 1ULL << (eax.split.bit_width - 1);
684 return 1; 745 return 1;
685fail1: 746fail1:
686 release_perfctr_nmi(perfctr_msr); 747 __release_perfctr_nmi(-1, perfctr_msr);
687fail: 748fail:
688 return 0; 749 return 0;
689} 750}
@@ -707,8 +768,8 @@ static void stop_intel_arch_watchdog(void)
707 768
708 wrmsr(wd->evntsel_msr, 0, 0); 769 wrmsr(wd->evntsel_msr, 0, 0);
709 770
710 release_evntsel_nmi(wd->evntsel_msr); 771 __release_evntsel_nmi(-1, wd->evntsel_msr);
711 release_perfctr_nmi(wd->perfctr_msr); 772 __release_perfctr_nmi(-1, wd->perfctr_msr);
712} 773}
713 774
714void setup_apic_nmi_watchdog(void *unused) 775void setup_apic_nmi_watchdog(void *unused)
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 030eb3753358..2bac8c60ad61 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -675,7 +675,7 @@ void __init gart_iommu_init(void)
675 dma_ops = &gart_dma_ops; 675 dma_ops = &gart_dma_ops;
676} 676}
677 677
678void gart_parse_options(char *p) 678void __init gart_parse_options(char *p)
679{ 679{
680 int arg; 680 int arg;
681 681
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index cbbc6adc1a92..d8d5ccc245c8 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -382,14 +382,17 @@ void exit_thread(void)
382void flush_thread(void) 382void flush_thread(void)
383{ 383{
384 struct task_struct *tsk = current; 384 struct task_struct *tsk = current;
385 struct thread_info *t = current_thread_info();
386 385
387 if (t->flags & _TIF_ABI_PENDING) { 386 if (test_tsk_thread_flag(tsk, TIF_ABI_PENDING)) {
388 t->flags ^= (_TIF_ABI_PENDING | _TIF_IA32); 387 clear_tsk_thread_flag(tsk, TIF_ABI_PENDING);
389 if (t->flags & _TIF_IA32) 388 if (test_tsk_thread_flag(tsk, TIF_IA32)) {
389 clear_tsk_thread_flag(tsk, TIF_IA32);
390 } else {
391 set_tsk_thread_flag(tsk, TIF_IA32);
390 current_thread_info()->status |= TS_COMPAT; 392 current_thread_info()->status |= TS_COMPAT;
393 }
391 } 394 }
392 t->flags &= ~_TIF_DEBUG; 395 clear_tsk_thread_flag(tsk, TIF_DEBUG);
393 396
394 tsk->thread.debugreg0 = 0; 397 tsk->thread.debugreg0 = 0;
395 tsk->thread.debugreg1 = 0; 398 tsk->thread.debugreg1 = 0;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 35443729aad8..cd4643a37022 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -923,8 +923,9 @@ void __init smp_prepare_boot_cpu(void)
923 */ 923 */
924int __cpuinit __cpu_up(unsigned int cpu) 924int __cpuinit __cpu_up(unsigned int cpu)
925{ 925{
926 int err;
927 int apicid = cpu_present_to_apicid(cpu); 926 int apicid = cpu_present_to_apicid(cpu);
927 unsigned long flags;
928 int err;
928 929
929 WARN_ON(irqs_disabled()); 930 WARN_ON(irqs_disabled());
930 931
@@ -958,7 +959,9 @@ int __cpuinit __cpu_up(unsigned int cpu)
958 /* 959 /*
959 * Make sure and check TSC sync: 960 * Make sure and check TSC sync:
960 */ 961 */
962 local_irq_save(flags);
961 check_tsc_sync_source(cpu); 963 check_tsc_sync_source(cpu);
964 local_irq_restore(flags);
962 965
963 while (!cpu_isset(cpu, cpu_online_map)) 966 while (!cpu_isset(cpu, cpu_online_map))
964 cpu_relax(); 967 cpu_relax();
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index 180ff919eaf9..b43c698cf7d3 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -112,7 +112,7 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
112 112
113 vread = __vsyscall_gtod_data.clock.vread; 113 vread = __vsyscall_gtod_data.clock.vread;
114 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled || !vread)) { 114 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled || !vread)) {
115 gettimeofday(tv,0); 115 gettimeofday(tv,NULL);
116 return; 116 return;
117 } 117 }
118 now = vread(); 118 now = vread();
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index 0dffae69f4ad..77c25b307635 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -59,3 +59,4 @@ EXPORT_SYMBOL(empty_zero_page);
59EXPORT_SYMBOL(init_level4_pgt); 59EXPORT_SYMBOL(init_level4_pgt);
60EXPORT_SYMBOL(load_gs_index); 60EXPORT_SYMBOL(load_gs_index);
61 61
62EXPORT_SYMBOL(_proxy_pda);
diff --git a/block/elevator.c b/block/elevator.c
index 25f6ef28e3bb..96a00c822748 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -964,17 +964,18 @@ void elv_unregister_queue(struct request_queue *q)
964 964
965int elv_register(struct elevator_type *e) 965int elv_register(struct elevator_type *e)
966{ 966{
967 char *def = "";
967 spin_lock_irq(&elv_list_lock); 968 spin_lock_irq(&elv_list_lock);
968 BUG_ON(elevator_find(e->elevator_name)); 969 BUG_ON(elevator_find(e->elevator_name));
969 list_add_tail(&e->list, &elv_list); 970 list_add_tail(&e->list, &elv_list);
970 spin_unlock_irq(&elv_list_lock); 971 spin_unlock_irq(&elv_list_lock);
971 972
972 printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
973 if (!strcmp(e->elevator_name, chosen_elevator) || 973 if (!strcmp(e->elevator_name, chosen_elevator) ||
974 (!*chosen_elevator && 974 (!*chosen_elevator &&
975 !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED))) 975 !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
976 printk(" (default)"); 976 def = " (default)";
977 printk("\n"); 977
978 printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
978 return 0; 979 return 0;
979} 980}
980EXPORT_SYMBOL_GPL(elv_register); 981EXPORT_SYMBOL_GPL(elv_register);
diff --git a/block/genhd.c b/block/genhd.c
index 050a1f0f3a86..441432a142f2 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -62,8 +62,6 @@ int register_blkdev(unsigned int major, const char *name)
62 /* temporary */ 62 /* temporary */
63 if (major == 0) { 63 if (major == 0) {
64 for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) { 64 for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) {
65 if (is_lanana_major(index))
66 continue;
67 if (major_names[index] == NULL) 65 if (major_names[index] == NULL)
68 break; 66 break;
69 } 67 }
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 38c293b987b7..3de06953ac33 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1221,7 +1221,7 @@ void blk_recount_segments(request_queue_t *q, struct bio *bio)
1221 * considered part of another segment, since that might 1221 * considered part of another segment, since that might
1222 * change with the bounce page. 1222 * change with the bounce page.
1223 */ 1223 */
1224 high = page_to_pfn(bv->bv_page) >= q->bounce_pfn; 1224 high = page_to_pfn(bv->bv_page) > q->bounce_pfn;
1225 if (high || highprv) 1225 if (high || highprv)
1226 goto new_hw_segment; 1226 goto new_hw_segment;
1227 if (cluster) { 1227 if (cluster) {
@@ -3658,8 +3658,8 @@ int __init blk_dev_init(void)
3658 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL); 3658 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
3659 register_hotcpu_notifier(&blk_cpu_notifier); 3659 register_hotcpu_notifier(&blk_cpu_notifier);
3660 3660
3661 blk_max_low_pfn = max_low_pfn; 3661 blk_max_low_pfn = max_low_pfn - 1;
3662 blk_max_pfn = max_pfn; 3662 blk_max_pfn = max_pfn - 1;
3663 3663
3664 return 0; 3664 return 0;
3665} 3665}
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 35172d3f043b..81afd1790a1d 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -59,8 +59,12 @@ EXPORT_SYMBOL_GPL(scatterwalk_map);
59static void scatterwalk_pagedone(struct scatter_walk *walk, int out, 59static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
60 unsigned int more) 60 unsigned int more)
61{ 61{
62 if (out) 62 if (out) {
63 flush_dcache_page(scatterwalk_page(walk)); 63 struct page *page;
64
65 page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
66 flush_dcache_page(page);
67 }
64 68
65 if (more) { 69 if (more) {
66 walk->offset += PAGE_SIZE - 1; 70 walk->offset += PAGE_SIZE - 1;
@@ -91,6 +95,8 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
91 memcpy_dir(buf, vaddr, len_this_page, out); 95 memcpy_dir(buf, vaddr, len_this_page, out);
92 scatterwalk_unmap(vaddr, out); 96 scatterwalk_unmap(vaddr, out);
93 97
98 scatterwalk_advance(walk, len_this_page);
99
94 if (nbytes == len_this_page) 100 if (nbytes == len_this_page)
95 break; 101 break;
96 102
@@ -99,7 +105,5 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
99 105
100 scatterwalk_pagedone(walk, out, 1); 106 scatterwalk_pagedone(walk, out, 1);
101 } 107 }
102
103 scatterwalk_advance(walk, nbytes);
104} 108}
105EXPORT_SYMBOL_GPL(scatterwalk_copychunks); 109EXPORT_SYMBOL_GPL(scatterwalk_copychunks);
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index f5e9da319ece..8eaa5aa210b0 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -768,7 +768,7 @@ static void test_deflate(void)
768 tv = (void *)tvmem; 768 tv = (void *)tvmem;
769 769
770 tfm = crypto_alloc_comp("deflate", 0, CRYPTO_ALG_ASYNC); 770 tfm = crypto_alloc_comp("deflate", 0, CRYPTO_ALG_ASYNC);
771 if (tfm == NULL) { 771 if (IS_ERR(tfm)) {
772 printk("failed to load transform for deflate\n"); 772 printk("failed to load transform for deflate\n");
773 return; 773 return;
774 } 774 }
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 7c49e103cf8f..e2ce4a9c1c92 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -7,6 +7,7 @@ menu "ACPI (Advanced Configuration and Power Interface) Support"
7 depends on !X86_VISWS 7 depends on !X86_VISWS
8 depends on !IA64_HP_SIM 8 depends on !IA64_HP_SIM
9 depends on IA64 || X86 9 depends on IA64 || X86
10 depends on PM
10 11
11config ACPI 12config ACPI
12 bool "ACPI Support" 13 bool "ACPI Support"
@@ -243,6 +244,17 @@ config ACPI_IBM_DOCK
243 244
244 If you are not sure, say N here. 245 If you are not sure, say N here.
245 246
247config ACPI_IBM_BAY
248 bool "Legacy Removable Bay Support"
249 depends on ACPI_IBM
250 default y
251 ---help---
252 Allows the ibm_acpi driver to handle removable bays. It will allow
253 disabling the device in the bay, and also generate notifications when
254 the bay lever is ejected or inserted.
255
256 If you are not sure, say Y here.
257
246config ACPI_TOSHIBA 258config ACPI_TOSHIBA
247 tristate "Toshiba Laptop Extras" 259 tristate "Toshiba Laptop Extras"
248 depends on X86 260 depends on X86
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index f289fd41e77d..3ec110ce00c8 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -79,11 +79,17 @@ static int __init blacklist_by_year(void)
79{ 79{
80 int year = dmi_get_year(DMI_BIOS_DATE); 80 int year = dmi_get_year(DMI_BIOS_DATE);
81 /* Doesn't exist? Likely an old system */ 81 /* Doesn't exist? Likely an old system */
82 if (year == -1) 82 if (year == -1) {
83 printk(KERN_ERR PREFIX "no DMI BIOS year, "
84 "acpi=force is required to enable ACPI\n" );
83 return 1; 85 return 1;
86 }
84 /* 0? Likely a buggy new BIOS */ 87 /* 0? Likely a buggy new BIOS */
85 if (year == 0) 88 if (year == 0) {
89 printk(KERN_ERR PREFIX "DMI BIOS year==0, "
90 "assuming ACPI-capable machine\n" );
86 return 0; 91 return 0;
92 }
87 if (year < CONFIG_ACPI_BLACKLIST_YEAR) { 93 if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
88 printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " 94 printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
89 "acpi=force is required to enable ACPI\n", 95 "acpi=force is required to enable ACPI\n",
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index ab6888373795..a802962ff2b4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -100,6 +100,7 @@ static struct acpi_ec {
100 unsigned long global_lock; 100 unsigned long global_lock;
101 struct mutex lock; 101 struct mutex lock;
102 atomic_t query_pending; 102 atomic_t query_pending;
103 atomic_t event_count;
103 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ 104 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */
104 wait_queue_head_t wait; 105 wait_queue_head_t wait;
105} *ec_ecdt; 106} *ec_ecdt;
@@ -131,10 +132,12 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
131 outb(data, ec->data_addr); 132 outb(data, ec->data_addr);
132} 133}
133 134
134static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) 135static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event,
136 unsigned old_count)
135{ 137{
136 u8 status = acpi_ec_read_status(ec); 138 u8 status = acpi_ec_read_status(ec);
137 139 if (old_count == atomic_read(&ec->event_count))
140 return 0;
138 if (event == ACPI_EC_EVENT_OBF_1) { 141 if (event == ACPI_EC_EVENT_OBF_1) {
139 if (status & ACPI_EC_FLAG_OBF) 142 if (status & ACPI_EC_FLAG_OBF)
140 return 1; 143 return 1;
@@ -146,19 +149,19 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
146 return 0; 149 return 0;
147} 150}
148 151
149static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event) 152static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count)
150{ 153{
151 if (acpi_ec_mode == EC_POLL) { 154 if (acpi_ec_mode == EC_POLL) {
152 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 155 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
153 while (time_before(jiffies, delay)) { 156 while (time_before(jiffies, delay)) {
154 if (acpi_ec_check_status(ec, event)) 157 if (acpi_ec_check_status(ec, event, 0))
155 return 0; 158 return 0;
156 } 159 }
157 } else { 160 } else {
158 if (wait_event_timeout(ec->wait, 161 if (wait_event_timeout(ec->wait,
159 acpi_ec_check_status(ec, event), 162 acpi_ec_check_status(ec, event, count),
160 msecs_to_jiffies(ACPI_EC_DELAY)) || 163 msecs_to_jiffies(ACPI_EC_DELAY)) ||
161 acpi_ec_check_status(ec, event)) { 164 acpi_ec_check_status(ec, event, 0)) {
162 return 0; 165 return 0;
163 } else { 166 } else {
164 printk(KERN_ERR PREFIX "acpi_ec_wait timeout," 167 printk(KERN_ERR PREFIX "acpi_ec_wait timeout,"
@@ -225,21 +228,22 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
225 u8 * rdata, unsigned rdata_len) 228 u8 * rdata, unsigned rdata_len)
226{ 229{
227 int result = 0; 230 int result = 0;
228 231 unsigned count = atomic_read(&ec->event_count);
229 acpi_ec_write_cmd(ec, command); 232 acpi_ec_write_cmd(ec, command);
230 233
231 for (; wdata_len > 0; --wdata_len) { 234 for (; wdata_len > 0; --wdata_len) {
232 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 235 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count);
233 if (result) { 236 if (result) {
234 printk(KERN_ERR PREFIX 237 printk(KERN_ERR PREFIX
235 "write_cmd timeout, command = %d\n", command); 238 "write_cmd timeout, command = %d\n", command);
236 goto end; 239 goto end;
237 } 240 }
241 count = atomic_read(&ec->event_count);
238 acpi_ec_write_data(ec, *(wdata++)); 242 acpi_ec_write_data(ec, *(wdata++));
239 } 243 }
240 244
241 if (!rdata_len) { 245 if (!rdata_len) {
242 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 246 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count);
243 if (result) { 247 if (result) {
244 printk(KERN_ERR PREFIX 248 printk(KERN_ERR PREFIX
245 "finish-write timeout, command = %d\n", command); 249 "finish-write timeout, command = %d\n", command);
@@ -250,13 +254,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
250 } 254 }
251 255
252 for (; rdata_len > 0; --rdata_len) { 256 for (; rdata_len > 0; --rdata_len) {
253 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); 257 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count);
254 if (result) { 258 if (result) {
255 printk(KERN_ERR PREFIX "read timeout, command = %d\n", 259 printk(KERN_ERR PREFIX "read timeout, command = %d\n",
256 command); 260 command);
257 goto end; 261 goto end;
258 } 262 }
259 263 count = atomic_read(&ec->event_count);
260 *(rdata++) = acpi_ec_read_data(ec); 264 *(rdata++) = acpi_ec_read_data(ec);
261 } 265 }
262 end: 266 end:
@@ -288,7 +292,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
288 /* Make sure GPE is enabled before doing transaction */ 292 /* Make sure GPE is enabled before doing transaction */
289 acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); 293 acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
290 294
291 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 295 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
292 if (status) { 296 if (status) {
293 printk(KERN_DEBUG PREFIX 297 printk(KERN_DEBUG PREFIX
294 "input buffer is not empty, aborting transaction\n"); 298 "input buffer is not empty, aborting transaction\n");
@@ -369,8 +373,8 @@ int ec_write(u8 addr, u8 val)
369EXPORT_SYMBOL(ec_write); 373EXPORT_SYMBOL(ec_write);
370 374
371int ec_transaction(u8 command, 375int ec_transaction(u8 command,
372 const u8 * wdata, unsigned wdata_len, 376 const u8 * wdata, unsigned wdata_len,
373 u8 * rdata, unsigned rdata_len) 377 u8 * rdata, unsigned rdata_len)
374{ 378{
375 struct acpi_ec *ec; 379 struct acpi_ec *ec;
376 380
@@ -435,7 +439,7 @@ static u32 acpi_ec_gpe_handler(void *data)
435 acpi_status status = AE_OK; 439 acpi_status status = AE_OK;
436 u8 value; 440 u8 value;
437 struct acpi_ec *ec = (struct acpi_ec *)data; 441 struct acpi_ec *ec = (struct acpi_ec *)data;
438 442 atomic_inc(&ec->event_count);
439 if (acpi_ec_mode == EC_INTR) { 443 if (acpi_ec_mode == EC_INTR) {
440 wake_up(&ec->wait); 444 wake_up(&ec->wait);
441 } 445 }
@@ -633,6 +637,7 @@ static int acpi_ec_add(struct acpi_device *device)
633 ec->uid = -1; 637 ec->uid = -1;
634 mutex_init(&ec->lock); 638 mutex_init(&ec->lock);
635 atomic_set(&ec->query_pending, 0); 639 atomic_set(&ec->query_pending, 0);
640 atomic_set(&ec->event_count, 1);
636 if (acpi_ec_mode == EC_INTR) { 641 if (acpi_ec_mode == EC_INTR) {
637 atomic_set(&ec->leaving_burst, 1); 642 atomic_set(&ec->leaving_burst, 1);
638 init_waitqueue_head(&ec->wait); 643 init_waitqueue_head(&ec->wait);
@@ -807,6 +812,7 @@ acpi_fake_ecdt_callback(acpi_handle handle,
807 acpi_status status; 812 acpi_status status;
808 813
809 mutex_init(&ec_ecdt->lock); 814 mutex_init(&ec_ecdt->lock);
815 atomic_set(&ec_ecdt->event_count, 1);
810 if (acpi_ec_mode == EC_INTR) { 816 if (acpi_ec_mode == EC_INTR) {
811 init_waitqueue_head(&ec_ecdt->wait); 817 init_waitqueue_head(&ec_ecdt->wait);
812 } 818 }
@@ -888,6 +894,7 @@ static int __init acpi_ec_get_real_ecdt(void)
888 return -ENOMEM; 894 return -ENOMEM;
889 895
890 mutex_init(&ec_ecdt->lock); 896 mutex_init(&ec_ecdt->lock);
897 atomic_set(&ec_ecdt->event_count, 1);
891 if (acpi_ec_mode == EC_INTR) { 898 if (acpi_ec_mode == EC_INTR) {
892 init_waitqueue_head(&ec_ecdt->wait); 899 init_waitqueue_head(&ec_ecdt->wait);
893 } 900 }
@@ -1016,8 +1023,7 @@ static int __init acpi_ec_set_intr_mode(char *str)
1016 acpi_ec_mode = EC_POLL; 1023 acpi_ec_mode = EC_POLL;
1017 } 1024 }
1018 acpi_ec_driver.ops.add = acpi_ec_add; 1025 acpi_ec_driver.ops.add = acpi_ec_add;
1019 printk(KERN_NOTICE PREFIX "%s mode.\n", 1026 printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling");
1020 intr ? "interrupt" : "polling");
1021 1027
1022 return 1; 1028 return 1;
1023} 1029}
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index d572700197f3..cae786ca8600 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -196,11 +196,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
196 notify_info->notify.value = (u16) notify_value; 196 notify_info->notify.value = (u16) notify_value;
197 notify_info->notify.handler_obj = handler_obj; 197 notify_info->notify.handler_obj = handler_obj;
198 198
199 acpi_ex_relinquish_interpreter(); 199 acpi_ex_exit_interpreter();
200 200
201 acpi_ev_notify_dispatch(notify_info); 201 acpi_ev_notify_dispatch(notify_info);
202 202
203 acpi_ex_reacquire_interpreter(); 203 status = acpi_ex_enter_interpreter();
204 if (ACPI_FAILURE(status)) {
205 return_ACPI_STATUS(status);
206 }
207
204 } 208 }
205 209
206 if (!handler_obj) { 210 if (!handler_obj) {
@@ -423,6 +427,8 @@ static acpi_status acpi_ev_remove_global_lock_handler(void)
423 * the global lock appear as a standard mutex on the OS side. 427 * the global lock appear as a standard mutex on the OS side.
424 * 428 *
425 *****************************************************************************/ 429 *****************************************************************************/
430static acpi_thread_id acpi_ev_global_lock_thread_id;
431static int acpi_ev_global_lock_acquired;
426 432
427acpi_status acpi_ev_acquire_global_lock(u16 timeout) 433acpi_status acpi_ev_acquire_global_lock(u16 timeout)
428{ 434{
@@ -435,11 +441,24 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
435 * Only one thread can acquire the GL at a time, the global_lock_mutex 441 * Only one thread can acquire the GL at a time, the global_lock_mutex
436 * enforces this. This interface releases the interpreter if we must wait. 442 * enforces this. This interface releases the interpreter if we must wait.
437 */ 443 */
438 status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); 444 status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0);
445 if (status == AE_TIME) {
446 if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) {
447 acpi_ev_global_lock_acquired++;
448 return AE_OK;
449 }
450 }
451
452 if (ACPI_FAILURE(status)) {
453 status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout);
454 }
439 if (ACPI_FAILURE(status)) { 455 if (ACPI_FAILURE(status)) {
440 return_ACPI_STATUS(status); 456 return_ACPI_STATUS(status);
441 } 457 }
442 458
459 acpi_ev_global_lock_thread_id = acpi_os_get_thread_id();
460 acpi_ev_global_lock_acquired++;
461
443 /* 462 /*
444 * Make sure that a global lock actually exists. If not, just treat 463 * Make sure that a global lock actually exists. If not, just treat
445 * the lock as a standard mutex. 464 * the lock as a standard mutex.
@@ -506,6 +525,11 @@ acpi_status acpi_ev_release_global_lock(void)
506 return_ACPI_STATUS(AE_NOT_ACQUIRED); 525 return_ACPI_STATUS(AE_NOT_ACQUIRED);
507 } 526 }
508 527
528 acpi_ev_global_lock_acquired--;
529 if (acpi_ev_global_lock_acquired > 0) {
530 return AE_OK;
531 }
532
509 if (acpi_gbl_global_lock_present) { 533 if (acpi_gbl_global_lock_present) {
510 534
511 /* Allow any thread to release the lock */ 535 /* Allow any thread to release the lock */
@@ -529,7 +553,8 @@ acpi_status acpi_ev_release_global_lock(void)
529 acpi_gbl_global_lock_acquired = FALSE; 553 acpi_gbl_global_lock_acquired = FALSE;
530 554
531 /* Release the local GL mutex */ 555 /* Release the local GL mutex */
532 556 acpi_ev_global_lock_thread_id = NULL;
557 acpi_ev_global_lock_acquired = 0;
533 acpi_os_release_mutex(acpi_gbl_global_lock_mutex); 558 acpi_os_release_mutex(acpi_gbl_global_lock_mutex);
534 return_ACPI_STATUS(status); 559 return_ACPI_STATUS(status);
535} 560}
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index e99f0c435a47..96b0e8431748 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -291,6 +291,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
291 u32 bit_width, acpi_integer * value) 291 u32 bit_width, acpi_integer * value)
292{ 292{
293 acpi_status status; 293 acpi_status status;
294 acpi_status status2;
294 acpi_adr_space_handler handler; 295 acpi_adr_space_handler handler;
295 acpi_adr_space_setup region_setup; 296 acpi_adr_space_setup region_setup;
296 union acpi_operand_object *handler_desc; 297 union acpi_operand_object *handler_desc;
@@ -344,7 +345,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
344 * setup will potentially execute control methods 345 * setup will potentially execute control methods
345 * (e.g., _REG method for this region) 346 * (e.g., _REG method for this region)
346 */ 347 */
347 acpi_ex_relinquish_interpreter(); 348 acpi_ex_exit_interpreter();
348 349
349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE, 350 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
350 handler_desc->address_space.context, 351 handler_desc->address_space.context,
@@ -352,7 +353,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
352 353
353 /* Re-enter the interpreter */ 354 /* Re-enter the interpreter */
354 355
355 acpi_ex_reacquire_interpreter(); 356 status2 = acpi_ex_enter_interpreter();
357 if (ACPI_FAILURE(status2)) {
358 return_ACPI_STATUS(status2);
359 }
356 360
357 /* Check for failure of the Region Setup */ 361 /* Check for failure of the Region Setup */
358 362
@@ -405,7 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
405 * exit the interpreter because the handler *might* block -- we don't 409 * exit the interpreter because the handler *might* block -- we don't
406 * know what it will do, so we can't hold the lock on the intepreter. 410 * know what it will do, so we can't hold the lock on the intepreter.
407 */ 411 */
408 acpi_ex_relinquish_interpreter(); 412 acpi_ex_exit_interpreter();
409 } 413 }
410 414
411 /* Call the handler */ 415 /* Call the handler */
@@ -426,7 +430,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
426 * We just returned from a non-default handler, we must re-enter the 430 * We just returned from a non-default handler, we must re-enter the
427 * interpreter 431 * interpreter
428 */ 432 */
429 acpi_ex_reacquire_interpreter(); 433 status2 = acpi_ex_enter_interpreter();
434 if (ACPI_FAILURE(status2)) {
435 return_ACPI_STATUS(status2);
436 }
430 } 437 }
431 438
432 return_ACPI_STATUS(status); 439 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 685a103a3587..a3379bafa676 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -768,9 +768,11 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
768 return (AE_BAD_PARAMETER); 768 return (AE_BAD_PARAMETER);
769 } 769 }
770 770
771 /* Must lock interpreter to prevent race conditions */ 771 status = acpi_ex_enter_interpreter();
772 if (ACPI_FAILURE(status)) {
773 return (status);
774 }
772 775
773 acpi_ex_enter_interpreter();
774 status = acpi_ev_acquire_global_lock(timeout); 776 status = acpi_ev_acquire_global_lock(timeout);
775 acpi_ex_exit_interpreter(); 777 acpi_ex_exit_interpreter();
776 778
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
index 7c38528a7e83..ae97812681a3 100644
--- a/drivers/acpi/executer/excreate.c
+++ b/drivers/acpi/executer/excreate.c
@@ -583,7 +583,10 @@ acpi_ex_create_method(u8 * aml_start,
583 * Get the sync_level. If method is serialized, a mutex will be 583 * Get the sync_level. If method is serialized, a mutex will be
584 * created for this method when it is parsed. 584 * created for this method when it is parsed.
585 */ 585 */
586 if (method_flags & AML_METHOD_SERIALIZED) { 586 if (acpi_gbl_all_methods_serialized) {
587 obj_desc->method.sync_level = 0;
588 obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
589 } else if (method_flags & AML_METHOD_SERIALIZED) {
587 /* 590 /*
588 * ACPI 1.0: sync_level = 0 591 * ACPI 1.0: sync_level = 0
589 * ACPI 2.0: sync_level = sync_level in method declaration 592 * ACPI 2.0: sync_level = sync_level in method declaration
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index 9460baff3032..b2edf620ba89 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -66,6 +66,7 @@ ACPI_MODULE_NAME("exsystem")
66acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) 66acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
67{ 67{
68 acpi_status status; 68 acpi_status status;
69 acpi_status status2;
69 70
70 ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); 71 ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
71 72
@@ -78,7 +79,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
78 79
79 /* We must wait, so unlock the interpreter */ 80 /* We must wait, so unlock the interpreter */
80 81
81 acpi_ex_relinquish_interpreter(); 82 acpi_ex_exit_interpreter();
82 83
83 status = acpi_os_wait_semaphore(semaphore, 1, timeout); 84 status = acpi_os_wait_semaphore(semaphore, 1, timeout);
84 85
@@ -88,7 +89,13 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
88 89
89 /* Reacquire the interpreter */ 90 /* Reacquire the interpreter */
90 91
91 acpi_ex_reacquire_interpreter(); 92 status2 = acpi_ex_enter_interpreter();
93 if (ACPI_FAILURE(status2)) {
94
95 /* Report fatal error, could not acquire interpreter */
96
97 return_ACPI_STATUS(status2);
98 }
92 } 99 }
93 100
94 return_ACPI_STATUS(status); 101 return_ACPI_STATUS(status);
@@ -112,6 +119,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
112acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) 119acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
113{ 120{
114 acpi_status status; 121 acpi_status status;
122 acpi_status status2;
115 123
116 ACPI_FUNCTION_TRACE(ex_system_wait_mutex); 124 ACPI_FUNCTION_TRACE(ex_system_wait_mutex);
117 125
@@ -124,7 +132,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
124 132
125 /* We must wait, so unlock the interpreter */ 133 /* We must wait, so unlock the interpreter */
126 134
127 acpi_ex_relinquish_interpreter(); 135 acpi_ex_exit_interpreter();
128 136
129 status = acpi_os_acquire_mutex(mutex, timeout); 137 status = acpi_os_acquire_mutex(mutex, timeout);
130 138
@@ -134,7 +142,13 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
134 142
135 /* Reacquire the interpreter */ 143 /* Reacquire the interpreter */
136 144
137 acpi_ex_reacquire_interpreter(); 145 status2 = acpi_ex_enter_interpreter();
146 if (ACPI_FAILURE(status2)) {
147
148 /* Report fatal error, could not acquire interpreter */
149
150 return_ACPI_STATUS(status2);
151 }
138 } 152 }
139 153
140 return_ACPI_STATUS(status); 154 return_ACPI_STATUS(status);
@@ -195,18 +209,20 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
195 209
196acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) 210acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
197{ 211{
212 acpi_status status;
213
198 ACPI_FUNCTION_ENTRY(); 214 ACPI_FUNCTION_ENTRY();
199 215
200 /* Since this thread will sleep, we must release the interpreter */ 216 /* Since this thread will sleep, we must release the interpreter */
201 217
202 acpi_ex_relinquish_interpreter(); 218 acpi_ex_exit_interpreter();
203 219
204 acpi_os_sleep(how_long); 220 acpi_os_sleep(how_long);
205 221
206 /* And now we must get the interpreter again */ 222 /* And now we must get the interpreter again */
207 223
208 acpi_ex_reacquire_interpreter(); 224 status = acpi_ex_enter_interpreter();
209 return (AE_OK); 225 return (status);
210} 226}
211 227
212/******************************************************************************* 228/*******************************************************************************
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 6b0aeccbb69b..aea461f3a48c 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -76,15 +76,14 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
76 * 76 *
77 * PARAMETERS: None 77 * PARAMETERS: None
78 * 78 *
79 * RETURN: None 79 * RETURN: Status
80 * 80 *
81 * DESCRIPTION: Enter the interpreter execution region. Failure to enter 81 * DESCRIPTION: Enter the interpreter execution region. Failure to enter
82 * the interpreter region is a fatal system error. Used in 82 * the interpreter region is a fatal system error
83 * conjunction with exit_interpreter.
84 * 83 *
85 ******************************************************************************/ 84 ******************************************************************************/
86 85
87void acpi_ex_enter_interpreter(void) 86acpi_status acpi_ex_enter_interpreter(void)
88{ 87{
89 acpi_status status; 88 acpi_status status;
90 89
@@ -92,42 +91,10 @@ void acpi_ex_enter_interpreter(void)
92 91
93 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); 92 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
94 if (ACPI_FAILURE(status)) { 93 if (ACPI_FAILURE(status)) {
95 ACPI_ERROR((AE_INFO, 94 ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
96 "Could not acquire AML Interpreter mutex"));
97 } 95 }
98 96
99 return_VOID; 97 return_ACPI_STATUS(status);
100}
101
102/*******************************************************************************
103 *
104 * FUNCTION: acpi_ex_reacquire_interpreter
105 *
106 * PARAMETERS: None
107 *
108 * RETURN: None
109 *
110 * DESCRIPTION: Reacquire the interpreter execution region from within the
111 * interpreter code. Failure to enter the interpreter region is a
112 * fatal system error. Used in conjuction with
113 * relinquish_interpreter
114 *
115 ******************************************************************************/
116
117void acpi_ex_reacquire_interpreter(void)
118{
119 ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);
120
121 /*
122 * If the global serialized flag is set, do not release the interpreter,
123 * since it was not actually released by acpi_ex_relinquish_interpreter.
124 * This forces the interpreter to be single threaded.
125 */
126 if (!acpi_gbl_all_methods_serialized) {
127 acpi_ex_enter_interpreter();
128 }
129
130 return_VOID;
131} 98}
132 99
133/******************************************************************************* 100/*******************************************************************************
@@ -138,9 +105,17 @@ void acpi_ex_reacquire_interpreter(void)
138 * 105 *
139 * RETURN: None 106 * RETURN: None
140 * 107 *
141 * DESCRIPTION: Exit the interpreter execution region. This is the top level 108 * DESCRIPTION: Exit the interpreter execution region
142 * routine used to exit the interpreter when all processing has 109 *
143 * been completed. 110 * Cases where the interpreter is unlocked:
111 * 1) Completion of the execution of a control method
112 * 2) Method blocked on a Sleep() AML opcode
113 * 3) Method blocked on an Acquire() AML opcode
114 * 4) Method blocked on a Wait() AML opcode
115 * 5) Method blocked to acquire the global lock
116 * 6) Method blocked to execute a serialized control method that is
117 * already executing
118 * 7) About to invoke a user-installed opregion handler
144 * 119 *
145 ******************************************************************************/ 120 ******************************************************************************/
146 121
@@ -152,46 +127,7 @@ void acpi_ex_exit_interpreter(void)
152 127
153 status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); 128 status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
154 if (ACPI_FAILURE(status)) { 129 if (ACPI_FAILURE(status)) {
155 ACPI_ERROR((AE_INFO, 130 ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
156 "Could not release AML Interpreter mutex"));
157 }
158
159 return_VOID;
160}
161
162/*******************************************************************************
163 *
164 * FUNCTION: acpi_ex_relinquish_interpreter
165 *
166 * PARAMETERS: None
167 *
168 * RETURN: None
169 *
170 * DESCRIPTION: Exit the interpreter execution region, from within the
171 * interpreter - before attempting an operation that will possibly
172 * block the running thread.
173 *
174 * Cases where the interpreter is unlocked internally
175 * 1) Method to be blocked on a Sleep() AML opcode
176 * 2) Method to be blocked on an Acquire() AML opcode
177 * 3) Method to be blocked on a Wait() AML opcode
178 * 4) Method to be blocked to acquire the global lock
179 * 5) Method to be blocked waiting to execute a serialized control method
180 * that is currently executing
181 * 6) About to invoke a user-installed opregion handler
182 *
183 ******************************************************************************/
184
185void acpi_ex_relinquish_interpreter(void)
186{
187 ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);
188
189 /*
190 * If the global serialized flag is set, do not release the interpreter.
191 * This forces the interpreter to be single threaded.
192 */
193 if (!acpi_gbl_all_methods_serialized) {
194 acpi_ex_exit_interpreter();
195 } 131 }
196 132
197 return_VOID; 133 return_VOID;
@@ -205,8 +141,8 @@ void acpi_ex_relinquish_interpreter(void)
205 * 141 *
206 * RETURN: none 142 * RETURN: none
207 * 143 *
208 * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is 144 * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
209 * 32-bit, as determined by the revision of the DSDT. 145 * belongs to a 32-bit ACPI table.
210 * 146 *
211 ******************************************************************************/ 147 ******************************************************************************/
212 148
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 8fa93125fd4c..c84b1faba28c 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -300,6 +300,11 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
300 /* 300 /*
301 * 2) Enable all wakeup GPEs 301 * 2) Enable all wakeup GPEs
302 */ 302 */
303 status = acpi_hw_disable_all_gpes();
304 if (ACPI_FAILURE(status)) {
305 return_ACPI_STATUS(status);
306 }
307
303 acpi_gbl_system_awake_and_running = FALSE; 308 acpi_gbl_system_awake_and_running = FALSE;
304 309
305 status = acpi_hw_enable_all_wakeup_gpes(); 310 status = acpi_hw_enable_all_wakeup_gpes();
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 4cc534e36e81..dc1096608f43 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -86,6 +86,7 @@
86 86
87#include <linux/proc_fs.h> 87#include <linux/proc_fs.h>
88#include <linux/backlight.h> 88#include <linux/backlight.h>
89#include <linux/fb.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
90 91
91#include <linux/dmi.h> 92#include <linux/dmi.h>
@@ -157,6 +158,7 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */
157 "\\_SB.PCI.ISA.SLCE", /* 570 */ 158 "\\_SB.PCI.ISA.SLCE", /* 570 */
158 ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ 159 ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */
159#endif 160#endif
161#ifdef CONFIG_ACPI_IBM_BAY
160IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ 162IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */
161 "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ 163 "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */
162 "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ 164 "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */
@@ -174,6 +176,7 @@ IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV", /* A3x, R32 */
174IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ 176IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */
175 "_EJ0", /* 770x */ 177 "_EJ0", /* 770x */
176 ); /* all others */ 178 ); /* all others */
179#endif /* CONFIG_ACPI_IBM_BAY */
177 180
178/* don't list other alternatives as we install a notify handler on the 570 */ 181/* don't list other alternatives as we install a notify handler on the 570 */
179IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ 182IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */
@@ -1044,6 +1047,7 @@ static int light_write(char *buf)
1044 return 0; 1047 return 0;
1045} 1048}
1046 1049
1050#if defined(CONFIG_ACPI_IBM_DOCK) || defined(CONFIG_ACPI_IBM_BAY)
1047static int _sta(acpi_handle handle) 1051static int _sta(acpi_handle handle)
1048{ 1052{
1049 int status; 1053 int status;
@@ -1053,6 +1057,7 @@ static int _sta(acpi_handle handle)
1053 1057
1054 return status; 1058 return status;
1055} 1059}
1060#endif
1056 1061
1057#ifdef CONFIG_ACPI_IBM_DOCK 1062#ifdef CONFIG_ACPI_IBM_DOCK
1058#define dock_docked() (_sta(dock_handle) & 1) 1063#define dock_docked() (_sta(dock_handle) & 1)
@@ -1119,6 +1124,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
1119} 1124}
1120#endif 1125#endif
1121 1126
1127#ifdef CONFIG_ACPI_IBM_BAY
1122static int bay_status_supported; 1128static int bay_status_supported;
1123static int bay_status2_supported; 1129static int bay_status2_supported;
1124static int bay_eject_supported; 1130static int bay_eject_supported;
@@ -1194,6 +1200,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event)
1194{ 1200{
1195 acpi_bus_generate_event(ibm->device, event, 0); 1201 acpi_bus_generate_event(ibm->device, event, 0);
1196} 1202}
1203#endif /* CONFIG_ACPI_IBM_BAY */
1197 1204
1198static int cmos_read(char *p) 1205static int cmos_read(char *p)
1199{ 1206{
@@ -1701,7 +1708,10 @@ static int brightness_write(char *buf)
1701 1708
1702static int brightness_update_status(struct backlight_device *bd) 1709static int brightness_update_status(struct backlight_device *bd)
1703{ 1710{
1704 return brightness_set(bd->props.brightness); 1711 return brightness_set(
1712 (bd->props.fb_blank == FB_BLANK_UNBLANK &&
1713 bd->props.power == FB_BLANK_UNBLANK) ?
1714 bd->props.brightness : 0);
1705} 1715}
1706 1716
1707static struct backlight_ops ibm_backlight_data = { 1717static struct backlight_ops ibm_backlight_data = {
@@ -1711,6 +1721,12 @@ static struct backlight_ops ibm_backlight_data = {
1711 1721
1712static int brightness_init(void) 1722static int brightness_init(void)
1713{ 1723{
1724 int b;
1725
1726 b = brightness_get(NULL);
1727 if (b < 0)
1728 return b;
1729
1714 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, 1730 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
1715 &ibm_backlight_data); 1731 &ibm_backlight_data);
1716 if (IS_ERR(ibm_backlight_device)) { 1732 if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1734,9 @@ static int brightness_init(void)
1718 return PTR_ERR(ibm_backlight_device); 1734 return PTR_ERR(ibm_backlight_device);
1719 } 1735 }
1720 1736
1721 ibm_backlight_device->props.max_brightness = 7; 1737 ibm_backlight_device->props.max_brightness = 7;
1738 ibm_backlight_device->props.brightness = b;
1739 backlight_update_status(ibm_backlight_device);
1722 1740
1723 return 0; 1741 return 0;
1724} 1742}
@@ -2353,6 +2371,7 @@ static struct ibm_struct ibms[] = {
2353 .type = ACPI_SYSTEM_NOTIFY, 2371 .type = ACPI_SYSTEM_NOTIFY,
2354 }, 2372 },
2355#endif 2373#endif
2374#ifdef CONFIG_ACPI_IBM_BAY
2356 { 2375 {
2357 .name = "bay", 2376 .name = "bay",
2358 .init = bay_init, 2377 .init = bay_init,
@@ -2362,6 +2381,7 @@ static struct ibm_struct ibms[] = {
2362 .handle = &bay_handle, 2381 .handle = &bay_handle,
2363 .type = ACPI_SYSTEM_NOTIFY, 2382 .type = ACPI_SYSTEM_NOTIFY,
2364 }, 2383 },
2384#endif /* CONFIG_ACPI_IBM_BAY */
2365 { 2385 {
2366 .name = "cmos", 2386 .name = "cmos",
2367 .read = cmos_read, 2387 .read = cmos_read,
@@ -2487,7 +2507,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
2487 ret = acpi_bus_get_device(*ibm->handle, &ibm->device); 2507 ret = acpi_bus_get_device(*ibm->handle, &ibm->device);
2488 if (ret < 0) { 2508 if (ret < 0) {
2489 printk(IBM_ERR "%s device not present\n", ibm->name); 2509 printk(IBM_ERR "%s device not present\n", ibm->name);
2490 return 0; 2510 return -ENODEV;
2491 } 2511 }
2492 2512
2493 acpi_driver_data(ibm->device) = ibm; 2513 acpi_driver_data(ibm->device) = ibm;
@@ -2496,8 +2516,13 @@ static int __init setup_notify(struct ibm_struct *ibm)
2496 status = acpi_install_notify_handler(*ibm->handle, ibm->type, 2516 status = acpi_install_notify_handler(*ibm->handle, ibm->type,
2497 dispatch_notify, ibm); 2517 dispatch_notify, ibm);
2498 if (ACPI_FAILURE(status)) { 2518 if (ACPI_FAILURE(status)) {
2499 printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n", 2519 if (status == AE_ALREADY_EXISTS) {
2500 ibm->name, status); 2520 printk(IBM_NOTICE "another device driver is already handling %s events\n",
2521 ibm->name);
2522 } else {
2523 printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n",
2524 ibm->name, status);
2525 }
2501 return -ENODEV; 2526 return -ENODEV;
2502 } 2527 }
2503 ibm->notify_installed = 1; 2528 ibm->notify_installed = 1;
@@ -2533,6 +2558,8 @@ static int __init register_driver(struct ibm_struct *ibm)
2533 return ret; 2558 return ret;
2534} 2559}
2535 2560
2561static void ibm_exit(struct ibm_struct *ibm);
2562
2536static int __init ibm_init(struct ibm_struct *ibm) 2563static int __init ibm_init(struct ibm_struct *ibm)
2537{ 2564{
2538 int ret; 2565 int ret;
@@ -2574,6 +2601,12 @@ static int __init ibm_init(struct ibm_struct *ibm)
2574 2601
2575 if (ibm->notify) { 2602 if (ibm->notify) {
2576 ret = setup_notify(ibm); 2603 ret = setup_notify(ibm);
2604 if (ret == -ENODEV) {
2605 printk(IBM_NOTICE "disabling subdriver %s\n",
2606 ibm->name);
2607 ibm_exit(ibm);
2608 return 0;
2609 }
2577 if (ret < 0) 2610 if (ret < 0)
2578 return ret; 2611 return ret;
2579 } 2612 }
@@ -2647,7 +2680,9 @@ IBM_PARAM(light);
2647#ifdef CONFIG_ACPI_IBM_DOCK 2680#ifdef CONFIG_ACPI_IBM_DOCK
2648IBM_PARAM(dock); 2681IBM_PARAM(dock);
2649#endif 2682#endif
2683#ifdef CONFIG_ACPI_IBM_BAY
2650IBM_PARAM(bay); 2684IBM_PARAM(bay);
2685#endif /* CONFIG_ACPI_IBM_BAY */
2651IBM_PARAM(cmos); 2686IBM_PARAM(cmos);
2652IBM_PARAM(led); 2687IBM_PARAM(led);
2653IBM_PARAM(beep); 2688IBM_PARAM(beep);
@@ -2723,12 +2758,14 @@ static int __init acpi_ibm_init(void)
2723 IBM_HANDLE_INIT(dock); 2758 IBM_HANDLE_INIT(dock);
2724#endif 2759#endif
2725 IBM_HANDLE_INIT(pci); 2760 IBM_HANDLE_INIT(pci);
2761#ifdef CONFIG_ACPI_IBM_BAY
2726 IBM_HANDLE_INIT(bay); 2762 IBM_HANDLE_INIT(bay);
2727 if (bay_handle) 2763 if (bay_handle)
2728 IBM_HANDLE_INIT(bay_ej); 2764 IBM_HANDLE_INIT(bay_ej);
2729 IBM_HANDLE_INIT(bay2); 2765 IBM_HANDLE_INIT(bay2);
2730 if (bay2_handle) 2766 if (bay2_handle)
2731 IBM_HANDLE_INIT(bay2_ej); 2767 IBM_HANDLE_INIT(bay2_ej);
2768#endif /* CONFIG_ACPI_IBM_BAY */
2732 IBM_HANDLE_INIT(beep); 2769 IBM_HANDLE_INIT(beep);
2733 IBM_HANDLE_INIT(ecrd); 2770 IBM_HANDLE_INIT(ecrd);
2734 IBM_HANDLE_INIT(ecwr); 2771 IBM_HANDLE_INIT(ecwr);
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index aa6370c67ec1..26fd0dd6953d 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -154,7 +154,11 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
154 * Execute the method via the interpreter. The interpreter is locked 154 * Execute the method via the interpreter. The interpreter is locked
155 * here before calling into the AML parser 155 * here before calling into the AML parser
156 */ 156 */
157 acpi_ex_enter_interpreter(); 157 status = acpi_ex_enter_interpreter();
158 if (ACPI_FAILURE(status)) {
159 return_ACPI_STATUS(status);
160 }
161
158 status = acpi_ps_execute_method(info); 162 status = acpi_ps_execute_method(info);
159 acpi_ex_exit_interpreter(); 163 acpi_ex_exit_interpreter();
160 } else { 164 } else {
@@ -178,7 +182,10 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
178 * resolution, we must lock it because we could access an opregion. 182 * resolution, we must lock it because we could access an opregion.
179 * The opregion access code assumes that the interpreter is locked. 183 * The opregion access code assumes that the interpreter is locked.
180 */ 184 */
181 acpi_ex_enter_interpreter(); 185 status = acpi_ex_enter_interpreter();
186 if (ACPI_FAILURE(status)) {
187 return_ACPI_STATUS(status);
188 }
182 189
183 /* Function has a strange interface */ 190 /* Function has a strange interface */
184 191
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 33db2241044e..c4ab615f77fe 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
214 u32 level, void *context, void **return_value) 214 u32 level, void *context, void **return_value)
215{ 215{
216 acpi_object_type type; 216 acpi_object_type type;
217 acpi_status status = AE_OK; 217 acpi_status status;
218 struct acpi_init_walk_info *info = 218 struct acpi_init_walk_info *info =
219 (struct acpi_init_walk_info *)context; 219 (struct acpi_init_walk_info *)context;
220 struct acpi_namespace_node *node = 220 struct acpi_namespace_node *node =
@@ -268,7 +268,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
268 /* 268 /*
269 * Must lock the interpreter before executing AML code 269 * Must lock the interpreter before executing AML code
270 */ 270 */
271 acpi_ex_enter_interpreter(); 271 status = acpi_ex_enter_interpreter();
272 if (ACPI_FAILURE(status)) {
273 return (status);
274 }
272 275
273 /* 276 /*
274 * Each of these types can contain executable AML code within the 277 * Each of these types can contain executable AML code within the
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index 7ac6ace50059..8904d0fae6a2 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -170,6 +170,7 @@ acpi_evaluate_object(acpi_handle handle,
170 struct acpi_buffer *return_buffer) 170 struct acpi_buffer *return_buffer)
171{ 171{
172 acpi_status status; 172 acpi_status status;
173 acpi_status status2;
173 struct acpi_evaluate_info *info; 174 struct acpi_evaluate_info *info;
174 acpi_size buffer_space_needed; 175 acpi_size buffer_space_needed;
175 u32 i; 176 u32 i;
@@ -328,12 +329,14 @@ acpi_evaluate_object(acpi_handle handle,
328 * Delete the internal return object. NOTE: Interpreter must be 329 * Delete the internal return object. NOTE: Interpreter must be
329 * locked to avoid race condition. 330 * locked to avoid race condition.
330 */ 331 */
331 acpi_ex_enter_interpreter(); 332 status2 = acpi_ex_enter_interpreter();
333 if (ACPI_SUCCESS(status2)) {
332 334
333 /* Remove one reference on the return object (should delete it) */ 335 /* Remove one reference on the return object (should delete it) */
334 336
335 acpi_ut_remove_reference(info->return_object); 337 acpi_ut_remove_reference(info->return_object);
336 acpi_ex_exit_interpreter(); 338 acpi_ex_exit_interpreter();
339 }
337 } 340 }
338 341
339 cleanup: 342 cleanup:
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 1ef338545dfe..4ffecd179702 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -436,8 +436,6 @@ int acpi_power_transition(struct acpi_device *device, int state)
436 cl = &device->power.states[device->power.state].resources; 436 cl = &device->power.states[device->power.state].resources;
437 tl = &device->power.states[state].resources; 437 tl = &device->power.states[state].resources;
438 438
439 device->power.state = ACPI_STATE_UNKNOWN;
440
441 if (!cl->count && !tl->count) { 439 if (!cl->count && !tl->count) {
442 result = -ENODEV; 440 result = -ENODEV;
443 goto end; 441 goto end;
@@ -468,12 +466,15 @@ int acpi_power_transition(struct acpi_device *device, int state)
468 goto end; 466 goto end;
469 } 467 }
470 468
471 /* We shouldn't change the state till all above operations succeed */ 469 end:
472 device->power.state = state; 470 if (result) {
473 end: 471 device->power.state = ACPI_STATE_UNKNOWN;
474 if (result)
475 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", 472 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
476 device->pnp.bus_id, state); 473 device->pnp.bus_id, state);
474 } else {
475 /* We shouldn't change the state till all above operations succeed */
476 device->power.state = state;
477 }
477 478
478 return result; 479 return result;
479} 480}
@@ -687,13 +688,6 @@ static int acpi_power_resume(struct acpi_device *device)
687 return result; 688 return result;
688 689
689 mutex_lock(&resource->resource_lock); 690 mutex_lock(&resource->resource_lock);
690 if ((resource->state == ACPI_POWER_RESOURCE_STATE_ON) &&
691 list_empty(&resource->reference)) {
692 mutex_unlock(&resource->resource_lock);
693 result = acpi_power_off_device(device->handle, NULL);
694 return result;
695 }
696
697 if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && 691 if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) &&
698 !list_empty(&resource->reference)) { 692 !list_empty(&resource->reference)) {
699 ref = container_of(resource->reference.next, struct acpi_power_reference, node); 693 ref = container_of(resource->reference.next, struct acpi_power_reference, node);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 60773005b8af..cdf78943af4d 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -268,6 +268,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
268 struct acpi_processor_cx *cx) 268 struct acpi_processor_cx *cx)
269{ 269{
270 struct acpi_processor_power *pwr = &pr->power; 270 struct acpi_processor_power *pwr = &pr->power;
271 u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2;
271 272
272 /* 273 /*
273 * Check, if one of the previous states already marked the lapic 274 * Check, if one of the previous states already marked the lapic
@@ -276,7 +277,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
276 if (pwr->timer_broadcast_on_state < state) 277 if (pwr->timer_broadcast_on_state < state)
277 return; 278 return;
278 279
279 if (cx->type >= ACPI_STATE_C2) 280 if (cx->type >= type)
280 pr->power.timer_broadcast_on_state = state; 281 pr->power.timer_broadcast_on_state = state;
281} 282}
282 283
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 1358c06a969c..cc48ab05676c 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
192 192
193 for (index = 0; index < number_of_elements; index++) { 193 for (index = 0; index < number_of_elements; index++) {
194 int source_name_index = 2;
195 int source_index_index = 3;
196
194 /* 197 /*
195 * Point user_prt past this current structure 198 * Point user_prt past this current structure
196 * 199 *
@@ -261,10 +264,28 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
261 } 264 }
262 265
263 /* 266 /*
267 * If BIOS erroneously reversed the _PRT source_name and source_index,
268 * then reverse them back.
269 */
270 if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) {
271 if (acpi_gbl_enable_interpreter_slack) {
272 source_name_index = 3;
273 source_index_index = 2;
274 printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,
277 "(PRT[%X].source_index) Need Integer, found %s",
278 index,
279 acpi_ut_get_object_type_name(sub_object_list[3])));
280 return_ACPI_STATUS(AE_BAD_DATA);
281 }
282 }
283
284 /*
264 * 3) Third subobject: Dereference the PRT.source_name 285 * 3) Third subobject: Dereference the PRT.source_name
265 * The name may be unresolved (slack mode), so allow a null object 286 * The name may be unresolved (slack mode), so allow a null object
266 */ 287 */
267 obj_desc = sub_object_list[2]; 288 obj_desc = sub_object_list[source_name_index];
268 if (obj_desc) { 289 if (obj_desc) {
269 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 290 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
270 case ACPI_TYPE_LOCAL_REFERENCE: 291 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
339 360
340 /* 4) Fourth subobject: Dereference the PRT.source_index */ 361 /* 4) Fourth subobject: Dereference the PRT.source_index */
341 362
342 obj_desc = sub_object_list[3]; 363 obj_desc = sub_object_list[source_index_index];
343 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 364 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
344 user_prt->source_index = (u32) obj_desc->integer.value; 365 user_prt->source_index = (u32) obj_desc->integer.value;
345 } else { 366 } else {
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 849e2c361804..c3419182c9a7 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -42,7 +42,9 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
42 42
43static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata; 43static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;
44 44
45void acpi_table_print_madt_entry(struct acpi_subtable_header * header) 45static int acpi_apic_instance __initdata;
46
47void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
46{ 48{
47 if (!header) 49 if (!header)
48 return; 50 return;
@@ -183,8 +185,10 @@ acpi_table_parse_entries(char *id,
183 if (!handler) 185 if (!handler)
184 return -EINVAL; 186 return -EINVAL;
185 187
186 /* Locate the table (if exists). There should only be one. */ 188 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
187 acpi_get_table(id, 0, &table_header); 189 acpi_get_table(id, acpi_apic_instance, &table_header);
190 else
191 acpi_get_table(id, 0, &table_header);
188 192
189 if (!table_header) { 193 if (!table_header) {
190 printk(KERN_WARNING PREFIX "%4.4s not present\n", id); 194 printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
@@ -237,10 +241,15 @@ acpi_table_parse_madt(enum acpi_madt_type id,
237int __init acpi_table_parse(char *id, acpi_table_handler handler) 241int __init acpi_table_parse(char *id, acpi_table_handler handler)
238{ 242{
239 struct acpi_table_header *table = NULL; 243 struct acpi_table_header *table = NULL;
244
240 if (!handler) 245 if (!handler)
241 return -EINVAL; 246 return -EINVAL;
242 247
243 acpi_get_table(id, 0, &table); 248 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
249 acpi_get_table(id, acpi_apic_instance, &table);
250 else
251 acpi_get_table(id, 0, &table);
252
244 if (table) { 253 if (table) {
245 handler(table); 254 handler(table);
246 return 0; 255 return 0;
@@ -248,6 +257,31 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
248 return 1; 257 return 1;
249} 258}
250 259
260/*
261 * The BIOS is supposed to supply a single APIC/MADT,
262 * but some report two. Provide a knob to use either.
263 * (don't you wish instance 0 and 1 were not the same?)
264 */
265static void __init check_multiple_madt(void)
266{
267 struct acpi_table_header *table = NULL;
268
269 acpi_get_table(ACPI_SIG_MADT, 2, &table);
270 if (table) {
271 printk(KERN_WARNING PREFIX
272 "BIOS bug: multiple APIC/MADT found,"
273 " using %d\n", acpi_apic_instance);
274 printk(KERN_WARNING PREFIX
275 "If \"acpi_apic_instance=%d\" works better, "
276 "notify linux-acpi@vger.kernel.org\n",
277 acpi_apic_instance ? 0 : 2);
278
279 } else
280 acpi_apic_instance = 0;
281
282 return;
283}
284
251/* 285/*
252 * acpi_table_init() 286 * acpi_table_init()
253 * 287 *
@@ -257,9 +291,22 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
257 * result: sdt_entry[] is initialized 291 * result: sdt_entry[] is initialized
258 */ 292 */
259 293
260
261int __init acpi_table_init(void) 294int __init acpi_table_init(void)
262{ 295{
263 acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); 296 acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
297 check_multiple_madt();
298 return 0;
299}
300
301static int __init acpi_parse_apic_instance(char *str)
302{
303
304 acpi_apic_instance = simple_strtoul(str, NULL, 0);
305
306 printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n",
307 acpi_apic_instance);
308
264 return 0; 309 return 0;
265} 310}
311
312early_param("acpi_apic_instance", acpi_parse_apic_instance);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 0771b434feb2..00d25b347255 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -102,9 +102,9 @@ struct acpi_video_bus_cap {
102 102
103struct acpi_video_device_attrib { 103struct acpi_video_device_attrib {
104 u32 display_index:4; /* A zero-based instance of the Display */ 104 u32 display_index:4; /* A zero-based instance of the Display */
105 u32 display_port_attachment:4; /*This field differenates displays type */ 105 u32 display_port_attachment:4; /*This field differentiates the display type */
106 u32 display_type:4; /*Describe the specific type in use */ 106 u32 display_type:4; /*Describe the specific type in use */
107 u32 vendor_specific:4; /*Chipset Vendor Specifi */ 107 u32 vendor_specific:4; /*Chipset Vendor Specific */
108 u32 bios_can_detect:1; /*BIOS can detect the device */ 108 u32 bios_can_detect:1; /*BIOS can detect the device */
109 u32 depend_on_vga:1; /*Non-VGA output device whose power is related to 109 u32 depend_on_vga:1; /*Non-VGA output device whose power is related to
110 the VGA device. */ 110 the VGA device. */
@@ -484,16 +484,16 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
484 * 0. The system BIOS should NOT automatically switch(toggle) 484 * 0. The system BIOS should NOT automatically switch(toggle)
485 * the active display output. 485 * the active display output.
486 * 1. The system BIOS should automatically switch (toggle) the 486 * 1. The system BIOS should automatically switch (toggle) the
487 * active display output. No swich event. 487 * active display output. No switch event.
488 * 2. The _DGS value should be locked. 488 * 2. The _DGS value should be locked.
489 * 3. The system BIOS should not automatically switch (toggle) the 489 * 3. The system BIOS should not automatically switch (toggle) the
490 * active display output, but instead generate the display switch 490 * active display output, but instead generate the display switch
491 * event notify code. 491 * event notify code.
492 * lcd_flag : 492 * lcd_flag :
493 * 0. The system BIOS should automatically control the brightness level 493 * 0. The system BIOS should automatically control the brightness level
494 * of the LCD, when the power changes from AC to DC 494 * of the LCD when the power changes from AC to DC
495 * 1. The system BIOS should NOT automatically control the brightness 495 * 1. The system BIOS should NOT automatically control the brightness
496 * level of the LCD, when the power changes from AC to DC. 496 * level of the LCD when the power changes from AC to DC.
497 * Return Value: 497 * Return Value:
498 * -1 wrong arg. 498 * -1 wrong arg.
499 */ 499 */
@@ -525,7 +525,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
525 * Return Value: 525 * Return Value:
526 * None 526 * None
527 * 527 *
528 * Find out all required AML method defined under the output 528 * Find out all required AML methods defined under the output
529 * device. 529 * device.
530 */ 530 */
531 531
@@ -636,7 +636,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
636 * Return Value: 636 * Return Value:
637 * None 637 * None
638 * 638 *
639 * Find out all required AML method defined under the video bus device. 639 * Find out all required AML methods defined under the video bus device.
640 */ 640 */
641 641
642static void acpi_video_bus_find_cap(struct acpi_video_bus *video) 642static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
@@ -681,19 +681,19 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
681 * to check well known required nodes. 681 * to check well known required nodes.
682 */ 682 */
683 683
684 /* Does this device able to support video switching ? */ 684 /* Does this device support video switching? */
685 if (video->cap._DOS) { 685 if (video->cap._DOS) {
686 video->flags.multihead = 1; 686 video->flags.multihead = 1;
687 status = 0; 687 status = 0;
688 } 688 }
689 689
690 /* Does this device able to retrieve a retrieve a video ROM ? */ 690 /* Does this device support retrieving a video ROM? */
691 if (video->cap._ROM) { 691 if (video->cap._ROM) {
692 video->flags.rom = 1; 692 video->flags.rom = 1;
693 status = 0; 693 status = 0;
694 } 694 }
695 695
696 /* Does this device able to configure which video device to POST ? */ 696 /* Does this device support configuring which video device to POST? */
697 if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { 697 if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
698 video->flags.post = 1; 698 video->flags.post = 1;
699 status = 0; 699 status = 0;
@@ -860,7 +860,7 @@ acpi_video_device_write_brightness(struct file *file,
860 if (level > 100) 860 if (level > 100)
861 return -EFAULT; 861 return -EFAULT;
862 862
863 /* validate though the list of available levels */ 863 /* validate through the list of available levels */
864 for (i = 0; i < dev->brightness->count; i++) 864 for (i = 0; i < dev->brightness->count; i++)
865 if (level == dev->brightness->levels[i]) { 865 if (level == dev->brightness->levels[i]) {
866 if (ACPI_SUCCESS 866 if (ACPI_SUCCESS
@@ -1065,10 +1065,10 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1065 printk(KERN_WARNING PREFIX 1065 printk(KERN_WARNING PREFIX
1066 "The motherboard VGA device is not listed as a possible POST device.\n"); 1066 "The motherboard VGA device is not listed as a possible POST device.\n");
1067 printk(KERN_WARNING PREFIX 1067 printk(KERN_WARNING PREFIX
1068 "This indicate a BIOS bug. Please contact the manufacturer.\n"); 1068 "This indicates a BIOS bug. Please contact the manufacturer.\n");
1069 } 1069 }
1070 printk("%lx\n", options); 1070 printk("%lx\n", options);
1071 seq_printf(seq, "can POST: <intgrated video>"); 1071 seq_printf(seq, "can POST: <integrated video>");
1072 if (options & 2) 1072 if (options & 2)
1073 seq_printf(seq, " <PCI video>"); 1073 seq_printf(seq, " <PCI video>");
1074 if (options & 4) 1074 if (options & 4)
@@ -1102,7 +1102,7 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1102 seq_printf(seq, "<not supported>\n"); 1102 seq_printf(seq, "<not supported>\n");
1103 goto end; 1103 goto end;
1104 } 1104 }
1105 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); 1105 seq_printf(seq, "device POSTed is <%s>\n", device_decode[id & 3]);
1106 1106
1107 end: 1107 end:
1108 return 0; 1108 return 0;
@@ -1156,7 +1156,7 @@ acpi_video_bus_write_POST(struct file *file,
1156 if (opt > 3) 1156 if (opt > 3)
1157 return -EFAULT; 1157 return -EFAULT;
1158 1158
1159 /* just in case an OEM 'forget' the motherboard... */ 1159 /* just in case an OEM 'forgot' the motherboard... */
1160 options |= 1; 1160 options |= 1;
1161 1161
1162 if (options & (1ul << opt)) { 1162 if (options & (1ul << opt)) {
@@ -1527,13 +1527,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1527/* 1527/*
1528 * Arg: 1528 * Arg:
1529 * video : video bus device 1529 * video : video bus device
1530 * event : Nontify Event 1530 * event : notify event
1531 * 1531 *
1532 * Return: 1532 * Return:
1533 * < 0 : error 1533 * < 0 : error
1534 * 1534 *
1535 * 1. Find out the current active output device. 1535 * 1. Find out the current active output device.
1536 * 2. Identify the next output device to switch 1536 * 2. Identify the next output device to switch to.
1537 * 3. call _DSS to do actual switch. 1537 * 3. call _DSS to do actual switch.
1538 */ 1538 */
1539 1539
@@ -1723,12 +1723,12 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1723 device = video->device; 1723 device = video->device;
1724 1724
1725 switch (event) { 1725 switch (event) {
1726 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, 1726 case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch,
1727 * most likely via hotkey. */ 1727 * most likely via hotkey. */
1728 acpi_bus_generate_event(device, event, 0); 1728 acpi_bus_generate_event(device, event, 0);
1729 break; 1729 break;
1730 1730
1731 case ACPI_VIDEO_NOTIFY_PROBE: /* User plug or remove a video 1731 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video
1732 * connector. */ 1732 * connector. */
1733 acpi_video_device_enumerate(video); 1733 acpi_video_device_enumerate(video);
1734 acpi_video_device_rebind(video); 1734 acpi_video_device_rebind(video);
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index d16b5b0c8b76..7bdbe5a914d0 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -564,7 +564,7 @@ config PATA_IXP4XX_CF
564 564
565config PATA_SCC 565config PATA_SCC
566 tristate "Toshiba's Cell Reference Set IDE support" 566 tristate "Toshiba's Cell Reference Set IDE support"
567 depends on PCI && PPC_IBM_CELL_BLADE 567 depends on PCI && PPC_CELLEB
568 help 568 help
569 This option enables support for the built-in IDE controller on 569 This option enables support for the built-in IDE controller on
570 Toshiba Cell Reference Board. 570 Toshiba Cell Reference Board.
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index dc7b56225923..fd27227771b4 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -80,6 +80,7 @@ enum {
80 board_ahci_pi = 1, 80 board_ahci_pi = 1,
81 board_ahci_vt8251 = 2, 81 board_ahci_vt8251 = 2,
82 board_ahci_ign_iferr = 3, 82 board_ahci_ign_iferr = 3,
83 board_ahci_sb600 = 4,
83 84
84 /* global controller registers */ 85 /* global controller registers */
85 HOST_CAP = 0x00, /* host capabilities */ 86 HOST_CAP = 0x00, /* host capabilities */
@@ -168,6 +169,7 @@ enum {
168 AHCI_FLAG_NO_NCQ = (1 << 24), 169 AHCI_FLAG_NO_NCQ = (1 << 24),
169 AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */ 170 AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */
170 AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ 171 AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */
172 AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */
171}; 173};
172 174
173struct ahci_cmd_hdr { 175struct ahci_cmd_hdr {
@@ -362,6 +364,18 @@ static const struct ata_port_info ahci_port_info[] = {
362 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 364 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
363 .port_ops = &ahci_ops, 365 .port_ops = &ahci_ops,
364 }, 366 },
367 /* board_ahci_sb600 */
368 {
369 .sht = &ahci_sht,
370 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
371 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
372 ATA_FLAG_SKIP_D2H_BSY |
373 AHCI_FLAG_IGN_SERR_INTERNAL,
374 .pio_mask = 0x1f, /* pio0-4 */
375 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
376 .port_ops = &ahci_ops,
377 },
378
365}; 379};
366 380
367static const struct pci_device_id ahci_pci_tbl[] = { 381static const struct pci_device_id ahci_pci_tbl[] = {
@@ -399,7 +413,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
399 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr }, 413 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr },
400 414
401 /* ATI */ 415 /* ATI */
402 { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */ 416 { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 non-raid */
403 { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */ 417 { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */
404 418
405 /* VIA */ 419 /* VIA */
@@ -1067,8 +1081,11 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1067 if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR) 1081 if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR)
1068 irq_stat &= ~PORT_IRQ_IF_ERR; 1082 irq_stat &= ~PORT_IRQ_IF_ERR;
1069 1083
1070 if (irq_stat & PORT_IRQ_TF_ERR) 1084 if (irq_stat & PORT_IRQ_TF_ERR) {
1071 err_mask |= AC_ERR_DEV; 1085 err_mask |= AC_ERR_DEV;
1086 if (ap->flags & AHCI_FLAG_IGN_SERR_INTERNAL)
1087 serror &= ~SERR_INTERNAL;
1088 }
1072 1089
1073 if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) { 1090 if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) {
1074 err_mask |= AC_ERR_HOST_BUS; 1091 err_mask |= AC_ERR_HOST_BUS;
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index dc42ba1b46f7..b952c584338f 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -93,7 +93,7 @@
93#include <linux/libata.h> 93#include <linux/libata.h>
94 94
95#define DRV_NAME "ata_piix" 95#define DRV_NAME "ata_piix"
96#define DRV_VERSION "2.10" 96#define DRV_VERSION "2.10ac1"
97 97
98enum { 98enum {
99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
@@ -667,14 +667,9 @@ static int ich_pata_prereset(struct ata_port *ap)
667{ 667{
668 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 668 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
669 669
670 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) { 670 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
671 ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); 671 return -ENOENT;
672 ap->eh_context.i.action &= ~ATA_EH_RESET_MASK;
673 return 0;
674 }
675
676 ich_pata_cbl_detect(ap); 672 ich_pata_cbl_detect(ap);
677
678 return ata_std_prereset(ap); 673 return ata_std_prereset(ap);
679} 674}
680 675
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index d14a48e75f1b..03a0acff6cfa 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -34,6 +34,13 @@ struct taskfile_array {
34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ 34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */
35}; 35};
36 36
37/*
38 * Helper - belongs in the PCI layer somewhere eventually
39 */
40static int is_pci_dev(struct device *dev)
41{
42 return (dev->bus == &pci_bus_type);
43}
37 44
38/** 45/**
39 * sata_get_dev_handle - finds acpi_handle and PCI device.function 46 * sata_get_dev_handle - finds acpi_handle and PCI device.function
@@ -53,6 +60,9 @@ static int sata_get_dev_handle(struct device *dev, acpi_handle *handle,
53 struct pci_dev *pci_dev; 60 struct pci_dev *pci_dev;
54 acpi_integer addr; 61 acpi_integer addr;
55 62
63 if (!is_pci_dev(dev))
64 return -ENODEV;
65
56 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ 66 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */
57 /* Please refer to the ACPI spec for the syntax of _ADR. */ 67 /* Please refer to the ACPI spec for the syntax of _ADR. */
58 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 68 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
@@ -84,7 +94,12 @@ static int pata_get_dev_handle(struct device *dev, acpi_handle *handle,
84 acpi_status status; 94 acpi_status status;
85 struct acpi_device_info *dinfo = NULL; 95 struct acpi_device_info *dinfo = NULL;
86 int ret = -ENODEV; 96 int ret = -ENODEV;
87 struct pci_dev *pdev = to_pci_dev(dev); 97 struct pci_dev *pdev;
98
99 if (!is_pci_dev(dev))
100 return -ENODEV;
101
102 pdev = to_pci_dev(dev);
88 103
89 bus = pdev->bus->number; 104 bus = pdev->bus->number;
90 devnum = PCI_SLOT(pdev->devfn); 105 devnum = PCI_SLOT(pdev->devfn);
@@ -290,7 +305,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
290 *gtf_address = 0UL; 305 *gtf_address = 0UL;
291 *obj_loc = 0UL; 306 *obj_loc = 0UL;
292 307
293 if (noacpi) 308 if (libata_noacpi)
294 return 0; 309 return 0;
295 310
296 if (ata_msg_probe(ap)) 311 if (ata_msg_probe(ap))
@@ -516,7 +531,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap,
516 ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", 531 ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
517 __FUNCTION__, ap->port_no); 532 __FUNCTION__, ap->port_no);
518 533
519 if (noacpi || !(ap->cbl == ATA_CBL_SATA)) 534 if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA))
520 return 0; 535 return 0;
521 536
522 if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) 537 if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED))
@@ -559,7 +574,14 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
559 unsigned long gtf_address; 574 unsigned long gtf_address;
560 unsigned long obj_loc; 575 unsigned long obj_loc;
561 576
562 if (noacpi) 577 if (libata_noacpi)
578 return 0;
579 /*
580 * TBD - implement PATA support. For now,
581 * we should not run GTF on PATA devices since some
582 * PATA require execution of GTM/STM before GTF.
583 */
584 if (!(ap->cbl == ATA_CBL_SATA))
563 return 0; 585 return 0;
564 586
565 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { 587 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) {
@@ -614,7 +636,7 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix)
614 struct acpi_object_list input; 636 struct acpi_object_list input;
615 union acpi_object in_params[1]; 637 union acpi_object in_params[1];
616 638
617 if (noacpi) 639 if (libata_noacpi)
618 return 0; 640 return 0;
619 641
620 if (ata_msg_probe(ap)) 642 if (ata_msg_probe(ap))
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index dc362fa01ca4..0abd72d0dec2 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -93,8 +93,8 @@ static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ;
93module_param(ata_probe_timeout, int, 0444); 93module_param(ata_probe_timeout, int, 0444);
94MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)"); 94MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)");
95 95
96int noacpi; 96int libata_noacpi = 1;
97module_param(noacpi, int, 0444); 97module_param_named(noacpi, libata_noacpi, int, 0444);
98MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set"); 98MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set");
99 99
100MODULE_AUTHOR("Jeff Garzik"); 100MODULE_AUTHOR("Jeff Garzik");
@@ -826,7 +826,7 @@ static u64 ata_id_n_sectors(const u16 *id)
826/** 826/**
827 * ata_id_to_dma_mode - Identify DMA mode from id block 827 * ata_id_to_dma_mode - Identify DMA mode from id block
828 * @dev: device to identify 828 * @dev: device to identify
829 * @mode: mode to assume if we cannot tell 829 * @unknown: mode to assume if we cannot tell
830 * 830 *
831 * Set up the timing values for the device based upon the identify 831 * Set up the timing values for the device based upon the identify
832 * reported values for the DMA mode. This function is used by drivers 832 * reported values for the DMA mode. This function is used by drivers
@@ -1784,6 +1784,13 @@ int ata_dev_configure(struct ata_device *dev)
1784 dev->max_sectors = ATA_MAX_SECTORS; 1784 dev->max_sectors = ATA_MAX_SECTORS;
1785 } 1785 }
1786 1786
1787 if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128)
1788 dev->max_sectors = min(ATA_MAX_SECTORS_128, dev->max_sectors);
1789
1790 /* limit ATAPI DMA to R/W commands only */
1791 if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY)
1792 dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY;
1793
1787 if (ap->ops->dev_config) 1794 if (ap->ops->dev_config)
1788 ap->ops->dev_config(ap, dev); 1795 ap->ops->dev_config(ap, dev);
1789 1796
@@ -3352,6 +3359,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3352 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 3359 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA },
3353 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, 3360 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA },
3354 3361
3362 /* Weird ATAPI devices */
3363 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 |
3364 ATA_HORKAGE_DMA_RW_ONLY },
3365
3355 /* Devices we expect to fail diagnostics */ 3366 /* Devices we expect to fail diagnostics */
3356 3367
3357 /* Devices where NCQ should be avoided */ 3368 /* Devices where NCQ should be avoided */
@@ -3359,6 +3370,15 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3359 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, 3370 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ },
3360 /* http://thread.gmane.org/gmane.linux.ide/14907 */ 3371 /* http://thread.gmane.org/gmane.linux.ide/14907 */
3361 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, 3372 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ },
3373 /* NCQ is broken */
3374 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ },
3375 /* NCQ hard hangs device under heavier load, needs hard power cycle */
3376 { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ },
3377 /* Blacklist entries taken from Silicon Image 3124/3132
3378 Windows driver .inf file - also several Linux problem reports */
3379 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, },
3380 { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, },
3381 { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, },
3362 3382
3363 /* Devices with NCQ limits */ 3383 /* Devices with NCQ limits */
3364 3384
@@ -3455,7 +3475,8 @@ static void ata_dev_xfermask(struct ata_device *dev)
3455 "device is on DMA blacklist, disabling DMA\n"); 3475 "device is on DMA blacklist, disabling DMA\n");
3456 } 3476 }
3457 3477
3458 if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed != ap) { 3478 if ((host->flags & ATA_HOST_SIMPLEX) &&
3479 host->simplex_claimed && host->simplex_claimed != ap) {
3459 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 3480 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
3460 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " 3481 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by "
3461 "other device, disabling DMA\n"); 3482 "other device, disabling DMA\n");
@@ -3669,6 +3690,26 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
3669 struct ata_port *ap = qc->ap; 3690 struct ata_port *ap = qc->ap;
3670 int rc = 0; /* Assume ATAPI DMA is OK by default */ 3691 int rc = 0; /* Assume ATAPI DMA is OK by default */
3671 3692
3693 /* some drives can only do ATAPI DMA on read/write */
3694 if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) {
3695 struct scsi_cmnd *cmd = qc->scsicmd;
3696 u8 *scsicmd = cmd->cmnd;
3697
3698 switch (scsicmd[0]) {
3699 case READ_10:
3700 case WRITE_10:
3701 case READ_12:
3702 case WRITE_12:
3703 case READ_6:
3704 case WRITE_6:
3705 /* atapi dma maybe ok */
3706 break;
3707 default:
3708 /* turn off atapi dma */
3709 return 1;
3710 }
3711 }
3712
3672 if (ap->ops->check_atapi_dma) 3713 if (ap->ops->check_atapi_dma)
3673 rc = ap->ops->check_atapi_dma(qc); 3714 rc = ap->ops->check_atapi_dma(qc);
3674 3715
@@ -4712,8 +4753,8 @@ static void fill_result_tf(struct ata_queued_cmd *qc)
4712{ 4753{
4713 struct ata_port *ap = qc->ap; 4754 struct ata_port *ap = qc->ap;
4714 4755
4715 ap->ops->tf_read(ap, &qc->result_tf);
4716 qc->result_tf.flags = qc->tf.flags; 4756 qc->result_tf.flags = qc->tf.flags;
4757 ap->ops->tf_read(ap, &qc->result_tf);
4717} 4758}
4718 4759
4719/** 4760/**
@@ -5684,18 +5725,22 @@ static void ata_host_release(struct device *gendev, void *res)
5684 for (i = 0; i < host->n_ports; i++) { 5725 for (i = 0; i < host->n_ports; i++) {
5685 struct ata_port *ap = host->ports[i]; 5726 struct ata_port *ap = host->ports[i];
5686 5727
5687 if (!ap) 5728 if (ap && ap->ops->port_stop)
5688 continue;
5689
5690 if (ap->ops->port_stop)
5691 ap->ops->port_stop(ap); 5729 ap->ops->port_stop(ap);
5692
5693 scsi_host_put(ap->scsi_host);
5694 } 5730 }
5695 5731
5696 if (host->ops->host_stop) 5732 if (host->ops->host_stop)
5697 host->ops->host_stop(host); 5733 host->ops->host_stop(host);
5698 5734
5735 for (i = 0; i < host->n_ports; i++) {
5736 struct ata_port *ap = host->ports[i];
5737
5738 if (ap)
5739 scsi_host_put(ap->scsi_host);
5740
5741 host->ports[i] = NULL;
5742 }
5743
5699 dev_set_drvdata(gendev, NULL); 5744 dev_set_drvdata(gendev, NULL);
5700} 5745}
5701 5746
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 7349c3dbf774..39f556c02992 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -982,26 +982,27 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
982 * RETURNS: 982 * RETURNS:
983 * 0 on success, AC_ERR_* mask on failure 983 * 0 on success, AC_ERR_* mask on failure
984 */ 984 */
985static unsigned int atapi_eh_request_sense(struct ata_device *dev, 985static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
986 unsigned char *sense_buf)
987{ 986{
987 struct ata_device *dev = qc->dev;
988 unsigned char *sense_buf = qc->scsicmd->sense_buffer;
988 struct ata_port *ap = dev->ap; 989 struct ata_port *ap = dev->ap;
989 struct ata_taskfile tf; 990 struct ata_taskfile tf;
990 u8 cdb[ATAPI_CDB_LEN]; 991 u8 cdb[ATAPI_CDB_LEN];
991 992
992 DPRINTK("ATAPI request sense\n"); 993 DPRINTK("ATAPI request sense\n");
993 994
994 ata_tf_init(dev, &tf);
995
996 /* FIXME: is this needed? */ 995 /* FIXME: is this needed? */
997 memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); 996 memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
998 997
999 /* XXX: why tf_read here? */ 998 /* initialize sense_buf with the error register,
1000 ap->ops->tf_read(ap, &tf); 999 * for the case where they are -not- overwritten
1001 1000 */
1002 /* fill these in, for the case where they are -not- overwritten */
1003 sense_buf[0] = 0x70; 1001 sense_buf[0] = 0x70;
1004 sense_buf[2] = tf.feature >> 4; 1002 sense_buf[2] = qc->result_tf.feature >> 4;
1003
1004 /* some devices time out if garbage left in tf */
1005 ata_tf_init(dev, &tf);
1005 1006
1006 memset(cdb, 0, ATAPI_CDB_LEN); 1007 memset(cdb, 0, ATAPI_CDB_LEN);
1007 cdb[0] = REQUEST_SENSE; 1008 cdb[0] = REQUEST_SENSE;
@@ -1165,8 +1166,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
1165 1166
1166 case ATA_DEV_ATAPI: 1167 case ATA_DEV_ATAPI:
1167 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { 1168 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
1168 tmp = atapi_eh_request_sense(qc->dev, 1169 tmp = atapi_eh_request_sense(qc);
1169 qc->scsicmd->sense_buffer);
1170 if (!tmp) { 1170 if (!tmp) {
1171 /* ATA_QCFLAG_SENSE_VALID is used to 1171 /* ATA_QCFLAG_SENSE_VALID is used to
1172 * tell atapi_qc_complete() that sense 1172 * tell atapi_qc_complete() that sense
@@ -1625,8 +1625,14 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1625 rc = prereset(ap); 1625 rc = prereset(ap);
1626 if (rc) { 1626 if (rc) {
1627 if (rc == -ENOENT) { 1627 if (rc == -ENOENT) {
1628 ata_port_printk(ap, KERN_DEBUG, "port disabled. ignoring.\n"); 1628 ata_port_printk(ap, KERN_DEBUG,
1629 "port disabled. ignoring.\n");
1629 ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; 1630 ap->eh_context.i.action &= ~ATA_EH_RESET_MASK;
1631
1632 for (i = 0; i < ATA_MAX_DEVICES; i++)
1633 classes[i] = ATA_DEV_NONE;
1634
1635 rc = 0;
1630 } else 1636 } else
1631 ata_port_printk(ap, KERN_ERR, 1637 ata_port_printk(ap, KERN_ERR,
1632 "prereset failed (errno=%d)\n", rc); 1638 "prereset failed (errno=%d)\n", rc);
@@ -1737,12 +1743,17 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1737{ 1743{
1738 struct ata_eh_context *ehc = &ap->eh_context; 1744 struct ata_eh_context *ehc = &ap->eh_context;
1739 struct ata_device *dev; 1745 struct ata_device *dev;
1746 unsigned int new_mask = 0;
1740 unsigned long flags; 1747 unsigned long flags;
1741 int i, rc = 0; 1748 int i, rc = 0;
1742 1749
1743 DPRINTK("ENTER\n"); 1750 DPRINTK("ENTER\n");
1744 1751
1745 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1752 /* For PATA drive side cable detection to work, IDENTIFY must
1753 * be done backwards such that PDIAG- is released by the slave
1754 * device before the master device is identified.
1755 */
1756 for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) {
1746 unsigned int action, readid_flags = 0; 1757 unsigned int action, readid_flags = 0;
1747 1758
1748 dev = &ap->device[i]; 1759 dev = &ap->device[i];
@@ -1754,13 +1765,13 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1754 if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { 1765 if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) {
1755 if (ata_port_offline(ap)) { 1766 if (ata_port_offline(ap)) {
1756 rc = -EIO; 1767 rc = -EIO;
1757 break; 1768 goto err;
1758 } 1769 }
1759 1770
1760 ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE); 1771 ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE);
1761 rc = ata_dev_revalidate(dev, readid_flags); 1772 rc = ata_dev_revalidate(dev, readid_flags);
1762 if (rc) 1773 if (rc)
1763 break; 1774 goto err;
1764 1775
1765 ata_eh_done(ap, dev, ATA_EH_REVALIDATE); 1776 ata_eh_done(ap, dev, ATA_EH_REVALIDATE);
1766 1777
@@ -1778,40 +1789,53 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1778 1789
1779 rc = ata_dev_read_id(dev, &dev->class, readid_flags, 1790 rc = ata_dev_read_id(dev, &dev->class, readid_flags,
1780 dev->id); 1791 dev->id);
1781 if (rc == 0) { 1792 switch (rc) {
1782 ehc->i.flags |= ATA_EHI_PRINTINFO; 1793 case 0:
1783 rc = ata_dev_configure(dev); 1794 new_mask |= 1 << i;
1784 ehc->i.flags &= ~ATA_EHI_PRINTINFO; 1795 break;
1785 } else if (rc == -ENOENT) { 1796 case -ENOENT:
1786 /* IDENTIFY was issued to non-existent 1797 /* IDENTIFY was issued to non-existent
1787 * device. No need to reset. Just 1798 * device. No need to reset. Just
1788 * thaw and kill the device. 1799 * thaw and kill the device.
1789 */ 1800 */
1790 ata_eh_thaw_port(ap); 1801 ata_eh_thaw_port(ap);
1791 dev->class = ATA_DEV_UNKNOWN; 1802 dev->class = ATA_DEV_UNKNOWN;
1792 rc = 0;
1793 }
1794
1795 if (rc) {
1796 dev->class = ATA_DEV_UNKNOWN;
1797 break; 1803 break;
1804 default:
1805 dev->class = ATA_DEV_UNKNOWN;
1806 goto err;
1798 } 1807 }
1808 }
1809 }
1799 1810
1800 if (ata_dev_enabled(dev)) { 1811 /* Configure new devices forward such that user doesn't see
1801 spin_lock_irqsave(ap->lock, flags); 1812 * device detection messages backwards.
1802 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; 1813 */
1803 spin_unlock_irqrestore(ap->lock, flags); 1814 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1815 dev = &ap->device[i];
1804 1816
1805 /* new device discovered, configure xfermode */ 1817 if (!(new_mask & (1 << i)))
1806 ehc->i.flags |= ATA_EHI_SETMODE; 1818 continue;
1807 } 1819
1808 } 1820 ehc->i.flags |= ATA_EHI_PRINTINFO;
1821 rc = ata_dev_configure(dev);
1822 ehc->i.flags &= ~ATA_EHI_PRINTINFO;
1823 if (rc)
1824 goto err;
1825
1826 spin_lock_irqsave(ap->lock, flags);
1827 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
1828 spin_unlock_irqrestore(ap->lock, flags);
1829
1830 /* new device discovered, configure xfermode */
1831 ehc->i.flags |= ATA_EHI_SETMODE;
1809 } 1832 }
1810 1833
1811 if (rc) 1834 return 0;
1812 *r_failed_dev = dev;
1813 1835
1814 DPRINTK("EXIT\n"); 1836 err:
1837 *r_failed_dev = dev;
1838 DPRINTK("EXIT rc=%d\n", rc);
1815 return rc; 1839 return rc;
1816} 1840}
1817 1841
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 6cc817a10204..e9364434182c 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -333,7 +333,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
333 scsi_cmd[8] = args[3]; 333 scsi_cmd[8] = args[3];
334 scsi_cmd[10] = args[4]; 334 scsi_cmd[10] = args[4];
335 scsi_cmd[12] = args[5]; 335 scsi_cmd[12] = args[5];
336 scsi_cmd[13] = args[6] & 0x0f; 336 scsi_cmd[13] = args[6] & 0x4f;
337 scsi_cmd[14] = args[0]; 337 scsi_cmd[14] = args[0];
338 338
339 /* Good values for timeout and retries? Values below 339 /* Good values for timeout and retries? Values below
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index c42671493e8c..1f1e3a51f859 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -56,7 +56,7 @@ extern struct workqueue_struct *ata_aux_wq;
56extern int atapi_enabled; 56extern int atapi_enabled;
57extern int atapi_dmadir; 57extern int atapi_dmadir;
58extern int libata_fua; 58extern int libata_fua;
59extern int noacpi; 59extern int libata_noacpi;
60extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); 60extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
61extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, 61extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
62 u64 block, u32 n_block, unsigned int tf_flags, 62 u64 block, u32 n_block, unsigned int tf_flags,
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 7ef834250a43..55cc293e7487 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -208,7 +208,7 @@ static struct ata_port_operations cs5520_port_ops = {
208static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 208static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
209{ 209{
210 u8 pcicfg; 210 u8 pcicfg;
211 void *iomap[5]; 211 void __iomem *iomap[5];
212 static struct ata_probe_ent probe[2]; 212 static struct ata_probe_ent probe[2];
213 int ports = 0; 213 int ports = 0;
214 214
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 9a0523b5c947..c6f0e1927551 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -193,7 +193,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
193 193
194 irq = platform_get_irq(pdev, 0); 194 irq = platform_get_irq(pdev, 0);
195 if (irq) 195 if (irq)
196 set_irq_type(irq, IRQT_HIGH); 196 set_irq_type(irq, IRQT_RISING);
197 197
198 /* Setup expansion bus chip selects */ 198 /* Setup expansion bus chip selects */
199 *data->cs0_cfg = data->cs0_bits; 199 *data->cs0_cfg = data->cs0_bits;
@@ -232,7 +232,6 @@ static __devexit int ixp4xx_pata_remove(struct platform_device *dev)
232 struct ata_host *host = platform_get_drvdata(dev); 232 struct ata_host *host = platform_get_drvdata(dev);
233 233
234 ata_host_detach(host); 234 ata_host_detach(host);
235 platform_set_drvdata(dev, NULL);
236 235
237 return 0; 236 return 0;
238} 237}
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index f5d88729ca79..882c36eaf293 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -329,7 +329,7 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv)
329 ae->dev = dev; 329 ae->dev = dev;
330 ae->irq = priv->ata_irq; 330 ae->irq = priv->ata_irq;
331 331
332 aio->cmd_addr = 0; /* Don't have a classic reg block */ 332 aio->cmd_addr = NULL; /* Don't have a classic reg block */
333 aio->altstatus_addr = &priv->ata_regs->tf_control; 333 aio->altstatus_addr = &priv->ata_regs->tf_control;
334 aio->ctl_addr = &priv->ata_regs->tf_control; 334 aio->ctl_addr = &priv->ata_regs->tf_control;
335 aio->data_addr = &priv->ata_regs->tf_data; 335 aio->data_addr = &priv->ata_regs->tf_data;
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index acdc52cbe38a..0a1493398913 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -195,7 +195,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
195 /* Cases the state machine will not complete correctly without help */ 195 /* Cases the state machine will not complete correctly without help */
196 if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA) 196 if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA)
197 { 197 {
198 len = qc->nbytes; 198 len = qc->nbytes / 2;
199 199
200 if (tf->flags & ATA_TFLAG_WRITE) 200 if (tf->flags & ATA_TFLAG_WRITE)
201 len |= 0x06000000; 201 len |= 0x06000000;
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 3193a603d1a1..1e21688bfcf2 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -672,10 +672,6 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
672 if (rc) 672 if (rc)
673 return rc; 673 return rc;
674 674
675 rc = pci_request_regions(pdev, DRV_NAME);
676 if (rc)
677 return rc;
678
679 rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME); 675 rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME);
680 if (rc) 676 if (rc)
681 return rc; 677 return rc;
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 388d07fab5f7..9d9670a9b117 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -874,8 +874,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
874 874
875 if (status & (NV_ADMA_STAT_DONE | 875 if (status & (NV_ADMA_STAT_DONE |
876 NV_ADMA_STAT_CPBERR)) { 876 NV_ADMA_STAT_CPBERR)) {
877 u32 check_commands = notifier | notifier_error; 877 u32 check_commands;
878 int pos, error = 0; 878 int pos, error = 0;
879
880 if(ata_tag_valid(ap->active_tag))
881 check_commands = 1 << ap->active_tag;
882 else
883 check_commands = ap->sactive;
884
879 /** Check CPBs for completed commands */ 885 /** Check CPBs for completed commands */
880 while ((pos = ffs(check_commands)) && !error) { 886 while ((pos = ffs(check_commands)) && !error) {
881 pos--; 887 pos--;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 75d961599651..5614df8c1ce2 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -346,6 +346,7 @@ static const struct pci_device_id sil24_pci_tbl[] = {
346 { PCI_VDEVICE(CMD, 0x3124), BID_SIL3124 }, 346 { PCI_VDEVICE(CMD, 0x3124), BID_SIL3124 },
347 { PCI_VDEVICE(INTEL, 0x3124), BID_SIL3124 }, 347 { PCI_VDEVICE(INTEL, 0x3124), BID_SIL3124 },
348 { PCI_VDEVICE(CMD, 0x3132), BID_SIL3132 }, 348 { PCI_VDEVICE(CMD, 0x3132), BID_SIL3132 },
349 { PCI_VDEVICE(CMD, 0x0242), BID_SIL3132 },
349 { PCI_VDEVICE(CMD, 0x3131), BID_SIL3131 }, 350 { PCI_VDEVICE(CMD, 0x3131), BID_SIL3131 },
350 { PCI_VDEVICE(CMD, 0x3531), BID_SIL3131 }, 351 { PCI_VDEVICE(CMD, 0x3531), BID_SIL3131 },
351 352
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 1879e0cd56aa..a787f0d4a5ba 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -354,7 +354,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
354 return -ENOMEM; 354 return -ENOMEM;
355 355
356 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) { 356 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) {
357 void *mmio; 357 void __iomem *mmio;
358 358
359 mmio = pcim_iomap(pdev, SIS_SCR_PCI_BAR, 0); 359 mmio = pcim_iomap(pdev, SIS_SCR_PCI_BAR, 0);
360 if (!mmio) 360 if (!mmio)
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 0d7091e2077f..2ad2527cf5b3 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1177,7 +1177,7 @@ static void __devinit eprom_get_esi(struct atm_dev *dev)
1177/*--------------------------------- entries ---------------------------------*/ 1177/*--------------------------------- entries ---------------------------------*/
1178 1178
1179 1179
1180static int __init zatm_init(struct atm_dev *dev) 1180static int __devinit zatm_init(struct atm_dev *dev)
1181{ 1181{
1182 struct zatm_dev *zatm_dev; 1182 struct zatm_dev *zatm_dev;
1183 struct pci_dev *pci_dev; 1183 struct pci_dev *pci_dev;
@@ -1256,7 +1256,7 @@ static int __init zatm_init(struct atm_dev *dev)
1256} 1256}
1257 1257
1258 1258
1259static int __init zatm_start(struct atm_dev *dev) 1259static int __devinit zatm_start(struct atm_dev *dev)
1260{ 1260{
1261 struct zatm_dev *zatm_dev = ZATM_DEV(dev); 1261 struct zatm_dev *zatm_dev = ZATM_DEV(dev);
1262 struct pci_dev *pdev = zatm_dev->pci_dev; 1262 struct pci_dev *pdev = zatm_dev->pci_dev;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index cf2a398aaaa1..d7fcf823a42a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -28,20 +28,6 @@ int (*platform_notify)(struct device * dev) = NULL;
28int (*platform_notify_remove)(struct device * dev) = NULL; 28int (*platform_notify_remove)(struct device * dev) = NULL;
29 29
30/* 30/*
31 * Detect the LANANA-assigned LOCAL/EXPERIMENTAL majors
32 */
33bool is_lanana_major(unsigned int major)
34{
35 if (major >= 60 && major <= 63)
36 return 1;
37 if (major >= 120 && major <= 127)
38 return 1;
39 if (major >= 240 && major <= 254)
40 return 1;
41 return 0;
42}
43
44/*
45 * sysfs bindings for devices. 31 * sysfs bindings for devices.
46 */ 32 */
47 33
@@ -407,6 +393,35 @@ void device_remove_bin_file(struct device *dev, struct bin_attribute *attr)
407} 393}
408EXPORT_SYMBOL_GPL(device_remove_bin_file); 394EXPORT_SYMBOL_GPL(device_remove_bin_file);
409 395
396/**
397 * device_schedule_callback - helper to schedule a callback for a device
398 * @dev: device.
399 * @func: callback function to invoke later.
400 *
401 * Attribute methods must not unregister themselves or their parent device
402 * (which would amount to the same thing). Attempts to do so will deadlock,
403 * since unregistration is mutually exclusive with driver callbacks.
404 *
405 * Instead methods can call this routine, which will attempt to allocate
406 * and schedule a workqueue request to call back @func with @dev as its
407 * argument in the workqueue's process context. @dev will be pinned until
408 * @func returns.
409 *
410 * Returns 0 if the request was submitted, -ENOMEM if storage could not
411 * be allocated.
412 *
413 * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an
414 * underlying sysfs routine (since it is intended for use by attribute
415 * methods), and if sysfs isn't available you'll get nothing but -ENOSYS.
416 */
417int device_schedule_callback(struct device *dev,
418 void (*func)(struct device *))
419{
420 return sysfs_schedule_callback(&dev->kobj,
421 (void (*)(void *)) func, dev);
422}
423EXPORT_SYMBOL_GPL(device_schedule_callback);
424
410static void klist_children_get(struct klist_node *n) 425static void klist_children_get(struct klist_node *n)
411{ 426{
412 struct device *dev = container_of(n, struct device, knode_parent); 427 struct device *dev = container_of(n, struct device, knode_parent);
@@ -584,17 +599,17 @@ int device_add(struct device *dev)
584 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 599 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
585 sysfs_create_link(&dev->class->subsys.kset.kobj, 600 sysfs_create_link(&dev->class->subsys.kset.kobj,
586 &dev->kobj, dev->bus_id); 601 &dev->kobj, dev->bus_id);
587#ifdef CONFIG_SYSFS_DEPRECATED
588 if (parent) { 602 if (parent) {
589 sysfs_create_link(&dev->kobj, &dev->parent->kobj, 603 sysfs_create_link(&dev->kobj, &dev->parent->kobj,
590 "device"); 604 "device");
605#ifdef CONFIG_SYSFS_DEPRECATED
591 class_name = make_class_name(dev->class->name, 606 class_name = make_class_name(dev->class->name,
592 &dev->kobj); 607 &dev->kobj);
593 if (class_name) 608 if (class_name)
594 sysfs_create_link(&dev->parent->kobj, 609 sysfs_create_link(&dev->parent->kobj,
595 &dev->kobj, class_name); 610 &dev->kobj, class_name);
596 }
597#endif 611#endif
612 }
598 } 613 }
599 614
600 if ((error = device_add_attrs(dev))) 615 if ((error = device_add_attrs(dev)))
@@ -651,17 +666,17 @@ int device_add(struct device *dev)
651 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 666 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
652 sysfs_remove_link(&dev->class->subsys.kset.kobj, 667 sysfs_remove_link(&dev->class->subsys.kset.kobj,
653 dev->bus_id); 668 dev->bus_id);
654#ifdef CONFIG_SYSFS_DEPRECATED
655 if (parent) { 669 if (parent) {
670#ifdef CONFIG_SYSFS_DEPRECATED
656 char *class_name = make_class_name(dev->class->name, 671 char *class_name = make_class_name(dev->class->name,
657 &dev->kobj); 672 &dev->kobj);
658 if (class_name) 673 if (class_name)
659 sysfs_remove_link(&dev->parent->kobj, 674 sysfs_remove_link(&dev->parent->kobj,
660 class_name); 675 class_name);
661 kfree(class_name); 676 kfree(class_name);
677#endif
662 sysfs_remove_link(&dev->kobj, "device"); 678 sysfs_remove_link(&dev->kobj, "device");
663 } 679 }
664#endif
665 680
666 down(&dev->class->sem); 681 down(&dev->class->sem);
667 /* notify any interfaces that the device is now gone */ 682 /* notify any interfaces that the device is now gone */
@@ -761,17 +776,17 @@ void device_del(struct device * dev)
761 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 776 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
762 sysfs_remove_link(&dev->class->subsys.kset.kobj, 777 sysfs_remove_link(&dev->class->subsys.kset.kobj,
763 dev->bus_id); 778 dev->bus_id);
764#ifdef CONFIG_SYSFS_DEPRECATED
765 if (parent) { 779 if (parent) {
780#ifdef CONFIG_SYSFS_DEPRECATED
766 char *class_name = make_class_name(dev->class->name, 781 char *class_name = make_class_name(dev->class->name,
767 &dev->kobj); 782 &dev->kobj);
768 if (class_name) 783 if (class_name)
769 sysfs_remove_link(&dev->parent->kobj, 784 sysfs_remove_link(&dev->parent->kobj,
770 class_name); 785 class_name);
771 kfree(class_name); 786 kfree(class_name);
787#endif
772 sysfs_remove_link(&dev->kobj, "device"); 788 sysfs_remove_link(&dev->kobj, "device");
773 } 789 }
774#endif
775 790
776 down(&dev->class->sem); 791 down(&dev->class->sem);
777 /* notify any interfaces that the device is now gone */ 792 /* notify any interfaces that the device is now gone */
@@ -787,6 +802,13 @@ void device_del(struct device * dev)
787 device_remove_attrs(dev); 802 device_remove_attrs(dev);
788 bus_remove_device(dev); 803 bus_remove_device(dev);
789 804
805 /*
806 * Some platform devices are driven without driver attached
807 * and managed resources may have been acquired. Make sure
808 * all resources are released.
809 */
810 devres_release_all(dev);
811
790 /* Notify the platform of the removal, in case they 812 /* Notify the platform of the removal, in case they
791 * need to do anything... 813 * need to do anything...
792 */ 814 */
@@ -1058,14 +1080,14 @@ int device_rename(struct device *dev, char *new_name)
1058 1080
1059 return error; 1081 return error;
1060} 1082}
1061 1083EXPORT_SYMBOL_GPL(device_rename);
1062 1084
1063static int device_move_class_links(struct device *dev, 1085static int device_move_class_links(struct device *dev,
1064 struct device *old_parent, 1086 struct device *old_parent,
1065 struct device *new_parent) 1087 struct device *new_parent)
1066{ 1088{
1089 int error = 0;
1067#ifdef CONFIG_SYSFS_DEPRECATED 1090#ifdef CONFIG_SYSFS_DEPRECATED
1068 int error;
1069 char *class_name; 1091 char *class_name;
1070 1092
1071 class_name = make_class_name(dev->class->name, &dev->kobj); 1093 class_name = make_class_name(dev->class->name, &dev->kobj);
@@ -1093,7 +1115,12 @@ out:
1093 kfree(class_name); 1115 kfree(class_name);
1094 return error; 1116 return error;
1095#else 1117#else
1096 return 0; 1118 if (old_parent)
1119 sysfs_remove_link(&dev->kobj, "device");
1120 if (new_parent)
1121 error = sysfs_create_link(&dev->kobj, &new_parent->kobj,
1122 "device");
1123 return error;
1097#endif 1124#endif
1098} 1125}
1099 1126
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 1214cbd17d86..082bfded3854 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -183,7 +183,14 @@ int driver_register(struct device_driver * drv)
183void driver_unregister(struct device_driver * drv) 183void driver_unregister(struct device_driver * drv)
184{ 184{
185 bus_remove_driver(drv); 185 bus_remove_driver(drv);
186 wait_for_completion(&drv->unloaded); 186 /*
187 * If the driver is a module, we are probably in
188 * the module unload path, and we want to wait
189 * for everything to unload before we can actually
190 * finish the unload.
191 */
192 if (drv->owner)
193 wait_for_completion(&drv->unloaded);
187} 194}
188 195
189/** 196/**
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index fdfa3d0cf6af..bbbb973a9d3c 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -54,7 +54,8 @@ int device_pm_add(struct device * dev)
54 int error; 54 int error;
55 55
56 pr_debug("PM: Adding info for %s:%s\n", 56 pr_debug("PM: Adding info for %s:%s\n",
57 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); 57 dev->bus ? dev->bus->name : "No Bus",
58 kobject_name(&dev->kobj));
58 down(&dpm_list_sem); 59 down(&dpm_list_sem);
59 list_add_tail(&dev->power.entry, &dpm_active); 60 list_add_tail(&dev->power.entry, &dpm_active);
60 device_pm_set_parent(dev, dev->parent); 61 device_pm_set_parent(dev, dev->parent);
@@ -67,7 +68,8 @@ int device_pm_add(struct device * dev)
67void device_pm_remove(struct device * dev) 68void device_pm_remove(struct device * dev)
68{ 69{
69 pr_debug("PM: Removing info for %s:%s\n", 70 pr_debug("PM: Removing info for %s:%s\n",
70 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); 71 dev->bus ? dev->bus->name : "No Bus",
72 kobject_name(&dev->kobj));
71 down(&dpm_list_sem); 73 down(&dpm_list_sem);
72 dpm_sysfs_remove(dev); 74 dpm_sysfs_remove(dev);
73 put_device(dev->power.pm_parent); 75 put_device(dev->power.pm_parent);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 0c716ee905d7..14d780666c0a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1439,7 +1439,7 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
1439 1439
1440 if (return_code == IO_OK) { 1440 if (return_code == IO_OK) {
1441 listlength = 1441 listlength =
1442 be32_to_cpu(*(__u32 *) ld_buff->LUNListLength); 1442 be32_to_cpu(*(__be32 *) ld_buff->LUNListLength);
1443 } else { /* reading number of logical volumes failed */ 1443 } else { /* reading number of logical volumes failed */
1444 printk(KERN_WARNING "cciss: report logical volume" 1444 printk(KERN_WARNING "cciss: report logical volume"
1445 " command failed\n"); 1445 " command failed\n");
@@ -1915,6 +1915,7 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
1915 "does not support reading geometry\n"); 1915 "does not support reading geometry\n");
1916 drv->heads = 255; 1916 drv->heads = 255;
1917 drv->sectors = 32; // Sectors per track 1917 drv->sectors = 32; // Sectors per track
1918 drv->cylinders = total_size + 1;
1918 drv->raid_level = RAID_UNKNOWN; 1919 drv->raid_level = RAID_UNKNOWN;
1919 } else { 1920 } else {
1920 drv->heads = inq_buff->data_byte[6]; 1921 drv->heads = inq_buff->data_byte[6];
@@ -1961,8 +1962,8 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
1961 ctlr, buf, sizeof(ReadCapdata_struct), 1962 ctlr, buf, sizeof(ReadCapdata_struct),
1962 1, logvol, 0, NULL, TYPE_CMD); 1963 1, logvol, 0, NULL, TYPE_CMD);
1963 if (return_code == IO_OK) { 1964 if (return_code == IO_OK) {
1964 *total_size = be32_to_cpu(*(__u32 *) buf->total_size); 1965 *total_size = be32_to_cpu(*(__be32 *) buf->total_size);
1965 *block_size = be32_to_cpu(*(__u32 *) buf->block_size); 1966 *block_size = be32_to_cpu(*(__be32 *) buf->block_size);
1966 } else { /* read capacity command failed */ 1967 } else { /* read capacity command failed */
1967 printk(KERN_WARNING "cciss: read capacity failed\n"); 1968 printk(KERN_WARNING "cciss: read capacity failed\n");
1968 *total_size = 0; 1969 *total_size = 0;
@@ -1997,8 +1998,8 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
1997 1, logvol, 0, NULL, TYPE_CMD); 1998 1, logvol, 0, NULL, TYPE_CMD);
1998 } 1999 }
1999 if (return_code == IO_OK) { 2000 if (return_code == IO_OK) {
2000 *total_size = be64_to_cpu(*(__u64 *) buf->total_size); 2001 *total_size = be64_to_cpu(*(__be64 *) buf->total_size);
2001 *block_size = be32_to_cpu(*(__u32 *) buf->block_size); 2002 *block_size = be32_to_cpu(*(__be32 *) buf->block_size);
2002 } else { /* read capacity command failed */ 2003 } else { /* read capacity command failed */
2003 printk(KERN_WARNING "cciss: read capacity failed\n"); 2004 printk(KERN_WARNING "cciss: read capacity failed\n");
2004 *total_size = 0; 2005 *total_size = 0;
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 99e2c8ce1cc4..31e01488eb51 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -663,11 +663,11 @@ static enum action pd_identify(struct pd_unit *disk)
663 return Fail; 663 return Fail;
664 pi_read_block(disk->pi, pd_scratch, 512); 664 pi_read_block(disk->pi, pd_scratch, 512);
665 disk->can_lba = pd_scratch[99] & 2; 665 disk->can_lba = pd_scratch[99] & 2;
666 disk->sectors = le16_to_cpu(*(u16 *) (pd_scratch + 12)); 666 disk->sectors = le16_to_cpu(*(__le16 *) (pd_scratch + 12));
667 disk->heads = le16_to_cpu(*(u16 *) (pd_scratch + 6)); 667 disk->heads = le16_to_cpu(*(__le16 *) (pd_scratch + 6));
668 disk->cylinders = le16_to_cpu(*(u16 *) (pd_scratch + 2)); 668 disk->cylinders = le16_to_cpu(*(__le16 *) (pd_scratch + 2));
669 if (disk->can_lba) 669 if (disk->can_lba)
670 disk->capacity = le32_to_cpu(*(u32 *) (pd_scratch + 120)); 670 disk->capacity = le32_to_cpu(*(__le32 *) (pd_scratch + 120));
671 else 671 else
672 disk->capacity = disk->sectors * disk->heads * disk->cylinders; 672 disk->capacity = disk->sectors * disk->heads * disk->cylinders;
673 673
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 3429ece4ef92..d0c978fbc204 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -386,6 +386,39 @@ config AU1000_SERIAL_CONSOLE
386 If you have an Alchemy AU1000 processor (MIPS based) and you want 386 If you have an Alchemy AU1000 processor (MIPS based) and you want
387 to use a console on a serial port, say Y. Otherwise, say N. 387 to use a console on a serial port, say Y. Otherwise, say N.
388 388
389config SERIAL_DEC
390 bool "DECstation serial support"
391 depends on MACH_DECSTATION
392 default y
393 help
394 This selects whether you want to be asked about drivers for
395 DECstation serial ports.
396
397 Note that the answer to this question won't directly affect the
398 kernel: saying N will just cause the configurator to skip all
399 the questions about DECstation serial ports.
400
401config SERIAL_DEC_CONSOLE
402 bool "Support for console on a DECstation serial port"
403 depends on SERIAL_DEC
404 default y
405 help
406 If you say Y here, it will be possible to use a serial port as the
407 system console (the system console is the device which receives all
408 kernel messages and warnings and which allows logins in single user
409 mode). Note that the firmware uses ttyS0 as the serial console on
410 the Maxine and ttyS2 on the others.
411
412 If unsure, say Y.
413
414config ZS
415 bool "Z85C30 Serial Support"
416 depends on SERIAL_DEC
417 default y
418 help
419 Documentation on the Zilog 85C350 serial communications controller
420 is downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf>
421
389config A2232 422config A2232
390 tristate "Commodore A2232 serial support (EXPERIMENTAL)" 423 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
391 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP 424 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index e542a628f1c7..55392a45a14b 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -18,11 +18,14 @@
18#define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992 18#define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992
19#define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0 19#define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0
20#define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 20#define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2
21#define PCI_DEVICE_ID_INTEL_82965GM_HB 0x2A00
22#define PCI_DEVICE_ID_INTEL_82965GM_IG 0x2A02
21 23
22#define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ 24#define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \
23 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ 25 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \
24 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 26 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
25 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB) 27 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
28 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB)
26 29
27 30
28extern int agp_memory_reserved; 31extern int agp_memory_reserved;
@@ -428,9 +431,8 @@ static void intel_i830_init_gtt_entries(void)
428 431
429 if (IS_I965) { 432 if (IS_I965) {
430 u32 pgetbl_ctl; 433 u32 pgetbl_ctl;
434 pgetbl_ctl = readl(intel_i830_private.registers+I810_PGETBL_CTL);
431 435
432 pci_read_config_dword(agp_bridge->dev, I810_PGETBL_CTL,
433 &pgetbl_ctl);
434 /* The 965 has a field telling us the size of the GTT, 436 /* The 965 has a field telling us the size of the GTT,
435 * which may be larger than what is necessary to map the 437 * which may be larger than what is necessary to map the
436 * aperture. 438 * aperture.
@@ -1921,7 +1923,13 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1921 bridge->driver = &intel_845_driver; 1923 bridge->driver = &intel_845_driver;
1922 name = "965G"; 1924 name = "965G";
1923 break; 1925 break;
1924 1926 case PCI_DEVICE_ID_INTEL_82965GM_HB:
1927 if (find_i830(PCI_DEVICE_ID_INTEL_82965GM_IG))
1928 bridge->driver = &intel_i965_driver;
1929 else
1930 bridge->driver = &intel_845_driver;
1931 name = "965GM";
1932 break;
1925 case PCI_DEVICE_ID_INTEL_7505_0: 1933 case PCI_DEVICE_ID_INTEL_7505_0:
1926 bridge->driver = &intel_7505_driver; 1934 bridge->driver = &intel_7505_driver;
1927 name = "E7505"; 1935 name = "E7505";
@@ -2080,6 +2088,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
2080 ID(PCI_DEVICE_ID_INTEL_82965G_1_HB), 2088 ID(PCI_DEVICE_ID_INTEL_82965G_1_HB),
2081 ID(PCI_DEVICE_ID_INTEL_82965Q_HB), 2089 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
2082 ID(PCI_DEVICE_ID_INTEL_82965G_HB), 2090 ID(PCI_DEVICE_ID_INTEL_82965G_HB),
2091 ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
2083 { } 2092 { }
2084}; 2093};
2085 2094
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 3ad0f648c6b2..6915a0599dfb 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -15,7 +15,6 @@ i810-objs := i810_drv.o i810_dma.o
15i830-objs := i830_drv.o i830_dma.o i830_irq.o 15i830-objs := i830_drv.o i830_dma.o i830_irq.o
16i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o 16i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
17radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o 17radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
18ffb-objs := ffb_drv.o ffb_context.o
19sis-objs := sis_drv.o sis_mm.o 18sis-objs := sis_drv.o sis_mm.o
20savage-objs := savage_drv.o savage_bci.o savage_state.o 19savage-objs := savage_drv.o savage_bci.o savage_state.o
21via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o 20via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
@@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o
36obj-$(CONFIG_DRM_I810) += i810.o 35obj-$(CONFIG_DRM_I810) += i810.o
37obj-$(CONFIG_DRM_I830) += i830.o 36obj-$(CONFIG_DRM_I830) += i830.o
38obj-$(CONFIG_DRM_I915) += i915.o 37obj-$(CONFIG_DRM_I915) += i915.o
39obj-$(CONFIG_DRM_FFB) += ffb.o
40obj-$(CONFIG_DRM_SIS) += sis.o 38obj-$(CONFIG_DRM_SIS) += sis.o
41obj-$(CONFIG_DRM_SAVAGE)+= savage.o 39obj-$(CONFIG_DRM_SAVAGE)+= savage.o
42obj-$(CONFIG_DRM_VIA) +=via.o 40obj-$(CONFIG_DRM_VIA) +=via.o
diff --git a/drivers/char/drm/ffb_context.c b/drivers/char/drm/ffb_context.c
deleted file mode 100644
index ac9ab40d57aa..000000000000
--- a/drivers/char/drm/ffb_context.c
+++ /dev/null
@@ -1,544 +0,0 @@
1/* $Id: ffb_context.c,v 1.5 2001/08/09 17:47:51 davem Exp $
2 * ffb_context.c: Creator/Creator3D DRI/DRM context switching.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 *
6 * Almost entirely stolen from tdfx_context.c, see there
7 * for authors.
8 */
9
10#include <asm/upa.h>
11
12#include "ffb.h"
13#include "drmP.h"
14
15#include "ffb_drv.h"
16
17static int DRM(alloc_queue) (drm_device_t * dev, int is_2d_only) {
18 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
19 int i;
20
21 for (i = 0; i < FFB_MAX_CTXS; i++) {
22 if (fpriv->hw_state[i] == NULL)
23 break;
24 }
25 if (i == FFB_MAX_CTXS)
26 return -1;
27
28 fpriv->hw_state[i] = kmalloc(sizeof(struct ffb_hw_context), GFP_KERNEL);
29 if (fpriv->hw_state[i] == NULL)
30 return -1;
31
32 fpriv->hw_state[i]->is_2d_only = is_2d_only;
33
34 /* Plus one because 0 is the special DRM_KERNEL_CONTEXT. */
35 return i + 1;
36}
37
38static void ffb_save_context(ffb_dev_priv_t * fpriv, int idx)
39{
40 ffb_fbcPtr ffb = fpriv->regs;
41 struct ffb_hw_context *ctx;
42 int i;
43
44 ctx = fpriv->hw_state[idx - 1];
45 if (idx == 0 || ctx == NULL)
46 return;
47
48 if (ctx->is_2d_only) {
49 /* 2D applications only care about certain pieces
50 * of state.
51 */
52 ctx->drawop = upa_readl(&ffb->drawop);
53 ctx->ppc = upa_readl(&ffb->ppc);
54 ctx->wid = upa_readl(&ffb->wid);
55 ctx->fg = upa_readl(&ffb->fg);
56 ctx->bg = upa_readl(&ffb->bg);
57 ctx->xclip = upa_readl(&ffb->xclip);
58 ctx->fbc = upa_readl(&ffb->fbc);
59 ctx->rop = upa_readl(&ffb->rop);
60 ctx->cmp = upa_readl(&ffb->cmp);
61 ctx->matchab = upa_readl(&ffb->matchab);
62 ctx->magnab = upa_readl(&ffb->magnab);
63 ctx->pmask = upa_readl(&ffb->pmask);
64 ctx->xpmask = upa_readl(&ffb->xpmask);
65 ctx->lpat = upa_readl(&ffb->lpat);
66 ctx->fontxy = upa_readl(&ffb->fontxy);
67 ctx->fontw = upa_readl(&ffb->fontw);
68 ctx->fontinc = upa_readl(&ffb->fontinc);
69
70 /* stencil/stencilctl only exists on FFB2+ and later
71 * due to the introduction of 3DRAM-III.
72 */
73 if (fpriv->ffb_type == ffb2_vertical_plus ||
74 fpriv->ffb_type == ffb2_horizontal_plus) {
75 ctx->stencil = upa_readl(&ffb->stencil);
76 ctx->stencilctl = upa_readl(&ffb->stencilctl);
77 }
78
79 for (i = 0; i < 32; i++)
80 ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
81 ctx->ucsr = upa_readl(&ffb->ucsr);
82 return;
83 }
84
85 /* Fetch drawop. */
86 ctx->drawop = upa_readl(&ffb->drawop);
87
88 /* If we were saving the vertex registers, this is where
89 * we would do it. We would save 32 32-bit words starting
90 * at ffb->suvtx.
91 */
92
93 /* Capture rendering attributes. */
94
95 ctx->ppc = upa_readl(&ffb->ppc); /* Pixel Processor Control */
96 ctx->wid = upa_readl(&ffb->wid); /* Current WID */
97 ctx->fg = upa_readl(&ffb->fg); /* Constant FG color */
98 ctx->bg = upa_readl(&ffb->bg); /* Constant BG color */
99 ctx->consty = upa_readl(&ffb->consty); /* Constant Y */
100 ctx->constz = upa_readl(&ffb->constz); /* Constant Z */
101 ctx->xclip = upa_readl(&ffb->xclip); /* X plane clip */
102 ctx->dcss = upa_readl(&ffb->dcss); /* Depth Cue Scale Slope */
103 ctx->vclipmin = upa_readl(&ffb->vclipmin); /* Primary XY clip, minimum */
104 ctx->vclipmax = upa_readl(&ffb->vclipmax); /* Primary XY clip, maximum */
105 ctx->vclipzmin = upa_readl(&ffb->vclipzmin); /* Primary Z clip, minimum */
106 ctx->vclipzmax = upa_readl(&ffb->vclipzmax); /* Primary Z clip, maximum */
107 ctx->dcsf = upa_readl(&ffb->dcsf); /* Depth Cue Scale Front Bound */
108 ctx->dcsb = upa_readl(&ffb->dcsb); /* Depth Cue Scale Back Bound */
109 ctx->dczf = upa_readl(&ffb->dczf); /* Depth Cue Scale Z Front */
110 ctx->dczb = upa_readl(&ffb->dczb); /* Depth Cue Scale Z Back */
111 ctx->blendc = upa_readl(&ffb->blendc); /* Alpha Blend Control */
112 ctx->blendc1 = upa_readl(&ffb->blendc1); /* Alpha Blend Color 1 */
113 ctx->blendc2 = upa_readl(&ffb->blendc2); /* Alpha Blend Color 2 */
114 ctx->fbc = upa_readl(&ffb->fbc); /* Frame Buffer Control */
115 ctx->rop = upa_readl(&ffb->rop); /* Raster Operation */
116 ctx->cmp = upa_readl(&ffb->cmp); /* Compare Controls */
117 ctx->matchab = upa_readl(&ffb->matchab); /* Buffer A/B Match Ops */
118 ctx->matchc = upa_readl(&ffb->matchc); /* Buffer C Match Ops */
119 ctx->magnab = upa_readl(&ffb->magnab); /* Buffer A/B Magnitude Ops */
120 ctx->magnc = upa_readl(&ffb->magnc); /* Buffer C Magnitude Ops */
121 ctx->pmask = upa_readl(&ffb->pmask); /* RGB Plane Mask */
122 ctx->xpmask = upa_readl(&ffb->xpmask); /* X Plane Mask */
123 ctx->ypmask = upa_readl(&ffb->ypmask); /* Y Plane Mask */
124 ctx->zpmask = upa_readl(&ffb->zpmask); /* Z Plane Mask */
125
126 /* Auxiliary Clips. */
127 ctx->auxclip0min = upa_readl(&ffb->auxclip[0].min);
128 ctx->auxclip0max = upa_readl(&ffb->auxclip[0].max);
129 ctx->auxclip1min = upa_readl(&ffb->auxclip[1].min);
130 ctx->auxclip1max = upa_readl(&ffb->auxclip[1].max);
131 ctx->auxclip2min = upa_readl(&ffb->auxclip[2].min);
132 ctx->auxclip2max = upa_readl(&ffb->auxclip[2].max);
133 ctx->auxclip3min = upa_readl(&ffb->auxclip[3].min);
134 ctx->auxclip3max = upa_readl(&ffb->auxclip[3].max);
135
136 ctx->lpat = upa_readl(&ffb->lpat); /* Line Pattern */
137 ctx->fontxy = upa_readl(&ffb->fontxy); /* XY Font Coordinate */
138 ctx->fontw = upa_readl(&ffb->fontw); /* Font Width */
139 ctx->fontinc = upa_readl(&ffb->fontinc); /* Font X/Y Increment */
140
141 /* These registers/features only exist on FFB2 and later chips. */
142 if (fpriv->ffb_type >= ffb2_prototype) {
143 ctx->dcss1 = upa_readl(&ffb->dcss1); /* Depth Cue Scale Slope 1 */
144 ctx->dcss2 = upa_readl(&ffb->dcss2); /* Depth Cue Scale Slope 2 */
145 ctx->dcss2 = upa_readl(&ffb->dcss3); /* Depth Cue Scale Slope 3 */
146 ctx->dcs2 = upa_readl(&ffb->dcs2); /* Depth Cue Scale 2 */
147 ctx->dcs3 = upa_readl(&ffb->dcs3); /* Depth Cue Scale 3 */
148 ctx->dcs4 = upa_readl(&ffb->dcs4); /* Depth Cue Scale 4 */
149 ctx->dcd2 = upa_readl(&ffb->dcd2); /* Depth Cue Depth 2 */
150 ctx->dcd3 = upa_readl(&ffb->dcd3); /* Depth Cue Depth 3 */
151 ctx->dcd4 = upa_readl(&ffb->dcd4); /* Depth Cue Depth 4 */
152
153 /* And stencil/stencilctl only exists on FFB2+ and later
154 * due to the introduction of 3DRAM-III.
155 */
156 if (fpriv->ffb_type == ffb2_vertical_plus ||
157 fpriv->ffb_type == ffb2_horizontal_plus) {
158 ctx->stencil = upa_readl(&ffb->stencil);
159 ctx->stencilctl = upa_readl(&ffb->stencilctl);
160 }
161 }
162
163 /* Save the 32x32 area pattern. */
164 for (i = 0; i < 32; i++)
165 ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
166
167 /* Finally, stash away the User Constol/Status Register. */
168 ctx->ucsr = upa_readl(&ffb->ucsr);
169}
170
171static void ffb_restore_context(ffb_dev_priv_t * fpriv, int old, int idx)
172{
173 ffb_fbcPtr ffb = fpriv->regs;
174 struct ffb_hw_context *ctx;
175 int i;
176
177 ctx = fpriv->hw_state[idx - 1];
178 if (idx == 0 || ctx == NULL)
179 return;
180
181 if (ctx->is_2d_only) {
182 /* 2D applications only care about certain pieces
183 * of state.
184 */
185 upa_writel(ctx->drawop, &ffb->drawop);
186
187 /* If we were restoring the vertex registers, this is where
188 * we would do it. We would restore 32 32-bit words starting
189 * at ffb->suvtx.
190 */
191
192 upa_writel(ctx->ppc, &ffb->ppc);
193 upa_writel(ctx->wid, &ffb->wid);
194 upa_writel(ctx->fg, &ffb->fg);
195 upa_writel(ctx->bg, &ffb->bg);
196 upa_writel(ctx->xclip, &ffb->xclip);
197 upa_writel(ctx->fbc, &ffb->fbc);
198 upa_writel(ctx->rop, &ffb->rop);
199 upa_writel(ctx->cmp, &ffb->cmp);
200 upa_writel(ctx->matchab, &ffb->matchab);
201 upa_writel(ctx->magnab, &ffb->magnab);
202 upa_writel(ctx->pmask, &ffb->pmask);
203 upa_writel(ctx->xpmask, &ffb->xpmask);
204 upa_writel(ctx->lpat, &ffb->lpat);
205 upa_writel(ctx->fontxy, &ffb->fontxy);
206 upa_writel(ctx->fontw, &ffb->fontw);
207 upa_writel(ctx->fontinc, &ffb->fontinc);
208
209 /* stencil/stencilctl only exists on FFB2+ and later
210 * due to the introduction of 3DRAM-III.
211 */
212 if (fpriv->ffb_type == ffb2_vertical_plus ||
213 fpriv->ffb_type == ffb2_horizontal_plus) {
214 upa_writel(ctx->stencil, &ffb->stencil);
215 upa_writel(ctx->stencilctl, &ffb->stencilctl);
216 upa_writel(0x80000000, &ffb->fbc);
217 upa_writel((ctx->stencilctl | 0x80000),
218 &ffb->rawstencilctl);
219 upa_writel(ctx->fbc, &ffb->fbc);
220 }
221
222 for (i = 0; i < 32; i++)
223 upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
224 upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
225 return;
226 }
227
228 /* Restore drawop. */
229 upa_writel(ctx->drawop, &ffb->drawop);
230
231 /* If we were restoring the vertex registers, this is where
232 * we would do it. We would restore 32 32-bit words starting
233 * at ffb->suvtx.
234 */
235
236 /* Restore rendering attributes. */
237
238 upa_writel(ctx->ppc, &ffb->ppc); /* Pixel Processor Control */
239 upa_writel(ctx->wid, &ffb->wid); /* Current WID */
240 upa_writel(ctx->fg, &ffb->fg); /* Constant FG color */
241 upa_writel(ctx->bg, &ffb->bg); /* Constant BG color */
242 upa_writel(ctx->consty, &ffb->consty); /* Constant Y */
243 upa_writel(ctx->constz, &ffb->constz); /* Constant Z */
244 upa_writel(ctx->xclip, &ffb->xclip); /* X plane clip */
245 upa_writel(ctx->dcss, &ffb->dcss); /* Depth Cue Scale Slope */
246 upa_writel(ctx->vclipmin, &ffb->vclipmin); /* Primary XY clip, minimum */
247 upa_writel(ctx->vclipmax, &ffb->vclipmax); /* Primary XY clip, maximum */
248 upa_writel(ctx->vclipzmin, &ffb->vclipzmin); /* Primary Z clip, minimum */
249 upa_writel(ctx->vclipzmax, &ffb->vclipzmax); /* Primary Z clip, maximum */
250 upa_writel(ctx->dcsf, &ffb->dcsf); /* Depth Cue Scale Front Bound */
251 upa_writel(ctx->dcsb, &ffb->dcsb); /* Depth Cue Scale Back Bound */
252 upa_writel(ctx->dczf, &ffb->dczf); /* Depth Cue Scale Z Front */
253 upa_writel(ctx->dczb, &ffb->dczb); /* Depth Cue Scale Z Back */
254 upa_writel(ctx->blendc, &ffb->blendc); /* Alpha Blend Control */
255 upa_writel(ctx->blendc1, &ffb->blendc1); /* Alpha Blend Color 1 */
256 upa_writel(ctx->blendc2, &ffb->blendc2); /* Alpha Blend Color 2 */
257 upa_writel(ctx->fbc, &ffb->fbc); /* Frame Buffer Control */
258 upa_writel(ctx->rop, &ffb->rop); /* Raster Operation */
259 upa_writel(ctx->cmp, &ffb->cmp); /* Compare Controls */
260 upa_writel(ctx->matchab, &ffb->matchab); /* Buffer A/B Match Ops */
261 upa_writel(ctx->matchc, &ffb->matchc); /* Buffer C Match Ops */
262 upa_writel(ctx->magnab, &ffb->magnab); /* Buffer A/B Magnitude Ops */
263 upa_writel(ctx->magnc, &ffb->magnc); /* Buffer C Magnitude Ops */
264 upa_writel(ctx->pmask, &ffb->pmask); /* RGB Plane Mask */
265 upa_writel(ctx->xpmask, &ffb->xpmask); /* X Plane Mask */
266 upa_writel(ctx->ypmask, &ffb->ypmask); /* Y Plane Mask */
267 upa_writel(ctx->zpmask, &ffb->zpmask); /* Z Plane Mask */
268
269 /* Auxiliary Clips. */
270 upa_writel(ctx->auxclip0min, &ffb->auxclip[0].min);
271 upa_writel(ctx->auxclip0max, &ffb->auxclip[0].max);
272 upa_writel(ctx->auxclip1min, &ffb->auxclip[1].min);
273 upa_writel(ctx->auxclip1max, &ffb->auxclip[1].max);
274 upa_writel(ctx->auxclip2min, &ffb->auxclip[2].min);
275 upa_writel(ctx->auxclip2max, &ffb->auxclip[2].max);
276 upa_writel(ctx->auxclip3min, &ffb->auxclip[3].min);
277 upa_writel(ctx->auxclip3max, &ffb->auxclip[3].max);
278
279 upa_writel(ctx->lpat, &ffb->lpat); /* Line Pattern */
280 upa_writel(ctx->fontxy, &ffb->fontxy); /* XY Font Coordinate */
281 upa_writel(ctx->fontw, &ffb->fontw); /* Font Width */
282 upa_writel(ctx->fontinc, &ffb->fontinc); /* Font X/Y Increment */
283
284 /* These registers/features only exist on FFB2 and later chips. */
285 if (fpriv->ffb_type >= ffb2_prototype) {
286 upa_writel(ctx->dcss1, &ffb->dcss1); /* Depth Cue Scale Slope 1 */
287 upa_writel(ctx->dcss2, &ffb->dcss2); /* Depth Cue Scale Slope 2 */
288 upa_writel(ctx->dcss3, &ffb->dcss2); /* Depth Cue Scale Slope 3 */
289 upa_writel(ctx->dcs2, &ffb->dcs2); /* Depth Cue Scale 2 */
290 upa_writel(ctx->dcs3, &ffb->dcs3); /* Depth Cue Scale 3 */
291 upa_writel(ctx->dcs4, &ffb->dcs4); /* Depth Cue Scale 4 */
292 upa_writel(ctx->dcd2, &ffb->dcd2); /* Depth Cue Depth 2 */
293 upa_writel(ctx->dcd3, &ffb->dcd3); /* Depth Cue Depth 3 */
294 upa_writel(ctx->dcd4, &ffb->dcd4); /* Depth Cue Depth 4 */
295
296 /* And stencil/stencilctl only exists on FFB2+ and later
297 * due to the introduction of 3DRAM-III.
298 */
299 if (fpriv->ffb_type == ffb2_vertical_plus ||
300 fpriv->ffb_type == ffb2_horizontal_plus) {
301 /* Unfortunately, there is a hardware bug on
302 * the FFB2+ chips which prevents a normal write
303 * to the stencil control register from working
304 * as it should.
305 *
306 * The state controlled by the FFB stencilctl register
307 * really gets transferred to the per-buffer instances
308 * of the stencilctl register in the 3DRAM chips.
309 *
310 * The bug is that FFB does not update buffer C correctly,
311 * so we have to do it by hand for them.
312 */
313
314 /* This will update buffers A and B. */
315 upa_writel(ctx->stencil, &ffb->stencil);
316 upa_writel(ctx->stencilctl, &ffb->stencilctl);
317
318 /* Force FFB to use buffer C 3dram regs. */
319 upa_writel(0x80000000, &ffb->fbc);
320 upa_writel((ctx->stencilctl | 0x80000),
321 &ffb->rawstencilctl);
322
323 /* Now restore the correct FBC controls. */
324 upa_writel(ctx->fbc, &ffb->fbc);
325 }
326 }
327
328 /* Restore the 32x32 area pattern. */
329 for (i = 0; i < 32; i++)
330 upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
331
332 /* Finally, stash away the User Constol/Status Register.
333 * The only state we really preserve here is the picking
334 * control.
335 */
336 upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
337}
338
339#define FFB_UCSR_FB_BUSY 0x01000000
340#define FFB_UCSR_RP_BUSY 0x02000000
341#define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY)
342
343static void FFBWait(ffb_fbcPtr ffb)
344{
345 int limit = 100000;
346
347 do {
348 u32 regval = upa_readl(&ffb->ucsr);
349
350 if ((regval & FFB_UCSR_ALL_BUSY) == 0)
351 break;
352 } while (--limit);
353}
354
355int ffb_driver_context_switch(drm_device_t * dev, int old, int new)
356{
357 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
358
359#ifdef DRM_DMA_HISTOGRAM
360 dev->ctx_start = get_cycles();
361#endif
362
363 DRM_DEBUG("Context switch from %d to %d\n", old, new);
364
365 if (new == dev->last_context || dev->last_context == 0) {
366 dev->last_context = new;
367 return 0;
368 }
369
370 FFBWait(fpriv->regs);
371 ffb_save_context(fpriv, old);
372 ffb_restore_context(fpriv, old, new);
373 FFBWait(fpriv->regs);
374
375 dev->last_context = new;
376
377 return 0;
378}
379
380int ffb_driver_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
381 unsigned long arg)
382{
383 drm_ctx_res_t res;
384 drm_ctx_t ctx;
385 int i;
386
387 DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS);
388 if (copy_from_user(&res, (drm_ctx_res_t __user *) arg, sizeof(res)))
389 return -EFAULT;
390 if (res.count >= DRM_RESERVED_CONTEXTS) {
391 memset(&ctx, 0, sizeof(ctx));
392 for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
393 ctx.handle = i;
394 if (copy_to_user(&res.contexts[i], &i, sizeof(i)))
395 return -EFAULT;
396 }
397 }
398 res.count = DRM_RESERVED_CONTEXTS;
399 if (copy_to_user((drm_ctx_res_t __user *) arg, &res, sizeof(res)))
400 return -EFAULT;
401 return 0;
402}
403
404int ffb_driver_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
405 unsigned long arg)
406{
407 drm_file_t *priv = filp->private_data;
408 drm_device_t *dev = priv->dev;
409 drm_ctx_t ctx;
410 int idx;
411
412 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
413 return -EFAULT;
414 idx = DRM(alloc_queue) (dev, (ctx.flags & _DRM_CONTEXT_2DONLY));
415 if (idx < 0)
416 return -ENFILE;
417
418 DRM_DEBUG("%d\n", ctx.handle);
419 ctx.handle = idx;
420 if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
421 return -EFAULT;
422 return 0;
423}
424
425int ffb_driver_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
426 unsigned long arg)
427{
428 drm_file_t *priv = filp->private_data;
429 drm_device_t *dev = priv->dev;
430 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
431 struct ffb_hw_context *hwctx;
432 drm_ctx_t ctx;
433 int idx;
434
435 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
436 return -EFAULT;
437
438 idx = ctx.handle;
439 if (idx <= 0 || idx >= FFB_MAX_CTXS)
440 return -EINVAL;
441
442 hwctx = fpriv->hw_state[idx - 1];
443 if (hwctx == NULL)
444 return -EINVAL;
445
446 if ((ctx.flags & _DRM_CONTEXT_2DONLY) == 0)
447 hwctx->is_2d_only = 0;
448 else
449 hwctx->is_2d_only = 1;
450
451 return 0;
452}
453
454int ffb_driver_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
455 unsigned long arg)
456{
457 drm_file_t *priv = filp->private_data;
458 drm_device_t *dev = priv->dev;
459 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
460 struct ffb_hw_context *hwctx;
461 drm_ctx_t ctx;
462 int idx;
463
464 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
465 return -EFAULT;
466
467 idx = ctx.handle;
468 if (idx <= 0 || idx >= FFB_MAX_CTXS)
469 return -EINVAL;
470
471 hwctx = fpriv->hw_state[idx - 1];
472 if (hwctx == NULL)
473 return -EINVAL;
474
475 if (hwctx->is_2d_only != 0)
476 ctx.flags = _DRM_CONTEXT_2DONLY;
477 else
478 ctx.flags = 0;
479
480 if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
481 return -EFAULT;
482
483 return 0;
484}
485
486int ffb_driver_switchctx(struct inode *inode, struct file *filp,
487 unsigned int cmd, unsigned long arg)
488{
489 drm_file_t *priv = filp->private_data;
490 drm_device_t *dev = priv->dev;
491 drm_ctx_t ctx;
492
493 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
494 return -EFAULT;
495 DRM_DEBUG("%d\n", ctx.handle);
496 return ffb_driver_context_switch(dev, dev->last_context, ctx.handle);
497}
498
499int ffb_driver_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
500 unsigned long arg)
501{
502 drm_ctx_t ctx;
503
504 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
505 return -EFAULT;
506 DRM_DEBUG("%d\n", ctx.handle);
507
508 return 0;
509}
510
511int ffb_driver_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
512 unsigned long arg)
513{
514 drm_ctx_t ctx;
515 drm_file_t *priv = filp->private_data;
516 drm_device_t *dev = priv->dev;
517 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
518 int idx;
519
520 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
521 return -EFAULT;
522 DRM_DEBUG("%d\n", ctx.handle);
523
524 idx = ctx.handle - 1;
525 if (idx < 0 || idx >= FFB_MAX_CTXS)
526 return -EINVAL;
527
528 kfree(fpriv->hw_state[idx]);
529 fpriv->hw_state[idx] = NULL;
530 return 0;
531}
532
533void ffb_set_context_ioctls(void)
534{
535 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)].func = ffb_driver_addctx;
536 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)].func = ffb_driver_rmctx;
537 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)].func = ffb_driver_modctx;
538 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)].func = ffb_driver_getctx;
539 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)].func =
540 ffb_driver_switchctx;
541 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)].func = ffb_driver_newctx;
542 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)].func = ffb_driver_resctx;
543
544}
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
deleted file mode 100644
index 9a19879e3b68..000000000000
--- a/drivers/char/drm/ffb_drv.c
+++ /dev/null
@@ -1,355 +0,0 @@
1/* $Id: ffb_drv.c,v 1.16 2001/10/18 16:00:24 davem Exp $
2 * ffb_drv.c: Creator/Creator3D direct rendering driver.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 */
6
7#include "ffb.h"
8#include "drmP.h"
9
10#include "ffb_drv.h"
11
12#include <linux/smp_lock.h>
13#include <asm/shmparam.h>
14#include <asm/oplib.h>
15#include <asm/upa.h>
16
17#define DRIVER_AUTHOR "David S. Miller"
18
19#define DRIVER_NAME "ffb"
20#define DRIVER_DESC "Creator/Creator3D"
21#define DRIVER_DATE "20000517"
22
23#define DRIVER_MAJOR 0
24#define DRIVER_MINOR 0
25#define DRIVER_PATCHLEVEL 1
26
27typedef struct _ffb_position_t {
28 int node;
29 int root;
30} ffb_position_t;
31
32static ffb_position_t *ffb_position;
33
34static void get_ffb_type(ffb_dev_priv_t * ffb_priv, int instance)
35{
36 volatile unsigned char *strap_bits;
37 unsigned char val;
38
39 strap_bits = (volatile unsigned char *)
40 (ffb_priv->card_phys_base + 0x00200000UL);
41
42 /* Don't ask, you have to read the value twice for whatever
43 * reason to get correct contents.
44 */
45 val = upa_readb(strap_bits);
46 val = upa_readb(strap_bits);
47 switch (val & 0x78) {
48 case (0x0 << 5) | (0x0 << 3):
49 ffb_priv->ffb_type = ffb1_prototype;
50 printk("ffb%d: Detected FFB1 pre-FCS prototype\n", instance);
51 break;
52 case (0x0 << 5) | (0x1 << 3):
53 ffb_priv->ffb_type = ffb1_standard;
54 printk("ffb%d: Detected FFB1\n", instance);
55 break;
56 case (0x0 << 5) | (0x3 << 3):
57 ffb_priv->ffb_type = ffb1_speedsort;
58 printk("ffb%d: Detected FFB1-SpeedSort\n", instance);
59 break;
60 case (0x1 << 5) | (0x0 << 3):
61 ffb_priv->ffb_type = ffb2_prototype;
62 printk("ffb%d: Detected FFB2/vertical pre-FCS prototype\n",
63 instance);
64 break;
65 case (0x1 << 5) | (0x1 << 3):
66 ffb_priv->ffb_type = ffb2_vertical;
67 printk("ffb%d: Detected FFB2/vertical\n", instance);
68 break;
69 case (0x1 << 5) | (0x2 << 3):
70 ffb_priv->ffb_type = ffb2_vertical_plus;
71 printk("ffb%d: Detected FFB2+/vertical\n", instance);
72 break;
73 case (0x2 << 5) | (0x0 << 3):
74 ffb_priv->ffb_type = ffb2_horizontal;
75 printk("ffb%d: Detected FFB2/horizontal\n", instance);
76 break;
77 case (0x2 << 5) | (0x2 << 3):
78 ffb_priv->ffb_type = ffb2_horizontal;
79 printk("ffb%d: Detected FFB2+/horizontal\n", instance);
80 break;
81 default:
82 ffb_priv->ffb_type = ffb2_vertical;
83 printk("ffb%d: Unknown boardID[%08x], assuming FFB2\n",
84 instance, val);
85 break;
86 };
87}
88
89static void ffb_apply_upa_parent_ranges(int parent,
90 struct linux_prom64_registers *regs)
91{
92 struct linux_prom64_ranges ranges[PROMREG_MAX];
93 char name[128];
94 int len, i;
95
96 prom_getproperty(parent, "name", name, sizeof(name));
97 if (strcmp(name, "upa") != 0)
98 return;
99
100 len =
101 prom_getproperty(parent, "ranges", (void *)ranges, sizeof(ranges));
102 if (len <= 0)
103 return;
104
105 len /= sizeof(struct linux_prom64_ranges);
106 for (i = 0; i < len; i++) {
107 struct linux_prom64_ranges *rng = &ranges[i];
108 u64 phys_addr = regs->phys_addr;
109
110 if (phys_addr >= rng->ot_child_base &&
111 phys_addr < (rng->ot_child_base + rng->or_size)) {
112 regs->phys_addr -= rng->ot_child_base;
113 regs->phys_addr += rng->ot_parent_base;
114 return;
115 }
116 }
117
118 return;
119}
120
121static int ffb_init_one(drm_device_t * dev, int prom_node, int parent_node,
122 int instance)
123{
124 struct linux_prom64_registers regs[2 * PROMREG_MAX];
125 ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
126 int i;
127
128 ffb_priv->prom_node = prom_node;
129 if (prom_getproperty(ffb_priv->prom_node, "reg",
130 (void *)regs, sizeof(regs)) <= 0) {
131 return -EINVAL;
132 }
133 ffb_apply_upa_parent_ranges(parent_node, &regs[0]);
134 ffb_priv->card_phys_base = regs[0].phys_addr;
135 ffb_priv->regs = (ffb_fbcPtr)
136 (regs[0].phys_addr + 0x00600000UL);
137 get_ffb_type(ffb_priv, instance);
138 for (i = 0; i < FFB_MAX_CTXS; i++)
139 ffb_priv->hw_state[i] = NULL;
140
141 return 0;
142}
143
144static drm_map_t *ffb_find_map(struct file *filp, unsigned long off)
145{
146 drm_file_t *priv = filp->private_data;
147 drm_device_t *dev;
148 drm_map_list_t *r_list;
149 struct list_head *list;
150 drm_map_t *map;
151
152 if (!priv || (dev = priv->dev) == NULL)
153 return NULL;
154
155 list_for_each(list, &dev->maplist->head) {
156 r_list = (drm_map_list_t *) list;
157 map = r_list->map;
158 if (!map)
159 continue;
160 if (r_list->user_token == off)
161 return map;
162 }
163
164 return NULL;
165}
166
167unsigned long ffb_get_unmapped_area(struct file *filp,
168 unsigned long hint,
169 unsigned long len,
170 unsigned long pgoff, unsigned long flags)
171{
172 drm_map_t *map = ffb_find_map(filp, pgoff << PAGE_SHIFT);
173 unsigned long addr = -ENOMEM;
174
175 if (!map)
176 return get_unmapped_area(NULL, hint, len, pgoff, flags);
177
178 if (map->type == _DRM_FRAME_BUFFER || map->type == _DRM_REGISTERS) {
179#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
180 addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags);
181#else
182 addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
183#endif
184 } else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) {
185 unsigned long slack = SHMLBA - PAGE_SIZE;
186
187 addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags);
188 if (!(addr & ~PAGE_MASK)) {
189 unsigned long kvirt = (unsigned long)map->handle;
190
191 if ((kvirt & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
192 unsigned long koff, aoff;
193
194 koff = kvirt & (SHMLBA - 1);
195 aoff = addr & (SHMLBA - 1);
196 if (koff < aoff)
197 koff += SHMLBA;
198
199 addr += (koff - aoff);
200 }
201 }
202 } else {
203 addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
204 }
205
206 return addr;
207}
208
209static int ffb_presetup(drm_device_t * dev)
210{
211 ffb_dev_priv_t *ffb_priv;
212 int ret = 0;
213 int i = 0;
214
215 /* Check for the case where no device was found. */
216 if (ffb_position == NULL)
217 return -ENODEV;
218
219 /* code used to use numdevs no numdevs anymore */
220 ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL);
221 if (!ffb_priv)
222 return -ENOMEM;
223 memset(ffb_priv, 0, sizeof(*ffb_priv));
224 dev->dev_private = ffb_priv;
225
226 ret = ffb_init_one(dev, ffb_position[i].node, ffb_position[i].root, i);
227 return ret;
228}
229
230static void ffb_driver_release(drm_device_t * dev, struct file *filp)
231{
232 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
233 int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
234 int idx;
235
236 idx = context - 1;
237 if (fpriv &&
238 context != DRM_KERNEL_CONTEXT && fpriv->hw_state[idx] != NULL) {
239 kfree(fpriv->hw_state[idx]);
240 fpriv->hw_state[idx] = NULL;
241 }
242}
243
244static void ffb_driver_pretakedown(drm_device_t * dev)
245{
246 kfree(dev->dev_private);
247}
248
249static int ffb_driver_postcleanup(drm_device_t * dev)
250{
251 kfree(ffb_position);
252 return 0;
253}
254
255static void ffb_driver_kernel_context_switch_unlock(struct drm_device *dev,
256 drm_lock_t * lock)
257{
258 dev->lock.filp = 0;
259 {
260 __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
261 unsigned int old, new, prev, ctx;
262
263 ctx = lock->context;
264 do {
265 old = *plock;
266 new = ctx;
267 prev = cmpxchg(plock, old, new);
268 } while (prev != old);
269 }
270 wake_up_interruptible(&dev->lock.lock_queue);
271}
272
273static unsigned long ffb_driver_get_map_ofs(drm_map_t * map)
274{
275 return (map->offset & 0xffffffff);
276}
277
278static unsigned long ffb_driver_get_reg_ofs(drm_device_t * dev)
279{
280 ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
281
282 if (ffb_priv)
283 return ffb_priv->card_phys_base;
284
285 return 0;
286}
287
288static int postinit(struct drm_device *dev, unsigned long flags)
289{
290 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
291 DRIVER_NAME,
292 DRIVER_MAJOR,
293 DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->minor);
294 return 0;
295}
296
297static int version(drm_version_t * version)
298{
299 int len;
300
301 version->version_major = DRIVER_MAJOR;
302 version->version_minor = DRIVER_MINOR;
303 version->version_patchlevel = DRIVER_PATCHLEVEL;
304 DRM_COPY(version->name, DRIVER_NAME);
305 DRM_COPY(version->date, DRIVER_DATE);
306 DRM_COPY(version->desc, DRIVER_DESC);
307 return 0;
308}
309
310static drm_ioctl_desc_t ioctls[] = {
311
312};
313
314static struct drm_driver driver = {
315 .driver_features = 0,
316 .dev_priv_size = sizeof(u32),
317 .release = ffb_driver_release,
318 .presetup = ffb_presetup,
319 .pretakedown = ffb_driver_pretakedown,
320 .postcleanup = ffb_driver_postcleanup,
321 .kernel_context_switch = ffb_driver_context_switch,
322 .kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock,
323 .get_map_ofs = ffb_driver_get_map_ofs,
324 .get_reg_ofs = ffb_driver_get_reg_ofs,
325 .postinit = postinit,
326 .version = version,
327 .ioctls = ioctls,
328 .num_ioctls = DRM_ARRAY_SIZE(ioctls),
329 .fops = {
330 .owner = THIS_MODULE,
331 .open = drm_open,
332 .release = drm_release,
333 .ioctl = drm_ioctl,
334 .mmap = drm_mmap,
335 .poll = drm_poll,
336 .fasync = drm_fasync,
337 }
338 ,
339};
340
341static int __init ffb_init(void)
342{
343 return -ENODEV;
344}
345
346static void __exit ffb_exit(void)
347{
348}
349
350module_init(ffb_init);
351module_exit(ffb_exit);
352
353MODULE_AUTHOR(DRIVER_AUTHOR);
354MODULE_DESCRIPTION(DRIVER_DESC);
355MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/char/drm/ffb_drv.h b/drivers/char/drm/ffb_drv.h
deleted file mode 100644
index 582afa6dd2b4..000000000000
--- a/drivers/char/drm/ffb_drv.h
+++ /dev/null
@@ -1,379 +0,0 @@
1/* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
2 * ffb_drv.h: Creator/Creator3D direct rendering driver.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 */
6
7/* Auxilliary clips. */
8typedef struct {
9 volatile unsigned int min;
10 volatile unsigned int max;
11} ffb_auxclip, *ffb_auxclipPtr;
12
13/* FFB register set. */
14typedef struct _ffb_fbc {
15 /* Next vertex registers, on the right we list which drawops
16 * use said register and the logical name the register has in
17 * that context.
18 *//* DESCRIPTION DRAWOP(NAME) */
19 /*0x00*/ unsigned int pad1[3];
20 /* Reserved */
21 /*0x0c*/ volatile unsigned int alpha;
22 /* ALPHA Transparency */
23 /*0x10*/ volatile unsigned int red;
24 /* RED */
25 /*0x14*/ volatile unsigned int green;
26 /* GREEN */
27 /*0x18*/ volatile unsigned int blue;
28 /* BLUE */
29 /*0x1c*/ volatile unsigned int z;
30 /* DEPTH */
31 /*0x20*/ volatile unsigned int y;
32 /* Y triangle(DOYF) */
33 /* aadot(DYF) */
34 /* ddline(DYF) */
35 /* aaline(DYF) */
36 /*0x24*/ volatile unsigned int x;
37 /* X triangle(DOXF) */
38 /* aadot(DXF) */
39 /* ddline(DXF) */
40 /* aaline(DXF) */
41 /*0x28*/ unsigned int pad2[2];
42 /* Reserved */
43 /*0x30*/ volatile unsigned int ryf;
44 /* Y (alias to DOYF) ddline(RYF) */
45 /* aaline(RYF) */
46 /* triangle(RYF) */
47 /*0x34*/ volatile unsigned int rxf;
48 /* X ddline(RXF) */
49 /* aaline(RXF) */
50 /* triangle(RXF) */
51 /*0x38*/ unsigned int pad3[2];
52 /* Reserved */
53 /*0x40*/ volatile unsigned int dmyf;
54 /* Y (alias to DOYF) triangle(DMYF) */
55 /*0x44*/ volatile unsigned int dmxf;
56 /* X triangle(DMXF) */
57 /*0x48*/ unsigned int pad4[2];
58 /* Reserved */
59 /*0x50*/ volatile unsigned int ebyi;
60 /* Y (alias to RYI) polygon(EBYI) */
61 /*0x54*/ volatile unsigned int ebxi;
62 /* X polygon(EBXI) */
63 /*0x58*/ unsigned int pad5[2];
64 /* Reserved */
65 /*0x60*/ volatile unsigned int by;
66 /* Y brline(RYI) */
67 /* fastfill(OP) */
68 /* polygon(YI) */
69 /* rectangle(YI) */
70 /* bcopy(SRCY) */
71 /* vscroll(SRCY) */
72 /*0x64*/ volatile unsigned int bx;
73 /* X brline(RXI) */
74 /* polygon(XI) */
75 /* rectangle(XI) */
76 /* bcopy(SRCX) */
77 /* vscroll(SRCX) */
78 /* fastfill(GO) */
79 /*0x68*/ volatile unsigned int dy;
80 /* destination Y fastfill(DSTY) */
81 /* bcopy(DSRY) */
82 /* vscroll(DSRY) */
83 /*0x6c*/ volatile unsigned int dx;
84 /* destination X fastfill(DSTX) */
85 /* bcopy(DSTX) */
86 /* vscroll(DSTX) */
87 /*0x70*/ volatile unsigned int bh;
88 /* Y (alias to RYI) brline(DYI) */
89 /* dot(DYI) */
90 /* polygon(ETYI) */
91 /* Height fastfill(H) */
92 /* bcopy(H) */
93 /* vscroll(H) */
94 /* Y count fastfill(NY) */
95 /*0x74*/ volatile unsigned int bw;
96 /* X dot(DXI) */
97 /* brline(DXI) */
98 /* polygon(ETXI) */
99 /* fastfill(W) */
100 /* bcopy(W) */
101 /* vscroll(W) */
102 /* fastfill(NX) */
103 /*0x78*/ unsigned int pad6[2];
104 /* Reserved */
105 /*0x80*/ unsigned int pad7[32];
106 /* Reserved */
107
108 /* Setup Unit's vertex state register */
109/*100*/ volatile unsigned int suvtx;
110 /*104*/ unsigned int pad8[63];
111 /* Reserved */
112
113 /* Frame Buffer Control Registers */
114 /*200*/ volatile unsigned int ppc;
115 /* Pixel Processor Control */
116 /*204*/ volatile unsigned int wid;
117 /* Current WID */
118 /*208*/ volatile unsigned int fg;
119 /* FG data */
120 /*20c*/ volatile unsigned int bg;
121 /* BG data */
122 /*210*/ volatile unsigned int consty;
123 /* Constant Y */
124 /*214*/ volatile unsigned int constz;
125 /* Constant Z */
126 /*218*/ volatile unsigned int xclip;
127 /* X Clip */
128 /*21c*/ volatile unsigned int dcss;
129 /* Depth Cue Scale Slope */
130 /*220*/ volatile unsigned int vclipmin;
131 /* Viewclip XY Min Bounds */
132 /*224*/ volatile unsigned int vclipmax;
133 /* Viewclip XY Max Bounds */
134 /*228*/ volatile unsigned int vclipzmin;
135 /* Viewclip Z Min Bounds */
136 /*22c*/ volatile unsigned int vclipzmax;
137 /* Viewclip Z Max Bounds */
138 /*230*/ volatile unsigned int dcsf;
139 /* Depth Cue Scale Front Bound */
140 /*234*/ volatile unsigned int dcsb;
141 /* Depth Cue Scale Back Bound */
142 /*238*/ volatile unsigned int dczf;
143 /* Depth Cue Z Front */
144 /*23c*/ volatile unsigned int dczb;
145 /* Depth Cue Z Back */
146 /*240*/ unsigned int pad9;
147 /* Reserved */
148 /*244*/ volatile unsigned int blendc;
149 /* Alpha Blend Control */
150 /*248*/ volatile unsigned int blendc1;
151 /* Alpha Blend Color 1 */
152 /*24c*/ volatile unsigned int blendc2;
153 /* Alpha Blend Color 2 */
154 /*250*/ volatile unsigned int fbramitc;
155 /* FB RAM Interleave Test Control */
156 /*254*/ volatile unsigned int fbc;
157 /* Frame Buffer Control */
158 /*258*/ volatile unsigned int rop;
159 /* Raster OPeration */
160 /*25c*/ volatile unsigned int cmp;
161 /* Frame Buffer Compare */
162 /*260*/ volatile unsigned int matchab;
163 /* Buffer AB Match Mask */
164 /*264*/ volatile unsigned int matchc;
165 /* Buffer C(YZ) Match Mask */
166 /*268*/ volatile unsigned int magnab;
167 /* Buffer AB Magnitude Mask */
168 /*26c*/ volatile unsigned int magnc;
169 /* Buffer C(YZ) Magnitude Mask */
170 /*270*/ volatile unsigned int fbcfg0;
171 /* Frame Buffer Config 0 */
172 /*274*/ volatile unsigned int fbcfg1;
173 /* Frame Buffer Config 1 */
174 /*278*/ volatile unsigned int fbcfg2;
175 /* Frame Buffer Config 2 */
176 /*27c*/ volatile unsigned int fbcfg3;
177 /* Frame Buffer Config 3 */
178 /*280*/ volatile unsigned int ppcfg;
179 /* Pixel Processor Config */
180 /*284*/ volatile unsigned int pick;
181 /* Picking Control */
182 /*288*/ volatile unsigned int fillmode;
183 /* FillMode */
184 /*28c*/ volatile unsigned int fbramwac;
185 /* FB RAM Write Address Control */
186 /*290*/ volatile unsigned int pmask;
187 /* RGB PlaneMask */
188 /*294*/ volatile unsigned int xpmask;
189 /* X PlaneMask */
190 /*298*/ volatile unsigned int ypmask;
191 /* Y PlaneMask */
192 /*29c*/ volatile unsigned int zpmask;
193 /* Z PlaneMask */
194 /*2a0*/ ffb_auxclip auxclip[4];
195 /* Auxilliary Viewport Clip */
196
197 /* New 3dRAM III support regs */
198/*2c0*/ volatile unsigned int rawblend2;
199/*2c4*/ volatile unsigned int rawpreblend;
200/*2c8*/ volatile unsigned int rawstencil;
201/*2cc*/ volatile unsigned int rawstencilctl;
202/*2d0*/ volatile unsigned int threedram1;
203/*2d4*/ volatile unsigned int threedram2;
204/*2d8*/ volatile unsigned int passin;
205/*2dc*/ volatile unsigned int rawclrdepth;
206/*2e0*/ volatile unsigned int rawpmask;
207/*2e4*/ volatile unsigned int rawcsrc;
208/*2e8*/ volatile unsigned int rawmatch;
209/*2ec*/ volatile unsigned int rawmagn;
210/*2f0*/ volatile unsigned int rawropblend;
211/*2f4*/ volatile unsigned int rawcmp;
212/*2f8*/ volatile unsigned int rawwac;
213/*2fc*/ volatile unsigned int fbramid;
214
215 /*300*/ volatile unsigned int drawop;
216 /* Draw OPeration */
217 /*304*/ unsigned int pad10[2];
218 /* Reserved */
219 /*30c*/ volatile unsigned int lpat;
220 /* Line Pattern control */
221 /*310*/ unsigned int pad11;
222 /* Reserved */
223 /*314*/ volatile unsigned int fontxy;
224 /* XY Font coordinate */
225 /*318*/ volatile unsigned int fontw;
226 /* Font Width */
227 /*31c*/ volatile unsigned int fontinc;
228 /* Font Increment */
229 /*320*/ volatile unsigned int font;
230 /* Font bits */
231 /*324*/ unsigned int pad12[3];
232 /* Reserved */
233/*330*/ volatile unsigned int blend2;
234/*334*/ volatile unsigned int preblend;
235/*338*/ volatile unsigned int stencil;
236/*33c*/ volatile unsigned int stencilctl;
237
238 /*340*/ unsigned int pad13[4];
239 /* Reserved */
240 /*350*/ volatile unsigned int dcss1;
241 /* Depth Cue Scale Slope 1 */
242 /*354*/ volatile unsigned int dcss2;
243 /* Depth Cue Scale Slope 2 */
244 /*358*/ volatile unsigned int dcss3;
245 /* Depth Cue Scale Slope 3 */
246/*35c*/ volatile unsigned int widpmask;
247/*360*/ volatile unsigned int dcs2;
248/*364*/ volatile unsigned int dcs3;
249/*368*/ volatile unsigned int dcs4;
250 /*36c*/ unsigned int pad14;
251 /* Reserved */
252/*370*/ volatile unsigned int dcd2;
253/*374*/ volatile unsigned int dcd3;
254/*378*/ volatile unsigned int dcd4;
255 /*37c*/ unsigned int pad15;
256 /* Reserved */
257 /*380*/ volatile unsigned int pattern[32];
258 /* area Pattern */
259 /*400*/ unsigned int pad16[8];
260 /* Reserved */
261 /*420*/ volatile unsigned int reset;
262 /* chip RESET */
263 /*424*/ unsigned int pad17[247];
264 /* Reserved */
265 /*800*/ volatile unsigned int devid;
266 /* Device ID */
267 /*804*/ unsigned int pad18[63];
268 /* Reserved */
269 /*900*/ volatile unsigned int ucsr;
270 /* User Control & Status Register */
271 /*904*/ unsigned int pad19[31];
272 /* Reserved */
273 /*980*/ volatile unsigned int mer;
274 /* Mode Enable Register */
275 /*984*/ unsigned int pad20[1439];
276 /* Reserved */
277} ffb_fbc, *ffb_fbcPtr;
278
279struct ffb_hw_context {
280 int is_2d_only;
281
282 unsigned int ppc;
283 unsigned int wid;
284 unsigned int fg;
285 unsigned int bg;
286 unsigned int consty;
287 unsigned int constz;
288 unsigned int xclip;
289 unsigned int dcss;
290 unsigned int vclipmin;
291 unsigned int vclipmax;
292 unsigned int vclipzmin;
293 unsigned int vclipzmax;
294 unsigned int dcsf;
295 unsigned int dcsb;
296 unsigned int dczf;
297 unsigned int dczb;
298 unsigned int blendc;
299 unsigned int blendc1;
300 unsigned int blendc2;
301 unsigned int fbc;
302 unsigned int rop;
303 unsigned int cmp;
304 unsigned int matchab;
305 unsigned int matchc;
306 unsigned int magnab;
307 unsigned int magnc;
308 unsigned int pmask;
309 unsigned int xpmask;
310 unsigned int ypmask;
311 unsigned int zpmask;
312 unsigned int auxclip0min;
313 unsigned int auxclip0max;
314 unsigned int auxclip1min;
315 unsigned int auxclip1max;
316 unsigned int auxclip2min;
317 unsigned int auxclip2max;
318 unsigned int auxclip3min;
319 unsigned int auxclip3max;
320 unsigned int drawop;
321 unsigned int lpat;
322 unsigned int fontxy;
323 unsigned int fontw;
324 unsigned int fontinc;
325 unsigned int area_pattern[32];
326 unsigned int ucsr;
327 unsigned int stencil;
328 unsigned int stencilctl;
329 unsigned int dcss1;
330 unsigned int dcss2;
331 unsigned int dcss3;
332 unsigned int dcs2;
333 unsigned int dcs3;
334 unsigned int dcs4;
335 unsigned int dcd2;
336 unsigned int dcd3;
337 unsigned int dcd4;
338 unsigned int mer;
339};
340
341#define FFB_MAX_CTXS 32
342
343enum ffb_chip_type {
344 ffb1_prototype = 0, /* Early pre-FCS FFB */
345 ffb1_standard, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
346 ffb1_speedsort, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
347 ffb2_prototype, /* Early pre-FCS vertical FFB2 */
348 ffb2_vertical, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
349 75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
350 ffb2_vertical_plus, /* Second FCS FFB2/vertical, same timings */
351 ffb2_horizontal, /* First FCS FFB2/horizontal, same timings as FFB2/vert */
352 ffb2_horizontal_plus, /* Second FCS FFB2/horizontal, same timings */
353 afb_m3, /* FCS Elite3D, 3 float chips */
354 afb_m6 /* FCS Elite3D, 6 float chips */
355};
356
357typedef struct ffb_dev_priv {
358 /* Misc software state. */
359 int prom_node;
360 enum ffb_chip_type ffb_type;
361 u64 card_phys_base;
362 struct miscdevice miscdev;
363
364 /* Controller registers. */
365 ffb_fbcPtr regs;
366
367 /* Context table. */
368 struct ffb_hw_context *hw_state[FFB_MAX_CTXS];
369} ffb_dev_priv_t;
370
371extern unsigned long ffb_get_unmapped_area(struct file *filp,
372 unsigned long hint,
373 unsigned long len,
374 unsigned long pgoff,
375 unsigned long flags);
376extern void ffb_set_context_ioctls(void);
377extern drm_ioctl_desc_t DRM(ioctls)[];
378
379extern int ffb_driver_context_switch(drm_device_t * dev, int old, int new);
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index 6d58b0370802..59146e3365ba 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -197,6 +197,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
197 197
198 hrs = alm_tm.tm_hour; 198 hrs = alm_tm.tm_hour;
199 min = alm_tm.tm_min; 199 min = alm_tm.tm_min;
200 sec = alm_tm.tm_sec;
200 201
201 if (hrs >= 24) 202 if (hrs >= 24)
202 hrs = 0xff; 203 hrs = 0xff;
@@ -204,9 +205,11 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
204 if (min >= 60) 205 if (min >= 60)
205 min = 0xff; 206 min = 0xff;
206 207
207 BIN_TO_BCD(sec); 208 if (sec != 0)
208 BIN_TO_BCD(min); 209 return -EINVAL;
209 BIN_TO_BCD(hrs); 210
211 min = BIN2BCD(min);
212 min = BIN2BCD(hrs);
210 213
211 spin_lock(&ds1286_lock); 214 spin_lock(&ds1286_lock);
212 rtc_write(hrs, RTC_HOURS_ALARM); 215 rtc_write(hrs, RTC_HOURS_ALARM);
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 337bbcdcf13d..8ea02755b1c9 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -710,12 +710,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
710} 710}
711 711
712 712
713static unsigned int gs_baudrates[] = {
714 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
715 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
716};
717
718
719void gs_set_termios (struct tty_struct * tty, 713void gs_set_termios (struct tty_struct * tty,
720 struct ktermios * old_termios) 714 struct ktermios * old_termios)
721{ 715{
@@ -771,7 +765,6 @@ void gs_set_termios (struct tty_struct * tty,
771 765
772 baudrate = tty_get_baud_rate(tty); 766 baudrate = tty_get_baud_rate(tty);
773 767
774 baudrate = gs_baudrates[baudrate];
775 if ((tiosp->c_cflag & CBAUD) == B38400) { 768 if ((tiosp->c_cflag & CBAUD) == B38400) {
776 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 769 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
777 baudrate = 57600; 770 baudrate = 57600;
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c
index 5f4fdcf7c96e..1f0962616ee5 100644
--- a/drivers/char/lcd.c
+++ b/drivers/char/lcd.c
@@ -11,9 +11,6 @@
11 * March 2001: Ported from 2.0.34 by Liam Davies 11 * March 2001: Ported from 2.0.34 by Liam Davies
12 * 12 *
13 */ 13 */
14
15#define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */
16
17#include <linux/types.h> 14#include <linux/types.h>
18#include <linux/errno.h> 15#include <linux/errno.h>
19#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
@@ -32,8 +29,6 @@
32 29
33#include "lcd.h" 30#include "lcd.h"
34 31
35static DEFINE_SPINLOCK(lcd_lock);
36
37static int lcd_ioctl(struct inode *inode, struct file *file, 32static int lcd_ioctl(struct inode *inode, struct file *file,
38 unsigned int cmd, unsigned long arg); 33 unsigned int cmd, unsigned long arg);
39 34
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e45326856680..7a32df594907 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1376,6 +1376,8 @@ static void do_tty_hangup(struct work_struct *work)
1376 read_unlock(&tasklist_lock); 1376 read_unlock(&tasklist_lock);
1377 1377
1378 tty->flags = 0; 1378 tty->flags = 0;
1379 put_pid(tty->session);
1380 put_pid(tty->pgrp);
1379 tty->session = NULL; 1381 tty->session = NULL;
1380 tty->pgrp = NULL; 1382 tty->pgrp = NULL;
1381 tty->ctrl_status = 0; 1383 tty->ctrl_status = 0;
@@ -3841,6 +3843,9 @@ static struct pid *__proc_set_tty(struct task_struct *tsk, struct tty_struct *tt
3841{ 3843{
3842 struct pid *old_pgrp; 3844 struct pid *old_pgrp;
3843 if (tty) { 3845 if (tty) {
3846 /* We should not have a session or pgrp to here but.... */
3847 put_pid(tty->session);
3848 put_pid(tty->pgrp);
3844 tty->session = get_pid(task_session(tsk)); 3849 tty->session = get_pid(task_session(tsk));
3845 tty->pgrp = get_pid(task_pgrp(tsk)); 3850 tty->pgrp = get_pid(task_pgrp(tsk));
3846 } 3851 }
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index c3f8e383933b..1bbb45b937fd 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -724,6 +724,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
724 return -ENOMEM; 724 return -ENOMEM;
725 memset(vc, 0, sizeof(*vc)); 725 memset(vc, 0, sizeof(*vc));
726 vc_cons[currcons].d = vc; 726 vc_cons[currcons].d = vc;
727 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
727 visual_init(vc, currcons, 1); 728 visual_init(vc, currcons, 1);
728 if (!*vc->vc_uni_pagedir_loc) 729 if (!*vc->vc_uni_pagedir_loc)
729 con_set_default_unimap(vc); 730 con_set_default_unimap(vc);
@@ -2185,10 +2186,28 @@ static void console_callback(struct work_struct *ignored)
2185 release_console_sem(); 2186 release_console_sem();
2186} 2187}
2187 2188
2188void set_console(int nr) 2189int set_console(int nr)
2189{ 2190{
2191 struct vc_data *vc = vc_cons[fg_console].d;
2192
2193 if (!vc_cons_allocated(nr) || vt_dont_switch ||
2194 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) {
2195
2196 /*
2197 * Console switch will fail in console_callback() or
2198 * change_console() so there is no point scheduling
2199 * the callback
2200 *
2201 * Existing set_console() users don't check the return
2202 * value so this shouldn't break anything
2203 */
2204 return -EINVAL;
2205 }
2206
2190 want_console = nr; 2207 want_console = nr;
2191 schedule_console_callback(); 2208 schedule_console_callback();
2209
2210 return 0;
2192} 2211}
2193 2212
2194struct tty_driver *console_driver; 2213struct tty_driver *console_driver;
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 3a5d301e783b..c9f2dd620e87 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -34,7 +34,7 @@
34#include <linux/kbd_diacr.h> 34#include <linux/kbd_diacr.h>
35#include <linux/selection.h> 35#include <linux/selection.h>
36 36
37static char vt_dont_switch; 37char vt_dont_switch;
38extern struct tty_driver *console_driver; 38extern struct tty_driver *console_driver;
39 39
40#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) 40#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count)
@@ -1039,10 +1039,22 @@ int vt_waitactive(int vt)
1039 1039
1040 add_wait_queue(&vt_activate_queue, &wait); 1040 add_wait_queue(&vt_activate_queue, &wait);
1041 for (;;) { 1041 for (;;) {
1042 set_current_state(TASK_INTERRUPTIBLE);
1043 retval = 0; 1042 retval = 0;
1044 if (vt == fg_console) 1043
1044 /*
1045 * Synchronize with redraw_screen(). By acquiring the console
1046 * semaphore we make sure that the console switch is completed
1047 * before we return. If we didn't wait for the semaphore, we
1048 * could return at a point where fg_console has already been
1049 * updated, but the console switch hasn't been completed.
1050 */
1051 acquire_console_sem();
1052 set_current_state(TASK_INTERRUPTIBLE);
1053 if (vt == fg_console) {
1054 release_console_sem();
1045 break; 1055 break;
1056 }
1057 release_console_sem();
1046 retval = -EINTR; 1058 retval = -EINTR;
1047 if (signal_pending(current)) 1059 if (signal_pending(current))
1048 break; 1060 break;
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index ea09d0c974ea..e812aa129e28 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -301,6 +301,7 @@ config I6300ESB_WDT
301config I8XX_TCO 301config I8XX_TCO
302 tristate "Intel i8xx TCO Timer/Watchdog" 302 tristate "Intel i8xx TCO Timer/Watchdog"
303 depends on WATCHDOG && (X86 || IA64) && PCI 303 depends on WATCHDOG && (X86 || IA64) && PCI
304 default n
304 ---help--- 305 ---help---
305 Hardware driver for the TCO timer built into the Intel 82801 306 Hardware driver for the TCO timer built into the Intel 82801
306 I/O Controller Hub family. The TCO (Total Cost of Ownership) 307 I/O Controller Hub family. The TCO (Total Cost of Ownership)
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
index 4a328ba0d262..76c7fa37fa6c 100644
--- a/drivers/char/watchdog/machzwd.c
+++ b/drivers/char/watchdog/machzwd.c
@@ -314,21 +314,21 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
314{ 314{
315 void __user *argp = (void __user *)arg; 315 void __user *argp = (void __user *)arg;
316 int __user *p = argp; 316 int __user *p = argp;
317 switch(cmd){ 317 switch (cmd) {
318 case WDIOC_GETSUPPORT: 318 case WDIOC_GETSUPPORT:
319 if (copy_to_user(argp, &zf_info, sizeof(zf_info))) 319 if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
320 return -EFAULT; 320 return -EFAULT;
321 break; 321 break;
322 322
323 case WDIOC_GETSTATUS: 323 case WDIOC_GETSTATUS:
324 return put_user(0, p); 324 return put_user(0, p);
325 325
326 case WDIOC_KEEPALIVE: 326 case WDIOC_KEEPALIVE:
327 zf_ping(0); 327 zf_ping(0);
328 break; 328 break;
329 329
330 default: 330 default:
331 return -ENOTTY; 331 return -ENOTTY;
332 } 332 }
333 333
334 return 0; 334 return 0;
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index d42060ede930..5ac309ee7f05 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -90,7 +90,7 @@ __setup("acpi_pm_good", acpi_pm_good_setup);
90static inline void acpi_pm_need_workaround(void) 90static inline void acpi_pm_need_workaround(void)
91{ 91{
92 clocksource_acpi_pm.read = acpi_pm_read_slow; 92 clocksource_acpi_pm.read = acpi_pm_read_slow;
93 clocksource_acpi_pm.rating = 110; 93 clocksource_acpi_pm.rating = 120;
94} 94}
95 95
96/* 96/*
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index a44db75bc25b..a905f7820331 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
128 */ 128 */
129static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) 129static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data)
130{ 130{
131 struct cn_callback_entry *__cbq; 131 struct cn_callback_entry *__cbq, *__new_cbq;
132 struct cn_dev *dev = &cdev; 132 struct cn_dev *dev = &cdev;
133 int err = -ENODEV; 133 int err = -ENODEV;
134 134
@@ -148,27 +148,27 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
148 } else { 148 } else {
149 struct cn_callback_data *d; 149 struct cn_callback_data *d;
150 150
151 __cbq = kzalloc(sizeof(*__cbq), GFP_ATOMIC); 151 err = -ENOMEM;
152 if (__cbq) { 152 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
153 d = &__cbq->data; 153 if (__new_cbq) {
154 d = &__new_cbq->data;
154 d->callback_priv = msg; 155 d->callback_priv = msg;
155 d->callback = __cbq->data.callback; 156 d->callback = __cbq->data.callback;
156 d->ddata = data; 157 d->ddata = data;
157 d->destruct_data = destruct_data; 158 d->destruct_data = destruct_data;
158 d->free = __cbq; 159 d->free = __new_cbq;
159 160
160 INIT_WORK(&__cbq->work, 161 INIT_WORK(&__new_cbq->work,
161 &cn_queue_wrapper); 162 &cn_queue_wrapper);
162 163
163 if (queue_work(dev->cbdev->cn_queue, 164 if (queue_work(dev->cbdev->cn_queue,
164 &__cbq->work)) 165 &__new_cbq->work))
165 err = 0; 166 err = 0;
166 else { 167 else {
167 kfree(__cbq); 168 kfree(__new_cbq);
168 err = -EINVAL; 169 err = -EINVAL;
169 } 170 }
170 } else 171 }
171 err = -ENOMEM;
172 } 172 }
173 break; 173 break;
174 } 174 }
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index f52facc570f5..3162010900c9 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1015,6 +1015,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
1015{ 1015{
1016 unsigned int cpu = sys_dev->id; 1016 unsigned int cpu = sys_dev->id;
1017 int retval; 1017 int retval;
1018
1019 if (cpu_is_offline(cpu))
1020 return 0;
1021
1018 if (unlikely(lock_policy_rwsem_write(cpu))) 1022 if (unlikely(lock_policy_rwsem_write(cpu)))
1019 BUG(); 1023 BUG();
1020 1024
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 15278044295c..322ee2984e3d 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -176,6 +176,7 @@ void dma_chan_cleanup(struct kref *kref)
176 chan->client = NULL; 176 chan->client = NULL;
177 kref_put(&chan->device->refcount, dma_async_device_cleanup); 177 kref_put(&chan->device->refcount, dma_async_device_cleanup);
178} 178}
179EXPORT_SYMBOL(dma_chan_cleanup);
179 180
180static void dma_chan_free_rcu(struct rcu_head *rcu) 181static void dma_chan_free_rcu(struct rcu_head *rcu)
181{ 182{
@@ -261,6 +262,7 @@ struct dma_client *dma_async_client_register(dma_event_callback event_callback)
261 262
262 return client; 263 return client;
263} 264}
265EXPORT_SYMBOL(dma_async_client_register);
264 266
265/** 267/**
266 * dma_async_client_unregister - unregister a client and free the &dma_client 268 * dma_async_client_unregister - unregister a client and free the &dma_client
@@ -287,6 +289,7 @@ void dma_async_client_unregister(struct dma_client *client)
287 kfree(client); 289 kfree(client);
288 dma_chans_rebalance(); 290 dma_chans_rebalance();
289} 291}
292EXPORT_SYMBOL(dma_async_client_unregister);
290 293
291/** 294/**
292 * dma_async_client_chan_request - request DMA channels 295 * dma_async_client_chan_request - request DMA channels
@@ -304,6 +307,7 @@ void dma_async_client_chan_request(struct dma_client *client,
304 client->chans_desired = number; 307 client->chans_desired = number;
305 dma_chans_rebalance(); 308 dma_chans_rebalance();
306} 309}
310EXPORT_SYMBOL(dma_async_client_chan_request);
307 311
308/** 312/**
309 * dma_async_device_register - registers DMA devices found 313 * dma_async_device_register - registers DMA devices found
@@ -346,6 +350,7 @@ int dma_async_device_register(struct dma_device *device)
346 350
347 return 0; 351 return 0;
348} 352}
353EXPORT_SYMBOL(dma_async_device_register);
349 354
350/** 355/**
351 * dma_async_device_cleanup - function called when all references are released 356 * dma_async_device_cleanup - function called when all references are released
@@ -390,23 +395,12 @@ void dma_async_device_unregister(struct dma_device *device)
390 kref_put(&device->refcount, dma_async_device_cleanup); 395 kref_put(&device->refcount, dma_async_device_cleanup);
391 wait_for_completion(&device->done); 396 wait_for_completion(&device->done);
392} 397}
398EXPORT_SYMBOL(dma_async_device_unregister);
393 399
394static int __init dma_bus_init(void) 400static int __init dma_bus_init(void)
395{ 401{
396 mutex_init(&dma_list_mutex); 402 mutex_init(&dma_list_mutex);
397 return class_register(&dma_devclass); 403 return class_register(&dma_devclass);
398} 404}
399
400subsys_initcall(dma_bus_init); 405subsys_initcall(dma_bus_init);
401 406
402EXPORT_SYMBOL(dma_async_client_register);
403EXPORT_SYMBOL(dma_async_client_unregister);
404EXPORT_SYMBOL(dma_async_client_chan_request);
405EXPORT_SYMBOL(dma_async_memcpy_buf_to_buf);
406EXPORT_SYMBOL(dma_async_memcpy_buf_to_pg);
407EXPORT_SYMBOL(dma_async_memcpy_pg_to_pg);
408EXPORT_SYMBOL(dma_async_memcpy_complete);
409EXPORT_SYMBOL(dma_async_memcpy_issue_pending);
410EXPORT_SYMBOL(dma_async_device_register);
411EXPORT_SYMBOL(dma_async_device_unregister);
412EXPORT_SYMBOL(dma_chan_cleanup);
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c
index 9e913629ef39..74edb1d0110f 100644
--- a/drivers/eisa/pci_eisa.c
+++ b/drivers/eisa/pci_eisa.c
@@ -19,8 +19,8 @@
19/* There is only *one* pci_eisa device per machine, right ? */ 19/* There is only *one* pci_eisa device per machine, right ? */
20static struct eisa_root_device pci_eisa_root; 20static struct eisa_root_device pci_eisa_root;
21 21
22static int __devinit pci_eisa_init (struct pci_dev *pdev, 22static int __init pci_eisa_init(struct pci_dev *pdev,
23 const struct pci_device_id *ent) 23 const struct pci_device_id *ent)
24{ 24{
25 int rc; 25 int rc;
26 26
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f4ee1afe488f..1cca32f46947 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -26,6 +26,7 @@
26#include <asm/byteorder.h> 26#include <asm/byteorder.h>
27#include <linux/input.h> 27#include <linux/input.h>
28#include <linux/wait.h> 28#include <linux/wait.h>
29#include <linux/vmalloc.h>
29 30
30#include <linux/hid.h> 31#include <linux/hid.h>
31#include <linux/hiddev.h> 32#include <linux/hiddev.h>
@@ -654,12 +655,13 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size)
654 memcpy(device->rdesc, start, size); 655 memcpy(device->rdesc, start, size);
655 device->rsize = size; 656 device->rsize = size;
656 657
657 if (!(parser = kzalloc(sizeof(struct hid_parser), GFP_KERNEL))) { 658 if (!(parser = vmalloc(sizeof(struct hid_parser)))) {
658 kfree(device->rdesc); 659 kfree(device->rdesc);
659 kfree(device->collection); 660 kfree(device->collection);
660 kfree(device); 661 kfree(device);
661 return NULL; 662 return NULL;
662 } 663 }
664 memset(parser, 0, sizeof(struct hid_parser));
663 parser->device = device; 665 parser->device = device;
664 666
665 end = start + size; 667 end = start + size;
@@ -668,7 +670,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size)
668 if (item.format != HID_ITEM_FORMAT_SHORT) { 670 if (item.format != HID_ITEM_FORMAT_SHORT) {
669 dbg("unexpected long global item"); 671 dbg("unexpected long global item");
670 hid_free_device(device); 672 hid_free_device(device);
671 kfree(parser); 673 vfree(parser);
672 return NULL; 674 return NULL;
673 } 675 }
674 676
@@ -676,7 +678,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size)
676 dbg("item %u %u %u %u parsing failed\n", 678 dbg("item %u %u %u %u parsing failed\n",
677 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); 679 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag);
678 hid_free_device(device); 680 hid_free_device(device);
679 kfree(parser); 681 vfree(parser);
680 return NULL; 682 return NULL;
681 } 683 }
682 684
@@ -684,23 +686,23 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size)
684 if (parser->collection_stack_ptr) { 686 if (parser->collection_stack_ptr) {
685 dbg("unbalanced collection at end of report description"); 687 dbg("unbalanced collection at end of report description");
686 hid_free_device(device); 688 hid_free_device(device);
687 kfree(parser); 689 vfree(parser);
688 return NULL; 690 return NULL;
689 } 691 }
690 if (parser->local.delimiter_depth) { 692 if (parser->local.delimiter_depth) {
691 dbg("unbalanced delimiter at end of report description"); 693 dbg("unbalanced delimiter at end of report description");
692 hid_free_device(device); 694 hid_free_device(device);
693 kfree(parser); 695 vfree(parser);
694 return NULL; 696 return NULL;
695 } 697 }
696 kfree(parser); 698 vfree(parser);
697 return device; 699 return device;
698 } 700 }
699 } 701 }
700 702
701 dbg("item fetching failed at offset %d\n", (int)(end - start)); 703 dbg("item fetching failed at offset %d\n", (int)(end - start));
702 hid_free_device(device); 704 hid_free_device(device);
703 kfree(parser); 705 vfree(parser);
704 return NULL; 706 return NULL;
705} 707}
706EXPORT_SYMBOL_GPL(hid_parse_report); 708EXPORT_SYMBOL_GPL(hid_parse_report);
@@ -753,8 +755,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
753 755
754 report += offset >> 3; /* adjust byte index */ 756 report += offset >> 3; /* adjust byte index */
755 offset &= 7; /* now only need bit offset into one byte */ 757 offset &= 7; /* now only need bit offset into one byte */
756 x = get_unaligned((u64 *) report); 758 x = le64_to_cpu(get_unaligned((__le64 *) report));
757 x = le64_to_cpu(x);
758 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ 759 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */
759 return (u32) x; 760 return (u32) x;
760} 761}
@@ -769,7 +770,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
769 */ 770 */
770static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) 771static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value)
771{ 772{
772 u64 x; 773 __le64 x;
773 u64 m = (1ULL << n) - 1; 774 u64 m = (1ULL << n) - 1;
774 775
775 WARN_ON(n > 32); 776 WARN_ON(n > 32);
@@ -780,10 +781,10 @@ static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u3
780 report += offset >> 3; 781 report += offset >> 3;
781 offset &= 7; 782 offset &= 7;
782 783
783 x = get_unaligned((u64 *)report); 784 x = get_unaligned((__le64 *)report);
784 x &= cpu_to_le64(~(m << offset)); 785 x &= cpu_to_le64(~(m << offset));
785 x |= cpu_to_le64(((u64) value) << offset); 786 x |= cpu_to_le64(((u64) value) << offset);
786 put_unaligned(x, (u64 *) report); 787 put_unaligned(x, (__le64 *) report);
787} 788}
788 789
789/* 790/*
@@ -873,10 +874,6 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
873 unsigned size = field->report_size; 874 unsigned size = field->report_size;
874 unsigned n; 875 unsigned n;
875 876
876 /* make sure the unused bits in the last byte are zeros */
877 if (count > 0 && size > 0)
878 data[(offset+count*size-1)/8] = 0;
879
880 for (n = 0; n < count; n++) { 877 for (n = 0; n < count; n++) {
881 if (field->logical_minimum < 0) /* signed values */ 878 if (field->logical_minimum < 0) /* signed values */
882 implement(data, offset + n * size, size, s32ton(field->value[n], size)); 879 implement(data, offset + n * size, size, s32ton(field->value[n], size));
@@ -972,7 +969,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
972 969
973 if (size < rsize) { 970 if (size < rsize) {
974 dbg("report %d is too short, (%d < %d)", report->id, size, rsize); 971 dbg("report %d is too short, (%d < %d)", report->id, size, rsize);
975 return -1; 972 memset(data + size, 0, rsize - size);
976 } 973 }
977 974
978 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 975 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index c3d4856fb618..6d105a1d41b1 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -527,6 +527,7 @@ config SENSORS_W83792D
527config SENSORS_W83793 527config SENSORS_W83793
528 tristate "Winbond W83793" 528 tristate "Winbond W83793"
529 depends on HWMON && I2C && EXPERIMENTAL 529 depends on HWMON && I2C && EXPERIMENTAL
530 select HWMON_VID
530 help 531 help
531 If you say yes here you get support for the Winbond W83793 532 If you say yes here you get support for the Winbond W83793
532 hardware monitoring chip. 533 hardware monitoring chip.
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index e15f9e37716a..0c70f8293341 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -254,7 +254,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr,
254 break; 254 break;
255 255
256 case I2C_SMBUS_BLOCK_PROC_CALL: 256 case I2C_SMBUS_BLOCK_PROC_CALL:
257 len = min_t(u8, data->block[0], 31); 257 len = min_t(u8, data->block[0],
258 I2C_SMBUS_BLOCK_MAX - 1);
258 amd_ec_write(smbus, AMD_SMB_CMD, command); 259 amd_ec_write(smbus, AMD_SMB_CMD, command);
259 amd_ec_write(smbus, AMD_SMB_BCNT, len); 260 amd_ec_write(smbus, AMD_SMB_BCNT, len);
260 for (i = 0; i < len; i++) 261 for (i = 0; i < len; i++)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 6569a36985bd..a320e7d82c1f 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -97,6 +97,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
97 int command, int hwpec); 97 int command, int hwpec);
98 98
99static unsigned long i801_smba; 99static unsigned long i801_smba;
100static unsigned char i801_original_hstcfg;
100static struct pci_driver i801_driver; 101static struct pci_driver i801_driver;
101static struct pci_dev *I801_dev; 102static struct pci_dev *I801_dev;
102static int isich4; 103static int isich4;
@@ -510,6 +511,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
510 } 511 }
511 512
512 pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); 513 pci_read_config_byte(I801_dev, SMBHSTCFG, &temp);
514 i801_original_hstcfg = temp;
513 temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ 515 temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */
514 if (!(temp & SMBHSTCFG_HST_EN)) { 516 if (!(temp & SMBHSTCFG_HST_EN)) {
515 dev_info(&dev->dev, "Enabling SMBus device\n"); 517 dev_info(&dev->dev, "Enabling SMBus device\n");
@@ -543,6 +545,7 @@ exit:
543static void __devexit i801_remove(struct pci_dev *dev) 545static void __devexit i801_remove(struct pci_dev *dev)
544{ 546{
545 i2c_del_adapter(&i801_adapter); 547 i2c_del_adapter(&i801_adapter);
548 pci_write_config_byte(I801_dev, SMBHSTCFG, i801_original_hstcfg);
546 pci_release_region(dev, SMBBAR); 549 pci_release_region(dev, SMBBAR);
547 /* 550 /*
548 * do not call pci_disable_device(dev) since it can cause hard hangs on 551 * do not call pci_disable_device(dev) since it can cause hard hangs on
@@ -550,11 +553,33 @@ static void __devexit i801_remove(struct pci_dev *dev)
550 */ 553 */
551} 554}
552 555
556#ifdef CONFIG_PM
557static int i801_suspend(struct pci_dev *dev, pm_message_t mesg)
558{
559 pci_save_state(dev);
560 pci_write_config_byte(dev, SMBHSTCFG, i801_original_hstcfg);
561 pci_set_power_state(dev, pci_choose_state(dev, mesg));
562 return 0;
563}
564
565static int i801_resume(struct pci_dev *dev)
566{
567 pci_set_power_state(dev, PCI_D0);
568 pci_restore_state(dev);
569 return pci_enable_device(dev);
570}
571#else
572#define i801_suspend NULL
573#define i801_resume NULL
574#endif
575
553static struct pci_driver i801_driver = { 576static struct pci_driver i801_driver = {
554 .name = "i801_smbus", 577 .name = "i801_smbus",
555 .id_table = i801_ids, 578 .id_table = i801_ids,
556 .probe = i801_probe, 579 .probe = i801_probe,
557 .remove = __devexit_p(i801_remove), 580 .remove = __devexit_p(i801_remove),
581 .suspend = i801_suspend,
582 .resume = i801_resume,
558}; 583};
559 584
560static int __init i2c_i801_init(void) 585static int __init i2c_i801_init(void)
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c
index 15edf40828b4..8a2ff0c114d9 100644
--- a/drivers/i2c/chips/ds1374.c
+++ b/drivers/i2c/chips/ds1374.c
@@ -207,6 +207,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind)
207 client->driver = &ds1374_driver; 207 client->driver = &ds1374_driver;
208 208
209 ds1374_workqueue = create_singlethread_workqueue("ds1374"); 209 ds1374_workqueue = create_singlethread_workqueue("ds1374");
210 if (!ds1374_workqueue) {
211 kfree(client);
212 return -ENOMEM; /* most expected reason */
213 }
210 214
211 if ((rc = i2c_attach_client(client)) != 0) { 215 if ((rc = i2c_attach_client(client)) != 0) {
212 kfree(client); 216 kfree(client);
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 5d134bb75ba1..ca2e4f830c39 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA
103 ---help--- 103 ---help---
104 There are two drivers for Serial ATA controllers. 104 There are two drivers for Serial ATA controllers.
105 105
106 The main driver, "libata", exists inside the SCSI subsystem 106 The main driver, "libata", uses the SCSI subsystem
107 and supports most modern SATA controllers. 107 and supports most modern SATA controllers. In order to use it
108 you may take a look at "Serial ATA (prod) and Parallel ATA
109 (experimental) drivers".
108 110
109 The IDE driver (which you are currently configuring) supports 111 The IDE driver (which you are currently configuring) supports
110 a few first-generation SATA controllers. 112 a few first-generation SATA controllers.
@@ -434,24 +436,8 @@ config BLK_DEV_IDEDMA_FORCED
434 436
435 Generally say N here. 437 Generally say N here.
436 438
437config IDEDMA_PCI_AUTO
438 bool "Use PCI DMA by default when available"
439 ---help---
440 Prior to kernel version 2.1.112, Linux used to automatically use
441 DMA for IDE drives and chipsets which support it. Due to concerns
442 about a couple of cases where buggy hardware may have caused damage,
443 the default is now to NOT use DMA automatically. To revert to the
444 previous behaviour, say Y to this question.
445
446 If you suspect your hardware is at all flakey, say N here.
447 Do NOT email the IDE kernel people regarding this issue!
448
449 It is normally safe to answer Y to this question unless your
450 motherboard uses a VIA VP2 chipset, in which case you should say N.
451
452config IDEDMA_ONLYDISK 439config IDEDMA_ONLYDISK
453 bool "Enable DMA only for disks " 440 bool "Enable DMA only for disks "
454 depends on IDEDMA_PCI_AUTO
455 help 441 help
456 This is used if you know your ATAPI Devices are going to fail DMA 442 This is used if you know your ATAPI Devices are going to fail DMA
457 Transfers. 443 Transfers.
@@ -769,6 +755,14 @@ config BLK_DEV_TC86C001
769 help 755 help
770 This driver adds support for Toshiba TC86C001 GOKU-S chip. 756 This driver adds support for Toshiba TC86C001 GOKU-S chip.
771 757
758config BLK_DEV_CELLEB
759 tristate "Toshiba's Cell Reference Set IDE support"
760 depends on PPC_CELLEB
761 help
762 This driver provides support for the built-in IDE controller on
763 Toshiba Cell Reference Board.
764 If unsure, say Y.
765
772endif 766endif
773 767
774config BLK_DEV_IDE_PMAC 768config BLK_DEV_IDE_PMAC
@@ -800,14 +794,6 @@ config BLK_DEV_IDEDMA_PMAC
800 to transfer data to and from memory. Saying Y is safe and improves 794 to transfer data to and from memory. Saying Y is safe and improves
801 performance. 795 performance.
802 796
803config BLK_DEV_IDE_CELLEB
804 bool "Toshiba's Cell Reference Set IDE support"
805 depends on PPC_CELLEB
806 help
807 This driver provides support for the built-in IDE controller on
808 Toshiba Cell Reference Board.
809 If unsure, say Y.
810
811config BLK_DEV_IDE_SWARM 797config BLK_DEV_IDE_SWARM
812 tristate "IDE for Sibyte evaluation boards" 798 tristate "IDE for Sibyte evaluation boards"
813 depends on SIBYTE_SB1xxx_SOC 799 depends on SIBYTE_SB1xxx_SOC
@@ -851,19 +837,6 @@ config BLK_DEV_IDEDMA_ICS
851 Say Y here if you want to add DMA (Direct Memory Access) support to 837 Say Y here if you want to add DMA (Direct Memory Access) support to
852 the ICS IDE driver. 838 the ICS IDE driver.
853 839
854config IDEDMA_ICS_AUTO
855 bool "Use ICS DMA by default"
856 depends on BLK_DEV_IDEDMA_ICS
857 help
858 Prior to kernel version 2.1.112, Linux used to automatically use
859 DMA for IDE drives and chipsets which support it. Due to concerns
860 about a couple of cases where buggy hardware may have caused damage,
861 the default is now to NOT use DMA automatically. To revert to the
862 previous behaviour, say Y to this question.
863
864 If you suspect your hardware is at all flakey, say N here.
865 Do NOT email the IDE kernel people regarding this issue!
866
867config BLK_DEV_IDE_RAPIDE 840config BLK_DEV_IDE_RAPIDE
868 tristate "RapIDE interface support" 841 tristate "RapIDE interface support"
869 depends on ARM && ARCH_ACORN 842 depends on ARM && ARCH_ACORN
@@ -1086,9 +1059,6 @@ config IDEDMA_IVB
1086 1059
1087 It is normally safe to answer Y; however, the default is N. 1060 It is normally safe to answer Y; however, the default is N.
1088 1061
1089config IDEDMA_AUTO
1090 def_bool IDEDMA_PCI_AUTO || IDEDMA_ICS_AUTO
1091
1092endif 1062endif
1093 1063
1094config BLK_DEV_HD_ONLY 1064config BLK_DEV_HD_ONLY
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 28feedfbd21d..d9f029e8ff74 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -37,7 +37,6 @@ ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o
37# built-in only drivers from ppc/ 37# built-in only drivers from ppc/
38ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o 38ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o 39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
40ide-core-$(CONFIG_BLK_DEV_IDE_CELLEB) += ppc/scc_pata.o
41 40
42# built-in only drivers from h8300/ 41# built-in only drivers from h8300/
43ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o 42ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 40e5c66b81ce..e2953fc1fafb 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -196,11 +196,6 @@ static void icside_maskproc(ide_drive_t *drive, int mask)
196} 196}
197 197
198#ifdef CONFIG_BLK_DEV_IDEDMA_ICS 198#ifdef CONFIG_BLK_DEV_IDEDMA_ICS
199
200#ifndef CONFIG_IDEDMA_ICS_AUTO
201#warning CONFIG_IDEDMA_ICS_AUTO=n support is obsolete, and will be removed soon.
202#endif
203
204/* 199/*
205 * SG-DMA support. 200 * SG-DMA support.
206 * 201 *
@@ -474,12 +469,6 @@ static int icside_dma_lostirq(ide_drive_t *drive)
474 469
475static void icside_dma_init(ide_hwif_t *hwif) 470static void icside_dma_init(ide_hwif_t *hwif)
476{ 471{
477 int autodma = 0;
478
479#ifdef CONFIG_IDEDMA_ICS_AUTO
480 autodma = 1;
481#endif
482
483 printk(" %s: SG-DMA", hwif->name); 472 printk(" %s: SG-DMA", hwif->name);
484 473
485 hwif->atapi_dma = 1; 474 hwif->atapi_dma = 1;
@@ -489,7 +478,7 @@ static void icside_dma_init(ide_hwif_t *hwif)
489 hwif->dmatable_cpu = NULL; 478 hwif->dmatable_cpu = NULL;
490 hwif->dmatable_dma = 0; 479 hwif->dmatable_dma = 0;
491 hwif->speedproc = icside_set_speed; 480 hwif->speedproc = icside_set_speed;
492 hwif->autodma = autodma; 481 hwif->autodma = 1;
493 482
494 hwif->ide_dma_check = icside_dma_check; 483 hwif->ide_dma_check = icside_dma_check;
495 hwif->dma_host_off = icside_dma_host_off; 484 hwif->dma_host_off = icside_dma_host_off;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 45a928c058cf..638becda81c6 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -735,6 +735,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
735 cdrom_saw_media_change (drive); 735 cdrom_saw_media_change (drive);
736 /*printk("%s: media changed\n",drive->name);*/ 736 /*printk("%s: media changed\n",drive->name);*/
737 return 0; 737 return 0;
738 } else if ((sense_key == ILLEGAL_REQUEST) &&
739 (rq->cmd[0] == GPCMD_START_STOP_UNIT)) {
740 /*
741 * Don't print error message for this condition--
742 * SFF8090i indicates that 5/24/00 is the correct
743 * response to a request to close the tray if the
744 * drive doesn't have that capability.
745 * cdrom_log_sense() knows this!
746 */
738 } else if (!(rq->cmd_flags & REQ_QUIET)) { 747 } else if (!(rq->cmd_flags & REQ_QUIET)) {
739 /* Otherwise, print an error. */ 748 /* Otherwise, print an error. */
740 ide_dump_status(drive, "packet command error", stat); 749 ide_dump_status(drive, "packet command error", stat);
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 08e7cd043bcc..fd213088b06b 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -767,7 +767,7 @@ int ide_set_dma(ide_drive_t *drive)
767 switch(rc) { 767 switch(rc) {
768 case -1: /* DMA needs to be disabled */ 768 case -1: /* DMA needs to be disabled */
769 hwif->dma_off_quietly(drive); 769 hwif->dma_off_quietly(drive);
770 return 0; 770 return -1;
771 case 0: /* DMA needs to be enabled */ 771 case 0: /* DMA needs to be enabled */
772 return hwif->ide_dma_on(drive); 772 return hwif->ide_dma_on(drive);
773 case 1: /* DMA setting cannot be changed */ 773 case 1: /* DMA setting cannot be changed */
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c193553f6fe7..8670112f1d39 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
519 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) 519 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
520 try_to_flush_leftover_data(drive); 520 try_to_flush_leftover_data(drive);
521 521
522 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
523 ide_kill_rq(drive, rq);
524 return ide_stopped;
525 }
526
522 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) 527 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
523 /* force an abort */ 528 rq->errors |= ERROR_RESET;
524 hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
525 529
526 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) 530 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
527 ide_kill_rq(drive, rq);
528 else {
529 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
530 ++rq->errors;
531 return ide_do_reset(drive);
532 }
533 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
534 drive->special.b.recalibrate = 1;
535 ++rq->errors; 531 ++rq->errors;
532 return ide_do_reset(drive);
536 } 533 }
534
535 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
536 drive->special.b.recalibrate = 1;
537
538 ++rq->errors;
539
537 return ide_stopped; 540 return ide_stopped;
538} 541}
539 542
@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
1025 if (!drive->special.all) { 1028 if (!drive->special.all) {
1026 ide_driver_t *drv; 1029 ide_driver_t *drv;
1027 1030
1031 /*
1032 * We reset the drive so we need to issue a SETFEATURES.
1033 * Do it _after_ do_special() restored device parameters.
1034 */
1035 if (drive->current_speed == 0xff)
1036 ide_config_drive_speed(drive, drive->desired_speed);
1037
1028 if (rq->cmd_type == REQ_TYPE_ATA_CMD || 1038 if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
1029 rq->cmd_type == REQ_TYPE_ATA_TASK || 1039 rq->cmd_type == REQ_TYPE_ATA_TASK ||
1030 rq->cmd_type == REQ_TYPE_ATA_TASKFILE) 1040 rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
@@ -1216,6 +1226,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1216#endif 1226#endif
1217 /* so that ide_timer_expiry knows what to do */ 1227 /* so that ide_timer_expiry knows what to do */
1218 hwgroup->sleeping = 1; 1228 hwgroup->sleeping = 1;
1229 hwgroup->req_gen_timer = hwgroup->req_gen;
1219 mod_timer(&hwgroup->timer, sleep); 1230 mod_timer(&hwgroup->timer, sleep);
1220 /* we purposely leave hwgroup->busy==1 1231 /* we purposely leave hwgroup->busy==1
1221 * while sleeping */ 1232 * while sleeping */
@@ -1401,7 +1412,8 @@ void ide_timer_expiry (unsigned long data)
1401 1412
1402 spin_lock_irqsave(&ide_lock, flags); 1413 spin_lock_irqsave(&ide_lock, flags);
1403 1414
1404 if ((handler = hwgroup->handler) == NULL) { 1415 if (((handler = hwgroup->handler) == NULL) ||
1416 (hwgroup->req_gen != hwgroup->req_gen_timer)) {
1405 /* 1417 /*
1406 * Either a marginal timeout occurred 1418 * Either a marginal timeout occurred
1407 * (got the interrupt just as timer expired), 1419 * (got the interrupt just as timer expired),
@@ -1429,6 +1441,7 @@ void ide_timer_expiry (unsigned long data)
1429 if ((wait = expiry(drive)) > 0) { 1441 if ((wait = expiry(drive)) > 0) {
1430 /* reset timer */ 1442 /* reset timer */
1431 hwgroup->timer.expires = jiffies + wait; 1443 hwgroup->timer.expires = jiffies + wait;
1444 hwgroup->req_gen_timer = hwgroup->req_gen;
1432 add_timer(&hwgroup->timer); 1445 add_timer(&hwgroup->timer);
1433 spin_unlock_irqrestore(&ide_lock, flags); 1446 spin_unlock_irqrestore(&ide_lock, flags);
1434 return; 1447 return;
@@ -1643,6 +1656,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
1643 printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); 1656 printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name);
1644 } 1657 }
1645 hwgroup->handler = NULL; 1658 hwgroup->handler = NULL;
1659 hwgroup->req_gen++;
1646 del_timer(&hwgroup->timer); 1660 del_timer(&hwgroup->timer);
1647 spin_unlock(&ide_lock); 1661 spin_unlock(&ide_lock);
1648 1662
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index bd513f5a2323..3caa176b3155 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
583 if(!(drive->id->hw_config & 0x4000)) 583 if(!(drive->id->hw_config & 0x4000))
584 return 0; 584 return 0;
585#endif /* CONFIG_IDEDMA_IVB */ 585#endif /* CONFIG_IDEDMA_IVB */
586 if (!(drive->id->hw_config & 0x2000)) 586 /*
587 return 0; 587 * FIXME:
588 * - change master/slave IDENTIFY order
589 * - force bit13 (80c cable present) check
590 * (unless the slave device is pre-ATA3)
591 */
588 return 1; 592 return 1;
589} 593}
590 594
@@ -885,6 +889,7 @@ static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
885 hwgroup->handler = handler; 889 hwgroup->handler = handler;
886 hwgroup->expiry = expiry; 890 hwgroup->expiry = expiry;
887 hwgroup->timer.expires = jiffies + timeout; 891 hwgroup->timer.expires = jiffies + timeout;
892 hwgroup->req_gen_timer = hwgroup->req_gen;
888 add_timer(&hwgroup->timer); 893 add_timer(&hwgroup->timer);
889} 894}
890 895
@@ -925,6 +930,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha
925 hwgroup->handler = handler; 930 hwgroup->handler = handler;
926 hwgroup->expiry = expiry; 931 hwgroup->expiry = expiry;
927 hwgroup->timer.expires = jiffies + timeout; 932 hwgroup->timer.expires = jiffies + timeout;
933 hwgroup->req_gen_timer = hwgroup->req_gen;
928 add_timer(&hwgroup->timer); 934 add_timer(&hwgroup->timer);
929 hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); 935 hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG);
930 /* Drive takes 400nS to respond, we must avoid the IRQ being 936 /* Drive takes 400nS to respond, we must avoid the IRQ being
@@ -1090,6 +1096,9 @@ static void pre_reset(ide_drive_t *drive)
1090 if (HWIF(drive)->pre_reset != NULL) 1096 if (HWIF(drive)->pre_reset != NULL)
1091 HWIF(drive)->pre_reset(drive); 1097 HWIF(drive)->pre_reset(drive);
1092 1098
1099 if (drive->current_speed != 0xff)
1100 drive->desired_speed = drive->current_speed;
1101 drive->current_speed = 0xff;
1093} 1102}
1094 1103
1095/* 1104/*
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index dfbd74458522..ae5bf2be6f52 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -177,11 +177,7 @@ DECLARE_MUTEX(ide_cfg_sem);
177static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ 177static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
178#endif 178#endif
179 179
180#ifdef CONFIG_IDEDMA_AUTO
181int noautodma = 0; 180int noautodma = 0;
182#else
183int noautodma = 1;
184#endif
185 181
186EXPORT_SYMBOL(noautodma); 182EXPORT_SYMBOL(noautodma);
187 183
@@ -1128,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg)
1128static int set_using_dma (ide_drive_t *drive, int arg) 1124static int set_using_dma (ide_drive_t *drive, int arg)
1129{ 1125{
1130#ifdef CONFIG_BLK_DEV_IDEDMA 1126#ifdef CONFIG_BLK_DEV_IDEDMA
1127 ide_hwif_t *hwif = drive->hwif;
1128 int err = -EPERM;
1129
1131 if (!drive->id || !(drive->id->capability & 1)) 1130 if (!drive->id || !(drive->id->capability & 1))
1132 return -EPERM; 1131 goto out;
1133 if (HWIF(drive)->ide_dma_check == NULL) 1132
1134 return -EPERM; 1133 if (hwif->ide_dma_check == NULL)
1134 goto out;
1135
1136 err = -EBUSY;
1137 if (ide_spin_wait_hwgroup(drive))
1138 goto out;
1139 /*
1140 * set ->busy flag, unlock and let it ride
1141 */
1142 hwif->hwgroup->busy = 1;
1143 spin_unlock_irq(&ide_lock);
1144
1145 err = 0;
1146
1135 if (arg) { 1147 if (arg) {
1136 if (ide_set_dma(drive)) 1148 if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
1137 return -EIO; 1149 err = -EIO;
1138 if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
1139 } else 1150 } else
1140 ide_dma_off(drive); 1151 ide_dma_off(drive);
1141 return 0; 1152
1153 /*
1154 * lock, clear ->busy flag and unlock before leaving
1155 */
1156 spin_lock_irq(&ide_lock);
1157 hwif->hwgroup->busy = 0;
1158 spin_unlock_irq(&ide_lock);
1159out:
1160 return err;
1142#else 1161#else
1143 return -EPERM; 1162 return -EPERM;
1144#endif 1163#endif
@@ -1943,6 +1962,8 @@ static char *media_string(ide_drive_t *drive)
1943 return "tape"; 1962 return "tape";
1944 case ide_floppy: 1963 case ide_floppy:
1945 return "floppy"; 1964 return "floppy";
1965 case ide_optical:
1966 return "optical";
1946 default: 1967 default:
1947 return "UNKNOWN"; 1968 return "UNKNOWN";
1948 } 1969 }
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index b2dc028dc8ca..d54d9fe92a7d 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -639,6 +639,7 @@ static int au_ide_probe(struct device *dev)
639 _auide_hwif *ahwif = &auide_hwif; 639 _auide_hwif *ahwif = &auide_hwif;
640 ide_hwif_t *hwif; 640 ide_hwif_t *hwif;
641 struct resource *res; 641 struct resource *res;
642 hw_regs_t *hw;
642 int ret = 0; 643 int ret = 0;
643 644
644#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 645#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
@@ -681,7 +682,7 @@ static int au_ide_probe(struct device *dev)
681 /* FIXME: This might possibly break PCMCIA IDE devices */ 682 /* FIXME: This might possibly break PCMCIA IDE devices */
682 683
683 hwif = &ide_hwifs[pdev->id]; 684 hwif = &ide_hwifs[pdev->id];
684 hw_regs_t *hw = &hwif->hw; 685 hw = &hwif->hw;
685 hwif->irq = hw->irq = ahwif->irq; 686 hwif->irq = hw->irq = ahwif->irq;
686 hwif->chipset = ide_au1xxx; 687 hwif->chipset = ide_au1xxx;
687 688
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile
index 6591ff4753cb..95d1ea8f1f14 100644
--- a/drivers/ide/pci/Makefile
+++ b/drivers/ide/pci/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_BLK_DEV_AEC62XX) += aec62xx.o
3obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o 3obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o
4obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o 4obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o
5obj-$(CONFIG_BLK_DEV_ATIIXP) += atiixp.o 5obj-$(CONFIG_BLK_DEV_ATIIXP) += atiixp.o
6obj-$(CONFIG_BLK_DEV_CELLEB) += scc_pata.o
6obj-$(CONFIG_BLK_DEV_CMD64X) += cmd64x.o 7obj-$(CONFIG_BLK_DEV_CMD64X) += cmd64x.o
7obj-$(CONFIG_BLK_DEV_CS5520) += cs5520.o 8obj-$(CONFIG_BLK_DEV_CS5520) += cs5520.o
8obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o 9obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index b0d4825c56a9..561197f7b5bb 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,6 +1,6 @@
1/* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 1/* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16
2 * 2 *
3 * linux/drivers/ide/pci/cmd64x.c Version 1.41 Feb 3, 2007 3 * linux/drivers/ide/pci/cmd64x.c Version 1.42 Feb 8, 2007
4 * 4 *
5 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 5 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
6 * Note, this driver is not used at all on other systems because 6 * Note, this driver is not used at all on other systems because
@@ -189,6 +189,11 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count)
189 189
190#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ 190#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */
191 191
192static u8 quantize_timing(int timing, int quant)
193{
194 return (timing + quant - 1) / quant;
195}
196
192/* 197/*
193 * This routine writes the prepared setup/active/recovery counts 198 * This routine writes the prepared setup/active/recovery counts
194 * for a drive into the cmd646 chipset registers to active them. 199 * for a drive into the cmd646 chipset registers to active them.
@@ -268,47 +273,37 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ
268 */ 273 */
269static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) 274static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted)
270{ 275{
271 int setup_time, active_time, recovery_time; 276 int setup_time, active_time, cycle_time;
272 int clock_time, pio_mode, cycle_time; 277 u8 cycle_count, setup_count, active_count, recovery_count;
273 u8 recovery_count2, cycle_count; 278 u8 pio_mode;
274 int setup_count, active_count, recovery_count; 279 int clock_time = 1000 / system_bus_clock();
275 int bus_speed = system_bus_clock(); 280 ide_pio_data_t pio;
276 ide_pio_data_t d;
277 281
278 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &d); 282 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio);
279 cycle_time = d.cycle_time; 283 cycle_time = pio.cycle_time;
280 284
281 /*
282 * I copied all this complicated stuff from cmd640.c and made a few
283 * minor changes. For now I am just going to pray that it is correct.
284 */
285 setup_time = ide_pio_timings[pio_mode].setup_time; 285 setup_time = ide_pio_timings[pio_mode].setup_time;
286 active_time = ide_pio_timings[pio_mode].active_time; 286 active_time = ide_pio_timings[pio_mode].active_time;
287 recovery_time = cycle_time - (setup_time + active_time);
288 clock_time = 1000 / bus_speed;
289 cycle_count = (cycle_time + clock_time - 1) / clock_time;
290
291 setup_count = (setup_time + clock_time - 1) / clock_time;
292 287
293 active_count = (active_time + clock_time - 1) / clock_time; 288 setup_count = quantize_timing( setup_time, clock_time);
289 cycle_count = quantize_timing( cycle_time, clock_time);
290 active_count = quantize_timing(active_time, clock_time);
294 291
295 recovery_count = (recovery_time + clock_time - 1) / clock_time; 292 recovery_count = cycle_count - active_count;
296 recovery_count2 = cycle_count - (setup_count + active_count); 293 /* program_drive_counts() takes care of zero recovery cycles */
297 if (recovery_count2 > recovery_count)
298 recovery_count = recovery_count2;
299 if (recovery_count > 16) { 294 if (recovery_count > 16) {
300 active_count += recovery_count - 16; 295 active_count += recovery_count - 16;
301 recovery_count = 16; 296 recovery_count = 16;
302 } 297 }
303 if (active_count > 16) 298 if (active_count > 16)
304 active_count = 16; /* maximum allowed by cmd646 */ 299 active_count = 16; /* maximum allowed by cmd64x */
305 300
306 program_drive_counts (drive, setup_count, active_count, recovery_count); 301 program_drive_counts (drive, setup_count, active_count, recovery_count);
307 302
308 cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " 303 cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, "
309 "clocks=%d/%d/%d\n", 304 "clocks=%d/%d/%d\n",
310 drive->name, mode_wanted, pio_mode, cycle_time, 305 drive->name, mode_wanted, pio_mode, cycle_time,
311 d.overridden ? " (overriding vendor mode)" : "", 306 pio.overridden ? " (overriding vendor mode)" : "",
312 setup_count, active_count, recovery_count); 307 setup_count, active_count, recovery_count);
313 308
314 return pio_mode; 309 return pio_mode;
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 53f25500c22b..be4fc96c29e0 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -240,12 +240,31 @@ static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_devi
240 return 0; 240 return 0;
241} 241}
242 242
243/* If libata is configured, jmicron PCI quirk will configure it such
244 * that the SATA ports are in AHCI function while the PATA ports are
245 * in a separate IDE function. In such cases, match device class and
246 * attach only to IDE. If libata isn't configured, keep the old
247 * behavior for backward compatibility.
248 */
249#if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE)
250#define JMB_CLASS PCI_CLASS_STORAGE_IDE << 8
251#define JMB_CLASS_MASK 0xffff00
252#else
253#define JMB_CLASS 0
254#define JMB_CLASS_MASK 0
255#endif
256
243static struct pci_device_id jmicron_pci_tbl[] = { 257static struct pci_device_id jmicron_pci_tbl[] = {
244 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 258 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361,
245 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 259 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 0},
246 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 260 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363,
247 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 261 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 1},
248 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 262 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365,
263 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 2},
264 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366,
265 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 3},
266 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368,
267 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 4},
249 { 0, }, 268 { 0, },
250}; 269};
251 270
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 6ceb25bc5a7b..ace98929cc3d 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive)
255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); 255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
256 } 256 }
257 257
258 if (drive->media != ide_disk) 258 if (drive->media != ide_disk && drive->media != ide_cdrom)
259 return 0; 259 return 0;
260 260
261 if (id->capability & 4) { 261 if (id->capability & 4) {
@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
545 545
546 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 546 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
547 547
548 hwif->atapi_dma = 1;
548 hwif->ultra_mask = 0x7f; 549 hwif->ultra_mask = 0x7f;
549 hwif->mwdma_mask = 0x07; 550 hwif->mwdma_mask = 0x07;
550 551
diff --git a/drivers/ide/ppc/scc_pata.c b/drivers/ide/pci/scc_pata.c
index f84bf791f72e..f84bf791f72e 100644
--- a/drivers/ide/ppc/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index a52c80fe7d3e..118fb3205ca8 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -505,11 +505,6 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
505 } 505 }
506 } 506 }
507} 507}
508
509#ifndef CONFIG_IDEDMA_PCI_AUTO
510#warning CONFIG_IDEDMA_PCI_AUTO=n support is obsolete, and will be removed soon.
511#endif
512
513#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ 508#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
514 509
515/** 510/**
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index b8a47342cd2c..cd84a55ecf20 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -138,9 +138,9 @@ config IEEE1394_DV1394
138 tristate "OHCI-DV I/O support (deprecated)" 138 tristate "OHCI-DV I/O support (deprecated)"
139 depends on IEEE1394 && IEEE1394_OHCI1394 139 depends on IEEE1394 && IEEE1394_OHCI1394
140 help 140 help
141 The dv1394 driver will be removed from Linux in a future release. 141 The dv1394 driver is unsupported and may be removed from Linux in a
142 Its functionality is now provided by raw1394 together with libraries 142 future release. Its functionality is now provided by raw1394 together
143 such as libiec61883. 143 with libraries such as libiec61883.
144 144
145config IEEE1394_RAWIO 145config IEEE1394_RAWIO
146 tristate "Raw IEEE1394 I/O support" 146 tristate "Raw IEEE1394 I/O support"
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index dee9529aa8e7..026e38face5c 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -2564,8 +2564,8 @@ static int __init dv1394_init_module(void)
2564 int ret; 2564 int ret;
2565 2565
2566 printk(KERN_WARNING 2566 printk(KERN_WARNING
2567 "WARNING: The dv1394 driver is unsupported and will be removed " 2567 "NOTE: The dv1394 driver is unsupported and may be removed in a "
2568 "from Linux soon. Use raw1394 instead.\n"); 2568 "future Linux release. Use raw1394 instead.\n");
2569 2569
2570 cdev_init(&dv1394_cdev, &dv1394_fops); 2570 cdev_init(&dv1394_cdev, &dv1394_fops);
2571 dv1394_cdev.owner = THIS_MODULE; 2571 dv1394_cdev.owner = THIS_MODULE;
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index a95313521985..03e44b337eb0 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -584,7 +584,10 @@ static void ether1394_add_host (struct hpsb_host *host)
584 } 584 }
585 585
586 SET_MODULE_OWNER(dev); 586 SET_MODULE_OWNER(dev);
587#if 0
588 /* FIXME - Is this the correct parent device anyway? */
587 SET_NETDEV_DEV(dev, &host->device); 589 SET_NETDEV_DEV(dev, &host->device);
590#endif
588 591
589 priv = netdev_priv(dev); 592 priv = netdev_priv(dev);
590 593
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d441815a3e0c..fde92ce45153 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1821,7 +1821,7 @@ static int cma_alloc_port(struct idr *ps, struct rdma_id_private *id_priv,
1821 struct rdma_bind_list *bind_list; 1821 struct rdma_bind_list *bind_list;
1822 int port, ret; 1822 int port, ret;
1823 1823
1824 bind_list = kmalloc(sizeof *bind_list, GFP_KERNEL); 1824 bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL);
1825 if (!bind_list) 1825 if (!bind_list)
1826 return -ENOMEM; 1826 return -ENOMEM;
1827 1827
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index b516b93b8550..c859134c1daa 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -266,7 +266,7 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id,
266 mutex_lock(&ctx->file->mut); 266 mutex_lock(&ctx->file->mut);
267 if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { 267 if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) {
268 if (!ctx->backlog) { 268 if (!ctx->backlog) {
269 ret = -EDQUOT; 269 ret = -ENOMEM;
270 kfree(uevent); 270 kfree(uevent);
271 goto out; 271 goto out;
272 } 272 }
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index d737c738d876..f5e9aeec6f6e 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -36,6 +36,7 @@
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/dma-mapping.h>
39 40
40#include "cxio_resource.h" 41#include "cxio_resource.h"
41#include "cxio_hal.h" 42#include "cxio_hal.h"
@@ -497,9 +498,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
497 u64 sge_cmd, ctx0, ctx1; 498 u64 sge_cmd, ctx0, ctx1;
498 u64 base_addr; 499 u64 base_addr;
499 struct t3_modify_qp_wr *wqe; 500 struct t3_modify_qp_wr *wqe;
500 struct sk_buff *skb = alloc_skb(sizeof(*wqe), GFP_KERNEL); 501 struct sk_buff *skb;
501
502 502
503 skb = alloc_skb(sizeof(*wqe), GFP_KERNEL);
503 if (!skb) { 504 if (!skb) {
504 PDBG("%s alloc_skb failed\n", __FUNCTION__); 505 PDBG("%s alloc_skb failed\n", __FUNCTION__);
505 return -ENOMEM; 506 return -ENOMEM;
@@ -507,7 +508,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
507 err = cxio_hal_init_ctrl_cq(rdev_p); 508 err = cxio_hal_init_ctrl_cq(rdev_p);
508 if (err) { 509 if (err) {
509 PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err); 510 PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err);
510 return err; 511 goto err;
511 } 512 }
512 rdev_p->ctrl_qp.workq = dma_alloc_coherent( 513 rdev_p->ctrl_qp.workq = dma_alloc_coherent(
513 &(rdev_p->rnic_info.pdev->dev), 514 &(rdev_p->rnic_info.pdev->dev),
@@ -517,7 +518,8 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
517 GFP_KERNEL); 518 GFP_KERNEL);
518 if (!rdev_p->ctrl_qp.workq) { 519 if (!rdev_p->ctrl_qp.workq) {
519 PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__); 520 PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__);
520 return -ENOMEM; 521 err = -ENOMEM;
522 goto err;
521 } 523 }
522 pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping, 524 pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping,
523 rdev_p->ctrl_qp.dma_addr); 525 rdev_p->ctrl_qp.dma_addr);
@@ -555,6 +557,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
555 rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); 557 rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2);
556 skb->priority = CPL_PRIORITY_CONTROL; 558 skb->priority = CPL_PRIORITY_CONTROL;
557 return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); 559 return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb));
560err:
561 kfree_skb(skb);
562 return err;
558} 563}
559 564
560static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) 565static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index b21fde8b659d..d0ed1d35ca3e 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -305,8 +305,7 @@ static int status2errno(int status)
305 */ 305 */
306static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) 306static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)
307{ 307{
308 if (skb) { 308 if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) {
309 BUG_ON(skb_cloned(skb));
310 skb_trim(skb, 0); 309 skb_trim(skb, 0);
311 skb_get(skb); 310 skb_get(skb);
312 } else { 311 } else {
@@ -1415,6 +1414,7 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1415 wake_up(&ep->com.waitq); 1414 wake_up(&ep->com.waitq);
1416 break; 1415 break;
1417 case FPDU_MODE: 1416 case FPDU_MODE:
1417 start_ep_timer(ep);
1418 __state_set(&ep->com, CLOSING); 1418 __state_set(&ep->com, CLOSING);
1419 attrs.next_state = IWCH_QP_STATE_CLOSING; 1419 attrs.next_state = IWCH_QP_STATE_CLOSING;
1420 iwch_modify_qp(ep->com.qp->rhp, ep->com.qp, 1420 iwch_modify_qp(ep->com.qp->rhp, ep->com.qp,
@@ -1425,7 +1425,6 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1425 disconnect = 0; 1425 disconnect = 0;
1426 break; 1426 break;
1427 case CLOSING: 1427 case CLOSING:
1428 start_ep_timer(ep);
1429 __state_set(&ep->com, MORIBUND); 1428 __state_set(&ep->com, MORIBUND);
1430 disconnect = 0; 1429 disconnect = 0;
1431 break; 1430 break;
@@ -1487,8 +1486,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1487 case CONNECTING: 1486 case CONNECTING:
1488 break; 1487 break;
1489 case MPA_REQ_WAIT: 1488 case MPA_REQ_WAIT:
1489 stop_ep_timer(ep);
1490 break; 1490 break;
1491 case MPA_REQ_SENT: 1491 case MPA_REQ_SENT:
1492 stop_ep_timer(ep);
1492 connect_reply_upcall(ep, -ECONNRESET); 1493 connect_reply_upcall(ep, -ECONNRESET);
1493 break; 1494 break;
1494 case MPA_REP_SENT: 1495 case MPA_REP_SENT:
@@ -1507,9 +1508,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1507 get_ep(&ep->com); 1508 get_ep(&ep->com);
1508 break; 1509 break;
1509 case MORIBUND: 1510 case MORIBUND:
1511 case CLOSING:
1510 stop_ep_timer(ep); 1512 stop_ep_timer(ep);
1513 /*FALLTHROUGH*/
1511 case FPDU_MODE: 1514 case FPDU_MODE:
1512 case CLOSING:
1513 if (ep->com.cm_id && ep->com.qp) { 1515 if (ep->com.cm_id && ep->com.qp) {
1514 attrs.next_state = IWCH_QP_STATE_ERROR; 1516 attrs.next_state = IWCH_QP_STATE_ERROR;
1515 ret = iwch_modify_qp(ep->com.qp->rhp, 1517 ret = iwch_modify_qp(ep->com.qp->rhp,
@@ -1570,7 +1572,6 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1570 spin_lock_irqsave(&ep->com.lock, flags); 1572 spin_lock_irqsave(&ep->com.lock, flags);
1571 switch (ep->com.state) { 1573 switch (ep->com.state) {
1572 case CLOSING: 1574 case CLOSING:
1573 start_ep_timer(ep);
1574 __state_set(&ep->com, MORIBUND); 1575 __state_set(&ep->com, MORIBUND);
1575 break; 1576 break;
1576 case MORIBUND: 1577 case MORIBUND:
@@ -1586,6 +1587,8 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1586 __state_set(&ep->com, DEAD); 1587 __state_set(&ep->com, DEAD);
1587 release = 1; 1588 release = 1;
1588 break; 1589 break;
1590 case ABORTING:
1591 break;
1589 case DEAD: 1592 case DEAD:
1590 default: 1593 default:
1591 BUG_ON(1); 1594 BUG_ON(1);
@@ -1659,6 +1662,7 @@ static void ep_timeout(unsigned long arg)
1659 break; 1662 break;
1660 case MPA_REQ_WAIT: 1663 case MPA_REQ_WAIT:
1661 break; 1664 break;
1665 case CLOSING:
1662 case MORIBUND: 1666 case MORIBUND:
1663 if (ep->com.cm_id && ep->com.qp) { 1667 if (ep->com.cm_id && ep->com.qp) {
1664 attrs.next_state = IWCH_QP_STATE_ERROR; 1668 attrs.next_state = IWCH_QP_STATE_ERROR;
@@ -1687,12 +1691,11 @@ int iwch_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
1687 return -ECONNRESET; 1691 return -ECONNRESET;
1688 } 1692 }
1689 BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); 1693 BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD);
1690 state_set(&ep->com, CLOSING);
1691 if (mpa_rev == 0) 1694 if (mpa_rev == 0)
1692 abort_connection(ep, NULL, GFP_KERNEL); 1695 abort_connection(ep, NULL, GFP_KERNEL);
1693 else { 1696 else {
1694 err = send_mpa_reject(ep, pdata, pdata_len); 1697 err = send_mpa_reject(ep, pdata, pdata_len);
1695 err = send_halfclose(ep, GFP_KERNEL); 1698 err = iwch_ep_disconnect(ep, 0, GFP_KERNEL);
1696 } 1699 }
1697 return 0; 1700 return 0;
1698} 1701}
@@ -1957,11 +1960,11 @@ int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp)
1957 case MPA_REQ_RCVD: 1960 case MPA_REQ_RCVD:
1958 case MPA_REP_SENT: 1961 case MPA_REP_SENT:
1959 case FPDU_MODE: 1962 case FPDU_MODE:
1963 start_ep_timer(ep);
1960 ep->com.state = CLOSING; 1964 ep->com.state = CLOSING;
1961 close = 1; 1965 close = 1;
1962 break; 1966 break;
1963 case CLOSING: 1967 case CLOSING:
1964 start_ep_timer(ep);
1965 ep->com.state = MORIBUND; 1968 ep->com.state = MORIBUND;
1966 close = 1; 1969 close = 1;
1967 break; 1970 break;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_ev.c b/drivers/infiniband/hw/cxgb3/iwch_ev.c
index 54362afbf72f..b40676662a8a 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_ev.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_ev.c
@@ -47,12 +47,6 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp,
47 struct iwch_qp_attributes attrs; 47 struct iwch_qp_attributes attrs;
48 struct iwch_qp *qhp; 48 struct iwch_qp *qhp;
49 49
50 printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x "
51 "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__,
52 CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe),
53 CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe),
54 CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe));
55
56 spin_lock(&rnicp->lock); 50 spin_lock(&rnicp->lock);
57 qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); 51 qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe));
58 52
@@ -73,6 +67,12 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp,
73 return; 67 return;
74 } 68 }
75 69
70 printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x "
71 "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__,
72 CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe),
73 CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe),
74 CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe));
75
76 atomic_inc(&qhp->refcnt); 76 atomic_inc(&qhp->refcnt);
77 spin_unlock(&rnicp->lock); 77 spin_unlock(&rnicp->lock);
78 78
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 9947a144a929..24e0df04f7db 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -331,6 +331,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
331 int ret = 0; 331 int ret = 0;
332 struct iwch_mm_entry *mm; 332 struct iwch_mm_entry *mm;
333 struct iwch_ucontext *ucontext; 333 struct iwch_ucontext *ucontext;
334 u64 addr;
334 335
335 PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, 336 PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff,
336 key, len); 337 key, len);
@@ -345,10 +346,11 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
345 mm = remove_mmap(ucontext, key, len); 346 mm = remove_mmap(ucontext, key, len);
346 if (!mm) 347 if (!mm)
347 return -EINVAL; 348 return -EINVAL;
349 addr = mm->addr;
348 kfree(mm); 350 kfree(mm);
349 351
350 if ((mm->addr >= rdev_p->rnic_info.udbell_physbase) && 352 if ((addr >= rdev_p->rnic_info.udbell_physbase) &&
351 (mm->addr < (rdev_p->rnic_info.udbell_physbase + 353 (addr < (rdev_p->rnic_info.udbell_physbase +
352 rdev_p->rnic_info.udbell_len))) { 354 rdev_p->rnic_info.udbell_len))) {
353 355
354 /* 356 /*
@@ -362,7 +364,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
362 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; 364 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND;
363 vma->vm_flags &= ~VM_MAYREAD; 365 vma->vm_flags &= ~VM_MAYREAD;
364 ret = io_remap_pfn_range(vma, vma->vm_start, 366 ret = io_remap_pfn_range(vma, vma->vm_start,
365 mm->addr >> PAGE_SHIFT, 367 addr >> PAGE_SHIFT,
366 len, vma->vm_page_prot); 368 len, vma->vm_page_prot);
367 } else { 369 } else {
368 370
@@ -370,7 +372,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
370 * Map WQ or CQ contig dma memory... 372 * Map WQ or CQ contig dma memory...
371 */ 373 */
372 ret = remap_pfn_range(vma, vma->vm_start, 374 ret = remap_pfn_range(vma, vma->vm_start,
373 mm->addr >> PAGE_SHIFT, 375 addr >> PAGE_SHIFT,
374 len, vma->vm_page_prot); 376 len, vma->vm_page_prot);
375 } 377 }
376 378
@@ -463,9 +465,6 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd,
463 php = to_iwch_pd(pd); 465 php = to_iwch_pd(pd);
464 rhp = php->rhp; 466 rhp = php->rhp;
465 467
466 acc = iwch_convert_access(acc);
467
468
469 mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); 468 mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
470 if (!mhp) 469 if (!mhp)
471 return ERR_PTR(-ENOMEM); 470 return ERR_PTR(-ENOMEM);
@@ -491,12 +490,7 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd,
491 mhp->attr.pdid = php->pdid; 490 mhp->attr.pdid = php->pdid;
492 mhp->attr.zbva = 0; 491 mhp->attr.zbva = 0;
493 492
494 /* NOTE: TPT perms are backwards from BIND WR perms! */ 493 mhp->attr.perms = iwch_ib_to_tpt_access(acc);
495 mhp->attr.perms = (acc & 0x1) << 3;
496 mhp->attr.perms |= (acc & 0x2) << 1;
497 mhp->attr.perms |= (acc & 0x4) >> 1;
498 mhp->attr.perms |= (acc & 0x8) >> 3;
499
500 mhp->attr.va_fbo = *iova_start; 494 mhp->attr.va_fbo = *iova_start;
501 mhp->attr.page_size = shift - 12; 495 mhp->attr.page_size = shift - 12;
502 496
@@ -525,7 +519,6 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
525 struct iwch_mr mh, *mhp; 519 struct iwch_mr mh, *mhp;
526 struct iwch_pd *php; 520 struct iwch_pd *php;
527 struct iwch_dev *rhp; 521 struct iwch_dev *rhp;
528 int new_acc;
529 __be64 *page_list = NULL; 522 __be64 *page_list = NULL;
530 int shift = 0; 523 int shift = 0;
531 u64 total_size; 524 u64 total_size;
@@ -546,19 +539,20 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
546 if (rhp != php->rhp) 539 if (rhp != php->rhp)
547 return -EINVAL; 540 return -EINVAL;
548 541
549 new_acc = mhp->attr.perms;
550
551 memcpy(&mh, mhp, sizeof *mhp); 542 memcpy(&mh, mhp, sizeof *mhp);
552 543
553 if (mr_rereg_mask & IB_MR_REREG_PD) 544 if (mr_rereg_mask & IB_MR_REREG_PD)
554 php = to_iwch_pd(pd); 545 php = to_iwch_pd(pd);
555 if (mr_rereg_mask & IB_MR_REREG_ACCESS) 546 if (mr_rereg_mask & IB_MR_REREG_ACCESS)
556 mh.attr.perms = iwch_convert_access(acc); 547 mh.attr.perms = iwch_ib_to_tpt_access(acc);
557 if (mr_rereg_mask & IB_MR_REREG_TRANS) 548 if (mr_rereg_mask & IB_MR_REREG_TRANS) {
558 ret = build_phys_page_list(buffer_list, num_phys_buf, 549 ret = build_phys_page_list(buffer_list, num_phys_buf,
559 iova_start, 550 iova_start,
560 &total_size, &npages, 551 &total_size, &npages,
561 &shift, &page_list); 552 &shift, &page_list);
553 if (ret)
554 return ret;
555 }
562 556
563 ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages); 557 ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages);
564 kfree(page_list); 558 kfree(page_list);
@@ -568,7 +562,7 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
568 if (mr_rereg_mask & IB_MR_REREG_PD) 562 if (mr_rereg_mask & IB_MR_REREG_PD)
569 mhp->attr.pdid = php->pdid; 563 mhp->attr.pdid = php->pdid;
570 if (mr_rereg_mask & IB_MR_REREG_ACCESS) 564 if (mr_rereg_mask & IB_MR_REREG_ACCESS)
571 mhp->attr.perms = acc; 565 mhp->attr.perms = iwch_ib_to_tpt_access(acc);
572 if (mr_rereg_mask & IB_MR_REREG_TRANS) { 566 if (mr_rereg_mask & IB_MR_REREG_TRANS) {
573 mhp->attr.zbva = 0; 567 mhp->attr.zbva = 0;
574 mhp->attr.va_fbo = *iova_start; 568 mhp->attr.va_fbo = *iova_start;
@@ -613,8 +607,6 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
613 goto err; 607 goto err;
614 } 608 }
615 609
616 acc = iwch_convert_access(acc);
617
618 i = n = 0; 610 i = n = 0;
619 611
620 list_for_each_entry(chunk, &region->chunk_list, list) 612 list_for_each_entry(chunk, &region->chunk_list, list)
@@ -630,10 +622,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
630 mhp->rhp = rhp; 622 mhp->rhp = rhp;
631 mhp->attr.pdid = php->pdid; 623 mhp->attr.pdid = php->pdid;
632 mhp->attr.zbva = 0; 624 mhp->attr.zbva = 0;
633 mhp->attr.perms = (acc & 0x1) << 3; 625 mhp->attr.perms = iwch_ib_to_tpt_access(acc);
634 mhp->attr.perms |= (acc & 0x2) << 1;
635 mhp->attr.perms |= (acc & 0x4) >> 1;
636 mhp->attr.perms |= (acc & 0x8) >> 3;
637 mhp->attr.va_fbo = region->virt_base; 626 mhp->attr.va_fbo = region->virt_base;
638 mhp->attr.page_size = shift - 12; 627 mhp->attr.page_size = shift - 12;
639 mhp->attr.len = (u32) region->length; 628 mhp->attr.len = (u32) region->length;
@@ -736,10 +725,8 @@ static int iwch_destroy_qp(struct ib_qp *ib_qp)
736 qhp = to_iwch_qp(ib_qp); 725 qhp = to_iwch_qp(ib_qp);
737 rhp = qhp->rhp; 726 rhp = qhp->rhp;
738 727
739 if (qhp->attr.state == IWCH_QP_STATE_RTS) { 728 attrs.next_state = IWCH_QP_STATE_ERROR;
740 attrs.next_state = IWCH_QP_STATE_ERROR; 729 iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0);
741 iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0);
742 }
743 wait_event(qhp->wait, !qhp->ep); 730 wait_event(qhp->wait, !qhp->ep);
744 731
745 remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid); 732 remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h
index de0fe1b93a0c..93bcc56756bd 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h
@@ -286,27 +286,20 @@ static inline int iwch_convert_state(enum ib_qp_state ib_state)
286 } 286 }
287} 287}
288 288
289enum iwch_mem_perms { 289static inline u32 iwch_ib_to_tpt_access(int acc)
290 IWCH_MEM_ACCESS_LOCAL_READ = 1 << 0,
291 IWCH_MEM_ACCESS_LOCAL_WRITE = 1 << 1,
292 IWCH_MEM_ACCESS_REMOTE_READ = 1 << 2,
293 IWCH_MEM_ACCESS_REMOTE_WRITE = 1 << 3,
294 IWCH_MEM_ACCESS_ATOMICS = 1 << 4,
295 IWCH_MEM_ACCESS_BINDING = 1 << 5,
296 IWCH_MEM_ACCESS_LOCAL =
297 (IWCH_MEM_ACCESS_LOCAL_READ | IWCH_MEM_ACCESS_LOCAL_WRITE),
298 IWCH_MEM_ACCESS_REMOTE =
299 (IWCH_MEM_ACCESS_REMOTE_WRITE | IWCH_MEM_ACCESS_REMOTE_READ)
300 /* cannot go beyond 1 << 31 */
301} __attribute__ ((packed));
302
303static inline u32 iwch_convert_access(int acc)
304{ 290{
305 return (acc & IB_ACCESS_REMOTE_WRITE ? IWCH_MEM_ACCESS_REMOTE_WRITE : 0) 291 return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) |
306 | (acc & IB_ACCESS_REMOTE_READ ? IWCH_MEM_ACCESS_REMOTE_READ : 0) | 292 (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) |
307 (acc & IB_ACCESS_LOCAL_WRITE ? IWCH_MEM_ACCESS_LOCAL_WRITE : 0) | 293 (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) |
308 (acc & IB_ACCESS_MW_BIND ? IWCH_MEM_ACCESS_BINDING : 0) | 294 TPT_LOCAL_READ;
309 IWCH_MEM_ACCESS_LOCAL_READ; 295}
296
297static inline u32 iwch_ib_to_mwbind_access(int acc)
298{
299 return (acc & IB_ACCESS_REMOTE_WRITE ? T3_MEM_ACCESS_REM_WRITE : 0) |
300 (acc & IB_ACCESS_REMOTE_READ ? T3_MEM_ACCESS_REM_READ : 0) |
301 (acc & IB_ACCESS_LOCAL_WRITE ? T3_MEM_ACCESS_LOCAL_WRITE : 0) |
302 T3_MEM_ACCESS_LOCAL_READ;
310} 303}
311 304
312enum iwch_mmid_state { 305enum iwch_mmid_state {
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c
index 9ea00cc4a5f8..0a472c9b44db 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_qp.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
@@ -439,7 +439,7 @@ int iwch_bind_mw(struct ib_qp *qp,
439 wqe->bind.type = T3_VA_BASED_TO; 439 wqe->bind.type = T3_VA_BASED_TO;
440 440
441 /* TBD: check perms */ 441 /* TBD: check perms */
442 wqe->bind.perms = iwch_convert_access(mw_bind->mw_access_flags); 442 wqe->bind.perms = iwch_ib_to_mwbind_access(mw_bind->mw_access_flags);
443 wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); 443 wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey);
444 wqe->bind.mw_stag = cpu_to_be32(mw->rkey); 444 wqe->bind.mw_stag = cpu_to_be32(mw->rkey);
445 wqe->bind.mw_len = cpu_to_be32(mw_bind->length); 445 wqe->bind.mw_len = cpu_to_be32(mw_bind->length);
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 40404c9e2817..82ded44c6cee 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -52,6 +52,8 @@ struct ehca_mw;
52struct ehca_pd; 52struct ehca_pd;
53struct ehca_av; 53struct ehca_av;
54 54
55#include <linux/wait.h>
56
55#include <rdma/ib_verbs.h> 57#include <rdma/ib_verbs.h>
56#include <rdma/ib_user_verbs.h> 58#include <rdma/ib_user_verbs.h>
57 59
@@ -153,7 +155,9 @@ struct ehca_cq {
153 spinlock_t cb_lock; 155 spinlock_t cb_lock;
154 struct hlist_head qp_hashtab[QP_HASHTAB_LEN]; 156 struct hlist_head qp_hashtab[QP_HASHTAB_LEN];
155 struct list_head entry; 157 struct list_head entry;
156 u32 nr_callbacks; 158 u32 nr_callbacks; /* #events assigned to cpu by scaling code */
159 u32 nr_events; /* #events seen */
160 wait_queue_head_t wait_completion;
157 spinlock_t task_lock; 161 spinlock_t task_lock;
158 u32 ownpid; 162 u32 ownpid;
159 /* mmap counter for resources mapped into user space */ 163 /* mmap counter for resources mapped into user space */
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index 6ebfa27e4e16..e2cdc1a16fe9 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -146,6 +146,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe,
146 spin_lock_init(&my_cq->spinlock); 146 spin_lock_init(&my_cq->spinlock);
147 spin_lock_init(&my_cq->cb_lock); 147 spin_lock_init(&my_cq->cb_lock);
148 spin_lock_init(&my_cq->task_lock); 148 spin_lock_init(&my_cq->task_lock);
149 init_waitqueue_head(&my_cq->wait_completion);
149 my_cq->ownpid = current->tgid; 150 my_cq->ownpid = current->tgid;
150 151
151 cq = &my_cq->ib_cq; 152 cq = &my_cq->ib_cq;
@@ -302,6 +303,16 @@ create_cq_exit1:
302 return cq; 303 return cq;
303} 304}
304 305
306static int get_cq_nr_events(struct ehca_cq *my_cq)
307{
308 int ret;
309 unsigned long flags;
310 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
311 ret = my_cq->nr_events;
312 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
313 return ret;
314}
315
305int ehca_destroy_cq(struct ib_cq *cq) 316int ehca_destroy_cq(struct ib_cq *cq)
306{ 317{
307 u64 h_ret; 318 u64 h_ret;
@@ -329,10 +340,11 @@ int ehca_destroy_cq(struct ib_cq *cq)
329 } 340 }
330 341
331 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 342 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
332 while (my_cq->nr_callbacks) { 343 while (my_cq->nr_events) {
333 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 344 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
334 yield(); 345 wait_event(my_cq->wait_completion, !get_cq_nr_events(my_cq));
335 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 346 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
347 /* recheck nr_events to assure no cqe has just arrived */
336 } 348 }
337 349
338 idr_remove(&ehca_cq_idr, my_cq->token); 350 idr_remove(&ehca_cq_idr, my_cq->token);
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index 3ec53c687d08..f284be1c9166 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -66,7 +66,9 @@
66static void queue_comp_task(struct ehca_cq *__cq); 66static void queue_comp_task(struct ehca_cq *__cq);
67 67
68static struct ehca_comp_pool* pool; 68static struct ehca_comp_pool* pool;
69#ifdef CONFIG_HOTPLUG_CPU
69static struct notifier_block comp_pool_callback_nb; 70static struct notifier_block comp_pool_callback_nb;
71#endif
70 72
71static inline void comp_event_callback(struct ehca_cq *cq) 73static inline void comp_event_callback(struct ehca_cq *cq)
72{ 74{
@@ -404,10 +406,11 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
404 u32 token; 406 u32 token;
405 unsigned long flags; 407 unsigned long flags;
406 struct ehca_cq *cq; 408 struct ehca_cq *cq;
409
407 eqe_value = eqe->entry; 410 eqe_value = eqe->entry;
408 ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value); 411 ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value);
409 if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) { 412 if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) {
410 ehca_dbg(&shca->ib_device, "... completion event"); 413 ehca_dbg(&shca->ib_device, "Got completion event");
411 token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value); 414 token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value);
412 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 415 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
413 cq = idr_find(&ehca_cq_idr, token); 416 cq = idr_find(&ehca_cq_idr, token);
@@ -419,16 +422,20 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
419 return; 422 return;
420 } 423 }
421 reset_eq_pending(cq); 424 reset_eq_pending(cq);
422 if (ehca_scaling_code) { 425 cq->nr_events++;
426 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
427 if (ehca_scaling_code)
423 queue_comp_task(cq); 428 queue_comp_task(cq);
424 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 429 else {
425 } else {
426 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
427 comp_event_callback(cq); 430 comp_event_callback(cq);
431 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
432 cq->nr_events--;
433 if (!cq->nr_events)
434 wake_up(&cq->wait_completion);
435 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
428 } 436 }
429 } else { 437 } else {
430 ehca_dbg(&shca->ib_device, 438 ehca_dbg(&shca->ib_device, "Got non completion event");
431 "Got non completion event");
432 parse_identifier(shca, eqe_value); 439 parse_identifier(shca, eqe_value);
433 } 440 }
434} 441}
@@ -478,6 +485,7 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
478 "token=%x", token); 485 "token=%x", token);
479 continue; 486 continue;
480 } 487 }
488 eqe_cache[eqe_cnt].cq->nr_events++;
481 spin_unlock(&ehca_cq_idr_lock); 489 spin_unlock(&ehca_cq_idr_lock);
482 } else 490 } else
483 eqe_cache[eqe_cnt].cq = NULL; 491 eqe_cache[eqe_cnt].cq = NULL;
@@ -504,12 +512,18 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
504 /* call completion handler for cached eqes */ 512 /* call completion handler for cached eqes */
505 for (i = 0; i < eqe_cnt; i++) 513 for (i = 0; i < eqe_cnt; i++)
506 if (eq->eqe_cache[i].cq) { 514 if (eq->eqe_cache[i].cq) {
507 if (ehca_scaling_code) { 515 if (ehca_scaling_code)
508 spin_lock(&ehca_cq_idr_lock);
509 queue_comp_task(eq->eqe_cache[i].cq); 516 queue_comp_task(eq->eqe_cache[i].cq);
510 spin_unlock(&ehca_cq_idr_lock); 517 else {
511 } else 518 struct ehca_cq *cq = eq->eqe_cache[i].cq;
512 comp_event_callback(eq->eqe_cache[i].cq); 519 comp_event_callback(cq);
520 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
521 cq->nr_events--;
522 if (!cq->nr_events)
523 wake_up(&cq->wait_completion);
524 spin_unlock_irqrestore(&ehca_cq_idr_lock,
525 flags);
526 }
513 } else { 527 } else {
514 ehca_dbg(&shca->ib_device, "Got non completion event"); 528 ehca_dbg(&shca->ib_device, "Got non completion event");
515 parse_identifier(shca, eq->eqe_cache[i].eqe->entry); 529 parse_identifier(shca, eq->eqe_cache[i].eqe->entry);
@@ -523,7 +537,6 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
523 if (!eqe) 537 if (!eqe)
524 break; 538 break;
525 process_eqe(shca, eqe); 539 process_eqe(shca, eqe);
526 eqe_cnt++;
527 } while (1); 540 } while (1);
528 541
529unlock_irq_spinlock: 542unlock_irq_spinlock:
@@ -567,8 +580,7 @@ static void __queue_comp_task(struct ehca_cq *__cq,
567 list_add_tail(&__cq->entry, &cct->cq_list); 580 list_add_tail(&__cq->entry, &cct->cq_list);
568 cct->cq_jobs++; 581 cct->cq_jobs++;
569 wake_up(&cct->wait_queue); 582 wake_up(&cct->wait_queue);
570 } 583 } else
571 else
572 __cq->nr_callbacks++; 584 __cq->nr_callbacks++;
573 585
574 spin_unlock(&__cq->task_lock); 586 spin_unlock(&__cq->task_lock);
@@ -577,18 +589,21 @@ static void __queue_comp_task(struct ehca_cq *__cq,
577 589
578static void queue_comp_task(struct ehca_cq *__cq) 590static void queue_comp_task(struct ehca_cq *__cq)
579{ 591{
580 int cpu;
581 int cpu_id; 592 int cpu_id;
582 struct ehca_cpu_comp_task *cct; 593 struct ehca_cpu_comp_task *cct;
594 int cq_jobs;
595 unsigned long flags;
583 596
584 cpu = get_cpu();
585 cpu_id = find_next_online_cpu(pool); 597 cpu_id = find_next_online_cpu(pool);
586 BUG_ON(!cpu_online(cpu_id)); 598 BUG_ON(!cpu_online(cpu_id));
587 599
588 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); 600 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id);
589 BUG_ON(!cct); 601 BUG_ON(!cct);
590 602
591 if (cct->cq_jobs > 0) { 603 spin_lock_irqsave(&cct->task_lock, flags);
604 cq_jobs = cct->cq_jobs;
605 spin_unlock_irqrestore(&cct->task_lock, flags);
606 if (cq_jobs > 0) {
592 cpu_id = find_next_online_cpu(pool); 607 cpu_id = find_next_online_cpu(pool);
593 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); 608 cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id);
594 BUG_ON(!cct); 609 BUG_ON(!cct);
@@ -608,11 +623,17 @@ static void run_comp_task(struct ehca_cpu_comp_task* cct)
608 cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); 623 cq = list_entry(cct->cq_list.next, struct ehca_cq, entry);
609 spin_unlock_irqrestore(&cct->task_lock, flags); 624 spin_unlock_irqrestore(&cct->task_lock, flags);
610 comp_event_callback(cq); 625 comp_event_callback(cq);
611 spin_lock_irqsave(&cct->task_lock, flags);
612 626
627 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
628 cq->nr_events--;
629 if (!cq->nr_events)
630 wake_up(&cq->wait_completion);
631 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
632
633 spin_lock_irqsave(&cct->task_lock, flags);
613 spin_lock(&cq->task_lock); 634 spin_lock(&cq->task_lock);
614 cq->nr_callbacks--; 635 cq->nr_callbacks--;
615 if (cq->nr_callbacks == 0) { 636 if (!cq->nr_callbacks) {
616 list_del_init(cct->cq_list.next); 637 list_del_init(cct->cq_list.next);
617 cct->cq_jobs--; 638 cct->cq_jobs--;
618 } 639 }
@@ -714,6 +735,7 @@ static void take_over_work(struct ehca_comp_pool *pool,
714 735
715} 736}
716 737
738#ifdef CONFIG_HOTPLUG_CPU
717static int comp_pool_callback(struct notifier_block *nfb, 739static int comp_pool_callback(struct notifier_block *nfb,
718 unsigned long action, 740 unsigned long action,
719 void *hcpu) 741 void *hcpu)
@@ -756,6 +778,7 @@ static int comp_pool_callback(struct notifier_block *nfb,
756 778
757 return NOTIFY_OK; 779 return NOTIFY_OK;
758} 780}
781#endif
759 782
760int ehca_create_comp_pool(void) 783int ehca_create_comp_pool(void)
761{ 784{
@@ -786,9 +809,11 @@ int ehca_create_comp_pool(void)
786 } 809 }
787 } 810 }
788 811
812#ifdef CONFIG_HOTPLUG_CPU
789 comp_pool_callback_nb.notifier_call = comp_pool_callback; 813 comp_pool_callback_nb.notifier_call = comp_pool_callback;
790 comp_pool_callback_nb.priority =0; 814 comp_pool_callback_nb.priority =0;
791 register_cpu_notifier(&comp_pool_callback_nb); 815 register_cpu_notifier(&comp_pool_callback_nb);
816#endif
792 817
793 printk(KERN_INFO "eHCA scaling code enabled\n"); 818 printk(KERN_INFO "eHCA scaling code enabled\n");
794 819
@@ -802,7 +827,9 @@ void ehca_destroy_comp_pool(void)
802 if (!ehca_scaling_code) 827 if (!ehca_scaling_code)
803 return; 828 return;
804 829
830#ifdef CONFIG_HOTPLUG_CPU
805 unregister_cpu_notifier(&comp_pool_callback_nb); 831 unregister_cpu_notifier(&comp_pool_callback_nb);
832#endif
806 833
807 for (i = 0; i < NR_CPUS; i++) { 834 for (i = 0; i < NR_CPUS; i++) {
808 if (cpu_online(i)) 835 if (cpu_online(i))
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index c1835121a822..059da9628bb5 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -52,7 +52,7 @@
52MODULE_LICENSE("Dual BSD/GPL"); 52MODULE_LICENSE("Dual BSD/GPL");
53MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); 53MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
54MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver"); 54MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver");
55MODULE_VERSION("SVNEHCA_0021"); 55MODULE_VERSION("SVNEHCA_0022");
56 56
57int ehca_open_aqp1 = 0; 57int ehca_open_aqp1 = 0;
58int ehca_debug_level = 0; 58int ehca_debug_level = 0;
@@ -810,7 +810,7 @@ int __init ehca_module_init(void)
810 int ret; 810 int ret;
811 811
812 printk(KERN_INFO "eHCA Infiniband Device Driver " 812 printk(KERN_INFO "eHCA Infiniband Device Driver "
813 "(Rel.: SVNEHCA_0021)\n"); 813 "(Rel.: SVNEHCA_0022)\n");
814 idr_init(&ehca_qp_idr); 814 idr_init(&ehca_qp_idr);
815 idr_init(&ehca_cq_idr); 815 idr_init(&ehca_cq_idr);
816 spin_lock_init(&ehca_qp_idr_lock); 816 spin_lock_init(&ehca_qp_idr_lock);
diff --git a/drivers/infiniband/hw/ipath/ipath_dma.c b/drivers/infiniband/hw/ipath/ipath_dma.c
index f6f949040825..f87f003e3ef8 100644
--- a/drivers/infiniband/hw/ipath/ipath_dma.c
+++ b/drivers/infiniband/hw/ipath/ipath_dma.c
@@ -167,7 +167,7 @@ static void *ipath_dma_alloc_coherent(struct ib_device *dev, size_t size,
167} 167}
168 168
169static void ipath_dma_free_coherent(struct ib_device *dev, size_t size, 169static void ipath_dma_free_coherent(struct ib_device *dev, size_t size,
170 void *cpu_addr, dma_addr_t dma_handle) 170 void *cpu_addr, u64 dma_handle)
171{ 171{
172 free_pages((unsigned long) cpu_addr, get_order(size)); 172 free_pages((unsigned long) cpu_addr, get_order(size));
173} 173}
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 5b40a846ff95..ed55979bfd34 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -451,12 +451,18 @@ bail:
451 return ret; 451 return ret;
452} 452}
453 453
454static void remove_file(struct dentry *parent, char *name) 454static int remove_file(struct dentry *parent, char *name)
455{ 455{
456 struct dentry *tmp; 456 struct dentry *tmp;
457 int ret;
457 458
458 tmp = lookup_one_len(name, parent, strlen(name)); 459 tmp = lookup_one_len(name, parent, strlen(name));
459 460
461 if (IS_ERR(tmp)) {
462 ret = PTR_ERR(tmp);
463 goto bail;
464 }
465
460 spin_lock(&dcache_lock); 466 spin_lock(&dcache_lock);
461 spin_lock(&tmp->d_lock); 467 spin_lock(&tmp->d_lock);
462 if (!(d_unhashed(tmp) && tmp->d_inode)) { 468 if (!(d_unhashed(tmp) && tmp->d_inode)) {
@@ -469,6 +475,14 @@ static void remove_file(struct dentry *parent, char *name)
469 spin_unlock(&tmp->d_lock); 475 spin_unlock(&tmp->d_lock);
470 spin_unlock(&dcache_lock); 476 spin_unlock(&dcache_lock);
471 } 477 }
478
479 ret = 0;
480bail:
481 /*
482 * We don't expect clients to care about the return value, but
483 * it's there if they need it.
484 */
485 return ret;
472} 486}
473 487
474static int remove_device_files(struct super_block *sb, 488static int remove_device_files(struct super_block *sb,
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 8e4846b5c641..fdb576dcfaa8 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -881,8 +881,8 @@ int mthca_init_mr_table(struct mthca_dev *dev)
881 } 881 }
882 mpts = mtts = 1 << i; 882 mpts = mtts = 1 << i;
883 } else { 883 } else {
884 mpts = dev->limits.num_mtt_segs; 884 mtts = dev->limits.num_mtt_segs;
885 mtts = dev->limits.num_mpts; 885 mpts = dev->limits.num_mpts;
886 } 886 }
887 887
888 if (!mthca_is_memfree(dev) && 888 if (!mthca_is_memfree(dev) &&
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 71dc84bd4254..1c6b63aca268 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1088,21 +1088,21 @@ static void mthca_unmap_memfree(struct mthca_dev *dev,
1088static int mthca_alloc_memfree(struct mthca_dev *dev, 1088static int mthca_alloc_memfree(struct mthca_dev *dev,
1089 struct mthca_qp *qp) 1089 struct mthca_qp *qp)
1090{ 1090{
1091 int ret = 0;
1092
1093 if (mthca_is_memfree(dev)) { 1091 if (mthca_is_memfree(dev)) {
1094 qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, 1092 qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ,
1095 qp->qpn, &qp->rq.db); 1093 qp->qpn, &qp->rq.db);
1096 if (qp->rq.db_index < 0) 1094 if (qp->rq.db_index < 0)
1097 return ret; 1095 return -ENOMEM;
1098 1096
1099 qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, 1097 qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
1100 qp->qpn, &qp->sq.db); 1098 qp->qpn, &qp->sq.db);
1101 if (qp->sq.db_index < 0) 1099 if (qp->sq.db_index < 0) {
1102 mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); 1100 mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
1101 return -ENOMEM;
1102 }
1103 } 1103 }
1104 1104
1105 return ret; 1105 return 0;
1106} 1106}
1107 1107
1108static void mthca_free_memfree(struct mthca_dev *dev, 1108static void mthca_free_memfree(struct mthca_dev *dev,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 3484e8ba24a4..2b242a4823f8 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -131,7 +131,7 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, int id, int
131 skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE); 131 skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE);
132 132
133 mapping[i + 1] = ib_dma_map_page(priv->ca, skb_shinfo(skb)->frags[i].page, 133 mapping[i + 1] = ib_dma_map_page(priv->ca, skb_shinfo(skb)->frags[i].page,
134 0, PAGE_SIZE, DMA_TO_DEVICE); 134 0, PAGE_SIZE, DMA_FROM_DEVICE);
135 if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1]))) 135 if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1])))
136 goto partial_error; 136 goto partial_error;
137 } 137 }
@@ -452,7 +452,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
452 skb->len, tx->mtu); 452 skb->len, tx->mtu);
453 ++priv->stats.tx_dropped; 453 ++priv->stats.tx_dropped;
454 ++priv->stats.tx_errors; 454 ++priv->stats.tx_errors;
455 ipoib_cm_skb_too_long(dev, skb, tx->mtu - INFINIBAND_ALEN); 455 ipoib_cm_skb_too_long(dev, skb, tx->mtu - IPOIB_ENCAP_LEN);
456 return; 456 return;
457 } 457 }
458 458
@@ -1095,7 +1095,7 @@ static void ipoib_cm_stale_task(struct work_struct *work)
1095 /* List if sorted by LRU, start from tail, 1095 /* List if sorted by LRU, start from tail,
1096 * stop when we see a recently used entry */ 1096 * stop when we see a recently used entry */
1097 p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); 1097 p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list);
1098 if (time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) 1098 if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT))
1099 break; 1099 break;
1100 list_del_init(&p->list); 1100 list_del_init(&p->list);
1101 spin_unlock_irqrestore(&priv->lock, flags); 1101 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index f2aa923ddbea..ba0ee5cf2ad7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -328,9 +328,9 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
328 struct ipoib_tx_buf *tx_req; 328 struct ipoib_tx_buf *tx_req;
329 u64 addr; 329 u64 addr;
330 330
331 if (unlikely(skb->len > priv->mcast_mtu + INFINIBAND_ALEN)) { 331 if (unlikely(skb->len > priv->mcast_mtu + IPOIB_ENCAP_LEN)) {
332 ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n", 332 ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n",
333 skb->len, priv->mcast_mtu + INFINIBAND_ALEN); 333 skb->len, priv->mcast_mtu + IPOIB_ENCAP_LEN);
334 ++priv->stats.tx_dropped; 334 ++priv->stats.tx_dropped;
335 ++priv->stats.tx_errors; 335 ++priv->stats.tx_errors;
336 ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu); 336 ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f9dbc6f68145..f2a40ae8e7d0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -380,7 +380,7 @@ static void path_rec_completion(int status,
380 struct net_device *dev = path->dev; 380 struct net_device *dev = path->dev;
381 struct ipoib_dev_priv *priv = netdev_priv(dev); 381 struct ipoib_dev_priv *priv = netdev_priv(dev);
382 struct ipoib_ah *ah = NULL; 382 struct ipoib_ah *ah = NULL;
383 struct ipoib_neigh *neigh; 383 struct ipoib_neigh *neigh, *tn;
384 struct sk_buff_head skqueue; 384 struct sk_buff_head skqueue;
385 struct sk_buff *skb; 385 struct sk_buff *skb;
386 unsigned long flags; 386 unsigned long flags;
@@ -418,7 +418,7 @@ static void path_rec_completion(int status,
418 while ((skb = __skb_dequeue(&path->queue))) 418 while ((skb = __skb_dequeue(&path->queue)))
419 __skb_queue_tail(&skqueue, skb); 419 __skb_queue_tail(&skqueue, skb);
420 420
421 list_for_each_entry(neigh, &path->neigh_list, list) { 421 list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
422 kref_get(&path->ah->ref); 422 kref_get(&path->ah->ref);
423 neigh->ah = path->ah; 423 neigh->ah = path->ah;
424 memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw, 424 memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw,
@@ -814,7 +814,7 @@ static void ipoib_set_mcast_list(struct net_device *dev)
814 queue_work(ipoib_workqueue, &priv->restart_task); 814 queue_work(ipoib_workqueue, &priv->restart_task);
815} 815}
816 816
817static void ipoib_neigh_destructor(struct neighbour *n) 817static void ipoib_neigh_cleanup(struct neighbour *n)
818{ 818{
819 struct ipoib_neigh *neigh; 819 struct ipoib_neigh *neigh;
820 struct ipoib_dev_priv *priv = netdev_priv(n->dev); 820 struct ipoib_dev_priv *priv = netdev_priv(n->dev);
@@ -822,7 +822,7 @@ static void ipoib_neigh_destructor(struct neighbour *n)
822 struct ipoib_ah *ah = NULL; 822 struct ipoib_ah *ah = NULL;
823 823
824 ipoib_dbg(priv, 824 ipoib_dbg(priv,
825 "neigh_destructor for %06x " IPOIB_GID_FMT "\n", 825 "neigh_cleanup for %06x " IPOIB_GID_FMT "\n",
826 IPOIB_QPN(n->ha), 826 IPOIB_QPN(n->ha),
827 IPOIB_GID_RAW_ARG(n->ha + 4)); 827 IPOIB_GID_RAW_ARG(n->ha + 4));
828 828
@@ -874,7 +874,7 @@ void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh)
874 874
875static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms) 875static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms)
876{ 876{
877 parms->neigh_destructor = ipoib_neigh_destructor; 877 parms->neigh_cleanup = ipoib_neigh_cleanup;
878 878
879 return 0; 879 return 0;
880} 880}
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index bb2e3d5eee20..54fbead4de01 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -407,6 +407,10 @@ static int ipoib_mcast_join_complete(int status,
407 queue_delayed_work(ipoib_workqueue, 407 queue_delayed_work(ipoib_workqueue,
408 &priv->mcast_task, 0); 408 &priv->mcast_task, 0);
409 mutex_unlock(&mcast_mutex); 409 mutex_unlock(&mcast_mutex);
410
411 if (mcast == priv->broadcast)
412 netif_carrier_on(dev);
413
410 return 0; 414 return 0;
411 } 415 }
412 416
@@ -594,7 +598,6 @@ void ipoib_mcast_join_task(struct work_struct *work)
594 ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); 598 ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");
595 599
596 clear_bit(IPOIB_MCAST_RUN, &priv->flags); 600 clear_bit(IPOIB_MCAST_RUN, &priv->flags);
597 netif_carrier_on(dev);
598} 601}
599 602
600int ipoib_mcast_start_thread(struct net_device *dev) 603int ipoib_mcast_start_thread(struct net_device *dev)
@@ -641,6 +644,9 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
641 struct ipoib_dev_priv *priv = netdev_priv(dev); 644 struct ipoib_dev_priv *priv = netdev_priv(dev);
642 int ret = 0; 645 int ret = 0;
643 646
647 if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags))
648 ib_sa_free_multicast(mcast->mc);
649
644 if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) { 650 if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) {
645 ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n", 651 ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n",
646 IPOIB_GID_ARG(mcast->mcmember.mgid)); 652 IPOIB_GID_ARG(mcast->mcmember.mgid));
@@ -652,9 +658,6 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
652 ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret); 658 ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret);
653 } 659 }
654 660
655 if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags))
656 ib_sa_free_multicast(mcast->mc);
657
658 return 0; 661 return 0;
659} 662}
660 663
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 3cb551b88756..7f3ec205e35f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -259,12 +259,13 @@ void ipoib_event(struct ib_event_handler *handler,
259 struct ipoib_dev_priv *priv = 259 struct ipoib_dev_priv *priv =
260 container_of(handler, struct ipoib_dev_priv, event_handler); 260 container_of(handler, struct ipoib_dev_priv, event_handler);
261 261
262 if (record->event == IB_EVENT_PORT_ERR || 262 if ((record->event == IB_EVENT_PORT_ERR ||
263 record->event == IB_EVENT_PKEY_CHANGE || 263 record->event == IB_EVENT_PKEY_CHANGE ||
264 record->event == IB_EVENT_PORT_ACTIVE || 264 record->event == IB_EVENT_PORT_ACTIVE ||
265 record->event == IB_EVENT_LID_CHANGE || 265 record->event == IB_EVENT_LID_CHANGE ||
266 record->event == IB_EVENT_SM_CHANGE || 266 record->event == IB_EVENT_SM_CHANGE ||
267 record->event == IB_EVENT_CLIENT_REREGISTER) { 267 record->event == IB_EVENT_CLIENT_REREGISTER) &&
268 record->element.port_num == priv->port) {
268 ipoib_dbg(priv, "Port state change event\n"); 269 ipoib_dbg(priv, "Port state change event\n");
269 queue_work(ipoib_workqueue, &priv->flush_task); 270 queue_work(ipoib_workqueue, &priv->flush_task);
270 } 271 }
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index cae8c96a55f8..8960196ffb0f 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -245,7 +245,6 @@ struct iser_conn {
245 wait_queue_head_t wait; /* waitq for conn/disconn */ 245 wait_queue_head_t wait; /* waitq for conn/disconn */
246 atomic_t post_recv_buf_count; /* posted rx count */ 246 atomic_t post_recv_buf_count; /* posted rx count */
247 atomic_t post_send_buf_count; /* posted tx count */ 247 atomic_t post_send_buf_count; /* posted tx count */
248 struct work_struct comperror_work; /* conn term sleepable ctx*/
249 char name[ISER_OBJECT_NAME_SIZE]; 248 char name[ISER_OBJECT_NAME_SIZE];
250 struct iser_page_vec *page_vec; /* represents SG to fmr maps* 249 struct iser_page_vec *page_vec; /* represents SG to fmr maps*
251 * maps serialized as tx is*/ 250 * maps serialized as tx is*/
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 89e37283c836..278fcbccc2d9 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -658,6 +658,7 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask)
658{ 658{
659 int deferred; 659 int deferred;
660 int is_rdma_aligned = 1; 660 int is_rdma_aligned = 1;
661 struct iser_regd_buf *regd;
661 662
662 /* if we were reading, copy back to unaligned sglist, 663 /* if we were reading, copy back to unaligned sglist,
663 * anyway dma_unmap and free the copy 664 * anyway dma_unmap and free the copy
@@ -672,20 +673,20 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask)
672 } 673 }
673 674
674 if (iser_ctask->dir[ISER_DIR_IN]) { 675 if (iser_ctask->dir[ISER_DIR_IN]) {
675 deferred = iser_regd_buff_release 676 regd = &iser_ctask->rdma_regd[ISER_DIR_IN];
676 (&iser_ctask->rdma_regd[ISER_DIR_IN]); 677 deferred = iser_regd_buff_release(regd);
677 if (deferred) { 678 if (deferred) {
678 iser_err("References remain for BUF-IN rdma reg\n"); 679 iser_err("%d references remain for BUF-IN rdma reg\n",
679 BUG(); 680 atomic_read(&regd->ref_count));
680 } 681 }
681 } 682 }
682 683
683 if (iser_ctask->dir[ISER_DIR_OUT]) { 684 if (iser_ctask->dir[ISER_DIR_OUT]) {
684 deferred = iser_regd_buff_release 685 regd = &iser_ctask->rdma_regd[ISER_DIR_OUT];
685 (&iser_ctask->rdma_regd[ISER_DIR_OUT]); 686 deferred = iser_regd_buff_release(regd);
686 if (deferred) { 687 if (deferred) {
687 iser_err("References remain for BUF-OUT rdma reg\n"); 688 iser_err("%d references remain for BUF-OUT rdma reg\n",
688 BUG(); 689 atomic_read(&regd->ref_count));
689 } 690 }
690 } 691 }
691 692
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 693b77002897..1fc967464a28 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -48,7 +48,6 @@
48 48
49static void iser_cq_tasklet_fn(unsigned long data); 49static void iser_cq_tasklet_fn(unsigned long data);
50static void iser_cq_callback(struct ib_cq *cq, void *cq_context); 50static void iser_cq_callback(struct ib_cq *cq, void *cq_context);
51static void iser_comp_error_worker(struct work_struct *work);
52 51
53static void iser_cq_event_callback(struct ib_event *cause, void *context) 52static void iser_cq_event_callback(struct ib_event *cause, void *context)
54{ 53{
@@ -480,7 +479,6 @@ int iser_conn_init(struct iser_conn **ibconn)
480 init_waitqueue_head(&ib_conn->wait); 479 init_waitqueue_head(&ib_conn->wait);
481 atomic_set(&ib_conn->post_recv_buf_count, 0); 480 atomic_set(&ib_conn->post_recv_buf_count, 0);
482 atomic_set(&ib_conn->post_send_buf_count, 0); 481 atomic_set(&ib_conn->post_send_buf_count, 0);
483 INIT_WORK(&ib_conn->comperror_work, iser_comp_error_worker);
484 INIT_LIST_HEAD(&ib_conn->conn_list); 482 INIT_LIST_HEAD(&ib_conn->conn_list);
485 spin_lock_init(&ib_conn->lock); 483 spin_lock_init(&ib_conn->lock);
486 484
@@ -753,26 +751,6 @@ int iser_post_send(struct iser_desc *tx_desc)
753 return ret_val; 751 return ret_val;
754} 752}
755 753
756static void iser_comp_error_worker(struct work_struct *work)
757{
758 struct iser_conn *ib_conn =
759 container_of(work, struct iser_conn, comperror_work);
760
761 /* getting here when the state is UP means that the conn is being *
762 * terminated asynchronously from the iSCSI layer's perspective. */
763 if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
764 ISER_CONN_TERMINATING))
765 iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
766 ISCSI_ERR_CONN_FAILED);
767
768 /* complete the termination process if disconnect event was delivered *
769 * note there are no more non completed posts to the QP */
770 if (ib_conn->disc_evt_flag) {
771 ib_conn->state = ISER_CONN_DOWN;
772 wake_up_interruptible(&ib_conn->wait);
773 }
774}
775
776static void iser_handle_comp_error(struct iser_desc *desc) 754static void iser_handle_comp_error(struct iser_desc *desc)
777{ 755{
778 struct iser_dto *dto = &desc->dto; 756 struct iser_dto *dto = &desc->dto;
@@ -791,8 +769,22 @@ static void iser_handle_comp_error(struct iser_desc *desc)
791 } 769 }
792 770
793 if (atomic_read(&ib_conn->post_recv_buf_count) == 0 && 771 if (atomic_read(&ib_conn->post_recv_buf_count) == 0 &&
794 atomic_read(&ib_conn->post_send_buf_count) == 0) 772 atomic_read(&ib_conn->post_send_buf_count) == 0) {
795 schedule_work(&ib_conn->comperror_work); 773 /* getting here when the state is UP means that the conn is *
774 * being terminated asynchronously from the iSCSI layer's *
775 * perspective. */
776 if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
777 ISER_CONN_TERMINATING))
778 iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
779 ISCSI_ERR_CONN_FAILED);
780
781 /* complete the termination process if disconnect event was delivered *
782 * note there are no more non completed posts to the QP */
783 if (ib_conn->disc_evt_flag) {
784 ib_conn->state = ISER_CONN_DOWN;
785 wake_up_interruptible(&ib_conn->wait);
786 }
787 }
796} 788}
797 789
798static void iser_cq_tasklet_fn(unsigned long data) 790static void iser_cq_tasklet_fn(unsigned long data)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index ec195a36e8f6..db9cca3b65e0 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -553,7 +553,8 @@ static int __devinit i8042_check_aux(void)
553 */ 553 */
554 554
555 param = 0x5a; 555 param = 0x5a;
556 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x5a) { 556 retval = i8042_command(&param, I8042_CMD_AUX_LOOP);
557 if (retval || param != 0x5a) {
557 558
558/* 559/*
559 * External connection test - filters out AT-soldered PS/2 i8042's 560 * External connection test - filters out AT-soldered PS/2 i8042's
@@ -567,7 +568,12 @@ static int __devinit i8042_check_aux(void)
567 (param && param != 0xfa && param != 0xff)) 568 (param && param != 0xfa && param != 0xff))
568 return -1; 569 return -1;
569 570
570 aux_loop_broken = 1; 571/*
572 * If AUX_LOOP completed without error but returned unexpected data
573 * mark it as broken
574 */
575 if (!retval)
576 aux_loop_broken = 1;
571 } 577 }
572 578
573/* 579/*
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index c7db4032ef02..e8606c48c9c3 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -553,6 +553,7 @@ static int ucb1400_ts_remove(struct device *dev)
553} 553}
554 554
555static struct device_driver ucb1400_ts_driver = { 555static struct device_driver ucb1400_ts_driver = {
556 .name = "ucb1400_ts",
556 .owner = THIS_MODULE, 557 .owner = THIS_MODULE,
557 .bus = &ac97_bus_type, 558 .bus = &ac97_bus_type,
558 .probe = ucb1400_ts_probe, 559 .probe = ucb1400_ts_probe,
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 63e51dd6debe..00e31609a238 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
54#define USB_SX353_PRODUCT_ID 0x0022 54#define USB_SX353_PRODUCT_ID 0x0022
55 55
56/* table of devices that work with this driver */ 56/* table of devices that work with this driver */
57static struct usb_device_id gigaset_table [] = { 57static const struct usb_device_id gigaset_table [] = {
58 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, 58 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) },
59 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, 59 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) },
60 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, 60 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) },
@@ -2305,7 +2305,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
2305 gigaset_unassign(cs); 2305 gigaset_unassign(cs);
2306} 2306}
2307 2307
2308static struct gigaset_ops gigops = { 2308static const struct gigaset_ops gigops = {
2309 gigaset_write_cmd, 2309 gigaset_write_cmd,
2310 gigaset_write_room, 2310 gigaset_write_room,
2311 gigaset_chars_in_buffer, 2311 gigaset_chars_in_buffer,
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index b460a73a7c85..6df336bdd571 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -944,8 +944,8 @@ static DEFINE_SPINLOCK(driver_lock);
944struct cardstate *gigaset_get_cs_by_id(int id) 944struct cardstate *gigaset_get_cs_by_id(int id)
945{ 945{
946 unsigned long flags; 946 unsigned long flags;
947 static struct cardstate *ret = NULL; 947 struct cardstate *ret = NULL;
948 static struct cardstate *cs; 948 struct cardstate *cs;
949 struct gigaset_driver *drv; 949 struct gigaset_driver *drv;
950 unsigned i; 950 unsigned i;
951 951
@@ -999,7 +999,7 @@ void gigaset_debugdrivers(void)
999static struct cardstate *gigaset_get_cs_by_minor(unsigned minor) 999static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
1000{ 1000{
1001 unsigned long flags; 1001 unsigned long flags;
1002 static struct cardstate *ret = NULL; 1002 struct cardstate *ret = NULL;
1003 struct gigaset_driver *drv; 1003 struct gigaset_driver *drv;
1004 unsigned index; 1004 unsigned index;
1005 1005
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 4661e2c722bc..cec1ef342fcc 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -409,7 +409,7 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME
409}; 409};
410#endif 410#endif
411 411
412static struct resp_type_t resp_type[]= 412static const struct resp_type_t resp_type[] =
413{ 413{
414 /*{"", RSP_EMPTY, RT_NOTHING},*/ 414 /*{"", RSP_EMPTY, RT_NOTHING},*/
415 {"OK", RSP_OK, RT_NOTHING}, 415 {"OK", RSP_OK, RT_NOTHING},
@@ -511,7 +511,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
511 unsigned char *argv[MAX_REC_PARAMS + 1]; 511 unsigned char *argv[MAX_REC_PARAMS + 1];
512 int params; 512 int params;
513 int i, j; 513 int i, j;
514 struct resp_type_t *rt; 514 const struct resp_type_t *rt;
515 int curarg; 515 int curarg;
516 unsigned long flags; 516 unsigned long flags;
517 unsigned next, tail, head; 517 unsigned next, tail, head;
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 8c0eb522dab1..e0505f238807 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -274,7 +274,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
274 * bit 12..10 = number of trailing '1' bits in result 274 * bit 12..10 = number of trailing '1' bits in result
275 * bit 14..13 = number of bits added by stuffing 275 * bit 14..13 = number of bits added by stuffing
276 */ 276 */
277static u16 stufftab[5 * 256] = { 277static const u16 stufftab[5 * 256] = {
278// previous 1s = 0: 278// previous 1s = 0:
279 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 279 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
280 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, 280 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f,
@@ -629,7 +629,7 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
629 * (replacing 8 by 7 to make it fit; the algorithm won't care) 629 * (replacing 8 by 7 to make it fit; the algorithm won't care)
630 * bit 7 set if there are 5 or more "interior" consecutive '1' bits 630 * bit 7 set if there are 5 or more "interior" consecutive '1' bits
631 */ 631 */
632static unsigned char bitcounts[256] = { 632static const unsigned char bitcounts[256] = {
633 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 633 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
634 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 634 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
635 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 635 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index c8b7db65e48f..ea44302e6e7e 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -459,7 +459,7 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag)
459 return -EINVAL; 459 return -EINVAL;
460} 460}
461 461
462static struct gigaset_ops ops = { 462static const struct gigaset_ops ops = {
463 gigaset_write_cmd, 463 gigaset_write_cmd,
464 gigaset_write_room, 464 gigaset_write_room,
465 gigaset_chars_in_buffer, 465 gigaset_chars_in_buffer,
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 04f2ad7ba8b0..2baef349c12d 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -50,7 +50,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
50#define USB_M105_PRODUCT_ID 0x0009 50#define USB_M105_PRODUCT_ID 0x0009
51 51
52/* table of devices that work with this driver */ 52/* table of devices that work with this driver */
53static struct usb_device_id gigaset_table [] = { 53static const struct usb_device_id gigaset_table [] = {
54 { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) }, 54 { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) },
55 { } /* Terminating entry */ 55 { } /* Terminating entry */
56}; 56};
@@ -860,7 +860,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
860 gigaset_unassign(cs); 860 gigaset_unassign(cs);
861} 861}
862 862
863static struct gigaset_ops ops = { 863static const struct gigaset_ops ops = {
864 gigaset_write_cmd, 864 gigaset_write_cmd,
865 gigaset_write_room, 865 gigaset_write_room,
866 gigaset_chars_in_buffer, 866 gigaset_chars_in_buffer,
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c
index 9df9e3548cf1..c547a6665052 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -440,7 +440,7 @@ isar_bh(struct work_struct *work)
440{ 440{
441 struct BCState *bcs = container_of(work, struct BCState, tqueue); 441 struct BCState *bcs = container_of(work, struct BCState, tqueue);
442 442
443 BChannel_bh(bcs); 443 BChannel_bh(work);
444 if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event)) 444 if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event))
445 ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR); 445 ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR);
446 if (test_and_clear_bit(B_LL_CONNECT, &bcs->event)) 446 if (test_and_clear_bit(B_LL_CONNECT, &bcs->event))
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index a163bca38973..dc7a8c78cbf9 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2464,7 +2464,7 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
2464 2464
2465 r = kvm_arch_ops->hardware_setup(); 2465 r = kvm_arch_ops->hardware_setup();
2466 if (r < 0) 2466 if (r < 0)
2467 return r; 2467 goto out;
2468 2468
2469 on_each_cpu(kvm_arch_ops->hardware_enable, NULL, 0, 1); 2469 on_each_cpu(kvm_arch_ops->hardware_enable, NULL, 0, 1);
2470 r = register_cpu_notifier(&kvm_cpu_notifier); 2470 r = register_cpu_notifier(&kvm_cpu_notifier);
@@ -2500,6 +2500,8 @@ out_free_2:
2500out_free_1: 2500out_free_1:
2501 on_each_cpu(kvm_arch_ops->hardware_disable, NULL, 0, 1); 2501 on_each_cpu(kvm_arch_ops->hardware_disable, NULL, 0, 1);
2502 kvm_arch_ops->hardware_unsetup(); 2502 kvm_arch_ops->hardware_unsetup();
2503out:
2504 kvm_arch_ops = NULL;
2503 return r; 2505 return r;
2504} 2506}
2505 2507
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index a1a93368f314..e85b4c7c36f7 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -131,7 +131,7 @@ static int dbg = 1;
131 (((address) >> PT32_LEVEL_SHIFT(level)) & ((1 << PT32_LEVEL_BITS) - 1)) 131 (((address) >> PT32_LEVEL_SHIFT(level)) & ((1 << PT32_LEVEL_BITS) - 1))
132 132
133 133
134#define PT64_BASE_ADDR_MASK (((1ULL << 52) - 1) & PAGE_MASK) 134#define PT64_BASE_ADDR_MASK (((1ULL << 52) - 1) & ~(u64)(PAGE_SIZE-1))
135#define PT64_DIR_BASE_ADDR_MASK \ 135#define PT64_DIR_BASE_ADDR_MASK \
136 (PT64_BASE_ADDR_MASK & ~((1ULL << (PAGE_SHIFT + PT64_LEVEL_BITS)) - 1)) 136 (PT64_BASE_ADDR_MASK & ~((1ULL << (PAGE_SHIFT + PT64_LEVEL_BITS)) - 1))
137 137
@@ -406,8 +406,8 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn)
406 spte = desc->shadow_ptes[0]; 406 spte = desc->shadow_ptes[0];
407 } 407 }
408 BUG_ON(!spte); 408 BUG_ON(!spte);
409 BUG_ON((*spte & PT64_BASE_ADDR_MASK) != 409 BUG_ON((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT
410 page_to_pfn(page) << PAGE_SHIFT); 410 != page_to_pfn(page));
411 BUG_ON(!(*spte & PT_PRESENT_MASK)); 411 BUG_ON(!(*spte & PT_PRESENT_MASK));
412 BUG_ON(!(*spte & PT_WRITABLE_MASK)); 412 BUG_ON(!(*spte & PT_WRITABLE_MASK));
413 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); 413 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
@@ -1093,22 +1093,40 @@ out:
1093 return r; 1093 return r;
1094} 1094}
1095 1095
1096static void mmu_pre_write_zap_pte(struct kvm_vcpu *vcpu,
1097 struct kvm_mmu_page *page,
1098 u64 *spte)
1099{
1100 u64 pte;
1101 struct kvm_mmu_page *child;
1102
1103 pte = *spte;
1104 if (is_present_pte(pte)) {
1105 if (page->role.level == PT_PAGE_TABLE_LEVEL)
1106 rmap_remove(vcpu, spte);
1107 else {
1108 child = page_header(pte & PT64_BASE_ADDR_MASK);
1109 mmu_page_remove_parent_pte(vcpu, child, spte);
1110 }
1111 }
1112 *spte = 0;
1113}
1114
1096void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) 1115void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
1097{ 1116{
1098 gfn_t gfn = gpa >> PAGE_SHIFT; 1117 gfn_t gfn = gpa >> PAGE_SHIFT;
1099 struct kvm_mmu_page *page; 1118 struct kvm_mmu_page *page;
1100 struct kvm_mmu_page *child;
1101 struct hlist_node *node, *n; 1119 struct hlist_node *node, *n;
1102 struct hlist_head *bucket; 1120 struct hlist_head *bucket;
1103 unsigned index; 1121 unsigned index;
1104 u64 *spte; 1122 u64 *spte;
1105 u64 pte;
1106 unsigned offset = offset_in_page(gpa); 1123 unsigned offset = offset_in_page(gpa);
1107 unsigned pte_size; 1124 unsigned pte_size;
1108 unsigned page_offset; 1125 unsigned page_offset;
1109 unsigned misaligned; 1126 unsigned misaligned;
1110 int level; 1127 int level;
1111 int flooded = 0; 1128 int flooded = 0;
1129 int npte;
1112 1130
1113 pgprintk("%s: gpa %llx bytes %d\n", __FUNCTION__, gpa, bytes); 1131 pgprintk("%s: gpa %llx bytes %d\n", __FUNCTION__, gpa, bytes);
1114 if (gfn == vcpu->last_pt_write_gfn) { 1132 if (gfn == vcpu->last_pt_write_gfn) {
@@ -1144,22 +1162,26 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
1144 } 1162 }
1145 page_offset = offset; 1163 page_offset = offset;
1146 level = page->role.level; 1164 level = page->role.level;
1165 npte = 1;
1147 if (page->role.glevels == PT32_ROOT_LEVEL) { 1166 if (page->role.glevels == PT32_ROOT_LEVEL) {
1148 page_offset <<= 1; /* 32->64 */ 1167 page_offset <<= 1; /* 32->64 */
1168 /*
1169 * A 32-bit pde maps 4MB while the shadow pdes map
1170 * only 2MB. So we need to double the offset again
1171 * and zap two pdes instead of one.
1172 */
1173 if (level == PT32_ROOT_LEVEL) {
1174 page_offset <<= 1;
1175 npte = 2;
1176 }
1149 page_offset &= ~PAGE_MASK; 1177 page_offset &= ~PAGE_MASK;
1150 } 1178 }
1151 spte = __va(page->page_hpa); 1179 spte = __va(page->page_hpa);
1152 spte += page_offset / sizeof(*spte); 1180 spte += page_offset / sizeof(*spte);
1153 pte = *spte; 1181 while (npte--) {
1154 if (is_present_pte(pte)) { 1182 mmu_pre_write_zap_pte(vcpu, page, spte);
1155 if (level == PT_PAGE_TABLE_LEVEL) 1183 ++spte;
1156 rmap_remove(vcpu, spte);
1157 else {
1158 child = page_header(pte & PT64_BASE_ADDR_MASK);
1159 mmu_page_remove_parent_pte(vcpu, child, spte);
1160 }
1161 } 1184 }
1162 *spte = 0;
1163 } 1185 }
1164} 1186}
1165 1187
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index c07178e61122..fbbf9d6b299f 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -371,10 +371,10 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
371 data = vmcs_read32(GUEST_SYSENTER_CS); 371 data = vmcs_read32(GUEST_SYSENTER_CS);
372 break; 372 break;
373 case MSR_IA32_SYSENTER_EIP: 373 case MSR_IA32_SYSENTER_EIP:
374 data = vmcs_read32(GUEST_SYSENTER_EIP); 374 data = vmcs_readl(GUEST_SYSENTER_EIP);
375 break; 375 break;
376 case MSR_IA32_SYSENTER_ESP: 376 case MSR_IA32_SYSENTER_ESP:
377 data = vmcs_read32(GUEST_SYSENTER_ESP); 377 data = vmcs_readl(GUEST_SYSENTER_ESP);
378 break; 378 break;
379 default: 379 default:
380 msr = find_msr_entry(vcpu, msr_index); 380 msr = find_msr_entry(vcpu, msr_index);
@@ -412,10 +412,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
412 vmcs_write32(GUEST_SYSENTER_CS, data); 412 vmcs_write32(GUEST_SYSENTER_CS, data);
413 break; 413 break;
414 case MSR_IA32_SYSENTER_EIP: 414 case MSR_IA32_SYSENTER_EIP:
415 vmcs_write32(GUEST_SYSENTER_EIP, data); 415 vmcs_writel(GUEST_SYSENTER_EIP, data);
416 break; 416 break;
417 case MSR_IA32_SYSENTER_ESP: 417 case MSR_IA32_SYSENTER_ESP:
418 vmcs_write32(GUEST_SYSENTER_ESP, data); 418 vmcs_writel(GUEST_SYSENTER_ESP, data);
419 break; 419 break;
420 case MSR_IA32_TIME_STAMP_COUNTER: 420 case MSR_IA32_TIME_STAMP_COUNTER:
421 guest_write_tsc(data); 421 guest_write_tsc(data);
@@ -618,7 +618,7 @@ static void fix_pmode_dataseg(int seg, struct kvm_save_segment *save)
618{ 618{
619 struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; 619 struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
620 620
621 if (vmcs_readl(sf->base) == save->base) { 621 if (vmcs_readl(sf->base) == save->base && (save->base & AR_S_MASK)) {
622 vmcs_write16(sf->selector, save->selector); 622 vmcs_write16(sf->selector, save->selector);
623 vmcs_writel(sf->base, save->base); 623 vmcs_writel(sf->base, save->base);
624 vmcs_write32(sf->limit, save->limit); 624 vmcs_write32(sf->limit, save->limit);
@@ -1888,6 +1888,27 @@ again:
1888 [cr2]"i"(offsetof(struct kvm_vcpu, cr2)) 1888 [cr2]"i"(offsetof(struct kvm_vcpu, cr2))
1889 : "cc", "memory" ); 1889 : "cc", "memory" );
1890 1890
1891 /*
1892 * Reload segment selectors ASAP. (it's needed for a functional
1893 * kernel: x86 relies on having __KERNEL_PDA in %fs and x86_64
1894 * relies on having 0 in %gs for the CPU PDA to work.)
1895 */
1896 if (fs_gs_ldt_reload_needed) {
1897 load_ldt(ldt_sel);
1898 load_fs(fs_sel);
1899 /*
1900 * If we have to reload gs, we must take care to
1901 * preserve our gs base.
1902 */
1903 local_irq_disable();
1904 load_gs(gs_sel);
1905#ifdef CONFIG_X86_64
1906 wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
1907#endif
1908 local_irq_enable();
1909
1910 reload_tss();
1911 }
1891 ++kvm_stat.exits; 1912 ++kvm_stat.exits;
1892 1913
1893 save_msrs(vcpu->guest_msrs, NR_BAD_MSRS); 1914 save_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
@@ -1905,22 +1926,6 @@ again:
1905 kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR); 1926 kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR);
1906 r = 0; 1927 r = 0;
1907 } else { 1928 } else {
1908 if (fs_gs_ldt_reload_needed) {
1909 load_ldt(ldt_sel);
1910 load_fs(fs_sel);
1911 /*
1912 * If we have to reload gs, we must take care to
1913 * preserve our gs base.
1914 */
1915 local_irq_disable();
1916 load_gs(gs_sel);
1917#ifdef CONFIG_X86_64
1918 wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
1919#endif
1920 local_irq_enable();
1921
1922 reload_tss();
1923 }
1924 /* 1929 /*
1925 * Profile KVM exit RIPs: 1930 * Profile KVM exit RIPs:
1926 */ 1931 */
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index c625ddb8833d..d5ecd2d53046 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -188,7 +188,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
188 for (i=0; i < cnt-1 ; i++) { 188 for (i=0; i < cnt-1 ; i++) {
189 sector_t sz = 0; 189 sector_t sz = 0;
190 int j; 190 int j;
191 for (j=i; i<cnt-1 && sz < min_spacing ; j++) 191 for (j = i; j < cnt - 1 && sz < min_spacing; j++)
192 sz += conf->disks[j].size; 192 sz += conf->disks[j].size;
193 if (sz >= min_spacing && sz < conf->hash_spacing) 193 if (sz >= min_spacing && sz < conf->hash_spacing)
194 conf->hash_spacing = sz; 194 conf->hash_spacing = sz;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6c06e825cff5..509171ca7fa8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1318,6 +1318,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1318 char b[BDEVNAME_SIZE]; 1318 char b[BDEVNAME_SIZE];
1319 struct kobject *ko; 1319 struct kobject *ko;
1320 char *s; 1320 char *s;
1321 int err;
1321 1322
1322 if (rdev->mddev) { 1323 if (rdev->mddev) {
1323 MD_BUG(); 1324 MD_BUG();
@@ -1352,20 +1353,35 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1352 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) 1353 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
1353 *s = '!'; 1354 *s = '!';
1354 1355
1355 list_add(&rdev->same_set, &mddev->disks);
1356 rdev->mddev = mddev; 1356 rdev->mddev = mddev;
1357 printk(KERN_INFO "md: bind<%s>\n", b); 1357 printk(KERN_INFO "md: bind<%s>\n", b);
1358 1358
1359 rdev->kobj.parent = &mddev->kobj; 1359 rdev->kobj.parent = &mddev->kobj;
1360 kobject_add(&rdev->kobj); 1360 if ((err = kobject_add(&rdev->kobj)))
1361 goto fail;
1361 1362
1362 if (rdev->bdev->bd_part) 1363 if (rdev->bdev->bd_part)
1363 ko = &rdev->bdev->bd_part->kobj; 1364 ko = &rdev->bdev->bd_part->kobj;
1364 else 1365 else
1365 ko = &rdev->bdev->bd_disk->kobj; 1366 ko = &rdev->bdev->bd_disk->kobj;
1366 sysfs_create_link(&rdev->kobj, ko, "block"); 1367 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
1368 kobject_del(&rdev->kobj);
1369 goto fail;
1370 }
1371 list_add(&rdev->same_set, &mddev->disks);
1367 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); 1372 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk);
1368 return 0; 1373 return 0;
1374
1375 fail:
1376 printk(KERN_WARNING "md: failed to register dev-%s for %s\n",
1377 b, mdname(mddev));
1378 return err;
1379}
1380
1381static void delayed_delete(struct work_struct *ws)
1382{
1383 mdk_rdev_t *rdev = container_of(ws, mdk_rdev_t, del_work);
1384 kobject_del(&rdev->kobj);
1369} 1385}
1370 1386
1371static void unbind_rdev_from_array(mdk_rdev_t * rdev) 1387static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -1380,7 +1396,12 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev)
1380 printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); 1396 printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b));
1381 rdev->mddev = NULL; 1397 rdev->mddev = NULL;
1382 sysfs_remove_link(&rdev->kobj, "block"); 1398 sysfs_remove_link(&rdev->kobj, "block");
1383 kobject_del(&rdev->kobj); 1399
1400 /* We need to delay this, otherwise we can deadlock when
1401 * writing to 'remove' to "dev/state"
1402 */
1403 INIT_WORK(&rdev->del_work, delayed_delete);
1404 schedule_work(&rdev->del_work);
1384} 1405}
1385 1406
1386/* 1407/*
@@ -2966,7 +2987,9 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2966 mddev->kobj.k_name = NULL; 2987 mddev->kobj.k_name = NULL;
2967 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); 2988 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
2968 mddev->kobj.ktype = &md_ktype; 2989 mddev->kobj.ktype = &md_ktype;
2969 kobject_register(&mddev->kobj); 2990 if (kobject_register(&mddev->kobj))
2991 printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
2992 disk->disk_name);
2970 return NULL; 2993 return NULL;
2971} 2994}
2972 2995
@@ -3144,9 +3167,12 @@ static int do_md_run(mddev_t * mddev)
3144 bitmap_destroy(mddev); 3167 bitmap_destroy(mddev);
3145 return err; 3168 return err;
3146 } 3169 }
3147 if (mddev->pers->sync_request) 3170 if (mddev->pers->sync_request) {
3148 sysfs_create_group(&mddev->kobj, &md_redundancy_group); 3171 if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
3149 else if (mddev->ro == 2) /* auto-readonly not meaningful */ 3172 printk(KERN_WARNING
3173 "md: cannot register extra attributes for %s\n",
3174 mdname(mddev));
3175 } else if (mddev->ro == 2) /* auto-readonly not meaningful */
3150 mddev->ro = 0; 3176 mddev->ro = 0;
3151 3177
3152 atomic_set(&mddev->writes_pending,0); 3178 atomic_set(&mddev->writes_pending,0);
@@ -3160,7 +3186,9 @@ static int do_md_run(mddev_t * mddev)
3160 if (rdev->raid_disk >= 0) { 3186 if (rdev->raid_disk >= 0) {
3161 char nm[20]; 3187 char nm[20];
3162 sprintf(nm, "rd%d", rdev->raid_disk); 3188 sprintf(nm, "rd%d", rdev->raid_disk);
3163 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3189 if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
3190 printk("md: cannot register %s for %s\n",
3191 nm, mdname(mddev));
3164 } 3192 }
3165 3193
3166 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3194 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -3325,6 +3353,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
3325 mddev->queue->merge_bvec_fn = NULL; 3353 mddev->queue->merge_bvec_fn = NULL;
3326 mddev->queue->unplug_fn = NULL; 3354 mddev->queue->unplug_fn = NULL;
3327 mddev->queue->issue_flush_fn = NULL; 3355 mddev->queue->issue_flush_fn = NULL;
3356 mddev->queue->backing_dev_info.congested_fn = NULL;
3328 if (mddev->pers->sync_request) 3357 if (mddev->pers->sync_request)
3329 sysfs_remove_group(&mddev->kobj, &md_redundancy_group); 3358 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
3330 3359
@@ -3371,6 +3400,9 @@ static int do_md_stop(mddev_t * mddev, int mode)
3371 sysfs_remove_link(&mddev->kobj, nm); 3400 sysfs_remove_link(&mddev->kobj, nm);
3372 } 3401 }
3373 3402
3403 /* make sure all delayed_delete calls have finished */
3404 flush_scheduled_work();
3405
3374 export_array(mddev); 3406 export_array(mddev);
3375 3407
3376 mddev->array_size = 0; 3408 mddev->array_size = 0;
@@ -5385,8 +5417,12 @@ static int remove_and_add_spares(mddev_t *mddev)
5385 if (mddev->pers->hot_add_disk(mddev,rdev)) { 5417 if (mddev->pers->hot_add_disk(mddev,rdev)) {
5386 char nm[20]; 5418 char nm[20];
5387 sprintf(nm, "rd%d", rdev->raid_disk); 5419 sprintf(nm, "rd%d", rdev->raid_disk);
5388 sysfs_create_link(&mddev->kobj, 5420 if (sysfs_create_link(&mddev->kobj,
5389 &rdev->kobj, nm); 5421 &rdev->kobj, nm))
5422 printk(KERN_WARNING
5423 "md: cannot register "
5424 "%s for %s\n",
5425 nm, mdname(mddev));
5390 spares++; 5426 spares++;
5391 md_new_event(mddev); 5427 md_new_event(mddev);
5392 } else 5428 } else
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 54a1ad5eef42..8d59914f2057 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3642,12 +3642,15 @@ static int run(mddev_t *mddev)
3642 } 3642 }
3643 3643
3644 /* Ok, everything is just fine now */ 3644 /* Ok, everything is just fine now */
3645 sysfs_create_group(&mddev->kobj, &raid5_attrs_group); 3645 if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
3646 printk(KERN_WARNING
3647 "raid5: failed to create sysfs attributes for %s\n",
3648 mdname(mddev));
3646 3649
3647 mddev->queue->unplug_fn = raid5_unplug_device; 3650 mddev->queue->unplug_fn = raid5_unplug_device;
3648 mddev->queue->issue_flush_fn = raid5_issue_flush; 3651 mddev->queue->issue_flush_fn = raid5_issue_flush;
3649 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
3650 mddev->queue->backing_dev_info.congested_data = mddev; 3652 mddev->queue->backing_dev_info.congested_data = mddev;
3653 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
3651 3654
3652 mddev->array_size = mddev->size * (conf->previous_raid_disks - 3655 mddev->array_size = mddev->size * (conf->previous_raid_disks -
3653 conf->max_degraded); 3656 conf->max_degraded);
@@ -3678,6 +3681,7 @@ static int stop(mddev_t *mddev)
3678 mddev->thread = NULL; 3681 mddev->thread = NULL;
3679 shrink_stripes(conf); 3682 shrink_stripes(conf);
3680 kfree(conf->stripe_hashtbl); 3683 kfree(conf->stripe_hashtbl);
3684 mddev->queue->backing_dev_info.congested_fn = NULL;
3681 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 3685 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
3682 sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); 3686 sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
3683 kfree(conf->disks); 3687 kfree(conf->disks);
@@ -3950,7 +3954,12 @@ static int raid5_start_reshape(mddev_t *mddev)
3950 added_devices++; 3954 added_devices++;
3951 rdev->recovery_offset = 0; 3955 rdev->recovery_offset = 0;
3952 sprintf(nm, "rd%d", rdev->raid_disk); 3956 sprintf(nm, "rd%d", rdev->raid_disk);
3953 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3957 if (sysfs_create_link(&mddev->kobj,
3958 &rdev->kobj, nm))
3959 printk(KERN_WARNING
3960 "raid5: failed to create "
3961 " link %s for %s\n",
3962 nm, mdname(mddev));
3954 } else 3963 } else
3955 break; 3964 break;
3956 } 3965 }
@@ -4104,6 +4113,10 @@ static struct mdk_personality raid4_personality =
4104 .spare_active = raid5_spare_active, 4113 .spare_active = raid5_spare_active,
4105 .sync_request = sync_request, 4114 .sync_request = sync_request,
4106 .resize = raid5_resize, 4115 .resize = raid5_resize,
4116#ifdef CONFIG_MD_RAID5_RESHAPE
4117 .check_reshape = raid5_check_reshape,
4118 .start_reshape = raid5_start_reshape,
4119#endif
4107 .quiesce = raid5_quiesce, 4120 .quiesce = raid5_quiesce,
4108}; 4121};
4109 4122
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
index cbf7c0564889..fcb194135627 100644
--- a/drivers/media/common/ir-functions.c
+++ b/drivers/media/common/ir-functions.c
@@ -310,13 +310,15 @@ void ir_rc5_timer_end(unsigned long data)
310 tv.tv_usec - ir->base_time.tv_usec; 310 tv.tv_usec - ir->base_time.tv_usec;
311 } 311 }
312 312
313 /* Allow some timmer jitter (RC5 is ~24ms anyway so this is ok) */ 313 /* signal we're ready to start a new code */
314 ir->active = 0;
315
316 /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */
314 if (gap < 28000) { 317 if (gap < 28000) {
315 dprintk(1, "ir-common: spurious timer_end\n"); 318 dprintk(1, "ir-common: spurious timer_end\n");
316 return; 319 return;
317 } 320 }
318 321
319 ir->active = 0;
320 if (ir->last_bit < 20) { 322 if (ir->last_bit < 20) {
321 /* ignore spurious codes (caused by light/other remotes) */ 323 /* ignore spurious codes (caused by light/other remotes) */
322 dprintk(1, "ir-common: short code: %x\n", ir->code); 324 dprintk(1, "ir-common: short code: %x\n", ir->code);
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index fc77de45ca4d..a5c0e1a3e6d1 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -180,8 +180,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file)
180 struct dvb_device *dvbdev = file->private_data; 180 struct dvb_device *dvbdev = file->private_data;
181 struct dmxdev *dmxdev = dvbdev->priv; 181 struct dmxdev *dmxdev = dvbdev->priv;
182 182
183 if (mutex_lock_interruptible(&dmxdev->mutex)) 183 mutex_lock(&dmxdev->mutex);
184 return -ERESTARTSYS;
185 184
186 if ((file->f_flags & O_ACCMODE) == O_WRONLY) { 185 if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
187 dmxdev->demux->disconnect_frontend(dmxdev->demux); 186 dmxdev->demux->disconnect_frontend(dmxdev->demux);
@@ -673,13 +672,8 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
673static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, 672static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev,
674 struct dmxdev_filter *dmxdevfilter) 673 struct dmxdev_filter *dmxdevfilter)
675{ 674{
676 if (mutex_lock_interruptible(&dmxdev->mutex)) 675 mutex_lock(&dmxdev->mutex);
677 return -ERESTARTSYS; 676 mutex_lock(&dmxdevfilter->mutex);
678
679 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) {
680 mutex_unlock(&dmxdev->mutex);
681 return -ERESTARTSYS;
682 }
683 677
684 dvb_dmxdev_filter_stop(dmxdevfilter); 678 dvb_dmxdev_filter_stop(dmxdevfilter);
685 dvb_dmxdev_filter_reset(dmxdevfilter); 679 dvb_dmxdev_filter_reset(dmxdevfilter);
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c
index fcff5eab21a3..6d8d1c3df863 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -673,8 +673,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed)
673 struct dvb_demux *demux = feed->demux; 673 struct dvb_demux *demux = feed->demux;
674 int ret; 674 int ret;
675 675
676 if (mutex_lock_interruptible(&demux->mutex)) 676 mutex_lock(&demux->mutex);
677 return -ERESTARTSYS;
678 677
679 if (feed->state < DMX_STATE_GO) { 678 if (feed->state < DMX_STATE_GO) {
680 mutex_unlock(&demux->mutex); 679 mutex_unlock(&demux->mutex);
@@ -748,8 +747,7 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
748 struct dvb_demux *demux = (struct dvb_demux *)dmx; 747 struct dvb_demux *demux = (struct dvb_demux *)dmx;
749 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; 748 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
750 749
751 if (mutex_lock_interruptible(&demux->mutex)) 750 mutex_lock(&demux->mutex);
752 return -ERESTARTSYS;
753 751
754 if (feed->state == DMX_STATE_FREE) { 752 if (feed->state == DMX_STATE_FREE) {
755 mutex_unlock(&demux->mutex); 753 mutex_unlock(&demux->mutex);
@@ -916,8 +914,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed)
916 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 914 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
917 int ret; 915 int ret;
918 916
919 if (mutex_lock_interruptible(&dvbdmx->mutex)) 917 mutex_lock(&dvbdmx->mutex);
920 return -ERESTARTSYS;
921 918
922 if (!dvbdmx->stop_feed) { 919 if (!dvbdmx->stop_feed) {
923 mutex_unlock(&dvbdmx->mutex); 920 mutex_unlock(&dvbdmx->mutex);
@@ -942,8 +939,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
942 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; 939 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
943 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 940 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
944 941
945 if (mutex_lock_interruptible(&dvbdmx->mutex)) 942 mutex_lock(&dvbdmx->mutex);
946 return -ERESTARTSYS;
947 943
948 if (dvbdmxfilter->feed != dvbdmxfeed) { 944 if (dvbdmxfilter->feed != dvbdmxfeed) {
949 mutex_unlock(&dvbdmx->mutex); 945 mutex_unlock(&dvbdmx->mutex);
@@ -1016,8 +1012,7 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
1016 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; 1012 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
1017 struct dvb_demux *dvbdmx = (struct dvb_demux *)demux; 1013 struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
1018 1014
1019 if (mutex_lock_interruptible(&dvbdmx->mutex)) 1015 mutex_lock(&dvbdmx->mutex);
1020 return -ERESTARTSYS;
1021 1016
1022 if (dvbdmxfeed->state == DMX_STATE_FREE) { 1017 if (dvbdmxfeed->state == DMX_STATE_FREE) {
1023 mutex_unlock(&dvbdmx->mutex); 1018 mutex_unlock(&dvbdmx->mutex);
@@ -1126,8 +1121,7 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux,
1126 if (demux->frontend) 1121 if (demux->frontend)
1127 return -EINVAL; 1122 return -EINVAL;
1128 1123
1129 if (mutex_lock_interruptible(&dvbdemux->mutex)) 1124 mutex_lock(&dvbdemux->mutex);
1130 return -ERESTARTSYS;
1131 1125
1132 demux->frontend = frontend; 1126 demux->frontend = frontend;
1133 mutex_unlock(&dvbdemux->mutex); 1127 mutex_unlock(&dvbdemux->mutex);
@@ -1138,8 +1132,7 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
1138{ 1132{
1139 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; 1133 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1140 1134
1141 if (mutex_lock_interruptible(&dvbdemux->mutex)) 1135 mutex_lock(&dvbdemux->mutex);
1142 return -ERESTARTSYS;
1143 1136
1144 demux->frontend = NULL; 1137 demux->frontend = NULL;
1145 mutex_unlock(&dvbdemux->mutex); 1138 mutex_unlock(&dvbdemux->mutex);
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 490337b5ee3e..14a372a0fe8b 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -203,8 +203,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
203 203
204 int id; 204 int id;
205 205
206 if (mutex_lock_interruptible(&dvbdev_register_lock)) 206 mutex_lock(&dvbdev_register_lock);
207 return -ERESTARTSYS;
208 207
209 if ((id = dvbdev_get_free_id (adap, type)) < 0){ 208 if ((id = dvbdev_get_free_id (adap, type)) < 0){
210 mutex_unlock(&dvbdev_register_lock); 209 mutex_unlock(&dvbdev_register_lock);
@@ -294,8 +293,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
294{ 293{
295 int num; 294 int num;
296 295
297 if (mutex_lock_interruptible(&dvbdev_register_lock)) 296 mutex_lock(&dvbdev_register_lock);
298 return -ERESTARTSYS;
299 297
300 if ((num = dvbdev_get_free_adapter_num ()) < 0) { 298 if ((num = dvbdev_get_free_adapter_num ()) < 0) {
301 mutex_unlock(&dvbdev_register_lock); 299 mutex_unlock(&dvbdev_register_lock);
@@ -323,8 +321,7 @@ EXPORT_SYMBOL(dvb_register_adapter);
323 321
324int dvb_unregister_adapter(struct dvb_adapter *adap) 322int dvb_unregister_adapter(struct dvb_adapter *adap)
325{ 323{
326 if (mutex_lock_interruptible(&dvbdev_register_lock)) 324 mutex_lock(&dvbdev_register_lock);
327 return -ERESTARTSYS;
328 list_del (&adap->list_head); 325 list_del (&adap->list_head);
329 mutex_unlock(&dvbdev_register_lock); 326 mutex_unlock(&dvbdev_register_lock);
330 return 0; 327 return 0;
diff --git a/drivers/media/dvb/frontends/isl6421.c b/drivers/media/dvb/frontends/isl6421.c
index ef319369ec26..c967148a5945 100644
--- a/drivers/media/dvb/frontends/isl6421.c
+++ b/drivers/media/dvb/frontends/isl6421.c
@@ -122,6 +122,7 @@ struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter
122 /* detect if it is present or not */ 122 /* detect if it is present or not */
123 if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { 123 if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) {
124 kfree(isl6421); 124 kfree(isl6421);
125 fe->sec_priv = NULL;
125 return NULL; 126 return NULL;
126 } 127 }
127 128
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 87c286ee6a00..b809f83d9563 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -562,7 +562,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
562 562
563 /* set input */ 563 /* set input */
564 if (state->config->set_pll_input) 564 if (state->config->set_pll_input)
565 state->config->set_pll_input(buf, 1); 565 state->config->set_pll_input(buf+1, 1);
566 break; 566 break;
567 case VSB_8: 567 case VSB_8:
568 /* Set non-punctured clock for VSB */ 568 /* Set non-punctured clock for VSB */
@@ -571,7 +571,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
571 571
572 /* set input */ 572 /* set input */
573 if (state->config->set_pll_input) 573 if (state->config->set_pll_input)
574 state->config->set_pll_input(buf, 0); 574 state->config->set_pll_input(buf+1, 0);
575 break; 575 break;
576 default: 576 default:
577 return -EINVAL; 577 return -EINVAL;
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index 4c27a2d90a38..ccc429cbbad0 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
212 for(i=0; i< cmd->msg_len; i++) { 212 for(i=0; i< cmd->msg_len; i++) {
213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]); 213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
214 } 214 }
215 tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len + 1) << 4)); 215 tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4));
216 216
217 tda10086_diseqc_wait(state); 217 tda10086_diseqc_wait(state);
218 218
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c
index ffda71dfdd65..058df5c10034 100644
--- a/drivers/media/dvb/pluto2/pluto2.c
+++ b/drivers/media/dvb/pluto2/pluto2.c
@@ -149,6 +149,15 @@ static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits)
149 writel(val, &pluto->io_mem[reg]); 149 writel(val, &pluto->io_mem[reg]);
150} 150}
151 151
152static void pluto_write_tscr(struct pluto *pluto, u32 val)
153{
154 /* set the number of packets */
155 val &= ~TSCR_ADEF;
156 val |= TS_DMA_PACKETS / 2;
157
158 pluto_writereg(pluto, REG_TSCR, val);
159}
160
152static void pluto_setsda(void *data, int state) 161static void pluto_setsda(void *data, int state)
153{ 162{
154 struct pluto *pluto = data; 163 struct pluto *pluto = data;
@@ -213,11 +222,11 @@ static void pluto_reset_ts(struct pluto *pluto, int reenable)
213 222
214 if (val & TSCR_RSTN) { 223 if (val & TSCR_RSTN) {
215 val &= ~TSCR_RSTN; 224 val &= ~TSCR_RSTN;
216 pluto_writereg(pluto, REG_TSCR, val); 225 pluto_write_tscr(pluto, val);
217 } 226 }
218 if (reenable) { 227 if (reenable) {
219 val |= TSCR_RSTN; 228 val |= TSCR_RSTN;
220 pluto_writereg(pluto, REG_TSCR, val); 229 pluto_write_tscr(pluto, val);
221 } 230 }
222} 231}
223 232
@@ -339,7 +348,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id)
339 } 348 }
340 349
341 /* ACK the interrupt */ 350 /* ACK the interrupt */
342 pluto_writereg(pluto, REG_TSCR, tscr | TSCR_IACK); 351 pluto_write_tscr(pluto, tscr | TSCR_IACK);
343 352
344 return IRQ_HANDLED; 353 return IRQ_HANDLED;
345} 354}
@@ -348,9 +357,6 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
348{ 357{
349 u32 val = pluto_readreg(pluto, REG_TSCR); 358 u32 val = pluto_readreg(pluto, REG_TSCR);
350 359
351 /* set the number of packets */
352 val &= ~TSCR_ADEF;
353 val |= TS_DMA_PACKETS / 2;
354 /* disable AFUL and LOCK interrupts */ 360 /* disable AFUL and LOCK interrupts */
355 val |= (TSCR_MSKA | TSCR_MSKL); 361 val |= (TSCR_MSKA | TSCR_MSKL);
356 /* enable DMA and OVERFLOW interrupts */ 362 /* enable DMA and OVERFLOW interrupts */
@@ -358,7 +364,7 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
358 /* clear pending interrupts */ 364 /* clear pending interrupts */
359 val |= TSCR_IACK; 365 val |= TSCR_IACK;
360 366
361 pluto_writereg(pluto, REG_TSCR, val); 367 pluto_write_tscr(pluto, val);
362} 368}
363 369
364static void pluto_disable_irqs(struct pluto *pluto) 370static void pluto_disable_irqs(struct pluto *pluto)
@@ -370,7 +376,7 @@ static void pluto_disable_irqs(struct pluto *pluto)
370 /* clear pending interrupts */ 376 /* clear pending interrupts */
371 val |= TSCR_IACK; 377 val |= TSCR_IACK;
372 378
373 pluto_writereg(pluto, REG_TSCR, val); 379 pluto_write_tscr(pluto, val);
374} 380}
375 381
376static int __devinit pluto_hw_init(struct pluto *pluto) 382static int __devinit pluto_hw_init(struct pluto *pluto)
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 920b63f8cf05..af66a5d5ecd8 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menu "Radio Adapters" 5menu "Radio Adapters"
6 depends on VIDEO_DEV!=n 6 depends on VIDEO_DEV
7 7
8config RADIO_CADET 8config RADIO_CADET
9 tristate "ADS Cadet AM/FM Tuner" 9 tristate "ADS Cadet AM/FM Tuner"
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 2fb9fe6a1ae7..ba1af3c8525e 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -780,18 +780,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
780 return 0; 780 return 0;
781} 781}
782 782
783static int msp_suspend(struct device * dev, pm_message_t state) 783static int msp_suspend(struct i2c_client *client, pm_message_t state)
784{ 784{
785 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
786 785
787 v4l_dbg(1, msp_debug, client, "suspend\n"); 786 v4l_dbg(1, msp_debug, client, "suspend\n");
788 msp_reset(client); 787 msp_reset(client);
789 return 0; 788 return 0;
790} 789}
791 790
792static int msp_resume(struct device * dev) 791static int msp_resume(struct i2c_client *client)
793{ 792{
794 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
795 793
796 v4l_dbg(1, msp_debug, client, "resume\n"); 794 v4l_dbg(1, msp_debug, client, "resume\n");
797 msp_wake_thread(client); 795 msp_wake_thread(client);
@@ -825,7 +823,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
825 if (msp_reset(client) == -1) { 823 if (msp_reset(client) == -1) {
826 v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); 824 v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
827 kfree(client); 825 kfree(client);
828 return -1; 826 return 0;
829 } 827 }
830 828
831 state = kmalloc(sizeof(*state), GFP_KERNEL); 829 state = kmalloc(sizeof(*state), GFP_KERNEL);
@@ -859,7 +857,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
859 v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); 857 v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
860 kfree(state); 858 kfree(state);
861 kfree(client); 859 kfree(client);
862 return -1; 860 return 0;
863 } 861 }
864 862
865 msp_set_audio(client); 863 msp_set_audio(client);
@@ -996,11 +994,11 @@ static struct i2c_driver i2c_driver = {
996 .id = I2C_DRIVERID_MSP3400, 994 .id = I2C_DRIVERID_MSP3400,
997 .attach_adapter = msp_probe, 995 .attach_adapter = msp_probe,
998 .detach_client = msp_detach, 996 .detach_client = msp_detach,
997 .suspend = msp_suspend,
998 .resume = msp_resume,
999 .command = msp_command, 999 .command = msp_command,
1000 .driver = { 1000 .driver = {
1001 .name = "msp3400", 1001 .name = "msp3400",
1002 .suspend = msp_suspend,
1003 .resume = msp_resume,
1004 }, 1002 },
1005}; 1003};
1006 1004
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 1ff5138e4bb6..9916cf32494d 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -1248,10 +1248,10 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
1248 ret |= pvr2_write_register(hdw, 0xaa18, 0x00840000); /*unknown*/ 1248 ret |= pvr2_write_register(hdw, 0xaa18, 0x00840000); /*unknown*/
1249 LOCK_TAKE(hdw->ctl_lock); do { 1249 LOCK_TAKE(hdw->ctl_lock); do {
1250 hdw->cmd_buffer[0] = FX2CMD_FWPOST1; 1250 hdw->cmd_buffer[0] = FX2CMD_FWPOST1;
1251 ret |= pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); 1251 ret |= pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0);
1252 hdw->cmd_buffer[0] = FX2CMD_MEMSEL; 1252 hdw->cmd_buffer[0] = FX2CMD_MEMSEL;
1253 hdw->cmd_buffer[1] = 0; 1253 hdw->cmd_buffer[1] = 0;
1254 ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,0,0); 1254 ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,NULL,0);
1255 } while (0); LOCK_GIVE(hdw->ctl_lock); 1255 } while (0); LOCK_GIVE(hdw->ctl_lock);
1256 1256
1257 if (ret) { 1257 if (ret) {
@@ -1320,7 +1320,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
1320 LOCK_TAKE(hdw->ctl_lock); do { 1320 LOCK_TAKE(hdw->ctl_lock); do {
1321 hdw->cmd_buffer[0] = FX2CMD_MEMSEL; 1321 hdw->cmd_buffer[0] = FX2CMD_MEMSEL;
1322 hdw->cmd_buffer[1] = 0; 1322 hdw->cmd_buffer[1] = 0;
1323 ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,0,0); 1323 ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,NULL,0);
1324 } while (0); LOCK_GIVE(hdw->ctl_lock); 1324 } while (0); LOCK_GIVE(hdw->ctl_lock);
1325 1325
1326 if (ret) { 1326 if (ret) {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 5313d342666e..25d3830b482a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -808,11 +808,11 @@ static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp)
808{ 808{
809 if (vp->dev_video) { 809 if (vp->dev_video) {
810 pvr2_v4l2_dev_destroy(vp->dev_video); 810 pvr2_v4l2_dev_destroy(vp->dev_video);
811 vp->dev_video = 0; 811 vp->dev_video = NULL;
812 } 812 }
813 if (vp->dev_radio) { 813 if (vp->dev_radio) {
814 pvr2_v4l2_dev_destroy(vp->dev_radio); 814 pvr2_v4l2_dev_destroy(vp->dev_radio);
815 vp->dev_radio = 0; 815 vp->dev_radio = NULL;
816 } 816 }
817 817
818 pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); 818 pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp);
@@ -1138,7 +1138,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
1138{ 1138{
1139 int mindevnum; 1139 int mindevnum;
1140 int unit_number; 1140 int unit_number;
1141 int *nr_ptr = 0; 1141 int *nr_ptr = NULL;
1142 dip->v4lp = vp; 1142 dip->v4lp = vp;
1143 1143
1144 1144
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 7735b6758921..4d5bbd859de1 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -961,7 +961,7 @@ static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
961 reg |= 0x10; 961 reg |= 0x10;
962 } else if (std == V4L2_STD_NTSC_M_JP) { 962 } else if (std == V4L2_STD_NTSC_M_JP) {
963 reg |= 0x40; 963 reg |= 0x40;
964 } else if (std == V4L2_STD_SECAM) { 964 } else if (std & V4L2_STD_SECAM) {
965 reg |= 0x50; 965 reg |= 0x50;
966 } 966 }
967 saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); 967 saa711x_write(client, R_0E_CHROMA_CNTL_1, reg);
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 7be73e3763de..15dbc6bf42a7 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -804,9 +804,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
804 return 0; 804 return 0;
805} 805}
806 806
807static int tuner_suspend(struct device *dev, pm_message_t state) 807static int tuner_suspend(struct i2c_client *c, pm_message_t state)
808{ 808{
809 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
810 struct tuner *t = i2c_get_clientdata (c); 809 struct tuner *t = i2c_get_clientdata (c);
811 810
812 tuner_dbg ("suspend\n"); 811 tuner_dbg ("suspend\n");
@@ -814,9 +813,8 @@ static int tuner_suspend(struct device *dev, pm_message_t state)
814 return 0; 813 return 0;
815} 814}
816 815
817static int tuner_resume(struct device *dev) 816static int tuner_resume(struct i2c_client *c)
818{ 817{
819 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
820 struct tuner *t = i2c_get_clientdata (c); 818 struct tuner *t = i2c_get_clientdata (c);
821 819
822 tuner_dbg ("resume\n"); 820 tuner_dbg ("resume\n");
@@ -837,10 +835,10 @@ static struct i2c_driver driver = {
837 .attach_adapter = tuner_probe, 835 .attach_adapter = tuner_probe,
838 .detach_client = tuner_detach, 836 .detach_client = tuner_detach,
839 .command = tuner_command, 837 .command = tuner_command,
838 .suspend = tuner_suspend,
839 .resume = tuner_resume,
840 .driver = { 840 .driver = {
841 .name = "tuner", 841 .name = "tuner",
842 .suspend = tuner_suspend,
843 .resume = tuner_resume,
844 }, 842 },
845}; 843};
846static struct i2c_client client_template = { 844static struct i2c_client client_template = {
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 404c014db1bd..1d2d03f77894 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
815static int 815static int
816mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 816mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
817{ 817{
818 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; 818 MPT_SCSI_HOST *hd;
819 struct mptsas_target_reset_event *target_reset_list, *n; 819 struct mptsas_target_reset_event *target_reset_list, *n;
820 int rc; 820 int rc;
821 821
@@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
827 if (reset_phase != MPT_IOC_POST_RESET) 827 if (reset_phase != MPT_IOC_POST_RESET)
828 goto out; 828 goto out;
829 829
830 if (!hd || !hd->ioc) 830 if (!ioc->sh || !ioc->sh->hostdata)
831 goto out;
832 hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
833 if (!hd->ioc)
831 goto out; 834 goto out;
832 835
833 if (list_empty(&hd->target_reset_list)) 836 if (list_empty(&hd->target_reset_list))
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index da9859f2caf2..b17c4b2bc9ef 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -390,13 +390,6 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
390 return BLKPREP_KILL; 390 return BLKPREP_KILL;
391 } 391 }
392 392
393 /* request is already processed by us, so return */
394 if (blk_special_request(req)) {
395 osm_debug("REQ_SPECIAL already set!\n");
396 req->cmd_flags |= REQ_DONTPREP;
397 return BLKPREP_OK;
398 }
399
400 /* connect the i2o_block_request to the request */ 393 /* connect the i2o_block_request to the request */
401 if (!req->special) { 394 if (!req->special) {
402 ireq = i2o_block_request_alloc(); 395 ireq = i2o_block_request_alloc();
@@ -408,11 +401,8 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
408 ireq->i2o_blk_dev = i2o_blk_dev; 401 ireq->i2o_blk_dev = i2o_blk_dev;
409 req->special = ireq; 402 req->special = ireq;
410 ireq->req = req; 403 ireq->req = req;
411 } else 404 }
412 ireq = req->special;
413
414 /* do not come back here */ 405 /* do not come back here */
415 req->cmd_type = REQ_TYPE_SPECIAL;
416 req->cmd_flags |= REQ_DONTPREP; 406 req->cmd_flags |= REQ_DONTPREP;
417 407
418 return BLKPREP_OK; 408 return BLKPREP_OK;
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index c707c8ebc1a2..b0b4458ae90b 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -319,7 +319,7 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to)
319 319
320 mode &= 3; /* get current power mode */ 320 mode &= 3; /* get current power mode */
321 321
322 if (unit > ARRAY_SIZE(sm->unit_power)) { 322 if (unit >= ARRAY_SIZE(sm->unit_power)) {
323 dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit); 323 dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit);
324 goto already; 324 goto already;
325 } 325 }
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 295e931c0dfb..4b232124a1ab 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -211,7 +211,7 @@ static struct workqueue_struct *led_workqueue;
211 enum led_brightness value); \ 211 enum led_brightness value); \
212 static void object##_led_update(struct work_struct *ignored); \ 212 static void object##_led_update(struct work_struct *ignored); \
213 static int object##_led_wk; \ 213 static int object##_led_wk; \
214 DECLARE_WORK(object##_led_work, object##_led_update); \ 214 static DECLARE_WORK(object##_led_work, object##_led_update); \
215 static struct led_classdev object##_led = { \ 215 static struct led_classdev object##_led = { \
216 .name = "asus:" ledname, \ 216 .name = "asus:" ledname, \
217 .brightness_set = object##_led_set, \ 217 .brightness_set = object##_led_set, \
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 2ebe240dd537..ac708bc2f9f3 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -453,7 +453,7 @@ static int sony_acpi_resume(struct acpi_device *device)
453static int sony_acpi_add(struct acpi_device *device) 453static int sony_acpi_add(struct acpi_device *device)
454{ 454{
455 acpi_status status; 455 acpi_status status;
456 int result; 456 int result = 0;
457 acpi_handle handle; 457 acpi_handle handle;
458 458
459 sony_acpi_acpi_device = device; 459 sony_acpi_acpi_device = device;
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c
index b060d4bfba29..0de5c9e94e74 100644
--- a/drivers/mmc/imxmmc.c
+++ b/drivers/mmc/imxmmc.c
@@ -569,10 +569,12 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat)
569 569
570 if(host->dma_dir == DMA_FROM_DEVICE) { 570 if(host->dma_dir == DMA_FROM_DEVICE) {
571 imxmci_busy_wait_for_status(host, &stat, 571 imxmci_busy_wait_for_status(host, &stat,
572 STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE, 572 STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE |
573 STATUS_TIME_OUT_READ,
573 50, "imxmci_cpu_driven_data read"); 574 50, "imxmci_cpu_driven_data read");
574 575
575 while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) && 576 while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) &&
577 !(stat & STATUS_TIME_OUT_READ) &&
576 (host->data_cnt < 512)) { 578 (host->data_cnt < 512)) {
577 579
578 udelay(20); /* required for clocks < 8MHz*/ 580 udelay(20); /* required for clocks < 8MHz*/
@@ -602,6 +604,12 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat)
602 if(host->dma_size & 0x1ff) 604 if(host->dma_size & 0x1ff)
603 stat &= ~STATUS_CRC_READ_ERR; 605 stat &= ~STATUS_CRC_READ_ERR;
604 606
607 if(stat & STATUS_TIME_OUT_READ) {
608 dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data read timeout STATUS = 0x%x\n",
609 stat);
610 trans_done = -1;
611 }
612
605 } else { 613 } else {
606 imxmci_busy_wait_for_status(host, &stat, 614 imxmci_busy_wait_for_status(host, &stat,
607 STATUS_APPL_BUFF_FE, 615 STATUS_APPL_BUFF_FE,
@@ -709,6 +717,9 @@ static void imxmci_tasklet_fnc(unsigned long data)
709 */ 717 */
710 stat |= host->status_reg; 718 stat |= host->status_reg;
711 719
720 if(test_bit(IMXMCI_PEND_CPU_DATA_b, &host->pending_events))
721 stat &= ~STATUS_CRC_READ_ERR;
722
712 if(test_bit(IMXMCI_PEND_WAIT_RESP_b, &host->pending_events)) { 723 if(test_bit(IMXMCI_PEND_WAIT_RESP_b, &host->pending_events)) {
713 imxmci_busy_wait_for_status(host, &stat, 724 imxmci_busy_wait_for_status(host, &stat,
714 STATUS_END_CMD_RESP | STATUS_ERR_MASK, 725 STATUS_END_CMD_RESP | STATUS_ERR_MASK,
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e3acd398fb37..1f6445840461 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -359,6 +359,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
359 cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; 359 cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp;
360 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; 360 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp;
361 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; 361 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp;
362 cfi->chips[i].ref_point_counter = 0;
363 init_waitqueue_head(&(cfi->chips[i].wq));
362 } 364 }
363 365
364 map->fldrv = &cfi_amdstd_chipdrv; 366 map->fldrv = &cfi_amdstd_chipdrv;
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 69d49e0250a9..b344ff858b2d 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -158,6 +158,8 @@ struct mtd_info *cfi_cmdset_0020(struct map_info *map, int primary)
158 cfi->chips[i].word_write_time = 128; 158 cfi->chips[i].word_write_time = 128;
159 cfi->chips[i].buffer_write_time = 128; 159 cfi->chips[i].buffer_write_time = 128;
160 cfi->chips[i].erase_time = 1024; 160 cfi->chips[i].erase_time = 1024;
161 cfi->chips[i].ref_point_counter = 0;
162 init_waitqueue_head(&(cfi->chips[i].wq));
161 } 163 }
162 164
163 return cfi_staa_setup(map); 165 return cfi_staa_setup(map);
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c
index b1104fe1f207..1c3b34ad7325 100644
--- a/drivers/mtd/maps/dilnetpc.c
+++ b/drivers/mtd/maps/dilnetpc.c
@@ -402,8 +402,8 @@ static int __init init_dnpc(void)
402 ++higlvl_partition_info[i].name; 402 ++higlvl_partition_info[i].name;
403 } 403 }
404 404
405 printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", 405 printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%llx\n",
406 is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys); 406 is_dnp ? "DNPC" : "ADNP", dnpc_map.size, (unsigned long long)dnpc_map.phys);
407 407
408 dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); 408 dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size);
409 409
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index 0bc013fd66a3..aa64a4752781 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -30,7 +30,7 @@
30 30
31#define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */ 31#define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */
32 32
33#define BIOS_CNTL 0xDC 33#define BIOS_CNTL 0xDC
34#define BIOS_LOCK_ENABLE 0x02 34#define BIOS_LOCK_ENABLE 0x02
35#define BIOS_WRITE_ENABLE 0x01 35#define BIOS_WRITE_ENABLE 0x01
36 36
@@ -145,7 +145,7 @@ static void esb2rom_cleanup(struct esb2rom_window *window)
145} 145}
146 146
147static int __devinit esb2rom_init_one(struct pci_dev *pdev, 147static int __devinit esb2rom_init_one(struct pci_dev *pdev,
148 const struct pci_device_id *ent) 148 const struct pci_device_id *ent)
149{ 149{
150 static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; 150 static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
151 struct esb2rom_window *window = &esb2rom_window; 151 struct esb2rom_window *window = &esb2rom_window;
@@ -185,7 +185,7 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev,
185 /* Find a region continuous to the end of the ROM window */ 185 /* Find a region continuous to the end of the ROM window */
186 window->phys = 0; 186 window->phys = 0;
187 pci_read_config_word(pdev, FWH_DEC_EN1, &word); 187 pci_read_config_word(pdev, FWH_DEC_EN1, &word);
188 printk(KERN_DEBUG "pci_read_config_byte : %x\n", word); 188 printk(KERN_DEBUG "pci_read_config_word : %x\n", word);
189 189
190 if ((word & FWH_8MiB) == FWH_8MiB) 190 if ((word & FWH_8MiB) == FWH_8MiB)
191 window->phys = 0xff400000; 191 window->phys = 0xff400000;
@@ -212,6 +212,11 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev,
212 else if ((word & FWH_0_5MiB) == FWH_0_5MiB) 212 else if ((word & FWH_0_5MiB) == FWH_0_5MiB)
213 window->phys = 0xfff80000; 213 window->phys = 0xfff80000;
214 214
215 if (window->phys == 0) {
216 printk(KERN_ERR MOD_NAME ": Rom window is closed\n");
217 goto out;
218 }
219
215 /* reserved 0x0020 and 0x0010 */ 220 /* reserved 0x0020 and 0x0010 */
216 window->phys -= 0x400000UL; 221 window->phys -= 0x400000UL;
217 window->size = (0xffffffffUL - window->phys) + 1UL; 222 window->size = (0xffffffffUL - window->phys) + 1UL;
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 880580c44e01..41844ea02462 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -727,6 +727,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c
727 concat->mtd.erasesize = subdev[0]->erasesize; 727 concat->mtd.erasesize = subdev[0]->erasesize;
728 concat->mtd.writesize = subdev[0]->writesize; 728 concat->mtd.writesize = subdev[0]->writesize;
729 concat->mtd.oobsize = subdev[0]->oobsize; 729 concat->mtd.oobsize = subdev[0]->oobsize;
730 concat->mtd.oobavail = subdev[0]->oobavail;
730 if (subdev[0]->writev) 731 if (subdev[0]->writev)
731 concat->mtd.writev = concat_writev; 732 concat->mtd.writev = concat_writev;
732 if (subdev[0]->read_oob) 733 if (subdev[0]->read_oob)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 633def3fb087..1af989023c66 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -200,6 +200,11 @@ static int part_erase (struct mtd_info *mtd, struct erase_info *instr)
200 return -EINVAL; 200 return -EINVAL;
201 instr->addr += part->offset; 201 instr->addr += part->offset;
202 ret = part->master->erase(part->master, instr); 202 ret = part->master->erase(part->master, instr);
203 if (ret) {
204 if (instr->fail_addr != 0xffffffff)
205 instr->fail_addr -= part->offset;
206 instr->addr -= part->offset;
207 }
203 return ret; 208 return ret;
204} 209}
205 210
@@ -338,6 +343,7 @@ int add_mtd_partitions(struct mtd_info *master,
338 slave->mtd.size = parts[i].size; 343 slave->mtd.size = parts[i].size;
339 slave->mtd.writesize = master->writesize; 344 slave->mtd.writesize = master->writesize;
340 slave->mtd.oobsize = master->oobsize; 345 slave->mtd.oobsize = master->oobsize;
346 slave->mtd.oobavail = master->oobavail;
341 slave->mtd.subpage_sft = master->subpage_sft; 347 slave->mtd.subpage_sft = master->subpage_sft;
342 348
343 slave->mtd.name = parts[i].name; 349 slave->mtd.name = parts[i].name;
@@ -559,4 +565,3 @@ EXPORT_SYMBOL_GPL(deregister_mtd_parser);
559MODULE_LICENSE("GPL"); 565MODULE_LICENSE("GPL");
560MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); 566MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
561MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); 567MODULE_DESCRIPTION("Generic support for partitioning of MTD devices");
562
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index 12608c13cce5..595208f965a5 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -114,7 +114,7 @@ module_param(no_autopart, int, 0);
114static int show_firmware_partition = 0; 114static int show_firmware_partition = 0;
115module_param(show_firmware_partition, int, 0); 115module_param(show_firmware_partition, int, 0);
116 116
117#ifdef MTD_NAND_DISKONCHIP_BBTWRITE 117#ifdef CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE
118static int inftl_bbt_write = 1; 118static int inftl_bbt_write = 1;
119#else 119#else
120static int inftl_bbt_write = 0; 120static int inftl_bbt_write = 0;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index acaf97bc80d1..6af37b8cff65 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2524,6 +2524,7 @@ int nand_scan_tail(struct mtd_info *mtd)
2524 for (i = 0; chip->ecc.layout->oobfree[i].length; i++) 2524 for (i = 0; chip->ecc.layout->oobfree[i].length; i++)
2525 chip->ecc.layout->oobavail += 2525 chip->ecc.layout->oobavail +=
2526 chip->ecc.layout->oobfree[i].length; 2526 chip->ecc.layout->oobfree[i].length;
2527 mtd->oobavail = chip->ecc.layout->oobavail;
2527 2528
2528 /* 2529 /*
2529 * Set the number of read / write steps for one page depending on ECC 2530 * Set the number of read / write steps for one page depending on ECC
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 7f1cb6e5dccb..9e14a26ca4e8 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -4,6 +4,11 @@
4 * Copyright (C) 2005-2007 Samsung Electronics 4 * Copyright (C) 2005-2007 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * 6 *
7 * Credits:
8 * Adrian Hunter <ext-adrian.hunter@nokia.com>:
9 * auto-placement support, read-while load support, various fixes
10 * Copyright (C) Nokia Corporation, 2007
11 *
7 * This program is free software; you can redistribute it and/or modify 12 * 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 13 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
@@ -831,7 +836,7 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
831 int readcol = column; 836 int readcol = column;
832 int readend = column + thislen; 837 int readend = column + thislen;
833 int lastgap = 0; 838 int lastgap = 0;
834 uint8_t *oob_buf = this->page_buf + mtd->writesize; 839 uint8_t *oob_buf = this->oob_buf;
835 840
836 for (free = this->ecclayout->oobfree; free->length; ++free) { 841 for (free = this->ecclayout->oobfree; free->length; ++free) {
837 if (readcol >= lastgap) 842 if (readcol >= lastgap)
@@ -849,7 +854,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
849 int n = ed - st; 854 int n = ed - st;
850 memcpy(buf, oob_buf + st, n); 855 memcpy(buf, oob_buf + st, n);
851 buf += n; 856 buf += n;
852 } 857 } else
858 break;
853 } 859 }
854 return 0; 860 return 0;
855} 861}
@@ -947,9 +953,9 @@ static int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len,
947 953
948/** 954/**
949 * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band 955 * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band
950 * @mtd: MTD device structure 956 * @param mtd: MTD device structure
951 * @from: offset to read from 957 * @param from: offset to read from
952 * @ops: oob operation description structure 958 * @param ops: oob operation description structure
953 */ 959 */
954static int onenand_read_oob(struct mtd_info *mtd, loff_t from, 960static int onenand_read_oob(struct mtd_info *mtd, loff_t from,
955 struct mtd_oob_ops *ops) 961 struct mtd_oob_ops *ops)
@@ -1017,7 +1023,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
1017 * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan 1023 * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan
1018 * @param mtd MTD device structure 1024 * @param mtd MTD device structure
1019 * @param from offset to read from 1025 * @param from offset to read from
1020 * @param @ops oob operation description structure 1026 * @param ops oob operation description structure
1021 * 1027 *
1022 * OneNAND read out-of-band data from the spare area for bbt scan 1028 * OneNAND read out-of-band data from the spare area for bbt scan
1023 */ 1029 */
@@ -1093,7 +1099,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
1093static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to) 1099static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to)
1094{ 1100{
1095 struct onenand_chip *this = mtd->priv; 1101 struct onenand_chip *this = mtd->priv;
1096 char *readp = this->page_buf + mtd->writesize; 1102 char oobbuf[64];
1097 int status, i; 1103 int status, i;
1098 1104
1099 this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize); 1105 this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize);
@@ -1102,9 +1108,9 @@ static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to
1102 if (status) 1108 if (status)
1103 return status; 1109 return status;
1104 1110
1105 this->read_bufferram(mtd, ONENAND_SPARERAM, readp, 0, mtd->oobsize); 1111 this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize);
1106 for(i = 0; i < mtd->oobsize; i++) 1112 for (i = 0; i < mtd->oobsize; i++)
1107 if (buf[i] != 0xFF && buf[i] != readp[i]) 1113 if (buf[i] != 0xFF && buf[i] != oobbuf[i])
1108 return -EBADMSG; 1114 return -EBADMSG;
1109 1115
1110 return 0; 1116 return 0;
@@ -1290,7 +1296,8 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
1290 int n = ed - st; 1296 int n = ed - st;
1291 memcpy(oob_buf + st, buf, n); 1297 memcpy(oob_buf + st, buf, n);
1292 buf += n; 1298 buf += n;
1293 } 1299 } else
1300 break;
1294 } 1301 }
1295 return 0; 1302 return 0;
1296} 1303}
@@ -1312,6 +1319,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1312 struct onenand_chip *this = mtd->priv; 1319 struct onenand_chip *this = mtd->priv;
1313 int column, ret = 0, oobsize; 1320 int column, ret = 0, oobsize;
1314 int written = 0; 1321 int written = 0;
1322 u_char *oobbuf;
1315 1323
1316 DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len); 1324 DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len);
1317 1325
@@ -1331,7 +1339,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1331 } 1339 }
1332 1340
1333 /* For compatibility with NAND: Do not allow write past end of page */ 1341 /* For compatibility with NAND: Do not allow write past end of page */
1334 if (column + len > oobsize) { 1342 if (unlikely(column + len > oobsize)) {
1335 printk(KERN_ERR "onenand_write_oob: " 1343 printk(KERN_ERR "onenand_write_oob: "
1336 "Attempt to write past end of page\n"); 1344 "Attempt to write past end of page\n");
1337 return -EINVAL; 1345 return -EINVAL;
@@ -1348,6 +1356,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1348 /* Grab the lock and see if the device is available */ 1356 /* Grab the lock and see if the device is available */
1349 onenand_get_device(mtd, FL_WRITING); 1357 onenand_get_device(mtd, FL_WRITING);
1350 1358
1359 oobbuf = this->oob_buf;
1360
1351 /* Loop until all data write */ 1361 /* Loop until all data write */
1352 while (written < len) { 1362 while (written < len) {
1353 int thislen = min_t(int, oobsize, len - written); 1363 int thislen = min_t(int, oobsize, len - written);
@@ -1358,12 +1368,12 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1358 1368
1359 /* We send data to spare ram with oobsize 1369 /* We send data to spare ram with oobsize
1360 * to prevent byte access */ 1370 * to prevent byte access */
1361 memset(this->page_buf, 0xff, mtd->oobsize); 1371 memset(oobbuf, 0xff, mtd->oobsize);
1362 if (mode == MTD_OOB_AUTO) 1372 if (mode == MTD_OOB_AUTO)
1363 onenand_fill_auto_oob(mtd, this->page_buf, buf, column, thislen); 1373 onenand_fill_auto_oob(mtd, oobbuf, buf, column, thislen);
1364 else 1374 else
1365 memcpy(this->page_buf + column, buf, thislen); 1375 memcpy(oobbuf + column, buf, thislen);
1366 this->write_bufferram(mtd, ONENAND_SPARERAM, this->page_buf, 0, mtd->oobsize); 1376 this->write_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize);
1367 1377
1368 this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize); 1378 this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize);
1369 1379
@@ -1375,7 +1385,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1375 break; 1385 break;
1376 } 1386 }
1377 1387
1378 ret = onenand_verify_oob(mtd, this->page_buf, to); 1388 ret = onenand_verify_oob(mtd, oobbuf, to);
1379 if (ret) { 1389 if (ret) {
1380 printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret); 1390 printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret);
1381 break; 1391 break;
@@ -1400,9 +1410,9 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1400 1410
1401/** 1411/**
1402 * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band 1412 * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band
1403 * @mtd: MTD device structure 1413 * @param mtd: MTD device structure
1404 * @from: offset to read from 1414 * @param to: offset to write
1405 * @ops: oob operation description structure 1415 * @param ops: oob operation description structure
1406 */ 1416 */
1407static int onenand_write_oob(struct mtd_info *mtd, loff_t to, 1417static int onenand_write_oob(struct mtd_info *mtd, loff_t to,
1408 struct mtd_oob_ops *ops) 1418 struct mtd_oob_ops *ops)
@@ -1616,6 +1626,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
1616 * @param mtd MTD device structure 1626 * @param mtd MTD device structure
1617 * @param ofs offset relative to mtd start 1627 * @param ofs offset relative to mtd start
1618 * @param len number of bytes to lock or unlock 1628 * @param len number of bytes to lock or unlock
1629 * @param cmd lock or unlock command
1619 * 1630 *
1620 * Lock or unlock one or more blocks 1631 * Lock or unlock one or more blocks
1621 */ 1632 */
@@ -2117,10 +2128,11 @@ static void onenand_check_features(struct mtd_info *mtd)
2117} 2128}
2118 2129
2119/** 2130/**
2120 * onenand_print_device_info - Print device ID 2131 * onenand_print_device_info - Print device & version ID
2121 * @param device device ID 2132 * @param device device ID
2133 * @param version version ID
2122 * 2134 *
2123 * Print device ID 2135 * Print device & version ID
2124 */ 2136 */
2125static void onenand_print_device_info(int device, int version) 2137static void onenand_print_device_info(int device, int version)
2126{ 2138{
@@ -2320,15 +2332,25 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
2320 2332
2321 /* Allocate buffers, if necessary */ 2333 /* Allocate buffers, if necessary */
2322 if (!this->page_buf) { 2334 if (!this->page_buf) {
2323 size_t len; 2335 this->page_buf = kzalloc(mtd->writesize, GFP_KERNEL);
2324 len = mtd->writesize + mtd->oobsize;
2325 this->page_buf = kmalloc(len, GFP_KERNEL);
2326 if (!this->page_buf) { 2336 if (!this->page_buf) {
2327 printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); 2337 printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n");
2328 return -ENOMEM; 2338 return -ENOMEM;
2329 } 2339 }
2330 this->options |= ONENAND_PAGEBUF_ALLOC; 2340 this->options |= ONENAND_PAGEBUF_ALLOC;
2331 } 2341 }
2342 if (!this->oob_buf) {
2343 this->oob_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
2344 if (!this->oob_buf) {
2345 printk(KERN_ERR "onenand_scan(): Can't allocate oob_buf\n");
2346 if (this->options & ONENAND_PAGEBUF_ALLOC) {
2347 this->options &= ~ONENAND_PAGEBUF_ALLOC;
2348 kfree(this->page_buf);
2349 }
2350 return -ENOMEM;
2351 }
2352 this->options |= ONENAND_OOBBUF_ALLOC;
2353 }
2332 2354
2333 this->state = FL_READY; 2355 this->state = FL_READY;
2334 init_waitqueue_head(&this->wq); 2356 init_waitqueue_head(&this->wq);
@@ -2367,6 +2389,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
2367 for (i = 0; this->ecclayout->oobfree[i].length; i++) 2389 for (i = 0; this->ecclayout->oobfree[i].length; i++)
2368 this->ecclayout->oobavail += 2390 this->ecclayout->oobavail +=
2369 this->ecclayout->oobfree[i].length; 2391 this->ecclayout->oobfree[i].length;
2392 mtd->oobavail = this->ecclayout->oobavail;
2370 2393
2371 mtd->ecclayout = this->ecclayout; 2394 mtd->ecclayout = this->ecclayout;
2372 2395
@@ -2424,9 +2447,11 @@ void onenand_release(struct mtd_info *mtd)
2424 kfree(bbm->bbt); 2447 kfree(bbm->bbt);
2425 kfree(this->bbm); 2448 kfree(this->bbm);
2426 } 2449 }
2427 /* Buffer allocated by onenand_scan */ 2450 /* Buffers allocated by onenand_scan */
2428 if (this->options & ONENAND_PAGEBUF_ALLOC) 2451 if (this->options & ONENAND_PAGEBUF_ALLOC)
2429 kfree(this->page_buf); 2452 kfree(this->page_buf);
2453 if (this->options & ONENAND_OOBBUF_ALLOC)
2454 kfree(this->oob_buf);
2430} 2455}
2431 2456
2432EXPORT_SYMBOL_GPL(onenand_scan); 2457EXPORT_SYMBOL_GPL(onenand_scan);
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 72995777f809..b406ecfa7268 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -858,19 +858,7 @@ static struct eisa_device_id vortex_eisa_ids[] = {
858}; 858};
859MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); 859MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids);
860 860
861static int vortex_eisa_probe(struct device *device); 861static int __init vortex_eisa_probe(struct device *device)
862static int vortex_eisa_remove(struct device *device);
863
864static struct eisa_driver vortex_eisa_driver = {
865 .id_table = vortex_eisa_ids,
866 .driver = {
867 .name = "3c59x",
868 .probe = vortex_eisa_probe,
869 .remove = vortex_eisa_remove
870 }
871};
872
873static int vortex_eisa_probe(struct device *device)
874{ 862{
875 void __iomem *ioaddr; 863 void __iomem *ioaddr;
876 struct eisa_device *edev; 864 struct eisa_device *edev;
@@ -893,7 +881,7 @@ static int vortex_eisa_probe(struct device *device)
893 return 0; 881 return 0;
894} 882}
895 883
896static int vortex_eisa_remove(struct device *device) 884static int __devexit vortex_eisa_remove(struct device *device)
897{ 885{
898 struct eisa_device *edev; 886 struct eisa_device *edev;
899 struct net_device *dev; 887 struct net_device *dev;
@@ -918,7 +906,17 @@ static int vortex_eisa_remove(struct device *device)
918 free_netdev(dev); 906 free_netdev(dev);
919 return 0; 907 return 0;
920} 908}
921#endif 909
910static struct eisa_driver vortex_eisa_driver = {
911 .id_table = vortex_eisa_ids,
912 .driver = {
913 .name = "3c59x",
914 .probe = vortex_eisa_probe,
915 .remove = __devexit_p(vortex_eisa_remove)
916 }
917};
918
919#endif /* CONFIG_EISA */
922 920
923/* returns count found (>= 0), or negative on error */ 921/* returns count found (>= 0), or negative on error */
924static int __init vortex_eisa_init(void) 922static int __init vortex_eisa_init(void)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index dae0aa408bc4..753695b624b3 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2373,22 +2373,23 @@ config CHELSIO_T1_NAPI
2373 when the driver is receiving lots of packets from the card. 2373 when the driver is receiving lots of packets from the card.
2374 2374
2375config CHELSIO_T3 2375config CHELSIO_T3
2376 tristate "Chelsio Communications T3 10Gb Ethernet support" 2376 tristate "Chelsio Communications T3 10Gb Ethernet support"
2377 depends on PCI 2377 depends on PCI
2378 help 2378 select FW_LOADER
2379 This driver supports Chelsio T3-based gigabit and 10Gb Ethernet 2379 help
2380 adapters. 2380 This driver supports Chelsio T3-based gigabit and 10Gb Ethernet
2381 adapters.
2381 2382
2382 For general information about Chelsio and our products, visit 2383 For general information about Chelsio and our products, visit
2383 our website at <http://www.chelsio.com>. 2384 our website at <http://www.chelsio.com>.
2384 2385
2385 For customer support, please visit our customer support page at 2386 For customer support, please visit our customer support page at
2386 <http://www.chelsio.com/support.htm>. 2387 <http://www.chelsio.com/support.htm>.
2387 2388
2388 Please send feedback to <linux-bugs@chelsio.com>. 2389 Please send feedback to <linux-bugs@chelsio.com>.
2389 2390
2390 To compile this driver as a module, choose M here: the module 2391 To compile this driver as a module, choose M here: the module
2391 will be called cxgb3. 2392 will be called cxgb3.
2392 2393
2393config EHEA 2394config EHEA
2394 tristate "eHEA Ethernet support" 2395 tristate "eHEA Ethernet support"
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 314dbaabb642..69482e0d849b 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -334,7 +334,6 @@ u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr)
334 int i; 334 int i;
335 335
336 crc32 = ether_crc_le(6, mc_addr); 336 crc32 = ether_crc_le(6, mc_addr);
337 crc32 = ~crc32;
338 for (i = 0; i < 32; i++) 337 for (i = 0; i < 32; i++)
339 value |= (((crc32 >> i) & 1) << (31 - i)); 338 value |= (((crc32 >> i) & 1) << (31 - i));
340 339
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 88d4f70035bb..8606eac5bec8 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1328,7 +1328,7 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb,
1328 1328
1329 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 1329 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1330 cso = skb->h.raw - skb->data; 1330 cso = skb->h.raw - skb->data;
1331 css = (skb->h.raw + skb->csum) - skb->data; 1331 css = (skb->h.raw + skb->csum_offset) - skb->data;
1332 if (unlikely(cso & 0x1)) { 1332 if (unlikely(cso & 0x1)) {
1333 printk(KERN_DEBUG "%s: payload offset != even number\n", 1333 printk(KERN_DEBUG "%s: payload offset != even number\n",
1334 atl1_driver_name); 1334 atl1_driver_name);
@@ -1562,7 +1562,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1562 /* mss will be nonzero if we're doing segment offload (TSO/GSO) */ 1562 /* mss will be nonzero if we're doing segment offload (TSO/GSO) */
1563 mss = skb_shinfo(skb)->gso_size; 1563 mss = skb_shinfo(skb)->gso_size;
1564 if (mss) { 1564 if (mss) {
1565 if (skb->protocol == ntohs(ETH_P_IP)) { 1565 if (skb->protocol == htons(ETH_P_IP)) {
1566 proto_hdr_len = ((skb->h.raw - skb->data) + 1566 proto_hdr_len = ((skb->h.raw - skb->data) +
1567 (skb->h.th->doff << 2)); 1567 (skb->h.th->doff << 2));
1568 if (unlikely(proto_hdr_len > len)) { 1568 if (unlikely(proto_hdr_len > len)) {
@@ -2320,6 +2320,16 @@ static void __devexit atl1_remove(struct pci_dev *pdev)
2320 return; 2320 return;
2321 2321
2322 adapter = netdev_priv(netdev); 2322 adapter = netdev_priv(netdev);
2323
2324 /* Some atl1 boards lack persistent storage for their MAC, and get it
2325 * from the BIOS during POST. If we've been messing with the MAC
2326 * address, we need to save the permanent one.
2327 */
2328 if (memcmp(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN)) {
2329 memcpy(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN);
2330 atl1_set_mac_addr(&adapter->hw);
2331 }
2332
2323 iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE); 2333 iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE);
2324 unregister_netdev(netdev); 2334 unregister_netdev(netdev);
2325 pci_iounmap(pdev, adapter->hw.hw_addr); 2335 pci_iounmap(pdev, adapter->hw.hw_addr);
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index aaada572732a..d742bfe24471 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1709,7 +1709,7 @@ static void __b44_set_rx_mode(struct net_device *dev)
1709 bw32(bp, B44_RXCONFIG, val); 1709 bw32(bp, B44_RXCONFIG, val);
1710 } else { 1710 } else {
1711 unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; 1711 unsigned char zero[6] = {0, 0, 0, 0, 0, 0};
1712 int i = 0; 1712 int i = 1;
1713 1713
1714 __b44_set_mac_addr(bp); 1714 __b44_set_mac_addr(bp);
1715 1715
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index c12e5ea61819..0b7aded8dcfd 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.5.5" 57#define DRV_MODULE_VERSION "1.5.7"
58#define DRV_MODULE_RELDATE "February 1, 2007" 58#define DRV_MODULE_RELDATE "March 29, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -2033,8 +2033,8 @@ bnx2_has_work(struct bnx2 *bp)
2033 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) 2033 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
2034 return 1; 2034 return 1;
2035 2035
2036 if (((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != 0) != 2036 if ((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) !=
2037 bp->link_up) 2037 (sblk->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE))
2038 return 1; 2038 return 1;
2039 2039
2040 return 0; 2040 return 0;
@@ -3099,20 +3099,18 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3099 3099
3100 if ((align_start = (offset32 & 3))) { 3100 if ((align_start = (offset32 & 3))) {
3101 offset32 &= ~3; 3101 offset32 &= ~3;
3102 len32 += (4 - align_start); 3102 len32 += align_start;
3103 if (len32 < 4)
3104 len32 = 4;
3103 if ((rc = bnx2_nvram_read(bp, offset32, start, 4))) 3105 if ((rc = bnx2_nvram_read(bp, offset32, start, 4)))
3104 return rc; 3106 return rc;
3105 } 3107 }
3106 3108
3107 if (len32 & 3) { 3109 if (len32 & 3) {
3108 if ((len32 > 4) || !align_start) { 3110 align_end = 4 - (len32 & 3);
3109 align_end = 4 - (len32 & 3); 3111 len32 += align_end;
3110 len32 += align_end; 3112 if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, end, 4)))
3111 if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, 3113 return rc;
3112 end, 4))) {
3113 return rc;
3114 }
3115 }
3116 } 3114 }
3117 3115
3118 if (align_start || align_end) { 3116 if (align_start || align_end) {
@@ -3187,17 +3185,17 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3187 if ((rc = bnx2_enable_nvram_write(bp)) != 0) 3185 if ((rc = bnx2_enable_nvram_write(bp)) != 0)
3188 goto nvram_write_end; 3186 goto nvram_write_end;
3189 3187
3190 /* Erase the page */
3191 if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
3192 goto nvram_write_end;
3193
3194 /* Re-enable the write again for the actual write */
3195 bnx2_enable_nvram_write(bp);
3196
3197 /* Loop to write back the buffer data from page_start to 3188 /* Loop to write back the buffer data from page_start to
3198 * data_start */ 3189 * data_start */
3199 i = 0; 3190 i = 0;
3200 if (bp->flash_info->buffered == 0) { 3191 if (bp->flash_info->buffered == 0) {
3192 /* Erase the page */
3193 if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
3194 goto nvram_write_end;
3195
3196 /* Re-enable the write again for the actual write */
3197 bnx2_enable_nvram_write(bp);
3198
3201 for (addr = page_start; addr < data_start; 3199 for (addr = page_start; addr < data_start;
3202 addr += 4, i += 4) { 3200 addr += 4, i += 4) {
3203 3201
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index e23deeb7d06d..8d1379633698 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -112,8 +112,7 @@ enum {
112}; 112};
113 113
114enum { 114enum {
115 SUPPORTED_OFFLOAD = 1 << 24, 115 SUPPORTED_IRQ = 1 << 24
116 SUPPORTED_IRQ = 1 << 25
117}; 116};
118 117
119enum { /* adapter interrupt-maintained statistics */ 118enum { /* adapter interrupt-maintained statistics */
@@ -260,6 +259,10 @@ struct mac_stats {
260 unsigned long serdes_signal_loss; 259 unsigned long serdes_signal_loss;
261 unsigned long xaui_pcs_ctc_err; 260 unsigned long xaui_pcs_ctc_err;
262 unsigned long xaui_pcs_align_change; 261 unsigned long xaui_pcs_align_change;
262
263 unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */
264 unsigned long num_resets; /* # times reset due to stuck TX */
265
263}; 266};
264 267
265struct tp_mib_stats { 268struct tp_mib_stats {
@@ -354,6 +357,9 @@ enum {
354 MC5_MODE_72_BIT = 2 357 MC5_MODE_72_BIT = 2
355}; 358};
356 359
360/* MC5 min active region size */
361enum { MC5_MIN_TIDS = 16 };
362
357struct vpd_params { 363struct vpd_params {
358 unsigned int cclk; 364 unsigned int cclk;
359 unsigned int mclk; 365 unsigned int mclk;
@@ -398,6 +404,13 @@ struct adapter_params {
398 unsigned int stats_update_period; /* MAC stats accumulation period */ 404 unsigned int stats_update_period; /* MAC stats accumulation period */
399 unsigned int linkpoll_period; /* link poll period in 0.1s */ 405 unsigned int linkpoll_period; /* link poll period in 0.1s */
400 unsigned int rev; /* chip revision */ 406 unsigned int rev; /* chip revision */
407 unsigned int offload;
408};
409
410enum { /* chip revisions */
411 T3_REV_A = 0,
412 T3_REV_B = 2,
413 T3_REV_B2 = 3,
401}; 414};
402 415
403struct trace_params { 416struct trace_params {
@@ -465,6 +478,13 @@ struct cmac {
465 struct adapter *adapter; 478 struct adapter *adapter;
466 unsigned int offset; 479 unsigned int offset;
467 unsigned int nucast; /* # of address filters for unicast MACs */ 480 unsigned int nucast; /* # of address filters for unicast MACs */
481 unsigned int tx_tcnt;
482 unsigned int tx_xcnt;
483 u64 tx_mcnt;
484 unsigned int rx_xcnt;
485 u64 rx_mcnt;
486 unsigned int toggle_cnt;
487 unsigned int txen;
468 struct mac_stats stats; 488 struct mac_stats stats;
469}; 489};
470 490
@@ -588,7 +608,7 @@ static inline int is_10G(const struct adapter *adap)
588 608
589static inline int is_offload(const struct adapter *adap) 609static inline int is_offload(const struct adapter *adap)
590{ 610{
591 return adapter_info(adap)->caps & SUPPORTED_OFFLOAD; 611 return adap->params.offload;
592} 612}
593 613
594static inline unsigned int core_ticks_per_usec(const struct adapter *adap) 614static inline unsigned int core_ticks_per_usec(const struct adapter *adap)
@@ -666,6 +686,7 @@ int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]);
666int t3_mac_set_num_ucast(struct cmac *mac, int n); 686int t3_mac_set_num_ucast(struct cmac *mac, int n);
667const struct mac_stats *t3_mac_update_stats(struct cmac *mac); 687const struct mac_stats *t3_mac_update_stats(struct cmac *mac);
668int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); 688int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc);
689int t3b2_mac_watchdog_task(struct cmac *mac);
669 690
670void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode); 691void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode);
671int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, 692int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 7ff834e45d6b..67b4b219d927 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -42,6 +42,7 @@
42#include <linux/workqueue.h> 42#include <linux/workqueue.h>
43#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
44#include <linux/rtnetlink.h> 44#include <linux/rtnetlink.h>
45#include <linux/firmware.h>
45#include <asm/uaccess.h> 46#include <asm/uaccess.h>
46 47
47#include "common.h" 48#include "common.h"
@@ -184,16 +185,24 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
184 int speed, int duplex, int pause) 185 int speed, int duplex, int pause)
185{ 186{
186 struct net_device *dev = adapter->port[port_id]; 187 struct net_device *dev = adapter->port[port_id];
188 struct port_info *pi = netdev_priv(dev);
189 struct cmac *mac = &pi->mac;
187 190
188 /* Skip changes from disabled ports. */ 191 /* Skip changes from disabled ports. */
189 if (!netif_running(dev)) 192 if (!netif_running(dev))
190 return; 193 return;
191 194
192 if (link_stat != netif_carrier_ok(dev)) { 195 if (link_stat != netif_carrier_ok(dev)) {
193 if (link_stat) 196 if (link_stat) {
197 t3_mac_enable(mac, MAC_DIRECTION_RX);
194 netif_carrier_on(dev); 198 netif_carrier_on(dev);
195 else 199 } else {
196 netif_carrier_off(dev); 200 netif_carrier_off(dev);
201 pi->phy.ops->power_down(&pi->phy, 1);
202 t3_mac_disable(mac, MAC_DIRECTION_RX);
203 t3_link_start(&pi->phy, mac, &pi->link_config);
204 }
205
197 link_report(dev); 206 link_report(dev);
198 } 207 }
199} 208}
@@ -406,7 +415,7 @@ static void quiesce_rx(struct adapter *adap)
406static int setup_sge_qsets(struct adapter *adap) 415static int setup_sge_qsets(struct adapter *adap)
407{ 416{
408 int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0; 417 int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0;
409 unsigned int ntxq = is_offload(adap) ? SGE_TXQ_PER_SET : 1; 418 unsigned int ntxq = SGE_TXQ_PER_SET;
410 419
411 if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) 420 if (adap->params.rev > 0 && !(adap->flags & USING_MSI))
412 irq_idx = -1; 421 irq_idx = -1;
@@ -484,12 +493,14 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
484static ssize_t set_nfilters(struct net_device *dev, unsigned int val) 493static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
485{ 494{
486 struct adapter *adap = dev->priv; 495 struct adapter *adap = dev->priv;
496 int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
487 497
488 if (adap->flags & FULL_INIT_DONE) 498 if (adap->flags & FULL_INIT_DONE)
489 return -EBUSY; 499 return -EBUSY;
490 if (val && adap->params.rev == 0) 500 if (val && adap->params.rev == 0)
491 return -EINVAL; 501 return -EINVAL;
492 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers) 502 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers -
503 min_tids)
493 return -EINVAL; 504 return -EINVAL;
494 adap->params.mc5.nfilters = val; 505 adap->params.mc5.nfilters = val;
495 return 0; 506 return 0;
@@ -507,7 +518,8 @@ static ssize_t set_nservers(struct net_device *dev, unsigned int val)
507 518
508 if (adap->flags & FULL_INIT_DONE) 519 if (adap->flags & FULL_INIT_DONE)
509 return -EBUSY; 520 return -EBUSY;
510 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters) 521 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters -
522 MC5_MIN_TIDS)
511 return -EINVAL; 523 return -EINVAL;
512 adap->params.mc5.nservers = val; 524 adap->params.mc5.nservers = val;
513 return 0; 525 return 0;
@@ -707,6 +719,28 @@ static void bind_qsets(struct adapter *adap)
707 } 719 }
708} 720}
709 721
722#define FW_FNAME "t3fw-%d.%d.%d.bin"
723
724static int upgrade_fw(struct adapter *adap)
725{
726 int ret;
727 char buf[64];
728 const struct firmware *fw;
729 struct device *dev = &adap->pdev->dev;
730
731 snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR,
732 FW_VERSION_MINOR, FW_VERSION_MICRO);
733 ret = request_firmware(&fw, buf, dev);
734 if (ret < 0) {
735 dev_err(dev, "could not upgrade firmware: unable to load %s\n",
736 buf);
737 return ret;
738 }
739 ret = t3_load_fw(adap, fw->data, fw->size);
740 release_firmware(fw);
741 return ret;
742}
743
710/** 744/**
711 * cxgb_up - enable the adapter 745 * cxgb_up - enable the adapter
712 * @adapter: adapter being enabled 746 * @adapter: adapter being enabled
@@ -723,6 +757,8 @@ static int cxgb_up(struct adapter *adap)
723 757
724 if (!(adap->flags & FULL_INIT_DONE)) { 758 if (!(adap->flags & FULL_INIT_DONE)) {
725 err = t3_check_fw_version(adap); 759 err = t3_check_fw_version(adap);
760 if (err == -EINVAL)
761 err = upgrade_fw(adap);
726 if (err) 762 if (err)
727 goto out; 763 goto out;
728 764
@@ -734,6 +770,8 @@ static int cxgb_up(struct adapter *adap)
734 if (err) 770 if (err)
735 goto out; 771 goto out;
736 772
773 t3_write_reg(adap, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12));
774
737 err = setup_sge_qsets(adap); 775 err = setup_sge_qsets(adap);
738 if (err) 776 if (err)
739 goto out; 777 goto out;
@@ -894,7 +932,7 @@ static int cxgb_open(struct net_device *dev)
894 return err; 932 return err;
895 933
896 set_bit(pi->port_id, &adapter->open_device_map); 934 set_bit(pi->port_id, &adapter->open_device_map);
897 if (!ofld_disable) { 935 if (is_offload(adapter) && !ofld_disable) {
898 err = offload_open(dev); 936 err = offload_open(dev);
899 if (err) 937 if (err)
900 printk(KERN_WARNING 938 printk(KERN_WARNING
@@ -1031,7 +1069,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
1031 "VLANinsertions ", 1069 "VLANinsertions ",
1032 "TxCsumOffload ", 1070 "TxCsumOffload ",
1033 "RxCsumGood ", 1071 "RxCsumGood ",
1034 "RxDrops " 1072 "RxDrops ",
1073
1074 "CheckTXEnToggled ",
1075 "CheckResets ",
1076
1035}; 1077};
1036 1078
1037static int get_stats_count(struct net_device *dev) 1079static int get_stats_count(struct net_device *dev)
@@ -1145,6 +1187,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
1145 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM); 1187 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM);
1146 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD); 1188 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD);
1147 *data++ = s->rx_cong_drops; 1189 *data++ = s->rx_cong_drops;
1190
1191 *data++ = s->num_toggled;
1192 *data++ = s->num_resets;
1148} 1193}
1149 1194
1150static inline void reg_block_dump(struct adapter *ap, void *buf, 1195static inline void reg_block_dump(struct adapter *ap, void *buf,
@@ -1362,23 +1407,27 @@ static int set_rx_csum(struct net_device *dev, u32 data)
1362 1407
1363static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1408static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1364{ 1409{
1365 struct adapter *adapter = dev->priv; 1410 const struct adapter *adapter = dev->priv;
1411 const struct port_info *pi = netdev_priv(dev);
1412 const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset];
1366 1413
1367 e->rx_max_pending = MAX_RX_BUFFERS; 1414 e->rx_max_pending = MAX_RX_BUFFERS;
1368 e->rx_mini_max_pending = 0; 1415 e->rx_mini_max_pending = 0;
1369 e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS; 1416 e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS;
1370 e->tx_max_pending = MAX_TXQ_ENTRIES; 1417 e->tx_max_pending = MAX_TXQ_ENTRIES;
1371 1418
1372 e->rx_pending = adapter->params.sge.qset[0].fl_size; 1419 e->rx_pending = q->fl_size;
1373 e->rx_mini_pending = adapter->params.sge.qset[0].rspq_size; 1420 e->rx_mini_pending = q->rspq_size;
1374 e->rx_jumbo_pending = adapter->params.sge.qset[0].jumbo_size; 1421 e->rx_jumbo_pending = q->jumbo_size;
1375 e->tx_pending = adapter->params.sge.qset[0].txq_size[0]; 1422 e->tx_pending = q->txq_size[0];
1376} 1423}
1377 1424
1378static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1425static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1379{ 1426{
1380 int i; 1427 int i;
1428 struct qset_params *q;
1381 struct adapter *adapter = dev->priv; 1429 struct adapter *adapter = dev->priv;
1430 const struct port_info *pi = netdev_priv(dev);
1382 1431
1383 if (e->rx_pending > MAX_RX_BUFFERS || 1432 if (e->rx_pending > MAX_RX_BUFFERS ||
1384 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || 1433 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS ||
@@ -1393,9 +1442,8 @@ static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1393 if (adapter->flags & FULL_INIT_DONE) 1442 if (adapter->flags & FULL_INIT_DONE)
1394 return -EBUSY; 1443 return -EBUSY;
1395 1444
1396 for (i = 0; i < SGE_QSETS; ++i) { 1445 q = &adapter->params.sge.qset[pi->first_qset];
1397 struct qset_params *q = &adapter->params.sge.qset[i]; 1446 for (i = 0; i < pi->nqsets; ++i, ++q) {
1398
1399 q->rspq_size = e->rx_mini_pending; 1447 q->rspq_size = e->rx_mini_pending;
1400 q->fl_size = e->rx_pending; 1448 q->fl_size = e->rx_pending;
1401 q->jumbo_size = e->rx_jumbo_pending; 1449 q->jumbo_size = e->rx_jumbo_pending;
@@ -2067,6 +2115,42 @@ static void check_link_status(struct adapter *adapter)
2067 } 2115 }
2068} 2116}
2069 2117
2118static void check_t3b2_mac(struct adapter *adapter)
2119{
2120 int i;
2121
2122 if (!rtnl_trylock()) /* synchronize with ifdown */
2123 return;
2124
2125 for_each_port(adapter, i) {
2126 struct net_device *dev = adapter->port[i];
2127 struct port_info *p = netdev_priv(dev);
2128 int status;
2129
2130 if (!netif_running(dev))
2131 continue;
2132
2133 status = 0;
2134 if (netif_running(dev) && netif_carrier_ok(dev))
2135 status = t3b2_mac_watchdog_task(&p->mac);
2136 if (status == 1)
2137 p->mac.stats.num_toggled++;
2138 else if (status == 2) {
2139 struct cmac *mac = &p->mac;
2140
2141 t3_mac_set_mtu(mac, dev->mtu);
2142 t3_mac_set_address(mac, 0, dev->dev_addr);
2143 cxgb_set_rxmode(dev);
2144 t3_link_start(&p->phy, mac, &p->link_config);
2145 t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
2146 t3_port_intr_enable(adapter, p->port_id);
2147 p->mac.stats.num_resets++;
2148 }
2149 }
2150 rtnl_unlock();
2151}
2152
2153
2070static void t3_adap_check_task(struct work_struct *work) 2154static void t3_adap_check_task(struct work_struct *work)
2071{ 2155{
2072 struct adapter *adapter = container_of(work, struct adapter, 2156 struct adapter *adapter = container_of(work, struct adapter,
@@ -2087,6 +2171,9 @@ static void t3_adap_check_task(struct work_struct *work)
2087 adapter->check_task_cnt = 0; 2171 adapter->check_task_cnt = 0;
2088 } 2172 }
2089 2173
2174 if (p->rev == T3_REV_B2)
2175 check_t3b2_mac(adapter);
2176
2090 /* Schedule the next check update if any port is active. */ 2177 /* Schedule the next check update if any port is active. */
2091 spin_lock(&adapter->work_lock); 2178 spin_lock(&adapter->work_lock);
2092 if (adapter->open_device_map & PORT_MASK) 2179 if (adapter->open_device_map & PORT_MASK)
@@ -2195,9 +2282,9 @@ static void __devinit print_port_info(struct adapter *adap,
2195 2282
2196 if (!test_bit(i, &adap->registered_device_map)) 2283 if (!test_bit(i, &adap->registered_device_map))
2197 continue; 2284 continue;
2198 printk(KERN_INFO "%s: %s %s RNIC (rev %d) %s%s\n", 2285 printk(KERN_INFO "%s: %s %s %sNIC (rev %d) %s%s\n",
2199 dev->name, ai->desc, pi->port_type->desc, 2286 dev->name, ai->desc, pi->port_type->desc,
2200 adap->params.rev, buf, 2287 is_offload(adap) ? "R" : "", adap->params.rev, buf,
2201 (adap->flags & USING_MSIX) ? " MSI-X" : 2288 (adap->flags & USING_MSIX) ? " MSI-X" :
2202 (adap->flags & USING_MSI) ? " MSI" : ""); 2289 (adap->flags & USING_MSI) ? " MSI" : "");
2203 if (adap->name == dev->name && adap->params.vpd.mclk) 2290 if (adap->name == dev->name && adap->params.vpd.mclk)
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index f6ed033efb56..48649244673e 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -553,7 +553,9 @@ int cxgb3_alloc_atid(struct t3cdev *tdev, struct cxgb3_client *client,
553 struct tid_info *t = &(T3C_DATA(tdev))->tid_maps; 553 struct tid_info *t = &(T3C_DATA(tdev))->tid_maps;
554 554
555 spin_lock_bh(&t->atid_lock); 555 spin_lock_bh(&t->atid_lock);
556 if (t->afree) { 556 if (t->afree &&
557 t->atids_in_use + atomic_read(&t->tids_in_use) + MC5_MIN_TIDS <=
558 t->ntids) {
557 union active_open_entry *p = t->afree; 559 union active_open_entry *p = t->afree;
558 560
559 atid = (p - t->atid_tab) + t->atid_base; 561 atid = (p - t->atid_tab) + t->atid_base;
@@ -741,17 +743,6 @@ static int do_act_establish(struct t3cdev *dev, struct sk_buff *skb)
741 } 743 }
742} 744}
743 745
744static int do_set_tcb_rpl(struct t3cdev *dev, struct sk_buff *skb)
745{
746 struct cpl_set_tcb_rpl *rpl = cplhdr(skb);
747
748 if (rpl->status != CPL_ERR_NONE)
749 printk(KERN_ERR
750 "Unexpected SET_TCB_RPL status %u for tid %u\n",
751 rpl->status, GET_TID(rpl));
752 return CPL_RET_BUF_DONE;
753}
754
755static int do_trace(struct t3cdev *dev, struct sk_buff *skb) 746static int do_trace(struct t3cdev *dev, struct sk_buff *skb)
756{ 747{
757 struct cpl_trace_pkt *p = cplhdr(skb); 748 struct cpl_trace_pkt *p = cplhdr(skb);
@@ -1213,7 +1204,8 @@ void __init cxgb3_offload_init(void)
1213 t3_register_cpl_handler(CPL_CLOSE_CON_RPL, do_hwtid_rpl); 1204 t3_register_cpl_handler(CPL_CLOSE_CON_RPL, do_hwtid_rpl);
1214 t3_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req_rss); 1205 t3_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req_rss);
1215 t3_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish); 1206 t3_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish);
1216 t3_register_cpl_handler(CPL_SET_TCB_RPL, do_set_tcb_rpl); 1207 t3_register_cpl_handler(CPL_SET_TCB_RPL, do_hwtid_rpl);
1208 t3_register_cpl_handler(CPL_GET_TCB_RPL, do_hwtid_rpl);
1217 t3_register_cpl_handler(CPL_RDMA_TERMINATE, do_term); 1209 t3_register_cpl_handler(CPL_RDMA_TERMINATE, do_term);
1218 t3_register_cpl_handler(CPL_RDMA_EC_STATUS, do_hwtid_rpl); 1210 t3_register_cpl_handler(CPL_RDMA_EC_STATUS, do_hwtid_rpl);
1219 t3_register_cpl_handler(CPL_TRACE_PKT, do_trace); 1211 t3_register_cpl_handler(CPL_TRACE_PKT, do_trace);
diff --git a/drivers/net/cxgb3/mc5.c b/drivers/net/cxgb3/mc5.c
index 644d62ea86a6..84c1ffa8e2d3 100644
--- a/drivers/net/cxgb3/mc5.c
+++ b/drivers/net/cxgb3/mc5.c
@@ -328,6 +328,9 @@ int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters,
328 unsigned int tcam_size = mc5->tcam_size; 328 unsigned int tcam_size = mc5->tcam_size;
329 struct adapter *adap = mc5->adapter; 329 struct adapter *adap = mc5->adapter;
330 330
331 if (!tcam_size)
332 return 0;
333
331 if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size) 334 if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size)
332 return -EINVAL; 335 return -EINVAL;
333 336
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index b56c5f52bcdc..e5a553410e24 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1206,6 +1206,14 @@
1206 1206
1207#define A_TP_RX_TRC_KEY0 0x120 1207#define A_TP_RX_TRC_KEY0 0x120
1208 1208
1209#define A_TP_TX_DROP_CNT_CH0 0x12d
1210
1211#define S_TXDROPCNTCH0RCVD 0
1212#define M_TXDROPCNTCH0RCVD 0xffff
1213#define V_TXDROPCNTCH0RCVD(x) ((x) << S_TXDROPCNTCH0RCVD)
1214#define G_TXDROPCNTCH0RCVD(x) (((x) >> S_TXDROPCNTCH0RCVD) & \
1215 M_TXDROPCNTCH0RCVD)
1216
1209#define A_ULPRX_CTL 0x500 1217#define A_ULPRX_CTL 0x500
1210 1218
1211#define S_ROUND_ROBIN 4 1219#define S_ROUND_ROBIN 4
@@ -1226,9 +1234,15 @@
1226 1234
1227#define A_ULPRX_ISCSI_TAGMASK 0x514 1235#define A_ULPRX_ISCSI_TAGMASK 0x514
1228 1236
1237#define S_HPZ0 0
1238#define M_HPZ0 0xf
1239#define V_HPZ0(x) ((x) << S_HPZ0)
1240#define G_HPZ0(x) (((x) >> S_HPZ0) & M_HPZ0)
1241
1229#define A_ULPRX_TDDP_LLIMIT 0x51c 1242#define A_ULPRX_TDDP_LLIMIT 0x51c
1230 1243
1231#define A_ULPRX_TDDP_ULIMIT 0x520 1244#define A_ULPRX_TDDP_ULIMIT 0x520
1245#define A_ULPRX_TDDP_PSZ 0x528
1232 1246
1233#define A_ULPRX_STAG_LLIMIT 0x52c 1247#define A_ULPRX_STAG_LLIMIT 0x52c
1234 1248
@@ -1834,6 +1848,8 @@
1834#define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN) 1848#define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN)
1835#define F_TXPAUSEEN V_TXPAUSEEN(1U) 1849#define F_TXPAUSEEN V_TXPAUSEEN(1U)
1836 1850
1851#define A_XGM_TX_PAUSE_QUANTA 0x808
1852
1837#define A_XGM_RX_CTRL 0x80c 1853#define A_XGM_RX_CTRL 0x80c
1838 1854
1839#define S_RXEN 0 1855#define S_RXEN 0
@@ -1920,11 +1936,20 @@
1920 1936
1921#define A_XGM_TXFIFO_CFG 0x888 1937#define A_XGM_TXFIFO_CFG 0x888
1922 1938
1939#define S_TXIPG 13
1940#define M_TXIPG 0xff
1941#define V_TXIPG(x) ((x) << S_TXIPG)
1942#define G_TXIPG(x) (((x) >> S_TXIPG) & M_TXIPG)
1943
1923#define S_TXFIFOTHRESH 4 1944#define S_TXFIFOTHRESH 4
1924#define M_TXFIFOTHRESH 0x1ff 1945#define M_TXFIFOTHRESH 0x1ff
1925 1946
1926#define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH) 1947#define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH)
1927 1948
1949#define S_ENDROPPKT 21
1950#define V_ENDROPPKT(x) ((x) << S_ENDROPPKT)
1951#define F_ENDROPPKT V_ENDROPPKT(1U)
1952
1928#define A_XGM_SERDES_CTRL 0x890 1953#define A_XGM_SERDES_CTRL 0x890
1929#define A_XGM_SERDES_CTRL0 0x8e0 1954#define A_XGM_SERDES_CTRL0 0x8e0
1930 1955
@@ -2190,6 +2215,13 @@
2190 2215
2191#define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 2216#define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4
2192 2217
2218#define A_XGM_TX_SPI4_SOP_EOP_CNT 0x9a8
2219
2220#define S_TXSPI4SOPCNT 16
2221#define M_TXSPI4SOPCNT 0xffff
2222#define V_TXSPI4SOPCNT(x) ((x) << S_TXSPI4SOPCNT)
2223#define G_TXSPI4SOPCNT(x) (((x) >> S_TXSPI4SOPCNT) & M_TXSPI4SOPCNT)
2224
2193#define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac 2225#define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac
2194 2226
2195#define XGMAC0_1_BASE_ADDR 0xa00 2227#define XGMAC0_1_BASE_ADDR 0xa00
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index c23783432e51..027ab2c3825c 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2631,7 +2631,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
2631 q->txq[TXQ_ETH].stop_thres = nports * 2631 q->txq[TXQ_ETH].stop_thres = nports *
2632 flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); 2632 flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3);
2633 2633
2634 if (ntxq == 1) { 2634 if (!is_offload(adapter)) {
2635#ifdef USE_RX_PAGE 2635#ifdef USE_RX_PAGE
2636 q->fl[0].buf_size = RX_PAGE_SIZE; 2636 q->fl[0].buf_size = RX_PAGE_SIZE;
2637#else 2637#else
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index eaa7a2e89a30..d83f075ef2d7 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -438,23 +438,23 @@ static const struct adapter_info t3_adap_info[] = {
438 {2, 0, 0, 0, 438 {2, 0, 0, 0,
439 F_GPIO2_OEN | F_GPIO4_OEN | 439 F_GPIO2_OEN | F_GPIO4_OEN |
440 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, 440 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5,
441 SUPPORTED_OFFLOAD, 441 0,
442 &mi1_mdio_ops, "Chelsio PE9000"}, 442 &mi1_mdio_ops, "Chelsio PE9000"},
443 {2, 0, 0, 0, 443 {2, 0, 0, 0,
444 F_GPIO2_OEN | F_GPIO4_OEN | 444 F_GPIO2_OEN | F_GPIO4_OEN |
445 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, 445 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5,
446 SUPPORTED_OFFLOAD, 446 0,
447 &mi1_mdio_ops, "Chelsio T302"}, 447 &mi1_mdio_ops, "Chelsio T302"},
448 {1, 0, 0, 0, 448 {1, 0, 0, 0,
449 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | 449 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
450 F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, 450 F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
451 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, 451 SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
452 &mi1_mdio_ext_ops, "Chelsio T310"}, 452 &mi1_mdio_ext_ops, "Chelsio T310"},
453 {2, 0, 0, 0, 453 {2, 0, 0, 0,
454 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | 454 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
455 F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | 455 F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL |
456 F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, 456 F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
457 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, 457 SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
458 &mi1_mdio_ext_ops, "Chelsio T320"}, 458 &mi1_mdio_ext_ops, "Chelsio T320"},
459}; 459};
460 460
@@ -681,7 +681,8 @@ enum {
681 SF_ERASE_SECTOR = 0xd8, /* erase sector */ 681 SF_ERASE_SECTOR = 0xd8, /* erase sector */
682 682
683 FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ 683 FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */
684 FW_VERS_ADDR = 0x77ffc /* flash address holding FW version */ 684 FW_VERS_ADDR = 0x77ffc, /* flash address holding FW version */
685 FW_MIN_SIZE = 8 /* at least version and csum */
685}; 686};
686 687
687/** 688/**
@@ -935,7 +936,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
935 const u32 *p = (const u32 *)fw_data; 936 const u32 *p = (const u32 *)fw_data;
936 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; 937 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
937 938
938 if (size & 3) 939 if ((size & 3) || size < FW_MIN_SIZE)
939 return -EINVAL; 940 return -EINVAL;
940 if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR) 941 if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR)
941 return -EFBIG; 942 return -EFBIG;
@@ -2899,6 +2900,9 @@ static int mc7_init(struct mc7 *mc7, unsigned int mc7_clock, int mem_type)
2899 struct adapter *adapter = mc7->adapter; 2900 struct adapter *adapter = mc7->adapter;
2900 const struct mc7_timing_params *p = &mc7_timings[mem_type]; 2901 const struct mc7_timing_params *p = &mc7_timings[mem_type];
2901 2902
2903 if (!mc7->size)
2904 return 0;
2905
2902 val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); 2906 val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG);
2903 slow = val & F_SLOW; 2907 slow = val & F_SLOW;
2904 width = G_WIDTH(val); 2908 width = G_WIDTH(val);
@@ -3099,8 +3103,10 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
3099 do { /* wait for uP to initialize */ 3103 do { /* wait for uP to initialize */
3100 msleep(20); 3104 msleep(20);
3101 } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); 3105 } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts);
3102 if (!attempts) 3106 if (!attempts) {
3107 CH_ERR(adapter, "uP initialization timed out\n");
3103 goto out_err; 3108 goto out_err;
3109 }
3104 3110
3105 err = 0; 3111 err = 0;
3106out_err: 3112out_err:
@@ -3200,7 +3206,7 @@ static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7,
3200 mc7->name = name; 3206 mc7->name = name;
3201 mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; 3207 mc7->offset = base_addr - MC7_PMRX_BASE_ADDR;
3202 cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); 3208 cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG);
3203 mc7->size = mc7_calc_size(cfg); 3209 mc7->size = mc7->size = G_DEN(cfg) == M_DEN ? 0 : mc7_calc_size(cfg);
3204 mc7->width = G_WIDTH(cfg); 3210 mc7->width = G_WIDTH(cfg);
3205} 3211}
3206 3212
@@ -3227,6 +3233,7 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai)
3227 V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); 3233 V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1));
3228 t3_write_reg(adapter, A_T3DBG_GPIO_EN, 3234 t3_write_reg(adapter, A_T3DBG_GPIO_EN,
3229 ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); 3235 ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL);
3236 t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0);
3230 3237
3231 if (adapter->params.rev == 0 || !uses_xaui(adapter)) 3238 if (adapter->params.rev == 0 || !uses_xaui(adapter))
3232 val |= F_ENRGMII; 3239 val |= F_ENRGMII;
@@ -3243,15 +3250,17 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai)
3243} 3250}
3244 3251
3245/* 3252/*
3246 * Reset the adapter. PCIe cards lose their config space during reset, PCI-X 3253 * Reset the adapter.
3254 * Older PCIe cards lose their config space during reset, PCI-X
3247 * ones don't. 3255 * ones don't.
3248 */ 3256 */
3249int t3_reset_adapter(struct adapter *adapter) 3257int t3_reset_adapter(struct adapter *adapter)
3250{ 3258{
3251 int i; 3259 int i, save_and_restore_pcie =
3260 adapter->params.rev < T3_REV_B2 && is_pcie(adapter);
3252 uint16_t devid = 0; 3261 uint16_t devid = 0;
3253 3262
3254 if (is_pcie(adapter)) 3263 if (save_and_restore_pcie)
3255 pci_save_state(adapter->pdev); 3264 pci_save_state(adapter->pdev);
3256 t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE); 3265 t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE);
3257 3266
@@ -3269,7 +3278,7 @@ int t3_reset_adapter(struct adapter *adapter)
3269 if (devid != 0x1425) 3278 if (devid != 0x1425)
3270 return -1; 3279 return -1;
3271 3280
3272 if (is_pcie(adapter)) 3281 if (save_and_restore_pcie)
3273 pci_restore_state(adapter->pdev); 3282 pci_restore_state(adapter->pdev);
3274 return 0; 3283 return 0;
3275} 3284}
@@ -3323,7 +3332,13 @@ int __devinit t3_prep_adapter(struct adapter *adapter,
3323 p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); 3332 p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size);
3324 p->ntimer_qs = p->cm_size >= (128 << 20) || 3333 p->ntimer_qs = p->cm_size >= (128 << 20) ||
3325 adapter->params.rev > 0 ? 12 : 6; 3334 adapter->params.rev > 0 ? 12 : 6;
3335 }
3336
3337 adapter->params.offload = t3_mc7_size(&adapter->pmrx) &&
3338 t3_mc7_size(&adapter->pmtx) &&
3339 t3_mc7_size(&adapter->cm);
3326 3340
3341 if (is_offload(adapter)) {
3327 adapter->params.mc5.nservers = DEFAULT_NSERVERS; 3342 adapter->params.mc5.nservers = DEFAULT_NSERVERS;
3328 adapter->params.mc5.nfilters = adapter->params.rev > 0 ? 3343 adapter->params.mc5.nfilters = adapter->params.rev > 0 ?
3329 DEFAULT_NFILTERS : 0; 3344 DEFAULT_NFILTERS : 0;
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
index 82278f850259..042e27e291cd 100644
--- a/drivers/net/cxgb3/version.h
+++ b/drivers/net/cxgb3/version.h
@@ -36,6 +36,9 @@
36#define DRV_NAME "cxgb3" 36#define DRV_NAME "cxgb3"
37/* Driver version */ 37/* Driver version */
38#define DRV_VERSION "1.0-ko" 38#define DRV_VERSION "1.0-ko"
39
40/* Firmware version */
39#define FW_VERSION_MAJOR 3 41#define FW_VERSION_MAJOR 3
40#define FW_VERSION_MINOR 2 42#define FW_VERSION_MINOR 3
43#define FW_VERSION_MICRO 0
41#endif /* __CHELSIO_VERSION_H */ 44#endif /* __CHELSIO_VERSION_H */
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index 907a272ae32d..a506792f9575 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -124,9 +124,6 @@ int t3_mac_reset(struct cmac *mac)
124 xaui_serdes_reset(mac); 124 xaui_serdes_reset(mac);
125 } 125 }
126 126
127 if (adap->params.rev > 0)
128 t3_write_reg(adap, A_XGM_PAUSE_TIMER + oft, 0xf000);
129
130 val = F_MAC_RESET_; 127 val = F_MAC_RESET_;
131 if (is_10G(adap)) 128 if (is_10G(adap))
132 val |= F_PCS_RESET_; 129 val |= F_PCS_RESET_;
@@ -145,6 +142,58 @@ int t3_mac_reset(struct cmac *mac)
145 return 0; 142 return 0;
146} 143}
147 144
145int t3b2_mac_reset(struct cmac *mac)
146{
147 struct adapter *adap = mac->adapter;
148 unsigned int oft = mac->offset;
149 u32 val;
150
151 if (!macidx(mac))
152 t3_set_reg_field(adap, A_MPS_CFG, F_PORT0ACTIVE, 0);
153 else
154 t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE, 0);
155
156 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_);
157 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */
158
159 msleep(10);
160
161 /* Check for xgm Rx fifo empty */
162 if (t3_wait_op_done(adap, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + oft,
163 0x80000000, 1, 5, 2)) {
164 CH_ERR(adap, "MAC %d Rx fifo drain failed\n",
165 macidx(mac));
166 return -1;
167 }
168
169 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, 0);
170 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */
171
172 val = F_MAC_RESET_;
173 if (is_10G(adap))
174 val |= F_PCS_RESET_;
175 else if (uses_xaui(adap))
176 val |= F_PCS_RESET_ | F_XG2G_RESET_;
177 else
178 val |= F_RGMII_RESET_ | F_XG2G_RESET_;
179 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val);
180 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */
181 if ((val & F_PCS_RESET_) && adap->params.rev) {
182 msleep(1);
183 t3b_pcs_reset(mac);
184 }
185 t3_write_reg(adap, A_XGM_RX_CFG + oft,
186 F_DISPAUSEFRAMES | F_EN1536BFRAMES |
187 F_RMFCS | F_ENJUMBO | F_ENHASHMCAST);
188
189 if (!macidx(mac))
190 t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT0ACTIVE);
191 else
192 t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT1ACTIVE);
193
194 return 0;
195}
196
148/* 197/*
149 * Set the exact match register 'idx' to recognize the given Ethernet address. 198 * Set the exact match register 'idx' to recognize the given Ethernet address.
150 */ 199 */
@@ -251,9 +300,11 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
251 * Adjust the PAUSE frame watermarks. We always set the LWM, and the 300 * Adjust the PAUSE frame watermarks. We always set the LWM, and the
252 * HWM only if flow-control is enabled. 301 * HWM only if flow-control is enabled.
253 */ 302 */
254 hwm = max(MAC_RXFIFO_SIZE - 3 * mtu, MAC_RXFIFO_SIZE / 2U); 303 hwm = max_t(unsigned int, MAC_RXFIFO_SIZE - 3 * mtu,
255 hwm = min(hwm, 3 * MAC_RXFIFO_SIZE / 4 + 1024); 304 MAC_RXFIFO_SIZE * 38 / 100);
256 lwm = hwm - 1024; 305 hwm = min(hwm, MAC_RXFIFO_SIZE - 8192);
306 lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4);
307
257 v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset); 308 v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset);
258 v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM); 309 v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM);
259 v |= V_RXFIFOPAUSELWM(lwm / 8); 310 v |= V_RXFIFOPAUSELWM(lwm / 8);
@@ -270,7 +321,15 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
270 thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; 321 thres = mtu > thres ? (mtu - thres + 7) / 8 : 0;
271 thres = max(thres, 8U); /* need at least 8 */ 322 thres = max(thres, 8U); /* need at least 8 */
272 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, 323 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset,
273 V_TXFIFOTHRESH(M_TXFIFOTHRESH), V_TXFIFOTHRESH(thres)); 324 V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG),
325 V_TXFIFOTHRESH(thres) | V_TXIPG(1));
326
327 if (adap->params.rev > 0)
328 t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset,
329 (hwm - lwm) * 4 / 8);
330 t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset,
331 MAC_RXFIFO_SIZE * 4 * 8 / 512);
332
274 return 0; 333 return 0;
275} 334}
276 335
@@ -298,12 +357,6 @@ int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc)
298 V_PORTSPEED(M_PORTSPEED), val); 357 V_PORTSPEED(M_PORTSPEED), val);
299 } 358 }
300 359
301 val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft);
302 val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM);
303 if (fc & PAUSE_TX)
304 val |= V_RXFIFOPAUSEHWM(G_RXFIFOPAUSELWM(val) + 128); /* +1KB */
305 t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val);
306
307 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, 360 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN,
308 (fc & PAUSE_RX) ? F_TXPAUSEEN : 0); 361 (fc & PAUSE_RX) ? F_TXPAUSEEN : 0);
309 return 0; 362 return 0;
@@ -314,13 +367,28 @@ int t3_mac_enable(struct cmac *mac, int which)
314 int idx = macidx(mac); 367 int idx = macidx(mac);
315 struct adapter *adap = mac->adapter; 368 struct adapter *adap = mac->adapter;
316 unsigned int oft = mac->offset; 369 unsigned int oft = mac->offset;
317 370 struct mac_stats *s = &mac->stats;
371
318 if (which & MAC_DIRECTION_TX) { 372 if (which & MAC_DIRECTION_TX) {
319 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN); 373 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN);
320 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); 374 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
321 t3_write_reg(adap, A_TP_PIO_DATA, 0xbf000001); 375 t3_write_reg(adap, A_TP_PIO_DATA, 0xc0ede401);
322 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); 376 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
323 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); 377 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
378
379 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx);
380 mac->tx_mcnt = s->tx_frames;
381 mac->tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
382 A_TP_PIO_DATA)));
383 mac->tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
384 A_XGM_TX_SPI4_SOP_EOP_CNT +
385 oft)));
386 mac->rx_mcnt = s->rx_frames;
387 mac->rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
388 A_XGM_RX_SPI4_SOP_EOP_CNT +
389 oft)));
390 mac->txen = F_TXEN;
391 mac->toggle_cnt = 0;
324 } 392 }
325 if (which & MAC_DIRECTION_RX) 393 if (which & MAC_DIRECTION_RX)
326 t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN); 394 t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN);
@@ -331,19 +399,102 @@ int t3_mac_disable(struct cmac *mac, int which)
331{ 399{
332 int idx = macidx(mac); 400 int idx = macidx(mac);
333 struct adapter *adap = mac->adapter; 401 struct adapter *adap = mac->adapter;
402 int val;
334 403
335 if (which & MAC_DIRECTION_TX) { 404 if (which & MAC_DIRECTION_TX) {
336 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); 405 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
337 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); 406 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
338 t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f); 407 t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f);
339 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); 408 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
340 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 0); 409 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
410 mac->txen = 0;
341 } 411 }
342 if (which & MAC_DIRECTION_RX) 412 if (which & MAC_DIRECTION_RX) {
413 t3_set_reg_field(mac->adapter, A_XGM_RESET_CTRL + mac->offset,
414 F_PCS_RESET_, 0);
415 msleep(100);
343 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0); 416 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0);
417 val = F_MAC_RESET_;
418 if (is_10G(adap))
419 val |= F_PCS_RESET_;
420 else if (uses_xaui(adap))
421 val |= F_PCS_RESET_ | F_XG2G_RESET_;
422 else
423 val |= F_RGMII_RESET_ | F_XG2G_RESET_;
424 t3_write_reg(mac->adapter, A_XGM_RESET_CTRL + mac->offset, val);
425 }
344 return 0; 426 return 0;
345} 427}
346 428
429int t3b2_mac_watchdog_task(struct cmac *mac)
430{
431 struct adapter *adap = mac->adapter;
432 struct mac_stats *s = &mac->stats;
433 unsigned int tx_tcnt, tx_xcnt;
434 unsigned int tx_mcnt = s->tx_frames;
435 unsigned int rx_mcnt = s->rx_frames;
436 unsigned int rx_xcnt;
437 int status;
438
439 if (tx_mcnt == mac->tx_mcnt) {
440 tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
441 A_XGM_TX_SPI4_SOP_EOP_CNT +
442 mac->offset)));
443 if (tx_xcnt == 0) {
444 t3_write_reg(adap, A_TP_PIO_ADDR,
445 A_TP_TX_DROP_CNT_CH0 + macidx(mac));
446 tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
447 A_TP_PIO_DATA)));
448 } else {
449 mac->toggle_cnt = 0;
450 return 0;
451 }
452 } else {
453 mac->toggle_cnt = 0;
454 return 0;
455 }
456
457 if (((tx_tcnt != mac->tx_tcnt) &&
458 (tx_xcnt == 0) && (mac->tx_xcnt == 0)) ||
459 ((mac->tx_mcnt == tx_mcnt) &&
460 (tx_xcnt != 0) && (mac->tx_xcnt != 0))) {
461 if (mac->toggle_cnt > 4)
462 status = 2;
463 else
464 status = 1;
465 } else {
466 mac->toggle_cnt = 0;
467 return 0;
468 }
469
470 if (rx_mcnt != mac->rx_mcnt)
471 rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
472 A_XGM_RX_SPI4_SOP_EOP_CNT +
473 mac->offset)));
474 else
475 return 0;
476
477 if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0)
478 status = 2;
479
480 mac->tx_tcnt = tx_tcnt;
481 mac->tx_xcnt = tx_xcnt;
482 mac->tx_mcnt = s->tx_frames;
483 mac->rx_xcnt = rx_xcnt;
484 mac->rx_mcnt = s->rx_frames;
485 if (status == 1) {
486 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
487 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */
488 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, mac->txen);
489 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */
490 mac->toggle_cnt++;
491 } else if (status == 2) {
492 t3b2_mac_reset(mac);
493 mac->toggle_cnt = 0;
494 }
495 return status;
496}
497
347/* 498/*
348 * This function is called periodically to accumulate the current values of the 499 * This function is called periodically to accumulate the current values of the
349 * RMON counters into the port statistics. Since the packet counters are only 500 * RMON counters into the port statistics. Since the packet counters are only
@@ -373,7 +524,11 @@ const struct mac_stats *t3_mac_update_stats(struct cmac *mac)
373 RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES); 524 RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES);
374 525
375 RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES); 526 RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES);
376 mac->stats.rx_too_long += RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT); 527
528 v = RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT);
529 if (mac->adapter->params.rev == T3_REV_B2)
530 v &= 0x7fffffff;
531 mac->stats.rx_too_long += v;
377 532
378 RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES); 533 RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES);
379 RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES); 534 RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES);
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index c8c41f0a47d6..714ea1176ec7 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -414,10 +414,9 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
414 icr &= 0x70; 414 icr &= 0x70;
415 outb(icr, EWRK3_ICR); /* Disable all the IRQs */ 415 outb(icr, EWRK3_ICR); /* Disable all the IRQs */
416 416
417 if (nicsr == (CSR_TXD | CSR_RXD)) 417 if (nicsr != (CSR_TXD | CSR_RXD))
418 return -ENXIO; 418 return -ENXIO;
419 419
420
421 /* Check that the EEPROM is alive and well and not living on Pluto... */ 420 /* Check that the EEPROM is alive and well and not living on Pluto... */
422 for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) { 421 for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) {
423 union { 422 union {
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 46e1697d9cfd..d04214e4e581 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2050,9 +2050,10 @@ static void nv_tx_timeout(struct net_device *dev)
2050 nv_drain_tx(dev); 2050 nv_drain_tx(dev);
2051 nv_init_tx(dev); 2051 nv_init_tx(dev);
2052 setup_hw_rings(dev, NV_SETUP_TX_RING); 2052 setup_hw_rings(dev, NV_SETUP_TX_RING);
2053 netif_wake_queue(dev);
2054 } 2053 }
2055 2054
2055 netif_wake_queue(dev);
2056
2056 /* 4) restart tx engine */ 2057 /* 4) restart tx engine */
2057 nv_start_tx(dev); 2058 nv_start_tx(dev);
2058 spin_unlock_irq(&np->lock); 2059 spin_unlock_irq(&np->lock);
@@ -3536,7 +3537,10 @@ static void nv_do_nic_poll(unsigned long data)
3536 pci_push(base); 3537 pci_push(base);
3537 3538
3538 if (!using_multi_irqs(dev)) { 3539 if (!using_multi_irqs(dev)) {
3539 nv_nic_irq(0, dev); 3540 if (np->desc_ver == DESC_VER_3)
3541 nv_nic_irq_optimized(0, dev);
3542 else
3543 nv_nic_irq(0, dev);
3540 if (np->msi_flags & NV_MSI_X_ENABLED) 3544 if (np->msi_flags & NV_MSI_X_ENABLED)
3541 enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 3545 enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
3542 else 3546 else
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index ca2b21f9d444..07b4c0d7a75c 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -96,17 +96,24 @@ static void ri_tasklet(unsigned long dev)
96 skb->tc_verd = SET_TC_NCLS(skb->tc_verd); 96 skb->tc_verd = SET_TC_NCLS(skb->tc_verd);
97 stats->tx_packets++; 97 stats->tx_packets++;
98 stats->tx_bytes +=skb->len; 98 stats->tx_bytes +=skb->len;
99
100 skb->dev = __dev_get_by_index(skb->iif);
101 if (!skb->dev) {
102 dev_kfree_skb(skb);
103 stats->tx_dropped++;
104 break;
105 }
106 skb->iif = _dev->ifindex;
107
99 if (from & AT_EGRESS) { 108 if (from & AT_EGRESS) {
100 dp->st_rx_frm_egr++; 109 dp->st_rx_frm_egr++;
101 dev_queue_xmit(skb); 110 dev_queue_xmit(skb);
102 } else if (from & AT_INGRESS) { 111 } else if (from & AT_INGRESS) {
103
104 dp->st_rx_frm_ing++; 112 dp->st_rx_frm_ing++;
113 skb_pull(skb, skb->dev->hard_header_len);
105 netif_rx(skb); 114 netif_rx(skb);
106 } else { 115 } else
107 dev_kfree_skb(skb); 116 BUG();
108 stats->tx_dropped++;
109 }
110 } 117 }
111 118
112 if (netif_tx_trylock(_dev)) { 119 if (netif_tx_trylock(_dev)) {
@@ -157,26 +164,10 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev)
157 stats->rx_packets++; 164 stats->rx_packets++;
158 stats->rx_bytes+=skb->len; 165 stats->rx_bytes+=skb->len;
159 166
160 if (!from || !skb->input_dev) { 167 if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) {
161dropped:
162 dev_kfree_skb(skb); 168 dev_kfree_skb(skb);
163 stats->rx_dropped++; 169 stats->rx_dropped++;
164 return ret; 170 return ret;
165 } else {
166 /*
167 * note we could be going
168 * ingress -> egress or
169 * egress -> ingress
170 */
171 skb->dev = skb->input_dev;
172 skb->input_dev = dev;
173 if (from & AT_INGRESS) {
174 skb_pull(skb, skb->dev->hard_header_len);
175 } else {
176 if (!(from & AT_EGRESS)) {
177 goto dropped;
178 }
179 }
180 } 171 }
181 172
182 if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { 173 if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) {
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 340ee99652eb..1d510bdc9b84 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1057,6 +1057,8 @@ static int stir421x_fw_upload(struct irda_usb_cb *self,
1057 1057
1058 if (ret < 0) 1058 if (ret < 0)
1059 break; 1059 break;
1060
1061 mdelay(10);
1060 } 1062 }
1061 1063
1062 kfree(patch_block); 1064 kfree(patch_block);
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 9137e239fac2..2272156af31e 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -321,15 +321,22 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data)
321 pxa_irda_set_speed(si, si->newspeed); 321 pxa_irda_set_speed(si, si->newspeed);
322 si->newspeed = 0; 322 si->newspeed = 0;
323 } else { 323 } else {
324 int i = 64;
325
324 ICCR0 = 0; 326 ICCR0 = 0;
325 pxa_irda_fir_dma_rx_start(si); 327 pxa_irda_fir_dma_rx_start(si);
328 while ((ICSR1 & ICSR1_RNE) && i--)
329 (void)ICDR;
326 ICCR0 = ICCR0_ITR | ICCR0_RXE; 330 ICCR0 = ICCR0_ITR | ICCR0_RXE;
331
332 if (i < 0)
333 printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n");
327 } 334 }
328 netif_wake_queue(dev); 335 netif_wake_queue(dev);
329} 336}
330 337
331/* EIF(Error in FIFO/End in Frame) handler for FIR */ 338/* EIF(Error in FIFO/End in Frame) handler for FIR */
332static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev) 339static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, int icsr0)
333{ 340{
334 unsigned int len, stat, data; 341 unsigned int len, stat, data;
335 342
@@ -350,7 +357,7 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
350 } 357 }
351 if (stat & ICSR1_ROR) { 358 if (stat & ICSR1_ROR) {
352 printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); 359 printk(KERN_DEBUG "pxa_ir: fir receive overrun\n");
353 si->stats.rx_frame_errors++; 360 si->stats.rx_over_errors++;
354 } 361 }
355 } else { 362 } else {
356 si->dma_rx_buff[len++] = data; 363 si->dma_rx_buff[len++] = data;
@@ -362,7 +369,15 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
362 369
363 if (stat & ICSR1_EOF) { 370 if (stat & ICSR1_EOF) {
364 /* end of frame. */ 371 /* end of frame. */
365 struct sk_buff *skb = alloc_skb(len+1,GFP_ATOMIC); 372 struct sk_buff *skb;
373
374 if (icsr0 & ICSR0_FRE) {
375 printk(KERN_ERR "pxa_ir: dropping erroneous frame\n");
376 si->stats.rx_dropped++;
377 return;
378 }
379
380 skb = alloc_skb(len+1,GFP_ATOMIC);
366 if (!skb) { 381 if (!skb) {
367 printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); 382 printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n");
368 si->stats.rx_dropped++; 383 si->stats.rx_dropped++;
@@ -392,7 +407,7 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
392{ 407{
393 struct net_device *dev = dev_id; 408 struct net_device *dev = dev_id;
394 struct pxa_irda *si = netdev_priv(dev); 409 struct pxa_irda *si = netdev_priv(dev);
395 int icsr0; 410 int icsr0, i = 64;
396 411
397 /* stop RX DMA */ 412 /* stop RX DMA */
398 DCSR(si->rxdma) &= ~DCSR_RUN; 413 DCSR(si->rxdma) &= ~DCSR_RUN;
@@ -412,13 +427,18 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
412 427
413 if (icsr0 & ICSR0_EIF) { 428 if (icsr0 & ICSR0_EIF) {
414 /* An error in FIFO occured, or there is a end of frame */ 429 /* An error in FIFO occured, or there is a end of frame */
415 pxa_irda_fir_irq_eif(si, dev); 430 pxa_irda_fir_irq_eif(si, dev, icsr0);
416 } 431 }
417 432
418 ICCR0 = 0; 433 ICCR0 = 0;
419 pxa_irda_fir_dma_rx_start(si); 434 pxa_irda_fir_dma_rx_start(si);
435 while ((ICSR1 & ICSR1_RNE) && i--)
436 (void)ICDR;
420 ICCR0 = ICCR0_ITR | ICCR0_RXE; 437 ICCR0 = ICCR0_ITR | ICCR0_RXE;
421 438
439 if (i < 0)
440 printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n");
441
422 return IRQ_HANDLED; 442 return IRQ_HANDLED;
423} 443}
424 444
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 9ba21e0f27c5..8015a7c5b0c9 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -787,6 +787,12 @@ static int mv643xx_eth_open(struct net_device *dev)
787 unsigned int size; 787 unsigned int size;
788 int err; 788 int err;
789 789
790 /* Clear any pending ethernet port interrupts */
791 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0);
792 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
793 /* wait for previous write to complete */
794 mv_read (MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num));
795
790 err = request_irq(dev->irq, mv643xx_eth_int_handler, 796 err = request_irq(dev->irq, mv643xx_eth_int_handler,
791 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); 797 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev);
792 if (err) { 798 if (err) {
@@ -875,10 +881,6 @@ static int mv643xx_eth_open(struct net_device *dev)
875 881
876 mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ 882 mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */
877 883
878 /* Clear any pending ethernet port interrupts */
879 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0);
880 mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
881
882 eth_port_start(dev); 884 eth_port_start(dev);
883 885
884 /* Interrupt Coalescing */ 886 /* Interrupt Coalescing */
@@ -1377,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1377 1379
1378 spin_lock_init(&mp->lock); 1380 spin_lock_init(&mp->lock);
1379 1381
1380 port_num = pd->port_number; 1382 port_num = mp->port_num = pd->port_number;
1381 1383
1382 /* set default config values */ 1384 /* set default config values */
1383 eth_port_uc_addr_get(dev, dev->dev_addr); 1385 eth_port_uc_addr_get(dev, dev->dev_addr);
@@ -1409,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1409 duplex = pd->duplex; 1411 duplex = pd->duplex;
1410 speed = pd->speed; 1412 speed = pd->speed;
1411 1413
1412 mp->port_num = port_num;
1413
1414 /* Hook up MII support for ethtool */ 1414 /* Hook up MII support for ethtool */
1415 mp->mii.dev = dev; 1415 mp->mii.dev = dev;
1416 mp->mii.mdio_read = mv643xx_mdio_read; 1416 mp->mii.mdio_read = mv643xx_mdio_read;
@@ -1514,9 +1514,23 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
1514 return 0; 1514 return 0;
1515} 1515}
1516 1516
1517static void mv643xx_eth_shutdown(struct platform_device *pdev)
1518{
1519 struct net_device *dev = platform_get_drvdata(pdev);
1520 struct mv643xx_private *mp = netdev_priv(dev);
1521 unsigned int port_num = mp->port_num;
1522
1523 /* Mask all interrupts on ethernet port */
1524 mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), 0);
1525 mv_read (MV643XX_ETH_INTERRUPT_MASK_REG(port_num));
1526
1527 eth_port_reset(port_num);
1528}
1529
1517static struct platform_driver mv643xx_eth_driver = { 1530static struct platform_driver mv643xx_eth_driver = {
1518 .probe = mv643xx_eth_probe, 1531 .probe = mv643xx_eth_probe,
1519 .remove = mv643xx_eth_remove, 1532 .remove = mv643xx_eth_remove,
1533 .shutdown = mv643xx_eth_shutdown,
1520 .driver = { 1534 .driver = {
1521 .name = MV643XX_ETH_NAME, 1535 .name = MV643XX_ETH_NAME,
1522 }, 1536 },
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index b05dc6ed7fb7..f8efe0e70a6b 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -71,7 +71,7 @@
71#include "myri10ge_mcp.h" 71#include "myri10ge_mcp.h"
72#include "myri10ge_mcp_gen_header.h" 72#include "myri10ge_mcp_gen_header.h"
73 73
74#define MYRI10GE_VERSION_STR "1.2.0" 74#define MYRI10GE_VERSION_STR "1.3.0-1.233"
75 75
76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
77MODULE_AUTHOR("Maintainer: help@myri.com"); 77MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -181,6 +181,7 @@ struct myri10ge_priv {
181 int intr_coal_delay; 181 int intr_coal_delay;
182 __be32 __iomem *intr_coal_delay_ptr; 182 __be32 __iomem *intr_coal_delay_ptr;
183 int mtrr; 183 int mtrr;
184 int wc_enabled;
184 int wake_queue; 185 int wake_queue;
185 int stop_queue; 186 int stop_queue;
186 int down_cnt; 187 int down_cnt;
@@ -233,7 +234,7 @@ static int myri10ge_msi = 1; /* enable msi by default */
233module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR); 234module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR);
234MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n"); 235MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n");
235 236
236static int myri10ge_intr_coal_delay = 25; 237static int myri10ge_intr_coal_delay = 75;
237module_param(myri10ge_intr_coal_delay, int, S_IRUGO); 238module_param(myri10ge_intr_coal_delay, int, S_IRUGO);
238MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n"); 239MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n");
239 240
@@ -278,7 +279,7 @@ static int myri10ge_fill_thresh = 256;
278module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); 279module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
279MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); 280MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
280 281
281static int myri10ge_wcfifo = 1; 282static int myri10ge_wcfifo = 0;
282module_param(myri10ge_wcfifo, int, S_IRUGO); 283module_param(myri10ge_wcfifo, int, S_IRUGO);
283MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); 284MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n");
284 285
@@ -717,6 +718,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
717 int status; 718 int status;
718 size_t bytes; 719 size_t bytes;
719 u32 len; 720 u32 len;
721 struct page *dmatest_page;
722 dma_addr_t dmatest_bus;
720 723
721 /* try to send a reset command to the card to see if it 724 /* try to send a reset command to the card to see if it
722 * is alive */ 725 * is alive */
@@ -726,6 +729,11 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
726 dev_err(&mgp->pdev->dev, "failed reset\n"); 729 dev_err(&mgp->pdev->dev, "failed reset\n");
727 return -ENXIO; 730 return -ENXIO;
728 } 731 }
732 dmatest_page = alloc_page(GFP_KERNEL);
733 if (!dmatest_page)
734 return -ENOMEM;
735 dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
736 DMA_BIDIRECTIONAL);
729 737
730 /* Now exchange information about interrupts */ 738 /* Now exchange information about interrupts */
731 739
@@ -764,8 +772,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
764 772
765 len = mgp->tx.boundary; 773 len = mgp->tx.boundary;
766 774
767 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 775 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
768 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 776 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
769 cmd.data2 = len * 0x10000; 777 cmd.data2 = len * 0x10000;
770 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 778 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
771 if (status == 0) 779 if (status == 0)
@@ -774,8 +782,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
774 else 782 else
775 dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", 783 dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n",
776 status); 784 status);
777 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 785 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
778 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 786 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
779 cmd.data2 = len * 0x1; 787 cmd.data2 = len * 0x1;
780 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 788 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
781 if (status == 0) 789 if (status == 0)
@@ -785,8 +793,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
785 dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", 793 dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n",
786 status); 794 status);
787 795
788 cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); 796 cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
789 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); 797 cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
790 cmd.data2 = len * 0x10001; 798 cmd.data2 = len * 0x10001;
791 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); 799 status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
792 if (status == 0) 800 if (status == 0)
@@ -796,6 +804,9 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
796 dev_warn(&mgp->pdev->dev, 804 dev_warn(&mgp->pdev->dev,
797 "DMA read/write benchmark failed: %d\n", status); 805 "DMA read/write benchmark failed: %d\n", status);
798 806
807 pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
808 put_page(dmatest_page);
809
799 memset(mgp->rx_done.entry, 0, bytes); 810 memset(mgp->rx_done.entry, 0, bytes);
800 811
801 /* reset mcp/driver shared state back to 0 */ 812 /* reset mcp/driver shared state back to 0 */
@@ -889,9 +900,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
889 /* try to refill entire ring */ 900 /* try to refill entire ring */
890 while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) { 901 while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) {
891 idx = rx->fill_cnt & rx->mask; 902 idx = rx->fill_cnt & rx->mask;
892 903 if (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE) {
893 if ((bytes < MYRI10GE_ALLOC_SIZE / 2) &&
894 (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) {
895 /* we can use part of previous page */ 904 /* we can use part of previous page */
896 get_page(rx->page); 905 get_page(rx->page);
897 } else { 906 } else {
@@ -922,6 +931,13 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
922 931
923 /* start next packet on a cacheline boundary */ 932 /* start next packet on a cacheline boundary */
924 rx->page_offset += SKB_DATA_ALIGN(bytes); 933 rx->page_offset += SKB_DATA_ALIGN(bytes);
934
935#if MYRI10GE_ALLOC_SIZE > 4096
936 /* don't cross a 4KB boundary */
937 if ((rx->page_offset >> 12) !=
938 ((rx->page_offset + bytes - 1) >> 12))
939 rx->page_offset = (rx->page_offset + 4096) & ~4095;
940#endif
925 rx->fill_cnt++; 941 rx->fill_cnt++;
926 942
927 /* copy 8 descriptors to the firmware at a time */ 943 /* copy 8 descriptors to the firmware at a time */
@@ -1375,7 +1391,7 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1375 data[i] = ((unsigned long *)&mgp->stats)[i]; 1391 data[i] = ((unsigned long *)&mgp->stats)[i];
1376 1392
1377 data[i++] = (unsigned int)mgp->tx.boundary; 1393 data[i++] = (unsigned int)mgp->tx.boundary;
1378 data[i++] = (unsigned int)(mgp->mtrr >= 0); 1394 data[i++] = (unsigned int)mgp->wc_enabled;
1379 data[i++] = (unsigned int)mgp->pdev->irq; 1395 data[i++] = (unsigned int)mgp->pdev->irq;
1380 data[i++] = (unsigned int)mgp->msi_enabled; 1396 data[i++] = (unsigned int)mgp->msi_enabled;
1381 data[i++] = (unsigned int)mgp->read_dma; 1397 data[i++] = (unsigned int)mgp->read_dma;
@@ -1456,6 +1472,8 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1456 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); 1472 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0);
1457 tx_ring_size = cmd.data0; 1473 tx_ring_size = cmd.data0;
1458 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); 1474 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
1475 if (status != 0)
1476 return status;
1459 rx_ring_size = cmd.data0; 1477 rx_ring_size = cmd.data0;
1460 1478
1461 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); 1479 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send);
@@ -1463,6 +1481,8 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1463 mgp->tx.mask = tx_ring_entries - 1; 1481 mgp->tx.mask = tx_ring_entries - 1;
1464 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; 1482 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1;
1465 1483
1484 status = -ENOMEM;
1485
1466 /* allocate the host shadow rings */ 1486 /* allocate the host shadow rings */
1467 1487
1468 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) 1488 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4)
@@ -1735,7 +1755,7 @@ static int myri10ge_open(struct net_device *dev)
1735 goto abort_with_irq; 1755 goto abort_with_irq;
1736 } 1756 }
1737 1757
1738 if (myri10ge_wcfifo && mgp->mtrr >= 0) { 1758 if (myri10ge_wcfifo && mgp->wc_enabled) {
1739 mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; 1759 mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4;
1740 mgp->rx_small.wc_fifo = 1760 mgp->rx_small.wc_fifo =
1741 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; 1761 (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL;
@@ -1992,10 +2012,9 @@ again:
1992 mss = 0; 2012 mss = 0;
1993 max_segments = MXGEFW_MAX_SEND_DESC; 2013 max_segments = MXGEFW_MAX_SEND_DESC;
1994 2014
1995 if (skb->len > (dev->mtu + ETH_HLEN)) { 2015 if (skb_is_gso(skb)) {
1996 mss = skb_shinfo(skb)->gso_size; 2016 mss = skb_shinfo(skb)->gso_size;
1997 if (mss != 0) 2017 max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
1998 max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
1999 } 2018 }
2000 2019
2001 if ((unlikely(avail < max_segments))) { 2020 if ((unlikely(avail < max_segments))) {
@@ -2468,6 +2487,12 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
2468 2487
2469#define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7 2488#define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7
2470#define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa 2489#define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa
2490#define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1 0x3510
2491#define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4 0x351b
2492#define PCI_DEVICE_ID_INTEL_E3000_PCIE 0x2779
2493#define PCI_DEVICE_ID_INTEL_E3010_PCIE 0x277a
2494#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140
2495#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142
2471 2496
2472static void myri10ge_select_firmware(struct myri10ge_priv *mgp) 2497static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2473{ 2498{
@@ -2499,6 +2524,24 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2499 ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS 2524 ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS
2500 && bridge->device == 2525 && bridge->device ==
2501 PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE) 2526 PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE)
2527 /* ServerWorks HT2100 */
2528 || (bridge->vendor == PCI_VENDOR_ID_SERVERWORKS
2529 && bridge->device >=
2530 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST
2531 && bridge->device <=
2532 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST)
2533 /* All Intel E3000/E3010 PCIE ports */
2534 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2535 && (bridge->device ==
2536 PCI_DEVICE_ID_INTEL_E3000_PCIE
2537 || bridge->device ==
2538 PCI_DEVICE_ID_INTEL_E3010_PCIE))
2539 /* All Intel 6310/6311/6321ESB PCIE ports */
2540 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2541 && bridge->device >=
2542 PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1
2543 && bridge->device <=
2544 PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4)
2502 /* All Intel E5000 PCIE ports */ 2545 /* All Intel E5000 PCIE ports */
2503 || (bridge->vendor == PCI_VENDOR_ID_INTEL 2546 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2504 && bridge->device >= 2547 && bridge->device >=
@@ -2510,6 +2553,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2510 bridge->vendor, bridge->device); 2553 bridge->vendor, bridge->device);
2511 mgp->tx.boundary = 4096; 2554 mgp->tx.boundary = 4096;
2512 mgp->fw_name = myri10ge_fw_aligned; 2555 mgp->fw_name = myri10ge_fw_aligned;
2556 } else if (bridge &&
2557 bridge->vendor == PCI_VENDOR_ID_SGI &&
2558 bridge->device == 0x4002 /* TIOCE pcie-port */ ) {
2559 /* this pcie bridge does not support 4K rdma request */
2560 mgp->tx.boundary = 2048;
2561 mgp->fw_name = myri10ge_fw_aligned;
2513 } 2562 }
2514 } else { 2563 } else {
2515 if (myri10ge_force_firmware == 1) { 2564 if (myri10ge_force_firmware == 1) {
@@ -2830,9 +2879,12 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2830 mgp->board_span = pci_resource_len(pdev, 0); 2879 mgp->board_span = pci_resource_len(pdev, 0);
2831 mgp->iomem_base = pci_resource_start(pdev, 0); 2880 mgp->iomem_base = pci_resource_start(pdev, 0);
2832 mgp->mtrr = -1; 2881 mgp->mtrr = -1;
2882 mgp->wc_enabled = 0;
2833#ifdef CONFIG_MTRR 2883#ifdef CONFIG_MTRR
2834 mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span, 2884 mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span,
2835 MTRR_TYPE_WRCOMB, 1); 2885 MTRR_TYPE_WRCOMB, 1);
2886 if (mgp->mtrr >= 0)
2887 mgp->wc_enabled = 1;
2836#endif 2888#endif
2837 /* Hack. need to get rid of these magic numbers */ 2889 /* Hack. need to get rid of these magic numbers */
2838 mgp->sram_size = 2890 mgp->sram_size =
@@ -2927,7 +2979,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2927 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", 2979 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n",
2928 (mgp->msi_enabled ? "MSI" : "xPIC"), 2980 (mgp->msi_enabled ? "MSI" : "xPIC"),
2929 netdev->irq, mgp->tx.boundary, mgp->fw_name, 2981 netdev->irq, mgp->tx.boundary, mgp->fw_name,
2930 (mgp->mtrr >= 0 ? "Enabled" : "Disabled")); 2982 (mgp->wc_enabled ? "Enabled" : "Disabled"));
2931 2983
2932 return 0; 2984 return 0;
2933 2985
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index c6172a77a6d7..349b96a3ec4c 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1712,7 +1712,7 @@ static void init_registers(struct net_device *dev)
1712 1712
1713 /* Enable interrupts by setting the interrupt mask. */ 1713 /* Enable interrupts by setting the interrupt mask. */
1714 writel(DEFAULT_INTR, ioaddr + IntrMask); 1714 writel(DEFAULT_INTR, ioaddr + IntrMask);
1715 writel(1, ioaddr + IntrEnable); 1715 natsemi_irq_enable(dev);
1716 1716
1717 writel(RxOn | TxOn, ioaddr + ChipCmd); 1717 writel(RxOn | TxOn, ioaddr + ChipCmd);
1718 writel(StatsClear, ioaddr + StatsCtrl); /* Clear Stats */ 1718 writel(StatsClear, ioaddr + StatsCtrl); /* Clear Stats */
@@ -2119,28 +2119,35 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
2119 struct netdev_private *np = netdev_priv(dev); 2119 struct netdev_private *np = netdev_priv(dev);
2120 void __iomem * ioaddr = ns_ioaddr(dev); 2120 void __iomem * ioaddr = ns_ioaddr(dev);
2121 2121
2122 if (np->hands_off) 2122 /* Reading IntrStatus automatically acknowledges so don't do
2123 * that while interrupts are disabled, (for example, while a
2124 * poll is scheduled). */
2125 if (np->hands_off || !readl(ioaddr + IntrEnable))
2123 return IRQ_NONE; 2126 return IRQ_NONE;
2124 2127
2125 /* Reading automatically acknowledges. */
2126 np->intr_status = readl(ioaddr + IntrStatus); 2128 np->intr_status = readl(ioaddr + IntrStatus);
2127 2129
2130 if (!np->intr_status)
2131 return IRQ_NONE;
2132
2128 if (netif_msg_intr(np)) 2133 if (netif_msg_intr(np))
2129 printk(KERN_DEBUG 2134 printk(KERN_DEBUG
2130 "%s: Interrupt, status %#08x, mask %#08x.\n", 2135 "%s: Interrupt, status %#08x, mask %#08x.\n",
2131 dev->name, np->intr_status, 2136 dev->name, np->intr_status,
2132 readl(ioaddr + IntrMask)); 2137 readl(ioaddr + IntrMask));
2133 2138
2134 if (!np->intr_status)
2135 return IRQ_NONE;
2136
2137 prefetch(&np->rx_skbuff[np->cur_rx % RX_RING_SIZE]); 2139 prefetch(&np->rx_skbuff[np->cur_rx % RX_RING_SIZE]);
2138 2140
2139 if (netif_rx_schedule_prep(dev)) { 2141 if (netif_rx_schedule_prep(dev)) {
2140 /* Disable interrupts and register for poll */ 2142 /* Disable interrupts and register for poll */
2141 natsemi_irq_disable(dev); 2143 natsemi_irq_disable(dev);
2142 __netif_rx_schedule(dev); 2144 __netif_rx_schedule(dev);
2143 } 2145 } else
2146 printk(KERN_WARNING
2147 "%s: Ignoring interrupt, status %#08x, mask %#08x.\n",
2148 dev->name, np->intr_status,
2149 readl(ioaddr + IntrMask));
2150
2144 return IRQ_HANDLED; 2151 return IRQ_HANDLED;
2145} 2152}
2146 2153
@@ -2156,6 +2163,20 @@ static int natsemi_poll(struct net_device *dev, int *budget)
2156 int work_done = 0; 2163 int work_done = 0;
2157 2164
2158 do { 2165 do {
2166 if (netif_msg_intr(np))
2167 printk(KERN_DEBUG
2168 "%s: Poll, status %#08x, mask %#08x.\n",
2169 dev->name, np->intr_status,
2170 readl(ioaddr + IntrMask));
2171
2172 /* netdev_rx() may read IntrStatus again if the RX state
2173 * machine falls over so do it first. */
2174 if (np->intr_status &
2175 (IntrRxDone | IntrRxIntr | RxStatusFIFOOver |
2176 IntrRxErr | IntrRxOverrun)) {
2177 netdev_rx(dev, &work_done, work_to_do);
2178 }
2179
2159 if (np->intr_status & 2180 if (np->intr_status &
2160 (IntrTxDone | IntrTxIntr | IntrTxIdle | IntrTxErr)) { 2181 (IntrTxDone | IntrTxIntr | IntrTxIdle | IntrTxErr)) {
2161 spin_lock(&np->lock); 2182 spin_lock(&np->lock);
@@ -2167,12 +2188,6 @@ static int natsemi_poll(struct net_device *dev, int *budget)
2167 if (np->intr_status & IntrAbnormalSummary) 2188 if (np->intr_status & IntrAbnormalSummary)
2168 netdev_error(dev, np->intr_status); 2189 netdev_error(dev, np->intr_status);
2169 2190
2170 if (np->intr_status &
2171 (IntrRxDone | IntrRxIntr | RxStatusFIFOOver |
2172 IntrRxErr | IntrRxOverrun)) {
2173 netdev_rx(dev, &work_done, work_to_do);
2174 }
2175
2176 *budget -= work_done; 2191 *budget -= work_done;
2177 dev->quota -= work_done; 2192 dev->quota -= work_done;
2178 2193
@@ -2399,19 +2414,8 @@ static struct net_device_stats *get_stats(struct net_device *dev)
2399#ifdef CONFIG_NET_POLL_CONTROLLER 2414#ifdef CONFIG_NET_POLL_CONTROLLER
2400static void natsemi_poll_controller(struct net_device *dev) 2415static void natsemi_poll_controller(struct net_device *dev)
2401{ 2416{
2402 struct netdev_private *np = netdev_priv(dev);
2403
2404 disable_irq(dev->irq); 2417 disable_irq(dev->irq);
2405 2418 intr_handler(dev->irq, dev);
2406 /*
2407 * A real interrupt might have already reached us at this point
2408 * but NAPI might still haven't called us back. As the interrupt
2409 * status register is cleared by reading, we should prevent an
2410 * interrupt loss in this case...
2411 */
2412 if (!np->intr_status)
2413 intr_handler(dev->irq, dev);
2414
2415 enable_irq(dev->irq); 2419 enable_irq(dev->irq);
2416} 2420}
2417#endif 2421#endif
@@ -3071,7 +3075,7 @@ static void enable_wol_mode(struct net_device *dev, int enable_intr)
3071 * Could be used to send a netlink message. 3075 * Could be used to send a netlink message.
3072 */ 3076 */
3073 writel(WOLPkt | LinkChange, ioaddr + IntrMask); 3077 writel(WOLPkt | LinkChange, ioaddr + IntrMask);
3074 writel(1, ioaddr + IntrEnable); 3078 natsemi_irq_enable(dev);
3075 } 3079 }
3076} 3080}
3077 3081
@@ -3202,7 +3206,7 @@ static int natsemi_suspend (struct pci_dev *pdev, pm_message_t state)
3202 disable_irq(dev->irq); 3206 disable_irq(dev->irq);
3203 spin_lock_irq(&np->lock); 3207 spin_lock_irq(&np->lock);
3204 3208
3205 writel(0, ioaddr + IntrEnable); 3209 natsemi_irq_disable(dev);
3206 np->hands_off = 1; 3210 np->hands_off = 1;
3207 natsemi_stop_rxtx(dev); 3211 natsemi_stop_rxtx(dev);
3208 netif_stop_queue(dev); 3212 netif_stop_queue(dev);
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 81742e4e5610..dd8ce35332fe 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -232,6 +232,7 @@ enum {
232#define MPORT_SINGLE_FUNCTION_MODE 0x1111 232#define MPORT_SINGLE_FUNCTION_MODE 0x1111
233 233
234extern unsigned long long netxen_dma_mask; 234extern unsigned long long netxen_dma_mask;
235extern unsigned long last_schedule_time;
235 236
236/* 237/*
237 * NetXen host-peg signal message structure 238 * NetXen host-peg signal message structure
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 986ef98db229..ee1b5a24cbe7 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -462,6 +462,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
462 } 462 }
463 printk(KERN_INFO "%s: flash unlocked. \n", 463 printk(KERN_INFO "%s: flash unlocked. \n",
464 netxen_nic_driver_name); 464 netxen_nic_driver_name);
465 last_schedule_time = jiffies;
465 ret = netxen_flash_erase_secondary(adapter); 466 ret = netxen_flash_erase_secondary(adapter);
466 if (ret != FLASH_SUCCESS) { 467 if (ret != FLASH_SUCCESS) {
467 printk(KERN_ERR "%s: Flash erase failed.\n", 468 printk(KERN_ERR "%s: Flash erase failed.\n",
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index a2877f33fa85..6537574a9cda 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -228,7 +228,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
228 &adapter->ctx_desc_pdev); 228 &adapter->ctx_desc_pdev);
229 229
230 printk("ctx_desc_phys_addr: 0x%llx\n", 230 printk("ctx_desc_phys_addr: 0x%llx\n",
231 (u64) adapter->ctx_desc_phys_addr); 231 (unsigned long long) adapter->ctx_desc_phys_addr);
232 if (addr == NULL) { 232 if (addr == NULL) {
233 DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); 233 DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
234 err = -ENOMEM; 234 err = -ENOMEM;
@@ -247,7 +247,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
247 adapter->max_tx_desc_count, 247 adapter->max_tx_desc_count,
248 (dma_addr_t *) & hw->cmd_desc_phys_addr, 248 (dma_addr_t *) & hw->cmd_desc_phys_addr,
249 &adapter->ahw.cmd_desc_pdev); 249 &adapter->ahw.cmd_desc_pdev);
250 printk("cmd_desc_phys_addr: 0x%llx\n", (u64) hw->cmd_desc_phys_addr); 250 printk("cmd_desc_phys_addr: 0x%llx\n",
251 (unsigned long long) hw->cmd_desc_phys_addr);
251 252
252 if (addr == NULL) { 253 if (addr == NULL) {
253 DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); 254 DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
@@ -821,7 +822,10 @@ int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu)
821{ 822{
822 struct netxen_adapter *adapter = port->adapter; 823 struct netxen_adapter *adapter = port->adapter;
823 new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; 824 new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
824 netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu); 825 if (port->portnum == 0)
826 netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu);
827 else if (port->portnum == 1)
828 netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, new_mtu);
825 return 0; 829 return 0;
826} 830}
827 831
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 586d32b676af..eff965dc5fff 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -42,6 +42,8 @@ struct crb_addr_pair {
42 u32 data; 42 u32 data;
43}; 43};
44 44
45unsigned long last_schedule_time;
46
45#define NETXEN_MAX_CRB_XFORM 60 47#define NETXEN_MAX_CRB_XFORM 60
46static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; 48static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM];
47#define NETXEN_ADDR_ERROR (0xffffffff) 49#define NETXEN_ADDR_ERROR (0xffffffff)
@@ -404,9 +406,14 @@ static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
404static inline int 406static inline int
405do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) 407do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
406{ 408{
409 if (jiffies > (last_schedule_time + (8 * HZ))) {
410 last_schedule_time = jiffies;
411 schedule();
412 }
413
407 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); 414 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
408 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); 415 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
409 udelay(70); /* prevent bursting on CRB */ 416 udelay(100); /* prevent bursting on CRB */
410 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 417 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
411 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); 418 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
412 if (netxen_wait_rom_done(adapter)) { 419 if (netxen_wait_rom_done(adapter)) {
@@ -415,7 +422,7 @@ do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
415 } 422 }
416 /* reset abyte_cnt and dummy_byte_cnt */ 423 /* reset abyte_cnt and dummy_byte_cnt */
417 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); 424 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
418 udelay(70); /* prevent bursting on CRB */ 425 udelay(100); /* prevent bursting on CRB */
419 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 426 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
420 427
421 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); 428 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA);
@@ -431,6 +438,7 @@ do_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
431 438
432 for (addridx = addr; addridx < (addr + size); addridx += 4) { 439 for (addridx = addr; addridx < (addr + size); addridx += 4) {
433 ret = do_rom_fast_read(adapter, addridx, (int *)bytes); 440 ret = do_rom_fast_read(adapter, addridx, (int *)bytes);
441 *(int *)bytes = cpu_to_le32(*(int *)bytes);
434 if (ret != 0) 442 if (ret != 0)
435 break; 443 break;
436 bytes += 4; 444 bytes += 4;
@@ -490,7 +498,7 @@ static inline int do_rom_fast_write_words(struct netxen_adapter *adapter,
490 int timeout = 0; 498 int timeout = 0;
491 int data; 499 int data;
492 500
493 data = *(u32*)bytes; 501 data = le32_to_cpu((*(u32*)bytes));
494 502
495 ret = do_rom_fast_write(adapter, addridx, data); 503 ret = do_rom_fast_write(adapter, addridx, data);
496 if (ret < 0) 504 if (ret < 0)
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index 00ca0fdb837b..6ca4e4fa6b88 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -710,8 +710,8 @@ match:
710 tp->chipset, 710 tp->chipset,
711 rtl_chip_info[tp->chipset].name); 711 rtl_chip_info[tp->chipset].name);
712 712
713 i = register_netdev (dev); 713 rc = register_netdev (dev);
714 if (i) 714 if (rc)
715 goto err_out_unmap; 715 goto err_out_unmap;
716 716
717 DPRINTK ("EXIT, returning 0\n"); 717 DPRINTK ("EXIT, returning 0\n");
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index a956a51d284f..1060154ae750 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -138,7 +138,7 @@ static const struct ethtool_ops netdev_ethtool_ops = {
138 138
139======================================================================*/ 139======================================================================*/
140 140
141static int ibmtr_attach(struct pcmcia_device *link) 141static int __devinit ibmtr_attach(struct pcmcia_device *link)
142{ 142{
143 ibmtr_dev_t *info; 143 ibmtr_dev_t *info;
144 struct net_device *dev; 144 struct net_device *dev;
@@ -217,7 +217,7 @@ static void ibmtr_detach(struct pcmcia_device *link)
217#define CS_CHECK(fn, ret) \ 217#define CS_CHECK(fn, ret) \
218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
219 219
220static int ibmtr_config(struct pcmcia_device *link) 220static int __devinit ibmtr_config(struct pcmcia_device *link)
221{ 221{
222 ibmtr_dev_t *info = link->priv; 222 ibmtr_dev_t *info = link->priv;
223 struct net_device *dev = info->dev; 223 struct net_device *dev = info->dev;
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 11b575f89856..ef58e4128782 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2544,6 +2544,9 @@ static void ppp_destroy_interface(struct ppp *ppp)
2544 ppp->active_filter = NULL; 2544 ppp->active_filter = NULL;
2545#endif /* CONFIG_PPP_FILTER */ 2545#endif /* CONFIG_PPP_FILTER */
2546 2546
2547 if (ppp->xmit_pending)
2548 kfree_skb(ppp->xmit_pending);
2549
2547 kfree(ppp); 2550 kfree(ppp);
2548} 2551}
2549 2552
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index d3f65dab306c..a8246eb2f8d9 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1691,6 +1691,27 @@ static int ql_populate_free_queue(struct ql3_adapter *qdev)
1691/* 1691/*
1692 * Caller holds hw_lock. 1692 * Caller holds hw_lock.
1693 */ 1693 */
1694static void ql_update_small_bufq_prod_index(struct ql3_adapter *qdev)
1695{
1696 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
1697 if (qdev->small_buf_release_cnt >= 16) {
1698 while (qdev->small_buf_release_cnt >= 16) {
1699 qdev->small_buf_q_producer_index++;
1700
1701 if (qdev->small_buf_q_producer_index ==
1702 NUM_SBUFQ_ENTRIES)
1703 qdev->small_buf_q_producer_index = 0;
1704 qdev->small_buf_release_cnt -= 8;
1705 }
1706 wmb();
1707 writel(qdev->small_buf_q_producer_index,
1708 &port_regs->CommonRegs.rxSmallQProducerIndex);
1709 }
1710}
1711
1712/*
1713 * Caller holds hw_lock.
1714 */
1694static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) 1715static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)
1695{ 1716{
1696 struct bufq_addr_element *lrg_buf_q_ele; 1717 struct bufq_addr_element *lrg_buf_q_ele;
@@ -1732,13 +1753,10 @@ static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)
1732 lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr; 1753 lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr;
1733 } 1754 }
1734 } 1755 }
1735 1756 wmb();
1736 qdev->lrg_buf_next_free = lrg_buf_q_ele; 1757 qdev->lrg_buf_next_free = lrg_buf_q_ele;
1737 1758 writel(qdev->lrg_buf_q_producer_index,
1738 ql_write_common_reg(qdev, 1759 &port_regs->CommonRegs.rxLargeQProducerIndex);
1739 &port_regs->CommonRegs.
1740 rxLargeQProducerIndex,
1741 qdev->lrg_buf_q_producer_index);
1742 } 1760 }
1743} 1761}
1744 1762
@@ -1915,17 +1933,18 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
1915 u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum); 1933 u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum);
1916 if (checksum & 1934 if (checksum &
1917 (IB_IP_IOCB_RSP_3032_ICE | 1935 (IB_IP_IOCB_RSP_3032_ICE |
1918 IB_IP_IOCB_RSP_3032_CE | 1936 IB_IP_IOCB_RSP_3032_CE)) {
1919 IB_IP_IOCB_RSP_3032_NUC)) {
1920 printk(KERN_ERR 1937 printk(KERN_ERR
1921 "%s: Bad checksum for this %s packet, checksum = %x.\n", 1938 "%s: Bad checksum for this %s packet, checksum = %x.\n",
1922 __func__, 1939 __func__,
1923 ((checksum & 1940 ((checksum &
1924 IB_IP_IOCB_RSP_3032_TCP) ? "TCP" : 1941 IB_IP_IOCB_RSP_3032_TCP) ? "TCP" :
1925 "UDP"),checksum); 1942 "UDP"),checksum);
1926 } else if (checksum & IB_IP_IOCB_RSP_3032_TCP) { 1943 } else if ((checksum & IB_IP_IOCB_RSP_3032_TCP) ||
1944 (checksum & IB_IP_IOCB_RSP_3032_UDP &&
1945 !(checksum & IB_IP_IOCB_RSP_3032_NUC))) {
1927 skb2->ip_summed = CHECKSUM_UNNECESSARY; 1946 skb2->ip_summed = CHECKSUM_UNNECESSARY;
1928 } 1947 }
1929 } 1948 }
1930 skb2->dev = qdev->ndev; 1949 skb2->dev = qdev->ndev;
1931 skb2->protocol = eth_type_trans(skb2, qdev->ndev); 1950 skb2->protocol = eth_type_trans(skb2, qdev->ndev);
@@ -1944,16 +1963,12 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
1944static int ql_tx_rx_clean(struct ql3_adapter *qdev, 1963static int ql_tx_rx_clean(struct ql3_adapter *qdev,
1945 int *tx_cleaned, int *rx_cleaned, int work_to_do) 1964 int *tx_cleaned, int *rx_cleaned, int work_to_do)
1946{ 1965{
1947 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
1948 struct net_rsp_iocb *net_rsp; 1966 struct net_rsp_iocb *net_rsp;
1949 struct net_device *ndev = qdev->ndev; 1967 struct net_device *ndev = qdev->ndev;
1950 unsigned long hw_flags;
1951 int work_done = 0; 1968 int work_done = 0;
1952 1969
1953 u32 rsp_producer_index = le32_to_cpu(*(qdev->prsp_producer_index));
1954
1955 /* While there are entries in the completion queue. */ 1970 /* While there are entries in the completion queue. */
1956 while ((rsp_producer_index != 1971 while ((le32_to_cpu(*(qdev->prsp_producer_index)) !=
1957 qdev->rsp_consumer_index) && (work_done < work_to_do)) { 1972 qdev->rsp_consumer_index) && (work_done < work_to_do)) {
1958 1973
1959 net_rsp = qdev->rsp_current; 1974 net_rsp = qdev->rsp_current;
@@ -2009,33 +2024,7 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
2009 work_done = *tx_cleaned + *rx_cleaned; 2024 work_done = *tx_cleaned + *rx_cleaned;
2010 } 2025 }
2011 2026
2012 if(work_done) { 2027 return work_done;
2013 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2014
2015 ql_update_lrg_bufq_prod_index(qdev);
2016
2017 if (qdev->small_buf_release_cnt >= 16) {
2018 while (qdev->small_buf_release_cnt >= 16) {
2019 qdev->small_buf_q_producer_index++;
2020
2021 if (qdev->small_buf_q_producer_index ==
2022 NUM_SBUFQ_ENTRIES)
2023 qdev->small_buf_q_producer_index = 0;
2024 qdev->small_buf_release_cnt -= 8;
2025 }
2026
2027 wmb();
2028 ql_write_common_reg(qdev,
2029 &port_regs->CommonRegs.
2030 rxSmallQProducerIndex,
2031 qdev->small_buf_q_producer_index);
2032
2033 }
2034
2035 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
2036 }
2037
2038 return *tx_cleaned + *rx_cleaned;
2039} 2028}
2040 2029
2041static int ql_poll(struct net_device *ndev, int *budget) 2030static int ql_poll(struct net_device *ndev, int *budget)
@@ -2059,9 +2048,10 @@ quit_polling:
2059 netif_rx_complete(ndev); 2048 netif_rx_complete(ndev);
2060 2049
2061 spin_lock_irqsave(&qdev->hw_lock, hw_flags); 2050 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2062 ql_write_common_reg(qdev, 2051 ql_update_small_bufq_prod_index(qdev);
2063 &port_regs->CommonRegs.rspQConsumerIndex, 2052 ql_update_lrg_bufq_prod_index(qdev);
2064 qdev->rsp_consumer_index); 2053 writel(qdev->rsp_consumer_index,
2054 &port_regs->CommonRegs.rspQConsumerIndex);
2065 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 2055 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
2066 2056
2067 ql_enable_interrupts(qdev); 2057 ql_enable_interrupts(qdev);
@@ -2217,12 +2207,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2217 int seg_cnt, seg = 0; 2207 int seg_cnt, seg = 0;
2218 int frag_cnt = (int)skb_shinfo(skb)->nr_frags; 2208 int frag_cnt = (int)skb_shinfo(skb)->nr_frags;
2219 2209
2220 seg_cnt = tx_cb->seg_count = ql_get_seg_count(qdev, 2210 seg_cnt = tx_cb->seg_count;
2221 (skb_shinfo(skb)->nr_frags));
2222 if(seg_cnt == -1) {
2223 printk(KERN_ERR PFX"%s: invalid segment count!\n",__func__);
2224 return NETDEV_TX_BUSY;
2225 }
2226 /* 2211 /*
2227 * Map the skb buffer first. 2212 * Map the skb buffer first.
2228 */ 2213 */
@@ -2278,7 +2263,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2278 pci_unmap_addr_set(&tx_cb->map[seg], mapaddr, 2263 pci_unmap_addr_set(&tx_cb->map[seg], mapaddr,
2279 map); 2264 map);
2280 pci_unmap_len_set(&tx_cb->map[seg], maplen, 2265 pci_unmap_len_set(&tx_cb->map[seg], maplen,
2281 len); 2266 sizeof(struct oal));
2282 oal_entry = (struct oal_entry *)oal; 2267 oal_entry = (struct oal_entry *)oal;
2283 oal++; 2268 oal++;
2284 seg++; 2269 seg++;
@@ -2380,6 +2365,7 @@ static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev)
2380 } 2365 }
2381 2366
2382 mac_iocb_ptr = tx_cb->queue_entry; 2367 mac_iocb_ptr = tx_cb->queue_entry;
2368 memset((void *)mac_iocb_ptr, 0, sizeof(struct ob_mac_iocb_req));
2383 mac_iocb_ptr->opcode = qdev->mac_ob_opcode; 2369 mac_iocb_ptr->opcode = qdev->mac_ob_opcode;
2384 mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X; 2370 mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X;
2385 mac_iocb_ptr->flags |= qdev->mb_bit_mask; 2371 mac_iocb_ptr->flags |= qdev->mb_bit_mask;
@@ -3054,15 +3040,6 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3054 goto out; 3040 goto out;
3055 } 3041 }
3056 3042
3057 if (qdev->mac_index)
3058 ql_write_page0_reg(qdev,
3059 &port_regs->mac1MaxFrameLengthReg,
3060 qdev->max_frame_size);
3061 else
3062 ql_write_page0_reg(qdev,
3063 &port_regs->mac0MaxFrameLengthReg,
3064 qdev->max_frame_size);
3065
3066 value = qdev->nvram_data.tcpMaxWindowSize; 3043 value = qdev->nvram_data.tcpMaxWindowSize;
3067 ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value); 3044 ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value);
3068 3045
@@ -3082,6 +3059,14 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3082 ql_sem_unlock(qdev, QL_FLASH_SEM_MASK); 3059 ql_sem_unlock(qdev, QL_FLASH_SEM_MASK);
3083 } 3060 }
3084 3061
3062 if (qdev->mac_index)
3063 ql_write_page0_reg(qdev,
3064 &port_regs->mac1MaxFrameLengthReg,
3065 qdev->max_frame_size);
3066 else
3067 ql_write_page0_reg(qdev,
3068 &port_regs->mac0MaxFrameLengthReg,
3069 qdev->max_frame_size);
3085 3070
3086 if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, 3071 if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK,
3087 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * 3072 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) *
@@ -3152,7 +3137,8 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3152 if (qdev->device_id == QL3032_DEVICE_ID) { 3137 if (qdev->device_id == QL3032_DEVICE_ID) {
3153 value = 3138 value =
3154 (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE | 3139 (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE |
3155 QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4); 3140 QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4 |
3141 QL3032_PORT_CONTROL_ET);
3156 ql_write_page0_reg(qdev, &port_regs->functionControl, 3142 ql_write_page0_reg(qdev, &port_regs->functionControl,
3157 ((value << 16) | value)); 3143 ((value << 16) | value));
3158 } else { 3144 } else {
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h
index 34cd6580fd07..0203f88f0544 100755
--- a/drivers/net/qla3xxx.h
+++ b/drivers/net/qla3xxx.h
@@ -1014,8 +1014,7 @@ struct eeprom_data {
1014 1014
1015/* Transmit and Receive Buffers */ 1015/* Transmit and Receive Buffers */
1016#define NUM_LBUFQ_ENTRIES 128 1016#define NUM_LBUFQ_ENTRIES 128
1017#define JUMBO_NUM_LBUFQ_ENTRIES \ 1017#define JUMBO_NUM_LBUFQ_ENTRIES 32
1018(NUM_LBUFQ_ENTRIES/(JUMBO_MTU_SIZE/NORMAL_MTU_SIZE))
1019#define NUM_SBUFQ_ENTRIES 64 1018#define NUM_SBUFQ_ENTRIES 64
1020#define QL_SMALL_BUFFER_SIZE 32 1019#define QL_SMALL_BUFFER_SIZE 32
1021#define QL_ADDR_ELE_PER_BUFQ_ENTRY \ 1020#define QL_ADDR_ELE_PER_BUFQ_ENTRY \
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 15d954e50cae..6a77b8a92245 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -66,6 +66,7 @@ VERSION 2.2LK <2005/01/25>
66#include <linux/init.h> 66#include <linux/init.h>
67#include <linux/dma-mapping.h> 67#include <linux/dma-mapping.h>
68 68
69#include <asm/system.h>
69#include <asm/io.h> 70#include <asm/io.h>
70#include <asm/irq.h> 71#include <asm/irq.h>
71 72
@@ -486,6 +487,7 @@ static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *,
486 void __iomem *); 487 void __iomem *);
487static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); 488static int rtl8169_change_mtu(struct net_device *dev, int new_mtu);
488static void rtl8169_down(struct net_device *dev); 489static void rtl8169_down(struct net_device *dev);
490static void rtl8169_rx_clear(struct rtl8169_private *tp);
489 491
490#ifdef CONFIG_R8169_NAPI 492#ifdef CONFIG_R8169_NAPI
491static int rtl8169_poll(struct net_device *dev, int *budget); 493static int rtl8169_poll(struct net_device *dev, int *budget);
@@ -572,8 +574,8 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr)
572{ 574{
573 unsigned int val; 575 unsigned int val;
574 576
575 mdio_write(ioaddr, MII_BMCR, BMCR_RESET); 577 val = mdio_read(ioaddr, MII_BMCR) | BMCR_RESET;
576 val = mdio_read(ioaddr, MII_BMCR); 578 mdio_write(ioaddr, MII_BMCR, val & 0xffff);
577} 579}
578 580
579static void rtl8169_check_link_status(struct net_device *dev, 581static void rtl8169_check_link_status(struct net_device *dev,
@@ -1368,11 +1370,7 @@ static inline void rtl8169_request_timer(struct net_device *dev)
1368 (tp->phy_version >= RTL_GIGA_PHY_VER_H)) 1370 (tp->phy_version >= RTL_GIGA_PHY_VER_H))
1369 return; 1371 return;
1370 1372
1371 init_timer(timer); 1373 mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT);
1372 timer->expires = jiffies + RTL8169_PHY_TIMEOUT;
1373 timer->data = (unsigned long)(dev);
1374 timer->function = rtl8169_phy_timer;
1375 add_timer(timer);
1376} 1374}
1377 1375
1378#ifdef CONFIG_NET_POLL_CONTROLLER 1376#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1685,6 +1683,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1685 tp->mmio_addr = ioaddr; 1683 tp->mmio_addr = ioaddr;
1686 tp->align = rtl_cfg_info[ent->driver_data].align; 1684 tp->align = rtl_cfg_info[ent->driver_data].align;
1687 1685
1686 init_timer(&tp->timer);
1687 tp->timer.data = (unsigned long) dev;
1688 tp->timer.function = rtl8169_phy_timer;
1689
1688 spin_lock_init(&tp->lock); 1690 spin_lock_init(&tp->lock);
1689 1691
1690 rc = register_netdev(dev); 1692 rc = register_netdev(dev);
@@ -1751,16 +1753,10 @@ static int rtl8169_open(struct net_device *dev)
1751{ 1753{
1752 struct rtl8169_private *tp = netdev_priv(dev); 1754 struct rtl8169_private *tp = netdev_priv(dev);
1753 struct pci_dev *pdev = tp->pci_dev; 1755 struct pci_dev *pdev = tp->pci_dev;
1754 int retval; 1756 int retval = -ENOMEM;
1755
1756 rtl8169_set_rxbufsize(tp, dev);
1757 1757
1758 retval =
1759 request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, dev->name, dev);
1760 if (retval < 0)
1761 goto out;
1762 1758
1763 retval = -ENOMEM; 1759 rtl8169_set_rxbufsize(tp, dev);
1764 1760
1765 /* 1761 /*
1766 * Rx and Tx desscriptors needs 256 bytes alignment. 1762 * Rx and Tx desscriptors needs 256 bytes alignment.
@@ -1769,19 +1765,26 @@ static int rtl8169_open(struct net_device *dev)
1769 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, 1765 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES,
1770 &tp->TxPhyAddr); 1766 &tp->TxPhyAddr);
1771 if (!tp->TxDescArray) 1767 if (!tp->TxDescArray)
1772 goto err_free_irq; 1768 goto out;
1773 1769
1774 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, 1770 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES,
1775 &tp->RxPhyAddr); 1771 &tp->RxPhyAddr);
1776 if (!tp->RxDescArray) 1772 if (!tp->RxDescArray)
1777 goto err_free_tx; 1773 goto err_free_tx_0;
1778 1774
1779 retval = rtl8169_init_ring(dev); 1775 retval = rtl8169_init_ring(dev);
1780 if (retval < 0) 1776 if (retval < 0)
1781 goto err_free_rx; 1777 goto err_free_rx_1;
1782 1778
1783 INIT_DELAYED_WORK(&tp->task, NULL); 1779 INIT_DELAYED_WORK(&tp->task, NULL);
1784 1780
1781 smp_mb();
1782
1783 retval = request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED,
1784 dev->name, dev);
1785 if (retval < 0)
1786 goto err_release_ring_2;
1787
1785 rtl8169_hw_start(dev); 1788 rtl8169_hw_start(dev);
1786 1789
1787 rtl8169_request_timer(dev); 1790 rtl8169_request_timer(dev);
@@ -1790,14 +1793,14 @@ static int rtl8169_open(struct net_device *dev)
1790out: 1793out:
1791 return retval; 1794 return retval;
1792 1795
1793err_free_rx: 1796err_release_ring_2:
1797 rtl8169_rx_clear(tp);
1798err_free_rx_1:
1794 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, 1799 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
1795 tp->RxPhyAddr); 1800 tp->RxPhyAddr);
1796err_free_tx: 1801err_free_tx_0:
1797 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, 1802 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray,
1798 tp->TxPhyAddr); 1803 tp->TxPhyAddr);
1799err_free_irq:
1800 free_irq(dev->irq, dev);
1801 goto out; 1804 goto out;
1802} 1805}
1803 1806
@@ -2887,7 +2890,7 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
2887 void __iomem *ioaddr = tp->mmio_addr; 2890 void __iomem *ioaddr = tp->mmio_addr;
2888 2891
2889 if (!netif_running(dev)) 2892 if (!netif_running(dev))
2890 goto out; 2893 goto out_pci_suspend;
2891 2894
2892 netif_device_detach(dev); 2895 netif_device_detach(dev);
2893 netif_stop_queue(dev); 2896 netif_stop_queue(dev);
@@ -2901,10 +2904,11 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
2901 2904
2902 spin_unlock_irq(&tp->lock); 2905 spin_unlock_irq(&tp->lock);
2903 2906
2907out_pci_suspend:
2904 pci_save_state(pdev); 2908 pci_save_state(pdev);
2905 pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); 2909 pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled);
2906 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 2910 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2907out: 2911
2908 return 0; 2912 return 0;
2909} 2913}
2910 2914
@@ -2912,15 +2916,15 @@ static int rtl8169_resume(struct pci_dev *pdev)
2912{ 2916{
2913 struct net_device *dev = pci_get_drvdata(pdev); 2917 struct net_device *dev = pci_get_drvdata(pdev);
2914 2918
2919 pci_set_power_state(pdev, PCI_D0);
2920 pci_restore_state(pdev);
2921 pci_enable_wake(pdev, PCI_D0, 0);
2922
2915 if (!netif_running(dev)) 2923 if (!netif_running(dev))
2916 goto out; 2924 goto out;
2917 2925
2918 netif_device_attach(dev); 2926 netif_device_attach(dev);
2919 2927
2920 pci_set_power_state(pdev, PCI_D0);
2921 pci_restore_state(pdev);
2922 pci_enable_wake(pdev, PCI_D0, 0);
2923
2924 rtl8169_schedule_work(dev, rtl8169_reset_task); 2928 rtl8169_schedule_work(dev, rtl8169_reset_task);
2925out: 2929out:
2926 return 0; 2930 return 0;
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c
index b269513cde45..143958f1ef0a 100644
--- a/drivers/net/saa9730.c
+++ b/drivers/net/saa9730.c
@@ -64,37 +64,37 @@ static unsigned int pci_irq_line;
64 64
65static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) 65static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp)
66{ 66{
67 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, 67 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
68 &lp->evm_saa9730_regs->InterruptBlock1); 68 &lp->evm_saa9730_regs->InterruptBlock1);
69 outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, 69 writel(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT,
70 &lp->evm_saa9730_regs->InterruptStatus1); 70 &lp->evm_saa9730_regs->InterruptStatus1);
71 outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | 71 writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT |
72 EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); 72 EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1);
73} 73}
74 74
75static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) 75static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp)
76{ 76{
77 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, 77 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
78 &lp->evm_saa9730_regs->InterruptBlock1); 78 &lp->evm_saa9730_regs->InterruptBlock1);
79 outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, 79 writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT,
80 &lp->evm_saa9730_regs->InterruptEnable1); 80 &lp->evm_saa9730_regs->InterruptEnable1);
81} 81}
82 82
83static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) 83static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp)
84{ 84{
85 outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); 85 writel(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1);
86} 86}
87 87
88static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) 88static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp)
89{ 89{
90 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, 90 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
91 &lp->evm_saa9730_regs->InterruptBlock1); 91 &lp->evm_saa9730_regs->InterruptBlock1);
92} 92}
93 93
94static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) 94static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp)
95{ 95{
96 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, 96 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
97 &lp->evm_saa9730_regs->InterruptBlock1); 97 &lp->evm_saa9730_regs->InterruptBlock1);
98} 98}
99 99
100static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) 100static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp)
@@ -147,7 +147,7 @@ static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp)
147 printk("lp->lan_saa9730_regs->RxStatus = %x\n", 147 printk("lp->lan_saa9730_regs->RxStatus = %x\n",
148 readl(&lp->lan_saa9730_regs->RxStatus)); 148 readl(&lp->lan_saa9730_regs->RxStatus));
149 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { 149 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) {
150 outl(i, &lp->lan_saa9730_regs->CamAddress); 150 writel(i, &lp->lan_saa9730_regs->CamAddress);
151 printk("lp->lan_saa9730_regs->CamData = %x\n", 151 printk("lp->lan_saa9730_regs->CamData = %x\n",
152 readl(&lp->lan_saa9730_regs->CamData)); 152 readl(&lp->lan_saa9730_regs->CamData));
153 } 153 }
@@ -288,28 +288,27 @@ static int lan_saa9730_allocate_buffers(struct pci_dev *pdev,
288 * Set rx buffer A and rx buffer B to point to the first two buffer 288 * Set rx buffer A and rx buffer B to point to the first two buffer
289 * spaces. 289 * spaces.
290 */ 290 */
291 outl(lp->dma_addr + rxoffset, 291 writel(lp->dma_addr + rxoffset, &lp->lan_saa9730_regs->RxBuffA);
292 &lp->lan_saa9730_regs->RxBuffA); 292 writel(lp->dma_addr + rxoffset +
293 outl(lp->dma_addr + rxoffset + 293 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE,
294 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, 294 &lp->lan_saa9730_regs->RxBuffB);
295 &lp->lan_saa9730_regs->RxBuffB);
296 295
297 /* 296 /*
298 * Set txm_buf_a and txm_buf_b to point to the first two buffer 297 * Set txm_buf_a and txm_buf_b to point to the first two buffer
299 * space 298 * space
300 */ 299 */
301 outl(lp->dma_addr + txoffset, 300 writel(lp->dma_addr + txoffset,
302 &lp->lan_saa9730_regs->TxBuffA); 301 &lp->lan_saa9730_regs->TxBuffA);
303 outl(lp->dma_addr + txoffset + 302 writel(lp->dma_addr + txoffset +
304 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, 303 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE,
305 &lp->lan_saa9730_regs->TxBuffB); 304 &lp->lan_saa9730_regs->TxBuffB);
306 305
307 /* Set packet number */ 306 /* Set packet number */
308 outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | 307 writel((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) |
309 (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | 308 (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) |
310 (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | 309 (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) |
311 (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), 310 (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF),
312 &lp->lan_saa9730_regs->PacketCount); 311 &lp->lan_saa9730_regs->PacketCount);
313 312
314 return 0; 313 return 0;
315 314
@@ -326,10 +325,10 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp)
326 325
327 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { 326 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) {
328 /* First set address to where data is written */ 327 /* First set address to where data is written */
329 outl(i, &lp->lan_saa9730_regs->CamAddress); 328 writel(i, &lp->lan_saa9730_regs->CamAddress);
330 outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) 329 writel((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) |
331 | (NetworkAddress[2] << 8) | NetworkAddress[3], 330 (NetworkAddress[2] << 8) | NetworkAddress[3],
332 &lp->lan_saa9730_regs->CamData); 331 &lp->lan_saa9730_regs->CamData);
333 NetworkAddress += 4; 332 NetworkAddress += 4;
334 } 333 }
335 return 0; 334 return 0;
@@ -365,8 +364,8 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
365 } 364 }
366 365
367 /* Now set the control and address register. */ 366 /* Now set the control and address register. */
368 outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, 367 writel(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF,
369 &lp->lan_saa9730_regs->StationMgmtCtl); 368 &lp->lan_saa9730_regs->StationMgmtCtl);
370 369
371 /* check link status, spin here till station is not busy */ 370 /* check link status, spin here till station is not busy */
372 i = 0; 371 i = 0;
@@ -391,23 +390,23 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
391 /* Link is down, reset the PHY first. */ 390 /* Link is down, reset the PHY first. */
392 391
393 /* set PHY address = 'CONTROL' */ 392 /* set PHY address = 'CONTROL' */
394 outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, 393 writel(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL,
395 &lp->lan_saa9730_regs->StationMgmtCtl); 394 &lp->lan_saa9730_regs->StationMgmtCtl);
396 395
397 /* Wait for 1 ms. */ 396 /* Wait for 1 ms. */
398 mdelay(1); 397 mdelay(1);
399 398
400 /* set 'CONTROL' = force reset and renegotiate */ 399 /* set 'CONTROL' = force reset and renegotiate */
401 outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | 400 writel(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG |
402 PHY_CONTROL_RESTART_AUTO_NEG, 401 PHY_CONTROL_RESTART_AUTO_NEG,
403 &lp->lan_saa9730_regs->StationMgmtData); 402 &lp->lan_saa9730_regs->StationMgmtData);
404 403
405 /* Wait for 50 ms. */ 404 /* Wait for 50 ms. */
406 mdelay(50); 405 mdelay(50);
407 406
408 /* set 'BUSY' to start operation */ 407 /* set 'BUSY' to start operation */
409 outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | 408 writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR |
410 PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); 409 PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl);
411 410
412 /* await completion */ 411 /* await completion */
413 i = 0; 412 i = 0;
@@ -427,9 +426,9 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
427 426
428 for (l = 0; l < 2; l++) { 427 for (l = 0; l < 2; l++) {
429 /* set PHY address = 'STATUS' */ 428 /* set PHY address = 'STATUS' */
430 outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | 429 writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF |
431 PHY_STATUS, 430 PHY_STATUS,
432 &lp->lan_saa9730_regs->StationMgmtCtl); 431 &lp->lan_saa9730_regs->StationMgmtCtl);
433 432
434 /* await completion */ 433 /* await completion */
435 i = 0; 434 i = 0;
@@ -462,35 +461,35 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
462static int lan_saa9730_control_init(struct lan_saa9730_private *lp) 461static int lan_saa9730_control_init(struct lan_saa9730_private *lp)
463{ 462{
464 /* Initialize DMA control register. */ 463 /* Initialize DMA control register. */
465 outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | 464 writel((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) |
466 (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | 465 (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) |
467 (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) 466 (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF)
468 | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | 467 | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN |
469 DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN, 468 DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN,
470 &lp->lan_saa9730_regs->LanDmaCtl); 469 &lp->lan_saa9730_regs->LanDmaCtl);
471 470
472 /* Initial MAC control register. */ 471 /* Initial MAC control register. */
473 outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, 472 writel((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP,
474 &lp->lan_saa9730_regs->MacCtl); 473 &lp->lan_saa9730_regs->MacCtl);
475 474
476 /* Initialize CAM control register. */ 475 /* Initialize CAM control register. */
477 outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, 476 writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC,
478 &lp->lan_saa9730_regs->CamCtl); 477 &lp->lan_saa9730_regs->CamCtl);
479 478
480 /* 479 /*
481 * Initialize CAM enable register, only turn on first entry, should 480 * Initialize CAM enable register, only turn on first entry, should
482 * contain own addr. 481 * contain own addr.
483 */ 482 */
484 outl(0x0001, &lp->lan_saa9730_regs->CamEnable); 483 writel(0x0001, &lp->lan_saa9730_regs->CamEnable);
485 484
486 /* Initialize Tx control register */ 485 /* Initialize Tx control register */
487 outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); 486 writel(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl);
488 487
489 /* Initialize Rcv control register */ 488 /* Initialize Rcv control register */
490 outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); 489 writel(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl);
491 490
492 /* Reset DMA engine */ 491 /* Reset DMA engine */
493 outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); 492 writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
494 493
495 return 0; 494 return 0;
496} 495}
@@ -500,14 +499,14 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp)
500 int i; 499 int i;
501 500
502 /* Stop DMA first */ 501 /* Stop DMA first */
503 outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) & 502 writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) &
504 ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), 503 ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA),
505 &lp->lan_saa9730_regs->LanDmaCtl); 504 &lp->lan_saa9730_regs->LanDmaCtl);
506 505
507 /* Set the SW Reset bits in DMA and MAC control registers */ 506 /* Set the SW Reset bits in DMA and MAC control registers */
508 outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); 507 writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
509 outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, 508 writel(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET,
510 &lp->lan_saa9730_regs->MacCtl); 509 &lp->lan_saa9730_regs->MacCtl);
511 510
512 /* 511 /*
513 * Wait for MAC reset to have finished. The reset bit is auto cleared 512 * Wait for MAC reset to have finished. The reset bit is auto cleared
@@ -532,8 +531,8 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp)
532 /* Stop lan controller. */ 531 /* Stop lan controller. */
533 lan_saa9730_stop(lp); 532 lan_saa9730_stop(lp);
534 533
535 outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, 534 writel(LAN_SAA9730_DEFAULT_TIME_OUT_CNT,
536 &lp->lan_saa9730_regs->Timeout); 535 &lp->lan_saa9730_regs->Timeout);
537 536
538 return 0; 537 return 0;
539} 538}
@@ -552,19 +551,19 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp)
552 lp->PendingTxmPacketIndex = 0; 551 lp->PendingTxmPacketIndex = 0;
553 lp->PendingTxmBufferIndex = 0; 552 lp->PendingTxmBufferIndex = 0;
554 553
555 outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | 554 writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA |
556 DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); 555 DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl);
557 556
558 /* For Tx, turn on MAC then DMA */ 557 /* For Tx, turn on MAC then DMA */
559 outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, 558 writel(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN,
560 &lp->lan_saa9730_regs->TxCtl); 559 &lp->lan_saa9730_regs->TxCtl);
561 560
562 /* For Rx, turn on DMA then MAC */ 561 /* For Rx, turn on DMA then MAC */
563 outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, 562 writel(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN,
564 &lp->lan_saa9730_regs->RxCtl); 563 &lp->lan_saa9730_regs->RxCtl);
565 564
566 /* Set Ok2Use to let hardware own the buffers. */ 565 /* Set Ok2Use to let hardware own the buffers. */
567 outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); 566 writel(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use);
568 567
569 return 0; 568 return 0;
570} 569}
@@ -587,7 +586,7 @@ static int lan_saa9730_tx(struct net_device *dev)
587 printk("lan_saa9730_tx interrupt\n"); 586 printk("lan_saa9730_tx interrupt\n");
588 587
589 /* Clear interrupt. */ 588 /* Clear interrupt. */
590 outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); 589 writel(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus);
591 590
592 while (1) { 591 while (1) {
593 pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] 592 pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex]
@@ -660,8 +659,8 @@ static int lan_saa9730_rx(struct net_device *dev)
660 printk("lan_saa9730_rx interrupt\n"); 659 printk("lan_saa9730_rx interrupt\n");
661 660
662 /* Clear receive interrupts. */ 661 /* Clear receive interrupts. */
663 outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | 662 writel(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT |
664 DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); 663 DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus);
665 664
666 /* Address next packet */ 665 /* Address next packet */
667 BufferIndex = lp->NextRcvBufferIndex; 666 BufferIndex = lp->NextRcvBufferIndex;
@@ -725,8 +724,8 @@ static int lan_saa9730_rx(struct net_device *dev)
725 *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); 724 *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF);
726 725
727 /* Make sure A or B is available to hardware as appropriate. */ 726 /* Make sure A or B is available to hardware as appropriate. */
728 outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, 727 writel(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A,
729 &lp->lan_saa9730_regs->Ok2Use); 728 &lp->lan_saa9730_regs->Ok2Use);
730 729
731 /* Go to next packet in sequence. */ 730 /* Go to next packet in sequence. */
732 lp->NextRcvPacketIndex++; 731 lp->NextRcvPacketIndex++;
@@ -844,8 +843,8 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp,
844 (len << TX_STAT_CTL_LENGTH_SHF)); 843 (len << TX_STAT_CTL_LENGTH_SHF));
845 844
846 /* Make sure A or B is available to hardware as appropriate. */ 845 /* Make sure A or B is available to hardware as appropriate. */
847 outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, 846 writel(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A,
848 &lp->lan_saa9730_regs->Ok2Use); 847 &lp->lan_saa9730_regs->Ok2Use);
849 848
850 return 0; 849 return 0;
851} 850}
@@ -938,15 +937,15 @@ static void lan_saa9730_set_multicast(struct net_device *dev)
938 937
939 if (dev->flags & IFF_PROMISC) { 938 if (dev->flags & IFF_PROMISC) {
940 /* accept all packets */ 939 /* accept all packets */
941 outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | 940 writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC |
942 CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, 941 CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC,
943 &lp->lan_saa9730_regs->CamCtl); 942 &lp->lan_saa9730_regs->CamCtl);
944 } else { 943 } else {
945 if (dev->flags & IFF_ALLMULTI) { 944 if (dev->flags & IFF_ALLMULTI) {
946 /* accept all multicast packets */ 945 /* accept all multicast packets */
947 outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | 946 writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
948 CAM_CONTROL_BROAD_ACC, 947 CAM_CONTROL_BROAD_ACC,
949 &lp->lan_saa9730_regs->CamCtl); 948 &lp->lan_saa9730_regs->CamCtl);
950 } else { 949 } else {
951 /* 950 /*
952 * Will handle the multicast stuff later. -carstenl 951 * Will handle the multicast stuff later. -carstenl
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 1eae16b72b4b..103c3174ab54 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -243,7 +243,7 @@ struct sbmac_softc {
243 * Controller-specific things 243 * Controller-specific things
244 */ 244 */
245 245
246 volatile void __iomem *sbm_base; /* MAC's base address */ 246 void __iomem *sbm_base; /* MAC's base address */
247 sbmac_state_t sbm_state; /* current state */ 247 sbmac_state_t sbm_state; /* current state */
248 248
249 volatile void __iomem *sbm_macenable; /* MAC Enable Register */ 249 volatile void __iomem *sbm_macenable; /* MAC Enable Register */
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 4a926f20b6ea..c32c21af3fdd 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -964,7 +964,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
964 goto out; 964 goto out;
965 } 965 }
966 966
967 spin_lock_bh(&priv->lock); 967 spin_lock(&priv->lock);
968 968
969 if (unlikely(!netif_carrier_ok(dev))) { 969 if (unlikely(!netif_carrier_ok(dev))) {
970 err = -ENOLINK; 970 err = -ENOLINK;
@@ -1005,7 +1005,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
1005 netif_stop_queue(dev); 1005 netif_stop_queue(dev);
1006 1006
1007out_unlock: 1007out_unlock:
1008 spin_unlock_bh(&priv->lock); 1008 spin_unlock(&priv->lock);
1009 1009
1010out: 1010out:
1011 dev_kfree_skb(skb); 1011 dev_kfree_skb(skb);
@@ -1042,12 +1042,12 @@ static int sc92031_open(struct net_device *dev)
1042 priv->pm_config = 0; 1042 priv->pm_config = 0;
1043 1043
1044 /* Interrupts already disabled by sc92031_stop or sc92031_probe */ 1044 /* Interrupts already disabled by sc92031_stop or sc92031_probe */
1045 spin_lock(&priv->lock); 1045 spin_lock_bh(&priv->lock);
1046 1046
1047 _sc92031_reset(dev); 1047 _sc92031_reset(dev);
1048 mmiowb(); 1048 mmiowb();
1049 1049
1050 spin_unlock(&priv->lock); 1050 spin_unlock_bh(&priv->lock);
1051 sc92031_enable_interrupts(dev); 1051 sc92031_enable_interrupts(dev);
1052 1052
1053 if (netif_carrier_ok(dev)) 1053 if (netif_carrier_ok(dev))
@@ -1077,13 +1077,13 @@ static int sc92031_stop(struct net_device *dev)
1077 /* Disable interrupts, stop Tx and Rx. */ 1077 /* Disable interrupts, stop Tx and Rx. */
1078 sc92031_disable_interrupts(dev); 1078 sc92031_disable_interrupts(dev);
1079 1079
1080 spin_lock(&priv->lock); 1080 spin_lock_bh(&priv->lock);
1081 1081
1082 _sc92031_disable_tx_rx(dev); 1082 _sc92031_disable_tx_rx(dev);
1083 _sc92031_tx_clear(dev); 1083 _sc92031_tx_clear(dev);
1084 mmiowb(); 1084 mmiowb();
1085 1085
1086 spin_unlock(&priv->lock); 1086 spin_unlock_bh(&priv->lock);
1087 1087
1088 free_irq(pdev->irq, dev); 1088 free_irq(pdev->irq, dev);
1089 pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs, 1089 pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs,
@@ -1539,13 +1539,13 @@ static int sc92031_suspend(struct pci_dev *pdev, pm_message_t state)
1539 /* Disable interrupts, stop Tx and Rx. */ 1539 /* Disable interrupts, stop Tx and Rx. */
1540 sc92031_disable_interrupts(dev); 1540 sc92031_disable_interrupts(dev);
1541 1541
1542 spin_lock(&priv->lock); 1542 spin_lock_bh(&priv->lock);
1543 1543
1544 _sc92031_disable_tx_rx(dev); 1544 _sc92031_disable_tx_rx(dev);
1545 _sc92031_tx_clear(dev); 1545 _sc92031_tx_clear(dev);
1546 mmiowb(); 1546 mmiowb();
1547 1547
1548 spin_unlock(&priv->lock); 1548 spin_unlock_bh(&priv->lock);
1549 1549
1550out: 1550out:
1551 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1551 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1565,12 +1565,12 @@ static int sc92031_resume(struct pci_dev *pdev)
1565 goto out; 1565 goto out;
1566 1566
1567 /* Interrupts already disabled by sc92031_suspend */ 1567 /* Interrupts already disabled by sc92031_suspend */
1568 spin_lock(&priv->lock); 1568 spin_lock_bh(&priv->lock);
1569 1569
1570 _sc92031_reset(dev); 1570 _sc92031_reset(dev);
1571 mmiowb(); 1571 mmiowb();
1572 1572
1573 spin_unlock(&priv->lock); 1573 spin_unlock_bh(&priv->lock);
1574 sc92031_enable_interrupts(dev); 1574 sc92031_enable_interrupts(dev);
1575 1575
1576 netif_device_attach(dev); 1576 netif_device_attach(dev);
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index b08508b35833..34463ce6f132 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -324,6 +324,7 @@ static struct mii_chip_info {
324 u32 feature; 324 u32 feature;
325} mii_chip_table[] = { 325} mii_chip_table[] = {
326 { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 }, 326 { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 },
327 { "Broadcom PHY AC131", { 0x0143, 0xbc70 }, LAN, 0 },
327 { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 }, 328 { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 },
328 { "Marvell PHY 88E1111", { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 }, 329 { "Marvell PHY 88E1111", { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 },
329 { "Realtek PHY RTL8201", { 0x0000, 0x8200 }, LAN, 0 }, 330 { "Realtek PHY RTL8201", { 0x0000, 0x8200 }, LAN, 0 },
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index eea75a401b0c..d476a3cc2e94 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -105,7 +105,8 @@ static const int txqaddr[] = { Q_XA1, Q_XA2 };
105static const int rxqaddr[] = { Q_R1, Q_R2 }; 105static const int rxqaddr[] = { Q_R1, Q_R2 };
106static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; 106static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
107static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; 107static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
108static const u32 irqmask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F }; 108static const u32 napimask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F };
109static const u32 portmask[] = { IS_PORT_1, IS_PORT_2 };
109 110
110static int skge_get_regs_len(struct net_device *dev) 111static int skge_get_regs_len(struct net_device *dev)
111{ 112{
@@ -162,27 +163,46 @@ static void skge_wol_init(struct skge_port *skge)
162{ 163{
163 struct skge_hw *hw = skge->hw; 164 struct skge_hw *hw = skge->hw;
164 int port = skge->port; 165 int port = skge->port;
165 enum pause_control save_mode; 166 u16 ctrl;
166 u32 ctrl;
167 167
168 /* Bring hardware out of reset */
169 skge_write16(hw, B0_CTST, CS_RST_CLR); 168 skge_write16(hw, B0_CTST, CS_RST_CLR);
170 skge_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR); 169 skge_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR);
171 170
172 skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); 171 /* Turn on Vaux */
173 skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); 172 skge_write8(hw, B0_POWER_CTRL,
173 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF);
174 174
175 /* Force to 10/100 skge_reset will re-enable on resume */ 175 /* WA code for COMA mode -- clear PHY reset */
176 save_mode = skge->flow_control; 176 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
177 skge->flow_control = FLOW_MODE_SYMMETRIC; 177 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
178 u32 reg = skge_read32(hw, B2_GP_IO);
179 reg |= GP_DIR_9;
180 reg &= ~GP_IO_9;
181 skge_write32(hw, B2_GP_IO, reg);
182 }
178 183
179 ctrl = skge->advertising; 184 skge_write32(hw, SK_REG(port, GPHY_CTRL),
180 skge->advertising &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full); 185 GPC_DIS_SLEEP |
186 GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0 |
187 GPC_ANEG_1 | GPC_RST_SET);
181 188
182 skge_phy_reset(skge); 189 skge_write32(hw, SK_REG(port, GPHY_CTRL),
190 GPC_DIS_SLEEP |
191 GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0 |
192 GPC_ANEG_1 | GPC_RST_CLR);
193
194 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR);
195
196 /* Force to 10/100 skge_reset will re-enable on resume */
197 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV,
198 PHY_AN_100FULL | PHY_AN_100HALF |
199 PHY_AN_10FULL | PHY_AN_10HALF| PHY_AN_CSMA);
200 /* no 1000 HD/FD */
201 gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, 0);
202 gm_phy_write(hw, port, PHY_MARV_CTRL,
203 PHY_CT_RESET | PHY_CT_SPS_LSB | PHY_CT_ANE |
204 PHY_CT_RE_CFG | PHY_CT_DUP_MD);
183 205
184 skge->flow_control = save_mode;
185 skge->advertising = ctrl;
186 206
187 /* Set GMAC to no flow control and auto update for speed/duplex */ 207 /* Set GMAC to no flow control and auto update for speed/duplex */
188 gma_write16(hw, port, GM_GP_CTRL, 208 gma_write16(hw, port, GM_GP_CTRL,
@@ -226,12 +246,10 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
226 struct skge_port *skge = netdev_priv(dev); 246 struct skge_port *skge = netdev_priv(dev);
227 struct skge_hw *hw = skge->hw; 247 struct skge_hw *hw = skge->hw;
228 248
229 if (wol->wolopts & wol_supported(hw)) 249 if (wol->wolopts & ~wol_supported(hw))
230 return -EOPNOTSUPP; 250 return -EOPNOTSUPP;
231 251
232 skge->wol = wol->wolopts; 252 skge->wol = wol->wolopts;
233 if (!netif_running(dev))
234 skge_wol_init(skge);
235 return 0; 253 return 0;
236} 254}
237 255
@@ -671,7 +689,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
671 struct skge_hw *hw = skge->hw; 689 struct skge_hw *hw = skge->hw;
672 int port = skge->port; 690 int port = skge->port;
673 691
674 mutex_lock(&hw->phy_mutex); 692 spin_lock_bh(&hw->phy_lock);
675 if (hw->chip_id == CHIP_ID_GENESIS) { 693 if (hw->chip_id == CHIP_ID_GENESIS) {
676 switch (mode) { 694 switch (mode) {
677 case LED_MODE_OFF: 695 case LED_MODE_OFF:
@@ -742,7 +760,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
742 PHY_M_LED_MO_RX(MO_LED_ON)); 760 PHY_M_LED_MO_RX(MO_LED_ON));
743 } 761 }
744 } 762 }
745 mutex_unlock(&hw->phy_mutex); 763 spin_unlock_bh(&hw->phy_lock);
746} 764}
747 765
748/* blink LED's for finding board */ 766/* blink LED's for finding board */
@@ -1316,7 +1334,7 @@ static void xm_phy_init(struct skge_port *skge)
1316 xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl); 1334 xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl);
1317 1335
1318 /* Poll PHY for status changes */ 1336 /* Poll PHY for status changes */
1319 schedule_delayed_work(&skge->link_thread, LINK_HZ); 1337 mod_timer(&skge->link_timer, jiffies + LINK_HZ);
1320} 1338}
1321 1339
1322static void xm_check_link(struct net_device *dev) 1340static void xm_check_link(struct net_device *dev)
@@ -1391,10 +1409,9 @@ static void xm_check_link(struct net_device *dev)
1391 * Since internal PHY is wired to a level triggered pin, can't 1409 * Since internal PHY is wired to a level triggered pin, can't
1392 * get an interrupt when carrier is detected. 1410 * get an interrupt when carrier is detected.
1393 */ 1411 */
1394static void xm_link_timer(struct work_struct *work) 1412static void xm_link_timer(unsigned long arg)
1395{ 1413{
1396 struct skge_port *skge = 1414 struct skge_port *skge = (struct skge_port *) arg;
1397 container_of(work, struct skge_port, link_thread.work);
1398 struct net_device *dev = skge->netdev; 1415 struct net_device *dev = skge->netdev;
1399 struct skge_hw *hw = skge->hw; 1416 struct skge_hw *hw = skge->hw;
1400 int port = skge->port; 1417 int port = skge->port;
@@ -1414,13 +1431,13 @@ static void xm_link_timer(struct work_struct *work)
1414 goto nochange; 1431 goto nochange;
1415 } 1432 }
1416 1433
1417 mutex_lock(&hw->phy_mutex); 1434 spin_lock(&hw->phy_lock);
1418 xm_check_link(dev); 1435 xm_check_link(dev);
1419 mutex_unlock(&hw->phy_mutex); 1436 spin_unlock(&hw->phy_lock);
1420 1437
1421nochange: 1438nochange:
1422 if (netif_running(dev)) 1439 if (netif_running(dev))
1423 schedule_delayed_work(&skge->link_thread, LINK_HZ); 1440 mod_timer(&skge->link_timer, jiffies + LINK_HZ);
1424} 1441}
1425 1442
1426static void genesis_mac_init(struct skge_hw *hw, int port) 1443static void genesis_mac_init(struct skge_hw *hw, int port)
@@ -2323,7 +2340,7 @@ static void skge_phy_reset(struct skge_port *skge)
2323 netif_stop_queue(skge->netdev); 2340 netif_stop_queue(skge->netdev);
2324 netif_carrier_off(skge->netdev); 2341 netif_carrier_off(skge->netdev);
2325 2342
2326 mutex_lock(&hw->phy_mutex); 2343 spin_lock_bh(&hw->phy_lock);
2327 if (hw->chip_id == CHIP_ID_GENESIS) { 2344 if (hw->chip_id == CHIP_ID_GENESIS) {
2328 genesis_reset(hw, port); 2345 genesis_reset(hw, port);
2329 genesis_mac_init(hw, port); 2346 genesis_mac_init(hw, port);
@@ -2331,7 +2348,7 @@ static void skge_phy_reset(struct skge_port *skge)
2331 yukon_reset(hw, port); 2348 yukon_reset(hw, port);
2332 yukon_init(hw, port); 2349 yukon_init(hw, port);
2333 } 2350 }
2334 mutex_unlock(&hw->phy_mutex); 2351 spin_unlock_bh(&hw->phy_lock);
2335 2352
2336 dev->set_multicast_list(dev); 2353 dev->set_multicast_list(dev);
2337} 2354}
@@ -2354,12 +2371,12 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2354 /* fallthru */ 2371 /* fallthru */
2355 case SIOCGMIIREG: { 2372 case SIOCGMIIREG: {
2356 u16 val = 0; 2373 u16 val = 0;
2357 mutex_lock(&hw->phy_mutex); 2374 spin_lock_bh(&hw->phy_lock);
2358 if (hw->chip_id == CHIP_ID_GENESIS) 2375 if (hw->chip_id == CHIP_ID_GENESIS)
2359 err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); 2376 err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val);
2360 else 2377 else
2361 err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); 2378 err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val);
2362 mutex_unlock(&hw->phy_mutex); 2379 spin_unlock_bh(&hw->phy_lock);
2363 data->val_out = val; 2380 data->val_out = val;
2364 break; 2381 break;
2365 } 2382 }
@@ -2368,14 +2385,14 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2368 if (!capable(CAP_NET_ADMIN)) 2385 if (!capable(CAP_NET_ADMIN))
2369 return -EPERM; 2386 return -EPERM;
2370 2387
2371 mutex_lock(&hw->phy_mutex); 2388 spin_lock_bh(&hw->phy_lock);
2372 if (hw->chip_id == CHIP_ID_GENESIS) 2389 if (hw->chip_id == CHIP_ID_GENESIS)
2373 err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, 2390 err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f,
2374 data->val_in); 2391 data->val_in);
2375 else 2392 else
2376 err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, 2393 err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f,
2377 data->val_in); 2394 data->val_in);
2378 mutex_unlock(&hw->phy_mutex); 2395 spin_unlock_bh(&hw->phy_lock);
2379 break; 2396 break;
2380 } 2397 }
2381 return err; 2398 return err;
@@ -2481,12 +2498,12 @@ static int skge_up(struct net_device *dev)
2481 goto free_rx_ring; 2498 goto free_rx_ring;
2482 2499
2483 /* Initialize MAC */ 2500 /* Initialize MAC */
2484 mutex_lock(&hw->phy_mutex); 2501 spin_lock_bh(&hw->phy_lock);
2485 if (hw->chip_id == CHIP_ID_GENESIS) 2502 if (hw->chip_id == CHIP_ID_GENESIS)
2486 genesis_mac_init(hw, port); 2503 genesis_mac_init(hw, port);
2487 else 2504 else
2488 yukon_mac_init(hw, port); 2505 yukon_mac_init(hw, port);
2489 mutex_unlock(&hw->phy_mutex); 2506 spin_unlock_bh(&hw->phy_lock);
2490 2507
2491 /* Configure RAMbuffers */ 2508 /* Configure RAMbuffers */
2492 chunk = hw->ram_size / ((hw->ports + 1)*2); 2509 chunk = hw->ram_size / ((hw->ports + 1)*2);
@@ -2504,6 +2521,11 @@ static int skge_up(struct net_device *dev)
2504 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); 2521 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2505 skge_led(skge, LED_MODE_ON); 2522 skge_led(skge, LED_MODE_ON);
2506 2523
2524 spin_lock_irq(&hw->hw_lock);
2525 hw->intr_mask |= portmask[port];
2526 skge_write32(hw, B0_IMSK, hw->intr_mask);
2527 spin_unlock_irq(&hw->hw_lock);
2528
2507 netif_poll_enable(dev); 2529 netif_poll_enable(dev);
2508 return 0; 2530 return 0;
2509 2531
@@ -2530,8 +2552,17 @@ static int skge_down(struct net_device *dev)
2530 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); 2552 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
2531 2553
2532 netif_stop_queue(dev); 2554 netif_stop_queue(dev);
2555
2533 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) 2556 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2534 cancel_delayed_work(&skge->link_thread); 2557 del_timer_sync(&skge->link_timer);
2558
2559 netif_poll_disable(dev);
2560 netif_carrier_off(dev);
2561
2562 spin_lock_irq(&hw->hw_lock);
2563 hw->intr_mask &= ~portmask[port];
2564 skge_write32(hw, B0_IMSK, hw->intr_mask);
2565 spin_unlock_irq(&hw->hw_lock);
2535 2566
2536 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); 2567 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
2537 if (hw->chip_id == CHIP_ID_GENESIS) 2568 if (hw->chip_id == CHIP_ID_GENESIS)
@@ -2575,8 +2606,10 @@ static int skge_down(struct net_device *dev)
2575 2606
2576 skge_led(skge, LED_MODE_OFF); 2607 skge_led(skge, LED_MODE_OFF);
2577 2608
2578 netif_poll_disable(dev); 2609 netif_tx_lock_bh(dev);
2579 skge_tx_clean(dev); 2610 skge_tx_clean(dev);
2611 netif_tx_unlock_bh(dev);
2612
2580 skge_rx_clean(skge); 2613 skge_rx_clean(skge);
2581 2614
2582 kfree(skge->rx_ring.start); 2615 kfree(skge->rx_ring.start);
@@ -2721,7 +2754,6 @@ static void skge_tx_clean(struct net_device *dev)
2721 struct skge_port *skge = netdev_priv(dev); 2754 struct skge_port *skge = netdev_priv(dev);
2722 struct skge_element *e; 2755 struct skge_element *e;
2723 2756
2724 netif_tx_lock_bh(dev);
2725 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { 2757 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) {
2726 struct skge_tx_desc *td = e->desc; 2758 struct skge_tx_desc *td = e->desc;
2727 skge_tx_free(skge, e, td->control); 2759 skge_tx_free(skge, e, td->control);
@@ -2730,7 +2762,6 @@ static void skge_tx_clean(struct net_device *dev)
2730 2762
2731 skge->tx_ring.to_clean = e; 2763 skge->tx_ring.to_clean = e;
2732 netif_wake_queue(dev); 2764 netif_wake_queue(dev);
2733 netif_tx_unlock_bh(dev);
2734} 2765}
2735 2766
2736static void skge_tx_timeout(struct net_device *dev) 2767static void skge_tx_timeout(struct net_device *dev)
@@ -3049,7 +3080,7 @@ static int skge_poll(struct net_device *dev, int *budget)
3049 3080
3050 spin_lock_irqsave(&hw->hw_lock, flags); 3081 spin_lock_irqsave(&hw->hw_lock, flags);
3051 __netif_rx_complete(dev); 3082 __netif_rx_complete(dev);
3052 hw->intr_mask |= irqmask[skge->port]; 3083 hw->intr_mask |= napimask[skge->port];
3053 skge_write32(hw, B0_IMSK, hw->intr_mask); 3084 skge_write32(hw, B0_IMSK, hw->intr_mask);
3054 skge_read32(hw, B0_IMSK); 3085 skge_read32(hw, B0_IMSK);
3055 spin_unlock_irqrestore(&hw->hw_lock, flags); 3086 spin_unlock_irqrestore(&hw->hw_lock, flags);
@@ -3160,28 +3191,29 @@ static void skge_error_irq(struct skge_hw *hw)
3160} 3191}
3161 3192
3162/* 3193/*
3163 * Interrupt from PHY are handled in work queue 3194 * Interrupt from PHY are handled in tasklet (softirq)
3164 * because accessing phy registers requires spin wait which might 3195 * because accessing phy registers requires spin wait which might
3165 * cause excess interrupt latency. 3196 * cause excess interrupt latency.
3166 */ 3197 */
3167static void skge_extirq(struct work_struct *work) 3198static void skge_extirq(unsigned long arg)
3168{ 3199{
3169 struct skge_hw *hw = container_of(work, struct skge_hw, phy_work); 3200 struct skge_hw *hw = (struct skge_hw *) arg;
3170 int port; 3201 int port;
3171 3202
3172 mutex_lock(&hw->phy_mutex);
3173 for (port = 0; port < hw->ports; port++) { 3203 for (port = 0; port < hw->ports; port++) {
3174 struct net_device *dev = hw->dev[port]; 3204 struct net_device *dev = hw->dev[port];
3175 struct skge_port *skge = netdev_priv(dev);
3176 3205
3177 if (netif_running(dev)) { 3206 if (netif_running(dev)) {
3207 struct skge_port *skge = netdev_priv(dev);
3208
3209 spin_lock(&hw->phy_lock);
3178 if (hw->chip_id != CHIP_ID_GENESIS) 3210 if (hw->chip_id != CHIP_ID_GENESIS)
3179 yukon_phy_intr(skge); 3211 yukon_phy_intr(skge);
3180 else if (hw->phy_type == SK_PHY_BCOM) 3212 else if (hw->phy_type == SK_PHY_BCOM)
3181 bcom_phy_intr(skge); 3213 bcom_phy_intr(skge);
3214 spin_unlock(&hw->phy_lock);
3182 } 3215 }
3183 } 3216 }
3184 mutex_unlock(&hw->phy_mutex);
3185 3217
3186 spin_lock_irq(&hw->hw_lock); 3218 spin_lock_irq(&hw->hw_lock);
3187 hw->intr_mask |= IS_EXT_REG; 3219 hw->intr_mask |= IS_EXT_REG;
@@ -3206,7 +3238,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
3206 status &= hw->intr_mask; 3238 status &= hw->intr_mask;
3207 if (status & IS_EXT_REG) { 3239 if (status & IS_EXT_REG) {
3208 hw->intr_mask &= ~IS_EXT_REG; 3240 hw->intr_mask &= ~IS_EXT_REG;
3209 schedule_work(&hw->phy_work); 3241 tasklet_schedule(&hw->phy_task);
3210 } 3242 }
3211 3243
3212 if (status & (IS_XA1_F|IS_R1_F)) { 3244 if (status & (IS_XA1_F|IS_R1_F)) {
@@ -3275,24 +3307,35 @@ static int skge_set_mac_address(struct net_device *dev, void *p)
3275 struct skge_hw *hw = skge->hw; 3307 struct skge_hw *hw = skge->hw;
3276 unsigned port = skge->port; 3308 unsigned port = skge->port;
3277 const struct sockaddr *addr = p; 3309 const struct sockaddr *addr = p;
3310 u16 ctrl;
3278 3311
3279 if (!is_valid_ether_addr(addr->sa_data)) 3312 if (!is_valid_ether_addr(addr->sa_data))
3280 return -EADDRNOTAVAIL; 3313 return -EADDRNOTAVAIL;
3281 3314
3282 mutex_lock(&hw->phy_mutex);
3283 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 3315 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
3284 memcpy_toio(hw->regs + B2_MAC_1 + port*8,
3285 dev->dev_addr, ETH_ALEN);
3286 memcpy_toio(hw->regs + B2_MAC_2 + port*8,
3287 dev->dev_addr, ETH_ALEN);
3288 3316
3289 if (hw->chip_id == CHIP_ID_GENESIS) 3317 if (!netif_running(dev)) {
3290 xm_outaddr(hw, port, XM_SA, dev->dev_addr); 3318 memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
3291 else { 3319 memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
3292 gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr); 3320 } else {
3293 gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr); 3321 /* disable Rx */
3322 spin_lock_bh(&hw->phy_lock);
3323 ctrl = gma_read16(hw, port, GM_GP_CTRL);
3324 gma_write16(hw, port, GM_GP_CTRL, ctrl & ~GM_GPCR_RX_ENA);
3325
3326 memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
3327 memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
3328
3329 if (hw->chip_id == CHIP_ID_GENESIS)
3330 xm_outaddr(hw, port, XM_SA, dev->dev_addr);
3331 else {
3332 gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
3333 gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
3334 }
3335
3336 gma_write16(hw, port, GM_GP_CTRL, ctrl);
3337 spin_unlock_bh(&hw->phy_lock);
3294 } 3338 }
3295 mutex_unlock(&hw->phy_mutex);
3296 3339
3297 return 0; 3340 return 0;
3298} 3341}
@@ -3407,10 +3450,9 @@ static int skge_reset(struct skge_hw *hw)
3407 else 3450 else
3408 hw->ram_size = t8 * 4096; 3451 hw->ram_size = t8 * 4096;
3409 3452
3410 hw->intr_mask = IS_HW_ERR | IS_PORT_1; 3453 hw->intr_mask = IS_HW_ERR;
3411 if (hw->ports > 1)
3412 hw->intr_mask |= IS_PORT_2;
3413 3454
3455 /* Use PHY IRQ for all but fiber based Genesis board */
3414 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)) 3456 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC))
3415 hw->intr_mask |= IS_EXT_REG; 3457 hw->intr_mask |= IS_EXT_REG;
3416 3458
@@ -3478,14 +3520,12 @@ static int skge_reset(struct skge_hw *hw)
3478 3520
3479 skge_write32(hw, B0_IMSK, hw->intr_mask); 3521 skge_write32(hw, B0_IMSK, hw->intr_mask);
3480 3522
3481 mutex_lock(&hw->phy_mutex);
3482 for (i = 0; i < hw->ports; i++) { 3523 for (i = 0; i < hw->ports; i++) {
3483 if (hw->chip_id == CHIP_ID_GENESIS) 3524 if (hw->chip_id == CHIP_ID_GENESIS)
3484 genesis_reset(hw, i); 3525 genesis_reset(hw, i);
3485 else 3526 else
3486 yukon_reset(hw, i); 3527 yukon_reset(hw, i);
3487 } 3528 }
3488 mutex_unlock(&hw->phy_mutex);
3489 3529
3490 return 0; 3530 return 0;
3491} 3531}
@@ -3533,6 +3573,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3533 skge->netdev = dev; 3573 skge->netdev = dev;
3534 skge->hw = hw; 3574 skge->hw = hw;
3535 skge->msg_enable = netif_msg_init(debug, default_msg); 3575 skge->msg_enable = netif_msg_init(debug, default_msg);
3576
3536 skge->tx_ring.count = DEFAULT_TX_RING_SIZE; 3577 skge->tx_ring.count = DEFAULT_TX_RING_SIZE;
3537 skge->rx_ring.count = DEFAULT_RX_RING_SIZE; 3578 skge->rx_ring.count = DEFAULT_RX_RING_SIZE;
3538 3579
@@ -3549,7 +3590,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3549 skge->port = port; 3590 skge->port = port;
3550 3591
3551 /* Only used for Genesis XMAC */ 3592 /* Only used for Genesis XMAC */
3552 INIT_DELAYED_WORK(&skge->link_thread, xm_link_timer); 3593 setup_timer(&skge->link_timer, xm_link_timer, (unsigned long) skge);
3553 3594
3554 if (hw->chip_id != CHIP_ID_GENESIS) { 3595 if (hw->chip_id != CHIP_ID_GENESIS) {
3555 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 3596 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
@@ -3631,9 +3672,9 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3631 } 3672 }
3632 3673
3633 hw->pdev = pdev; 3674 hw->pdev = pdev;
3634 mutex_init(&hw->phy_mutex);
3635 INIT_WORK(&hw->phy_work, skge_extirq);
3636 spin_lock_init(&hw->hw_lock); 3675 spin_lock_init(&hw->hw_lock);
3676 spin_lock_init(&hw->phy_lock);
3677 tasklet_init(&hw->phy_task, &skge_extirq, (unsigned long) hw);
3637 3678
3638 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); 3679 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
3639 if (!hw->regs) { 3680 if (!hw->regs) {
@@ -3719,6 +3760,8 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3719 dev0 = hw->dev[0]; 3760 dev0 = hw->dev[0];
3720 unregister_netdev(dev0); 3761 unregister_netdev(dev0);
3721 3762
3763 tasklet_disable(&hw->phy_task);
3764
3722 spin_lock_irq(&hw->hw_lock); 3765 spin_lock_irq(&hw->hw_lock);
3723 hw->intr_mask = 0; 3766 hw->intr_mask = 0;
3724 skge_write32(hw, B0_IMSK, 0); 3767 skge_write32(hw, B0_IMSK, 0);
@@ -3741,21 +3784,6 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3741} 3784}
3742 3785
3743#ifdef CONFIG_PM 3786#ifdef CONFIG_PM
3744static int vaux_avail(struct pci_dev *pdev)
3745{
3746 int pm_cap;
3747
3748 pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
3749 if (pm_cap) {
3750 u16 ctl;
3751 pci_read_config_word(pdev, pm_cap + PCI_PM_PMC, &ctl);
3752 if (ctl & PCI_PM_CAP_AUX_POWER)
3753 return 1;
3754 }
3755 return 0;
3756}
3757
3758
3759static int skge_suspend(struct pci_dev *pdev, pm_message_t state) 3787static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
3760{ 3788{
3761 struct skge_hw *hw = pci_get_drvdata(pdev); 3789 struct skge_hw *hw = pci_get_drvdata(pdev);
@@ -3777,10 +3805,6 @@ static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
3777 wol |= skge->wol; 3805 wol |= skge->wol;
3778 } 3806 }
3779 3807
3780 if (wol && vaux_avail(pdev))
3781 skge_write8(hw, B0_POWER_CTRL,
3782 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF);
3783
3784 skge_write32(hw, B0_IMSK, 0); 3808 skge_write32(hw, B0_IMSK, 0);
3785 pci_enable_wake(pdev, pci_choose_state(pdev, state), wol); 3809 pci_enable_wake(pdev, pci_choose_state(pdev, state), wol);
3786 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3810 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -3826,6 +3850,28 @@ out:
3826} 3850}
3827#endif 3851#endif
3828 3852
3853static void skge_shutdown(struct pci_dev *pdev)
3854{
3855 struct skge_hw *hw = pci_get_drvdata(pdev);
3856 int i, wol = 0;
3857
3858 for (i = 0; i < hw->ports; i++) {
3859 struct net_device *dev = hw->dev[i];
3860 struct skge_port *skge = netdev_priv(dev);
3861
3862 if (skge->wol)
3863 skge_wol_init(skge);
3864 wol |= skge->wol;
3865 }
3866
3867 pci_enable_wake(pdev, PCI_D3hot, wol);
3868 pci_enable_wake(pdev, PCI_D3cold, wol);
3869
3870 pci_disable_device(pdev);
3871 pci_set_power_state(pdev, PCI_D3hot);
3872
3873}
3874
3829static struct pci_driver skge_driver = { 3875static struct pci_driver skge_driver = {
3830 .name = DRV_NAME, 3876 .name = DRV_NAME,
3831 .id_table = skge_id_table, 3877 .id_table = skge_id_table,
@@ -3835,6 +3881,7 @@ static struct pci_driver skge_driver = {
3835 .suspend = skge_suspend, 3881 .suspend = skge_suspend,
3836 .resume = skge_resume, 3882 .resume = skge_resume,
3837#endif 3883#endif
3884 .shutdown = skge_shutdown,
3838}; 3885};
3839 3886
3840static int __init skge_init_module(void) 3887static int __init skge_init_module(void)
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index e9354dfa7e9a..86467ae74d45 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -2424,8 +2424,8 @@ struct skge_hw {
2424 u32 ram_size; 2424 u32 ram_size;
2425 u32 ram_offset; 2425 u32 ram_offset;
2426 u16 phy_addr; 2426 u16 phy_addr;
2427 struct work_struct phy_work; 2427 spinlock_t phy_lock;
2428 struct mutex phy_mutex; 2428 struct tasklet_struct phy_task;
2429}; 2429};
2430 2430
2431enum pause_control { 2431enum pause_control {
@@ -2457,7 +2457,7 @@ struct skge_port {
2457 2457
2458 struct net_device_stats net_stats; 2458 struct net_device_stats net_stats;
2459 2459
2460 struct delayed_work link_thread; 2460 struct timer_list link_timer;
2461 enum pause_control flow_control; 2461 enum pause_control flow_control;
2462 enum pause_status flow_status; 2462 enum pause_status flow_status;
2463 u8 rx_csum; 2463 u8 rx_csum;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 53839979cfb8..4a009b7b1777 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -510,9 +510,9 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
510 ledover &= ~PHY_M_LED_MO_RX; 510 ledover &= ~PHY_M_LED_MO_RX;
511 } 511 }
512 512
513 if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) { 513 if (hw->chip_id == CHIP_ID_YUKON_EC_U &&
514 hw->chip_rev == CHIP_REV_YU_EC_U_A1) {
514 /* apply fixes in PHY AFE */ 515 /* apply fixes in PHY AFE */
515 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
516 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255); 516 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255);
517 517
518 /* increase differential signal amplitude in 10BASE-T */ 518 /* increase differential signal amplitude in 10BASE-T */
@@ -524,7 +524,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
524 gm_phy_write(hw, port, 0x17, 0x2002); 524 gm_phy_write(hw, port, 0x17, 0x2002);
525 525
526 /* set page register to 0 */ 526 /* set page register to 0 */
527 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 527 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0);
528 } else if (hw->chip_id != CHIP_ID_YUKON_EX) { 528 } else if (hw->chip_id != CHIP_ID_YUKON_EX) {
529 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); 529 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
530 530
@@ -1561,6 +1561,7 @@ static int sky2_down(struct net_device *dev)
1561 1561
1562 /* Stop more packets from being queued */ 1562 /* Stop more packets from being queued */
1563 netif_stop_queue(dev); 1563 netif_stop_queue(dev);
1564 netif_carrier_off(dev);
1564 1565
1565 /* Disable port IRQ */ 1566 /* Disable port IRQ */
1566 imask = sky2_read32(hw, B0_IMSK); 1567 imask = sky2_read32(hw, B0_IMSK);
@@ -2165,9 +2166,27 @@ force_update:
2165 /* fall through */ 2166 /* fall through */
2166#endif 2167#endif
2167 case OP_RXCHKS: 2168 case OP_RXCHKS:
2168 skb = sky2->rx_ring[sky2->rx_next].skb; 2169 if (!sky2->rx_csum)
2169 skb->ip_summed = CHECKSUM_COMPLETE; 2170 break;
2170 skb->csum = status & 0xffff; 2171
2172 /* Both checksum counters are programmed to start at
2173 * the same offset, so unless there is a problem they
2174 * should match. This failure is an early indication that
2175 * hardware receive checksumming won't work.
2176 */
2177 if (likely(status >> 16 == (status & 0xffff))) {
2178 skb = sky2->rx_ring[sky2->rx_next].skb;
2179 skb->ip_summed = CHECKSUM_COMPLETE;
2180 skb->csum = status & 0xffff;
2181 } else {
2182 printk(KERN_NOTICE PFX "%s: hardware receive "
2183 "checksum problem (status = %#x)\n",
2184 dev->name, status);
2185 sky2->rx_csum = 0;
2186 sky2_write32(sky2->hw,
2187 Q_ADDR(rxqaddr[le->link], Q_CSR),
2188 BMU_DIS_RX_CHKSUM);
2189 }
2171 break; 2190 break;
2172 2191
2173 case OP_TXINDEXLE: 2192 case OP_TXINDEXLE:
@@ -3751,6 +3770,11 @@ static int sky2_resume(struct pci_dev *pdev)
3751 goto out; 3770 goto out;
3752 3771
3753 pci_enable_wake(pdev, PCI_D0, 0); 3772 pci_enable_wake(pdev, PCI_D0, 0);
3773
3774 /* Re-enable all clocks */
3775 if (hw->chip_id == CHIP_ID_YUKON_EX || hw->chip_id == CHIP_ID_YUKON_EC_U)
3776 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
3777
3754 sky2_reset(hw); 3778 sky2_reset(hw);
3755 3779
3756 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 3780 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index c62e85d89f41..7bee45b42a2c 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev)
336 336
337 /* XXX - leak? */ 337 /* XXX - leak? */
338 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); 338 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
339 if (MEM == NULL) {
340#ifdef CONFIG_SUN3
341 iounmap((void __iomem *)ioaddr);
342#endif
343 printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
344 return 0;
345 }
339 346
340 lp->iobase = (volatile unsigned short *)ioaddr; 347 lp->iobase = (volatile unsigned short *)ioaddr;
341 dev->base_addr = (unsigned long)ioaddr; /* informational only */ 348 dev->base_addr = (unsigned long)ioaddr; /* informational only */
342 349
343 REGA(CSR0) = CSR0_STOP; 350 REGA(CSR0) = CSR0_STOP;
344 351
345 request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); 352 if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
353#ifdef CONFIG_SUN3
354 iounmap((void __iomem *)ioaddr);
355#endif
356 dvma_free((void *)MEM);
357 printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
358 return 0;
359 }
346 dev->irq = (unsigned short)LANCE_IRQ; 360 dev->irq = (unsigned short)LANCE_IRQ;
347 361
348 362
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 616be8d0fa85..08ea61db46fe 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2530,6 +2530,35 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev)
2530 return &gp->net_stats; 2530 return &gp->net_stats;
2531} 2531}
2532 2532
2533static int gem_set_mac_address(struct net_device *dev, void *addr)
2534{
2535 struct sockaddr *macaddr = (struct sockaddr *) addr;
2536 struct gem *gp = dev->priv;
2537 unsigned char *e = &dev->dev_addr[0];
2538
2539 if (!is_valid_ether_addr(macaddr->sa_data))
2540 return -EADDRNOTAVAIL;
2541
2542 if (!netif_running(dev) || !netif_device_present(dev)) {
2543 /* We'll just catch it later when the
2544 * device is up'd or resumed.
2545 */
2546 memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
2547 return 0;
2548 }
2549
2550 mutex_lock(&gp->pm_mutex);
2551 memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
2552 if (gp->running) {
2553 writel((e[4] << 8) | e[5], gp->regs + MAC_ADDR0);
2554 writel((e[2] << 8) | e[3], gp->regs + MAC_ADDR1);
2555 writel((e[0] << 8) | e[1], gp->regs + MAC_ADDR2);
2556 }
2557 mutex_unlock(&gp->pm_mutex);
2558
2559 return 0;
2560}
2561
2533static void gem_set_multicast(struct net_device *dev) 2562static void gem_set_multicast(struct net_device *dev)
2534{ 2563{
2535 struct gem *gp = dev->priv; 2564 struct gem *gp = dev->priv;
@@ -3122,6 +3151,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3122 dev->change_mtu = gem_change_mtu; 3151 dev->change_mtu = gem_change_mtu;
3123 dev->irq = pdev->irq; 3152 dev->irq = pdev->irq;
3124 dev->dma = 0; 3153 dev->dma = 0;
3154 dev->set_mac_address = gem_set_mac_address;
3125#ifdef CONFIG_NET_POLL_CONTROLLER 3155#ifdef CONFIG_NET_POLL_CONTROLLER
3126 dev->poll_controller = gem_poll_controller; 3156 dev->poll_controller = gem_poll_controller;
3127#endif 3157#endif
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8c8f9f4d47a5..256969e1300c 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.74" 67#define DRV_MODULE_VERSION "3.75"
68#define DRV_MODULE_RELDATE "February 20, 2007" 68#define DRV_MODULE_RELDATE "March 23, 2007"
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
@@ -3568,32 +3568,34 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id)
3568 * Reading the PCI State register will confirm whether the 3568 * Reading the PCI State register will confirm whether the
3569 * interrupt is ours and will flush the status block. 3569 * interrupt is ours and will flush the status block.
3570 */ 3570 */
3571 if ((sblk->status & SD_STATUS_UPDATED) || 3571 if (unlikely(!(sblk->status & SD_STATUS_UPDATED))) {
3572 !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { 3572 if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
3573 /* 3573 (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
3574 * Writing any value to intr-mbox-0 clears PCI INTA# and 3574 handled = 0;
3575 * chip-internal interrupt pending events.
3576 * Writing non-zero to intr-mbox-0 additional tells the
3577 * NIC to stop sending us irqs, engaging "in-intr-handler"
3578 * event coalescing.
3579 */
3580 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3581 0x00000001);
3582 if (tg3_irq_sync(tp))
3583 goto out; 3575 goto out;
3584 sblk->status &= ~SD_STATUS_UPDATED;
3585 if (likely(tg3_has_work(tp))) {
3586 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3587 netif_rx_schedule(dev); /* schedule NAPI poll */
3588 } else {
3589 /* No work, shared interrupt perhaps? re-enable
3590 * interrupts, and flush that PCI write
3591 */
3592 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3593 0x00000000);
3594 } 3576 }
3595 } else { /* shared interrupt */ 3577 }
3596 handled = 0; 3578
3579 /*
3580 * Writing any value to intr-mbox-0 clears PCI INTA# and
3581 * chip-internal interrupt pending events.
3582 * Writing non-zero to intr-mbox-0 additional tells the
3583 * NIC to stop sending us irqs, engaging "in-intr-handler"
3584 * event coalescing.
3585 */
3586 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
3587 if (tg3_irq_sync(tp))
3588 goto out;
3589 sblk->status &= ~SD_STATUS_UPDATED;
3590 if (likely(tg3_has_work(tp))) {
3591 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3592 netif_rx_schedule(dev); /* schedule NAPI poll */
3593 } else {
3594 /* No work, shared interrupt perhaps? re-enable
3595 * interrupts, and flush that PCI write
3596 */
3597 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3598 0x00000000);
3597 } 3599 }
3598out: 3600out:
3599 return IRQ_RETVAL(handled); 3601 return IRQ_RETVAL(handled);
@@ -3611,31 +3613,33 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
3611 * Reading the PCI State register will confirm whether the 3613 * Reading the PCI State register will confirm whether the
3612 * interrupt is ours and will flush the status block. 3614 * interrupt is ours and will flush the status block.
3613 */ 3615 */
3614 if ((sblk->status_tag != tp->last_tag) || 3616 if (unlikely(sblk->status_tag == tp->last_tag)) {
3615 !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { 3617 if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
3616 /* 3618 (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
3617 * writing any value to intr-mbox-0 clears PCI INTA# and 3619 handled = 0;
3618 * chip-internal interrupt pending events.
3619 * writing non-zero to intr-mbox-0 additional tells the
3620 * NIC to stop sending us irqs, engaging "in-intr-handler"
3621 * event coalescing.
3622 */
3623 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3624 0x00000001);
3625 if (tg3_irq_sync(tp))
3626 goto out; 3620 goto out;
3627 if (netif_rx_schedule_prep(dev)) {
3628 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3629 /* Update last_tag to mark that this status has been
3630 * seen. Because interrupt may be shared, we may be
3631 * racing with tg3_poll(), so only update last_tag
3632 * if tg3_poll() is not scheduled.
3633 */
3634 tp->last_tag = sblk->status_tag;
3635 __netif_rx_schedule(dev);
3636 } 3621 }
3637 } else { /* shared interrupt */ 3622 }
3638 handled = 0; 3623
3624 /*
3625 * writing any value to intr-mbox-0 clears PCI INTA# and
3626 * chip-internal interrupt pending events.
3627 * writing non-zero to intr-mbox-0 additional tells the
3628 * NIC to stop sending us irqs, engaging "in-intr-handler"
3629 * event coalescing.
3630 */
3631 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
3632 if (tg3_irq_sync(tp))
3633 goto out;
3634 if (netif_rx_schedule_prep(dev)) {
3635 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3636 /* Update last_tag to mark that this status has been
3637 * seen. Because interrupt may be shared, we may be
3638 * racing with tg3_poll(), so only update last_tag
3639 * if tg3_poll() is not scheduled.
3640 */
3641 tp->last_tag = sblk->status_tag;
3642 __netif_rx_schedule(dev);
3639 } 3643 }
3640out: 3644out:
3641 return IRQ_RETVAL(handled); 3645 return IRQ_RETVAL(handled);
@@ -4823,6 +4827,21 @@ static int tg3_chip_reset(struct tg3 *tp)
4823 if (write_op == tg3_write_flush_reg32) 4827 if (write_op == tg3_write_flush_reg32)
4824 tp->write32 = tg3_write32; 4828 tp->write32 = tg3_write32;
4825 4829
4830 /* Prevent the irq handler from reading or writing PCI registers
4831 * during chip reset when the memory enable bit in the PCI command
4832 * register may be cleared. The chip does not generate interrupt
4833 * at this time, but the irq handler may still be called due to irq
4834 * sharing or irqpoll.
4835 */
4836 tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING;
4837 if (tp->hw_status) {
4838 tp->hw_status->status = 0;
4839 tp->hw_status->status_tag = 0;
4840 }
4841 tp->last_tag = 0;
4842 smp_mb();
4843 synchronize_irq(tp->pdev->irq);
4844
4826 /* do the reset */ 4845 /* do the reset */
4827 val = GRC_MISC_CFG_CORECLK_RESET; 4846 val = GRC_MISC_CFG_CORECLK_RESET;
4828 4847
@@ -4904,6 +4923,8 @@ static int tg3_chip_reset(struct tg3 *tp)
4904 4923
4905 pci_restore_state(tp->pdev); 4924 pci_restore_state(tp->pdev);
4906 4925
4926 tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING;
4927
4907 /* Make sure PCI-X relaxed ordering bit is clear. */ 4928 /* Make sure PCI-X relaxed ordering bit is clear. */
4908 pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); 4929 pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
4909 val &= ~PCIX_CAPS_RELAXED_ORDERING; 4930 val &= ~PCIX_CAPS_RELAXED_ORDERING;
@@ -6321,8 +6342,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6321 RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB | 6342 RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB |
6322 RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB | 6343 RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB |
6323 RDMAC_MODE_LNGREAD_ENAB); 6344 RDMAC_MODE_LNGREAD_ENAB);
6324 if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
6325 rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE;
6326 6345
6327 /* If statement applies to 5705 and 5750 PCI devices only */ 6346 /* If statement applies to 5705 and 5750 PCI devices only */
6328 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && 6347 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
@@ -6495,9 +6514,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6495 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 6514 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
6496 val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK); 6515 val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK);
6497 val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); 6516 val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
6498 if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
6499 val |= (tp->split_mode_max_reqs <<
6500 PCIX_CAPS_SPLIT_SHIFT);
6501 } 6517 }
6502 tw32(TG3PCI_X_CAPS, val); 6518 tw32(TG3PCI_X_CAPS, val);
6503 } 6519 }
@@ -10863,14 +10879,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10863 grc_misc_cfg = tr32(GRC_MISC_CFG); 10879 grc_misc_cfg = tr32(GRC_MISC_CFG);
10864 grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; 10880 grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK;
10865 10881
10866 /* Broadcom's driver says that CIOBE multisplit has a bug */
10867#if 0
10868 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
10869 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) {
10870 tp->tg3_flags |= TG3_FLAG_SPLIT_MODE;
10871 tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ;
10872 }
10873#endif
10874 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && 10882 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
10875 (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || 10883 (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 ||
10876 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) 10884 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M))
@@ -11968,14 +11976,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11968 i == 5 ? '\n' : ':'); 11976 i == 5 ? '\n' : ':');
11969 11977
11970 printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] " 11978 printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] "
11971 "MIirq[%d] ASF[%d] Split[%d] WireSpeed[%d] " 11979 "MIirq[%d] ASF[%d] WireSpeed[%d] TSOcap[%d]\n",
11972 "TSOcap[%d] \n",
11973 dev->name, 11980 dev->name,
11974 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, 11981 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
11975 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, 11982 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
11976 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, 11983 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0,
11977 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, 11984 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
11978 (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) != 0,
11979 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0, 11985 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0,
11980 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); 11986 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0);
11981 printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", 11987 printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n",
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 086892d8c1f1..d515ed23841b 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2223,7 +2223,7 @@ struct tg3 {
2223#define TG3_FLAG_40BIT_DMA_BUG 0x08000000 2223#define TG3_FLAG_40BIT_DMA_BUG 0x08000000
2224#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 2224#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000
2225#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 2225#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000
2226#define TG3_FLAG_SPLIT_MODE 0x40000000 2226#define TG3_FLAG_CHIP_RESETTING 0x40000000
2227#define TG3_FLAG_INIT_COMPLETE 0x80000000 2227#define TG3_FLAG_INIT_COMPLETE 0x80000000
2228 u32 tg3_flags2; 2228 u32 tg3_flags2;
2229#define TG3_FLG2_RESTART_TIMER 0x00000001 2229#define TG3_FLG2_RESTART_TIMER 0x00000001
@@ -2262,9 +2262,6 @@ struct tg3 {
2262#define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 2262#define TG3_FLG2_NO_FWARE_REPORTED 0x40000000
2263#define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000 2263#define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000
2264 2264
2265 u32 split_mode_max_reqs;
2266#define SPLIT_MODE_5704_MAX_REQ 3
2267
2268 struct timer_list timer; 2265 struct timer_list timer;
2269 u16 timer_counter; 2266 u16 timer_counter;
2270 u16 timer_multiplier; 2267 u16 timer_multiplier;
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 0d97e10ccac5..01d55315ee8c 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -186,7 +186,6 @@ static char __devinit *adapter_def(char type)
186#define TRC_INITV 0x02 /* verbose init trace points */ 186#define TRC_INITV 0x02 /* verbose init trace points */
187static unsigned char ibmtr_debug_trace = 0; 187static unsigned char ibmtr_debug_trace = 0;
188 188
189static int ibmtr_probe(struct net_device *dev);
190static int ibmtr_probe1(struct net_device *dev, int ioaddr); 189static int ibmtr_probe1(struct net_device *dev, int ioaddr);
191static unsigned char get_sram_size(struct tok_info *adapt_info); 190static unsigned char get_sram_size(struct tok_info *adapt_info);
192static int trdev_init(struct net_device *dev); 191static int trdev_init(struct net_device *dev);
@@ -335,17 +334,6 @@ static void ibmtr_cleanup_card(struct net_device *dev)
335#endif 334#endif
336} 335}
337 336
338int ibmtr_probe_card(struct net_device *dev)
339{
340 int err = ibmtr_probe(dev);
341 if (!err) {
342 err = register_netdev(dev);
343 if (err)
344 ibmtr_cleanup_card(dev);
345 }
346 return err;
347}
348
349/**************************************************************************** 337/****************************************************************************
350 * ibmtr_probe(): Routine specified in the network device structure 338 * ibmtr_probe(): Routine specified in the network device structure
351 * to probe for an IBM Token Ring Adapter. Routine outline: 339 * to probe for an IBM Token Ring Adapter. Routine outline:
@@ -358,7 +346,7 @@ int ibmtr_probe_card(struct net_device *dev)
358 * which references it. 346 * which references it.
359 ****************************************************************************/ 347 ****************************************************************************/
360 348
361static int ibmtr_probe(struct net_device *dev) 349static int __devinit ibmtr_probe(struct net_device *dev)
362{ 350{
363 int i; 351 int i;
364 int base_addr = dev->base_addr; 352 int base_addr = dev->base_addr;
@@ -378,6 +366,17 @@ static int ibmtr_probe(struct net_device *dev)
378 return -ENODEV; 366 return -ENODEV;
379} 367}
380 368
369int __devinit ibmtr_probe_card(struct net_device *dev)
370{
371 int err = ibmtr_probe(dev);
372 if (!err) {
373 err = register_netdev(dev);
374 if (err)
375 ibmtr_cleanup_card(dev);
376 }
377 return err;
378}
379
381/*****************************************************************************/ 380/*****************************************************************************/
382 381
383static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) 382static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 24a29c99ba94..9aeac76184f3 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -190,13 +190,13 @@
190 190
191/* Structure/enum declaration ------------------------------- */ 191/* Structure/enum declaration ------------------------------- */
192struct tx_desc { 192struct tx_desc {
193 u32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */ 193 __le32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */
194 char *tx_buf_ptr; /* Data for us */ 194 char *tx_buf_ptr; /* Data for us */
195 struct tx_desc *next_tx_desc; 195 struct tx_desc *next_tx_desc;
196} __attribute__(( aligned(32) )); 196} __attribute__(( aligned(32) ));
197 197
198struct rx_desc { 198struct rx_desc {
199 u32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */ 199 __le32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */
200 struct sk_buff *rx_skb_ptr; /* Data for us */ 200 struct sk_buff *rx_skb_ptr; /* Data for us */
201 struct rx_desc *next_rx_desc; 201 struct rx_desc *next_rx_desc;
202} __attribute__(( aligned(32) )); 202} __attribute__(( aligned(32) ));
@@ -458,7 +458,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
458 458
459 /* read 64 word srom data */ 459 /* read 64 word srom data */
460 for (i = 0; i < 64; i++) 460 for (i = 0; i < 64; i++)
461 ((u16 *) db->srom)[i] = 461 ((__le16 *) db->srom)[i] =
462 cpu_to_le16(read_srom_word(db->ioaddr, i)); 462 cpu_to_le16(read_srom_word(db->ioaddr, i));
463 463
464 /* Set Node address */ 464 /* Set Node address */
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dab88b958d6e..639e1e6913bf 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3607,7 +3607,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3607 if (bd == ugeth->confBd[txQ]) { 3607 if (bd == ugeth->confBd[txQ]) {
3608 if (!netif_queue_stopped(dev)) 3608 if (!netif_queue_stopped(dev))
3609 netif_stop_queue(dev); 3609 netif_stop_queue(dev);
3610 return NETDEV_TX_BUSY;
3611 } 3610 }
3612 3611
3613 ugeth->txBd[txQ] = bd; 3612 ugeth->txBd[txQ] = bd;
@@ -3623,7 +3622,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3623 3622
3624 spin_unlock_irq(&ugeth->lock); 3623 spin_unlock_irq(&ugeth->lock);
3625 3624
3626 return NETDEV_TX_OK; 3625 return 0;
3627} 3626}
3628 3627
3629static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit) 3628static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit)
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index ebbda1d8f542..f3a972e74e9a 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -30,8 +30,8 @@
30*/ 30*/
31 31
32#define DRV_NAME "via-rhine" 32#define DRV_NAME "via-rhine"
33#define DRV_VERSION "1.4.2" 33#define DRV_VERSION "1.4.3"
34#define DRV_RELDATE "Sept-11-2006" 34#define DRV_RELDATE "2007-03-06"
35 35
36 36
37/* A few user-configurable values. 37/* A few user-configurable values.
@@ -105,6 +105,7 @@ static const int multicast_filter_limit = 32;
105#include <asm/io.h> 105#include <asm/io.h>
106#include <asm/irq.h> 106#include <asm/irq.h>
107#include <asm/uaccess.h> 107#include <asm/uaccess.h>
108#include <linux/dmi.h>
108 109
109/* These identify the driver base version and may not be removed. */ 110/* These identify the driver base version and may not be removed. */
110static char version[] __devinitdata = 111static char version[] __devinitdata =
@@ -1995,6 +1996,23 @@ static struct pci_driver rhine_driver = {
1995 .shutdown = rhine_shutdown, 1996 .shutdown = rhine_shutdown,
1996}; 1997};
1997 1998
1999static struct dmi_system_id __initdata rhine_dmi_table[] = {
2000 {
2001 .ident = "EPIA-M",
2002 .matches = {
2003 DMI_MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."),
2004 DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
2005 },
2006 },
2007 {
2008 .ident = "KV7",
2009 .matches = {
2010 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
2011 DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
2012 },
2013 },
2014 { NULL }
2015};
1998 2016
1999static int __init rhine_init(void) 2017static int __init rhine_init(void)
2000{ 2018{
@@ -2002,6 +2020,16 @@ static int __init rhine_init(void)
2002#ifdef MODULE 2020#ifdef MODULE
2003 printk(version); 2021 printk(version);
2004#endif 2022#endif
2023 if (dmi_check_system(rhine_dmi_table)) {
2024 /* these BIOSes fail at PXE boot if chip is in D3 */
2025 avoid_D3 = 1;
2026 printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 "
2027 "enabled.\n",
2028 DRV_NAME);
2029 }
2030 else if (avoid_D3)
2031 printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME);
2032
2005 return pci_register_driver(&rhine_driver); 2033 return pci_register_driver(&rhine_driver);
2006} 2034}
2007 2035
diff --git a/drivers/net/wan/lmc/lmc_media.h b/drivers/net/wan/lmc/lmc_media.h
deleted file mode 100644
index ddcc00403563..000000000000
--- a/drivers/net/wan/lmc/lmc_media.h
+++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef _LMC_MEDIA_H_
2#define _LMC_MEDIA_H_
3
4lmc_media_t lmc_ds3_media = {
5 lmc_ds3_init, /* special media init stuff */
6 lmc_ds3_default, /* reset to default state */
7 lmc_ds3_set_status, /* reset status to state provided */
8 lmc_dummy_set_1, /* set clock source */
9 lmc_dummy_set2_1, /* set line speed */
10 lmc_ds3_set_100ft, /* set cable length */
11 lmc_ds3_set_scram, /* set scrambler */
12 lmc_ds3_get_link_status, /* get link status */
13 lmc_dummy_set_1, /* set link status */
14 lmc_ds3_set_crc_length, /* set CRC length */
15 lmc_dummy_set_1, /* set T1 or E1 circuit type */
16 lmc_ds3_watchdog
17};
18
19lmc_media_t lmc_hssi_media = {
20 lmc_hssi_init, /* special media init stuff */
21 lmc_hssi_default, /* reset to default state */
22 lmc_hssi_set_status, /* reset status to state provided */
23 lmc_hssi_set_clock, /* set clock source */
24 lmc_dummy_set2_1, /* set line speed */
25 lmc_dummy_set_1, /* set cable length */
26 lmc_dummy_set_1, /* set scrambler */
27 lmc_hssi_get_link_status, /* get link status */
28 lmc_hssi_set_link_status, /* set link status */
29 lmc_hssi_set_crc_length, /* set CRC length */
30 lmc_dummy_set_1, /* set T1 or E1 circuit type */
31 lmc_hssi_watchdog
32};
33
34lmc_media_t lmc_ssi_media = { lmc_ssi_init, /* special media init stuff */
35 lmc_ssi_default, /* reset to default state */
36 lmc_ssi_set_status, /* reset status to state provided */
37 lmc_ssi_set_clock, /* set clock source */
38 lmc_ssi_set_speed, /* set line speed */
39 lmc_dummy_set_1, /* set cable length */
40 lmc_dummy_set_1, /* set scrambler */
41 lmc_ssi_get_link_status, /* get link status */
42 lmc_ssi_set_link_status, /* set link status */
43 lmc_ssi_set_crc_length, /* set CRC length */
44 lmc_dummy_set_1, /* set T1 or E1 circuit type */
45 lmc_ssi_watchdog
46};
47
48lmc_media_t lmc_t1_media = {
49 lmc_t1_init, /* special media init stuff */
50 lmc_t1_default, /* reset to default state */
51 lmc_t1_set_status, /* reset status to state provided */
52 lmc_t1_set_clock, /* set clock source */
53 lmc_dummy_set2_1, /* set line speed */
54 lmc_dummy_set_1, /* set cable length */
55 lmc_dummy_set_1, /* set scrambler */
56 lmc_t1_get_link_status, /* get link status */
57 lmc_dummy_set_1, /* set link status */
58 lmc_t1_set_crc_length, /* set CRC length */
59 lmc_t1_set_circuit_type, /* set T1 or E1 circuit type */
60 lmc_t1_watchdog
61};
62
63
64#endif
65
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
index 8dbcf83bb5f3..8b4540bfc1b0 100644
--- a/drivers/net/wan/z85230.c
+++ b/drivers/net/wan/z85230.c
@@ -407,7 +407,7 @@ static void z8530_tx(struct z8530_channel *c)
407 while(c->txcount) { 407 while(c->txcount) {
408 /* FIFO full ? */ 408 /* FIFO full ? */
409 if(!(read_zsreg(c, R0)&4)) 409 if(!(read_zsreg(c, R0)&4))
410 break; 410 return;
411 c->txcount--; 411 c->txcount--;
412 /* 412 /*
413 * Shovel out the byte 413 * Shovel out the byte
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index a8c2bfe26c27..2ada76a93cb6 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2852,7 +2852,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2852 if (rc) { 2852 if (rc) {
2853 airo_print_err(dev->name, "register interrupt %d failed, rc %d", 2853 airo_print_err(dev->name, "register interrupt %d failed, rc %d",
2854 irq, rc); 2854 irq, rc);
2855 goto err_out_unlink; 2855 goto err_out_nets;
2856 } 2856 }
2857 if (!is_pcmcia) { 2857 if (!is_pcmcia) {
2858 if (!request_region( dev->base_addr, 64, dev->name )) { 2858 if (!request_region( dev->base_addr, 64, dev->name )) {
@@ -2935,6 +2935,8 @@ err_out_res:
2935 release_region( dev->base_addr, 64 ); 2935 release_region( dev->base_addr, 64 );
2936err_out_irq: 2936err_out_irq:
2937 free_irq(dev->irq, dev); 2937 free_irq(dev->irq, dev);
2938err_out_nets:
2939 airo_networks_free(ai);
2938err_out_unlink: 2940err_out_unlink:
2939 del_airo_dev(dev); 2941 del_airo_dev(dev);
2940err_out_thr: 2942err_out_thr:
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index e594af46ff05..a38e7eec0e62 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -946,6 +946,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
946 u8 channel; 946 u8 channel;
947 struct bcm43xx_phyinfo *phy; 947 struct bcm43xx_phyinfo *phy;
948 const char *iso_country; 948 const char *iso_country;
949 u8 max_bg_channel;
949 950
950 geo = kzalloc(sizeof(*geo), GFP_KERNEL); 951 geo = kzalloc(sizeof(*geo), GFP_KERNEL);
951 if (!geo) 952 if (!geo)
@@ -967,6 +968,23 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
967 } 968 }
968 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 969 iso_country = bcm43xx_locale_iso(bcm->sprom.locale);
969 970
971/* set the maximum channel based on locale set in sprom or witle locale option */
972 switch (bcm->sprom.locale) {
973 case BCM43xx_LOCALE_THAILAND:
974 case BCM43xx_LOCALE_ISRAEL:
975 case BCM43xx_LOCALE_JORDAN:
976 case BCM43xx_LOCALE_USA_CANADA_ANZ:
977 case BCM43xx_LOCALE_USA_LOW:
978 max_bg_channel = 11;
979 break;
980 case BCM43xx_LOCALE_JAPAN:
981 case BCM43xx_LOCALE_JAPAN_HIGH:
982 max_bg_channel = 14;
983 break;
984 default:
985 max_bg_channel = 13;
986 }
987
970 if (have_a) { 988 if (have_a) {
971 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; 989 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL;
972 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { 990 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) {
@@ -978,7 +996,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
978 } 996 }
979 if (have_bg) { 997 if (have_bg) {
980 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; 998 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL;
981 channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { 999 channel <= max_bg_channel; channel++) {
982 chan = &geo->bg[i++]; 1000 chan = &geo->bg[i++];
983 chan->freq = bcm43xx_channel_to_freq_bg(channel); 1001 chan->freq = bcm43xx_channel_to_freq_bg(channel);
984 chan->channel = channel; 1002 chan->channel = channel;
@@ -1858,9 +1876,6 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id)
1858 1876
1859 spin_lock(&bcm->irq_lock); 1877 spin_lock(&bcm->irq_lock);
1860 1878
1861 assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
1862 assert(bcm->current_core->id == BCM43xx_COREID_80211);
1863
1864 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); 1879 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
1865 if (reason == 0xffffffff) { 1880 if (reason == 0xffffffff) {
1866 /* irq not for us (shared irq) */ 1881 /* irq not for us (shared irq) */
@@ -1871,6 +1886,9 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id)
1871 if (!reason) 1886 if (!reason)
1872 goto out; 1887 goto out;
1873 1888
1889 assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
1890 assert(bcm->current_core->id == BCM43xx_COREID_80211);
1891
1874 bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON) 1892 bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON)
1875 & 0x0001DC00; 1893 & 0x0001DC00;
1876 bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON) 1894 bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index 3a5c9c2b2150..72529a440f15 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -757,7 +757,7 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
757 if (radio->version == 0x2050) 757 if (radio->version == 0x2050)
758 bcm43xx_phy_write(bcm, 0x0038, 0x0667); 758 bcm43xx_phy_write(bcm, 0x0038, 0x0667);
759 759
760 if (phy->type == BCM43xx_PHYTYPE_G) { 760 if (phy->connected) {
761 if (radio->version == 0x2050) { 761 if (radio->version == 0x2050) {
762 bcm43xx_radio_write16(bcm, 0x007A, 762 bcm43xx_radio_write16(bcm, 0x007A,
763 bcm43xx_radio_read16(bcm, 0x007A) 763 bcm43xx_radio_read16(bcm, 0x007A)
@@ -859,6 +859,11 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
859 bcm43xx_radio_write16(bcm, 0x005D, 0x0088); 859 bcm43xx_radio_write16(bcm, 0x005D, 0x0088);
860 bcm43xx_radio_write16(bcm, 0x005E, 0x0088); 860 bcm43xx_radio_write16(bcm, 0x005E, 0x0088);
861 bcm43xx_radio_write16(bcm, 0x007D, 0x0088); 861 bcm43xx_radio_write16(bcm, 0x007D, 0x0088);
862 bcm43xx_shm_write32(bcm, BCM43xx_SHM_SHARED,
863 BCM43xx_UCODEFLAGS_OFFSET,
864 (bcm43xx_shm_read32(bcm, BCM43xx_SHM_SHARED,
865 BCM43xx_UCODEFLAGS_OFFSET)
866 | 0x00000200));
862 } 867 }
863 if (radio->revision == 8) { 868 if (radio->revision == 8) {
864 bcm43xx_radio_write16(bcm, 0x0051, 0x0000); 869 bcm43xx_radio_write16(bcm, 0x0051, 0x0000);
@@ -941,7 +946,8 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
941 bcm43xx_phy_write(bcm, 0x0038, 0x0668); 946 bcm43xx_phy_write(bcm, 0x0038, 0x0668);
942 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); 947 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF);
943 if (radio->revision <= 5) 948 if (radio->revision <= 5)
944 bcm43xx_phy_write(bcm, 0x005D, bcm43xx_phy_read(bcm, 0x005D) | 0x0003); 949 bcm43xx_phy_write(bcm, 0x005D, (bcm43xx_phy_read(bcm, 0x005D)
950 & 0xFF80) | 0x0003);
945 if (radio->revision <= 2) 951 if (radio->revision <= 2)
946 bcm43xx_radio_write16(bcm, 0x005D, 0x000D); 952 bcm43xx_radio_write16(bcm, 0x005D, 0x000D);
947 953
@@ -958,7 +964,7 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
958 bcm43xx_phy_write(bcm, 0x0016, 0x0410); 964 bcm43xx_phy_write(bcm, 0x0016, 0x0410);
959 bcm43xx_phy_write(bcm, 0x0017, 0x0820); 965 bcm43xx_phy_write(bcm, 0x0017, 0x0820);
960 bcm43xx_phy_write(bcm, 0x0062, 0x0007); 966 bcm43xx_phy_write(bcm, 0x0062, 0x0007);
961 (void) bcm43xx_radio_calibrationvalue(bcm); 967 bcm43xx_radio_init2050(bcm);
962 bcm43xx_phy_lo_g_measure(bcm); 968 bcm43xx_phy_lo_g_measure(bcm);
963 if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { 969 if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) {
964 bcm43xx_calc_nrssi_slope(bcm); 970 bcm43xx_calc_nrssi_slope(bcm);
@@ -972,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
972{ 978{
973 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 979 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
974 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 980 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
975 u16 backup_phy[15]; 981 u16 backup_phy[15] = {0};
976 u16 backup_radio[3]; 982 u16 backup_radio[3];
977 u16 backup_bband; 983 u16 backup_bband;
978 u16 i; 984 u16 i;
@@ -983,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
983 backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); 989 backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001);
984 backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); 990 backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811);
985 backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); 991 backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812);
986 backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); 992 if (phy->rev != 1) {
987 backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); 993 backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814);
994 backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815);
995 }
988 backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); 996 backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A);
989 backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); 997 backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059);
990 backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); 998 backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058);
@@ -1012,14 +1020,16 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1012 bcm43xx_phy_read(bcm, 0x0811) | 0x0001); 1020 bcm43xx_phy_read(bcm, 0x0811) | 0x0001);
1013 bcm43xx_phy_write(bcm, 0x0812, 1021 bcm43xx_phy_write(bcm, 0x0812,
1014 bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); 1022 bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE);
1015 bcm43xx_phy_write(bcm, 0x0814, 1023 if (phy->rev != 1) {
1016 bcm43xx_phy_read(bcm, 0x0814) | 0x0001); 1024 bcm43xx_phy_write(bcm, 0x0814,
1017 bcm43xx_phy_write(bcm, 0x0815, 1025 bcm43xx_phy_read(bcm, 0x0814) | 0x0001);
1018 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); 1026 bcm43xx_phy_write(bcm, 0x0815,
1019 bcm43xx_phy_write(bcm, 0x0814, 1027 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE);
1020 bcm43xx_phy_read(bcm, 0x0814) | 0x0002); 1028 bcm43xx_phy_write(bcm, 0x0814,
1021 bcm43xx_phy_write(bcm, 0x0815, 1029 bcm43xx_phy_read(bcm, 0x0814) | 0x0002);
1022 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); 1030 bcm43xx_phy_write(bcm, 0x0815,
1031 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD);
1032 }
1023 bcm43xx_phy_write(bcm, 0x0811, 1033 bcm43xx_phy_write(bcm, 0x0811,
1024 bcm43xx_phy_read(bcm, 0x0811) | 0x000C); 1034 bcm43xx_phy_read(bcm, 0x0811) | 0x000C);
1025 bcm43xx_phy_write(bcm, 0x0812, 1035 bcm43xx_phy_write(bcm, 0x0812,
@@ -1042,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1042 bcm43xx_phy_read(bcm, 0x000A) 1052 bcm43xx_phy_read(bcm, 0x000A)
1043 | 0x2000); 1053 | 0x2000);
1044 } 1054 }
1045 bcm43xx_phy_write(bcm, 0x0814, 1055 if (phy->rev != 1) {
1046 bcm43xx_phy_read(bcm, 0x0814) | 0x0004); 1056 bcm43xx_phy_write(bcm, 0x0814,
1047 bcm43xx_phy_write(bcm, 0x0815, 1057 bcm43xx_phy_read(bcm, 0x0814) | 0x0004);
1048 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); 1058 bcm43xx_phy_write(bcm, 0x0815,
1059 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB);
1060 }
1049 bcm43xx_phy_write(bcm, 0x0003, 1061 bcm43xx_phy_write(bcm, 0x0003,
1050 (bcm43xx_phy_read(bcm, 0x0003) 1062 (bcm43xx_phy_read(bcm, 0x0003)
1051 & 0xFF9F) | 0x0040); 1063 & 0xFF9F) | 0x0040);
@@ -1132,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1132 } 1144 }
1133 } 1145 }
1134 1146
1135 bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); 1147 if (phy->rev != 1) {
1136 bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); 1148 bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]);
1149 bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]);
1150 }
1137 bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); 1151 bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]);
1138 bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); 1152 bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]);
1139 bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); 1153 bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]);
@@ -1182,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1182 bcm43xx_phy_write(bcm, 0x0811, 0x0000); 1196 bcm43xx_phy_write(bcm, 0x0811, 0x0000);
1183 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1197 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1184 } 1198 }
1185 if (phy->rev >= 3) { 1199 if (phy->rev > 5) {
1186 bcm43xx_phy_write(bcm, 0x0811, 0x0400); 1200 bcm43xx_phy_write(bcm, 0x0811, 0x0400);
1187 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1201 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1188 } 1202 }
1189 if (phy->connected) { 1203 if (phy->rev >= 2 && phy->connected) {
1190 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; 1204 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
1191 if (tmp < 6) { 1205 if (tmp ==3 || tmp == 5) {
1192 bcm43xx_phy_write(bcm, 0x04C2, 0x1816); 1206 bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
1193 bcm43xx_phy_write(bcm, 0x04C3, 0x8006); 1207 bcm43xx_phy_write(bcm, 0x04C3, 0x8006);
1194 if (tmp != 3) { 1208 if (tmp == 5) {
1195 bcm43xx_phy_write(bcm, 0x04CC, 1209 bcm43xx_phy_write(bcm, 0x04CC,
1196 (bcm43xx_phy_read(bcm, 0x04CC) 1210 (bcm43xx_phy_read(bcm, 0x04CC)
1197 & 0x00FF) | 0x1F00); 1211 & 0x00FF) | 0x1F00);
1198 } 1212 }
1199 } 1213 }
1200 }
1201 if (phy->rev < 3 && phy->connected)
1202 bcm43xx_phy_write(bcm, 0x047E, 0x0078); 1214 bcm43xx_phy_write(bcm, 0x047E, 0x0078);
1215 }
1203 if (radio->revision == 8) { 1216 if (radio->revision == 8) {
1204 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); 1217 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080);
1205 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); 1218 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004);
@@ -1226,7 +1239,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1226 if (phy->rev >= 6) { 1239 if (phy->rev >= 6) {
1227 bcm43xx_phy_write(bcm, 0x0036, 1240 bcm43xx_phy_write(bcm, 0x0036,
1228 (bcm43xx_phy_read(bcm, 0x0036) 1241 (bcm43xx_phy_read(bcm, 0x0036)
1229 & 0xF000) | (radio->txctl2 << 12)); 1242 & 0x0FFF) | (radio->txctl2 << 12));
1230 } 1243 }
1231 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) 1244 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL)
1232 bcm43xx_phy_write(bcm, 0x002E, 0x8075); 1245 bcm43xx_phy_write(bcm, 0x002E, 0x8075);
@@ -1237,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1237 else 1250 else
1238 bcm43xx_phy_write(bcm, 0x002F, 0x0202); 1251 bcm43xx_phy_write(bcm, 0x002F, 0x0202);
1239 } 1252 }
1240 if (phy->connected) { 1253 if (phy->connected || phy->rev >= 2) {
1241 bcm43xx_phy_lo_adjust(bcm, 0); 1254 bcm43xx_phy_lo_adjust(bcm, 0);
1242 bcm43xx_phy_write(bcm, 0x080F, 0x8078); 1255 bcm43xx_phy_write(bcm, 0x080F, 0x8078);
1243 } 1256 }
@@ -1251,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1251 */ 1264 */
1252 bcm43xx_nrssi_hw_update(bcm, 0xFFFF); 1265 bcm43xx_nrssi_hw_update(bcm, 0xFFFF);
1253 bcm43xx_calc_nrssi_threshold(bcm); 1266 bcm43xx_calc_nrssi_threshold(bcm);
1254 } else if (phy->connected) { 1267 } else if (phy->connected || phy->rev >= 2) {
1255 if (radio->nrssi[0] == -1000) { 1268 if (radio->nrssi[0] == -1000) {
1256 assert(radio->nrssi[1] == -1000); 1269 assert(radio->nrssi[1] == -1000);
1257 bcm43xx_calc_nrssi_slope(bcm); 1270 bcm43xx_calc_nrssi_slope(bcm);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
index 32beb91b7164..4025dd0089d2 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
@@ -458,7 +458,7 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
458 bcm43xx_phy_write(bcm, 0x005A, 0x0480); 458 bcm43xx_phy_write(bcm, 0x005A, 0x0480);
459 bcm43xx_phy_write(bcm, 0x0059, 0x0810); 459 bcm43xx_phy_write(bcm, 0x0059, 0x0810);
460 bcm43xx_phy_write(bcm, 0x0058, 0x000D); 460 bcm43xx_phy_write(bcm, 0x0058, 0x000D);
461 if (phy->rev == 0) { 461 if (phy->analog == 0) {
462 bcm43xx_phy_write(bcm, 0x0003, 0x0122); 462 bcm43xx_phy_write(bcm, 0x0003, 0x0122);
463 } else { 463 } else {
464 bcm43xx_phy_write(bcm, 0x000A, 464 bcm43xx_phy_write(bcm, 0x000A,
@@ -570,9 +570,9 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
570 nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027); 570 nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027);
571 bcm43xx_radio_write16(bcm, 0x007A, 571 bcm43xx_radio_write16(bcm, 0x007A,
572 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); 572 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F);
573 if (phy->rev >= 2) { 573 if (phy->analog >= 2) {
574 bcm43xx_write16(bcm, 0x03E6, 0x0040); 574 bcm43xx_write16(bcm, 0x03E6, 0x0040);
575 } else if (phy->rev == 0) { 575 } else if (phy->analog == 0) {
576 bcm43xx_write16(bcm, 0x03E6, 0x0122); 576 bcm43xx_write16(bcm, 0x03E6, 0x0122);
577 } else { 577 } else {
578 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, 578 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT,
@@ -596,7 +596,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
596 bcm43xx_phy_write(bcm, 0x0015, backup[5]); 596 bcm43xx_phy_write(bcm, 0x0015, backup[5]);
597 bcm43xx_phy_write(bcm, 0x002A, backup[6]); 597 bcm43xx_phy_write(bcm, 0x002A, backup[6]);
598 bcm43xx_synth_pu_workaround(bcm, radio->channel); 598 bcm43xx_synth_pu_workaround(bcm, radio->channel);
599 if (phy->rev != 0) 599 if (phy->analog != 0)
600 bcm43xx_write16(bcm, 0x03F4, backup[13]); 600 bcm43xx_write16(bcm, 0x03F4, backup[13]);
601 601
602 bcm43xx_phy_write(bcm, 0x0020, backup[7]); 602 bcm43xx_phy_write(bcm, 0x0020, backup[7]);
@@ -692,7 +692,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
692 692
693 bcm43xx_radio_write16(bcm, 0x007A, 693 bcm43xx_radio_write16(bcm, 0x007A,
694 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); 694 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F);
695 if (phy->rev >= 2) { 695 if (phy->analog >= 2) {
696 bcm43xx_phy_write(bcm, 0x0003, 696 bcm43xx_phy_write(bcm, 0x0003,
697 (bcm43xx_phy_read(bcm, 0x0003) 697 (bcm43xx_phy_read(bcm, 0x0003)
698 & 0xFF9F) | 0x0040); 698 & 0xFF9F) | 0x0040);
@@ -882,10 +882,10 @@ static void _stack_save(u32 *_stackptr, size_t *stackidx,
882{ 882{
883 u32 *stackptr = &(_stackptr[*stackidx]); 883 u32 *stackptr = &(_stackptr[*stackidx]);
884 884
885 assert((offset & 0xF000) == 0x0000); 885 assert((offset & 0xE000) == 0x0000);
886 assert((id & 0xF0) == 0x00); 886 assert((id & 0xF8) == 0x00);
887 *stackptr = offset; 887 *stackptr = offset;
888 *stackptr |= ((u32)id) << 12; 888 *stackptr |= ((u32)id) << 13;
889 *stackptr |= ((u32)value) << 16; 889 *stackptr |= ((u32)value) << 16;
890 (*stackidx)++; 890 (*stackidx)++;
891 assert(*stackidx < BCM43xx_INTERFSTACK_SIZE); 891 assert(*stackidx < BCM43xx_INTERFSTACK_SIZE);
@@ -896,12 +896,12 @@ static u16 _stack_restore(u32 *stackptr,
896{ 896{
897 size_t i; 897 size_t i;
898 898
899 assert((offset & 0xF000) == 0x0000); 899 assert((offset & 0xE000) == 0x0000);
900 assert((id & 0xF0) == 0x00); 900 assert((id & 0xF8) == 0x00);
901 for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) { 901 for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) {
902 if ((*stackptr & 0x00000FFF) != offset) 902 if ((*stackptr & 0x00001FFF) != offset)
903 continue; 903 continue;
904 if (((*stackptr & 0x0000F000) >> 12) != id) 904 if (((*stackptr & 0x00007000) >> 13) != id)
905 continue; 905 continue;
906 return ((*stackptr & 0xFFFF0000) >> 16); 906 return ((*stackptr & 0xFFFF0000) >> 16);
907 } 907 }
@@ -1579,7 +1579,7 @@ void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm)
1579 1579
1580 for (i = 0; i < 5; i++) { 1580 for (i = 0; i < 5; i++) {
1581 for (j = 0; j < 5; j++) { 1581 for (j = 0; j < 5; j++) {
1582 if (tmp == (data_high[i] << 4 | data_low[j])) { 1582 if (tmp == (data_high[i] | data_low[j])) {
1583 bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0); 1583 bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0);
1584 return; 1584 return;
1585 } 1585 }
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index 7b665e2386a8..d6d9413d7f23 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -105,18 +105,24 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
105 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); 105 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
106 unsigned long flags; 106 unsigned long flags;
107 u8 channel; 107 u8 channel;
108 s8 expon;
108 int freq; 109 int freq;
109 int err = -EINVAL; 110 int err = -EINVAL;
110 111
111 mutex_lock(&bcm->mutex); 112 mutex_lock(&bcm->mutex);
112 spin_lock_irqsave(&bcm->irq_lock, flags); 113 spin_lock_irqsave(&bcm->irq_lock, flags);
113 114
114 if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { 115 if ((data->freq.e == 0) &&
116 (data->freq.m >= 0) && (data->freq.m <= 1000)) {
115 channel = data->freq.m; 117 channel = data->freq.m;
116 freq = bcm43xx_channel_to_freq(bcm, channel); 118 freq = bcm43xx_channel_to_freq(bcm, channel);
117 } else { 119 } else {
118 channel = bcm43xx_freq_to_channel(bcm, data->freq.m);
119 freq = data->freq.m; 120 freq = data->freq.m;
121 expon = 6 - data->freq.e;
122 while (--expon >= 0) /* scale down the frequency to MHz */
123 freq /= 10;
124 assert(freq > 1000);
125 channel = bcm43xx_freq_to_channel(bcm, freq);
120 } 126 }
121 if (!ieee80211_is_valid_channel(bcm->ieee, channel)) 127 if (!ieee80211_is_valid_channel(bcm->ieee, channel))
122 goto out_unlock; 128 goto out_unlock;
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 9c64f894b71b..87ee3ee020fe 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -337,6 +337,7 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type)
337 chip->patch_cr157 = (value >> 13) & 0x1; 337 chip->patch_cr157 = (value >> 13) & 0x1;
338 chip->patch_6m_band_edge = (value >> 21) & 0x1; 338 chip->patch_6m_band_edge = (value >> 21) & 0x1;
339 chip->new_phy_layout = (value >> 31) & 0x1; 339 chip->new_phy_layout = (value >> 31) & 0x1;
340 chip->al2230s_bit = (value >> 7) & 0x1;
340 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; 341 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2;
341 chip->supports_tx_led = 1; 342 chip->supports_tx_led = 1;
342 if (value & (1 << 24)) { /* LED scenario */ 343 if (value & (1 << 24)) { /* LED scenario */
@@ -591,16 +592,16 @@ int zd_chip_unlock_phy_regs(struct zd_chip *chip)
591 return r; 592 return r;
592} 593}
593 594
594/* CR157 can be optionally patched by the EEPROM */ 595/* CR157 can be optionally patched by the EEPROM for original ZD1211 */
595static int patch_cr157(struct zd_chip *chip) 596static int patch_cr157(struct zd_chip *chip)
596{ 597{
597 int r; 598 int r;
598 u32 value; 599 u16 value;
599 600
600 if (!chip->patch_cr157) 601 if (!chip->patch_cr157)
601 return 0; 602 return 0;
602 603
603 r = zd_ioread32_locked(chip, &value, E2P_PHY_REG); 604 r = zd_ioread16_locked(chip, &value, E2P_PHY_REG);
604 if (r) 605 if (r)
605 return r; 606 return r;
606 607
@@ -790,11 +791,6 @@ static int zd1211b_hw_reset_phy(struct zd_chip *chip)
790 goto out; 791 goto out;
791 792
792 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 793 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
793 if (r)
794 goto unlock;
795
796 r = patch_cr157(chip);
797unlock:
798 t = zd_chip_unlock_phy_regs(chip); 794 t = zd_chip_unlock_phy_regs(chip);
799 if (t && !r) 795 if (t && !r)
800 r = t; 796 r = t;
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index b07569e391ee..e57ed75d9425 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -641,8 +641,8 @@ enum {
641 * also only 11 channels. */ 641 * also only 11 channels. */
642#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) 642#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18)
643 643
644#define E2P_PHY_REG E2P_DATA(0x1a)
645#define E2P_DEVICE_VER E2P_DATA(0x20) 644#define E2P_DEVICE_VER E2P_DATA(0x20)
645#define E2P_PHY_REG E2P_DATA(0x25)
646#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) 646#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28)
647#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) 647#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a)
648#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c) 648#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c)
@@ -711,7 +711,7 @@ struct zd_chip {
711 u16 link_led; 711 u16 link_led;
712 unsigned int pa_type:4, 712 unsigned int pa_type:4,
713 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, 713 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1,
714 new_phy_layout:1, 714 new_phy_layout:1, al2230s_bit:1,
715 is_zd1211b:1, supports_tx_led:1; 715 is_zd1211b:1, supports_tx_led:1;
716}; 716};
717 717
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
index 25323a13a3db..5235a7827ac5 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -358,6 +358,12 @@ int zd_rf_init_al2230(struct zd_rf *rf)
358{ 358{
359 struct zd_chip *chip = zd_rf_to_chip(rf); 359 struct zd_chip *chip = zd_rf_to_chip(rf);
360 360
361 if (chip->al2230s_bit) {
362 dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
363 "supported by this driver.\n");
364 return -ENODEV;
365 }
366
361 rf->switch_radio_off = al2230_switch_radio_off; 367 rf->switch_radio_off = al2230_switch_radio_off;
362 if (chip->is_zd1211b) { 368 if (chip->is_zd1211b) {
363 rf->init_hw = zd1211b_al2230_init_hw; 369 rf->init_hw = zd1211b_al2230_init_hw;
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index 00e937e9240e..e7fbac529935 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -70,11 +70,12 @@ void wake_up_buffer_waiter(void)
70int alloc_event_buffer(void) 70int alloc_event_buffer(void)
71{ 71{
72 int err = -ENOMEM; 72 int err = -ENOMEM;
73 unsigned long flags;
73 74
74 spin_lock(&oprofilefs_lock); 75 spin_lock_irqsave(&oprofilefs_lock, flags);
75 buffer_size = fs_buffer_size; 76 buffer_size = fs_buffer_size;
76 buffer_watershed = fs_buffer_watershed; 77 buffer_watershed = fs_buffer_watershed;
77 spin_unlock(&oprofilefs_lock); 78 spin_unlock_irqrestore(&oprofilefs_lock, flags);
78 79
79 if (buffer_watershed >= buffer_size) 80 if (buffer_watershed >= buffer_size)
80 return -EINVAL; 81 return -EINVAL;
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 6e67b42ca46d..8543cb26cf34 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -65,6 +65,7 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t co
65int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count) 65int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count)
66{ 66{
67 char tmpbuf[TMPBUFSIZE]; 67 char tmpbuf[TMPBUFSIZE];
68 unsigned long flags;
68 69
69 if (!count) 70 if (!count)
70 return 0; 71 return 0;
@@ -77,9 +78,9 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz
77 if (copy_from_user(tmpbuf, buf, count)) 78 if (copy_from_user(tmpbuf, buf, count))
78 return -EFAULT; 79 return -EFAULT;
79 80
80 spin_lock(&oprofilefs_lock); 81 spin_lock_irqsave(&oprofilefs_lock, flags);
81 *val = simple_strtoul(tmpbuf, NULL, 0); 82 *val = simple_strtoul(tmpbuf, NULL, 0);
82 spin_unlock(&oprofilefs_lock); 83 spin_unlock_irqrestore(&oprofilefs_lock, flags);
83 return 0; 84 return 0;
84} 85}
85 86
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 01869b1782e4..435c1958a7b7 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -94,12 +94,14 @@ static void msi_set_mask_bit(unsigned int irq, int flag)
94 int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + 94 int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
95 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; 95 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET;
96 writel(flag, entry->mask_base + offset); 96 writel(flag, entry->mask_base + offset);
97 readl(entry->mask_base + offset);
97 break; 98 break;
98 } 99 }
99 default: 100 default:
100 BUG(); 101 BUG();
101 break; 102 break;
102 } 103 }
104 entry->msi_attrib.masked = !!flag;
103} 105}
104 106
105void read_msi_msg(unsigned int irq, struct msi_msg *msg) 107void read_msi_msg(unsigned int irq, struct msi_msg *msg)
@@ -179,6 +181,7 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg)
179 default: 181 default:
180 BUG(); 182 BUG();
181 } 183 }
184 entry->msg = *msg;
182} 185}
183 186
184void mask_msi_irq(unsigned int irq) 187void mask_msi_irq(unsigned int irq)
@@ -225,164 +228,60 @@ static struct msi_desc* alloc_msi_entry(void)
225} 228}
226 229
227#ifdef CONFIG_PM 230#ifdef CONFIG_PM
228static int __pci_save_msi_state(struct pci_dev *dev)
229{
230 int pos, i = 0;
231 u16 control;
232 struct pci_cap_saved_state *save_state;
233 u32 *cap;
234
235 if (!dev->msi_enabled)
236 return 0;
237
238 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
239 if (pos <= 0)
240 return 0;
241
242 save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u32) * 5,
243 GFP_KERNEL);
244 if (!save_state) {
245 printk(KERN_ERR "Out of memory in pci_save_msi_state\n");
246 return -ENOMEM;
247 }
248 cap = &save_state->data[0];
249
250 pci_read_config_dword(dev, pos, &cap[i++]);
251 control = cap[0] >> 16;
252 pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, &cap[i++]);
253 if (control & PCI_MSI_FLAGS_64BIT) {
254 pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, &cap[i++]);
255 pci_read_config_dword(dev, pos + PCI_MSI_DATA_64, &cap[i++]);
256 } else
257 pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, &cap[i++]);
258 if (control & PCI_MSI_FLAGS_MASKBIT)
259 pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, &cap[i++]);
260 save_state->cap_nr = PCI_CAP_ID_MSI;
261 pci_add_saved_cap(dev, save_state);
262 return 0;
263}
264
265static void __pci_restore_msi_state(struct pci_dev *dev) 231static void __pci_restore_msi_state(struct pci_dev *dev)
266{ 232{
267 int i = 0, pos; 233 int pos;
268 u16 control; 234 u16 control;
269 struct pci_cap_saved_state *save_state; 235 struct msi_desc *entry;
270 u32 *cap;
271 236
272 if (!dev->msi_enabled) 237 if (!dev->msi_enabled)
273 return; 238 return;
274 239
275 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSI); 240 entry = get_irq_msi(dev->irq);
276 pos = pci_find_capability(dev, PCI_CAP_ID_MSI); 241 pos = entry->msi_attrib.pos;
277 if (!save_state || pos <= 0)
278 return;
279 cap = &save_state->data[0];
280 242
281 pci_intx(dev, 0); /* disable intx */ 243 pci_intx(dev, 0); /* disable intx */
282 control = cap[i++] >> 16;
283 msi_set_enable(dev, 0); 244 msi_set_enable(dev, 0);
284 pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, cap[i++]); 245 write_msi_msg(dev->irq, &entry->msg);
285 if (control & PCI_MSI_FLAGS_64BIT) { 246 if (entry->msi_attrib.maskbit)
286 pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, cap[i++]); 247 msi_set_mask_bit(dev->irq, entry->msi_attrib.masked);
287 pci_write_config_dword(dev, pos + PCI_MSI_DATA_64, cap[i++]); 248
288 } else 249 pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
289 pci_write_config_dword(dev, pos + PCI_MSI_DATA_32, cap[i++]); 250 control &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE);
290 if (control & PCI_MSI_FLAGS_MASKBIT) 251 if (entry->msi_attrib.maskbit || !entry->msi_attrib.masked)
291 pci_write_config_dword(dev, pos + PCI_MSI_MASK_BIT, cap[i++]); 252 control |= PCI_MSI_FLAGS_ENABLE;
292 pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); 253 pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control);
293 pci_remove_saved_cap(save_state);
294 kfree(save_state);
295}
296
297static int __pci_save_msix_state(struct pci_dev *dev)
298{
299 int pos;
300 int irq, head, tail = 0;
301 u16 control;
302 struct pci_cap_saved_state *save_state;
303
304 if (!dev->msix_enabled)
305 return 0;
306
307 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
308 if (pos <= 0)
309 return 0;
310
311 /* save the capability */
312 pci_read_config_word(dev, msi_control_reg(pos), &control);
313 save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u16),
314 GFP_KERNEL);
315 if (!save_state) {
316 printk(KERN_ERR "Out of memory in pci_save_msix_state\n");
317 return -ENOMEM;
318 }
319 *((u16 *)&save_state->data[0]) = control;
320
321 /* save the table */
322 irq = head = dev->first_msi_irq;
323 while (head != tail) {
324 struct msi_desc *entry;
325
326 entry = get_irq_msi(irq);
327 read_msi_msg(irq, &entry->msg_save);
328
329 tail = entry->link.tail;
330 irq = tail;
331 }
332
333 save_state->cap_nr = PCI_CAP_ID_MSIX;
334 pci_add_saved_cap(dev, save_state);
335 return 0;
336}
337
338int pci_save_msi_state(struct pci_dev *dev)
339{
340 int rc;
341
342 rc = __pci_save_msi_state(dev);
343 if (rc)
344 return rc;
345
346 rc = __pci_save_msix_state(dev);
347
348 return rc;
349} 254}
350 255
351static void __pci_restore_msix_state(struct pci_dev *dev) 256static void __pci_restore_msix_state(struct pci_dev *dev)
352{ 257{
353 u16 save;
354 int pos; 258 int pos;
355 int irq, head, tail = 0; 259 int irq, head, tail = 0;
356 struct msi_desc *entry; 260 struct msi_desc *entry;
357 struct pci_cap_saved_state *save_state; 261 u16 control;
358 262
359 if (!dev->msix_enabled) 263 if (!dev->msix_enabled)
360 return; 264 return;
361 265
362 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSIX);
363 if (!save_state)
364 return;
365 save = *((u16 *)&save_state->data[0]);
366 pci_remove_saved_cap(save_state);
367 kfree(save_state);
368
369 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
370 if (pos <= 0)
371 return;
372
373 /* route the table */ 266 /* route the table */
374 pci_intx(dev, 0); /* disable intx */ 267 pci_intx(dev, 0); /* disable intx */
375 msix_set_enable(dev, 0); 268 msix_set_enable(dev, 0);
376 irq = head = dev->first_msi_irq; 269 irq = head = dev->first_msi_irq;
270 entry = get_irq_msi(irq);
271 pos = entry->msi_attrib.pos;
377 while (head != tail) { 272 while (head != tail) {
378 entry = get_irq_msi(irq); 273 entry = get_irq_msi(irq);
379 write_msi_msg(irq, &entry->msg_save); 274 write_msi_msg(irq, &entry->msg);
275 msi_set_mask_bit(irq, entry->msi_attrib.masked);
380 276
381 tail = entry->link.tail; 277 tail = entry->link.tail;
382 irq = tail; 278 irq = tail;
383 } 279 }
384 280
385 pci_write_config_word(dev, msi_control_reg(pos), save); 281 pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control);
282 control &= ~PCI_MSIX_FLAGS_MASKALL;
283 control |= PCI_MSIX_FLAGS_ENABLE;
284 pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
386} 285}
387 286
388void pci_restore_msi_state(struct pci_dev *dev) 287void pci_restore_msi_state(struct pci_dev *dev)
@@ -420,6 +319,7 @@ static int msi_capability_init(struct pci_dev *dev)
420 entry->msi_attrib.is_64 = is_64bit_address(control); 319 entry->msi_attrib.is_64 = is_64bit_address(control);
421 entry->msi_attrib.entry_nr = 0; 320 entry->msi_attrib.entry_nr = 0;
422 entry->msi_attrib.maskbit = is_mask_bit_support(control); 321 entry->msi_attrib.maskbit = is_mask_bit_support(control);
322 entry->msi_attrib.masked = 1;
423 entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ 323 entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
424 entry->msi_attrib.pos = pos; 324 entry->msi_attrib.pos = pos;
425 if (is_mask_bit_support(control)) { 325 if (is_mask_bit_support(control)) {
@@ -507,6 +407,7 @@ static int msix_capability_init(struct pci_dev *dev,
507 entry->msi_attrib.is_64 = 1; 407 entry->msi_attrib.is_64 = 1;
508 entry->msi_attrib.entry_nr = j; 408 entry->msi_attrib.entry_nr = j;
509 entry->msi_attrib.maskbit = 1; 409 entry->msi_attrib.maskbit = 1;
410 entry->msi_attrib.masked = 1;
510 entry->msi_attrib.default_irq = dev->irq; 411 entry->msi_attrib.default_irq = dev->irq;
511 entry->msi_attrib.pos = pos; 412 entry->msi_attrib.pos = pos;
512 entry->dev = dev; 413 entry->dev = dev;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index df495300ce3d..d3eab057b2d3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -551,7 +551,9 @@ static int pci_save_pcie_state(struct pci_dev *dev)
551 if (pos <= 0) 551 if (pos <= 0)
552 return 0; 552 return 0;
553 553
554 save_state = kzalloc(sizeof(*save_state) + sizeof(u16) * 4, GFP_KERNEL); 554 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP);
555 if (!save_state)
556 save_state = kzalloc(sizeof(*save_state) + sizeof(u16) * 4, GFP_KERNEL);
555 if (!save_state) { 557 if (!save_state) {
556 dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); 558 dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n");
557 return -ENOMEM; 559 return -ENOMEM;
@@ -582,8 +584,6 @@ static void pci_restore_pcie_state(struct pci_dev *dev)
582 pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); 584 pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]);
583 pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); 585 pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]);
584 pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); 586 pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]);
585 pci_remove_saved_cap(save_state);
586 kfree(save_state);
587} 587}
588 588
589 589
@@ -597,7 +597,9 @@ static int pci_save_pcix_state(struct pci_dev *dev)
597 if (pos <= 0) 597 if (pos <= 0)
598 return 0; 598 return 0;
599 599
600 save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL); 600 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP);
601 if (!save_state)
602 save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL);
601 if (!save_state) { 603 if (!save_state) {
602 dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); 604 dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n");
603 return -ENOMEM; 605 return -ENOMEM;
@@ -622,8 +624,6 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
622 cap = (u16 *)&save_state->data[0]; 624 cap = (u16 *)&save_state->data[0];
623 625
624 pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]); 626 pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
625 pci_remove_saved_cap(save_state);
626 kfree(save_state);
627} 627}
628 628
629 629
@@ -638,8 +638,6 @@ pci_save_state(struct pci_dev *dev)
638 /* XXX: 100% dword access ok here? */ 638 /* XXX: 100% dword access ok here? */
639 for (i = 0; i < 16; i++) 639 for (i = 0; i < 16; i++)
640 pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]); 640 pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]);
641 if ((i = pci_save_msi_state(dev)) != 0)
642 return i;
643 if ((i = pci_save_pcie_state(dev)) != 0) 641 if ((i = pci_save_pcie_state(dev)) != 0)
644 return i; 642 return i;
645 if ((i = pci_save_pcix_state(dev)) != 0) 643 if ((i = pci_save_pcix_state(dev)) != 0)
@@ -757,7 +755,8 @@ int pci_enable_device(struct pci_dev *dev)
757 * when a device is enabled using managed PCI device enable interface. 755 * when a device is enabled using managed PCI device enable interface.
758 */ 756 */
759struct pci_devres { 757struct pci_devres {
760 unsigned int disable:1; 758 unsigned int enabled:1;
759 unsigned int pinned:1;
761 unsigned int orig_intx:1; 760 unsigned int orig_intx:1;
762 unsigned int restore_intx:1; 761 unsigned int restore_intx:1;
763 u32 region_mask; 762 u32 region_mask;
@@ -781,7 +780,7 @@ static void pcim_release(struct device *gendev, void *res)
781 if (this->restore_intx) 780 if (this->restore_intx)
782 pci_intx(dev, this->orig_intx); 781 pci_intx(dev, this->orig_intx);
783 782
784 if (this->disable) 783 if (this->enabled && !this->pinned)
785 pci_disable_device(dev); 784 pci_disable_device(dev);
786} 785}
787 786
@@ -820,12 +819,12 @@ int pcim_enable_device(struct pci_dev *pdev)
820 dr = get_pci_dr(pdev); 819 dr = get_pci_dr(pdev);
821 if (unlikely(!dr)) 820 if (unlikely(!dr))
822 return -ENOMEM; 821 return -ENOMEM;
823 WARN_ON(!!dr->disable); 822 WARN_ON(!!dr->enabled);
824 823
825 rc = pci_enable_device(pdev); 824 rc = pci_enable_device(pdev);
826 if (!rc) { 825 if (!rc) {
827 pdev->is_managed = 1; 826 pdev->is_managed = 1;
828 dr->disable = 1; 827 dr->enabled = 1;
829 } 828 }
830 return rc; 829 return rc;
831} 830}
@@ -843,9 +842,9 @@ void pcim_pin_device(struct pci_dev *pdev)
843 struct pci_devres *dr; 842 struct pci_devres *dr;
844 843
845 dr = find_pci_dr(pdev); 844 dr = find_pci_dr(pdev);
846 WARN_ON(!dr || !dr->disable); 845 WARN_ON(!dr || !dr->enabled);
847 if (dr) 846 if (dr)
848 dr->disable = 0; 847 dr->pinned = 1;
849} 848}
850 849
851/** 850/**
@@ -876,7 +875,7 @@ pci_disable_device(struct pci_dev *dev)
876 875
877 dr = find_pci_dr(dev); 876 dr = find_pci_dr(dev);
878 if (dr) 877 if (dr)
879 dr->disable = 0; 878 dr->enabled = 0;
880 879
881 if (atomic_sub_return(1, &dev->enable_cnt) != 0) 880 if (atomic_sub_return(1, &dev->enable_cnt) != 0)
882 return; 881 return;
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ae7a975995a5..62ea04c8af64 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -52,10 +52,8 @@ static inline void pci_no_msi(void) { }
52#endif 52#endif
53 53
54#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM) 54#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM)
55int pci_save_msi_state(struct pci_dev *dev);
56void pci_restore_msi_state(struct pci_dev *dev); 55void pci_restore_msi_state(struct pci_dev *dev);
57#else 56#else
58static inline int pci_save_msi_state(struct pci_dev *dev) { return 0; }
59static inline void pci_restore_msi_state(struct pci_dev *dev) {} 57static inline void pci_restore_msi_state(struct pci_dev *dev) {}
60#endif 58#endif
61 59
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index b164de050d4f..db6ad8e763ac 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -66,7 +66,7 @@ static struct pci_error_handlers aer_error_handlers = {
66 .resume = aer_error_resume, 66 .resume = aer_error_resume,
67}; 67};
68 68
69static struct pcie_port_service_driver aerdrv = { 69static struct pcie_port_service_driver aerdriver = {
70 .name = "aer", 70 .name = "aer",
71 .id_table = &aer_id[0], 71 .id_table = &aer_id[0],
72 72
@@ -328,7 +328,7 @@ static void aer_error_resume(struct pci_dev *dev)
328 **/ 328 **/
329static int __init aer_service_init(void) 329static int __init aer_service_init(void)
330{ 330{
331 return pcie_port_service_register(&aerdrv); 331 return pcie_port_service_register(&aerdriver);
332} 332}
333 333
334/** 334/**
@@ -338,7 +338,7 @@ static int __init aer_service_init(void)
338 **/ 338 **/
339static void __exit aer_service_exit(void) 339static void __exit aer_service_exit(void)
340{ 340{
341 pcie_port_service_unregister(&aerdrv); 341 pcie_port_service_unregister(&aerdriver);
342} 342}
343 343
344module_init(aer_service_init); 344module_init(aer_service_init);
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index f17e7ed2b2a5..df383645e366 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -93,7 +93,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
93 if (!dev->irq && dev->pin) { 93 if (!dev->irq && dev->pin) {
94 printk(KERN_WARNING 94 printk(KERN_WARNING
95 "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", 95 "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n",
96 __FUNCTION__, dev->device, dev->vendor); 96 __FUNCTION__, dev->vendor, dev->device);
97 } 97 }
98 if (pcie_port_device_register(dev)) { 98 if (pcie_port_device_register(dev)) {
99 pci_disable_device(dev); 99 pci_disable_device(dev);
@@ -276,7 +276,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = {
276 .resume = pcie_portdrv_err_resume, 276 .resume = pcie_portdrv_err_resume,
277}; 277};
278 278
279static struct pci_driver pcie_portdrv = { 279static struct pci_driver pcie_portdriver = {
280 .name = (char *)device_name, 280 .name = (char *)device_name,
281 .id_table = &port_pci_ids[0], 281 .id_table = &port_pci_ids[0],
282 282
@@ -298,7 +298,7 @@ static int __init pcie_portdrv_init(void)
298 printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval); 298 printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval);
299 goto out; 299 goto out;
300 } 300 }
301 retval = pci_register_driver(&pcie_portdrv); 301 retval = pci_register_driver(&pcie_portdriver);
302 if (retval) 302 if (retval)
303 pcie_port_bus_unregister(); 303 pcie_port_bus_unregister();
304 out: 304 out:
@@ -307,7 +307,7 @@ static int __init pcie_portdrv_init(void)
307 307
308static void __exit pcie_portdrv_exit(void) 308static void __exit pcie_portdrv_exit(void)
309{ 309{
310 pci_unregister_driver(&pcie_portdrv); 310 pci_unregister_driver(&pcie_portdriver);
311 pcie_port_bus_unregister(); 311 pcie_port_bus_unregister();
312} 312}
313 313
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7f94fc098cd3..65d6f23ead41 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -963,6 +963,13 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho
963 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 963 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
964 * becomes necessary to do this tweak in two steps -- I've chosen the Host 964 * becomes necessary to do this tweak in two steps -- I've chosen the Host
965 * bridge as trigger. 965 * bridge as trigger.
966 *
967 * Note that we used to unhide the SMBus that way on Toshiba laptops
968 * (Satellite A40 and Tecra M2) but then found that the thermal management
969 * was done by SMM code, which could cause unsynchronized concurrent
970 * accesses to the SMBus registers, with potentially bad effects. Thus you
971 * should be very careful when adding new entries: if SMM is accessing the
972 * Intel SMBus, this is a very good reason to leave it hidden.
966 */ 973 */
967static int asus_hides_smbus; 974static int asus_hides_smbus;
968 975
@@ -1040,17 +1047,6 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
1040 case 0x099c: /* HP Compaq nx6110 */ 1047 case 0x099c: /* HP Compaq nx6110 */
1041 asus_hides_smbus = 1; 1048 asus_hides_smbus = 1;
1042 } 1049 }
1043 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_TOSHIBA)) {
1044 if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
1045 switch(dev->subsystem_device) {
1046 case 0x0001: /* Toshiba Satellite A40 */
1047 asus_hides_smbus = 1;
1048 }
1049 else if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1050 switch(dev->subsystem_device) {
1051 case 0x0001: /* Toshiba Tecra M2 */
1052 asus_hides_smbus = 1;
1053 }
1054 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 1050 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
1055 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1051 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1056 switch(dev->subsystem_device) { 1052 switch(dev->subsystem_device) {
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index ff98eaddaa73..2dd8681d6b31 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -15,7 +15,7 @@
15 15
16DECLARE_RWSEM(pci_bus_sem); 16DECLARE_RWSEM(pci_bus_sem);
17 17
18static struct pci_bus * __devinit 18static struct pci_bus *
19pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) 19pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
20{ 20{
21 struct pci_bus* child; 21 struct pci_bus* child;
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 551bde5d9430..b693367d38cd 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -372,7 +372,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
372 skt->socket.resource_ops = &pccard_static_ops; 372 skt->socket.resource_ops = &pccard_static_ops;
373 skt->socket.ops = &au1x00_pcmcia_operations; 373 skt->socket.ops = &au1x00_pcmcia_operations;
374 skt->socket.owner = ops->owner; 374 skt->socket.owner = ops->owner;
375 skt->socket.dev.dev = dev; 375 skt->socket.dev.parent = dev;
376 376
377 init_timer(&skt->poll_timer); 377 init_timer(&skt->poll_timer);
378 skt->poll_timer.function = au1x00_pcmcia_poll_event; 378 skt->poll_timer.function = au1x00_pcmcia_poll_event;
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index d77f75129f8a..2df216b00817 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -202,15 +202,14 @@ static struct pccard_operations omap_cf_ops = {
202 * "what chipselect is used". Boards could want more. 202 * "what chipselect is used". Boards could want more.
203 */ 203 */
204 204
205static int __devinit omap_cf_probe(struct device *dev) 205static int __init omap_cf_probe(struct platform_device *pdev)
206{ 206{
207 unsigned seg; 207 unsigned seg;
208 struct omap_cf_socket *cf; 208 struct omap_cf_socket *cf;
209 struct platform_device *pdev = to_platform_device(dev);
210 int irq; 209 int irq;
211 int status; 210 int status;
212 211
213 seg = (int) dev->platform_data; 212 seg = (int) pdev->dev.platform_data;
214 if (seg == 0 || seg > 3) 213 if (seg == 0 || seg > 3)
215 return -ENODEV; 214 return -ENODEV;
216 215
@@ -227,7 +226,7 @@ static int __devinit omap_cf_probe(struct device *dev)
227 cf->timer.data = (unsigned long) cf; 226 cf->timer.data = (unsigned long) cf;
228 227
229 cf->pdev = pdev; 228 cf->pdev = pdev;
230 dev_set_drvdata(dev, cf); 229 platform_set_drvdata(pdev, cf);
231 230
232 /* this primarily just shuts up irq handling noise */ 231 /* this primarily just shuts up irq handling noise */
233 status = request_irq(irq, omap_cf_irq, IRQF_SHARED, 232 status = request_irq(irq, omap_cf_irq, IRQF_SHARED,
@@ -291,7 +290,7 @@ static int __devinit omap_cf_probe(struct device *dev)
291 omap_cf_present() ? "present" : "(not present)"); 290 omap_cf_present() ? "present" : "(not present)");
292 291
293 cf->socket.owner = THIS_MODULE; 292 cf->socket.owner = THIS_MODULE;
294 cf->socket.dev.parent = dev; 293 cf->socket.dev.parent = &pdev->dev;
295 cf->socket.ops = &omap_cf_ops; 294 cf->socket.ops = &omap_cf_ops;
296 cf->socket.resource_ops = &pccard_static_ops; 295 cf->socket.resource_ops = &pccard_static_ops;
297 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP 296 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
@@ -318,9 +317,9 @@ fail0:
318 return status; 317 return status;
319} 318}
320 319
321static int __devexit omap_cf_remove(struct device *dev) 320static int __exit omap_cf_remove(struct platform_device *pdev)
322{ 321{
323 struct omap_cf_socket *cf = dev_get_drvdata(dev); 322 struct omap_cf_socket *cf = platform_get_drvdata(pdev);
324 323
325 cf->active = 0; 324 cf->active = 0;
326 pcmcia_unregister_socket(&cf->socket); 325 pcmcia_unregister_socket(&cf->socket);
@@ -332,26 +331,36 @@ static int __devexit omap_cf_remove(struct device *dev)
332 return 0; 331 return 0;
333} 332}
334 333
335static struct device_driver omap_cf_driver = { 334static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
336 .name = (char *) driver_name, 335{
337 .bus = &platform_bus_type, 336 return pcmcia_socket_dev_suspend(&pdev->dev, mesg);
338 .probe = omap_cf_probe, 337}
339 .remove = __devexit_p(omap_cf_remove), 338
340 .suspend = pcmcia_socket_dev_suspend, 339static int omap_cf_resume(struct platform_device *pdev)
341 .resume = pcmcia_socket_dev_resume, 340{
341 return pcmcia_socket_dev_resume(&pdev->dev);
342}
343
344static struct platform_driver omap_cf_driver = {
345 .driver = {
346 .name = (char *) driver_name,
347 },
348 .remove = __exit_p(omap_cf_remove),
349 .suspend = omap_cf_suspend,
350 .resume = omap_cf_resume,
342}; 351};
343 352
344static int __init omap_cf_init(void) 353static int __init omap_cf_init(void)
345{ 354{
346 if (cpu_is_omap16xx()) 355 if (cpu_is_omap16xx())
347 return driver_register(&omap_cf_driver); 356 return platform_driver_probe(&omap_cf_driver, omap_cf_probe);
348 return -ENODEV; 357 return -ENODEV;
349} 358}
350 359
351static void __exit omap_cf_exit(void) 360static void __exit omap_cf_exit(void)
352{ 361{
353 if (cpu_is_omap16xx()) 362 if (cpu_is_omap16xx())
354 driver_unregister(&omap_cf_driver); 363 platform_driver_unregister(&omap_cf_driver);
355} 364}
356 365
357module_init(omap_cf_init); 366module_init(omap_cf_init);
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 5026b345cb30..57e6ab1004d0 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -451,7 +451,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
451 return -EINVAL; 451 return -EINVAL;
452 452
453 if(!pnp_can_configure(dev)) { 453 if(!pnp_can_configure(dev)) {
454 pnp_info("Device %s does not support resource configuration.", dev->dev.bus_id); 454 pnp_dbg("Device %s does not support resource configuration.", dev->dev.bus_id);
455 return -ENODEV; 455 return -ENODEV;
456 } 456 }
457 457
@@ -482,7 +482,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
482int pnp_start_dev(struct pnp_dev *dev) 482int pnp_start_dev(struct pnp_dev *dev)
483{ 483{
484 if (!pnp_can_write(dev)) { 484 if (!pnp_can_write(dev)) {
485 pnp_info("Device %s does not support activation.", dev->dev.bus_id); 485 pnp_dbg("Device %s does not support activation.", dev->dev.bus_id);
486 return -EINVAL; 486 return -EINVAL;
487 } 487 }
488 488
@@ -506,7 +506,7 @@ int pnp_start_dev(struct pnp_dev *dev)
506int pnp_stop_dev(struct pnp_dev *dev) 506int pnp_stop_dev(struct pnp_dev *dev)
507{ 507{
508 if (!pnp_can_disable(dev)) { 508 if (!pnp_can_disable(dev)) {
509 pnp_info("Device %s does not support disabling.", dev->dev.bus_id); 509 pnp_dbg("Device %s does not support disabling.", dev->dev.bus_id);
510 return -EINVAL; 510 return -EINVAL;
511 } 511 }
512 if (dev->protocol->disable(dev)<0) { 512 if (dev->protocol->disable(dev)<0) {
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 7a535542fe92..118ac9779b3c 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -89,6 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
89 return; 89 return;
90 90
91 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 91 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
92 res->irq_resource[i].flags |= irq_flags(triggering, polarity);
92 irq = acpi_register_gsi(gsi, triggering, polarity); 93 irq = acpi_register_gsi(gsi, triggering, polarity);
93 if (irq < 0) { 94 if (irq < 0) {
94 res->irq_resource[i].flags |= IORESOURCE_DISABLED; 95 res->irq_resource[i].flags |= IORESOURCE_DISABLED;
@@ -103,8 +104,52 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
103 pcibios_penalize_isa_irq(irq, 1); 104 pcibios_penalize_isa_irq(irq, 1);
104} 105}
105 106
107static int dma_flags(int type, int bus_master, int transfer)
108{
109 int flags = 0;
110
111 if (bus_master)
112 flags |= IORESOURCE_DMA_MASTER;
113 switch (type) {
114 case ACPI_COMPATIBILITY:
115 flags |= IORESOURCE_DMA_COMPATIBLE;
116 break;
117 case ACPI_TYPE_A:
118 flags |= IORESOURCE_DMA_TYPEA;
119 break;
120 case ACPI_TYPE_B:
121 flags |= IORESOURCE_DMA_TYPEB;
122 break;
123 case ACPI_TYPE_F:
124 flags |= IORESOURCE_DMA_TYPEF;
125 break;
126 default:
127 /* Set a default value ? */
128 flags |= IORESOURCE_DMA_COMPATIBLE;
129 pnp_err("Invalid DMA type");
130 }
131 switch (transfer) {
132 case ACPI_TRANSFER_8:
133 flags |= IORESOURCE_DMA_8BIT;
134 break;
135 case ACPI_TRANSFER_8_16:
136 flags |= IORESOURCE_DMA_8AND16BIT;
137 break;
138 case ACPI_TRANSFER_16:
139 flags |= IORESOURCE_DMA_16BIT;
140 break;
141 default:
142 /* Set a default value ? */
143 flags |= IORESOURCE_DMA_8AND16BIT;
144 pnp_err("Invalid DMA transfer type");
145 }
146
147 return flags;
148}
149
106static void 150static void
107pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) 151pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma,
152 int type, int bus_master, int transfer)
108{ 153{
109 int i = 0; 154 int i = 0;
110 while (i < PNP_MAX_DMA && 155 while (i < PNP_MAX_DMA &&
@@ -112,6 +157,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
112 i++; 157 i++;
113 if (i < PNP_MAX_DMA) { 158 if (i < PNP_MAX_DMA) {
114 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag 159 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag
160 res->dma_resource[i].flags |= dma_flags(type, bus_master, transfer);
115 if (dma == -1) { 161 if (dma == -1) {
116 res->dma_resource[i].flags |= IORESOURCE_DISABLED; 162 res->dma_resource[i].flags |= IORESOURCE_DISABLED;
117 return; 163 return;
@@ -123,7 +169,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
123 169
124static void 170static void
125pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, 171pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
126 u64 io, u64 len) 172 u64 io, u64 len, int io_decode)
127{ 173{
128 int i = 0; 174 int i = 0;
129 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 175 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -131,6 +177,8 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
131 i++; 177 i++;
132 if (i < PNP_MAX_PORT) { 178 if (i < PNP_MAX_PORT) {
133 res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag 179 res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag
180 if (io_decode == ACPI_DECODE_16)
181 res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR;
134 if (len <= 0 || (io + len -1) >= 0x10003) { 182 if (len <= 0 || (io + len -1) >= 0x10003) {
135 res->port_resource[i].flags |= IORESOURCE_DISABLED; 183 res->port_resource[i].flags |= IORESOURCE_DISABLED;
136 return; 184 return;
@@ -142,7 +190,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
142 190
143static void 191static void
144pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, 192pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
145 u64 mem, u64 len) 193 u64 mem, u64 len, int write_protect)
146{ 194{
147 int i = 0; 195 int i = 0;
148 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 196 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -154,6 +202,9 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
154 res->mem_resource[i].flags |= IORESOURCE_DISABLED; 202 res->mem_resource[i].flags |= IORESOURCE_DISABLED;
155 return; 203 return;
156 } 204 }
205 if(write_protect == ACPI_READ_WRITE_MEMORY)
206 res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE;
207
157 res->mem_resource[i].start = mem; 208 res->mem_resource[i].start = mem;
158 res->mem_resource[i].end = mem + len - 1; 209 res->mem_resource[i].end = mem + len - 1;
159 } 210 }
@@ -178,10 +229,11 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
178 229
179 if (p->resource_type == ACPI_MEMORY_RANGE) 230 if (p->resource_type == ACPI_MEMORY_RANGE)
180 pnpacpi_parse_allocated_memresource(res_table, 231 pnpacpi_parse_allocated_memresource(res_table,
181 p->minimum, p->address_length); 232 p->minimum, p->address_length, p->info.mem.write_protect);
182 else if (p->resource_type == ACPI_IO_RANGE) 233 else if (p->resource_type == ACPI_IO_RANGE)
183 pnpacpi_parse_allocated_ioresource(res_table, 234 pnpacpi_parse_allocated_ioresource(res_table,
184 p->minimum, p->address_length); 235 p->minimum, p->address_length,
236 p->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16);
185} 237}
186 238
187static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 239static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
@@ -208,13 +260,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
208 case ACPI_RESOURCE_TYPE_DMA: 260 case ACPI_RESOURCE_TYPE_DMA:
209 if (res->data.dma.channel_count > 0) 261 if (res->data.dma.channel_count > 0)
210 pnpacpi_parse_allocated_dmaresource(res_table, 262 pnpacpi_parse_allocated_dmaresource(res_table,
211 res->data.dma.channels[0]); 263 res->data.dma.channels[0],
264 res->data.dma.type,
265 res->data.dma.bus_master,
266 res->data.dma.transfer);
212 break; 267 break;
213 268
214 case ACPI_RESOURCE_TYPE_IO: 269 case ACPI_RESOURCE_TYPE_IO:
215 pnpacpi_parse_allocated_ioresource(res_table, 270 pnpacpi_parse_allocated_ioresource(res_table,
216 res->data.io.minimum, 271 res->data.io.minimum,
217 res->data.io.address_length); 272 res->data.io.address_length,
273 res->data.io.io_decode);
218 break; 274 break;
219 275
220 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 276 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -224,7 +280,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
224 case ACPI_RESOURCE_TYPE_FIXED_IO: 280 case ACPI_RESOURCE_TYPE_FIXED_IO:
225 pnpacpi_parse_allocated_ioresource(res_table, 281 pnpacpi_parse_allocated_ioresource(res_table,
226 res->data.fixed_io.address, 282 res->data.fixed_io.address,
227 res->data.fixed_io.address_length); 283 res->data.fixed_io.address_length,
284 ACPI_DECODE_10);
228 break; 285 break;
229 286
230 case ACPI_RESOURCE_TYPE_VENDOR: 287 case ACPI_RESOURCE_TYPE_VENDOR:
@@ -236,17 +293,20 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
236 case ACPI_RESOURCE_TYPE_MEMORY24: 293 case ACPI_RESOURCE_TYPE_MEMORY24:
237 pnpacpi_parse_allocated_memresource(res_table, 294 pnpacpi_parse_allocated_memresource(res_table,
238 res->data.memory24.minimum, 295 res->data.memory24.minimum,
239 res->data.memory24.address_length); 296 res->data.memory24.address_length,
297 res->data.memory24.write_protect);
240 break; 298 break;
241 case ACPI_RESOURCE_TYPE_MEMORY32: 299 case ACPI_RESOURCE_TYPE_MEMORY32:
242 pnpacpi_parse_allocated_memresource(res_table, 300 pnpacpi_parse_allocated_memresource(res_table,
243 res->data.memory32.minimum, 301 res->data.memory32.minimum,
244 res->data.memory32.address_length); 302 res->data.memory32.address_length,
303 res->data.memory32.write_protect);
245 break; 304 break;
246 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 305 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
247 pnpacpi_parse_allocated_memresource(res_table, 306 pnpacpi_parse_allocated_memresource(res_table,
248 res->data.fixed_memory32.address, 307 res->data.fixed_memory32.address,
249 res->data.fixed_memory32.address_length); 308 res->data.fixed_memory32.address_length,
309 res->data.fixed_memory32.write_protect);
250 break; 310 break;
251 case ACPI_RESOURCE_TYPE_ADDRESS16: 311 case ACPI_RESOURCE_TYPE_ADDRESS16:
252 case ACPI_RESOURCE_TYPE_ADDRESS32: 312 case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -304,42 +364,8 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
304 364
305 for(i = 0; i < p->channel_count; i++) 365 for(i = 0; i < p->channel_count; i++)
306 dma->map |= 1 << p->channels[i]; 366 dma->map |= 1 << p->channels[i];
307 dma->flags = 0; 367
308 if (p->bus_master) 368 dma->flags = dma_flags(p->type, p->bus_master, p->transfer);
309 dma->flags |= IORESOURCE_DMA_MASTER;
310 switch (p->type) {
311 case ACPI_COMPATIBILITY:
312 dma->flags |= IORESOURCE_DMA_COMPATIBLE;
313 break;
314 case ACPI_TYPE_A:
315 dma->flags |= IORESOURCE_DMA_TYPEA;
316 break;
317 case ACPI_TYPE_B:
318 dma->flags |= IORESOURCE_DMA_TYPEB;
319 break;
320 case ACPI_TYPE_F:
321 dma->flags |= IORESOURCE_DMA_TYPEF;
322 break;
323 default:
324 /* Set a default value ? */
325 dma->flags |= IORESOURCE_DMA_COMPATIBLE;
326 pnp_err("Invalid DMA type");
327 }
328 switch (p->transfer) {
329 case ACPI_TRANSFER_8:
330 dma->flags |= IORESOURCE_DMA_8BIT;
331 break;
332 case ACPI_TRANSFER_8_16:
333 dma->flags |= IORESOURCE_DMA_8AND16BIT;
334 break;
335 case ACPI_TRANSFER_16:
336 dma->flags |= IORESOURCE_DMA_16BIT;
337 break;
338 default:
339 /* Set a default value ? */
340 dma->flags |= IORESOURCE_DMA_8AND16BIT;
341 pnp_err("Invalid DMA transfer type");
342 }
343 369
344 pnp_register_dma_resource(option, dma); 370 pnp_register_dma_resource(option, dma);
345 return; 371 return;
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 2065e74bb63f..a8a95540b1ef 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -22,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
22 { "", 0 } 22 { "", 0 }
23}; 23};
24 24
25static void reserve_range(char *pnpid, int start, int end, int port) 25static void reserve_range(const char *pnpid, resource_size_t start, resource_size_t end, int port)
26{ 26{
27 struct resource *res; 27 struct resource *res;
28 char *regionid; 28 char *regionid;
@@ -32,9 +32,9 @@ static void reserve_range(char *pnpid, int start, int end, int port)
32 return; 32 return;
33 snprintf(regionid, 16, "pnp %s", pnpid); 33 snprintf(regionid, 16, "pnp %s", pnpid);
34 if (port) 34 if (port)
35 res = request_region(start,end-start+1,regionid); 35 res = request_region(start, end-start+1, regionid);
36 else 36 else
37 res = request_mem_region(start,end-start+1,regionid); 37 res = request_mem_region(start, end-start+1, regionid);
38 if (res == NULL) 38 if (res == NULL)
39 kfree(regionid); 39 kfree(regionid);
40 else 40 else
@@ -45,12 +45,13 @@ static void reserve_range(char *pnpid, int start, int end, int port)
45 * have double reservations. 45 * have double reservations.
46 */ 46 */
47 printk(KERN_INFO 47 printk(KERN_INFO
48 "pnp: %s: %s range 0x%x-0x%x %s reserved\n", 48 "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
49 pnpid, port ? "ioport" : "iomem", start, end, 49 pnpid, port ? "ioport" : "iomem",
50 (unsigned long long)start, (unsigned long long)end,
50 NULL != res ? "has been" : "could not be"); 51 NULL != res ? "has been" : "could not be");
51} 52}
52 53
53static void reserve_resources_of_dev(struct pnp_dev *dev) 54static void reserve_resources_of_dev(const struct pnp_dev *dev)
54{ 55{
55 int i; 56 int i;
56 57
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c
index 21c97c80aa2e..bc70e81f8cb0 100644
--- a/drivers/ps3/ps3av_cmd.c
+++ b/drivers/ps3/ps3av_cmd.c
@@ -485,12 +485,12 @@ static u8 ps3av_cnv_mclk(u32 fs)
485 485
486static const u32 ps3av_ns_table[][5] = { 486static const u32 ps3av_ns_table[][5] = {
487 /* D1, D2, D3, D4, D5 */ 487 /* D1, D2, D3, D4, D5 */
488 [PS3AV_CMD_AUDIO_FS_44K-BASE] { 6272, 6272, 17836, 17836, 8918 }, 488 [PS3AV_CMD_AUDIO_FS_44K-BASE] = { 6272, 6272, 17836, 17836, 8918 },
489 [PS3AV_CMD_AUDIO_FS_48K-BASE] { 6144, 6144, 11648, 11648, 5824 }, 489 [PS3AV_CMD_AUDIO_FS_48K-BASE] = { 6144, 6144, 11648, 11648, 5824 },
490 [PS3AV_CMD_AUDIO_FS_88K-BASE] { 12544, 12544, 35672, 35672, 17836 }, 490 [PS3AV_CMD_AUDIO_FS_88K-BASE] = { 12544, 12544, 35672, 35672, 17836 },
491 [PS3AV_CMD_AUDIO_FS_96K-BASE] { 12288, 12288, 23296, 23296, 11648 }, 491 [PS3AV_CMD_AUDIO_FS_96K-BASE] = { 12288, 12288, 23296, 23296, 11648 },
492 [PS3AV_CMD_AUDIO_FS_176K-BASE] { 25088, 25088, 71344, 71344, 35672 }, 492 [PS3AV_CMD_AUDIO_FS_176K-BASE] = { 25088, 25088, 71344, 71344, 35672 },
493 [PS3AV_CMD_AUDIO_FS_192K-BASE] { 24576, 24576, 46592, 46592, 23296 } 493 [PS3AV_CMD_AUDIO_FS_192K-BASE] = { 24576, 24576, 46592, 46592, 23296 }
494}; 494};
495 495
496static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid) 496static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid)
@@ -543,9 +543,10 @@ static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid)
543 543
544#undef BASE 544#undef BASE
545 545
546static u8 ps3av_cnv_enable(u32 source, u8 *enable) 546static u8 ps3av_cnv_enable(u32 source, const u8 *enable)
547{ 547{
548 u8 *p, ret = 0; 548 const u8 *p;
549 u8 ret = 0;
549 550
550 if (source == PS3AV_CMD_AUDIO_SOURCE_SPDIF) { 551 if (source == PS3AV_CMD_AUDIO_SOURCE_SPDIF) {
551 ret = 0x03; 552 ret = 0x03;
@@ -559,9 +560,10 @@ static u8 ps3av_cnv_enable(u32 source, u8 *enable)
559 return ret; 560 return ret;
560} 561}
561 562
562static u8 ps3av_cnv_fifomap(u8 *map) 563static u8 ps3av_cnv_fifomap(const u8 *map)
563{ 564{
564 u8 *p, ret = 0; 565 const u8 *p;
566 u8 ret = 0;
565 567
566 p = map; 568 p = map;
567 ret = p[0] + (p[1] << 2) + (p[2] << 4) + (p[3] << 6); 569 ret = p[0] + (p[1] << 2) + (p[2] << 4) + (p[3] << 6);
@@ -615,7 +617,7 @@ static void ps3av_cnv_info(struct ps3av_audio_info_frame *info,
615 info->pb5.lsv = mode->audio_downmix_level; 617 info->pb5.lsv = mode->audio_downmix_level;
616} 618}
617 619
618static void ps3av_cnv_chstat(u8 *chstat, u8 *cs_info) 620static void ps3av_cnv_chstat(u8 *chstat, const u8 *cs_info)
619{ 621{
620 memcpy(chstat, cs_info, 5); 622 memcpy(chstat, cs_info, 5);
621} 623}
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c
index 1adf186bfaf5..6c12744eeb9d 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/vuart.c
@@ -952,7 +952,7 @@ fail_alloc_irq:
952 kfree(dev->priv); 952 kfree(dev->priv);
953 dev->priv = NULL; 953 dev->priv = NULL;
954fail_alloc: 954fail_alloc:
955 vuart_bus_priv.devices[port_number] = 0; 955 vuart_bus_priv.devices[port_number] = NULL;
956fail_match: 956fail_match:
957 up(&vuart_bus_priv.probe_mutex); 957 up(&vuart_bus_priv.probe_mutex);
958 dev_dbg(&dev->core, "%s:%d failed\n", __func__, __LINE__); 958 dev_dbg(&dev->core, "%s:%d failed\n", __func__, __LINE__);
@@ -978,7 +978,7 @@ static int ps3_vuart_remove(struct device *_dev)
978 dev_dbg(&dev->core, "%s:%d: %s no remove method\n", __func__, 978 dev_dbg(&dev->core, "%s:%d: %s no remove method\n", __func__,
979 __LINE__, dev->core.bus_id); 979 __LINE__, dev->core.bus_id);
980 980
981 vuart_bus_priv.devices[dev->priv->port_number] = 0; 981 vuart_bus_priv.devices[dev->priv->port_number] = NULL;
982 982
983 if (--vuart_bus_priv.use_count == 0) { 983 if (--vuart_bus_priv.use_count == 0) {
984 BUG(); 984 BUG();
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 85bf795abdcc..7c0d60910077 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -59,6 +59,19 @@ struct cmos_rtc {
59 59
60static const char driver_name[] = "rtc_cmos"; 60static const char driver_name[] = "rtc_cmos";
61 61
62/* The RTC_INTR register may have e.g. RTC_PF set even if RTC_PIE is clear;
63 * always mask it against the irq enable bits in RTC_CONTROL. Bit values
64 * are the same: PF==PIE, AF=AIE, UF=UIE; so RTC_IRQMASK works with both.
65 */
66#define RTC_IRQMASK (RTC_PF | RTC_AF | RTC_UF)
67
68static inline int is_intr(u8 rtc_intr)
69{
70 if (!(rtc_intr & RTC_IRQF))
71 return 0;
72 return rtc_intr & RTC_IRQMASK;
73}
74
62/*----------------------------------------------------------------*/ 75/*----------------------------------------------------------------*/
63 76
64static int cmos_read_time(struct device *dev, struct rtc_time *t) 77static int cmos_read_time(struct device *dev, struct rtc_time *t)
@@ -188,7 +201,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
188 rtc_control &= ~RTC_AIE; 201 rtc_control &= ~RTC_AIE;
189 CMOS_WRITE(rtc_control, RTC_CONTROL); 202 CMOS_WRITE(rtc_control, RTC_CONTROL);
190 rtc_intr = CMOS_READ(RTC_INTR_FLAGS); 203 rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
191 if (rtc_intr) 204 rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
205 if (is_intr(rtc_intr))
192 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); 206 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
193 207
194 /* update alarm */ 208 /* update alarm */
@@ -207,7 +221,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
207 rtc_control |= RTC_AIE; 221 rtc_control |= RTC_AIE;
208 CMOS_WRITE(rtc_control, RTC_CONTROL); 222 CMOS_WRITE(rtc_control, RTC_CONTROL);
209 rtc_intr = CMOS_READ(RTC_INTR_FLAGS); 223 rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
210 if (rtc_intr) 224 rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
225 if (is_intr(rtc_intr))
211 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); 226 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
212 } 227 }
213 228
@@ -287,7 +302,8 @@ cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
287 } 302 }
288 CMOS_WRITE(rtc_control, RTC_CONTROL); 303 CMOS_WRITE(rtc_control, RTC_CONTROL);
289 rtc_intr = CMOS_READ(RTC_INTR_FLAGS); 304 rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
290 if (rtc_intr) 305 rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
306 if (is_intr(rtc_intr))
291 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); 307 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
292 spin_unlock_irqrestore(&rtc_lock, flags); 308 spin_unlock_irqrestore(&rtc_lock, flags);
293 return 0; 309 return 0;
@@ -353,12 +369,10 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
353 369
354 spin_lock(&rtc_lock); 370 spin_lock(&rtc_lock);
355 irqstat = CMOS_READ(RTC_INTR_FLAGS); 371 irqstat = CMOS_READ(RTC_INTR_FLAGS);
372 irqstat &= (CMOS_READ(RTC_CONTROL) & RTC_IRQMASK) | RTC_IRQF;
356 spin_unlock(&rtc_lock); 373 spin_unlock(&rtc_lock);
357 374
358 if (irqstat) { 375 if (is_intr(irqstat)) {
359 /* NOTE: irqstat may have e.g. RTC_PF set
360 * even when RTC_PIE is clear...
361 */
362 rtc_update_irq(p, 1, irqstat); 376 rtc_update_irq(p, 1, irqstat);
363 return IRQ_HANDLED; 377 return IRQ_HANDLED;
364 } else 378 } else
@@ -525,25 +539,26 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg)
525{ 539{
526 struct cmos_rtc *cmos = dev_get_drvdata(dev); 540 struct cmos_rtc *cmos = dev_get_drvdata(dev);
527 int do_wake = device_may_wakeup(dev); 541 int do_wake = device_may_wakeup(dev);
528 unsigned char tmp, irqstat; 542 unsigned char tmp;
529 543
530 /* only the alarm might be a wakeup event source */ 544 /* only the alarm might be a wakeup event source */
531 spin_lock_irq(&rtc_lock); 545 spin_lock_irq(&rtc_lock);
532 cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL); 546 cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL);
533 if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { 547 if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) {
548 unsigned char irqstat;
549
534 if (do_wake) 550 if (do_wake)
535 tmp &= ~(RTC_PIE|RTC_UIE); 551 tmp &= ~(RTC_PIE|RTC_UIE);
536 else 552 else
537 tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE); 553 tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE);
538 CMOS_WRITE(tmp, RTC_CONTROL); 554 CMOS_WRITE(tmp, RTC_CONTROL);
539 irqstat = CMOS_READ(RTC_INTR_FLAGS); 555 irqstat = CMOS_READ(RTC_INTR_FLAGS);
540 } else 556 irqstat &= (tmp & RTC_IRQMASK) | RTC_IRQF;
541 irqstat = 0; 557 if (is_intr(irqstat))
558 rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat);
559 }
542 spin_unlock_irq(&rtc_lock); 560 spin_unlock_irq(&rtc_lock);
543 561
544 if (irqstat)
545 rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat);
546
547 /* ACPI HOOK: enable ACPI_EVENT_RTC when (tmp & RTC_AIE) 562 /* ACPI HOOK: enable ACPI_EVENT_RTC when (tmp & RTC_AIE)
548 * ... it'd be best if we could do that under rtc_lock. 563 * ... it'd be best if we could do that under rtc_lock.
549 */ 564 */
@@ -573,9 +588,10 @@ static int cmos_resume(struct device *dev)
573 spin_lock_irq(&rtc_lock); 588 spin_lock_irq(&rtc_lock);
574 CMOS_WRITE(tmp, RTC_CONTROL); 589 CMOS_WRITE(tmp, RTC_CONTROL);
575 tmp = CMOS_READ(RTC_INTR_FLAGS); 590 tmp = CMOS_READ(RTC_INTR_FLAGS);
576 spin_unlock_irq(&rtc_lock); 591 tmp &= (cmos->suspend_ctrl & RTC_IRQMASK) | RTC_IRQF;
577 if (tmp) 592 if (is_intr(tmp))
578 rtc_update_irq(&cmos->rtc->class_dev, 1, tmp); 593 rtc_update_irq(&cmos->rtc->class_dev, 1, tmp);
594 spin_unlock_irq(&rtc_lock);
579 } 595 }
580 596
581 pr_debug("%s: resume, ctrl %02x\n", 597 pr_debug("%s: resume, ctrl %02x\n",
@@ -594,7 +610,7 @@ static int cmos_resume(struct device *dev)
594/*----------------------------------------------------------------*/ 610/*----------------------------------------------------------------*/
595 611
596/* The "CMOS" RTC normally lives on the platform_bus. On ACPI systems, 612/* The "CMOS" RTC normally lives on the platform_bus. On ACPI systems,
597 * the device node may alternatively be created as a PNP device. 613 * the device node will always be created as a PNPACPI device.
598 */ 614 */
599 615
600#ifdef CONFIG_PNPACPI 616#ifdef CONFIG_PNPACPI
@@ -673,7 +689,7 @@ module_exit(cmos_exit);
673/*----------------------------------------------------------------*/ 689/*----------------------------------------------------------------*/
674 690
675/* Platform setup should have set up an RTC device, when PNPACPI is 691/* Platform setup should have set up an RTC device, when PNPACPI is
676 * unavailable ... this is the normal case, common even on PCs. 692 * unavailable ... this could happen even on (older) PCs.
677 */ 693 */
678 694
679static int __init cmos_platform_probe(struct platform_device *pdev) 695static int __init cmos_platform_probe(struct platform_device *pdev)
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index ab782bb46ac1..e810e4a44ed4 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -65,7 +65,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */
65 * resulting condition code and DIAG return code. */ 65 * resulting condition code and DIAG return code. */
66static inline int dia250(void *iob, int cmd) 66static inline int dia250(void *iob, int cmd)
67{ 67{
68 register unsigned long reg0 asm ("0") = (unsigned long) iob; 68 register unsigned long reg2 asm ("2") = (unsigned long) iob;
69 typedef union { 69 typedef union {
70 struct dasd_diag_init_io init_io; 70 struct dasd_diag_init_io init_io;
71 struct dasd_diag_rw_io rw_io; 71 struct dasd_diag_rw_io rw_io;
@@ -74,15 +74,15 @@ static inline int dia250(void *iob, int cmd)
74 74
75 rc = 3; 75 rc = 3;
76 asm volatile( 76 asm volatile(
77 " diag 0,%2,0x250\n" 77 " diag 2,%2,0x250\n"
78 "0: ipm %0\n" 78 "0: ipm %0\n"
79 " srl %0,28\n" 79 " srl %0,28\n"
80 " or %0,1\n" 80 " or %0,3\n"
81 "1:\n" 81 "1:\n"
82 EX_TABLE(0b,1b) 82 EX_TABLE(0b,1b)
83 : "+d" (rc), "=m" (*(addr_type *) iob) 83 : "+d" (rc), "=m" (*(addr_type *) iob)
84 : "d" (cmd), "d" (reg0), "m" (*(addr_type *) iob) 84 : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob)
85 : "1", "cc"); 85 : "3", "cc");
86 return rc; 86 return rc;
87} 87}
88 88
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index d48e3ca4752c..5aeb68e732b0 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -71,19 +71,31 @@ __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
71 * Provide an 'ungroup' attribute so the user can remove group devices no 71 * Provide an 'ungroup' attribute so the user can remove group devices no
72 * longer needed or accidentially created. Saves memory :) 72 * longer needed or accidentially created. Saves memory :)
73 */ 73 */
74static void ccwgroup_ungroup_callback(struct device *dev)
75{
76 struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
77
78 __ccwgroup_remove_symlinks(gdev);
79 device_unregister(dev);
80}
81
74static ssize_t 82static ssize_t
75ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 83ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
76{ 84{
77 struct ccwgroup_device *gdev; 85 struct ccwgroup_device *gdev;
86 int rc;
78 87
79 gdev = to_ccwgroupdev(dev); 88 gdev = to_ccwgroupdev(dev);
80 89
81 if (gdev->state != CCWGROUP_OFFLINE) 90 if (gdev->state != CCWGROUP_OFFLINE)
82 return -EINVAL; 91 return -EINVAL;
83 92
84 __ccwgroup_remove_symlinks(gdev); 93 /* Note that we cannot unregister the device from one of its
85 device_unregister(dev); 94 * attribute methods, so we have to use this roundabout approach.
86 95 */
96 rc = device_schedule_callback(dev, ccwgroup_ungroup_callback);
97 if (rc)
98 count = rc;
87 return count; 99 return count;
88} 100}
89 101
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c
index 6b1caea622ea..aa96e6752592 100644
--- a/drivers/s390/cio/device_status.c
+++ b/drivers/s390/cio/device_status.c
@@ -221,6 +221,14 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
221 221
222 cdev_irb = &cdev->private->irb; 222 cdev_irb = &cdev->private->irb;
223 223
224 /*
225 * If the clear function had been performed, all formerly pending
226 * status at the subchannel has been cleared and we must not pass
227 * intermediate accumulated status to the device driver.
228 */
229 if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC)
230 memset(&cdev->private->irb, 0, sizeof(struct irb));
231
224 /* Copy bits which are valid only for the start function. */ 232 /* Copy bits which are valid only for the start function. */
225 if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) { 233 if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) {
226 /* Copy key. */ 234 /* Copy key. */
@@ -263,7 +271,11 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
263 cdev_irb->scsw.cpa = irb->scsw.cpa; 271 cdev_irb->scsw.cpa = irb->scsw.cpa;
264 /* Accumulate device status, but not the device busy flag. */ 272 /* Accumulate device status, but not the device busy flag. */
265 cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY; 273 cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY;
266 cdev_irb->scsw.dstat |= irb->scsw.dstat; 274 /* dstat is not always valid. */
275 if (irb->scsw.stctl &
276 (SCSW_STCTL_PRIM_STATUS | SCSW_STCTL_SEC_STATUS
277 | SCSW_STCTL_INTER_STATUS | SCSW_STCTL_ALERT_STATUS))
278 cdev_irb->scsw.dstat |= irb->scsw.dstat;
267 /* Accumulate subchannel status. */ 279 /* Accumulate subchannel status. */
268 cdev_irb->scsw.cstat |= irb->scsw.cstat; 280 cdev_irb->scsw.cstat |= irb->scsw.cstat;
269 /* Copy residual count if it is valid. */ 281 /* Copy residual count if it is valid. */
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 5b1e3ff26c0b..05fac0733f3d 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -210,9 +210,11 @@ again:
210 goto again; 210 goto again;
211 } 211 }
212 if (rc < 0) { 212 if (rc < 0) {
213 QDIO_DBF_TEXT3(1,trace,"sqberr"); 213 QDIO_DBF_TEXT3(1,trace,"sqberr");
214 sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no); 214 sprintf(dbf_text,"%2x,%2x",tmp_cnt,*cnt);
215 QDIO_DBF_TEXT3(1,trace,dbf_text); 215 QDIO_DBF_TEXT3(1,trace,dbf_text);
216 sprintf(dbf_text,"%d,%d",ccq,q_no);
217 QDIO_DBF_TEXT3(1,trace,dbf_text);
216 q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION| 218 q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION|
217 QDIO_STATUS_LOOK_FOR_ERROR, 219 QDIO_STATUS_LOOK_FOR_ERROR,
218 0, 0, 0, -1, -1, q->int_parm); 220 0, 0, 0, -1, -1, q->int_parm);
@@ -1250,7 +1252,6 @@ qdio_is_inbound_q_done(struct qdio_q *q)
1250 if (!no_used) { 1252 if (!no_used) {
1251 QDIO_DBF_TEXT4(0,trace,"inqisdnA"); 1253 QDIO_DBF_TEXT4(0,trace,"inqisdnA");
1252 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); 1254 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
1253 QDIO_DBF_TEXT4(0,trace,dbf_text);
1254 return 1; 1255 return 1;
1255 } 1256 }
1256 if (irq->is_qebsm) { 1257 if (irq->is_qebsm) {
@@ -3371,10 +3372,15 @@ qdio_do_qdio_fill_input(struct qdio_q *q, unsigned int qidx,
3371 unsigned int count, struct qdio_buffer *buffers) 3372 unsigned int count, struct qdio_buffer *buffers)
3372{ 3373{
3373 struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; 3374 struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
3375 int tmp = 0;
3376
3374 qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); 3377 qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1);
3375 if (irq->is_qebsm) { 3378 if (irq->is_qebsm) {
3376 while (count) 3379 while (count) {
3377 set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count); 3380 tmp = set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count);
3381 if (!tmp)
3382 return;
3383 }
3378 return; 3384 return;
3379 } 3385 }
3380 for (;;) { 3386 for (;;) {
@@ -3390,11 +3396,15 @@ qdio_do_qdio_fill_output(struct qdio_q *q, unsigned int qidx,
3390 unsigned int count, struct qdio_buffer *buffers) 3396 unsigned int count, struct qdio_buffer *buffers)
3391{ 3397{
3392 struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; 3398 struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
3399 int tmp = 0;
3393 3400
3394 qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); 3401 qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1);
3395 if (irq->is_qebsm) { 3402 if (irq->is_qebsm) {
3396 while (count) 3403 while (count) {
3397 set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count); 3404 tmp = set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count);
3405 if (!tmp)
3406 return;
3407 }
3398 return; 3408 return;
3399 } 3409 }
3400 3410
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index c7d1355237b6..bf37cdf43fae 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -65,6 +65,8 @@ module_param_named(poll_thread, ap_thread_flag, int, 0000);
65MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on)."); 65MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on).");
66 66
67static struct device *ap_root_device = NULL; 67static struct device *ap_root_device = NULL;
68static DEFINE_SPINLOCK(ap_device_lock);
69static LIST_HEAD(ap_device_list);
68 70
69/** 71/**
70 * Workqueue & timer for bus rescan. 72 * Workqueue & timer for bus rescan.
@@ -457,6 +459,9 @@ static int ap_device_probe(struct device *dev)
457 int rc; 459 int rc;
458 460
459 ap_dev->drv = ap_drv; 461 ap_dev->drv = ap_drv;
462 spin_lock_bh(&ap_device_lock);
463 list_add(&ap_dev->list, &ap_device_list);
464 spin_unlock_bh(&ap_device_lock);
460 rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; 465 rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV;
461 return rc; 466 return rc;
462} 467}
@@ -497,6 +502,12 @@ static int ap_device_remove(struct device *dev)
497 ap_flush_queue(ap_dev); 502 ap_flush_queue(ap_dev);
498 if (ap_drv->remove) 503 if (ap_drv->remove)
499 ap_drv->remove(ap_dev); 504 ap_drv->remove(ap_dev);
505 spin_lock_bh(&ap_device_lock);
506 list_del_init(&ap_dev->list);
507 spin_unlock_bh(&ap_device_lock);
508 spin_lock_bh(&ap_dev->lock);
509 atomic_sub(ap_dev->queue_count, &ap_poll_requests);
510 spin_unlock_bh(&ap_dev->lock);
500 return 0; 511 return 0;
501} 512}
502 513
@@ -749,10 +760,16 @@ static void ap_scan_bus(struct work_struct *unused)
749 (void *)(unsigned long)qid, 760 (void *)(unsigned long)qid,
750 __ap_scan_bus); 761 __ap_scan_bus);
751 rc = ap_query_queue(qid, &queue_depth, &device_type); 762 rc = ap_query_queue(qid, &queue_depth, &device_type);
752 if (dev && rc) { 763 if (dev) {
753 put_device(dev); 764 ap_dev = to_ap_dev(dev);
754 device_unregister(dev); 765 spin_lock_bh(&ap_dev->lock);
755 continue; 766 if (rc || ap_dev->unregistered) {
767 spin_unlock_bh(&ap_dev->lock);
768 put_device(dev);
769 device_unregister(dev);
770 continue;
771 } else
772 spin_unlock_bh(&ap_dev->lock);
756 } 773 }
757 if (dev) { 774 if (dev) {
758 put_device(dev); 775 put_device(dev);
@@ -772,6 +789,7 @@ static void ap_scan_bus(struct work_struct *unused)
772 spin_lock_init(&ap_dev->lock); 789 spin_lock_init(&ap_dev->lock);
773 INIT_LIST_HEAD(&ap_dev->pendingq); 790 INIT_LIST_HEAD(&ap_dev->pendingq);
774 INIT_LIST_HEAD(&ap_dev->requestq); 791 INIT_LIST_HEAD(&ap_dev->requestq);
792 INIT_LIST_HEAD(&ap_dev->list);
775 if (device_type == 0) 793 if (device_type == 0)
776 ap_probe_device_type(ap_dev); 794 ap_probe_device_type(ap_dev);
777 else 795 else
@@ -852,6 +870,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
852 case AP_RESPONSE_NO_PENDING_REPLY: 870 case AP_RESPONSE_NO_PENDING_REPLY:
853 if (status.queue_empty) { 871 if (status.queue_empty) {
854 /* The card shouldn't forget requests but who knows. */ 872 /* The card shouldn't forget requests but who knows. */
873 atomic_sub(ap_dev->queue_count, &ap_poll_requests);
855 ap_dev->queue_count = 0; 874 ap_dev->queue_count = 0;
856 list_splice_init(&ap_dev->pendingq, &ap_dev->requestq); 875 list_splice_init(&ap_dev->pendingq, &ap_dev->requestq);
857 ap_dev->requestq_count += ap_dev->pendingq_count; 876 ap_dev->requestq_count += ap_dev->pendingq_count;
@@ -985,7 +1004,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
985 ap_dev->unregistered = 1; 1004 ap_dev->unregistered = 1;
986 } else { 1005 } else {
987 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); 1006 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV));
988 rc = 0; 1007 rc = -ENODEV;
989 } 1008 }
990 spin_unlock_bh(&ap_dev->lock); 1009 spin_unlock_bh(&ap_dev->lock);
991 if (rc == -ENODEV) 1010 if (rc == -ENODEV)
@@ -1033,31 +1052,29 @@ static void ap_poll_timeout(unsigned long unused)
1033 * polling until bit 2^0 of the control flags is not set. If bit 2^1 1052 * polling until bit 2^0 of the control flags is not set. If bit 2^1
1034 * of the control flags has been set arm the poll timer. 1053 * of the control flags has been set arm the poll timer.
1035 */ 1054 */
1036static int __ap_poll_all(struct device *dev, void *data) 1055static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
1037{ 1056{
1038 struct ap_device *ap_dev = to_ap_dev(dev);
1039 int rc;
1040
1041 spin_lock(&ap_dev->lock); 1057 spin_lock(&ap_dev->lock);
1042 if (!ap_dev->unregistered) { 1058 if (!ap_dev->unregistered) {
1043 rc = ap_poll_queue(to_ap_dev(dev), (unsigned long *) data); 1059 if (ap_poll_queue(ap_dev, flags))
1044 if (rc)
1045 ap_dev->unregistered = 1; 1060 ap_dev->unregistered = 1;
1046 } else 1061 }
1047 rc = 0;
1048 spin_unlock(&ap_dev->lock); 1062 spin_unlock(&ap_dev->lock);
1049 if (rc)
1050 device_unregister(&ap_dev->device);
1051 return 0; 1063 return 0;
1052} 1064}
1053 1065
1054static void ap_poll_all(unsigned long dummy) 1066static void ap_poll_all(unsigned long dummy)
1055{ 1067{
1056 unsigned long flags; 1068 unsigned long flags;
1069 struct ap_device *ap_dev;
1057 1070
1058 do { 1071 do {
1059 flags = 0; 1072 flags = 0;
1060 bus_for_each_dev(&ap_bus_type, NULL, &flags, __ap_poll_all); 1073 spin_lock(&ap_device_lock);
1074 list_for_each_entry(ap_dev, &ap_device_list, list) {
1075 __ap_poll_all(ap_dev, &flags);
1076 }
1077 spin_unlock(&ap_device_lock);
1061 } while (flags & 1); 1078 } while (flags & 1);
1062 if (flags & 2) 1079 if (flags & 2)
1063 ap_schedule_poll_timer(); 1080 ap_schedule_poll_timer();
@@ -1075,6 +1092,7 @@ static int ap_poll_thread(void *data)
1075 DECLARE_WAITQUEUE(wait, current); 1092 DECLARE_WAITQUEUE(wait, current);
1076 unsigned long flags; 1093 unsigned long flags;
1077 int requests; 1094 int requests;
1095 struct ap_device *ap_dev;
1078 1096
1079 set_user_nice(current, 19); 1097 set_user_nice(current, 19);
1080 while (1) { 1098 while (1) {
@@ -1092,10 +1110,12 @@ static int ap_poll_thread(void *data)
1092 set_current_state(TASK_RUNNING); 1110 set_current_state(TASK_RUNNING);
1093 remove_wait_queue(&ap_poll_wait, &wait); 1111 remove_wait_queue(&ap_poll_wait, &wait);
1094 1112
1095 local_bh_disable();
1096 flags = 0; 1113 flags = 0;
1097 bus_for_each_dev(&ap_bus_type, NULL, &flags, __ap_poll_all); 1114 spin_lock_bh(&ap_device_lock);
1098 local_bh_enable(); 1115 list_for_each_entry(ap_dev, &ap_device_list, list) {
1116 __ap_poll_all(ap_dev, &flags);
1117 }
1118 spin_unlock_bh(&ap_device_lock);
1099 } 1119 }
1100 set_current_state(TASK_RUNNING); 1120 set_current_state(TASK_RUNNING);
1101 remove_wait_queue(&ap_poll_wait, &wait); 1121 remove_wait_queue(&ap_poll_wait, &wait);
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
index 83b69c01cd6e..008559ea742b 100644
--- a/drivers/s390/crypto/ap_bus.h
+++ b/drivers/s390/crypto/ap_bus.h
@@ -106,6 +106,7 @@ struct ap_device {
106 struct device device; 106 struct device device;
107 struct ap_driver *drv; /* Pointer to AP device driver. */ 107 struct ap_driver *drv; /* Pointer to AP device driver. */
108 spinlock_t lock; /* Per device lock. */ 108 spinlock_t lock; /* Per device lock. */
109 struct list_head list; /* private list of all AP devices. */
109 110
110 ap_qid_t qid; /* AP queue id. */ 111 ap_qid_t qid; /* AP queue id. */
111 int queue_depth; /* AP queue depth.*/ 112 int queue_depth; /* AP queue depth.*/
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 99761391f340..e3625a47a596 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -298,14 +298,14 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex)
298 get_device(&zdev->ap_dev->device); 298 get_device(&zdev->ap_dev->device);
299 zdev->request_count++; 299 zdev->request_count++;
300 __zcrypt_decrease_preference(zdev); 300 __zcrypt_decrease_preference(zdev);
301 spin_unlock_bh(&zcrypt_device_lock);
302 if (try_module_get(zdev->ap_dev->drv->driver.owner)) { 301 if (try_module_get(zdev->ap_dev->drv->driver.owner)) {
302 spin_unlock_bh(&zcrypt_device_lock);
303 rc = zdev->ops->rsa_modexpo(zdev, mex); 303 rc = zdev->ops->rsa_modexpo(zdev, mex);
304 spin_lock_bh(&zcrypt_device_lock);
304 module_put(zdev->ap_dev->drv->driver.owner); 305 module_put(zdev->ap_dev->drv->driver.owner);
305 } 306 }
306 else 307 else
307 rc = -EAGAIN; 308 rc = -EAGAIN;
308 spin_lock_bh(&zcrypt_device_lock);
309 zdev->request_count--; 309 zdev->request_count--;
310 __zcrypt_increase_preference(zdev); 310 __zcrypt_increase_preference(zdev);
311 put_device(&zdev->ap_dev->device); 311 put_device(&zdev->ap_dev->device);
@@ -373,14 +373,14 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
373 get_device(&zdev->ap_dev->device); 373 get_device(&zdev->ap_dev->device);
374 zdev->request_count++; 374 zdev->request_count++;
375 __zcrypt_decrease_preference(zdev); 375 __zcrypt_decrease_preference(zdev);
376 spin_unlock_bh(&zcrypt_device_lock);
377 if (try_module_get(zdev->ap_dev->drv->driver.owner)) { 376 if (try_module_get(zdev->ap_dev->drv->driver.owner)) {
377 spin_unlock_bh(&zcrypt_device_lock);
378 rc = zdev->ops->rsa_modexpo_crt(zdev, crt); 378 rc = zdev->ops->rsa_modexpo_crt(zdev, crt);
379 spin_lock_bh(&zcrypt_device_lock);
379 module_put(zdev->ap_dev->drv->driver.owner); 380 module_put(zdev->ap_dev->drv->driver.owner);
380 } 381 }
381 else 382 else
382 rc = -EAGAIN; 383 rc = -EAGAIN;
383 spin_lock_bh(&zcrypt_device_lock);
384 zdev->request_count--; 384 zdev->request_count--;
385 __zcrypt_increase_preference(zdev); 385 __zcrypt_increase_preference(zdev);
386 put_device(&zdev->ap_dev->device); 386 put_device(&zdev->ap_dev->device);
@@ -408,14 +408,14 @@ static long zcrypt_send_cprb(struct ica_xcRB *xcRB)
408 get_device(&zdev->ap_dev->device); 408 get_device(&zdev->ap_dev->device);
409 zdev->request_count++; 409 zdev->request_count++;
410 __zcrypt_decrease_preference(zdev); 410 __zcrypt_decrease_preference(zdev);
411 spin_unlock_bh(&zcrypt_device_lock);
412 if (try_module_get(zdev->ap_dev->drv->driver.owner)) { 411 if (try_module_get(zdev->ap_dev->drv->driver.owner)) {
412 spin_unlock_bh(&zcrypt_device_lock);
413 rc = zdev->ops->send_cprb(zdev, xcRB); 413 rc = zdev->ops->send_cprb(zdev, xcRB);
414 spin_lock_bh(&zcrypt_device_lock);
414 module_put(zdev->ap_dev->drv->driver.owner); 415 module_put(zdev->ap_dev->drv->driver.owner);
415 } 416 }
416 else 417 else
417 rc = -EAGAIN; 418 rc = -EAGAIN;
418 spin_lock_bh(&zcrypt_device_lock);
419 zdev->request_count--; 419 zdev->request_count--;
420 __zcrypt_increase_preference(zdev); 420 __zcrypt_increase_preference(zdev);
421 put_device(&zdev->ap_dev->device); 421 put_device(&zdev->ap_dev->device);
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index e95c281f1e36..84b108d7c7fd 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -873,7 +873,7 @@ qeth_realloc_headroom(struct qeth_card *card, struct sk_buff *skb, int size)
873} 873}
874 874
875static inline struct sk_buff * 875static inline struct sk_buff *
876qeth_pskb_unshare(struct sk_buff *skb, int pri) 876qeth_pskb_unshare(struct sk_buff *skb, gfp_t pri)
877{ 877{
878 struct sk_buff *nskb; 878 struct sk_buff *nskb;
879 if (!skb_cloned(skb)) 879 if (!skb_cloned(skb))
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 8c81cec85298..60446b88f721 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -3091,6 +3091,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
3091 cmdp->u.raw64.direction = 3091 cmdp->u.raw64.direction =
3092 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; 3092 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
3093 memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); 3093 memcpy(cmdp->u.raw64.cmd,scp->cmnd,16);
3094 cmdp->u.raw64.sg_ranz = 0;
3094 } else { 3095 } else {
3095 cmdp->u.raw.reserved = 0; 3096 cmdp->u.raw.reserved = 0;
3096 cmdp->u.raw.mdisc_time = 0; 3097 cmdp->u.raw.mdisc_time = 0;
@@ -3107,6 +3108,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
3107 cmdp->u.raw.direction = 3108 cmdp->u.raw.direction =
3108 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; 3109 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
3109 memcpy(cmdp->u.raw.cmd,scp->cmnd,12); 3110 memcpy(cmdp->u.raw.cmd,scp->cmnd,12);
3111 cmdp->u.raw.sg_ranz = 0;
3110 } 3112 }
3111 3113
3112 if (scp->use_sg) { 3114 if (scp->use_sg) {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 9d014e5a81c4..057fd7e0e379 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1817,10 +1817,9 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
1817 struct lpfc_sli *psli = &phba->sli; 1817 struct lpfc_sli *psli = &phba->sli;
1818 struct lpfc_sli_ring *pring; 1818 struct lpfc_sli_ring *pring;
1819 1819
1820 if (state == pci_channel_io_perm_failure) { 1820 if (state == pci_channel_io_perm_failure)
1821 lpfc_pci_remove_one(pdev);
1822 return PCI_ERS_RESULT_DISCONNECT; 1821 return PCI_ERS_RESULT_DISCONNECT;
1823 } 1822
1824 pci_disable_device(pdev); 1823 pci_disable_device(pdev);
1825 /* 1824 /*
1826 * There may be I/Os dropped by the firmware. 1825 * There may be I/Os dropped by the firmware.
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index b8edcf5b5451..918bb6019540 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -716,7 +716,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
716 */ 716 */
717 if (copy_sense) { 717 if (copy_sense) {
718 if (!SCSI_SENSE_VALID(scmd)) { 718 if (!SCSI_SENSE_VALID(scmd)) {
719 memcpy(scmd->sense_buffer, scmd->request_buffer, 719 memcpy(scmd->sense_buffer, page_address(sgl.page),
720 sizeof(scmd->sense_buffer)); 720 sizeof(scmd->sense_buffer));
721 } 721 }
722 __free_page(sgl.page); 722 __free_page(sgl.page);
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index c275dcac3f18..939de0de18bc 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -452,10 +452,22 @@ store_rescan_field (struct device *dev, struct device_attribute *attr, const cha
452} 452}
453static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); 453static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
454 454
455static void sdev_store_delete_callback(struct device *dev)
456{
457 scsi_remove_device(to_scsi_device(dev));
458}
459
455static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, 460static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf,
456 size_t count) 461 size_t count)
457{ 462{
458 scsi_remove_device(to_scsi_device(dev)); 463 int rc;
464
465 /* An attribute cannot be unregistered by one of its own methods,
466 * so we have to use this roundabout approach.
467 */
468 rc = device_schedule_callback(dev, sdev_store_delete_callback);
469 if (rc)
470 count = rc;
459 return count; 471 return count;
460}; 472};
461static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); 473static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index cde5db44abf6..301c8c0be9d7 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -340,6 +340,9 @@ static const struct pnp_device_id pnp_dev_table[] = {
340 { "FUJ02B8", 0 }, 340 { "FUJ02B8", 0 },
341 { "FUJ02B9", 0 }, 341 { "FUJ02B9", 0 },
342 { "FUJ02BC", 0 }, 342 { "FUJ02BC", 0 },
343 /* Fujitsu Wacom Tablet PC devices */
344 { "FUJ02E5", 0 },
345 { "FUJ02E6", 0 },
343 /* Rockwell's (PORALiNK) 33600 INT PNP */ 346 /* Rockwell's (PORALiNK) 33600 INT PNP */
344 { "WCI0003", 0 }, 347 { "WCI0003", 0 },
345 /* Unkown PnP modems */ 348 /* Unkown PnP modems */
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index c53b69610a51..46c40bbc4bc6 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -17,6 +17,9 @@
17 * License. See the file "COPYING" in the main directory of this archive 17 * License. See the file "COPYING" in the main directory of this archive
18 * for more details. 18 * for more details.
19 */ 19 */
20#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
21#define SUPPORT_SYSRQ
22#endif
20 23
21#undef DEBUG 24#undef DEBUG
22 25
@@ -49,11 +52,6 @@
49#endif 52#endif
50 53
51#include <asm/sci.h> 54#include <asm/sci.h>
52
53#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
54#define SUPPORT_SYSRQ
55#endif
56
57#include "sh-sci.h" 55#include "sh-sci.h"
58 56
59struct sci_port { 57struct sci_port {
@@ -645,6 +643,9 @@ static inline int sci_handle_breaks(struct uart_port *port)
645 struct tty_struct *tty = port->info->tty; 643 struct tty_struct *tty = port->info->tty;
646 struct sci_port *s = &sci_ports[port->line]; 644 struct sci_port *s = &sci_ports[port->line];
647 645
646 if (uart_handle_break(port))
647 return 0;
648
648 if (!s->break_flag && status & SCxSR_BRK(port)) { 649 if (!s->break_flag && status & SCxSR_BRK(port)) {
649#if defined(CONFIG_CPU_SH3) 650#if defined(CONFIG_CPU_SH3)
650 /* Debounce break */ 651 /* Debounce break */
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index 253ceb895ca7..a27e9e92cb5e 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -636,25 +636,6 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id)
636} 636}
637 637
638/** 638/**
639 * sn_sal_connect_interrupt - Request interrupt, handled by sn_sal_interrupt
640 * @port: Our sn_cons_port (which contains the uart port)
641 *
642 * returns the console irq if interrupt is successfully registered, else 0
643 *
644 */
645static int sn_sal_connect_interrupt(struct sn_cons_port *port)
646{
647 if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
648 IRQF_DISABLED | IRQF_SHARED,
649 "SAL console driver", port) >= 0) {
650 return SGI_UART_VECTOR;
651 }
652
653 printk(KERN_INFO "sn_console: console proceeding in polled mode\n");
654 return 0;
655}
656
657/**
658 * sn_sal_timer_poll - this function handles polled console mode 639 * sn_sal_timer_poll - this function handles polled console mode
659 * @data: A pointer to our sn_cons_port (which contains the uart port) 640 * @data: A pointer to our sn_cons_port (which contains the uart port)
660 * 641 *
@@ -746,30 +727,31 @@ static void __init sn_sal_switch_to_asynch(struct sn_cons_port *port)
746 * mode. We were previously in asynch/polling mode (using init_timer). 727 * mode. We were previously in asynch/polling mode (using init_timer).
747 * 728 *
748 * We attempt to switch to interrupt mode here by calling 729 * We attempt to switch to interrupt mode here by calling
749 * sn_sal_connect_interrupt. If that works out, we enable receive interrupts. 730 * request_irq. If that works out, we enable receive interrupts.
750 */ 731 */
751static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port) 732static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port)
752{ 733{
753 int irq;
754 unsigned long flags; 734 unsigned long flags;
755 735
756 if (!port) 736 if (port) {
757 return; 737 DPRINTF("sn_console: switching to interrupt driven console\n");
758
759 DPRINTF("sn_console: switching to interrupt driven console\n");
760
761 spin_lock_irqsave(&port->sc_port.lock, flags);
762 738
763 irq = sn_sal_connect_interrupt(port); 739 if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
740 IRQF_DISABLED | IRQF_SHARED,
741 "SAL console driver", port) >= 0) {
742 spin_lock_irqsave(&port->sc_port.lock, flags);
743 port->sc_port.irq = SGI_UART_VECTOR;
744 port->sc_ops = &intr_ops;
764 745
765 if (irq) { 746 /* turn on receive interrupts */
766 port->sc_port.irq = irq; 747 ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV);
767 port->sc_ops = &intr_ops; 748 spin_unlock_irqrestore(&port->sc_port.lock, flags);
768 749 }
769 /* turn on receive interrupts */ 750 else {
770 ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV); 751 printk(KERN_INFO
752 "sn_console: console proceeding in polled mode\n");
753 }
771 } 754 }
772 spin_unlock_irqrestore(&port->sc_port.lock, flags);
773} 755}
774 756
775/* 757/*
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c
index 48e4f48e779f..8efa07e8b8c2 100644
--- a/drivers/spi/at25.c
+++ b/drivers/spi/at25.c
@@ -291,7 +291,7 @@ static int at25_probe(struct spi_device *spi)
291 */ 291 */
292 sr = spi_w8r8(spi, AT25_RDSR); 292 sr = spi_w8r8(spi, AT25_RDSR);
293 if (sr < 0 || sr & AT25_SR_nRDY) { 293 if (sr < 0 || sr & AT25_SR_nRDY) {
294 dev_dbg(&at25->spi->dev, "rdsr --> %d (%02x)\n", sr, sr); 294 dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr);
295 err = -ENXIO; 295 err = -ENXIO;
296 goto fail; 296 goto fail;
297 } 297 }
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 6fa260d1a9be..66e7bc985797 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -425,7 +425,7 @@ static int atmel_spi_setup(struct spi_device *spi)
425 if (ret) 425 if (ret)
426 return ret; 426 return ret;
427 spi->controller_state = (void *)npcs_pin; 427 spi->controller_state = (void *)npcs_pin;
428 gpio_direction_output(npcs_pin); 428 gpio_direction_output(npcs_pin, !(spi->mode & SPI_CS_HIGH));
429 } 429 }
430 430
431 dev_dbg(&spi->dev, 431 dev_dbg(&spi->dev,
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2328128728be..6657331eed93 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -189,8 +189,8 @@ static DECLARE_MUTEX(board_lock);
189 * this is exported so that for example a USB or parport based adapter 189 * this is exported so that for example a USB or parport based adapter
190 * driver could add devices (which it would learn about out-of-band). 190 * driver could add devices (which it would learn about out-of-band).
191 */ 191 */
192struct spi_device *__init_or_module 192struct spi_device *spi_new_device(struct spi_master *master,
193spi_new_device(struct spi_master *master, struct spi_board_info *chip) 193 struct spi_board_info *chip)
194{ 194{
195 struct spi_device *proxy; 195 struct spi_device *proxy;
196 struct device *dev = master->cdev.dev; 196 struct device *dev = master->cdev.dev;
@@ -352,8 +352,7 @@ static struct class spi_master_class = {
352 * the master's methods before calling spi_register_master(); and (after errors 352 * the master's methods before calling spi_register_master(); and (after errors
353 * adding the device) calling spi_master_put() to prevent a memory leak. 353 * adding the device) calling spi_master_put() to prevent a memory leak.
354 */ 354 */
355struct spi_master * __init_or_module 355struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
356spi_alloc_master(struct device *dev, unsigned size)
357{ 356{
358 struct spi_master *master; 357 struct spi_master *master;
359 358
@@ -392,8 +391,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
392 * After a successful return, the caller is responsible for calling 391 * After a successful return, the caller is responsible for calling
393 * spi_unregister_master(). 392 * spi_unregister_master().
394 */ 393 */
395int __init_or_module 394int spi_register_master(struct spi_master *master)
396spi_register_master(struct spi_master *master)
397{ 395{
398 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); 396 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
399 struct device *dev = master->cdev.dev; 397 struct device *dev = master->cdev.dev;
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 24a330d82395..88425e1af4d3 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -302,10 +302,6 @@ static void bitbang_work(struct work_struct *work)
302 setup_transfer = NULL; 302 setup_transfer = NULL;
303 303
304 list_for_each_entry (t, &m->transfers, transfer_list) { 304 list_for_each_entry (t, &m->transfers, transfer_list) {
305 if (bitbang->shutdown) {
306 status = -ESHUTDOWN;
307 break;
308 }
309 305
310 /* override or restore speed and wordsize */ 306 /* override or restore speed and wordsize */
311 if (t->speed_hz || t->bits_per_word) { 307 if (t->speed_hz || t->bits_per_word) {
@@ -410,8 +406,6 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
410 m->status = -EINPROGRESS; 406 m->status = -EINPROGRESS;
411 407
412 bitbang = spi_master_get_devdata(spi->master); 408 bitbang = spi_master_get_devdata(spi->master);
413 if (bitbang->shutdown)
414 return -ESHUTDOWN;
415 409
416 spin_lock_irqsave(&bitbang->lock, flags); 410 spin_lock_irqsave(&bitbang->lock, flags);
417 if (!spi->max_speed_hz) 411 if (!spi->max_speed_hz)
@@ -507,28 +501,12 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start);
507 */ 501 */
508int spi_bitbang_stop(struct spi_bitbang *bitbang) 502int spi_bitbang_stop(struct spi_bitbang *bitbang)
509{ 503{
510 unsigned limit = 500; 504 spi_unregister_master(bitbang->master);
511
512 spin_lock_irq(&bitbang->lock);
513 bitbang->shutdown = 0;
514 while (!list_empty(&bitbang->queue) && limit--) {
515 spin_unlock_irq(&bitbang->lock);
516 505
517 dev_dbg(bitbang->master->cdev.dev, "wait for queue\n"); 506 WARN_ON(!list_empty(&bitbang->queue));
518 msleep(10);
519
520 spin_lock_irq(&bitbang->lock);
521 }
522 spin_unlock_irq(&bitbang->lock);
523 if (!list_empty(&bitbang->queue)) {
524 dev_err(bitbang->master->cdev.dev, "queue didn't empty\n");
525 return -EBUSY;
526 }
527 507
528 destroy_workqueue(bitbang->workqueue); 508 destroy_workqueue(bitbang->workqueue);
529 509
530 spi_unregister_master(bitbang->master);
531
532 return 0; 510 return 0;
533} 511}
534EXPORT_SYMBOL_GPL(spi_bitbang_stop); 512EXPORT_SYMBOL_GPL(spi_bitbang_stop);
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 651379c51ae6..220abce63e4a 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -41,7 +41,7 @@ struct s3c24xx_spi {
41 int len; 41 int len;
42 int count; 42 int count;
43 43
44 int (*set_cs)(struct s3c2410_spi_info *spi, 44 void (*set_cs)(struct s3c2410_spi_info *spi,
45 int cs, int pol); 45 int cs, int pol);
46 46
47 /* data buffers */ 47 /* data buffers */
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 3d72aa5cfc71..3524e3fc08b9 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -70,7 +70,6 @@
70#include <asm/dec/machtype.h> 70#include <asm/dec/machtype.h>
71#include <asm/dec/serial.h> 71#include <asm/dec/serial.h>
72#include <asm/dec/system.h> 72#include <asm/dec/system.h>
73#include <asm/dec/tc.h>
74 73
75#ifdef CONFIG_KGDB 74#ifdef CONFIG_KGDB
76#include <asm/kgdb.h> 75#include <asm/kgdb.h>
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d38a25f36ea5..31ae661e586a 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -332,9 +332,9 @@ static void acm_rx_tasklet(unsigned long _acm)
332 if (!ACM_READY(acm)) 332 if (!ACM_READY(acm))
333 return; 333 return;
334 334
335 spin_lock(&acm->throttle_lock); 335 spin_lock_irqsave(&acm->throttle_lock, flags);
336 throttled = acm->throttle; 336 throttled = acm->throttle;
337 spin_unlock(&acm->throttle_lock); 337 spin_unlock_irqrestore(&acm->throttle_lock, flags);
338 if (throttled) 338 if (throttled)
339 return; 339 return;
340 340
@@ -352,9 +352,9 @@ next_buffer:
352 dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); 352 dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);
353 353
354 tty_buffer_request_room(tty, buf->size); 354 tty_buffer_request_room(tty, buf->size);
355 spin_lock(&acm->throttle_lock); 355 spin_lock_irqsave(&acm->throttle_lock, flags);
356 throttled = acm->throttle; 356 throttled = acm->throttle;
357 spin_unlock(&acm->throttle_lock); 357 spin_unlock_irqrestore(&acm->throttle_lock, flags);
358 if (!throttled) 358 if (!throttled)
359 tty_insert_flip_string(tty, buf->base, buf->size); 359 tty_insert_flip_string(tty, buf->base, buf->size);
360 tty_flip_buffer_push(tty); 360 tty_flip_buffer_push(tty);
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 63e50a1f1396..6584cf00f7f3 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -202,6 +202,7 @@ struct quirk_printer_struct {
202 202
203#define USBLP_QUIRK_BIDIR 0x1 /* reports bidir but requires unidirectional mode (no INs/reads) */ 203#define USBLP_QUIRK_BIDIR 0x1 /* reports bidir but requires unidirectional mode (no INs/reads) */
204#define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */ 204#define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */
205#define USBLP_QUIRK_BAD_CLASS 0x4 /* descriptor uses vendor-specific Class or SubClass */
205 206
206static const struct quirk_printer_struct quirk_printers[] = { 207static const struct quirk_printer_struct quirk_printers[] = {
207 { 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */ 208 { 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */
@@ -218,6 +219,7 @@ static const struct quirk_printer_struct quirk_printers[] = {
218 { 0x0409, 0xf0be, USBLP_QUIRK_BIDIR }, /* NEC Picty920 (HP OEM) */ 219 { 0x0409, 0xf0be, USBLP_QUIRK_BIDIR }, /* NEC Picty920 (HP OEM) */
219 { 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) */ 220 { 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) */
220 { 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /* Kyocera Mita FS 820, by zut <kernel@zut.de> */ 221 { 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /* Kyocera Mita FS 820, by zut <kernel@zut.de> */
222 { 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /* Seiko Epson Receipt Printer M129C */
221 { 0, 0 } 223 { 0, 0 }
222}; 224};
223 225
@@ -1048,7 +1050,8 @@ static int usblp_select_alts(struct usblp *usblp)
1048 ifd = &if_alt->altsetting[i]; 1050 ifd = &if_alt->altsetting[i];
1049 1051
1050 if (ifd->desc.bInterfaceClass != 7 || ifd->desc.bInterfaceSubClass != 1) 1052 if (ifd->desc.bInterfaceClass != 7 || ifd->desc.bInterfaceSubClass != 1)
1051 continue; 1053 if (!(usblp->quirks & USBLP_QUIRK_BAD_CLASS))
1054 continue;
1052 1055
1053 if (ifd->desc.bInterfaceProtocol < USBLP_FIRST_PROTOCOL || 1056 if (ifd->desc.bInterfaceProtocol < USBLP_FIRST_PROTOCOL ||
1054 ifd->desc.bInterfaceProtocol > USBLP_LAST_PROTOCOL) 1057 ifd->desc.bInterfaceProtocol > USBLP_LAST_PROTOCOL)
@@ -1232,6 +1235,7 @@ static struct usb_device_id usblp_ids [] = {
1232 { USB_INTERFACE_INFO(7, 1, 1) }, 1235 { USB_INTERFACE_INFO(7, 1, 1) },
1233 { USB_INTERFACE_INFO(7, 1, 2) }, 1236 { USB_INTERFACE_INFO(7, 1, 2) },
1234 { USB_INTERFACE_INFO(7, 1, 3) }, 1237 { USB_INTERFACE_INFO(7, 1, 3) },
1238 { USB_DEVICE(0x04b8, 0x0202) }, /* Seiko Epson Receipt Printer M129C */
1235 { } /* Terminating entry */ 1239 { } /* Terminating entry */
1236}; 1240};
1237 1241
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 274f14f1633e..36e7a843bf91 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -912,7 +912,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
912 struct async *as; 912 struct async *as;
913 struct usb_ctrlrequest *dr = NULL; 913 struct usb_ctrlrequest *dr = NULL;
914 unsigned int u, totlen, isofrmlen; 914 unsigned int u, totlen, isofrmlen;
915 int ret, interval = 0, ifnum = -1; 915 int ret, ifnum = -1;
916 916
917 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| 917 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK|
918 URB_NO_FSBR|URB_ZERO_PACKET)) 918 URB_NO_FSBR|URB_ZERO_PACKET))
@@ -992,7 +992,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
992 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 992 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
993 != USB_ENDPOINT_XFER_ISOC) 993 != USB_ENDPOINT_XFER_ISOC)
994 return -EINVAL; 994 return -EINVAL;
995 interval = 1 << min (15, ep->desc.bInterval - 1);
996 isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets; 995 isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets;
997 if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) 996 if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
998 return -ENOMEM; 997 return -ENOMEM;
@@ -1021,10 +1020,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1021 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 1020 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
1022 != USB_ENDPOINT_XFER_INT) 1021 != USB_ENDPOINT_XFER_INT)
1023 return -EINVAL; 1022 return -EINVAL;
1024 if (ps->dev->speed == USB_SPEED_HIGH)
1025 interval = 1 << min (15, ep->desc.bInterval - 1);
1026 else
1027 interval = ep->desc.bInterval;
1028 if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) 1023 if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
1029 return -EINVAL; 1024 return -EINVAL;
1030 if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) 1025 if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))
@@ -1053,7 +1048,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1053 as->urb->setup_packet = (unsigned char*)dr; 1048 as->urb->setup_packet = (unsigned char*)dr;
1054 as->urb->start_frame = uurb->start_frame; 1049 as->urb->start_frame = uurb->start_frame;
1055 as->urb->number_of_packets = uurb->number_of_packets; 1050 as->urb->number_of_packets = uurb->number_of_packets;
1056 as->urb->interval = interval; 1051 if (uurb->type == USBDEVFS_URB_TYPE_ISO ||
1052 ps->dev->speed == USB_SPEED_HIGH)
1053 as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);
1054 else
1055 as->urb->interval = ep->desc.bInterval;
1057 as->urb->context = as; 1056 as->urb->context = as;
1058 as->urb->complete = async_completed; 1057 as->urb->complete = async_completed;
1059 for (totlen = u = 0; u < uurb->number_of_packets; u++) { 1058 for (totlen = u = 0; u < uurb->number_of_packets; u++) {
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 41400743ce2c..b89a98e61323 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1281,12 +1281,6 @@ int usb_new_device(struct usb_device *udev)
1281{ 1281{
1282 int err; 1282 int err;
1283 1283
1284 /* Lock ourself into memory in order to keep a probe sequence
1285 * sleeping in a new thread from allowing us to be unloaded.
1286 */
1287 if (!try_module_get(THIS_MODULE))
1288 return -EINVAL;
1289
1290 /* Determine quirks */ 1284 /* Determine quirks */
1291 usb_detect_quirks(udev); 1285 usb_detect_quirks(udev);
1292 1286
@@ -1390,7 +1384,6 @@ int usb_new_device(struct usb_device *udev)
1390 usb_autoresume_device(udev->parent); 1384 usb_autoresume_device(udev->parent);
1391 1385
1392exit: 1386exit:
1393 module_put(THIS_MODULE);
1394 return err; 1387 return err;
1395 1388
1396fail: 1389fail:
@@ -2443,7 +2436,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2443 2436
2444 if (portchange & USB_PORT_STAT_C_CONNECTION) { 2437 if (portchange & USB_PORT_STAT_C_CONNECTION) {
2445 status = hub_port_debounce(hub, port1); 2438 status = hub_port_debounce(hub, port1);
2446 if (status < 0) { 2439 if (status < 0 && printk_ratelimit()) {
2447 dev_err (hub_dev, 2440 dev_err (hub_dev,
2448 "connect-debounce failed, port %d disabled\n", 2441 "connect-debounce failed, port %d disabled\n",
2449 port1); 2442 port1);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 2f17468b5c1e..217a3d6d0a06 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -221,10 +221,15 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
221 221
222 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 222 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
223 USB_ENDPOINT_XFER_INT) { 223 USB_ENDPOINT_XFER_INT) {
224 int interval;
225
226 if (usb_dev->speed == USB_SPEED_HIGH)
227 interval = 1 << min(15, ep->desc.bInterval - 1);
228 else
229 interval = ep->desc.bInterval;
224 pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); 230 pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30);
225 usb_fill_int_urb(urb, usb_dev, pipe, data, len, 231 usb_fill_int_urb(urb, usb_dev, pipe, data, len,
226 usb_api_blocking_completion, NULL, 232 usb_api_blocking_completion, NULL, interval);
227 ep->desc.bInterval);
228 } else 233 } else
229 usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, 234 usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
230 usb_api_blocking_completion, NULL); 235 usb_api_blocking_completion, NULL);
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 0e5c646cb4f6..f08ec85a6d64 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,7 +30,8 @@
30static const struct usb_device_id usb_quirk_list[] = { 30static const struct usb_device_id usb_quirk_list[] = {
31 /* HP 5300/5370C scanner */ 31 /* HP 5300/5370C scanner */
32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, 32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
33 33 /* Seiko Epson Corp - Perfection 1670 */
34 { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
34 /* Elsa MicroLink 56k (V.250) */ 35 /* Elsa MicroLink 56k (V.250) */
35 { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 36 { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
36 37
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index a4677802fb20..2a6e3163d944 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1835,7 +1835,7 @@ static int at91udc_resume(struct platform_device *pdev)
1835#define at91udc_resume NULL 1835#define at91udc_resume NULL
1836#endif 1836#endif
1837 1837
1838static struct platform_driver at91_udc = { 1838static struct platform_driver at91_udc_driver = {
1839 .remove = __exit_p(at91udc_remove), 1839 .remove = __exit_p(at91udc_remove),
1840 .shutdown = at91udc_shutdown, 1840 .shutdown = at91udc_shutdown,
1841 .suspend = at91udc_suspend, 1841 .suspend = at91udc_suspend,
@@ -1848,13 +1848,13 @@ static struct platform_driver at91_udc = {
1848 1848
1849static int __init udc_init_module(void) 1849static int __init udc_init_module(void)
1850{ 1850{
1851 return platform_driver_probe(&at91_udc, at91udc_probe); 1851 return platform_driver_probe(&at91_udc_driver, at91udc_probe);
1852} 1852}
1853module_init(udc_init_module); 1853module_init(udc_init_module);
1854 1854
1855static void __exit udc_exit_module(void) 1855static void __exit udc_exit_module(void)
1856{ 1856{
1857 platform_driver_unregister(&at91_udc); 1857 platform_driver_unregister(&at91_udc_driver);
1858} 1858}
1859module_exit(udc_exit_module); 1859module_exit(udc_exit_module);
1860 1860
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 7b3a326b57ab..65c91d3735de 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req)
297 297
298/*-------------------------------------------------------------------------*/ 298/*-------------------------------------------------------------------------*/
299 299
300#undef USE_KMALLOC
301
302/* many common platforms have dma-coherent caches, which means that it's
303 * safe to use kmalloc() memory for all i/o buffers without using any
304 * cache flushing calls. (unless you're trying to share cache lines
305 * between dma and non-dma activities, which is a slow idea in any case.)
306 *
307 * other platforms need more care, with 2.6 having a moderately general
308 * solution except for the common "buffer is smaller than a page" case.
309 */
310#if defined(CONFIG_X86)
311#define USE_KMALLOC
312
313#elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT)
314#define USE_KMALLOC
315
316#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
317#define USE_KMALLOC
318
319#endif
320
321/* allocating buffers this way eliminates dma mapping overhead, which 300/* allocating buffers this way eliminates dma mapping overhead, which
322 * on some platforms will mean eliminating a per-io buffer copy. with 301 * on some platforms will mean eliminating a per-io buffer copy. with
323 * some kinds of system caches, further tweaks may still be needed. 302 * some kinds of system caches, further tweaks may still be needed.
@@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
334 return NULL; 313 return NULL;
335 *dma = DMA_ADDR_INVALID; 314 *dma = DMA_ADDR_INVALID;
336 315
337#if defined(USE_KMALLOC)
338 retval = kmalloc(bytes, gfp_flags);
339 if (retval)
340 *dma = virt_to_phys(retval);
341#else
342 if (ep->dma) { 316 if (ep->dma) {
343 /* the main problem with this call is that it wastes memory 317 /* the main problem with this call is that it wastes memory
344 * on typical 1/N page allocations: it allocates 1-N pages. 318 * on typical 1/N page allocations: it allocates 1-N pages.
@@ -348,7 +322,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
348 bytes, dma, gfp_flags); 322 bytes, dma, gfp_flags);
349 } else 323 } else
350 retval = kmalloc(bytes, gfp_flags); 324 retval = kmalloc(bytes, gfp_flags);
351#endif
352 return retval; 325 return retval;
353} 326}
354 327
@@ -356,7 +329,6 @@ static void
356goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) 329goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
357{ 330{
358 /* free memory into the right allocator */ 331 /* free memory into the right allocator */
359#ifndef USE_KMALLOC
360 if (dma != DMA_ADDR_INVALID) { 332 if (dma != DMA_ADDR_INVALID) {
361 struct goku_ep *ep; 333 struct goku_ep *ep;
362 334
@@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
365 return; 337 return;
366 dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); 338 dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma);
367 } else 339 } else
368#endif
369 kfree (buf); 340 kfree (buf);
370} 341}
371 342
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 8f9a2b615422..b394e63894d2 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -296,6 +296,15 @@ omap_free_request(struct usb_ep *ep, struct usb_request *_req)
296 296
297/*-------------------------------------------------------------------------*/ 297/*-------------------------------------------------------------------------*/
298 298
299/*
300 * dma-coherent memory allocation (for dma-capable endpoints)
301 *
302 * NOTE: the dma_*_coherent() API calls suck. Most implementations are
303 * (a) page-oriented, so small buffers lose big; and (b) asymmetric with
304 * respect to calls with irqs disabled: alloc is safe, free is not.
305 * We currently work around (b), but not (a).
306 */
307
299static void * 308static void *
300omap_alloc_buffer( 309omap_alloc_buffer(
301 struct usb_ep *_ep, 310 struct usb_ep *_ep,
@@ -307,6 +316,9 @@ omap_alloc_buffer(
307 void *retval; 316 void *retval;
308 struct omap_ep *ep; 317 struct omap_ep *ep;
309 318
319 if (!_ep)
320 return NULL;
321
310 ep = container_of(_ep, struct omap_ep, ep); 322 ep = container_of(_ep, struct omap_ep, ep);
311 if (use_dma && ep->has_dma) { 323 if (use_dma && ep->has_dma) {
312 static int warned; 324 static int warned;
@@ -326,6 +338,35 @@ omap_alloc_buffer(
326 return retval; 338 return retval;
327} 339}
328 340
341static DEFINE_SPINLOCK(buflock);
342static LIST_HEAD(buffers);
343
344struct free_record {
345 struct list_head list;
346 struct device *dev;
347 unsigned bytes;
348 dma_addr_t dma;
349};
350
351static void do_free(unsigned long ignored)
352{
353 spin_lock_irq(&buflock);
354 while (!list_empty(&buffers)) {
355 struct free_record *buf;
356
357 buf = list_entry(buffers.next, struct free_record, list);
358 list_del(&buf->list);
359 spin_unlock_irq(&buflock);
360
361 dma_free_coherent(buf->dev, buf->bytes, buf, buf->dma);
362
363 spin_lock_irq(&buflock);
364 }
365 spin_unlock_irq(&buflock);
366}
367
368static DECLARE_TASKLET(deferred_free, do_free, 0);
369
329static void omap_free_buffer( 370static void omap_free_buffer(
330 struct usb_ep *_ep, 371 struct usb_ep *_ep,
331 void *buf, 372 void *buf,
@@ -333,13 +374,29 @@ static void omap_free_buffer(
333 unsigned bytes 374 unsigned bytes
334) 375)
335{ 376{
336 struct omap_ep *ep; 377 if (!_ep) {
378 WARN_ON(1);
379 return;
380 }
337 381
338 ep = container_of(_ep, struct omap_ep, ep); 382 /* free memory into the right allocator */
339 if (use_dma && _ep && ep->has_dma) 383 if (dma != DMA_ADDR_INVALID) {
340 dma_free_coherent(ep->udc->gadget.dev.parent, bytes, buf, dma); 384 struct omap_ep *ep;
341 else 385 struct free_record *rec = buf;
342 kfree (buf); 386 unsigned long flags;
387
388 ep = container_of(_ep, struct omap_ep, ep);
389
390 rec->dev = ep->udc->gadget.dev.parent;
391 rec->bytes = bytes;
392 rec->dma = dma;
393
394 spin_lock_irqsave(&buflock, flags);
395 list_add_tail(&rec->list, &buffers);
396 tasklet_schedule(&deferred_free);
397 spin_unlock_irqrestore(&buflock, flags);
398 } else
399 kfree(buf);
343} 400}
344 401
345/*-------------------------------------------------------------------------*/ 402/*-------------------------------------------------------------------------*/
@@ -1691,12 +1748,38 @@ ep0out_status_stage:
1691 udc->ep0_pending = 0; 1748 udc->ep0_pending = 0;
1692 break; 1749 break;
1693 case USB_REQ_GET_STATUS: 1750 case USB_REQ_GET_STATUS:
1751 /* USB_ENDPOINT_HALT status? */
1752 if (u.r.bRequestType != (USB_DIR_IN|USB_RECIP_ENDPOINT))
1753 goto intf_status;
1754
1755 /* ep0 never stalls */
1756 if (!(w_index & 0xf))
1757 goto zero_status;
1758
1759 /* only active endpoints count */
1760 ep = &udc->ep[w_index & 0xf];
1761 if (w_index & USB_DIR_IN)
1762 ep += 16;
1763 if (!ep->desc)
1764 goto do_stall;
1765
1766 /* iso never stalls */
1767 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC)
1768 goto zero_status;
1769
1770 /* FIXME don't assume non-halted endpoints!! */
1771 ERR("%s status, can't report\n", ep->ep.name);
1772 goto do_stall;
1773
1774intf_status:
1694 /* return interface status. if we were pedantic, 1775 /* return interface status. if we were pedantic,
1695 * we'd detect non-existent interfaces, and stall. 1776 * we'd detect non-existent interfaces, and stall.
1696 */ 1777 */
1697 if (u.r.bRequestType 1778 if (u.r.bRequestType
1698 != (USB_DIR_IN|USB_RECIP_INTERFACE)) 1779 != (USB_DIR_IN|USB_RECIP_INTERFACE))
1699 goto delegate; 1780 goto delegate;
1781
1782zero_status:
1700 /* return two zero bytes */ 1783 /* return two zero bytes */
1701 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1784 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR;
1702 UDC_DATA_REG = 0; 1785 UDC_DATA_REG = 0;
@@ -2068,7 +2151,7 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev)
2068 2151
2069/*-------------------------------------------------------------------------*/ 2152/*-------------------------------------------------------------------------*/
2070 2153
2071static inline int machine_needs_vbus_session(void) 2154static inline int machine_without_vbus_sense(void)
2072{ 2155{
2073 return (machine_is_omap_innovator() 2156 return (machine_is_omap_innovator()
2074 || machine_is_omap_osk() 2157 || machine_is_omap_osk()
@@ -2156,7 +2239,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2156 /* boards that don't have VBUS sensing can't autogate 48MHz; 2239 /* boards that don't have VBUS sensing can't autogate 48MHz;
2157 * can't enter deep sleep while a gadget driver is active. 2240 * can't enter deep sleep while a gadget driver is active.
2158 */ 2241 */
2159 if (machine_needs_vbus_session()) 2242 if (machine_without_vbus_sense())
2160 omap_vbus_session(&udc->gadget, 1); 2243 omap_vbus_session(&udc->gadget, 1);
2161 2244
2162done: 2245done:
@@ -2179,7 +2262,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
2179 if (udc->dc_clk != NULL) 2262 if (udc->dc_clk != NULL)
2180 omap_udc_enable_clock(1); 2263 omap_udc_enable_clock(1);
2181 2264
2182 if (machine_needs_vbus_session()) 2265 if (machine_without_vbus_sense())
2183 omap_vbus_session(&udc->gadget, 0); 2266 omap_vbus_session(&udc->gadget, 0);
2184 2267
2185 if (udc->transceiver) 2268 if (udc->transceiver)
@@ -2822,7 +2905,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
2822 hmc = HMC_1510; 2905 hmc = HMC_1510;
2823 type = "(unknown)"; 2906 type = "(unknown)";
2824 2907
2825 if (machine_is_omap_innovator() || machine_is_sx1()) { 2908 if (machine_without_vbus_sense()) {
2826 /* just set up software VBUS detect, and then 2909 /* just set up software VBUS detect, and then
2827 * later rig it so we always report VBUS. 2910 * later rig it so we always report VBUS.
2828 * FIXME without really sensing VBUS, we can't 2911 * FIXME without really sensing VBUS, we can't
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a74056488234..c7458f7e56cc 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -669,6 +669,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
669 */ 669 */
670 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); 670 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
671 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); 671 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
672 mod_timer(&hcd->rh_timer, ehci->reset_done[i]);
672 } 673 }
673 } 674 }
674 675
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 9af529d22b3e..1813b7cac294 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -653,8 +653,7 @@ static int ehci_hub_control (
653 if (status & ~0xffff) /* only if wPortChange is interesting */ 653 if (status & ~0xffff) /* only if wPortChange is interesting */
654#endif 654#endif
655 dbg_port (ehci, "GetStatus", wIndex + 1, temp); 655 dbg_port (ehci, "GetStatus", wIndex + 1, temp);
656 // we "know" this alignment is good, caller used kmalloc()... 656 put_unaligned(cpu_to_le32 (status), (__le32 *) buf);
657 *((__le32 *) buf) = cpu_to_le32 (status);
658 break; 657 break;
659 case SetHubFeature: 658 case SetHubFeature:
660 switch (wValue) { 659 switch (wValue) {
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index 8d24d3dc0a61..1497371583b9 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -145,7 +145,8 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space)
145 return out - buf; 145 return out - buf;
146} 146}
147 147
148static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) 148static int uhci_show_qh(struct uhci_hcd *uhci,
149 struct uhci_qh *qh, char *buf, int len, int space)
149{ 150{
150 char *out = buf; 151 char *out = buf;
151 int i, nurbs; 152 int i, nurbs;
@@ -190,6 +191,9 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
190 191
191 if (list_empty(&qh->queue)) { 192 if (list_empty(&qh->queue)) {
192 out += sprintf(out, "%*s queue is empty\n", space, ""); 193 out += sprintf(out, "%*s queue is empty\n", space, "");
194 if (qh == uhci->skel_async_qh)
195 out += uhci_show_td(uhci->term_td, out,
196 len - (out - buf), 0);
193 } else { 197 } else {
194 struct urb_priv *urbp = list_entry(qh->queue.next, 198 struct urb_priv *urbp = list_entry(qh->queue.next,
195 struct urb_priv, node); 199 struct urb_priv, node);
@@ -343,6 +347,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
343 struct list_head *tmp, *head; 347 struct list_head *tmp, *head;
344 int nframes, nerrs; 348 int nframes, nerrs;
345 __le32 link; 349 __le32 link;
350 __le32 fsbr_link;
346 351
347 static const char * const qh_names[] = { 352 static const char * const qh_names[] = {
348 "unlink", "iso", "int128", "int64", "int32", "int16", 353 "unlink", "iso", "int128", "int64", "int32", "int16",
@@ -424,21 +429,22 @@ check_link:
424 429
425 out += sprintf(out, "Skeleton QHs\n"); 430 out += sprintf(out, "Skeleton QHs\n");
426 431
432 fsbr_link = 0;
427 for (i = 0; i < UHCI_NUM_SKELQH; ++i) { 433 for (i = 0; i < UHCI_NUM_SKELQH; ++i) {
428 int cnt = 0; 434 int cnt = 0;
429 __le32 fsbr_link = 0;
430 435
431 qh = uhci->skelqh[i]; 436 qh = uhci->skelqh[i];
432 out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \ 437 out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \
433 out += uhci_show_qh(qh, out, len - (out - buf), 4); 438 out += uhci_show_qh(uhci, qh, out, len - (out - buf), 4);
434 439
435 /* Last QH is the Terminating QH, it's different */ 440 /* Last QH is the Terminating QH, it's different */
436 if (i == SKEL_TERM) { 441 if (i == SKEL_TERM) {
437 if (qh_element(qh) != LINK_TO_TD(uhci->term_td)) 442 if (qh_element(qh) != LINK_TO_TD(uhci->term_td))
438 out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); 443 out += sprintf(out, " skel_term_qh element is not set to term_td!\n");
439 if (link == LINK_TO_QH(uhci->skel_term_qh)) 444 link = fsbr_link;
440 goto check_qh_link; 445 if (!link)
441 continue; 446 link = LINK_TO_QH(uhci->skel_term_qh);
447 goto check_qh_link;
442 } 448 }
443 449
444 head = &qh->node; 450 head = &qh->node;
@@ -448,7 +454,7 @@ check_link:
448 qh = list_entry(tmp, struct uhci_qh, node); 454 qh = list_entry(tmp, struct uhci_qh, node);
449 tmp = tmp->next; 455 tmp = tmp->next;
450 if (++cnt <= 10) 456 if (++cnt <= 10)
451 out += uhci_show_qh(qh, out, 457 out += uhci_show_qh(uhci, qh, out,
452 len - (out - buf), 4); 458 len - (out - buf), 4);
453 if (!fsbr_link && qh->skel >= SKEL_FSBR) 459 if (!fsbr_link && qh->skel >= SKEL_FSBR)
454 fsbr_link = LINK_TO_QH(qh); 460 fsbr_link = LINK_TO_QH(qh);
@@ -463,8 +469,6 @@ check_link:
463 link = LINK_TO_QH(uhci->skel_async_qh); 469 link = LINK_TO_QH(uhci->skel_async_qh);
464 else if (!uhci->fsbr_is_on) 470 else if (!uhci->fsbr_is_on)
465 ; 471 ;
466 else if (fsbr_link)
467 link = fsbr_link;
468 else 472 else
469 link = LINK_TO_QH(uhci->skel_term_qh); 473 link = LINK_TO_QH(uhci->skel_term_qh);
470check_qh_link: 474check_qh_link:
@@ -573,8 +577,8 @@ static const struct file_operations uhci_debug_operations = {
573static inline void lprintk(char *buf) 577static inline void lprintk(char *buf)
574{} 578{}
575 579
576static inline int uhci_show_qh(struct uhci_qh *qh, char *buf, 580static inline int uhci_show_qh(struct uhci_hcd *uhci,
577 int len, int space) 581 struct uhci_qh *qh, char *buf, int len, int space)
578{ 582{
579 return 0; 583 return 0;
580} 584}
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 44da4334f1d6..d22da26ff167 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -632,7 +632,8 @@ static int uhci_start(struct usb_hcd *hcd)
632 */ 632 */
633 for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i) 633 for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i)
634 uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh); 634 uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh);
635 uhci->skel_async_qh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM; 635 uhci->skel_async_qh->link = UHCI_PTR_TERM;
636 uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
636 637
637 /* This dummy TD is to work around a bug in Intel PIIX controllers */ 638 /* This dummy TD is to work around a bug in Intel PIIX controllers */
638 uhci_fill_td(uhci->term_td, 0, uhci_explen(0) | 639 uhci_fill_td(uhci->term_td, 0, uhci_explen(0) |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index bacc25c53ba3..8e4427aebb14 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -33,6 +33,9 @@ static __u8 root_hub_hub_des[] =
33/* status change bits: nonzero writes will clear */ 33/* status change bits: nonzero writes will clear */
34#define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC) 34#define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC)
35 35
36/* suspend/resume bits: port suspended or port resuming */
37#define SUSPEND_BITS (USBPORTSC_SUSP | USBPORTSC_RD)
38
36/* A port that either is connected or has a changed-bit set will prevent 39/* A port that either is connected or has a changed-bit set will prevent
37 * us from AUTO_STOPPING. 40 * us from AUTO_STOPPING.
38 */ 41 */
@@ -96,8 +99,8 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
96 int status; 99 int status;
97 int i; 100 int i;
98 101
99 if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) { 102 if (inw(port_addr) & SUSPEND_BITS) {
100 CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); 103 CLR_RH_PORTSTAT(SUSPEND_BITS);
101 if (test_bit(port, &uhci->resuming_ports)) 104 if (test_bit(port, &uhci->resuming_ports))
102 set_bit(port, &uhci->port_c_suspend); 105 set_bit(port, &uhci->port_c_suspend);
103 106
@@ -107,7 +110,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
107 * Experiments show that some controllers take longer, so 110 * Experiments show that some controllers take longer, so
108 * we'll poll for completion. */ 111 * we'll poll for completion. */
109 for (i = 0; i < 10; ++i) { 112 for (i = 0; i < 10; ++i) {
110 if (!(inw(port_addr) & USBPORTSC_RD)) 113 if (!(inw(port_addr) & SUSPEND_BITS))
111 break; 114 break;
112 udelay(1); 115 udelay(1);
113 } 116 }
@@ -289,7 +292,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
289 wPortStatus |= USB_PORT_STAT_CONNECTION; 292 wPortStatus |= USB_PORT_STAT_CONNECTION;
290 if (status & USBPORTSC_PE) { 293 if (status & USBPORTSC_PE) {
291 wPortStatus |= USB_PORT_STAT_ENABLE; 294 wPortStatus |= USB_PORT_STAT_ENABLE;
292 if (status & (USBPORTSC_SUSP | USBPORTSC_RD)) 295 if (status & SUSPEND_BITS)
293 wPortStatus |= USB_PORT_STAT_SUSPEND; 296 wPortStatus |= USB_PORT_STAT_SUSPEND;
294 } 297 }
295 if (status & USBPORTSC_OC) 298 if (status & USBPORTSC_OC)
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index f4ebdb3e488f..19a0cc02b9a2 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -45,43 +45,27 @@ static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)
45 */ 45 */
46static void uhci_fsbr_on(struct uhci_hcd *uhci) 46static void uhci_fsbr_on(struct uhci_hcd *uhci)
47{ 47{
48 struct uhci_qh *fsbr_qh, *lqh, *tqh; 48 struct uhci_qh *lqh;
49 49
50 /* The terminating skeleton QH always points back to the first
51 * FSBR QH. Make the last async QH point to the terminating
52 * skeleton QH. */
50 uhci->fsbr_is_on = 1; 53 uhci->fsbr_is_on = 1;
51 lqh = list_entry(uhci->skel_async_qh->node.prev, 54 lqh = list_entry(uhci->skel_async_qh->node.prev,
52 struct uhci_qh, node); 55 struct uhci_qh, node);
53 56 lqh->link = LINK_TO_QH(uhci->skel_term_qh);
54 /* Find the first FSBR QH. Linear search through the list is
55 * acceptable because normally FSBR gets turned on as soon as
56 * one QH needs it. */
57 fsbr_qh = NULL;
58 list_for_each_entry_reverse(tqh, &uhci->skel_async_qh->node, node) {
59 if (tqh->skel < SKEL_FSBR)
60 break;
61 fsbr_qh = tqh;
62 }
63
64 /* No FSBR QH means we must insert the terminating skeleton QH */
65 if (!fsbr_qh) {
66 uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
67 wmb();
68 lqh->link = uhci->skel_term_qh->link;
69
70 /* Otherwise loop the last QH to the first FSBR QH */
71 } else
72 lqh->link = LINK_TO_QH(fsbr_qh);
73} 57}
74 58
75static void uhci_fsbr_off(struct uhci_hcd *uhci) 59static void uhci_fsbr_off(struct uhci_hcd *uhci)
76{ 60{
77 struct uhci_qh *lqh; 61 struct uhci_qh *lqh;
78 62
63 /* Remove the link from the last async QH to the terminating
64 * skeleton QH. */
79 uhci->fsbr_is_on = 0; 65 uhci->fsbr_is_on = 0;
80 lqh = list_entry(uhci->skel_async_qh->node.prev, 66 lqh = list_entry(uhci->skel_async_qh->node.prev,
81 struct uhci_qh, node); 67 struct uhci_qh, node);
82 68 lqh->link = UHCI_PTR_TERM;
83 /* End the async list normally and unlink the terminating QH */
84 lqh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM;
85} 69}
86 70
87static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb) 71static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb)
@@ -464,9 +448,8 @@ static void link_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
464 */ 448 */
465static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh) 449static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
466{ 450{
467 struct uhci_qh *pqh, *lqh; 451 struct uhci_qh *pqh;
468 __le32 link_to_new_qh; 452 __le32 link_to_new_qh;
469 __le32 *extra_link = &link_to_new_qh;
470 453
471 /* Find the predecessor QH for our new one and insert it in the list. 454 /* Find the predecessor QH for our new one and insert it in the list.
472 * The list of QHs is expected to be short, so linear search won't 455 * The list of QHs is expected to be short, so linear search won't
@@ -476,31 +459,17 @@ static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
476 break; 459 break;
477 } 460 }
478 list_add(&qh->node, &pqh->node); 461 list_add(&qh->node, &pqh->node);
479 qh->link = pqh->link;
480
481 link_to_new_qh = LINK_TO_QH(qh);
482
483 /* If this is now the first FSBR QH, take special action */
484 if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
485 qh->skel >= SKEL_FSBR) {
486 lqh = list_entry(uhci->skel_async_qh->node.prev,
487 struct uhci_qh, node);
488
489 /* If the new QH is also the last one, we must unlink
490 * the terminating skeleton QH and make the new QH point
491 * back to itself. */
492 if (qh == lqh) {
493 qh->link = link_to_new_qh;
494 extra_link = &uhci->skel_term_qh->link;
495
496 /* Otherwise the last QH must point to the new QH */
497 } else
498 extra_link = &lqh->link;
499 }
500 462
501 /* Link it into the schedule */ 463 /* Link it into the schedule */
464 qh->link = pqh->link;
502 wmb(); 465 wmb();
503 *extra_link = pqh->link = link_to_new_qh; 466 link_to_new_qh = LINK_TO_QH(qh);
467 pqh->link = link_to_new_qh;
468
469 /* If this is now the first FSBR QH, link the terminating skeleton
470 * QH to it. */
471 if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR)
472 uhci->skel_term_qh->link = link_to_new_qh;
504} 473}
505 474
506/* 475/*
@@ -561,31 +530,16 @@ static void unlink_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
561 */ 530 */
562static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh) 531static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
563{ 532{
564 struct uhci_qh *pqh, *lqh; 533 struct uhci_qh *pqh;
565 __le32 link_to_next_qh = qh->link; 534 __le32 link_to_next_qh = qh->link;
566 535
567 pqh = list_entry(qh->node.prev, struct uhci_qh, node); 536 pqh = list_entry(qh->node.prev, struct uhci_qh, node);
568
569 /* If this is the first FSBQ QH, take special action */
570 if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
571 qh->skel >= SKEL_FSBR) {
572 lqh = list_entry(uhci->skel_async_qh->node.prev,
573 struct uhci_qh, node);
574
575 /* If this QH is also the last one, we must link in
576 * the terminating skeleton QH. */
577 if (qh == lqh) {
578 link_to_next_qh = LINK_TO_QH(uhci->skel_term_qh);
579 uhci->skel_term_qh->link = link_to_next_qh;
580 wmb();
581 qh->link = link_to_next_qh;
582
583 /* Otherwise the last QH must point to the new first FSBR QH */
584 } else
585 lqh->link = link_to_next_qh;
586 }
587
588 pqh->link = link_to_next_qh; 537 pqh->link = link_to_next_qh;
538
539 /* If this was the old first FSBR QH, link the terminating skeleton
540 * QH to the next (new first FSBR) QH. */
541 if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR)
542 uhci->skel_term_qh->link = link_to_next_qh;
589 mb(); 543 mb();
590} 544}
591 545
@@ -1217,7 +1171,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
1217 1171
1218 if (debug > 1 && errbuf) { 1172 if (debug > 1 && errbuf) {
1219 /* Print the chain for debugging */ 1173 /* Print the chain for debugging */
1220 uhci_show_qh(urbp->qh, errbuf, 1174 uhci_show_qh(uhci, urbp->qh, errbuf,
1221 ERRBUF_LEN, 0); 1175 ERRBUF_LEN, 0);
1222 lprintk(errbuf); 1176 lprintk(errbuf);
1223 } 1177 }
diff --git a/drivers/usb/misc/berry_charge.c b/drivers/usb/misc/berry_charge.c
index 60893c6c8221..b15f2fd8dab4 100644
--- a/drivers/usb/misc/berry_charge.c
+++ b/drivers/usb/misc/berry_charge.c
@@ -69,7 +69,7 @@ static int magic_charge(struct usb_device *udev)
69 return retval; 69 return retval;
70 } 70 }
71 71
72 dbg(&udev->dev, "Sending first magic command\n"); 72 dbg(&udev->dev, "Sending second magic command\n");
73 retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 73 retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
74 0xa2, 0x40, 0, 1, dummy_buffer, 0, 100); 74 0xa2, 0x40, 0, 1, dummy_buffer, 0, 100);
75 if (retval != 0) { 75 if (retval != 0) {
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 0c1d66ddb812..bc3327e3dd78 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -2905,17 +2905,31 @@ static int __init ftdi_elan_init(void)
2905{ 2905{
2906 int result; 2906 int result;
2907 printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, 2907 printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name,
2908 __TIME__, __DATE__); 2908 __TIME__, __DATE__);
2909 init_MUTEX(&ftdi_module_lock); 2909 init_MUTEX(&ftdi_module_lock);
2910 INIT_LIST_HEAD(&ftdi_static_list); 2910 INIT_LIST_HEAD(&ftdi_static_list);
2911 status_queue = create_singlethread_workqueue("ftdi-status-control"); 2911 status_queue = create_singlethread_workqueue("ftdi-status-control");
2912 if (!status_queue)
2913 goto err1;
2912 command_queue = create_singlethread_workqueue("ftdi-command-engine"); 2914 command_queue = create_singlethread_workqueue("ftdi-command-engine");
2915 if (!command_queue)
2916 goto err2;
2913 respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); 2917 respond_queue = create_singlethread_workqueue("ftdi-respond-engine");
2918 if (!respond_queue)
2919 goto err3;
2914 result = usb_register(&ftdi_elan_driver); 2920 result = usb_register(&ftdi_elan_driver);
2915 if (result) 2921 if (result)
2916 printk(KERN_ERR "usb_register failed. Error number %d\n", 2922 printk(KERN_ERR "usb_register failed. Error number %d\n",
2917 result); 2923 result);
2918 return result; 2924 return result;
2925
2926 err3:
2927 destroy_workqueue(command_queue);
2928 err2:
2929 destroy_workqueue(status_queue);
2930 err1:
2931 printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name);
2932 return -ENOMEM;
2919} 2933}
2920 2934
2921static void __exit ftdi_elan_exit(void) 2935static void __exit ftdi_elan_exit(void)
diff --git a/drivers/usb/net/dm9601.c b/drivers/usb/net/dm9601.c
index 4a932e1cd93b..5130cc7eb314 100644
--- a/drivers/usb/net/dm9601.c
+++ b/drivers/usb/net/dm9601.c
@@ -571,9 +571,21 @@ static const struct driver_info dm9601_info = {
571 571
572static const struct usb_device_id products[] = { 572static const struct usb_device_id products[] = {
573 { 573 {
574 USB_DEVICE(0x07aa, 0x9601), /* Corega FEther USB-TXC */
575 .driver_info = (unsigned long)&dm9601_info,
576 },
577 {
574 USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ 578 USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */
575 .driver_info = (unsigned long)&dm9601_info, 579 .driver_info = (unsigned long)&dm9601_info,
576 }, 580 },
581 {
582 USB_DEVICE(0x0a46, 0x6688), /* ZT6688 USB NIC */
583 .driver_info = (unsigned long)&dm9601_info,
584 },
585 {
586 USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */
587 .driver_info = (unsigned long)&dm9601_info,
588 },
577 {}, // END 589 {}, // END
578}; 590};
579 591
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 18816bf96a4d..39a498362594 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,11 +18,6 @@
18 18
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
22 { USB_DEVICE(0x1410, 0x1130) }, /* Novatel Wireless S720 CDMA/EV-DO */
23 { USB_DEVICE(0x1410, 0x2110) }, /* Novatel Wireless U720 CDMA/EV-DO */
24 { USB_DEVICE(0x1410, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */
25 { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
26 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */ 21 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
27 { }, 22 { },
28}; 23};
@@ -44,8 +39,43 @@ struct airprime_private {
44 int outstanding_urbs; 39 int outstanding_urbs;
45 int throttled; 40 int throttled;
46 struct urb *read_urbp[NUM_READ_URBS]; 41 struct urb *read_urbp[NUM_READ_URBS];
42
43 /* Settings for the port */
44 int rts_state; /* Handshaking pins (outputs) */
45 int dtr_state;
46 int cts_state; /* Handshaking pins (inputs) */
47 int dsr_state;
48 int dcd_state;
49 int ri_state;
47}; 50};
48 51
52static int airprime_send_setup(struct usb_serial_port *port)
53{
54 struct usb_serial *serial = port->serial;
55 struct airprime_private *priv;
56
57 dbg("%s", __FUNCTION__);
58
59 if (port->number != 0)
60 return 0;
61
62 priv = usb_get_serial_port_data(port);
63
64 if (port->tty) {
65 int val = 0;
66 if (priv->dtr_state)
67 val |= 0x01;
68 if (priv->rts_state)
69 val |= 0x02;
70
71 return usb_control_msg(serial->dev,
72 usb_rcvctrlpipe(serial->dev, 0),
73 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
74 }
75
76 return 0;
77}
78
49static void airprime_read_bulk_callback(struct urb *urb) 79static void airprime_read_bulk_callback(struct urb *urb)
50{ 80{
51 struct usb_serial_port *port = urb->context; 81 struct usb_serial_port *port = urb->context;
@@ -118,6 +148,10 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
118 usb_set_serial_port_data(port, priv); 148 usb_set_serial_port_data(port, priv);
119 } 149 }
120 150
151 /* Set some sane defaults */
152 priv->rts_state = 1;
153 priv->dtr_state = 1;
154
121 for (i = 0; i < NUM_READ_URBS; ++i) { 155 for (i = 0; i < NUM_READ_URBS; ++i) {
122 buffer = kmalloc(buffer_size, GFP_KERNEL); 156 buffer = kmalloc(buffer_size, GFP_KERNEL);
123 if (!buffer) { 157 if (!buffer) {
@@ -151,6 +185,9 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
151 /* remember this urb so we can kill it when the port is closed */ 185 /* remember this urb so we can kill it when the port is closed */
152 priv->read_urbp[i] = urb; 186 priv->read_urbp[i] = urb;
153 } 187 }
188
189 airprime_send_setup(port);
190
154 goto out; 191 goto out;
155 192
156 errout: 193 errout:
@@ -176,6 +213,11 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp)
176 213
177 dbg("%s - port %d", __FUNCTION__, port->number); 214 dbg("%s - port %d", __FUNCTION__, port->number);
178 215
216 priv->rts_state = 0;
217 priv->dtr_state = 0;
218
219 airprime_send_setup(port);
220
179 for (i = 0; i < NUM_READ_URBS; ++i) { 221 for (i = 0; i < NUM_READ_URBS; ++i) {
180 usb_kill_urb (priv->read_urbp[i]); 222 usb_kill_urb (priv->read_urbp[i]);
181 kfree (priv->read_urbp[i]->transfer_buffer); 223 kfree (priv->read_urbp[i]->transfer_buffer);
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index db623e754899..d7d0ba986a80 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -63,6 +63,8 @@ static struct usb_device_id id_table [] = {
63 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ 63 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
64 { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ 64 { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
65 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 65 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
66 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
67 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
66 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 68 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
67 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ 69 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
68 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ 70 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c525b42dadde..8ff9d54b21e6 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -315,6 +315,7 @@ static struct usb_device_id id_table_combined [] = {
315 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, 315 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
316 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, 316 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
317 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, 317 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) },
318 { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) },
318 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, 319 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
319 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, 320 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
320 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, 321 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
@@ -420,6 +421,14 @@ static struct usb_device_id id_table_combined [] = {
420 { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, 421 { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) },
421 { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) }, 422 { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) },
422 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, 423 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) },
424 { USB_DEVICE(FTDI_VID, FTDI_IBS_US485_PID) },
425 { USB_DEVICE(FTDI_VID, FTDI_IBS_PICPRO_PID) },
426 { USB_DEVICE(FTDI_VID, FTDI_IBS_PCMCIA_PID) },
427 { USB_DEVICE(FTDI_VID, FTDI_IBS_PK1_PID) },
428 { USB_DEVICE(FTDI_VID, FTDI_IBS_RS232MON_PID) },
429 { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) },
430 { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
431 { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
423 /* 432 /*
424 * These will probably use user-space drivers. Uncomment them if 433 * These will probably use user-space drivers. Uncomment them if
425 * you need them or use the user-specified vendor/product module 434 * you need them or use the user-specified vendor/product module
@@ -459,6 +468,7 @@ static struct usb_device_id id_table_combined [] = {
459 { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, 468 { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) },
460 { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, 469 { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) },
461 { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, 470 { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) },
471 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
462 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 472 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
463 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 473 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
464 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 474 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
@@ -533,6 +543,7 @@ static const char *ftdi_chip_name[] = {
533 [FT8U232AM] = "FT8U232AM", 543 [FT8U232AM] = "FT8U232AM",
534 [FT232BM] = "FT232BM", 544 [FT232BM] = "FT232BM",
535 [FT2232C] = "FT2232C", 545 [FT2232C] = "FT2232C",
546 [FT232RL] = "FT232RL",
536}; 547};
537 548
538 549
@@ -588,6 +599,8 @@ struct ftdi_private {
588static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); 599static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id);
589static int ftdi_sio_attach (struct usb_serial *serial); 600static int ftdi_sio_attach (struct usb_serial *serial);
590static void ftdi_shutdown (struct usb_serial *serial); 601static void ftdi_shutdown (struct usb_serial *serial);
602static int ftdi_sio_port_probe (struct usb_serial_port *port);
603static int ftdi_sio_port_remove (struct usb_serial_port *port);
591static int ftdi_open (struct usb_serial_port *port, struct file *filp); 604static int ftdi_open (struct usb_serial_port *port, struct file *filp);
592static void ftdi_close (struct usb_serial_port *port, struct file *filp); 605static void ftdi_close (struct usb_serial_port *port, struct file *filp);
593static int ftdi_write (struct usb_serial_port *port, const unsigned char *buf, int count); 606static int ftdi_write (struct usb_serial_port *port, const unsigned char *buf, int count);
@@ -622,6 +635,8 @@ static struct usb_serial_driver ftdi_sio_device = {
622 .num_bulk_out = 1, 635 .num_bulk_out = 1,
623 .num_ports = 1, 636 .num_ports = 1,
624 .probe = ftdi_sio_probe, 637 .probe = ftdi_sio_probe,
638 .port_probe = ftdi_sio_port_probe,
639 .port_remove = ftdi_sio_port_remove,
625 .open = ftdi_open, 640 .open = ftdi_open,
626 .close = ftdi_close, 641 .close = ftdi_close,
627 .throttle = ftdi_throttle, 642 .throttle = ftdi_throttle,
@@ -864,6 +879,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
864 break; 879 break;
865 case FT232BM: /* FT232BM chip */ 880 case FT232BM: /* FT232BM chip */
866 case FT2232C: /* FT2232C chip */ 881 case FT2232C: /* FT2232C chip */
882 case FT232RL:
867 if (baud <= 3000000) { 883 if (baud <= 3000000) {
868 div_value = ftdi_232bm_baud_to_divisor(baud); 884 div_value = ftdi_232bm_baud_to_divisor(baud);
869 } else { 885 } else {
@@ -1006,9 +1022,12 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1006 /* (It might be a BM because of the iSerialNumber bug, 1022 /* (It might be a BM because of the iSerialNumber bug,
1007 * but it will still work as an AM device.) */ 1023 * but it will still work as an AM device.) */
1008 priv->chip_type = FT8U232AM; 1024 priv->chip_type = FT8U232AM;
1009 } else { 1025 } else if (version < 0x600) {
1010 /* Assume its an FT232BM (or FT245BM) */ 1026 /* Assume its an FT232BM (or FT245BM) */
1011 priv->chip_type = FT232BM; 1027 priv->chip_type = FT232BM;
1028 } else {
1029 /* Assume its an FT232R */
1030 priv->chip_type = FT232RL;
1012 } 1031 }
1013 info("Detected %s", ftdi_chip_name[priv->chip_type]); 1032 info("Detected %s", ftdi_chip_name[priv->chip_type]);
1014} 1033}
@@ -1024,11 +1043,10 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a
1024{ 1043{
1025 struct usb_serial_port *port = to_usb_serial_port(dev); 1044 struct usb_serial_port *port = to_usb_serial_port(dev);
1026 struct ftdi_private *priv = usb_get_serial_port_data(port); 1045 struct ftdi_private *priv = usb_get_serial_port_data(port);
1027 struct usb_device *udev; 1046 struct usb_device *udev = port->serial->dev;
1028 unsigned short latency = 0; 1047 unsigned short latency = 0;
1029 int rv = 0; 1048 int rv = 0;
1030 1049
1031 udev = to_usb_device(dev);
1032 1050
1033 dbg("%s",__FUNCTION__); 1051 dbg("%s",__FUNCTION__);
1034 1052
@@ -1052,13 +1070,11 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute *
1052{ 1070{
1053 struct usb_serial_port *port = to_usb_serial_port(dev); 1071 struct usb_serial_port *port = to_usb_serial_port(dev);
1054 struct ftdi_private *priv = usb_get_serial_port_data(port); 1072 struct ftdi_private *priv = usb_get_serial_port_data(port);
1055 struct usb_device *udev; 1073 struct usb_device *udev = port->serial->dev;
1056 char buf[1]; 1074 char buf[1];
1057 int v = simple_strtoul(valbuf, NULL, 10); 1075 int v = simple_strtoul(valbuf, NULL, 10);
1058 int rv = 0; 1076 int rv = 0;
1059 1077
1060 udev = to_usb_device(dev);
1061
1062 dbg("%s: setting latency timer = %i", __FUNCTION__, v); 1078 dbg("%s: setting latency timer = %i", __FUNCTION__, v);
1063 1079
1064 rv = usb_control_msg(udev, 1080 rv = usb_control_msg(udev,
@@ -1083,13 +1099,11 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att
1083{ 1099{
1084 struct usb_serial_port *port = to_usb_serial_port(dev); 1100 struct usb_serial_port *port = to_usb_serial_port(dev);
1085 struct ftdi_private *priv = usb_get_serial_port_data(port); 1101 struct ftdi_private *priv = usb_get_serial_port_data(port);
1086 struct usb_device *udev; 1102 struct usb_device *udev = port->serial->dev;
1087 char buf[1]; 1103 char buf[1];
1088 int v = simple_strtoul(valbuf, NULL, 10); 1104 int v = simple_strtoul(valbuf, NULL, 10);
1089 int rv = 0; 1105 int rv = 0;
1090 1106
1091 udev = to_usb_device(dev);
1092
1093 dbg("%s: setting event char = %i", __FUNCTION__, v); 1107 dbg("%s: setting event char = %i", __FUNCTION__, v);
1094 1108
1095 rv = usb_control_msg(udev, 1109 rv = usb_control_msg(udev,
@@ -1110,46 +1124,38 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att
1110static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); 1124static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer);
1111static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); 1125static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char);
1112 1126
1113static int create_sysfs_attrs(struct usb_serial *serial) 1127static int create_sysfs_attrs(struct usb_serial_port *port)
1114{ 1128{
1115 struct ftdi_private *priv; 1129 struct ftdi_private *priv = usb_get_serial_port_data(port);
1116 struct usb_device *udev;
1117 int retval = 0; 1130 int retval = 0;
1118 1131
1119 dbg("%s",__FUNCTION__); 1132 dbg("%s",__FUNCTION__);
1120 1133
1121 priv = usb_get_serial_port_data(serial->port[0]);
1122 udev = serial->dev;
1123
1124 /* XXX I've no idea if the original SIO supports the event_char 1134 /* XXX I've no idea if the original SIO supports the event_char
1125 * sysfs parameter, so I'm playing it safe. */ 1135 * sysfs parameter, so I'm playing it safe. */
1126 if (priv->chip_type != SIO) { 1136 if (priv->chip_type != SIO) {
1127 dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); 1137 dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]);
1128 retval = device_create_file(&udev->dev, &dev_attr_event_char); 1138 retval = device_create_file(&port->dev, &dev_attr_event_char);
1129 if ((!retval) && 1139 if ((!retval) &&
1130 (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) { 1140 (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) {
1131 retval = device_create_file(&udev->dev, 1141 retval = device_create_file(&port->dev,
1132 &dev_attr_latency_timer); 1142 &dev_attr_latency_timer);
1133 } 1143 }
1134 } 1144 }
1135 return retval; 1145 return retval;
1136} 1146}
1137 1147
1138static void remove_sysfs_attrs(struct usb_serial *serial) 1148static void remove_sysfs_attrs(struct usb_serial_port *port)
1139{ 1149{
1140 struct ftdi_private *priv; 1150 struct ftdi_private *priv = usb_get_serial_port_data(port);
1141 struct usb_device *udev;
1142 1151
1143 dbg("%s",__FUNCTION__); 1152 dbg("%s",__FUNCTION__);
1144 1153
1145 priv = usb_get_serial_port_data(serial->port[0]);
1146 udev = serial->dev;
1147
1148 /* XXX see create_sysfs_attrs */ 1154 /* XXX see create_sysfs_attrs */
1149 if (priv->chip_type != SIO) { 1155 if (priv->chip_type != SIO) {
1150 device_remove_file(&udev->dev, &dev_attr_event_char); 1156 device_remove_file(&port->dev, &dev_attr_event_char);
1151 if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) { 1157 if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) {
1152 device_remove_file(&udev->dev, &dev_attr_latency_timer); 1158 device_remove_file(&port->dev, &dev_attr_latency_timer);
1153 } 1159 }
1154 } 1160 }
1155 1161
@@ -1169,13 +1175,9 @@ static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id
1169 return (0); 1175 return (0);
1170} 1176}
1171 1177
1172/* attach subroutine */ 1178static int ftdi_sio_port_probe(struct usb_serial_port *port)
1173static int ftdi_sio_attach (struct usb_serial *serial)
1174{ 1179{
1175 struct usb_serial_port *port = serial->port[0];
1176 struct ftdi_private *priv; 1180 struct ftdi_private *priv;
1177 struct ftdi_sio_quirk *quirk;
1178 int retval;
1179 1181
1180 dbg("%s",__FUNCTION__); 1182 dbg("%s",__FUNCTION__);
1181 1183
@@ -1215,19 +1217,21 @@ static int ftdi_sio_attach (struct usb_serial *serial)
1215 kfree(port->bulk_out_buffer); 1217 kfree(port->bulk_out_buffer);
1216 port->bulk_out_buffer = NULL; 1218 port->bulk_out_buffer = NULL;
1217 1219
1218 usb_set_serial_port_data(serial->port[0], priv); 1220 usb_set_serial_port_data(port, priv);
1219 1221
1220 ftdi_determine_type (serial->port[0]); 1222 ftdi_determine_type (port);
1221 retval = create_sysfs_attrs(serial); 1223 create_sysfs_attrs(port);
1222 if (retval) 1224 return 0;
1223 dev_err(&serial->dev->dev, "Error creating sysfs files, " 1225}
1224 "continuing\n");
1225 1226
1227/* attach subroutine */
1228static int ftdi_sio_attach (struct usb_serial *serial)
1229{
1226 /* Check for device requiring special set up. */ 1230 /* Check for device requiring special set up. */
1227 quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial); 1231 struct ftdi_sio_quirk *quirk = usb_get_serial_data(serial);
1228 if (quirk && quirk->setup) { 1232
1233 if (quirk && quirk->setup)
1229 quirk->setup(serial); 1234 quirk->setup(serial);
1230 }
1231 1235
1232 return 0; 1236 return 0;
1233} /* ftdi_sio_attach */ 1237} /* ftdi_sio_attach */
@@ -1271,17 +1275,18 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
1271 * calls __serial_close for each open of the port 1275 * calls __serial_close for each open of the port
1272 * shutdown is called then (ie ftdi_shutdown) 1276 * shutdown is called then (ie ftdi_shutdown)
1273 */ 1277 */
1274
1275
1276static void ftdi_shutdown (struct usb_serial *serial) 1278static void ftdi_shutdown (struct usb_serial *serial)
1277{ /* ftdi_shutdown */ 1279{
1280 dbg("%s", __FUNCTION__);
1281}
1278 1282
1279 struct usb_serial_port *port = serial->port[0]; 1283static int ftdi_sio_port_remove(struct usb_serial_port *port)
1284{
1280 struct ftdi_private *priv = usb_get_serial_port_data(port); 1285 struct ftdi_private *priv = usb_get_serial_port_data(port);
1281 1286
1282 dbg("%s", __FUNCTION__); 1287 dbg("%s", __FUNCTION__);
1283 1288
1284 remove_sysfs_attrs(serial); 1289 remove_sysfs_attrs(port);
1285 1290
1286 /* all open ports are closed at this point 1291 /* all open ports are closed at this point
1287 * (by usbserial.c:__serial_close, which calls ftdi_close) 1292 * (by usbserial.c:__serial_close, which calls ftdi_close)
@@ -1291,8 +1296,9 @@ static void ftdi_shutdown (struct usb_serial *serial)
1291 usb_set_serial_port_data(port, NULL); 1296 usb_set_serial_port_data(port, NULL);
1292 kfree(priv); 1297 kfree(priv);
1293 } 1298 }
1294} /* ftdi_shutdown */
1295 1299
1300 return 0;
1301}
1296 1302
1297static int ftdi_open (struct usb_serial_port *port, struct file *filp) 1303static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1298{ /* ftdi_open */ 1304{ /* ftdi_open */
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 1bdda935f7d9..513cfe1b768b 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -27,6 +27,7 @@
27#define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ 27#define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */
28#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ 28#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
29#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ 29#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
30#define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */
30#define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ 31#define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */
31#define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ 32#define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */
32#define FTDI_NF_RIC_PID 0x0001 /* Product Id */ 33#define FTDI_NF_RIC_PID 0x0001 /* Product Id */
@@ -339,6 +340,12 @@
339#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ 340#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */
340 341
341/* 342/*
343 * TTi (Thurlby Thandar Instruments)
344 */
345#define TTI_VID 0x103E /* Vendor Id */
346#define TTI_QL355P_PID 0x03E8 /* TTi QL355P power supply */
347
348/*
342 * Definitions for B&B Electronics products. 349 * Definitions for B&B Electronics products.
343 */ 350 */
344#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ 351#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
@@ -497,6 +504,19 @@
497#define TELLDUS_VID 0x1781 /* Vendor ID */ 504#define TELLDUS_VID 0x1781 /* Vendor ID */
498#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ 505#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */
499 506
507/*
508 * IBS elektronik product ids
509 * Submitted by Thomas Schleusener
510 */
511#define FTDI_IBS_US485_PID 0xff38 /* IBS US485 (USB<-->RS422/485 interface) */
512#define FTDI_IBS_PICPRO_PID 0xff39 /* IBS PIC-Programmer */
513#define FTDI_IBS_PCMCIA_PID 0xff3a /* IBS Card reader for PCMCIA SRAM-cards */
514#define FTDI_IBS_PK1_PID 0xff3b /* IBS PK1 - Particel counter */
515#define FTDI_IBS_RS232MON_PID 0xff3c /* IBS RS232 - Monitor */
516#define FTDI_IBS_APP70_PID 0xff3d /* APP 70 (dust monitoring system) */
517#define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */
518#define FTDI_IBS_PROD_PID 0xff3f /* future device */
519
500/* Commands */ 520/* Commands */
501#define FTDI_SIO_RESET 0 /* Reset the port */ 521#define FTDI_SIO_RESET 0 /* Reset the port */
502#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 522#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
@@ -620,6 +640,7 @@ typedef enum {
620 FT8U232AM = 2, 640 FT8U232AM = 2,
621 FT232BM = 3, 641 FT232BM = 3,
622 FT2232C = 4, 642 FT2232C = 4,
643 FT232RL = 5,
623} ftdi_chip_type_t; 644} ftdi_chip_type_t;
624 645
625typedef enum { 646typedef enum {
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 53baeec8f265..4f8282ad7720 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -20,13 +20,14 @@
20#include <linux/usb/serial.h> 20#include <linux/usb/serial.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22 22
23static int generic_probe(struct usb_interface *interface,
24 const struct usb_device_id *id);
25
26 23
27static int debug; 24static int debug;
28 25
29#ifdef CONFIG_USB_SERIAL_GENERIC 26#ifdef CONFIG_USB_SERIAL_GENERIC
27
28static int generic_probe(struct usb_interface *interface,
29 const struct usb_device_id *id);
30
30static __u16 vendor = 0x05f9; 31static __u16 vendor = 0x05f9;
31static __u16 product = 0xffff; 32static __u16 product = 0xffff;
32 33
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index a408184334ea..d16e2e1764ad 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -247,6 +247,8 @@ static struct usb_device_id ipaq_id_table [] = {
247 { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ 247 { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */
248 { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ 248 { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */
249 { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ 249 { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */
250 { USB_DEVICE(0x04AD, 0x0306) }, /* GPS Pocket PC USB Sync */
251 { USB_DEVICE(0x04B7, 0x0531) }, /* MyGuide 7000 XL USB Sync */
250 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ 252 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */
251 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ 253 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
252 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ 254 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 2d588fb82573..19bf403f9db2 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1628,6 +1628,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
1628 .chars_in_buffer = mos7720_chars_in_buffer, 1628 .chars_in_buffer = mos7720_chars_in_buffer,
1629 .break_ctl = mos7720_break, 1629 .break_ctl = mos7720_break,
1630 .read_bulk_callback = mos7720_bulk_in_callback, 1630 .read_bulk_callback = mos7720_bulk_in_callback,
1631 .read_int_callback = mos7720_interrupt_callback,
1631}; 1632};
1632 1633
1633static int __init moschip7720_init(void) 1634static int __init moschip7720_init(void)
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index db92a7fb1f7c..e178e6f40319 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -109,7 +109,6 @@ static int option_send_setup(struct usb_serial_port *port);
109#define HUAWEI_PRODUCT_E220 0x1003 109#define HUAWEI_PRODUCT_E220 0x1003
110 110
111#define NOVATELWIRELESS_VENDOR_ID 0x1410 111#define NOVATELWIRELESS_VENDOR_ID 0x1410
112#define NOVATELWIRELESS_PRODUCT_U740 0x1400
113 112
114#define ANYDATA_VENDOR_ID 0x16d5 113#define ANYDATA_VENDOR_ID 0x16d5
115#define ANYDATA_PRODUCT_ID 0x6501 114#define ANYDATA_PRODUCT_ID 0x6501
@@ -152,7 +151,19 @@ static struct usb_device_id option_ids[] = {
152 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, 151 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
153 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 152 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
154 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) }, 153 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) },
155 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 154 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1100) }, /* Novatel Merlin XS620/S640 */
155 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1110) }, /* Novatel Merlin S620 */
156 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1120) }, /* Novatel Merlin EX720 */
157 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1130) }, /* Novatel Merlin S720 */
158 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1400) }, /* Novatel U730 */
159 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1410) }, /* Novatel U740 */
160 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1420) }, /* Novatel EU870 */
161 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */
162 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel XU870 */
163 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2100) }, /* Novatel EV620 CDMA/EV-DO */
164 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */
165 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */
166 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */
156 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, 167 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
157 { } /* Terminating entry */ 168 { } /* Terminating entry */
158}; 169};
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 6bf22a28adb8..7639022cdf84 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -99,9 +99,12 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
99 continue; 99 continue;
100 100
101 *minor = i; 101 *minor = i;
102 j = 0;
102 dbg("%s - minor base = %d", __FUNCTION__, *minor); 103 dbg("%s - minor base = %d", __FUNCTION__, *minor);
103 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) 104 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
104 serial_table[i] = serial; 105 serial_table[i] = serial;
106 serial->port[j++]->number = i;
107 }
105 spin_unlock(&table_lock); 108 spin_unlock(&table_lock);
106 return serial; 109 return serial;
107 } 110 }
@@ -826,7 +829,6 @@ int usb_serial_probe(struct usb_interface *interface,
826 num_ports = type->num_ports; 829 num_ports = type->num_ports;
827 } 830 }
828 831
829 serial->minor = minor;
830 serial->num_ports = num_ports; 832 serial->num_ports = num_ports;
831 serial->num_bulk_in = num_bulk_in; 833 serial->num_bulk_in = num_bulk_in;
832 serial->num_bulk_out = num_bulk_out; 834 serial->num_bulk_out = num_bulk_out;
@@ -847,7 +849,6 @@ int usb_serial_probe(struct usb_interface *interface,
847 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); 849 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
848 if (!port) 850 if (!port)
849 goto probe_error; 851 goto probe_error;
850 port->number = i + serial->minor;
851 port->serial = serial; 852 port->serial = serial;
852 spin_lock_init(&port->lock); 853 spin_lock_init(&port->lock);
853 mutex_init(&port->mutex); 854 mutex_init(&port->mutex);
@@ -980,6 +981,7 @@ int usb_serial_probe(struct usb_interface *interface,
980 dev_err(&interface->dev, "No more free serial devices\n"); 981 dev_err(&interface->dev, "No more free serial devices\n");
981 goto probe_error; 982 goto probe_error;
982 } 983 }
984 serial->minor = minor;
983 985
984 /* register all of the individual ports with the driver core */ 986 /* register all of the individual ports with the driver core */
985 for (i = 0; i < num_ports; ++i) { 987 for (i = 0; i < num_ports; ++i) {
@@ -1034,9 +1036,6 @@ probe_error:
1034 kfree(port->interrupt_out_buffer); 1036 kfree(port->interrupt_out_buffer);
1035 } 1037 }
1036 1038
1037 /* return the minor range that this device had */
1038 return_serial (serial);
1039
1040 /* free up any memory that we allocated */ 1039 /* free up any memory that we allocated */
1041 for (i = 0; i < serial->num_port_pointers; ++i) 1040 for (i = 0; i < serial->num_port_pointers; ++i)
1042 kfree(serial->port[i]); 1041 kfree(serial->port[i]);
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 9644a8ea4aa7..4a9d0d5c7282 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -146,6 +146,13 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100,
146 US_SC_DEVICE, US_PR_DEVICE, NULL, 146 US_SC_DEVICE, US_PR_DEVICE, NULL,
147 US_FL_IGNORE_RESIDUE ), 147 US_FL_IGNORE_RESIDUE ),
148 148
149/* Reported by Andrew Nayenko <relan@bk.ru> */
150UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592,
151 "Nokia",
152 "Nokia 6288",
153 US_SC_DEVICE, US_PR_DEVICE, NULL,
154 US_FL_MAX_SECTORS_64 ),
155
149/* Reported by Mario Rettig <mariorettig@web.de> */ 156/* Reported by Mario Rettig <mariorettig@web.de> */
150UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, 157UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
151 "Nokia", 158 "Nokia",
@@ -320,6 +327,13 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
320 US_SC_DEVICE, US_PR_DEVICE, NULL, 327 US_SC_DEVICE, US_PR_DEVICE, NULL,
321 US_FL_FIX_CAPACITY), 328 US_FL_FIX_CAPACITY),
322 329
330/* Reported by Emil Larsson <emil@swip.net> */
331UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0100,
332 "NIKON",
333 "NIKON DSC D80",
334 US_SC_DEVICE, US_PR_DEVICE, NULL,
335 US_FL_FIX_CAPACITY),
336
323/* BENQ DC5330 337/* BENQ DC5330
324 * Reported by Manuel Fombuena <mfombuena@ya.com> and 338 * Reported by Manuel Fombuena <mfombuena@ya.com> and
325 * Frank Copeland <fjc@thingy.apana.org.au> */ 339 * Frank Copeland <fjc@thingy.apana.org.au> */
@@ -1395,16 +1409,6 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
1395 US_SC_DEVICE, US_PR_DEVICE, NULL, 1409 US_SC_DEVICE, US_PR_DEVICE, NULL,
1396 US_FL_IGNORE_RESIDUE ), 1410 US_FL_IGNORE_RESIDUE ),
1397 1411
1398/* Reported by Thomas Baechler <thomas@archlinux.org>
1399 * Fixes I/O errors with Teac HD-35PU devices
1400 */
1401
1402UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
1403 "Super Top",
1404 "USB 2.0 IDE DEVICE",
1405 US_SC_DEVICE, US_PR_DEVICE, NULL,
1406 US_FL_IGNORE_RESIDUE),
1407
1408/* patch submitted by Davide Perini <perini.davide@dpsoftware.org> 1412/* patch submitted by Davide Perini <perini.davide@dpsoftware.org>
1409 * and Renato Perini <rperini@email.it> 1413 * and Renato Perini <rperini@email.it>
1410 */ 1414 */
@@ -1414,6 +1418,16 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
1414 US_SC_DEVICE, US_PR_DEVICE, NULL, 1418 US_SC_DEVICE, US_PR_DEVICE, NULL,
1415 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), 1419 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
1416 1420
1421/*
1422 * Patch by Pete Zaitcev <zaitcev@redhat.com>
1423 * Report by Mark Patton. Red Hat bz#208928.
1424 */
1425UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001,
1426 "Motorola",
1427 "RAZR V3i",
1428 US_SC_DEVICE, US_PR_DEVICE, NULL,
1429 US_FL_FIX_CAPACITY),
1430
1417/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ 1431/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */
1418UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, 1432UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1419 "MPIO", 1433 "MPIO",
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 35d2abd1ed50..5af684b40496 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1320,7 +1320,7 @@ config FB_AU1100
1320 1320
1321config FB_AU1200 1321config FB_AU1200
1322 bool "Au1200 LCD Driver" 1322 bool "Au1200 LCD Driver"
1323 depends on FB && MIPS && SOC_AU1200 1323 depends on (FB = y) && MIPS && SOC_AU1200
1324 select FB_CFB_FILLRECT 1324 select FB_CFB_FILLRECT
1325 select FB_CFB_COPYAREA 1325 select FB_CFB_COPYAREA
1326 select FB_CFB_IMAGEBLIT 1326 select FB_CFB_IMAGEBLIT
@@ -1470,7 +1470,7 @@ config FB_G364
1470 1470
1471config FB_68328 1471config FB_68328
1472 bool "Motorola 68328 native frame buffer support" 1472 bool "Motorola 68328 native frame buffer support"
1473 depends on FB && (M68328 || M68EZ328 || M68VZ328) 1473 depends on (FB = y) && (M68328 || M68EZ328 || M68VZ328)
1474 select FB_CFB_FILLRECT 1474 select FB_CFB_FILLRECT
1475 select FB_CFB_COPYAREA 1475 select FB_CFB_COPYAREA
1476 select FB_CFB_IMAGEBLIT 1476 select FB_CFB_IMAGEBLIT
@@ -1616,7 +1616,7 @@ config FB_IBM_GXT4500
1616 1616
1617config FB_PS3 1617config FB_PS3
1618 bool "PS3 GPU framebuffer driver" 1618 bool "PS3 GPU framebuffer driver"
1619 depends on FB && PS3_PS3AV 1619 depends on (FB = y) && PS3_PS3AV
1620 select FB_CFB_FILLRECT 1620 select FB_CFB_FILLRECT
1621 select FB_CFB_COPYAREA 1621 select FB_CFB_COPYAREA
1622 select FB_CFB_IMAGEBLIT 1622 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index d1312477813e..6b488b8a7eee 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -199,8 +199,8 @@ static int locomolcd_remove(struct locomo_dev *dev)
199{ 199{
200 unsigned long flags; 200 unsigned long flags;
201 201
202 locomobl_data.brightness = 0; 202 locomolcd_bl_device->props.brightness = 0;
203 locomobl_data.power = 0; 203 locomolcd_bl_device->props.power = 0;
204 locomolcd_set_intensity(locomolcd_bl_device); 204 locomolcd_set_intensity(locomolcd_bl_device);
205 205
206 backlight_device_unregister(locomolcd_bl_device); 206 backlight_device_unregister(locomolcd_bl_device);
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c
index 702269357861..836ab4df0ef2 100644
--- a/drivers/video/backlight/progear_bl.c
+++ b/drivers/video/backlight/progear_bl.c
@@ -65,13 +65,13 @@ static int progearbl_probe(struct platform_device *pdev)
65 u8 temp; 65 u8 temp;
66 struct backlight_device *progear_backlight_device; 66 struct backlight_device *progear_backlight_device;
67 67
68 pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0); 68 pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL);
69 if (!pmu_dev) { 69 if (!pmu_dev) {
70 printk("ALI M7101 PMU not found.\n"); 70 printk("ALI M7101 PMU not found.\n");
71 return -ENODEV; 71 return -ENODEV;
72 } 72 }
73 73
74 sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0); 74 sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
75 if (!sb_dev) { 75 if (!sb_dev) {
76 printk("ALI 1533 SB not found.\n"); 76 printk("ALI 1533 SB not found.\n");
77 pci_dev_put(pmu_dev); 77 pci_dev_put(pmu_dev);
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index 9bb6257d6918..b0b2e40bbd9f 100644
--- a/drivers/video/bw2.c
+++ b/drivers/video/bw2.c
@@ -186,8 +186,7 @@ static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
186 * Initialisation 186 * Initialisation
187 */ 187 */
188 188
189static void 189static void __devinit bw2_init_fix(struct fb_info *info, int linebytes)
190bw2_init_fix(struct fb_info *info, int linebytes)
191{ 190{
192 strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id)); 191 strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id));
193 192
@@ -199,43 +198,44 @@ bw2_init_fix(struct fb_info *info, int linebytes)
199 info->fix.accel = FB_ACCEL_SUN_BWTWO; 198 info->fix.accel = FB_ACCEL_SUN_BWTWO;
200} 199}
201 200
202static u8 bw2regs_1600[] __initdata = { 201static u8 bw2regs_1600[] __devinitdata = {
203 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13, 202 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13,
204 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e, 203 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e,
205 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01, 204 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01,
206 0x10, 0x21, 0 205 0x10, 0x21, 0
207}; 206};
208 207
209static u8 bw2regs_ecl[] __initdata = { 208static u8 bw2regs_ecl[] __devinitdata = {
210 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c, 209 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c,
211 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23, 210 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23,
212 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01, 211 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01,
213 0x10, 0x20, 0 212 0x10, 0x20, 0
214}; 213};
215 214
216static u8 bw2regs_analog[] __initdata = { 215static u8 bw2regs_analog[] __devinitdata = {
217 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13, 216 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13,
218 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22, 217 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22,
219 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 218 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
220 0x10, 0x20, 0 219 0x10, 0x20, 0
221}; 220};
222 221
223static u8 bw2regs_76hz[] __initdata = { 222static u8 bw2regs_76hz[] __devinitdata = {
224 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, 223 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
225 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, 224 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
226 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, 225 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
227 0x10, 0x24, 0 226 0x10, 0x24, 0
228}; 227};
229 228
230static u8 bw2regs_66hz[] __initdata = { 229static u8 bw2regs_66hz[] __devinitdata = {
231 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, 230 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
232 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, 231 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
233 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 232 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
234 0x10, 0x20, 0 233 0x10, 0x20, 0
235}; 234};
236 235
237static void bw2_do_default_mode(struct bw2_par *par, struct fb_info *info, 236static void __devinit bw2_do_default_mode(struct bw2_par *par,
238 int *linebytes) 237 struct fb_info *info,
238 int *linebytes)
239{ 239{
240 u8 status, mon; 240 u8 status, mon;
241 u8 *p; 241 u8 *p;
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index ec6a51a5822d..b071bb632b97 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -354,7 +354,8 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
354 * Initialisation 354 * Initialisation
355 */ 355 */
356 356
357static void cg14_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) 357static void __devinit cg14_init_fix(struct fb_info *info, int linebytes,
358 struct device_node *dp)
358{ 359{
359 const char *name = dp->name; 360 const char *name = dp->name;
360 361
@@ -368,7 +369,7 @@ static void cg14_init_fix(struct fb_info *info, int linebytes, struct device_nod
368 info->fix.accel = FB_ACCEL_SUN_CG14; 369 info->fix.accel = FB_ACCEL_SUN_CG14;
369} 370}
370 371
371static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __initdata = { 372static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __devinitdata = {
372 { 373 {
373 .voff = CG14_REGS, 374 .voff = CG14_REGS,
374 .poff = 0x80000000, 375 .poff = 0x80000000,
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index ada6f7e3a891..767c850f8eb7 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -186,8 +186,7 @@ static int cg3_setcolreg(unsigned regno,
186 * @blank_mode: the blank mode we want. 186 * @blank_mode: the blank mode we want.
187 * @info: frame buffer structure that represents a single frame buffer 187 * @info: frame buffer structure that represents a single frame buffer
188 */ 188 */
189static int 189static int cg3_blank(int blank, struct fb_info *info)
190cg3_blank(int blank, struct fb_info *info)
191{ 190{
192 struct cg3_par *par = (struct cg3_par *) info->par; 191 struct cg3_par *par = (struct cg3_par *) info->par;
193 struct cg3_regs __iomem *regs = par->regs; 192 struct cg3_regs __iomem *regs = par->regs;
@@ -251,8 +250,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
251 * Initialisation 250 * Initialisation
252 */ 251 */
253 252
254static void 253static void __devinit cg3_init_fix(struct fb_info *info, int linebytes,
255cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) 254 struct device_node *dp)
256{ 255{
257 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); 256 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
258 257
@@ -264,8 +263,8 @@ cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp)
264 info->fix.accel = FB_ACCEL_SUN_CGTHREE; 263 info->fix.accel = FB_ACCEL_SUN_CGTHREE;
265} 264}
266 265
267static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, 266static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
268 struct device_node *dp) 267 struct device_node *dp)
269{ 268{
270 char *params; 269 char *params;
271 char *p; 270 char *p;
@@ -287,36 +286,36 @@ static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
287 } 286 }
288} 287}
289 288
290static u8 cg3regvals_66hz[] __initdata = { /* 1152 x 900, 66 Hz */ 289static u8 cg3regvals_66hz[] __devinitdata = { /* 1152 x 900, 66 Hz */
291 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, 290 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
292 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, 291 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
293 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 292 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
294 0x10, 0x20, 0 293 0x10, 0x20, 0
295}; 294};
296 295
297static u8 cg3regvals_76hz[] __initdata = { /* 1152 x 900, 76 Hz */ 296static u8 cg3regvals_76hz[] __devinitdata = { /* 1152 x 900, 76 Hz */
298 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, 297 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
299 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, 298 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
300 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, 299 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
301 0x10, 0x24, 0 300 0x10, 0x24, 0
302}; 301};
303 302
304static u8 cg3regvals_rdi[] __initdata = { /* 640 x 480, cgRDI */ 303static u8 cg3regvals_rdi[] __devinitdata = { /* 640 x 480, cgRDI */
305 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, 304 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10,
306 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, 305 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51,
307 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, 306 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01,
308 0x10, 0x22, 0 307 0x10, 0x22, 0
309}; 308};
310 309
311static u8 *cg3_regvals[] __initdata = { 310static u8 *cg3_regvals[] __devinitdata = {
312 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi 311 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi
313}; 312};
314 313
315static u_char cg3_dacvals[] __initdata = { 314static u_char cg3_dacvals[] __devinitdata = {
316 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 315 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0
317}; 316};
318 317
319static void cg3_do_default_mode(struct cg3_par *par) 318static void __devinit cg3_do_default_mode(struct cg3_par *par)
320{ 319{
321 enum cg3_type type; 320 enum cg3_type type;
322 u8 *p; 321 u8 *p;
@@ -433,7 +432,8 @@ static int __devinit cg3_init_one(struct of_device *op)
433 return 0; 432 return 0;
434} 433}
435 434
436static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id *match) 435static int __devinit cg3_probe(struct of_device *dev,
436 const struct of_device_id *match)
437{ 437{
438 struct of_device *op = to_of_device(&dev->dev); 438 struct of_device *op = to_of_device(&dev->dev);
439 439
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 15854aec3180..1d4e8354b561 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -336,14 +336,30 @@ struct ffb_dac {
336 u32 value2; 336 u32 value2;
337}; 337};
338 338
339#define FFB_DAC_UCTRL 0x1001 /* User Control */
340#define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */
341#define FFB_DAC_UCTRL_MANREV_SHIFT 8
342#define FFB_DAC_TGEN 0x6000 /* Timing Generator */
343#define FFB_DAC_TGEN_VIDE 0x00000001 /* Video Enable */
344#define FFB_DAC_DID 0x8000 /* Device Identification */
345#define FFB_DAC_DID_PNUM 0x0ffff000 /* Device Part Number */
346#define FFB_DAC_DID_PNUM_SHIFT 12
347#define FFB_DAC_DID_REV 0xf0000000 /* Device Revision */
348#define FFB_DAC_DID_REV_SHIFT 28
349
350#define FFB_DAC_CUR_CTRL 0x100
351#define FFB_DAC_CUR_CTRL_P0 0x00000001
352#define FFB_DAC_CUR_CTRL_P1 0x00000002
353
339struct ffb_par { 354struct ffb_par {
340 spinlock_t lock; 355 spinlock_t lock;
341 struct ffb_fbc __iomem *fbc; 356 struct ffb_fbc __iomem *fbc;
342 struct ffb_dac __iomem *dac; 357 struct ffb_dac __iomem *dac;
343 358
344 u32 flags; 359 u32 flags;
345#define FFB_FLAG_AFB 0x00000001 360#define FFB_FLAG_AFB 0x00000001 /* AFB m3 or m6 */
346#define FFB_FLAG_BLANKED 0x00000002 361#define FFB_FLAG_BLANKED 0x00000002 /* screen is blanked */
362#define FFB_FLAG_INVCURSOR 0x00000004 /* DAC has inverted cursor logic */
347 363
348 u32 fg_cache __attribute__((aligned (8))); 364 u32 fg_cache __attribute__((aligned (8)));
349 u32 bg_cache; 365 u32 bg_cache;
@@ -354,7 +370,6 @@ struct ffb_par {
354 unsigned long physbase; 370 unsigned long physbase;
355 unsigned long fbsize; 371 unsigned long fbsize;
356 372
357 int dac_rev;
358 int board_type; 373 int board_type;
359}; 374};
360 375
@@ -426,11 +441,12 @@ static void ffb_switch_from_graph(struct ffb_par *par)
426 FFBWait(par); 441 FFBWait(par);
427 442
428 /* Disable cursor. */ 443 /* Disable cursor. */
429 upa_writel(0x100, &dac->type2); 444 upa_writel(FFB_DAC_CUR_CTRL, &dac->type2);
430 if (par->dac_rev <= 2) 445 if (par->flags & FFB_FLAG_INVCURSOR)
431 upa_writel(0, &dac->value2); 446 upa_writel(0, &dac->value2);
432 else 447 else
433 upa_writel(3, &dac->value2); 448 upa_writel((FFB_DAC_CUR_CTRL_P0 |
449 FFB_DAC_CUR_CTRL_P1), &dac->value2);
434 450
435 spin_unlock_irqrestore(&par->lock, flags); 451 spin_unlock_irqrestore(&par->lock, flags);
436} 452}
@@ -664,18 +680,18 @@ ffb_blank(int blank, struct fb_info *info)
664 struct ffb_par *par = (struct ffb_par *) info->par; 680 struct ffb_par *par = (struct ffb_par *) info->par;
665 struct ffb_dac __iomem *dac = par->dac; 681 struct ffb_dac __iomem *dac = par->dac;
666 unsigned long flags; 682 unsigned long flags;
667 u32 tmp; 683 u32 val;
684 int i;
668 685
669 spin_lock_irqsave(&par->lock, flags); 686 spin_lock_irqsave(&par->lock, flags);
670 687
671 FFBWait(par); 688 FFBWait(par);
672 689
690 upa_writel(FFB_DAC_TGEN, &dac->type);
691 val = upa_readl(&dac->value);
673 switch (blank) { 692 switch (blank) {
674 case FB_BLANK_UNBLANK: /* Unblanking */ 693 case FB_BLANK_UNBLANK: /* Unblanking */
675 upa_writel(0x6000, &dac->type); 694 val |= FFB_DAC_TGEN_VIDE;
676 tmp = (upa_readl(&dac->value) | 0x1);
677 upa_writel(0x6000, &dac->type);
678 upa_writel(tmp, &dac->value);
679 par->flags &= ~FFB_FLAG_BLANKED; 695 par->flags &= ~FFB_FLAG_BLANKED;
680 break; 696 break;
681 697
@@ -683,13 +699,16 @@ ffb_blank(int blank, struct fb_info *info)
683 case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ 699 case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
684 case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ 700 case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
685 case FB_BLANK_POWERDOWN: /* Poweroff */ 701 case FB_BLANK_POWERDOWN: /* Poweroff */
686 upa_writel(0x6000, &dac->type); 702 val &= ~FFB_DAC_TGEN_VIDE;
687 tmp = (upa_readl(&dac->value) & ~0x1);
688 upa_writel(0x6000, &dac->type);
689 upa_writel(tmp, &dac->value);
690 par->flags |= FFB_FLAG_BLANKED; 703 par->flags |= FFB_FLAG_BLANKED;
691 break; 704 break;
692 } 705 }
706 upa_writel(FFB_DAC_TGEN, &dac->type);
707 upa_writel(val, &dac->value);
708 for (i = 0; i < 10; i++) {
709 upa_writel(FFB_DAC_TGEN, &dac->type);
710 upa_readl(&dac->value);
711 }
693 712
694 spin_unlock_irqrestore(&par->lock, flags); 713 spin_unlock_irqrestore(&par->lock, flags);
695 714
@@ -894,6 +913,7 @@ static int ffb_init_one(struct of_device *op)
894 struct ffb_dac __iomem *dac; 913 struct ffb_dac __iomem *dac;
895 struct all_info *all; 914 struct all_info *all;
896 int err; 915 int err;
916 u32 dac_pnum, dac_rev, dac_mrev;
897 917
898 all = kzalloc(sizeof(*all), GFP_KERNEL); 918 all = kzalloc(sizeof(*all), GFP_KERNEL);
899 if (!all) 919 if (!all)
@@ -948,17 +968,31 @@ static int ffb_init_one(struct of_device *op)
948 if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) 968 if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0)
949 upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); 969 upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr);
950 970
951 ffb_switch_from_graph(&all->par);
952
953 dac = all->par.dac; 971 dac = all->par.dac;
954 upa_writel(0x8000, &dac->type); 972 upa_writel(FFB_DAC_DID, &dac->type);
955 all->par.dac_rev = upa_readl(&dac->value) >> 0x1c; 973 dac_pnum = upa_readl(&dac->value);
974 dac_rev = (dac_pnum & FFB_DAC_DID_REV) >> FFB_DAC_DID_REV_SHIFT;
975 dac_pnum = (dac_pnum & FFB_DAC_DID_PNUM) >> FFB_DAC_DID_PNUM_SHIFT;
976
977 upa_writel(FFB_DAC_UCTRL, &dac->type);
978 dac_mrev = upa_readl(&dac->value);
979 dac_mrev = (dac_mrev & FFB_DAC_UCTRL_MANREV) >>
980 FFB_DAC_UCTRL_MANREV_SHIFT;
956 981
957 /* Elite3D has different DAC revision numbering, and no DAC revisions 982 /* Elite3D has different DAC revision numbering, and no DAC revisions
958 * have the reversed meaning of cursor enable. 983 * have the reversed meaning of cursor enable. Otherwise, Pacifica 1
984 * ramdacs with manufacturing revision less than 3 have inverted
985 * cursor logic. We identify Pacifica 1 as not Pacifica 2, the
986 * latter having a part number value of 0x236e.
959 */ 987 */
960 if (all->par.flags & FFB_FLAG_AFB) 988 if ((all->par.flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) {
961 all->par.dac_rev = 10; 989 all->par.flags &= ~FFB_FLAG_INVCURSOR;
990 } else {
991 if (dac_mrev < 3)
992 all->par.flags |= FFB_FLAG_INVCURSOR;
993 }
994
995 ffb_switch_from_graph(&all->par);
962 996
963 /* Unblank it just to be sure. When there are multiple 997 /* Unblank it just to be sure. When there are multiple
964 * FFB/AFB cards in the system, or it is not the OBP 998 * FFB/AFB cards in the system, or it is not the OBP
@@ -993,10 +1027,12 @@ static int ffb_init_one(struct of_device *op)
993 1027
994 dev_set_drvdata(&op->dev, all); 1028 dev_set_drvdata(&op->dev, all);
995 1029
996 printk("%s: %s at %016lx, type %d, DAC revision %d\n", 1030 printk("%s: %s at %016lx, type %d, "
1031 "DAC pnum[%x] rev[%d] manuf_rev[%d]\n",
997 dp->full_name, 1032 dp->full_name,
998 ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), 1033 ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"),
999 all->par.physbase, all->par.board_type, all->par.dac_rev); 1034 all->par.physbase, all->par.board_type,
1035 dac_pnum, dac_rev, dac_mrev);
1000 1036
1001 return 0; 1037 return 0;
1002} 1038}
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 1d1c7c624d7f..d7ece8d17a2c 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -285,8 +285,6 @@ static const struct riva_regs reg_template = {
285#define MAX_LEVEL 0x534 285#define MAX_LEVEL 0x534
286#define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX) 286#define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX)
287 287
288static struct backlight_properties riva_bl_data;
289
290static int riva_bl_get_level_brightness(struct riva_par *par, 288static int riva_bl_get_level_brightness(struct riva_par *par,
291 int level) 289 int level)
292{ 290{
@@ -372,7 +370,7 @@ static void riva_bl_init(struct riva_par *par)
372 FB_BACKLIGHT_MAX); 370 FB_BACKLIGHT_MAX);
373 371
374 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; 372 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
375 bd->props.brightness = riva_bl_data.max_brightness; 373 bd->props.brightness = bd->props.max_brightness;
376 bd->props.power = FB_BLANK_UNBLANK; 374 bd->props.power = FB_BLANK_UNBLANK;
377 backlight_update_status(bd); 375 backlight_update_status(bd);
378 376
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 98919a6975f0..3091b20124b4 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -1000,11 +1000,12 @@ err_enable_device:
1000static void __devexit s3_pci_remove(struct pci_dev *dev) 1000static void __devexit s3_pci_remove(struct pci_dev *dev)
1001{ 1001{
1002 struct fb_info *info = pci_get_drvdata(dev); 1002 struct fb_info *info = pci_get_drvdata(dev);
1003 struct s3fb_info *par = info->par;
1004 1003
1005 if (info) { 1004 if (info) {
1006 1005
1007#ifdef CONFIG_MTRR 1006#ifdef CONFIG_MTRR
1007 struct s3fb_info *par = info->par;
1008
1008 if (par->mtrr_reg >= 0) { 1009 if (par->mtrr_reg >= 0) {
1009 mtrr_del(par->mtrr_reg, 0, 0); 1010 mtrr_del(par->mtrr_reg, 0, 0);
1010 par->mtrr_reg = -1; 1011 par->mtrr_reg = -1;
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 4afa30522fdb..0166ec2ccf32 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -384,6 +384,19 @@ SavageSetup2DEngine(struct savagefb_par *par)
384 BCI_SEND(0); 384 BCI_SEND(0);
385 BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); 385 BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2);
386 BCI_SEND(GlobalBitmapDescriptor); 386 BCI_SEND(GlobalBitmapDescriptor);
387
388 /*
389 * I don't know why, sending this twice fixes the intial black screen,
390 * prevents X from crashing at least in Toshiba laptops with SavageIX.
391 * --Tony
392 */
393 par->bci_ptr = 0;
394 par->SavageWaitFifo(par, 4);
395
396 BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD1);
397 BCI_SEND(0);
398 BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2);
399 BCI_SEND(GlobalBitmapDescriptor);
387} 400}
388 401
389static void savagefb_set_clip(struct fb_info *info) 402static void savagefb_set_clip(struct fb_info *info)
@@ -496,7 +509,7 @@ static int common_calc_clock(long freq, int min_m, int min_n1, int max_n1,
496#ifdef SAVAGEFB_DEBUG 509#ifdef SAVAGEFB_DEBUG
497/* This function is used to debug, it prints out the contents of s3 regs */ 510/* This function is used to debug, it prints out the contents of s3 regs */
498 511
499static void SavagePrintRegs(void) 512static void SavagePrintRegs(struct savagefb_par *par)
500{ 513{
501 unsigned char i; 514 unsigned char i;
502 int vgaCRIndex = 0x3d4; 515 int vgaCRIndex = 0x3d4;
@@ -1525,7 +1538,7 @@ static int savagefb_set_par(struct fb_info *info)
1525 savagefb_set_fix(info); 1538 savagefb_set_fix(info);
1526 savagefb_set_clip(info); 1539 savagefb_set_clip(info);
1527 1540
1528 SavagePrintRegs(); 1541 SavagePrintRegs(par);
1529 return 0; 1542 return 0;
1530} 1543}
1531 1544
@@ -2155,7 +2168,6 @@ static int __devinit savagefb_probe(struct pci_dev* dev,
2155 int video_len; 2168 int video_len;
2156 2169
2157 DBG("savagefb_probe"); 2170 DBG("savagefb_probe");
2158 SavagePrintRegs();
2159 2171
2160 info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev); 2172 info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev);
2161 if (!info) 2173 if (!info)
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index 59cd1e750f30..62fa5500361d 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -257,6 +257,7 @@ static void __sst_dac_write(u8 __iomem *vbase, u8 reg, u8 val)
257 r_dprintk("sst_dac_write(%#x, %#x)\n", reg, val); 257 r_dprintk("sst_dac_write(%#x, %#x)\n", reg, val);
258 reg &= 0x07; 258 reg &= 0x07;
259 __sst_write(vbase, DAC_DATA,(((u32)reg << 8)) | (u32)val); 259 __sst_write(vbase, DAC_DATA,(((u32)reg << 8)) | (u32)val);
260 __sst_wait_idle(vbase);
260} 261}
261 262
262/* indexed access to ti/att dacs */ 263/* indexed access to ti/att dacs */
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index 8ada4c5c5d70..6a82d39dc498 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -40,7 +40,6 @@
40extern struct file_system_type v9fs_fs_type; 40extern struct file_system_type v9fs_fs_type;
41extern const struct address_space_operations v9fs_addr_operations; 41extern const struct address_space_operations v9fs_addr_operations;
42extern const struct file_operations v9fs_file_operations; 42extern const struct file_operations v9fs_file_operations;
43extern const struct file_operations v9fs_cached_file_operations;
44extern const struct file_operations v9fs_dir_operations; 43extern const struct file_operations v9fs_dir_operations;
45extern struct dentry_operations v9fs_dentry_operations; 44extern struct dentry_operations v9fs_dentry_operations;
46extern struct dentry_operations v9fs_cached_dentry_operations; 45extern struct dentry_operations v9fs_cached_dentry_operations;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 653dfa5b2531..c7b677253843 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -42,6 +42,8 @@
42#include "v9fs_vfs.h" 42#include "v9fs_vfs.h"
43#include "fid.h" 43#include "fid.h"
44 44
45static const struct file_operations v9fs_cached_file_operations;
46
45/** 47/**
46 * v9fs_file_open - open a file (or directory) 48 * v9fs_file_open - open a file (or directory)
47 * @inode: inode to be opened 49 * @inode: inode to be opened
@@ -245,7 +247,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
245 return total; 247 return total;
246} 248}
247 249
248const struct file_operations v9fs_cached_file_operations = { 250static const struct file_operations v9fs_cached_file_operations = {
249 .llseek = generic_file_llseek, 251 .llseek = generic_file_llseek,
250 .read = do_sync_read, 252 .read = do_sync_read,
251 .aio_read = generic_file_aio_read, 253 .aio_read = generic_file_aio_read,
diff --git a/fs/aio.c b/fs/aio.c
index 0b4ee0a5c83e..e4598d6d49dd 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -136,7 +136,6 @@ static int aio_setup_ring(struct kioctx *ctx)
136 0); 136 0);
137 if (IS_ERR((void *)info->mmap_base)) { 137 if (IS_ERR((void *)info->mmap_base)) {
138 up_write(&ctx->mm->mmap_sem); 138 up_write(&ctx->mm->mmap_sem);
139 printk("mmap err: %ld\n", -info->mmap_base);
140 info->mmap_size = 0; 139 info->mmap_size = 0;
141 aio_free_ring(ctx); 140 aio_free_ring(ctx);
142 return -EAGAIN; 141 return -EAGAIN;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 51db1182b27e..9cc4f0a8aaae 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -507,7 +507,7 @@ out:
507#define INTERPRETER_ELF 2 507#define INTERPRETER_ELF 2
508 508
509#ifndef STACK_RND_MASK 509#ifndef STACK_RND_MASK
510#define STACK_RND_MASK 0x7ff /* with 4K pages 8MB of VA */ 510#define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) /* 8MB of VA */
511#endif 511#endif
512 512
513static unsigned long randomize_stack_top(unsigned long stack_top) 513static unsigned long randomize_stack_top(unsigned long stack_top)
@@ -1704,7 +1704,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1704 DUMP_SEEK(PAGE_SIZE); 1704 DUMP_SEEK(PAGE_SIZE);
1705 } else { 1705 } else {
1706 if (page == ZERO_PAGE(addr)) { 1706 if (page == ZERO_PAGE(addr)) {
1707 DUMP_SEEK(PAGE_SIZE); 1707 if (!dump_seek(file, PAGE_SIZE)) {
1708 page_cache_release(page);
1709 goto end_coredump;
1710 }
1708 } else { 1711 } else {
1709 void *kaddr; 1712 void *kaddr;
1710 flush_cache_page(vma, addr, 1713 flush_cache_page(vma, addr,
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 5810aa1339fd..f3ddca4a387b 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -179,6 +179,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
179 int executable_stack; 179 int executable_stack;
180 int retval, i; 180 int retval, i;
181 181
182 kdebug("____ LOAD %d ____", current->pid);
183
182 memset(&exec_params, 0, sizeof(exec_params)); 184 memset(&exec_params, 0, sizeof(exec_params));
183 memset(&interp_params, 0, sizeof(interp_params)); 185 memset(&interp_params, 0, sizeof(interp_params));
184 186
@@ -941,8 +943,11 @@ static int elf_fdpic_map_file_constdisp_on_uclinux(
941 943
942 if (mm) { 944 if (mm) {
943 if (phdr->p_flags & PF_X) { 945 if (phdr->p_flags & PF_X) {
944 mm->start_code = seg->addr; 946 if (!mm->start_code) {
945 mm->end_code = seg->addr + phdr->p_memsz; 947 mm->start_code = seg->addr;
948 mm->end_code = seg->addr +
949 phdr->p_memsz;
950 }
946 } else if (!mm->start_data) { 951 } else if (!mm->start_data) {
947 mm->start_data = seg->addr; 952 mm->start_data = seg->addr;
948#ifndef CONFIG_MMU 953#ifndef CONFIG_MMU
@@ -1123,8 +1128,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1123 1128
1124 if (mm) { 1129 if (mm) {
1125 if (phdr->p_flags & PF_X) { 1130 if (phdr->p_flags & PF_X) {
1126 mm->start_code = maddr; 1131 if (!mm->start_code) {
1127 mm->end_code = maddr + phdr->p_memsz; 1132 mm->start_code = maddr;
1133 mm->end_code = maddr + phdr->p_memsz;
1134 }
1128 } else if (!mm->start_data) { 1135 } else if (!mm->start_data) {
1129 mm->start_data = maddr; 1136 mm->start_data = maddr;
1130 mm->end_data = maddr + phdr->p_memsz; 1137 mm->end_data = maddr + phdr->p_memsz;
@@ -1473,8 +1480,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
1473 DUMP_SEEK(file->f_pos + PAGE_SIZE); 1480 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1474 } 1481 }
1475 else if (page == ZERO_PAGE(addr)) { 1482 else if (page == ZERO_PAGE(addr)) {
1476 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1477 page_cache_release(page); 1483 page_cache_release(page);
1484 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1478 } 1485 }
1479 else { 1486 else {
1480 void *kaddr; 1487 void *kaddr;
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 78ced721554d..164a45cdaf5f 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -109,8 +109,6 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
109 /* temporary */ 109 /* temporary */
110 if (major == 0) { 110 if (major == 0) {
111 for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) { 111 for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
112 if (is_lanana_major(i))
113 continue;
114 if (chrdevs[i] == NULL) 112 if (chrdevs[i] == NULL)
115 break; 113 break;
116 } 114 }
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 6247628bdaed..5d1f4873d701 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -4,6 +4,12 @@ Fix mtime bouncing around from local idea of last write times to remote time.
4Fix hang (in i_size_read) when simultaneous size update of same remote file 4Fix hang (in i_size_read) when simultaneous size update of same remote file
5on smp system corrupts sequence number. Do not reread unnecessarily partial page 5on smp system corrupts sequence number. Do not reread unnecessarily partial page
6(which we are about to overwrite anyway) when writing out file opened rw. 6(which we are about to overwrite anyway) when writing out file opened rw.
7When DOS attribute of file on non-Unix server's file changes on the server side
8from read-only back to read-write, reflect this change in default file mode
9(we had been leaving a file's mode read-only until the inode were reloaded).
10Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute
11when archive dos attribute not set and we are changing mode back to writeable
12on server which does not support the Unix Extensions).
7 13
8Version 1.47 14Version 1.47
9------------ 15------------
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 0efdf35aab2c..4d8948e8762c 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -220,7 +220,7 @@
220 */ 220 */
221#define CIFS_NO_HANDLE 0xFFFF 221#define CIFS_NO_HANDLE 0xFFFF
222 222
223#define NO_CHANGE_64 0xFFFFFFFFFFFFFFFFULL 223#define NO_CHANGE_64 cpu_to_le64(0xFFFFFFFFFFFFFFFFULL)
224#define NO_CHANGE_32 0xFFFFFFFFUL 224#define NO_CHANGE_32 0xFFFFFFFFUL
225 225
226/* IPC$ in ASCII */ 226/* IPC$ in ASCII */
@@ -1887,7 +1887,13 @@ typedef struct {
1887 calls including posix open 1887 calls including posix open
1888 and posix unlink */ 1888 and posix unlink */
1889#ifdef CONFIG_CIFS_POSIX 1889#ifdef CONFIG_CIFS_POSIX
1890#define CIFS_UNIX_CAP_MASK 0x0000003b 1890/* Can not set pathnames cap yet until we send new posix create SMB since
1891 otherwise server can treat such handles opened with older ntcreatex
1892 (by a new client which knows how to send posix path ops)
1893 as non-posix handles (can affect write behavior with byte range locks.
1894 We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
1895/* #define CIFS_UNIX_CAP_MASK 0x0000003b */
1896#define CIFS_UNIX_CAP_MASK 0x0000001b
1891#else 1897#else
1892#define CIFS_UNIX_CAP_MASK 0x00000013 1898#define CIFS_UNIX_CAP_MASK 0x00000013
1893#endif /* CONFIG_CIFS_POSIX */ 1899#endif /* CONFIG_CIFS_POSIX */
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 86b9dbbd8441..f414526e476a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -494,6 +494,12 @@ int cifs_get_inode_info(struct inode **pinode,
494 mode e.g. 555 */ 494 mode e.g. 555 */
495 if (cifsInfo->cifsAttrs & ATTR_READONLY) 495 if (cifsInfo->cifsAttrs & ATTR_READONLY)
496 inode->i_mode &= ~(S_IWUGO); 496 inode->i_mode &= ~(S_IWUGO);
497 else if ((inode->i_mode & S_IWUGO) == 0)
498 /* the ATTR_READONLY flag may have been */
499 /* changed on server -- set any w bits */
500 /* allowed by mnt_file_mode */
501 inode->i_mode |= (S_IWUGO &
502 cifs_sb->mnt_file_mode);
497 /* BB add code here - 503 /* BB add code here -
498 validate if device or weird share or device type? */ 504 validate if device or weird share or device type? */
499 } 505 }
@@ -1190,6 +1196,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1190 struct cifsFileInfo *open_file = NULL; 1196 struct cifsFileInfo *open_file = NULL;
1191 FILE_BASIC_INFO time_buf; 1197 FILE_BASIC_INFO time_buf;
1192 int set_time = FALSE; 1198 int set_time = FALSE;
1199 int set_dosattr = FALSE;
1193 __u64 mode = 0xFFFFFFFFFFFFFFFFULL; 1200 __u64 mode = 0xFFFFFFFFFFFFFFFFULL;
1194 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1201 __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
1195 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1202 __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
@@ -1326,15 +1333,23 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1326 else if (attrs->ia_valid & ATTR_MODE) { 1333 else if (attrs->ia_valid & ATTR_MODE) {
1327 rc = 0; 1334 rc = 0;
1328 if ((mode & S_IWUGO) == 0) /* not writeable */ { 1335 if ((mode & S_IWUGO) == 0) /* not writeable */ {
1329 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) 1336 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
1337 set_dosattr = TRUE;
1330 time_buf.Attributes = 1338 time_buf.Attributes =
1331 cpu_to_le32(cifsInode->cifsAttrs | 1339 cpu_to_le32(cifsInode->cifsAttrs |
1332 ATTR_READONLY); 1340 ATTR_READONLY);
1341 }
1333 } else if ((mode & S_IWUGO) == S_IWUGO) { 1342 } else if ((mode & S_IWUGO) == S_IWUGO) {
1334 if (cifsInode->cifsAttrs & ATTR_READONLY) 1343 if (cifsInode->cifsAttrs & ATTR_READONLY) {
1344 set_dosattr = TRUE;
1335 time_buf.Attributes = 1345 time_buf.Attributes =
1336 cpu_to_le32(cifsInode->cifsAttrs & 1346 cpu_to_le32(cifsInode->cifsAttrs &
1337 (~ATTR_READONLY)); 1347 (~ATTR_READONLY));
1348 /* Windows ignores set to zero */
1349 if(time_buf.Attributes == 0)
1350 time_buf.Attributes |=
1351 cpu_to_le32(ATTR_NORMAL);
1352 }
1338 } 1353 }
1339 /* BB to be implemented - 1354 /* BB to be implemented -
1340 via Windows security descriptors or streams */ 1355 via Windows security descriptors or streams */
@@ -1372,7 +1387,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1372 } else 1387 } else
1373 time_buf.ChangeTime = 0; 1388 time_buf.ChangeTime = 0;
1374 1389
1375 if (set_time || time_buf.Attributes) { 1390 if (set_time || set_dosattr) {
1376 time_buf.CreationTime = 0; /* do not change */ 1391 time_buf.CreationTime = 0; /* do not change */
1377 /* In the future we should experiment - try setting timestamps 1392 /* In the future we should experiment - try setting timestamps
1378 via Handle (SetFileInfo) instead of by path */ 1393 via Handle (SetFileInfo) instead of by path */
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 44cfb528797d..2a374d5215ab 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -219,6 +219,10 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
219 tmp_inode->i_mode |= S_IFREG; 219 tmp_inode->i_mode |= S_IFREG;
220 if (attr & ATTR_READONLY) 220 if (attr & ATTR_READONLY)
221 tmp_inode->i_mode &= ~(S_IWUGO); 221 tmp_inode->i_mode &= ~(S_IWUGO);
222 else if ((tmp_inode->i_mode & S_IWUGO) == 0)
223 /* the ATTR_READONLY flag may have been changed on */
224 /* server -- set any w bits allowed by mnt_file_mode */
225 tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode);
222 } /* could add code here - to validate if device or weird share type? */ 226 } /* could add code here - to validate if device or weird share type? */
223 227
224 /* can not fill in nlink here as in qpathinfo version and Unx search */ 228 /* can not fill in nlink here as in qpathinfo version and Unx search */
diff --git a/fs/compat.c b/fs/compat.c
index 0ec70e3cee0a..040a8be38a48 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -48,6 +48,7 @@
48#include <linux/highmem.h> 48#include <linux/highmem.h>
49#include <linux/poll.h> 49#include <linux/poll.h>
50#include <linux/mm.h> 50#include <linux/mm.h>
51#include <linux/eventpoll.h>
51 52
52#include <net/sock.h> /* siocdevprivate_ioctl */ 53#include <net/sock.h> /* siocdevprivate_ioctl */
53 54
@@ -2235,3 +2236,102 @@ long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2)
2235 return sys_ni_syscall(); 2236 return sys_ni_syscall();
2236} 2237}
2237#endif 2238#endif
2239
2240#ifdef CONFIG_EPOLL
2241
2242#ifdef CONFIG_HAS_COMPAT_EPOLL_EVENT
2243asmlinkage long compat_sys_epoll_ctl(int epfd, int op, int fd,
2244 struct compat_epoll_event __user *event)
2245{
2246 long err = 0;
2247 struct compat_epoll_event user;
2248 struct epoll_event __user *kernel = NULL;
2249
2250 if (event) {
2251 if (copy_from_user(&user, event, sizeof(user)))
2252 return -EFAULT;
2253 kernel = compat_alloc_user_space(sizeof(struct epoll_event));
2254 err |= __put_user(user.events, &kernel->events);
2255 err |= __put_user(user.data, &kernel->data);
2256 }
2257
2258 return err ? err : sys_epoll_ctl(epfd, op, fd, kernel);
2259}
2260
2261
2262asmlinkage long compat_sys_epoll_wait(int epfd,
2263 struct compat_epoll_event __user *events,
2264 int maxevents, int timeout)
2265{
2266 long i, ret, err = 0;
2267 struct epoll_event __user *kbuf;
2268 struct epoll_event ev;
2269
2270 if ((maxevents <= 0) ||
2271 (maxevents > (INT_MAX / sizeof(struct epoll_event))))
2272 return -EINVAL;
2273 kbuf = compat_alloc_user_space(sizeof(struct epoll_event) * maxevents);
2274 ret = sys_epoll_wait(epfd, kbuf, maxevents, timeout);
2275 for (i = 0; i < ret; i++) {
2276 err |= __get_user(ev.events, &kbuf[i].events);
2277 err |= __get_user(ev.data, &kbuf[i].data);
2278 err |= __put_user(ev.events, &events->events);
2279 err |= __put_user_unaligned(ev.data, &events->data);
2280 events++;
2281 }
2282
2283 return err ? -EFAULT: ret;
2284}
2285#endif /* CONFIG_HAS_COMPAT_EPOLL_EVENT */
2286
2287#ifdef TIF_RESTORE_SIGMASK
2288asmlinkage long compat_sys_epoll_pwait(int epfd,
2289 struct compat_epoll_event __user *events,
2290 int maxevents, int timeout,
2291 const compat_sigset_t __user *sigmask,
2292 compat_size_t sigsetsize)
2293{
2294 long err;
2295 compat_sigset_t csigmask;
2296 sigset_t ksigmask, sigsaved;
2297
2298 /*
2299 * If the caller wants a certain signal mask to be set during the wait,
2300 * we apply it here.
2301 */
2302 if (sigmask) {
2303 if (sigsetsize != sizeof(compat_sigset_t))
2304 return -EINVAL;
2305 if (copy_from_user(&csigmask, sigmask, sizeof(csigmask)))
2306 return -EFAULT;
2307 sigset_from_compat(&ksigmask, &csigmask);
2308 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
2309 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
2310 }
2311
2312#ifdef CONFIG_HAS_COMPAT_EPOLL_EVENT
2313 err = compat_sys_epoll_wait(epfd, events, maxevents, timeout);
2314#else
2315 err = sys_epoll_wait(epfd, events, maxevents, timeout);
2316#endif
2317
2318 /*
2319 * If we changed the signal mask, we need to restore the original one.
2320 * In case we've got a signal while waiting, we do not restore the
2321 * signal mask yet, and we allow do_signal() to deliver the signal on
2322 * the way back to userspace, before the signal mask is restored.
2323 */
2324 if (sigmask) {
2325 if (err == -EINTR) {
2326 memcpy(&current->saved_sigmask, &sigsaved,
2327 sizeof(sigsaved));
2328 set_thread_flag(TIF_RESTORE_SIGMASK);
2329 } else
2330 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
2331 }
2332
2333 return err;
2334}
2335#endif /* TIF_RESTORE_SIGMASK */
2336
2337#endif /* CONFIG_EPOLL */
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index c81c958b3e1d..8b1c5d8bf4ef 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -2553,11 +2553,15 @@ HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl)
2553HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl) 2553HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl)
2554/* wireless */ 2554/* wireless */
2555HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl) 2555HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl)
2556HANDLE_IOCTL(SIOCGIWPRIV, do_wireless_ioctl)
2557HANDLE_IOCTL(SIOCGIWSTATS, do_wireless_ioctl)
2556HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl) 2558HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl)
2557HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl) 2559HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl)
2558HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl) 2560HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl)
2559HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl) 2561HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl)
2562HANDLE_IOCTL(SIOCSIWMLME, do_wireless_ioctl)
2560HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl) 2563HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl)
2564HANDLE_IOCTL(SIOCSIWSCAN, do_wireless_ioctl)
2561HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl) 2565HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl)
2562HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl) 2566HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl)
2563HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl) 2567HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl)
@@ -2565,6 +2569,11 @@ HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl)
2565HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl) 2569HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl)
2566HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) 2570HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl)
2567HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) 2571HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl)
2572HANDLE_IOCTL(SIOCSIWGENIE, do_wireless_ioctl)
2573HANDLE_IOCTL(SIOCGIWGENIE, do_wireless_ioctl)
2574HANDLE_IOCTL(SIOCSIWENCODEEXT, do_wireless_ioctl)
2575HANDLE_IOCTL(SIOCGIWENCODEEXT, do_wireless_ioctl)
2576HANDLE_IOCTL(SIOCSIWPMKSA, do_wireless_ioctl)
2568HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) 2577HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl)
2569HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) 2578HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl)
2570HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl) 2579HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl)
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 34750d5e4ff2..5e6e37e58f36 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1141,25 +1141,22 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1141 1141
1142 err = -ENOMEM; 1142 err = -ENOMEM;
1143 dentry = d_alloc(configfs_sb->s_root, &name); 1143 dentry = d_alloc(configfs_sb->s_root, &name);
1144 if (!dentry) 1144 if (dentry) {
1145 goto out_release; 1145 d_add(dentry, NULL);
1146
1147 d_add(dentry, NULL);
1148 1146
1149 err = configfs_attach_group(sd->s_element, &group->cg_item, 1147 err = configfs_attach_group(sd->s_element, &group->cg_item,
1150 dentry); 1148 dentry);
1151 if (!err) 1149 if (err) {
1152 dentry = NULL; 1150 d_delete(dentry);
1153 else 1151 dput(dentry);
1154 d_delete(dentry); 1152 }
1153 }
1155 1154
1156 mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex); 1155 mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
1157 1156
1158 if (dentry) { 1157 if (err) {
1159 dput(dentry); 1158 unlink_group(group);
1160out_release: 1159 configfs_release_fs();
1161 unlink_group(group);
1162 configfs_release_fs();
1163 } 1160 }
1164 1161
1165 return err; 1162 return err;
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 40db61dc95f2..3870150b83a4 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -22,6 +22,7 @@
22#include "lockspace.h" 22#include "lockspace.h"
23#include "lock.h" 23#include "lock.h"
24#include "lvb_table.h" 24#include "lvb_table.h"
25#include "user.h"
25 26
26static const char *name_prefix="dlm"; 27static const char *name_prefix="dlm";
27static struct miscdevice ctl_device; 28static struct miscdevice ctl_device;
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 329efcd3d8c9..cb20b964419f 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -78,18 +78,13 @@ struct kmem_cache *ecryptfs_dentry_info_cache;
78 */ 78 */
79static void ecryptfs_d_release(struct dentry *dentry) 79static void ecryptfs_d_release(struct dentry *dentry)
80{ 80{
81 struct dentry *lower_dentry; 81 if (ecryptfs_dentry_to_private(dentry)) {
82 82 if (ecryptfs_dentry_to_lower(dentry)) {
83 lower_dentry = ecryptfs_dentry_to_lower(dentry); 83 mntput(ecryptfs_dentry_to_lower_mnt(dentry));
84 if (ecryptfs_dentry_to_private(dentry)) 84 dput(ecryptfs_dentry_to_lower(dentry));
85 }
85 kmem_cache_free(ecryptfs_dentry_info_cache, 86 kmem_cache_free(ecryptfs_dentry_info_cache,
86 ecryptfs_dentry_to_private(dentry)); 87 ecryptfs_dentry_to_private(dentry));
87 if (lower_dentry) {
88 struct vfsmount *lower_mnt =
89 ecryptfs_dentry_to_lower_mnt(dentry);
90
91 mntput(lower_mnt);
92 dput(lower_dentry);
93 } 88 }
94 return; 89 return;
95} 90}
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index e62f3fc7241e..1548be26b5e6 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -38,7 +38,7 @@ static struct dentry *lock_parent(struct dentry *dentry)
38 struct dentry *dir; 38 struct dentry *dir;
39 39
40 dir = dget(dentry->d_parent); 40 dir = dget(dentry->d_parent);
41 mutex_lock(&(dir->d_inode->i_mutex)); 41 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT);
42 return dir; 42 return dir;
43} 43}
44 44
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 8a824f4ce5c6..a5b150f7e8a2 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1148,102 +1148,37 @@ static int do_journal_get_write_access(handle_t *handle,
1148 return ext3_journal_get_write_access(handle, bh); 1148 return ext3_journal_get_write_access(handle, bh);
1149} 1149}
1150 1150
1151/*
1152 * The idea of this helper function is following:
1153 * if prepare_write has allocated some blocks, but not all of them, the
1154 * transaction must include the content of the newly allocated blocks.
1155 * This content is expected to be set to zeroes by block_prepare_write().
1156 * 2006/10/14 SAW
1157 */
1158static int ext3_prepare_failure(struct file *file, struct page *page,
1159 unsigned from, unsigned to)
1160{
1161 struct address_space *mapping;
1162 struct buffer_head *bh, *head, *next;
1163 unsigned block_start, block_end;
1164 unsigned blocksize;
1165 int ret;
1166 handle_t *handle = ext3_journal_current_handle();
1167
1168 mapping = page->mapping;
1169 if (ext3_should_writeback_data(mapping->host)) {
1170 /* optimization: no constraints about data */
1171skip:
1172 return ext3_journal_stop(handle);
1173 }
1174
1175 head = page_buffers(page);
1176 blocksize = head->b_size;
1177 for ( bh = head, block_start = 0;
1178 bh != head || !block_start;
1179 block_start = block_end, bh = next)
1180 {
1181 next = bh->b_this_page;
1182 block_end = block_start + blocksize;
1183 if (block_end <= from)
1184 continue;
1185 if (block_start >= to) {
1186 block_start = to;
1187 break;
1188 }
1189 if (!buffer_mapped(bh))
1190 /* prepare_write failed on this bh */
1191 break;
1192 if (ext3_should_journal_data(mapping->host)) {
1193 ret = do_journal_get_write_access(handle, bh);
1194 if (ret) {
1195 ext3_journal_stop(handle);
1196 return ret;
1197 }
1198 }
1199 /*
1200 * block_start here becomes the first block where the current iteration
1201 * of prepare_write failed.
1202 */
1203 }
1204 if (block_start <= from)
1205 goto skip;
1206
1207 /* commit allocated and zeroed buffers */
1208 return mapping->a_ops->commit_write(file, page, from, block_start);
1209}
1210
1211static int ext3_prepare_write(struct file *file, struct page *page, 1151static int ext3_prepare_write(struct file *file, struct page *page,
1212 unsigned from, unsigned to) 1152 unsigned from, unsigned to)
1213{ 1153{
1214 struct inode *inode = page->mapping->host; 1154 struct inode *inode = page->mapping->host;
1215 int ret, ret2; 1155 int ret, needed_blocks = ext3_writepage_trans_blocks(inode);
1216 int needed_blocks = ext3_writepage_trans_blocks(inode);
1217 handle_t *handle; 1156 handle_t *handle;
1218 int retries = 0; 1157 int retries = 0;
1219 1158
1220retry: 1159retry:
1221 handle = ext3_journal_start(inode, needed_blocks); 1160 handle = ext3_journal_start(inode, needed_blocks);
1222 if (IS_ERR(handle)) 1161 if (IS_ERR(handle)) {
1223 return PTR_ERR(handle); 1162 ret = PTR_ERR(handle);
1163 goto out;
1164 }
1224 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) 1165 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
1225 ret = nobh_prepare_write(page, from, to, ext3_get_block); 1166 ret = nobh_prepare_write(page, from, to, ext3_get_block);
1226 else 1167 else
1227 ret = block_prepare_write(page, from, to, ext3_get_block); 1168 ret = block_prepare_write(page, from, to, ext3_get_block);
1228 if (ret) 1169 if (ret)
1229 goto failure; 1170 goto prepare_write_failed;
1230 1171
1231 if (ext3_should_journal_data(inode)) { 1172 if (ext3_should_journal_data(inode)) {
1232 ret = walk_page_buffers(handle, page_buffers(page), 1173 ret = walk_page_buffers(handle, page_buffers(page),
1233 from, to, NULL, do_journal_get_write_access); 1174 from, to, NULL, do_journal_get_write_access);
1234 if (ret)
1235 /* fatal error, just put the handle and return */
1236 journal_stop(handle);
1237 } 1175 }
1238 return ret; 1176prepare_write_failed:
1239 1177 if (ret)
1240failure: 1178 ext3_journal_stop(handle);
1241 ret2 = ext3_prepare_failure(file, page, from, to);
1242 if (ret2 < 0)
1243 return ret2;
1244 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) 1179 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
1245 goto retry; 1180 goto retry;
1246 /* retry number exceeded, or other error like -EDQUOT */ 1181out:
1247 return ret; 1182 return ret;
1248} 1183}
1249 1184
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 12f7dda1232c..f58cbb26323e 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -495,7 +495,8 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
495 BHDR(bh)->h_refcount = cpu_to_le32( 495 BHDR(bh)->h_refcount = cpu_to_le32(
496 le32_to_cpu(BHDR(bh)->h_refcount) - 1); 496 le32_to_cpu(BHDR(bh)->h_refcount) - 1);
497 error = ext3_journal_dirty_metadata(handle, bh); 497 error = ext3_journal_dirty_metadata(handle, bh);
498 handle->h_sync = 1; 498 if (IS_SYNC(inode))
499 handle->h_sync = 1;
499 DQUOT_FREE_BLOCK(inode, 1); 500 DQUOT_FREE_BLOCK(inode, 1);
500 ea_bdebug(bh, "refcount now=%d; releasing", 501 ea_bdebug(bh, "refcount now=%d; releasing",
501 le32_to_cpu(BHDR(bh)->h_refcount)); 502 le32_to_cpu(BHDR(bh)->h_refcount));
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fbff4b9e122a..810b6d6474bf 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1147,102 +1147,37 @@ static int do_journal_get_write_access(handle_t *handle,
1147 return ext4_journal_get_write_access(handle, bh); 1147 return ext4_journal_get_write_access(handle, bh);
1148} 1148}
1149 1149
1150/*
1151 * The idea of this helper function is following:
1152 * if prepare_write has allocated some blocks, but not all of them, the
1153 * transaction must include the content of the newly allocated blocks.
1154 * This content is expected to be set to zeroes by block_prepare_write().
1155 * 2006/10/14 SAW
1156 */
1157static int ext4_prepare_failure(struct file *file, struct page *page,
1158 unsigned from, unsigned to)
1159{
1160 struct address_space *mapping;
1161 struct buffer_head *bh, *head, *next;
1162 unsigned block_start, block_end;
1163 unsigned blocksize;
1164 int ret;
1165 handle_t *handle = ext4_journal_current_handle();
1166
1167 mapping = page->mapping;
1168 if (ext4_should_writeback_data(mapping->host)) {
1169 /* optimization: no constraints about data */
1170skip:
1171 return ext4_journal_stop(handle);
1172 }
1173
1174 head = page_buffers(page);
1175 blocksize = head->b_size;
1176 for ( bh = head, block_start = 0;
1177 bh != head || !block_start;
1178 block_start = block_end, bh = next)
1179 {
1180 next = bh->b_this_page;
1181 block_end = block_start + blocksize;
1182 if (block_end <= from)
1183 continue;
1184 if (block_start >= to) {
1185 block_start = to;
1186 break;
1187 }
1188 if (!buffer_mapped(bh))
1189 /* prepare_write failed on this bh */
1190 break;
1191 if (ext4_should_journal_data(mapping->host)) {
1192 ret = do_journal_get_write_access(handle, bh);
1193 if (ret) {
1194 ext4_journal_stop(handle);
1195 return ret;
1196 }
1197 }
1198 /*
1199 * block_start here becomes the first block where the current iteration
1200 * of prepare_write failed.
1201 */
1202 }
1203 if (block_start <= from)
1204 goto skip;
1205
1206 /* commit allocated and zeroed buffers */
1207 return mapping->a_ops->commit_write(file, page, from, block_start);
1208}
1209
1210static int ext4_prepare_write(struct file *file, struct page *page, 1150static int ext4_prepare_write(struct file *file, struct page *page,
1211 unsigned from, unsigned to) 1151 unsigned from, unsigned to)
1212{ 1152{
1213 struct inode *inode = page->mapping->host; 1153 struct inode *inode = page->mapping->host;
1214 int ret, ret2; 1154 int ret, needed_blocks = ext4_writepage_trans_blocks(inode);
1215 int needed_blocks = ext4_writepage_trans_blocks(inode);
1216 handle_t *handle; 1155 handle_t *handle;
1217 int retries = 0; 1156 int retries = 0;
1218 1157
1219retry: 1158retry:
1220 handle = ext4_journal_start(inode, needed_blocks); 1159 handle = ext4_journal_start(inode, needed_blocks);
1221 if (IS_ERR(handle)) 1160 if (IS_ERR(handle)) {
1222 return PTR_ERR(handle); 1161 ret = PTR_ERR(handle);
1162 goto out;
1163 }
1223 if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode)) 1164 if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))
1224 ret = nobh_prepare_write(page, from, to, ext4_get_block); 1165 ret = nobh_prepare_write(page, from, to, ext4_get_block);
1225 else 1166 else
1226 ret = block_prepare_write(page, from, to, ext4_get_block); 1167 ret = block_prepare_write(page, from, to, ext4_get_block);
1227 if (ret) 1168 if (ret)
1228 goto failure; 1169 goto prepare_write_failed;
1229 1170
1230 if (ext4_should_journal_data(inode)) { 1171 if (ext4_should_journal_data(inode)) {
1231 ret = walk_page_buffers(handle, page_buffers(page), 1172 ret = walk_page_buffers(handle, page_buffers(page),
1232 from, to, NULL, do_journal_get_write_access); 1173 from, to, NULL, do_journal_get_write_access);
1233 if (ret)
1234 /* fatal error, just put the handle and return */
1235 ext4_journal_stop(handle);
1236 } 1174 }
1237 return ret; 1175prepare_write_failed:
1238 1176 if (ret)
1239failure: 1177 ext4_journal_stop(handle);
1240 ret2 = ext4_prepare_failure(file, page, from, to);
1241 if (ret2 < 0)
1242 return ret2;
1243 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) 1178 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
1244 goto retry; 1179 goto retry;
1245 /* retry number exceeded, or other error like -EDQUOT */ 1180out:
1246 return ret; 1181 return ret;
1247} 1182}
1248 1183
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 406bf61ed510..8890eba1db52 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -195,7 +195,7 @@ static struct dentry_operations fuse_dentry_operations = {
195 .d_revalidate = fuse_dentry_revalidate, 195 .d_revalidate = fuse_dentry_revalidate,
196}; 196};
197 197
198static int valid_mode(int m) 198int fuse_valid_type(int m)
199{ 199{
200 return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) || 200 return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
201 S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m); 201 S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m);
@@ -248,7 +248,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
248 fuse_put_request(fc, req); 248 fuse_put_request(fc, req);
249 /* Zero nodeid is same as -ENOENT, but with valid timeout */ 249 /* Zero nodeid is same as -ENOENT, but with valid timeout */
250 if (!err && outarg.nodeid && 250 if (!err && outarg.nodeid &&
251 (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode))) 251 (invalid_nodeid(outarg.nodeid) ||
252 !fuse_valid_type(outarg.attr.mode)))
252 err = -EIO; 253 err = -EIO;
253 if (!err && outarg.nodeid) { 254 if (!err && outarg.nodeid) {
254 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 255 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index b98b20de7405..68ae87cbafab 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -552,3 +552,8 @@ int fuse_ctl_add_conn(struct fuse_conn *fc);
552 * Remove connection from control filesystem 552 * Remove connection from control filesystem
553 */ 553 */
554void fuse_ctl_remove_conn(struct fuse_conn *fc); 554void fuse_ctl_remove_conn(struct fuse_conn *fc);
555
556/**
557 * Is file type valid?
558 */
559int fuse_valid_type(int m);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5ab8e50e7808..608db81219a0 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -330,6 +330,8 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
330 case OPT_ROOTMODE: 330 case OPT_ROOTMODE:
331 if (match_octal(&args[0], &value)) 331 if (match_octal(&args[0], &value))
332 return 0; 332 return 0;
333 if (!fuse_valid_type(value))
334 return 0;
333 d->rootmode = value; 335 d->rootmode = value;
334 d->rootmode_present = 1; 336 d->rootmode_present = 1;
335 break; 337 break;
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 6618c1190252..12accb08fe02 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -20,6 +20,7 @@
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/lm_interface.h> 21#include <linux/lm_interface.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/module.h>
23#include <linux/rwsem.h> 24#include <linux/rwsem.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25 26
@@ -953,9 +954,6 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret)
953 spin_unlock(&gl->gl_spin); 954 spin_unlock(&gl->gl_spin);
954 } 955 }
955 956
956 if (glops->go_drop_bh)
957 glops->go_drop_bh(gl);
958
959 spin_lock(&gl->gl_spin); 957 spin_lock(&gl->gl_spin);
960 gl->gl_req_gh = NULL; 958 gl->gl_req_gh = NULL;
961 gl->gl_req_bh = NULL; 959 gl->gl_req_bh = NULL;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 46af55355513..39c8ae23bd9c 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -245,7 +245,6 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
245 245
246 if (ip && S_ISREG(ip->i_inode.i_mode)) { 246 if (ip && S_ISREG(ip->i_inode.i_mode)) {
247 truncate_inode_pages(ip->i_inode.i_mapping, 0); 247 truncate_inode_pages(ip->i_inode.i_mapping, 0);
248 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), !ip->i_inode.i_mapping->nrpages);
249 clear_bit(GIF_PAGED, &ip->i_flags); 248 clear_bit(GIF_PAGED, &ip->i_flags);
250 } 249 }
251} 250}
@@ -459,6 +458,8 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
459}; 458};
460 459
461const struct gfs2_glock_operations gfs2_rgrp_glops = { 460const struct gfs2_glock_operations gfs2_rgrp_glops = {
461 .go_xmote_th = meta_go_sync,
462 .go_drop_th = meta_go_sync,
462 .go_inval = meta_go_inval, 463 .go_inval = meta_go_inval,
463 .go_demote_ok = rgrp_go_demote_ok, 464 .go_demote_ok = rgrp_go_demote_ok,
464 .go_lock = rgrp_go_lock, 465 .go_lock = rgrp_go_lock,
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 12c80fd28db5..49f0dbf40d86 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -104,7 +104,6 @@ struct gfs2_glock_operations {
104 void (*go_xmote_th) (struct gfs2_glock *gl); 104 void (*go_xmote_th) (struct gfs2_glock *gl);
105 void (*go_xmote_bh) (struct gfs2_glock *gl); 105 void (*go_xmote_bh) (struct gfs2_glock *gl);
106 void (*go_drop_th) (struct gfs2_glock *gl); 106 void (*go_drop_th) (struct gfs2_glock *gl);
107 void (*go_drop_bh) (struct gfs2_glock *gl);
108 void (*go_inval) (struct gfs2_glock *gl, int flags); 107 void (*go_inval) (struct gfs2_glock *gl, int flags);
109 int (*go_demote_ok) (struct gfs2_glock *gl); 108 int (*go_demote_ok) (struct gfs2_glock *gl);
110 int (*go_lock) (struct gfs2_holder *gh); 109 int (*go_lock) (struct gfs2_holder *gh);
@@ -416,7 +415,6 @@ struct gfs2_tune {
416 unsigned int gt_stall_secs; /* Detects trouble! */ 415 unsigned int gt_stall_secs; /* Detects trouble! */
417 unsigned int gt_complain_secs; 416 unsigned int gt_complain_secs;
418 unsigned int gt_reclaim_limit; /* Max num of glocks in reclaim list */ 417 unsigned int gt_reclaim_limit; /* Max num of glocks in reclaim list */
419 unsigned int gt_entries_per_readdir;
420 unsigned int gt_statfs_quantum; 418 unsigned int gt_statfs_quantum;
421 unsigned int gt_statfs_slow; 419 unsigned int gt_statfs_slow;
422}; 420};
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 0d6831a40565..df0b8b3018b9 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -43,7 +43,8 @@ static int iget_test(struct inode *inode, void *opaque)
43 struct gfs2_inode *ip = GFS2_I(inode); 43 struct gfs2_inode *ip = GFS2_I(inode);
44 struct gfs2_inum_host *inum = opaque; 44 struct gfs2_inum_host *inum = opaque;
45 45
46 if (ip->i_num.no_addr == inum->no_addr) 46 if (ip->i_num.no_addr == inum->no_addr &&
47 inode->i_private != NULL)
47 return 1; 48 return 1;
48 49
49 return 0; 50 return 0;
@@ -61,13 +62,13 @@ static int iget_set(struct inode *inode, void *opaque)
61 62
62struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum) 63struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum)
63{ 64{
64 return ilookup5(sb, (unsigned long)inum->no_formal_ino, 65 return ilookup5(sb, (unsigned long)inum->no_addr,
65 iget_test, inum); 66 iget_test, inum);
66} 67}
67 68
68static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum) 69static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum)
69{ 70{
70 return iget5_locked(sb, (unsigned long)inum->no_formal_ino, 71 return iget5_locked(sb, (unsigned long)inum->no_addr,
71 iget_test, iget_set, inum); 72 iget_test, iget_set, inum);
72} 73}
73 74
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 56e33590b656..b3b7e8475359 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -266,9 +266,11 @@ skip_lock:
266out: 266out:
267 return error; 267 return error;
268out_unlock: 268out_unlock:
269 if (error == GLR_TRYFAILED)
270 error = AOP_TRUNCATED_PAGE;
271 unlock_page(page); 269 unlock_page(page);
270 if (error == GLR_TRYFAILED) {
271 error = AOP_TRUNCATED_PAGE;
272 yield();
273 }
272 if (do_unlock) 274 if (do_unlock)
273 gfs2_holder_uninit(&gh); 275 gfs2_holder_uninit(&gh);
274 goto out; 276 goto out;
@@ -364,6 +366,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
364 if (error == GLR_TRYFAILED) { 366 if (error == GLR_TRYFAILED) {
365 unlock_page(page); 367 unlock_page(page);
366 error = AOP_TRUNCATED_PAGE; 368 error = AOP_TRUNCATED_PAGE;
369 yield();
367 } 370 }
368 goto out_uninit; 371 goto out_uninit;
369 } 372 }
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 1de05b63d43a..aad918337a46 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -38,14 +38,11 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb,
38 struct gfs2_fh_obj fh_obj; 38 struct gfs2_fh_obj fh_obj;
39 struct gfs2_inum_host *this, parent; 39 struct gfs2_inum_host *this, parent;
40 40
41 if (fh_type != fh_len)
42 return NULL;
43
44 this = &fh_obj.this; 41 this = &fh_obj.this;
45 fh_obj.imode = DT_UNKNOWN; 42 fh_obj.imode = DT_UNKNOWN;
46 memset(&parent, 0, sizeof(struct gfs2_inum)); 43 memset(&parent, 0, sizeof(struct gfs2_inum));
47 44
48 switch (fh_type) { 45 switch (fh_len) {
49 case GFS2_LARGE_FH_SIZE: 46 case GFS2_LARGE_FH_SIZE:
50 parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32; 47 parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
51 parent.no_formal_ino |= be32_to_cpu(fh[5]); 48 parent.no_formal_ino |= be32_to_cpu(fh[5]);
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ee80b8a5e7bc..ee54cb667083 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -840,7 +840,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
840 } 840 }
841 841
842 printk(KERN_WARNING "GFS2: Unrecognized block device or " 842 printk(KERN_WARNING "GFS2: Unrecognized block device or "
843 "mount point %s", dev_name); 843 "mount point %s\n", dev_name);
844 844
845free_nd: 845free_nd:
846 path_release(&nd); 846 path_release(&nd);
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index d0db881b55d2..c186857e48a8 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -279,7 +279,7 @@ static int bh_get(struct gfs2_quota_data *qd)
279 (bh->b_data + sizeof(struct gfs2_meta_header) + 279 (bh->b_data + sizeof(struct gfs2_meta_header) +
280 offset * sizeof(struct gfs2_quota_change)); 280 offset * sizeof(struct gfs2_quota_change));
281 281
282 mutex_lock(&sdp->sd_quota_mutex); 282 mutex_unlock(&sdp->sd_quota_mutex);
283 283
284 return 0; 284 return 0;
285 285
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 70f424fcf1cd..4fdda974dc83 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -76,7 +76,6 @@ void gfs2_tune_init(struct gfs2_tune *gt)
76 gt->gt_stall_secs = 600; 76 gt->gt_stall_secs = 600;
77 gt->gt_complain_secs = 10; 77 gt->gt_complain_secs = 10;
78 gt->gt_reclaim_limit = 5000; 78 gt->gt_reclaim_limit = 5000;
79 gt->gt_entries_per_readdir = 32;
80 gt->gt_statfs_quantum = 30; 79 gt->gt_statfs_quantum = 30;
81 gt->gt_statfs_slow = 0; 80 gt->gt_statfs_slow = 0;
82} 81}
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e965eb11d76f..fd301a910122 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -20,7 +20,6 @@
20#include "hostfs.h" 20#include "hostfs.h"
21#include "kern_util.h" 21#include "kern_util.h"
22#include "kern.h" 22#include "kern.h"
23#include "user_util.h"
24#include "init.h" 23#include "init.h"
25 24
26struct hostfs_inode_info { 25struct hostfs_inode_info {
@@ -47,7 +46,7 @@ struct dentry_operations hostfs_dentry_ops = {
47}; 46};
48 47
49/* Changed in hostfs_args before the kernel starts running */ 48/* Changed in hostfs_args before the kernel starts running */
50static char *root_ino = "/"; 49static char *root_ino = "";
51static int append = 0; 50static int append = 0;
52 51
53#define HOSTFS_SUPER_MAGIC 0x00c0ffee 52#define HOSTFS_SUPER_MAGIC 0x00c0ffee
@@ -939,7 +938,7 @@ static const struct address_space_operations hostfs_link_aops = {
939static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) 938static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
940{ 939{
941 struct inode *root_inode; 940 struct inode *root_inode;
942 char *name, *data = d; 941 char *host_root_path, *req_root = d;
943 int err; 942 int err;
944 943
945 sb->s_blocksize = 1024; 944 sb->s_blocksize = 1024;
@@ -947,15 +946,17 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
947 sb->s_magic = HOSTFS_SUPER_MAGIC; 946 sb->s_magic = HOSTFS_SUPER_MAGIC;
948 sb->s_op = &hostfs_sbops; 947 sb->s_op = &hostfs_sbops;
949 948
950 if((data == NULL) || (*data == '\0')) 949 /* NULL is printed as <NULL> by sprintf: avoid that. */
951 data = root_ino; 950 if (req_root == NULL)
951 req_root = "";
952 952
953 err = -ENOMEM; 953 err = -ENOMEM;
954 name = kmalloc(strlen(data) + 1, GFP_KERNEL); 954 host_root_path = kmalloc(strlen(root_ino) + 1
955 if(name == NULL) 955 + strlen(req_root) + 1, GFP_KERNEL);
956 if(host_root_path == NULL)
956 goto out; 957 goto out;
957 958
958 strcpy(name, data); 959 sprintf(host_root_path, "%s/%s", root_ino, req_root);
959 960
960 root_inode = iget(sb, 0); 961 root_inode = iget(sb, 0);
961 if(root_inode == NULL) 962 if(root_inode == NULL)
@@ -965,7 +966,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
965 if(err) 966 if(err)
966 goto out_put; 967 goto out_put;
967 968
968 HOSTFS_I(root_inode)->host_filename = name; 969 HOSTFS_I(root_inode)->host_filename = host_root_path;
970 /* Avoid that in the error path, iput(root_inode) frees again
971 * host_root_path through hostfs_destroy_inode! */
972 host_root_path = NULL;
969 973
970 err = -ENOMEM; 974 err = -ENOMEM;
971 sb->s_root = d_alloc_root(root_inode); 975 sb->s_root = d_alloc_root(root_inode);
@@ -977,7 +981,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
977 /* No iput in this case because the dput does that for us */ 981 /* No iput in this case because the dput does that for us */
978 dput(sb->s_root); 982 dput(sb->s_root);
979 sb->s_root = NULL; 983 sb->s_root = NULL;
980 goto out_free; 984 goto out;
981 } 985 }
982 986
983 return(0); 987 return(0);
@@ -985,7 +989,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
985 out_put: 989 out_put:
986 iput(root_inode); 990 iput(root_inode);
987 out_free: 991 out_free:
988 kfree(name); 992 kfree(host_root_path);
989 out: 993 out:
990 return(err); 994 return(err);
991} 995}
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 6eb3daebd563..888f236e5494 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -99,7 +99,13 @@ static int jffs2_garbage_collect_thread(void *_c)
99 if (try_to_freeze()) 99 if (try_to_freeze())
100 continue; 100 continue;
101 101
102 cond_resched(); 102 /* This thread is purely an optimisation. But if it runs when
103 other things could be running, it actually makes things a
104 lot worse. Use yield() and put it at the back of the runqueue
105 every time. Especially during boot, pulling an inode in
106 with read_inode() is much preferable to having the GC thread
107 get there first. */
108 yield();
103 109
104 /* Put_super will send a SIGKILL and then wait on the sem. 110 /* Put_super will send a SIGKILL and then wait on the sem.
105 */ 111 */
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 58a0b912e9d0..717a48cf7df2 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -373,7 +373,14 @@ free_out:
373static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs2_unknown_node *un) 373static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs2_unknown_node *un)
374{ 374{
375 /* We don't mark unknown nodes as REF_UNCHECKED */ 375 /* We don't mark unknown nodes as REF_UNCHECKED */
376 BUG_ON(ref_flags(ref) == REF_UNCHECKED); 376 if (ref_flags(ref) == REF_UNCHECKED) {
377 JFFS2_ERROR("REF_UNCHECKED but unknown node at %#08x\n",
378 ref_offset(ref));
379 JFFS2_ERROR("Node is {%04x,%04x,%08x,%08x}. Please report this error.\n",
380 je16_to_cpu(un->magic), je16_to_cpu(un->nodetype),
381 je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc));
382 return 1;
383 }
377 384
378 un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype)); 385 un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype));
379 386
@@ -576,6 +583,13 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
576 jffs2_mark_node_obsolete(c, ref); 583 jffs2_mark_node_obsolete(c, ref);
577 goto cont; 584 goto cont;
578 } 585 }
586 /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */
587 if (!je32_to_cpu(node->u.hdr_crc) && !je16_to_cpu(node->u.nodetype) &&
588 !je16_to_cpu(node->u.magic) && !je32_to_cpu(node->u.totlen)) {
589 JFFS2_NOTICE("All zero node header at %#08x.\n", ref_offset(ref));
590 jffs2_mark_node_obsolete(c, ref);
591 goto cont;
592 }
579 593
580 switch (je16_to_cpu(node->u.nodetype)) { 594 switch (je16_to_cpu(node->u.nodetype)) {
581 595
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 31c1475d922a..7fb45bd4915c 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -734,6 +734,15 @@ scan_more:
734 ofs += 4; 734 ofs += 4;
735 continue; 735 continue;
736 } 736 }
737 /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */
738 if (!je32_to_cpu(node->hdr_crc) && !je16_to_cpu(node->nodetype) &&
739 !je16_to_cpu(node->magic) && !je32_to_cpu(node->totlen)) {
740 noisy_printk(&noise, "jffs2_scan_eraseblock(): All zero node header at 0x%08x.\n", ofs);
741 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
742 return err;
743 ofs += 4;
744 continue;
745 }
737 746
738 if (ofs + je32_to_cpu(node->totlen) > 747 if (ofs + je32_to_cpu(node->totlen) >
739 jeb->offset + c->sector_size) { 748 jeb->offset + c->sector_size) {
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index de718e3a1692..4fac6dd53954 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -238,7 +238,10 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
238 jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; 238 jeb = &c->blocks[c->wbuf_ofs / c->sector_size];
239 239
240 spin_lock(&c->erase_completion_lock); 240 spin_lock(&c->erase_completion_lock);
241 jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); 241 if (c->wbuf_ofs % c->mtd->erasesize)
242 jffs2_block_refile(c, jeb, REFILE_NOTEMPTY);
243 else
244 jffs2_block_refile(c, jeb, REFILE_ANYWAY);
242 spin_unlock(&c->erase_completion_lock); 245 spin_unlock(&c->erase_completion_lock);
243 246
244 BUG_ON(!ref_obsolete(jeb->last_node)); 247 BUG_ON(!ref_obsolete(jeb->last_node));
@@ -1087,7 +1090,7 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *
1087 if (!c->mtd->block_markbad) 1090 if (!c->mtd->block_markbad)
1088 return 1; // What else can we do? 1091 return 1; // What else can we do?
1089 1092
1090 D1(printk(KERN_WARNING "jffs2_write_nand_badblock(): Marking bad block at %08x\n", bad_offset)); 1093 printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset);
1091 ret = c->mtd->block_markbad(c->mtd, bad_offset); 1094 ret = c->mtd->block_markbad(c->mtd, bad_offset);
1092 1095
1093 if (ret) { 1096 if (ret) {
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index af53c02f473b..93d046c85f52 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -429,7 +429,8 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
429 int err; 429 int err;
430 430
431 /* Flush out writes to the server in order to update c/mtime */ 431 /* Flush out writes to the server in order to update c/mtime */
432 nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT); 432 if (S_ISREG(inode->i_mode))
433 nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT);
433 434
434 /* 435 /*
435 * We may force a getattr if the user cares about atime. 436 * We may force a getattr if the user cares about atime.
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index bb516a2cfbaf..f1eae44b9a1a 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -151,10 +151,10 @@ int __init register_nfs_fs(void)
151 if (ret < 0) 151 if (ret < 0)
152 goto error_0; 152 goto error_0;
153 153
154#ifdef CONFIG_NFS_V4
155 ret = nfs_register_sysctl(); 154 ret = nfs_register_sysctl();
156 if (ret < 0) 155 if (ret < 0)
157 goto error_1; 156 goto error_1;
157#ifdef CONFIG_NFS_V4
158 ret = register_filesystem(&nfs4_fs_type); 158 ret = register_filesystem(&nfs4_fs_type);
159 if (ret < 0) 159 if (ret < 0)
160 goto error_2; 160 goto error_2;
@@ -165,9 +165,9 @@ int __init register_nfs_fs(void)
165#ifdef CONFIG_NFS_V4 165#ifdef CONFIG_NFS_V4
166error_2: 166error_2:
167 nfs_unregister_sysctl(); 167 nfs_unregister_sysctl();
168#endif
168error_1: 169error_1:
169 unregister_filesystem(&nfs_fs_type); 170 unregister_filesystem(&nfs_fs_type);
170#endif
171error_0: 171error_0:
172 return ret; 172 return ret;
173} 173}
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
index fcdcafbb3293..b62481dabae9 100644
--- a/fs/nfs/sysctl.c
+++ b/fs/nfs/sysctl.c
@@ -50,6 +50,14 @@ static ctl_table nfs_cb_sysctls[] = {
50 .proc_handler = &proc_dointvec_jiffies, 50 .proc_handler = &proc_dointvec_jiffies,
51 .strategy = &sysctl_jiffies, 51 .strategy = &sysctl_jiffies,
52 }, 52 },
53 {
54 .ctl_name = CTL_UNNUMBERED,
55 .procname = "nfs_congestion_kb",
56 .data = &nfs_congestion_kb,
57 .maxlen = sizeof(nfs_congestion_kb),
58 .mode = 0644,
59 .proc_handler = &proc_dointvec,
60 },
53 { .ctl_name = 0 } 61 { .ctl_name = 0 }
54}; 62};
55 63
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index febdade91670..2867e6b7096f 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -12,6 +12,7 @@
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/file.h> 13#include <linux/file.h>
14#include <linux/writeback.h> 14#include <linux/writeback.h>
15#include <linux/swap.h>
15 16
16#include <linux/sunrpc/clnt.h> 17#include <linux/sunrpc/clnt.h>
17#include <linux/nfs_fs.h> 18#include <linux/nfs_fs.h>
@@ -38,7 +39,6 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context*,
38 struct page *, 39 struct page *,
39 unsigned int, unsigned int); 40 unsigned int, unsigned int);
40static void nfs_mark_request_dirty(struct nfs_page *req); 41static void nfs_mark_request_dirty(struct nfs_page *req);
41static int nfs_wait_on_write_congestion(struct address_space *, int);
42static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); 42static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how);
43static const struct rpc_call_ops nfs_write_partial_ops; 43static const struct rpc_call_ops nfs_write_partial_ops;
44static const struct rpc_call_ops nfs_write_full_ops; 44static const struct rpc_call_ops nfs_write_full_ops;
@@ -48,8 +48,6 @@ static struct kmem_cache *nfs_wdata_cachep;
48static mempool_t *nfs_wdata_mempool; 48static mempool_t *nfs_wdata_mempool;
49static mempool_t *nfs_commit_mempool; 49static mempool_t *nfs_commit_mempool;
50 50
51static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion);
52
53struct nfs_write_data *nfs_commit_alloc(void) 51struct nfs_write_data *nfs_commit_alloc(void)
54{ 52{
55 struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS); 53 struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS);
@@ -211,6 +209,40 @@ static int wb_priority(struct writeback_control *wbc)
211} 209}
212 210
213/* 211/*
212 * NFS congestion control
213 */
214
215int nfs_congestion_kb;
216
217#define NFS_CONGESTION_ON_THRESH (nfs_congestion_kb >> (PAGE_SHIFT-10))
218#define NFS_CONGESTION_OFF_THRESH \
219 (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2))
220
221static void nfs_set_page_writeback(struct page *page)
222{
223 if (!test_set_page_writeback(page)) {
224 struct inode *inode = page->mapping->host;
225 struct nfs_server *nfss = NFS_SERVER(inode);
226
227 if (atomic_inc_return(&nfss->writeback) >
228 NFS_CONGESTION_ON_THRESH)
229 set_bdi_congested(&nfss->backing_dev_info, WRITE);
230 }
231}
232
233static void nfs_end_page_writeback(struct page *page)
234{
235 struct inode *inode = page->mapping->host;
236 struct nfs_server *nfss = NFS_SERVER(inode);
237
238 end_page_writeback(page);
239 if (atomic_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) {
240 clear_bdi_congested(&nfss->backing_dev_info, WRITE);
241 congestion_end(WRITE);
242 }
243}
244
245/*
214 * Find an associated nfs write request, and prepare to flush it out 246 * Find an associated nfs write request, and prepare to flush it out
215 * Returns 1 if there was no write request, or if the request was 247 * Returns 1 if there was no write request, or if the request was
216 * already tagged by nfs_set_page_dirty.Returns 0 if the request 248 * already tagged by nfs_set_page_dirty.Returns 0 if the request
@@ -247,7 +279,7 @@ static int nfs_page_mark_flush(struct page *page)
247 spin_unlock(req_lock); 279 spin_unlock(req_lock);
248 if (test_and_set_bit(PG_FLUSHING, &req->wb_flags) == 0) { 280 if (test_and_set_bit(PG_FLUSHING, &req->wb_flags) == 0) {
249 nfs_mark_request_dirty(req); 281 nfs_mark_request_dirty(req);
250 set_page_writeback(page); 282 nfs_set_page_writeback(page);
251 } 283 }
252 ret = test_bit(PG_NEED_FLUSH, &req->wb_flags); 284 ret = test_bit(PG_NEED_FLUSH, &req->wb_flags);
253 nfs_unlock_request(req); 285 nfs_unlock_request(req);
@@ -302,13 +334,8 @@ int nfs_writepage(struct page *page, struct writeback_control *wbc)
302 return err; 334 return err;
303} 335}
304 336
305/*
306 * Note: causes nfs_update_request() to block on the assumption
307 * that the writeback is generated due to memory pressure.
308 */
309int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) 337int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
310{ 338{
311 struct backing_dev_info *bdi = mapping->backing_dev_info;
312 struct inode *inode = mapping->host; 339 struct inode *inode = mapping->host;
313 int err; 340 int err;
314 341
@@ -317,20 +344,12 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
317 err = generic_writepages(mapping, wbc); 344 err = generic_writepages(mapping, wbc);
318 if (err) 345 if (err)
319 return err; 346 return err;
320 while (test_and_set_bit(BDI_write_congested, &bdi->state) != 0) {
321 if (wbc->nonblocking)
322 return 0;
323 nfs_wait_on_write_congestion(mapping, 0);
324 }
325 err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc)); 347 err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc));
326 if (err < 0) 348 if (err < 0)
327 goto out; 349 goto out;
328 nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); 350 nfs_add_stats(inode, NFSIOS_WRITEPAGES, err);
329 err = 0; 351 err = 0;
330out: 352out:
331 clear_bit(BDI_write_congested, &bdi->state);
332 wake_up_all(&nfs_write_congestion);
333 congestion_end(WRITE);
334 return err; 353 return err;
335} 354}
336 355
@@ -360,7 +379,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
360} 379}
361 380
362/* 381/*
363 * Insert a write request into an inode 382 * Remove a write request from an inode
364 */ 383 */
365static void nfs_inode_remove_request(struct nfs_page *req) 384static void nfs_inode_remove_request(struct nfs_page *req)
366{ 385{
@@ -531,10 +550,10 @@ static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, un
531} 550}
532#endif 551#endif
533 552
534static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr) 553static int nfs_wait_on_write_congestion(struct address_space *mapping)
535{ 554{
555 struct inode *inode = mapping->host;
536 struct backing_dev_info *bdi = mapping->backing_dev_info; 556 struct backing_dev_info *bdi = mapping->backing_dev_info;
537 DEFINE_WAIT(wait);
538 int ret = 0; 557 int ret = 0;
539 558
540 might_sleep(); 559 might_sleep();
@@ -542,31 +561,23 @@ static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr)
542 if (!bdi_write_congested(bdi)) 561 if (!bdi_write_congested(bdi))
543 return 0; 562 return 0;
544 563
545 nfs_inc_stats(mapping->host, NFSIOS_CONGESTIONWAIT); 564 nfs_inc_stats(inode, NFSIOS_CONGESTIONWAIT);
546 565
547 if (intr) { 566 do {
548 struct rpc_clnt *clnt = NFS_CLIENT(mapping->host); 567 struct rpc_clnt *clnt = NFS_CLIENT(inode);
549 sigset_t oldset; 568 sigset_t oldset;
550 569
551 rpc_clnt_sigmask(clnt, &oldset); 570 rpc_clnt_sigmask(clnt, &oldset);
552 prepare_to_wait(&nfs_write_congestion, &wait, TASK_INTERRUPTIBLE); 571 ret = congestion_wait_interruptible(WRITE, HZ/10);
553 if (bdi_write_congested(bdi)) {
554 if (signalled())
555 ret = -ERESTARTSYS;
556 else
557 schedule();
558 }
559 rpc_clnt_sigunmask(clnt, &oldset); 572 rpc_clnt_sigunmask(clnt, &oldset);
560 } else { 573 if (ret == -ERESTARTSYS)
561 prepare_to_wait(&nfs_write_congestion, &wait, TASK_UNINTERRUPTIBLE); 574 break;
562 if (bdi_write_congested(bdi)) 575 ret = 0;
563 schedule(); 576 } while (bdi_write_congested(bdi));
564 } 577
565 finish_wait(&nfs_write_congestion, &wait);
566 return ret; 578 return ret;
567} 579}
568 580
569
570/* 581/*
571 * Try to update any existing write request, or create one if there is none. 582 * Try to update any existing write request, or create one if there is none.
572 * In order to match, the request's credentials must match those of 583 * In order to match, the request's credentials must match those of
@@ -577,14 +588,15 @@ static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr)
577static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, 588static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
578 struct page *page, unsigned int offset, unsigned int bytes) 589 struct page *page, unsigned int offset, unsigned int bytes)
579{ 590{
580 struct inode *inode = page->mapping->host; 591 struct address_space *mapping = page->mapping;
592 struct inode *inode = mapping->host;
581 struct nfs_inode *nfsi = NFS_I(inode); 593 struct nfs_inode *nfsi = NFS_I(inode);
582 struct nfs_page *req, *new = NULL; 594 struct nfs_page *req, *new = NULL;
583 unsigned long rqend, end; 595 unsigned long rqend, end;
584 596
585 end = offset + bytes; 597 end = offset + bytes;
586 598
587 if (nfs_wait_on_write_congestion(page->mapping, NFS_SERVER(inode)->flags & NFS_MOUNT_INTR)) 599 if (nfs_wait_on_write_congestion(mapping))
588 return ERR_PTR(-ERESTARTSYS); 600 return ERR_PTR(-ERESTARTSYS);
589 for (;;) { 601 for (;;) {
590 /* Loop over all inode entries and see if we find 602 /* Loop over all inode entries and see if we find
@@ -727,7 +739,7 @@ int nfs_updatepage(struct file *file, struct page *page,
727 739
728static void nfs_writepage_release(struct nfs_page *req) 740static void nfs_writepage_release(struct nfs_page *req)
729{ 741{
730 end_page_writeback(req->wb_page); 742 nfs_end_page_writeback(req->wb_page);
731 743
732#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 744#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
733 if (!PageError(req->wb_page)) { 745 if (!PageError(req->wb_page)) {
@@ -1042,12 +1054,12 @@ static void nfs_writeback_done_full(struct rpc_task *task, void *calldata)
1042 if (task->tk_status < 0) { 1054 if (task->tk_status < 0) {
1043 nfs_set_pageerror(page); 1055 nfs_set_pageerror(page);
1044 req->wb_context->error = task->tk_status; 1056 req->wb_context->error = task->tk_status;
1045 end_page_writeback(page); 1057 nfs_end_page_writeback(page);
1046 nfs_inode_remove_request(req); 1058 nfs_inode_remove_request(req);
1047 dprintk(", error = %d\n", task->tk_status); 1059 dprintk(", error = %d\n", task->tk_status);
1048 goto next; 1060 goto next;
1049 } 1061 }
1050 end_page_writeback(page); 1062 nfs_end_page_writeback(page);
1051 1063
1052#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1064#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
1053 if (data->args.stable != NFS_UNSTABLE || data->verf.committed == NFS_FILE_SYNC) { 1065 if (data->args.stable != NFS_UNSTABLE || data->verf.committed == NFS_FILE_SYNC) {
@@ -1514,6 +1526,26 @@ int __init nfs_init_writepagecache(void)
1514 if (nfs_commit_mempool == NULL) 1526 if (nfs_commit_mempool == NULL)
1515 return -ENOMEM; 1527 return -ENOMEM;
1516 1528
1529 /*
1530 * NFS congestion size, scale with available memory.
1531 *
1532 * 64MB: 8192k
1533 * 128MB: 11585k
1534 * 256MB: 16384k
1535 * 512MB: 23170k
1536 * 1GB: 32768k
1537 * 2GB: 46340k
1538 * 4GB: 65536k
1539 * 8GB: 92681k
1540 * 16GB: 131072k
1541 *
1542 * This allows larger machines to have larger/more transfers.
1543 * Limit the default to 256M
1544 */
1545 nfs_congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10);
1546 if (nfs_congestion_kb > 256*1024)
1547 nfs_congestion_kb = 256*1024;
1548
1517 return 0; 1549 return 0;
1518} 1550}
1519 1551
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 6f677988c71d..7e4bb0af24d7 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -859,8 +859,8 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
859#define NFS3_ENTRY_BAGGAGE (2 + 1 + 2 + 1) 859#define NFS3_ENTRY_BAGGAGE (2 + 1 + 2 + 1)
860#define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2)) 860#define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2))
861static int 861static int
862encode_entry(struct readdir_cd *ccd, const char *name, 862encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
863 int namlen, off_t offset, ino_t ino, unsigned int d_type, int plus) 863 loff_t offset, ino_t ino, unsigned int d_type, int plus)
864{ 864{
865 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, 865 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
866 common); 866 common);
@@ -880,7 +880,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
880 *cd->offset1 = htonl(offset64 & 0xffffffff); 880 *cd->offset1 = htonl(offset64 & 0xffffffff);
881 cd->offset1 = NULL; 881 cd->offset1 = NULL;
882 } else { 882 } else {
883 xdr_encode_hyper(cd->offset, (u64) offset); 883 xdr_encode_hyper(cd->offset, offset64);
884 } 884 }
885 } 885 }
886 886
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 832673b14587..673a53c014a3 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -228,7 +228,7 @@ _posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
228 struct posix_acl_summary pas; 228 struct posix_acl_summary pas;
229 unsigned short deny; 229 unsigned short deny;
230 int eflag = ((flags & NFS4_ACL_TYPE_DEFAULT) ? 230 int eflag = ((flags & NFS4_ACL_TYPE_DEFAULT) ?
231 NFS4_INHERITANCE_FLAGS : 0); 231 NFS4_INHERITANCE_FLAGS | NFS4_ACE_INHERIT_ONLY_ACE : 0);
232 232
233 BUG_ON(pacl->a_count < 3); 233 BUG_ON(pacl->a_count < 3);
234 summarize_posix_acl(pacl, &pas); 234 summarize_posix_acl(pacl, &pas);
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9e4067999209..af360705e551 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -750,9 +750,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
750 status = nfserr_clid_inuse; 750 status = nfserr_clid_inuse;
751 if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred) 751 if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred)
752 || conf->cl_addr != sin->sin_addr.s_addr) { 752 || conf->cl_addr != sin->sin_addr.s_addr) {
753 printk("NFSD: setclientid: string in use by client" 753 dprintk("NFSD: setclientid: string in use by client"
754 "(clientid %08x/%08x)\n", 754 "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
755 conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id);
756 goto out; 755 goto out;
757 } 756 }
758 } 757 }
@@ -3261,7 +3260,6 @@ __nfs4_state_shutdown(void)
3261 unhash_delegation(dp); 3260 unhash_delegation(dp);
3262 } 3261 }
3263 3262
3264 cancel_delayed_work(&laundromat_work);
3265 nfsd4_shutdown_recdir(); 3263 nfsd4_shutdown_recdir();
3266 nfs4_init = 0; 3264 nfs4_init = 0;
3267} 3265}
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index c2660cbfcd96..8d995bcef806 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -17,7 +17,6 @@
17#include <linux/stat.h> 17#include <linux/stat.h>
18#include <linux/dcache.h> 18#include <linux/dcache.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <asm/pgtable.h>
21 20
22#include <linux/sunrpc/clnt.h> 21#include <linux/sunrpc/clnt.h>
23#include <linux/sunrpc/svc.h> 22#include <linux/sunrpc/svc.h>
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 93628b02ef5d..875c11443817 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -614,6 +614,27 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
614 ocfs2_rw_unlock(inode, 0); 614 ocfs2_rw_unlock(inode, 0);
615} 615}
616 616
617/*
618 * ocfs2_invalidatepage() and ocfs2_releasepage() are shamelessly stolen
619 * from ext3. PageChecked() bits have been removed as OCFS2 does not
620 * do journalled data.
621 */
622static void ocfs2_invalidatepage(struct page *page, unsigned long offset)
623{
624 journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
625
626 journal_invalidatepage(journal, page, offset);
627}
628
629static int ocfs2_releasepage(struct page *page, gfp_t wait)
630{
631 journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
632
633 if (!page_has_buffers(page))
634 return 0;
635 return journal_try_to_free_buffers(journal, page, wait);
636}
637
617static ssize_t ocfs2_direct_IO(int rw, 638static ssize_t ocfs2_direct_IO(int rw,
618 struct kiocb *iocb, 639 struct kiocb *iocb,
619 const struct iovec *iov, 640 const struct iovec *iov,
@@ -661,5 +682,8 @@ const struct address_space_operations ocfs2_aops = {
661 .commit_write = ocfs2_commit_write, 682 .commit_write = ocfs2_commit_write,
662 .bmap = ocfs2_bmap, 683 .bmap = ocfs2_bmap,
663 .sync_page = block_sync_page, 684 .sync_page = block_sync_page,
664 .direct_IO = ocfs2_direct_IO 685 .direct_IO = ocfs2_direct_IO,
686 .invalidatepage = ocfs2_invalidatepage,
687 .releasepage = ocfs2_releasepage,
688 .migratepage = buffer_migrate_page,
665}; 689};
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 5a9779bb9236..eba282da500e 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1234,6 +1234,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1234 const char *page, 1234 const char *page,
1235 size_t count) 1235 size_t count)
1236{ 1236{
1237 struct task_struct *hb_task;
1237 long fd; 1238 long fd;
1238 int sectsize; 1239 int sectsize;
1239 char *p = (char *)page; 1240 char *p = (char *)page;
@@ -1319,20 +1320,28 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1319 */ 1320 */
1320 atomic_set(&reg->hr_steady_iterations, O2HB_LIVE_THRESHOLD + 1); 1321 atomic_set(&reg->hr_steady_iterations, O2HB_LIVE_THRESHOLD + 1);
1321 1322
1322 reg->hr_task = kthread_run(o2hb_thread, reg, "o2hb-%s", 1323 hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s",
1323 reg->hr_item.ci_name); 1324 reg->hr_item.ci_name);
1324 if (IS_ERR(reg->hr_task)) { 1325 if (IS_ERR(hb_task)) {
1325 ret = PTR_ERR(reg->hr_task); 1326 ret = PTR_ERR(hb_task);
1326 mlog_errno(ret); 1327 mlog_errno(ret);
1327 reg->hr_task = NULL;
1328 goto out; 1328 goto out;
1329 } 1329 }
1330 1330
1331 spin_lock(&o2hb_live_lock);
1332 reg->hr_task = hb_task;
1333 spin_unlock(&o2hb_live_lock);
1334
1331 ret = wait_event_interruptible(o2hb_steady_queue, 1335 ret = wait_event_interruptible(o2hb_steady_queue,
1332 atomic_read(&reg->hr_steady_iterations) == 0); 1336 atomic_read(&reg->hr_steady_iterations) == 0);
1333 if (ret) { 1337 if (ret) {
1334 kthread_stop(reg->hr_task); 1338 spin_lock(&o2hb_live_lock);
1339 hb_task = reg->hr_task;
1335 reg->hr_task = NULL; 1340 reg->hr_task = NULL;
1341 spin_unlock(&o2hb_live_lock);
1342
1343 if (hb_task)
1344 kthread_stop(hb_task);
1336 goto out; 1345 goto out;
1337 } 1346 }
1338 1347
@@ -1354,10 +1363,17 @@ out:
1354static ssize_t o2hb_region_pid_read(struct o2hb_region *reg, 1363static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
1355 char *page) 1364 char *page)
1356{ 1365{
1357 if (!reg->hr_task) 1366 pid_t pid = 0;
1367
1368 spin_lock(&o2hb_live_lock);
1369 if (reg->hr_task)
1370 pid = reg->hr_task->pid;
1371 spin_unlock(&o2hb_live_lock);
1372
1373 if (!pid)
1358 return 0; 1374 return 0;
1359 1375
1360 return sprintf(page, "%u\n", reg->hr_task->pid); 1376 return sprintf(page, "%u\n", pid);
1361} 1377}
1362 1378
1363struct o2hb_region_attribute { 1379struct o2hb_region_attribute {
@@ -1495,13 +1511,17 @@ out:
1495static void o2hb_heartbeat_group_drop_item(struct config_group *group, 1511static void o2hb_heartbeat_group_drop_item(struct config_group *group,
1496 struct config_item *item) 1512 struct config_item *item)
1497{ 1513{
1514 struct task_struct *hb_task;
1498 struct o2hb_region *reg = to_o2hb_region(item); 1515 struct o2hb_region *reg = to_o2hb_region(item);
1499 1516
1500 /* stop the thread when the user removes the region dir */ 1517 /* stop the thread when the user removes the region dir */
1501 if (reg->hr_task) { 1518 spin_lock(&o2hb_live_lock);
1502 kthread_stop(reg->hr_task); 1519 hb_task = reg->hr_task;
1503 reg->hr_task = NULL; 1520 reg->hr_task = NULL;
1504 } 1521 spin_unlock(&o2hb_live_lock);
1522
1523 if (hb_task)
1524 kthread_stop(hb_task);
1505 1525
1506 config_item_put(item); 1526 config_item_put(item);
1507} 1527}
@@ -1682,7 +1702,7 @@ out:
1682} 1702}
1683EXPORT_SYMBOL_GPL(o2hb_register_callback); 1703EXPORT_SYMBOL_GPL(o2hb_register_callback);
1684 1704
1685int o2hb_unregister_callback(struct o2hb_callback_func *hc) 1705void o2hb_unregister_callback(struct o2hb_callback_func *hc)
1686{ 1706{
1687 BUG_ON(hc->hc_magic != O2HB_CB_MAGIC); 1707 BUG_ON(hc->hc_magic != O2HB_CB_MAGIC);
1688 1708
@@ -1690,15 +1710,13 @@ int o2hb_unregister_callback(struct o2hb_callback_func *hc)
1690 __builtin_return_address(0), hc); 1710 __builtin_return_address(0), hc);
1691 1711
1692 if (list_empty(&hc->hc_item)) 1712 if (list_empty(&hc->hc_item))
1693 return 0; 1713 return;
1694 1714
1695 down_write(&o2hb_callback_sem); 1715 down_write(&o2hb_callback_sem);
1696 1716
1697 list_del_init(&hc->hc_item); 1717 list_del_init(&hc->hc_item);
1698 1718
1699 up_write(&o2hb_callback_sem); 1719 up_write(&o2hb_callback_sem);
1700
1701 return 0;
1702} 1720}
1703EXPORT_SYMBOL_GPL(o2hb_unregister_callback); 1721EXPORT_SYMBOL_GPL(o2hb_unregister_callback);
1704 1722
diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h
index cac6223206a9..cc6d40b39771 100644
--- a/fs/ocfs2/cluster/heartbeat.h
+++ b/fs/ocfs2/cluster/heartbeat.h
@@ -70,7 +70,7 @@ void o2hb_setup_callback(struct o2hb_callback_func *hc,
70 void *data, 70 void *data,
71 int priority); 71 int priority);
72int o2hb_register_callback(struct o2hb_callback_func *hc); 72int o2hb_register_callback(struct o2hb_callback_func *hc);
73int o2hb_unregister_callback(struct o2hb_callback_func *hc); 73void o2hb_unregister_callback(struct o2hb_callback_func *hc);
74void o2hb_fill_node_map(unsigned long *map, 74void o2hb_fill_node_map(unsigned long *map,
75 unsigned bytes); 75 unsigned bytes);
76void o2hb_init(void); 76void o2hb_init(void);
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 1718215fc018..69caf3e12fea 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1638,17 +1638,8 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num,
1638 1638
1639void o2net_unregister_hb_callbacks(void) 1639void o2net_unregister_hb_callbacks(void)
1640{ 1640{
1641 int ret; 1641 o2hb_unregister_callback(&o2net_hb_up);
1642 1642 o2hb_unregister_callback(&o2net_hb_down);
1643 ret = o2hb_unregister_callback(&o2net_hb_up);
1644 if (ret < 0)
1645 mlog(ML_ERROR, "Status return %d unregistering heartbeat up "
1646 "callback!\n", ret);
1647
1648 ret = o2hb_unregister_callback(&o2net_hb_down);
1649 if (ret < 0)
1650 mlog(ML_ERROR, "Status return %d unregistering heartbeat down "
1651 "callback!\n", ret);
1652} 1643}
1653 1644
1654int o2net_register_hb_callbacks(void) 1645int o2net_register_hb_callbacks(void)
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 6087c4749fee..c558442a0b44 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -138,8 +138,10 @@ static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);
138 138
139void __dlm_unhash_lockres(struct dlm_lock_resource *lockres) 139void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
140{ 140{
141 hlist_del_init(&lockres->hash_node); 141 if (!hlist_unhashed(&lockres->hash_node)) {
142 dlm_lockres_put(lockres); 142 hlist_del_init(&lockres->hash_node);
143 dlm_lockres_put(lockres);
144 }
143} 145}
144 146
145void __dlm_insert_lockres(struct dlm_ctxt *dlm, 147void __dlm_insert_lockres(struct dlm_ctxt *dlm,
@@ -655,6 +657,8 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm)
655 dlm_kick_thread(dlm, NULL); 657 dlm_kick_thread(dlm, NULL);
656 658
657 while (dlm_migrate_all_locks(dlm)) { 659 while (dlm_migrate_all_locks(dlm)) {
660 /* Give dlm_thread time to purge the lockres' */
661 msleep(500);
658 mlog(0, "%s: more migration to do\n", dlm->name); 662 mlog(0, "%s: more migration to do\n", dlm->name);
659 } 663 }
660 dlm_mark_domain_leaving(dlm); 664 dlm_mark_domain_leaving(dlm);
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 77e4e6169a0d..6edffca99d98 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2424,6 +2424,57 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data)
2424 dlm_lockres_put(res); 2424 dlm_lockres_put(res);
2425} 2425}
2426 2426
2427/* Checks whether the lockres can be migrated. Returns 0 if yes, < 0
2428 * if not. If 0, numlocks is set to the number of locks in the lockres.
2429 */
2430static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm,
2431 struct dlm_lock_resource *res,
2432 int *numlocks)
2433{
2434 int ret;
2435 int i;
2436 int count = 0;
2437 struct list_head *queue, *iter;
2438 struct dlm_lock *lock;
2439
2440 assert_spin_locked(&res->spinlock);
2441
2442 ret = -EINVAL;
2443 if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
2444 mlog(0, "cannot migrate lockres with unknown owner!\n");
2445 goto leave;
2446 }
2447
2448 if (res->owner != dlm->node_num) {
2449 mlog(0, "cannot migrate lockres this node doesn't own!\n");
2450 goto leave;
2451 }
2452
2453 ret = 0;
2454 queue = &res->granted;
2455 for (i = 0; i < 3; i++) {
2456 list_for_each(iter, queue) {
2457 lock = list_entry(iter, struct dlm_lock, list);
2458 ++count;
2459 if (lock->ml.node == dlm->node_num) {
2460 mlog(0, "found a lock owned by this node still "
2461 "on the %s queue! will not migrate this "
2462 "lockres\n", (i == 0 ? "granted" :
2463 (i == 1 ? "converting" :
2464 "blocked")));
2465 ret = -ENOTEMPTY;
2466 goto leave;
2467 }
2468 }
2469 queue++;
2470 }
2471
2472 *numlocks = count;
2473 mlog(0, "migrateable lockres having %d locks\n", *numlocks);
2474
2475leave:
2476 return ret;
2477}
2427 2478
2428/* 2479/*
2429 * DLM_MIGRATE_LOCKRES 2480 * DLM_MIGRATE_LOCKRES
@@ -2437,14 +2488,12 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
2437 struct dlm_master_list_entry *mle = NULL; 2488 struct dlm_master_list_entry *mle = NULL;
2438 struct dlm_master_list_entry *oldmle = NULL; 2489 struct dlm_master_list_entry *oldmle = NULL;
2439 struct dlm_migratable_lockres *mres = NULL; 2490 struct dlm_migratable_lockres *mres = NULL;
2440 int ret = -EINVAL; 2491 int ret = 0;
2441 const char *name; 2492 const char *name;
2442 unsigned int namelen; 2493 unsigned int namelen;
2443 int mle_added = 0; 2494 int mle_added = 0;
2444 struct list_head *queue, *iter; 2495 int numlocks;
2445 int i; 2496 int wake = 0;
2446 struct dlm_lock *lock;
2447 int empty = 1, wake = 0;
2448 2497
2449 if (!dlm_grab(dlm)) 2498 if (!dlm_grab(dlm))
2450 return -EINVAL; 2499 return -EINVAL;
@@ -2458,42 +2507,16 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
2458 * ensure this lockres is a proper candidate for migration 2507 * ensure this lockres is a proper candidate for migration
2459 */ 2508 */
2460 spin_lock(&res->spinlock); 2509 spin_lock(&res->spinlock);
2461 if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { 2510 ret = dlm_is_lockres_migrateable(dlm, res, &numlocks);
2462 mlog(0, "cannot migrate lockres with unknown owner!\n"); 2511 if (ret < 0) {
2463 spin_unlock(&res->spinlock);
2464 goto leave;
2465 }
2466 if (res->owner != dlm->node_num) {
2467 mlog(0, "cannot migrate lockres this node doesn't own!\n");
2468 spin_unlock(&res->spinlock); 2512 spin_unlock(&res->spinlock);
2469 goto leave; 2513 goto leave;
2470 } 2514 }
2471 mlog(0, "checking queues...\n");
2472 queue = &res->granted;
2473 for (i=0; i<3; i++) {
2474 list_for_each(iter, queue) {
2475 lock = list_entry (iter, struct dlm_lock, list);
2476 empty = 0;
2477 if (lock->ml.node == dlm->node_num) {
2478 mlog(0, "found a lock owned by this node "
2479 "still on the %s queue! will not "
2480 "migrate this lockres\n",
2481 i==0 ? "granted" :
2482 (i==1 ? "converting" : "blocked"));
2483 spin_unlock(&res->spinlock);
2484 ret = -ENOTEMPTY;
2485 goto leave;
2486 }
2487 }
2488 queue++;
2489 }
2490 mlog(0, "all locks on this lockres are nonlocal. continuing\n");
2491 spin_unlock(&res->spinlock); 2515 spin_unlock(&res->spinlock);
2492 2516
2493 /* no work to do */ 2517 /* no work to do */
2494 if (empty) { 2518 if (numlocks == 0) {
2495 mlog(0, "no locks were found on this lockres! done!\n"); 2519 mlog(0, "no locks were found on this lockres! done!\n");
2496 ret = 0;
2497 goto leave; 2520 goto leave;
2498 } 2521 }
2499 2522
@@ -2729,15 +2752,26 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
2729{ 2752{
2730 int ret; 2753 int ret;
2731 int lock_dropped = 0; 2754 int lock_dropped = 0;
2755 int numlocks;
2732 2756
2757 spin_lock(&res->spinlock);
2733 if (res->owner != dlm->node_num) { 2758 if (res->owner != dlm->node_num) {
2734 if (!__dlm_lockres_unused(res)) { 2759 if (!__dlm_lockres_unused(res)) {
2735 mlog(ML_ERROR, "%s:%.*s: this node is not master, " 2760 mlog(ML_ERROR, "%s:%.*s: this node is not master, "
2736 "trying to free this but locks remain\n", 2761 "trying to free this but locks remain\n",
2737 dlm->name, res->lockname.len, res->lockname.name); 2762 dlm->name, res->lockname.len, res->lockname.name);
2738 } 2763 }
2764 spin_unlock(&res->spinlock);
2765 goto leave;
2766 }
2767
2768 /* No need to migrate a lockres having no locks */
2769 ret = dlm_is_lockres_migrateable(dlm, res, &numlocks);
2770 if (ret >= 0 && numlocks == 0) {
2771 spin_unlock(&res->spinlock);
2739 goto leave; 2772 goto leave;
2740 } 2773 }
2774 spin_unlock(&res->spinlock);
2741 2775
2742 /* Wheee! Migrate lockres here! Will sleep so drop spinlock. */ 2776 /* Wheee! Migrate lockres here! Will sleep so drop spinlock. */
2743 spin_unlock(&dlm->spinlock); 2777 spin_unlock(&dlm->spinlock);
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 8ffa0916eb86..2b264c6ba039 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -256,18 +256,14 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
256 break; 256 break;
257 } 257 }
258 258
259 mlog(0, "removing lockres %.*s:%p from purgelist\n", 259 dlm_lockres_get(lockres);
260 lockres->lockname.len, lockres->lockname.name, lockres);
261 list_del_init(&lockres->purge);
262 dlm_lockres_put(lockres);
263 dlm->purge_count--;
264 260
265 /* This may drop and reacquire the dlm spinlock if it 261 /* This may drop and reacquire the dlm spinlock if it
266 * has to do migration. */ 262 * has to do migration. */
267 mlog(0, "calling dlm_purge_lockres!\n");
268 if (dlm_purge_lockres(dlm, lockres)) 263 if (dlm_purge_lockres(dlm, lockres))
269 BUG(); 264 BUG();
270 mlog(0, "DONE calling dlm_purge_lockres!\n"); 265
266 dlm_lockres_put(lockres);
271 267
272 /* Avoid adding any scheduling latencies */ 268 /* Avoid adding any scheduling latencies */
273 cond_resched_lock(&dlm->spinlock); 269 cond_resched_lock(&dlm->spinlock);
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index 8fc52d6d0ce7..b25ef63781ba 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -164,8 +164,10 @@ int ocfs2_register_hb_callbacks(struct ocfs2_super *osb)
164 } 164 }
165 165
166 status = o2hb_register_callback(&osb->osb_hb_up); 166 status = o2hb_register_callback(&osb->osb_hb_up);
167 if (status < 0) 167 if (status < 0) {
168 mlog_errno(status); 168 mlog_errno(status);
169 o2hb_unregister_callback(&osb->osb_hb_down);
170 }
169 171
170bail: 172bail:
171 return status; 173 return status;
@@ -173,18 +175,11 @@ bail:
173 175
174void ocfs2_clear_hb_callbacks(struct ocfs2_super *osb) 176void ocfs2_clear_hb_callbacks(struct ocfs2_super *osb)
175{ 177{
176 int status;
177
178 if (ocfs2_mount_local(osb)) 178 if (ocfs2_mount_local(osb))
179 return; 179 return;
180 180
181 status = o2hb_unregister_callback(&osb->osb_hb_down); 181 o2hb_unregister_callback(&osb->osb_hb_down);
182 if (status < 0) 182 o2hb_unregister_callback(&osb->osb_hb_up);
183 mlog_errno(status);
184
185 status = o2hb_unregister_callback(&osb->osb_hb_up);
186 if (status < 0)
187 mlog_errno(status);
188} 183}
189 184
190void ocfs2_stop_heartbeat(struct ocfs2_super *osb) 185void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig
index 74552c60b671..6e8bb66fe619 100644
--- a/fs/partitions/Kconfig
+++ b/fs/partitions/Kconfig
@@ -235,5 +235,4 @@ config EFI_PARTITION
235 select CRC32 235 select CRC32
236 help 236 help
237 Say Y here if you would like to use hard disks under Linux which 237 Say Y here if you would like to use hard disks under Linux which
238 were partitioned using EFI GPT. Presently only useful on the 238 were partitioned using EFI GPT.
239 IA-64 platform.
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 22d38ffc9ef0..8a7d0035ad7a 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -180,7 +180,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
180 } 180 }
181 if (res > 0) 181 if (res > 0)
182 return state; 182 return state;
183 if (!err) 183 if (err)
184 /* The partition is unrecognized. So report I/O errors if there were any */ 184 /* The partition is unrecognized. So report I/O errors if there were any */
185 res = err; 185 res = err;
186 if (!res) 186 if (!res)
@@ -541,7 +541,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
541 if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) 541 if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
542 return 0; 542 return 0;
543 if (IS_ERR(state)) /* I/O error reading the partition table */ 543 if (IS_ERR(state)) /* I/O error reading the partition table */
544 return PTR_ERR(state); 544 return -EIO;
545 for (p = 1; p < state->limit; p++) { 545 for (p = 1; p < state->limit; p++) {
546 sector_t size = state->parts[p].size; 546 sector_t size = state->parts[p].size;
547 sector_t from = state->parts[p].from; 547 sector_t from = state->parts[p].from;
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index a6b3a8f878f0..bce38e3f06cb 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -8,8 +8,9 @@ proc-y := nommu.o task_nommu.o
8proc-$(CONFIG_MMU) := mmu.o task_mmu.o 8proc-$(CONFIG_MMU) := mmu.o task_mmu.o
9 9
10proc-y += inode.o root.o base.o generic.o array.o \ 10proc-y += inode.o root.o base.o generic.o array.o \
11 proc_tty.o proc_misc.o proc_sysctl.o 11 proc_tty.o proc_misc.o
12 12
13proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
13proc-$(CONFIG_PROC_KCORE) += kcore.o 14proc-$(CONFIG_PROC_KCORE) += kcore.o
14proc-$(CONFIG_PROC_VMCORE) += vmcore.o 15proc-$(CONFIG_PROC_VMCORE) += vmcore.o
15proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o 16proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 01f7769da8e6..989af5e55d1b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1558,29 +1558,20 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
1558 size_t count, loff_t *ppos) 1558 size_t count, loff_t *ppos)
1559{ 1559{
1560 struct inode * inode = file->f_path.dentry->d_inode; 1560 struct inode * inode = file->f_path.dentry->d_inode;
1561 unsigned long page; 1561 char *p = NULL;
1562 ssize_t length; 1562 ssize_t length;
1563 struct task_struct *task = get_proc_task(inode); 1563 struct task_struct *task = get_proc_task(inode);
1564 1564
1565 length = -ESRCH;
1566 if (!task) 1565 if (!task)
1567 goto out_no_task; 1566 return -ESRCH;
1568
1569 if (count > PAGE_SIZE)
1570 count = PAGE_SIZE;
1571 length = -ENOMEM;
1572 if (!(page = __get_free_page(GFP_KERNEL)))
1573 goto out;
1574 1567
1575 length = security_getprocattr(task, 1568 length = security_getprocattr(task,
1576 (char*)file->f_path.dentry->d_name.name, 1569 (char*)file->f_path.dentry->d_name.name,
1577 (void*)page, count); 1570 &p);
1578 if (length >= 0)
1579 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length);
1580 free_page(page);
1581out:
1582 put_task_struct(task); 1571 put_task_struct(task);
1583out_no_task: 1572 if (length > 0)
1573 length = simple_read_from_buffer(buf, count, ppos, p, length);
1574 kfree(p);
1584 return length; 1575 return length;
1585} 1576}
1586 1577
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index c932aa65e198..f771889183c3 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -11,7 +11,11 @@
11 11
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13 13
14#ifdef CONFIG_PROC_SYSCTL
14extern int proc_sys_init(void); 15extern int proc_sys_init(void);
16#else
17static inline void proc_sys_init(void) { }
18#endif
15 19
16struct vmalloc_info { 20struct vmalloc_info {
17 unsigned long used; 21 unsigned long used;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 5834a744c2a9..41f17037f738 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -79,9 +79,7 @@ void __init proc_root_init(void)
79 proc_device_tree_init(); 79 proc_device_tree_init();
80#endif 80#endif
81 proc_bus = proc_mkdir("bus", NULL); 81 proc_bus = proc_mkdir("bus", NULL);
82#ifdef CONFIG_SYSCTL
83 proc_sys_init(); 82 proc_sys_init();
84#endif
85} 83}
86 84
87static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat 85static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index 42261dbdf60f..723f7c667661 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -181,6 +181,7 @@ static int smb_setup_request(struct smb_request *req)
181 req->rq_errno = 0; 181 req->rq_errno = 0;
182 req->rq_fragment = 0; 182 req->rq_fragment = 0;
183 kfree(req->rq_trans2buffer); 183 kfree(req->rq_trans2buffer);
184 req->rq_trans2buffer = NULL;
184 185
185 return 0; 186 return 0;
186} 187}
diff --git a/fs/splice.c b/fs/splice.c
index 2fca6ebf4cc2..5428b0ff3b6f 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -576,76 +576,21 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
576 if (this_len + offset > PAGE_CACHE_SIZE) 576 if (this_len + offset > PAGE_CACHE_SIZE)
577 this_len = PAGE_CACHE_SIZE - offset; 577 this_len = PAGE_CACHE_SIZE - offset;
578 578
579 /*
580 * Reuse buf page, if SPLICE_F_MOVE is set and we are doing a full
581 * page.
582 */
583 if ((sd->flags & SPLICE_F_MOVE) && this_len == PAGE_CACHE_SIZE) {
584 /*
585 * If steal succeeds, buf->page is now pruned from the
586 * pagecache and we can reuse it. The page will also be
587 * locked on successful return.
588 */
589 if (buf->ops->steal(pipe, buf))
590 goto find_page;
591
592 page = buf->page;
593 if (add_to_page_cache(page, mapping, index, GFP_KERNEL)) {
594 unlock_page(page);
595 goto find_page;
596 }
597
598 page_cache_get(page);
599
600 if (!(buf->flags & PIPE_BUF_FLAG_LRU))
601 lru_cache_add(page);
602 } else {
603find_page: 579find_page:
604 page = find_lock_page(mapping, index); 580 page = find_lock_page(mapping, index);
605 if (!page) { 581 if (!page) {
606 ret = -ENOMEM; 582 ret = -ENOMEM;
607 page = page_cache_alloc_cold(mapping); 583 page = page_cache_alloc_cold(mapping);
608 if (unlikely(!page)) 584 if (unlikely(!page))
609 goto out_ret; 585 goto out_ret;
610
611 /*
612 * This will also lock the page
613 */
614 ret = add_to_page_cache_lru(page, mapping, index,
615 GFP_KERNEL);
616 if (unlikely(ret))
617 goto out;
618 }
619 586
620 /* 587 /*
621 * We get here with the page locked. If the page is also 588 * This will also lock the page
622 * uptodate, we don't need to do more. If it isn't, we
623 * may need to bring it in if we are not going to overwrite
624 * the full page.
625 */ 589 */
626 if (!PageUptodate(page)) { 590 ret = add_to_page_cache_lru(page, mapping, index,
627 if (this_len < PAGE_CACHE_SIZE) { 591 GFP_KERNEL);
628 ret = mapping->a_ops->readpage(file, page); 592 if (unlikely(ret))
629 if (unlikely(ret)) 593 goto out;
630 goto out;
631
632 lock_page(page);
633
634 if (!PageUptodate(page)) {
635 /*
636 * Page got invalidated, repeat.
637 */
638 if (!page->mapping) {
639 unlock_page(page);
640 page_cache_release(page);
641 goto find_page;
642 }
643 ret = -EIO;
644 goto out;
645 }
646 } else
647 SetPageUptodate(page);
648 }
649 } 594 }
650 595
651 ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len); 596 ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len);
@@ -682,18 +627,25 @@ find_page:
682 } 627 }
683 628
684 ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); 629 ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
685 if (!ret) { 630 if (ret) {
631 if (ret == AOP_TRUNCATED_PAGE) {
632 page_cache_release(page);
633 goto find_page;
634 }
635 if (ret < 0)
636 goto out;
686 /* 637 /*
687 * Return the number of bytes written and mark page as 638 * Partial write has happened, so 'ret' already initialized by
688 * accessed, we are now done! 639 * number of bytes written, Where is nothing we have to do here.
689 */ 640 */
641 } else
690 ret = this_len; 642 ret = this_len;
691 mark_page_accessed(page); 643 /*
692 balance_dirty_pages_ratelimited(mapping); 644 * Return the number of bytes written and mark page as
693 } else if (ret == AOP_TRUNCATED_PAGE) { 645 * accessed, we are now done!
694 page_cache_release(page); 646 */
695 goto find_page; 647 mark_page_accessed(page);
696 } 648 balance_dirty_pages_ratelimited(mapping);
697out: 649out:
698 page_cache_release(page); 650 page_cache_release(page);
699 unlock_page(page); 651 unlock_page(page);
@@ -706,9 +658,9 @@ out_ret:
706 * key here is the 'actor' worker passed in that actually moves the data 658 * key here is the 'actor' worker passed in that actually moves the data
707 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above. 659 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above.
708 */ 660 */
709static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, 661ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
710 struct file *out, loff_t *ppos, size_t len, 662 struct file *out, loff_t *ppos, size_t len,
711 unsigned int flags, splice_actor *actor) 663 unsigned int flags, splice_actor *actor)
712{ 664{
713 int ret, do_wakeup, err; 665 int ret, do_wakeup, err;
714 struct splice_desc sd; 666 struct splice_desc sd;
@@ -802,6 +754,7 @@ static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
802 754
803 return ret; 755 return ret;
804} 756}
757EXPORT_SYMBOL(__splice_from_pipe);
805 758
806ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, 759ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
807 loff_t *ppos, size_t len, unsigned int flags, 760 loff_t *ppos, size_t len, unsigned int flags,
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 8d4d839a9d88..fc4633378dc0 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -168,12 +168,12 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
168 ssize_t retval = 0; 168 ssize_t retval = 0;
169 169
170 down(&buffer->sem); 170 down(&buffer->sem);
171 if (buffer->orphaned) {
172 retval = -ENODEV;
173 goto out;
174 }
175 if (buffer->needs_read_fill) { 171 if (buffer->needs_read_fill) {
176 if ((retval = fill_read_buffer(file->f_path.dentry,buffer))) 172 if (buffer->orphaned)
173 retval = -ENODEV;
174 else
175 retval = fill_read_buffer(file->f_path.dentry,buffer);
176 if (retval)
177 goto out; 177 goto out;
178 } 178 }
179 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n", 179 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
@@ -629,6 +629,60 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
629} 629}
630EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group); 630EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group);
631 631
632struct sysfs_schedule_callback_struct {
633 struct kobject *kobj;
634 void (*func)(void *);
635 void *data;
636 struct work_struct work;
637};
638
639static void sysfs_schedule_callback_work(struct work_struct *work)
640{
641 struct sysfs_schedule_callback_struct *ss = container_of(work,
642 struct sysfs_schedule_callback_struct, work);
643
644 (ss->func)(ss->data);
645 kobject_put(ss->kobj);
646 kfree(ss);
647}
648
649/**
650 * sysfs_schedule_callback - helper to schedule a callback for a kobject
651 * @kobj: object we're acting for.
652 * @func: callback function to invoke later.
653 * @data: argument to pass to @func.
654 *
655 * sysfs attribute methods must not unregister themselves or their parent
656 * kobject (which would amount to the same thing). Attempts to do so will
657 * deadlock, since unregistration is mutually exclusive with driver
658 * callbacks.
659 *
660 * Instead methods can call this routine, which will attempt to allocate
661 * and schedule a workqueue request to call back @func with @data as its
662 * argument in the workqueue's process context. @kobj will be pinned
663 * until @func returns.
664 *
665 * Returns 0 if the request was submitted, -ENOMEM if storage could not
666 * be allocated.
667 */
668int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
669 void *data)
670{
671 struct sysfs_schedule_callback_struct *ss;
672
673 ss = kmalloc(sizeof(*ss), GFP_KERNEL);
674 if (!ss)
675 return -ENOMEM;
676 kobject_get(kobj);
677 ss->kobj = kobj;
678 ss->func = func;
679 ss->data = data;
680 INIT_WORK(&ss->work, sysfs_schedule_callback_work);
681 schedule_work(&ss->work);
682 return 0;
683}
684EXPORT_SYMBOL_GPL(sysfs_schedule_callback);
685
632 686
633EXPORT_SYMBOL_GPL(sysfs_create_file); 687EXPORT_SYMBOL_GPL(sysfs_create_file);
634EXPORT_SYMBOL_GPL(sysfs_remove_file); 688EXPORT_SYMBOL_GPL(sysfs_remove_file);
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index ccb7d722c558..4de5c6b89918 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -222,13 +222,17 @@ const unsigned char * sysfs_get_name(struct sysfs_dirent *sd)
222 222
223static inline void orphan_all_buffers(struct inode *node) 223static inline void orphan_all_buffers(struct inode *node)
224{ 224{
225 struct sysfs_buffer_collection *set = node->i_private; 225 struct sysfs_buffer_collection *set;
226 struct sysfs_buffer *buf; 226 struct sysfs_buffer *buf;
227 227
228 mutex_lock_nested(&node->i_mutex, I_MUTEX_CHILD); 228 mutex_lock_nested(&node->i_mutex, I_MUTEX_CHILD);
229 if (node->i_private) { 229 set = node->i_private;
230 list_for_each_entry(buf, &set->associates, associates) 230 if (set) {
231 list_for_each_entry(buf, &set->associates, associates) {
232 down(&buf->sem);
231 buf->orphaned = 1; 233 buf->orphaned = 1;
234 up(&buf->sem);
235 }
232 } 236 }
233 mutex_unlock(&node->i_mutex); 237 mutex_unlock(&node->i_mutex);
234} 238}
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index bcc44084e004..841ac25fd950 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -244,62 +244,87 @@ failed:
244 * We can come here from ufs_writepage or ufs_prepare_write, 244 * We can come here from ufs_writepage or ufs_prepare_write,
245 * locked_page is argument of these functions, so we already lock it. 245 * locked_page is argument of these functions, so we already lock it.
246 */ 246 */
247static void ufs_change_blocknr(struct inode *inode, unsigned int beg, 247static void ufs_change_blocknr(struct inode *inode, sector_t beg,
248 unsigned int count, unsigned int oldb, 248 unsigned int count, sector_t oldb,
249 unsigned int newb, struct page *locked_page) 249 sector_t newb, struct page *locked_page)
250{ 250{
251 const unsigned mask = (1 << (PAGE_CACHE_SHIFT - inode->i_blkbits)) - 1; 251 const unsigned blks_per_page =
252 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits);
253 const unsigned mask = blks_per_page - 1;
252 struct address_space * const mapping = inode->i_mapping; 254 struct address_space * const mapping = inode->i_mapping;
253 pgoff_t index, cur_index; 255 pgoff_t index, cur_index, last_index;
254 unsigned end, pos, j; 256 unsigned pos, j, lblock;
257 sector_t end, i;
255 struct page *page; 258 struct page *page;
256 struct buffer_head *head, *bh; 259 struct buffer_head *head, *bh;
257 260
258 UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n", 261 UFSD("ENTER, ino %lu, count %u, oldb %llu, newb %llu\n",
259 inode->i_ino, count, oldb, newb); 262 inode->i_ino, count,
263 (unsigned long long)oldb, (unsigned long long)newb);
260 264
261 BUG_ON(!locked_page); 265 BUG_ON(!locked_page);
262 BUG_ON(!PageLocked(locked_page)); 266 BUG_ON(!PageLocked(locked_page));
263 267
264 cur_index = locked_page->index; 268 cur_index = locked_page->index;
265 269 end = count + beg;
266 for (end = count + beg; beg < end; beg = (beg | mask) + 1) { 270 last_index = end >> (PAGE_CACHE_SHIFT - inode->i_blkbits);
267 index = beg >> (PAGE_CACHE_SHIFT - inode->i_blkbits); 271 for (i = beg; i < end; i = (i | mask) + 1) {
272 index = i >> (PAGE_CACHE_SHIFT - inode->i_blkbits);
268 273
269 if (likely(cur_index != index)) { 274 if (likely(cur_index != index)) {
270 page = ufs_get_locked_page(mapping, index); 275 page = ufs_get_locked_page(mapping, index);
271 if (!page || IS_ERR(page)) /* it was truncated or EIO */ 276 if (!page)/* it was truncated */
277 continue;
278 if (IS_ERR(page)) {/* or EIO */
279 ufs_error(inode->i_sb, __FUNCTION__,
280 "read of page %llu failed\n",
281 (unsigned long long)index);
272 continue; 282 continue;
283 }
273 } else 284 } else
274 page = locked_page; 285 page = locked_page;
275 286
276 head = page_buffers(page); 287 head = page_buffers(page);
277 bh = head; 288 bh = head;
278 pos = beg & mask; 289 pos = i & mask;
279 for (j = 0; j < pos; ++j) 290 for (j = 0; j < pos; ++j)
280 bh = bh->b_this_page; 291 bh = bh->b_this_page;
281 j = 0; 292
293
294 if (unlikely(index == last_index))
295 lblock = end & mask;
296 else
297 lblock = blks_per_page;
298
282 do { 299 do {
283 if (buffer_mapped(bh)) { 300 if (j >= lblock)
284 pos = bh->b_blocknr - oldb; 301 break;
285 if (pos < count) { 302 pos = (i - beg) + j;
286 UFSD(" change from %llu to %llu\n", 303
287 (unsigned long long)pos + oldb, 304 if (!buffer_mapped(bh))
288 (unsigned long long)pos + newb); 305 map_bh(bh, inode->i_sb, oldb + pos);
289 bh->b_blocknr = newb + pos; 306 if (!buffer_uptodate(bh)) {
290 unmap_underlying_metadata(bh->b_bdev, 307 ll_rw_block(READ, 1, &bh);
291 bh->b_blocknr); 308 wait_on_buffer(bh);
292 mark_buffer_dirty(bh); 309 if (!buffer_uptodate(bh)) {
293 ++j; 310 ufs_error(inode->i_sb, __FUNCTION__,
311 "read of block failed\n");
312 break;
294 } 313 }
295 } 314 }
296 315
316 UFSD(" change from %llu to %llu, pos %u\n",
317 (unsigned long long)pos + oldb,
318 (unsigned long long)pos + newb, pos);
319
320 bh->b_blocknr = newb + pos;
321 unmap_underlying_metadata(bh->b_bdev,
322 bh->b_blocknr);
323 mark_buffer_dirty(bh);
324 ++j;
297 bh = bh->b_this_page; 325 bh = bh->b_this_page;
298 } while (bh != head); 326 } while (bh != head);
299 327
300 if (j)
301 set_page_dirty(page);
302
303 if (likely(cur_index != index)) 328 if (likely(cur_index != index))
304 ufs_put_locked_page(page); 329 ufs_put_locked_page(page);
305 } 330 }
@@ -457,8 +482,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
457 if (result) { 482 if (result) {
458 ufs_clear_frags(inode, result + oldcount, newcount - oldcount, 483 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
459 locked_page != NULL); 484 locked_page != NULL);
460 ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp, 485 ufs_change_blocknr(inode, fragment - oldcount, oldcount,
461 result, locked_page); 486 uspi->s_sbbase + tmp,
487 uspi->s_sbbase + result, locked_page);
462 ufs_cpu_to_data_ptr(sb, p, result); 488 ufs_cpu_to_data_ptr(sb, p, result);
463 *err = 0; 489 *err = 0;
464 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 490 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index b868878009b6..c28a8b6f2feb 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -343,9 +343,8 @@ cg_found:
343 lock_buffer(bh); 343 lock_buffer(bh);
344 ufs2_inode = (struct ufs2_inode *)bh->b_data; 344 ufs2_inode = (struct ufs2_inode *)bh->b_data;
345 ufs2_inode += ufs_inotofsbo(inode->i_ino); 345 ufs2_inode += ufs_inotofsbo(inode->i_ino);
346 ufs2_inode->ui_birthtime.tv_sec = 346 ufs2_inode->ui_birthtime = cpu_to_fs64(sb, CURRENT_TIME.tv_sec);
347 cpu_to_fs32(sb, CURRENT_TIME_SEC.tv_sec); 347 ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, CURRENT_TIME.tv_nsec);
348 ufs2_inode->ui_birthtime.tv_usec = 0;
349 mark_buffer_dirty(bh); 348 mark_buffer_dirty(bh);
350 unlock_buffer(bh); 349 unlock_buffer(bh);
351 if (sb->s_flags & MS_SYNCHRONOUS) 350 if (sb->s_flags & MS_SYNCHRONOUS)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index fb34ad03e224..013d7afe7cde 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -212,7 +212,7 @@ repeat:
212 brelse (result); 212 brelse (result);
213 goto repeat; 213 goto repeat;
214 } else { 214 } else {
215 *phys = tmp + blockoff; 215 *phys = uspi->s_sbbase + tmp + blockoff;
216 return NULL; 216 return NULL;
217 } 217 }
218 } 218 }
@@ -282,9 +282,9 @@ repeat:
282 } 282 }
283 283
284 if (!phys) { 284 if (!phys) {
285 result = sb_getblk(sb, tmp + blockoff); 285 result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff);
286 } else { 286 } else {
287 *phys = tmp + blockoff; 287 *phys = uspi->s_sbbase + tmp + blockoff;
288 result = NULL; 288 result = NULL;
289 *err = 0; 289 *err = 0;
290 *new = 1; 290 *new = 1;
@@ -368,7 +368,7 @@ repeat:
368 brelse (result); 368 brelse (result);
369 goto repeat; 369 goto repeat;
370 } else { 370 } else {
371 *phys = tmp + blockoff; 371 *phys = uspi->s_sbbase + tmp + blockoff;
372 goto out; 372 goto out;
373 } 373 }
374 } 374 }
@@ -389,9 +389,9 @@ repeat:
389 389
390 390
391 if (!phys) { 391 if (!phys) {
392 result = sb_getblk(sb, tmp + blockoff); 392 result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff);
393 } else { 393 } else {
394 *phys = tmp + blockoff; 394 *phys = uspi->s_sbbase + tmp + blockoff;
395 *new = 1; 395 *new = 1;
396 } 396 }
397 397
@@ -668,12 +668,12 @@ static void ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
668 inode->i_gid = fs32_to_cpu(sb, ufs2_inode->ui_gid); 668 inode->i_gid = fs32_to_cpu(sb, ufs2_inode->ui_gid);
669 669
670 inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); 670 inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size);
671 inode->i_atime.tv_sec = fs32_to_cpu(sb, ufs2_inode->ui_atime.tv_sec); 671 inode->i_atime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_atime);
672 inode->i_ctime.tv_sec = fs32_to_cpu(sb, ufs2_inode->ui_ctime.tv_sec); 672 inode->i_ctime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_ctime);
673 inode->i_mtime.tv_sec = fs32_to_cpu(sb, ufs2_inode->ui_mtime.tv_sec); 673 inode->i_mtime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_mtime);
674 inode->i_mtime.tv_nsec = 0; 674 inode->i_atime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_atimensec);
675 inode->i_atime.tv_nsec = 0; 675 inode->i_ctime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_ctimensec);
676 inode->i_ctime.tv_nsec = 0; 676 inode->i_mtime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_mtimensec);
677 inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); 677 inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks);
678 inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen); 678 inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen);
679 ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags); 679 ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags);
@@ -803,12 +803,12 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode)
803 ufs_inode->ui_gid = cpu_to_fs32(sb, inode->i_gid); 803 ufs_inode->ui_gid = cpu_to_fs32(sb, inode->i_gid);
804 804
805 ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); 805 ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size);
806 ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); 806 ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec);
807 ufs_inode->ui_atime.tv_usec = 0; 807 ufs_inode->ui_atimensec = cpu_to_fs32(sb, inode->i_atime.tv_nsec);
808 ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb, inode->i_ctime.tv_sec); 808 ufs_inode->ui_ctime = cpu_to_fs64(sb, inode->i_ctime.tv_sec);
809 ufs_inode->ui_ctime.tv_usec = 0; 809 ufs_inode->ui_ctimensec = cpu_to_fs32(sb, inode->i_ctime.tv_nsec);
810 ufs_inode->ui_mtime.tv_sec = cpu_to_fs32(sb, inode->i_mtime.tv_sec); 810 ufs_inode->ui_mtime = cpu_to_fs64(sb, inode->i_mtime.tv_sec);
811 ufs_inode->ui_mtime.tv_usec = 0; 811 ufs_inode->ui_mtimensec = cpu_to_fs32(sb, inode->i_mtime.tv_nsec);
812 812
813 ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks); 813 ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks);
814 ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); 814 ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags);
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 749581fa7729..79c54c85fb58 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -74,7 +74,7 @@ static int ufs_trunc_direct(struct inode *inode)
74 unsigned i, tmp; 74 unsigned i, tmp;
75 int retry; 75 int retry;
76 76
77 UFSD("ENTER\n"); 77 UFSD("ENTER: ino %lu\n", inode->i_ino);
78 78
79 sb = inode->i_sb; 79 sb = inode->i_sb;
80 uspi = UFS_SB(sb)->s_uspi; 80 uspi = UFS_SB(sb)->s_uspi;
@@ -96,8 +96,8 @@ static int ufs_trunc_direct(struct inode *inode)
96 block2 = ufs_fragstoblks (frag3); 96 block2 = ufs_fragstoblks (frag3);
97 } 97 }
98 98
99 UFSD("frag1 %llu, frag2 %llu, block1 %llu, block2 %llu, frag3 %llu," 99 UFSD("ino %lu, frag1 %llu, frag2 %llu, block1 %llu, block2 %llu,"
100 " frag4 %llu\n", 100 " frag3 %llu, frag4 %llu\n", inode->i_ino,
101 (unsigned long long)frag1, (unsigned long long)frag2, 101 (unsigned long long)frag1, (unsigned long long)frag2,
102 (unsigned long long)block1, (unsigned long long)block2, 102 (unsigned long long)block1, (unsigned long long)block2,
103 (unsigned long long)frag3, (unsigned long long)frag4); 103 (unsigned long long)frag3, (unsigned long long)frag4);
@@ -163,7 +163,7 @@ next1:
163 mark_inode_dirty(inode); 163 mark_inode_dirty(inode);
164 next3: 164 next3:
165 165
166 UFSD("EXIT\n"); 166 UFSD("EXIT: ino %lu\n", inode->i_ino);
167 return retry; 167 return retry;
168} 168}
169 169
@@ -248,7 +248,7 @@ static int ufs_trunc_indirect(struct inode *inode, u64 offset, void *p)
248 } 248 }
249 ubh_brelse (ind_ubh); 249 ubh_brelse (ind_ubh);
250 250
251 UFSD("EXIT\n"); 251 UFSD("EXIT: ino %lu\n", inode->i_ino);
252 252
253 return retry; 253 return retry;
254} 254}
@@ -262,7 +262,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p)
262 void *dind; 262 void *dind;
263 int retry = 0; 263 int retry = 0;
264 264
265 UFSD("ENTER\n"); 265 UFSD("ENTER: ino %lu\n", inode->i_ino);
266 266
267 sb = inode->i_sb; 267 sb = inode->i_sb;
268 uspi = UFS_SB(sb)->s_uspi; 268 uspi = UFS_SB(sb)->s_uspi;
@@ -312,7 +312,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p)
312 } 312 }
313 ubh_brelse (dind_bh); 313 ubh_brelse (dind_bh);
314 314
315 UFSD("EXIT\n"); 315 UFSD("EXIT: ino %lu\n", inode->i_ino);
316 316
317 return retry; 317 return retry;
318} 318}
@@ -327,7 +327,7 @@ static int ufs_trunc_tindirect(struct inode *inode)
327 void *tind, *p; 327 void *tind, *p;
328 int retry; 328 int retry;
329 329
330 UFSD("ENTER\n"); 330 UFSD("ENTER: ino %lu\n", inode->i_ino);
331 331
332 retry = 0; 332 retry = 0;
333 333
@@ -348,7 +348,7 @@ static int ufs_trunc_tindirect(struct inode *inode)
348 } 348 }
349 349
350 for (i = tindirect_block ; i < uspi->s_apb ; i++) { 350 for (i = tindirect_block ; i < uspi->s_apb ; i++) {
351 tind = ubh_get_addr32 (tind_bh, i); 351 tind = ubh_get_data_ptr(uspi, tind_bh, i);
352 retry |= ufs_trunc_dindirect(inode, UFS_NDADDR + 352 retry |= ufs_trunc_dindirect(inode, UFS_NDADDR +
353 uspi->s_apb + ((i + 1) << uspi->s_2apbshift), tind); 353 uspi->s_apb + ((i + 1) << uspi->s_2apbshift), tind);
354 ubh_mark_buffer_dirty(tind_bh); 354 ubh_mark_buffer_dirty(tind_bh);
@@ -372,19 +372,21 @@ static int ufs_trunc_tindirect(struct inode *inode)
372 } 372 }
373 ubh_brelse (tind_bh); 373 ubh_brelse (tind_bh);
374 374
375 UFSD("EXIT\n"); 375 UFSD("EXIT: ino %lu\n", inode->i_ino);
376 return retry; 376 return retry;
377} 377}
378 378
379static int ufs_alloc_lastblock(struct inode *inode) 379static int ufs_alloc_lastblock(struct inode *inode)
380{ 380{
381 int err = 0; 381 int err = 0;
382 struct super_block *sb = inode->i_sb;
382 struct address_space *mapping = inode->i_mapping; 383 struct address_space *mapping = inode->i_mapping;
383 struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi; 384 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
384 unsigned i, end; 385 unsigned i, end;
385 sector_t lastfrag; 386 sector_t lastfrag;
386 struct page *lastpage; 387 struct page *lastpage;
387 struct buffer_head *bh; 388 struct buffer_head *bh;
389 u64 phys64;
388 390
389 lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift; 391 lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift;
390 392
@@ -424,6 +426,20 @@ static int ufs_alloc_lastblock(struct inode *inode)
424 set_page_dirty(lastpage); 426 set_page_dirty(lastpage);
425 } 427 }
426 428
429 if (lastfrag >= UFS_IND_FRAGMENT) {
430 end = uspi->s_fpb - ufs_fragnum(lastfrag) - 1;
431 phys64 = bh->b_blocknr + 1;
432 for (i = 0; i < end; ++i) {
433 bh = sb_getblk(sb, i + phys64);
434 lock_buffer(bh);
435 memset(bh->b_data, 0, sb->s_blocksize);
436 set_buffer_uptodate(bh);
437 mark_buffer_dirty(bh);
438 unlock_buffer(bh);
439 sync_dirty_buffer(bh);
440 brelse(bh);
441 }
442 }
427out_unlock: 443out_unlock:
428 ufs_put_locked_page(lastpage); 444 ufs_put_locked_page(lastpage);
429out: 445out:
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index e2bea6a661f0..69e9e80735d2 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1829,11 +1829,11 @@ xfs_buf_init(void)
1829 if (!xfs_buf_zone) 1829 if (!xfs_buf_zone)
1830 goto out_free_trace_buf; 1830 goto out_free_trace_buf;
1831 1831
1832 xfslogd_workqueue = create_freezeable_workqueue("xfslogd"); 1832 xfslogd_workqueue = create_workqueue("xfslogd");
1833 if (!xfslogd_workqueue) 1833 if (!xfslogd_workqueue)
1834 goto out_free_buf_zone; 1834 goto out_free_buf_zone;
1835 1835
1836 xfsdatad_workqueue = create_freezeable_workqueue("xfsdatad"); 1836 xfsdatad_workqueue = create_workqueue("xfsdatad");
1837 if (!xfsdatad_workqueue) 1837 if (!xfsdatad_workqueue)
1838 goto out_destroy_xfslogd_workqueue; 1838 goto out_destroy_xfslogd_workqueue;
1839 1839
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index 73967c8152d3..440983019993 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -446,14 +446,10 @@ acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
446/* 446/*
447 * exutils - interpreter/scanner utilities 447 * exutils - interpreter/scanner utilities
448 */ 448 */
449void acpi_ex_enter_interpreter(void); 449acpi_status acpi_ex_enter_interpreter(void);
450 450
451void acpi_ex_exit_interpreter(void); 451void acpi_ex_exit_interpreter(void);
452 452
453void acpi_ex_reacquire_interpreter(void);
454
455void acpi_ex_relinquish_interpreter(void);
456
457void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); 453void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
458 454
459u8 acpi_ex_acquire_global_lock(u32 rule); 455u8 acpi_ex_acquire_global_lock(u32 rule);
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 72a6e2c3a536..56bf492e7acc 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -344,7 +344,7 @@ typedef u32 acpi_integer;
344 344
345/* 64-bit integers */ 345/* 64-bit integers */
346 346
347typedef u64 acpi_integer; 347typedef unsigned long long acpi_integer;
348#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 348#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
349#define ACPI_INTEGER_BIT_SIZE 64 349#define ACPI_INTEGER_BIT_SIZE 64
350#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 350#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
diff --git a/include/asm-arm/arch-at91/gpio.h b/include/asm-arm/arch-at91/gpio.h
index 98ad2114f43a..0a241e2fb672 100644
--- a/include/asm-arm/arch-at91/gpio.h
+++ b/include/asm-arm/arch-at91/gpio.h
@@ -223,7 +223,7 @@ static inline void gpio_free(unsigned gpio)
223} 223}
224 224
225extern int gpio_direction_input(unsigned gpio); 225extern int gpio_direction_input(unsigned gpio);
226extern int gpio_direction_output(unsigned gpio); 226extern int gpio_direction_output(unsigned gpio, int value);
227 227
228static inline int gpio_get_value(unsigned gpio) 228static inline int gpio_get_value(unsigned gpio)
229{ 229{
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index b7b5414d9320..a41ba229c564 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -238,23 +238,6 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
238#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l)) 238#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l))
239#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l)) 239#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l))
240 240
241static inline int
242check_signature(const unsigned char __iomem *bus_addr, const unsigned char *signature,
243 int length)
244{
245 int retval = 0;
246 do {
247 if (readb(bus_addr) != *signature)
248 goto out;
249 bus_addr++;
250 signature++;
251 length--;
252 } while (length);
253 retval = 1;
254out:
255 return retval;
256}
257
258#endif 241#endif
259 242
260#ifndef CONFIG_PCI 243#ifndef CONFIG_PCI
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index 9444958bec1e..ed35e5c94f40 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -144,9 +144,9 @@
144#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000) 144#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
145#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000) 145#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
146#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000) 146#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
147#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000) 147#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000)
148#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000) 148#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000)
149#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000) 149#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000)
150#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000) 150#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
151#define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000) 151#define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
152#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000) 152#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
diff --git a/include/asm-arm/arch-lh7a40x/entry-macro.S b/include/asm-arm/arch-lh7a40x/entry-macro.S
index 502700604e00..ffe397250f0c 100644
--- a/include/asm-arm/arch-lh7a40x/entry-macro.S
+++ b/include/asm-arm/arch-lh7a40x/entry-macro.S
@@ -86,6 +86,12 @@ branch_irq_lh7a400: b 1000f
86 .macro disable_fiq 86 .macro disable_fiq
87 .endm 87 .endm
88 88
89 .macro get_irqnr_preamble, base, tmp
90 .endm
91
92 .macro arch_ret_to_user, tmp1, tmp2
93 .endm
94
89 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 95 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
90 mov \irqnr, #0 96 mov \irqnr, #0
91 mov \base, #io_p2v(0x80000000) @ APB registers 97 mov \base, #io_p2v(0x80000000) @ APB registers
@@ -105,6 +111,12 @@ branch_irq_lh7a400: b 1000f
105 .macro disable_fiq 111 .macro disable_fiq
106 .endm 112 .endm
107 113
114 .macro get_irqnr_preamble, base, tmp
115 .endm
116
117 .macro arch_ret_to_user, tmp1, tmp2
118 .endm
119
108 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 120 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
109 mov \irqnr, #0 @ VIC1 irq base 121 mov \irqnr, #0 @ VIC1 irq base
110 mov \base, #io_p2v(0x80000000) @ APB registers 122 mov \base, #io_p2v(0x80000000) @ APB registers
diff --git a/include/asm-arm/arch-ns9xxx/clock.h b/include/asm-arm/arch-ns9xxx/clock.h
index 4371a485db47..a7c5ab3d9011 100644
--- a/include/asm-arm/arch-ns9xxx/clock.h
+++ b/include/asm-arm/arch-ns9xxx/clock.h
@@ -11,6 +11,7 @@
11#ifndef __ASM_ARCH_CLOCK_H 11#ifndef __ASM_ARCH_CLOCK_H
12#define __ASM_ARCH_CLOCK_H 12#define __ASM_ARCH_CLOCK_H
13 13
14static inline u32 ns9xxx_systemclock(void) __attribute__((const));
14static inline u32 ns9xxx_systemclock(void) 15static inline u32 ns9xxx_systemclock(void)
15{ 16{
16 /* 17 /*
@@ -19,17 +20,20 @@ static inline u32 ns9xxx_systemclock(void)
19 return 353894400; 20 return 353894400;
20} 21}
21 22
22static inline const u32 ns9xxx_cpuclock(void) 23static inline u32 ns9xxx_cpuclock(void) __attribute__((const));
24static inline u32 ns9xxx_cpuclock(void)
23{ 25{
24 return ns9xxx_systemclock() / 2; 26 return ns9xxx_systemclock() / 2;
25} 27}
26 28
27static inline const u32 ns9xxx_ahbclock(void) 29static inline u32 ns9xxx_ahbclock(void) __attribute__((const));
30static inline u32 ns9xxx_ahbclock(void)
28{ 31{
29 return ns9xxx_systemclock() / 4; 32 return ns9xxx_systemclock() / 4;
30} 33}
31 34
32static inline const u32 ns9xxx_bbusclock(void) 35static inline u32 ns9xxx_bbusclock(void) __attribute__((const));
36static inline u32 ns9xxx_bbusclock(void)
33{ 37{
34 return ns9xxx_systemclock() / 8; 38 return ns9xxx_systemclock() / 8;
35} 39}
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
index 3762a6ae6a7f..590917efc94a 100644
--- a/include/asm-arm/arch-omap/gpio.h
+++ b/include/asm-arm/arch-omap/gpio.h
@@ -113,8 +113,9 @@ static inline int gpio_direction_input(unsigned gpio)
113 return __gpio_set_direction(gpio, 1); 113 return __gpio_set_direction(gpio, 1);
114} 114}
115 115
116static inline int gpio_direction_output(unsigned gpio) 116static inline int gpio_direction_output(unsigned gpio, int value)
117{ 117{
118 omap_set_gpio_dataout(gpio, value);
118 return __gpio_set_direction(gpio, 0); 119 return __gpio_set_direction(gpio, 0);
119} 120}
120 121
diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h
index 3d348a351157..aeba24347f8e 100644
--- a/include/asm-arm/arch-pxa/gpio.h
+++ b/include/asm-arm/arch-pxa/gpio.h
@@ -43,9 +43,9 @@ static inline int gpio_direction_input(unsigned gpio)
43 return pxa_gpio_mode(gpio | GPIO_IN); 43 return pxa_gpio_mode(gpio | GPIO_IN);
44} 44}
45 45
46static inline int gpio_direction_output(unsigned gpio) 46static inline int gpio_direction_output(unsigned gpio, int value)
47{ 47{
48 return pxa_gpio_mode(gpio | GPIO_OUT); 48 return pxa_gpio_mode(gpio | GPIO_OUT | (value ? 0 : GPIO_DFLT_LOW));
49} 49}
50 50
51static inline int __gpio_get_value(unsigned gpio) 51static inline int __gpio_get_value(unsigned gpio)
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index aec835b6f057..139c9d954818 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1476,7 +1476,7 @@
1476#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT) 1476#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT)
1477#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT) 1477#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT)
1478#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT) 1478#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT)
1479#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_OUT) 1479#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN)
1480#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN) 1480#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN)
1481 1481
1482/* 1482/*
diff --git a/include/asm-arm/arch-s3c2410/gpio.h b/include/asm-arm/arch-s3c2410/gpio.h
index d47ae453f8ca..7583895fd336 100644
--- a/include/asm-arm/arch-s3c2410/gpio.h
+++ b/include/asm-arm/arch-s3c2410/gpio.h
@@ -44,9 +44,11 @@ static inline int gpio_direction_input(unsigned gpio)
44 return 0; 44 return 0;
45} 45}
46 46
47static inline int gpio_direction_output(unsigned gpio) 47static inline int gpio_direction_output(unsigned gpio, int value)
48{ 48{
49 s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT); 49 s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT);
50 /* REVISIT can we write the value first, to avoid glitching? */
51 s3c2410_gpio_setpin(gpio, value);
50 return 0; 52 return 0;
51} 53}
52 54
diff --git a/include/asm-arm/arch-sa1100/gpio.h b/include/asm-arm/arch-sa1100/gpio.h
index da7575b0e5d0..e7a9d26e22a8 100644
--- a/include/asm-arm/arch-sa1100/gpio.h
+++ b/include/asm-arm/arch-sa1100/gpio.h
@@ -38,7 +38,7 @@ static inline void gpio_free(unsigned gpio)
38} 38}
39 39
40extern int gpio_direction_input(unsigned gpio); 40extern int gpio_direction_input(unsigned gpio);
41extern int gpio_direction_output(unsigned gpio); 41extern int gpio_direction_output(unsigned gpio, int value);
42 42
43 43
44static inline int gpio_get_value(unsigned gpio) 44static inline int gpio_get_value(unsigned gpio)
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index ea88aa6bfc78..f266c2795124 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -103,9 +103,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
103 unsigned long tmp, tmp2; 103 unsigned long tmp, tmp2;
104 104
105 __asm__ __volatile__("@ atomic_clear_mask\n" 105 __asm__ __volatile__("@ atomic_clear_mask\n"
106"1: ldrex %0, %2\n" 106"1: ldrex %0, [%2]\n"
107" bic %0, %0, %3\n" 107" bic %0, %0, %3\n"
108" strex %1, %0, %2\n" 108" strex %1, %0, [%2]\n"
109" teq %1, #0\n" 109" teq %1, #0\n"
110" bne 1b" 110" bne 1b"
111 : "=&r" (tmp), "=&r" (tmp2) 111 : "=&r" (tmp), "=&r" (tmp2)
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index f06d8a43fdee..69134c7518c1 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/memory.h>
6 7
7#define CPU_ARCH_UNKNOWN 0 8#define CPU_ARCH_UNKNOWN 0
8#define CPU_ARCH_ARMv3 1 9#define CPU_ARCH_ARMv3 1
@@ -154,7 +155,7 @@ extern unsigned int user_debug;
154#define vectors_high() (0) 155#define vectors_high() (0)
155#endif 156#endif
156 157
157#if __LINUX_ARM_ARCH__ >= 6 158#if defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ >= 6
158#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \ 159#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
159 : : "r" (0) : "memory") 160 : : "r" (0) : "memory")
160#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \ 161#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
@@ -168,22 +169,23 @@ extern unsigned int user_debug;
168#define dmb() __asm__ __volatile__ ("" : : : "memory") 169#define dmb() __asm__ __volatile__ ("" : : : "memory")
169#endif 170#endif
170 171
171#define mb() barrier() 172#ifndef CONFIG_SMP
172#define rmb() barrier() 173#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
173#define wmb() barrier() 174#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
174#define read_barrier_depends() do { } while(0) 175#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
175 176#define smp_mb() barrier()
176#ifdef CONFIG_SMP 177#define smp_rmb() barrier()
177#define smp_mb() dmb() 178#define smp_wmb() barrier()
178#define smp_rmb() dmb()
179#define smp_wmb() dmb()
180#define smp_read_barrier_depends() read_barrier_depends()
181#else 179#else
182#define smp_mb() barrier() 180#define mb() dmb()
183#define smp_rmb() barrier() 181#define rmb() dmb()
184#define smp_wmb() barrier() 182#define wmb() dmb()
185#define smp_read_barrier_depends() read_barrier_depends() 183#define smp_mb() dmb()
186#endif /* CONFIG_SMP */ 184#define smp_rmb() dmb()
185#define smp_wmb() dmb()
186#endif
187#define read_barrier_depends() do { } while(0)
188#define smp_read_barrier_depends() do { } while(0)
187 189
188#define set_mb(var, value) do { var = value; smp_mb(); } while (0) 190#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
189#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); 191#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 0991b7bc3f78..c025ab47e4b9 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -372,7 +372,7 @@
372#define __NR_move_pages (__NR_SYSCALL_BASE+344) 372#define __NR_move_pages (__NR_SYSCALL_BASE+344)
373#define __NR_getcpu (__NR_SYSCALL_BASE+345) 373#define __NR_getcpu (__NR_SYSCALL_BASE+345)
374 /* 346 for epoll_pwait */ 374 /* 346 for epoll_pwait */
375#define __NR_sys_kexec_load (__NR_SYSCALL_BASE+347) 375#define __NR_kexec_load (__NR_SYSCALL_BASE+347)
376 376
377/* 377/*
378 * The following SWIs are ARM private. 378 * The following SWIs are ARM private.
diff --git a/include/asm-avr32/Kbuild b/include/asm-avr32/Kbuild
index 8770e73ce938..3136628ba8d2 100644
--- a/include/asm-avr32/Kbuild
+++ b/include/asm-avr32/Kbuild
@@ -1,3 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3headers-y += cachectl.h 3header-y += cachectl.h
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h
index fcb756bdaa8e..80a21aa9ae77 100644
--- a/include/asm-avr32/arch-at32ap/gpio.h
+++ b/include/asm-avr32/arch-at32ap/gpio.h
@@ -10,7 +10,7 @@ int __must_check gpio_request(unsigned int gpio, const char *label);
10void gpio_free(unsigned int gpio); 10void gpio_free(unsigned int gpio);
11 11
12int gpio_direction_input(unsigned int gpio); 12int gpio_direction_input(unsigned int gpio);
13int gpio_direction_output(unsigned int gpio); 13int gpio_direction_output(unsigned int gpio, int value);
14int gpio_get_value(unsigned int gpio); 14int gpio_get_value(unsigned int gpio);
15void gpio_set_value(unsigned int gpio, int value); 15void gpio_set_value(unsigned int gpio, int value);
16 16
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 115813e48fe0..21bb60bbb9a1 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -274,6 +274,24 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
274 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction); 274 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
275} 275}
276 276
277static inline void
278dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
279 unsigned long offset, size_t size,
280 enum dma_data_direction direction)
281{
282 /* just sync everything, that's all the pci API can do */
283 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
284}
285
286static inline void
287dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
288 unsigned long offset, size_t size,
289 enum dma_data_direction direction)
290{
291 /* just sync everything, that's all the pci API can do */
292 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
293}
294
277/** 295/**
278 * dma_sync_sg_for_cpu 296 * dma_sync_sg_for_cpu
279 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 297 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 00c23433b39f..6d7e279b1490 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -180,6 +180,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
180#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE 180#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
181#define arch_enter_lazy_mmu_mode() do {} while (0) 181#define arch_enter_lazy_mmu_mode() do {} while (0)
182#define arch_leave_lazy_mmu_mode() do {} while (0) 182#define arch_leave_lazy_mmu_mode() do {} while (0)
183#define arch_flush_lazy_mmu_mode() do {} while (0)
183#endif 184#endif
184 185
185/* 186/*
@@ -193,6 +194,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
193#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE 194#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
194#define arch_enter_lazy_cpu_mode() do {} while (0) 195#define arch_enter_lazy_cpu_mode() do {} while (0)
195#define arch_leave_lazy_cpu_mode() do {} while (0) 196#define arch_leave_lazy_cpu_mode() do {} while (0)
197#define arch_flush_lazy_cpu_mode() do {} while (0)
196#endif 198#endif
197 199
198/* 200/*
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index cc6b1652249a..a19810a08ae9 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -117,6 +117,7 @@ extern void enable_NMI_through_LVT0 (void * dummy);
117#define ARCH_APICTIMER_STOPS_ON_C3 1 117#define ARCH_APICTIMER_STOPS_ON_C3 1
118 118
119extern int timer_over_8254; 119extern int timer_over_8254;
120extern int local_apic_timer_c2_ok;
120 121
121#else /* !CONFIG_X86_LOCAL_APIC */ 122#else /* !CONFIG_X86_LOCAL_APIC */
122static inline void lapic_shutdown(void) { } 123static inline void lapic_shutdown(void) { }
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index 3f92b94e0d75..d1b8e4ab6c1a 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -75,6 +75,7 @@
75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
78#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
78 79
79/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 80/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
80#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 81#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 8d33c9bb7c1c..952b3ee3c9bb 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -88,16 +88,16 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
88 pr_reg[4] = regs->edi; \ 88 pr_reg[4] = regs->edi; \
89 pr_reg[5] = regs->ebp; \ 89 pr_reg[5] = regs->ebp; \
90 pr_reg[6] = regs->eax; \ 90 pr_reg[6] = regs->eax; \
91 pr_reg[7] = regs->xds; \ 91 pr_reg[7] = regs->xds & 0xffff; \
92 pr_reg[8] = regs->xes; \ 92 pr_reg[8] = regs->xes & 0xffff; \
93 pr_reg[9] = regs->xfs; \ 93 pr_reg[9] = regs->xfs & 0xffff; \
94 savesegment(gs,pr_reg[10]); \ 94 savesegment(gs,pr_reg[10]); \
95 pr_reg[11] = regs->orig_eax; \ 95 pr_reg[11] = regs->orig_eax; \
96 pr_reg[12] = regs->eip; \ 96 pr_reg[12] = regs->eip; \
97 pr_reg[13] = regs->xcs; \ 97 pr_reg[13] = regs->xcs & 0xffff; \
98 pr_reg[14] = regs->eflags; \ 98 pr_reg[14] = regs->eflags; \
99 pr_reg[15] = regs->esp; \ 99 pr_reg[15] = regs->esp; \
100 pr_reg[16] = regs->xss; 100 pr_reg[16] = regs->xss & 0xffff;
101 101
102/* This yields a mask that user programs can use to figure out what 102/* This yields a mask that user programs can use to figure out what
103 instruction set this CPU supports. This could be done in user space, 103 instruction set this CPU supports. This could be done in user space,
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index ec3b6803fd36..2ad3f30b1a68 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -275,6 +275,8 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
275#define MSR_K7_FID_VID_CTL 0xC0010041 275#define MSR_K7_FID_VID_CTL 0xC0010041
276#define MSR_K7_FID_VID_STATUS 0xC0010042 276#define MSR_K7_FID_VID_STATUS 0xC0010042
277 277
278#define MSR_K8_ENABLE_C1E 0xC0010055
279
278/* extended feature register */ 280/* extended feature register */
279#define MSR_EFER 0xc0000080 281#define MSR_EFER 0xc0000080
280 282
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h
index 64544cb85d6a..b04333ea6f31 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -33,7 +33,7 @@ extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
33 33
34extern atomic_t nmi_active; 34extern atomic_t nmi_active;
35extern unsigned int nmi_watchdog; 35extern unsigned int nmi_watchdog;
36#define NMI_DEFAULT 0 36#define NMI_DEFAULT -1
37#define NMI_NONE 0 37#define NMI_NONE 0
38#define NMI_IO_APIC 1 38#define NMI_IO_APIC 1
39#define NMI_LOCAL_APIC 2 39#define NMI_LOCAL_APIC 2
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index f8319cae2ac5..e63f1e444fcf 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -130,7 +130,7 @@ struct paravirt_ops
130 void (*flush_tlb_kernel)(void); 130 void (*flush_tlb_kernel)(void);
131 void (*flush_tlb_single)(u32 addr); 131 void (*flush_tlb_single)(u32 addr);
132 132
133 void (fastcall *map_pt_hook)(int type, pte_t *va, u32 pfn); 133 void (*map_pt_hook)(int type, pte_t *va, u32 pfn);
134 134
135 void (*alloc_pt)(u32 pfn); 135 void (*alloc_pt)(u32 pfn);
136 void (*alloc_pd)(u32 pfn); 136 void (*alloc_pd)(u32 pfn);
@@ -421,14 +421,17 @@ static inline void pmd_clear(pmd_t *pmdp)
421#define PARAVIRT_LAZY_NONE 0 421#define PARAVIRT_LAZY_NONE 0
422#define PARAVIRT_LAZY_MMU 1 422#define PARAVIRT_LAZY_MMU 1
423#define PARAVIRT_LAZY_CPU 2 423#define PARAVIRT_LAZY_CPU 2
424#define PARAVIRT_LAZY_FLUSH 3
424 425
425#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE 426#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
426#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU) 427#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU)
427#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 428#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
429#define arch_flush_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
428 430
429#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 431#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
430#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU) 432#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU)
431#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 433#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
434#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
432 435
433/* These all sit in the .parainstructions section to tell us what to patch. */ 436/* These all sit in the .parainstructions section to tell us what to patch. */
434struct paravirt_patch { 437struct paravirt_patch {
diff --git a/include/asm-i386/sync_bitops.h b/include/asm-i386/sync_bitops.h
index c94d51c993ee..7d72351bea75 100644
--- a/include/asm-i386/sync_bitops.h
+++ b/include/asm-i386/sync_bitops.h
@@ -130,7 +130,7 @@ static inline int sync_test_and_change_bit(int nr, volatile unsigned long* addr)
130 return oldbit; 130 return oldbit;
131} 131}
132 132
133static __always_inline int sync_const_test_bit(int nr, const volatile unsigned long *addr) 133static __always_inline int sync_constant_test_bit(int nr, const volatile unsigned long *addr)
134{ 134{
135 return ((1UL << (nr & 31)) & 135 return ((1UL << (nr & 31)) &
136 (((const volatile unsigned int *)addr)[nr >> 5])) != 0; 136 (((const volatile unsigned int *)addr)[nr >> 5])) != 0;
diff --git a/include/asm-i386/termbits.h b/include/asm-i386/termbits.h
index 12baf1d6343f..2e6237693814 100644
--- a/include/asm-i386/termbits.h
+++ b/include/asm-i386/termbits.h
@@ -144,7 +144,7 @@ struct ktermios {
144#define B3000000 0010015 144#define B3000000 0010015
145#define B3500000 0010016 145#define B3500000 0010016
146#define B4000000 0010017 146#define B4000000 0010017
147#define CIBAUD 002003600000 /* input baud rate (not used) */ 147#define CIBAUD 002003600000
148#define CMSPAR 010000000000 /* mark or space (stick) parity */ 148#define CMSPAR 010000000000 /* mark or space (stick) parity */
149#define CRTSCTS 020000000000 /* flow control */ 149#define CRTSCTS 020000000000 /* flow control */
150 150
diff --git a/include/asm-i386/vmi_time.h b/include/asm-i386/vmi_time.h
index 94d0a12a4114..c3a1fcf66c96 100644
--- a/include/asm-i386/vmi_time.h
+++ b/include/asm-i386/vmi_time.h
@@ -54,7 +54,7 @@ extern unsigned long vmi_cpu_khz(void);
54 54
55#ifdef CONFIG_X86_LOCAL_APIC 55#ifdef CONFIG_X86_LOCAL_APIC
56extern void __init vmi_timer_setup_boot_alarm(void); 56extern void __init vmi_timer_setup_boot_alarm(void);
57extern void __init vmi_timer_setup_secondary_alarm(void); 57extern void __devinit vmi_timer_setup_secondary_alarm(void);
58extern void apic_vmi_timer_interrupt(void); 58extern void apic_vmi_timer_interrupt(void);
59#endif 59#endif
60 60
diff --git a/include/asm-ia64/kexec.h b/include/asm-ia64/kexec.h
index f2ad469a6ddf..41299ddfee30 100644
--- a/include/asm-ia64/kexec.h
+++ b/include/asm-ia64/kexec.h
@@ -22,7 +22,6 @@
22 } while(0) 22 } while(0)
23 23
24extern struct kimage *ia64_kimage; 24extern struct kimage *ia64_kimage;
25DECLARE_PER_CPU(u64, ia64_mca_pal_base);
26extern const unsigned int relocate_new_kernel_size; 25extern const unsigned int relocate_new_kernel_size;
27extern void relocate_new_kernel(unsigned long, unsigned long, 26extern void relocate_new_kernel(unsigned long, unsigned long,
28 struct ia64_boot_param *, unsigned long); 27 struct ia64_boot_param *, unsigned long);
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 3c96ac19154e..ca33eb181ff2 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -168,6 +168,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
168# define platform_setup_msi_irq ia64_mv.setup_msi_irq 168# define platform_setup_msi_irq ia64_mv.setup_msi_irq
169# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq 169# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq
170# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus 170# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus
171# define platform_kernel_launch_event ia64_mv.kernel_launch_event
171# endif 172# endif
172 173
173/* __attribute__((__aligned__(16))) is required to make size of the 174/* __attribute__((__aligned__(16))) is required to make size of the
@@ -269,6 +270,7 @@ struct ia64_machine_vector {
269 platform_setup_msi_irq, \ 270 platform_setup_msi_irq, \
270 platform_teardown_msi_irq, \ 271 platform_teardown_msi_irq, \
271 platform_pci_fixup_bus, \ 272 platform_pci_fixup_bus, \
273 platform_kernel_launch_event \
272} 274}
273 275
274extern struct ia64_machine_vector ia64_mv; 276extern struct ia64_machine_vector ia64_mv;
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index ee97f7c2d462..41098f459684 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -156,6 +156,8 @@ struct ia64_mca_notify_die {
156 int *monarch_cpu; 156 int *monarch_cpu;
157}; 157};
158 158
159DECLARE_PER_CPU(u64, ia64_mca_pal_base);
160
159#else /* __ASSEMBLY__ */ 161#else /* __ASSEMBLY__ */
160 162
161#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */ 163#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
index 21ec5f3d23de..3a62878e84f3 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -36,6 +36,7 @@ extern void reserve_memory (void);
36extern void find_initrd (void); 36extern void find_initrd (void);
37extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg); 37extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
38extern void efi_memmap_init(unsigned long *, unsigned long *); 38extern void efi_memmap_init(unsigned long *, unsigned long *);
39extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
39 40
40extern unsigned long vmcore_find_descriptor_size(unsigned long address); 41extern unsigned long vmcore_find_descriptor_size(unsigned long address);
41extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end); 42extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end);
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index e43021a99a20..67656ce767c2 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -371,6 +371,7 @@ typedef u64 pal_mc_info_index_t;
371 * dependent 371 * dependent
372 */ 372 */
373 373
374#define PAL_TLB_CHECK_OP_PURGE 8
374 375
375typedef struct pal_process_state_info_s { 376typedef struct pal_process_state_info_s {
376 u64 reserved1 : 2, 377 u64 reserved1 : 2,
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 5160233bbfac..5a5d1c2ce39d 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -9,6 +9,7 @@
9 9
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/scatterlist.h> 11#include <asm/scatterlist.h>
12#include <asm/hw_irq.h>
12 13
13/* 14/*
14 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus 15 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
@@ -170,7 +171,7 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
170#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 171#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
171static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 172static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
172{ 173{
173 return channel ? 15 : 14; 174 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
174} 175}
175 176
176#endif /* _ASM_IA64_PCI_H */ 177#endif /* _ASM_IA64_PCI_H */
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 5830d36fd8e6..4f4ee1c2db2f 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -210,7 +210,7 @@ struct desc_struct {
210 unsigned int a, b; 210 unsigned int a, b;
211}; 211};
212 212
213#define desc_empty(desc) (!((desc)->a + (desc)->b)) 213#define desc_empty(desc) (!((desc)->a | (desc)->b))
214#define desc_equal(desc1, desc2) (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b)) 214#define desc_equal(desc1, desc2) (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
215 215
216#define GDT_ENTRY_TLS_ENTRIES 3 216#define GDT_ENTRY_TLS_ENTRIES 3
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index d000689d9142..46cadf5aaac5 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -847,12 +847,13 @@ extern int ia64_sal_oemcall_reentrant(struct ia64_sal_retval *, u64, u64, u64,
847 */ 847 */
848struct sal_to_os_boot { 848struct sal_to_os_boot {
849 u64 rr[8]; /* Region Registers */ 849 u64 rr[8]; /* Region Registers */
850 u64 br[6]; /* br0: return addr into SAL boot rendez routine */ 850 u64 br[6]; /* br0:
851 * return addr into SAL boot rendez routine */
851 u64 gr1; /* SAL:GP */ 852 u64 gr1; /* SAL:GP */
852 u64 gr12; /* SAL:SP */ 853 u64 gr12; /* SAL:SP */
853 u64 gr13; /* SAL: Task Pointer */ 854 u64 gr13; /* SAL: Task Pointer */
854 u64 fpsr; 855 u64 fpsr;
855 u64 pfs; 856 u64 pfs;
856 u64 rnat; 857 u64 rnat;
857 u64 unat; 858 u64 unat;
858 u64 bspstore; 859 u64 bspstore;
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index 17cb6cc3f21a..da205b7cdaac 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -21,6 +21,7 @@
21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \ 21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \
22 asic == PCIIO_ASIC_TYPE_TIOCP) 22 asic == PCIIO_ASIC_TYPE_TIOCP)
23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC) 23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC)
24#define IS_TIOCP_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_TIOCP)
24 25
25 26
26/* 27/*
@@ -53,8 +54,8 @@
53 * Bridge PMU Address Transaltion Entry Attibutes 54 * Bridge PMU Address Transaltion Entry Attibutes
54 */ 55 */
55#define PCI32_ATE_V (0x1 << 0) 56#define PCI32_ATE_V (0x1 << 0)
56#define PCI32_ATE_CO (0x1 << 1) 57#define PCI32_ATE_CO (0x1 << 1) /* PIC ASIC ONLY */
57#define PCI32_ATE_PREC (0x1 << 2) 58#define PCI32_ATE_PIO (0x1 << 1) /* TIOCP ASIC ONLY */
58#define PCI32_ATE_MSI (0x1 << 2) 59#define PCI32_ATE_MSI (0x1 << 2)
59#define PCI32_ATE_PREF (0x1 << 3) 60#define PCI32_ATE_PREF (0x1 << 3)
60#define PCI32_ATE_BAR (0x1 << 4) 61#define PCI32_ATE_BAR (0x1 << 4)
diff --git a/include/asm-ia64/unwind.h b/include/asm-ia64/unwind.h
index 5df0276b0493..1af3875f1a57 100644
--- a/include/asm-ia64/unwind.h
+++ b/include/asm-ia64/unwind.h
@@ -81,7 +81,7 @@ struct unw_frame_info {
81 struct unw_ireg { 81 struct unw_ireg {
82 unsigned long *loc; 82 unsigned long *loc;
83 struct unw_ireg_nat { 83 struct unw_ireg_nat {
84 long type : 3; /* enum unw_nat_type */ 84 unsigned long type : 3; /* enum unw_nat_type */
85 signed long off : 61; /* NaT word is at loc+nat.off */ 85 signed long off : 61; /* NaT word is at loc+nat.off */
86 } nat; 86 } nat;
87 } r4, r5, r6, r7; 87 } r4, r5, r6, r7;
diff --git a/include/asm-m32r/dma-mapping.h b/include/asm-m32r/dma-mapping.h
index a7fa0302bda7..f9b58ebba361 100644
--- a/include/asm-m32r/dma-mapping.h
+++ b/include/asm-m32r/dma-mapping.h
@@ -1,23 +1,6 @@
1#ifndef _ASM_M32R_DMA_MAPPING_H 1#ifndef _ASM_M32R_DMA_MAPPING_H
2#define _ASM_M32R_DMA_MAPPING_H 2#define _ASM_M32R_DMA_MAPPING_H
3 3
4/* 4#include <asm-generic/dma-mapping-broken.h>
5 * NOTE: Do not include <asm-generic/dma-mapping.h>
6 * Because it requires PCI stuffs, but current M32R don't provide these.
7 */
8
9static inline void *
10dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
11 gfp_t flag)
12{
13 return (void *)NULL;
14}
15
16static inline void
17dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
18 dma_addr_t dma_handle)
19{
20 return;
21}
22 5
23#endif /* _ASM_M32R_DMA_MAPPING_H */ 6#endif /* _ASM_M32R_DMA_MAPPING_H */
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index 00259ed6fc95..a26cdeb46a57 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -32,7 +32,7 @@ extern void dma_free_coherent(struct device *, size_t,
32 void *, dma_addr_t); 32 void *, dma_addr_t);
33 33
34static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, 34static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
35 dma_addr_t *handle, int flag) 35 dma_addr_t *handle, gfp_t flag)
36{ 36{
37 return dma_alloc_coherent(dev, size, handle, flag); 37 return dma_alloc_coherent(dev, size, handle, flag);
38} 38}
diff --git a/include/asm-m68k/mc146818rtc.h b/include/asm-m68k/mc146818rtc.h
index 11fe12ddb913..9f70a01f73dc 100644
--- a/include/asm-m68k/mc146818rtc.h
+++ b/include/asm-m68k/mc146818rtc.h
@@ -11,6 +11,7 @@
11#include <asm/atarihw.h> 11#include <asm/atarihw.h>
12 12
13#define RTC_PORT(x) (TT_RTC_BAS + 2*(x)) 13#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
14#define RTC_ALWAYS_BCD 0
14 15
15#define CMOS_READ(addr) ({ \ 16#define CMOS_READ(addr) ({ \
16atari_outb_p((addr),RTC_PORT(0)); \ 17atari_outb_p((addr),RTC_PORT(0)); \
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 8578869a8bcf..1ac50b6c47ad 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -79,9 +79,9 @@ static __inline__ void atomic_add(int i, atomic_t * v)
79 } else { 79 } else {
80 unsigned long flags; 80 unsigned long flags;
81 81
82 local_irq_save(flags); 82 raw_local_irq_save(flags);
83 v->counter += i; 83 v->counter += i;
84 local_irq_restore(flags); 84 raw_local_irq_restore(flags);
85 } 85 }
86} 86}
87 87
@@ -124,9 +124,9 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
124 } else { 124 } else {
125 unsigned long flags; 125 unsigned long flags;
126 126
127 local_irq_save(flags); 127 raw_local_irq_save(flags);
128 v->counter -= i; 128 v->counter -= i;
129 local_irq_restore(flags); 129 raw_local_irq_restore(flags);
130 } 130 }
131} 131}
132 132
@@ -173,11 +173,11 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
173 } else { 173 } else {
174 unsigned long flags; 174 unsigned long flags;
175 175
176 local_irq_save(flags); 176 raw_local_irq_save(flags);
177 result = v->counter; 177 result = v->counter;
178 result += i; 178 result += i;
179 v->counter = result; 179 v->counter = result;
180 local_irq_restore(flags); 180 raw_local_irq_restore(flags);
181 } 181 }
182 182
183 smp_mb(); 183 smp_mb();
@@ -225,11 +225,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
225 } else { 225 } else {
226 unsigned long flags; 226 unsigned long flags;
227 227
228 local_irq_save(flags); 228 raw_local_irq_save(flags);
229 result = v->counter; 229 result = v->counter;
230 result -= i; 230 result -= i;
231 v->counter = result; 231 v->counter = result;
232 local_irq_restore(flags); 232 raw_local_irq_restore(flags);
233 } 233 }
234 234
235 smp_mb(); 235 smp_mb();
@@ -293,12 +293,12 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
293 } else { 293 } else {
294 unsigned long flags; 294 unsigned long flags;
295 295
296 local_irq_save(flags); 296 raw_local_irq_save(flags);
297 result = v->counter; 297 result = v->counter;
298 result -= i; 298 result -= i;
299 if (result >= 0) 299 if (result >= 0)
300 v->counter = result; 300 v->counter = result;
301 local_irq_restore(flags); 301 raw_local_irq_restore(flags);
302 } 302 }
303 303
304 smp_mb(); 304 smp_mb();
@@ -454,9 +454,9 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
454 } else { 454 } else {
455 unsigned long flags; 455 unsigned long flags;
456 456
457 local_irq_save(flags); 457 raw_local_irq_save(flags);
458 v->counter += i; 458 v->counter += i;
459 local_irq_restore(flags); 459 raw_local_irq_restore(flags);
460 } 460 }
461} 461}
462 462
@@ -499,9 +499,9 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
499 } else { 499 } else {
500 unsigned long flags; 500 unsigned long flags;
501 501
502 local_irq_save(flags); 502 raw_local_irq_save(flags);
503 v->counter -= i; 503 v->counter -= i;
504 local_irq_restore(flags); 504 raw_local_irq_restore(flags);
505 } 505 }
506} 506}
507 507
@@ -548,11 +548,11 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
548 } else { 548 } else {
549 unsigned long flags; 549 unsigned long flags;
550 550
551 local_irq_save(flags); 551 raw_local_irq_save(flags);
552 result = v->counter; 552 result = v->counter;
553 result += i; 553 result += i;
554 v->counter = result; 554 v->counter = result;
555 local_irq_restore(flags); 555 raw_local_irq_restore(flags);
556 } 556 }
557 557
558 smp_mb(); 558 smp_mb();
@@ -600,11 +600,11 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
600 } else { 600 } else {
601 unsigned long flags; 601 unsigned long flags;
602 602
603 local_irq_save(flags); 603 raw_local_irq_save(flags);
604 result = v->counter; 604 result = v->counter;
605 result -= i; 605 result -= i;
606 v->counter = result; 606 v->counter = result;
607 local_irq_restore(flags); 607 raw_local_irq_restore(flags);
608 } 608 }
609 609
610 smp_mb(); 610 smp_mb();
@@ -668,12 +668,12 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
668 } else { 668 } else {
669 unsigned long flags; 669 unsigned long flags;
670 670
671 local_irq_save(flags); 671 raw_local_irq_save(flags);
672 result = v->counter; 672 result = v->counter;
673 result -= i; 673 result -= i;
674 if (result >= 0) 674 if (result >= 0)
675 v->counter = result; 675 v->counter = result;
676 local_irq_restore(flags); 676 raw_local_irq_restore(flags);
677 } 677 }
678 678
679 smp_mb(); 679 smp_mb();
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 8959da245cfb..d995413e11fd 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -100,9 +100,9 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
100 100
101 a += nr >> SZLONG_LOG; 101 a += nr >> SZLONG_LOG;
102 mask = 1UL << bit; 102 mask = 1UL << bit;
103 local_irq_save(flags); 103 raw_local_irq_save(flags);
104 *a |= mask; 104 *a |= mask;
105 local_irq_restore(flags); 105 raw_local_irq_restore(flags);
106 } 106 }
107} 107}
108 108
@@ -165,9 +165,9 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
165 165
166 a += nr >> SZLONG_LOG; 166 a += nr >> SZLONG_LOG;
167 mask = 1UL << bit; 167 mask = 1UL << bit;
168 local_irq_save(flags); 168 raw_local_irq_save(flags);
169 *a &= ~mask; 169 *a &= ~mask;
170 local_irq_restore(flags); 170 raw_local_irq_restore(flags);
171 } 171 }
172} 172}
173 173
@@ -220,9 +220,9 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
220 220
221 a += nr >> SZLONG_LOG; 221 a += nr >> SZLONG_LOG;
222 mask = 1UL << bit; 222 mask = 1UL << bit;
223 local_irq_save(flags); 223 raw_local_irq_save(flags);
224 *a ^= mask; 224 *a ^= mask;
225 local_irq_restore(flags); 225 raw_local_irq_restore(flags);
226 } 226 }
227} 227}
228 228
@@ -287,10 +287,10 @@ static inline int test_and_set_bit(unsigned long nr,
287 287
288 a += nr >> SZLONG_LOG; 288 a += nr >> SZLONG_LOG;
289 mask = 1UL << bit; 289 mask = 1UL << bit;
290 local_irq_save(flags); 290 raw_local_irq_save(flags);
291 retval = (mask & *a) != 0; 291 retval = (mask & *a) != 0;
292 *a |= mask; 292 *a |= mask;
293 local_irq_restore(flags); 293 raw_local_irq_restore(flags);
294 294
295 return retval; 295 return retval;
296 } 296 }
@@ -381,10 +381,10 @@ static inline int test_and_clear_bit(unsigned long nr,
381 381
382 a += nr >> SZLONG_LOG; 382 a += nr >> SZLONG_LOG;
383 mask = 1UL << bit; 383 mask = 1UL << bit;
384 local_irq_save(flags); 384 raw_local_irq_save(flags);
385 retval = (mask & *a) != 0; 385 retval = (mask & *a) != 0;
386 *a &= ~mask; 386 *a &= ~mask;
387 local_irq_restore(flags); 387 raw_local_irq_restore(flags);
388 388
389 return retval; 389 return retval;
390 } 390 }
@@ -452,10 +452,10 @@ static inline int test_and_change_bit(unsigned long nr,
452 452
453 a += nr >> SZLONG_LOG; 453 a += nr >> SZLONG_LOG;
454 mask = 1UL << bit; 454 mask = 1UL << bit;
455 local_irq_save(flags); 455 raw_local_irq_save(flags);
456 retval = (mask & *a) != 0; 456 retval = (mask & *a) != 0;
457 *a ^= mask; 457 *a ^= mask;
458 local_irq_restore(flags); 458 raw_local_irq_restore(flags);
459 459
460 return retval; 460 return retval;
461 } 461 }
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 0ddada3bb0b6..28d907d4347a 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -48,6 +48,15 @@ static inline void flush_dcache_page(struct page *page)
48#define flush_dcache_mmap_lock(mapping) do { } while (0) 48#define flush_dcache_mmap_lock(mapping) do { } while (0)
49#define flush_dcache_mmap_unlock(mapping) do { } while (0) 49#define flush_dcache_mmap_unlock(mapping) do { } while (0)
50 50
51#define ARCH_HAS_FLUSH_ANON_PAGE
52extern void __flush_anon_page(struct page *, unsigned long);
53static inline void flush_anon_page(struct vm_area_struct *vma,
54 struct page *page, unsigned long vmaddr)
55{
56 if (cpu_has_dc_aliases && PageAnon(page))
57 __flush_anon_page(page, vmaddr);
58}
59
51static inline void flush_icache_page(struct vm_area_struct *vma, 60static inline void flush_icache_page(struct vm_area_struct *vma,
52 struct page *page) 61 struct page *page)
53{ 62{
@@ -86,4 +95,7 @@ extern void (*flush_data_cache_page)(unsigned long addr);
86/* Run kernel code uncached, useful for cache probing functions. */ 95/* Run kernel code uncached, useful for cache probing functions. */
87unsigned long __init run_uncached(void *func); 96unsigned long __init run_uncached(void *func);
88 97
98extern void *kmap_coherent(struct page *page, unsigned long addr);
99extern void kunmap_coherent(struct page *page);
100
89#endif /* _ASM_CACHEFLUSH_H */ 101#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index eadca266f159..5e4bed123b48 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -40,6 +40,9 @@
40#endif 40#endif
41#ifndef cpu_has_fpu 41#ifndef cpu_has_fpu
42#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU) 42#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
43#define raw_cpu_has_fpu (raw_current_cpu_data.options & MIPS_CPU_FPU)
44#else
45#define raw_cpu_has_fpu cpu_has_fpu
43#endif 46#endif
44#ifndef cpu_has_32fpr 47#ifndef cpu_has_32fpr
45#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR) 48#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index 610d0cdeaa9e..22fe8453fcc7 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -87,6 +87,7 @@ struct cpuinfo_mips {
87 87
88extern struct cpuinfo_mips cpu_data[]; 88extern struct cpuinfo_mips cpu_data[];
89#define current_cpu_data cpu_data[smp_processor_id()] 89#define current_cpu_data cpu_data[smp_processor_id()]
90#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
90 91
91extern void cpu_probe(void); 92extern void cpu_probe(void);
92extern void cpu_report(void); 93extern void cpu_report(void);
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index ea77050f8e3a..223d156efb9f 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -79,7 +79,7 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
79 __delay(usecs); 79 __delay(usecs);
80} 80}
81 81
82#define __udelay_val cpu_data[smp_processor_id()].udelay_val 82#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
83 83
84#define udelay(usecs) __udelay((usecs),__udelay_val) 84#define udelay(usecs) __udelay((usecs),__udelay_val)
85 85
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index e06ef0776d48..833437d31ef1 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -74,7 +74,7 @@
74 * 74 *
75 */ 75 */
76 76
77#ifndef GENERIC_ISA_DMA_SUPPORT_BROKEN 77#ifndef CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN
78#define MAX_DMA_CHANNELS 8 78#define MAX_DMA_CHANNELS 8
79#endif 79#endif
80 80
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index efef843b93f0..4e12d1f9534f 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -27,11 +27,11 @@
27struct sigcontext; 27struct sigcontext;
28struct sigcontext32; 28struct sigcontext32;
29 29
30extern asmlinkage int (*save_fp_context)(struct sigcontext *sc); 30extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
31extern asmlinkage int (*restore_fp_context)(struct sigcontext *sc); 31extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
32 32
33extern asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc); 33extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
34extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc); 34extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
35 35
36extern void fpu_emulator_init_fpu(void); 36extern void fpu_emulator_init_fpu(void);
37extern void _init_fpu(void); 37extern void _init_fpu(void);
@@ -68,6 +68,8 @@ do { \
68 /* We don't care about the c0 hazard here */ \ 68 /* We don't care about the c0 hazard here */ \
69} while (0) 69} while (0)
70 70
71#define __fpu_enabled() (read_c0_status() & ST0_CU1)
72
71#define enable_fpu() \ 73#define enable_fpu() \
72do { \ 74do { \
73 if (cpu_has_fpu) \ 75 if (cpu_has_fpu) \
@@ -93,31 +95,47 @@ static inline int is_fpu_owner(void)
93 return cpu_has_fpu && __is_fpu_owner(); 95 return cpu_has_fpu && __is_fpu_owner();
94} 96}
95 97
96static inline void own_fpu(void) 98static inline void __own_fpu(void)
97{ 99{
98 if (cpu_has_fpu) { 100 __enable_fpu();
99 __enable_fpu(); 101 KSTK_STATUS(current) |= ST0_CU1;
100 KSTK_STATUS(current) |= ST0_CU1; 102 set_thread_flag(TIF_USEDFPU);
101 set_thread_flag(TIF_USEDFPU); 103}
104
105static inline void own_fpu(int restore)
106{
107 preempt_disable();
108 if (cpu_has_fpu && !__is_fpu_owner()) {
109 __own_fpu();
110 if (restore)
111 _restore_fp(current);
102 } 112 }
113 preempt_enable();
103} 114}
104 115
105static inline void lose_fpu(void) 116static inline void lose_fpu(int save)
106{ 117{
107 if (cpu_has_fpu) { 118 preempt_disable();
119 if (is_fpu_owner()) {
120 if (save)
121 _save_fp(current);
108 KSTK_STATUS(current) &= ~ST0_CU1; 122 KSTK_STATUS(current) &= ~ST0_CU1;
109 clear_thread_flag(TIF_USEDFPU); 123 clear_thread_flag(TIF_USEDFPU);
110 __disable_fpu(); 124 __disable_fpu();
111 } 125 }
126 preempt_enable();
112} 127}
113 128
114static inline void init_fpu(void) 129static inline void init_fpu(void)
115{ 130{
131 preempt_disable();
116 if (cpu_has_fpu) { 132 if (cpu_has_fpu) {
133 __own_fpu();
117 _init_fpu(); 134 _init_fpu();
118 } else { 135 } else {
119 fpu_emulator_init_fpu(); 136 fpu_emulator_init_fpu();
120 } 137 }
138 preempt_enable();
121} 139}
122 140
123static inline void save_fp(struct task_struct *tsk) 141static inline void save_fp(struct task_struct *tsk)
@@ -144,4 +162,18 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
144 return tsk->thread.fpu.fpr; 162 return tsk->thread.fpu.fpr;
145} 163}
146 164
165static inline void enable_fp_in_kernel(void)
166{
167 set_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
168 /* make sure CU1 and FPU ownership are consistent */
169 if (!__is_fpu_owner() && __fpu_enabled())
170 __disable_fpu();
171}
172
173static inline void disable_fp_in_kernel(void)
174{
175 BUG_ON(!__is_fpu_owner() && __fpu_enabled());
176 clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
177}
178
147#endif /* _ASM_FPU_H */ 179#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 50073157a617..e50c77e69cb5 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -52,6 +52,7 @@ ASMMACRO(tlb_probe_hazard,
52 _ehb 52 _ehb
53 ) 53 )
54ASMMACRO(irq_enable_hazard, 54ASMMACRO(irq_enable_hazard,
55 _ehb
55 ) 56 )
56ASMMACRO(irq_disable_hazard, 57ASMMACRO(irq_disable_hazard,
57 _ehb 58 _ehb
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
index af3b07dfad4b..e459fa05db83 100644
--- a/include/asm-mips/irqflags.h
+++ b/include/asm-mips/irqflags.h
@@ -13,29 +13,9 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/compiler.h>
16#include <asm/hazards.h> 17#include <asm/hazards.h>
17 18
18/*
19 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred IPIs,
20 * at the cost of branch and call overhead on each local_irq_restore()
21 */
22
23#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
24
25extern void smtc_ipi_replay(void);
26
27#define irq_restore_epilog(flags) \
28do { \
29 if (!(flags & 0x0400)) \
30 smtc_ipi_replay(); \
31} while (0)
32
33#else
34
35#define irq_restore_epilog(ignore) do { } while (0)
36
37#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
38
39__asm__ ( 19__asm__ (
40 " .macro raw_local_irq_enable \n" 20 " .macro raw_local_irq_enable \n"
41 " .set push \n" 21 " .set push \n"
@@ -205,17 +185,28 @@ __asm__ (
205 " .set pop \n" 185 " .set pop \n"
206 " .endm \n"); 186 " .endm \n");
207 187
208#define raw_local_irq_restore(flags) \ 188extern void smtc_ipi_replay(void);
209do { \ 189
210 unsigned long __tmp1; \ 190static inline void raw_local_irq_restore(unsigned long flags)
211 \ 191{
212 __asm__ __volatile__( \ 192 unsigned long __tmp1;
213 "raw_local_irq_restore\t%0" \ 193
214 : "=r" (__tmp1) \ 194#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
215 : "0" (flags) \ 195 /*
216 : "memory"); \ 196 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred
217 irq_restore_epilog(flags); \ 197 * IPIs, at the cost of branch and call overhead on each
218} while(0) 198 * local_irq_restore()
199 */
200 if (unlikely(!(flags & 0x0400)))
201 smtc_ipi_replay();
202#endif
203
204 __asm__ __volatile__(
205 "raw_local_irq_restore\t%0"
206 : "=r" (__tmp1)
207 : "0" (flags)
208 : "memory");
209}
219 210
220static inline int raw_irqs_disabled_flags(unsigned long flags) 211static inline int raw_irqs_disabled_flags(unsigned long flags)
221{ 212{
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index e9fa252f8a3f..8fcae21adbd5 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -141,40 +141,6 @@ static int auide_ddma_init( _auide_hwif *auide );
141static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif); 141static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif);
142int __init auide_probe(void); 142int __init auide_probe(void);
143 143
144#ifdef CONFIG_PM
145 int au1200ide_pm_callback( au1xxx_power_dev_t *dev,
146 au1xxx_request_t request, void *data);
147 static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev );
148 static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev );
149 static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev );
150 static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev );
151 static int au1xxxide_pm_access( au1xxx_power_dev_t *dev );
152 static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev );
153 static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev );
154#endif
155
156
157/*
158 * Multi-Word DMA + DbDMA functions
159 */
160#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
161 static int auide_build_sglist(ide_drive_t *drive, struct request *rq);
162 static int auide_build_dmatable(ide_drive_t *drive);
163 static int auide_dma_end(ide_drive_t *drive);
164 ide_startstop_t auide_dma_intr (ide_drive_t *drive);
165 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command);
166 static int auide_dma_setup(ide_drive_t *drive);
167 static int auide_dma_check(ide_drive_t *drive);
168 static int auide_dma_test_irq(ide_drive_t *drive);
169 static int auide_dma_host_off(ide_drive_t *drive);
170 static int auide_dma_host_on(ide_drive_t *drive);
171 static int auide_dma_lostirq(ide_drive_t *drive);
172 static int auide_dma_on(ide_drive_t *drive);
173 static void auide_ddma_tx_callback(int irq, void *param);
174 static void auide_ddma_rx_callback(int irq, void *param);
175 static int auide_dma_off_quietly(ide_drive_t *drive);
176#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
177
178/******************************************************************************* 144/*******************************************************************************
179* PIO Mode timing calculation : * 145* PIO Mode timing calculation : *
180* * 146* *
diff --git a/include/asm-mips/mach-ip27/dma-coherence.h b/include/asm-mips/mach-ip27/dma-coherence.h
index 659816e200d4..3fdbbf68e952 100644
--- a/include/asm-mips/mach-ip27/dma-coherence.h
+++ b/include/asm-mips/mach-ip27/dma-coherence.h
@@ -18,7 +18,8 @@
18 18
19struct device; 19struct device;
20 20
21static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) 21static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
22 size_t size)
22{ 23{
23 dma_addr_t pa = dev_to_baddr(dev, virt_to_phys(addr)); 24 dma_addr_t pa = dev_to_baddr(dev, virt_to_phys(addr));
24 25
@@ -37,7 +38,7 @@ static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
37 return dma_addr & (0xffUL << 56); 38 return dma_addr & (0xffUL << 56);
38} 39}
39 40
40static void plat_unmap_dma_mem(dma_addr_t dma_addr) 41static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
41{ 42{
42} 43}
43 44
diff --git a/include/asm-mips/mach-ip32/dma-coherence.h b/include/asm-mips/mach-ip32/dma-coherence.h
index 950be17bbb86..c3f9a6a20eb0 100644
--- a/include/asm-mips/mach-ip32/dma-coherence.h
+++ b/include/asm-mips/mach-ip32/dma-coherence.h
@@ -26,7 +26,8 @@ struct device;
26 26
27#define RAM_OFFSET_MASK 0x3fffffffUL 27#define RAM_OFFSET_MASK 0x3fffffffUL
28 28
29static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) 29static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
30 size_t size)
30{ 31{
31 dma_addr_t pa = virt_to_phys(addr) & RAM_OFFSET_MASK; 32 dma_addr_t pa = virt_to_phys(addr) & RAM_OFFSET_MASK;
32 33
@@ -59,7 +60,7 @@ static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
59 return addr; 60 return addr;
60} 61}
61 62
62static void plat_unmap_dma_mem(dma_addr_t dma_addr) 63static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
63{ 64{
64} 65}
65 66
diff --git a/include/asm-mips/marvell.h b/include/asm-mips/marvell.h
index df94955b098a..b6144bafc565 100644
--- a/include/asm-mips/marvell.h
+++ b/include/asm-mips/marvell.h
@@ -54,5 +54,6 @@ struct mv_pci_controller {
54}; 54};
55 55
56extern void ll_mv64340_irq(void); 56extern void ll_mv64340_irq(void);
57extern void mv64340_irq_init(unsigned int base);
57 58
58#endif /* __ASM_MIPS_MARVELL_H */ 59#endif /* __ASM_MIPS_MARVELL_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index a5b18710b6a4..49f5a1a2dfcd 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -199,7 +199,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
199{ 199{
200 return pud_val(pud); 200 return pud_val(pud);
201} 201}
202#define pud_phys(pud) (pud_val(pud) - PAGE_OFFSET) 202#define pud_phys(pud) virt_to_phys((void *)pud_val(pud))
203#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT)) 203#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
204 204
205/* Find an entry in the second-level page table.. */ 205/* Find an entry in the second-level page table.. */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 3fcfd7979de5..0d3295f57a95 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -75,7 +75,7 @@ extern void paging_init(void);
75 * Conversion functions: convert a page and protection to a page entry, 75 * Conversion functions: convert a page and protection to a page entry,
76 * and a page entry and page directory to the page they refer to. 76 * and a page entry and page directory to the page they refer to.
77 */ 77 */
78#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) 78#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
80#define pmd_page_vaddr(pmd) pmd_val(pmd) 80#define pmd_page_vaddr(pmd) pmd_val(pmd)
81 81
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
index 59162f74a798..65778c890a62 100644
--- a/include/asm-mips/rtlx.h
+++ b/include/asm-mips/rtlx.h
@@ -23,8 +23,8 @@
23 23
24extern int rtlx_open(int index, int can_sleep); 24extern int rtlx_open(int index, int can_sleep);
25extern int rtlx_release(int index); 25extern int rtlx_release(int index);
26extern ssize_t rtlx_read(int index, void *buff, size_t count, int user); 26extern ssize_t rtlx_read(int index, void __user *buff, size_t count);
27extern ssize_t rtlx_write(int index, void *buffer, size_t count, int user); 27extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
28extern unsigned int rtlx_read_poll(int index, int can_sleep); 28extern 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
diff --git a/include/asm-mips/sgiarcs.h b/include/asm-mips/sgiarcs.h
index ddb859d05257..439bce7daa3a 100644
--- a/include/asm-mips/sgiarcs.h
+++ b/include/asm-mips/sgiarcs.h
@@ -459,7 +459,7 @@ struct linux_smonblock {
459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \ 459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \ 460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \ 461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
462 register signed int __a5 = (a5); \ 462 register signed int __a5 = (int) (long) (a5); \
463 long __vec = (long) romvec->dest; \ 463 long __vec = (long) romvec->dest; \
464 __asm__ __volatile__( \ 464 __asm__ __volatile__( \
465 "dsubu\t$29, 32\n\t" \ 465 "dsubu\t$29, 32\n\t" \
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index dfb29e13bce0..494aa65dcfbd 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -67,6 +67,6 @@ extern void bcm1480_smp_finish(void);
67 67
68#endif 68#endif
69 69
70#define IOADDR(a) ((volatile void __iomem *)(IO_BASE + (a))) 70#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
71 71
72#endif 72#endif
diff --git a/include/asm-mips/sibyte/trace_prof.h b/include/asm-mips/sibyte/trace_prof.h
deleted file mode 100644
index 557792075e9a..000000000000
--- a/include/asm-mips/sibyte/trace_prof.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * Copyright (C) 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef __ASM_SIBYTE_TRACE_PROF_H
20#define __ASM_SIBYTE_TRACE_PROF_H
21
22#undef DBG
23#if SBPROF_TB_DEBUG
24#define DBG(a) a
25#else
26#define DBG(a)
27#endif
28
29#define SBPROF_TB_MAJOR 240
30#define DEVNAME "bcm1250_tbprof"
31
32typedef u_int64_t tb_sample_t[6*256];
33
34struct sbprof_tb {
35 int open;
36 tb_sample_t *sbprof_tbbuf;
37 int next_tb_sample;
38
39 volatile int tb_enable;
40 volatile int tb_armed;
41
42 wait_queue_head_t tb_sync;
43 wait_queue_head_t tb_read;
44};
45
46#define MAX_SAMPLE_BYTES (24*1024*1024)
47#define MAX_TBSAMPLE_BYTES (12*1024*1024)
48
49#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
50#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
51#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
52
53/* IOCTLs */
54#define SBPROF_ZBSTART _IOW('s', 0, int)
55#define SBPROF_ZBSTOP _IOW('s', 1, int)
56#define SBPROF_ZBWAITFULL _IOW('s', 2, int)
57
58/***************************************************************************
59 * Routines for gathering ZBbus profiles using trace buffer
60 ***************************************************************************/
61
62/* Requires: Already called zclk_timer_init with a value that won't
63 saturate 40 bits. No subsequent use of SCD performance counters
64 or trace buffer.
65 Effect: Starts gathering random ZBbus profiles using trace buffer. */
66extern int sbprof_zbprof_start(struct file *filp);
67
68/* Effect: Stops collection of ZBbus profiles */
69extern int sbprof_zbprof_stop(void);
70
71
72/***************************************************************************
73 * Routines for using 40-bit SCD cycle counter
74 *
75 * Client responsible for either handling interrupts or making sure
76 * the cycles counter never saturates, e.g., by doing
77 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
78 ***************************************************************************/
79
80/* Configures SCD counter 0 to count ZCLKs starting from val;
81 Configures SCD counters1,2,3 to count nothing.
82 Must not be called while gathering ZBbus profiles.
83
84unsigned long long val; */
85#define zclk_timer_init(val) \
86 __asm__ __volatile__ (".set push;" \
87 ".set mips64;" \
88 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
89 "sd %0, 0x10($8);" /* write val to counter0 */ \
90 "sd %1, 0($8);" /* config counter0 for zclks*/ \
91 ".set pop" \
92 : /* no outputs */ \
93 /* enable, counter0 */ \
94 : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
95 : /* modifies */ "$8" )
96
97
98/* Reads SCD counter 0 and puts result in value
99 unsigned long long val; */
100#define zclk_get(val) \
101 __asm__ __volatile__ (".set push;" \
102 ".set mips64;" \
103 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
104 "ld %0, 0x10($8);" /* write val to counter0 */ \
105 ".set pop" \
106 : /* outputs */ "=r"(val) \
107 : /* inputs */ \
108 : /* modifies */ "$8" )
109
110#endif /* __ASM_SIBYTE_TRACE_PROF_H */
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
index 360ea6d250c7..a52a4a7a36e0 100644
--- a/include/asm-mips/smtc_ipi.h
+++ b/include/asm-mips/smtc_ipi.h
@@ -65,12 +65,10 @@ static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
65 spin_unlock_irqrestore(&q->lock, flags); 65 spin_unlock_irqrestore(&q->lock, flags);
66} 66}
67 67
68static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q) 68static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
69{ 69{
70 struct smtc_ipi *p; 70 struct smtc_ipi *p;
71 long flags;
72 71
73 spin_lock_irqsave(&q->lock, flags);
74 if (q->head == NULL) 72 if (q->head == NULL)
75 p = NULL; 73 p = NULL;
76 else { 74 else {
@@ -81,7 +79,19 @@ static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
81 if (q->head == NULL) 79 if (q->head == NULL)
82 q->tail = NULL; 80 q->tail = NULL;
83 } 81 }
82
83 return p;
84}
85
86static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
87{
88 unsigned long flags;
89 struct smtc_ipi *p;
90
91 spin_lock_irqsave(&q->lock, flags);
92 p = __smtc_ipi_dq(q);
84 spin_unlock_irqrestore(&q->lock, flags); 93 spin_unlock_irqrestore(&q->lock, flags);
94
85 return p; 95 return p;
86} 96}
87 97
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 597a3743f6a1..290887077e44 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -121,10 +121,10 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
121 } else { 121 } else {
122 unsigned long flags; 122 unsigned long flags;
123 123
124 local_irq_save(flags); 124 raw_local_irq_save(flags);
125 retval = *m; 125 retval = *m;
126 *m = val; 126 *m = val;
127 local_irq_restore(flags); /* implies memory barrier */ 127 raw_local_irq_restore(flags); /* implies memory barrier */
128 } 128 }
129 129
130 smp_mb(); 130 smp_mb();
@@ -169,10 +169,10 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
169 } else { 169 } else {
170 unsigned long flags; 170 unsigned long flags;
171 171
172 local_irq_save(flags); 172 raw_local_irq_save(flags);
173 retval = *m; 173 retval = *m;
174 *m = val; 174 *m = val;
175 local_irq_restore(flags); /* implies memory barrier */ 175 raw_local_irq_restore(flags); /* implies memory barrier */
176 } 176 }
177 177
178 smp_mb(); 178 smp_mb();
@@ -250,11 +250,11 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
250 } else { 250 } else {
251 unsigned long flags; 251 unsigned long flags;
252 252
253 local_irq_save(flags); 253 raw_local_irq_save(flags);
254 retval = *m; 254 retval = *m;
255 if (retval == old) 255 if (retval == old)
256 *m = new; 256 *m = new;
257 local_irq_restore(flags); /* implies memory barrier */ 257 raw_local_irq_restore(flags); /* implies memory barrier */
258 } 258 }
259 259
260 smp_mb(); 260 smp_mb();
@@ -304,11 +304,11 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
304 } else { 304 } else {
305 unsigned long flags; 305 unsigned long flags;
306 306
307 local_irq_save(flags); 307 raw_local_irq_save(flags);
308 retval = *m; 308 retval = *m;
309 if (retval == old) 309 if (retval == old)
310 *m = new; 310 *m = new;
311 local_irq_restore(flags); /* implies memory barrier */ 311 raw_local_irq_restore(flags); /* implies memory barrier */
312 } 312 }
313 313
314 smp_mb(); 314 smp_mb();
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index fbcda8204473..6cf05f4a4e7e 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -119,6 +119,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
120#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
121#define TIF_FREEZE 19 121#define TIF_FREEZE 19
122#define TIF_ALLOW_FP_IN_KERNEL 20
122#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 123#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
123 124
124#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 125#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index a0f14eea1da5..afa700ded877 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -178,7 +178,7 @@ static struct fd_dma_ops virt_dma_ops =
178 ._dma_setup = vdma_dma_setup 178 ._dma_setup = vdma_dma_setup
179}; 179};
180 180
181static int fd_request_dma() 181static int fd_request_dma(void)
182{ 182{
183 if (can_use_virtual_dma & 1) { 183 if (can_use_virtual_dma & 1) {
184 fd_ops = &virt_dma_ops; 184 fd_ops = &virt_dma_ops;
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 60977806d2f4..62efd9d7a43d 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -237,6 +237,20 @@ long plpar_hcall_norets(unsigned long opcode, ...);
237long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); 237long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
238 238
239/** 239/**
240 * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats
241 * @opcode: The hypervisor call to make.
242 * @retbuf: Buffer to store up to 4 return arguments in.
243 *
244 * This call supports up to 6 arguments and 4 return arguments. Use
245 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
246 *
247 * Used when phyp interface needs to be called in real mode. Similar to
248 * plpar_hcall, but plpar_hcall_raw works in real mode and does not
249 * calculate hypervisor call statistics.
250 */
251long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
252
253/**
240 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments 254 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
241 * @opcode: The hypervisor call to make. 255 * @opcode: The hypervisor call to make.
242 * @retbuf: Buffer to store up to 9 return arguments in. 256 * @retbuf: Buffer to store up to 9 return arguments in.
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
index 9fdd0491f6a3..1020b7fc0129 100644
--- a/include/asm-powerpc/immap_qe.h
+++ b/include/asm-powerpc/immap_qe.h
@@ -258,8 +258,9 @@ struct ucc_slow {
258 u8 uccs; /* UCCx status register */ 258 u8 uccs; /* UCCx status register */
259 u8 res3[0x24]; 259 u8 res3[0x24];
260 __be16 utpt; 260 __be16 utpt;
261 u8 res4[0x52];
261 u8 guemr; /* UCC general extended mode register */ 262 u8 guemr; /* UCC general extended mode register */
262 u8 res4[0x200 - 0x091]; 263 u8 res5[0x200 - 0x091];
263} __attribute__ ((packed)); 264} __attribute__ ((packed));
264 265
265/* QE UCC Fast */ 266/* QE UCC Fast */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 0f9f2dd24a79..31d5054be20f 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -165,6 +165,13 @@ int spu_irq_class_0_bottom(struct spu *spu);
165int spu_irq_class_1_bottom(struct spu *spu); 165int spu_irq_class_1_bottom(struct spu *spu);
166void spu_irq_setaffinity(struct spu *spu, int cpu); 166void spu_irq_setaffinity(struct spu *spu, int cpu);
167 167
168extern void spu_invalidate_slbs(struct spu *spu);
169extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
170
171/* Calls from the memory management to the SPU */
172struct mm_struct;
173extern void spu_flush_all_slbs(struct mm_struct *mm);
174
168/* system callbacks from the SPU */ 175/* system callbacks from the SPU */
169struct spu_syscall_block { 176struct spu_syscall_block {
170 u64 nr_ret; 177 u64 nr_ret;
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index bdbf906a767f..8aad0619eb8e 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -221,8 +221,6 @@ struct spu_priv2_collapsed {
221 * @spu_chnlcnt_RW: Array of saved channel counts. 221 * @spu_chnlcnt_RW: Array of saved channel counts.
222 * @spu_chnldata_RW: Array of saved channel data. 222 * @spu_chnldata_RW: Array of saved channel data.
223 * @suspend_time: Time stamp when decrementer disabled. 223 * @suspend_time: Time stamp when decrementer disabled.
224 * @slb_esid_RW: Array of saved SLB esid entries.
225 * @slb_vsid_RW: Array of saved SLB vsid entries.
226 * 224 *
227 * Structure representing the whole of the SPU 225 * Structure representing the whole of the SPU
228 * context save area (CSA). This struct contains 226 * context save area (CSA). This struct contains
@@ -245,8 +243,6 @@ struct spu_state {
245 u32 spu_mailbox_data[4]; 243 u32 spu_mailbox_data[4];
246 u32 pu_mailbox_data[1]; 244 u32 pu_mailbox_data[1];
247 unsigned long suspend_time; 245 unsigned long suspend_time;
248 u64 slb_esid_RW[8];
249 u64 slb_vsid_RW[8];
250 spinlock_t register_lock; 246 spinlock_t register_lock;
251}; 247};
252 248
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 418e5c7e972c..8d853c554631 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -304,5 +304,6 @@ SYSCALL_SPU(fchmodat)
304SYSCALL_SPU(faccessat) 304SYSCALL_SPU(faccessat)
305COMPAT_SYS_SPU(get_robust_list) 305COMPAT_SYS_SPU(get_robust_list)
306COMPAT_SYS_SPU(set_robust_list) 306COMPAT_SYS_SPU(set_robust_list)
307COMPAT_SYS(move_pages) 307COMPAT_SYS_SPU(move_pages)
308SYSCALL_SPU(getcpu) 308SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index bcc21bf56a12..2baedbe54e13 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -325,10 +325,11 @@
325#define __NR_set_robust_list 300 325#define __NR_set_robust_list 300
326#define __NR_move_pages 301 326#define __NR_move_pages 301
327#define __NR_getcpu 302 327#define __NR_getcpu 302
328#define __NR_epoll_pwait 303
328 329
329#ifdef __KERNEL__ 330#ifdef __KERNEL__
330 331
331#define __NR_syscalls 303 332#define __NR_syscalls 304
332 333
333#define __NR__exit __NR_exit 334#define __NR__exit __NR_exit
334#define NR_syscalls __NR_syscalls 335#define NR_syscalls __NR_syscalls
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 0a3cd7ec8451..d5a8e7c1477c 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -121,50 +121,21 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
121 unsigned short len, unsigned short proto, 121 unsigned short len, unsigned short proto,
122 __wsum sum) 122 __wsum sum)
123{ 123{
124#ifndef __s390x__ 124 __u32 csum = (__force __u32)sum;
125 asm volatile( 125
126 " alr %0,%1\n" /* sum += saddr */ 126 csum += (__force __u32)saddr;
127 " brc 12,0f\n" 127 if (csum < (__force __u32)saddr)
128 " ahi %0,1\n" /* add carry */ 128 csum++;
129 "0:" 129
130 : "+&d" (sum) : "d" (saddr) : "cc"); 130 csum += (__force __u32)daddr;
131 asm volatile( 131 if (csum < (__force __u32)daddr)
132 " alr %0,%1\n" /* sum += daddr */ 132 csum++;
133 " brc 12,1f\n" 133
134 " ahi %0,1\n" /* add carry */ 134 csum += len + proto;
135 "1:" 135 if (csum < len + proto)
136 : "+&d" (sum) : "d" (daddr) : "cc"); 136 csum++;
137 asm volatile( 137
138 " alr %0,%1\n" /* sum += len + proto */ 138 return (__force __wsum)csum;
139 " brc 12,2f\n"
140 " ahi %0,1\n" /* add carry */
141 "2:"
142 : "+&d" (sum)
143 : "d" (len + proto)
144 : "cc");
145#else /* __s390x__ */
146 asm volatile(
147 " lgfr %0,%0\n"
148 " algr %0,%1\n" /* sum += saddr */
149 " brc 12,0f\n"
150 " aghi %0,1\n" /* add carry */
151 "0: algr %0,%2\n" /* sum += daddr */
152 " brc 12,1f\n"
153 " aghi %0,1\n" /* add carry */
154 "1: algfr %0,%3\n" /* sum += len + proto */
155 " brc 12,2f\n"
156 " aghi %0,1\n" /* add carry */
157 "2: srlg 0,%0,32\n"
158 " alr %0,0\n" /* fold to 32 bits */
159 " brc 12,3f\n"
160 " ahi %0,1\n" /* add carry */
161 "3: llgfr %0,%0"
162 : "+&d" (sum)
163 : "d" (saddr), "d" (daddr),
164 "d" (len + proto)
165 : "cc", "0");
166#endif /* __s390x__ */
167 return sum;
168} 139}
169 140
170/* 141/*
diff --git a/include/asm-s390/ipl.h b/include/asm-s390/ipl.h
index 660f78271a93..0eb64083480a 100644
--- a/include/asm-s390/ipl.h
+++ b/include/asm-s390/ipl.h
@@ -14,9 +14,13 @@
14#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ 14#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
15 sizeof(struct ipl_block_fcp)) 15 sizeof(struct ipl_block_fcp))
16 16
17#define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 8)
18
17#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ 19#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
18 sizeof(struct ipl_block_ccw)) 20 sizeof(struct ipl_block_ccw))
19 21
22#define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 8)
23
20#define IPL_MAX_SUPPORTED_VERSION (0) 24#define IPL_MAX_SUPPORTED_VERSION (0)
21 25
22#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ 26#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
@@ -58,6 +62,7 @@ struct ipl_block_ccw {
58 u8 vm_flags; 62 u8 vm_flags;
59 u8 reserved3[3]; 63 u8 reserved3[3];
60 u32 vm_parm_len; 64 u32 vm_parm_len;
65 u8 reserved4[80];
61} __attribute__((packed)); 66} __attribute__((packed));
62 67
63struct ipl_parameter_block { 68struct ipl_parameter_block {
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index fb6fef97d739..5c6f00d62df8 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -250,8 +250,9 @@
250/* Number 310 is reserved for new sys_move_pages */ 250/* Number 310 is reserved for new sys_move_pages */
251#define __NR_getcpu 311 251#define __NR_getcpu 311
252#define __NR_epoll_pwait 312 252#define __NR_epoll_pwait 312
253#define __NR_utimes 313
253 254
254#define NR_syscalls 313 255#define NR_syscalls 314
255 256
256/* 257/*
257 * There are some system calls that are not present on 64 bit, some 258 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index e3a180cf5062..9a3cb6ba9d15 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -21,6 +21,7 @@
21 21
22#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 22#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
23 23
24#ifndef __ASSEMBLY__
24struct cache_info { 25struct cache_info {
25 unsigned int ways; /* Number of cache ways */ 26 unsigned int ways; /* Number of cache ways */
26 unsigned int sets; /* Number of cache sets */ 27 unsigned int sets; /* Number of cache sets */
@@ -47,6 +48,6 @@ struct cache_info {
47 48
48 unsigned long flags; 49 unsigned long flags;
49}; 50};
50 51#endif /* __ASSEMBLY__ */
51#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
52#endif /* __ASM_SH_CACHE_H */ 53#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index 22f12634975b..07f62ec9ff0c 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -30,8 +30,5 @@ extern void __flush_invalidate_region(void *start, int size);
30 30
31#define HAVE_ARCH_UNMAPPED_AREA 31#define HAVE_ARCH_UNMAPPED_AREA
32 32
33/* Page flag for lazy dcache write-back for the aliasing UP caches */
34#define PG_dcache_dirty PG_arch_1
35
36#endif /* __KERNEL__ */ 33#endif /* __KERNEL__ */
37#endif /* __ASM_SH_CACHEFLUSH_H */ 34#endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
index 6fabbba228de..f70d8ef76a15 100644
--- a/include/asm-sh/cpu-sh3/cacheflush.h
+++ b/include/asm-sh/cpu-sh3/cacheflush.h
@@ -36,6 +36,8 @@
36 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */ 36 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
37#define CACHE_ALIAS 0x00001000 37#define CACHE_ALIAS 0x00001000
38 38
39#define PG_mapped PG_arch_1
40
39void flush_cache_all(void); 41void flush_cache_all(void);
40void flush_cache_mm(struct mm_struct *mm); 42void flush_cache_mm(struct mm_struct *mm);
41#define flush_cache_dup_mm(mm) flush_cache_mm(mm) 43#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
index b3746a936a09..5fd5c89ef86a 100644
--- a/include/asm-sh/cpu-sh4/cacheflush.h
+++ b/include/asm-sh/cpu-sh4/cacheflush.h
@@ -39,4 +39,6 @@ void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
39/* Initialization of P3 area for copy_user_page */ 39/* Initialization of P3 area for copy_user_page */
40void p3_cache_init(void); 40void p3_cache_init(void);
41 41
42#define PG_mapped PG_arch_1
43
42#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */ 44#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/include/asm-sh/hp6xx.h b/include/asm-sh/hp6xx.h
index f35134c159dd..53ca5643d9c7 100644
--- a/include/asm-sh/hp6xx.h
+++ b/include/asm-sh/hp6xx.h
@@ -10,9 +10,9 @@
10 * 10 *
11 */ 11 */
12 12
13#define HP680_BTN_IRQ IRQ0_IRQ 13#define HP680_BTN_IRQ 32 /* IRQ0_IRQ */
14#define HP680_TS_IRQ IRQ3_IRQ 14#define HP680_TS_IRQ 35 /* IRQ3_IRQ */
15#define HP680_HD64461_IRQ IRQ4_IRQ 15#define HP680_HD64461_IRQ 36 /* IRQ4_IRQ */
16 16
17#define DAC_LCD_BRIGHTNESS 0 17#define DAC_LCD_BRIGHTNESS 0
18#define DAC_SPEAKER_VOLUME 1 18#define DAC_SPEAKER_VOLUME 1
diff --git a/include/asm-sh/ioctls.h b/include/asm-sh/ioctls.h
index 9d84a2d445a2..35805df010a0 100644
--- a/include/asm-sh/ioctls.h
+++ b/include/asm-sh/ioctls.h
@@ -16,17 +16,17 @@
16#define TCSETSW 0x5403 16#define TCSETSW 0x5403
17#define TCSETSF 0x5404 17#define TCSETSF 0x5404
18 18
19#define TCGETA _IOR('t', 23, struct termio) 19#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
20#define TCSETA _IOW('t', 24, struct termio) 20#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
21#define TCSETAW _IOW('t', 25, struct termio) 21#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
22#define TCSETAF _IOW('t', 28, struct termio) 22#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */
23 23
24#define TCSBRK _IO('t', 29) 24#define TCSBRK _IO('t', 29)
25#define TCXONC _IO('t', 30) 25#define TCXONC _IO('t', 30)
26#define TCFLSH _IO('t', 31) 26#define TCFLSH _IO('t', 31)
27 27
28#define TIOCSWINSZ _IOW('t', 103, struct winsize) 28#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
29#define TIOCGWINSZ _IOR('t', 104, struct winsize) 29#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
30#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ 30#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
31#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ 31#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
32#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ 32#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
@@ -59,8 +59,8 @@
59#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */ 59#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */
60#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */ 60#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */
61#define TIOCCONS _IO('T', 29) /* 0x541D */ 61#define TIOCCONS _IO('T', 29) /* 0x541D */
62#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) /* 0x541E */ 62#define TIOCGSERIAL 0x803C541E /* _IOR('T', 30, struct serial_struct) 0x541E */
63#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) /* 0x541F */ 63#define TIOCSSERIAL 0x403C541F /* _IOW('T', 31, struct serial_struct) 0x541F */
64#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */ 64#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */
65# define TIOCPKT_DATA 0 65# define TIOCPKT_DATA 0
66# define TIOCPKT_FLUSHREAD 1 66# define TIOCPKT_FLUSHREAD 1
@@ -86,12 +86,12 @@
86#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */ 86#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */
87#define TIOCGLCKTRMIOS 0x5456 87#define TIOCGLCKTRMIOS 0x5456
88#define TIOCSLCKTRMIOS 0x5457 88#define TIOCSLCKTRMIOS 0x5457
89#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */ 89#define TIOCSERGSTRUCT 0x80d85458 /* _IOR('T', 88, struct async_struct) 0x5458 */ /* For debugging only */
90#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */ 90#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
91 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 91 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
92# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 92# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
93#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config */ 93#define TIOCSERGETMULTI 0x80A8545A /* _IOR('T', 90, struct serial_multiport_struct) 0x545A */ /* Get multiport config */
94#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */ 94#define TIOCSERSETMULTI 0x40A8545B /* _IOW('T', 91, struct serial_multiport_struct) 0x545B */ /* Set multiport config */
95 95
96#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */ 96#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */
97#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 97#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 8ccf7ae593ef..afe188f0ad5f 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -94,8 +94,13 @@
94/* 94/*
95 * Convert back and forth between INTEVT and IRQ values. 95 * Convert back and forth between INTEVT and IRQ values.
96 */ 96 */
97#ifdef CONFIG_CPU_HAS_INTEVT
97#define evt2irq(evt) (((evt) >> 5) - 16) 98#define evt2irq(evt) (((evt) >> 5) - 16)
98#define irq2evt(irq) (((irq) + 16) << 5) 99#define irq2evt(irq) (((irq) + 16) << 5)
100#else
101#define evt2irq(evt) (evt)
102#define irq2evt(irq) (irq)
103#endif
99 104
100/* 105/*
101 * Simple Mask Register Support 106 * Simple Mask Register Support
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 9214c015fe14..184d7fcaaf10 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -583,6 +583,11 @@ struct mm_struct;
583extern unsigned int kobjsize(const void *objp); 583extern unsigned int kobjsize(const void *objp);
584#endif /* !CONFIG_MMU */ 584#endif /* !CONFIG_MMU */
585 585
586#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
587#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
588extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
589#endif
590
586extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 591extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
587extern void paging_init(void); 592extern void paging_init(void);
588 593
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index b1e42e7f998b..4a6a19f4f8a4 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/irqflags.h> 9#include <linux/irqflags.h>
10#include <linux/compiler.h>
10#include <asm/types.h> 11#include <asm/types.h>
11 12
12/* 13/*
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 279e70a77c75..31d55e3782d5 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -111,6 +111,7 @@ static inline struct thread_info *current_thread_info(void)
111#define TIF_SIGPENDING 2 /* signal pending */ 111#define TIF_SIGPENDING 2 /* signal pending */
112#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 112#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
113#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ 113#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
114#define TIF_SINGLESTEP 5 /* singlestepping active */
114#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 115#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
115#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 116#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
116#define TIF_MEMDIE 18 117#define TIF_MEMDIE 18
@@ -121,6 +122,7 @@ static inline struct thread_info *current_thread_info(void)
121#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 122#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
122#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 123#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
123#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 124#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
125#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
124#define _TIF_USEDFPU (1<<TIF_USEDFPU) 126#define _TIF_USEDFPU (1<<TIF_USEDFPU)
125#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 127#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
126#define _TIF_FREEZE (1<<TIF_FREEZE) 128#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 17f527bfd455..49be50a36b77 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -233,6 +233,7 @@
233#define __NR_fcntl64 221 233#define __NR_fcntl64 221
234/* 223 is unused */ 234/* 223 is unused */
235#define __NR_gettid 224 235#define __NR_gettid 224
236#define __NR_readahead 225
236#define __NR_setxattr 226 237#define __NR_setxattr 226
237#define __NR_lsetxattr 227 238#define __NR_lsetxattr 227
238#define __NR_fsetxattr 228 239#define __NR_fsetxattr 228
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h
index e4e83eb0161e..9090060a23e6 100644
--- a/include/asm-sparc/a.out.h
+++ b/include/asm-sparc/a.out.h
@@ -80,7 +80,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
80 unsigned long r_address; /* relocation addr */ 80 unsigned long r_address; /* relocation addr */
81 unsigned int r_index:24; /* segment index or symbol index */ 81 unsigned int r_index:24; /* segment index or symbol index */
82 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ 82 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
83 int r_pad:2; /* <unused> */ 83 unsigned int r_pad:2; /* <unused> */
84 enum reloc_type r_type:5; /* type of relocation to perform */ 84 enum reloc_type r_type:5; /* type of relocation to perform */
85 long r_addend; /* addend for relocation value */ 85 long r_addend; /* addend for relocation value */
86}; 86};
diff --git a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h
index 6db83dc93cb7..f3a641e6b2c8 100644
--- a/include/asm-sparc/dma-mapping.h
+++ b/include/asm-sparc/dma-mapping.h
@@ -5,20 +5,7 @@
5#ifdef CONFIG_PCI 5#ifdef CONFIG_PCI
6#include <asm-generic/dma-mapping.h> 6#include <asm-generic/dma-mapping.h>
7#else 7#else
8 8#include <asm-generic/dma-mapping-broken.h>
9static inline void *dma_alloc_coherent(struct device *dev, size_t size,
10 dma_addr_t *dma_handle, gfp_t flag)
11{
12 BUG();
13 return NULL;
14}
15
16static inline void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle)
18{
19 BUG();
20}
21
22#endif /* PCI */ 9#endif /* PCI */
23 10
24#endif /* _ASM_SPARC_DMA_MAPPING_H */ 11#endif /* _ASM_SPARC_DMA_MAPPING_H */
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
index bd92a78f4937..958d0513a6d4 100644
--- a/include/asm-sparc/mostek.h
+++ b/include/asm-sparc/mostek.h
@@ -87,7 +87,7 @@ extern void __iomem *mstk48t02_regs;
87#define MSTK_DOW_MASK 0x07 87#define MSTK_DOW_MASK 0x07
88#define MSTK_DOM_MASK 0x3f 88#define MSTK_DOM_MASK 0x3f
89#define MSTK_MONTH_MASK 0x1f 89#define MSTK_MONTH_MASK 0x1f
90#define MSTK_YEAR_MASK 0xff 90#define MSTK_YEAR_MASK 0xffU
91 91
92/* Binary coded decimal conversion macros. */ 92/* Binary coded decimal conversion macros. */
93#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) 93#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index d5b2f8053b3b..e43ed1d63a9d 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -319,16 +319,17 @@
319#define __NR_set_robust_list 300 319#define __NR_set_robust_list 300
320#define __NR_get_robust_list 301 320#define __NR_get_robust_list 301
321#define __NR_migrate_pages 302 321#define __NR_migrate_pages 302
322#define __NR_mbind 303
323#define __NR_get_mempolicy 304
324#define __NR_set_mempolicy 305
325#define __NR_kexec_load 306
326#define __NR_move_pages 307
327#define __NR_getcpu 308
328#define __NR_epoll_pwait 309
322 329
323#define NR_SYSCALLS 303 330#define NR_SYSCALLS 310
324 331
325#ifdef __KERNEL__ 332#ifdef __KERNEL__
326/* WARNING: You MAY NOT add syscall numbers larger than 302, since
327 * all of the syscall tables in the Sparc kernel are
328 * sized to have 302 entries (starting at zero). Therefore
329 * find a free slot in the 0-302 range.
330 */
331
332#define __ARCH_WANT_IPC_PARSE_VERSION 333#define __ARCH_WANT_IPC_PARSE_VERSION
333#define __ARCH_WANT_OLD_READDIR 334#define __ARCH_WANT_OLD_READDIR
334#define __ARCH_WANT_STAT64 335#define __ARCH_WANT_STAT64
@@ -345,7 +346,6 @@
345#define __ARCH_WANT_SYS_GETPGRP 346#define __ARCH_WANT_SYS_GETPGRP
346#define __ARCH_WANT_SYS_LLSEEK 347#define __ARCH_WANT_SYS_LLSEEK
347#define __ARCH_WANT_SYS_NICE 348#define __ARCH_WANT_SYS_NICE
348#define __ARCH_WANT_SYS_OLD_GETRLIMIT
349#define __ARCH_WANT_SYS_OLDUMOUNT 349#define __ARCH_WANT_SYS_OLDUMOUNT
350#define __ARCH_WANT_SYS_SIGPENDING 350#define __ARCH_WANT_SYS_SIGPENDING
351#define __ARCH_WANT_SYS_SIGPROCMASK 351#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index 35cb5c9e0c92..eb3b8e90b279 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -86,7 +86,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
86 unsigned int r_address; /* relocation addr */ 86 unsigned int r_address; /* relocation addr */
87 unsigned int r_index:24; /* segment index or symbol index */ 87 unsigned int r_index:24; /* segment index or symbol index */
88 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ 88 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
89 int r_pad:2; /* <unused> */ 89 unsigned int r_pad:2; /* <unused> */
90 enum reloc_type r_type:5; /* type of relocation to perform */ 90 enum reloc_type r_type:5; /* type of relocation to perform */
91 int r_addend; /* addend for relocation value */ 91 int r_addend; /* addend for relocation value */
92}; 92};
diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
index 09b5aba6678a..d14dd8988161 100644
--- a/include/asm-sparc64/mostek.h
+++ b/include/asm-sparc64/mostek.h
@@ -89,7 +89,7 @@ extern void __iomem *mstk48t02_regs;
89#define MSTK_DOW_MASK 0x07 89#define MSTK_DOW_MASK 0x07
90#define MSTK_DOM_MASK 0x3f 90#define MSTK_DOM_MASK 0x3f
91#define MSTK_MONTH_MASK 0x1f 91#define MSTK_MONTH_MASK 0x1f
92#define MSTK_YEAR_MASK 0xff 92#define MSTK_YEAR_MASK 0xffU
93 93
94/* Binary coded decimal conversion macros. */ 94/* Binary coded decimal conversion macros. */
95#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) 95#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index be9509c8f8c1..284dfd01a33d 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -19,6 +19,17 @@
19 */ 19 */
20#define HAS_DMA 20#define HAS_DMA
21 21
22static DEFINE_SPINLOCK(dma_spin_lock);
23
24#define claim_dma_lock() \
25({ unsigned long flags; \
26 spin_lock_irqsave(&dma_spin_lock, flags); \
27 flags; \
28})
29
30#define release_dma_lock(__flags) \
31 spin_unlock_irqrestore(&dma_spin_lock, __flags);
32
22static struct sparc_ebus_info { 33static struct sparc_ebus_info {
23 struct ebus_dma_info info; 34 struct ebus_dma_info info;
24 unsigned int addr; 35 unsigned int addr;
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h
index e82612cd9f33..ab55ffcb7bf4 100644
--- a/include/asm-sparc64/tsb.h
+++ b/include/asm-sparc64/tsb.h
@@ -264,6 +264,7 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
264 be,a,pt %xcc, OK_LABEL; \ 264 be,a,pt %xcc, OK_LABEL; \
265 mov REG4, REG1; 265 mov REG4, REG1;
266 266
267#ifndef CONFIG_DEBUG_PAGEALLOC
267 /* This version uses a trick, the TAG is already (VADDR >> 22) so 268 /* This version uses a trick, the TAG is already (VADDR >> 22) so
268 * we can make use of that for the index computation. 269 * we can make use of that for the index computation.
269 */ 270 */
@@ -277,5 +278,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
277 cmp REG3, TAG; \ 278 cmp REG3, TAG; \
278 be,a,pt %xcc, OK_LABEL; \ 279 be,a,pt %xcc, OK_LABEL; \
279 mov REG4, REG1; 280 mov REG4, REG1;
281#endif
280 282
281#endif /* !(_SPARC64_TSB_H) */ 283#endif /* !(_SPARC64_TSB_H) */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 47047536f261..e2dcb87e0c62 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -321,17 +321,17 @@
321#define __NR_set_robust_list 300 321#define __NR_set_robust_list 300
322#define __NR_get_robust_list 301 322#define __NR_get_robust_list 301
323#define __NR_migrate_pages 302 323#define __NR_migrate_pages 302
324#define __NR_mbind 303
325#define __NR_get_mempolicy 304
326#define __NR_set_mempolicy 305
327#define __NR_kexec_load 306
328#define __NR_move_pages 307
329#define __NR_getcpu 308
330#define __NR_epoll_pwait 309
324 331
325#define NR_SYSCALLS 303 332#define NR_SYSCALLS 310
326 333
327#ifdef __KERNEL__ 334#ifdef __KERNEL__
328
329/* WARNING: You MAY NOT add syscall numbers larger than 302, since
330 * all of the syscall tables in the Sparc kernel are
331 * sized to have 302 entries (starting at zero). Therefore
332 * find a free slot in the 0-302 range.
333 */
334
335/* sysconf options, for SunOS compatibility */ 335/* sysconf options, for SunOS compatibility */
336#define _SC_ARG_MAX 1 336#define _SC_ARG_MAX 1
337#define _SC_CHILD_MAX 2 337#define _SC_CHILD_MAX 2
@@ -359,7 +359,6 @@
359#define __ARCH_WANT_SYS_GETPGRP 359#define __ARCH_WANT_SYS_GETPGRP
360#define __ARCH_WANT_SYS_LLSEEK 360#define __ARCH_WANT_SYS_LLSEEK
361#define __ARCH_WANT_SYS_NICE 361#define __ARCH_WANT_SYS_NICE
362#define __ARCH_WANT_SYS_OLD_GETRLIMIT
363#define __ARCH_WANT_SYS_OLDUMOUNT 362#define __ARCH_WANT_SYS_OLDUMOUNT
364#define __ARCH_WANT_SYS_SIGPENDING 363#define __ARCH_WANT_SYS_SIGPENDING
365#define __ARCH_WANT_SYS_SIGPROCMASK 364#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S
index f0454516dd31..f5de80c31e88 100644
--- a/include/asm-um/common.lds.S
+++ b/include/asm-um/common.lds.S
@@ -15,6 +15,7 @@
15 PROVIDE (_unprotected_end = .); 15 PROVIDE (_unprotected_end = .);
16 16
17 . = ALIGN(4096); 17 . = ALIGN(4096);
18 .note : { *(.note.*) }
18 __start___ex_table = .; 19 __start___ex_table = .;
19 __ex_table : { *(__ex_table) } 20 __ex_table : { *(__ex_table) }
20 __stop___ex_table = .; 21 __stop___ex_table = .;
diff --git a/include/asm-um/delay.h b/include/asm-um/delay.h
index 0985bda66750..c71e32b6741e 100644
--- a/include/asm-um/delay.h
+++ b/include/asm-um/delay.h
@@ -1,9 +1,20 @@
1#ifndef __UM_DELAY_H 1#ifndef __UM_DELAY_H
2#define __UM_DELAY_H 2#define __UM_DELAY_H
3 3
4#include "asm/arch/delay.h"
5#include "asm/archparam.h"
6
7#define MILLION 1000000 4#define MILLION 1000000
8 5
6/* Undefined on purpose */
7extern void __bad_udelay(void);
8
9extern void __udelay(unsigned long usecs);
10extern void __delay(unsigned long loops);
11
12#define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
13 __bad_udelay() : __udelay(n))
14
15/* It appears that ndelay is not used at all for UML, and has never been
16 * implemented. */
17extern void __unimplemented_ndelay(void);
18#define ndelay(n) __unimplemented_ndelay()
19
9#endif 20#endif
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
index 6050e0eb257e..172a75fde512 100644
--- a/include/asm-um/pgtable-2level.h
+++ b/include/asm-um/pgtable-2level.h
@@ -45,12 +45,12 @@ static inline void pgd_mkuptodate(pgd_t pgd) { }
45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
46 46
47/* 47/*
48 * Bits 0 through 3 are taken 48 * Bits 0 through 4 are taken
49 */ 49 */
50#define PTE_FILE_MAX_BITS 28 50#define PTE_FILE_MAX_BITS 27
51 51
52#define pte_to_pgoff(pte) (pte_val(pte) >> 4) 52#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
53 53
54#define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE }) 54#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
55 55
56#endif 56#endif
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index e81d0f289f0b..7cfb39cbd918 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -102,5 +102,6 @@ void switch_ipi_to_APIC_timer(void *cpumask);
102#define ARCH_APICTIMER_STOPS_ON_C3 1 102#define ARCH_APICTIMER_STOPS_ON_C3 1
103 103
104extern unsigned boot_cpu_id; 104extern unsigned boot_cpu_id;
105extern int local_apic_timer_c2_ok;
105 106
106#endif /* __ASM_APIC_H */ 107#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 2e4b7a5ed1c4..6153ae5df2e8 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -38,7 +38,7 @@
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR 38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39 39
40/* 40/*
41 * Vectors 0x20-0x2f are used for ISA interrupts. 41 * Vectors 0x30-0x3f are used for ISA interrupts.
42 */ 42 */
43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10 43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10
44#define IRQ1_VECTOR IRQ0_VECTOR + 1 44#define IRQ1_VECTOR IRQ0_VECTOR + 1
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
index ceb3d8dac33d..72375e7d32a8 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -64,7 +64,7 @@ extern int setup_nmi_watchdog(char *);
64 64
65extern atomic_t nmi_active; 65extern atomic_t nmi_active;
66extern unsigned int nmi_watchdog; 66extern unsigned int nmi_watchdog;
67#define NMI_DEFAULT 0 67#define NMI_DEFAULT -1
68#define NMI_NONE 0 68#define NMI_NONE 0
69#define NMI_IO_APIC 1 69#define NMI_IO_APIC 1
70#define NMI_LOCAL_APIC 2 70#define NMI_LOCAL_APIC 2
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index f54f3abf93ce..b6e65a699f2a 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -99,7 +99,7 @@ extern int force_iommu, no_iommu;
99extern int iommu_detected; 99extern int iommu_detected;
100#ifdef CONFIG_IOMMU 100#ifdef CONFIG_IOMMU
101extern void gart_iommu_init(void); 101extern void gart_iommu_init(void);
102extern void gart_parse_options(char *); 102extern void __init gart_parse_options(char *);
103extern void iommu_hole_init(void); 103extern void iommu_hole_init(void);
104extern int fallback_aper_order; 104extern int fallback_aper_order;
105extern int fallback_aper_force; 105extern int fallback_aper_force;
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index e17b9ec42e98..de592a408c07 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -7,6 +7,7 @@
7#include <linux/threads.h> 7#include <linux/threads.h>
8#include <linux/cpumask.h> 8#include <linux/cpumask.h>
9#include <linux/bitops.h> 9#include <linux/bitops.h>
10#include <linux/init.h>
10extern int disable_apic; 11extern int disable_apic;
11 12
12#include <asm/fixmap.h> 13#include <asm/fixmap.h>
@@ -68,7 +69,7 @@ extern int __cpu_disable(void);
68extern void __cpu_die(unsigned int cpu); 69extern void __cpu_die(unsigned int cpu);
69extern void prefill_possible_map(void); 70extern void prefill_possible_map(void);
70extern unsigned num_processors; 71extern unsigned num_processors;
71extern unsigned disabled_cpus; 72extern unsigned __cpuinitdata disabled_cpus;
72 73
73#define NO_PROC_ID 0xFF /* No processor magic marker */ 74#define NO_PROC_ID 0xFF /* No processor magic marker */
74 75
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 1981f70fcad1..9df30b939c4e 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -373,12 +373,12 @@ extern long __copy_user_nocache(void *dst, const void __user *src, unsigned size
373static inline int __copy_from_user_nocache(void *dst, const void __user *src, unsigned size) 373static inline int __copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
374{ 374{
375 might_sleep(); 375 might_sleep();
376 return __copy_user_nocache(dst, (__force void *)src, size, 1); 376 return __copy_user_nocache(dst, src, size, 1);
377} 377}
378 378
379static inline int __copy_from_user_inatomic_nocache(void *dst, const void __user *src, unsigned size) 379static inline int __copy_from_user_inatomic_nocache(void *dst, const void __user *src, unsigned size)
380{ 380{
381 return __copy_user_nocache(dst, (__force void *)src, size, 0); 381 return __copy_user_nocache(dst, src, size, 0);
382} 382}
383 383
384#endif /* __X86_64_UACCESS_H */ 384#endif /* __X86_64_UACCESS_H */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index c331da2da5f7..6caeb98e29dd 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -40,6 +40,7 @@ enum {
40 ATA_MAX_DEVICES = 2, /* per bus/port */ 40 ATA_MAX_DEVICES = 2, /* per bus/port */
41 ATA_MAX_PRD = 256, /* we could make these 256/256 */ 41 ATA_MAX_PRD = 256, /* we could make these 256/256 */
42 ATA_SECT_SIZE = 512, 42 ATA_SECT_SIZE = 512,
43 ATA_MAX_SECTORS_128 = 128,
43 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
45 46
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 7011d6255593..f2542c24b328 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -93,6 +93,7 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw); 93void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw); 94void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout); 95long congestion_wait(int rw, long timeout);
96long congestion_wait_interruptible(int rw, long timeout);
96void congestion_end(int rw); 97void congestion_end(int rw);
97 98
98#define bdi_cap_writeback_dirty(bdi) \ 99#define bdi_cap_writeback_dirty(bdi) \
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 2275f2748708..81c07cd18643 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -108,7 +108,7 @@ static inline void *alloc_remap(int nid, unsigned long size)
108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ 108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
109 109
110extern unsigned long __meminitdata nr_kernel_pages; 110extern unsigned long __meminitdata nr_kernel_pages;
111extern unsigned long nr_all_pages; 111extern unsigned long __meminitdata nr_all_pages;
112 112
113extern void *alloc_large_system_hash(const char *tablename, 113extern void *alloc_large_system_hash(const char *tablename,
114 unsigned long bucketsize, 114 unsigned long bucketsize,
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 80b17f440ec1..ccd863dd77fa 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -234,5 +234,24 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
235 const compat_ulong_t __user *new_nodes); 235 const compat_ulong_t __user *new_nodes);
236 236
237/*
238 * epoll (fs/eventpoll.c) compat bits follow ...
239 */
240#ifndef CONFIG_HAS_COMPAT_EPOLL_EVENT
241struct epoll_event;
242#define compat_epoll_event epoll_event
243#else
244asmlinkage long compat_sys_epoll_ctl(int epfd, int op, int fd,
245 struct compat_epoll_event __user *event);
246asmlinkage long compat_sys_epoll_wait(int epfd,
247 struct compat_epoll_event __user *events,
248 int maxevents, int timeout);
249#endif
250asmlinkage long compat_sys_epoll_pwait(int epfd,
251 struct compat_epoll_event __user *events,
252 int maxevents, int timeout,
253 const compat_sigset_t __user *sigmask,
254 compat_size_t sigsetsize);
255
237#endif /* CONFIG_COMPAT */ 256#endif /* CONFIG_COMPAT */
238#endif /* _LINUX_COMPAT_H */ 257#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index aca66984aafd..3b6949b41745 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -15,8 +15,8 @@
15# define __acquire(x) __context__(x,1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18extern void __chk_user_ptr(void __user *); 18extern void __chk_user_ptr(const void __user *);
19extern void __chk_io_ptr(void __iomem *); 19extern void __chk_io_ptr(const void __iomem *);
20#else 20#else
21# define __user 21# define __user
22# define __kernel 22# define __kernel
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 769ddc6df492..c22b0dfcbcd2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -127,9 +127,13 @@ static inline int cpu_is_offline(int cpu) { return 0; }
127#endif /* CONFIG_HOTPLUG_CPU */ 127#endif /* CONFIG_HOTPLUG_CPU */
128 128
129#ifdef CONFIG_SUSPEND_SMP 129#ifdef CONFIG_SUSPEND_SMP
130extern int suspend_cpu_hotplug;
131
130extern int disable_nonboot_cpus(void); 132extern int disable_nonboot_cpus(void);
131extern void enable_nonboot_cpus(void); 133extern void enable_nonboot_cpus(void);
132#else 134#else
135#define suspend_cpu_hotplug 0
136
133static inline int disable_nonboot_cpus(void) { return 0; } 137static inline int disable_nonboot_cpus(void) { return 0; }
134static inline void enable_nonboot_cpus(void) {} 138static inline void enable_nonboot_cpus(void) {}
135#endif 139#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index 39a3199a826d..5cf30e95c8b6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -128,6 +128,7 @@ struct device_driver {
128 128
129 struct module * owner; 129 struct module * owner;
130 const char * mod_name; /* used for built-in modules */ 130 const char * mod_name; /* used for built-in modules */
131 struct module_kobject * mkobj;
131 132
132 int (*probe) (struct device * dev); 133 int (*probe) (struct device * dev);
133 int (*remove) (struct device * dev); 134 int (*remove) (struct device * dev);
@@ -353,6 +354,8 @@ extern int __must_check device_create_bin_file(struct device *dev,
353 struct bin_attribute *attr); 354 struct bin_attribute *attr);
354extern void device_remove_bin_file(struct device *dev, 355extern void device_remove_bin_file(struct device *dev,
355 struct bin_attribute *attr); 356 struct bin_attribute *attr);
357extern int device_schedule_callback(struct device *dev,
358 void (*func)(struct device *));
356 359
357/* device resource management */ 360/* device resource management */
358typedef void (*dr_release_t)(struct device *dev, void *res); 361typedef void (*dr_release_t)(struct device *dev, void *res);
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 84cfa8bbdc36..d2a96cbf4f0e 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -31,12 +31,19 @@
31/* 31/*
32 * On x86-64 make the 64bit structure have the same alignment as the 32 * On x86-64 make the 64bit structure have the same alignment as the
33 * 32bit structure. This makes 32bit emulation easier. 33 * 32bit structure. This makes 32bit emulation easier.
34 *
35 * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 +
36 * 64_BIT adds up to UML/x86_64.
34 */ 37 */
35#ifdef __x86_64__ 38#ifdef __x86_64__
36#define EPOLL_PACKED __attribute__((packed)) 39#define EPOLL_PACKED __attribute__((packed))
37#else 40#else
41#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
42#define EPOLL_PACKED __attribute__((packed))
43#else
38#define EPOLL_PACKED 44#define EPOLL_PACKED
39#endif 45#endif
46#endif
40 47
41struct epoll_event { 48struct epoll_event {
42 __u32 events; 49 __u32 events;
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 5bdbc744e773..17c29dca8354 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -206,6 +206,7 @@ struct hrtimer_cpu_base {
206struct clock_event_device; 206struct clock_event_device;
207 207
208extern void clock_was_set(void); 208extern void clock_was_set(void);
209extern void hres_timers_resume(void);
209extern void hrtimer_interrupt(struct clock_event_device *dev); 210extern void hrtimer_interrupt(struct clock_event_device *dev);
210 211
211/* 212/*
@@ -236,6 +237,8 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
236 */ 237 */
237static inline void clock_was_set(void) { } 238static inline void clock_was_set(void) { }
238 239
240static inline void hres_timers_resume(void) { }
241
239/* 242/*
240 * In non high resolution mode the time reference is taken from 243 * In non high resolution mode the time reference is taken from
241 * the base softirq time variable. 244 * the base softirq time variable.
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 34f2676b3c62..d3bbc7188b6a 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -615,6 +615,7 @@ typedef struct ide_drive_s {
615 u8 init_speed; /* transfer rate set at boot */ 615 u8 init_speed; /* transfer rate set at boot */
616 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */ 616 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */
617 u8 current_speed; /* current transfer rate set */ 617 u8 current_speed; /* current transfer rate set */
618 u8 desired_speed; /* desired transfer rate set */
618 u8 dn; /* now wide spread use */ 619 u8 dn; /* now wide spread use */
619 u8 wcache; /* status of write cache */ 620 u8 wcache; /* status of write cache */
620 u8 acoustic; /* acoustic management */ 621 u8 acoustic; /* acoustic management */
@@ -860,6 +861,8 @@ typedef struct hwgroup_s {
860 int (*expiry)(ide_drive_t *); 861 int (*expiry)(ide_drive_t *);
861 /* ide_system_bus_speed */ 862 /* ide_system_bus_speed */
862 int pio_clock; 863 int pio_clock;
864 int req_gen;
865 int req_gen_timer;
863 866
864 unsigned char cmd_buf[4]; 867 unsigned char cmd_buf[4];
865} ide_hwgroup_t; 868} ide_hwgroup_t;
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 636094c29b16..6da6772c19ff 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -92,19 +92,16 @@ extern struct ipc_namespace init_ipc_ns;
92 92
93#ifdef CONFIG_SYSVIPC 93#ifdef CONFIG_SYSVIPC
94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
95extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
95#else 96#else
96#define INIT_IPC_NS(ns) 97#define INIT_IPC_NS(ns)
98static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
99{ return 0; }
97#endif 100#endif
98 101
99#ifdef CONFIG_IPC_NS 102#ifdef CONFIG_IPC_NS
100extern void free_ipc_ns(struct kref *kref); 103extern void free_ipc_ns(struct kref *kref);
101extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
102extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns); 104extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
103#else
104static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
105{
106 return 0;
107}
108#endif 105#endif
109 106
110static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 107static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 06c58c423fe1..506ad20c18f8 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -75,7 +75,7 @@ extern int do_poke_blanked_console;
75 75
76extern void (*kbd_ledfunc)(unsigned int led); 76extern void (*kbd_ledfunc)(unsigned int led);
77 77
78extern void set_console(int nr); 78extern int set_console(int nr);
79extern void schedule_console_callback(void); 79extern void schedule_console_callback(void);
80 80
81static inline void set_leds(void) 81static inline void set_leds(void)
diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index 4c2c3737e415..2dacab8beccb 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
@@ -87,8 +87,6 @@ static inline unsigned sysv_minor(u32 dev)
87 return dev & 0x3ffff; 87 return dev & 0x3ffff;
88} 88}
89 89
90bool is_lanana_major(unsigned int major);
91
92#else /* __KERNEL__ */ 90#else /* __KERNEL__ */
93 91
94/* 92/*
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index c68c7ac6b232..248305bb9a18 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -57,7 +57,11 @@ typedef union {
57} ktime_t; 57} ktime_t;
58 58
59#define KTIME_MAX ((s64)~((u64)1 << 63)) 59#define KTIME_MAX ((s64)~((u64)1 << 63))
60#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) 60#if (BITS_PER_LONG == 64)
61# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
62#else
63# define KTIME_SEC_MAX LONG_MAX
64#endif
61 65
62/* 66/*
63 * ktime_t definitions when using the 64-bit scalar representation: 67 * ktime_t definitions when using the 64-bit scalar representation:
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e3f32f3189b2..0cfbcb6f08eb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -311,15 +311,17 @@ enum {
311 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 311 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
312 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 312 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
313 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 313 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
314 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
315 ATA_HORKAGE_DMA_RW_ONLY = (1 << 4), /* ATAPI DMA for RW only */
314}; 316};
315 317
316enum hsm_task_states { 318enum hsm_task_states {
317 HSM_ST_IDLE, /* no command on going */ 319 HSM_ST_IDLE, /* no command on going */
320 HSM_ST_FIRST, /* (waiting the device to)
321 write CDB or first data block */
318 HSM_ST, /* (waiting the device to) transfer data */ 322 HSM_ST, /* (waiting the device to) transfer data */
319 HSM_ST_LAST, /* (waiting the device to) complete command */ 323 HSM_ST_LAST, /* (waiting the device to) complete command */
320 HSM_ST_ERR, /* error */ 324 HSM_ST_ERR, /* error */
321 HSM_ST_FIRST, /* (waiting the device to)
322 write CDB or first data block */
323}; 325};
324 326
325enum ata_completion_errors { 327enum ata_completion_errors {
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 06fe93a3e916..14c937d345cb 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -245,7 +245,7 @@ extern void lock_release(struct lockdep_map *lock, int nested,
245 245
246# define INIT_LOCKDEP .lockdep_recursion = 0, 246# define INIT_LOCKDEP .lockdep_recursion = 0,
247 247
248#define lockdep_depth(tsk) ((tsk)->lockdep_depth) 248#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
249 249
250#else /* !LOCKDEP */ 250#else /* !LOCKDEP */
251 251
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 74c8a2ecc9dd..e38fe6822cb4 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -17,7 +17,7 @@ struct msi_desc {
17 struct { 17 struct {
18 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ 18 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */
19 __u8 maskbit : 1; /* mask-pending bit supported ? */ 19 __u8 maskbit : 1; /* mask-pending bit supported ? */
20 __u8 unused : 1; 20 __u8 masked : 1;
21 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 21 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
22 __u8 pos; /* Location of the msi capability */ 22 __u8 pos; /* Location of the msi capability */
23 __u16 entry_nr; /* specific enabled entry */ 23 __u16 entry_nr; /* specific enabled entry */
@@ -32,10 +32,8 @@ struct msi_desc {
32 void __iomem *mask_base; 32 void __iomem *mask_base;
33 struct pci_dev *dev; 33 struct pci_dev *dev;
34 34
35#ifdef CONFIG_PM 35 /* Last set MSI message */
36 /* PM save area for MSIX address/data */ 36 struct msi_msg msg;
37 struct msi_msg msg_save;
38#endif
39}; 37};
40 38
41/* 39/*
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 6a8570be331b..3d956c3abb31 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -121,6 +121,7 @@ struct mtd_info {
121 u_int32_t writesize; 121 u_int32_t writesize;
122 122
123 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 123 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
124 u_int32_t oobavail; // Available OOB bytes per block
124 125
125 // Kernel-only stuff starts here. 126 // Kernel-only stuff starts here.
126 char *name; 127 char *name;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index d8af8a95e58d..a56d24ada505 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -82,7 +82,8 @@ struct onenand_bufferram {
82 * @wq: [INTERN] wait queue to sleep on if a OneNAND 82 * @wq: [INTERN] wait queue to sleep on if a OneNAND
83 * operation is in progress 83 * operation is in progress
84 * @state: [INTERN] the current state of the OneNAND device 84 * @state: [INTERN] the current state of the OneNAND device
85 * @page_buf: data buffer 85 * @page_buf: [INTERN] page main data buffer
86 * @oob_buf: [INTERN] page oob data buffer
86 * @subpagesize: [INTERN] holds the subpagesize 87 * @subpagesize: [INTERN] holds the subpagesize
87 * @ecclayout: [REPLACEABLE] the default ecc placement scheme 88 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
88 * @bbm: [REPLACEABLE] pointer to Bad Block Management 89 * @bbm: [REPLACEABLE] pointer to Bad Block Management
@@ -122,6 +123,7 @@ struct onenand_chip {
122 wait_queue_head_t wq; 123 wait_queue_head_t wq;
123 onenand_state_t state; 124 onenand_state_t state;
124 unsigned char *page_buf; 125 unsigned char *page_buf;
126 unsigned char *oob_buf;
125 127
126 int subpagesize; 128 int subpagesize;
127 struct nand_ecclayout *ecclayout; 129 struct nand_ecclayout *ecclayout;
@@ -156,6 +158,7 @@ struct onenand_chip {
156#define ONENAND_HAS_CONT_LOCK (0x0001) 158#define ONENAND_HAS_CONT_LOCK (0x0001)
157#define ONENAND_HAS_UNLOCK_ALL (0x0002) 159#define ONENAND_HAS_UNLOCK_ALL (0x0002)
158#define ONENAND_PAGEBUF_ALLOC (0x1000) 160#define ONENAND_PAGEBUF_ALLOC (0x1000)
161#define ONENAND_OOBBUF_ALLOC (0x2000)
159 162
160/* 163/*
161 * OneNAND Flash Manufacturer ID Codes 164 * OneNAND Flash Manufacturer ID Codes
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 47aaa2c66738..e9ae0c6e2c62 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -415,6 +415,7 @@ extern void nfs_complete_unlink(struct dentry *);
415/* 415/*
416 * linux/fs/nfs/write.c 416 * linux/fs/nfs/write.c
417 */ 417 */
418extern int nfs_congestion_kb;
418extern int nfs_writepage(struct page *page, struct writeback_control *wbc); 419extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
419extern int nfs_writepages(struct address_space *, struct writeback_control *); 420extern int nfs_writepages(struct address_space *, struct writeback_control *);
420extern int nfs_flush_incompatible(struct file *file, struct page *page); 421extern int nfs_flush_incompatible(struct file *file, struct page *page);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 95796e6924f1..c95d5e642548 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -82,6 +82,7 @@ struct nfs_server {
82 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 82 struct rpc_clnt * client_acl; /* ACL RPC client handle */
83 struct nfs_iostats * io_stats; /* I/O statistics */ 83 struct nfs_iostats * io_stats; /* I/O statistics */
84 struct backing_dev_info backing_dev_info; 84 struct backing_dev_info backing_dev_info;
85 atomic_t writeback; /* number of writeback pages */
85 int flags; /* various flags */ 86 int flags; /* various flags */
86 unsigned int caps; /* server capabilities */ 87 unsigned int caps; /* server capabilities */
87 unsigned int rsize; /* read size */ 88 unsigned int rsize; /* read size */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 78417e421b4c..481ea0663f19 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -209,11 +209,6 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
209 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 209 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
210} 210}
211 211
212static inline void pci_remove_saved_cap(struct pci_cap_saved_state *cap)
213{
214 hlist_del(&cap->next);
215}
216
217/* 212/*
218 * For PCI devices, the region numbers are assigned this way: 213 * For PCI devices, the region numbers are assigned this way:
219 * 214 *
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index f09cce2357ff..495d368390e0 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -296,6 +296,7 @@
296#define PCI_MSIX_FLAGS 2 296#define PCI_MSIX_FLAGS 2
297#define PCI_MSIX_FLAGS_QSIZE 0x7FF 297#define PCI_MSIX_FLAGS_QSIZE 0x7FF
298#define PCI_MSIX_FLAGS_ENABLE (1 << 15) 298#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
299#define PCI_MSIX_FLAGS_MASKALL (1 << 14)
299#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 300#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
300#define PCI_MSIX_FLAGS_BITMASK (1 << 0) 301#define PCI_MSIX_FLAGS_BITMASK (1 << 0)
301 302
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 2e19478e9e84..8bcbc54e1b48 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -99,4 +99,8 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
99 loff_t *, size_t, unsigned int, 99 loff_t *, size_t, unsigned int,
100 splice_actor *); 100 splice_actor *);
101 101
102extern ssize_t __splice_from_pipe(struct pipe_inode_info *, struct file *,
103 loff_t *, size_t, unsigned int,
104 splice_actor *);
105
102#endif 106#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8245c282168b..de72c49747c8 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -104,6 +104,7 @@ struct mdk_rdev_s
104 * for reporting to userspace and storing 104 * for reporting to userspace and storing
105 * in superblock. 105 * in superblock.
106 */ 106 */
107 struct work_struct del_work; /* used for delayed sysfs removal */
107}; 108};
108 109
109struct mddev_s 110struct mddev_s
diff --git a/include/linux/security.h b/include/linux/security.h
index 7f88d97575fd..47e82c120f9a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1324,7 +1324,7 @@ struct security_operations {
1324 1324
1325 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1325 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1326 1326
1327 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1327 int (*getprocattr)(struct task_struct *p, char *name, char **value);
1328 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1328 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1329 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); 1329 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1330 void (*release_secctx)(char *secdata, u32 seclen); 1330 void (*release_secctx)(char *secdata, u32 seclen);
@@ -2092,9 +2092,9 @@ static inline void security_d_instantiate (struct dentry *dentry, struct inode *
2092 security_ops->d_instantiate (dentry, inode); 2092 security_ops->d_instantiate (dentry, inode);
2093} 2093}
2094 2094
2095static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size) 2095static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
2096{ 2096{
2097 return security_ops->getprocattr(p, name, value, size); 2097 return security_ops->getprocattr(p, name, value);
2098} 2098}
2099 2099
2100static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size) 2100static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
@@ -2749,7 +2749,7 @@ static inline int security_sem_semop (struct sem_array * sma,
2749static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) 2749static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
2750{ } 2750{ }
2751 2751
2752static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size) 2752static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
2753{ 2753{
2754 return -EINVAL; 2754 return -EINVAL;
2755} 2755}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4ff3940210d8..82f43ad478c7 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -188,7 +188,7 @@ enum {
188 * @sk: Socket we are owned by 188 * @sk: Socket we are owned by
189 * @tstamp: Time we arrived 189 * @tstamp: Time we arrived
190 * @dev: Device we arrived on/are leaving by 190 * @dev: Device we arrived on/are leaving by
191 * @input_dev: Device we arrived on 191 * @iif: ifindex of device we arrived on
192 * @h: Transport layer header 192 * @h: Transport layer header
193 * @nh: Network layer header 193 * @nh: Network layer header
194 * @mac: Link layer header 194 * @mac: Link layer header
@@ -235,7 +235,8 @@ struct sk_buff {
235 struct sock *sk; 235 struct sock *sk;
236 struct skb_timeval tstamp; 236 struct skb_timeval tstamp;
237 struct net_device *dev; 237 struct net_device *dev;
238 struct net_device *input_dev; 238 int iif;
239 /* 4 byte hole on 64 bit*/
239 240
240 union { 241 union {
241 struct tcphdr *th; 242 struct tcphdr *th;
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 2e8c048b9b80..9dbca629dcfb 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -25,7 +25,6 @@ struct spi_bitbang {
25 spinlock_t lock; 25 spinlock_t lock;
26 struct list_head queue; 26 struct list_head queue;
27 u8 busy; 27 u8 busy;
28 u8 shutdown;
29 u8 use_dma; 28 u8 use_dma;
30 29
31 struct spi_master *master; 30 struct spi_master *master;
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 523405e1e1f6..fea9a6b3fb7b 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -11,6 +11,7 @@
11#define _SYSFS_H_ 11#define _SYSFS_H_
12 12
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14#include <linux/errno.h>
14#include <linux/list.h> 15#include <linux/list.h>
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16 17
@@ -78,6 +79,9 @@ struct sysfs_ops {
78 79
79#ifdef CONFIG_SYSFS 80#ifdef CONFIG_SYSFS
80 81
82extern int sysfs_schedule_callback(struct kobject *kobj,
83 void (*func)(void *), void *data);
84
81extern int __must_check 85extern int __must_check
82sysfs_create_dir(struct kobject *, struct dentry *); 86sysfs_create_dir(struct kobject *, struct dentry *);
83 87
@@ -132,6 +136,12 @@ extern int __must_check sysfs_init(void);
132 136
133#else /* CONFIG_SYSFS */ 137#else /* CONFIG_SYSFS */
134 138
139static inline int sysfs_schedule_callback(struct kobject *kobj,
140 void (*func)(void *), void *data)
141{
142 return -ENOSYS;
143}
144
135static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow) 145static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow)
136{ 146{
137 return 0; 147 return 0;
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index dc2e9fe69418..daeba22b7656 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -649,10 +649,10 @@ struct ufs2_inode {
649 __fs32 ui_blksize; /* 12: Inode blocksize. */ 649 __fs32 ui_blksize; /* 12: Inode blocksize. */
650 __fs64 ui_size; /* 16: File byte count. */ 650 __fs64 ui_size; /* 16: File byte count. */
651 __fs64 ui_blocks; /* 24: Bytes actually held. */ 651 __fs64 ui_blocks; /* 24: Bytes actually held. */
652 struct ufs_timeval ui_atime; /* 32: Last access time. */ 652 __fs64 ui_atime; /* 32: Last access time. */
653 struct ufs_timeval ui_mtime; /* 40: Last modified time. */ 653 __fs64 ui_mtime; /* 40: Last modified time. */
654 struct ufs_timeval ui_ctime; /* 48: Last inode change time. */ 654 __fs64 ui_ctime; /* 48: Last inode change time. */
655 struct ufs_timeval ui_birthtime; /* 56: Inode creation time. */ 655 __fs64 ui_birthtime; /* 56: Inode creation time. */
656 __fs32 ui_mtimensec; /* 64: Last modified time. */ 656 __fs32 ui_mtimensec; /* 64: Last modified time. */
657 __fs32 ui_atimensec; /* 68: Last access time. */ 657 __fs32 ui_atimensec; /* 68: Last access time. */
658 __fs32 ui_ctimensec; /* 72: Last inode change time. */ 658 __fs32 ui_ctimensec; /* 72: Last inode change time. */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index a4555fe3754c..e10267d402c5 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsigned long unshare_flags,
70 70
71static inline int copy_utsname(int flags, struct task_struct *tsk) 71static inline int copy_utsname(int flags, struct task_struct *tsk)
72{ 72{
73 if (flags & CLONE_NEWUTS)
74 return -EINVAL;
73 return 0; 75 return 0;
74} 76}
75static inline void put_uts_ns(struct uts_namespace *ns) 77static inline void put_uts_ns(struct uts_namespace *ns)
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 37a1a41f5b65..e0db669998f3 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -83,6 +83,7 @@ void reset_vc(struct vc_data *vc);
83#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) 83#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
84extern char con_buf[CON_BUF_SIZE]; 84extern char con_buf[CON_BUF_SIZE];
85extern struct semaphore con_buf_sem; 85extern struct semaphore con_buf_sem;
86extern char vt_dont_switch;
86 87
87struct vt_spawn_console { 88struct vt_spawn_console {
88 spinlock_t lock; 89 spinlock_t lock;
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 447c52beb691..48759b2f57d7 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 21 14.3.06 4 * Version : 22 16.3.07
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _LINUX_WIRELESS_H 10#ifndef _LINUX_WIRELESS_H
@@ -85,7 +85,7 @@
85 * (there is some stuff that will be added in the future...) 85 * (there is some stuff that will be added in the future...)
86 * I just plan to increment with each new version. 86 * I just plan to increment with each new version.
87 */ 87 */
88#define WIRELESS_EXT 21 88#define WIRELESS_EXT 22
89 89
90/* 90/*
91 * Changes : 91 * Changes :
@@ -221,6 +221,10 @@
221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers 221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
222 * - Power/Retry relative values no longer * 100000 222 * - Power/Retry relative values no longer * 100000
223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI 223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
224 *
225 * V21 to V22
226 * ----------
227 * - Prevent leaking of kernel space in stream on 64 bits.
224 */ 228 */
225 229
226/**************************** CONSTANTS ****************************/ 230/**************************** CONSTANTS ****************************/
@@ -1085,4 +1089,15 @@ struct iw_event
1085#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ 1089#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1086 IW_EV_POINT_OFF) 1090 IW_EV_POINT_OFF)
1087 1091
1092/* Size of the Event prefix when packed in stream */
1093#define IW_EV_LCP_PK_LEN (4)
1094/* Size of the various events when packed in stream */
1095#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
1096#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32))
1097#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
1098#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
1099#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
1100#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
1101#define IW_EV_POINT_PK_LEN (IW_EV_LCP_LEN + 4)
1102
1088#endif /* _LINUX_WIRELESS_H */ 1103#endif /* _LINUX_WIRELESS_H */
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 83fe2e3d1e25..50e33b0e9349 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -239,7 +239,8 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits);
239#define SAA7146_HPS_SYNC_PORT_B 0x01 239#define SAA7146_HPS_SYNC_PORT_B 0x01
240 240
241/* some memory sizes */ 241/* some memory sizes */
242#define SAA7146_CLIPPING_MEM (14*PAGE_SIZE) 242/* max. 16 clipping rectangles */
243#define SAA7146_CLIPPING_MEM (16 * 4 * sizeof(u32))
243 244
244/* some defines for the various clipping-modes */ 245/* some defines for the various clipping-modes */
245#define SAA7146_CLIPPING_RECT 0x4 246#define SAA7146_CLIPPING_RECT 0x4
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index bc3c26494c3d..d585ea9fa97d 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -34,6 +34,7 @@ struct fib_rules_ops
34 int family; 34 int family;
35 struct list_head list; 35 struct list_head list;
36 int rule_size; 36 int rule_size;
37 int addr_size;
37 38
38 int (*action)(struct fib_rule *, 39 int (*action)(struct fib_rule *,
39 struct flowi *, int, 40 struct flowi *, int,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 9eda572a2a65..cf355a3c2ad5 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -58,6 +58,7 @@ struct fib6_node
58 __u16 fn_bit; /* bit key */ 58 __u16 fn_bit; /* bit key */
59 __u16 fn_flags; 59 __u16 fn_flags;
60 __u32 fn_sernum; 60 __u32 fn_sernum;
61 struct rt6_info *rr_ptr;
61}; 62};
62 63
63#ifndef CONFIG_IPV6_SUBTREES 64#ifndef CONFIG_IPV6_SUBTREES
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 10559e937d27..8a830188354d 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define the new driver API for Wireless Extensions 2 * This file define the new driver API for Wireless Extensions
3 * 3 *
4 * Version : 7 18.3.05 4 * Version : 8 16.3.07
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 2001-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 2001-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _IW_HANDLER_H 10#ifndef _IW_HANDLER_H
@@ -207,7 +207,7 @@
207 * will be needed... 207 * will be needed...
208 * I just plan to increment with each new version. 208 * I just plan to increment with each new version.
209 */ 209 */
210#define IW_HANDLER_VERSION 7 210#define IW_HANDLER_VERSION 8
211 211
212/* 212/*
213 * Changes : 213 * Changes :
@@ -239,6 +239,10 @@
239 * - Remove (struct iw_point *)->pointer from events and streams 239 * - Remove (struct iw_point *)->pointer from events and streams
240 * - Remove spy_offset from struct iw_handler_def 240 * - Remove spy_offset from struct iw_handler_def
241 * - Add "check" version of event macros for ieee802.11 stack 241 * - Add "check" version of event macros for ieee802.11 stack
242 *
243 * V7 to V8
244 * ----------
245 * - Prevent leaking of kernel space in stream on 64 bits.
242 */ 246 */
243 247
244/**************************** CONSTANTS ****************************/ 248/**************************** CONSTANTS ****************************/
@@ -500,7 +504,11 @@ iwe_stream_add_event(char * stream, /* Stream of events */
500 /* Check if it's possible */ 504 /* Check if it's possible */
501 if(likely((stream + event_len) < ends)) { 505 if(likely((stream + event_len) < ends)) {
502 iwe->len = event_len; 506 iwe->len = event_len;
503 memcpy(stream, (char *) iwe, event_len); 507 /* Beware of alignement issues on 64 bits */
508 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
509 memcpy(stream + IW_EV_LCP_LEN,
510 ((char *) iwe) + IW_EV_LCP_LEN,
511 event_len - IW_EV_LCP_LEN);
504 stream += event_len; 512 stream += event_len;
505 } 513 }
506 return stream; 514 return stream;
@@ -521,10 +529,10 @@ iwe_stream_add_point(char * stream, /* Stream of events */
521 /* Check if it's possible */ 529 /* Check if it's possible */
522 if(likely((stream + event_len) < ends)) { 530 if(likely((stream + event_len) < ends)) {
523 iwe->len = event_len; 531 iwe->len = event_len;
524 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN); 532 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
525 memcpy(stream + IW_EV_LCP_LEN, 533 memcpy(stream + IW_EV_LCP_LEN,
526 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 534 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
527 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 535 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
528 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 536 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
529 stream += event_len; 537 stream += event_len;
530 } 538 }
@@ -574,7 +582,11 @@ iwe_stream_check_add_event(char * stream, /* Stream of events */
574 /* Check if it's possible, set error if not */ 582 /* Check if it's possible, set error if not */
575 if(likely((stream + event_len) < ends)) { 583 if(likely((stream + event_len) < ends)) {
576 iwe->len = event_len; 584 iwe->len = event_len;
577 memcpy(stream, (char *) iwe, event_len); 585 /* Beware of alignement issues on 64 bits */
586 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
587 memcpy(stream + IW_EV_LCP_LEN,
588 ((char *) iwe) + IW_EV_LCP_LEN,
589 event_len - IW_EV_LCP_LEN);
578 stream += event_len; 590 stream += event_len;
579 } else 591 } else
580 *perr = -E2BIG; 592 *perr = -E2BIG;
@@ -598,10 +610,10 @@ iwe_stream_check_add_point(char * stream, /* Stream of events */
598 /* Check if it's possible */ 610 /* Check if it's possible */
599 if(likely((stream + event_len) < ends)) { 611 if(likely((stream + event_len) < ends)) {
600 iwe->len = event_len; 612 iwe->len = event_len;
601 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN); 613 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
602 memcpy(stream + IW_EV_LCP_LEN, 614 memcpy(stream + IW_EV_LCP_LEN,
603 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 615 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
604 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 616 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
605 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 617 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
606 stream += event_len; 618 stream += event_len;
607 } else 619 } else
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 3725b93c52f3..ad7fe1121412 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -36,7 +36,7 @@ struct neigh_parms
36 struct net_device *dev; 36 struct net_device *dev;
37 struct neigh_parms *next; 37 struct neigh_parms *next;
38 int (*neigh_setup)(struct neighbour *); 38 int (*neigh_setup)(struct neighbour *);
39 void (*neigh_destructor)(struct neighbour *); 39 void (*neigh_cleanup)(struct neighbour *);
40 struct neigh_table *tbl; 40 struct neigh_table *tbl;
41 41
42 void *sysctl_table; 42 void *sysctl_table;
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index b902d24a3256..02647fe3d74b 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -352,10 +352,13 @@ tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv)
352static inline int 352static inline int
353tcf_match_indev(struct sk_buff *skb, char *indev) 353tcf_match_indev(struct sk_buff *skb, char *indev)
354{ 354{
355 struct net_device *dev;
356
355 if (indev[0]) { 357 if (indev[0]) {
356 if (!skb->input_dev) 358 if (!skb->iif)
357 return 0; 359 return 0;
358 if (strcmp(indev, skb->input_dev->name)) 360 dev = __dev_get_by_index(skb->iif);
361 if (!dev || strcmp(indev, dev->name))
359 return 0; 362 return 0;
360 } 363 }
361 364
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 31a8e88f1a74..f431acf3dcea 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1002,6 +1002,7 @@ void sctp_transport_update_rto(struct sctp_transport *, __u32);
1002void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); 1002void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1003void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); 1003void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
1004unsigned long sctp_transport_timeout(struct sctp_transport *); 1004unsigned long sctp_transport_timeout(struct sctp_transport *);
1005void sctp_transport_reset(struct sctp_transport *);
1005 1006
1006 1007
1007/* This is the structure we use to queue packets as they come into 1008/* This is the structure we use to queue packets as they come into
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index a43c8788b650..ab26ab3adae1 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -59,6 +59,7 @@ struct sctp_ulpq {
59/* Prototypes. */ 59/* Prototypes. */
60struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *, 60struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
61 struct sctp_association *); 61 struct sctp_association *);
62void sctp_ulpq_flush(struct sctp_ulpq *ulpq);
62void sctp_ulpq_free(struct sctp_ulpq *); 63void sctp_ulpq_free(struct sctp_ulpq *);
63 64
64/* Add a new DATA chunk for processing. */ 65/* Add a new DATA chunk for processing. */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 92a1fc46ea59..5a00aa85b756 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -988,8 +988,9 @@ extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int,
988int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 988int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
989struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 989struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
990 struct xfrm_selector *sel, 990 struct xfrm_selector *sel,
991 struct xfrm_sec_ctx *ctx, int delete); 991 struct xfrm_sec_ctx *ctx, int delete,
992struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); 992 int *err);
993struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err);
993void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 994void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
994u32 xfrm_get_acqseq(void); 995u32 xfrm_get_acqseq(void);
995void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); 996void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
diff --git a/include/sound/version.h b/include/sound/version.h
index 5f7275000102..42a18cc95f38 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.14rc3" 2#define CONFIG_SND_VERSION "1.0.14rc3"
3#define CONFIG_SND_DATE " (Tue Mar 06 13:10:00 2007 UTC)" 3#define CONFIG_SND_DATE " (Wed Mar 14 07:25:50 2007 UTC)"
diff --git a/ipc/util.c b/ipc/util.c
index 08a647965b9e..0b652387d169 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -144,6 +144,13 @@ void free_ipc_ns(struct kref *kref)
144 shm_exit_ns(ns); 144 shm_exit_ns(ns);
145 kfree(ns); 145 kfree(ns);
146} 146}
147#else
148int copy_ipcs(unsigned long flags, struct task_struct *tsk)
149{
150 if (flags & CLONE_NEWIPC)
151 return -EINVAL;
152 return 0;
153}
147#endif 154#endif
148 155
149/** 156/**
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 359955800dd2..628c7ac590a0 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -739,28 +739,26 @@ static inline void audit_free_context(struct audit_context *context)
739void audit_log_task_context(struct audit_buffer *ab) 739void audit_log_task_context(struct audit_buffer *ab)
740{ 740{
741 char *ctx = NULL; 741 char *ctx = NULL;
742 ssize_t len = 0; 742 unsigned len;
743 int error;
744 u32 sid;
745
746 selinux_get_task_sid(current, &sid);
747 if (!sid)
748 return;
743 749
744 len = security_getprocattr(current, "current", NULL, 0); 750 error = selinux_sid_to_string(sid, &ctx, &len);
745 if (len < 0) { 751 if (error) {
746 if (len != -EINVAL) 752 if (error != -EINVAL)
747 goto error_path; 753 goto error_path;
748 return; 754 return;
749 } 755 }
750 756
751 ctx = kmalloc(len, GFP_KERNEL);
752 if (!ctx)
753 goto error_path;
754
755 len = security_getprocattr(current, "current", ctx, len);
756 if (len < 0 )
757 goto error_path;
758
759 audit_log_format(ab, " subj=%s", ctx); 757 audit_log_format(ab, " subj=%s", ctx);
758 kfree(ctx);
760 return; 759 return;
761 760
762error_path: 761error_path:
763 kfree(ctx);
764 audit_panic("error in audit_log_task_context"); 762 audit_panic("error in audit_log_task_context");
765 return; 763 return;
766} 764}
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3d4206ada5c9..36e70845cfc3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -254,6 +254,12 @@ int __cpuinit cpu_up(unsigned int cpu)
254} 254}
255 255
256#ifdef CONFIG_SUSPEND_SMP 256#ifdef CONFIG_SUSPEND_SMP
257/* Needed to prevent the microcode driver from requesting firmware in its CPU
258 * hotplug notifier during the suspend/resume.
259 */
260int suspend_cpu_hotplug;
261EXPORT_SYMBOL(suspend_cpu_hotplug);
262
257static cpumask_t frozen_cpus; 263static cpumask_t frozen_cpus;
258 264
259int disable_nonboot_cpus(void) 265int disable_nonboot_cpus(void)
@@ -261,16 +267,8 @@ int disable_nonboot_cpus(void)
261 int cpu, first_cpu, error = 0; 267 int cpu, first_cpu, error = 0;
262 268
263 mutex_lock(&cpu_add_remove_lock); 269 mutex_lock(&cpu_add_remove_lock);
264 first_cpu = first_cpu(cpu_present_map); 270 suspend_cpu_hotplug = 1;
265 if (!cpu_online(first_cpu)) { 271 first_cpu = first_cpu(cpu_online_map);
266 error = _cpu_up(first_cpu);
267 if (error) {
268 printk(KERN_ERR "Could not bring CPU%d up.\n",
269 first_cpu);
270 goto out;
271 }
272 }
273
274 /* We take down all of the non-boot CPUs in one shot to avoid races 272 /* We take down all of the non-boot CPUs in one shot to avoid races
275 * with the userspace trying to use the CPU hotplug at the same time 273 * with the userspace trying to use the CPU hotplug at the same time
276 */ 274 */
@@ -296,7 +294,7 @@ int disable_nonboot_cpus(void)
296 } else { 294 } else {
297 printk(KERN_ERR "Non-boot CPUs are not disabled\n"); 295 printk(KERN_ERR "Non-boot CPUs are not disabled\n");
298 } 296 }
299out: 297 suspend_cpu_hotplug = 0;
300 mutex_unlock(&cpu_add_remove_lock); 298 mutex_unlock(&cpu_add_remove_lock);
301 return error; 299 return error;
302} 300}
@@ -308,20 +306,22 @@ void enable_nonboot_cpus(void)
308 /* Allow everyone to use the CPU hotplug again */ 306 /* Allow everyone to use the CPU hotplug again */
309 mutex_lock(&cpu_add_remove_lock); 307 mutex_lock(&cpu_add_remove_lock);
310 cpu_hotplug_disabled = 0; 308 cpu_hotplug_disabled = 0;
311 mutex_unlock(&cpu_add_remove_lock);
312 if (cpus_empty(frozen_cpus)) 309 if (cpus_empty(frozen_cpus))
313 return; 310 goto out;
314 311
312 suspend_cpu_hotplug = 1;
315 printk("Enabling non-boot CPUs ...\n"); 313 printk("Enabling non-boot CPUs ...\n");
316 for_each_cpu_mask(cpu, frozen_cpus) { 314 for_each_cpu_mask(cpu, frozen_cpus) {
317 error = cpu_up(cpu); 315 error = _cpu_up(cpu);
318 if (!error) { 316 if (!error) {
319 printk("CPU%d is up\n", cpu); 317 printk("CPU%d is up\n", cpu);
320 continue; 318 continue;
321 } 319 }
322 printk(KERN_WARNING "Error taking CPU%d up: %d\n", 320 printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
323 cpu, error);
324 } 321 }
325 cpus_clear(frozen_cpus); 322 cpus_clear(frozen_cpus);
323 suspend_cpu_hotplug = 0;
324out:
325 mutex_unlock(&cpu_add_remove_lock);
326} 326}
327#endif 327#endif
diff --git a/kernel/exit.c b/kernel/exit.c
index f132349c0325..b55ed4cc9104 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -790,7 +790,7 @@ static void exit_notify(struct task_struct *tsk)
790 790
791 pgrp = task_pgrp(tsk); 791 pgrp = task_pgrp(tsk);
792 if ((task_pgrp(t) != pgrp) && 792 if ((task_pgrp(t) != pgrp) &&
793 (task_session(t) != task_session(tsk)) && 793 (task_session(t) == task_session(tsk)) &&
794 will_become_orphaned_pgrp(pgrp, tsk) && 794 will_become_orphaned_pgrp(pgrp, tsk) &&
795 has_stopped_jobs(pgrp)) { 795 has_stopped_jobs(pgrp)) {
796 __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); 796 __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp);
diff --git a/kernel/fork.c b/kernel/fork.c
index d154cc786489..6af959c034d8 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -933,8 +933,8 @@ asmlinkage long sys_set_tid_address(int __user *tidptr)
933 933
934static inline void rt_mutex_init_task(struct task_struct *p) 934static inline void rt_mutex_init_task(struct task_struct *p)
935{ 935{
936#ifdef CONFIG_RT_MUTEXES
937 spin_lock_init(&p->pi_lock); 936 spin_lock_init(&p->pi_lock);
937#ifdef CONFIG_RT_MUTEXES
938 plist_head_init(&p->pi_waiters, &p->pi_lock); 938 plist_head_init(&p->pi_waiters, &p->pi_lock);
939 p->pi_blocked_on = NULL; 939 p->pi_blocked_on = NULL;
940#endif 940#endif
diff --git a/kernel/futex.c b/kernel/futex.c
index e749e7df14b1..5a270b5e3f95 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -565,6 +565,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
565 if (!pi_state) 565 if (!pi_state)
566 return -EINVAL; 566 return -EINVAL;
567 567
568 spin_lock(&pi_state->pi_mutex.wait_lock);
568 new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); 569 new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
569 570
570 /* 571 /*
@@ -604,6 +605,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
604 pi_state->owner = new_owner; 605 pi_state->owner = new_owner;
605 spin_unlock_irq(&new_owner->pi_lock); 606 spin_unlock_irq(&new_owner->pi_lock);
606 607
608 spin_unlock(&pi_state->pi_mutex.wait_lock);
607 rt_mutex_unlock(&pi_state->pi_mutex); 609 rt_mutex_unlock(&pi_state->pi_mutex);
608 610
609 return 0; 611 return 0;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index ec4cb9f3e3b7..b74860aaf5f1 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -135,7 +135,7 @@ EXPORT_SYMBOL_GPL(ktime_get_ts);
135static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) 135static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
136{ 136{
137 ktime_t xtim, tomono; 137 ktime_t xtim, tomono;
138 struct timespec xts; 138 struct timespec xts, tom;
139 unsigned long seq; 139 unsigned long seq;
140 140
141 do { 141 do {
@@ -145,10 +145,11 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
145#else 145#else
146 xts = xtime; 146 xts = xtime;
147#endif 147#endif
148 tom = wall_to_monotonic;
148 } while (read_seqretry(&xtime_lock, seq)); 149 } while (read_seqretry(&xtime_lock, seq));
149 150
150 xtim = timespec_to_ktime(xts); 151 xtim = timespec_to_ktime(xts);
151 tomono = timespec_to_ktime(wall_to_monotonic); 152 tomono = timespec_to_ktime(tom);
152 base->clock_base[CLOCK_REALTIME].softirq_time = xtim; 153 base->clock_base[CLOCK_REALTIME].softirq_time = xtim;
153 base->clock_base[CLOCK_MONOTONIC].softirq_time = 154 base->clock_base[CLOCK_MONOTONIC].softirq_time =
154 ktime_add(xtim, tomono); 155 ktime_add(xtim, tomono);
@@ -458,6 +459,18 @@ void clock_was_set(void)
458} 459}
459 460
460/* 461/*
462 * During resume we might have to reprogram the high resolution timer
463 * interrupt (on the local CPU):
464 */
465void hres_timers_resume(void)
466{
467 WARN_ON_ONCE(num_online_cpus() > 1);
468
469 /* Retrigger the CPU local events: */
470 retrigger_next_event(NULL);
471}
472
473/*
461 * Check, whether the timer is on the callback pending list 474 * Check, whether the timer is on the callback pending list
462 */ 475 */
463static inline int hrtimer_cb_pending(const struct hrtimer *timer) 476static inline int hrtimer_cb_pending(const struct hrtimer *timer)
@@ -644,6 +657,12 @@ hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
644 orun++; 657 orun++;
645 } 658 }
646 timer->expires = ktime_add(timer->expires, interval); 659 timer->expires = ktime_add(timer->expires, interval);
660 /*
661 * Make sure, that the result did not wrap with a very large
662 * interval.
663 */
664 if (timer->expires.tv64 < 0)
665 timer->expires = ktime_set(KTIME_SEC_MAX, 0);
647 666
648 return orun; 667 return orun;
649} 668}
@@ -807,7 +826,12 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
807 826
808 timer_stats_hrtimer_set_start_info(timer); 827 timer_stats_hrtimer_set_start_info(timer);
809 828
810 enqueue_hrtimer(timer, new_base, base == new_base); 829 /*
830 * Only allow reprogramming if the new base is on this CPU.
831 * (it might still be on another CPU if the timer was pending)
832 */
833 enqueue_hrtimer(timer, new_base,
834 new_base->cpu_base == &__get_cpu_var(hrtimer_bases));
811 835
812 unlock_hrtimer_base(timer, &flags); 836 unlock_hrtimer_base(timer, &flags);
813 837
diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
index 85a430da0fb6..d8ee241115f5 100644
--- a/kernel/irq/devres.c
+++ b/kernel/irq/devres.c
@@ -54,7 +54,7 @@ int devm_request_irq(struct device *dev, unsigned int irq,
54 54
55 rc = request_irq(irq, handler, irqflags, devname, dev_id); 55 rc = request_irq(irq, handler, irqflags, devname, dev_id);
56 if (rc) { 56 if (rc) {
57 kfree(dr); 57 devres_free(dr);
58 return rc; 58 return rc;
59 } 59 }
60 60
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 8dc24c92dc6d..7065a687ac54 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2742,6 +2742,10 @@ void debug_show_all_locks(void)
2742 int count = 10; 2742 int count = 10;
2743 int unlock = 1; 2743 int unlock = 1;
2744 2744
2745 if (unlikely(!debug_locks)) {
2746 printk("INFO: lockdep is turned off.\n");
2747 return;
2748 }
2745 printk("\nShowing all locks held in the system:\n"); 2749 printk("\nShowing all locks held in the system:\n");
2746 2750
2747 /* 2751 /*
@@ -2785,6 +2789,10 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks);
2785 2789
2786void debug_show_held_locks(struct task_struct *task) 2790void debug_show_held_locks(struct task_struct *task)
2787{ 2791{
2792 if (unlikely(!debug_locks)) {
2793 printk("INFO: lockdep is turned off.\n");
2794 return;
2795 }
2788 lockdep_print_held_locks(task); 2796 lockdep_print_held_locks(task);
2789} 2797}
2790 2798
diff --git a/kernel/module.c b/kernel/module.c
index f77e893e4620..dcdb32b8b13c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2384,8 +2384,13 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
2384 2384
2385 /* Lookup built-in module entry in /sys/modules */ 2385 /* Lookup built-in module entry in /sys/modules */
2386 mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); 2386 mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name);
2387 if (mkobj) 2387 if (mkobj) {
2388 mk = container_of(mkobj, struct module_kobject, kobj); 2388 mk = container_of(mkobj, struct module_kobject, kobj);
2389 /* remember our module structure */
2390 drv->mkobj = mk;
2391 /* kset_find_obj took a reference */
2392 kobject_put(mkobj);
2393 }
2389 } 2394 }
2390 2395
2391 if (!mk) 2396 if (!mk)
@@ -2405,26 +2410,25 @@ EXPORT_SYMBOL(module_add_driver);
2405 2410
2406void module_remove_driver(struct device_driver *drv) 2411void module_remove_driver(struct device_driver *drv)
2407{ 2412{
2413 struct module_kobject *mk = NULL;
2408 char *driver_name; 2414 char *driver_name;
2409 2415
2410 if (!drv) 2416 if (!drv)
2411 return; 2417 return;
2412 2418
2413 sysfs_remove_link(&drv->kobj, "module"); 2419 sysfs_remove_link(&drv->kobj, "module");
2414 if (drv->owner && drv->owner->mkobj.drivers_dir) { 2420
2421 if (drv->owner)
2422 mk = &drv->owner->mkobj;
2423 else if (drv->mkobj)
2424 mk = drv->mkobj;
2425 if (mk && mk->drivers_dir) {
2415 driver_name = make_driver_name(drv); 2426 driver_name = make_driver_name(drv);
2416 if (driver_name) { 2427 if (driver_name) {
2417 sysfs_remove_link(drv->owner->mkobj.drivers_dir, 2428 sysfs_remove_link(mk->drivers_dir, driver_name);
2418 driver_name);
2419 kfree(driver_name); 2429 kfree(driver_name);
2420 } 2430 }
2421 } 2431 }
2422 /*
2423 * Undo the additional reference we added in module_add_driver()
2424 * via kset_find_obj()
2425 */
2426 if (drv->mod_name)
2427 kobject_put(&drv->kobj);
2428} 2432}
2429EXPORT_SYMBOL(module_remove_driver); 2433EXPORT_SYMBOL(module_remove_driver);
2430#endif 2434#endif
diff --git a/kernel/power/console.c b/kernel/power/console.c
index 623786d44159..89bcf4973ee5 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -27,7 +27,15 @@ int pm_prepare_console(void)
27 return 1; 27 return 1;
28 } 28 }
29 29
30 set_console(SUSPEND_CONSOLE); 30 if (set_console(SUSPEND_CONSOLE)) {
31 /*
32 * We're unable to switch to the SUSPEND_CONSOLE.
33 * Let the calling function know so it can decide
34 * what to do.
35 */
36 release_console_sem();
37 return 1;
38 }
31 release_console_sem(); 39 release_console_sem();
32 40
33 if (vt_waitactive(SUSPEND_CONSOLE)) { 41 if (vt_waitactive(SUSPEND_CONSOLE)) {
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 406b20adb27a..aec19b063e3f 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -240,12 +240,6 @@ static int software_resume(void)
240 goto Done; 240 goto Done;
241 } 241 }
242 242
243 error = platform_prepare();
244 if (error) {
245 swsusp_free();
246 goto Thaw;
247 }
248
249 pr_debug("PM: Reading swsusp image.\n"); 243 pr_debug("PM: Reading swsusp image.\n");
250 244
251 error = swsusp_read(); 245 error = swsusp_read();
@@ -268,7 +262,6 @@ static int software_resume(void)
268 enable_nonboot_cpus(); 262 enable_nonboot_cpus();
269 Free: 263 Free:
270 swsusp_free(); 264 swsusp_free();
271 platform_finish();
272 device_resume(); 265 device_resume();
273 resume_console(); 266 resume_console();
274 Thaw: 267 Thaw:
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 7fb834397a0d..175370824f37 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -229,13 +229,13 @@ int swsusp_shrink_memory(void)
229 size += highmem_size; 229 size += highmem_size;
230 for_each_zone (zone) 230 for_each_zone (zone)
231 if (populated_zone(zone)) { 231 if (populated_zone(zone)) {
232 tmp += snapshot_additional_pages(zone);
232 if (is_highmem(zone)) { 233 if (is_highmem(zone)) {
233 highmem_size -= 234 highmem_size -=
234 zone_page_state(zone, NR_FREE_PAGES); 235 zone_page_state(zone, NR_FREE_PAGES);
235 } else { 236 } else {
236 tmp -= zone_page_state(zone, NR_FREE_PAGES); 237 tmp -= zone_page_state(zone, NR_FREE_PAGES);
237 tmp += zone->lowmem_reserve[ZONE_NORMAL]; 238 tmp += zone->lowmem_reserve[ZONE_NORMAL];
238 tmp += snapshot_additional_pages(zone);
239 } 239 }
240 } 240 }
241 241
diff --git a/kernel/power/user.c b/kernel/power/user.c
index dd09efe7df54..7cf6713b2325 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -368,9 +368,12 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
368 if (error) { 368 if (error) {
369 printk(KERN_ERR "Failed to suspend some devices.\n"); 369 printk(KERN_ERR "Failed to suspend some devices.\n");
370 } else { 370 } else {
371 /* Enter S3, system is already frozen */ 371 error = disable_nonboot_cpus();
372 suspend_enter(PM_SUSPEND_MEM); 372 if (!error) {
373 373 /* Enter S3, system is already frozen */
374 suspend_enter(PM_SUSPEND_MEM);
375 enable_nonboot_cpus();
376 }
374 /* Wake up devices */ 377 /* Wake up devices */
375 device_resume(); 378 device_resume();
376 } 379 }
diff --git a/kernel/sched.c b/kernel/sched.c
index a4ca632c477c..b9a683730148 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4687,32 +4687,10 @@ out_unlock:
4687 return retval; 4687 return retval;
4688} 4688}
4689 4689
4690static inline struct task_struct *eldest_child(struct task_struct *p)
4691{
4692 if (list_empty(&p->children))
4693 return NULL;
4694 return list_entry(p->children.next,struct task_struct,sibling);
4695}
4696
4697static inline struct task_struct *older_sibling(struct task_struct *p)
4698{
4699 if (p->sibling.prev==&p->parent->children)
4700 return NULL;
4701 return list_entry(p->sibling.prev,struct task_struct,sibling);
4702}
4703
4704static inline struct task_struct *younger_sibling(struct task_struct *p)
4705{
4706 if (p->sibling.next==&p->parent->children)
4707 return NULL;
4708 return list_entry(p->sibling.next,struct task_struct,sibling);
4709}
4710
4711static const char stat_nam[] = "RSDTtZX"; 4690static const char stat_nam[] = "RSDTtZX";
4712 4691
4713static void show_task(struct task_struct *p) 4692static void show_task(struct task_struct *p)
4714{ 4693{
4715 struct task_struct *relative;
4716 unsigned long free = 0; 4694 unsigned long free = 0;
4717 unsigned state; 4695 unsigned state;
4718 4696
@@ -4738,19 +4716,7 @@ static void show_task(struct task_struct *p)
4738 free = (unsigned long)n - (unsigned long)end_of_stack(p); 4716 free = (unsigned long)n - (unsigned long)end_of_stack(p);
4739 } 4717 }
4740#endif 4718#endif
4741 printk("%5lu %5d %6d ", free, p->pid, p->parent->pid); 4719 printk("%5lu %5d %6d", free, p->pid, p->parent->pid);
4742 if ((relative = eldest_child(p)))
4743 printk("%5d ", relative->pid);
4744 else
4745 printk(" ");
4746 if ((relative = younger_sibling(p)))
4747 printk("%7d", relative->pid);
4748 else
4749 printk(" ");
4750 if ((relative = older_sibling(p)))
4751 printk(" %5d", relative->pid);
4752 else
4753 printk(" ");
4754 if (!p->mm) 4720 if (!p->mm)
4755 printk(" (L-TLB)\n"); 4721 printk(" (L-TLB)\n");
4756 else 4722 else
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 34b2301276ce..1b255df4fcd0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -846,7 +846,8 @@ static ctl_table vm_table[] = {
846 .extra2 = &one_hundred, 846 .extra2 = &one_hundred,
847 }, 847 },
848#endif 848#endif
849#ifdef CONFIG_X86_32 849#if defined(CONFIG_X86_32) || \
850 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
850 { 851 {
851 .ctl_name = VM_VDSO_ENABLED, 852 .ctl_name = VM_VDSO_ENABLED,
852 .procname = "vdso_enabled", 853 .procname = "vdso_enabled",
diff --git a/kernel/time.c b/kernel/time.c
index c6c80ea5d0ea..2f47888e46c9 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -635,6 +635,7 @@ timeval_to_jiffies(const struct timeval *value)
635 (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> 635 (((u64)usec * USEC_CONVERSION + USEC_ROUND) >>
636 (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; 636 (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
637} 637}
638EXPORT_SYMBOL(timeval_to_jiffies);
638 639
639void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) 640void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
640{ 641{
@@ -649,6 +650,7 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
649 tv_usec /= NSEC_PER_USEC; 650 tv_usec /= NSEC_PER_USEC;
650 value->tv_usec = tv_usec; 651 value->tv_usec = tv_usec;
651} 652}
653EXPORT_SYMBOL(jiffies_to_timeval);
652 654
653/* 655/*
654 * Convert jiffies/jiffies_64 to clock_t and back. 656 * Convert jiffies/jiffies_64 to clock_t and back.
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 67932ea78c17..76212b2a99de 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -274,72 +274,3 @@ void clockevents_notify(unsigned long reason, void *arg)
274} 274}
275EXPORT_SYMBOL_GPL(clockevents_notify); 275EXPORT_SYMBOL_GPL(clockevents_notify);
276 276
277#ifdef CONFIG_SYSFS
278
279/**
280 * clockevents_show_registered - sysfs interface for listing clockevents
281 * @dev: unused
282 * @buf: char buffer to be filled with clock events list
283 *
284 * Provides sysfs interface for listing registered clock event devices
285 */
286static ssize_t clockevents_show_registered(struct sys_device *dev, char *buf)
287{
288 struct list_head *tmp;
289 char *p = buf;
290 int cpu;
291
292 spin_lock(&clockevents_lock);
293
294 list_for_each(tmp, &clockevent_devices) {
295 struct clock_event_device *ce;
296
297 ce = list_entry(tmp, struct clock_event_device, list);
298 p += sprintf(p, "%-20s F:%04x M:%d", ce->name,
299 ce->features, ce->mode);
300 p += sprintf(p, " C:");
301 if (!cpus_equal(ce->cpumask, cpu_possible_map)) {
302 for_each_cpu_mask(cpu, ce->cpumask)
303 p += sprintf(p, " %d", cpu);
304 } else {
305 /*
306 * FIXME: Add the cpu which is handling this sucker
307 */
308 }
309 p += sprintf(p, "\n");
310 }
311
312 spin_unlock(&clockevents_lock);
313
314 return p - buf;
315}
316
317/*
318 * Sysfs setup bits:
319 */
320static SYSDEV_ATTR(registered, 0600,
321 clockevents_show_registered, NULL);
322
323static struct sysdev_class clockevents_sysclass = {
324 set_kset_name("clockevents"),
325};
326
327static struct sys_device clockevents_sys_device = {
328 .id = 0,
329 .cls = &clockevents_sysclass,
330};
331
332static int __init clockevents_sysfs_init(void)
333{
334 int error = sysdev_class_register(&clockevents_sysclass);
335
336 if (!error)
337 error = sysdev_register(&clockevents_sys_device);
338 if (!error)
339 error = sysdev_create_file(
340 &clockevents_sys_device,
341 &attr_registered);
342 return error;
343}
344device_initcall(clockevents_sysfs_init);
345#endif
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 5b0e46b56fd0..fe5c7db24247 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -151,7 +151,8 @@ static void clocksource_check_watchdog(struct clocksource *cs)
151 watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; 151 watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
152 add_timer(&watchdog_timer); 152 add_timer(&watchdog_timer);
153 } 153 }
154 } else if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) { 154 } else {
155 if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
155 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES; 156 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
156 157
157 if (!watchdog || cs->rating > watchdog->rating) { 158 if (!watchdog || cs->rating > watchdog->rating) {
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 3be8da8fed7e..4c256fdb8875 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -69,4 +69,4 @@ static int __init init_jiffies_clocksource(void)
69 return clocksource_register(&clocksource_jiffies); 69 return clocksource_register(&clocksource_jiffies);
70} 70}
71 71
72module_init(init_jiffies_clocksource); 72core_initcall(init_jiffies_clocksource);
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index eb12509e00bd..cb25649c6f50 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -32,7 +32,7 @@ static u64 tick_length, tick_length_base;
32/* TIME_ERROR prevents overwriting the CMOS clock */ 32/* TIME_ERROR prevents overwriting the CMOS clock */
33static int time_state = TIME_OK; /* clock synchronization status */ 33static int time_state = TIME_OK; /* clock synchronization status */
34int time_status = STA_UNSYNC; /* clock status bits */ 34int time_status = STA_UNSYNC; /* clock status bits */
35static long time_offset; /* time adjustment (ns) */ 35static s64 time_offset; /* time adjustment (ns) */
36static long time_constant = 2; /* pll time constant */ 36static long time_constant = 2; /* pll time constant */
37long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ 37long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */
38long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ 38long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */
@@ -196,7 +196,7 @@ void __attribute__ ((weak)) notify_arch_cmos_timer(void)
196 */ 196 */
197int do_adjtimex(struct timex *txc) 197int do_adjtimex(struct timex *txc)
198{ 198{
199 long ltemp, mtemp, save_adjust; 199 long mtemp, save_adjust, rem;
200 s64 freq_adj, temp64; 200 s64 freq_adj, temp64;
201 int result; 201 int result;
202 202
@@ -277,14 +277,14 @@ int do_adjtimex(struct timex *txc)
277 time_adjust = txc->offset; 277 time_adjust = txc->offset;
278 } 278 }
279 else if (time_status & STA_PLL) { 279 else if (time_status & STA_PLL) {
280 ltemp = txc->offset * NSEC_PER_USEC; 280 time_offset = txc->offset * NSEC_PER_USEC;
281 281
282 /* 282 /*
283 * Scale the phase adjustment and 283 * Scale the phase adjustment and
284 * clamp to the operating range. 284 * clamp to the operating range.
285 */ 285 */
286 time_offset = min(ltemp, MAXPHASE * NSEC_PER_USEC); 286 time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC);
287 time_offset = max(time_offset, -MAXPHASE * NSEC_PER_USEC); 287 time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC);
288 288
289 /* 289 /*
290 * Select whether the frequency is to be controlled 290 * Select whether the frequency is to be controlled
@@ -297,11 +297,11 @@ int do_adjtimex(struct timex *txc)
297 mtemp = xtime.tv_sec - time_reftime; 297 mtemp = xtime.tv_sec - time_reftime;
298 time_reftime = xtime.tv_sec; 298 time_reftime = xtime.tv_sec;
299 299
300 freq_adj = (s64)time_offset * mtemp; 300 freq_adj = time_offset * mtemp;
301 freq_adj = shift_right(freq_adj, time_constant * 2 + 301 freq_adj = shift_right(freq_adj, time_constant * 2 +
302 (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); 302 (SHIFT_PLL + 2) * 2 - SHIFT_NSEC);
303 if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { 303 if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) {
304 temp64 = (s64)time_offset << (SHIFT_NSEC - SHIFT_FLL); 304 temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
305 if (time_offset < 0) { 305 if (time_offset < 0) {
306 temp64 = -temp64; 306 temp64 = -temp64;
307 do_div(temp64, mtemp); 307 do_div(temp64, mtemp);
@@ -314,8 +314,10 @@ int do_adjtimex(struct timex *txc)
314 freq_adj += time_freq; 314 freq_adj += time_freq;
315 freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); 315 freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC);
316 time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); 316 time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC);
317 time_offset = (time_offset / NTP_INTERVAL_FREQ) 317 time_offset = div_long_long_rem_signed(time_offset,
318 << SHIFT_UPDATE; 318 NTP_INTERVAL_FREQ,
319 &rem);
320 time_offset <<= SHIFT_UPDATE;
319 } /* STA_PLL */ 321 } /* STA_PLL */
320 } /* txc->modes & ADJ_OFFSET */ 322 } /* txc->modes & ADJ_OFFSET */
321 if (txc->modes & ADJ_TICK) 323 if (txc->modes & ADJ_TICK)
@@ -328,12 +330,12 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
328 result = TIME_ERROR; 330 result = TIME_ERROR;
329 331
330 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) 332 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
331 txc->offset = save_adjust; 333 txc->offset = save_adjust;
332 else 334 else
333 txc->offset = shift_right(time_offset, SHIFT_UPDATE) 335 txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *
334 * NTP_INTERVAL_FREQ / 1000; 336 NTP_INTERVAL_FREQ / 1000;
335 txc->freq = (time_freq / NSEC_PER_USEC) 337 txc->freq = (time_freq / NSEC_PER_USEC) <<
336 << (SHIFT_USEC - SHIFT_NSEC); 338 (SHIFT_USEC - SHIFT_NSEC);
337 txc->maxerror = time_maxerror; 339 txc->maxerror = time_maxerror;
338 txc->esterror = time_esterror; 340 txc->esterror = time_esterror;
339 txc->status = time_status; 341 txc->status = time_status;
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 5567745470f7..eadfce2fff74 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -307,12 +307,19 @@ int tick_resume_broadcast(void)
307 spin_lock_irqsave(&tick_broadcast_lock, flags); 307 spin_lock_irqsave(&tick_broadcast_lock, flags);
308 308
309 bc = tick_broadcast_device.evtdev; 309 bc = tick_broadcast_device.evtdev;
310 if (bc) {
311 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC &&
312 !cpus_empty(tick_broadcast_mask))
313 tick_broadcast_start_periodic(bc);
314 310
315 broadcast = cpu_isset(smp_processor_id(), tick_broadcast_mask); 311 if (bc) {
312 switch (tick_broadcast_device.mode) {
313 case TICKDEV_MODE_PERIODIC:
314 if(!cpus_empty(tick_broadcast_mask))
315 tick_broadcast_start_periodic(bc);
316 broadcast = cpu_isset(smp_processor_id(),
317 tick_broadcast_mask);
318 break;
319 case TICKDEV_MODE_ONESHOT:
320 broadcast = tick_resume_broadcast_oneshot(bc);
321 break;
322 }
316 } 323 }
317 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 324 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
318 325
@@ -347,6 +354,16 @@ static int tick_broadcast_set_event(ktime_t expires, int force)
347 } 354 }
348} 355}
349 356
357int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
358{
359 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
360
361 if(!cpus_empty(tick_broadcast_oneshot_mask))
362 tick_broadcast_set_event(ktime_get(), 1);
363
364 return cpu_isset(smp_processor_id(), tick_broadcast_oneshot_mask);
365}
366
350/* 367/*
351 * Reprogram the broadcast device: 368 * Reprogram the broadcast device:
352 * 369 *
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 43ba1bdec14c..bfda3f7f0716 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -298,18 +298,17 @@ static void tick_shutdown(unsigned int *cpup)
298 spin_unlock_irqrestore(&tick_device_lock, flags); 298 spin_unlock_irqrestore(&tick_device_lock, flags);
299} 299}
300 300
301static void tick_suspend_periodic(void) 301static void tick_suspend(void)
302{ 302{
303 struct tick_device *td = &__get_cpu_var(tick_cpu_device); 303 struct tick_device *td = &__get_cpu_var(tick_cpu_device);
304 unsigned long flags; 304 unsigned long flags;
305 305
306 spin_lock_irqsave(&tick_device_lock, flags); 306 spin_lock_irqsave(&tick_device_lock, flags);
307 if (td->mode == TICKDEV_MODE_PERIODIC) 307 clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN);
308 clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN);
309 spin_unlock_irqrestore(&tick_device_lock, flags); 308 spin_unlock_irqrestore(&tick_device_lock, flags);
310} 309}
311 310
312static void tick_resume_periodic(void) 311static void tick_resume(void)
313{ 312{
314 struct tick_device *td = &__get_cpu_var(tick_cpu_device); 313 struct tick_device *td = &__get_cpu_var(tick_cpu_device);
315 unsigned long flags; 314 unsigned long flags;
@@ -317,6 +316,8 @@ static void tick_resume_periodic(void)
317 spin_lock_irqsave(&tick_device_lock, flags); 316 spin_lock_irqsave(&tick_device_lock, flags);
318 if (td->mode == TICKDEV_MODE_PERIODIC) 317 if (td->mode == TICKDEV_MODE_PERIODIC)
319 tick_setup_periodic(td->evtdev, 0); 318 tick_setup_periodic(td->evtdev, 0);
319 else
320 tick_resume_oneshot();
320 spin_unlock_irqrestore(&tick_device_lock, flags); 321 spin_unlock_irqrestore(&tick_device_lock, flags);
321} 322}
322 323
@@ -348,13 +349,13 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason,
348 break; 349 break;
349 350
350 case CLOCK_EVT_NOTIFY_SUSPEND: 351 case CLOCK_EVT_NOTIFY_SUSPEND:
351 tick_suspend_periodic(); 352 tick_suspend();
352 tick_suspend_broadcast(); 353 tick_suspend_broadcast();
353 break; 354 break;
354 355
355 case CLOCK_EVT_NOTIFY_RESUME: 356 case CLOCK_EVT_NOTIFY_RESUME:
356 if (!tick_resume_broadcast()) 357 if (!tick_resume_broadcast())
357 tick_resume_periodic(); 358 tick_resume();
358 break; 359 break;
359 360
360 default: 361 default:
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 75890efd24ff..c9d203bde518 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -19,12 +19,13 @@ extern void tick_setup_oneshot(struct clock_event_device *newdev,
19extern int tick_program_event(ktime_t expires, int force); 19extern int tick_program_event(ktime_t expires, int force);
20extern void tick_oneshot_notify(void); 20extern void tick_oneshot_notify(void);
21extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); 21extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
22 22extern void tick_resume_oneshot(void);
23# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 23# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
24extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); 24extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
25extern void tick_broadcast_oneshot_control(unsigned long reason); 25extern void tick_broadcast_oneshot_control(unsigned long reason);
26extern void tick_broadcast_switch_to_oneshot(void); 26extern void tick_broadcast_switch_to_oneshot(void);
27extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); 27extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
28extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
28# else /* BROADCAST */ 29# else /* BROADCAST */
29static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 30static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
30{ 31{
@@ -43,6 +44,10 @@ void tick_setup_oneshot(struct clock_event_device *newdev,
43{ 44{
44 BUG(); 45 BUG();
45} 46}
47static inline void tick_resume_oneshot(void)
48{
49 BUG();
50}
46static inline int tick_program_event(ktime_t expires, int force) 51static inline int tick_program_event(ktime_t expires, int force)
47{ 52{
48 return 0; 53 return 0;
@@ -54,6 +59,10 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
54} 59}
55static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 60static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
56static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 61static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
62static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
63{
64 return 0;
65}
57#endif /* !TICK_ONESHOT */ 66#endif /* !TICK_ONESHOT */
58 67
59/* 68/*
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 2e8b7ff863cc..f6997ab0c3c9 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -41,6 +41,18 @@ int tick_program_event(ktime_t expires, int force)
41} 41}
42 42
43/** 43/**
44 * tick_resume_onshot - resume oneshot mode
45 */
46void tick_resume_oneshot(void)
47{
48 struct tick_device *td = &__get_cpu_var(tick_cpu_device);
49 struct clock_event_device *dev = td->evtdev;
50
51 clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
52 tick_program_event(ktime_get(), 1);
53}
54
55/**
44 * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) 56 * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz)
45 */ 57 */
46void tick_setup_oneshot(struct clock_event_device *newdev, 58void tick_setup_oneshot(struct clock_event_device *newdev,
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index f82c635c3d5c..59df5e8555a8 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -194,9 +194,9 @@ print_tickdevice(struct seq_file *m, struct tick_device *td)
194 return; 194 return;
195 } 195 }
196 SEQ_printf(m, "%s\n", dev->name); 196 SEQ_printf(m, "%s\n", dev->name);
197 SEQ_printf(m, " max_delta_ns: %ld\n", dev->max_delta_ns); 197 SEQ_printf(m, " max_delta_ns: %lu\n", dev->max_delta_ns);
198 SEQ_printf(m, " min_delta_ns: %ld\n", dev->min_delta_ns); 198 SEQ_printf(m, " min_delta_ns: %lu\n", dev->min_delta_ns);
199 SEQ_printf(m, " mult: %ld\n", dev->mult); 199 SEQ_printf(m, " mult: %lu\n", dev->mult);
200 SEQ_printf(m, " shift: %d\n", dev->shift); 200 SEQ_printf(m, " shift: %d\n", dev->shift);
201 SEQ_printf(m, " mode: %d\n", dev->mode); 201 SEQ_printf(m, " mode: %d\n", dev->mode);
202 SEQ_printf(m, " next_event: %Ld nsecs\n", 202 SEQ_printf(m, " next_event: %Ld nsecs\n",
diff --git a/kernel/timer.c b/kernel/timer.c
index 797cccb86431..dd6c2c1c561b 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -695,15 +695,28 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now,
695{ 695{
696 ktime_t hr_delta = hrtimer_get_next_event(); 696 ktime_t hr_delta = hrtimer_get_next_event();
697 struct timespec tsdelta; 697 struct timespec tsdelta;
698 unsigned long delta;
698 699
699 if (hr_delta.tv64 == KTIME_MAX) 700 if (hr_delta.tv64 == KTIME_MAX)
700 return expires; 701 return expires;
701 702
702 if (hr_delta.tv64 <= TICK_NSEC) 703 /*
703 return now; 704 * Expired timer available, let it expire in the next tick
705 */
706 if (hr_delta.tv64 <= 0)
707 return now + 1;
704 708
705 tsdelta = ktime_to_timespec(hr_delta); 709 tsdelta = ktime_to_timespec(hr_delta);
706 now += timespec_to_jiffies(&tsdelta); 710 delta = timespec_to_jiffies(&tsdelta);
711 /*
712 * Take rounding errors in to account and make sure, that it
713 * expires in the next tick. Otherwise we go into an endless
714 * ping pong due to tick_nohz_stop_sched_tick() retriggering
715 * the timer softirq
716 */
717 if (delta < 1)
718 delta = 1;
719 now += delta;
707 if (time_before(now, expires)) 720 if (time_before(now, expires))
708 return now; 721 return now;
709 return expires; 722 return expires;
@@ -1003,7 +1016,7 @@ static int timekeeping_resume(struct sys_device *dev)
1003 clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); 1016 clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
1004 1017
1005 /* Resume hrtimers */ 1018 /* Resume hrtimers */
1006 clock_was_set(); 1019 hres_timers_resume();
1007 1020
1008 return 0; 1021 return 0;
1009} 1022}
diff --git a/lib/kobject.c b/lib/kobject.c
index f4f6176dcd12..057921c5945a 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -385,9 +385,11 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
385 goto out; 385 goto out;
386 old_parent = kobj->parent; 386 old_parent = kobj->parent;
387 kobj->parent = new_parent; 387 kobj->parent = new_parent;
388 new_parent = NULL;
388 kobject_put(old_parent); 389 kobject_put(old_parent);
389 kobject_uevent_env(kobj, KOBJ_MOVE, envp); 390 kobject_uevent_env(kobj, KOBJ_MOVE, envp);
390out: 391out:
392 kobject_put(new_parent);
391 kobject_put(kobj); 393 kobject_put(kobj);
392 kfree(devpath_string); 394 kfree(devpath_string);
393 kfree(devpath); 395 kfree(devpath);
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index f50a2811f9dc..e5de3781d3fe 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -55,6 +55,22 @@ long congestion_wait(int rw, long timeout)
55} 55}
56EXPORT_SYMBOL(congestion_wait); 56EXPORT_SYMBOL(congestion_wait);
57 57
58long congestion_wait_interruptible(int rw, long timeout)
59{
60 long ret;
61 DEFINE_WAIT(wait);
62 wait_queue_head_t *wqh = &congestion_wqh[rw];
63
64 prepare_to_wait(wqh, &wait, TASK_INTERRUPTIBLE);
65 if (signal_pending(current))
66 ret = -ERESTARTSYS;
67 else
68 ret = io_schedule_timeout(timeout);
69 finish_wait(wqh, &wait);
70 return ret;
71}
72EXPORT_SYMBOL(congestion_wait_interruptible);
73
58/** 74/**
59 * congestion_end - wake up sleepers on a congested backing_dev_info 75 * congestion_end - wake up sleepers on a congested backing_dev_info
60 * @rw: READ or WRITE 76 * @rw: READ or WRITE
diff --git a/mm/bounce.c b/mm/bounce.c
index 643efbe82402..ad401fc57440 100644
--- a/mm/bounce.c
+++ b/mm/bounce.c
@@ -204,7 +204,7 @@ static void __blk_queue_bounce(request_queue_t *q, struct bio **bio_orig,
204 /* 204 /*
205 * is destination page below bounce pfn? 205 * is destination page below bounce pfn?
206 */ 206 */
207 if (page_to_pfn(page) < q->bounce_pfn) 207 if (page_to_pfn(page) <= q->bounce_pfn)
208 continue; 208 continue;
209 209
210 /* 210 /*
diff --git a/mm/filemap.c b/mm/filemap.c
index d1060b8d3cd6..5dfc093ceb3d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2379,7 +2379,8 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2379 struct file *file = iocb->ki_filp; 2379 struct file *file = iocb->ki_filp;
2380 struct address_space *mapping = file->f_mapping; 2380 struct address_space *mapping = file->f_mapping;
2381 ssize_t retval; 2381 ssize_t retval;
2382 size_t write_len = 0; 2382 size_t write_len;
2383 pgoff_t end = 0; /* silence gcc */
2383 2384
2384 /* 2385 /*
2385 * If it's a write, unmap all mmappings of the file up-front. This 2386 * If it's a write, unmap all mmappings of the file up-front. This
@@ -2388,23 +2389,46 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2388 */ 2389 */
2389 if (rw == WRITE) { 2390 if (rw == WRITE) {
2390 write_len = iov_length(iov, nr_segs); 2391 write_len = iov_length(iov, nr_segs);
2392 end = (offset + write_len - 1) >> PAGE_CACHE_SHIFT;
2391 if (mapping_mapped(mapping)) 2393 if (mapping_mapped(mapping))
2392 unmap_mapping_range(mapping, offset, write_len, 0); 2394 unmap_mapping_range(mapping, offset, write_len, 0);
2393 } 2395 }
2394 2396
2395 retval = filemap_write_and_wait(mapping); 2397 retval = filemap_write_and_wait(mapping);
2396 if (retval == 0) { 2398 if (retval)
2397 retval = mapping->a_ops->direct_IO(rw, iocb, iov, 2399 goto out;
2398 offset, nr_segs); 2400
2399 if (rw == WRITE && mapping->nrpages) { 2401 /*
2400 pgoff_t end = (offset + write_len - 1) 2402 * After a write we want buffered reads to be sure to go to disk to get
2401 >> PAGE_CACHE_SHIFT; 2403 * the new data. We invalidate clean cached page from the region we're
2402 int err = invalidate_inode_pages2_range(mapping, 2404 * about to write. We do this *before* the write so that we can return
2405 * -EIO without clobbering -EIOCBQUEUED from ->direct_IO().
2406 */
2407 if (rw == WRITE && mapping->nrpages) {
2408 retval = invalidate_inode_pages2_range(mapping,
2403 offset >> PAGE_CACHE_SHIFT, end); 2409 offset >> PAGE_CACHE_SHIFT, end);
2404 if (err) 2410 if (retval)
2405 retval = err; 2411 goto out;
2406 }
2407 } 2412 }
2413
2414 retval = mapping->a_ops->direct_IO(rw, iocb, iov, offset, nr_segs);
2415 if (retval)
2416 goto out;
2417
2418 /*
2419 * Finally, try again to invalidate clean pages which might have been
2420 * faulted in by get_user_pages() if the source of the write was an
2421 * mmap()ed region of the file we're writing. That's a pretty crazy
2422 * thing to do, so we don't support it 100%. If this invalidation
2423 * fails and we have -EIOCBQUEUED we ignore the failure.
2424 */
2425 if (rw == WRITE && mapping->nrpages) {
2426 int err = invalidate_inode_pages2_range(mapping,
2427 offset >> PAGE_CACHE_SHIFT, end);
2428 if (err && retval >= 0)
2429 retval = err;
2430 }
2431out:
2408 return retval; 2432 return retval;
2409} 2433}
2410 2434
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 9dd9fbb75139..cbb335813ec0 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -17,6 +17,29 @@
17#include "filemap.h" 17#include "filemap.h"
18 18
19/* 19/*
20 * We do use our own empty page to avoid interference with other users
21 * of ZERO_PAGE(), such as /dev/zero
22 */
23static struct page *__xip_sparse_page;
24
25static struct page *xip_sparse_page(void)
26{
27 if (!__xip_sparse_page) {
28 unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER);
29 if (zeroes) {
30 static DEFINE_SPINLOCK(xip_alloc_lock);
31 spin_lock(&xip_alloc_lock);
32 if (!__xip_sparse_page)
33 __xip_sparse_page = virt_to_page(zeroes);
34 else
35 free_page(zeroes);
36 spin_unlock(&xip_alloc_lock);
37 }
38 }
39 return __xip_sparse_page;
40}
41
42/*
20 * This is a file read routine for execute in place files, and uses 43 * This is a file read routine for execute in place files, and uses
21 * the mapping->a_ops->get_xip_page() function for the actual low-level 44 * the mapping->a_ops->get_xip_page() function for the actual low-level
22 * stuff. 45 * stuff.
@@ -162,7 +185,7 @@ EXPORT_SYMBOL_GPL(xip_file_sendfile);
162 * xip_write 185 * xip_write
163 * 186 *
164 * This function walks all vmas of the address_space and unmaps the 187 * This function walks all vmas of the address_space and unmaps the
165 * ZERO_PAGE when found at pgoff. Should it go in rmap.c? 188 * __xip_sparse_page when found at pgoff.
166 */ 189 */
167static void 190static void
168__xip_unmap (struct address_space * mapping, 191__xip_unmap (struct address_space * mapping,
@@ -177,13 +200,16 @@ __xip_unmap (struct address_space * mapping,
177 spinlock_t *ptl; 200 spinlock_t *ptl;
178 struct page *page; 201 struct page *page;
179 202
203 page = __xip_sparse_page;
204 if (!page)
205 return;
206
180 spin_lock(&mapping->i_mmap_lock); 207 spin_lock(&mapping->i_mmap_lock);
181 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) { 208 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
182 mm = vma->vm_mm; 209 mm = vma->vm_mm;
183 address = vma->vm_start + 210 address = vma->vm_start +
184 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); 211 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
185 BUG_ON(address < vma->vm_start || address >= vma->vm_end); 212 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
186 page = ZERO_PAGE(0);
187 pte = page_check_address(page, mm, address, &ptl); 213 pte = page_check_address(page, mm, address, &ptl);
188 if (pte) { 214 if (pte) {
189 /* Nuke the page table entry. */ 215 /* Nuke the page table entry. */
@@ -222,16 +248,14 @@ xip_file_nopage(struct vm_area_struct * area,
222 + area->vm_pgoff; 248 + area->vm_pgoff;
223 249
224 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 250 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
225 if (pgoff >= size) { 251 if (pgoff >= size)
226 return NULL; 252 return NOPAGE_SIGBUS;
227 }
228 253
229 page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0); 254 page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0);
230 if (!IS_ERR(page)) { 255 if (!IS_ERR(page))
231 goto out; 256 goto out;
232 }
233 if (PTR_ERR(page) != -ENODATA) 257 if (PTR_ERR(page) != -ENODATA)
234 return NULL; 258 return NOPAGE_SIGBUS;
235 259
236 /* sparse block */ 260 /* sparse block */
237 if ((area->vm_flags & (VM_WRITE | VM_MAYWRITE)) && 261 if ((area->vm_flags & (VM_WRITE | VM_MAYWRITE)) &&
@@ -241,12 +265,14 @@ xip_file_nopage(struct vm_area_struct * area,
241 page = mapping->a_ops->get_xip_page (mapping, 265 page = mapping->a_ops->get_xip_page (mapping,
242 pgoff*(PAGE_SIZE/512), 1); 266 pgoff*(PAGE_SIZE/512), 1);
243 if (IS_ERR(page)) 267 if (IS_ERR(page))
244 return NULL; 268 return NOPAGE_SIGBUS;
245 /* unmap page at pgoff from all other vmas */ 269 /* unmap page at pgoff from all other vmas */
246 __xip_unmap(mapping, pgoff); 270 __xip_unmap(mapping, pgoff);
247 } else { 271 } else {
248 /* not shared and writable, use ZERO_PAGE() */ 272 /* not shared and writable, use xip_sparse_page() */
249 page = ZERO_PAGE(0); 273 page = xip_sparse_page();
274 if (!page)
275 return NOPAGE_OOM;
250 } 276 }
251 277
252out: 278out:
diff --git a/mm/madvise.c b/mm/madvise.c
index 4e196155a0c3..603c5257ed6e 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -155,10 +155,14 @@ static long madvise_dontneed(struct vm_area_struct * vma,
155 * Other filesystems return -ENOSYS. 155 * Other filesystems return -ENOSYS.
156 */ 156 */
157static long madvise_remove(struct vm_area_struct *vma, 157static long madvise_remove(struct vm_area_struct *vma,
158 struct vm_area_struct **prev,
158 unsigned long start, unsigned long end) 159 unsigned long start, unsigned long end)
159{ 160{
160 struct address_space *mapping; 161 struct address_space *mapping;
161 loff_t offset, endoff; 162 loff_t offset, endoff;
163 int error;
164
165 *prev = NULL; /* tell sys_madvise we drop mmap_sem */
162 166
163 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) 167 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
164 return -EINVAL; 168 return -EINVAL;
@@ -177,7 +181,12 @@ static long madvise_remove(struct vm_area_struct *vma,
177 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 181 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
178 endoff = (loff_t)(end - vma->vm_start - 1) 182 endoff = (loff_t)(end - vma->vm_start - 1)
179 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 183 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
180 return vmtruncate_range(mapping->host, offset, endoff); 184
185 /* vmtruncate_range needs to take i_mutex and i_alloc_sem */
186 up_write(&current->mm->mmap_sem);
187 error = vmtruncate_range(mapping->host, offset, endoff);
188 down_write(&current->mm->mmap_sem);
189 return error;
181} 190}
182 191
183static long 192static long
@@ -199,7 +208,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
199 error = madvise_behavior(vma, prev, start, end, behavior); 208 error = madvise_behavior(vma, prev, start, end, behavior);
200 break; 209 break;
201 case MADV_REMOVE: 210 case MADV_REMOVE:
202 error = madvise_remove(vma, start, end); 211 error = madvise_remove(vma, prev, start, end);
203 break; 212 break;
204 213
205 case MADV_WILLNEED: 214 case MADV_WILLNEED:
@@ -312,12 +321,15 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
312 if (error) 321 if (error)
313 goto out; 322 goto out;
314 start = tmp; 323 start = tmp;
315 if (start < prev->vm_end) 324 if (prev && start < prev->vm_end)
316 start = prev->vm_end; 325 start = prev->vm_end;
317 error = unmapped_error; 326 error = unmapped_error;
318 if (start >= end) 327 if (start >= end)
319 goto out; 328 goto out;
320 vma = prev->vm_next; 329 if (prev)
330 vma = prev->vm_next;
331 else /* madvise_remove dropped mmap_sem */
332 vma = find_vma(current->mm, start);
321 } 333 }
322out: 334out:
323 up_write(&current->mm->mmap_sem); 335 up_write(&current->mm->mmap_sem);
diff --git a/mm/nommu.c b/mm/nommu.c
index 23fb033e596d..cbbc13774819 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -826,6 +826,11 @@ unsigned long do_mmap_pgoff(struct file *file,
826 unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; 826 unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
827 unsigned long vmpglen; 827 unsigned long vmpglen;
828 828
829 /* suppress VMA sharing for shared regions */
830 if (vm_flags & VM_SHARED &&
831 capabilities & BDI_CAP_MAP_DIRECT)
832 goto dont_share_VMAs;
833
829 for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) { 834 for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) {
830 vma = rb_entry(rb, struct vm_area_struct, vm_rb); 835 vma = rb_entry(rb, struct vm_area_struct, vm_rb);
831 836
@@ -859,6 +864,7 @@ unsigned long do_mmap_pgoff(struct file *file,
859 goto shared; 864 goto shared;
860 } 865 }
861 866
867 dont_share_VMAs:
862 vma = NULL; 868 vma = NULL;
863 869
864 /* obtain the address at which to make a shared mapping 870 /* obtain the address at which to make a shared mapping
@@ -1193,6 +1199,28 @@ void unmap_mapping_range(struct address_space *mapping,
1193EXPORT_SYMBOL(unmap_mapping_range); 1199EXPORT_SYMBOL(unmap_mapping_range);
1194 1200
1195/* 1201/*
1202 * ask for an unmapped area at which to create a mapping on a file
1203 */
1204unsigned long get_unmapped_area(struct file *file, unsigned long addr,
1205 unsigned long len, unsigned long pgoff,
1206 unsigned long flags)
1207{
1208 unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
1209 unsigned long, unsigned long);
1210
1211 get_area = current->mm->get_unmapped_area;
1212 if (file && file->f_op && file->f_op->get_unmapped_area)
1213 get_area = file->f_op->get_unmapped_area;
1214
1215 if (!get_area)
1216 return -ENOSYS;
1217
1218 return get_area(file, addr, len, pgoff, flags);
1219}
1220
1221EXPORT_SYMBOL(get_unmapped_area);
1222
1223/*
1196 * Check that a process has enough memory to allocate a new virtual 1224 * Check that a process has enough memory to allocate a new virtual
1197 * mapping. 0 means there is enough memory for the allocation to 1225 * mapping. 0 means there is enough memory for the allocation to
1198 * succeed and -ENOMEM implies there is not. 1226 * succeed and -ENOMEM implies there is not.
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index b278b8d60eee..2f3916986abf 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -320,7 +320,7 @@ static int oom_kill_task(struct task_struct *p)
320 * Don't kill the process if any threads are set to OOM_DISABLE 320 * Don't kill the process if any threads are set to OOM_DISABLE
321 */ 321 */
322 do_each_thread(g, q) { 322 do_each_thread(g, q) {
323 if (q->mm == mm && p->oomkilladj == OOM_DISABLE) 323 if (q->mm == mm && q->oomkilladj == OOM_DISABLE)
324 return 1; 324 return 1;
325 } while_each_thread(g, q); 325 } while_each_thread(g, q);
326 326
diff --git a/mm/rmap.c b/mm/rmap.c
index 22ed3f71a674..b82146e6dfc9 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -498,9 +498,9 @@ int page_mkclean(struct page *page)
498 struct address_space *mapping = page_mapping(page); 498 struct address_space *mapping = page_mapping(page);
499 if (mapping) 499 if (mapping)
500 ret = page_mkclean_file(mapping, page); 500 ret = page_mkclean_file(mapping, page);
501 if (page_test_and_clear_dirty(page))
502 ret = 1;
501 } 503 }
502 if (page_test_and_clear_dirty(page))
503 ret = 1;
504 504
505 return ret; 505 return ret;
506} 506}
diff --git a/mm/shmem.c b/mm/shmem.c
index b8c429a2d271..b2a35ebf071a 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -402,26 +402,38 @@ static swp_entry_t *shmem_swp_alloc(struct shmem_inode_info *info, unsigned long
402/* 402/*
403 * shmem_free_swp - free some swap entries in a directory 403 * shmem_free_swp - free some swap entries in a directory
404 * 404 *
405 * @dir: pointer to the directory 405 * @dir: pointer to the directory
406 * @edir: pointer after last entry of the directory 406 * @edir: pointer after last entry of the directory
407 * @punch_lock: pointer to spinlock when needed for the holepunch case
407 */ 408 */
408static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir) 409static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir,
410 spinlock_t *punch_lock)
409{ 411{
412 spinlock_t *punch_unlock = NULL;
410 swp_entry_t *ptr; 413 swp_entry_t *ptr;
411 int freed = 0; 414 int freed = 0;
412 415
413 for (ptr = dir; ptr < edir; ptr++) { 416 for (ptr = dir; ptr < edir; ptr++) {
414 if (ptr->val) { 417 if (ptr->val) {
418 if (unlikely(punch_lock)) {
419 punch_unlock = punch_lock;
420 punch_lock = NULL;
421 spin_lock(punch_unlock);
422 if (!ptr->val)
423 continue;
424 }
415 free_swap_and_cache(*ptr); 425 free_swap_and_cache(*ptr);
416 *ptr = (swp_entry_t){0}; 426 *ptr = (swp_entry_t){0};
417 freed++; 427 freed++;
418 } 428 }
419 } 429 }
430 if (punch_unlock)
431 spin_unlock(punch_unlock);
420 return freed; 432 return freed;
421} 433}
422 434
423static int shmem_map_and_free_swp(struct page *subdir, 435static int shmem_map_and_free_swp(struct page *subdir, int offset,
424 int offset, int limit, struct page ***dir) 436 int limit, struct page ***dir, spinlock_t *punch_lock)
425{ 437{
426 swp_entry_t *ptr; 438 swp_entry_t *ptr;
427 int freed = 0; 439 int freed = 0;
@@ -431,7 +443,8 @@ static int shmem_map_and_free_swp(struct page *subdir,
431 int size = limit - offset; 443 int size = limit - offset;
432 if (size > LATENCY_LIMIT) 444 if (size > LATENCY_LIMIT)
433 size = LATENCY_LIMIT; 445 size = LATENCY_LIMIT;
434 freed += shmem_free_swp(ptr+offset, ptr+offset+size); 446 freed += shmem_free_swp(ptr+offset, ptr+offset+size,
447 punch_lock);
435 if (need_resched()) { 448 if (need_resched()) {
436 shmem_swp_unmap(ptr); 449 shmem_swp_unmap(ptr);
437 if (*dir) { 450 if (*dir) {
@@ -481,7 +494,10 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
481 long nr_swaps_freed = 0; 494 long nr_swaps_freed = 0;
482 int offset; 495 int offset;
483 int freed; 496 int freed;
484 int punch_hole = 0; 497 int punch_hole;
498 spinlock_t *needs_lock;
499 spinlock_t *punch_lock;
500 unsigned long upper_limit;
485 501
486 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 502 inode->i_ctime = inode->i_mtime = CURRENT_TIME;
487 idx = (start + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 503 idx = (start + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
@@ -492,11 +508,20 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
492 info->flags |= SHMEM_TRUNCATE; 508 info->flags |= SHMEM_TRUNCATE;
493 if (likely(end == (loff_t) -1)) { 509 if (likely(end == (loff_t) -1)) {
494 limit = info->next_index; 510 limit = info->next_index;
511 upper_limit = SHMEM_MAX_INDEX;
495 info->next_index = idx; 512 info->next_index = idx;
513 needs_lock = NULL;
514 punch_hole = 0;
496 } else { 515 } else {
497 limit = (end + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 516 if (end + 1 >= inode->i_size) { /* we may free a little more */
498 if (limit > info->next_index) 517 limit = (inode->i_size + PAGE_CACHE_SIZE - 1) >>
499 limit = info->next_index; 518 PAGE_CACHE_SHIFT;
519 upper_limit = SHMEM_MAX_INDEX;
520 } else {
521 limit = (end + 1) >> PAGE_CACHE_SHIFT;
522 upper_limit = limit;
523 }
524 needs_lock = &info->lock;
500 punch_hole = 1; 525 punch_hole = 1;
501 } 526 }
502 527
@@ -513,17 +538,30 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
513 size = limit; 538 size = limit;
514 if (size > SHMEM_NR_DIRECT) 539 if (size > SHMEM_NR_DIRECT)
515 size = SHMEM_NR_DIRECT; 540 size = SHMEM_NR_DIRECT;
516 nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size); 541 nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size, needs_lock);
517 } 542 }
518 543
519 /* 544 /*
520 * If there are no indirect blocks or we are punching a hole 545 * If there are no indirect blocks or we are punching a hole
521 * below indirect blocks, nothing to be done. 546 * below indirect blocks, nothing to be done.
522 */ 547 */
523 if (!topdir || (punch_hole && (limit <= SHMEM_NR_DIRECT))) 548 if (!topdir || limit <= SHMEM_NR_DIRECT)
524 goto done2; 549 goto done2;
525 550
526 BUG_ON(limit <= SHMEM_NR_DIRECT); 551 /*
552 * The truncation case has already dropped info->lock, and we're safe
553 * because i_size and next_index have already been lowered, preventing
554 * access beyond. But in the punch_hole case, we still need to take
555 * the lock when updating the swap directory, because there might be
556 * racing accesses by shmem_getpage(SGP_CACHE), shmem_unuse_inode or
557 * shmem_writepage. However, whenever we find we can remove a whole
558 * directory page (not at the misaligned start or end of the range),
559 * we first NULLify its pointer in the level above, and then have no
560 * need to take the lock when updating its contents: needs_lock and
561 * punch_lock (either pointing to info->lock or NULL) manage this.
562 */
563
564 upper_limit -= SHMEM_NR_DIRECT;
527 limit -= SHMEM_NR_DIRECT; 565 limit -= SHMEM_NR_DIRECT;
528 idx = (idx > SHMEM_NR_DIRECT)? (idx - SHMEM_NR_DIRECT): 0; 566 idx = (idx > SHMEM_NR_DIRECT)? (idx - SHMEM_NR_DIRECT): 0;
529 offset = idx % ENTRIES_PER_PAGE; 567 offset = idx % ENTRIES_PER_PAGE;
@@ -543,8 +581,14 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
543 if (*dir) { 581 if (*dir) {
544 diroff = ((idx - ENTRIES_PER_PAGEPAGE/2) % 582 diroff = ((idx - ENTRIES_PER_PAGEPAGE/2) %
545 ENTRIES_PER_PAGEPAGE) / ENTRIES_PER_PAGE; 583 ENTRIES_PER_PAGEPAGE) / ENTRIES_PER_PAGE;
546 if (!diroff && !offset) { 584 if (!diroff && !offset && upper_limit >= stage) {
547 *dir = NULL; 585 if (needs_lock) {
586 spin_lock(needs_lock);
587 *dir = NULL;
588 spin_unlock(needs_lock);
589 needs_lock = NULL;
590 } else
591 *dir = NULL;
548 nr_pages_to_free++; 592 nr_pages_to_free++;
549 list_add(&middir->lru, &pages_to_free); 593 list_add(&middir->lru, &pages_to_free);
550 } 594 }
@@ -570,39 +614,55 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
570 } 614 }
571 stage = idx + ENTRIES_PER_PAGEPAGE; 615 stage = idx + ENTRIES_PER_PAGEPAGE;
572 middir = *dir; 616 middir = *dir;
573 *dir = NULL; 617 if (punch_hole)
574 nr_pages_to_free++; 618 needs_lock = &info->lock;
575 list_add(&middir->lru, &pages_to_free); 619 if (upper_limit >= stage) {
620 if (needs_lock) {
621 spin_lock(needs_lock);
622 *dir = NULL;
623 spin_unlock(needs_lock);
624 needs_lock = NULL;
625 } else
626 *dir = NULL;
627 nr_pages_to_free++;
628 list_add(&middir->lru, &pages_to_free);
629 }
576 shmem_dir_unmap(dir); 630 shmem_dir_unmap(dir);
577 cond_resched(); 631 cond_resched();
578 dir = shmem_dir_map(middir); 632 dir = shmem_dir_map(middir);
579 diroff = 0; 633 diroff = 0;
580 } 634 }
635 punch_lock = needs_lock;
581 subdir = dir[diroff]; 636 subdir = dir[diroff];
582 if (subdir && page_private(subdir)) { 637 if (subdir && !offset && upper_limit-idx >= ENTRIES_PER_PAGE) {
638 if (needs_lock) {
639 spin_lock(needs_lock);
640 dir[diroff] = NULL;
641 spin_unlock(needs_lock);
642 punch_lock = NULL;
643 } else
644 dir[diroff] = NULL;
645 nr_pages_to_free++;
646 list_add(&subdir->lru, &pages_to_free);
647 }
648 if (subdir && page_private(subdir) /* has swap entries */) {
583 size = limit - idx; 649 size = limit - idx;
584 if (size > ENTRIES_PER_PAGE) 650 if (size > ENTRIES_PER_PAGE)
585 size = ENTRIES_PER_PAGE; 651 size = ENTRIES_PER_PAGE;
586 freed = shmem_map_and_free_swp(subdir, 652 freed = shmem_map_and_free_swp(subdir,
587 offset, size, &dir); 653 offset, size, &dir, punch_lock);
588 if (!dir) 654 if (!dir)
589 dir = shmem_dir_map(middir); 655 dir = shmem_dir_map(middir);
590 nr_swaps_freed += freed; 656 nr_swaps_freed += freed;
591 if (offset) 657 if (offset || punch_lock) {
592 spin_lock(&info->lock); 658 spin_lock(&info->lock);
593 set_page_private(subdir, page_private(subdir) - freed); 659 set_page_private(subdir,
594 if (offset) 660 page_private(subdir) - freed);
595 spin_unlock(&info->lock); 661 spin_unlock(&info->lock);
596 if (!punch_hole) 662 } else
597 BUG_ON(page_private(subdir) > offset); 663 BUG_ON(page_private(subdir) != freed);
598 }
599 if (offset)
600 offset = 0;
601 else if (subdir && !page_private(subdir)) {
602 dir[diroff] = NULL;
603 nr_pages_to_free++;
604 list_add(&subdir->lru, &pages_to_free);
605 } 664 }
665 offset = 0;
606 } 666 }
607done1: 667done1:
608 shmem_dir_unmap(dir); 668 shmem_dir_unmap(dir);
@@ -614,8 +674,16 @@ done2:
614 * generic_delete_inode did it, before we lowered next_index. 674 * generic_delete_inode did it, before we lowered next_index.
615 * Also, though shmem_getpage checks i_size before adding to 675 * Also, though shmem_getpage checks i_size before adding to
616 * cache, no recheck after: so fix the narrow window there too. 676 * cache, no recheck after: so fix the narrow window there too.
677 *
678 * Recalling truncate_inode_pages_range and unmap_mapping_range
679 * every time for punch_hole (which never got a chance to clear
680 * SHMEM_PAGEIN at the start of vmtruncate_range) is expensive,
681 * yet hardly ever necessary: try to optimize them out later.
617 */ 682 */
618 truncate_inode_pages_range(inode->i_mapping, start, end); 683 truncate_inode_pages_range(inode->i_mapping, start, end);
684 if (punch_hole)
685 unmap_mapping_range(inode->i_mapping, start,
686 end - start, 1);
619 } 687 }
620 688
621 spin_lock(&info->lock); 689 spin_lock(&info->lock);
diff --git a/mm/slab.c b/mm/slab.c
index 57f7aa420064..4cbac24ae2f1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1802,8 +1802,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
1802 /* Print header */ 1802 /* Print header */
1803 if (lines == 0) { 1803 if (lines == 0) {
1804 printk(KERN_ERR 1804 printk(KERN_ERR
1805 "Slab corruption: start=%p, len=%d\n", 1805 "Slab corruption: %s start=%p, len=%d\n",
1806 realobj, size); 1806 cachep->name, realobj, size);
1807 print_objinfo(cachep, objp, 0); 1807 print_objinfo(cachep, objp, 0);
1808 } 1808 }
1809 /* Hexdump the affected line */ 1809 /* Hexdump the affected line */
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 113c175f1715..c8b7dc2c3257 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1417,10 +1417,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1417 /* 1417 /*
1418 * Size check to see if ddp->deh_len was crap 1418 * Size check to see if ddp->deh_len was crap
1419 * (Otherwise we'll detonate most spectacularly 1419 * (Otherwise we'll detonate most spectacularly
1420 * in the middle of recvmsg()). 1420 * in the middle of atalk_checksum() or recvmsg()).
1421 */ 1421 */
1422 if (skb->len < sizeof(*ddp)) 1422 if (skb->len < sizeof(*ddp) || skb->len < (len_hops & 1023)) {
1423 pr_debug("AppleTalk: dropping corrupted frame (deh_len=%u, "
1424 "skb->len=%u)\n", len_hops & 1023, skb->len);
1423 goto freeit; 1425 goto freeit;
1426 }
1424 1427
1425 /* 1428 /*
1426 * Any checksums. Note we don't do htons() on this == is assumed to be 1429 * Any checksums. Note we don't do htons() on this == is assumed to be
diff --git a/net/atm/clip.c b/net/atm/clip.c
index ebb5d0ce8b6f..8c3825816085 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -261,14 +261,6 @@ static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
261 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags); 261 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags);
262} 262}
263 263
264static void clip_neigh_destroy(struct neighbour *neigh)
265{
266 DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh);
267 if (NEIGH2ENTRY(neigh)->vccs)
268 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n");
269 NEIGH2ENTRY(neigh)->vccs = (void *) NEIGHBOR_DEAD;
270}
271
272static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb) 264static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
273{ 265{
274 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb); 266 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb);
@@ -342,7 +334,6 @@ static struct neigh_table clip_tbl = {
342 /* parameters are copied from ARP ... */ 334 /* parameters are copied from ARP ... */
343 .parms = { 335 .parms = {
344 .tbl = &clip_tbl, 336 .tbl = &clip_tbl,
345 .neigh_destructor = clip_neigh_destroy,
346 .base_reachable_time = 30 * HZ, 337 .base_reachable_time = 30 * HZ,
347 .retrans_time = 1 * HZ, 338 .retrans_time = 1 * HZ,
348 .gc_staletime = 60 * HZ, 339 .gc_staletime = 60 * HZ,
diff --git a/net/ax25/Kconfig b/net/ax25/Kconfig
index a8993a041724..43dd86fca4d3 100644
--- a/net/ax25/Kconfig
+++ b/net/ax25/Kconfig
@@ -1,30 +1,27 @@
1# 1#
2# Amateur Radio protocols and AX.25 device configuration 2# Amateur Radio protocols and AX.25 device configuration
3# 3#
4# 19971130 Now in an own category to make correct compilation of the
5# AX.25 stuff easier...
6# Joerg Reuter DL1BKE <jreuter@yaina.de>
7# 19980129 Moved to net/ax25/Config.in, sourcing device drivers.
8 4
9menuconfig HAMRADIO 5menuconfig HAMRADIO
10 depends on NET 6 depends on NET
11 bool "Amateur Radio support" 7 bool "Amateur Radio support"
12 help 8 help
13 If you want to connect your Linux box to an amateur radio, answer Y 9 If you want to connect your Linux box to an amateur radio, answer Y
14 here. You want to read <http://www.tapr.org/tapr/html/pkthome.html> and 10 here. You want to read <http://www.tapr.org/tapr/html/pkthome.html>
15 the AX25-HOWTO, available from <http://www.tldp.org/docs.html#howto>. 11 and more specifically about AX.25 on Linux
12 <http://www.linux-ax25.org/>.
16 13
17 Note that the answer to this question won't directly affect the 14 Note that the answer to this question won't directly affect the
18 kernel: saying N will just cause the configurator to skip all 15 kernel: saying N will just cause the configurator to skip all
19 the questions about amateur radio. 16 the questions about amateur radio.
20 17
21comment "Packet Radio protocols" 18comment "Packet Radio protocols"
22 depends on HAMRADIO && NET 19 depends on HAMRADIO
23 20
24config AX25 21config AX25
25 tristate "Amateur Radio AX.25 Level 2 protocol" 22 tristate "Amateur Radio AX.25 Level 2 protocol"
26 depends on HAMRADIO && NET 23 depends on HAMRADIO
27 ---help--- 24 help
28 This is the protocol used for computer communication over amateur 25 This is the protocol used for computer communication over amateur
29 radio. It is either used by itself for point-to-point links, or to 26 radio. It is either used by itself for point-to-point links, or to
30 carry other protocols such as tcp/ip. To use it, you need a device 27 carry other protocols such as tcp/ip. To use it, you need a device
@@ -52,6 +49,7 @@ config AX25
52 49
53config AX25_DAMA_SLAVE 50config AX25_DAMA_SLAVE
54 bool "AX.25 DAMA Slave support" 51 bool "AX.25 DAMA Slave support"
52 default y
55 depends on AX25 53 depends on AX25
56 help 54 help
57 DAMA is a mechanism to prevent collisions when doing AX.25 55 DAMA is a mechanism to prevent collisions when doing AX.25
@@ -59,23 +57,38 @@ config AX25_DAMA_SLAVE
59 from clients (called "slaves") and redistributes it to other slaves. 57 from clients (called "slaves") and redistributes it to other slaves.
60 If you say Y here, your Linux box will act as a DAMA slave; this is 58 If you say Y here, your Linux box will act as a DAMA slave; this is
61 transparent in that you don't have to do any special DAMA 59 transparent in that you don't have to do any special DAMA
62 configuration. (Linux cannot yet act as a DAMA server.) If unsure, 60 configuration. Linux cannot yet act as a DAMA server. This option
63 say N. 61 only compiles DAMA slave support into the kernel. It still needs to
62 be enabled at runtime. For more about DAMA see
63 <http://www.linux-ax25.org>. If unsure, say Y.
64
65# placeholder until implemented
66config AX25_DAMA_MASTER
67 bool 'AX.25 DAMA Master support'
68 depends on AX25_DAMA_SLAVE && BROKEN
69 help
70 DAMA is a mechanism to prevent collisions when doing AX.25
71 networking. A DAMA server (called "master") accepts incoming traffic
72 from clients (called "slaves") and redistributes it to other slaves.
73 If you say Y here, your Linux box will act as a DAMA master; this is
74 transparent in that you don't have to do any special DAMA
75 configuration. Linux cannot yet act as a DAMA server. This option
76 only compiles DAMA slave support into the kernel. It still needs to
77 be explicitly enabled, so if unsure, say Y.
64 78
65# bool ' AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER
66config NETROM 79config NETROM
67 tristate "Amateur Radio NET/ROM protocol" 80 tristate "Amateur Radio NET/ROM protocol"
68 depends on AX25 81 depends on AX25
69 ---help--- 82 help
70 NET/ROM is a network layer protocol on top of AX.25 useful for 83 NET/ROM is a network layer protocol on top of AX.25 useful for
71 routing. 84 routing.
72 85
73 A comprehensive listing of all the software for Linux amateur radio 86 A comprehensive listing of all the software for Linux amateur radio
74 users as well as information about how to configure an AX.25 port is 87 users as well as information about how to configure an AX.25 port is
75 contained in the AX25-HOWTO, available from 88 contained in the Linux Ham Wiki, available from
76 <http://www.tldp.org/docs.html#howto>. You also might want to 89 <http://www.linux-ax25.org>. You also might want to check out the
77 check out the file <file:Documentation/networking/ax25.txt>. More 90 file <file:Documentation/networking/ax25.txt>. More information about
78 information about digital amateur radio in general is on the WWW at 91 digital amateur radio in general is on the WWW at
79 <http://www.tapr.org/tapr/html/pkthome.html>. 92 <http://www.tapr.org/tapr/html/pkthome.html>.
80 93
81 To compile this driver as a module, choose M here: the 94 To compile this driver as a module, choose M here: the
@@ -84,27 +97,25 @@ config NETROM
84config ROSE 97config ROSE
85 tristate "Amateur Radio X.25 PLP (Rose)" 98 tristate "Amateur Radio X.25 PLP (Rose)"
86 depends on AX25 99 depends on AX25
87 ---help--- 100 help
88 The Packet Layer Protocol (PLP) is a way to route packets over X.25 101 The Packet Layer Protocol (PLP) is a way to route packets over X.25
89 connections in general and amateur radio AX.25 connections in 102 connections in general and amateur radio AX.25 connections in
90 particular, essentially an alternative to NET/ROM. 103 particular, essentially an alternative to NET/ROM.
91 104
92 A comprehensive listing of all the software for Linux amateur radio 105 A comprehensive listing of all the software for Linux amateur radio
93 users as well as information about how to configure an AX.25 port is 106 users as well as information about how to configure an AX.25 port is
94 contained in the AX25-HOWTO, available from 107 contained in the Linux Ham Wiki, available from
95 <http://www.tldp.org/docs.html#howto>. You also might want to 108 <http://www.linux-ax25.org>. You also might want to check out the
96 check out the file <file:Documentation/networking/ax25.txt>. More 109 file <file:Documentation/networking/ax25.txt>. More information about
97 information about digital amateur radio in general is on the WWW at 110 digital amateur radio in general is on the WWW at
98 <http://www.tapr.org/tapr/html/pkthome.html>. 111 <http://www.tapr.org/tapr/html/pkthome.html>.
99 112
100 To compile this driver as a module, choose M here: the 113 To compile this driver as a module, choose M here: the
101 module will be called rose. 114 module will be called rose.
102 115
103
104menu "AX.25 network device drivers" 116menu "AX.25 network device drivers"
105 depends on HAMRADIO && NET && AX25!=n 117 depends on HAMRADIO && AX25
106 118
107source "drivers/net/hamradio/Kconfig" 119source "drivers/net/hamradio/Kconfig"
108 120
109endmenu 121endmenu
110
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index f928d2b2a17d..71f5cfbbebb8 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -656,7 +656,7 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
656 /* Detach sockets from device */ 656 /* Detach sockets from device */
657 read_lock(&hci_sk_list.lock); 657 read_lock(&hci_sk_list.lock);
658 sk_for_each(sk, node, &hci_sk_list.head) { 658 sk_for_each(sk, node, &hci_sk_list.head) {
659 bh_lock_sock(sk); 659 lock_sock(sk);
660 if (hci_pi(sk)->hdev == hdev) { 660 if (hci_pi(sk)->hdev == hdev) {
661 hci_pi(sk)->hdev = NULL; 661 hci_pi(sk)->hdev = NULL;
662 sk->sk_err = EPIPE; 662 sk->sk_err = EPIPE;
@@ -665,7 +665,7 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
665 665
666 hci_dev_put(hdev); 666 hci_dev_put(hdev);
667 } 667 }
668 bh_unlock_sock(sk); 668 release_sock(sk);
669 } 669 }
670 read_unlock(&hci_sk_list.lock); 670 read_unlock(&hci_sk_list.lock);
671 } 671 }
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 4c914df5fd06..d342e89b8bdd 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -319,7 +319,7 @@ static int __hidp_send_ctrl_message(struct hidp_session *session,
319 return 0; 319 return 0;
320} 320}
321 321
322static int inline hidp_send_ctrl_message(struct hidp_session *session, 322static inline int hidp_send_ctrl_message(struct hidp_session *session,
323 unsigned char hdr, unsigned char *data, int size) 323 unsigned char hdr, unsigned char *data, int size)
324{ 324{
325 int err; 325 int err;
@@ -679,6 +679,27 @@ static void hidp_close(struct hid_device *hid)
679{ 679{
680} 680}
681 681
682static const struct {
683 __u16 idVendor;
684 __u16 idProduct;
685 unsigned quirks;
686} hidp_blacklist[] = {
687 /* Apple wireless Mighty Mouse */
688 { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
689
690 { } /* Terminating entry */
691};
692
693static void hidp_setup_quirks(struct hid_device *hid)
694{
695 unsigned int n;
696
697 for (n = 0; hidp_blacklist[n].idVendor; n++)
698 if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) &&
699 hidp_blacklist[n].idProduct == le16_to_cpu(hid->product))
700 hid->quirks = hidp_blacklist[n].quirks;
701}
702
682static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_connadd_req *req) 703static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_connadd_req *req)
683{ 704{
684 struct hid_device *hid = session->hid; 705 struct hid_device *hid = session->hid;
@@ -708,6 +729,8 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn
708 729
709 hid->hidinput_input_event = hidp_hidinput_event; 730 hid->hidinput_input_event = hidp_hidinput_event;
710 731
732 hidp_setup_quirks(hid);
733
711 list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) 734 list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
712 hidp_send_report(session, report); 735 hidp_send_report(session, report);
713 736
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index def2e403f932..8d566c13cc73 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -197,8 +197,8 @@ struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
197 197
198 rcu_read_lock(); 198 rcu_read_lock();
199 fdb = __br_fdb_get(br, addr); 199 fdb = __br_fdb_get(br, addr);
200 if (fdb) 200 if (fdb && !atomic_inc_not_zero(&fdb->use_count))
201 atomic_inc(&fdb->use_count); 201 fdb = NULL;
202 rcu_read_unlock(); 202 rcu_read_unlock();
203 return fdb; 203 return fdb;
204} 204}
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 6845a258408f..f3a2e29be40c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -428,6 +428,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
428 spin_lock_bh(&br->lock); 428 spin_lock_bh(&br->lock);
429 br_stp_recalculate_bridge_id(br); 429 br_stp_recalculate_bridge_id(br);
430 br_features_recompute(br); 430 br_features_recompute(br);
431
432 if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&
433 (br->dev->flags & IFF_UP))
434 br_stp_enable_port(p);
431 spin_unlock_bh(&br->lock); 435 spin_unlock_bh(&br->lock);
432 436
433 dev_set_mtu(br->dev, br_min_mtu(br)); 437 dev_set_mtu(br->dev, br_min_mtu(br));
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 7712d76f06ba..5439a3c46c3e 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -61,7 +61,7 @@ static int brnf_filter_vlan_tagged __read_mostly = 1;
61#define brnf_filter_vlan_tagged 1 61#define brnf_filter_vlan_tagged 1
62#endif 62#endif
63 63
64static __be16 inline vlan_proto(const struct sk_buff *skb) 64static inline __be16 vlan_proto(const struct sk_buff *skb)
65{ 65{
66 return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; 66 return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
67} 67}
diff --git a/net/core/dev.c b/net/core/dev.c
index cf71614dae93..4dc93cc4d5b7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -751,13 +751,10 @@ int dev_change_name(struct net_device *dev, char *newname)
751 else 751 else
752 strlcpy(dev->name, newname, IFNAMSIZ); 752 strlcpy(dev->name, newname, IFNAMSIZ);
753 753
754 err = device_rename(&dev->dev, dev->name); 754 device_rename(&dev->dev, dev->name);
755 if (!err) { 755 hlist_del(&dev->name_hlist);
756 hlist_del(&dev->name_hlist); 756 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
757 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); 757 raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
758 raw_notifier_call_chain(&netdev_chain,
759 NETDEV_CHANGENAME, dev);
760 }
761 758
762 return err; 759 return err;
763} 760}
@@ -1741,8 +1738,8 @@ static int ing_filter(struct sk_buff *skb)
1741 if (dev->qdisc_ingress) { 1738 if (dev->qdisc_ingress) {
1742 __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); 1739 __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
1743 if (MAX_RED_LOOP < ttl++) { 1740 if (MAX_RED_LOOP < ttl++) {
1744 printk(KERN_WARNING "Redir loop detected Dropping packet (%s->%s)\n", 1741 printk(KERN_WARNING "Redir loop detected Dropping packet (%d->%d)\n",
1745 skb->input_dev->name, skb->dev->name); 1742 skb->iif, skb->dev->ifindex);
1746 return TC_ACT_SHOT; 1743 return TC_ACT_SHOT;
1747 } 1744 }
1748 1745
@@ -1750,10 +1747,10 @@ static int ing_filter(struct sk_buff *skb)
1750 1747
1751 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS); 1748 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS);
1752 1749
1753 spin_lock(&dev->ingress_lock); 1750 spin_lock(&dev->queue_lock);
1754 if ((q = dev->qdisc_ingress) != NULL) 1751 if ((q = dev->qdisc_ingress) != NULL)
1755 result = q->enqueue(skb, q); 1752 result = q->enqueue(skb, q);
1756 spin_unlock(&dev->ingress_lock); 1753 spin_unlock(&dev->queue_lock);
1757 1754
1758 } 1755 }
1759 1756
@@ -1775,8 +1772,8 @@ int netif_receive_skb(struct sk_buff *skb)
1775 if (!skb->tstamp.off_sec) 1772 if (!skb->tstamp.off_sec)
1776 net_timestamp(skb); 1773 net_timestamp(skb);
1777 1774
1778 if (!skb->input_dev) 1775 if (!skb->iif)
1779 skb->input_dev = skb->dev; 1776 skb->iif = skb->dev->ifindex;
1780 1777
1781 orig_dev = skb_bond(skb); 1778 orig_dev = skb_bond(skb);
1782 1779
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 215f1bff048f..7174ced75efc 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -143,7 +143,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
143 } 143 }
144 } 144 }
145 145
146 err = -ENETUNREACH; 146 err = -ESRCH;
147out: 147out:
148 rcu_read_unlock(); 148 rcu_read_unlock();
149 149
@@ -152,6 +152,28 @@ out:
152 152
153EXPORT_SYMBOL_GPL(fib_rules_lookup); 153EXPORT_SYMBOL_GPL(fib_rules_lookup);
154 154
155static int validate_rulemsg(struct fib_rule_hdr *frh, struct nlattr **tb,
156 struct fib_rules_ops *ops)
157{
158 int err = -EINVAL;
159
160 if (frh->src_len)
161 if (tb[FRA_SRC] == NULL ||
162 frh->src_len > (ops->addr_size * 8) ||
163 nla_len(tb[FRA_SRC]) != ops->addr_size)
164 goto errout;
165
166 if (frh->dst_len)
167 if (tb[FRA_DST] == NULL ||
168 frh->dst_len > (ops->addr_size * 8) ||
169 nla_len(tb[FRA_DST]) != ops->addr_size)
170 goto errout;
171
172 err = 0;
173errout:
174 return err;
175}
176
155int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 177int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
156{ 178{
157 struct fib_rule_hdr *frh = nlmsg_data(nlh); 179 struct fib_rule_hdr *frh = nlmsg_data(nlh);
@@ -173,6 +195,10 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
173 if (err < 0) 195 if (err < 0)
174 goto errout; 196 goto errout;
175 197
198 err = validate_rulemsg(frh, tb, ops);
199 if (err < 0)
200 goto errout;
201
176 rule = kzalloc(ops->rule_size, GFP_KERNEL); 202 rule = kzalloc(ops->rule_size, GFP_KERNEL);
177 if (rule == NULL) { 203 if (rule == NULL) {
178 err = -ENOMEM; 204 err = -ENOMEM;
@@ -260,6 +286,10 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
260 if (err < 0) 286 if (err < 0)
261 goto errout; 287 goto errout;
262 288
289 err = validate_rulemsg(frh, tb, ops);
290 if (err < 0)
291 goto errout;
292
263 list_for_each_entry(rule, ops->rules_list, list) { 293 list_for_each_entry(rule, ops->rules_list, list) {
264 if (frh->action && (frh->action != rule->action)) 294 if (frh->action && (frh->action != rule->action))
265 continue; 295 continue;
@@ -374,7 +404,7 @@ int fib_rules_dump(struct sk_buff *skb, struct netlink_callback *cb, int family)
374 return -EAFNOSUPPORT; 404 return -EAFNOSUPPORT;
375 405
376 rcu_read_lock(); 406 rcu_read_lock();
377 list_for_each_entry(rule, ops->rules_list, list) { 407 list_for_each_entry_rcu(rule, ops->rules_list, list) {
378 if (idx < cb->args[0]) 408 if (idx < cb->args[0])
379 goto skip; 409 goto skip;
380 410
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 3183142c6044..cfc60019cf92 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -140,6 +140,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
140 n->dead = 1; 140 n->dead = 1;
141 shrunk = 1; 141 shrunk = 1;
142 write_unlock(&n->lock); 142 write_unlock(&n->lock);
143 if (n->parms->neigh_cleanup)
144 n->parms->neigh_cleanup(n);
143 neigh_release(n); 145 neigh_release(n);
144 continue; 146 continue;
145 } 147 }
@@ -211,6 +213,8 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
211 NEIGH_PRINTK2("neigh %p is stray.\n", n); 213 NEIGH_PRINTK2("neigh %p is stray.\n", n);
212 } 214 }
213 write_unlock(&n->lock); 215 write_unlock(&n->lock);
216 if (n->parms->neigh_cleanup)
217 n->parms->neigh_cleanup(n);
214 neigh_release(n); 218 neigh_release(n);
215 } 219 }
216 } 220 }
@@ -582,9 +586,6 @@ void neigh_destroy(struct neighbour *neigh)
582 kfree(hh); 586 kfree(hh);
583 } 587 }
584 588
585 if (neigh->parms->neigh_destructor)
586 (neigh->parms->neigh_destructor)(neigh);
587
588 skb_queue_purge(&neigh->arp_queue); 589 skb_queue_purge(&neigh->arp_queue);
589 590
590 dev_put(neigh->dev); 591 dev_put(neigh->dev);
@@ -675,6 +676,8 @@ static void neigh_periodic_timer(unsigned long arg)
675 *np = n->next; 676 *np = n->next;
676 n->dead = 1; 677 n->dead = 1;
677 write_unlock(&n->lock); 678 write_unlock(&n->lock);
679 if (n->parms->neigh_cleanup)
680 n->parms->neigh_cleanup(n);
678 neigh_release(n); 681 neigh_release(n);
679 continue; 682 continue;
680 } 683 }
@@ -2088,8 +2091,11 @@ void __neigh_for_each_release(struct neigh_table *tbl,
2088 } else 2091 } else
2089 np = &n->next; 2092 np = &n->next;
2090 write_unlock(&n->lock); 2093 write_unlock(&n->lock);
2091 if (release) 2094 if (release) {
2095 if (n->parms->neigh_cleanup)
2096 n->parms->neigh_cleanup(n);
2092 neigh_release(n); 2097 neigh_release(n);
2098 }
2093 } 2099 }
2094 } 2100 }
2095} 2101}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 6055074c4b81..33ea8eac7fe0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -621,7 +621,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
621 if (err < 0) 621 if (err < 0)
622 goto errout; 622 goto errout;
623 623
624 iw += IW_EV_POINT_OFF; 624 /* Payload is at an offset in buffer */
625 iw = iw_buf + IW_EV_POINT_OFF;
625 } 626 }
626#endif /* CONFIG_NET_WIRELESS_RTNETLINK */ 627#endif /* CONFIG_NET_WIRELESS_RTNETLINK */
627 628
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 820761f9eeef..87573ae35b02 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -463,6 +463,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
463 memcpy(n->cb, skb->cb, sizeof(skb->cb)); 463 memcpy(n->cb, skb->cb, sizeof(skb->cb));
464 C(len); 464 C(len);
465 C(data_len); 465 C(data_len);
466 C(mac_len);
466 C(csum); 467 C(csum);
467 C(local_df); 468 C(local_df);
468 n->cloned = 1; 469 n->cloned = 1;
@@ -495,7 +496,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
495 n->tc_verd = SET_TC_VERD(skb->tc_verd,0); 496 n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
496 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd); 497 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
497 n->tc_verd = CLR_TC_MUNGED(n->tc_verd); 498 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
498 C(input_dev); 499 C(iif);
499#endif 500#endif
500 skb_copy_secmark(n, skb); 501 skb_copy_secmark(n, skb);
501#endif 502#endif
diff --git a/net/core/sock.c b/net/core/sock.c
index 8d65d6478dcd..27c4f62382bd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -808,7 +808,7 @@ lenout:
808 * 808 *
809 * (We also register the sk_lock with the lock validator.) 809 * (We also register the sk_lock with the lock validator.)
810 */ 810 */
811static void inline sock_lock_init(struct sock *sk) 811static inline void sock_lock_init(struct sock *sk)
812{ 812{
813 sock_lock_init_class_and_name(sk, 813 sock_lock_init_class_and_name(sk,
814 af_family_slock_key_strings[sk->sk_family], 814 af_family_slock_key_strings[sk->sk_family],
diff --git a/net/core/wireless.c b/net/core/wireless.c
index 9936ab11e6e0..b07fe270a508 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -2,7 +2,7 @@
2 * This file implement the Wireless Extensions APIs. 2 * This file implement the Wireless Extensions APIs.
3 * 3 *
4 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 4 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
5 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 5 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
6 * 6 *
7 * (As all part of the Linux kernel, this file is GPL) 7 * (As all part of the Linux kernel, this file is GPL)
8 */ 8 */
@@ -76,6 +76,9 @@
76 * o Change length in ESSID and NICK to strlen() instead of strlen()+1 76 * o Change length in ESSID and NICK to strlen() instead of strlen()+1
77 * o Make standard_ioctl_num and standard_event_num unsigned 77 * o Make standard_ioctl_num and standard_event_num unsigned
78 * o Remove (struct net_device *)->get_wireless_stats() 78 * o Remove (struct net_device *)->get_wireless_stats()
79 *
80 * v10 - 16.3.07 - Jean II
81 * o Prevent leaking of kernel space in stream on 64 bits.
79 */ 82 */
80 83
81/***************************** INCLUDES *****************************/ 84/***************************** INCLUDES *****************************/
@@ -427,6 +430,21 @@ static const int event_type_size[] = {
427 IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */ 430 IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */
428}; 431};
429 432
433/* Size (in bytes) of various events, as packed */
434static const int event_type_pk_size[] = {
435 IW_EV_LCP_PK_LEN, /* IW_HEADER_TYPE_NULL */
436 0,
437 IW_EV_CHAR_PK_LEN, /* IW_HEADER_TYPE_CHAR */
438 0,
439 IW_EV_UINT_PK_LEN, /* IW_HEADER_TYPE_UINT */
440 IW_EV_FREQ_PK_LEN, /* IW_HEADER_TYPE_FREQ */
441 IW_EV_ADDR_PK_LEN, /* IW_HEADER_TYPE_ADDR */
442 0,
443 IW_EV_POINT_PK_LEN, /* Without variable payload */
444 IW_EV_PARAM_PK_LEN, /* IW_HEADER_TYPE_PARAM */
445 IW_EV_QUAL_PK_LEN, /* IW_HEADER_TYPE_QUAL */
446};
447
430/************************ COMMON SUBROUTINES ************************/ 448/************************ COMMON SUBROUTINES ************************/
431/* 449/*
432 * Stuff that may be used in various place or doesn't fit in one 450 * Stuff that may be used in various place or doesn't fit in one
@@ -1217,7 +1235,7 @@ static int rtnetlink_standard_get(struct net_device * dev,
1217 memcpy(buffer + IW_EV_POINT_OFF, request, request_len); 1235 memcpy(buffer + IW_EV_POINT_OFF, request, request_len);
1218 /* Use our own copy of wrqu */ 1236 /* Use our own copy of wrqu */
1219 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF 1237 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF
1220 + IW_EV_LCP_LEN); 1238 + IW_EV_LCP_PK_LEN);
1221 1239
1222 /* No extra arguments. Trivial to handle */ 1240 /* No extra arguments. Trivial to handle */
1223 ret = handler(dev, &info, wrqu, NULL); 1241 ret = handler(dev, &info, wrqu, NULL);
@@ -1229,8 +1247,8 @@ static int rtnetlink_standard_get(struct net_device * dev,
1229 1247
1230 /* Get a temp copy of wrqu (skip pointer) */ 1248 /* Get a temp copy of wrqu (skip pointer) */
1231 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF, 1249 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
1232 ((char *) request) + IW_EV_LCP_LEN, 1250 ((char *) request) + IW_EV_LCP_PK_LEN,
1233 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1251 IW_EV_POINT_LEN - IW_EV_LCP_PK_LEN);
1234 1252
1235 /* Calculate space needed by arguments. Always allocate 1253 /* Calculate space needed by arguments. Always allocate
1236 * for max space. Easier, and won't last long... */ 1254 * for max space. Easier, and won't last long... */
@@ -1240,7 +1258,7 @@ static int rtnetlink_standard_get(struct net_device * dev,
1240 (wrqu_point.data.length > descr->max_tokens)) 1258 (wrqu_point.data.length > descr->max_tokens))
1241 extra_size = (wrqu_point.data.length 1259 extra_size = (wrqu_point.data.length
1242 * descr->token_size); 1260 * descr->token_size);
1243 buffer_size = extra_size + IW_EV_POINT_LEN + IW_EV_POINT_OFF; 1261 buffer_size = extra_size + IW_EV_POINT_PK_LEN + IW_EV_POINT_OFF;
1244#ifdef WE_RTNETLINK_DEBUG 1262#ifdef WE_RTNETLINK_DEBUG
1245 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n", 1263 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n",
1246 dev->name, extra_size, buffer_size); 1264 dev->name, extra_size, buffer_size);
@@ -1254,15 +1272,15 @@ static int rtnetlink_standard_get(struct net_device * dev,
1254 1272
1255 /* Put wrqu in the right place (just before extra). 1273 /* Put wrqu in the right place (just before extra).
1256 * Leave space for IWE header and dummy pointer... 1274 * Leave space for IWE header and dummy pointer...
1257 * Note that IW_EV_LCP_LEN==4 bytes, so it's still aligned... 1275 * Note that IW_EV_LCP_PK_LEN==4 bytes, so it's still aligned.
1258 */ 1276 */
1259 memcpy(buffer + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 1277 memcpy(buffer + IW_EV_LCP_PK_LEN + IW_EV_POINT_OFF,
1260 ((char *) &wrqu_point) + IW_EV_POINT_OFF, 1278 ((char *) &wrqu_point) + IW_EV_POINT_OFF,
1261 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1279 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1262 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_LEN); 1280 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_PK_LEN);
1263 1281
1264 /* Extra comes logically after that. Offset +12 bytes. */ 1282 /* Extra comes logically after that. Offset +12 bytes. */
1265 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_LEN; 1283 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_PK_LEN;
1266 1284
1267 /* Call the handler */ 1285 /* Call the handler */
1268 ret = handler(dev, &info, wrqu, extra); 1286 ret = handler(dev, &info, wrqu, extra);
@@ -1270,11 +1288,11 @@ static int rtnetlink_standard_get(struct net_device * dev,
1270 /* Calculate real returned length */ 1288 /* Calculate real returned length */
1271 extra_size = (wrqu->data.length * descr->token_size); 1289 extra_size = (wrqu->data.length * descr->token_size);
1272 /* Re-adjust reply size */ 1290 /* Re-adjust reply size */
1273 request->len = extra_size + IW_EV_POINT_LEN; 1291 request->len = extra_size + IW_EV_POINT_PK_LEN;
1274 1292
1275 /* Put the iwe header where it should, i.e. scrap the 1293 /* Put the iwe header where it should, i.e. scrap the
1276 * dummy pointer. */ 1294 * dummy pointer. */
1277 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_LEN); 1295 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_PK_LEN);
1278 1296
1279#ifdef WE_RTNETLINK_DEBUG 1297#ifdef WE_RTNETLINK_DEBUG
1280 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size); 1298 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size);
@@ -1331,10 +1349,10 @@ static inline int rtnetlink_standard_set(struct net_device * dev,
1331#endif /* WE_RTNETLINK_DEBUG */ 1349#endif /* WE_RTNETLINK_DEBUG */
1332 1350
1333 /* Extract fixed header from request. This is properly aligned. */ 1351 /* Extract fixed header from request. This is properly aligned. */
1334 wrqu = &request->u; 1352 wrqu = (union iwreq_data *) (((char *) request) + IW_EV_LCP_PK_LEN);
1335 1353
1336 /* Check if wrqu is complete */ 1354 /* Check if wrqu is complete */
1337 hdr_len = event_type_size[descr->header_type]; 1355 hdr_len = event_type_pk_size[descr->header_type];
1338 if(request_len < hdr_len) { 1356 if(request_len < hdr_len) {
1339#ifdef WE_RTNETLINK_DEBUG 1357#ifdef WE_RTNETLINK_DEBUG
1340 printk(KERN_DEBUG 1358 printk(KERN_DEBUG
@@ -1359,7 +1377,7 @@ static inline int rtnetlink_standard_set(struct net_device * dev,
1359 1377
1360 /* Put wrqu in the right place (skip pointer) */ 1378 /* Put wrqu in the right place (skip pointer) */
1361 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF, 1379 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
1362 wrqu, IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1380 wrqu, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1363 /* Don't forget about the event code... */ 1381 /* Don't forget about the event code... */
1364 wrqu = &wrqu_point; 1382 wrqu = &wrqu_point;
1365 1383
@@ -1483,7 +1501,7 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1483 hdr_len = extra_size; 1501 hdr_len = extra_size;
1484 extra_size = 0; 1502 extra_size = 0;
1485 } else { 1503 } else {
1486 hdr_len = IW_EV_POINT_LEN; 1504 hdr_len = IW_EV_POINT_PK_LEN;
1487 } 1505 }
1488 1506
1489 /* Check if wrqu is complete */ 1507 /* Check if wrqu is complete */
@@ -1514,7 +1532,7 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1514 memcpy(buffer + IW_EV_POINT_OFF, request, request_len); 1532 memcpy(buffer + IW_EV_POINT_OFF, request, request_len);
1515 /* Use our own copy of wrqu */ 1533 /* Use our own copy of wrqu */
1516 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF 1534 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF
1517 + IW_EV_LCP_LEN); 1535 + IW_EV_LCP_PK_LEN);
1518 1536
1519 /* No extra arguments. Trivial to handle */ 1537 /* No extra arguments. Trivial to handle */
1520 ret = handler(dev, &info, wrqu, (char *) wrqu); 1538 ret = handler(dev, &info, wrqu, (char *) wrqu);
@@ -1523,7 +1541,7 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1523 char * extra; 1541 char * extra;
1524 1542
1525 /* Buffer for full reply */ 1543 /* Buffer for full reply */
1526 buffer_size = extra_size + IW_EV_POINT_LEN + IW_EV_POINT_OFF; 1544 buffer_size = extra_size + IW_EV_POINT_PK_LEN + IW_EV_POINT_OFF;
1527 1545
1528#ifdef WE_RTNETLINK_DEBUG 1546#ifdef WE_RTNETLINK_DEBUG
1529 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n", 1547 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n",
@@ -1538,15 +1556,15 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1538 1556
1539 /* Put wrqu in the right place (just before extra). 1557 /* Put wrqu in the right place (just before extra).
1540 * Leave space for IWE header and dummy pointer... 1558 * Leave space for IWE header and dummy pointer...
1541 * Note that IW_EV_LCP_LEN==4 bytes, so it's still aligned... 1559 * Note that IW_EV_LCP_PK_LEN==4 bytes, so it's still aligned.
1542 */ 1560 */
1543 memcpy(buffer + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 1561 memcpy(buffer + IW_EV_LCP_PK_LEN + IW_EV_POINT_OFF,
1544 ((char *) request) + IW_EV_LCP_LEN, 1562 ((char *) request) + IW_EV_LCP_PK_LEN,
1545 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1563 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1546 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_LEN); 1564 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_PK_LEN);
1547 1565
1548 /* Extra comes logically after that. Offset +12 bytes. */ 1566 /* Extra comes logically after that. Offset +12 bytes. */
1549 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_LEN; 1567 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_PK_LEN;
1550 1568
1551 /* Call the handler */ 1569 /* Call the handler */
1552 ret = handler(dev, &info, wrqu, extra); 1570 ret = handler(dev, &info, wrqu, extra);
@@ -1556,11 +1574,11 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1556 if (!(descr->get_args & IW_PRIV_SIZE_FIXED)) 1574 if (!(descr->get_args & IW_PRIV_SIZE_FIXED))
1557 extra_size = adjust_priv_size(descr->get_args, wrqu); 1575 extra_size = adjust_priv_size(descr->get_args, wrqu);
1558 /* Re-adjust reply size */ 1576 /* Re-adjust reply size */
1559 request->len = extra_size + IW_EV_POINT_LEN; 1577 request->len = extra_size + IW_EV_POINT_PK_LEN;
1560 1578
1561 /* Put the iwe header where it should, i.e. scrap the 1579 /* Put the iwe header where it should, i.e. scrap the
1562 * dummy pointer. */ 1580 * dummy pointer. */
1563 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_LEN); 1581 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_PK_LEN);
1564 1582
1565#ifdef WE_RTNETLINK_DEBUG 1583#ifdef WE_RTNETLINK_DEBUG
1566 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size); 1584 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size);
@@ -1641,14 +1659,14 @@ static inline int rtnetlink_private_set(struct net_device * dev,
1641 /* Does it fits in wrqu ? */ 1659 /* Does it fits in wrqu ? */
1642 if((descr->set_args & IW_PRIV_SIZE_FIXED) && 1660 if((descr->set_args & IW_PRIV_SIZE_FIXED) &&
1643 (extra_size <= IFNAMSIZ)) { 1661 (extra_size <= IFNAMSIZ)) {
1644 hdr_len = IW_EV_LCP_LEN + extra_size; 1662 hdr_len = IW_EV_LCP_PK_LEN + extra_size;
1645 extra_size = 0; 1663 extra_size = 0;
1646 } else { 1664 } else {
1647 hdr_len = IW_EV_POINT_LEN; 1665 hdr_len = IW_EV_POINT_PK_LEN;
1648 } 1666 }
1649 1667
1650 /* Extract fixed header from request. This is properly aligned. */ 1668 /* Extract fixed header from request. This is properly aligned. */
1651 wrqu = &request->u; 1669 wrqu = (union iwreq_data *) (((char *) request) + IW_EV_LCP_PK_LEN);
1652 1670
1653 /* Check if wrqu is complete */ 1671 /* Check if wrqu is complete */
1654 if(request_len < hdr_len) { 1672 if(request_len < hdr_len) {
@@ -1675,7 +1693,7 @@ static inline int rtnetlink_private_set(struct net_device * dev,
1675 1693
1676 /* Put wrqu in the right place (skip pointer) */ 1694 /* Put wrqu in the right place (skip pointer) */
1677 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF, 1695 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
1678 wrqu, IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1696 wrqu, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1679 1697
1680 /* Does it fits within bounds ? */ 1698 /* Does it fits within bounds ? */
1681 if(wrqu_point.data.length > (descr->set_args & 1699 if(wrqu_point.data.length > (descr->set_args &
@@ -1738,7 +1756,7 @@ int wireless_rtnetlink_get(struct net_device * dev,
1738 iw_handler handler; 1756 iw_handler handler;
1739 1757
1740 /* Check length */ 1758 /* Check length */
1741 if(len < IW_EV_LCP_LEN) { 1759 if(len < IW_EV_LCP_PK_LEN) {
1742 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n", 1760 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n",
1743 dev->name, len); 1761 dev->name, len);
1744 return -EINVAL; 1762 return -EINVAL;
@@ -1822,7 +1840,7 @@ int wireless_rtnetlink_set(struct net_device * dev,
1822 iw_handler handler; 1840 iw_handler handler;
1823 1841
1824 /* Check length */ 1842 /* Check length */
1825 if(len < IW_EV_LCP_LEN) { 1843 if(len < IW_EV_LCP_PK_LEN) {
1826 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n", 1844 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n",
1827 dev->name, len); 1845 dev->name, len);
1828 return -EINVAL; 1846 return -EINVAL;
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 5361a4d8e13b..746f79d104b3 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -545,12 +545,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
545 /* set idle flag */ 545 /* set idle flag */
546 hctx->ccid3hctx_idle = 1; 546 hctx->ccid3hctx_idle = 1;
547 break; 547 break;
548 case TFRC_SSTATE_NO_SENT: 548 case TFRC_SSTATE_NO_SENT: /* fall through */
549 /*
550 * XXX when implementing bidirectional rx/tx check this again
551 */
552 DCCP_WARN("Illegal ACK received - no packet sent\n");
553 /* fall through */
554 case TFRC_SSTATE_TERM: /* ignore feedback when closing */ 549 case TFRC_SSTATE_TERM: /* ignore feedback when closing */
555 break; 550 break;
556 } 551 }
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 287099f7f042..78b043c458bf 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -248,18 +248,8 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
248 DCCP_ACKVEC_STATE_RECEIVED)) 248 DCCP_ACKVEC_STATE_RECEIVED))
249 goto discard; 249 goto discard;
250 250
251 /* 251 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
252 * Deliver to the CCID module in charge. 252 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
253 * FIXME: Currently DCCP operates one-directional only, i.e. a listening
254 * server is not at the same time a connecting client. There is
255 * not much sense in delivering to both rx/tx sides at the moment
256 * (only one is active at a time); when moving to bidirectional
257 * service, this needs to be revised.
258 */
259 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_CLIENT)
260 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
261 else /* listening or connected server */
262 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
263 253
264 return __dccp_rcv_established(sk, skb, dh, len); 254 return __dccp_rcv_established(sk, skb, dh, len);
265discard: 255discard:
@@ -494,11 +484,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
494 DCCP_ACKVEC_STATE_RECEIVED)) 484 DCCP_ACKVEC_STATE_RECEIVED))
495 goto discard; 485 goto discard;
496 486
497 /* XXX see the comments in dccp_rcv_established about this */ 487 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
498 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_CLIENT) 488 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
499 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
500 else
501 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
502 } 489 }
503 490
504 /* 491 /*
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 3282f2f2291b..aa21cc4de37f 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -213,19 +213,6 @@ do_interrupted:
213 goto out; 213 goto out;
214} 214}
215 215
216static void dccp_write_xmit_timer(unsigned long data) {
217 struct sock *sk = (struct sock *)data;
218 struct dccp_sock *dp = dccp_sk(sk);
219
220 bh_lock_sock(sk);
221 if (sock_owned_by_user(sk))
222 sk_reset_timer(sk, &dp->dccps_xmit_timer, jiffies+1);
223 else
224 dccp_write_xmit(sk, 0);
225 bh_unlock_sock(sk);
226 sock_put(sk);
227}
228
229void dccp_write_xmit(struct sock *sk, int block) 216void dccp_write_xmit(struct sock *sk, int block)
230{ 217{
231 struct dccp_sock *dp = dccp_sk(sk); 218 struct dccp_sock *dp = dccp_sk(sk);
@@ -434,9 +421,6 @@ static inline void dccp_connect_init(struct sock *sk)
434 dp->dccps_gar = dp->dccps_iss; 421 dp->dccps_gar = dp->dccps_iss;
435 422
436 icsk->icsk_retransmits = 0; 423 icsk->icsk_retransmits = 0;
437 init_timer(&dp->dccps_xmit_timer);
438 dp->dccps_xmit_timer.data = (unsigned long)sk;
439 dp->dccps_xmit_timer.function = dccp_write_xmit_timer;
440} 424}
441 425
442int dccp_connect(struct sock *sk) 426int dccp_connect(struct sock *sk)
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index cf28c53a389a..6607b7b14f34 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -575,7 +575,7 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
575 if (get_user(len, optlen)) 575 if (get_user(len, optlen))
576 return -EFAULT; 576 return -EFAULT;
577 577
578 if (len < sizeof(int)) 578 if (len < (int)sizeof(int))
579 return -EINVAL; 579 return -EINVAL;
580 580
581 dp = dccp_sk(sk); 581 dp = dccp_sk(sk);
@@ -589,9 +589,11 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
589 (__be32 __user *)optval, optlen); 589 (__be32 __user *)optval, optlen);
590 case DCCP_SOCKOPT_SEND_CSCOV: 590 case DCCP_SOCKOPT_SEND_CSCOV:
591 val = dp->dccps_pcslen; 591 val = dp->dccps_pcslen;
592 len = sizeof(val);
592 break; 593 break;
593 case DCCP_SOCKOPT_RECV_CSCOV: 594 case DCCP_SOCKOPT_RECV_CSCOV:
594 val = dp->dccps_pcrlen; 595 val = dp->dccps_pcrlen;
596 len = sizeof(val);
595 break; 597 break;
596 case 128 ... 191: 598 case 128 ... 191:
597 return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname, 599 return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname,
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index 41ea0f6594c4..0197a41c256a 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -261,8 +261,33 @@ out:
261 sock_put(sk); 261 sock_put(sk);
262} 262}
263 263
264/* Transmit-delay timer: used by the CCIDs to delay actual send time */
265static void dccp_write_xmit_timer(unsigned long data)
266{
267 struct sock *sk = (struct sock *)data;
268 struct dccp_sock *dp = dccp_sk(sk);
269
270 bh_lock_sock(sk);
271 if (sock_owned_by_user(sk))
272 sk_reset_timer(sk, &dp->dccps_xmit_timer, jiffies+1);
273 else
274 dccp_write_xmit(sk, 0);
275 bh_unlock_sock(sk);
276 sock_put(sk);
277}
278
279static void dccp_init_write_xmit_timer(struct sock *sk)
280{
281 struct dccp_sock *dp = dccp_sk(sk);
282
283 init_timer(&dp->dccps_xmit_timer);
284 dp->dccps_xmit_timer.data = (unsigned long)sk;
285 dp->dccps_xmit_timer.function = dccp_write_xmit_timer;
286}
287
264void dccp_init_xmit_timers(struct sock *sk) 288void dccp_init_xmit_timers(struct sock *sk)
265{ 289{
290 dccp_init_write_xmit_timer(sk);
266 inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer, 291 inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer,
267 &dccp_keepalive_timer); 292 &dccp_keepalive_timer);
268} 293}
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 3cbfddc98430..82d58a977e6f 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -63,7 +63,7 @@ static struct
63{ 63{
64 int error; 64 int error;
65 u8 scope; 65 u8 scope;
66} dn_fib_props[RTA_MAX+1] = { 66} dn_fib_props[RTN_MAX+1] = {
67 [RTN_UNSPEC] = { .error = 0, .scope = RT_SCOPE_NOWHERE }, 67 [RTN_UNSPEC] = { .error = 0, .scope = RT_SCOPE_NOWHERE },
68 [RTN_UNICAST] = { .error = 0, .scope = RT_SCOPE_UNIVERSE }, 68 [RTN_UNICAST] = { .error = 0, .scope = RT_SCOPE_UNIVERSE },
69 [RTN_LOCAL] = { .error = 0, .scope = RT_SCOPE_HOST }, 69 [RTN_LOCAL] = { .error = 0, .scope = RT_SCOPE_HOST },
@@ -276,6 +276,9 @@ struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, struct dn_kern_rta
276 struct dn_fib_info *ofi; 276 struct dn_fib_info *ofi;
277 int nhs = 1; 277 int nhs = 1;
278 278
279 if (r->rtm_type > RTN_MAX)
280 goto err_inval;
281
279 if (dn_fib_props[r->rtm_type].scope > r->rtm_scope) 282 if (dn_fib_props[r->rtm_type].scope > r->rtm_scope)
280 goto err_inval; 283 goto err_inval;
281 284
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index b6c98ac93dc8..5e86dd542302 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -109,8 +109,6 @@ errout:
109 109
110static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = { 110static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
111 FRA_GENERIC_POLICY, 111 FRA_GENERIC_POLICY,
112 [FRA_SRC] = { .type = NLA_U16 },
113 [FRA_DST] = { .type = NLA_U16 },
114}; 112};
115 113
116static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 114static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
@@ -133,7 +131,7 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
133 int err = -EINVAL; 131 int err = -EINVAL;
134 struct dn_fib_rule *r = (struct dn_fib_rule *)rule; 132 struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
135 133
136 if (frh->src_len > 16 || frh->dst_len > 16 || frh->tos) 134 if (frh->tos)
137 goto errout; 135 goto errout;
138 136
139 if (rule->table == RT_TABLE_UNSPEC) { 137 if (rule->table == RT_TABLE_UNSPEC) {
@@ -150,10 +148,10 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
150 } 148 }
151 } 149 }
152 150
153 if (tb[FRA_SRC]) 151 if (frh->src_len)
154 r->src = nla_get_le16(tb[FRA_SRC]); 152 r->src = nla_get_le16(tb[FRA_SRC]);
155 153
156 if (tb[FRA_DST]) 154 if (frh->dst_len)
157 r->dst = nla_get_le16(tb[FRA_DST]); 155 r->dst = nla_get_le16(tb[FRA_DST]);
158 156
159 r->src_len = frh->src_len; 157 r->src_len = frh->src_len;
@@ -176,10 +174,10 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
176 if (frh->dst_len && (r->dst_len != frh->dst_len)) 174 if (frh->dst_len && (r->dst_len != frh->dst_len))
177 return 0; 175 return 0;
178 176
179 if (tb[FRA_SRC] && (r->src != nla_get_le16(tb[FRA_SRC]))) 177 if (frh->src_len && (r->src != nla_get_le16(tb[FRA_SRC])))
180 return 0; 178 return 0;
181 179
182 if (tb[FRA_DST] && (r->dst != nla_get_le16(tb[FRA_DST]))) 180 if (frh->dst_len && (r->dst != nla_get_le16(tb[FRA_DST])))
183 return 0; 181 return 0;
184 182
185 return 1; 183 return 1;
@@ -249,6 +247,7 @@ int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
249static struct fib_rules_ops dn_fib_rules_ops = { 247static struct fib_rules_ops dn_fib_rules_ops = {
250 .family = AF_DECnet, 248 .family = AF_DECnet,
251 .rule_size = sizeof(struct dn_fib_rule), 249 .rule_size = sizeof(struct dn_fib_rule),
250 .addr_size = sizeof(u16),
252 .action = dn_fib_rule_action, 251 .action = dn_fib_rule_action,
253 .match = dn_fib_rule_match, 252 .match = dn_fib_rule_match,
254 .configure = dn_fib_rule_configure, 253 .configure = dn_fib_rule_configure,
diff --git a/net/ieee80211/Kconfig b/net/ieee80211/Kconfig
index a64be6cdf078..6ef766ef9618 100644
--- a/net/ieee80211/Kconfig
+++ b/net/ieee80211/Kconfig
@@ -38,7 +38,7 @@ config IEEE80211_CRYPT_WEP
38 Include software based cipher suites in support of IEEE 38 Include software based cipher suites in support of IEEE
39 802.11's WEP. This is needed for WEP as well as 802.1x. 39 802.11's WEP. This is needed for WEP as well as 802.1x.
40 40
41 This can be compiled as a modules and it will be called 41 This can be compiled as a module and it will be called
42 "ieee80211_crypt_wep". 42 "ieee80211_crypt_wep".
43 43
44config IEEE80211_CRYPT_CCMP 44config IEEE80211_CRYPT_CCMP
@@ -51,7 +51,7 @@ config IEEE80211_CRYPT_CCMP
51 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with CCMP enabled 51 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with CCMP enabled
52 networks. 52 networks.
53 53
54 This can be compiled as a modules and it will be called 54 This can be compiled as a module and it will be called
55 "ieee80211_crypt_ccmp". 55 "ieee80211_crypt_ccmp".
56 56
57config IEEE80211_CRYPT_TKIP 57config IEEE80211_CRYPT_TKIP
@@ -66,7 +66,7 @@ config IEEE80211_CRYPT_TKIP
66 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with TKIP enabled 66 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with TKIP enabled
67 networks. 67 networks.
68 68
69 This can be compiled as a modules and it will be called 69 This can be compiled as a module and it will be called
70 "ieee80211_crypt_tkip". 70 "ieee80211_crypt_tkip".
71 71
72source "net/ieee80211/softmac/Kconfig" 72source "net/ieee80211/softmac/Kconfig"
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index c976dd7e9758..2ce5b693a8bd 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -1933,6 +1933,11 @@ int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
1933 &cipso_ptr[6], 1933 &cipso_ptr[6],
1934 secattr); 1934 secattr);
1935 break; 1935 break;
1936 case CIPSO_V4_TAG_RANGE:
1937 ret_val = cipso_v4_parsetag_rng(doi_def,
1938 &cipso_ptr[6],
1939 secattr);
1940 break;
1936 } 1941 }
1937 1942
1938skbuff_getattr_return: 1943skbuff_getattr_return:
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e10794dc5f64..98a00d0edc76 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -502,8 +502,10 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
502 goto errout; 502 goto errout;
503 503
504 ifm = nlmsg_data(nlh); 504 ifm = nlmsg_data(nlh);
505 if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) 505 if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) {
506 err = -EINVAL;
506 goto errout; 507 goto errout;
508 }
507 509
508 dev = __dev_get_by_index(ifm->ifa_index); 510 dev = __dev_get_by_index(ifm->ifa_index);
509 if (dev == NULL) { 511 if (dev == NULL) {
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 1fba6439fc57..fc920f63452b 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -493,6 +493,11 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
493 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; 493 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid;
494 cfg->fc_nlinfo.nlh = nlh; 494 cfg->fc_nlinfo.nlh = nlh;
495 495
496 if (cfg->fc_type > RTN_MAX) {
497 err = -EINVAL;
498 goto errout;
499 }
500
496 nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { 501 nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) {
497 switch (attr->nla_type) { 502 switch (attr->nla_type) {
498 case RTA_DST: 503 case RTA_DST:
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index b837c33e0404..c660c074c76c 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -171,8 +171,6 @@ static struct fib_table *fib_empty_table(void)
171 171
172static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = { 172static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = {
173 FRA_GENERIC_POLICY, 173 FRA_GENERIC_POLICY,
174 [FRA_SRC] = { .type = NLA_U32 },
175 [FRA_DST] = { .type = NLA_U32 },
176 [FRA_FLOW] = { .type = NLA_U32 }, 174 [FRA_FLOW] = { .type = NLA_U32 },
177}; 175};
178 176
@@ -183,8 +181,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
183 int err = -EINVAL; 181 int err = -EINVAL;
184 struct fib4_rule *rule4 = (struct fib4_rule *) rule; 182 struct fib4_rule *rule4 = (struct fib4_rule *) rule;
185 183
186 if (frh->src_len > 32 || frh->dst_len > 32 || 184 if (frh->tos & ~IPTOS_TOS_MASK)
187 (frh->tos & ~IPTOS_TOS_MASK))
188 goto errout; 185 goto errout;
189 186
190 if (rule->table == RT_TABLE_UNSPEC) { 187 if (rule->table == RT_TABLE_UNSPEC) {
@@ -201,10 +198,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
201 } 198 }
202 } 199 }
203 200
204 if (tb[FRA_SRC]) 201 if (frh->src_len)
205 rule4->src = nla_get_be32(tb[FRA_SRC]); 202 rule4->src = nla_get_be32(tb[FRA_SRC]);
206 203
207 if (tb[FRA_DST]) 204 if (frh->dst_len)
208 rule4->dst = nla_get_be32(tb[FRA_DST]); 205 rule4->dst = nla_get_be32(tb[FRA_DST]);
209 206
210#ifdef CONFIG_NET_CLS_ROUTE 207#ifdef CONFIG_NET_CLS_ROUTE
@@ -242,10 +239,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
242 return 0; 239 return 0;
243#endif 240#endif
244 241
245 if (tb[FRA_SRC] && (rule4->src != nla_get_be32(tb[FRA_SRC]))) 242 if (frh->src_len && (rule4->src != nla_get_be32(tb[FRA_SRC])))
246 return 0; 243 return 0;
247 244
248 if (tb[FRA_DST] && (rule4->dst != nla_get_be32(tb[FRA_DST]))) 245 if (frh->dst_len && (rule4->dst != nla_get_be32(tb[FRA_DST])))
249 return 0; 246 return 0;
250 247
251 return 1; 248 return 1;
@@ -309,6 +306,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
309static struct fib_rules_ops fib4_rules_ops = { 306static struct fib_rules_ops fib4_rules_ops = {
310 .family = AF_INET, 307 .family = AF_INET,
311 .rule_size = sizeof(struct fib4_rule), 308 .rule_size = sizeof(struct fib4_rule),
309 .addr_size = sizeof(u32),
312 .action = fib4_rule_action, 310 .action = fib4_rule_action,
313 .match = fib4_rule_match, 311 .match = fib4_rule_match,
314 .configure = fib4_rule_configure, 312 .configure = fib4_rule_configure,
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 2f1fdae6efa6..3dad12ee76c3 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -89,7 +89,7 @@ static const struct
89{ 89{
90 int error; 90 int error;
91 u8 scope; 91 u8 scope;
92} fib_props[RTA_MAX + 1] = { 92} fib_props[RTN_MAX + 1] = {
93 { 93 {
94 .error = 0, 94 .error = 0,
95 .scope = RT_SCOPE_NOWHERE, 95 .scope = RT_SCOPE_NOWHERE,
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 72b3036bbc09..214c34732e84 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1123,6 +1123,9 @@ err:
1123 return fa_head; 1123 return fa_head;
1124} 1124}
1125 1125
1126/*
1127 * Caller must hold RTNL.
1128 */
1126static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg) 1129static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1127{ 1130{
1128 struct trie *t = (struct trie *) tb->tb_data; 1131 struct trie *t = (struct trie *) tb->tb_data;
@@ -1527,7 +1530,6 @@ static int trie_leaf_remove(struct trie *t, t_key key)
1527 t->revision++; 1530 t->revision++;
1528 t->size--; 1531 t->size--;
1529 1532
1530 preempt_disable();
1531 tp = NODE_PARENT(n); 1533 tp = NODE_PARENT(n);
1532 tnode_free((struct tnode *) n); 1534 tnode_free((struct tnode *) n);
1533 1535
@@ -1537,11 +1539,13 @@ static int trie_leaf_remove(struct trie *t, t_key key)
1537 rcu_assign_pointer(t->trie, trie_rebalance(t, tp)); 1539 rcu_assign_pointer(t->trie, trie_rebalance(t, tp));
1538 } else 1540 } else
1539 rcu_assign_pointer(t->trie, NULL); 1541 rcu_assign_pointer(t->trie, NULL);
1540 preempt_enable();
1541 1542
1542 return 1; 1543 return 1;
1543} 1544}
1544 1545
1546/*
1547 * Caller must hold RTNL.
1548 */
1545static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg) 1549static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg)
1546{ 1550{
1547 struct trie *t = (struct trie *) tb->tb_data; 1551 struct trie *t = (struct trie *) tb->tb_data;
@@ -1720,6 +1724,9 @@ up:
1720 return NULL; /* Ready. Root of trie */ 1724 return NULL; /* Ready. Root of trie */
1721} 1725}
1722 1726
1727/*
1728 * Caller must hold RTNL.
1729 */
1723static int fn_trie_flush(struct fib_table *tb) 1730static int fn_trie_flush(struct fib_table *tb)
1724{ 1731{
1725 struct trie *t = (struct trie *) tb->tb_data; 1732 struct trie *t = (struct trie *) tb->tb_data;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 1c6a084b5fb7..8cedb2a2c9df 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1255,9 +1255,9 @@ out:
1255 */ 1255 */
1256void ip_mc_rejoin_group(struct ip_mc_list *im) 1256void ip_mc_rejoin_group(struct ip_mc_list *im)
1257{ 1257{
1258#ifdef CONFIG_IP_MULTICAST
1258 struct in_device *in_dev = im->interface; 1259 struct in_device *in_dev = im->interface;
1259 1260
1260#ifdef CONFIG_IP_MULTICAST
1261 if (im->multiaddr == IGMP_ALL_HOSTS) 1261 if (im->multiaddr == IGMP_ALL_HOSTS)
1262 return; 1262 return;
1263 1263
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index adf25f9f70e1..6bcfdf6dfcc9 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -253,14 +253,17 @@ ip_nat_local_fn(unsigned int hooknum,
253 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 253 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
254 254
255 if (ct->tuplehash[dir].tuple.dst.ip != 255 if (ct->tuplehash[dir].tuple.dst.ip !=
256 ct->tuplehash[!dir].tuple.src.ip 256 ct->tuplehash[!dir].tuple.src.ip) {
257#ifdef CONFIG_XFRM
258 || ct->tuplehash[dir].tuple.dst.u.all !=
259 ct->tuplehash[!dir].tuple.src.u.all
260#endif
261 )
262 if (ip_route_me_harder(pskb, RTN_UNSPEC)) 257 if (ip_route_me_harder(pskb, RTN_UNSPEC))
263 ret = NF_DROP; 258 ret = NF_DROP;
259 }
260#ifdef CONFIG_XFRM
261 else if (ct->tuplehash[dir].tuple.dst.u.all !=
262 ct->tuplehash[!dir].tuple.src.u.all)
263 if (ip_xfrm_me_harder(pskb))
264 ret = NF_DROP;
265#endif
266
264 } 267 }
265 return ret; 268 return ret;
266} 269}
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index e965b333c997..42b08029e867 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -411,12 +411,10 @@ checkentry(const char *tablename,
411 "has invalid config pointer!\n"); 411 "has invalid config pointer!\n");
412 return 0; 412 return 0;
413 } 413 }
414 clusterip_config_entry_get(cipinfo->config);
415 } else { 414 } else {
416 /* Case B: This is a new rule referring to an existing 415 /* Case B: This is a new rule referring to an existing
417 * clusterip config. */ 416 * clusterip config. */
418 cipinfo->config = config; 417 cipinfo->config = config;
419 clusterip_config_entry_get(cipinfo->config);
420 } 418 }
421 } else { 419 } else {
422 /* Case C: This is a completely new clusterip config */ 420 /* Case C: This is a completely new clusterip config */
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c
index e4d3ef17d45b..15aa3db8cb33 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -245,14 +245,16 @@ nf_nat_local_fn(unsigned int hooknum,
245 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 245 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
246 246
247 if (ct->tuplehash[dir].tuple.dst.u3.ip != 247 if (ct->tuplehash[dir].tuple.dst.u3.ip !=
248 ct->tuplehash[!dir].tuple.src.u3.ip 248 ct->tuplehash[!dir].tuple.src.u3.ip) {
249#ifdef CONFIG_XFRM
250 || ct->tuplehash[dir].tuple.dst.u.all !=
251 ct->tuplehash[!dir].tuple.src.u.all
252#endif
253 )
254 if (ip_route_me_harder(pskb, RTN_UNSPEC)) 249 if (ip_route_me_harder(pskb, RTN_UNSPEC))
255 ret = NF_DROP; 250 ret = NF_DROP;
251 }
252#ifdef CONFIG_XFRM
253 else if (ct->tuplehash[dir].tuple.dst.u.all !=
254 ct->tuplehash[!dir].tuple.src.u.all)
255 if (ip_xfrm_me_harder(pskb))
256 ret = NF_DROP;
257#endif
256 } 258 }
257 return ret; 259 return ret;
258} 260}
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 74c4d103ebc2..3834b10b5115 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2458,11 +2458,18 @@ void __init tcp_init(void)
2458 sysctl_max_syn_backlog = 128; 2458 sysctl_max_syn_backlog = 128;
2459 } 2459 }
2460 2460
2461 /* Allow no more than 3/4 kernel memory (usually less) allocated to TCP */ 2461 /* Set the pressure threshold to be a fraction of global memory that
2462 sysctl_tcp_mem[0] = (1536 / sizeof (struct inet_bind_hashbucket)) << order; 2462 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2463 sysctl_tcp_mem[1] = sysctl_tcp_mem[0] * 4 / 3; 2463 * memory, with a floor of 128 pages.
2464 */
2465 limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2466 limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2467 limit = max(limit, 128UL);
2468 sysctl_tcp_mem[0] = limit / 4 * 3;
2469 sysctl_tcp_mem[1] = limit;
2464 sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2; 2470 sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
2465 2471
2472 /* Set per-socket limits to no more than 1/128 the pressure threshold */
2466 limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7); 2473 limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);
2467 max_share = min(4UL*1024*1024, limit); 2474 max_share = min(4UL*1024*1024, limit);
2468 2475
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index dc151139b5af..3c24881f2a65 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -943,7 +943,8 @@ static void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
943 if (tp->packets_out > tp->snd_cwnd_used) 943 if (tp->packets_out > tp->snd_cwnd_used)
944 tp->snd_cwnd_used = tp->packets_out; 944 tp->snd_cwnd_used = tp->packets_out;
945 945
946 if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto) 946 if (sysctl_tcp_slow_start_after_idle &&
947 (s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto)
947 tcp_cwnd_application_limited(sk); 948 tcp_cwnd_application_limited(sk);
948 } 949 }
949} 950}
@@ -1607,6 +1608,9 @@ u32 __tcp_select_window(struct sock *sk)
1607 */ 1608 */
1608 if (window <= free_space - mss || window > free_space) 1609 if (window <= free_space - mss || window > free_space)
1609 window = (free_space/mss)*mss; 1610 window = (free_space/mss)*mss;
1611 else if (mss == full_space &&
1612 free_space > window + full_space/2)
1613 window = free_space;
1610 } 1614 }
1611 1615
1612 return window; 1616 return window;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ce6c46034314..fc620a7c1db4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1215,6 +1215,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1215 1215
1216 if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen)) 1216 if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen))
1217 goto short_packet; 1217 goto short_packet;
1218 uh = skb->h.uh;
1218 1219
1219 udp4_csum_init(skb, uh); 1220 udp4_csum_init(skb, uh);
1220 1221
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index 89cf59ea7bbe..f68dfd8a0f5c 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -42,10 +42,9 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
42 42
43 skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen); 43 skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen);
44 top_iph = skb->nh.iph; 44 top_iph = skb->nh.iph;
45 hdrlen = iph->ihl * 4 - optlen; 45 skb->h.raw += sizeof(*iph) - hdrlen;
46 skb->h.raw += hdrlen;
47 46
48 memmove(top_iph, iph, hdrlen); 47 memmove(top_iph, iph, sizeof(*iph));
49 if (unlikely(optlen)) { 48 if (unlikely(optlen)) {
50 struct ip_beet_phdr *ph; 49 struct ip_beet_phdr *ph;
51 50
@@ -55,6 +54,8 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
55 ph->padlen = 4 - (optlen & 4); 54 ph->padlen = 4 - (optlen & 4);
56 ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8; 55 ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8;
57 ph->nexthdr = top_iph->protocol; 56 ph->nexthdr = top_iph->protocol;
57 if (ph->padlen)
58 memset(ph + 1, IPOPT_NOP, ph->padlen);
58 59
59 top_iph->protocol = IPPROTO_BEETPH; 60 top_iph->protocol = IPPROTO_BEETPH;
60 top_iph->ihl = sizeof(struct iphdr) / 4; 61 top_iph->ihl = sizeof(struct iphdr) / 4;
@@ -77,29 +78,32 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb)
77 protocol = iph->protocol; 78 protocol = iph->protocol;
78 79
79 if (unlikely(iph->protocol == IPPROTO_BEETPH)) { 80 if (unlikely(iph->protocol == IPPROTO_BEETPH)) {
80 struct ip_beet_phdr *ph = (struct ip_beet_phdr*)(iph + 1); 81 struct ip_beet_phdr *ph;
81 82
82 if (!pskb_may_pull(skb, sizeof(*ph))) 83 if (!pskb_may_pull(skb, sizeof(*ph)))
83 goto out; 84 goto out;
85 ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1);
84 86
85 phlen = ph->hdrlen * 8; 87 phlen = sizeof(*ph) + ph->padlen;
86 optlen = phlen - ph->padlen - sizeof(*ph); 88 optlen = ph->hdrlen * 8 - phlen;
87 if (optlen < 0 || optlen & 3 || optlen > 250) 89 if (optlen < 0 || optlen & 3 || optlen > 250)
88 goto out; 90 goto out;
89 91
90 if (!pskb_may_pull(skb, phlen)) 92 if (!pskb_may_pull(skb, phlen + optlen))
91 goto out; 93 goto out;
94 skb->len -= phlen + optlen;
92 95
93 ph_nexthdr = ph->nexthdr; 96 ph_nexthdr = ph->nexthdr;
94 } 97 }
95 98
96 skb_push(skb, sizeof(*iph) - phlen + optlen); 99 skb->nh.raw = skb->data + (phlen - sizeof(*iph));
97 memmove(skb->data, skb->nh.raw, sizeof(*iph)); 100 memmove(skb->nh.raw, iph, sizeof(*iph));
98 skb->nh.raw = skb->data; 101 skb->h.raw = skb->data + (phlen + optlen);
102 skb->data = skb->h.raw;
99 103
100 iph = skb->nh.iph; 104 iph = skb->nh.iph;
101 iph->ihl = (sizeof(*iph) + optlen) / 4; 105 iph->ihl = (sizeof(*iph) + optlen) / 4;
102 iph->tot_len = htons(skb->len); 106 iph->tot_len = htons(skb->len + iph->ihl * 4);
103 iph->daddr = x->sel.daddr.a4; 107 iph->daddr = x->sel.daddr.a4;
104 iph->saddr = x->sel.saddr.a4; 108 iph->saddr = x->sel.saddr.a4;
105 if (ph_nexthdr) 109 if (ph_nexthdr)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e16f1bba5dff..7552663aa125 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -342,10 +342,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
342 } 342 }
343#endif 343#endif
344 344
345 if (netif_carrier_ok(dev)) 345 if (netif_running(dev) && netif_carrier_ok(dev))
346 ndev->if_flags |= IF_READY; 346 ndev->if_flags |= IF_READY;
347 347
348
349 ipv6_mc_init_dev(ndev); 348 ipv6_mc_init_dev(ndev);
350 ndev->tstamp = jiffies; 349 ndev->tstamp = jiffies;
351#ifdef CONFIG_SYSCTL 350#ifdef CONFIG_SYSCTL
@@ -808,7 +807,7 @@ struct ipv6_saddr_score {
808#define IPV6_SADDR_SCORE_LABEL 0x0020 807#define IPV6_SADDR_SCORE_LABEL 0x0020
809#define IPV6_SADDR_SCORE_PRIVACY 0x0040 808#define IPV6_SADDR_SCORE_PRIVACY 0x0040
810 809
811static int inline ipv6_saddr_preferred(int type) 810static inline int ipv6_saddr_preferred(int type)
812{ 811{
813 if (type & (IPV6_ADDR_MAPPED|IPV6_ADDR_COMPATv4| 812 if (type & (IPV6_ADDR_MAPPED|IPV6_ADDR_COMPATv4|
814 IPV6_ADDR_LOOPBACK|IPV6_ADDR_RESERVED)) 813 IPV6_ADDR_LOOPBACK|IPV6_ADDR_RESERVED))
@@ -817,7 +816,7 @@ static int inline ipv6_saddr_preferred(int type)
817} 816}
818 817
819/* static matching label */ 818/* static matching label */
820static int inline ipv6_saddr_label(const struct in6_addr *addr, int type) 819static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
821{ 820{
822 /* 821 /*
823 * prefix (longest match) label 822 * prefix (longest match) label
@@ -3322,7 +3321,7 @@ errout:
3322 rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err); 3321 rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err);
3323} 3322}
3324 3323
3325static void inline ipv6_store_devconf(struct ipv6_devconf *cnf, 3324static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
3326 __s32 *array, int bytes) 3325 __s32 *array, int bytes)
3327{ 3326{
3328 BUG_ON(bytes < (DEVCONF_MAX * 4)); 3327 BUG_ON(bytes < (DEVCONF_MAX * 4));
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 0862809ffcf7..ea3035b4e3e8 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -131,8 +131,6 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
131 131
132static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = { 132static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = {
133 FRA_GENERIC_POLICY, 133 FRA_GENERIC_POLICY,
134 [FRA_SRC] = { .len = sizeof(struct in6_addr) },
135 [FRA_DST] = { .len = sizeof(struct in6_addr) },
136}; 134};
137 135
138static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, 136static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
@@ -142,9 +140,6 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
142 int err = -EINVAL; 140 int err = -EINVAL;
143 struct fib6_rule *rule6 = (struct fib6_rule *) rule; 141 struct fib6_rule *rule6 = (struct fib6_rule *) rule;
144 142
145 if (frh->src_len > 128 || frh->dst_len > 128)
146 goto errout;
147
148 if (rule->action == FR_ACT_TO_TBL) { 143 if (rule->action == FR_ACT_TO_TBL) {
149 if (rule->table == RT6_TABLE_UNSPEC) 144 if (rule->table == RT6_TABLE_UNSPEC)
150 goto errout; 145 goto errout;
@@ -155,11 +150,11 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
155 } 150 }
156 } 151 }
157 152
158 if (tb[FRA_SRC]) 153 if (frh->src_len)
159 nla_memcpy(&rule6->src.addr, tb[FRA_SRC], 154 nla_memcpy(&rule6->src.addr, tb[FRA_SRC],
160 sizeof(struct in6_addr)); 155 sizeof(struct in6_addr));
161 156
162 if (tb[FRA_DST]) 157 if (frh->dst_len)
163 nla_memcpy(&rule6->dst.addr, tb[FRA_DST], 158 nla_memcpy(&rule6->dst.addr, tb[FRA_DST],
164 sizeof(struct in6_addr)); 159 sizeof(struct in6_addr));
165 160
@@ -186,11 +181,11 @@ static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
186 if (frh->tos && (rule6->tclass != frh->tos)) 181 if (frh->tos && (rule6->tclass != frh->tos))
187 return 0; 182 return 0;
188 183
189 if (tb[FRA_SRC] && 184 if (frh->src_len &&
190 nla_memcmp(tb[FRA_SRC], &rule6->src.addr, sizeof(struct in6_addr))) 185 nla_memcmp(tb[FRA_SRC], &rule6->src.addr, sizeof(struct in6_addr)))
191 return 0; 186 return 0;
192 187
193 if (tb[FRA_DST] && 188 if (frh->dst_len &&
194 nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) 189 nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr)))
195 return 0; 190 return 0;
196 191
@@ -240,6 +235,7 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
240static struct fib_rules_ops fib6_rules_ops = { 235static struct fib_rules_ops fib6_rules_ops = {
241 .family = AF_INET6, 236 .family = AF_INET6,
242 .rule_size = sizeof(struct fib6_rule), 237 .rule_size = sizeof(struct fib6_rule),
238 .addr_size = sizeof(struct in6_addr),
243 .action = fib6_rule_action, 239 .action = fib6_rule_action,
244 .match = fib6_rule_match, 240 .match = fib6_rule_match,
245 .configure = fib6_rule_configure, 241 .configure = fib6_rule_configure,
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index f4d7be77eb0f..268f476ef3db 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -658,6 +658,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
658 ins = &iter->u.dst.rt6_next; 658 ins = &iter->u.dst.rt6_next;
659 } 659 }
660 660
661 /* Reset round-robin state, if necessary */
662 if (ins == &fn->leaf)
663 fn->rr_ptr = NULL;
664
661 /* 665 /*
662 * insert node 666 * insert node
663 */ 667 */
@@ -1109,6 +1113,10 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1109 rt6_stats.fib_rt_entries--; 1113 rt6_stats.fib_rt_entries--;
1110 rt6_stats.fib_discarded_routes++; 1114 rt6_stats.fib_discarded_routes++;
1111 1115
1116 /* Reset round-robin state, if necessary */
1117 if (fn->rr_ptr == rt)
1118 fn->rr_ptr = NULL;
1119
1112 /* Adjust walkers */ 1120 /* Adjust walkers */
1113 read_lock(&fib6_walker_lock); 1121 read_lock(&fib6_walker_lock);
1114 FOR_WALKERS(w) { 1122 FOR_WALKERS(w) {
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 11bfc7c43182..61e7a6c8141d 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -108,8 +108,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
108 108
109 /* pkt_len may be zero if Jumbo payload option is present */ 109 /* pkt_len may be zero if Jumbo payload option is present */
110 if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { 110 if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {
111 if (pkt_len + sizeof(struct ipv6hdr) > skb->len) 111 if (pkt_len + sizeof(struct ipv6hdr) > skb->len) {
112 goto truncated; 112 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS);
113 goto drop;
114 }
113 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) { 115 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) {
114 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); 116 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
115 goto drop; 117 goto drop;
@@ -128,8 +130,6 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
128 rcu_read_unlock(); 130 rcu_read_unlock();
129 131
130 return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); 132 return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
131truncated:
132 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS);
133err: 133err:
134 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); 134 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
135drop: 135drop:
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 286c86735aed..f5f9582a8d39 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -413,7 +413,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
413 } 413 }
414 414
415 /* routing header option needs extra check */ 415 /* routing header option needs extra check */
416 if (optname == IPV6_RTHDR && opt->srcrt) { 416 if (optname == IPV6_RTHDR && opt && opt->srcrt) {
417 struct ipv6_rt_hdr *rthdr = opt->srcrt; 417 struct ipv6_rt_hdr *rthdr = opt->srcrt;
418 switch (rthdr->type) { 418 switch (rthdr->type) {
419 case IPV6_SRCRT_TYPE_0: 419 case IPV6_SRCRT_TYPE_0:
@@ -795,12 +795,16 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
795EXPORT_SYMBOL(compat_ipv6_setsockopt); 795EXPORT_SYMBOL(compat_ipv6_setsockopt);
796#endif 796#endif
797 797
798static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, 798static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
799 char __user *optval, int len) 799 char __user *optval, int len)
800{ 800{
801 if (!hdr) 801 struct ipv6_opt_hdr *hdr;
802
803 if (!opt || !opt->hopopt)
802 return 0; 804 return 0;
803 len = min_t(int, len, ipv6_optlen(hdr)); 805 hdr = opt->hopopt;
806
807 len = min_t(unsigned int, len, ipv6_optlen(hdr));
804 if (copy_to_user(optval, hdr, ipv6_optlen(hdr))) 808 if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
805 return -EFAULT; 809 return -EFAULT;
806 return len; 810 return len;
@@ -940,7 +944,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
940 { 944 {
941 945
942 lock_sock(sk); 946 lock_sock(sk);
943 len = ipv6_getsockopt_sticky(sk, np->opt->hopopt, 947 len = ipv6_getsockopt_sticky(sk, np->opt,
944 optval, len); 948 optval, len);
945 release_sock(sk); 949 release_sock(sk);
946 return put_user(len, optlen); 950 return put_user(len, optlen);
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 6f19c4a49560..d1102455668d 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -257,6 +257,7 @@ static unsigned int ipv6_conntrack_in(unsigned int hooknum,
257 } 257 }
258 nf_conntrack_get(reasm->nfct); 258 nf_conntrack_get(reasm->nfct);
259 (*pskb)->nfct = reasm->nfct; 259 (*pskb)->nfct = reasm->nfct;
260 (*pskb)->nfctinfo = reasm->nfctinfo;
260 return NF_ACCEPT; 261 return NF_ACCEPT;
261 } 262 }
262 263
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 306d5d83c068..203e069e7fe9 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -687,9 +687,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
687 int err; 687 int err;
688 688
689 /* Rough check on arithmetic overflow, 689 /* Rough check on arithmetic overflow,
690 better check is made in ip6_build_xmit 690 better check is made in ip6_append_data().
691 */ 691 */
692 if (len < 0) 692 if (len > INT_MAX)
693 return -EMSGSIZE; 693 return -EMSGSIZE;
694 694
695 /* Mirror BSD error message compatibility */ 695 /* Mirror BSD error message compatibility */
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0e1f4b2cd3dd..ad9b285692ba 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -308,27 +308,18 @@ static inline void rt6_probe(struct rt6_info *rt)
308/* 308/*
309 * Default Router Selection (RFC 2461 6.3.6) 309 * Default Router Selection (RFC 2461 6.3.6)
310 */ 310 */
311static int inline rt6_check_dev(struct rt6_info *rt, int oif) 311static inline int rt6_check_dev(struct rt6_info *rt, int oif)
312{ 312{
313 struct net_device *dev = rt->rt6i_dev; 313 struct net_device *dev = rt->rt6i_dev;
314 int ret = 0; 314 if (!oif || dev->ifindex == oif)
315
316 if (!oif)
317 return 2;
318 if (dev->flags & IFF_LOOPBACK) {
319 if (!WARN_ON(rt->rt6i_idev == NULL) &&
320 rt->rt6i_idev->dev->ifindex == oif)
321 ret = 1;
322 else
323 return 0;
324 }
325 if (dev->ifindex == oif)
326 return 2; 315 return 2;
327 316 if ((dev->flags & IFF_LOOPBACK) &&
328 return ret; 317 rt->rt6i_idev && rt->rt6i_idev->dev->ifindex == oif)
318 return 1;
319 return 0;
329} 320}
330 321
331static int inline rt6_check_neigh(struct rt6_info *rt) 322static inline int rt6_check_neigh(struct rt6_info *rt)
332{ 323{
333 struct neighbour *neigh = rt->rt6i_nexthop; 324 struct neighbour *neigh = rt->rt6i_nexthop;
334 int m = 0; 325 int m = 0;
@@ -363,55 +354,76 @@ static int rt6_score_route(struct rt6_info *rt, int oif,
363 return m; 354 return m;
364} 355}
365 356
366static struct rt6_info *rt6_select(struct rt6_info **head, int oif, 357static struct rt6_info *find_match(struct rt6_info *rt, int oif, int strict,
367 int strict) 358 int *mpri, struct rt6_info *match)
359{
360 int m;
361
362 if (rt6_check_expired(rt))
363 goto out;
364
365 m = rt6_score_route(rt, oif, strict);
366 if (m < 0)
367 goto out;
368
369 if (m > *mpri) {
370 if (strict & RT6_LOOKUP_F_REACHABLE)
371 rt6_probe(match);
372 *mpri = m;
373 match = rt;
374 } else if (strict & RT6_LOOKUP_F_REACHABLE) {
375 rt6_probe(rt);
376 }
377
378out:
379 return match;
380}
381
382static struct rt6_info *find_rr_leaf(struct fib6_node *fn,
383 struct rt6_info *rr_head,
384 u32 metric, int oif, int strict)
368{ 385{
369 struct rt6_info *match = NULL, *last = NULL; 386 struct rt6_info *rt, *match;
370 struct rt6_info *rt, *rt0 = *head;
371 u32 metric;
372 int mpri = -1; 387 int mpri = -1;
373 388
374 RT6_TRACE("%s(head=%p(*head=%p), oif=%d)\n", 389 match = NULL;
375 __FUNCTION__, head, head ? *head : NULL, oif); 390 for (rt = rr_head; rt && rt->rt6i_metric == metric;
391 rt = rt->u.dst.rt6_next)
392 match = find_match(rt, oif, strict, &mpri, match);
393 for (rt = fn->leaf; rt && rt != rr_head && rt->rt6i_metric == metric;
394 rt = rt->u.dst.rt6_next)
395 match = find_match(rt, oif, strict, &mpri, match);
376 396
377 for (rt = rt0, metric = rt0->rt6i_metric; 397 return match;
378 rt && rt->rt6i_metric == metric && (!last || rt != rt0); 398}
379 rt = rt->u.dst.rt6_next) {
380 int m;
381 399
382 if (rt6_check_expired(rt)) 400static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict)
383 continue; 401{
402 struct rt6_info *match, *rt0;
384 403
385 last = rt; 404 RT6_TRACE("%s(fn->leaf=%p, oif=%d)\n",
405 __FUNCTION__, fn->leaf, oif);
386 406
387 m = rt6_score_route(rt, oif, strict); 407 rt0 = fn->rr_ptr;
388 if (m < 0) 408 if (!rt0)
389 continue; 409 fn->rr_ptr = rt0 = fn->leaf;
390 410
391 if (m > mpri) { 411 match = find_rr_leaf(fn, rt0, rt0->rt6i_metric, oif, strict);
392 if (strict & RT6_LOOKUP_F_REACHABLE)
393 rt6_probe(match);
394 match = rt;
395 mpri = m;
396 } else if (strict & RT6_LOOKUP_F_REACHABLE) {
397 rt6_probe(rt);
398 }
399 }
400 412
401 if (!match && 413 if (!match &&
402 (strict & RT6_LOOKUP_F_REACHABLE) && 414 (strict & RT6_LOOKUP_F_REACHABLE)) {
403 last && last != rt0) { 415 struct rt6_info *next = rt0->u.dst.rt6_next;
416
404 /* no entries matched; do round-robin */ 417 /* no entries matched; do round-robin */
405 static DEFINE_SPINLOCK(lock); 418 if (!next || next->rt6i_metric != rt0->rt6i_metric)
406 spin_lock(&lock); 419 next = fn->leaf;
407 *head = rt0->u.dst.rt6_next; 420
408 rt0->u.dst.rt6_next = last->u.dst.rt6_next; 421 if (next != rt0)
409 last->u.dst.rt6_next = rt0; 422 fn->rr_ptr = next;
410 spin_unlock(&lock);
411 } 423 }
412 424
413 RT6_TRACE("%s() => %p, score=%d\n", 425 RT6_TRACE("%s() => %p\n",
414 __FUNCTION__, match, mpri); 426 __FUNCTION__, match);
415 427
416 return (match ? match : &ip6_null_entry); 428 return (match ? match : &ip6_null_entry);
417} 429}
@@ -657,7 +669,7 @@ restart_2:
657 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 669 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
658 670
659restart: 671restart:
660 rt = rt6_select(&fn->leaf, fl->iif, strict | reachable); 672 rt = rt6_select(fn, fl->iif, strict | reachable);
661 BACKTRACK(&fl->fl6_src); 673 BACKTRACK(&fl->fl6_src);
662 if (rt == &ip6_null_entry || 674 if (rt == &ip6_null_entry ||
663 rt->rt6i_flags & RTF_CACHE) 675 rt->rt6i_flags & RTF_CACHE)
@@ -752,7 +764,7 @@ restart_2:
752 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 764 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
753 765
754restart: 766restart:
755 rt = rt6_select(&fn->leaf, fl->oif, strict | reachable); 767 rt = rt6_select(fn, fl->oif, strict | reachable);
756 BACKTRACK(&fl->fl6_src); 768 BACKTRACK(&fl->fl6_src);
757 if (rt == &ip6_null_entry || 769 if (rt == &ip6_null_entry ||
758 rt->rt6i_flags & RTF_CACHE) 770 rt->rt6i_flags & RTF_CACHE)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index f57a9baa6b27..92f99927d12d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1453,6 +1453,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1453 First: no IPv4 options. 1453 First: no IPv4 options.
1454 */ 1454 */
1455 newinet->opt = NULL; 1455 newinet->opt = NULL;
1456 newnp->ipv6_fl_list = NULL;
1456 1457
1457 /* Clone RX bits */ 1458 /* Clone RX bits */
1458 newnp->rxopt.all = np->rxopt.all; 1459 newnp->rxopt.all = np->rxopt.all;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 0ad471909881..f590db57a7c9 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -615,7 +615,7 @@ do_udp_sendmsg:
615 return udp_sendmsg(iocb, sk, msg, len); 615 return udp_sendmsg(iocb, sk, msg, len);
616 616
617 /* Rough check on arithmetic overflow, 617 /* Rough check on arithmetic overflow,
618 better check is made in ip6_build_xmit 618 better check is made in ip6_append_data().
619 */ 619 */
620 if (len > INT_MAX - sizeof(struct udphdr)) 620 if (len > INT_MAX - sizeof(struct udphdr))
621 return -EMSGSIZE; 621 return -EMSGSIZE;
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index ee4b84a33ff4..93c42232aa39 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -58,7 +58,7 @@ static struct kmem_cache *xfrm6_tunnel_spi_kmem __read_mostly;
58static struct hlist_head xfrm6_tunnel_spi_byaddr[XFRM6_TUNNEL_SPI_BYADDR_HSIZE]; 58static struct hlist_head xfrm6_tunnel_spi_byaddr[XFRM6_TUNNEL_SPI_BYADDR_HSIZE];
59static struct hlist_head xfrm6_tunnel_spi_byspi[XFRM6_TUNNEL_SPI_BYSPI_HSIZE]; 59static struct hlist_head xfrm6_tunnel_spi_byspi[XFRM6_TUNNEL_SPI_BYSPI_HSIZE];
60 60
61static unsigned inline xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr) 61static inline unsigned xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
62{ 62{
63 unsigned h; 63 unsigned h;
64 64
@@ -70,7 +70,7 @@ static unsigned inline xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
70 return h; 70 return h;
71} 71}
72 72
73static unsigned inline xfrm6_tunnel_spi_hash_byspi(u32 spi) 73static inline unsigned xfrm6_tunnel_spi_hash_byspi(u32 spi)
74{ 74{
75 return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; 75 return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE;
76} 76}
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h
index 873ae189e37a..bc2e15ce7004 100644
--- a/net/irda/irnet/irnet.h
+++ b/net/irda/irnet/irnet.h
@@ -419,7 +419,7 @@ typedef struct irnet_socket
419 u32 raccm; /* to please pppd - dummy) */ 419 u32 raccm; /* to please pppd - dummy) */
420 unsigned int flags; /* PPP flags (compression, ...) */ 420 unsigned int flags; /* PPP flags (compression, ...) */
421 unsigned int rbits; /* Unused receive flags ??? */ 421 unsigned int rbits; /* Unused receive flags ??? */
422 422 struct work_struct disconnect_work; /* Process context disconnection */
423 /* ------------------------ IrTTP part ------------------------ */ 423 /* ------------------------ IrTTP part ------------------------ */
424 /* We create a pseudo "socket" over the IrDA tranport */ 424 /* We create a pseudo "socket" over the IrDA tranport */
425 unsigned long ttp_open; /* Set when IrTTP is ready */ 425 unsigned long ttp_open; /* Set when IrTTP is ready */
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index c378e668af0c..a4f1439ffdd8 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -10,6 +10,27 @@
10 10
11#include "irnet_irda.h" /* Private header */ 11#include "irnet_irda.h" /* Private header */
12 12
13/*
14 * PPP disconnect work: we need to make sure we're in
15 * process context when calling ppp_unregister_channel().
16 */
17static void irnet_ppp_disconnect(struct work_struct *work)
18{
19 irnet_socket * self =
20 container_of(work, irnet_socket, disconnect_work);
21
22 if (self == NULL)
23 return;
24 /*
25 * If we were connected, cleanup & close the PPP
26 * channel, which will kill pppd (hangup) and the rest.
27 */
28 if (self->ppp_open && !self->ttp_open && !self->ttp_connect) {
29 ppp_unregister_channel(&self->chan);
30 self->ppp_open = 0;
31 }
32}
33
13/************************* CONTROL CHANNEL *************************/ 34/************************* CONTROL CHANNEL *************************/
14/* 35/*
15 * When ppp is not active, /dev/irnet act as a control channel. 36 * When ppp is not active, /dev/irnet act as a control channel.
@@ -499,6 +520,8 @@ irda_irnet_create(irnet_socket * self)
499#endif /* DISCOVERY_NOMASK */ 520#endif /* DISCOVERY_NOMASK */
500 self->tx_flow = FLOW_START; /* Flow control from IrTTP */ 521 self->tx_flow = FLOW_START; /* Flow control from IrTTP */
501 522
523 INIT_WORK(&self->disconnect_work, irnet_ppp_disconnect);
524
502 DEXIT(IRDA_SOCK_TRACE, "\n"); 525 DEXIT(IRDA_SOCK_TRACE, "\n");
503 return(0); 526 return(0);
504} 527}
@@ -1134,15 +1157,8 @@ irnet_disconnect_indication(void * instance,
1134 { 1157 {
1135 if(test_open) 1158 if(test_open)
1136 { 1159 {
1137#ifdef MISSING_PPP_API 1160 /* ppp_unregister_channel() wants a user context. */
1138 /* ppp_unregister_channel() wants a user context, which we 1161 schedule_work(&self->disconnect_work);
1139 * are guaranteed to NOT have here. What are we supposed
1140 * to do here ? Jean II */
1141 /* If we were connected, cleanup & close the PPP channel,
1142 * which will kill pppd (hangup) and the rest */
1143 ppp_unregister_channel(&self->chan);
1144 self->ppp_open = 0;
1145#endif
1146 } 1162 }
1147 else 1163 else
1148 { 1164 {
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index a7486b3bddcb..da3f2bc1b6f6 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1455,6 +1455,7 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
1455 1455
1456 /* Not everything should be copied */ 1456 /* Not everything should be copied */
1457 new->notify.instance = instance; 1457 new->notify.instance = instance;
1458 spin_lock_init(&new->lock);
1458 init_timer(&new->todo_timer); 1459 init_timer(&new->todo_timer);
1459 1460
1460 skb_queue_head_init(&new->rx_queue); 1461 skb_queue_head_init(&new->rx_queue);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 1c58204d767e..a4e7e2db0ff3 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1467,9 +1467,6 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1467 1467
1468 err = xfrm_state_delete(x); 1468 err = xfrm_state_delete(x);
1469 1469
1470 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
1471 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
1472
1473 if (err < 0) 1470 if (err < 0)
1474 goto out; 1471 goto out;
1475 1472
@@ -1478,6 +1475,8 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1478 c.event = XFRM_MSG_DELSA; 1475 c.event = XFRM_MSG_DELSA;
1479 km_state_notify(x, &c); 1476 km_state_notify(x, &c);
1480out: 1477out:
1478 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
1479 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
1481 xfrm_state_put(x); 1480 xfrm_state_put(x);
1482 1481
1483 return err; 1482 return err;
@@ -2294,14 +2293,12 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2294 } 2293 }
2295 2294
2296 xp = xfrm_policy_bysel_ctx(XFRM_POLICY_TYPE_MAIN, pol->sadb_x_policy_dir-1, 2295 xp = xfrm_policy_bysel_ctx(XFRM_POLICY_TYPE_MAIN, pol->sadb_x_policy_dir-1,
2297 &sel, tmp.security, 1); 2296 &sel, tmp.security, 1, &err);
2298 security_xfrm_policy_free(&tmp); 2297 security_xfrm_policy_free(&tmp);
2299 2298
2300 if (xp == NULL) 2299 if (xp == NULL)
2301 return -ENOENT; 2300 return -ENOENT;
2302 2301
2303 err = security_xfrm_policy_delete(xp);
2304
2305 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0, 2302 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
2306 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL); 2303 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
2307 2304
@@ -2539,7 +2536,7 @@ static int pfkey_migrate(struct sock *sk, struct sk_buff *skb,
2539static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) 2536static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
2540{ 2537{
2541 unsigned int dir; 2538 unsigned int dir;
2542 int err; 2539 int err = 0, delete;
2543 struct sadb_x_policy *pol; 2540 struct sadb_x_policy *pol;
2544 struct xfrm_policy *xp; 2541 struct xfrm_policy *xp;
2545 struct km_event c; 2542 struct km_event c;
@@ -2551,16 +2548,20 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2551 if (dir >= XFRM_POLICY_MAX) 2548 if (dir >= XFRM_POLICY_MAX)
2552 return -EINVAL; 2549 return -EINVAL;
2553 2550
2551 delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2);
2554 xp = xfrm_policy_byid(XFRM_POLICY_TYPE_MAIN, dir, pol->sadb_x_policy_id, 2552 xp = xfrm_policy_byid(XFRM_POLICY_TYPE_MAIN, dir, pol->sadb_x_policy_id,
2555 hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2553 delete, &err);
2556 if (xp == NULL) 2554 if (xp == NULL)
2557 return -ENOENT; 2555 return -ENOENT;
2558 2556
2559 err = 0; 2557 if (delete) {
2558 xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
2559 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
2560 2560
2561 c.seq = hdr->sadb_msg_seq; 2561 if (err)
2562 c.pid = hdr->sadb_msg_pid; 2562 goto out;
2563 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2563 c.seq = hdr->sadb_msg_seq;
2564 c.pid = hdr->sadb_msg_pid;
2564 c.data.byid = 1; 2565 c.data.byid = 1;
2565 c.event = XFRM_MSG_DELPOLICY; 2566 c.event = XFRM_MSG_DELPOLICY;
2566 km_policy_notify(xp, dir, &c); 2567 km_policy_notify(xp, dir, &c);
@@ -2568,6 +2569,7 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2568 err = key_pol_get_resp(sk, xp, hdr, dir); 2569 err = key_pol_get_resp(sk, xp, hdr, dir);
2569 } 2570 }
2570 2571
2572out:
2571 xfrm_pol_put(xp); 2573 xfrm_pol_put(xp);
2572 return err; 2574 return err;
2573} 2575}
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 253fce3ad2d3..54698af6d0af 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -275,6 +275,7 @@ config NF_CT_NETLINK
275 tristate 'Connection tracking netlink interface (EXPERIMENTAL)' 275 tristate 'Connection tracking netlink interface (EXPERIMENTAL)'
276 depends on EXPERIMENTAL && NF_CONNTRACK && NETFILTER_NETLINK 276 depends on EXPERIMENTAL && NF_CONNTRACK && NETFILTER_NETLINK
277 depends on NF_CONNTRACK!=y || NETFILTER_NETLINK!=m 277 depends on NF_CONNTRACK!=y || NETFILTER_NETLINK!=m
278 depends on NF_NAT=n || NF_NAT
278 help 279 help
279 This option enables support for a netlink-based userspace interface 280 This option enables support for a netlink-based userspace interface
280 281
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 91a0972ec117..5cb30ebba0f4 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -486,7 +486,7 @@ __build_packet_message(struct nfulnl_instance *inst,
486 * for physical device (when called from ipv4) */ 486 * for physical device (when called from ipv4) */
487 NFA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, 487 NFA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV,
488 sizeof(tmp_uint), &tmp_uint); 488 sizeof(tmp_uint), &tmp_uint);
489 if (skb->nf_bridge) { 489 if (skb->nf_bridge && skb->nf_bridge->physoutdev) {
490 tmp_uint = 490 tmp_uint =
491 htonl(skb->nf_bridge->physoutdev->ifindex); 491 htonl(skb->nf_bridge->physoutdev->ifindex);
492 NFA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, 492 NFA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV,
@@ -615,7 +615,7 @@ nfulnl_log_packet(unsigned int pf,
615 615
616 plen = 0; 616 plen = 0;
617 if (prefix) 617 if (prefix)
618 plen = strlen(prefix); 618 plen = strlen(prefix) + 1;
619 619
620 /* all macros expand to constant values at compile time */ 620 /* all macros expand to constant values at compile time */
621 /* FIXME: do we want to make the size calculation conditional based on 621 /* FIXME: do we want to make the size calculation conditional based on
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 8c34f1ca6c8c..f92d5310847b 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -700,23 +700,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
700 unsigned char cause, diagnostic; 700 unsigned char cause, diagnostic;
701 struct net_device *dev; 701 struct net_device *dev;
702 ax25_uid_assoc *user; 702 ax25_uid_assoc *user;
703 int n; 703 int n, err = 0;
704
705 if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) {
706 sock->state = SS_CONNECTED;
707 return 0; /* Connect completed during a ERESTARTSYS event */
708 }
709
710 if (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) {
711 sock->state = SS_UNCONNECTED;
712 return -ECONNREFUSED;
713 }
714
715 if (sk->sk_state == TCP_ESTABLISHED)
716 return -EISCONN; /* No reconnect on a seqpacket socket */
717
718 sk->sk_state = TCP_CLOSE;
719 sock->state = SS_UNCONNECTED;
720 704
721 if (addr_len != sizeof(struct sockaddr_rose) && addr_len != sizeof(struct full_sockaddr_rose)) 705 if (addr_len != sizeof(struct sockaddr_rose) && addr_len != sizeof(struct full_sockaddr_rose))
722 return -EINVAL; 706 return -EINVAL;
@@ -734,24 +718,53 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
734 if ((rose->source_ndigis + addr->srose_ndigis) > ROSE_MAX_DIGIS) 718 if ((rose->source_ndigis + addr->srose_ndigis) > ROSE_MAX_DIGIS)
735 return -EINVAL; 719 return -EINVAL;
736 720
721 lock_sock(sk);
722
723 if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) {
724 /* Connect completed during a ERESTARTSYS event */
725 sock->state = SS_CONNECTED;
726 goto out_release;
727 }
728
729 if (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) {
730 sock->state = SS_UNCONNECTED;
731 err = -ECONNREFUSED;
732 goto out_release;
733 }
734
735 if (sk->sk_state == TCP_ESTABLISHED) {
736 /* No reconnect on a seqpacket socket */
737 err = -EISCONN;
738 goto out_release;
739 }
740
741 sk->sk_state = TCP_CLOSE;
742 sock->state = SS_UNCONNECTED;
743
737 rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, 744 rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause,
738 &diagnostic); 745 &diagnostic);
739 if (!rose->neighbour) 746 if (!rose->neighbour)
740 return -ENETUNREACH; 747 return -ENETUNREACH;
741 748
742 rose->lci = rose_new_lci(rose->neighbour); 749 rose->lci = rose_new_lci(rose->neighbour);
743 if (!rose->lci) 750 if (!rose->lci) {
744 return -ENETUNREACH; 751 err = -ENETUNREACH;
752 goto out_release;
753 }
745 754
746 if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in this may or may not work */ 755 if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in this may or may not work */
747 sock_reset_flag(sk, SOCK_ZAPPED); 756 sock_reset_flag(sk, SOCK_ZAPPED);
748 757
749 if ((dev = rose_dev_first()) == NULL) 758 if ((dev = rose_dev_first()) == NULL) {
750 return -ENETUNREACH; 759 err = -ENETUNREACH;
760 goto out_release;
761 }
751 762
752 user = ax25_findbyuid(current->euid); 763 user = ax25_findbyuid(current->euid);
753 if (!user) 764 if (!user) {
754 return -EINVAL; 765 err = -EINVAL;
766 goto out_release;
767 }
755 768
756 memcpy(&rose->source_addr, dev->dev_addr, ROSE_ADDR_LEN); 769 memcpy(&rose->source_addr, dev->dev_addr, ROSE_ADDR_LEN);
757 rose->source_call = user->call; 770 rose->source_call = user->call;
@@ -789,8 +802,10 @@ rose_try_next_neigh:
789 rose_start_t1timer(sk); 802 rose_start_t1timer(sk);
790 803
791 /* Now the loop */ 804 /* Now the loop */
792 if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) 805 if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) {
793 return -EINPROGRESS; 806 err = -EINPROGRESS;
807 goto out_release;
808 }
794 809
795 /* 810 /*
796 * A Connect Ack with Choke or timeout or failed routing will go to 811 * A Connect Ack with Choke or timeout or failed routing will go to
@@ -805,8 +820,10 @@ rose_try_next_neigh:
805 set_current_state(TASK_INTERRUPTIBLE); 820 set_current_state(TASK_INTERRUPTIBLE);
806 if (sk->sk_state != TCP_SYN_SENT) 821 if (sk->sk_state != TCP_SYN_SENT)
807 break; 822 break;
823 release_sock(sk);
808 if (!signal_pending(tsk)) { 824 if (!signal_pending(tsk)) {
809 schedule(); 825 schedule();
826 lock_sock(sk);
810 continue; 827 continue;
811 } 828 }
812 current->state = TASK_RUNNING; 829 current->state = TASK_RUNNING;
@@ -822,14 +839,19 @@ rose_try_next_neigh:
822 rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, &diagnostic); 839 rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, &diagnostic);
823 if (rose->neighbour) 840 if (rose->neighbour)
824 goto rose_try_next_neigh; 841 goto rose_try_next_neigh;
825 /* No more neighbour */ 842
843 /* No more neighbours */
826 sock->state = SS_UNCONNECTED; 844 sock->state = SS_UNCONNECTED;
827 return sock_error(sk); /* Always set at this point */ 845 err = sock_error(sk); /* Always set at this point */
846 goto out_release;
828 } 847 }
829 848
830 sock->state = SS_CONNECTED; 849 sock->state = SS_CONNECTED;
831 850
832 return 0; 851out_release:
852 release_sock(sk);
853
854 return err;
833} 855}
834 856
835static int rose_accept(struct socket *sock, struct socket *newsock, int flags) 857static int rose_accept(struct socket *sock, struct socket *newsock, int flags)
@@ -877,6 +899,8 @@ static int rose_accept(struct socket *sock, struct socket *newsock, int flags)
877 lock_sock(sk); 899 lock_sock(sk);
878 continue; 900 continue;
879 } 901 }
902 current->state = TASK_RUNNING;
903 remove_wait_queue(sk->sk_sleep, &wait);
880 return -ERESTARTSYS; 904 return -ERESTARTSYS;
881 } 905 }
882 current->state = TASK_RUNNING; 906 current->state = TASK_RUNNING;
diff --git a/net/sched/Makefile b/net/sched/Makefile
index ff2d6e5e282c..020767a204d4 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o
17obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o 17obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o
18obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o 18obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
19obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o 19obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
20obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
21obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o 20obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o
22obj-$(CONFIG_NET_SCH_RED) += sch_red.o 21obj-$(CONFIG_NET_SCH_RED) += sch_red.o
23obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o 22obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 68f26cb278f9..3e93683e9ab3 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -198,7 +198,7 @@ bad_mirred:
198 skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at); 198 skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
199 199
200 skb2->dev = dev; 200 skb2->dev = dev;
201 skb2->input_dev = skb->dev; 201 skb2->iif = skb->dev->ifindex;
202 dev_queue_xmit(skb2); 202 dev_queue_xmit(skb2);
203 spin_unlock(&m->tcf_lock); 203 spin_unlock(&m->tcf_lock);
204 return m->tcf_action; 204 return m->tcf_action;
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index fad08e521c24..4a91f082a81d 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -81,6 +81,13 @@ static void basic_put(struct tcf_proto *tp, unsigned long f)
81 81
82static int basic_init(struct tcf_proto *tp) 82static int basic_init(struct tcf_proto *tp)
83{ 83{
84 struct basic_head *head;
85
86 head = kzalloc(sizeof(*head), GFP_KERNEL);
87 if (head == NULL)
88 return -ENOBUFS;
89 INIT_LIST_HEAD(&head->flist);
90 tp->root = head;
84 return 0; 91 return 0;
85} 92}
86 93
@@ -102,6 +109,7 @@ static void basic_destroy(struct tcf_proto *tp)
102 list_del(&f->link); 109 list_del(&f->link);
103 basic_delete_filter(tp, f); 110 basic_delete_filter(tp, f);
104 } 111 }
112 kfree(head);
105} 113}
106 114
107static int basic_delete(struct tcf_proto *tp, unsigned long arg) 115static int basic_delete(struct tcf_proto *tp, unsigned long arg)
@@ -176,15 +184,6 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
176 } 184 }
177 185
178 err = -ENOBUFS; 186 err = -ENOBUFS;
179 if (head == NULL) {
180 head = kzalloc(sizeof(*head), GFP_KERNEL);
181 if (head == NULL)
182 goto errout;
183
184 INIT_LIST_HEAD(&head->flist);
185 tp->root = head;
186 }
187
188 f = kzalloc(sizeof(*f), GFP_KERNEL); 187 f = kzalloc(sizeof(*f), GFP_KERNEL);
189 if (f == NULL) 188 if (f == NULL)
190 goto errout; 189 goto errout;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index e85df07d8ce7..abc47cc48ad0 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -93,7 +93,7 @@ void route4_reset_fastmap(struct net_device *dev, struct route4_head *head, u32
93 spin_unlock_bh(&dev->queue_lock); 93 spin_unlock_bh(&dev->queue_lock);
94} 94}
95 95
96static void __inline__ 96static inline void
97route4_set_fastmap(struct route4_head *head, u32 id, int iif, 97route4_set_fastmap(struct route4_head *head, u32 id, int iif,
98 struct route4_filter *f) 98 struct route4_filter *f)
99{ 99{
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 040e2d2d281a..7563fdcef4b7 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -245,9 +245,9 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
245 } 245 }
246 246
247 if (tb[TCA_TCINDEX_SHIFT-1]) { 247 if (tb[TCA_TCINDEX_SHIFT-1]) {
248 if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT-1]) < sizeof(u16)) 248 if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT-1]) < sizeof(int))
249 goto errout; 249 goto errout;
250 cp.shift = *(u16 *) RTA_DATA(tb[TCA_TCINDEX_SHIFT-1]); 250 cp.shift = *(int *) RTA_DATA(tb[TCA_TCINDEX_SHIFT-1]);
251 } 251 }
252 252
253 err = -EBUSY; 253 err = -EBUSY;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 396deb71480f..407c6fb1ba14 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1184,10 +1184,12 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
1184 1184
1185 sch_tree_lock(sch); 1185 sch_tree_lock(sch);
1186 1186
1187 list_del(&cl->hlist);
1188 list_del(&cl->siblings); 1187 list_del(&cl->siblings);
1189 hfsc_adjust_levels(cl->cl_parent); 1188 hfsc_adjust_levels(cl->cl_parent);
1189
1190 hfsc_purge_queue(sch, cl); 1190 hfsc_purge_queue(sch, cl);
1191 list_del(&cl->hlist);
1192
1191 if (--cl->refcnt == 0) 1193 if (--cl->refcnt == 0)
1192 hfsc_destroy_class(sch, cl); 1194 hfsc_destroy_class(sch, cl);
1193 1195
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 97cbb9aec946..3c3294d01041 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1380,15 +1380,15 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
1380 1380
1381 sch_tree_lock(sch); 1381 sch_tree_lock(sch);
1382 1382
1383 /* delete from hash and active; remainder in destroy_class */
1384 hlist_del_init(&cl->hlist);
1385
1386 if (!cl->level) { 1383 if (!cl->level) {
1387 qlen = cl->un.leaf.q->q.qlen; 1384 qlen = cl->un.leaf.q->q.qlen;
1388 qdisc_reset(cl->un.leaf.q); 1385 qdisc_reset(cl->un.leaf.q);
1389 qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen); 1386 qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen);
1390 } 1387 }
1391 1388
1389 /* delete from hash and active; remainder in destroy_class */
1390 hlist_del_init(&cl->hlist);
1391
1392 if (cl->prio_activity) 1392 if (cl->prio_activity)
1393 htb_deactivate(q, cl); 1393 htb_deactivate(q, cl);
1394 1394
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index fa82b73c965b..78d2ddb5ca18 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1046,6 +1046,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
1046 trans = list_entry(pos, struct sctp_transport, transports); 1046 trans = list_entry(pos, struct sctp_transport, transports);
1047 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) 1047 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
1048 sctp_assoc_del_peer(asoc, &trans->ipaddr); 1048 sctp_assoc_del_peer(asoc, &trans->ipaddr);
1049
1050 if (asoc->state >= SCTP_STATE_ESTABLISHED)
1051 sctp_transport_reset(trans);
1049 } 1052 }
1050 1053
1051 /* If the case is A (association restart), use 1054 /* If the case is A (association restart), use
@@ -1063,6 +1066,18 @@ void sctp_assoc_update(struct sctp_association *asoc,
1063 */ 1066 */
1064 sctp_ssnmap_clear(asoc->ssnmap); 1067 sctp_ssnmap_clear(asoc->ssnmap);
1065 1068
1069 /* Flush the ULP reassembly and ordered queue.
1070 * Any data there will now be stale and will
1071 * cause problems.
1072 */
1073 sctp_ulpq_flush(&asoc->ulpq);
1074
1075 /* reset the overall association error count so
1076 * that the restarted association doesn't get torn
1077 * down on the next retransmission timer.
1078 */
1079 asoc->overall_error_count = 0;
1080
1066 } else { 1081 } else {
1067 /* Add any peer addresses from the new association. */ 1082 /* Add any peer addresses from the new association. */
1068 list_for_each(pos, &new->peer.transport_addr_list) { 1083 list_for_each(pos, &new->peer.transport_addr_list) {
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 63fe1093b616..0b9c49b3a100 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -360,7 +360,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
360 return; 360 return;
361 } 361 }
362 362
363 read_lock(&in6_dev->lock); 363 read_lock_bh(&in6_dev->lock);
364 for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) { 364 for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) {
365 /* Add the address to the local list. */ 365 /* Add the address to the local list. */
366 addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC); 366 addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC);
@@ -374,7 +374,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
374 } 374 }
375 } 375 }
376 376
377 read_unlock(&in6_dev->lock); 377 read_unlock_bh(&in6_dev->lock);
378 rcu_read_unlock(); 378 rcu_read_unlock();
379} 379}
380 380
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 70c39eac0581..e9097cf614ba 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4342,8 +4342,24 @@ sctp_disposition_t sctp_sf_do_prm_requestheartbeat(
4342 void *arg, 4342 void *arg,
4343 sctp_cmd_seq_t *commands) 4343 sctp_cmd_seq_t *commands)
4344{ 4344{
4345 return sctp_sf_heartbeat(ep, asoc, type, (struct sctp_transport *)arg, 4345 if (SCTP_DISPOSITION_NOMEM == sctp_sf_heartbeat(ep, asoc, type,
4346 commands); 4346 (struct sctp_transport *)arg, commands))
4347 return SCTP_DISPOSITION_NOMEM;
4348
4349 /*
4350 * RFC 2960 (bis), section 8.3
4351 *
4352 * D) Request an on-demand HEARTBEAT on a specific destination
4353 * transport address of a given association.
4354 *
4355 * The endpoint should increment the respective error counter of
4356 * the destination transport address each time a HEARTBEAT is sent
4357 * to that address and not acknowledged within one RTO.
4358 *
4359 */
4360 sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_RESET,
4361 SCTP_TRANSPORT(arg));
4362 return SCTP_DISPOSITION_CONSUME;
4347} 4363}
4348 4364
4349/* 4365/*
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index a596f5308cb1..4d8c2ab864fc 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -526,3 +526,35 @@ unsigned long sctp_transport_timeout(struct sctp_transport *t)
526 timeout += jiffies; 526 timeout += jiffies;
527 return timeout; 527 return timeout;
528} 528}
529
530/* Reset transport variables to their initial values */
531void sctp_transport_reset(struct sctp_transport *t)
532{
533 struct sctp_association *asoc = t->asoc;
534
535 /* RFC 2960 (bis), Section 5.2.4
536 * All the congestion control parameters (e.g., cwnd, ssthresh)
537 * related to this peer MUST be reset to their initial values
538 * (see Section 6.2.1)
539 */
540 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
541 t->ssthresh = asoc->peer.i.a_rwnd;
542 t->rto = asoc->rto_initial;
543 t->rtt = 0;
544 t->srtt = 0;
545 t->rttvar = 0;
546
547 /* Reset these additional varibles so that we have a clean
548 * slate.
549 */
550 t->partial_bytes_acked = 0;
551 t->flight_size = 0;
552 t->error_count = 0;
553 t->rto_pending = 0;
554
555 /* Initialize the state information for SFR-CACC */
556 t->cacc.changeover_active = 0;
557 t->cacc.cycling_changeover = 0;
558 t->cacc.next_tsn_at_change = 0;
559 t->cacc.cacc_saw_newack = 0;
560}
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index f4759a9bdaee..bfb197e37da3 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -73,7 +73,7 @@ struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *ulpq,
73 73
74 74
75/* Flush the reassembly and ordering queues. */ 75/* Flush the reassembly and ordering queues. */
76static void sctp_ulpq_flush(struct sctp_ulpq *ulpq) 76void sctp_ulpq_flush(struct sctp_ulpq *ulpq)
77{ 77{
78 struct sk_buff *skb; 78 struct sk_buff *skb;
79 struct sctp_ulpevent *event; 79 struct sctp_ulpevent *event;
diff --git a/net/socket.c b/net/socket.c
index 9566e57ac7f5..ea8f81abc45c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1381,7 +1381,7 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
1381 1381
1382 err = sock_attach_fd(newsock, newfile); 1382 err = sock_attach_fd(newsock, newfile);
1383 if (err < 0) 1383 if (err < 0)
1384 goto out_fd; 1384 goto out_fd_simple;
1385 1385
1386 err = security_socket_accept(sock, newsock); 1386 err = security_socket_accept(sock, newsock);
1387 if (err) 1387 if (err)
@@ -1414,6 +1414,11 @@ out_put:
1414 fput_light(sock->file, fput_needed); 1414 fput_light(sock->file, fput_needed);
1415out: 1415out:
1416 return err; 1416 return err;
1417out_fd_simple:
1418 sock_release(newsock);
1419 put_filp(newfile);
1420 put_unused_fd(newfd);
1421 goto out_put;
1417out_fd: 1422out_fd:
1418 fput(newfile); 1423 fput(newfile);
1419 put_unused_fd(newfd); 1424 put_unused_fd(newfd);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index f6e1eb1ea720..593f62ff8521 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -779,8 +779,8 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
779 } 779 }
780 780
781 clear_bit(SK_DATA, &svsk->sk_flags); 781 clear_bit(SK_DATA, &svsk->sk_flags);
782 while ((err == kernel_recvmsg(svsk->sk_sock, &msg, NULL, 782 while ((err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
783 0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 || 783 0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 ||
784 (skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) { 784 (skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) {
785 if (err == -EAGAIN) { 785 if (err == -EAGAIN) {
786 svc_sock_received(svsk); 786 svc_sock_received(svsk);
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
deleted file mode 100644
index 41d7e32be70d..000000000000
--- a/net/wanrouter/af_wanpipe.c
+++ /dev/null
@@ -1,2600 +0,0 @@
1/*****************************************************************************
2* af_wanpipe.c WANPIPE(tm) Secure Socket Layer.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Due Credit:
14* Wanpipe socket layer is based on Packet and
15* the X25 socket layers. The above sockets were
16* used for the specific use of Sangoma Technologies
17* API programs.
18* Packet socket Authors: Ross Biro, Fred N. van Kempen and
19* Alan Cox.
20* X25 socket Author: Jonathan Naylor.
21* ============================================================================
22* Mar 15, 2002 Arnaldo C. Melo o Use wp_sk()->num, as it isnt anymore in sock
23* Apr 25, 2000 Nenad Corbic o Added the ability to send zero length packets.
24* Mar 13, 2000 Nenad Corbic o Added a tx buffer check via ioctl call.
25* Mar 06, 2000 Nenad Corbic o Fixed the corrupt sock lcn problem.
26* Server and client application can run
27* simultaneously without conflicts.
28* Feb 29, 2000 Nenad Corbic o Added support for PVC protocols, such as
29* CHDLC, Frame Relay and HDLC API.
30* Jan 17, 2000 Nenad Corbic o Initial version, based on AF_PACKET socket.
31* X25API support only.
32*
33******************************************************************************/
34
35#include <linux/types.h>
36#include <linux/sched.h>
37#include <linux/mm.h>
38#include <linux/capability.h>
39#include <linux/fcntl.h>
40#include <linux/socket.h>
41#include <linux/in.h>
42#include <linux/inet.h>
43#include <linux/netdevice.h>
44#include <linux/poll.h>
45#include <linux/wireless.h>
46#include <linux/kmod.h>
47#include <net/ip.h>
48#include <net/protocol.h>
49#include <linux/skbuff.h>
50#include <net/sock.h>
51#include <linux/errno.h>
52#include <linux/timer.h>
53#include <asm/system.h>
54#include <asm/uaccess.h>
55#include <linux/module.h>
56#include <linux/init.h>
57#include <linux/if_wanpipe.h>
58#include <linux/pkt_sched.h>
59#include <linux/tcp_states.h>
60#include <linux/if_wanpipe_common.h>
61
62#ifdef CONFIG_INET
63#include <net/inet_common.h>
64#endif
65
66#define SLOW_BACKOFF 0.1*HZ
67#define FAST_BACKOFF 0.01*HZ
68
69//#define PRINT_DEBUG
70#ifdef PRINT_DEBUG
71 #define DBG_PRINTK(format, a...) printk(format, ## a)
72#else
73 #define DBG_PRINTK(format, a...)
74#endif
75
76
77/* SECURE SOCKET IMPLEMENTATION
78 *
79 * TRANSMIT:
80 *
81 * When the user sends a packet via send() system call
82 * the wanpipe_sendmsg() function is executed.
83 *
84 * Each packet is enqueud into sk->sk_write_queue transmit
85 * queue. When the packet is enqueued, a delayed transmit
86 * timer is triggerd which acts as a Bottom Half hander.
87 *
88 * wanpipe_delay_transmit() function (BH), dequeues packets
89 * from the sk->sk_write_queue transmit queue and sends it
90 * to the deriver via dev->hard_start_xmit(skb, dev) function.
91 * Note, this function is actual a function pointer of if_send()
92 * routine in the wanpipe driver.
93 *
94 * X25API GUARANTEED DELIVERY:
95 *
96 * In order to provide 100% guaranteed packet delivery,
97 * an atomic 'packet_sent' counter is implemented. Counter
98 * is incremented for each packet enqueued
99 * into sk->sk_write_queue. Counter is decremented each
100 * time wanpipe_delayed_transmit() function successfuly
101 * passes the packet to the driver. Before each send(), a poll
102 * routine checks the sock resources The maximum value of
103 * packet sent counter is 1, thus if one packet is queued, the
104 * application will block until that packet is passed to the
105 * driver.
106 *
107 * RECEIVE:
108 *
109 * Wanpipe device drivers call the socket bottom half
110 * function, wanpipe_rcv() to queue the incoming packets
111 * into an AF_WANPIPE socket queue. Based on wanpipe_rcv()
112 * return code, the driver knows whether the packet was
113 * successfully queued. If the socket queue is full,
114 * protocol flow control is used by the driver, if any,
115 * to slow down the traffic until the sock queue is free.
116 *
117 * Every time a packet arrives into a socket queue the
118 * socket wakes up processes which are waiting to receive
119 * data.
120 *
121 * If the socket queue is full, the driver sets a block
122 * bit which signals the socket to kick the wanpipe driver
123 * bottom half hander when the socket queue is partialy
124 * empty. wanpipe_recvmsg() function performs this action.
125 *
126 * In case of x25api, packets will never be dropped, since
127 * flow control is available.
128 *
129 * In case of streaming protocols like CHDLC, packets will
130 * be dropped but the statistics will be generated.
131 */
132
133
134/* The code below is used to test memory leaks. It prints out
135 * a message every time kmalloc and kfree system calls get executed.
136 * If the calls match there is no leak :)
137 */
138
139/***********FOR DEBUGGING PURPOSES*********************************************
140#define KMEM_SAFETYZONE 8
141
142static void * dbg_kmalloc(unsigned int size, int prio, int line) {
143 void * v = kmalloc(size,prio);
144 printk(KERN_INFO "line %d kmalloc(%d,%d) = %p\n",line,size,prio,v);
145 return v;
146}
147static void dbg_kfree(void * v, int line) {
148 printk(KERN_INFO "line %d kfree(%p)\n",line,v);
149 kfree(v);
150}
151
152#define kmalloc(x,y) dbg_kmalloc(x,y,__LINE__)
153#define kfree(x) dbg_kfree(x,__LINE__)
154******************************************************************************/
155
156
157/* List of all wanpipe sockets. */
158HLIST_HEAD(wanpipe_sklist);
159static DEFINE_RWLOCK(wanpipe_sklist_lock);
160
161atomic_t wanpipe_socks_nr;
162static unsigned long wanpipe_tx_critical;
163
164#if 0
165/* Private wanpipe socket structures. */
166struct wanpipe_opt
167{
168 void *mbox; /* Mail box */
169 void *card; /* Card bouded to */
170 struct net_device *dev; /* Bounded device */
171 unsigned short lcn; /* Binded LCN */
172 unsigned char svc; /* 0=pvc, 1=svc */
173 unsigned char timer; /* flag for delayed transmit*/
174 struct timer_list tx_timer;
175 unsigned poll_cnt;
176 unsigned char force; /* Used to force sock release */
177 atomic_t packet_sent;
178};
179#endif
180
181static int sk_count;
182extern const struct proto_ops wanpipe_ops;
183static unsigned long find_free_critical;
184
185static void wanpipe_unlink_driver(struct sock *sk);
186static void wanpipe_link_driver(struct net_device *dev, struct sock *sk);
187static void wanpipe_wakeup_driver(struct sock *sk);
188static int execute_command(struct sock *, unsigned char, unsigned int);
189static int check_dev(struct net_device *dev, sdla_t *card);
190struct net_device *wanpipe_find_free_dev(sdla_t *card);
191static void wanpipe_unlink_card (struct sock *);
192static int wanpipe_link_card (struct sock *);
193static struct sock *wanpipe_make_new(struct sock *);
194static struct sock *wanpipe_alloc_socket(void);
195static inline int get_atomic_device(struct net_device *dev);
196static int wanpipe_exec_cmd(struct sock *, int, unsigned int);
197static int get_ioctl_cmd (struct sock *, void *);
198static int set_ioctl_cmd (struct sock *, void *);
199static void release_device(struct net_device *dev);
200static void wanpipe_kill_sock_timer (unsigned long data);
201static void wanpipe_kill_sock_irq (struct sock *);
202static void wanpipe_kill_sock_accept (struct sock *);
203static int wanpipe_do_bind(struct sock *sk, struct net_device *dev,
204 int protocol);
205struct sock * get_newsk_from_skb (struct sk_buff *);
206static int wanpipe_debug (struct sock *, void *);
207static void wanpipe_delayed_transmit (unsigned long data);
208static void release_driver(struct sock *);
209static void start_cleanup_timer (struct sock *);
210static void check_write_queue(struct sock *);
211static int check_driver_busy (struct sock *);
212
213/*============================================================
214 * wanpipe_rcv
215 *
216 * Wanpipe socket bottom half handler. This function
217 * is called by the WANPIPE device drivers to queue a
218 * incoming packet into the socket receive queue.
219 * Once the packet is queued, all processes waiting to
220 * read are woken up.
221 *
222 * During socket bind, this function is bounded into
223 * WANPIPE driver private.
224 *===========================================================*/
225
226static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
227 struct sock *sk)
228{
229 struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb;
230 wanpipe_common_t *chan = dev->priv;
231 /*
232 * When we registered the protocol we saved the socket in the data
233 * field for just this event.
234 */
235
236 skb->dev = dev;
237
238 sll->sll_family = AF_WANPIPE;
239 sll->sll_hatype = dev->type;
240 sll->sll_protocol = skb->protocol;
241 sll->sll_pkttype = skb->pkt_type;
242 sll->sll_ifindex = dev->ifindex;
243 sll->sll_halen = 0;
244
245 if (dev->hard_header_parse)
246 sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
247
248 /*
249 * WAN_PACKET_DATA : Data which should be passed up the receive queue.
250 * WAN_PACKET_ASYC : Asynchronous data like place call, which should
251 * be passed up the listening sock.
252 * WAN_PACKET_ERR : Asynchronous data like clear call or restart
253 * which should go into an error queue.
254 */
255 switch (skb->pkt_type){
256
257 case WAN_PACKET_DATA:
258 if (sock_queue_rcv_skb(sk,skb)<0){
259 return -ENOMEM;
260 }
261 break;
262 case WAN_PACKET_CMD:
263 sk->sk_state = chan->state;
264 /* Bug fix: update Mar6.
265 * Do not set the sock lcn number here, since
266 * cmd is not guaranteed to be executed on the
267 * board, thus Lcn could be wrong */
268 sk->sk_data_ready(sk, skb->len);
269 kfree_skb(skb);
270 break;
271 case WAN_PACKET_ERR:
272 sk->sk_state = chan->state;
273 if (sock_queue_err_skb(sk,skb)<0){
274 return -ENOMEM;
275 }
276 break;
277 default:
278 printk(KERN_INFO "wansock: BH Illegal Packet Type Dropping\n");
279 kfree_skb(skb);
280 break;
281 }
282
283//??????????????????????
284// if (sk->sk_state == WANSOCK_DISCONNECTED){
285// if (sk->sk_zapped) {
286// //printk(KERN_INFO "wansock: Disconnected, killing early\n");
287// wanpipe_unlink_driver(sk);
288// sk->sk_bound_dev_if = 0;
289// }
290// }
291
292 return 0;
293}
294
295/*============================================================
296 * wanpipe_listen_rcv
297 *
298 * Wanpipe LISTEN socket bottom half handler. This function
299 * is called by the WANPIPE device drivers to queue an
300 * incoming call into the socket listening queue.
301 * Once the packet is queued, the waiting accept() process
302 * is woken up.
303 *
304 * During socket bind, this function is bounded into
305 * WANPIPE driver private.
306 *
307 * IMPORTANT NOTE:
308 * The accept call() is waiting for an skb packet
309 * which contains a pointer to a device structure.
310 *
311 * When we do a bind to a device structre, we
312 * bind a newly created socket into "chan->sk". Thus,
313 * when accept receives the skb packet, it will know
314 * from which dev it came form, and in turn it will know
315 * the address of the new sock.
316 *
317 * NOTE: This function gets called from driver ISR.
318 *===========================================================*/
319
320static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
321{
322 wanpipe_opt *wp = wp_sk(sk), *newwp;
323 struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb;
324 struct sock *newsk;
325 struct net_device *dev;
326 sdla_t *card;
327 mbox_cmd_t *mbox_ptr;
328 wanpipe_common_t *chan;
329
330 /* Find a free device, if none found, all svc's are busy
331 */
332
333 card = (sdla_t*)wp->card;
334 if (!card){
335 printk(KERN_INFO "wansock: LISTEN ERROR, No Card\n");
336 return -ENODEV;
337 }
338
339 dev = wanpipe_find_free_dev(card);
340 if (!dev){
341 printk(KERN_INFO "wansock: LISTEN ERROR, No Free Device\n");
342 return -ENODEV;
343 }
344
345 chan=dev->priv;
346 chan->state = WANSOCK_CONNECTING;
347
348 /* Allocate a new sock, which accept will bind
349 * and pass up to the user
350 */
351 if ((newsk = wanpipe_make_new(sk)) == NULL){
352 release_device(dev);
353 return -ENOMEM;
354 }
355
356
357 /* Initialize the new sock structure
358 */
359 newsk->sk_bound_dev_if = dev->ifindex;
360 newwp = wp_sk(newsk);
361 newwp->card = wp->card;
362
363 /* Insert the sock into the main wanpipe
364 * sock list.
365 */
366 atomic_inc(&wanpipe_socks_nr);
367
368 /* Allocate and fill in the new Mail Box. Then
369 * bind the mail box to the sock. It will be
370 * used by the ioctl call to read call information
371 * and to execute commands.
372 */
373 if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
374 wanpipe_kill_sock_irq (newsk);
375 release_device(dev);
376 return -ENOMEM;
377 }
378 memcpy(mbox_ptr,skb->data,skb->len);
379
380 /* Register the lcn on which incoming call came
381 * from. Thus, if we have to clear it, we know
382 * which lcn to clear
383 */
384
385 newwp->lcn = mbox_ptr->cmd.lcn;
386 newwp->mbox = (void *)mbox_ptr;
387
388 DBG_PRINTK(KERN_INFO "NEWSOCK : Device %s, bind to lcn %i\n",
389 dev->name,mbox_ptr->cmd.lcn);
390
391 chan->lcn = mbox_ptr->cmd.lcn;
392 card->u.x.svc_to_dev_map[(chan->lcn%MAX_X25_LCN)] = dev;
393
394 sock_reset_flag(newsk, SOCK_ZAPPED);
395 newwp->num = htons(X25_PROT);
396
397 if (wanpipe_do_bind(newsk, dev, newwp->num)) {
398 wanpipe_kill_sock_irq (newsk);
399 release_device(dev);
400 return -EINVAL;
401 }
402 newsk->sk_state = WANSOCK_CONNECTING;
403
404
405 /* Fill in the standard sock address info */
406
407 sll->sll_family = AF_WANPIPE;
408 sll->sll_hatype = dev->type;
409 sll->sll_protocol = skb->protocol;
410 sll->sll_pkttype = skb->pkt_type;
411 sll->sll_ifindex = dev->ifindex;
412 sll->sll_halen = 0;
413
414 skb->dev = dev;
415 sk->sk_ack_backlog++;
416
417 /* We must do this manually, since the sock_queue_rcv_skb()
418 * function sets the skb->dev to NULL. However, we use
419 * the dev field in the accept function.*/
420 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
421 (unsigned)sk->sk_rcvbuf) {
422
423 wanpipe_unlink_driver(newsk);
424 wanpipe_kill_sock_irq (newsk);
425 --sk->sk_ack_backlog;
426 return -ENOMEM;
427 }
428
429 skb_set_owner_r(skb, sk);
430 skb_queue_tail(&sk->sk_receive_queue, skb);
431 sk->sk_data_ready(sk, skb->len);
432
433 return 0;
434}
435
436
437
438/*============================================================
439 * wanpipe_make_new
440 *
441 * Create a new sock, and allocate a wanpipe private
442 * structure to it. Also, copy the important data
443 * from the original sock to the new sock.
444 *
445 * This function is used by wanpipe_listen_rcv() listen
446 * bottom half handler. A copy of the listening sock
447 * is created using this function.
448 *
449 *===========================================================*/
450
451static struct sock *wanpipe_make_new(struct sock *osk)
452{
453 struct sock *sk;
454
455 if (osk->sk_type != SOCK_RAW)
456 return NULL;
457
458 if ((sk = wanpipe_alloc_socket()) == NULL)
459 return NULL;
460
461 sk->sk_type = osk->sk_type;
462 sk->sk_socket = osk->sk_socket;
463 sk->sk_priority = osk->sk_priority;
464 sk->sk_protocol = osk->sk_protocol;
465 wp_sk(sk)->num = wp_sk(osk)->num;
466 sk->sk_rcvbuf = osk->sk_rcvbuf;
467 sk->sk_sndbuf = osk->sk_sndbuf;
468 sk->sk_state = WANSOCK_CONNECTING;
469 sk->sk_sleep = osk->sk_sleep;
470
471 if (sock_flag(osk, SOCK_DBG))
472 sock_set_flag(sk, SOCK_DBG);
473
474 return sk;
475}
476
477/*
478 * FIXME: wanpipe_opt has to include a sock in its definition and stop using
479 * sk_protinfo, but this code is not even compilable now, so lets leave it for
480 * later.
481 */
482static struct proto wanpipe_proto = {
483 .name = "WANPIPE",
484 .owner = THIS_MODULE,
485 .obj_size = sizeof(struct sock),
486};
487
488/*============================================================
489 * wanpipe_make_new
490 *
491 * Allocate memory for the a new sock, and sock
492 * private data.
493 *
494 * Increment the module use count.
495 *
496 * This function is used by wanpipe_create() and
497 * wanpipe_make_new() functions.
498 *
499 *===========================================================*/
500
501static struct sock *wanpipe_alloc_socket(void)
502{
503 struct sock *sk;
504 struct wanpipe_opt *wan_opt;
505
506 if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &wanpipe_proto, 1)) == NULL)
507 return NULL;
508
509 if ((wan_opt = kzalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
510 sk_free(sk);
511 return NULL;
512 }
513
514 wp_sk(sk) = wan_opt;
515
516 /* Use timer to send data to the driver. This will act
517 * as a BH handler for sendmsg functions */
518 init_timer(&wan_opt->tx_timer);
519 wan_opt->tx_timer.data = (unsigned long)sk;
520 wan_opt->tx_timer.function = wanpipe_delayed_transmit;
521
522 sock_init_data(NULL, sk);
523 return sk;
524}
525
526
527/*============================================================
528 * wanpipe_sendmsg
529 *
530 * This function implements a sendto() system call,
531 * for AF_WANPIPE socket family.
532 * During socket bind() sk->sk_bound_dev_if is initialized
533 * to a correct network device. This number is used
534 * to find a network device to which the packet should
535 * be passed to.
536 *
537 * Each packet is queued into sk->sk_write_queue and
538 * delayed transmit bottom half handler is marked for
539 * execution.
540 *
541 * A socket must be in WANSOCK_CONNECTED state before
542 * a packet is queued into sk->sk_write_queue.
543 *===========================================================*/
544
545static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
546 struct msghdr *msg, int len)
547{
548 wanpipe_opt *wp;
549 struct sock *sk = sock->sk;
550 struct wan_sockaddr_ll *saddr=(struct wan_sockaddr_ll *)msg->msg_name;
551 struct sk_buff *skb;
552 struct net_device *dev;
553 unsigned short proto;
554 unsigned char *addr;
555 int ifindex, err, reserve = 0;
556
557
558 if (!sock_flag(sk, SOCK_ZAPPED))
559 return -ENETDOWN;
560
561 if (sk->sk_state != WANSOCK_CONNECTED)
562 return -ENOTCONN;
563
564 if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
565 return(-EINVAL);
566
567 /* it was <=, now one can send
568 * zero length packets */
569 if (len < sizeof(x25api_hdr_t))
570 return -EINVAL;
571
572 wp = wp_sk(sk);
573
574 if (saddr == NULL) {
575 ifindex = sk->sk_bound_dev_if;
576 proto = wp->num;
577 addr = NULL;
578
579 }else{
580 if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){
581 return -EINVAL;
582 }
583
584 ifindex = sk->sk_bound_dev_if;
585 proto = saddr->sll_protocol;
586 addr = saddr->sll_addr;
587 }
588
589 dev = dev_get_by_index(ifindex);
590 if (dev == NULL){
591 printk(KERN_INFO "wansock: Send failed, dev index: %i\n",ifindex);
592 return -ENXIO;
593 }
594 dev_put(dev);
595
596 if (sock->type == SOCK_RAW)
597 reserve = dev->hard_header_len;
598
599 if (len > dev->mtu+reserve){
600 return -EMSGSIZE;
601 }
602
603 skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev),
604 msg->msg_flags & MSG_DONTWAIT, &err);
605
606 if (skb==NULL){
607 goto out_unlock;
608 }
609
610 skb_reserve(skb, LL_RESERVED_SPACE(dev));
611 skb->nh.raw = skb->data;
612
613 /* Returns -EFAULT on error */
614 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
615 if (err){
616 goto out_free;
617 }
618
619 if (dev->hard_header) {
620 int res;
621 err = -EINVAL;
622 res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len);
623 if (res<0){
624 goto out_free;
625 }
626 }
627
628 skb->protocol = proto;
629 skb->dev = dev;
630 skb->priority = sk->sk_priority;
631 skb->pkt_type = WAN_PACKET_DATA;
632
633 err = -ENETDOWN;
634 if (!(dev->flags & IFF_UP))
635 goto out_free;
636
637 if (atomic_read(&sk->sk_wmem_alloc) + skb->truesize >
638 (unsigned int)sk->sk_sndbuf){
639 kfree_skb(skb);
640 return -ENOBUFS;
641 }
642
643 skb_queue_tail(&sk->sk_write_queue,skb);
644 atomic_inc(&wp->packet_sent);
645
646 if (!(test_and_set_bit(0, &wp->timer)))
647 mod_timer(&wp->tx_timer, jiffies + 1);
648
649 return(len);
650
651out_free:
652 kfree_skb(skb);
653out_unlock:
654 return err;
655}
656
657/*============================================================
658 * wanpipe_delayed_tarnsmit
659 *
660 * Transmit bottom half handler. It dequeues packets
661 * from sk->sk_write_queue and passes them to the
662 * driver. If the driver is busy, the packet is
663 * re-enqueued.
664 *
665 * Packet Sent counter is decremented on successful
666 * transmission.
667 *===========================================================*/
668
669
670static void wanpipe_delayed_transmit (unsigned long data)
671{
672 struct sock *sk=(struct sock *)data;
673 struct sk_buff *skb;
674 wanpipe_opt *wp = wp_sk(sk);
675 struct net_device *dev = wp->dev;
676 sdla_t *card = (sdla_t*)wp->card;
677
678 if (!card || !dev){
679 clear_bit(0, &wp->timer);
680 DBG_PRINTK(KERN_INFO "wansock: Transmit delay, no dev or card\n");
681 return;
682 }
683
684 if (sk->sk_state != WANSOCK_CONNECTED || !sock_flag(sk, SOCK_ZAPPED)) {
685 clear_bit(0, &wp->timer);
686 DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n");
687 return;
688 }
689
690 /* If driver is executing command, we must offload
691 * the board by not sending data. Otherwise a
692 * pending command will never get a free buffer
693 * to execute */
694 if (atomic_read(&card->u.x.command_busy)){
695 wp->tx_timer.expires = jiffies + SLOW_BACKOFF;
696 add_timer(&wp->tx_timer);
697 DBG_PRINTK(KERN_INFO "wansock: Tx Timer, command bys BACKOFF\n");
698 return;
699 }
700
701
702 if (test_and_set_bit(0,&wanpipe_tx_critical)){
703 printk(KERN_INFO "WanSock: Tx timer critical %s\n",dev->name);
704 wp->tx_timer.expires = jiffies + SLOW_BACKOFF;
705 add_timer(&wp->tx_timer);
706 return;
707 }
708
709 /* Check for a packet in the fifo and send */
710 if ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL){
711
712 if (dev->hard_start_xmit(skb, dev) != 0){
713
714 /* Driver failed to transmit, re-enqueue
715 * the packet and retry again later */
716 skb_queue_head(&sk->sk_write_queue,skb);
717 clear_bit(0,&wanpipe_tx_critical);
718 return;
719 }else{
720
721 /* Packet Sent successful. Check for more packets
722 * if more packets, re-trigger the transmit routine
723 * other wise exit
724 */
725 atomic_dec(&wp->packet_sent);
726
727 if (skb_peek(&sk->sk_write_queue) == NULL) {
728 /* If there is nothing to send, kick
729 * the poll routine, which will trigger
730 * the application to send more data */
731 sk->sk_data_ready(sk, 0);
732 clear_bit(0, &wp->timer);
733 }else{
734 /* Reschedule as fast as possible */
735 wp->tx_timer.expires = jiffies + 1;
736 add_timer(&wp->tx_timer);
737 }
738 }
739 }
740 clear_bit(0,&wanpipe_tx_critical);
741}
742
743/*============================================================
744 * execute_command
745 *
746 * Execute x25api commands. The atomic variable
747 * chan->command is used to indicate to the driver that
748 * command is pending for execution. The acutal command
749 * structure is placed into a sock mbox structure
750 * (wp_sk(sk)->mbox).
751 *
752 * The sock private structure, mbox is
753 * used as shared memory between sock and the driver.
754 * Driver uses the sock mbox to execute the command
755 * and return the result.
756 *
757 * For all command except PLACE CALL, the function
758 * waits for the result. PLACE CALL can be ether
759 * blocking or nonblocking. The user sets this option
760 * via ioctl call.
761 *===========================================================*/
762
763
764static int execute_command(struct sock *sk, unsigned char cmd, unsigned int flags)
765{
766 wanpipe_opt *wp = wp_sk(sk);
767 struct net_device *dev;
768 wanpipe_common_t *chan=NULL;
769 int err=0;
770 DECLARE_WAITQUEUE(wait, current);
771
772 dev = dev_get_by_index(sk->sk_bound_dev_if);
773 if (dev == NULL){
774 printk(KERN_INFO "wansock: Exec failed no dev %i\n",
775 sk->sk_bound_dev_if);
776 return -ENODEV;
777 }
778 dev_put(dev);
779
780 if ((chan=dev->priv) == NULL){
781 printk(KERN_INFO "wansock: Exec cmd failed no priv area\n");
782 return -ENODEV;
783 }
784
785 if (atomic_read(&chan->command)){
786 printk(KERN_INFO "wansock: ERROR: Command already running %x, %s\n",
787 atomic_read(&chan->command),dev->name);
788 return -EINVAL;
789 }
790
791 if (!wp->mbox) {
792 printk(KERN_INFO "wansock: In execute without MBOX\n");
793 return -EINVAL;
794 }
795
796 ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd;
797 ((mbox_cmd_t*)wp->mbox)->cmd.lcn = wp->lcn;
798 ((mbox_cmd_t*)wp->mbox)->cmd.result = 0x7F;
799
800
801 if (flags & O_NONBLOCK){
802 cmd |= 0x80;
803 atomic_set(&chan->command, cmd);
804 }else{
805 atomic_set(&chan->command, cmd);
806 }
807
808 add_wait_queue(sk->sk_sleep,&wait);
809 current->state = TASK_INTERRUPTIBLE;
810 for (;;){
811 if (((mbox_cmd_t*)wp->mbox)->cmd.result != 0x7F) {
812 err = 0;
813 break;
814 }
815 if (signal_pending(current)) {
816 err = -ERESTARTSYS;
817 break;
818 }
819 schedule();
820 }
821 current->state = TASK_RUNNING;
822 remove_wait_queue(sk->sk_sleep,&wait);
823
824 return err;
825}
826
827/*============================================================
828 * wanpipe_destroy_timer
829 *
830 * Used by wanpipe_release, to delay release of
831 * the socket.
832 *===========================================================*/
833
834static void wanpipe_destroy_timer(unsigned long data)
835{
836 struct sock *sk=(struct sock *)data;
837 wanpipe_opt *wp = wp_sk(sk);
838
839 if ((!atomic_read(&sk->sk_wmem_alloc) &&
840 !atomic_read(&sk->sk_rmem_alloc)) ||
841 (++wp->force == 5)) {
842
843 if (atomic_read(&sk->sk_wmem_alloc) ||
844 atomic_read(&sk->sk_rmem_alloc))
845 printk(KERN_INFO "wansock: Warning, Packet Discarded due to sock shutdown!\n");
846
847 kfree(wp);
848 wp_sk(sk) = NULL;
849
850 if (atomic_read(&sk->sk_refcnt) != 1) {
851 atomic_set(&sk->sk_refcnt, 1);
852 DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :delay.\n",
853 atomic_read(&sk->sk_refcnt));
854 }
855 sock_put(sk);
856 atomic_dec(&wanpipe_socks_nr);
857 return;
858 }
859
860 sk->sk_timer.expires = jiffies + 5 * HZ;
861 add_timer(&sk->sk_timer);
862 printk(KERN_INFO "wansock: packet sk destroy delayed\n");
863}
864
865/*============================================================
866 * wanpipe_unlink_driver
867 *
868 * When the socket is released, this function is
869 * used to remove links that bind the sock and the
870 * driver together.
871 *===========================================================*/
872static void wanpipe_unlink_driver (struct sock *sk)
873{
874 struct net_device *dev;
875 wanpipe_common_t *chan=NULL;
876
877 sock_reset_flag(sk, SOCK_ZAPPED);
878 sk->sk_state = WANSOCK_DISCONNECTED;
879 wp_sk(sk)->dev = NULL;
880
881 dev = dev_get_by_index(sk->sk_bound_dev_if);
882 if (!dev){
883 printk(KERN_INFO "wansock: No dev on release\n");
884 return;
885 }
886 dev_put(dev);
887
888 if ((chan = dev->priv) == NULL){
889 printk(KERN_INFO "wansock: No Priv Area on release\n");
890 return;
891 }
892
893 set_bit(0,&chan->common_critical);
894 chan->sk=NULL;
895 chan->func=NULL;
896 chan->mbox=NULL;
897 chan->tx_timer=NULL;
898 clear_bit(0,&chan->common_critical);
899 release_device(dev);
900
901 return;
902}
903
904/*============================================================
905 * wanpipe_link_driver
906 *
907 * Upon successful bind(), sock is linked to a driver
908 * by binding in the wanpipe_rcv() bottom half handler
909 * to the driver function pointer, as well as sock and
910 * sock mailbox addresses. This way driver can pass
911 * data up the socket.
912 *===========================================================*/
913
914static void wanpipe_link_driver(struct net_device *dev, struct sock *sk)
915{
916 wanpipe_opt *wp = wp_sk(sk);
917 wanpipe_common_t *chan = dev->priv;
918 if (!chan)
919 return;
920 set_bit(0,&chan->common_critical);
921 chan->sk=sk;
922 chan->func=wanpipe_rcv;
923 chan->mbox = wp->mbox;
924 chan->tx_timer = &wp->tx_timer;
925 wp->dev = dev;
926 sock_set_flag(sk, SOCK_ZAPPED);
927 clear_bit(0,&chan->common_critical);
928}
929
930
931/*============================================================
932 * release_device
933 *
934 * During sock release, clear a critical bit, which
935 * marks the device a being taken.
936 *===========================================================*/
937
938
939static void release_device(struct net_device *dev)
940{
941 wanpipe_common_t *chan=dev->priv;
942 clear_bit(0,(void*)&chan->rw_bind);
943}
944
945/*============================================================
946 * wanpipe_release
947 *
948 * Close a PACKET socket. This is fairly simple. We
949 * immediately go to 'closed' state and remove our
950 * protocol entry in the device list.
951 *===========================================================*/
952
953static int wanpipe_release(struct socket *sock)
954{
955 wanpipe_opt *wp;
956 struct sock *sk = sock->sk;
957
958 if (!sk)
959 return 0;
960
961 wp = wp_sk(sk);
962 check_write_queue(sk);
963
964 /* Kill the tx timer, if we don't kill it now, the timer
965 * will run after we kill the sock. Timer code will
966 * try to access the sock which has been killed and cause
967 * kernel panic */
968
969 del_timer(&wp->tx_timer);
970
971 /*
972 * Unhook packet receive handler.
973 */
974
975 if (wp->num == htons(X25_PROT) &&
976 sk->sk_state != WANSOCK_DISCONNECTED && sock_flag(sk, SOCK_ZAPPED)) {
977 struct net_device *dev = dev_get_by_index(sk->sk_bound_dev_if);
978 wanpipe_common_t *chan;
979 if (dev){
980 chan=dev->priv;
981 atomic_set(&chan->disconnect,1);
982 DBG_PRINTK(KERN_INFO "wansock: Sending Clear Indication %i\n",
983 sk->sk_state);
984 dev_put(dev);
985 }
986 }
987
988 set_bit(1,&wanpipe_tx_critical);
989 write_lock(&wanpipe_sklist_lock);
990 sk_del_node_init(sk);
991 write_unlock(&wanpipe_sklist_lock);
992 clear_bit(1,&wanpipe_tx_critical);
993
994
995
996 release_driver(sk);
997
998
999 /*
1000 * Now the socket is dead. No more input will appear.
1001 */
1002
1003 sk->sk_state_change(sk); /* It is useless. Just for sanity. */
1004
1005 sock->sk = NULL;
1006 sk->sk_socket = NULL;
1007 sock_set_flag(sk, SOCK_DEAD);
1008
1009 /* Purge queues */
1010 skb_queue_purge(&sk->sk_receive_queue);
1011 skb_queue_purge(&sk->sk_write_queue);
1012 skb_queue_purge(&sk->sk_error_queue);
1013
1014 if (atomic_read(&sk->sk_rmem_alloc) ||
1015 atomic_read(&sk->sk_wmem_alloc)) {
1016 del_timer(&sk->sk_timer);
1017 printk(KERN_INFO "wansock: Killing in Timer R %i , W %i\n",
1018 atomic_read(&sk->sk_rmem_alloc),
1019 atomic_read(&sk->sk_wmem_alloc));
1020 sk->sk_timer.data = (unsigned long)sk;
1021 sk->sk_timer.expires = jiffies + HZ;
1022 sk->sk_timer.function = wanpipe_destroy_timer;
1023 add_timer(&sk->sk_timer);
1024 return 0;
1025 }
1026
1027 kfree(wp);
1028 wp_sk(sk) = NULL;
1029
1030 if (atomic_read(&sk->sk_refcnt) != 1) {
1031 DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i !:release.\n",
1032 atomic_read(&sk->sk_refcnt));
1033 atomic_set(&sk->sk_refcnt, 1);
1034 }
1035 sock_put(sk);
1036 atomic_dec(&wanpipe_socks_nr);
1037 return 0;
1038}
1039
1040/*============================================================
1041 * check_write_queue
1042 *
1043 * During sock shutdown, if the sock state is
1044 * WANSOCK_CONNECTED and there is transmit data
1045 * pending. Wait until data is released
1046 * before proceeding.
1047 *===========================================================*/
1048
1049static void check_write_queue(struct sock *sk)
1050{
1051
1052 if (sk->sk_state != WANSOCK_CONNECTED)
1053 return;
1054
1055 if (!atomic_read(&sk->sk_wmem_alloc))
1056 return;
1057
1058 printk(KERN_INFO "wansock: MAJOR ERROR, Data lost on sock release !!!\n");
1059
1060}
1061
1062/*============================================================
1063 * release_driver
1064 *
1065 * This function is called during sock shutdown, to
1066 * release any resources and links that bind the sock
1067 * to the driver. It also changes the state of the
1068 * sock to WANSOCK_DISCONNECTED
1069 *===========================================================*/
1070
1071static void release_driver(struct sock *sk)
1072{
1073 wanpipe_opt *wp;
1074 struct sk_buff *skb=NULL;
1075 struct sock *deadsk=NULL;
1076
1077 if (sk->sk_state == WANSOCK_LISTEN ||
1078 sk->sk_state == WANSOCK_BIND_LISTEN) {
1079 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
1080 if ((deadsk = get_newsk_from_skb(skb))){
1081 DBG_PRINTK (KERN_INFO "wansock: RELEASE: FOUND DEAD SOCK\n");
1082 sock_set_flag(deadsk, SOCK_DEAD);
1083 start_cleanup_timer(deadsk);
1084 }
1085 kfree_skb(skb);
1086 }
1087 if (sock_flag(sk, SOCK_ZAPPED))
1088 wanpipe_unlink_card(sk);
1089 }else{
1090 if (sock_flag(sk, SOCK_ZAPPED))
1091 wanpipe_unlink_driver(sk);
1092 }
1093 sk->sk_state = WANSOCK_DISCONNECTED;
1094 sk->sk_bound_dev_if = 0;
1095 sock_reset_flag(sk, SOCK_ZAPPED);
1096 wp = wp_sk(sk);
1097
1098 if (wp) {
1099 kfree(wp->mbox);
1100 wp->mbox = NULL;
1101 }
1102}
1103
1104/*============================================================
1105 * start_cleanup_timer
1106 *
1107 * If new incoming call's are pending but the socket
1108 * is being released, start the timer which will
1109 * envoke the kill routines for pending socks.
1110 *===========================================================*/
1111
1112
1113static void start_cleanup_timer (struct sock *sk)
1114{
1115 del_timer(&sk->sk_timer);
1116 sk->sk_timer.data = (unsigned long)sk;
1117 sk->sk_timer.expires = jiffies + HZ;
1118 sk->sk_timer.function = wanpipe_kill_sock_timer;
1119 add_timer(&sk->sk_timer);
1120}
1121
1122
1123/*============================================================
1124 * wanpipe_kill_sock
1125 *
1126 * This is a function which performs actual killing
1127 * of the sock. It releases socket resources,
1128 * and unlinks the sock from the driver.
1129 *===========================================================*/
1130
1131static void wanpipe_kill_sock_timer (unsigned long data)
1132{
1133
1134 struct sock *sk = (struct sock *)data;
1135 struct sock **skp;
1136
1137 if (!sk)
1138 return;
1139
1140 /* This function can be called from interrupt. We must use
1141 * appropriate locks */
1142
1143 if (test_bit(1,&wanpipe_tx_critical)){
1144 sk->sk_timer.expires = jiffies + 10;
1145 add_timer(&sk->sk_timer);
1146 return;
1147 }
1148
1149 write_lock(&wanpipe_sklist_lock);
1150 sk_del_node_init(sk);
1151 write_unlock(&wanpipe_sklist_lock);
1152
1153
1154 if (wp_sk(sk)->num == htons(X25_PROT) &&
1155 sk->sk_state != WANSOCK_DISCONNECTED) {
1156 struct net_device *dev = dev_get_by_index(sk->sk_bound_dev_if);
1157 wanpipe_common_t *chan;
1158 if (dev){
1159 chan=dev->priv;
1160 atomic_set(&chan->disconnect,1);
1161 dev_put(dev);
1162 }
1163 }
1164
1165 release_driver(sk);
1166
1167 sk->sk_socket = NULL;
1168
1169 /* Purge queues */
1170 skb_queue_purge(&sk->sk_receive_queue);
1171 skb_queue_purge(&sk->sk_write_queue);
1172 skb_queue_purge(&sk->sk_error_queue);
1173
1174 if (atomic_read(&sk->sk_rmem_alloc) ||
1175 atomic_read(&sk->sk_wmem_alloc)) {
1176 del_timer(&sk->sk_timer);
1177 printk(KERN_INFO "wansock: Killing SOCK in Timer\n");
1178 sk->sk_timer.data = (unsigned long)sk;
1179 sk->sk_timer.expires = jiffies + HZ;
1180 sk->sk_timer.function = wanpipe_destroy_timer;
1181 add_timer(&sk->sk_timer);
1182 return;
1183 }
1184
1185 kfree(wp_sk(sk));
1186 wp_sk(sk) = NULL;
1187
1188 if (atomic_read(&sk->sk_refcnt) != 1) {
1189 atomic_set(&sk->sk_refcnt, 1);
1190 DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :timer.\n",
1191 atomic_read(&sk->sk_refcnt));
1192 }
1193 sock_put(sk);
1194 atomic_dec(&wanpipe_socks_nr);
1195 return;
1196}
1197
1198static void wanpipe_kill_sock_accept (struct sock *sk)
1199{
1200
1201 struct sock **skp;
1202
1203 if (!sk)
1204 return;
1205
1206 /* This function can be called from interrupt. We must use
1207 * appropriate locks */
1208
1209 write_lock(&wanpipe_sklist_lock);
1210 sk_del_node_init(sk);
1211 write_unlock(&wanpipe_sklist_lock);
1212
1213 sk->sk_socket = NULL;
1214
1215
1216 kfree(wp_sk(sk));
1217 wp_sk(sk) = NULL;
1218
1219 if (atomic_read(&sk->sk_refcnt) != 1) {
1220 atomic_set(&sk->sk_refcnt, 1);
1221 DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :timer.\n",
1222 atomic_read(&sk->sk_refcnt));
1223 }
1224 sock_put(sk);
1225 atomic_dec(&wanpipe_socks_nr);
1226 return;
1227}
1228
1229
1230static void wanpipe_kill_sock_irq (struct sock *sk)
1231{
1232
1233 if (!sk)
1234 return;
1235
1236 sk->sk_socket = NULL;
1237
1238 kfree(wp_sk(sk));
1239 wp_sk(sk) = NULL;
1240
1241 if (atomic_read(&sk->sk_refcnt) != 1) {
1242 atomic_set(&sk->sk_refcnt, 1);
1243 DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i !:listen.\n",
1244 atomic_read(&sk->sk_refcnt));
1245 }
1246 sock_put(sk);
1247 atomic_dec(&wanpipe_socks_nr);
1248}
1249
1250
1251/*============================================================
1252 * wanpipe_do_bind
1253 *
1254 * Bottom half of the binding system call.
1255 * Once the wanpipe_bind() function checks the
1256 * legality of the call, this function binds the
1257 * sock to the driver.
1258 *===========================================================*/
1259
1260static int wanpipe_do_bind(struct sock *sk, struct net_device *dev,
1261 int protocol)
1262{
1263 wanpipe_opt *wp = wp_sk(sk);
1264 wanpipe_common_t *chan=NULL;
1265 int err=0;
1266
1267 if (sock_flag(sk, SOCK_ZAPPED)) {
1268 err = -EALREADY;
1269 goto bind_unlock_exit;
1270 }
1271
1272 wp->num = protocol;
1273
1274 if (protocol == 0){
1275 release_device(dev);
1276 err = -EINVAL;
1277 goto bind_unlock_exit;
1278 }
1279
1280 if (dev) {
1281 if (dev->flags&IFF_UP) {
1282 chan=dev->priv;
1283 sk->sk_state = chan->state;
1284
1285 if (wp->num == htons(X25_PROT) &&
1286 sk->sk_state != WANSOCK_DISCONNECTED &&
1287 sk->sk_state != WANSOCK_CONNECTING) {
1288 DBG_PRINTK(KERN_INFO
1289 "wansock: Binding to Device not DISCONNECTED %i\n",
1290 sk->sk_state);
1291 release_device(dev);
1292 err = -EAGAIN;
1293 goto bind_unlock_exit;
1294 }
1295
1296 wanpipe_link_driver(dev,sk);
1297 sk->sk_bound_dev_if = dev->ifindex;
1298
1299 /* X25 Specific option */
1300 if (wp->num == htons(X25_PROT))
1301 wp_sk(sk)->svc = chan->svc;
1302
1303 } else {
1304 sk->sk_err = ENETDOWN;
1305 sk->sk_error_report(sk);
1306 release_device(dev);
1307 err = -EINVAL;
1308 }
1309 } else {
1310 err = -ENODEV;
1311 }
1312bind_unlock_exit:
1313 /* FIXME where is this lock */
1314
1315 return err;
1316}
1317
1318/*============================================================
1319 * wanpipe_bind
1320 *
1321 * BIND() System call, which is bound to the AF_WANPIPE
1322 * operations structure. It checks for correct wanpipe
1323 * card name, and cross references interface names with
1324 * the card names. Thus, interface name must belong to
1325 * the actual card.
1326 *===========================================================*/
1327
1328
1329static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1330{
1331 struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr;
1332 struct sock *sk=sock->sk;
1333 wanpipe_opt *wp = wp_sk(sk);
1334 struct net_device *dev = NULL;
1335 sdla_t *card=NULL;
1336 char name[15];
1337
1338 /*
1339 * Check legality
1340 */
1341
1342 if (addr_len < sizeof(struct wan_sockaddr_ll)){
1343 printk(KERN_INFO "wansock: Address length error\n");
1344 return -EINVAL;
1345 }
1346 if (sll->sll_family != AF_WANPIPE){
1347 printk(KERN_INFO "wansock: Illegal family name specified.\n");
1348 return -EINVAL;
1349 }
1350
1351 card = wanpipe_find_card (sll->sll_card);
1352 if (!card){
1353 printk(KERN_INFO "wansock: Wanpipe card not found: %s\n",sll->sll_card);
1354 return -ENODEV;
1355 }else{
1356 wp_sk(sk)->card = (void *)card;
1357 }
1358
1359 if (!strcmp(sll->sll_device,"svc_listen")){
1360
1361 /* Bind a sock to a card structure for listening
1362 */
1363 int err=0;
1364
1365 /* This is x25 specific area if protocol doesn't
1366 * match, return error */
1367 if (sll->sll_protocol != htons(X25_PROT))
1368 return -EINVAL;
1369
1370 err= wanpipe_link_card (sk);
1371 if (err < 0)
1372 return err;
1373
1374 if (sll->sll_protocol)
1375 wp->num = sll->sll_protocol;
1376 sk->sk_state = WANSOCK_BIND_LISTEN;
1377 return 0;
1378
1379 }else if (!strcmp(sll->sll_device,"svc_connect")){
1380
1381 /* This is x25 specific area if protocol doesn't
1382 * match, return error */
1383 if (sll->sll_protocol != htons(X25_PROT))
1384 return -EINVAL;
1385
1386 /* Find a free device
1387 */
1388 dev = wanpipe_find_free_dev(card);
1389 if (dev == NULL){
1390 DBG_PRINTK(KERN_INFO "wansock: No free network devices for card %s\n",
1391 card->devname);
1392 return -EINVAL;
1393 }
1394 }else{
1395 /* Bind a socket to a interface name
1396 * This is used by PVC mostly
1397 */
1398 strlcpy(name,sll->sll_device,sizeof(name));
1399 dev = dev_get_by_name(name);
1400 if (dev == NULL){
1401 printk(KERN_INFO "wansock: Failed to get Dev from name: %s,\n",
1402 name);
1403 return -ENODEV;
1404 }
1405
1406 dev_put(dev);
1407
1408 if (check_dev(dev, card)){
1409 printk(KERN_INFO "wansock: Device %s, doesn't belong to card %s\n",
1410 dev->name, card->devname);
1411 return -EINVAL;
1412 }
1413 if (get_atomic_device (dev))
1414 return -EINVAL;
1415 }
1416
1417 return wanpipe_do_bind(sk, dev, sll->sll_protocol ? : wp->num);
1418}
1419
1420/*============================================================
1421 * get_atomic_device
1422 *
1423 * Sets a bit atomically which indicates that
1424 * the interface is taken. This avoids race conditions.
1425 *===========================================================*/
1426
1427
1428static inline int get_atomic_device(struct net_device *dev)
1429{
1430 wanpipe_common_t *chan = dev->priv;
1431 if (!test_and_set_bit(0,(void *)&chan->rw_bind)){
1432 return 0;
1433 }
1434 return 1;
1435}
1436
1437/*============================================================
1438 * check_dev
1439 *
1440 * Check that device name belongs to a particular card.
1441 *===========================================================*/
1442
1443static int check_dev(struct net_device *dev, sdla_t *card)
1444{
1445 struct net_device* tmp_dev;
1446
1447 for (tmp_dev = card->wandev.dev; tmp_dev;
1448 tmp_dev = *((struct net_device **)tmp_dev->priv)) {
1449 if (tmp_dev->ifindex == dev->ifindex){
1450 return 0;
1451 }
1452 }
1453 return 1;
1454}
1455
1456/*============================================================
1457 * wanpipe_find_free_dev
1458 *
1459 * Find a free network interface. If found set atomic
1460 * bit indicating that the interface is taken.
1461 * X25API Specific.
1462 *===========================================================*/
1463
1464struct net_device *wanpipe_find_free_dev(sdla_t *card)
1465{
1466 struct net_device* dev;
1467 volatile wanpipe_common_t *chan;
1468
1469 if (test_and_set_bit(0,&find_free_critical)){
1470 printk(KERN_INFO "CRITICAL in Find Free\n");
1471 }
1472
1473 for (dev = card->wandev.dev; dev;
1474 dev = *((struct net_device **)dev->priv)) {
1475 chan = dev->priv;
1476 if (!chan)
1477 continue;
1478 if (chan->usedby == API && chan->svc){
1479 if (!get_atomic_device (dev)){
1480 if (chan->state != WANSOCK_DISCONNECTED){
1481 release_device(dev);
1482 }else{
1483 clear_bit(0,&find_free_critical);
1484 return dev;
1485 }
1486 }
1487 }
1488 }
1489 clear_bit(0,&find_free_critical);
1490 return NULL;
1491}
1492
1493/*============================================================
1494 * wanpipe_create
1495 *
1496 * SOCKET() System call. It allocates a sock structure
1497 * and adds the socket to the wanpipe_sk_list.
1498 * Crates AF_WANPIPE socket.
1499 *===========================================================*/
1500
1501static int wanpipe_create(struct socket *sock, int protocol)
1502{
1503 struct sock *sk;
1504
1505 //FIXME: This checks for root user, SECURITY ?
1506 //if (!capable(CAP_NET_RAW))
1507 // return -EPERM;
1508
1509 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
1510 return -ESOCKTNOSUPPORT;
1511
1512 sock->state = SS_UNCONNECTED;
1513
1514 if ((sk = wanpipe_alloc_socket()) == NULL)
1515 return -ENOBUFS;
1516
1517 sk->sk_reuse = 1;
1518 sock->ops = &wanpipe_ops;
1519 sock_init_data(sock,sk);
1520
1521 sock_reset_flag(sk, SOCK_ZAPPED);
1522 sk->sk_family = PF_WANPIPE;
1523 wp_sk(sk)->num = protocol;
1524 sk->sk_state = WANSOCK_DISCONNECTED;
1525 sk->sk_ack_backlog = 0;
1526 sk->sk_bound_dev_if = 0;
1527
1528 atomic_inc(&wanpipe_socks_nr);
1529
1530 /* We must disable interrupts because the ISR
1531 * can also change the list */
1532 set_bit(1,&wanpipe_tx_critical);
1533 write_lock(&wanpipe_sklist_lock);
1534 sk_add_node(sk, &wanpipe_sklist);
1535 write_unlock(&wanpipe_sklist_lock);
1536 clear_bit(1,&wanpipe_tx_critical);
1537
1538 return(0);
1539}
1540
1541
1542/*============================================================
1543 * wanpipe_recvmsg
1544 *
1545 * Pull a packet from our receive queue and hand it
1546 * to the user. If necessary we block.
1547 *===========================================================*/
1548
1549static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock,
1550 struct msghdr *msg, int len, int flags)
1551{
1552 struct sock *sk = sock->sk;
1553 struct sk_buff *skb;
1554 int copied, err=-ENOBUFS;
1555
1556
1557 /*
1558 * If the address length field is there to be filled in, we fill
1559 * it in now.
1560 */
1561
1562 msg->msg_namelen = sizeof(struct wan_sockaddr_ll);
1563
1564 /*
1565 * Call the generic datagram receiver. This handles all sorts
1566 * of horrible races and re-entrancy so we can forget about it
1567 * in the protocol layers.
1568 *
1569 * Now it will return ENETDOWN, if device have just gone down,
1570 * but then it will block.
1571 */
1572
1573 if (flags & MSG_OOB){
1574 skb = skb_dequeue(&sk->sk_error_queue);
1575 }else{
1576 skb=skb_recv_datagram(sk,flags,1,&err);
1577 }
1578 /*
1579 * An error occurred so return it. Because skb_recv_datagram()
1580 * handles the blocking we don't see and worry about blocking
1581 * retries.
1582 */
1583
1584 if(skb==NULL)
1585 goto out;
1586
1587 /*
1588 * You lose any data beyond the buffer you gave. If it worries a
1589 * user program they can ask the device for its MTU anyway.
1590 */
1591
1592 copied = skb->len;
1593 if (copied > len)
1594 {
1595 copied=len;
1596 msg->msg_flags|=MSG_TRUNC;
1597 }
1598
1599 wanpipe_wakeup_driver(sk);
1600
1601 /* We can't use skb_copy_datagram here */
1602 err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
1603 if (err)
1604 goto out_free;
1605
1606 sock_recv_timestamp(msg, sk, skb);
1607
1608 if (msg->msg_name)
1609 memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
1610
1611 /*
1612 * Free or return the buffer as appropriate. Again this
1613 * hides all the races and re-entrancy issues from us.
1614 */
1615 err = (flags&MSG_TRUNC) ? skb->len : copied;
1616
1617out_free:
1618 skb_free_datagram(sk, skb);
1619out:
1620 return err;
1621}
1622
1623
1624/*============================================================
1625 * wanpipe_wakeup_driver
1626 *
1627 * If socket receive buffer is full and driver cannot
1628 * pass data up the sock, it sets a packet_block flag.
1629 * This function check that flag and if sock receive
1630 * queue has room it kicks the driver BH handler.
1631 *
1632 * This way, driver doesn't have to poll the sock
1633 * receive queue.
1634 *===========================================================*/
1635
1636static void wanpipe_wakeup_driver(struct sock *sk)
1637{
1638 struct net_device *dev = NULL;
1639 wanpipe_common_t *chan=NULL;
1640
1641 dev = dev_get_by_index(sk->sk_bound_dev_if);
1642 if (!dev)
1643 return;
1644
1645 dev_put(dev);
1646
1647 if ((chan = dev->priv) == NULL)
1648 return;
1649
1650 if (atomic_read(&chan->receive_block)){
1651 if (atomic_read(&sk->sk_rmem_alloc) <
1652 ((unsigned)sk->sk_rcvbuf * 0.9)) {
1653 printk(KERN_INFO "wansock: Queuing task for wanpipe\n");
1654 atomic_set(&chan->receive_block,0);
1655 wanpipe_queue_tq(&chan->wanpipe_task);
1656 wanpipe_mark_bh();
1657 }
1658 }
1659}
1660
1661/*============================================================
1662 * wanpipe_getname
1663 *
1664 * I don't know what to do with this yet.
1665 * User can use this function to get sock address
1666 * information. Not very useful for Sangoma's purposes.
1667 *===========================================================*/
1668
1669
1670static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr,
1671 int *uaddr_len, int peer)
1672{
1673 struct net_device *dev;
1674 struct sock *sk = sock->sk;
1675 struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr;
1676
1677 sll->sll_family = AF_WANPIPE;
1678 sll->sll_ifindex = sk->sk_bound_dev_if;
1679 sll->sll_protocol = wp_sk(sk)->num;
1680 dev = dev_get_by_index(sk->sk_bound_dev_if);
1681 if (dev) {
1682 sll->sll_hatype = dev->type;
1683 sll->sll_halen = dev->addr_len;
1684 memcpy(sll->sll_addr, dev->dev_addr, dev->addr_len);
1685 } else {
1686 sll->sll_hatype = 0; /* Bad: we have no ARPHRD_UNSPEC */
1687 sll->sll_halen = 0;
1688 }
1689 *uaddr_len = sizeof(*sll);
1690
1691 dev_put(dev);
1692
1693 return 0;
1694}
1695
1696/*============================================================
1697 * wanpipe_notifier
1698 *
1699 * If driver turns off network interface, this function
1700 * will be envoked. Currently I treate it as a
1701 * call disconnect. More thought should go into this
1702 * function.
1703 *
1704 * FIXME: More thought should go into this function.
1705 *
1706 *===========================================================*/
1707
1708static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void *data)
1709{
1710 struct sock *sk;
1711 hlist_node *node;
1712 struct net_device *dev = (struct net_device *)data;
1713
1714 sk_for_each(sk, node, &wanpipe_sklist) {
1715 struct wanpipe_opt *po = wp_sk(sk);
1716
1717 if (!po)
1718 continue;
1719 if (dev == NULL)
1720 continue;
1721
1722 switch (msg) {
1723 case NETDEV_DOWN:
1724 case NETDEV_UNREGISTER:
1725 if (dev->ifindex == sk->sk_bound_dev_if) {
1726 printk(KERN_INFO "wansock: Device down %s\n",dev->name);
1727 if (sock_flag(sk, SOCK_ZAPPED)) {
1728 wanpipe_unlink_driver(sk);
1729 sk->sk_err = ENETDOWN;
1730 sk->sk_error_report(sk);
1731 }
1732
1733 if (msg == NETDEV_UNREGISTER) {
1734 printk(KERN_INFO "wansock: Unregistering Device: %s\n",
1735 dev->name);
1736 wanpipe_unlink_driver(sk);
1737 sk->sk_bound_dev_if = 0;
1738 }
1739 }
1740 break;
1741 case NETDEV_UP:
1742 if (dev->ifindex == sk->sk_bound_dev_if &&
1743 po->num && !sock_flag(sk, SOCK_ZAPPED)) {
1744 printk(KERN_INFO "wansock: Registering Device: %s\n",
1745 dev->name);
1746 wanpipe_link_driver(dev,sk);
1747 }
1748 break;
1749 }
1750 }
1751 return NOTIFY_DONE;
1752}
1753
1754/*============================================================
1755 * wanpipe_ioctl
1756 *
1757 * Execute a user commands, and set socket options.
1758 *
1759 * FIXME: More thought should go into this function.
1760 *
1761 *===========================================================*/
1762
1763static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1764{
1765 struct sock *sk = sock->sk;
1766 int err;
1767
1768 switch(cmd)
1769 {
1770 case SIOCGSTAMP:
1771 return sock_get_timestamp(sk, (struct timeval __user *)arg);
1772
1773 case SIOC_WANPIPE_CHECK_TX:
1774
1775 return atomic_read(&sk->sk_wmem_alloc);
1776
1777 case SIOC_WANPIPE_SOCK_STATE:
1778
1779 if (sk->sk_state == WANSOCK_CONNECTED)
1780 return 0;
1781
1782 return 1;
1783
1784
1785 case SIOC_WANPIPE_GET_CALL_DATA:
1786
1787 return get_ioctl_cmd (sk,(void*)arg);
1788
1789 case SIOC_WANPIPE_SET_CALL_DATA:
1790
1791 return set_ioctl_cmd (sk,(void*)arg);
1792
1793 case SIOC_WANPIPE_ACCEPT_CALL:
1794 case SIOC_WANPIPE_CLEAR_CALL:
1795 case SIOC_WANPIPE_RESET_CALL:
1796
1797 if ((err=set_ioctl_cmd(sk,(void*)arg)) < 0)
1798 return err;
1799
1800 err=wanpipe_exec_cmd(sk,cmd,0);
1801 get_ioctl_cmd(sk,(void*)arg);
1802 return err;
1803
1804 case SIOC_WANPIPE_DEBUG:
1805
1806 return wanpipe_debug(sk,(void*)arg);
1807
1808 case SIOC_WANPIPE_SET_NONBLOCK:
1809
1810 if (sk->sk_state != WANSOCK_DISCONNECTED)
1811 return -EINVAL;
1812
1813 sock->file->f_flags |= O_NONBLOCK;
1814 return 0;
1815
1816#ifdef CONFIG_INET
1817 case SIOCADDRT:
1818 case SIOCDELRT:
1819 case SIOCDARP:
1820 case SIOCGARP:
1821 case SIOCSARP:
1822 case SIOCDRARP:
1823 case SIOCGRARP:
1824 case SIOCSRARP:
1825 case SIOCGIFADDR:
1826 case SIOCSIFADDR:
1827 case SIOCGIFBRDADDR:
1828 case SIOCSIFBRDADDR:
1829 case SIOCGIFNETMASK:
1830 case SIOCSIFNETMASK:
1831 case SIOCGIFDSTADDR:
1832 case SIOCSIFDSTADDR:
1833 case SIOCSIFFLAGS:
1834 return inet_dgram_ops.ioctl(sock, cmd, arg);
1835#endif
1836
1837 default:
1838 return -ENOIOCTLCMD;
1839 }
1840 /*NOTREACHED*/
1841}
1842
1843/*============================================================
1844 * wanpipe_debug
1845 *
1846 * This function will pass up information about all
1847 * active sockets.
1848 *
1849 * FIXME: More thought should go into this function.
1850 *
1851 *===========================================================*/
1852
1853static int wanpipe_debug (struct sock *origsk, void *arg)
1854{
1855 struct sock *sk;
1856 struct hlist_node *node;
1857 struct net_device *dev = NULL;
1858 wanpipe_common_t *chan=NULL;
1859 int cnt=0, err=0;
1860 wan_debug_t *dbg_data = (wan_debug_t *)arg;
1861
1862 sk_for_each(sk, node, &wanpipe_sklist) {
1863 wanpipe_opt *wp = wp_sk(sk);
1864
1865 if (sk == origsk){
1866 continue;
1867 }
1868
1869 if ((err=put_user(1, &dbg_data->debug[cnt].free)))
1870 return err;
1871 if ((err = put_user(sk->sk_state,
1872 &dbg_data->debug[cnt].state_sk)))
1873 return err;
1874 if ((err = put_user(sk->sk_rcvbuf,
1875 &dbg_data->debug[cnt].rcvbuf)))
1876 return err;
1877 if ((err = put_user(atomic_read(&sk->sk_rmem_alloc),
1878 &dbg_data->debug[cnt].rmem)))
1879 return err;
1880 if ((err = put_user(atomic_read(&sk->sk_wmem_alloc),
1881 &dbg_data->debug[cnt].wmem)))
1882 return err;
1883 if ((err = put_user(sk->sk_sndbuf,
1884 &dbg_data->debug[cnt].sndbuf)))
1885 return err;
1886 if ((err=put_user(sk_count, &dbg_data->debug[cnt].sk_count)))
1887 return err;
1888 if ((err=put_user(wp->poll_cnt, &dbg_data->debug[cnt].poll_cnt)))
1889 return err;
1890 if ((err = put_user(sk->sk_bound_dev_if,
1891 &dbg_data->debug[cnt].bound)))
1892 return err;
1893
1894 if (sk->sk_bound_dev_if) {
1895 dev = dev_get_by_index(sk->sk_bound_dev_if);
1896 if (!dev)
1897 continue;
1898
1899 chan=dev->priv;
1900 dev_put(dev);
1901
1902 if ((err=put_user(chan->state, &dbg_data->debug[cnt].d_state)))
1903 return err;
1904 if ((err=put_user(chan->svc, &dbg_data->debug[cnt].svc)))
1905 return err;
1906
1907 if ((err=put_user(atomic_read(&chan->command),
1908 &dbg_data->debug[cnt].command)))
1909 return err;
1910
1911
1912 if (wp){
1913 sdla_t *card = (sdla_t*)wp->card;
1914
1915 if (card){
1916 if ((err=put_user(atomic_read(&card->u.x.command_busy),
1917 &dbg_data->debug[cnt].cmd_busy)))
1918 return err;
1919 }
1920
1921 if ((err=put_user(wp->lcn,
1922 &dbg_data->debug[cnt].lcn)))
1923 return err;
1924
1925 if (wp->mbox) {
1926 if ((err=put_user(1, &dbg_data->debug[cnt].mbox)))
1927 return err;
1928 }
1929 }
1930
1931 if ((err=put_user(atomic_read(&chan->receive_block),
1932 &dbg_data->debug[cnt].rblock)))
1933 return err;
1934
1935 if (copy_to_user(dbg_data->debug[cnt].name, dev->name, strlen(dev->name)))
1936 return -EFAULT;
1937 }
1938
1939 if (++cnt == MAX_NUM_DEBUG)
1940 break;
1941 }
1942 return 0;
1943}
1944
1945/*============================================================
1946 * get_ioctl_cmd
1947 *
1948 * Pass up the contents of socket MBOX to the user.
1949 *===========================================================*/
1950
1951static int get_ioctl_cmd (struct sock *sk, void *arg)
1952{
1953 x25api_t *usr_data = (x25api_t *)arg;
1954 mbox_cmd_t *mbox_ptr;
1955 int err;
1956
1957 if (usr_data == NULL)
1958 return -EINVAL;
1959
1960 if (!wp_sk(sk)->mbox) {
1961 return -EINVAL;
1962 }
1963
1964 mbox_ptr = (mbox_cmd_t *)wp_sk(sk)->mbox;
1965
1966 if ((err=put_user(mbox_ptr->cmd.qdm, &usr_data->hdr.qdm)))
1967 return err;
1968 if ((err=put_user(mbox_ptr->cmd.cause, &usr_data->hdr.cause)))
1969 return err;
1970 if ((err=put_user(mbox_ptr->cmd.diagn, &usr_data->hdr.diagn)))
1971 return err;
1972 if ((err=put_user(mbox_ptr->cmd.length, &usr_data->hdr.length)))
1973 return err;
1974 if ((err=put_user(mbox_ptr->cmd.result, &usr_data->hdr.result)))
1975 return err;
1976 if ((err=put_user(mbox_ptr->cmd.lcn, &usr_data->hdr.lcn)))
1977 return err;
1978
1979 if (mbox_ptr->cmd.length > 0){
1980 if (mbox_ptr->cmd.length > X25_MAX_DATA)
1981 return -EINVAL;
1982
1983 if (copy_to_user(usr_data->data, mbox_ptr->data, mbox_ptr->cmd.length)){
1984 printk(KERN_INFO "wansock: Copy failed !!!\n");
1985 return -EFAULT;
1986 }
1987 }
1988 return 0;
1989}
1990
1991/*============================================================
1992 * set_ioctl_cmd
1993 *
1994 * Before command can be execute, socket MBOX must
1995 * be created, and initialized with user data.
1996 *===========================================================*/
1997
1998static int set_ioctl_cmd (struct sock *sk, void *arg)
1999{
2000 x25api_t *usr_data = (x25api_t *)arg;
2001 mbox_cmd_t *mbox_ptr;
2002 int err;
2003
2004 if (!wp_sk(sk)->mbox) {
2005 void *mbox_ptr;
2006 struct net_device *dev = dev_get_by_index(sk->sk_bound_dev_if);
2007 if (!dev)
2008 return -ENODEV;
2009
2010 dev_put(dev);
2011
2012 if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
2013 return -ENOMEM;
2014
2015 wp_sk(sk)->mbox = mbox_ptr;
2016
2017 wanpipe_link_driver(dev,sk);
2018 }
2019
2020 mbox_ptr = (mbox_cmd_t*)wp_sk(sk)->mbox;
2021 memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
2022
2023 if (usr_data == NULL){
2024 return 0;
2025 }
2026 if ((err=get_user(mbox_ptr->cmd.qdm, &usr_data->hdr.qdm)))
2027 return err;
2028 if ((err=get_user(mbox_ptr->cmd.cause, &usr_data->hdr.cause)))
2029 return err;
2030 if ((err=get_user(mbox_ptr->cmd.diagn, &usr_data->hdr.diagn)))
2031 return err;
2032 if ((err=get_user(mbox_ptr->cmd.length, &usr_data->hdr.length)))
2033 return err;
2034 if ((err=get_user(mbox_ptr->cmd.result, &usr_data->hdr.result)))
2035 return err;
2036
2037 if (mbox_ptr->cmd.length > 0){
2038 if (mbox_ptr->cmd.length > X25_MAX_DATA)
2039 return -EINVAL;
2040
2041 if (copy_from_user(mbox_ptr->data, usr_data->data, mbox_ptr->cmd.length)){
2042 printk(KERN_INFO "Copy failed\n");
2043 return -EFAULT;
2044 }
2045 }
2046 return 0;
2047}
2048
2049
2050/*======================================================================
2051 * wanpipe_poll
2052 *
2053 * Datagram poll: Again totally generic. This also handles
2054 * sequenced packet sockets providing the socket receive queue
2055 * is only ever holding data ready to receive.
2056 *
2057 * Note: when you _don't_ use this routine for this protocol,
2058 * and you use a different write policy from sock_writeable()
2059 * then please supply your own write_space callback.
2060 *=====================================================================*/
2061
2062unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *wait)
2063{
2064 struct sock *sk = sock->sk;
2065 unsigned int mask;
2066
2067 ++wp_sk(sk)->poll_cnt;
2068
2069 poll_wait(file, sk->sk_sleep, wait);
2070 mask = 0;
2071
2072 /* exceptional events? */
2073 if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) {
2074 mask |= POLLPRI;
2075 return mask;
2076 }
2077 if (sk->sk_shutdown & RCV_SHUTDOWN)
2078 mask |= POLLHUP;
2079
2080 /* readable? */
2081 if (!skb_queue_empty(&sk->sk_receive_queue)) {
2082 mask |= POLLIN | POLLRDNORM;
2083 }
2084
2085 /* connection hasn't started yet */
2086 if (sk->sk_state == WANSOCK_CONNECTING) {
2087 return mask;
2088 }
2089
2090 if (sk->sk_state == WANSOCK_DISCONNECTED) {
2091 mask = POLLPRI;
2092 return mask;
2093 }
2094
2095 /* This check blocks the user process if there is
2096 * a packet already queued in the socket write queue.
2097 * This option is only for X25API protocol, for other
2098 * protocol like chdlc enable streaming mode,
2099 * where multiple packets can be pending in the socket
2100 * transmit queue */
2101
2102 if (wp_sk(sk)->num == htons(X25_PROT)) {
2103 if (atomic_read(&wp_sk(sk)->packet_sent))
2104 return mask;
2105 }
2106
2107 /* writable? */
2108 if (sock_writeable(sk)){
2109 mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
2110 }else{
2111 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
2112 }
2113
2114 return mask;
2115}
2116
2117/*======================================================================
2118 * wanpipe_listen
2119 *
2120 * X25API Specific function. Set a socket into LISTENING MODE.
2121 *=====================================================================*/
2122
2123
2124static int wanpipe_listen(struct socket *sock, int backlog)
2125{
2126 struct sock *sk = sock->sk;
2127
2128 /* This is x25 specific area if protocol doesn't
2129 * match, return error */
2130 if (wp_sk(sk)->num != htons(X25_PROT))
2131 return -EINVAL;
2132
2133 if (sk->sk_state == WANSOCK_BIND_LISTEN) {
2134
2135 sk->sk_max_ack_backlog = backlog;
2136 sk->sk_state = WANSOCK_LISTEN;
2137 return 0;
2138 }else{
2139 printk(KERN_INFO "wansock: Listening sock was not binded\n");
2140 }
2141
2142 return -EINVAL;
2143}
2144
2145/*======================================================================
2146 * wanpipe_link_card
2147 *
2148 * Connects the listening socket to the driver
2149 *=====================================================================*/
2150
2151static int wanpipe_link_card (struct sock *sk)
2152{
2153 sdla_t *card = (sdla_t*)wp_sk(sk)->card;
2154
2155 if (!card)
2156 return -ENOMEM;
2157
2158 if ((card->sk != NULL) || (card->func != NULL)){
2159 printk(KERN_INFO "wansock: Listening queue is already established\n");
2160 return -EINVAL;
2161 }
2162
2163 card->sk=sk;
2164 card->func=wanpipe_listen_rcv;
2165 sock_set_flag(sk, SOCK_ZAPPED);
2166
2167 return 0;
2168}
2169
2170/*======================================================================
2171 * wanpipe_listen
2172 *
2173 * X25API Specific function. Disconnect listening socket from
2174 * the driver.
2175 *=====================================================================*/
2176
2177static void wanpipe_unlink_card (struct sock *sk)
2178{
2179 sdla_t *card = (sdla_t*)wp_sk(sk)->card;
2180
2181 if (card){
2182 card->sk=NULL;
2183 card->func=NULL;
2184 }
2185}
2186
2187/*======================================================================
2188 * wanpipe_exec_cmd
2189 *
2190 * Ioctl function calls this function to execute user command.
2191 * Connect() sytem call also calls this function to execute
2192 * place call. This function blocks until command is executed.
2193 *=====================================================================*/
2194
2195static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
2196{
2197 int err = -EINVAL;
2198 wanpipe_opt *wp = wp_sk(sk);
2199 mbox_cmd_t *mbox_ptr = (mbox_cmd_t*)wp->mbox;
2200
2201 if (!mbox_ptr){
2202 printk(KERN_INFO "NO MBOX PTR !!!!!\n");
2203 return -EINVAL;
2204 }
2205
2206 /* This is x25 specific area if protocol doesn't
2207 * match, return error */
2208 if (wp->num != htons(X25_PROT))
2209 return -EINVAL;
2210
2211
2212 switch (cmd){
2213
2214 case SIOC_WANPIPE_ACCEPT_CALL:
2215
2216 if (sk->sk_state != WANSOCK_CONNECTING) {
2217 err = -EHOSTDOWN;
2218 break;
2219 }
2220
2221 err = execute_command(sk,X25_ACCEPT_CALL,0);
2222 if (err < 0)
2223 break;
2224
2225 /* Update. Mar6 2000.
2226 * Do not set the sock lcn number here, since
2227 * it is done in wanpipe_listen_rcv().
2228 */
2229 if (sk->sk_state == WANSOCK_CONNECTED) {
2230 wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
2231 DBG_PRINTK(KERN_INFO "\nwansock: Accept OK %i\n",
2232 wp->lcn);
2233 err = 0;
2234
2235 }else{
2236 DBG_PRINTK (KERN_INFO "\nwansock: Accept Failed %i\n",
2237 wp->lcn);
2238 wp->lcn = 0;
2239 err = -ECONNREFUSED;
2240 }
2241 break;
2242
2243 case SIOC_WANPIPE_CLEAR_CALL:
2244
2245 if (sk->sk_state == WANSOCK_DISCONNECTED) {
2246 err = -EINVAL;
2247 break;
2248 }
2249
2250
2251 /* Check if data buffers are pending for transmission,
2252 * if so, check whether user wants to wait until data
2253 * is transmitted, or clear a call and drop packets */
2254
2255 if (atomic_read(&sk->sk_wmem_alloc) ||
2256 check_driver_busy(sk)) {
2257 mbox_cmd_t *mbox = wp->mbox;
2258 if (mbox->cmd.qdm & 0x80){
2259 mbox->cmd.result = 0x35;
2260 err = -EAGAIN;
2261 break;
2262 }
2263 }
2264
2265 sk->sk_state = WANSOCK_DISCONNECTING;
2266
2267 err = execute_command(sk,X25_CLEAR_CALL,0);
2268 if (err < 0)
2269 break;
2270
2271 err = -ECONNREFUSED;
2272 if (sk->sk_state == WANSOCK_DISCONNECTED) {
2273 DBG_PRINTK(KERN_INFO "\nwansock: CLEAR OK %i\n",
2274 wp->lcn);
2275 wp->lcn = 0;
2276 err = 0;
2277 }
2278 break;
2279
2280 case SIOC_WANPIPE_RESET_CALL:
2281
2282 if (sk->sk_state != WANSOCK_CONNECTED) {
2283 err = -EINVAL;
2284 break;
2285 }
2286
2287
2288 /* Check if data buffers are pending for transmission,
2289 * if so, check whether user wants to wait until data
2290 * is transmitted, or reset a call and drop packets */
2291
2292 if (atomic_read(&sk->sk_wmem_alloc) ||
2293 check_driver_busy(sk)) {
2294 mbox_cmd_t *mbox = wp->mbox;
2295 if (mbox->cmd.qdm & 0x80){
2296 mbox->cmd.result = 0x35;
2297 err = -EAGAIN;
2298 break;
2299 }
2300 }
2301
2302
2303 err = execute_command(sk, X25_RESET,0);
2304 if (err < 0)
2305 break;
2306
2307 err = mbox_ptr->cmd.result;
2308 break;
2309
2310
2311 case X25_PLACE_CALL:
2312
2313 err=execute_command(sk,X25_PLACE_CALL,flags);
2314 if (err < 0)
2315 break;
2316
2317 if (sk->sk_state == WANSOCK_CONNECTED) {
2318
2319 wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
2320
2321 DBG_PRINTK(KERN_INFO "\nwansock: PLACE CALL OK %i\n",
2322 wp->lcn);
2323 err = 0;
2324
2325 } else if (sk->sk_state == WANSOCK_CONNECTING &&
2326 (flags & O_NONBLOCK)) {
2327 wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
2328 DBG_PRINTK(KERN_INFO "\nwansock: Place Call OK: Waiting %i\n",
2329 wp->lcn);
2330
2331 err = 0;
2332
2333 }else{
2334 DBG_PRINTK(KERN_INFO "\nwansock: Place call Failed\n");
2335 err = -ECONNREFUSED;
2336 }
2337
2338 break;
2339
2340 default:
2341 return -EINVAL;
2342 }
2343
2344 return err;
2345}
2346
2347static int check_driver_busy (struct sock *sk)
2348{
2349 struct net_device *dev = dev_get_by_index(sk->sk_bound_dev_if);
2350 wanpipe_common_t *chan;
2351
2352 if (!dev)
2353 return 0;
2354
2355 dev_put(dev);
2356
2357 if ((chan=dev->priv) == NULL)
2358 return 0;
2359
2360 return atomic_read(&chan->driver_busy);
2361}
2362
2363
2364/*======================================================================
2365 * wanpipe_accept
2366 *
2367 * ACCEPT() System call. X25API Specific function.
2368 * For each incoming call, create a new socket and
2369 * return it to the user.
2370 *=====================================================================*/
2371
2372static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags)
2373{
2374 struct sock *sk;
2375 struct sock *newsk;
2376 struct sk_buff *skb;
2377 DECLARE_WAITQUEUE(wait, current);
2378 int err=0;
2379
2380 if (newsock->sk != NULL){
2381 wanpipe_kill_sock_accept(newsock->sk);
2382 newsock->sk=NULL;
2383 }
2384
2385 if ((sk = sock->sk) == NULL)
2386 return -EINVAL;
2387
2388 if (sk->sk_type != SOCK_RAW)
2389 return -EOPNOTSUPP;
2390
2391 if (sk->sk_state != WANSOCK_LISTEN)
2392 return -EINVAL;
2393
2394 if (wp_sk(sk)->num != htons(X25_PROT))
2395 return -EINVAL;
2396
2397 add_wait_queue(sk->sk_sleep,&wait);
2398 current->state = TASK_INTERRUPTIBLE;
2399 for (;;){
2400 skb = skb_dequeue(&sk->sk_receive_queue);
2401 if (skb){
2402 err=0;
2403 break;
2404 }
2405 if (signal_pending(current)) {
2406 err = -ERESTARTSYS;
2407 break;
2408 }
2409 schedule();
2410 }
2411 current->state = TASK_RUNNING;
2412 remove_wait_queue(sk->sk_sleep,&wait);
2413
2414 if (err != 0)
2415 return err;
2416
2417 newsk = get_newsk_from_skb(skb);
2418 if (!newsk){
2419 return -EINVAL;
2420 }
2421
2422 set_bit(1,&wanpipe_tx_critical);
2423 write_lock(&wanpipe_sklist_lock);
2424 sk_add_node(newsk, &wanpipe_sklist);
2425 write_unlock(&wanpipe_sklist_lock);
2426 clear_bit(1,&wanpipe_tx_critical);
2427
2428 newsk->sk_socket = newsock;
2429 newsk->sk_sleep = &newsock->wait;
2430
2431 /* Now attach up the new socket */
2432 sk->sk_ack_backlog--;
2433 newsock->sk = newsk;
2434
2435 kfree_skb(skb);
2436
2437 DBG_PRINTK(KERN_INFO "\nwansock: ACCEPT Got LCN %i\n",
2438 wp_sk(newsk)->lcn);
2439 return 0;
2440}
2441
2442/*======================================================================
2443 * get_newsk_from_skb
2444 *
2445 * Accept() uses this function to get the address of the new
2446 * socket structure.
2447 *=====================================================================*/
2448
2449struct sock * get_newsk_from_skb (struct sk_buff *skb)
2450{
2451 struct net_device *dev = skb->dev;
2452 wanpipe_common_t *chan;
2453
2454 if (!dev){
2455 return NULL;
2456 }
2457
2458 if ((chan = dev->priv) == NULL){
2459 return NULL;
2460 }
2461
2462 if (!chan->sk){
2463 return NULL;
2464 }
2465 return (struct sock *)chan->sk;
2466}
2467
2468/*======================================================================
2469 * wanpipe_connect
2470 *
2471 * CONNECT() System Call. X25API specific function
2472 * Check the state of the sock, and execute PLACE_CALL command.
2473 * Connect can ether block or return without waiting for connection,
2474 * if specified by user.
2475 *=====================================================================*/
2476
2477static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags)
2478{
2479 struct sock *sk = sock->sk;
2480 struct wan_sockaddr_ll *addr = (struct wan_sockaddr_ll*)uaddr;
2481 struct net_device *dev;
2482 int err;
2483
2484 if (wp_sk(sk)->num != htons(X25_PROT))
2485 return -EINVAL;
2486
2487 if (sk->sk_state == WANSOCK_CONNECTED)
2488 return -EISCONN; /* No reconnect on a seqpacket socket */
2489
2490 if (sk->sk_state != WAN_DISCONNECTED) {
2491 printk(KERN_INFO "wansock: Trying to connect on channel NON DISCONNECT\n");
2492 return -ECONNREFUSED;
2493 }
2494
2495 sk->sk_state = WANSOCK_DISCONNECTED;
2496 sock->state = SS_UNCONNECTED;
2497
2498 if (addr_len != sizeof(struct wan_sockaddr_ll))
2499 return -EINVAL;
2500
2501 if (addr->sll_family != AF_WANPIPE)
2502 return -EINVAL;
2503
2504 if ((dev = dev_get_by_index(sk->sk_bound_dev_if)) == NULL)
2505 return -ENETUNREACH;
2506
2507 dev_put(dev);
2508
2509 if (!sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
2510 return -EINVAL;
2511
2512 sock->state = SS_CONNECTING;
2513 sk->sk_state = WANSOCK_CONNECTING;
2514
2515 if (!wp_sk(sk)->mbox) {
2516 if (wp_sk (sk)->svc)
2517 return -EINVAL;
2518 else {
2519 int err;
2520 if ((err=set_ioctl_cmd(sk,NULL)) < 0)
2521 return err;
2522 }
2523 }
2524
2525 if ((err=wanpipe_exec_cmd(sk, X25_PLACE_CALL,flags)) != 0){
2526 sock->state = SS_UNCONNECTED;
2527 sk->sk_state = WANSOCK_CONNECTED;
2528 return err;
2529 }
2530
2531 if (sk->sk_state != WANSOCK_CONNECTED && (flags & O_NONBLOCK)) {
2532 return 0;
2533 }
2534
2535 if (sk->sk_state != WANSOCK_CONNECTED) {
2536 sock->state = SS_UNCONNECTED;
2537 return -ECONNREFUSED;
2538 }
2539
2540 sock->state = SS_CONNECTED;
2541 return 0;
2542}
2543
2544const struct proto_ops wanpipe_ops = {
2545 .family = PF_WANPIPE,
2546 .owner = THIS_MODULE,
2547 .release = wanpipe_release,
2548 .bind = wanpipe_bind,
2549 .connect = wanpipe_connect,
2550 .socketpair = sock_no_socketpair,
2551 .accept = wanpipe_accept,
2552 .getname = wanpipe_getname,
2553 .poll = wanpipe_poll,
2554 .ioctl = wanpipe_ioctl,
2555 .listen = wanpipe_listen,
2556 .shutdown = sock_no_shutdown,
2557 .setsockopt = sock_no_setsockopt,
2558 .getsockopt = sock_no_getsockopt,
2559 .sendmsg = wanpipe_sendmsg,
2560 .recvmsg = wanpipe_recvmsg
2561};
2562
2563static struct net_proto_family wanpipe_family_ops = {
2564 .family = PF_WANPIPE,
2565 .create = wanpipe_create,
2566 .owner = THIS_MODULE,
2567};
2568
2569struct notifier_block wanpipe_netdev_notifier = {
2570 .notifier_call = wanpipe_notifier,
2571};
2572
2573
2574#ifdef MODULE
2575void cleanup_module(void)
2576{
2577 printk(KERN_INFO "wansock: Cleaning up \n");
2578 unregister_netdevice_notifier(&wanpipe_netdev_notifier);
2579 sock_unregister(PF_WANPIPE);
2580 proto_unregister(&wanpipe_proto);
2581}
2582
2583int init_module(void)
2584{
2585 int rc;
2586
2587 printk(KERN_INFO "wansock: Registering Socket \n");
2588
2589 rc = proto_register(&wanpipe_proto, 0);
2590 if (rc != 0)
2591 goto out;
2592
2593 sock_register(&wanpipe_family_ops);
2594 register_netdevice_notifier(&wanpipe_netdev_notifier);
2595out:
2596 return rc;
2597}
2598#endif
2599MODULE_LICENSE("GPL");
2600MODULE_ALIAS_NETPROTO(PF_WANPIPE);
diff --git a/net/x25/x25_forward.c b/net/x25/x25_forward.c
index d339e0c810a8..8738ec7ce693 100644
--- a/net/x25/x25_forward.c
+++ b/net/x25/x25_forward.c
@@ -26,64 +26,66 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,
26 short same_lci = 0; 26 short same_lci = 0;
27 int rc = 0; 27 int rc = 0;
28 28
29 if ((rt = x25_get_route(dest_addr)) != NULL) { 29 if ((rt = x25_get_route(dest_addr)) == NULL)
30 goto out_no_route;
30 31
31 if ((neigh_new = x25_get_neigh(rt->dev)) == NULL) { 32 if ((neigh_new = x25_get_neigh(rt->dev)) == NULL) {
32 /* This shouldnt happen, if it occurs somehow 33 /* This shouldnt happen, if it occurs somehow
33 * do something sensible 34 * do something sensible
34 */
35 goto out_put_route;
36 }
37
38 /* Avoid a loop. This is the normal exit path for a
39 * system with only one x.25 iface and default route
40 */ 35 */
41 if (rt->dev == from->dev) { 36 goto out_put_route;
42 goto out_put_nb; 37 }
43 }
44 38
45 /* Remote end sending a call request on an already 39 /* Avoid a loop. This is the normal exit path for a
46 * established LCI? It shouldnt happen, just in case.. 40 * system with only one x.25 iface and default route
47 */ 41 */
48 read_lock_bh(&x25_forward_list_lock); 42 if (rt->dev == from->dev) {
49 list_for_each(entry, &x25_forward_list) { 43 goto out_put_nb;
50 x25_frwd = list_entry(entry, struct x25_forward, node); 44 }
51 if (x25_frwd->lci == lci) { 45
52 printk(KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n"); 46 /* Remote end sending a call request on an already
53 same_lci = 1; 47 * established LCI? It shouldnt happen, just in case..
54 } 48 */
55 } 49 read_lock_bh(&x25_forward_list_lock);
56 read_unlock_bh(&x25_forward_list_lock); 50 list_for_each(entry, &x25_forward_list) {
57 51 x25_frwd = list_entry(entry, struct x25_forward, node);
58 /* Save the forwarding details for future traffic */ 52 if (x25_frwd->lci == lci) {
59 if (!same_lci){ 53 printk(KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n");
60 if ((new_frwd = kmalloc(sizeof(struct x25_forward), 54 same_lci = 1;
61 GFP_ATOMIC)) == NULL){
62 rc = -ENOMEM;
63 goto out_put_nb;
64 }
65 new_frwd->lci = lci;
66 new_frwd->dev1 = rt->dev;
67 new_frwd->dev2 = from->dev;
68 write_lock_bh(&x25_forward_list_lock);
69 list_add(&new_frwd->node, &x25_forward_list);
70 write_unlock_bh(&x25_forward_list_lock);
71 } 55 }
56 }
57 read_unlock_bh(&x25_forward_list_lock);
72 58
73 /* Forward the call request */ 59 /* Save the forwarding details for future traffic */
74 if ( (skbn = skb_clone(skb, GFP_ATOMIC)) == NULL){ 60 if (!same_lci){
61 if ((new_frwd = kmalloc(sizeof(struct x25_forward),
62 GFP_ATOMIC)) == NULL){
63 rc = -ENOMEM;
75 goto out_put_nb; 64 goto out_put_nb;
76 } 65 }
77 x25_transmit_link(skbn, neigh_new); 66 new_frwd->lci = lci;
78 rc = 1; 67 new_frwd->dev1 = rt->dev;
68 new_frwd->dev2 = from->dev;
69 write_lock_bh(&x25_forward_list_lock);
70 list_add(&new_frwd->node, &x25_forward_list);
71 write_unlock_bh(&x25_forward_list_lock);
79 } 72 }
80 73
74 /* Forward the call request */
75 if ( (skbn = skb_clone(skb, GFP_ATOMIC)) == NULL){
76 goto out_put_nb;
77 }
78 x25_transmit_link(skbn, neigh_new);
79 rc = 1;
80
81 81
82out_put_nb: 82out_put_nb:
83 x25_neigh_put(neigh_new); 83 x25_neigh_put(neigh_new);
84 84
85out_put_route: 85out_put_route:
86 x25_route_put(rt); 86 x25_route_put(rt);
87
88out_no_route:
87 return rc; 89 return rc;
88} 90}
89 91
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 946b715db5ec..785c3e39f062 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -735,12 +735,14 @@ EXPORT_SYMBOL(xfrm_policy_insert);
735 735
736struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 736struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
737 struct xfrm_selector *sel, 737 struct xfrm_selector *sel,
738 struct xfrm_sec_ctx *ctx, int delete) 738 struct xfrm_sec_ctx *ctx, int delete,
739 int *err)
739{ 740{
740 struct xfrm_policy *pol, *ret; 741 struct xfrm_policy *pol, *ret;
741 struct hlist_head *chain; 742 struct hlist_head *chain;
742 struct hlist_node *entry; 743 struct hlist_node *entry;
743 744
745 *err = 0;
744 write_lock_bh(&xfrm_policy_lock); 746 write_lock_bh(&xfrm_policy_lock);
745 chain = policy_hash_bysel(sel, sel->family, dir); 747 chain = policy_hash_bysel(sel, sel->family, dir);
746 ret = NULL; 748 ret = NULL;
@@ -750,6 +752,11 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
750 xfrm_sec_ctx_match(ctx, pol->security)) { 752 xfrm_sec_ctx_match(ctx, pol->security)) {
751 xfrm_pol_hold(pol); 753 xfrm_pol_hold(pol);
752 if (delete) { 754 if (delete) {
755 *err = security_xfrm_policy_delete(pol);
756 if (*err) {
757 write_unlock_bh(&xfrm_policy_lock);
758 return pol;
759 }
753 hlist_del(&pol->bydst); 760 hlist_del(&pol->bydst);
754 hlist_del(&pol->byidx); 761 hlist_del(&pol->byidx);
755 xfrm_policy_count[dir]--; 762 xfrm_policy_count[dir]--;
@@ -768,12 +775,14 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
768} 775}
769EXPORT_SYMBOL(xfrm_policy_bysel_ctx); 776EXPORT_SYMBOL(xfrm_policy_bysel_ctx);
770 777
771struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete) 778struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete,
779 int *err)
772{ 780{
773 struct xfrm_policy *pol, *ret; 781 struct xfrm_policy *pol, *ret;
774 struct hlist_head *chain; 782 struct hlist_head *chain;
775 struct hlist_node *entry; 783 struct hlist_node *entry;
776 784
785 *err = 0;
777 write_lock_bh(&xfrm_policy_lock); 786 write_lock_bh(&xfrm_policy_lock);
778 chain = xfrm_policy_byidx + idx_hash(id); 787 chain = xfrm_policy_byidx + idx_hash(id);
779 ret = NULL; 788 ret = NULL;
@@ -781,6 +790,11 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete)
781 if (pol->type == type && pol->index == id) { 790 if (pol->type == type && pol->index == id) {
782 xfrm_pol_hold(pol); 791 xfrm_pol_hold(pol);
783 if (delete) { 792 if (delete) {
793 *err = security_xfrm_policy_delete(pol);
794 if (*err) {
795 write_unlock_bh(&xfrm_policy_lock);
796 return pol;
797 }
784 hlist_del(&pol->bydst); 798 hlist_del(&pol->bydst);
785 hlist_del(&pol->byidx); 799 hlist_del(&pol->byidx);
786 xfrm_policy_count[dir]--; 800 xfrm_policy_count[dir]--;
@@ -2075,7 +2089,7 @@ void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
2075 sizeof(struct in6_addr)); 2089 sizeof(struct in6_addr));
2076 } 2090 }
2077 audit_log_format(audit_buf, 2091 audit_log_format(audit_buf,
2078 " src=" NIP6_FMT "dst=" NIP6_FMT, 2092 " src=" NIP6_FMT " dst=" NIP6_FMT,
2079 NIP6(saddr6), NIP6(daddr6)); 2093 NIP6(saddr6), NIP6(daddr6));
2080 } 2094 }
2081 break; 2095 break;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a35f9e4ede26..e3a0bcfa5df1 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -704,7 +704,8 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re
704 x->props.mode != mode || 704 x->props.mode != mode ||
705 x->props.family != family || 705 x->props.family != family ||
706 x->km.state != XFRM_STATE_ACQ || 706 x->km.state != XFRM_STATE_ACQ ||
707 x->id.spi != 0) 707 x->id.spi != 0 ||
708 x->id.proto != proto)
708 continue; 709 continue;
709 710
710 switch (family) { 711 switch (family) {
@@ -801,7 +802,8 @@ int xfrm_state_add(struct xfrm_state *x)
801 802
802 if (use_spi && x->km.seq) { 803 if (use_spi && x->km.seq) {
803 x1 = __xfrm_find_acq_byseq(x->km.seq); 804 x1 = __xfrm_find_acq_byseq(x->km.seq);
804 if (x1 && xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family)) { 805 if (x1 && ((x1->id.proto != x->id.proto) ||
806 xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) {
805 xfrm_state_put(x1); 807 xfrm_state_put(x1);
806 x1 = NULL; 808 x1 = NULL;
807 } 809 }
@@ -1369,7 +1371,8 @@ int xfrm_replay_check(struct xfrm_state *x, __be32 net_seq)
1369 return 0; 1371 return 0;
1370 1372
1371 diff = x->replay.seq - seq; 1373 diff = x->replay.seq - seq;
1372 if (diff >= x->props.replay_window) { 1374 if (diff >= min_t(unsigned int, x->props.replay_window,
1375 sizeof(x->replay.bitmap) * 8)) {
1373 x->stats.replay_window++; 1376 x->stats.replay_window++;
1374 return -EINVAL; 1377 return -EINVAL;
1375 } 1378 }
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 956cfe0ff7f8..e81e2fb3d429 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -530,9 +530,6 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
530 530
531 err = xfrm_state_delete(x); 531 err = xfrm_state_delete(x);
532 532
533 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
534 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
535
536 if (err < 0) 533 if (err < 0)
537 goto out; 534 goto out;
538 535
@@ -542,6 +539,8 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
542 km_state_notify(x, &c); 539 km_state_notify(x, &c);
543 540
544out: 541out:
542 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
543 AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
545 xfrm_state_put(x); 544 xfrm_state_put(x);
546 return err; 545 return err;
547} 546}
@@ -1254,7 +1253,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1254 return err; 1253 return err;
1255 1254
1256 if (p->index) 1255 if (p->index)
1257 xp = xfrm_policy_byid(type, p->dir, p->index, delete); 1256 xp = xfrm_policy_byid(type, p->dir, p->index, delete, &err);
1258 else { 1257 else {
1259 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1]; 1258 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1];
1260 struct xfrm_policy tmp; 1259 struct xfrm_policy tmp;
@@ -1270,7 +1269,8 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1270 if ((err = security_xfrm_policy_alloc(&tmp, uctx))) 1269 if ((err = security_xfrm_policy_alloc(&tmp, uctx)))
1271 return err; 1270 return err;
1272 } 1271 }
1273 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, delete); 1272 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security,
1273 delete, &err);
1274 security_xfrm_policy_free(&tmp); 1274 security_xfrm_policy_free(&tmp);
1275 } 1275 }
1276 if (xp == NULL) 1276 if (xp == NULL)
@@ -1288,8 +1288,6 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1288 MSG_DONTWAIT); 1288 MSG_DONTWAIT);
1289 } 1289 }
1290 } else { 1290 } else {
1291 err = security_xfrm_policy_delete(xp);
1292
1293 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, 1291 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
1294 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL); 1292 AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
1295 1293
@@ -1303,9 +1301,8 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1303 km_policy_notify(xp, p->dir, &c); 1301 km_policy_notify(xp, p->dir, &c);
1304 } 1302 }
1305 1303
1306 xfrm_pol_put(xp);
1307
1308out: 1304out:
1305 xfrm_pol_put(xp);
1309 return err; 1306 return err;
1310} 1307}
1311 1308
@@ -1502,7 +1499,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1502 return err; 1499 return err;
1503 1500
1504 if (p->index) 1501 if (p->index)
1505 xp = xfrm_policy_byid(type, p->dir, p->index, 0); 1502 xp = xfrm_policy_byid(type, p->dir, p->index, 0, &err);
1506 else { 1503 else {
1507 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1]; 1504 struct rtattr *rt = xfrma[XFRMA_SEC_CTX-1];
1508 struct xfrm_policy tmp; 1505 struct xfrm_policy tmp;
@@ -1518,13 +1515,14 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1518 if ((err = security_xfrm_policy_alloc(&tmp, uctx))) 1515 if ((err = security_xfrm_policy_alloc(&tmp, uctx)))
1519 return err; 1516 return err;
1520 } 1517 }
1521 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, 0); 1518 xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security,
1519 0, &err);
1522 security_xfrm_policy_free(&tmp); 1520 security_xfrm_policy_free(&tmp);
1523 } 1521 }
1524 1522
1525 if (xp == NULL) 1523 if (xp == NULL)
1526 return err; 1524 return -ENOENT;
1527 read_lock(&xp->lock); 1525 read_lock(&xp->lock);
1528 if (xp->dead) { 1526 if (xp->dead) {
1529 read_unlock(&xp->lock); 1527 read_unlock(&xp->lock);
1530 goto out; 1528 goto out;
@@ -2027,7 +2025,7 @@ nlmsg_failure:
2027 return -1; 2025 return -1;
2028} 2026}
2029 2027
2030static int inline xfrm_sa_len(struct xfrm_state *x) 2028static inline int xfrm_sa_len(struct xfrm_state *x)
2031{ 2029{
2032 int l = 0; 2030 int l = 0;
2033 if (x->aalg) 2031 if (x->aalg)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 668a11a8b383..6bc7e7cfccf6 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -28,9 +28,11 @@
28 * the dependency on linux/autoconf.h by a dependency on every config 28 * the dependency on linux/autoconf.h by a dependency on every config
29 * option which is mentioned in any of the listed prequisites. 29 * option which is mentioned in any of the listed prequisites.
30 * 30 *
31 * To be exact, split-include populates a tree in include/config/, 31 * kconfig populates a tree in include/config/ with an empty file
32 * e.g. include/config/his/driver.h, which contains the #define/#undef 32 * for each config symbol and when the configuration is updated
33 * for the CONFIG_HIS_DRIVER option. 33 * the files representing changed config options are touched
34 * which then let make pick up the changes and the files that use
35 * the config symbols are rebuilt.
34 * 36 *
35 * So if the user changes his CONFIG_HIS_DRIVER option, only the objects 37 * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
36 * which depend on "include/linux/config/his/driver.h" will be rebuilt, 38 * which depend on "include/linux/config/his/driver.h" will be rebuilt,
@@ -245,6 +247,8 @@ void parse_config_file(char *map, size_t len)
245 continue; 247 continue;
246 248
247 found: 249 found:
250 if (!memcmp(q - 7, "_MODULE", 7))
251 q -= 7;
248 use_config(p+7, q-p-7); 252 use_config(p+7, q-p-7);
249 } 253 }
250} 254}
diff --git a/security/dummy.c b/security/dummy.c
index 558795b237d6..8ffd76405b5b 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -907,7 +907,7 @@ static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode)
907 return; 907 return;
908} 908}
909 909
910static int dummy_getprocattr(struct task_struct *p, char *name, void *value, size_t size) 910static int dummy_getprocattr(struct task_struct *p, char *name, char **value)
911{ 911{
912 return -EINVAL; 912 return -EINVAL;
913} 913}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 19a385e9968e..d41e24d6ae41 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4468,11 +4468,12 @@ static void selinux_d_instantiate (struct dentry *dentry, struct inode *inode)
4468} 4468}
4469 4469
4470static int selinux_getprocattr(struct task_struct *p, 4470static int selinux_getprocattr(struct task_struct *p,
4471 char *name, void *value, size_t size) 4471 char *name, char **value)
4472{ 4472{
4473 struct task_security_struct *tsec; 4473 struct task_security_struct *tsec;
4474 u32 sid; 4474 u32 sid;
4475 int error; 4475 int error;
4476 unsigned len;
4476 4477
4477 if (current != p) { 4478 if (current != p) {
4478 error = task_has_perm(current, p, PROCESS__GETATTR); 4479 error = task_has_perm(current, p, PROCESS__GETATTR);
@@ -4500,7 +4501,10 @@ static int selinux_getprocattr(struct task_struct *p,
4500 if (!sid) 4501 if (!sid)
4501 return 0; 4502 return 0;
4502 4503
4503 return selinux_getsecurity(sid, value, size); 4504 error = security_sid_to_context(sid, value, &len);
4505 if (error)
4506 return error;
4507 return len;
4504} 4508}
4505 4509
4506static int selinux_setprocattr(struct task_struct *p, 4510static int selinux_setprocattr(struct task_struct *p,
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index a0ec886f2aa3..f4056a9c371b 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -1346,22 +1346,34 @@ static const struct file_operations sq_fops =
1346 .ioctl = sq_ioctl, 1346 .ioctl = sq_ioctl,
1347 .open = sq_open, 1347 .open = sq_open,
1348 .release = sq_release, 1348 .release = sq_release,
1349};
1350
1349#ifdef HAS_RECORD 1351#ifdef HAS_RECORD
1350 .read = NULL /* default to no read for compat mode */ 1352static const struct file_operations sq_fops_record =
1351#endif 1353{
1354 .owner = THIS_MODULE,
1355 .llseek = no_llseek,
1356 .write = sq_write,
1357 .poll = sq_poll,
1358 .ioctl = sq_ioctl,
1359 .open = sq_open,
1360 .release = sq_release,
1361 .read = sq_read,
1352}; 1362};
1363#endif
1353 1364
1354static int sq_init(void) 1365static int sq_init(void)
1355{ 1366{
1367 const struct file_operations *fops = &sq_fops;
1356#ifndef MODULE 1368#ifndef MODULE
1357 int sq_unit; 1369 int sq_unit;
1358#endif 1370#endif
1359 1371
1360#ifdef HAS_RECORD 1372#ifdef HAS_RECORD
1361 if (dmasound.mach.record) 1373 if (dmasound.mach.record)
1362 sq_fops.read = sq_read ; 1374 fops = &sq_fops_record;
1363#endif 1375#endif
1364 sq_unit = register_sound_dsp(&sq_fops, -1); 1376 sq_unit = register_sound_dsp(fops, -1);
1365 if (sq_unit < 0) { 1377 if (sq_unit < 0) {
1366 printk(KERN_ERR "dmasound_core: couldn't register fops\n") ; 1378 printk(KERN_ERR "dmasound_core: couldn't register fops\n") ;
1367 return sq_unit ; 1379 return sq_unit ;
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 37fabf75daa7..b188a4df58cb 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1962,9 +1962,11 @@ static int snd_ac97_ad1888_downmix_put(struct snd_kcontrol *kcontrol, struct snd
1962static void ad1888_update_jacks(struct snd_ac97 *ac97) 1962static void ad1888_update_jacks(struct snd_ac97 *ac97)
1963{ 1963{
1964 unsigned short val = 0; 1964 unsigned short val = 0;
1965 if (! is_shared_linein(ac97)) 1965 /* clear LODIS if shared jack is to be used for Surround out */
1966 if (is_shared_linein(ac97))
1966 val |= (1 << 12); 1967 val |= (1 << 12);
1967 if (! is_shared_micin(ac97)) 1968 /* clear CLDIS if shared jack is to be used for C/LFE out */
1969 if (is_shared_micin(ac97))
1968 val |= (1 << 11); 1970 val |= (1 << 11);
1969 /* shared Line-In */ 1971 /* shared Line-In */
1970 snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val); 1972 snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val);
@@ -2136,8 +2138,9 @@ static const struct snd_kcontrol_new snd_ac97_ad1985_controls[] = {
2136static void ad1985_update_jacks(struct snd_ac97 *ac97) 2138static void ad1985_update_jacks(struct snd_ac97 *ac97)
2137{ 2139{
2138 ad1888_update_jacks(ac97); 2140 ad1888_update_jacks(ac97);
2141 /* clear OMS if shared jack is to be used for C/LFE out */
2139 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, 2142 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9,
2140 is_shared_micin(ac97) ? 0 : 1 << 9); 2143 is_shared_micin(ac97) ? 1 << 9 : 0);
2141} 2144}
2142 2145
2143static int patch_ad1985_specific(struct snd_ac97 *ac97) 2146static int patch_ad1985_specific(struct snd_ac97 *ac97)
@@ -2418,9 +2421,9 @@ static void ad1986_update_jacks(struct snd_ac97 *ac97)
2418 unsigned short ser_val; 2421 unsigned short ser_val;
2419 2422
2420 /* disable SURROUND and CENTER/LFE if not surround mode */ 2423 /* disable SURROUND and CENTER/LFE if not surround mode */
2421 if (! is_surround_on(ac97)) 2424 if (!is_surround_on(ac97))
2422 misc_val |= AC97_AD1986_SODIS; 2425 misc_val |= AC97_AD1986_SODIS;
2423 if (! is_clfe_on(ac97)) 2426 if (!is_clfe_on(ac97))
2424 misc_val |= AC97_AD1986_CLDIS; 2427 misc_val |= AC97_AD1986_CLDIS;
2425 2428
2426 /* select line input (default=LINE_IN, SURROUND or MIC_1/2) */ 2429 /* select line input (default=LINE_IN, SURROUND or MIC_1/2) */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b9a8e238b0a8..1672cace1ae7 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -199,7 +199,6 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
199 199
200/* STATESTS int mask: SD2,SD1,SD0 */ 200/* STATESTS int mask: SD2,SD1,SD0 */
201#define STATESTS_INT_MASK 0x07 201#define STATESTS_INT_MASK 0x07
202#define AZX_MAX_CODECS 3
203 202
204/* SD_CTL bits */ 203/* SD_CTL bits */
205#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ 204#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
@@ -966,6 +965,16 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
966 * Codec initialization 965 * Codec initialization
967 */ 966 */
968 967
968static unsigned int azx_max_codecs[] __devinitdata = {
969 [AZX_DRIVER_ICH] = 3,
970 [AZX_DRIVER_ATI] = 4,
971 [AZX_DRIVER_ATIHDMI] = 4,
972 [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */
973 [AZX_DRIVER_SIS] = 3, /* FIXME: correct? */
974 [AZX_DRIVER_ULI] = 3, /* FIXME: correct? */
975 [AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */
976};
977
969static int __devinit azx_codec_create(struct azx *chip, const char *model) 978static int __devinit azx_codec_create(struct azx *chip, const char *model)
970{ 979{
971 struct hda_bus_template bus_temp; 980 struct hda_bus_template bus_temp;
@@ -982,7 +991,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model)
982 return err; 991 return err;
983 992
984 codecs = 0; 993 codecs = 0;
985 for (c = 0; c < AZX_MAX_CODECS; c++) { 994 for (c = 0; c < azx_max_codecs[chip->driver_type]; c++) {
986 if ((chip->codec_mask & (1 << c)) & probe_mask) { 995 if ((chip->codec_mask & (1 << c)) & probe_mask) {
987 err = snd_hda_codec_new(chip->bus, c, NULL); 996 err = snd_hda_codec_new(chip->bus, c, NULL);
988 if (err < 0) 997 if (err < 0)
@@ -1078,6 +1087,10 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1078 runtime->hw.rates = hinfo->rates; 1087 runtime->hw.rates = hinfo->rates;
1079 snd_pcm_limit_hw_rates(runtime); 1088 snd_pcm_limit_hw_rates(runtime);
1080 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 1089 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
1090 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1091 128);
1092 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1093 128);
1081 if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { 1094 if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) {
1082 azx_release_device(azx_dev); 1095 azx_release_device(azx_dev);
1083 mutex_unlock(&chip->open_mutex); 1096 mutex_unlock(&chip->open_mutex);
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 00ace59b05c9..f94f1f22889e 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -833,12 +833,14 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
833 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS P5", AD1986A_3STACK), 833 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS P5", AD1986A_3STACK),
834 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK), 834 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK),
835 SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK), 835 SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK),
836 SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK),
836 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), 837 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP),
837 SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), 838 SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD),
838 SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), 839 SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD),
839 SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), 840 SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD),
840 SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), 841 SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK),
841 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), 842 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA),
843 SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP),
842 SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), 844 SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK),
843 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_LAPTOP_EAPD), 845 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_LAPTOP_EAPD),
844 SND_PCI_QUIRK(0x17c0, 0x2017, "Samsung M50", AD1986A_LAPTOP), 846 SND_PCI_QUIRK(0x17c0, 0x2017, "Samsung M50", AD1986A_LAPTOP),
@@ -1205,7 +1207,7 @@ static struct hda_verb ad1981_init_verbs[] = {
1205/* 1207/*
1206 * Patch for HP nx6320 1208 * Patch for HP nx6320
1207 * 1209 *
1208 * nx6320 uses EAPD in the reserve way - EAPD-on means the internal 1210 * nx6320 uses EAPD in the reverse way - EAPD-on means the internal
1209 * speaker output enabled _and_ mute-LED off. 1211 * speaker output enabled _and_ mute-LED off.
1210 */ 1212 */
1211 1213
@@ -1373,6 +1375,21 @@ static int ad1981_hp_init(struct hda_codec *codec)
1373 return 0; 1375 return 0;
1374} 1376}
1375 1377
1378/* configuration for Toshiba Laptops */
1379static struct hda_verb ad1981_toshiba_init_verbs[] = {
1380 {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x01 }, /* default on */
1381 /* pin sensing on HP and Mic jacks */
1382 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
1383 {0x08, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_MIC_EVENT},
1384 {}
1385};
1386
1387static struct snd_kcontrol_new ad1981_toshiba_mixers[] = {
1388 HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT),
1389 HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT),
1390 { }
1391};
1392
1376/* configuration for Lenovo Thinkpad T60 */ 1393/* configuration for Lenovo Thinkpad T60 */
1377static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = { 1394static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
1378 HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT), 1395 HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT),
@@ -1418,6 +1435,7 @@ enum {
1418 AD1981_BASIC, 1435 AD1981_BASIC,
1419 AD1981_HP, 1436 AD1981_HP,
1420 AD1981_THINKPAD, 1437 AD1981_THINKPAD,
1438 AD1981_TOSHIBA,
1421 AD1981_MODELS 1439 AD1981_MODELS
1422}; 1440};
1423 1441
@@ -1425,6 +1443,7 @@ static const char *ad1981_models[AD1981_MODELS] = {
1425 [AD1981_HP] = "hp", 1443 [AD1981_HP] = "hp",
1426 [AD1981_THINKPAD] = "thinkpad", 1444 [AD1981_THINKPAD] = "thinkpad",
1427 [AD1981_BASIC] = "basic", 1445 [AD1981_BASIC] = "basic",
1446 [AD1981_TOSHIBA] = "toshiba"
1428}; 1447};
1429 1448
1430static struct snd_pci_quirk ad1981_cfg_tbl[] = { 1449static struct snd_pci_quirk ad1981_cfg_tbl[] = {
@@ -1435,6 +1454,7 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = {
1435 /* Lenovo Thinkpad T60/X60/Z6xx */ 1454 /* Lenovo Thinkpad T60/X60/Z6xx */
1436 SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), 1455 SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD),
1437 SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), 1456 SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD),
1457 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA),
1438 {} 1458 {}
1439}; 1459};
1440 1460
@@ -1485,8 +1505,17 @@ static int patch_ad1981(struct hda_codec *codec)
1485 spec->mixers[0] = ad1981_thinkpad_mixers; 1505 spec->mixers[0] = ad1981_thinkpad_mixers;
1486 spec->input_mux = &ad1981_thinkpad_capture_source; 1506 spec->input_mux = &ad1981_thinkpad_capture_source;
1487 break; 1507 break;
1508 case AD1981_TOSHIBA:
1509 spec->mixers[0] = ad1981_hp_mixers;
1510 spec->mixers[1] = ad1981_toshiba_mixers;
1511 spec->num_init_verbs = 2;
1512 spec->init_verbs[1] = ad1981_toshiba_init_verbs;
1513 spec->multiout.dig_out_nid = 0;
1514 spec->input_mux = &ad1981_hp_capture_source;
1515 codec->patch_ops.init = ad1981_hp_init;
1516 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1517 break;
1488 } 1518 }
1489
1490 return 0; 1519 return 0;
1491} 1520}
1492 1521
@@ -2607,6 +2636,12 @@ static const char *ad1988_models[AD1988_MODEL_LAST] = {
2607 [AD1988_AUTO] = "auto", 2636 [AD1988_AUTO] = "auto",
2608}; 2637};
2609 2638
2639static struct snd_pci_quirk ad1988_cfg_tbl[] = {
2640 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
2641 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
2642 {}
2643};
2644
2610static int patch_ad1988(struct hda_codec *codec) 2645static int patch_ad1988(struct hda_codec *codec)
2611{ 2646{
2612 struct ad198x_spec *spec; 2647 struct ad198x_spec *spec;
@@ -2623,7 +2658,7 @@ static int patch_ad1988(struct hda_codec *codec)
2623 snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); 2658 snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n");
2624 2659
2625 board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, 2660 board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST,
2626 ad1988_models, NULL); 2661 ad1988_models, ad1988_cfg_tbl);
2627 if (board_config < 0) { 2662 if (board_config < 0) {
2628 printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); 2663 printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n");
2629 board_config = AD1988_AUTO; 2664 board_config = AD1988_AUTO;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 84d005ef30ee..fba3cb11bc2a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4186,6 +4186,8 @@ static const char *alc260_models[ALC260_MODEL_LAST] = {
4186static struct snd_pci_quirk alc260_cfg_tbl[] = { 4186static struct snd_pci_quirk alc260_cfg_tbl[] = {
4187 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), 4187 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4188 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), 4188 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4189 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4190 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4189 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), 4191 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4190 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), 4192 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4191 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), 4193 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4c7b03996be9..c94291bc5367 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -60,7 +60,8 @@ enum {
60 STAC_D945GTP5, 60 STAC_D945GTP5,
61 STAC_MACMINI, 61 STAC_MACMINI,
62 STAC_MACBOOK, 62 STAC_MACBOOK,
63 STAC_MACBOOK_PRO, 63 STAC_MACBOOK_PRO_V1,
64 STAC_MACBOOK_PRO_V2,
64 STAC_922X_MODELS 65 STAC_922X_MODELS
65}; 66};
66 67
@@ -529,7 +530,13 @@ static unsigned int macbook_pin_configs[10] = {
529 0x400000fc, 0x400000fb, 530 0x400000fc, 0x400000fb,
530}; 531};
531 532
532static unsigned int macbook_pro_pin_configs[10] = { 533static unsigned int macbook_pro_v1_pin_configs[10] = {
534 0x0321e230, 0x03a1e020, 0x9017e110, 0x01014010,
535 0x01a19021, 0x0381e021, 0x1345e240, 0x13c5e22e,
536 0x02a19320, 0x400000fb
537};
538
539static unsigned int macbook_pro_v2_pin_configs[10] = {
533 0x0221401f, 0x90a70120, 0x01813024, 0x01014010, 540 0x0221401f, 0x90a70120, 0x01813024, 0x01014010,
534 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e, 541 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e,
535 0x400000fc, 0x400000fb, 542 0x400000fc, 0x400000fb,
@@ -541,7 +548,8 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
541 [STAC_D945GTP5] = d945gtp5_pin_configs, 548 [STAC_D945GTP5] = d945gtp5_pin_configs,
542 [STAC_MACMINI] = d945gtp5_pin_configs, 549 [STAC_MACMINI] = d945gtp5_pin_configs,
543 [STAC_MACBOOK] = macbook_pin_configs, 550 [STAC_MACBOOK] = macbook_pin_configs,
544 [STAC_MACBOOK_PRO] = macbook_pro_pin_configs, 551 [STAC_MACBOOK_PRO_V1] = macbook_pro_v1_pin_configs,
552 [STAC_MACBOOK_PRO_V2] = macbook_pro_v2_pin_configs,
545}; 553};
546 554
547static const char *stac922x_models[STAC_922X_MODELS] = { 555static const char *stac922x_models[STAC_922X_MODELS] = {
@@ -550,7 +558,8 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
550 [STAC_D945GTP3] = "3stack", 558 [STAC_D945GTP3] = "3stack",
551 [STAC_MACMINI] = "macmini", 559 [STAC_MACMINI] = "macmini",
552 [STAC_MACBOOK] = "macbook", 560 [STAC_MACBOOK] = "macbook",
553 [STAC_MACBOOK_PRO] = "macbook-pro", 561 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
562 [STAC_MACBOOK_PRO_V2] = "macbook-pro",
554}; 563};
555 564
556static struct snd_pci_quirk stac922x_cfg_tbl[] = { 565static struct snd_pci_quirk stac922x_cfg_tbl[] = {
@@ -1600,6 +1609,11 @@ static int stac92xx_init(struct hda_codec *codec)
1600 for (i = 0; i < cfg->hp_outs; i++) 1609 for (i = 0; i < cfg->hp_outs; i++)
1601 enable_pin_detect(codec, cfg->hp_pins[i], 1610 enable_pin_detect(codec, cfg->hp_pins[i],
1602 STAC_HP_EVENT); 1611 STAC_HP_EVENT);
1612 /* force to enable the first line-out; the others are set up
1613 * in unsol_event
1614 */
1615 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
1616 AC_PINCTL_OUT_EN);
1603 stac92xx_auto_init_hp_out(codec); 1617 stac92xx_auto_init_hp_out(codec);
1604 /* fake event to set up pins */ 1618 /* fake event to set up pins */
1605 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 1619 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
@@ -1889,9 +1903,13 @@ static int patch_stac922x(struct hda_codec *codec)
1889 /* Intel Macs have all same PCI SSID, so we need to check 1903 /* Intel Macs have all same PCI SSID, so we need to check
1890 * codec SSID to distinguish the exact models 1904 * codec SSID to distinguish the exact models
1891 */ 1905 */
1906 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
1892 switch (codec->subsystem_id) { 1907 switch (codec->subsystem_id) {
1893 case 0x106b1e00: 1908 case 0x106b0200: /* MacBook Pro first generation */
1894 spec->board_config = STAC_MACBOOK_PRO; 1909 spec->board_config = STAC_MACBOOK_PRO_V1;
1910 break;
1911 case 0x106b1e00: /* MacBook Pro second generation */
1912 spec->board_config = STAC_MACBOOK_PRO_V2;
1895 break; 1913 break;
1896 } 1914 }
1897 } 1915 }
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index a289abfc7172..7cf2dcb9d8d4 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -725,10 +725,11 @@ static void fill_nocache(void *buf, int size, int nocache)
725static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev) 725static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev)
726{ 726{
727 unsigned long port = ichdev->reg_offset; 727 unsigned long port = ichdev->reg_offset;
728 unsigned long flags;
728 int status, civ, i, step; 729 int status, civ, i, step;
729 int ack = 0; 730 int ack = 0;
730 731
731 spin_lock(&chip->reg_lock); 732 spin_lock_irqsave(&chip->reg_lock, flags);
732 status = igetbyte(chip, port + ichdev->roff_sr); 733 status = igetbyte(chip, port + ichdev->roff_sr);
733 civ = igetbyte(chip, port + ICH_REG_OFF_CIV); 734 civ = igetbyte(chip, port + ICH_REG_OFF_CIV);
734 if (!(status & ICH_BCIS)) { 735 if (!(status & ICH_BCIS)) {
@@ -768,7 +769,7 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich
768 ack = 1; 769 ack = 1;
769 } 770 }
770 } 771 }
771 spin_unlock(&chip->reg_lock); 772 spin_unlock_irqrestore(&chip->reg_lock, flags);
772 if (ack && ichdev->substream) { 773 if (ack && ichdev->substream) {
773 snd_pcm_period_elapsed(ichdev->substream); 774 snd_pcm_period_elapsed(ichdev->substream);
774 } 775 }
@@ -2470,7 +2471,10 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
2470 } 2471 }
2471 pci_disable_device(pci); 2472 pci_disable_device(pci);
2472 pci_save_state(pci); 2473 pci_save_state(pci);
2473 pci_set_power_state(pci, pci_choose_state(pci, state)); 2474 /* The call below may disable built-in speaker on some laptops
2475 * after S2RAM. So, don't touch it.
2476 */
2477 /* pci_set_power_state(pci, pci_choose_state(pci, state)); */
2474 return 0; 2478 return 0;
2475} 2479}
2476 2480
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
index ec821a57f843..dccaa4be679e 100644
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -10,6 +10,8 @@ config SND_SOC_AC97_BUS
10 10
11config SND_SOC 11config SND_SOC
12 tristate "SoC audio support" 12 tristate "SoC audio support"
13 depends on SND
14 select SND_PCM
13 ---help--- 15 ---help---
14 16
15 If you want SoC support, you should say Y here and also to the 17 If you want SoC support, you should say Y here and also to the
diff --git a/sound/soc/at91/Kconfig b/sound/soc/at91/Kconfig
index 5bcf08b728b0..a5b2558916c1 100644
--- a/sound/soc/at91/Kconfig
+++ b/sound/soc/at91/Kconfig
@@ -2,8 +2,7 @@ menu "SoC Audio for the Atmel AT91"
2 2
3config SND_AT91_SOC 3config SND_AT91_SOC
4 tristate "SoC Audio for the Atmel AT91 System-on-Chip" 4 tristate "SoC Audio for the Atmel AT91 System-on-Chip"
5 depends on ARCH_AT91 && SND 5 depends on ARCH_AT91 && SND_SOC
6 select SND_PCM
7 help 6 help
8 Say Y or M if you want to add support for codecs attached to 7 Say Y or M if you want to add support for codecs attached to
9 the AT91 SSC interface. You will also need 8 the AT91 SSC interface. You will also need
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 579e1c8d2b28..b9ab3b8e1d3e 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -2,8 +2,7 @@ menu "SoC Audio for the Intel PXA2xx"
2 2
3config SND_PXA2XX_SOC 3config SND_PXA2XX_SOC
4 tristate "SoC Audio for the Intel PXA2xx chip" 4 tristate "SoC Audio for the Intel PXA2xx chip"
5 depends on ARCH_PXA && SND 5 depends on ARCH_PXA && SND_SOC
6 select SND_PCM
7 help 6 help
8 Say Y or M if you want to add support for codecs attached to 7 Say Y or M if you want to add support for codecs attached to
9 the PXA2xx AC97, I2S or SSP interface. You will also need 8 the PXA2xx AC97, I2S or SSP interface. You will also need