aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-31 03:17:34 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-31 03:17:34 -0400
commita1744d3bee19d3b9cbfb825ab316a101b9c9f109 (patch)
treec0e2324c09beca0eb5782eb5abf241ea2b7a4a11
parent275f165fa970174f8a98205529750e8abb6c0a33 (diff)
parenta432226614c5616e3cfd211e0acffa0acfb4770c (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/p54/p54common.c
-rw-r--r--.mailmap2
-rw-r--r--Documentation/00-INDEX4
-rw-r--r--Documentation/DocBook/Makefile4
-rw-r--r--Documentation/DocBook/deviceiobook.tmpl2
-rw-r--r--Documentation/DocBook/mcabook.tmpl2
-rw-r--r--Documentation/DocBook/wanbook.tmpl2
-rw-r--r--Documentation/DocBook/z8530book.tmpl2
-rw-r--r--Documentation/ManagementStyle2
-rw-r--r--Documentation/accounting/.gitignore1
-rw-r--r--Documentation/arm/empeg/README13
-rw-r--r--Documentation/arm/empeg/ir.txt49
-rw-r--r--Documentation/arm/empeg/mkdevs11
-rw-r--r--Documentation/auxdisplay/.gitignore1
-rw-r--r--Documentation/connector/.gitignore1
-rw-r--r--Documentation/filesystems/Locking12
-rw-r--r--Documentation/filesystems/vfs.txt39
-rw-r--r--Documentation/ftrace.txt3
-rw-r--r--Documentation/i2c/busses/i2c-sis96x2
-rw-r--r--Documentation/ia64/.gitignore1
-rw-r--r--Documentation/isdn/CREDITS2
-rw-r--r--Documentation/ja_JP/HOWTO14
-rw-r--r--Documentation/kernel-parameters.txt12
-rw-r--r--Documentation/lguest/Makefile2
-rw-r--r--Documentation/lguest/lguest.c4
-rw-r--r--Documentation/networking/.gitignore1
-rw-r--r--Documentation/networking/dmfe.txt2
-rw-r--r--Documentation/pcmcia/.gitignore1
-rw-r--r--Documentation/scheduler/00-INDEX2
-rw-r--r--Documentation/scheduler/sched-design-CFS.txt2
-rw-r--r--Documentation/scsi/aacraid.txt2
-rw-r--r--Documentation/spi/.gitignore2
-rw-r--r--Documentation/stable_kernel_rules.txt1
-rw-r--r--Documentation/sysctl/kernel.txt24
-rw-r--r--Documentation/video4linux/.gitignore1
-rw-r--r--Documentation/video4linux/bttv/CONTRIBUTORS2
-rw-r--r--Documentation/vm/.gitignore1
-rw-r--r--Documentation/watchdog/src/.gitignore2
-rw-r--r--Documentation/x86/x86_64/boot-options.txt4
-rw-r--r--Documentation/x86/x86_64/fake-numa-for-cpusets2
-rw-r--r--MAINTAINERS37
-rw-r--r--Makefile10
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/boot/compressed/Makefile2
-rw-r--r--arch/arm/common/sharpsl_pm.c19
-rw-r--r--arch/arm/include/asm/ftrace.h2
-rw-r--r--arch/arm/kernel/armksyms.c2
-rw-r--r--arch/arm/kernel/entry-common.S4
-rw-r--r--arch/arm/kernel/ftrace.c13
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c1
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-ep93xx/core.c6
-rw-r--r--arch/arm/mach-imx/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-mx3/mx31ads.c2
-rw-r--r--arch/arm/mach-mx3/pcm037.c4
-rw-r--r--arch/arm/mach-ns9xxx/gpio.c2
-rw-r--r--arch/arm/mach-orion5x/gpio.c2
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c4
-rw-r--r--arch/arm/mach-pxa/include/mach/sharpsl.h1
-rw-r--r--arch/arm/mach-pxa/spitz.c12
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c4
-rw-r--r--arch/arm/mm/proc-xsc3.S2
-rw-r--r--arch/arm/plat-mxc/gpio.c2
-rw-r--r--arch/arm/plat-mxc/include/mach/io.h20
-rw-r--r--arch/ia64/include/asm/iommu.h1
-rw-r--r--arch/ia64/include/asm/kvm_host.h6
-rw-r--r--arch/ia64/kernel/pci-dma.c7
-rw-r--r--arch/ia64/kvm/Makefile8
-rw-r--r--arch/ia64/kvm/kvm-ia64.c80
-rw-r--r--arch/ia64/kvm/kvm_fw.c9
-rw-r--r--arch/ia64/kvm/process.c2
-rw-r--r--arch/mips/Kconfig67
-rw-r--r--arch/mips/Makefile23
-rw-r--r--arch/mips/alchemy/common/platform.c98
-rw-r--r--arch/mips/alchemy/pb1200/platform.c81
-rw-r--r--arch/mips/configs/ip22_defconfig1
-rw-r--r--arch/mips/configs/ip27_defconfig1
-rw-r--r--arch/mips/configs/ip28_defconfig2
-rw-r--r--arch/mips/configs/pnx8335-stb225_defconfig1149
-rw-r--r--arch/mips/emma/Kconfig29
-rw-r--r--arch/mips/emma/common/Makefile (renamed from arch/mips/emma2rh/common/Makefile)2
-rw-r--r--arch/mips/emma/common/prom.c (renamed from arch/mips/emma2rh/common/prom.c)6
-rw-r--r--arch/mips/emma/markeins/Makefile (renamed from arch/mips/emma2rh/markeins/Makefile)2
-rw-r--r--arch/mips/emma/markeins/irq.c331
-rw-r--r--arch/mips/emma/markeins/led.c (renamed from arch/mips/emma2rh/markeins/led.c)2
-rw-r--r--arch/mips/emma/markeins/platform.c (renamed from arch/mips/emma2rh/markeins/platform.c)2
-rw-r--r--arch/mips/emma/markeins/setup.c (renamed from arch/mips/emma2rh/markeins/setup.c)2
-rw-r--r--arch/mips/emma2rh/common/irq.c105
-rw-r--r--arch/mips/emma2rh/common/irq_emma2rh.c106
-rw-r--r--arch/mips/emma2rh/markeins/irq.c132
-rw-r--r--arch/mips/emma2rh/markeins/irq_markeins.c158
-rw-r--r--arch/mips/include/asm/bitops.h114
-rw-r--r--arch/mips/include/asm/break.h1
-rw-r--r--arch/mips/include/asm/byteorder.h40
-rw-r--r--arch/mips/include/asm/cpu-features.h2
-rw-r--r--arch/mips/include/asm/ds1286.h15
-rw-r--r--arch/mips/include/asm/emma/emma2rh.h (renamed from arch/mips/include/asm/emma2rh/emma2rh.h)15
-rw-r--r--arch/mips/include/asm/emma/markeins.h (renamed from arch/mips/include/asm/emma2rh/markeins.h)0
-rw-r--r--arch/mips/include/asm/fpu_emulator.h17
-rw-r--r--arch/mips/include/asm/m48t35.h27
-rw-r--r--arch/mips/include/asm/mach-lemote/pci.h30
-rw-r--r--arch/mips/include/asm/mach-pnx833x/gpio.h172
-rw-r--r--arch/mips/include/asm/mach-pnx833x/irq-mapping.h126
-rw-r--r--arch/mips/include/asm/mach-pnx833x/irq.h53
-rw-r--r--arch/mips/include/asm/mach-pnx833x/pnx833x.h202
-rw-r--r--arch/mips/include/asm/mach-pnx833x/war.h25
-rw-r--r--arch/mips/include/asm/mach-tx49xx/mangle-port.h26
-rw-r--r--arch/mips/include/asm/mipsregs.h1
-rw-r--r--arch/mips/include/asm/module.h2
-rw-r--r--arch/mips/include/asm/ptrace.h17
-rw-r--r--arch/mips/include/asm/txx9/generic.h5
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/cpu-probe.c247
-rw-r--r--arch/mips/kernel/scall32-o32.S4
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/setup.c4
-rw-r--r--arch/mips/kernel/smp.c12
-rw-r--r--arch/mips/kernel/traps.c29
-rw-r--r--arch/mips/kernel/unaligned.c20
-rw-r--r--arch/mips/lemote/lm2e/pci.c13
-rw-r--r--arch/mips/lemote/lm2e/setup.c11
-rw-r--r--arch/mips/lib/Makefile1
-rw-r--r--arch/mips/lib/dump_tlb.c1
-rw-r--r--arch/mips/math-emu/cp1emu.c12
-rw-r--r--arch/mips/math-emu/dsemul.c7
-rw-r--r--arch/mips/math-emu/dsemul.h17
-rw-r--r--arch/mips/mm/Makefile1
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/nxp/pnx833x/common/Makefile3
-rw-r--r--arch/mips/nxp/pnx833x/common/interrupts.c380
-rw-r--r--arch/mips/nxp/pnx833x/common/platform.c319
-rw-r--r--arch/mips/nxp/pnx833x/common/prom.c70
-rw-r--r--arch/mips/nxp/pnx833x/common/reset.c45
-rw-r--r--arch/mips/nxp/pnx833x/common/setup.c64
-rw-r--r--arch/mips/nxp/pnx833x/stb22x/Makefile3
-rw-r--r--arch/mips/nxp/pnx833x/stb22x/board.c133
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/fixup-emma2rh.c2
-rw-r--r--arch/mips/pci/fixup-rc32434.c1
-rw-r--r--arch/mips/pci/ops-emma2rh.c2
-rw-r--r--arch/mips/pci/pci-emma2rh.c2
-rw-r--r--arch/mips/rb532/devices.c2
-rw-r--r--arch/mips/rb532/gpio.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c17
-rw-r--r--arch/mips/txx9/Kconfig6
-rw-r--r--arch/mips/txx9/generic/7segled.c112
-rw-r--r--arch/mips/txx9/generic/Makefile1
-rw-r--r--arch/mips/txx9/generic/setup.c37
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c25
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c88
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/include/asm/ftrace.h2
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/entry_32.S2
-rw-r--r--arch/powerpc/kernel/entry_64.S2
-rw-r--r--arch/powerpc/kernel/ftrace.c27
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c2
-rw-r--r--arch/powerpc/platforms/powermac/Makefile2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c26
-rw-r--r--arch/s390/Kconfig16
-rw-r--r--arch/s390/appldata/appldata_base.c2
-rw-r--r--arch/s390/include/asm/kvm_virtio.h2
-rw-r--r--arch/s390/include/asm/mmu.h3
-rw-r--r--arch/s390/include/asm/mmu_context.h19
-rw-r--r--arch/s390/include/asm/pgtable.h8
-rw-r--r--arch/s390/include/asm/thread_info.h5
-rw-r--r--arch/s390/kernel/smp.c24
-rw-r--r--arch/s390/mm/pgtable.c16
-rw-r--r--arch/sparc64/Kconfig3
-rw-r--r--arch/sparc64/Kconfig.debug2
-rw-r--r--arch/sparc64/kernel/Makefile2
-rw-r--r--arch/sparc64/kernel/ftrace.c26
-rw-r--r--arch/sparc64/lib/mcount.S4
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/Kconfig.cpu24
-rw-r--r--arch/x86/boot/compressed/.gitignore2
-rw-r--r--arch/x86/include/asm/dma-mapping.h4
-rw-r--r--arch/x86/include/asm/es7000/wakecpu.h9
-rw-r--r--arch/x86/include/asm/ftrace.h4
-rw-r--r--arch/x86/include/asm/io.h6
-rw-r--r--arch/x86/include/asm/iommu.h1
-rw-r--r--arch/x86/include/asm/kvm_host.h3
-rw-r--r--arch/x86/include/asm/mach-default/mach_wakecpu.h9
-rw-r--r--arch/x86/include/asm/pgtable-3level.h4
-rw-r--r--arch/x86/include/asm/smp.h6
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h1
-rw-r--r--arch/x86/kernel/Makefile3
-rw-r--r--arch/x86/kernel/cpu/addon_cpuid_features.c2
-rw-r--r--arch/x86/kernel/cpu/common.c6
-rw-r--r--arch/x86/kernel/entry_32.S4
-rw-r--r--arch/x86/kernel/entry_64.S4
-rw-r--r--arch/x86/kernel/ftrace.c50
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c7
-rw-r--r--arch/x86/kernel/i386_ksyms_32.c2
-rw-r--r--arch/x86/kernel/k8.c1
-rw-r--r--arch/x86/kernel/machine_kexec_32.c5
-rw-r--r--arch/x86/kernel/microcode_amd.c2
-rw-r--r--arch/x86/kernel/microcode_core.c4
-rw-r--r--arch/x86/kernel/pci-dma.c16
-rw-r--r--arch/x86/kernel/pci-gart_64.c2
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c14
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/kernel/vsmp_64.c2
-rw-r--r--arch/x86/kernel/x8664_ksyms_64.c2
-rw-r--r--arch/x86/kvm/i8254.c11
-rw-r--r--arch/x86/kvm/i8254.h1
-rw-r--r--arch/x86/kvm/mmu.c1
-rw-r--r--arch/x86/kvm/x86.c6
-rw-r--r--arch/x86/lguest/boot.c32
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c12
-rw-r--r--arch/x86/mm/gup.c2
-rw-r--r--arch/x86/mm/init_64.c75
-rw-r--r--arch/x86/mm/ioremap.c22
-rw-r--r--arch/x86/mm/pat.c4
-rw-r--r--arch/x86/xen/Makefile2
-rw-r--r--arch/x86/xen/mmu.c18
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/ata/ahci.c41
-rw-r--r--drivers/ata/ata_generic.c2
-rw-r--r--drivers/ata/ata_piix.c2
-rw-r--r--drivers/ata/libata-core.c35
-rw-r--r--drivers/ata/libata-eh.c14
-rw-r--r--drivers/ata/libata-scsi.c9
-rw-r--r--drivers/ata/pata_acpi.c2
-rw-r--r--drivers/ata/pata_ali.c1
-rw-r--r--drivers/ata/pata_amd.c1
-rw-r--r--drivers/ata/pata_artop.c2
-rw-r--r--drivers/ata/pata_atiixp.c1
-rw-r--r--drivers/ata/pata_cmd640.c1
-rw-r--r--drivers/ata/pata_cmd64x.c2
-rw-r--r--drivers/ata/pata_cs5530.c1
-rw-r--r--drivers/ata/pata_cs5535.c2
-rw-r--r--drivers/ata/pata_cypress.c2
-rw-r--r--drivers/ata/pata_efar.c2
-rw-r--r--drivers/ata/pata_isapnp.c2
-rw-r--r--drivers/ata/pata_it821x.c7
-rw-r--r--drivers/ata/pata_jmicron.c2
-rw-r--r--drivers/ata/pata_legacy.c2
-rw-r--r--drivers/ata/pata_marvell.c2
-rw-r--r--drivers/ata/pata_mpiix.c2
-rw-r--r--drivers/ata/pata_netcell.c2
-rw-r--r--drivers/ata/pata_ninja32.c44
-rw-r--r--drivers/ata/pata_ns87410.c1
-rw-r--r--drivers/ata/pata_ns87415.c2
-rw-r--r--drivers/ata/pata_oldpiix.c2
-rw-r--r--drivers/ata/pata_opti.c1
-rw-r--r--drivers/ata/pata_optidma.c1
-rw-r--r--drivers/ata/pata_pcmcia.c2
-rw-r--r--drivers/ata/pata_pdc202xx_old.c2
-rw-r--r--drivers/ata/pata_platform.c2
-rw-r--r--drivers/ata/pata_qdi.c2
-rw-r--r--drivers/ata/pata_radisys.c2
-rw-r--r--drivers/ata/pata_sc1200.c2
-rw-r--r--drivers/ata/pata_scc.c2
-rw-r--r--drivers/ata/pata_serverworks.c1
-rw-r--r--drivers/ata/pata_sil680.c1
-rw-r--r--drivers/ata/pata_sis.c2
-rw-r--r--drivers/ata/pata_sl82c105.c1
-rw-r--r--drivers/ata/pata_triflex.c2
-rw-r--r--drivers/ata/pata_via.c1
-rw-r--r--drivers/ata/pata_winbond.c2
-rw-r--r--drivers/ata/sata_sil24.c5
-rw-r--r--drivers/base/sys.c10
-rw-r--r--drivers/block/loop.c5
-rw-r--r--drivers/bluetooth/bluecard_cs.c2
-rw-r--r--drivers/bluetooth/bt3c_cs.c6
-rw-r--r--drivers/bluetooth/btuart_cs.c6
-rw-r--r--drivers/bluetooth/dtl1_cs.c7
-rw-r--r--drivers/char/Kconfig22
-rw-r--r--drivers/char/Makefile2
-rw-r--r--drivers/char/ds1286.c585
-rw-r--r--drivers/char/ip27-rtc.c329
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c1
-rw-r--r--drivers/char/pcmcia/synclink_cs.c2
-rw-r--r--drivers/edac/Kconfig7
-rw-r--r--drivers/edac/Makefile1
-rw-r--r--drivers/edac/cell_edac.c3
-rw-r--r--drivers/edac/x38_edac.c524
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-dell.c1
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/usbhid/hid-core.c60
-rw-r--r--drivers/hid/usbhid/usbhid.h2
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c2
-rw-r--r--drivers/i2c/busses/scx200_i2c.c1
-rw-r--r--drivers/input/misc/sgi_btns.c1
-rw-r--r--drivers/leds/leds-da903x.c2
-rw-r--r--drivers/md/dm-raid1.c3
-rw-r--r--drivers/md/dm-snap.c32
-rw-r--r--drivers/md/dm-snap.h2
-rw-r--r--drivers/md/md.c7
-rw-r--r--drivers/message/i2o/i2o_block.c12
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c1
-rw-r--r--drivers/misc/sgi-xp/Makefile4
-rw-r--r--drivers/misc/sgi-xp/xp.h4
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c4
-rw-r--r--drivers/misc/sony-laptop.c6
-rw-r--r--drivers/mmc/host/mmci.c5
-rw-r--r--drivers/net/amd8111e.c23
-rw-r--r--drivers/net/arm/at91_ether.c6
-rw-r--r--drivers/net/atlx/atl1.c7
-rw-r--r--drivers/net/atlx/atl1.h2
-rw-r--r--drivers/net/bonding/bond_alb.c13
-rw-r--r--drivers/net/bonding/bond_main.c52
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_qmr.c57
-rw-r--r--drivers/net/ehea/ehea_qmr.h3
-rw-r--r--drivers/net/gianfar.c16
-rw-r--r--drivers/net/gianfar_mii.c21
-rw-r--r--drivers/net/gianfar_mii.h3
-rw-r--r--drivers/net/ibm_newemac/core.c2
-rw-r--r--drivers/net/loopback.c9
-rw-r--r--drivers/net/mlx4/en_main.c1
-rw-r--r--drivers/net/mlx4/fw.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/pppoe.c6
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/tulip/dmfe.c12
-rw-r--r--drivers/net/usb/dm9601.c15
-rw-r--r--drivers/net/via-velocity.c11
-rw-r--r--drivers/net/wan/syncppp.c5
-rw-r--r--drivers/net/wan/z85230.c1
-rw-r--r--drivers/net/wireless/ath5k/base.c37
-rw-r--r--drivers/net/wireless/ath5k/debug.c2
-rw-r--r--drivers/net/wireless/ath5k/initvals.c2
-rw-r--r--drivers/net/wireless/ath5k/reset.c22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/libertas/cmd.c4
-rw-r--r--drivers/net/wireless/libertas/scan.c4
-rw-r--r--drivers/net/wireless/p54/p54common.c5
-rw-r--r--drivers/net/wireless/p54/p54pci.c132
-rw-r--r--drivers/net/wireless/rt2x00/Kconfig2
-rw-r--r--drivers/parport/parport_cs.c2
-rw-r--r--drivers/pci/quirks.c14
-rw-r--r--drivers/pcmcia/pcmcia_resource.c3
-rw-r--r--drivers/regulator/da903x.c29
-rw-r--r--drivers/rtc/rtc-ds3234.c4
-rw-r--r--drivers/rtc/rtc-s3c.c8
-rw-r--r--drivers/s390/char/tape_block.c6
-rw-r--r--drivers/s390/char/tape_core.c8
-rw-r--r--drivers/s390/cio/qdio_debug.c19
-rw-r--r--drivers/s390/cio/qdio_main.c1
-rw-r--r--drivers/s390/net/qeth_core_main.c3
-rw-r--r--drivers/s390/net/qeth_l2_main.c27
-rw-r--r--drivers/s390/net/qeth_l3_main.c13
-rw-r--r--drivers/s390/net/qeth_l3_sys.c7
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/serial/Kconfig4
-rw-r--r--drivers/serial/netx-serial.c4
-rw-r--r--drivers/usb/class/usbtmc.c2
-rw-r--r--drivers/usb/core/hcd.c35
-rw-r--r--drivers/usb/core/hcd.h1
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/usb/core/urb.c22
-rw-r--r--drivers/usb/serial/usb-serial.c1
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/video/backlight/corgi_lcd.c4
-rw-r--r--drivers/video/console/fbcon.c2
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/via/global.h3
-rw-r--r--drivers/watchdog/acquirewdt.c6
-rw-r--r--drivers/watchdog/advantechwdt.c6
-rw-r--r--drivers/watchdog/bfin_wdt.c2
-rw-r--r--drivers/watchdog/eurotechwdt.c4
-rw-r--r--drivers/watchdog/i6300esb.c3
-rw-r--r--drivers/watchdog/ib700wdt.c6
-rw-r--r--drivers/watchdog/indydog.c2
-rw-r--r--drivers/watchdog/mpcore_wdt.c4
-rw-r--r--drivers/watchdog/omap_wdt.c2
-rw-r--r--drivers/watchdog/pcwd_pci.c2
-rw-r--r--drivers/watchdog/pcwd_usb.c2
-rw-r--r--drivers/watchdog/rc32434_wdt.c3
-rw-r--r--drivers/watchdog/s3c2410_wdt.c2
-rw-r--r--drivers/watchdog/sa1100_wdt.c2
-rw-r--r--drivers/watchdog/sb_wdog.c4
-rw-r--r--drivers/watchdog/sbc8360.c6
-rw-r--r--drivers/watchdog/sbc_epx_c3.c2
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c2
-rw-r--r--drivers/watchdog/softdog.c3
-rw-r--r--drivers/watchdog/w83627hf_wdt.c6
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--drivers/watchdog/wafer5823wdt.c4
-rw-r--r--drivers/watchdog/wdt.c4
-rw-r--r--drivers/watchdog/wdt285.c3
-rw-r--r--drivers/watchdog/wdt_pci.c4
-rw-r--r--drivers/xen/events.c2
-rw-r--r--drivers/xen/manage.c2
-rw-r--r--drivers/xen/xencomm.c23
-rw-r--r--fs/ecryptfs/crypto.c15
-rw-r--r--fs/fat/inode.c2
-rw-r--r--fs/jbd/transaction.c1
-rw-r--r--fs/libfs.c2
-rw-r--r--fs/nfs/inode.c11
-rw-r--r--fs/ocfs2/file.c3
-rw-r--r--fs/splice.c4
-rw-r--r--include/asm-generic/kdebug.h1
-rw-r--r--include/linux/cgroup.h4
-rw-r--r--include/linux/freezer.h5
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/fsl_devices.h3
-rw-r--r--include/linux/ftrace.h48
-rw-r--r--include/linux/hid.h1
-rw-r--r--include/linux/init.h6
-rw-r--r--include/linux/kernel.h4
-rw-r--r--include/linux/kvm.h6
-rw-r--r--include/linux/kvm_host.h7
-rw-r--r--include/linux/mod_devicetable.h1
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/resource.h4
-rw-r--r--include/linux/sched.h12
-rw-r--r--include/linux/security.h6
-rw-r--r--include/linux/spi/spi_bitbang.h3
-rw-r--r--include/net/mac80211.h11
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/sock.h1
-rw-r--r--include/scsi/scsi_tcq.h14
-rw-r--r--include/sound/soc.h3
-rw-r--r--init/Kconfig16
-rw-r--r--init/do_mounts_md.c2
-rw-r--r--kernel/Makefile4
-rw-r--r--kernel/cgroup_freezer.c51
-rw-r--r--kernel/freezer.c20
-rw-r--r--kernel/irq/proc.c2
-rw-r--r--kernel/lockdep.c17
-rw-r--r--kernel/printk.c39
-rw-r--r--kernel/profile.c2
-rw-r--r--kernel/resource.c6
-rw-r--r--kernel/sched.c3
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sched_fair.c169
-rw-r--r--kernel/sched_idletask.c5
-rw-r--r--kernel/sched_rt.c5
-rw-r--r--kernel/signal.c3
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/trace/Kconfig29
-rw-r--r--kernel/trace/Makefile6
-rw-r--r--kernel/trace/ftrace.c608
-rw-r--r--kernel/trace/ring_buffer.c6
-rw-r--r--kernel/trace/trace.c22
-rw-r--r--kernel/trace/trace.h22
-rw-r--r--kernel/trace/trace_functions.c2
-rw-r--r--kernel/trace/trace_irqsoff.c4
-rw-r--r--kernel/trace/trace_sched_wakeup.c4
-rw-r--r--kernel/trace/trace_selftest.c18
-rw-r--r--kernel/trace/trace_stack.c4
-rw-r--r--kernel/tracepoint.c8
-rw-r--r--lib/Makefile2
-rw-r--r--lib/dynamic_printk.c4
-rw-r--r--lib/swiotlb.c6
-rw-r--r--mm/filemap.c242
-rw-r--r--mm/mmap.c3
-rw-r--r--mm/nommu.c3
-rw-r--r--mm/shmem.c8
-rw-r--r--mm/vmalloc.c3
-rw-r--r--net/core/net_namespace.c32
-rw-r--r--net/core/pktgen.c27
-rw-r--r--net/ipv4/cipso_ipv4.c7
-rw-r--r--net/mac80211/rc80211_minstrel_debugfs.c6
-rw-r--r--net/netfilter/nf_conntrack_proto_gre.c4
-rw-r--r--net/netlabel/netlabel_addrlist.c2
-rw-r--r--net/netlabel/netlabel_addrlist.h22
-rw-r--r--net/netlabel/netlabel_mgmt.c2
-rw-r--r--net/rfkill/rfkill-input.c5
-rw-r--r--net/sunrpc/auth.c18
-rw-r--r--net/sunrpc/xprtsock.c58
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--scripts/Makefile.build10
-rw-r--r--scripts/Makefile.modpost2
-rw-r--r--scripts/bootgraph.pl19
-rwxr-xr-xscripts/checksyscalls.sh4
-rw-r--r--scripts/headers_check.pl10
-rw-r--r--scripts/headers_install.pl17
-rw-r--r--scripts/mod/sumversion.c12
-rwxr-xr-xscripts/package/mkspec5
-rwxr-xr-xscripts/recordmcount.pl28
-rwxr-xr-xscripts/setlocalversion6
-rw-r--r--security/security.c9
-rw-r--r--sound/core/control.c7
-rw-r--r--sound/pci/ac97/ac97_codec.c6
-rw-r--r--sound/pci/hda/hda_codec.c1
-rw-r--r--sound/pci/hda/hda_intel.c29
-rw-r--r--sound/pci/hda/patch_analog.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c4
-rw-r--r--sound/pci/ice1712/ice1712.c6
-rw-r--r--sound/pci/intel8x0.c1
-rw-r--r--sound/soc/codecs/wm9713.c2
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c14
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/usb/usbquirks.h30
-rw-r--r--virt/kvm/irq_comm.c42
-rw-r--r--virt/kvm/kvm_main.c12
493 files changed, 6718 insertions, 4013 deletions
diff --git a/.mailmap b/.mailmap
index eba9bf953ef5..97f7b4fb6139 100644
--- a/.mailmap
+++ b/.mailmap
@@ -80,6 +80,8 @@ Nguyen Anh Quynh <aquynh@gmail.com>
80Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> 80Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
81Patrick Mochel <mochel@digitalimplant.org> 81Patrick Mochel <mochel@digitalimplant.org>
82Peter A Jonsson <pj@ludd.ltu.se> 82Peter A Jonsson <pj@ludd.ltu.se>
83Peter Oruba <peter@oruba.de>
84Peter Oruba <peter.oruba@amd.com>
83Praveen BP <praveenbp@ti.com> 85Praveen BP <praveenbp@ti.com>
84Rajesh Shah <rajesh.shah@intel.com> 86Rajesh Shah <rajesh.shah@intel.com>
85Ralf Baechle <ralf@linux-mips.org> 87Ralf Baechle <ralf@linux-mips.org>
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 7286ad090db7..edef85ce1195 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -172,7 +172,7 @@ i2c/
172 - directory with info about the I2C bus/protocol (2 wire, kHz speed). 172 - directory with info about the I2C bus/protocol (2 wire, kHz speed).
173i2o/ 173i2o/
174 - directory with info about the Linux I2O subsystem. 174 - directory with info about the Linux I2O subsystem.
175i386/ 175x86/i386/
176 - directory with info about Linux on Intel 32 bit architecture. 176 - directory with info about Linux on Intel 32 bit architecture.
177ia64/ 177ia64/
178 - directory with info about Linux on Intel 64 bit architecture. 178 - directory with info about Linux on Intel 64 bit architecture.
@@ -382,7 +382,7 @@ w1/
382 - directory with documents regarding the 1-wire (w1) subsystem. 382 - directory with documents regarding the 1-wire (w1) subsystem.
383watchdog/ 383watchdog/
384 - how to auto-reboot Linux if it has "fallen and can't get up". ;-) 384 - how to auto-reboot Linux if it has "fallen and can't get up". ;-)
385x86_64/ 385x86/x86_64/
386 - directory with info on Linux support for AMD x86-64 (Hammer) machines. 386 - directory with info on Linux support for AMD x86-64 (Hammer) machines.
387zorro.txt 387zorro.txt
388 - info on writing drivers for Zorro bus devices found on Amigas. 388 - info on writing drivers for Zorro bus devices found on Amigas.
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index fabc06466b93..9b1f6ca100d1 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -136,7 +136,7 @@ quiet_cmd_db2ps = PS $@
136%.ps : %.xml 136%.ps : %.xml
137 $(call cmd,db2ps) 137 $(call cmd,db2ps)
138 138
139quiet_cmd_db2pdf = PDF $@ 139quiet_cmd_db2pdf = PDF $@
140 cmd_db2pdf = $(subst TYPE,pdf, $($(PDF_METHOD)template)) 140 cmd_db2pdf = $(subst TYPE,pdf, $($(PDF_METHOD)template))
141%.pdf : %.xml 141%.pdf : %.xml
142 $(call cmd,db2pdf) 142 $(call cmd,db2pdf)
@@ -148,7 +148,7 @@ build_main_index = rm -rf $(main_idx) && \
148 echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \ 148 echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \
149 cat $(HTML) >> $(main_idx) 149 cat $(HTML) >> $(main_idx)
150 150
151quiet_cmd_db2html = HTML $@ 151quiet_cmd_db2html = HTML $@
152 cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \ 152 cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \
153 echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ 153 echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \
154 $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ 154 $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
diff --git a/Documentation/DocBook/deviceiobook.tmpl b/Documentation/DocBook/deviceiobook.tmpl
index 60d6e0b81bd9..3ed88126ab8f 100644
--- a/Documentation/DocBook/deviceiobook.tmpl
+++ b/Documentation/DocBook/deviceiobook.tmpl
@@ -24,7 +24,7 @@
24 <surname>Cox</surname> 24 <surname>Cox</surname>
25 <affiliation> 25 <affiliation>
26 <address> 26 <address>
27 <email>alan@redhat.com</email> 27 <email>alan@lxorguk.ukuu.org.uk</email>
28 </address> 28 </address>
29 </affiliation> 29 </affiliation>
30 </author> 30 </author>
diff --git a/Documentation/DocBook/mcabook.tmpl b/Documentation/DocBook/mcabook.tmpl
index 499eddc2d079..467ccac6ec50 100644
--- a/Documentation/DocBook/mcabook.tmpl
+++ b/Documentation/DocBook/mcabook.tmpl
@@ -12,7 +12,7 @@
12 <surname>Cox</surname> 12 <surname>Cox</surname>
13 <affiliation> 13 <affiliation>
14 <address> 14 <address>
15 <email>alan@redhat.com</email> 15 <email>alan@lxorguk.ukuu.org.uk</email>
16 </address> 16 </address>
17 </affiliation> 17 </affiliation>
18 </author> 18 </author>
diff --git a/Documentation/DocBook/wanbook.tmpl b/Documentation/DocBook/wanbook.tmpl
index 9eebcc304de4..8c93db122f04 100644
--- a/Documentation/DocBook/wanbook.tmpl
+++ b/Documentation/DocBook/wanbook.tmpl
@@ -12,7 +12,7 @@
12 <surname>Cox</surname> 12 <surname>Cox</surname>
13 <affiliation> 13 <affiliation>
14 <address> 14 <address>
15 <email>alan@redhat.com</email> 15 <email>alan@lxorguk.ukuu.org.uk</email>
16 </address> 16 </address>
17 </affiliation> 17 </affiliation>
18 </author> 18 </author>
diff --git a/Documentation/DocBook/z8530book.tmpl b/Documentation/DocBook/z8530book.tmpl
index a42a8a4c7689..6f3883be877e 100644
--- a/Documentation/DocBook/z8530book.tmpl
+++ b/Documentation/DocBook/z8530book.tmpl
@@ -12,7 +12,7 @@
12 <surname>Cox</surname> 12 <surname>Cox</surname>
13 <affiliation> 13 <affiliation>
14 <address> 14 <address>
15 <email>alan@redhat.com</email> 15 <email>alan@lxorguk.ukuu.org.uk</email>
16 </address> 16 </address>
17 </affiliation> 17 </affiliation>
18 </author> 18 </author>
diff --git a/Documentation/ManagementStyle b/Documentation/ManagementStyle
index 49a8efa5afeb..a5f0ea58c788 100644
--- a/Documentation/ManagementStyle
+++ b/Documentation/ManagementStyle
@@ -17,7 +17,7 @@ companies. If you sign purchase orders or you have any clue about the
17budget of your group, you're almost certainly not a kernel manager. 17budget of your group, you're almost certainly not a kernel manager.
18These suggestions may or may not apply to you. 18These suggestions may or may not apply to you.
19 19
20First off, I'd suggest buying "Seven Habits of Highly Successful 20First off, I'd suggest buying "Seven Habits of Highly Effective
21People", and NOT read it. Burn it, it's a great symbolic gesture. 21People", and NOT read it. Burn it, it's a great symbolic gesture.
22 22
23(*) This document does so not so much by answering the question, but by 23(*) This document does so not so much by answering the question, but by
diff --git a/Documentation/accounting/.gitignore b/Documentation/accounting/.gitignore
new file mode 100644
index 000000000000..86485203c4ae
--- /dev/null
+++ b/Documentation/accounting/.gitignore
@@ -0,0 +1 @@
getdelays
diff --git a/Documentation/arm/empeg/README b/Documentation/arm/empeg/README
deleted file mode 100644
index 09cc8d03ae58..000000000000
--- a/Documentation/arm/empeg/README
+++ /dev/null
@@ -1,13 +0,0 @@
1Empeg, Ltd's Empeg MP3 Car Audio Player
2
3The initial design is to go in your car, but you can use it at home, on a
4boat... almost anywhere. The principle is to store CD-quality music using
5MPEG technology onto a hard disk in the unit, and use the power of the
6embedded computer to serve up the music you want.
7
8For more details, see:
9
10 http://www.empeg.com
11
12
13
diff --git a/Documentation/arm/empeg/ir.txt b/Documentation/arm/empeg/ir.txt
deleted file mode 100644
index 10a297450164..000000000000
--- a/Documentation/arm/empeg/ir.txt
+++ /dev/null
@@ -1,49 +0,0 @@
1Infra-red driver documentation.
2
3Mike Crowe <mac@empeg.com>
4(C) Empeg Ltd 1999
5
6Not a lot here yet :-)
7
8The Kenwood KCA-R6A remote control generates a sequence like the following:
9
10Go low for approx 16T (Around 9000us)
11Go high for approx 8T (Around 4000us)
12Go low for less than 2T (Around 750us)
13
14For each of the 32 bits
15 Go high for more than 2T (Around 1500us) == 1
16 Go high for less than T (Around 400us) == 0
17 Go low for less than 2T (Around 750us)
18
19Rather than repeat a signal when the button is held down certain buttons
20generate the following code to indicate repetition.
21
22Go low for approx 16T
23Go high for approx 4T
24Go low for less than 2T
25
26(By removing the <2T from the start of the sequence and placing at the end
27 it can be considered a stop bit but I found it easier to deal with it at
28 the start).
29
30The 32 bits are encoded as XxYy where x and y are the actual data values
31while X and Y are the logical inverses of the associated data values. Using
32LSB first yields sensible codes for the numbers.
33
34All codes are of the form b9xx
35
36The numeric keys generate the code 0x where x is the number pressed.
37
38Tuner 1c
39Tape 1d
40CD 1e
41CD-MD-CH 1f
42Track- 0a
43Track+ 0b
44Rewind 0c
45FF 0d
46DNPP 5e
47Play/Pause 0e
48Vol+ 14
49Vol- 15
diff --git a/Documentation/arm/empeg/mkdevs b/Documentation/arm/empeg/mkdevs
deleted file mode 100644
index 7a85e28d14f3..000000000000
--- a/Documentation/arm/empeg/mkdevs
+++ /dev/null
@@ -1,11 +0,0 @@
1#!/bin/sh
2mknod /dev/display c 244 0
3mknod /dev/ir c 242 0
4mknod /dev/usb0 c 243 0
5mknod /dev/audio c 245 4
6mknod /dev/dsp c 245 3
7mknod /dev/mixer c 245 0
8mknod /dev/empeg_state c 246 0
9mknod /dev/radio0 c 81 64
10ln -sf radio0 radio
11ln -sf usb0 usb
diff --git a/Documentation/auxdisplay/.gitignore b/Documentation/auxdisplay/.gitignore
new file mode 100644
index 000000000000..7af222860a96
--- /dev/null
+++ b/Documentation/auxdisplay/.gitignore
@@ -0,0 +1 @@
cfag12864b-example
diff --git a/Documentation/connector/.gitignore b/Documentation/connector/.gitignore
new file mode 100644
index 000000000000..d2b9c32accd4
--- /dev/null
+++ b/Documentation/connector/.gitignore
@@ -0,0 +1 @@
ucon
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 8362860e21a7..23d2f4460deb 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -161,8 +161,12 @@ prototypes:
161 int (*set_page_dirty)(struct page *page); 161 int (*set_page_dirty)(struct page *page);
162 int (*readpages)(struct file *filp, struct address_space *mapping, 162 int (*readpages)(struct file *filp, struct address_space *mapping,
163 struct list_head *pages, unsigned nr_pages); 163 struct list_head *pages, unsigned nr_pages);
164 int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); 164 int (*write_begin)(struct file *, struct address_space *mapping,
165 int (*commit_write)(struct file *, struct page *, unsigned, unsigned); 165 loff_t pos, unsigned len, unsigned flags,
166 struct page **pagep, void **fsdata);
167 int (*write_end)(struct file *, struct address_space *mapping,
168 loff_t pos, unsigned len, unsigned copied,
169 struct page *page, void *fsdata);
166 sector_t (*bmap)(struct address_space *, sector_t); 170 sector_t (*bmap)(struct address_space *, sector_t);
167 int (*invalidatepage) (struct page *, unsigned long); 171 int (*invalidatepage) (struct page *, unsigned long);
168 int (*releasepage) (struct page *, int); 172 int (*releasepage) (struct page *, int);
@@ -180,8 +184,6 @@ sync_page: no maybe
180writepages: no 184writepages: no
181set_page_dirty no no 185set_page_dirty no no
182readpages: no 186readpages: no
183prepare_write: no yes yes
184commit_write: no yes yes
185write_begin: no locks the page yes 187write_begin: no locks the page yes
186write_end: no yes, unlocks yes 188write_end: no yes, unlocks yes
187perform_write: no n/a yes 189perform_write: no n/a yes
@@ -191,7 +193,7 @@ releasepage: no yes
191direct_IO: no 193direct_IO: no
192launder_page: no yes 194launder_page: no yes
193 195
194 ->prepare_write(), ->commit_write(), ->sync_page() and ->readpage() 196 ->write_begin(), ->write_end(), ->sync_page() and ->readpage()
195may be called from the request handler (/dev/loop). 197may be called from the request handler (/dev/loop).
196 198
197 ->readpage() unlocks the page, either synchronously or via I/O 199 ->readpage() unlocks the page, either synchronously or via I/O
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index c4d348dabe94..5579bda58a6d 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -492,7 +492,7 @@ written-back to storage typically in whole pages, however the
492address_space has finer control of write sizes. 492address_space has finer control of write sizes.
493 493
494The read process essentially only requires 'readpage'. The write 494The read process essentially only requires 'readpage'. The write
495process is more complicated and uses prepare_write/commit_write or 495process is more complicated and uses write_begin/write_end or
496set_page_dirty to write data into the address_space, and writepage, 496set_page_dirty to write data into the address_space, and writepage,
497sync_page, and writepages to writeback data to storage. 497sync_page, and writepages to writeback data to storage.
498 498
@@ -521,8 +521,6 @@ struct address_space_operations {
521 int (*set_page_dirty)(struct page *page); 521 int (*set_page_dirty)(struct page *page);
522 int (*readpages)(struct file *filp, struct address_space *mapping, 522 int (*readpages)(struct file *filp, struct address_space *mapping,
523 struct list_head *pages, unsigned nr_pages); 523 struct list_head *pages, unsigned nr_pages);
524 int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
525 int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
526 int (*write_begin)(struct file *, struct address_space *mapping, 524 int (*write_begin)(struct file *, struct address_space *mapping,
527 loff_t pos, unsigned len, unsigned flags, 525 loff_t pos, unsigned len, unsigned flags,
528 struct page **pagep, void **fsdata); 526 struct page **pagep, void **fsdata);
@@ -598,37 +596,7 @@ struct address_space_operations {
598 readpages is only used for read-ahead, so read errors are 596 readpages is only used for read-ahead, so read errors are
599 ignored. If anything goes wrong, feel free to give up. 597 ignored. If anything goes wrong, feel free to give up.
600 598
601 prepare_write: called by the generic write path in VM to set up a write 599 write_begin:
602 request for a page. This indicates to the address space that
603 the given range of bytes is about to be written. The
604 address_space should check that the write will be able to
605 complete, by allocating space if necessary and doing any other
606 internal housekeeping. If the write will update parts of
607 any basic-blocks on storage, then those blocks should be
608 pre-read (if they haven't been read already) so that the
609 updated blocks can be written out properly.
610 The page will be locked.
611
612 Note: the page _must not_ be marked uptodate in this function
613 (or anywhere else) unless it actually is uptodate right now. As
614 soon as a page is marked uptodate, it is possible for a concurrent
615 read(2) to copy it to userspace.
616
617 commit_write: If prepare_write succeeds, new data will be copied
618 into the page and then commit_write will be called. It will
619 typically update the size of the file (if appropriate) and
620 mark the inode as dirty, and do any other related housekeeping
621 operations. It should avoid returning an error if possible -
622 errors should have been handled by prepare_write.
623
624 write_begin: This is intended as a replacement for prepare_write. The
625 key differences being that:
626 - it returns a locked page (in *pagep) rather than being
627 given a pre locked page;
628 - it must be able to cope with short writes (where the
629 length passed to write_begin is greater than the number
630 of bytes copied into the page).
631
632 Called by the generic buffered write code to ask the filesystem to 600 Called by the generic buffered write code to ask the filesystem to
633 prepare to write len bytes at the given offset in the file. The 601 prepare to write len bytes at the given offset in the file. The
634 address_space should check that the write will be able to complete, 602 address_space should check that the write will be able to complete,
@@ -640,6 +608,9 @@ struct address_space_operations {
640 The filesystem must return the locked pagecache page for the specified 608 The filesystem must return the locked pagecache page for the specified
641 offset, in *pagep, for the caller to write into. 609 offset, in *pagep, for the caller to write into.
642 610
611 It must be able to cope with short writes (where the length passed to
612 write_begin is greater than the number of bytes copied into the page).
613
643 flags is a field for AOP_FLAG_xxx flags, described in 614 flags is a field for AOP_FLAG_xxx flags, described in
644 include/linux/fs.h. 615 include/linux/fs.h.
645 616
diff --git a/Documentation/ftrace.txt b/Documentation/ftrace.txt
index d330fe3103da..ea5a827395dd 100644
--- a/Documentation/ftrace.txt
+++ b/Documentation/ftrace.txt
@@ -291,6 +291,9 @@ explains which is which.
291 CPU#: The CPU which the process was running on. 291 CPU#: The CPU which the process was running on.
292 292
293 irqs-off: 'd' interrupts are disabled. '.' otherwise. 293 irqs-off: 'd' interrupts are disabled. '.' otherwise.
294 Note: If the architecture does not support a way to
295 read the irq flags variable, an 'X' will always
296 be printed here.
294 297
295 need-resched: 'N' task need_resched is set, '.' otherwise. 298 need-resched: 'N' task need_resched is set, '.' otherwise.
296 299
diff --git a/Documentation/i2c/busses/i2c-sis96x b/Documentation/i2c/busses/i2c-sis96x
index 266481fd26e2..70e6a0cc1e15 100644
--- a/Documentation/i2c/busses/i2c-sis96x
+++ b/Documentation/i2c/busses/i2c-sis96x
@@ -42,7 +42,7 @@ I suspect that this driver could be made to work for the following SiS
42chipsets as well: 635, and 635T. If anyone owns a board with those chips 42chipsets as well: 635, and 635T. If anyone owns a board with those chips
43AND is willing to risk crashing & burning an otherwise well-behaved kernel 43AND is willing to risk crashing & burning an otherwise well-behaved kernel
44in the name of progress... please contact me at <mhoffman@lightlink.com> or 44in the name of progress... please contact me at <mhoffman@lightlink.com> or
45via the project's mailing list: <i2c@lm-sensors.org>. Please send bug 45via the linux-i2c mailing list: <linux-i2c@vger.kernel.org>. Please send bug
46reports and/or success stories as well. 46reports and/or success stories as well.
47 47
48 48
diff --git a/Documentation/ia64/.gitignore b/Documentation/ia64/.gitignore
new file mode 100644
index 000000000000..ab806edc8732
--- /dev/null
+++ b/Documentation/ia64/.gitignore
@@ -0,0 +1 @@
aliasing-test
diff --git a/Documentation/isdn/CREDITS b/Documentation/isdn/CREDITS
index 8cac6c2f23ee..c1679e913fca 100644
--- a/Documentation/isdn/CREDITS
+++ b/Documentation/isdn/CREDITS
@@ -5,7 +5,7 @@ I want to thank all who contributed to this project and especially to:
5Thomas Bogendörfer (tsbogend@bigbug.franken.de) 5Thomas Bogendörfer (tsbogend@bigbug.franken.de)
6 Tester, lots of bugfixes and hints. 6 Tester, lots of bugfixes and hints.
7 7
8Alan Cox (alan@redhat.com) 8Alan Cox (alan@lxorguk.ukuu.org.uk)
9 For help getting into standard-kernel. 9 For help getting into standard-kernel.
10 10
11Henner Eisen (eis@baty.hanse.de) 11Henner Eisen (eis@baty.hanse.de)
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO
index 0775cf4798b2..55476982b5ca 100644
--- a/Documentation/ja_JP/HOWTO
+++ b/Documentation/ja_JP/HOWTO
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates for this file, please try 11fork. So if you have any comments or updates for this file, please try
12to update the original English file first. 12to update the original English file first.
13 13
14Last Updated: 2008/08/21 14Last Updated: 2008/10/24
15================================== 15==================================
16ã“ã‚Œã¯ã€ 16ã“ã‚Œã¯ã€
17linux-2.6.27/Documentation/HOWTO 17linux-2.6.28/Documentation/HOWTO
18ã®å’Œè¨³ã§ã™ã€‚ 18ã®å’Œè¨³ã§ã™ã€‚
19 19
20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
21翻訳日: 2008/8/5 21翻訳日: 2008/10/24
22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> 23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com>
24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
@@ -110,8 +110,8 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã¯å¹…広ã„範囲ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’å
110æ–°ã—ã„ドキュメントファイルも追加ã™ã‚‹ã“ã¨ã‚’勧ã‚ã¾ã™ã€‚ 110æ–°ã—ã„ドキュメントファイルも追加ã™ã‚‹ã“ã¨ã‚’勧ã‚ã¾ã™ã€‚
111カーãƒãƒ«ã®å¤‰æ›´ãŒã€ã‚«ãƒ¼ãƒãƒ«ãŒãƒ¦ãƒ¼ã‚¶ç©ºé–“ã«å…¬é–‹ã—ã¦ã„るインターフェイス㮠111カーãƒãƒ«ã®å¤‰æ›´ãŒã€ã‚«ãƒ¼ãƒãƒ«ãŒãƒ¦ãƒ¼ã‚¶ç©ºé–“ã«å…¬é–‹ã—ã¦ã„るインターフェイスã®
112変更を引ãèµ·ã“ã™å ´åˆã€ãã®å¤‰æ›´ã‚’説明ã™ã‚‹ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ãƒšãƒ¼ã‚¸ã®ãƒ‘ッãƒã‚„情報 112変更を引ãèµ·ã“ã™å ´åˆã€ãã®å¤‰æ›´ã‚’説明ã™ã‚‹ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ãƒšãƒ¼ã‚¸ã®ãƒ‘ッãƒã‚„情報
113をマニュアルページã®ãƒ¡ãƒ³ãƒ†ãƒŠ mtk.manpages@gmail.com ã«é€ã‚ãã¨ã‚’勧ã‚ã¾ 113をマニュアルページã®ãƒ¡ãƒ³ãƒ†ãƒŠ mtk.manpages@gmail.com ã«é€ã‚ŠãCC ã‚’
114ã™ã€‚ 114linux-api@ver.kernel.org ã«é€ã‚‹ã“ã¨ã‚’勧ã‚ã¾ã™ã€‚
115 115
116以下ã¯ã‚«ãƒ¼ãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã«å«ã¾ã‚Œã¦ã„る読んã§ãŠãã¹ãファイルã®ä¸€è¦§ã§ 116以下ã¯ã‚«ãƒ¼ãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã«å«ã¾ã‚Œã¦ã„る読んã§ãŠãã¹ãファイルã®ä¸€è¦§ã§
117ã™- 117ã™-
@@ -149,7 +149,7 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã¯å¹…広ã„範囲ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’å
149 ã“ã®ä»–ã«ãƒ‘ッãƒã‚’作る方法ã«ã¤ã„ã¦ã®ã‚ˆãã§ããŸè¨˜è¿°ã¯- 149 ã“ã®ä»–ã«ãƒ‘ッãƒã‚’作る方法ã«ã¤ã„ã¦ã®ã‚ˆãã§ããŸè¨˜è¿°ã¯-
150 150
151 "The Perfect Patch" 151 "The Perfect Patch"
152 http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt 152 http://userweb.kernel.org/~akpm/stuff/tpp.txt
153 "Linux kernel patch submission format" 153 "Linux kernel patch submission format"
154 http://linux.yyz.us/patch-format.html 154 http://linux.yyz.us/patch-format.html
155 155
@@ -664,7 +664,7 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å–
664ã“ã‚Œã«ã¤ã„ã¦å…¨ã¦ãŒã©ã®ã‚ˆã†ã«ã‚ã‚‹ã¹ãã‹ã«ã¤ã„ã¦ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ 664ã“ã‚Œã«ã¤ã„ã¦å…¨ã¦ãŒã©ã®ã‚ˆã†ã«ã‚ã‚‹ã¹ãã‹ã«ã¤ã„ã¦ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡
665ント㮠ChangeLog セクションを見ã¦ãã ã•ã„- 665ント㮠ChangeLog セクションを見ã¦ãã ã•ã„-
666 "The Perfect Patch" 666 "The Perfect Patch"
667 http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt 667 http://userweb.kernel.org/~akpm/stuff/tpp.txt
668 668
669ã“れらã®ã©ã‚Œã‚‚ãŒã€æ™‚ã«ã¯ã¨ã¦ã‚‚困難ã§ã™ã€‚ã“れらã®æ…£ä¾‹ã‚’完璧ã«å®Ÿæ–½ã™ã‚‹ã« 669ã“れらã®ã©ã‚Œã‚‚ãŒã€æ™‚ã«ã¯ã¨ã¦ã‚‚困難ã§ã™ã€‚ã“れらã®æ…£ä¾‹ã‚’完璧ã«å®Ÿæ–½ã™ã‚‹ã«
670ã¯æ•°å¹´ã‹ã‹ã‚‹ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“。ã“ã‚Œã¯ç¶™ç¶šçš„ãªæ”¹å–„ã®ãƒ—ロセスã§ã‚ã‚Šã€ãã®ãŸ 670ã¯æ•°å¹´ã‹ã‹ã‚‹ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“。ã“ã‚Œã¯ç¶™ç¶šçš„ãªæ”¹å–„ã®ãƒ—ロセスã§ã‚ã‚Šã€ãã®ãŸ
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 343e0f0f84b6..1bbcaa8982b6 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -100,7 +100,7 @@ parameter is applicable:
100 X86-32 X86-32, aka i386 architecture is enabled. 100 X86-32 X86-32, aka i386 architecture is enabled.
101 X86-64 X86-64 architecture is enabled. 101 X86-64 X86-64 architecture is enabled.
102 More X86-64 boot options can be found in 102 More X86-64 boot options can be found in
103 Documentation/x86_64/boot-options.txt . 103 Documentation/x86/x86_64/boot-options.txt .
104 X86 Either 32bit or 64bit x86 (same as X86-32+X86-64) 104 X86 Either 32bit or 64bit x86 (same as X86-32+X86-64)
105 105
106In addition, the following text indicates that the option: 106In addition, the following text indicates that the option:
@@ -112,10 +112,10 @@ In addition, the following text indicates that the option:
112Parameters denoted with BOOT are actually interpreted by the boot 112Parameters denoted with BOOT are actually interpreted by the boot
113loader, and have no meaning to the kernel directly. 113loader, and have no meaning to the kernel directly.
114Do not modify the syntax of boot loader parameters without extreme 114Do not modify the syntax of boot loader parameters without extreme
115need or coordination with <Documentation/i386/boot.txt>. 115need or coordination with <Documentation/x86/i386/boot.txt>.
116 116
117There are also arch-specific kernel-parameters not documented here. 117There are also arch-specific kernel-parameters not documented here.
118See for example <Documentation/x86_64/boot-options.txt>. 118See for example <Documentation/x86/x86_64/boot-options.txt>.
119 119
120Note that ALL kernel parameters listed below are CASE SENSITIVE, and that 120Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
121a trailing = on the name of any parameter states that that parameter will 121a trailing = on the name of any parameter states that that parameter will
@@ -1222,7 +1222,7 @@ and is between 256 and 4096 characters. It is defined in the file
1222 1222
1223 mce [X86-32] Machine Check Exception 1223 mce [X86-32] Machine Check Exception
1224 1224
1225 mce=option [X86-64] See Documentation/x86_64/boot-options.txt 1225 mce=option [X86-64] See Documentation/x86/x86_64/boot-options.txt
1226 1226
1227 md= [HW] RAID subsystems devices and level 1227 md= [HW] RAID subsystems devices and level
1228 See Documentation/md.txt. 1228 See Documentation/md.txt.
@@ -1728,7 +1728,7 @@ and is between 256 and 4096 characters. It is defined in the file
1728 See Documentation/paride.txt. 1728 See Documentation/paride.txt.
1729 1729
1730 pirq= [SMP,APIC] Manual mp-table setup 1730 pirq= [SMP,APIC] Manual mp-table setup
1731 See Documentation/i386/IO-APIC.txt. 1731 See Documentation/x86/i386/IO-APIC.txt.
1732 1732
1733 plip= [PPT,NET] Parallel port network link 1733 plip= [PPT,NET] Parallel port network link
1734 Format: { parport<nr> | timid | 0 } 1734 Format: { parport<nr> | timid | 0 }
@@ -2343,7 +2343,7 @@ and is between 256 and 4096 characters. It is defined in the file
2343 See Documentation/fb/modedb.txt. 2343 See Documentation/fb/modedb.txt.
2344 2344
2345 vga= [BOOT,X86-32] Select a particular video mode 2345 vga= [BOOT,X86-32] Select a particular video mode
2346 See Documentation/i386/boot.txt and 2346 See Documentation/x86/i386/boot.txt and
2347 Documentation/svga.txt. 2347 Documentation/svga.txt.
2348 Use vga=ask for menu. 2348 Use vga=ask for menu.
2349 This is actually a boot loader parameter; the value is 2349 This is actually a boot loader parameter; the value is
diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile
index bac037eb1cda..725eef81cd48 100644
--- a/Documentation/lguest/Makefile
+++ b/Documentation/lguest/Makefile
@@ -1,5 +1,5 @@
1# This creates the demonstration utility "lguest" which runs a Linux guest. 1# This creates the demonstration utility "lguest" which runs a Linux guest.
2CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include 2CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include
3LDLIBS:=-lz 3LDLIBS:=-lz
4 4
5all: lguest 5all: lguest
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 7228369d1014..804520633fcf 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -44,7 +44,7 @@
44#include "linux/virtio_console.h" 44#include "linux/virtio_console.h"
45#include "linux/virtio_rng.h" 45#include "linux/virtio_rng.h"
46#include "linux/virtio_ring.h" 46#include "linux/virtio_ring.h"
47#include "asm-x86/bootparam.h" 47#include "asm/bootparam.h"
48/*L:110 We can ignore the 39 include files we need for this program, but I do 48/*L:110 We can ignore the 39 include files we need for this program, but I do
49 * want to draw attention to the use of kernel-style types. 49 * want to draw attention to the use of kernel-style types.
50 * 50 *
@@ -402,7 +402,7 @@ static unsigned long load_bzimage(int fd)
402 void *p = from_guest_phys(0x100000); 402 void *p = from_guest_phys(0x100000);
403 403
404 /* Go back to the start of the file and read the header. It should be 404 /* Go back to the start of the file and read the header. It should be
405 * a Linux boot header (see Documentation/i386/boot.txt) */ 405 * a Linux boot header (see Documentation/x86/i386/boot.txt) */
406 lseek(fd, 0, SEEK_SET); 406 lseek(fd, 0, SEEK_SET);
407 read(fd, &boot, sizeof(boot)); 407 read(fd, &boot, sizeof(boot));
408 408
diff --git a/Documentation/networking/.gitignore b/Documentation/networking/.gitignore
new file mode 100644
index 000000000000..286a5680f490
--- /dev/null
+++ b/Documentation/networking/.gitignore
@@ -0,0 +1 @@
ifenslave
diff --git a/Documentation/networking/dmfe.txt b/Documentation/networking/dmfe.txt
index b1b7499dd9d3..8006c227fda2 100644
--- a/Documentation/networking/dmfe.txt
+++ b/Documentation/networking/dmfe.txt
@@ -60,6 +60,6 @@ Tobias Ringstrom <tori@unhappy.mine.nu> : Current Maintainer
60Contributors: 60Contributors:
61 61
62Marcelo Tosatti <marcelo@conectiva.com.br> 62Marcelo Tosatti <marcelo@conectiva.com.br>
63Alan Cox <alan@redhat.com> 63Alan Cox <alan@lxorguk.ukuu.org.uk>
64Jeff Garzik <jgarzik@pobox.com> 64Jeff Garzik <jgarzik@pobox.com>
65Vojtech Pavlik <vojtech@suse.cz> 65Vojtech Pavlik <vojtech@suse.cz>
diff --git a/Documentation/pcmcia/.gitignore b/Documentation/pcmcia/.gitignore
new file mode 100644
index 000000000000..53d081336757
--- /dev/null
+++ b/Documentation/pcmcia/.gitignore
@@ -0,0 +1 @@
crc32hash
diff --git a/Documentation/scheduler/00-INDEX b/Documentation/scheduler/00-INDEX
index fc234d093fbf..aabcc3a089ba 100644
--- a/Documentation/scheduler/00-INDEX
+++ b/Documentation/scheduler/00-INDEX
@@ -4,8 +4,6 @@ sched-arch.txt
4 - CPU Scheduler implementation hints for architecture specific code. 4 - CPU Scheduler implementation hints for architecture specific code.
5sched-coding.txt 5sched-coding.txt
6 - reference for various scheduler-related methods in the O(1) scheduler. 6 - reference for various scheduler-related methods in the O(1) scheduler.
7sched-design.txt
8 - goals, design and implementation of the Linux O(1) scheduler.
9sched-design-CFS.txt 7sched-design-CFS.txt
10 - goals, design and implementation of the Complete Fair Scheduler. 8 - goals, design and implementation of the Complete Fair Scheduler.
11sched-domains.txt 9sched-domains.txt
diff --git a/Documentation/scheduler/sched-design-CFS.txt b/Documentation/scheduler/sched-design-CFS.txt
index 9d8eb553884c..eb471c7a905e 100644
--- a/Documentation/scheduler/sched-design-CFS.txt
+++ b/Documentation/scheduler/sched-design-CFS.txt
@@ -92,7 +92,7 @@ other HZ detail. Thus the CFS scheduler has no notion of "timeslices" in the
92way the previous scheduler had, and has no heuristics whatsoever. There is 92way the previous scheduler had, and has no heuristics whatsoever. There is
93only one central tunable (you have to switch on CONFIG_SCHED_DEBUG): 93only one central tunable (you have to switch on CONFIG_SCHED_DEBUG):
94 94
95 /proc/sys/kernel/sched_granularity_ns 95 /proc/sys/kernel/sched_min_granularity_ns
96 96
97which can be used to tune the scheduler from "desktop" (i.e., low latencies) to 97which can be used to tune the scheduler from "desktop" (i.e., low latencies) to
98"server" (i.e., good batching) workloads. It defaults to a setting suitable 98"server" (i.e., good batching) workloads. It defaults to a setting suitable
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt
index 709ca991a451..ddace3afc83b 100644
--- a/Documentation/scsi/aacraid.txt
+++ b/Documentation/scsi/aacraid.txt
@@ -128,7 +128,7 @@ Supported Cards/Chipsets
128 128
129People 129People
130------------------------- 130-------------------------
131Alan Cox <alan@redhat.com> 131Alan Cox <alan@lxorguk.ukuu.org.uk>
132Christoph Hellwig <hch@infradead.org> (updates for new-style PCI probing and SCSI host registration, 132Christoph Hellwig <hch@infradead.org> (updates for new-style PCI probing and SCSI host registration,
133 small cleanups/fixes) 133 small cleanups/fixes)
134Matt Domsch <matt_domsch@dell.com> (revision ioctl, adapter messages) 134Matt Domsch <matt_domsch@dell.com> (revision ioctl, adapter messages)
diff --git a/Documentation/spi/.gitignore b/Documentation/spi/.gitignore
new file mode 100644
index 000000000000..4280576397e8
--- /dev/null
+++ b/Documentation/spi/.gitignore
@@ -0,0 +1,2 @@
1spidev_fdx
2spidev_test
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index 4cfc78835bc1..a452227361b1 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -12,6 +12,7 @@ Rules on what kind of patches are accepted, and which ones are not, into the
12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real 12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
13 security issue, or some "oh, that's not good" issue. In short, something 13 security issue, or some "oh, that's not good" issue. In short, something
14 critical. 14 critical.
15 - New device IDs and quirks are also accepted.
15 - No "theoretical race condition" issues, unless an explanation of how the 16 - No "theoretical race condition" issues, unless an explanation of how the
16 race can be exploited is also provided. 17 race can be exploited is also provided.
17 - It cannot contain any "trivial" fixes in it (spelling changes, 18 - It cannot contain any "trivial" fixes in it (spelling changes,
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index bde799e06598..a4ccdd1981cf 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -363,11 +363,21 @@ tainted:
363Non-zero if the kernel has been tainted. Numeric values, which 363Non-zero if the kernel has been tainted. Numeric values, which
364can be ORed together: 364can be ORed together:
365 365
366 1 - A module with a non-GPL license has been loaded, this 366 1 - A module with a non-GPL license has been loaded, this
367 includes modules with no license. 367 includes modules with no license.
368 Set by modutils >= 2.4.9 and module-init-tools. 368 Set by modutils >= 2.4.9 and module-init-tools.
369 2 - A module was force loaded by insmod -f. 369 2 - A module was force loaded by insmod -f.
370 Set by modutils >= 2.4.9 and module-init-tools. 370 Set by modutils >= 2.4.9 and module-init-tools.
371 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. 371 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP.
372 64 - A module from drivers/staging was loaded. 372 8 - A module was forcibly unloaded from the system by rmmod -f.
373 16 - A hardware machine check error occurred on the system.
374 32 - A bad page was discovered on the system.
375 64 - The user has asked that the system be marked "tainted". This
376 could be because they are running software that directly modifies
377 the hardware, or for other reasons.
378 128 - The system has died.
379 256 - The ACPI DSDT has been overridden with one supplied by the user
380 instead of using the one provided by the hardware.
381 512 - A kernel warning has occurred.
3821024 - A module from drivers/staging was loaded.
373 383
diff --git a/Documentation/video4linux/.gitignore b/Documentation/video4linux/.gitignore
new file mode 100644
index 000000000000..952703943e8e
--- /dev/null
+++ b/Documentation/video4linux/.gitignore
@@ -0,0 +1 @@
v4lgrab
diff --git a/Documentation/video4linux/bttv/CONTRIBUTORS b/Documentation/video4linux/bttv/CONTRIBUTORS
index 8aad6dd93d6b..eb41b2650860 100644
--- a/Documentation/video4linux/bttv/CONTRIBUTORS
+++ b/Documentation/video4linux/bttv/CONTRIBUTORS
@@ -3,7 +3,7 @@ Contributors to bttv:
3Michael Chu <mmchu@pobox.com> 3Michael Chu <mmchu@pobox.com>
4 AverMedia fix and more flexible card recognition 4 AverMedia fix and more flexible card recognition
5 5
6Alan Cox <alan@redhat.com> 6Alan Cox <alan@lxorguk.ukuu.org.uk>
7 Video4Linux interface and 2.1.x kernel adaptation 7 Video4Linux interface and 2.1.x kernel adaptation
8 8
9Chris Kleitsch 9Chris Kleitsch
diff --git a/Documentation/vm/.gitignore b/Documentation/vm/.gitignore
new file mode 100644
index 000000000000..33e8a023df02
--- /dev/null
+++ b/Documentation/vm/.gitignore
@@ -0,0 +1 @@
slabinfo
diff --git a/Documentation/watchdog/src/.gitignore b/Documentation/watchdog/src/.gitignore
new file mode 100644
index 000000000000..ac90997dba93
--- /dev/null
+++ b/Documentation/watchdog/src/.gitignore
@@ -0,0 +1,2 @@
1watchdog-simple
2watchdog-test
diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt
index 72ffb5373ec7..f6d561a1a9b2 100644
--- a/Documentation/x86/x86_64/boot-options.txt
+++ b/Documentation/x86/x86_64/boot-options.txt
@@ -35,7 +35,7 @@ APICs
35 35
36 nolapic Don't use the local APIC (alias for i386 compatibility) 36 nolapic Don't use the local APIC (alias for i386 compatibility)
37 37
38 pirq=... See Documentation/i386/IO-APIC.txt 38 pirq=... See Documentation/x86/i386/IO-APIC.txt
39 39
40 noapictimer Don't set up the APIC timer 40 noapictimer Don't set up the APIC timer
41 41
@@ -139,7 +139,7 @@ Non Executable Mappings
139SMP 139SMP
140 140
141 additional_cpus=NUM Allow NUM more CPUs for hotplug 141 additional_cpus=NUM Allow NUM more CPUs for hotplug
142 (defaults are specified by the BIOS, see Documentation/x86_64/cpu-hotplug-spec) 142 (defaults are specified by the BIOS, see Documentation/x86/x86_64/cpu-hotplug-spec)
143 143
144NUMA 144NUMA
145 145
diff --git a/Documentation/x86/x86_64/fake-numa-for-cpusets b/Documentation/x86/x86_64/fake-numa-for-cpusets
index d1a985c5b00a..33bb56655991 100644
--- a/Documentation/x86/x86_64/fake-numa-for-cpusets
+++ b/Documentation/x86/x86_64/fake-numa-for-cpusets
@@ -10,7 +10,7 @@ amount of system memory that are available to a certain class of tasks.
10For more information on the features of cpusets, see Documentation/cpusets.txt. 10For more information on the features of cpusets, see Documentation/cpusets.txt.
11There are a number of different configurations you can use for your needs. For 11There are a number of different configurations you can use for your needs. For
12more information on the numa=fake command line option and its various ways of 12more information on the numa=fake command line option and its various ways of
13configuring fake nodes, see Documentation/x86_64/boot-options.txt. 13configuring fake nodes, see Documentation/x86/x86_64/boot-options.txt.
14 14
15For the purposes of this introduction, we'll assume a very primitive NUMA 15For the purposes of this introduction, we'll assume a very primitive NUMA
16emulation setup of "numa=fake=4*512,". This will split our system memory into 16emulation setup of "numa=fake=4*512,". This will split our system memory into
diff --git a/MAINTAINERS b/MAINTAINERS
index 74e69ab8c132..cda50d690735 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -347,7 +347,7 @@ S: Maintained
347ALI1563 I2C DRIVER 347ALI1563 I2C DRIVER
348P: Rudolf Marek 348P: Rudolf Marek
349M: r.marek@assembler.cz 349M: r.marek@assembler.cz
350L: i2c@lm-sensors.org 350L: linux-i2c@vger.kernel.org
351S: Maintained 351S: Maintained
352 352
353ALPHA PORT 353ALPHA PORT
@@ -610,6 +610,11 @@ P: Philipp Zabel
610M: philipp.zabel@gmail.com 610M: philipp.zabel@gmail.com
611S: Maintained 611S: Maintained
612 612
613ARM/NEC MOBILEPRO 900/c MACHINE SUPPORT
614P: Michael Petchkovsky
615M: mkpetch@internode.on.net
616S: Maintained
617
613ARM/TOSA MACHINE SUPPORT 618ARM/TOSA MACHINE SUPPORT
614P: Dmitry Baryshkov 619P: Dmitry Baryshkov
615M: dbaryshkov@gmail.com 620M: dbaryshkov@gmail.com
@@ -738,6 +743,8 @@ P: Nick Kossifidis
738M: mickflemm@gmail.com 743M: mickflemm@gmail.com
739P: Luis R. Rodriguez 744P: Luis R. Rodriguez
740M: mcgrof@gmail.com 745M: mcgrof@gmail.com
746P: Bob Copeland
747M: me@bobcopeland.com
741L: linux-wireless@vger.kernel.org 748L: linux-wireless@vger.kernel.org
742L: ath5k-devel@lists.ath5k.org 749L: ath5k-devel@lists.ath5k.org
743S: Maintained 750S: Maintained
@@ -1744,7 +1751,7 @@ FREESCALE I2C CPM DRIVER
1744P: Jochen Friedrich 1751P: Jochen Friedrich
1745M: jochen@scram.de 1752M: jochen@scram.de
1746L: linuxppc-dev@ozlabs.org 1753L: linuxppc-dev@ozlabs.org
1747L: i2c@lm-sensors.org 1754L: linux-i2c@vger.kernel.org
1748S: Maintained 1755S: Maintained
1749 1756
1750FREESCALE SOC FS_ENET DRIVER 1757FREESCALE SOC FS_ENET DRIVER
@@ -2017,7 +2024,7 @@ S: Maintained
2017I2C/SMBUS STUB DRIVER 2024I2C/SMBUS STUB DRIVER
2018P: Mark M. Hoffman 2025P: Mark M. Hoffman
2019M: mhoffman@lightlink.com 2026M: mhoffman@lightlink.com
2020L: i2c@lm-sensors.org 2027L: linux-i2c@vger.kernel.org
2021S: Maintained 2028S: Maintained
2022 2029
2023I2C SUBSYSTEM 2030I2C SUBSYSTEM
@@ -2025,14 +2032,14 @@ P: Jean Delvare (PC drivers, core)
2025M: khali@linux-fr.org 2032M: khali@linux-fr.org
2026P: Ben Dooks (embedded platforms) 2033P: Ben Dooks (embedded platforms)
2027M: ben-linux@fluff.org 2034M: ben-linux@fluff.org
2028L: i2c@lm-sensors.org 2035L: linux-i2c@vger.kernel.org
2029T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/ 2036T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
2030S: Maintained 2037S: Maintained
2031 2038
2032I2C-TINY-USB DRIVER 2039I2C-TINY-USB DRIVER
2033P: Till Harbaum 2040P: Till Harbaum
2034M: till@harbaum.org 2041M: till@harbaum.org
2035L: i2c@lm-sensors.org 2042L: linux-i2c@vger.kernel.org
2036T: http://www.harbaum.org/till/i2c_tiny_usb 2043T: http://www.harbaum.org/till/i2c_tiny_usb
2037S: Maintained 2044S: Maintained
2038 2045
@@ -2696,6 +2703,16 @@ M: matthew@wil.cx
2696L: linux-scsi@vger.kernel.org 2703L: linux-scsi@vger.kernel.org
2697S: Maintained 2704S: Maintained
2698 2705
2706LTP (Linux Test Project)
2707P: Subrata Modak
2708M: subrata@linux.vnet.ibm.com
2709P: Mike Frysinger
2710M: vapier@gentoo.org
2711L: ltp-list@lists.sourceforge.net (subscribers-only)
2712W: http://ltp.sourceforge.net/
2713T: git kernel.org/pub/scm/linux/kernel/git/galak/ltp.git
2714S: Maintained
2715
2699M32R ARCHITECTURE 2716M32R ARCHITECTURE
2700P: Hirokazu Takata 2717P: Hirokazu Takata
2701M: takata@linux-m32r.org 2718M: takata@linux-m32r.org
@@ -3138,7 +3155,7 @@ S: Maintained
3138OPENCORES I2C BUS DRIVER 3155OPENCORES I2C BUS DRIVER
3139P: Peter Korsgaard 3156P: Peter Korsgaard
3140M: jacmet@sunsite.dk 3157M: jacmet@sunsite.dk
3141L: i2c@lm-sensors.org 3158L: linux-i2c@vger.kernel.org
3142S: Maintained 3159S: Maintained
3143 3160
3144OPROFILE 3161OPROFILE
@@ -3185,7 +3202,7 @@ S: Maintained
3185PA SEMI SMBUS DRIVER 3202PA SEMI SMBUS DRIVER
3186P: Olof Johansson 3203P: Olof Johansson
3187M: olof@lixom.net 3204M: olof@lixom.net
3188L: i2c@lm-sensors.org 3205L: linux-i2c@vger.kernel.org
3189S: Maintained 3206S: Maintained
3190 3207
3191PANASONIC LAPTOP ACPI EXTRAS DRIVER 3208PANASONIC LAPTOP ACPI EXTRAS DRIVER
@@ -3330,7 +3347,7 @@ S: Maintained
3330PNXxxxx I2C DRIVER 3347PNXxxxx I2C DRIVER
3331P: Vitaly Wool 3348P: Vitaly Wool
3332M: vitalywool@gmail.com 3349M: vitalywool@gmail.com
3333L: i2c@lm-sensors.org 3350L: linux-i2c@vger.kernel.org
3334S: Maintained 3351S: Maintained
3335 3352
3336PPP PROTOCOL DRIVERS AND COMPRESSORS 3353PPP PROTOCOL DRIVERS AND COMPRESSORS
@@ -3794,7 +3811,7 @@ S: Maintained
3794SIS 96X I2C/SMBUS DRIVER 3811SIS 96X I2C/SMBUS DRIVER
3795P: Mark M. Hoffman 3812P: Mark M. Hoffman
3796M: mhoffman@lightlink.com 3813M: mhoffman@lightlink.com
3797L: i2c@lm-sensors.org 3814L: linux-i2c@vger.kernel.org
3798S: Maintained 3815S: Maintained
3799 3816
3800SIS FRAMEBUFFER DRIVER 3817SIS FRAMEBUFFER DRIVER
@@ -4541,7 +4558,7 @@ S: Maintained
4541VIAPRO SMBUS DRIVER 4558VIAPRO SMBUS DRIVER
4542P: Jean Delvare 4559P: Jean Delvare
4543M: khali@linux-fr.org 4560M: khali@linux-fr.org
4544L: i2c@lm-sensors.org 4561L: linux-i2c@vger.kernel.org
4545S: Maintained 4562S: Maintained
4546 4563
4547VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER 4564VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER
diff --git a/Makefile b/Makefile
index e9c5d47f31cd..d50081751e02 100644
--- a/Makefile
+++ b/Makefile
@@ -536,7 +536,7 @@ KBUILD_CFLAGS += -g
536KBUILD_AFLAGS += -gdwarf-2 536KBUILD_AFLAGS += -gdwarf-2
537endif 537endif
538 538
539ifdef CONFIG_FTRACE 539ifdef CONFIG_FUNCTION_TRACER
540KBUILD_CFLAGS += -pg 540KBUILD_CFLAGS += -pg
541endif 541endif
542 542
@@ -961,6 +961,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
961 961
962# The asm symlink changes when $(ARCH) changes. 962# The asm symlink changes when $(ARCH) changes.
963# Detect this and ask user to run make mrproper 963# Detect this and ask user to run make mrproper
964# If asm is a stale symlink (point to dir that does not exist) remove it
964define check-symlink 965define check-symlink
965 set -e; \ 966 set -e; \
966 if [ -L include/asm ]; then \ 967 if [ -L include/asm ]; then \
@@ -970,6 +971,10 @@ define check-symlink
970 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ 971 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
971 exit 1; \ 972 exit 1; \
972 fi; \ 973 fi; \
974 test -e $$asmlink || rm include/asm; \
975 elif [ -d include/asm ]; then \
976 echo "ERROR: $@ is a directory but a symlink was expected";\
977 exit 1; \
973 fi 978 fi
974endef 979endef
975 980
@@ -1431,7 +1436,8 @@ ALLSOURCE_ARCHS := $(SRCARCH)
1431define find-sources 1436define find-sources
1432 ( for arch in $(ALLSOURCE_ARCHS) ; do \ 1437 ( for arch in $(ALLSOURCE_ARCHS) ; do \
1433 find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \ 1438 find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \
1434 -name $1 -print; \ 1439 -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \
1440 -o -name $1 -print; \
1435 done ; \ 1441 done ; \
1436 find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ 1442 find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
1437 -name $1 -print; \ 1443 -name $1 -print; \
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5021db2217ed..9722f8bb506c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -16,8 +16,7 @@ config ARM
16 select HAVE_ARCH_KGDB 16 select HAVE_ARCH_KGDB
17 select HAVE_KPROBES if (!XIP_KERNEL) 17 select HAVE_KPROBES if (!XIP_KERNEL)
18 select HAVE_KRETPROBES if (HAVE_KPROBES) 18 select HAVE_KRETPROBES if (HAVE_KPROBES)
19 select HAVE_FTRACE if (!XIP_KERNEL) 19 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
20 select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE)
21 select HAVE_GENERIC_DMA_COHERENT 20 select HAVE_GENERIC_DMA_COHERENT
22 help 21 help
23 The ARM series is a line of low-power-consumption RISC chip designs 22 The ARM series is a line of low-power-consumption RISC chip designs
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 7a03f2007882..c47f2a3f8f8f 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -70,7 +70,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
70targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ 70targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \
71 head.o misc.o $(OBJS) 71 head.o misc.o $(OBJS)
72 72
73ifeq ($(CONFIG_FTRACE),y) 73ifeq ($(CONFIG_FUNCTION_TRACER),y)
74ORIG_CFLAGS := $(KBUILD_CFLAGS) 74ORIG_CFLAGS := $(KBUILD_CFLAGS)
75KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) 75KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
76endif 76endif
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index db8309161408..780bbf7cb26f 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -54,11 +54,13 @@
54/* 54/*
55 * Prototypes 55 * Prototypes
56 */ 56 */
57#ifdef CONFIG_PM
57static int sharpsl_off_charge_battery(void); 58static int sharpsl_off_charge_battery(void);
58static int sharpsl_check_battery_temp(void);
59static int sharpsl_check_battery_voltage(void); 59static int sharpsl_check_battery_voltage(void);
60static int sharpsl_ac_check(void);
61static int sharpsl_fatal_check(void); 60static int sharpsl_fatal_check(void);
61#endif
62static int sharpsl_check_battery_temp(void);
63static int sharpsl_ac_check(void);
62static int sharpsl_average_value(int ad); 64static int sharpsl_average_value(int ad);
63static void sharpsl_average_clear(void); 65static void sharpsl_average_clear(void);
64static void sharpsl_charge_toggle(struct work_struct *private_); 66static void sharpsl_charge_toggle(struct work_struct *private_);
@@ -424,6 +426,7 @@ static int sharpsl_check_battery_temp(void)
424 return 0; 426 return 0;
425} 427}
426 428
429#ifdef CONFIG_PM
427static int sharpsl_check_battery_voltage(void) 430static int sharpsl_check_battery_voltage(void)
428{ 431{
429 int val, i, buff[5]; 432 int val, i, buff[5];
@@ -455,6 +458,7 @@ static int sharpsl_check_battery_voltage(void)
455 458
456 return 0; 459 return 0;
457} 460}
461#endif
458 462
459static int sharpsl_ac_check(void) 463static int sharpsl_ac_check(void)
460{ 464{
@@ -586,8 +590,6 @@ static int corgi_pxa_pm_enter(suspend_state_t state)
586 590
587 return 0; 591 return 0;
588} 592}
589#endif
590
591 593
592/* 594/*
593 * Check for fatal battery errors 595 * Check for fatal battery errors
@@ -738,7 +740,10 @@ static int sharpsl_off_charge_battery(void)
738 } 740 }
739 } 741 }
740} 742}
741 743#else
744#define sharpsl_pm_suspend NULL
745#define sharpsl_pm_resume NULL
746#endif
742 747
743static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf) 748static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
744{ 749{
@@ -768,10 +773,12 @@ static void sharpsl_apm_get_power_status(struct apm_power_info *info)
768 info->battery_life = sharpsl_pm.battstat.mainbat_percent; 773 info->battery_life = sharpsl_pm.battstat.mainbat_percent;
769} 774}
770 775
776#ifdef CONFIG_PM
771static struct platform_suspend_ops sharpsl_pm_ops = { 777static struct platform_suspend_ops sharpsl_pm_ops = {
772 .enter = corgi_pxa_pm_enter, 778 .enter = corgi_pxa_pm_enter,
773 .valid = suspend_valid_only_mem, 779 .valid = suspend_valid_only_mem,
774}; 780};
781#endif
775 782
776static int __init sharpsl_pm_probe(struct platform_device *pdev) 783static int __init sharpsl_pm_probe(struct platform_device *pdev)
777{ 784{
@@ -802,7 +809,9 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
802 809
803 apm_get_power_status = sharpsl_apm_get_power_status; 810 apm_get_power_status = sharpsl_apm_get_power_status;
804 811
812#ifdef CONFIG_PM
805 suspend_set_ops(&sharpsl_pm_ops); 813 suspend_set_ops(&sharpsl_pm_ops);
814#endif
806 815
807 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250)); 816 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
808 817
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index 584ef9a8e5a5..39c8bc1a006a 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_ARM_FTRACE 1#ifndef _ASM_ARM_FTRACE
2#define _ASM_ARM_FTRACE 2#define _ASM_ARM_FTRACE
3 3
4#ifdef CONFIG_FTRACE 4#ifdef CONFIG_FUNCTION_TRACER
5#define MCOUNT_ADDR ((long)(mcount)) 5#define MCOUNT_ADDR ((long)(mcount))
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ 6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7 7
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 2357b1cf1cf9..c74f766ffc12 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -183,6 +183,6 @@ EXPORT_SYMBOL(_find_next_bit_be);
183 183
184EXPORT_SYMBOL(copy_page); 184EXPORT_SYMBOL(copy_page);
185 185
186#ifdef CONFIG_FTRACE 186#ifdef CONFIG_FUNCTION_TRACER
187EXPORT_SYMBOL(mcount); 187EXPORT_SYMBOL(mcount);
188#endif 188#endif
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 3aa14dcc5bab..06269ea375c5 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -101,7 +101,7 @@ ENDPROC(ret_from_fork)
101#undef CALL 101#undef CALL
102#define CALL(x) .long x 102#define CALL(x) .long x
103 103
104#ifdef CONFIG_FTRACE 104#ifdef CONFIG_FUNCTION_TRACER
105#ifdef CONFIG_DYNAMIC_FTRACE 105#ifdef CONFIG_DYNAMIC_FTRACE
106ENTRY(mcount) 106ENTRY(mcount)
107 stmdb sp!, {r0-r3, lr} 107 stmdb sp!, {r0-r3, lr}
@@ -149,7 +149,7 @@ trace:
149ftrace_stub: 149ftrace_stub:
150 mov pc, lr 150 mov pc, lr
151 151
152#endif /* CONFIG_FTRACE */ 152#endif /* CONFIG_FUNCTION_TRACER */
153 153
154/*============================================================================= 154/*=============================================================================
155 * SWI handler 155 * SWI handler
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 76d50e6091bc..6c90479e8974 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -95,19 +95,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
95 return ret; 95 return ret;
96} 96}
97 97
98int ftrace_mcount_set(unsigned long *data)
99{
100 unsigned long pc, old;
101 unsigned long *addr = data;
102 unsigned char *new;
103
104 pc = (unsigned long)&mcount_call;
105 memcpy(&old, &mcount_call, MCOUNT_INSN_SIZE);
106 new = ftrace_call_replace(pc, *addr);
107 *addr = ftrace_modify_code(pc, (unsigned char *)&old, new);
108 return 0;
109}
110
111/* run from kstop_machine */ 98/* run from kstop_machine */
112int __init ftrace_dyn_arch_init(void *data) 99int __init ftrace_dyn_arch_init(void *data)
113{ 100{
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 9c040c78889a..e263fda3e2d1 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -165,6 +165,7 @@ static struct at91_mmc_data __initdata afeb9260_mmc_data = {
165static struct i2c_board_info __initdata afeb9260_i2c_devices[] = { 165static struct i2c_board_info __initdata afeb9260_i2c_devices[] = {
166 { 166 {
167 I2C_BOARD_INFO("fm3130", 0x68), 167 I2C_BOARD_INFO("fm3130", 0x68),
168 }, {
168 I2C_BOARD_INFO("24c64", 0x50), 169 I2C_BOARD_INFO("24c64", 0x50),
169 }, 170 },
170}; 171};
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index 76d76e2fa69e..bffa6741a751 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -13,6 +13,7 @@
13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H 13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H
14#define __ASM_ARCH_AT91RM9200_GPIO_H 14#define __ASM_ARCH_AT91RM9200_GPIO_H
15 15
16#include <linux/kernel.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
17 18
18#define PIN_BASE NR_AIC_IRQS 19#define PIN_BASE NR_AIC_IRQS
@@ -220,6 +221,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
220 221
221static inline void gpio_free(unsigned gpio) 222static inline void gpio_free(unsigned gpio)
222{ 223{
224 might_sleep();
223} 225}
224 226
225extern int gpio_direction_input(unsigned gpio); 227extern int gpio_direction_input(unsigned gpio);
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index de53f0be71b9..48345fb34613 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -26,6 +26,7 @@
26#include <linux/serial_core.h> 26#include <linux/serial_core.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/dma-mapping.h>
29#include <linux/time.h> 30#include <linux/time.h>
30#include <linux/timex.h> 31#include <linux/timex.h>
31#include <linux/delay.h> 32#include <linux/delay.h>
@@ -449,12 +450,13 @@ static struct resource ep93xx_ohci_resources[] = {
449 }, 450 },
450}; 451};
451 452
453
452static struct platform_device ep93xx_ohci_device = { 454static struct platform_device ep93xx_ohci_device = {
453 .name = "ep93xx-ohci", 455 .name = "ep93xx-ohci",
454 .id = -1, 456 .id = -1,
455 .dev = { 457 .dev = {
456 .dma_mask = (void *)0xffffffff, 458 .dma_mask = &ep93xx_ohci_device.dev.coherent_dma_mask,
457 .coherent_dma_mask = 0xffffffff, 459 .coherent_dma_mask = DMA_BIT_MASK(32),
458 }, 460 },
459 .num_resources = ARRAY_SIZE(ep93xx_ohci_resources), 461 .num_resources = ARRAY_SIZE(ep93xx_ohci_resources),
460 .resource = ep93xx_ohci_resources, 462 .resource = ep93xx_ohci_resources,
diff --git a/arch/arm/mach-imx/include/mach/gpio.h b/arch/arm/mach-imx/include/mach/gpio.h
index 6e3d795f2264..502d5aa2c093 100644
--- a/arch/arm/mach-imx/include/mach/gpio.h
+++ b/arch/arm/mach-imx/include/mach/gpio.h
@@ -1,5 +1,6 @@
1#ifndef _IMX_GPIO_H 1#ifndef _IMX_GPIO_H
2 2
3#include <linux/kernel.h>
3#include <mach/imx-regs.h> 4#include <mach/imx-regs.h>
4 5
5#define IMX_GPIO_ALLOC_MODE_NORMAL 0 6#define IMX_GPIO_ALLOC_MODE_NORMAL 0
@@ -63,6 +64,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
63 64
64static inline void gpio_free(unsigned gpio) 65static inline void gpio_free(unsigned gpio)
65{ 66{
67 might_sleep();
68
66 imx_gpio_free(gpio); 69 imx_gpio_free(gpio);
67} 70}
68 71
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index 9fbde177920f..cd5aec26c072 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -25,6 +25,7 @@
25#ifndef __ASM_ARCH_IXP4XX_GPIO_H 25#ifndef __ASM_ARCH_IXP4XX_GPIO_H
26#define __ASM_ARCH_IXP4XX_GPIO_H 26#define __ASM_ARCH_IXP4XX_GPIO_H
27 27
28#include <linux/kernel.h>
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29 30
30static inline int gpio_request(unsigned gpio, const char *label) 31static inline int gpio_request(unsigned gpio, const char *label)
@@ -34,6 +35,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
34 35
35static inline void gpio_free(unsigned gpio) 36static inline void gpio_free(unsigned gpio)
36{ 37{
38 might_sleep();
39
37 return; 40 return;
38} 41}
39 42
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
index 73c84168761c..d4af5c335f16 100644
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -11,6 +11,8 @@
11#ifndef __ASM_ARCH_GPIO_H_ 11#ifndef __ASM_ARCH_GPIO_H_
12#define __ASM_ARCH_GPIO_H_ 12#define __ASM_ARCH_GPIO_H_
13 13
14#include <linux/kernel.h>
15
14#define KS8695_GPIO_0 0 16#define KS8695_GPIO_0 0
15#define KS8695_GPIO_1 1 17#define KS8695_GPIO_1 1
16#define KS8695_GPIO_2 2 18#define KS8695_GPIO_2 2
@@ -74,6 +76,7 @@ static inline int gpio_request(unsigned int pin, const char *label)
74 76
75static inline void gpio_free(unsigned int pin) 77static inline void gpio_free(unsigned int pin)
76{ 78{
79 might_sleep();
77} 80}
78 81
79#endif 82#endif
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index 1be4a390c63f..f902a7c37c31 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -35,6 +35,8 @@
35#include <mach/imx-uart.h> 35#include <mach/imx-uart.h>
36#include <mach/iomux-mx3.h> 36#include <mach/iomux-mx3.h>
37 37
38#include "devices.h"
39
38/*! 40/*!
39 * @file mx31ads.c 41 * @file mx31ads.c
40 * 42 *
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 11fda95c86a5..843f68c8ead1 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -91,12 +91,12 @@ static struct map_desc pcm037_io_desc[] __initdata = {
91 .virtual = AIPS1_BASE_ADDR_VIRT, 91 .virtual = AIPS1_BASE_ADDR_VIRT,
92 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR), 92 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
93 .length = AIPS1_SIZE, 93 .length = AIPS1_SIZE,
94 .type = MT_DEVICE 94 .type = MT_DEVICE_NONSHARED
95 }, { 95 }, {
96 .virtual = AIPS2_BASE_ADDR_VIRT, 96 .virtual = AIPS2_BASE_ADDR_VIRT,
97 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR), 97 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
98 .length = AIPS2_SIZE, 98 .length = AIPS2_SIZE,
99 .type = MT_DEVICE 99 .type = MT_DEVICE_NONSHARED
100 }, 100 },
101}; 101};
102 102
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c
index 5241e6a286cc..5503ca09c4ae 100644
--- a/arch/arm/mach-ns9xxx/gpio.c
+++ b/arch/arm/mach-ns9xxx/gpio.c
@@ -8,6 +8,7 @@
8 * under the terms of the GNU General Public License version 2 as published by 8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11#include <linux/kernel.h>
11#include <linux/compiler.h> 12#include <linux/compiler.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/spinlock.h> 14#include <linux/spinlock.h>
@@ -63,6 +64,7 @@ EXPORT_SYMBOL(gpio_request);
63 64
64void gpio_free(unsigned gpio) 65void gpio_free(unsigned gpio)
65{ 66{
67 might_sleep();
66 clear_bit(gpio, gpiores); 68 clear_bit(gpio, gpiores);
67 return; 69 return;
68} 70}
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c
index fc419868e39f..f99d08811e5a 100644
--- a/arch/arm/mach-orion5x/gpio.c
+++ b/arch/arm/mach-orion5x/gpio.c
@@ -165,6 +165,8 @@ EXPORT_SYMBOL(gpio_request);
165 165
166void gpio_free(unsigned pin) 166void gpio_free(unsigned pin)
167{ 167{
168 might_sleep();
169
168 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) { 170 if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
169 pr_debug("%s: invalid GPIO %d\n", __func__, pin); 171 pr_debug("%s: invalid GPIO %d\n", __func__, pin);
170 return; 172 return;
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index eb7d6c94aa42..e35259032813 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -204,7 +204,9 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
204 .read_devdata = corgipm_read_devdata, 204 .read_devdata = corgipm_read_devdata,
205 .charger_wakeup = corgi_charger_wakeup, 205 .charger_wakeup = corgi_charger_wakeup,
206 .should_wakeup = corgi_should_wakeup, 206 .should_wakeup = corgi_should_wakeup,
207#ifdef CONFIG_BACKLIGHT_CORGI 207#if defined(CONFIG_LCD_CORGI)
208 .backlight_limit = corgi_lcd_limit_intensity,
209#elif defined(CONFIG_BACKLIGHT_CORGI)
208 .backlight_limit = corgibl_limit_intensity, 210 .backlight_limit = corgibl_limit_intensity,
209#endif 211#endif
210 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 212 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
diff --git a/arch/arm/mach-pxa/include/mach/sharpsl.h b/arch/arm/mach-pxa/include/mach/sharpsl.h
index 3b1d4a72d4d1..8242e14a44fa 100644
--- a/arch/arm/mach-pxa/include/mach/sharpsl.h
+++ b/arch/arm/mach-pxa/include/mach/sharpsl.h
@@ -26,6 +26,7 @@ struct corgits_machinfo {
26 * SharpSL Backlight 26 * SharpSL Backlight
27 */ 27 */
28extern void corgibl_limit_intensity(int limit); 28extern void corgibl_limit_intensity(int limit);
29extern void corgi_lcd_limit_intensity(int limit);
29 30
30 31
31/* 32/*
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 524f656dc56d..f0a5bbae0b45 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -385,6 +385,16 @@ static void __init spitz_init_spi(void)
385 if (err) 385 if (err)
386 goto err_free_2; 386 goto err_free_2;
387 387
388 err = gpio_direction_output(SPITZ_GPIO_ADS7846_CS, 1);
389 if (err)
390 goto err_free_3;
391 err = gpio_direction_output(SPITZ_GPIO_LCDCON_CS, 1);
392 if (err)
393 goto err_free_3;
394 err = gpio_direction_output(SPITZ_GPIO_MAX1111_CS, 1);
395 if (err)
396 goto err_free_3;
397
388 if (machine_is_akita()) { 398 if (machine_is_akita()) {
389 spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; 399 spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT;
390 spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; 400 spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
@@ -394,6 +404,8 @@ static void __init spitz_init_spi(void)
394 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); 404 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
395 return; 405 return;
396 406
407err_free_3:
408 gpio_free(SPITZ_GPIO_MAX1111_CS);
397err_free_2: 409err_free_2:
398 gpio_free(SPITZ_GPIO_LCDCON_CS); 410 gpio_free(SPITZ_GPIO_LCDCON_CS);
399err_free_1: 411err_free_1:
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 53018db106ac..072e77cfe5a3 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -198,7 +198,9 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = {
198 .read_devdata = spitzpm_read_devdata, 198 .read_devdata = spitzpm_read_devdata,
199 .charger_wakeup = spitz_charger_wakeup, 199 .charger_wakeup = spitz_charger_wakeup,
200 .should_wakeup = spitz_should_wakeup, 200 .should_wakeup = spitz_should_wakeup,
201#ifdef CONFIG_BACKLIGHT_CORGI 201#if defined(CONFIG_LCD_CORGI)
202 .backlight_limit = corgi_lcd_limit_intensity,
203#elif defined(CONFIG_BACKLIGHT_CORGI)
202 .backlight_limit = corgibl_limit_intensity, 204 .backlight_limit = corgibl_limit_intensity,
203#endif 205#endif
204 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 206 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index 04dc8b65401b..8f6cf56c11c0 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -349,7 +349,7 @@ ENTRY(cpu_xsc3_switch_mm)
349cpu_xsc3_mt_table: 349cpu_xsc3_mt_table:
350 .long 0x00 @ L_PTE_MT_UNCACHED 350 .long 0x00 @ L_PTE_MT_UNCACHED
351 .long PTE_EXT_TEX(1) @ L_PTE_MT_BUFFERABLE 351 .long PTE_EXT_TEX(1) @ L_PTE_MT_BUFFERABLE
352 .long PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH 352 .long PTE_EXT_TEX(5) | PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH
353 .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK 353 .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK
354 .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_SHARED 354 .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_SHARED
355 .long 0x00 @ unused 355 .long 0x00 @ unused
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 733e0acac916..de5c4747453f 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -188,7 +188,7 @@ static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset)
188 struct mxc_gpio_port *port = 188 struct mxc_gpio_port *port =
189 container_of(chip, struct mxc_gpio_port, chip); 189 container_of(chip, struct mxc_gpio_port, chip);
190 190
191 return (__raw_readl(port->base + GPIO_DR) >> offset) & 1; 191 return (__raw_readl(port->base + GPIO_PSR) >> offset) & 1;
192} 192}
193 193
194static int mxc_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 194static int mxc_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h
index 65b6810124c1..5d4cb1196441 100644
--- a/arch/arm/plat-mxc/include/mach/io.h
+++ b/arch/arm/plat-mxc/include/mach/io.h
@@ -14,6 +14,26 @@
14/* Allow IO space to be anywhere in the memory */ 14/* Allow IO space to be anywhere in the memory */
15#define IO_SPACE_LIMIT 0xffffffff 15#define IO_SPACE_LIMIT 0xffffffff
16 16
17#ifdef CONFIG_ARCH_MX3
18#define __arch_ioremap __mx3_ioremap
19#define __arch_iounmap __iounmap
20
21static inline void __iomem *
22__mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
23{
24 if (mtype == MT_DEVICE) {
25 /* Access all peripherals below 0x80000000 as nonshared device
26 * but leave l2cc alone.
27 */
28 if ((phys_addr < 0x80000000) && ((phys_addr < L2CC_BASE_ADDR) ||
29 (phys_addr >= L2CC_BASE_ADDR + L2CC_SIZE)))
30 mtype = MT_DEVICE_NONSHARED;
31 }
32
33 return __arm_ioremap(phys_addr, size, mtype);
34}
35#endif
36
17/* io address mapping macro */ 37/* io address mapping macro */
18#define __io(a) ((void __iomem *)(a)) 38#define __io(a) ((void __iomem *)(a))
19 39
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h
index 5fb2bb93de3b..0490794fe4aa 100644
--- a/arch/ia64/include/asm/iommu.h
+++ b/arch/ia64/include/asm/iommu.h
@@ -11,6 +11,5 @@ extern int force_iommu, no_iommu;
11extern int iommu_detected; 11extern int iommu_detected;
12extern void iommu_dma_init(void); 12extern void iommu_dma_init(void);
13extern void machvec_init(const char *name); 13extern void machvec_init(const char *name);
14extern int forbid_dac;
15 14
16#endif 15#endif
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 85db124d37f6..c60d324da540 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -365,7 +365,8 @@ struct kvm_vcpu_arch {
365 long itc_offset; 365 long itc_offset;
366 unsigned long itc_check; 366 unsigned long itc_check;
367 unsigned long timer_check; 367 unsigned long timer_check;
368 unsigned long timer_pending; 368 unsigned int timer_pending;
369 unsigned int timer_fired;
369 370
370 unsigned long vrr[8]; 371 unsigned long vrr[8];
371 unsigned long ibr[8]; 372 unsigned long ibr[8];
@@ -417,6 +418,9 @@ struct kvm_arch {
417 struct list_head assigned_dev_head; 418 struct list_head assigned_dev_head;
418 struct dmar_domain *intel_iommu_domain; 419 struct dmar_domain *intel_iommu_domain;
419 struct hlist_head irq_ack_notifier_list; 420 struct hlist_head irq_ack_notifier_list;
421
422 unsigned long irq_sources_bitmap;
423 unsigned long irq_states[KVM_IOAPIC_NUM_PINS];
420}; 424};
421 425
422union cpuid3_t { 426union cpuid3_t {
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 10a75b557650..031abbf9c875 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -89,13 +89,6 @@ int iommu_dma_supported(struct device *dev, u64 mask)
89{ 89{
90 struct dma_mapping_ops *ops = get_dma_ops(dev); 90 struct dma_mapping_ops *ops = get_dma_ops(dev);
91 91
92#ifdef CONFIG_PCI
93 if (mask > 0xffffffff && forbid_dac > 0) {
94 dev_info(dev, "Disallowing DAC for device\n");
95 return 0;
96 }
97#endif
98
99 if (ops->dma_supported_op) 92 if (ops->dma_supported_op)
100 return ops->dma_supported_op(dev, mask); 93 return ops->dma_supported_op(dev, mask);
101 94
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile
index cf37f8f490c0..3ab4d6d50704 100644
--- a/arch/ia64/kvm/Makefile
+++ b/arch/ia64/kvm/Makefile
@@ -29,13 +29,18 @@ define cmd_offsets
29 echo ""; \ 29 echo ""; \
30 echo "#endif" ) > $@ 30 echo "#endif" ) > $@
31endef 31endef
32
32# We use internal rules to avoid the "is up to date" message from make 33# We use internal rules to avoid the "is up to date" message from make
33arch/ia64/kvm/asm-offsets.s: arch/ia64/kvm/asm-offsets.c 34arch/ia64/kvm/asm-offsets.s: arch/ia64/kvm/asm-offsets.c \
35 $(wildcard $(srctree)/arch/ia64/include/asm/*.h)\
36 $(wildcard $(srctree)/include/linux/*.h)
34 $(call if_changed_dep,cc_s_c) 37 $(call if_changed_dep,cc_s_c)
35 38
36$(obj)/$(offsets-file): arch/ia64/kvm/asm-offsets.s 39$(obj)/$(offsets-file): arch/ia64/kvm/asm-offsets.s
37 $(call cmd,offsets) 40 $(call cmd,offsets)
38 41
42FORCE : $(obj)/$(offsets-file)
43
39# 44#
40# Makefile for Kernel-based Virtual Machine module 45# Makefile for Kernel-based Virtual Machine module
41# 46#
@@ -53,7 +58,6 @@ endif
53kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o 58kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o
54obj-$(CONFIG_KVM) += kvm.o 59obj-$(CONFIG_KVM) += kvm.o
55 60
56FORCE : $(obj)/$(offsets-file)
57EXTRA_CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127 61EXTRA_CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127
58kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ 62kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \
59 vtlb.o process.o 63 vtlb.o process.o
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index a312c9e9b9ef..3caac477de9e 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -385,6 +385,7 @@ static int handle_global_purge(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
385 struct kvm *kvm = vcpu->kvm; 385 struct kvm *kvm = vcpu->kvm;
386 struct call_data call_data; 386 struct call_data call_data;
387 int i; 387 int i;
388
388 call_data.ptc_g_data = p->u.ptc_g_data; 389 call_data.ptc_g_data = p->u.ptc_g_data;
389 390
390 for (i = 0; i < KVM_MAX_VCPUS; i++) { 391 for (i = 0; i < KVM_MAX_VCPUS; i++) {
@@ -418,33 +419,41 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
418 ktime_t kt; 419 ktime_t kt;
419 long itc_diff; 420 long itc_diff;
420 unsigned long vcpu_now_itc; 421 unsigned long vcpu_now_itc;
421
422 unsigned long expires; 422 unsigned long expires;
423 struct hrtimer *p_ht = &vcpu->arch.hlt_timer; 423 struct hrtimer *p_ht = &vcpu->arch.hlt_timer;
424 unsigned long cyc_per_usec = local_cpu_data->cyc_per_usec; 424 unsigned long cyc_per_usec = local_cpu_data->cyc_per_usec;
425 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd); 425 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
426 426
427 vcpu_now_itc = ia64_getreg(_IA64_REG_AR_ITC) + vcpu->arch.itc_offset; 427 if (irqchip_in_kernel(vcpu->kvm)) {
428 428
429 if (time_after(vcpu_now_itc, vpd->itm)) { 429 vcpu_now_itc = ia64_getreg(_IA64_REG_AR_ITC) + vcpu->arch.itc_offset;
430 vcpu->arch.timer_check = 1;
431 return 1;
432 }
433 itc_diff = vpd->itm - vcpu_now_itc;
434 if (itc_diff < 0)
435 itc_diff = -itc_diff;
436 430
437 expires = div64_u64(itc_diff, cyc_per_usec); 431 if (time_after(vcpu_now_itc, vpd->itm)) {
438 kt = ktime_set(0, 1000 * expires); 432 vcpu->arch.timer_check = 1;
439 vcpu->arch.ht_active = 1; 433 return 1;
440 hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS); 434 }
435 itc_diff = vpd->itm - vcpu_now_itc;
436 if (itc_diff < 0)
437 itc_diff = -itc_diff;
438
439 expires = div64_u64(itc_diff, cyc_per_usec);
440 kt = ktime_set(0, 1000 * expires);
441
442 down_read(&vcpu->kvm->slots_lock);
443 vcpu->arch.ht_active = 1;
444 hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS);
441 445
442 if (irqchip_in_kernel(vcpu->kvm)) {
443 vcpu->arch.mp_state = KVM_MP_STATE_HALTED; 446 vcpu->arch.mp_state = KVM_MP_STATE_HALTED;
444 kvm_vcpu_block(vcpu); 447 kvm_vcpu_block(vcpu);
445 hrtimer_cancel(p_ht); 448 hrtimer_cancel(p_ht);
446 vcpu->arch.ht_active = 0; 449 vcpu->arch.ht_active = 0;
447 450
451 if (test_and_clear_bit(KVM_REQ_UNHALT, &vcpu->requests))
452 if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED)
453 vcpu->arch.mp_state =
454 KVM_MP_STATE_RUNNABLE;
455 up_read(&vcpu->kvm->slots_lock);
456
448 if (vcpu->arch.mp_state != KVM_MP_STATE_RUNNABLE) 457 if (vcpu->arch.mp_state != KVM_MP_STATE_RUNNABLE)
449 return -EINTR; 458 return -EINTR;
450 return 1; 459 return 1;
@@ -484,10 +493,6 @@ static int (*kvm_vti_exit_handlers[])(struct kvm_vcpu *vcpu,
484static const int kvm_vti_max_exit_handlers = 493static const int kvm_vti_max_exit_handlers =
485 sizeof(kvm_vti_exit_handlers)/sizeof(*kvm_vti_exit_handlers); 494 sizeof(kvm_vti_exit_handlers)/sizeof(*kvm_vti_exit_handlers);
486 495
487static void kvm_prepare_guest_switch(struct kvm_vcpu *vcpu)
488{
489}
490
491static uint32_t kvm_get_exit_reason(struct kvm_vcpu *vcpu) 496static uint32_t kvm_get_exit_reason(struct kvm_vcpu *vcpu)
492{ 497{
493 struct exit_ctl_data *p_exit_data; 498 struct exit_ctl_data *p_exit_data;
@@ -600,8 +605,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
600 605
601again: 606again:
602 preempt_disable(); 607 preempt_disable();
603
604 kvm_prepare_guest_switch(vcpu);
605 local_irq_disable(); 608 local_irq_disable();
606 609
607 if (signal_pending(current)) { 610 if (signal_pending(current)) {
@@ -614,7 +617,7 @@ again:
614 617
615 vcpu->guest_mode = 1; 618 vcpu->guest_mode = 1;
616 kvm_guest_enter(); 619 kvm_guest_enter();
617 620 down_read(&vcpu->kvm->slots_lock);
618 r = vti_vcpu_run(vcpu, kvm_run); 621 r = vti_vcpu_run(vcpu, kvm_run);
619 if (r < 0) { 622 if (r < 0) {
620 local_irq_enable(); 623 local_irq_enable();
@@ -634,9 +637,8 @@ again:
634 * But we need to prevent reordering, hence this barrier(): 637 * But we need to prevent reordering, hence this barrier():
635 */ 638 */
636 barrier(); 639 barrier();
637
638 kvm_guest_exit(); 640 kvm_guest_exit();
639 641 up_read(&vcpu->kvm->slots_lock);
640 preempt_enable(); 642 preempt_enable();
641 643
642 r = kvm_handle_exit(kvm_run, vcpu); 644 r = kvm_handle_exit(kvm_run, vcpu);
@@ -673,6 +675,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
673 675
674 if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { 676 if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
675 kvm_vcpu_block(vcpu); 677 kvm_vcpu_block(vcpu);
678 clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
676 vcpu_put(vcpu); 679 vcpu_put(vcpu);
677 return -EAGAIN; 680 return -EAGAIN;
678 } 681 }
@@ -778,6 +781,9 @@ static void kvm_init_vm(struct kvm *kvm)
778 kvm_build_io_pmt(kvm); 781 kvm_build_io_pmt(kvm);
779 782
780 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 783 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
784
785 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */
786 set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap);
781} 787}
782 788
783struct kvm *kvm_arch_create_vm(void) 789struct kvm *kvm_arch_create_vm(void)
@@ -941,9 +947,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
941 goto out; 947 goto out;
942 if (irqchip_in_kernel(kvm)) { 948 if (irqchip_in_kernel(kvm)) {
943 mutex_lock(&kvm->lock); 949 mutex_lock(&kvm->lock);
944 kvm_ioapic_set_irq(kvm->arch.vioapic, 950 kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
945 irq_event.irq, 951 irq_event.irq, irq_event.level);
946 irq_event.level);
947 mutex_unlock(&kvm->lock); 952 mutex_unlock(&kvm->lock);
948 r = 0; 953 r = 0;
949 } 954 }
@@ -1123,15 +1128,16 @@ static enum hrtimer_restart hlt_timer_fn(struct hrtimer *data)
1123 wait_queue_head_t *q; 1128 wait_queue_head_t *q;
1124 1129
1125 vcpu = container_of(data, struct kvm_vcpu, arch.hlt_timer); 1130 vcpu = container_of(data, struct kvm_vcpu, arch.hlt_timer);
1131 q = &vcpu->wq;
1132
1126 if (vcpu->arch.mp_state != KVM_MP_STATE_HALTED) 1133 if (vcpu->arch.mp_state != KVM_MP_STATE_HALTED)
1127 goto out; 1134 goto out;
1128 1135
1129 q = &vcpu->wq; 1136 if (waitqueue_active(q))
1130 if (waitqueue_active(q)) {
1131 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
1132 wake_up_interruptible(q); 1137 wake_up_interruptible(q);
1133 } 1138
1134out: 1139out:
1140 vcpu->arch.timer_fired = 1;
1135 vcpu->arch.timer_check = 1; 1141 vcpu->arch.timer_check = 1;
1136 return HRTIMER_NORESTART; 1142 return HRTIMER_NORESTART;
1137} 1143}
@@ -1700,12 +1706,14 @@ static void vcpu_kick_intr(void *info)
1700void kvm_vcpu_kick(struct kvm_vcpu *vcpu) 1706void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
1701{ 1707{
1702 int ipi_pcpu = vcpu->cpu; 1708 int ipi_pcpu = vcpu->cpu;
1709 int cpu = get_cpu();
1703 1710
1704 if (waitqueue_active(&vcpu->wq)) 1711 if (waitqueue_active(&vcpu->wq))
1705 wake_up_interruptible(&vcpu->wq); 1712 wake_up_interruptible(&vcpu->wq);
1706 1713
1707 if (vcpu->guest_mode) 1714 if (vcpu->guest_mode && cpu != ipi_pcpu)
1708 smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0); 1715 smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0);
1716 put_cpu();
1709} 1717}
1710 1718
1711int kvm_apic_set_irq(struct kvm_vcpu *vcpu, u8 vec, u8 trig) 1719int kvm_apic_set_irq(struct kvm_vcpu *vcpu, u8 vec, u8 trig)
@@ -1715,13 +1723,7 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, u8 vec, u8 trig)
1715 1723
1716 if (!test_and_set_bit(vec, &vpd->irr[0])) { 1724 if (!test_and_set_bit(vec, &vpd->irr[0])) {
1717 vcpu->arch.irq_new_pending = 1; 1725 vcpu->arch.irq_new_pending = 1;
1718 if (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) 1726 kvm_vcpu_kick(vcpu);
1719 kvm_vcpu_kick(vcpu);
1720 else if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED) {
1721 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
1722 if (waitqueue_active(&vcpu->wq))
1723 wake_up_interruptible(&vcpu->wq);
1724 }
1725 return 1; 1727 return 1;
1726 } 1728 }
1727 return 0; 1729 return 0;
@@ -1791,7 +1793,7 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
1791 1793
1792int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) 1794int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
1793{ 1795{
1794 return 0; 1796 return vcpu->arch.timer_fired;
1795} 1797}
1796 1798
1797gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) 1799gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c
index 0c69d9ec92d4..cb7600bdff9d 100644
--- a/arch/ia64/kvm/kvm_fw.c
+++ b/arch/ia64/kvm/kvm_fw.c
@@ -286,6 +286,12 @@ static u64 kvm_get_pal_call_index(struct kvm_vcpu *vcpu)
286 return index; 286 return index;
287} 287}
288 288
289static void prepare_for_halt(struct kvm_vcpu *vcpu)
290{
291 vcpu->arch.timer_pending = 1;
292 vcpu->arch.timer_fired = 0;
293}
294
289int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *run) 295int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *run)
290{ 296{
291 297
@@ -304,11 +310,10 @@ int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *run)
304 break; 310 break;
305 case PAL_HALT_LIGHT: 311 case PAL_HALT_LIGHT:
306 { 312 {
307 vcpu->arch.timer_pending = 1;
308 INIT_PAL_STATUS_SUCCESS(result); 313 INIT_PAL_STATUS_SUCCESS(result);
314 prepare_for_halt(vcpu);
309 if (kvm_highest_pending_irq(vcpu) == -1) 315 if (kvm_highest_pending_irq(vcpu) == -1)
310 ret = kvm_emulate_halt(vcpu); 316 ret = kvm_emulate_halt(vcpu);
311
312 } 317 }
313 break; 318 break;
314 319
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c
index 3417783ae164..800817307b7b 100644
--- a/arch/ia64/kvm/process.c
+++ b/arch/ia64/kvm/process.c
@@ -713,7 +713,7 @@ void leave_hypervisor_tail(void)
713 if (!(VCPU(v, itv) & (1 << 16))) { 713 if (!(VCPU(v, itv) & (1 << 16))) {
714 vcpu_pend_interrupt(v, VCPU(v, itv) 714 vcpu_pend_interrupt(v, VCPU(v, itv)
715 & 0xff); 715 & 0xff);
716 VMX(v, itc_check) = 0; 716 VMX(v, itc_check) = 0;
717 } else { 717 } else {
718 v->arch.timer_pending = 1; 718 v->arch.timer_pending = 1;
719 } 719 }
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 5f149b030c0f..f4af967a6b30 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -238,21 +238,8 @@ config MIPS_SIM
238 This option enables support for MIPS Technologies MIPSsim software 238 This option enables support for MIPS Technologies MIPSsim software
239 emulator. 239 emulator.
240 240
241config MARKEINS 241config MACH_EMMA
242 bool "NEC EMMA2RH Mark-eins" 242 bool "NEC EMMA series based machines"
243 select CEVT_R4K
244 select CSRC_R4K
245 select DMA_NONCOHERENT
246 select HW_HAS_PCI
247 select IRQ_CPU
248 select SWAP_IO_SPACE
249 select SYS_SUPPORTS_32BIT_KERNEL
250 select SYS_SUPPORTS_BIG_ENDIAN
251 select SYS_SUPPORTS_LITTLE_ENDIAN
252 select SYS_HAS_CPU_R5000
253 help
254 This enables support for the R5432-based NEC Mark-eins
255 boards with R5500 CPU.
256 243
257config MACH_VR41XX 244config MACH_VR41XX
258 bool "NEC VR4100 series based machines" 245 bool "NEC VR4100 series based machines"
@@ -261,6 +248,19 @@ config MACH_VR41XX
261 select SYS_HAS_CPU_VR41XX 248 select SYS_HAS_CPU_VR41XX
262 select GENERIC_HARDIRQS_NO__DO_IRQ 249 select GENERIC_HARDIRQS_NO__DO_IRQ
263 250
251config NXP_STB220
252 bool "NXP STB220 board"
253 select SOC_PNX833X
254 help
255 Support for NXP Semiconductors STB220 Development Board.
256
257config NXP_STB225
258 bool "NXP 225 board"
259 select SOC_PNX833X
260 select SOC_PNX8335
261 help
262 Support for NXP Semiconductors STB225 Development Board.
263
264config PNX8550_JBS 264config PNX8550_JBS
265 bool "NXP PNX8550 based JBS board" 265 bool "NXP PNX8550 based JBS board"
266 select PNX8550 266 select PNX8550
@@ -327,7 +327,6 @@ config SGI_IP22
327 select IP22_CPU_SCACHE 327 select IP22_CPU_SCACHE
328 select IRQ_CPU 328 select IRQ_CPU
329 select GENERIC_ISA_DMA_SUPPORT_BROKEN 329 select GENERIC_ISA_DMA_SUPPORT_BROKEN
330 select SGI_HAS_DS1286
331 select SGI_HAS_I8042 330 select SGI_HAS_I8042
332 select SGI_HAS_INDYDOG 331 select SGI_HAS_INDYDOG
333 select SGI_HAS_HAL2 332 select SGI_HAS_HAL2
@@ -382,7 +381,6 @@ config SGI_IP28
382 select HW_HAS_EISA 381 select HW_HAS_EISA
383 select I8253 382 select I8253
384 select I8259 383 select I8259
385 select SGI_HAS_DS1286
386 select SGI_HAS_I8042 384 select SGI_HAS_I8042
387 select SGI_HAS_INDYDOG 385 select SGI_HAS_INDYDOG
388 select SGI_HAS_HAL2 386 select SGI_HAS_HAL2
@@ -601,6 +599,7 @@ endchoice
601 599
602source "arch/mips/alchemy/Kconfig" 600source "arch/mips/alchemy/Kconfig"
603source "arch/mips/basler/excite/Kconfig" 601source "arch/mips/basler/excite/Kconfig"
602source "arch/mips/emma/Kconfig"
604source "arch/mips/jazz/Kconfig" 603source "arch/mips/jazz/Kconfig"
605source "arch/mips/lasat/Kconfig" 604source "arch/mips/lasat/Kconfig"
606source "arch/mips/pmc-sierra/Kconfig" 605source "arch/mips/pmc-sierra/Kconfig"
@@ -849,6 +848,24 @@ config MIPS_RM9122
849 bool 848 bool
850 select SERIAL_RM9000 849 select SERIAL_RM9000
851 850
851config SOC_PNX833X
852 bool
853 select CEVT_R4K
854 select CSRC_R4K
855 select IRQ_CPU
856 select DMA_NONCOHERENT
857 select SYS_HAS_CPU_MIPS32_R2
858 select SYS_SUPPORTS_32BIT_KERNEL
859 select SYS_SUPPORTS_LITTLE_ENDIAN
860 select SYS_SUPPORTS_BIG_ENDIAN
861 select GENERIC_HARDIRQS_NO__DO_IRQ
862 select GENERIC_GPIO
863 select CPU_MIPSR2_IRQ_VI
864
865config SOC_PNX8335
866 bool
867 select SOC_PNX833X
868
852config PNX8550 869config PNX8550
853 bool 870 bool
854 select SOC_PNX8550 871 select SOC_PNX8550
@@ -874,9 +891,6 @@ config EMMA2RH
874config SERIAL_RM9000 891config SERIAL_RM9000
875 bool 892 bool
876 893
877config SGI_HAS_DS1286
878 bool
879
880config SGI_HAS_INDYDOG 894config SGI_HAS_INDYDOG
881 bool 895 bool
882 896
@@ -1092,6 +1106,16 @@ config CPU_R5432
1092 select CPU_SUPPORTS_32BIT_KERNEL 1106 select CPU_SUPPORTS_32BIT_KERNEL
1093 select CPU_SUPPORTS_64BIT_KERNEL 1107 select CPU_SUPPORTS_64BIT_KERNEL
1094 1108
1109config CPU_R5500
1110 bool "R5500"
1111 depends on SYS_HAS_CPU_R5500
1112 select CPU_HAS_LLSC
1113 select CPU_SUPPORTS_32BIT_KERNEL
1114 select CPU_SUPPORTS_64BIT_KERNEL
1115 help
1116 NEC VR5500 and VR5500A series processors implement 64-bit MIPS IV
1117 instruction set.
1118
1095config CPU_R6000 1119config CPU_R6000
1096 bool "R6000" 1120 bool "R6000"
1097 depends on EXPERIMENTAL 1121 depends on EXPERIMENTAL
@@ -1202,6 +1226,9 @@ config SYS_HAS_CPU_R5000
1202config SYS_HAS_CPU_R5432 1226config SYS_HAS_CPU_R5432
1203 bool 1227 bool
1204 1228
1229config SYS_HAS_CPU_R5500
1230 bool
1231
1205config SYS_HAS_CPU_R6000 1232config SYS_HAS_CPU_R6000
1206 bool 1233 bool
1207 1234
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 7f39fd8a91fe..28c55f608913 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -131,6 +131,8 @@ cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips64r2 -U_
131cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap 131cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap
132cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \ 132cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \
133 -Wa,--trap 133 -Wa,--trap
134cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \
135 -Wa,--trap
134cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \ 136cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
135 -Wa,--trap 137 -Wa,--trap
136cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 138cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
@@ -381,6 +383,14 @@ load-$(CONFIG_CASIO_E55) += 0xffffffff80004000
381# 383#
382load-$(CONFIG_TANBAC_TB022X) += 0xffffffff80000000 384load-$(CONFIG_TANBAC_TB022X) += 0xffffffff80000000
383 385
386# NXP STB225
387core-$(CONFIG_SOC_PNX833X) += arch/mips/nxp/pnx833x/common/
388cflags-$(CONFIG_SOC_PNX833X) += -Iarch/mips/include/asm/mach-pnx833x
389libs-$(CONFIG_NXP_STB220) += arch/mips/nxp/pnx833x/stb22x/
390load-$(CONFIG_NXP_STB220) += 0xffffffff80001000
391libs-$(CONFIG_NXP_STB225) += arch/mips/nxp/pnx833x/stb22x/
392load-$(CONFIG_NXP_STB225) += 0xffffffff80001000
393
384# 394#
385# Common NXP PNX8550 395# Common NXP PNX8550
386# 396#
@@ -399,14 +409,17 @@ load-$(CONFIG_PNX8550_JBS) += 0xffffffff80060000
399libs-$(CONFIG_PNX8550_STB810) += arch/mips/nxp/pnx8550/stb810/ 409libs-$(CONFIG_PNX8550_STB810) += arch/mips/nxp/pnx8550/stb810/
400load-$(CONFIG_PNX8550_STB810) += 0xffffffff80060000 410load-$(CONFIG_PNX8550_STB810) += 0xffffffff80060000
401 411
402# NEC EMMA2RH boards
403# 412#
404core-$(CONFIG_EMMA2RH) += arch/mips/emma2rh/common/ 413# Common NEC EMMAXXX
405cflags-$(CONFIG_EMMA2RH) += -I$(srctree)/arch/mips/include/asm/mach-emma2rh 414#
415core-$(CONFIG_SOC_EMMA) += arch/mips/emma/common/
416cflags-$(CONFIG_SOC_EMMA2RH) += -I$(srctree)/arch/mips/include/asm/mach-emma2rh
406 417
418#
407# NEC EMMA2RH Mark-eins 419# NEC EMMA2RH Mark-eins
408core-$(CONFIG_MARKEINS) += arch/mips/emma2rh/markeins/ 420#
409load-$(CONFIG_MARKEINS) += 0xffffffff88100000 421core-$(CONFIG_NEC_MARKEINS) += arch/mips/emma/markeins/
422load-$(CONFIG_NEC_MARKEINS) += 0xffffffff88100000
410 423
411# 424#
412# SGI IP22 (Indy/Indigo2) 425# SGI IP22 (Indy/Indigo2)
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index dc8a67efac28..5c76c6448e04 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -17,6 +17,8 @@
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/mach-au1x00/au1xxx.h> 19#include <asm/mach-au1x00/au1xxx.h>
20#include <asm/mach-au1x00/au1xxx_dbdma.h>
21#include <asm/mach-au1x00/au1100_mmc.h>
20 22
21#define PORT(_base, _irq) \ 23#define PORT(_base, _irq) \
22 { \ 24 { \
@@ -163,24 +165,6 @@ static struct resource au1xxx_usb_gdt_resources[] = {
163 }, 165 },
164}; 166};
165 167
166static struct resource au1xxx_mmc_resources[] = {
167 [0] = {
168 .start = SD0_PHYS_ADDR,
169 .end = SD0_PHYS_ADDR + 0x7ffff,
170 .flags = IORESOURCE_MEM,
171 },
172 [1] = {
173 .start = SD1_PHYS_ADDR,
174 .end = SD1_PHYS_ADDR + 0x7ffff,
175 .flags = IORESOURCE_MEM,
176 },
177 [2] = {
178 .start = AU1200_SD_INT,
179 .end = AU1200_SD_INT,
180 .flags = IORESOURCE_IRQ,
181 }
182};
183
184static u64 udc_dmamask = DMA_32BIT_MASK; 168static u64 udc_dmamask = DMA_32BIT_MASK;
185 169
186static struct platform_device au1xxx_usb_gdt_device = { 170static struct platform_device au1xxx_usb_gdt_device = {
@@ -249,16 +233,79 @@ static struct platform_device au1200_lcd_device = {
249 233
250static u64 au1xxx_mmc_dmamask = DMA_32BIT_MASK; 234static u64 au1xxx_mmc_dmamask = DMA_32BIT_MASK;
251 235
252static struct platform_device au1xxx_mmc_device = { 236extern struct au1xmmc_platform_data au1xmmc_platdata[2];
237
238static struct resource au1200_mmc0_resources[] = {
239 [0] = {
240 .start = SD0_PHYS_ADDR,
241 .end = SD0_PHYS_ADDR + 0x7ffff,
242 .flags = IORESOURCE_MEM,
243 },
244 [1] = {
245 .start = AU1200_SD_INT,
246 .end = AU1200_SD_INT,
247 .flags = IORESOURCE_IRQ,
248 },
249 [2] = {
250 .start = DSCR_CMD0_SDMS_TX0,
251 .end = DSCR_CMD0_SDMS_TX0,
252 .flags = IORESOURCE_DMA,
253 },
254 [3] = {
255 .start = DSCR_CMD0_SDMS_RX0,
256 .end = DSCR_CMD0_SDMS_RX0,
257 .flags = IORESOURCE_DMA,
258 }
259};
260
261static struct platform_device au1200_mmc0_device = {
253 .name = "au1xxx-mmc", 262 .name = "au1xxx-mmc",
254 .id = 0, 263 .id = 0,
255 .dev = { 264 .dev = {
256 .dma_mask = &au1xxx_mmc_dmamask, 265 .dma_mask = &au1xxx_mmc_dmamask,
257 .coherent_dma_mask = DMA_32BIT_MASK, 266 .coherent_dma_mask = DMA_32BIT_MASK,
267 .platform_data = &au1xmmc_platdata[0],
258 }, 268 },
259 .num_resources = ARRAY_SIZE(au1xxx_mmc_resources), 269 .num_resources = ARRAY_SIZE(au1200_mmc0_resources),
260 .resource = au1xxx_mmc_resources, 270 .resource = au1200_mmc0_resources,
261}; 271};
272
273#ifndef CONFIG_MIPS_DB1200
274static struct resource au1200_mmc1_resources[] = {
275 [0] = {
276 .start = SD1_PHYS_ADDR,
277 .end = SD1_PHYS_ADDR + 0x7ffff,
278 .flags = IORESOURCE_MEM,
279 },
280 [1] = {
281 .start = AU1200_SD_INT,
282 .end = AU1200_SD_INT,
283 .flags = IORESOURCE_IRQ,
284 },
285 [2] = {
286 .start = DSCR_CMD0_SDMS_TX1,
287 .end = DSCR_CMD0_SDMS_TX1,
288 .flags = IORESOURCE_DMA,
289 },
290 [3] = {
291 .start = DSCR_CMD0_SDMS_RX1,
292 .end = DSCR_CMD0_SDMS_RX1,
293 .flags = IORESOURCE_DMA,
294 }
295};
296
297static struct platform_device au1200_mmc1_device = {
298 .name = "au1xxx-mmc",
299 .id = 1,
300 .dev = {
301 .dma_mask = &au1xxx_mmc_dmamask,
302 .coherent_dma_mask = DMA_32BIT_MASK,
303 .platform_data = &au1xmmc_platdata[1],
304 },
305 .num_resources = ARRAY_SIZE(au1200_mmc1_resources),
306 .resource = au1200_mmc1_resources,
307};
308#endif /* #ifndef CONFIG_MIPS_DB1200 */
262#endif /* #ifdef CONFIG_SOC_AU1200 */ 309#endif /* #ifdef CONFIG_SOC_AU1200 */
263 310
264static struct platform_device au1x00_pcmcia_device = { 311static struct platform_device au1x00_pcmcia_device = {
@@ -296,7 +343,10 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
296 &au1xxx_usb_gdt_device, 343 &au1xxx_usb_gdt_device,
297 &au1xxx_usb_otg_device, 344 &au1xxx_usb_otg_device,
298 &au1200_lcd_device, 345 &au1200_lcd_device,
299 &au1xxx_mmc_device, 346 &au1200_mmc0_device,
347#ifndef CONFIG_MIPS_DB1200
348 &au1200_mmc1_device,
349#endif
300#endif 350#endif
301#ifdef SMBUS_PSC_BASE 351#ifdef SMBUS_PSC_BASE
302 &pbdb_smbus_device, 352 &pbdb_smbus_device,
diff --git a/arch/mips/alchemy/pb1200/platform.c b/arch/mips/alchemy/pb1200/platform.c
index f8fb0aeac571..95303297c534 100644
--- a/arch/mips/alchemy/pb1200/platform.c
+++ b/arch/mips/alchemy/pb1200/platform.c
@@ -20,9 +20,90 @@
20 20
21#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/leds.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24 25
25#include <asm/mach-au1x00/au1xxx.h> 26#include <asm/mach-au1x00/au1xxx.h>
27#include <asm/mach-au1x00/au1100_mmc.h>
28
29static int mmc_activity;
30
31static void pb1200mmc0_set_power(void *mmc_host, int state)
32{
33 if (state)
34 bcsr->board |= BCSR_BOARD_SD0PWR;
35 else
36 bcsr->board &= ~BCSR_BOARD_SD0PWR;
37
38 au_sync_delay(1);
39}
40
41static int pb1200mmc0_card_readonly(void *mmc_host)
42{
43 return (bcsr->status & BCSR_STATUS_SD0WP) ? 1 : 0;
44}
45
46static int pb1200mmc0_card_inserted(void *mmc_host)
47{
48 return (bcsr->sig_status & BCSR_INT_SD0INSERT) ? 1 : 0;
49}
50
51static void pb1200_mmcled_set(struct led_classdev *led,
52 enum led_brightness brightness)
53{
54 if (brightness != LED_OFF) {
55 if (++mmc_activity == 1)
56 bcsr->disk_leds &= ~(1 << 8);
57 } else {
58 if (--mmc_activity == 0)
59 bcsr->disk_leds |= (1 << 8);
60 }
61}
62
63static struct led_classdev pb1200mmc_led = {
64 .brightness_set = pb1200_mmcled_set,
65};
66
67#ifndef CONFIG_MIPS_DB1200
68static void pb1200mmc1_set_power(void *mmc_host, int state)
69{
70 if (state)
71 bcsr->board |= BCSR_BOARD_SD1PWR;
72 else
73 bcsr->board &= ~BCSR_BOARD_SD1PWR;
74
75 au_sync_delay(1);
76}
77
78static int pb1200mmc1_card_readonly(void *mmc_host)
79{
80 return (bcsr->status & BCSR_STATUS_SD1WP) ? 1 : 0;
81}
82
83static int pb1200mmc1_card_inserted(void *mmc_host)
84{
85 return (bcsr->sig_status & BCSR_INT_SD1INSERT) ? 1 : 0;
86}
87#endif
88
89const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
90 [0] = {
91 .set_power = pb1200mmc0_set_power,
92 .card_inserted = pb1200mmc0_card_inserted,
93 .card_readonly = pb1200mmc0_card_readonly,
94 .cd_setup = NULL, /* use poll-timer in driver */
95 .led = &pb1200mmc_led,
96 },
97#ifndef CONFIG_MIPS_DB1200
98 [1] = {
99 .set_power = pb1200mmc1_set_power,
100 .card_inserted = pb1200mmc1_card_inserted,
101 .card_readonly = pb1200mmc1_card_readonly,
102 .cd_setup = NULL, /* use poll-timer in driver */
103 .led = &pb1200mmc_led,
104 },
105#endif
106};
26 107
27static struct resource ide_resources[] = { 108static struct resource ide_resources[] = {
28 [0] = { 109 [0] = {
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index cc8e6bf2b245..f719bf5e01aa 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -771,7 +771,6 @@ CONFIG_WATCHDOG=y
771CONFIG_INDYDOG=m 771CONFIG_INDYDOG=m
772# CONFIG_HW_RANDOM is not set 772# CONFIG_HW_RANDOM is not set
773# CONFIG_RTC is not set 773# CONFIG_RTC is not set
774CONFIG_SGI_DS1286=m
775# CONFIG_R3964 is not set 774# CONFIG_R3964 is not set
776CONFIG_RAW_DRIVER=m 775CONFIG_RAW_DRIVER=m
777CONFIG_MAX_RAW_DEVS=256 776CONFIG_MAX_RAW_DEVS=256
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 831d3e5a1ea6..34ea319be94c 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -701,7 +701,6 @@ CONFIG_LEGACY_PTY_COUNT=256
701# CONFIG_WATCHDOG is not set 701# CONFIG_WATCHDOG is not set
702CONFIG_HW_RANDOM=m 702CONFIG_HW_RANDOM=m
703# CONFIG_RTC is not set 703# CONFIG_RTC is not set
704CONFIG_SGI_IP27_RTC=y
705# CONFIG_R3964 is not set 704# CONFIG_R3964 is not set
706# CONFIG_APPLICOM is not set 705# CONFIG_APPLICOM is not set
707# CONFIG_DRM is not set 706# CONFIG_DRM is not set
diff --git a/arch/mips/configs/ip28_defconfig b/arch/mips/configs/ip28_defconfig
index 822b01f643e3..70a744e9a8c5 100644
--- a/arch/mips/configs/ip28_defconfig
+++ b/arch/mips/configs/ip28_defconfig
@@ -70,7 +70,6 @@ CONFIG_CPU_BIG_ENDIAN=y
70CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y 70CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
71CONFIG_IRQ_CPU=y 71CONFIG_IRQ_CPU=y
72CONFIG_SWAP_IO_SPACE=y 72CONFIG_SWAP_IO_SPACE=y
73CONFIG_SGI_HAS_DS1286=y
74CONFIG_SGI_HAS_INDYDOG=y 73CONFIG_SGI_HAS_INDYDOG=y
75CONFIG_SGI_HAS_SEEQ=y 74CONFIG_SGI_HAS_SEEQ=y
76CONFIG_SGI_HAS_WD93=y 75CONFIG_SGI_HAS_WD93=y
@@ -585,7 +584,6 @@ CONFIG_LEGACY_PTY_COUNT=256
585# CONFIG_IPMI_HANDLER is not set 584# CONFIG_IPMI_HANDLER is not set
586# CONFIG_HW_RANDOM is not set 585# CONFIG_HW_RANDOM is not set
587# CONFIG_RTC is not set 586# CONFIG_RTC is not set
588CONFIG_SGI_DS1286=y
589# CONFIG_DTLK is not set 587# CONFIG_DTLK is not set
590# CONFIG_R3964 is not set 588# CONFIG_R3964 is not set
591# CONFIG_RAW_DRIVER is not set 589# CONFIG_RAW_DRIVER is not set
diff --git a/arch/mips/configs/pnx8335-stb225_defconfig b/arch/mips/configs/pnx8335-stb225_defconfig
new file mode 100644
index 000000000000..d9536522cff5
--- /dev/null
+++ b/arch/mips/configs/pnx8335-stb225_defconfig
@@ -0,0 +1,1149 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26
4# Sat Jul 26 09:02:59 2008
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_MALTA is not set
20# CONFIG_MIPS_SIM is not set
21# CONFIG_MARKEINS is not set
22# CONFIG_MACH_VR41XX is not set
23# CONFIG_NXP_STB220 is not set
24CONFIG_NXP_STB225=y
25# CONFIG_PNX8550_JBS is not set
26# CONFIG_PNX8550_STB810 is not set
27# CONFIG_PMC_MSP is not set
28# CONFIG_PMC_YOSEMITE is not set
29# CONFIG_SGI_IP22 is not set
30# CONFIG_SGI_IP27 is not set
31# CONFIG_SGI_IP28 is not set
32# CONFIG_SGI_IP32 is not set
33# CONFIG_SIBYTE_CRHINE is not set
34# CONFIG_SIBYTE_CARMEL is not set
35# CONFIG_SIBYTE_CRHONE is not set
36# CONFIG_SIBYTE_RHONE is not set
37# CONFIG_SIBYTE_SWARM is not set
38# CONFIG_SIBYTE_LITTLESUR is not set
39# CONFIG_SIBYTE_SENTOSA is not set
40# CONFIG_SIBYTE_BIGSUR is not set
41# CONFIG_SNI_RM is not set
42# CONFIG_MACH_TX39XX is not set
43# CONFIG_MACH_TX49XX is not set
44# CONFIG_WR_PPMC is not set
45CONFIG_RWSEM_GENERIC_SPINLOCK=y
46# CONFIG_ARCH_HAS_ILOG2_U32 is not set
47# CONFIG_ARCH_HAS_ILOG2_U64 is not set
48CONFIG_ARCH_SUPPORTS_OPROFILE=y
49CONFIG_GENERIC_FIND_NEXT_BIT=y
50CONFIG_GENERIC_HWEIGHT=y
51CONFIG_GENERIC_CALIBRATE_DELAY=y
52CONFIG_GENERIC_CLOCKEVENTS=y
53CONFIG_GENERIC_TIME=y
54CONFIG_GENERIC_CMOS_UPDATE=y
55CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
56CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
57CONFIG_CEVT_R4K=y
58CONFIG_CSRC_R4K=y
59CONFIG_DMA_NONCOHERENT=y
60CONFIG_DMA_NEED_PCI_MAP_STATE=y
61# CONFIG_HOTPLUG_CPU is not set
62# CONFIG_NO_IOPORT is not set
63CONFIG_GENERIC_GPIO=y
64# CONFIG_CPU_BIG_ENDIAN is not set
65CONFIG_CPU_LITTLE_ENDIAN=y
66CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
67CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
68CONFIG_IRQ_CPU=y
69CONFIG_SOC_PNX833X=y
70CONFIG_SOC_PNX8335=y
71CONFIG_MIPS_L1_CACHE_SHIFT=5
72
73#
74# CPU selection
75#
76# CONFIG_CPU_LOONGSON2 is not set
77# CONFIG_CPU_MIPS32_R1 is not set
78CONFIG_CPU_MIPS32_R2=y
79# CONFIG_CPU_MIPS64_R1 is not set
80# CONFIG_CPU_MIPS64_R2 is not set
81# CONFIG_CPU_R3000 is not set
82# CONFIG_CPU_TX39XX is not set
83# CONFIG_CPU_VR41XX is not set
84# CONFIG_CPU_R4300 is not set
85# CONFIG_CPU_R4X00 is not set
86# CONFIG_CPU_TX49XX is not set
87# CONFIG_CPU_R5000 is not set
88# CONFIG_CPU_R5432 is not set
89# CONFIG_CPU_R6000 is not set
90# CONFIG_CPU_NEVADA is not set
91# CONFIG_CPU_R8000 is not set
92# CONFIG_CPU_R10000 is not set
93# CONFIG_CPU_RM7000 is not set
94# CONFIG_CPU_RM9000 is not set
95# CONFIG_CPU_SB1 is not set
96CONFIG_SYS_HAS_CPU_MIPS32_R2=y
97CONFIG_CPU_MIPS32=y
98CONFIG_CPU_MIPSR2=y
99CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
100CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
101
102#
103# Kernel type
104#
105CONFIG_32BIT=y
106# CONFIG_64BIT is not set
107CONFIG_PAGE_SIZE_4KB=y
108# CONFIG_PAGE_SIZE_8KB is not set
109# CONFIG_PAGE_SIZE_16KB is not set
110# CONFIG_PAGE_SIZE_64KB is not set
111CONFIG_CPU_HAS_PREFETCH=y
112CONFIG_MIPS_MT_DISABLED=y
113# CONFIG_MIPS_MT_SMP is not set
114# CONFIG_MIPS_MT_SMTC is not set
115CONFIG_CPU_HAS_LLSC=y
116CONFIG_CPU_MIPSR2_IRQ_VI=y
117CONFIG_CPU_HAS_SYNC=y
118CONFIG_GENERIC_HARDIRQS=y
119CONFIG_GENERIC_IRQ_PROBE=y
120CONFIG_CPU_SUPPORTS_HIGHMEM=y
121CONFIG_ARCH_FLATMEM_ENABLE=y
122CONFIG_ARCH_POPULATES_NODE_MAP=y
123CONFIG_SELECT_MEMORY_MODEL=y
124CONFIG_FLATMEM_MANUAL=y
125# CONFIG_DISCONTIGMEM_MANUAL is not set
126# CONFIG_SPARSEMEM_MANUAL is not set
127CONFIG_FLATMEM=y
128CONFIG_FLAT_NODE_MEM_MAP=y
129# CONFIG_SPARSEMEM_STATIC is not set
130# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
131CONFIG_PAGEFLAGS_EXTENDED=y
132CONFIG_SPLIT_PTLOCK_CPUS=4
133# CONFIG_RESOURCES_64BIT is not set
134CONFIG_ZONE_DMA_FLAG=0
135CONFIG_VIRT_TO_BUS=y
136CONFIG_TICK_ONESHOT=y
137CONFIG_NO_HZ=y
138CONFIG_HIGH_RES_TIMERS=y
139CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
140# CONFIG_HZ_48 is not set
141# CONFIG_HZ_100 is not set
142CONFIG_HZ_128=y
143# CONFIG_HZ_250 is not set
144# CONFIG_HZ_256 is not set
145# CONFIG_HZ_1000 is not set
146# CONFIG_HZ_1024 is not set
147CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
148CONFIG_HZ=128
149# CONFIG_PREEMPT_NONE is not set
150CONFIG_PREEMPT_VOLUNTARY=y
151# CONFIG_PREEMPT is not set
152# CONFIG_KEXEC is not set
153# CONFIG_SECCOMP is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157
158#
159# General setup
160#
161CONFIG_EXPERIMENTAL=y
162CONFIG_BROKEN_ON_SMP=y
163CONFIG_INIT_ENV_ARG_LIMIT=32
164CONFIG_LOCALVERSION=""
165# CONFIG_LOCALVERSION_AUTO is not set
166# CONFIG_SWAP is not set
167CONFIG_SYSVIPC=y
168CONFIG_SYSVIPC_SYSCTL=y
169# CONFIG_POSIX_MQUEUE is not set
170# CONFIG_BSD_PROCESS_ACCT is not set
171# CONFIG_TASKSTATS is not set
172# CONFIG_AUDIT is not set
173# CONFIG_IKCONFIG is not set
174CONFIG_LOG_BUF_SHIFT=14
175# CONFIG_CGROUPS is not set
176# CONFIG_GROUP_SCHED is not set
177CONFIG_SYSFS_DEPRECATED=y
178CONFIG_SYSFS_DEPRECATED_V2=y
179# CONFIG_RELAY is not set
180# CONFIG_NAMESPACES is not set
181# CONFIG_BLK_DEV_INITRD is not set
182CONFIG_CC_OPTIMIZE_FOR_SIZE=y
183CONFIG_SYSCTL=y
184CONFIG_EMBEDDED=y
185CONFIG_SYSCTL_SYSCALL=y
186CONFIG_SYSCTL_SYSCALL_CHECK=y
187CONFIG_KALLSYMS=y
188# CONFIG_KALLSYMS_EXTRA_PASS is not set
189CONFIG_HOTPLUG=y
190CONFIG_PRINTK=y
191CONFIG_BUG=y
192CONFIG_ELF_CORE=y
193CONFIG_PCSPKR_PLATFORM=y
194CONFIG_COMPAT_BRK=y
195CONFIG_BASE_FULL=y
196CONFIG_FUTEX=y
197CONFIG_ANON_INODES=y
198CONFIG_EPOLL=y
199CONFIG_SIGNALFD=y
200CONFIG_TIMERFD=y
201CONFIG_EVENTFD=y
202CONFIG_SHMEM=y
203CONFIG_VM_EVENT_COUNTERS=y
204CONFIG_SLAB=y
205# CONFIG_SLUB is not set
206# CONFIG_SLOB is not set
207# CONFIG_PROFILING is not set
208# CONFIG_MARKERS is not set
209CONFIG_HAVE_OPROFILE=y
210# CONFIG_HAVE_KPROBES is not set
211# CONFIG_HAVE_KRETPROBES is not set
212# CONFIG_HAVE_DMA_ATTRS is not set
213# CONFIG_USE_GENERIC_SMP_HELPERS is not set
214CONFIG_PROC_PAGE_MONITOR=y
215CONFIG_SLABINFO=y
216CONFIG_RT_MUTEXES=y
217# CONFIG_TINY_SHMEM is not set
218CONFIG_BASE_SMALL=0
219CONFIG_MODULES=y
220# CONFIG_MODULE_FORCE_LOAD is not set
221CONFIG_MODULE_UNLOAD=y
222# CONFIG_MODULE_FORCE_UNLOAD is not set
223# CONFIG_MODVERSIONS is not set
224# CONFIG_MODULE_SRCVERSION_ALL is not set
225CONFIG_KMOD=y
226CONFIG_BLOCK=y
227# CONFIG_LBD is not set
228# CONFIG_BLK_DEV_IO_TRACE is not set
229# CONFIG_LSF is not set
230# CONFIG_BLK_DEV_BSG is not set
231# CONFIG_BLK_DEV_INTEGRITY is not set
232
233#
234# IO Schedulers
235#
236CONFIG_IOSCHED_NOOP=y
237# CONFIG_IOSCHED_AS is not set
238# CONFIG_IOSCHED_DEADLINE is not set
239# CONFIG_IOSCHED_CFQ is not set
240# CONFIG_DEFAULT_AS is not set
241# CONFIG_DEFAULT_DEADLINE is not set
242# CONFIG_DEFAULT_CFQ is not set
243CONFIG_DEFAULT_NOOP=y
244CONFIG_DEFAULT_IOSCHED="noop"
245CONFIG_CLASSIC_RCU=y
246
247#
248# Bus options (PCI, PCMCIA, EISA, ISA, TC)
249#
250# CONFIG_ARCH_SUPPORTS_MSI is not set
251CONFIG_MMU=y
252# CONFIG_PCCARD is not set
253
254#
255# Executable file formats
256#
257CONFIG_BINFMT_ELF=y
258# CONFIG_BINFMT_MISC is not set
259CONFIG_TRAD_SIGNALS=y
260
261#
262# Power management options
263#
264CONFIG_ARCH_SUSPEND_POSSIBLE=y
265CONFIG_PM=y
266# CONFIG_PM_DEBUG is not set
267CONFIG_PM_SLEEP=y
268CONFIG_SUSPEND=y
269CONFIG_SUSPEND_FREEZER=y
270
271#
272# Networking
273#
274CONFIG_NET=y
275
276#
277# Networking options
278#
279CONFIG_PACKET=y
280# CONFIG_PACKET_MMAP is not set
281CONFIG_UNIX=y
282CONFIG_XFRM=y
283# CONFIG_XFRM_USER is not set
284# CONFIG_XFRM_SUB_POLICY is not set
285# CONFIG_XFRM_MIGRATE is not set
286# CONFIG_XFRM_STATISTICS is not set
287# CONFIG_NET_KEY is not set
288CONFIG_INET=y
289CONFIG_IP_MULTICAST=y
290# CONFIG_IP_ADVANCED_ROUTER is not set
291CONFIG_IP_FIB_HASH=y
292CONFIG_IP_PNP=y
293CONFIG_IP_PNP_DHCP=y
294# CONFIG_IP_PNP_BOOTP is not set
295# CONFIG_IP_PNP_RARP is not set
296# CONFIG_NET_IPIP is not set
297# CONFIG_NET_IPGRE is not set
298# CONFIG_IP_MROUTE is not set
299# CONFIG_ARPD is not set
300# CONFIG_SYN_COOKIES is not set
301CONFIG_INET_AH=y
302# CONFIG_INET_ESP is not set
303# CONFIG_INET_IPCOMP is not set
304# CONFIG_INET_XFRM_TUNNEL is not set
305# CONFIG_INET_TUNNEL is not set
306CONFIG_INET_XFRM_MODE_TRANSPORT=y
307CONFIG_INET_XFRM_MODE_TUNNEL=y
308CONFIG_INET_XFRM_MODE_BEET=y
309# CONFIG_INET_LRO is not set
310CONFIG_INET_DIAG=y
311CONFIG_INET_TCP_DIAG=y
312# CONFIG_TCP_CONG_ADVANCED is not set
313CONFIG_TCP_CONG_CUBIC=y
314CONFIG_DEFAULT_TCP_CONG="cubic"
315# CONFIG_TCP_MD5SIG is not set
316# CONFIG_IPV6 is not set
317# CONFIG_NETWORK_SECMARK is not set
318# CONFIG_NETFILTER is not set
319# CONFIG_IP_DCCP is not set
320# CONFIG_IP_SCTP is not set
321# CONFIG_TIPC is not set
322# CONFIG_ATM is not set
323# CONFIG_BRIDGE is not set
324# CONFIG_VLAN_8021Q is not set
325# CONFIG_DECNET is not set
326# CONFIG_LLC2 is not set
327# CONFIG_IPX is not set
328# CONFIG_ATALK is not set
329# CONFIG_X25 is not set
330# CONFIG_LAPB is not set
331# CONFIG_ECONET is not set
332# CONFIG_WAN_ROUTER is not set
333# CONFIG_NET_SCHED is not set
334
335#
336# Network testing
337#
338# CONFIG_NET_PKTGEN is not set
339# CONFIG_HAMRADIO is not set
340# CONFIG_CAN is not set
341# CONFIG_IRDA is not set
342# CONFIG_BT is not set
343# CONFIG_AF_RXRPC is not set
344
345#
346# Wireless
347#
348# CONFIG_CFG80211 is not set
349# CONFIG_WIRELESS_EXT is not set
350# CONFIG_MAC80211 is not set
351# CONFIG_IEEE80211 is not set
352# CONFIG_RFKILL is not set
353# CONFIG_NET_9P is not set
354
355#
356# Device Drivers
357#
358
359#
360# Generic Driver Options
361#
362CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
363CONFIG_STANDALONE=y
364CONFIG_PREVENT_FIRMWARE_BUILD=y
365CONFIG_FW_LOADER=y
366CONFIG_FIRMWARE_IN_KERNEL=y
367CONFIG_EXTRA_FIRMWARE=""
368# CONFIG_SYS_HYPERVISOR is not set
369# CONFIG_CONNECTOR is not set
370CONFIG_MTD=y
371# CONFIG_MTD_DEBUG is not set
372# CONFIG_MTD_CONCAT is not set
373CONFIG_MTD_PARTITIONS=y
374# CONFIG_MTD_REDBOOT_PARTS is not set
375CONFIG_MTD_CMDLINE_PARTS=y
376# CONFIG_MTD_AR7_PARTS is not set
377
378#
379# User Modules And Translation Layers
380#
381CONFIG_MTD_CHAR=y
382CONFIG_MTD_BLKDEVS=y
383CONFIG_MTD_BLOCK=y
384# CONFIG_FTL is not set
385# CONFIG_NFTL is not set
386# CONFIG_INFTL is not set
387# CONFIG_RFD_FTL is not set
388# CONFIG_SSFDC is not set
389# CONFIG_MTD_OOPS is not set
390
391#
392# RAM/ROM/Flash chip drivers
393#
394CONFIG_MTD_CFI=y
395# CONFIG_MTD_JEDECPROBE is not set
396CONFIG_MTD_GEN_PROBE=y
397CONFIG_MTD_CFI_ADV_OPTIONS=y
398# CONFIG_MTD_CFI_NOSWAP is not set
399# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
400CONFIG_MTD_CFI_LE_BYTE_SWAP=y
401CONFIG_MTD_CFI_GEOMETRY=y
402CONFIG_MTD_MAP_BANK_WIDTH_1=y
403CONFIG_MTD_MAP_BANK_WIDTH_2=y
404CONFIG_MTD_MAP_BANK_WIDTH_4=y
405# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
406# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
407# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
408CONFIG_MTD_CFI_I1=y
409CONFIG_MTD_CFI_I2=y
410# CONFIG_MTD_CFI_I4 is not set
411# CONFIG_MTD_CFI_I8 is not set
412# CONFIG_MTD_OTP is not set
413# CONFIG_MTD_CFI_INTELEXT is not set
414CONFIG_MTD_CFI_AMDSTD=y
415# CONFIG_MTD_CFI_STAA is not set
416CONFIG_MTD_CFI_UTIL=y
417# CONFIG_MTD_RAM is not set
418# CONFIG_MTD_ROM is not set
419# CONFIG_MTD_ABSENT is not set
420
421#
422# Mapping drivers for chip access
423#
424# CONFIG_MTD_COMPLEX_MAPPINGS is not set
425CONFIG_MTD_PHYSMAP=y
426CONFIG_MTD_PHYSMAP_START=0x18000000
427CONFIG_MTD_PHYSMAP_LEN=0x04000000
428CONFIG_MTD_PHYSMAP_BANKWIDTH=2
429# CONFIG_MTD_PLATRAM is not set
430
431#
432# Self-contained MTD device drivers
433#
434# CONFIG_MTD_SLRAM is not set
435# CONFIG_MTD_PHRAM is not set
436# CONFIG_MTD_MTDRAM is not set
437# CONFIG_MTD_BLOCK2MTD is not set
438
439#
440# Disk-On-Chip Device Drivers
441#
442# CONFIG_MTD_DOC2000 is not set
443# CONFIG_MTD_DOC2001 is not set
444# CONFIG_MTD_DOC2001PLUS is not set
445# CONFIG_MTD_NAND is not set
446# CONFIG_MTD_ONENAND is not set
447
448#
449# UBI - Unsorted block images
450#
451# CONFIG_MTD_UBI is not set
452# CONFIG_PARPORT is not set
453CONFIG_BLK_DEV=y
454# CONFIG_BLK_DEV_COW_COMMON is not set
455CONFIG_BLK_DEV_LOOP=y
456# CONFIG_BLK_DEV_CRYPTOLOOP is not set
457# CONFIG_BLK_DEV_NBD is not set
458# CONFIG_BLK_DEV_RAM is not set
459# CONFIG_CDROM_PKTCDVD is not set
460# CONFIG_ATA_OVER_ETH is not set
461# CONFIG_BLK_DEV_HD is not set
462# CONFIG_MISC_DEVICES is not set
463CONFIG_HAVE_IDE=y
464# CONFIG_IDE is not set
465
466#
467# SCSI device support
468#
469# CONFIG_RAID_ATTRS is not set
470CONFIG_SCSI=y
471CONFIG_SCSI_DMA=y
472# CONFIG_SCSI_TGT is not set
473# CONFIG_SCSI_NETLINK is not set
474CONFIG_SCSI_PROC_FS=y
475
476#
477# SCSI support type (disk, tape, CD-ROM)
478#
479CONFIG_BLK_DEV_SD=y
480# CONFIG_CHR_DEV_ST is not set
481# CONFIG_CHR_DEV_OSST is not set
482# CONFIG_BLK_DEV_SR is not set
483# CONFIG_CHR_DEV_SG is not set
484# CONFIG_CHR_DEV_SCH is not set
485
486#
487# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
488#
489# CONFIG_SCSI_MULTI_LUN is not set
490# CONFIG_SCSI_CONSTANTS is not set
491# CONFIG_SCSI_LOGGING is not set
492# CONFIG_SCSI_SCAN_ASYNC is not set
493CONFIG_SCSI_WAIT_SCAN=m
494
495#
496# SCSI Transports
497#
498# CONFIG_SCSI_SPI_ATTRS is not set
499# CONFIG_SCSI_FC_ATTRS is not set
500# CONFIG_SCSI_ISCSI_ATTRS is not set
501# CONFIG_SCSI_SAS_LIBSAS is not set
502# CONFIG_SCSI_SRP_ATTRS is not set
503# CONFIG_SCSI_LOWLEVEL is not set
504# CONFIG_SCSI_DH is not set
505CONFIG_ATA=y
506# CONFIG_ATA_NONSTANDARD is not set
507CONFIG_SATA_PMP=y
508CONFIG_ATA_SFF=y
509# CONFIG_SATA_MV is not set
510# CONFIG_PATA_PLATFORM is not set
511# CONFIG_MD is not set
512CONFIG_NETDEVICES=y
513# CONFIG_DUMMY is not set
514# CONFIG_BONDING is not set
515# CONFIG_MACVLAN is not set
516# CONFIG_EQUALIZER is not set
517# CONFIG_TUN is not set
518# CONFIG_VETH is not set
519# CONFIG_PHYLIB is not set
520CONFIG_NET_ETHERNET=y
521CONFIG_MII=y
522# CONFIG_AX88796 is not set
523# CONFIG_DM9000 is not set
524# CONFIG_IBM_NEW_EMAC_ZMII is not set
525# CONFIG_IBM_NEW_EMAC_RGMII is not set
526# CONFIG_IBM_NEW_EMAC_TAH is not set
527# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
528# CONFIG_B44 is not set
529# CONFIG_NETDEV_1000 is not set
530# CONFIG_NETDEV_10000 is not set
531
532#
533# Wireless LAN
534#
535# CONFIG_WLAN_PRE80211 is not set
536# CONFIG_WLAN_80211 is not set
537# CONFIG_IWLWIFI_LEDS is not set
538# CONFIG_WAN is not set
539# CONFIG_PPP is not set
540# CONFIG_SLIP is not set
541# CONFIG_NETCONSOLE is not set
542# CONFIG_NETPOLL is not set
543# CONFIG_NET_POLL_CONTROLLER is not set
544# CONFIG_ISDN is not set
545# CONFIG_PHONE is not set
546
547#
548# Input device support
549#
550CONFIG_INPUT=y
551# CONFIG_INPUT_FF_MEMLESS is not set
552# CONFIG_INPUT_POLLDEV is not set
553
554#
555# Userland interfaces
556#
557# CONFIG_INPUT_MOUSEDEV is not set
558# CONFIG_INPUT_JOYDEV is not set
559CONFIG_INPUT_EVDEV=m
560CONFIG_INPUT_EVBUG=m
561
562#
563# Input Device Drivers
564#
565# CONFIG_INPUT_KEYBOARD is not set
566# CONFIG_INPUT_MOUSE is not set
567# CONFIG_INPUT_JOYSTICK is not set
568# CONFIG_INPUT_TABLET is not set
569# CONFIG_INPUT_TOUCHSCREEN is not set
570# CONFIG_INPUT_MISC is not set
571
572#
573# Hardware I/O ports
574#
575CONFIG_SERIO=y
576# CONFIG_SERIO_I8042 is not set
577CONFIG_SERIO_SERPORT=y
578# CONFIG_SERIO_LIBPS2 is not set
579# CONFIG_SERIO_RAW is not set
580# CONFIG_GAMEPORT is not set
581
582#
583# Character devices
584#
585CONFIG_VT=y
586CONFIG_CONSOLE_TRANSLATIONS=y
587# CONFIG_VT_CONSOLE is not set
588CONFIG_HW_CONSOLE=y
589# CONFIG_VT_HW_CONSOLE_BINDING is not set
590CONFIG_DEVKMEM=y
591# CONFIG_SERIAL_NONSTANDARD is not set
592
593#
594# Serial drivers
595#
596# CONFIG_SERIAL_8250 is not set
597
598#
599# Non-8250 serial port support
600#
601CONFIG_SERIAL_PNX8XXX=y
602CONFIG_SERIAL_PNX8XXX_CONSOLE=y
603CONFIG_SERIAL_CORE=y
604CONFIG_SERIAL_CORE_CONSOLE=y
605CONFIG_UNIX98_PTYS=y
606# CONFIG_LEGACY_PTYS is not set
607# CONFIG_IPMI_HANDLER is not set
608CONFIG_HW_RANDOM=y
609# CONFIG_R3964 is not set
610# CONFIG_RAW_DRIVER is not set
611# CONFIG_TCG_TPM is not set
612CONFIG_I2C=y
613CONFIG_I2C_BOARDINFO=y
614CONFIG_I2C_CHARDEV=y
615
616#
617# I2C Hardware Bus support
618#
619
620#
621# I2C system bus drivers (mostly embedded / system-on-chip)
622#
623# CONFIG_I2C_GPIO is not set
624# CONFIG_I2C_OCORES is not set
625# CONFIG_I2C_SIMTEC is not set
626
627#
628# External I2C/SMBus adapter drivers
629#
630# CONFIG_I2C_PARPORT_LIGHT is not set
631# CONFIG_I2C_TAOS_EVM is not set
632
633#
634# Other I2C/SMBus bus drivers
635#
636# CONFIG_I2C_PCA_PLATFORM is not set
637# CONFIG_I2C_STUB is not set
638
639#
640# Miscellaneous I2C Chip support
641#
642# CONFIG_DS1682 is not set
643# CONFIG_AT24 is not set
644# CONFIG_SENSORS_EEPROM is not set
645# CONFIG_SENSORS_PCF8574 is not set
646# CONFIG_PCF8575 is not set
647# CONFIG_SENSORS_PCA9539 is not set
648# CONFIG_SENSORS_PCF8591 is not set
649# CONFIG_SENSORS_MAX6875 is not set
650# CONFIG_SENSORS_TSL2550 is not set
651# CONFIG_I2C_DEBUG_CORE is not set
652# CONFIG_I2C_DEBUG_ALGO is not set
653# CONFIG_I2C_DEBUG_BUS is not set
654# CONFIG_I2C_DEBUG_CHIP is not set
655# CONFIG_SPI is not set
656# CONFIG_W1 is not set
657# CONFIG_POWER_SUPPLY is not set
658# CONFIG_HWMON is not set
659# CONFIG_THERMAL is not set
660# CONFIG_THERMAL_HWMON is not set
661# CONFIG_WATCHDOG is not set
662
663#
664# Sonics Silicon Backplane
665#
666CONFIG_SSB_POSSIBLE=y
667# CONFIG_SSB is not set
668
669#
670# Multifunction device drivers
671#
672# CONFIG_MFD_CORE is not set
673# CONFIG_MFD_SM501 is not set
674# CONFIG_HTC_PASIC3 is not set
675
676#
677# Multimedia devices
678#
679
680#
681# Multimedia core support
682#
683# CONFIG_VIDEO_DEV is not set
684CONFIG_DVB_CORE=y
685CONFIG_VIDEO_MEDIA=y
686
687#
688# Multimedia drivers
689#
690# CONFIG_MEDIA_ATTACH is not set
691CONFIG_MEDIA_TUNER=y
692# CONFIG_MEDIA_TUNER_CUSTOMIZE is not set
693CONFIG_MEDIA_TUNER_SIMPLE=y
694CONFIG_MEDIA_TUNER_TDA8290=y
695CONFIG_MEDIA_TUNER_TDA9887=y
696CONFIG_MEDIA_TUNER_TEA5761=y
697CONFIG_MEDIA_TUNER_TEA5767=y
698CONFIG_MEDIA_TUNER_MT20XX=y
699CONFIG_MEDIA_TUNER_XC2028=y
700CONFIG_MEDIA_TUNER_XC5000=y
701CONFIG_DVB_CAPTURE_DRIVERS=y
702# CONFIG_TTPCI_EEPROM is not set
703# CONFIG_DVB_B2C2_FLEXCOP is not set
704
705#
706# Supported DVB Frontends
707#
708
709#
710# Customise DVB Frontends
711#
712# CONFIG_DVB_FE_CUSTOMISE is not set
713
714#
715# DVB-S (satellite) frontends
716#
717# CONFIG_DVB_CX24110 is not set
718# CONFIG_DVB_CX24123 is not set
719# CONFIG_DVB_MT312 is not set
720# CONFIG_DVB_S5H1420 is not set
721# CONFIG_DVB_STV0299 is not set
722# CONFIG_DVB_TDA8083 is not set
723# CONFIG_DVB_TDA10086 is not set
724# CONFIG_DVB_VES1X93 is not set
725# CONFIG_DVB_TUNER_ITD1000 is not set
726# CONFIG_DVB_TDA826X is not set
727# CONFIG_DVB_TUA6100 is not set
728
729#
730# DVB-T (terrestrial) frontends
731#
732# CONFIG_DVB_SP8870 is not set
733# CONFIG_DVB_SP887X is not set
734# CONFIG_DVB_CX22700 is not set
735# CONFIG_DVB_CX22702 is not set
736# CONFIG_DVB_DRX397XD is not set
737# CONFIG_DVB_L64781 is not set
738CONFIG_DVB_TDA1004X=y
739# CONFIG_DVB_NXT6000 is not set
740# CONFIG_DVB_MT352 is not set
741# CONFIG_DVB_ZL10353 is not set
742# CONFIG_DVB_DIB3000MB is not set
743# CONFIG_DVB_DIB3000MC is not set
744# CONFIG_DVB_DIB7000M is not set
745# CONFIG_DVB_DIB7000P is not set
746# CONFIG_DVB_TDA10048 is not set
747
748#
749# DVB-C (cable) frontends
750#
751# CONFIG_DVB_VES1820 is not set
752# CONFIG_DVB_TDA10021 is not set
753# CONFIG_DVB_TDA10023 is not set
754# CONFIG_DVB_STV0297 is not set
755
756#
757# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
758#
759# CONFIG_DVB_NXT200X is not set
760# CONFIG_DVB_OR51211 is not set
761# CONFIG_DVB_OR51132 is not set
762# CONFIG_DVB_BCM3510 is not set
763# CONFIG_DVB_LGDT330X is not set
764# CONFIG_DVB_S5H1409 is not set
765# CONFIG_DVB_AU8522 is not set
766# CONFIG_DVB_S5H1411 is not set
767
768#
769# Digital terrestrial only tuners/PLL
770#
771# CONFIG_DVB_PLL is not set
772# CONFIG_DVB_TUNER_DIB0070 is not set
773
774#
775# SEC control devices for DVB-S
776#
777# CONFIG_DVB_LNBP21 is not set
778# CONFIG_DVB_ISL6405 is not set
779# CONFIG_DVB_ISL6421 is not set
780# CONFIG_DAB is not set
781
782#
783# Graphics support
784#
785# CONFIG_VGASTATE is not set
786# CONFIG_VIDEO_OUTPUT_CONTROL is not set
787CONFIG_FB=y
788# CONFIG_FIRMWARE_EDID is not set
789# CONFIG_FB_DDC is not set
790# CONFIG_FB_CFB_FILLRECT is not set
791# CONFIG_FB_CFB_COPYAREA is not set
792# CONFIG_FB_CFB_IMAGEBLIT is not set
793# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
794# CONFIG_FB_SYS_FILLRECT is not set
795# CONFIG_FB_SYS_COPYAREA is not set
796# CONFIG_FB_SYS_IMAGEBLIT is not set
797# CONFIG_FB_FOREIGN_ENDIAN is not set
798# CONFIG_FB_SYS_FOPS is not set
799# CONFIG_FB_SVGALIB is not set
800# CONFIG_FB_MACMODES is not set
801# CONFIG_FB_BACKLIGHT is not set
802# CONFIG_FB_MODE_HELPERS is not set
803# CONFIG_FB_TILEBLITTING is not set
804
805#
806# Frame buffer hardware drivers
807#
808# CONFIG_FB_S1D13XXX is not set
809# CONFIG_FB_VIRTUAL is not set
810# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
811
812#
813# Display device support
814#
815# CONFIG_DISPLAY_SUPPORT is not set
816
817#
818# Console display driver support
819#
820# CONFIG_VGA_CONSOLE is not set
821CONFIG_DUMMY_CONSOLE=y
822# CONFIG_FRAMEBUFFER_CONSOLE is not set
823# CONFIG_LOGO is not set
824CONFIG_SOUND=m
825CONFIG_SND=m
826CONFIG_SND_TIMER=m
827CONFIG_SND_PCM=m
828CONFIG_SND_SEQUENCER=m
829# CONFIG_SND_SEQ_DUMMY is not set
830CONFIG_SND_OSSEMUL=y
831CONFIG_SND_MIXER_OSS=m
832CONFIG_SND_PCM_OSS=m
833CONFIG_SND_PCM_OSS_PLUGINS=y
834CONFIG_SND_SEQUENCER_OSS=y
835# CONFIG_SND_DYNAMIC_MINORS is not set
836CONFIG_SND_SUPPORT_OLD_API=y
837CONFIG_SND_VERBOSE_PROCFS=y
838CONFIG_SND_VERBOSE_PRINTK=y
839CONFIG_SND_DEBUG=y
840# CONFIG_SND_DEBUG_VERBOSE is not set
841# CONFIG_SND_PCM_XRUN_DEBUG is not set
842CONFIG_SND_DRIVERS=y
843# CONFIG_SND_DUMMY is not set
844# CONFIG_SND_VIRMIDI is not set
845# CONFIG_SND_MTPAV is not set
846# CONFIG_SND_SERIAL_U16550 is not set
847# CONFIG_SND_MPU401 is not set
848CONFIG_SND_MIPS=y
849# CONFIG_SND_SOC is not set
850# CONFIG_SOUND_PRIME is not set
851CONFIG_HID_SUPPORT=y
852CONFIG_HID=y
853# CONFIG_HID_DEBUG is not set
854# CONFIG_HIDRAW is not set
855CONFIG_USB_SUPPORT=y
856# CONFIG_USB_ARCH_HAS_HCD is not set
857# CONFIG_USB_ARCH_HAS_OHCI is not set
858# CONFIG_USB_ARCH_HAS_EHCI is not set
859# CONFIG_USB_OTG_WHITELIST is not set
860# CONFIG_USB_OTG_BLACKLIST_HUB is not set
861
862#
863# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
864#
865# CONFIG_USB_GADGET is not set
866# CONFIG_MMC is not set
867# CONFIG_MEMSTICK is not set
868# CONFIG_NEW_LEDS is not set
869# CONFIG_ACCESSIBILITY is not set
870CONFIG_RTC_LIB=y
871# CONFIG_RTC_CLASS is not set
872# CONFIG_DMADEVICES is not set
873# CONFIG_UIO is not set
874
875#
876# File systems
877#
878CONFIG_EXT2_FS=m
879# CONFIG_EXT2_FS_XATTR is not set
880# CONFIG_EXT2_FS_XIP is not set
881# CONFIG_EXT3_FS is not set
882# CONFIG_EXT4DEV_FS is not set
883# CONFIG_REISERFS_FS is not set
884# CONFIG_JFS_FS is not set
885# CONFIG_FS_POSIX_ACL is not set
886# CONFIG_XFS_FS is not set
887# CONFIG_OCFS2_FS is not set
888# CONFIG_DNOTIFY is not set
889CONFIG_INOTIFY=y
890CONFIG_INOTIFY_USER=y
891# CONFIG_QUOTA is not set
892# CONFIG_AUTOFS_FS is not set
893# CONFIG_AUTOFS4_FS is not set
894# CONFIG_FUSE_FS is not set
895
896#
897# CD-ROM/DVD Filesystems
898#
899# CONFIG_ISO9660_FS is not set
900# CONFIG_UDF_FS is not set
901
902#
903# DOS/FAT/NT Filesystems
904#
905CONFIG_FAT_FS=m
906CONFIG_MSDOS_FS=m
907CONFIG_VFAT_FS=m
908CONFIG_FAT_DEFAULT_CODEPAGE=437
909CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
910# CONFIG_NTFS_FS is not set
911
912#
913# Pseudo filesystems
914#
915CONFIG_PROC_FS=y
916# CONFIG_PROC_KCORE is not set
917CONFIG_PROC_SYSCTL=y
918CONFIG_SYSFS=y
919CONFIG_TMPFS=y
920# CONFIG_TMPFS_POSIX_ACL is not set
921# CONFIG_HUGETLB_PAGE is not set
922# CONFIG_CONFIGFS_FS is not set
923
924#
925# Miscellaneous filesystems
926#
927# CONFIG_ADFS_FS is not set
928# CONFIG_AFFS_FS is not set
929# CONFIG_HFS_FS is not set
930# CONFIG_HFSPLUS_FS is not set
931# CONFIG_BEFS_FS is not set
932# CONFIG_BFS_FS is not set
933# CONFIG_EFS_FS is not set
934CONFIG_JFFS2_FS=y
935CONFIG_JFFS2_FS_DEBUG=0
936CONFIG_JFFS2_FS_WRITEBUFFER=y
937# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
938# CONFIG_JFFS2_SUMMARY is not set
939# CONFIG_JFFS2_FS_XATTR is not set
940# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
941CONFIG_JFFS2_ZLIB=y
942# CONFIG_JFFS2_LZO is not set
943CONFIG_JFFS2_RTIME=y
944# CONFIG_JFFS2_RUBIN is not set
945CONFIG_CRAMFS=y
946# CONFIG_VXFS_FS is not set
947# CONFIG_MINIX_FS is not set
948# CONFIG_HPFS_FS is not set
949# CONFIG_QNX4FS_FS is not set
950# CONFIG_ROMFS_FS is not set
951# CONFIG_SYSV_FS is not set
952# CONFIG_UFS_FS is not set
953CONFIG_NETWORK_FILESYSTEMS=y
954CONFIG_NFS_FS=y
955CONFIG_NFS_V3=y
956# CONFIG_NFS_V3_ACL is not set
957# CONFIG_NFS_V4 is not set
958CONFIG_ROOT_NFS=y
959CONFIG_NFSD=m
960CONFIG_NFSD_V3=y
961# CONFIG_NFSD_V3_ACL is not set
962# CONFIG_NFSD_V4 is not set
963CONFIG_LOCKD=y
964CONFIG_LOCKD_V4=y
965CONFIG_EXPORTFS=m
966CONFIG_NFS_COMMON=y
967CONFIG_SUNRPC=y
968# CONFIG_RPCSEC_GSS_KRB5 is not set
969# CONFIG_RPCSEC_GSS_SPKM3 is not set
970# CONFIG_SMB_FS is not set
971# CONFIG_CIFS is not set
972# CONFIG_NCP_FS is not set
973# CONFIG_CODA_FS is not set
974# CONFIG_AFS_FS is not set
975
976#
977# Partition Types
978#
979# CONFIG_PARTITION_ADVANCED is not set
980CONFIG_MSDOS_PARTITION=y
981CONFIG_NLS=y
982CONFIG_NLS_DEFAULT="iso8859-1"
983CONFIG_NLS_CODEPAGE_437=m
984# CONFIG_NLS_CODEPAGE_737 is not set
985# CONFIG_NLS_CODEPAGE_775 is not set
986CONFIG_NLS_CODEPAGE_850=m
987# CONFIG_NLS_CODEPAGE_852 is not set
988# CONFIG_NLS_CODEPAGE_855 is not set
989# CONFIG_NLS_CODEPAGE_857 is not set
990# CONFIG_NLS_CODEPAGE_860 is not set
991# CONFIG_NLS_CODEPAGE_861 is not set
992# CONFIG_NLS_CODEPAGE_862 is not set
993# CONFIG_NLS_CODEPAGE_863 is not set
994# CONFIG_NLS_CODEPAGE_864 is not set
995# CONFIG_NLS_CODEPAGE_865 is not set
996# CONFIG_NLS_CODEPAGE_866 is not set
997# CONFIG_NLS_CODEPAGE_869 is not set
998# CONFIG_NLS_CODEPAGE_936 is not set
999# CONFIG_NLS_CODEPAGE_950 is not set
1000CONFIG_NLS_CODEPAGE_932=m
1001# CONFIG_NLS_CODEPAGE_949 is not set
1002# CONFIG_NLS_CODEPAGE_874 is not set
1003# CONFIG_NLS_ISO8859_8 is not set
1004# CONFIG_NLS_CODEPAGE_1250 is not set
1005# CONFIG_NLS_CODEPAGE_1251 is not set
1006CONFIG_NLS_ASCII=m
1007CONFIG_NLS_ISO8859_1=m
1008# CONFIG_NLS_ISO8859_2 is not set
1009# CONFIG_NLS_ISO8859_3 is not set
1010# CONFIG_NLS_ISO8859_4 is not set
1011# CONFIG_NLS_ISO8859_5 is not set
1012# CONFIG_NLS_ISO8859_6 is not set
1013# CONFIG_NLS_ISO8859_7 is not set
1014# CONFIG_NLS_ISO8859_9 is not set
1015# CONFIG_NLS_ISO8859_13 is not set
1016# CONFIG_NLS_ISO8859_14 is not set
1017CONFIG_NLS_ISO8859_15=m
1018# CONFIG_NLS_KOI8_R is not set
1019# CONFIG_NLS_KOI8_U is not set
1020CONFIG_NLS_UTF8=m
1021# CONFIG_DLM is not set
1022
1023#
1024# Kernel hacking
1025#
1026CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1027# CONFIG_PRINTK_TIME is not set
1028CONFIG_ENABLE_WARN_DEPRECATED=y
1029CONFIG_ENABLE_MUST_CHECK=y
1030CONFIG_FRAME_WARN=1024
1031# CONFIG_MAGIC_SYSRQ is not set
1032# CONFIG_UNUSED_SYMBOLS is not set
1033# CONFIG_DEBUG_FS is not set
1034# CONFIG_HEADERS_CHECK is not set
1035# CONFIG_DEBUG_KERNEL is not set
1036# CONFIG_SAMPLES is not set
1037# CONFIG_KERNEL_TESTS is not set
1038CONFIG_CMDLINE=""
1039
1040#
1041# Security options
1042#
1043# CONFIG_KEYS is not set
1044# CONFIG_SECURITY is not set
1045# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1046CONFIG_CRYPTO=y
1047
1048#
1049# Crypto core or helper
1050#
1051CONFIG_CRYPTO_ALGAPI=y
1052CONFIG_CRYPTO_HASH=y
1053CONFIG_CRYPTO_MANAGER=y
1054# CONFIG_CRYPTO_GF128MUL is not set
1055# CONFIG_CRYPTO_NULL is not set
1056# CONFIG_CRYPTO_CRYPTD is not set
1057# CONFIG_CRYPTO_AUTHENC is not set
1058# CONFIG_CRYPTO_TEST is not set
1059
1060#
1061# Authenticated Encryption with Associated Data
1062#
1063# CONFIG_CRYPTO_CCM is not set
1064# CONFIG_CRYPTO_GCM is not set
1065# CONFIG_CRYPTO_SEQIV is not set
1066
1067#
1068# Block modes
1069#
1070# CONFIG_CRYPTO_CBC is not set
1071# CONFIG_CRYPTO_CTR is not set
1072# CONFIG_CRYPTO_CTS is not set
1073# CONFIG_CRYPTO_ECB is not set
1074# CONFIG_CRYPTO_LRW is not set
1075# CONFIG_CRYPTO_PCBC is not set
1076# CONFIG_CRYPTO_XTS is not set
1077
1078#
1079# Hash modes
1080#
1081CONFIG_CRYPTO_HMAC=y
1082# CONFIG_CRYPTO_XCBC is not set
1083
1084#
1085# Digest
1086#
1087# CONFIG_CRYPTO_CRC32C is not set
1088# CONFIG_CRYPTO_MD4 is not set
1089CONFIG_CRYPTO_MD5=y
1090# CONFIG_CRYPTO_MICHAEL_MIC is not set
1091# CONFIG_CRYPTO_RMD128 is not set
1092# CONFIG_CRYPTO_RMD160 is not set
1093# CONFIG_CRYPTO_RMD256 is not set
1094# CONFIG_CRYPTO_RMD320 is not set
1095CONFIG_CRYPTO_SHA1=y
1096# CONFIG_CRYPTO_SHA256 is not set
1097# CONFIG_CRYPTO_SHA512 is not set
1098# CONFIG_CRYPTO_TGR192 is not set
1099# CONFIG_CRYPTO_WP512 is not set
1100
1101#
1102# Ciphers
1103#
1104# CONFIG_CRYPTO_AES is not set
1105# CONFIG_CRYPTO_ANUBIS is not set
1106# CONFIG_CRYPTO_ARC4 is not set
1107# CONFIG_CRYPTO_BLOWFISH is not set
1108# CONFIG_CRYPTO_CAMELLIA is not set
1109# CONFIG_CRYPTO_CAST5 is not set
1110# CONFIG_CRYPTO_CAST6 is not set
1111# CONFIG_CRYPTO_DES is not set
1112# CONFIG_CRYPTO_FCRYPT is not set
1113# CONFIG_CRYPTO_KHAZAD is not set
1114# CONFIG_CRYPTO_SALSA20 is not set
1115# CONFIG_CRYPTO_SEED is not set
1116# CONFIG_CRYPTO_SERPENT is not set
1117# CONFIG_CRYPTO_TEA is not set
1118# CONFIG_CRYPTO_TWOFISH is not set
1119
1120#
1121# Compression
1122#
1123# CONFIG_CRYPTO_DEFLATE is not set
1124# CONFIG_CRYPTO_LZO is not set
1125
1126#
1127# Random Number Generation
1128#
1129# CONFIG_CRYPTO_PRNG is not set
1130CONFIG_CRYPTO_HW=y
1131
1132#
1133# Library routines
1134#
1135CONFIG_BITREVERSE=y
1136# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1137# CONFIG_CRC_CCITT is not set
1138# CONFIG_CRC16 is not set
1139# CONFIG_CRC_T10DIF is not set
1140# CONFIG_CRC_ITU_T is not set
1141CONFIG_CRC32=y
1142# CONFIG_CRC7 is not set
1143# CONFIG_LIBCRC32C is not set
1144CONFIG_ZLIB_INFLATE=y
1145CONFIG_ZLIB_DEFLATE=y
1146CONFIG_PLIST=y
1147CONFIG_HAS_IOMEM=y
1148CONFIG_HAS_IOPORT=y
1149CONFIG_HAS_DMA=y
diff --git a/arch/mips/emma/Kconfig b/arch/mips/emma/Kconfig
new file mode 100644
index 000000000000..9669c72123c9
--- /dev/null
+++ b/arch/mips/emma/Kconfig
@@ -0,0 +1,29 @@
1choice
2 prompt "Machine type"
3 depends on MACH_EMMA
4 default NEC_MARKEINS
5
6config NEC_MARKEINS
7 bool "NEC EMMA2RH Mark-eins board"
8 select SOC_EMMA2RH
9 select HW_HAS_PCI
10 help
11 This enables support for the NEC Electronics Mark-eins boards.
12
13endchoice
14
15config SOC_EMMA2RH
16 bool
17 select SOC_EMMA
18 select SYS_HAS_CPU_R5500
19 select SYS_SUPPORTS_32BIT_KERNEL
20 select SYS_SUPPORTS_64BIT_KERNEL
21
22config SOC_EMMA
23 bool
24 select CEVT_R4K
25 select CSRC_R4K
26 select DMA_NONCOHERENT
27 select IRQ_CPU
28 select SWAP_IO_SPACE
29 select SYS_SUPPORTS_BIG_ENDIAN
diff --git a/arch/mips/emma2rh/common/Makefile b/arch/mips/emma/common/Makefile
index 859121b3867d..c392d28c1ef1 100644
--- a/arch/mips/emma2rh/common/Makefile
+++ b/arch/mips/emma/common/Makefile
@@ -10,4 +10,4 @@
10# (at your option) any later version. 10# (at your option) any later version.
11# 11#
12 12
13obj-$(CONFIG_MARKEINS) += irq.o irq_emma2rh.o prom.o 13obj-$(CONFIG_NEC_MARKEINS) += prom.o
diff --git a/arch/mips/emma2rh/common/prom.c b/arch/mips/emma/common/prom.c
index e14a2e3d8842..120f53fbdb45 100644
--- a/arch/mips/emma2rh/common/prom.c
+++ b/arch/mips/emma/common/prom.c
@@ -29,11 +29,11 @@
29 29
30#include <asm/addrspace.h> 30#include <asm/addrspace.h>
31#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
32#include <asm/emma2rh/emma2rh.h> 32#include <asm/emma/emma2rh.h>
33 33
34const char *get_system_type(void) 34const char *get_system_type(void)
35{ 35{
36#if defined(CONFIG_MARKEINS) 36#ifdef CONFIG_NEC_MARKEINS
37 return "NEC EMMA2RH Mark-eins"; 37 return "NEC EMMA2RH Mark-eins";
38#else 38#else
39#error Unknown NEC board 39#error Unknown NEC board
@@ -60,7 +60,7 @@ void __init prom_init(void)
60 strcat(arcs_cmdline, " "); 60 strcat(arcs_cmdline, " ");
61 } 61 }
62 62
63#if defined(CONFIG_MARKEINS) 63#ifdef CONFIG_NEC_MARKEINS
64 add_memory_region(0, EMMA2RH_RAM_SIZE, BOOT_MEM_RAM); 64 add_memory_region(0, EMMA2RH_RAM_SIZE, BOOT_MEM_RAM);
65#else 65#else
66#error Unknown NEC board 66#error Unknown NEC board
diff --git a/arch/mips/emma2rh/markeins/Makefile b/arch/mips/emma/markeins/Makefile
index 14fc268b175c..16e0017ba919 100644
--- a/arch/mips/emma2rh/markeins/Makefile
+++ b/arch/mips/emma/markeins/Makefile
@@ -10,4 +10,4 @@
10# (at your option) any later version. 10# (at your option) any later version.
11# 11#
12 12
13obj-$(CONFIG_MARKEINS) += irq.o irq_markeins.o setup.o led.o platform.o 13obj-$(CONFIG_NEC_MARKEINS) += irq.o setup.o led.o platform.o
diff --git a/arch/mips/emma/markeins/irq.c b/arch/mips/emma/markeins/irq.c
new file mode 100644
index 000000000000..c2583ecc93cf
--- /dev/null
+++ b/arch/mips/emma/markeins/irq.c
@@ -0,0 +1,331 @@
1/*
2 * arch/mips/emma2rh/markeins/irq.c
3 * This file defines the irq handler for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/types.h>
29#include <linux/ptrace.h>
30#include <linux/delay.h>
31
32#include <asm/irq_cpu.h>
33#include <asm/system.h>
34#include <asm/mipsregs.h>
35#include <asm/addrspace.h>
36#include <asm/bootinfo.h>
37
38#include <asm/emma/emma2rh.h>
39
40static void emma2rh_irq_enable(unsigned int irq)
41{
42 u32 reg_value;
43 u32 reg_bitmask;
44 u32 reg_index;
45
46 irq -= EMMA2RH_IRQ_BASE;
47
48 reg_index = EMMA2RH_BHIF_INT_EN_0 +
49 (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32);
50 reg_value = emma2rh_in32(reg_index);
51 reg_bitmask = 0x1 << (irq % 32);
52 emma2rh_out32(reg_index, reg_value | reg_bitmask);
53}
54
55static void emma2rh_irq_disable(unsigned int irq)
56{
57 u32 reg_value;
58 u32 reg_bitmask;
59 u32 reg_index;
60
61 irq -= EMMA2RH_IRQ_BASE;
62
63 reg_index = EMMA2RH_BHIF_INT_EN_0 +
64 (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32);
65 reg_value = emma2rh_in32(reg_index);
66 reg_bitmask = 0x1 << (irq % 32);
67 emma2rh_out32(reg_index, reg_value & ~reg_bitmask);
68}
69
70struct irq_chip emma2rh_irq_controller = {
71 .name = "emma2rh_irq",
72 .ack = emma2rh_irq_disable,
73 .mask = emma2rh_irq_disable,
74 .mask_ack = emma2rh_irq_disable,
75 .unmask = emma2rh_irq_enable,
76};
77
78void emma2rh_irq_init(void)
79{
80 u32 i;
81
82 for (i = 0; i < NUM_EMMA2RH_IRQ; i++)
83 set_irq_chip_and_handler(EMMA2RH_IRQ_BASE + i,
84 &emma2rh_irq_controller,
85 handle_level_irq);
86}
87
88static void emma2rh_sw_irq_enable(unsigned int irq)
89{
90 u32 reg;
91
92 irq -= EMMA2RH_SW_IRQ_BASE;
93
94 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
95 reg |= 1 << irq;
96 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg);
97}
98
99static void emma2rh_sw_irq_disable(unsigned int irq)
100{
101 u32 reg;
102
103 irq -= EMMA2RH_SW_IRQ_BASE;
104
105 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
106 reg &= ~(1 << irq);
107 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg);
108}
109
110struct irq_chip emma2rh_sw_irq_controller = {
111 .name = "emma2rh_sw_irq",
112 .ack = emma2rh_sw_irq_disable,
113 .mask = emma2rh_sw_irq_disable,
114 .mask_ack = emma2rh_sw_irq_disable,
115 .unmask = emma2rh_sw_irq_enable,
116};
117
118void emma2rh_sw_irq_init(void)
119{
120 u32 i;
121
122 for (i = 0; i < NUM_EMMA2RH_IRQ_SW; i++)
123 set_irq_chip_and_handler(EMMA2RH_SW_IRQ_BASE + i,
124 &emma2rh_sw_irq_controller,
125 handle_level_irq);
126}
127
128static void emma2rh_gpio_irq_enable(unsigned int irq)
129{
130 u32 reg;
131
132 irq -= EMMA2RH_GPIO_IRQ_BASE;
133
134 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
135 reg |= 1 << irq;
136 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
137}
138
139static void emma2rh_gpio_irq_disable(unsigned int irq)
140{
141 u32 reg;
142
143 irq -= EMMA2RH_GPIO_IRQ_BASE;
144
145 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
146 reg &= ~(1 << irq);
147 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
148}
149
150static void emma2rh_gpio_irq_ack(unsigned int irq)
151{
152 u32 reg;
153
154 irq -= EMMA2RH_GPIO_IRQ_BASE;
155 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq));
156
157 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
158 reg &= ~(1 << irq);
159 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
160}
161
162static void emma2rh_gpio_irq_end(unsigned int irq)
163{
164 u32 reg;
165
166 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
167
168 irq -= EMMA2RH_GPIO_IRQ_BASE;
169
170 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
171 reg |= 1 << irq;
172 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
173 }
174}
175
176struct irq_chip emma2rh_gpio_irq_controller = {
177 .name = "emma2rh_gpio_irq",
178 .ack = emma2rh_gpio_irq_ack,
179 .mask = emma2rh_gpio_irq_disable,
180 .mask_ack = emma2rh_gpio_irq_ack,
181 .unmask = emma2rh_gpio_irq_enable,
182 .end = emma2rh_gpio_irq_end,
183};
184
185void emma2rh_gpio_irq_init(void)
186{
187 u32 i;
188
189 for (i = 0; i < NUM_EMMA2RH_IRQ_GPIO; i++)
190 set_irq_chip(EMMA2RH_GPIO_IRQ_BASE + i,
191 &emma2rh_gpio_irq_controller);
192}
193
194static struct irqaction irq_cascade = {
195 .handler = no_action,
196 .flags = 0,
197 .mask = CPU_MASK_NONE,
198 .name = "cascade",
199 .dev_id = NULL,
200 .next = NULL,
201};
202
203/*
204 * the first level int-handler will jump here if it is a emma2rh irq
205 */
206void emma2rh_irq_dispatch(void)
207{
208 u32 intStatus;
209 u32 bitmask;
210 u32 i;
211
212 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0) &
213 emma2rh_in32(EMMA2RH_BHIF_INT_EN_0);
214
215#ifdef EMMA2RH_SW_CASCADE
216 if (intStatus &
217 (1 << ((EMMA2RH_SW_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
218 u32 swIntStatus;
219 swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT)
220 & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
221 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
222 if (swIntStatus & bitmask) {
223 do_IRQ(EMMA2RH_SW_IRQ_BASE + i);
224 return;
225 }
226 }
227 }
228#endif
229
230 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
231 if (intStatus & bitmask) {
232 do_IRQ(EMMA2RH_IRQ_BASE + i);
233 return;
234 }
235 }
236
237 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1) &
238 emma2rh_in32(EMMA2RH_BHIF_INT_EN_1);
239
240#ifdef EMMA2RH_GPIO_CASCADE
241 if (intStatus &
242 (1 << ((EMMA2RH_GPIO_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
243 u32 gpioIntStatus;
244 gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST)
245 & emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
246 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
247 if (gpioIntStatus & bitmask) {
248 do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i);
249 return;
250 }
251 }
252 }
253#endif
254
255 for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) {
256 if (intStatus & bitmask) {
257 do_IRQ(EMMA2RH_IRQ_BASE + i);
258 return;
259 }
260 }
261
262 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2) &
263 emma2rh_in32(EMMA2RH_BHIF_INT_EN_2);
264
265 for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) {
266 if (intStatus & bitmask) {
267 do_IRQ(EMMA2RH_IRQ_BASE + i);
268 return;
269 }
270 }
271}
272
273void __init arch_init_irq(void)
274{
275 u32 reg;
276
277 /* by default, interrupts are disabled. */
278 emma2rh_out32(EMMA2RH_BHIF_INT_EN_0, 0);
279 emma2rh_out32(EMMA2RH_BHIF_INT_EN_1, 0);
280 emma2rh_out32(EMMA2RH_BHIF_INT_EN_2, 0);
281 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_0, 0);
282 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_1, 0);
283 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_2, 0);
284 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, 0);
285
286 clear_c0_status(0xff00);
287 set_c0_status(0x0400);
288
289#define GPIO_PCI (0xf<<15)
290 /* setup GPIO interrupt for PCI interface */
291 /* direction input */
292 reg = emma2rh_in32(EMMA2RH_GPIO_DIR);
293 emma2rh_out32(EMMA2RH_GPIO_DIR, reg & ~GPIO_PCI);
294 /* disable interrupt */
295 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
296 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg & ~GPIO_PCI);
297 /* level triggerd */
298 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MODE);
299 emma2rh_out32(EMMA2RH_GPIO_INT_MODE, reg | GPIO_PCI);
300 reg = emma2rh_in32(EMMA2RH_GPIO_INT_CND_A);
301 emma2rh_out32(EMMA2RH_GPIO_INT_CND_A, reg & (~GPIO_PCI));
302 /* interrupt clear */
303 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~GPIO_PCI);
304
305 /* init all controllers */
306 emma2rh_irq_init();
307 emma2rh_sw_irq_init();
308 emma2rh_gpio_irq_init();
309 mips_cpu_irq_init();
310
311 /* setup cascade interrupts */
312 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade);
313 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade);
314 setup_irq(CPU_IRQ_BASE + CPU_EMMA2RH_CASCADE, &irq_cascade);
315}
316
317asmlinkage void plat_irq_dispatch(void)
318{
319 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
320
321 if (pending & STATUSF_IP7)
322 do_IRQ(CPU_IRQ_BASE + 7);
323 else if (pending & STATUSF_IP2)
324 emma2rh_irq_dispatch();
325 else if (pending & STATUSF_IP1)
326 do_IRQ(CPU_IRQ_BASE + 1);
327 else if (pending & STATUSF_IP0)
328 do_IRQ(CPU_IRQ_BASE + 0);
329 else
330 spurious_interrupt();
331}
diff --git a/arch/mips/emma2rh/markeins/led.c b/arch/mips/emma/markeins/led.c
index b65254c1bfe9..377a181b6561 100644
--- a/arch/mips/emma2rh/markeins/led.c
+++ b/arch/mips/emma/markeins/led.c
@@ -21,7 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/string.h> 23#include <linux/string.h>
24#include <asm/emma2rh/emma2rh.h> 24#include <asm/emma/emma2rh.h>
25 25
26const unsigned long clear = 0x20202020; 26const unsigned long clear = 0x20202020;
27 27
diff --git a/arch/mips/emma2rh/markeins/platform.c b/arch/mips/emma/markeins/platform.c
index fb9cda253ab0..88e87f6b3442 100644
--- a/arch/mips/emma2rh/markeins/platform.c
+++ b/arch/mips/emma/markeins/platform.c
@@ -36,7 +36,7 @@
36#include <asm/reboot.h> 36#include <asm/reboot.h>
37#include <asm/traps.h> 37#include <asm/traps.h>
38 38
39#include <asm/emma2rh/emma2rh.h> 39#include <asm/emma/emma2rh.h>
40 40
41 41
42#define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */ 42#define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma/markeins/setup.c
index b6a23ad539f8..67f456500084 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma/markeins/setup.c
@@ -29,7 +29,7 @@
29#include <asm/time.h> 29#include <asm/time.h>
30#include <asm/reboot.h> 30#include <asm/reboot.h>
31 31
32#include <asm/emma2rh/emma2rh.h> 32#include <asm/emma/emma2rh.h>
33 33
34#define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */ 34#define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */
35 35
diff --git a/arch/mips/emma2rh/common/irq.c b/arch/mips/emma2rh/common/irq.c
deleted file mode 100644
index 91cbd959ab67..000000000000
--- a/arch/mips/emma2rh/common/irq.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * arch/mips/emma2rh/common/irq.c
3 * This file is common irq dispatcher.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/types.h>
29
30#include <asm/system.h>
31#include <asm/mipsregs.h>
32#include <asm/addrspace.h>
33#include <asm/bootinfo.h>
34
35#include <asm/emma2rh/emma2rh.h>
36
37/*
38 * the first level int-handler will jump here if it is a emma2rh irq
39 */
40void emma2rh_irq_dispatch(void)
41{
42 u32 intStatus;
43 u32 bitmask;
44 u32 i;
45
46 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0)
47 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_0);
48
49#ifdef EMMA2RH_SW_CASCADE
50 if (intStatus &
51 (1 << ((EMMA2RH_SW_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
52 u32 swIntStatus;
53 swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT)
54 & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
55 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
56 if (swIntStatus & bitmask) {
57 do_IRQ(EMMA2RH_SW_IRQ_BASE + i);
58 return;
59 }
60 }
61 }
62#endif
63
64 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
65 if (intStatus & bitmask) {
66 do_IRQ(EMMA2RH_IRQ_BASE + i);
67 return;
68 }
69 }
70
71 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1)
72 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_1);
73
74#ifdef EMMA2RH_GPIO_CASCADE
75 if (intStatus &
76 (1 << ((EMMA2RH_GPIO_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
77 u32 gpioIntStatus;
78 gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST)
79 & emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
80 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
81 if (gpioIntStatus & bitmask) {
82 do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i);
83 return;
84 }
85 }
86 }
87#endif
88
89 for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) {
90 if (intStatus & bitmask) {
91 do_IRQ(EMMA2RH_IRQ_BASE + i);
92 return;
93 }
94 }
95
96 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2)
97 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_2);
98
99 for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) {
100 if (intStatus & bitmask) {
101 do_IRQ(EMMA2RH_IRQ_BASE + i);
102 return;
103 }
104 }
105}
diff --git a/arch/mips/emma2rh/common/irq_emma2rh.c b/arch/mips/emma2rh/common/irq_emma2rh.c
deleted file mode 100644
index 96df37b77759..000000000000
--- a/arch/mips/emma2rh/common/irq_emma2rh.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * arch/mips/emma2rh/common/irq_emma2rh.c
3 * This file defines the irq handler for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26/*
27 * EMMA2RH defines 64 IRQs.
28 *
29 * This file exports one function:
30 * emma2rh_irq_init(u32 irq_base);
31 */
32
33#include <linux/interrupt.h>
34#include <linux/types.h>
35#include <linux/ptrace.h>
36
37#include <asm/debug.h>
38
39#include <asm/emma2rh/emma2rh.h>
40
41/* number of total irqs supported by EMMA2RH */
42#define NUM_EMMA2RH_IRQ 96
43
44static int emma2rh_irq_base = -1;
45
46void ll_emma2rh_irq_enable(int);
47void ll_emma2rh_irq_disable(int);
48
49static void emma2rh_irq_enable(unsigned int irq)
50{
51 ll_emma2rh_irq_enable(irq - emma2rh_irq_base);
52}
53
54static void emma2rh_irq_disable(unsigned int irq)
55{
56 ll_emma2rh_irq_disable(irq - emma2rh_irq_base);
57}
58
59struct irq_chip emma2rh_irq_controller = {
60 .name = "emma2rh_irq",
61 .ack = emma2rh_irq_disable,
62 .mask = emma2rh_irq_disable,
63 .mask_ack = emma2rh_irq_disable,
64 .unmask = emma2rh_irq_enable,
65};
66
67void emma2rh_irq_init(u32 irq_base)
68{
69 u32 i;
70
71 for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++)
72 set_irq_chip_and_handler(i, &emma2rh_irq_controller,
73 handle_level_irq);
74
75 emma2rh_irq_base = irq_base;
76}
77
78void ll_emma2rh_irq_enable(int emma2rh_irq)
79{
80 u32 reg_value;
81 u32 reg_bitmask;
82 u32 reg_index;
83
84 reg_index = EMMA2RH_BHIF_INT_EN_0
85 + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0)
86 * (emma2rh_irq / 32);
87 reg_value = emma2rh_in32(reg_index);
88 reg_bitmask = 0x1 << (emma2rh_irq % 32);
89 db_assert((reg_value & reg_bitmask) == 0);
90 emma2rh_out32(reg_index, reg_value | reg_bitmask);
91}
92
93void ll_emma2rh_irq_disable(int emma2rh_irq)
94{
95 u32 reg_value;
96 u32 reg_bitmask;
97 u32 reg_index;
98
99 reg_index = EMMA2RH_BHIF_INT_EN_0
100 + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0)
101 * (emma2rh_irq / 32);
102 reg_value = emma2rh_in32(reg_index);
103 reg_bitmask = 0x1 << (emma2rh_irq % 32);
104 db_assert((reg_value & reg_bitmask) != 0);
105 emma2rh_out32(reg_index, reg_value & ~reg_bitmask);
106}
diff --git a/arch/mips/emma2rh/markeins/irq.c b/arch/mips/emma2rh/markeins/irq.c
deleted file mode 100644
index 6bcf6a06367a..000000000000
--- a/arch/mips/emma2rh/markeins/irq.c
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * arch/mips/emma2rh/markeins/irq.c
3 * This file defines the irq handler for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/types.h>
29#include <linux/ptrace.h>
30#include <linux/delay.h>
31
32#include <asm/irq_cpu.h>
33#include <asm/system.h>
34#include <asm/mipsregs.h>
35#include <asm/debug.h>
36#include <asm/addrspace.h>
37#include <asm/bootinfo.h>
38
39#include <asm/emma2rh/emma2rh.h>
40
41/*
42 * IRQ mapping
43 *
44 * 0-7: 8 CPU interrupts
45 * 0 - software interrupt 0
46 * 1 - software interrupt 1
47 * 2 - most Vrc5477 interrupts are routed to this pin
48 * 3 - (optional) some other interrupts routed to this pin for debugg
49 * 4 - not used
50 * 5 - not used
51 * 6 - not used
52 * 7 - cpu timer (used by default)
53 *
54 */
55
56extern void emma2rh_sw_irq_init(u32 base);
57extern void emma2rh_gpio_irq_init(u32 base);
58extern void emma2rh_irq_init(u32 base);
59extern void emma2rh_irq_dispatch(void);
60
61static struct irqaction irq_cascade = {
62 .handler = no_action,
63 .flags = 0,
64 .mask = CPU_MASK_NONE,
65 .name = "cascade",
66 .dev_id = NULL,
67 .next = NULL,
68};
69
70void __init arch_init_irq(void)
71{
72 u32 reg;
73
74 db_run(printk("markeins_irq_setup invoked.\n"));
75
76 /* by default, interrupts are disabled. */
77 emma2rh_out32(EMMA2RH_BHIF_INT_EN_0, 0);
78 emma2rh_out32(EMMA2RH_BHIF_INT_EN_1, 0);
79 emma2rh_out32(EMMA2RH_BHIF_INT_EN_2, 0);
80 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_0, 0);
81 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_1, 0);
82 emma2rh_out32(EMMA2RH_BHIF_INT1_EN_2, 0);
83 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, 0);
84
85 clear_c0_status(0xff00);
86 set_c0_status(0x0400);
87
88#define GPIO_PCI (0xf<<15)
89 /* setup GPIO interrupt for PCI interface */
90 /* direction input */
91 reg = emma2rh_in32(EMMA2RH_GPIO_DIR);
92 emma2rh_out32(EMMA2RH_GPIO_DIR, reg & ~GPIO_PCI);
93 /* disable interrupt */
94 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
95 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg & ~GPIO_PCI);
96 /* level triggerd */
97 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MODE);
98 emma2rh_out32(EMMA2RH_GPIO_INT_MODE, reg | GPIO_PCI);
99 reg = emma2rh_in32(EMMA2RH_GPIO_INT_CND_A);
100 emma2rh_out32(EMMA2RH_GPIO_INT_CND_A, reg & (~GPIO_PCI));
101 /* interrupt clear */
102 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~GPIO_PCI);
103
104 /* init all controllers */
105 emma2rh_irq_init(EMMA2RH_IRQ_BASE);
106 emma2rh_sw_irq_init(EMMA2RH_SW_IRQ_BASE);
107 emma2rh_gpio_irq_init(EMMA2RH_GPIO_IRQ_BASE);
108 mips_cpu_irq_init();
109
110 /* setup cascade interrupts */
111 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade);
112 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade);
113 setup_irq(CPU_IRQ_BASE + CPU_EMMA2RH_CASCADE, &irq_cascade);
114}
115
116asmlinkage void plat_irq_dispatch(void)
117{
118 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
119
120 if (pending & STATUSF_IP7)
121 do_IRQ(CPU_IRQ_BASE + 7);
122 else if (pending & STATUSF_IP2)
123 emma2rh_irq_dispatch();
124 else if (pending & STATUSF_IP1)
125 do_IRQ(CPU_IRQ_BASE + 1);
126 else if (pending & STATUSF_IP0)
127 do_IRQ(CPU_IRQ_BASE + 0);
128 else
129 spurious_interrupt();
130}
131
132
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c
deleted file mode 100644
index fba5c156f472..000000000000
--- a/arch/mips/emma2rh/markeins/irq_markeins.c
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * arch/mips/emma2rh/markeins/irq_markeins.c
3 * This file defines the irq handler for Mark-eins.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/interrupt.h>
26#include <linux/irq.h>
27#include <linux/types.h>
28#include <linux/ptrace.h>
29
30#include <asm/debug.h>
31#include <asm/emma2rh/emma2rh.h>
32
33static int emma2rh_sw_irq_base = -1;
34static int emma2rh_gpio_irq_base = -1;
35
36void ll_emma2rh_sw_irq_enable(int reg);
37void ll_emma2rh_sw_irq_disable(int reg);
38void ll_emma2rh_gpio_irq_enable(int reg);
39void ll_emma2rh_gpio_irq_disable(int reg);
40
41static void emma2rh_sw_irq_enable(unsigned int irq)
42{
43 ll_emma2rh_sw_irq_enable(irq - emma2rh_sw_irq_base);
44}
45
46static void emma2rh_sw_irq_disable(unsigned int irq)
47{
48 ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base);
49}
50
51struct irq_chip emma2rh_sw_irq_controller = {
52 .name = "emma2rh_sw_irq",
53 .ack = emma2rh_sw_irq_disable,
54 .mask = emma2rh_sw_irq_disable,
55 .mask_ack = emma2rh_sw_irq_disable,
56 .unmask = emma2rh_sw_irq_enable,
57};
58
59void emma2rh_sw_irq_init(u32 irq_base)
60{
61 u32 i;
62
63 for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++)
64 set_irq_chip_and_handler(i, &emma2rh_sw_irq_controller,
65 handle_level_irq);
66
67 emma2rh_sw_irq_base = irq_base;
68}
69
70void ll_emma2rh_sw_irq_enable(int irq)
71{
72 u32 reg;
73
74 db_assert(irq >= 0);
75 db_assert(irq < NUM_EMMA2RH_IRQ_SW);
76
77 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
78 reg |= 1 << irq;
79 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg);
80}
81
82void ll_emma2rh_sw_irq_disable(int irq)
83{
84 u32 reg;
85
86 db_assert(irq >= 0);
87 db_assert(irq < 32);
88
89 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
90 reg &= ~(1 << irq);
91 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg);
92}
93
94static void emma2rh_gpio_irq_enable(unsigned int irq)
95{
96 ll_emma2rh_gpio_irq_enable(irq - emma2rh_gpio_irq_base);
97}
98
99static void emma2rh_gpio_irq_disable(unsigned int irq)
100{
101 ll_emma2rh_gpio_irq_disable(irq - emma2rh_gpio_irq_base);
102}
103
104static void emma2rh_gpio_irq_ack(unsigned int irq)
105{
106 irq -= emma2rh_gpio_irq_base;
107 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq));
108 ll_emma2rh_gpio_irq_disable(irq);
109}
110
111static void emma2rh_gpio_irq_end(unsigned int irq)
112{
113 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
114 ll_emma2rh_gpio_irq_enable(irq - emma2rh_gpio_irq_base);
115}
116
117struct irq_chip emma2rh_gpio_irq_controller = {
118 .name = "emma2rh_gpio_irq",
119 .ack = emma2rh_gpio_irq_ack,
120 .mask = emma2rh_gpio_irq_disable,
121 .mask_ack = emma2rh_gpio_irq_ack,
122 .unmask = emma2rh_gpio_irq_enable,
123 .end = emma2rh_gpio_irq_end,
124};
125
126void emma2rh_gpio_irq_init(u32 irq_base)
127{
128 u32 i;
129
130 for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++)
131 set_irq_chip(i, &emma2rh_gpio_irq_controller);
132
133 emma2rh_gpio_irq_base = irq_base;
134}
135
136void ll_emma2rh_gpio_irq_enable(int irq)
137{
138 u32 reg;
139
140 db_assert(irq >= 0);
141 db_assert(irq < NUM_EMMA2RH_IRQ_GPIO);
142
143 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
144 reg |= 1 << irq;
145 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
146}
147
148void ll_emma2rh_gpio_irq_disable(int irq)
149{
150 u32 reg;
151
152 db_assert(irq >= 0);
153 db_assert(irq < NUM_EMMA2RH_IRQ_GPIO);
154
155 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
156 reg &= ~(1 << irq);
157 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg);
158}
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 49df8c4c9d25..bac4a960b24c 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -558,39 +558,67 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
558 __clear_bit(nr, addr); 558 __clear_bit(nr, addr);
559} 559}
560 560
561#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
562
563/* 561/*
564 * Return the bit position (0..63) of the most significant 1 bit in a word 562 * Return the bit position (0..63) of the most significant 1 bit in a word
565 * Returns -1 if no 1 bit exists 563 * Returns -1 if no 1 bit exists
566 */ 564 */
567static inline unsigned long __fls(unsigned long x) 565static inline unsigned long __fls(unsigned long word)
568{ 566{
569 int lz; 567 int num;
570 568
571 if (sizeof(x) == 4) { 569 if (BITS_PER_LONG == 32 &&
570 __builtin_constant_p(cpu_has_mips_r) && cpu_has_mips_r) {
572 __asm__( 571 __asm__(
573 " .set push \n" 572 " .set push \n"
574 " .set mips32 \n" 573 " .set mips32 \n"
575 " clz %0, %1 \n" 574 " clz %0, %1 \n"
576 " .set pop \n" 575 " .set pop \n"
577 : "=r" (lz) 576 : "=r" (num)
578 : "r" (x)); 577 : "r" (word));
579 578
580 return 31 - lz; 579 return 31 - num;
581 } 580 }
582 581
583 BUG_ON(sizeof(x) != 8); 582 if (BITS_PER_LONG == 64 &&
583 __builtin_constant_p(cpu_has_mips64) && cpu_has_mips64) {
584 __asm__(
585 " .set push \n"
586 " .set mips64 \n"
587 " dclz %0, %1 \n"
588 " .set pop \n"
589 : "=r" (num)
590 : "r" (word));
584 591
585 __asm__( 592 return 63 - num;
586 " .set push \n" 593 }
587 " .set mips64 \n" 594
588 " dclz %0, %1 \n" 595 num = BITS_PER_LONG - 1;
589 " .set pop \n"
590 : "=r" (lz)
591 : "r" (x));
592 596
593 return 63 - lz; 597#if BITS_PER_LONG == 64
598 if (!(word & (~0ul << 32))) {
599 num -= 32;
600 word <<= 32;
601 }
602#endif
603 if (!(word & (~0ul << (BITS_PER_LONG-16)))) {
604 num -= 16;
605 word <<= 16;
606 }
607 if (!(word & (~0ul << (BITS_PER_LONG-8)))) {
608 num -= 8;
609 word <<= 8;
610 }
611 if (!(word & (~0ul << (BITS_PER_LONG-4)))) {
612 num -= 4;
613 word <<= 4;
614 }
615 if (!(word & (~0ul << (BITS_PER_LONG-2)))) {
616 num -= 2;
617 word <<= 2;
618 }
619 if (!(word & (~0ul << (BITS_PER_LONG-1))))
620 num -= 1;
621 return num;
594} 622}
595 623
596/* 624/*
@@ -612,23 +640,43 @@ static inline unsigned long __ffs(unsigned long word)
612 * This is defined the same way as ffs. 640 * This is defined the same way as ffs.
613 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. 641 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
614 */ 642 */
615static inline int fls(int word) 643static inline int fls(int x)
616{ 644{
617 __asm__("clz %0, %1" : "=r" (word) : "r" (word)); 645 int r;
618 646
619 return 32 - word; 647 if (__builtin_constant_p(cpu_has_mips_r) && cpu_has_mips_r) {
620} 648 __asm__("clz %0, %1" : "=r" (x) : "r" (x));
621 649
622#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPS64) 650 return 32 - x;
623static inline int fls64(__u64 word) 651 }
624{
625 __asm__("dclz %0, %1" : "=r" (word) : "r" (word));
626 652
627 return 64 - word; 653 r = 32;
654 if (!x)
655 return 0;
656 if (!(x & 0xffff0000u)) {
657 x <<= 16;
658 r -= 16;
659 }
660 if (!(x & 0xff000000u)) {
661 x <<= 8;
662 r -= 8;
663 }
664 if (!(x & 0xf0000000u)) {
665 x <<= 4;
666 r -= 4;
667 }
668 if (!(x & 0xc0000000u)) {
669 x <<= 2;
670 r -= 2;
671 }
672 if (!(x & 0x80000000u)) {
673 x <<= 1;
674 r -= 1;
675 }
676 return r;
628} 677}
629#else 678
630#include <asm-generic/bitops/fls64.h> 679#include <asm-generic/bitops/fls64.h>
631#endif
632 680
633/* 681/*
634 * ffs - find first bit set. 682 * ffs - find first bit set.
@@ -646,16 +694,6 @@ static inline int ffs(int word)
646 return fls(word & -word); 694 return fls(word & -word);
647} 695}
648 696
649#else
650
651#include <asm-generic/bitops/__ffs.h>
652#include <asm-generic/bitops/__fls.h>
653#include <asm-generic/bitops/ffs.h>
654#include <asm-generic/bitops/fls.h>
655#include <asm-generic/bitops/fls64.h>
656
657#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
658
659#include <asm-generic/bitops/ffz.h> 697#include <asm-generic/bitops/ffz.h>
660#include <asm-generic/bitops/find.h> 698#include <asm-generic/bitops/find.h>
661 699
diff --git a/arch/mips/include/asm/break.h b/arch/mips/include/asm/break.h
index 25b980c91e7e..44437ed765e8 100644
--- a/arch/mips/include/asm/break.h
+++ b/arch/mips/include/asm/break.h
@@ -29,6 +29,7 @@
29#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */ 29#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
30#define BRK_BUG 512 /* Used by BUG() */ 30#define BRK_BUG 512 /* Used by BUG() */
31#define BRK_KDB 513 /* Used in KDB_ENTER() */ 31#define BRK_KDB 513 /* Used in KDB_ENTER() */
32#define BRK_MEMU 514 /* Used by FPU emulator */
32#define BRK_MULOVF 1023 /* Multiply overflow */ 33#define BRK_MULOVF 1023 /* Multiply overflow */
33 34
34#endif /* __ASM_BREAK_H */ 35#endif /* __ASM_BREAK_H */
diff --git a/arch/mips/include/asm/byteorder.h b/arch/mips/include/asm/byteorder.h
index fe7dc2d59b69..2988d29a0867 100644
--- a/arch/mips/include/asm/byteorder.h
+++ b/arch/mips/include/asm/byteorder.h
@@ -11,11 +11,19 @@
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <asm/types.h> 12#include <asm/types.h>
13 13
14#ifdef __GNUC__ 14#if defined(__MIPSEB__)
15# define __BIG_ENDIAN
16#elif defined(__MIPSEL__)
17# define __LITTLE_ENDIAN
18#else
19# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
20#endif
21
22#define __SWAB_64_THRU_32__
15 23
16#ifdef CONFIG_CPU_MIPSR2 24#ifdef CONFIG_CPU_MIPSR2
17 25
18static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) 26static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
19{ 27{
20 __asm__( 28 __asm__(
21 " wsbh %0, %1 \n" 29 " wsbh %0, %1 \n"
@@ -24,9 +32,9 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
24 32
25 return x; 33 return x;
26} 34}
27#define __arch__swab16(x) ___arch__swab16(x) 35#define __arch_swab16 __arch_swab16
28 36
29static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) 37static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
30{ 38{
31 __asm__( 39 __asm__(
32 " wsbh %0, %1 \n" 40 " wsbh %0, %1 \n"
@@ -36,11 +44,10 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
36 44
37 return x; 45 return x;
38} 46}
39#define __arch__swab32(x) ___arch__swab32(x) 47#define __arch_swab32 __arch_swab32
40 48
41#ifdef CONFIG_CPU_MIPS64_R2 49#ifdef CONFIG_CPU_MIPS64_R2
42 50static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
43static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
44{ 51{
45 __asm__( 52 __asm__(
46 " dsbh %0, %1 \n" 53 " dsbh %0, %1 \n"
@@ -51,26 +58,11 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
51 58
52 return x; 59 return x;
53} 60}
54 61#define __arch_swab64 __arch_swab64
55#define __arch__swab64(x) ___arch__swab64(x)
56
57#endif /* CONFIG_CPU_MIPS64_R2 */ 62#endif /* CONFIG_CPU_MIPS64_R2 */
58 63
59#endif /* CONFIG_CPU_MIPSR2 */ 64#endif /* CONFIG_CPU_MIPSR2 */
60 65
61#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 66#include <linux/byteorder.h>
62# define __BYTEORDER_HAS_U64__
63# define __SWAB_64_THRU_32__
64#endif
65
66#endif /* __GNUC__ */
67
68#if defined(__MIPSEB__)
69# include <linux/byteorder/big_endian.h>
70#elif defined(__MIPSEL__)
71# include <linux/byteorder/little_endian.h>
72#else
73# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
74#endif
75 67
76#endif /* _ASM_BYTEORDER_H */ 68#endif /* _ASM_BYTEORDER_H */
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 5ea701fc3425..12d12dfe73c0 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -141,6 +141,8 @@
141#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2) 141#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2)
142#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1) 142#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1)
143#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2) 143#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2)
144#define cpu_has_mips_r (cpu_has_mips32r1 | cpu_has_mips32r2 | \
145 cpu_has_mips64r1 | cpu_has_mips64r2)
144 146
145#ifndef cpu_has_dsp 147#ifndef cpu_has_dsp
146#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) 148#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
diff --git a/arch/mips/include/asm/ds1286.h b/arch/mips/include/asm/ds1286.h
deleted file mode 100644
index 6983b6ff0af3..000000000000
--- a/arch/mips/include/asm/ds1286.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Machine dependent access functions for RTC registers.
7 *
8 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
9 */
10#ifndef _ASM_DS1286_H
11#define _ASM_DS1286_H
12
13#include <ds1286.h>
14
15#endif /* _ASM_DS1286_H */
diff --git a/arch/mips/include/asm/emma2rh/emma2rh.h b/arch/mips/include/asm/emma/emma2rh.h
index 6a1af0af51e3..30aea91de626 100644
--- a/arch/mips/include/asm/emma2rh/emma2rh.h
+++ b/arch/mips/include/asm/emma/emma2rh.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-mips/emma2rh/emma2rh.h 2 * arch/mips/include/asm/emma/emma2rh.h
3 * This file is EMMA2RH common header. 3 * This file is EMMA2RH common header.
4 * 4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006 5 * Copyright (C) NEC Electronics Corporation 2005-2006
@@ -21,8 +21,8 @@
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24#ifndef __ASM_EMMA2RH_EMMA2RH_H 24#ifndef __ASM_EMMA_EMMA2RH_H
25#define __ASM_EMMA2RH_EMMA2RH_H 25#define __ASM_EMMA_EMMA2RH_H
26 26
27#include <irq.h> 27#include <irq.h>
28 28
@@ -206,7 +206,6 @@ static inline void emma2rh_out32(u32 offset, u32 val)
206static inline u32 emma2rh_in32(u32 offset) 206static inline u32 emma2rh_in32(u32 offset)
207{ 207{
208 u32 val = *(volatile u32 *)(EMMA2RH_BASE | offset); 208 u32 val = *(volatile u32 *)(EMMA2RH_BASE | offset);
209 emma2rh_sync();
210 return val; 209 return val;
211} 210}
212 211
@@ -219,7 +218,6 @@ static inline void emma2rh_out16(u32 offset, u16 val)
219static inline u16 emma2rh_in16(u32 offset) 218static inline u16 emma2rh_in16(u32 offset)
220{ 219{
221 u16 val = *(volatile u16 *)(EMMA2RH_BASE | offset); 220 u16 val = *(volatile u16 *)(EMMA2RH_BASE | offset);
222 emma2rh_sync();
223 return val; 221 return val;
224} 222}
225 223
@@ -232,7 +230,6 @@ static inline void emma2rh_out8(u32 offset, u8 val)
232static inline u8 emma2rh_in8(u32 offset) 230static inline u8 emma2rh_in8(u32 offset)
233{ 231{
234 u8 val = *(volatile u8 *)(EMMA2RH_BASE | offset); 232 u8 val = *(volatile u8 *)(EMMA2RH_BASE | offset);
235 emma2rh_sync();
236 return val; 233 return val;
237} 234}
238 235
@@ -324,10 +321,10 @@ static inline u8 emma2rh_in8(u32 offset)
324/* 321/*
325 * include the board dependent part 322 * include the board dependent part
326 */ 323 */
327#if defined(CONFIG_MARKEINS) 324#ifdef CONFIG_NEC_MARKEINS
328#include <asm/emma2rh/markeins.h> 325#include <asm/emma/markeins.h>
329#else 326#else
330#error "Unknown EMMA2RH board!" 327#error "Unknown EMMA2RH board!"
331#endif 328#endif
332 329
333#endif /* __ASM_EMMA2RH_EMMA2RH_H */ 330#endif /* __ASM_EMMA_EMMA2RH_H */
diff --git a/arch/mips/include/asm/emma2rh/markeins.h b/arch/mips/include/asm/emma/markeins.h
index 973b0628490d..973b0628490d 100644
--- a/arch/mips/include/asm/emma2rh/markeins.h
+++ b/arch/mips/include/asm/emma/markeins.h
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index 2731c38bd7ae..e5189572956c 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -23,6 +23,9 @@
23#ifndef _ASM_FPU_EMULATOR_H 23#ifndef _ASM_FPU_EMULATOR_H
24#define _ASM_FPU_EMULATOR_H 24#define _ASM_FPU_EMULATOR_H
25 25
26#include <asm/break.h>
27#include <asm/inst.h>
28
26struct mips_fpu_emulator_stats { 29struct mips_fpu_emulator_stats {
27 unsigned int emulated; 30 unsigned int emulated;
28 unsigned int loads; 31 unsigned int loads;
@@ -34,4 +37,18 @@ struct mips_fpu_emulator_stats {
34 37
35extern struct mips_fpu_emulator_stats fpuemustats; 38extern struct mips_fpu_emulator_stats fpuemustats;
36 39
40extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
41 unsigned long cpc);
42extern int do_dsemulret(struct pt_regs *xcp);
43
44/*
45 * Instruction inserted following the badinst to further tag the sequence
46 */
47#define BD_COOKIE 0x0000bd36 /* tne $0, $0 with baggage */
48
49/*
50 * Break instruction with special math emu break code set
51 */
52#define BREAK_MATH (0x0000000d | (BRK_MEMU << 16))
53
37#endif /* _ASM_FPU_EMULATOR_H */ 54#endif /* _ASM_FPU_EMULATOR_H */
diff --git a/arch/mips/include/asm/m48t35.h b/arch/mips/include/asm/m48t35.h
deleted file mode 100644
index f44852e9a96d..000000000000
--- a/arch/mips/include/asm/m48t35.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Registers for the SGS-Thomson M48T35 Timekeeper RAM chip
3 */
4#ifndef _ASM_M48T35_H
5#define _ASM_M48T35_H
6
7#include <linux/spinlock.h>
8
9extern spinlock_t rtc_lock;
10
11struct m48t35_rtc {
12 volatile u8 pad[0x7ff8]; /* starts at 0x7ff8 */
13 volatile u8 control;
14 volatile u8 sec;
15 volatile u8 min;
16 volatile u8 hour;
17 volatile u8 day;
18 volatile u8 date;
19 volatile u8 month;
20 volatile u8 year;
21};
22
23#define M48T35_RTC_SET 0x80
24#define M48T35_RTC_STOPPED 0x80
25#define M48T35_RTC_READ 0x40
26
27#endif /* _ASM_M48T35_H */
diff --git a/arch/mips/include/asm/mach-lemote/pci.h b/arch/mips/include/asm/mach-lemote/pci.h
new file mode 100644
index 000000000000..ea6aa143b78e
--- /dev/null
+++ b/arch/mips/include/asm/mach-lemote/pci.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org>
3 *
4 * This program is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General
6 * Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This program is distributed in the hope that it will be
11 * useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
19 * 02139, USA.
20 */
21
22#ifndef _LEMOTE_PCI_H_
23#define _LEMOTE_PCI_H_
24
25#define LOONGSON2E_PCI_MEM_START 0x14000000UL
26#define LOONGSON2E_PCI_MEM_END 0x1fffffffUL
27#define LOONGSON2E_PCI_IO_START 0x00004000UL
28#define LOONGSON2E_IO_PORT_BASE 0x1fd00000UL
29
30#endif /* !_LEMOTE_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-pnx833x/gpio.h b/arch/mips/include/asm/mach-pnx833x/gpio.h
new file mode 100644
index 000000000000..8de0eb9c98a3
--- /dev/null
+++ b/arch/mips/include/asm/mach-pnx833x/gpio.h
@@ -0,0 +1,172 @@
1/*
2 * gpio.h: GPIO Support for PNX833X.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#ifndef __ASM_MIPS_MACH_PNX833X_GPIO_H
23#define __ASM_MIPS_MACH_PNX833X_GPIO_H
24
25/* BIG FAT WARNING: races danger!
26 No protections exist here. Current users are only early init code,
27 when locking is not needed because no cuncurency yet exists there,
28 and GPIO IRQ dispatcher, which does locking.
29 However, if many uses will ever happen, proper locking will be needed
30 - including locking between different uses
31*/
32
33#include "pnx833x.h"
34
35#define SET_REG_BIT(reg, bit) do { (reg |= (1 << (bit))); } while (0)
36#define CLEAR_REG_BIT(reg, bit) do { (reg &= ~(1 << (bit))); } while (0)
37
38/* Initialize GPIO to a known state */
39static inline void pnx833x_gpio_init(void)
40{
41 PNX833X_PIO_DIR = 0;
42 PNX833X_PIO_DIR2 = 0;
43 PNX833X_PIO_SEL = 0;
44 PNX833X_PIO_SEL2 = 0;
45 PNX833X_PIO_INT_EDGE = 0;
46 PNX833X_PIO_INT_HI = 0;
47 PNX833X_PIO_INT_LO = 0;
48
49 /* clear any GPIO interrupt requests */
50 PNX833X_PIO_INT_CLEAR = 0xffff;
51 PNX833X_PIO_INT_CLEAR = 0;
52 PNX833X_PIO_INT_ENABLE = 0;
53}
54
55/* Select GPIO direction for a pin */
56static inline void pnx833x_gpio_select_input(unsigned int pin)
57{
58 if (pin < 32)
59 CLEAR_REG_BIT(PNX833X_PIO_DIR, pin);
60 else
61 CLEAR_REG_BIT(PNX833X_PIO_DIR2, pin & 31);
62}
63static inline void pnx833x_gpio_select_output(unsigned int pin)
64{
65 if (pin < 32)
66 SET_REG_BIT(PNX833X_PIO_DIR, pin);
67 else
68 SET_REG_BIT(PNX833X_PIO_DIR2, pin & 31);
69}
70
71/* Select GPIO or alternate function for a pin */
72static inline void pnx833x_gpio_select_function_io(unsigned int pin)
73{
74 if (pin < 32)
75 CLEAR_REG_BIT(PNX833X_PIO_SEL, pin);
76 else
77 CLEAR_REG_BIT(PNX833X_PIO_SEL2, pin & 31);
78}
79static inline void pnx833x_gpio_select_function_alt(unsigned int pin)
80{
81 if (pin < 32)
82 SET_REG_BIT(PNX833X_PIO_SEL, pin);
83 else
84 SET_REG_BIT(PNX833X_PIO_SEL2, pin & 31);
85}
86
87/* Read GPIO pin */
88static inline int pnx833x_gpio_read(unsigned int pin)
89{
90 if (pin < 32)
91 return (PNX833X_PIO_IN >> pin) & 1;
92 else
93 return (PNX833X_PIO_IN2 >> (pin & 31)) & 1;
94}
95
96/* Write GPIO pin */
97static inline void pnx833x_gpio_write(unsigned int val, unsigned int pin)
98{
99 if (pin < 32) {
100 if (val)
101 SET_REG_BIT(PNX833X_PIO_OUT, pin);
102 else
103 CLEAR_REG_BIT(PNX833X_PIO_OUT, pin);
104 } else {
105 if (val)
106 SET_REG_BIT(PNX833X_PIO_OUT2, pin & 31);
107 else
108 CLEAR_REG_BIT(PNX833X_PIO_OUT2, pin & 31);
109 }
110}
111
112/* Configure GPIO interrupt */
113#define GPIO_INT_NONE 0
114#define GPIO_INT_LEVEL_LOW 1
115#define GPIO_INT_LEVEL_HIGH 2
116#define GPIO_INT_EDGE_RISING 3
117#define GPIO_INT_EDGE_FALLING 4
118#define GPIO_INT_EDGE_BOTH 5
119static inline void pnx833x_gpio_setup_irq(int when, unsigned int pin)
120{
121 switch (when) {
122 case GPIO_INT_LEVEL_LOW:
123 CLEAR_REG_BIT(PNX833X_PIO_INT_EDGE, pin);
124 CLEAR_REG_BIT(PNX833X_PIO_INT_HI, pin);
125 SET_REG_BIT(PNX833X_PIO_INT_LO, pin);
126 break;
127 case GPIO_INT_LEVEL_HIGH:
128 CLEAR_REG_BIT(PNX833X_PIO_INT_EDGE, pin);
129 SET_REG_BIT(PNX833X_PIO_INT_HI, pin);
130 CLEAR_REG_BIT(PNX833X_PIO_INT_LO, pin);
131 break;
132 case GPIO_INT_EDGE_RISING:
133 SET_REG_BIT(PNX833X_PIO_INT_EDGE, pin);
134 SET_REG_BIT(PNX833X_PIO_INT_HI, pin);
135 CLEAR_REG_BIT(PNX833X_PIO_INT_LO, pin);
136 break;
137 case GPIO_INT_EDGE_FALLING:
138 SET_REG_BIT(PNX833X_PIO_INT_EDGE, pin);
139 CLEAR_REG_BIT(PNX833X_PIO_INT_HI, pin);
140 SET_REG_BIT(PNX833X_PIO_INT_LO, pin);
141 break;
142 case GPIO_INT_EDGE_BOTH:
143 SET_REG_BIT(PNX833X_PIO_INT_EDGE, pin);
144 SET_REG_BIT(PNX833X_PIO_INT_HI, pin);
145 SET_REG_BIT(PNX833X_PIO_INT_LO, pin);
146 break;
147 default:
148 CLEAR_REG_BIT(PNX833X_PIO_INT_EDGE, pin);
149 CLEAR_REG_BIT(PNX833X_PIO_INT_HI, pin);
150 CLEAR_REG_BIT(PNX833X_PIO_INT_LO, pin);
151 break;
152 }
153}
154
155/* Enable/disable GPIO interrupt */
156static inline void pnx833x_gpio_enable_irq(unsigned int pin)
157{
158 SET_REG_BIT(PNX833X_PIO_INT_ENABLE, pin);
159}
160static inline void pnx833x_gpio_disable_irq(unsigned int pin)
161{
162 CLEAR_REG_BIT(PNX833X_PIO_INT_ENABLE, pin);
163}
164
165/* Clear GPIO interrupt request */
166static inline void pnx833x_gpio_clear_irq(unsigned int pin)
167{
168 SET_REG_BIT(PNX833X_PIO_INT_CLEAR, pin);
169 CLEAR_REG_BIT(PNX833X_PIO_INT_CLEAR, pin);
170}
171
172#endif
diff --git a/arch/mips/include/asm/mach-pnx833x/irq-mapping.h b/arch/mips/include/asm/mach-pnx833x/irq-mapping.h
new file mode 100644
index 000000000000..657f089b1724
--- /dev/null
+++ b/arch/mips/include/asm/mach-pnx833x/irq-mapping.h
@@ -0,0 +1,126 @@
1
2/*
3 * irq.h: IRQ mappings for PNX833X.
4 *
5 * Copyright 2008 NXP Semiconductors
6 * Chris Steel <chris.steel@nxp.com>
7 * Daniel Laird <daniel.j.laird@nxp.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef __ASM_MIPS_MACH_PNX833X_IRQ_MAPPING_H
25#define __ASM_MIPS_MACH_PNX833X_IRQ_MAPPING_H
26/*
27 * The "IRQ numbers" are completely virtual.
28 *
29 * In PNX8330/1, we have 48 interrupt lines, numbered from 1 to 48.
30 * Let's use numbers 1..48 for PIC interrupts, number 0 for timer interrupt,
31 * numbers 49..64 for (virtual) GPIO interrupts.
32 *
33 * In PNX8335, we have 57 interrupt lines, numbered from 1 to 57,
34 * connected to PIC, which uses core hardware interrupt 2, and also
35 * a timer interrupt through hardware interrupt 5.
36 * Let's use numbers 1..64 for PIC interrupts, number 0 for timer interrupt,
37 * numbers 65..80 for (virtual) GPIO interrupts.
38 *
39 */
40#include <irq.h>
41
42#define PNX833X_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7)
43
44/* Interrupts supported by PIC */
45#define PNX833X_PIC_I2C0_INT (PNX833X_PIC_IRQ_BASE + 1)
46#define PNX833X_PIC_I2C1_INT (PNX833X_PIC_IRQ_BASE + 2)
47#define PNX833X_PIC_UART0_INT (PNX833X_PIC_IRQ_BASE + 3)
48#define PNX833X_PIC_UART1_INT (PNX833X_PIC_IRQ_BASE + 4)
49#define PNX833X_PIC_TS_IN0_DV_INT (PNX833X_PIC_IRQ_BASE + 5)
50#define PNX833X_PIC_TS_IN0_DMA_INT (PNX833X_PIC_IRQ_BASE + 6)
51#define PNX833X_PIC_GPIO_INT (PNX833X_PIC_IRQ_BASE + 7)
52#define PNX833X_PIC_AUDIO_DEC_INT (PNX833X_PIC_IRQ_BASE + 8)
53#define PNX833X_PIC_VIDEO_DEC_INT (PNX833X_PIC_IRQ_BASE + 9)
54#define PNX833X_PIC_CONFIG_INT (PNX833X_PIC_IRQ_BASE + 10)
55#define PNX833X_PIC_AOI_INT (PNX833X_PIC_IRQ_BASE + 11)
56#define PNX833X_PIC_SYNC_INT (PNX833X_PIC_IRQ_BASE + 12)
57#define PNX8330_PIC_SPU_INT (PNX833X_PIC_IRQ_BASE + 13)
58#define PNX8335_PIC_SATA_INT (PNX833X_PIC_IRQ_BASE + 13)
59#define PNX833X_PIC_OSD_INT (PNX833X_PIC_IRQ_BASE + 14)
60#define PNX833X_PIC_DISP1_INT (PNX833X_PIC_IRQ_BASE + 15)
61#define PNX833X_PIC_DEINTERLACER_INT (PNX833X_PIC_IRQ_BASE + 16)
62#define PNX833X_PIC_DISPLAY2_INT (PNX833X_PIC_IRQ_BASE + 17)
63#define PNX833X_PIC_VC_INT (PNX833X_PIC_IRQ_BASE + 18)
64#define PNX833X_PIC_SC_INT (PNX833X_PIC_IRQ_BASE + 19)
65#define PNX833X_PIC_IDE_INT (PNX833X_PIC_IRQ_BASE + 20)
66#define PNX833X_PIC_IDE_DMA_INT (PNX833X_PIC_IRQ_BASE + 21)
67#define PNX833X_PIC_TS_IN1_DV_INT (PNX833X_PIC_IRQ_BASE + 22)
68#define PNX833X_PIC_TS_IN1_DMA_INT (PNX833X_PIC_IRQ_BASE + 23)
69#define PNX833X_PIC_SGDX_DMA_INT (PNX833X_PIC_IRQ_BASE + 24)
70#define PNX833X_PIC_TS_OUT_INT (PNX833X_PIC_IRQ_BASE + 25)
71#define PNX833X_PIC_IR_INT (PNX833X_PIC_IRQ_BASE + 26)
72#define PNX833X_PIC_VMSP1_INT (PNX833X_PIC_IRQ_BASE + 27)
73#define PNX833X_PIC_VMSP2_INT (PNX833X_PIC_IRQ_BASE + 28)
74#define PNX833X_PIC_PIBC_INT (PNX833X_PIC_IRQ_BASE + 29)
75#define PNX833X_PIC_TS_IN0_TRD_INT (PNX833X_PIC_IRQ_BASE + 30)
76#define PNX833X_PIC_SGDX_TPD_INT (PNX833X_PIC_IRQ_BASE + 31)
77#define PNX833X_PIC_USB_INT (PNX833X_PIC_IRQ_BASE + 32)
78#define PNX833X_PIC_TS_IN1_TRD_INT (PNX833X_PIC_IRQ_BASE + 33)
79#define PNX833X_PIC_CLOCK_INT (PNX833X_PIC_IRQ_BASE + 34)
80#define PNX833X_PIC_SGDX_PARSER_INT (PNX833X_PIC_IRQ_BASE + 35)
81#define PNX833X_PIC_VMSP_DMA_INT (PNX833X_PIC_IRQ_BASE + 36)
82
83#if defined(CONFIG_SOC_PNX8335)
84#define PNX8335_PIC_MIU_INT (PNX833X_PIC_IRQ_BASE + 37)
85#define PNX8335_PIC_AVCHIP_IRQ_INT (PNX833X_PIC_IRQ_BASE + 38)
86#define PNX8335_PIC_SYNC_HD_INT (PNX833X_PIC_IRQ_BASE + 39)
87#define PNX8335_PIC_DISP_HD_INT (PNX833X_PIC_IRQ_BASE + 40)
88#define PNX8335_PIC_DISP_SCALER_INT (PNX833X_PIC_IRQ_BASE + 41)
89#define PNX8335_PIC_OSD_HD1_INT (PNX833X_PIC_IRQ_BASE + 42)
90#define PNX8335_PIC_DTL_WRITER_Y_INT (PNX833X_PIC_IRQ_BASE + 43)
91#define PNX8335_PIC_DTL_WRITER_C_INT (PNX833X_PIC_IRQ_BASE + 44)
92#define PNX8335_PIC_DTL_EMULATOR_Y_IR_INT (PNX833X_PIC_IRQ_BASE + 45)
93#define PNX8335_PIC_DTL_EMULATOR_C_IR_INT (PNX833X_PIC_IRQ_BASE + 46)
94#define PNX8335_PIC_DENC_TTX_INT (PNX833X_PIC_IRQ_BASE + 47)
95#define PNX8335_PIC_MMI_SIF0_INT (PNX833X_PIC_IRQ_BASE + 48)
96#define PNX8335_PIC_MMI_SIF1_INT (PNX833X_PIC_IRQ_BASE + 49)
97#define PNX8335_PIC_MMI_CDMMU_INT (PNX833X_PIC_IRQ_BASE + 50)
98#define PNX8335_PIC_PIBCS_INT (PNX833X_PIC_IRQ_BASE + 51)
99#define PNX8335_PIC_ETHERNET_INT (PNX833X_PIC_IRQ_BASE + 52)
100#define PNX8335_PIC_VMSP1_0_INT (PNX833X_PIC_IRQ_BASE + 53)
101#define PNX8335_PIC_VMSP1_1_INT (PNX833X_PIC_IRQ_BASE + 54)
102#define PNX8335_PIC_VMSP1_DMA_INT (PNX833X_PIC_IRQ_BASE + 55)
103#define PNX8335_PIC_TDGR_DE_INT (PNX833X_PIC_IRQ_BASE + 56)
104#define PNX8335_PIC_IR1_IRQ_INT (PNX833X_PIC_IRQ_BASE + 57)
105#endif
106
107/* GPIO interrupts */
108#define PNX833X_GPIO_0_INT (PNX833X_GPIO_IRQ_BASE + 0)
109#define PNX833X_GPIO_1_INT (PNX833X_GPIO_IRQ_BASE + 1)
110#define PNX833X_GPIO_2_INT (PNX833X_GPIO_IRQ_BASE + 2)
111#define PNX833X_GPIO_3_INT (PNX833X_GPIO_IRQ_BASE + 3)
112#define PNX833X_GPIO_4_INT (PNX833X_GPIO_IRQ_BASE + 4)
113#define PNX833X_GPIO_5_INT (PNX833X_GPIO_IRQ_BASE + 5)
114#define PNX833X_GPIO_6_INT (PNX833X_GPIO_IRQ_BASE + 6)
115#define PNX833X_GPIO_7_INT (PNX833X_GPIO_IRQ_BASE + 7)
116#define PNX833X_GPIO_8_INT (PNX833X_GPIO_IRQ_BASE + 8)
117#define PNX833X_GPIO_9_INT (PNX833X_GPIO_IRQ_BASE + 9)
118#define PNX833X_GPIO_10_INT (PNX833X_GPIO_IRQ_BASE + 10)
119#define PNX833X_GPIO_11_INT (PNX833X_GPIO_IRQ_BASE + 11)
120#define PNX833X_GPIO_12_INT (PNX833X_GPIO_IRQ_BASE + 12)
121#define PNX833X_GPIO_13_INT (PNX833X_GPIO_IRQ_BASE + 13)
122#define PNX833X_GPIO_14_INT (PNX833X_GPIO_IRQ_BASE + 14)
123#define PNX833X_GPIO_15_INT (PNX833X_GPIO_IRQ_BASE + 15)
124
125#endif
126
diff --git a/arch/mips/include/asm/mach-pnx833x/irq.h b/arch/mips/include/asm/mach-pnx833x/irq.h
new file mode 100644
index 000000000000..745114b1d8d5
--- /dev/null
+++ b/arch/mips/include/asm/mach-pnx833x/irq.h
@@ -0,0 +1,53 @@
1/*
2 * irq.h: IRQ mappings for PNX833X.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef __ASM_MIPS_MACH_PNX833X_IRQ_H
24#define __ASM_MIPS_MACH_PNX833X_IRQ_H
25/*
26 * The "IRQ numbers" are completely virtual.
27 *
28 * In PNX8330/1, we have 48 interrupt lines, numbered from 1 to 48.
29 * Let's use numbers 1..48 for PIC interrupts, number 0 for timer interrupt,
30 * numbers 49..64 for (virtual) GPIO interrupts.
31 *
32 * In PNX8335, we have 57 interrupt lines, numbered from 1 to 57,
33 * connected to PIC, which uses core hardware interrupt 2, and also
34 * a timer interrupt through hardware interrupt 5.
35 * Let's use numbers 1..64 for PIC interrupts, number 0 for timer interrupt,
36 * numbers 65..80 for (virtual) GPIO interrupts.
37 *
38 */
39#if defined(CONFIG_SOC_PNX8335)
40 #define PNX833X_PIC_NUM_IRQ 58
41#else
42 #define PNX833X_PIC_NUM_IRQ 37
43#endif
44
45#define MIPS_CPU_NUM_IRQ 8
46#define PNX833X_GPIO_NUM_IRQ 16
47
48#define MIPS_CPU_IRQ_BASE 0
49#define PNX833X_PIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + MIPS_CPU_NUM_IRQ)
50#define PNX833X_GPIO_IRQ_BASE (PNX833X_PIC_IRQ_BASE + PNX833X_PIC_NUM_IRQ)
51#define NR_IRQS (MIPS_CPU_NUM_IRQ + PNX833X_PIC_NUM_IRQ + PNX833X_GPIO_NUM_IRQ)
52
53#endif
diff --git a/arch/mips/include/asm/mach-pnx833x/pnx833x.h b/arch/mips/include/asm/mach-pnx833x/pnx833x.h
new file mode 100644
index 000000000000..100f52870e3c
--- /dev/null
+++ b/arch/mips/include/asm/mach-pnx833x/pnx833x.h
@@ -0,0 +1,202 @@
1/*
2 * pnx833x.h: Register mappings for PNX833X.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#ifndef __ASM_MIPS_MACH_PNX833X_PNX833X_H
23#define __ASM_MIPS_MACH_PNX833X_PNX833X_H
24
25/* All regs are accessed in KSEG1 */
26#define PNX833X_BASE (0xa0000000ul + 0x17E00000ul)
27
28#define PNX833X_REG(offs) (*((volatile unsigned long *)(PNX833X_BASE + offs)))
29
30/* Registers are named exactly as in PNX833X docs, just with PNX833X_ prefix */
31
32/* Read access to multibit fields */
33#define PNX833X_BIT(val, reg, field) ((val) & PNX833X_##reg##_##field)
34#define PNX833X_REGBIT(reg, field) PNX833X_BIT(PNX833X_##reg, reg, field)
35
36/* Use PNX833X_FIELD to extract a field from val */
37#define PNX_FIELD(cpu, val, reg, field) \
38 (((val) & PNX##cpu##_##reg##_##field##_MASK) >> \
39 PNX##cpu##_##reg##_##field##_SHIFT)
40#define PNX833X_FIELD(val, reg, field) PNX_FIELD(833X, val, reg, field)
41#define PNX8330_FIELD(val, reg, field) PNX_FIELD(8330, val, reg, field)
42#define PNX8335_FIELD(val, reg, field) PNX_FIELD(8335, val, reg, field)
43
44/* Use PNX833X_REGFIELD to extract a field from a register */
45#define PNX833X_REGFIELD(reg, field) PNX833X_FIELD(PNX833X_##reg, reg, field)
46#define PNX8330_REGFIELD(reg, field) PNX8330_FIELD(PNX8330_##reg, reg, field)
47#define PNX8335_REGFIELD(reg, field) PNX8335_FIELD(PNX8335_##reg, reg, field)
48
49
50#define PNX_WRITEFIELD(cpu, val, reg, field) \
51 (PNX##cpu##_##reg = (PNX##cpu##_##reg & ~(PNX##cpu##_##reg##_##field##_MASK)) | \
52 ((val) << PNX##cpu##_##reg##_##field##_SHIFT))
53#define PNX833X_WRITEFIELD(val, reg, field) \
54 PNX_WRITEFIELD(833X, val, reg, field)
55#define PNX8330_WRITEFIELD(val, reg, field) \
56 PNX_WRITEFIELD(8330, val, reg, field)
57#define PNX8335_WRITEFIELD(val, reg, field) \
58 PNX_WRITEFIELD(8335, val, reg, field)
59
60
61/* Macros to detect CPU type */
62
63#define PNX833X_CONFIG_MODULE_ID PNX833X_REG(0x7FFC)
64#define PNX833X_CONFIG_MODULE_ID_MAJREV_MASK 0x0000f000
65#define PNX833X_CONFIG_MODULE_ID_MAJREV_SHIFT 12
66#define PNX8330_CONFIG_MODULE_MAJREV 4
67#define PNX8335_CONFIG_MODULE_MAJREV 5
68#define CPU_IS_PNX8330 (PNX833X_REGFIELD(CONFIG_MODULE_ID, MAJREV) == \
69 PNX8330_CONFIG_MODULE_MAJREV)
70#define CPU_IS_PNX8335 (PNX833X_REGFIELD(CONFIG_MODULE_ID, MAJREV) == \
71 PNX8335_CONFIG_MODULE_MAJREV)
72
73
74
75#define PNX833X_RESET_CONTROL PNX833X_REG(0x8004)
76#define PNX833X_RESET_CONTROL_2 PNX833X_REG(0x8014)
77
78#define PNX833X_PIC_REG(offs) PNX833X_REG(0x01000 + (offs))
79#define PNX833X_PIC_INT_PRIORITY PNX833X_PIC_REG(0x0)
80#define PNX833X_PIC_INT_SRC PNX833X_PIC_REG(0x4)
81#define PNX833X_PIC_INT_SRC_INT_SRC_MASK 0x00000FF8ul /* bits 11:3 */
82#define PNX833X_PIC_INT_SRC_INT_SRC_SHIFT 3
83#define PNX833X_PIC_INT_REG(irq) PNX833X_PIC_REG(0x10 + 4*(irq))
84
85#define PNX833X_CLOCK_CPUCP_CTL PNX833X_REG(0x9228)
86#define PNX833X_CLOCK_CPUCP_CTL_EXIT_RESET 0x00000002ul /* bit 1 */
87#define PNX833X_CLOCK_CPUCP_CTL_DIV_CLOCK_MASK 0x00000018ul /* bits 4:3 */
88#define PNX833X_CLOCK_CPUCP_CTL_DIV_CLOCK_SHIFT 3
89
90#define PNX8335_CLOCK_PLL_CPU_CTL PNX833X_REG(0x9020)
91#define PNX8335_CLOCK_PLL_CPU_CTL_FREQ_MASK 0x1f
92#define PNX8335_CLOCK_PLL_CPU_CTL_FREQ_SHIFT 0
93
94#define PNX833X_CONFIG_MUX PNX833X_REG(0x7004)
95#define PNX833X_CONFIG_MUX_IDE_MUX 0x00000080 /* bit 7 */
96
97#define PNX8330_CONFIG_POLYFUSE_7 PNX833X_REG(0x7040)
98#define PNX8330_CONFIG_POLYFUSE_7_BOOT_MODE_MASK 0x00180000
99#define PNX8330_CONFIG_POLYFUSE_7_BOOT_MODE_SHIFT 19
100
101#define PNX833X_PIO_IN PNX833X_REG(0xF000)
102#define PNX833X_PIO_OUT PNX833X_REG(0xF004)
103#define PNX833X_PIO_DIR PNX833X_REG(0xF008)
104#define PNX833X_PIO_SEL PNX833X_REG(0xF014)
105#define PNX833X_PIO_INT_EDGE PNX833X_REG(0xF020)
106#define PNX833X_PIO_INT_HI PNX833X_REG(0xF024)
107#define PNX833X_PIO_INT_LO PNX833X_REG(0xF028)
108#define PNX833X_PIO_INT_STATUS PNX833X_REG(0xFFE0)
109#define PNX833X_PIO_INT_ENABLE PNX833X_REG(0xFFE4)
110#define PNX833X_PIO_INT_CLEAR PNX833X_REG(0xFFE8)
111#define PNX833X_PIO_IN2 PNX833X_REG(0xF05C)
112#define PNX833X_PIO_OUT2 PNX833X_REG(0xF060)
113#define PNX833X_PIO_DIR2 PNX833X_REG(0xF064)
114#define PNX833X_PIO_SEL2 PNX833X_REG(0xF068)
115
116#define PNX833X_UART0_PORTS_START (PNX833X_BASE + 0xB000)
117#define PNX833X_UART0_PORTS_END (PNX833X_BASE + 0xBFFF)
118#define PNX833X_UART1_PORTS_START (PNX833X_BASE + 0xC000)
119#define PNX833X_UART1_PORTS_END (PNX833X_BASE + 0xCFFF)
120
121#define PNX833X_USB_PORTS_START (PNX833X_BASE + 0x19000)
122#define PNX833X_USB_PORTS_END (PNX833X_BASE + 0x19FFF)
123
124#define PNX833X_CONFIG_USB PNX833X_REG(0x7008)
125
126#define PNX833X_I2C0_PORTS_START (PNX833X_BASE + 0xD000)
127#define PNX833X_I2C0_PORTS_END (PNX833X_BASE + 0xDFFF)
128#define PNX833X_I2C1_PORTS_START (PNX833X_BASE + 0xE000)
129#define PNX833X_I2C1_PORTS_END (PNX833X_BASE + 0xEFFF)
130
131#define PNX833X_IDE_PORTS_START (PNX833X_BASE + 0x1A000)
132#define PNX833X_IDE_PORTS_END (PNX833X_BASE + 0x1AFFF)
133#define PNX833X_IDE_MODULE_ID PNX833X_REG(0x1AFFC)
134
135#define PNX833X_IDE_MODULE_ID_MODULE_ID_MASK 0xFFFF0000
136#define PNX833X_IDE_MODULE_ID_MODULE_ID_SHIFT 16
137#define PNX833X_IDE_MODULE_ID_VALUE 0xA009
138
139
140#define PNX833X_MIU_SEL0 PNX833X_REG(0x2004)
141#define PNX833X_MIU_SEL0_TIMING PNX833X_REG(0x2008)
142#define PNX833X_MIU_SEL1 PNX833X_REG(0x200C)
143#define PNX833X_MIU_SEL1_TIMING PNX833X_REG(0x2010)
144#define PNX833X_MIU_SEL2 PNX833X_REG(0x2014)
145#define PNX833X_MIU_SEL2_TIMING PNX833X_REG(0x2018)
146#define PNX833X_MIU_SEL3 PNX833X_REG(0x201C)
147#define PNX833X_MIU_SEL3_TIMING PNX833X_REG(0x2020)
148
149#define PNX833X_MIU_SEL0_SPI_MODE_ENABLE_MASK (1 << 14)
150#define PNX833X_MIU_SEL0_SPI_MODE_ENABLE_SHIFT 14
151
152#define PNX833X_MIU_SEL0_BURST_MODE_ENABLE_MASK (1 << 7)
153#define PNX833X_MIU_SEL0_BURST_MODE_ENABLE_SHIFT 7
154
155#define PNX833X_MIU_SEL0_BURST_PAGE_LEN_MASK (0xF << 9)
156#define PNX833X_MIU_SEL0_BURST_PAGE_LEN_SHIFT 9
157
158#define PNX833X_MIU_CONFIG_SPI PNX833X_REG(0x2000)
159
160#define PNX833X_MIU_CONFIG_SPI_OPCODE_MASK (0xFF << 3)
161#define PNX833X_MIU_CONFIG_SPI_OPCODE_SHIFT 3
162
163#define PNX833X_MIU_CONFIG_SPI_DATA_ENABLE_MASK (1 << 2)
164#define PNX833X_MIU_CONFIG_SPI_DATA_ENABLE_SHIFT 2
165
166#define PNX833X_MIU_CONFIG_SPI_ADDR_ENABLE_MASK (1 << 1)
167#define PNX833X_MIU_CONFIG_SPI_ADDR_ENABLE_SHIFT 1
168
169#define PNX833X_MIU_CONFIG_SPI_SYNC_MASK (1 << 0)
170#define PNX833X_MIU_CONFIG_SPI_SYNC_SHIFT 0
171
172#define PNX833X_WRITE_CONFIG_SPI(opcode, data_enable, addr_enable, sync) \
173 (PNX833X_MIU_CONFIG_SPI = \
174 ((opcode) << PNX833X_MIU_CONFIG_SPI_OPCODE_SHIFT) | \
175 ((data_enable) << PNX833X_MIU_CONFIG_SPI_DATA_ENABLE_SHIFT) | \
176 ((addr_enable) << PNX833X_MIU_CONFIG_SPI_ADDR_ENABLE_SHIFT) | \
177 ((sync) << PNX833X_MIU_CONFIG_SPI_SYNC_SHIFT))
178
179#define PNX8335_IP3902_PORTS_START (PNX833X_BASE + 0x2F000)
180#define PNX8335_IP3902_PORTS_END (PNX833X_BASE + 0x2FFFF)
181#define PNX8335_IP3902_MODULE_ID PNX833X_REG(0x2FFFC)
182
183#define PNX8335_IP3902_MODULE_ID_MODULE_ID_MASK 0xFFFF0000
184#define PNX8335_IP3902_MODULE_ID_MODULE_ID_SHIFT 16
185#define PNX8335_IP3902_MODULE_ID_VALUE 0x3902
186
187 /* I/O location(gets remapped)*/
188#define PNX8335_NAND_BASE 0x18000000
189/* I/O location with CLE high */
190#define PNX8335_NAND_CLE_MASK 0x00100000
191/* I/O location with ALE high */
192#define PNX8335_NAND_ALE_MASK 0x00010000
193
194#define PNX8335_SATA_PORTS_START (PNX833X_BASE + 0x2E000)
195#define PNX8335_SATA_PORTS_END (PNX833X_BASE + 0x2EFFF)
196#define PNX8335_SATA_MODULE_ID PNX833X_REG(0x2EFFC)
197
198#define PNX8335_SATA_MODULE_ID_MODULE_ID_MASK 0xFFFF0000
199#define PNX8335_SATA_MODULE_ID_MODULE_ID_SHIFT 16
200#define PNX8335_SATA_MODULE_ID_VALUE 0xA099
201
202#endif
diff --git a/arch/mips/include/asm/mach-pnx833x/war.h b/arch/mips/include/asm/mach-pnx833x/war.h
new file mode 100644
index 000000000000..82cd1e97bc2e
--- /dev/null
+++ b/arch/mips/include/asm/mach-pnx833x/war.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_PNX833X_WAR_H
9#define __ASM_MIPS_MACH_PNX833X_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_PNX8550_WAR_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/mangle-port.h b/arch/mips/include/asm/mach-tx49xx/mangle-port.h
new file mode 100644
index 000000000000..5e6912fdd0ed
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/mangle-port.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_MACH_TX49XX_MANGLE_PORT_H
2#define __ASM_MACH_TX49XX_MANGLE_PORT_H
3
4#define __swizzle_addr_b(port) (port)
5#define __swizzle_addr_w(port) (port)
6#define __swizzle_addr_l(port) (port)
7#define __swizzle_addr_q(port) (port)
8
9#define ioswabb(a, x) (x)
10#define __mem_ioswabb(a, x) (x)
11#if defined(CONFIG_TOSHIBA_RBTX4939) && \
12 (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) && \
13 defined(__BIG_ENDIAN)
14#define NEEDS_TXX9_IOSWABW
15extern u16 (*ioswabw)(volatile u16 *a, u16 x);
16extern u16 (*__mem_ioswabw)(volatile u16 *a, u16 x);
17#else
18#define ioswabw(a, x) le16_to_cpu(x)
19#define __mem_ioswabw(a, x) (x)
20#endif
21#define ioswabl(a, x) le32_to_cpu(x)
22#define __mem_ioswabl(a, x) (x)
23#define ioswabq(a, x) le64_to_cpu(x)
24#define __mem_ioswabq(a, x) (x)
25
26#endif /* __ASM_MACH_TX49XX_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 979866000da4..9316324d070d 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -192,6 +192,7 @@
192#define PM_16M 0x01ffe000 192#define PM_16M 0x01ffe000
193#define PM_64M 0x07ffe000 193#define PM_64M 0x07ffe000
194#define PM_256M 0x1fffe000 194#define PM_256M 0x1fffe000
195#define PM_1G 0x7fffe000
195 196
196#endif 197#endif
197 198
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h
index de6d09ebbd80..e2e09b2cd265 100644
--- a/arch/mips/include/asm/module.h
+++ b/arch/mips/include/asm/module.h
@@ -98,6 +98,8 @@ search_module_dbetables(unsigned long addr)
98#define MODULE_PROC_FAMILY "R5000 " 98#define MODULE_PROC_FAMILY "R5000 "
99#elif defined CONFIG_CPU_R5432 99#elif defined CONFIG_CPU_R5432
100#define MODULE_PROC_FAMILY "R5432 " 100#define MODULE_PROC_FAMILY "R5432 "
101#elif defined CONFIG_CPU_R5500
102#define MODULE_PROC_FAMILY "R5500 "
101#elif defined CONFIG_CPU_R6000 103#elif defined CONFIG_CPU_R6000
102#define MODULE_PROC_FAMILY "R6000 " 104#define MODULE_PROC_FAMILY "R6000 "
103#elif defined CONFIG_CPU_NEVADA 105#elif defined CONFIG_CPU_NEVADA
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index 9c22571b160d..813abd16255d 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -80,25 +80,25 @@ enum pt_watch_style {
80 pt_watch_style_mips64 80 pt_watch_style_mips64
81}; 81};
82struct mips32_watch_regs { 82struct mips32_watch_regs {
83 uint32_t watchlo[8]; 83 unsigned int watchlo[8];
84 /* Lower 16 bits of watchhi. */ 84 /* Lower 16 bits of watchhi. */
85 uint16_t watchhi[8]; 85 unsigned short watchhi[8];
86 /* Valid mask and I R W bits. 86 /* Valid mask and I R W bits.
87 * bit 0 -- 1 if W bit is usable. 87 * bit 0 -- 1 if W bit is usable.
88 * bit 1 -- 1 if R bit is usable. 88 * bit 1 -- 1 if R bit is usable.
89 * bit 2 -- 1 if I bit is usable. 89 * bit 2 -- 1 if I bit is usable.
90 * bits 3 - 11 -- Valid watchhi mask bits. 90 * bits 3 - 11 -- Valid watchhi mask bits.
91 */ 91 */
92 uint16_t watch_masks[8]; 92 unsigned short watch_masks[8];
93 /* The number of valid watch register pairs. */ 93 /* The number of valid watch register pairs. */
94 uint32_t num_valid; 94 unsigned int num_valid;
95} __attribute__((aligned(8))); 95} __attribute__((aligned(8)));
96 96
97struct mips64_watch_regs { 97struct mips64_watch_regs {
98 uint64_t watchlo[8]; 98 unsigned long long watchlo[8];
99 uint16_t watchhi[8]; 99 unsigned short watchhi[8];
100 uint16_t watch_masks[8]; 100 unsigned short watch_masks[8];
101 uint32_t num_valid; 101 unsigned int num_valid;
102} __attribute__((aligned(8))); 102} __attribute__((aligned(8)));
103 103
104struct pt_watch_regs { 104struct pt_watch_regs {
@@ -116,6 +116,7 @@ struct pt_watch_regs {
116 116
117#include <linux/compiler.h> 117#include <linux/compiler.h>
118#include <linux/linkage.h> 118#include <linux/linkage.h>
119#include <linux/types.h>
119#include <asm/isadep.h> 120#include <asm/isadep.h>
120 121
121struct task_struct; 122struct task_struct;
diff --git a/arch/mips/include/asm/txx9/generic.h b/arch/mips/include/asm/txx9/generic.h
index 4316a3e57678..9cde0090cbf6 100644
--- a/arch/mips/include/asm/txx9/generic.h
+++ b/arch/mips/include/asm/txx9/generic.h
@@ -86,4 +86,9 @@ void txx9_iocled_init(unsigned long baseaddr,
86 int basenum, unsigned int num, int lowactive, 86 int basenum, unsigned int num, int lowactive,
87 const char *color, char **deftriggers); 87 const char *color, char **deftriggers);
88 88
89/* 7SEG LED */
90void txx9_7segled_init(unsigned int num,
91 void (*putc)(unsigned int pos, unsigned char val));
92int txx9_7segled_putc(unsigned int pos, char c);
93
89#endif /* __ASM_TXX9_GENERIC_H */ 94#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index d9da7112aaf8..b1372c27f136 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_CPU_R4X00) += r4k_fpu.o r4k_switch.o
33obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o 33obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o
34obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o 34obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o
35obj-$(CONFIG_CPU_R5432) += r4k_fpu.o r4k_switch.o 35obj-$(CONFIG_CPU_R5432) += r4k_fpu.o r4k_switch.o
36obj-$(CONFIG_CPU_R5500) += r4k_fpu.o r4k_switch.o
36obj-$(CONFIG_CPU_R8000) += r4k_fpu.o r4k_switch.o 37obj-$(CONFIG_CPU_R8000) += r4k_fpu.o r4k_switch.o
37obj-$(CONFIG_CPU_RM7000) += r4k_fpu.o r4k_switch.o 38obj-$(CONFIG_CPU_RM7000) += r4k_fpu.o r4k_switch.o
38obj-$(CONFIG_CPU_RM9000) += r4k_fpu.o r4k_switch.o 39obj-$(CONFIG_CPU_RM9000) += r4k_fpu.o r4k_switch.o
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 0cf15457ecac..c9207b5fd923 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -286,11 +286,12 @@ static inline int __cpu_has_fpu(void)
286#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ 286#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
287 | MIPS_CPU_COUNTER) 287 | MIPS_CPU_COUNTER)
288 288
289static inline void cpu_probe_legacy(struct cpuinfo_mips *c) 289static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
290{ 290{
291 switch (c->processor_id & 0xff00) { 291 switch (c->processor_id & 0xff00) {
292 case PRID_IMP_R2000: 292 case PRID_IMP_R2000:
293 c->cputype = CPU_R2000; 293 c->cputype = CPU_R2000;
294 __cpu_name[cpu] = "R2000";
294 c->isa_level = MIPS_CPU_ISA_I; 295 c->isa_level = MIPS_CPU_ISA_I;
295 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 296 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
296 MIPS_CPU_NOFPUEX; 297 MIPS_CPU_NOFPUEX;
@@ -299,13 +300,19 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
299 c->tlbsize = 64; 300 c->tlbsize = 64;
300 break; 301 break;
301 case PRID_IMP_R3000: 302 case PRID_IMP_R3000:
302 if ((c->processor_id & 0xff) == PRID_REV_R3000A) 303 if ((c->processor_id & 0xff) == PRID_REV_R3000A) {
303 if (cpu_has_confreg()) 304 if (cpu_has_confreg()) {
304 c->cputype = CPU_R3081E; 305 c->cputype = CPU_R3081E;
305 else 306 __cpu_name[cpu] = "R3081";
307 } else {
306 c->cputype = CPU_R3000A; 308 c->cputype = CPU_R3000A;
307 else 309 __cpu_name[cpu] = "R3000A";
310 }
311 break;
312 } else {
308 c->cputype = CPU_R3000; 313 c->cputype = CPU_R3000;
314 __cpu_name[cpu] = "R3000";
315 }
309 c->isa_level = MIPS_CPU_ISA_I; 316 c->isa_level = MIPS_CPU_ISA_I;
310 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 317 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
311 MIPS_CPU_NOFPUEX; 318 MIPS_CPU_NOFPUEX;
@@ -315,15 +322,21 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
315 break; 322 break;
316 case PRID_IMP_R4000: 323 case PRID_IMP_R4000:
317 if (read_c0_config() & CONF_SC) { 324 if (read_c0_config() & CONF_SC) {
318 if ((c->processor_id & 0xff) >= PRID_REV_R4400) 325 if ((c->processor_id & 0xff) >= PRID_REV_R4400) {
319 c->cputype = CPU_R4400PC; 326 c->cputype = CPU_R4400PC;
320 else 327 __cpu_name[cpu] = "R4400PC";
328 } else {
321 c->cputype = CPU_R4000PC; 329 c->cputype = CPU_R4000PC;
330 __cpu_name[cpu] = "R4000PC";
331 }
322 } else { 332 } else {
323 if ((c->processor_id & 0xff) >= PRID_REV_R4400) 333 if ((c->processor_id & 0xff) >= PRID_REV_R4400) {
324 c->cputype = CPU_R4400SC; 334 c->cputype = CPU_R4400SC;
325 else 335 __cpu_name[cpu] = "R4400SC";
336 } else {
326 c->cputype = CPU_R4000SC; 337 c->cputype = CPU_R4000SC;
338 __cpu_name[cpu] = "R4000SC";
339 }
327 } 340 }
328 341
329 c->isa_level = MIPS_CPU_ISA_III; 342 c->isa_level = MIPS_CPU_ISA_III;
@@ -336,25 +349,34 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
336 switch (c->processor_id & 0xf0) { 349 switch (c->processor_id & 0xf0) {
337 case PRID_REV_VR4111: 350 case PRID_REV_VR4111:
338 c->cputype = CPU_VR4111; 351 c->cputype = CPU_VR4111;
352 __cpu_name[cpu] = "NEC VR4111";
339 break; 353 break;
340 case PRID_REV_VR4121: 354 case PRID_REV_VR4121:
341 c->cputype = CPU_VR4121; 355 c->cputype = CPU_VR4121;
356 __cpu_name[cpu] = "NEC VR4121";
342 break; 357 break;
343 case PRID_REV_VR4122: 358 case PRID_REV_VR4122:
344 if ((c->processor_id & 0xf) < 0x3) 359 if ((c->processor_id & 0xf) < 0x3) {
345 c->cputype = CPU_VR4122; 360 c->cputype = CPU_VR4122;
346 else 361 __cpu_name[cpu] = "NEC VR4122";
362 } else {
347 c->cputype = CPU_VR4181A; 363 c->cputype = CPU_VR4181A;
364 __cpu_name[cpu] = "NEC VR4181A";
365 }
348 break; 366 break;
349 case PRID_REV_VR4130: 367 case PRID_REV_VR4130:
350 if ((c->processor_id & 0xf) < 0x4) 368 if ((c->processor_id & 0xf) < 0x4) {
351 c->cputype = CPU_VR4131; 369 c->cputype = CPU_VR4131;
352 else 370 __cpu_name[cpu] = "NEC VR4131";
371 } else {
353 c->cputype = CPU_VR4133; 372 c->cputype = CPU_VR4133;
373 __cpu_name[cpu] = "NEC VR4133";
374 }
354 break; 375 break;
355 default: 376 default:
356 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n"); 377 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
357 c->cputype = CPU_VR41XX; 378 c->cputype = CPU_VR41XX;
379 __cpu_name[cpu] = "NEC Vr41xx";
358 break; 380 break;
359 } 381 }
360 c->isa_level = MIPS_CPU_ISA_III; 382 c->isa_level = MIPS_CPU_ISA_III;
@@ -363,6 +385,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
363 break; 385 break;
364 case PRID_IMP_R4300: 386 case PRID_IMP_R4300:
365 c->cputype = CPU_R4300; 387 c->cputype = CPU_R4300;
388 __cpu_name[cpu] = "R4300";
366 c->isa_level = MIPS_CPU_ISA_III; 389 c->isa_level = MIPS_CPU_ISA_III;
367 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 390 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
368 MIPS_CPU_LLSC; 391 MIPS_CPU_LLSC;
@@ -370,6 +393,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
370 break; 393 break;
371 case PRID_IMP_R4600: 394 case PRID_IMP_R4600:
372 c->cputype = CPU_R4600; 395 c->cputype = CPU_R4600;
396 __cpu_name[cpu] = "R4600";
373 c->isa_level = MIPS_CPU_ISA_III; 397 c->isa_level = MIPS_CPU_ISA_III;
374 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 398 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
375 MIPS_CPU_LLSC; 399 MIPS_CPU_LLSC;
@@ -384,6 +408,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
384 * it's c0_prid id number with the TX3900. 408 * it's c0_prid id number with the TX3900.
385 */ 409 */
386 c->cputype = CPU_R4650; 410 c->cputype = CPU_R4650;
411 __cpu_name[cpu] = "R4650";
387 c->isa_level = MIPS_CPU_ISA_III; 412 c->isa_level = MIPS_CPU_ISA_III;
388 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; 413 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
389 c->tlbsize = 48; 414 c->tlbsize = 48;
@@ -395,25 +420,26 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
395 420
396 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { 421 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
397 c->cputype = CPU_TX3927; 422 c->cputype = CPU_TX3927;
423 __cpu_name[cpu] = "TX3927";
398 c->tlbsize = 64; 424 c->tlbsize = 64;
399 } else { 425 } else {
400 switch (c->processor_id & 0xff) { 426 switch (c->processor_id & 0xff) {
401 case PRID_REV_TX3912: 427 case PRID_REV_TX3912:
402 c->cputype = CPU_TX3912; 428 c->cputype = CPU_TX3912;
429 __cpu_name[cpu] = "TX3912";
403 c->tlbsize = 32; 430 c->tlbsize = 32;
404 break; 431 break;
405 case PRID_REV_TX3922: 432 case PRID_REV_TX3922:
406 c->cputype = CPU_TX3922; 433 c->cputype = CPU_TX3922;
434 __cpu_name[cpu] = "TX3922";
407 c->tlbsize = 64; 435 c->tlbsize = 64;
408 break; 436 break;
409 default:
410 c->cputype = CPU_UNKNOWN;
411 break;
412 } 437 }
413 } 438 }
414 break; 439 break;
415 case PRID_IMP_R4700: 440 case PRID_IMP_R4700:
416 c->cputype = CPU_R4700; 441 c->cputype = CPU_R4700;
442 __cpu_name[cpu] = "R4700";
417 c->isa_level = MIPS_CPU_ISA_III; 443 c->isa_level = MIPS_CPU_ISA_III;
418 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 444 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
419 MIPS_CPU_LLSC; 445 MIPS_CPU_LLSC;
@@ -421,6 +447,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
421 break; 447 break;
422 case PRID_IMP_TX49: 448 case PRID_IMP_TX49:
423 c->cputype = CPU_TX49XX; 449 c->cputype = CPU_TX49XX;
450 __cpu_name[cpu] = "R49XX";
424 c->isa_level = MIPS_CPU_ISA_III; 451 c->isa_level = MIPS_CPU_ISA_III;
425 c->options = R4K_OPTS | MIPS_CPU_LLSC; 452 c->options = R4K_OPTS | MIPS_CPU_LLSC;
426 if (!(c->processor_id & 0x08)) 453 if (!(c->processor_id & 0x08))
@@ -429,6 +456,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
429 break; 456 break;
430 case PRID_IMP_R5000: 457 case PRID_IMP_R5000:
431 c->cputype = CPU_R5000; 458 c->cputype = CPU_R5000;
459 __cpu_name[cpu] = "R5000";
432 c->isa_level = MIPS_CPU_ISA_IV; 460 c->isa_level = MIPS_CPU_ISA_IV;
433 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 461 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
434 MIPS_CPU_LLSC; 462 MIPS_CPU_LLSC;
@@ -436,6 +464,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
436 break; 464 break;
437 case PRID_IMP_R5432: 465 case PRID_IMP_R5432:
438 c->cputype = CPU_R5432; 466 c->cputype = CPU_R5432;
467 __cpu_name[cpu] = "R5432";
439 c->isa_level = MIPS_CPU_ISA_IV; 468 c->isa_level = MIPS_CPU_ISA_IV;
440 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 469 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
441 MIPS_CPU_WATCH | MIPS_CPU_LLSC; 470 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
@@ -443,6 +472,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
443 break; 472 break;
444 case PRID_IMP_R5500: 473 case PRID_IMP_R5500:
445 c->cputype = CPU_R5500; 474 c->cputype = CPU_R5500;
475 __cpu_name[cpu] = "R5500";
446 c->isa_level = MIPS_CPU_ISA_IV; 476 c->isa_level = MIPS_CPU_ISA_IV;
447 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 477 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
448 MIPS_CPU_WATCH | MIPS_CPU_LLSC; 478 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
@@ -450,6 +480,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
450 break; 480 break;
451 case PRID_IMP_NEVADA: 481 case PRID_IMP_NEVADA:
452 c->cputype = CPU_NEVADA; 482 c->cputype = CPU_NEVADA;
483 __cpu_name[cpu] = "Nevada";
453 c->isa_level = MIPS_CPU_ISA_IV; 484 c->isa_level = MIPS_CPU_ISA_IV;
454 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 485 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
455 MIPS_CPU_DIVEC | MIPS_CPU_LLSC; 486 MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
@@ -457,6 +488,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
457 break; 488 break;
458 case PRID_IMP_R6000: 489 case PRID_IMP_R6000:
459 c->cputype = CPU_R6000; 490 c->cputype = CPU_R6000;
491 __cpu_name[cpu] = "R6000";
460 c->isa_level = MIPS_CPU_ISA_II; 492 c->isa_level = MIPS_CPU_ISA_II;
461 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | 493 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
462 MIPS_CPU_LLSC; 494 MIPS_CPU_LLSC;
@@ -464,6 +496,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
464 break; 496 break;
465 case PRID_IMP_R6000A: 497 case PRID_IMP_R6000A:
466 c->cputype = CPU_R6000A; 498 c->cputype = CPU_R6000A;
499 __cpu_name[cpu] = "R6000A";
467 c->isa_level = MIPS_CPU_ISA_II; 500 c->isa_level = MIPS_CPU_ISA_II;
468 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | 501 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
469 MIPS_CPU_LLSC; 502 MIPS_CPU_LLSC;
@@ -471,6 +504,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
471 break; 504 break;
472 case PRID_IMP_RM7000: 505 case PRID_IMP_RM7000:
473 c->cputype = CPU_RM7000; 506 c->cputype = CPU_RM7000;
507 __cpu_name[cpu] = "RM7000";
474 c->isa_level = MIPS_CPU_ISA_IV; 508 c->isa_level = MIPS_CPU_ISA_IV;
475 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 509 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
476 MIPS_CPU_LLSC; 510 MIPS_CPU_LLSC;
@@ -486,6 +520,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
486 break; 520 break;
487 case PRID_IMP_RM9000: 521 case PRID_IMP_RM9000:
488 c->cputype = CPU_RM9000; 522 c->cputype = CPU_RM9000;
523 __cpu_name[cpu] = "RM9000";
489 c->isa_level = MIPS_CPU_ISA_IV; 524 c->isa_level = MIPS_CPU_ISA_IV;
490 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 525 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
491 MIPS_CPU_LLSC; 526 MIPS_CPU_LLSC;
@@ -500,6 +535,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
500 break; 535 break;
501 case PRID_IMP_R8000: 536 case PRID_IMP_R8000:
502 c->cputype = CPU_R8000; 537 c->cputype = CPU_R8000;
538 __cpu_name[cpu] = "RM8000";
503 c->isa_level = MIPS_CPU_ISA_IV; 539 c->isa_level = MIPS_CPU_ISA_IV;
504 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 540 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
505 MIPS_CPU_FPU | MIPS_CPU_32FPR | 541 MIPS_CPU_FPU | MIPS_CPU_32FPR |
@@ -508,6 +544,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
508 break; 544 break;
509 case PRID_IMP_R10000: 545 case PRID_IMP_R10000:
510 c->cputype = CPU_R10000; 546 c->cputype = CPU_R10000;
547 __cpu_name[cpu] = "R10000";
511 c->isa_level = MIPS_CPU_ISA_IV; 548 c->isa_level = MIPS_CPU_ISA_IV;
512 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 549 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
513 MIPS_CPU_FPU | MIPS_CPU_32FPR | 550 MIPS_CPU_FPU | MIPS_CPU_32FPR |
@@ -517,6 +554,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
517 break; 554 break;
518 case PRID_IMP_R12000: 555 case PRID_IMP_R12000:
519 c->cputype = CPU_R12000; 556 c->cputype = CPU_R12000;
557 __cpu_name[cpu] = "R12000";
520 c->isa_level = MIPS_CPU_ISA_IV; 558 c->isa_level = MIPS_CPU_ISA_IV;
521 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 559 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
522 MIPS_CPU_FPU | MIPS_CPU_32FPR | 560 MIPS_CPU_FPU | MIPS_CPU_32FPR |
@@ -526,6 +564,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
526 break; 564 break;
527 case PRID_IMP_R14000: 565 case PRID_IMP_R14000:
528 c->cputype = CPU_R14000; 566 c->cputype = CPU_R14000;
567 __cpu_name[cpu] = "R14000";
529 c->isa_level = MIPS_CPU_ISA_IV; 568 c->isa_level = MIPS_CPU_ISA_IV;
530 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 569 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
531 MIPS_CPU_FPU | MIPS_CPU_32FPR | 570 MIPS_CPU_FPU | MIPS_CPU_32FPR |
@@ -535,6 +574,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
535 break; 574 break;
536 case PRID_IMP_LOONGSON2: 575 case PRID_IMP_LOONGSON2:
537 c->cputype = CPU_LOONGSON2; 576 c->cputype = CPU_LOONGSON2;
577 __cpu_name[cpu] = "ICT Loongson-2";
538 c->isa_level = MIPS_CPU_ISA_III; 578 c->isa_level = MIPS_CPU_ISA_III;
539 c->options = R4K_OPTS | 579 c->options = R4K_OPTS |
540 MIPS_CPU_FPU | MIPS_CPU_LLSC | 580 MIPS_CPU_FPU | MIPS_CPU_LLSC |
@@ -652,21 +692,24 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
652 692
653static void __cpuinit decode_configs(struct cpuinfo_mips *c) 693static void __cpuinit decode_configs(struct cpuinfo_mips *c)
654{ 694{
695 int ok;
696
655 /* MIPS32 or MIPS64 compliant CPU. */ 697 /* MIPS32 or MIPS64 compliant CPU. */
656 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | 698 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
657 MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; 699 MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
658 700
659 c->scache.flags = MIPS_CACHE_NOT_PRESENT; 701 c->scache.flags = MIPS_CACHE_NOT_PRESENT;
660 702
661 /* Read Config registers. */ 703 ok = decode_config0(c); /* Read Config registers. */
662 if (!decode_config0(c)) 704 BUG_ON(!ok); /* Arch spec violation! */
663 return; /* actually worth a panic() */ 705 if (ok)
664 if (!decode_config1(c)) 706 ok = decode_config1(c);
665 return; 707 if (ok)
666 if (!decode_config2(c)) 708 ok = decode_config2(c);
667 return; 709 if (ok)
668 if (!decode_config3(c)) 710 ok = decode_config3(c);
669 return; 711
712 mips_probe_watch_registers(c);
670} 713}
671 714
672#ifdef CONFIG_CPU_MIPSR2 715#ifdef CONFIG_CPU_MIPSR2
@@ -675,52 +718,62 @@ extern void spram_config(void);
675static inline void spram_config(void) {} 718static inline void spram_config(void) {}
676#endif 719#endif
677 720
678static inline void cpu_probe_mips(struct cpuinfo_mips *c) 721static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
679{ 722{
680 decode_configs(c); 723 decode_configs(c);
681 mips_probe_watch_registers(c);
682 switch (c->processor_id & 0xff00) { 724 switch (c->processor_id & 0xff00) {
683 case PRID_IMP_4KC: 725 case PRID_IMP_4KC:
684 c->cputype = CPU_4KC; 726 c->cputype = CPU_4KC;
727 __cpu_name[cpu] = "MIPS 4Kc";
685 break; 728 break;
686 case PRID_IMP_4KEC: 729 case PRID_IMP_4KEC:
687 c->cputype = CPU_4KEC; 730 c->cputype = CPU_4KEC;
731 __cpu_name[cpu] = "MIPS 4KEc";
688 break; 732 break;
689 case PRID_IMP_4KECR2: 733 case PRID_IMP_4KECR2:
690 c->cputype = CPU_4KEC; 734 c->cputype = CPU_4KEC;
735 __cpu_name[cpu] = "MIPS 4KEc";
691 break; 736 break;
692 case PRID_IMP_4KSC: 737 case PRID_IMP_4KSC:
693 case PRID_IMP_4KSD: 738 case PRID_IMP_4KSD:
694 c->cputype = CPU_4KSC; 739 c->cputype = CPU_4KSC;
740 __cpu_name[cpu] = "MIPS 4KSc";
695 break; 741 break;
696 case PRID_IMP_5KC: 742 case PRID_IMP_5KC:
697 c->cputype = CPU_5KC; 743 c->cputype = CPU_5KC;
744 __cpu_name[cpu] = "MIPS 5Kc";
698 break; 745 break;
699 case PRID_IMP_20KC: 746 case PRID_IMP_20KC:
700 c->cputype = CPU_20KC; 747 c->cputype = CPU_20KC;
748 __cpu_name[cpu] = "MIPS 20Kc";
701 break; 749 break;
702 case PRID_IMP_24K: 750 case PRID_IMP_24K:
703 case PRID_IMP_24KE: 751 case PRID_IMP_24KE:
704 c->cputype = CPU_24K; 752 c->cputype = CPU_24K;
753 __cpu_name[cpu] = "MIPS 24Kc";
705 break; 754 break;
706 case PRID_IMP_25KF: 755 case PRID_IMP_25KF:
707 c->cputype = CPU_25KF; 756 c->cputype = CPU_25KF;
757 __cpu_name[cpu] = "MIPS 25Kc";
708 break; 758 break;
709 case PRID_IMP_34K: 759 case PRID_IMP_34K:
710 c->cputype = CPU_34K; 760 c->cputype = CPU_34K;
761 __cpu_name[cpu] = "MIPS 34Kc";
711 break; 762 break;
712 case PRID_IMP_74K: 763 case PRID_IMP_74K:
713 c->cputype = CPU_74K; 764 c->cputype = CPU_74K;
765 __cpu_name[cpu] = "MIPS 74Kc";
714 break; 766 break;
715 case PRID_IMP_1004K: 767 case PRID_IMP_1004K:
716 c->cputype = CPU_1004K; 768 c->cputype = CPU_1004K;
769 __cpu_name[cpu] = "MIPS 1004Kc";
717 break; 770 break;
718 } 771 }
719 772
720 spram_config(); 773 spram_config();
721} 774}
722 775
723static inline void cpu_probe_alchemy(struct cpuinfo_mips *c) 776static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
724{ 777{
725 decode_configs(c); 778 decode_configs(c);
726 switch (c->processor_id & 0xff00) { 779 switch (c->processor_id & 0xff00) {
@@ -729,23 +782,31 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
729 switch ((c->processor_id >> 24) & 0xff) { 782 switch ((c->processor_id >> 24) & 0xff) {
730 case 0: 783 case 0:
731 c->cputype = CPU_AU1000; 784 c->cputype = CPU_AU1000;
785 __cpu_name[cpu] = "Au1000";
732 break; 786 break;
733 case 1: 787 case 1:
734 c->cputype = CPU_AU1500; 788 c->cputype = CPU_AU1500;
789 __cpu_name[cpu] = "Au1500";
735 break; 790 break;
736 case 2: 791 case 2:
737 c->cputype = CPU_AU1100; 792 c->cputype = CPU_AU1100;
793 __cpu_name[cpu] = "Au1100";
738 break; 794 break;
739 case 3: 795 case 3:
740 c->cputype = CPU_AU1550; 796 c->cputype = CPU_AU1550;
797 __cpu_name[cpu] = "Au1550";
741 break; 798 break;
742 case 4: 799 case 4:
743 c->cputype = CPU_AU1200; 800 c->cputype = CPU_AU1200;
744 if (2 == (c->processor_id & 0xff)) 801 __cpu_name[cpu] = "Au1200";
802 if ((c->processor_id & 0xff) == 2) {
745 c->cputype = CPU_AU1250; 803 c->cputype = CPU_AU1250;
804 __cpu_name[cpu] = "Au1250";
805 }
746 break; 806 break;
747 case 5: 807 case 5:
748 c->cputype = CPU_AU1210; 808 c->cputype = CPU_AU1210;
809 __cpu_name[cpu] = "Au1210";
749 break; 810 break;
750 default: 811 default:
751 panic("Unknown Au Core!"); 812 panic("Unknown Au Core!");
@@ -755,154 +816,67 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
755 } 816 }
756} 817}
757 818
758static inline void cpu_probe_sibyte(struct cpuinfo_mips *c) 819static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
759{ 820{
760 decode_configs(c); 821 decode_configs(c);
761 822
762 switch (c->processor_id & 0xff00) { 823 switch (c->processor_id & 0xff00) {
763 case PRID_IMP_SB1: 824 case PRID_IMP_SB1:
764 c->cputype = CPU_SB1; 825 c->cputype = CPU_SB1;
826 __cpu_name[cpu] = "SiByte SB1";
765 /* FPU in pass1 is known to have issues. */ 827 /* FPU in pass1 is known to have issues. */
766 if ((c->processor_id & 0xff) < 0x02) 828 if ((c->processor_id & 0xff) < 0x02)
767 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); 829 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
768 break; 830 break;
769 case PRID_IMP_SB1A: 831 case PRID_IMP_SB1A:
770 c->cputype = CPU_SB1A; 832 c->cputype = CPU_SB1A;
833 __cpu_name[cpu] = "SiByte SB1A";
771 break; 834 break;
772 } 835 }
773} 836}
774 837
775static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c) 838static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
776{ 839{
777 decode_configs(c); 840 decode_configs(c);
778 switch (c->processor_id & 0xff00) { 841 switch (c->processor_id & 0xff00) {
779 case PRID_IMP_SR71000: 842 case PRID_IMP_SR71000:
780 c->cputype = CPU_SR71000; 843 c->cputype = CPU_SR71000;
844 __cpu_name[cpu] = "Sandcraft SR71000";
781 c->scache.ways = 8; 845 c->scache.ways = 8;
782 c->tlbsize = 64; 846 c->tlbsize = 64;
783 break; 847 break;
784 } 848 }
785} 849}
786 850
787static inline void cpu_probe_nxp(struct cpuinfo_mips *c) 851static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
788{ 852{
789 decode_configs(c); 853 decode_configs(c);
790 switch (c->processor_id & 0xff00) { 854 switch (c->processor_id & 0xff00) {
791 case PRID_IMP_PR4450: 855 case PRID_IMP_PR4450:
792 c->cputype = CPU_PR4450; 856 c->cputype = CPU_PR4450;
857 __cpu_name[cpu] = "Philips PR4450";
793 c->isa_level = MIPS_CPU_ISA_M32R1; 858 c->isa_level = MIPS_CPU_ISA_M32R1;
794 break; 859 break;
795 default:
796 panic("Unknown NXP Core!"); /* REVISIT: die? */
797 break;
798 } 860 }
799} 861}
800 862
801 863static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
802static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
803{ 864{
804 decode_configs(c); 865 decode_configs(c);
805 switch (c->processor_id & 0xff00) { 866 switch (c->processor_id & 0xff00) {
806 case PRID_IMP_BCM3302: 867 case PRID_IMP_BCM3302:
807 c->cputype = CPU_BCM3302; 868 c->cputype = CPU_BCM3302;
869 __cpu_name[cpu] = "Broadcom BCM3302";
808 break; 870 break;
809 case PRID_IMP_BCM4710: 871 case PRID_IMP_BCM4710:
810 c->cputype = CPU_BCM4710; 872 c->cputype = CPU_BCM4710;
811 break; 873 __cpu_name[cpu] = "Broadcom BCM4710";
812 default:
813 c->cputype = CPU_UNKNOWN;
814 break; 874 break;
815 } 875 }
816} 876}
817 877
818const char *__cpu_name[NR_CPUS]; 878const char *__cpu_name[NR_CPUS];
819 879
820/*
821 * Name a CPU
822 */
823static __cpuinit const char *cpu_to_name(struct cpuinfo_mips *c)
824{
825 const char *name = NULL;
826
827 switch (c->cputype) {
828 case CPU_UNKNOWN: name = "unknown"; break;
829 case CPU_R2000: name = "R2000"; break;
830 case CPU_R3000: name = "R3000"; break;
831 case CPU_R3000A: name = "R3000A"; break;
832 case CPU_R3041: name = "R3041"; break;
833 case CPU_R3051: name = "R3051"; break;
834 case CPU_R3052: name = "R3052"; break;
835 case CPU_R3081: name = "R3081"; break;
836 case CPU_R3081E: name = "R3081E"; break;
837 case CPU_R4000PC: name = "R4000PC"; break;
838 case CPU_R4000SC: name = "R4000SC"; break;
839 case CPU_R4000MC: name = "R4000MC"; break;
840 case CPU_R4200: name = "R4200"; break;
841 case CPU_R4400PC: name = "R4400PC"; break;
842 case CPU_R4400SC: name = "R4400SC"; break;
843 case CPU_R4400MC: name = "R4400MC"; break;
844 case CPU_R4600: name = "R4600"; break;
845 case CPU_R6000: name = "R6000"; break;
846 case CPU_R6000A: name = "R6000A"; break;
847 case CPU_R8000: name = "R8000"; break;
848 case CPU_R10000: name = "R10000"; break;
849 case CPU_R12000: name = "R12000"; break;
850 case CPU_R14000: name = "R14000"; break;
851 case CPU_R4300: name = "R4300"; break;
852 case CPU_R4650: name = "R4650"; break;
853 case CPU_R4700: name = "R4700"; break;
854 case CPU_R5000: name = "R5000"; break;
855 case CPU_R5000A: name = "R5000A"; break;
856 case CPU_R4640: name = "R4640"; break;
857 case CPU_NEVADA: name = "Nevada"; break;
858 case CPU_RM7000: name = "RM7000"; break;
859 case CPU_RM9000: name = "RM9000"; break;
860 case CPU_R5432: name = "R5432"; break;
861 case CPU_4KC: name = "MIPS 4Kc"; break;
862 case CPU_5KC: name = "MIPS 5Kc"; break;
863 case CPU_R4310: name = "R4310"; break;
864 case CPU_SB1: name = "SiByte SB1"; break;
865 case CPU_SB1A: name = "SiByte SB1A"; break;
866 case CPU_TX3912: name = "TX3912"; break;
867 case CPU_TX3922: name = "TX3922"; break;
868 case CPU_TX3927: name = "TX3927"; break;
869 case CPU_AU1000: name = "Au1000"; break;
870 case CPU_AU1500: name = "Au1500"; break;
871 case CPU_AU1100: name = "Au1100"; break;
872 case CPU_AU1550: name = "Au1550"; break;
873 case CPU_AU1200: name = "Au1200"; break;
874 case CPU_AU1210: name = "Au1210"; break;
875 case CPU_AU1250: name = "Au1250"; break;
876 case CPU_4KEC: name = "MIPS 4KEc"; break;
877 case CPU_4KSC: name = "MIPS 4KSc"; break;
878 case CPU_VR41XX: name = "NEC Vr41xx"; break;
879 case CPU_R5500: name = "R5500"; break;
880 case CPU_TX49XX: name = "TX49xx"; break;
881 case CPU_20KC: name = "MIPS 20Kc"; break;
882 case CPU_24K: name = "MIPS 24K"; break;
883 case CPU_25KF: name = "MIPS 25Kf"; break;
884 case CPU_34K: name = "MIPS 34K"; break;
885 case CPU_1004K: name = "MIPS 1004K"; break;
886 case CPU_74K: name = "MIPS 74K"; break;
887 case CPU_VR4111: name = "NEC VR4111"; break;
888 case CPU_VR4121: name = "NEC VR4121"; break;
889 case CPU_VR4122: name = "NEC VR4122"; break;
890 case CPU_VR4131: name = "NEC VR4131"; break;
891 case CPU_VR4133: name = "NEC VR4133"; break;
892 case CPU_VR4181: name = "NEC VR4181"; break;
893 case CPU_VR4181A: name = "NEC VR4181A"; break;
894 case CPU_SR71000: name = "Sandcraft SR71000"; break;
895 case CPU_BCM3302: name = "Broadcom BCM3302"; break;
896 case CPU_BCM4710: name = "Broadcom BCM4710"; break;
897 case CPU_PR4450: name = "Philips PR4450"; break;
898 case CPU_LOONGSON2: name = "ICT Loongson-2"; break;
899 default:
900 BUG();
901 }
902
903 return name;
904}
905
906__cpuinit void cpu_probe(void) 880__cpuinit void cpu_probe(void)
907{ 881{
908 struct cpuinfo_mips *c = &current_cpu_data; 882 struct cpuinfo_mips *c = &current_cpu_data;
@@ -915,30 +889,31 @@ __cpuinit void cpu_probe(void)
915 c->processor_id = read_c0_prid(); 889 c->processor_id = read_c0_prid();
916 switch (c->processor_id & 0xff0000) { 890 switch (c->processor_id & 0xff0000) {
917 case PRID_COMP_LEGACY: 891 case PRID_COMP_LEGACY:
918 cpu_probe_legacy(c); 892 cpu_probe_legacy(c, cpu);
919 break; 893 break;
920 case PRID_COMP_MIPS: 894 case PRID_COMP_MIPS:
921 cpu_probe_mips(c); 895 cpu_probe_mips(c, cpu);
922 break; 896 break;
923 case PRID_COMP_ALCHEMY: 897 case PRID_COMP_ALCHEMY:
924 cpu_probe_alchemy(c); 898 cpu_probe_alchemy(c, cpu);
925 break; 899 break;
926 case PRID_COMP_SIBYTE: 900 case PRID_COMP_SIBYTE:
927 cpu_probe_sibyte(c); 901 cpu_probe_sibyte(c, cpu);
928 break; 902 break;
929 case PRID_COMP_BROADCOM: 903 case PRID_COMP_BROADCOM:
930 cpu_probe_broadcom(c); 904 cpu_probe_broadcom(c, cpu);
931 break; 905 break;
932 case PRID_COMP_SANDCRAFT: 906 case PRID_COMP_SANDCRAFT:
933 cpu_probe_sandcraft(c); 907 cpu_probe_sandcraft(c, cpu);
934 break; 908 break;
935 case PRID_COMP_NXP: 909 case PRID_COMP_NXP:
936 cpu_probe_nxp(c); 910 cpu_probe_nxp(c, cpu);
937 break; 911 break;
938 default:
939 c->cputype = CPU_UNKNOWN;
940 } 912 }
941 913
914 BUG_ON(!__cpu_name[cpu]);
915 BUG_ON(c->cputype == CPU_UNKNOWN);
916
942 /* 917 /*
943 * Platform code can force the cpu type to optimize code 918 * Platform code can force the cpu type to optimize code
944 * generation. In that case be sure the cpu type is correctly 919 * generation. In that case be sure the cpu type is correctly
@@ -958,8 +933,6 @@ __cpuinit void cpu_probe(void)
958 } 933 }
959 } 934 }
960 935
961 __cpu_name[cpu] = cpu_to_name(c);
962
963 if (cpu_has_mips_r2) 936 if (cpu_has_mips_r2)
964 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; 937 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
965 else 938 else
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 5e75a316f6b1..759f68066b5d 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -180,7 +180,7 @@ bad_stack:
180 * The system call does not exist in this kernel 180 * The system call does not exist in this kernel
181 */ 181 */
182illegal_syscall: 182illegal_syscall:
183 li v0, -ENOSYS # error 183 li v0, ENOSYS # error
184 sw v0, PT_R2(sp) 184 sw v0, PT_R2(sp)
185 li t0, 1 # set error flag 185 li t0, 1 # set error flag
186 sw t0, PT_R7(sp) 186 sw t0, PT_R7(sp)
@@ -293,7 +293,7 @@ bad_alignment:
293 jr t2 293 jr t2
294 /* Unreached */ 294 /* Unreached */
295 295
296einval: li v0, -EINVAL 296einval: li v0, -ENOSYS
297 jr ra 297 jr ra
298 END(sys_syscall) 298 END(sys_syscall)
299 299
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 3d58204c9d44..a9e171618994 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -117,7 +117,7 @@ syscall_trace_entry:
117 117
118illegal_syscall: 118illegal_syscall:
119 /* This also isn't a 64-bit syscall, throw an error. */ 119 /* This also isn't a 64-bit syscall, throw an error. */
120 li v0, -ENOSYS # error 120 li v0, ENOSYS # error
121 sd v0, PT_R2(sp) 121 sd v0, PT_R2(sp)
122 li t0, 1 # set error flag 122 li t0, 1 # set error flag
123 sd t0, PT_R7(sp) 123 sd t0, PT_R7(sp)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 16f8edfe5cdc..4430a1f8fdf1 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -601,8 +601,8 @@ static int __init debugfs_mips(void)
601 struct dentry *d; 601 struct dentry *d;
602 602
603 d = debugfs_create_dir("mips", NULL); 603 d = debugfs_create_dir("mips", NULL);
604 if (IS_ERR(d)) 604 if (!d)
605 return PTR_ERR(d); 605 return -ENOMEM;
606 mips_debugfs_dir = d; 606 mips_debugfs_dir = d;
607 return 0; 607 return 0;
608} 608}
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 7b59cfb7e602..8bf88faf5afd 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -163,8 +163,10 @@ static void stop_this_cpu(void *dummy)
163 * Remove this CPU: 163 * Remove this CPU:
164 */ 164 */
165 cpu_clear(smp_processor_id(), cpu_online_map); 165 cpu_clear(smp_processor_id(), cpu_online_map);
166 local_irq_enable(); /* May need to service _machine_restart IPI */ 166 for (;;) {
167 for (;;); /* Wait if available. */ 167 if (cpu_wait)
168 (*cpu_wait)(); /* Wait if available. */
169 }
168} 170}
169 171
170void smp_send_stop(void) 172void smp_send_stop(void)
@@ -193,12 +195,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
193/* preload SMP state for boot cpu */ 195/* preload SMP state for boot cpu */
194void __devinit smp_prepare_boot_cpu(void) 196void __devinit smp_prepare_boot_cpu(void)
195{ 197{
196 /*
197 * This assumes that bootup is always handled by the processor
198 * with the logic and physical number 0.
199 */
200 __cpu_number_map[0] = 0;
201 __cpu_logical_map[0] = 0;
202 cpu_set(0, phys_cpu_present_map); 198 cpu_set(0, phys_cpu_present_map);
203 cpu_set(0, cpu_online_map); 199 cpu_set(0, cpu_online_map);
204 cpu_set(0, cpu_callin_map); 200 cpu_set(0, cpu_callin_map);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 80b9e070c207..353056110f2b 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -32,6 +32,7 @@
32#include <asm/cpu.h> 32#include <asm/cpu.h>
33#include <asm/dsp.h> 33#include <asm/dsp.h>
34#include <asm/fpu.h> 34#include <asm/fpu.h>
35#include <asm/fpu_emulator.h>
35#include <asm/mipsregs.h> 36#include <asm/mipsregs.h>
36#include <asm/mipsmtregs.h> 37#include <asm/mipsmtregs.h>
37#include <asm/module.h> 38#include <asm/module.h>
@@ -722,6 +723,21 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
722 die_if_kernel("Kernel bug detected", regs); 723 die_if_kernel("Kernel bug detected", regs);
723 force_sig(SIGTRAP, current); 724 force_sig(SIGTRAP, current);
724 break; 725 break;
726 case BRK_MEMU:
727 /*
728 * Address errors may be deliberately induced by the FPU
729 * emulator to retake control of the CPU after executing the
730 * instruction in the delay slot of an emulated branch.
731 *
732 * Terminate if exception was recognized as a delay slot return
733 * otherwise handle as normal.
734 */
735 if (do_dsemulret(regs))
736 return;
737
738 die_if_kernel("Math emu break/trap", regs);
739 force_sig(SIGTRAP, current);
740 break;
725 default: 741 default:
726 scnprintf(b, sizeof(b), "%s instruction in kernel code", str); 742 scnprintf(b, sizeof(b), "%s instruction in kernel code", str);
727 die_if_kernel(b, regs); 743 die_if_kernel(b, regs);
@@ -1555,6 +1571,8 @@ void __cpuinit set_uncached_handler(unsigned long offset, void *addr,
1555#ifdef CONFIG_64BIT 1571#ifdef CONFIG_64BIT
1556 unsigned long uncached_ebase = TO_UNCAC(ebase); 1572 unsigned long uncached_ebase = TO_UNCAC(ebase);
1557#endif 1573#endif
1574 if (cpu_has_mips_r2)
1575 ebase += (read_c0_ebase() & 0x3ffff000);
1558 1576
1559 if (!addr) 1577 if (!addr)
1560 panic(panic_null_cerr); 1578 panic(panic_null_cerr);
@@ -1588,8 +1606,11 @@ void __init trap_init(void)
1588 1606
1589 if (cpu_has_veic || cpu_has_vint) 1607 if (cpu_has_veic || cpu_has_vint)
1590 ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64); 1608 ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64);
1591 else 1609 else {
1592 ebase = CAC_BASE; 1610 ebase = CAC_BASE;
1611 if (cpu_has_mips_r2)
1612 ebase += (read_c0_ebase() & 0x3ffff000);
1613 }
1593 1614
1594 per_cpu_trap_init(); 1615 per_cpu_trap_init();
1595 1616
@@ -1697,11 +1718,11 @@ void __init trap_init(void)
1697 1718
1698 if (cpu_has_vce) 1719 if (cpu_has_vce)
1699 /* Special exception: R4[04]00 uses also the divec space. */ 1720 /* Special exception: R4[04]00 uses also the divec space. */
1700 memcpy((void *)(CAC_BASE + 0x180), &except_vec3_r4000, 0x100); 1721 memcpy((void *)(ebase + 0x180), &except_vec3_r4000, 0x100);
1701 else if (cpu_has_4kex) 1722 else if (cpu_has_4kex)
1702 memcpy((void *)(CAC_BASE + 0x180), &except_vec3_generic, 0x80); 1723 memcpy((void *)(ebase + 0x180), &except_vec3_generic, 0x80);
1703 else 1724 else
1704 memcpy((void *)(CAC_BASE + 0x080), &except_vec3_generic, 0x80); 1725 memcpy((void *)(ebase + 0x080), &except_vec3_generic, 0x80);
1705 1726
1706 signal_init(); 1727 signal_init();
1707#ifdef CONFIG_MIPS32_COMPAT 1728#ifdef CONFIG_MIPS32_COMPAT
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index c327b21bca81..bf4c4a979abb 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -499,22 +499,10 @@ sigill:
499 499
500asmlinkage void do_ade(struct pt_regs *regs) 500asmlinkage void do_ade(struct pt_regs *regs)
501{ 501{
502 extern int do_dsemulret(struct pt_regs *);
503 unsigned int __user *pc; 502 unsigned int __user *pc;
504 mm_segment_t seg; 503 mm_segment_t seg;
505 504
506 /* 505 /*
507 * Address errors may be deliberately induced by the FPU emulator to
508 * retake control of the CPU after executing the instruction in the
509 * delay slot of an emulated branch.
510 */
511 /* Terminate if exception was recognized as a delay slot return */
512 if (do_dsemulret(regs))
513 return;
514
515 /* Otherwise handle as normal */
516
517 /*
518 * Did we catch a fault trying to load an instruction? 506 * Did we catch a fault trying to load an instruction?
519 * Or are we running in MIPS16 mode? 507 * Or are we running in MIPS16 mode?
520 */ 508 */
@@ -560,12 +548,12 @@ static int __init debugfs_unaligned(void)
560 return -ENODEV; 548 return -ENODEV;
561 d = debugfs_create_u32("unaligned_instructions", S_IRUGO, 549 d = debugfs_create_u32("unaligned_instructions", S_IRUGO,
562 mips_debugfs_dir, &unaligned_instructions); 550 mips_debugfs_dir, &unaligned_instructions);
563 if (IS_ERR(d)) 551 if (!d)
564 return PTR_ERR(d); 552 return -ENOMEM;
565 d = debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR, 553 d = debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR,
566 mips_debugfs_dir, &unaligned_action); 554 mips_debugfs_dir, &unaligned_action);
567 if (IS_ERR(d)) 555 if (!d)
568 return PTR_ERR(d); 556 return -ENOMEM;
569 return 0; 557 return 0;
570} 558}
571__initcall(debugfs_unaligned); 559__initcall(debugfs_unaligned);
diff --git a/arch/mips/lemote/lm2e/pci.c b/arch/mips/lemote/lm2e/pci.c
index c1e41f15cc7e..8be03a8e1ad4 100644
--- a/arch/mips/lemote/lm2e/pci.c
+++ b/arch/mips/lemote/lm2e/pci.c
@@ -30,19 +30,20 @@
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <asm/mips-boards/bonito64.h> 32#include <asm/mips-boards/bonito64.h>
33#include <asm/mach-lemote/pci.h>
33 34
34extern struct pci_ops bonito64_pci_ops; 35extern struct pci_ops bonito64_pci_ops;
35 36
36static struct resource loongson2e_pci_mem_resource = { 37static struct resource loongson2e_pci_mem_resource = {
37 .name = "LOONGSON2E PCI MEM", 38 .name = "LOONGSON2E PCI MEM",
38 .start = 0x14000000UL, 39 .start = LOONGSON2E_PCI_MEM_START,
39 .end = 0x1fffffffUL, 40 .end = LOONGSON2E_PCI_MEM_END,
40 .flags = IORESOURCE_MEM, 41 .flags = IORESOURCE_MEM,
41}; 42};
42 43
43static struct resource loongson2e_pci_io_resource = { 44static struct resource loongson2e_pci_io_resource = {
44 .name = "LOONGSON2E PCI IO MEM", 45 .name = "LOONGSON2E PCI IO MEM",
45 .start = 0x00004000UL, 46 .start = LOONGSON2E_PCI_IO_START,
46 .end = IO_SPACE_LIMIT, 47 .end = IO_SPACE_LIMIT,
47 .flags = IORESOURCE_IO, 48 .flags = IORESOURCE_IO,
48}; 49};
@@ -82,6 +83,12 @@ static void __init ict_pcimap(void)
82static int __init pcibios_init(void) 83static int __init pcibios_init(void)
83{ 84{
84 ict_pcimap(); 85 ict_pcimap();
86
87 loongson2e_pci_controller.io_map_base =
88 (unsigned long) ioremap(LOONGSON2E_IO_PORT_BASE,
89 loongson2e_pci_io_resource.end -
90 loongson2e_pci_io_resource.start + 1);
91
85 register_pci_controller(&loongson2e_pci_controller); 92 register_pci_controller(&loongson2e_pci_controller);
86 93
87 return 0; 94 return 0;
diff --git a/arch/mips/lemote/lm2e/setup.c b/arch/mips/lemote/lm2e/setup.c
index 2cc6745991ab..ebd6ceaef2fd 100644
--- a/arch/mips/lemote/lm2e/setup.c
+++ b/arch/mips/lemote/lm2e/setup.c
@@ -34,6 +34,7 @@
34#include <asm/mc146818-time.h> 34#include <asm/mc146818-time.h>
35#include <asm/time.h> 35#include <asm/time.h>
36#include <asm/wbflush.h> 36#include <asm/wbflush.h>
37#include <asm/mach-lemote/pci.h>
37 38
38#ifdef CONFIG_VT 39#ifdef CONFIG_VT
39#include <linux/console.h> 40#include <linux/console.h>
@@ -42,12 +43,6 @@
42 43
43extern void mips_reboot_setup(void); 44extern void mips_reboot_setup(void);
44 45
45#ifdef CONFIG_64BIT
46#define PTR_PAD(p) ((0xffffffff00000000)|((unsigned long long)(p)))
47#else
48#define PTR_PAD(p) (p)
49#endif
50
51unsigned long cpu_clock_freq; 46unsigned long cpu_clock_freq;
52unsigned long bus_clock; 47unsigned long bus_clock;
53unsigned int memsize; 48unsigned int memsize;
@@ -80,8 +75,8 @@ static void wbflush_loongson2e(void)
80 75
81void __init plat_mem_setup(void) 76void __init plat_mem_setup(void)
82{ 77{
83 set_io_port_base(PTR_PAD(0xbfd00000)); 78 set_io_port_base((unsigned long)ioremap(LOONGSON2E_IO_PORT_BASE,
84 79 IO_SPACE_LIMIT - LOONGSON2E_PCI_IO_START + 1));
85 mips_reboot_setup(); 80 mips_reboot_setup();
86 81
87 __wbflush = wbflush_loongson2e; 82 __wbflush = wbflush_loongson2e;
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 8810dfb915dd..dbcf6511b74e 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_CPU_R4300) += dump_tlb.o
18obj-$(CONFIG_CPU_R4X00) += dump_tlb.o 18obj-$(CONFIG_CPU_R4X00) += dump_tlb.o
19obj-$(CONFIG_CPU_R5000) += dump_tlb.o 19obj-$(CONFIG_CPU_R5000) += dump_tlb.o
20obj-$(CONFIG_CPU_R5432) += dump_tlb.o 20obj-$(CONFIG_CPU_R5432) += dump_tlb.o
21obj-$(CONFIG_CPU_R5500) += dump_tlb.o
21obj-$(CONFIG_CPU_R6000) += 22obj-$(CONFIG_CPU_R6000) +=
22obj-$(CONFIG_CPU_R8000) += 23obj-$(CONFIG_CPU_R8000) +=
23obj-$(CONFIG_CPU_RM7000) += dump_tlb.o 24obj-$(CONFIG_CPU_RM7000) += dump_tlb.o
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
index 465ff0ec85b9..779821cd54ab 100644
--- a/arch/mips/lib/dump_tlb.c
+++ b/arch/mips/lib/dump_tlb.c
@@ -25,6 +25,7 @@ static inline const char *msk2str(unsigned int mask)
25 case PM_16M: return "16Mb"; 25 case PM_16M: return "16Mb";
26 case PM_64M: return "64Mb"; 26 case PM_64M: return "64Mb";
27 case PM_256M: return "256Mb"; 27 case PM_256M: return "256Mb";
28 case PM_1G: return "1Gb";
28#endif 29#endif
29 } 30 }
30 return ""; 31 return "";
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index b08fc65c13a6..890f77927d62 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -48,7 +48,6 @@
48#include <asm/branch.h> 48#include <asm/branch.h>
49 49
50#include "ieee754.h" 50#include "ieee754.h"
51#include "dsemul.h"
52 51
53/* Strap kernel emulator for full MIPS IV emulation */ 52/* Strap kernel emulator for full MIPS IV emulation */
54 53
@@ -346,9 +345,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
346 /* cop control register rd -> gpr[rt] */ 345 /* cop control register rd -> gpr[rt] */
347 u32 value; 346 u32 value;
348 347
349 if (ir == CP1UNDEF) {
350 return do_dsemulret(xcp);
351 }
352 if (MIPSInst_RD(ir) == FPCREG_CSR) { 348 if (MIPSInst_RD(ir) == FPCREG_CSR) {
353 value = ctx->fcr31; 349 value = ctx->fcr31;
354 value = (value & ~0x3) | mips_rm[value & 0x3]; 350 value = (value & ~0x3) | mips_rm[value & 0x3];
@@ -1299,12 +1295,12 @@ static int __init debugfs_fpuemu(void)
1299 if (!mips_debugfs_dir) 1295 if (!mips_debugfs_dir)
1300 return -ENODEV; 1296 return -ENODEV;
1301 dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir); 1297 dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir);
1302 if (IS_ERR(dir)) 1298 if (!dir)
1303 return PTR_ERR(dir); 1299 return -ENOMEM;
1304 for (i = 0; i < ARRAY_SIZE(vars); i++) { 1300 for (i = 0; i < ARRAY_SIZE(vars); i++) {
1305 d = debugfs_create_u32(vars[i].name, S_IRUGO, dir, vars[i].v); 1301 d = debugfs_create_u32(vars[i].name, S_IRUGO, dir, vars[i].v);
1306 if (IS_ERR(d)) 1302 if (!d)
1307 return PTR_ERR(d); 1303 return -ENOMEM;
1308 } 1304 }
1309 return 0; 1305 return 0;
1310} 1306}
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c
index 653e325849e4..df7b9d928efc 100644
--- a/arch/mips/math-emu/dsemul.c
+++ b/arch/mips/math-emu/dsemul.c
@@ -18,7 +18,6 @@
18#include <asm/fpu_emulator.h> 18#include <asm/fpu_emulator.h>
19 19
20#include "ieee754.h" 20#include "ieee754.h"
21#include "dsemul.h"
22 21
23/* Strap kernel emulator for full MIPS IV emulation */ 22/* Strap kernel emulator for full MIPS IV emulation */
24 23
@@ -94,7 +93,7 @@ int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc)
94 return SIGBUS; 93 return SIGBUS;
95 94
96 err = __put_user(ir, &fr->emul); 95 err = __put_user(ir, &fr->emul);
97 err |= __put_user((mips_instruction)BADINST, &fr->badinst); 96 err |= __put_user((mips_instruction)BREAK_MATH, &fr->badinst);
98 err |= __put_user((mips_instruction)BD_COOKIE, &fr->cookie); 97 err |= __put_user((mips_instruction)BD_COOKIE, &fr->cookie);
99 err |= __put_user(cpc, &fr->epc); 98 err |= __put_user(cpc, &fr->epc);
100 99
@@ -130,13 +129,13 @@ int do_dsemulret(struct pt_regs *xcp)
130 /* 129 /*
131 * Do some sanity checking on the stackframe: 130 * Do some sanity checking on the stackframe:
132 * 131 *
133 * - Is the instruction pointed to by the EPC an BADINST? 132 * - Is the instruction pointed to by the EPC an BREAK_MATH?
134 * - Is the following memory word the BD_COOKIE? 133 * - Is the following memory word the BD_COOKIE?
135 */ 134 */
136 err = __get_user(insn, &fr->badinst); 135 err = __get_user(insn, &fr->badinst);
137 err |= __get_user(cookie, &fr->cookie); 136 err |= __get_user(cookie, &fr->cookie);
138 137
139 if (unlikely(err || (insn != BADINST) || (cookie != BD_COOKIE))) { 138 if (unlikely(err || (insn != BREAK_MATH) || (cookie != BD_COOKIE))) {
140 fpuemustats.errors++; 139 fpuemustats.errors++;
141 return 0; 140 return 0;
142 } 141 }
diff --git a/arch/mips/math-emu/dsemul.h b/arch/mips/math-emu/dsemul.h
deleted file mode 100644
index 091f0e76730f..000000000000
--- a/arch/mips/math-emu/dsemul.h
+++ /dev/null
@@ -1,17 +0,0 @@
1extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc);
2extern int do_dsemulret(struct pt_regs *xcp);
3
4/* Instruction which will always cause an address error */
5#define AdELOAD 0x8c000001 /* lw $0,1($0) */
6/* Instruction which will plainly cause a CP1 exception when FPU is disabled */
7#define CP1UNDEF 0x44400001 /* cfc1 $0,$0 undef */
8
9/* Instruction inserted following the badinst to further tag the sequence */
10#define BD_COOKIE 0x0000bd36 /* tne $0,$0 with baggage */
11
12/* Setup which instruction to use for trampoline */
13#ifdef STANDALONE_EMULATOR
14#define BADINST CP1UNDEF
15#else
16#define BADINST AdELOAD
17#endif
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index 44e8dd8106bf..95ba32b5b720 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_CPU_R4300) += c-r4k.o cex-gen.o tlb-r4k.o
19obj-$(CONFIG_CPU_R4X00) += c-r4k.o cex-gen.o tlb-r4k.o 19obj-$(CONFIG_CPU_R4X00) += c-r4k.o cex-gen.o tlb-r4k.o
20obj-$(CONFIG_CPU_R5000) += c-r4k.o cex-gen.o tlb-r4k.o 20obj-$(CONFIG_CPU_R5000) += c-r4k.o cex-gen.o tlb-r4k.o
21obj-$(CONFIG_CPU_R5432) += c-r4k.o cex-gen.o tlb-r4k.o 21obj-$(CONFIG_CPU_R5432) += c-r4k.o cex-gen.o tlb-r4k.o
22obj-$(CONFIG_CPU_R5500) += c-r4k.o cex-gen.o tlb-r4k.o
22obj-$(CONFIG_CPU_R8000) += c-r4k.o cex-gen.o tlb-r8k.o 23obj-$(CONFIG_CPU_R8000) += c-r4k.o cex-gen.o tlb-r8k.o
23obj-$(CONFIG_CPU_RM7000) += c-r4k.o cex-gen.o tlb-r4k.o 24obj-$(CONFIG_CPU_RM7000) += c-r4k.o cex-gen.o tlb-r4k.o
24obj-$(CONFIG_CPU_RM9000) += c-r4k.o cex-gen.o tlb-r4k.o 25obj-$(CONFIG_CPU_RM9000) += c-r4k.o cex-gen.o tlb-r4k.o
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 891312f8e5a6..5b98d0e731c2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -324,7 +324,6 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
324 if (cpu_is_noncoherent_r10000(dev)) 324 if (cpu_is_noncoherent_r10000(dev))
325 __dma_sync((unsigned long)page_address(sg_page(sg)), 325 __dma_sync((unsigned long)page_address(sg_page(sg)),
326 sg->length, direction); 326 sg->length, direction);
327 plat_unmap_dma_mem(sg->dma_address);
328 } 327 }
329} 328}
330 329
@@ -342,7 +341,6 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nele
342 if (!plat_device_is_coherent(dev)) 341 if (!plat_device_is_coherent(dev))
343 __dma_sync((unsigned long)page_address(sg_page(sg)), 342 __dma_sync((unsigned long)page_address(sg_page(sg)),
344 sg->length, direction); 343 sg->length, direction);
345 plat_unmap_dma_mem(sg->dma_address);
346 } 344 }
347} 345}
348 346
diff --git a/arch/mips/nxp/pnx833x/common/Makefile b/arch/mips/nxp/pnx833x/common/Makefile
new file mode 100644
index 000000000000..4a16f3b503b5
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/common/Makefile
@@ -0,0 +1,3 @@
1obj-y := interrupts.o platform.o prom.o setup.o reset.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx833x/common/interrupts.c b/arch/mips/nxp/pnx833x/common/interrupts.c
new file mode 100644
index 000000000000..30533ba200e2
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/common/interrupts.c
@@ -0,0 +1,380 @@
1/*
2 * interrupts.c: Interrupt mappings for PNX833X.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#include <linux/kernel.h>
23#include <linux/irq.h>
24#include <linux/hardirq.h>
25#include <linux/interrupt.h>
26#include <asm/mipsregs.h>
27#include <asm/irq_cpu.h>
28#include <irq.h>
29#include <irq-mapping.h>
30#include <gpio.h>
31
32static int mips_cpu_timer_irq;
33
34static const unsigned int irq_prio[PNX833X_PIC_NUM_IRQ] =
35{
36 0, /* unused */
37 4, /* PNX833X_PIC_I2C0_INT 1 */
38 4, /* PNX833X_PIC_I2C1_INT 2 */
39 1, /* PNX833X_PIC_UART0_INT 3 */
40 1, /* PNX833X_PIC_UART1_INT 4 */
41 6, /* PNX833X_PIC_TS_IN0_DV_INT 5 */
42 6, /* PNX833X_PIC_TS_IN0_DMA_INT 6 */
43 7, /* PNX833X_PIC_GPIO_INT 7 */
44 4, /* PNX833X_PIC_AUDIO_DEC_INT 8 */
45 5, /* PNX833X_PIC_VIDEO_DEC_INT 9 */
46 4, /* PNX833X_PIC_CONFIG_INT 10 */
47 4, /* PNX833X_PIC_AOI_INT 11 */
48 9, /* PNX833X_PIC_SYNC_INT 12 */
49 9, /* PNX8335_PIC_SATA_INT 13 */
50 4, /* PNX833X_PIC_OSD_INT 14 */
51 9, /* PNX833X_PIC_DISP1_INT 15 */
52 4, /* PNX833X_PIC_DEINTERLACER_INT 16 */
53 9, /* PNX833X_PIC_DISPLAY2_INT 17 */
54 4, /* PNX833X_PIC_VC_INT 18 */
55 4, /* PNX833X_PIC_SC_INT 19 */
56 9, /* PNX833X_PIC_IDE_INT 20 */
57 9, /* PNX833X_PIC_IDE_DMA_INT 21 */
58 6, /* PNX833X_PIC_TS_IN1_DV_INT 22 */
59 6, /* PNX833X_PIC_TS_IN1_DMA_INT 23 */
60 4, /* PNX833X_PIC_SGDX_DMA_INT 24 */
61 4, /* PNX833X_PIC_TS_OUT_INT 25 */
62 4, /* PNX833X_PIC_IR_INT 26 */
63 3, /* PNX833X_PIC_VMSP1_INT 27 */
64 3, /* PNX833X_PIC_VMSP2_INT 28 */
65 4, /* PNX833X_PIC_PIBC_INT 29 */
66 4, /* PNX833X_PIC_TS_IN0_TRD_INT 30 */
67 4, /* PNX833X_PIC_SGDX_TPD_INT 31 */
68 5, /* PNX833X_PIC_USB_INT 32 */
69 4, /* PNX833X_PIC_TS_IN1_TRD_INT 33 */
70 4, /* PNX833X_PIC_CLOCK_INT 34 */
71 4, /* PNX833X_PIC_SGDX_PARSER_INT 35 */
72 4, /* PNX833X_PIC_VMSP_DMA_INT 36 */
73#if defined(CONFIG_SOC_PNX8335)
74 4, /* PNX8335_PIC_MIU_INT 37 */
75 4, /* PNX8335_PIC_AVCHIP_IRQ_INT 38 */
76 9, /* PNX8335_PIC_SYNC_HD_INT 39 */
77 9, /* PNX8335_PIC_DISP_HD_INT 40 */
78 9, /* PNX8335_PIC_DISP_SCALER_INT 41 */
79 4, /* PNX8335_PIC_OSD_HD1_INT 42 */
80 4, /* PNX8335_PIC_DTL_WRITER_Y_INT 43 */
81 4, /* PNX8335_PIC_DTL_WRITER_C_INT 44 */
82 4, /* PNX8335_PIC_DTL_EMULATOR_Y_IR_INT 45 */
83 4, /* PNX8335_PIC_DTL_EMULATOR_C_IR_INT 46 */
84 4, /* PNX8335_PIC_DENC_TTX_INT 47 */
85 4, /* PNX8335_PIC_MMI_SIF0_INT 48 */
86 4, /* PNX8335_PIC_MMI_SIF1_INT 49 */
87 4, /* PNX8335_PIC_MMI_CDMMU_INT 50 */
88 4, /* PNX8335_PIC_PIBCS_INT 51 */
89 12, /* PNX8335_PIC_ETHERNET_INT 52 */
90 3, /* PNX8335_PIC_VMSP1_0_INT 53 */
91 3, /* PNX8335_PIC_VMSP1_1_INT 54 */
92 4, /* PNX8335_PIC_VMSP1_DMA_INT 55 */
93 4, /* PNX8335_PIC_TDGR_DE_INT 56 */
94 4, /* PNX8335_PIC_IR1_IRQ_INT 57 */
95#endif
96};
97
98static void pnx833x_timer_dispatch(void)
99{
100 do_IRQ(mips_cpu_timer_irq);
101}
102
103static void pic_dispatch(void)
104{
105 unsigned int irq = PNX833X_REGFIELD(PIC_INT_SRC, INT_SRC);
106
107 if ((irq >= 1) && (irq < (PNX833X_PIC_NUM_IRQ))) {
108 unsigned long priority = PNX833X_PIC_INT_PRIORITY;
109 PNX833X_PIC_INT_PRIORITY = irq_prio[irq];
110
111 if (irq == PNX833X_PIC_GPIO_INT) {
112 unsigned long mask = PNX833X_PIO_INT_STATUS & PNX833X_PIO_INT_ENABLE;
113 int pin;
114 while ((pin = ffs(mask & 0xffff))) {
115 pin -= 1;
116 do_IRQ(PNX833X_GPIO_IRQ_BASE + pin);
117 mask &= ~(1 << pin);
118 }
119 } else {
120 do_IRQ(irq + PNX833X_PIC_IRQ_BASE);
121 }
122
123 PNX833X_PIC_INT_PRIORITY = priority;
124 } else {
125 printk(KERN_ERR "plat_irq_dispatch: unexpected irq %u\n", irq);
126 }
127}
128
129asmlinkage void plat_irq_dispatch(void)
130{
131 unsigned int pending = read_c0_status() & read_c0_cause();
132
133 if (pending & STATUSF_IP4)
134 pic_dispatch();
135 else if (pending & STATUSF_IP7)
136 do_IRQ(PNX833X_TIMER_IRQ);
137 else
138 spurious_interrupt();
139}
140
141static inline void pnx833x_hard_enable_pic_irq(unsigned int irq)
142{
143 /* Currently we do this by setting IRQ priority to 1.
144 If priority support is being implemented, 1 should be repalced
145 by a better value. */
146 PNX833X_PIC_INT_REG(irq) = irq_prio[irq];
147}
148
149static inline void pnx833x_hard_disable_pic_irq(unsigned int irq)
150{
151 /* Disable IRQ by writing setting it's priority to 0 */
152 PNX833X_PIC_INT_REG(irq) = 0;
153}
154
155static int irqflags[PNX833X_PIC_NUM_IRQ]; /* initialized by zeroes */
156#define IRQFLAG_STARTED 1
157#define IRQFLAG_DISABLED 2
158
159static DEFINE_SPINLOCK(pnx833x_irq_lock);
160
161static unsigned int pnx833x_startup_pic_irq(unsigned int irq)
162{
163 unsigned long flags;
164 unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
165
166 spin_lock_irqsave(&pnx833x_irq_lock, flags);
167
168 irqflags[pic_irq] = IRQFLAG_STARTED; /* started, not disabled */
169 pnx833x_hard_enable_pic_irq(pic_irq);
170
171 spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
172 return 0;
173}
174
175static void pnx833x_shutdown_pic_irq(unsigned int irq)
176{
177 unsigned long flags;
178 unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
179
180 spin_lock_irqsave(&pnx833x_irq_lock, flags);
181
182 irqflags[pic_irq] = 0; /* not started */
183 pnx833x_hard_disable_pic_irq(pic_irq);
184
185 spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
186}
187
188static void pnx833x_enable_pic_irq(unsigned int irq)
189{
190 unsigned long flags;
191 unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
192
193 spin_lock_irqsave(&pnx833x_irq_lock, flags);
194
195 irqflags[pic_irq] &= ~IRQFLAG_DISABLED;
196 if (irqflags[pic_irq] == IRQFLAG_STARTED)
197 pnx833x_hard_enable_pic_irq(pic_irq);
198
199 spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
200}
201
202static void pnx833x_disable_pic_irq(unsigned int irq)
203{
204 unsigned long flags;
205 unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
206
207 spin_lock_irqsave(&pnx833x_irq_lock, flags);
208
209 irqflags[pic_irq] |= IRQFLAG_DISABLED;
210 pnx833x_hard_disable_pic_irq(pic_irq);
211
212 spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
213}
214
215static void pnx833x_ack_pic_irq(unsigned int irq)
216{
217}
218
219static void pnx833x_end_pic_irq(unsigned int irq)
220{
221}
222
223static DEFINE_SPINLOCK(pnx833x_gpio_pnx833x_irq_lock);
224
225static unsigned int pnx833x_startup_gpio_irq(unsigned int irq)
226{
227 int pin = irq - PNX833X_GPIO_IRQ_BASE;
228 unsigned long flags;
229 spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
230 pnx833x_gpio_enable_irq(pin);
231 spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
232 return 0;
233}
234
235static void pnx833x_enable_gpio_irq(unsigned int irq)
236{
237 int pin = irq - PNX833X_GPIO_IRQ_BASE;
238 unsigned long flags;
239 spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
240 pnx833x_gpio_enable_irq(pin);
241 spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
242}
243
244static void pnx833x_disable_gpio_irq(unsigned int irq)
245{
246 int pin = irq - PNX833X_GPIO_IRQ_BASE;
247 unsigned long flags;
248 spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
249 pnx833x_gpio_disable_irq(pin);
250 spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
251}
252
253static void pnx833x_ack_gpio_irq(unsigned int irq)
254{
255}
256
257static void pnx833x_end_gpio_irq(unsigned int irq)
258{
259 int pin = irq - PNX833X_GPIO_IRQ_BASE;
260 unsigned long flags;
261 spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
262 pnx833x_gpio_clear_irq(pin);
263 spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
264}
265
266static int pnx833x_set_type_gpio_irq(unsigned int irq, unsigned int flow_type)
267{
268 int pin = irq - PNX833X_GPIO_IRQ_BASE;
269 int gpio_mode;
270
271 switch (flow_type) {
272 case IRQ_TYPE_EDGE_RISING:
273 gpio_mode = GPIO_INT_EDGE_RISING;
274 break;
275 case IRQ_TYPE_EDGE_FALLING:
276 gpio_mode = GPIO_INT_EDGE_FALLING;
277 break;
278 case IRQ_TYPE_EDGE_BOTH:
279 gpio_mode = GPIO_INT_EDGE_BOTH;
280 break;
281 case IRQ_TYPE_LEVEL_HIGH:
282 gpio_mode = GPIO_INT_LEVEL_HIGH;
283 break;
284 case IRQ_TYPE_LEVEL_LOW:
285 gpio_mode = GPIO_INT_LEVEL_LOW;
286 break;
287 default:
288 gpio_mode = GPIO_INT_NONE;
289 break;
290 }
291
292 pnx833x_gpio_setup_irq(gpio_mode, pin);
293
294 return 0;
295}
296
297static struct irq_chip pnx833x_pic_irq_type = {
298 .typename = "PNX-PIC",
299 .startup = pnx833x_startup_pic_irq,
300 .shutdown = pnx833x_shutdown_pic_irq,
301 .enable = pnx833x_enable_pic_irq,
302 .disable = pnx833x_disable_pic_irq,
303 .ack = pnx833x_ack_pic_irq,
304 .end = pnx833x_end_pic_irq
305};
306
307static struct irq_chip pnx833x_gpio_irq_type = {
308 .typename = "PNX-GPIO",
309 .startup = pnx833x_startup_gpio_irq,
310 .shutdown = pnx833x_disable_gpio_irq,
311 .enable = pnx833x_enable_gpio_irq,
312 .disable = pnx833x_disable_gpio_irq,
313 .ack = pnx833x_ack_gpio_irq,
314 .end = pnx833x_end_gpio_irq,
315 .set_type = pnx833x_set_type_gpio_irq
316};
317
318void __init arch_init_irq(void)
319{
320 unsigned int irq;
321
322 /* setup standard internal cpu irqs */
323 mips_cpu_irq_init();
324
325 /* Set IRQ information in irq_desc */
326 for (irq = PNX833X_PIC_IRQ_BASE; irq < (PNX833X_PIC_IRQ_BASE + PNX833X_PIC_NUM_IRQ); irq++) {
327 pnx833x_hard_disable_pic_irq(irq);
328 set_irq_chip_and_handler(irq, &pnx833x_pic_irq_type, handle_simple_irq);
329 }
330
331 for (irq = PNX833X_GPIO_IRQ_BASE; irq < (PNX833X_GPIO_IRQ_BASE + PNX833X_GPIO_NUM_IRQ); irq++)
332 set_irq_chip_and_handler(irq, &pnx833x_gpio_irq_type, handle_simple_irq);
333
334 /* Set PIC priority limiter register to 0 */
335 PNX833X_PIC_INT_PRIORITY = 0;
336
337 /* Setup GPIO IRQ dispatching */
338 pnx833x_startup_pic_irq(PNX833X_PIC_GPIO_INT);
339
340 /* Enable PIC IRQs (HWIRQ2) */
341 if (cpu_has_vint)
342 set_vi_handler(4, pic_dispatch);
343
344 write_c0_status(read_c0_status() | IE_IRQ2);
345}
346
347unsigned int __cpuinit get_c0_compare_int(void)
348{
349 if (cpu_has_vint)
350 set_vi_handler(cp0_compare_irq, pnx833x_timer_dispatch);
351
352 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
353 return mips_cpu_timer_irq;
354}
355
356void __init plat_time_init(void)
357{
358 /* calculate mips_hpt_frequency based on PNX833X_CLOCK_CPUCP_CTL reg */
359
360 extern unsigned long mips_hpt_frequency;
361 unsigned long reg = PNX833X_CLOCK_CPUCP_CTL;
362
363 if (!(PNX833X_BIT(reg, CLOCK_CPUCP_CTL, EXIT_RESET))) {
364 /* Functional clock is disabled so use crystal frequency */
365 mips_hpt_frequency = 25;
366 } else {
367#if defined(CONFIG_SOC_PNX8335)
368 /* Functional clock is enabled, so get clock multiplier */
369 mips_hpt_frequency = 90 + (10 * PNX8335_REGFIELD(CLOCK_PLL_CPU_CTL, FREQ));
370#else
371 static const unsigned long int freq[4] = {240, 160, 120, 80};
372 mips_hpt_frequency = freq[PNX833X_FIELD(reg, CLOCK_CPUCP_CTL, DIV_CLOCK)];
373#endif
374 }
375
376 printk(KERN_INFO "CPU clock is %ld MHz\n", mips_hpt_frequency);
377
378 mips_hpt_frequency *= 500000;
379}
380
diff --git a/arch/mips/nxp/pnx833x/common/platform.c b/arch/mips/nxp/pnx833x/common/platform.c
new file mode 100644
index 000000000000..b1ccbcc18f78
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/common/platform.c
@@ -0,0 +1,319 @@
1/*
2 * platform.c: platform support for PNX833X.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * Based on software written by:
9 * Nikita Youshchenko <yoush@debian.org>, based on PNX8550 code.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/device.h>
26#include <linux/dma-mapping.h>
27#include <linux/platform_device.h>
28#include <linux/kernel.h>
29#include <linux/init.h>
30#include <linux/resource.h>
31#include <linux/serial.h>
32#include <linux/serial_pnx8xxx.h>
33#include <linux/mtd/nand.h>
34#include <linux/mtd/partitions.h>
35
36#ifdef CONFIG_I2C_PNX0105
37/* Until i2c driver available in kernel.*/
38#include <linux/i2c-pnx0105.h>
39#endif
40
41#include <irq.h>
42#include <irq-mapping.h>
43#include <pnx833x.h>
44
45static u64 uart_dmamask = DMA_32BIT_MASK;
46
47static struct resource pnx833x_uart_resources[] = {
48 [0] = {
49 .start = PNX833X_UART0_PORTS_START,
50 .end = PNX833X_UART0_PORTS_END,
51 .flags = IORESOURCE_MEM,
52 },
53 [1] = {
54 .start = PNX833X_PIC_UART0_INT,
55 .end = PNX833X_PIC_UART0_INT,
56 .flags = IORESOURCE_IRQ,
57 },
58 [2] = {
59 .start = PNX833X_UART1_PORTS_START,
60 .end = PNX833X_UART1_PORTS_END,
61 .flags = IORESOURCE_MEM,
62 },
63 [3] = {
64 .start = PNX833X_PIC_UART1_INT,
65 .end = PNX833X_PIC_UART1_INT,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70struct pnx8xxx_port pnx8xxx_ports[] = {
71 [0] = {
72 .port = {
73 .type = PORT_PNX8XXX,
74 .iotype = UPIO_MEM,
75 .membase = (void __iomem *)PNX833X_UART0_PORTS_START,
76 .mapbase = PNX833X_UART0_PORTS_START,
77 .irq = PNX833X_PIC_UART0_INT,
78 .uartclk = 3692300,
79 .fifosize = 16,
80 .flags = UPF_BOOT_AUTOCONF,
81 .line = 0,
82 },
83 },
84 [1] = {
85 .port = {
86 .type = PORT_PNX8XXX,
87 .iotype = UPIO_MEM,
88 .membase = (void __iomem *)PNX833X_UART1_PORTS_START,
89 .mapbase = PNX833X_UART1_PORTS_START,
90 .irq = PNX833X_PIC_UART1_INT,
91 .uartclk = 3692300,
92 .fifosize = 16,
93 .flags = UPF_BOOT_AUTOCONF,
94 .line = 1,
95 },
96 },
97};
98
99static struct platform_device pnx833x_uart_device = {
100 .name = "pnx8xxx-uart",
101 .id = -1,
102 .dev = {
103 .dma_mask = &uart_dmamask,
104 .coherent_dma_mask = DMA_32BIT_MASK,
105 .platform_data = pnx8xxx_ports,
106 },
107 .num_resources = ARRAY_SIZE(pnx833x_uart_resources),
108 .resource = pnx833x_uart_resources,
109};
110
111static u64 ehci_dmamask = DMA_32BIT_MASK;
112
113static struct resource pnx833x_usb_ehci_resources[] = {
114 [0] = {
115 .start = PNX833X_USB_PORTS_START,
116 .end = PNX833X_USB_PORTS_END,
117 .flags = IORESOURCE_MEM,
118 },
119 [1] = {
120 .start = PNX833X_PIC_USB_INT,
121 .end = PNX833X_PIC_USB_INT,
122 .flags = IORESOURCE_IRQ,
123 },
124};
125
126static struct platform_device pnx833x_usb_ehci_device = {
127 .name = "pnx833x-ehci",
128 .id = -1,
129 .dev = {
130 .dma_mask = &ehci_dmamask,
131 .coherent_dma_mask = DMA_32BIT_MASK,
132 },
133 .num_resources = ARRAY_SIZE(pnx833x_usb_ehci_resources),
134 .resource = pnx833x_usb_ehci_resources,
135};
136
137#ifdef CONFIG_I2C_PNX0105
138static struct resource pnx833x_i2c0_resources[] = {
139 {
140 .start = PNX833X_I2C0_PORTS_START,
141 .end = PNX833X_I2C0_PORTS_END,
142 .flags = IORESOURCE_MEM,
143 },
144 {
145 .start = PNX833X_PIC_I2C0_INT,
146 .end = PNX833X_PIC_I2C0_INT,
147 .flags = IORESOURCE_IRQ,
148 },
149};
150
151static struct resource pnx833x_i2c1_resources[] = {
152 {
153 .start = PNX833X_I2C1_PORTS_START,
154 .end = PNX833X_I2C1_PORTS_END,
155 .flags = IORESOURCE_MEM,
156 },
157 {
158 .start = PNX833X_PIC_I2C1_INT,
159 .end = PNX833X_PIC_I2C1_INT,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct i2c_pnx0105_dev pnx833x_i2c_dev[] = {
165 {
166 .base = PNX833X_I2C0_PORTS_START,
167 .irq = -1, /* should be PNX833X_PIC_I2C0_INT but polling is faster */
168 .clock = 6, /* 0 == 400 kHz, 4 == 100 kHz(Maximum HDMI), 6 = 50kHz(Prefered HDCP) */
169 .bus_addr = 0, /* no slave support */
170 },
171 {
172 .base = PNX833X_I2C1_PORTS_START,
173 .irq = -1, /* on high freq, polling is faster */
174 /*.irq = PNX833X_PIC_I2C1_INT,*/
175 .clock = 4, /* 0 == 400 kHz, 4 == 100 kHz. 100 kHz seems a safe default for now */
176 .bus_addr = 0, /* no slave support */
177 },
178};
179
180static struct platform_device pnx833x_i2c0_device = {
181 .name = "i2c-pnx0105",
182 .id = 0,
183 .dev = {
184 .platform_data = &pnx833x_i2c_dev[0],
185 },
186 .num_resources = ARRAY_SIZE(pnx833x_i2c0_resources),
187 .resource = pnx833x_i2c0_resources,
188};
189
190static struct platform_device pnx833x_i2c1_device = {
191 .name = "i2c-pnx0105",
192 .id = 1,
193 .dev = {
194 .platform_data = &pnx833x_i2c_dev[1],
195 },
196 .num_resources = ARRAY_SIZE(pnx833x_i2c1_resources),
197 .resource = pnx833x_i2c1_resources,
198};
199#endif
200
201static u64 ethernet_dmamask = DMA_32BIT_MASK;
202
203static struct resource pnx833x_ethernet_resources[] = {
204 [0] = {
205 .start = PNX8335_IP3902_PORTS_START,
206 .end = PNX8335_IP3902_PORTS_END,
207 .flags = IORESOURCE_MEM,
208 },
209 [1] = {
210 .start = PNX8335_PIC_ETHERNET_INT,
211 .end = PNX8335_PIC_ETHERNET_INT,
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device pnx833x_ethernet_device = {
217 .name = "ip3902-eth",
218 .id = -1,
219 .dev = {
220 .dma_mask = &ethernet_dmamask,
221 .coherent_dma_mask = DMA_32BIT_MASK,
222 },
223 .num_resources = ARRAY_SIZE(pnx833x_ethernet_resources),
224 .resource = pnx833x_ethernet_resources,
225};
226
227static struct resource pnx833x_sata_resources[] = {
228 [0] = {
229 .start = PNX8335_SATA_PORTS_START,
230 .end = PNX8335_SATA_PORTS_END,
231 .flags = IORESOURCE_MEM,
232 },
233 [1] = {
234 .start = PNX8335_PIC_SATA_INT,
235 .end = PNX8335_PIC_SATA_INT,
236 .flags = IORESOURCE_IRQ,
237 },
238};
239
240static struct platform_device pnx833x_sata_device = {
241 .name = "pnx833x-sata",
242 .id = -1,
243 .num_resources = ARRAY_SIZE(pnx833x_sata_resources),
244 .resource = pnx833x_sata_resources,
245};
246
247static const char *part_probes[] = {
248 "cmdlinepart",
249 NULL
250};
251
252static void
253pnx833x_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
254{
255 struct nand_chip *this = mtd->priv;
256 unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
257
258 if (cmd == NAND_CMD_NONE)
259 return;
260
261 if (ctrl & NAND_CLE)
262 writeb(cmd, (void __iomem *)(nandaddr + PNX8335_NAND_CLE_MASK));
263 else
264 writeb(cmd, (void __iomem *)(nandaddr + PNX8335_NAND_ALE_MASK));
265}
266
267static struct platform_nand_data pnx833x_flash_nand_data = {
268 .chip = {
269 .chip_delay = 25,
270 .part_probe_types = part_probes,
271 },
272 .ctrl = {
273 .cmd_ctrl = pnx833x_flash_nand_cmd_ctrl
274 }
275};
276
277/*
278 * Set start to be the correct address (PNX8335_NAND_BASE with no 0xb!!),
279 * 12 bytes more seems to be the standard that allows for NAND access.
280 */
281static struct resource pnx833x_flash_nand_resource = {
282 .start = PNX8335_NAND_BASE,
283 .end = PNX8335_NAND_BASE + 12,
284 .flags = IORESOURCE_MEM,
285};
286
287static struct platform_device pnx833x_flash_nand = {
288 .name = "gen_nand",
289 .id = -1,
290 .num_resources = 1,
291 .resource = &pnx833x_flash_nand_resource,
292 .dev = {
293 .platform_data = &pnx833x_flash_nand_data,
294 },
295};
296
297static struct platform_device *pnx833x_platform_devices[] __initdata = {
298 &pnx833x_uart_device,
299 &pnx833x_usb_ehci_device,
300#ifdef CONFIG_I2C_PNX0105
301 &pnx833x_i2c0_device,
302 &pnx833x_i2c1_device,
303#endif
304 &pnx833x_ethernet_device,
305 &pnx833x_sata_device,
306 &pnx833x_flash_nand,
307};
308
309static int __init pnx833x_platform_init(void)
310{
311 int res;
312
313 res = platform_add_devices(pnx833x_platform_devices,
314 ARRAY_SIZE(pnx833x_platform_devices));
315
316 return res;
317}
318
319arch_initcall(pnx833x_platform_init);
diff --git a/arch/mips/nxp/pnx833x/common/prom.c b/arch/mips/nxp/pnx833x/common/prom.c
new file mode 100644
index 000000000000..2a41e8fec210
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/common/prom.c
@@ -0,0 +1,70 @@
1/*
2 * prom.c:
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * Based on software written by:
9 * Nikita Youshchenko <yoush@debian.org>, based on PNX8550 code.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/init.h>
26#include <asm/bootinfo.h>
27#include <linux/string.h>
28
29void __init prom_init_cmdline(void)
30{
31 int argc = fw_arg0;
32 char **argv = (char **)fw_arg1;
33 char *c = &(arcs_cmdline[0]);
34 int i;
35
36 for (i = 1; i < argc; i++) {
37 strcpy(c, argv[i]);
38 c += strlen(argv[i]);
39 if (i < argc-1)
40 *c++ = ' ';
41 }
42 *c = 0;
43}
44
45char __init *prom_getenv(char *envname)
46{
47 extern char **prom_envp;
48 char **env = prom_envp;
49 int i;
50
51 i = strlen(envname);
52
53 while (*env) {
54 if (strncmp(envname, *env, i) == 0 && *(*env+i) == '=')
55 return *env + i + 1;
56 env++;
57 }
58
59 return 0;
60}
61
62void __init prom_free_prom_memory(void)
63{
64}
65
66char * __init prom_getcmdline(void)
67{
68 return arcs_cmdline;
69}
70
diff --git a/arch/mips/nxp/pnx833x/common/reset.c b/arch/mips/nxp/pnx833x/common/reset.c
new file mode 100644
index 000000000000..a9bc9bacad2b
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/common/reset.c
@@ -0,0 +1,45 @@
1/*
2 * reset.c: reset support for PNX833X.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * Based on software written by:
9 * Nikita Youshchenko <yoush@debian.org>, based on PNX8550 code.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/slab.h>
26#include <linux/reboot.h>
27#include <pnx833x.h>
28
29void pnx833x_machine_restart(char *command)
30{
31 PNX833X_RESET_CONTROL_2 = 0;
32 PNX833X_RESET_CONTROL = 0;
33}
34
35void pnx833x_machine_halt(void)
36{
37 while (1)
38 __asm__ __volatile__ ("wait");
39
40}
41
42void pnx833x_machine_power_off(void)
43{
44 pnx833x_machine_halt();
45}
diff --git a/arch/mips/nxp/pnx833x/common/setup.c b/arch/mips/nxp/pnx833x/common/setup.c
new file mode 100644
index 000000000000..e51fbc4b644d
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/common/setup.c
@@ -0,0 +1,64 @@
1/*
2 * setup.c: Setup PNX833X Soc.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * Based on software written by:
9 * Nikita Youshchenko <yoush@debian.org>, based on PNX8550 code.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/ioport.h>
28#include <linux/io.h>
29#include <linux/pci.h>
30#include <asm/reboot.h>
31#include <pnx833x.h>
32#include <gpio.h>
33
34extern void pnx833x_board_setup(void);
35extern void pnx833x_machine_restart(char *);
36extern void pnx833x_machine_halt(void);
37extern void pnx833x_machine_power_off(void);
38
39int __init plat_mem_setup(void)
40{
41 /* fake pci bus to avoid bounce buffers */
42 PCI_DMA_BUS_IS_PHYS = 1;
43
44 /* set mips clock to 320MHz */
45#if defined(CONFIG_SOC_PNX8335)
46 PNX8335_WRITEFIELD(0x17, CLOCK_PLL_CPU_CTL, FREQ);
47#endif
48 pnx833x_gpio_init(); /* so it will be ready in board_setup() */
49
50 pnx833x_board_setup();
51
52 _machine_restart = pnx833x_machine_restart;
53 _machine_halt = pnx833x_machine_halt;
54 pm_power_off = pnx833x_machine_power_off;
55
56 /* IO/MEM resources. */
57 set_io_port_base(KSEG1);
58 ioport_resource.start = 0;
59 ioport_resource.end = ~0;
60 iomem_resource.start = 0;
61 iomem_resource.end = ~0;
62
63 return 0;
64}
diff --git a/arch/mips/nxp/pnx833x/stb22x/Makefile b/arch/mips/nxp/pnx833x/stb22x/Makefile
new file mode 100644
index 000000000000..f81c5801f455
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/stb22x/Makefile
@@ -0,0 +1,3 @@
1lib-y := board.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx833x/stb22x/board.c b/arch/mips/nxp/pnx833x/stb22x/board.c
new file mode 100644
index 000000000000..90cc604bdadf
--- /dev/null
+++ b/arch/mips/nxp/pnx833x/stb22x/board.c
@@ -0,0 +1,133 @@
1/*
2 * board.c: STB225 board support.
3 *
4 * Copyright 2008 NXP Semiconductors
5 * Chris Steel <chris.steel@nxp.com>
6 * Daniel Laird <daniel.j.laird@nxp.com>
7 *
8 * Based on software written by:
9 * Nikita Youshchenko <yoush@debian.org>, based on PNX8550 code.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/init.h>
26#include <asm/bootinfo.h>
27#include <linux/mm.h>
28#include <pnx833x.h>
29#include <gpio.h>
30
31/* endianess twiddlers */
32#define PNX8335_DEBUG0 0x4400
33#define PNX8335_DEBUG1 0x4404
34#define PNX8335_DEBUG2 0x4408
35#define PNX8335_DEBUG3 0x440c
36#define PNX8335_DEBUG4 0x4410
37#define PNX8335_DEBUG5 0x4414
38#define PNX8335_DEBUG6 0x4418
39#define PNX8335_DEBUG7 0x441c
40
41int prom_argc;
42char **prom_argv = 0, **prom_envp = 0;
43
44extern void prom_init_cmdline(void);
45extern char *prom_getenv(char *envname);
46
47const char *get_system_type(void)
48{
49 return "NXP STB22x";
50}
51
52static inline unsigned long env_or_default(char *env, unsigned long dfl)
53{
54 char *str = prom_getenv(env);
55 return str ? simple_strtol(str, 0, 0) : dfl;
56}
57
58void __init prom_init(void)
59{
60 unsigned long memsize;
61
62 prom_argc = fw_arg0;
63 prom_argv = (char **)fw_arg1;
64 prom_envp = (char **)fw_arg2;
65
66 prom_init_cmdline();
67
68 memsize = env_or_default("memsize", 0x02000000);
69 add_memory_region(0, memsize, BOOT_MEM_RAM);
70}
71
72void __init pnx833x_board_setup(void)
73{
74 pnx833x_gpio_select_function_alt(4);
75 pnx833x_gpio_select_output(4);
76 pnx833x_gpio_select_function_alt(5);
77 pnx833x_gpio_select_input(5);
78 pnx833x_gpio_select_function_alt(6);
79 pnx833x_gpio_select_input(6);
80 pnx833x_gpio_select_function_alt(7);
81 pnx833x_gpio_select_output(7);
82
83 pnx833x_gpio_select_function_alt(25);
84 pnx833x_gpio_select_function_alt(26);
85
86 pnx833x_gpio_select_function_alt(27);
87 pnx833x_gpio_select_function_alt(28);
88 pnx833x_gpio_select_function_alt(29);
89 pnx833x_gpio_select_function_alt(30);
90 pnx833x_gpio_select_function_alt(31);
91 pnx833x_gpio_select_function_alt(32);
92 pnx833x_gpio_select_function_alt(33);
93
94#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
95 /* Setup MIU for NAND access on CS0...
96 *
97 * (it seems that we must also configure CS1 for reliable operation,
98 * otherwise the first read ID command will fail if it's read as 4 bytes
99 * but pass if it's read as 1 word.)
100 */
101
102 /* Setup MIU CS0 & CS1 timing */
103 PNX833X_MIU_SEL0 = 0;
104 PNX833X_MIU_SEL1 = 0;
105 PNX833X_MIU_SEL0_TIMING = 0x50003081;
106 PNX833X_MIU_SEL1_TIMING = 0x50003081;
107
108 /* Setup GPIO 00 for use as MIU CS1 (CS0 is not multiplexed, so does not need this) */
109 pnx833x_gpio_select_function_alt(0);
110
111 /* Setup GPIO 04 to input NAND read/busy signal */
112 pnx833x_gpio_select_function_io(4);
113 pnx833x_gpio_select_input(4);
114
115 /* Setup GPIO 05 to disable NAND write protect */
116 pnx833x_gpio_select_function_io(5);
117 pnx833x_gpio_select_output(5);
118 pnx833x_gpio_write(1, 5);
119
120#elif defined(CONFIG_MTD_CFI) || defined(CONFIG_MTD_CFI_MODULE)
121
122 /* Set up MIU for 16-bit NOR access on CS0 and CS1... */
123
124 /* Setup MIU CS0 & CS1 timing */
125 PNX833X_MIU_SEL0 = 1;
126 PNX833X_MIU_SEL1 = 1;
127 PNX833X_MIU_SEL0_TIMING = 0x6A08D082;
128 PNX833X_MIU_SEL1_TIMING = 0x6A08D082;
129
130 /* Setup GPIO 00 for use as MIU CS1 (CS0 is not multiplexed, so does not need this) */
131 pnx833x_gpio_select_function_alt(0);
132#endif
133}
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index b1886244cedf..e8a97f59e066 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_MIPS_MSC) += ops-msc.o
13obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o 13obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o
14obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o 14obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
15obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o 15obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
16obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o 16obj-$(CONFIG_NEC_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
17obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o 17obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
18obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o 18obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
19 19
diff --git a/arch/mips/pci/fixup-emma2rh.c b/arch/mips/pci/fixup-emma2rh.c
index 846eae9cdd05..fba5aad00d51 100644
--- a/arch/mips/pci/fixup-emma2rh.c
+++ b/arch/mips/pci/fixup-emma2rh.c
@@ -30,7 +30,7 @@
30 30
31#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
32 32
33#include <asm/emma2rh/emma2rh.h> 33#include <asm/emma/emma2rh.h>
34 34
35#define EMMA2RH_PCI_HOST_SLOT 0x09 35#define EMMA2RH_PCI_HOST_SLOT 0x09
36#define EMMA2RH_USB_SLOT 0x03 36#define EMMA2RH_USB_SLOT 0x03
diff --git a/arch/mips/pci/fixup-rc32434.c b/arch/mips/pci/fixup-rc32434.c
index 75b90dcb7a09..3d86823d03a0 100644
--- a/arch/mips/pci/fixup-rc32434.c
+++ b/arch/mips/pci/fixup-rc32434.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31 31
32#include <asm/mach-rc32434/rc32434.h> 32#include <asm/mach-rc32434/rc32434.h>
33#include <asm/mach-rc32434/irq.h>
33 34
34static int __devinitdata irq_map[2][12] = { 35static int __devinitdata irq_map[2][12] = {
35 {0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1}, 36 {0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1},
diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
index d31bfc6d4150..5947a70b0b7f 100644
--- a/arch/mips/pci/ops-emma2rh.c
+++ b/arch/mips/pci/ops-emma2rh.c
@@ -30,7 +30,7 @@
30#include <asm/addrspace.h> 30#include <asm/addrspace.h>
31#include <asm/debug.h> 31#include <asm/debug.h>
32 32
33#include <asm/emma2rh/emma2rh.h> 33#include <asm/emma/emma2rh.h>
34 34
35#define RTABORT (0x1<<9) 35#define RTABORT (0x1<<9)
36#define RMABORT (0x1<<10) 36#define RMABORT (0x1<<10)
diff --git a/arch/mips/pci/pci-emma2rh.c b/arch/mips/pci/pci-emma2rh.c
index 772e283daa63..2df4190232cd 100644
--- a/arch/mips/pci/pci-emma2rh.c
+++ b/arch/mips/pci/pci-emma2rh.c
@@ -30,7 +30,7 @@
30 30
31#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
32 32
33#include <asm/emma2rh/emma2rh.h> 33#include <asm/emma/emma2rh.h>
34 34
35static struct resource pci_io_resource = { 35static struct resource pci_io_resource = {
36 .name = "pci IO space", 36 .name = "pci IO space",
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 31619c601b11..2f22d714d5b0 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -280,7 +280,7 @@ static int __init plat_setup_devices(void)
280{ 280{
281 /* Look for the CF card reader */ 281 /* Look for the CF card reader */
282 if (!readl(IDT434_REG_BASE + DEV1MASK)) 282 if (!readl(IDT434_REG_BASE + DEV1MASK))
283 rb532_devs[1] = NULL; 283 rb532_devs[2] = NULL; /* disable cf_slot0 at index 2 */
284 else { 284 else {
285 cf_slot0_res[0].start = 285 cf_slot0_res[0].start =
286 readl(IDT434_REG_BASE + DEV1BASE); 286 readl(IDT434_REG_BASE + DEV1BASE);
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index 76a7fd96d564..70c4a6726377 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -310,6 +310,10 @@ int __init rb532_gpio_init(void)
310 return -ENXIO; 310 return -ENXIO;
311 } 311 }
312 312
313 /* Set the interrupt status and level for the CF pin */
314 rb532_gpio_set_int_level(&rb532_gpio_chip->chip, CF_GPIO_NUM, 1);
315 rb532_gpio_set_int_status(&rb532_gpio_chip->chip, CF_GPIO_NUM, 0);
316
313 return 0; 317 return 0;
314} 318}
315arch_initcall(rb532_gpio_init); 319arch_initcall(rb532_gpio_init);
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index f6d9bf4b26e7..f8b18af141a1 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -12,20 +12,11 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/signal.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h> 15#include <linux/interrupt.h>
18#include <linux/irq.h>
19 16
20#include <asm/mipsregs.h>
21#include <asm/addrspace.h>
22#include <asm/irq_cpu.h> 17#include <asm/irq_cpu.h>
23#include <asm/sgi/ioc.h>
24#include <asm/sgi/hpc3.h> 18#include <asm/sgi/hpc3.h>
25#include <asm/sgi/ip22.h> 19#include <asm/sgi/ip22.h>
26#include <asm/time.h>
27
28/* #define DEBUG_SGINT */
29 20
30/* So far nothing hangs here */ 21/* So far nothing hangs here */
31#undef USE_LIO3_IRQ 22#undef USE_LIO3_IRQ
@@ -68,7 +59,7 @@ static void enable_local1_irq(unsigned int irq)
68 sgint->imask1 |= (1 << (irq - SGINT_LOCAL1)); 59 sgint->imask1 |= (1 << (irq - SGINT_LOCAL1));
69} 60}
70 61
71void disable_local1_irq(unsigned int irq) 62static void disable_local1_irq(unsigned int irq)
72{ 63{
73 sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1)); 64 sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1));
74} 65}
@@ -87,7 +78,7 @@ static void enable_local2_irq(unsigned int irq)
87 sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2)); 78 sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2));
88} 79}
89 80
90void disable_local2_irq(unsigned int irq) 81static void disable_local2_irq(unsigned int irq)
91{ 82{
92 sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2)); 83 sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2));
93 if (!sgint->cmeimask0) 84 if (!sgint->cmeimask0)
@@ -108,7 +99,7 @@ static void enable_local3_irq(unsigned int irq)
108 sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3)); 99 sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3));
109} 100}
110 101
111void disable_local3_irq(unsigned int irq) 102static void disable_local3_irq(unsigned int irq)
112{ 103{
113 sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3)); 104 sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3));
114 if (!sgint->cmeimask1) 105 if (!sgint->cmeimask1)
@@ -344,6 +335,6 @@ void __init arch_init_irq(void)
344 335
345#ifdef CONFIG_EISA 336#ifdef CONFIG_EISA
346 if (ip22_is_fullhouse()) /* Only Indigo-2 has EISA stuff */ 337 if (ip22_is_fullhouse()) /* Only Indigo-2 has EISA stuff */
347 ip22_eisa_init(); 338 ip22_eisa_init();
348#endif 339#endif
349} 340}
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 17052db4161d..226e8bb2f0a1 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -46,9 +46,10 @@ config TOSHIBA_RBTX4938
46 support this machine type 46 support this machine type
47 47
48config TOSHIBA_RBTX4939 48config TOSHIBA_RBTX4939
49 bool "Toshiba RBTX4939 bobard" 49 bool "Toshiba RBTX4939 board"
50 depends on MACH_TX49XX 50 depends on MACH_TX49XX
51 select SOC_TX4939 51 select SOC_TX4939
52 select TXX9_7SEGLED
52 help 53 help
53 This Toshiba board is based on the TX4939 processor. Say Y here to 54 This Toshiba board is based on the TX4939 processor. Say Y here to
54 support this machine type 55 support this machine type
@@ -86,6 +87,9 @@ config SOC_TX4939
86 select HW_HAS_PCI 87 select HW_HAS_PCI
87 select PCI_TX4927 88 select PCI_TX4927
88 89
90config TXX9_7SEGLED
91 bool
92
89config TOSHIBA_FPCIB0 93config TOSHIBA_FPCIB0
90 bool "FPCIB0 Backplane Support" 94 bool "FPCIB0 Backplane Support"
91 depends on PCI && MACH_TXX9 95 depends on PCI && MACH_TXX9
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c
new file mode 100644
index 000000000000..727ab21b6618
--- /dev/null
+++ b/arch/mips/txx9/generic/7segled.c
@@ -0,0 +1,112 @@
1/*
2 * 7 Segment LED routines
3 * Based on RBTX49xx patch from CELF patch archive.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * (C) Copyright TOSHIBA CORPORATION 2005-2007
10 * All Rights Reserved.
11 */
12#include <linux/sysdev.h>
13#include <linux/slab.h>
14#include <linux/map_to_7segment.h>
15#include <asm/txx9/generic.h>
16
17static unsigned int tx_7segled_num;
18static void (*tx_7segled_putc)(unsigned int pos, unsigned char val);
19
20void __init txx9_7segled_init(unsigned int num,
21 void (*putc)(unsigned int pos, unsigned char val))
22{
23 tx_7segled_num = num;
24 tx_7segled_putc = putc;
25}
26
27static SEG7_CONVERSION_MAP(txx9_seg7map, MAP_ASCII7SEG_ALPHANUM_LC);
28
29int txx9_7segled_putc(unsigned int pos, char c)
30{
31 if (pos >= tx_7segled_num)
32 return -EINVAL;
33 c = map_to_seg7(&txx9_seg7map, c);
34 if (c < 0)
35 return c;
36 tx_7segled_putc(pos, c);
37 return 0;
38}
39
40static ssize_t ascii_store(struct sys_device *dev,
41 struct sysdev_attribute *attr,
42 const char *buf, size_t size)
43{
44 unsigned int ch = dev->id;
45 txx9_7segled_putc(ch, buf[0]);
46 return size;
47}
48
49static ssize_t raw_store(struct sys_device *dev,
50 struct sysdev_attribute *attr,
51 const char *buf, size_t size)
52{
53 unsigned int ch = dev->id;
54 tx_7segled_putc(ch, buf[0]);
55 return size;
56}
57
58static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store);
59static SYSDEV_ATTR(raw, 0200, NULL, raw_store);
60
61static ssize_t map_seg7_show(struct sysdev_class *class, char *buf)
62{
63 memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map));
64 return sizeof(txx9_seg7map);
65}
66
67static ssize_t map_seg7_store(struct sysdev_class *class,
68 const char *buf, size_t size)
69{
70 if (size != sizeof(txx9_seg7map))
71 return -EINVAL;
72 memcpy(&txx9_seg7map, buf, size);
73 return size;
74}
75
76static SYSDEV_CLASS_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store);
77
78static struct sysdev_class tx_7segled_sysdev_class = {
79 .name = "7segled",
80};
81
82static int __init tx_7segled_init_sysfs(void)
83{
84 int error, i;
85 if (!tx_7segled_num)
86 return -ENODEV;
87 error = sysdev_class_register(&tx_7segled_sysdev_class);
88 if (error)
89 return error;
90 error = sysdev_class_create_file(&tx_7segled_sysdev_class,
91 &attr_map_seg7);
92 if (error)
93 return error;
94 for (i = 0; i < tx_7segled_num; i++) {
95 struct sys_device *dev;
96 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
97 if (!dev) {
98 error = -ENODEV;
99 break;
100 }
101 dev->id = i;
102 dev->cls = &tx_7segled_sysdev_class;
103 error = sysdev_register(dev);
104 if (!error) {
105 sysdev_create_file(dev, &attr_ascii);
106 sysdev_create_file(dev, &attr_raw);
107 }
108 }
109 return error;
110}
111
112device_initcall(tx_7segled_init_sysfs);
diff --git a/arch/mips/txx9/generic/Makefile b/arch/mips/txx9/generic/Makefile
index 0030d23bef5b..f2579ce054a1 100644
--- a/arch/mips/txx9/generic/Makefile
+++ b/arch/mips/txx9/generic/Makefile
@@ -10,5 +10,6 @@ obj-$(CONFIG_SOC_TX4938) += mem_tx4927.o setup_tx4938.o irq_tx4938.o
10obj-$(CONFIG_SOC_TX4939) += setup_tx4939.o irq_tx4939.o 10obj-$(CONFIG_SOC_TX4939) += setup_tx4939.o irq_tx4939.o
11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o 11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o
12obj-$(CONFIG_SPI) += spi_eeprom.o 12obj-$(CONFIG_SPI) += spi_eeprom.o
13obj-$(CONFIG_TXX9_7SEGLED) += 7segled.o
13 14
14EXTRA_CFLAGS += -Werror 15EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 5526375010f8..a13a08b8c9ec 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -156,11 +156,23 @@ static struct txx9_board_vec *__init find_board_byname(const char *name)
156 156
157static void __init prom_init_cmdline(void) 157static void __init prom_init_cmdline(void)
158{ 158{
159 int argc = (int)fw_arg0; 159 int argc;
160 int *argv32 = (int *)fw_arg1; 160 int *argv32;
161 int i; /* Always ignore the "-c" at argv[0] */ 161 int i; /* Always ignore the "-c" at argv[0] */
162 char builtin[CL_SIZE]; 162 char builtin[CL_SIZE];
163 163
164 if (fw_arg0 >= CKSEG0 || fw_arg1 < CKSEG0) {
165 /*
166 * argc is not a valid number, or argv32 is not a valid
167 * pointer
168 */
169 argc = 0;
170 argv32 = NULL;
171 } else {
172 argc = (int)fw_arg0;
173 argv32 = (int *)fw_arg1;
174 }
175
164 /* ignore all built-in args if any f/w args given */ 176 /* ignore all built-in args if any f/w args given */
165 /* 177 /*
166 * But if built-in strings was started with '+', append them 178 * But if built-in strings was started with '+', append them
@@ -414,10 +426,12 @@ char * __init prom_getcmdline(void)
414 426
415const char *__init prom_getenv(const char *name) 427const char *__init prom_getenv(const char *name)
416{ 428{
417 const s32 *str = (const s32 *)fw_arg2; 429 const s32 *str;
418 430
419 if (!str) 431 if (fw_arg2 < CKSEG0)
420 return NULL; 432 return NULL;
433
434 str = (const s32 *)fw_arg2;
421 /* YAMON style ("name", "value" pairs) */ 435 /* YAMON style ("name", "value" pairs) */
422 while (str[0] && str[1]) { 436 while (str[0] && str[1]) {
423 if (!strcmp((const char *)(unsigned long)str[0], name)) 437 if (!strcmp((const char *)(unsigned long)str[0], name))
@@ -622,6 +636,21 @@ unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none;
622EXPORT_SYMBOL(__swizzle_addr_b); 636EXPORT_SYMBOL(__swizzle_addr_b);
623#endif 637#endif
624 638
639#ifdef NEEDS_TXX9_IOSWABW
640static u16 ioswabw_default(volatile u16 *a, u16 x)
641{
642 return le16_to_cpu(x);
643}
644static u16 __mem_ioswabw_default(volatile u16 *a, u16 x)
645{
646 return x;
647}
648u16 (*ioswabw)(volatile u16 *a, u16 x) = ioswabw_default;
649EXPORT_SYMBOL(ioswabw);
650u16 (*__mem_ioswabw)(volatile u16 *a, u16 x) = __mem_ioswabw_default;
651EXPORT_SYMBOL(__mem_ioswabw);
652#endif
653
625void __init txx9_physmap_flash_init(int no, unsigned long addr, 654void __init txx9_physmap_flash_init(int no, unsigned long addr,
626 unsigned long size, 655 unsigned long size,
627 const struct physmap_flash_data *pdata) 656 const struct physmap_flash_data *pdata)
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 4a74423b2ba8..01129a9d50fa 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -49,6 +49,7 @@
49#include <linux/platform_device.h> 49#include <linux/platform_device.h>
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/gpio.h> 51#include <linux/gpio.h>
52#include <linux/leds.h>
52#include <asm/io.h> 53#include <asm/io.h>
53#include <asm/reboot.h> 54#include <asm/reboot.h>
54#include <asm/txx9/generic.h> 55#include <asm/txx9/generic.h>
@@ -210,10 +211,6 @@ static void __init rbtx4927_mem_setup(void)
210 /* TX4927-SIO DTR on (PIO[15]) */ 211 /* TX4927-SIO DTR on (PIO[15]) */
211 gpio_request(15, "sio-dtr"); 212 gpio_request(15, "sio-dtr");
212 gpio_direction_output(15, 1); 213 gpio_direction_output(15, 1);
213 gpio_request(0, "led");
214 gpio_direction_output(0, 1);
215 gpio_request(1, "led");
216 gpio_direction_output(1, 1);
217 214
218 tx4927_sio_init(0, 0); 215 tx4927_sio_init(0, 0);
219#ifdef CONFIG_SERIAL_TXX9_CONSOLE 216#ifdef CONFIG_SERIAL_TXX9_CONSOLE
@@ -315,6 +312,25 @@ static void __init rbtx4927_mtd_init(void)
315 tx4927_mtd_init(i); 312 tx4927_mtd_init(i);
316} 313}
317 314
315static void __init rbtx4927_gpioled_init(void)
316{
317 static struct gpio_led leds[] = {
318 { .name = "gpioled:green:0", .gpio = 0, .active_low = 1, },
319 { .name = "gpioled:green:1", .gpio = 1, .active_low = 1, },
320 };
321 static struct gpio_led_platform_data pdata = {
322 .num_leds = ARRAY_SIZE(leds),
323 .leds = leds,
324 };
325 struct platform_device *pdev = platform_device_alloc("leds-gpio", 0);
326
327 if (!pdev)
328 return;
329 pdev->dev.platform_data = &pdata;
330 if (platform_device_add(pdev))
331 platform_device_put(pdev);
332}
333
318static void __init rbtx4927_device_init(void) 334static void __init rbtx4927_device_init(void)
319{ 335{
320 toshiba_rbtx4927_rtc_init(); 336 toshiba_rbtx4927_rtc_init();
@@ -322,6 +338,7 @@ static void __init rbtx4927_device_init(void)
322 tx4927_wdt_init(); 338 tx4927_wdt_init();
323 rbtx4927_mtd_init(); 339 rbtx4927_mtd_init();
324 txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL); 340 txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
341 rbtx4927_gpioled_init();
325} 342}
326 343
327struct txx9_board_vec rbtx4927_vec __initdata = { 344struct txx9_board_vec rbtx4927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c
index 9855d7bccc20..98fbd9391bf8 100644
--- a/arch/mips/txx9/rbtx4939/setup.c
+++ b/arch/mips/txx9/rbtx4939/setup.c
@@ -14,6 +14,8 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/leds.h> 16#include <linux/leds.h>
17#include <linux/interrupt.h>
18#include <linux/smc91x.h>
17#include <asm/reboot.h> 19#include <asm/reboot.h>
18#include <asm/txx9/generic.h> 20#include <asm/txx9/generic.h>
19#include <asm/txx9/pci.h> 21#include <asm/txx9/pci.h>
@@ -33,6 +35,21 @@ static void __init rbtx4939_time_init(void)
33 tx4939_time_init(0); 35 tx4939_time_init(0);
34} 36}
35 37
38#if defined(__BIG_ENDIAN) && \
39 (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE))
40#define HAVE_RBTX4939_IOSWAB
41#define IS_CE1_ADDR(addr) \
42 ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1))
43static u16 rbtx4939_ioswabw(volatile u16 *a, u16 x)
44{
45 return IS_CE1_ADDR(a) ? x : le16_to_cpu(x);
46}
47static u16 rbtx4939_mem_ioswabw(volatile u16 *a, u16 x)
48{
49 return !IS_CE1_ADDR(a) ? x : le16_to_cpu(x);
50}
51#endif /* __BIG_ENDIAN && CONFIG_SMC91X */
52
36static void __init rbtx4939_pci_setup(void) 53static void __init rbtx4939_pci_setup(void)
37{ 54{
38#ifdef CONFIG_PCI 55#ifdef CONFIG_PCI
@@ -239,6 +256,32 @@ static inline void rbtx4939_led_setup(void)
239} 256}
240#endif 257#endif
241 258
259static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val)
260{
261#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
262 unsigned long flags;
263 local_irq_save(flags);
264 /* bit7: reserved for LED class */
265 led_val[pos] = (led_val[pos] & 0x80) | (val & 0x7f);
266 val = led_val[pos];
267 local_irq_restore(flags);
268#endif
269 writeb(val, rbtx4939_7seg_addr(pos / 4, pos % 4));
270}
271
272static void rbtx4939_7segled_putc(unsigned int pos, unsigned char val)
273{
274 /* convert from map_to_seg7() notation */
275 val = (val & 0x88) |
276 ((val & 0x40) >> 6) |
277 ((val & 0x20) >> 4) |
278 ((val & 0x10) >> 2) |
279 ((val & 0x04) << 2) |
280 ((val & 0x02) << 4) |
281 ((val & 0x01) << 6);
282 __rbtx4939_7segled_putc(pos, val);
283}
284
242static void __init rbtx4939_arch_init(void) 285static void __init rbtx4939_arch_init(void)
243{ 286{
244 rbtx4939_pci_setup(); 287 rbtx4939_pci_setup();
@@ -246,22 +289,50 @@ static void __init rbtx4939_arch_init(void)
246 289
247static void __init rbtx4939_device_init(void) 290static void __init rbtx4939_device_init(void)
248{ 291{
292 unsigned long smc_addr = RBTX4939_ETHER_ADDR - IO_BASE;
293 struct resource smc_res[] = {
294 {
295 .start = smc_addr,
296 .end = smc_addr + 0x10 - 1,
297 .flags = IORESOURCE_MEM,
298 }, {
299 .start = RBTX4939_IRQ_ETHER,
300 /* override default irq flag defined in smc91x.h */
301 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
302 },
303 };
304 struct smc91x_platdata smc_pdata = {
305 .flags = SMC91X_USE_16BIT,
306 };
307 struct platform_device *pdev;
249#if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) 308#if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE)
250 int i, j; 309 int i, j;
251 unsigned char ethaddr[2][6]; 310 unsigned char ethaddr[2][6];
311 u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f;
312
252 for (i = 0; i < 2; i++) { 313 for (i = 0; i < 2; i++) {
253 unsigned long area = CKSEG1 + 0x1fff0000 + (i * 0x10); 314 unsigned long area = CKSEG1 + 0x1fff0000 + (i * 0x10);
254 if (readb(rbtx4939_bdipsw_addr) & 8) { 315 if (bdipsw == 0)
316 memcpy(ethaddr[i], (void *)area, 6);
317 else {
255 u16 buf[3]; 318 u16 buf[3];
256 area -= 0x03000000; 319 if (bdipsw & 8)
320 area -= 0x03000000;
321 else
322 area -= 0x01000000;
257 for (j = 0; j < 3; j++) 323 for (j = 0; j < 3; j++)
258 buf[j] = le16_to_cpup((u16 *)(area + j * 2)); 324 buf[j] = le16_to_cpup((u16 *)(area + j * 2));
259 memcpy(ethaddr[i], buf, 6); 325 memcpy(ethaddr[i], buf, 6);
260 } else 326 }
261 memcpy(ethaddr[i], (void *)area, 6);
262 } 327 }
263 tx4939_ethaddr_init(ethaddr[0], ethaddr[1]); 328 tx4939_ethaddr_init(ethaddr[0], ethaddr[1]);
264#endif 329#endif
330 pdev = platform_device_alloc("smc91x", -1);
331 if (!pdev ||
332 platform_device_add_resources(pdev, smc_res, ARRAY_SIZE(smc_res)) ||
333 platform_device_add_data(pdev, &smc_pdata, sizeof(smc_pdata)) ||
334 platform_device_add(pdev))
335 platform_device_put(pdev);
265 rbtx4939_led_setup(); 336 rbtx4939_led_setup();
266 tx4939_wdt_init(); 337 tx4939_wdt_init();
267 tx4939_ata_init(); 338 tx4939_ata_init();
@@ -269,6 +340,8 @@ static void __init rbtx4939_device_init(void)
269 340
270static void __init rbtx4939_setup(void) 341static void __init rbtx4939_setup(void)
271{ 342{
343 int i;
344
272 rbtx4939_ebusc_setup(); 345 rbtx4939_ebusc_setup();
273 /* always enable ATA0 */ 346 /* always enable ATA0 */
274 txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE); 347 txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE);
@@ -276,9 +349,16 @@ static void __init rbtx4939_setup(void)
276 if (txx9_master_clock == 0) 349 if (txx9_master_clock == 0)
277 txx9_master_clock = 20000000; 350 txx9_master_clock = 20000000;
278 tx4939_setup(); 351 tx4939_setup();
352#ifdef HAVE_RBTX4939_IOSWAB
353 ioswabw = rbtx4939_ioswabw;
354 __mem_ioswabw = rbtx4939_mem_ioswabw;
355#endif
279 356
280 _machine_restart = rbtx4939_machine_restart; 357 _machine_restart = rbtx4939_machine_restart;
281 358
359 txx9_7segled_init(RBTX4939_MAX_7SEGLEDS, rbtx4939_7segled_putc);
360 for (i = 0; i < RBTX4939_MAX_7SEGLEDS; i++)
361 txx9_7segled_putc(i, '-');
282 pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", 362 pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
283 readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr), 363 readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr),
284 readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr)); 364 readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr));
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5b1527883fcb..525c13a4de93 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -108,8 +108,7 @@ config ARCH_NO_VIRT_TO_BUS
108config PPC 108config PPC
109 bool 109 bool
110 default y 110 default y
111 select HAVE_DYNAMIC_FTRACE 111 select HAVE_FUNCTION_TRACER
112 select HAVE_FTRACE
113 select ARCH_WANT_OPTIONAL_GPIOLIB 112 select ARCH_WANT_OPTIONAL_GPIOLIB
114 select HAVE_IDE 113 select HAVE_IDE
115 select HAVE_IOREMAP_PROT 114 select HAVE_IOREMAP_PROT
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 24dd1a37f8fb..1f0667069940 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -122,7 +122,7 @@ KBUILD_CFLAGS += -mcpu=powerpc
122endif 122endif
123 123
124# Work around a gcc code-gen bug with -fno-omit-frame-pointer. 124# Work around a gcc code-gen bug with -fno-omit-frame-pointer.
125ifeq ($(CONFIG_FTRACE),y) 125ifeq ($(CONFIG_FUNCTION_TRACER),y)
126KBUILD_CFLAGS += -mno-sched-epilog 126KBUILD_CFLAGS += -mno-sched-epilog
127endif 127endif
128 128
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index de921326cca8..b298f7a631e6 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_POWERPC_FTRACE 1#ifndef _ASM_POWERPC_FTRACE
2#define _ASM_POWERPC_FTRACE 2#define _ASM_POWERPC_FTRACE
3 3
4#ifdef CONFIG_FTRACE 4#ifdef CONFIG_FUNCTION_TRACER
5#define MCOUNT_ADDR ((long)(_mcount)) 5#define MCOUNT_ADDR ((long)(_mcount))
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ 6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7 7
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index fdb58253fa5b..92673b43858d 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -12,7 +12,7 @@ CFLAGS_prom_init.o += -fPIC
12CFLAGS_btext.o += -fPIC 12CFLAGS_btext.o += -fPIC
13endif 13endif
14 14
15ifdef CONFIG_FTRACE 15ifdef CONFIG_FUNCTION_TRACER
16# Do not trace early boot code 16# Do not trace early boot code
17CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog 17CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog
18CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog 18CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 1cbbf7033641..7ecc0d1855c3 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -1158,7 +1158,7 @@ machine_check_in_rtas:
1158 1158
1159#endif /* CONFIG_PPC_RTAS */ 1159#endif /* CONFIG_PPC_RTAS */
1160 1160
1161#ifdef CONFIG_FTRACE 1161#ifdef CONFIG_FUNCTION_TRACER
1162#ifdef CONFIG_DYNAMIC_FTRACE 1162#ifdef CONFIG_DYNAMIC_FTRACE
1163_GLOBAL(mcount) 1163_GLOBAL(mcount)
1164_GLOBAL(_mcount) 1164_GLOBAL(_mcount)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index fd8b4bae9b04..e6d52845854f 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -884,7 +884,7 @@ _GLOBAL(enter_prom)
884 mtlr r0 884 mtlr r0
885 blr 885 blr
886 886
887#ifdef CONFIG_FTRACE 887#ifdef CONFIG_FUNCTION_TRACER
888#ifdef CONFIG_DYNAMIC_FTRACE 888#ifdef CONFIG_DYNAMIC_FTRACE
889_GLOBAL(mcount) 889_GLOBAL(mcount)
890_GLOBAL(_mcount) 890_GLOBAL(_mcount)
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 3855ceb937b0..f4b006ed0ab1 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -28,17 +28,17 @@ static unsigned int ftrace_nop = 0x60000000;
28#endif 28#endif
29 29
30 30
31static unsigned int notrace ftrace_calc_offset(long ip, long addr) 31static unsigned int ftrace_calc_offset(long ip, long addr)
32{ 32{
33 return (int)(addr - ip); 33 return (int)(addr - ip);
34} 34}
35 35
36notrace unsigned char *ftrace_nop_replace(void) 36unsigned char *ftrace_nop_replace(void)
37{ 37{
38 return (char *)&ftrace_nop; 38 return (char *)&ftrace_nop;
39} 39}
40 40
41notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) 41unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
42{ 42{
43 static unsigned int op; 43 static unsigned int op;
44 44
@@ -68,7 +68,7 @@ notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
68# define _ASM_PTR " .long " 68# define _ASM_PTR " .long "
69#endif 69#endif
70 70
71notrace int 71int
72ftrace_modify_code(unsigned long ip, unsigned char *old_code, 72ftrace_modify_code(unsigned long ip, unsigned char *old_code,
73 unsigned char *new_code) 73 unsigned char *new_code)
74{ 74{
@@ -113,7 +113,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
113 return faulted; 113 return faulted;
114} 114}
115 115
116notrace int ftrace_update_ftrace_func(ftrace_func_t func) 116int ftrace_update_ftrace_func(ftrace_func_t func)
117{ 117{
118 unsigned long ip = (unsigned long)(&ftrace_call); 118 unsigned long ip = (unsigned long)(&ftrace_call);
119 unsigned char old[MCOUNT_INSN_SIZE], *new; 119 unsigned char old[MCOUNT_INSN_SIZE], *new;
@@ -126,23 +126,6 @@ notrace int ftrace_update_ftrace_func(ftrace_func_t func)
126 return ret; 126 return ret;
127} 127}
128 128
129notrace int ftrace_mcount_set(unsigned long *data)
130{
131 unsigned long ip = (long)(&mcount_call);
132 unsigned long *addr = data;
133 unsigned char old[MCOUNT_INSN_SIZE], *new;
134
135 /*
136 * Replace the mcount stub with a pointer to the
137 * ip recorder function.
138 */
139 memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
140 new = ftrace_call_replace(ip, *addr);
141 *addr = ftrace_modify_code(ip, old, new);
142
143 return 0;
144}
145
146int __init ftrace_dyn_arch_init(void *data) 129int __init ftrace_dyn_arch_init(void *data)
147{ 130{
148 /* This is running in kstop_machine */ 131 /* This is running in kstop_machine */
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 8edc2359c419..260089dccfb0 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(single_step_exception);
68EXPORT_SYMBOL(sys_sigreturn); 68EXPORT_SYMBOL(sys_sigreturn);
69#endif 69#endif
70 70
71#ifdef CONFIG_FTRACE 71#ifdef CONFIG_FUNCTION_TRACER
72EXPORT_SYMBOL(_mcount); 72EXPORT_SYMBOL(_mcount);
73#endif 73#endif
74 74
diff --git a/arch/powerpc/platforms/powermac/Makefile b/arch/powerpc/platforms/powermac/Makefile
index be60d64be7ad..50f169392551 100644
--- a/arch/powerpc/platforms/powermac/Makefile
+++ b/arch/powerpc/platforms/powermac/Makefile
@@ -1,6 +1,6 @@
1CFLAGS_bootx_init.o += -fPIC 1CFLAGS_bootx_init.o += -fPIC
2 2
3ifdef CONFIG_FTRACE 3ifdef CONFIG_FUNCTION_TRACER
4# Do not trace early boot code 4# Do not trace early boot code
5CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog 5CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog
6endif 6endif
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 01b884b25696..26ecb96f9731 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -223,6 +223,8 @@ static int gfar_mdio_of_init_one(struct device_node *np)
223 if (ret) 223 if (ret)
224 return ret; 224 return ret;
225 225
226 /* The gianfar device will try to use the same ID created below to find
227 * this bus, to coordinate register access (since they share). */
226 mdio_dev = platform_device_register_simple("fsl-gianfar_mdio", 228 mdio_dev = platform_device_register_simple("fsl-gianfar_mdio",
227 res.start&0xfffff, &res, 1); 229 res.start&0xfffff, &res, 1);
228 if (IS_ERR(mdio_dev)) 230 if (IS_ERR(mdio_dev))
@@ -394,6 +396,30 @@ static int __init gfar_of_init(void)
394 of_node_put(mdio); 396 of_node_put(mdio);
395 } 397 }
396 398
399 /* Get MDIO bus controlled by this eTSEC, if any. Normally only
400 * eTSEC 1 will control an MDIO bus, not necessarily the same
401 * bus that its PHY is on ('mdio' above), so we can't just use
402 * that. What we do is look for a gianfar mdio device that has
403 * overlapping registers with this device. That's really the
404 * whole point, to find the device sharing our registers to
405 * coordinate access with it.
406 */
407 for_each_compatible_node(mdio, NULL, "fsl,gianfar-mdio") {
408 if (of_address_to_resource(mdio, 0, &res))
409 continue;
410
411 if (res.start >= r[0].start && res.end <= r[0].end) {
412 /* Get the ID the mdio bus platform device was
413 * registered with. gfar_data.bus_id is
414 * different because it's for finding a PHY,
415 * while this is for finding a MII bus.
416 */
417 gfar_data.mdio_bus = res.start&0xfffff;
418 of_node_put(mdio);
419 break;
420 }
421 }
422
397 ret = 423 ret =
398 platform_device_add_data(gfar_dev, &gfar_data, 424 platform_device_add_data(gfar_dev, &gfar_data,
399 sizeof(struct 425 sizeof(struct
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 70b7645ce745..8116a3328a19 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -241,19 +241,17 @@ config PACK_STACK
241 Say Y if you are unsure. 241 Say Y if you are unsure.
242 242
243config SMALL_STACK 243config SMALL_STACK
244 bool "Use 4kb/8kb for kernel stack instead of 8kb/16kb" 244 bool "Use 8kb for kernel stack instead of 16kb"
245 depends on PACK_STACK && !LOCKDEP 245 depends on PACK_STACK && 64BIT && !LOCKDEP
246 help 246 help
247 If you say Y here and the compiler supports the -mkernel-backchain 247 If you say Y here and the compiler supports the -mkernel-backchain
248 option the kernel will use a smaller kernel stack size. For 31 bit 248 option the kernel will use a smaller kernel stack size. The reduced
249 the reduced size is 4kb instead of 8kb and for 64 bit it is 8kb 249 size is 8kb instead of 16kb. This allows to run more threads on a
250 instead of 16kb. This allows to run more thread on a system and 250 system and reduces the pressure on the memory management for higher
251 reduces the pressure on the memory management for higher order 251 order page allocations.
252 page allocations.
253 252
254 Say N if you are unsure. 253 Say N if you are unsure.
255 254
256
257config CHECK_STACK 255config CHECK_STACK
258 bool "Detect kernel stack overflow" 256 bool "Detect kernel stack overflow"
259 help 257 help
@@ -384,7 +382,7 @@ config IPL
384choice 382choice
385 prompt "IPL method generated into head.S" 383 prompt "IPL method generated into head.S"
386 depends on IPL 384 depends on IPL
387 default IPL_TAPE 385 default IPL_VM
388 help 386 help
389 Select "tape" if you want to IPL the image from a Tape. 387 Select "tape" if you want to IPL the image from a Tape.
390 388
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index a7f8979fb925..a06a47cdd5e0 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -424,7 +424,7 @@ out:
424 */ 424 */
425int appldata_register_ops(struct appldata_ops *ops) 425int appldata_register_ops(struct appldata_ops *ops)
426{ 426{
427 if ((ops->size > APPLDATA_MAX_REC_SIZE) || (ops->size < 0)) 427 if (ops->size > APPLDATA_MAX_REC_SIZE)
428 return -EINVAL; 428 return -EINVAL;
429 429
430 ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL); 430 ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL);
diff --git a/arch/s390/include/asm/kvm_virtio.h b/arch/s390/include/asm/kvm_virtio.h
index 146100224def..c13568b9351c 100644
--- a/arch/s390/include/asm/kvm_virtio.h
+++ b/arch/s390/include/asm/kvm_virtio.h
@@ -52,7 +52,7 @@ struct kvm_vqconfig {
52 52
53#ifdef __KERNEL__ 53#ifdef __KERNEL__
54/* early virtio console setup */ 54/* early virtio console setup */
55#ifdef CONFIG_VIRTIO_CONSOLE 55#ifdef CONFIG_S390_GUEST
56extern void s390_virtio_console_init(void); 56extern void s390_virtio_console_init(void);
57#else 57#else
58static inline void s390_virtio_console_init(void) 58static inline void s390_virtio_console_init(void)
diff --git a/arch/s390/include/asm/mmu.h b/arch/s390/include/asm/mmu.h
index 5dd5e7b3476f..d2b4ff831477 100644
--- a/arch/s390/include/asm/mmu.h
+++ b/arch/s390/include/asm/mmu.h
@@ -7,7 +7,8 @@ typedef struct {
7 unsigned long asce_bits; 7 unsigned long asce_bits;
8 unsigned long asce_limit; 8 unsigned long asce_limit;
9 int noexec; 9 int noexec;
10 int pgstes; 10 int has_pgste; /* The mmu context has extended page tables */
11 int alloc_pgste; /* cloned contexts will have extended page tables */
11} mm_context_t; 12} mm_context_t;
12 13
13#endif 14#endif
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index 4c2fbf48c9c4..28ec870655af 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -20,12 +20,25 @@ static inline int init_new_context(struct task_struct *tsk,
20#ifdef CONFIG_64BIT 20#ifdef CONFIG_64BIT
21 mm->context.asce_bits |= _ASCE_TYPE_REGION3; 21 mm->context.asce_bits |= _ASCE_TYPE_REGION3;
22#endif 22#endif
23 if (current->mm->context.pgstes) { 23 if (current->mm->context.alloc_pgste) {
24 /*
25 * alloc_pgste indicates, that any NEW context will be created
26 * with extended page tables. The old context is unchanged. The
27 * page table allocation and the page table operations will
28 * look at has_pgste to distinguish normal and extended page
29 * tables. The only way to create extended page tables is to
30 * set alloc_pgste and then create a new context (e.g. dup_mm).
31 * The page table allocation is called after init_new_context
32 * and if has_pgste is set, it will create extended page
33 * tables.
34 */
24 mm->context.noexec = 0; 35 mm->context.noexec = 0;
25 mm->context.pgstes = 1; 36 mm->context.has_pgste = 1;
37 mm->context.alloc_pgste = 1;
26 } else { 38 } else {
27 mm->context.noexec = s390_noexec; 39 mm->context.noexec = s390_noexec;
28 mm->context.pgstes = 0; 40 mm->context.has_pgste = 0;
41 mm->context.alloc_pgste = 0;
29 } 42 }
30 mm->context.asce_limit = STACK_TOP_MAX; 43 mm->context.asce_limit = STACK_TOP_MAX;
31 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm)); 44 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 1a928f84afd6..7fc76133b3e4 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -679,7 +679,7 @@ static inline void pmd_clear(pmd_t *pmd)
679 679
680static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 680static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
681{ 681{
682 if (mm->context.pgstes) 682 if (mm->context.has_pgste)
683 ptep_rcp_copy(ptep); 683 ptep_rcp_copy(ptep);
684 pte_val(*ptep) = _PAGE_TYPE_EMPTY; 684 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
685 if (mm->context.noexec) 685 if (mm->context.noexec)
@@ -763,7 +763,7 @@ static inline int kvm_s390_test_and_clear_page_dirty(struct mm_struct *mm,
763 struct page *page; 763 struct page *page;
764 unsigned int skey; 764 unsigned int skey;
765 765
766 if (!mm->context.pgstes) 766 if (!mm->context.has_pgste)
767 return -EINVAL; 767 return -EINVAL;
768 rcp_lock(ptep); 768 rcp_lock(ptep);
769 pgste = (unsigned long *) (ptep + PTRS_PER_PTE); 769 pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
@@ -794,7 +794,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
794 int young; 794 int young;
795 unsigned long *pgste; 795 unsigned long *pgste;
796 796
797 if (!vma->vm_mm->context.pgstes) 797 if (!vma->vm_mm->context.has_pgste)
798 return 0; 798 return 0;
799 physpage = pte_val(*ptep) & PAGE_MASK; 799 physpage = pte_val(*ptep) & PAGE_MASK;
800 pgste = (unsigned long *) (ptep + PTRS_PER_PTE); 800 pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
@@ -844,7 +844,7 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
844static inline void ptep_invalidate(struct mm_struct *mm, 844static inline void ptep_invalidate(struct mm_struct *mm,
845 unsigned long address, pte_t *ptep) 845 unsigned long address, pte_t *ptep)
846{ 846{
847 if (mm->context.pgstes) { 847 if (mm->context.has_pgste) {
848 rcp_lock(ptep); 848 rcp_lock(ptep);
849 __ptep_ipte(address, ptep); 849 __ptep_ipte(address, ptep);
850 ptep_rcp_copy(ptep); 850 ptep_rcp_copy(ptep);
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index de3fad60c682..c1eaf9604da7 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -15,13 +15,8 @@
15 * Size of kernel stack for each process 15 * Size of kernel stack for each process
16 */ 16 */
17#ifndef __s390x__ 17#ifndef __s390x__
18#ifndef __SMALL_STACK
19#define THREAD_ORDER 1 18#define THREAD_ORDER 1
20#define ASYNC_ORDER 1 19#define ASYNC_ORDER 1
21#else
22#define THREAD_ORDER 0
23#define ASYNC_ORDER 0
24#endif
25#else /* __s390x__ */ 20#else /* __s390x__ */
26#ifndef __SMALL_STACK 21#ifndef __SMALL_STACK
27#define THREAD_ORDER 2 22#define THREAD_ORDER 2
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 9e8b1f9b8f4d..b5595688a477 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1119,9 +1119,7 @@ out:
1119 return rc; 1119 return rc;
1120} 1120}
1121 1121
1122static ssize_t __ref rescan_store(struct sys_device *dev, 1122static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
1123 struct sysdev_attribute *attr,
1124 const char *buf,
1125 size_t count) 1123 size_t count)
1126{ 1124{
1127 int rc; 1125 int rc;
@@ -1129,12 +1127,10 @@ static ssize_t __ref rescan_store(struct sys_device *dev,
1129 rc = smp_rescan_cpus(); 1127 rc = smp_rescan_cpus();
1130 return rc ? rc : count; 1128 return rc ? rc : count;
1131} 1129}
1132static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); 1130static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store);
1133#endif /* CONFIG_HOTPLUG_CPU */ 1131#endif /* CONFIG_HOTPLUG_CPU */
1134 1132
1135static ssize_t dispatching_show(struct sys_device *dev, 1133static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
1136 struct sysdev_attribute *attr,
1137 char *buf)
1138{ 1134{
1139 ssize_t count; 1135 ssize_t count;
1140 1136
@@ -1144,9 +1140,8 @@ static ssize_t dispatching_show(struct sys_device *dev,
1144 return count; 1140 return count;
1145} 1141}
1146 1142
1147static ssize_t dispatching_store(struct sys_device *dev, 1143static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf,
1148 struct sysdev_attribute *attr, 1144 size_t count)
1149 const char *buf, size_t count)
1150{ 1145{
1151 int val, rc; 1146 int val, rc;
1152 char delim; 1147 char delim;
@@ -1168,7 +1163,8 @@ out:
1168 put_online_cpus(); 1163 put_online_cpus();
1169 return rc ? rc : count; 1164 return rc ? rc : count;
1170} 1165}
1171static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store); 1166static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show,
1167 dispatching_store);
1172 1168
1173static int __init topology_init(void) 1169static int __init topology_init(void)
1174{ 1170{
@@ -1178,13 +1174,11 @@ static int __init topology_init(void)
1178 register_cpu_notifier(&smp_cpu_nb); 1174 register_cpu_notifier(&smp_cpu_nb);
1179 1175
1180#ifdef CONFIG_HOTPLUG_CPU 1176#ifdef CONFIG_HOTPLUG_CPU
1181 rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 1177 rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan);
1182 &attr_rescan.attr);
1183 if (rc) 1178 if (rc)
1184 return rc; 1179 return rc;
1185#endif 1180#endif
1186 rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 1181 rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching);
1187 &attr_dispatching.attr);
1188 if (rc) 1182 if (rc)
1189 return rc; 1183 return rc;
1190 for_each_present_cpu(cpu) { 1184 for_each_present_cpu(cpu) {
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 3d98ba82ea67..ef3635b52fc0 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -169,7 +169,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
169 unsigned long *table; 169 unsigned long *table;
170 unsigned long bits; 170 unsigned long bits;
171 171
172 bits = (mm->context.noexec || mm->context.pgstes) ? 3UL : 1UL; 172 bits = (mm->context.noexec || mm->context.has_pgste) ? 3UL : 1UL;
173 spin_lock(&mm->page_table_lock); 173 spin_lock(&mm->page_table_lock);
174 page = NULL; 174 page = NULL;
175 if (!list_empty(&mm->context.pgtable_list)) { 175 if (!list_empty(&mm->context.pgtable_list)) {
@@ -186,7 +186,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
186 pgtable_page_ctor(page); 186 pgtable_page_ctor(page);
187 page->flags &= ~FRAG_MASK; 187 page->flags &= ~FRAG_MASK;
188 table = (unsigned long *) page_to_phys(page); 188 table = (unsigned long *) page_to_phys(page);
189 if (mm->context.pgstes) 189 if (mm->context.has_pgste)
190 clear_table_pgstes(table); 190 clear_table_pgstes(table);
191 else 191 else
192 clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); 192 clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE);
@@ -210,7 +210,7 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
210 struct page *page; 210 struct page *page;
211 unsigned long bits; 211 unsigned long bits;
212 212
213 bits = (mm->context.noexec || mm->context.pgstes) ? 3UL : 1UL; 213 bits = (mm->context.noexec || mm->context.has_pgste) ? 3UL : 1UL;
214 bits <<= (__pa(table) & (PAGE_SIZE - 1)) / 256 / sizeof(unsigned long); 214 bits <<= (__pa(table) & (PAGE_SIZE - 1)) / 256 / sizeof(unsigned long);
215 page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 215 page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
216 spin_lock(&mm->page_table_lock); 216 spin_lock(&mm->page_table_lock);
@@ -257,7 +257,7 @@ int s390_enable_sie(void)
257 struct mm_struct *mm, *old_mm; 257 struct mm_struct *mm, *old_mm;
258 258
259 /* Do we have pgstes? if yes, we are done */ 259 /* Do we have pgstes? if yes, we are done */
260 if (tsk->mm->context.pgstes) 260 if (tsk->mm->context.has_pgste)
261 return 0; 261 return 0;
262 262
263 /* lets check if we are allowed to replace the mm */ 263 /* lets check if we are allowed to replace the mm */
@@ -269,14 +269,14 @@ int s390_enable_sie(void)
269 } 269 }
270 task_unlock(tsk); 270 task_unlock(tsk);
271 271
272 /* we copy the mm with pgstes enabled */ 272 /* we copy the mm and let dup_mm create the page tables with_pgstes */
273 tsk->mm->context.pgstes = 1; 273 tsk->mm->context.alloc_pgste = 1;
274 mm = dup_mm(tsk); 274 mm = dup_mm(tsk);
275 tsk->mm->context.pgstes = 0; 275 tsk->mm->context.alloc_pgste = 0;
276 if (!mm) 276 if (!mm)
277 return -ENOMEM; 277 return -ENOMEM;
278 278
279 /* Now lets check again if somebody attached ptrace etc */ 279 /* Now lets check again if something happened */
280 task_lock(tsk); 280 task_lock(tsk);
281 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 || 281 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
282 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) { 282 tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) {
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 035b15af90d8..3b96e70b4670 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -11,8 +11,7 @@ config SPARC
11config SPARC64 11config SPARC64
12 bool 12 bool
13 default y 13 default y
14 select HAVE_DYNAMIC_FTRACE 14 select HAVE_FUNCTION_TRACER
15 select HAVE_FTRACE
16 select HAVE_IDE 15 select HAVE_IDE
17 select HAVE_LMB 16 select HAVE_LMB
18 select HAVE_ARCH_KGDB 17 select HAVE_ARCH_KGDB
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index d6d32d178fc8..c40515c06690 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -33,7 +33,7 @@ config DEBUG_PAGEALLOC
33 33
34config MCOUNT 34config MCOUNT
35 bool 35 bool
36 depends on STACK_DEBUG || FTRACE 36 depends on STACK_DEBUG || FUNCTION_TRACER
37 default y 37 default y
38 38
39config FRAME_POINTER 39config FRAME_POINTER
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index c0b8009ab196..b3e0b986bef8 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -5,6 +5,8 @@
5EXTRA_AFLAGS := -ansi 5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror 6EXTRA_CFLAGS := -Werror
7 7
8CFLAGS_REMOVE_ftrace.o = -pg
9
8extra-y := head.o init_task.o vmlinux.lds 10extra-y := head.o init_task.o vmlinux.lds
9 11
10obj-y := process.o setup.o cpu.o idprom.o reboot.o \ 12obj-y := process.o setup.o cpu.o idprom.o reboot.o \
diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc64/kernel/ftrace.c
index 4298d0aee713..d0218e73f982 100644
--- a/arch/sparc64/kernel/ftrace.c
+++ b/arch/sparc64/kernel/ftrace.c
@@ -9,12 +9,12 @@
9 9
10static const u32 ftrace_nop = 0x01000000; 10static const u32 ftrace_nop = 0x01000000;
11 11
12notrace unsigned char *ftrace_nop_replace(void) 12unsigned char *ftrace_nop_replace(void)
13{ 13{
14 return (char *)&ftrace_nop; 14 return (char *)&ftrace_nop;
15} 15}
16 16
17notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) 17unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
18{ 18{
19 static u32 call; 19 static u32 call;
20 s32 off; 20 s32 off;
@@ -25,7 +25,7 @@ notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
25 return (unsigned char *) &call; 25 return (unsigned char *) &call;
26} 26}
27 27
28notrace int 28int
29ftrace_modify_code(unsigned long ip, unsigned char *old_code, 29ftrace_modify_code(unsigned long ip, unsigned char *old_code,
30 unsigned char *new_code) 30 unsigned char *new_code)
31{ 31{
@@ -59,7 +59,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
59 return faulted; 59 return faulted;
60} 60}
61 61
62notrace int ftrace_update_ftrace_func(ftrace_func_t func) 62int ftrace_update_ftrace_func(ftrace_func_t func)
63{ 63{
64 unsigned long ip = (unsigned long)(&ftrace_call); 64 unsigned long ip = (unsigned long)(&ftrace_call);
65 unsigned char old[MCOUNT_INSN_SIZE], *new; 65 unsigned char old[MCOUNT_INSN_SIZE], *new;
@@ -69,24 +69,6 @@ notrace int ftrace_update_ftrace_func(ftrace_func_t func)
69 return ftrace_modify_code(ip, old, new); 69 return ftrace_modify_code(ip, old, new);
70} 70}
71 71
72notrace int ftrace_mcount_set(unsigned long *data)
73{
74 unsigned long ip = (long)(&mcount_call);
75 unsigned long *addr = data;
76 unsigned char old[MCOUNT_INSN_SIZE], *new;
77
78 /*
79 * Replace the mcount stub with a pointer to the
80 * ip recorder function.
81 */
82 memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
83 new = ftrace_call_replace(ip, *addr);
84 *addr = ftrace_modify_code(ip, old, new);
85
86 return 0;
87}
88
89
90int __init ftrace_dyn_arch_init(void *data) 72int __init ftrace_dyn_arch_init(void *data)
91{ 73{
92 ftrace_mcount_set(data); 74 ftrace_mcount_set(data);
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc64/lib/mcount.S
index fad90ddb3a28..7ce9c65f3592 100644
--- a/arch/sparc64/lib/mcount.S
+++ b/arch/sparc64/lib/mcount.S
@@ -93,7 +93,7 @@ mcount:
93 nop 93 nop
941: 941:
95#endif 95#endif
96#ifdef CONFIG_FTRACE 96#ifdef CONFIG_FUNCTION_TRACER
97#ifdef CONFIG_DYNAMIC_FTRACE 97#ifdef CONFIG_DYNAMIC_FTRACE
98 mov %o7, %o0 98 mov %o7, %o0
99 .globl mcount_call 99 .globl mcount_call
@@ -119,7 +119,7 @@ mcount_call:
119 .size _mcount,.-_mcount 119 .size _mcount,.-_mcount
120 .size mcount,.-mcount 120 .size mcount,.-mcount
121 121
122#ifdef CONFIG_FTRACE 122#ifdef CONFIG_FUNCTION_TRACER
123 .globl ftrace_stub 123 .globl ftrace_stub
124 .type ftrace_stub,#function 124 .type ftrace_stub,#function
125ftrace_stub: 125ftrace_stub:
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 350bee1d54dc..6f20718d3156 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -28,7 +28,7 @@ config X86
28 select HAVE_KRETPROBES 28 select HAVE_KRETPROBES
29 select HAVE_FTRACE_MCOUNT_RECORD 29 select HAVE_FTRACE_MCOUNT_RECORD
30 select HAVE_DYNAMIC_FTRACE 30 select HAVE_DYNAMIC_FTRACE
31 select HAVE_FTRACE 31 select HAVE_FUNCTION_TRACER
32 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 32 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
33 select HAVE_ARCH_KGDB if !X86_VOYAGER 33 select HAVE_ARCH_KGDB if !X86_VOYAGER
34 select HAVE_ARCH_TRACEHOOK 34 select HAVE_ARCH_TRACEHOOK
@@ -231,6 +231,10 @@ config SMP
231 231
232 If you don't know what to do here, say N. 232 If you don't know what to do here, say N.
233 233
234config X86_HAS_BOOT_CPU_ID
235 def_bool y
236 depends on X86_VOYAGER
237
234config X86_FIND_SMP_CONFIG 238config X86_FIND_SMP_CONFIG
235 def_bool y 239 def_bool y
236 depends on X86_MPPARSE || X86_VOYAGER 240 depends on X86_MPPARSE || X86_VOYAGER
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 0b7c4a3f0651..b815664fe370 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -513,19 +513,19 @@ config CPU_SUP_UMC_32
513 If unsure, say N. 513 If unsure, say N.
514 514
515config X86_DS 515config X86_DS
516 bool "Debug Store support" 516 def_bool X86_PTRACE_BTS
517 default y 517 depends on X86_DEBUGCTLMSR
518 help
519 Add support for Debug Store.
520 This allows the kernel to provide a memory buffer to the hardware
521 to store various profiling and tracing events.
522 518
523config X86_PTRACE_BTS 519config X86_PTRACE_BTS
524 bool "ptrace interface to Branch Trace Store" 520 bool "Branch Trace Store"
525 default y 521 default y
526 depends on (X86_DS && X86_DEBUGCTLMSR) 522 depends on X86_DEBUGCTLMSR
527 help 523 help
528 Add a ptrace interface to allow collecting an execution trace 524 This adds a ptrace interface to the hardware's branch trace store.
529 of the traced task. 525
530 This collects control flow changes in a (cyclic) buffer and allows 526 Debuggers may use it to collect an execution trace of the debugged
531 debuggers to fill in the gaps and show an execution trace of the debuggee. 527 application in order to answer the question 'how did I get here?'.
528 Debuggers may trace user mode as well as kernel mode.
529
530 Say Y unless there is no application development on this machine
531 and you want to save a small amount of code size.
diff --git a/arch/x86/boot/compressed/.gitignore b/arch/x86/boot/compressed/.gitignore
index be0ed065249b..63eff3b04d01 100644
--- a/arch/x86/boot/compressed/.gitignore
+++ b/arch/x86/boot/compressed/.gitignore
@@ -1 +1,3 @@
1relocs 1relocs
2vmlinux.bin.all
3vmlinux.relocs
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 4a5397bfce27..7f225a4b2a26 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -255,9 +255,11 @@ static inline unsigned long dma_alloc_coherent_mask(struct device *dev,
255 255
256static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) 256static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp)
257{ 257{
258#ifdef CONFIG_X86_64
259 unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp); 258 unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp);
260 259
260 if (dma_mask <= DMA_24BIT_MASK)
261 gfp |= GFP_DMA;
262#ifdef CONFIG_X86_64
261 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) 263 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA))
262 gfp |= GFP_DMA32; 264 gfp |= GFP_DMA32;
263#endif 265#endif
diff --git a/arch/x86/include/asm/es7000/wakecpu.h b/arch/x86/include/asm/es7000/wakecpu.h
index 3ffc5a7bf667..398493461913 100644
--- a/arch/x86/include/asm/es7000/wakecpu.h
+++ b/arch/x86/include/asm/es7000/wakecpu.h
@@ -50,10 +50,9 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
50{ 50{
51} 51}
52 52
53#if APIC_DEBUG 53#define inquire_remote_apic(apicid) do { \
54 #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid) 54 if (apic_verbosity >= APIC_DEBUG) \
55#else 55 __inquire_remote_apic(apicid); \
56 #define inquire_remote_apic(apicid) {} 56 } while (0)
57#endif
58 57
59#endif /* __ASM_MACH_WAKECPU_H */ 58#endif /* __ASM_MACH_WAKECPU_H */
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 47f7e65e6c1d..9e8bc29b8b17 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_X86_FTRACE_H 1#ifndef _ASM_X86_FTRACE_H
2#define _ASM_X86_FTRACE_H 2#define _ASM_X86_FTRACE_H
3 3
4#ifdef CONFIG_FTRACE 4#ifdef CONFIG_FUNCTION_TRACER
5#define MCOUNT_ADDR ((long)(mcount)) 5#define MCOUNT_ADDR ((long)(mcount))
6#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ 6#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
7 7
@@ -19,6 +19,6 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
19} 19}
20#endif 20#endif
21 21
22#endif /* CONFIG_FTRACE */ 22#endif /* CONFIG_FUNCTION_TRACER */
23 23
24#endif /* _ASM_X86_FTRACE_H */ 24#endif /* _ASM_X86_FTRACE_H */
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 5618a103f395..ac2abc88cd95 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -82,9 +82,9 @@ extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size);
82extern void early_ioremap_init(void); 82extern void early_ioremap_init(void);
83extern void early_ioremap_clear(void); 83extern void early_ioremap_clear(void);
84extern void early_ioremap_reset(void); 84extern void early_ioremap_reset(void);
85extern void *early_ioremap(unsigned long offset, unsigned long size); 85extern void __iomem *early_ioremap(unsigned long offset, unsigned long size);
86extern void *early_memremap(unsigned long offset, unsigned long size); 86extern void __iomem *early_memremap(unsigned long offset, unsigned long size);
87extern void early_iounmap(void *addr, unsigned long size); 87extern void early_iounmap(void __iomem *addr, unsigned long size);
88extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); 88extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
89 89
90 90
diff --git a/arch/x86/include/asm/iommu.h b/arch/x86/include/asm/iommu.h
index 98e28ea8cd16..e4a552d44465 100644
--- a/arch/x86/include/asm/iommu.h
+++ b/arch/x86/include/asm/iommu.h
@@ -7,7 +7,6 @@ extern struct dma_mapping_ops nommu_dma_ops;
7extern int force_iommu, no_iommu; 7extern int force_iommu, no_iommu;
8extern int iommu_detected; 8extern int iommu_detected;
9extern int dmar_disabled; 9extern int dmar_disabled;
10extern int forbid_dac;
11 10
12extern unsigned long iommu_nr_pages(unsigned long addr, unsigned long len); 11extern unsigned long iommu_nr_pages(unsigned long addr, unsigned long len);
13 12
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 65679d006337..8346be87cfa1 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -364,6 +364,9 @@ struct kvm_arch{
364 364
365 struct page *ept_identity_pagetable; 365 struct page *ept_identity_pagetable;
366 bool ept_identity_pagetable_done; 366 bool ept_identity_pagetable_done;
367
368 unsigned long irq_sources_bitmap;
369 unsigned long irq_states[KVM_IOAPIC_NUM_PINS];
367}; 370};
368 371
369struct kvm_vm_stat { 372struct kvm_vm_stat {
diff --git a/arch/x86/include/asm/mach-default/mach_wakecpu.h b/arch/x86/include/asm/mach-default/mach_wakecpu.h
index d5c0b826a4ff..9d80db91e992 100644
--- a/arch/x86/include/asm/mach-default/mach_wakecpu.h
+++ b/arch/x86/include/asm/mach-default/mach_wakecpu.h
@@ -33,10 +33,9 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
33{ 33{
34} 34}
35 35
36#if APIC_DEBUG 36#define inquire_remote_apic(apicid) do { \
37 #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid) 37 if (apic_verbosity >= APIC_DEBUG) \
38#else 38 __inquire_remote_apic(apicid); \
39 #define inquire_remote_apic(apicid) {} 39 } while (0)
40#endif
41 40
42#endif /* _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H */ 41#endif /* _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H */
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
index fb16cec702e4..52597aeadfff 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -120,13 +120,13 @@ static inline void pud_clear(pud_t *pudp)
120 write_cr3(pgd); 120 write_cr3(pgd);
121} 121}
122 122
123#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PTE_PFN_MASK)) 123#define pud_page(pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT)
124 124
125#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK)) 125#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))
126 126
127 127
128/* Find an entry in the second-level page table.. */ 128/* Find an entry in the second-level page table.. */
129#define pmd_offset(pud, address) ((pmd_t *)pud_page(*(pud)) + \ 129#define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) + \
130 pmd_index(address)) 130 pmd_index(address))
131 131
132#ifdef CONFIG_SMP 132#ifdef CONFIG_SMP
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 2766021aef80..d12811ce51d9 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -225,5 +225,11 @@ static inline int hard_smp_processor_id(void)
225 225
226#endif /* CONFIG_X86_LOCAL_APIC */ 226#endif /* CONFIG_X86_LOCAL_APIC */
227 227
228#ifdef CONFIG_X86_HAS_BOOT_CPU_ID
229extern unsigned char boot_cpu_id;
230#else
231#define boot_cpu_id 0
232#endif
233
228#endif /* __ASSEMBLY__ */ 234#endif /* __ASSEMBLY__ */
229#endif /* _ASM_X86_SMP_H */ 235#endif /* _ASM_X86_SMP_H */
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index c6ad93e315c8..7a5782610b2b 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/numa.h> 14#include <linux/numa.h>
15#include <linux/percpu.h> 15#include <linux/percpu.h>
16#include <linux/timer.h>
16#include <asm/types.h> 17#include <asm/types.h>
17#include <asm/percpu.h> 18#include <asm/percpu.h>
18 19
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index d7e5a58ee22f..e489ff9cb3e2 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -6,11 +6,12 @@ extra-y := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinu
6 6
7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) 7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
8 8
9ifdef CONFIG_FTRACE 9ifdef CONFIG_FUNCTION_TRACER
10# Do not profile debug and lowlevel utilities 10# Do not profile debug and lowlevel utilities
11CFLAGS_REMOVE_tsc.o = -pg 11CFLAGS_REMOVE_tsc.o = -pg
12CFLAGS_REMOVE_rtc.o = -pg 12CFLAGS_REMOVE_rtc.o = -pg
13CFLAGS_REMOVE_paravirt-spinlocks.o = -pg 13CFLAGS_REMOVE_paravirt-spinlocks.o = -pg
14CFLAGS_REMOVE_ftrace.o = -pg
14endif 15endif
15 16
16# 17#
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index 0d9c993aa93e..ef8f831af823 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -69,7 +69,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
69 */ 69 */
70void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) 70void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
71{ 71{
72#ifdef CONFIG_SMP 72#ifdef CONFIG_X86_SMP
73 unsigned int eax, ebx, ecx, edx, sub_index; 73 unsigned int eax, ebx, ecx, edx, sub_index;
74 unsigned int ht_mask_width, core_plus_mask_width; 74 unsigned int ht_mask_width, core_plus_mask_width;
75 unsigned int core_select_mask, core_level_siblings; 75 unsigned int core_select_mask, core_level_siblings;
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 25581dcb280e..003a65395bd5 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -549,6 +549,10 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
549 this_cpu->c_early_init(c); 549 this_cpu->c_early_init(c);
550 550
551 validate_pat_support(c); 551 validate_pat_support(c);
552
553#ifdef CONFIG_SMP
554 c->cpu_index = boot_cpu_id;
555#endif
552} 556}
553 557
554void __init early_cpu_init(void) 558void __init early_cpu_init(void)
@@ -1134,7 +1138,7 @@ void __cpuinit cpu_init(void)
1134 /* 1138 /*
1135 * Boot processor to setup the FP and extended state context info. 1139 * Boot processor to setup the FP and extended state context info.
1136 */ 1140 */
1137 if (!smp_processor_id()) 1141 if (smp_processor_id() == boot_cpu_id)
1138 init_thread_xstate(); 1142 init_thread_xstate();
1139 1143
1140 xsave_init(); 1144 xsave_init();
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index dd65143941a8..28b597ef9ca1 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -1149,7 +1149,7 @@ ENDPROC(xen_failsafe_callback)
1149 1149
1150#endif /* CONFIG_XEN */ 1150#endif /* CONFIG_XEN */
1151 1151
1152#ifdef CONFIG_FTRACE 1152#ifdef CONFIG_FUNCTION_TRACER
1153#ifdef CONFIG_DYNAMIC_FTRACE 1153#ifdef CONFIG_DYNAMIC_FTRACE
1154 1154
1155ENTRY(mcount) 1155ENTRY(mcount)
@@ -1204,7 +1204,7 @@ trace:
1204 jmp ftrace_stub 1204 jmp ftrace_stub
1205END(mcount) 1205END(mcount)
1206#endif /* CONFIG_DYNAMIC_FTRACE */ 1206#endif /* CONFIG_DYNAMIC_FTRACE */
1207#endif /* CONFIG_FTRACE */ 1207#endif /* CONFIG_FUNCTION_TRACER */
1208 1208
1209.section .rodata,"a" 1209.section .rodata,"a"
1210#include "syscall_table_32.S" 1210#include "syscall_table_32.S"
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 09e7145484c5..b86f332c96a6 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -61,7 +61,7 @@
61 61
62 .code64 62 .code64
63 63
64#ifdef CONFIG_FTRACE 64#ifdef CONFIG_FUNCTION_TRACER
65#ifdef CONFIG_DYNAMIC_FTRACE 65#ifdef CONFIG_DYNAMIC_FTRACE
66ENTRY(mcount) 66ENTRY(mcount)
67 retq 67 retq
@@ -138,7 +138,7 @@ trace:
138 jmp ftrace_stub 138 jmp ftrace_stub
139END(mcount) 139END(mcount)
140#endif /* CONFIG_DYNAMIC_FTRACE */ 140#endif /* CONFIG_DYNAMIC_FTRACE */
141#endif /* CONFIG_FTRACE */ 141#endif /* CONFIG_FUNCTION_TRACER */
142 142
143#ifndef CONFIG_PREEMPT 143#ifndef CONFIG_PREEMPT
144#define retint_kernel retint_restore_args 144#define retint_kernel retint_restore_args
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index d073d981a730..50ea0ac8c9bf 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -21,8 +21,7 @@
21#include <asm/nops.h> 21#include <asm/nops.h>
22 22
23 23
24/* Long is fine, even if it is only 4 bytes ;-) */ 24static unsigned char ftrace_nop[MCOUNT_INSN_SIZE];
25static unsigned long *ftrace_nop;
26 25
27union ftrace_code_union { 26union ftrace_code_union {
28 char code[MCOUNT_INSN_SIZE]; 27 char code[MCOUNT_INSN_SIZE];
@@ -33,17 +32,17 @@ union ftrace_code_union {
33}; 32};
34 33
35 34
36static int notrace ftrace_calc_offset(long ip, long addr) 35static int ftrace_calc_offset(long ip, long addr)
37{ 36{
38 return (int)(addr - ip); 37 return (int)(addr - ip);
39} 38}
40 39
41notrace unsigned char *ftrace_nop_replace(void) 40unsigned char *ftrace_nop_replace(void)
42{ 41{
43 return (char *)ftrace_nop; 42 return ftrace_nop;
44} 43}
45 44
46notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) 45unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
47{ 46{
48 static union ftrace_code_union calc; 47 static union ftrace_code_union calc;
49 48
@@ -57,7 +56,7 @@ notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
57 return calc.code; 56 return calc.code;
58} 57}
59 58
60notrace int 59int
61ftrace_modify_code(unsigned long ip, unsigned char *old_code, 60ftrace_modify_code(unsigned long ip, unsigned char *old_code,
62 unsigned char *new_code) 61 unsigned char *new_code)
63{ 62{
@@ -66,26 +65,31 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
66 /* 65 /*
67 * Note: Due to modules and __init, code can 66 * Note: Due to modules and __init, code can
68 * disappear and change, we need to protect against faulting 67 * disappear and change, we need to protect against faulting
69 * as well as code changing. 68 * as well as code changing. We do this by using the
69 * probe_kernel_* functions.
70 * 70 *
71 * No real locking needed, this code is run through 71 * No real locking needed, this code is run through
72 * kstop_machine, or before SMP starts. 72 * kstop_machine, or before SMP starts.
73 */ 73 */
74 if (__copy_from_user_inatomic(replaced, (char __user *)ip, MCOUNT_INSN_SIZE))
75 return 1;
76 74
75 /* read the text we want to modify */
76 if (probe_kernel_read(replaced, (void *)ip, MCOUNT_INSN_SIZE))
77 return -EFAULT;
78
79 /* Make sure it is what we expect it to be */
77 if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) 80 if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
78 return 2; 81 return -EINVAL;
79 82
80 WARN_ON_ONCE(__copy_to_user_inatomic((char __user *)ip, new_code, 83 /* replace the text with the new text */
81 MCOUNT_INSN_SIZE)); 84 if (probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE))
85 return -EPERM;
82 86
83 sync_core(); 87 sync_core();
84 88
85 return 0; 89 return 0;
86} 90}
87 91
88notrace int ftrace_update_ftrace_func(ftrace_func_t func) 92int ftrace_update_ftrace_func(ftrace_func_t func)
89{ 93{
90 unsigned long ip = (unsigned long)(&ftrace_call); 94 unsigned long ip = (unsigned long)(&ftrace_call);
91 unsigned char old[MCOUNT_INSN_SIZE], *new; 95 unsigned char old[MCOUNT_INSN_SIZE], *new;
@@ -98,13 +102,6 @@ notrace int ftrace_update_ftrace_func(ftrace_func_t func)
98 return ret; 102 return ret;
99} 103}
100 104
101notrace int ftrace_mcount_set(unsigned long *data)
102{
103 /* mcount is initialized as a nop */
104 *data = 0;
105 return 0;
106}
107
108int __init ftrace_dyn_arch_init(void *data) 105int __init ftrace_dyn_arch_init(void *data)
109{ 106{
110 extern const unsigned char ftrace_test_p6nop[]; 107 extern const unsigned char ftrace_test_p6nop[];
@@ -127,9 +124,6 @@ int __init ftrace_dyn_arch_init(void *data)
127 * TODO: check the cpuid to determine the best nop. 124 * TODO: check the cpuid to determine the best nop.
128 */ 125 */
129 asm volatile ( 126 asm volatile (
130 "jmp ftrace_test_jmp\n"
131 /* This code needs to stay around */
132 ".section .text, \"ax\"\n"
133 "ftrace_test_jmp:" 127 "ftrace_test_jmp:"
134 "jmp ftrace_test_p6nop\n" 128 "jmp ftrace_test_p6nop\n"
135 "nop\n" 129 "nop\n"
@@ -140,8 +134,6 @@ int __init ftrace_dyn_arch_init(void *data)
140 "jmp 1f\n" 134 "jmp 1f\n"
141 "ftrace_test_nop5:" 135 "ftrace_test_nop5:"
142 ".byte 0x66,0x66,0x66,0x66,0x90\n" 136 ".byte 0x66,0x66,0x66,0x66,0x90\n"
143 "jmp 1f\n"
144 ".previous\n"
145 "1:" 137 "1:"
146 ".section .fixup, \"ax\"\n" 138 ".section .fixup, \"ax\"\n"
147 "2: movl $1, %0\n" 139 "2: movl $1, %0\n"
@@ -156,15 +148,15 @@ int __init ftrace_dyn_arch_init(void *data)
156 switch (faulted) { 148 switch (faulted) {
157 case 0: 149 case 0:
158 pr_info("ftrace: converting mcount calls to 0f 1f 44 00 00\n"); 150 pr_info("ftrace: converting mcount calls to 0f 1f 44 00 00\n");
159 ftrace_nop = (unsigned long *)ftrace_test_p6nop; 151 memcpy(ftrace_nop, ftrace_test_p6nop, MCOUNT_INSN_SIZE);
160 break; 152 break;
161 case 1: 153 case 1:
162 pr_info("ftrace: converting mcount calls to 66 66 66 66 90\n"); 154 pr_info("ftrace: converting mcount calls to 66 66 66 66 90\n");
163 ftrace_nop = (unsigned long *)ftrace_test_nop5; 155 memcpy(ftrace_nop, ftrace_test_nop5, MCOUNT_INSN_SIZE);
164 break; 156 break;
165 case 2: 157 case 2:
166 pr_info("ftrace: converting mcount calls to jmp . + 5\n"); 158 pr_info("ftrace: converting mcount calls to jmp . + 5\n");
167 ftrace_nop = (unsigned long *)ftrace_test_jmp; 159 memcpy(ftrace_nop, ftrace_test_jmp, MCOUNT_INSN_SIZE);
168 break; 160 break;
169 } 161 }
170 162
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 680a06557c5e..2c7dbdb98278 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -15,7 +15,6 @@
15#include <linux/ctype.h> 15#include <linux/ctype.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/bootmem.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/hardirq.h> 19#include <linux/hardirq.h>
21#include <asm/smp.h> 20#include <asm/smp.h>
@@ -398,16 +397,16 @@ void __init uv_system_init(void)
398 printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades()); 397 printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades());
399 398
400 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades(); 399 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
401 uv_blade_info = alloc_bootmem_pages(bytes); 400 uv_blade_info = kmalloc(bytes, GFP_KERNEL);
402 401
403 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size); 402 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
404 403
405 bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes(); 404 bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes();
406 uv_node_to_blade = alloc_bootmem_pages(bytes); 405 uv_node_to_blade = kmalloc(bytes, GFP_KERNEL);
407 memset(uv_node_to_blade, 255, bytes); 406 memset(uv_node_to_blade, 255, bytes);
408 407
409 bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus(); 408 bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus();
410 uv_cpu_to_blade = alloc_bootmem_pages(bytes); 409 uv_cpu_to_blade = kmalloc(bytes, GFP_KERNEL);
411 memset(uv_cpu_to_blade, 255, bytes); 410 memset(uv_cpu_to_blade, 255, bytes);
412 411
413 blade = 0; 412 blade = 0;
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index dd7ebee446af..43cec6bdda63 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -5,7 +5,7 @@
5#include <asm/desc.h> 5#include <asm/desc.h>
6#include <asm/ftrace.h> 6#include <asm/ftrace.h>
7 7
8#ifdef CONFIG_FTRACE 8#ifdef CONFIG_FUNCTION_TRACER
9/* mcount is defined in assembly */ 9/* mcount is defined in assembly */
10EXPORT_SYMBOL(mcount); 10EXPORT_SYMBOL(mcount);
11#endif 11#endif
diff --git a/arch/x86/kernel/k8.c b/arch/x86/kernel/k8.c
index 304d8bad6559..cbc4332a77b2 100644
--- a/arch/x86/kernel/k8.c
+++ b/arch/x86/kernel/k8.c
@@ -18,7 +18,6 @@ static u32 *flush_words;
18struct pci_device_id k8_nb_ids[] = { 18struct pci_device_id k8_nb_ids[] = {
19 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, 19 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
20 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, 20 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
21 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
22 {} 21 {}
23}; 22};
24EXPORT_SYMBOL(k8_nb_ids); 23EXPORT_SYMBOL(k8_nb_ids);
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 0732adba05ca..7a385746509a 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -162,7 +162,10 @@ void machine_kexec(struct kimage *image)
162 page_list[VA_PTE_0] = (unsigned long)kexec_pte0; 162 page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
163 page_list[PA_PTE_1] = __pa(kexec_pte1); 163 page_list[PA_PTE_1] = __pa(kexec_pte1);
164 page_list[VA_PTE_1] = (unsigned long)kexec_pte1; 164 page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
165 page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT); 165
166 if (image->type == KEXEC_TYPE_DEFAULT)
167 page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
168 << PAGE_SHIFT);
166 169
167 /* The segment registers are funny things, they have both a 170 /* The segment registers are funny things, they have both a
168 * visible and an invisible part. Whenever the visible part is 171 * visible and an invisible part. Whenever the visible part is
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 7a1f8eeac2c7..5f8e5d75a254 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -39,7 +39,7 @@
39#include <asm/microcode.h> 39#include <asm/microcode.h>
40 40
41MODULE_DESCRIPTION("AMD Microcode Update Driver"); 41MODULE_DESCRIPTION("AMD Microcode Update Driver");
42MODULE_AUTHOR("Peter Oruba <peter.oruba@amd.com>"); 42MODULE_AUTHOR("Peter Oruba");
43MODULE_LICENSE("GPL v2"); 43MODULE_LICENSE("GPL v2");
44 44
45#define UCODE_MAGIC 0x00414d44 45#define UCODE_MAGIC 0x00414d44
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 936d8d55f230..82fb2809ce32 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -480,8 +480,8 @@ static int __init microcode_init(void)
480 480
481 printk(KERN_INFO 481 printk(KERN_INFO
482 "Microcode Update Driver: v" MICROCODE_VERSION 482 "Microcode Update Driver: v" MICROCODE_VERSION
483 " <tigran@aivazian.fsnet.co.uk>" 483 " <tigran@aivazian.fsnet.co.uk>,"
484 " <peter.oruba@amd.com>\n"); 484 " Peter Oruba\n");
485 485
486 return 0; 486 return 0;
487} 487}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 1972266e8ba5..192624820217 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -9,6 +9,8 @@
9#include <asm/calgary.h> 9#include <asm/calgary.h>
10#include <asm/amd_iommu.h> 10#include <asm/amd_iommu.h>
11 11
12static int forbid_dac __read_mostly;
13
12struct dma_mapping_ops *dma_ops; 14struct dma_mapping_ops *dma_ops;
13EXPORT_SYMBOL(dma_ops); 15EXPORT_SYMBOL(dma_ops);
14 16
@@ -291,3 +293,17 @@ void pci_iommu_shutdown(void)
291} 293}
292/* Must execute after PCI subsystem */ 294/* Must execute after PCI subsystem */
293fs_initcall(pci_iommu_init); 295fs_initcall(pci_iommu_init);
296
297#ifdef CONFIG_PCI
298/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
299
300static __devinit void via_no_dac(struct pci_dev *dev)
301{
302 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
303 printk(KERN_INFO "PCI: VIA PCI bridge detected."
304 "Disabling DAC.\n");
305 forbid_dac = 1;
306 }
307}
308DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
309#endif
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index e3f75bbcedea..a42b02b4df68 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -744,7 +744,7 @@ void __init gart_iommu_init(void)
744 long i; 744 long i;
745 745
746 if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) { 746 if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) {
747 printk(KERN_INFO "PCI-GART: No AMD northbridge found.\n"); 747 printk(KERN_INFO "PCI-GART: No AMD GART found.\n");
748 return; 748 return;
749 } 749 }
750 750
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index c4ce0332759e..3c539d111abb 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -18,9 +18,21 @@ swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size,
18 return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction); 18 return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction);
19} 19}
20 20
21static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
22 dma_addr_t *dma_handle, gfp_t flags)
23{
24 void *vaddr;
25
26 vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags);
27 if (vaddr)
28 return vaddr;
29
30 return swiotlb_alloc_coherent(hwdev, size, dma_handle, flags);
31}
32
21struct dma_mapping_ops swiotlb_dma_ops = { 33struct dma_mapping_ops swiotlb_dma_ops = {
22 .mapping_error = swiotlb_dma_mapping_error, 34 .mapping_error = swiotlb_dma_mapping_error,
23 .alloc_coherent = swiotlb_alloc_coherent, 35 .alloc_coherent = x86_swiotlb_alloc_coherent,
24 .free_coherent = swiotlb_free_coherent, 36 .free_coherent = swiotlb_free_coherent,
25 .map_single = swiotlb_map_single_phys, 37 .map_single = swiotlb_map_single_phys,
26 .unmap_single = swiotlb_unmap_single, 38 .unmap_single = swiotlb_unmap_single,
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 161bb850fc47..62348e4fd8d1 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -759,7 +759,7 @@ __cpuinit int unsynchronized_tsc(void)
759 if (!cpu_has_tsc || tsc_unstable) 759 if (!cpu_has_tsc || tsc_unstable)
760 return 1; 760 return 1;
761 761
762#ifdef CONFIG_SMP 762#ifdef CONFIG_X86_SMP
763 if (apic_is_clustered_box()) 763 if (apic_is_clustered_box())
764 return 1; 764 return 1;
765#endif 765#endif
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 7766d36983fc..a688f3bfaec2 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -78,7 +78,7 @@ static unsigned __init_or_module vsmp_patch(u8 type, u16 clobbers, void *ibuf,
78 78
79static void __init set_vsmp_pv_ops(void) 79static void __init set_vsmp_pv_ops(void)
80{ 80{
81 void *address; 81 void __iomem *address;
82 unsigned int cap, ctl, cfg; 82 unsigned int cap, ctl, cfg;
83 83
84 /* set vSMP magic bits to indicate vSMP capable kernel */ 84 /* set vSMP magic bits to indicate vSMP capable kernel */
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index b545f371b5f5..695e426aa354 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -12,7 +12,7 @@
12#include <asm/desc.h> 12#include <asm/desc.h>
13#include <asm/ftrace.h> 13#include <asm/ftrace.h>
14 14
15#ifdef CONFIG_FTRACE 15#ifdef CONFIG_FUNCTION_TRACER
16/* mcount is defined in assembly */ 16/* mcount is defined in assembly */
17EXPORT_SYMBOL(mcount); 17EXPORT_SYMBOL(mcount);
18#endif 18#endif
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 11c6725fb798..8772dc946823 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -545,6 +545,12 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
545 if (!pit) 545 if (!pit)
546 return NULL; 546 return NULL;
547 547
548 mutex_lock(&kvm->lock);
549 pit->irq_source_id = kvm_request_irq_source_id(kvm);
550 mutex_unlock(&kvm->lock);
551 if (pit->irq_source_id < 0)
552 return NULL;
553
548 mutex_init(&pit->pit_state.lock); 554 mutex_init(&pit->pit_state.lock);
549 mutex_lock(&pit->pit_state.lock); 555 mutex_lock(&pit->pit_state.lock);
550 spin_lock_init(&pit->pit_state.inject_lock); 556 spin_lock_init(&pit->pit_state.inject_lock);
@@ -587,6 +593,7 @@ void kvm_free_pit(struct kvm *kvm)
587 mutex_lock(&kvm->arch.vpit->pit_state.lock); 593 mutex_lock(&kvm->arch.vpit->pit_state.lock);
588 timer = &kvm->arch.vpit->pit_state.pit_timer.timer; 594 timer = &kvm->arch.vpit->pit_state.pit_timer.timer;
589 hrtimer_cancel(timer); 595 hrtimer_cancel(timer);
596 kvm_free_irq_source_id(kvm, kvm->arch.vpit->irq_source_id);
590 mutex_unlock(&kvm->arch.vpit->pit_state.lock); 597 mutex_unlock(&kvm->arch.vpit->pit_state.lock);
591 kfree(kvm->arch.vpit); 598 kfree(kvm->arch.vpit);
592 } 599 }
@@ -595,8 +602,8 @@ void kvm_free_pit(struct kvm *kvm)
595static void __inject_pit_timer_intr(struct kvm *kvm) 602static void __inject_pit_timer_intr(struct kvm *kvm)
596{ 603{
597 mutex_lock(&kvm->lock); 604 mutex_lock(&kvm->lock);
598 kvm_set_irq(kvm, 0, 1); 605 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1);
599 kvm_set_irq(kvm, 0, 0); 606 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0);
600 mutex_unlock(&kvm->lock); 607 mutex_unlock(&kvm->lock);
601} 608}
602 609
diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h
index e436d4983aa1..4178022b97aa 100644
--- a/arch/x86/kvm/i8254.h
+++ b/arch/x86/kvm/i8254.h
@@ -44,6 +44,7 @@ struct kvm_pit {
44 struct kvm_io_device speaker_dev; 44 struct kvm_io_device speaker_dev;
45 struct kvm *kvm; 45 struct kvm *kvm;
46 struct kvm_kpit_state pit_state; 46 struct kvm_kpit_state pit_state;
47 int irq_source_id;
47}; 48};
48 49
49#define KVM_PIT_BASE_ADDRESS 0x40 50#define KVM_PIT_BASE_ADDRESS 0x40
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 99c239c5c0ac..2a5e64881d9b 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2634,6 +2634,7 @@ static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu,
2634static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu) 2634static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu)
2635{ 2635{
2636 kvm_x86_ops->tlb_flush(vcpu); 2636 kvm_x86_ops->tlb_flush(vcpu);
2637 set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests);
2637 return 1; 2638 return 1;
2638} 2639}
2639 2640
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4f0677d1eae8..f1f8ff2f1fa2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1742,7 +1742,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
1742 goto out; 1742 goto out;
1743 if (irqchip_in_kernel(kvm)) { 1743 if (irqchip_in_kernel(kvm)) {
1744 mutex_lock(&kvm->lock); 1744 mutex_lock(&kvm->lock);
1745 kvm_set_irq(kvm, irq_event.irq, irq_event.level); 1745 kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
1746 irq_event.irq, irq_event.level);
1746 mutex_unlock(&kvm->lock); 1747 mutex_unlock(&kvm->lock);
1747 r = 0; 1748 r = 0;
1748 } 1749 }
@@ -4013,6 +4014,9 @@ struct kvm *kvm_arch_create_vm(void)
4013 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); 4014 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
4014 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 4015 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
4015 4016
4017 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */
4018 set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap);
4019
4016 return kvm; 4020 return kvm;
4017} 4021}
4018 4022
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 48ee4f9435f4..a5d8e1ace1cf 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -367,10 +367,9 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx,
367 * lazily after a task switch, and Linux uses that gratefully, but wouldn't a 367 * lazily after a task switch, and Linux uses that gratefully, but wouldn't a
368 * name like "FPUTRAP bit" be a little less cryptic? 368 * name like "FPUTRAP bit" be a little less cryptic?
369 * 369 *
370 * We store cr0 (and cr3) locally, because the Host never changes it. The 370 * We store cr0 locally because the Host never changes it. The Guest sometimes
371 * Guest sometimes wants to read it and we'd prefer not to bother the Host 371 * wants to read it and we'd prefer not to bother the Host unnecessarily. */
372 * unnecessarily. */ 372static unsigned long current_cr0;
373static unsigned long current_cr0, current_cr3;
374static void lguest_write_cr0(unsigned long val) 373static void lguest_write_cr0(unsigned long val)
375{ 374{
376 lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0); 375 lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0);
@@ -399,17 +398,23 @@ static unsigned long lguest_read_cr2(void)
399 return lguest_data.cr2; 398 return lguest_data.cr2;
400} 399}
401 400
401/* See lguest_set_pte() below. */
402static bool cr3_changed = false;
403
402/* cr3 is the current toplevel pagetable page: the principle is the same as 404/* cr3 is the current toplevel pagetable page: the principle is the same as
403 * cr0. Keep a local copy, and tell the Host when it changes. */ 405 * cr0. Keep a local copy, and tell the Host when it changes. The only
406 * difference is that our local copy is in lguest_data because the Host needs
407 * to set it upon our initial hypercall. */
404static void lguest_write_cr3(unsigned long cr3) 408static void lguest_write_cr3(unsigned long cr3)
405{ 409{
410 lguest_data.pgdir = cr3;
406 lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0); 411 lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0);
407 current_cr3 = cr3; 412 cr3_changed = true;
408} 413}
409 414
410static unsigned long lguest_read_cr3(void) 415static unsigned long lguest_read_cr3(void)
411{ 416{
412 return current_cr3; 417 return lguest_data.pgdir;
413} 418}
414 419
415/* cr4 is used to enable and disable PGE, but we don't care. */ 420/* cr4 is used to enable and disable PGE, but we don't care. */
@@ -498,13 +503,13 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
498 * to forget all of them. Fortunately, this is very rare. 503 * to forget all of them. Fortunately, this is very rare.
499 * 504 *
500 * ... except in early boot when the kernel sets up the initial pagetables, 505 * ... except in early boot when the kernel sets up the initial pagetables,
501 * which makes booting astonishingly slow. So we don't even tell the Host 506 * which makes booting astonishingly slow: 1.83 seconds! So we don't even tell
502 * anything changed until we've done the first page table switch. */ 507 * the Host anything changed until we've done the first page table switch,
508 * which brings boot back to 0.25 seconds. */
503static void lguest_set_pte(pte_t *ptep, pte_t pteval) 509static void lguest_set_pte(pte_t *ptep, pte_t pteval)
504{ 510{
505 *ptep = pteval; 511 *ptep = pteval;
506 /* Don't bother with hypercall before initial setup. */ 512 if (cr3_changed)
507 if (current_cr3)
508 lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0); 513 lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
509} 514}
510 515
@@ -521,7 +526,7 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval)
521static void lguest_flush_tlb_single(unsigned long addr) 526static void lguest_flush_tlb_single(unsigned long addr)
522{ 527{
523 /* Simply set it to zero: if it was not, it will fault back in. */ 528 /* Simply set it to zero: if it was not, it will fault back in. */
524 lazy_hcall(LHCALL_SET_PTE, current_cr3, addr, 0); 529 lazy_hcall(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0);
525} 530}
526 531
527/* This is what happens after the Guest has removed a large number of entries. 532/* This is what happens after the Guest has removed a large number of entries.
@@ -581,6 +586,9 @@ static void __init lguest_init_IRQ(void)
581 586
582 for (i = 0; i < LGUEST_IRQS; i++) { 587 for (i = 0; i < LGUEST_IRQS; i++) {
583 int vector = FIRST_EXTERNAL_VECTOR + i; 588 int vector = FIRST_EXTERNAL_VECTOR + i;
589 /* Some systems map "vectors" to interrupts weirdly. Lguest has
590 * a straightforward 1 to 1 mapping, so force that here. */
591 __get_cpu_var(vector_irq)[vector] = i;
584 if (vector != SYSCALL_VECTOR) { 592 if (vector != SYSCALL_VECTOR) {
585 set_intr_gate(vector, interrupt[vector]); 593 set_intr_gate(vector, interrupt[vector]);
586 set_irq_chip_and_handler_name(i, &lguest_irq_controller, 594 set_irq_chip_and_handler_name(i, &lguest_irq_controller,
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 0f6e8a6523ae..7f4c6af14351 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -90,6 +90,7 @@ static void ack_vic_irq(unsigned int irq);
90static void vic_enable_cpi(void); 90static void vic_enable_cpi(void);
91static void do_boot_cpu(__u8 cpuid); 91static void do_boot_cpu(__u8 cpuid);
92static void do_quad_bootstrap(void); 92static void do_quad_bootstrap(void);
93static void initialize_secondary(void);
93 94
94int hard_smp_processor_id(void); 95int hard_smp_processor_id(void);
95int safe_smp_processor_id(void); 96int safe_smp_processor_id(void);
@@ -344,6 +345,12 @@ static void do_quad_bootstrap(void)
344 } 345 }
345} 346}
346 347
348void prefill_possible_map(void)
349{
350 /* This is empty on voyager because we need a much
351 * earlier detection which is done in find_smp_config */
352}
353
347/* Set up all the basic stuff: read the SMP config and make all the 354/* Set up all the basic stuff: read the SMP config and make all the
348 * SMP information reflect only the boot cpu. All others will be 355 * SMP information reflect only the boot cpu. All others will be
349 * brought on-line later. */ 356 * brought on-line later. */
@@ -413,6 +420,7 @@ void __init smp_store_cpu_info(int id)
413 struct cpuinfo_x86 *c = &cpu_data(id); 420 struct cpuinfo_x86 *c = &cpu_data(id);
414 421
415 *c = boot_cpu_data; 422 *c = boot_cpu_data;
423 c->cpu_index = id;
416 424
417 identify_secondary_cpu(c); 425 identify_secondary_cpu(c);
418} 426}
@@ -650,6 +658,8 @@ void __init smp_boot_cpus(void)
650 smp_tune_scheduling(); 658 smp_tune_scheduling();
651 */ 659 */
652 smp_store_cpu_info(boot_cpu_id); 660 smp_store_cpu_info(boot_cpu_id);
661 /* setup the jump vector */
662 initial_code = (unsigned long)initialize_secondary;
653 printk("CPU%d: ", boot_cpu_id); 663 printk("CPU%d: ", boot_cpu_id);
654 print_cpu_info(&cpu_data(boot_cpu_id)); 664 print_cpu_info(&cpu_data(boot_cpu_id));
655 665
@@ -702,7 +712,7 @@ void __init smp_boot_cpus(void)
702 712
703/* Reload the secondary CPUs task structure (this function does not 713/* Reload the secondary CPUs task structure (this function does not
704 * return ) */ 714 * return ) */
705void __init initialize_secondary(void) 715static void __init initialize_secondary(void)
706{ 716{
707#if 0 717#if 0
708 // AC kernels only 718 // AC kernels only
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 4ba373c5b8c8..be54176e9eb2 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -233,7 +233,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
233 len = (unsigned long) nr_pages << PAGE_SHIFT; 233 len = (unsigned long) nr_pages << PAGE_SHIFT;
234 end = start + len; 234 end = start + len;
235 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, 235 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
236 start, len))) 236 (void __user *)start, len)))
237 goto slow_irqon; 237 goto slow_irqon;
238 238
239 /* 239 /*
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index b8e461d49412..9db01db6e3cd 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -350,8 +350,10 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,
350 * pagetable pages as RO. So assume someone who pre-setup 350 * pagetable pages as RO. So assume someone who pre-setup
351 * these mappings are more intelligent. 351 * these mappings are more intelligent.
352 */ 352 */
353 if (pte_val(*pte)) 353 if (pte_val(*pte)) {
354 pages++;
354 continue; 355 continue;
356 }
355 357
356 if (0) 358 if (0)
357 printk(" pte=%p addr=%lx pte=%016lx\n", 359 printk(" pte=%p addr=%lx pte=%016lx\n",
@@ -418,8 +420,10 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
418 * not differ with respect to page frame and 420 * not differ with respect to page frame and
419 * attributes. 421 * attributes.
420 */ 422 */
421 if (page_size_mask & (1 << PG_LEVEL_2M)) 423 if (page_size_mask & (1 << PG_LEVEL_2M)) {
424 pages++;
422 continue; 425 continue;
426 }
423 new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd)); 427 new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd));
424 } 428 }
425 429
@@ -499,8 +503,10 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
499 * not differ with respect to page frame and 503 * not differ with respect to page frame and
500 * attributes. 504 * attributes.
501 */ 505 */
502 if (page_size_mask & (1 << PG_LEVEL_1G)) 506 if (page_size_mask & (1 << PG_LEVEL_1G)) {
507 pages++;
503 continue; 508 continue;
509 }
504 prot = pte_pgprot(pte_clrhuge(*(pte_t *)pud)); 510 prot = pte_pgprot(pte_clrhuge(*(pte_t *)pud));
505 } 511 }
506 512
@@ -665,12 +671,13 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
665 unsigned long last_map_addr = 0; 671 unsigned long last_map_addr = 0;
666 unsigned long page_size_mask = 0; 672 unsigned long page_size_mask = 0;
667 unsigned long start_pfn, end_pfn; 673 unsigned long start_pfn, end_pfn;
674 unsigned long pos;
668 675
669 struct map_range mr[NR_RANGE_MR]; 676 struct map_range mr[NR_RANGE_MR];
670 int nr_range, i; 677 int nr_range, i;
671 int use_pse, use_gbpages; 678 int use_pse, use_gbpages;
672 679
673 printk(KERN_INFO "init_memory_mapping\n"); 680 printk(KERN_INFO "init_memory_mapping: %016lx-%016lx\n", start, end);
674 681
675 /* 682 /*
676 * Find space for the kernel direct mapping tables. 683 * Find space for the kernel direct mapping tables.
@@ -704,35 +711,50 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
704 711
705 /* head if not big page alignment ?*/ 712 /* head if not big page alignment ?*/
706 start_pfn = start >> PAGE_SHIFT; 713 start_pfn = start >> PAGE_SHIFT;
707 end_pfn = ((start + (PMD_SIZE - 1)) >> PMD_SHIFT) 714 pos = start_pfn << PAGE_SHIFT;
715 end_pfn = ((pos + (PMD_SIZE - 1)) >> PMD_SHIFT)
708 << (PMD_SHIFT - PAGE_SHIFT); 716 << (PMD_SHIFT - PAGE_SHIFT);
709 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); 717 if (start_pfn < end_pfn) {
718 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
719 pos = end_pfn << PAGE_SHIFT;
720 }
710 721
711 /* big page (2M) range*/ 722 /* big page (2M) range*/
712 start_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT) 723 start_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT)
713 << (PMD_SHIFT - PAGE_SHIFT); 724 << (PMD_SHIFT - PAGE_SHIFT);
714 end_pfn = ((start + (PUD_SIZE - 1))>>PUD_SHIFT) 725 end_pfn = ((pos + (PUD_SIZE - 1))>>PUD_SHIFT)
715 << (PUD_SHIFT - PAGE_SHIFT); 726 << (PUD_SHIFT - PAGE_SHIFT);
716 if (end_pfn > ((end>>PUD_SHIFT)<<(PUD_SHIFT - PAGE_SHIFT))) 727 if (end_pfn > ((end>>PMD_SHIFT)<<(PMD_SHIFT - PAGE_SHIFT)))
717 end_pfn = ((end>>PUD_SHIFT)<<(PUD_SHIFT - PAGE_SHIFT)); 728 end_pfn = ((end>>PMD_SHIFT)<<(PMD_SHIFT - PAGE_SHIFT));
718 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 729 if (start_pfn < end_pfn) {
719 page_size_mask & (1<<PG_LEVEL_2M)); 730 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
731 page_size_mask & (1<<PG_LEVEL_2M));
732 pos = end_pfn << PAGE_SHIFT;
733 }
720 734
721 /* big page (1G) range */ 735 /* big page (1G) range */
722 start_pfn = end_pfn; 736 start_pfn = ((pos + (PUD_SIZE - 1))>>PUD_SHIFT)
723 end_pfn = (end>>PUD_SHIFT) << (PUD_SHIFT - PAGE_SHIFT); 737 << (PUD_SHIFT - PAGE_SHIFT);
724 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 738 end_pfn = (end >> PUD_SHIFT) << (PUD_SHIFT - PAGE_SHIFT);
739 if (start_pfn < end_pfn) {
740 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
725 page_size_mask & 741 page_size_mask &
726 ((1<<PG_LEVEL_2M)|(1<<PG_LEVEL_1G))); 742 ((1<<PG_LEVEL_2M)|(1<<PG_LEVEL_1G)));
743 pos = end_pfn << PAGE_SHIFT;
744 }
727 745
728 /* tail is not big page (1G) alignment */ 746 /* tail is not big page (1G) alignment */
729 start_pfn = end_pfn; 747 start_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT)
730 end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT); 748 << (PMD_SHIFT - PAGE_SHIFT);
731 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 749 end_pfn = (end >> PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
732 page_size_mask & (1<<PG_LEVEL_2M)); 750 if (start_pfn < end_pfn) {
751 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
752 page_size_mask & (1<<PG_LEVEL_2M));
753 pos = end_pfn << PAGE_SHIFT;
754 }
733 755
734 /* tail is not big page (2M) alignment */ 756 /* tail is not big page (2M) alignment */
735 start_pfn = end_pfn; 757 start_pfn = pos>>PAGE_SHIFT;
736 end_pfn = end>>PAGE_SHIFT; 758 end_pfn = end>>PAGE_SHIFT;
737 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); 759 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
738 760
@@ -831,12 +853,12 @@ int arch_add_memory(int nid, u64 start, u64 size)
831 unsigned long nr_pages = size >> PAGE_SHIFT; 853 unsigned long nr_pages = size >> PAGE_SHIFT;
832 int ret; 854 int ret;
833 855
834 last_mapped_pfn = init_memory_mapping(start, start + size-1); 856 last_mapped_pfn = init_memory_mapping(start, start + size);
835 if (last_mapped_pfn > max_pfn_mapped) 857 if (last_mapped_pfn > max_pfn_mapped)
836 max_pfn_mapped = last_mapped_pfn; 858 max_pfn_mapped = last_mapped_pfn;
837 859
838 ret = __add_pages(zone, start_pfn, nr_pages); 860 ret = __add_pages(zone, start_pfn, nr_pages);
839 WARN_ON(1); 861 WARN_ON_ONCE(ret);
840 862
841 return ret; 863 return ret;
842} 864}
@@ -878,6 +900,7 @@ static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel,
878void __init mem_init(void) 900void __init mem_init(void)
879{ 901{
880 long codesize, reservedpages, datasize, initsize; 902 long codesize, reservedpages, datasize, initsize;
903 unsigned long absent_pages;
881 904
882 start_periodic_check_for_corruption(); 905 start_periodic_check_for_corruption();
883 906
@@ -893,8 +916,9 @@ void __init mem_init(void)
893#else 916#else
894 totalram_pages = free_all_bootmem(); 917 totalram_pages = free_all_bootmem();
895#endif 918#endif
896 reservedpages = max_pfn - totalram_pages - 919
897 absent_pages_in_range(0, max_pfn); 920 absent_pages = absent_pages_in_range(0, max_pfn);
921 reservedpages = max_pfn - totalram_pages - absent_pages;
898 after_bootmem = 1; 922 after_bootmem = 1;
899 923
900 codesize = (unsigned long) &_etext - (unsigned long) &_text; 924 codesize = (unsigned long) &_etext - (unsigned long) &_text;
@@ -911,10 +935,11 @@ void __init mem_init(void)
911 VSYSCALL_END - VSYSCALL_START); 935 VSYSCALL_END - VSYSCALL_START);
912 936
913 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 937 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
914 "%ldk reserved, %ldk data, %ldk init)\n", 938 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
915 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 939 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
916 max_pfn << (PAGE_SHIFT-10), 940 max_pfn << (PAGE_SHIFT-10),
917 codesize >> 10, 941 codesize >> 10,
942 absent_pages << (PAGE_SHIFT-10),
918 reservedpages << (PAGE_SHIFT-10), 943 reservedpages << (PAGE_SHIFT-10),
919 datasize >> 10, 944 datasize >> 10,
920 initsize >> 10); 945 initsize >> 10);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index ae71e11eb3e5..d4c4307ff3e0 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -387,7 +387,7 @@ static void __iomem *ioremap_default(resource_size_t phys_addr,
387 unsigned long size) 387 unsigned long size)
388{ 388{
389 unsigned long flags; 389 unsigned long flags;
390 void *ret; 390 void __iomem *ret;
391 int err; 391 int err;
392 392
393 /* 393 /*
@@ -399,11 +399,11 @@ static void __iomem *ioremap_default(resource_size_t phys_addr,
399 if (err < 0) 399 if (err < 0)
400 return NULL; 400 return NULL;
401 401
402 ret = (void *) __ioremap_caller(phys_addr, size, flags, 402 ret = __ioremap_caller(phys_addr, size, flags,
403 __builtin_return_address(0)); 403 __builtin_return_address(0));
404 404
405 free_memtype(phys_addr, phys_addr + size); 405 free_memtype(phys_addr, phys_addr + size);
406 return (void __iomem *)ret; 406 return ret;
407} 407}
408 408
409void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size, 409void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
@@ -622,7 +622,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)
622 __early_set_fixmap(idx, 0, __pgprot(0)); 622 __early_set_fixmap(idx, 0, __pgprot(0));
623} 623}
624 624
625static void *prev_map[FIX_BTMAPS_SLOTS] __initdata; 625static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata;
626static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata; 626static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata;
627static int __init check_early_ioremap_leak(void) 627static int __init check_early_ioremap_leak(void)
628{ 628{
@@ -645,7 +645,7 @@ static int __init check_early_ioremap_leak(void)
645} 645}
646late_initcall(check_early_ioremap_leak); 646late_initcall(check_early_ioremap_leak);
647 647
648static void __init *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot) 648static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot)
649{ 649{
650 unsigned long offset, last_addr; 650 unsigned long offset, last_addr;
651 unsigned int nrpages; 651 unsigned int nrpages;
@@ -713,23 +713,23 @@ static void __init *__early_ioremap(unsigned long phys_addr, unsigned long size,
713 if (early_ioremap_debug) 713 if (early_ioremap_debug)
714 printk(KERN_CONT "%08lx + %08lx\n", offset, fix_to_virt(idx0)); 714 printk(KERN_CONT "%08lx + %08lx\n", offset, fix_to_virt(idx0));
715 715
716 prev_map[slot] = (void *) (offset + fix_to_virt(idx0)); 716 prev_map[slot] = (void __iomem *)(offset + fix_to_virt(idx0));
717 return prev_map[slot]; 717 return prev_map[slot];
718} 718}
719 719
720/* Remap an IO device */ 720/* Remap an IO device */
721void __init *early_ioremap(unsigned long phys_addr, unsigned long size) 721void __init __iomem *early_ioremap(unsigned long phys_addr, unsigned long size)
722{ 722{
723 return __early_ioremap(phys_addr, size, PAGE_KERNEL_IO); 723 return __early_ioremap(phys_addr, size, PAGE_KERNEL_IO);
724} 724}
725 725
726/* Remap memory */ 726/* Remap memory */
727void __init *early_memremap(unsigned long phys_addr, unsigned long size) 727void __init __iomem *early_memremap(unsigned long phys_addr, unsigned long size)
728{ 728{
729 return __early_ioremap(phys_addr, size, PAGE_KERNEL); 729 return __early_ioremap(phys_addr, size, PAGE_KERNEL);
730} 730}
731 731
732void __init early_iounmap(void *addr, unsigned long size) 732void __init early_iounmap(void __iomem *addr, unsigned long size)
733{ 733{
734 unsigned long virt_addr; 734 unsigned long virt_addr;
735 unsigned long offset; 735 unsigned long offset;
@@ -779,7 +779,7 @@ void __init early_iounmap(void *addr, unsigned long size)
779 --idx; 779 --idx;
780 --nrpages; 780 --nrpages;
781 } 781 }
782 prev_map[slot] = 0; 782 prev_map[slot] = NULL;
783} 783}
784 784
785void __this_fixmap_does_not_exist(void) 785void __this_fixmap_does_not_exist(void)
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 738fd0f24958..eb1bf000d12e 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -481,12 +481,16 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
481 return 1; 481 return 1;
482} 482}
483#else 483#else
484/* This check is needed to avoid cache aliasing when PAT is enabled */
484static inline int range_is_allowed(unsigned long pfn, unsigned long size) 485static inline int range_is_allowed(unsigned long pfn, unsigned long size)
485{ 486{
486 u64 from = ((u64)pfn) << PAGE_SHIFT; 487 u64 from = ((u64)pfn) << PAGE_SHIFT;
487 u64 to = from + size; 488 u64 to = from + size;
488 u64 cursor = from; 489 u64 cursor = from;
489 490
491 if (!pat_enabled)
492 return 1;
493
490 while (cursor < to) { 494 while (cursor < to) {
491 if (!devmem_is_allowed(pfn)) { 495 if (!devmem_is_allowed(pfn)) {
492 printk(KERN_INFO 496 printk(KERN_INFO
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 313947940a1a..6dcefba7836f 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -1,4 +1,4 @@
1ifdef CONFIG_FTRACE 1ifdef CONFIG_FUNCTION_TRACER
2# Do not profile debug and lowlevel utilities 2# Do not profile debug and lowlevel utilities
3CFLAGS_REMOVE_spinlock.o = -pg 3CFLAGS_REMOVE_spinlock.o = -pg
4CFLAGS_REMOVE_time.o = -pg 4CFLAGS_REMOVE_time.o = -pg
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index d4d52f5a1cf7..aba77b2b7d18 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -246,11 +246,21 @@ xmaddr_t arbitrary_virt_to_machine(void *vaddr)
246{ 246{
247 unsigned long address = (unsigned long)vaddr; 247 unsigned long address = (unsigned long)vaddr;
248 unsigned int level; 248 unsigned int level;
249 pte_t *pte = lookup_address(address, &level); 249 pte_t *pte;
250 unsigned offset = address & ~PAGE_MASK; 250 unsigned offset;
251 251
252 BUG_ON(pte == NULL); 252 /*
253 * if the PFN is in the linear mapped vaddr range, we can just use
254 * the (quick) virt_to_machine() p2m lookup
255 */
256 if (virt_addr_valid(vaddr))
257 return virt_to_machine(vaddr);
253 258
259 /* otherwise we have to do a (slower) full page-table walk */
260
261 pte = lookup_address(address, &level);
262 BUG_ON(pte == NULL);
263 offset = address & ~PAGE_MASK;
254 return XMADDR(((phys_addr_t)pte_mfn(*pte) << PAGE_SHIFT) + offset); 264 return XMADDR(((phys_addr_t)pte_mfn(*pte) << PAGE_SHIFT) + offset);
255} 265}
256 266
@@ -410,7 +420,7 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
410 420
411 xen_mc_batch(); 421 xen_mc_batch();
412 422
413 u.ptr = virt_to_machine(ptep).maddr | MMU_PT_UPDATE_PRESERVE_AD; 423 u.ptr = arbitrary_virt_to_machine(ptep).maddr | MMU_PT_UPDATE_PRESERVE_AD;
414 u.val = pte_val_ma(pte); 424 u.val = pte_val_ma(pte);
415 xen_extend_mmu_update(&u); 425 xen_extend_mmu_update(&u);
416 426
diff --git a/drivers/Kconfig b/drivers/Kconfig
index d38f43f593d4..2f557f570ade 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -68,6 +68,8 @@ source "drivers/ssb/Kconfig"
68 68
69source "drivers/mfd/Kconfig" 69source "drivers/mfd/Kconfig"
70 70
71source "drivers/regulator/Kconfig"
72
71source "drivers/media/Kconfig" 73source "drivers/media/Kconfig"
72 74
73source "drivers/video/Kconfig" 75source "drivers/video/Kconfig"
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index aeadd00411a1..a67b8e7c712d 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -49,6 +49,17 @@
49#define DRV_NAME "ahci" 49#define DRV_NAME "ahci"
50#define DRV_VERSION "3.0" 50#define DRV_VERSION "3.0"
51 51
52/* Enclosure Management Control */
53#define EM_CTRL_MSG_TYPE 0x000f0000
54
55/* Enclosure Management LED Message Type */
56#define EM_MSG_LED_HBA_PORT 0x0000000f
57#define EM_MSG_LED_PMP_SLOT 0x0000ff00
58#define EM_MSG_LED_VALUE 0xffff0000
59#define EM_MSG_LED_VALUE_ACTIVITY 0x00070000
60#define EM_MSG_LED_VALUE_OFF 0xfff80000
61#define EM_MSG_LED_VALUE_ON 0x00010000
62
52static int ahci_skip_host_reset; 63static int ahci_skip_host_reset;
53module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); 64module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444);
54MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); 65MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)");
@@ -588,6 +599,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
588 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ 599 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
589 { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ 600 { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */
590 601
602 /* Promise */
603 { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
604
591 /* Generic, PCI class code for AHCI */ 605 /* Generic, PCI class code for AHCI */
592 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 606 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
593 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, 607 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -1220,18 +1234,20 @@ static void ahci_sw_activity_blink(unsigned long arg)
1220 struct ahci_em_priv *emp = &pp->em_priv[link->pmp]; 1234 struct ahci_em_priv *emp = &pp->em_priv[link->pmp];
1221 unsigned long led_message = emp->led_state; 1235 unsigned long led_message = emp->led_state;
1222 u32 activity_led_state; 1236 u32 activity_led_state;
1237 unsigned long flags;
1223 1238
1224 led_message &= 0xffff0000; 1239 led_message &= EM_MSG_LED_VALUE;
1225 led_message |= ap->port_no | (link->pmp << 8); 1240 led_message |= ap->port_no | (link->pmp << 8);
1226 1241
1227 /* check to see if we've had activity. If so, 1242 /* check to see if we've had activity. If so,
1228 * toggle state of LED and reset timer. If not, 1243 * toggle state of LED and reset timer. If not,
1229 * turn LED to desired idle state. 1244 * turn LED to desired idle state.
1230 */ 1245 */
1246 spin_lock_irqsave(ap->lock, flags);
1231 if (emp->saved_activity != emp->activity) { 1247 if (emp->saved_activity != emp->activity) {
1232 emp->saved_activity = emp->activity; 1248 emp->saved_activity = emp->activity;
1233 /* get the current LED state */ 1249 /* get the current LED state */
1234 activity_led_state = led_message & 0x00010000; 1250 activity_led_state = led_message & EM_MSG_LED_VALUE_ON;
1235 1251
1236 if (activity_led_state) 1252 if (activity_led_state)
1237 activity_led_state = 0; 1253 activity_led_state = 0;
@@ -1239,17 +1255,18 @@ static void ahci_sw_activity_blink(unsigned long arg)
1239 activity_led_state = 1; 1255 activity_led_state = 1;
1240 1256
1241 /* clear old state */ 1257 /* clear old state */
1242 led_message &= 0xfff8ffff; 1258 led_message &= ~EM_MSG_LED_VALUE_ACTIVITY;
1243 1259
1244 /* toggle state */ 1260 /* toggle state */
1245 led_message |= (activity_led_state << 16); 1261 led_message |= (activity_led_state << 16);
1246 mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); 1262 mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100));
1247 } else { 1263 } else {
1248 /* switch to idle */ 1264 /* switch to idle */
1249 led_message &= 0xfff8ffff; 1265 led_message &= ~EM_MSG_LED_VALUE_ACTIVITY;
1250 if (emp->blink_policy == BLINK_OFF) 1266 if (emp->blink_policy == BLINK_OFF)
1251 led_message |= (1 << 16); 1267 led_message |= (1 << 16);
1252 } 1268 }
1269 spin_unlock_irqrestore(ap->lock, flags);
1253 ahci_transmit_led_message(ap, led_message, 4); 1270 ahci_transmit_led_message(ap, led_message, 4);
1254} 1271}
1255 1272
@@ -1294,7 +1311,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1294 struct ahci_em_priv *emp; 1311 struct ahci_em_priv *emp;
1295 1312
1296 /* get the slot number from the message */ 1313 /* get the slot number from the message */
1297 pmp = (state & 0x0000ff00) >> 8; 1314 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
1298 if (pmp < MAX_SLOTS) 1315 if (pmp < MAX_SLOTS)
1299 emp = &pp->em_priv[pmp]; 1316 emp = &pp->em_priv[pmp];
1300 else 1317 else
@@ -1319,7 +1336,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1319 message[0] |= (4 << 8); 1336 message[0] |= (4 << 8);
1320 1337
1321 /* ignore 0:4 of byte zero, fill in port info yourself */ 1338 /* ignore 0:4 of byte zero, fill in port info yourself */
1322 message[1] = ((state & 0xfffffff0) | ap->port_no); 1339 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no);
1323 1340
1324 /* write message to EM_LOC */ 1341 /* write message to EM_LOC */
1325 writel(message[0], mmio + hpriv->em_loc); 1342 writel(message[0], mmio + hpriv->em_loc);
@@ -1362,7 +1379,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
1362 state = simple_strtoul(buf, NULL, 0); 1379 state = simple_strtoul(buf, NULL, 0);
1363 1380
1364 /* get the slot number from the message */ 1381 /* get the slot number from the message */
1365 pmp = (state & 0x0000ff00) >> 8; 1382 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
1366 if (pmp < MAX_SLOTS) 1383 if (pmp < MAX_SLOTS)
1367 emp = &pp->em_priv[pmp]; 1384 emp = &pp->em_priv[pmp];
1368 else 1385 else
@@ -1373,7 +1390,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
1373 * activity led through em_message 1390 * activity led through em_message
1374 */ 1391 */
1375 if (emp->blink_policy) 1392 if (emp->blink_policy)
1376 state &= 0xfff8ffff; 1393 state &= ~EM_MSG_LED_VALUE_ACTIVITY;
1377 1394
1378 return ahci_transmit_led_message(ap, state, size); 1395 return ahci_transmit_led_message(ap, state, size);
1379} 1396}
@@ -1392,16 +1409,16 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val)
1392 link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); 1409 link->flags &= ~(ATA_LFLAG_SW_ACTIVITY);
1393 1410
1394 /* set the LED to OFF */ 1411 /* set the LED to OFF */
1395 port_led_state &= 0xfff80000; 1412 port_led_state &= EM_MSG_LED_VALUE_OFF;
1396 port_led_state |= (ap->port_no | (link->pmp << 8)); 1413 port_led_state |= (ap->port_no | (link->pmp << 8));
1397 ahci_transmit_led_message(ap, port_led_state, 4); 1414 ahci_transmit_led_message(ap, port_led_state, 4);
1398 } else { 1415 } else {
1399 link->flags |= ATA_LFLAG_SW_ACTIVITY; 1416 link->flags |= ATA_LFLAG_SW_ACTIVITY;
1400 if (val == BLINK_OFF) { 1417 if (val == BLINK_OFF) {
1401 /* set LED to ON for idle */ 1418 /* set LED to ON for idle */
1402 port_led_state &= 0xfff80000; 1419 port_led_state &= EM_MSG_LED_VALUE_OFF;
1403 port_led_state |= (ap->port_no | (link->pmp << 8)); 1420 port_led_state |= (ap->port_no | (link->pmp << 8));
1404 port_led_state |= 0x00010000; /* check this */ 1421 port_led_state |= EM_MSG_LED_VALUE_ON; /* check this */
1405 ahci_transmit_led_message(ap, port_led_state, 4); 1422 ahci_transmit_led_message(ap, port_led_state, 4);
1406 } 1423 }
1407 } 1424 }
@@ -2612,7 +2629,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2612 u32 em_loc = readl(mmio + HOST_EM_LOC); 2629 u32 em_loc = readl(mmio + HOST_EM_LOC);
2613 u32 em_ctl = readl(mmio + HOST_EM_CTL); 2630 u32 em_ctl = readl(mmio + HOST_EM_CTL);
2614 2631
2615 messages = (em_ctl & 0x000f0000) >> 16; 2632 messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16;
2616 2633
2617 /* we only support LED message type right now */ 2634 /* we only support LED message type right now */
2618 if ((messages & 0x01) && (ahci_em_messages == 1)) { 2635 if ((messages & 0x01) && (ahci_em_messages == 1)) {
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 75a406f5e694..5c33767e66de 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * ata_generic.c - Generic PATA/SATA controller driver. 2 * ata_generic.c - Generic PATA/SATA controller driver.
3 * Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved. 3 * Copyright 2005 Red Hat Inc, all rights reserved.
4 * 4 *
5 * Elements from ide/pci/generic.c 5 * Elements from ide/pci/generic.c
6 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 6 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index e9e32ed6b1a3..52dc2d8b8f22 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -14,7 +14,7 @@
14 * 14 *
15 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 15 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
16 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 16 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
17 * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> 17 * Copyright (C) 2003 Red Hat Inc
18 * 18 *
19 * 19 *
20 * This program is free software; you can redistribute it and/or modify 20 * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8cb0b360bfd8..2ff633c119e2 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4156,29 +4156,33 @@ static int cable_is_40wire(struct ata_port *ap)
4156 struct ata_link *link; 4156 struct ata_link *link;
4157 struct ata_device *dev; 4157 struct ata_device *dev;
4158 4158
4159 /* If the controller thinks we are 40 wire, we are */ 4159 /* If the controller thinks we are 40 wire, we are. */
4160 if (ap->cbl == ATA_CBL_PATA40) 4160 if (ap->cbl == ATA_CBL_PATA40)
4161 return 1; 4161 return 1;
4162 /* If the controller thinks we are 80 wire, we are */ 4162
4163 /* If the controller thinks we are 80 wire, we are. */
4163 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) 4164 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA)
4164 return 0; 4165 return 0;
4165 /* If the system is known to be 40 wire short cable (eg laptop), 4166
4166 then we allow 80 wire modes even if the drive isn't sure */ 4167 /* If the system is known to be 40 wire short cable (eg
4168 * laptop), then we allow 80 wire modes even if the drive
4169 * isn't sure.
4170 */
4167 if (ap->cbl == ATA_CBL_PATA40_SHORT) 4171 if (ap->cbl == ATA_CBL_PATA40_SHORT)
4168 return 0; 4172 return 0;
4169 /* If the controller doesn't know we scan 4173
4170 4174 /* If the controller doesn't know, we scan.
4171 - Note: We look for all 40 wire detects at this point. 4175 *
4172 Any 80 wire detect is taken to be 80 wire cable 4176 * Note: We look for all 40 wire detects at this point. Any
4173 because 4177 * 80 wire detect is taken to be 80 wire cable because
4174 - In many setups only the one drive (slave if present) 4178 * - in many setups only the one drive (slave if present) will
4175 will give a valid detect 4179 * give a valid detect
4176 - If you have a non detect capable drive you don't 4180 * - if you have a non detect capable drive you don't want it
4177 want it to colour the choice 4181 * to colour the choice
4178 */ 4182 */
4179 ata_port_for_each_link(link, ap) { 4183 ata_port_for_each_link(link, ap) {
4180 ata_link_for_each_dev(dev, link) { 4184 ata_link_for_each_dev(dev, link) {
4181 if (!ata_is_40wire(dev)) 4185 if (ata_dev_enabled(dev) && !ata_is_40wire(dev))
4182 return 0; 4186 return 0;
4183 } 4187 }
4184 } 4188 }
@@ -4553,6 +4557,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
4553/** 4557/**
4554 * ata_qc_new_init - Request an available ATA command, and initialize it 4558 * ata_qc_new_init - Request an available ATA command, and initialize it
4555 * @dev: Device from whom we request an available command structure 4559 * @dev: Device from whom we request an available command structure
4560 * @tag: command tag
4556 * 4561 *
4557 * LOCKING: 4562 * LOCKING:
4558 * None. 4563 * None.
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5d687d7cffae..8077bdf5d30d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -603,6 +603,9 @@ void ata_scsi_error(struct Scsi_Host *host)
603 ata_link_for_each_dev(dev, link) { 603 ata_link_for_each_dev(dev, link) {
604 int devno = dev->devno; 604 int devno = dev->devno;
605 605
606 if (!ata_dev_enabled(dev))
607 continue;
608
606 ehc->saved_xfer_mode[devno] = dev->xfer_mode; 609 ehc->saved_xfer_mode[devno] = dev->xfer_mode;
607 if (ata_ncq_enabled(dev)) 610 if (ata_ncq_enabled(dev))
608 ehc->saved_ncq_enabled |= 1 << devno; 611 ehc->saved_ncq_enabled |= 1 << devno;
@@ -1161,6 +1164,7 @@ void ata_eh_detach_dev(struct ata_device *dev)
1161{ 1164{
1162 struct ata_link *link = dev->link; 1165 struct ata_link *link = dev->link;
1163 struct ata_port *ap = link->ap; 1166 struct ata_port *ap = link->ap;
1167 struct ata_eh_context *ehc = &link->eh_context;
1164 unsigned long flags; 1168 unsigned long flags;
1165 1169
1166 ata_dev_disable(dev); 1170 ata_dev_disable(dev);
@@ -1174,9 +1178,11 @@ void ata_eh_detach_dev(struct ata_device *dev)
1174 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; 1178 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
1175 } 1179 }
1176 1180
1177 /* clear per-dev EH actions */ 1181 /* clear per-dev EH info */
1178 ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); 1182 ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK);
1179 ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); 1183 ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK);
1184 ehc->saved_xfer_mode[dev->devno] = 0;
1185 ehc->saved_ncq_enabled &= ~(1 << dev->devno);
1180 1186
1181 spin_unlock_irqrestore(ap->lock, flags); 1187 spin_unlock_irqrestore(ap->lock, flags);
1182} 1188}
@@ -2787,6 +2793,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2787 2793
2788 /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ 2794 /* if data transfer is verified, clear DUBIOUS_XFER on ering top */
2789 ata_link_for_each_dev(dev, link) { 2795 ata_link_for_each_dev(dev, link) {
2796 if (!ata_dev_enabled(dev))
2797 continue;
2798
2790 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { 2799 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) {
2791 struct ata_ering_entry *ent; 2800 struct ata_ering_entry *ent;
2792 2801
@@ -2808,6 +2817,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2808 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; 2817 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno];
2809 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); 2818 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno));
2810 2819
2820 if (!ata_dev_enabled(dev))
2821 continue;
2822
2811 if (dev->xfer_mode != saved_xfer_mode || 2823 if (dev->xfer_mode != saved_xfer_mode ||
2812 ata_ncq_enabled(dev) != saved_ncq) 2824 ata_ncq_enabled(dev) != saved_ncq)
2813 dev->flags |= ATA_DFLAG_DUBIOUS_XFER; 2825 dev->flags |= ATA_DFLAG_DUBIOUS_XFER;
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 4b95c4387e9e..bbb30d882f05 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1107,6 +1107,15 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
1107 1107
1108 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); 1108 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
1109 depth = min(ATA_MAX_QUEUE - 1, depth); 1109 depth = min(ATA_MAX_QUEUE - 1, depth);
1110
1111 /*
1112 * If this device is behind a port multiplier, we have
1113 * to share the tag map between all devices on that PMP.
1114 * Set up the shared tag map here and we get automatic.
1115 */
1116 if (dev->link->ap->pmp_link)
1117 scsi_init_shared_tag_map(sdev->host, ATA_MAX_QUEUE - 1);
1118
1110 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); 1119 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
1111 scsi_activate_tcq(sdev, depth); 1120 scsi_activate_tcq(sdev, depth);
1112 } 1121 }
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index eb919c16a03e..e2e332d8ff95 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * ACPI PATA driver 2 * ACPI PATA driver
3 * 3 *
4 * (c) 2007 Red Hat <alan@redhat.com> 4 * (c) 2007 Red Hat
5 */ 5 */
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 5ca70fa1f587..73c466e452ca 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_ali.c - ALI 15x3 PATA for new ATA layer 2 * pata_ali.c - ALI 15x3 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based in part upon 5 * based in part upon
7 * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 6 * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 57dd00f463d3..0ec9c7d9fe9d 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_amd.c - AMD PATA for new ATA layer 2 * pata_amd.c - AMD PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based on pata-sil680. Errata information is taken from data sheets 5 * Based on pata-sil680. Errata information is taken from data sheets
7 * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are 6 * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 0f513bc11193..6b3092c75ffe 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_artop.c - ARTOP ATA controller driver 2 * pata_artop.c - ARTOP ATA controller driver
3 * 3 *
4 * (C) 2006 Red Hat <alan@redhat.com> 4 * (C) 2006 Red Hat
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based in part on drivers/ide/pci/aec62xx.c 7 * Based in part on drivers/ide/pci/aec62xx.c
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index e8a0d99d7356..0e2cde8f9973 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_atiixp.c - ATI PATA for new ATA layer 2 * pata_atiixp.c - ATI PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based on 5 * Based on
7 * 6 *
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 2de30b990278..34a394264c3d 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_cmd640.c - CMD640 PCI PATA for new ATA layer 2 * pata_cmd640.c - CMD640 PCI PATA for new ATA layer
3 * (C) 2007 Red Hat Inc 3 * (C) 2007 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based upon 5 * Based upon
7 * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996 6 * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index ddd09b7d98c9..3167d8fed2f2 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_cmd64x.c - CMD64x PATA for new ATA layer 2 * pata_cmd64x.c - CMD64x PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * Based upon 6 * Based upon
7 * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 7 * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 0c4b271a9d5a..bba453381f44 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata-cs5530.c - CS5530 PATA for new ATA layer 2 * pata-cs5530.c - CS5530 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based upon cs5530.c by Mark Lord. 5 * based upon cs5530.c by Mark Lord.
7 * 6 *
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index f1b6556f0483..1b2d4a0f5f74 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata-cs5535.c - CS5535 PATA for new ATA layer 2 * pata-cs5535.c - CS5535 PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and 6 * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and
7 * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de 7 * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index 2ff62608ae37..d546425cd380 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_cypress.c - Cypress PATA for new ATA layer 2 * pata_cypress.c - Cypress PATA for new ATA layer
3 * (C) 2006 Red Hat Inc 3 * (C) 2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox
5 * 5 *
6 * Based heavily on 6 * Based heavily on
7 * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 7 * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index 9fba82976ba6..ac6392ea35b0 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_efar.c - EFAR PIIX clone controller driver 2 * pata_efar.c - EFAR PIIX clone controller driver
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat
5 * 5 *
6 * Some parts based on ata_piix.c by Jeff Garzik and others. 6 * Some parts based on ata_piix.c by Jeff Garzik and others.
7 * 7 *
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 6a111baab523..15cdb9148aab 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -1,7 +1,7 @@
1 1
2/* 2/*
3 * pata-isapnp.c - ISA PnP PATA controller driver. 3 * pata-isapnp.c - ISA PnP PATA controller driver.
4 * Copyright 2005/2006 Red Hat Inc <alan@redhat.com>, all rights reserved. 4 * Copyright 2005/2006 Red Hat Inc, all rights reserved.
5 * 5 *
6 * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru> 6 * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru>
7 */ 7 */
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 0221c9a46769..860ede526282 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_it821x.c - IT821x PATA for new ATA layer 2 * pata_it821x.c - IT821x PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * based upon 7 * based upon
@@ -10,7 +10,7 @@
10 * 10 *
11 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 11 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004
12 * 12 *
13 * Copyright (C) 2004 Red Hat <alan@redhat.com> 13 * Copyright (C) 2004 Red Hat
14 * 14 *
15 * May be copied or modified under the terms of the GNU General Public License 15 * May be copied or modified under the terms of the GNU General Public License
16 * Based in part on the ITE vendor provided SCSI driver. 16 * Based in part on the ITE vendor provided SCSI driver.
@@ -557,9 +557,8 @@ static unsigned int it821x_read_id(struct ata_device *adev,
557 if (strstr(model_num, "Integrated Technology Express")) { 557 if (strstr(model_num, "Integrated Technology Express")) {
558 /* Set feature bits the firmware neglects */ 558 /* Set feature bits the firmware neglects */
559 id[49] |= 0x0300; /* LBA, DMA */ 559 id[49] |= 0x0300; /* LBA, DMA */
560 id[82] |= 0x0400; /* LBA48 */
561 id[83] &= 0x7FFF; 560 id[83] &= 0x7FFF;
562 id[83] |= 0x4000; /* Word 83 is valid */ 561 id[83] |= 0x4400; /* Word 83 is valid and LBA48 */
563 id[86] |= 0x0400; /* LBA48 on */ 562 id[86] |= 0x0400; /* LBA48 on */
564 id[ATA_ID_MAJOR_VER] |= 0x1F; 563 id[ATA_ID_MAJOR_VER] |= 0x1F;
565 } 564 }
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 73b7596816b4..38cf1ab2d289 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -4,7 +4,7 @@
4 * driven by AHCI in the usual configuration although 4 * driven by AHCI in the usual configuration although
5 * this driver can handle other setups if we need it. 5 * this driver can handle other setups if we need it.
6 * 6 *
7 * (c) 2006 Red Hat <alan@redhat.com> 7 * (c) 2006 Red Hat
8 */ 8 */
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index bc037ffce200..930c2208640b 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata-legacy.c - Legacy port PATA/SATA controller driver. 2 * pata-legacy.c - Legacy port PATA/SATA controller driver.
3 * Copyright 2005/2006 Red Hat <alan@redhat.com>, all rights reserved. 3 * Copyright 2005/2006 Red Hat, all rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 0d87eec84966..76e399bf8c1b 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -5,7 +5,7 @@
5 * isn't making full use of the device functionality but it is 5 * isn't making full use of the device functionality but it is
6 * easy to get working. 6 * easy to get working.
7 * 7 *
8 * (c) 2006 Red Hat <alan@redhat.com> 8 * (c) 2006 Red Hat
9 */ 9 */
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index 7d7e3fdab71f..7c8faa48b5f3 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_mpiix.c - Intel MPIIX PATA for new ATA layer 2 * pata_mpiix.c - Intel MPIIX PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * The MPIIX is different enough to the PIIX4 and friends that we give it 6 * The MPIIX is different enough to the PIIX4 and friends that we give it
7 * a separate driver. The old ide/pci code handles this by just not tuning 7 * a separate driver. The old ide/pci code handles this by just not tuning
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index d9719c8b9dbe..9dc05e1656a8 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_netcell.c - Netcell PATA driver 2 * pata_netcell.c - Netcell PATA driver
3 * 3 *
4 * (c) 2006 Red Hat <alan@redhat.com> 4 * (c) 2006 Red Hat
5 */ 5 */
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c
index 565e67cd13fa..4e466eae8b46 100644
--- a/drivers/ata/pata_ninja32.c
+++ b/drivers/ata/pata_ninja32.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_ninja32.c - Ninja32 PATA for new ATA layer 2 * pata_ninja32.c - Ninja32 PATA for new ATA layer
3 * (C) 2007 Red Hat Inc 3 * (C) 2007 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Note: The controller like many controllers has shared timings for 5 * Note: The controller like many controllers has shared timings for
7 * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back 6 * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back
@@ -45,7 +44,7 @@
45#include <linux/libata.h> 44#include <linux/libata.h>
46 45
47#define DRV_NAME "pata_ninja32" 46#define DRV_NAME "pata_ninja32"
48#define DRV_VERSION "0.0.1" 47#define DRV_VERSION "0.1.1"
49 48
50 49
51/** 50/**
@@ -89,6 +88,17 @@ static struct ata_port_operations ninja32_port_ops = {
89 .set_piomode = ninja32_set_piomode, 88 .set_piomode = ninja32_set_piomode,
90}; 89};
91 90
91static void ninja32_program(void __iomem *base)
92{
93 iowrite8(0x05, base + 0x01); /* Enable interrupt lines */
94 iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */
95 iowrite8(0x01, base + 0x03); /* Unknown */
96 iowrite8(0x20, base + 0x04); /* WAIT0 */
97 iowrite8(0x8f, base + 0x05); /* Unknown */
98 iowrite8(0xa4, base + 0x1c); /* Unknown */
99 iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */
100}
101
92static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) 102static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)
93{ 103{
94 struct ata_host *host; 104 struct ata_host *host;
@@ -134,18 +144,28 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)
134 ap->ioaddr.bmdma_addr = base; 144 ap->ioaddr.bmdma_addr = base;
135 ata_sff_std_ports(&ap->ioaddr); 145 ata_sff_std_ports(&ap->ioaddr);
136 146
137 iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ 147 ninja32_program(base);
138 iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */
139 iowrite8(0x01, base + 0x03); /* Unknown */
140 iowrite8(0x20, base + 0x04); /* WAIT0 */
141 iowrite8(0x8f, base + 0x05); /* Unknown */
142 iowrite8(0xa4, base + 0x1c); /* Unknown */
143 iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */
144 /* FIXME: Should we disable them at remove ? */ 148 /* FIXME: Should we disable them at remove ? */
145 return ata_host_activate(host, dev->irq, ata_sff_interrupt, 149 return ata_host_activate(host, dev->irq, ata_sff_interrupt,
146 IRQF_SHARED, &ninja32_sht); 150 IRQF_SHARED, &ninja32_sht);
147} 151}
148 152
153#ifdef CONFIG_PM
154
155static int ninja32_reinit_one(struct pci_dev *pdev)
156{
157 struct ata_host *host = dev_get_drvdata(&pdev->dev);
158 int rc;
159
160 rc = ata_pci_device_do_resume(pdev);
161 if (rc)
162 return rc;
163 ninja32_program(host->iomap[0]);
164 ata_host_resume(host);
165 return 0;
166}
167#endif
168
149static const struct pci_device_id ninja32[] = { 169static const struct pci_device_id ninja32[] = {
150 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 170 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
151 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 171 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -156,7 +176,11 @@ static struct pci_driver ninja32_pci_driver = {
156 .name = DRV_NAME, 176 .name = DRV_NAME,
157 .id_table = ninja32, 177 .id_table = ninja32,
158 .probe = ninja32_init_one, 178 .probe = ninja32_init_one,
159 .remove = ata_pci_remove_one 179 .remove = ata_pci_remove_one,
180#ifdef CONFIG_PM
181 .suspend = ata_pci_device_suspend,
182 .resume = ninja32_reinit_one,
183#endif
160}; 184};
161 185
162static int __init ninja32_init(void) 186static int __init ninja32_init(void)
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index be756b7ef07e..40d411c460de 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer 2 * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer
3 * (C) 2006 Red Hat Inc 3 * (C) 2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index e0aa7eaaee0a..89bf5f865d6a 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_ns87415.c - NS87415 (non PARISC) PATA 2 * pata_ns87415.c - NS87415 (non PARISC) PATA
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * This is a fairly generic MWDMA controller. It has some limitations 6 * This is a fairly generic MWDMA controller. It has some limitations
7 * as it requires timing reloads on PIO/DMA transitions but it is otherwise 7 * as it requires timing reloads on PIO/DMA transitions but it is otherwise
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index df64f2443001..c0dbc46a348e 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_oldpiix.c - Intel PATA/SATA controllers 2 * pata_oldpiix.c - Intel PATA/SATA controllers
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat
5 * 5 *
6 * Some parts based on ata_piix.c by Jeff Garzik and others. 6 * Some parts based on ata_piix.c by Jeff Garzik and others.
7 * 7 *
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index fb2cf661b0e8..e4fa4d565e96 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_opti.c - ATI PATA for new ATA layer 2 * pata_opti.c - ATI PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based on 5 * Based on
7 * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 6 * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 4cd744456313..93bb6e91973f 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_optidma.c - Opti DMA PATA for new ATA layer 2 * pata_optidma.c - Opti DMA PATA for new ATA layer
3 * (C) 2006 Red Hat Inc 3 * (C) 2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * The Opti DMA controllers are related to the older PIO PCI controllers 5 * The Opti DMA controllers are related to the older PIO PCI controllers
7 * and indeed the VLB ones. The main differences are that the timing 6 * and indeed the VLB ones. The main differences are that the timing
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 02b596b9cf6a..271cb64d429e 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata_pcmcia.c - PCMCIA PATA controller driver. 2 * pata_pcmcia.c - PCMCIA PATA controller driver.
3 * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. 3 * Copyright 2005-2006 Red Hat Inc, all rights reserved.
4 * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz 4 * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz
5 * <openembedded@hrw.one.pl> 5 * <openembedded@hrw.one.pl>
6 * 6 *
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index d2673060bc8d..799a6a098712 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer 2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c 7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 8f65ad61b8af..77e4e3b17f54 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Based on pata_pcmcia: 6 * Based on pata_pcmcia:
7 * 7 *
8 * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. 8 * Copyright 2005-2006 Red Hat Inc, all rights reserved.
9 * 9 *
10 * This file is subject to the terms and conditions of the GNU General Public 10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive 11 * License. See the file "COPYING" in the main directory of this archive
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 63b7a1c165a5..3080f371222c 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata_qdi.c - QDI VLB ATA controllers 2 * pata_qdi.c - QDI VLB ATA controllers
3 * (C) 2006 Red Hat <alan@redhat.com> 3 * (C) 2006 Red Hat
4 * 4 *
5 * This driver mostly exists as a proof of concept for non PCI devices under 5 * This driver mostly exists as a proof of concept for non PCI devices under
6 * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly 6 * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index 1c0d9fa7ee54..0b0aa452de14 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_radisys.c - Intel PATA/SATA controllers 2 * pata_radisys.c - Intel PATA/SATA controllers
3 * 3 *
4 * (C) 2006 Red Hat <alan@redhat.com> 4 * (C) 2006 Red Hat <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * Some parts based on ata_piix.c by Jeff Garzik and others. 6 * Some parts based on ata_piix.c by Jeff Garzik and others.
7 * 7 *
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 0278fd2b8fb1..9a4bdca54616 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * New ATA layer SC1200 driver Alan Cox <alan@redhat.com> 2 * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk>
3 * 3 *
4 * TODO: Mode selection filtering 4 * TODO: Mode selection filtering
5 * TODO: Can't enable second channel until ATA core has serialize 5 * TODO: Can't enable second channel until ATA core has serialize
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 16673d168573..cf3707e516a2 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -8,7 +8,7 @@
8 * Copyright 2003-2005 Jeff Garzik 8 * Copyright 2003-2005 Jeff Garzik
9 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 9 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
10 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 10 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
11 * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> 11 * Copyright (C) 2003 Red Hat Inc
12 * 12 *
13 * and drivers/ata/ahci.c: 13 * and drivers/ata/ahci.c:
14 * Copyright 2004-2005 Red Hat, Inc. 14 * Copyright 2004-2005 Red Hat, Inc.
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index ffd26d0dc50d..72e41c9f969b 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_serverworks.c - Serverworks PATA for new ATA layer 2 * pata_serverworks.c - Serverworks PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based upon 5 * based upon
7 * 6 *
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index a598bb36aafc..83580a59db58 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_sil680.c - SIL680 PATA for new ATA layer 2 * pata_sil680.c - SIL680 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based upon 5 * based upon
7 * 6 *
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 26345d7b531c..d34236611752 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_sis.c - SiS ATA driver 2 * pata_sis.c - SiS ATA driver
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based upon linux/drivers/ide/pci/sis5513.c 7 * Based upon linux/drivers/ide/pci/sis5513.c
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 69877bd81815..1b0e7b6d8ef5 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_sl82c105.c - SL82C105 PATA for new ATA layer 2 * pata_sl82c105.c - SL82C105 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based in part on linux/drivers/ide/pci/sl82c105.c 5 * Based in part on linux/drivers/ide/pci/sl82c105.c
7 * SL82C105/Winbond 553 IDE driver 6 * SL82C105/Winbond 553 IDE driver
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index b181261f2743..ef9597517cdd 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_triflex.c - Compaq PATA for new ATA layer 2 * pata_triflex.c - Compaq PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * based upon 6 * based upon
7 * 7 *
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 8fdb2ce73210..681169c9c640 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_via.c - VIA PATA for new ATA layer 2 * pata_via.c - VIA PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Documentation 5 * Documentation
7 * Most chipset documentation available under NDA only 6 * Most chipset documentation available under NDA only
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index a7606b044a61..319e164a3d74 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata_winbond.c - Winbond VLB ATA controllers 2 * pata_winbond.c - Winbond VLB ATA controllers
3 * (C) 2006 Red Hat <alan@redhat.com> 3 * (C) 2006 Red Hat
4 * 4 *
5 * Support for the Winbond 83759A when operating in advanced mode. 5 * Support for the Winbond 83759A when operating in advanced mode.
6 * Multichip mode is not currently supported. 6 * Multichip mode is not currently supported.
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 4621807a1a6a..ccee930f1e12 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1329,6 +1329,11 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1329 } 1329 }
1330 } 1330 }
1331 1331
1332 /* Set max read request size to 4096. This slightly increases
1333 * write throughput for pci-e variants.
1334 */
1335 pcie_set_readrq(pdev, 4096);
1336
1332 sil24_init_controller(host); 1337 sil24_init_controller(host);
1333 1338
1334 pci_set_master(pdev); 1339 pci_set_master(pdev);
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 75dd6e22faff..c98c31ec2f75 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -355,7 +355,7 @@ static void __sysdev_resume(struct sys_device *dev)
355 * sysdev_suspend - Suspend all system devices. 355 * sysdev_suspend - Suspend all system devices.
356 * @state: Power state to enter. 356 * @state: Power state to enter.
357 * 357 *
358 * We perform an almost identical operation as sys_device_shutdown() 358 * We perform an almost identical operation as sysdev_shutdown()
359 * above, though calling ->suspend() instead. Interrupts are disabled 359 * above, though calling ->suspend() instead. Interrupts are disabled
360 * when this called. Devices are responsible for both saving state and 360 * when this called. Devices are responsible for both saving state and
361 * quiescing or powering down the device. 361 * quiescing or powering down the device.
@@ -437,7 +437,7 @@ aux_driver:
437/** 437/**
438 * sysdev_resume - Bring system devices back to life. 438 * sysdev_resume - Bring system devices back to life.
439 * 439 *
440 * Similar to sys_device_suspend(), but we iterate the list forwards 440 * Similar to sysdev_suspend(), but we iterate the list forwards
441 * to guarantee that parent devices are resumed before their children. 441 * to guarantee that parent devices are resumed before their children.
442 * 442 *
443 * Note: Interrupts are disabled when called. 443 * Note: Interrupts are disabled when called.
@@ -488,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
488 if (end == buf) 488 if (end == buf)
489 return -EINVAL; 489 return -EINVAL;
490 *(unsigned long *)(ea->var) = new; 490 *(unsigned long *)(ea->var) = new;
491 return end - buf; 491 /* Always return full write size even if we didn't consume all */
492 return size;
492} 493}
493EXPORT_SYMBOL_GPL(sysdev_store_ulong); 494EXPORT_SYMBOL_GPL(sysdev_store_ulong);
494 495
@@ -511,7 +512,8 @@ ssize_t sysdev_store_int(struct sys_device *sysdev,
511 if (end == buf || new > INT_MAX || new < INT_MIN) 512 if (end == buf || new > INT_MAX || new < INT_MIN)
512 return -EINVAL; 513 return -EINVAL;
513 *(int *)(ea->var) = new; 514 *(int *)(ea->var) = new;
514 return end - buf; 515 /* Always return full write size even if we didn't consume all */
516 return size;
515} 517}
516EXPORT_SYMBOL_GPL(sysdev_store_int); 518EXPORT_SYMBOL_GPL(sysdev_store_int);
517 519
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 3f09cd8bcc38..5c4ee70d5cf3 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -40,8 +40,7 @@
40 * Heinz Mauelshagen <mge@sistina.com>, Feb 2002 40 * Heinz Mauelshagen <mge@sistina.com>, Feb 2002
41 * 41 *
42 * Support for falling back on the write file operation when the address space 42 * Support for falling back on the write file operation when the address space
43 * operations prepare_write and/or commit_write are not available on the 43 * operations write_begin is not available on the backing filesystem.
44 * backing filesystem.
45 * Anton Altaparmakov, 16 Feb 2005 44 * Anton Altaparmakov, 16 Feb 2005
46 * 45 *
47 * Still To Fix: 46 * Still To Fix:
@@ -765,7 +764,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
765 */ 764 */
766 if (!file->f_op->splice_read) 765 if (!file->f_op->splice_read)
767 goto out_putf; 766 goto out_putf;
768 if (aops->prepare_write || aops->write_begin) 767 if (aops->write_begin)
769 lo_flags |= LO_FLAGS_USE_AOPS; 768 lo_flags |= LO_FLAGS_USE_AOPS;
770 if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write) 769 if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
771 lo_flags |= LO_FLAGS_READ_ONLY; 770 lo_flags |= LO_FLAGS_READ_ONLY;
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index e6ee21d99d92..b0e569ba730d 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -867,7 +867,7 @@ static int bluecard_probe(struct pcmcia_device *link)
867 867
868 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 868 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
869 link->io.NumPorts1 = 8; 869 link->io.NumPorts1 = 8;
870 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 870 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
871 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 871 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
872 872
873 link->irq.Handler = bluecard_interrupt; 873 link->irq.Handler = bluecard_interrupt;
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 2cbe70b66470..b3e4d07a4ac2 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -343,6 +343,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
343 bt3c_info_t *info = dev_inst; 343 bt3c_info_t *info = dev_inst;
344 unsigned int iobase; 344 unsigned int iobase;
345 int iir; 345 int iir;
346 irqreturn_t r = IRQ_NONE;
346 347
347 BUG_ON(!info->hdev); 348 BUG_ON(!info->hdev);
348 349
@@ -374,11 +375,12 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
374 375
375 outb(iir, iobase + CONTROL); 376 outb(iir, iobase + CONTROL);
376 } 377 }
378 r = IRQ_HANDLED;
377 } 379 }
378 380
379 spin_unlock(&(info->lock)); 381 spin_unlock(&(info->lock));
380 382
381 return IRQ_HANDLED; 383 return r;
382} 384}
383 385
384 386
@@ -657,7 +659,7 @@ static int bt3c_probe(struct pcmcia_device *link)
657 659
658 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 660 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
659 link->io.NumPorts1 = 8; 661 link->io.NumPorts1 = 8;
660 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 662 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
661 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 663 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
662 664
663 link->irq.Handler = bt3c_interrupt; 665 link->irq.Handler = bt3c_interrupt;
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 8e556b7ff9f6..efd689a062eb 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -293,6 +293,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
293 unsigned int iobase; 293 unsigned int iobase;
294 int boguscount = 0; 294 int boguscount = 0;
295 int iir, lsr; 295 int iir, lsr;
296 irqreturn_t r = IRQ_NONE;
296 297
297 BUG_ON(!info->hdev); 298 BUG_ON(!info->hdev);
298 299
@@ -302,6 +303,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
302 303
303 iir = inb(iobase + UART_IIR) & UART_IIR_ID; 304 iir = inb(iobase + UART_IIR) & UART_IIR_ID;
304 while (iir) { 305 while (iir) {
306 r = IRQ_HANDLED;
305 307
306 /* Clear interrupt */ 308 /* Clear interrupt */
307 lsr = inb(iobase + UART_LSR); 309 lsr = inb(iobase + UART_LSR);
@@ -335,7 +337,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
335 337
336 spin_unlock(&(info->lock)); 338 spin_unlock(&(info->lock));
337 339
338 return IRQ_HANDLED; 340 return r;
339} 341}
340 342
341 343
@@ -586,7 +588,7 @@ static int btuart_probe(struct pcmcia_device *link)
586 588
587 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 589 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
588 link->io.NumPorts1 = 8; 590 link->io.NumPorts1 = 8;
589 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 591 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
590 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 592 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
591 593
592 link->irq.Handler = btuart_interrupt; 594 link->irq.Handler = btuart_interrupt;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index e6e6b037695a..901bdd95655f 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -297,6 +297,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
297 unsigned char msr; 297 unsigned char msr;
298 int boguscount = 0; 298 int boguscount = 0;
299 int iir, lsr; 299 int iir, lsr;
300 irqreturn_t r = IRQ_NONE;
300 301
301 BUG_ON(!info->hdev); 302 BUG_ON(!info->hdev);
302 303
@@ -307,6 +308,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
307 iir = inb(iobase + UART_IIR) & UART_IIR_ID; 308 iir = inb(iobase + UART_IIR) & UART_IIR_ID;
308 while (iir) { 309 while (iir) {
309 310
311 r = IRQ_HANDLED;
310 /* Clear interrupt */ 312 /* Clear interrupt */
311 lsr = inb(iobase + UART_LSR); 313 lsr = inb(iobase + UART_LSR);
312 314
@@ -343,11 +345,12 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
343 info->ri_latch = msr & UART_MSR_RI; 345 info->ri_latch = msr & UART_MSR_RI;
344 clear_bit(XMIT_WAITING, &(info->tx_state)); 346 clear_bit(XMIT_WAITING, &(info->tx_state));
345 dtl1_write_wakeup(info); 347 dtl1_write_wakeup(info);
348 r = IRQ_HANDLED;
346 } 349 }
347 350
348 spin_unlock(&(info->lock)); 351 spin_unlock(&(info->lock));
349 352
350 return IRQ_HANDLED; 353 return r;
351} 354}
352 355
353 356
@@ -568,7 +571,7 @@ static int dtl1_probe(struct pcmcia_device *link)
568 571
569 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 572 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
570 link->io.NumPorts1 = 8; 573 link->io.NumPorts1 = 8;
571 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 574 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
572 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 575 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
573 576
574 link->irq.Handler = dtl1_interrupt; 577 link->irq.Handler = dtl1_interrupt;
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 122254155ae1..43b35d0369d6 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -812,28 +812,6 @@ config JS_RTC
812 To compile this driver as a module, choose M here: the 812 To compile this driver as a module, choose M here: the
813 module will be called js-rtc. 813 module will be called js-rtc.
814 814
815config SGI_DS1286
816 tristate "SGI DS1286 RTC support"
817 depends on SGI_HAS_DS1286
818 help
819 If you say Y here and create a character special file /dev/rtc with
820 major number 10 and minor number 135 using mknod ("man mknod"), you
821 will get access to the real time clock built into your computer.
822 Every SGI has such a clock built in. It reports status information
823 via the file /proc/rtc and its behaviour is set by various ioctls on
824 /dev/rtc.
825
826config SGI_IP27_RTC
827 bool "SGI M48T35 RTC support"
828 depends on SGI_IP27
829 help
830 If you say Y here and create a character special file /dev/rtc with
831 major number 10 and minor number 135 using mknod ("man mknod"), you
832 will get access to the real time clock built into your computer.
833 Every SGI has such a clock built in. It reports status information
834 via the file /proc/rtc and its behaviour is set by various ioctls on
835 /dev/rtc.
836
837config GEN_RTC 815config GEN_RTC
838 tristate "Generic /dev/rtc emulation" 816 tristate "Generic /dev/rtc emulation"
839 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32 817 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 1a4247dccac4..438f71317c5c 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_RTC) += rtc.o
74obj-$(CONFIG_HPET) += hpet.o 74obj-$(CONFIG_HPET) += hpet.o
75obj-$(CONFIG_GEN_RTC) += genrtc.o 75obj-$(CONFIG_GEN_RTC) += genrtc.o
76obj-$(CONFIG_EFI_RTC) += efirtc.o 76obj-$(CONFIG_EFI_RTC) += efirtc.o
77obj-$(CONFIG_SGI_DS1286) += ds1286.o
78obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o
79obj-$(CONFIG_DS1302) += ds1302.o 77obj-$(CONFIG_DS1302) += ds1302.o
80obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ 78obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/
81ifeq ($(CONFIG_GENERIC_NVRAM),y) 79ifeq ($(CONFIG_GENERIC_NVRAM),y)
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
deleted file mode 100644
index 0a826d7be10e..000000000000
--- a/drivers/char/ds1286.c
+++ /dev/null
@@ -1,585 +0,0 @@
1/*
2 * DS1286 Real Time Clock interface for Linux
3 *
4 * Copyright (C) 1998, 1999, 2000 Ralf Baechle
5 *
6 * Based on code written by Paul Gortmaker.
7 *
8 * This driver allows use of the real time clock (built into nearly all
9 * computers) from user space. It exports the /dev/rtc interface supporting
10 * various ioctl() and also the /proc/rtc pseudo-file for status
11 * information.
12 *
13 * The ioctls can be used to set the interrupt behaviour and generation rate
14 * from the RTC via IRQ 8. Then the /dev/rtc interface can be used to make
15 * use of these timer interrupts, be they interval or alarm based.
16 *
17 * The /dev/rtc interface will block on reads until an interrupt has been
18 * received. If a RTC interrupt has already happened, it will output an
19 * unsigned long and then block. The output value contains the interrupt
20 * status in the low byte and the number of interrupts since the last read
21 * in the remaining high bytes. The /dev/rtc interface can also be used with
22 * the select(2) call.
23 *
24 * This program is free software; you can redistribute it and/or modify it
25 * under the terms of the GNU General Public License as published by the
26 * Free Software Foundation; either version 2 of the License, or (at your
27 * option) any later version.
28 */
29#include <linux/ds1286.h>
30#include <linux/smp_lock.h>
31#include <linux/types.h>
32#include <linux/errno.h>
33#include <linux/miscdevice.h>
34#include <linux/slab.h>
35#include <linux/ioport.h>
36#include <linux/fcntl.h>
37#include <linux/init.h>
38#include <linux/poll.h>
39#include <linux/rtc.h>
40#include <linux/spinlock.h>
41#include <linux/bcd.h>
42#include <linux/proc_fs.h>
43#include <linux/jiffies.h>
44
45#include <asm/uaccess.h>
46#include <asm/system.h>
47
48#define DS1286_VERSION "1.0"
49
50/*
51 * We sponge a minor off of the misc major. No need slurping
52 * up another valuable major dev number for this. If you add
53 * an ioctl, make sure you don't conflict with SPARC's RTC
54 * ioctls.
55 */
56
57static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait);
58
59static ssize_t ds1286_read(struct file *file, char *buf,
60 size_t count, loff_t *ppos);
61
62static int ds1286_ioctl(struct inode *inode, struct file *file,
63 unsigned int cmd, unsigned long arg);
64
65static unsigned int ds1286_poll(struct file *file, poll_table *wait);
66
67static void ds1286_get_alm_time (struct rtc_time *alm_tm);
68static void ds1286_get_time(struct rtc_time *rtc_tm);
69static int ds1286_set_time(struct rtc_time *rtc_tm);
70
71static inline unsigned char ds1286_is_updating(void);
72
73static DEFINE_SPINLOCK(ds1286_lock);
74
75static int ds1286_read_proc(char *page, char **start, off_t off,
76 int count, int *eof, void *data);
77
78/*
79 * Bits in rtc_status. (7 bits of room for future expansion)
80 */
81
82#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */
83#define RTC_TIMER_ON 0x02 /* missed irq timer active */
84
85static unsigned char ds1286_status; /* bitmapped status byte. */
86
87static unsigned char days_in_mo[] = {
88 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
89};
90
91/*
92 * Now all the various file operations that we export.
93 */
94
95static ssize_t ds1286_read(struct file *file, char *buf,
96 size_t count, loff_t *ppos)
97{
98 return -EIO;
99}
100
101static int ds1286_ioctl(struct inode *inode, struct file *file,
102 unsigned int cmd, unsigned long arg)
103{
104 struct rtc_time wtime;
105
106 switch (cmd) {
107 case RTC_AIE_OFF: /* Mask alarm int. enab. bit */
108 {
109 unsigned long flags;
110 unsigned char val;
111
112 if (!capable(CAP_SYS_TIME))
113 return -EACCES;
114
115 spin_lock_irqsave(&ds1286_lock, flags);
116 val = rtc_read(RTC_CMD);
117 val |= RTC_TDM;
118 rtc_write(val, RTC_CMD);
119 spin_unlock_irqrestore(&ds1286_lock, flags);
120
121 return 0;
122 }
123 case RTC_AIE_ON: /* Allow alarm interrupts. */
124 {
125 unsigned long flags;
126 unsigned char val;
127
128 if (!capable(CAP_SYS_TIME))
129 return -EACCES;
130
131 spin_lock_irqsave(&ds1286_lock, flags);
132 val = rtc_read(RTC_CMD);
133 val &= ~RTC_TDM;
134 rtc_write(val, RTC_CMD);
135 spin_unlock_irqrestore(&ds1286_lock, flags);
136
137 return 0;
138 }
139 case RTC_WIE_OFF: /* Mask watchdog int. enab. bit */
140 {
141 unsigned long flags;
142 unsigned char val;
143
144 if (!capable(CAP_SYS_TIME))
145 return -EACCES;
146
147 spin_lock_irqsave(&ds1286_lock, flags);
148 val = rtc_read(RTC_CMD);
149 val |= RTC_WAM;
150 rtc_write(val, RTC_CMD);
151 spin_unlock_irqrestore(&ds1286_lock, flags);
152
153 return 0;
154 }
155 case RTC_WIE_ON: /* Allow watchdog interrupts. */
156 {
157 unsigned long flags;
158 unsigned char val;
159
160 if (!capable(CAP_SYS_TIME))
161 return -EACCES;
162
163 spin_lock_irqsave(&ds1286_lock, flags);
164 val = rtc_read(RTC_CMD);
165 val &= ~RTC_WAM;
166 rtc_write(val, RTC_CMD);
167 spin_unlock_irqrestore(&ds1286_lock, flags);
168
169 return 0;
170 }
171 case RTC_ALM_READ: /* Read the present alarm time */
172 {
173 /*
174 * This returns a struct rtc_time. Reading >= 0xc0
175 * means "don't care" or "match all". Only the tm_hour,
176 * tm_min, and tm_sec values are filled in.
177 */
178
179 memset(&wtime, 0, sizeof(wtime));
180 ds1286_get_alm_time(&wtime);
181 break;
182 }
183 case RTC_ALM_SET: /* Store a time into the alarm */
184 {
185 /*
186 * This expects a struct rtc_time. Writing 0xff means
187 * "don't care" or "match all". Only the tm_hour,
188 * tm_min and tm_sec are used.
189 */
190 unsigned char hrs, min, sec;
191 struct rtc_time alm_tm;
192
193 if (!capable(CAP_SYS_TIME))
194 return -EACCES;
195
196 if (copy_from_user(&alm_tm, (struct rtc_time*)arg,
197 sizeof(struct rtc_time)))
198 return -EFAULT;
199
200 hrs = alm_tm.tm_hour;
201 min = alm_tm.tm_min;
202 sec = alm_tm.tm_sec;
203
204 if (hrs >= 24)
205 hrs = 0xff;
206
207 if (min >= 60)
208 min = 0xff;
209
210 if (sec != 0)
211 return -EINVAL;
212
213 min = bin2bcd(min);
214 min = bin2bcd(hrs);
215
216 spin_lock(&ds1286_lock);
217 rtc_write(hrs, RTC_HOURS_ALARM);
218 rtc_write(min, RTC_MINUTES_ALARM);
219 spin_unlock(&ds1286_lock);
220
221 return 0;
222 }
223 case RTC_RD_TIME: /* Read the time/date from RTC */
224 {
225 memset(&wtime, 0, sizeof(wtime));
226 ds1286_get_time(&wtime);
227 break;
228 }
229 case RTC_SET_TIME: /* Set the RTC */
230 {
231 struct rtc_time rtc_tm;
232
233 if (!capable(CAP_SYS_TIME))
234 return -EACCES;
235
236 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
237 sizeof(struct rtc_time)))
238 return -EFAULT;
239
240 return ds1286_set_time(&rtc_tm);
241 }
242 default:
243 return -EINVAL;
244 }
245 return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
246}
247
248/*
249 * We enforce only one user at a time here with the open/close.
250 * Also clear the previous interrupt data on an open, and clean
251 * up things on a close.
252 */
253
254static int ds1286_open(struct inode *inode, struct file *file)
255{
256 lock_kernel();
257 spin_lock_irq(&ds1286_lock);
258
259 if (ds1286_status & RTC_IS_OPEN)
260 goto out_busy;
261
262 ds1286_status |= RTC_IS_OPEN;
263
264 spin_unlock_irq(&ds1286_lock);
265 unlock_kernel();
266 return 0;
267
268out_busy:
269 spin_lock_irq(&ds1286_lock);
270 unlock_kernel();
271 return -EBUSY;
272}
273
274static int ds1286_release(struct inode *inode, struct file *file)
275{
276 ds1286_status &= ~RTC_IS_OPEN;
277
278 return 0;
279}
280
281static unsigned int ds1286_poll(struct file *file, poll_table *wait)
282{
283 poll_wait(file, &ds1286_wait, wait);
284
285 return 0;
286}
287
288/*
289 * The various file operations we support.
290 */
291
292static const struct file_operations ds1286_fops = {
293 .llseek = no_llseek,
294 .read = ds1286_read,
295 .poll = ds1286_poll,
296 .ioctl = ds1286_ioctl,
297 .open = ds1286_open,
298 .release = ds1286_release,
299};
300
301static struct miscdevice ds1286_dev=
302{
303 .minor = RTC_MINOR,
304 .name = "rtc",
305 .fops = &ds1286_fops,
306};
307
308static int __init ds1286_init(void)
309{
310 int err;
311
312 printk(KERN_INFO "DS1286 Real Time Clock Driver v%s\n", DS1286_VERSION);
313
314 err = misc_register(&ds1286_dev);
315 if (err)
316 goto out;
317
318 if (!create_proc_read_entry("driver/rtc", 0, 0, ds1286_read_proc, NULL)) {
319 err = -ENOMEM;
320
321 goto out_deregister;
322 }
323
324 return 0;
325
326out_deregister:
327 misc_deregister(&ds1286_dev);
328
329out:
330 return err;
331}
332
333static void __exit ds1286_exit(void)
334{
335 remove_proc_entry("driver/rtc", NULL);
336 misc_deregister(&ds1286_dev);
337}
338
339static char *days[] = {
340 "***", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
341};
342
343/*
344 * Info exported via "/proc/rtc".
345 */
346static int ds1286_proc_output(char *buf)
347{
348 char *p, *s;
349 struct rtc_time tm;
350 unsigned char hundredth, month, cmd, amode;
351
352 p = buf;
353
354 ds1286_get_time(&tm);
355 hundredth = rtc_read(RTC_HUNDREDTH_SECOND);
356 hundredth = bcd2bin(hundredth);
357
358 p += sprintf(p,
359 "rtc_time\t: %02d:%02d:%02d.%02d\n"
360 "rtc_date\t: %04d-%02d-%02d\n",
361 tm.tm_hour, tm.tm_min, tm.tm_sec, hundredth,
362 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
363
364 /*
365 * We implicitly assume 24hr mode here. Alarm values >= 0xc0 will
366 * match any value for that particular field. Values that are
367 * greater than a valid time, but less than 0xc0 shouldn't appear.
368 */
369 ds1286_get_alm_time(&tm);
370 p += sprintf(p, "alarm\t\t: %s ", days[tm.tm_wday]);
371 if (tm.tm_hour <= 24)
372 p += sprintf(p, "%02d:", tm.tm_hour);
373 else
374 p += sprintf(p, "**:");
375
376 if (tm.tm_min <= 59)
377 p += sprintf(p, "%02d\n", tm.tm_min);
378 else
379 p += sprintf(p, "**\n");
380
381 month = rtc_read(RTC_MONTH);
382 p += sprintf(p,
383 "oscillator\t: %s\n"
384 "square_wave\t: %s\n",
385 (month & RTC_EOSC) ? "disabled" : "enabled",
386 (month & RTC_ESQW) ? "disabled" : "enabled");
387
388 amode = ((rtc_read(RTC_MINUTES_ALARM) & 0x80) >> 5) |
389 ((rtc_read(RTC_HOURS_ALARM) & 0x80) >> 6) |
390 ((rtc_read(RTC_DAY_ALARM) & 0x80) >> 7);
391 if (amode == 7) s = "each minute";
392 else if (amode == 3) s = "minutes match";
393 else if (amode == 1) s = "hours and minutes match";
394 else if (amode == 0) s = "days, hours and minutes match";
395 else s = "invalid";
396 p += sprintf(p, "alarm_mode\t: %s\n", s);
397
398 cmd = rtc_read(RTC_CMD);
399 p += sprintf(p,
400 "alarm_enable\t: %s\n"
401 "wdog_alarm\t: %s\n"
402 "alarm_mask\t: %s\n"
403 "wdog_alarm_mask\t: %s\n"
404 "interrupt_mode\t: %s\n"
405 "INTB_mode\t: %s_active\n"
406 "interrupt_pins\t: %s\n",
407 (cmd & RTC_TDF) ? "yes" : "no",
408 (cmd & RTC_WAF) ? "yes" : "no",
409 (cmd & RTC_TDM) ? "disabled" : "enabled",
410 (cmd & RTC_WAM) ? "disabled" : "enabled",
411 (cmd & RTC_PU_LVL) ? "pulse" : "level",
412 (cmd & RTC_IBH_LO) ? "low" : "high",
413 (cmd & RTC_IPSW) ? "unswapped" : "swapped");
414
415 return p - buf;
416}
417
418static int ds1286_read_proc(char *page, char **start, off_t off,
419 int count, int *eof, void *data)
420{
421 int len = ds1286_proc_output (page);
422 if (len <= off+count) *eof = 1;
423 *start = page + off;
424 len -= off;
425 if (len>count)
426 len = count;
427 if (len<0)
428 len = 0;
429
430 return len;
431}
432
433/*
434 * Returns true if a clock update is in progress
435 */
436static inline unsigned char ds1286_is_updating(void)
437{
438 return rtc_read(RTC_CMD) & RTC_TE;
439}
440
441
442static void ds1286_get_time(struct rtc_time *rtc_tm)
443{
444 unsigned char save_control;
445 unsigned long flags;
446
447 /*
448 * read RTC once any update in progress is done. The update
449 * can take just over 2ms. We wait 10 to 20ms. There is no need to
450 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
451 * If you need to know *exactly* when a second has started, enable
452 * periodic update complete interrupts, (via ioctl) and then
453 * immediately read /dev/rtc which will block until you get the IRQ.
454 * Once the read clears, read the RTC time (again via ioctl). Easy.
455 */
456
457 if (ds1286_is_updating() != 0)
458 msleep(20);
459
460 /*
461 * Only the values that we read from the RTC are set. We leave
462 * tm_wday, tm_yday and tm_isdst untouched. Even though the
463 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
464 * by the RTC when initially set to a non-zero value.
465 */
466 spin_lock_irqsave(&ds1286_lock, flags);
467 save_control = rtc_read(RTC_CMD);
468 rtc_write((save_control|RTC_TE), RTC_CMD);
469
470 rtc_tm->tm_sec = rtc_read(RTC_SECONDS);
471 rtc_tm->tm_min = rtc_read(RTC_MINUTES);
472 rtc_tm->tm_hour = rtc_read(RTC_HOURS) & 0x3f;
473 rtc_tm->tm_mday = rtc_read(RTC_DATE);
474 rtc_tm->tm_mon = rtc_read(RTC_MONTH) & 0x1f;
475 rtc_tm->tm_year = rtc_read(RTC_YEAR);
476
477 rtc_write(save_control, RTC_CMD);
478 spin_unlock_irqrestore(&ds1286_lock, flags);
479
480 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
481 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
482 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
483 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
484 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
485 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
486
487 /*
488 * Account for differences between how the RTC uses the values
489 * and how they are defined in a struct rtc_time;
490 */
491 if (rtc_tm->tm_year < 45)
492 rtc_tm->tm_year += 30;
493 if ((rtc_tm->tm_year += 40) < 70)
494 rtc_tm->tm_year += 100;
495
496 rtc_tm->tm_mon--;
497}
498
499static int ds1286_set_time(struct rtc_time *rtc_tm)
500{
501 unsigned char mon, day, hrs, min, sec, leap_yr;
502 unsigned char save_control;
503 unsigned int yrs;
504 unsigned long flags;
505
506
507 yrs = rtc_tm->tm_year + 1900;
508 mon = rtc_tm->tm_mon + 1; /* tm_mon starts at zero */
509 day = rtc_tm->tm_mday;
510 hrs = rtc_tm->tm_hour;
511 min = rtc_tm->tm_min;
512 sec = rtc_tm->tm_sec;
513
514 if (yrs < 1970)
515 return -EINVAL;
516
517 leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400));
518
519 if ((mon > 12) || (day == 0))
520 return -EINVAL;
521
522 if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr)))
523 return -EINVAL;
524
525 if ((hrs >= 24) || (min >= 60) || (sec >= 60))
526 return -EINVAL;
527
528 if ((yrs -= 1940) > 255) /* They are unsigned */
529 return -EINVAL;
530
531 if (yrs >= 100)
532 yrs -= 100;
533
534 sec = bin2bcd(sec);
535 min = bin2bcd(min);
536 hrs = bin2bcd(hrs);
537 day = bin2bcd(day);
538 mon = bin2bcd(mon);
539 yrs = bin2bcd(yrs);
540
541 spin_lock_irqsave(&ds1286_lock, flags);
542 save_control = rtc_read(RTC_CMD);
543 rtc_write((save_control|RTC_TE), RTC_CMD);
544
545 rtc_write(yrs, RTC_YEAR);
546 rtc_write(mon, RTC_MONTH);
547 rtc_write(day, RTC_DATE);
548 rtc_write(hrs, RTC_HOURS);
549 rtc_write(min, RTC_MINUTES);
550 rtc_write(sec, RTC_SECONDS);
551 rtc_write(0, RTC_HUNDREDTH_SECOND);
552
553 rtc_write(save_control, RTC_CMD);
554 spin_unlock_irqrestore(&ds1286_lock, flags);
555
556 return 0;
557}
558
559static void ds1286_get_alm_time(struct rtc_time *alm_tm)
560{
561 unsigned char cmd;
562 unsigned long flags;
563
564 /*
565 * Only the values that we read from the RTC are set. That
566 * means only tm_wday, tm_hour, tm_min.
567 */
568 spin_lock_irqsave(&ds1286_lock, flags);
569 alm_tm->tm_min = rtc_read(RTC_MINUTES_ALARM) & 0x7f;
570 alm_tm->tm_hour = rtc_read(RTC_HOURS_ALARM) & 0x1f;
571 alm_tm->tm_wday = rtc_read(RTC_DAY_ALARM) & 0x07;
572 cmd = rtc_read(RTC_CMD);
573 spin_unlock_irqrestore(&ds1286_lock, flags);
574
575 alm_tm->tm_min = bcd2bin(alm_tm->tm_min);
576 alm_tm->tm_hour = bcd2bin(alm_tm->tm_hour);
577 alm_tm->tm_sec = 0;
578}
579
580module_init(ds1286_init);
581module_exit(ds1286_exit);
582
583MODULE_AUTHOR("Ralf Baechle");
584MODULE_LICENSE("GPL");
585MODULE_ALIAS_MISCDEV(RTC_MINOR);
diff --git a/drivers/char/ip27-rtc.c b/drivers/char/ip27-rtc.c
deleted file mode 100644
index 2abd881b4cbc..000000000000
--- a/drivers/char/ip27-rtc.c
+++ /dev/null
@@ -1,329 +0,0 @@
1/*
2 * Driver for the SGS-Thomson M48T35 Timekeeper RAM chip
3 *
4 * Real Time Clock interface for Linux
5 *
6 * TODO: Implement periodic interrupts.
7 *
8 * Copyright (C) 2000 Silicon Graphics, Inc.
9 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
10 *
11 * Based on code written by Paul Gortmaker.
12 *
13 * This driver allows use of the real time clock (built into
14 * nearly all computers) from user space. It exports the /dev/rtc
15 * interface supporting various ioctl() and also the /proc/rtc
16 * pseudo-file for status information.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 *
23 */
24
25#define RTC_VERSION "1.09b"
26
27#include <linux/bcd.h>
28#include <linux/module.h>
29#include <linux/kernel.h>
30#include <linux/smp_lock.h>
31#include <linux/types.h>
32#include <linux/miscdevice.h>
33#include <linux/ioport.h>
34#include <linux/fcntl.h>
35#include <linux/rtc.h>
36#include <linux/init.h>
37#include <linux/poll.h>
38#include <linux/proc_fs.h>
39
40#include <asm/m48t35.h>
41#include <asm/sn/ioc3.h>
42#include <asm/io.h>
43#include <asm/uaccess.h>
44#include <asm/system.h>
45#include <asm/sn/klconfig.h>
46#include <asm/sn/sn0/ip27.h>
47#include <asm/sn/sn0/hub.h>
48#include <asm/sn/sn_private.h>
49
50static long rtc_ioctl(struct file *filp, unsigned int cmd,
51 unsigned long arg);
52
53static int rtc_read_proc(char *page, char **start, off_t off,
54 int count, int *eof, void *data);
55
56static void get_rtc_time(struct rtc_time *rtc_tm);
57
58/*
59 * Bits in rtc_status. (6 bits of room for future expansion)
60 */
61
62#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */
63#define RTC_TIMER_ON 0x02 /* missed irq timer active */
64
65static unsigned char rtc_status; /* bitmapped status byte. */
66static unsigned long rtc_freq; /* Current periodic IRQ rate */
67static struct m48t35_rtc *rtc;
68
69/*
70 * If this driver ever becomes modularised, it will be really nice
71 * to make the epoch retain its value across module reload...
72 */
73
74static unsigned long epoch = 1970; /* year corresponding to 0x00 */
75
76static const unsigned char days_in_mo[] =
77{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
78
79static long rtc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
80{
81
82 struct rtc_time wtime;
83
84 switch (cmd) {
85 case RTC_RD_TIME: /* Read the time/date from RTC */
86 {
87 get_rtc_time(&wtime);
88 break;
89 }
90 case RTC_SET_TIME: /* Set the RTC */
91 {
92 struct rtc_time rtc_tm;
93 unsigned char mon, day, hrs, min, sec, leap_yr;
94 unsigned int yrs;
95
96 if (!capable(CAP_SYS_TIME))
97 return -EACCES;
98
99 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
100 sizeof(struct rtc_time)))
101 return -EFAULT;
102
103 yrs = rtc_tm.tm_year + 1900;
104 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */
105 day = rtc_tm.tm_mday;
106 hrs = rtc_tm.tm_hour;
107 min = rtc_tm.tm_min;
108 sec = rtc_tm.tm_sec;
109
110 if (yrs < 1970)
111 return -EINVAL;
112
113 leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400));
114
115 if ((mon > 12) || (day == 0))
116 return -EINVAL;
117
118 if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr)))
119 return -EINVAL;
120
121 if ((hrs >= 24) || (min >= 60) || (sec >= 60))
122 return -EINVAL;
123
124 if ((yrs -= epoch) > 255) /* They are unsigned */
125 return -EINVAL;
126
127 if (yrs > 169)
128 return -EINVAL;
129
130 if (yrs >= 100)
131 yrs -= 100;
132
133 sec = bin2bcd(sec);
134 min = bin2bcd(min);
135 hrs = bin2bcd(hrs);
136 day = bin2bcd(day);
137 mon = bin2bcd(mon);
138 yrs = bin2bcd(yrs);
139
140 spin_lock_irq(&rtc_lock);
141 rtc->control |= M48T35_RTC_SET;
142 rtc->year = yrs;
143 rtc->month = mon;
144 rtc->date = day;
145 rtc->hour = hrs;
146 rtc->min = min;
147 rtc->sec = sec;
148 rtc->control &= ~M48T35_RTC_SET;
149 spin_unlock_irq(&rtc_lock);
150
151 return 0;
152 }
153 default:
154 return -EINVAL;
155 }
156 return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
157}
158
159/*
160 * We enforce only one user at a time here with the open/close.
161 * Also clear the previous interrupt data on an open, and clean
162 * up things on a close.
163 */
164
165static int rtc_open(struct inode *inode, struct file *file)
166{
167 lock_kernel();
168 spin_lock_irq(&rtc_lock);
169
170 if (rtc_status & RTC_IS_OPEN) {
171 spin_unlock_irq(&rtc_lock);
172 unlock_kernel();
173 return -EBUSY;
174 }
175
176 rtc_status |= RTC_IS_OPEN;
177 spin_unlock_irq(&rtc_lock);
178 unlock_kernel();
179
180 return 0;
181}
182
183static int rtc_release(struct inode *inode, struct file *file)
184{
185 /*
186 * Turn off all interrupts once the device is no longer
187 * in use, and clear the data.
188 */
189
190 spin_lock_irq(&rtc_lock);
191 rtc_status &= ~RTC_IS_OPEN;
192 spin_unlock_irq(&rtc_lock);
193
194 return 0;
195}
196
197/*
198 * The various file operations we support.
199 */
200
201static const struct file_operations rtc_fops = {
202 .owner = THIS_MODULE,
203 .unlocked_ioctl = rtc_ioctl,
204 .open = rtc_open,
205 .release = rtc_release,
206};
207
208static struct miscdevice rtc_dev=
209{
210 RTC_MINOR,
211 "rtc",
212 &rtc_fops
213};
214
215static int __init rtc_init(void)
216{
217 rtc = (struct m48t35_rtc *)
218 (KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base + IOC3_BYTEBUS_DEV0);
219
220 printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION);
221 if (misc_register(&rtc_dev)) {
222 printk(KERN_ERR "rtc: cannot register misc device.\n");
223 return -ENODEV;
224 }
225 if (!create_proc_read_entry("driver/rtc", 0, NULL, rtc_read_proc, NULL)) {
226 printk(KERN_ERR "rtc: cannot create /proc/rtc.\n");
227 misc_deregister(&rtc_dev);
228 return -ENOENT;
229 }
230
231 rtc_freq = 1024;
232
233 return 0;
234}
235
236static void __exit rtc_exit (void)
237{
238 /* interrupts and timer disabled at this point by rtc_release */
239
240 remove_proc_entry ("rtc", NULL);
241 misc_deregister(&rtc_dev);
242}
243
244module_init(rtc_init);
245module_exit(rtc_exit);
246
247/*
248 * Info exported via "/proc/rtc".
249 */
250
251static int rtc_get_status(char *buf)
252{
253 char *p;
254 struct rtc_time tm;
255
256 /*
257 * Just emulate the standard /proc/rtc
258 */
259
260 p = buf;
261
262 get_rtc_time(&tm);
263
264 /*
265 * There is no way to tell if the luser has the RTC set for local
266 * time or for Universal Standard Time (GMT). Probably local though.
267 */
268 p += sprintf(p,
269 "rtc_time\t: %02d:%02d:%02d\n"
270 "rtc_date\t: %04d-%02d-%02d\n"
271 "rtc_epoch\t: %04lu\n"
272 "24hr\t\t: yes\n",
273 tm.tm_hour, tm.tm_min, tm.tm_sec,
274 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);
275
276 return p - buf;
277}
278
279static int rtc_read_proc(char *page, char **start, off_t off,
280 int count, int *eof, void *data)
281{
282 int len = rtc_get_status(page);
283 if (len <= off+count) *eof = 1;
284 *start = page + off;
285 len -= off;
286 if (len>count) len = count;
287 if (len<0) len = 0;
288 return len;
289}
290
291static void get_rtc_time(struct rtc_time *rtc_tm)
292{
293 /*
294 * Do we need to wait for the last update to finish?
295 */
296
297 /*
298 * Only the values that we read from the RTC are set. We leave
299 * tm_wday, tm_yday and tm_isdst untouched. Even though the
300 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
301 * by the RTC when initially set to a non-zero value.
302 */
303 spin_lock_irq(&rtc_lock);
304 rtc->control |= M48T35_RTC_READ;
305 rtc_tm->tm_sec = rtc->sec;
306 rtc_tm->tm_min = rtc->min;
307 rtc_tm->tm_hour = rtc->hour;
308 rtc_tm->tm_mday = rtc->date;
309 rtc_tm->tm_mon = rtc->month;
310 rtc_tm->tm_year = rtc->year;
311 rtc->control &= ~M48T35_RTC_READ;
312 spin_unlock_irq(&rtc_lock);
313
314 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
315 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
316 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
317 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
318 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
319 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
320
321 /*
322 * Account for differences between how the RTC uses the values
323 * and how they are defined in a struct rtc_time;
324 */
325 if ((rtc_tm->tm_year += (epoch - 1900)) <= 69)
326 rtc_tm->tm_year += 100;
327
328 rtc_tm->tm_mon--;
329}
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 835a33c8d5f5..1d7b429f7ffa 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -957,3 +957,4 @@ module_exit(cleanup_ipmi);
957MODULE_LICENSE("GPL"); 957MODULE_LICENSE("GPL");
958MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); 958MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
959MODULE_DESCRIPTION("Linux device interface for the IPMI message handler."); 959MODULE_DESCRIPTION("Linux device interface for the IPMI message handler.");
960MODULE_ALIAS("platform:ipmi_si");
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 9a626e50b793..4d64a02612a4 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -554,7 +554,7 @@ static int mgslpc_probe(struct pcmcia_device *link)
554 /* Initialize the struct pcmcia_device structure */ 554 /* Initialize the struct pcmcia_device structure */
555 555
556 /* Interrupt setup */ 556 /* Interrupt setup */
557 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 557 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
558 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 558 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
559 link->irq.Handler = NULL; 559 link->irq.Handler = NULL;
560 560
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 5a11e3cbcae2..e0dbd388757f 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -102,6 +102,13 @@ config EDAC_I3000
102 Support for error detection and correction on the Intel 102 Support for error detection and correction on the Intel
103 3000 and 3010 server chipsets. 103 3000 and 3010 server chipsets.
104 104
105config EDAC_X38
106 tristate "Intel X38"
107 depends on EDAC_MM_EDAC && PCI && X86
108 help
109 Support for error detection and correction on the Intel
110 X38 server chipsets.
111
105config EDAC_I82860 112config EDAC_I82860
106 tristate "Intel 82860" 113 tristate "Intel 82860"
107 depends on EDAC_MM_EDAC && PCI && X86_32 114 depends on EDAC_MM_EDAC && PCI && X86_32
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile
index e5e9104b5520..62c2d9bad8dc 100644
--- a/drivers/edac/Makefile
+++ b/drivers/edac/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_EDAC_I82443BXGX) += i82443bxgx_edac.o
26obj-$(CONFIG_EDAC_I82875P) += i82875p_edac.o 26obj-$(CONFIG_EDAC_I82875P) += i82875p_edac.o
27obj-$(CONFIG_EDAC_I82975X) += i82975x_edac.o 27obj-$(CONFIG_EDAC_I82975X) += i82975x_edac.o
28obj-$(CONFIG_EDAC_I3000) += i3000_edac.o 28obj-$(CONFIG_EDAC_I3000) += i3000_edac.o
29obj-$(CONFIG_EDAC_X38) += x38_edac.o
29obj-$(CONFIG_EDAC_I82860) += i82860_edac.o 30obj-$(CONFIG_EDAC_I82860) += i82860_edac.o
30obj-$(CONFIG_EDAC_R82600) += r82600_edac.o 31obj-$(CONFIG_EDAC_R82600) += r82600_edac.o
31obj-$(CONFIG_EDAC_PASEMI) += pasemi_edac.o 32obj-$(CONFIG_EDAC_PASEMI) += pasemi_edac.o
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
index 887072f5dc8b..cd2e3b8087e7 100644
--- a/drivers/edac/cell_edac.c
+++ b/drivers/edac/cell_edac.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#undef DEBUG 10#undef DEBUG
11 11
12#include <linux/edac.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/init.h> 14#include <linux/init.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -164,6 +165,8 @@ static int __devinit cell_edac_probe(struct platform_device *pdev)
164 if (regs == NULL) 165 if (regs == NULL)
165 return -ENODEV; 166 return -ENODEV;
166 167
168 edac_op_state = EDAC_OPSTATE_POLL;
169
167 /* Get channel population */ 170 /* Get channel population */
168 reg = in_be64(&regs->mic_mnt_cfg); 171 reg = in_be64(&regs->mic_mnt_cfg);
169 dev_dbg(&pdev->dev, "MIC_MNT_CFG = 0x%016lx\n", reg); 172 dev_dbg(&pdev->dev, "MIC_MNT_CFG = 0x%016lx\n", reg);
diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
new file mode 100644
index 000000000000..2406c2ce2844
--- /dev/null
+++ b/drivers/edac/x38_edac.c
@@ -0,0 +1,524 @@
1/*
2 * Intel X38 Memory Controller kernel module
3 * Copyright (C) 2008 Cluster Computing, Inc.
4 *
5 * This file may be distributed under the terms of the
6 * GNU General Public License.
7 *
8 * This file is based on i3200_edac.c
9 *
10 */
11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/pci.h>
15#include <linux/pci_ids.h>
16#include <linux/slab.h>
17#include <linux/edac.h>
18#include "edac_core.h"
19
20#define X38_REVISION "1.1"
21
22#define EDAC_MOD_STR "x38_edac"
23
24#define PCI_DEVICE_ID_INTEL_X38_HB 0x29e0
25
26#define X38_RANKS 8
27#define X38_RANKS_PER_CHANNEL 4
28#define X38_CHANNELS 2
29
30/* Intel X38 register addresses - device 0 function 0 - DRAM Controller */
31
32#define X38_MCHBAR_LOW 0x48 /* MCH Memory Mapped Register BAR */
33#define X38_MCHBAR_HIGH 0x4b
34#define X38_MCHBAR_MASK 0xfffffc000ULL /* bits 35:14 */
35#define X38_MMR_WINDOW_SIZE 16384
36
37#define X38_TOM 0xa0 /* Top of Memory (16b)
38 *
39 * 15:10 reserved
40 * 9:0 total populated physical memory
41 */
42#define X38_TOM_MASK 0x3ff /* bits 9:0 */
43#define X38_TOM_SHIFT 26 /* 64MiB grain */
44
45#define X38_ERRSTS 0xc8 /* Error Status Register (16b)
46 *
47 * 15 reserved
48 * 14 Isochronous TBWRR Run Behind FIFO Full
49 * (ITCV)
50 * 13 Isochronous TBWRR Run Behind FIFO Put
51 * (ITSTV)
52 * 12 reserved
53 * 11 MCH Thermal Sensor Event
54 * for SMI/SCI/SERR (GTSE)
55 * 10 reserved
56 * 9 LOCK to non-DRAM Memory Flag (LCKF)
57 * 8 reserved
58 * 7 DRAM Throttle Flag (DTF)
59 * 6:2 reserved
60 * 1 Multi-bit DRAM ECC Error Flag (DMERR)
61 * 0 Single-bit DRAM ECC Error Flag (DSERR)
62 */
63#define X38_ERRSTS_UE 0x0002
64#define X38_ERRSTS_CE 0x0001
65#define X38_ERRSTS_BITS (X38_ERRSTS_UE | X38_ERRSTS_CE)
66
67
68/* Intel MMIO register space - device 0 function 0 - MMR space */
69
70#define X38_C0DRB 0x200 /* Channel 0 DRAM Rank Boundary (16b x 4)
71 *
72 * 15:10 reserved
73 * 9:0 Channel 0 DRAM Rank Boundary Address
74 */
75#define X38_C1DRB 0x600 /* Channel 1 DRAM Rank Boundary (16b x 4) */
76#define X38_DRB_MASK 0x3ff /* bits 9:0 */
77#define X38_DRB_SHIFT 26 /* 64MiB grain */
78
79#define X38_C0ECCERRLOG 0x280 /* Channel 0 ECC Error Log (64b)
80 *
81 * 63:48 Error Column Address (ERRCOL)
82 * 47:32 Error Row Address (ERRROW)
83 * 31:29 Error Bank Address (ERRBANK)
84 * 28:27 Error Rank Address (ERRRANK)
85 * 26:24 reserved
86 * 23:16 Error Syndrome (ERRSYND)
87 * 15: 2 reserved
88 * 1 Multiple Bit Error Status (MERRSTS)
89 * 0 Correctable Error Status (CERRSTS)
90 */
91#define X38_C1ECCERRLOG 0x680 /* Channel 1 ECC Error Log (64b) */
92#define X38_ECCERRLOG_CE 0x1
93#define X38_ECCERRLOG_UE 0x2
94#define X38_ECCERRLOG_RANK_BITS 0x18000000
95#define X38_ECCERRLOG_SYNDROME_BITS 0xff0000
96
97#define X38_CAPID0 0xe0 /* see P.94 of spec for details */
98
99static int x38_channel_num;
100
101static int how_many_channel(struct pci_dev *pdev)
102{
103 unsigned char capid0_8b; /* 8th byte of CAPID0 */
104
105 pci_read_config_byte(pdev, X38_CAPID0 + 8, &capid0_8b);
106 if (capid0_8b & 0x20) { /* check DCD: Dual Channel Disable */
107 debugf0("In single channel mode.\n");
108 x38_channel_num = 1;
109 } else {
110 debugf0("In dual channel mode.\n");
111 x38_channel_num = 2;
112 }
113
114 return x38_channel_num;
115}
116
117static unsigned long eccerrlog_syndrome(u64 log)
118{
119 return (log & X38_ECCERRLOG_SYNDROME_BITS) >> 16;
120}
121
122static int eccerrlog_row(int channel, u64 log)
123{
124 return ((log & X38_ECCERRLOG_RANK_BITS) >> 27) |
125 (channel * X38_RANKS_PER_CHANNEL);
126}
127
128enum x38_chips {
129 X38 = 0,
130};
131
132struct x38_dev_info {
133 const char *ctl_name;
134};
135
136struct x38_error_info {
137 u16 errsts;
138 u16 errsts2;
139 u64 eccerrlog[X38_CHANNELS];
140};
141
142static const struct x38_dev_info x38_devs[] = {
143 [X38] = {
144 .ctl_name = "x38"},
145};
146
147static struct pci_dev *mci_pdev;
148static int x38_registered = 1;
149
150
151static void x38_clear_error_info(struct mem_ctl_info *mci)
152{
153 struct pci_dev *pdev;
154
155 pdev = to_pci_dev(mci->dev);
156
157 /*
158 * Clear any error bits.
159 * (Yes, we really clear bits by writing 1 to them.)
160 */
161 pci_write_bits16(pdev, X38_ERRSTS, X38_ERRSTS_BITS,
162 X38_ERRSTS_BITS);
163}
164
165static u64 x38_readq(const void __iomem *addr)
166{
167 return readl(addr) | (((u64)readl(addr + 4)) << 32);
168}
169
170static void x38_get_and_clear_error_info(struct mem_ctl_info *mci,
171 struct x38_error_info *info)
172{
173 struct pci_dev *pdev;
174 void __iomem *window = mci->pvt_info;
175
176 pdev = to_pci_dev(mci->dev);
177
178 /*
179 * This is a mess because there is no atomic way to read all the
180 * registers at once and the registers can transition from CE being
181 * overwritten by UE.
182 */
183 pci_read_config_word(pdev, X38_ERRSTS, &info->errsts);
184 if (!(info->errsts & X38_ERRSTS_BITS))
185 return;
186
187 info->eccerrlog[0] = x38_readq(window + X38_C0ECCERRLOG);
188 if (x38_channel_num == 2)
189 info->eccerrlog[1] = x38_readq(window + X38_C1ECCERRLOG);
190
191 pci_read_config_word(pdev, X38_ERRSTS, &info->errsts2);
192
193 /*
194 * If the error is the same for both reads then the first set
195 * of reads is valid. If there is a change then there is a CE
196 * with no info and the second set of reads is valid and
197 * should be UE info.
198 */
199 if ((info->errsts ^ info->errsts2) & X38_ERRSTS_BITS) {
200 info->eccerrlog[0] = x38_readq(window + X38_C0ECCERRLOG);
201 if (x38_channel_num == 2)
202 info->eccerrlog[1] =
203 x38_readq(window + X38_C1ECCERRLOG);
204 }
205
206 x38_clear_error_info(mci);
207}
208
209static void x38_process_error_info(struct mem_ctl_info *mci,
210 struct x38_error_info *info)
211{
212 int channel;
213 u64 log;
214
215 if (!(info->errsts & X38_ERRSTS_BITS))
216 return;
217
218 if ((info->errsts ^ info->errsts2) & X38_ERRSTS_BITS) {
219 edac_mc_handle_ce_no_info(mci, "UE overwrote CE");
220 info->errsts = info->errsts2;
221 }
222
223 for (channel = 0; channel < x38_channel_num; channel++) {
224 log = info->eccerrlog[channel];
225 if (log & X38_ECCERRLOG_UE) {
226 edac_mc_handle_ue(mci, 0, 0,
227 eccerrlog_row(channel, log), "x38 UE");
228 } else if (log & X38_ECCERRLOG_CE) {
229 edac_mc_handle_ce(mci, 0, 0,
230 eccerrlog_syndrome(log),
231 eccerrlog_row(channel, log), 0, "x38 CE");
232 }
233 }
234}
235
236static void x38_check(struct mem_ctl_info *mci)
237{
238 struct x38_error_info info;
239
240 debugf1("MC%d: %s()\n", mci->mc_idx, __func__);
241 x38_get_and_clear_error_info(mci, &info);
242 x38_process_error_info(mci, &info);
243}
244
245
246void __iomem *x38_map_mchbar(struct pci_dev *pdev)
247{
248 union {
249 u64 mchbar;
250 struct {
251 u32 mchbar_low;
252 u32 mchbar_high;
253 };
254 } u;
255 void __iomem *window;
256
257 pci_read_config_dword(pdev, X38_MCHBAR_LOW, &u.mchbar_low);
258 pci_write_config_dword(pdev, X38_MCHBAR_LOW, u.mchbar_low | 0x1);
259 pci_read_config_dword(pdev, X38_MCHBAR_HIGH, &u.mchbar_high);
260 u.mchbar &= X38_MCHBAR_MASK;
261
262 if (u.mchbar != (resource_size_t)u.mchbar) {
263 printk(KERN_ERR
264 "x38: mmio space beyond accessible range (0x%llx)\n",
265 (unsigned long long)u.mchbar);
266 return NULL;
267 }
268
269 window = ioremap_nocache(u.mchbar, X38_MMR_WINDOW_SIZE);
270 if (!window)
271 printk(KERN_ERR "x38: cannot map mmio space at 0x%llx\n",
272 (unsigned long long)u.mchbar);
273
274 return window;
275}
276
277
278static void x38_get_drbs(void __iomem *window,
279 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL])
280{
281 int i;
282
283 for (i = 0; i < X38_RANKS_PER_CHANNEL; i++) {
284 drbs[0][i] = readw(window + X38_C0DRB + 2*i) & X38_DRB_MASK;
285 drbs[1][i] = readw(window + X38_C1DRB + 2*i) & X38_DRB_MASK;
286 }
287}
288
289static bool x38_is_stacked(struct pci_dev *pdev,
290 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL])
291{
292 u16 tom;
293
294 pci_read_config_word(pdev, X38_TOM, &tom);
295 tom &= X38_TOM_MASK;
296
297 return drbs[X38_CHANNELS - 1][X38_RANKS_PER_CHANNEL - 1] == tom;
298}
299
300static unsigned long drb_to_nr_pages(
301 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL],
302 bool stacked, int channel, int rank)
303{
304 int n;
305
306 n = drbs[channel][rank];
307 if (rank > 0)
308 n -= drbs[channel][rank - 1];
309 if (stacked && (channel == 1) && drbs[channel][rank] ==
310 drbs[channel][X38_RANKS_PER_CHANNEL - 1]) {
311 n -= drbs[0][X38_RANKS_PER_CHANNEL - 1];
312 }
313
314 n <<= (X38_DRB_SHIFT - PAGE_SHIFT);
315 return n;
316}
317
318static int x38_probe1(struct pci_dev *pdev, int dev_idx)
319{
320 int rc;
321 int i;
322 struct mem_ctl_info *mci = NULL;
323 unsigned long last_page;
324 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL];
325 bool stacked;
326 void __iomem *window;
327
328 debugf0("MC: %s()\n", __func__);
329
330 window = x38_map_mchbar(pdev);
331 if (!window)
332 return -ENODEV;
333
334 x38_get_drbs(window, drbs);
335
336 how_many_channel(pdev);
337
338 /* FIXME: unconventional pvt_info usage */
339 mci = edac_mc_alloc(0, X38_RANKS, x38_channel_num, 0);
340 if (!mci)
341 return -ENOMEM;
342
343 debugf3("MC: %s(): init mci\n", __func__);
344
345 mci->dev = &pdev->dev;
346 mci->mtype_cap = MEM_FLAG_DDR2;
347
348 mci->edac_ctl_cap = EDAC_FLAG_SECDED;
349 mci->edac_cap = EDAC_FLAG_SECDED;
350
351 mci->mod_name = EDAC_MOD_STR;
352 mci->mod_ver = X38_REVISION;
353 mci->ctl_name = x38_devs[dev_idx].ctl_name;
354 mci->dev_name = pci_name(pdev);
355 mci->edac_check = x38_check;
356 mci->ctl_page_to_phys = NULL;
357 mci->pvt_info = window;
358
359 stacked = x38_is_stacked(pdev, drbs);
360
361 /*
362 * The dram rank boundary (DRB) reg values are boundary addresses
363 * for each DRAM rank with a granularity of 64MB. DRB regs are
364 * cumulative; the last one will contain the total memory
365 * contained in all ranks.
366 */
367 last_page = -1UL;
368 for (i = 0; i < mci->nr_csrows; i++) {
369 unsigned long nr_pages;
370 struct csrow_info *csrow = &mci->csrows[i];
371
372 nr_pages = drb_to_nr_pages(drbs, stacked,
373 i / X38_RANKS_PER_CHANNEL,
374 i % X38_RANKS_PER_CHANNEL);
375
376 if (nr_pages == 0) {
377 csrow->mtype = MEM_EMPTY;
378 continue;
379 }
380
381 csrow->first_page = last_page + 1;
382 last_page += nr_pages;
383 csrow->last_page = last_page;
384 csrow->nr_pages = nr_pages;
385
386 csrow->grain = nr_pages << PAGE_SHIFT;
387 csrow->mtype = MEM_DDR2;
388 csrow->dtype = DEV_UNKNOWN;
389 csrow->edac_mode = EDAC_UNKNOWN;
390 }
391
392 x38_clear_error_info(mci);
393
394 rc = -ENODEV;
395 if (edac_mc_add_mc(mci)) {
396 debugf3("MC: %s(): failed edac_mc_add_mc()\n", __func__);
397 goto fail;
398 }
399
400 /* get this far and it's successful */
401 debugf3("MC: %s(): success\n", __func__);
402 return 0;
403
404fail:
405 iounmap(window);
406 if (mci)
407 edac_mc_free(mci);
408
409 return rc;
410}
411
412static int __devinit x38_init_one(struct pci_dev *pdev,
413 const struct pci_device_id *ent)
414{
415 int rc;
416
417 debugf0("MC: %s()\n", __func__);
418
419 if (pci_enable_device(pdev) < 0)
420 return -EIO;
421
422 rc = x38_probe1(pdev, ent->driver_data);
423 if (!mci_pdev)
424 mci_pdev = pci_dev_get(pdev);
425
426 return rc;
427}
428
429static void __devexit x38_remove_one(struct pci_dev *pdev)
430{
431 struct mem_ctl_info *mci;
432
433 debugf0("%s()\n", __func__);
434
435 mci = edac_mc_del_mc(&pdev->dev);
436 if (!mci)
437 return;
438
439 iounmap(mci->pvt_info);
440
441 edac_mc_free(mci);
442}
443
444static const struct pci_device_id x38_pci_tbl[] __devinitdata = {
445 {
446 PCI_VEND_DEV(INTEL, X38_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
447 X38},
448 {
449 0,
450 } /* 0 terminated list. */
451};
452
453MODULE_DEVICE_TABLE(pci, x38_pci_tbl);
454
455static struct pci_driver x38_driver = {
456 .name = EDAC_MOD_STR,
457 .probe = x38_init_one,
458 .remove = __devexit_p(x38_remove_one),
459 .id_table = x38_pci_tbl,
460};
461
462static int __init x38_init(void)
463{
464 int pci_rc;
465
466 debugf3("MC: %s()\n", __func__);
467
468 /* Ensure that the OPSTATE is set correctly for POLL or NMI */
469 opstate_init();
470
471 pci_rc = pci_register_driver(&x38_driver);
472 if (pci_rc < 0)
473 goto fail0;
474
475 if (!mci_pdev) {
476 x38_registered = 0;
477 mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
478 PCI_DEVICE_ID_INTEL_X38_HB, NULL);
479 if (!mci_pdev) {
480 debugf0("x38 pci_get_device fail\n");
481 pci_rc = -ENODEV;
482 goto fail1;
483 }
484
485 pci_rc = x38_init_one(mci_pdev, x38_pci_tbl);
486 if (pci_rc < 0) {
487 debugf0("x38 init fail\n");
488 pci_rc = -ENODEV;
489 goto fail1;
490 }
491 }
492
493 return 0;
494
495fail1:
496 pci_unregister_driver(&x38_driver);
497
498fail0:
499 if (mci_pdev)
500 pci_dev_put(mci_pdev);
501
502 return pci_rc;
503}
504
505static void __exit x38_exit(void)
506{
507 debugf3("MC: %s()\n", __func__);
508
509 pci_unregister_driver(&x38_driver);
510 if (!x38_registered) {
511 x38_remove_one(mci_pdev);
512 pci_dev_put(mci_pdev);
513 }
514}
515
516module_init(x38_init);
517module_exit(x38_exit);
518
519MODULE_LICENSE("GPL");
520MODULE_AUTHOR("Cluster Computing, Inc. Hitoshi Mitake");
521MODULE_DESCRIPTION("MC support for Intel X38 memory hub controllers");
522
523module_param(edac_op_state, int, 0444);
524MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 743e6f8cb202..1903e7515650 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1263,6 +1263,7 @@ static const struct hid_device_id hid_blacklist[] = {
1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1268 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1269 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
diff --git a/drivers/hid/hid-dell.c b/drivers/hid/hid-dell.c
index 1a0d0dfc62fc..f5474300b83a 100644
--- a/drivers/hid/hid-dell.c
+++ b/drivers/hid/hid-dell.c
@@ -48,6 +48,7 @@ err_free:
48static const struct hid_device_id dell_devices[] = { 48static const struct hid_device_id dell_devices[] = {
49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
51 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
51 { } 52 { }
52}; 53};
53MODULE_DEVICE_TABLE(hid, dell_devices); 54MODULE_DEVICE_TABLE(hid, dell_devices);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index a0d6a6cb1842..5cc404291736 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -163,6 +163,9 @@
163 163
164#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 164#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
165 165
166#define USB_VENDOR_ID_GENERIC_13BA 0x13ba
167#define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017
168
166#define USB_VENDOR_ID_GLAB 0x06c2 169#define USB_VENDOR_ID_GLAB 0x06c2
167#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 170#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
168#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 171#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 42bdd83444c1..18e5ddd722cd 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/mutex.h>
23#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
24#include <linux/spinlock.h> 25#include <linux/spinlock.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
@@ -776,21 +777,10 @@ static int usbhid_start(struct hid_device *hid)
776 struct usb_interface *intf = to_usb_interface(hid->dev.parent); 777 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
777 struct usb_host_interface *interface = intf->cur_altsetting; 778 struct usb_host_interface *interface = intf->cur_altsetting;
778 struct usb_device *dev = interface_to_usbdev(intf); 779 struct usb_device *dev = interface_to_usbdev(intf);
779 struct usbhid_device *usbhid; 780 struct usbhid_device *usbhid = hid->driver_data;
780 unsigned int n, insize = 0; 781 unsigned int n, insize = 0;
781 int ret; 782 int ret;
782 783
783 WARN_ON(hid->driver_data);
784
785 usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL);
786 if (usbhid == NULL) {
787 ret = -ENOMEM;
788 goto err;
789 }
790
791 hid->driver_data = usbhid;
792 usbhid->hid = hid;
793
794 usbhid->bufsize = HID_MIN_BUFFER_SIZE; 784 usbhid->bufsize = HID_MIN_BUFFER_SIZE;
795 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize); 785 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize);
796 hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize); 786 hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize);
@@ -804,6 +794,7 @@ static int usbhid_start(struct hid_device *hid)
804 if (insize > HID_MAX_BUFFER_SIZE) 794 if (insize > HID_MAX_BUFFER_SIZE)
805 insize = HID_MAX_BUFFER_SIZE; 795 insize = HID_MAX_BUFFER_SIZE;
806 796
797 mutex_lock(&usbhid->setup);
807 if (hid_alloc_buffers(dev, hid)) { 798 if (hid_alloc_buffers(dev, hid)) {
808 ret = -ENOMEM; 799 ret = -ENOMEM;
809 goto fail; 800 goto fail;
@@ -888,6 +879,9 @@ static int usbhid_start(struct hid_device *hid)
888 usbhid_init_reports(hid); 879 usbhid_init_reports(hid);
889 hid_dump_device(hid); 880 hid_dump_device(hid);
890 881
882 set_bit(HID_STARTED, &usbhid->iofl);
883 mutex_unlock(&usbhid->setup);
884
891 return 0; 885 return 0;
892 886
893fail: 887fail:
@@ -895,8 +889,7 @@ fail:
895 usb_free_urb(usbhid->urbout); 889 usb_free_urb(usbhid->urbout);
896 usb_free_urb(usbhid->urbctrl); 890 usb_free_urb(usbhid->urbctrl);
897 hid_free_buffers(dev, hid); 891 hid_free_buffers(dev, hid);
898 kfree(usbhid); 892 mutex_unlock(&usbhid->setup);
899err:
900 return ret; 893 return ret;
901} 894}
902 895
@@ -907,6 +900,8 @@ static void usbhid_stop(struct hid_device *hid)
907 if (WARN_ON(!usbhid)) 900 if (WARN_ON(!usbhid))
908 return; 901 return;
909 902
903 mutex_lock(&usbhid->setup);
904 clear_bit(HID_STARTED, &usbhid->iofl);
910 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 905 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
911 set_bit(HID_DISCONNECTED, &usbhid->iofl); 906 set_bit(HID_DISCONNECTED, &usbhid->iofl);
912 spin_unlock_irq(&usbhid->inlock); 907 spin_unlock_irq(&usbhid->inlock);
@@ -931,8 +926,7 @@ static void usbhid_stop(struct hid_device *hid)
931 usb_free_urb(usbhid->urbout); 926 usb_free_urb(usbhid->urbout);
932 927
933 hid_free_buffers(hid_to_usb_dev(hid), hid); 928 hid_free_buffers(hid_to_usb_dev(hid), hid);
934 kfree(usbhid); 929 mutex_unlock(&usbhid->setup);
935 hid->driver_data = NULL;
936} 930}
937 931
938static struct hid_ll_driver usb_hid_driver = { 932static struct hid_ll_driver usb_hid_driver = {
@@ -947,6 +941,7 @@ static struct hid_ll_driver usb_hid_driver = {
947static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) 941static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
948{ 942{
949 struct usb_device *dev = interface_to_usbdev(intf); 943 struct usb_device *dev = interface_to_usbdev(intf);
944 struct usbhid_device *usbhid;
950 struct hid_device *hid; 945 struct hid_device *hid;
951 size_t len; 946 size_t len;
952 int ret; 947 int ret;
@@ -1000,14 +995,26 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1000 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) 995 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0)
1001 hid->uniq[0] = 0; 996 hid->uniq[0] = 0;
1002 997
998 usbhid = kzalloc(sizeof(*usbhid), GFP_KERNEL);
999 if (usbhid == NULL) {
1000 ret = -ENOMEM;
1001 goto err;
1002 }
1003
1004 hid->driver_data = usbhid;
1005 usbhid->hid = hid;
1006 mutex_init(&usbhid->setup); /* needed on suspend/resume */
1007
1003 ret = hid_add_device(hid); 1008 ret = hid_add_device(hid);
1004 if (ret) { 1009 if (ret) {
1005 if (ret != -ENODEV) 1010 if (ret != -ENODEV)
1006 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1011 dev_err(&intf->dev, "can't add hid device: %d\n", ret);
1007 goto err; 1012 goto err_free;
1008 } 1013 }
1009 1014
1010 return 0; 1015 return 0;
1016err_free:
1017 kfree(usbhid);
1011err: 1018err:
1012 hid_destroy_device(hid); 1019 hid_destroy_device(hid);
1013 return ret; 1020 return ret;
@@ -1016,11 +1023,14 @@ err:
1016static void hid_disconnect(struct usb_interface *intf) 1023static void hid_disconnect(struct usb_interface *intf)
1017{ 1024{
1018 struct hid_device *hid = usb_get_intfdata(intf); 1025 struct hid_device *hid = usb_get_intfdata(intf);
1026 struct usbhid_device *usbhid;
1019 1027
1020 if (WARN_ON(!hid)) 1028 if (WARN_ON(!hid))
1021 return; 1029 return;
1022 1030
1031 usbhid = hid->driver_data;
1023 hid_destroy_device(hid); 1032 hid_destroy_device(hid);
1033 kfree(usbhid);
1024} 1034}
1025 1035
1026static int hid_suspend(struct usb_interface *intf, pm_message_t message) 1036static int hid_suspend(struct usb_interface *intf, pm_message_t message)
@@ -1028,11 +1038,18 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1028 struct hid_device *hid = usb_get_intfdata (intf); 1038 struct hid_device *hid = usb_get_intfdata (intf);
1029 struct usbhid_device *usbhid = hid->driver_data; 1039 struct usbhid_device *usbhid = hid->driver_data;
1030 1040
1041 mutex_lock(&usbhid->setup);
1042 if (!test_bit(HID_STARTED, &usbhid->iofl)) {
1043 mutex_unlock(&usbhid->setup);
1044 return 0;
1045 }
1046
1031 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 1047 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
1032 set_bit(HID_SUSPENDED, &usbhid->iofl); 1048 set_bit(HID_SUSPENDED, &usbhid->iofl);
1033 spin_unlock_irq(&usbhid->inlock); 1049 spin_unlock_irq(&usbhid->inlock);
1034 del_timer(&usbhid->io_retry); 1050 del_timer_sync(&usbhid->io_retry);
1035 usb_kill_urb(usbhid->urbin); 1051 usb_kill_urb(usbhid->urbin);
1052 mutex_unlock(&usbhid->setup);
1036 dev_dbg(&intf->dev, "suspend\n"); 1053 dev_dbg(&intf->dev, "suspend\n");
1037 return 0; 1054 return 0;
1038} 1055}
@@ -1043,9 +1060,16 @@ static int hid_resume(struct usb_interface *intf)
1043 struct usbhid_device *usbhid = hid->driver_data; 1060 struct usbhid_device *usbhid = hid->driver_data;
1044 int status; 1061 int status;
1045 1062
1063 mutex_lock(&usbhid->setup);
1064 if (!test_bit(HID_STARTED, &usbhid->iofl)) {
1065 mutex_unlock(&usbhid->setup);
1066 return 0;
1067 }
1068
1046 clear_bit(HID_SUSPENDED, &usbhid->iofl); 1069 clear_bit(HID_SUSPENDED, &usbhid->iofl);
1047 usbhid->retry_delay = 0; 1070 usbhid->retry_delay = 0;
1048 status = hid_start_in(hid); 1071 status = hid_start_in(hid);
1072 mutex_unlock(&usbhid->setup);
1049 dev_dbg(&intf->dev, "resume status %d\n", status); 1073 dev_dbg(&intf->dev, "resume status %d\n", status);
1050 return status; 1074 return status;
1051} 1075}
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index abedb13c623e..55973ff54008 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/mutex.h>
30#include <linux/timer.h> 31#include <linux/timer.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
32#include <linux/workqueue.h> 33#include <linux/workqueue.h>
@@ -73,6 +74,7 @@ struct usbhid_device {
73 dma_addr_t outbuf_dma; /* Output buffer dma */ 74 dma_addr_t outbuf_dma; /* Output buffer dma */
74 spinlock_t outlock; /* Output fifo spinlock */ 75 spinlock_t outlock; /* Output fifo spinlock */
75 76
77 struct mutex setup;
76 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 78 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
77 struct timer_list io_retry; /* Retry timer */ 79 struct timer_list io_retry; /* Retry timer */
78 unsigned long stop_retry; /* Time to give up, in jiffies */ 80 unsigned long stop_retry; /* Time to give up, in jiffies */
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index c772e02c2803..1fac4e233133 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -507,7 +507,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int
507 unsigned long timeout; 507 unsigned long timeout;
508 int ret; 508 int ret;
509 509
510 if (!readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN) 510 if (!(readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN))
511 return -EIO; 511 return -EIO;
512 512
513 ret = s3c24xx_i2c_set_master(i2c); 513 ret = s3c24xx_i2c_set_master(i2c);
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
index c3022a023449..e4c98539c517 100644
--- a/drivers/i2c/busses/scx200_i2c.c
+++ b/drivers/i2c/busses/scx200_i2c.c
@@ -81,6 +81,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
81 81
82static struct i2c_adapter scx200_i2c_ops = { 82static struct i2c_adapter scx200_i2c_ops = {
83 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
84 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
84 .id = I2C_HW_B_SCX200, 85 .id = I2C_HW_B_SCX200,
85 .algo_data = &scx200_i2c_data, 86 .algo_data = &scx200_i2c_data,
86 .name = "NatSemi SCx200 I2C", 87 .name = "NatSemi SCx200 I2C",
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c
index ce238f59b3c8..be3a15f5b25d 100644
--- a/drivers/input/misc/sgi_btns.c
+++ b/drivers/input/misc/sgi_btns.c
@@ -174,5 +174,6 @@ static void __exit sgi_buttons_exit(void)
174 platform_driver_unregister(&sgi_buttons_driver); 174 platform_driver_unregister(&sgi_buttons_driver);
175} 175}
176 176
177MODULE_LICENSE("GPL");
177module_init(sgi_buttons_init); 178module_init(sgi_buttons_init);
178module_exit(sgi_buttons_exit); 179module_exit(sgi_buttons_exit);
diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
index 2768c69257f6..1f3cc512eff8 100644
--- a/drivers/leds/leds-da903x.c
+++ b/drivers/leds/leds-da903x.c
@@ -58,7 +58,7 @@ static void da903x_led_work(struct work_struct *work)
58 offset = DA9030_LED_OFFSET(led->id); 58 offset = DA9030_LED_OFFSET(led->id);
59 val = led->flags & ~0x87; 59 val = led->flags & ~0x87;
60 val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */ 60 val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */
61 val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */ 61 val |= (0x7 - (led->new_brightness >> 5)) & 0x7; /* PWM<2:0> */
62 da903x_write(led->master, DA9030_LED1_CONTROL + offset, val); 62 da903x_write(led->master, DA9030_LED1_CONTROL + offset, val);
63 break; 63 break;
64 case DA9030_ID_VIBRA: 64 case DA9030_ID_VIBRA:
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 92dcc06832a4..9d7b53ed75b2 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -656,9 +656,10 @@ static void do_failures(struct mirror_set *ms, struct bio_list *failures)
656 return; 656 return;
657 657
658 if (!ms->log_failure) { 658 if (!ms->log_failure) {
659 while ((bio = bio_list_pop(failures))) 659 while ((bio = bio_list_pop(failures))) {
660 ms->in_sync = 0; 660 ms->in_sync = 0;
661 dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0); 661 dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0);
662 }
662 return; 663 return;
663 } 664 }
664 665
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index b2d9d1ac28ad..6c96db26b87c 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -229,19 +229,21 @@ static void __insert_origin(struct origin *o)
229 */ 229 */
230static int register_snapshot(struct dm_snapshot *snap) 230static int register_snapshot(struct dm_snapshot *snap)
231{ 231{
232 struct origin *o; 232 struct origin *o, *new_o;
233 struct block_device *bdev = snap->origin->bdev; 233 struct block_device *bdev = snap->origin->bdev;
234 234
235 new_o = kmalloc(sizeof(*new_o), GFP_KERNEL);
236 if (!new_o)
237 return -ENOMEM;
238
235 down_write(&_origins_lock); 239 down_write(&_origins_lock);
236 o = __lookup_origin(bdev); 240 o = __lookup_origin(bdev);
237 241
238 if (!o) { 242 if (o)
243 kfree(new_o);
244 else {
239 /* New origin */ 245 /* New origin */
240 o = kmalloc(sizeof(*o), GFP_KERNEL); 246 o = new_o;
241 if (!o) {
242 up_write(&_origins_lock);
243 return -ENOMEM;
244 }
245 247
246 /* Initialise the struct */ 248 /* Initialise the struct */
247 INIT_LIST_HEAD(&o->snapshots); 249 INIT_LIST_HEAD(&o->snapshots);
@@ -368,6 +370,7 @@ static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snaps
368 struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool, 370 struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool,
369 GFP_NOIO); 371 GFP_NOIO);
370 372
373 atomic_inc(&s->pending_exceptions_count);
371 pe->snap = s; 374 pe->snap = s;
372 375
373 return pe; 376 return pe;
@@ -375,7 +378,11 @@ static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snaps
375 378
376static void free_pending_exception(struct dm_snap_pending_exception *pe) 379static void free_pending_exception(struct dm_snap_pending_exception *pe)
377{ 380{
378 mempool_free(pe, pe->snap->pending_pool); 381 struct dm_snapshot *s = pe->snap;
382
383 mempool_free(pe, s->pending_pool);
384 smp_mb__before_atomic_dec();
385 atomic_dec(&s->pending_exceptions_count);
379} 386}
380 387
381static void insert_completed_exception(struct dm_snapshot *s, 388static void insert_completed_exception(struct dm_snapshot *s,
@@ -600,6 +607,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
600 607
601 s->valid = 1; 608 s->valid = 1;
602 s->active = 0; 609 s->active = 0;
610 atomic_set(&s->pending_exceptions_count, 0);
603 init_rwsem(&s->lock); 611 init_rwsem(&s->lock);
604 spin_lock_init(&s->pe_lock); 612 spin_lock_init(&s->pe_lock);
605 s->ti = ti; 613 s->ti = ti;
@@ -726,6 +734,14 @@ static void snapshot_dtr(struct dm_target *ti)
726 /* After this returns there can be no new kcopyd jobs. */ 734 /* After this returns there can be no new kcopyd jobs. */
727 unregister_snapshot(s); 735 unregister_snapshot(s);
728 736
737 while (atomic_read(&s->pending_exceptions_count))
738 yield();
739 /*
740 * Ensure instructions in mempool_destroy aren't reordered
741 * before atomic_read.
742 */
743 smp_mb();
744
729#ifdef CONFIG_DM_DEBUG 745#ifdef CONFIG_DM_DEBUG
730 for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++) 746 for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++)
731 BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i])); 747 BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i]));
diff --git a/drivers/md/dm-snap.h b/drivers/md/dm-snap.h
index f07315fe2362..99c0106ede2d 100644
--- a/drivers/md/dm-snap.h
+++ b/drivers/md/dm-snap.h
@@ -160,6 +160,8 @@ struct dm_snapshot {
160 160
161 mempool_t *pending_pool; 161 mempool_t *pending_pool;
162 162
163 atomic_t pending_exceptions_count;
164
163 struct exception_table pending; 165 struct exception_table pending;
164 struct exception_table complete; 166 struct exception_table complete;
165 167
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b4162f6f1b79..9abf6ed16535 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3884,6 +3884,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3884 if (mode == 0) { 3884 if (mode == 0) {
3885 mdk_rdev_t *rdev; 3885 mdk_rdev_t *rdev;
3886 struct list_head *tmp; 3886 struct list_head *tmp;
3887 struct block_device *bdev;
3887 3888
3888 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); 3889 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
3889 3890
@@ -3940,6 +3941,12 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3940 mddev->degraded = 0; 3941 mddev->degraded = 0;
3941 mddev->barriers_work = 0; 3942 mddev->barriers_work = 0;
3942 mddev->safemode = 0; 3943 mddev->safemode = 0;
3944 bdev = bdget_disk(mddev->gendisk, 0);
3945 if (bdev) {
3946 blkdev_ioctl(bdev, 0, BLKRRPART, 0);
3947 bdput(bdev);
3948 }
3949 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
3943 3950
3944 } else if (mddev->pers) 3951 } else if (mddev->pers)
3945 printk(KERN_INFO "md: %s switched to read-only mode.\n", 3952 printk(KERN_INFO "md: %s switched to read-only mode.\n",
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 11a617ab4243..84bdc2ee69e6 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -567,8 +567,8 @@ static void i2o_block_biosparam(unsigned long capacity, unsigned short *cyls,
567 567
568/** 568/**
569 * i2o_block_open - Open the block device 569 * i2o_block_open - Open the block device
570 * @inode: inode for block device being opened 570 * @bdev: block device being opened
571 * @file: file to open 571 * @mode: file open mode
572 * 572 *
573 * Power up the device, mount and lock the media. This function is called, 573 * Power up the device, mount and lock the media. This function is called,
574 * if the block device is opened for access. 574 * if the block device is opened for access.
@@ -596,8 +596,8 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
596 596
597/** 597/**
598 * i2o_block_release - Release the I2O block device 598 * i2o_block_release - Release the I2O block device
599 * @inode: inode for block device being released 599 * @disk: gendisk device being released
600 * @file: file to close 600 * @mode: file open mode
601 * 601 *
602 * Unlock and unmount the media, and power down the device. Gets called if 602 * Unlock and unmount the media, and power down the device. Gets called if
603 * the block device is closed. 603 * the block device is closed.
@@ -643,8 +643,8 @@ static int i2o_block_getgeo(struct block_device *bdev, struct hd_geometry *geo)
643 643
644/** 644/**
645 * i2o_block_ioctl - Issue device specific ioctl calls. 645 * i2o_block_ioctl - Issue device specific ioctl calls.
646 * @inode: inode for block device ioctl 646 * @bdev: block device being opened
647 * @file: file for ioctl 647 * @mode: file open mode
648 * @cmd: ioctl command 648 * @cmd: ioctl command
649 * @arg: arg 649 * @arg: arg
650 * 650 *
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 08e26beefe64..ce39fa54949b 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -113,7 +113,6 @@ static int hdpu_nexus_probe(struct platform_device *pdev)
113 if (!hdpu_chassis_id) 113 if (!hdpu_chassis_id)
114 printk(KERN_WARNING "sky_nexus: " 114 printk(KERN_WARNING "sky_nexus: "
115 "Unable to create proc dir entry: sky_chassis_id\n"); 115 "Unable to create proc dir entry: sky_chassis_id\n");
116 }
117 116
118 return 0; 117 return 0;
119} 118}
diff --git a/drivers/misc/sgi-xp/Makefile b/drivers/misc/sgi-xp/Makefile
index 35ce28578075..4fc40d8e1bcc 100644
--- a/drivers/misc/sgi-xp/Makefile
+++ b/drivers/misc/sgi-xp/Makefile
@@ -5,14 +5,14 @@
5obj-$(CONFIG_SGI_XP) += xp.o 5obj-$(CONFIG_SGI_XP) += xp.o
6xp-y := xp_main.o 6xp-y := xp_main.o
7xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o 7xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o
8xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o xp_uv.o 8xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o
9xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o 9xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o
10xp-$(CONFIG_X86_64) += xp_uv.o 10xp-$(CONFIG_X86_64) += xp_uv.o
11 11
12obj-$(CONFIG_SGI_XP) += xpc.o 12obj-$(CONFIG_SGI_XP) += xpc.o
13xpc-y := xpc_main.o xpc_channel.o xpc_partition.o 13xpc-y := xpc_main.o xpc_channel.o xpc_partition.o
14xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o 14xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o
15xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o xpc_uv.o 15xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o
16xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o 16xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o
17xpc-$(CONFIG_X86_64) += xpc_uv.o 17xpc-$(CONFIG_X86_64) += xpc_uv.o
18 18
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h
index 859a5281c61b..ed1722e50049 100644
--- a/drivers/misc/sgi-xp/xp.h
+++ b/drivers/misc/sgi-xp/xp.h
@@ -19,7 +19,11 @@
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */ 20#include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */
21#define is_shub() ia64_platform_is("sn2") 21#define is_shub() ia64_platform_is("sn2")
22#ifdef CONFIG_IA64_SGI_UV
22#define is_uv() ia64_platform_is("uv") 23#define is_uv() ia64_platform_is("uv")
24#else
25#define is_uv() 0
26#endif
23#endif 27#endif
24#ifdef CONFIG_X86_64 28#ifdef CONFIG_X86_64
25#include <asm/genapic.h> 29#include <asm/genapic.h>
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 46325fc84811..e8d5cfbd32c2 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -1104,7 +1104,7 @@ xpc_do_exit(enum xp_retval reason)
1104 1104
1105 if (is_shub()) 1105 if (is_shub())
1106 xpc_exit_sn2(); 1106 xpc_exit_sn2();
1107 else 1107 else if (is_uv())
1108 xpc_exit_uv(); 1108 xpc_exit_uv();
1109} 1109}
1110 1110
@@ -1363,7 +1363,7 @@ out_2:
1363out_1: 1363out_1:
1364 if (is_shub()) 1364 if (is_shub())
1365 xpc_exit_sn2(); 1365 xpc_exit_sn2();
1366 else 1366 else if (is_uv())
1367 xpc_exit_uv(); 1367 xpc_exit_uv();
1368 return ret; 1368 return ret;
1369} 1369}
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 5a97d3a9d745..f483c4221f76 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -2315,8 +2315,10 @@ end:
2315 */ 2315 */
2316static int sony_pic_disable(struct acpi_device *device) 2316static int sony_pic_disable(struct acpi_device *device)
2317{ 2317{
2318 if (ACPI_FAILURE(acpi_evaluate_object(device->handle, 2318 acpi_status ret = acpi_evaluate_object(device->handle, "_DIS", NULL,
2319 "_DIS", NULL, NULL))) 2319 NULL);
2320
2321 if (ACPI_FAILURE(ret) && ret != AE_NOT_FOUND)
2320 return -ENXIO; 2322 return -ENXIO;
2321 2323
2322 dprintk("Device disabled\n"); 2324 dprintk("Device disabled\n");
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 696cf3647ceb..2fadf323c696 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -391,6 +391,7 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
391static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) 391static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
392{ 392{
393 struct mmci_host *host = mmc_priv(mmc); 393 struct mmci_host *host = mmc_priv(mmc);
394 unsigned long flags;
394 395
395 WARN_ON(host->mrq != NULL); 396 WARN_ON(host->mrq != NULL);
396 397
@@ -402,7 +403,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
402 return; 403 return;
403 } 404 }
404 405
405 spin_lock_irq(&host->lock); 406 spin_lock_irqsave(&host->lock, flags);
406 407
407 host->mrq = mrq; 408 host->mrq = mrq;
408 409
@@ -411,7 +412,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
411 412
412 mmci_start_command(host, mrq->cmd, 0); 413 mmci_start_command(host, mrq->cmd, 0);
413 414
414 spin_unlock_irq(&host->lock); 415 spin_unlock_irqrestore(&host->lock, flags);
415} 416}
416 417
417static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 418static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 20fcf0cdd801..4a2ef838fed6 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -644,10 +644,6 @@ This function frees the transmiter and receiver descriptor rings.
644*/ 644*/
645static void amd8111e_free_ring(struct amd8111e_priv* lp) 645static void amd8111e_free_ring(struct amd8111e_priv* lp)
646{ 646{
647
648 /* Free transmit and receive skbs */
649 amd8111e_free_skbs(lp->amd8111e_net_dev);
650
651 /* Free transmit and receive descriptor rings */ 647 /* Free transmit and receive descriptor rings */
652 if(lp->rx_ring){ 648 if(lp->rx_ring){
653 pci_free_consistent(lp->pci_dev, 649 pci_free_consistent(lp->pci_dev,
@@ -833,12 +829,14 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget)
833 829
834 } while(intr0 & RINT0); 830 } while(intr0 & RINT0);
835 831
836 /* Receive descriptor is empty now */ 832 if (rx_pkt_limit > 0) {
837 spin_lock_irqsave(&lp->lock, flags); 833 /* Receive descriptor is empty now */
838 __netif_rx_complete(dev, napi); 834 spin_lock_irqsave(&lp->lock, flags);
839 writel(VAL0|RINTEN0, mmio + INTEN0); 835 __netif_rx_complete(dev, napi);
840 writel(VAL2 | RDMD0, mmio + CMD0); 836 writel(VAL0|RINTEN0, mmio + INTEN0);
841 spin_unlock_irqrestore(&lp->lock, flags); 837 writel(VAL2 | RDMD0, mmio + CMD0);
838 spin_unlock_irqrestore(&lp->lock, flags);
839 }
842 840
843rx_not_empty: 841rx_not_empty:
844 return num_rx_pkt; 842 return num_rx_pkt;
@@ -1231,7 +1229,9 @@ static int amd8111e_close(struct net_device * dev)
1231 1229
1232 amd8111e_disable_interrupt(lp); 1230 amd8111e_disable_interrupt(lp);
1233 amd8111e_stop_chip(lp); 1231 amd8111e_stop_chip(lp);
1234 amd8111e_free_ring(lp); 1232
1233 /* Free transmit and receive skbs */
1234 amd8111e_free_skbs(lp->amd8111e_net_dev);
1235 1235
1236 netif_carrier_off(lp->amd8111e_net_dev); 1236 netif_carrier_off(lp->amd8111e_net_dev);
1237 1237
@@ -1241,6 +1241,7 @@ static int amd8111e_close(struct net_device * dev)
1241 1241
1242 spin_unlock_irq(&lp->lock); 1242 spin_unlock_irq(&lp->lock);
1243 free_irq(dev->irq, dev); 1243 free_irq(dev->irq, dev);
1244 amd8111e_free_ring(lp);
1244 1245
1245 /* Update the statistics before closing */ 1246 /* Update the statistics before closing */
1246 amd8111e_get_stats(dev); 1247 amd8111e_get_stats(dev);
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 65ce451ae961..e21dc2075ed8 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -1078,7 +1078,8 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add
1078 init_timer(&lp->check_timer); 1078 init_timer(&lp->check_timer);
1079 lp->check_timer.data = (unsigned long)dev; 1079 lp->check_timer.data = (unsigned long)dev;
1080 lp->check_timer.function = at91ether_check_link; 1080 lp->check_timer.function = at91ether_check_link;
1081 } 1081 } else if (lp->board_data.phy_irq_pin >= 32)
1082 gpio_request(lp->board_data.phy_irq_pin, "ethernet_phy");
1082 1083
1083 /* Display ethernet banner */ 1084 /* Display ethernet banner */
1084 printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%pM)\n", 1085 printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%pM)\n",
@@ -1165,6 +1166,9 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
1165 struct net_device *dev = platform_get_drvdata(pdev); 1166 struct net_device *dev = platform_get_drvdata(pdev);
1166 struct at91_private *lp = netdev_priv(dev); 1167 struct at91_private *lp = netdev_priv(dev);
1167 1168
1169 if (lp->board_data.phy_irq_pin >= 32)
1170 gpio_free(lp->board_data.phy_irq_pin);
1171
1168 unregister_netdev(dev); 1172 unregister_netdev(dev);
1169 free_irq(dev->irq, dev); 1173 free_irq(dev->irq, dev);
1170 dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); 1174 dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 3cf59a7f5a1c..246d92b42636 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2310,7 +2310,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count,
2310 if (tpd != ptpd) 2310 if (tpd != ptpd)
2311 memcpy(tpd, ptpd, sizeof(struct tx_packet_desc)); 2311 memcpy(tpd, ptpd, sizeof(struct tx_packet_desc));
2312 tpd->buffer_addr = cpu_to_le64(buffer_info->dma); 2312 tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
2313 tpd->word2 = (cpu_to_le16(buffer_info->length) & 2313 tpd->word2 &= ~(TPD_BUFLEN_MASK << TPD_BUFLEN_SHIFT);
2314 tpd->word2 |= (cpu_to_le16(buffer_info->length) &
2314 TPD_BUFLEN_MASK) << TPD_BUFLEN_SHIFT; 2315 TPD_BUFLEN_MASK) << TPD_BUFLEN_SHIFT;
2315 2316
2316 /* 2317 /*
@@ -2409,8 +2410,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2409 vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) | 2410 vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) |
2410 ((vlan_tag >> 9) & 0x8); 2411 ((vlan_tag >> 9) & 0x8);
2411 ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; 2412 ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT;
2412 ptpd->word3 |= (vlan_tag & TPD_VL_TAGGED_MASK) << 2413 ptpd->word2 |= (vlan_tag & TPD_VLANTAG_MASK) <<
2413 TPD_VL_TAGGED_SHIFT; 2414 TPD_VLANTAG_SHIFT;
2414 } 2415 }
2415 2416
2416 tso = atl1_tso(adapter, skb, ptpd); 2417 tso = atl1_tso(adapter, skb, ptpd);
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h
index a5015b14a429..ffa73fc8d95e 100644
--- a/drivers/net/atlx/atl1.h
+++ b/drivers/net/atlx/atl1.h
@@ -504,7 +504,7 @@ struct rx_free_desc {
504#define TPD_PKTNT_MASK 0x0001 504#define TPD_PKTNT_MASK 0x0001
505#define TPD_PKTINT_SHIFT 15 505#define TPD_PKTINT_SHIFT 15
506#define TPD_VLANTAG_MASK 0xFFFF 506#define TPD_VLANTAG_MASK 0xFFFF
507#define TPD_VLAN_SHIFT 16 507#define TPD_VLANTAG_SHIFT 16
508 508
509/* tpd word 3 bits 0:13 */ 509/* tpd word 3 bits 0:13 */
510#define TPD_EOP_MASK 0x0001 510#define TPD_EOP_MASK 0x0001
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index ade5f3f6693b..87437c788476 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -169,11 +169,14 @@ static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_
169 /* clear slave from tx_hashtbl */ 169 /* clear slave from tx_hashtbl */
170 tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl; 170 tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl;
171 171
172 index = SLAVE_TLB_INFO(slave).head; 172 /* skip this if we've already freed the tx hash table */
173 while (index != TLB_NULL_INDEX) { 173 if (tx_hash_table) {
174 u32 next_index = tx_hash_table[index].next; 174 index = SLAVE_TLB_INFO(slave).head;
175 tlb_init_table_entry(&tx_hash_table[index], save_load); 175 while (index != TLB_NULL_INDEX) {
176 index = next_index; 176 u32 next_index = tx_hash_table[index].next;
177 tlb_init_table_entry(&tx_hash_table[index], save_load);
178 index = next_index;
179 }
177 } 180 }
178 181
179 tlb_init_slave(slave); 182 tlb_init_slave(slave);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f2da031fd7ba..fd9028d7c06e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1978,6 +1978,20 @@ void bond_destroy(struct bonding *bond)
1978 unregister_netdevice(bond->dev); 1978 unregister_netdevice(bond->dev);
1979} 1979}
1980 1980
1981static void bond_destructor(struct net_device *bond_dev)
1982{
1983 struct bonding *bond = bond_dev->priv;
1984
1985 if (bond->wq)
1986 destroy_workqueue(bond->wq);
1987
1988 netif_addr_lock_bh(bond_dev);
1989 bond_mc_list_destroy(bond);
1990 netif_addr_unlock_bh(bond_dev);
1991
1992 free_netdev(bond_dev);
1993}
1994
1981/* 1995/*
1982* First release a slave and than destroy the bond if no more slaves iare left. 1996* First release a slave and than destroy the bond if no more slaves iare left.
1983* Must be under rtnl_lock when this function is called. 1997* Must be under rtnl_lock when this function is called.
@@ -2375,6 +2389,9 @@ static void bond_miimon_commit(struct bonding *bond)
2375 continue; 2389 continue;
2376 2390
2377 case BOND_LINK_DOWN: 2391 case BOND_LINK_DOWN:
2392 if (slave->link_failure_count < UINT_MAX)
2393 slave->link_failure_count++;
2394
2378 slave->link = BOND_LINK_DOWN; 2395 slave->link = BOND_LINK_DOWN;
2379 2396
2380 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || 2397 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP ||
@@ -4543,7 +4560,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4543 4560
4544 bond_set_mode_ops(bond, bond->params.mode); 4561 bond_set_mode_ops(bond, bond->params.mode);
4545 4562
4546 bond_dev->destructor = free_netdev; 4563 bond_dev->destructor = bond_destructor;
4547 4564
4548 /* Initialize the device options */ 4565 /* Initialize the device options */
4549 bond_dev->tx_queue_len = 0; 4566 bond_dev->tx_queue_len = 0;
@@ -4582,20 +4599,6 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4582 return 0; 4599 return 0;
4583} 4600}
4584 4601
4585/* De-initialize device specific data.
4586 * Caller must hold rtnl_lock.
4587 */
4588static void bond_deinit(struct net_device *bond_dev)
4589{
4590 struct bonding *bond = bond_dev->priv;
4591
4592 list_del(&bond->bond_list);
4593
4594#ifdef CONFIG_PROC_FS
4595 bond_remove_proc_entry(bond);
4596#endif
4597}
4598
4599static void bond_work_cancel_all(struct bonding *bond) 4602static void bond_work_cancel_all(struct bonding *bond)
4600{ 4603{
4601 write_lock_bh(&bond->lock); 4604 write_lock_bh(&bond->lock);
@@ -4617,6 +4620,22 @@ static void bond_work_cancel_all(struct bonding *bond)
4617 cancel_delayed_work(&bond->ad_work); 4620 cancel_delayed_work(&bond->ad_work);
4618} 4621}
4619 4622
4623/* De-initialize device specific data.
4624 * Caller must hold rtnl_lock.
4625 */
4626static void bond_deinit(struct net_device *bond_dev)
4627{
4628 struct bonding *bond = bond_dev->priv;
4629
4630 list_del(&bond->bond_list);
4631
4632 bond_work_cancel_all(bond);
4633
4634#ifdef CONFIG_PROC_FS
4635 bond_remove_proc_entry(bond);
4636#endif
4637}
4638
4620/* Unregister and free all bond devices. 4639/* Unregister and free all bond devices.
4621 * Caller must hold rtnl_lock. 4640 * Caller must hold rtnl_lock.
4622 */ 4641 */
@@ -4628,9 +4647,6 @@ static void bond_free_all(void)
4628 struct net_device *bond_dev = bond->dev; 4647 struct net_device *bond_dev = bond->dev;
4629 4648
4630 bond_work_cancel_all(bond); 4649 bond_work_cancel_all(bond);
4631 netif_addr_lock_bh(bond_dev);
4632 bond_mc_list_destroy(bond);
4633 netif_addr_unlock_bh(bond_dev);
4634 /* Release the bonded slaves */ 4650 /* Release the bonded slaves */
4635 bond_release_all(bond_dev); 4651 bond_release_all(bond_dev);
4636 bond_destroy(bond); 4652 bond_destroy(bond);
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 82dd1a891ce7..002d918fb4c7 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0094" 43#define DRV_VERSION "EHEA_0095"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 9b61dc9865d1..9d006878f045 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -632,10 +632,13 @@ static void ehea_rebuild_busmap(void)
632 } 632 }
633} 633}
634 634
635static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add) 635static int ehea_update_busmap(unsigned long pfn, unsigned long nr_pages, int add)
636{ 636{
637 unsigned long i, start_section, end_section; 637 unsigned long i, start_section, end_section;
638 638
639 if (!nr_pages)
640 return 0;
641
639 if (!ehea_bmap) { 642 if (!ehea_bmap) {
640 ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL); 643 ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL);
641 if (!ehea_bmap) 644 if (!ehea_bmap)
@@ -643,7 +646,7 @@ static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add)
643 } 646 }
644 647
645 start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE; 648 start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE;
646 end_section = start_section + ((pgnum * PAGE_SIZE) / EHEA_SECTSIZE); 649 end_section = start_section + ((nr_pages * PAGE_SIZE) / EHEA_SECTSIZE);
647 /* Mark entries as valid or invalid only; address is assigned later */ 650 /* Mark entries as valid or invalid only; address is assigned later */
648 for (i = start_section; i < end_section; i++) { 651 for (i = start_section; i < end_section; i++) {
649 u64 flag; 652 u64 flag;
@@ -692,10 +695,54 @@ int ehea_rem_sect_bmap(unsigned long pfn, unsigned long nr_pages)
692 return ret; 695 return ret;
693} 696}
694 697
695static int ehea_create_busmap_callback(unsigned long pfn, 698static int ehea_is_hugepage(unsigned long pfn)
696 unsigned long nr_pages, void *arg) 699{
700 int page_order;
701
702 if (pfn & EHEA_HUGEPAGE_PFN_MASK)
703 return 0;
704
705 page_order = compound_order(pfn_to_page(pfn));
706 if (page_order + PAGE_SHIFT != EHEA_HUGEPAGESHIFT)
707 return 0;
708
709 return 1;
710}
711
712static int ehea_create_busmap_callback(unsigned long initial_pfn,
713 unsigned long total_nr_pages, void *arg)
697{ 714{
698 return ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_ADD_SECT); 715 int ret;
716 unsigned long pfn, start_pfn, end_pfn, nr_pages;
717
718 if ((total_nr_pages * PAGE_SIZE) < EHEA_HUGEPAGE_SIZE)
719 return ehea_update_busmap(initial_pfn, total_nr_pages,
720 EHEA_BUSMAP_ADD_SECT);
721
722 /* Given chunk is >= 16GB -> check for hugepages */
723 start_pfn = initial_pfn;
724 end_pfn = initial_pfn + total_nr_pages;
725 pfn = start_pfn;
726
727 while (pfn < end_pfn) {
728 if (ehea_is_hugepage(pfn)) {
729 /* Add mem found in front of the hugepage */
730 nr_pages = pfn - start_pfn;
731 ret = ehea_update_busmap(start_pfn, nr_pages,
732 EHEA_BUSMAP_ADD_SECT);
733 if (ret)
734 return ret;
735
736 /* Skip the hugepage */
737 pfn += (EHEA_HUGEPAGE_SIZE / PAGE_SIZE);
738 start_pfn = pfn;
739 } else
740 pfn += (EHEA_SECTSIZE / PAGE_SIZE);
741 }
742
743 /* Add mem found behind the hugepage(s) */
744 nr_pages = pfn - start_pfn;
745 return ehea_update_busmap(start_pfn, nr_pages, EHEA_BUSMAP_ADD_SECT);
699} 746}
700 747
701int ehea_create_busmap(void) 748int ehea_create_busmap(void)
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 1e58dc06b7d2..0817c1e74a19 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -40,6 +40,9 @@
40#define EHEA_PAGESIZE (1UL << EHEA_PAGESHIFT) 40#define EHEA_PAGESIZE (1UL << EHEA_PAGESHIFT)
41#define EHEA_SECTSIZE (1UL << 24) 41#define EHEA_SECTSIZE (1UL << 24)
42#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT) 42#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT)
43#define EHEA_HUGEPAGESHIFT 34
44#define EHEA_HUGEPAGE_SIZE (1UL << EHEA_HUGEPAGESHIFT)
45#define EHEA_HUGEPAGE_PFN_MASK ((EHEA_HUGEPAGE_SIZE - 1) >> PAGE_SHIFT)
43 46
44#if ((1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE) 47#if ((1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE)
45#error eHEA module cannot work if kernel sectionsize < ehea sectionsize 48#error eHEA module cannot work if kernel sectionsize < ehea sectionsize
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 15c422387028..013525f3c3bd 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -584,6 +584,18 @@ static void gfar_configure_serdes(struct net_device *dev)
584 struct gfar_mii __iomem *regs = 584 struct gfar_mii __iomem *regs =
585 (void __iomem *)&priv->regs->gfar_mii_regs; 585 (void __iomem *)&priv->regs->gfar_mii_regs;
586 int tbipa = gfar_read(&priv->regs->tbipa); 586 int tbipa = gfar_read(&priv->regs->tbipa);
587 struct mii_bus *bus = gfar_get_miibus(priv);
588
589 if (bus)
590 mutex_lock(&bus->mdio_lock);
591
592 /* If the link is already up, we must already be ok, and don't need to
593 * configure and reset the TBI<->SerDes link. Maybe U-Boot configured
594 * everything for us? Resetting it takes the link down and requires
595 * several seconds for it to come back.
596 */
597 if (gfar_local_mdio_read(regs, tbipa, MII_BMSR) & BMSR_LSTATUS)
598 goto done;
587 599
588 /* Single clk mode, mii mode off(for serdes communication) */ 600 /* Single clk mode, mii mode off(for serdes communication) */
589 gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); 601 gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT);
@@ -594,6 +606,10 @@ static void gfar_configure_serdes(struct net_device *dev)
594 606
595 gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | 607 gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE |
596 BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); 608 BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000);
609
610 done:
611 if (bus)
612 mutex_unlock(&bus->mdio_lock);
597} 613}
598 614
599static void init_registers(struct net_device *dev) 615static void init_registers(struct net_device *dev)
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index bf73eea98010..0e2595d24933 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -269,6 +269,27 @@ static struct device_driver gianfar_mdio_driver = {
269 .remove = gfar_mdio_remove, 269 .remove = gfar_mdio_remove,
270}; 270};
271 271
272static int match_mdio_bus(struct device *dev, void *data)
273{
274 const struct gfar_private *priv = data;
275 const struct platform_device *pdev = to_platform_device(dev);
276
277 return !strcmp(pdev->name, gianfar_mdio_driver.name) &&
278 pdev->id == priv->einfo->mdio_bus;
279}
280
281/* Given a gfar_priv structure, find the mii_bus controlled by this device (not
282 * necessarily the same as the bus the gfar's PHY is on), if one exists.
283 * Normally only the first gianfar controls a mii_bus. */
284struct mii_bus *gfar_get_miibus(const struct gfar_private *priv)
285{
286 /*const*/ struct device *d;
287
288 d = bus_find_device(gianfar_mdio_driver.bus, NULL, (void *)priv,
289 match_mdio_bus);
290 return d ? dev_get_drvdata(d) : NULL;
291}
292
272int __init gfar_mdio_init(void) 293int __init gfar_mdio_init(void)
273{ 294{
274 return driver_register(&gianfar_mdio_driver); 295 return driver_register(&gianfar_mdio_driver);
diff --git a/drivers/net/gianfar_mii.h b/drivers/net/gianfar_mii.h
index 2af28b16a0e2..02dc970ca1ff 100644
--- a/drivers/net/gianfar_mii.h
+++ b/drivers/net/gianfar_mii.h
@@ -18,6 +18,8 @@
18#ifndef __GIANFAR_MII_H 18#ifndef __GIANFAR_MII_H
19#define __GIANFAR_MII_H 19#define __GIANFAR_MII_H
20 20
21struct gfar_private; /* forward ref */
22
21#define MIIMIND_BUSY 0x00000001 23#define MIIMIND_BUSY 0x00000001
22#define MIIMIND_NOTVALID 0x00000004 24#define MIIMIND_NOTVALID 0x00000004
23 25
@@ -44,6 +46,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
44int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, 46int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
45 int regnum, u16 value); 47 int regnum, u16 value);
46int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum); 48int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
49struct mii_bus *gfar_get_miibus(const struct gfar_private *priv);
47int __init gfar_mdio_init(void); 50int __init gfar_mdio_init(void);
48void gfar_mdio_exit(void); 51void gfar_mdio_exit(void);
49#endif /* GIANFAR_PHY_H */ 52#endif /* GIANFAR_PHY_H */
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 1232ef9fb9ef..87a706694fb3 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2603,7 +2603,7 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2603 of_device_is_compatible(np, "ibm,emac-440gr")) 2603 of_device_is_compatible(np, "ibm,emac-440gr"))
2604 dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX; 2604 dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
2605 if (of_device_is_compatible(np, "ibm,emac-405ez")) { 2605 if (of_device_is_compatible(np, "ibm,emac-405ez")) {
2606#ifdef CONFIG_IBM_NEW_EMAC_NO_FLOW_CONTROL 2606#ifdef CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL
2607 dev->features |= EMAC_FTR_NO_FLOW_CONTROL_40x; 2607 dev->features |= EMAC_FTR_NO_FLOW_CONTROL_40x;
2608#else 2608#else
2609 printk(KERN_ERR "%s: Flow control not disabled!\n", 2609 printk(KERN_ERR "%s: Flow control not disabled!\n",
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 3b43bfd85a0f..b1ac63ab8c16 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -76,15 +76,6 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
76 76
77 skb->protocol = eth_type_trans(skb,dev); 77 skb->protocol = eth_type_trans(skb,dev);
78 78
79#ifdef LOOPBACK_TSO
80 if (skb_is_gso(skb)) {
81 BUG_ON(skb->protocol != htons(ETH_P_IP));
82 BUG_ON(ip_hdr(skb)->protocol != IPPROTO_TCP);
83
84 emulate_large_send_offload(skb);
85 return 0;
86 }
87#endif
88 dev->last_rx = jiffies; 79 dev->last_rx = jiffies;
89 80
90 /* it's OK to use per_cpu_ptr() because BHs are off */ 81 /* it's OK to use per_cpu_ptr() because BHs are off */
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index 1b0eebf84f76..4b9794e97a79 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -35,7 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/cpumask.h>
39 38
40#include <linux/mlx4/driver.h> 39#include <linux/mlx4/driver.h>
41#include <linux/mlx4/device.h> 40#include <linux/mlx4/device.h>
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index be09fdb79cb8..cee199ceba2f 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -360,9 +360,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
360#define QUERY_PORT_ETH_MTU_OFFSET 0x02 360#define QUERY_PORT_ETH_MTU_OFFSET 0x02
361#define QUERY_PORT_WIDTH_OFFSET 0x06 361#define QUERY_PORT_WIDTH_OFFSET 0x06
362#define QUERY_PORT_MAX_GID_PKEY_OFFSET 0x07 362#define QUERY_PORT_MAX_GID_PKEY_OFFSET 0x07
363#define QUERY_PORT_MAC_OFFSET 0x08
364#define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a 363#define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a
365#define QUERY_PORT_MAX_VL_OFFSET 0x0b 364#define QUERY_PORT_MAX_VL_OFFSET 0x0b
365#define QUERY_PORT_MAC_OFFSET 0x10
366 366
367 for (i = 1; i <= dev_cap->num_ports; ++i) { 367 for (i = 1; i <= dev_cap->num_ports; ++i) {
368 err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT, 368 err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT,
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 22e6292212f7..d2cbc7d55b10 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -75,7 +75,7 @@
75#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
76#include "myri10ge_mcp_gen_header.h" 76#include "myri10ge_mcp_gen_header.h"
77 77
78#define MYRI10GE_VERSION_STR "1.4.3-1.371" 78#define MYRI10GE_VERSION_STR "1.4.3-1.375"
79 79
80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
81MODULE_AUTHOR("Maintainer: help@myri.com"); 81MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -1393,6 +1393,7 @@ myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index)
1393 if (tx->req == tx->done) { 1393 if (tx->req == tx->done) {
1394 tx->queue_active = 0; 1394 tx->queue_active = 0;
1395 put_be32(htonl(1), tx->send_stop); 1395 put_be32(htonl(1), tx->send_stop);
1396 mmiowb();
1396 } 1397 }
1397 __netif_tx_unlock(dev_queue); 1398 __netif_tx_unlock(dev_queue);
1398 } 1399 }
@@ -2864,6 +2865,7 @@ again:
2864 if ((mgp->dev->real_num_tx_queues > 1) && tx->queue_active == 0) { 2865 if ((mgp->dev->real_num_tx_queues > 1) && tx->queue_active == 0) {
2865 tx->queue_active = 1; 2866 tx->queue_active = 1;
2866 put_be32(htonl(1), tx->send_go); 2867 put_be32(htonl(1), tx->send_go);
2868 mmiowb();
2867 } 2869 }
2868 tx->pkt_start++; 2870 tx->pkt_start++;
2869 if ((avail - count) < MXGEFW_MAX_SEND_DESC) { 2871 if ((avail - count) < MXGEFW_MAX_SEND_DESC) {
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index ff8fe2332d3f..c22b30533a14 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -399,11 +399,11 @@ static int pppoe_rcv(struct sk_buff *skb,
399 if (skb->len < len) 399 if (skb->len < len)
400 goto drop; 400 goto drop;
401 401
402 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex); 402 if (pskb_trim_rcsum(skb, len))
403 if (!po)
404 goto drop; 403 goto drop;
405 404
406 if (pskb_trim_rcsum(skb, len)) 405 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
406 if (!po)
407 goto drop; 407 goto drop;
408 408
409 return sk_receive_skb(sk_pppox(po), skb, 0); 409 return sk_receive_skb(sk_pppox(po), skb, 0);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 37ff94bdbc83..2d8bfa7bd9e9 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2059,7 +2059,6 @@ static int smc_request_attrib(struct platform_device *pdev,
2059 struct net_device *ndev) 2059 struct net_device *ndev)
2060{ 2060{
2061 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); 2061 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
2062 struct smc_local *lp = netdev_priv(ndev);
2063 2062
2064 if (!res) 2063 if (!res)
2065 return 0; 2064 return 0;
@@ -2074,7 +2073,6 @@ static void smc_release_attrib(struct platform_device *pdev,
2074 struct net_device *ndev) 2073 struct net_device *ndev)
2075{ 2074{
2076 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); 2075 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
2077 struct smc_local *lp = netdev_priv(ndev);
2078 2076
2079 if (res) 2077 if (res)
2080 release_mem_region(res->start, ATTRIB_SIZE); 2078 release_mem_region(res->start, ATTRIB_SIZE);
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 194f1825718a..0ec3281529f9 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -419,9 +419,13 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
419 /* Allocate Tx/Rx descriptor memory */ 419 /* Allocate Tx/Rx descriptor memory */
420 db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * 420 db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) *
421 DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr); 421 DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
422 if (!db->desc_pool_ptr)
423 goto err_out_res;
422 424
423 db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * 425 db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC *
424 TX_DESC_CNT + 4, &db->buf_pool_dma_ptr); 426 TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
427 if (!db->buf_pool_ptr)
428 goto err_out_free_desc;
425 429
426 db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr; 430 db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
427 db->first_tx_desc_dma = db->desc_pool_dma_ptr; 431 db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -468,7 +472,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
468 472
469 err = register_netdev (dev); 473 err = register_netdev (dev);
470 if (err) 474 if (err)
471 goto err_out_res; 475 goto err_out_free_buf;
472 476
473 printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, %pM, irq %d.\n", 477 printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, %pM, irq %d.\n",
474 dev->name, 478 dev->name,
@@ -481,6 +485,12 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
481 485
482 return 0; 486 return 0;
483 487
488err_out_free_buf:
489 pci_free_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
490 db->buf_pool_ptr, db->buf_pool_dma_ptr);
491err_out_free_desc:
492 pci_free_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20,
493 db->desc_pool_ptr, db->desc_pool_dma_ptr);
484err_out_res: 494err_out_res:
485 pci_release_regions(pdev); 495 pci_release_regions(pdev);
486err_out_disable: 496err_out_disable:
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 78df2be8a728..db3377dae9d5 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -396,6 +396,20 @@ static void dm9601_set_multicast(struct net_device *net)
396 dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl); 396 dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
397} 397}
398 398
399static int dm9601_set_mac_address(struct net_device *net, void *p)
400{
401 struct sockaddr *addr = p;
402 struct usbnet *dev = netdev_priv(net);
403
404 if (!is_valid_ether_addr(addr->sa_data))
405 return -EINVAL;
406
407 memcpy(net->dev_addr, addr->sa_data, net->addr_len);
408 dm_write_async(dev, DM_PHY_ADDR, net->addr_len, net->dev_addr);
409
410 return 0;
411}
412
399static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) 413static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
400{ 414{
401 int ret; 415 int ret;
@@ -406,6 +420,7 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
406 420
407 dev->net->do_ioctl = dm9601_ioctl; 421 dev->net->do_ioctl = dm9601_ioctl;
408 dev->net->set_multicast_list = dm9601_set_multicast; 422 dev->net->set_multicast_list = dm9601_set_multicast;
423 dev->net->set_mac_address = dm9601_set_mac_address;
409 dev->net->ethtool_ops = &dm9601_ethtool_ops; 424 dev->net->ethtool_ops = &dm9601_ethtool_ops;
410 dev->net->hard_header_len += DM_TX_OVERHEAD; 425 dev->net->hard_header_len += DM_TX_OVERHEAD;
411 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 426 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 2dced383bcfb..3590ea5a902d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -521,7 +521,7 @@ static void __devexit velocity_remove1(struct pci_dev *pdev)
521 * we don't duplicate code for each option. 521 * we don't duplicate code for each option.
522 */ 522 */
523 523
524static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max, int def, char *name, char *devname) 524static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max, int def, char *name, const char *devname)
525{ 525{
526 if (val == -1) 526 if (val == -1)
527 *opt = def; 527 *opt = def;
@@ -550,7 +550,7 @@ static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max,
550 * we don't duplicate code for each option. 550 * we don't duplicate code for each option.
551 */ 551 */
552 552
553static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 flag, char *name, char *devname) 553static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 flag, char *name, const char *devname)
554{ 554{
555 (*opt) &= (~flag); 555 (*opt) &= (~flag);
556 if (val == -1) 556 if (val == -1)
@@ -576,7 +576,7 @@ static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 fla
576 * for the current device 576 * for the current device
577 */ 577 */
578 578
579static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname) 579static void __devinit velocity_get_options(struct velocity_opt *opts, int index, const char *devname)
580{ 580{
581 581
582 velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname); 582 velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname);
@@ -863,6 +863,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
863 static int first = 1; 863 static int first = 1;
864 struct net_device *dev; 864 struct net_device *dev;
865 int i; 865 int i;
866 const char *drv_string;
866 const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data]; 867 const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
867 struct velocity_info *vptr; 868 struct velocity_info *vptr;
868 struct mac_regs __iomem * regs; 869 struct mac_regs __iomem * regs;
@@ -935,7 +936,9 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
935 dev->dev_addr[i] = readb(&regs->PAR[i]); 936 dev->dev_addr[i] = readb(&regs->PAR[i]);
936 937
937 938
938 velocity_get_options(&vptr->options, velocity_nics, dev->name); 939 drv_string = dev_driver_string(&pdev->dev);
940
941 velocity_get_options(&vptr->options, velocity_nics, drv_string);
939 942
940 /* 943 /*
941 * Mask out the options cannot be set to the chip 944 * Mask out the options cannot be set to the chip
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 327d58589e12..6e92f7b44b1a 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -756,10 +756,11 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
756 case CISCO_ADDR_REQ: 756 case CISCO_ADDR_REQ:
757 /* Stolen from net/ipv4/devinet.c -- SIOCGIFADDR ioctl */ 757 /* Stolen from net/ipv4/devinet.c -- SIOCGIFADDR ioctl */
758 { 758 {
759 struct in_device *in_dev;
760 struct in_ifaddr *ifa;
761 __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */ 759 __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */
762#ifdef CONFIG_INET 760#ifdef CONFIG_INET
761 struct in_device *in_dev;
762 struct in_ifaddr *ifa;
763
763 rcu_read_lock(); 764 rcu_read_lock();
764 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) 765 if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
765 { 766 {
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
index ccd9cd35ecbe..5bf7e01ef0e9 100644
--- a/drivers/net/wan/z85230.c
+++ b/drivers/net/wan/z85230.c
@@ -695,7 +695,6 @@ EXPORT_SYMBOL(z8530_nop);
695 * z8530_interrupt - Handle an interrupt from a Z8530 695 * z8530_interrupt - Handle an interrupt from a Z8530
696 * @irq: Interrupt number 696 * @irq: Interrupt number
697 * @dev_id: The Z8530 device that is interrupting. 697 * @dev_id: The Z8530 device that is interrupting.
698 * @regs: unused
699 * 698 *
700 * A Z85[2]30 device has stuck its hand in the air for attention. 699 * A Z85[2]30 device has stuck its hand in the air for attention.
701 * We scan both the channels on the chip for events and then call 700 * We scan both the channels on the chip for events and then call
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 0f1d6bdd51a2..9e47d727e220 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -661,8 +661,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
661{ 661{
662 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 662 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
663 struct ath5k_softc *sc = hw->priv; 663 struct ath5k_softc *sc = hw->priv;
664 struct ath5k_hw *ah = sc->ah; 664 int err;
665 int i, err;
666 665
667 pci_restore_state(pdev); 666 pci_restore_state(pdev);
668 667
@@ -688,16 +687,6 @@ ath5k_pci_resume(struct pci_dev *pdev)
688 goto err_irq; 687 goto err_irq;
689 ath5k_led_enable(sc); 688 ath5k_led_enable(sc);
690 689
691 /*
692 * Reset the key cache since some parts do not
693 * reset the contents on initial power up or resume.
694 *
695 * FIXME: This may need to be revisited when mac80211 becomes
696 * aware of suspend/resume.
697 */
698 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
699 ath5k_hw_reset_key(ah, i);
700
701 return 0; 690 return 0;
702err_irq: 691err_irq:
703 free_irq(pdev->irq, sc); 692 free_irq(pdev->irq, sc);
@@ -718,7 +707,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
718 struct ath5k_softc *sc = hw->priv; 707 struct ath5k_softc *sc = hw->priv;
719 struct ath5k_hw *ah = sc->ah; 708 struct ath5k_hw *ah = sc->ah;
720 u8 mac[ETH_ALEN]; 709 u8 mac[ETH_ALEN];
721 unsigned int i;
722 int ret; 710 int ret;
723 711
724 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device); 712 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
@@ -737,13 +725,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
737 __set_bit(ATH_STAT_MRRETRY, sc->status); 725 __set_bit(ATH_STAT_MRRETRY, sc->status);
738 726
739 /* 727 /*
740 * Reset the key cache since some parts do not
741 * reset the contents on initial power up.
742 */
743 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
744 ath5k_hw_reset_key(ah, i);
745
746 /*
747 * Collect the channel list. The 802.11 layer 728 * Collect the channel list. The 802.11 layer
748 * is resposible for filtering this list based 729 * is resposible for filtering this list based
749 * on settings like the phy mode and regulatory 730 * on settings like the phy mode and regulatory
@@ -2202,7 +2183,8 @@ ath5k_beacon_config(struct ath5k_softc *sc)
2202static int 2183static int
2203ath5k_init(struct ath5k_softc *sc, bool is_resume) 2184ath5k_init(struct ath5k_softc *sc, bool is_resume)
2204{ 2185{
2205 int ret; 2186 struct ath5k_hw *ah = sc->ah;
2187 int ret, i;
2206 2188
2207 mutex_lock(&sc->lock); 2189 mutex_lock(&sc->lock);
2208 2190
@@ -2235,10 +2217,17 @@ ath5k_init(struct ath5k_softc *sc, bool is_resume)
2235 if (ret) 2217 if (ret)
2236 goto done; 2218 goto done;
2237 2219
2220 /*
2221 * Reset the key cache since some parts do not reset the
2222 * contents on initial power up or resume from suspend.
2223 */
2224 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
2225 ath5k_hw_reset_key(ah, i);
2226
2238 __set_bit(ATH_STAT_STARTED, sc->status); 2227 __set_bit(ATH_STAT_STARTED, sc->status);
2239 2228
2240 /* Set ack to be sent at low bit-rates */ 2229 /* Set ack to be sent at low bit-rates */
2241 ath5k_hw_set_ack_bitrate_high(sc->ah, false); 2230 ath5k_hw_set_ack_bitrate_high(ah, false);
2242 2231
2243 mod_timer(&sc->calib_tim, round_jiffies(jiffies + 2232 mod_timer(&sc->calib_tim, round_jiffies(jiffies +
2244 msecs_to_jiffies(ath5k_calinterval * 1000))); 2233 msecs_to_jiffies(ath5k_calinterval * 1000)));
@@ -2953,10 +2942,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
2953 sc->opmode != NL80211_IFTYPE_MESH_POINT && 2942 sc->opmode != NL80211_IFTYPE_MESH_POINT &&
2954 test_bit(ATH_STAT_PROMISC, sc->status)) 2943 test_bit(ATH_STAT_PROMISC, sc->status))
2955 rfilt |= AR5K_RX_FILTER_PROM; 2944 rfilt |= AR5K_RX_FILTER_PROM;
2956 if (sc->opmode == NL80211_IFTYPE_STATION || 2945 if (sc->opmode == NL80211_IFTYPE_ADHOC)
2957 sc->opmode == NL80211_IFTYPE_ADHOC) {
2958 rfilt |= AR5K_RX_FILTER_BEACON; 2946 rfilt |= AR5K_RX_FILTER_BEACON;
2959 }
2960 2947
2961 /* Set filters */ 2948 /* Set filters */
2962 ath5k_hw_set_rx_filter(ah,rfilt); 2949 ath5k_hw_set_rx_filter(ah,rfilt);
diff --git a/drivers/net/wireless/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c
index 8f92d670f614..19980cbd5d5f 100644
--- a/drivers/net/wireless/ath5k/debug.c
+++ b/drivers/net/wireless/ath5k/debug.c
@@ -339,7 +339,7 @@ static struct {
339 { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" }, 339 { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" },
340 { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" }, 340 { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" },
341 { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" }, 341 { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" },
342 { ATH5K_DEBUG_LED, "led", "LED mamagement" }, 342 { ATH5K_DEBUG_LED, "led", "LED management" },
343 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, 343 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" },
344 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, 344 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
345 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, 345 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" },
diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c
index ea2e1a20b499..ceaa6c475c06 100644
--- a/drivers/net/wireless/ath5k/initvals.c
+++ b/drivers/net/wireless/ath5k/initvals.c
@@ -806,6 +806,8 @@ static const struct ath5k_ini_mode ar5212_rf5111_ini_mode_end[] = {
806 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 806 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
807 { AR5K_PHY(642), 807 { AR5K_PHY(642),
808 { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 808 { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
809 { 0xa228,
810 { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } },
809 { 0xa23c, 811 { 0xa23c,
810 { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } }, 812 { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },
811}; 813};
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c
index 8f1886834e61..1b6d45b6772d 100644
--- a/drivers/net/wireless/ath5k/reset.c
+++ b/drivers/net/wireless/ath5k/reset.c
@@ -537,9 +537,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
537 mdelay(1); 537 mdelay(1);
538 538
539 /* 539 /*
540 * Write some more initial register settings 540 * Write some more initial register settings for revised chips
541 */ 541 */
542 if (ah->ah_version == AR5K_AR5212) { 542 if (ah->ah_version == AR5K_AR5212 &&
543 ah->ah_phy_revision > 0x41) {
543 ath5k_hw_reg_write(ah, 0x0002a002, 0x982c); 544 ath5k_hw_reg_write(ah, 0x0002a002, 0x982c);
544 545
545 if (channel->hw_value == CHANNEL_G) 546 if (channel->hw_value == CHANNEL_G)
@@ -558,19 +559,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
558 else 559 else
559 ath5k_hw_reg_write(ah, 0x00000000, 0x994c); 560 ath5k_hw_reg_write(ah, 0x00000000, 0x994c);
560 561
561 /* Some bits are disabled here, we know nothing about 562 /* Got this from legacy-hal */
562 * register 0xa228 yet, most of the times this ends up 563 AR5K_REG_DISABLE_BITS(ah, 0xa228, 0x200);
563 * with a value 0x9b5 -haven't seen any dump with 564
564 * a different value- */ 565 AR5K_REG_MASKED_BITS(ah, 0xa228, 0x800, 0xfffe03ff);
565 /* Got this from decompiling binary HAL */
566 data = ath5k_hw_reg_read(ah, 0xa228);
567 data &= 0xfffffdff;
568 ath5k_hw_reg_write(ah, data, 0xa228);
569
570 data = ath5k_hw_reg_read(ah, 0xa228);
571 data &= 0xfffe03ff;
572 ath5k_hw_reg_write(ah, data, 0xa228);
573 data = 0;
574 566
575 /* Just write 0x9b5 ? */ 567 /* Just write 0x9b5 ? */
576 /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */ 568 /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 2af9a14446e4..fe9307424a91 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2086,7 +2086,6 @@ static void iwl_alive_start(struct iwl_priv *priv)
2086 iwl4965_error_recovery(priv); 2086 iwl4965_error_recovery(priv);
2087 2087
2088 iwl_power_update_mode(priv, 1); 2088 iwl_power_update_mode(priv, 1);
2089 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
2090 2089
2091 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) 2090 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
2092 iwl4965_set_mode(priv, priv->iw_mode); 2091 iwl4965_set_mode(priv, priv->iw_mode);
@@ -2338,6 +2337,7 @@ static void iwl_bg_alive_start(struct work_struct *data)
2338 mutex_lock(&priv->mutex); 2337 mutex_lock(&priv->mutex);
2339 iwl_alive_start(priv); 2338 iwl_alive_start(priv);
2340 mutex_unlock(&priv->mutex); 2339 mutex_unlock(&priv->mutex);
2340 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
2341} 2341}
2342 2342
2343static void iwl4965_bg_rf_kill(struct work_struct *work) 2343static void iwl4965_bg_rf_kill(struct work_struct *work)
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 8542d85f36af..d45b07cf6a62 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -604,9 +604,9 @@ int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel,
604 if (ret == 0) { 604 if (ret == 0) {
605 *curlevel = le16_to_cpu(cmd.curlevel); 605 *curlevel = le16_to_cpu(cmd.curlevel);
606 if (minlevel) 606 if (minlevel)
607 *minlevel = le16_to_cpu(cmd.minlevel); 607 *minlevel = cmd.minlevel;
608 if (maxlevel) 608 if (maxlevel)
609 *maxlevel = le16_to_cpu(cmd.maxlevel); 609 *maxlevel = cmd.maxlevel;
610 } 610 }
611 611
612 lbs_deb_leave(LBS_DEB_CMD); 612 lbs_deb_leave(LBS_DEB_CMD);
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index fcaef38d5df9..351b3f6e5664 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -596,8 +596,8 @@ static int lbs_process_bss(struct bss_descriptor *bss,
596 596
597 switch (elem->id) { 597 switch (elem->id) {
598 case MFIE_TYPE_SSID: 598 case MFIE_TYPE_SSID:
599 bss->ssid_len = elem->len; 599 bss->ssid_len = min_t(int, 32, elem->len);
600 memcpy(bss->ssid, elem->data, elem->len); 600 memcpy(bss->ssid, elem->data, bss->ssid_len);
601 lbs_deb_scan("got SSID IE: '%s', len %u\n", 601 lbs_deb_scan("got SSID IE: '%s', len %u\n",
602 escape_essid(bss->ssid, bss->ssid_len), 602 escape_essid(bss->ssid, bss->ssid_len),
603 bss->ssid_len); 603 bss->ssid_len);
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 72859decd907..6370c44c64d5 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -319,7 +319,7 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
319 void *tmp; 319 void *tmp;
320 int err; 320 int err;
321 u8 *end = (u8 *)eeprom + len; 321 u8 *end = (u8 *)eeprom + len;
322 u16 synth; 322 u16 synth = 0;
323 323
324 wrap = (struct eeprom_pda_wrap *) eeprom; 324 wrap = (struct eeprom_pda_wrap *) eeprom;
325 entry = (void *)wrap->data + le16_to_cpu(wrap->len); 325 entry = (void *)wrap->data + le16_to_cpu(wrap->len);
@@ -421,7 +421,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
421 entry = (void *)entry + (entry_len + 1)*2; 421 entry = (void *)entry + (entry_len + 1)*2;
422 } 422 }
423 423
424 if (!priv->iq_autocal || !priv->output_limit || !priv->curve_data) { 424 if (!synth || !priv->iq_autocal || !priv->output_limit ||
425 !priv->curve_data) {
425 printk(KERN_ERR "p54: not all required entries found in eeprom!\n"); 426 printk(KERN_ERR "p54: not all required entries found in eeprom!\n");
426 err = -EINVAL; 427 err = -EINVAL;
427 goto err; 428 goto err;
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 194237b66424..bba2c90e533f 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -346,68 +346,6 @@ static void p54p_tx(struct ieee80211_hw *dev, struct p54_control_hdr *data,
346 printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy)); 346 printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
347} 347}
348 348
349static int p54p_open(struct ieee80211_hw *dev)
350{
351 struct p54p_priv *priv = dev->priv;
352 int err;
353
354 init_completion(&priv->boot_comp);
355 err = request_irq(priv->pdev->irq, &p54p_interrupt,
356 IRQF_SHARED, "p54pci", dev);
357 if (err) {
358 printk(KERN_ERR "%s: failed to register IRQ handler\n",
359 wiphy_name(dev->wiphy));
360 return err;
361 }
362
363 memset(priv->ring_control, 0, sizeof(*priv->ring_control));
364 err = p54p_upload_firmware(dev);
365 if (err) {
366 free_irq(priv->pdev->irq, dev);
367 return err;
368 }
369 priv->rx_idx_data = priv->tx_idx_data = 0;
370 priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0;
371
372 p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
373 ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
374
375 p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
376 ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
377
378 P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
379 P54P_READ(ring_control_base);
380 wmb();
381 udelay(10);
382
383 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
384 P54P_READ(int_enable);
385 wmb();
386 udelay(10);
387
388 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
389 P54P_READ(dev_int);
390
391 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
392 printk(KERN_ERR "%s: Cannot boot firmware!\n",
393 wiphy_name(dev->wiphy));
394 free_irq(priv->pdev->irq, dev);
395 return -ETIMEDOUT;
396 }
397
398 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
399 P54P_READ(int_enable);
400 wmb();
401 udelay(10);
402
403 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
404 P54P_READ(dev_int);
405 wmb();
406 udelay(10);
407
408 return 0;
409}
410
411static void p54p_stop(struct ieee80211_hw *dev) 349static void p54p_stop(struct ieee80211_hw *dev)
412{ 350{
413 struct p54p_priv *priv = dev->priv; 351 struct p54p_priv *priv = dev->priv;
@@ -474,6 +412,68 @@ static void p54p_stop(struct ieee80211_hw *dev)
474 memset(ring_control, 0, sizeof(*ring_control)); 412 memset(ring_control, 0, sizeof(*ring_control));
475} 413}
476 414
415static int p54p_open(struct ieee80211_hw *dev)
416{
417 struct p54p_priv *priv = dev->priv;
418 int err;
419
420 init_completion(&priv->boot_comp);
421 err = request_irq(priv->pdev->irq, &p54p_interrupt,
422 IRQF_SHARED, "p54pci", dev);
423 if (err) {
424 printk(KERN_ERR "%s: failed to register IRQ handler\n",
425 wiphy_name(dev->wiphy));
426 return err;
427 }
428
429 memset(priv->ring_control, 0, sizeof(*priv->ring_control));
430 err = p54p_upload_firmware(dev);
431 if (err) {
432 free_irq(priv->pdev->irq, dev);
433 return err;
434 }
435 priv->rx_idx_data = priv->tx_idx_data = 0;
436 priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0;
437
438 p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
439 ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
440
441 p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
442 ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
443
444 P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
445 P54P_READ(ring_control_base);
446 wmb();
447 udelay(10);
448
449 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
450 P54P_READ(int_enable);
451 wmb();
452 udelay(10);
453
454 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
455 P54P_READ(dev_int);
456
457 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
458 printk(KERN_ERR "%s: Cannot boot firmware!\n",
459 wiphy_name(dev->wiphy));
460 p54p_stop(dev);
461 return -ETIMEDOUT;
462 }
463
464 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
465 P54P_READ(int_enable);
466 wmb();
467 udelay(10);
468
469 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
470 P54P_READ(dev_int);
471 wmb();
472 udelay(10);
473
474 return 0;
475}
476
477static int __devinit p54p_probe(struct pci_dev *pdev, 477static int __devinit p54p_probe(struct pci_dev *pdev,
478 const struct pci_device_id *id) 478 const struct pci_device_id *id)
479{ 479{
@@ -555,11 +555,13 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
555 spin_lock_init(&priv->lock); 555 spin_lock_init(&priv->lock);
556 tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev); 556 tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);
557 557
558 p54p_open(dev); 558 err = p54p_open(dev);
559 if (err)
560 goto err_free_common;
559 err = p54_read_eeprom(dev); 561 err = p54_read_eeprom(dev);
560 p54p_stop(dev); 562 p54p_stop(dev);
561 if (err) 563 if (err)
562 goto err_free_desc; 564 goto err_free_common;
563 565
564 err = ieee80211_register_hw(dev); 566 err = ieee80211_register_hw(dev);
565 if (err) { 567 if (err) {
@@ -572,8 +574,6 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
572 574
573 err_free_common: 575 err_free_common:
574 p54_free_common(dev); 576 p54_free_common(dev);
575
576 err_free_desc:
577 pci_free_consistent(pdev, sizeof(*priv->ring_control), 577 pci_free_consistent(pdev, sizeof(*priv->ring_control),
578 priv->ring_control, priv->ring_control_dma); 578 priv->ring_control, priv->ring_control_dma);
579 579
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig
index f839ce044afd..95511ac22470 100644
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -1,5 +1,5 @@
1menuconfig RT2X00 1menuconfig RT2X00
2 bool "Ralink driver support" 2 tristate "Ralink driver support"
3 depends on MAC80211 && WLAN_80211 && EXPERIMENTAL 3 depends on MAC80211 && WLAN_80211 && EXPERIMENTAL
4 ---help--- 4 ---help---
5 This will enable the experimental support for the Ralink drivers, 5 This will enable the experimental support for the Ralink drivers,
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index b1899e9c1f65..0cd5fbc7f2c2 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -112,7 +112,7 @@ static int parport_probe(struct pcmcia_device *link)
112 112
113 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 113 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
114 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 114 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
115 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 115 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
116 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 116 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
117 link->conf.Attributes = CONF_ENABLE_IRQ; 117 link->conf.Attributes = CONF_ENABLE_IRQ;
118 link->conf.IntType = INT_MEMORY_AND_IO; 118 link->conf.IntType = INT_MEMORY_AND_IO;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 96cf8ecd04ce..bbf66ea8fd87 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -43,20 +43,6 @@ static void __devinit quirk_mellanox_tavor(struct pci_dev *dev)
43DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor); 43DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor);
44DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor); 44DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor);
45 45
46/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
47int forbid_dac __read_mostly;
48EXPORT_SYMBOL(forbid_dac);
49
50static __devinit void via_no_dac(struct pci_dev *dev)
51{
52 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
53 dev_info(&dev->dev,
54 "VIA PCI bridge detected. Disabling DAC.\n");
55 forbid_dac = 1;
56 }
57}
58DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
59
60/* Deal with broken BIOS'es that neglect to enable passive release, 46/* Deal with broken BIOS'es that neglect to enable passive release,
61 which can cause problems in combination with the 82441FX/PPro MTRRs */ 47 which can cause problems in combination with the 82441FX/PPro MTRRs */
62static void quirk_passive_release(struct pci_dev *dev) 48static void quirk_passive_release(struct pci_dev *dev)
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index afea2b2558b5..76d4a98f0955 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -693,8 +693,9 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
693 type = 0; 693 type = 0;
694 if (s->functions > 1) /* All of this ought to be handled higher up */ 694 if (s->functions > 1) /* All of this ought to be handled higher up */
695 type = IRQF_SHARED; 695 type = IRQF_SHARED;
696 if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) 696 else if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
697 type = IRQF_SHARED; 697 type = IRQF_SHARED;
698 else printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n");
698 699
699#ifdef CONFIG_PCMCIA_PROBE 700#ifdef CONFIG_PCMCIA_PROBE
700 701
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 3688e339db87..773b29cec8be 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -79,6 +79,11 @@ struct da903x_regulator_info {
79 int enable_bit; 79 int enable_bit;
80}; 80};
81 81
82static inline struct device *to_da903x_dev(struct regulator_dev *rdev)
83{
84 return rdev_get_dev(rdev)->parent->parent;
85}
86
82static inline int check_range(struct da903x_regulator_info *info, 87static inline int check_range(struct da903x_regulator_info *info,
83 int min_uV, int max_uV) 88 int min_uV, int max_uV)
84{ 89{
@@ -93,7 +98,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
93 int min_uV, int max_uV) 98 int min_uV, int max_uV)
94{ 99{
95 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 100 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
96 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 101 struct device *da9034_dev = to_da903x_dev(rdev);
97 uint8_t val, mask; 102 uint8_t val, mask;
98 103
99 if (check_range(info, min_uV, max_uV)) { 104 if (check_range(info, min_uV, max_uV)) {
@@ -111,7 +116,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
111static int da903x_get_voltage(struct regulator_dev *rdev) 116static int da903x_get_voltage(struct regulator_dev *rdev)
112{ 117{
113 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 118 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
114 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 119 struct device *da9034_dev = to_da903x_dev(rdev);
115 uint8_t val, mask; 120 uint8_t val, mask;
116 int ret; 121 int ret;
117 122
@@ -128,7 +133,7 @@ static int da903x_get_voltage(struct regulator_dev *rdev)
128static int da903x_enable(struct regulator_dev *rdev) 133static int da903x_enable(struct regulator_dev *rdev)
129{ 134{
130 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 135 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
131 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 136 struct device *da9034_dev = to_da903x_dev(rdev);
132 137
133 return da903x_set_bits(da9034_dev, info->enable_reg, 138 return da903x_set_bits(da9034_dev, info->enable_reg,
134 1 << info->enable_bit); 139 1 << info->enable_bit);
@@ -137,7 +142,7 @@ static int da903x_enable(struct regulator_dev *rdev)
137static int da903x_disable(struct regulator_dev *rdev) 142static int da903x_disable(struct regulator_dev *rdev)
138{ 143{
139 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 144 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
140 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 145 struct device *da9034_dev = to_da903x_dev(rdev);
141 146
142 return da903x_clr_bits(da9034_dev, info->enable_reg, 147 return da903x_clr_bits(da9034_dev, info->enable_reg,
143 1 << info->enable_bit); 148 1 << info->enable_bit);
@@ -146,7 +151,7 @@ static int da903x_disable(struct regulator_dev *rdev)
146static int da903x_is_enabled(struct regulator_dev *rdev) 151static int da903x_is_enabled(struct regulator_dev *rdev)
147{ 152{
148 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 153 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
149 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 154 struct device *da9034_dev = to_da903x_dev(rdev);
150 uint8_t reg_val; 155 uint8_t reg_val;
151 int ret; 156 int ret;
152 157
@@ -162,7 +167,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev,
162 int min_uV, int max_uV) 167 int min_uV, int max_uV)
163{ 168{
164 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 169 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
165 struct device *da903x_dev = rdev_get_dev(rdev)->parent; 170 struct device *da903x_dev = to_da903x_dev(rdev);
166 uint8_t val, mask; 171 uint8_t val, mask;
167 int ret; 172 int ret;
168 173
@@ -189,7 +194,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
189 int min_uV, int max_uV) 194 int min_uV, int max_uV)
190{ 195{
191 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 196 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
192 struct device *da903x_dev = rdev_get_dev(rdev)->parent; 197 struct device *da903x_dev = to_da903x_dev(rdev);
193 uint8_t val, mask; 198 uint8_t val, mask;
194 int thresh; 199 int thresh;
195 200
@@ -215,7 +220,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
215static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) 220static int da9030_get_ldo14_voltage(struct regulator_dev *rdev)
216{ 221{
217 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 222 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
218 struct device *da903x_dev = rdev_get_dev(rdev)->parent; 223 struct device *da903x_dev = to_da903x_dev(rdev);
219 uint8_t val, mask; 224 uint8_t val, mask;
220 int ret; 225 int ret;
221 226
@@ -238,7 +243,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev,
238 int min_uV, int max_uV) 243 int min_uV, int max_uV)
239{ 244{
240 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 245 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
241 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 246 struct device *da9034_dev = to_da903x_dev(rdev);
242 uint8_t val, mask; 247 uint8_t val, mask;
243 int ret; 248 int ret;
244 249
@@ -264,7 +269,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
264 int min_uV, int max_uV) 269 int min_uV, int max_uV)
265{ 270{
266 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 271 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
267 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 272 struct device *da9034_dev = to_da903x_dev(rdev);
268 uint8_t val, mask; 273 uint8_t val, mask;
269 274
270 if (check_range(info, min_uV, max_uV)) { 275 if (check_range(info, min_uV, max_uV)) {
@@ -283,7 +288,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
283static int da9034_get_ldo12_voltage(struct regulator_dev *rdev) 288static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
284{ 289{
285 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 290 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
286 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 291 struct device *da9034_dev = to_da903x_dev(rdev);
287 uint8_t val, mask; 292 uint8_t val, mask;
288 int ret; 293 int ret;
289 294
@@ -466,7 +471,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
466 if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15) 471 if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15)
467 ri->desc.ops = &da9030_regulator_ldo1_15_ops; 472 ri->desc.ops = &da9030_regulator_ldo1_15_ops;
468 473
469 rdev = regulator_register(&ri->desc, pdev->dev.parent, ri); 474 rdev = regulator_register(&ri->desc, &pdev->dev, ri);
470 if (IS_ERR(rdev)) { 475 if (IS_ERR(rdev)) {
471 dev_err(&pdev->dev, "failed to register regulator %s\n", 476 dev_err(&pdev->dev, "failed to register regulator %s\n",
472 ri->desc.name); 477 ri->desc.name);
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index 37d131d03f33..45e5b106af73 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -189,7 +189,7 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
189 .set_time = ds3234_set_time, 189 .set_time = ds3234_set_time,
190}; 190};
191 191
192static int ds3234_probe(struct spi_device *spi) 192static int __devinit ds3234_probe(struct spi_device *spi)
193{ 193{
194 struct rtc_device *rtc; 194 struct rtc_device *rtc;
195 unsigned char tmp; 195 unsigned char tmp;
@@ -249,7 +249,7 @@ static int ds3234_probe(struct spi_device *spi)
249 return 0; 249 return 0;
250} 250}
251 251
252static int __exit ds3234_remove(struct spi_device *spi) 252static int __devexit ds3234_remove(struct spi_device *spi)
253{ 253{
254 struct ds3234 *chip = platform_get_drvdata(spi); 254 struct ds3234 *chip = platform_get_drvdata(spi);
255 struct rtc_device *rtc = chip->rtc; 255 struct rtc_device *rtc = chip->rtc;
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 910bc704939c..f59277bbedaa 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -455,6 +455,8 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
455 455
456 s3c_rtc_setfreq(&pdev->dev, 1); 456 s3c_rtc_setfreq(&pdev->dev, 1);
457 457
458 device_init_wakeup(&pdev->dev, 1);
459
458 /* register RTC and exit */ 460 /* register RTC and exit */
459 461
460 rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops, 462 rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops,
@@ -507,7 +509,7 @@ static int s3c_rtc_resume(struct platform_device *pdev)
507#define s3c_rtc_resume NULL 509#define s3c_rtc_resume NULL
508#endif 510#endif
509 511
510static struct platform_driver s3c2410_rtcdrv = { 512static struct platform_driver s3c2410_rtc_driver = {
511 .probe = s3c_rtc_probe, 513 .probe = s3c_rtc_probe,
512 .remove = __devexit_p(s3c_rtc_remove), 514 .remove = __devexit_p(s3c_rtc_remove),
513 .suspend = s3c_rtc_suspend, 515 .suspend = s3c_rtc_suspend,
@@ -523,12 +525,12 @@ static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics
523static int __init s3c_rtc_init(void) 525static int __init s3c_rtc_init(void)
524{ 526{
525 printk(banner); 527 printk(banner);
526 return platform_driver_register(&s3c2410_rtcdrv); 528 return platform_driver_register(&s3c2410_rtc_driver);
527} 529}
528 530
529static void __exit s3c_rtc_exit(void) 531static void __exit s3c_rtc_exit(void)
530{ 532{
531 platform_driver_unregister(&s3c2410_rtcdrv); 533 platform_driver_unregister(&s3c2410_rtc_driver);
532} 534}
533 535
534module_init(s3c_rtc_init); 536module_init(s3c_rtc_init);
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 023803dbb0c7..ae18baf59f06 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -76,7 +76,7 @@ tapeblock_trigger_requeue(struct tape_device *device)
76static void 76static void
77tapeblock_end_request(struct request *req, int error) 77tapeblock_end_request(struct request *req, int error)
78{ 78{
79 if (__blk_end_request(req, error, blk_rq_bytes(req))) 79 if (blk_end_request(req, error, blk_rq_bytes(req)))
80 BUG(); 80 BUG();
81} 81}
82 82
@@ -166,7 +166,7 @@ tapeblock_requeue(struct work_struct *work) {
166 nr_queued++; 166 nr_queued++;
167 spin_unlock(get_ccwdev_lock(device->cdev)); 167 spin_unlock(get_ccwdev_lock(device->cdev));
168 168
169 spin_lock(&device->blk_data.request_queue_lock); 169 spin_lock_irq(&device->blk_data.request_queue_lock);
170 while ( 170 while (
171 !blk_queue_plugged(queue) && 171 !blk_queue_plugged(queue) &&
172 elv_next_request(queue) && 172 elv_next_request(queue) &&
@@ -176,7 +176,9 @@ tapeblock_requeue(struct work_struct *work) {
176 if (rq_data_dir(req) == WRITE) { 176 if (rq_data_dir(req) == WRITE) {
177 DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); 177 DBF_EVENT(1, "TBLOCK: Rejecting write request\n");
178 blkdev_dequeue_request(req); 178 blkdev_dequeue_request(req);
179 spin_unlock_irq(&device->blk_data.request_queue_lock);
179 tapeblock_end_request(req, -EIO); 180 tapeblock_end_request(req, -EIO);
181 spin_lock_irq(&device->blk_data.request_queue_lock);
180 continue; 182 continue;
181 } 183 }
182 blkdev_dequeue_request(req); 184 blkdev_dequeue_request(req);
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index d7073dbf825c..f9bb51fa7f5b 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -1200,7 +1200,7 @@ tape_open(struct tape_device *device)
1200{ 1200{
1201 int rc; 1201 int rc;
1202 1202
1203 spin_lock(get_ccwdev_lock(device->cdev)); 1203 spin_lock_irq(get_ccwdev_lock(device->cdev));
1204 if (device->tape_state == TS_NOT_OPER) { 1204 if (device->tape_state == TS_NOT_OPER) {
1205 DBF_EVENT(6, "TAPE:nodev\n"); 1205 DBF_EVENT(6, "TAPE:nodev\n");
1206 rc = -ENODEV; 1206 rc = -ENODEV;
@@ -1218,7 +1218,7 @@ tape_open(struct tape_device *device)
1218 tape_state_set(device, TS_IN_USE); 1218 tape_state_set(device, TS_IN_USE);
1219 rc = 0; 1219 rc = 0;
1220 } 1220 }
1221 spin_unlock(get_ccwdev_lock(device->cdev)); 1221 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1222 return rc; 1222 return rc;
1223} 1223}
1224 1224
@@ -1228,11 +1228,11 @@ tape_open(struct tape_device *device)
1228int 1228int
1229tape_release(struct tape_device *device) 1229tape_release(struct tape_device *device)
1230{ 1230{
1231 spin_lock(get_ccwdev_lock(device->cdev)); 1231 spin_lock_irq(get_ccwdev_lock(device->cdev));
1232 if (device->tape_state == TS_IN_USE) 1232 if (device->tape_state == TS_IN_USE)
1233 tape_state_set(device, TS_UNUSED); 1233 tape_state_set(device, TS_UNUSED);
1234 module_put(device->discipline->owner); 1234 module_put(device->discipline->owner);
1235 spin_unlock(get_ccwdev_lock(device->cdev)); 1235 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1236 return 0; 1236 return 0;
1237} 1237}
1238 1238
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
index b5390821434f..f05590355be8 100644
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -20,6 +20,7 @@ static struct dentry *debugfs_root;
20#define MAX_DEBUGFS_QUEUES 32 20#define MAX_DEBUGFS_QUEUES 32
21static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL }; 21static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL };
22static DEFINE_MUTEX(debugfs_mutex); 22static DEFINE_MUTEX(debugfs_mutex);
23#define QDIO_DEBUGFS_NAME_LEN 40
23 24
24void qdio_allocate_do_dbf(struct qdio_initialize *init_data) 25void qdio_allocate_do_dbf(struct qdio_initialize *init_data)
25{ 26{
@@ -152,17 +153,6 @@ static int qstat_seq_open(struct inode *inode, struct file *filp)
152 filp->f_path.dentry->d_inode->i_private); 153 filp->f_path.dentry->d_inode->i_private);
153} 154}
154 155
155static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name)
156{
157 memset(name, 0, sizeof(name));
158 sprintf(name, "%s", dev_name(&cdev->dev));
159 if (q->is_input_q)
160 sprintf(name + strlen(name), "_input");
161 else
162 sprintf(name + strlen(name), "_output");
163 sprintf(name + strlen(name), "_%d", q->nr);
164}
165
166static void remove_debugfs_entry(struct qdio_q *q) 156static void remove_debugfs_entry(struct qdio_q *q)
167{ 157{
168 int i; 158 int i;
@@ -189,14 +179,17 @@ static struct file_operations debugfs_fops = {
189static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) 179static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev)
190{ 180{
191 int i = 0; 181 int i = 0;
192 char name[40]; 182 char name[QDIO_DEBUGFS_NAME_LEN];
193 183
194 while (debugfs_queues[i] != NULL) { 184 while (debugfs_queues[i] != NULL) {
195 i++; 185 i++;
196 if (i >= MAX_DEBUGFS_QUEUES) 186 if (i >= MAX_DEBUGFS_QUEUES)
197 return; 187 return;
198 } 188 }
199 get_queue_name(q, cdev, name); 189 snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%s_%d",
190 dev_name(&cdev->dev),
191 q->is_input_q ? "input" : "output",
192 q->nr);
200 debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, 193 debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,
201 debugfs_root, q, &debugfs_fops); 194 debugfs_root, q, &debugfs_fops);
202} 195}
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index a50682d2a0fa..7c8659151993 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -1083,7 +1083,6 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
1083 case -EIO: 1083 case -EIO:
1084 sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no); 1084 sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no);
1085 QDIO_DBF_TEXT2(1, setup, dbf_text); 1085 QDIO_DBF_TEXT2(1, setup, dbf_text);
1086 qdio_int_error(cdev);
1087 return; 1086 return;
1088 case -ETIMEDOUT: 1087 case -ETIMEDOUT:
1089 sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no); 1088 sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 7de410d5be4a..52d26592c72c 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3025,7 +3025,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3025 struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill, 3025 struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill,
3026 int offset) 3026 int offset)
3027{ 3027{
3028 int length = skb->len - offset; 3028 int length = skb->len;
3029 int length_here; 3029 int length_here;
3030 int element; 3030 int element;
3031 char *data; 3031 char *data;
@@ -3037,6 +3037,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3037 3037
3038 if (offset >= 0) { 3038 if (offset >= 0) {
3039 data = skb->data + offset; 3039 data = skb->data + offset;
3040 length -= offset;
3040 first_lap = 0; 3041 first_lap = 0;
3041 } 3042 }
3042 3043
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 18623ef01287..8a8fad7a8bea 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -367,8 +367,6 @@ static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode)
367 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 367 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
368 368
369 qeth_set_allowed_threads(card, 0, 1); 369 qeth_set_allowed_threads(card, 0, 1);
370 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD))
371 return -ERESTARTSYS;
372 if (card->read.state == CH_STATE_UP && 370 if (card->read.state == CH_STATE_UP &&
373 card->write.state == CH_STATE_UP && 371 card->write.state == CH_STATE_UP &&
374 (card->state == CARD_STATE_UP)) { 372 (card->state == CARD_STATE_UP)) {
@@ -445,12 +443,15 @@ static void qeth_l2_process_inbound_buffer(struct qeth_card *card,
445 netif_rx(skb); 443 netif_rx(skb);
446 break; 444 break;
447 case QETH_HEADER_TYPE_OSN: 445 case QETH_HEADER_TYPE_OSN:
448 skb_push(skb, sizeof(struct qeth_hdr)); 446 if (card->info.type == QETH_CARD_TYPE_OSN) {
449 skb_copy_to_linear_data(skb, hdr, 447 skb_push(skb, sizeof(struct qeth_hdr));
448 skb_copy_to_linear_data(skb, hdr,
450 sizeof(struct qeth_hdr)); 449 sizeof(struct qeth_hdr));
451 len = skb->len; 450 len = skb->len;
452 card->osn_info.data_cb(skb); 451 card->osn_info.data_cb(skb);
453 break; 452 break;
453 }
454 /* else unknown */
454 default: 455 default:
455 dev_kfree_skb_any(skb); 456 dev_kfree_skb_any(skb);
456 QETH_DBF_TEXT(TRACE, 3, "inbunkno"); 457 QETH_DBF_TEXT(TRACE, 3, "inbunkno");
@@ -969,12 +970,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
969 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 970 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
970 971
971 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); 972 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1);
972 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD)) {
973 PRINT_WARN("set_online of card %s interrupted by user!\n",
974 CARD_BUS_ID(card));
975 return -ERESTARTSYS;
976 }
977
978 recover_flag = card->state; 973 recover_flag = card->state;
979 rc = ccw_device_set_online(CARD_RDEV(card)); 974 rc = ccw_device_set_online(CARD_RDEV(card));
980 if (rc) { 975 if (rc) {
@@ -1085,11 +1080,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev,
1085 if (card->dev && netif_carrier_ok(card->dev)) 1080 if (card->dev && netif_carrier_ok(card->dev))
1086 netif_carrier_off(card->dev); 1081 netif_carrier_off(card->dev);
1087 recover_flag = card->state; 1082 recover_flag = card->state;
1088 if (qeth_l2_stop_card(card, recovery_mode) == -ERESTARTSYS) { 1083 qeth_l2_stop_card(card, recovery_mode);
1089 PRINT_WARN("Stopping card %s interrupted by user!\n",
1090 CARD_BUS_ID(card));
1091 return -ERESTARTSYS;
1092 }
1093 rc = ccw_device_set_offline(CARD_DDEV(card)); 1084 rc = ccw_device_set_offline(CARD_DDEV(card));
1094 rc2 = ccw_device_set_offline(CARD_WDEV(card)); 1085 rc2 = ccw_device_set_offline(CARD_WDEV(card));
1095 rc3 = ccw_device_set_offline(CARD_RDEV(card)); 1086 rc3 = ccw_device_set_offline(CARD_RDEV(card));
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 99547dea44de..ed59fedd5922 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2064,8 +2064,6 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode)
2064 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 2064 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
2065 2065
2066 qeth_set_allowed_threads(card, 0, 1); 2066 qeth_set_allowed_threads(card, 0, 1);
2067 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD))
2068 return -ERESTARTSYS;
2069 if (card->read.state == CH_STATE_UP && 2067 if (card->read.state == CH_STATE_UP &&
2070 card->write.state == CH_STATE_UP && 2068 card->write.state == CH_STATE_UP &&
2071 (card->state == CARD_STATE_UP)) { 2069 (card->state == CARD_STATE_UP)) {
@@ -3049,11 +3047,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
3049 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 3047 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
3050 3048
3051 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); 3049 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1);
3052 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD)) {
3053 PRINT_WARN("set_online of card %s interrupted by user!\n",
3054 CARD_BUS_ID(card));
3055 return -ERESTARTSYS;
3056 }
3057 3050
3058 recover_flag = card->state; 3051 recover_flag = card->state;
3059 rc = ccw_device_set_online(CARD_RDEV(card)); 3052 rc = ccw_device_set_online(CARD_RDEV(card));
@@ -3170,11 +3163,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev,
3170 if (card->dev && netif_carrier_ok(card->dev)) 3163 if (card->dev && netif_carrier_ok(card->dev))
3171 netif_carrier_off(card->dev); 3164 netif_carrier_off(card->dev);
3172 recover_flag = card->state; 3165 recover_flag = card->state;
3173 if (qeth_l3_stop_card(card, recovery_mode) == -ERESTARTSYS) { 3166 qeth_l3_stop_card(card, recovery_mode);
3174 PRINT_WARN("Stopping card %s interrupted by user!\n",
3175 CARD_BUS_ID(card));
3176 return -ERESTARTSYS;
3177 }
3178 rc = ccw_device_set_offline(CARD_DDEV(card)); 3167 rc = ccw_device_set_offline(CARD_DDEV(card));
3179 rc2 = ccw_device_set_offline(CARD_WDEV(card)); 3168 rc2 = ccw_device_set_offline(CARD_WDEV(card));
3180 rc3 = ccw_device_set_offline(CARD_RDEV(card)); 3169 rc3 = ccw_device_set_offline(CARD_RDEV(card));
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index 210ddb639748..c144b9924d52 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -121,9 +121,6 @@ static ssize_t qeth_l3_dev_route6_show(struct device *dev,
121 if (!card) 121 if (!card)
122 return -EINVAL; 122 return -EINVAL;
123 123
124 if (!qeth_is_supported(card, IPA_IPV6))
125 return sprintf(buf, "%s\n", "n/a");
126
127 return qeth_l3_dev_route_show(card, &card->options.route6, buf); 124 return qeth_l3_dev_route_show(card, &card->options.route6, buf);
128} 125}
129 126
@@ -135,10 +132,6 @@ static ssize_t qeth_l3_dev_route6_store(struct device *dev,
135 if (!card) 132 if (!card)
136 return -EINVAL; 133 return -EINVAL;
137 134
138 if (!qeth_is_supported(card, IPA_IPV6)) {
139 return -EOPNOTSUPP;
140 }
141
142 return qeth_l3_dev_route_store(card, &card->options.route6, 135 return qeth_l3_dev_route_store(card, &card->options.route6,
143 QETH_PROT_IPV6, buf, count); 136 QETH_PROT_IPV6, buf, count);
144} 137}
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index c33bcb284df7..56f4e6bffc21 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -290,9 +290,11 @@
290#include <scsi/scsi_ioctl.h> 290#include <scsi/scsi_ioctl.h>
291#include "fdomain.h" 291#include "fdomain.h"
292 292
293#ifndef PCMCIA
293MODULE_AUTHOR("Rickard E. Faith"); 294MODULE_AUTHOR("Rickard E. Faith");
294MODULE_DESCRIPTION("Future domain SCSI driver"); 295MODULE_DESCRIPTION("Future domain SCSI driver");
295MODULE_LICENSE("GPL"); 296MODULE_LICENSE("GPL");
297#endif
296 298
297 299
298#define VERSION "$Revision: 5.51 $" 300#define VERSION "$Revision: 5.51 $"
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index c94d3c4b7521..579d63a81aa2 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1276,7 +1276,7 @@ config SERIAL_SGI_IOC3
1276 say Y or M. Otherwise, say N. 1276 say Y or M. Otherwise, say N.
1277 1277
1278config SERIAL_NETX 1278config SERIAL_NETX
1279 bool "NetX serial port support" 1279 tristate "NetX serial port support"
1280 depends on ARM && ARCH_NETX 1280 depends on ARM && ARCH_NETX
1281 select SERIAL_CORE 1281 select SERIAL_CORE
1282 help 1282 help
@@ -1288,7 +1288,7 @@ config SERIAL_NETX
1288 1288
1289config SERIAL_NETX_CONSOLE 1289config SERIAL_NETX_CONSOLE
1290 bool "Console on NetX serial port" 1290 bool "Console on NetX serial port"
1291 depends on SERIAL_NETX 1291 depends on SERIAL_NETX=y
1292 select SERIAL_CORE_CONSOLE 1292 select SERIAL_CORE_CONSOLE
1293 help 1293 help
1294 If you have enabled the serial port on the Hilscher NetX SoC 1294 If you have enabled the serial port on the Hilscher NetX SoC
diff --git a/drivers/serial/netx-serial.c b/drivers/serial/netx-serial.c
index 3f489329e8d3..3e5dda8518b7 100644
--- a/drivers/serial/netx-serial.c
+++ b/drivers/serial/netx-serial.c
@@ -42,8 +42,6 @@
42#define SERIAL_NX_MAJOR 204 42#define SERIAL_NX_MAJOR 204
43#define MINOR_START 170 43#define MINOR_START 170
44 44
45#ifdef CONFIG_SERIAL_NETX_CONSOLE
46
47enum uart_regs { 45enum uart_regs {
48 UART_DR = 0x00, 46 UART_DR = 0x00,
49 UART_SR = 0x04, 47 UART_SR = 0x04,
@@ -528,6 +526,8 @@ static struct netx_port netx_ports[] = {
528 } 526 }
529}; 527};
530 528
529#ifdef CONFIG_SERIAL_NETX_CONSOLE
530
531static void netx_console_putchar(struct uart_port *port, int ch) 531static void netx_console_putchar(struct uart_port *port, int ch)
532{ 532{
533 while (readl(port->membase + UART_FR) & FR_BUSY); 533 while (readl(port->membase + UART_FR) & FR_BUSY);
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 543811f6e6e8..8e74657f106c 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -133,7 +133,7 @@ static int usbtmc_release(struct inode *inode, struct file *file)
133 133
134static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data) 134static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data)
135{ 135{
136 char *buffer; 136 u8 *buffer;
137 struct device *dev; 137 struct device *dev;
138 int rv; 138 int rv;
139 int n; 139 int n;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fc9018e72a09..e1b42626d04d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -106,6 +106,9 @@ static DEFINE_SPINLOCK(hcd_root_hub_lock);
106/* used when updating an endpoint's URB list */ 106/* used when updating an endpoint's URB list */
107static DEFINE_SPINLOCK(hcd_urb_list_lock); 107static DEFINE_SPINLOCK(hcd_urb_list_lock);
108 108
109/* used to protect against unlinking URBs after the device is gone */
110static DEFINE_SPINLOCK(hcd_urb_unlink_lock);
111
109/* wait queue for synchronous unlinks */ 112/* wait queue for synchronous unlinks */
110DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue); 113DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue);
111 114
@@ -1376,10 +1379,25 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)
1376int usb_hcd_unlink_urb (struct urb *urb, int status) 1379int usb_hcd_unlink_urb (struct urb *urb, int status)
1377{ 1380{
1378 struct usb_hcd *hcd; 1381 struct usb_hcd *hcd;
1379 int retval; 1382 int retval = -EIDRM;
1383 unsigned long flags;
1380 1384
1381 hcd = bus_to_hcd(urb->dev->bus); 1385 /* Prevent the device and bus from going away while
1382 retval = unlink1(hcd, urb, status); 1386 * the unlink is carried out. If they are already gone
1387 * then urb->use_count must be 0, since disconnected
1388 * devices can't have any active URBs.
1389 */
1390 spin_lock_irqsave(&hcd_urb_unlink_lock, flags);
1391 if (atomic_read(&urb->use_count) > 0) {
1392 retval = 0;
1393 usb_get_dev(urb->dev);
1394 }
1395 spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags);
1396 if (retval == 0) {
1397 hcd = bus_to_hcd(urb->dev->bus);
1398 retval = unlink1(hcd, urb, status);
1399 usb_put_dev(urb->dev);
1400 }
1383 1401
1384 if (retval == 0) 1402 if (retval == 0)
1385 retval = -EINPROGRESS; 1403 retval = -EINPROGRESS;
@@ -1528,6 +1546,17 @@ void usb_hcd_disable_endpoint(struct usb_device *udev,
1528 hcd->driver->endpoint_disable(hcd, ep); 1546 hcd->driver->endpoint_disable(hcd, ep);
1529} 1547}
1530 1548
1549/* Protect against drivers that try to unlink URBs after the device
1550 * is gone, by waiting until all unlinks for @udev are finished.
1551 * Since we don't currently track URBs by device, simply wait until
1552 * nothing is running in the locked region of usb_hcd_unlink_urb().
1553 */
1554void usb_hcd_synchronize_unlinks(struct usb_device *udev)
1555{
1556 spin_lock_irq(&hcd_urb_unlink_lock);
1557 spin_unlock_irq(&hcd_urb_unlink_lock);
1558}
1559
1531/*-------------------------------------------------------------------------*/ 1560/*-------------------------------------------------------------------------*/
1532 1561
1533/* called in any context */ 1562/* called in any context */
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 2dcde61c465e..9465e70f4dd0 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -232,6 +232,7 @@ extern void usb_hcd_flush_endpoint(struct usb_device *udev,
232 struct usb_host_endpoint *ep); 232 struct usb_host_endpoint *ep);
233extern void usb_hcd_disable_endpoint(struct usb_device *udev, 233extern void usb_hcd_disable_endpoint(struct usb_device *udev,
234 struct usb_host_endpoint *ep); 234 struct usb_host_endpoint *ep);
235extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
235extern int usb_hcd_get_frame_number(struct usb_device *udev); 236extern int usb_hcd_get_frame_number(struct usb_device *udev);
236 237
237extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, 238extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 9b3f16bd12cb..b19cbfcd51da 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -659,6 +659,9 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
659 PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2); 659 PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2);
660 schedule_delayed_work(&hub->init_work, 660 schedule_delayed_work(&hub->init_work,
661 msecs_to_jiffies(delay)); 661 msecs_to_jiffies(delay));
662
663 /* Suppress autosuspend until init is done */
664 to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
662 return; /* Continues at init2: below */ 665 return; /* Continues at init2: below */
663 } else { 666 } else {
664 hub_power_on(hub, true); 667 hub_power_on(hub, true);
@@ -1429,6 +1432,7 @@ void usb_disconnect(struct usb_device **pdev)
1429 */ 1432 */
1430 dev_dbg (&udev->dev, "unregistering device\n"); 1433 dev_dbg (&udev->dev, "unregistering device\n");
1431 usb_disable_device(udev, 0); 1434 usb_disable_device(udev, 0);
1435 usb_hcd_synchronize_unlinks(udev);
1432 1436
1433 usb_unlock_device(udev); 1437 usb_unlock_device(udev);
1434 1438
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index f2638009a464..4342bd9c3bb6 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -474,6 +474,12 @@ EXPORT_SYMBOL_GPL(usb_submit_urb);
474 * indicating that the request has been canceled (rather than any other 474 * indicating that the request has been canceled (rather than any other
475 * code). 475 * code).
476 * 476 *
477 * Drivers should not call this routine or related routines, such as
478 * usb_kill_urb() or usb_unlink_anchored_urbs(), after their disconnect
479 * method has returned. The disconnect function should synchronize with
480 * a driver's I/O routines to insure that all URB-related activity has
481 * completed before it returns.
482 *
477 * This request is always asynchronous. Success is indicated by 483 * This request is always asynchronous. Success is indicated by
478 * returning -EINPROGRESS, at which time the URB will probably not yet 484 * returning -EINPROGRESS, at which time the URB will probably not yet
479 * have been given back to the device driver. When it is eventually 485 * have been given back to the device driver. When it is eventually
@@ -550,6 +556,9 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb);
550 * This routine may not be used in an interrupt context (such as a bottom 556 * This routine may not be used in an interrupt context (such as a bottom
551 * half or a completion handler), or when holding a spinlock, or in other 557 * half or a completion handler), or when holding a spinlock, or in other
552 * situations where the caller can't schedule(). 558 * situations where the caller can't schedule().
559 *
560 * This routine should not be called by a driver after its disconnect
561 * method has returned.
553 */ 562 */
554void usb_kill_urb(struct urb *urb) 563void usb_kill_urb(struct urb *urb)
555{ 564{
@@ -588,6 +597,9 @@ EXPORT_SYMBOL_GPL(usb_kill_urb);
588 * This routine may not be used in an interrupt context (such as a bottom 597 * This routine may not be used in an interrupt context (such as a bottom
589 * half or a completion handler), or when holding a spinlock, or in other 598 * half or a completion handler), or when holding a spinlock, or in other
590 * situations where the caller can't schedule(). 599 * situations where the caller can't schedule().
600 *
601 * This routine should not be called by a driver after its disconnect
602 * method has returned.
591 */ 603 */
592void usb_poison_urb(struct urb *urb) 604void usb_poison_urb(struct urb *urb)
593{ 605{
@@ -622,6 +634,9 @@ EXPORT_SYMBOL_GPL(usb_unpoison_urb);
622 * 634 *
623 * this allows all outstanding URBs to be killed starting 635 * this allows all outstanding URBs to be killed starting
624 * from the back of the queue 636 * from the back of the queue
637 *
638 * This routine should not be called by a driver after its disconnect
639 * method has returned.
625 */ 640 */
626void usb_kill_anchored_urbs(struct usb_anchor *anchor) 641void usb_kill_anchored_urbs(struct usb_anchor *anchor)
627{ 642{
@@ -651,6 +666,9 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);
651 * this allows all outstanding URBs to be poisoned starting 666 * this allows all outstanding URBs to be poisoned starting
652 * from the back of the queue. Newly added URBs will also be 667 * from the back of the queue. Newly added URBs will also be
653 * poisoned 668 * poisoned
669 *
670 * This routine should not be called by a driver after its disconnect
671 * method has returned.
654 */ 672 */
655void usb_poison_anchored_urbs(struct usb_anchor *anchor) 673void usb_poison_anchored_urbs(struct usb_anchor *anchor)
656{ 674{
@@ -672,6 +690,7 @@ void usb_poison_anchored_urbs(struct usb_anchor *anchor)
672 spin_unlock_irq(&anchor->lock); 690 spin_unlock_irq(&anchor->lock);
673} 691}
674EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); 692EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
693
675/** 694/**
676 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse 695 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
677 * @anchor: anchor the requests are bound to 696 * @anchor: anchor the requests are bound to
@@ -680,6 +699,9 @@ EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
680 * from the back of the queue. This function is asynchronous. 699 * from the back of the queue. This function is asynchronous.
681 * The unlinking is just tiggered. It may happen after this 700 * The unlinking is just tiggered. It may happen after this
682 * function has returned. 701 * function has returned.
702 *
703 * This routine should not be called by a driver after its disconnect
704 * method has returned.
683 */ 705 */
684void usb_unlink_anchored_urbs(struct usb_anchor *anchor) 706void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
685{ 707{
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 8be3f39891c7..794b5ffe4397 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -281,6 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
281 if (tty->driver_data) 281 if (tty->driver_data)
282 tty->driver_data = NULL; 282 tty->driver_data = NULL;
283 tty_port_tty_set(&port->port, NULL); 283 tty_port_tty_set(&port->port, NULL);
284 tty_kref_put(tty);
284 } 285 }
285 } 286 }
286 287
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index a2b9ebbef38e..fb9e20e624c1 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -333,6 +333,13 @@ UNUSUAL_DEV( 0x0482, 0x0103, 0x0100, 0x0100,
333 "Finecam S5", 333 "Finecam S5",
334 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), 334 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY),
335 335
336/* Patch submitted by Jens Taprogge <jens.taprogge@taprogge.org> */
337UNUSUAL_DEV( 0x0482, 0x0107, 0x0100, 0x0100,
338 "Kyocera",
339 "CONTAX SL300R T*",
340 US_SC_DEVICE, US_PR_DEVICE, NULL,
341 US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE),
342
336/* Reported by Paul Stewart <stewart@wetlogic.net> 343/* Reported by Paul Stewart <stewart@wetlogic.net>
337 * This entry is needed because the device reports Sub=ff */ 344 * This entry is needed because the device reports Sub=ff */
338UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, 345UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 2afd47eefe74..f8a4bb20f41a 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -439,7 +439,7 @@ static int corgi_bl_update_status(struct backlight_device *bd)
439 return corgi_bl_set_intensity(lcd, intensity); 439 return corgi_bl_set_intensity(lcd, intensity);
440} 440}
441 441
442void corgibl_limit_intensity(int limit) 442void corgi_lcd_limit_intensity(int limit)
443{ 443{
444 if (limit) 444 if (limit)
445 corgibl_flags |= CORGIBL_BATTLOW; 445 corgibl_flags |= CORGIBL_BATTLOW;
@@ -448,7 +448,7 @@ void corgibl_limit_intensity(int limit)
448 448
449 backlight_update_status(the_corgi_lcd->bl_dev); 449 backlight_update_status(the_corgi_lcd->bl_dev);
450} 450}
451EXPORT_SYMBOL(corgibl_limit_intensity); 451EXPORT_SYMBOL(corgi_lcd_limit_intensity);
452 452
453static struct backlight_ops corgi_bl_ops = { 453static struct backlight_ops corgi_bl_ops = {
454 .get_brightness = corgi_bl_get_intensity, 454 .get_brightness = corgi_bl_get_intensity,
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 64b3d30027b8..b92947d62ad6 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2118,7 +2118,7 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
2118 height, width); 2118 height, width);
2119} 2119}
2120 2120
2121static __inline__ void updatescrollmode(struct display *p, 2121static void updatescrollmode(struct display *p,
2122 struct fb_info *info, 2122 struct fb_info *info,
2123 struct vc_data *vc) 2123 struct vc_data *vc)
2124{ 2124{
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index cd5f20da738a..6048b55f2878 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1262,8 +1262,8 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1262 case FBIOPUT_CON2FBMAP: 1262 case FBIOPUT_CON2FBMAP:
1263 arg = (unsigned long) compat_ptr(arg); 1263 arg = (unsigned long) compat_ptr(arg);
1264 case FBIOBLANK: 1264 case FBIOBLANK:
1265 ret = fb_ioctl(file, cmd, arg); 1265 mutex_unlock(&info->lock);
1266 break; 1266 return fb_ioctl(file, cmd, arg);
1267 1267
1268 case FBIOGET_FSCREENINFO: 1268 case FBIOGET_FSCREENINFO:
1269 ret = fb_get_fscreeninfo(inode, file, cmd, arg); 1269 ret = fb_get_fscreeninfo(inode, file, cmd, arg);
diff --git a/drivers/video/via/global.h b/drivers/video/via/global.h
index 8e5263c5b812..7543d5f7e309 100644
--- a/drivers/video/via/global.h
+++ b/drivers/video/via/global.h
@@ -38,7 +38,6 @@
38#include "iface.h" 38#include "iface.h"
39#include "viafbdev.h" 39#include "viafbdev.h"
40#include "chip.h" 40#include "chip.h"
41#include "debug.h"
42#include "accel.h" 41#include "accel.h"
43#include "share.h" 42#include "share.h"
44#include "dvi.h" 43#include "dvi.h"
@@ -48,12 +47,10 @@
48 47
49#include "lcd.h" 48#include "lcd.h"
50#include "ioctl.h" 49#include "ioctl.h"
51#include "viamode.h"
52#include "via_utility.h" 50#include "via_utility.h"
53#include "vt1636.h" 51#include "vt1636.h"
54#include "tblDPASetting.h" 52#include "tblDPASetting.h"
55#include "tbl1636.h" 53#include "tbl1636.h"
56#include "viafbdev.h"
57 54
58/* External struct*/ 55/* External struct*/
59 56
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
index 6e46a551395c..3e57aa4d643a 100644
--- a/drivers/watchdog/acquirewdt.c
+++ b/drivers/watchdog/acquirewdt.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Based on wdt.c. Original copyright messages: 4 * Based on wdt.c. Original copyright messages:
5 * 5 *
6 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 6 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
7 * http://www.redhat.com 7 * All Rights Reserved.
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
@@ -15,7 +15,7 @@
15 * warranty for any of this software. This material is provided 15 * warranty for any of this software. This material is provided
16 * "AS-IS" and at no charge. 16 * "AS-IS" and at no charge.
17 * 17 *
18 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 18 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
19 * 19 *
20 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 20 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
21 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 21 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
index a5110f93a755..a1d7856ea6e0 100644
--- a/drivers/watchdog/advantechwdt.c
+++ b/drivers/watchdog/advantechwdt.c
@@ -6,8 +6,8 @@
6 * Based on acquirewdt.c which is based on wdt.c. 6 * Based on acquirewdt.c which is based on wdt.c.
7 * Original copyright messages: 7 * Original copyright messages:
8 * 8 *
9 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 9 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
10 * http://www.redhat.com 10 * All Rights Reserved.
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -18,7 +18,7 @@
18 * warranty for any of this software. This material is provided 18 * warranty for any of this software. This material is provided
19 * "AS-IS" and at no charge. 19 * "AS-IS" and at no charge.
20 * 20 *
21 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 21 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
22 * 22 *
23 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 23 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
24 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 24 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 31b42253054e..067a57cb3f82 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -5,7 +5,7 @@
5 * Originally based on softdog.c 5 * Originally based on softdog.c
6 * Copyright 2006-2007 Analog Devices Inc. 6 * Copyright 2006-2007 Analog Devices Inc.
7 * Copyright 2006-2007 Michele d'Amico 7 * Copyright 2006-2007 Michele d'Amico
8 * Copyright 1996 Alan Cox <alan@redhat.com> 8 * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
9 * 9 *
10 * Enter bugs at http://blackfin.uclinux.org/ 10 * Enter bugs at http://blackfin.uclinux.org/
11 * 11 *
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c
index bbd14e34319f..a171fc6ae1cb 100644
--- a/drivers/watchdog/eurotechwdt.c
+++ b/drivers/watchdog/eurotechwdt.c
@@ -8,8 +8,8 @@
8 * Based on wdt.c. 8 * Based on wdt.c.
9 * Original copyright messages: 9 * Original copyright messages:
10 * 10 *
11 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 11 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
12 * http://www.redhat.com 12 * All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index c13383f7fcb9..74f951c18b90 100644
--- a/drivers/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -394,8 +394,7 @@ static unsigned char __init esb_getdevice(void)
394 goto err_disable; 394 goto err_disable;
395 } 395 }
396 396
397 BASEADDR = ioremap(pci_resource_start(esb_pci, 0), 397 BASEADDR = pci_ioremap_bar(esb_pci, 0);
398 pci_resource_len(esb_pci, 0));
399 if (BASEADDR == NULL) { 398 if (BASEADDR == NULL) {
400 /* Something's wrong here, BASEADDR has to be set */ 399 /* Something's wrong here, BASEADDR has to be set */
401 printk(KERN_ERR PFX "failed to get BASEADDR\n"); 400 printk(KERN_ERR PFX "failed to get BASEADDR\n");
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index 8782ec1f5aa0..317ef2b16cff 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -11,8 +11,8 @@
11 * Based on acquirewdt.c which is based on wdt.c. 11 * Based on acquirewdt.c which is based on wdt.c.
12 * Original copyright messages: 12 * Original copyright messages:
13 * 13 *
14 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 14 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
15 * http://www.redhat.com 15 * All Rights Reserved.
16 * 16 *
17 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License 18 * modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
23 * warranty for any of this software. This material is provided 23 * warranty for any of this software. This material is provided
24 * "AS-IS" and at no charge. 24 * "AS-IS" and at no charge.
25 * 25 *
26 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 26 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
27 * 27 *
28 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 28 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
29 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 29 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c
index 73c9e7992feb..0f761db9a27c 100644
--- a/drivers/watchdog/indydog.c
+++ b/drivers/watchdog/indydog.c
@@ -9,7 +9,7 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * based on softdog.c by Alan Cox <alan@redhat.com> 12 * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk>
13 */ 13 */
14 14
15#include <linux/module.h> 15#include <linux/module.h>
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 2a9bfa81f9d6..1130ad697ce2 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -4,8 +4,8 @@
4 * (c) Copyright 2004 ARM Limited 4 * (c) Copyright 2004 ARM Limited
5 * 5 *
6 * Based on the SoftDog driver: 6 * Based on the SoftDog driver:
7 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 7 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
8 * http://www.redhat.com 8 * All Rights Reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 7bcbb7f4745f..2f2ce7429f5b 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -16,7 +16,7 @@
16 * 20030527: George G. Davis <gdavis@mvista.com> 16 * 20030527: George G. Davis <gdavis@mvista.com>
17 * Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c 17 * Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c
18 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu> 18 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
19 * Based on SoftDog driver by Alan Cox <alan@redhat.com> 19 * Based on SoftDog driver by Alan Cox <alan@lxorguk.ukuu.org.uk>
20 * 20 *
21 * Copyright (c) 2004 Texas Instruments. 21 * Copyright (c) 2004 Texas Instruments.
22 * 1. Modified to support OMAP1610 32-KHz watchdog timer 22 * 1. Modified to support OMAP1610 32-KHz watchdog timer
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
index 90eb1d4271d7..5d76422c402c 100644
--- a/drivers/watchdog/pcwd_pci.c
+++ b/drivers/watchdog/pcwd_pci.c
@@ -6,7 +6,7 @@
6 * Based on source code of the following authors: 6 * Based on source code of the following authors:
7 * Ken Hollis <kenji@bitgate.com>, 7 * Ken Hollis <kenji@bitgate.com>,
8 * Lindsay Harris <lindsay@bluegum.com>, 8 * Lindsay Harris <lindsay@bluegum.com>,
9 * Alan Cox <alan@redhat.com>, 9 * Alan Cox <alan@lxorguk.ukuu.org.uk>,
10 * Matt Domsch <Matt_Domsch@dell.com>, 10 * Matt Domsch <Matt_Domsch@dell.com>,
11 * Rob Radez <rob@osinvestor.com> 11 * Rob Radez <rob@osinvestor.com>
12 * 12 *
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index c1685c942de6..afb089695da8 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Based on source code of the following authors: 6 * Based on source code of the following authors:
7 * Ken Hollis <kenji@bitgate.com>, 7 * Ken Hollis <kenji@bitgate.com>,
8 * Alan Cox <alan@redhat.com>, 8 * Alan Cox <alan@lxorguk.ukuu.org.uk>,
9 * Matt Domsch <Matt_Domsch@dell.com>, 9 * Matt Domsch <Matt_Domsch@dell.com>,
10 * Rob Radez <rob@osinvestor.com>, 10 * Rob Radez <rob@osinvestor.com>,
11 * Greg Kroah-Hartman <greg@kroah.com> 11 * Greg Kroah-Hartman <greg@kroah.com>
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index c9c73b69c5e5..57027f4653ce 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -7,7 +7,8 @@
7 * based on 7 * based on
8 * SoftDog 0.05: A Software Watchdog Device 8 * SoftDog 0.05: A Software Watchdog Device
9 * 9 *
10 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 10 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
11 * All Rights Reserved.
11 * 12 *
12 * This program is free software; you can redistribute it and/or 13 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 14 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 86d42801de45..f7f6ce82a5e2 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -6,7 +6,7 @@
6 * S3C2410 Watchdog Timer Support 6 * S3C2410 Watchdog Timer Support
7 * 7 *
8 * Based on, softdog.c by Alan Cox, 8 * Based on, softdog.c by Alan Cox,
9 * (c) Copyright 1996 Alan Cox <alan@redhat.com> 9 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index 31a48437dc3d..ed01e4c2beff 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -2,7 +2,7 @@
2 * Watchdog driver for the SA11x0/PXA2xx 2 * Watchdog driver for the SA11x0/PXA2xx
3 * 3 *
4 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu> 4 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
5 * Based on SoftDog driver by Alan Cox <alan@redhat.com> 5 * Based on SoftDog driver by Alan Cox <alan@lxorguk.ukuu.org.uk>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 27e526a07c9a..38f5831c9291 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -35,8 +35,8 @@
35 * Based on various other watchdog drivers, which are probably all 35 * Based on various other watchdog drivers, which are probably all
36 * loosely based on something Alan Cox wrote years ago. 36 * loosely based on something Alan Cox wrote years ago.
37 * 37 *
38 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 38 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
39 * http://www.redhat.com 39 * All Rights Reserved.
40 * 40 *
41 * This program is free software; you can redistribute it and/or 41 * This program is free software; you can redistribute it and/or
42 * modify it under the terms of the GNU General Public License 42 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c
index fd83dd052d8c..ae74f6bcfa23 100644
--- a/drivers/watchdog/sbc8360.c
+++ b/drivers/watchdog/sbc8360.c
@@ -16,8 +16,8 @@
16 * Based on acquirewdt.c which is based on wdt.c. 16 * Based on acquirewdt.c which is based on wdt.c.
17 * Original copyright messages: 17 * Original copyright messages:
18 * 18 *
19 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 19 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
20 * http://www.redhat.com 20 * All Rights Reserved.
21 * 21 *
22 * This program is free software; you can redistribute it and/or 22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License 23 * modify it under the terms of the GNU General Public License
@@ -28,7 +28,7 @@
28 * warranty for any of this software. This material is provided 28 * warranty for any of this software. This material is provided
29 * "AS-IS" and at no charge. 29 * "AS-IS" and at no charge.
30 * 30 *
31 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 31 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
32 * 32 *
33 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 33 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
34 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 34 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c
index e5e470ca7759..06553debc7bc 100644
--- a/drivers/watchdog/sbc_epx_c3.c
+++ b/drivers/watchdog/sbc_epx_c3.c
@@ -10,7 +10,7 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 * 12 *
13 * based on softdog.c by Alan Cox <alan@redhat.com> 13 * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk>
14 */ 14 */
15 15
16#include <linux/module.h> 16#include <linux/module.h>
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index 988ff1d5b4be..2e56cad77d19 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SMsC 37B787 Watchdog Timer driver for Linux 2.6.x.x 2 * SMsC 37B787 Watchdog Timer driver for Linux 2.6.x.x
3 * 3 *
4 * Based on acquirewdt.c by Alan Cox <alan@redhat.com> 4 * Based on acquirewdt.c by Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * and some other existing drivers 5 * and some other existing drivers
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index c650464c5c63..7204f9662114 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * SoftDog 0.07: A Software Watchdog Device 2 * SoftDog 0.07: A Software Watchdog Device
3 * 3 *
4 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 4 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>, All Rights Reserved.
5 * http://www.redhat.com
6 * 5 *
7 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index 69396adaa5c3..916890abffdd 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -11,8 +11,8 @@
11 * 11 *
12 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> 12 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl>
13 * 13 *
14 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 14 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
15 * http://www.redhat.com 15 * All Rights Reserved.
16 * 16 *
17 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License 18 * modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
23 * warranty for any of this software. This material is provided 23 * warranty for any of this software. This material is provided
24 * "AS-IS" and at no charge. 24 * "AS-IS" and at no charge.
25 * 25 *
26 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 26 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 445d30a01ed3..3c7aa412b1f3 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -12,8 +12,8 @@
12 * 12 *
13 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> 13 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl>
14 * 14 *
15 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 15 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
16 * http://www.redhat.com 16 * All Rights Reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License 19 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c
index 68377ae171ff..42e940c23891 100644
--- a/drivers/watchdog/wafer5823wdt.c
+++ b/drivers/watchdog/wafer5823wdt.c
@@ -10,8 +10,8 @@
10 * Based on advantechwdt.c which is based on wdt.c. 10 * Based on advantechwdt.c which is based on wdt.c.
11 * Original copyright messages: 11 * Original copyright messages:
12 * 12 *
13 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 13 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
14 * http://www.redhat.com 14 * All Rights Reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License 17 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index deeebb2b13ea..eddb9187e7b6 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Industrial Computer Source WDT500/501 driver 2 * Industrial Computer Source WDT500/501 driver
3 * 3 *
4 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 4 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
5 * http://www.redhat.com 5 * All Rights Reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c
index 191ea6302107..f55135662d78 100644
--- a/drivers/watchdog/wdt285.c
+++ b/drivers/watchdog/wdt285.c
@@ -6,7 +6,8 @@
6 * 6 *
7 * SoftDog 0.05: A Software Watchdog Device 7 * SoftDog 0.05: A Software Watchdog Device
8 * 8 *
9 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 9 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
10 * All Rights Reserved.
10 * 11 *
11 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c
index ed02bdb38c09..c45839a4a34d 100644
--- a/drivers/watchdog/wdt_pci.c
+++ b/drivers/watchdog/wdt_pci.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Industrial Computer Source PCI-WDT500/501 driver 2 * Industrial Computer Source PCI-WDT500/501 driver
3 * 3 *
4 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 4 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
5 * http://www.redhat.com 5 * All Rights Reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 9ce1ab6c268d..1e3b934a4cf7 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -774,7 +774,7 @@ void xen_poll_irq(int irq)
774 774
775 poll.nr_ports = 1; 775 poll.nr_ports = 1;
776 poll.timeout = 0; 776 poll.timeout = 0;
777 poll.ports = &evtchn; 777 set_xen_guest_handle(poll.ports, &evtchn);
778 778
779 if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0) 779 if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0)
780 BUG(); 780 BUG();
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index d0e87cbe157c..9b91617b9582 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -39,8 +39,6 @@ static int xen_suspend(void *data)
39 39
40 BUG_ON(!irqs_disabled()); 40 BUG_ON(!irqs_disabled());
41 41
42 load_cr3(swapper_pg_dir);
43
44 err = device_power_down(PMSG_SUSPEND); 42 err = device_power_down(PMSG_SUSPEND);
45 if (err) { 43 if (err) {
46 printk(KERN_ERR "xen_suspend: device_power_down failed: %d\n", 44 printk(KERN_ERR "xen_suspend: device_power_down failed: %d\n",
diff --git a/drivers/xen/xencomm.c b/drivers/xen/xencomm.c
index 797cb4e31f07..a240b2c20b99 100644
--- a/drivers/xen/xencomm.c
+++ b/drivers/xen/xencomm.c
@@ -23,13 +23,7 @@
23#include <asm/page.h> 23#include <asm/page.h>
24#include <xen/xencomm.h> 24#include <xen/xencomm.h>
25#include <xen/interface/xen.h> 25#include <xen/interface/xen.h>
26#ifdef __ia64__ 26#include <asm/xen/xencomm.h> /* for xencomm_is_phys_contiguous() */
27#include <asm/xen/xencomm.h> /* for is_kern_addr() */
28#endif
29
30#ifdef HAVE_XEN_PLATFORM_COMPAT_H
31#include <xen/platform-compat.h>
32#endif
33 27
34static int xencomm_init(struct xencomm_desc *desc, 28static int xencomm_init(struct xencomm_desc *desc,
35 void *buffer, unsigned long bytes) 29 void *buffer, unsigned long bytes)
@@ -157,20 +151,11 @@ static int xencomm_create(void *buffer, unsigned long bytes,
157 return 0; 151 return 0;
158} 152}
159 153
160/* check if memory address is within VMALLOC region */
161static int is_phys_contiguous(unsigned long addr)
162{
163 if (!is_kernel_addr(addr))
164 return 0;
165
166 return (addr < VMALLOC_START) || (addr >= VMALLOC_END);
167}
168
169static struct xencomm_handle *xencomm_create_inline(void *ptr) 154static struct xencomm_handle *xencomm_create_inline(void *ptr)
170{ 155{
171 unsigned long paddr; 156 unsigned long paddr;
172 157
173 BUG_ON(!is_phys_contiguous((unsigned long)ptr)); 158 BUG_ON(!xencomm_is_phys_contiguous((unsigned long)ptr));
174 159
175 paddr = (unsigned long)xencomm_pa(ptr); 160 paddr = (unsigned long)xencomm_pa(ptr);
176 BUG_ON(paddr & XENCOMM_INLINE_FLAG); 161 BUG_ON(paddr & XENCOMM_INLINE_FLAG);
@@ -202,7 +187,7 @@ struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes)
202 int rc; 187 int rc;
203 struct xencomm_desc *desc; 188 struct xencomm_desc *desc;
204 189
205 if (is_phys_contiguous((unsigned long)ptr)) 190 if (xencomm_is_phys_contiguous((unsigned long)ptr))
206 return xencomm_create_inline(ptr); 191 return xencomm_create_inline(ptr);
207 192
208 rc = xencomm_create(ptr, bytes, &desc, GFP_KERNEL); 193 rc = xencomm_create(ptr, bytes, &desc, GFP_KERNEL);
@@ -219,7 +204,7 @@ struct xencomm_handle *__xencomm_map_no_alloc(void *ptr, unsigned long bytes,
219 int rc; 204 int rc;
220 struct xencomm_desc *desc = NULL; 205 struct xencomm_desc *desc = NULL;
221 206
222 if (is_phys_contiguous((unsigned long)ptr)) 207 if (xencomm_is_phys_contiguous((unsigned long)ptr))
223 return xencomm_create_inline(ptr); 208 return xencomm_create_inline(ptr);
224 209
225 rc = xencomm_create_mini(ptr, bytes, xc_desc, 210 rc = xencomm_create_mini(ptr, bytes, xc_desc,
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 06db79d05c12..6046239465a1 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1251,6 +1251,7 @@ struct kmem_cache *ecryptfs_header_cache_2;
1251/** 1251/**
1252 * ecryptfs_write_headers_virt 1252 * ecryptfs_write_headers_virt
1253 * @page_virt: The virtual address to write the headers to 1253 * @page_virt: The virtual address to write the headers to
1254 * @max: The size of memory allocated at page_virt
1254 * @size: Set to the number of bytes written by this function 1255 * @size: Set to the number of bytes written by this function
1255 * @crypt_stat: The cryptographic context 1256 * @crypt_stat: The cryptographic context
1256 * @ecryptfs_dentry: The eCryptfs dentry 1257 * @ecryptfs_dentry: The eCryptfs dentry
@@ -1278,7 +1279,8 @@ struct kmem_cache *ecryptfs_header_cache_2;
1278 * 1279 *
1279 * Returns zero on success 1280 * Returns zero on success
1280 */ 1281 */
1281static int ecryptfs_write_headers_virt(char *page_virt, size_t *size, 1282static int ecryptfs_write_headers_virt(char *page_virt, size_t max,
1283 size_t *size,
1282 struct ecryptfs_crypt_stat *crypt_stat, 1284 struct ecryptfs_crypt_stat *crypt_stat,
1283 struct dentry *ecryptfs_dentry) 1285 struct dentry *ecryptfs_dentry)
1284{ 1286{
@@ -1296,7 +1298,7 @@ static int ecryptfs_write_headers_virt(char *page_virt, size_t *size,
1296 offset += written; 1298 offset += written;
1297 rc = ecryptfs_generate_key_packet_set((page_virt + offset), crypt_stat, 1299 rc = ecryptfs_generate_key_packet_set((page_virt + offset), crypt_stat,
1298 ecryptfs_dentry, &written, 1300 ecryptfs_dentry, &written,
1299 PAGE_CACHE_SIZE - offset); 1301 max - offset);
1300 if (rc) 1302 if (rc)
1301 ecryptfs_printk(KERN_WARNING, "Error generating key packet " 1303 ecryptfs_printk(KERN_WARNING, "Error generating key packet "
1302 "set; rc = [%d]\n", rc); 1304 "set; rc = [%d]\n", rc);
@@ -1368,14 +1370,14 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry)
1368 goto out; 1370 goto out;
1369 } 1371 }
1370 /* Released in this function */ 1372 /* Released in this function */
1371 virt = kzalloc(crypt_stat->num_header_bytes_at_front, GFP_KERNEL); 1373 virt = (char *)get_zeroed_page(GFP_KERNEL);
1372 if (!virt) { 1374 if (!virt) {
1373 printk(KERN_ERR "%s: Out of memory\n", __func__); 1375 printk(KERN_ERR "%s: Out of memory\n", __func__);
1374 rc = -ENOMEM; 1376 rc = -ENOMEM;
1375 goto out; 1377 goto out;
1376 } 1378 }
1377 rc = ecryptfs_write_headers_virt(virt, &size, crypt_stat, 1379 rc = ecryptfs_write_headers_virt(virt, PAGE_CACHE_SIZE, &size,
1378 ecryptfs_dentry); 1380 crypt_stat, ecryptfs_dentry);
1379 if (unlikely(rc)) { 1381 if (unlikely(rc)) {
1380 printk(KERN_ERR "%s: Error whilst writing headers; rc = [%d]\n", 1382 printk(KERN_ERR "%s: Error whilst writing headers; rc = [%d]\n",
1381 __func__, rc); 1383 __func__, rc);
@@ -1393,8 +1395,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry)
1393 goto out_free; 1395 goto out_free;
1394 } 1396 }
1395out_free: 1397out_free:
1396 memset(virt, 0, crypt_stat->num_header_bytes_at_front); 1398 free_page((unsigned long)virt);
1397 kfree(virt);
1398out: 1399out:
1399 return rc; 1400 return rc;
1400} 1401}
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 19eafbe3c379..2b2eec1283bf 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -175,7 +175,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
175 175
176 if (rw == WRITE) { 176 if (rw == WRITE) {
177 /* 177 /*
178 * FIXME: blockdev_direct_IO() doesn't use ->prepare_write(), 178 * FIXME: blockdev_direct_IO() doesn't use ->write_begin(),
179 * so we need to update the ->mmu_private to block boundary. 179 * so we need to update the ->mmu_private to block boundary.
180 * 180 *
181 * But we must fill the remaining area or hole by nul for 181 * But we must fill the remaining area or hole by nul for
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index d15cd6e7251e..60d4c32c8808 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -860,7 +860,6 @@ out:
860 * int journal_get_undo_access() - Notify intent to modify metadata with non-rewindable consequences 860 * int journal_get_undo_access() - Notify intent to modify metadata with non-rewindable consequences
861 * @handle: transaction 861 * @handle: transaction
862 * @bh: buffer to undo 862 * @bh: buffer to undo
863 * @credits: store the number of taken credits here (if not NULL)
864 * 863 *
865 * Sometimes there is a need to distinguish between metadata which has 864 * Sometimes there is a need to distinguish between metadata which has
866 * been committed to disk and that which has not. The ext3fs code uses 865 * been committed to disk and that which has not. The ext3fs code uses
diff --git a/fs/libfs.c b/fs/libfs.c
index 74688598bcf7..e960a8321902 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -814,7 +814,7 @@ EXPORT_SYMBOL(simple_getattr);
814EXPORT_SYMBOL(simple_link); 814EXPORT_SYMBOL(simple_link);
815EXPORT_SYMBOL(simple_lookup); 815EXPORT_SYMBOL(simple_lookup);
816EXPORT_SYMBOL(simple_pin_fs); 816EXPORT_SYMBOL(simple_pin_fs);
817EXPORT_SYMBOL(simple_prepare_write); 817EXPORT_UNUSED_SYMBOL(simple_prepare_write);
818EXPORT_SYMBOL(simple_readpage); 818EXPORT_SYMBOL(simple_readpage);
819EXPORT_SYMBOL(simple_release_fs); 819EXPORT_SYMBOL(simple_release_fs);
820EXPORT_SYMBOL(simple_rename); 820EXPORT_SYMBOL(simple_rename);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index dc52793ff8f8..d22eb383e1cf 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -908,21 +908,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt
908 return nfs_size_to_loff_t(fattr->size) > i_size_read(inode); 908 return nfs_size_to_loff_t(fattr->size) > i_size_read(inode);
909} 909}
910 910
911static unsigned long nfs_attr_generation_counter; 911static atomic_long_t nfs_attr_generation_counter;
912 912
913static unsigned long nfs_read_attr_generation_counter(void) 913static unsigned long nfs_read_attr_generation_counter(void)
914{ 914{
915 smp_rmb(); 915 return atomic_long_read(&nfs_attr_generation_counter);
916 return nfs_attr_generation_counter;
917} 916}
918 917
919unsigned long nfs_inc_attr_generation_counter(void) 918unsigned long nfs_inc_attr_generation_counter(void)
920{ 919{
921 unsigned long ret; 920 return atomic_long_inc_return(&nfs_attr_generation_counter);
922 smp_rmb();
923 ret = ++nfs_attr_generation_counter;
924 smp_wmb();
925 return ret;
926} 921}
927 922
928void nfs_fattr_init(struct nfs_fattr *fattr) 923void nfs_fattr_init(struct nfs_fattr *fattr)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 8d3225a78073..7efe937a415f 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -679,8 +679,7 @@ leave:
679 679
680/* Some parts of this taken from generic_cont_expand, which turned out 680/* Some parts of this taken from generic_cont_expand, which turned out
681 * to be too fragile to do exactly what we need without us having to 681 * to be too fragile to do exactly what we need without us having to
682 * worry about recursive locking in ->prepare_write() and 682 * worry about recursive locking in ->write_begin() and ->write_end(). */
683 * ->commit_write(). */
684static int ocfs2_write_zero_page(struct inode *inode, 683static int ocfs2_write_zero_page(struct inode *inode,
685 u64 size) 684 u64 size)
686{ 685{
diff --git a/fs/splice.c b/fs/splice.c
index a1e701c27156..1abab5cee4ba 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -731,8 +731,8 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
731 }; 731 };
732 732
733 /* 733 /*
734 * The actor worker might be calling ->prepare_write and 734 * The actor worker might be calling ->write_begin and
735 * ->commit_write. Most of the time, these expect i_mutex to 735 * ->write_end. Most of the time, these expect i_mutex to
736 * be held. Since this may result in an ABBA deadlock with 736 * be held. Since this may result in an ABBA deadlock with
737 * pipe->inode, we have to order lock acquiry here. 737 * pipe->inode, we have to order lock acquiry here.
738 */ 738 */
diff --git a/include/asm-generic/kdebug.h b/include/asm-generic/kdebug.h
index 2b799c90b2d4..11e57b6a85fc 100644
--- a/include/asm-generic/kdebug.h
+++ b/include/asm-generic/kdebug.h
@@ -3,6 +3,7 @@
3 3
4enum die_val { 4enum die_val {
5 DIE_UNUSED, 5 DIE_UNUSED,
6 DIE_OOPS=1
6}; 7};
7 8
8#endif /* _ASM_GENERIC_KDEBUG_H */ 9#endif /* _ASM_GENERIC_KDEBUG_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 8b00f6643e93..1164963c3a85 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -25,7 +25,6 @@ struct cgroup;
25 25
26extern int cgroup_init_early(void); 26extern int cgroup_init_early(void);
27extern int cgroup_init(void); 27extern int cgroup_init(void);
28extern void cgroup_init_smp(void);
29extern void cgroup_lock(void); 28extern void cgroup_lock(void);
30extern bool cgroup_lock_live_group(struct cgroup *cgrp); 29extern bool cgroup_lock_live_group(struct cgroup *cgrp);
31extern void cgroup_unlock(void); 30extern void cgroup_unlock(void);
@@ -348,8 +347,6 @@ struct cgroup_subsys {
348 struct cgroupfs_root *root; 347 struct cgroupfs_root *root;
349 348
350 struct list_head sibling; 349 struct list_head sibling;
351
352 void *private;
353}; 350};
354 351
355#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 352#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
@@ -410,7 +407,6 @@ void cgroup_mm_owner_callbacks(struct task_struct *old,
410 407
411static inline int cgroup_init_early(void) { return 0; } 408static inline int cgroup_init_early(void) { return 0; }
412static inline int cgroup_init(void) { return 0; } 409static inline int cgroup_init(void) { return 0; }
413static inline void cgroup_init_smp(void) {}
414static inline void cgroup_fork(struct task_struct *p) {} 410static inline void cgroup_fork(struct task_struct *p) {}
415static inline void cgroup_fork_callbacks(struct task_struct *p) {} 411static inline void cgroup_fork_callbacks(struct task_struct *p) {}
416static inline void cgroup_post_fork(struct task_struct *p) {} 412static inline void cgroup_post_fork(struct task_struct *p) {}
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 8f225339eee9..5a361f85cfec 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -44,11 +44,6 @@ static inline bool should_send_signal(struct task_struct *p)
44 return !(p->flags & PF_FREEZER_NOSIG); 44 return !(p->flags & PF_FREEZER_NOSIG);
45} 45}
46 46
47/*
48 * Wake up a frozen process
49 */
50extern int __thaw_process(struct task_struct *p);
51
52/* Takes and releases task alloc lock using task_lock() */ 47/* Takes and releases task alloc lock using task_lock() */
53extern int thaw_process(struct task_struct *p); 48extern int thaw_process(struct task_struct *p);
54 49
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5b248d61430c..0dcdd9458f4b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -489,13 +489,6 @@ struct address_space_operations {
489 int (*readpages)(struct file *filp, struct address_space *mapping, 489 int (*readpages)(struct file *filp, struct address_space *mapping,
490 struct list_head *pages, unsigned nr_pages); 490 struct list_head *pages, unsigned nr_pages);
491 491
492 /*
493 * ext3 requires that a successful prepare_write() call be followed
494 * by a commit_write() call - they must be balanced
495 */
496 int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
497 int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
498
499 int (*write_begin)(struct file *, struct address_space *mapping, 492 int (*write_begin)(struct file *, struct address_space *mapping,
500 loff_t pos, unsigned len, unsigned flags, 493 loff_t pos, unsigned len, unsigned flags,
501 struct page **pagep, void **fsdata); 494 struct page **pagep, void **fsdata);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 4e625e0094c8..708bab58d8d0 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -49,7 +49,8 @@ struct gianfar_platform_data {
49 u32 device_flags; 49 u32 device_flags;
50 /* board specific information */ 50 /* board specific information */
51 u32 board_flags; 51 u32 board_flags;
52 char bus_id[MII_BUS_ID_SIZE]; 52 int mdio_bus; /* Bus controlled by us */
53 char bus_id[MII_BUS_ID_SIZE]; /* Bus PHY is on */
53 u32 phy_id; 54 u32 phy_id;
54 u8 mac_addr[6]; 55 u8 mac_addr[6];
55 phy_interface_t interface; 56 phy_interface_t interface;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index a3d46151be19..703eb53cfa2b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -8,7 +8,7 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/kallsyms.h> 9#include <linux/kallsyms.h>
10 10
11#ifdef CONFIG_FTRACE 11#ifdef CONFIG_FUNCTION_TRACER
12 12
13extern int ftrace_enabled; 13extern int ftrace_enabled;
14extern int 14extern int
@@ -36,16 +36,14 @@ void clear_ftrace_function(void);
36 36
37extern void ftrace_stub(unsigned long a0, unsigned long a1); 37extern void ftrace_stub(unsigned long a0, unsigned long a1);
38 38
39#else /* !CONFIG_FTRACE */ 39#else /* !CONFIG_FUNCTION_TRACER */
40# define register_ftrace_function(ops) do { } while (0) 40# define register_ftrace_function(ops) do { } while (0)
41# define unregister_ftrace_function(ops) do { } while (0) 41# define unregister_ftrace_function(ops) do { } while (0)
42# define clear_ftrace_function(ops) do { } while (0) 42# define clear_ftrace_function(ops) do { } while (0)
43static inline void ftrace_kill_atomic(void) { } 43static inline void ftrace_kill(void) { }
44#endif /* CONFIG_FTRACE */ 44#endif /* CONFIG_FUNCTION_TRACER */
45 45
46#ifdef CONFIG_DYNAMIC_FTRACE 46#ifdef CONFIG_DYNAMIC_FTRACE
47# define FTRACE_HASHBITS 10
48# define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
49 47
50enum { 48enum {
51 FTRACE_FL_FREE = (1 << 0), 49 FTRACE_FL_FREE = (1 << 0),
@@ -58,9 +56,9 @@ enum {
58}; 56};
59 57
60struct dyn_ftrace { 58struct dyn_ftrace {
61 struct hlist_node node; 59 struct list_head list;
62 unsigned long ip; /* address of mcount call-site */ 60 unsigned long ip; /* address of mcount call-site */
63 unsigned long flags; 61 unsigned long flags;
64}; 62};
65 63
66int ftrace_force_update(void); 64int ftrace_force_update(void);
@@ -71,14 +69,33 @@ extern int ftrace_ip_converted(unsigned long ip);
71extern unsigned char *ftrace_nop_replace(void); 69extern unsigned char *ftrace_nop_replace(void);
72extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); 70extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
73extern int ftrace_dyn_arch_init(void *data); 71extern int ftrace_dyn_arch_init(void *data);
74extern int ftrace_mcount_set(unsigned long *data);
75extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
76 unsigned char *new_code);
77extern int ftrace_update_ftrace_func(ftrace_func_t func); 72extern int ftrace_update_ftrace_func(ftrace_func_t func);
78extern void ftrace_caller(void); 73extern void ftrace_caller(void);
79extern void ftrace_call(void); 74extern void ftrace_call(void);
80extern void mcount_call(void); 75extern void mcount_call(void);
81 76
77/**
78 * ftrace_modify_code - modify code segment
79 * @ip: the address of the code segment
80 * @old_code: the contents of what is expected to be there
81 * @new_code: the code to patch in
82 *
83 * This is a very sensitive operation and great care needs
84 * to be taken by the arch. The operation should carefully
85 * read the location, check to see if what is read is indeed
86 * what we expect it to be, and then on success of the compare,
87 * it should write to the location.
88 *
89 * Return must be:
90 * 0 on success
91 * -EFAULT on error reading the location
92 * -EINVAL on a failed compare of the contents
93 * -EPERM on error writing to the location
94 * Any other value will be considered a failure.
95 */
96extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
97 unsigned char *new_code);
98
82extern int skip_trace(unsigned long ip); 99extern int skip_trace(unsigned long ip);
83 100
84extern void ftrace_release(void *start, unsigned long size); 101extern void ftrace_release(void *start, unsigned long size);
@@ -97,11 +114,10 @@ static inline void ftrace_release(void *start, unsigned long size) { }
97 114
98/* totally disable ftrace - can not re-enable after this */ 115/* totally disable ftrace - can not re-enable after this */
99void ftrace_kill(void); 116void ftrace_kill(void);
100void ftrace_kill_atomic(void);
101 117
102static inline void tracer_disable(void) 118static inline void tracer_disable(void)
103{ 119{
104#ifdef CONFIG_FTRACE 120#ifdef CONFIG_FUNCTION_TRACER
105 ftrace_enabled = 0; 121 ftrace_enabled = 0;
106#endif 122#endif
107} 123}
@@ -113,7 +129,7 @@ static inline void tracer_disable(void)
113 */ 129 */
114static inline int __ftrace_enabled_save(void) 130static inline int __ftrace_enabled_save(void)
115{ 131{
116#ifdef CONFIG_FTRACE 132#ifdef CONFIG_FUNCTION_TRACER
117 int saved_ftrace_enabled = ftrace_enabled; 133 int saved_ftrace_enabled = ftrace_enabled;
118 ftrace_enabled = 0; 134 ftrace_enabled = 0;
119 return saved_ftrace_enabled; 135 return saved_ftrace_enabled;
@@ -124,7 +140,7 @@ static inline int __ftrace_enabled_save(void)
124 140
125static inline void __ftrace_enabled_restore(int enabled) 141static inline void __ftrace_enabled_restore(int enabled)
126{ 142{
127#ifdef CONFIG_FTRACE 143#ifdef CONFIG_FUNCTION_TRACER
128 ftrace_enabled = enabled; 144 ftrace_enabled = enabled;
129#endif 145#endif
130} 146}
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 5355ca4b939e..e5780f8c934a 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -410,6 +410,7 @@ struct hid_output_fifo {
410#define HID_SUSPENDED 5 410#define HID_SUSPENDED 5
411#define HID_CLEAR_HALT 6 411#define HID_CLEAR_HALT 6
412#define HID_DISCONNECTED 7 412#define HID_DISCONNECTED 7
413#define HID_STARTED 8
413 414
414struct hid_input { 415struct hid_input {
415 struct list_head list; 416 struct list_head list;
diff --git a/include/linux/init.h b/include/linux/init.h
index 0c1264668be0..68cb0265d009 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -112,21 +112,25 @@
112#define __FINIT .previous 112#define __FINIT .previous
113 113
114#define __INITDATA .section ".init.data","aw" 114#define __INITDATA .section ".init.data","aw"
115#define __INITRODATA .section ".init.rodata","a"
115#define __FINITDATA .previous 116#define __FINITDATA .previous
116 117
117#define __DEVINIT .section ".devinit.text", "ax" 118#define __DEVINIT .section ".devinit.text", "ax"
118#define __DEVINITDATA .section ".devinit.data", "aw" 119#define __DEVINITDATA .section ".devinit.data", "aw"
120#define __DEVINITRODATA .section ".devinit.rodata", "a"
119 121
120#define __CPUINIT .section ".cpuinit.text", "ax" 122#define __CPUINIT .section ".cpuinit.text", "ax"
121#define __CPUINITDATA .section ".cpuinit.data", "aw" 123#define __CPUINITDATA .section ".cpuinit.data", "aw"
124#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
122 125
123#define __MEMINIT .section ".meminit.text", "ax" 126#define __MEMINIT .section ".meminit.text", "ax"
124#define __MEMINITDATA .section ".meminit.data", "aw" 127#define __MEMINITDATA .section ".meminit.data", "aw"
128#define __MEMINITRODATA .section ".meminit.rodata", "a"
125 129
126/* silence warnings when references are OK */ 130/* silence warnings when references are OK */
127#define __REF .section ".ref.text", "ax" 131#define __REF .section ".ref.text", "ax"
128#define __REFDATA .section ".ref.data", "aw" 132#define __REFDATA .section ".ref.data", "aw"
129#define __REFCONST .section ".ref.rodata", "aw" 133#define __REFCONST .section ".ref.rodata", "a"
130 134
131#ifndef __ASSEMBLY__ 135#ifndef __ASSEMBLY__
132/* 136/*
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 77777c460099..ed60f8718d80 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -116,6 +116,8 @@ extern int _cond_resched(void);
116# define might_resched() do { } while (0) 116# define might_resched() do { } while (0)
117#endif 117#endif
118 118
119#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
120 void __might_sleep(char *file, int line);
119/** 121/**
120 * might_sleep - annotation for functions that can sleep 122 * might_sleep - annotation for functions that can sleep
121 * 123 *
@@ -126,8 +128,6 @@ extern int _cond_resched(void);
126 * be bitten later when the calling function happens to sleep when it is not 128 * be bitten later when the calling function happens to sleep when it is not
127 * supposed to. 129 * supposed to.
128 */ 130 */
129#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
130 void __might_sleep(char *file, int line);
131# define might_sleep() \ 131# define might_sleep() \
132 do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) 132 do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
133#else 133#else
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 797fcd781242..f18b86fa8655 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -489,6 +489,9 @@ struct kvm_assigned_pci_dev {
489 __u32 busnr; 489 __u32 busnr;
490 __u32 devfn; 490 __u32 devfn;
491 __u32 flags; 491 __u32 flags;
492 union {
493 __u32 reserved[12];
494 };
492}; 495};
493 496
494struct kvm_assigned_irq { 497struct kvm_assigned_irq {
@@ -496,6 +499,9 @@ struct kvm_assigned_irq {
496 __u32 host_irq; 499 __u32 host_irq;
497 __u32 guest_irq; 500 __u32 guest_irq;
498 __u32 flags; 501 __u32 flags;
502 union {
503 __u32 reserved[12];
504 };
499}; 505};
500 506
501#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 507#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3833c48fae3a..bb92be2153bc 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -37,6 +37,8 @@
37#define KVM_REQ_UNHALT 6 37#define KVM_REQ_UNHALT 6
38#define KVM_REQ_MMU_SYNC 7 38#define KVM_REQ_MMU_SYNC 7
39 39
40#define KVM_USERSPACE_IRQ_SOURCE_ID 0
41
40struct kvm_vcpu; 42struct kvm_vcpu;
41extern struct kmem_cache *kvm_vcpu_cache; 43extern struct kmem_cache *kvm_vcpu_cache;
42 44
@@ -306,15 +308,18 @@ struct kvm_assigned_dev_kernel {
306 int host_irq; 308 int host_irq;
307 int guest_irq; 309 int guest_irq;
308 int irq_requested; 310 int irq_requested;
311 int irq_source_id;
309 struct pci_dev *dev; 312 struct pci_dev *dev;
310 struct kvm *kvm; 313 struct kvm *kvm;
311}; 314};
312void kvm_set_irq(struct kvm *kvm, int irq, int level); 315void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
313void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); 316void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi);
314void kvm_register_irq_ack_notifier(struct kvm *kvm, 317void kvm_register_irq_ack_notifier(struct kvm *kvm,
315 struct kvm_irq_ack_notifier *kian); 318 struct kvm_irq_ack_notifier *kian);
316void kvm_unregister_irq_ack_notifier(struct kvm *kvm, 319void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
317 struct kvm_irq_ack_notifier *kian); 320 struct kvm_irq_ack_notifier *kian);
321int kvm_request_irq_source_id(struct kvm *kvm);
322void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
318 323
319#ifdef CONFIG_DMAR 324#ifdef CONFIG_DMAR
320int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, 325int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index eb71b45fdf5a..97b91d1abb43 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -135,6 +135,7 @@ struct usb_device_id {
135 135
136struct hid_device_id { 136struct hid_device_id {
137 __u16 bus; 137 __u16 bus;
138 __u16 pad1;
138 __u32 vendor; 139 __u32 vendor;
139 __u32 product; 140 __u32 product;
140 kernel_ulong_t driver_data 141 kernel_ulong_t driver_data
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c8bcb59adfdf..9d77b1d7dca8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1537,7 +1537,6 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1537/** 1537/**
1538 * netif_tx_lock - grab network device transmit lock 1538 * netif_tx_lock - grab network device transmit lock
1539 * @dev: network device 1539 * @dev: network device
1540 * @cpu: cpu number of lock owner
1541 * 1540 *
1542 * Get network device transmit lock 1541 * Get network device transmit lock
1543 */ 1542 */
diff --git a/include/linux/resource.h b/include/linux/resource.h
index aaa423a6f3d9..40fc7e626082 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -59,10 +59,10 @@ struct rlimit {
59#define _STK_LIM (8*1024*1024) 59#define _STK_LIM (8*1024*1024)
60 60
61/* 61/*
62 * GPG wants 32kB of mlocked memory, to make sure pass phrases 62 * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
63 * and other sensitive information are never written to disk. 63 * and other sensitive information are never written to disk.
64 */ 64 */
65#define MLOCK_LIMIT (8 * PAGE_SIZE) 65#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
66 66
67/* 67/*
68 * Due to binary compatibility, the actual resource numbers 68 * Due to binary compatibility, the actual resource numbers
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8478f334d732..b483f39a7112 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -936,7 +936,6 @@ struct sched_class {
936 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); 936 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
937 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 937 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
938 void (*yield_task) (struct rq *rq); 938 void (*yield_task) (struct rq *rq);
939 int (*select_task_rq)(struct task_struct *p, int sync);
940 939
941 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); 940 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync);
942 941
@@ -944,6 +943,8 @@ struct sched_class {
944 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 943 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
945 944
946#ifdef CONFIG_SMP 945#ifdef CONFIG_SMP
946 int (*select_task_rq)(struct task_struct *p, int sync);
947
947 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, 948 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
948 struct rq *busiest, unsigned long max_load_move, 949 struct rq *busiest, unsigned long max_load_move,
949 struct sched_domain *sd, enum cpu_idle_type idle, 950 struct sched_domain *sd, enum cpu_idle_type idle,
@@ -955,16 +956,17 @@ struct sched_class {
955 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 956 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
956 void (*post_schedule) (struct rq *this_rq); 957 void (*post_schedule) (struct rq *this_rq);
957 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 958 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
958#endif
959 959
960 void (*set_curr_task) (struct rq *rq);
961 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
962 void (*task_new) (struct rq *rq, struct task_struct *p);
963 void (*set_cpus_allowed)(struct task_struct *p, 960 void (*set_cpus_allowed)(struct task_struct *p,
964 const cpumask_t *newmask); 961 const cpumask_t *newmask);
965 962
966 void (*rq_online)(struct rq *rq); 963 void (*rq_online)(struct rq *rq);
967 void (*rq_offline)(struct rq *rq); 964 void (*rq_offline)(struct rq *rq);
965#endif
966
967 void (*set_curr_task) (struct rq *rq);
968 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
969 void (*task_new) (struct rq *rq, struct task_struct *p);
968 970
969 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 971 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
970 int running); 972 int running);
diff --git a/include/linux/security.h b/include/linux/security.h
index f5c4a51eb42e..c13f1cec9abb 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1585,6 +1585,7 @@ int security_syslog(int type);
1585int security_settime(struct timespec *ts, struct timezone *tz); 1585int security_settime(struct timespec *ts, struct timezone *tz);
1586int security_vm_enough_memory(long pages); 1586int security_vm_enough_memory(long pages);
1587int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1587int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1588int security_vm_enough_memory_kern(long pages);
1588int security_bprm_alloc(struct linux_binprm *bprm); 1589int security_bprm_alloc(struct linux_binprm *bprm);
1589void security_bprm_free(struct linux_binprm *bprm); 1590void security_bprm_free(struct linux_binprm *bprm);
1590void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); 1591void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
@@ -1820,6 +1821,11 @@ static inline int security_vm_enough_memory(long pages)
1820 return cap_vm_enough_memory(current->mm, pages); 1821 return cap_vm_enough_memory(current->mm, pages);
1821} 1822}
1822 1823
1824static inline int security_vm_enough_memory_kern(long pages)
1825{
1826 return cap_vm_enough_memory(current->mm, pages);
1827}
1828
1823static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) 1829static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1824{ 1830{
1825 return cap_vm_enough_memory(mm, pages); 1831 return cap_vm_enough_memory(mm, pages);
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index b8db32cea1de..bf8de281b4ed 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -18,6 +18,9 @@
18 * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(), 18 * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods. 19 * and custom setup()/cleanup() methods.
20 */ 20 */
21
22#include <linux/workqueue.h>
23
21struct spi_bitbang { 24struct spi_bitbang {
22 struct workqueue_struct *workqueue; 25 struct workqueue_struct *workqueue;
23 struct work_struct work; 26 struct work_struct work;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d861197f83c7..8856e2d60e9f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1474,7 +1474,6 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1474 * ieee80211_beacon_get - beacon generation function 1474 * ieee80211_beacon_get - beacon generation function
1475 * @hw: pointer obtained from ieee80211_alloc_hw(). 1475 * @hw: pointer obtained from ieee80211_alloc_hw().
1476 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1476 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1477 * @control: will be filled with information needed to send this beacon.
1478 * 1477 *
1479 * If the beacon frames are generated by the host system (i.e., not in 1478 * If the beacon frames are generated by the host system (i.e., not in
1480 * hardware/firmware), the low-level driver uses this function to receive 1479 * hardware/firmware), the low-level driver uses this function to receive
@@ -1575,7 +1574,6 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1575 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames 1574 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
1576 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1575 * @hw: pointer as obtained from ieee80211_alloc_hw().
1577 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1576 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1578 * @control: will be filled with information needed to send returned frame.
1579 * 1577 *
1580 * Function for accessing buffered broadcast and multicast frames. If 1578 * Function for accessing buffered broadcast and multicast frames. If
1581 * hardware/firmware does not implement buffering of broadcast/multicast 1579 * hardware/firmware does not implement buffering of broadcast/multicast
@@ -1623,9 +1621,8 @@ unsigned int ieee80211_hdrlen(__le16 fc);
1623 * 1621 *
1624 * @keyconf: the parameter passed with the set key 1622 * @keyconf: the parameter passed with the set key
1625 * @skb: the skb for which the key is needed 1623 * @skb: the skb for which the key is needed
1626 * @rc4key: a buffer to which the key will be written
1627 * @type: TBD 1624 * @type: TBD
1628 * @key: TBD 1625 * @key: a buffer to which the key will be written
1629 */ 1626 */
1630void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, 1627void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
1631 struct sk_buff *skb, 1628 struct sk_buff *skb,
@@ -1726,7 +1723,8 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1726 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1723 * @hw: pointer as obtained from ieee80211_alloc_hw().
1727 * @ra: receiver address of the BA session recipient 1724 * @ra: receiver address of the BA session recipient
1728 * @tid: the TID to BA on. 1725 * @tid: the TID to BA on.
1729 * @return: success if addBA request was sent, failure otherwise 1726 *
1727 * Return: success if addBA request was sent, failure otherwise
1730 * 1728 *
1731 * Although mac80211/low level driver/user space application can estimate 1729 * Although mac80211/low level driver/user space application can estimate
1732 * the need to start aggregation on a certain RA/TID, the session level 1730 * the need to start aggregation on a certain RA/TID, the session level
@@ -1764,7 +1762,8 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1764 * @ra: receiver address of the BA session recipient 1762 * @ra: receiver address of the BA session recipient
1765 * @tid: the TID to stop BA. 1763 * @tid: the TID to stop BA.
1766 * @initiator: if indicates initiator DELBA frame will be sent. 1764 * @initiator: if indicates initiator DELBA frame will be sent.
1767 * @return: error if no sta with matching da found, success otherwise 1765 *
1766 * Return: error if no sta with matching da found, success otherwise
1768 * 1767 *
1769 * Although mac80211/low level driver/user space application can estimate 1768 * Although mac80211/low level driver/user space application can estimate
1770 * the need to stop aggregation on a certain RA/TID, the session level 1769 * the need to stop aggregation on a certain RA/TID, the session level
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 708009be88b6..700c53a3c6fa 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -214,6 +214,8 @@ struct pernet_operations {
214 214
215extern int register_pernet_subsys(struct pernet_operations *); 215extern int register_pernet_subsys(struct pernet_operations *);
216extern void unregister_pernet_subsys(struct pernet_operations *); 216extern void unregister_pernet_subsys(struct pernet_operations *);
217extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
218extern void unregister_pernet_gen_subsys(int id, struct pernet_operations *);
217extern int register_pernet_device(struct pernet_operations *); 219extern int register_pernet_device(struct pernet_operations *);
218extern void unregister_pernet_device(struct pernet_operations *); 220extern void unregister_pernet_device(struct pernet_operations *);
219extern int register_pernet_gen_device(int *id, struct pernet_operations *); 221extern int register_pernet_gen_device(int *id, struct pernet_operations *);
diff --git a/include/net/sock.h b/include/net/sock.h
index a4f6d3fc0470..941ad7c830a3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -973,7 +973,6 @@ extern void sock_init_data(struct socket *sock, struct sock *sk);
973 973
974/** 974/**
975 * sk_filter_release: Release a socket filter 975 * sk_filter_release: Release a socket filter
976 * @sk: socket
977 * @fp: filter to remove 976 * @fp: filter to remove
978 * 977 *
979 * Remove a filter from a socket and release its resources. 978 * Remove a filter from a socket and release its resources.
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index cf4c219c0b5c..17231385cb37 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -140,8 +140,18 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag)
140 */ 140 */
141static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) 141static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
142{ 142{
143 shost->bqt = blk_init_tags(depth); 143 /*
144 return shost->bqt ? 0 : -ENOMEM; 144 * If the shared tag map isn't already initialized, do it now.
145 * This saves callers from having to check ->bqt when setting up
146 * devices on the shared host (for libata)
147 */
148 if (!shost->bqt) {
149 shost->bqt = blk_init_tags(depth);
150 if (!shost->bqt)
151 return -ENOMEM;
152 }
153
154 return 0;
145} 155}
146 156
147/** 157/**
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a1e0357a84d7..5e0189876afd 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -28,7 +28,8 @@
28 */ 28 */
29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ 29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
30 ((unsigned long)&(struct soc_mixer_control) \ 30 ((unsigned long)&(struct soc_mixer_control) \
31 {.reg = xreg, .shift = xshift, .max = xmax, .invert = xinvert}) 31 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
32 .invert = xinvert})
32#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 33#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
33 ((unsigned long)&(struct soc_mixer_control) \ 34 ((unsigned long)&(struct soc_mixer_control) \
34 {.reg = xreg, .max = xmax, .invert = xinvert}) 35 {.reg = xreg, .max = xmax, .invert = xinvert})
diff --git a/init/Kconfig b/init/Kconfig
index 44e9208f9c78..86b00c53fade 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -401,16 +401,20 @@ config CGROUP_MEM_RES_CTLR
401 depends on CGROUPS && RESOURCE_COUNTERS 401 depends on CGROUPS && RESOURCE_COUNTERS
402 select MM_OWNER 402 select MM_OWNER
403 help 403 help
404 Provides a memory resource controller that manages both page cache and 404 Provides a memory resource controller that manages both anonymous
405 RSS memory. 405 memory and page cache. (See Documentation/controllers/memory.txt)
406 406
407 Note that setting this option increases fixed memory overhead 407 Note that setting this option increases fixed memory overhead
408 associated with each page of memory in the system by 4/8 bytes 408 associated with each page of memory in the system. By this,
409 and also increases cache misses because struct page on many 64bit 409 20(40)bytes/PAGE_SIZE on 32(64)bit system will be occupied by memory
410 systems will not fit into a single cache line anymore. 410 usage tracking struct at boot. Total amount of this is printed out
411 at boot.
411 412
412 Only enable when you're ok with these trade offs and really 413 Only enable when you're ok with these trade offs and really
413 sure you need the memory resource controller. 414 sure you need the memory resource controller. Even when you enable
415 this, you can set "cgroup_disable=memory" at your boot option to
416 disable memory resource controller and you can avoid overheads.
417 (and lose benefits of memory resource contoller)
414 418
415 This config option also selects MM_OWNER config option, which 419 This config option also selects MM_OWNER config option, which
416 could in turn add some fork/exit overhead. 420 could in turn add some fork/exit overhead.
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 4c87ee1fe5d3..4d42f450b590 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -1,4 +1,4 @@
1 1#include <linux/delay.h>
2#include <linux/raid/md.h> 2#include <linux/raid/md.h>
3#include <linux/delay.h> 3#include <linux/delay.h>
4 4
diff --git a/kernel/Makefile b/kernel/Makefile
index 305f11dbef21..9a3ec66a9d84 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -13,7 +13,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o \
13 13
14CFLAGS_REMOVE_sched.o = -mno-spe 14CFLAGS_REMOVE_sched.o = -mno-spe
15 15
16ifdef CONFIG_FTRACE 16ifdef CONFIG_FUNCTION_TRACER
17# Do not trace debug files and internal ftrace files 17# Do not trace debug files and internal ftrace files
18CFLAGS_REMOVE_lockdep.o = -pg 18CFLAGS_REMOVE_lockdep.o = -pg
19CFLAGS_REMOVE_lockdep_proc.o = -pg 19CFLAGS_REMOVE_lockdep_proc.o = -pg
@@ -88,7 +88,7 @@ obj-$(CONFIG_MARKERS) += marker.o
88obj-$(CONFIG_TRACEPOINTS) += tracepoint.o 88obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
89obj-$(CONFIG_LATENCYTOP) += latencytop.o 89obj-$(CONFIG_LATENCYTOP) += latencytop.o
90obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o 90obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
91obj-$(CONFIG_FTRACE) += trace/ 91obj-$(CONFIG_FUNCTION_TRACER) += trace/
92obj-$(CONFIG_TRACING) += trace/ 92obj-$(CONFIG_TRACING) += trace/
93obj-$(CONFIG_SMP) += sched_cpupri.o 93obj-$(CONFIG_SMP) += sched_cpupri.o
94 94
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index e95056954498..7fa476f01d05 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -162,9 +162,13 @@ static int freezer_can_attach(struct cgroup_subsys *ss,
162 struct task_struct *task) 162 struct task_struct *task)
163{ 163{
164 struct freezer *freezer; 164 struct freezer *freezer;
165 int retval;
166 165
167 /* Anything frozen can't move or be moved to/from */ 166 /*
167 * Anything frozen can't move or be moved to/from.
168 *
169 * Since orig_freezer->state == FROZEN means that @task has been
170 * frozen, so it's sufficient to check the latter condition.
171 */
168 172
169 if (is_task_frozen_enough(task)) 173 if (is_task_frozen_enough(task))
170 return -EBUSY; 174 return -EBUSY;
@@ -173,13 +177,7 @@ static int freezer_can_attach(struct cgroup_subsys *ss,
173 if (freezer->state == CGROUP_FROZEN) 177 if (freezer->state == CGROUP_FROZEN)
174 return -EBUSY; 178 return -EBUSY;
175 179
176 retval = 0; 180 return 0;
177 task_lock(task);
178 freezer = task_freezer(task);
179 if (freezer->state == CGROUP_FROZEN)
180 retval = -EBUSY;
181 task_unlock(task);
182 return retval;
183} 181}
184 182
185static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task) 183static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task)
@@ -190,8 +188,9 @@ static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task)
190 freezer = task_freezer(task); 188 freezer = task_freezer(task);
191 task_unlock(task); 189 task_unlock(task);
192 190
193 BUG_ON(freezer->state == CGROUP_FROZEN);
194 spin_lock_irq(&freezer->lock); 191 spin_lock_irq(&freezer->lock);
192 BUG_ON(freezer->state == CGROUP_FROZEN);
193
195 /* Locking avoids race with FREEZING -> THAWED transitions. */ 194 /* Locking avoids race with FREEZING -> THAWED transitions. */
196 if (freezer->state == CGROUP_FREEZING) 195 if (freezer->state == CGROUP_FREEZING)
197 freeze_task(task, true); 196 freeze_task(task, true);
@@ -276,25 +275,18 @@ static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer)
276 return num_cant_freeze_now ? -EBUSY : 0; 275 return num_cant_freeze_now ? -EBUSY : 0;
277} 276}
278 277
279static int unfreeze_cgroup(struct cgroup *cgroup, struct freezer *freezer) 278static void unfreeze_cgroup(struct cgroup *cgroup, struct freezer *freezer)
280{ 279{
281 struct cgroup_iter it; 280 struct cgroup_iter it;
282 struct task_struct *task; 281 struct task_struct *task;
283 282
284 cgroup_iter_start(cgroup, &it); 283 cgroup_iter_start(cgroup, &it);
285 while ((task = cgroup_iter_next(cgroup, &it))) { 284 while ((task = cgroup_iter_next(cgroup, &it))) {
286 int do_wake; 285 thaw_process(task);
287
288 task_lock(task);
289 do_wake = __thaw_process(task);
290 task_unlock(task);
291 if (do_wake)
292 wake_up_process(task);
293 } 286 }
294 cgroup_iter_end(cgroup, &it); 287 cgroup_iter_end(cgroup, &it);
295 freezer->state = CGROUP_THAWED;
296 288
297 return 0; 289 freezer->state = CGROUP_THAWED;
298} 290}
299 291
300static int freezer_change_state(struct cgroup *cgroup, 292static int freezer_change_state(struct cgroup *cgroup,
@@ -304,27 +296,22 @@ static int freezer_change_state(struct cgroup *cgroup,
304 int retval = 0; 296 int retval = 0;
305 297
306 freezer = cgroup_freezer(cgroup); 298 freezer = cgroup_freezer(cgroup);
299
307 spin_lock_irq(&freezer->lock); 300 spin_lock_irq(&freezer->lock);
301
308 update_freezer_state(cgroup, freezer); 302 update_freezer_state(cgroup, freezer);
309 if (goal_state == freezer->state) 303 if (goal_state == freezer->state)
310 goto out; 304 goto out;
311 switch (freezer->state) { 305
306 switch (goal_state) {
312 case CGROUP_THAWED: 307 case CGROUP_THAWED:
313 retval = try_to_freeze_cgroup(cgroup, freezer); 308 unfreeze_cgroup(cgroup, freezer);
314 break; 309 break;
315 case CGROUP_FREEZING:
316 if (goal_state == CGROUP_FROZEN) {
317 /* Userspace is retrying after
318 * "/bin/echo FROZEN > freezer.state" returned -EBUSY */
319 retval = try_to_freeze_cgroup(cgroup, freezer);
320 break;
321 }
322 /* state == FREEZING and goal_state == THAWED, so unfreeze */
323 case CGROUP_FROZEN: 310 case CGROUP_FROZEN:
324 retval = unfreeze_cgroup(cgroup, freezer); 311 retval = try_to_freeze_cgroup(cgroup, freezer);
325 break; 312 break;
326 default: 313 default:
327 break; 314 BUG();
328 } 315 }
329out: 316out:
330 spin_unlock_irq(&freezer->lock); 317 spin_unlock_irq(&freezer->lock);
diff --git a/kernel/freezer.c b/kernel/freezer.c
index ba6248b323ef..2f4936cf7083 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -121,16 +121,7 @@ void cancel_freezing(struct task_struct *p)
121 } 121 }
122} 122}
123 123
124/* 124static int __thaw_process(struct task_struct *p)
125 * Wake up a frozen process
126 *
127 * task_lock() is needed to prevent the race with refrigerator() which may
128 * occur if the freezing of tasks fails. Namely, without the lock, if the
129 * freezing of tasks failed, thaw_tasks() might have run before a task in
130 * refrigerator() could call frozen_process(), in which case the task would be
131 * frozen and no one would thaw it.
132 */
133int __thaw_process(struct task_struct *p)
134{ 125{
135 if (frozen(p)) { 126 if (frozen(p)) {
136 p->flags &= ~PF_FROZEN; 127 p->flags &= ~PF_FROZEN;
@@ -140,6 +131,15 @@ int __thaw_process(struct task_struct *p)
140 return 0; 131 return 0;
141} 132}
142 133
134/*
135 * Wake up a frozen process
136 *
137 * task_lock() is needed to prevent the race with refrigerator() which may
138 * occur if the freezing of tasks fails. Namely, without the lock, if the
139 * freezing of tasks failed, thaw_tasks() might have run before a task in
140 * refrigerator() could call frozen_process(), in which case the task would be
141 * frozen and no one would thaw it.
142 */
143int thaw_process(struct task_struct *p) 143int thaw_process(struct task_struct *p)
144{ 144{
145 task_lock(p); 145 task_lock(p);
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index fac014a81b24..4d161c70ba55 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -220,7 +220,7 @@ void unregister_handler_proc(unsigned int irq, struct irqaction *action)
220 } 220 }
221} 221}
222 222
223void register_default_affinity_proc(void) 223static void register_default_affinity_proc(void)
224{ 224{
225#ifdef CONFIG_SMP 225#ifdef CONFIG_SMP
226 proc_create("irq/default_smp_affinity", 0600, NULL, 226 proc_create("irq/default_smp_affinity", 0600, NULL,
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index dbda475b13bd..06e157119d2b 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2169,12 +2169,11 @@ void early_boot_irqs_on(void)
2169/* 2169/*
2170 * Hardirqs will be enabled: 2170 * Hardirqs will be enabled:
2171 */ 2171 */
2172void trace_hardirqs_on_caller(unsigned long a0) 2172void trace_hardirqs_on_caller(unsigned long ip)
2173{ 2173{
2174 struct task_struct *curr = current; 2174 struct task_struct *curr = current;
2175 unsigned long ip;
2176 2175
2177 time_hardirqs_on(CALLER_ADDR0, a0); 2176 time_hardirqs_on(CALLER_ADDR0, ip);
2178 2177
2179 if (unlikely(!debug_locks || current->lockdep_recursion)) 2178 if (unlikely(!debug_locks || current->lockdep_recursion))
2180 return; 2179 return;
@@ -2188,7 +2187,6 @@ void trace_hardirqs_on_caller(unsigned long a0)
2188 } 2187 }
2189 /* we'll do an OFF -> ON transition: */ 2188 /* we'll do an OFF -> ON transition: */
2190 curr->hardirqs_enabled = 1; 2189 curr->hardirqs_enabled = 1;
2191 ip = (unsigned long) __builtin_return_address(0);
2192 2190
2193 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) 2191 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
2194 return; 2192 return;
@@ -2224,11 +2222,11 @@ EXPORT_SYMBOL(trace_hardirqs_on);
2224/* 2222/*
2225 * Hardirqs were disabled: 2223 * Hardirqs were disabled:
2226 */ 2224 */
2227void trace_hardirqs_off_caller(unsigned long a0) 2225void trace_hardirqs_off_caller(unsigned long ip)
2228{ 2226{
2229 struct task_struct *curr = current; 2227 struct task_struct *curr = current;
2230 2228
2231 time_hardirqs_off(CALLER_ADDR0, a0); 2229 time_hardirqs_off(CALLER_ADDR0, ip);
2232 2230
2233 if (unlikely(!debug_locks || current->lockdep_recursion)) 2231 if (unlikely(!debug_locks || current->lockdep_recursion))
2234 return; 2232 return;
@@ -2241,7 +2239,7 @@ void trace_hardirqs_off_caller(unsigned long a0)
2241 * We have done an ON -> OFF transition: 2239 * We have done an ON -> OFF transition:
2242 */ 2240 */
2243 curr->hardirqs_enabled = 0; 2241 curr->hardirqs_enabled = 0;
2244 curr->hardirq_disable_ip = _RET_IP_; 2242 curr->hardirq_disable_ip = ip;
2245 curr->hardirq_disable_event = ++curr->irq_events; 2243 curr->hardirq_disable_event = ++curr->irq_events;
2246 debug_atomic_inc(&hardirqs_off_events); 2244 debug_atomic_inc(&hardirqs_off_events);
2247 } else 2245 } else
@@ -3417,9 +3415,10 @@ retry:
3417 } 3415 }
3418 printk(" ignoring it.\n"); 3416 printk(" ignoring it.\n");
3419 unlock = 0; 3417 unlock = 0;
3418 } else {
3419 if (count != 10)
3420 printk(KERN_CONT " locked it.\n");
3420 } 3421 }
3421 if (count != 10)
3422 printk(" locked it.\n");
3423 3422
3424 do_each_thread(g, p) { 3423 do_each_thread(g, p) {
3425 /* 3424 /*
diff --git a/kernel/printk.c b/kernel/printk.c
index 6341af77eb65..f492f1583d77 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -233,45 +233,6 @@ static inline void boot_delay_msec(void)
233#endif 233#endif
234 234
235/* 235/*
236 * Return the number of unread characters in the log buffer.
237 */
238static int log_buf_get_len(void)
239{
240 return logged_chars;
241}
242
243/*
244 * Copy a range of characters from the log buffer.
245 */
246int log_buf_copy(char *dest, int idx, int len)
247{
248 int ret, max;
249 bool took_lock = false;
250
251 if (!oops_in_progress) {
252 spin_lock_irq(&logbuf_lock);
253 took_lock = true;
254 }
255
256 max = log_buf_get_len();
257 if (idx < 0 || idx >= max) {
258 ret = -1;
259 } else {
260 if (len > max)
261 len = max;
262 ret = len;
263 idx += (log_end - max);
264 while (len-- > 0)
265 dest[len] = LOG_BUF(idx + len);
266 }
267
268 if (took_lock)
269 spin_unlock_irq(&logbuf_lock);
270
271 return ret;
272}
273
274/*
275 * Commands to do_syslog: 236 * Commands to do_syslog:
276 * 237 *
277 * 0 -- Close the log. Currently a NOP. 238 * 0 -- Close the log. Currently a NOP.
diff --git a/kernel/profile.c b/kernel/profile.c
index a9e422df6bf6..9830a037d8db 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -102,7 +102,7 @@ int profile_setup(char *str)
102__setup("profile=", profile_setup); 102__setup("profile=", profile_setup);
103 103
104 104
105int profile_init(void) 105int __ref profile_init(void)
106{ 106{
107 int buffer_bytes; 107 int buffer_bytes;
108 if (!prof_on) 108 if (!prof_on)
diff --git a/kernel/resource.c b/kernel/resource.c
index 4089d12af6e0..6aac5c60b25d 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -17,6 +17,7 @@
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/pfn.h>
20#include <asm/io.h> 21#include <asm/io.h>
21 22
22 23
@@ -571,7 +572,7 @@ static void __init __reserve_region_with_split(struct resource *root,
571 572
572} 573}
573 574
574void reserve_region_with_split(struct resource *root, 575void __init reserve_region_with_split(struct resource *root,
575 resource_size_t start, resource_size_t end, 576 resource_size_t start, resource_size_t end,
576 const char *name) 577 const char *name)
577{ 578{
@@ -849,7 +850,8 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size)
849 continue; 850 continue;
850 if (p->end < addr) 851 if (p->end < addr)
851 continue; 852 continue;
852 if (p->start <= addr && (p->end >= addr + size - 1)) 853 if (PFN_DOWN(p->start) <= PFN_DOWN(addr) &&
854 PFN_DOWN(p->end) >= PFN_DOWN(addr + size - 1))
853 continue; 855 continue;
854 printk(KERN_WARNING "resource map sanity check conflict: " 856 printk(KERN_WARNING "resource map sanity check conflict: "
855 "0x%llx 0x%llx 0x%llx 0x%llx %s\n", 857 "0x%llx 0x%llx 0x%llx 0x%llx %s\n",
diff --git a/kernel/sched.c b/kernel/sched.c
index 6625c3c4b10d..e8819bc6f462 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -386,7 +386,6 @@ struct cfs_rq {
386 386
387 u64 exec_clock; 387 u64 exec_clock;
388 u64 min_vruntime; 388 u64 min_vruntime;
389 u64 pair_start;
390 389
391 struct rb_root tasks_timeline; 390 struct rb_root tasks_timeline;
392 struct rb_node *rb_leftmost; 391 struct rb_node *rb_leftmost;
@@ -3344,7 +3343,7 @@ small_imbalance:
3344 } else 3343 } else
3345 this_load_per_task = cpu_avg_load_per_task(this_cpu); 3344 this_load_per_task = cpu_avg_load_per_task(this_cpu);
3346 3345
3347 if (max_load - this_load + 2*busiest_load_per_task >= 3346 if (max_load - this_load + busiest_load_per_task >=
3348 busiest_load_per_task * imbn) { 3347 busiest_load_per_task * imbn) {
3349 *imbalance = busiest_load_per_task; 3348 *imbalance = busiest_load_per_task;
3350 return busiest; 3349 return busiest;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index ad958c1ec708..5ae17762ec32 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -319,7 +319,7 @@ static int __init init_sched_debug_procfs(void)
319{ 319{
320 struct proc_dir_entry *pe; 320 struct proc_dir_entry *pe;
321 321
322 pe = proc_create("sched_debug", 0644, NULL, &sched_debug_fops); 322 pe = proc_create("sched_debug", 0444, NULL, &sched_debug_fops);
323 if (!pe) 323 if (!pe)
324 return -ENOMEM; 324 return -ENOMEM;
325 return 0; 325 return 0;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 9573c33688b8..ce514afd78ff 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -143,6 +143,49 @@ static inline struct sched_entity *parent_entity(struct sched_entity *se)
143 return se->parent; 143 return se->parent;
144} 144}
145 145
146/* return depth at which a sched entity is present in the hierarchy */
147static inline int depth_se(struct sched_entity *se)
148{
149 int depth = 0;
150
151 for_each_sched_entity(se)
152 depth++;
153
154 return depth;
155}
156
157static void
158find_matching_se(struct sched_entity **se, struct sched_entity **pse)
159{
160 int se_depth, pse_depth;
161
162 /*
163 * preemption test can be made between sibling entities who are in the
164 * same cfs_rq i.e who have a common parent. Walk up the hierarchy of
165 * both tasks until we find their ancestors who are siblings of common
166 * parent.
167 */
168
169 /* First walk up until both entities are at same depth */
170 se_depth = depth_se(*se);
171 pse_depth = depth_se(*pse);
172
173 while (se_depth > pse_depth) {
174 se_depth--;
175 *se = parent_entity(*se);
176 }
177
178 while (pse_depth > se_depth) {
179 pse_depth--;
180 *pse = parent_entity(*pse);
181 }
182
183 while (!is_same_group(*se, *pse)) {
184 *se = parent_entity(*se);
185 *pse = parent_entity(*pse);
186 }
187}
188
146#else /* CONFIG_FAIR_GROUP_SCHED */ 189#else /* CONFIG_FAIR_GROUP_SCHED */
147 190
148static inline struct rq *rq_of(struct cfs_rq *cfs_rq) 191static inline struct rq *rq_of(struct cfs_rq *cfs_rq)
@@ -193,6 +236,11 @@ static inline struct sched_entity *parent_entity(struct sched_entity *se)
193 return NULL; 236 return NULL;
194} 237}
195 238
239static inline void
240find_matching_se(struct sched_entity **se, struct sched_entity **pse)
241{
242}
243
196#endif /* CONFIG_FAIR_GROUP_SCHED */ 244#endif /* CONFIG_FAIR_GROUP_SCHED */
197 245
198 246
@@ -223,6 +271,27 @@ static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
223 return se->vruntime - cfs_rq->min_vruntime; 271 return se->vruntime - cfs_rq->min_vruntime;
224} 272}
225 273
274static void update_min_vruntime(struct cfs_rq *cfs_rq)
275{
276 u64 vruntime = cfs_rq->min_vruntime;
277
278 if (cfs_rq->curr)
279 vruntime = cfs_rq->curr->vruntime;
280
281 if (cfs_rq->rb_leftmost) {
282 struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
283 struct sched_entity,
284 run_node);
285
286 if (vruntime == cfs_rq->min_vruntime)
287 vruntime = se->vruntime;
288 else
289 vruntime = min_vruntime(vruntime, se->vruntime);
290 }
291
292 cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
293}
294
226/* 295/*
227 * Enqueue an entity into the rb-tree: 296 * Enqueue an entity into the rb-tree:
228 */ 297 */
@@ -256,15 +325,8 @@ static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
256 * Maintain a cache of leftmost tree entries (it is frequently 325 * Maintain a cache of leftmost tree entries (it is frequently
257 * used): 326 * used):
258 */ 327 */
259 if (leftmost) { 328 if (leftmost)
260 cfs_rq->rb_leftmost = &se->run_node; 329 cfs_rq->rb_leftmost = &se->run_node;
261 /*
262 * maintain cfs_rq->min_vruntime to be a monotonic increasing
263 * value tracking the leftmost vruntime in the tree.
264 */
265 cfs_rq->min_vruntime =
266 max_vruntime(cfs_rq->min_vruntime, se->vruntime);
267 }
268 330
269 rb_link_node(&se->run_node, parent, link); 331 rb_link_node(&se->run_node, parent, link);
270 rb_insert_color(&se->run_node, &cfs_rq->tasks_timeline); 332 rb_insert_color(&se->run_node, &cfs_rq->tasks_timeline);
@@ -274,18 +336,9 @@ static void __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
274{ 336{
275 if (cfs_rq->rb_leftmost == &se->run_node) { 337 if (cfs_rq->rb_leftmost == &se->run_node) {
276 struct rb_node *next_node; 338 struct rb_node *next_node;
277 struct sched_entity *next;
278 339
279 next_node = rb_next(&se->run_node); 340 next_node = rb_next(&se->run_node);
280 cfs_rq->rb_leftmost = next_node; 341 cfs_rq->rb_leftmost = next_node;
281
282 if (next_node) {
283 next = rb_entry(next_node,
284 struct sched_entity, run_node);
285 cfs_rq->min_vruntime =
286 max_vruntime(cfs_rq->min_vruntime,
287 next->vruntime);
288 }
289 } 342 }
290 343
291 if (cfs_rq->next == se) 344 if (cfs_rq->next == se)
@@ -424,6 +477,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
424 schedstat_add(cfs_rq, exec_clock, delta_exec); 477 schedstat_add(cfs_rq, exec_clock, delta_exec);
425 delta_exec_weighted = calc_delta_fair(delta_exec, curr); 478 delta_exec_weighted = calc_delta_fair(delta_exec, curr);
426 curr->vruntime += delta_exec_weighted; 479 curr->vruntime += delta_exec_weighted;
480 update_min_vruntime(cfs_rq);
427} 481}
428 482
429static void update_curr(struct cfs_rq *cfs_rq) 483static void update_curr(struct cfs_rq *cfs_rq)
@@ -613,13 +667,7 @@ static void check_spread(struct cfs_rq *cfs_rq, struct sched_entity *se)
613static void 667static void
614place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) 668place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
615{ 669{
616 u64 vruntime; 670 u64 vruntime = cfs_rq->min_vruntime;
617
618 if (first_fair(cfs_rq)) {
619 vruntime = min_vruntime(cfs_rq->min_vruntime,
620 __pick_next_entity(cfs_rq)->vruntime);
621 } else
622 vruntime = cfs_rq->min_vruntime;
623 671
624 /* 672 /*
625 * The 'current' period is already promised to the current tasks, 673 * The 'current' period is already promised to the current tasks,
@@ -696,6 +744,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
696 if (se != cfs_rq->curr) 744 if (se != cfs_rq->curr)
697 __dequeue_entity(cfs_rq, se); 745 __dequeue_entity(cfs_rq, se);
698 account_entity_dequeue(cfs_rq, se); 746 account_entity_dequeue(cfs_rq, se);
747 update_min_vruntime(cfs_rq);
699} 748}
700 749
701/* 750/*
@@ -742,16 +791,14 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
742 se->prev_sum_exec_runtime = se->sum_exec_runtime; 791 se->prev_sum_exec_runtime = se->sum_exec_runtime;
743} 792}
744 793
794static int
795wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se);
796
745static struct sched_entity * 797static struct sched_entity *
746pick_next(struct cfs_rq *cfs_rq, struct sched_entity *se) 798pick_next(struct cfs_rq *cfs_rq, struct sched_entity *se)
747{ 799{
748 struct rq *rq = rq_of(cfs_rq); 800 if (!cfs_rq->next || wakeup_preempt_entity(cfs_rq->next, se) == 1)
749 u64 pair_slice = rq->clock - cfs_rq->pair_start;
750
751 if (!cfs_rq->next || pair_slice > sysctl_sched_min_granularity) {
752 cfs_rq->pair_start = rq->clock;
753 return se; 801 return se;
754 }
755 802
756 return cfs_rq->next; 803 return cfs_rq->next;
757} 804}
@@ -1122,10 +1169,9 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
1122 if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS)) 1169 if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
1123 return 0; 1170 return 0;
1124 1171
1125 if (!sync && sched_feat(SYNC_WAKEUPS) && 1172 if (sync && (curr->se.avg_overlap > sysctl_sched_migration_cost ||
1126 curr->se.avg_overlap < sysctl_sched_migration_cost && 1173 p->se.avg_overlap > sysctl_sched_migration_cost))
1127 p->se.avg_overlap < sysctl_sched_migration_cost) 1174 sync = 0;
1128 sync = 1;
1129 1175
1130 /* 1176 /*
1131 * If sync wakeup then subtract the (maximum possible) 1177 * If sync wakeup then subtract the (maximum possible)
@@ -1244,13 +1290,42 @@ static unsigned long wakeup_gran(struct sched_entity *se)
1244 * More easily preempt - nice tasks, while not making it harder for 1290 * More easily preempt - nice tasks, while not making it harder for
1245 * + nice tasks. 1291 * + nice tasks.
1246 */ 1292 */
1247 if (sched_feat(ASYM_GRAN)) 1293 if (!sched_feat(ASYM_GRAN) || se->load.weight > NICE_0_LOAD)
1248 gran = calc_delta_mine(gran, NICE_0_LOAD, &se->load); 1294 gran = calc_delta_fair(sysctl_sched_wakeup_granularity, se);
1249 1295
1250 return gran; 1296 return gran;
1251} 1297}
1252 1298
1253/* 1299/*
1300 * Should 'se' preempt 'curr'.
1301 *
1302 * |s1
1303 * |s2
1304 * |s3
1305 * g
1306 * |<--->|c
1307 *
1308 * w(c, s1) = -1
1309 * w(c, s2) = 0
1310 * w(c, s3) = 1
1311 *
1312 */
1313static int
1314wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
1315{
1316 s64 gran, vdiff = curr->vruntime - se->vruntime;
1317
1318 if (vdiff <= 0)
1319 return -1;
1320
1321 gran = wakeup_gran(curr);
1322 if (vdiff > gran)
1323 return 1;
1324
1325 return 0;
1326}
1327
1328/*
1254 * Preempt the current task with a newly woken task if needed: 1329 * Preempt the current task with a newly woken task if needed:
1255 */ 1330 */
1256static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync) 1331static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
@@ -1258,7 +1333,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
1258 struct task_struct *curr = rq->curr; 1333 struct task_struct *curr = rq->curr;
1259 struct cfs_rq *cfs_rq = task_cfs_rq(curr); 1334 struct cfs_rq *cfs_rq = task_cfs_rq(curr);
1260 struct sched_entity *se = &curr->se, *pse = &p->se; 1335 struct sched_entity *se = &curr->se, *pse = &p->se;
1261 s64 delta_exec;
1262 1336
1263 if (unlikely(rt_prio(p->prio))) { 1337 if (unlikely(rt_prio(p->prio))) {
1264 update_rq_clock(rq); 1338 update_rq_clock(rq);
@@ -1296,9 +1370,19 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
1296 return; 1370 return;
1297 } 1371 }
1298 1372
1299 delta_exec = se->sum_exec_runtime - se->prev_sum_exec_runtime; 1373 find_matching_se(&se, &pse);
1300 if (delta_exec > wakeup_gran(pse)) 1374
1301 resched_task(curr); 1375 while (se) {
1376 BUG_ON(!pse);
1377
1378 if (wakeup_preempt_entity(se, pse) == 1) {
1379 resched_task(curr);
1380 break;
1381 }
1382
1383 se = parent_entity(se);
1384 pse = parent_entity(pse);
1385 }
1302} 1386}
1303 1387
1304static struct task_struct *pick_next_task_fair(struct rq *rq) 1388static struct task_struct *pick_next_task_fair(struct rq *rq)
@@ -1594,9 +1678,6 @@ static const struct sched_class fair_sched_class = {
1594 .enqueue_task = enqueue_task_fair, 1678 .enqueue_task = enqueue_task_fair,
1595 .dequeue_task = dequeue_task_fair, 1679 .dequeue_task = dequeue_task_fair,
1596 .yield_task = yield_task_fair, 1680 .yield_task = yield_task_fair,
1597#ifdef CONFIG_SMP
1598 .select_task_rq = select_task_rq_fair,
1599#endif /* CONFIG_SMP */
1600 1681
1601 .check_preempt_curr = check_preempt_wakeup, 1682 .check_preempt_curr = check_preempt_wakeup,
1602 1683
@@ -1604,6 +1685,8 @@ static const struct sched_class fair_sched_class = {
1604 .put_prev_task = put_prev_task_fair, 1685 .put_prev_task = put_prev_task_fair,
1605 1686
1606#ifdef CONFIG_SMP 1687#ifdef CONFIG_SMP
1688 .select_task_rq = select_task_rq_fair,
1689
1607 .load_balance = load_balance_fair, 1690 .load_balance = load_balance_fair,
1608 .move_one_task = move_one_task_fair, 1691 .move_one_task = move_one_task_fair,
1609#endif 1692#endif
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index dec4ccabe2f5..8a21a2e28c13 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -105,9 +105,6 @@ static const struct sched_class idle_sched_class = {
105 105
106 /* dequeue is not valid, we print a debug message there: */ 106 /* dequeue is not valid, we print a debug message there: */
107 .dequeue_task = dequeue_task_idle, 107 .dequeue_task = dequeue_task_idle,
108#ifdef CONFIG_SMP
109 .select_task_rq = select_task_rq_idle,
110#endif /* CONFIG_SMP */
111 108
112 .check_preempt_curr = check_preempt_curr_idle, 109 .check_preempt_curr = check_preempt_curr_idle,
113 110
@@ -115,6 +112,8 @@ static const struct sched_class idle_sched_class = {
115 .put_prev_task = put_prev_task_idle, 112 .put_prev_task = put_prev_task_idle,
116 113
117#ifdef CONFIG_SMP 114#ifdef CONFIG_SMP
115 .select_task_rq = select_task_rq_idle,
116
118 .load_balance = load_balance_idle, 117 .load_balance = load_balance_idle,
119 .move_one_task = move_one_task_idle, 118 .move_one_task = move_one_task_idle,
120#endif 119#endif
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index b446dc87494f..d9ba9d5f99d6 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1504,9 +1504,6 @@ static const struct sched_class rt_sched_class = {
1504 .enqueue_task = enqueue_task_rt, 1504 .enqueue_task = enqueue_task_rt,
1505 .dequeue_task = dequeue_task_rt, 1505 .dequeue_task = dequeue_task_rt,
1506 .yield_task = yield_task_rt, 1506 .yield_task = yield_task_rt,
1507#ifdef CONFIG_SMP
1508 .select_task_rq = select_task_rq_rt,
1509#endif /* CONFIG_SMP */
1510 1507
1511 .check_preempt_curr = check_preempt_curr_rt, 1508 .check_preempt_curr = check_preempt_curr_rt,
1512 1509
@@ -1514,6 +1511,8 @@ static const struct sched_class rt_sched_class = {
1514 .put_prev_task = put_prev_task_rt, 1511 .put_prev_task = put_prev_task_rt,
1515 1512
1516#ifdef CONFIG_SMP 1513#ifdef CONFIG_SMP
1514 .select_task_rq = select_task_rq_rt,
1515
1517 .load_balance = load_balance_rt, 1516 .load_balance = load_balance_rt,
1518 .move_one_task = move_one_task_rt, 1517 .move_one_task = move_one_task_rt,
1519 .set_cpus_allowed = set_cpus_allowed_rt, 1518 .set_cpus_allowed = set_cpus_allowed_rt,
diff --git a/kernel/signal.c b/kernel/signal.c
index 105217da5c82..4530fc654455 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1144,7 +1144,8 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
1144 struct task_struct * p; 1144 struct task_struct * p;
1145 1145
1146 for_each_process(p) { 1146 for_each_process(p) {
1147 if (p->pid > 1 && !same_thread_group(p, current)) { 1147 if (task_pid_vnr(p) > 1 &&
1148 !same_thread_group(p, current)) {
1148 int err = group_send_sig_info(sig, info, p); 1149 int err = group_send_sig_info(sig, info, p);
1149 ++count; 1150 ++count;
1150 if (err != -EPERM) 1151 if (err != -EPERM)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index a13bd4dfaeb1..9d048fa2d902 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -474,7 +474,7 @@ static struct ctl_table kern_table[] = {
474 .mode = 0644, 474 .mode = 0644,
475 .proc_handler = &proc_dointvec, 475 .proc_handler = &proc_dointvec,
476 }, 476 },
477#ifdef CONFIG_FTRACE 477#ifdef CONFIG_FUNCTION_TRACER
478 { 478 {
479 .ctl_name = CTL_UNNUMBERED, 479 .ctl_name = CTL_UNNUMBERED,
480 .procname = "ftrace_enabled", 480 .procname = "ftrace_enabled",
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 1cb3e1f616af..b58f43bec363 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -1,13 +1,13 @@
1# 1#
2# Architectures that offer an FTRACE implementation should select HAVE_FTRACE: 2# Architectures that offer an FUNCTION_TRACER implementation should
3# select HAVE_FUNCTION_TRACER:
3# 4#
4 5
5config NOP_TRACER 6config NOP_TRACER
6 bool 7 bool
7 8
8config HAVE_FTRACE 9config HAVE_FUNCTION_TRACER
9 bool 10 bool
10 select NOP_TRACER
11 11
12config HAVE_DYNAMIC_FTRACE 12config HAVE_DYNAMIC_FTRACE
13 bool 13 bool
@@ -27,10 +27,13 @@ config TRACING
27 select RING_BUFFER 27 select RING_BUFFER
28 select STACKTRACE 28 select STACKTRACE
29 select TRACEPOINTS 29 select TRACEPOINTS
30 select NOP_TRACER
31
32menu "Tracers"
30 33
31config FTRACE 34config FUNCTION_TRACER
32 bool "Kernel Function Tracer" 35 bool "Kernel Function Tracer"
33 depends on HAVE_FTRACE 36 depends on HAVE_FUNCTION_TRACER
34 depends on DEBUG_KERNEL 37 depends on DEBUG_KERNEL
35 select FRAME_POINTER 38 select FRAME_POINTER
36 select TRACING 39 select TRACING
@@ -49,7 +52,6 @@ config IRQSOFF_TRACER
49 default n 52 default n
50 depends on TRACE_IRQFLAGS_SUPPORT 53 depends on TRACE_IRQFLAGS_SUPPORT
51 depends on GENERIC_TIME 54 depends on GENERIC_TIME
52 depends on HAVE_FTRACE
53 depends on DEBUG_KERNEL 55 depends on DEBUG_KERNEL
54 select TRACE_IRQFLAGS 56 select TRACE_IRQFLAGS
55 select TRACING 57 select TRACING
@@ -73,7 +75,6 @@ config PREEMPT_TRACER
73 default n 75 default n
74 depends on GENERIC_TIME 76 depends on GENERIC_TIME
75 depends on PREEMPT 77 depends on PREEMPT
76 depends on HAVE_FTRACE
77 depends on DEBUG_KERNEL 78 depends on DEBUG_KERNEL
78 select TRACING 79 select TRACING
79 select TRACER_MAX_TRACE 80 select TRACER_MAX_TRACE
@@ -101,7 +102,6 @@ config SYSPROF_TRACER
101 102
102config SCHED_TRACER 103config SCHED_TRACER
103 bool "Scheduling Latency Tracer" 104 bool "Scheduling Latency Tracer"
104 depends on HAVE_FTRACE
105 depends on DEBUG_KERNEL 105 depends on DEBUG_KERNEL
106 select TRACING 106 select TRACING
107 select CONTEXT_SWITCH_TRACER 107 select CONTEXT_SWITCH_TRACER
@@ -112,7 +112,6 @@ config SCHED_TRACER
112 112
113config CONTEXT_SWITCH_TRACER 113config CONTEXT_SWITCH_TRACER
114 bool "Trace process context switches" 114 bool "Trace process context switches"
115 depends on HAVE_FTRACE
116 depends on DEBUG_KERNEL 115 depends on DEBUG_KERNEL
117 select TRACING 116 select TRACING
118 select MARKERS 117 select MARKERS
@@ -122,9 +121,9 @@ config CONTEXT_SWITCH_TRACER
122 121
123config BOOT_TRACER 122config BOOT_TRACER
124 bool "Trace boot initcalls" 123 bool "Trace boot initcalls"
125 depends on HAVE_FTRACE
126 depends on DEBUG_KERNEL 124 depends on DEBUG_KERNEL
127 select TRACING 125 select TRACING
126 select CONTEXT_SWITCH_TRACER
128 help 127 help
129 This tracer helps developers to optimize boot times: it records 128 This tracer helps developers to optimize boot times: it records
130 the timings of the initcalls and traces key events and the identity 129 the timings of the initcalls and traces key events and the identity
@@ -141,9 +140,9 @@ config BOOT_TRACER
141 140
142config STACK_TRACER 141config STACK_TRACER
143 bool "Trace max stack" 142 bool "Trace max stack"
144 depends on HAVE_FTRACE 143 depends on HAVE_FUNCTION_TRACER
145 depends on DEBUG_KERNEL 144 depends on DEBUG_KERNEL
146 select FTRACE 145 select FUNCTION_TRACER
147 select STACKTRACE 146 select STACKTRACE
148 help 147 help
149 This special tracer records the maximum stack footprint of the 148 This special tracer records the maximum stack footprint of the
@@ -160,7 +159,7 @@ config STACK_TRACER
160 159
161config DYNAMIC_FTRACE 160config DYNAMIC_FTRACE
162 bool "enable/disable ftrace tracepoints dynamically" 161 bool "enable/disable ftrace tracepoints dynamically"
163 depends on FTRACE 162 depends on FUNCTION_TRACER
164 depends on HAVE_DYNAMIC_FTRACE 163 depends on HAVE_DYNAMIC_FTRACE
165 depends on DEBUG_KERNEL 164 depends on DEBUG_KERNEL
166 default y 165 default y
@@ -170,7 +169,7 @@ config DYNAMIC_FTRACE
170 with a No-Op instruction) as they are called. A table is 169 with a No-Op instruction) as they are called. A table is
171 created to dynamically enable them again. 170 created to dynamically enable them again.
172 171
173 This way a CONFIG_FTRACE kernel is slightly larger, but otherwise 172 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but otherwise
174 has native performance as long as no tracing is active. 173 has native performance as long as no tracing is active.
175 174
176 The changes to the code are done by a kernel thread that 175 The changes to the code are done by a kernel thread that
@@ -195,3 +194,5 @@ config FTRACE_STARTUP_TEST
195 a series of tests are made to verify that the tracer is 194 a series of tests are made to verify that the tracer is
196 functioning properly. It will do tests on all the configured 195 functioning properly. It will do tests on all the configured
197 tracers of ftrace. 196 tracers of ftrace.
197
198endmenu
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index a85dfba88ba0..c8228b1a49e9 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -1,7 +1,7 @@
1 1
2# Do not instrument the tracer itself: 2# Do not instrument the tracer itself:
3 3
4ifdef CONFIG_FTRACE 4ifdef CONFIG_FUNCTION_TRACER
5ORIG_CFLAGS := $(KBUILD_CFLAGS) 5ORIG_CFLAGS := $(KBUILD_CFLAGS)
6KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) 6KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
7 7
@@ -10,13 +10,13 @@ CFLAGS_trace_selftest_dynamic.o = -pg
10obj-y += trace_selftest_dynamic.o 10obj-y += trace_selftest_dynamic.o
11endif 11endif
12 12
13obj-$(CONFIG_FTRACE) += libftrace.o 13obj-$(CONFIG_FUNCTION_TRACER) += libftrace.o
14obj-$(CONFIG_RING_BUFFER) += ring_buffer.o 14obj-$(CONFIG_RING_BUFFER) += ring_buffer.o
15 15
16obj-$(CONFIG_TRACING) += trace.o 16obj-$(CONFIG_TRACING) += trace.o
17obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o 17obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
18obj-$(CONFIG_SYSPROF_TRACER) += trace_sysprof.o 18obj-$(CONFIG_SYSPROF_TRACER) += trace_sysprof.o
19obj-$(CONFIG_FTRACE) += trace_functions.o 19obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
20obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o 20obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
21obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o 21obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
22obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o 22obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4dda4f60a2a9..4a39d24568c8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -25,13 +25,24 @@
25#include <linux/ftrace.h> 25#include <linux/ftrace.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <linux/ctype.h> 27#include <linux/ctype.h>
28#include <linux/hash.h>
29#include <linux/list.h> 28#include <linux/list.h>
30 29
31#include <asm/ftrace.h> 30#include <asm/ftrace.h>
32 31
33#include "trace.h" 32#include "trace.h"
34 33
34#define FTRACE_WARN_ON(cond) \
35 do { \
36 if (WARN_ON(cond)) \
37 ftrace_kill(); \
38 } while (0)
39
40#define FTRACE_WARN_ON_ONCE(cond) \
41 do { \
42 if (WARN_ON_ONCE(cond)) \
43 ftrace_kill(); \
44 } while (0)
45
35/* ftrace_enabled is a method to turn ftrace on or off */ 46/* ftrace_enabled is a method to turn ftrace on or off */
36int ftrace_enabled __read_mostly; 47int ftrace_enabled __read_mostly;
37static int last_ftrace_enabled; 48static int last_ftrace_enabled;
@@ -153,21 +164,8 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops)
153} 164}
154 165
155#ifdef CONFIG_DYNAMIC_FTRACE 166#ifdef CONFIG_DYNAMIC_FTRACE
156
157#ifndef CONFIG_FTRACE_MCOUNT_RECORD 167#ifndef CONFIG_FTRACE_MCOUNT_RECORD
158/* 168# error Dynamic ftrace depends on MCOUNT_RECORD
159 * The hash lock is only needed when the recording of the mcount
160 * callers are dynamic. That is, by the caller themselves and
161 * not recorded via the compilation.
162 */
163static DEFINE_SPINLOCK(ftrace_hash_lock);
164#define ftrace_hash_lock(flags) spin_lock_irqsave(&ftrace_hash_lock, flags)
165#define ftrace_hash_unlock(flags) \
166 spin_unlock_irqrestore(&ftrace_hash_lock, flags)
167#else
168/* This is protected via the ftrace_lock with MCOUNT_RECORD. */
169#define ftrace_hash_lock(flags) do { (void)(flags); } while (0)
170#define ftrace_hash_unlock(flags) do { } while(0)
171#endif 169#endif
172 170
173/* 171/*
@@ -178,8 +176,6 @@ static DEFINE_SPINLOCK(ftrace_hash_lock);
178 */ 176 */
179static unsigned long mcount_addr = MCOUNT_ADDR; 177static unsigned long mcount_addr = MCOUNT_ADDR;
180 178
181static struct task_struct *ftraced_task;
182
183enum { 179enum {
184 FTRACE_ENABLE_CALLS = (1 << 0), 180 FTRACE_ENABLE_CALLS = (1 << 0),
185 FTRACE_DISABLE_CALLS = (1 << 1), 181 FTRACE_DISABLE_CALLS = (1 << 1),
@@ -190,13 +186,9 @@ enum {
190 186
191static int ftrace_filtered; 187static int ftrace_filtered;
192static int tracing_on; 188static int tracing_on;
193static int frozen_record_count;
194
195static struct hlist_head ftrace_hash[FTRACE_HASHSIZE];
196 189
197static DEFINE_PER_CPU(int, ftrace_shutdown_disable_cpu); 190static LIST_HEAD(ftrace_new_addrs);
198 191
199static DEFINE_MUTEX(ftraced_lock);
200static DEFINE_MUTEX(ftrace_regex_lock); 192static DEFINE_MUTEX(ftrace_regex_lock);
201 193
202struct ftrace_page { 194struct ftrace_page {
@@ -214,16 +206,13 @@ struct ftrace_page {
214static struct ftrace_page *ftrace_pages_start; 206static struct ftrace_page *ftrace_pages_start;
215static struct ftrace_page *ftrace_pages; 207static struct ftrace_page *ftrace_pages;
216 208
217static int ftraced_trigger;
218static int ftraced_suspend;
219static int ftraced_stop;
220
221static int ftrace_record_suspend;
222
223static struct dyn_ftrace *ftrace_free_records; 209static struct dyn_ftrace *ftrace_free_records;
224 210
225 211
226#ifdef CONFIG_KPROBES 212#ifdef CONFIG_KPROBES
213
214static int frozen_record_count;
215
227static inline void freeze_record(struct dyn_ftrace *rec) 216static inline void freeze_record(struct dyn_ftrace *rec)
228{ 217{
229 if (!(rec->flags & FTRACE_FL_FROZEN)) { 218 if (!(rec->flags & FTRACE_FL_FROZEN)) {
@@ -250,72 +239,6 @@ static inline int record_frozen(struct dyn_ftrace *rec)
250# define record_frozen(rec) ({ 0; }) 239# define record_frozen(rec) ({ 0; })
251#endif /* CONFIG_KPROBES */ 240#endif /* CONFIG_KPROBES */
252 241
253int skip_trace(unsigned long ip)
254{
255 unsigned long fl;
256 struct dyn_ftrace *rec;
257 struct hlist_node *t;
258 struct hlist_head *head;
259
260 if (frozen_record_count == 0)
261 return 0;
262
263 head = &ftrace_hash[hash_long(ip, FTRACE_HASHBITS)];
264 hlist_for_each_entry_rcu(rec, t, head, node) {
265 if (rec->ip == ip) {
266 if (record_frozen(rec)) {
267 if (rec->flags & FTRACE_FL_FAILED)
268 return 1;
269
270 if (!(rec->flags & FTRACE_FL_CONVERTED))
271 return 1;
272
273 if (!tracing_on || !ftrace_enabled)
274 return 1;
275
276 if (ftrace_filtered) {
277 fl = rec->flags & (FTRACE_FL_FILTER |
278 FTRACE_FL_NOTRACE);
279 if (!fl || (fl & FTRACE_FL_NOTRACE))
280 return 1;
281 }
282 }
283 break;
284 }
285 }
286
287 return 0;
288}
289
290static inline int
291ftrace_ip_in_hash(unsigned long ip, unsigned long key)
292{
293 struct dyn_ftrace *p;
294 struct hlist_node *t;
295 int found = 0;
296
297 hlist_for_each_entry_rcu(p, t, &ftrace_hash[key], node) {
298 if (p->ip == ip) {
299 found = 1;
300 break;
301 }
302 }
303
304 return found;
305}
306
307static inline void
308ftrace_add_hash(struct dyn_ftrace *node, unsigned long key)
309{
310 hlist_add_head_rcu(&node->node, &ftrace_hash[key]);
311}
312
313/* called from kstop_machine */
314static inline void ftrace_del_hash(struct dyn_ftrace *node)
315{
316 hlist_del(&node->node);
317}
318
319static void ftrace_free_rec(struct dyn_ftrace *rec) 242static void ftrace_free_rec(struct dyn_ftrace *rec)
320{ 243{
321 rec->ip = (unsigned long)ftrace_free_records; 244 rec->ip = (unsigned long)ftrace_free_records;
@@ -346,7 +269,6 @@ void ftrace_release(void *start, unsigned long size)
346 } 269 }
347 } 270 }
348 spin_unlock(&ftrace_lock); 271 spin_unlock(&ftrace_lock);
349
350} 272}
351 273
352static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip) 274static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
@@ -358,10 +280,8 @@ static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
358 rec = ftrace_free_records; 280 rec = ftrace_free_records;
359 281
360 if (unlikely(!(rec->flags & FTRACE_FL_FREE))) { 282 if (unlikely(!(rec->flags & FTRACE_FL_FREE))) {
361 WARN_ON_ONCE(1); 283 FTRACE_WARN_ON_ONCE(1);
362 ftrace_free_records = NULL; 284 ftrace_free_records = NULL;
363 ftrace_disabled = 1;
364 ftrace_enabled = 0;
365 return NULL; 285 return NULL;
366 } 286 }
367 287
@@ -371,76 +291,36 @@ static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
371 } 291 }
372 292
373 if (ftrace_pages->index == ENTRIES_PER_PAGE) { 293 if (ftrace_pages->index == ENTRIES_PER_PAGE) {
374 if (!ftrace_pages->next) 294 if (!ftrace_pages->next) {
375 return NULL; 295 /* allocate another page */
296 ftrace_pages->next =
297 (void *)get_zeroed_page(GFP_KERNEL);
298 if (!ftrace_pages->next)
299 return NULL;
300 }
376 ftrace_pages = ftrace_pages->next; 301 ftrace_pages = ftrace_pages->next;
377 } 302 }
378 303
379 return &ftrace_pages->records[ftrace_pages->index++]; 304 return &ftrace_pages->records[ftrace_pages->index++];
380} 305}
381 306
382static void 307static struct dyn_ftrace *
383ftrace_record_ip(unsigned long ip) 308ftrace_record_ip(unsigned long ip)
384{ 309{
385 struct dyn_ftrace *node; 310 struct dyn_ftrace *rec;
386 unsigned long flags;
387 unsigned long key;
388 int resched;
389 int cpu;
390 311
391 if (!ftrace_enabled || ftrace_disabled) 312 if (!ftrace_enabled || ftrace_disabled)
392 return; 313 return NULL;
393
394 resched = need_resched();
395 preempt_disable_notrace();
396 314
397 /* 315 rec = ftrace_alloc_dyn_node(ip);
398 * We simply need to protect against recursion. 316 if (!rec)
399 * Use the the raw version of smp_processor_id and not 317 return NULL;
400 * __get_cpu_var which can call debug hooks that can
401 * cause a recursive crash here.
402 */
403 cpu = raw_smp_processor_id();
404 per_cpu(ftrace_shutdown_disable_cpu, cpu)++;
405 if (per_cpu(ftrace_shutdown_disable_cpu, cpu) != 1)
406 goto out;
407
408 if (unlikely(ftrace_record_suspend))
409 goto out;
410
411 key = hash_long(ip, FTRACE_HASHBITS);
412
413 WARN_ON_ONCE(key >= FTRACE_HASHSIZE);
414
415 if (ftrace_ip_in_hash(ip, key))
416 goto out;
417
418 ftrace_hash_lock(flags);
419
420 /* This ip may have hit the hash before the lock */
421 if (ftrace_ip_in_hash(ip, key))
422 goto out_unlock;
423
424 node = ftrace_alloc_dyn_node(ip);
425 if (!node)
426 goto out_unlock;
427
428 node->ip = ip;
429
430 ftrace_add_hash(node, key);
431 318
432 ftraced_trigger = 1; 319 rec->ip = ip;
433 320
434 out_unlock: 321 list_add(&rec->list, &ftrace_new_addrs);
435 ftrace_hash_unlock(flags);
436 out:
437 per_cpu(ftrace_shutdown_disable_cpu, cpu)--;
438 322
439 /* prevent recursion with scheduler */ 323 return rec;
440 if (resched)
441 preempt_enable_no_resched_notrace();
442 else
443 preempt_enable_notrace();
444} 324}
445 325
446#define FTRACE_ADDR ((long)(ftrace_caller)) 326#define FTRACE_ADDR ((long)(ftrace_caller))
@@ -559,7 +439,6 @@ static void ftrace_replace_code(int enable)
559 rec->flags |= FTRACE_FL_FAILED; 439 rec->flags |= FTRACE_FL_FAILED;
560 if ((system_state == SYSTEM_BOOTING) || 440 if ((system_state == SYSTEM_BOOTING) ||
561 !core_kernel_text(rec->ip)) { 441 !core_kernel_text(rec->ip)) {
562 ftrace_del_hash(rec);
563 ftrace_free_rec(rec); 442 ftrace_free_rec(rec);
564 } 443 }
565 } 444 }
@@ -567,15 +446,6 @@ static void ftrace_replace_code(int enable)
567 } 446 }
568} 447}
569 448
570static void ftrace_shutdown_replenish(void)
571{
572 if (ftrace_pages->next)
573 return;
574
575 /* allocate another page */
576 ftrace_pages->next = (void *)get_zeroed_page(GFP_KERNEL);
577}
578
579static void print_ip_ins(const char *fmt, unsigned char *p) 449static void print_ip_ins(const char *fmt, unsigned char *p)
580{ 450{
581 int i; 451 int i;
@@ -591,23 +461,23 @@ ftrace_code_disable(struct dyn_ftrace *rec)
591{ 461{
592 unsigned long ip; 462 unsigned long ip;
593 unsigned char *nop, *call; 463 unsigned char *nop, *call;
594 int failed; 464 int ret;
595 465
596 ip = rec->ip; 466 ip = rec->ip;
597 467
598 nop = ftrace_nop_replace(); 468 nop = ftrace_nop_replace();
599 call = ftrace_call_replace(ip, mcount_addr); 469 call = ftrace_call_replace(ip, mcount_addr);
600 470
601 failed = ftrace_modify_code(ip, call, nop); 471 ret = ftrace_modify_code(ip, call, nop);
602 if (failed) { 472 if (ret) {
603 switch (failed) { 473 switch (ret) {
604 case 1: 474 case -EFAULT:
605 WARN_ON_ONCE(1); 475 FTRACE_WARN_ON_ONCE(1);
606 pr_info("ftrace faulted on modifying "); 476 pr_info("ftrace faulted on modifying ");
607 print_ip_sym(ip); 477 print_ip_sym(ip);
608 break; 478 break;
609 case 2: 479 case -EINVAL:
610 WARN_ON_ONCE(1); 480 FTRACE_WARN_ON_ONCE(1);
611 pr_info("ftrace failed to modify "); 481 pr_info("ftrace failed to modify ");
612 print_ip_sym(ip); 482 print_ip_sym(ip);
613 print_ip_ins(" expected: ", call); 483 print_ip_ins(" expected: ", call);
@@ -615,6 +485,15 @@ ftrace_code_disable(struct dyn_ftrace *rec)
615 print_ip_ins(" replace: ", nop); 485 print_ip_ins(" replace: ", nop);
616 printk(KERN_CONT "\n"); 486 printk(KERN_CONT "\n");
617 break; 487 break;
488 case -EPERM:
489 FTRACE_WARN_ON_ONCE(1);
490 pr_info("ftrace faulted on writing ");
491 print_ip_sym(ip);
492 break;
493 default:
494 FTRACE_WARN_ON_ONCE(1);
495 pr_info("ftrace faulted on unknown error ");
496 print_ip_sym(ip);
618 } 497 }
619 498
620 rec->flags |= FTRACE_FL_FAILED; 499 rec->flags |= FTRACE_FL_FAILED;
@@ -623,19 +502,11 @@ ftrace_code_disable(struct dyn_ftrace *rec)
623 return 1; 502 return 1;
624} 503}
625 504
626static int __ftrace_update_code(void *ignore);
627
628static int __ftrace_modify_code(void *data) 505static int __ftrace_modify_code(void *data)
629{ 506{
630 unsigned long addr;
631 int *command = data; 507 int *command = data;
632 508
633 if (*command & FTRACE_ENABLE_CALLS) { 509 if (*command & FTRACE_ENABLE_CALLS) {
634 /*
635 * Update any recorded ips now that we have the
636 * machine stopped
637 */
638 __ftrace_update_code(NULL);
639 ftrace_replace_code(1); 510 ftrace_replace_code(1);
640 tracing_on = 1; 511 tracing_on = 1;
641 } else if (*command & FTRACE_DISABLE_CALLS) { 512 } else if (*command & FTRACE_DISABLE_CALLS) {
@@ -646,14 +517,6 @@ static int __ftrace_modify_code(void *data)
646 if (*command & FTRACE_UPDATE_TRACE_FUNC) 517 if (*command & FTRACE_UPDATE_TRACE_FUNC)
647 ftrace_update_ftrace_func(ftrace_trace_function); 518 ftrace_update_ftrace_func(ftrace_trace_function);
648 519
649 if (*command & FTRACE_ENABLE_MCOUNT) {
650 addr = (unsigned long)ftrace_record_ip;
651 ftrace_mcount_set(&addr);
652 } else if (*command & FTRACE_DISABLE_MCOUNT) {
653 addr = (unsigned long)ftrace_stub;
654 ftrace_mcount_set(&addr);
655 }
656
657 return 0; 520 return 0;
658} 521}
659 522
@@ -662,26 +525,9 @@ static void ftrace_run_update_code(int command)
662 stop_machine(__ftrace_modify_code, &command, NULL); 525 stop_machine(__ftrace_modify_code, &command, NULL);
663} 526}
664 527
665void ftrace_disable_daemon(void)
666{
667 /* Stop the daemon from calling kstop_machine */
668 mutex_lock(&ftraced_lock);
669 ftraced_stop = 1;
670 mutex_unlock(&ftraced_lock);
671
672 ftrace_force_update();
673}
674
675void ftrace_enable_daemon(void)
676{
677 mutex_lock(&ftraced_lock);
678 ftraced_stop = 0;
679 mutex_unlock(&ftraced_lock);
680
681 ftrace_force_update();
682}
683
684static ftrace_func_t saved_ftrace_func; 528static ftrace_func_t saved_ftrace_func;
529static int ftrace_start;
530static DEFINE_MUTEX(ftrace_start_lock);
685 531
686static void ftrace_startup(void) 532static void ftrace_startup(void)
687{ 533{
@@ -690,9 +536,9 @@ static void ftrace_startup(void)
690 if (unlikely(ftrace_disabled)) 536 if (unlikely(ftrace_disabled))
691 return; 537 return;
692 538
693 mutex_lock(&ftraced_lock); 539 mutex_lock(&ftrace_start_lock);
694 ftraced_suspend++; 540 ftrace_start++;
695 if (ftraced_suspend == 1) 541 if (ftrace_start == 1)
696 command |= FTRACE_ENABLE_CALLS; 542 command |= FTRACE_ENABLE_CALLS;
697 543
698 if (saved_ftrace_func != ftrace_trace_function) { 544 if (saved_ftrace_func != ftrace_trace_function) {
@@ -705,7 +551,7 @@ static void ftrace_startup(void)
705 551
706 ftrace_run_update_code(command); 552 ftrace_run_update_code(command);
707 out: 553 out:
708 mutex_unlock(&ftraced_lock); 554 mutex_unlock(&ftrace_start_lock);
709} 555}
710 556
711static void ftrace_shutdown(void) 557static void ftrace_shutdown(void)
@@ -715,9 +561,9 @@ static void ftrace_shutdown(void)
715 if (unlikely(ftrace_disabled)) 561 if (unlikely(ftrace_disabled))
716 return; 562 return;
717 563
718 mutex_lock(&ftraced_lock); 564 mutex_lock(&ftrace_start_lock);
719 ftraced_suspend--; 565 ftrace_start--;
720 if (!ftraced_suspend) 566 if (!ftrace_start)
721 command |= FTRACE_DISABLE_CALLS; 567 command |= FTRACE_DISABLE_CALLS;
722 568
723 if (saved_ftrace_func != ftrace_trace_function) { 569 if (saved_ftrace_func != ftrace_trace_function) {
@@ -730,7 +576,7 @@ static void ftrace_shutdown(void)
730 576
731 ftrace_run_update_code(command); 577 ftrace_run_update_code(command);
732 out: 578 out:
733 mutex_unlock(&ftraced_lock); 579 mutex_unlock(&ftrace_start_lock);
734} 580}
735 581
736static void ftrace_startup_sysctl(void) 582static void ftrace_startup_sysctl(void)
@@ -740,15 +586,15 @@ static void ftrace_startup_sysctl(void)
740 if (unlikely(ftrace_disabled)) 586 if (unlikely(ftrace_disabled))
741 return; 587 return;
742 588
743 mutex_lock(&ftraced_lock); 589 mutex_lock(&ftrace_start_lock);
744 /* Force update next time */ 590 /* Force update next time */
745 saved_ftrace_func = NULL; 591 saved_ftrace_func = NULL;
746 /* ftraced_suspend is true if we want ftrace running */ 592 /* ftrace_start is true if we want ftrace running */
747 if (ftraced_suspend) 593 if (ftrace_start)
748 command |= FTRACE_ENABLE_CALLS; 594 command |= FTRACE_ENABLE_CALLS;
749 595
750 ftrace_run_update_code(command); 596 ftrace_run_update_code(command);
751 mutex_unlock(&ftraced_lock); 597 mutex_unlock(&ftrace_start_lock);
752} 598}
753 599
754static void ftrace_shutdown_sysctl(void) 600static void ftrace_shutdown_sysctl(void)
@@ -758,112 +604,50 @@ static void ftrace_shutdown_sysctl(void)
758 if (unlikely(ftrace_disabled)) 604 if (unlikely(ftrace_disabled))
759 return; 605 return;
760 606
761 mutex_lock(&ftraced_lock); 607 mutex_lock(&ftrace_start_lock);
762 /* ftraced_suspend is true if ftrace is running */ 608 /* ftrace_start is true if ftrace is running */
763 if (ftraced_suspend) 609 if (ftrace_start)
764 command |= FTRACE_DISABLE_CALLS; 610 command |= FTRACE_DISABLE_CALLS;
765 611
766 ftrace_run_update_code(command); 612 ftrace_run_update_code(command);
767 mutex_unlock(&ftraced_lock); 613 mutex_unlock(&ftrace_start_lock);
768} 614}
769 615
770static cycle_t ftrace_update_time; 616static cycle_t ftrace_update_time;
771static unsigned long ftrace_update_cnt; 617static unsigned long ftrace_update_cnt;
772unsigned long ftrace_update_tot_cnt; 618unsigned long ftrace_update_tot_cnt;
773 619
774static int __ftrace_update_code(void *ignore) 620static int ftrace_update_code(void)
775{ 621{
776 int i, save_ftrace_enabled; 622 struct dyn_ftrace *p, *t;
777 cycle_t start, stop; 623 cycle_t start, stop;
778 struct dyn_ftrace *p;
779 struct hlist_node *t, *n;
780 struct hlist_head *head, temp_list;
781
782 /* Don't be recording funcs now */
783 ftrace_record_suspend++;
784 save_ftrace_enabled = ftrace_enabled;
785 ftrace_enabled = 0;
786 624
787 start = ftrace_now(raw_smp_processor_id()); 625 start = ftrace_now(raw_smp_processor_id());
788 ftrace_update_cnt = 0; 626 ftrace_update_cnt = 0;
789 627
790 /* No locks needed, the machine is stopped! */ 628 list_for_each_entry_safe(p, t, &ftrace_new_addrs, list) {
791 for (i = 0; i < FTRACE_HASHSIZE; i++) {
792 INIT_HLIST_HEAD(&temp_list);
793 head = &ftrace_hash[i];
794 629
795 /* all CPUS are stopped, we are safe to modify code */ 630 /* If something went wrong, bail without enabling anything */
796 hlist_for_each_entry_safe(p, t, n, head, node) { 631 if (unlikely(ftrace_disabled))
797 /* Skip over failed records which have not been 632 return -1;
798 * freed. */
799 if (p->flags & FTRACE_FL_FAILED)
800 continue;
801 633
802 /* Unconverted records are always at the head of the 634 list_del_init(&p->list);
803 * hash bucket. Once we encounter a converted record,
804 * simply skip over to the next bucket. Saves ftraced
805 * some processor cycles (ftrace does its bid for
806 * global warming :-p ). */
807 if (p->flags & (FTRACE_FL_CONVERTED))
808 break;
809 635
810 /* Ignore updates to this record's mcount site. 636 /* convert record (i.e, patch mcount-call with NOP) */
811 * Reintroduce this record at the head of this 637 if (ftrace_code_disable(p)) {
812 * bucket to attempt to "convert" it again if 638 p->flags |= FTRACE_FL_CONVERTED;
813 * the kprobe on it is unregistered before the 639 ftrace_update_cnt++;
814 * next run. */ 640 } else
815 if (get_kprobe((void *)p->ip)) { 641 ftrace_free_rec(p);
816 ftrace_del_hash(p);
817 INIT_HLIST_NODE(&p->node);
818 hlist_add_head(&p->node, &temp_list);
819 freeze_record(p);
820 continue;
821 } else {
822 unfreeze_record(p);
823 }
824
825 /* convert record (i.e, patch mcount-call with NOP) */
826 if (ftrace_code_disable(p)) {
827 p->flags |= FTRACE_FL_CONVERTED;
828 ftrace_update_cnt++;
829 } else {
830 if ((system_state == SYSTEM_BOOTING) ||
831 !core_kernel_text(p->ip)) {
832 ftrace_del_hash(p);
833 ftrace_free_rec(p);
834 }
835 }
836 }
837
838 hlist_for_each_entry_safe(p, t, n, &temp_list, node) {
839 hlist_del(&p->node);
840 INIT_HLIST_NODE(&p->node);
841 hlist_add_head(&p->node, head);
842 }
843 } 642 }
844 643
845 stop = ftrace_now(raw_smp_processor_id()); 644 stop = ftrace_now(raw_smp_processor_id());
846 ftrace_update_time = stop - start; 645 ftrace_update_time = stop - start;
847 ftrace_update_tot_cnt += ftrace_update_cnt; 646 ftrace_update_tot_cnt += ftrace_update_cnt;
848 ftraced_trigger = 0;
849
850 ftrace_enabled = save_ftrace_enabled;
851 ftrace_record_suspend--;
852 647
853 return 0; 648 return 0;
854} 649}
855 650
856static int ftrace_update_code(void)
857{
858 if (unlikely(ftrace_disabled) ||
859 !ftrace_enabled || !ftraced_trigger)
860 return 0;
861
862 stop_machine(__ftrace_update_code, NULL, NULL);
863
864 return 1;
865}
866
867static int __init ftrace_dyn_table_alloc(unsigned long num_to_init) 651static int __init ftrace_dyn_table_alloc(unsigned long num_to_init)
868{ 652{
869 struct ftrace_page *pg; 653 struct ftrace_page *pg;
@@ -892,7 +676,7 @@ static int __init ftrace_dyn_table_alloc(unsigned long num_to_init)
892 pg = ftrace_pages = ftrace_pages_start; 676 pg = ftrace_pages = ftrace_pages_start;
893 677
894 cnt = num_to_init / ENTRIES_PER_PAGE; 678 cnt = num_to_init / ENTRIES_PER_PAGE;
895 pr_info("ftrace: allocating %ld hash entries in %d pages\n", 679 pr_info("ftrace: allocating %ld entries in %d pages\n",
896 num_to_init, cnt); 680 num_to_init, cnt);
897 681
898 for (i = 0; i < cnt; i++) { 682 for (i = 0; i < cnt; i++) {
@@ -1401,10 +1185,10 @@ ftrace_regex_release(struct inode *inode, struct file *file, int enable)
1401 } 1185 }
1402 1186
1403 mutex_lock(&ftrace_sysctl_lock); 1187 mutex_lock(&ftrace_sysctl_lock);
1404 mutex_lock(&ftraced_lock); 1188 mutex_lock(&ftrace_start_lock);
1405 if (iter->filtered && ftraced_suspend && ftrace_enabled) 1189 if (iter->filtered && ftrace_start && ftrace_enabled)
1406 ftrace_run_update_code(FTRACE_ENABLE_CALLS); 1190 ftrace_run_update_code(FTRACE_ENABLE_CALLS);
1407 mutex_unlock(&ftraced_lock); 1191 mutex_unlock(&ftrace_start_lock);
1408 mutex_unlock(&ftrace_sysctl_lock); 1192 mutex_unlock(&ftrace_sysctl_lock);
1409 1193
1410 kfree(iter); 1194 kfree(iter);
@@ -1424,55 +1208,6 @@ ftrace_notrace_release(struct inode *inode, struct file *file)
1424 return ftrace_regex_release(inode, file, 0); 1208 return ftrace_regex_release(inode, file, 0);
1425} 1209}
1426 1210
1427static ssize_t
1428ftraced_read(struct file *filp, char __user *ubuf,
1429 size_t cnt, loff_t *ppos)
1430{
1431 /* don't worry about races */
1432 char *buf = ftraced_stop ? "disabled\n" : "enabled\n";
1433 int r = strlen(buf);
1434
1435 return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
1436}
1437
1438static ssize_t
1439ftraced_write(struct file *filp, const char __user *ubuf,
1440 size_t cnt, loff_t *ppos)
1441{
1442 char buf[64];
1443 long val;
1444 int ret;
1445
1446 if (cnt >= sizeof(buf))
1447 return -EINVAL;
1448
1449 if (copy_from_user(&buf, ubuf, cnt))
1450 return -EFAULT;
1451
1452 if (strncmp(buf, "enable", 6) == 0)
1453 val = 1;
1454 else if (strncmp(buf, "disable", 7) == 0)
1455 val = 0;
1456 else {
1457 buf[cnt] = 0;
1458
1459 ret = strict_strtoul(buf, 10, &val);
1460 if (ret < 0)
1461 return ret;
1462
1463 val = !!val;
1464 }
1465
1466 if (val)
1467 ftrace_enable_daemon();
1468 else
1469 ftrace_disable_daemon();
1470
1471 filp->f_pos += cnt;
1472
1473 return cnt;
1474}
1475
1476static struct file_operations ftrace_avail_fops = { 1211static struct file_operations ftrace_avail_fops = {
1477 .open = ftrace_avail_open, 1212 .open = ftrace_avail_open,
1478 .read = seq_read, 1213 .read = seq_read,
@@ -1503,54 +1238,6 @@ static struct file_operations ftrace_notrace_fops = {
1503 .release = ftrace_notrace_release, 1238 .release = ftrace_notrace_release,
1504}; 1239};
1505 1240
1506static struct file_operations ftraced_fops = {
1507 .open = tracing_open_generic,
1508 .read = ftraced_read,
1509 .write = ftraced_write,
1510};
1511
1512/**
1513 * ftrace_force_update - force an update to all recording ftrace functions
1514 */
1515int ftrace_force_update(void)
1516{
1517 int ret = 0;
1518
1519 if (unlikely(ftrace_disabled))
1520 return -ENODEV;
1521
1522 mutex_lock(&ftrace_sysctl_lock);
1523 mutex_lock(&ftraced_lock);
1524
1525 /*
1526 * If ftraced_trigger is not set, then there is nothing
1527 * to update.
1528 */
1529 if (ftraced_trigger && !ftrace_update_code())
1530 ret = -EBUSY;
1531
1532 mutex_unlock(&ftraced_lock);
1533 mutex_unlock(&ftrace_sysctl_lock);
1534
1535 return ret;
1536}
1537
1538static void ftrace_force_shutdown(void)
1539{
1540 struct task_struct *task;
1541 int command = FTRACE_DISABLE_CALLS | FTRACE_UPDATE_TRACE_FUNC;
1542
1543 mutex_lock(&ftraced_lock);
1544 task = ftraced_task;
1545 ftraced_task = NULL;
1546 ftraced_suspend = -1;
1547 ftrace_run_update_code(command);
1548 mutex_unlock(&ftraced_lock);
1549
1550 if (task)
1551 kthread_stop(task);
1552}
1553
1554static __init int ftrace_init_debugfs(void) 1241static __init int ftrace_init_debugfs(void)
1555{ 1242{
1556 struct dentry *d_tracer; 1243 struct dentry *d_tracer;
@@ -1581,17 +1268,11 @@ static __init int ftrace_init_debugfs(void)
1581 pr_warning("Could not create debugfs " 1268 pr_warning("Could not create debugfs "
1582 "'set_ftrace_notrace' entry\n"); 1269 "'set_ftrace_notrace' entry\n");
1583 1270
1584 entry = debugfs_create_file("ftraced_enabled", 0644, d_tracer,
1585 NULL, &ftraced_fops);
1586 if (!entry)
1587 pr_warning("Could not create debugfs "
1588 "'ftraced_enabled' entry\n");
1589 return 0; 1271 return 0;
1590} 1272}
1591 1273
1592fs_initcall(ftrace_init_debugfs); 1274fs_initcall(ftrace_init_debugfs);
1593 1275
1594#ifdef CONFIG_FTRACE_MCOUNT_RECORD
1595static int ftrace_convert_nops(unsigned long *start, 1276static int ftrace_convert_nops(unsigned long *start,
1596 unsigned long *end) 1277 unsigned long *end)
1597{ 1278{
@@ -1599,20 +1280,18 @@ static int ftrace_convert_nops(unsigned long *start,
1599 unsigned long addr; 1280 unsigned long addr;
1600 unsigned long flags; 1281 unsigned long flags;
1601 1282
1283 mutex_lock(&ftrace_start_lock);
1602 p = start; 1284 p = start;
1603 while (p < end) { 1285 while (p < end) {
1604 addr = ftrace_call_adjust(*p++); 1286 addr = ftrace_call_adjust(*p++);
1605 /* should not be called from interrupt context */
1606 spin_lock(&ftrace_lock);
1607 ftrace_record_ip(addr); 1287 ftrace_record_ip(addr);
1608 spin_unlock(&ftrace_lock);
1609 ftrace_shutdown_replenish();
1610 } 1288 }
1611 1289
1612 /* p is ignored */ 1290 /* disable interrupts to prevent kstop machine */
1613 local_irq_save(flags); 1291 local_irq_save(flags);
1614 __ftrace_update_code(p); 1292 ftrace_update_code();
1615 local_irq_restore(flags); 1293 local_irq_restore(flags);
1294 mutex_unlock(&ftrace_start_lock);
1616 1295
1617 return 0; 1296 return 0;
1618} 1297}
@@ -1658,130 +1337,34 @@ void __init ftrace_init(void)
1658 failed: 1337 failed:
1659 ftrace_disabled = 1; 1338 ftrace_disabled = 1;
1660} 1339}
1661#else /* CONFIG_FTRACE_MCOUNT_RECORD */
1662static int ftraced(void *ignore)
1663{
1664 unsigned long usecs;
1665
1666 while (!kthread_should_stop()) {
1667
1668 set_current_state(TASK_INTERRUPTIBLE);
1669
1670 /* check once a second */
1671 schedule_timeout(HZ);
1672 1340
1673 if (unlikely(ftrace_disabled)) 1341#else
1674 continue;
1675
1676 mutex_lock(&ftrace_sysctl_lock);
1677 mutex_lock(&ftraced_lock);
1678 if (!ftraced_suspend && !ftraced_stop &&
1679 ftrace_update_code()) {
1680 usecs = nsecs_to_usecs(ftrace_update_time);
1681 if (ftrace_update_tot_cnt > 100000) {
1682 ftrace_update_tot_cnt = 0;
1683 pr_info("hm, dftrace overflow: %lu change%s"
1684 " (%lu total) in %lu usec%s\n",
1685 ftrace_update_cnt,
1686 ftrace_update_cnt != 1 ? "s" : "",
1687 ftrace_update_tot_cnt,
1688 usecs, usecs != 1 ? "s" : "");
1689 ftrace_disabled = 1;
1690 WARN_ON_ONCE(1);
1691 }
1692 }
1693 mutex_unlock(&ftraced_lock);
1694 mutex_unlock(&ftrace_sysctl_lock);
1695
1696 ftrace_shutdown_replenish();
1697 }
1698 __set_current_state(TASK_RUNNING);
1699 return 0;
1700}
1701 1342
1702static int __init ftrace_dynamic_init(void) 1343static int __init ftrace_nodyn_init(void)
1703{ 1344{
1704 struct task_struct *p; 1345 ftrace_enabled = 1;
1705 unsigned long addr;
1706 int ret;
1707
1708 addr = (unsigned long)ftrace_record_ip;
1709
1710 stop_machine(ftrace_dyn_arch_init, &addr, NULL);
1711
1712 /* ftrace_dyn_arch_init places the return code in addr */
1713 if (addr) {
1714 ret = (int)addr;
1715 goto failed;
1716 }
1717
1718 ret = ftrace_dyn_table_alloc(NR_TO_INIT);
1719 if (ret)
1720 goto failed;
1721
1722 p = kthread_run(ftraced, NULL, "ftraced");
1723 if (IS_ERR(p)) {
1724 ret = -1;
1725 goto failed;
1726 }
1727
1728 last_ftrace_enabled = ftrace_enabled = 1;
1729 ftraced_task = p;
1730
1731 return 0; 1346 return 0;
1732
1733 failed:
1734 ftrace_disabled = 1;
1735 return ret;
1736} 1347}
1348device_initcall(ftrace_nodyn_init);
1737 1349
1738core_initcall(ftrace_dynamic_init);
1739#endif /* CONFIG_FTRACE_MCOUNT_RECORD */
1740
1741#else
1742# define ftrace_startup() do { } while (0) 1350# define ftrace_startup() do { } while (0)
1743# define ftrace_shutdown() do { } while (0) 1351# define ftrace_shutdown() do { } while (0)
1744# define ftrace_startup_sysctl() do { } while (0) 1352# define ftrace_startup_sysctl() do { } while (0)
1745# define ftrace_shutdown_sysctl() do { } while (0) 1353# define ftrace_shutdown_sysctl() do { } while (0)
1746# define ftrace_force_shutdown() do { } while (0)
1747#endif /* CONFIG_DYNAMIC_FTRACE */ 1354#endif /* CONFIG_DYNAMIC_FTRACE */
1748 1355
1749/** 1356/**
1750 * ftrace_kill_atomic - kill ftrace from critical sections 1357 * ftrace_kill - kill ftrace
1751 * 1358 *
1752 * This function should be used by panic code. It stops ftrace 1359 * This function should be used by panic code. It stops ftrace
1753 * but in a not so nice way. If you need to simply kill ftrace 1360 * but in a not so nice way. If you need to simply kill ftrace
1754 * from a non-atomic section, use ftrace_kill. 1361 * from a non-atomic section, use ftrace_kill.
1755 */ 1362 */
1756void ftrace_kill_atomic(void)
1757{
1758 ftrace_disabled = 1;
1759 ftrace_enabled = 0;
1760#ifdef CONFIG_DYNAMIC_FTRACE
1761 ftraced_suspend = -1;
1762#endif
1763 clear_ftrace_function();
1764}
1765
1766/**
1767 * ftrace_kill - totally shutdown ftrace
1768 *
1769 * This is a safety measure. If something was detected that seems
1770 * wrong, calling this function will keep ftrace from doing
1771 * any more modifications, and updates.
1772 * used when something went wrong.
1773 */
1774void ftrace_kill(void) 1363void ftrace_kill(void)
1775{ 1364{
1776 mutex_lock(&ftrace_sysctl_lock);
1777 ftrace_disabled = 1; 1365 ftrace_disabled = 1;
1778 ftrace_enabled = 0; 1366 ftrace_enabled = 0;
1779
1780 clear_ftrace_function(); 1367 clear_ftrace_function();
1781 mutex_unlock(&ftrace_sysctl_lock);
1782
1783 /* Try to totally disable ftrace */
1784 ftrace_force_shutdown();
1785} 1368}
1786 1369
1787/** 1370/**
@@ -1870,3 +1453,4 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
1870 mutex_unlock(&ftrace_sysctl_lock); 1453 mutex_unlock(&ftrace_sysctl_lock);
1871 return ret; 1454 return ret;
1872} 1455}
1456
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 94af1fe56bb4..cedf4e268285 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -130,7 +130,7 @@ struct buffer_page {
130static inline void free_buffer_page(struct buffer_page *bpage) 130static inline void free_buffer_page(struct buffer_page *bpage)
131{ 131{
132 if (bpage->page) 132 if (bpage->page)
133 __free_page(bpage->page); 133 free_page((unsigned long)bpage->page);
134 kfree(bpage); 134 kfree(bpage);
135} 135}
136 136
@@ -966,7 +966,9 @@ rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
966 if (unlikely(*delta > (1ULL << 59) && !once++)) { 966 if (unlikely(*delta > (1ULL << 59) && !once++)) {
967 printk(KERN_WARNING "Delta way too big! %llu" 967 printk(KERN_WARNING "Delta way too big! %llu"
968 " ts=%llu write stamp = %llu\n", 968 " ts=%llu write stamp = %llu\n",
969 *delta, *ts, cpu_buffer->write_stamp); 969 (unsigned long long)*delta,
970 (unsigned long long)*ts,
971 (unsigned long long)cpu_buffer->write_stamp);
970 WARN_ON(1); 972 WARN_ON(1);
971 } 973 }
972 974
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d345d649d073..8a499e2adaec 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -34,6 +34,7 @@
34 34
35#include <linux/stacktrace.h> 35#include <linux/stacktrace.h>
36#include <linux/ring_buffer.h> 36#include <linux/ring_buffer.h>
37#include <linux/irqflags.h>
37 38
38#include "trace.h" 39#include "trace.h"
39 40
@@ -655,7 +656,11 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
655 entry->preempt_count = pc & 0xff; 656 entry->preempt_count = pc & 0xff;
656 entry->pid = (tsk) ? tsk->pid : 0; 657 entry->pid = (tsk) ? tsk->pid : 0;
657 entry->flags = 658 entry->flags =
659#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
658 (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | 660 (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
661#else
662 TRACE_FLAG_IRQS_NOSUPPORT |
663#endif
659 ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | 664 ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
660 ((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) | 665 ((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
661 (need_resched() ? TRACE_FLAG_NEED_RESCHED : 0); 666 (need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
@@ -851,7 +856,7 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
851 preempt_enable_notrace(); 856 preempt_enable_notrace();
852} 857}
853 858
854#ifdef CONFIG_FTRACE 859#ifdef CONFIG_FUNCTION_TRACER
855static void 860static void
856function_trace_call(unsigned long ip, unsigned long parent_ip) 861function_trace_call(unsigned long ip, unsigned long parent_ip)
857{ 862{
@@ -865,9 +870,6 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
865 if (unlikely(!ftrace_function_enabled)) 870 if (unlikely(!ftrace_function_enabled))
866 return; 871 return;
867 872
868 if (skip_trace(ip))
869 return;
870
871 pc = preempt_count(); 873 pc = preempt_count();
872 resched = need_resched(); 874 resched = need_resched();
873 preempt_disable_notrace(); 875 preempt_disable_notrace();
@@ -1246,7 +1248,8 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
1246 trace_seq_printf(s, "%8.8s-%-5d ", comm, entry->pid); 1248 trace_seq_printf(s, "%8.8s-%-5d ", comm, entry->pid);
1247 trace_seq_printf(s, "%3d", cpu); 1249 trace_seq_printf(s, "%3d", cpu);
1248 trace_seq_printf(s, "%c%c", 1250 trace_seq_printf(s, "%c%c",
1249 (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : '.', 1251 (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' :
1252 (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' : '.',
1250 ((entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.')); 1253 ((entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.'));
1251 1254
1252 hardirq = entry->flags & TRACE_FLAG_HARDIRQ; 1255 hardirq = entry->flags & TRACE_FLAG_HARDIRQ;
@@ -2379,9 +2382,10 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
2379 int i; 2382 int i;
2380 size_t ret; 2383 size_t ret;
2381 2384
2385 ret = cnt;
2386
2382 if (cnt > max_tracer_type_len) 2387 if (cnt > max_tracer_type_len)
2383 cnt = max_tracer_type_len; 2388 cnt = max_tracer_type_len;
2384 ret = cnt;
2385 2389
2386 if (copy_from_user(&buf, ubuf, cnt)) 2390 if (copy_from_user(&buf, ubuf, cnt))
2387 return -EFAULT; 2391 return -EFAULT;
@@ -2414,8 +2418,8 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
2414 out: 2418 out:
2415 mutex_unlock(&trace_types_lock); 2419 mutex_unlock(&trace_types_lock);
2416 2420
2417 if (ret == cnt) 2421 if (ret > 0)
2418 filp->f_pos += cnt; 2422 filp->f_pos += ret;
2419 2423
2420 return ret; 2424 return ret;
2421} 2425}
@@ -3097,7 +3101,7 @@ void ftrace_dump(void)
3097 dump_ran = 1; 3101 dump_ran = 1;
3098 3102
3099 /* No turning back! */ 3103 /* No turning back! */
3100 ftrace_kill_atomic(); 3104 ftrace_kill();
3101 3105
3102 for_each_tracing_cpu(cpu) { 3106 for_each_tracing_cpu(cpu) {
3103 atomic_inc(&global_trace.data[cpu]->disabled); 3107 atomic_inc(&global_trace.data[cpu]->disabled);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index f1f99572cde7..8465ad052707 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -120,18 +120,20 @@ struct trace_boot {
120/* 120/*
121 * trace_flag_type is an enumeration that holds different 121 * trace_flag_type is an enumeration that holds different
122 * states when a trace occurs. These are: 122 * states when a trace occurs. These are:
123 * IRQS_OFF - interrupts were disabled 123 * IRQS_OFF - interrupts were disabled
124 * NEED_RESCED - reschedule is requested 124 * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags
125 * HARDIRQ - inside an interrupt handler 125 * NEED_RESCED - reschedule is requested
126 * SOFTIRQ - inside a softirq handler 126 * HARDIRQ - inside an interrupt handler
127 * CONT - multiple entries hold the trace item 127 * SOFTIRQ - inside a softirq handler
128 * CONT - multiple entries hold the trace item
128 */ 129 */
129enum trace_flag_type { 130enum trace_flag_type {
130 TRACE_FLAG_IRQS_OFF = 0x01, 131 TRACE_FLAG_IRQS_OFF = 0x01,
131 TRACE_FLAG_NEED_RESCHED = 0x02, 132 TRACE_FLAG_IRQS_NOSUPPORT = 0x02,
132 TRACE_FLAG_HARDIRQ = 0x04, 133 TRACE_FLAG_NEED_RESCHED = 0x04,
133 TRACE_FLAG_SOFTIRQ = 0x08, 134 TRACE_FLAG_HARDIRQ = 0x08,
134 TRACE_FLAG_CONT = 0x10, 135 TRACE_FLAG_SOFTIRQ = 0x10,
136 TRACE_FLAG_CONT = 0x20,
135}; 137};
136 138
137#define TRACE_BUF_SIZE 1024 139#define TRACE_BUF_SIZE 1024
@@ -335,7 +337,7 @@ void update_max_tr_single(struct trace_array *tr,
335 337
336extern cycle_t ftrace_now(int cpu); 338extern cycle_t ftrace_now(int cpu);
337 339
338#ifdef CONFIG_FTRACE 340#ifdef CONFIG_FUNCTION_TRACER
339void tracing_start_function_trace(void); 341void tracing_start_function_trace(void);
340void tracing_stop_function_trace(void); 342void tracing_stop_function_trace(void);
341#else 343#else
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index e90eb0c2c56c..0f85a64003d3 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -64,7 +64,7 @@ static void function_trace_ctrl_update(struct trace_array *tr)
64 64
65static struct tracer function_trace __read_mostly = 65static struct tracer function_trace __read_mostly =
66{ 66{
67 .name = "ftrace", 67 .name = "function",
68 .init = function_trace_init, 68 .init = function_trace_init,
69 .reset = function_trace_reset, 69 .reset = function_trace_reset,
70 .ctrl_update = function_trace_ctrl_update, 70 .ctrl_update = function_trace_ctrl_update,
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index a7db7f040ae0..9c74071c10e0 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -63,7 +63,7 @@ irq_trace(void)
63 */ 63 */
64static __cacheline_aligned_in_smp unsigned long max_sequence; 64static __cacheline_aligned_in_smp unsigned long max_sequence;
65 65
66#ifdef CONFIG_FTRACE 66#ifdef CONFIG_FUNCTION_TRACER
67/* 67/*
68 * irqsoff uses its own tracer function to keep the overhead down: 68 * irqsoff uses its own tracer function to keep the overhead down:
69 */ 69 */
@@ -104,7 +104,7 @@ static struct ftrace_ops trace_ops __read_mostly =
104{ 104{
105 .func = irqsoff_tracer_call, 105 .func = irqsoff_tracer_call,
106}; 106};
107#endif /* CONFIG_FTRACE */ 107#endif /* CONFIG_FUNCTION_TRACER */
108 108
109/* 109/*
110 * Should this new latency be reported/recorded? 110 * Should this new latency be reported/recorded?
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index fe4a252c2363..3ae93f16b565 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -31,7 +31,7 @@ static raw_spinlock_t wakeup_lock =
31 31
32static void __wakeup_reset(struct trace_array *tr); 32static void __wakeup_reset(struct trace_array *tr);
33 33
34#ifdef CONFIG_FTRACE 34#ifdef CONFIG_FUNCTION_TRACER
35/* 35/*
36 * irqsoff uses its own tracer function to keep the overhead down: 36 * irqsoff uses its own tracer function to keep the overhead down:
37 */ 37 */
@@ -96,7 +96,7 @@ static struct ftrace_ops trace_ops __read_mostly =
96{ 96{
97 .func = wakeup_tracer_call, 97 .func = wakeup_tracer_call,
98}; 98};
99#endif /* CONFIG_FTRACE */ 99#endif /* CONFIG_FUNCTION_TRACER */
100 100
101/* 101/*
102 * Should this new latency be reported/recorded? 102 * Should this new latency be reported/recorded?
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 09cf230d7eca..90bc752a7580 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -70,7 +70,7 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count)
70 return ret; 70 return ret;
71} 71}
72 72
73#ifdef CONFIG_FTRACE 73#ifdef CONFIG_FUNCTION_TRACER
74 74
75#ifdef CONFIG_DYNAMIC_FTRACE 75#ifdef CONFIG_DYNAMIC_FTRACE
76 76
@@ -99,13 +99,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
99 /* passed in by parameter to fool gcc from optimizing */ 99 /* passed in by parameter to fool gcc from optimizing */
100 func(); 100 func();
101 101
102 /* update the records */
103 ret = ftrace_force_update();
104 if (ret) {
105 printk(KERN_CONT ".. ftraced failed .. ");
106 return ret;
107 }
108
109 /* 102 /*
110 * Some archs *cough*PowerPC*cough* add charachters to the 103 * Some archs *cough*PowerPC*cough* add charachters to the
111 * start of the function names. We simply put a '*' to 104 * start of the function names. We simply put a '*' to
@@ -183,13 +176,6 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
183 /* make sure msleep has been recorded */ 176 /* make sure msleep has been recorded */
184 msleep(1); 177 msleep(1);
185 178
186 /* force the recorded functions to be traced */
187 ret = ftrace_force_update();
188 if (ret) {
189 printk(KERN_CONT ".. ftraced failed .. ");
190 return ret;
191 }
192
193 /* start the tracing */ 179 /* start the tracing */
194 ftrace_enabled = 1; 180 ftrace_enabled = 1;
195 tracer_enabled = 1; 181 tracer_enabled = 1;
@@ -226,7 +212,7 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
226 212
227 return ret; 213 return ret;
228} 214}
229#endif /* CONFIG_FTRACE */ 215#endif /* CONFIG_FUNCTION_TRACER */
230 216
231#ifdef CONFIG_IRQSOFF_TRACER 217#ifdef CONFIG_IRQSOFF_TRACER
232int 218int
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 74c5d9a3afae..be682b62fe58 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -44,6 +44,10 @@ static inline void check_stack(void)
44 if (this_size <= max_stack_size) 44 if (this_size <= max_stack_size)
45 return; 45 return;
46 46
47 /* we do not handle interrupt stacks yet */
48 if (!object_is_on_stack(&this_size))
49 return;
50
47 raw_local_irq_save(flags); 51 raw_local_irq_save(flags);
48 __raw_spin_lock(&max_stack_lock); 52 __raw_spin_lock(&max_stack_lock);
49 53
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index f2b7c28a4708..af8c85664882 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -131,6 +131,9 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe)
131 131
132 old = entry->funcs; 132 old = entry->funcs;
133 133
134 if (!old)
135 return NULL;
136
134 debug_print_probes(entry); 137 debug_print_probes(entry);
135 /* (N -> M), (N > 1, M >= 0) probes */ 138 /* (N -> M), (N > 1, M >= 0) probes */
136 for (nr_probes = 0; old[nr_probes]; nr_probes++) { 139 for (nr_probes = 0; old[nr_probes]; nr_probes++) {
@@ -388,6 +391,11 @@ int tracepoint_probe_unregister(const char *name, void *probe)
388 if (entry->rcu_pending) 391 if (entry->rcu_pending)
389 rcu_barrier_sched(); 392 rcu_barrier_sched();
390 old = tracepoint_entry_remove_probe(entry, probe); 393 old = tracepoint_entry_remove_probe(entry, probe);
394 if (!old) {
395 printk(KERN_WARNING "Warning: Trying to unregister a probe"
396 "that doesn't exist\n");
397 goto end;
398 }
391 mutex_unlock(&tracepoints_mutex); 399 mutex_unlock(&tracepoints_mutex);
392 tracepoint_update_probes(); /* may update entry */ 400 tracepoint_update_probes(); /* may update entry */
393 mutex_lock(&tracepoints_mutex); 401 mutex_lock(&tracepoints_mutex);
diff --git a/lib/Makefile b/lib/Makefile
index 16feaab057b2..7cb65d85aeb0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,7 +2,7 @@
2# Makefile for some libs needed in the kernel. 2# Makefile for some libs needed in the kernel.
3# 3#
4 4
5ifdef CONFIG_FTRACE 5ifdef CONFIG_FUNCTION_TRACER
6ORIG_CFLAGS := $(KBUILD_CFLAGS) 6ORIG_CFLAGS := $(KBUILD_CFLAGS)
7KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) 7KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
8endif 8endif
diff --git a/lib/dynamic_printk.c b/lib/dynamic_printk.c
index d640f87bdc9e..d83660fd6fdd 100644
--- a/lib/dynamic_printk.c
+++ b/lib/dynamic_printk.c
@@ -402,6 +402,8 @@ static int __init dynamic_printk_init(void)
402 iter->logical_modname, 402 iter->logical_modname,
403 iter->flag_names, iter->hash, iter->hash2); 403 iter->flag_names, iter->hash, iter->hash2);
404 } 404 }
405 if (dynamic_enabled == DYNAMIC_ENABLED_ALL)
406 set_all(true);
405 return 0; 407 return 0;
406} 408}
407module_init(dynamic_printk_init); 409module_init(dynamic_printk_init);
@@ -411,7 +413,7 @@ static int __init dynamic_printk_setup(char *str)
411{ 413{
412 if (str) 414 if (str)
413 return -ENOENT; 415 return -ENOENT;
414 set_all(true); 416 dynamic_enabled = DYNAMIC_ENABLED_ALL;
415 return 0; 417 return 0;
416} 418}
417/* Use early_param(), so we can get debug output as early as possible */ 419/* Use early_param(), so we can get debug output as early as possible */
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index f8eebd489149..78330c37a61b 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -497,8 +497,10 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
497 printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", 497 printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n",
498 (unsigned long long)*hwdev->dma_mask, 498 (unsigned long long)*hwdev->dma_mask,
499 (unsigned long long)dev_addr); 499 (unsigned long long)dev_addr);
500 panic("swiotlb_alloc_coherent: allocated memory is out of " 500
501 "range for device"); 501 /* DMA_TO_DEVICE to avoid memcpy in unmap_single */
502 unmap_single(hwdev, ret, size, DMA_TO_DEVICE);
503 return NULL;
502 } 504 }
503 *dma_handle = dev_addr; 505 *dma_handle = dev_addr;
504 return ret; 506 return ret;
diff --git a/mm/filemap.c b/mm/filemap.c
index ab8553658af3..f3e5f8944d17 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2029,48 +2029,8 @@ int pagecache_write_begin(struct file *file, struct address_space *mapping,
2029{ 2029{
2030 const struct address_space_operations *aops = mapping->a_ops; 2030 const struct address_space_operations *aops = mapping->a_ops;
2031 2031
2032 if (aops->write_begin) { 2032 return aops->write_begin(file, mapping, pos, len, flags,
2033 return aops->write_begin(file, mapping, pos, len, flags,
2034 pagep, fsdata); 2033 pagep, fsdata);
2035 } else {
2036 int ret;
2037 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
2038 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
2039 struct inode *inode = mapping->host;
2040 struct page *page;
2041again:
2042 page = __grab_cache_page(mapping, index);
2043 *pagep = page;
2044 if (!page)
2045 return -ENOMEM;
2046
2047 if (flags & AOP_FLAG_UNINTERRUPTIBLE && !PageUptodate(page)) {
2048 /*
2049 * There is no way to resolve a short write situation
2050 * for a !Uptodate page (except by double copying in
2051 * the caller done by generic_perform_write_2copy).
2052 *
2053 * Instead, we have to bring it uptodate here.
2054 */
2055 ret = aops->readpage(file, page);
2056 page_cache_release(page);
2057 if (ret) {
2058 if (ret == AOP_TRUNCATED_PAGE)
2059 goto again;
2060 return ret;
2061 }
2062 goto again;
2063 }
2064
2065 ret = aops->prepare_write(file, page, offset, offset+len);
2066 if (ret) {
2067 unlock_page(page);
2068 page_cache_release(page);
2069 if (pos + len > inode->i_size)
2070 vmtruncate(inode, inode->i_size);
2071 }
2072 return ret;
2073 }
2074} 2034}
2075EXPORT_SYMBOL(pagecache_write_begin); 2035EXPORT_SYMBOL(pagecache_write_begin);
2076 2036
@@ -2079,32 +2039,9 @@ int pagecache_write_end(struct file *file, struct address_space *mapping,
2079 struct page *page, void *fsdata) 2039 struct page *page, void *fsdata)
2080{ 2040{
2081 const struct address_space_operations *aops = mapping->a_ops; 2041 const struct address_space_operations *aops = mapping->a_ops;
2082 int ret;
2083
2084 if (aops->write_end) {
2085 mark_page_accessed(page);
2086 ret = aops->write_end(file, mapping, pos, len, copied,
2087 page, fsdata);
2088 } else {
2089 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
2090 struct inode *inode = mapping->host;
2091
2092 flush_dcache_page(page);
2093 ret = aops->commit_write(file, page, offset, offset+len);
2094 unlock_page(page);
2095 mark_page_accessed(page);
2096 page_cache_release(page);
2097
2098 if (ret < 0) {
2099 if (pos + len > inode->i_size)
2100 vmtruncate(inode, inode->i_size);
2101 } else if (ret > 0)
2102 ret = min_t(size_t, copied, ret);
2103 else
2104 ret = copied;
2105 }
2106 2042
2107 return ret; 2043 mark_page_accessed(page);
2044 return aops->write_end(file, mapping, pos, len, copied, page, fsdata);
2108} 2045}
2109EXPORT_SYMBOL(pagecache_write_end); 2046EXPORT_SYMBOL(pagecache_write_end);
2110 2047
@@ -2226,174 +2163,6 @@ repeat:
2226} 2163}
2227EXPORT_SYMBOL(__grab_cache_page); 2164EXPORT_SYMBOL(__grab_cache_page);
2228 2165
2229static ssize_t generic_perform_write_2copy(struct file *file,
2230 struct iov_iter *i, loff_t pos)
2231{
2232 struct address_space *mapping = file->f_mapping;
2233 const struct address_space_operations *a_ops = mapping->a_ops;
2234 struct inode *inode = mapping->host;
2235 long status = 0;
2236 ssize_t written = 0;
2237
2238 do {
2239 struct page *src_page;
2240 struct page *page;
2241 pgoff_t index; /* Pagecache index for current page */
2242 unsigned long offset; /* Offset into pagecache page */
2243 unsigned long bytes; /* Bytes to write to page */
2244 size_t copied; /* Bytes copied from user */
2245
2246 offset = (pos & (PAGE_CACHE_SIZE - 1));
2247 index = pos >> PAGE_CACHE_SHIFT;
2248 bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
2249 iov_iter_count(i));
2250
2251 /*
2252 * a non-NULL src_page indicates that we're doing the
2253 * copy via get_user_pages and kmap.
2254 */
2255 src_page = NULL;
2256
2257 /*
2258 * Bring in the user page that we will copy from _first_.
2259 * Otherwise there's a nasty deadlock on copying from the
2260 * same page as we're writing to, without it being marked
2261 * up-to-date.
2262 *
2263 * Not only is this an optimisation, but it is also required
2264 * to check that the address is actually valid, when atomic
2265 * usercopies are used, below.
2266 */
2267 if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
2268 status = -EFAULT;
2269 break;
2270 }
2271
2272 page = __grab_cache_page(mapping, index);
2273 if (!page) {
2274 status = -ENOMEM;
2275 break;
2276 }
2277
2278 /*
2279 * non-uptodate pages cannot cope with short copies, and we
2280 * cannot take a pagefault with the destination page locked.
2281 * So pin the source page to copy it.
2282 */
2283 if (!PageUptodate(page) && !segment_eq(get_fs(), KERNEL_DS)) {
2284 unlock_page(page);
2285
2286 src_page = alloc_page(GFP_KERNEL);
2287 if (!src_page) {
2288 page_cache_release(page);
2289 status = -ENOMEM;
2290 break;
2291 }
2292
2293 /*
2294 * Cannot get_user_pages with a page locked for the
2295 * same reason as we can't take a page fault with a
2296 * page locked (as explained below).
2297 */
2298 copied = iov_iter_copy_from_user(src_page, i,
2299 offset, bytes);
2300 if (unlikely(copied == 0)) {
2301 status = -EFAULT;
2302 page_cache_release(page);
2303 page_cache_release(src_page);
2304 break;
2305 }
2306 bytes = copied;
2307
2308 lock_page(page);
2309 /*
2310 * Can't handle the page going uptodate here, because
2311 * that means we would use non-atomic usercopies, which
2312 * zero out the tail of the page, which can cause
2313 * zeroes to become transiently visible. We could just
2314 * use a non-zeroing copy, but the APIs aren't too
2315 * consistent.
2316 */
2317 if (unlikely(!page->mapping || PageUptodate(page))) {
2318 unlock_page(page);
2319 page_cache_release(page);
2320 page_cache_release(src_page);
2321 continue;
2322 }
2323 }
2324
2325 status = a_ops->prepare_write(file, page, offset, offset+bytes);
2326 if (unlikely(status))
2327 goto fs_write_aop_error;
2328
2329 if (!src_page) {
2330 /*
2331 * Must not enter the pagefault handler here, because
2332 * we hold the page lock, so we might recursively
2333 * deadlock on the same lock, or get an ABBA deadlock
2334 * against a different lock, or against the mmap_sem
2335 * (which nests outside the page lock). So increment
2336 * preempt count, and use _atomic usercopies.
2337 *
2338 * The page is uptodate so we are OK to encounter a
2339 * short copy: if unmodified parts of the page are
2340 * marked dirty and written out to disk, it doesn't
2341 * really matter.
2342 */
2343 pagefault_disable();
2344 copied = iov_iter_copy_from_user_atomic(page, i,
2345 offset, bytes);
2346 pagefault_enable();
2347 } else {
2348 void *src, *dst;
2349 src = kmap_atomic(src_page, KM_USER0);
2350 dst = kmap_atomic(page, KM_USER1);
2351 memcpy(dst + offset, src + offset, bytes);
2352 kunmap_atomic(dst, KM_USER1);
2353 kunmap_atomic(src, KM_USER0);
2354 copied = bytes;
2355 }
2356 flush_dcache_page(page);
2357
2358 status = a_ops->commit_write(file, page, offset, offset+bytes);
2359 if (unlikely(status < 0))
2360 goto fs_write_aop_error;
2361 if (unlikely(status > 0)) /* filesystem did partial write */
2362 copied = min_t(size_t, copied, status);
2363
2364 unlock_page(page);
2365 mark_page_accessed(page);
2366 page_cache_release(page);
2367 if (src_page)
2368 page_cache_release(src_page);
2369
2370 iov_iter_advance(i, copied);
2371 pos += copied;
2372 written += copied;
2373
2374 balance_dirty_pages_ratelimited(mapping);
2375 cond_resched();
2376 continue;
2377
2378fs_write_aop_error:
2379 unlock_page(page);
2380 page_cache_release(page);
2381 if (src_page)
2382 page_cache_release(src_page);
2383
2384 /*
2385 * prepare_write() may have instantiated a few blocks
2386 * outside i_size. Trim these off again. Don't need
2387 * i_size_read because we hold i_mutex.
2388 */
2389 if (pos + bytes > inode->i_size)
2390 vmtruncate(inode, inode->i_size);
2391 break;
2392 } while (iov_iter_count(i));
2393
2394 return written ? written : status;
2395}
2396
2397static ssize_t generic_perform_write(struct file *file, 2166static ssize_t generic_perform_write(struct file *file,
2398 struct iov_iter *i, loff_t pos) 2167 struct iov_iter *i, loff_t pos)
2399{ 2168{
@@ -2494,10 +2263,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
2494 struct iov_iter i; 2263 struct iov_iter i;
2495 2264
2496 iov_iter_init(&i, iov, nr_segs, count, written); 2265 iov_iter_init(&i, iov, nr_segs, count, written);
2497 if (a_ops->write_begin) 2266 status = generic_perform_write(file, &i, pos);
2498 status = generic_perform_write(file, &i, pos);
2499 else
2500 status = generic_perform_write_2copy(file, &i, pos);
2501 2267
2502 if (likely(status >= 0)) { 2268 if (likely(status >= 0)) {
2503 written += status; 2269 written += status;
diff --git a/mm/mmap.c b/mm/mmap.c
index 74f4d158022e..de14ac21e5b5 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -175,7 +175,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
175 175
176 /* Don't let a single process grow too big: 176 /* Don't let a single process grow too big:
177 leave 3% of the size of this process for other processes */ 177 leave 3% of the size of this process for other processes */
178 allowed -= mm->total_vm / 32; 178 if (mm)
179 allowed -= mm->total_vm / 32;
179 180
180 /* 181 /*
181 * cast `allowed' as a signed long because vm_committed_space 182 * cast `allowed' as a signed long because vm_committed_space
diff --git a/mm/nommu.c b/mm/nommu.c
index 2696b24f2bb3..7695dc850785 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1454,7 +1454,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
1454 1454
1455 /* Don't let a single process grow too big: 1455 /* Don't let a single process grow too big:
1456 leave 3% of the size of this process for other processes */ 1456 leave 3% of the size of this process for other processes */
1457 allowed -= current->mm->total_vm / 32; 1457 if (mm)
1458 allowed -= mm->total_vm / 32;
1458 1459
1459 /* 1460 /*
1460 * cast `allowed' as a signed long because vm_committed_space 1461 * cast `allowed' as a signed long because vm_committed_space
diff --git a/mm/shmem.c b/mm/shmem.c
index d38d7e61fcd0..0ed075215e5f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -161,8 +161,8 @@ static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb)
161 */ 161 */
162static inline int shmem_acct_size(unsigned long flags, loff_t size) 162static inline int shmem_acct_size(unsigned long flags, loff_t size)
163{ 163{
164 return (flags & VM_ACCOUNT)? 164 return (flags & VM_ACCOUNT) ?
165 security_vm_enough_memory(VM_ACCT(size)): 0; 165 security_vm_enough_memory_kern(VM_ACCT(size)) : 0;
166} 166}
167 167
168static inline void shmem_unacct_size(unsigned long flags, loff_t size) 168static inline void shmem_unacct_size(unsigned long flags, loff_t size)
@@ -179,8 +179,8 @@ static inline void shmem_unacct_size(unsigned long flags, loff_t size)
179 */ 179 */
180static inline int shmem_acct_block(unsigned long flags) 180static inline int shmem_acct_block(unsigned long flags)
181{ 181{
182 return (flags & VM_ACCOUNT)? 182 return (flags & VM_ACCOUNT) ?
183 0: security_vm_enough_memory(VM_ACCT(PAGE_CACHE_SIZE)); 183 0 : security_vm_enough_memory_kern(VM_ACCT(PAGE_CACHE_SIZE));
184} 184}
185 185
186static inline void shmem_unacct_blocks(unsigned long flags, long pages) 186static inline void shmem_unacct_blocks(unsigned long flags, long pages)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 036536945dd9..f1cc03bbf6ac 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -897,7 +897,8 @@ EXPORT_SYMBOL(vm_unmap_ram);
897 * @count: number of pages 897 * @count: number of pages
898 * @node: prefer to allocate data structures on this node 898 * @node: prefer to allocate data structures on this node
899 * @prot: memory protection to use. PAGE_KERNEL for regular RAM 899 * @prot: memory protection to use. PAGE_KERNEL for regular RAM
900 * @returns: a pointer to the address that has been mapped, or NULL on failure 900 *
901 * Returns: a pointer to the address that has been mapped, or %NULL on failure
901 */ 902 */
902void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot) 903void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot)
903{ 904{
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 861b4cbf40db..55cffad2f328 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -324,6 +324,38 @@ void unregister_pernet_subsys(struct pernet_operations *module)
324} 324}
325EXPORT_SYMBOL_GPL(unregister_pernet_subsys); 325EXPORT_SYMBOL_GPL(unregister_pernet_subsys);
326 326
327int register_pernet_gen_subsys(int *id, struct pernet_operations *ops)
328{
329 int rv;
330
331 mutex_lock(&net_mutex);
332again:
333 rv = ida_get_new_above(&net_generic_ids, 1, id);
334 if (rv < 0) {
335 if (rv == -EAGAIN) {
336 ida_pre_get(&net_generic_ids, GFP_KERNEL);
337 goto again;
338 }
339 goto out;
340 }
341 rv = register_pernet_operations(first_device, ops);
342 if (rv < 0)
343 ida_remove(&net_generic_ids, *id);
344 mutex_unlock(&net_mutex);
345out:
346 return rv;
347}
348EXPORT_SYMBOL_GPL(register_pernet_gen_subsys);
349
350void unregister_pernet_gen_subsys(int id, struct pernet_operations *ops)
351{
352 mutex_lock(&net_mutex);
353 unregister_pernet_operations(ops);
354 ida_remove(&net_generic_ids, id);
355 mutex_unlock(&net_mutex);
356}
357EXPORT_SYMBOL_GPL(unregister_pernet_gen_subsys);
358
327/** 359/**
328 * register_pernet_device - register a network namespace device 360 * register_pernet_device - register a network namespace device
329 * @ops: pernet operations structure for the subsystem 361 * @ops: pernet operations structure for the subsystem
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 18dd83c2ead0..fa4973bf73e9 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1972,28 +1972,27 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1972 1972
1973 /* make sure that we don't pick a non-existing transmit queue */ 1973 /* make sure that we don't pick a non-existing transmit queue */
1974 ntxq = pkt_dev->odev->real_num_tx_queues; 1974 ntxq = pkt_dev->odev->real_num_tx_queues;
1975 if (ntxq <= num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) { 1975 if (ntxq > num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) {
1976 printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU " 1976 printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU "
1977 "disabled because CPU count (%d) exceeds number ", 1977 "disabled because CPU count (%d) exceeds number "
1978 num_online_cpus()); 1978 "of tx queues (%d) on %s\n", num_online_cpus(), ntxq,
1979 printk(KERN_WARNING "pktgen: WARNING: of tx queues " 1979 pkt_dev->odev->name);
1980 "(%d) on %s \n", ntxq, pkt_dev->odev->name);
1981 pkt_dev->flags &= ~F_QUEUE_MAP_CPU; 1980 pkt_dev->flags &= ~F_QUEUE_MAP_CPU;
1982 } 1981 }
1983 if (ntxq <= pkt_dev->queue_map_min) { 1982 if (ntxq <= pkt_dev->queue_map_min) {
1984 printk(KERN_WARNING "pktgen: WARNING: Requested " 1983 printk(KERN_WARNING "pktgen: WARNING: Requested "
1985 "queue_map_min (%d) exceeds number of tx\n", 1984 "queue_map_min (zero-based) (%d) exceeds valid range "
1986 pkt_dev->queue_map_min); 1985 "[0 - %d] for (%d) queues on %s, resetting\n",
1987 printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " 1986 pkt_dev->queue_map_min, (ntxq ?: 1)- 1, ntxq,
1988 "%s, resetting\n", ntxq, pkt_dev->odev->name); 1987 pkt_dev->odev->name);
1989 pkt_dev->queue_map_min = ntxq - 1; 1988 pkt_dev->queue_map_min = ntxq - 1;
1990 } 1989 }
1991 if (ntxq <= pkt_dev->queue_map_max) { 1990 if (pkt_dev->queue_map_max >= ntxq) {
1992 printk(KERN_WARNING "pktgen: WARNING: Requested " 1991 printk(KERN_WARNING "pktgen: WARNING: Requested "
1993 "queue_map_max (%d) exceeds number of tx\n", 1992 "queue_map_max (zero-based) (%d) exceeds valid range "
1994 pkt_dev->queue_map_max); 1993 "[0 - %d] for (%d) queues on %s, resetting\n",
1995 printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " 1994 pkt_dev->queue_map_max, (ntxq ?: 1)- 1, ntxq,
1996 "%s, resetting\n", ntxq, pkt_dev->odev->name); 1995 pkt_dev->odev->name);
1997 pkt_dev->queue_map_max = ntxq - 1; 1996 pkt_dev->queue_map_max = ntxq - 1;
1998 } 1997 }
1999 1998
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 4bcec7f77251..e52799047a5f 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -2062,9 +2062,10 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb,
2062 u32 opt_len; 2062 u32 opt_len;
2063 int len_delta; 2063 int len_delta;
2064 2064
2065 buf_len = cipso_v4_genopt(buf, buf_len, doi_def, secattr); 2065 ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
2066 if (buf_len < 0) 2066 if (ret_val < 0)
2067 return buf_len; 2067 return ret_val;
2068 buf_len = ret_val;
2068 opt_len = (buf_len + 3) & ~3; 2069 opt_len = (buf_len + 3) & ~3;
2069 2070
2070 /* we overwrite any existing options to ensure that we have enough 2071 /* we overwrite any existing options to ensure that we have enough
diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c
index 0b024cd6b809..98f480708050 100644
--- a/net/mac80211/rc80211_minstrel_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_debugfs.c
@@ -94,8 +94,8 @@ minstrel_stats_open(struct inode *inode, struct file *file)
94 prob / 10, prob % 10, 94 prob / 10, prob % 10,
95 mr->last_success, 95 mr->last_success,
96 mr->last_attempts, 96 mr->last_attempts,
97 mr->succ_hist, 97 (unsigned long long)mr->succ_hist,
98 mr->att_hist); 98 (unsigned long long)mr->att_hist);
99 } 99 }
100 p += sprintf(p, "\nTotal packet count:: ideal %d " 100 p += sprintf(p, "\nTotal packet count:: ideal %d "
101 "lookaround %d\n\n", 101 "lookaround %d\n\n",
@@ -106,7 +106,7 @@ minstrel_stats_open(struct inode *inode, struct file *file)
106 return 0; 106 return 0;
107} 107}
108 108
109static int 109static ssize_t
110minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *o) 110minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *o)
111{ 111{
112 struct minstrel_stats_info *ms; 112 struct minstrel_stats_info *ms;
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index a2cdbcbf64c4..4ab62ad85dd4 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -335,7 +335,7 @@ static int __init nf_ct_proto_gre_init(void)
335 rv = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_gre4); 335 rv = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_gre4);
336 if (rv < 0) 336 if (rv < 0)
337 return rv; 337 return rv;
338 rv = register_pernet_gen_device(&proto_gre_net_id, &proto_gre_net_ops); 338 rv = register_pernet_gen_subsys(&proto_gre_net_id, &proto_gre_net_ops);
339 if (rv < 0) 339 if (rv < 0)
340 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); 340 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4);
341 return rv; 341 return rv;
@@ -344,7 +344,7 @@ static int __init nf_ct_proto_gre_init(void)
344static void nf_ct_proto_gre_fini(void) 344static void nf_ct_proto_gre_fini(void)
345{ 345{
346 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); 346 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4);
347 unregister_pernet_gen_device(proto_gre_net_id, &proto_gre_net_ops); 347 unregister_pernet_gen_subsys(proto_gre_net_id, &proto_gre_net_ops);
348} 348}
349 349
350module_init(nf_ct_proto_gre_init); 350module_init(nf_ct_proto_gre_init);
diff --git a/net/netlabel/netlabel_addrlist.c b/net/netlabel/netlabel_addrlist.c
index 8b1c58b0820c..2fc49e56c5a7 100644
--- a/net/netlabel/netlabel_addrlist.c
+++ b/net/netlabel/netlabel_addrlist.c
@@ -315,6 +315,7 @@ struct netlbl_af6list *netlbl_af6list_remove(const struct in6_addr *addr,
315 * Audit Helper Functions 315 * Audit Helper Functions
316 */ 316 */
317 317
318#ifdef CONFIG_AUDIT
318/** 319/**
319 * netlbl_af4list_audit_addr - Audit an IPv4 address 320 * netlbl_af4list_audit_addr - Audit an IPv4 address
320 * @audit_buf: audit buffer 321 * @audit_buf: audit buffer
@@ -386,3 +387,4 @@ void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf,
386 } 387 }
387} 388}
388#endif /* IPv6 */ 389#endif /* IPv6 */
390#endif /* CONFIG_AUDIT */
diff --git a/net/netlabel/netlabel_addrlist.h b/net/netlabel/netlabel_addrlist.h
index 0242bead405f..07ae7fd82be1 100644
--- a/net/netlabel/netlabel_addrlist.h
+++ b/net/netlabel/netlabel_addrlist.h
@@ -120,9 +120,19 @@ struct netlbl_af4list *netlbl_af4list_search(__be32 addr,
120struct netlbl_af4list *netlbl_af4list_search_exact(__be32 addr, 120struct netlbl_af4list *netlbl_af4list_search_exact(__be32 addr,
121 __be32 mask, 121 __be32 mask,
122 struct list_head *head); 122 struct list_head *head);
123
124#ifdef CONFIG_AUDIT
123void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf, 125void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf,
124 int src, const char *dev, 126 int src, const char *dev,
125 __be32 addr, __be32 mask); 127 __be32 addr, __be32 mask);
128#else
129static inline void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf,
130 int src, const char *dev,
131 __be32 addr, __be32 mask)
132{
133 return;
134}
135#endif
126 136
127#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 137#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
128 138
@@ -179,11 +189,23 @@ struct netlbl_af6list *netlbl_af6list_search(const struct in6_addr *addr,
179struct netlbl_af6list *netlbl_af6list_search_exact(const struct in6_addr *addr, 189struct netlbl_af6list *netlbl_af6list_search_exact(const struct in6_addr *addr,
180 const struct in6_addr *mask, 190 const struct in6_addr *mask,
181 struct list_head *head); 191 struct list_head *head);
192
193#ifdef CONFIG_AUDIT
182void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf, 194void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf,
183 int src, 195 int src,
184 const char *dev, 196 const char *dev,
185 const struct in6_addr *addr, 197 const struct in6_addr *addr,
186 const struct in6_addr *mask); 198 const struct in6_addr *mask);
199#else
200static inline void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf,
201 int src,
202 const char *dev,
203 const struct in6_addr *addr,
204 const struct in6_addr *mask)
205{
206 return;
207}
208#endif
187#endif /* IPV6 */ 209#endif /* IPV6 */
188 210
189#endif 211#endif
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index ee769ecaa13c..0a0ef17b2a40 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -265,7 +265,7 @@ add_failure:
265static int netlbl_mgmt_listentry(struct sk_buff *skb, 265static int netlbl_mgmt_listentry(struct sk_buff *skb,
266 struct netlbl_dom_map *entry) 266 struct netlbl_dom_map *entry)
267{ 267{
268 int ret_val; 268 int ret_val = 0;
269 struct nlattr *nla_a; 269 struct nlattr *nla_a;
270 struct nlattr *nla_b; 270 struct nlattr *nla_b;
271 struct netlbl_af4list *iter4; 271 struct netlbl_af4list *iter4;
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index 21124ec0a73d..bfdade72e066 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -256,6 +256,11 @@ static struct input_handler rfkill_handler = {
256 256
257static int __init rfkill_handler_init(void) 257static int __init rfkill_handler_init(void)
258{ 258{
259 unsigned long last_run = jiffies - msecs_to_jiffies(500);
260 rfkill_wlan.last = last_run;
261 rfkill_bt.last = last_run;
262 rfkill_uwb.last = last_run;
263 rfkill_wimax.last = last_run;
259 return input_register_handler(&rfkill_handler); 264 return input_register_handler(&rfkill_handler);
260} 265}
261 266
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 436bf1b4b76c..cb216b2df666 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -228,19 +228,21 @@ static int
228rpcauth_prune_expired(struct list_head *free, int nr_to_scan) 228rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
229{ 229{
230 spinlock_t *cache_lock; 230 spinlock_t *cache_lock;
231 struct rpc_cred *cred; 231 struct rpc_cred *cred, *next;
232 unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM; 232 unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM;
233 233
234 while (!list_empty(&cred_unused)) { 234 list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) {
235 cred = list_entry(cred_unused.next, struct rpc_cred, cr_lru); 235
236 /* Enforce a 60 second garbage collection moratorium */
237 if (time_in_range(cred->cr_expire, expired, jiffies) &&
238 test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0)
239 continue;
240
236 list_del_init(&cred->cr_lru); 241 list_del_init(&cred->cr_lru);
237 number_cred_unused--; 242 number_cred_unused--;
238 if (atomic_read(&cred->cr_count) != 0) 243 if (atomic_read(&cred->cr_count) != 0)
239 continue; 244 continue;
240 /* Enforce a 5 second garbage collection moratorium */ 245
241 if (time_in_range(cred->cr_expire, expired, jiffies) &&
242 test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0)
243 continue;
244 cache_lock = &cred->cr_auth->au_credcache->lock; 246 cache_lock = &cred->cr_auth->au_credcache->lock;
245 spin_lock(cache_lock); 247 spin_lock(cache_lock);
246 if (atomic_read(&cred->cr_count) == 0) { 248 if (atomic_read(&cred->cr_count) == 0) {
@@ -453,7 +455,7 @@ need_lock:
453 } 455 }
454 if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0) 456 if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0)
455 rpcauth_unhash_cred(cred); 457 rpcauth_unhash_cred(cred);
456 else if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { 458 if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) {
457 cred->cr_expire = jiffies; 459 cred->cr_expire = jiffies;
458 list_add_tail(&cred->cr_lru, &cred_unused); 460 list_add_tail(&cred->cr_lru, &cred_unused);
459 number_cred_unused++; 461 number_cred_unused++;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index f9ce3c9949d5..82a9b6286dd3 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -249,6 +249,7 @@ struct sock_xprt {
249 void (*old_data_ready)(struct sock *, int); 249 void (*old_data_ready)(struct sock *, int);
250 void (*old_state_change)(struct sock *); 250 void (*old_state_change)(struct sock *);
251 void (*old_write_space)(struct sock *); 251 void (*old_write_space)(struct sock *);
252 void (*old_error_report)(struct sock *);
252}; 253};
253 254
254/* 255/*
@@ -696,8 +697,9 @@ static int xs_tcp_send_request(struct rpc_task *task)
696 case -EAGAIN: 697 case -EAGAIN:
697 xs_nospace(task); 698 xs_nospace(task);
698 break; 699 break;
699 case -ECONNREFUSED:
700 case -ECONNRESET: 700 case -ECONNRESET:
701 xs_tcp_shutdown(xprt);
702 case -ECONNREFUSED:
701 case -ENOTCONN: 703 case -ENOTCONN:
702 case -EPIPE: 704 case -EPIPE:
703 status = -ENOTCONN; 705 status = -ENOTCONN;
@@ -740,6 +742,22 @@ out_release:
740 xprt_release_xprt(xprt, task); 742 xprt_release_xprt(xprt, task);
741} 743}
742 744
745static void xs_save_old_callbacks(struct sock_xprt *transport, struct sock *sk)
746{
747 transport->old_data_ready = sk->sk_data_ready;
748 transport->old_state_change = sk->sk_state_change;
749 transport->old_write_space = sk->sk_write_space;
750 transport->old_error_report = sk->sk_error_report;
751}
752
753static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk)
754{
755 sk->sk_data_ready = transport->old_data_ready;
756 sk->sk_state_change = transport->old_state_change;
757 sk->sk_write_space = transport->old_write_space;
758 sk->sk_error_report = transport->old_error_report;
759}
760
743/** 761/**
744 * xs_close - close a socket 762 * xs_close - close a socket
745 * @xprt: transport 763 * @xprt: transport
@@ -763,9 +781,8 @@ static void xs_close(struct rpc_xprt *xprt)
763 transport->sock = NULL; 781 transport->sock = NULL;
764 782
765 sk->sk_user_data = NULL; 783 sk->sk_user_data = NULL;
766 sk->sk_data_ready = transport->old_data_ready; 784
767 sk->sk_state_change = transport->old_state_change; 785 xs_restore_old_callbacks(transport, sk);
768 sk->sk_write_space = transport->old_write_space;
769 write_unlock_bh(&sk->sk_callback_lock); 786 write_unlock_bh(&sk->sk_callback_lock);
770 787
771 sk->sk_no_check = 0; 788 sk->sk_no_check = 0;
@@ -1178,6 +1195,28 @@ static void xs_tcp_state_change(struct sock *sk)
1178} 1195}
1179 1196
1180/** 1197/**
1198 * xs_tcp_error_report - callback mainly for catching RST events
1199 * @sk: socket
1200 */
1201static void xs_tcp_error_report(struct sock *sk)
1202{
1203 struct rpc_xprt *xprt;
1204
1205 read_lock(&sk->sk_callback_lock);
1206 if (sk->sk_err != ECONNRESET || sk->sk_state != TCP_ESTABLISHED)
1207 goto out;
1208 if (!(xprt = xprt_from_sock(sk)))
1209 goto out;
1210 dprintk("RPC: %s client %p...\n"
1211 "RPC: error %d\n",
1212 __func__, xprt, sk->sk_err);
1213
1214 xprt_force_disconnect(xprt);
1215out:
1216 read_unlock(&sk->sk_callback_lock);
1217}
1218
1219/**
1181 * xs_udp_write_space - callback invoked when socket buffer space 1220 * xs_udp_write_space - callback invoked when socket buffer space
1182 * becomes available 1221 * becomes available
1183 * @sk: socket whose state has changed 1222 * @sk: socket whose state has changed
@@ -1452,10 +1491,9 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1452 1491
1453 write_lock_bh(&sk->sk_callback_lock); 1492 write_lock_bh(&sk->sk_callback_lock);
1454 1493
1494 xs_save_old_callbacks(transport, sk);
1495
1455 sk->sk_user_data = xprt; 1496 sk->sk_user_data = xprt;
1456 transport->old_data_ready = sk->sk_data_ready;
1457 transport->old_state_change = sk->sk_state_change;
1458 transport->old_write_space = sk->sk_write_space;
1459 sk->sk_data_ready = xs_udp_data_ready; 1497 sk->sk_data_ready = xs_udp_data_ready;
1460 sk->sk_write_space = xs_udp_write_space; 1498 sk->sk_write_space = xs_udp_write_space;
1461 sk->sk_no_check = UDP_CSUM_NORCV; 1499 sk->sk_no_check = UDP_CSUM_NORCV;
@@ -1587,13 +1625,13 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1587 1625
1588 write_lock_bh(&sk->sk_callback_lock); 1626 write_lock_bh(&sk->sk_callback_lock);
1589 1627
1628 xs_save_old_callbacks(transport, sk);
1629
1590 sk->sk_user_data = xprt; 1630 sk->sk_user_data = xprt;
1591 transport->old_data_ready = sk->sk_data_ready;
1592 transport->old_state_change = sk->sk_state_change;
1593 transport->old_write_space = sk->sk_write_space;
1594 sk->sk_data_ready = xs_tcp_data_ready; 1631 sk->sk_data_ready = xs_tcp_data_ready;
1595 sk->sk_state_change = xs_tcp_state_change; 1632 sk->sk_state_change = xs_tcp_state_change;
1596 sk->sk_write_space = xs_tcp_write_space; 1633 sk->sk_write_space = xs_tcp_write_space;
1634 sk->sk_error_report = xs_tcp_error_report;
1597 sk->sk_allocation = GFP_ATOMIC; 1635 sk->sk_allocation = GFP_ATOMIC;
1598 1636
1599 /* socket options */ 1637 /* socket options */
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 80b13eea30e7..9d88c3df804a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1251,6 +1251,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl,
1251 -EINVAL : -EAGAIN); 1251 -EINVAL : -EAGAIN);
1252 xfrm_state_put(x); 1252 xfrm_state_put(x);
1253 } 1253 }
1254 else if (error == -ESRCH)
1255 error = -EAGAIN;
1254 1256
1255 if (!tmpl->optional) 1257 if (!tmpl->optional)
1256 goto fail; 1258 goto fail;
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5ed4cbf1e0e1..468fbc9016c7 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -198,10 +198,16 @@ cmd_modversions = \
198 fi; 198 fi;
199endif 199endif
200 200
201ifdef CONFIG_64BIT
202arch_bits = 64
203else
204arch_bits = 32
205endif
206
201ifdef CONFIG_FTRACE_MCOUNT_RECORD 207ifdef CONFIG_FTRACE_MCOUNT_RECORD
202cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \ 208cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \
203 "$(ARCH)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" \ 209 "$(ARCH)" "$(arch_bits)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" \
204 "$(MV)" "$(@)"; 210 "$(NM)" "$(RM)" "$(MV)" "$(@)";
205endif 211endif
206 212
207define rule_cc_o_c 213define rule_cc_o_c
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 9ee9783aea57..f4053dc7b5d6 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -82,7 +82,7 @@ modpost = scripts/mod/modpost \
82 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ 82 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
83 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ 83 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
84 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 84 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
85 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \ 85 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
86 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 86 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
87 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 87 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
88 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ 88 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl
index 5e7316e5aa39..d2c61efc216f 100644
--- a/scripts/bootgraph.pl
+++ b/scripts/bootgraph.pl
@@ -37,7 +37,10 @@
37# dmesg | perl scripts/bootgraph.pl > output.svg 37# dmesg | perl scripts/bootgraph.pl > output.svg
38# 38#
39 39
40my %start, %end; 40use strict;
41
42my %start;
43my %end;
41my $done = 0; 44my $done = 0;
42my $maxtime = 0; 45my $maxtime = 0;
43my $firsttime = 100; 46my $firsttime = 100;
@@ -105,18 +108,20 @@ my $threshold = ($maxtime - $firsttime) / 60.0;
105my $stylecounter = 0; 108my $stylecounter = 0;
106my %rows; 109my %rows;
107my $rowscount = 1; 110my $rowscount = 1;
108while (($key,$value) = each %start) { 111my @initcalls = sort { $start{$a} <=> $start{$b} } keys(%start);
112my $key;
113foreach $key (@initcalls) {
109 my $duration = $end{$key} - $start{$key}; 114 my $duration = $end{$key} - $start{$key};
110 115
111 if ($duration >= $threshold) { 116 if ($duration >= $threshold) {
112 my $s, $s2, $e, $y; 117 my ($s, $s2, $e, $w, $y, $y2, $style);
113 $pid = $pids{$key}; 118 my $pid = $pids{$key};
114 119
115 if (!defined($rows{$pid})) { 120 if (!defined($rows{$pid})) {
116 $rows{$pid} = $rowscount; 121 $rows{$pid} = $rowscount;
117 $rowscount = $rowscount + 1; 122 $rowscount = $rowscount + 1;
118 } 123 }
119 $s = ($value - $firsttime) * $mult; 124 $s = ($start{$key} - $firsttime) * $mult;
120 $s2 = $s + 6; 125 $s2 = $s + 6;
121 $e = ($end{$key} - $firsttime) * $mult; 126 $e = ($end{$key} - $firsttime) * $mult;
122 $w = $e - $s; 127 $w = $e - $s;
@@ -140,9 +145,9 @@ while (($key,$value) = each %start) {
140my $time = $firsttime; 145my $time = $firsttime;
141my $step = ($maxtime - $firsttime) / 15; 146my $step = ($maxtime - $firsttime) / 15;
142while ($time < $maxtime) { 147while ($time < $maxtime) {
143 my $s2 = ($time - $firsttime) * $mult; 148 my $s3 = ($time - $firsttime) * $mult;
144 my $tm = int($time * 100) / 100.0; 149 my $tm = int($time * 100) / 100.0;
145 print "<text transform=\"translate($s2,89) rotate(90)\">$tm</text>\n"; 150 print "<text transform=\"translate($s3,89) rotate(90)\">$tm</text>\n";
146 $time = $time + $step; 151 $time = $time + $step;
147} 152}
148 153
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 41564b142c04..60d00d1c4eee 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -113,10 +113,10 @@ EOF
113} 113}
114 114
115syscall_list() { 115syscall_list() {
116sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\ 116sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\
117\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\ 117\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
118\#warning syscall \1 not implemented\ 118\#warning syscall \1 not implemented\
119\#endif/p }' $1 119\#endif/p' $1
120} 120}
121 121
122(ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \ 122(ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 15d53a6b1a1f..488a3b1f760f 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl -w
2# 2#
3# headers_check.pl execute a number of trivial consistency checks 3# headers_check.pl execute a number of trivial consistency checks
4# 4#
@@ -17,7 +17,6 @@
17# 2) TODO: check for leaked CONFIG_ symbols 17# 2) TODO: check for leaked CONFIG_ symbols
18 18
19use strict; 19use strict;
20use warnings;
21 20
22my ($dir, $arch, @files) = @ARGV; 21my ($dir, $arch, @files) = @ARGV;
23 22
@@ -27,14 +26,15 @@ my $lineno = 0;
27my $filename; 26my $filename;
28 27
29foreach my $file (@files) { 28foreach my $file (@files) {
29 local *FH;
30 $filename = $file; 30 $filename = $file;
31 open(my $fh, '<', "$filename") or die "$filename: $!\n"; 31 open(FH, "<$filename") or die "$filename: $!\n";
32 $lineno = 0; 32 $lineno = 0;
33 while ($line = <$fh>) { 33 while ($line = <FH>) {
34 $lineno++; 34 $lineno++;
35 check_include(); 35 check_include();
36 } 36 }
37 close $fh; 37 close FH;
38} 38}
39exit $ret; 39exit $ret;
40 40
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 68591cd08731..7d2b4146e02f 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl -w
2# 2#
3# headers_install prepare the listed header files for use in 3# headers_install prepare the listed header files for use in
4# user space and copy the files to their destination. 4# user space and copy the files to their destination.
@@ -17,28 +17,29 @@
17# 3) Drop all sections defined out by __KERNEL__ (using unifdef) 17# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
18 18
19use strict; 19use strict;
20use warnings;
21 20
22my ($readdir, $installdir, $arch, @files) = @ARGV; 21my ($readdir, $installdir, $arch, @files) = @ARGV;
23 22
24my $unifdef = "scripts/unifdef -U__KERNEL__"; 23my $unifdef = "scripts/unifdef -U__KERNEL__";
25 24
26foreach my $file (@files) { 25foreach my $file (@files) {
26 local *INFILE;
27 local *OUTFILE;
27 my $tmpfile = "$installdir/$file.tmp"; 28 my $tmpfile = "$installdir/$file.tmp";
28 open(my $infile, '<', "$readdir/$file") 29 open(INFILE, "<$readdir/$file")
29 or die "$readdir/$file: $!\n"; 30 or die "$readdir/$file: $!\n";
30 open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n"; 31 open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
31 while (my $line = <$infile>) { 32 while (my $line = <INFILE>) {
32 $line =~ s/([\s(])__user\s/$1/g; 33 $line =~ s/([\s(])__user\s/$1/g;
33 $line =~ s/([\s(])__force\s/$1/g; 34 $line =~ s/([\s(])__force\s/$1/g;
34 $line =~ s/([\s(])__iomem\s/$1/g; 35 $line =~ s/([\s(])__iomem\s/$1/g;
35 $line =~ s/\s__attribute_const__\s/ /g; 36 $line =~ s/\s__attribute_const__\s/ /g;
36 $line =~ s/\s__attribute_const__$//g; 37 $line =~ s/\s__attribute_const__$//g;
37 $line =~ s/^#include <linux\/compiler.h>//; 38 $line =~ s/^#include <linux\/compiler.h>//;
38 printf $outfile "%s", $line; 39 printf OUTFILE "%s", $line;
39 } 40 }
40 close $outfile; 41 close OUTFILE;
41 close $infile; 42 close INFILE;
42 system $unifdef . " $tmpfile > $installdir/$file"; 43 system $unifdef . " $tmpfile > $installdir/$file";
43 unlink $tmpfile; 44 unlink $tmpfile;
44} 45}
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index d9cc6901d680..aadc5223dcdb 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -290,6 +290,15 @@ static int parse_file(const char *fname, struct md4_ctx *md)
290 release_file(file, len); 290 release_file(file, len);
291 return 1; 291 return 1;
292} 292}
293/* Check whether the file is a static library or not */
294static int is_static_library(const char *objfile)
295{
296 int len = strlen(objfile);
297 if (objfile[len - 2] == '.' && objfile[len - 1] == 'a')
298 return 1;
299 else
300 return 0;
301}
293 302
294/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to 303/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to
295 * figure out source file. */ 304 * figure out source file. */
@@ -420,7 +429,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
420 while ((fname = strsep(&sources, " ")) != NULL) { 429 while ((fname = strsep(&sources, " ")) != NULL) {
421 if (!*fname) 430 if (!*fname)
422 continue; 431 continue;
423 if (!parse_source_files(fname, &md)) 432 if (!(is_static_library(fname)) &&
433 !parse_source_files(fname, &md))
424 goto release; 434 goto release;
425 } 435 }
426 436
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index ffd61fe0c1ad..2500886fb90a 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -57,15 +57,17 @@ fi
57echo "%build" 57echo "%build"
58 58
59if ! $PREBUILT; then 59if ! $PREBUILT; then
60echo "make clean && make %{_smp_mflags}" 60echo "make clean && make %{?_smp_mflags}"
61echo "" 61echo ""
62fi 62fi
63 63
64echo "%install" 64echo "%install"
65echo "%ifarch ia64" 65echo "%ifarch ia64"
66echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 66echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
67echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
67echo "%else" 68echo "%else"
68echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' 69echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
70echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
69echo "%endif" 71echo "%endif"
70 72
71echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' 73echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
@@ -92,5 +94,6 @@ echo "%files"
92echo '%defattr (-, root, root)' 94echo '%defattr (-, root, root)'
93echo "%dir /lib/modules" 95echo "%dir /lib/modules"
94echo "/lib/modules/$KERNELRELEASE" 96echo "/lib/modules/$KERNELRELEASE"
97echo "/lib/firmware"
95echo "/boot/*" 98echo "/boot/*"
96echo "" 99echo ""
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index f56d760bd589..6b9fe3eb8360 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -106,7 +106,13 @@ if ($#ARGV < 6) {
106 exit(1); 106 exit(1);
107} 107}
108 108
109my ($arch, $objdump, $objcopy, $cc, $ld, $nm, $rm, $mv, $inputfile) = @ARGV; 109my ($arch, $bits, $objdump, $objcopy, $cc,
110 $ld, $nm, $rm, $mv, $inputfile) = @ARGV;
111
112# Acceptable sections to record.
113my %text_sections = (
114 ".text" => 1,
115);
110 116
111$objdump = "objdump" if ((length $objdump) == 0); 117$objdump = "objdump" if ((length $objdump) == 0);
112$objcopy = "objcopy" if ((length $objcopy) == 0); 118$objcopy = "objcopy" if ((length $objcopy) == 0);
@@ -129,8 +135,16 @@ my $function_regex; # Find the name of a function
129 # (return offset and func name) 135 # (return offset and func name)
130my $mcount_regex; # Find the call site to mcount (return offset) 136my $mcount_regex; # Find the call site to mcount (return offset)
131 137
138if ($arch eq "x86") {
139 if ($bits == 64) {
140 $arch = "x86_64";
141 } else {
142 $arch = "i386";
143 }
144}
145
132if ($arch eq "x86_64") { 146if ($arch eq "x86_64") {
133 $section_regex = "Disassembly of section"; 147 $section_regex = "Disassembly of section\\s+(\\S+):";
134 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 148 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
135 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; 149 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
136 $type = ".quad"; 150 $type = ".quad";
@@ -142,7 +156,7 @@ if ($arch eq "x86_64") {
142 $cc .= " -m64"; 156 $cc .= " -m64";
143 157
144} elsif ($arch eq "i386") { 158} elsif ($arch eq "i386") {
145 $section_regex = "Disassembly of section"; 159 $section_regex = "Disassembly of section\\s+(\\S+):";
146 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 160 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
147 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; 161 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";
148 $type = ".long"; 162 $type = ".long";
@@ -289,7 +303,13 @@ my $text;
289while (<IN>) { 303while (<IN>) {
290 # is it a section? 304 # is it a section?
291 if (/$section_regex/) { 305 if (/$section_regex/) {
292 $read_function = 1; 306
307 # Only record text sections that we know are safe
308 if (defined($text_sections{$1})) {
309 $read_function = 1;
310 } else {
311 $read_function = 0;
312 }
293 # print out any recorded offsets 313 # print out any recorded offsets
294 update_funcs() if ($text_found); 314 update_funcs() if ($text_found);
295 315
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 83b75126c9f7..72d233528ade 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -9,11 +9,13 @@ usage() {
9cd "${1:-.}" || usage 9cd "${1:-.}" || usage
10 10
11# Check for git and a git repo. 11# Check for git and a git repo.
12if head=`git rev-parse --verify HEAD 2>/dev/null`; then 12if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
13 # Do we have an untagged version? 13 # Do we have an untagged version?
14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then 14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
15 if tag=`git describe 2>/dev/null`; then 15 if tag=`git describe 2>/dev/null`; then
16 echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' 16 echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
17 else
18 printf '%s%s' -g $head
17 fi 19 fi
18 fi 20 fi
19 21
@@ -55,7 +57,7 @@ if rev=`svn info 2>/dev/null | grep '^Revision'`; then
55 57
56 # Are there uncommitted changes? 58 # Are there uncommitted changes?
57 if [ $changes != 0 ]; then 59 if [ $changes != 0 ]; then
58 printf -- '-svn%s%s%s' "$rev" -dirty "$changes" 60 printf -- '-svn%s%s' "$rev" -dirty
59 else 61 else
60 printf -- '-svn%s' "$rev" 62 printf -- '-svn%s' "$rev"
61 fi 63 fi
diff --git a/security/security.c b/security/security.c
index 255b08559b2b..c0acfa7177e5 100644
--- a/security/security.c
+++ b/security/security.c
@@ -198,14 +198,23 @@ int security_settime(struct timespec *ts, struct timezone *tz)
198 198
199int security_vm_enough_memory(long pages) 199int security_vm_enough_memory(long pages)
200{ 200{
201 WARN_ON(current->mm == NULL);
201 return security_ops->vm_enough_memory(current->mm, pages); 202 return security_ops->vm_enough_memory(current->mm, pages);
202} 203}
203 204
204int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) 205int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
205{ 206{
207 WARN_ON(mm == NULL);
206 return security_ops->vm_enough_memory(mm, pages); 208 return security_ops->vm_enough_memory(mm, pages);
207} 209}
208 210
211int security_vm_enough_memory_kern(long pages)
212{
213 /* If current->mm is a kernel thread then we will pass NULL,
214 for this specific case that is fine */
215 return security_ops->vm_enough_memory(current->mm, pages);
216}
217
209int security_bprm_alloc(struct linux_binprm *bprm) 218int security_bprm_alloc(struct linux_binprm *bprm)
210{ 219{
211 return security_ops->bprm_alloc_security(bprm); 220 return security_ops->bprm_alloc_security(bprm);
diff --git a/sound/core/control.c b/sound/core/control.c
index 6d71f9a7ccbb..b0bf42691047 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -225,8 +225,13 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
225 kctl.id.iface = ncontrol->iface; 225 kctl.id.iface = ncontrol->iface;
226 kctl.id.device = ncontrol->device; 226 kctl.id.device = ncontrol->device;
227 kctl.id.subdevice = ncontrol->subdevice; 227 kctl.id.subdevice = ncontrol->subdevice;
228 if (ncontrol->name) 228 if (ncontrol->name) {
229 strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); 229 strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
230 if (strcmp(ncontrol->name, kctl.id.name) != 0)
231 snd_printk(KERN_WARNING
232 "Control name '%s' truncated to '%s'\n",
233 ncontrol->name, kctl.id.name);
234 }
230 kctl.id.index = ncontrol->index; 235 kctl.id.index = ncontrol->index;
231 kctl.count = ncontrol->count ? ncontrol->count : 1; 236 kctl.count = ncontrol->count ? ncontrol->count : 1;
232 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : 237 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 6704acbca8c0..bd510eceff1f 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1927,9 +1927,9 @@ static int snd_ac97_dev_register(struct snd_device *device)
1927 ac97->dev.bus = &ac97_bus_type; 1927 ac97->dev.bus = &ac97_bus_type;
1928 ac97->dev.parent = ac97->bus->card->dev; 1928 ac97->dev.parent = ac97->bus->card->dev;
1929 ac97->dev.release = ac97_device_release; 1929 ac97->dev.release = ac97_device_release;
1930 snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "%d-%d:%s", 1930 dev_set_name(&ac97->dev, "%d-%d:%s",
1931 ac97->bus->card->number, ac97->num, 1931 ac97->bus->card->number, ac97->num,
1932 snd_ac97_get_short_name(ac97)); 1932 snd_ac97_get_short_name(ac97));
1933 if ((err = device_register(&ac97->dev)) < 0) { 1933 if ((err = device_register(&ac97->dev)) < 0) {
1934 snd_printk(KERN_ERR "Can't register ac97 bus\n"); 1934 snd_printk(KERN_ERR "Can't register ac97 bus\n");
1935 ac97->dev.bus = NULL; 1935 ac97->dev.bus = NULL;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 6447754ae56e..ba1ab737b55f 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -64,6 +64,7 @@ static struct hda_vendor_id hda_vendor_ids[] = {
64 { 0x14f1, "Conexant" }, 64 { 0x14f1, "Conexant" },
65 { 0x17e8, "Chrontel" }, 65 { 0x17e8, "Chrontel" },
66 { 0x1854, "LG" }, 66 { 0x1854, "LG" },
67 { 0x1aec, "Wolfson Microelectronics" },
67 { 0x434d, "C-Media" }, 68 { 0x434d, "C-Media" },
68 { 0x8384, "SigmaTel" }, 69 { 0x8384, "SigmaTel" },
69 {} /* terminator */ 70 {} /* terminator */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f080f8ce0ecb..35722ec920cb 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -45,6 +45,7 @@
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48#include <linux/reboot.h>
48#include <sound/core.h> 49#include <sound/core.h>
49#include <sound/initval.h> 50#include <sound/initval.h>
50#include "hda_codec.h" 51#include "hda_codec.h"
@@ -397,6 +398,9 @@ struct azx {
397 398
398 /* for pending irqs */ 399 /* for pending irqs */
399 struct work_struct irq_pending_work; 400 struct work_struct irq_pending_work;
401
402 /* reboot notifier (for mysterious hangup problem at power-down) */
403 struct notifier_block reboot_notifier;
400}; 404};
401 405
402/* driver types */ 406/* driver types */
@@ -1979,12 +1983,36 @@ static int azx_resume(struct pci_dev *pci)
1979 1983
1980 1984
1981/* 1985/*
1986 * reboot notifier for hang-up problem at power-down
1987 */
1988static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf)
1989{
1990 struct azx *chip = container_of(nb, struct azx, reboot_notifier);
1991 azx_stop_chip(chip);
1992 return NOTIFY_OK;
1993}
1994
1995static void azx_notifier_register(struct azx *chip)
1996{
1997 chip->reboot_notifier.notifier_call = azx_halt;
1998 register_reboot_notifier(&chip->reboot_notifier);
1999}
2000
2001static void azx_notifier_unregister(struct azx *chip)
2002{
2003 if (chip->reboot_notifier.notifier_call)
2004 unregister_reboot_notifier(&chip->reboot_notifier);
2005}
2006
2007/*
1982 * destructor 2008 * destructor
1983 */ 2009 */
1984static int azx_free(struct azx *chip) 2010static int azx_free(struct azx *chip)
1985{ 2011{
1986 int i; 2012 int i;
1987 2013
2014 azx_notifier_unregister(chip);
2015
1988 if (chip->initialized) { 2016 if (chip->initialized) {
1989 azx_clear_irq_pending(chip); 2017 azx_clear_irq_pending(chip);
1990 for (i = 0; i < chip->num_streams; i++) 2018 for (i = 0; i < chip->num_streams; i++)
@@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
2348 pci_set_drvdata(pci, card); 2376 pci_set_drvdata(pci, card);
2349 chip->running = 1; 2377 chip->running = 1;
2350 power_down_all_codecs(chip); 2378 power_down_all_codecs(chip);
2379 azx_notifier_register(chip);
2351 2380
2352 dev++; 2381 dev++;
2353 return err; 2382 return err;
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2b00c4afdf97..d3fd432cb3ea 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -3860,6 +3860,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = {
3860 3860
3861static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 3861static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
3862 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), 3862 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
3863 SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE),
3863 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), 3864 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD),
3864 {} 3865 {}
3865}; 3866};
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 788fdc6f3264..df9b0bc7f878 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -566,10 +566,8 @@ static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
566 nid = codec->slave_dig_outs[smux_idx - 1]; 566 nid = codec->slave_dig_outs[smux_idx - 1];
567 if (spec->cur_smux[smux_idx] == smux->num_items - 1) 567 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
568 val = AMP_OUT_MUTE; 568 val = AMP_OUT_MUTE;
569 if (smux_idx == 0)
570 nid = spec->multiout.dig_out_nid;
571 else 569 else
572 nid = codec->slave_dig_outs[smux_idx - 1]; 570 val = AMP_OUT_UNMUTE;
573 /* un/mute SPDIF out */ 571 /* un/mute SPDIF out */
574 snd_hda_codec_write_cache(codec, nid, 0, 572 snd_hda_codec_write_cache(codec, nid, 0,
575 AC_VERB_SET_AMP_GAIN_MUTE, val); 573 AC_VERB_SET_AMP_GAIN_MUTE, val);
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 5b442383fcda..58d7cda03de5 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2688,12 +2688,13 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2688 return err; 2688 return err;
2689 } 2689 }
2690 2690
2691 if (ice_has_con_ac97(ice)) 2691 if (ice_has_con_ac97(ice)) {
2692 err = snd_ice1712_pcm(ice, pcm_dev++, NULL); 2692 err = snd_ice1712_pcm(ice, pcm_dev++, NULL);
2693 if (err < 0) { 2693 if (err < 0) {
2694 snd_card_free(card); 2694 snd_card_free(card);
2695 return err; 2695 return err;
2696 } 2696 }
2697 }
2697 2698
2698 err = snd_ice1712_ac97_mixer(ice); 2699 err = snd_ice1712_ac97_mixer(ice);
2699 if (err < 0) { 2700 if (err < 0) {
@@ -2715,12 +2716,13 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2715 } 2716 }
2716 } 2717 }
2717 2718
2718 if (ice_has_con_ac97(ice)) 2719 if (ice_has_con_ac97(ice)) {
2719 err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL); 2720 err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL);
2720 if (err < 0) { 2721 if (err < 0) {
2721 snd_card_free(card); 2722 snd_card_free(card);
2722 return err; 2723 return err;
2723 } 2724 }
2725 }
2724 2726
2725 if (!c->no_mpu401) { 2727 if (!c->no_mpu401) {
2726 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, 2728 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index c88d1eace1c4..19d3391e229f 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2702,6 +2702,7 @@ static struct snd_pci_quirk intel8x0_clock_list[] __devinitdata = {
2702 SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000), 2702 SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000),
2703 SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100), 2703 SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100),
2704 SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000), 2704 SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000),
2705 SND_PCI_QUIRK(0x1028, 0x01ad, "AD1981B", 48000),
2705 SND_PCI_QUIRK(0x1043, 0x80f3, "AD1985", 48000), 2706 SND_PCI_QUIRK(0x1043, 0x80f3, "AD1985", 48000),
2706 { } /* terminator */ 2707 { } /* terminator */
2707}; 2708};
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index aba402b3c999..945b32ed9884 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -140,7 +140,7 @@ SOC_SINGLE("Capture ADC Boost (+20dB) Switch", AC97_VIDEO, 6, 1, 0),
140 140
141SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), 141SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0),
142SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), 142SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0),
143SOC_SINGLE("ALC Decay Time ", AC97_CODEC_CLASS_REV, 4, 15, 0), 143SOC_SINGLE("ALC Decay Time", AC97_CODEC_CLASS_REV, 4, 15, 0),
144SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), 144SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0),
145SOC_ENUM("ALC Function", wm9713_enum[6]), 145SOC_ENUM("ALC Function", wm9713_enum[6]),
146SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), 146SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0),
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 86923299bc10..94a02eaa4825 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -277,7 +277,7 @@ static int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd)
277 struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; 277 struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs;
278 u16 imr; 278 u16 imr;
279 u8 psc_cmd; 279 u8 psc_cmd;
280 long flags; 280 unsigned long flags;
281 281
282 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 282 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
283 s = &psc_i2s->capture; 283 s = &psc_i2s->capture;
@@ -699,9 +699,11 @@ static ssize_t psc_i2s_stat_store(struct device *dev,
699 return count; 699 return count;
700} 700}
701 701
702DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL); 702static DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL);
703DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store); 703static DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show,
704DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store); 704 psc_i2s_stat_store);
705static DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show,
706 psc_i2s_stat_store);
705 707
706/* --------------------------------------------------------------------- 708/* ---------------------------------------------------------------------
707 * OF platform bus binding code: 709 * OF platform bus binding code:
@@ -819,8 +821,8 @@ static int __devinit psc_i2s_of_probe(struct of_device *op,
819 821
820 /* Register the SYSFS files */ 822 /* Register the SYSFS files */
821 rc = device_create_file(psc_i2s->dev, &dev_attr_status); 823 rc = device_create_file(psc_i2s->dev, &dev_attr_status);
822 rc = device_create_file(psc_i2s->dev, &dev_attr_capture_overrun); 824 rc |= device_create_file(psc_i2s->dev, &dev_attr_capture_overrun);
823 rc = device_create_file(psc_i2s->dev, &dev_attr_playback_underrun); 825 rc |= device_create_file(psc_i2s->dev, &dev_attr_playback_underrun);
824 if (rc) 826 if (rc)
825 dev_info(psc_i2s->dev, "error creating sysfs files\n"); 827 dev_info(psc_i2s->dev, "error creating sysfs files\n");
826 828
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 462e635dfc74..a3adbf06b1e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1462,7 +1462,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
1462 struct soc_mixer_control *mc = 1462 struct soc_mixer_control *mc =
1463 (struct soc_mixer_control *)kcontrol->private_value; 1463 (struct soc_mixer_control *)kcontrol->private_value;
1464 int max = mc->max; 1464 int max = mc->max;
1465 unsigned int shift = mc->min; 1465 unsigned int shift = mc->shift;
1466 unsigned int rshift = mc->rshift; 1466 unsigned int rshift = mc->rshift;
1467 1467
1468 if (max == 1) 1468 if (max == 1)
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 69689e79bf79..92115755d98e 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -1480,6 +1480,36 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1480 } 1480 }
1481 } 1481 }
1482}, 1482},
1483{
1484 /* Advanced modes of the Edirol UA-25EX.
1485 * For the standard mode, UA-25EX has ID 0582:00e7, which
1486 * offers only 16-bit PCM at 44.1 kHz and no MIDI.
1487 */
1488 USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e6),
1489 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1490 .vendor_name = "EDIROL",
1491 .product_name = "UA-25EX",
1492 .ifnum = QUIRK_ANY_INTERFACE,
1493 .type = QUIRK_COMPOSITE,
1494 .data = (const struct snd_usb_audio_quirk[]) {
1495 {
1496 .ifnum = 0,
1497 .type = QUIRK_AUDIO_EDIROL_UAXX
1498 },
1499 {
1500 .ifnum = 1,
1501 .type = QUIRK_AUDIO_EDIROL_UAXX
1502 },
1503 {
1504 .ifnum = 2,
1505 .type = QUIRK_AUDIO_EDIROL_UAXX
1506 },
1507 {
1508 .ifnum = -1
1509 }
1510 }
1511 }
1512},
1483 1513
1484/* Guillemot devices */ 1514/* Guillemot devices */
1485{ 1515{
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index d0169f5e6047..55ad76ee2d09 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -25,15 +25,23 @@
25#include "ioapic.h" 25#include "ioapic.h"
26 26
27/* This should be called with the kvm->lock mutex held */ 27/* This should be called with the kvm->lock mutex held */
28void kvm_set_irq(struct kvm *kvm, int irq, int level) 28void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level)
29{ 29{
30 unsigned long *irq_state = (unsigned long *)&kvm->arch.irq_states[irq];
31
32 /* Logical OR for level trig interrupt */
33 if (level)
34 set_bit(irq_source_id, irq_state);
35 else
36 clear_bit(irq_source_id, irq_state);
37
30 /* Not possible to detect if the guest uses the PIC or the 38 /* Not possible to detect if the guest uses the PIC or the
31 * IOAPIC. So set the bit in both. The guest will ignore 39 * IOAPIC. So set the bit in both. The guest will ignore
32 * writes to the unused one. 40 * writes to the unused one.
33 */ 41 */
34 kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level); 42 kvm_ioapic_set_irq(kvm->arch.vioapic, irq, !!(*irq_state));
35#ifdef CONFIG_X86 43#ifdef CONFIG_X86
36 kvm_pic_set_irq(pic_irqchip(kvm), irq, level); 44 kvm_pic_set_irq(pic_irqchip(kvm), irq, !!(*irq_state));
37#endif 45#endif
38} 46}
39 47
@@ -58,3 +66,31 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
58{ 66{
59 hlist_del(&kian->link); 67 hlist_del(&kian->link);
60} 68}
69
70/* The caller must hold kvm->lock mutex */
71int kvm_request_irq_source_id(struct kvm *kvm)
72{
73 unsigned long *bitmap = &kvm->arch.irq_sources_bitmap;
74 int irq_source_id = find_first_zero_bit(bitmap,
75 sizeof(kvm->arch.irq_sources_bitmap));
76 if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
77 printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
78 irq_source_id = -EFAULT;
79 } else
80 set_bit(irq_source_id, bitmap);
81 return irq_source_id;
82}
83
84void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
85{
86 int i;
87
88 if (irq_source_id <= 0 ||
89 irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
90 printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
91 return;
92 }
93 for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++)
94 clear_bit(irq_source_id, &kvm->arch.irq_states[i]);
95 clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
96}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index cf0ab8ed3845..a87f45edfae8 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -105,14 +105,12 @@ static void kvm_assigned_dev_interrupt_work_handler(struct work_struct *work)
105 */ 105 */
106 mutex_lock(&assigned_dev->kvm->lock); 106 mutex_lock(&assigned_dev->kvm->lock);
107 kvm_set_irq(assigned_dev->kvm, 107 kvm_set_irq(assigned_dev->kvm,
108 assigned_dev->irq_source_id,
108 assigned_dev->guest_irq, 1); 109 assigned_dev->guest_irq, 1);
109 mutex_unlock(&assigned_dev->kvm->lock); 110 mutex_unlock(&assigned_dev->kvm->lock);
110 kvm_put_kvm(assigned_dev->kvm); 111 kvm_put_kvm(assigned_dev->kvm);
111} 112}
112 113
113/* FIXME: Implement the OR logic needed to make shared interrupts on
114 * this line behave properly
115 */
116static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) 114static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)
117{ 115{
118 struct kvm_assigned_dev_kernel *assigned_dev = 116 struct kvm_assigned_dev_kernel *assigned_dev =
@@ -134,7 +132,7 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian)
134 132
135 dev = container_of(kian, struct kvm_assigned_dev_kernel, 133 dev = container_of(kian, struct kvm_assigned_dev_kernel,
136 ack_notifier); 134 ack_notifier);
137 kvm_set_irq(dev->kvm, dev->guest_irq, 0); 135 kvm_set_irq(dev->kvm, dev->irq_source_id, dev->guest_irq, 0);
138 enable_irq(dev->host_irq); 136 enable_irq(dev->host_irq);
139} 137}
140 138
@@ -146,6 +144,7 @@ static void kvm_free_assigned_device(struct kvm *kvm,
146 free_irq(assigned_dev->host_irq, (void *)assigned_dev); 144 free_irq(assigned_dev->host_irq, (void *)assigned_dev);
147 145
148 kvm_unregister_irq_ack_notifier(kvm, &assigned_dev->ack_notifier); 146 kvm_unregister_irq_ack_notifier(kvm, &assigned_dev->ack_notifier);
147 kvm_free_irq_source_id(kvm, assigned_dev->irq_source_id);
149 148
150 if (cancel_work_sync(&assigned_dev->interrupt_work)) 149 if (cancel_work_sync(&assigned_dev->interrupt_work))
151 /* We had pending work. That means we will have to take 150 /* We had pending work. That means we will have to take
@@ -215,6 +214,11 @@ static int kvm_vm_ioctl_assign_irq(struct kvm *kvm,
215 match->ack_notifier.gsi = assigned_irq->guest_irq; 214 match->ack_notifier.gsi = assigned_irq->guest_irq;
216 match->ack_notifier.irq_acked = kvm_assigned_dev_ack_irq; 215 match->ack_notifier.irq_acked = kvm_assigned_dev_ack_irq;
217 kvm_register_irq_ack_notifier(kvm, &match->ack_notifier); 216 kvm_register_irq_ack_notifier(kvm, &match->ack_notifier);
217 r = kvm_request_irq_source_id(kvm);
218 if (r < 0)
219 goto out_release;
220 else
221 match->irq_source_id = r;
218 222
219 /* Even though this is PCI, we don't want to use shared 223 /* Even though this is PCI, we don't want to use shared
220 * interrupts. Sharing host devices with guest-assigned devices 224 * interrupts. Sharing host devices with guest-assigned devices