aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2006-02-10 11:53:29 -0500
committerSteve French <sfrench@us.ibm.com>2006-02-10 11:53:29 -0500
commitb580513e841d81eebf0d7b02f412be0882c2ce5f (patch)
tree9336a14058eed66c335db10512f33a31f9e8c938
parent04fdabe17c4840a4cd84c3589f20f5d4689b1ec5 (diff)
parent418aade459f03318defd18ef0b11981a63bd81b0 (diff)
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--Documentation/hwmon/f71805f105
-rw-r--r--Documentation/hwmon/it872
-rw-r--r--Documentation/hwmon/sysfs-interface18
-rw-r--r--Documentation/i2c/busses/i2c-sis96x (renamed from Documentation/i2c/busses/i2c-sis69x)4
-rw-r--r--Documentation/powerpc/booting-without-of.txt8
-rw-r--r--Documentation/spi/butterfly23
-rw-r--r--Documentation/unshare.txt295
-rw-r--r--Documentation/video4linux/CARDLIST.cx882
-rw-r--r--Documentation/video4linux/CARDLIST.saa71346
-rw-r--r--MAINTAINERS17
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/kernel/smp.c25
-rw-r--r--arch/arm/Kconfig49
-rw-r--r--arch/arm/configs/enp2611_defconfig2
-rw-r--r--arch/arm/configs/ixdp2400_defconfig2
-rw-r--r--arch/arm/configs/ixdp2401_defconfig2
-rw-r--r--arch/arm/configs/ixdp2801_defconfig2
-rw-r--r--arch/arm/configs/s3c2410_defconfig51
-rw-r--r--arch/arm/kernel/calls.S8
-rw-r--r--arch/arm/kernel/entry-armv.S17
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c71
-rw-r--r--arch/arm/mach-clps711x/Kconfig2
-rw-r--r--arch/arm/mach-imx/mx1ads.c1
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c5
-rw-r--r--arch/arm/mach-omap1/board-generic.c3
-rw-r--r--arch/arm/mach-omap1/board-h2.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c3
-rw-r--r--arch/arm/mach-omap1/board-innovator.c3
-rw-r--r--arch/arm/mach-omap1/board-netstar.c3
-rw-r--r--arch/arm/mach-omap1/board-osk.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c3
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c3
-rw-r--r--arch/arm/mach-omap1/io.c42
-rw-r--r--arch/arm/mach-omap2/board-generic.c3
-rw-r--r--arch/arm/mach-omap2/board-h4.c3
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-s3c2410/clock.c43
-rw-r--r--arch/arm/mach-s3c2410/clock.h1
-rw-r--r--arch/arm/mach-s3c2410/devs.c5
-rw-r--r--arch/arm/plat-omap/sram.c9
-rw-r--r--arch/cris/Makefile2
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c8
-rw-r--r--arch/cris/kernel/setup.c1
-rw-r--r--arch/i386/kernel/apic.c2
-rw-r--r--arch/i386/kernel/smpboot.c4
-rw-r--r--arch/i386/kernel/syscall_table.S1
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c2
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/dig/setup.c10
-rw-r--r--arch/ia64/ia32/ia32_signal.c1
-rw-r--r--arch/ia64/kernel/efi.c16
-rw-r--r--arch/ia64/kernel/entry.S16
-rw-r--r--arch/ia64/kernel/fsys.S29
-rw-r--r--arch/ia64/kernel/head.S1
-rw-r--r--arch/ia64/kernel/mca_drv.c3
-rw-r--r--arch/ia64/kernel/sal.c75
-rw-r--r--arch/ia64/kernel/setup.c4
-rw-r--r--arch/ia64/kernel/time.c27
-rw-r--r--arch/ia64/sn/Makefile2
-rw-r--r--arch/ia64/sn/kernel/Makefile2
-rw-r--r--arch/ia64/sn/kernel/bte.c17
-rw-r--r--arch/ia64/sn/kernel/io_init.c17
-rw-r--r--arch/ia64/sn/kernel/irq.c25
-rw-r--r--arch/ia64/sn/kernel/klconflib.c29
-rw-r--r--arch/ia64/sn/kernel/mca.c5
-rw-r--r--arch/ia64/sn/kernel/setup.c73
-rw-r--r--arch/ia64/sn/kernel/sn2/Makefile2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c196
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c5
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c19
-rw-r--r--arch/ia64/sn/pci/Makefile2
-rw-r--r--arch/ia64/sn/pci/pcibr/Makefile2
-rw-r--r--arch/m32r/kernel/m32r_ksyms.c5
-rw-r--r--arch/m32r/kernel/setup.c6
-rw-r--r--arch/m68knommu/kernel/process.c8
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/Makefile25
-rw-r--r--arch/mips/au1000/common/reset.c2
-rw-r--r--arch/mips/au1000/common/setup.c3
-rw-r--r--arch/mips/cobalt/int-handler.S2
-rw-r--r--arch/mips/cobalt/irq.c2
-rw-r--r--arch/mips/cobalt/reset.c2
-rw-r--r--arch/mips/cobalt/setup.c9
-rw-r--r--arch/mips/configs/ip32_defconfig1
-rw-r--r--arch/mips/configs/qemu_defconfig78
-rw-r--r--arch/mips/ddb5xxx/ddb5074/setup.c3
-rw-r--r--arch/mips/ddb5xxx/ddb5476/setup.c3
-rw-r--r--arch/mips/ddb5xxx/ddb5477/setup.c3
-rw-r--r--arch/mips/dec/setup.c3
-rw-r--r--arch/mips/gt64120/ev64120/setup.c4
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c6
-rw-r--r--arch/mips/ite-boards/generic/it8172_setup.c3
-rw-r--r--arch/mips/jazz/setup.c4
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c3
-rw-r--r--arch/mips/kernel/cpu-probe.c7
-rw-r--r--arch/mips/kernel/genex.S2
-rw-r--r--arch/mips/kernel/process.c5
-rw-r--r--arch/mips/kernel/ptrace32.c22
-rw-r--r--arch/mips/kernel/reset.c18
-rw-r--r--arch/mips/kernel/rtlx.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S17
-rw-r--r--arch/mips/kernel/scall64-64.S17
-rw-r--r--arch/mips/kernel/scall64-n32.S17
-rw-r--r--arch/mips/kernel/scall64-o32.S17
-rw-r--r--arch/mips/kernel/signal-common.h8
-rw-r--r--arch/mips/kernel/signal.c104
-rw-r--r--arch/mips/kernel/signal32.c67
-rw-r--r--arch/mips/kernel/signal_n32.c14
-rw-r--r--arch/mips/kernel/syscall.c48
-rw-r--r--arch/mips/kernel/traps.c2
-rw-r--r--arch/mips/kernel/vmlinux.lds.S11
-rw-r--r--arch/mips/lasat/reset.c5
-rw-r--r--arch/mips/lasat/setup.c4
-rw-r--r--arch/mips/lib-32/dump_tlb.c33
-rw-r--r--arch/mips/math-emu/dp_simple.c14
-rw-r--r--arch/mips/math-emu/sp_simple.c14
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c4
-rw-r--r--arch/mips/mips-boards/generic/reset.c5
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c4
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c4
-rw-r--r--arch/mips/mm/c-r4k.c7
-rw-r--r--arch/mips/mm/cache.c5
-rw-r--r--arch/mips/mm/init.c16
-rw-r--r--arch/mips/momentum/jaguar_atx/ja-console.c2
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c3
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c4
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c4
-rw-r--r--arch/mips/momentum/ocelot_g/setup.c4
-rw-r--r--arch/mips/oprofile/Makefile1
-rw-r--r--arch/mips/oprofile/common.c3
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c11
-rw-r--r--arch/mips/pci/Makefile1
-rw-r--r--arch/mips/pci/fixup-cobalt.c6
-rw-r--r--arch/mips/pci/ops-gt64111.c2
-rw-r--r--arch/mips/pci/pci-bcm1480.c2
-rw-r--r--arch/mips/philips/pnx8550/common/platform.c8
-rw-r--r--arch/mips/philips/pnx8550/common/setup.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c55
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c10
-rw-r--r--arch/mips/sgi-ip27/ip27-reset.c5
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c3
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c13
-rw-r--r--arch/mips/sibyte/cfe/setup.c3
-rw-r--r--arch/mips/sibyte/sb1250/prom.c3
-rw-r--r--arch/mips/sibyte/sb1250/setup.c36
-rw-r--r--arch/mips/sni/setup.c5
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c10
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c140
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c4
-rw-r--r--arch/mips/vr41xx/common/pmu.c3
-rw-r--r--arch/parisc/hpux/sys_hpux.c10
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/kernel/fpu.S2
-rw-r--r--arch/powerpc/kernel/head_64.S5
-rw-r--r--arch/powerpc/kernel/iommu.c9
-rw-r--r--arch/powerpc/kernel/prom.c38
-rw-r--r--arch/powerpc/kernel/prom_init.c4
-rw-r--r--arch/powerpc/kernel/prom_parse.c4
-rw-r--r--arch/powerpc/kernel/rtas.c12
-rw-r--r--arch/powerpc/kernel/rtas_flash.c3
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/signal_32.c18
-rw-r--r--arch/powerpc/kernel/signal_64.c4
-rw-r--r--arch/powerpc/kernel/smp.c3
-rw-r--r--arch/powerpc/kernel/time.c8
-rw-r--r--arch/powerpc/kernel/udbg_16550.c2
-rw-r--r--arch/powerpc/mm/lmb.c4
-rw-r--r--arch/powerpc/mm/mem.c14
-rw-r--r--arch/powerpc/platforms/cell/Makefile2
-rw-r--r--arch/powerpc/platforms/chrp/chrp.h1
-rw-r--r--arch/powerpc/platforms/chrp/pci.c2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c2
-rw-r--r--arch/powerpc/platforms/chrp/time.c21
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c3
-rw-r--r--arch/powerpc/platforms/powermac/pci.c89
-rw-r--r--arch/powerpc/platforms/powermac/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c8
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/ppc/kernel/head_8xx.S7
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c4
-rw-r--r--arch/ppc/platforms/4xx/bamboo.c4
-rw-r--r--arch/ppc/platforms/4xx/bubinga.c4
-rw-r--r--arch/ppc/platforms/4xx/ebony.c4
-rw-r--r--arch/ppc/platforms/4xx/luan.c4
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c4
-rw-r--r--arch/ppc/platforms/4xx/xilinx_ml300.c4
-rw-r--r--arch/ppc/platforms/4xx/yucca.c4
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c4
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c4
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c4
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c2
-rw-r--r--arch/ppc/platforms/85xx/tqm85xx.c4
-rw-r--r--arch/ppc/platforms/chestnut.c2
-rw-r--r--arch/ppc/platforms/ev64260.c2
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.c2
-rw-r--r--arch/ppc/platforms/spruce.c4
-rw-r--r--arch/ppc/syslib/ocp.c4
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.c2
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c2
-rw-r--r--arch/s390/kernel/compat_linux.c83
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--arch/s390/kernel/traps.c2
-rw-r--r--arch/s390/mm/cmm.c10
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/io.c30
-rw-r--r--arch/sh64/kernel/sh_ksyms.c8
-rw-r--r--arch/sparc/kernel/entry.S2
-rw-r--r--arch/sparc/kernel/process.c2
-rw-r--r--arch/sparc/kernel/systbls.S3
-rw-r--r--arch/sparc64/defconfig5
-rw-r--r--arch/sparc64/kernel/entry.S2
-rw-r--r--arch/sparc64/kernel/systbls.S7
-rw-r--r--arch/sparc64/solaris/systbl.S29
-rw-r--r--arch/um/drivers/chan_user.c15
-rw-r--r--arch/um/drivers/net_kern.c29
-rw-r--r--arch/um/include/registers.h2
-rw-r--r--arch/um/kernel/skas/process.c569
-rw-r--r--arch/um/kernel/um_arch.c18
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c4
-rw-r--r--arch/um/os-Linux/skas/mem.c2
-rw-r--r--arch/um/os-Linux/skas/process.c21
-rw-r--r--arch/um/os-Linux/start_up.c1
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c5
-rw-r--r--arch/um/sys-x86_64/ptrace_user.c7
-rw-r--r--arch/um/sys-x86_64/user-offsets.c2
-rw-r--r--arch/x86_64/ia32/ia32entry.S3
-rw-r--r--arch/x86_64/kernel/setup.c2
-rw-r--r--arch/x86_64/kernel/smpboot.c3
-rw-r--r--arch/x86_64/kernel/time.c2
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c5
-rw-r--r--arch/x86_64/pci/mmconfig.c2
-rw-r--r--block/elevator.c70
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--block/scsi_ioctl.c3
-rw-r--r--crypto/scatterwalk.c1
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/base/base.h4
-rw-r--r--drivers/base/bus.c3
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/base/power/resume.c3
-rw-r--r--drivers/base/power/shutdown.c2
-rw-r--r--drivers/base/power/suspend.c3
-rw-r--r--drivers/base/power/sysfs.c24
-rw-r--r--drivers/base/sys.c3
-rw-r--r--drivers/block/cciss.c5
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/drm/drmP.h10
-rw-r--r--drivers/char/drm/drm_stub.c2
-rw-r--r--drivers/char/drm/drm_sysfs.c131
-rw-r--r--drivers/char/ser_a2232.c1
-rw-r--r--drivers/char/tty_io.c30
-rw-r--r--drivers/char/watchdog/sbc_epx_c3.c15
-rw-r--r--drivers/edac/i82875p_edac.c2
-rw-r--r--drivers/hwmon/Kconfig10
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/f71805f.c908
-rw-r--r--drivers/hwmon/it87.c8
-rw-r--r--drivers/hwmon/lm77.c8
-rw-r--r--drivers/hwmon/w83792d.c31
-rw-r--r--drivers/i2c/algos/i2c-algo-sibyte.c2
-rw-r--r--drivers/i2c/busses/Kconfig1
-rw-r--r--drivers/i2c/busses/i2c-i801.c2
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.c7
-rw-r--r--drivers/i2c/busses/i2c-pxa.c2
-rw-r--r--drivers/i2c/i2c-core.c15
-rw-r--r--drivers/ide/ide-disk.c6
-rw-r--r--drivers/infiniband/core/ucm.c13
-rw-r--r--drivers/isdn/hisax/Kconfig2
-rw-r--r--drivers/macintosh/Kconfig8
-rw-r--r--drivers/macintosh/Makefile5
-rw-r--r--drivers/macintosh/windfarm.h3
-rw-r--r--drivers/macintosh/windfarm_core.c122
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c169
-rw-r--r--drivers/macintosh/windfarm_pid.c8
-rw-r--r--drivers/macintosh/windfarm_pid.h1
-rw-r--r--drivers/macintosh/windfarm_pm112.c698
-rw-r--r--drivers/macintosh/windfarm_pm81.c87
-rw-r--r--drivers/macintosh/windfarm_pm91.c95
-rw-r--r--drivers/macintosh/windfarm_smu_controls.c69
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c418
-rw-r--r--drivers/macintosh/windfarm_smu_sensors.c43
-rw-r--r--drivers/media/dvb/b2c2/Kconfig2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-common.h2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-dma.c35
-rw-r--r--drivers/media/dvb/b2c2/flexcop-fe-tuner.c9
-rw-r--r--drivers/media/dvb/b2c2/flexcop-misc.c6
-rw-r--r--drivers/media/dvb/b2c2/flexcop-pci.c6
-rw-r--r--drivers/media/dvb/b2c2/flexcop-reg.h4
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c44
-rw-r--r--drivers/media/dvb/bt8xx/bt878.h17
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig12
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c12
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c13
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c8
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h1
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x.c6
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x.h2
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045-fe.c6
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c2
-rw-r--r--drivers/media/dvb/frontends/Kconfig24
-rw-r--r--drivers/media/dvb/frontends/Makefile3
-rw-r--r--drivers/media/dvb/frontends/at76c651.c450
-rw-r--r--drivers/media/dvb/frontends/at76c651.h47
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c8
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.h2
-rw-r--r--drivers/media/dvb/frontends/nxt2002.c706
-rw-r--r--drivers/media/dvb/frontends/nxt2002.h23
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c58
-rw-r--r--drivers/media/dvb/frontends/tda80xx.c734
-rw-r--r--drivers/media/dvb/frontends/tda80xx.h51
-rw-r--r--drivers/media/dvb/ttpci/av7110.c14
-rw-r--r--drivers/media/dvb/ttpci/av7110.h2
-rw-r--r--drivers/media/dvb/ttpci/av7110_ir.c26
-rw-r--r--drivers/media/video/bttv-driver.c2
-rw-r--r--drivers/media/video/compat_ioctl32.c89
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c50
-rw-r--r--drivers/media/video/cx88/Kconfig12
-rw-r--r--drivers/media/video/cx88/Makefile5
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c6
-rw-r--r--drivers/media/video/cx88/cx88-cards.c6
-rw-r--r--drivers/media/video/cx88/cx88-core.c10
-rw-r--r--drivers/media/video/cx88/cx88-input.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c17
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c3
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c47
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c2
-rw-r--r--drivers/media/video/saa7134/saa7134.h2
-rw-r--r--drivers/media/video/stradis.c15
-rw-r--r--drivers/media/video/tda9887.c9
-rw-r--r--drivers/media/video/tuner-core.c8
-rw-r--r--drivers/media/video/tvaudio.c9
-rw-r--r--drivers/media/video/tvp5150.c32
-rw-r--r--drivers/mmc/Kconfig2
-rw-r--r--drivers/mtd/chips/Kconfig2
-rw-r--r--drivers/net/8139too.c38
-rw-r--r--drivers/net/Kconfig7
-rw-r--r--drivers/net/bonding/bond_main.c15
-rw-r--r--drivers/net/bonding/bond_sysfs.c6
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/gianfar.c24
-rw-r--r--drivers/net/gianfar.h8
-rw-r--r--drivers/net/gianfar_ethtool.c8
-rw-r--r--drivers/net/gianfar_mii.c17
-rw-r--r--drivers/net/hamradio/baycom_par.c1
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/r8169.c13
-rw-r--r--drivers/net/sis900.h1
-rw-r--r--drivers/net/sky2.c186
-rw-r--r--drivers/net/sky2.h9
-rw-r--r--drivers/net/tulip/uli526x.c2
-rw-r--r--drivers/net/wan/dscc4.c2
-rw-r--r--drivers/net/wan/pci200syn.c2
-rw-r--r--drivers/net/wan/wanxl.c2
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c2
-rw-r--r--drivers/scsi/aacraid/commsup.c2
-rw-r--r--drivers/scsi/mac53c94.c4
-rw-r--r--drivers/scsi/sata_mv.c11
-rw-r--r--drivers/scsi/sata_sil.c10
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/serial/21285.c2
-rw-r--r--drivers/serial/68328serial.c4
-rw-r--r--drivers/serial/68360serial.c4
-rw-r--r--drivers/serial/8250.c1
-rw-r--r--drivers/serial/8250_au1x00.c1
-rw-r--r--drivers/serial/8250_pci.c4
-rw-r--r--drivers/serial/amba-pl010.c4
-rw-r--r--drivers/serial/au1x00_uart.c12
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c25
-rw-r--r--drivers/serial/dz.c3
-rw-r--r--drivers/serial/imx.c4
-rw-r--r--drivers/serial/ip22zilog.c8
-rw-r--r--drivers/serial/m32r_sio.c2
-rw-r--r--drivers/serial/m32r_sio.h2
-rw-r--r--drivers/serial/mcfserial.c16
-rw-r--r--drivers/serial/mux.c2
-rw-r--r--drivers/serial/pmac_zilog.c2
-rw-r--r--drivers/serial/s3c2410.c4
-rw-r--r--drivers/serial/sa1100.c2
-rw-r--r--drivers/serial/serial_lh7a40x.c6
-rw-r--r--drivers/serial/sh-sci.c20
-rw-r--r--drivers/serial/sunsab.c2
-rw-r--r--drivers/serial/sunsu.c10
-rw-r--r--drivers/serial/sunzilog.c4
-rw-r--r--drivers/serial/v850e_uart.c2
-rw-r--r--drivers/sn/ioc3.c18
-rw-r--r--drivers/spi/Kconfig10
-rw-r--r--drivers/spi/spi_butterfly.c36
-rw-r--r--drivers/tc/tc.c1
-rw-r--r--drivers/video/backlight/backlight.c1
-rw-r--r--drivers/video/backlight/lcd.c1
-rw-r--r--drivers/video/pmag-ba-fb.c1
-rw-r--r--drivers/video/pmagb-b-fb.c1
-rw-r--r--fs/compat_ioctl.c8
-rw-r--r--fs/debugfs/file.c6
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/namei.c6
-rw-r--r--fs/namespace.c58
-rw-r--r--fs/nfs/nfsroot.c3
-rw-r--r--fs/nfsd/nfs4proc.c6
-rw-r--r--fs/reiserfs/hashes.c1
-rw-r--r--fs/select.c4
-rw-r--r--fs/super.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c2
-rw-r--r--include/asm-alpha/system.h2
-rw-r--r--include/asm-arm/arch-omap/io.h6
-rw-r--r--include/asm-arm/mutex.h131
-rw-r--r--include/asm-i386/unistd.h3
-rw-r--r--include/asm-ia64/processor.h17
-rw-r--r--include/asm-ia64/sal.h10
-rw-r--r--include/asm-ia64/sn/bte.h23
-rw-r--r--include/asm-ia64/sn/intr.h38
-rw-r--r--include/asm-ia64/system.h25
-rw-r--r--include/asm-ia64/unistd.h17
-rw-r--r--include/asm-m68knommu/hardirq.h1
-rw-r--r--include/asm-mips/abi.h4
-rw-r--r--include/asm-mips/bitops.h58
-rw-r--r--include/asm-mips/byteorder.h29
-rw-r--r--include/asm-mips/cacheflush.h3
-rw-r--r--include/asm-mips/hazards.h2
-rw-r--r--include/asm-mips/interrupt.h27
-rw-r--r--include/asm-mips/io.h35
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h4
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h (renamed from include/asm-mips/cobalt/cobalt.h)0
-rw-r--r--include/asm-mips/mach-cobalt/cpu-feature-overrides.h56
-rw-r--r--include/asm-mips/mach-cobalt/mach-gt64120.h (renamed from include/asm-mips/cobalt/mach-gt64120.h)0
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/r4kcache.h400
-rw-r--r--include/asm-mips/reboot.h3
-rw-r--r--include/asm-mips/string.h22
-rw-r--r--include/asm-mips/thread_info.h2
-rw-r--r--include/asm-mips/tx4927/tx4927.h21
-rw-r--r--include/asm-mips/tx4927/tx4927_pci.h10
-rw-r--r--include/asm-mips/uaccess.h71
-rw-r--r--include/asm-mips/unistd.h64
-rw-r--r--include/asm-powerpc/compat.h5
-rw-r--r--include/asm-powerpc/dma-mapping.h1
-rw-r--r--include/asm-powerpc/prom.h2
-rw-r--r--include/asm-powerpc/smu.h5
-rw-r--r--include/asm-powerpc/thread_info.h2
-rw-r--r--include/asm-s390/uaccess.h10
-rw-r--r--include/asm-sparc/unistd.h7
-rw-r--r--include/asm-sparc64/unistd.h7
-rw-r--r--include/asm-x86_64/ia32_unistd.h5
-rw-r--r--include/asm-x86_64/numa.h7
-rw-r--r--include/asm-x86_64/unistd.h10
-rw-r--r--include/linux/cpumask.h3
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/dvb/video.h2
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/i2c.h3
-rw-r--r--include/linux/ioc3.h2
-rw-r--r--include/linux/jbd.h1
-rw-r--r--include/linux/kbd_kern.h4
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/mtd/map.h1
-rw-r--r--include/linux/namespace.h1
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/nodemask.h1
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/suspend.h10
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_flip.h4
-rw-r--r--include/linux/videodev2.h6
-rw-r--r--include/net/irda/irlap.h3
-rw-r--r--init/Kconfig1
-rw-r--r--init/initramfs.c24
-rw-r--r--init/main.c1
-rw-r--r--ipc/mqueue.c3
-rw-r--r--ipc/shm.c1
-rw-r--r--kernel/compat.c1
-rw-r--r--kernel/fork.c394
-rw-r--r--kernel/module.c3
-rw-r--r--kernel/panic.c1
-rw-r--r--kernel/power/console.c4
-rw-r--r--kernel/power/power.h16
-rw-r--r--kernel/power/swsusp.c6
-rw-r--r--kernel/sched.c129
-rw-r--r--kernel/signal.c9
-rw-r--r--kernel/sys.c2
-rw-r--r--kernel/timer.c2
-rw-r--r--lib/kobject.c9
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--lib/spinlock_debug.c6
-rw-r--r--mm/hugetlb.c19
-rw-r--r--mm/slab.c10
-rw-r--r--mm/slob.c2
-rw-r--r--mm/swap.c32
-rw-r--r--mm/vmscan.c25
-rw-r--r--net/bridge/br_if.c94
-rw-r--r--net/bridge/br_input.c19
-rw-r--r--net/bridge/br_netfilter.c53
-rw-r--r--net/bridge/br_private.h6
-rw-r--r--net/bridge/br_stp_bpdu.c30
-rw-r--r--net/bridge/br_sysfs_if.c50
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c1
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/tcp_input.c3
-rw-r--r--net/ipv4/xfrm4_policy.c1
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/ipv6/mcast.c2
-rw-r--r--net/ipv6/raw.c1
-rw-r--r--net/ipv6/xfrm6_policy.c1
-rw-r--r--net/irda/irda_device.c4
-rw-r--r--net/irda/irnet/irnet_irda.c2
-rw-r--r--net/netlink/af_netlink.c7
-rw-r--r--net/xfrm/xfrm_policy.c1
-rw-r--r--scripts/kconfig/Makefile12
-rw-r--r--scripts/kconfig/lxdialog/Makefile7
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh14
-rw-r--r--security/selinux/Kconfig2
-rw-r--r--security/selinux/avc.c2
-rw-r--r--sound/oss/dmasound/tas_common.h16
-rw-r--r--sound/oss/emu10k1/recmgr.c2
-rw-r--r--sound/ppc/pmac.c3
-rw-r--r--sound/ppc/tumbler.c19
535 files changed, 6694 insertions, 5748 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 4d4897c8ef96..b730d765b525 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -162,3 +162,12 @@ What: pci_module_init(driver)
162When: January 2007 162When: January 2007
163Why: Is replaced by pci_register_driver(pci_driver). 163Why: Is replaced by pci_register_driver(pci_driver).
164Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de> 164Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de>
165
166---------------------------
167
168What: I2C interface of the it87 driver
169When: January 2007
170Why: The ISA interface is faster and should be always available. The I2C
171 probing is also known to cause trouble in at least one case (see
172 bug #5889.)
173Who: Jean Delvare <khali@linux-fr.org>
diff --git a/Documentation/hwmon/f71805f b/Documentation/hwmon/f71805f
new file mode 100644
index 000000000000..28c5b7d1eb90
--- /dev/null
+++ b/Documentation/hwmon/f71805f
@@ -0,0 +1,105 @@
1Kernel driver f71805f
2=====================
3
4Supported chips:
5 * Fintek F71805F/FG
6 Prefix: 'f71805f'
7 Addresses scanned: none, address read from Super I/O config space
8 Datasheet: Provided by Fintek on request
9
10Author: Jean Delvare <khali@linux-fr.org>
11
12Thanks to Denis Kieft from Barracuda Networks for the donation of a
13test system (custom Jetway K8M8MS motherboard, with CPU and RAM) and
14for providing initial documentation.
15
16Thanks to Kris Chen from Fintek for answering technical questions and
17providing additional documentation.
18
19Thanks to Chris Lin from Jetway for providing wiring schematics and
20anwsering technical questions.
21
22
23Description
24-----------
25
26The Fintek F71805F/FG Super I/O chip includes complete hardware monitoring
27capabilities. It can monitor up to 9 voltages (counting its own power
28source), 3 fans and 3 temperature sensors.
29
30This chip also has fan controlling features, using either DC or PWM, in
31three different modes (one manual, two automatic). The driver doesn't
32support these features yet.
33
34The driver assumes that no more than one chip is present, which seems
35reasonable.
36
37
38Voltage Monitoring
39------------------
40
41Voltages are sampled by an 8-bit ADC with a LSB of 8 mV. The supported
42range is thus from 0 to 2.040 V. Voltage values outside of this range
43need external resistors. An exception is in0, which is used to monitor
44the chip's own power source (+3.3V), and is divided internally by a
45factor 2.
46
47The two LSB of the voltage limit registers are not used (always 0), so
48you can only set the limits in steps of 32 mV (before scaling).
49
50The wirings and resistor values suggested by Fintek are as follow:
51
52 pin expected
53 name use R1 R2 divider raw val.
54
55in0 VCC VCC3.3V int. int. 2.00 1.65 V
56in1 VIN1 VTT1.2V 10K - 1.00 1.20 V
57in2 VIN2 VRAM 100K 100K 2.00 ~1.25 V (1)
58in3 VIN3 VCHIPSET 47K 100K 1.47 2.24 V (2)
59in4 VIN4 VCC5V 200K 47K 5.25 0.95 V
60in5 VIN5 +12V 200K 20K 11.00 1.05 V
61in6 VIN6 VCC1.5V 10K - 1.00 1.50 V
62in7 VIN7 VCORE 10K - 1.00 ~1.40 V (1)
63in8 VIN8 VSB5V 200K 47K 1.00 0.95 V
64
65(1) Depends on your hardware setup.
66(2) Obviously not correct, swapping R1 and R2 would make more sense.
67
68These values can be used as hints at best, as motherboard manufacturers
69are free to use a completely different setup. As a matter of fact, the
70Jetway K8M8MS uses a significantly different setup. You will have to
71find out documentation about your own motherboard, and edit sensors.conf
72accordingly.
73
74Each voltage measured has associated low and high limits, each of which
75triggers an alarm when crossed.
76
77
78Fan Monitoring
79--------------
80
81Fan rotation speeds are reported as 12-bit values from a gated clock
82signal. Speeds down to 366 RPM can be measured. There is no theoretical
83high limit, but values over 6000 RPM seem to cause problem. The effective
84resolution is much lower than you would expect, the step between different
85register values being 10 rather than 1.
86
87The chip assumes 2 pulse-per-revolution fans.
88
89An alarm is triggered if the rotation speed drops below a programmable
90limit or is too low to be measured.
91
92
93Temperature Monitoring
94----------------------
95
96Temperatures are reported in degrees Celsius. Each temperature measured
97has a high limit, those crossing triggers an alarm. There is an associated
98hysteresis value, below which the temperature has to drop before the
99alarm is cleared.
100
101All temperature channels are external, there is no embedded temperature
102sensor. Each channel can be used for connecting either a thermal diode
103or a thermistor. The driver reports the currently selected mode, but
104doesn't allow changing it. In theory, the BIOS should have configured
105everything properly.
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87
index 7f42e441c645..9555be1ed999 100644
--- a/Documentation/hwmon/it87
+++ b/Documentation/hwmon/it87
@@ -9,7 +9,7 @@ Supported chips:
9 http://www.ite.com.tw/ 9 http://www.ite.com.tw/
10 * IT8712F 10 * IT8712F
11 Prefix: 'it8712' 11 Prefix: 'it8712'
12 Addresses scanned: I2C 0x28 - 0x2f 12 Addresses scanned: I2C 0x2d
13 from Super I/O config space (8 I/O ports) 13 from Super I/O config space (8 I/O ports)
14 Datasheet: Publicly available at the ITE website 14 Datasheet: Publicly available at the ITE website
15 http://www.ite.com.tw/ 15 http://www.ite.com.tw/
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
index 764cdc5480e7..a0d0ab24288e 100644
--- a/Documentation/hwmon/sysfs-interface
+++ b/Documentation/hwmon/sysfs-interface
@@ -179,11 +179,12 @@ temp[1-*]_auto_point[1-*]_temp_hyst
179**************** 179****************
180 180
181temp[1-3]_type Sensor type selection. 181temp[1-3]_type Sensor type selection.
182 Integers 1, 2, 3 or thermistor Beta value (3435) 182 Integers 1 to 4 or thermistor Beta value (typically 3435)
183 Read/Write. 183 Read/Write.
184 1: PII/Celeron Diode 184 1: PII/Celeron Diode
185 2: 3904 transistor 185 2: 3904 transistor
186 3: thermal diode 186 3: thermal diode
187 4: thermistor (default/unknown Beta)
187 Not all types are supported by all chips 188 Not all types are supported by all chips
188 189
189temp[1-4]_max Temperature max value. 190temp[1-4]_max Temperature max value.
@@ -261,6 +262,21 @@ alarms Alarm bitmask.
261 of individual bits. 262 of individual bits.
262 Bits are defined in kernel/include/sensors.h. 263 Bits are defined in kernel/include/sensors.h.
263 264
265alarms_in Alarm bitmask relative to in (voltage) channels
266 Read only
267 A '1' bit means an alarm, LSB corresponds to in0 and so on
268 Prefered to 'alarms' for newer chips
269
270alarms_fan Alarm bitmask relative to fan channels
271 Read only
272 A '1' bit means an alarm, LSB corresponds to fan1 and so on
273 Prefered to 'alarms' for newer chips
274
275alarms_temp Alarm bitmask relative to temp (temperature) channels
276 Read only
277 A '1' bit means an alarm, LSB corresponds to temp1 and so on
278 Prefered to 'alarms' for newer chips
279
264beep_enable Beep/interrupt enable 280beep_enable Beep/interrupt enable
265 0 to disable. 281 0 to disable.
266 1 to enable. 282 1 to enable.
diff --git a/Documentation/i2c/busses/i2c-sis69x b/Documentation/i2c/busses/i2c-sis96x
index b88953dfd580..00a009b977e9 100644
--- a/Documentation/i2c/busses/i2c-sis69x
+++ b/Documentation/i2c/busses/i2c-sis96x
@@ -7,7 +7,7 @@ Supported adapters:
7 Any combination of these host bridges: 7 Any combination of these host bridges:
8 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 746 8 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 746
9 and these south bridges: 9 and these south bridges:
10 961, 962, 963(L) 10 961, 962, 963(L)
11 11
12Author: Mark M. Hoffman <mhoffman@lightlink.com> 12Author: Mark M. Hoffman <mhoffman@lightlink.com>
13 13
@@ -29,7 +29,7 @@ The command "lspci" as root should produce something like these lines:
29 29
30or perhaps this... 30or perhaps this...
31 31
3200:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 3200:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645
3300:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961 3300:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961
3400:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016 3400:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016
35 35
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 1284498e847c..54e5f9b1536d 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -880,6 +880,10 @@ address which can extend beyond that limit.
880 - device_type : Should be "soc" 880 - device_type : Should be "soc"
881 - ranges : Should be defined as specified in 1) to describe the 881 - ranges : Should be defined as specified in 1) to describe the
882 translation of SOC addresses for memory mapped SOC registers. 882 translation of SOC addresses for memory mapped SOC registers.
883 - bus-frequency: Contains the bus frequency for the SOC node.
884 Typically, the value of this field is filled in by the boot
885 loader.
886
883 887
884 Recommended properties: 888 Recommended properties:
885 889
@@ -919,6 +923,7 @@ SOC.
919 device_type = "soc"; 923 device_type = "soc";
920 ranges = <00000000 e0000000 00100000> 924 ranges = <00000000 e0000000 00100000>
921 reg = <e0000000 00003000>; 925 reg = <e0000000 00003000>;
926 bus-frequency = <0>;
922 } 927 }
923 928
924 929
@@ -1170,6 +1175,8 @@ platforms are moved over to use the flattened-device-tree model.
1170 1175
1171 mdio@24520 { 1176 mdio@24520 {
1172 reg = <24520 20>; 1177 reg = <24520 20>;
1178 device_type = "mdio";
1179 compatible = "gianfar";
1173 1180
1174 ethernet-phy@0 { 1181 ethernet-phy@0 {
1175 ...... 1182 ......
@@ -1317,6 +1324,7 @@ not necessary as they are usually the same as the root node.
1317 device_type = "soc"; 1324 device_type = "soc";
1318 ranges = <00000000 e0000000 00100000> 1325 ranges = <00000000 e0000000 00100000>
1319 reg = <e0000000 00003000>; 1326 reg = <e0000000 00003000>;
1327 bus-frequency = <0>;
1320 1328
1321 mdio@24520 { 1329 mdio@24520 {
1322 reg = <24520 20>; 1330 reg = <24520 20>;
diff --git a/Documentation/spi/butterfly b/Documentation/spi/butterfly
index a2e8c8d90e35..9927af7a629c 100644
--- a/Documentation/spi/butterfly
+++ b/Documentation/spi/butterfly
@@ -12,13 +12,20 @@ You can make this adapter from an old printer cable and solder things
12directly to the Butterfly. Or (if you have the parts and skills) you 12directly to the Butterfly. Or (if you have the parts and skills) you
13can come up with something fancier, providing ciruit protection to the 13can come up with something fancier, providing ciruit protection to the
14Butterfly and the printer port, or with a better power supply than two 14Butterfly and the printer port, or with a better power supply than two
15signal pins from the printer port. 15signal pins from the printer port. Or for that matter, you can use
16similar cables to talk to many AVR boards, even a breadboard.
17
18This is more powerful than "ISP programming" cables since it lets kernel
19SPI protocol drivers interact with the AVR, and could even let the AVR
20issue interrupts to them. Later, your protocol driver should work
21easily with a "real SPI controller", instead of this bitbanger.
16 22
17 23
18The first cable connections will hook Linux up to one SPI bus, with the 24The first cable connections will hook Linux up to one SPI bus, with the
19AVR and a DataFlash chip; and to the AVR reset line. This is all you 25AVR and a DataFlash chip; and to the AVR reset line. This is all you
20need to reflash the firmware, and the pins are the standard Atmel "ISP" 26need to reflash the firmware, and the pins are the standard Atmel "ISP"
21connector pins (used also on non-Butterfly AVR boards). 27connector pins (used also on non-Butterfly AVR boards). On the parport
28side this is like "sp12" programming cables.
22 29
23 Signal Butterfly Parport (DB-25) 30 Signal Butterfly Parport (DB-25)
24 ------ --------- --------------- 31 ------ --------- ---------------
@@ -40,10 +47,14 @@ by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and
40 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT 47 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT
41 GND = J400.GND = pin 24/GND 48 GND = J400.GND = pin 24/GND
42 49
43The "USI" controller, using J405, can be used for a second SPI bus. That 50Or you could flash firmware making the AVR into an SPI slave (keeping the
44would let you talk to the AVR over SPI, running firmware that makes it act 51DataFlash in reset) and tweak the spi_butterfly driver to make it bind to
45as an SPI slave, while letting either Linux or the AVR use the DataFlash. 52the driver for your custom SPI-based protocol.
46There are plenty of spare parport pins to wire this one up, such as: 53
54The "USI" controller, using J405, can also be used for a second SPI bus.
55That would let you talk to the AVR using custom SPI-with-USI firmware,
56while letting either Linux or the AVR use the DataFlash. There are plenty
57of spare parport pins to wire this one up, such as:
47 58
48 Signal Butterfly Parport (DB-25) 59 Signal Butterfly Parport (DB-25)
49 ------ --------- --------------- 60 ------ --------- ---------------
diff --git a/Documentation/unshare.txt b/Documentation/unshare.txt
new file mode 100644
index 000000000000..90a5e9e5bef1
--- /dev/null
+++ b/Documentation/unshare.txt
@@ -0,0 +1,295 @@
1
2unshare system call:
3--------------------
4This document describes the new system call, unshare. The document
5provides an overview of the feature, why it is needed, how it can
6be used, its interface specification, design, implementation and
7how it can be tested.
8
9Change Log:
10-----------
11version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006
12
13Contents:
14---------
15 1) Overview
16 2) Benefits
17 3) Cost
18 4) Requirements
19 5) Functional Specification
20 6) High Level Design
21 7) Low Level Design
22 8) Test Specification
23 9) Future Work
24
251) Overview
26-----------
27Most legacy operating system kernels support an abstraction of threads
28as multiple execution contexts within a process. These kernels provide
29special resources and mechanisms to maintain these "threads". The Linux
30kernel, in a clever and simple manner, does not make distinction
31between processes and "threads". The kernel allows processes to share
32resources and thus they can achieve legacy "threads" behavior without
33requiring additional data structures and mechanisms in the kernel. The
34power of implementing threads in this manner comes not only from
35its simplicity but also from allowing application programmers to work
36outside the confinement of all-or-nothing shared resources of legacy
37threads. On Linux, at the time of thread creation using the clone system
38call, applications can selectively choose which resources to share
39between threads.
40
41unshare system call adds a primitive to the Linux thread model that
42allows threads to selectively 'unshare' any resources that were being
43shared at the time of their creation. unshare was conceptualized by
44Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part
45of the discussion on POSIX threads on Linux. unshare augments the
46usefulness of Linux threads for applications that would like to control
47shared resources without creating a new process. unshare is a natural
48addition to the set of available primitives on Linux that implement
49the concept of process/thread as a virtual machine.
50
512) Benefits
52-----------
53unshare would be useful to large application frameworks such as PAM
54where creating a new process to control sharing/unsharing of process
55resources is not possible. Since namespaces are shared by default
56when creating a new process using fork or clone, unshare can benefit
57even non-threaded applications if they have a need to disassociate
58from default shared namespace. The following lists two use-cases
59where unshare can be used.
60
612.1 Per-security context namespaces
62-----------------------------------
63unshare can be used to implement polyinstantiated directories using
64the kernel's per-process namespace mechanism. Polyinstantiated directories,
65such as per-user and/or per-security context instance of /tmp, /var/tmp or
66per-security context instance of a user's home directory, isolate user
67processes when working with these directories. Using unshare, a PAM
68module can easily setup a private namespace for a user at login.
69Polyinstantiated directories are required for Common Criteria certification
70with Labeled System Protection Profile, however, with the availability
71of shared-tree feature in the Linux kernel, even regular Linux systems
72can benefit from setting up private namespaces at login and
73polyinstantiating /tmp, /var/tmp and other directories deemed
74appropriate by system administrators.
75
762.2 unsharing of virtual memory and/or open files
77-------------------------------------------------
78Consider a client/server application where the server is processing
79client requests by creating processes that share resources such as
80virtual memory and open files. Without unshare, the server has to
81decide what needs to be shared at the time of creating the process
82which services the request. unshare allows the server an ability to
83disassociate parts of the context during the servicing of the
84request. For large and complex middleware application frameworks, this
85ability to unshare after the process was created can be very
86useful.
87
883) Cost
89-------
90In order to not duplicate code and to handle the fact that unshare
91works on an active task (as opposed to clone/fork working on a newly
92allocated inactive task) unshare had to make minor reorganizational
93changes to copy_* functions utilized by clone/fork system call.
94There is a cost associated with altering existing, well tested and
95stable code to implement a new feature that may not get exercised
96extensively in the beginning. However, with proper design and code
97review of the changes and creation of an unshare test for the LTP
98the benefits of this new feature can exceed its cost.
99
1004) Requirements
101---------------
102unshare reverses sharing that was done using clone(2) system call,
103so unshare should have a similar interface as clone(2). That is,
104since flags in clone(int flags, void *stack) specifies what should
105be shared, similar flags in unshare(int flags) should specify
106what should be unshared. Unfortunately, this may appear to invert
107the meaning of the flags from the way they are used in clone(2).
108However, there was no easy solution that was less confusing and that
109allowed incremental context unsharing in future without an ABI change.
110
111unshare interface should accommodate possible future addition of
112new context flags without requiring a rebuild of old applications.
113If and when new context flags are added, unshare design should allow
114incremental unsharing of those resources on an as needed basis.
115
1165) Functional Specification
117---------------------------
118NAME
119 unshare - disassociate parts of the process execution context
120
121SYNOPSIS
122 #include <sched.h>
123
124 int unshare(int flags);
125
126DESCRIPTION
127 unshare allows a process to disassociate parts of its execution
128 context that are currently being shared with other processes. Part
129 of execution context, such as the namespace, is shared by default
130 when a new process is created using fork(2), while other parts,
131 such as the virtual memory, open file descriptors, etc, may be
132 shared by explicit request to share them when creating a process
133 using clone(2).
134
135 The main use of unshare is to allow a process to control its
136 shared execution context without creating a new process.
137
138 The flags argument specifies one or bitwise-or'ed of several of
139 the following constants.
140
141 CLONE_FS
142 If CLONE_FS is set, file system information of the caller
143 is disassociated from the shared file system information.
144
145 CLONE_FILES
146 If CLONE_FILES is set, the file descriptor table of the
147 caller is disassociated from the shared file descriptor
148 table.
149
150 CLONE_NEWNS
151 If CLONE_NEWNS is set, the namespace of the caller is
152 disassociated from the shared namespace.
153
154 CLONE_VM
155 If CLONE_VM is set, the virtual memory of the caller is
156 disassociated from the shared virtual memory.
157
158RETURN VALUE
159 On success, zero returned. On failure, -1 is returned and errno is
160
161ERRORS
162 EPERM CLONE_NEWNS was specified by a non-root process (process
163 without CAP_SYS_ADMIN).
164
165 ENOMEM Cannot allocate sufficient memory to copy parts of caller's
166 context that need to be unshared.
167
168 EINVAL Invalid flag was specified as an argument.
169
170CONFORMING TO
171 The unshare() call is Linux-specific and should not be used
172 in programs intended to be portable.
173
174SEE ALSO
175 clone(2), fork(2)
176
1776) High Level Design
178--------------------
179Depending on the flags argument, the unshare system call allocates
180appropriate process context structures, populates it with values from
181the current shared version, associates newly duplicated structures
182with the current task structure and releases corresponding shared
183versions. Helper functions of clone (copy_*) could not be used
184directly by unshare because of the following two reasons.
185 1) clone operates on a newly allocated not-yet-active task
186 structure, where as unshare operates on the current active
187 task. Therefore unshare has to take appropriate task_lock()
188 before associating newly duplicated context structures
189 2) unshare has to allocate and duplicate all context structures
190 that are being unshared, before associating them with the
191 current task and releasing older shared structures. Failure
192 do so will create race conditions and/or oops when trying
193 to backout due to an error. Consider the case of unsharing
194 both virtual memory and namespace. After successfully unsharing
195 vm, if the system call encounters an error while allocating
196 new namespace structure, the error return code will have to
197 reverse the unsharing of vm. As part of the reversal the
198 system call will have to go back to older, shared, vm
199 structure, which may not exist anymore.
200
201Therefore code from copy_* functions that allocated and duplicated
202current context structure was moved into new dup_* functions. Now,
203copy_* functions call dup_* functions to allocate and duplicate
204appropriate context structures and then associate them with the
205task structure that is being constructed. unshare system call on
206the other hand performs the following:
207 1) Check flags to force missing, but implied, flags
208 2) For each context structure, call the corresponding unshare
209 helper function to allocate and duplicate a new context
210 structure, if the appropriate bit is set in the flags argument.
211 3) If there is no error in allocation and duplication and there
212 are new context structures then lock the current task structure,
213 associate new context structures with the current task structure,
214 and release the lock on the current task structure.
215 4) Appropriately release older, shared, context structures.
216
2177) Low Level Design
218-------------------
219Implementation of unshare can be grouped in the following 4 different
220items:
221 a) Reorganization of existing copy_* functions
222 b) unshare system call service function
223 c) unshare helper functions for each different process context
224 d) Registration of system call number for different architectures
225
226 7.1) Reorganization of copy_* functions
227 Each copy function such as copy_mm, copy_namespace, copy_files,
228 etc, had roughly two components. The first component allocated
229 and duplicated the appropriate structure and the second component
230 linked it to the task structure passed in as an argument to the copy
231 function. The first component was split into its own function.
232 These dup_* functions allocated and duplicated the appropriate
233 context structure. The reorganized copy_* functions invoked
234 their corresponding dup_* functions and then linked the newly
235 duplicated structures to the task structure with which the
236 copy function was called.
237
238 7.2) unshare system call service function
239 * Check flags
240 Force implied flags. If CLONE_THREAD is set force CLONE_VM.
241 If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is
242 set and signals are also being shared, force CLONE_THREAD. If
243 CLONE_NEWNS is set, force CLONE_FS.
244 * For each context flag, invoke the corresponding unshare_*
245 helper routine with flags passed into the system call and a
246 reference to pointer pointing the new unshared structure
247 * If any new structures are created by unshare_* helper
248 functions, take the task_lock() on the current task,
249 modify appropriate context pointers, and release the
250 task lock.
251 * For all newly unshared structures, release the corresponding
252 older, shared, structures.
253
254 7.3) unshare_* helper functions
255 For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND,
256 and CLONE_THREAD, return -EINVAL since they are not implemented yet.
257 For others, check the flag value to see if the unsharing is
258 required for that structure. If it is, invoke the corresponding
259 dup_* function to allocate and duplicate the structure and return
260 a pointer to it.
261
262 7.4) Appropriately modify architecture specific code to register the
263 the new system call.
264
2658) Test Specification
266---------------------
267The test for unshare should test the following:
268 1) Valid flags: Test to check that clone flags for signal and
269 signal handlers, for which unsharing is not implemented
270 yet, return -EINVAL.
271 2) Missing/implied flags: Test to make sure that if unsharing
272 namespace without specifying unsharing of filesystem, correctly
273 unshares both namespace and filesystem information.
274 3) For each of the four (namespace, filesystem, files and vm)
275 supported unsharing, verify that the system call correctly
276 unshares the appropriate structure. Verify that unsharing
277 them individually as well as in combination with each
278 other works as expected.
279 4) Concurrent execution: Use shared memory segments and futex on
280 an address in the shm segment to synchronize execution of
281 about 10 threads. Have a couple of threads execute execve,
282 a couple _exit and the rest unshare with different combination
283 of flags. Verify that unsharing is performed as expected and
284 that there are no oops or hangs.
285
2869) Future Work
287--------------
288The current implementation of unshare does not allow unsharing of
289signals and signal handlers. Signals are complex to begin with and
290to unshare signals and/or signal handlers of a currently running
291process is even more complex. If in the future there is a specific
292need to allow unsharing of signals and/or signal handlers, it can
293be incrementally added to unshare without affecting legacy
294applications using unshare.
295
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 56e194f1a0b0..8bea3fbd0548 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -42,4 +42,4 @@
42 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802] 42 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802]
43 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025] 43 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025]
44 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1] 44 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1]
45 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50] 45 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54]
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index cb3a59bbeb17..8a352597830f 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -1,7 +1,7 @@
1 0 -> UNKNOWN/GENERIC 1 0 -> UNKNOWN/GENERIC
2 1 -> Proteus Pro [philips reference design] [1131:2001,1131:2001] 2 1 -> Proteus Pro [philips reference design] [1131:2001,1131:2001]
3 2 -> LifeView FlyVIDEO3000 [5168:0138,4e42:0138] 3 2 -> LifeView FlyVIDEO3000 [5168:0138,4e42:0138]
4 3 -> LifeView FlyVIDEO2000 [5168:0138] 4 3 -> LifeView/Typhoon FlyVIDEO2000 [5168:0138,4e42:0138]
5 4 -> EMPRESS [1131:6752] 5 4 -> EMPRESS [1131:6752]
6 5 -> SKNet Monster TV [1131:4e85] 6 5 -> SKNet Monster TV [1131:4e85]
7 6 -> Tevion MD 9717 7 6 -> Tevion MD 9717
@@ -53,12 +53,12 @@
53 52 -> AverMedia AverTV/305 [1461:2108] 53 52 -> AverMedia AverTV/305 [1461:2108]
54 53 -> ASUS TV-FM 7135 [1043:4845] 54 53 -> ASUS TV-FM 7135 [1043:4845]
55 54 -> LifeView FlyTV Platinum FM [5168:0214,1489:0214] 55 54 -> LifeView FlyTV Platinum FM [5168:0214,1489:0214]
56 55 -> LifeView FlyDVB-T DUO [5168:0502,5168:0306] 56 55 -> LifeView FlyDVB-T DUO [5168:0306]
57 56 -> Avermedia AVerTV 307 [1461:a70a] 57 56 -> Avermedia AVerTV 307 [1461:a70a]
58 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] 58 57 -> Avermedia AVerTV GO 007 FM [1461:f31f]
59 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370] 59 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370]
60 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 60 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134
61 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus [4e42:0502] 61 60 -> LifeView/Typhoon FlyDVB-T Duo Cardbus [5168:0502,4e42:0502]
62 61 -> Philips TOUGH DVB-T reference design [1131:2004] 62 61 -> Philips TOUGH DVB-T reference design [1131:2004]
63 62 -> Compro VideoMate TV Gold+II 63 62 -> Compro VideoMate TV Gold+II
64 63 -> Kworld Xpert TV PVR7134 64 63 -> Kworld Xpert TV PVR7134
diff --git a/MAINTAINERS b/MAINTAINERS
index 11d44daa6025..b22db521cec1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -540,7 +540,8 @@ S: Supported
540 540
541BTTV VIDEO4LINUX DRIVER 541BTTV VIDEO4LINUX DRIVER
542P: Mauro Carvalho Chehab 542P: Mauro Carvalho Chehab
543M: mchehab@brturbo.com.br 543M: mchehab@infradead.org
544M: v4l-dvb-maintainer@linuxtv.org
544L: video4linux-list@redhat.com 545L: video4linux-list@redhat.com
545W: http://linuxtv.org 546W: http://linuxtv.org
546T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git 547T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
@@ -837,11 +838,12 @@ S: Maintained
837 838
838DVB SUBSYSTEM AND DRIVERS 839DVB SUBSYSTEM AND DRIVERS
839P: LinuxTV.org Project 840P: LinuxTV.org Project
840M: linux-dvb-maintainer@linuxtv.org 841M: mchehab@infradead.org
842M: v4l-dvb-maintainer@linuxtv.org
841L: linux-dvb@linuxtv.org (subscription required) 843L: linux-dvb@linuxtv.org (subscription required)
842W: http://linuxtv.org/ 844W: http://linuxtv.org/
843T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git 845T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
844S: Supported 846S: Maintained
845 847
846EATA-DMA SCSI DRIVER 848EATA-DMA SCSI DRIVER
847P: Michael Neuffer 849P: Michael Neuffer
@@ -929,6 +931,12 @@ M: sct@redhat.com, akpm@osdl.org, adilger@clusterfs.com
929L: ext3-users@redhat.com 931L: ext3-users@redhat.com
930S: Maintained 932S: Maintained
931 933
934F71805F HARDWARE MONITORING DRIVER
935P: Jean Delvare
936M: khali@linux-fr.org
937L: lm-sensors@lm-sensors.org
938S: Maintained
939
932FARSYNC SYNCHRONOUS DRIVER 940FARSYNC SYNCHRONOUS DRIVER
933P: Kevin Curtis 941P: Kevin Curtis
934M: kevin.curtis@farsite.co.uk 942M: kevin.curtis@farsite.co.uk
@@ -2956,7 +2964,8 @@ S: Maintained
2956 2964
2957VIDEO FOR LINUX 2965VIDEO FOR LINUX
2958P: Mauro Carvalho Chehab 2966P: Mauro Carvalho Chehab
2959M: mchehab@brturbo.com.br 2967M: mchehab@infradead.org
2968M: v4l-dvb-maintainer@linuxtv.org
2960L: video4linux-list@redhat.com 2969L: video4linux-list@redhat.com
2961W: http://linuxtv.org 2970W: http://linuxtv.org
2962T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git 2971T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
diff --git a/Makefile b/Makefile
index cd5b619db9d8..a1158d1c051e 100644
--- a/Makefile
+++ b/Makefile
@@ -442,7 +442,7 @@ export KBUILD_DEFCONFIG
442config %config: scripts_basic outputmakefile FORCE 442config %config: scripts_basic outputmakefile FORCE
443 $(Q)mkdir -p include/linux 443 $(Q)mkdir -p include/linux
444 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 444 $(Q)$(MAKE) $(build)=scripts/kconfig $@
445 $(Q)$(MAKE) .kernelrelease 445 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
446 446
447else 447else
448# =========================================================================== 448# ===========================================================================
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 4b873527ce1c..02c2db08114a 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -73,9 +73,6 @@ cpumask_t cpu_online_map;
73 73
74EXPORT_SYMBOL(cpu_online_map); 74EXPORT_SYMBOL(cpu_online_map);
75 75
76/* cpus reported in the hwrpb */
77static unsigned long hwrpb_cpu_present_mask __initdata = 0;
78
79int smp_num_probed; /* Internal processor count */ 76int smp_num_probed; /* Internal processor count */
80int smp_num_cpus = 1; /* Number that came online. */ 77int smp_num_cpus = 1; /* Number that came online. */
81 78
@@ -442,7 +439,7 @@ setup_smp(void)
442 if ((cpu->flags & 0x1cc) == 0x1cc) { 439 if ((cpu->flags & 0x1cc) == 0x1cc) {
443 smp_num_probed++; 440 smp_num_probed++;
444 /* Assume here that "whami" == index */ 441 /* Assume here that "whami" == index */
445 hwrpb_cpu_present_mask |= (1UL << i); 442 cpu_set(i, cpu_possible_map);
446 cpu->pal_revision = boot_cpu_palrev; 443 cpu->pal_revision = boot_cpu_palrev;
447 } 444 }
448 445
@@ -453,12 +450,12 @@ setup_smp(void)
453 } 450 }
454 } else { 451 } else {
455 smp_num_probed = 1; 452 smp_num_probed = 1;
456 hwrpb_cpu_present_mask = (1UL << boot_cpuid); 453 cpu_set(boot_cpuid, cpu_possible_map);
457 } 454 }
458 cpu_present_mask = cpumask_of_cpu(boot_cpuid); 455 cpu_present_mask = cpumask_of_cpu(boot_cpuid);
459 456
460 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", 457 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
461 smp_num_probed, hwrpb_cpu_present_mask); 458 smp_num_probed, cpu_possible_map.bits[0]);
462} 459}
463 460
464/* 461/*
@@ -467,8 +464,6 @@ setup_smp(void)
467void __init 464void __init
468smp_prepare_cpus(unsigned int max_cpus) 465smp_prepare_cpus(unsigned int max_cpus)
469{ 466{
470 int cpu_count, i;
471
472 /* Take care of some initial bookkeeping. */ 467 /* Take care of some initial bookkeeping. */
473 memset(ipi_data, 0, sizeof(ipi_data)); 468 memset(ipi_data, 0, sizeof(ipi_data));
474 469
@@ -486,19 +481,7 @@ smp_prepare_cpus(unsigned int max_cpus)
486 481
487 printk(KERN_INFO "SMP starting up secondaries.\n"); 482 printk(KERN_INFO "SMP starting up secondaries.\n");
488 483
489 cpu_count = 1; 484 smp_num_cpus = smp_num_probed;
490 for (i = 0; (i < NR_CPUS) && (cpu_count < max_cpus); i++) {
491 if (i == boot_cpuid)
492 continue;
493
494 if (((hwrpb_cpu_present_mask >> i) & 1) == 0)
495 continue;
496
497 cpu_set(i, cpu_possible_map);
498 cpu_count++;
499 }
500
501 smp_num_cpus = cpu_count;
502} 485}
503 486
504void __devinit 487void __devinit
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5959e36c3b4c..15dc1a0dffbb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -10,9 +10,9 @@ config ARM
10 default y 10 default y
11 help 11 help
12 The ARM series is a line of low-power-consumption RISC chip designs 12 The ARM series is a line of low-power-consumption RISC chip designs
13 licensed by ARM ltd and targeted at embedded applications and 13 licensed by ARM Ltd and targeted at embedded applications and
14 handhelds such as the Compaq IPAQ. ARM-based PCs are no longer 14 handhelds such as the Compaq IPAQ. ARM-based PCs are no longer
15 manufactured, but legacy ARM-based PC hardware remains popular in 15 manufactured, but legacy ARM-based PC hardware remains popular in
16 Europe. There is an ARM Linux project with a web page at 16 Europe. There is an ARM Linux project with a web page at
17 <http://www.arm.linux.org.uk/>. 17 <http://www.arm.linux.org.uk/>.
18 18
@@ -69,6 +69,9 @@ config GENERIC_ISA_DMA
69config FIQ 69config FIQ
70 bool 70 bool
71 71
72config ARCH_MTD_XIP
73 bool
74
72source "init/Kconfig" 75source "init/Kconfig"
73 76
74menu "System Type" 77menu "System Type"
@@ -81,45 +84,62 @@ config ARCH_CLPS7500
81 bool "Cirrus-CL-PS7500FE" 84 bool "Cirrus-CL-PS7500FE"
82 select TIMER_ACORN 85 select TIMER_ACORN
83 select ISA 86 select ISA
87 help
88 Support for the Cirrus Logic PS7500FE system-on-a-chip.
84 89
85config ARCH_CLPS711X 90config ARCH_CLPS711X
86 bool "CLPS711x/EP721x-based" 91 bool "CLPS711x/EP721x-based"
92 help
93 Support for Cirrus Logic 711x/721x based boards.
87 94
88config ARCH_CO285 95config ARCH_CO285
89 bool "Co-EBSA285" 96 bool "Co-EBSA285"
90 select FOOTBRIDGE 97 select FOOTBRIDGE
91 select FOOTBRIDGE_ADDIN 98 select FOOTBRIDGE_ADDIN
99 help
100 Support for Intel's EBSA285 companion chip.
92 101
93config ARCH_EBSA110 102config ARCH_EBSA110
94 bool "EBSA-110" 103 bool "EBSA-110"
95 select ISA 104 select ISA
96 help 105 help
97 This is an evaluation board for the StrongARM processor available 106 This is an evaluation board for the StrongARM processor available
98 from Digital. It has limited hardware on-board, including an onboard 107 from Digital. It has limited hardware on-board, including an
99 Ethernet interface, two PCMCIA sockets, two serial ports and a 108 Ethernet interface, two PCMCIA sockets, two serial ports and a
100 parallel port. 109 parallel port.
101 110
102config ARCH_FOOTBRIDGE 111config ARCH_FOOTBRIDGE
103 bool "FootBridge" 112 bool "FootBridge"
104 select FOOTBRIDGE 113 select FOOTBRIDGE
114 help
115 Support for systems based on the DC21285 companion chip
116 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
105 117
106config ARCH_INTEGRATOR 118config ARCH_INTEGRATOR
107 bool "Integrator" 119 bool "Integrator"
108 select ARM_AMBA 120 select ARM_AMBA
109 select ICST525 121 select ICST525
122 help
123 Support for ARM's Integrator platform.
110 124
111config ARCH_IOP3XX 125config ARCH_IOP3XX
112 bool "IOP3xx-based" 126 bool "IOP3xx-based"
113 select PCI 127 select PCI
128 help
129 Support for Intel's IOP3XX (XScale) family of processors.
114 130
115config ARCH_IXP4XX 131config ARCH_IXP4XX
116 bool "IXP4xx-based" 132 bool "IXP4xx-based"
117 select DMABOUNCE 133 select DMABOUNCE
118 select PCI 134 select PCI
135 help
136 Support for Intel's IXP4XX (XScale) family of processors.
119 137
120config ARCH_IXP2000 138config ARCH_IXP2000
121 bool "IXP2400/2800-based" 139 bool "IXP2400/2800-based"
122 select PCI 140 select PCI
141 help
142 Support for Intel's IXP2400/2800 (XScale) family of processors.
123 143
124config ARCH_L7200 144config ARCH_L7200
125 bool "LinkUp-L7200" 145 bool "LinkUp-L7200"
@@ -136,6 +156,9 @@ config ARCH_L7200
136 156
137config ARCH_PXA 157config ARCH_PXA
138 bool "PXA2xx-based" 158 bool "PXA2xx-based"
159 select ARCH_MTD_XIP
160 help
161 Support for Intel's PXA2XX processor line.
139 162
140config ARCH_RPC 163config ARCH_RPC
141 bool "RiscPC" 164 bool "RiscPC"
@@ -152,19 +175,25 @@ config ARCH_SA1100
152 bool "SA1100-based" 175 bool "SA1100-based"
153 select ISA 176 select ISA
154 select ARCH_DISCONTIGMEM_ENABLE 177 select ARCH_DISCONTIGMEM_ENABLE
178 select ARCH_MTD_XIP
179 help
180 Support for StrongARM 11x0 based boards.
155 181
156config ARCH_S3C2410 182config ARCH_S3C2410
157 bool "Samsung S3C2410" 183 bool "Samsung S3C2410"
158 help 184 help
159 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 185 Samsung S3C2410X CPU based systems, such as the Simtec Electronics
160 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 186 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
161 the Samsung SMDK2410 development board (and derviatives). 187 the Samsung SMDK2410 development board (and derivatives).
162 188
163config ARCH_SHARK 189config ARCH_SHARK
164 bool "Shark" 190 bool "Shark"
165 select ISA 191 select ISA
166 select ISA_DMA 192 select ISA_DMA
167 select PCI 193 select PCI
194 help
195 Support for the StrongARM based Digital DNARD machine, also known
196 as "Shark" (<http://www.shark-linux.de/shark.html>).
168 197
169config ARCH_LH7A40X 198config ARCH_LH7A40X
170 bool "Sharp LH7A40X" 199 bool "Sharp LH7A40X"
@@ -176,6 +205,8 @@ config ARCH_LH7A40X
176 205
177config ARCH_OMAP 206config ARCH_OMAP
178 bool "TI OMAP" 207 bool "TI OMAP"
208 help
209 Support for TI's OMAP platform (OMAP1 and OMAP2).
179 210
180config ARCH_VERSATILE 211config ARCH_VERSATILE
181 bool "Versatile" 212 bool "Versatile"
@@ -194,6 +225,8 @@ config ARCH_REALVIEW
194 225
195config ARCH_IMX 226config ARCH_IMX
196 bool "IMX" 227 bool "IMX"
228 help
229 Support for Motorola's i.MX family of processors (MX1, MXL).
197 230
198config ARCH_H720X 231config ARCH_H720X
199 bool "Hynix-HMS720x-based" 232 bool "Hynix-HMS720x-based"
@@ -210,8 +243,8 @@ config ARCH_AAEC2000
210config ARCH_AT91RM9200 243config ARCH_AT91RM9200
211 bool "AT91RM9200" 244 bool "AT91RM9200"
212 help 245 help
213 Say Y here if you intend to run this kernel on an AT91RM9200-based 246 Say Y here if you intend to run this kernel on an Atmel
214 board. 247 AT91RM9200-based board.
215 248
216endchoice 249endchoice
217 250
@@ -417,8 +450,8 @@ config AEABI
417 To use this you need GCC version 4.0.0 or later. 450 To use this you need GCC version 4.0.0 or later.
418 451
419config OABI_COMPAT 452config OABI_COMPAT
420 bool "Allow old ABI binaries to run with this kernel" 453 bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)"
421 depends on AEABI 454 depends on AEABI && EXPERIMENTAL
422 default y 455 default y
423 help 456 help
424 This option preserves the old syscall interface along with the 457 This option preserves the old syscall interface along with the
diff --git a/arch/arm/configs/enp2611_defconfig b/arch/arm/configs/enp2611_defconfig
index 9592e3925c79..5fdaf3ce9d56 100644
--- a/arch/arm/configs/enp2611_defconfig
+++ b/arch/arm/configs/enp2611_defconfig
@@ -171,7 +171,7 @@ CONFIG_ALIGNMENT_TRAP=y
171# 171#
172CONFIG_ZBOOT_ROM_TEXT=0x0 172CONFIG_ZBOOT_ROM_TEXT=0x0
173CONFIG_ZBOOT_ROM_BSS=0x0 173CONFIG_ZBOOT_ROM_BSS=0x0
174CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 174CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"
175# CONFIG_XIP_KERNEL is not set 175# CONFIG_XIP_KERNEL is not set
176 176
177# 177#
diff --git a/arch/arm/configs/ixdp2400_defconfig b/arch/arm/configs/ixdp2400_defconfig
index d9d6bb86a6fa..c67fc449a11f 100644
--- a/arch/arm/configs/ixdp2400_defconfig
+++ b/arch/arm/configs/ixdp2400_defconfig
@@ -172,7 +172,7 @@ CONFIG_ALIGNMENT_TRAP=y
172# 172#
173CONFIG_ZBOOT_ROM_TEXT=0x0 173CONFIG_ZBOOT_ROM_TEXT=0x0
174CONFIG_ZBOOT_ROM_BSS=0x0 174CONFIG_ZBOOT_ROM_BSS=0x0
175CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 175CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"
176# CONFIG_XIP_KERNEL is not set 176# CONFIG_XIP_KERNEL is not set
177 177
178# 178#
diff --git a/arch/arm/configs/ixdp2401_defconfig b/arch/arm/configs/ixdp2401_defconfig
index 2dc9d499c7d7..60d66e82c51f 100644
--- a/arch/arm/configs/ixdp2401_defconfig
+++ b/arch/arm/configs/ixdp2401_defconfig
@@ -172,7 +172,7 @@ CONFIG_ALIGNMENT_TRAP=y
172# 172#
173CONFIG_ZBOOT_ROM_TEXT=0x0 173CONFIG_ZBOOT_ROM_TEXT=0x0
174CONFIG_ZBOOT_ROM_BSS=0x0 174CONFIG_ZBOOT_ROM_BSS=0x0
175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0"
176# CONFIG_XIP_KERNEL is not set 176# CONFIG_XIP_KERNEL is not set
177 177
178# 178#
diff --git a/arch/arm/configs/ixdp2801_defconfig b/arch/arm/configs/ixdp2801_defconfig
index ea8f4b478fa3..f54f3dcc5b33 100644
--- a/arch/arm/configs/ixdp2801_defconfig
+++ b/arch/arm/configs/ixdp2801_defconfig
@@ -172,7 +172,7 @@ CONFIG_ALIGNMENT_TRAP=y
172# 172#
173CONFIG_ZBOOT_ROM_TEXT=0x0 173CONFIG_ZBOOT_ROM_TEXT=0x0
174CONFIG_ZBOOT_ROM_BSS=0x0 174CONFIG_ZBOOT_ROM_BSS=0x0
175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware ixdp2x01_clock=50000000" 175CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0"
176# CONFIG_XIP_KERNEL is not set 176# CONFIG_XIP_KERNEL is not set
177 177
178# 178#
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index 1964ccd8a71f..6695b07cf1ba 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -1,11 +1,10 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.16-rc2
4# Sun Nov 13 17:41:24 2005 4# Mon Feb 6 11:17:23 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 9CONFIG_GENERIC_CALIBRATE_DELAY=y
11 10
@@ -28,27 +27,31 @@ CONFIG_SYSVIPC=y
28# CONFIG_BSD_PROCESS_ACCT is not set 27# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 28CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
31# CONFIG_HOTPLUG is not set
32CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set 30# CONFIG_IKCONFIG is not set
34CONFIG_INITRAMFS_SOURCE="" 31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_UID16=y
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y
35# CONFIG_EMBEDDED is not set 34# CONFIG_EMBEDDED is not set
36CONFIG_KALLSYMS=y 35CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_ALL is not set 36# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_HOTPLUG=y
39CONFIG_PRINTK=y 39CONFIG_PRINTK=y
40CONFIG_BUG=y 40CONFIG_BUG=y
41CONFIG_ELF_CORE=y
41CONFIG_BASE_FULL=y 42CONFIG_BASE_FULL=y
42CONFIG_FUTEX=y 43CONFIG_FUTEX=y
43CONFIG_EPOLL=y 44CONFIG_EPOLL=y
44CONFIG_CC_OPTIMIZE_FOR_SIZE=y
45CONFIG_SHMEM=y 45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0 46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0 47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0 48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0 49CONFIG_CC_ALIGN_JUMPS=0
50CONFIG_SLAB=y
50# CONFIG_TINY_SHMEM is not set 51# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0 52CONFIG_BASE_SMALL=0
53# CONFIG_SLOB is not set
54CONFIG_OBSOLETE_INTERMODULE=y
52 55
53# 56#
54# Loadable module support 57# Loadable module support
@@ -102,6 +105,7 @@ CONFIG_ARCH_S3C2410=y
102# CONFIG_ARCH_IMX is not set 105# CONFIG_ARCH_IMX is not set
103# CONFIG_ARCH_H720X is not set 106# CONFIG_ARCH_H720X is not set
104# CONFIG_ARCH_AAEC2000 is not set 107# CONFIG_ARCH_AAEC2000 is not set
108# CONFIG_ARCH_AT91RM9200 is not set
105 109
106# 110#
107# S3C24XX Implementations 111# S3C24XX Implementations
@@ -160,7 +164,6 @@ CONFIG_CPU_TLB_V4WBI=y
160# Bus support 164# Bus support
161# 165#
162CONFIG_ISA=y 166CONFIG_ISA=y
163CONFIG_ISA_DMA_API=y
164 167
165# 168#
166# PCCARD (PCMCIA/CardBus) support 169# PCCARD (PCMCIA/CardBus) support
@@ -172,6 +175,7 @@ CONFIG_ISA_DMA_API=y
172# 175#
173# CONFIG_PREEMPT is not set 176# CONFIG_PREEMPT is not set
174# CONFIG_NO_IDLE_HZ is not set 177# CONFIG_NO_IDLE_HZ is not set
178# CONFIG_AEABI is not set
175# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
176CONFIG_SELECT_MEMORY_MODEL=y 180CONFIG_SELECT_MEMORY_MODEL=y
177CONFIG_FLATMEM_MANUAL=y 181CONFIG_FLATMEM_MANUAL=y
@@ -214,6 +218,8 @@ CONFIG_BINFMT_AOUT=y
214# Power management options 218# Power management options
215# 219#
216CONFIG_PM=y 220CONFIG_PM=y
221CONFIG_PM_LEGACY=y
222# CONFIG_PM_DEBUG is not set
217CONFIG_APM=y 223CONFIG_APM=y
218 224
219# 225#
@@ -259,6 +265,11 @@ CONFIG_TCP_CONG_BIC=y
259# SCTP Configuration (EXPERIMENTAL) 265# SCTP Configuration (EXPERIMENTAL)
260# 266#
261# CONFIG_IP_SCTP is not set 267# CONFIG_IP_SCTP is not set
268
269#
270# TIPC Configuration (EXPERIMENTAL)
271#
272# CONFIG_TIPC is not set
262# CONFIG_ATM is not set 273# CONFIG_ATM is not set
263# CONFIG_BRIDGE is not set 274# CONFIG_BRIDGE is not set
264# CONFIG_VLAN_8021Q is not set 275# CONFIG_VLAN_8021Q is not set
@@ -276,7 +287,6 @@ CONFIG_TCP_CONG_BIC=y
276# QoS and/or fair queueing 287# QoS and/or fair queueing
277# 288#
278# CONFIG_NET_SCHED is not set 289# CONFIG_NET_SCHED is not set
279# CONFIG_NET_CLS_ROUTE is not set
280 290
281# 291#
282# Network testing 292# Network testing
@@ -300,6 +310,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
300# CONFIG_DEBUG_DRIVER is not set 310# CONFIG_DEBUG_DRIVER is not set
301 311
302# 312#
313# Connector - unified userspace <-> kernelspace linker
314#
315# CONFIG_CONNECTOR is not set
316
317#
303# Memory Technology Devices (MTD) 318# Memory Technology Devices (MTD)
304# 319#
305CONFIG_MTD=y 320CONFIG_MTD=y
@@ -412,8 +427,6 @@ CONFIG_PARPORT_1284=y
412# 427#
413# Block devices 428# Block devices
414# 429#
415# CONFIG_BLK_DEV_XD is not set
416# CONFIG_PARIDE is not set
417# CONFIG_BLK_DEV_COW_COMMON is not set 430# CONFIG_BLK_DEV_COW_COMMON is not set
418CONFIG_BLK_DEV_LOOP=y 431CONFIG_BLK_DEV_LOOP=y
419# CONFIG_BLK_DEV_CRYPTOLOOP is not set 432# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -502,7 +515,6 @@ CONFIG_NETDEVICES=y
502CONFIG_NET_ETHERNET=y 515CONFIG_NET_ETHERNET=y
503CONFIG_MII=y 516CONFIG_MII=y
504# CONFIG_NET_VENDOR_3COM is not set 517# CONFIG_NET_VENDOR_3COM is not set
505# CONFIG_LANCE is not set
506# CONFIG_NET_VENDOR_SMC is not set 518# CONFIG_NET_VENDOR_SMC is not set
507# CONFIG_SMC91X is not set 519# CONFIG_SMC91X is not set
508CONFIG_DM9000=y 520CONFIG_DM9000=y
@@ -607,11 +619,11 @@ CONFIG_SERIAL_NONSTANDARD=y
607# CONFIG_ROCKETPORT is not set 619# CONFIG_ROCKETPORT is not set
608# CONFIG_CYCLADES is not set 620# CONFIG_CYCLADES is not set
609# CONFIG_DIGIEPCA is not set 621# CONFIG_DIGIEPCA is not set
610# CONFIG_ESPSERIAL is not set
611# CONFIG_MOXA_INTELLIO is not set 622# CONFIG_MOXA_INTELLIO is not set
612# CONFIG_MOXA_SMARTIO is not set 623# CONFIG_MOXA_SMARTIO is not set
613# CONFIG_ISI is not set 624# CONFIG_ISI is not set
614# CONFIG_SYNCLINKMP is not set 625# CONFIG_SYNCLINKMP is not set
626# CONFIG_SYNCLINK_GT is not set
615# CONFIG_N_HDLC is not set 627# CONFIG_N_HDLC is not set
616# CONFIG_RISCOM8 is not set 628# CONFIG_RISCOM8 is not set
617# CONFIG_SPECIALIX is not set 629# CONFIG_SPECIALIX is not set
@@ -625,6 +637,7 @@ CONFIG_SERIAL_NONSTANDARD=y
625CONFIG_SERIAL_8250=y 637CONFIG_SERIAL_8250=y
626CONFIG_SERIAL_8250_CONSOLE=y 638CONFIG_SERIAL_8250_CONSOLE=y
627CONFIG_SERIAL_8250_NR_UARTS=8 639CONFIG_SERIAL_8250_NR_UARTS=8
640CONFIG_SERIAL_8250_RUNTIME_UARTS=4
628CONFIG_SERIAL_8250_EXTENDED=y 641CONFIG_SERIAL_8250_EXTENDED=y
629CONFIG_SERIAL_8250_MANY_PORTS=y 642CONFIG_SERIAL_8250_MANY_PORTS=y
630CONFIG_SERIAL_8250_SHARE_IRQ=y 643CONFIG_SERIAL_8250_SHARE_IRQ=y
@@ -687,6 +700,7 @@ CONFIG_S3C2410_RTC=y
687# 700#
688# TPM devices 701# TPM devices
689# 702#
703# CONFIG_TCG_TPM is not set
690# CONFIG_TELCLOCK is not set 704# CONFIG_TELCLOCK is not set
691 705
692# 706#
@@ -731,6 +745,12 @@ CONFIG_SENSORS_EEPROM=m
731# CONFIG_I2C_DEBUG_CHIP is not set 745# CONFIG_I2C_DEBUG_CHIP is not set
732 746
733# 747#
748# SPI support
749#
750# CONFIG_SPI is not set
751# CONFIG_SPI_MASTER is not set
752
753#
734# Hardware Monitoring support 754# Hardware Monitoring support
735# 755#
736CONFIG_HWMON=y 756CONFIG_HWMON=y
@@ -863,6 +883,7 @@ CONFIG_FS_MBCACHE=y
863# CONFIG_JFS_FS is not set 883# CONFIG_JFS_FS is not set
864# CONFIG_FS_POSIX_ACL is not set 884# CONFIG_FS_POSIX_ACL is not set
865# CONFIG_XFS_FS is not set 885# CONFIG_XFS_FS is not set
886# CONFIG_OCFS2_FS is not set
866# CONFIG_MINIX_FS is not set 887# CONFIG_MINIX_FS is not set
867CONFIG_ROMFS_FS=y 888CONFIG_ROMFS_FS=y
868CONFIG_INOTIFY=y 889CONFIG_INOTIFY=y
@@ -897,6 +918,7 @@ CONFIG_SYSFS=y
897# CONFIG_HUGETLB_PAGE is not set 918# CONFIG_HUGETLB_PAGE is not set
898CONFIG_RAMFS=y 919CONFIG_RAMFS=y
899# CONFIG_RELAYFS_FS is not set 920# CONFIG_RELAYFS_FS is not set
921# CONFIG_CONFIGFS_FS is not set
900 922
901# 923#
902# Miscellaneous filesystems 924# Miscellaneous filesystems
@@ -965,6 +987,7 @@ CONFIG_SOLARIS_X86_PARTITION=y
965# CONFIG_SGI_PARTITION is not set 987# CONFIG_SGI_PARTITION is not set
966# CONFIG_ULTRIX_PARTITION is not set 988# CONFIG_ULTRIX_PARTITION is not set
967# CONFIG_SUN_PARTITION is not set 989# CONFIG_SUN_PARTITION is not set
990# CONFIG_KARMA_PARTITION is not set
968# CONFIG_EFI_PARTITION is not set 991# CONFIG_EFI_PARTITION is not set
969 992
970# 993#
@@ -1020,12 +1043,13 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1020# Kernel hacking 1043# Kernel hacking
1021# 1044#
1022# CONFIG_PRINTK_TIME is not set 1045# CONFIG_PRINTK_TIME is not set
1023CONFIG_DEBUG_KERNEL=y
1024CONFIG_MAGIC_SYSRQ=y 1046CONFIG_MAGIC_SYSRQ=y
1047CONFIG_DEBUG_KERNEL=y
1025CONFIG_LOG_BUF_SHIFT=16 1048CONFIG_LOG_BUF_SHIFT=16
1026CONFIG_DETECT_SOFTLOCKUP=y 1049CONFIG_DETECT_SOFTLOCKUP=y
1027# CONFIG_SCHEDSTATS is not set 1050# CONFIG_SCHEDSTATS is not set
1028# CONFIG_DEBUG_SLAB is not set 1051# CONFIG_DEBUG_SLAB is not set
1052CONFIG_DEBUG_MUTEXES=y
1029# CONFIG_DEBUG_SPINLOCK is not set 1053# CONFIG_DEBUG_SPINLOCK is not set
1030# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1054# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1031# CONFIG_DEBUG_KOBJECT is not set 1055# CONFIG_DEBUG_KOBJECT is not set
@@ -1034,6 +1058,7 @@ CONFIG_DEBUG_INFO=y
1034# CONFIG_DEBUG_FS is not set 1058# CONFIG_DEBUG_FS is not set
1035# CONFIG_DEBUG_VM is not set 1059# CONFIG_DEBUG_VM is not set
1036CONFIG_FRAME_POINTER=y 1060CONFIG_FRAME_POINTER=y
1061CONFIG_FORCED_INLINING=y
1037# CONFIG_RCU_TORTURE_TEST is not set 1062# CONFIG_RCU_TORTURE_TEST is not set
1038CONFIG_DEBUG_USER=y 1063CONFIG_DEBUG_USER=y
1039# CONFIG_DEBUG_WAITQ is not set 1064# CONFIG_DEBUG_WAITQ is not set
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index d058e7c12568..8c3035d5ffc9 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -291,21 +291,21 @@
291 CALL(sys_mq_getsetattr) 291 CALL(sys_mq_getsetattr)
292/* 280 */ CALL(sys_waitid) 292/* 280 */ CALL(sys_waitid)
293 CALL(sys_socket) 293 CALL(sys_socket)
294 CALL(sys_bind) 294 CALL(ABI(sys_bind, sys_oabi_bind))
295 CALL(sys_connect) 295 CALL(ABI(sys_connect, sys_oabi_connect))
296 CALL(sys_listen) 296 CALL(sys_listen)
297/* 285 */ CALL(sys_accept) 297/* 285 */ CALL(sys_accept)
298 CALL(sys_getsockname) 298 CALL(sys_getsockname)
299 CALL(sys_getpeername) 299 CALL(sys_getpeername)
300 CALL(sys_socketpair) 300 CALL(sys_socketpair)
301 CALL(sys_send) 301 CALL(sys_send)
302/* 290 */ CALL(sys_sendto) 302/* 290 */ CALL(ABI(sys_sendto, sys_oabi_sendto))
303 CALL(sys_recv) 303 CALL(sys_recv)
304 CALL(sys_recvfrom) 304 CALL(sys_recvfrom)
305 CALL(sys_shutdown) 305 CALL(sys_shutdown)
306 CALL(sys_setsockopt) 306 CALL(sys_setsockopt)
307/* 295 */ CALL(sys_getsockopt) 307/* 295 */ CALL(sys_getsockopt)
308 CALL(sys_sendmsg) 308 CALL(ABI(sys_sendmsg, sys_oabi_sendmsg))
309 CALL(sys_recvmsg) 309 CALL(sys_recvmsg)
310 CALL(ABI(sys_semop, sys_oabi_semop)) 310 CALL(ABI(sys_semop, sys_oabi_semop))
311 CALL(sys_semget) 311 CALL(sys_semget)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d401d908c463..964cd717506b 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -333,10 +333,14 @@ __pabt_svc:
333 @ from the exception stack 333 @ from the exception stack
334 334
335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) 335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
336#ifndef CONFIG_MMU
337#warning "NPTL on non MMU needs fixing"
338#else
336 @ make sure our user space atomic helper is aborted 339 @ make sure our user space atomic helper is aborted
337 cmp r2, #TASK_SIZE 340 cmp r2, #TASK_SIZE
338 bichs r3, r3, #PSR_Z_BIT 341 bichs r3, r3, #PSR_Z_BIT
339#endif 342#endif
343#endif
340 344
341 @ 345 @
342 @ We are now ready to fill in the remaining blanks on the stack: 346 @ We are now ready to fill in the remaining blanks on the stack:
@@ -705,7 +709,12 @@ __kuser_memory_barrier: @ 0xffff0fa0
705 * The C flag is also set if *ptr was changed to allow for assembly 709 * The C flag is also set if *ptr was changed to allow for assembly
706 * optimization in the calling code. 710 * optimization in the calling code.
707 * 711 *
708 * Note: this routine already includes memory barriers as needed. 712 * Notes:
713 *
714 * - This routine already includes memory barriers as needed.
715 *
716 * - A failure might be transient, i.e. it is possible, although unlikely,
717 * that "failure" be returned even if *ptr == oldval.
709 * 718 *
710 * For example, a user space atomic_add implementation could look like this: 719 * For example, a user space atomic_add implementation could look like this:
711 * 720 *
@@ -756,12 +765,18 @@ __kuser_cmpxchg: @ 0xffff0fc0
756 * exception happening just after the str instruction which would 765 * exception happening just after the str instruction which would
757 * clear the Z flag although the exchange was done. 766 * clear the Z flag although the exchange was done.
758 */ 767 */
768#ifdef CONFIG_MMU
759 teq ip, ip @ set Z flag 769 teq ip, ip @ set Z flag
760 ldr ip, [r2] @ load current val 770 ldr ip, [r2] @ load current val
761 add r3, r2, #1 @ prepare store ptr 771 add r3, r2, #1 @ prepare store ptr
762 teqeq ip, r0 @ compare with oldval if still allowed 772 teqeq ip, r0 @ compare with oldval if still allowed
763 streq r1, [r3, #-1]! @ store newval if still allowed 773 streq r1, [r3, #-1]! @ store newval if still allowed
764 subs r0, r2, r3 @ if r2 == r3 the str occured 774 subs r0, r2, r3 @ if r2 == r3 the str occured
775#else
776#warning "NPTL on non MMU needs fixing"
777 mov r0, #-1
778 adds r0, r0, #0
779#endif
765 mov pc, lr 780 mov pc, lr
766 781
767#else 782#else
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index eafa8e5284af..9d4b76409c64 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -59,6 +59,16 @@
59 * struct sembuf loses its padding with EABI. Since arrays of them are 59 * struct sembuf loses its padding with EABI. Since arrays of them are
60 * used they have to be copyed to remove the padding. Compatibility wrappers 60 * used they have to be copyed to remove the padding. Compatibility wrappers
61 * provided below. 61 * provided below.
62 *
63 * sys_bind:
64 * sys_connect:
65 * sys_sendmsg:
66 * sys_sendto:
67 *
68 * struct sockaddr_un loses its padding with EABI. Since the size of the
69 * structure is used as a validation test in unix_mkname(), we need to
70 * change the length argument to 110 whenever it is 112. Compatibility
71 * wrappers provided below.
62 */ 72 */
63 73
64#include <linux/syscalls.h> 74#include <linux/syscalls.h>
@@ -67,6 +77,7 @@
67#include <linux/fcntl.h> 77#include <linux/fcntl.h>
68#include <linux/eventpoll.h> 78#include <linux/eventpoll.h>
69#include <linux/sem.h> 79#include <linux/sem.h>
80#include <linux/socket.h>
70#include <asm/ipc.h> 81#include <asm/ipc.h>
71#include <asm/uaccess.h> 82#include <asm/uaccess.h>
72 83
@@ -337,3 +348,63 @@ asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
337 return sys_ipc(call, first, second, third, ptr, fifth); 348 return sys_ipc(call, first, second, third, ptr, fifth);
338 } 349 }
339} 350}
351
352asmlinkage long sys_oabi_bind(int fd, struct sockaddr __user *addr, int addrlen)
353{
354 sa_family_t sa_family;
355 if (addrlen == 112 &&
356 get_user(sa_family, &addr->sa_family) == 0 &&
357 sa_family == AF_UNIX)
358 addrlen = 110;
359 return sys_bind(fd, addr, addrlen);
360}
361
362asmlinkage long sys_oabi_connect(int fd, struct sockaddr __user *addr, int addrlen)
363{
364 sa_family_t sa_family;
365 if (addrlen == 112 &&
366 get_user(sa_family, &addr->sa_family) == 0 &&
367 sa_family == AF_UNIX)
368 addrlen = 110;
369 return sys_connect(fd, addr, addrlen);
370}
371
372asmlinkage long sys_oabi_sendto(int fd, void __user *buff,
373 size_t len, unsigned flags,
374 struct sockaddr __user *addr,
375 int addrlen)
376{
377 sa_family_t sa_family;
378 if (addrlen == 112 &&
379 get_user(sa_family, &addr->sa_family) == 0 &&
380 sa_family == AF_UNIX)
381 addrlen = 110;
382 return sys_sendto(fd, buff, len, flags, addr, addrlen);
383}
384
385asmlinkage long sys_oabi_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
386{
387 struct sockaddr __user *addr;
388 int msg_namelen;
389 sa_family_t sa_family;
390 if (msg &&
391 get_user(msg_namelen, &msg->msg_namelen) == 0 &&
392 msg_namelen == 112 &&
393 get_user(addr, &msg->msg_name) == 0 &&
394 get_user(sa_family, &addr->sa_family) == 0 &&
395 sa_family == AF_UNIX)
396 {
397 /*
398 * HACK ALERT: there is a limit to how much backward bending
399 * we should do for what is actually a transitional
400 * compatibility layer. This already has known flaws with
401 * a few ioctls that we don't intend to fix. Therefore
402 * consider this blatent hack as another one... and take care
403 * to run for cover. In most cases it will "just work fine".
404 * If it doesn't, well, tough.
405 */
406 put_user(110, &msg->msg_namelen);
407 }
408 return sys_sendmsg(fd, msg, flags);
409}
410
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index 0793dcf54f2e..0e2b641268ad 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -24,6 +24,8 @@ config ARCH_CEIVA
24 24
25config ARCH_CLEP7312 25config ARCH_CLEP7312
26 bool "CLEP7312" 26 bool "CLEP7312"
27 help
28 Boards based on the Cirrus Logic 7212/7312 chips.
27 29
28config ARCH_EDB7211 30config ARCH_EDB7211
29 bool "EDB7211" 31 bool "EDB7211"
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index dc31e3fd6c57..8ab1b040288c 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -27,7 +27,6 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include "generic.h" 29#include "generic.h"
30#include <asm/serial.h>
31 30
32static struct resource cs89x0_resources[] = { 31static struct resource cs89x0_resources[] = {
33 [0] = { 32 [0] = {
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index 9e5a13bb39d0..52fac89e95b5 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -106,6 +106,7 @@ static void __init enp2611_pci_preinit(void)
106{ 106{
107 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000); 107 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
108 ixp2000_pci_preinit(); 108 ixp2000_pci_preinit();
109 pcibios_setup("firmware");
109} 110}
110 111
111static inline int enp2611_pci_valid_device(struct pci_bus *bus, 112static inline int enp2611_pci_valid_device(struct pci_bus *bus,
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index 7c782403042a..09101271298e 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -68,6 +68,7 @@ void __init ixdp2400_pci_preinit(void)
68{ 68{
69 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000); 69 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
70 ixp2000_pci_preinit(); 70 ixp2000_pci_preinit();
71 pcibios_setup("firmware");
71} 72}
72 73
73int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys) 74int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys)
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index 10f06606d460..150519fb38ec 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -212,6 +212,7 @@ void __init ixdp2x01_pci_preinit(void)
212{ 212{
213 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00000000); 213 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00000000);
214 ixp2000_pci_preinit(); 214 ixp2000_pci_preinit();
215 pcibios_setup("firmware");
215} 216}
216 217
217#define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) 218#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
@@ -299,7 +300,9 @@ struct hw_pci ixdp2x01_pci __initdata = {
299 300
300int __init ixdp2x01_pci_init(void) 301int __init ixdp2x01_pci_init(void)
301{ 302{
302 pci_common_init(&ixdp2x01_pci); 303 if (machine_is_ixdp2401() || machine_is_ixdp2801())
304 pci_common_init(&ixdp2x01_pci);
305
303 return 0; 306 return 0;
304} 307}
305 308
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index bdc20b51b076..a177e78b2b87 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -30,6 +30,7 @@
30 30
31static void __init omap_generic_init_irq(void) 31static void __init omap_generic_init_irq(void)
32{ 32{
33 omap1_init_common_hw();
33 omap_init_irq(); 34 omap_init_irq();
34} 35}
35 36
@@ -104,7 +105,7 @@ static void __init omap_generic_init(void)
104 105
105static void __init omap_generic_map_io(void) 106static void __init omap_generic_map_io(void)
106{ 107{
107 omap_map_common_io(); 108 omap1_map_common_io();
108} 109}
109 110
110MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 111MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 9533c36a92df..89f0cc74a519 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -128,6 +128,7 @@ static void __init h2_init_smc91x(void)
128 128
129static void __init h2_init_irq(void) 129static void __init h2_init_irq(void)
130{ 130{
131 omap1_init_common_hw();
131 omap_init_irq(); 132 omap_init_irq();
132 omap_gpio_init(); 133 omap_gpio_init();
133 h2_init_smc91x(); 134 h2_init_smc91x();
@@ -194,7 +195,7 @@ static void __init h2_init(void)
194 195
195static void __init h2_map_io(void) 196static void __init h2_map_io(void)
196{ 197{
197 omap_map_common_io(); 198 omap1_map_common_io();
198} 199}
199 200
200MACHINE_START(OMAP_H2, "TI-H2") 201MACHINE_START(OMAP_H2, "TI-H2")
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index d665efc1c344..d9f386265996 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -203,6 +203,7 @@ static void __init h3_init_smc91x(void)
203 203
204void h3_init_irq(void) 204void h3_init_irq(void)
205{ 205{
206 omap1_init_common_hw();
206 omap_init_irq(); 207 omap_init_irq();
207 omap_gpio_init(); 208 omap_gpio_init();
208 h3_init_smc91x(); 209 h3_init_smc91x();
@@ -210,7 +211,7 @@ void h3_init_irq(void)
210 211
211static void __init h3_map_io(void) 212static void __init h3_map_io(void)
212{ 213{
213 omap_map_common_io(); 214 omap1_map_common_io();
214} 215}
215 216
216MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") 217MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 652f37c7f906..a04e4332915e 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -181,6 +181,7 @@ static void __init innovator_init_smc91x(void)
181 181
182void innovator_init_irq(void) 182void innovator_init_irq(void)
183{ 183{
184 omap1_init_common_hw();
184 omap_init_irq(); 185 omap_init_irq();
185 omap_gpio_init(); 186 omap_gpio_init();
186#ifdef CONFIG_ARCH_OMAP15XX 187#ifdef CONFIG_ARCH_OMAP15XX
@@ -285,7 +286,7 @@ static void __init innovator_init(void)
285 286
286static void __init innovator_map_io(void) 287static void __init innovator_map_io(void)
287{ 288{
288 omap_map_common_io(); 289 omap1_map_common_io();
289 290
290#ifdef CONFIG_ARCH_OMAP15XX 291#ifdef CONFIG_ARCH_OMAP15XX
291 if (cpu_is_omap1510()) { 292 if (cpu_is_omap1510()) {
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 58f783930d45..60d5f8a3339c 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -65,6 +65,7 @@ static struct omap_board_config_kernel netstar_config[] = {
65 65
66static void __init netstar_init_irq(void) 66static void __init netstar_init_irq(void)
67{ 67{
68 omap1_init_common_hw();
68 omap_init_irq(); 69 omap_init_irq();
69 omap_gpio_init(); 70 omap_gpio_init();
70} 71}
@@ -108,7 +109,7 @@ static void __init netstar_init(void)
108 109
109static void __init netstar_map_io(void) 110static void __init netstar_map_io(void)
110{ 111{
111 omap_map_common_io(); 112 omap1_map_common_io();
112} 113}
113 114
114#define MACHINE_PANICED 1 115#define MACHINE_PANICED 1
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index e5d126e8f276..543fa136106d 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -169,6 +169,7 @@ static void __init osk_init_cf(void)
169 169
170static void __init osk_init_irq(void) 170static void __init osk_init_irq(void)
171{ 171{
172 omap1_init_common_hw();
172 omap_init_irq(); 173 omap_init_irq();
173 omap_gpio_init(); 174 omap_gpio_init();
174 osk_init_smc91x(); 175 osk_init_smc91x();
@@ -269,7 +270,7 @@ static void __init osk_init(void)
269 270
270static void __init osk_map_io(void) 271static void __init osk_map_io(void)
271{ 272{
272 omap_map_common_io(); 273 omap1_map_common_io();
273} 274}
274 275
275MACHINE_START(OMAP_OSK, "TI-OSK") 276MACHINE_START(OMAP_OSK, "TI-OSK")
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 67fada207622..e488f7236775 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -34,6 +34,7 @@
34 34
35static void __init omap_generic_init_irq(void) 35static void __init omap_generic_init_irq(void)
36{ 36{
37 omap1_init_common_hw();
37 omap_init_irq(); 38 omap_init_irq();
38} 39}
39 40
@@ -72,7 +73,7 @@ static void __init omap_generic_init(void)
72 73
73static void __init omap_generic_map_io(void) 74static void __init omap_generic_map_io(void)
74{ 75{
75 omap_map_common_io(); 76 omap1_map_common_io();
76} 77}
77 78
78MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") 79MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 88708a0c52a2..3913a3cc0ce6 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -144,6 +144,7 @@ static void __init perseus2_init_smc91x(void)
144 144
145void omap_perseus2_init_irq(void) 145void omap_perseus2_init_irq(void)
146{ 146{
147 omap1_init_common_hw();
147 omap_init_irq(); 148 omap_init_irq();
148 omap_gpio_init(); 149 omap_gpio_init();
149 perseus2_init_smc91x(); 150 perseus2_init_smc91x();
@@ -160,7 +161,7 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
160 161
161static void __init omap_perseus2_map_io(void) 162static void __init omap_perseus2_map_io(void)
162{ 163{
163 omap_map_common_io(); 164 omap1_map_common_io();
164 iotable_init(omap_perseus2_io_desc, 165 iotable_init(omap_perseus2_io_desc,
165 ARRAY_SIZE(omap_perseus2_io_desc)); 166 ARRAY_SIZE(omap_perseus2_io_desc));
166 167
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 959b4b847c87..bfd5fdd1a875 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -162,6 +162,7 @@ static struct omap_board_config_kernel voiceblue_config[] = {
162 162
163static void __init voiceblue_init_irq(void) 163static void __init voiceblue_init_irq(void)
164{ 164{
165 omap1_init_common_hw();
165 omap_init_irq(); 166 omap_init_irq();
166 omap_gpio_init(); 167 omap_gpio_init();
167} 168}
@@ -206,7 +207,7 @@ static void __init voiceblue_init(void)
206 207
207static void __init voiceblue_map_io(void) 208static void __init voiceblue_map_io(void)
208{ 209{
209 omap_map_common_io(); 210 omap1_map_common_io();
210} 211}
211 212
212#define MACHINE_PANICED 1 213#define MACHINE_PANICED 1
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index a7a19f75b9e1..82d556be79c5 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16#include <asm/tlb.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/arch/mux.h> 19#include <asm/arch/mux.h>
@@ -83,15 +84,24 @@ static struct map_desc omap16xx_io_desc[] __initdata = {
83}; 84};
84#endif 85#endif
85 86
86static int initialized = 0; 87/*
87 88 * Maps common IO regions for omap1. This should only get called from
88static void __init _omap_map_io(void) 89 * board specific init.
90 */
91void __init omap1_map_common_io(void)
89{ 92{
90 initialized = 1;
91
92 /* We have to initialize the IO space mapping before we can run
93 * cpu_is_omapxxx() macros. */
94 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); 93 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
94
95 /* Normally devicemaps_init() would flush caches and tlb after
96 * mdesc->map_io(), but we must also do it here because of the CPU
97 * revision check below.
98 */
99 local_flush_tlb_all();
100 flush_cache_all();
101
102 /* We want to check CPU revision early for cpu_is_omapxxxx() macros.
103 * IO space mapping must be initialized before we can do that.
104 */
95 omap_check_revision(); 105 omap_check_revision();
96 106
97#ifdef CONFIG_ARCH_OMAP730 107#ifdef CONFIG_ARCH_OMAP730
@@ -111,7 +121,14 @@ static void __init _omap_map_io(void)
111#endif 121#endif
112 122
113 omap_sram_init(); 123 omap_sram_init();
124}
114 125
126/*
127 * Common low-level hardware init for omap1. This should only get called from
128 * board specific init.
129 */
130void __init omap1_init_common_hw()
131{
115 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 132 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
116 * on a Posted Write in the TIPB Bridge". 133 * on a Posted Write in the TIPB Bridge".
117 */ 134 */
@@ -121,16 +138,7 @@ static void __init _omap_map_io(void)
121 /* Must init clocks early to assure that timer interrupt works 138 /* Must init clocks early to assure that timer interrupt works
122 */ 139 */
123 omap1_clk_init(); 140 omap1_clk_init();
124}
125 141
126/* 142 omap1_mux_init();
127 * This should only get called from board specific init
128 */
129void __init omap_map_common_io(void)
130{
131 if (!initialized) {
132 _omap_map_io();
133 omap1_mux_init();
134 }
135} 143}
136 144
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index b937123e5c65..eaecbf422d8c 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -33,6 +33,7 @@
33 33
34static void __init omap_generic_init_irq(void) 34static void __init omap_generic_init_irq(void)
35{ 35{
36 omap2_init_common_hw();
36 omap_init_irq(); 37 omap_init_irq();
37} 38}
38 39
@@ -64,7 +65,7 @@ static void __init omap_generic_init(void)
64 65
65static void __init omap_generic_map_io(void) 66static void __init omap_generic_map_io(void)
66{ 67{
67 omap_map_common_io(); 68 omap2_map_common_io();
68} 69}
69 70
70MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") 71MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index c3c35d40378a..a300d634d8a5 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -136,6 +136,7 @@ static inline void __init h4_init_smc91x(void)
136 136
137static void __init omap_h4_init_irq(void) 137static void __init omap_h4_init_irq(void)
138{ 138{
139 omap2_init_common_hw();
139 omap_init_irq(); 140 omap_init_irq();
140 omap_gpio_init(); 141 omap_gpio_init();
141 h4_init_smc91x(); 142 h4_init_smc91x();
@@ -181,7 +182,7 @@ static void __init omap_h4_init(void)
181 182
182static void __init omap_h4_map_io(void) 183static void __init omap_h4_map_io(void)
183{ 184{
184 omap_map_common_io(); 185 omap2_map_common_io();
185} 186}
186 187
187MACHINE_START(OMAP_H4, "OMAP2420 H4 board") 188MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 4a222f59f2cf..4303d988c4bf 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -182,7 +182,7 @@ static const struct icst307_params realview_oscvco_params = {
182static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) 182static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
183{ 183{
184 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; 184 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
185 void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC1_OFFSET; 185 void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
186 u32 val; 186 u32 val;
187 187
188 val = readl(sys_osc) & ~0x7ffff; 188 val = readl(sys_osc) & ~0x7ffff;
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index af2f3d52b61b..08489efdaf06 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -40,7 +40,6 @@
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41 41
42#include <asm/hardware.h> 42#include <asm/hardware.h>
43#include <asm/atomic.h>
44#include <asm/irq.h> 43#include <asm/irq.h>
45#include <asm/io.h> 44#include <asm/io.h>
46 45
@@ -59,22 +58,18 @@ static DEFINE_MUTEX(clocks_mutex);
59void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable) 58void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable)
60{ 59{
61 unsigned long clkcon; 60 unsigned long clkcon;
62 unsigned long flags;
63
64 local_irq_save(flags);
65 61
66 clkcon = __raw_readl(S3C2410_CLKCON); 62 clkcon = __raw_readl(S3C2410_CLKCON);
67 clkcon &= ~clocks;
68 63
69 if (enable) 64 if (enable)
70 clkcon |= clocks; 65 clkcon |= clocks;
66 else
67 clkcon &= ~clocks;
71 68
72 /* ensure none of the special function bits set */ 69 /* ensure none of the special function bits set */
73 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER); 70 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);
74 71
75 __raw_writel(clkcon, S3C2410_CLKCON); 72 __raw_writel(clkcon, S3C2410_CLKCON);
76
77 local_irq_restore(flags);
78} 73}
79 74
80/* enable and disable calls for use with the clk struct */ 75/* enable and disable calls for use with the clk struct */
@@ -138,16 +133,32 @@ void clk_put(struct clk *clk)
138 133
139int clk_enable(struct clk *clk) 134int clk_enable(struct clk *clk)
140{ 135{
141 if (IS_ERR(clk)) 136 if (IS_ERR(clk) || clk == NULL)
142 return -EINVAL; 137 return -EINVAL;
143 138
144 return (clk->enable)(clk, 1); 139 clk_enable(clk->parent);
140
141 mutex_lock(&clocks_mutex);
142
143 if ((clk->usage++) == 0)
144 (clk->enable)(clk, 1);
145
146 mutex_unlock(&clocks_mutex);
147 return 0;
145} 148}
146 149
147void clk_disable(struct clk *clk) 150void clk_disable(struct clk *clk)
148{ 151{
149 if (!IS_ERR(clk)) 152 if (IS_ERR(clk) || clk == NULL)
153 return;
154
155 mutex_lock(&clocks_mutex);
156
157 if ((--clk->usage) == 0)
150 (clk->enable)(clk, 0); 158 (clk->enable)(clk, 0);
159
160 mutex_unlock(&clocks_mutex);
161 clk_disable(clk->parent);
151} 162}
152 163
153 164
@@ -361,6 +372,14 @@ int s3c24xx_register_clock(struct clk *clk)
361 if (clk->enable == NULL) 372 if (clk->enable == NULL)
362 clk->enable = clk_null_enable; 373 clk->enable = clk_null_enable;
363 374
375 /* if this is a standard clock, set the usage state */
376
377 if (clk->ctrlbit) {
378 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
379
380 clk->usage = (clkcon & clk->ctrlbit) ? 1 : 0;
381 }
382
364 /* add to the list of available clocks */ 383 /* add to the list of available clocks */
365 384
366 mutex_lock(&clocks_mutex); 385 mutex_lock(&clocks_mutex);
@@ -402,6 +421,8 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
402 * the LCD clock if it is not needed. 421 * the LCD clock if it is not needed.
403 */ 422 */
404 423
424 mutex_lock(&clocks_mutex);
425
405 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0); 426 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0);
406 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0); 427 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0);
407 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0); 428 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0);
@@ -409,6 +430,8 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
409 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0); 430 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0);
410 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0); 431 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0);
411 432
433 mutex_unlock(&clocks_mutex);
434
412 /* assume uart clocks are correctly setup */ 435 /* assume uart clocks are correctly setup */
413 436
414 /* register our clocks */ 437 /* register our clocks */
diff --git a/arch/arm/mach-s3c2410/clock.h b/arch/arm/mach-s3c2410/clock.h
index 177d5c8decf7..eb5c95d1e7f2 100644
--- a/arch/arm/mach-s3c2410/clock.h
+++ b/arch/arm/mach-s3c2410/clock.h
@@ -16,6 +16,7 @@ struct clk {
16 struct clk *parent; 16 struct clk *parent;
17 const char *name; 17 const char *name;
18 int id; 18 int id;
19 int usage;
19 unsigned long rate; 20 unsigned long rate;
20 unsigned long ctrlbit; 21 unsigned long ctrlbit;
21 int (*enable)(struct clk *, int enable); 22 int (*enable)(struct clk *, int enable);
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c
index b8d994a24d1c..0a47d38789a5 100644
--- a/arch/arm/mach-s3c2410/devs.c
+++ b/arch/arm/mach-s3c2410/devs.c
@@ -275,6 +275,11 @@ static struct resource s3c_adc_resource[] = {
275 }, 275 },
276 [1] = { 276 [1] = {
277 .start = IRQ_TC, 277 .start = IRQ_TC,
278 .end = IRQ_TC,
279 .flags = IORESOURCE_IRQ,
280 },
281 [2] = {
282 .start = IRQ_ADC,
278 .end = IRQ_ADC, 283 .end = IRQ_ADC,
279 .flags = IORESOURCE_IRQ, 284 .flags = IORESOURCE_IRQ,
280 } 285 }
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 792f66375830..ee82763b02b8 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <asm/tlb.h>
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
22 23
@@ -96,6 +97,14 @@ void __init omap_map_sram(void)
96 omap_sram_io_desc[0].length); 97 omap_sram_io_desc[0].length);
97 98
98 /* 99 /*
100 * Normally devicemaps_init() would flush caches and tlb after
101 * mdesc->map_io(), but since we're called from map_io(), we
102 * must do it here.
103 */
104 local_flush_tlb_all();
105 flush_cache_all();
106
107 /*
99 * Looks like we need to preserve some bootloader code at the 108 * Looks like we need to preserve some bootloader code at the
100 * beginning of SRAM for jumping to flash for reboot to work... 109 * beginning of SRAM for jumping to flash for reboot to work...
101 */ 110 */
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index ea65d585cf5e..ee114699ef8e 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -119,7 +119,7 @@ $(SRC_ARCH)/.links:
119 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib 119 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
120 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch 120 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
121 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S 121 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
122 @ln -sfn $(SRC_ARCH)/$(SARCH)/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c 122 @ln -sfn $(SRC_ARCH)/$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
123 @touch $@ 123 @touch $@
124 124
125# Create link to sub arch includes 125# Create link to sub arch includes
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index f214f74f264e..961c0d58ded4 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -202,18 +202,18 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
202 int i; 202 int i;
203 unsigned long tmp; 203 unsigned long tmp;
204 204
205 ret = 0;
205 for (i = 0; i <= PT_MAX; i++) { 206 for (i = 0; i <= PT_MAX; i++) {
206 tmp = get_reg(child, i); 207 tmp = get_reg(child, i);
207 208
208 if (put_user(tmp, datap)) { 209 if (put_user(tmp, datap)) {
209 ret = -EFAULT; 210 ret = -EFAULT;
210 goto out_tsk; 211 break;
211 } 212 }
212 213
213 data += sizeof(long); 214 data += sizeof(long);
214 } 215 }
215 216
216 ret = 0;
217 break; 217 break;
218 } 218 }
219 219
@@ -222,10 +222,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
222 int i; 222 int i;
223 unsigned long tmp; 223 unsigned long tmp;
224 224
225 ret = 0;
225 for (i = 0; i <= PT_MAX; i++) { 226 for (i = 0; i <= PT_MAX; i++) {
226 if (get_user(tmp, datap)) { 227 if (get_user(tmp, datap)) {
227 ret = -EFAULT; 228 ret = -EFAULT;
228 goto out_tsk; 229 break;
229 } 230 }
230 231
231 if (i == PT_DCCR) { 232 if (i == PT_DCCR) {
@@ -237,7 +238,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
237 data += sizeof(long); 238 data += sizeof(long);
238 } 239 }
239 240
240 ret = 0;
241 break; 241 break;
242 } 242 }
243 243
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index d11206e467ab..1ba57efff60d 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -24,7 +24,6 @@
24/* 24/*
25 * Setup options 25 * Setup options
26 */ 26 */
27struct drive_info_struct { char dummy[32]; } drive_info;
28struct screen_info screen_info; 27struct screen_info screen_info;
29 28
30extern int root_mountflags; 29extern int root_mountflags;
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 98a5c23cf3df..f39e09ef64ec 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -77,7 +77,7 @@ void ack_bad_irq(unsigned int irq)
77 * completely. 77 * completely.
78 * But only ack when the APIC is enabled -AK 78 * But only ack when the APIC is enabled -AK
79 */ 79 */
80 if (!cpu_has_apic) 80 if (cpu_has_apic)
81 ack_APIC_irq(); 81 ack_APIC_irq();
82} 82}
83 83
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 255adb498268..fb00ab7b7612 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -87,11 +87,7 @@ EXPORT_SYMBOL(cpu_online_map);
87cpumask_t cpu_callin_map; 87cpumask_t cpu_callin_map;
88cpumask_t cpu_callout_map; 88cpumask_t cpu_callout_map;
89EXPORT_SYMBOL(cpu_callout_map); 89EXPORT_SYMBOL(cpu_callout_map);
90#ifdef CONFIG_HOTPLUG_CPU
91cpumask_t cpu_possible_map = CPU_MASK_ALL;
92#else
93cpumask_t cpu_possible_map; 90cpumask_t cpu_possible_map;
94#endif
95EXPORT_SYMBOL(cpu_possible_map); 91EXPORT_SYMBOL(cpu_possible_map);
96static cpumask_t smp_commenced_mask; 92static cpumask_t smp_commenced_mask;
97 93
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 1b665928336b..5a8b3fb6d27b 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -309,3 +309,4 @@ ENTRY(sys_call_table)
309 .long sys_faccessat 309 .long sys_faccessat
310 .long sys_pselect6 310 .long sys_pselect6
311 .long sys_ppoll 311 .long sys_ppoll
312 .long sys_unshare /* 310 */
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 72a1b9cae2e4..6e4c3baef6cc 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -240,7 +240,7 @@ static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
240cpumask_t cpu_callin_map = CPU_MASK_NONE; 240cpumask_t cpu_callin_map = CPU_MASK_NONE;
241cpumask_t cpu_callout_map = CPU_MASK_NONE; 241cpumask_t cpu_callout_map = CPU_MASK_NONE;
242EXPORT_SYMBOL(cpu_callout_map); 242EXPORT_SYMBOL(cpu_callout_map);
243cpumask_t cpu_possible_map = CPU_MASK_ALL; 243cpumask_t cpu_possible_map = CPU_MASK_NONE;
244EXPORT_SYMBOL(cpu_possible_map); 244EXPORT_SYMBOL(cpu_possible_map);
245 245
246/* The per processor IRQ masks (these are usually kept in sync) */ 246/* The per processor IRQ masks (these are usually kept in sync) */
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 199eeaf0f4e3..845cd0902a50 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -194,7 +194,6 @@ config IA64_L1_CACHE_SHIFT
194 default "7" if MCKINLEY 194 default "7" if MCKINLEY
195 default "6" if ITANIUM 195 default "6" if ITANIUM
196 196
197# align cache-sensitive data to 64 bytes
198config IA64_CYCLONE 197config IA64_CYCLONE
199 bool "Cyclone (EXA) Time Source support" 198 bool "Cyclone (EXA) Time Source support"
200 help 199 help
@@ -374,6 +373,9 @@ config IA64_PALINFO
374 To use this option, you have to ensure that the "/proc file system 373 To use this option, you have to ensure that the "/proc file system
375 support" (CONFIG_PROC_FS) is enabled, too. 374 support" (CONFIG_PROC_FS) is enabled, too.
376 375
376config SGI_SN
377 def_bool y if (IA64_SGI_SN2 || IA64_GENERIC)
378
377source "drivers/firmware/Kconfig" 379source "drivers/firmware/Kconfig"
378 380
379source "fs/Kconfig.binfmt" 381source "fs/Kconfig.binfmt"
diff --git a/arch/ia64/dig/setup.c b/arch/ia64/dig/setup.c
index d58003f1ad02..c9104bfff667 100644
--- a/arch/ia64/dig/setup.c
+++ b/arch/ia64/dig/setup.c
@@ -25,16 +25,6 @@
25#include <asm/machvec.h> 25#include <asm/machvec.h>
26#include <asm/system.h> 26#include <asm/system.h>
27 27
28/*
29 * This is here so we can use the CMOS detection in ide-probe.c to
30 * determine what drives are present. In theory, we don't need this
31 * as the auto-detection could be done via ide-probe.c:do_probe() but
32 * in practice that would be much slower, which is painful when
33 * running in the simulator. Note that passing zeroes in DRIVE_INFO
34 * is sufficient (the IDE driver will autodetect the drive geometry).
35 */
36char drive_info[4*16];
37
38void __init 28void __init
39dig_setup (char **cmdline_p) 29dig_setup (char **cmdline_p)
40{ 30{
diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
index 5856510210fa..b3355a9ca2c3 100644
--- a/arch/ia64/ia32/ia32_signal.c
+++ b/arch/ia64/ia32/ia32_signal.c
@@ -515,6 +515,7 @@ sys32_signal (int sig, unsigned int handler)
515 515
516 sigact_set_handler(&new_sa, handler, 0); 516 sigact_set_handler(&new_sa, handler, 0);
517 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK; 517 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
518 sigemptyset(&new_sa.sa.sa_mask);
518 519
519 ret = do_sigaction(sig, &new_sa, &old_sa); 520 ret = do_sigaction(sig, &new_sa, &old_sa);
520 521
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index c485a3b32ba8..9990320b6f9a 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -410,24 +410,16 @@ efi_init (void)
410 efi_config_table_t *config_tables; 410 efi_config_table_t *config_tables;
411 efi_char16_t *c16; 411 efi_char16_t *c16;
412 u64 efi_desc_size; 412 u64 efi_desc_size;
413 char *cp, *end, vendor[100] = "unknown"; 413 char *cp, vendor[100] = "unknown";
414 extern char saved_command_line[]; 414 extern char saved_command_line[];
415 int i; 415 int i;
416 416
417 /* it's too early to be able to use the standard kernel command line support... */ 417 /* it's too early to be able to use the standard kernel command line support... */
418 for (cp = saved_command_line; *cp; ) { 418 for (cp = saved_command_line; *cp; ) {
419 if (memcmp(cp, "mem=", 4) == 0) { 419 if (memcmp(cp, "mem=", 4) == 0) {
420 cp += 4; 420 mem_limit = memparse(cp + 4, &cp);
421 mem_limit = memparse(cp, &end);
422 if (end != cp)
423 break;
424 cp = end;
425 } else if (memcmp(cp, "max_addr=", 9) == 0) { 421 } else if (memcmp(cp, "max_addr=", 9) == 0) {
426 cp += 9; 422 max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
427 max_addr = GRANULEROUNDDOWN(memparse(cp, &end));
428 if (end != cp)
429 break;
430 cp = end;
431 } else { 423 } else {
432 while (*cp != ' ' && *cp) 424 while (*cp != ' ' && *cp)
433 ++cp; 425 ++cp;
@@ -458,7 +450,7 @@ efi_init (void)
458 /* Show what we know for posterity */ 450 /* Show what we know for posterity */
459 c16 = __va(efi.systab->fw_vendor); 451 c16 = __va(efi.systab->fw_vendor);
460 if (c16) { 452 if (c16) {
461 for (i = 0;i < (int) sizeof(vendor) && *c16; ++i) 453 for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)
462 vendor[i] = *c16++; 454 vendor[i] = *c16++;
463 vendor[i] = '\0'; 455 vendor[i] = '\0';
464 } 456 }
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 7a6ffd613789..27b222c277e4 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1601,5 +1601,21 @@ sys_call_table:
1601 data8 sys_inotify_add_watch 1601 data8 sys_inotify_add_watch
1602 data8 sys_inotify_rm_watch 1602 data8 sys_inotify_rm_watch
1603 data8 sys_migrate_pages // 1280 1603 data8 sys_migrate_pages // 1280
1604 data8 sys_openat
1605 data8 sys_mkdirat
1606 data8 sys_mknodat
1607 data8 sys_fchownat
1608 data8 sys_futimesat // 1285
1609 data8 sys_newfstatat
1610 data8 sys_unlinkat
1611 data8 sys_renameat
1612 data8 sys_linkat
1613 data8 sys_symlinkat // 1290
1614 data8 sys_readlinkat
1615 data8 sys_fchmodat
1616 data8 sys_faccessat
1617 data8 sys_ni_syscall // reserved for pselect
1618 data8 sys_ni_syscall // 1295 reserved for ppoll
1619 data8 sys_unshare
1604 1620
1605 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1621 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index ce423910ca97..ac6055c83115 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -878,31 +878,8 @@ fsyscall_table:
878 data8 0 // timer_delete 878 data8 0 // timer_delete
879 data8 0 // clock_settime 879 data8 0 // clock_settime
880 data8 fsys_clock_gettime // clock_gettime 880 data8 fsys_clock_gettime // clock_gettime
881 data8 0 // clock_getres // 1255 881 #define __NR_syscall_last 1255
882 data8 0 // clock_nanosleep 882
883 data8 0 // fstatfs64 883 .space 8*(NR_syscalls + 1024 - __NR_syscall_last), 0
884 data8 0 // statfs64
885 data8 0
886 data8 0 // 1260
887 data8 0
888 data8 0 // mq_open
889 data8 0 // mq_unlink
890 data8 0 // mq_timedsend
891 data8 0 // mq_timedreceive // 1265
892 data8 0 // mq_notify
893 data8 0 // mq_getsetattr
894 data8 0 // kexec_load
895 data8 0
896 data8 0 // 1270
897 data8 0
898 data8 0
899 data8 0
900 data8 0
901 data8 0 // 1275
902 data8 0
903 data8 0
904 data8 0
905 data8 0
906 data8 0 // 1280
907 884
908 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 885 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index fbc7ea35dd57..f1778a84ea61 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -352,6 +352,7 @@ start_ap:
352 mov ar.rsc=0 // place RSE in enforced lazy mode 352 mov ar.rsc=0 // place RSE in enforced lazy mode
353 ;; 353 ;;
354 loadrs // clear the dirty partition 354 loadrs // clear the dirty partition
355 mov IA64_KR(PER_CPU_DATA)=r0 // clear physical per-CPU base
355 ;; 356 ;;
356 mov ar.bspstore=r2 // establish the new RSE stack 357 mov ar.bspstore=r2 // establish the new RSE stack
357 ;; 358 ;;
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index 3492e3211a44..8fd93afa75a7 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -437,6 +437,9 @@ recover_from_read_error(slidx_table_t *slidx,
437 * the process not have any locks of kernel. 437 * the process not have any locks of kernel.
438 */ 438 */
439 439
440 /* Is minstate valid? */
441 if (!peidx_bottom(peidx) || !(peidx_bottom(peidx)->valid.minstate))
442 return 0;
440 psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr); 443 psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr);
441 444
442 /* 445 /*
diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
index acc0f132f86c..056f7a6eedc7 100644
--- a/arch/ia64/kernel/sal.c
+++ b/arch/ia64/kernel/sal.c
@@ -14,6 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/string.h> 15#include <linux/string.h>
16 16
17#include <asm/delay.h>
17#include <asm/page.h> 18#include <asm/page.h>
18#include <asm/sal.h> 19#include <asm/sal.h>
19#include <asm/pal.h> 20#include <asm/pal.h>
@@ -214,6 +215,78 @@ chk_nointroute_opt(void)
214static void __init sal_desc_ap_wakeup(void *p) { } 215static void __init sal_desc_ap_wakeup(void *p) { }
215#endif 216#endif
216 217
218/*
219 * HP rx5670 firmware polls for interrupts during SAL_CACHE_FLUSH by reading
220 * cr.ivr, but it never writes cr.eoi. This leaves any interrupt marked as
221 * "in-service" and masks other interrupts of equal or lower priority.
222 *
223 * HP internal defect reports: F1859, F2775, F3031.
224 */
225static int sal_cache_flush_drops_interrupts;
226
227static void __init
228check_sal_cache_flush (void)
229{
230 unsigned long flags, itv;
231 int cpu;
232 u64 vector;
233
234 cpu = get_cpu();
235 local_irq_save(flags);
236
237 /*
238 * Schedule a timer interrupt, wait until it's reported, and see if
239 * SAL_CACHE_FLUSH drops it.
240 */
241 itv = ia64_get_itv();
242 BUG_ON((itv & (1 << 16)) == 0);
243
244 ia64_set_itv(IA64_TIMER_VECTOR);
245 ia64_set_itm(ia64_get_itc() + 1000);
246
247 while (!ia64_get_irr(IA64_TIMER_VECTOR))
248 cpu_relax();
249
250 ia64_sal_cache_flush(3);
251
252 if (ia64_get_irr(IA64_TIMER_VECTOR)) {
253 vector = ia64_get_ivr();
254 ia64_eoi();
255 WARN_ON(vector != IA64_TIMER_VECTOR);
256 } else {
257 sal_cache_flush_drops_interrupts = 1;
258 printk(KERN_ERR "SAL: SAL_CACHE_FLUSH drops interrupts; "
259 "PAL_CACHE_FLUSH will be used instead\n");
260 ia64_eoi();
261 }
262
263 ia64_set_itv(itv);
264 local_irq_restore(flags);
265 put_cpu();
266}
267
268s64
269ia64_sal_cache_flush (u64 cache_type)
270{
271 struct ia64_sal_retval isrv;
272
273 if (sal_cache_flush_drops_interrupts) {
274 unsigned long flags;
275 u64 progress;
276 s64 rc;
277
278 progress = 0;
279 local_irq_save(flags);
280 rc = ia64_pal_cache_flush(cache_type,
281 PAL_CACHE_FLUSH_INVALIDATE, &progress, NULL);
282 local_irq_restore(flags);
283 return rc;
284 }
285
286 SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0);
287 return isrv.status;
288}
289
217void __init 290void __init
218ia64_sal_init (struct ia64_sal_systab *systab) 291ia64_sal_init (struct ia64_sal_systab *systab)
219{ 292{
@@ -262,6 +335,8 @@ ia64_sal_init (struct ia64_sal_systab *systab)
262 } 335 }
263 p += SAL_DESC_SIZE(*p); 336 p += SAL_DESC_SIZE(*p);
264 } 337 }
338
339 check_sal_cache_flush();
265} 340}
266 341
267int 342int
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c0766575a3a2..35f7835294a3 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -71,6 +71,8 @@ unsigned long __per_cpu_offset[NR_CPUS];
71EXPORT_SYMBOL(__per_cpu_offset); 71EXPORT_SYMBOL(__per_cpu_offset);
72#endif 72#endif
73 73
74extern void ia64_setup_printk_clock(void);
75
74DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); 76DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
75DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); 77DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);
76DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8); 78DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
@@ -445,6 +447,8 @@ setup_arch (char **cmdline_p)
445 /* process SAL system table: */ 447 /* process SAL system table: */
446 ia64_sal_init(efi.sal_systab); 448 ia64_sal_init(efi.sal_systab);
447 449
450 ia64_setup_printk_clock();
451
448#ifdef CONFIG_SMP 452#ifdef CONFIG_SMP
449 cpu_physical_id(0) = hard_smp_processor_id(); 453 cpu_physical_id(0) = hard_smp_processor_id();
450 454
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 028a2b95936c..a094ec49ccfa 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -278,3 +278,30 @@ udelay (unsigned long usecs)
278 } 278 }
279} 279}
280EXPORT_SYMBOL(udelay); 280EXPORT_SYMBOL(udelay);
281
282static unsigned long long ia64_itc_printk_clock(void)
283{
284 if (ia64_get_kr(IA64_KR_PER_CPU_DATA))
285 return sched_clock();
286 return 0;
287}
288
289static unsigned long long ia64_default_printk_clock(void)
290{
291 return (unsigned long long)(jiffies_64 - INITIAL_JIFFIES) *
292 (1000000000/HZ);
293}
294
295unsigned long long (*ia64_printk_clock)(void) = &ia64_default_printk_clock;
296
297unsigned long long printk_clock(void)
298{
299 return ia64_printk_clock();
300}
301
302void __init
303ia64_setup_printk_clock(void)
304{
305 if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT))
306 ia64_printk_clock = ia64_itc_printk_clock;
307}
diff --git a/arch/ia64/sn/Makefile b/arch/ia64/sn/Makefile
index a269f6d84c29..79a7df02e812 100644
--- a/arch/ia64/sn/Makefile
+++ b/arch/ia64/sn/Makefile
@@ -9,6 +9,4 @@
9# Makefile for the sn ia64 subplatform 9# Makefile for the sn ia64 subplatform
10# 10#
11 11
12CPPFLAGS += -I$(srctree)/arch/ia64/sn/include
13
14obj-y += kernel/ pci/ 12obj-y += kernel/ pci/
diff --git a/arch/ia64/sn/kernel/Makefile b/arch/ia64/sn/kernel/Makefile
index 4351c4ff9845..3e9b4eea7418 100644
--- a/arch/ia64/sn/kernel/Makefile
+++ b/arch/ia64/sn/kernel/Makefile
@@ -7,6 +7,8 @@
7# Copyright (C) 1999,2001-2005 Silicon Graphics, Inc. All Rights Reserved. 7# Copyright (C) 1999,2001-2005 Silicon Graphics, Inc. All Rights Reserved.
8# 8#
9 9
10CPPFLAGS += -I$(srctree)/arch/ia64/sn/include
11
10obj-y += setup.o bte.o bte_error.o irq.o mca.o idle.o \ 12obj-y += setup.o bte.o bte_error.o irq.o mca.o idle.o \
11 huberror.o io_init.o iomv.o klconflib.o sn2/ 13 huberror.o io_init.o iomv.o klconflib.o sn2/
12obj-$(CONFIG_IA64_GENERIC) += machvec.o 14obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index dd73c0cb754b..1f11db470d90 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/config.h> 9#include <linux/config.h>
@@ -186,18 +186,13 @@ retry_bteop:
186 186
187 /* Initialize the notification to a known value. */ 187 /* Initialize the notification to a known value. */
188 *bte->most_rcnt_na = BTE_WORD_BUSY; 188 *bte->most_rcnt_na = BTE_WORD_BUSY;
189 notif_phys_addr = TO_PHYS(ia64_tpa((unsigned long)bte->most_rcnt_na)); 189 notif_phys_addr = (u64)bte->most_rcnt_na;
190 190
191 if (is_shub2()) {
192 src = SH2_TIO_PHYS_TO_DMA(src);
193 dest = SH2_TIO_PHYS_TO_DMA(dest);
194 notif_phys_addr = SH2_TIO_PHYS_TO_DMA(notif_phys_addr);
195 }
196 /* Set the source and destination registers */ 191 /* Set the source and destination registers */
197 BTE_PRINTKV(("IBSA = 0x%lx)\n", (TO_PHYS(src)))); 192 BTE_PRINTKV(("IBSA = 0x%lx)\n", src));
198 BTE_SRC_STORE(bte, TO_PHYS(src)); 193 BTE_SRC_STORE(bte, src);
199 BTE_PRINTKV(("IBDA = 0x%lx)\n", (TO_PHYS(dest)))); 194 BTE_PRINTKV(("IBDA = 0x%lx)\n", dest));
200 BTE_DEST_STORE(bte, TO_PHYS(dest)); 195 BTE_DEST_STORE(bte, dest);
201 196
202 /* Set the notification register */ 197 /* Set the notification register */
203 BTE_PRINTKV(("IBNA = 0x%lx)\n", notif_phys_addr)); 198 BTE_PRINTKV(("IBNA = 0x%lx)\n", notif_phys_addr));
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index a4c78152b336..3437c2390429 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -208,7 +208,7 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
208 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for 208 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for
209 * each node in the system. 209 * each node in the system.
210 */ 210 */
211static void sn_fixup_ionodes(void) 211static void __init sn_fixup_ionodes(void)
212{ 212{
213 struct sn_flush_device_kernel *sn_flush_device_kernel; 213 struct sn_flush_device_kernel *sn_flush_device_kernel;
214 struct sn_flush_device_kernel *dev_entry; 214 struct sn_flush_device_kernel *dev_entry;
@@ -467,6 +467,13 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
467 pcidev_info->pdi_sn_irq_info = NULL; 467 pcidev_info->pdi_sn_irq_info = NULL;
468 kfree(sn_irq_info); 468 kfree(sn_irq_info);
469 } 469 }
470
471 /*
472 * MSI currently not supported on altix. Remove this when
473 * the MSI abstraction patches are integrated into the kernel
474 * (sometime after 2.6.16 releases)
475 */
476 dev->no_msi = 1;
470} 477}
471 478
472/* 479/*
@@ -610,15 +617,15 @@ void sn_bus_store_sysdata(struct pci_dev *dev)
610void sn_bus_free_sysdata(void) 617void sn_bus_free_sysdata(void)
611{ 618{
612 struct sysdata_el *element; 619 struct sysdata_el *element;
613 struct list_head *list; 620 struct list_head *list, *safe;
614 621
615sn_sysdata_free_start: 622 list_for_each_safe(list, safe, &sn_sysdata_list) {
616 list_for_each(list, &sn_sysdata_list) {
617 element = list_entry(list, struct sysdata_el, entry); 623 element = list_entry(list, struct sysdata_el, entry);
618 list_del(&element->entry); 624 list_del(&element->entry);
625 list_del(&(((struct pcidev_info *)
626 (element->sysdata))->pdi_list));
619 kfree(element->sysdata); 627 kfree(element->sysdata);
620 kfree(element); 628 kfree(element);
621 goto sn_sysdata_free_start;
622 } 629 }
623 return; 630 return;
624} 631}
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index ec37084bdc17..c373113d073a 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -5,11 +5,12 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 8 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
9 */ 9 */
10 10
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/init.h>
13#include <asm/sn/addrs.h> 14#include <asm/sn/addrs.h>
14#include <asm/sn/arch.h> 15#include <asm/sn/arch.h>
15#include <asm/sn/intr.h> 16#include <asm/sn/intr.h>
@@ -76,17 +77,15 @@ static void sn_enable_irq(unsigned int irq)
76 77
77static void sn_ack_irq(unsigned int irq) 78static void sn_ack_irq(unsigned int irq)
78{ 79{
79 u64 event_occurred, mask = 0; 80 u64 event_occurred, mask;
80 81
81 irq = irq & 0xff; 82 irq = irq & 0xff;
82 event_occurred = 83 event_occurred = HUB_L((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED));
83 HUB_L((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED));
84 mask = event_occurred & SH_ALL_INT_MASK; 84 mask = event_occurred & SH_ALL_INT_MASK;
85 HUB_S((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED_ALIAS), 85 HUB_S((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED_ALIAS), mask);
86 mask);
87 __set_bit(irq, (volatile void *)pda->sn_in_service_ivecs); 86 __set_bit(irq, (volatile void *)pda->sn_in_service_ivecs);
88 87
89 move_irq(irq); 88 move_native_irq(irq);
90} 89}
91 90
92static void sn_end_irq(unsigned int irq) 91static void sn_end_irq(unsigned int irq)
@@ -219,9 +218,8 @@ static void register_intr_pda(struct sn_irq_info *sn_irq_info)
219 pdacpu(cpu)->sn_last_irq = irq; 218 pdacpu(cpu)->sn_last_irq = irq;
220 } 219 }
221 220
222 if (pdacpu(cpu)->sn_first_irq == 0 || pdacpu(cpu)->sn_first_irq > irq) { 221 if (pdacpu(cpu)->sn_first_irq == 0 || pdacpu(cpu)->sn_first_irq > irq)
223 pdacpu(cpu)->sn_first_irq = irq; 222 pdacpu(cpu)->sn_first_irq = irq;
224 }
225} 223}
226 224
227static void unregister_intr_pda(struct sn_irq_info *sn_irq_info) 225static void unregister_intr_pda(struct sn_irq_info *sn_irq_info)
@@ -289,7 +287,7 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
289 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]); 287 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
290 spin_unlock(&sn_irq_info_lock); 288 spin_unlock(&sn_irq_info_lock);
291 289
292 (void)register_intr_pda(sn_irq_info); 290 register_intr_pda(sn_irq_info);
293} 291}
294 292
295void sn_irq_unfixup(struct pci_dev *pci_dev) 293void sn_irq_unfixup(struct pci_dev *pci_dev)
@@ -301,7 +299,9 @@ void sn_irq_unfixup(struct pci_dev *pci_dev)
301 return; 299 return;
302 300
303 sn_irq_info = SN_PCIDEV_INFO(pci_dev)->pdi_sn_irq_info; 301 sn_irq_info = SN_PCIDEV_INFO(pci_dev)->pdi_sn_irq_info;
304 if (!sn_irq_info || !sn_irq_info->irq_irq) { 302 if (!sn_irq_info)
303 return;
304 if (!sn_irq_info->irq_irq) {
305 kfree(sn_irq_info); 305 kfree(sn_irq_info);
306 return; 306 return;
307 } 307 }
@@ -419,7 +419,7 @@ void sn_lb_int_war_check(void)
419 rcu_read_unlock(); 419 rcu_read_unlock();
420} 420}
421 421
422void sn_irq_lh_init(void) 422void __init sn_irq_lh_init(void)
423{ 423{
424 int i; 424 int i;
425 425
@@ -434,5 +434,4 @@ void sn_irq_lh_init(void)
434 434
435 INIT_LIST_HEAD(sn_irq_lh[i]); 435 INIT_LIST_HEAD(sn_irq_lh[i]);
436 } 436 }
437
438} 437}
diff --git a/arch/ia64/sn/kernel/klconflib.c b/arch/ia64/sn/kernel/klconflib.c
index 0f11a3299cd2..87682b48ef83 100644
--- a/arch/ia64/sn/kernel/klconflib.c
+++ b/arch/ia64/sn/kernel/klconflib.c
@@ -78,31 +78,30 @@ format_module_id(char *buffer, moduleid_t m, int fmt)
78 position = MODULE_GET_BPOS(m); 78 position = MODULE_GET_BPOS(m);
79 79
80 if ((fmt == MODULE_FORMAT_BRIEF) || (fmt == MODULE_FORMAT_LCD)) { 80 if ((fmt == MODULE_FORMAT_BRIEF) || (fmt == MODULE_FORMAT_LCD)) {
81 /* Brief module number format, eg. 002c15 */ 81 /* Brief module number format, eg. 002c15 */
82 82
83 /* Decompress the rack number */ 83 /* Decompress the rack number */
84 *buffer++ = '0' + RACK_GET_CLASS(rack); 84 *buffer++ = '0' + RACK_GET_CLASS(rack);
85 *buffer++ = '0' + RACK_GET_GROUP(rack); 85 *buffer++ = '0' + RACK_GET_GROUP(rack);
86 *buffer++ = '0' + RACK_GET_NUM(rack); 86 *buffer++ = '0' + RACK_GET_NUM(rack);
87 87
88 /* Add the brick type */ 88 /* Add the brick type */
89 *buffer++ = brickchar; 89 *buffer++ = brickchar;
90 } 90 }
91 else if (fmt == MODULE_FORMAT_LONG) { 91 else if (fmt == MODULE_FORMAT_LONG) {
92 /* Fuller hwgraph format, eg. rack/002/bay/15 */ 92 /* Fuller hwgraph format, eg. rack/002/bay/15 */
93 93
94 strcpy(buffer, "rack" "/"); buffer += strlen(buffer); 94 strcpy(buffer, "rack" "/"); buffer += strlen(buffer);
95 95
96 *buffer++ = '0' + RACK_GET_CLASS(rack); 96 *buffer++ = '0' + RACK_GET_CLASS(rack);
97 *buffer++ = '0' + RACK_GET_GROUP(rack); 97 *buffer++ = '0' + RACK_GET_GROUP(rack);
98 *buffer++ = '0' + RACK_GET_NUM(rack); 98 *buffer++ = '0' + RACK_GET_NUM(rack);
99 99
100 strcpy(buffer, "/" "bay" "/"); buffer += strlen(buffer); 100 strcpy(buffer, "/" "bay" "/"); buffer += strlen(buffer);
101 } 101 }
102 102
103 /* Add the bay position, using at least two digits */ 103 /* Add the bay position, using at least two digits */
104 if (position < 10) 104 if (position < 10)
105 *buffer++ = '0'; 105 *buffer++ = '0';
106 sprintf(buffer, "%d", position); 106 sprintf(buffer, "%d", position);
107
108} 107}
diff --git a/arch/ia64/sn/kernel/mca.c b/arch/ia64/sn/kernel/mca.c
index 9ab684d1bb55..3db62f24596c 100644
--- a/arch/ia64/sn/kernel/mca.c
+++ b/arch/ia64/sn/kernel/mca.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
@@ -137,7 +137,8 @@ int sn_salinfo_platform_oemdata(const u8 *sect_header, u8 **oemdata, u64 *oemdat
137 137
138static int __init sn_salinfo_init(void) 138static int __init sn_salinfo_init(void)
139{ 139{
140 salinfo_platform_oemdata = &sn_salinfo_platform_oemdata; 140 if (ia64_platform_is("sn2"))
141 salinfo_platform_oemdata = &sn_salinfo_platform_oemdata;
141 return 0; 142 return 0;
142} 143}
143 144
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index e510dce9971f..48645ac120fc 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -67,6 +67,7 @@ extern unsigned long last_time_offset;
67extern void (*ia64_mark_idle) (int); 67extern void (*ia64_mark_idle) (int);
68extern void snidle(int); 68extern void snidle(int);
69extern unsigned char acpi_kbd_controller_present; 69extern unsigned char acpi_kbd_controller_present;
70extern unsigned long long (*ia64_printk_clock)(void);
70 71
71unsigned long sn_rtc_cycles_per_second; 72unsigned long sn_rtc_cycles_per_second;
72EXPORT_SYMBOL(sn_rtc_cycles_per_second); 73EXPORT_SYMBOL(sn_rtc_cycles_per_second);
@@ -125,20 +126,6 @@ struct screen_info sn_screen_info = {
125}; 126};
126 127
127/* 128/*
128 * This is here so we can use the CMOS detection in ide-probe.c to
129 * determine what drives are present. In theory, we don't need this
130 * as the auto-detection could be done via ide-probe.c:do_probe() but
131 * in practice that would be much slower, which is painful when
132 * running in the simulator. Note that passing zeroes in DRIVE_INFO
133 * is sufficient (the IDE driver will autodetect the drive geometry).
134 */
135#ifdef CONFIG_IA64_GENERIC
136extern char drive_info[4 * 16];
137#else
138char drive_info[4 * 16];
139#endif
140
141/*
142 * This routine can only be used during init, since 129 * This routine can only be used during init, since
143 * smp_boot_data is an init data structure. 130 * smp_boot_data is an init data structure.
144 * We have to use smp_boot_data.cpu_phys_id to find 131 * We have to use smp_boot_data.cpu_phys_id to find
@@ -209,7 +196,7 @@ void __init early_sn_setup(void)
209} 196}
210 197
211extern int platform_intr_list[]; 198extern int platform_intr_list[];
212static int __initdata shub_1_1_found = 0; 199static int __initdata shub_1_1_found;
213 200
214/* 201/*
215 * sn_check_for_wars 202 * sn_check_for_wars
@@ -372,6 +359,16 @@ sn_scan_pcdp(void)
372 } 359 }
373} 360}
374 361
362static unsigned long sn2_rtc_initial;
363
364static unsigned long long ia64_sn2_printk_clock(void)
365{
366 unsigned long rtc_now = rtc_time();
367
368 return (rtc_now - sn2_rtc_initial) *
369 (1000000000 / sn_rtc_cycles_per_second);
370}
371
375/** 372/**
376 * sn_setup - SN platform setup routine 373 * sn_setup - SN platform setup routine
377 * @cmdline_p: kernel command line 374 * @cmdline_p: kernel command line
@@ -386,6 +383,7 @@ void __init sn_setup(char **cmdline_p)
386 u32 version = sn_sal_rev(); 383 u32 version = sn_sal_rev();
387 extern void sn_cpu_init(void); 384 extern void sn_cpu_init(void);
388 385
386 sn2_rtc_initial = rtc_time();
389 ia64_sn_plat_set_error_handling_features(); // obsolete 387 ia64_sn_plat_set_error_handling_features(); // obsolete
390 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV); 388 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV);
391 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES); 389 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES);
@@ -437,19 +435,6 @@ void __init sn_setup(char **cmdline_p)
437 */ 435 */
438 build_cnode_tables(); 436 build_cnode_tables();
439 437
440 /*
441 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
442 * support here so we don't have to listen to failed keyboard probe
443 * messages.
444 */
445 if (version <= 0x0209 && acpi_kbd_controller_present) {
446 printk(KERN_INFO "Disabling legacy keyboard support as prom "
447 "is too old and doesn't provide FADT\n");
448 acpi_kbd_controller_present = 0;
449 }
450
451 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
452
453 status = 438 status =
454 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec, 439 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec,
455 &drift); 440 &drift);
@@ -463,6 +448,21 @@ void __init sn_setup(char **cmdline_p)
463 448
464 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR; 449 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;
465 450
451 ia64_printk_clock = ia64_sn2_printk_clock;
452
453 /*
454 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
455 * support here so we don't have to listen to failed keyboard probe
456 * messages.
457 */
458 if (version <= 0x0209 && acpi_kbd_controller_present) {
459 printk(KERN_INFO "Disabling legacy keyboard support as prom "
460 "is too old and doesn't provide FADT\n");
461 acpi_kbd_controller_present = 0;
462 }
463
464 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
465
466 /* 466 /*
467 * we set the default root device to /dev/hda 467 * we set the default root device to /dev/hda
468 * to make simulation easy 468 * to make simulation easy
@@ -578,13 +578,17 @@ void __init sn_cpu_init(void)
578 sn_prom_type = 2; 578 sn_prom_type = 2;
579 else 579 else
580 sn_prom_type = 1; 580 sn_prom_type = 1;
581 printk("Running on medusa with %s PROM\n", (sn_prom_type == 1) ? "real" : "fake"); 581 printk(KERN_INFO "Running on medusa with %s PROM\n",
582 (sn_prom_type == 1) ? "real" : "fake");
582 } 583 }
583 584
584 memset(pda, 0, sizeof(pda)); 585 memset(pda, 0, sizeof(pda));
585 if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, &sn_hub_info->nasid_bitmask, &sn_hub_info->nasid_shift, 586 if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2,
586 &sn_system_size, &sn_sharing_domain_size, &sn_partition_id, 587 &sn_hub_info->nasid_bitmask,
587 &sn_coherency_id, &sn_region_size)) 588 &sn_hub_info->nasid_shift,
589 &sn_system_size, &sn_sharing_domain_size,
590 &sn_partition_id, &sn_coherency_id,
591 &sn_region_size))
588 BUG(); 592 BUG();
589 sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2; 593 sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2;
590 594
@@ -716,7 +720,8 @@ void __init build_cnode_tables(void)
716 for_each_online_node(node) { 720 for_each_online_node(node) {
717 kl_config_hdr_t *klgraph_header; 721 kl_config_hdr_t *klgraph_header;
718 nasid = cnodeid_to_nasid(node); 722 nasid = cnodeid_to_nasid(node);
719 if ((klgraph_header = ia64_sn_get_klconfig_addr(nasid)) == NULL) 723 klgraph_header = ia64_sn_get_klconfig_addr(nasid);
724 if (klgraph_header == NULL)
720 BUG(); 725 BUG();
721 brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info); 726 brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info);
722 while (brd) { 727 while (brd) {
@@ -734,7 +739,7 @@ nasid_slice_to_cpuid(int nasid, int slice)
734{ 739{
735 long cpu; 740 long cpu;
736 741
737 for (cpu=0; cpu < NR_CPUS; cpu++) 742 for (cpu = 0; cpu < NR_CPUS; cpu++)
738 if (cpuid_to_nasid(cpu) == nasid && 743 if (cpuid_to_nasid(cpu) == nasid &&
739 cpuid_to_slice(cpu) == slice) 744 cpuid_to_slice(cpu) == slice)
740 return cpu; 745 return cpu;
diff --git a/arch/ia64/sn/kernel/sn2/Makefile b/arch/ia64/sn/kernel/sn2/Makefile
index 170bde4549da..99e177693234 100644
--- a/arch/ia64/sn/kernel/sn2/Makefile
+++ b/arch/ia64/sn/kernel/sn2/Makefile
@@ -9,5 +9,7 @@
9# sn2 specific kernel files 9# sn2 specific kernel files
10# 10#
11 11
12CPPFLAGS += -I$(srctree)/arch/ia64/sn/include
13
12obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \ 14obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \
13 prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o 15 prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 471bbaa65d1b..f153a4c35c70 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2000-2006 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
@@ -46,104 +46,28 @@ DECLARE_PER_CPU(struct ptc_stats, ptcstats);
46 46
47static __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock); 47static __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock);
48 48
49void sn2_ptc_deadlock_recovery(short *, short, int, volatile unsigned long *, unsigned long data0, 49void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned long *, unsigned long,
50 volatile unsigned long *, unsigned long data1); 50 volatile unsigned long *, unsigned long);
51 51
52#ifdef DEBUG_PTC
53/* 52/*
54 * ptctest: 53 * Note: some is the following is captured here to make degugging easier
55 * 54 * (the macros make more sense if you see the debug patch - not posted)
56 * xyz - 3 digit hex number:
57 * x - Force PTC purges to use shub:
58 * 0 - no force
59 * 1 - force
60 * y - interupt enable
61 * 0 - disable interrupts
62 * 1 - leave interuupts enabled
63 * z - type of lock:
64 * 0 - global lock
65 * 1 - node local lock
66 * 2 - no lock
67 *
68 * Note: on shub1, only ptctest == 0 is supported. Don't try other values!
69 */ 55 */
70
71static unsigned int sn2_ptctest = 0;
72
73static int __init ptc_test(char *str)
74{
75 get_option(&str, &sn2_ptctest);
76 return 1;
77}
78__setup("ptctest=", ptc_test);
79
80static inline int ptc_lock(unsigned long *flagp)
81{
82 unsigned long opt = sn2_ptctest & 255;
83
84 switch (opt) {
85 case 0x00:
86 spin_lock_irqsave(&sn2_global_ptc_lock, *flagp);
87 break;
88 case 0x01:
89 spin_lock_irqsave(&sn_nodepda->ptc_lock, *flagp);
90 break;
91 case 0x02:
92 local_irq_save(*flagp);
93 break;
94 case 0x10:
95 spin_lock(&sn2_global_ptc_lock);
96 break;
97 case 0x11:
98 spin_lock(&sn_nodepda->ptc_lock);
99 break;
100 case 0x12:
101 break;
102 default:
103 BUG();
104 }
105 return opt;
106}
107
108static inline void ptc_unlock(unsigned long flags, int opt)
109{
110 switch (opt) {
111 case 0x00:
112 spin_unlock_irqrestore(&sn2_global_ptc_lock, flags);
113 break;
114 case 0x01:
115 spin_unlock_irqrestore(&sn_nodepda->ptc_lock, flags);
116 break;
117 case 0x02:
118 local_irq_restore(flags);
119 break;
120 case 0x10:
121 spin_unlock(&sn2_global_ptc_lock);
122 break;
123 case 0x11:
124 spin_unlock(&sn_nodepda->ptc_lock);
125 break;
126 case 0x12:
127 break;
128 default:
129 BUG();
130 }
131}
132#else
133
134#define sn2_ptctest 0 56#define sn2_ptctest 0
57#define local_node_uses_ptc_ga(sh1) ((sh1) ? 1 : 0)
58#define max_active_pio(sh1) ((sh1) ? 32 : 7)
59#define reset_max_active_on_deadlock() 1
60#define PTC_LOCK(sh1) ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock)
135 61
136static inline int ptc_lock(unsigned long *flagp) 62static inline void ptc_lock(int sh1, unsigned long *flagp)
137{ 63{
138 spin_lock_irqsave(&sn2_global_ptc_lock, *flagp); 64 spin_lock_irqsave(PTC_LOCK(sh1), *flagp);
139 return 0;
140} 65}
141 66
142static inline void ptc_unlock(unsigned long flags, int opt) 67static inline void ptc_unlock(int sh1, unsigned long flags)
143{ 68{
144 spin_unlock_irqrestore(&sn2_global_ptc_lock, flags); 69 spin_unlock_irqrestore(PTC_LOCK(sh1), flags);
145} 70}
146#endif
147 71
148struct ptc_stats { 72struct ptc_stats {
149 unsigned long ptc_l; 73 unsigned long ptc_l;
@@ -151,27 +75,30 @@ struct ptc_stats {
151 unsigned long shub_ptc_flushes; 75 unsigned long shub_ptc_flushes;
152 unsigned long nodes_flushed; 76 unsigned long nodes_flushed;
153 unsigned long deadlocks; 77 unsigned long deadlocks;
78 unsigned long deadlocks2;
154 unsigned long lock_itc_clocks; 79 unsigned long lock_itc_clocks;
155 unsigned long shub_itc_clocks; 80 unsigned long shub_itc_clocks;
156 unsigned long shub_itc_clocks_max; 81 unsigned long shub_itc_clocks_max;
82 unsigned long shub_ptc_flushes_not_my_mm;
157}; 83};
158 84
159static inline unsigned long wait_piowc(void) 85static inline unsigned long wait_piowc(void)
160{ 86{
161 volatile unsigned long *piows, zeroval; 87 volatile unsigned long *piows;
162 unsigned long ws; 88 unsigned long zeroval, ws;
163 89
164 piows = pda->pio_write_status_addr; 90 piows = pda->pio_write_status_addr;
165 zeroval = pda->pio_write_status_val; 91 zeroval = pda->pio_write_status_val;
166 do { 92 do {
167 cpu_relax(); 93 cpu_relax();
168 } while (((ws = *piows) & SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK) != zeroval); 94 } while (((ws = *piows) & SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK) != zeroval);
169 return ws; 95 return (ws & SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK) != 0;
170} 96}
171 97
172void sn_tlb_migrate_finish(struct mm_struct *mm) 98void sn_tlb_migrate_finish(struct mm_struct *mm)
173{ 99{
174 if (mm == current->mm) 100 /* flush_tlb_mm is inefficient if more than 1 users of mm */
101 if (mm == current->mm && mm && atomic_read(&mm->mm_users) == 1)
175 flush_tlb_mm(mm); 102 flush_tlb_mm(mm);
176} 103}
177 104
@@ -201,12 +128,14 @@ void
201sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, 128sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
202 unsigned long end, unsigned long nbits) 129 unsigned long end, unsigned long nbits)
203{ 130{
204 int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0; 131 int i, ibegin, shub1, cnode, mynasid, cpu, lcpu = 0, nasid;
205 int mymm = (mm == current->active_mm && current->mm); 132 int mymm = (mm == current->active_mm && mm == current->mm);
133 int use_cpu_ptcga;
206 volatile unsigned long *ptc0, *ptc1; 134 volatile unsigned long *ptc0, *ptc1;
207 unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value; 135 unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value, old_rr = 0;
208 short nasids[MAX_NUMNODES], nix; 136 short nasids[MAX_NUMNODES], nix;
209 nodemask_t nodes_flushed; 137 nodemask_t nodes_flushed;
138 int active, max_active, deadlock;
210 139
211 nodes_clear(nodes_flushed); 140 nodes_clear(nodes_flushed);
212 i = 0; 141 i = 0;
@@ -267,41 +196,56 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
267 196
268 197
269 mynasid = get_nasid(); 198 mynasid = get_nasid();
199 use_cpu_ptcga = local_node_uses_ptc_ga(shub1);
200 max_active = max_active_pio(shub1);
270 201
271 itc = ia64_get_itc(); 202 itc = ia64_get_itc();
272 opt = ptc_lock(&flags); 203 ptc_lock(shub1, &flags);
273 itc2 = ia64_get_itc(); 204 itc2 = ia64_get_itc();
205
274 __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc; 206 __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc;
275 __get_cpu_var(ptcstats).shub_ptc_flushes++; 207 __get_cpu_var(ptcstats).shub_ptc_flushes++;
276 __get_cpu_var(ptcstats).nodes_flushed += nix; 208 __get_cpu_var(ptcstats).nodes_flushed += nix;
209 if (!mymm)
210 __get_cpu_var(ptcstats).shub_ptc_flushes_not_my_mm++;
277 211
212 if (use_cpu_ptcga && !mymm) {
213 old_rr = ia64_get_rr(start);
214 ia64_set_rr(start, (old_rr & 0xff) | (rr_value << 8));
215 ia64_srlz_d();
216 }
217
218 wait_piowc();
278 do { 219 do {
279 if (shub1) 220 if (shub1)
280 data1 = start | (1UL << SH1_PTC_1_START_SHFT); 221 data1 = start | (1UL << SH1_PTC_1_START_SHFT);
281 else 222 else
282 data0 = (data0 & ~SH2_PTC_ADDR_MASK) | (start & SH2_PTC_ADDR_MASK); 223 data0 = (data0 & ~SH2_PTC_ADDR_MASK) | (start & SH2_PTC_ADDR_MASK);
283 for (i = 0; i < nix; i++) { 224 deadlock = 0;
225 active = 0;
226 for (ibegin = 0, i = 0; i < nix; i++) {
284 nasid = nasids[i]; 227 nasid = nasids[i];
285 if ((!(sn2_ptctest & 3)) && unlikely(nasid == mynasid && mymm)) { 228 if (use_cpu_ptcga && unlikely(nasid == mynasid)) {
286 ia64_ptcga(start, nbits << 2); 229 ia64_ptcga(start, nbits << 2);
287 ia64_srlz_i(); 230 ia64_srlz_i();
288 } else { 231 } else {
289 ptc0 = CHANGE_NASID(nasid, ptc0); 232 ptc0 = CHANGE_NASID(nasid, ptc0);
290 if (ptc1) 233 if (ptc1)
291 ptc1 = CHANGE_NASID(nasid, ptc1); 234 ptc1 = CHANGE_NASID(nasid, ptc1);
292 pio_atomic_phys_write_mmrs(ptc0, data0, ptc1, 235 pio_atomic_phys_write_mmrs(ptc0, data0, ptc1, data1);
293 data1); 236 active++;
294 flushed = 1; 237 }
238 if (active >= max_active || i == (nix - 1)) {
239 if ((deadlock = wait_piowc())) {
240 sn2_ptc_deadlock_recovery(nasids, ibegin, i, mynasid, ptc0, data0, ptc1, data1);
241 if (reset_max_active_on_deadlock())
242 max_active = 1;
243 }
244 active = 0;
245 ibegin = i + 1;
295 } 246 }
296 } 247 }
297 if (flushed
298 && (wait_piowc() &
299 (SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK))) {
300 sn2_ptc_deadlock_recovery(nasids, nix, mynasid, ptc0, data0, ptc1, data1);
301 }
302
303 start += (1UL << nbits); 248 start += (1UL << nbits);
304
305 } while (start < end); 249 } while (start < end);
306 250
307 itc2 = ia64_get_itc() - itc2; 251 itc2 = ia64_get_itc() - itc2;
@@ -309,7 +253,12 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
309 if (itc2 > __get_cpu_var(ptcstats).shub_itc_clocks_max) 253 if (itc2 > __get_cpu_var(ptcstats).shub_itc_clocks_max)
310 __get_cpu_var(ptcstats).shub_itc_clocks_max = itc2; 254 __get_cpu_var(ptcstats).shub_itc_clocks_max = itc2;
311 255
312 ptc_unlock(flags, opt); 256 if (old_rr) {
257 ia64_set_rr(start, old_rr);
258 ia64_srlz_d();
259 }
260
261 ptc_unlock(shub1, flags);
313 262
314 preempt_enable(); 263 preempt_enable();
315} 264}
@@ -321,27 +270,30 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
321 * TLB flush transaction. The recovery sequence is somewhat tricky & is 270 * TLB flush transaction. The recovery sequence is somewhat tricky & is
322 * coded in assembly language. 271 * coded in assembly language.
323 */ 272 */
324void sn2_ptc_deadlock_recovery(short *nasids, short nix, int mynasid, volatile unsigned long *ptc0, unsigned long data0, 273void sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid, volatile unsigned long *ptc0, unsigned long data0,
325 volatile unsigned long *ptc1, unsigned long data1) 274 volatile unsigned long *ptc1, unsigned long data1)
326{ 275{
327 extern void sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long, 276 extern unsigned long sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
328 volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long); 277 volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long);
329 short nasid, i; 278 short nasid, i;
330 unsigned long *piows, zeroval; 279 unsigned long *piows, zeroval, n;
331 280
332 __get_cpu_var(ptcstats).deadlocks++; 281 __get_cpu_var(ptcstats).deadlocks++;
333 282
334 piows = (unsigned long *) pda->pio_write_status_addr; 283 piows = (unsigned long *) pda->pio_write_status_addr;
335 zeroval = pda->pio_write_status_val; 284 zeroval = pda->pio_write_status_val;
336 285
337 for (i=0; i < nix; i++) { 286
287 for (i=ib; i <= ie; i++) {
338 nasid = nasids[i]; 288 nasid = nasids[i];
339 if (!(sn2_ptctest & 3) && nasid == mynasid) 289 if (local_node_uses_ptc_ga(is_shub1()) && nasid == mynasid)
340 continue; 290 continue;
341 ptc0 = CHANGE_NASID(nasid, ptc0); 291 ptc0 = CHANGE_NASID(nasid, ptc0);
342 if (ptc1) 292 if (ptc1)
343 ptc1 = CHANGE_NASID(nasid, ptc1); 293 ptc1 = CHANGE_NASID(nasid, ptc1);
344 sn2_ptc_deadlock_recovery_core(ptc0, data0, ptc1, data1, piows, zeroval); 294
295 n = sn2_ptc_deadlock_recovery_core(ptc0, data0, ptc1, data1, piows, zeroval);
296 __get_cpu_var(ptcstats).deadlocks2 += n;
345 } 297 }
346 298
347} 299}
@@ -452,20 +404,22 @@ static int sn2_ptc_seq_show(struct seq_file *file, void *data)
452 cpu = *(loff_t *) data; 404 cpu = *(loff_t *) data;
453 405
454 if (!cpu) { 406 if (!cpu) {
455 seq_printf(file, "# ptc_l change_rid shub_ptc_flushes shub_nodes_flushed deadlocks lock_nsec shub_nsec shub_nsec_max\n"); 407 seq_printf(file,
408 "# cpu ptc_l newrid ptc_flushes nodes_flushed deadlocks lock_nsec shub_nsec shub_nsec_max not_my_mm deadlock2\n");
456 seq_printf(file, "# ptctest %d\n", sn2_ptctest); 409 seq_printf(file, "# ptctest %d\n", sn2_ptctest);
457 } 410 }
458 411
459 if (cpu < NR_CPUS && cpu_online(cpu)) { 412 if (cpu < NR_CPUS && cpu_online(cpu)) {
460 stat = &per_cpu(ptcstats, cpu); 413 stat = &per_cpu(ptcstats, cpu);
461 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l, 414 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l,
462 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed, 415 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed,
463 stat->deadlocks, 416 stat->deadlocks,
464 1000 * stat->lock_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, 417 1000 * stat->lock_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec,
465 1000 * stat->shub_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, 418 1000 * stat->shub_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec,
466 1000 * stat->shub_itc_clocks_max / per_cpu(cpu_info, cpu).cyc_per_usec); 419 1000 * stat->shub_itc_clocks_max / per_cpu(cpu_info, cpu).cyc_per_usec,
420 stat->shub_ptc_flushes_not_my_mm,
421 stat->deadlocks2);
467 } 422 }
468
469 return 0; 423 return 0;
470} 424}
471 425
@@ -476,7 +430,7 @@ static struct seq_operations sn2_ptc_seq_ops = {
476 .show = sn2_ptc_seq_show 430 .show = sn2_ptc_seq_show
477}; 431};
478 432
479int sn2_ptc_proc_open(struct inode *inode, struct file *file) 433static int sn2_ptc_proc_open(struct inode *inode, struct file *file)
480{ 434{
481 return seq_open(file, &sn2_ptc_seq_ops); 435 return seq_open(file, &sn2_ptc_seq_ops);
482} 436}
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 19b54fbcd7ea..70db21f3df21 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved.
7 * 7 *
8 * SGI Altix topology and hardware performance monitoring API. 8 * SGI Altix topology and hardware performance monitoring API.
9 * Mark Goodwin <markgw@sgi.com>. 9 * Mark Goodwin <markgw@sgi.com>.
@@ -973,6 +973,9 @@ static int __devinit sn_hwperf_misc_register_init(void)
973{ 973{
974 int e; 974 int e;
975 975
976 if (!ia64_platform_is("sn2"))
977 return 0;
978
976 sn_hwperf_init(); 979 sn_hwperf_init();
977 980
978 /* 981 /*
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index c75f8aeefc2b..9cd460dfe27e 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -575,18 +575,21 @@ xpc_activate_partition(struct xpc_partition *part)
575 575
576 spin_lock_irqsave(&part->act_lock, irq_flags); 576 spin_lock_irqsave(&part->act_lock, irq_flags);
577 577
578 pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0);
579
580 DBUG_ON(part->act_state != XPC_P_INACTIVE); 578 DBUG_ON(part->act_state != XPC_P_INACTIVE);
581 579
582 if (pid > 0) { 580 part->act_state = XPC_P_ACTIVATION_REQ;
583 part->act_state = XPC_P_ACTIVATION_REQ; 581 XPC_SET_REASON(part, xpcCloneKThread, __LINE__);
584 XPC_SET_REASON(part, xpcCloneKThread, __LINE__);
585 } else {
586 XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__);
587 }
588 582
589 spin_unlock_irqrestore(&part->act_lock, irq_flags); 583 spin_unlock_irqrestore(&part->act_lock, irq_flags);
584
585 pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0);
586
587 if (unlikely(pid <= 0)) {
588 spin_lock_irqsave(&part->act_lock, irq_flags);
589 part->act_state = XPC_P_INACTIVE;
590 XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__);
591 spin_unlock_irqrestore(&part->act_lock, irq_flags);
592 }
590} 593}
591 594
592 595
diff --git a/arch/ia64/sn/pci/Makefile b/arch/ia64/sn/pci/Makefile
index 321576b1b425..c6946784a6a8 100644
--- a/arch/ia64/sn/pci/Makefile
+++ b/arch/ia64/sn/pci/Makefile
@@ -7,4 +7,6 @@
7# 7#
8# Makefile for the sn pci general routines. 8# Makefile for the sn pci general routines.
9 9
10CPPFLAGS += -I$(srctree)/arch/ia64/sn/include
11
10obj-y := pci_dma.o tioca_provider.o tioce_provider.o pcibr/ 12obj-y := pci_dma.o tioca_provider.o tioce_provider.o pcibr/
diff --git a/arch/ia64/sn/pci/pcibr/Makefile b/arch/ia64/sn/pci/pcibr/Makefile
index 1850c4a94c41..3b403ea456f9 100644
--- a/arch/ia64/sn/pci/pcibr/Makefile
+++ b/arch/ia64/sn/pci/pcibr/Makefile
@@ -7,5 +7,7 @@
7# 7#
8# Makefile for the sn2 io routines. 8# Makefile for the sn2 io routines.
9 9
10CPPFLAGS += -I$(srctree)/arch/ia64/sn/include
11
10obj-y += pcibr_dma.o pcibr_reg.o \ 12obj-y += pcibr_dma.o pcibr_reg.o \
11 pcibr_ate.o pcibr_provider.o 13 pcibr_ate.o pcibr_provider.o
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index dbc8a392105f..be8b711367ec 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -18,11 +18,6 @@
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
20 20
21#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
22extern struct drive_info_struct drive_info;
23EXPORT_SYMBOL(drive_info);
24#endif
25
26/* platform dependent support */ 21/* platform dependent support */
27EXPORT_SYMBOL(boot_cpu_data); 22EXPORT_SYMBOL(boot_cpu_data);
28EXPORT_SYMBOL(dump_fpu); 23EXPORT_SYMBOL(dump_fpu);
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index c2e4dccf0112..d742037a7ccb 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -37,12 +37,6 @@
37extern void init_mmu(void); 37extern void init_mmu(void);
38#endif 38#endif
39 39
40#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) \
41 || defined(CONFIG_BLK_DEV_IDE_MODULE) \
42 || defined(CONFIG_BLK_DEV_HD_MODULE)
43struct drive_info_struct { char dummy[32]; } drive_info;
44#endif
45
46extern char _end[]; 40extern char _end[];
47 41
48/* 42/*
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 99bf43824795..63c117dae0c3 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -39,6 +39,14 @@
39 39
40asmlinkage void ret_from_fork(void); 40asmlinkage void ret_from_fork(void);
41 41
42/*
43 * The following aren't currently used.
44 */
45void (*pm_idle)(void);
46EXPORT_SYMBOL(pm_idle);
47
48void (*pm_power_off)(void);
49EXPORT_SYMBOL(pm_power_off);
42 50
43/* 51/*
44 * The idle loop on an m68knommu.. 52 * The idle loop on an m68knommu..
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c3e852e9953e..767de847b4ab 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -595,6 +595,7 @@ config SGI_IP32
595 select SYS_HAS_CPU_R5000 595 select SYS_HAS_CPU_R5000
596 select SYS_HAS_CPU_R10000 if BROKEN 596 select SYS_HAS_CPU_R10000 if BROKEN
597 select SYS_HAS_CPU_RM7000 597 select SYS_HAS_CPU_RM7000
598 select SYS_HAS_CPU_NEVADA
598 select SYS_SUPPORTS_64BIT_KERNEL 599 select SYS_SUPPORTS_64BIT_KERNEL
599 select SYS_SUPPORTS_BIG_ENDIAN 600 select SYS_SUPPORTS_BIG_ENDIAN
600 help 601 help
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 2a9f2ef27b29..6a57407df1bc 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -53,14 +53,17 @@ CROSS_COMPILE := $(tool-prefix)
53endif 53endif
54 54
55CHECKFLAGS-y += -D__linux__ -D__mips__ \ 55CHECKFLAGS-y += -D__linux__ -D__mips__ \
56 -D_MIPS_SZINT=32 \
56 -D_ABIO32=1 \ 57 -D_ABIO32=1 \
57 -D_ABIN32=2 \ 58 -D_ABIN32=2 \
58 -D_ABI64=3 59 -D_ABI64=3
59CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \ 60CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \
60 -D_MIPS_SZLONG=32 \ 61 -D_MIPS_SZLONG=32 \
62 -D_MIPS_SZPTR=32 \
61 -D__PTRDIFF_TYPE__=int 63 -D__PTRDIFF_TYPE__=int
62CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \ 64CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \
63 -D_MIPS_SZLONG=64 \ 65 -D_MIPS_SZLONG=64 \
66 -D_MIPS_SZPTR=64 \
64 -D__PTRDIFF_TYPE__="long int" 67 -D__PTRDIFF_TYPE__="long int"
65CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__ 68CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__
66CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__ 69CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__
@@ -166,79 +169,97 @@ echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_i
166# 169#
167cflags-$(CONFIG_CPU_R3000) += \ 170cflags-$(CONFIG_CPU_R3000) += \
168 $(call set_gccflags,r3000,mips1,r3000,mips1,mips1) 171 $(call set_gccflags,r3000,mips1,r3000,mips1,mips1)
172CHECKFLAGS-$(CONFIG_CPU_R3000) += -D_MIPS_ISA=_MIPS_ISA_MIPS1
169 173
170cflags-$(CONFIG_CPU_TX39XX) += \ 174cflags-$(CONFIG_CPU_TX39XX) += \
171 $(call set_gccflags,r3900,mips1,r3000,mips1,mips1) 175 $(call set_gccflags,r3900,mips1,r3000,mips1,mips1)
176CHECKFLAGS-$(CONFIG_CPU_TX39XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS1
172 177
173cflags-$(CONFIG_CPU_R6000) += \ 178cflags-$(CONFIG_CPU_R6000) += \
174 $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \ 179 $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \
175 -Wa,--trap 180 -Wa,--trap
181CHECKFLAGS-$(CONFIG_CPU_R6000) += -D_MIPS_ISA=_MIPS_ISA_MIPS2
176 182
177cflags-$(CONFIG_CPU_R4300) += \ 183cflags-$(CONFIG_CPU_R4300) += \
178 $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \ 184 $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \
179 -Wa,--trap 185 -Wa,--trap
186CHECKFLAGS-$(CONFIG_CPU_R4300) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
180 187
181cflags-$(CONFIG_CPU_VR41XX) += \ 188cflags-$(CONFIG_CPU_VR41XX) += \
182 $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \ 189 $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \
183 -Wa,--trap 190 -Wa,--trap
191CHECKFLAGS-$(CONFIG_CPU_VR41XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
184 192
185cflags-$(CONFIG_CPU_R4X00) += \ 193cflags-$(CONFIG_CPU_R4X00) += \
186 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ 194 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
187 -Wa,--trap 195 -Wa,--trap
196CHECKFLAGS-$(CONFIG_CPU_R4X00) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
188 197
189cflags-$(CONFIG_CPU_TX49XX) += \ 198cflags-$(CONFIG_CPU_TX49XX) += \
190 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ 199 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
191 -Wa,--trap 200 -Wa,--trap
201CHECKFLAGS-$(CONFIG_CPU_TX49XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
192 202
193cflags-$(CONFIG_CPU_MIPS32_R1) += \ 203cflags-$(CONFIG_CPU_MIPS32_R1) += \
194 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \ 204 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
195 -Wa,--trap 205 -Wa,--trap
206CHECKFLAGS-$(CONFIG_CPU_MIPS32_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS32
196 207
197cflags-$(CONFIG_CPU_MIPS32_R2) += \ 208cflags-$(CONFIG_CPU_MIPS32_R2) += \
198 $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \ 209 $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \
199 -Wa,--trap 210 -Wa,--trap
211CHECKFLAGS-$(CONFIG_CPU_MIPS32_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS32
200 212
201cflags-$(CONFIG_CPU_MIPS64_R1) += \ 213cflags-$(CONFIG_CPU_MIPS64_R1) += \
202 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \ 214 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
203 -Wa,--trap 215 -Wa,--trap
216CHECKFLAGS-$(CONFIG_CPU_MIPS64_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
204 217
205cflags-$(CONFIG_CPU_MIPS64_R2) += \ 218cflags-$(CONFIG_CPU_MIPS64_R2) += \
206 $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \ 219 $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \
207 -Wa,--trap 220 -Wa,--trap
221CHECKFLAGS-$(CONFIG_CPU_MIPS64_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
208 222
209cflags-$(CONFIG_CPU_R5000) += \ 223cflags-$(CONFIG_CPU_R5000) += \
210 $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \ 224 $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \
211 -Wa,--trap 225 -Wa,--trap
226CHECKFLAGS-$(CONFIG_CPU_R5000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
212 227
213cflags-$(CONFIG_CPU_R5432) += \ 228cflags-$(CONFIG_CPU_R5432) += \
214 $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \ 229 $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \
215 -Wa,--trap 230 -Wa,--trap
231CHECKFLAGS-$(CONFIG_CPU_R5432) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
216 232
217cflags-$(CONFIG_CPU_NEVADA) += \ 233cflags-$(CONFIG_CPU_NEVADA) += \
218 $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \ 234 $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \
219 -Wa,--trap 235 -Wa,--trap
220# $(call cc-option,-mmad) 236CHECKFLAGS-$(CONFIG_CPU_NEVADA) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
221 237
222cflags-$(CONFIG_CPU_RM7000) += \ 238cflags-$(CONFIG_CPU_RM7000) += \
223 $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \ 239 $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \
224 -Wa,--trap 240 -Wa,--trap
241CHECKFLAGS-$(CONFIG_CPU_RM7000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
225 242
226cflags-$(CONFIG_CPU_RM9000) += \ 243cflags-$(CONFIG_CPU_RM9000) += \
227 $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \ 244 $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \
228 -Wa,--trap 245 -Wa,--trap
246CHECKFLAGS-$(CONFIG_CPU_RM9000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
229 247
230 248
231cflags-$(CONFIG_CPU_SB1) += \ 249cflags-$(CONFIG_CPU_SB1) += \
232 $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \ 250 $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \
233 -Wa,--trap 251 -Wa,--trap
252CHECKFLAGS-$(CONFIG_CPU_SB1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
234 253
235cflags-$(CONFIG_CPU_R8000) += \ 254cflags-$(CONFIG_CPU_R8000) += \
236 $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \ 255 $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \
237 -Wa,--trap 256 -Wa,--trap
257CHECKFLAGS-$(CONFIG_CPU_R8000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
238 258
239cflags-$(CONFIG_CPU_R10000) += \ 259cflags-$(CONFIG_CPU_R10000) += \
240 $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \ 260 $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \
241 -Wa,--trap 261 -Wa,--trap
262CHECKFLAGS-$(CONFIG_CPU_R10000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
242 263
243ifdef CONFIG_CPU_SB1 264ifdef CONFIG_CPU_SB1
244ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 265ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
@@ -369,7 +390,7 @@ load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
369# Cobalt Server 390# Cobalt Server
370# 391#
371core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/ 392core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/
372cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/cobalt 393cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/mach-cobalt
373load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000 394load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
374 395
375# 396#
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c
index 65b84db800e4..4ffccedf5967 100644
--- a/arch/mips/au1000/common/reset.c
+++ b/arch/mips/au1000/common/reset.c
@@ -151,7 +151,7 @@ void au1000_restart(char *command)
151 } 151 }
152 152
153 set_c0_status(ST0_BEV | ST0_ERL); 153 set_c0_status(ST0_BEV | ST0_ERL);
154 set_c0_config(CONF_CM_UNCACHED); 154 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
155 flush_cache_all(); 155 flush_cache_all();
156 write_c0_wired(0); 156 write_c0_wired(0);
157 157
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 08c8c855cc9c..eb155c071aa6 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -33,6 +33,7 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/pm.h>
36 37
37#include <asm/cpu.h> 38#include <asm/cpu.h>
38#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
@@ -125,7 +126,7 @@ void __init plat_setup(void)
125#endif 126#endif
126 _machine_restart = au1000_restart; 127 _machine_restart = au1000_restart;
127 _machine_halt = au1000_halt; 128 _machine_halt = au1000_halt;
128 _machine_power_off = au1000_power_off; 129 pm_power_off = au1000_power_off;
129 board_time_init = au1xxx_time_init; 130 board_time_init = au1xxx_time_init;
130 board_timer_setup = au1xxx_timer_setup; 131 board_timer_setup = au1xxx_timer_setup;
131 132
diff --git a/arch/mips/cobalt/int-handler.S b/arch/mips/cobalt/int-handler.S
index f92608e8d84f..e75d5e3ca868 100644
--- a/arch/mips/cobalt/int-handler.S
+++ b/arch/mips/cobalt/int-handler.S
@@ -8,7 +8,7 @@
8 */ 8 */
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/mipsregs.h> 10#include <asm/mipsregs.h>
11#include <asm/cobalt/cobalt.h> 11#include <asm/mach-cobalt/cobalt.h>
12#include <asm/regdef.h> 12#include <asm/regdef.h>
13#include <asm/stackframe.h> 13#include <asm/stackframe.h>
14 14
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
index 0d90851f925e..f9a108820d6e 100644
--- a/arch/mips/cobalt/irq.c
+++ b/arch/mips/cobalt/irq.c
@@ -18,7 +18,7 @@
18#include <asm/gt64120.h> 18#include <asm/gt64120.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20 20
21#include <asm/cobalt/cobalt.h> 21#include <asm/mach-cobalt/cobalt.h>
22 22
23extern void cobalt_handle_int(void); 23extern void cobalt_handle_int(void);
24 24
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c
index 805a0e88507b..753dfccae6fa 100644
--- a/arch/mips/cobalt/reset.c
+++ b/arch/mips/cobalt/reset.c
@@ -16,7 +16,7 @@
16#include <asm/reboot.h> 16#include <asm/reboot.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/cobalt/cobalt.h> 19#include <asm/mach-cobalt/cobalt.h>
20 20
21void cobalt_machine_halt(void) 21void cobalt_machine_halt(void)
22{ 22{
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index d358a118fa31..b9713a723053 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 1997, 2004, 05 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv) 9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10 * 10 *
11 */ 11 */
@@ -13,6 +13,7 @@
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pm.h>
16#include <linux/serial.h> 17#include <linux/serial.h>
17#include <linux/serial_core.h> 18#include <linux/serial_core.h>
18 19
@@ -25,7 +26,7 @@
25#include <asm/gt64120.h> 26#include <asm/gt64120.h>
26#include <asm/serial.h> 27#include <asm/serial.h>
27 28
28#include <asm/cobalt/cobalt.h> 29#include <asm/mach-cobalt/cobalt.h>
29 30
30extern void cobalt_machine_restart(char *command); 31extern void cobalt_machine_restart(char *command);
31extern void cobalt_machine_halt(void); 32extern void cobalt_machine_halt(void);
@@ -99,7 +100,7 @@ void __init plat_setup(void)
99 100
100 _machine_restart = cobalt_machine_restart; 101 _machine_restart = cobalt_machine_restart;
101 _machine_halt = cobalt_machine_halt; 102 _machine_halt = cobalt_machine_halt;
102 _machine_power_off = cobalt_machine_power_off; 103 pm_power_off = cobalt_machine_power_off;
103 104
104 board_timer_setup = cobalt_timer_setup; 105 board_timer_setup = cobalt_timer_setup;
105 106
@@ -139,7 +140,7 @@ void __init plat_setup(void)
139 uart.type = PORT_UNKNOWN; 140 uart.type = PORT_UNKNOWN;
140 uart.uartclk = 18432000; 141 uart.uartclk = 18432000;
141 uart.irq = COBALT_SERIAL_IRQ; 142 uart.irq = COBALT_SERIAL_IRQ;
142 uart.flags = STD_COM_FLAGS; 143 uart.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
143 uart.iobase = 0xc800000; 144 uart.iobase = 0xc800000;
144 uart.iotype = UPIO_PORT; 145 uart.iotype = UPIO_PORT;
145 146
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 967e7acd8e1f..a34db6e82b27 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -102,6 +102,7 @@ CONFIG_CPU_R5000=y
102# CONFIG_CPU_RM9000 is not set 102# CONFIG_CPU_RM9000 is not set
103# CONFIG_CPU_SB1 is not set 103# CONFIG_CPU_SB1 is not set
104CONFIG_SYS_HAS_CPU_R5000=y 104CONFIG_SYS_HAS_CPU_R5000=y
105CONFIG_SYS_HAS_CPU_NEVADA=y
105CONFIG_SYS_HAS_CPU_RM7000=y 106CONFIG_SYS_HAS_CPU_RM7000=y
106CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y 107CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
107CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 108CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index dee44606164c..c02becab850b 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2 3# Linux kernel version: 2.6.16-rc2
4# Thu Nov 24 01:07:00 2005 4# Fri Feb 3 17:14:27 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -147,26 +147,27 @@ CONFIG_LOCALVERSION_AUTO=y
147# CONFIG_BSD_PROCESS_ACCT is not set 147# CONFIG_BSD_PROCESS_ACCT is not set
148# CONFIG_SYSCTL is not set 148# CONFIG_SYSCTL is not set
149# CONFIG_AUDIT is not set 149# CONFIG_AUDIT is not set
150# CONFIG_HOTPLUG is not set
151CONFIG_KOBJECT_UEVENT=y
152# CONFIG_IKCONFIG is not set 150# CONFIG_IKCONFIG is not set
153CONFIG_INITRAMFS_SOURCE="" 151CONFIG_INITRAMFS_SOURCE=""
154CONFIG_EMBEDDED=y 152CONFIG_EMBEDDED=y
155CONFIG_KALLSYMS=y 153CONFIG_KALLSYMS=y
156# CONFIG_KALLSYMS_EXTRA_PASS is not set 154# CONFIG_KALLSYMS_EXTRA_PASS is not set
155# CONFIG_HOTPLUG is not set
157CONFIG_PRINTK=y 156CONFIG_PRINTK=y
158# CONFIG_BUG is not set 157# CONFIG_BUG is not set
158CONFIG_ELF_CORE=y
159# CONFIG_BASE_FULL is not set 159# CONFIG_BASE_FULL is not set
160# CONFIG_FUTEX is not set 160# CONFIG_FUTEX is not set
161# CONFIG_EPOLL is not set 161# CONFIG_EPOLL is not set
162# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
163# CONFIG_SHMEM is not set 162# CONFIG_SHMEM is not set
164CONFIG_CC_ALIGN_FUNCTIONS=0 163CONFIG_CC_ALIGN_FUNCTIONS=0
165CONFIG_CC_ALIGN_LABELS=0 164CONFIG_CC_ALIGN_LABELS=0
166CONFIG_CC_ALIGN_LOOPS=0 165CONFIG_CC_ALIGN_LOOPS=0
167CONFIG_CC_ALIGN_JUMPS=0 166CONFIG_CC_ALIGN_JUMPS=0
167CONFIG_SLAB=y
168CONFIG_TINY_SHMEM=y 168CONFIG_TINY_SHMEM=y
169CONFIG_BASE_SMALL=1 169CONFIG_BASE_SMALL=1
170# CONFIG_SLOB is not set
170 171
171# 172#
172# Loadable module support 173# Loadable module support
@@ -266,11 +267,7 @@ CONFIG_TCP_CONG_BIC=y
266# CONFIG_HAMRADIO is not set 267# CONFIG_HAMRADIO is not set
267# CONFIG_IRDA is not set 268# CONFIG_IRDA is not set
268# CONFIG_BT is not set 269# CONFIG_BT is not set
269CONFIG_IEEE80211=y 270# CONFIG_IEEE80211 is not set
270# CONFIG_IEEE80211_DEBUG is not set
271CONFIG_IEEE80211_CRYPT_WEP=y
272CONFIG_IEEE80211_CRYPT_CCMP=y
273CONFIG_IEEE80211_CRYPT_TKIP=y
274 271
275# 272#
276# Device Drivers 273# Device Drivers
@@ -323,7 +320,7 @@ CONFIG_BLK_DEV_RAM_COUNT=16
323# 320#
324# SCSI device support 321# SCSI device support
325# 322#
326CONFIG_RAID_ATTRS=y 323# CONFIG_RAID_ATTRS is not set
327# CONFIG_SCSI is not set 324# CONFIG_SCSI is not set
328 325
329# 326#
@@ -366,24 +363,16 @@ CONFIG_NETDEVICES=y
366# 363#
367# PHY device support 364# PHY device support
368# 365#
369CONFIG_PHYLIB=y 366# CONFIG_PHYLIB is not set
370
371#
372# MII PHY device drivers
373#
374CONFIG_MARVELL_PHY=y
375CONFIG_DAVICOM_PHY=y
376CONFIG_QSEMI_PHY=y
377CONFIG_LXT_PHY=y
378CONFIG_CICADA_PHY=y
379 367
380# 368#
381# Ethernet (10 or 100Mbit) 369# Ethernet (10 or 100Mbit)
382# 370#
383CONFIG_NET_ETHERNET=y 371CONFIG_NET_ETHERNET=y
384CONFIG_MII=y 372# CONFIG_MII is not set
385# CONFIG_NET_VENDOR_3COM is not set 373# CONFIG_NET_VENDOR_3COM is not set
386# CONFIG_NET_VENDOR_SMC is not set 374# CONFIG_NET_VENDOR_SMC is not set
375# CONFIG_DM9000 is not set
387# CONFIG_NET_VENDOR_RACAL is not set 376# CONFIG_NET_VENDOR_RACAL is not set
388# CONFIG_DEPCA is not set 377# CONFIG_DEPCA is not set
389# CONFIG_HP100 is not set 378# CONFIG_HP100 is not set
@@ -479,6 +468,7 @@ CONFIG_HW_CONSOLE=y
479CONFIG_SERIAL_8250=y 468CONFIG_SERIAL_8250=y
480CONFIG_SERIAL_8250_CONSOLE=y 469CONFIG_SERIAL_8250_CONSOLE=y
481CONFIG_SERIAL_8250_NR_UARTS=4 470CONFIG_SERIAL_8250_NR_UARTS=4
471CONFIG_SERIAL_8250_RUNTIME_UARTS=4
482# CONFIG_SERIAL_8250_EXTENDED is not set 472# CONFIG_SERIAL_8250_EXTENDED is not set
483 473
484# 474#
@@ -518,6 +508,12 @@ CONFIG_SERIAL_CORE_CONSOLE=y
518# CONFIG_I2C is not set 508# CONFIG_I2C is not set
519 509
520# 510#
511# SPI support
512#
513# CONFIG_SPI is not set
514# CONFIG_SPI_MASTER is not set
515
516#
521# Dallas's 1-wire bus 517# Dallas's 1-wire bus
522# 518#
523# CONFIG_W1 is not set 519# CONFIG_W1 is not set
@@ -592,11 +588,14 @@ CONFIG_DUMMY_CONSOLE=y
592# 588#
593 589
594# 590#
591# EDAC - error detection and reporting (RAS)
592#
593
594#
595# File systems 595# File systems
596# 596#
597# CONFIG_EXT2_FS is not set 597# CONFIG_EXT2_FS is not set
598# CONFIG_EXT3_FS is not set 598# CONFIG_EXT3_FS is not set
599# CONFIG_JBD is not set
600# CONFIG_REISERFS_FS is not set 599# CONFIG_REISERFS_FS is not set
601# CONFIG_JFS_FS is not set 600# CONFIG_JFS_FS is not set
602# CONFIG_FS_POSIX_ACL is not set 601# CONFIG_FS_POSIX_ACL is not set
@@ -677,6 +676,7 @@ CONFIG_MSDOS_PARTITION=y
677# Kernel hacking 676# Kernel hacking
678# 677#
679# CONFIG_PRINTK_TIME is not set 678# CONFIG_PRINTK_TIME is not set
679# CONFIG_MAGIC_SYSRQ is not set
680# CONFIG_DEBUG_KERNEL is not set 680# CONFIG_DEBUG_KERNEL is not set
681CONFIG_LOG_BUF_SHIFT=14 681CONFIG_LOG_BUF_SHIFT=14
682CONFIG_CROSSCOMPILE=y 682CONFIG_CROSSCOMPILE=y
@@ -690,31 +690,7 @@ CONFIG_CMDLINE="console=ttyS0 debug ip=172.20.0.2:172.20.0.1::255.255.0.0"
690# 690#
691# Cryptographic options 691# Cryptographic options
692# 692#
693CONFIG_CRYPTO=y 693# CONFIG_CRYPTO is not set
694CONFIG_CRYPTO_HMAC=y
695CONFIG_CRYPTO_NULL=y
696CONFIG_CRYPTO_MD4=y
697CONFIG_CRYPTO_MD5=y
698CONFIG_CRYPTO_SHA1=y
699CONFIG_CRYPTO_SHA256=y
700CONFIG_CRYPTO_SHA512=y
701CONFIG_CRYPTO_WP512=y
702CONFIG_CRYPTO_TGR192=y
703CONFIG_CRYPTO_DES=y
704CONFIG_CRYPTO_BLOWFISH=y
705CONFIG_CRYPTO_TWOFISH=y
706CONFIG_CRYPTO_SERPENT=y
707CONFIG_CRYPTO_AES=y
708CONFIG_CRYPTO_CAST5=y
709CONFIG_CRYPTO_CAST6=y
710CONFIG_CRYPTO_TEA=y
711CONFIG_CRYPTO_ARC4=y
712CONFIG_CRYPTO_KHAZAD=y
713CONFIG_CRYPTO_ANUBIS=y
714CONFIG_CRYPTO_DEFLATE=y
715CONFIG_CRYPTO_MICHAEL_MIC=y
716CONFIG_CRYPTO_CRC32C=y
717# CONFIG_CRYPTO_TEST is not set
718 694
719# 695#
720# Hardware crypto devices 696# Hardware crypto devices
@@ -724,8 +700,6 @@ CONFIG_CRYPTO_CRC32C=y
724# Library routines 700# Library routines
725# 701#
726# CONFIG_CRC_CCITT is not set 702# CONFIG_CRC_CCITT is not set
727CONFIG_CRC16=y 703# CONFIG_CRC16 is not set
728CONFIG_CRC32=y 704CONFIG_CRC32=y
729CONFIG_LIBCRC32C=y 705# CONFIG_LIBCRC32C is not set
730CONFIG_ZLIB_INFLATE=y
731CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/mips/ddb5xxx/ddb5074/setup.c b/arch/mips/ddb5xxx/ddb5074/setup.c
index 11535be265b9..91456b068c2e 100644
--- a/arch/mips/ddb5xxx/ddb5074/setup.c
+++ b/arch/mips/ddb5xxx/ddb5074/setup.c
@@ -14,6 +14,7 @@
14#include <linux/ide.h> 14#include <linux/ide.h>
15#include <linux/ioport.h> 15#include <linux/ioport.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/pm.h>
17 18
18#include <asm/addrspace.h> 19#include <asm/addrspace.h>
19#include <asm/bcache.h> 20#include <asm/bcache.h>
@@ -95,7 +96,7 @@ void __init plat_setup(void)
95 96
96 _machine_restart = ddb_machine_restart; 97 _machine_restart = ddb_machine_restart;
97 _machine_halt = ddb_machine_halt; 98 _machine_halt = ddb_machine_halt;
98 _machine_power_off = ddb_machine_power_off; 99 pm_power_off = ddb_machine_power_off;
99 100
100 ddb_out32(DDB_BAR0, 0); 101 ddb_out32(DDB_BAR0, 0);
101 102
diff --git a/arch/mips/ddb5xxx/ddb5476/setup.c b/arch/mips/ddb5xxx/ddb5476/setup.c
index f4e480a74edf..c902adef5942 100644
--- a/arch/mips/ddb5xxx/ddb5476/setup.c
+++ b/arch/mips/ddb5xxx/ddb5476/setup.c
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/pm.h>
14 15
15#include <asm/addrspace.h> 16#include <asm/addrspace.h>
16#include <asm/bcache.h> 17#include <asm/bcache.h>
@@ -133,7 +134,7 @@ void __init plat_setup(void)
133 134
134 _machine_restart = ddb_machine_restart; 135 _machine_restart = ddb_machine_restart;
135 _machine_halt = ddb_machine_halt; 136 _machine_halt = ddb_machine_halt;
136 _machine_power_off = ddb_machine_power_off; 137 pm_power_off = ddb_machine_power_off;
137 138
138 /* request io port/mem resources */ 139 /* request io port/mem resources */
139 if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) || 140 if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) ||
diff --git a/arch/mips/ddb5xxx/ddb5477/setup.c b/arch/mips/ddb5xxx/ddb5477/setup.c
index 81163353c4a8..2f566034cc44 100644
--- a/arch/mips/ddb5xxx/ddb5477/setup.c
+++ b/arch/mips/ddb5xxx/ddb5477/setup.c
@@ -26,6 +26,7 @@
26#include <linux/major.h> 26#include <linux/major.h>
27#include <linux/kdev_t.h> 27#include <linux/kdev_t.h>
28#include <linux/root_dev.h> 28#include <linux/root_dev.h>
29#include <linux/pm.h>
29 30
30#include <asm/cpu.h> 31#include <asm/cpu.h>
31#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
@@ -182,7 +183,7 @@ void __init plat_setup(void)
182 183
183 _machine_restart = ddb_machine_restart; 184 _machine_restart = ddb_machine_restart;
184 _machine_halt = ddb_machine_halt; 185 _machine_halt = ddb_machine_halt;
185 _machine_power_off = ddb_machine_power_off; 186 pm_power_off = ddb_machine_power_off;
186 187
187 /* setup resource limits */ 188 /* setup resource limits */
188 ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1; 189 ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1;
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index 9ef54fe1feaa..7c1ca8f6330e 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -17,6 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/pm.h>
20 21
21#include <asm/bootinfo.h> 22#include <asm/bootinfo.h>
22#include <asm/cpu.h> 23#include <asm/cpu.h>
@@ -158,7 +159,7 @@ void __init plat_setup(void)
158 159
159 _machine_restart = dec_machine_restart; 160 _machine_restart = dec_machine_restart;
160 _machine_halt = dec_machine_halt; 161 _machine_halt = dec_machine_halt;
161 _machine_power_off = dec_machine_power_off; 162 pm_power_off = dec_machine_power_off;
162 163
163 ioport_resource.start = ~0UL; 164 ioport_resource.start = ~0UL;
164 ioport_resource.end = 0UL; 165 ioport_resource.end = 0UL;
diff --git a/arch/mips/gt64120/ev64120/setup.c b/arch/mips/gt64120/ev64120/setup.c
index 98b5a96cc039..6d859d1e7a2d 100644
--- a/arch/mips/gt64120/ev64120/setup.c
+++ b/arch/mips/gt64120/ev64120/setup.c
@@ -34,6 +34,8 @@
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/timex.h> 36#include <linux/timex.h>
37#include <linux/pm.h>
38
37#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
38#include <asm/page.h> 40#include <asm/page.h>
39#include <asm/io.h> 41#include <asm/io.h>
@@ -73,7 +75,7 @@ void __init plat_setup(void)
73{ 75{
74 _machine_restart = galileo_machine_restart; 76 _machine_restart = galileo_machine_restart;
75 _machine_halt = galileo_machine_halt; 77 _machine_halt = galileo_machine_halt;
76 _machine_power_off = galileo_machine_power_off; 78 pm_power_off = galileo_machine_power_off;
77 79
78 board_time_init = gt64120_time_init; 80 board_time_init = gt64120_time_init;
79 set_io_port_base(KSEG1); 81 set_io_port_base(KSEG1);
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
index 0d07c33112d0..20b65d3d2151 100644
--- a/arch/mips/gt64120/momenco_ocelot/setup.c
+++ b/arch/mips/gt64120/momenco_ocelot/setup.c
@@ -4,7 +4,7 @@
4 * BRIEF MODULE DESCRIPTION 4 * BRIEF MODULE DESCRIPTION
5 * Momentum Computer Ocelot (CP7000) - board dependent boot routines 5 * Momentum Computer Ocelot (CP7000) - board dependent boot routines
6 * 6 *
7 * Copyright (C) 1996, 1997, 2001 Ralf Baechle 7 * Copyright (C) 1996, 1997, 2001, 06 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2000 RidgeRun, Inc. 8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Copyright (C) 2001 Red Hat, Inc. 9 * Copyright (C) 2001 Red Hat, Inc.
10 * Copyright (C) 2002 Momentum Computer 10 * Copyright (C) 2002 Momentum Computer
@@ -47,6 +47,8 @@
47#include <linux/pci.h> 47#include <linux/pci.h>
48#include <linux/timex.h> 48#include <linux/timex.h>
49#include <linux/vmalloc.h> 49#include <linux/vmalloc.h>
50#include <linux/pm.h>
51
50#include <asm/time.h> 52#include <asm/time.h>
51#include <asm/bootinfo.h> 53#include <asm/bootinfo.h>
52#include <asm/page.h> 54#include <asm/page.h>
@@ -159,7 +161,7 @@ void __init plat_setup(void)
159 161
160 _machine_restart = momenco_ocelot_restart; 162 _machine_restart = momenco_ocelot_restart;
161 _machine_halt = momenco_ocelot_halt; 163 _machine_halt = momenco_ocelot_halt;
162 _machine_power_off = momenco_ocelot_power_off; 164 pm_power_off = momenco_ocelot_power_off;
163 165
164 /* 166 /*
165 * initrd_start = (ulong)ocelot_initrd_start; 167 * initrd_start = (ulong)ocelot_initrd_start;
diff --git a/arch/mips/ite-boards/generic/it8172_setup.c b/arch/mips/ite-boards/generic/it8172_setup.c
index 062429dd7ca0..fc73c8d69df7 100644
--- a/arch/mips/ite-boards/generic/it8172_setup.c
+++ b/arch/mips/ite-boards/generic/it8172_setup.c
@@ -34,6 +34,7 @@
34#include <linux/major.h> 34#include <linux/major.h>
35#include <linux/kdev_t.h> 35#include <linux/kdev_t.h>
36#include <linux/root_dev.h> 36#include <linux/root_dev.h>
37#include <linux/pm.h>
37 38
38#include <asm/cpu.h> 39#include <asm/cpu.h>
39#include <asm/time.h> 40#include <asm/time.h>
@@ -125,7 +126,7 @@ void __init plat_setup(void)
125 126
126 _machine_restart = it8172_restart; 127 _machine_restart = it8172_restart;
127 _machine_halt = it8172_halt; 128 _machine_halt = it8172_halt;
128 _machine_power_off = it8172_power_off; 129 pm_power_off = it8172_power_off;
129 130
130 /* 131 /*
131 * IO/MEM resources. 132 * IO/MEM resources.
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index 044df9d4ab7c..4036dc434551 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -19,6 +19,8 @@
19#include <linux/console.h> 19#include <linux/console.h>
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <linux/ide.h> 21#include <linux/ide.h>
22#include <linux/pm.h>
23
22#include <asm/bootinfo.h> 24#include <asm/bootinfo.h>
23#include <asm/irq.h> 25#include <asm/irq.h>
24#include <asm/jazz.h> 26#include <asm/jazz.h>
@@ -79,7 +81,7 @@ void __init plat_setup(void)
79 81
80 _machine_restart = jazz_machine_restart; 82 _machine_restart = jazz_machine_restart;
81 _machine_halt = jazz_machine_halt; 83 _machine_halt = jazz_machine_halt;
82 _machine_power_off = jazz_machine_power_off; 84 pm_power_off = jazz_machine_power_off;
83 85
84#warning "Somebody should check if screen_info is ok for Jazz." 86#warning "Somebody should check if screen_info is ok for Jazz."
85 87
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 4763957df8fc..9359cc413494 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -44,6 +44,7 @@
44#include <linux/ioport.h> 44#include <linux/ioport.h>
45#include <linux/param.h> /* for HZ */ 45#include <linux/param.h> /* for HZ */
46#include <linux/delay.h> 46#include <linux/delay.h>
47#include <linux/pm.h>
47#ifdef CONFIG_SERIAL_TXX9 48#ifdef CONFIG_SERIAL_TXX9
48#include <linux/tty.h> 49#include <linux/tty.h>
49#include <linux/serial.h> 50#include <linux/serial.h>
@@ -211,7 +212,7 @@ void __init plat_setup(void)
211 212
212 _machine_restart = jmr3927_machine_restart; 213 _machine_restart = jmr3927_machine_restart;
213 _machine_halt = jmr3927_machine_halt; 214 _machine_halt = jmr3927_machine_halt;
214 _machine_power_off = jmr3927_machine_power_off; 215 pm_power_off = jmr3927_machine_power_off;
215 216
216 /* 217 /*
217 * IO/MEM resources. 218 * IO/MEM resources.
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index fac48ad27b34..292f8b243a5e 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -2,8 +2,8 @@
2 * Processor capabilities determination functions. 2 * Processor capabilities determination functions.
3 * 3 *
4 * Copyright (C) xxxx the Anonymous 4 * Copyright (C) xxxx the Anonymous
5 * Copyright (C) 1994 - 2006 Ralf Baechle
5 * Copyright (C) 2003, 2004 Maciej W. Rozycki 6 * Copyright (C) 2003, 2004 Maciej W. Rozycki
6 * Copyright (C) 1994 - 2003 Ralf Baechle
7 * Copyright (C) 2001, 2004 MIPS Inc. 7 * Copyright (C) 2001, 2004 MIPS Inc.
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
@@ -641,10 +641,9 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
641 switch (c->processor_id & 0xff00) { 641 switch (c->processor_id & 0xff00) {
642 case PRID_IMP_SB1: 642 case PRID_IMP_SB1:
643 c->cputype = CPU_SB1; 643 c->cputype = CPU_SB1;
644#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
645 /* FPU in pass1 is known to have issues. */ 644 /* FPU in pass1 is known to have issues. */
646 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); 645 if ((c->processor_id & 0xff) < 0x20)
647#endif 646 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
648 break; 647 break;
649 case PRID_IMP_SB1A: 648 case PRID_IMP_SB1A:
650 c->cputype = CPU_SB1A; 649 c->cputype = CPU_SB1A;
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index aa18a8b7b380..13f22d1d0e8b 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -233,11 +233,11 @@ NESTED(except_vec_nmi, 0, sp)
233NESTED(nmi_handler, PT_SIZE, sp) 233NESTED(nmi_handler, PT_SIZE, sp)
234 .set push 234 .set push
235 .set noat 235 .set noat
236 .set mips3
237 SAVE_ALL 236 SAVE_ALL
238 move a0, sp 237 move a0, sp
239 jal nmi_exception_handler 238 jal nmi_exception_handler
240 RESTORE_ALL 239 RESTORE_ALL
240 .set mips3
241 eret 241 eret
242 .set pop 242 .set pop
243 END(nmi_handler) 243 END(nmi_handler)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index fa98f10d0132..5232fc752935 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others. 6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
7 * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2004 Thiemo Seufer 9 * Copyright (C) 2004 Thiemo Seufer
9 */ 10 */
@@ -58,8 +59,8 @@ ATTRIB_NORET void cpu_idle(void)
58 } 59 }
59} 60}
60 61
61extern int do_signal(sigset_t *oldset, struct pt_regs *regs); 62extern void do_signal(struct pt_regs *regs);
62extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); 63extern void do_signal32(struct pt_regs *regs);
63 64
64/* 65/*
65 * Native o32 and N64 ABI without DSP ASE 66 * Native o32 and N64 ABI without DSP ASE
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 0c82b25d8c6d..0d5cf97af727 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -88,7 +88,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
88 ret = -EIO; 88 ret = -EIO;
89 if (copied != sizeof(tmp)) 89 if (copied != sizeof(tmp))
90 break; 90 break;
91 ret = put_user(tmp, (unsigned int *) (unsigned long) data); 91 ret = put_user(tmp, (unsigned int __user *) (unsigned long) data);
92 break; 92 break;
93 } 93 }
94 94
@@ -174,8 +174,10 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
174 case FPC_EIR: { /* implementation / version register */ 174 case FPC_EIR: { /* implementation / version register */
175 unsigned int flags; 175 unsigned int flags;
176 176
177 if (!cpu_has_fpu) 177 if (!cpu_has_fpu) {
178 tmp = 0;
178 break; 179 break;
180 }
179 181
180 preempt_disable(); 182 preempt_disable();
181 if (cpu_has_mipsmt) { 183 if (cpu_has_mipsmt) {
@@ -194,15 +196,18 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
194 preempt_enable(); 196 preempt_enable();
195 break; 197 break;
196 } 198 }
197 case DSP_BASE ... DSP_BASE + 5: 199 case DSP_BASE ... DSP_BASE + 5: {
200 dspreg_t *dregs;
201
198 if (!cpu_has_dsp) { 202 if (!cpu_has_dsp) {
199 tmp = 0; 203 tmp = 0;
200 ret = -EIO; 204 ret = -EIO;
201 goto out_tsk; 205 goto out_tsk;
202 } 206 }
203 dspreg_t *dregs = __get_dsp_regs(child); 207 dregs = __get_dsp_regs(child);
204 tmp = (unsigned long) (dregs[addr - DSP_BASE]); 208 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
205 break; 209 break;
210 }
206 case DSP_CONTROL: 211 case DSP_CONTROL:
207 if (!cpu_has_dsp) { 212 if (!cpu_has_dsp) {
208 tmp = 0; 213 tmp = 0;
@@ -216,7 +221,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
216 ret = -EIO; 221 ret = -EIO;
217 goto out_tsk; 222 goto out_tsk;
218 } 223 }
219 ret = put_user(tmp, (unsigned *) (unsigned long) data); 224 ret = put_user(tmp, (unsigned __user *) (unsigned long) data);
220 break; 225 break;
221 } 226 }
222 227
@@ -304,15 +309,18 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
304 else 309 else
305 child->thread.fpu.soft.fcr31 = data; 310 child->thread.fpu.soft.fcr31 = data;
306 break; 311 break;
307 case DSP_BASE ... DSP_BASE + 5: 312 case DSP_BASE ... DSP_BASE + 5: {
313 dspreg_t *dregs;
314
308 if (!cpu_has_dsp) { 315 if (!cpu_has_dsp) {
309 ret = -EIO; 316 ret = -EIO;
310 break; 317 break;
311 } 318 }
312 319
313 dspreg_t *dregs = __get_dsp_regs(child); 320 dregs = __get_dsp_regs(child);
314 dregs[addr - DSP_BASE] = data; 321 dregs[addr - DSP_BASE] = data;
315 break; 322 break;
323 }
316 case DSP_CONTROL: 324 case DSP_CONTROL:
317 if (!cpu_has_dsp) { 325 if (!cpu_has_dsp) {
318 ret = -EIO; 326 ret = -EIO;
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 5e37df3111ad..621037db2290 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -3,17 +3,16 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2001 by Ralf Baechle 6 * Copyright (C) 2001, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2001 MIPS Technologies, Inc. 7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */ 8 */
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/pm.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/reboot.h> 13#include <linux/reboot.h>
13#include <asm/reboot.h>
14 14
15void (*pm_power_off)(void); 15#include <asm/reboot.h>
16EXPORT_SYMBOL(pm_power_off);
17 16
18/* 17/*
19 * Urgs ... Too many MIPS machines to handle this in a generic way. 18 * Urgs ... Too many MIPS machines to handle this in a generic way.
@@ -22,23 +21,22 @@ EXPORT_SYMBOL(pm_power_off);
22 */ 21 */
23void (*_machine_restart)(char *command); 22void (*_machine_restart)(char *command);
24void (*_machine_halt)(void); 23void (*_machine_halt)(void);
25void (*_machine_power_off)(void); 24void (*pm_power_off)(void);
26 25
27void machine_restart(char *command) 26void machine_restart(char *command)
28{ 27{
29 _machine_restart(command); 28 if (_machine_restart)
29 _machine_restart(command);
30} 30}
31 31
32void machine_halt(void) 32void machine_halt(void)
33{ 33{
34 _machine_halt(); 34 if (_machine_halt)
35 _machine_halt();
35} 36}
36 37
37void machine_power_off(void) 38void machine_power_off(void)
38{ 39{
39 if (pm_power_off) 40 if (pm_power_off)
40 pm_power_off(); 41 pm_power_off();
41
42 _machine_power_off();
43} 42}
44
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 1d855112bac2..986a9cf23067 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org)
3 * 4 *
4 * This program is free software; you can distribute it and/or modify it 5 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as 6 * under the terms of the GNU General Public License (Version 2) as
@@ -20,9 +21,12 @@
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/fs.h> 22#include <linux/fs.h>
22#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/irq.h>
23#include <linux/poll.h> 26#include <linux/poll.h>
24#include <linux/sched.h> 27#include <linux/sched.h>
25#include <linux/wait.h> 28#include <linux/wait.h>
29
26#include <asm/mipsmtregs.h> 30#include <asm/mipsmtregs.h>
27#include <asm/bitops.h> 31#include <asm/bitops.h>
28#include <asm/cpu.h> 32#include <asm/cpu.h>
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index a42e0e8caa7b..d7c4a38ed5ae 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -617,6 +617,23 @@ einval: li v0, -EINVAL
617 sys sys_inotify_init 0 617 sys sys_inotify_init 0
618 sys sys_inotify_add_watch 3 /* 4285 */ 618 sys sys_inotify_add_watch 3 /* 4285 */
619 sys sys_inotify_rm_watch 2 619 sys sys_inotify_rm_watch 2
620 sys sys_migrate_pages 4
621 sys sys_openat 4
622 sys sys_mkdirat 3
623 sys sys_mknodat 4 /* 4290 */
624 sys sys_fchownat 5
625 sys sys_futimesat 3
626 sys sys_newfstatat 4
627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4
630 sys sys_symlinkat 3
631 sys sys_readlinkat 4
632 sys sys_fchmodat 3
633 sys sys_faccessat 3 /* 4300 */
634 sys sys_pselect6 6
635 sys sys_ppoll 5
636 sys sys_unshare 1
620 .endm 637 .endm
621 638
622 /* We pre-compute the number of _instruction_ bytes needed to 639 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 47bfbd416709..98bf25df56f3 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -443,3 +443,20 @@ sys_call_table:
443 PTR sys_inotify_init 443 PTR sys_inotify_init
444 PTR sys_inotify_add_watch 444 PTR sys_inotify_add_watch
445 PTR sys_inotify_rm_watch /* 5245 */ 445 PTR sys_inotify_rm_watch /* 5245 */
446 PTR sys_migrate_pages
447 PTR sys_openat
448 PTR sys_mkdirat
449 PTR sys_mknodat
450 PTR sys_fchownat /* 5250 */
451 PTR sys_futimesat
452 PTR sys_newfstatat
453 PTR sys_unlinkat
454 PTR sys_renameat
455 PTR sys_linkat /* 5255 */
456 PTR sys_symlinkat
457 PTR sys_readlinkat
458 PTR sys_fchmodat
459 PTR sys_faccessat
460 PTR sys_pselect6 /* 5260 */
461 PTR sys_ppoll
462 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index b465ced1758f..bc4980cefc8b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -369,3 +369,20 @@ EXPORT(sysn32_call_table)
369 PTR sys_inotify_init 369 PTR sys_inotify_init
370 PTR sys_inotify_add_watch 370 PTR sys_inotify_add_watch
371 PTR sys_inotify_rm_watch 371 PTR sys_inotify_rm_watch
372 PTR sys_migrate_pages /* 6250 */
373 PTR sys_openat
374 PTR sys_mkdirat
375 PTR sys_mknodat
376 PTR sys_fchownat
377 PTR sys_futimesat /* 6255 */
378 PTR sys_newfstatat
379 PTR sys_unlinkat
380 PTR sys_renameat
381 PTR sys_linkat
382 PTR sys_symlinkat /* 6260 */
383 PTR sys_readlinkat
384 PTR sys_fchmodat
385 PTR sys_faccessat
386 PTR sys_pselect6
387 PTR sys_ppoll /* 6265 */
388 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 3d338ca7eeeb..5b0414018c9a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -491,4 +491,21 @@ sys_call_table:
491 PTR sys_inotify_init 491 PTR sys_inotify_init
492 PTR sys_inotify_add_watch /* 4285 */ 492 PTR sys_inotify_add_watch /* 4285 */
493 PTR sys_inotify_rm_watch 493 PTR sys_inotify_rm_watch
494 PTR sys_migrate_pages
495 PTR compat_sys_openat
496 PTR sys_mkdirat
497 PTR sys_mknodat /* 4290 */
498 PTR sys_fchownat
499 PTR compat_sys_futimesat
500 PTR compat_sys_newfstatat
501 PTR sys_unlinkat
502 PTR sys_renameat /* 4295 */
503 PTR sys_linkat
504 PTR sys_symlinkat
505 PTR sys_readlinkat
506 PTR sys_fchmodat
507 PTR sys_faccessat /* 4300 */
508 PTR sys_pselect6
509 PTR sys_ppoll
510 PTR sys_unshare
494 .size sys_call_table,.-sys_call_table 511 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 0f66ae5838b9..0fbc492d24b4 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -11,7 +11,7 @@
11#include <linux/config.h> 11#include <linux/config.h>
12 12
13static inline int 13static inline int
14setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 14setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
15{ 15{
16 int err = 0; 16 int err = 0;
17 17
@@ -82,7 +82,7 @@ out:
82} 82}
83 83
84static inline int 84static inline int
85restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 85restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
86{ 86{
87 unsigned int used_math; 87 unsigned int used_math;
88 unsigned long treg; 88 unsigned long treg;
@@ -157,7 +157,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
157/* 157/*
158 * Determine which stack to use.. 158 * Determine which stack to use..
159 */ 159 */
160static inline void * 160static inline void __user *
161get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 161get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
162{ 162{
163 unsigned long sp; 163 unsigned long sp;
@@ -176,7 +176,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
177 sp = current->sas_ss_sp + current->sas_ss_size; 177 sp = current->sas_ss_sp + current->sas_ss_size;
178 178
179 return (void *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK)); 179 return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK));
180} 180}
181 181
182static inline int install_sigtramp(unsigned int __user *tramp, 182static inline int install_sigtramp(unsigned int __user *tramp,
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 7d1800fe7038..c974cc9b30eb 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -39,8 +39,6 @@
39 39
40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
41 41
42int do_signal(sigset_t *oldset, struct pt_regs *regs);
43
44/* 42/*
45 * Atomically swap in the new signal mask, and wait for a signal. 43 * Atomically swap in the new signal mask, and wait for a signal.
46 */ 44 */
@@ -50,7 +48,7 @@ save_static_function(sys_sigsuspend);
50__attribute_used__ noinline static int 48__attribute_used__ noinline static int
51_sys_sigsuspend(nabi_no_regargs struct pt_regs regs) 49_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
52{ 50{
53 sigset_t saveset, newset; 51 sigset_t newset;
54 sigset_t __user *uset; 52 sigset_t __user *uset;
55 53
56 uset = (sigset_t __user *) regs.regs[4]; 54 uset = (sigset_t __user *) regs.regs[4];
@@ -59,19 +57,15 @@ _sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
59 sigdelsetmask(&newset, ~_BLOCKABLE); 57 sigdelsetmask(&newset, ~_BLOCKABLE);
60 58
61 spin_lock_irq(&current->sighand->siglock); 59 spin_lock_irq(&current->sighand->siglock);
62 saveset = current->blocked; 60 current->saved_sigmask = current->blocked;
63 current->blocked = newset; 61 current->blocked = newset;
64 recalc_sigpending(); 62 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock); 63 spin_unlock_irq(&current->sighand->siglock);
66 64
67 regs.regs[2] = EINTR; 65 current->state = TASK_INTERRUPTIBLE;
68 regs.regs[7] = 1; 66 schedule();
69 while (1) { 67 set_thread_flag(TIF_RESTORE_SIGMASK);
70 current->state = TASK_INTERRUPTIBLE; 68 return -ERESTARTNOHAND;
71 schedule();
72 if (do_signal(&saveset, &regs))
73 return -EINTR;
74 }
75} 69}
76#endif 70#endif
77 71
@@ -79,7 +73,7 @@ save_static_function(sys_rt_sigsuspend);
79__attribute_used__ noinline static int 73__attribute_used__ noinline static int
80_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 74_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
81{ 75{
82 sigset_t saveset, newset; 76 sigset_t newset;
83 sigset_t __user *unewset; 77 sigset_t __user *unewset;
84 size_t sigsetsize; 78 size_t sigsetsize;
85 79
@@ -94,19 +88,15 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
94 sigdelsetmask(&newset, ~_BLOCKABLE); 88 sigdelsetmask(&newset, ~_BLOCKABLE);
95 89
96 spin_lock_irq(&current->sighand->siglock); 90 spin_lock_irq(&current->sighand->siglock);
97 saveset = current->blocked; 91 current->saved_sigmask = current->blocked;
98 current->blocked = newset; 92 current->blocked = newset;
99 recalc_sigpending(); 93 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock); 94 spin_unlock_irq(&current->sighand->siglock);
101 95
102 regs.regs[2] = EINTR; 96 current->state = TASK_INTERRUPTIBLE;
103 regs.regs[7] = 1; 97 schedule();
104 while (1) { 98 set_thread_flag(TIF_RESTORE_SIGMASK);
105 current->state = TASK_INTERRUPTIBLE; 99 return -ERESTARTNOHAND;
106 schedule();
107 if (do_signal(&saveset, &regs))
108 return -EINTR;
109 }
110} 100}
111 101
112#ifdef CONFIG_TRAD_SIGNALS 102#ifdef CONFIG_TRAD_SIGNALS
@@ -199,10 +189,10 @@ save_static_function(sys_sigreturn);
199__attribute_used__ noinline static void 189__attribute_used__ noinline static void
200_sys_sigreturn(nabi_no_regargs struct pt_regs regs) 190_sys_sigreturn(nabi_no_regargs struct pt_regs regs)
201{ 191{
202 struct sigframe *frame; 192 struct sigframe __user *frame;
203 sigset_t blocked; 193 sigset_t blocked;
204 194
205 frame = (struct sigframe *) regs.regs[29]; 195 frame = (struct sigframe __user *) regs.regs[29];
206 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 196 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
207 goto badframe; 197 goto badframe;
208 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 198 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
@@ -236,11 +226,11 @@ save_static_function(sys_rt_sigreturn);
236__attribute_used__ noinline static void 226__attribute_used__ noinline static void
237_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 227_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
238{ 228{
239 struct rt_sigframe *frame; 229 struct rt_sigframe __user *frame;
240 sigset_t set; 230 sigset_t set;
241 stack_t st; 231 stack_t st;
242 232
243 frame = (struct rt_sigframe *) regs.regs[29]; 233 frame = (struct rt_sigframe __user *) regs.regs[29];
244 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 234 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
245 goto badframe; 235 goto badframe;
246 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 236 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -259,7 +249,7 @@ _sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
259 goto badframe; 249 goto badframe;
260 /* It is more difficult to avoid calling this function than to 250 /* It is more difficult to avoid calling this function than to
261 call it and ignore errors. */ 251 call it and ignore errors. */
262 do_sigaltstack(&st, NULL, regs.regs[29]); 252 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
263 253
264 /* 254 /*
265 * Don't let your children do this ... 255 * Don't let your children do this ...
@@ -279,7 +269,7 @@ badframe:
279int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, 269int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
280 int signr, sigset_t *set) 270 int signr, sigset_t *set)
281{ 271{
282 struct sigframe *frame; 272 struct sigframe __user *frame;
283 int err = 0; 273 int err = 0;
284 274
285 frame = get_sigframe(ka, regs, sizeof(*frame)); 275 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -315,18 +305,18 @@ int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
315 current->comm, current->pid, 305 current->comm, current->pid,
316 frame, regs->cp0_epc, frame->regs[31]); 306 frame, regs->cp0_epc, frame->regs[31]);
317#endif 307#endif
318 return 1; 308 return 0;
319 309
320give_sigsegv: 310give_sigsegv:
321 force_sigsegv(signr, current); 311 force_sigsegv(signr, current);
322 return 0; 312 return -EFAULT;
323} 313}
324#endif 314#endif
325 315
326int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, 316int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
327 int signr, sigset_t *set, siginfo_t *info) 317 int signr, sigset_t *set, siginfo_t *info)
328{ 318{
329 struct rt_sigframe *frame; 319 struct rt_sigframe __user *frame;
330 int err = 0; 320 int err = 0;
331 321
332 frame = get_sigframe(ka, regs, sizeof(*frame)); 322 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -340,7 +330,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
340 330
341 /* Create the ucontext. */ 331 /* Create the ucontext. */
342 err |= __put_user(0, &frame->rs_uc.uc_flags); 332 err |= __put_user(0, &frame->rs_uc.uc_flags);
343 err |= __put_user(0, &frame->rs_uc.uc_link); 333 err |= __put_user(NULL, &frame->rs_uc.uc_link);
344 err |= __put_user((void *)current->sas_ss_sp, 334 err |= __put_user((void *)current->sas_ss_sp,
345 &frame->rs_uc.uc_stack.ss_sp); 335 &frame->rs_uc.uc_stack.ss_sp);
346 err |= __put_user(sas_ss_flags(regs->regs[29]), 336 err |= __put_user(sas_ss_flags(regs->regs[29]),
@@ -375,11 +365,11 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
375 current->comm, current->pid, 365 current->comm, current->pid,
376 frame, regs->cp0_epc, regs->regs[31]); 366 frame, regs->cp0_epc, regs->regs[31]);
377#endif 367#endif
378 return 1; 368 return 0;
379 369
380give_sigsegv: 370give_sigsegv:
381 force_sigsegv(signr, current); 371 force_sigsegv(signr, current);
382 return 0; 372 return -EFAULT;
383} 373}
384 374
385static inline int handle_signal(unsigned long sig, siginfo_t *info, 375static inline int handle_signal(unsigned long sig, siginfo_t *info,
@@ -393,7 +383,7 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
393 regs->regs[2] = EINTR; 383 regs->regs[2] = EINTR;
394 break; 384 break;
395 case ERESTARTSYS: 385 case ERESTARTSYS:
396 if(!(ka->sa.sa_flags & SA_RESTART)) { 386 if (!(ka->sa.sa_flags & SA_RESTART)) {
397 regs->regs[2] = EINTR; 387 regs->regs[2] = EINTR;
398 break; 388 break;
399 } 389 }
@@ -420,9 +410,10 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
420 return ret; 410 return ret;
421} 411}
422 412
423int do_signal(sigset_t *oldset, struct pt_regs *regs) 413void do_signal(struct pt_regs *regs)
424{ 414{
425 struct k_sigaction ka; 415 struct k_sigaction ka;
416 sigset_t *oldset;
426 siginfo_t info; 417 siginfo_t info;
427 int signr; 418 int signr;
428 419
@@ -432,17 +423,31 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
432 * if so. 423 * if so.
433 */ 424 */
434 if (!user_mode(regs)) 425 if (!user_mode(regs))
435 return 1; 426 return;
436 427
437 if (try_to_freeze()) 428 if (try_to_freeze())
438 goto no_signal; 429 goto no_signal;
439 430
440 if (!oldset) 431 if (test_thread_flag(TIF_RESTORE_SIGMASK))
432 oldset = &current->saved_sigmask;
433 else
441 oldset = &current->blocked; 434 oldset = &current->blocked;
442 435
436
443 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 437 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
444 if (signr > 0) 438 if (signr > 0) {
445 return handle_signal(signr, &info, &ka, oldset, regs); 439 /* Whee! Actually deliver the signal. */
440 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
441 /*
442 * A signal was successfully delivered; the saved
443 * sigmask will have been stored in the signal frame,
444 * and will be restored by sigreturn, so we can simply
445 * clear the TIF_RESTORE_SIGMASK flag.
446 */
447 if (test_thread_flag(TIF_RESTORE_SIGMASK))
448 clear_thread_flag(TIF_RESTORE_SIGMASK);
449 }
450 }
446 451
447no_signal: 452no_signal:
448 /* 453 /*
@@ -463,18 +468,25 @@ no_signal:
463 regs->cp0_epc -= 4; 468 regs->cp0_epc -= 4;
464 } 469 }
465 } 470 }
466 return 0; 471
472 /*
473 * If there's no signal to deliver, we just put the saved sigmask
474 * back
475 */
476 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
477 clear_thread_flag(TIF_RESTORE_SIGMASK);
478 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
479 }
467} 480}
468 481
469/* 482/*
470 * notification of userspace execution resumption 483 * notification of userspace execution resumption
471 * - triggered by current->work.notify_resume 484 * - triggered by the TIF_WORK_MASK flags
472 */ 485 */
473asmlinkage void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, 486asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
474 __u32 thread_info_flags) 487 __u32 thread_info_flags)
475{ 488{
476 /* deal with pending signal delivery */ 489 /* deal with pending signal delivery */
477 if (thread_info_flags & _TIF_SIGPENDING) { 490 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
478 current->thread.abi->do_signal(oldset, regs); 491 current->thread.abi->do_signal(regs);
479 }
480} 492}
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 98b185bbc947..da3271e1fdac 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -144,7 +144,7 @@ struct ucontext32 {
144extern void __put_sigset_unknown_nsig(void); 144extern void __put_sigset_unknown_nsig(void);
145extern void __get_sigset_unknown_nsig(void); 145extern void __get_sigset_unknown_nsig(void);
146 146
147static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t *ubuf) 147static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf)
148{ 148{
149 int err = 0; 149 int err = 0;
150 150
@@ -269,7 +269,7 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
269 if (!access_ok(VERIFY_READ, act, sizeof(*act))) 269 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
270 return -EFAULT; 270 return -EFAULT;
271 err |= __get_user(handler, &act->sa_handler); 271 err |= __get_user(handler, &act->sa_handler);
272 new_ka.sa.sa_handler = (void*)(s64)handler; 272 new_ka.sa.sa_handler = (void __user *)(s64)handler;
273 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); 273 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
274 err |= __get_user(mask, &act->sa_mask.sig[0]); 274 err |= __get_user(mask, &act->sa_mask.sig[0]);
275 if (err) 275 if (err)
@@ -299,8 +299,8 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
299 299
300asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) 300asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
301{ 301{
302 const stack32_t *uss = (const stack32_t *) regs.regs[4]; 302 const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4];
303 stack32_t *uoss = (stack32_t *) regs.regs[5]; 303 stack32_t __user *uoss = (stack32_t __user *) regs.regs[5];
304 unsigned long usp = regs.regs[29]; 304 unsigned long usp = regs.regs[29];
305 stack_t kss, koss; 305 stack_t kss, koss;
306 int ret, err = 0; 306 int ret, err = 0;
@@ -319,7 +319,8 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
319 } 319 }
320 320
321 set_fs (KERNEL_DS); 321 set_fs (KERNEL_DS);
322 ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, usp); 322 ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL,
323 uoss ? (stack_t __user *)&koss : NULL, usp);
323 set_fs (old_fs); 324 set_fs (old_fs);
324 325
325 if (!ret && uoss) { 326 if (!ret && uoss) {
@@ -335,7 +336,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
335 return ret; 336 return ret;
336} 337}
337 338
338static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 *sc) 339static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user *sc)
339{ 340{
340 u32 used_math; 341 u32 used_math;
341 int err = 0; 342 int err = 0;
@@ -420,7 +421,7 @@ struct rt_sigframe32 {
420#endif 421#endif
421}; 422};
422 423
423int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from) 424int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
424{ 425{
425 int err; 426 int err;
426 427
@@ -455,7 +456,7 @@ int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from)
455 err |= __put_user(from->si_uid, &to->si_uid); 456 err |= __put_user(from->si_uid, &to->si_uid);
456 break; 457 break;
457 case __SI_FAULT >> 16: 458 case __SI_FAULT >> 16:
458 err |= __put_user((long)from->si_addr, &to->si_addr); 459 err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
459 break; 460 break;
460 case __SI_POLL >> 16: 461 case __SI_POLL >> 16:
461 err |= __put_user(from->si_band, &to->si_band); 462 err |= __put_user(from->si_band, &to->si_band);
@@ -476,10 +477,10 @@ save_static_function(sys32_sigreturn);
476__attribute_used__ noinline static void 477__attribute_used__ noinline static void
477_sys32_sigreturn(nabi_no_regargs struct pt_regs regs) 478_sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
478{ 479{
479 struct sigframe *frame; 480 struct sigframe __user *frame;
480 sigset_t blocked; 481 sigset_t blocked;
481 482
482 frame = (struct sigframe *) regs.regs[29]; 483 frame = (struct sigframe __user *) regs.regs[29];
483 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 484 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
484 goto badframe; 485 goto badframe;
485 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 486 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
@@ -512,13 +513,13 @@ save_static_function(sys32_rt_sigreturn);
512__attribute_used__ noinline static void 513__attribute_used__ noinline static void
513_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 514_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
514{ 515{
515 struct rt_sigframe32 *frame; 516 struct rt_sigframe32 __user *frame;
516 mm_segment_t old_fs; 517 mm_segment_t old_fs;
517 sigset_t set; 518 sigset_t set;
518 stack_t st; 519 stack_t st;
519 s32 sp; 520 s32 sp;
520 521
521 frame = (struct rt_sigframe32 *) regs.regs[29]; 522 frame = (struct rt_sigframe32 __user *) regs.regs[29];
522 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 523 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
523 goto badframe; 524 goto badframe;
524 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 525 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -546,7 +547,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
546 call it and ignore errors. */ 547 call it and ignore errors. */
547 old_fs = get_fs(); 548 old_fs = get_fs();
548 set_fs (KERNEL_DS); 549 set_fs (KERNEL_DS);
549 do_sigaltstack(&st, NULL, regs.regs[29]); 550 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
550 set_fs (old_fs); 551 set_fs (old_fs);
551 552
552 /* 553 /*
@@ -564,7 +565,7 @@ badframe:
564} 565}
565 566
566static inline int setup_sigcontext32(struct pt_regs *regs, 567static inline int setup_sigcontext32(struct pt_regs *regs,
567 struct sigcontext32 *sc) 568 struct sigcontext32 __user *sc)
568{ 569{
569 int err = 0; 570 int err = 0;
570 571
@@ -623,8 +624,9 @@ out:
623/* 624/*
624 * Determine which stack to use.. 625 * Determine which stack to use..
625 */ 626 */
626static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 627static inline void __user *get_sigframe(struct k_sigaction *ka,
627 size_t frame_size) 628 struct pt_regs *regs,
629 size_t frame_size)
628{ 630{
629 unsigned long sp; 631 unsigned long sp;
630 632
@@ -642,13 +644,13 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
642 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 644 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
643 sp = current->sas_ss_sp + current->sas_ss_size; 645 sp = current->sas_ss_sp + current->sas_ss_size;
644 646
645 return (void *)((sp - frame_size) & ALMASK); 647 return (void __user *)((sp - frame_size) & ALMASK);
646} 648}
647 649
648int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 650int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
649 int signr, sigset_t *set) 651 int signr, sigset_t *set)
650{ 652{
651 struct sigframe *frame; 653 struct sigframe __user *frame;
652 int err = 0; 654 int err = 0;
653 655
654 frame = get_sigframe(ka, regs, sizeof(*frame)); 656 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -692,17 +694,17 @@ int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
692 current->comm, current->pid, 694 current->comm, current->pid,
693 frame, regs->cp0_epc, frame->sf_code); 695 frame, regs->cp0_epc, frame->sf_code);
694#endif 696#endif
695 return 1; 697 return 0;
696 698
697give_sigsegv: 699give_sigsegv:
698 force_sigsegv(signr, current); 700 force_sigsegv(signr, current);
699 return 0; 701 return -EFAULT;
700} 702}
701 703
702int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 704int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
703 int signr, sigset_t *set, siginfo_t *info) 705 int signr, sigset_t *set, siginfo_t *info)
704{ 706{
705 struct rt_sigframe32 *frame; 707 struct rt_sigframe32 __user *frame;
706 int err = 0; 708 int err = 0;
707 s32 sp; 709 s32 sp;
708 710
@@ -763,11 +765,11 @@ int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
763 current->comm, current->pid, 765 current->comm, current->pid,
764 frame, regs->cp0_epc, frame->rs_code); 766 frame, regs->cp0_epc, frame->rs_code);
765#endif 767#endif
766 return 1; 768 return 0;
767 769
768give_sigsegv: 770give_sigsegv:
769 force_sigsegv(signr, current); 771 force_sigsegv(signr, current);
770 return 0; 772 return -EFAULT;
771} 773}
772 774
773static inline int handle_signal(unsigned long sig, siginfo_t *info, 775static inline int handle_signal(unsigned long sig, siginfo_t *info,
@@ -855,7 +857,7 @@ no_signal:
855} 857}
856 858
857asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, 859asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
858 struct sigaction32 *oact, 860 struct sigaction32 __user *oact,
859 unsigned int sigsetsize) 861 unsigned int sigsetsize)
860{ 862{
861 struct k_sigaction new_sa, old_sa; 863 struct k_sigaction new_sa, old_sa;
@@ -872,7 +874,7 @@ asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
872 if (!access_ok(VERIFY_READ, act, sizeof(*act))) 874 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
873 return -EFAULT; 875 return -EFAULT;
874 err |= __get_user(handler, &act->sa_handler); 876 err |= __get_user(handler, &act->sa_handler);
875 new_sa.sa.sa_handler = (void*)(s64)handler; 877 new_sa.sa.sa_handler = (void __user *)(s64)handler;
876 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); 878 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags);
877 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); 879 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask);
878 if (err) 880 if (err)
@@ -899,7 +901,7 @@ out:
899} 901}
900 902
901asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, 903asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
902 compat_sigset_t *oset, unsigned int sigsetsize) 904 compat_sigset_t __user *oset, unsigned int sigsetsize)
903{ 905{
904 sigset_t old_set, new_set; 906 sigset_t old_set, new_set;
905 int ret; 907 int ret;
@@ -909,8 +911,9 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
909 return -EFAULT; 911 return -EFAULT;
910 912
911 set_fs (KERNEL_DS); 913 set_fs (KERNEL_DS);
912 ret = sys_rt_sigprocmask(how, set ? &new_set : NULL, 914 ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL,
913 oset ? &old_set : NULL, sigsetsize); 915 oset ? (sigset_t __user *)&old_set : NULL,
916 sigsetsize);
914 set_fs (old_fs); 917 set_fs (old_fs);
915 918
916 if (!ret && oset && put_sigset(&old_set, oset)) 919 if (!ret && oset && put_sigset(&old_set, oset))
@@ -919,7 +922,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
919 return ret; 922 return ret;
920} 923}
921 924
922asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, 925asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
923 unsigned int sigsetsize) 926 unsigned int sigsetsize)
924{ 927{
925 int ret; 928 int ret;
@@ -927,7 +930,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
927 mm_segment_t old_fs = get_fs(); 930 mm_segment_t old_fs = get_fs();
928 931
929 set_fs (KERNEL_DS); 932 set_fs (KERNEL_DS);
930 ret = sys_rt_sigpending(&set, sigsetsize); 933 ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize);
931 set_fs (old_fs); 934 set_fs (old_fs);
932 935
933 if (!ret && put_sigset(&set, uset)) 936 if (!ret && put_sigset(&set, uset))
@@ -936,7 +939,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
936 return ret; 939 return ret;
937} 940}
938 941
939asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) 942asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
940{ 943{
941 siginfo_t info; 944 siginfo_t info;
942 int ret; 945 int ret;
@@ -946,7 +949,7 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo)
946 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) 949 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
947 return -EFAULT; 950 return -EFAULT;
948 set_fs (KERNEL_DS); 951 set_fs (KERNEL_DS);
949 ret = sys_rt_sigqueueinfo(pid, sig, &info); 952 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
950 set_fs (old_fs); 953 set_fs (old_fs);
951 return ret; 954 return ret;
952} 955}
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ec61b2670ba6..384fc4a639a4 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -48,6 +48,8 @@
48#define __NR_N32_rt_sigreturn 6211 48#define __NR_N32_rt_sigreturn 6211
49#define __NR_N32_restart_syscall 6214 49#define __NR_N32_restart_syscall 6214
50 50
51#define DEBUG_SIG 0
52
51#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 53#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
52 54
53/* IRIX compatible stack_t */ 55/* IRIX compatible stack_t */
@@ -83,12 +85,12 @@ save_static_function(sysn32_rt_sigreturn);
83__attribute_used__ noinline static void 85__attribute_used__ noinline static void
84_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 86_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
85{ 87{
86 struct rt_sigframe_n32 *frame; 88 struct rt_sigframe_n32 __user *frame;
87 sigset_t set; 89 sigset_t set;
88 stack_t st; 90 stack_t st;
89 s32 sp; 91 s32 sp;
90 92
91 frame = (struct rt_sigframe_n32 *) regs.regs[29]; 93 frame = (struct rt_sigframe_n32 __user *) regs.regs[29];
92 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 94 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
93 goto badframe; 95 goto badframe;
94 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 96 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -114,7 +116,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
114 116
115 /* It is more difficult to avoid calling this function than to 117 /* It is more difficult to avoid calling this function than to
116 call it and ignore errors. */ 118 call it and ignore errors. */
117 do_sigaltstack(&st, NULL, regs.regs[29]); 119 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
118 120
119 /* 121 /*
120 * Don't let your children do this ... 122 * Don't let your children do this ...
@@ -133,7 +135,7 @@ badframe:
133int setup_rt_frame_n32(struct k_sigaction * ka, 135int setup_rt_frame_n32(struct k_sigaction * ka,
134 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) 136 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info)
135{ 137{
136 struct rt_sigframe_n32 *frame; 138 struct rt_sigframe_n32 __user *frame;
137 int err = 0; 139 int err = 0;
138 s32 sp; 140 s32 sp;
139 141
@@ -184,9 +186,9 @@ int setup_rt_frame_n32(struct k_sigaction * ka,
184 current->comm, current->pid, 186 current->comm, current->pid,
185 frame, regs->cp0_epc, regs->regs[31]); 187 frame, regs->cp0_epc, regs->regs[31]);
186#endif 188#endif
187 return 1; 189 return 0;
188 190
189give_sigsegv: 191give_sigsegv:
190 force_sigsegv(signr, current); 192 force_sigsegv(signr, current);
191 return 0; 193 return -EFAULT;
192} 194}
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 332358430ff5..1da2eeb3ef9e 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
212 int error; 212 int error;
213 char * filename; 213 char * filename;
214 214
215 filename = getname((char *) (long)regs.regs[4]); 215 filename = getname((char __user *) (long)regs.regs[4]);
216 error = PTR_ERR(filename); 216 error = PTR_ERR(filename);
217 if (IS_ERR(filename)) 217 if (IS_ERR(filename))
218 goto out; 218 goto out;
219 error = do_execve(filename, (char **) (long)regs.regs[5], 219 error = do_execve(filename, (char __user *__user *) (long)regs.regs[5],
220 (char **) (long)regs.regs[6], &regs); 220 (char __user *__user *) (long)regs.regs[6], &regs);
221 putname(filename); 221 putname(filename);
222 222
223out: 223out:
@@ -227,7 +227,7 @@ out:
227/* 227/*
228 * Compacrapability ... 228 * Compacrapability ...
229 */ 229 */
230asmlinkage int sys_uname(struct old_utsname * name) 230asmlinkage int sys_uname(struct old_utsname __user * name)
231{ 231{
232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
233 return 0; 233 return 0;
@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
237/* 237/*
238 * Compacrapability ... 238 * Compacrapability ...
239 */ 239 */
240asmlinkage int sys_olduname(struct oldold_utsname * name) 240asmlinkage int sys_olduname(struct oldold_utsname __user * name)
241{ 241{
242 int error; 242 int error;
243 243
@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long addr)
274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
275{ 275{
276 int tmp, len; 276 int tmp, len;
277 char *name; 277 char __user *name;
278 278
279 switch(cmd) { 279 switch(cmd) {
280 case SETNAME: { 280 case SETNAME: {
@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
283 if (!capable(CAP_SYS_ADMIN)) 283 if (!capable(CAP_SYS_ADMIN))
284 return -EPERM; 284 return -EPERM;
285 285
286 name = (char *) arg1; 286 name = (char __user *) arg1;
287 287
288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); 288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
289 if (len < 0) 289 if (len < 0)
@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
324 * This is really horribly ugly. 324 * This is really horribly ugly.
325 */ 325 */
326asmlinkage int sys_ipc (uint call, int first, int second, 326asmlinkage int sys_ipc (uint call, int first, int second,
327 unsigned long third, void *ptr, long fifth) 327 unsigned long third, void __user *ptr, long fifth)
328{ 328{
329 int version, ret; 329 int version, ret;
330 330
@@ -333,24 +333,25 @@ asmlinkage int sys_ipc (uint call, int first, int second,
333 333
334 switch (call) { 334 switch (call) {
335 case SEMOP: 335 case SEMOP:
336 return sys_semtimedop (first, (struct sembuf *)ptr, second, 336 return sys_semtimedop (first, (struct sembuf __user *)ptr,
337 NULL); 337 second, NULL);
338 case SEMTIMEDOP: 338 case SEMTIMEDOP:
339 return sys_semtimedop (first, (struct sembuf *)ptr, second, 339 return sys_semtimedop (first, (struct sembuf __user *)ptr,
340 (const struct timespec __user *)fifth); 340 second,
341 (const struct timespec __user *)fifth);
341 case SEMGET: 342 case SEMGET:
342 return sys_semget (first, second, third); 343 return sys_semget (first, second, third);
343 case SEMCTL: { 344 case SEMCTL: {
344 union semun fourth; 345 union semun fourth;
345 if (!ptr) 346 if (!ptr)
346 return -EINVAL; 347 return -EINVAL;
347 if (get_user(fourth.__pad, (void **) ptr)) 348 if (get_user(fourth.__pad, (void *__user *) ptr))
348 return -EFAULT; 349 return -EFAULT;
349 return sys_semctl (first, second, third, fourth); 350 return sys_semctl (first, second, third, fourth);
350 } 351 }
351 352
352 case MSGSND: 353 case MSGSND:
353 return sys_msgsnd (first, (struct msgbuf *) ptr, 354 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
354 second, third); 355 second, third);
355 case MSGRCV: 356 case MSGRCV:
356 switch (version) { 357 switch (version) {
@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
360 return -EINVAL; 361 return -EINVAL;
361 362
362 if (copy_from_user(&tmp, 363 if (copy_from_user(&tmp,
363 (struct ipc_kludge *) ptr, 364 (struct ipc_kludge __user *) ptr,
364 sizeof (tmp))) 365 sizeof (tmp)))
365 return -EFAULT; 366 return -EFAULT;
366 return sys_msgrcv (first, tmp.msgp, second, 367 return sys_msgrcv (first, tmp.msgp, second,
@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int first, int second,
368 } 369 }
369 default: 370 default:
370 return sys_msgrcv (first, 371 return sys_msgrcv (first,
371 (struct msgbuf *) ptr, 372 (struct msgbuf __user *) ptr,
372 second, fifth, third); 373 second, fifth, third);
373 } 374 }
374 case MSGGET: 375 case MSGGET:
375 return sys_msgget ((key_t) first, second); 376 return sys_msgget ((key_t) first, second);
376 case MSGCTL: 377 case MSGCTL:
377 return sys_msgctl (first, second, (struct msqid_ds *) ptr); 378 return sys_msgctl (first, second,
379 (struct msqid_ds __user *) ptr);
378 380
379 case SHMAT: 381 case SHMAT:
380 switch (version) { 382 switch (version) {
381 default: { 383 default: {
382 ulong raddr; 384 ulong raddr;
383 ret = do_shmat (first, (char *) ptr, second, &raddr); 385 ret = do_shmat (first, (char __user *) ptr, second,
386 &raddr);
384 if (ret) 387 if (ret)
385 return ret; 388 return ret;
386 return put_user (raddr, (ulong *) third); 389 return put_user (raddr, (ulong __user *) third);
387 } 390 }
388 case 1: /* iBCS2 emulator entry point */ 391 case 1: /* iBCS2 emulator entry point */
389 if (!segment_eq(get_fs(), get_ds())) 392 if (!segment_eq(get_fs(), get_ds()))
390 return -EINVAL; 393 return -EINVAL;
391 return do_shmat (first, (char *) ptr, second, (ulong *) third); 394 return do_shmat (first, (char __user *) ptr, second,
395 (ulong *) third);
392 } 396 }
393 case SHMDT: 397 case SHMDT:
394 return sys_shmdt ((char *)ptr); 398 return sys_shmdt ((char __user *)ptr);
395 case SHMGET: 399 case SHMGET:
396 return sys_shmget (first, second, third); 400 return sys_shmget (first, second, third);
397 case SHMCTL: 401 case SHMCTL:
398 return sys_shmctl (first, second, 402 return sys_shmctl (first, second,
399 (struct shmid_ds *) ptr); 403 (struct shmid_ds __user *) ptr);
400 default: 404 default:
401 return -ENOSYS; 405 return -ENOSYS;
402 } 406 }
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 59a187956de0..c9d2b5147ca3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1168,7 +1168,7 @@ void __init per_cpu_trap_init(void)
1168#endif 1168#endif
1169 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) 1169 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV)
1170 status_set |= ST0_XX; 1170 status_set |= ST0_XX;
1171 change_c0_status(ST0_CU|ST0_MX|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, 1171 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
1172 status_set); 1172 status_set);
1173 1173
1174 if (cpu_has_dsp) 1174 if (cpu_has_dsp)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 25cc856d8e7e..ff699dbb99f7 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -1,4 +1,5 @@
1#include <linux/config.h> 1#include <linux/config.h>
2#include <asm/asm-offsets.h>
2#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
3 4
4#undef mips /* CPP really sucks for this job */ 5#undef mips /* CPP really sucks for this job */
@@ -64,10 +65,10 @@ SECTIONS
64 we can shorten the on-disk segment size. */ 65 we can shorten the on-disk segment size. */
65 .sdata : { *(.sdata) } 66 .sdata : { *(.sdata) }
66 67
67 . = ALIGN(4096); 68 . = ALIGN(_PAGE_SIZE);
68 __nosave_begin = .; 69 __nosave_begin = .;
69 .data_nosave : { *(.data.nosave) } 70 .data_nosave : { *(.data.nosave) }
70 . = ALIGN(4096); 71 . = ALIGN(_PAGE_SIZE);
71 __nosave_end = .; 72 __nosave_end = .;
72 73
73 . = ALIGN(32); 74 . = ALIGN(32);
@@ -76,7 +77,7 @@ SECTIONS
76 _edata = .; /* End of data section */ 77 _edata = .; /* End of data section */
77 78
78 /* will be freed after init */ 79 /* will be freed after init */
79 . = ALIGN(4096); /* Init code and data */ 80 . = ALIGN(_PAGE_SIZE); /* Init code and data */
80 __init_begin = .; 81 __init_begin = .;
81 .init.text : { 82 .init.text : {
82 _sinittext = .; 83 _sinittext = .;
@@ -105,7 +106,7 @@ SECTIONS
105 .con_initcall.init : { *(.con_initcall.init) } 106 .con_initcall.init : { *(.con_initcall.init) }
106 __con_initcall_end = .; 107 __con_initcall_end = .;
107 SECURITY_INIT 108 SECURITY_INIT
108 . = ALIGN(4096); 109 . = ALIGN(_PAGE_SIZE);
109 __initramfs_start = .; 110 __initramfs_start = .;
110 .init.ramfs : { *(.init.ramfs) } 111 .init.ramfs : { *(.init.ramfs) }
111 __initramfs_end = .; 112 __initramfs_end = .;
@@ -113,7 +114,7 @@ SECTIONS
113 __per_cpu_start = .; 114 __per_cpu_start = .;
114 .data.percpu : { *(.data.percpu) } 115 .data.percpu : { *(.data.percpu) }
115 __per_cpu_end = .; 116 __per_cpu_end = .;
116 . = ALIGN(4096); 117 . = ALIGN(_PAGE_SIZE);
117 __init_end = .; 118 __init_end = .;
118 /* freed after init ends here */ 119 /* freed after init ends here */
119 120
diff --git a/arch/mips/lasat/reset.c b/arch/mips/lasat/reset.c
index 8d7d7a454f9a..181bf68175fc 100644
--- a/arch/mips/lasat/reset.c
+++ b/arch/mips/lasat/reset.c
@@ -19,9 +19,12 @@
19 */ 19 */
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/pm.h>
23
22#include <asm/reboot.h> 24#include <asm/reboot.h>
23#include <asm/system.h> 25#include <asm/system.h>
24#include <asm/lasat/lasat.h> 26#include <asm/lasat/lasat.h>
27
25#include "picvue.h" 28#include "picvue.h"
26#include "prom.h" 29#include "prom.h"
27 30
@@ -63,5 +66,5 @@ void lasat_reboot_setup(void)
63{ 66{
64 _machine_restart = lasat_machine_restart; 67 _machine_restart = lasat_machine_restart;
65 _machine_halt = lasat_machine_halt; 68 _machine_halt = lasat_machine_halt;
66 _machine_power_off = lasat_machine_halt; 69 pm_power_off = lasat_machine_halt;
67} 70}
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index dcd819d57dae..83eb08b7a072 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -134,8 +134,8 @@ void __init serial_init(void)
134 134
135 memset(&s, 0, sizeof(s)); 135 memset(&s, 0, sizeof(s));
136 136
137 s.flags = STD_COM_FLAGS; 137 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
138 s.iotype = SERIAL_IO_MEM; 138 s.iotype = UPIO_MEM;
139 139
140 if (mips_machtype == MACH_LASAT_100) { 140 if (mips_machtype == MACH_LASAT_100) {
141 s.uartclk = LASAT_BASE_BAUD_100 * 16; 141 s.uartclk = LASAT_BASE_BAUD_100 * 16;
diff --git a/arch/mips/lib-32/dump_tlb.c b/arch/mips/lib-32/dump_tlb.c
index 46519f4331eb..c49a925d0169 100644
--- a/arch/mips/lib-32/dump_tlb.c
+++ b/arch/mips/lib-32/dump_tlb.c
@@ -158,29 +158,26 @@ void dump_list_process(struct task_struct *t, void *address)
158 printk("task->mm == %8p\n", t->mm); 158 printk("task->mm == %8p\n", t->mm);
159 //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd); 159 //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd);
160 160
161 if (addr > KSEG0) 161 if (addr > KSEG0) {
162 page_dir = pgd_offset_k(0); 162 page_dir = pgd_offset_k(0);
163 else if (t->mm) {
164 page_dir = pgd_offset(t->mm, 0);
165 printk("page_dir == %08x\n", (unsigned int) page_dir);
166 } else
167 printk("Current thread has no mm\n");
168
169 if (addr > KSEG0)
170 pgd = pgd_offset_k(addr); 163 pgd = pgd_offset_k(addr);
171 else if (t->mm) { 164 } else if (t->mm) {
165 page_dir = pgd_offset(t->mm, 0);
172 pgd = pgd_offset(t->mm, addr); 166 pgd = pgd_offset(t->mm, addr);
173 printk("pgd == %08x, ", (unsigned int) pgd); 167 } else {
174 pud = pud_offset(pgd, addr); 168 printk("Current thread has no mm\n");
175 printk("pud == %08x, ", (unsigned int) pud); 169 return;
170 }
171 printk("page_dir == %08x\n", (unsigned int) page_dir);
172 printk("pgd == %08x, ", (unsigned int) pgd);
173 pud = pud_offset(pgd, addr);
174 printk("pud == %08x, ", (unsigned int) pud);
176 175
177 pmd = pmd_offset(pud, addr); 176 pmd = pmd_offset(pud, addr);
178 printk("pmd == %08x, ", (unsigned int) pmd); 177 printk("pmd == %08x, ", (unsigned int) pmd);
179 178
180 pte = pte_offset(pmd, addr); 179 pte = pte_offset(pmd, addr);
181 printk("pte == %08x, ", (unsigned int) pte); 180 printk("pte == %08x, ", (unsigned int) pte);
182 } else
183 printk("Current thread has no mm\n");
184 181
185 page = *pte; 182 page = *pte;
186#ifdef CONFIG_64BIT_PHYS_ADDR 183#ifdef CONFIG_64BIT_PHYS_ADDR
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
index 495c1ac94298..1c555e6c6a9f 100644
--- a/arch/mips/math-emu/dp_simple.c
+++ b/arch/mips/math-emu/dp_simple.c
@@ -48,16 +48,22 @@ ieee754dp ieee754dp_neg(ieee754dp x)
48 CLEARCX; 48 CLEARCX;
49 FLUSHXDP; 49 FLUSHXDP;
50 50
51 /*
52 * Invert the sign ALWAYS to prevent an endless recursion on
53 * pow() in libc.
54 */
55 /* quick fix up */
56 DPSIGN(x) ^= 1;
57
51 if (xc == IEEE754_CLASS_SNAN) { 58 if (xc == IEEE754_CLASS_SNAN) {
59 ieee754dp y = ieee754dp_indef();
52 SETCX(IEEE754_INVALID_OPERATION); 60 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754dp_nanxcpt(ieee754dp_indef(), "neg"); 61 DPSIGN(y) = DPSIGN(x);
62 return ieee754dp_nanxcpt(y, "neg");
54 } 63 }
55 64
56 if (ieee754dp_isnan(x)) /* but not infinity */ 65 if (ieee754dp_isnan(x)) /* but not infinity */
57 return ieee754dp_nanxcpt(x, "neg", x); 66 return ieee754dp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 DPSIGN(x) ^= 1;
61 return x; 67 return x;
62} 68}
63 69
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index c809830dffb4..770f0f4677cd 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -48,16 +48,22 @@ ieee754sp ieee754sp_neg(ieee754sp x)
48 CLEARCX; 48 CLEARCX;
49 FLUSHXSP; 49 FLUSHXSP;
50 50
51 /*
52 * Invert the sign ALWAYS to prevent an endless recursion on
53 * pow() in libc.
54 */
55 /* quick fix up */
56 SPSIGN(x) ^= 1;
57
51 if (xc == IEEE754_CLASS_SNAN) { 58 if (xc == IEEE754_CLASS_SNAN) {
59 ieee754sp y = ieee754sp_indef();
52 SETCX(IEEE754_INVALID_OPERATION); 60 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754sp_nanxcpt(ieee754sp_indef(), "neg"); 61 SPSIGN(y) = SPSIGN(x);
62 return ieee754sp_nanxcpt(y, "neg");
54 } 63 }
55 64
56 if (ieee754sp_isnan(x)) /* but not infinity */ 65 if (ieee754sp_isnan(x)) /* but not infinity */
57 return ieee754sp_nanxcpt(x, "neg", x); 66 return ieee754sp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 SPSIGN(x) ^= 1;
61 return x; 67 return x;
62} 68}
63 69
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 625843b30bed..873cf3141a31 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -82,8 +82,8 @@ static void __init serial_init(void)
82#endif 82#endif
83 s.irq = ATLASINT_UART; 83 s.irq = ATLASINT_UART;
84 s.uartclk = ATLAS_BASE_BAUD * 16; 84 s.uartclk = ATLAS_BASE_BAUD * 16;
85 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 85 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
86 s.iotype = SERIAL_IO_PORT; 86 s.iotype = UPIO_PORT;
87 s.regshift = 3; 87 s.regshift = 3;
88 88
89 if (early_serial_setup(&s) != 0) { 89 if (early_serial_setup(&s) != 0) {
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c
index 9fdec743bd95..7213c395fb6b 100644
--- a/arch/mips/mips-boards/generic/reset.c
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -23,6 +23,7 @@
23 * 23 *
24 */ 24 */
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/pm.h>
26 27
27#include <asm/io.h> 28#include <asm/io.h>
28#include <asm/reboot.h> 29#include <asm/reboot.h>
@@ -65,9 +66,9 @@ void mips_reboot_setup(void)
65 _machine_restart = mips_machine_restart; 66 _machine_restart = mips_machine_restart;
66 _machine_halt = mips_machine_halt; 67 _machine_halt = mips_machine_halt;
67#if defined(CONFIG_MIPS_ATLAS) 68#if defined(CONFIG_MIPS_ATLAS)
68 _machine_power_off = atlas_machine_power_off; 69 pm_power_off = atlas_machine_power_off;
69#endif 70#endif
70#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD) 71#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD)
71 _machine_power_off = mips_machine_halt; 72 pm_power_off = mips_machine_halt;
72#endif 73#endif
73} 74}
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index f966bc161dfa..4266ce445174 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -71,8 +71,8 @@ static void __init serial_init(void)
71#endif 71#endif
72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0; 72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0;
73 s.uartclk = SEAD_BASE_BAUD * 16; 73 s.uartclk = SEAD_BASE_BAUD * 16;
74 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 74 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
75 s.iotype = 0; 75 s.iotype = UPIO_PORT;
76 s.regshift = 3; 76 s.regshift = 3;
77 77
78 if (early_serial_setup(&s) != 0) { 78 if (early_serial_setup(&s) != 0) {
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index 485d5a58d9cf..a2fd62997ca3 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -88,8 +88,8 @@ static void __init serial_init(void)
88 but poll for now */ 88 but poll for now */
89 s.irq = 0; 89 s.irq = 0;
90 s.uartclk = BASE_BAUD * 16; 90 s.uartclk = BASE_BAUD * 16;
91 s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST; 91 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
92 s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST; 92 s.iotype = UPIO_PORT;
93 s.regshift = 0; 93 s.regshift = 0;
94 s.timeout = 4; 94 s.timeout = 4;
95 95
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 422b55fab07a..e51c38cef88e 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -464,8 +464,8 @@ static void r4k_flush_data_cache_page(unsigned long addr)
464} 464}
465 465
466struct flush_icache_range_args { 466struct flush_icache_range_args {
467 unsigned long __user start; 467 unsigned long start;
468 unsigned long __user end; 468 unsigned long end;
469}; 469};
470 470
471static inline void local_r4k_flush_icache_range(void *args) 471static inline void local_r4k_flush_icache_range(void *args)
@@ -528,8 +528,7 @@ static inline void local_r4k_flush_icache_range(void *args)
528 } 528 }
529} 529}
530 530
531static void r4k_flush_icache_range(unsigned long __user start, 531static void r4k_flush_icache_range(unsigned long start, unsigned long end)
532 unsigned long __user end)
533{ 532{
534 struct flush_icache_range_args args; 533 struct flush_icache_range_args args;
535 534
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 314701a66b13..591c22b080e4 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -25,8 +25,7 @@ void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
25 unsigned long end); 25 unsigned long end);
26void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, 26void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page,
27 unsigned long pfn); 27 unsigned long pfn);
28void (*flush_icache_range)(unsigned long __user start, 28void (*flush_icache_range)(unsigned long start, unsigned long end);
29 unsigned long __user end);
30void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page); 29void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page);
31 30
32/* MIPS specific cache operations */ 31/* MIPS specific cache operations */
@@ -53,7 +52,7 @@ EXPORT_SYMBOL(_dma_cache_inv);
53 * We could optimize the case where the cache argument is not BCACHE but 52 * We could optimize the case where the cache argument is not BCACHE but
54 * that seems very atypical use ... 53 * that seems very atypical use ...
55 */ 54 */
56asmlinkage int sys_cacheflush(unsigned long __user addr, 55asmlinkage int sys_cacheflush(unsigned long addr,
57 unsigned long bytes, unsigned int cache) 56 unsigned long bytes, unsigned int cache)
58{ 57{
59 if (bytes == 0) 58 if (bytes == 0)
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 4ee91c9a556f..0ff9a348b843 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -24,6 +24,7 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/highmem.h> 25#include <linux/highmem.h>
26#include <linux/swap.h> 26#include <linux/swap.h>
27#include <linux/proc_fs.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
29#include <asm/cachectl.h> 30#include <asm/cachectl.h>
@@ -200,6 +201,11 @@ static inline int page_is_ram(unsigned long pagenr)
200 return 0; 201 return 0;
201} 202}
202 203
204static struct kcore_list kcore_mem, kcore_vmalloc;
205#ifdef CONFIG_64BIT
206static struct kcore_list kcore_kseg0;
207#endif
208
203void __init mem_init(void) 209void __init mem_init(void)
204{ 210{
205 unsigned long codesize, reservedpages, datasize, initsize; 211 unsigned long codesize, reservedpages, datasize, initsize;
@@ -249,6 +255,16 @@ void __init mem_init(void)
249 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 255 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
250 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 256 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
251 257
258#ifdef CONFIG_64BIT
259 if ((unsigned long) &_text > (unsigned long) CKSEG0)
260 /* The -4 is a hack so that user tools don't have to handle
261 the overflow. */
262 kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4);
263#endif
264 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
265 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
266 VMALLOC_END-VMALLOC_START);
267
252 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 268 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
253 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", 269 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
254 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 270 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
index da6e1ed34db1..2292d0ec47fc 100644
--- a/arch/mips/momentum/jaguar_atx/ja-console.c
+++ b/arch/mips/momentum/jaguar_atx/ja-console.c
@@ -93,7 +93,7 @@ static void inline ja_console_probe(void)
93 up.uartclk = JAGUAR_ATX_UART_CLK; 93 up.uartclk = JAGUAR_ATX_UART_CLK;
94 up.regshift = 2; 94 up.regshift = 2;
95 up.iotype = UPIO_MEM; 95 up.iotype = UPIO_MEM;
96 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 96 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
97 up.line = 0; 97 up.line = 0;
98 98
99 if (early_serial_setup(&up)) 99 if (early_serial_setup(&up))
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
index bab192ddc185..301d67226d72 100644
--- a/arch/mips/momentum/jaguar_atx/setup.c
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -50,6 +50,7 @@
50#include <linux/pci.h> 50#include <linux/pci.h>
51#include <linux/swap.h> 51#include <linux/swap.h>
52#include <linux/ioport.h> 52#include <linux/ioport.h>
53#include <linux/pm.h>
53#include <linux/sched.h> 54#include <linux/sched.h>
54#include <linux/interrupt.h> 55#include <linux/interrupt.h>
55#include <linux/timex.h> 56#include <linux/timex.h>
@@ -365,7 +366,7 @@ void __init plat_setup(void)
365 366
366 _machine_restart = momenco_jaguar_restart; 367 _machine_restart = momenco_jaguar_restart;
367 _machine_halt = momenco_jaguar_halt; 368 _machine_halt = momenco_jaguar_halt;
368 _machine_power_off = momenco_jaguar_power_off; 369 pm_power_off = momenco_jaguar_power_off;
369 370
370 /* 371 /*
371 * initrd_start = (ulong)jaguar_initrd_start; 372 * initrd_start = (ulong)jaguar_initrd_start;
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index c9b7ff8148ec..f95677f4f06f 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -57,6 +57,8 @@
57#include <linux/timex.h> 57#include <linux/timex.h>
58#include <linux/bootmem.h> 58#include <linux/bootmem.h>
59#include <linux/mv643xx.h> 59#include <linux/mv643xx.h>
60#include <linux/pm.h>
61
60#include <asm/time.h> 62#include <asm/time.h>
61#include <asm/page.h> 63#include <asm/page.h>
62#include <asm/bootinfo.h> 64#include <asm/bootinfo.h>
@@ -321,7 +323,7 @@ void __init plat_setup(void)
321 323
322 _machine_restart = momenco_ocelot_restart; 324 _machine_restart = momenco_ocelot_restart;
323 _machine_halt = momenco_ocelot_halt; 325 _machine_halt = momenco_ocelot_halt;
324 _machine_power_off = momenco_ocelot_power_off; 326 pm_power_off = momenco_ocelot_power_off;
325 327
326 /* Wired TLB entries */ 328 /* Wired TLB entries */
327 setup_wired_tlb_entries(); 329 setup_wired_tlb_entries();
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
index 2755c1547473..15998d8a9341 100644
--- a/arch/mips/momentum/ocelot_c/setup.c
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -51,8 +51,10 @@
51#include <linux/sched.h> 51#include <linux/sched.h>
52#include <linux/interrupt.h> 52#include <linux/interrupt.h>
53#include <linux/pci.h> 53#include <linux/pci.h>
54#include <linux/pm.h>
54#include <linux/timex.h> 55#include <linux/timex.h>
55#include <linux/vmalloc.h> 56#include <linux/vmalloc.h>
57
56#include <asm/time.h> 58#include <asm/time.h>
57#include <asm/bootinfo.h> 59#include <asm/bootinfo.h>
58#include <asm/page.h> 60#include <asm/page.h>
@@ -236,7 +238,7 @@ void __init plat_setup(void)
236 238
237 _machine_restart = momenco_ocelot_restart; 239 _machine_restart = momenco_ocelot_restart;
238 _machine_halt = momenco_ocelot_halt; 240 _machine_halt = momenco_ocelot_halt;
239 _machine_power_off = momenco_ocelot_power_off; 241 pm_power_off = momenco_ocelot_power_off;
240 242
241 /* 243 /*
242 * initrd_start = (ulong)ocelot_initrd_start; 244 * initrd_start = (ulong)ocelot_initrd_start;
diff --git a/arch/mips/momentum/ocelot_g/setup.c b/arch/mips/momentum/ocelot_g/setup.c
index 6336751391c3..fed4e8eee116 100644
--- a/arch/mips/momentum/ocelot_g/setup.c
+++ b/arch/mips/momentum/ocelot_g/setup.c
@@ -47,8 +47,10 @@
47#include <linux/sched.h> 47#include <linux/sched.h>
48#include <linux/interrupt.h> 48#include <linux/interrupt.h>
49#include <linux/pci.h> 49#include <linux/pci.h>
50#include <linux/pm.h>
50#include <linux/timex.h> 51#include <linux/timex.h>
51#include <linux/vmalloc.h> 52#include <linux/vmalloc.h>
53
52#include <asm/time.h> 54#include <asm/time.h>
53#include <asm/bootinfo.h> 55#include <asm/bootinfo.h>
54#include <asm/page.h> 56#include <asm/page.h>
@@ -169,7 +171,7 @@ void __init plat_setup(void)
169 171
170 _machine_restart = momenco_ocelot_restart; 172 _machine_restart = momenco_ocelot_restart;
171 _machine_halt = momenco_ocelot_halt; 173 _machine_halt = momenco_ocelot_halt;
172 _machine_power_off = momenco_ocelot_power_off; 174 pm_power_off = momenco_ocelot_power_off;
173 175
174 /* 176 /*
175 * initrd_start = (ulong)ocelot_initrd_start; 177 * initrd_start = (ulong)ocelot_initrd_start;
diff --git a/arch/mips/oprofile/Makefile b/arch/mips/oprofile/Makefile
index 354261d37d62..0a50aad5bbe4 100644
--- a/arch/mips/oprofile/Makefile
+++ b/arch/mips/oprofile/Makefile
@@ -12,4 +12,5 @@ oprofile-y := $(DRIVER_OBJS) common.o
12 12
13oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o 13oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o
14oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o 14oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o
15oprofile-$(CONFIG_CPU_SB1) += op_model_mipsxx.o
15oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o 16oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 53f9889b30ed..935dd851f480 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -79,6 +79,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
79 case CPU_20KC: 79 case CPU_20KC:
80 case CPU_24K: 80 case CPU_24K:
81 case CPU_25KF: 81 case CPU_25KF:
82 case CPU_34K:
83 case CPU_SB1:
84 case CPU_SB1A:
82 lmodel = &op_model_mipsxx; 85 lmodel = &op_model_mipsxx;
83 break; 86 break;
84 87
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 1d1eee407faf..95d488ca0754 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -201,10 +201,21 @@ static int __init mipsxx_init(void)
201 op_model_mipsxx.cpu_type = "mips/25K"; 201 op_model_mipsxx.cpu_type = "mips/25K";
202 break; 202 break;
203 203
204#ifndef CONFIG_SMP
205 case CPU_34K:
206 op_model_mipsxx.cpu_type = "mips/34K";
207 break;
208#endif
209
204 case CPU_5KC: 210 case CPU_5KC:
205 op_model_mipsxx.cpu_type = "mips/5K"; 211 op_model_mipsxx.cpu_type = "mips/5K";
206 break; 212 break;
207 213
214 case CPU_SB1:
215 case CPU_SB1A:
216 op_model_mipsxx.cpu_type = "mips/sb1";
217 break;
218
208 default: 219 default:
209 printk(KERN_ERR "Profiling unsupported for this CPU\n"); 220 printk(KERN_ERR "Profiling unsupported for this CPU\n");
210 221
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 741e67c9195a..16205b587338 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \
46obj-$(CONFIG_SGI_IP27) += pci-ip27.o 46obj-$(CONFIG_SGI_IP27) += pci-ip27.o
47obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o 47obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o
48obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o 48obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
49obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o
49obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o 50obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o
50obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o 51obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o
51obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o 52obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index 909292f50d06..75a01e764898 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -17,7 +17,7 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/gt64120.h> 18#include <asm/gt64120.h>
19 19
20#include <asm/cobalt/cobalt.h> 20#include <asm/mach-cobalt/cobalt.h>
21 21
22extern int cobalt_board_id; 22extern int cobalt_board_id;
23 23
@@ -52,7 +52,7 @@ static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
52 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lt); 52 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lt);
53 if (lt < 64) 53 if (lt < 64)
54 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); 54 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
55 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7); 55 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8);
56} 56}
57 57
58DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, 58DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
@@ -69,7 +69,7 @@ static void qube_raq_galileo_fixup(struct pci_dev *dev)
69 * host bridge. 69 * host bridge.
70 */ 70 */
71 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); 71 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
72 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7); 72 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8);
73 73
74 /* 74 /*
75 * The code described by the comment below has been removed 75 * The code described by the comment below has been removed
diff --git a/arch/mips/pci/ops-gt64111.c b/arch/mips/pci/ops-gt64111.c
index c1807934768d..13de45940b19 100644
--- a/arch/mips/pci/ops-gt64111.c
+++ b/arch/mips/pci/ops-gt64111.c
@@ -15,7 +15,7 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/gt64120.h> 16#include <asm/gt64120.h>
17 17
18#include <asm/cobalt/cobalt.h> 18#include <asm/mach-cobalt/cobalt.h>
19 19
20/* 20/*
21 * Device 31 on the GT64111 is used to generate PCI special 21 * Device 31 on the GT64111 is used to generate PCI special
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index f194b4e4f86a..ca975e7d32ff 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -234,11 +234,9 @@ static int __init bcm1480_pcibios_init(void)
234 234
235 /* turn on ExpMemEn */ 235 /* turn on ExpMemEn */
236 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); 236 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40));
237 printk("PCIFeatureCtrl = %x\n", cmdreg);
238 WRITECFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40), 237 WRITECFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40),
239 cmdreg | 0x10); 238 cmdreg | 0x10);
240 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); 239 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40));
241 printk("PCIFeatureCtrl = %x\n", cmdreg);
242 240
243 /* 241 /*
244 * Establish mappings in KSEG2 (kernel virtual) to PCI I/O 242 * Establish mappings in KSEG2 (kernel virtual) to PCI I/O
diff --git a/arch/mips/philips/pnx8550/common/platform.c b/arch/mips/philips/pnx8550/common/platform.c
index 8aa9bd65b45e..a592260fd673 100644
--- a/arch/mips/philips/pnx8550/common/platform.c
+++ b/arch/mips/philips/pnx8550/common/platform.c
@@ -66,28 +66,28 @@ struct ip3106_port ip3106_ports[] = {
66 [0] = { 66 [0] = {
67 .port = { 67 .port = {
68 .type = PORT_IP3106, 68 .type = PORT_IP3106,
69 .iotype = SERIAL_IO_MEM, 69 .iotype = UPIO_MEM,
70 .membase = (void __iomem *)PNX8550_UART_PORT0, 70 .membase = (void __iomem *)PNX8550_UART_PORT0,
71 .mapbase = PNX8550_UART_PORT0, 71 .mapbase = PNX8550_UART_PORT0,
72 .irq = PNX8550_UART_INT(0), 72 .irq = PNX8550_UART_INT(0),
73 .uartclk = 3692300, 73 .uartclk = 3692300,
74 .fifosize = 16, 74 .fifosize = 16,
75 .ops = &ip3106_pops, 75 .ops = &ip3106_pops,
76 .flags = ASYNC_BOOT_AUTOCONF, 76 .flags = UPF_BOOT_AUTOCONF,
77 .line = 0, 77 .line = 0,
78 }, 78 },
79 }, 79 },
80 [1] = { 80 [1] = {
81 .port = { 81 .port = {
82 .type = PORT_IP3106, 82 .type = PORT_IP3106,
83 .iotype = SERIAL_IO_MEM, 83 .iotype = UPIO_MEM,
84 .membase = (void __iomem *)PNX8550_UART_PORT1, 84 .membase = (void __iomem *)PNX8550_UART_PORT1,
85 .mapbase = PNX8550_UART_PORT1, 85 .mapbase = PNX8550_UART_PORT1,
86 .irq = PNX8550_UART_INT(1), 86 .irq = PNX8550_UART_INT(1),
87 .uartclk = 3692300, 87 .uartclk = 3692300,
88 .fifosize = 16, 88 .fifosize = 16,
89 .ops = &ip3106_pops, 89 .ops = &ip3106_pops,
90 .flags = ASYNC_BOOT_AUTOCONF, 90 .flags = UPF_BOOT_AUTOCONF,
91 .line = 1, 91 .line = 1,
92 }, 92 },
93 }, 93 },
diff --git a/arch/mips/philips/pnx8550/common/setup.c b/arch/mips/philips/pnx8550/common/setup.c
index ee6bf72094f6..0d8a77619391 100644
--- a/arch/mips/philips/pnx8550/common/setup.c
+++ b/arch/mips/philips/pnx8550/common/setup.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/serial_ip3106.h> 27#include <linux/serial_ip3106.h>
28#include <linux/pm.h>
28 29
29#include <asm/cpu.h> 30#include <asm/cpu.h>
30#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
@@ -90,7 +91,7 @@ void __init plat_setup(void)
90 91
91 _machine_restart = pnx8550_machine_restart; 92 _machine_restart = pnx8550_machine_restart;
92 _machine_halt = pnx8550_machine_halt; 93 _machine_halt = pnx8550_machine_halt;
93 _machine_power_off = pnx8550_machine_power_off; 94 pm_power_off = pnx8550_machine_power_off;
94 95
95 board_time_init = pnx8550_time_init; 96 board_time_init = pnx8550_time_init;
96 board_timer_setup = pnx8550_timer_setup; 97 board_timer_setup = pnx8550_timer_setup;
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
index 555bfacf7647..165275c00cbb 100644
--- a/arch/mips/pmc-sierra/yosemite/prom.c
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/pm.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
17 18
18#include <asm/io.h> 19#include <asm/io.h>
@@ -92,7 +93,7 @@ void __init prom_init(void)
92 /* Callbacks for halt, restart */ 93 /* Callbacks for halt, restart */
93 _machine_restart = (void (*)(char *)) prom_exit; 94 _machine_restart = (void (*)(char *)) prom_exit;
94 _machine_halt = prom_halt; 95 _machine_halt = prom_halt;
95 _machine_power_off = prom_halt; 96 pm_power_off = prom_halt;
96 97
97 debug_vectors = cv; 98 debug_vectors = cv;
98 arcs_cmdline[0] = '\0'; 99 arcs_cmdline[0] = '\0';
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 059755b5ed57..8bce711575de 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -185,7 +185,7 @@ static void __init py_uart_setup(void)
185 up.uartclk = TITAN_UART_CLK; 185 up.uartclk = TITAN_UART_CLK;
186 up.regshift = 0; 186 up.regshift = 0;
187 up.iotype = UPIO_MEM; 187 up.iotype = UPIO_MEM;
188 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 188 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
189 up.line = 0; 189 up.line = 0;
190 190
191 if (early_serial_setup(&up)) 191 if (early_serial_setup(&up))
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 214ffd2e98a3..92a3b3c15ed3 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -3,8 +3,9 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1997, 1998, 2001, 2003 by Ralf Baechle 6 * Copyright (C) 1997, 1998, 2001, 03, 05, 06 by Ralf Baechle
7 */ 7 */
8#include <linux/linkage.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/ds1286.h> 10#include <linux/ds1286.h>
10#include <linux/module.h> 11#include <linux/module.h>
@@ -12,6 +13,7 @@
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/sched.h> 14#include <linux/sched.h>
14#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/pm.h>
15#include <linux/timer.h> 17#include <linux/timer.h>
16 18
17#include <asm/io.h> 19#include <asm/io.h>
@@ -41,28 +43,10 @@ static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer;
41 43
42#define MACHINE_PANICED 1 44#define MACHINE_PANICED 1
43#define MACHINE_SHUTTING_DOWN 2 45#define MACHINE_SHUTTING_DOWN 2
44static int machine_state = 0;
45 46
46static void sgi_machine_restart(char *command) __attribute__((noreturn)); 47static int machine_state;
47static void sgi_machine_halt(void) __attribute__((noreturn));
48static void sgi_machine_power_off(void) __attribute__((noreturn));
49 48
50static void sgi_machine_restart(char *command) 49static void ATTRIB_NORET sgi_machine_power_off(void)
51{
52 if (machine_state & MACHINE_SHUTTING_DOWN)
53 sgi_machine_power_off();
54 sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT;
55 while (1);
56}
57
58static void sgi_machine_halt(void)
59{
60 if (machine_state & MACHINE_SHUTTING_DOWN)
61 sgi_machine_power_off();
62 ArcEnterInteractiveMode();
63}
64
65static void sgi_machine_power_off(void)
66{ 50{
67 unsigned int tmp; 51 unsigned int tmp;
68 52
@@ -84,6 +68,21 @@ static void sgi_machine_power_off(void)
84 } 68 }
85} 69}
86 70
71static void ATTRIB_NORET sgi_machine_restart(char *command)
72{
73 if (machine_state & MACHINE_SHUTTING_DOWN)
74 sgi_machine_power_off();
75 sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT;
76 while (1);
77}
78
79static void ATTRIB_NORET sgi_machine_halt(void)
80{
81 if (machine_state & MACHINE_SHUTTING_DOWN)
82 sgi_machine_power_off();
83 ArcEnterInteractiveMode();
84}
85
87static void power_timeout(unsigned long data) 86static void power_timeout(unsigned long data)
88{ 87{
89 sgi_machine_power_off(); 88 sgi_machine_power_off();
@@ -95,7 +94,7 @@ static void blink_timeout(unsigned long data)
95 sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); 94 sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
96 sgioc->reset = sgi_ioc_reset; 95 sgioc->reset = sgi_ioc_reset;
97 96
98 mod_timer(&blink_timer, jiffies+data); 97 mod_timer(&blink_timer, jiffies + data);
99} 98}
100 99
101static void debounce(unsigned long data) 100static void debounce(unsigned long data)
@@ -103,7 +102,7 @@ static void debounce(unsigned long data)
103 del_timer(&debounce_timer); 102 del_timer(&debounce_timer);
104 if (sgint->istat1 & SGINT_ISTAT1_PWR) { 103 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
105 /* Interrupt still being sent. */ 104 /* Interrupt still being sent. */
106 debounce_timer.expires = jiffies + 5; /* 0.05s */ 105 debounce_timer.expires = jiffies + (HZ / 20); /* 0.05s */
107 add_timer(&debounce_timer); 106 add_timer(&debounce_timer);
108 107
109 sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | 108 sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR |
@@ -151,7 +150,7 @@ static inline void volume_up_button(unsigned long data)
151 indy_volume_button(1); 150 indy_volume_button(1);
152 151
153 if (sgint->istat1 & SGINT_ISTAT1_PWR) { 152 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
154 volume_timer.expires = jiffies + 1; 153 volume_timer.expires = jiffies + (HZ / 100);
155 add_timer(&volume_timer); 154 add_timer(&volume_timer);
156 } 155 }
157} 156}
@@ -164,7 +163,7 @@ static inline void volume_down_button(unsigned long data)
164 indy_volume_button(-1); 163 indy_volume_button(-1);
165 164
166 if (sgint->istat1 & SGINT_ISTAT1_PWR) { 165 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
167 volume_timer.expires = jiffies + 1; 166 volume_timer.expires = jiffies + (HZ / 100);
168 add_timer(&volume_timer); 167 add_timer(&volume_timer);
169 } 168 }
170} 169}
@@ -199,14 +198,14 @@ static irqreturn_t panel_int(int irq, void *dev_id, struct pt_regs *regs)
199 if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { 198 if (!(buttons & SGIOC_PANEL_VOLUPINTR)) {
200 init_timer(&volume_timer); 199 init_timer(&volume_timer);
201 volume_timer.function = volume_up_button; 200 volume_timer.function = volume_up_button;
202 volume_timer.expires = jiffies + 1; 201 volume_timer.expires = jiffies + (HZ / 100);
203 add_timer(&volume_timer); 202 add_timer(&volume_timer);
204 } 203 }
205 /* Volume down button was pressed */ 204 /* Volume down button was pressed */
206 if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { 205 if (!(buttons & SGIOC_PANEL_VOLDNINTR)) {
207 init_timer(&volume_timer); 206 init_timer(&volume_timer);
208 volume_timer.function = volume_down_button; 207 volume_timer.function = volume_down_button;
209 volume_timer.expires = jiffies + 1; 208 volume_timer.expires = jiffies + (HZ / 100);
210 add_timer(&volume_timer); 209 add_timer(&volume_timer);
211 } 210 }
212 211
@@ -234,7 +233,7 @@ static int __init reboot_setup(void)
234{ 233{
235 _machine_restart = sgi_machine_restart; 234 _machine_restart = sgi_machine_restart;
236 _machine_halt = sgi_machine_halt; 235 _machine_halt = sgi_machine_halt;
237 _machine_power_off = sgi_machine_power_off; 236 pm_power_off = sgi_machine_power_off;
238 237
239 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); 238 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
240 init_timer(&blink_timer); 239 init_timer(&blink_timer);
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 5e59b4c8876b..7018e1833e85 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -56,6 +56,7 @@ extern void ip22_time_init(void) __init;
56void __init plat_setup(void) 56void __init plat_setup(void)
57{ 57{
58 char *ctype; 58 char *ctype;
59 char *cserial;
59 60
60 board_be_init = ip22_be_init; 61 board_be_init = ip22_be_init;
61 ip22_time_init(); 62 ip22_time_init();
@@ -81,9 +82,14 @@ void __init plat_setup(void)
81 /* ARCS console environment variable is set to "g?" for 82 /* ARCS console environment variable is set to "g?" for
82 * graphics console, it is set to "d" for the first serial 83 * graphics console, it is set to "d" for the first serial
83 * line and "d2" for the second serial line. 84 * line and "d2" for the second serial line.
85 *
86 * Need to check if the case is 'g' but no keyboard:
87 * (ConsoleIn/Out = serial)
84 */ 88 */
85 ctype = ArcGetEnvironmentVariable("console"); 89 ctype = ArcGetEnvironmentVariable("console");
86 if (ctype && *ctype == 'd') { 90 cserial = ArcGetEnvironmentVariable("ConsoleOut");
91
92 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
87 static char options[8]; 93 static char options[8];
88 char *baud = ArcGetEnvironmentVariable("dbaud"); 94 char *baud = ArcGetEnvironmentVariable("dbaud");
89 if (baud) 95 if (baud)
@@ -91,7 +97,7 @@ void __init plat_setup(void)
91 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0, 97 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
92 baud ? options : NULL); 98 baud ? options : NULL);
93 } else if (!ctype || *ctype != 'g') { 99 } else if (!ctype || *ctype != 'g') {
94 /* Use ARC if we don't want serial ('d') or Newport ('g'). */ 100 /* Use ARC if we don't want serial ('d') or graphics ('g'). */
95 prom_flags |= PROM_FLAG_USE_AS_CONSOLE; 101 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
96 add_preferred_console("arc", 0, NULL); 102 add_preferred_console("arc", 0, NULL);
97 } 103 }
diff --git a/arch/mips/sgi-ip27/ip27-reset.c b/arch/mips/sgi-ip27/ip27-reset.c
index 2e16be94c78b..4322db57d3c1 100644
--- a/arch/mips/sgi-ip27/ip27-reset.c
+++ b/arch/mips/sgi-ip27/ip27-reset.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Reset an IP27. 6 * Reset an IP27.
7 * 7 *
8 * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle 8 * Copyright (C) 1997, 1998, 1999, 2000, 06 by Ralf Baechle
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */ 10 */
11#include <linux/config.h> 11#include <linux/config.h>
@@ -15,6 +15,7 @@
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/mmzone.h> 16#include <linux/mmzone.h>
17#include <linux/nodemask.h> 17#include <linux/nodemask.h>
18#include <linux/pm.h>
18 19
19#include <asm/io.h> 20#include <asm/io.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
@@ -77,5 +78,5 @@ void ip27_reboot_setup(void)
77{ 78{
78 _machine_restart = ip27_machine_restart; 79 _machine_restart = ip27_machine_restart;
79 _machine_halt = ip27_machine_halt; 80 _machine_halt = ip27_machine_halt;
80 _machine_power_off = ip27_machine_power_off; 81 pm_power_off = ip27_machine_power_off;
81} 82}
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 88e1f52059ff..0c948008b023 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/ds17287rtc.h> 16#include <linux/ds17287rtc.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/pm.h>
18 19
19#include <asm/addrspace.h> 20#include <asm/addrspace.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
@@ -188,7 +189,7 @@ static __init int ip32_reboot_setup(void)
188 189
189 _machine_restart = ip32_machine_restart; 190 _machine_restart = ip32_machine_restart;
190 _machine_halt = ip32_machine_halt; 191 _machine_halt = ip32_machine_halt;
191 _machine_power_off = ip32_machine_power_off; 192 pm_power_off = ip32_machine_power_off;
192 193
193 init_timer(&blink_timer); 194 init_timer(&blink_timer);
194 blink_timer.function = blink_timeout; 195 blink_timer.function = blink_timeout;
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index d10a269aeae1..2c38770b1e1b 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -66,11 +66,6 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
66#include <linux/tty.h> 66#include <linux/tty.h>
67#include <linux/serial.h> 67#include <linux/serial.h>
68#include <linux/serial_core.h> 68#include <linux/serial_core.h>
69extern int early_serial_setup(struct uart_port *port);
70
71#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
72#define BASE_BAUD (1843200 / 16)
73
74#endif /* CONFIG_SERIAL_8250 */ 69#endif /* CONFIG_SERIAL_8250 */
75 70
76/* An arbitrary time; this can be decreased if reliability looks good */ 71/* An arbitrary time; this can be decreased if reliability looks good */
@@ -110,8 +105,8 @@ void __init plat_setup(void)
110 o2_serial[0].type = PORT_16550A; 105 o2_serial[0].type = PORT_16550A;
111 o2_serial[0].line = 0; 106 o2_serial[0].line = 0;
112 o2_serial[0].irq = MACEISA_SERIAL1_IRQ; 107 o2_serial[0].irq = MACEISA_SERIAL1_IRQ;
113 o2_serial[0].flags = STD_COM_FLAGS; 108 o2_serial[0].flags = UPF_SKIP_TEST;
114 o2_serial[0].uartclk = BASE_BAUD * 16; 109 o2_serial[0].uartclk = 1843200;
115 o2_serial[0].iotype = UPIO_MEM; 110 o2_serial[0].iotype = UPIO_MEM;
116 o2_serial[0].membase = (char *)&mace->isa.serial1; 111 o2_serial[0].membase = (char *)&mace->isa.serial1;
117 o2_serial[0].fifosize = 14; 112 o2_serial[0].fifosize = 14;
@@ -121,8 +116,8 @@ void __init plat_setup(void)
121 o2_serial[1].type = PORT_16550A; 116 o2_serial[1].type = PORT_16550A;
122 o2_serial[1].line = 1; 117 o2_serial[1].line = 1;
123 o2_serial[1].irq = MACEISA_SERIAL2_IRQ; 118 o2_serial[1].irq = MACEISA_SERIAL2_IRQ;
124 o2_serial[1].flags = STD_COM_FLAGS; 119 o2_serial[1].flags = UPF_SKIP_TEST;
125 o2_serial[1].uartclk = BASE_BAUD * 16; 120 o2_serial[1].uartclk = 1843200;
126 o2_serial[1].iotype = UPIO_MEM; 121 o2_serial[1].iotype = UPIO_MEM;
127 o2_serial[1].membase = (char *)&mace->isa.serial2; 122 o2_serial[1].membase = (char *)&mace->isa.serial2;
128 o2_serial[1].fifosize = 14; 123 o2_serial[1].fifosize = 14;
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c
index 7a2c7a8510d4..ea308029450e 100644
--- a/arch/mips/sibyte/cfe/setup.c
+++ b/arch/mips/sibyte/cfe/setup.c
@@ -23,6 +23,7 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/blkdev.h> 24#include <linux/blkdev.h>
25#include <linux/bootmem.h> 25#include <linux/bootmem.h>
26#include <linux/pm.h>
26#include <linux/smp.h> 27#include <linux/smp.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
@@ -248,7 +249,7 @@ void __init prom_init(void)
248 249
249 _machine_restart = cfe_linux_restart; 250 _machine_restart = cfe_linux_restart;
250 _machine_halt = cfe_linux_halt; 251 _machine_halt = cfe_linux_halt;
251 _machine_power_off = cfe_linux_halt; 252 pm_power_off = cfe_linux_halt;
252 253
253 /* 254 /*
254 * Check if a loader was used; if NOT, the 4 arguments are 255 * Check if a loader was used; if NOT, the 4 arguments are
diff --git a/arch/mips/sibyte/sb1250/prom.c b/arch/mips/sibyte/sb1250/prom.c
index de62ab0f55a2..742043f8d755 100644
--- a/arch/mips/sibyte/sb1250/prom.c
+++ b/arch/mips/sibyte/sb1250/prom.c
@@ -24,6 +24,7 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/initrd.h> 26#include <linux/initrd.h>
27#include <linux/pm.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
29#include <asm/reboot.h> 30#include <asm/reboot.h>
@@ -79,7 +80,7 @@ void __init prom_init(void)
79{ 80{
80 _machine_restart = (void (*)(char *))prom_linux_exit; 81 _machine_restart = (void (*)(char *))prom_linux_exit;
81 _machine_halt = prom_linux_exit; 82 _machine_halt = prom_linux_exit;
82 _machine_power_off = prom_linux_exit; 83 pm_power_off = prom_linux_exit;
83 84
84 strcpy(arcs_cmdline, "root=/dev/ram0 "); 85 strcpy(arcs_cmdline, "root=/dev/ram0 ");
85 86
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index df2e266c700c..fde4751c84fe 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/config.h> 18#include <linux/config.h>
19#include <linux/init.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/reboot.h> 21#include <linux/reboot.h>
21#include <linux/string.h> 22#include <linux/string.h>
@@ -42,7 +43,7 @@ static inline int setup_bcm112x(void);
42 43
43/* Setup code likely to be common to all SiByte platforms */ 44/* Setup code likely to be common to all SiByte platforms */
44 45
45static inline int sys_rev_decode(void) 46static int __init sys_rev_decode(void)
46{ 47{
47 int ret = 0; 48 int ret = 0;
48 49
@@ -74,7 +75,7 @@ static inline int sys_rev_decode(void)
74 return ret; 75 return ret;
75} 76}
76 77
77static inline int setup_bcm1250(void) 78static int __init setup_bcm1250(void)
78{ 79{
79 int ret = 0; 80 int ret = 0;
80 81
@@ -120,7 +121,7 @@ static inline int setup_bcm1250(void)
120 return ret; 121 return ret;
121} 122}
122 123
123static inline int setup_bcm112x(void) 124static int __init setup_bcm112x(void)
124{ 125{
125 int ret = 0; 126 int ret = 0;
126 127
@@ -146,7 +147,7 @@ static inline int setup_bcm112x(void)
146 return ret; 147 return ret;
147} 148}
148 149
149void sb1250_setup(void) 150void __init sb1250_setup(void)
150{ 151{
151 uint64_t sys_rev; 152 uint64_t sys_rev;
152 int plldiv; 153 int plldiv;
@@ -169,31 +170,42 @@ void sb1250_setup(void)
169 soc_str, pass_str, zbbus_mhz * 2, sb1_pass); 170 soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
170 prom_printf("Board type: %s\n", get_system_type()); 171 prom_printf("Board type: %s\n", get_system_type());
171 172
172 switch(war_pass) { 173 switch (war_pass) {
173 case K_SYS_REVISION_BCM1250_PASS1: 174 case K_SYS_REVISION_BCM1250_PASS1:
174#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS 175#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
175 prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); 176 prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
177 "and the kernel doesn't have the proper "
178 "workarounds compiled in. @@@@\n");
176 bad_config = 1; 179 bad_config = 1;
177#endif 180#endif
178 break; 181 break;
179 case K_SYS_REVISION_BCM1250_PASS2: 182 case K_SYS_REVISION_BCM1250_PASS2:
180 /* Pass 2 - easiest as default for now - so many numbers */ 183 /* Pass 2 - easiest as default for now - so many numbers */
181#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) 184#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \
182 prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); 185 !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
186 prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the "
187 "kernel doesn't have the proper workarounds "
188 "compiled in. @@@@\n");
183 bad_config = 1; 189 bad_config = 1;
184#endif 190#endif
185#ifdef CONFIG_CPU_HAS_PREFETCH 191#ifdef CONFIG_CPU_HAS_PREFETCH
186 prom_printf("@@@@ Prefetches may be enabled in this kernel, but are buggy on this board. @@@@\n"); 192 prom_printf("@@@@ Prefetches may be enabled in this kernel, "
193 "but are buggy on this board. @@@@\n");
187 bad_config = 1; 194 bad_config = 1;
188#endif 195#endif
189 break; 196 break;
190 case K_SYS_REVISION_BCM1250_PASS2_2: 197 case K_SYS_REVISION_BCM1250_PASS2_2:
191#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS 198#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
192 prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); 199 prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the "
200 "kernel doesn't have the proper workarounds "
201 "compiled in. @@@@\n");
193 bad_config = 1; 202 bad_config = 1;
194#endif 203#endif
195#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || !defined(CONFIG_CPU_HAS_PREFETCH) 204#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \
196 prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is conservatively configured for an 'A' stepping. @@@@\n"); 205 !defined(CONFIG_CPU_HAS_PREFETCH)
206 prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is "
207 "conservatively configured for an 'A' stepping. "
208 "@@@@\n");
197#endif 209#endif
198 break; 210 break;
199 default: 211 default:
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 262c85680709..1141fcd13a59 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
9 */ 9 */
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/eisa.h> 11#include <linux/eisa.h>
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/mc146818rtc.h> 17#include <linux/mc146818rtc.h>
18#include <linux/pm.h>
18#include <linux/pci.h> 19#include <linux/pci.h>
19#include <linux/console.h> 20#include <linux/console.h>
20#include <linux/fb.h> 21#include <linux/fb.h>
@@ -189,7 +190,7 @@ void __init plat_setup(void)
189 190
190 _machine_restart = sni_machine_restart; 191 _machine_restart = sni_machine_restart;
191 _machine_halt = sni_machine_halt; 192 _machine_halt = sni_machine_halt;
192 _machine_power_off = sni_machine_power_off; 193 pm_power_off = sni_machine_power_off;
193 194
194 sni_display_setup(); 195 sni_display_setup();
195 196
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
index e4d095d3e192..e19e2be70f76 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
@@ -60,7 +60,6 @@ void __init prom_init_cmdline(void)
60 60
61void __init prom_init(void) 61void __init prom_init(void)
62{ 62{
63 const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES;
64 extern int tx4927_get_mem_size(void); 63 extern int tx4927_get_mem_size(void);
65 extern char* toshiba_name; 64 extern char* toshiba_name;
66 int msize; 65 int msize;
@@ -69,12 +68,13 @@ void __init prom_init(void)
69 68
70 mips_machgroup = MACH_GROUP_TOSHIBA; 69 mips_machgroup = MACH_GROUP_TOSHIBA;
71 70
72 if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) 71 if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) {
73 mips_machtype = MACH_TOSHIBA_RBTX4927; 72 mips_machtype = MACH_TOSHIBA_RBTX4927;
74 else 73 toshiba_name = "TX4927";
74 } else {
75 mips_machtype = MACH_TOSHIBA_RBTX4937; 75 mips_machtype = MACH_TOSHIBA_RBTX4937;
76 76 toshiba_name = "TX4937";
77 toshiba_name = toshiba_name_list[mips_machtype]; 77 }
78 78
79 msize = tx4927_get_mem_size(); 79 msize = tx4927_get_mem_size();
80 add_memory_region(0, msize << 20, BOOT_MEM_RAM); 80 add_memory_region(0, msize << 20, BOOT_MEM_RAM);
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index 990fcb294bab..2ad6401d2af4 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -53,6 +53,8 @@
53#include <linux/interrupt.h> 53#include <linux/interrupt.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/timex.h> 55#include <linux/timex.h>
56#include <linux/pm.h>
57
56#include <asm/bootinfo.h> 58#include <asm/bootinfo.h>
57#include <asm/page.h> 59#include <asm/page.h>
58#include <asm/io.h> 60#include <asm/io.h>
@@ -537,19 +539,10 @@ void tx4927_pci_setup(void)
537 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, 539 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
538 "0x%08lx=mips_io_port_base", 540 "0x%08lx=mips_io_port_base",
539 mips_io_port_base); 541 mips_io_port_base);
540
541 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
542 "setup pci_io_resource to 0x%08lx 0x%08lx\n",
543 pci_io_resource.start,
544 pci_io_resource.end);
545 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
546 "setup pci_mem_resource to 0x%08lx 0x%08lx\n",
547 pci_mem_resource.start,
548 pci_mem_resource.end);
549
550 if (!called) { 542 if (!called) {
551 printk 543 printk
552 ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", 544 ("%s PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
545 toshiba_name,
553 (unsigned short) (tx4927_pcicptr->pciid >> 16), 546 (unsigned short) (tx4927_pcicptr->pciid >> 16),
554 (unsigned short) (tx4927_pcicptr->pciid & 0xffff), 547 (unsigned short) (tx4927_pcicptr->pciid & 0xffff),
555 (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), 548 (unsigned short) (tx4927_pcicptr->pciccrev & 0xff),
@@ -562,21 +555,52 @@ void tx4927_pci_setup(void)
562 (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); 555 (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : "");
563 if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { 556 if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) {
564 int pciclk = 0; 557 int pciclk = 0;
565 switch ((unsigned long) tx4927_ccfgptr-> 558 if (mips_machtype == MACH_TOSHIBA_RBTX4937)
566 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 559 switch ((unsigned long) tx4927_ccfgptr->
567 case TX4927_CCFG_PCIDIVMODE_2_5: 560 ccfg & TX4937_CCFG_PCIDIVMODE_MASK) {
568 pciclk = tx4927_cpu_clock * 2 / 5; 561 case TX4937_CCFG_PCIDIVMODE_4:
569 break; 562 pciclk = tx4927_cpu_clock / 4;
570 case TX4927_CCFG_PCIDIVMODE_3: 563 break;
571 pciclk = tx4927_cpu_clock / 3; 564 case TX4937_CCFG_PCIDIVMODE_4_5:
572 break; 565 pciclk = tx4927_cpu_clock * 2 / 9;
573 case TX4927_CCFG_PCIDIVMODE_5: 566 break;
574 pciclk = tx4927_cpu_clock / 5; 567 case TX4937_CCFG_PCIDIVMODE_5:
575 break; 568 pciclk = tx4927_cpu_clock / 5;
576 case TX4927_CCFG_PCIDIVMODE_6: 569 break;
577 pciclk = tx4927_cpu_clock / 6; 570 case TX4937_CCFG_PCIDIVMODE_5_5:
578 break; 571 pciclk = tx4927_cpu_clock * 2 / 11;
579 } 572 break;
573 case TX4937_CCFG_PCIDIVMODE_8:
574 pciclk = tx4927_cpu_clock / 8;
575 break;
576 case TX4937_CCFG_PCIDIVMODE_9:
577 pciclk = tx4927_cpu_clock / 9;
578 break;
579 case TX4937_CCFG_PCIDIVMODE_10:
580 pciclk = tx4927_cpu_clock / 10;
581 break;
582 case TX4937_CCFG_PCIDIVMODE_11:
583 pciclk = tx4927_cpu_clock / 11;
584 break;
585 }
586
587 else
588 switch ((unsigned long) tx4927_ccfgptr->
589 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
590 case TX4927_CCFG_PCIDIVMODE_2_5:
591 pciclk = tx4927_cpu_clock * 2 / 5;
592 break;
593 case TX4927_CCFG_PCIDIVMODE_3:
594 pciclk = tx4927_cpu_clock / 3;
595 break;
596 case TX4927_CCFG_PCIDIVMODE_5:
597 pciclk = tx4927_cpu_clock / 5;
598 break;
599 case TX4927_CCFG_PCIDIVMODE_6:
600 pciclk = tx4927_cpu_clock / 6;
601 break;
602 }
603
580 printk("Internal(%dMHz)", pciclk / 1000000); 604 printk("Internal(%dMHz)", pciclk / 1000000);
581 } else { 605 } else {
582 int pciclk = 0; 606 int pciclk = 0;
@@ -814,24 +838,40 @@ void __init toshiba_rbtx4927_setup(void)
814 ":ResetRoutines\n"); 838 ":ResetRoutines\n");
815 _machine_restart = toshiba_rbtx4927_restart; 839 _machine_restart = toshiba_rbtx4927_restart;
816 _machine_halt = toshiba_rbtx4927_halt; 840 _machine_halt = toshiba_rbtx4927_halt;
817 _machine_power_off = toshiba_rbtx4927_power_off; 841 pm_power_off = toshiba_rbtx4927_power_off;
818 842
819#ifdef CONFIG_PCI 843#ifdef CONFIG_PCI
820 844
821 /* PCIC */ 845 /* PCIC */
822 /* 846 /*
823 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. 847 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
824 * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1). 848 *
849 * For TX4927:
850 * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
825 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) 851 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
826 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) 852 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
827 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) 853 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
828 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) 854 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
829 * i.e. S9[3]: ON (83MHz), OFF (100MHz) 855 * i.e. S9[3]: ON (83MHz), OFF (100MHz)
856 *
857 * For TX4937:
858 * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
859 * PCIDIVMODE[10] is 0.
860 * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
861 * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
862 * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
863 * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
864 * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
865 * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
866 *
830 */ 867 */
831 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 868 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
832 "ccfg is %lx, DIV is %x\n", 869 "ccfg is %lx, PCIDIVMODE is %x\n",
833 (unsigned long) tx4927_ccfgptr-> 870 (unsigned long) tx4927_ccfgptr->ccfg,
834 ccfg, TX4927_CCFG_PCIDIVMODE_MASK); 871 (unsigned long) tx4927_ccfgptr->ccfg &
872 (mips_machtype == MACH_TOSHIBA_RBTX4937 ?
873 TX4937_CCFG_PCIDIVMODE_MASK :
874 TX4927_CCFG_PCIDIVMODE_MASK));
835 875
836 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 876 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
837 "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", 877 "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n",
@@ -842,20 +882,30 @@ void __init toshiba_rbtx4927_setup(void)
842 (unsigned long) tx4927_ccfgptr-> 882 (unsigned long) tx4927_ccfgptr->
843 ccfg & TX4927_CCFG_PCIXARB); 883 ccfg & TX4927_CCFG_PCIXARB);
844 884
845 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 885 if (mips_machtype == MACH_TOSHIBA_RBTX4937)
846 "PCIDIVMODE is %lx\n", 886 switch ((unsigned long)tx4927_ccfgptr->
847 (unsigned long) tx4927_ccfgptr-> 887 ccfg & TX4937_CCFG_PCIDIVMODE_MASK) {
848 ccfg & TX4927_CCFG_PCIDIVMODE_MASK); 888 case TX4937_CCFG_PCIDIVMODE_8:
849 889 case TX4937_CCFG_PCIDIVMODE_4:
850 switch ((unsigned long) tx4927_ccfgptr-> 890 tx4927_cpu_clock = 266666666; /* 266MHz */
851 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 891 break;
852 case TX4927_CCFG_PCIDIVMODE_2_5: 892 case TX4937_CCFG_PCIDIVMODE_9:
853 case TX4927_CCFG_PCIDIVMODE_5: 893 case TX4937_CCFG_PCIDIVMODE_4_5:
854 tx4927_cpu_clock = 166000000; /* 166MHz */ 894 tx4927_cpu_clock = 300000000; /* 300MHz */
855 break; 895 break;
856 default: 896 default:
857 tx4927_cpu_clock = 200000000; /* 200MHz */ 897 tx4927_cpu_clock = 333333333; /* 333MHz */
858 } 898 }
899 else
900 switch ((unsigned long)tx4927_ccfgptr->
901 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
902 case TX4927_CCFG_PCIDIVMODE_2_5:
903 case TX4927_CCFG_PCIDIVMODE_5:
904 tx4927_cpu_clock = 166666666; /* 166MHz */
905 break;
906 default:
907 tx4927_cpu_clock = 200000000; /* 200MHz */
908 }
859 909
860 /* CCFG */ 910 /* CCFG */
861 /* enable Timeout BusError */ 911 /* enable Timeout BusError */
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 9f1dcc8ca5a3..5c7ace982a49 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -20,6 +20,8 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/console.h> 21#include <linux/console.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/pm.h>
24
23#include <asm/wbflush.h> 25#include <asm/wbflush.h>
24#include <asm/reboot.h> 26#include <asm/reboot.h>
25#include <asm/irq.h> 27#include <asm/irq.h>
@@ -1003,7 +1005,7 @@ void __init toshiba_rbtx4938_setup(void)
1003 1005
1004 _machine_restart = rbtx4938_machine_restart; 1006 _machine_restart = rbtx4938_machine_restart;
1005 _machine_halt = rbtx4938_machine_halt; 1007 _machine_halt = rbtx4938_machine_halt;
1006 _machine_power_off = rbtx4938_machine_power_off; 1008 pm_power_off = rbtx4938_machine_power_off;
1007 1009
1008 *rbtx4938_led_ptr = 0xff; 1010 *rbtx4938_led_ptr = 0xff;
1009 printk("RBTX4938 --- FPGA(Rev %02x)", *rbtx4938_fpga_rev_ptr); 1011 printk("RBTX4938 --- FPGA(Rev %02x)", *rbtx4938_fpga_rev_ptr);
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c
index 02bf4f7d06ba..5e469796413f 100644
--- a/arch/mips/vr41xx/common/pmu.c
+++ b/arch/mips/vr41xx/common/pmu.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/pm.h>
24#include <linux/smp.h> 25#include <linux/smp.h>
25#include <linux/types.h> 26#include <linux/types.h>
26 27
@@ -114,7 +115,7 @@ static int __init vr41xx_pmu_init(void)
114 115
115 _machine_restart = vr41xx_restart; 116 _machine_restart = vr41xx_restart;
116 _machine_halt = vr41xx_halt; 117 _machine_halt = vr41xx_halt;
117 _machine_power_off = vr41xx_power_off; 118 pm_power_off = vr41xx_power_off;
118 119
119 return 0; 120 return 0;
120} 121}
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 29b4d61898f2..05273ccced0e 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -468,19 +468,23 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
468 if ( opcode == 1 ) { /* GETFSIND */ 468 if ( opcode == 1 ) { /* GETFSIND */
469 len = strlen_user((char *)arg1); 469 len = strlen_user((char *)arg1);
470 printk(KERN_DEBUG "len of arg1 = %d\n", len); 470 printk(KERN_DEBUG "len of arg1 = %d\n", len);
471 471 if (len == 0)
472 fsname = (char *) kmalloc(len+1, GFP_KERNEL); 472 return 0;
473 fsname = (char *) kmalloc(len, GFP_KERNEL);
473 if ( !fsname ) { 474 if ( !fsname ) {
474 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 475 printk(KERN_DEBUG "failed to kmalloc fsname\n");
475 return 0; 476 return 0;
476 } 477 }
477 478
478 if ( copy_from_user(fsname, (char *)arg1, len+1) ) { 479 if ( copy_from_user(fsname, (char *)arg1, len) ) {
479 printk(KERN_DEBUG "failed to copy_from_user fsname\n"); 480 printk(KERN_DEBUG "failed to copy_from_user fsname\n");
480 kfree(fsname); 481 kfree(fsname);
481 return 0; 482 return 0;
482 } 483 }
483 484
485 /* String could be altered by userspace after strlen_user() */
486 fsname[len] = '\0';
487
484 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); 488 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname);
485 if ( !strcmp(fsname, "hfs") ) { 489 if ( !strcmp(fsname, "hfs") ) {
486 fstype = 0; 490 fstype = 0;
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 44dd82b791d1..efcad7601a7a 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -167,6 +167,8 @@ endef
167 167
168archclean: 168archclean:
169 $(Q)$(MAKE) $(clean)=$(boot) 169 $(Q)$(MAKE) $(clean)=$(boot)
170
171archmrproper:
170 $(Q)rm -rf arch/$(ARCH)/include 172 $(Q)rm -rf arch/$(ARCH)/include
171 173
172archprepare: checkbin 174archprepare: checkbin
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index e4362dfa37fb..340730fb8c91 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -66,7 +66,7 @@ _GLOBAL(load_up_fpu)
66#else 66#else
67 ld r4,PACACURRENT(r13) 67 ld r4,PACACURRENT(r13)
68 addi r5,r4,THREAD /* Get THREAD */ 68 addi r5,r4,THREAD /* Get THREAD */
69 ld r4,THREAD_FPEXC_MODE(r5) 69 lwz r4,THREAD_FPEXC_MODE(r5)
70 ori r12,r12,MSR_FP 70 ori r12,r12,MSR_FP
71 or r12,r12,r4 71 or r12,r12,r4
72 std r12,_MSR(r1) 72 std r12,_MSR(r1)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 308268466342..415659629394 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -749,11 +749,12 @@ iSeries_secondary_smp_loop:
749 749
750 .globl decrementer_iSeries_masked 750 .globl decrementer_iSeries_masked
751decrementer_iSeries_masked: 751decrementer_iSeries_masked:
752 /* We may not have a valid TOC pointer in here. */
752 li r11,1 753 li r11,1
753 ld r12,PACALPPACAPTR(r13) 754 ld r12,PACALPPACAPTR(r13)
754 stb r11,LPPACADECRINT(r12) 755 stb r11,LPPACADECRINT(r12)
755 LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy) 756 LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy)
756 lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12) 757 lwz r12,0(r12)
757 mtspr SPRN_DEC,r12 758 mtspr SPRN_DEC,r12
758 /* fall through */ 759 /* fall through */
759 760
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 4d9b4388918b..946f3219fd29 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -334,9 +334,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
334 334
335 spin_unlock_irqrestore(&(tbl->it_lock), flags); 335 spin_unlock_irqrestore(&(tbl->it_lock), flags);
336 336
337 /* Make sure updates are seen by hardware */
338 mb();
339
340 DBG("mapped %d elements:\n", outcount); 337 DBG("mapped %d elements:\n", outcount);
341 338
342 /* For the sake of iommu_unmap_sg, we clear out the length in the 339 /* For the sake of iommu_unmap_sg, we clear out the length in the
@@ -347,6 +344,10 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
347 outs->dma_address = DMA_ERROR_CODE; 344 outs->dma_address = DMA_ERROR_CODE;
348 outs->dma_length = 0; 345 outs->dma_length = 0;
349 } 346 }
347
348 /* Make sure updates are seen by hardware */
349 mb();
350
350 return outcount; 351 return outcount;
351 352
352 failure: 353 failure:
@@ -358,6 +359,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
358 npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr) 359 npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr)
359 >> PAGE_SHIFT; 360 >> PAGE_SHIFT;
360 __iommu_free(tbl, vaddr, npages); 361 __iommu_free(tbl, vaddr, npages);
362 s->dma_address = DMA_ERROR_CODE;
363 s->dma_length = 0;
361 } 364 }
362 } 365 }
363 spin_unlock_irqrestore(&(tbl->it_lock), flags); 366 spin_unlock_irqrestore(&(tbl->it_lock), flags);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d50c8df0183e..294832a7e0a6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -491,7 +491,12 @@ void __init finish_device_tree(void)
491 size = 16; 491 size = 16;
492 finish_node(allnodes, &size, 1); 492 finish_node(allnodes, &size, 1);
493 size -= 16; 493 size -= 16;
494 end = start = (unsigned long) __va(lmb_alloc(size, 128)); 494
495 if (0 == size)
496 end = start = 0;
497 else
498 end = start = (unsigned long)__va(lmb_alloc(size, 128));
499
495 finish_node(allnodes, &end, 0); 500 finish_node(allnodes, &end, 0);
496 BUG_ON(end != start + size); 501 BUG_ON(end != start + size);
497 502
@@ -1398,8 +1403,8 @@ struct device_node *of_find_node_by_name(struct device_node *from,
1398 1403
1399 read_lock(&devtree_lock); 1404 read_lock(&devtree_lock);
1400 np = from ? from->allnext : allnodes; 1405 np = from ? from->allnext : allnodes;
1401 for (; np != 0; np = np->allnext) 1406 for (; np != NULL; np = np->allnext)
1402 if (np->name != 0 && strcasecmp(np->name, name) == 0 1407 if (np->name != NULL && strcasecmp(np->name, name) == 0
1403 && of_node_get(np)) 1408 && of_node_get(np))
1404 break; 1409 break;
1405 if (from) 1410 if (from)
@@ -1917,3 +1922,30 @@ int prom_update_property(struct device_node *np,
1917 1922
1918 return 0; 1923 return 0;
1919} 1924}
1925
1926#ifdef CONFIG_KEXEC
1927/* We may have allocated the flat device tree inside the crash kernel region
1928 * in prom_init. If so we need to move it out into regular memory. */
1929void kdump_move_device_tree(void)
1930{
1931 unsigned long start, end;
1932 struct boot_param_header *new;
1933
1934 start = __pa((unsigned long)initial_boot_params);
1935 end = start + initial_boot_params->totalsize;
1936
1937 if (end < crashk_res.start || start > crashk_res.end)
1938 return;
1939
1940 new = (struct boot_param_header*)
1941 __va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE));
1942
1943 memcpy(new, initial_boot_params, initial_boot_params->totalsize);
1944
1945 initial_boot_params = new;
1946
1947 DBG("Flat device tree blob moved to %p\n", initial_boot_params);
1948
1949 /* XXX should we unreserve the old DT? */
1950}
1951#endif /* CONFIG_KEXEC */
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 7881ec96ef11..ec7153f4d47c 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2098,6 +2098,10 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2098 */ 2098 */
2099 prom_init_stdout(); 2099 prom_init_stdout();
2100 2100
2101 /* Bail if this is a kdump kernel. */
2102 if (PHYSICAL_START > 0)
2103 prom_panic("Error: You can't boot a kdump kernel from OF!\n");
2104
2101 /* 2105 /*
2102 * Check for an initrd 2106 * Check for an initrd
2103 */ 2107 */
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index a8099c806150..3934c227549b 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -465,8 +465,10 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
465 if (parent == NULL) 465 if (parent == NULL)
466 return NULL; 466 return NULL;
467 bus = of_match_bus(parent); 467 bus = of_match_bus(parent);
468 if (strcmp(bus->name, "pci")) 468 if (strcmp(bus->name, "pci")) {
469 of_node_put(parent);
469 return NULL; 470 return NULL;
471 }
470 bus->count_cells(dev, &na, &ns); 472 bus->count_cells(dev, &na, &ns);
471 of_node_put(parent); 473 of_node_put(parent);
472 if (!OF_CHECK_COUNTS(na, ns)) 474 if (!OF_CHECK_COUNTS(na, ns))
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7fe4a5c944c9..b5b2add7ad1e 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -22,6 +22,7 @@
22 22
23#include <asm/prom.h> 23#include <asm/prom.h>
24#include <asm/rtas.h> 24#include <asm/rtas.h>
25#include <asm/hvcall.h>
25#include <asm/semaphore.h> 26#include <asm/semaphore.h>
26#include <asm/machdep.h> 27#include <asm/machdep.h>
27#include <asm/page.h> 28#include <asm/page.h>
@@ -565,6 +566,7 @@ static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
565#ifdef CONFIG_PPC_PSERIES 566#ifdef CONFIG_PPC_PSERIES
566static void rtas_percpu_suspend_me(void *info) 567static void rtas_percpu_suspend_me(void *info)
567{ 568{
569 int i;
568 long rc; 570 long rc;
569 long flags; 571 long flags;
570 struct rtas_suspend_me_data *data = 572 struct rtas_suspend_me_data *data =
@@ -587,18 +589,16 @@ static void rtas_percpu_suspend_me(void *info)
587 589
588 if (rc == H_Continue) { 590 if (rc == H_Continue) {
589 data->waiting = 0; 591 data->waiting = 0;
590 rtas_call(ibm_suspend_me_token, 0, 1, 592 data->args->args[data->args->nargs] =
591 data->args->args); 593 rtas_call(ibm_suspend_me_token, 0, 1, NULL);
594 for_each_cpu(i)
595 plpar_hcall_norets(H_PROD,i);
592 } else { 596 } else {
593 data->waiting = -EBUSY; 597 data->waiting = -EBUSY;
594 printk(KERN_ERR "Error on H_Join hypervisor call\n"); 598 printk(KERN_ERR "Error on H_Join hypervisor call\n");
595 } 599 }
596 600
597out: 601out:
598 /* before we restore interrupts, make sure we don't
599 * generate a spurious soft lockup errors
600 */
601 touch_softlockup_watchdog();
602 local_irq_restore(flags); 602 local_irq_restore(flags);
603 return; 603 return;
604} 604}
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 50500093c97f..aaf384c3f04a 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -672,8 +672,7 @@ static void rtas_flash_firmware(int reboot_type)
672static void remove_flash_pde(struct proc_dir_entry *dp) 672static void remove_flash_pde(struct proc_dir_entry *dp)
673{ 673{
674 if (dp) { 674 if (dp) {
675 if (dp->data != NULL) 675 kfree(dp->data);
676 kfree(dp->data);
677 dp->owner = NULL; 676 dp->owner = NULL;
678 remove_proc_entry(dp->name, dp->parent); 677 remove_proc_entry(dp->name, dp->parent);
679 } 678 }
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index e29b275e09e0..a717dff695ef 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -398,6 +398,9 @@ void __init setup_system(void)
398{ 398{
399 DBG(" -> setup_system()\n"); 399 DBG(" -> setup_system()\n");
400 400
401#ifdef CONFIG_KEXEC
402 kdump_move_device_tree();
403#endif
401 /* 404 /*
402 * Unflatten the device-tree passed by prom_init or kexec 405 * Unflatten the device-tree passed by prom_init or kexec
403 */ 406 */
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index c6d0595da6b5..bd837b5dbf06 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -142,11 +142,7 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
142 return 0; 142 return 0;
143} 143}
144 144
145static inline compat_uptr_t to_user_ptr(void *kp) 145#define to_user_ptr(p) ptr_to_compat(p)
146{
147 return (compat_uptr_t)(u64)kp;
148}
149
150#define from_user_ptr(p) compat_ptr(p) 146#define from_user_ptr(p) compat_ptr(p)
151 147
152static inline int save_general_regs(struct pt_regs *regs, 148static inline int save_general_regs(struct pt_regs *regs,
@@ -213,8 +209,8 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
213 return 0; 209 return 0;
214} 210}
215 211
216#define to_user_ptr(p) (p) 212#define to_user_ptr(p) ((unsigned long)(p))
217#define from_user_ptr(p) (p) 213#define from_user_ptr(p) ((void __user *)(p))
218 214
219static inline int save_general_regs(struct pt_regs *regs, 215static inline int save_general_regs(struct pt_regs *regs,
220 struct mcontext __user *frame) 216 struct mcontext __user *frame)
@@ -526,7 +522,7 @@ long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
526 522
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 523 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
528 if (!ret && oact) { 524 if (!ret && oact) {
529 ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler); 525 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask); 526 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 527 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
532 } 528 }
@@ -675,8 +671,8 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
675int compat_sys_sigaltstack(u32 __new, u32 __old, int r5, 671int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
676 int r6, int r7, int r8, struct pt_regs *regs) 672 int r6, int r7, int r8, struct pt_regs *regs)
677{ 673{
678 stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; 674 stack_32_t __user * newstack = compat_ptr(__new);
679 stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; 675 stack_32_t __user * oldstack = compat_ptr(__old);
680 stack_t uss, uoss; 676 stack_t uss, uoss;
681 int ret; 677 int ret;
682 mm_segment_t old_fs; 678 mm_segment_t old_fs;
@@ -708,7 +704,7 @@ int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
708 set_fs(old_fs); 704 set_fs(old_fs);
709 /* Copy the stack information to the user output buffer */ 705 /* Copy the stack information to the user output buffer */
710 if (!ret && oldstack && 706 if (!ret && oldstack &&
711 (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || 707 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
712 __put_user(uoss.ss_flags, &oldstack->ss_flags) || 708 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
713 __put_user(uoss.ss_size, &oldstack->ss_size))) 709 __put_user(uoss.ss_size, &oldstack->ss_size)))
714 return -EFAULT; 710 return -EFAULT;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index b3193116e686..497a5d3df359 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -60,8 +60,8 @@ struct rt_sigframe {
60 struct ucontext uc; 60 struct ucontext uc;
61 unsigned long _unused[2]; 61 unsigned long _unused[2];
62 unsigned int tramp[TRAMP_SIZE]; 62 unsigned int tramp[TRAMP_SIZE];
63 struct siginfo *pinfo; 63 struct siginfo __user *pinfo;
64 void *puc; 64 void __user *puc;
65 struct siginfo info; 65 struct siginfo info;
66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ 66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */
67 char abigap[288]; 67 char abigap[288];
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c8458c531b25..13595a64f013 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -540,6 +540,9 @@ int __devinit start_secondary(void *unused)
540 if (smp_ops->take_timebase) 540 if (smp_ops->take_timebase)
541 smp_ops->take_timebase(); 541 smp_ops->take_timebase();
542 542
543 if (system_state > SYSTEM_BOOTING)
544 per_cpu(last_jiffy, cpu) = get_tb();
545
543 spin_lock(&call_lock); 546 spin_lock(&call_lock);
544 cpu_set(cpu, cpu_online_map); 547 cpu_set(cpu, cpu_online_map);
545 spin_unlock(&call_lock); 548 spin_unlock(&call_lock);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c4a294d657b9..1886045a2fd8 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -612,10 +612,10 @@ void __init generic_calibrate_decr(void)
612 612
613 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ 613 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
614 node_found = 0; 614 node_found = 0;
615 if (cpu != 0) { 615 if (cpu) {
616 fp = (unsigned int *)get_property(cpu, "timebase-frequency", 616 fp = (unsigned int *)get_property(cpu, "timebase-frequency",
617 NULL); 617 NULL);
618 if (fp != 0) { 618 if (fp) {
619 node_found = 1; 619 node_found = 1;
620 ppc_tb_freq = *fp; 620 ppc_tb_freq = *fp;
621 } 621 }
@@ -626,10 +626,10 @@ void __init generic_calibrate_decr(void)
626 626
627 ppc_proc_freq = DEFAULT_PROC_FREQ; 627 ppc_proc_freq = DEFAULT_PROC_FREQ;
628 node_found = 0; 628 node_found = 0;
629 if (cpu != 0) { 629 if (cpu) {
630 fp = (unsigned int *)get_property(cpu, "clock-frequency", 630 fp = (unsigned int *)get_property(cpu, "clock-frequency",
631 NULL); 631 NULL);
632 if (fp != 0) { 632 if (fp) {
633 node_found = 1; 633 node_found = 1;
634 ppc_proc_freq = *fp; 634 ppc_proc_freq = *fp;
635 } 635 }
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 2da65a9c93f6..5d29dcca523c 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -144,7 +144,7 @@ unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
144} 144}
145 145
146#ifdef CONFIG_PPC_MAPLE 146#ifdef CONFIG_PPC_MAPLE
147void udbg_maple_real_putc(unsigned char c) 147void udbg_maple_real_putc(char c)
148{ 148{
149 if (udbg_comport) { 149 if (udbg_comport) {
150 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0) 150 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 9584608fd768..bbe3eac918e8 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -197,6 +197,8 @@ long __init lmb_reserve(unsigned long base, unsigned long size)
197{ 197{
198 struct lmb_region *_rgn = &(lmb.reserved); 198 struct lmb_region *_rgn = &(lmb.reserved);
199 199
200 BUG_ON(0 == size);
201
200 return lmb_add_region(_rgn, base, size); 202 return lmb_add_region(_rgn, base, size);
201} 203}
202 204
@@ -227,6 +229,8 @@ unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align,
227 long i, j; 229 long i, j;
228 unsigned long base = 0; 230 unsigned long base = 0;
229 231
232 BUG_ON(0 == size);
233
230#ifdef CONFIG_PPC32 234#ifdef CONFIG_PPC32
231 /* On 32-bit, make sure we allocate lowmem */ 235 /* On 32-bit, make sure we allocate lowmem */
232 if (max_addr == LMB_ALLOC_ANYWHERE) 236 if (max_addr == LMB_ALLOC_ANYWHERE)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 15aac0d78dfa..550517c2dd42 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -435,17 +435,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
435{ 435{
436 clear_page(page); 436 clear_page(page);
437 437
438 if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
439 return;
440 /* 438 /*
441 * We shouldnt have to do this, but some versions of glibc 439 * We shouldnt have to do this, but some versions of glibc
442 * require it (ld.so assumes zero filled pages are icache clean) 440 * require it (ld.so assumes zero filled pages are icache clean)
443 * - Anton 441 * - Anton
444 */ 442 */
445 443 flush_dcache_page(pg);
446 /* avoid an atomic op if possible */
447 if (test_bit(PG_arch_1, &pg->flags))
448 clear_bit(PG_arch_1, &pg->flags);
449} 444}
450EXPORT_SYMBOL(clear_user_page); 445EXPORT_SYMBOL(clear_user_page);
451 446
@@ -469,12 +464,7 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
469 return; 464 return;
470#endif 465#endif
471 466
472 if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) 467 flush_dcache_page(pg);
473 return;
474
475 /* avoid an atomic op if possible */
476 if (test_bit(PG_arch_1, &pg->flags))
477 clear_bit(PG_arch_1, &pg->flags);
478} 468}
479 469
480void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, 470void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 16031b565be4..3b998a393e3f 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -2,7 +2,7 @@ obj-y += interrupt.o iommu.o setup.o spider-pic.o
2obj-y += pervasive.o 2obj-y += pervasive.o
3 3
4obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_SPU_FS) += spufs/ spu-base.o 5obj-$(CONFIG_SPU_FS) += spu-base.o spufs/
6 6
7spu-base-y += spu_base.o spu_priv1.o 7spu-base-y += spu_base.o spu_priv1.o
8 8
diff --git a/arch/powerpc/platforms/chrp/chrp.h b/arch/powerpc/platforms/chrp/chrp.h
index 3a2057fa314a..814f54742e0f 100644
--- a/arch/powerpc/platforms/chrp/chrp.h
+++ b/arch/powerpc/platforms/chrp/chrp.h
@@ -5,7 +5,6 @@
5extern void chrp_nvram_init(void); 5extern void chrp_nvram_init(void);
6extern void chrp_get_rtc_time(struct rtc_time *); 6extern void chrp_get_rtc_time(struct rtc_time *);
7extern int chrp_set_rtc_time(struct rtc_time *); 7extern int chrp_set_rtc_time(struct rtc_time *);
8extern void chrp_calibrate_decr(void);
9extern long chrp_time_init(void); 8extern long chrp_time_init(void);
10 9
11extern void chrp_find_bridges(void); 10extern void chrp_find_bridges(void);
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 00c52f27ef4f..8ef279ad36ad 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -204,9 +204,11 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
204 struct device_node *root = find_path_device("/"); 204 struct device_node *root = find_path_device("/");
205 struct device_node *rtas; 205 struct device_node *rtas;
206 206
207 of_node_get(root);
207 rtas = of_find_node_by_name (root, "rtas"); 208 rtas = of_find_node_by_name (root, "rtas");
208 if (rtas) { 209 if (rtas) {
209 hose->ops = &rtas_pci_ops; 210 hose->ops = &rtas_pci_ops;
211 of_node_put(rtas);
210 } else { 212 } else {
211 printk ("RTAS supporting Pegasos OF not found, please upgrade" 213 printk ("RTAS supporting Pegasos OF not found, please upgrade"
212 " your firmware\n"); 214 " your firmware\n");
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 2dc87aa5962f..e1fadbf49150 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -506,7 +506,7 @@ void __init chrp_init(void)
506 ppc_md.halt = rtas_halt; 506 ppc_md.halt = rtas_halt;
507 507
508 ppc_md.time_init = chrp_time_init; 508 ppc_md.time_init = chrp_time_init;
509 ppc_md.calibrate_decr = chrp_calibrate_decr; 509 ppc_md.calibrate_decr = generic_calibrate_decr;
510 510
511 /* this may get overridden with rtas routines later... */ 511 /* this may get overridden with rtas routines later... */
512 ppc_md.set_rtc_time = chrp_set_rtc_time; 512 ppc_md.set_rtc_time = chrp_set_rtc_time;
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 36a0f97bb7b1..78df2e7ca88a 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -167,24 +167,3 @@ void chrp_get_rtc_time(struct rtc_time *tm)
167 tm->tm_mon = mon; 167 tm->tm_mon = mon;
168 tm->tm_year = year; 168 tm->tm_year = year;
169} 169}
170
171
172void __init chrp_calibrate_decr(void)
173{
174 struct device_node *cpu;
175 unsigned int freq, *fp;
176
177 /*
178 * The cpu node should have a timebase-frequency property
179 * to tell us the rate at which the decrementer counts.
180 */
181 freq = 16666000; /* hardcoded default */
182 cpu = find_type_devices("cpu");
183 if (cpu != 0) {
184 fp = (unsigned int *)
185 get_property(cpu, "timebase-frequency", NULL);
186 if (fp != 0)
187 freq = *fp;
188 }
189 ppc_tb_freq = freq;
190}
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 535c802b369f..87eb6bb7f0e7 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1052,8 +1052,7 @@ struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter)
1052} 1052}
1053EXPORT_SYMBOL_GPL(pmac_i2c_adapter_to_bus); 1053EXPORT_SYMBOL_GPL(pmac_i2c_adapter_to_bus);
1054 1054
1055extern int pmac_i2c_match_adapter(struct device_node *dev, 1055int pmac_i2c_match_adapter(struct device_node *dev, struct i2c_adapter *adapter)
1056 struct i2c_adapter *adapter)
1057{ 1056{
1058 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev); 1057 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev);
1059 1058
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f671ed253901..de3f30e6b333 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -136,14 +136,14 @@ static void __init fixup_bus_range(struct device_node *bridge)
136 |(((unsigned int)(off)) & 0xFCUL) \ 136 |(((unsigned int)(off)) & 0xFCUL) \
137 |1UL) 137 |1UL)
138 138
139static unsigned long macrisc_cfg_access(struct pci_controller* hose, 139static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose,
140 u8 bus, u8 dev_fn, u8 offset) 140 u8 bus, u8 dev_fn, u8 offset)
141{ 141{
142 unsigned int caddr; 142 unsigned int caddr;
143 143
144 if (bus == hose->first_busno) { 144 if (bus == hose->first_busno) {
145 if (dev_fn < (11 << 3)) 145 if (dev_fn < (11 << 3))
146 return 0; 146 return NULL;
147 caddr = MACRISC_CFA0(dev_fn, offset); 147 caddr = MACRISC_CFA0(dev_fn, offset);
148 } else 148 } else
149 caddr = MACRISC_CFA1(bus, dev_fn, offset); 149 caddr = MACRISC_CFA1(bus, dev_fn, offset);
@@ -154,14 +154,14 @@ static unsigned long macrisc_cfg_access(struct pci_controller* hose,
154 } while (in_le32(hose->cfg_addr) != caddr); 154 } while (in_le32(hose->cfg_addr) != caddr);
155 155
156 offset &= has_uninorth ? 0x07 : 0x03; 156 offset &= has_uninorth ? 0x07 : 0x03;
157 return ((unsigned long)hose->cfg_data) + offset; 157 return hose->cfg_data + offset;
158} 158}
159 159
160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
161 int offset, int len, u32 *val) 161 int offset, int len, u32 *val)
162{ 162{
163 struct pci_controller *hose; 163 struct pci_controller *hose;
164 unsigned long addr; 164 volatile void __iomem *addr;
165 165
166 hose = pci_bus_to_host(bus); 166 hose = pci_bus_to_host(bus);
167 if (hose == NULL) 167 if (hose == NULL)
@@ -177,13 +177,13 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
177 */ 177 */
178 switch (len) { 178 switch (len) {
179 case 1: 179 case 1:
180 *val = in_8((u8 *)addr); 180 *val = in_8(addr);
181 break; 181 break;
182 case 2: 182 case 2:
183 *val = in_le16((u16 *)addr); 183 *val = in_le16(addr);
184 break; 184 break;
185 default: 185 default:
186 *val = in_le32((u32 *)addr); 186 *val = in_le32(addr);
187 break; 187 break;
188 } 188 }
189 return PCIBIOS_SUCCESSFUL; 189 return PCIBIOS_SUCCESSFUL;
@@ -193,7 +193,7 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
193 int offset, int len, u32 val) 193 int offset, int len, u32 val)
194{ 194{
195 struct pci_controller *hose; 195 struct pci_controller *hose;
196 unsigned long addr; 196 volatile void __iomem *addr;
197 197
198 hose = pci_bus_to_host(bus); 198 hose = pci_bus_to_host(bus);
199 if (hose == NULL) 199 if (hose == NULL)
@@ -209,16 +209,16 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
209 */ 209 */
210 switch (len) { 210 switch (len) {
211 case 1: 211 case 1:
212 out_8((u8 *)addr, val); 212 out_8(addr, val);
213 (void) in_8((u8 *)addr); 213 (void) in_8(addr);
214 break; 214 break;
215 case 2: 215 case 2:
216 out_le16((u16 *)addr, val); 216 out_le16(addr, val);
217 (void) in_le16((u16 *)addr); 217 (void) in_le16(addr);
218 break; 218 break;
219 default: 219 default:
220 out_le32((u32 *)addr, val); 220 out_le32(addr, val);
221 (void) in_le32((u32 *)addr); 221 (void) in_le32(addr);
222 break; 222 break;
223 } 223 }
224 return PCIBIOS_SUCCESSFUL; 224 return PCIBIOS_SUCCESSFUL;
@@ -348,25 +348,23 @@ static int u3_ht_skip_device(struct pci_controller *hose,
348 + (((unsigned int)bus) << 16) \ 348 + (((unsigned int)bus) << 16) \
349 + 0x01000000UL) 349 + 0x01000000UL)
350 350
351static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 351static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose,
352 u8 bus, u8 devfn, u8 offset) 352 u8 bus, u8 devfn, u8 offset)
353{ 353{
354 if (bus == hose->first_busno) { 354 if (bus == hose->first_busno) {
355 /* For now, we don't self probe U3 HT bridge */ 355 /* For now, we don't self probe U3 HT bridge */
356 if (PCI_SLOT(devfn) == 0) 356 if (PCI_SLOT(devfn) == 0)
357 return 0; 357 return NULL;
358 return ((unsigned long)hose->cfg_data) + 358 return hose->cfg_data + U3_HT_CFA0(devfn, offset);
359 U3_HT_CFA0(devfn, offset);
360 } else 359 } else
361 return ((unsigned long)hose->cfg_data) + 360 return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
362 U3_HT_CFA1(bus, devfn, offset);
363} 361}
364 362
365static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 363static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
366 int offset, int len, u32 *val) 364 int offset, int len, u32 *val)
367{ 365{
368 struct pci_controller *hose; 366 struct pci_controller *hose;
369 unsigned long addr; 367 volatile void __iomem *addr;
370 368
371 hose = pci_bus_to_host(bus); 369 hose = pci_bus_to_host(bus);
372 if (hose == NULL) 370 if (hose == NULL)
@@ -400,13 +398,13 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
400 */ 398 */
401 switch (len) { 399 switch (len) {
402 case 1: 400 case 1:
403 *val = in_8((u8 *)addr); 401 *val = in_8(addr);
404 break; 402 break;
405 case 2: 403 case 2:
406 *val = in_le16((u16 *)addr); 404 *val = in_le16(addr);
407 break; 405 break;
408 default: 406 default:
409 *val = in_le32((u32 *)addr); 407 *val = in_le32(addr);
410 break; 408 break;
411 } 409 }
412 return PCIBIOS_SUCCESSFUL; 410 return PCIBIOS_SUCCESSFUL;
@@ -416,7 +414,7 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
416 int offset, int len, u32 val) 414 int offset, int len, u32 val)
417{ 415{
418 struct pci_controller *hose; 416 struct pci_controller *hose;
419 unsigned long addr; 417 volatile void __iomem *addr;
420 418
421 hose = pci_bus_to_host(bus); 419 hose = pci_bus_to_host(bus);
422 if (hose == NULL) 420 if (hose == NULL)
@@ -442,16 +440,16 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
442 */ 440 */
443 switch (len) { 441 switch (len) {
444 case 1: 442 case 1:
445 out_8((u8 *)addr, val); 443 out_8(addr, val);
446 (void) in_8((u8 *)addr); 444 (void) in_8(addr);
447 break; 445 break;
448 case 2: 446 case 2:
449 out_le16((u16 *)addr, val); 447 out_le16(addr, val);
450 (void) in_le16((u16 *)addr); 448 (void) in_le16(addr);
451 break; 449 break;
452 default: 450 default:
453 out_le32((u32 *)addr, val); 451 out_le32((u32 __iomem *)addr, val);
454 (void) in_le32((u32 *)addr); 452 (void) in_le32(addr);
455 break; 453 break;
456 } 454 }
457 return PCIBIOS_SUCCESSFUL; 455 return PCIBIOS_SUCCESSFUL;
@@ -476,7 +474,7 @@ static struct pci_ops u3_ht_pci_ops =
476 |(((unsigned int)(off)) & 0xfcU) \ 474 |(((unsigned int)(off)) & 0xfcU) \
477 |1UL) 475 |1UL)
478 476
479static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, 477static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose,
480 u8 bus, u8 dev_fn, int offset) 478 u8 bus, u8 dev_fn, int offset)
481{ 479{
482 unsigned int caddr; 480 unsigned int caddr;
@@ -492,14 +490,14 @@ static unsigned long u4_pcie_cfg_access(struct pci_controller* hose,
492 } while (in_le32(hose->cfg_addr) != caddr); 490 } while (in_le32(hose->cfg_addr) != caddr);
493 491
494 offset &= 0x03; 492 offset &= 0x03;
495 return ((unsigned long)hose->cfg_data) + offset; 493 return hose->cfg_data + offset;
496} 494}
497 495
498static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 496static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
499 int offset, int len, u32 *val) 497 int offset, int len, u32 *val)
500{ 498{
501 struct pci_controller *hose; 499 struct pci_controller *hose;
502 unsigned long addr; 500 volatile void __iomem *addr;
503 501
504 hose = pci_bus_to_host(bus); 502 hose = pci_bus_to_host(bus);
505 if (hose == NULL) 503 if (hose == NULL)
@@ -515,13 +513,13 @@ static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
515 */ 513 */
516 switch (len) { 514 switch (len) {
517 case 1: 515 case 1:
518 *val = in_8((u8 *)addr); 516 *val = in_8(addr);
519 break; 517 break;
520 case 2: 518 case 2:
521 *val = in_le16((u16 *)addr); 519 *val = in_le16(addr);
522 break; 520 break;
523 default: 521 default:
524 *val = in_le32((u32 *)addr); 522 *val = in_le32(addr);
525 break; 523 break;
526 } 524 }
527 return PCIBIOS_SUCCESSFUL; 525 return PCIBIOS_SUCCESSFUL;
@@ -531,7 +529,7 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
531 int offset, int len, u32 val) 529 int offset, int len, u32 val)
532{ 530{
533 struct pci_controller *hose; 531 struct pci_controller *hose;
534 unsigned long addr; 532 volatile void __iomem *addr;
535 533
536 hose = pci_bus_to_host(bus); 534 hose = pci_bus_to_host(bus);
537 if (hose == NULL) 535 if (hose == NULL)
@@ -547,16 +545,16 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
547 */ 545 */
548 switch (len) { 546 switch (len) {
549 case 1: 547 case 1:
550 out_8((u8 *)addr, val); 548 out_8(addr, val);
551 (void) in_8((u8 *)addr); 549 (void) in_8(addr);
552 break; 550 break;
553 case 2: 551 case 2:
554 out_le16((u16 *)addr, val); 552 out_le16(addr, val);
555 (void) in_le16((u16 *)addr); 553 (void) in_le16(addr);
556 break; 554 break;
557 default: 555 default:
558 out_le32((u32 *)addr, val); 556 out_le32(addr, val);
559 (void) in_le32((u32 *)addr); 557 (void) in_le32(addr);
560 break; 558 break;
561 } 559 }
562 return PCIBIOS_SUCCESSFUL; 560 return PCIBIOS_SUCCESSFUL;
@@ -773,8 +771,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
773 * the reg address cell, we shall fix that by killing struct 771 * the reg address cell, we shall fix that by killing struct
774 * reg_property and using some accessor functions instead 772 * reg_property and using some accessor functions instead
775 */ 773 */
776 hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 774 hose->cfg_data = ioremap(0xf2000000, 0x02000000);
777 0x02000000);
778 775
779 /* 776 /*
780 * /ht node doesn't expose a "ranges" property, so we "remove" 777 * /ht node doesn't expose a "ranges" property, so we "remove"
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 89c4c3636161..1955462f4082 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -82,8 +82,6 @@
82 82
83#undef SHOW_GATWICK_IRQS 83#undef SHOW_GATWICK_IRQS
84 84
85unsigned char drive_info;
86
87int ppc_override_l2cr = 0; 85int ppc_override_l2cr = 0;
88int ppc_override_l2cr_value; 86int ppc_override_l2cr_value;
89int has_l2cache = 0; 87int has_l2cache = 0;
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 6373372932ba..e3cbba49fd6e 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -333,7 +333,7 @@ void handle_eeh_events (struct eeh_event *event)
333 rc = eeh_reset_device(frozen_pdn, NULL); 333 rc = eeh_reset_device(frozen_pdn, NULL);
334 if (rc) 334 if (rc)
335 goto hard_fail; 335 goto hard_fail;
336 pci_walk_bus(frozen_bus, eeh_report_reset, 0); 336 pci_walk_bus(frozen_bus, eeh_report_reset, NULL);
337 } 337 }
338 338
339 /* If all devices reported they can proceed, the re-enable PIO */ 339 /* If all devices reported they can proceed, the re-enable PIO */
@@ -342,11 +342,11 @@ void handle_eeh_events (struct eeh_event *event)
342 rc = eeh_reset_device(frozen_pdn, NULL); 342 rc = eeh_reset_device(frozen_pdn, NULL);
343 if (rc) 343 if (rc)
344 goto hard_fail; 344 goto hard_fail;
345 pci_walk_bus(frozen_bus, eeh_report_reset, 0); 345 pci_walk_bus(frozen_bus, eeh_report_reset, NULL);
346 } 346 }
347 347
348 /* Tell all device drivers that they can resume operations */ 348 /* Tell all device drivers that they can resume operations */
349 pci_walk_bus(frozen_bus, eeh_report_resume, 0); 349 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
350 350
351 return; 351 return;
352 352
@@ -367,7 +367,7 @@ hard_fail:
367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);
368 368
369 /* Notify all devices that they're about to go down. */ 369 /* Notify all devices that they're about to go down. */
370 pci_walk_bus(frozen_bus, eeh_report_failure, 0); 370 pci_walk_bus(frozen_bus, eeh_report_failure, NULL);
371 371
372 /* Shut down the device drivers for good. */ 372 /* Shut down the device drivers for good. */
373 pcibios_remove_pci_devices(frozen_bus); 373 pcibios_remove_pci_devices(frozen_bus);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index da6cebaf72cd..9edeca83f434 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -585,7 +585,7 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
585static void pseries_kexec_cpu_down(int crash_shutdown, int secondary) 585static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
586{ 586{
587 /* Don't risk a hypervisor call if we're crashing */ 587 /* Don't risk a hypervisor call if we're crashing */
588 if (!crash_shutdown) { 588 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
589 unsigned long vpa = __pa(get_lppaca()); 589 unsigned long vpa = __pa(get_lppaca());
590 590
591 if (unregister_vpa(hard_smp_processor_id(), vpa)) { 591 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 977de9db8754..6298264efe36 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -59,7 +59,7 @@ static unsigned long dart_tablesize;
59static u32 *dart_vbase; 59static u32 *dart_vbase;
60 60
61/* Mapped base address for the dart */ 61/* Mapped base address for the dart */
62static unsigned int *__iomem dart; 62static unsigned int __iomem *dart;
63 63
64/* Dummy val that entries are set to when unused */ 64/* Dummy val that entries are set to when unused */
65static unsigned int dart_emptyval; 65static unsigned int dart_emptyval;
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index 3e6ca7f5843f..c1e89ad0684d 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -810,13 +810,16 @@ initial_mmu:
810 mtspr SPRN_MD_TWC, r9 810 mtspr SPRN_MD_TWC, r9
811 li r11, MI_BOOTINIT /* Create RPN for address 0 */ 811 li r11, MI_BOOTINIT /* Create RPN for address 0 */
812 addis r11, r11, 0x0080 /* Add 8M */ 812 addis r11, r11, 0x0080 /* Add 8M */
813 mtspr SPRN_MD_RPN, r8 813 mtspr SPRN_MD_RPN, r11
814
815 addi r10, r10, 0x0100
816 mtspr SPRN_MD_CTR, r10
814 817
815 addis r8, r8, 0x0080 /* Add 8M */ 818 addis r8, r8, 0x0080 /* Add 8M */
816 mtspr SPRN_MD_EPN, r8 819 mtspr SPRN_MD_EPN, r8
817 mtspr SPRN_MD_TWC, r9 820 mtspr SPRN_MD_TWC, r9
818 addis r11, r11, 0x0080 /* Add 8M */ 821 addis r11, r11, 0x0080 /* Add 8M */
819 mtspr SPRN_MD_RPN, r8 822 mtspr SPRN_MD_RPN, r11
820#endif 823#endif
821 824
822 /* Since the cache is enabled according to the information we 825 /* Since the cache is enabled according to the information we
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 3a6e4bcb3c53..15bd9b448a48 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -186,11 +186,15 @@ EXPORT_SYMBOL(flush_tlb_kernel_range);
186EXPORT_SYMBOL(flush_tlb_page); 186EXPORT_SYMBOL(flush_tlb_page);
187EXPORT_SYMBOL(_tlbie); 187EXPORT_SYMBOL(_tlbie);
188#ifdef CONFIG_ALTIVEC 188#ifdef CONFIG_ALTIVEC
189#ifndef CONFIG_SMP
189EXPORT_SYMBOL(last_task_used_altivec); 190EXPORT_SYMBOL(last_task_used_altivec);
191#endif
190EXPORT_SYMBOL(giveup_altivec); 192EXPORT_SYMBOL(giveup_altivec);
191#endif /* CONFIG_ALTIVEC */ 193#endif /* CONFIG_ALTIVEC */
192#ifdef CONFIG_SPE 194#ifdef CONFIG_SPE
195#ifndef CONFIG_SMP
193EXPORT_SYMBOL(last_task_used_spe); 196EXPORT_SYMBOL(last_task_used_spe);
197#endif
194EXPORT_SYMBOL(giveup_spe); 198EXPORT_SYMBOL(giveup_spe);
195#endif /* CONFIG_SPE */ 199#endif /* CONFIG_SPE */
196#ifdef CONFIG_SMP 200#ifdef CONFIG_SMP
diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
index 159b228eca1e..0ec53f049338 100644
--- a/arch/ppc/platforms/4xx/bamboo.c
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -332,8 +332,8 @@ bamboo_early_serial_map(void)
332 port.irq = 0; 332 port.irq = 0;
333 port.uartclk = clocks.uart0; 333 port.uartclk = clocks.uart0;
334 port.regshift = 0; 334 port.regshift = 0;
335 port.iotype = SERIAL_IO_MEM; 335 port.iotype = UPIO_MEM;
336 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 336 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
337 port.line = 0; 337 port.line = 0;
338 338
339 if (early_serial_setup(&port) != 0) { 339 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/bubinga.c b/arch/ppc/platforms/4xx/bubinga.c
index 8110f55668c5..ce48a4f08cbb 100644
--- a/arch/ppc/platforms/4xx/bubinga.c
+++ b/arch/ppc/platforms/4xx/bubinga.c
@@ -97,8 +97,8 @@ bubinga_early_serial_map(void)
97 port.irq = ACTING_UART0_INT; 97 port.irq = ACTING_UART0_INT;
98 port.uartclk = uart_clock; 98 port.uartclk = uart_clock;
99 port.regshift = 0; 99 port.regshift = 0;
100 port.iotype = SERIAL_IO_MEM; 100 port.iotype = UPIO_MEM;
101 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 101 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
102 port.line = 0; 102 port.line = 0;
103 103
104 if (early_serial_setup(&port) != 0) { 104 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
index 64ebae19cdbb..9a828b623417 100644
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -225,8 +225,8 @@ ebony_early_serial_map(void)
225 port.irq = 0; 225 port.irq = 0;
226 port.uartclk = clocks.uart0; 226 port.uartclk = clocks.uart0;
227 port.regshift = 0; 227 port.regshift = 0;
228 port.iotype = SERIAL_IO_MEM; 228 port.iotype = UPIO_MEM;
229 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 229 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
230 port.line = 0; 230 port.line = 0;
231 231
232 if (early_serial_setup(&port) != 0) { 232 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
index d810b736d9bf..21d29132aebd 100644
--- a/arch/ppc/platforms/4xx/luan.c
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -279,8 +279,8 @@ luan_early_serial_map(void)
279 port.irq = UART0_INT; 279 port.irq = UART0_INT;
280 port.uartclk = clocks.uart0; 280 port.uartclk = clocks.uart0;
281 port.regshift = 0; 281 port.regshift = 0;
282 port.iotype = SERIAL_IO_MEM; 282 port.iotype = UPIO_MEM;
283 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 283 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
284 port.line = 0; 284 port.line = 0;
285 285
286 if (early_serial_setup(&port) != 0) { 286 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index 73b2c98158f6..4f355b6acab2 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -248,8 +248,8 @@ ocotea_early_serial_map(void)
248 port.irq = UART0_INT; 248 port.irq = UART0_INT;
249 port.uartclk = clocks.uart0; 249 port.uartclk = clocks.uart0;
250 port.regshift = 0; 250 port.regshift = 0;
251 port.iotype = SERIAL_IO_MEM; 251 port.iotype = UPIO_MEM;
252 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 252 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
253 port.line = 0; 253 port.line = 0;
254 254
255 if (early_serial_setup(&port) != 0) { 255 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
index 0b1b77d986bf..e90d97f64f76 100644
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -95,8 +95,8 @@ ml300_early_serial_map(void)
95 port.irq = old_ports[i].irq; 95 port.irq = old_ports[i].irq;
96 port.uartclk = old_ports[i].baud_base * 16; 96 port.uartclk = old_ports[i].baud_base * 16;
97 port.regshift = old_ports[i].iomem_reg_shift; 97 port.regshift = old_ports[i].iomem_reg_shift;
98 port.iotype = SERIAL_IO_MEM; 98 port.iotype = UPIO_MEM;
99 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 99 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
100 port.line = i; 100 port.line = i;
101 101
102 if (early_serial_setup(&port) != 0) { 102 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c
index e60f4bd437ec..b065b8babcd3 100644
--- a/arch/ppc/platforms/4xx/yucca.c
+++ b/arch/ppc/platforms/4xx/yucca.c
@@ -305,8 +305,8 @@ yucca_early_serial_map(void)
305 port.irq = UART0_INT; 305 port.irq = UART0_INT;
306 port.uartclk = clocks.uart0; 306 port.uartclk = clocks.uart0;
307 port.regshift = 0; 307 port.regshift = 0;
308 port.iotype = SERIAL_IO_MEM; 308 port.iotype = UPIO_MEM;
309 port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 309 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
310 port.line = 0; 310 port.line = 0;
311 311
312 if (early_serial_setup(&port) != 0) { 312 if (early_serial_setup(&port) != 0) {
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index 012e1e652c03..1a659bbc1860 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -301,14 +301,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
301 struct uart_port p; 301 struct uart_port p;
302 302
303 memset(&p, 0, sizeof (p)); 303 memset(&p, 0, sizeof (p));
304 p.iotype = SERIAL_IO_MEM; 304 p.iotype = UPIO_MEM;
305 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4500); 305 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4500);
306 p.uartclk = binfo->bi_busfreq; 306 p.uartclk = binfo->bi_busfreq;
307 307
308 gen550_init(0, &p); 308 gen550_init(0, &p);
309 309
310 memset(&p, 0, sizeof (p)); 310 memset(&p, 0, sizeof (p));
311 p.iotype = SERIAL_IO_MEM; 311 p.iotype = UPIO_MEM;
312 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4600); 312 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4600);
313 p.uartclk = binfo->bi_busfreq; 313 p.uartclk = binfo->bi_busfreq;
314 314
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index 2eceb1e6f4eb..408d64f18e1a 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -162,14 +162,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
162 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 162 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
163 163
164 memset(&p, 0, sizeof (p)); 164 memset(&p, 0, sizeof (p));
165 p.iotype = SERIAL_IO_MEM; 165 p.iotype = UPIO_MEM;
166 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 166 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
167 p.uartclk = binfo->bi_busfreq; 167 p.uartclk = binfo->bi_busfreq;
168 168
169 gen550_init(0, &p); 169 gen550_init(0, &p);
170 170
171 memset(&p, 0, sizeof (p)); 171 memset(&p, 0, sizeof (p));
172 p.iotype = SERIAL_IO_MEM; 172 p.iotype = UPIO_MEM;
173 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 173 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
174 p.uartclk = binfo->bi_busfreq; 174 p.uartclk = binfo->bi_busfreq;
175 175
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index b332ebae6bd3..1801ab392e22 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -534,14 +534,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
534 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 534 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
535 535
536 memset(&p, 0, sizeof (p)); 536 memset(&p, 0, sizeof (p));
537 p.iotype = SERIAL_IO_MEM; 537 p.iotype = UPIO_MEM;
538 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 538 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
539 p.uartclk = binfo->bi_busfreq; 539 p.uartclk = binfo->bi_busfreq;
540 540
541 gen550_init(0, &p); 541 gen550_init(0, &p);
542 542
543 memset(&p, 0, sizeof (p)); 543 memset(&p, 0, sizeof (p));
544 p.iotype = SERIAL_IO_MEM; 544 p.iotype = UPIO_MEM;
545 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 545 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
546 p.uartclk = binfo->bi_busfreq; 546 p.uartclk = binfo->bi_busfreq;
547 547
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index e777ba824aa9..8a72221f816c 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -64,7 +64,7 @@ sbc8560_early_serial_map(void)
64 uart_req.irq = MPC85xx_IRQ_EXT9; 64 uart_req.irq = MPC85xx_IRQ_EXT9;
65 uart_req.flags = STD_COM_FLAGS; 65 uart_req.flags = STD_COM_FLAGS;
66 uart_req.uartclk = BASE_BAUD * 16; 66 uart_req.uartclk = BASE_BAUD * 16;
67 uart_req.iotype = SERIAL_IO_MEM; 67 uart_req.iotype = UPIO_MEM;
68 uart_req.mapbase = UARTA_ADDR; 68 uart_req.mapbase = UARTA_ADDR;
69 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART0_SIZE); 69 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART0_SIZE);
70 uart_req.type = PORT_16650; 70 uart_req.type = PORT_16650;
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
index b436f4d0a3fa..a5e38ba62732 100644
--- a/arch/ppc/platforms/85xx/tqm85xx.c
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -346,14 +346,14 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
346 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 346 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
347 347
348 memset(&p, 0, sizeof (p)); 348 memset(&p, 0, sizeof (p));
349 p.iotype = SERIAL_IO_MEM; 349 p.iotype = UPIO_MEM;
350 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 350 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
351 p.uartclk = binfo->bi_busfreq; 351 p.uartclk = binfo->bi_busfreq;
352 352
353 gen550_init(0, &p); 353 gen550_init(0, &p);
354 354
355 memset(&p, 0, sizeof (p)); 355 memset(&p, 0, sizeof (p));
356 p.iotype = SERIAL_IO_MEM; 356 p.iotype = UPIO_MEM;
357 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 357 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
358 p.uartclk = binfo->bi_busfreq; 358 p.uartclk = binfo->bi_busfreq;
359 359
diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
index 48a4a510d598..aefcc0e7be57 100644
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -116,7 +116,7 @@ chestnut_early_serial_map(void)
116 port.uartclk = BASE_BAUD * 16; 116 port.uartclk = BASE_BAUD * 16;
117 port.irq = UART0_INT; 117 port.irq = UART0_INT;
118 port.flags = STD_COM_FLAGS | UPF_IOREMAP; 118 port.flags = STD_COM_FLAGS | UPF_IOREMAP;
119 port.iotype = SERIAL_IO_MEM; 119 port.iotype = UPIO_MEM;
120 port.mapbase = CHESTNUT_UART0_IO_BASE; 120 port.mapbase = CHESTNUT_UART0_IO_BASE;
121 port.regshift = 0; 121 port.regshift = 0;
122 122
diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c
index 32358b3fb236..ffde8f6f6302 100644
--- a/arch/ppc/platforms/ev64260.c
+++ b/arch/ppc/platforms/ev64260.c
@@ -330,7 +330,7 @@ ev64260_early_serial_map(void)
330 port.irq = EV64260_UART_0_IRQ; 330 port.irq = EV64260_UART_0_IRQ;
331 port.uartclk = BASE_BAUD * 16; 331 port.uartclk = BASE_BAUD * 16;
332 port.regshift = 2; 332 port.regshift = 2;
333 port.iotype = SERIAL_IO_MEM; 333 port.iotype = UPIO_MEM;
334 port.flags = STD_COM_FLAGS; 334 port.flags = STD_COM_FLAGS;
335 335
336#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 336#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
index 708b8739ecdd..872c0a3ba3c7 100644
--- a/arch/ppc/platforms/radstone_ppc7d.c
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -100,7 +100,7 @@ static void __init ppc7d_early_serial_map(void)
100 serial_req.uartclk = UART_CLK; 100 serial_req.uartclk = UART_CLK;
101 serial_req.irq = 4; 101 serial_req.irq = 4;
102 serial_req.flags = STD_COM_FLAGS; 102 serial_req.flags = STD_COM_FLAGS;
103 serial_req.iotype = SERIAL_IO_MEM; 103 serial_req.iotype = UPIO_MEM;
104 serial_req.membase = (u_char *) PPC7D_SERIAL_0; 104 serial_req.membase = (u_char *) PPC7D_SERIAL_0;
105 105
106 gen550_init(0, &serial_req); 106 gen550_init(0, &serial_req);
diff --git a/arch/ppc/platforms/spruce.c b/arch/ppc/platforms/spruce.c
index 5ad70d357cb9..69e1de7971f2 100644
--- a/arch/ppc/platforms/spruce.c
+++ b/arch/ppc/platforms/spruce.c
@@ -176,8 +176,8 @@ spruce_early_serial_map(void)
176 memset(&serial_req, 0, sizeof(serial_req)); 176 memset(&serial_req, 0, sizeof(serial_req));
177 serial_req.uartclk = uart_clk; 177 serial_req.uartclk = uart_clk;
178 serial_req.irq = UART0_INT; 178 serial_req.irq = UART0_INT;
179 serial_req.flags = ASYNC_BOOT_AUTOCONF; 179 serial_req.flags = UPF_BOOT_AUTOCONF;
180 serial_req.iotype = SERIAL_IO_MEM; 180 serial_req.iotype = UPIO_MEM;
181 serial_req.membase = (u_char *)UART0_IO_BASE; 181 serial_req.membase = (u_char *)UART0_IO_BASE;
182 serial_req.regshift = 0; 182 serial_req.regshift = 0;
183 183
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
index ab34b1d6072f..2fe28ded2c60 100644
--- a/arch/ppc/syslib/ocp.c
+++ b/arch/ppc/syslib/ocp.c
@@ -189,8 +189,8 @@ ocp_device_resume(struct device *dev)
189struct bus_type ocp_bus_type = { 189struct bus_type ocp_bus_type = {
190 .name = "ocp", 190 .name = "ocp",
191 .match = ocp_device_match, 191 .match = ocp_device_match,
192 .probe = ocp_driver_probe, 192 .probe = ocp_device_probe,
193 .remove = ocp_driver_remove, 193 .remove = ocp_device_remove,
194 .suspend = ocp_device_suspend, 194 .suspend = ocp_device_suspend,
195 .resume = ocp_device_resume, 195 .resume = ocp_device_resume,
196}; 196};
diff --git a/arch/ppc/syslib/ppc83xx_setup.c b/arch/ppc/syslib/ppc83xx_setup.c
index 1b5fe9e398d4..7bada82527a8 100644
--- a/arch/ppc/syslib/ppc83xx_setup.c
+++ b/arch/ppc/syslib/ppc83xx_setup.c
@@ -108,7 +108,7 @@ mpc83xx_early_serial_map(void)
108 108
109#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 109#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
110 memset(&serial_req, 0, sizeof (serial_req)); 110 memset(&serial_req, 0, sizeof (serial_req));
111 serial_req.iotype = SERIAL_IO_MEM; 111 serial_req.iotype = UPIO_MEM;
112 serial_req.mapbase = pdata[0].mapbase; 112 serial_req.mapbase = pdata[0].mapbase;
113 serial_req.membase = pdata[0].membase; 113 serial_req.membase = pdata[0].membase;
114 serial_req.regshift = 0; 114 serial_req.regshift = 0;
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
index 1a47ff4b831d..e4dda43fdaa7 100644
--- a/arch/ppc/syslib/ppc85xx_setup.c
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -90,7 +90,7 @@ mpc85xx_early_serial_map(void)
90 90
91#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 91#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
92 memset(&serial_req, 0, sizeof (serial_req)); 92 memset(&serial_req, 0, sizeof (serial_req));
93 serial_req.iotype = SERIAL_IO_MEM; 93 serial_req.iotype = UPIO_MEM;
94 serial_req.mapbase = pdata[0].mapbase; 94 serial_req.mapbase = pdata[0].mapbase;
95 serial_req.membase = pdata[0].membase; 95 serial_req.membase = pdata[0].membase;
96 serial_req.regshift = 0; 96 serial_req.regshift = 0;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index bf9a7a361b34..cc20f0e3a7d3 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -100,12 +100,12 @@
100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
102 102
103asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) 103asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
104{ 104{
105 return sys_chown(filename, low2highuid(user), low2highgid(group)); 105 return sys_chown(filename, low2highuid(user), low2highgid(group));
106} 106}
107 107
108asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) 108asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
109{ 109{
110 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 110 return sys_lchown(filename, low2highuid(user), low2highgid(group));
111} 111}
@@ -141,7 +141,7 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
141 low2highuid(suid)); 141 low2highuid(suid));
142} 142}
143 143
144asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) 144asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
145{ 145{
146 int retval; 146 int retval;
147 147
@@ -158,7 +158,7 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
158 low2highgid(sgid)); 158 low2highgid(sgid));
159} 159}
160 160
161asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) 161asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
162{ 162{
163 int retval; 163 int retval;
164 164
@@ -179,7 +179,7 @@ asmlinkage long sys32_setfsgid16(u16 gid)
179 return sys_setfsgid((gid_t)gid); 179 return sys_setfsgid((gid_t)gid);
180} 180}
181 181
182static int groups16_to_user(u16 *grouplist, struct group_info *group_info) 182static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
183{ 183{
184 int i; 184 int i;
185 u16 group; 185 u16 group;
@@ -193,7 +193,7 @@ static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
193 return 0; 193 return 0;
194} 194}
195 195
196static int groups16_from_user(struct group_info *group_info, u16 *grouplist) 196static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
197{ 197{
198 int i; 198 int i;
199 u16 group; 199 u16 group;
@@ -207,7 +207,7 @@ static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
207 return 0; 207 return 0;
208} 208}
209 209
210asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) 210asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
211{ 211{
212 int i; 212 int i;
213 213
@@ -231,7 +231,7 @@ out:
231 return i; 231 return i;
232} 232}
233 233
234asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) 234asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
235{ 235{
236 struct group_info *group_info; 236 struct group_info *group_info;
237 int retval; 237 int retval;
@@ -278,14 +278,14 @@ asmlinkage long sys32_getegid16(void)
278 278
279/* 32-bit timeval and related flotsam. */ 279/* 32-bit timeval and related flotsam. */
280 280
281static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
282{ 282{
283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) || 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
284 (__get_user(o->tv_sec, &i->tv_sec) || 284 (__get_user(o->tv_sec, &i->tv_sec) ||
285 __get_user(o->tv_usec, &i->tv_usec))); 285 __get_user(o->tv_usec, &i->tv_usec)));
286} 286}
287 287
288static inline long put_tv32(struct compat_timeval *o, struct timeval *i) 288static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
289{ 289{
290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
291 (__put_user(i->tv_sec, &o->tv_sec) || 291 (__put_user(i->tv_sec, &o->tv_sec) ||
@@ -341,7 +341,7 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
341 return -ENOSYS; 341 return -ENOSYS;
342} 342}
343 343
344asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low) 344asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
345{ 345{
346 if ((int)high < 0) 346 if ((int)high < 0)
347 return -EINVAL; 347 return -EINVAL;
@@ -357,7 +357,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
357 return sys_ftruncate(fd, (high << 32) | low); 357 return sys_ftruncate(fd, (high << 32) | low);
358} 358}
359 359
360int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 360int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
361{ 361{
362 int err; 362 int err;
363 363
@@ -591,7 +591,7 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
591 591
592extern struct timezone sys_tz; 592extern struct timezone sys_tz;
593 593
594asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 594asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
595{ 595{
596 if (tv) { 596 if (tv) {
597 struct timeval ktv; 597 struct timeval ktv;
@@ -606,7 +606,7 @@ asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *t
606 return 0; 606 return 0;
607} 607}
608 608
609static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 609static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
610{ 610{
611 long usec; 611 long usec;
612 612
@@ -620,7 +620,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
620 return 0; 620 return 0;
621} 621}
622 622
623asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 623asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
624{ 624{
625 struct timespec kts; 625 struct timespec kts;
626 struct timezone ktz; 626 struct timezone ktz;
@@ -645,7 +645,7 @@ asmlinkage long sys32_pause(void)
645 return -ERESTARTNOHAND; 645 return -ERESTARTNOHAND;
646} 646}
647 647
648asmlinkage long sys32_pread64(unsigned int fd, char *ubuf, 648asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
649 size_t count, u32 poshi, u32 poslo) 649 size_t count, u32 poshi, u32 poslo)
650{ 650{
651 if ((compat_ssize_t) count < 0) 651 if ((compat_ssize_t) count < 0)
@@ -653,7 +653,7 @@ asmlinkage long sys32_pread64(unsigned int fd, char *ubuf,
653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
654} 654}
655 655
656asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf, 656asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
657 size_t count, u32 poshi, u32 poslo) 657 size_t count, u32 poshi, u32 poslo)
658{ 658{
659 if ((compat_ssize_t) count < 0) 659 if ((compat_ssize_t) count < 0)
@@ -666,7 +666,7 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
667} 667}
668 668
669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count) 669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
670{ 670{
671 mm_segment_t old_fs = get_fs(); 671 mm_segment_t old_fs = get_fs();
672 int ret; 672 int ret;
@@ -686,7 +686,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
686} 686}
687 687
688asmlinkage long sys32_sendfile64(int out_fd, int in_fd, 688asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
689 compat_loff_t *offset, s32 count) 689 compat_loff_t __user *offset, s32 count)
690{ 690{
691 mm_segment_t old_fs = get_fs(); 691 mm_segment_t old_fs = get_fs();
692 int ret; 692 int ret;
@@ -722,7 +722,7 @@ struct timex32 {
722 722
723extern int do_adjtimex(struct timex *); 723extern int do_adjtimex(struct timex *);
724 724
725asmlinkage long sys32_adjtimex(struct timex32 *utp) 725asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
726{ 726{
727 struct timex txc; 727 struct timex txc;
728 int ret; 728 int ret;
@@ -789,12 +789,13 @@ struct __sysctl_args32 {
789 u32 __unused[4]; 789 u32 __unused[4];
790}; 790};
791 791
792asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) 792asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
793{ 793{
794 struct __sysctl_args32 tmp; 794 struct __sysctl_args32 tmp;
795 int error; 795 int error;
796 size_t oldlen, *oldlenp = NULL; 796 size_t oldlen;
797 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 797 size_t __user *oldlenp = NULL;
798 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
798 799
799 if (copy_from_user(&tmp, args, sizeof(tmp))) 800 if (copy_from_user(&tmp, args, sizeof(tmp)))
800 return -EFAULT; 801 return -EFAULT;
@@ -806,20 +807,20 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
806 basically copy the whole sysctl.c here, and 807 basically copy the whole sysctl.c here, and
807 glibc's __sysctl uses rw memory for the structure 808 glibc's __sysctl uses rw memory for the structure
808 anyway. */ 809 anyway. */
809 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 810 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
810 put_user(oldlen, (size_t *)addr)) 811 put_user(oldlen, (size_t __user *)addr))
811 return -EFAULT; 812 return -EFAULT;
812 oldlenp = (size_t *)addr; 813 oldlenp = (size_t __user *)addr;
813 } 814 }
814 815
815 lock_kernel(); 816 lock_kernel();
816 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 817 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
817 oldlenp, (void *)A(tmp.newval), tmp.newlen); 818 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
818 unlock_kernel(); 819 unlock_kernel();
819 if (oldlenp) { 820 if (oldlenp) {
820 if (!error) { 821 if (!error) {
821 if (get_user(oldlen, (size_t *)addr) || 822 if (get_user(oldlen, (size_t __user *)addr) ||
822 put_user(oldlen, (u32 *)A(tmp.oldlenp))) 823 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
823 error = -EFAULT; 824 error = -EFAULT;
824 } 825 }
825 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 826 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -853,7 +854,7 @@ struct stat64_emu31 {
853 unsigned long st_ino; 854 unsigned long st_ino;
854}; 855};
855 856
856static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat) 857static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
857{ 858{
858 struct stat64_emu31 tmp; 859 struct stat64_emu31 tmp;
859 860
@@ -877,7 +878,7 @@ static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat)
877 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 878 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
878} 879}
879 880
880asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf) 881asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf)
881{ 882{
882 struct kstat stat; 883 struct kstat stat;
883 int ret = vfs_stat(filename, &stat); 884 int ret = vfs_stat(filename, &stat);
@@ -886,7 +887,7 @@ asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf)
886 return ret; 887 return ret;
887} 888}
888 889
889asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf) 890asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf)
890{ 891{
891 struct kstat stat; 892 struct kstat stat;
892 int ret = vfs_lstat(filename, &stat); 893 int ret = vfs_lstat(filename, &stat);
@@ -895,7 +896,7 @@ asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf)
895 return ret; 896 return ret;
896} 897}
897 898
898asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf) 899asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf)
899{ 900{
900 struct kstat stat; 901 struct kstat stat;
901 int ret = vfs_fstat(fd, &stat); 902 int ret = vfs_fstat(fd, &stat);
@@ -952,7 +953,7 @@ out:
952 953
953 954
954asmlinkage unsigned long 955asmlinkage unsigned long
955old32_mmap(struct mmap_arg_struct_emu31 *arg) 956old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
956{ 957{
957 struct mmap_arg_struct_emu31 a; 958 struct mmap_arg_struct_emu31 a;
958 int error = -EFAULT; 959 int error = -EFAULT;
@@ -970,7 +971,7 @@ out:
970} 971}
971 972
972asmlinkage long 973asmlinkage long
973sys32_mmap2(struct mmap_arg_struct_emu31 *arg) 974sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
974{ 975{
975 struct mmap_arg_struct_emu31 a; 976 struct mmap_arg_struct_emu31 a;
976 int error = -EFAULT; 977 int error = -EFAULT;
@@ -982,7 +983,7 @@ out:
982 return error; 983 return error;
983} 984}
984 985
985asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count) 986asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
986{ 987{
987 if ((compat_ssize_t) count < 0) 988 if ((compat_ssize_t) count < 0)
988 return -EINVAL; 989 return -EINVAL;
@@ -990,7 +991,7 @@ asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count)
990 return sys_read(fd, buf, count); 991 return sys_read(fd, buf, count);
991} 992}
992 993
993asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count) 994asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
994{ 995{
995 if ((compat_ssize_t) count < 0) 996 if ((compat_ssize_t) count < 0)
996 return -EINVAL; 997 return -EINVAL;
@@ -1002,12 +1003,12 @@ asmlinkage long sys32_clone(struct pt_regs regs)
1002{ 1003{
1003 unsigned long clone_flags; 1004 unsigned long clone_flags;
1004 unsigned long newsp; 1005 unsigned long newsp;
1005 int *parent_tidptr, *child_tidptr; 1006 int __user *parent_tidptr, *child_tidptr;
1006 1007
1007 clone_flags = regs.gprs[3] & 0xffffffffUL; 1008 clone_flags = regs.gprs[3] & 0xffffffffUL;
1008 newsp = regs.orig_gpr2 & 0x7fffffffUL; 1009 newsp = regs.orig_gpr2 & 0x7fffffffUL;
1009 parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); 1010 parent_tidptr = compat_ptr(regs.gprs[4]);
1010 child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); 1011 child_tidptr = compat_ptr(regs.gprs[5]);
1011 if (!newsp) 1012 if (!newsp)
1012 newsp = regs.gprs[15]; 1013 newsp = regs.gprs[15];
1013 return do_fork(clone_flags, newsp, &regs, 0, 1014 return do_fork(clone_flags, newsp, &regs, 0,
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 6a63553493c5..e351780bb660 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -122,8 +122,8 @@ out:
122#ifndef CONFIG_64BIT 122#ifndef CONFIG_64BIT
123struct sel_arg_struct { 123struct sel_arg_struct {
124 unsigned long n; 124 unsigned long n;
125 fd_set *inp, *outp, *exp; 125 fd_set __user *inp, *outp, *exp;
126 struct timeval *tvp; 126 struct timeval __user *tvp;
127}; 127};
128 128
129asmlinkage long old_select(struct sel_arg_struct __user *arg) 129asmlinkage long old_select(struct sel_arg_struct __user *arg)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5d21e9e6e7b4..a46793beeddd 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -486,7 +486,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
486 info.si_signo = signal; 486 info.si_signo = signal;
487 info.si_errno = 0; 487 info.si_errno = 0;
488 info.si_code = ILL_ILLOPC; 488 info.si_code = ILL_ILLOPC;
489 info.si_addr = (void *) location; 489 info.si_addr = (void __user *) location;
490 do_trap(interruption_code, signal, 490 do_trap(interruption_code, signal,
491 "illegal operation", regs, &info); 491 "illegal operation", regs, &info);
492 } 492 }
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 2d5cb1385753..b075ab499d05 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -42,8 +42,8 @@ static volatile long cmm_timed_pages_target = 0;
42static long cmm_timeout_pages = 0; 42static long cmm_timeout_pages = 0;
43static long cmm_timeout_seconds = 0; 43static long cmm_timeout_seconds = 0;
44 44
45static struct cmm_page_array *cmm_page_list = 0; 45static struct cmm_page_array *cmm_page_list = NULL;
46static struct cmm_page_array *cmm_timed_page_list = 0; 46static struct cmm_page_array *cmm_timed_page_list = NULL;
47 47
48static unsigned long cmm_thread_active = 0; 48static unsigned long cmm_thread_active = 0;
49static struct work_struct cmm_thread_starter; 49static struct work_struct cmm_thread_starter;
@@ -259,7 +259,7 @@ static struct ctl_table cmm_table[];
259 259
260static int 260static int
261cmm_pages_handler(ctl_table *ctl, int write, struct file *filp, 261cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
262 void *buffer, size_t *lenp, loff_t *ppos) 262 void __user *buffer, size_t *lenp, loff_t *ppos)
263{ 263{
264 char buf[16], *p; 264 char buf[16], *p;
265 long pages; 265 long pages;
@@ -300,7 +300,7 @@ cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
300 300
301static int 301static int
302cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp, 302cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
303 void *buffer, size_t *lenp, loff_t *ppos) 303 void __user *buffer, size_t *lenp, loff_t *ppos)
304{ 304{
305 char buf[64], *p; 305 char buf[64], *p;
306 long pages, seconds; 306 long pages, seconds;
@@ -419,7 +419,7 @@ cmm_init (void)
419#ifdef CONFIG_CMM_IUCV 419#ifdef CONFIG_CMM_IUCV
420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); 420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target);
421#endif 421#endif
422 INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, 0); 422 INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, NULL);
423 init_waitqueue_head(&cmm_thread_wait); 423 init_waitqueue_head(&cmm_thread_wait);
424 init_timer(&cmm_timer); 424 init_timer(&cmm_timer);
425 return 0; 425 return 0;
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c
index c46f9154cfd5..123abbbc91e0 100644
--- a/arch/sh/boards/renesas/rts7751r2d/io.c
+++ b/arch/sh/boards/renesas/rts7751r2d/io.c
@@ -216,24 +216,26 @@ void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count)
216{ 216{
217 volatile __u8 *bp; 217 volatile __u8 *bp;
218 volatile __u16 *p; 218 volatile __u16 *p;
219 unsigned char *s = addr;
219 220
220 if (CHECK_AX88796L_PORT(port)) { 221 if (CHECK_AX88796L_PORT(port)) {
221 p = (volatile unsigned short *)port88796l(port, 0); 222 p = (volatile unsigned short *)port88796l(port, 0);
222 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 223 while (count--) *s++ = *p & 0xff;
223 } else if (PXSEG(port)) 224 } else if (PXSEG(port))
224 while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; 225 while (count--) *s++ = *(volatile unsigned char *)port;
225 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 226 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
226 bp = (__u8 *)PCI_IOMAP(port); 227 bp = (__u8 *)PCI_IOMAP(port);
227 while (count--) *((volatile unsigned char *) addr)++ = *bp; 228 while (count--) *s++ = *bp;
228 } else { 229 } else {
229 p = (volatile unsigned short *)port2adr(port); 230 p = (volatile unsigned short *)port2adr(port);
230 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 231 while (count--) *s++ = *p & 0xff;
231 } 232 }
232} 233}
233 234
234void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) 235void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
235{ 236{
236 volatile __u16 *p; 237 volatile __u16 *p;
238 __u16 *s = addr;
237 239
238 if (CHECK_AX88796L_PORT(port)) 240 if (CHECK_AX88796L_PORT(port))
239 p = (volatile unsigned short *)port88796l(port, 1); 241 p = (volatile unsigned short *)port88796l(port, 1);
@@ -243,7 +245,7 @@ void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
243 p = (volatile unsigned short *)PCI_IOMAP(port); 245 p = (volatile unsigned short *)PCI_IOMAP(port);
244 else 246 else
245 p = (volatile unsigned short *)port2adr(port); 247 p = (volatile unsigned short *)port2adr(port);
246 while (count--) *((__u16 *) addr)++ = *p; 248 while (count--) *s++ = *p;
247} 249}
248 250
249void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) 251void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
@@ -252,8 +254,9 @@ void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
252 maybebadio(insl, port); 254 maybebadio(insl, port);
253 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 255 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
254 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 256 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
257 __u32 *s = addr;
255 258
256 while (count--) *((__u32 *) addr)++ = *p; 259 while (count--) *s++ = *p;
257 } else 260 } else
258 maybebadio(insl, port); 261 maybebadio(insl, port);
259} 262}
@@ -262,24 +265,26 @@ void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count)
262{ 265{
263 volatile __u8 *bp; 266 volatile __u8 *bp;
264 volatile __u16 *p; 267 volatile __u16 *p;
268 const __u8 *s = addr;
265 269
266 if (CHECK_AX88796L_PORT(port)) { 270 if (CHECK_AX88796L_PORT(port)) {
267 p = (volatile unsigned short *)port88796l(port, 0); 271 p = (volatile unsigned short *)port88796l(port, 0);
268 while (count--) *p = *((unsigned char *) addr)++; 272 while (count--) *p = *s++;
269 } else if (PXSEG(port)) 273 } else if (PXSEG(port))
270 while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; 274 while (count--) *(volatile unsigned char *)port = *s++;
271 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 275 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
272 bp = (__u8 *)PCI_IOMAP(port); 276 bp = (__u8 *)PCI_IOMAP(port);
273 while (count--) *bp = *((volatile unsigned char *) addr)++; 277 while (count--) *bp = *s++;
274 } else { 278 } else {
275 p = (volatile unsigned short *)port2adr(port); 279 p = (volatile unsigned short *)port2adr(port);
276 while (count--) *p = *((unsigned char *) addr)++; 280 while (count--) *p = *s++;
277 } 281 }
278} 282}
279 283
280void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) 284void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
281{ 285{
282 volatile __u16 *p; 286 volatile __u16 *p;
287 const __u16 *s = addr;
283 288
284 if (CHECK_AX88796L_PORT(port)) 289 if (CHECK_AX88796L_PORT(port))
285 p = (volatile unsigned short *)port88796l(port, 1); 290 p = (volatile unsigned short *)port88796l(port, 1);
@@ -289,7 +294,7 @@ void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
289 p = (volatile unsigned short *)PCI_IOMAP(port); 294 p = (volatile unsigned short *)PCI_IOMAP(port);
290 else 295 else
291 p = (volatile unsigned short *)port2adr(port); 296 p = (volatile unsigned short *)port2adr(port);
292 while (count--) *p = *((__u16 *) addr)++; 297 while (count--) *p = *s++;
293} 298}
294 299
295void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) 300void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
@@ -298,8 +303,9 @@ void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
298 maybebadio(outsl, port); 303 maybebadio(outsl, port);
299 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 304 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
300 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 305 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
306 const __u32 *s = addr;
301 307
302 while (count--) *p = *((__u32 *) addr)++; 308 while (count--) *p = *s++;
303 } else 309 } else
304 maybebadio(outsl, port); 310 maybebadio(outsl, port);
305} 311}
diff --git a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c
index 472b450e61be..de29c45f23a7 100644
--- a/arch/sh64/kernel/sh_ksyms.c
+++ b/arch/sh64/kernel/sh_ksyms.c
@@ -31,14 +31,6 @@
31 31
32extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 32extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
33 33
34#if 0
35/* Not yet - there's no declaration of drive_info anywhere. */
36#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
37extern struct drive_info_struct drive_info;
38EXPORT_SYMBOL(drive_info);
39#endif
40#endif
41
42/* platform dependent support */ 34/* platform dependent support */
43EXPORT_SYMBOL(dump_fpu); 35EXPORT_SYMBOL(dump_fpu);
44EXPORT_SYMBOL(iounmap); 36EXPORT_SYMBOL(iounmap);
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 267ec8f6fb58..887f6a160c58 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -38,7 +38,7 @@
38 38
39#define curptr g6 39#define curptr g6
40 40
41#define NR_SYSCALLS 299 /* Each OS is different... */ 41#define NR_SYSCALLS 300 /* Each OS is different... */
42 42
43/* These are just handy. */ 43/* These are just handy. */
44#define _SV save %sp, -STACKFRAME_SZ, %sp 44#define _SV save %sp, -STACKFRAME_SZ, %sp
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index fbb05a452e51..118cac84a0f5 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -54,7 +54,7 @@ void (*pm_idle)(void);
54 * This is done via auxio, but could be used as a fallback 54 * This is done via auxio, but could be used as a fallback
55 * handler when auxio is not present-- unused for now... 55 * handler when auxio is not present-- unused for now...
56 */ 56 */
57void (*pm_power_off)(void); 57void (*pm_power_off)(void) = machine_power_off;
58 58
59/* 59/*
60 * sysctl - toggle power-off restriction for serial console 60 * sysctl - toggle power-off restriction for serial console
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index 6877ae4cd1d9..c0314705d73a 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -78,7 +78,7 @@ sys_call_table:
78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat 79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat
80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll 81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
82 82
83#ifdef CONFIG_SUNOS_EMUL 83#ifdef CONFIG_SUNOS_EMUL
84 /* Now the SunOS syscall table. */ 84 /* Now the SunOS syscall table. */
@@ -190,5 +190,6 @@ sunos_sys_table:
190/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys 190/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys
191 .long sunos_nosys, sunos_nosys, sunos_nosys 191 .long sunos_nosys, sunos_nosys, sunos_nosys
192 .long sunos_nosys, sunos_nosys, sunos_nosys 192 .long sunos_nosys, sunos_nosys, sunos_nosys
193 .long sunos_nosys
193 194
194#endif 195#endif
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index bc56a7d88308..069d49777b2a 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc2 3# Linux kernel version: 2.6.16-rc2
4# Sat Feb 4 02:31:38 2006 4# Tue Feb 7 17:47:18 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -30,7 +30,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
30# General setup 30# General setup
31# 31#
32CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 33# CONFIG_LOCALVERSION_AUTO is not set
34CONFIG_SWAP=y 34CONFIG_SWAP=y
35CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
36CONFIG_POSIX_MQUEUE=y 36CONFIG_POSIX_MQUEUE=y
@@ -766,6 +766,7 @@ CONFIG_HWMON=y
766# CONFIG_SENSORS_ASB100 is not set 766# CONFIG_SENSORS_ASB100 is not set
767# CONFIG_SENSORS_ATXP1 is not set 767# CONFIG_SENSORS_ATXP1 is not set
768# CONFIG_SENSORS_DS1621 is not set 768# CONFIG_SENSORS_DS1621 is not set
769# CONFIG_SENSORS_F71805F is not set
769# CONFIG_SENSORS_FSCHER is not set 770# CONFIG_SENSORS_FSCHER is not set
770# CONFIG_SENSORS_FSCPOS is not set 771# CONFIG_SENSORS_FSCPOS is not set
771# CONFIG_SENSORS_GL518SM is not set 772# CONFIG_SENSORS_GL518SM is not set
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 12911e7463f2..a73553ae7e53 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -25,7 +25,7 @@
25 25
26#define curptr g6 26#define curptr g6
27 27
28#define NR_SYSCALLS 299 /* Each OS is different... */ 28#define NR_SYSCALLS 300 /* Each OS is different... */
29 29
30 .text 30 .text
31 .align 32 31 .align 32
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 2881faf36635..a19168510be2 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -79,7 +79,7 @@ sys_call_table32:
79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat 79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat 80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat
81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll 82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
83 83
84#endif /* CONFIG_COMPAT */ 84#endif /* CONFIG_COMPAT */
85 85
@@ -146,9 +146,9 @@ sys_call_table:
146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat 149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat
150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll 151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
152 152
153#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 153#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
154 defined(CONFIG_SOLARIS_EMUL_MODULE) 154 defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -261,4 +261,5 @@ sunos_sys_table:
261/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys 261/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys
262 .word sunos_nosys, sunos_nosys, sunos_nosys 262 .word sunos_nosys, sunos_nosys, sunos_nosys
263 .word sunos_nosys, sunos_nosys, sunos_nosys 263 .word sunos_nosys, sunos_nosys, sunos_nosys
264 .word sunos_nosys
264#endif 265#endif
diff --git a/arch/sparc64/solaris/systbl.S b/arch/sparc64/solaris/systbl.S
index d25667eeae10..7043ca18caf9 100644
--- a/arch/sparc64/solaris/systbl.S
+++ b/arch/sparc64/solaris/systbl.S
@@ -283,32 +283,3 @@ solaris_sys_table:
283 .word solaris_unimplemented /* 253 */ 283 .word solaris_unimplemented /* 253 */
284 .word solaris_unimplemented /* 254 */ 284 .word solaris_unimplemented /* 254 */
285 .word solaris_unimplemented /* 255 */ 285 .word solaris_unimplemented /* 255 */
286 .word solaris_unimplemented /* 256 */
287 .word solaris_unimplemented /* 257 */
288 .word solaris_unimplemented /* 258 */
289 .word solaris_unimplemented /* 259 */
290 .word solaris_unimplemented /* 260 */
291 .word solaris_unimplemented /* 261 */
292 .word solaris_unimplemented /* 262 */
293 .word solaris_unimplemented /* 263 */
294 .word solaris_unimplemented /* 264 */
295 .word solaris_unimplemented /* 265 */
296 .word solaris_unimplemented /* 266 */
297 .word solaris_unimplemented /* 267 */
298 .word solaris_unimplemented /* 268 */
299 .word solaris_unimplemented /* 269 */
300 .word solaris_unimplemented /* 270 */
301 .word solaris_unimplemented /* 271 */
302 .word solaris_unimplemented /* 272 */
303 .word solaris_unimplemented /* 273 */
304 .word solaris_unimplemented /* 274 */
305 .word solaris_unimplemented /* 275 */
306 .word solaris_unimplemented /* 276 */
307 .word solaris_unimplemented /* 277 */
308 .word solaris_unimplemented /* 278 */
309 .word solaris_unimplemented /* 279 */
310 .word solaris_unimplemented /* 280 */
311 .word solaris_unimplemented /* 281 */
312 .word solaris_unimplemented /* 282 */
313 .word solaris_unimplemented /* 283 */
314
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 5d50d4a44abf..2f880cb167a5 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -9,6 +9,7 @@
9#include <termios.h> 9#include <termios.h>
10#include <string.h> 10#include <string.h>
11#include <signal.h> 11#include <signal.h>
12#include <sched.h>
12#include <sys/stat.h> 13#include <sys/stat.h>
13#include <sys/ioctl.h> 14#include <sys/ioctl.h>
14#include <sys/socket.h> 15#include <sys/socket.h>
@@ -73,7 +74,6 @@ static void winch_handler(int sig)
73struct winch_data { 74struct winch_data {
74 int pty_fd; 75 int pty_fd;
75 int pipe_fd; 76 int pipe_fd;
76 int close_me;
77}; 77};
78 78
79static int winch_thread(void *arg) 79static int winch_thread(void *arg)
@@ -84,7 +84,6 @@ static int winch_thread(void *arg)
84 int count, err; 84 int count, err;
85 char c = 1; 85 char c = 1;
86 86
87 os_close_file(data->close_me);
88 pty_fd = data->pty_fd; 87 pty_fd = data->pty_fd;
89 pipe_fd = data->pipe_fd; 88 pipe_fd = data->pipe_fd;
90 count = os_write_file(pipe_fd, &c, sizeof(c)); 89 count = os_write_file(pipe_fd, &c, sizeof(c));
@@ -153,15 +152,16 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
153 } 152 }
154 153
155 data = ((struct winch_data) { .pty_fd = fd, 154 data = ((struct winch_data) { .pty_fd = fd,
156 .pipe_fd = fds[1], 155 .pipe_fd = fds[1] } );
157 .close_me = fds[0] } ); 156 /* CLONE_FILES so this thread doesn't hold open files which are open
158 err = run_helper_thread(winch_thread, &data, 0, &stack, 0); 157 * now, but later closed. This is a problem with /dev/net/tun.
158 */
159 err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0);
159 if(err < 0){ 160 if(err < 0){
160 printk("fork of winch_thread failed - errno = %d\n", errno); 161 printk("fork of winch_thread failed - errno = %d\n", errno);
161 goto out_close; 162 goto out_close;
162 } 163 }
163 164
164 os_close_file(fds[1]);
165 *fd_out = fds[0]; 165 *fd_out = fds[0];
166 n = os_read_file(fds[0], &c, sizeof(c)); 166 n = os_read_file(fds[0], &c, sizeof(c));
167 if(n != sizeof(c)){ 167 if(n != sizeof(c)){
@@ -169,13 +169,12 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
169 printk("read failed, err = %d\n", -n); 169 printk("read failed, err = %d\n", -n);
170 printk("fd %d will not support SIGWINCH\n", fd); 170 printk("fd %d will not support SIGWINCH\n", fd);
171 err = -EINVAL; 171 err = -EINVAL;
172 goto out_close1; 172 goto out_close;
173 } 173 }
174 return err ; 174 return err ;
175 175
176 out_close: 176 out_close:
177 os_close_file(fds[1]); 177 os_close_file(fds[1]);
178 out_close1:
179 os_close_file(fds[0]); 178 os_close_file(fds[0]);
180 out: 179 out:
181 return err; 180 return err;
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 8ebb2241ad42..8c7279bb353b 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -131,9 +131,8 @@ static int uml_net_open(struct net_device *dev)
131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev); 131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev);
132 if(err != 0){ 132 if(err != 0){
133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); 133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
134 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
135 lp->fd = -1;
136 err = -ENETUNREACH; 134 err = -ENETUNREACH;
135 goto out_close;
137 } 136 }
138 137
139 lp->tl.data = (unsigned long) &lp->user; 138 lp->tl.data = (unsigned long) &lp->user;
@@ -145,9 +144,19 @@ static int uml_net_open(struct net_device *dev)
145 */ 144 */
146 while((err = uml_net_rx(dev)) > 0) ; 145 while((err = uml_net_rx(dev)) > 0) ;
147 146
148 out:
149 spin_unlock(&lp->lock); 147 spin_unlock(&lp->lock);
150 return(err); 148
149 spin_lock(&opened_lock);
150 list_add(&lp->list, &opened);
151 spin_unlock(&opened_lock);
152
153 return 0;
154out_close:
155 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
156 lp->fd = -1;
157out:
158 spin_unlock(&lp->lock);
159 return err;
151} 160}
152 161
153static int uml_net_close(struct net_device *dev) 162static int uml_net_close(struct net_device *dev)
@@ -161,9 +170,13 @@ static int uml_net_close(struct net_device *dev)
161 if(lp->close != NULL) 170 if(lp->close != NULL)
162 (*lp->close)(lp->fd, &lp->user); 171 (*lp->close)(lp->fd, &lp->user);
163 lp->fd = -1; 172 lp->fd = -1;
164 list_del(&lp->list);
165 173
166 spin_unlock(&lp->lock); 174 spin_unlock(&lp->lock);
175
176 spin_lock(&opened_lock);
177 list_del(&lp->list);
178 spin_unlock(&opened_lock);
179
167 return 0; 180 return 0;
168} 181}
169 182
@@ -410,11 +423,7 @@ static int eth_configure(int n, void *init, char *mac,
410 if (device->have_mac) 423 if (device->have_mac)
411 set_ether_mac(dev, device->mac); 424 set_ether_mac(dev, device->mac);
412 425
413 spin_lock(&opened_lock); 426 return 0;
414 list_add(&lp->list, &opened);
415 spin_unlock(&opened_lock);
416
417 return(0);
418} 427}
419 428
420static struct uml_net *find_device(int n) 429static struct uml_net *find_device(int n)
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index 4892e5fcef07..83b688ca198f 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -14,7 +14,7 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs);
14extern void save_registers(int pid, union uml_pt_regs *regs); 14extern void save_registers(int pid, union uml_pt_regs *regs);
15extern void restore_registers(int pid, union uml_pt_regs *regs); 15extern void restore_registers(int pid, union uml_pt_regs *regs);
16extern void init_registers(int pid); 16extern void init_registers(int pid);
17extern void get_safe_registers(unsigned long * regs); 17extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs);
18extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); 18extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer);
19 19
20#endif 20#endif
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
deleted file mode 100644
index eea1c9c4bb0f..000000000000
--- a/arch/um/kernel/skas/process.c
+++ /dev/null
@@ -1,569 +0,0 @@
1/*
2 * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h>
9#include <errno.h>
10#include <signal.h>
11#include <setjmp.h>
12#include <sched.h>
13#include <sys/wait.h>
14#include <sys/mman.h>
15#include <sys/user.h>
16#include <sys/time.h>
17#include <asm/unistd.h>
18#include <asm/types.h>
19#include "user.h"
20#include "ptrace_user.h"
21#include "sysdep/ptrace.h"
22#include "user_util.h"
23#include "kern_util.h"
24#include "skas.h"
25#include "stub-data.h"
26#include "mm_id.h"
27#include "sysdep/sigcontext.h"
28#include "sysdep/stub.h"
29#include "os.h"
30#include "proc_mm.h"
31#include "skas_ptrace.h"
32#include "chan_user.h"
33#include "registers.h"
34#include "mem.h"
35#include "uml-config.h"
36#include "process.h"
37
38int is_skas_winch(int pid, int fd, void *data)
39{
40 if(pid != os_getpgrp())
41 return(0);
42
43 register_winch_irq(-1, fd, -1, data);
44 return(1);
45}
46
47void wait_stub_done(int pid, int sig, char * fname)
48{
49 int n, status, err;
50
51 do {
52 if ( sig != -1 ) {
53 err = ptrace(PTRACE_CONT, pid, 0, sig);
54 if(err)
55 panic("%s : continue failed, errno = %d\n",
56 fname, errno);
57 }
58 sig = 0;
59
60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
61 } while((n >= 0) && WIFSTOPPED(status) &&
62 ((WSTOPSIG(status) == SIGVTALRM) ||
63 /* running UML inside a detached screen can cause
64 * SIGWINCHes
65 */
66 (WSTOPSIG(status) == SIGWINCH)));
67
68 if((n < 0) || !WIFSTOPPED(status) ||
69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
70 unsigned long regs[HOST_FRAME_SIZE];
71 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
72 printk("Failed to get registers from stub, "
73 "errno = %d\n", errno);
74 else {
75 int i;
76
77 printk("Stub registers -\n");
78 for(i = 0; i < HOST_FRAME_SIZE; i++)
79 printk("\t%d - %lx\n", i, regs[i]);
80 }
81 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
82 "pid = %d, n = %d, errno = %d, status = 0x%x\n",
83 fname, pid, n, errno, status);
84 }
85}
86
87void get_skas_faultinfo(int pid, struct faultinfo * fi)
88{
89 int err;
90
91 if(ptrace_faultinfo){
92 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi);
93 if(err)
94 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, "
95 "errno = %d\n", errno);
96
97 /* Special handling for i386, which has different structs */
98 if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo))
99 memset((char *)fi + sizeof(struct ptrace_faultinfo), 0,
100 sizeof(struct faultinfo) -
101 sizeof(struct ptrace_faultinfo));
102 }
103 else {
104 wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo");
105
106 /* faultinfo is prepared by the stub-segv-handler at start of
107 * the stub stack page. We just have to copy it.
108 */
109 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
110 }
111}
112
113static void handle_segv(int pid, union uml_pt_regs * regs)
114{
115 get_skas_faultinfo(pid, &regs->skas.faultinfo);
116 segv(regs->skas.faultinfo, 0, 1, NULL);
117}
118
119/*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/
120static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu)
121{
122 int err, status;
123
124 /* Mark this as a syscall */
125 UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs);
126
127 if (!local_using_sysemu)
128 {
129 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid);
130 if(err < 0)
131 panic("handle_trap - nullifying syscall failed errno = %d\n",
132 errno);
133
134 err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
135 if(err < 0)
136 panic("handle_trap - continuing to end of syscall failed, "
137 "errno = %d\n", errno);
138
139 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
140 if((err < 0) || !WIFSTOPPED(status) ||
141 (WSTOPSIG(status) != SIGTRAP + 0x80))
142 panic("handle_trap - failed to wait at end of syscall, "
143 "errno = %d, status = %d\n", errno, status);
144 }
145
146 handle_syscall(regs);
147}
148
149extern int __syscall_stub_start;
150int stub_code_fd = -1;
151__u64 stub_code_offset;
152
153static int userspace_tramp(void *stack)
154{
155 void *addr;
156
157 ptrace(PTRACE_TRACEME, 0, 0, 0);
158
159 init_new_thread_signals(1);
160 enable_timer();
161
162 if(!proc_mm){
163 /* This has a pte, but it can't be mapped in with the usual
164 * tlb_flush mechanism because this is part of that mechanism
165 */
166 addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(),
167 PROT_EXEC, MAP_FIXED | MAP_PRIVATE,
168 stub_code_fd, stub_code_offset);
169 if(addr == MAP_FAILED){
170 printk("mapping stub code failed, errno = %d\n",
171 errno);
172 exit(1);
173 }
174
175 if(stack != NULL){
176 int fd;
177 __u64 offset;
178
179 fd = phys_mapping(to_phys(stack), &offset);
180 addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(),
181 PROT_READ | PROT_WRITE,
182 MAP_FIXED | MAP_SHARED, fd, offset);
183 if(addr == MAP_FAILED){
184 printk("mapping stub stack failed, "
185 "errno = %d\n", errno);
186 exit(1);
187 }
188 }
189 }
190 if(!ptrace_faultinfo){
191 unsigned long v = UML_CONFIG_STUB_CODE +
192 (unsigned long) stub_segv_handler -
193 (unsigned long) &__syscall_stub_start;
194
195 set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size());
196 set_handler(SIGSEGV, (void *) v, SA_ONSTACK,
197 SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,
198 SIGUSR1, -1);
199 }
200
201 os_stop_process(os_getpid());
202 return(0);
203}
204
205/* Each element set once, and only accessed by a single processor anyway */
206#undef NR_CPUS
207#define NR_CPUS 1
208int userspace_pid[NR_CPUS];
209
210int start_userspace(unsigned long stub_stack)
211{
212 void *stack;
213 unsigned long sp;
214 int pid, status, n, flags;
215
216 if ( stub_code_fd == -1 )
217 stub_code_fd = phys_mapping(to_phys(&__syscall_stub_start),
218 &stub_code_offset);
219
220 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
221 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
222 if(stack == MAP_FAILED)
223 panic("start_userspace : mmap failed, errno = %d", errno);
224 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
225
226 flags = CLONE_FILES | SIGCHLD;
227 if(proc_mm) flags |= CLONE_VM;
228 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
229 if(pid < 0)
230 panic("start_userspace : clone failed, errno = %d", errno);
231
232 do {
233 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
234 if(n < 0)
235 panic("start_userspace : wait failed, errno = %d",
236 errno);
237 } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM));
238
239 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))
240 panic("start_userspace : expected SIGSTOP, got status = %d",
241 status);
242
243 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0)
244 panic("start_userspace : PTRACE_SETOPTIONS failed, errno=%d\n",
245 errno);
246
247 if(munmap(stack, PAGE_SIZE) < 0)
248 panic("start_userspace : munmap failed, errno = %d\n", errno);
249
250 return(pid);
251}
252
253void userspace(union uml_pt_regs *regs)
254{
255 int err, status, op, pid = userspace_pid[0];
256 int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/
257
258 while(1){
259 restore_registers(pid, regs);
260
261 /* Now we set local_using_sysemu to be used for one loop */
262 local_using_sysemu = get_using_sysemu();
263
264 op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL));
265
266 err = ptrace(op, pid, 0, 0);
267 if(err)
268 panic("userspace - could not resume userspace process, "
269 "pid=%d, ptrace operation = %d, errno = %d\n",
270 op, errno);
271
272 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
273 if(err < 0)
274 panic("userspace - waitpid failed, errno = %d\n",
275 errno);
276
277 regs->skas.is_user = 1;
278 save_registers(pid, regs);
279 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
280
281 if(WIFSTOPPED(status)){
282 switch(WSTOPSIG(status)){
283 case SIGSEGV:
284 if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo)
285 user_signal(SIGSEGV, regs, pid);
286 else handle_segv(pid, regs);
287 break;
288 case SIGTRAP + 0x80:
289 handle_trap(pid, regs, local_using_sysemu);
290 break;
291 case SIGTRAP:
292 relay_signal(SIGTRAP, regs);
293 break;
294 case SIGIO:
295 case SIGVTALRM:
296 case SIGILL:
297 case SIGBUS:
298 case SIGFPE:
299 case SIGWINCH:
300 user_signal(WSTOPSIG(status), regs, pid);
301 break;
302 default:
303 printk("userspace - child stopped with signal "
304 "%d\n", WSTOPSIG(status));
305 }
306 pid = userspace_pid[0];
307 interrupt_end();
308
309 /* Avoid -ERESTARTSYS handling in host */
310 PT_SYSCALL_NR(regs->skas.regs) = -1;
311 }
312 }
313}
314#define INIT_JMP_NEW_THREAD 0
315#define INIT_JMP_REMOVE_SIGSTACK 1
316#define INIT_JMP_CALLBACK 2
317#define INIT_JMP_HALT 3
318#define INIT_JMP_REBOOT 4
319
320
321int copy_context_skas0(unsigned long new_stack, int pid)
322{
323 int err;
324 unsigned long regs[MAX_REG_NR];
325 unsigned long current_stack = current_stub_stack();
326 struct stub_data *data = (struct stub_data *) current_stack;
327 struct stub_data *child_data = (struct stub_data *) new_stack;
328 __u64 new_offset;
329 int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);
330
331 /* prepare offset and fd of child's stack as argument for parent's
332 * and child's mmap2 calls
333 */
334 *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),
335 .fd = new_fd,
336 .timer = ((struct itimerval)
337 { { 0, 1000000 / hz() },
338 { 0, 1000000 / hz() }})});
339 get_safe_registers(regs);
340
341 /* Set parent's instruction pointer to start of clone-stub */
342 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
343 (unsigned long) stub_clone_handler -
344 (unsigned long) &__syscall_stub_start;
345 regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE -
346 sizeof(void *);
347 err = ptrace_setregs(pid, regs);
348 if(err < 0)
349 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
350 "pid = %d, errno = %d\n", pid, errno);
351
352 /* set a well known return code for detection of child write failure */
353 child_data->err = 12345678;
354
355 /* Wait, until parent has finished its work: read child's pid from
356 * parent's stack, and check, if bad result.
357 */
358 wait_stub_done(pid, 0, "copy_context_skas0");
359
360 pid = data->err;
361 if(pid < 0)
362 panic("copy_context_skas0 - stub-parent reports error %d\n",
363 pid);
364
365 /* Wait, until child has finished too: read child's result from
366 * child's stack and check it.
367 */
368 wait_stub_done(pid, -1, "copy_context_skas0");
369 if (child_data->err != UML_CONFIG_STUB_DATA)
370 panic("copy_context_skas0 - stub-child reports error %d\n",
371 child_data->err);
372
373 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
374 (void *)PTRACE_O_TRACESYSGOOD) < 0)
375 panic("copy_context_skas0 : PTRACE_SETOPTIONS failed, "
376 "errno = %d\n", errno);
377
378 return pid;
379}
380
381/*
382 * This is used only, if stub pages are needed, while proc_mm is
383 * availabl. Opening /proc/mm creates a new mm_context, which lacks
384 * the stub-pages. Thus, we map them using /proc/mm-fd
385 */
386void map_stub_pages(int fd, unsigned long code,
387 unsigned long data, unsigned long stack)
388{
389 struct proc_mm_op mmop;
390 int n;
391
392 mmop = ((struct proc_mm_op) { .op = MM_MMAP,
393 .u =
394 { .mmap =
395 { .addr = code,
396 .len = PAGE_SIZE,
397 .prot = PROT_EXEC,
398 .flags = MAP_FIXED | MAP_PRIVATE,
399 .fd = stub_code_fd,
400 .offset = stub_code_offset
401 } } });
402 n = os_write_file(fd, &mmop, sizeof(mmop));
403 if(n != sizeof(mmop))
404 panic("map_stub_pages : /proc/mm map for code failed, "
405 "err = %d\n", -n);
406
407 if ( stack ) {
408 __u64 map_offset;
409 int map_fd = phys_mapping(to_phys((void *)stack), &map_offset);
410 mmop = ((struct proc_mm_op)
411 { .op = MM_MMAP,
412 .u =
413 { .mmap =
414 { .addr = data,
415 .len = PAGE_SIZE,
416 .prot = PROT_READ | PROT_WRITE,
417 .flags = MAP_FIXED | MAP_SHARED,
418 .fd = map_fd,
419 .offset = map_offset
420 } } });
421 n = os_write_file(fd, &mmop, sizeof(mmop));
422 if(n != sizeof(mmop))
423 panic("map_stub_pages : /proc/mm map for data failed, "
424 "err = %d\n", -n);
425 }
426}
427
428void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
429 void (*handler)(int))
430{
431 unsigned long flags;
432 sigjmp_buf switch_buf, fork_buf;
433
434 *switch_buf_ptr = &switch_buf;
435 *fork_buf_ptr = &fork_buf;
436
437 /* Somewhat subtle - siglongjmp restores the signal mask before doing
438 * the longjmp. This means that when jumping from one stack to another
439 * when the target stack has interrupts enabled, an interrupt may occur
440 * on the source stack. This is bad when starting up a process because
441 * it's not supposed to get timer ticks until it has been scheduled.
442 * So, we disable interrupts around the sigsetjmp to ensure that
443 * they can't happen until we get back here where they are safe.
444 */
445 flags = get_signals();
446 block_signals();
447 if(sigsetjmp(fork_buf, 1) == 0)
448 new_thread_proc(stack, handler);
449
450 remove_sigstack();
451
452 set_signals(flags);
453}
454
455void thread_wait(void *sw, void *fb)
456{
457 sigjmp_buf buf, **switch_buf = sw, *fork_buf;
458
459 *switch_buf = &buf;
460 fork_buf = fb;
461 if(sigsetjmp(buf, 1) == 0)
462 siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);
463}
464
465void switch_threads(void *me, void *next)
466{
467 sigjmp_buf my_buf, **me_ptr = me, *next_buf = next;
468
469 *me_ptr = &my_buf;
470 if(sigsetjmp(my_buf, 1) == 0)
471 siglongjmp(*next_buf, 1);
472}
473
474static sigjmp_buf initial_jmpbuf;
475
476/* XXX Make these percpu */
477static void (*cb_proc)(void *arg);
478static void *cb_arg;
479static sigjmp_buf *cb_back;
480
481int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
482{
483 sigjmp_buf **switch_buf = switch_buf_ptr;
484 int n;
485
486 set_handler(SIGWINCH, (__sighandler_t) sig_handler,
487 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,
488 SIGVTALRM, -1);
489
490 *fork_buf_ptr = &initial_jmpbuf;
491 n = sigsetjmp(initial_jmpbuf, 1);
492 switch(n){
493 case INIT_JMP_NEW_THREAD:
494 new_thread_proc((void *) stack, new_thread_handler);
495 break;
496 case INIT_JMP_REMOVE_SIGSTACK:
497 remove_sigstack();
498 break;
499 case INIT_JMP_CALLBACK:
500 (*cb_proc)(cb_arg);
501 siglongjmp(*cb_back, 1);
502 break;
503 case INIT_JMP_HALT:
504 kmalloc_ok = 0;
505 return(0);
506 case INIT_JMP_REBOOT:
507 kmalloc_ok = 0;
508 return(1);
509 default:
510 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
511 }
512 siglongjmp(**switch_buf, 1);
513}
514
515void initial_thread_cb_skas(void (*proc)(void *), void *arg)
516{
517 sigjmp_buf here;
518
519 cb_proc = proc;
520 cb_arg = arg;
521 cb_back = &here;
522
523 block_signals();
524 if(sigsetjmp(here, 1) == 0)
525 siglongjmp(initial_jmpbuf, INIT_JMP_CALLBACK);
526 unblock_signals();
527
528 cb_proc = NULL;
529 cb_arg = NULL;
530 cb_back = NULL;
531}
532
533void halt_skas(void)
534{
535 block_signals();
536 siglongjmp(initial_jmpbuf, INIT_JMP_HALT);
537}
538
539void reboot_skas(void)
540{
541 block_signals();
542 siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT);
543}
544
545void switch_mm_skas(struct mm_id *mm_idp)
546{
547 int err;
548
549#warning need cpu pid in switch_mm_skas
550 if(proc_mm){
551 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0,
552 mm_idp->u.mm_fd);
553 if(err)
554 panic("switch_mm_skas - PTRACE_SWITCH_MM failed, "
555 "errno = %d\n", errno);
556 }
557 else userspace_pid[0] = mm_idp->u.pid;
558}
559
560/*
561 * Overrides for Emacs so that we follow Linus's tabbing style.
562 * Emacs will notice this stuff at the end of the file and automatically
563 * adjust the settings for this buffer only. This must remain at the end
564 * of the file.
565 * ---------------------------------------------------------------------------
566 * Local variables:
567 * c-file-style: "linux"
568 * End:
569 */
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index e2d3ca445ef5..27cdf9164422 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -193,6 +193,24 @@ __uml_setup("root=", uml_root_setup,
193" root=/dev/ubd5\n\n" 193" root=/dev/ubd5\n\n"
194); 194);
195 195
196#ifndef CONFIG_MODE_TT
197
198static int __init no_skas_debug_setup(char *line, int *add)
199{
200 printf("'debug' is not necessary to gdb UML in skas mode - run \n");
201 printf("'gdb linux' and disable CONFIG_CMDLINE_ON_HOST if gdb \n");
202 printf("doesn't work as expected\n");
203
204 return 0;
205}
206
207__uml_setup("debug", no_skas_debug_setup,
208"debug\n"
209" this flag is not needed to run gdb on UML in skas mode\n\n"
210);
211
212#endif
213
196#ifdef CONFIG_SMP 214#ifdef CONFIG_SMP
197static int __init uml_ncpus_setup(char *line, int *add) 215static int __init uml_ncpus_setup(char *line, int *add)
198{ 216{
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 52945338b64d..87c3aa0252db 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -122,6 +122,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
122 return(-EINVAL); 122 return(-EINVAL);
123 } 123 }
124 *fd_out = ((int *) CMSG_DATA(cmsg))[0]; 124 *fd_out = ((int *) CMSG_DATA(cmsg))[0];
125 os_set_exec_close(*fd_out, 1);
125 return(0); 126 return(0);
126} 127}
127 128
@@ -137,7 +138,8 @@ static int tuntap_open(void *data)
137 return(err); 138 return(err);
138 139
139 if(pri->fixed_config){ 140 if(pri->fixed_config){
140 pri->fd = os_open_file("/dev/net/tun", of_rdwr(OPENFLAGS()), 0); 141 pri->fd = os_open_file("/dev/net/tun",
142 of_cloexec(of_rdwr(OPENFLAGS())), 0);
141 if(pri->fd < 0){ 143 if(pri->fd < 0){
142 printk("Failed to open /dev/net/tun, err = %d\n", 144 printk("Failed to open /dev/net/tun, err = %d\n",
143 -pri->fd); 145 -pri->fd);
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 9890e9090f58..fbb080c2fc26 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -60,7 +60,7 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
60 60
61 multi_count++; 61 multi_count++;
62 62
63 get_safe_registers(regs); 63 get_safe_registers(regs, NULL);
64 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 64 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
65 ((unsigned long) &batch_syscall_stub - 65 ((unsigned long) &batch_syscall_stub -
66 (unsigned long) &__syscall_stub_start); 66 (unsigned long) &__syscall_stub_start);
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 120a21c5883f..bbf34cb91ce1 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -310,16 +310,12 @@ void userspace(union uml_pt_regs *regs)
310 } 310 }
311 } 311 }
312} 312}
313#define INIT_JMP_NEW_THREAD 0
314#define INIT_JMP_REMOVE_SIGSTACK 1
315#define INIT_JMP_CALLBACK 2
316#define INIT_JMP_HALT 3
317#define INIT_JMP_REBOOT 4
318 313
319int copy_context_skas0(unsigned long new_stack, int pid) 314int copy_context_skas0(unsigned long new_stack, int pid)
320{ 315{
321 int err; 316 int err;
322 unsigned long regs[MAX_REG_NR]; 317 unsigned long regs[HOST_FRAME_SIZE];
318 unsigned long fp_regs[HOST_FP_SIZE];
323 unsigned long current_stack = current_stub_stack(); 319 unsigned long current_stack = current_stub_stack();
324 struct stub_data *data = (struct stub_data *) current_stack; 320 struct stub_data *data = (struct stub_data *) current_stack;
325 struct stub_data *child_data = (struct stub_data *) new_stack; 321 struct stub_data *child_data = (struct stub_data *) new_stack;
@@ -334,7 +330,7 @@ int copy_context_skas0(unsigned long new_stack, int pid)
334 .timer = ((struct itimerval) 330 .timer = ((struct itimerval)
335 { { 0, 1000000 / hz() }, 331 { { 0, 1000000 / hz() },
336 { 0, 1000000 / hz() }})}); 332 { 0, 1000000 / hz() }})});
337 get_safe_registers(regs); 333 get_safe_registers(regs, fp_regs);
338 334
339 /* Set parent's instruction pointer to start of clone-stub */ 335 /* Set parent's instruction pointer to start of clone-stub */
340 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 336 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
@@ -350,6 +346,11 @@ int copy_context_skas0(unsigned long new_stack, int pid)
350 panic("copy_context_skas0 : PTRACE_SETREGS failed, " 346 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
351 "pid = %d, errno = %d\n", pid, errno); 347 "pid = %d, errno = %d\n", pid, errno);
352 348
349 err = ptrace_setfpregs(pid, fp_regs);
350 if(err < 0)
351 panic("copy_context_skas0 : PTRACE_SETFPREGS failed, "
352 "pid = %d, errno = %d\n", pid, errno);
353
353 /* set a well known return code for detection of child write failure */ 354 /* set a well known return code for detection of child write failure */
354 child_data->err = 12345678; 355 child_data->err = 12345678;
355 356
@@ -457,6 +458,12 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
457 set_signals(flags); 458 set_signals(flags);
458} 459}
459 460
461#define INIT_JMP_NEW_THREAD 0
462#define INIT_JMP_REMOVE_SIGSTACK 1
463#define INIT_JMP_CALLBACK 2
464#define INIT_JMP_HALT 3
465#define INIT_JMP_REBOOT 4
466
460void thread_wait(void *sw, void *fb) 467void thread_wait(void *sw, void *fb)
461{ 468{
462 sigjmp_buf buf, **switch_buf = sw, *fork_buf; 469 sigjmp_buf buf, **switch_buf = sw, *fork_buf;
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 6c5b17ed59e1..829d6b0d8b02 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -49,6 +49,7 @@ static int ptrace_child(void *arg)
49 int pid = os_getpid(), ppid = getppid(); 49 int pid = os_getpid(), ppid = getppid();
50 int sc_result; 50 int sc_result;
51 51
52 change_sig(SIGWINCH, 0);
52 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ 53 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){
53 perror("ptrace"); 54 perror("ptrace");
54 os_kill_process(pid, 0); 55 os_kill_process(pid, 0);
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index aee4812333c6..7a6f6b99ceff 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -122,9 +122,12 @@ void init_registers(int pid)
122 err); 122 err);
123} 123}
124 124
125void get_safe_registers(unsigned long *regs) 125void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
126{ 126{
127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
128 if(fp_regs != NULL)
129 memcpy(fp_regs, exec_fp_regs,
130 HOST_FP_SIZE * sizeof(unsigned long));
128} 131}
129 132
130void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) 133void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index 4b638dfb52b0..001941fa1a1e 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -70,9 +70,12 @@ void init_registers(int pid)
70 err); 70 err);
71} 71}
72 72
73void get_safe_registers(unsigned long *regs) 73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
74{ 74{
75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
76 if(fp_regs != NULL)
77 memcpy(fp_regs, exec_fp_regs,
78 HOST_FP_SIZE * sizeof(unsigned long));
76} 79}
77 80
78void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) 81void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
diff --git a/arch/um/sys-x86_64/ptrace_user.c b/arch/um/sys-x86_64/ptrace_user.c
index 12e404c6fa46..b5f9c33e311e 100644
--- a/arch/um/sys-x86_64/ptrace_user.c
+++ b/arch/um/sys-x86_64/ptrace_user.c
@@ -24,6 +24,13 @@ int ptrace_setregs(long pid, unsigned long *regs)
24 return(0); 24 return(0);
25} 25}
26 26
27int ptrace_setfpregs(long pid, unsigned long *regs)
28{
29 if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0)
30 return -errno;
31 return 0;
32}
33
27void ptrace_pokeuser(unsigned long addr, unsigned long data) 34void ptrace_pokeuser(unsigned long addr, unsigned long data)
28{ 35{
29 panic("ptrace_pokeuser"); 36 panic("ptrace_pokeuser");
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 5a585bfbb8c2..7bd54a921cf7 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -57,7 +57,7 @@ void foo(void)
57#endif 57#endif
58 58
59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); 59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE);
60 DEFINE(HOST_FP_SIZE, 0); 60 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
61 DEFINE(HOST_XFP_SIZE, 0); 61 DEFINE(HOST_XFP_SIZE, 0);
62 DEFINE_LONGS(HOST_RBX, RBX); 62 DEFINE_LONGS(HOST_RBX, RBX);
63 DEFINE_LONGS(HOST_RCX, RCX); 63 DEFINE_LONGS(HOST_RCX, RCX);
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 067c0f47bd0d..ada4535d0161 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -685,6 +685,9 @@ ia32_sys_call_table:
685 .quad sys_readlinkat /* 305 */ 685 .quad sys_readlinkat /* 305 */
686 .quad sys_fchmodat 686 .quad sys_fchmodat
687 .quad sys_faccessat 687 .quad sys_faccessat
688 .quad sys_ni_syscall /* pselect6 for now */
689 .quad sys_ni_syscall /* ppoll for now */
690 .quad sys_unshare /* 310 */
688ia32_syscall_end: 691ia32_syscall_end:
689 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 692 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
690 .quad ni_syscall 693 .quad ni_syscall
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 363db5a003df..9435ab7d6fb8 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -94,7 +94,6 @@ unsigned long saved_video_mode;
94/* 94/*
95 * Setup options 95 * Setup options
96 */ 96 */
97struct drive_info_struct { char dummy[32]; } drive_info;
98struct screen_info screen_info; 97struct screen_info screen_info;
99struct sys_desc_table_struct { 98struct sys_desc_table_struct {
100 unsigned short length; 99 unsigned short length;
@@ -572,7 +571,6 @@ void __init setup_arch(char **cmdline_p)
572 unsigned long kernel_end; 571 unsigned long kernel_end;
573 572
574 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 573 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
575 drive_info = DRIVE_INFO;
576 screen_info = SCREEN_INFO; 574 screen_info = SCREEN_INFO;
577 edid_info = EDID_INFO; 575 edid_info = EDID_INFO;
578 saved_video_mode = SAVED_VIDEO_MODE; 576 saved_video_mode = SAVED_VIDEO_MODE;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index a28756ef7cef..67e4e28f4df8 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -59,6 +59,7 @@
59#include <asm/nmi.h> 59#include <asm/nmi.h>
60#include <asm/irq.h> 60#include <asm/irq.h>
61#include <asm/hw_irq.h> 61#include <asm/hw_irq.h>
62#include <asm/numa.h>
62 63
63/* Number of siblings per CPU package */ 64/* Number of siblings per CPU package */
64int smp_num_siblings = 1; 65int smp_num_siblings = 1;
@@ -890,6 +891,7 @@ do_rest:
890 if (boot_error) { 891 if (boot_error) {
891 cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */ 892 cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */
892 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ 893 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
894 clear_node_cpumask(cpu); /* was set by numa_add_cpu */
893 cpu_clear(cpu, cpu_present_map); 895 cpu_clear(cpu, cpu_present_map);
894 cpu_clear(cpu, cpu_possible_map); 896 cpu_clear(cpu, cpu_possible_map);
895 x86_cpu_to_apicid[cpu] = BAD_APICID; 897 x86_cpu_to_apicid[cpu] = BAD_APICID;
@@ -1187,6 +1189,7 @@ void remove_cpu_from_maps(void)
1187 cpu_clear(cpu, cpu_callout_map); 1189 cpu_clear(cpu, cpu_callout_map);
1188 cpu_clear(cpu, cpu_callin_map); 1190 cpu_clear(cpu, cpu_callin_map);
1189 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ 1191 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
1192 clear_node_cpumask(cpu);
1190} 1193}
1191 1194
1192int __cpu_disable(void) 1195int __cpu_disable(void)
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index c0844bffbf84..dba7237be5c1 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -748,7 +748,7 @@ static __init int late_hpet_init(void)
748 * Timer0 and Timer1 is used by platform. 748 * Timer0 and Timer1 is used by platform.
749 */ 749 */
750 hd.hd_phys_address = vxtime.hpet_address; 750 hd.hd_phys_address = vxtime.hpet_address;
751 hd.hd_address = (void *)fix_to_virt(FIX_HPET_BASE); 751 hd.hd_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE);
752 hd.hd_nirqs = ntimer; 752 hd.hd_nirqs = ntimer;
753 hd.hd_flags = HPET_DATA_PLATFORM; 753 hd.hd_flags = HPET_DATA_PLATFORM;
754 hpet_reserve_timer(&hd, 0); 754 hpet_reserve_timer(&hd, 0);
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index b614d54d2ae4..3496abc8d372 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -39,11 +39,6 @@ extern void __write_lock_failed(rwlock_t *rw);
39extern void __read_lock_failed(rwlock_t *rw); 39extern void __read_lock_failed(rwlock_t *rw);
40#endif 40#endif
41 41
42#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
43extern struct drive_info_struct drive_info;
44EXPORT_SYMBOL(drive_info);
45#endif
46
47/* platform dependent support */ 42/* platform dependent support */
48EXPORT_SYMBOL(boot_cpu_data); 43EXPORT_SYMBOL(boot_cpu_data);
49//EXPORT_SYMBOL(dump_fpu); 44//EXPORT_SYMBOL(dump_fpu);
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index b4a3fe4ec249..18f371fe37f8 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -49,7 +49,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
49 return pci_mmcfg_virt[0].virt; 49 return pci_mmcfg_virt[0].virt;
50 50
51 /* Fall back to type 0 */ 51 /* Fall back to type 0 */
52 return 0; 52 return NULL;
53} 53}
54 54
55static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 55static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
diff --git a/block/elevator.c b/block/elevator.c
index 2fc269f69726..24b702d649a9 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -293,7 +293,7 @@ void elv_requeue_request(request_queue_t *q, struct request *rq)
293 293
294 rq->flags &= ~REQ_STARTED; 294 rq->flags &= ~REQ_STARTED;
295 295
296 __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE, 0); 296 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE);
297} 297}
298 298
299static void elv_drain_elevator(request_queue_t *q) 299static void elv_drain_elevator(request_queue_t *q)
@@ -310,41 +310,11 @@ static void elv_drain_elevator(request_queue_t *q)
310 } 310 }
311} 311}
312 312
313void __elv_add_request(request_queue_t *q, struct request *rq, int where, 313void elv_insert(request_queue_t *q, struct request *rq, int where)
314 int plug)
315{ 314{
316 struct list_head *pos; 315 struct list_head *pos;
317 unsigned ordseq; 316 unsigned ordseq;
318 317
319 if (q->ordcolor)
320 rq->flags |= REQ_ORDERED_COLOR;
321
322 if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
323 /*
324 * toggle ordered color
325 */
326 if (blk_barrier_rq(rq))
327 q->ordcolor ^= 1;
328
329 /*
330 * barriers implicitly indicate back insertion
331 */
332 if (where == ELEVATOR_INSERT_SORT)
333 where = ELEVATOR_INSERT_BACK;
334
335 /*
336 * this request is scheduling boundary, update end_sector
337 */
338 if (blk_fs_request(rq)) {
339 q->end_sector = rq_end_sector(rq);
340 q->boundary_rq = rq;
341 }
342 } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
343 where = ELEVATOR_INSERT_BACK;
344
345 if (plug)
346 blk_plug_device(q);
347
348 rq->q = q; 318 rq->q = q;
349 319
350 switch (where) { 320 switch (where) {
@@ -425,6 +395,42 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
425 } 395 }
426} 396}
427 397
398void __elv_add_request(request_queue_t *q, struct request *rq, int where,
399 int plug)
400{
401 if (q->ordcolor)
402 rq->flags |= REQ_ORDERED_COLOR;
403
404 if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
405 /*
406 * toggle ordered color
407 */
408 if (blk_barrier_rq(rq))
409 q->ordcolor ^= 1;
410
411 /*
412 * barriers implicitly indicate back insertion
413 */
414 if (where == ELEVATOR_INSERT_SORT)
415 where = ELEVATOR_INSERT_BACK;
416
417 /*
418 * this request is scheduling boundary, update
419 * end_sector
420 */
421 if (blk_fs_request(rq)) {
422 q->end_sector = rq_end_sector(rq);
423 q->boundary_rq = rq;
424 }
425 } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
426 where = ELEVATOR_INSERT_BACK;
427
428 if (plug)
429 blk_plug_device(q);
430
431 elv_insert(q, rq, where);
432}
433
428void elv_add_request(request_queue_t *q, struct request *rq, int where, 434void elv_add_request(request_queue_t *q, struct request *rq, int where,
429 int plug) 435 int plug)
430{ 436{
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index ee5ed98db4cd..03d9c82b0fe7 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -454,7 +454,7 @@ static void queue_flush(request_queue_t *q, unsigned which)
454 rq->end_io = end_io; 454 rq->end_io = end_io;
455 q->prepare_flush_fn(q, rq); 455 q->prepare_flush_fn(q, rq);
456 456
457 __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); 457 elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
458} 458}
459 459
460static inline struct request *start_ordered(request_queue_t *q, 460static inline struct request *start_ordered(request_queue_t *q,
@@ -490,7 +490,7 @@ static inline struct request *start_ordered(request_queue_t *q,
490 else 490 else
491 q->ordseq |= QUEUE_ORDSEQ_POSTFLUSH; 491 q->ordseq |= QUEUE_ORDSEQ_POSTFLUSH;
492 492
493 __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); 493 elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
494 494
495 if (q->ordered & QUEUE_ORDERED_PREFLUSH) { 495 if (q->ordered & QUEUE_ORDERED_PREFLUSH) {
496 queue_flush(q, QUEUE_ORDERED_PREFLUSH); 496 queue_flush(q, QUEUE_ORDERED_PREFLUSH);
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index cc72210687eb..24f7af9d0abc 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -310,6 +310,8 @@ static int sg_io(struct file *file, request_queue_t *q,
310 if (!rq->timeout) 310 if (!rq->timeout)
311 rq->timeout = BLK_DEFAULT_TIMEOUT; 311 rq->timeout = BLK_DEFAULT_TIMEOUT;
312 312
313 rq->retries = 0;
314
313 start_time = jiffies; 315 start_time = jiffies;
314 316
315 /* ignore return value. All information is passed back to caller 317 /* ignore return value. All information is passed back to caller
@@ -427,6 +429,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
427 rq->data = buffer; 429 rq->data = buffer;
428 rq->data_len = bytes; 430 rq->data_len = bytes;
429 rq->flags |= REQ_BLOCK_PC; 431 rq->flags |= REQ_BLOCK_PC;
432 rq->retries = 0;
430 433
431 blk_execute_rq(q, bd_disk, rq, 0); 434 blk_execute_rq(q, bd_disk, rq, 0);
432 err = rq->errors & 0xff; /* only 8 bit SCSI status */ 435 err = rq->errors & 0xff; /* only 8 bit SCSI status */
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 47ac90e615f4..2953e2cc56f0 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -17,7 +17,6 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/highmem.h> 19#include <linux/highmem.h>
20#include <asm/bug.h>
21#include <asm/scatterlist.h> 20#include <asm/scatterlist.h>
22#include "internal.h" 21#include "internal.h"
23#include "scatterwalk.h" 22#include "scatterwalk.h"
diff --git a/drivers/Makefile b/drivers/Makefile
index 619dd964c51c..5c69b86db624 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -69,7 +69,7 @@ obj-$(CONFIG_EISA) += eisa/
69obj-$(CONFIG_CPU_FREQ) += cpufreq/ 69obj-$(CONFIG_CPU_FREQ) += cpufreq/
70obj-$(CONFIG_MMC) += mmc/ 70obj-$(CONFIG_MMC) += mmc/
71obj-$(CONFIG_INFINIBAND) += infiniband/ 71obj-$(CONFIG_INFINIBAND) += infiniband/
72obj-$(CONFIG_SGI_IOC4) += sn/ 72obj-$(CONFIG_SGI_SN) += sn/
73obj-y += firmware/ 73obj-y += firmware/
74obj-$(CONFIG_CRYPTO) += crypto/ 74obj-$(CONFIG_CRYPTO) += crypto/
75obj-$(CONFIG_SUPERH) += sh/ 75obj-$(CONFIG_SUPERH) += sh/
diff --git a/drivers/base/base.h b/drivers/base/base.h
index e3b548d46cff..5735b38582d0 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -19,6 +19,10 @@ extern void bus_remove_driver(struct device_driver *);
19extern void driver_detach(struct device_driver * drv); 19extern void driver_detach(struct device_driver * drv);
20extern int driver_probe_device(struct device_driver *, struct device *); 20extern int driver_probe_device(struct device_driver *, struct device *);
21 21
22extern void sysdev_shutdown(void);
23extern int sysdev_suspend(pm_message_t state);
24extern int sysdev_resume(void);
25
22static inline struct class_device *to_class_dev(struct kobject *obj) 26static inline struct class_device *to_class_dev(struct kobject *obj)
23{ 27{
24 return container_of(obj, struct class_device, kobj); 28 return container_of(obj, struct class_device, kobj);
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 29f6af554e71..c3141565d59d 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -133,6 +133,8 @@ static struct kobj_type ktype_bus = {
133decl_subsys(bus, &ktype_bus, NULL); 133decl_subsys(bus, &ktype_bus, NULL);
134 134
135 135
136#ifdef CONFIG_HOTPLUG
137
136/* Manually detach a device from its associated driver. */ 138/* Manually detach a device from its associated driver. */
137static int driver_helper(struct device *dev, void *data) 139static int driver_helper(struct device *dev, void *data)
138{ 140{
@@ -193,6 +195,7 @@ static ssize_t driver_bind(struct device_driver *drv,
193} 195}
194static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); 196static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
195 197
198#endif
196 199
197static struct device * next_device(struct klist_iter * i) 200static struct device * next_device(struct klist_iter * i)
198{ 201{
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index d1a05224627e..105a0d61eb1f 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -303,7 +303,7 @@ static int block_size_init(void)
303 */ 303 */
304#ifdef CONFIG_ARCH_MEMORY_PROBE 304#ifdef CONFIG_ARCH_MEMORY_PROBE
305static ssize_t 305static ssize_t
306memory_probe_store(struct class *class, const char __user *buf, size_t count) 306memory_probe_store(struct class *class, const char *buf, size_t count)
307{ 307{
308 u64 phys_addr; 308 u64 phys_addr;
309 int ret; 309 int ret;
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c
index 0a7aa07b9a2a..317edbf0feca 100644
--- a/drivers/base/power/resume.c
+++ b/drivers/base/power/resume.c
@@ -9,10 +9,9 @@
9 */ 9 */
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include "../base.h"
12#include "power.h" 13#include "power.h"
13 14
14extern int sysdev_resume(void);
15
16 15
17/** 16/**
18 * resume_device - Restore state for one device. 17 * resume_device - Restore state for one device.
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index c2475f3134ea..8826a5b6673e 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -12,6 +12,7 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <asm/semaphore.h> 13#include <asm/semaphore.h>
14 14
15#include "../base.h"
15#include "power.h" 16#include "power.h"
16 17
17#define to_dev(node) container_of(node, struct device, kobj.entry) 18#define to_dev(node) container_of(node, struct device, kobj.entry)
@@ -28,7 +29,6 @@ extern struct subsystem devices_subsys;
28 * they only get one called once when interrupts are disabled. 29 * they only get one called once when interrupts are disabled.
29 */ 30 */
30 31
31extern int sysdev_shutdown(void);
32 32
33/** 33/**
34 * device_shutdown - call ->shutdown() on each device to shutdown. 34 * device_shutdown - call ->shutdown() on each device to shutdown.
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index 50501764d050..8660779fb288 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -9,10 +9,9 @@
9 */ 9 */
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include "../base.h"
12#include "power.h" 13#include "power.h"
13 14
14extern int sysdev_suspend(pm_message_t state);
15
16/* 15/*
17 * The entries in the dpm_active list are in a depth first order, simply 16 * The entries in the dpm_active list are in a depth first order, simply
18 * because children are guaranteed to be discovered after parents, and 17 * because children are guaranteed to be discovered after parents, and
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index f3a0c562bcb5..40d7242a07c1 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -27,22 +27,30 @@
27 27
28static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) 28static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
29{ 29{
30 return sprintf(buf, "%u\n", dev->power.power_state.event); 30 if (dev->power.power_state.event)
31 return sprintf(buf, "2\n");
32 else
33 return sprintf(buf, "0\n");
31} 34}
32 35
33static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) 36static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
34{ 37{
35 pm_message_t state; 38 pm_message_t state;
36 char * rest; 39 int error = -EINVAL;
37 int error = 0;
38 40
39 state.event = simple_strtoul(buf, &rest, 10); 41 state.event = PM_EVENT_SUSPEND;
40 if (*rest) 42 /* Older apps expected to write "3" here - confused with PCI D3 */
41 return -EINVAL; 43 if ((n == 1) && !strcmp(buf, "3"))
42 if (state.event)
43 error = dpm_runtime_suspend(dev, state); 44 error = dpm_runtime_suspend(dev, state);
44 else 45
46 if ((n == 1) && !strcmp(buf, "2"))
47 error = dpm_runtime_suspend(dev, state);
48
49 if ((n == 1) && !strcmp(buf, "0")) {
45 dpm_runtime_resume(dev); 50 dpm_runtime_resume(dev);
51 error = 0;
52 }
53
46 return error ? error : n; 54 return error ? error : n;
47} 55}
48 56
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 66ed8f2fece5..6fc23ab127bd 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -21,8 +21,11 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/device.h>
24#include <asm/semaphore.h> 25#include <asm/semaphore.h>
25 26
27#include "base.h"
28
26extern struct subsystem devices_subsys; 29extern struct subsystem devices_subsys;
27 30
28#define to_sysdev(k) container_of(k, struct sys_device, kobj) 31#define to_sysdev(k) container_of(k, struct sys_device, kobj)
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 12d7b9bdfa93..0d65394707db 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2183,6 +2183,7 @@ static void cciss_softirq_done(struct request *rq)
2183{ 2183{
2184 CommandList_struct *cmd = rq->completion_data; 2184 CommandList_struct *cmd = rq->completion_data;
2185 ctlr_info_t *h = hba[cmd->ctlr]; 2185 ctlr_info_t *h = hba[cmd->ctlr];
2186 unsigned long flags;
2186 u64bit temp64; 2187 u64bit temp64;
2187 int i, ddir; 2188 int i, ddir;
2188 2189
@@ -2205,10 +2206,10 @@ static void cciss_softirq_done(struct request *rq)
2205 printk("Done with %p\n", rq); 2206 printk("Done with %p\n", rq);
2206#endif /* CCISS_DEBUG */ 2207#endif /* CCISS_DEBUG */
2207 2208
2208 spin_lock_irq(&h->lock); 2209 spin_lock_irqsave(&h->lock, flags);
2209 end_that_request_last(rq, rq->errors); 2210 end_that_request_last(rq, rq->errors);
2210 cmd_free(h, cmd,1); 2211 cmd_free(h, cmd,1);
2211 spin_unlock_irq(&h->lock); 2212 spin_unlock_irqrestore(&h->lock, flags);
2212} 2213}
2213 2214
2214/* checks the status of the job and calls complete buffers to mark all 2215/* checks the status of the job and calls complete buffers to mark all
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 193446e6a08a..e27617259552 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -42,8 +42,6 @@
42#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44 44
45#include <asm/bug.h>
46
47#include <asm/vio.h> 45#include <asm/vio.h>
48#include <asm/scatterlist.h> 46#include <asm/scatterlist.h>
49#include <asm/iseries/hv_types.h> 47#include <asm/iseries/hv_types.h>
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 4c67727d75b1..05ba410682a3 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -222,7 +222,7 @@ config SYNCLINKMP
222 222
223config SYNCLINK_GT 223config SYNCLINK_GT
224 tristate "SyncLink GT/AC support" 224 tristate "SyncLink GT/AC support"
225 depends on SERIAL_NONSTANDARD 225 depends on SERIAL_NONSTANDARD && PCI
226 help 226 help
227 Support for SyncLink GT and SyncLink AC families of 227 Support for SyncLink GT and SyncLink AC families of
228 synchronous and asynchronous serial adapters 228 synchronous and asynchronous serial adapters
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 71b8b32b075f..107df9fdba4e 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -980,7 +980,7 @@ extern int drm_put_head(drm_head_t * head);
980extern unsigned int drm_debug; 980extern unsigned int drm_debug;
981extern unsigned int drm_cards_limit; 981extern unsigned int drm_cards_limit;
982extern drm_head_t **drm_heads; 982extern drm_head_t **drm_heads;
983extern struct drm_sysfs_class *drm_class; 983extern struct class *drm_class;
984extern struct proc_dir_entry *drm_proc_root; 984extern struct proc_dir_entry *drm_proc_root;
985 985
986 /* Proc support (drm_proc.h) */ 986 /* Proc support (drm_proc.h) */
@@ -1011,11 +1011,9 @@ extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
1011extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); 1011extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
1012 1012
1013 /* sysfs support (drm_sysfs.c) */ 1013 /* sysfs support (drm_sysfs.c) */
1014struct drm_sysfs_class; 1014extern struct class *drm_sysfs_create(struct module *owner, char *name);
1015extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, 1015extern void drm_sysfs_destroy(struct class *cs);
1016 char *name); 1016extern struct class_device *drm_sysfs_device_add(struct class *cs,
1017extern void drm_sysfs_destroy(struct drm_sysfs_class *cs);
1018extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
1019 drm_head_t *head); 1017 drm_head_t *head);
1020extern void drm_sysfs_device_remove(struct class_device *class_dev); 1018extern void drm_sysfs_device_remove(struct class_device *class_dev);
1021 1019
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 7a9263ff3007..68073e14fdec 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -50,7 +50,7 @@ module_param_named(cards_limit, drm_cards_limit, int, 0444);
50module_param_named(debug, drm_debug, int, 0600); 50module_param_named(debug, drm_debug, int, 0600);
51 51
52drm_head_t **drm_heads; 52drm_head_t **drm_heads;
53struct drm_sysfs_class *drm_class; 53struct class *drm_class;
54struct proc_dir_entry *drm_proc_root; 54struct proc_dir_entry *drm_proc_root;
55 55
56static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, 56static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index 68e43ddc16ae..0b9f98a7eb10 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support 3 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support
3 * extra sysfs attribute from DRM. Normal drm_sysfs_class 4 * extra sysfs attribute from DRM. Normal drm_sysfs_class
@@ -19,36 +20,6 @@
19#include "drm_core.h" 20#include "drm_core.h"
20#include "drmP.h" 21#include "drmP.h"
21 22
22struct drm_sysfs_class {
23 struct class_device_attribute attr;
24 struct class class;
25};
26#define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class)
27
28struct simple_dev {
29 dev_t dev;
30 struct class_device class_dev;
31};
32#define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)
33
34static void release_simple_dev(struct class_device *class_dev)
35{
36 struct simple_dev *s_dev = to_simple_dev(class_dev);
37 kfree(s_dev);
38}
39
40static ssize_t show_dev(struct class_device *class_dev, char *buf)
41{
42 struct simple_dev *s_dev = to_simple_dev(class_dev);
43 return print_dev_t(buf, s_dev->dev);
44}
45
46static void drm_sysfs_class_release(struct class *class)
47{
48 struct drm_sysfs_class *cs = to_drm_sysfs_class(class);
49 kfree(cs);
50}
51
52/* Display the version of drm_core. This doesn't work right in current design */ 23/* Display the version of drm_core. This doesn't work right in current design */
53static ssize_t version_show(struct class *dev, char *buf) 24static ssize_t version_show(struct class *dev, char *buf)
54{ 25{
@@ -69,38 +40,16 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
69 * Note, the pointer created here is to be destroyed when finished by making a 40 * Note, the pointer created here is to be destroyed when finished by making a
70 * call to drm_sysfs_destroy(). 41 * call to drm_sysfs_destroy().
71 */ 42 */
72struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name) 43struct class *drm_sysfs_create(struct module *owner, char *name)
73{ 44{
74 struct drm_sysfs_class *cs; 45 struct class *class;
75 int retval; 46
76 47 class = class_create(owner, name);
77 cs = kmalloc(sizeof(*cs), GFP_KERNEL); 48 if (!class)
78 if (!cs) { 49 return class;
79 retval = -ENOMEM; 50
80 goto error; 51 class_create_file(class, &class_attr_version);
81 } 52 return class;
82 memset(cs, 0x00, sizeof(*cs));
83
84 cs->class.name = name;
85 cs->class.class_release = drm_sysfs_class_release;
86 cs->class.release = release_simple_dev;
87
88 cs->attr.attr.name = "dev";
89 cs->attr.attr.mode = S_IRUGO;
90 cs->attr.attr.owner = owner;
91 cs->attr.show = show_dev;
92 cs->attr.store = NULL;
93
94 retval = class_register(&cs->class);
95 if (retval)
96 goto error;
97 class_create_file(&cs->class, &class_attr_version);
98
99 return cs;
100
101 error:
102 kfree(cs);
103 return ERR_PTR(retval);
104} 53}
105 54
106/** 55/**
@@ -110,12 +59,13 @@ struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name)
110 * Note, the pointer to be destroyed must have been created with a call to 59 * Note, the pointer to be destroyed must have been created with a call to
111 * drm_sysfs_create(). 60 * drm_sysfs_create().
112 */ 61 */
113void drm_sysfs_destroy(struct drm_sysfs_class *cs) 62void drm_sysfs_destroy(struct class *class)
114{ 63{
115 if ((cs == NULL) || (IS_ERR(cs))) 64 if ((class == NULL) || (IS_ERR(class)))
116 return; 65 return;
117 66
118 class_unregister(&cs->class); 67 class_remove_file(class, &class_attr_version);
68 class_destroy(class);
119} 69}
120 70
121static ssize_t show_dri(struct class_device *class_device, char *buf) 71static ssize_t show_dri(struct class_device *class_device, char *buf)
@@ -132,7 +82,7 @@ static struct class_device_attribute class_device_attrs[] = {
132 82
133/** 83/**
134 * drm_sysfs_device_add - adds a class device to sysfs for a character driver 84 * drm_sysfs_device_add - adds a class device to sysfs for a character driver
135 * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. 85 * @cs: pointer to the struct class that this device should be registered to.
136 * @dev: the dev_t for the device to be added. 86 * @dev: the dev_t for the device to be added.
137 * @device: a pointer to a struct device that is assiociated with this class device. 87 * @device: a pointer to a struct device that is assiociated with this class device.
138 * @fmt: string for the class device's name 88 * @fmt: string for the class device's name
@@ -141,46 +91,26 @@ static struct class_device_attribute class_device_attrs[] = {
141 * class. A "dev" file will be created, showing the dev_t for the device. The 91 * class. A "dev" file will be created, showing the dev_t for the device. The
142 * pointer to the struct class_device will be returned from the call. Any further 92 * pointer to the struct class_device will be returned from the call. Any further
143 * sysfs files that might be required can be created using this pointer. 93 * sysfs files that might be required can be created using this pointer.
144 * Note: the struct drm_sysfs_class passed to this function must have previously been 94 * Note: the struct class passed to this function must have previously been
145 * created with a call to drm_sysfs_create(). 95 * created with a call to drm_sysfs_create().
146 */ 96 */
147struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, 97struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head)
148 drm_head_t *head)
149{ 98{
150 struct simple_dev *s_dev = NULL; 99 struct class_device *class_dev;
151 int i, retval; 100 int i;
152
153 if ((cs == NULL) || (IS_ERR(cs))) {
154 retval = -ENODEV;
155 goto error;
156 }
157
158 s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL);
159 if (!s_dev) {
160 retval = -ENOMEM;
161 goto error;
162 }
163 memset(s_dev, 0x00, sizeof(*s_dev));
164
165 s_dev->dev = MKDEV(DRM_MAJOR, head->minor);
166 s_dev->class_dev.dev = &(head->dev->pdev)->dev;
167 s_dev->class_dev.class = &cs->class;
168 101
169 snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor); 102 class_dev = class_device_create(cs, NULL,
170 retval = class_device_register(&s_dev->class_dev); 103 MKDEV(DRM_MAJOR, head->minor),
171 if (retval) 104 &(head->dev->pdev)->dev,
172 goto error; 105 "card%d", head->minor);
106 if (!class_dev)
107 return NULL;
173 108
174 class_device_create_file(&s_dev->class_dev, &cs->attr); 109 class_set_devdata(class_dev, head);
175 class_set_devdata(&s_dev->class_dev, head);
176 110
177 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 111 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
178 class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]); 112 class_device_create_file(class_dev, &class_device_attrs[i]);
179 return &s_dev->class_dev; 113 return class_dev;
180
181error:
182 kfree(s_dev);
183 return ERR_PTR(retval);
184} 114}
185 115
186/** 116/**
@@ -192,10 +122,9 @@ error:
192 */ 122 */
193void drm_sysfs_device_remove(struct class_device *class_dev) 123void drm_sysfs_device_remove(struct class_device *class_dev)
194{ 124{
195 struct simple_dev *s_dev = to_simple_dev(class_dev);
196 int i; 125 int i;
197 126
198 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 127 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
199 class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]); 128 class_device_remove_file(class_dev, &class_device_attrs[i]);
200 class_device_unregister(&s_dev->class_dev); 129 class_device_unregister(class_dev);
201} 130}
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c
index 80a5b840e22f..fee68cc895f8 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/char/ser_a2232.c
@@ -103,6 +103,7 @@
103 103
104#include <linux/serial.h> 104#include <linux/serial.h>
105#include <linux/generic_serial.h> 105#include <linux/generic_serial.h>
106#include <linux/tty_flip.h>
106 107
107#include "ser_a2232.h" 108#include "ser_a2232.h"
108#include "ser_a2232fw.h" 109#include "ser_a2232fw.h"
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 076e07c1da38..a23816d3e9a1 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -268,6 +268,8 @@ static struct tty_buffer *tty_buffer_alloc(size_t size)
268 p->size = size; 268 p->size = size;
269 p->next = NULL; 269 p->next = NULL;
270 p->active = 0; 270 p->active = 0;
271 p->commit = 0;
272 p->read = 0;
271 p->char_buf_ptr = (char *)(p->data); 273 p->char_buf_ptr = (char *)(p->data);
272 p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; 274 p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size;
273/* printk("Flip create %p\n", p); */ 275/* printk("Flip create %p\n", p); */
@@ -298,6 +300,8 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
298 *tbh = t->next; 300 *tbh = t->next;
299 t->next = NULL; 301 t->next = NULL;
300 t->used = 0; 302 t->used = 0;
303 t->commit = 0;
304 t->read = 0;
301 /* DEBUG ONLY */ 305 /* DEBUG ONLY */
302 memset(t->data, '*', size); 306 memset(t->data, '*', size);
303/* printk("Flip recycle %p\n", t); */ 307/* printk("Flip recycle %p\n", t); */
@@ -335,6 +339,7 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
335 if (b != NULL) { 339 if (b != NULL) {
336 b->next = n; 340 b->next = n;
337 b->active = 0; 341 b->active = 0;
342 b->commit = b->used;
338 } else 343 } else
339 tty->buf.head = n; 344 tty->buf.head = n;
340 tty->buf.tail = n; 345 tty->buf.tail = n;
@@ -2752,6 +2757,9 @@ static void flush_to_ldisc(void *private_)
2752 unsigned long flags; 2757 unsigned long flags;
2753 struct tty_ldisc *disc; 2758 struct tty_ldisc *disc;
2754 struct tty_buffer *tbuf; 2759 struct tty_buffer *tbuf;
2760 int count;
2761 char *char_buf;
2762 unsigned char *flag_buf;
2755 2763
2756 disc = tty_ldisc_ref(tty); 2764 disc = tty_ldisc_ref(tty);
2757 if (disc == NULL) /* !TTY_LDISC */ 2765 if (disc == NULL) /* !TTY_LDISC */
@@ -2765,16 +2773,20 @@ static void flush_to_ldisc(void *private_)
2765 goto out; 2773 goto out;
2766 } 2774 }
2767 spin_lock_irqsave(&tty->buf.lock, flags); 2775 spin_lock_irqsave(&tty->buf.lock, flags);
2768 while((tbuf = tty->buf.head) != NULL && !tbuf->active) { 2776 while((tbuf = tty->buf.head) != NULL) {
2777 while ((count = tbuf->commit - tbuf->read) != 0) {
2778 char_buf = tbuf->char_buf_ptr + tbuf->read;
2779 flag_buf = tbuf->flag_buf_ptr + tbuf->read;
2780 tbuf->read += count;
2781 spin_unlock_irqrestore(&tty->buf.lock, flags);
2782 disc->receive_buf(tty, char_buf, flag_buf, count);
2783 spin_lock_irqsave(&tty->buf.lock, flags);
2784 }
2785 if (tbuf->active)
2786 break;
2769 tty->buf.head = tbuf->next; 2787 tty->buf.head = tbuf->next;
2770 if (tty->buf.head == NULL) 2788 if (tty->buf.head == NULL)
2771 tty->buf.tail = NULL; 2789 tty->buf.tail = NULL;
2772 spin_unlock_irqrestore(&tty->buf.lock, flags);
2773 /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */
2774 disc->receive_buf(tty, tbuf->char_buf_ptr,
2775 tbuf->flag_buf_ptr,
2776 tbuf->used);
2777 spin_lock_irqsave(&tty->buf.lock, flags);
2778 tty_buffer_free(tty, tbuf); 2790 tty_buffer_free(tty, tbuf);
2779 } 2791 }
2780 spin_unlock_irqrestore(&tty->buf.lock, flags); 2792 spin_unlock_irqrestore(&tty->buf.lock, flags);
@@ -2871,8 +2883,10 @@ void tty_flip_buffer_push(struct tty_struct *tty)
2871{ 2883{
2872 unsigned long flags; 2884 unsigned long flags;
2873 spin_lock_irqsave(&tty->buf.lock, flags); 2885 spin_lock_irqsave(&tty->buf.lock, flags);
2874 if (tty->buf.tail != NULL) 2886 if (tty->buf.tail != NULL) {
2875 tty->buf.tail->active = 0; 2887 tty->buf.tail->active = 0;
2888 tty->buf.tail->commit = tty->buf.tail->used;
2889 }
2876 spin_unlock_irqrestore(&tty->buf.lock, flags); 2890 spin_unlock_irqrestore(&tty->buf.lock, flags);
2877 2891
2878 if (tty->low_latency) 2892 if (tty->low_latency)
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c
index 7a4dfb95d087..837b1ec3ffe3 100644
--- a/drivers/char/watchdog/sbc_epx_c3.c
+++ b/drivers/char/watchdog/sbc_epx_c3.c
@@ -92,7 +92,7 @@ static int epx_c3_release(struct inode *inode, struct file *file)
92 return 0; 92 return 0;
93} 93}
94 94
95static ssize_t epx_c3_write(struct file *file, const char *data, 95static ssize_t epx_c3_write(struct file *file, const char __user *data,
96 size_t len, loff_t *ppos) 96 size_t len, loff_t *ppos)
97{ 97{
98 /* Refresh the timer. */ 98 /* Refresh the timer. */
@@ -105,6 +105,7 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
105 unsigned int cmd, unsigned long arg) 105 unsigned int cmd, unsigned long arg)
106{ 106{
107 int options, retval = -EINVAL; 107 int options, retval = -EINVAL;
108 int __user *argp = (void __user *)arg;
108 static struct watchdog_info ident = { 109 static struct watchdog_info ident = {
109 .options = WDIOF_KEEPALIVEPING | 110 .options = WDIOF_KEEPALIVEPING |
110 WDIOF_MAGICCLOSE, 111 WDIOF_MAGICCLOSE,
@@ -114,20 +115,19 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
114 115
115 switch (cmd) { 116 switch (cmd) {
116 case WDIOC_GETSUPPORT: 117 case WDIOC_GETSUPPORT:
117 if (copy_to_user((struct watchdog_info *)arg, 118 if (copy_to_user(argp, &ident, sizeof(ident)))
118 &ident, sizeof(ident)))
119 return -EFAULT; 119 return -EFAULT;
120 return 0; 120 return 0;
121 case WDIOC_GETSTATUS: 121 case WDIOC_GETSTATUS:
122 case WDIOC_GETBOOTSTATUS: 122 case WDIOC_GETBOOTSTATUS:
123 return put_user(0,(int *)arg); 123 return put_user(0, argp);
124 case WDIOC_KEEPALIVE: 124 case WDIOC_KEEPALIVE:
125 epx_c3_pet(); 125 epx_c3_pet();
126 return 0; 126 return 0;
127 case WDIOC_GETTIMEOUT: 127 case WDIOC_GETTIMEOUT:
128 return put_user(WATCHDOG_TIMEOUT,(int *)arg); 128 return put_user(WATCHDOG_TIMEOUT, argp);
129 case WDIOC_SETOPTIONS: { 129 case WDIOC_SETOPTIONS:
130 if (get_user(options, (int *)arg)) 130 if (get_user(options, argp))
131 return -EFAULT; 131 return -EFAULT;
132 132
133 if (options & WDIOS_DISABLECARD) { 133 if (options & WDIOS_DISABLECARD) {
@@ -141,7 +141,6 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
141 } 141 }
142 142
143 return retval; 143 return retval;
144 }
145 default: 144 default:
146 return -ENOIOCTLCMD; 145 return -ENOIOCTLCMD;
147 } 146 }
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c
index 009c08fe5d69..1991f94af753 100644
--- a/drivers/edac/i82875p_edac.c
+++ b/drivers/edac/i82875p_edac.c
@@ -159,7 +159,7 @@ enum i82875p_chips {
159 159
160struct i82875p_pvt { 160struct i82875p_pvt {
161 struct pci_dev *ovrfl_pdev; 161 struct pci_dev *ovrfl_pdev;
162 void *ovrfl_window; 162 void __iomem *ovrfl_window;
163}; 163};
164 164
165 165
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index c58295914365..7230d4e08196 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -113,6 +113,16 @@ config SENSORS_DS1621
113 This driver can also be built as a module. If so, the module 113 This driver can also be built as a module. If so, the module
114 will be called ds1621. 114 will be called ds1621.
115 115
116config SENSORS_F71805F
117 tristate "Fintek F71805F/FG"
118 depends on HWMON && EXPERIMENTAL
119 help
120 If you say yes here you get support for hardware monitoring
121 features of the Fintek F71805F/FG chips.
122
123 This driver can also be built as a module. If so, the module
124 will be called f71805f.
125
116config SENSORS_FSCHER 126config SENSORS_FSCHER
117 tristate "FSC Hermes" 127 tristate "FSC Hermes"
118 depends on HWMON && I2C && EXPERIMENTAL 128 depends on HWMON && I2C && EXPERIMENTAL
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 06d4a1d14105..fbdb8d911a72 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o
18obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o 18obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o
19obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o 19obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
20obj-$(CONFIG_SENSORS_DS1621) += ds1621.o 20obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
21obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
21obj-$(CONFIG_SENSORS_FSCHER) += fscher.o 22obj-$(CONFIG_SENSORS_FSCHER) += fscher.o
22obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o 23obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o
23obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o 24obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c
new file mode 100644
index 000000000000..e029e0a94ecc
--- /dev/null
+++ b/drivers/hwmon/f71805f.c
@@ -0,0 +1,908 @@
1/*
2 * f71805f.c - driver for the Fintek F71805F/FG Super-I/O chip integrated
3 * hardware monitoring features
4 * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>
5 *
6 * The F71805F/FG is a LPC Super-I/O chip made by Fintek. It integrates
7 * complete hardware monitoring features: voltage, fan and temperature
8 * sensors, and manual and automatic fan speed control.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#include <linux/module.h>
26#include <linux/init.h>
27#include <linux/slab.h>
28#include <linux/jiffies.h>
29#include <linux/platform_device.h>
30#include <linux/hwmon.h>
31#include <linux/hwmon-sysfs.h>
32#include <linux/err.h>
33#include <asm/io.h>
34
35static struct platform_device *pdev;
36
37#define DRVNAME "f71805f"
38
39/*
40 * Super-I/O constants and functions
41 */
42
43#define F71805F_LD_HWM 0x04
44
45#define SIO_REG_LDSEL 0x07 /* Logical device select */
46#define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */
47#define SIO_REG_DEVREV 0x22 /* Device revision */
48#define SIO_REG_MANID 0x23 /* Fintek ID (2 bytes) */
49#define SIO_REG_ENABLE 0x30 /* Logical device enable */
50#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */
51
52#define SIO_FINTEK_ID 0x1934
53#define SIO_F71805F_ID 0x0406
54
55static inline int
56superio_inb(int base, int reg)
57{
58 outb(reg, base);
59 return inb(base + 1);
60}
61
62static int
63superio_inw(int base, int reg)
64{
65 int val;
66 outb(reg++, base);
67 val = inb(base + 1) << 8;
68 outb(reg, base);
69 val |= inb(base + 1);
70 return val;
71}
72
73static inline void
74superio_select(int base, int ld)
75{
76 outb(SIO_REG_LDSEL, base);
77 outb(ld, base + 1);
78}
79
80static inline void
81superio_enter(int base)
82{
83 outb(0x87, base);
84 outb(0x87, base);
85}
86
87static inline void
88superio_exit(int base)
89{
90 outb(0xaa, base);
91}
92
93/*
94 * ISA constants
95 */
96
97#define REGION_LENGTH 2
98#define ADDR_REG_OFFSET 0
99#define DATA_REG_OFFSET 1
100
101static struct resource f71805f_resource __initdata = {
102 .flags = IORESOURCE_IO,
103};
104
105/*
106 * Registers
107 */
108
109/* in nr from 0 to 8 (8-bit values) */
110#define F71805F_REG_IN(nr) (0x10 + (nr))
111#define F71805F_REG_IN_HIGH(nr) (0x40 + 2 * (nr))
112#define F71805F_REG_IN_LOW(nr) (0x41 + 2 * (nr))
113/* fan nr from 0 to 2 (12-bit values, two registers) */
114#define F71805F_REG_FAN(nr) (0x20 + 2 * (nr))
115#define F71805F_REG_FAN_LOW(nr) (0x28 + 2 * (nr))
116#define F71805F_REG_FAN_CTRL(nr) (0x60 + 16 * (nr))
117/* temp nr from 0 to 2 (8-bit values) */
118#define F71805F_REG_TEMP(nr) (0x1B + (nr))
119#define F71805F_REG_TEMP_HIGH(nr) (0x54 + 2 * (nr))
120#define F71805F_REG_TEMP_HYST(nr) (0x55 + 2 * (nr))
121#define F71805F_REG_TEMP_MODE 0x01
122
123#define F71805F_REG_START 0x00
124/* status nr from 0 to 2 */
125#define F71805F_REG_STATUS(nr) (0x36 + (nr))
126
127/*
128 * Data structures and manipulation thereof
129 */
130
131struct f71805f_data {
132 unsigned short addr;
133 const char *name;
134 struct semaphore lock;
135 struct class_device *class_dev;
136
137 struct semaphore update_lock;
138 char valid; /* !=0 if following fields are valid */
139 unsigned long last_updated; /* In jiffies */
140 unsigned long last_limits; /* In jiffies */
141
142 /* Register values */
143 u8 in[9];
144 u8 in_high[9];
145 u8 in_low[9];
146 u16 fan[3];
147 u16 fan_low[3];
148 u8 fan_enabled; /* Read once at init time */
149 u8 temp[3];
150 u8 temp_high[3];
151 u8 temp_hyst[3];
152 u8 temp_mode;
153 u8 alarms[3];
154};
155
156static inline long in_from_reg(u8 reg)
157{
158 return (reg * 8);
159}
160
161/* The 2 least significant bits are not used */
162static inline u8 in_to_reg(long val)
163{
164 if (val <= 0)
165 return 0;
166 if (val >= 2016)
167 return 0xfc;
168 return (((val + 16) / 32) << 2);
169}
170
171/* in0 is downscaled by a factor 2 internally */
172static inline long in0_from_reg(u8 reg)
173{
174 return (reg * 16);
175}
176
177static inline u8 in0_to_reg(long val)
178{
179 if (val <= 0)
180 return 0;
181 if (val >= 4032)
182 return 0xfc;
183 return (((val + 32) / 64) << 2);
184}
185
186/* The 4 most significant bits are not used */
187static inline long fan_from_reg(u16 reg)
188{
189 reg &= 0xfff;
190 if (!reg || reg == 0xfff)
191 return 0;
192 return (1500000 / reg);
193}
194
195static inline u16 fan_to_reg(long rpm)
196{
197 /* If the low limit is set below what the chip can measure,
198 store the largest possible 12-bit value in the registers,
199 so that no alarm will ever trigger. */
200 if (rpm < 367)
201 return 0xfff;
202 return (1500000 / rpm);
203}
204
205static inline long temp_from_reg(u8 reg)
206{
207 return (reg * 1000);
208}
209
210static inline u8 temp_to_reg(long val)
211{
212 if (val < 0)
213 val = 0;
214 else if (val > 1000 * 0xff)
215 val = 0xff;
216 return ((val + 500) / 1000);
217}
218
219/*
220 * Device I/O access
221 */
222
223static u8 f71805f_read8(struct f71805f_data *data, u8 reg)
224{
225 u8 val;
226
227 down(&data->lock);
228 outb(reg, data->addr + ADDR_REG_OFFSET);
229 val = inb(data->addr + DATA_REG_OFFSET);
230 up(&data->lock);
231
232 return val;
233}
234
235static void f71805f_write8(struct f71805f_data *data, u8 reg, u8 val)
236{
237 down(&data->lock);
238 outb(reg, data->addr + ADDR_REG_OFFSET);
239 outb(val, data->addr + DATA_REG_OFFSET);
240 up(&data->lock);
241}
242
243/* It is important to read the MSB first, because doing so latches the
244 value of the LSB, so we are sure both bytes belong to the same value. */
245static u16 f71805f_read16(struct f71805f_data *data, u8 reg)
246{
247 u16 val;
248
249 down(&data->lock);
250 outb(reg, data->addr + ADDR_REG_OFFSET);
251 val = inb(data->addr + DATA_REG_OFFSET) << 8;
252 outb(++reg, data->addr + ADDR_REG_OFFSET);
253 val |= inb(data->addr + DATA_REG_OFFSET);
254 up(&data->lock);
255
256 return val;
257}
258
259static void f71805f_write16(struct f71805f_data *data, u8 reg, u16 val)
260{
261 down(&data->lock);
262 outb(reg, data->addr + ADDR_REG_OFFSET);
263 outb(val >> 8, data->addr + DATA_REG_OFFSET);
264 outb(++reg, data->addr + ADDR_REG_OFFSET);
265 outb(val & 0xff, data->addr + DATA_REG_OFFSET);
266 up(&data->lock);
267}
268
269static struct f71805f_data *f71805f_update_device(struct device *dev)
270{
271 struct f71805f_data *data = dev_get_drvdata(dev);
272 int nr;
273
274 down(&data->update_lock);
275
276 /* Limit registers cache is refreshed after 60 seconds */
277 if (time_after(jiffies, data->last_updated + 60 * HZ)
278 || !data->valid) {
279 for (nr = 0; nr < 9; nr++) {
280 data->in_high[nr] = f71805f_read8(data,
281 F71805F_REG_IN_HIGH(nr));
282 data->in_low[nr] = f71805f_read8(data,
283 F71805F_REG_IN_LOW(nr));
284 }
285 for (nr = 0; nr < 3; nr++) {
286 if (data->fan_enabled & (1 << nr))
287 data->fan_low[nr] = f71805f_read16(data,
288 F71805F_REG_FAN_LOW(nr));
289 }
290 for (nr = 0; nr < 3; nr++) {
291 data->temp_high[nr] = f71805f_read8(data,
292 F71805F_REG_TEMP_HIGH(nr));
293 data->temp_hyst[nr] = f71805f_read8(data,
294 F71805F_REG_TEMP_HYST(nr));
295 }
296 data->temp_mode = f71805f_read8(data, F71805F_REG_TEMP_MODE);
297
298 data->last_limits = jiffies;
299 }
300
301 /* Measurement registers cache is refreshed after 1 second */
302 if (time_after(jiffies, data->last_updated + HZ)
303 || !data->valid) {
304 for (nr = 0; nr < 9; nr++) {
305 data->in[nr] = f71805f_read8(data,
306 F71805F_REG_IN(nr));
307 }
308 for (nr = 0; nr < 3; nr++) {
309 if (data->fan_enabled & (1 << nr))
310 data->fan[nr] = f71805f_read16(data,
311 F71805F_REG_FAN(nr));
312 }
313 for (nr = 0; nr < 3; nr++) {
314 data->temp[nr] = f71805f_read8(data,
315 F71805F_REG_TEMP(nr));
316 }
317 for (nr = 0; nr < 3; nr++) {
318 data->alarms[nr] = f71805f_read8(data,
319 F71805F_REG_STATUS(nr));
320 }
321
322 data->last_updated = jiffies;
323 data->valid = 1;
324 }
325
326 up(&data->update_lock);
327
328 return data;
329}
330
331/*
332 * Sysfs interface
333 */
334
335static ssize_t show_in0(struct device *dev, struct device_attribute *devattr,
336 char *buf)
337{
338 struct f71805f_data *data = f71805f_update_device(dev);
339
340 return sprintf(buf, "%ld\n", in0_from_reg(data->in[0]));
341}
342
343static ssize_t show_in0_max(struct device *dev, struct device_attribute
344 *devattr, char *buf)
345{
346 struct f71805f_data *data = f71805f_update_device(dev);
347
348 return sprintf(buf, "%ld\n", in0_from_reg(data->in_high[0]));
349}
350
351static ssize_t show_in0_min(struct device *dev, struct device_attribute
352 *devattr, char *buf)
353{
354 struct f71805f_data *data = f71805f_update_device(dev);
355
356 return sprintf(buf, "%ld\n", in0_from_reg(data->in_low[0]));
357}
358
359static ssize_t set_in0_max(struct device *dev, struct device_attribute
360 *devattr, const char *buf, size_t count)
361{
362 struct f71805f_data *data = dev_get_drvdata(dev);
363 long val = simple_strtol(buf, NULL, 10);
364
365 down(&data->update_lock);
366 data->in_high[0] = in0_to_reg(val);
367 f71805f_write8(data, F71805F_REG_IN_HIGH(0), data->in_high[0]);
368 up(&data->update_lock);
369
370 return count;
371}
372
373static ssize_t set_in0_min(struct device *dev, struct device_attribute
374 *devattr, const char *buf, size_t count)
375{
376 struct f71805f_data *data = dev_get_drvdata(dev);
377 long val = simple_strtol(buf, NULL, 10);
378
379 down(&data->update_lock);
380 data->in_low[0] = in0_to_reg(val);
381 f71805f_write8(data, F71805F_REG_IN_LOW(0), data->in_low[0]);
382 up(&data->update_lock);
383
384 return count;
385}
386
387static DEVICE_ATTR(in0_input, S_IRUGO, show_in0, NULL);
388static DEVICE_ATTR(in0_max, S_IRUGO| S_IWUSR, show_in0_max, set_in0_max);
389static DEVICE_ATTR(in0_min, S_IRUGO| S_IWUSR, show_in0_min, set_in0_min);
390
391static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
392 char *buf)
393{
394 struct f71805f_data *data = f71805f_update_device(dev);
395 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
396 int nr = attr->index;
397
398 return sprintf(buf, "%ld\n", in_from_reg(data->in[nr]));
399}
400
401static ssize_t show_in_max(struct device *dev, struct device_attribute
402 *devattr, char *buf)
403{
404 struct f71805f_data *data = f71805f_update_device(dev);
405 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
406 int nr = attr->index;
407
408 return sprintf(buf, "%ld\n", in_from_reg(data->in_high[nr]));
409}
410
411static ssize_t show_in_min(struct device *dev, struct device_attribute
412 *devattr, char *buf)
413{
414 struct f71805f_data *data = f71805f_update_device(dev);
415 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
416 int nr = attr->index;
417
418 return sprintf(buf, "%ld\n", in_from_reg(data->in_low[nr]));
419}
420
421static ssize_t set_in_max(struct device *dev, struct device_attribute
422 *devattr, const char *buf, size_t count)
423{
424 struct f71805f_data *data = dev_get_drvdata(dev);
425 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
426 int nr = attr->index;
427 long val = simple_strtol(buf, NULL, 10);
428
429 down(&data->update_lock);
430 data->in_high[nr] = in_to_reg(val);
431 f71805f_write8(data, F71805F_REG_IN_HIGH(nr), data->in_high[nr]);
432 up(&data->update_lock);
433
434 return count;
435}
436
437static ssize_t set_in_min(struct device *dev, struct device_attribute
438 *devattr, const char *buf, size_t count)
439{
440 struct f71805f_data *data = dev_get_drvdata(dev);
441 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
442 int nr = attr->index;
443 long val = simple_strtol(buf, NULL, 10);
444
445 down(&data->update_lock);
446 data->in_low[nr] = in_to_reg(val);
447 f71805f_write8(data, F71805F_REG_IN_LOW(nr), data->in_low[nr]);
448 up(&data->update_lock);
449
450 return count;
451}
452
453#define sysfs_in(offset) \
454static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
455 show_in, NULL, offset); \
456static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
457 show_in_max, set_in_max, offset); \
458static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
459 show_in_min, set_in_min, offset)
460
461sysfs_in(1);
462sysfs_in(2);
463sysfs_in(3);
464sysfs_in(4);
465sysfs_in(5);
466sysfs_in(6);
467sysfs_in(7);
468sysfs_in(8);
469
470static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
471 char *buf)
472{
473 struct f71805f_data *data = f71805f_update_device(dev);
474 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
475 int nr = attr->index;
476
477 return sprintf(buf, "%ld\n", fan_from_reg(data->fan[nr]));
478}
479
480static ssize_t show_fan_min(struct device *dev, struct device_attribute
481 *devattr, char *buf)
482{
483 struct f71805f_data *data = f71805f_update_device(dev);
484 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
485 int nr = attr->index;
486
487 return sprintf(buf, "%ld\n", fan_from_reg(data->fan_low[nr]));
488}
489
490static ssize_t set_fan_min(struct device *dev, struct device_attribute
491 *devattr, const char *buf, size_t count)
492{
493 struct f71805f_data *data = dev_get_drvdata(dev);
494 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
495 int nr = attr->index;
496 long val = simple_strtol(buf, NULL, 10);
497
498 down(&data->update_lock);
499 data->fan_low[nr] = fan_to_reg(val);
500 f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]);
501 up(&data->update_lock);
502
503 return count;
504}
505
506#define sysfs_fan(offset) \
507static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
508 show_fan, NULL, offset - 1); \
509static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
510 show_fan_min, set_fan_min, offset - 1)
511
512sysfs_fan(1);
513sysfs_fan(2);
514sysfs_fan(3);
515
516static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
517 char *buf)
518{
519 struct f71805f_data *data = f71805f_update_device(dev);
520 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
521 int nr = attr->index;
522
523 return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr]));
524}
525
526static ssize_t show_temp_max(struct device *dev, struct device_attribute
527 *devattr, char *buf)
528{
529 struct f71805f_data *data = f71805f_update_device(dev);
530 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
531 int nr = attr->index;
532
533 return sprintf(buf, "%ld\n", temp_from_reg(data->temp_high[nr]));
534}
535
536static ssize_t show_temp_hyst(struct device *dev, struct device_attribute
537 *devattr, char *buf)
538{
539 struct f71805f_data *data = f71805f_update_device(dev);
540 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
541 int nr = attr->index;
542
543 return sprintf(buf, "%ld\n", temp_from_reg(data->temp_hyst[nr]));
544}
545
546static ssize_t show_temp_type(struct device *dev, struct device_attribute
547 *devattr, char *buf)
548{
549 struct f71805f_data *data = f71805f_update_device(dev);
550 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
551 int nr = attr->index;
552
553 /* 3 is diode, 4 is thermistor */
554 return sprintf(buf, "%u\n", (data->temp_mode & (1 << nr)) ? 3 : 4);
555}
556
557static ssize_t set_temp_max(struct device *dev, struct device_attribute
558 *devattr, const char *buf, size_t count)
559{
560 struct f71805f_data *data = dev_get_drvdata(dev);
561 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
562 int nr = attr->index;
563 long val = simple_strtol(buf, NULL, 10);
564
565 down(&data->update_lock);
566 data->temp_high[nr] = temp_to_reg(val);
567 f71805f_write8(data, F71805F_REG_TEMP_HIGH(nr), data->temp_high[nr]);
568 up(&data->update_lock);
569
570 return count;
571}
572
573static ssize_t set_temp_hyst(struct device *dev, struct device_attribute
574 *devattr, const char *buf, size_t count)
575{
576 struct f71805f_data *data = dev_get_drvdata(dev);
577 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
578 int nr = attr->index;
579 long val = simple_strtol(buf, NULL, 10);
580
581 down(&data->update_lock);
582 data->temp_hyst[nr] = temp_to_reg(val);
583 f71805f_write8(data, F71805F_REG_TEMP_HYST(nr), data->temp_hyst[nr]);
584 up(&data->update_lock);
585
586 return count;
587}
588
589#define sysfs_temp(offset) \
590static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
591 show_temp, NULL, offset - 1); \
592static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
593 show_temp_max, set_temp_max, offset - 1); \
594static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \
595 show_temp_hyst, set_temp_hyst, offset - 1); \
596static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO, \
597 show_temp_type, NULL, offset - 1)
598
599sysfs_temp(1);
600sysfs_temp(2);
601sysfs_temp(3);
602
603static ssize_t show_alarms_in(struct device *dev, struct device_attribute
604 *devattr, char *buf)
605{
606 struct f71805f_data *data = f71805f_update_device(dev);
607
608 return sprintf(buf, "%d\n", data->alarms[0] |
609 ((data->alarms[1] & 0x01) << 8));
610}
611
612static ssize_t show_alarms_fan(struct device *dev, struct device_attribute
613 *devattr, char *buf)
614{
615 struct f71805f_data *data = f71805f_update_device(dev);
616
617 return sprintf(buf, "%d\n", data->alarms[2] & 0x07);
618}
619
620static ssize_t show_alarms_temp(struct device *dev, struct device_attribute
621 *devattr, char *buf)
622{
623 struct f71805f_data *data = f71805f_update_device(dev);
624
625 return sprintf(buf, "%d\n", (data->alarms[1] >> 3) & 0x07);
626}
627
628static DEVICE_ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL);
629static DEVICE_ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL);
630static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL);
631
632static ssize_t show_name(struct device *dev, struct device_attribute
633 *devattr, char *buf)
634{
635 struct f71805f_data *data = dev_get_drvdata(dev);
636
637 return sprintf(buf, "%s\n", data->name);
638}
639
640static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
641
642/*
643 * Device registration and initialization
644 */
645
646static void __devinit f71805f_init_device(struct f71805f_data *data)
647{
648 u8 reg;
649 int i;
650
651 reg = f71805f_read8(data, F71805F_REG_START);
652 if ((reg & 0x41) != 0x01) {
653 printk(KERN_DEBUG DRVNAME ": Starting monitoring "
654 "operations\n");
655 f71805f_write8(data, F71805F_REG_START, (reg | 0x01) & ~0x40);
656 }
657
658 /* Fan monitoring can be disabled. If it is, we won't be polling
659 the register values, and won't create the related sysfs files. */
660 for (i = 0; i < 3; i++) {
661 reg = f71805f_read8(data, F71805F_REG_FAN_CTRL(i));
662 if (!(reg & 0x80))
663 data->fan_enabled |= (1 << i);
664 }
665}
666
667static int __devinit f71805f_probe(struct platform_device *pdev)
668{
669 struct f71805f_data *data;
670 struct resource *res;
671 int err;
672
673 if (!(data = kzalloc(sizeof(struct f71805f_data), GFP_KERNEL))) {
674 err = -ENOMEM;
675 printk(KERN_ERR DRVNAME ": Out of memory\n");
676 goto exit;
677 }
678
679 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
680 data->addr = res->start;
681 init_MUTEX(&data->lock);
682 data->name = "f71805f";
683 init_MUTEX(&data->update_lock);
684
685 platform_set_drvdata(pdev, data);
686
687 data->class_dev = hwmon_device_register(&pdev->dev);
688 if (IS_ERR(data->class_dev)) {
689 err = PTR_ERR(data->class_dev);
690 dev_err(&pdev->dev, "Class registration failed (%d)\n", err);
691 goto exit_free;
692 }
693
694 /* Initialize the F71805F chip */
695 f71805f_init_device(data);
696
697 /* Register sysfs interface files */
698 device_create_file(&pdev->dev, &dev_attr_in0_input);
699 device_create_file(&pdev->dev, &dev_attr_in0_max);
700 device_create_file(&pdev->dev, &dev_attr_in0_min);
701 device_create_file(&pdev->dev, &sensor_dev_attr_in1_input.dev_attr);
702 device_create_file(&pdev->dev, &sensor_dev_attr_in2_input.dev_attr);
703 device_create_file(&pdev->dev, &sensor_dev_attr_in3_input.dev_attr);
704 device_create_file(&pdev->dev, &sensor_dev_attr_in4_input.dev_attr);
705 device_create_file(&pdev->dev, &sensor_dev_attr_in5_input.dev_attr);
706 device_create_file(&pdev->dev, &sensor_dev_attr_in6_input.dev_attr);
707 device_create_file(&pdev->dev, &sensor_dev_attr_in7_input.dev_attr);
708 device_create_file(&pdev->dev, &sensor_dev_attr_in8_input.dev_attr);
709 device_create_file(&pdev->dev, &sensor_dev_attr_in1_max.dev_attr);
710 device_create_file(&pdev->dev, &sensor_dev_attr_in2_max.dev_attr);
711 device_create_file(&pdev->dev, &sensor_dev_attr_in3_max.dev_attr);
712 device_create_file(&pdev->dev, &sensor_dev_attr_in4_max.dev_attr);
713 device_create_file(&pdev->dev, &sensor_dev_attr_in5_max.dev_attr);
714 device_create_file(&pdev->dev, &sensor_dev_attr_in6_max.dev_attr);
715 device_create_file(&pdev->dev, &sensor_dev_attr_in7_max.dev_attr);
716 device_create_file(&pdev->dev, &sensor_dev_attr_in8_max.dev_attr);
717 device_create_file(&pdev->dev, &sensor_dev_attr_in1_min.dev_attr);
718 device_create_file(&pdev->dev, &sensor_dev_attr_in2_min.dev_attr);
719 device_create_file(&pdev->dev, &sensor_dev_attr_in3_min.dev_attr);
720 device_create_file(&pdev->dev, &sensor_dev_attr_in4_min.dev_attr);
721 device_create_file(&pdev->dev, &sensor_dev_attr_in5_min.dev_attr);
722 device_create_file(&pdev->dev, &sensor_dev_attr_in6_min.dev_attr);
723 device_create_file(&pdev->dev, &sensor_dev_attr_in7_min.dev_attr);
724 device_create_file(&pdev->dev, &sensor_dev_attr_in8_min.dev_attr);
725 if (data->fan_enabled & (1 << 0)) {
726 device_create_file(&pdev->dev,
727 &sensor_dev_attr_fan1_input.dev_attr);
728 device_create_file(&pdev->dev,
729 &sensor_dev_attr_fan1_min.dev_attr);
730 }
731 if (data->fan_enabled & (1 << 1)) {
732 device_create_file(&pdev->dev,
733 &sensor_dev_attr_fan2_input.dev_attr);
734 device_create_file(&pdev->dev,
735 &sensor_dev_attr_fan2_min.dev_attr);
736 }
737 if (data->fan_enabled & (1 << 2)) {
738 device_create_file(&pdev->dev,
739 &sensor_dev_attr_fan3_input.dev_attr);
740 device_create_file(&pdev->dev,
741 &sensor_dev_attr_fan3_min.dev_attr);
742 }
743 device_create_file(&pdev->dev,
744 &sensor_dev_attr_temp1_input.dev_attr);
745 device_create_file(&pdev->dev,
746 &sensor_dev_attr_temp2_input.dev_attr);
747 device_create_file(&pdev->dev,
748 &sensor_dev_attr_temp3_input.dev_attr);
749 device_create_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
750 device_create_file(&pdev->dev, &sensor_dev_attr_temp2_max.dev_attr);
751 device_create_file(&pdev->dev, &sensor_dev_attr_temp3_max.dev_attr);
752 device_create_file(&pdev->dev,
753 &sensor_dev_attr_temp1_max_hyst.dev_attr);
754 device_create_file(&pdev->dev,
755 &sensor_dev_attr_temp2_max_hyst.dev_attr);
756 device_create_file(&pdev->dev,
757 &sensor_dev_attr_temp3_max_hyst.dev_attr);
758 device_create_file(&pdev->dev, &sensor_dev_attr_temp1_type.dev_attr);
759 device_create_file(&pdev->dev, &sensor_dev_attr_temp2_type.dev_attr);
760 device_create_file(&pdev->dev, &sensor_dev_attr_temp3_type.dev_attr);
761 device_create_file(&pdev->dev, &dev_attr_alarms_in);
762 device_create_file(&pdev->dev, &dev_attr_alarms_fan);
763 device_create_file(&pdev->dev, &dev_attr_alarms_temp);
764 device_create_file(&pdev->dev, &dev_attr_name);
765
766 return 0;
767
768exit_free:
769 kfree(data);
770exit:
771 return err;
772}
773
774static int __devexit f71805f_remove(struct platform_device *pdev)
775{
776 struct f71805f_data *data = platform_get_drvdata(pdev);
777
778 platform_set_drvdata(pdev, NULL);
779 hwmon_device_unregister(data->class_dev);
780 kfree(data);
781
782 return 0;
783}
784
785static struct platform_driver f71805f_driver = {
786 .driver = {
787 .owner = THIS_MODULE,
788 .name = DRVNAME,
789 },
790 .probe = f71805f_probe,
791 .remove = __devexit_p(f71805f_remove),
792};
793
794static int __init f71805f_device_add(unsigned short address)
795{
796 int err;
797
798 pdev = platform_device_alloc(DRVNAME, address);
799 if (!pdev) {
800 err = -ENOMEM;
801 printk(KERN_ERR DRVNAME ": Device allocation failed\n");
802 goto exit;
803 }
804
805 f71805f_resource.start = address;
806 f71805f_resource.end = address + REGION_LENGTH - 1;
807 f71805f_resource.name = pdev->name;
808 err = platform_device_add_resources(pdev, &f71805f_resource, 1);
809 if (err) {
810 printk(KERN_ERR DRVNAME ": Device resource addition failed "
811 "(%d)\n", err);
812 goto exit_device_put;
813 }
814
815 err = platform_device_add(pdev);
816 if (err) {
817 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
818 err);
819 goto exit_device_put;
820 }
821
822 return 0;
823
824exit_device_put:
825 platform_device_put(pdev);
826exit:
827 return err;
828}
829
830static int __init f71805f_find(int sioaddr, unsigned short *address)
831{
832 int err = -ENODEV;
833 u16 devid;
834
835 superio_enter(sioaddr);
836
837 devid = superio_inw(sioaddr, SIO_REG_MANID);
838 if (devid != SIO_FINTEK_ID)
839 goto exit;
840
841 devid = superio_inw(sioaddr, SIO_REG_DEVID);
842 if (devid != SIO_F71805F_ID) {
843 printk(KERN_INFO DRVNAME ": Unsupported Fintek device, "
844 "skipping\n");
845 goto exit;
846 }
847
848 superio_select(sioaddr, F71805F_LD_HWM);
849 if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {
850 printk(KERN_WARNING DRVNAME ": Device not activated, "
851 "skipping\n");
852 goto exit;
853 }
854
855 *address = superio_inw(sioaddr, SIO_REG_ADDR);
856 if (*address == 0) {
857 printk(KERN_WARNING DRVNAME ": Base address not set, "
858 "skipping\n");
859 goto exit;
860 }
861
862 err = 0;
863 printk(KERN_INFO DRVNAME ": Found F71805F chip at %#x, revision %u\n",
864 *address, superio_inb(sioaddr, SIO_REG_DEVREV));
865
866exit:
867 superio_exit(sioaddr);
868 return err;
869}
870
871static int __init f71805f_init(void)
872{
873 int err;
874 unsigned short address;
875
876 if (f71805f_find(0x2e, &address)
877 && f71805f_find(0x4e, &address))
878 return -ENODEV;
879
880 err = platform_driver_register(&f71805f_driver);
881 if (err)
882 goto exit;
883
884 /* Sets global pdev as a side effect */
885 err = f71805f_device_add(address);
886 if (err)
887 goto exit_driver;
888
889 return 0;
890
891exit_driver:
892 platform_driver_unregister(&f71805f_driver);
893exit:
894 return err;
895}
896
897static void __exit f71805f_exit(void)
898{
899 platform_device_unregister(pdev);
900 platform_driver_unregister(&f71805f_driver);
901}
902
903MODULE_AUTHOR("Jean Delvare <khali@linux-fr>");
904MODULE_LICENSE("GPL");
905MODULE_DESCRIPTION("F71805F hardware monitoring driver");
906
907module_init(f71805f_init);
908module_exit(f71805f_exit);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0da7c9c508c3..e87d52c59940 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -45,8 +45,7 @@
45 45
46 46
47/* Addresses to scan */ 47/* Addresses to scan */
48static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 48static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
49 0x2e, 0x2f, I2C_CLIENT_END };
50static unsigned short isa_address; 49static unsigned short isa_address;
51 50
52/* Insmod parameters */ 51/* Insmod parameters */
@@ -830,6 +829,11 @@ static int it87_detect(struct i2c_adapter *adapter, int address, int kind)
830 if ((err = i2c_attach_client(new_client))) 829 if ((err = i2c_attach_client(new_client)))
831 goto ERROR2; 830 goto ERROR2;
832 831
832 if (!is_isa)
833 dev_info(&new_client->dev, "The I2C interface to IT87xxF "
834 "hardware monitoring chips is deprecated. Please "
835 "report if you still rely on it.\n");
836
833 /* Check PWM configuration */ 837 /* Check PWM configuration */
834 enable_pwm_interface = it87_check_pwm(new_client); 838 enable_pwm_interface = it87_check_pwm(new_client);
835 839
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
index a2f420d01fb7..df9e02aaa70a 100644
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -87,15 +87,15 @@ static struct i2c_driver lm77_driver = {
87 87
88/* In the temperature registers, the low 3 bits are not part of the 88/* In the temperature registers, the low 3 bits are not part of the
89 temperature values; they are the status bits. */ 89 temperature values; they are the status bits. */
90static inline u16 LM77_TEMP_TO_REG(int temp) 90static inline s16 LM77_TEMP_TO_REG(int temp)
91{ 91{
92 int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX); 92 int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX);
93 return (u16)((ntemp / 500) * 8); 93 return (ntemp / 500) * 8;
94} 94}
95 95
96static inline int LM77_TEMP_FROM_REG(u16 reg) 96static inline int LM77_TEMP_FROM_REG(s16 reg)
97{ 97{
98 return ((int)reg / 8) * 500; 98 return (reg / 8) * 500;
99} 99}
100 100
101/* sysfs stuff */ 101/* sysfs stuff */
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index b176bf0c4c7b..a2f6bb676235 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -303,10 +303,6 @@ struct w83792d_data {
303static int w83792d_attach_adapter(struct i2c_adapter *adapter); 303static int w83792d_attach_adapter(struct i2c_adapter *adapter);
304static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind); 304static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind);
305static int w83792d_detach_client(struct i2c_client *client); 305static int w83792d_detach_client(struct i2c_client *client);
306
307static int w83792d_read_value(struct i2c_client *client, u8 register);
308static int w83792d_write_value(struct i2c_client *client, u8 register,
309 u8 value);
310static struct w83792d_data *w83792d_update_device(struct device *dev); 306static struct w83792d_data *w83792d_update_device(struct device *dev);
311 307
312#ifdef DEBUG 308#ifdef DEBUG
@@ -329,6 +325,20 @@ static inline long in_count_from_reg(int nr, struct w83792d_data *data)
329 return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03)); 325 return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03));
330} 326}
331 327
328/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
329 but the driver only accesses registers in bank 0, so we don't have
330 to switch banks and lock access between switches. */
331static inline int w83792d_read_value(struct i2c_client *client, u8 reg)
332{
333 return i2c_smbus_read_byte_data(client, reg);
334}
335
336static inline int
337w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
338{
339 return i2c_smbus_write_byte_data(client, reg, value);
340}
341
332/* following are the sysfs callback functions */ 342/* following are the sysfs callback functions */
333static ssize_t show_in(struct device *dev, struct device_attribute *attr, 343static ssize_t show_in(struct device *dev, struct device_attribute *attr,
334 char *buf) 344 char *buf)
@@ -1386,19 +1396,6 @@ w83792d_detach_client(struct i2c_client *client)
1386 return 0; 1396 return 0;
1387} 1397}
1388 1398
1389/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
1390 but the driver only accesses registers in bank 0, so we don't have
1391 to switch banks and lock access between switches. */
1392static int w83792d_read_value(struct i2c_client *client, u8 reg)
1393{
1394 return i2c_smbus_read_byte_data(client, reg);
1395}
1396
1397static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
1398{
1399 return i2c_smbus_write_byte_data(client, reg, value);
1400}
1401
1402static void 1399static void
1403w83792d_init_client(struct i2c_client *client) 1400w83792d_init_client(struct i2c_client *client)
1404{ 1401{
diff --git a/drivers/i2c/algos/i2c-algo-sibyte.c b/drivers/i2c/algos/i2c-algo-sibyte.c
index 938848ae162d..3df3f09995c2 100644
--- a/drivers/i2c/algos/i2c-algo-sibyte.c
+++ b/drivers/i2c/algos/i2c-algo-sibyte.c
@@ -202,7 +202,7 @@ EXPORT_SYMBOL(i2c_sibyte_del_bus);
202#ifdef MODULE 202#ifdef MODULE
203MODULE_AUTHOR("Kip Walker, Broadcom Corp."); 203MODULE_AUTHOR("Kip Walker, Broadcom Corp.");
204MODULE_DESCRIPTION("SiByte I2C-Bus algorithm"); 204MODULE_DESCRIPTION("SiByte I2C-Bus algorithm");
205MODULE_PARM(bit_scan, "i"); 205module_param(bit_scan, int, 0);
206MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus"); 206MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus");
207MODULE_LICENSE("GPL"); 207MODULE_LICENSE("GPL");
208 208
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 08d5b8fed2dc..ff92735c7c85 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -124,6 +124,7 @@ config I2C_I801
124 ICH6 124 ICH6
125 ICH7 125 ICH7
126 ESB2 126 ESB2
127 ICH8
127 128
128 This driver can also be built as a module. If so, the module 129 This driver can also be built as a module. If so, the module
129 will be called i2c-i801. 130 will be called i2c-i801.
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 1c752ddc10e2..8e0f3158215f 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -32,6 +32,7 @@
32 ICH6 266A 32 ICH6 266A
33 ICH7 27DA 33 ICH7 27DA
34 ESB2 269B 34 ESB2 269B
35 ICH8 283E
35 This driver supports several versions of Intel's I/O Controller Hubs (ICH). 36 This driver supports several versions of Intel's I/O Controller Hubs (ICH).
36 For SMBus support, they are similar to the PIIX4 and are part 37 For SMBus support, they are similar to the PIIX4 and are part
37 of Intel's '810' and other chipsets. 38 of Intel's '810' and other chipsets.
@@ -527,6 +528,7 @@ static struct pci_device_id i801_ids[] = {
527 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_16) }, 528 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_16) },
528 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) }, 529 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) },
529 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) }, 530 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) },
531 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) },
530 { 0, } 532 { 0, }
531}; 533};
532 534
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 3e5eba9fcacb..c63025a4c861 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -121,14 +121,11 @@ static struct i2c_adapter parport_adapter = {
121 121
122static int __init i2c_parport_init(void) 122static int __init i2c_parport_init(void)
123{ 123{
124 int type_count; 124 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
125
126 type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
127 if (type < 0 || type >= type_count) {
128 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 125 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
129 type = 0; 126 type = 0;
130 } 127 }
131 128
132 if (base == 0) { 129 if (base == 0) {
133 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE); 130 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);
134 base = DEFAULT_BASE; 131 base = DEFAULT_BASE;
@@ -152,7 +149,7 @@ static int __init i2c_parport_init(void)
152 release_region(base, 3); 149 release_region(base, 3);
153 return -ENODEV; 150 return -ENODEV;
154 } 151 }
155 152
156 return 0; 153 return 0;
157} 154}
158 155
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 2854d858fc9b..7e2e8cd1c14a 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -241,14 +241,11 @@ static struct parport_driver i2c_parport_driver = {
241 241
242static int __init i2c_parport_init(void) 242static int __init i2c_parport_init(void)
243{ 243{
244 int type_count; 244 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
245
246 type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
247 if (type < 0 || type >= type_count) {
248 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 245 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
249 type = 0; 246 type = 0;
250 } 247 }
251 248
252 return parport_register_driver(&i2c_parport_driver); 249 return parport_register_driver(&i2c_parport_driver);
253} 250}
254 251
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 86e2234faf80..7579f4b256a8 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -861,7 +861,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id, struct pt_regs *r
861 decode_ISR(isr); 861 decode_ISR(isr);
862 } 862 }
863 863
864 if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32)) 864 if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog))
865 i2c->isrlog[i2c->irqlogidx++] = isr; 865 i2c->isrlog[i2c->irqlogidx++] = isr;
866 866
867 show_state(i2c); 867 show_state(i2c);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 0ce58b506046..1a2c9ab5d9e3 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -946,6 +946,20 @@ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *val
946 } 946 }
947} 947}
948 948
949s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,
950 u8 length, u8 *values)
951{
952 union i2c_smbus_data data;
953
954 if (length > I2C_SMBUS_BLOCK_MAX)
955 length = I2C_SMBUS_BLOCK_MAX;
956 data.block[0] = length;
957 memcpy(data.block + 1, values, length);
958 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
959 I2C_SMBUS_WRITE, command,
960 I2C_SMBUS_I2C_BLOCK_DATA, &data);
961}
962
949/* Simulate a SMBus command using the i2c protocol 963/* Simulate a SMBus command using the i2c protocol
950 No checking of parameters is done! */ 964 No checking of parameters is done! */
951static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, 965static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
@@ -1150,6 +1164,7 @@ EXPORT_SYMBOL(i2c_smbus_read_word_data);
1150EXPORT_SYMBOL(i2c_smbus_write_word_data); 1164EXPORT_SYMBOL(i2c_smbus_write_word_data);
1151EXPORT_SYMBOL(i2c_smbus_write_block_data); 1165EXPORT_SYMBOL(i2c_smbus_write_block_data);
1152EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); 1166EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
1167EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data);
1153 1168
1154MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 1169MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
1155MODULE_DESCRIPTION("I2C-Bus main module"); 1170MODULE_DESCRIPTION("I2C-Bus main module");
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 6c60a9d2afd8..09086b8b6486 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -190,7 +190,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
190 if (lba48) { 190 if (lba48) {
191 task_ioreg_t tasklets[10]; 191 task_ioreg_t tasklets[10];
192 192
193 pr_debug("%s: LBA=0x%012llx\n", drive->name, block); 193 pr_debug("%s: LBA=0x%012llx\n", drive->name,
194 (unsigned long long)block);
194 195
195 tasklets[0] = 0; 196 tasklets[0] = 0;
196 tasklets[1] = 0; 197 tasklets[1] = 0;
@@ -317,7 +318,8 @@ static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, s
317 318
318 pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", 319 pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n",
319 drive->name, rq_data_dir(rq) == READ ? "read" : "writ", 320 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
320 block, rq->nr_sectors, (unsigned long)rq->buffer); 321 (unsigned long long)block, rq->nr_sectors,
322 (unsigned long)rq->buffer);
321 323
322 if (hwif->rw_disk) 324 if (hwif->rw_disk)
323 hwif->rw_disk(drive, rq); 325 hwif->rw_disk(drive, rq);
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index e95c4293a496..f6a05965a4e8 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1319,15 +1319,6 @@ static struct class ucm_class = {
1319 .release = ib_ucm_release_class_dev 1319 .release = ib_ucm_release_class_dev
1320}; 1320};
1321 1321
1322static ssize_t show_dev(struct class_device *class_dev, char *buf)
1323{
1324 struct ib_ucm_device *dev;
1325
1326 dev = container_of(class_dev, struct ib_ucm_device, class_dev);
1327 return print_dev_t(buf, dev->dev.dev);
1328}
1329static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
1330
1331static ssize_t show_ibdev(struct class_device *class_dev, char *buf) 1322static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
1332{ 1323{
1333 struct ib_ucm_device *dev; 1324 struct ib_ucm_device *dev;
@@ -1364,15 +1355,13 @@ static void ib_ucm_add_one(struct ib_device *device)
1364 1355
1365 ucm_dev->class_dev.class = &ucm_class; 1356 ucm_dev->class_dev.class = &ucm_class;
1366 ucm_dev->class_dev.dev = device->dma_device; 1357 ucm_dev->class_dev.dev = device->dma_device;
1358 ucm_dev->class_dev.devt = ucm_dev->dev.dev;
1367 snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d", 1359 snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d",
1368 ucm_dev->devnum); 1360 ucm_dev->devnum);
1369 if (class_device_register(&ucm_dev->class_dev)) 1361 if (class_device_register(&ucm_dev->class_dev))
1370 goto err_cdev; 1362 goto err_cdev;
1371 1363
1372 if (class_device_create_file(&ucm_dev->class_dev, 1364 if (class_device_create_file(&ucm_dev->class_dev,
1373 &class_device_attr_dev))
1374 goto err_class;
1375 if (class_device_create_file(&ucm_dev->class_dev,
1376 &class_device_attr_ibdev)) 1365 &class_device_attr_ibdev))
1377 goto err_class; 1366 goto err_class;
1378 1367
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 0ef560144be3..6dfc94122dd9 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -351,7 +351,7 @@ config HISAX_ENTERNOW_PCI
351 351
352config HISAX_AMD7930 352config HISAX_AMD7930
353 bool "Am7930 (EXPERIMENTAL)" 353 bool "Am7930 (EXPERIMENTAL)"
354 depends on EXPERIMENTAL && SPARC 354 depends on EXPERIMENTAL && SPARC && BROKEN
355 help 355 help
356 This enables HiSax support for the AMD7930 chips on some SPARCs. 356 This enables HiSax support for the AMD7930 chips on some SPARCs.
357 This code is not finished yet. 357 This code is not finished yet.
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 7d4a0ac28c06..12ad462737ba 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -187,6 +187,14 @@ config WINDFARM_PM91
187 This driver provides thermal control for the PowerMac9,1 187 This driver provides thermal control for the PowerMac9,1
188 which is the recent (SMU based) single CPU desktop G5 188 which is the recent (SMU based) single CPU desktop G5
189 189
190config WINDFARM_PM112
191 tristate "Support for thermal management on PowerMac11,2"
192 depends on WINDFARM && I2C && PMAC_SMU
193 select I2C_POWERMAC
194 help
195 This driver provides thermal control for the PowerMac11,2
196 which are the recent dual and quad G5 machines using the
197 970MP dual-core processor.
190 198
191config ANSLCD 199config ANSLCD
192 tristate "Support for ANS LCD display" 200 tristate "Support for ANS LCD display"
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index f4657aa81fb0..6081acdea404 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -35,3 +35,8 @@ obj-$(CONFIG_WINDFARM_PM91) += windfarm_smu_controls.o \
35 windfarm_smu_sensors.o \ 35 windfarm_smu_sensors.o \
36 windfarm_lm75_sensor.o windfarm_pid.o \ 36 windfarm_lm75_sensor.o windfarm_pid.o \
37 windfarm_cpufreq_clamp.o windfarm_pm91.o 37 windfarm_cpufreq_clamp.o windfarm_pm91.o
38obj-$(CONFIG_WINDFARM_PM112) += windfarm_pm112.o windfarm_smu_sat.o \
39 windfarm_smu_controls.o \
40 windfarm_smu_sensors.o \
41 windfarm_max6690_sensor.o \
42 windfarm_lm75_sensor.o windfarm_pid.o
diff --git a/drivers/macintosh/windfarm.h b/drivers/macintosh/windfarm.h
index 3f0cb0312ea3..7a2482cc26a7 100644
--- a/drivers/macintosh/windfarm.h
+++ b/drivers/macintosh/windfarm.h
@@ -14,6 +14,7 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <linux/device.h>
17 18
18/* Display a 16.16 fixed point value */ 19/* Display a 16.16 fixed point value */
19#define FIX32TOPRINT(f) ((f) >> 16),((((f) & 0xffff) * 1000) >> 16) 20#define FIX32TOPRINT(f) ((f) >> 16),((((f) & 0xffff) * 1000) >> 16)
@@ -39,6 +40,7 @@ struct wf_control {
39 char *name; 40 char *name;
40 int type; 41 int type;
41 struct kref ref; 42 struct kref ref;
43 struct device_attribute attr;
42}; 44};
43 45
44#define WF_CONTROL_TYPE_GENERIC 0 46#define WF_CONTROL_TYPE_GENERIC 0
@@ -87,6 +89,7 @@ struct wf_sensor {
87 struct wf_sensor_ops *ops; 89 struct wf_sensor_ops *ops;
88 char *name; 90 char *name;
89 struct kref ref; 91 struct kref ref;
92 struct device_attribute attr;
90}; 93};
91 94
92/* Same lifetime rules as controls */ 95/* Same lifetime rules as controls */
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 6c2a471ea6c0..bb8d5efe19bf 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -33,6 +33,7 @@
33#include <linux/reboot.h> 33#include <linux/reboot.h>
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/mutex.h>
36 37
37#include "windfarm.h" 38#include "windfarm.h"
38 39
@@ -48,13 +49,17 @@
48 49
49static LIST_HEAD(wf_controls); 50static LIST_HEAD(wf_controls);
50static LIST_HEAD(wf_sensors); 51static LIST_HEAD(wf_sensors);
51static DECLARE_MUTEX(wf_lock); 52static DEFINE_MUTEX(wf_lock);
52static struct notifier_block *wf_client_list; 53static struct notifier_block *wf_client_list;
53static int wf_client_count; 54static int wf_client_count;
54static unsigned int wf_overtemp; 55static unsigned int wf_overtemp;
55static unsigned int wf_overtemp_counter; 56static unsigned int wf_overtemp_counter;
56struct task_struct *wf_thread; 57struct task_struct *wf_thread;
57 58
59static struct platform_device wf_platform_device = {
60 .name = "windfarm",
61};
62
58/* 63/*
59 * Utilities & tick thread 64 * Utilities & tick thread
60 */ 65 */
@@ -156,26 +161,67 @@ static void wf_control_release(struct kref *kref)
156 kfree(ct); 161 kfree(ct);
157} 162}
158 163
164static ssize_t wf_show_control(struct device *dev,
165 struct device_attribute *attr, char *buf)
166{
167 struct wf_control *ctrl = container_of(attr, struct wf_control, attr);
168 s32 val = 0;
169 int err;
170
171 err = ctrl->ops->get_value(ctrl, &val);
172 if (err < 0)
173 return err;
174 return sprintf(buf, "%d\n", val);
175}
176
177/* This is really only for debugging... */
178static ssize_t wf_store_control(struct device *dev,
179 struct device_attribute *attr,
180 const char *buf, size_t count)
181{
182 struct wf_control *ctrl = container_of(attr, struct wf_control, attr);
183 int val;
184 int err;
185 char *endp;
186
187 val = simple_strtoul(buf, &endp, 0);
188 while (endp < buf + count && (*endp == ' ' || *endp == '\n'))
189 ++endp;
190 if (endp - buf < count)
191 return -EINVAL;
192 err = ctrl->ops->set_value(ctrl, val);
193 if (err < 0)
194 return err;
195 return count;
196}
197
159int wf_register_control(struct wf_control *new_ct) 198int wf_register_control(struct wf_control *new_ct)
160{ 199{
161 struct wf_control *ct; 200 struct wf_control *ct;
162 201
163 down(&wf_lock); 202 mutex_lock(&wf_lock);
164 list_for_each_entry(ct, &wf_controls, link) { 203 list_for_each_entry(ct, &wf_controls, link) {
165 if (!strcmp(ct->name, new_ct->name)) { 204 if (!strcmp(ct->name, new_ct->name)) {
166 printk(KERN_WARNING "windfarm: trying to register" 205 printk(KERN_WARNING "windfarm: trying to register"
167 " duplicate control %s\n", ct->name); 206 " duplicate control %s\n", ct->name);
168 up(&wf_lock); 207 mutex_unlock(&wf_lock);
169 return -EEXIST; 208 return -EEXIST;
170 } 209 }
171 } 210 }
172 kref_init(&new_ct->ref); 211 kref_init(&new_ct->ref);
173 list_add(&new_ct->link, &wf_controls); 212 list_add(&new_ct->link, &wf_controls);
174 213
214 new_ct->attr.attr.name = new_ct->name;
215 new_ct->attr.attr.owner = THIS_MODULE;
216 new_ct->attr.attr.mode = 0644;
217 new_ct->attr.show = wf_show_control;
218 new_ct->attr.store = wf_store_control;
219 device_create_file(&wf_platform_device.dev, &new_ct->attr);
220
175 DBG("wf: Registered control %s\n", new_ct->name); 221 DBG("wf: Registered control %s\n", new_ct->name);
176 222
177 wf_notify(WF_EVENT_NEW_CONTROL, new_ct); 223 wf_notify(WF_EVENT_NEW_CONTROL, new_ct);
178 up(&wf_lock); 224 mutex_unlock(&wf_lock);
179 225
180 return 0; 226 return 0;
181} 227}
@@ -183,9 +229,9 @@ EXPORT_SYMBOL_GPL(wf_register_control);
183 229
184void wf_unregister_control(struct wf_control *ct) 230void wf_unregister_control(struct wf_control *ct)
185{ 231{
186 down(&wf_lock); 232 mutex_lock(&wf_lock);
187 list_del(&ct->link); 233 list_del(&ct->link);
188 up(&wf_lock); 234 mutex_unlock(&wf_lock);
189 235
190 DBG("wf: Unregistered control %s\n", ct->name); 236 DBG("wf: Unregistered control %s\n", ct->name);
191 237
@@ -197,16 +243,16 @@ struct wf_control * wf_find_control(const char *name)
197{ 243{
198 struct wf_control *ct; 244 struct wf_control *ct;
199 245
200 down(&wf_lock); 246 mutex_lock(&wf_lock);
201 list_for_each_entry(ct, &wf_controls, link) { 247 list_for_each_entry(ct, &wf_controls, link) {
202 if (!strcmp(ct->name, name)) { 248 if (!strcmp(ct->name, name)) {
203 if (wf_get_control(ct)) 249 if (wf_get_control(ct))
204 ct = NULL; 250 ct = NULL;
205 up(&wf_lock); 251 mutex_unlock(&wf_lock);
206 return ct; 252 return ct;
207 } 253 }
208 } 254 }
209 up(&wf_lock); 255 mutex_unlock(&wf_lock);
210 return NULL; 256 return NULL;
211} 257}
212EXPORT_SYMBOL_GPL(wf_find_control); 258EXPORT_SYMBOL_GPL(wf_find_control);
@@ -246,26 +292,46 @@ static void wf_sensor_release(struct kref *kref)
246 kfree(sr); 292 kfree(sr);
247} 293}
248 294
295static ssize_t wf_show_sensor(struct device *dev,
296 struct device_attribute *attr, char *buf)
297{
298 struct wf_sensor *sens = container_of(attr, struct wf_sensor, attr);
299 s32 val = 0;
300 int err;
301
302 err = sens->ops->get_value(sens, &val);
303 if (err < 0)
304 return err;
305 return sprintf(buf, "%d.%03d\n", FIX32TOPRINT(val));
306}
307
249int wf_register_sensor(struct wf_sensor *new_sr) 308int wf_register_sensor(struct wf_sensor *new_sr)
250{ 309{
251 struct wf_sensor *sr; 310 struct wf_sensor *sr;
252 311
253 down(&wf_lock); 312 mutex_lock(&wf_lock);
254 list_for_each_entry(sr, &wf_sensors, link) { 313 list_for_each_entry(sr, &wf_sensors, link) {
255 if (!strcmp(sr->name, new_sr->name)) { 314 if (!strcmp(sr->name, new_sr->name)) {
256 printk(KERN_WARNING "windfarm: trying to register" 315 printk(KERN_WARNING "windfarm: trying to register"
257 " duplicate sensor %s\n", sr->name); 316 " duplicate sensor %s\n", sr->name);
258 up(&wf_lock); 317 mutex_unlock(&wf_lock);
259 return -EEXIST; 318 return -EEXIST;
260 } 319 }
261 } 320 }
262 kref_init(&new_sr->ref); 321 kref_init(&new_sr->ref);
263 list_add(&new_sr->link, &wf_sensors); 322 list_add(&new_sr->link, &wf_sensors);
264 323
324 new_sr->attr.attr.name = new_sr->name;
325 new_sr->attr.attr.owner = THIS_MODULE;
326 new_sr->attr.attr.mode = 0444;
327 new_sr->attr.show = wf_show_sensor;
328 new_sr->attr.store = NULL;
329 device_create_file(&wf_platform_device.dev, &new_sr->attr);
330
265 DBG("wf: Registered sensor %s\n", new_sr->name); 331 DBG("wf: Registered sensor %s\n", new_sr->name);
266 332
267 wf_notify(WF_EVENT_NEW_SENSOR, new_sr); 333 wf_notify(WF_EVENT_NEW_SENSOR, new_sr);
268 up(&wf_lock); 334 mutex_unlock(&wf_lock);
269 335
270 return 0; 336 return 0;
271} 337}
@@ -273,9 +339,9 @@ EXPORT_SYMBOL_GPL(wf_register_sensor);
273 339
274void wf_unregister_sensor(struct wf_sensor *sr) 340void wf_unregister_sensor(struct wf_sensor *sr)
275{ 341{
276 down(&wf_lock); 342 mutex_lock(&wf_lock);
277 list_del(&sr->link); 343 list_del(&sr->link);
278 up(&wf_lock); 344 mutex_unlock(&wf_lock);
279 345
280 DBG("wf: Unregistered sensor %s\n", sr->name); 346 DBG("wf: Unregistered sensor %s\n", sr->name);
281 347
@@ -287,16 +353,16 @@ struct wf_sensor * wf_find_sensor(const char *name)
287{ 353{
288 struct wf_sensor *sr; 354 struct wf_sensor *sr;
289 355
290 down(&wf_lock); 356 mutex_lock(&wf_lock);
291 list_for_each_entry(sr, &wf_sensors, link) { 357 list_for_each_entry(sr, &wf_sensors, link) {
292 if (!strcmp(sr->name, name)) { 358 if (!strcmp(sr->name, name)) {
293 if (wf_get_sensor(sr)) 359 if (wf_get_sensor(sr))
294 sr = NULL; 360 sr = NULL;
295 up(&wf_lock); 361 mutex_unlock(&wf_lock);
296 return sr; 362 return sr;
297 } 363 }
298 } 364 }
299 up(&wf_lock); 365 mutex_unlock(&wf_lock);
300 return NULL; 366 return NULL;
301} 367}
302EXPORT_SYMBOL_GPL(wf_find_sensor); 368EXPORT_SYMBOL_GPL(wf_find_sensor);
@@ -329,7 +395,7 @@ int wf_register_client(struct notifier_block *nb)
329 struct wf_control *ct; 395 struct wf_control *ct;
330 struct wf_sensor *sr; 396 struct wf_sensor *sr;
331 397
332 down(&wf_lock); 398 mutex_lock(&wf_lock);
333 rc = notifier_chain_register(&wf_client_list, nb); 399 rc = notifier_chain_register(&wf_client_list, nb);
334 if (rc != 0) 400 if (rc != 0)
335 goto bail; 401 goto bail;
@@ -341,19 +407,19 @@ int wf_register_client(struct notifier_block *nb)
341 if (wf_client_count == 1) 407 if (wf_client_count == 1)
342 wf_start_thread(); 408 wf_start_thread();
343 bail: 409 bail:
344 up(&wf_lock); 410 mutex_unlock(&wf_lock);
345 return rc; 411 return rc;
346} 412}
347EXPORT_SYMBOL_GPL(wf_register_client); 413EXPORT_SYMBOL_GPL(wf_register_client);
348 414
349int wf_unregister_client(struct notifier_block *nb) 415int wf_unregister_client(struct notifier_block *nb)
350{ 416{
351 down(&wf_lock); 417 mutex_lock(&wf_lock);
352 notifier_chain_unregister(&wf_client_list, nb); 418 notifier_chain_unregister(&wf_client_list, nb);
353 wf_client_count++; 419 wf_client_count++;
354 if (wf_client_count == 0) 420 if (wf_client_count == 0)
355 wf_stop_thread(); 421 wf_stop_thread();
356 up(&wf_lock); 422 mutex_unlock(&wf_lock);
357 423
358 return 0; 424 return 0;
359} 425}
@@ -361,23 +427,23 @@ EXPORT_SYMBOL_GPL(wf_unregister_client);
361 427
362void wf_set_overtemp(void) 428void wf_set_overtemp(void)
363{ 429{
364 down(&wf_lock); 430 mutex_lock(&wf_lock);
365 wf_overtemp++; 431 wf_overtemp++;
366 if (wf_overtemp == 1) { 432 if (wf_overtemp == 1) {
367 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n"); 433 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n");
368 wf_overtemp_counter = 0; 434 wf_overtemp_counter = 0;
369 wf_notify(WF_EVENT_OVERTEMP, NULL); 435 wf_notify(WF_EVENT_OVERTEMP, NULL);
370 } 436 }
371 up(&wf_lock); 437 mutex_unlock(&wf_lock);
372} 438}
373EXPORT_SYMBOL_GPL(wf_set_overtemp); 439EXPORT_SYMBOL_GPL(wf_set_overtemp);
374 440
375void wf_clear_overtemp(void) 441void wf_clear_overtemp(void)
376{ 442{
377 down(&wf_lock); 443 mutex_lock(&wf_lock);
378 WARN_ON(wf_overtemp == 0); 444 WARN_ON(wf_overtemp == 0);
379 if (wf_overtemp == 0) { 445 if (wf_overtemp == 0) {
380 up(&wf_lock); 446 mutex_unlock(&wf_lock);
381 return; 447 return;
382 } 448 }
383 wf_overtemp--; 449 wf_overtemp--;
@@ -385,7 +451,7 @@ void wf_clear_overtemp(void)
385 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n"); 451 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n");
386 wf_notify(WF_EVENT_NORMALTEMP, NULL); 452 wf_notify(WF_EVENT_NORMALTEMP, NULL);
387 } 453 }
388 up(&wf_lock); 454 mutex_unlock(&wf_lock);
389} 455}
390EXPORT_SYMBOL_GPL(wf_clear_overtemp); 456EXPORT_SYMBOL_GPL(wf_clear_overtemp);
391 457
@@ -395,10 +461,6 @@ int wf_is_overtemp(void)
395} 461}
396EXPORT_SYMBOL_GPL(wf_is_overtemp); 462EXPORT_SYMBOL_GPL(wf_is_overtemp);
397 463
398static struct platform_device wf_platform_device = {
399 .name = "windfarm",
400};
401
402static int __init windfarm_core_init(void) 464static int __init windfarm_core_init(void)
403{ 465{
404 DBG("wf: core loaded\n"); 466 DBG("wf: core loaded\n");
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
new file mode 100644
index 000000000000..5b9ad6ca7cba
--- /dev/null
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -0,0 +1,169 @@
1/*
2 * Windfarm PowerMac thermal control. MAX6690 sensor.
3 *
4 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
5 *
6 * Use and redistribute under the terms of the GNU GPL v2.
7 */
8#include <linux/types.h>
9#include <linux/errno.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/slab.h>
13#include <linux/i2c.h>
14#include <linux/i2c-dev.h>
15#include <asm/prom.h>
16#include <asm/pmac_low_i2c.h>
17
18#include "windfarm.h"
19
20#define VERSION "0.1"
21
22/* This currently only exports the external temperature sensor,
23 since that's all the control loops need. */
24
25/* Some MAX6690 register numbers */
26#define MAX6690_INTERNAL_TEMP 0
27#define MAX6690_EXTERNAL_TEMP 1
28
29struct wf_6690_sensor {
30 struct i2c_client i2c;
31 struct wf_sensor sens;
32};
33
34#define wf_to_6690(x) container_of((x), struct wf_6690_sensor, sens)
35#define i2c_to_6690(x) container_of((x), struct wf_6690_sensor, i2c)
36
37static int wf_max6690_attach(struct i2c_adapter *adapter);
38static int wf_max6690_detach(struct i2c_client *client);
39
40static struct i2c_driver wf_max6690_driver = {
41 .driver = {
42 .name = "wf_max6690",
43 },
44 .attach_adapter = wf_max6690_attach,
45 .detach_client = wf_max6690_detach,
46};
47
48static int wf_max6690_get(struct wf_sensor *sr, s32 *value)
49{
50 struct wf_6690_sensor *max = wf_to_6690(sr);
51 s32 data;
52
53 if (max->i2c.adapter == NULL)
54 return -ENODEV;
55
56 /* chip gets initialized by firmware */
57 data = i2c_smbus_read_byte_data(&max->i2c, MAX6690_EXTERNAL_TEMP);
58 if (data < 0)
59 return data;
60 *value = data << 16;
61 return 0;
62}
63
64static void wf_max6690_release(struct wf_sensor *sr)
65{
66 struct wf_6690_sensor *max = wf_to_6690(sr);
67
68 if (max->i2c.adapter) {
69 i2c_detach_client(&max->i2c);
70 max->i2c.adapter = NULL;
71 }
72 kfree(max);
73}
74
75static struct wf_sensor_ops wf_max6690_ops = {
76 .get_value = wf_max6690_get,
77 .release = wf_max6690_release,
78 .owner = THIS_MODULE,
79};
80
81static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr)
82{
83 struct wf_6690_sensor *max;
84 char *name = "u4-temp";
85
86 max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
87 if (max == NULL) {
88 printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: "
89 "no memory\n", name);
90 return;
91 }
92
93 max->sens.ops = &wf_max6690_ops;
94 max->sens.name = name;
95 max->i2c.addr = addr >> 1;
96 max->i2c.adapter = adapter;
97 max->i2c.driver = &wf_max6690_driver;
98 strncpy(max->i2c.name, name, I2C_NAME_SIZE-1);
99
100 if (i2c_attach_client(&max->i2c)) {
101 printk(KERN_ERR "windfarm: failed to attach MAX6690 sensor\n");
102 goto fail;
103 }
104
105 if (wf_register_sensor(&max->sens)) {
106 i2c_detach_client(&max->i2c);
107 goto fail;
108 }
109
110 return;
111
112 fail:
113 kfree(max);
114}
115
116static int wf_max6690_attach(struct i2c_adapter *adapter)
117{
118 struct device_node *busnode, *dev = NULL;
119 struct pmac_i2c_bus *bus;
120 const char *loc;
121 u32 *reg;
122
123 bus = pmac_i2c_adapter_to_bus(adapter);
124 if (bus == NULL)
125 return -ENODEV;
126 busnode = pmac_i2c_get_bus_node(bus);
127
128 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
129 if (!device_is_compatible(dev, "max6690"))
130 continue;
131 loc = get_property(dev, "hwsensor-location", NULL);
132 reg = (u32 *) get_property(dev, "reg", NULL);
133 if (!loc || !reg)
134 continue;
135 printk("found max6690, loc=%s reg=%x\n", loc, *reg);
136 if (strcmp(loc, "BACKSIDE"))
137 continue;
138 wf_max6690_create(adapter, *reg);
139 }
140
141 return 0;
142}
143
144static int wf_max6690_detach(struct i2c_client *client)
145{
146 struct wf_6690_sensor *max = i2c_to_6690(client);
147
148 max->i2c.adapter = NULL;
149 wf_unregister_sensor(&max->sens);
150
151 return 0;
152}
153
154static int __init wf_max6690_sensor_init(void)
155{
156 return i2c_add_driver(&wf_max6690_driver);
157}
158
159static void __exit wf_max6690_sensor_exit(void)
160{
161 i2c_del_driver(&wf_max6690_driver);
162}
163
164module_init(wf_max6690_sensor_init);
165module_exit(wf_max6690_sensor_exit);
166
167MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
168MODULE_DESCRIPTION("MAX6690 sensor objects for PowerMac thermal control");
169MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_pid.c b/drivers/macintosh/windfarm_pid.c
index 2e803b368757..0842432e27ad 100644
--- a/drivers/macintosh/windfarm_pid.c
+++ b/drivers/macintosh/windfarm_pid.c
@@ -88,8 +88,8 @@ EXPORT_SYMBOL_GPL(wf_cpu_pid_init);
88 88
89s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp) 89s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
90{ 90{
91 s64 error, integ, deriv, prop; 91 s64 integ, deriv, prop;
92 s32 target, sval, adj; 92 s32 error, target, sval, adj;
93 int i, hlen = st->param.history_len; 93 int i, hlen = st->param.history_len;
94 94
95 /* Calculate error term */ 95 /* Calculate error term */
@@ -117,7 +117,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
117 integ += st->errors[(st->index + hlen - i) % hlen]; 117 integ += st->errors[(st->index + hlen - i) % hlen];
118 integ *= st->param.interval; 118 integ *= st->param.interval;
119 integ *= st->param.gr; 119 integ *= st->param.gr;
120 sval = st->param.tmax - ((integ >> 20) & 0xffffffff); 120 sval = st->param.tmax - (s32)(integ >> 20);
121 adj = min(st->param.ttarget, sval); 121 adj = min(st->param.ttarget, sval);
122 122
123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj); 123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj);
@@ -129,7 +129,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
129 deriv *= st->param.gd; 129 deriv *= st->param.gd;
130 130
131 /* Calculate proportional term */ 131 /* Calculate proportional term */
132 prop = (new_temp - adj); 132 prop = st->last_delta = (new_temp - adj);
133 prop *= st->param.gp; 133 prop *= st->param.gp;
134 134
135 DBG("deriv: %lx, prop: %lx\n", deriv, prop); 135 DBG("deriv: %lx, prop: %lx\n", deriv, prop);
diff --git a/drivers/macintosh/windfarm_pid.h b/drivers/macintosh/windfarm_pid.h
index a364c2a2499c..bbccc22d42b8 100644
--- a/drivers/macintosh/windfarm_pid.h
+++ b/drivers/macintosh/windfarm_pid.h
@@ -72,6 +72,7 @@ struct wf_cpu_pid_state {
72 int index; /* index of current power */ 72 int index; /* index of current power */
73 int tindex; /* index of current temp */ 73 int tindex; /* index of current temp */
74 s32 target; /* current target value */ 74 s32 target; /* current target value */
75 s32 last_delta; /* last Tactual - Ttarget */
75 s32 powers[WF_PID_MAX_HISTORY]; /* power history buffer */ 76 s32 powers[WF_PID_MAX_HISTORY]; /* power history buffer */
76 s32 errors[WF_PID_MAX_HISTORY]; /* error history buffer */ 77 s32 errors[WF_PID_MAX_HISTORY]; /* error history buffer */
77 s32 temps[2]; /* temp. history buffer */ 78 s32 temps[2]; /* temp. history buffer */
diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
new file mode 100644
index 000000000000..c2a4e689c784
--- /dev/null
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -0,0 +1,698 @@
1/*
2 * Windfarm PowerMac thermal control.
3 * Control loops for machines with SMU and PPC970MP processors.
4 *
5 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
6 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
7 *
8 * Use and redistribute under the terms of the GNU GPL v2.
9 */
10#include <linux/types.h>
11#include <linux/errno.h>
12#include <linux/kernel.h>
13#include <linux/device.h>
14#include <linux/platform_device.h>
15#include <linux/reboot.h>
16#include <asm/prom.h>
17#include <asm/smu.h>
18
19#include "windfarm.h"
20#include "windfarm_pid.h"
21
22#define VERSION "0.2"
23
24#define DEBUG
25#undef LOTSA_DEBUG
26
27#ifdef DEBUG
28#define DBG(args...) printk(args)
29#else
30#define DBG(args...) do { } while(0)
31#endif
32
33#ifdef LOTSA_DEBUG
34#define DBG_LOTS(args...) printk(args)
35#else
36#define DBG_LOTS(args...) do { } while(0)
37#endif
38
39/* define this to force CPU overtemp to 60 degree, useful for testing
40 * the overtemp code
41 */
42#undef HACKED_OVERTEMP
43
44/* We currently only handle 2 chips, 4 cores... */
45#define NR_CHIPS 2
46#define NR_CORES 4
47#define NR_CPU_FANS 3 * NR_CHIPS
48
49/* Controls and sensors */
50static struct wf_sensor *sens_cpu_temp[NR_CORES];
51static struct wf_sensor *sens_cpu_power[NR_CORES];
52static struct wf_sensor *hd_temp;
53static struct wf_sensor *slots_power;
54static struct wf_sensor *u4_temp;
55
56static struct wf_control *cpu_fans[NR_CPU_FANS];
57static char *cpu_fan_names[NR_CPU_FANS] = {
58 "cpu-rear-fan-0",
59 "cpu-rear-fan-1",
60 "cpu-front-fan-0",
61 "cpu-front-fan-1",
62 "cpu-pump-0",
63 "cpu-pump-1",
64};
65static struct wf_control *cpufreq_clamp;
66
67/* Second pump isn't required (and isn't actually present) */
68#define CPU_FANS_REQD (NR_CPU_FANS - 2)
69#define FIRST_PUMP 4
70#define LAST_PUMP 5
71
72/* We keep a temperature history for average calculation of 180s */
73#define CPU_TEMP_HIST_SIZE 180
74
75/* Scale factor for fan speed, *100 */
76static int cpu_fan_scale[NR_CPU_FANS] = {
77 100,
78 100,
79 97, /* inlet fans run at 97% of exhaust fan */
80 97,
81 100, /* updated later */
82 100, /* updated later */
83};
84
85static struct wf_control *backside_fan;
86static struct wf_control *slots_fan;
87static struct wf_control *drive_bay_fan;
88
89/* PID loop state */
90static struct wf_cpu_pid_state cpu_pid[NR_CORES];
91static u32 cpu_thist[CPU_TEMP_HIST_SIZE];
92static int cpu_thist_pt;
93static s64 cpu_thist_total;
94static s32 cpu_all_tmax = 100 << 16;
95static int cpu_last_target;
96static struct wf_pid_state backside_pid;
97static int backside_tick;
98static struct wf_pid_state slots_pid;
99static int slots_started;
100static struct wf_pid_state drive_bay_pid;
101static int drive_bay_tick;
102
103static int nr_cores;
104static int have_all_controls;
105static int have_all_sensors;
106static int started;
107
108static int failure_state;
109#define FAILURE_SENSOR 1
110#define FAILURE_FAN 2
111#define FAILURE_PERM 4
112#define FAILURE_LOW_OVERTEMP 8
113#define FAILURE_HIGH_OVERTEMP 16
114
115/* Overtemp values */
116#define LOW_OVER_AVERAGE 0
117#define LOW_OVER_IMMEDIATE (10 << 16)
118#define LOW_OVER_CLEAR ((-10) << 16)
119#define HIGH_OVER_IMMEDIATE (14 << 16)
120#define HIGH_OVER_AVERAGE (10 << 16)
121#define HIGH_OVER_IMMEDIATE (14 << 16)
122
123
124/* Implementation... */
125static int create_cpu_loop(int cpu)
126{
127 int chip = cpu / 2;
128 int core = cpu & 1;
129 struct smu_sdbp_header *hdr;
130 struct smu_sdbp_cpupiddata *piddata;
131 struct wf_cpu_pid_param pid;
132 struct wf_control *main_fan = cpu_fans[0];
133 s32 tmax;
134 int fmin;
135
136 /* Get PID params from the appropriate SAT */
137 hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL);
138 if (hdr == NULL) {
139 printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n");
140 return -EINVAL;
141 }
142 piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];
143
144 /* Get FVT params to get Tmax; if not found, assume default */
145 hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);
146 if (hdr) {
147 struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr[1];
148 tmax = fvt->maxtemp << 16;
149 } else
150 tmax = 95 << 16; /* default to 95 degrees C */
151
152 /* We keep a global tmax for overtemp calculations */
153 if (tmax < cpu_all_tmax)
154 cpu_all_tmax = tmax;
155
156 /*
157 * Darwin has a minimum fan speed of 1000 rpm for the 4-way and
158 * 515 for the 2-way. That appears to be overkill, so for now,
159 * impose a minimum of 750 or 515.
160 */
161 fmin = (nr_cores > 2) ? 750 : 515;
162
163 /* Initialize PID loop */
164 pid.interval = 1; /* seconds */
165 pid.history_len = piddata->history_len;
166 pid.gd = piddata->gd;
167 pid.gp = piddata->gp;
168 pid.gr = piddata->gr / piddata->history_len;
169 pid.pmaxadj = (piddata->max_power << 16) - (piddata->power_adj << 8);
170 pid.ttarget = tmax - (piddata->target_temp_delta << 16);
171 pid.tmax = tmax;
172 pid.min = main_fan->ops->get_min(main_fan);
173 pid.max = main_fan->ops->get_max(main_fan);
174 if (pid.min < fmin)
175 pid.min = fmin;
176
177 wf_cpu_pid_init(&cpu_pid[cpu], &pid);
178 return 0;
179}
180
181static void cpu_max_all_fans(void)
182{
183 int i;
184
185 /* We max all CPU fans in case of a sensor error. We also do the
186 * cpufreq clamping now, even if it's supposedly done later by the
187 * generic code anyway, we do it earlier here to react faster
188 */
189 if (cpufreq_clamp)
190 wf_control_set_max(cpufreq_clamp);
191 for (i = 0; i < NR_CPU_FANS; ++i)
192 if (cpu_fans[i])
193 wf_control_set_max(cpu_fans[i]);
194}
195
196static int cpu_check_overtemp(s32 temp)
197{
198 int new_state = 0;
199 s32 t_avg, t_old;
200
201 /* First check for immediate overtemps */
202 if (temp >= (cpu_all_tmax + LOW_OVER_IMMEDIATE)) {
203 new_state |= FAILURE_LOW_OVERTEMP;
204 if ((failure_state & FAILURE_LOW_OVERTEMP) == 0)
205 printk(KERN_ERR "windfarm: Overtemp due to immediate CPU"
206 " temperature !\n");
207 }
208 if (temp >= (cpu_all_tmax + HIGH_OVER_IMMEDIATE)) {
209 new_state |= FAILURE_HIGH_OVERTEMP;
210 if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0)
211 printk(KERN_ERR "windfarm: Critical overtemp due to"
212 " immediate CPU temperature !\n");
213 }
214
215 /* We calculate a history of max temperatures and use that for the
216 * overtemp management
217 */
218 t_old = cpu_thist[cpu_thist_pt];
219 cpu_thist[cpu_thist_pt] = temp;
220 cpu_thist_pt = (cpu_thist_pt + 1) % CPU_TEMP_HIST_SIZE;
221 cpu_thist_total -= t_old;
222 cpu_thist_total += temp;
223 t_avg = cpu_thist_total / CPU_TEMP_HIST_SIZE;
224
225 DBG_LOTS("t_avg = %d.%03d (out: %d.%03d, in: %d.%03d)\n",
226 FIX32TOPRINT(t_avg), FIX32TOPRINT(t_old), FIX32TOPRINT(temp));
227
228 /* Now check for average overtemps */
229 if (t_avg >= (cpu_all_tmax + LOW_OVER_AVERAGE)) {
230 new_state |= FAILURE_LOW_OVERTEMP;
231 if ((failure_state & FAILURE_LOW_OVERTEMP) == 0)
232 printk(KERN_ERR "windfarm: Overtemp due to average CPU"
233 " temperature !\n");
234 }
235 if (t_avg >= (cpu_all_tmax + HIGH_OVER_AVERAGE)) {
236 new_state |= FAILURE_HIGH_OVERTEMP;
237 if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0)
238 printk(KERN_ERR "windfarm: Critical overtemp due to"
239 " average CPU temperature !\n");
240 }
241
242 /* Now handle overtemp conditions. We don't currently use the windfarm
243 * overtemp handling core as it's not fully suited to the needs of those
244 * new machine. This will be fixed later.
245 */
246 if (new_state) {
247 /* High overtemp -> immediate shutdown */
248 if (new_state & FAILURE_HIGH_OVERTEMP)
249 machine_power_off();
250 if ((failure_state & new_state) != new_state)
251 cpu_max_all_fans();
252 failure_state |= new_state;
253 } else if ((failure_state & FAILURE_LOW_OVERTEMP) &&
254 (temp < (cpu_all_tmax + LOW_OVER_CLEAR))) {
255 printk(KERN_ERR "windfarm: Overtemp condition cleared !\n");
256 failure_state &= ~FAILURE_LOW_OVERTEMP;
257 }
258
259 return failure_state & (FAILURE_LOW_OVERTEMP | FAILURE_HIGH_OVERTEMP);
260}
261
262static void cpu_fans_tick(void)
263{
264 int err, cpu;
265 s32 greatest_delta = 0;
266 s32 temp, power, t_max = 0;
267 int i, t, target = 0;
268 struct wf_sensor *sr;
269 struct wf_control *ct;
270 struct wf_cpu_pid_state *sp;
271
272 DBG_LOTS(KERN_DEBUG);
273 for (cpu = 0; cpu < nr_cores; ++cpu) {
274 /* Get CPU core temperature */
275 sr = sens_cpu_temp[cpu];
276 err = sr->ops->get_value(sr, &temp);
277 if (err) {
278 DBG("\n");
279 printk(KERN_WARNING "windfarm: CPU %d temperature "
280 "sensor error %d\n", cpu, err);
281 failure_state |= FAILURE_SENSOR;
282 cpu_max_all_fans();
283 return;
284 }
285
286 /* Keep track of highest temp */
287 t_max = max(t_max, temp);
288
289 /* Get CPU power */
290 sr = sens_cpu_power[cpu];
291 err = sr->ops->get_value(sr, &power);
292 if (err) {
293 DBG("\n");
294 printk(KERN_WARNING "windfarm: CPU %d power "
295 "sensor error %d\n", cpu, err);
296 failure_state |= FAILURE_SENSOR;
297 cpu_max_all_fans();
298 return;
299 }
300
301 /* Run PID */
302 sp = &cpu_pid[cpu];
303 t = wf_cpu_pid_run(sp, power, temp);
304
305 if (cpu == 0 || sp->last_delta > greatest_delta) {
306 greatest_delta = sp->last_delta;
307 target = t;
308 }
309 DBG_LOTS("[%d] P=%d.%.3d T=%d.%.3d ",
310 cpu, FIX32TOPRINT(power), FIX32TOPRINT(temp));
311 }
312 DBG_LOTS("fans = %d, t_max = %d.%03d\n", target, FIX32TOPRINT(t_max));
313
314 /* Darwin limits decrease to 20 per iteration */
315 if (target < (cpu_last_target - 20))
316 target = cpu_last_target - 20;
317 cpu_last_target = target;
318 for (cpu = 0; cpu < nr_cores; ++cpu)
319 cpu_pid[cpu].target = target;
320
321 /* Handle possible overtemps */
322 if (cpu_check_overtemp(t_max))
323 return;
324
325 /* Set fans */
326 for (i = 0; i < NR_CPU_FANS; ++i) {
327 ct = cpu_fans[i];
328 if (ct == NULL)
329 continue;
330 err = ct->ops->set_value(ct, target * cpu_fan_scale[i] / 100);
331 if (err) {
332 printk(KERN_WARNING "windfarm: fan %s reports "
333 "error %d\n", ct->name, err);
334 failure_state |= FAILURE_FAN;
335 break;
336 }
337 }
338}
339
340/* Backside/U4 fan */
341static struct wf_pid_param backside_param = {
342 .interval = 5,
343 .history_len = 2,
344 .gd = 48 << 20,
345 .gp = 5 << 20,
346 .gr = 0,
347 .itarget = 64 << 16,
348 .additive = 1,
349};
350
351static void backside_fan_tick(void)
352{
353 s32 temp;
354 int speed;
355 int err;
356
357 if (!backside_fan || !u4_temp)
358 return;
359 if (!backside_tick) {
360 /* first time; initialize things */
361 backside_param.min = backside_fan->ops->get_min(backside_fan);
362 backside_param.max = backside_fan->ops->get_max(backside_fan);
363 wf_pid_init(&backside_pid, &backside_param);
364 backside_tick = 1;
365 }
366 if (--backside_tick > 0)
367 return;
368 backside_tick = backside_pid.param.interval;
369
370 err = u4_temp->ops->get_value(u4_temp, &temp);
371 if (err) {
372 printk(KERN_WARNING "windfarm: U4 temp sensor error %d\n",
373 err);
374 failure_state |= FAILURE_SENSOR;
375 wf_control_set_max(backside_fan);
376 return;
377 }
378 speed = wf_pid_run(&backside_pid, temp);
379 DBG_LOTS("backside PID temp=%d.%.3d speed=%d\n",
380 FIX32TOPRINT(temp), speed);
381
382 err = backside_fan->ops->set_value(backside_fan, speed);
383 if (err) {
384 printk(KERN_WARNING "windfarm: backside fan error %d\n", err);
385 failure_state |= FAILURE_FAN;
386 }
387}
388
389/* Drive bay fan */
390static struct wf_pid_param drive_bay_prm = {
391 .interval = 5,
392 .history_len = 2,
393 .gd = 30 << 20,
394 .gp = 5 << 20,
395 .gr = 0,
396 .itarget = 40 << 16,
397 .additive = 1,
398};
399
400static void drive_bay_fan_tick(void)
401{
402 s32 temp;
403 int speed;
404 int err;
405
406 if (!drive_bay_fan || !hd_temp)
407 return;
408 if (!drive_bay_tick) {
409 /* first time; initialize things */
410 drive_bay_prm.min = drive_bay_fan->ops->get_min(drive_bay_fan);
411 drive_bay_prm.max = drive_bay_fan->ops->get_max(drive_bay_fan);
412 wf_pid_init(&drive_bay_pid, &drive_bay_prm);
413 drive_bay_tick = 1;
414 }
415 if (--drive_bay_tick > 0)
416 return;
417 drive_bay_tick = drive_bay_pid.param.interval;
418
419 err = hd_temp->ops->get_value(hd_temp, &temp);
420 if (err) {
421 printk(KERN_WARNING "windfarm: drive bay temp sensor "
422 "error %d\n", err);
423 failure_state |= FAILURE_SENSOR;
424 wf_control_set_max(drive_bay_fan);
425 return;
426 }
427 speed = wf_pid_run(&drive_bay_pid, temp);
428 DBG_LOTS("drive_bay PID temp=%d.%.3d speed=%d\n",
429 FIX32TOPRINT(temp), speed);
430
431 err = drive_bay_fan->ops->set_value(drive_bay_fan, speed);
432 if (err) {
433 printk(KERN_WARNING "windfarm: drive bay fan error %d\n", err);
434 failure_state |= FAILURE_FAN;
435 }
436}
437
438/* PCI slots area fan */
439/* This makes the fan speed proportional to the power consumed */
440static struct wf_pid_param slots_param = {
441 .interval = 1,
442 .history_len = 2,
443 .gd = 0,
444 .gp = 0,
445 .gr = 0x1277952,
446 .itarget = 0,
447 .min = 1560,
448 .max = 3510,
449};
450
451static void slots_fan_tick(void)
452{
453 s32 power;
454 int speed;
455 int err;
456
457 if (!slots_fan || !slots_power)
458 return;
459 if (!slots_started) {
460 /* first time; initialize things */
461 wf_pid_init(&slots_pid, &slots_param);
462 slots_started = 1;
463 }
464
465 err = slots_power->ops->get_value(slots_power, &power);
466 if (err) {
467 printk(KERN_WARNING "windfarm: slots power sensor error %d\n",
468 err);
469 failure_state |= FAILURE_SENSOR;
470 wf_control_set_max(slots_fan);
471 return;
472 }
473 speed = wf_pid_run(&slots_pid, power);
474 DBG_LOTS("slots PID power=%d.%.3d speed=%d\n",
475 FIX32TOPRINT(power), speed);
476
477 err = slots_fan->ops->set_value(slots_fan, speed);
478 if (err) {
479 printk(KERN_WARNING "windfarm: slots fan error %d\n", err);
480 failure_state |= FAILURE_FAN;
481 }
482}
483
484static void set_fail_state(void)
485{
486 int i;
487
488 if (cpufreq_clamp)
489 wf_control_set_max(cpufreq_clamp);
490 for (i = 0; i < NR_CPU_FANS; ++i)
491 if (cpu_fans[i])
492 wf_control_set_max(cpu_fans[i]);
493 if (backside_fan)
494 wf_control_set_max(backside_fan);
495 if (slots_fan)
496 wf_control_set_max(slots_fan);
497 if (drive_bay_fan)
498 wf_control_set_max(drive_bay_fan);
499}
500
501static void pm112_tick(void)
502{
503 int i, last_failure;
504
505 if (!started) {
506 started = 1;
507 for (i = 0; i < nr_cores; ++i) {
508 if (create_cpu_loop(i) < 0) {
509 failure_state = FAILURE_PERM;
510 set_fail_state();
511 break;
512 }
513 }
514 DBG_LOTS("cpu_all_tmax=%d.%03d\n", FIX32TOPRINT(cpu_all_tmax));
515
516#ifdef HACKED_OVERTEMP
517 cpu_all_tmax = 60 << 16;
518#endif
519 }
520
521 /* Permanent failure, bail out */
522 if (failure_state & FAILURE_PERM)
523 return;
524 /* Clear all failure bits except low overtemp which will be eventually
525 * cleared by the control loop itself
526 */
527 last_failure = failure_state;
528 failure_state &= FAILURE_LOW_OVERTEMP;
529 cpu_fans_tick();
530 backside_fan_tick();
531 slots_fan_tick();
532 drive_bay_fan_tick();
533
534 DBG_LOTS("last_failure: 0x%x, failure_state: %x\n",
535 last_failure, failure_state);
536
537 /* Check for failures. Any failure causes cpufreq clamping */
538 if (failure_state && last_failure == 0 && cpufreq_clamp)
539 wf_control_set_max(cpufreq_clamp);
540 if (failure_state == 0 && last_failure && cpufreq_clamp)
541 wf_control_set_min(cpufreq_clamp);
542
543 /* That's it for now, we might want to deal with other failures
544 * differently in the future though
545 */
546}
547
548static void pm112_new_control(struct wf_control *ct)
549{
550 int i, max_exhaust;
551
552 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {
553 if (wf_get_control(ct) == 0)
554 cpufreq_clamp = ct;
555 }
556
557 for (i = 0; i < NR_CPU_FANS; ++i) {
558 if (!strcmp(ct->name, cpu_fan_names[i])) {
559 if (cpu_fans[i] == NULL && wf_get_control(ct) == 0)
560 cpu_fans[i] = ct;
561 break;
562 }
563 }
564 if (i >= NR_CPU_FANS) {
565 /* not a CPU fan, try the others */
566 if (!strcmp(ct->name, "backside-fan")) {
567 if (backside_fan == NULL && wf_get_control(ct) == 0)
568 backside_fan = ct;
569 } else if (!strcmp(ct->name, "slots-fan")) {
570 if (slots_fan == NULL && wf_get_control(ct) == 0)
571 slots_fan = ct;
572 } else if (!strcmp(ct->name, "drive-bay-fan")) {
573 if (drive_bay_fan == NULL && wf_get_control(ct) == 0)
574 drive_bay_fan = ct;
575 }
576 return;
577 }
578
579 for (i = 0; i < CPU_FANS_REQD; ++i)
580 if (cpu_fans[i] == NULL)
581 return;
582
583 /* work out pump scaling factors */
584 max_exhaust = cpu_fans[0]->ops->get_max(cpu_fans[0]);
585 for (i = FIRST_PUMP; i <= LAST_PUMP; ++i)
586 if ((ct = cpu_fans[i]) != NULL)
587 cpu_fan_scale[i] =
588 ct->ops->get_max(ct) * 100 / max_exhaust;
589
590 have_all_controls = 1;
591}
592
593static void pm112_new_sensor(struct wf_sensor *sr)
594{
595 unsigned int i;
596
597 if (have_all_sensors)
598 return;
599 if (!strncmp(sr->name, "cpu-temp-", 9)) {
600 i = sr->name[9] - '0';
601 if (sr->name[10] == 0 && i < NR_CORES &&
602 sens_cpu_temp[i] == NULL && wf_get_sensor(sr) == 0)
603 sens_cpu_temp[i] = sr;
604
605 } else if (!strncmp(sr->name, "cpu-power-", 10)) {
606 i = sr->name[10] - '0';
607 if (sr->name[11] == 0 && i < NR_CORES &&
608 sens_cpu_power[i] == NULL && wf_get_sensor(sr) == 0)
609 sens_cpu_power[i] = sr;
610 } else if (!strcmp(sr->name, "hd-temp")) {
611 if (hd_temp == NULL && wf_get_sensor(sr) == 0)
612 hd_temp = sr;
613 } else if (!strcmp(sr->name, "slots-power")) {
614 if (slots_power == NULL && wf_get_sensor(sr) == 0)
615 slots_power = sr;
616 } else if (!strcmp(sr->name, "u4-temp")) {
617 if (u4_temp == NULL && wf_get_sensor(sr) == 0)
618 u4_temp = sr;
619 } else
620 return;
621
622 /* check if we have all the sensors we need */
623 for (i = 0; i < nr_cores; ++i)
624 if (sens_cpu_temp[i] == NULL || sens_cpu_power[i] == NULL)
625 return;
626
627 have_all_sensors = 1;
628}
629
630static int pm112_wf_notify(struct notifier_block *self,
631 unsigned long event, void *data)
632{
633 switch (event) {
634 case WF_EVENT_NEW_SENSOR:
635 pm112_new_sensor(data);
636 break;
637 case WF_EVENT_NEW_CONTROL:
638 pm112_new_control(data);
639 break;
640 case WF_EVENT_TICK:
641 if (have_all_controls && have_all_sensors)
642 pm112_tick();
643 }
644 return 0;
645}
646
647static struct notifier_block pm112_events = {
648 .notifier_call = pm112_wf_notify,
649};
650
651static int wf_pm112_probe(struct device *dev)
652{
653 wf_register_client(&pm112_events);
654 return 0;
655}
656
657static int wf_pm112_remove(struct device *dev)
658{
659 wf_unregister_client(&pm112_events);
660 /* should release all sensors and controls */
661 return 0;
662}
663
664static struct device_driver wf_pm112_driver = {
665 .name = "windfarm",
666 .bus = &platform_bus_type,
667 .probe = wf_pm112_probe,
668 .remove = wf_pm112_remove,
669};
670
671static int __init wf_pm112_init(void)
672{
673 struct device_node *cpu;
674
675 if (!machine_is_compatible("PowerMac11,2"))
676 return -ENODEV;
677
678 /* Count the number of CPU cores */
679 nr_cores = 0;
680 for (cpu = NULL; (cpu = of_find_node_by_type(cpu, "cpu")) != NULL; )
681 ++nr_cores;
682
683 printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n");
684 driver_register(&wf_pm112_driver);
685 return 0;
686}
687
688static void __exit wf_pm112_exit(void)
689{
690 driver_unregister(&wf_pm112_driver);
691}
692
693module_init(wf_pm112_init);
694module_exit(wf_pm112_exit);
695
696MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
697MODULE_DESCRIPTION("Thermal control for PowerMac11,2");
698MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c
index eb69a601e765..f1df6efcbe68 100644
--- a/drivers/macintosh/windfarm_pm81.c
+++ b/drivers/macintosh/windfarm_pm81.c
@@ -538,45 +538,6 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
538 } 538 }
539} 539}
540 540
541
542/*
543 * ****** Attributes ******
544 *
545 */
546
547#define BUILD_SHOW_FUNC_FIX(name, data) \
548static ssize_t show_##name(struct device *dev, \
549 struct device_attribute *attr, \
550 char *buf) \
551{ \
552 ssize_t r; \
553 s32 val = 0; \
554 data->ops->get_value(data, &val); \
555 r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \
556 return r; \
557} \
558static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
559
560
561#define BUILD_SHOW_FUNC_INT(name, data) \
562static ssize_t show_##name(struct device *dev, \
563 struct device_attribute *attr, \
564 char *buf) \
565{ \
566 s32 val = 0; \
567 data->ops->get_value(data, &val); \
568 return sprintf(buf, "%d", val); \
569} \
570static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
571
572BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main);
573BUILD_SHOW_FUNC_INT(sys_fan, fan_system);
574BUILD_SHOW_FUNC_INT(hd_fan, fan_hd);
575
576BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp);
577BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power);
578BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp);
579
580/* 541/*
581 * ****** Setup / Init / Misc ... ****** 542 * ****** Setup / Init / Misc ... ******
582 * 543 *
@@ -654,17 +615,13 @@ static void wf_smu_new_control(struct wf_control *ct)
654 return; 615 return;
655 616
656 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) { 617 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) {
657 if (wf_get_control(ct) == 0) { 618 if (wf_get_control(ct) == 0)
658 fan_cpu_main = ct; 619 fan_cpu_main = ct;
659 device_create_file(wf_smu_dev, &dev_attr_cpu_fan);
660 }
661 } 620 }
662 621
663 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) { 622 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) {
664 if (wf_get_control(ct) == 0) { 623 if (wf_get_control(ct) == 0)
665 fan_system = ct; 624 fan_system = ct;
666 device_create_file(wf_smu_dev, &dev_attr_sys_fan);
667 }
668 } 625 }
669 626
670 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) { 627 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {
@@ -683,10 +640,8 @@ static void wf_smu_new_control(struct wf_control *ct)
683 } 640 }
684 641
685 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { 642 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {
686 if (wf_get_control(ct) == 0) { 643 if (wf_get_control(ct) == 0)
687 fan_hd = ct; 644 fan_hd = ct;
688 device_create_file(wf_smu_dev, &dev_attr_hd_fan);
689 }
690 } 645 }
691 646
692 if (fan_system && fan_hd && fan_cpu_main && cpufreq_clamp) 647 if (fan_system && fan_hd && fan_cpu_main && cpufreq_clamp)
@@ -699,24 +654,18 @@ static void wf_smu_new_sensor(struct wf_sensor *sr)
699 return; 654 return;
700 655
701 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { 656 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {
702 if (wf_get_sensor(sr) == 0) { 657 if (wf_get_sensor(sr) == 0)
703 sensor_cpu_power = sr; 658 sensor_cpu_power = sr;
704 device_create_file(wf_smu_dev, &dev_attr_cpu_power);
705 }
706 } 659 }
707 660
708 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { 661 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {
709 if (wf_get_sensor(sr) == 0) { 662 if (wf_get_sensor(sr) == 0)
710 sensor_cpu_temp = sr; 663 sensor_cpu_temp = sr;
711 device_create_file(wf_smu_dev, &dev_attr_cpu_temp);
712 }
713 } 664 }
714 665
715 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { 666 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {
716 if (wf_get_sensor(sr) == 0) { 667 if (wf_get_sensor(sr) == 0)
717 sensor_hd_temp = sr; 668 sensor_hd_temp = sr;
718 device_create_file(wf_smu_dev, &dev_attr_hd_temp);
719 }
720 } 669 }
721 670
722 if (sensor_cpu_power && sensor_cpu_temp && sensor_hd_temp) 671 if (sensor_cpu_power && sensor_cpu_temp && sensor_hd_temp)
@@ -794,32 +743,20 @@ static int wf_smu_remove(struct device *ddev)
794 * with that except by adding locks all over... I'll do that 743 * with that except by adding locks all over... I'll do that
795 * eventually but heh, who ever rmmod this module anyway ? 744 * eventually but heh, who ever rmmod this module anyway ?
796 */ 745 */
797 if (sensor_cpu_power) { 746 if (sensor_cpu_power)
798 device_remove_file(wf_smu_dev, &dev_attr_cpu_power);
799 wf_put_sensor(sensor_cpu_power); 747 wf_put_sensor(sensor_cpu_power);
800 } 748 if (sensor_cpu_temp)
801 if (sensor_cpu_temp) {
802 device_remove_file(wf_smu_dev, &dev_attr_cpu_temp);
803 wf_put_sensor(sensor_cpu_temp); 749 wf_put_sensor(sensor_cpu_temp);
804 } 750 if (sensor_hd_temp)
805 if (sensor_hd_temp) {
806 device_remove_file(wf_smu_dev, &dev_attr_hd_temp);
807 wf_put_sensor(sensor_hd_temp); 751 wf_put_sensor(sensor_hd_temp);
808 }
809 752
810 /* Release all controls */ 753 /* Release all controls */
811 if (fan_cpu_main) { 754 if (fan_cpu_main)
812 device_remove_file(wf_smu_dev, &dev_attr_cpu_fan);
813 wf_put_control(fan_cpu_main); 755 wf_put_control(fan_cpu_main);
814 } 756 if (fan_hd)
815 if (fan_hd) {
816 device_remove_file(wf_smu_dev, &dev_attr_hd_fan);
817 wf_put_control(fan_hd); 757 wf_put_control(fan_hd);
818 } 758 if (fan_system)
819 if (fan_system) {
820 device_remove_file(wf_smu_dev, &dev_attr_sys_fan);
821 wf_put_control(fan_system); 759 wf_put_control(fan_system);
822 }
823 if (cpufreq_clamp) 760 if (cpufreq_clamp)
824 wf_put_control(cpufreq_clamp); 761 wf_put_control(cpufreq_clamp);
825 762
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index 43243cf7410b..0d6372e96d32 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -458,45 +458,6 @@ static void wf_smu_slots_fans_tick(struct wf_smu_slots_fans_state *st)
458 458
459 459
460/* 460/*
461 * ****** Attributes ******
462 *
463 */
464
465#define BUILD_SHOW_FUNC_FIX(name, data) \
466static ssize_t show_##name(struct device *dev, \
467 struct device_attribute *attr, \
468 char *buf) \
469{ \
470 ssize_t r; \
471 s32 val = 0; \
472 data->ops->get_value(data, &val); \
473 r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \
474 return r; \
475} \
476static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
477
478
479#define BUILD_SHOW_FUNC_INT(name, data) \
480static ssize_t show_##name(struct device *dev, \
481 struct device_attribute *attr, \
482 char *buf) \
483{ \
484 s32 val = 0; \
485 data->ops->get_value(data, &val); \
486 return sprintf(buf, "%d", val); \
487} \
488static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);
489
490BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main);
491BUILD_SHOW_FUNC_INT(hd_fan, fan_hd);
492BUILD_SHOW_FUNC_INT(slots_fan, fan_slots);
493
494BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp);
495BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power);
496BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp);
497BUILD_SHOW_FUNC_FIX(slots_power, sensor_slots_power);
498
499/*
500 * ****** Setup / Init / Misc ... ****** 461 * ****** Setup / Init / Misc ... ******
501 * 462 *
502 */ 463 */
@@ -581,10 +542,8 @@ static void wf_smu_new_control(struct wf_control *ct)
581 return; 542 return;
582 543
583 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) { 544 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) {
584 if (wf_get_control(ct) == 0) { 545 if (wf_get_control(ct) == 0)
585 fan_cpu_main = ct; 546 fan_cpu_main = ct;
586 device_create_file(wf_smu_dev, &dev_attr_cpu_fan);
587 }
588 } 547 }
589 548
590 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) { 549 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) {
@@ -603,17 +562,13 @@ static void wf_smu_new_control(struct wf_control *ct)
603 } 562 }
604 563
605 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { 564 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {
606 if (wf_get_control(ct) == 0) { 565 if (wf_get_control(ct) == 0)
607 fan_hd = ct; 566 fan_hd = ct;
608 device_create_file(wf_smu_dev, &dev_attr_hd_fan);
609 }
610 } 567 }
611 568
612 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) { 569 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) {
613 if (wf_get_control(ct) == 0) { 570 if (wf_get_control(ct) == 0)
614 fan_slots = ct; 571 fan_slots = ct;
615 device_create_file(wf_smu_dev, &dev_attr_slots_fan);
616 }
617 } 572 }
618 573
619 if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd && 574 if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd &&
@@ -627,31 +582,23 @@ static void wf_smu_new_sensor(struct wf_sensor *sr)
627 return; 582 return;
628 583
629 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { 584 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {
630 if (wf_get_sensor(sr) == 0) { 585 if (wf_get_sensor(sr) == 0)
631 sensor_cpu_power = sr; 586 sensor_cpu_power = sr;
632 device_create_file(wf_smu_dev, &dev_attr_cpu_power);
633 }
634 } 587 }
635 588
636 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { 589 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {
637 if (wf_get_sensor(sr) == 0) { 590 if (wf_get_sensor(sr) == 0)
638 sensor_cpu_temp = sr; 591 sensor_cpu_temp = sr;
639 device_create_file(wf_smu_dev, &dev_attr_cpu_temp);
640 }
641 } 592 }
642 593
643 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { 594 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {
644 if (wf_get_sensor(sr) == 0) { 595 if (wf_get_sensor(sr) == 0)
645 sensor_hd_temp = sr; 596 sensor_hd_temp = sr;
646 device_create_file(wf_smu_dev, &dev_attr_hd_temp);
647 }
648 } 597 }
649 598
650 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) { 599 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) {
651 if (wf_get_sensor(sr) == 0) { 600 if (wf_get_sensor(sr) == 0)
652 sensor_slots_power = sr; 601 sensor_slots_power = sr;
653 device_create_file(wf_smu_dev, &dev_attr_slots_power);
654 }
655 } 602 }
656 603
657 if (sensor_cpu_power && sensor_cpu_temp && 604 if (sensor_cpu_power && sensor_cpu_temp &&
@@ -720,40 +667,26 @@ static int wf_smu_remove(struct device *ddev)
720 * with that except by adding locks all over... I'll do that 667 * with that except by adding locks all over... I'll do that
721 * eventually but heh, who ever rmmod this module anyway ? 668 * eventually but heh, who ever rmmod this module anyway ?
722 */ 669 */
723 if (sensor_cpu_power) { 670 if (sensor_cpu_power)
724 device_remove_file(wf_smu_dev, &dev_attr_cpu_power);
725 wf_put_sensor(sensor_cpu_power); 671 wf_put_sensor(sensor_cpu_power);
726 } 672 if (sensor_cpu_temp)
727 if (sensor_cpu_temp) {
728 device_remove_file(wf_smu_dev, &dev_attr_cpu_temp);
729 wf_put_sensor(sensor_cpu_temp); 673 wf_put_sensor(sensor_cpu_temp);
730 } 674 if (sensor_hd_temp)
731 if (sensor_hd_temp) {
732 device_remove_file(wf_smu_dev, &dev_attr_hd_temp);
733 wf_put_sensor(sensor_hd_temp); 675 wf_put_sensor(sensor_hd_temp);
734 } 676 if (sensor_slots_power)
735 if (sensor_slots_power) {
736 device_remove_file(wf_smu_dev, &dev_attr_slots_power);
737 wf_put_sensor(sensor_slots_power); 677 wf_put_sensor(sensor_slots_power);
738 }
739 678
740 /* Release all controls */ 679 /* Release all controls */
741 if (fan_cpu_main) { 680 if (fan_cpu_main)
742 device_remove_file(wf_smu_dev, &dev_attr_cpu_fan);
743 wf_put_control(fan_cpu_main); 681 wf_put_control(fan_cpu_main);
744 }
745 if (fan_cpu_second) 682 if (fan_cpu_second)
746 wf_put_control(fan_cpu_second); 683 wf_put_control(fan_cpu_second);
747 if (fan_cpu_third) 684 if (fan_cpu_third)
748 wf_put_control(fan_cpu_third); 685 wf_put_control(fan_cpu_third);
749 if (fan_hd) { 686 if (fan_hd)
750 device_remove_file(wf_smu_dev, &dev_attr_hd_fan);
751 wf_put_control(fan_hd); 687 wf_put_control(fan_hd);
752 } 688 if (fan_slots)
753 if (fan_slots) {
754 device_remove_file(wf_smu_dev, &dev_attr_slots_fan);
755 wf_put_control(fan_slots); 689 wf_put_control(fan_slots);
756 }
757 if (cpufreq_clamp) 690 if (cpufreq_clamp)
758 wf_put_control(cpufreq_clamp); 691 wf_put_control(cpufreq_clamp);
759 692
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 4d811600bdab..a9e88edc0c72 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -24,7 +24,7 @@
24 24
25#include "windfarm.h" 25#include "windfarm.h"
26 26
27#define VERSION "0.3" 27#define VERSION "0.4"
28 28
29#undef DEBUG 29#undef DEBUG
30 30
@@ -34,6 +34,8 @@
34#define DBG(args...) do { } while(0) 34#define DBG(args...) do { } while(0)
35#endif 35#endif
36 36
37static int smu_supports_new_fans_ops = 1;
38
37/* 39/*
38 * SMU fans control object 40 * SMU fans control object
39 */ 41 */
@@ -59,23 +61,49 @@ static int smu_set_fan(int pwm, u8 id, u16 value)
59 61
60 /* Fill SMU command structure */ 62 /* Fill SMU command structure */
61 cmd.cmd = SMU_CMD_FAN_COMMAND; 63 cmd.cmd = SMU_CMD_FAN_COMMAND;
62 cmd.data_len = 14; 64
65 /* The SMU has an "old" and a "new" way of setting the fan speed
66 * Unfortunately, I found no reliable way to know which one works
67 * on a given machine model. After some investigations it appears
68 * that MacOS X just tries the new one, and if it fails fallbacks
69 * to the old ones ... Ugh.
70 */
71 retry:
72 if (smu_supports_new_fans_ops) {
73 buffer[0] = 0x30;
74 buffer[1] = id;
75 *((u16 *)(&buffer[2])) = value;
76 cmd.data_len = 4;
77 } else {
78 if (id > 7)
79 return -EINVAL;
80 /* Fill argument buffer */
81 memset(buffer, 0, 16);
82 buffer[0] = pwm ? 0x10 : 0x00;
83 buffer[1] = 0x01 << id;
84 *((u16 *)&buffer[2 + id * 2]) = value;
85 cmd.data_len = 14;
86 }
87
63 cmd.reply_len = 16; 88 cmd.reply_len = 16;
64 cmd.data_buf = cmd.reply_buf = buffer; 89 cmd.data_buf = cmd.reply_buf = buffer;
65 cmd.status = 0; 90 cmd.status = 0;
66 cmd.done = smu_done_complete; 91 cmd.done = smu_done_complete;
67 cmd.misc = &comp; 92 cmd.misc = &comp;
68 93
69 /* Fill argument buffer */
70 memset(buffer, 0, 16);
71 buffer[0] = pwm ? 0x10 : 0x00;
72 buffer[1] = 0x01 << id;
73 *((u16 *)&buffer[2 + id * 2]) = value;
74
75 rc = smu_queue_cmd(&cmd); 94 rc = smu_queue_cmd(&cmd);
76 if (rc) 95 if (rc)
77 return rc; 96 return rc;
78 wait_for_completion(&comp); 97 wait_for_completion(&comp);
98
99 /* Handle fallback (see coment above) */
100 if (cmd.status != 0 && smu_supports_new_fans_ops) {
101 printk(KERN_WARNING "windfarm: SMU failed new fan command "
102 "falling back to old method\n");
103 smu_supports_new_fans_ops = 0;
104 goto retry;
105 }
106
79 return cmd.status; 107 return cmd.status;
80} 108}
81 109
@@ -158,19 +186,29 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
158 186
159 /* Names used on desktop models */ 187 /* Names used on desktop models */
160 if (!strcmp(l, "Rear Fan 0") || !strcmp(l, "Rear Fan") || 188 if (!strcmp(l, "Rear Fan 0") || !strcmp(l, "Rear Fan") ||
161 !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan")) 189 !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan") ||
190 !strcmp(l, "CPU A EXHAUST"))
162 fct->ctrl.name = "cpu-rear-fan-0"; 191 fct->ctrl.name = "cpu-rear-fan-0";
163 else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1")) 192 else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1") ||
193 !strcmp(l, "CPU B EXHAUST"))
164 fct->ctrl.name = "cpu-rear-fan-1"; 194 fct->ctrl.name = "cpu-rear-fan-1";
165 else if (!strcmp(l, "Front Fan 0") || !strcmp(l, "Front Fan") || 195 else if (!strcmp(l, "Front Fan 0") || !strcmp(l, "Front Fan") ||
166 !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan")) 196 !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan") ||
197 !strcmp(l, "CPU A INTAKE"))
167 fct->ctrl.name = "cpu-front-fan-0"; 198 fct->ctrl.name = "cpu-front-fan-0";
168 else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1")) 199 else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1") ||
200 !strcmp(l, "CPU B INTAKE"))
169 fct->ctrl.name = "cpu-front-fan-1"; 201 fct->ctrl.name = "cpu-front-fan-1";
170 else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan")) 202 else if (!strcmp(l, "CPU A PUMP"))
203 fct->ctrl.name = "cpu-pump-0";
204 else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") ||
205 !strcmp(l, "EXPANSION SLOTS INTAKE"))
171 fct->ctrl.name = "slots-fan"; 206 fct->ctrl.name = "slots-fan";
172 else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay")) 207 else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay") ||
208 !strcmp(l, "DRIVE BAY A INTAKE"))
173 fct->ctrl.name = "drive-bay-fan"; 209 fct->ctrl.name = "drive-bay-fan";
210 else if (!strcmp(l, "BACKSIDE"))
211 fct->ctrl.name = "backside-fan";
174 212
175 /* Names used on iMac models */ 213 /* Names used on iMac models */
176 if (!strcmp(l, "System Fan") || !strcmp(l, "System fan")) 214 if (!strcmp(l, "System Fan") || !strcmp(l, "System fan"))
@@ -223,7 +261,8 @@ static int __init smu_controls_init(void)
223 261
224 /* Look for RPM fans */ 262 /* Look for RPM fans */
225 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;) 263 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;)
226 if (!strcmp(fans->name, "rpm-fans")) 264 if (!strcmp(fans->name, "rpm-fans") ||
265 device_is_compatible(fans, "smu-rpm-fans"))
227 break; 266 break;
228 for (fan = NULL; 267 for (fan = NULL;
229 fans && (fan = of_get_next_child(fans, fan)) != NULL;) { 268 fans && (fan = of_get_next_child(fans, fan)) != NULL;) {
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
new file mode 100644
index 000000000000..3a32c59494f2
--- /dev/null
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -0,0 +1,418 @@
1/*
2 * Windfarm PowerMac thermal control. SMU "satellite" controller sensors.
3 *
4 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
5 *
6 * Released under the terms of the GNU GPL v2.
7 */
8
9#include <linux/types.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/init.h>
14#include <linux/wait.h>
15#include <linux/i2c.h>
16#include <linux/i2c-dev.h>
17#include <asm/semaphore.h>
18#include <asm/prom.h>
19#include <asm/smu.h>
20#include <asm/pmac_low_i2c.h>
21
22#include "windfarm.h"
23
24#define VERSION "0.2"
25
26#define DEBUG
27
28#ifdef DEBUG
29#define DBG(args...) printk(args)
30#else
31#define DBG(args...) do { } while(0)
32#endif
33
34/* If the cache is older than 800ms we'll refetch it */
35#define MAX_AGE msecs_to_jiffies(800)
36
37struct wf_sat {
38 int nr;
39 atomic_t refcnt;
40 struct semaphore mutex;
41 unsigned long last_read; /* jiffies when cache last updated */
42 u8 cache[16];
43 struct i2c_client i2c;
44 struct device_node *node;
45};
46
47static struct wf_sat *sats[2];
48
49struct wf_sat_sensor {
50 int index;
51 int index2; /* used for power sensors */
52 int shift;
53 struct wf_sat *sat;
54 struct wf_sensor sens;
55};
56
57#define wf_to_sat(c) container_of(c, struct wf_sat_sensor, sens)
58#define i2c_to_sat(c) container_of(c, struct wf_sat, i2c)
59
60static int wf_sat_attach(struct i2c_adapter *adapter);
61static int wf_sat_detach(struct i2c_client *client);
62
63static struct i2c_driver wf_sat_driver = {
64 .driver = {
65 .name = "wf_smu_sat",
66 },
67 .attach_adapter = wf_sat_attach,
68 .detach_client = wf_sat_detach,
69};
70
71/*
72 * XXX i2c_smbus_read_i2c_block_data doesn't pass the requested
73 * length down to the low-level driver, so we use this, which
74 * works well enough with the SMU i2c driver code...
75 */
76static int sat_read_block(struct i2c_client *client, u8 command,
77 u8 *values, int len)
78{
79 union i2c_smbus_data data;
80 int err;
81
82 data.block[0] = len;
83 err = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
84 I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA,
85 &data);
86 if (!err)
87 memcpy(values, data.block, len);
88 return err;
89}
90
91struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
92 unsigned int *size)
93{
94 struct wf_sat *sat;
95 int err;
96 unsigned int i, len;
97 u8 *buf;
98 u8 data[4];
99
100 /* TODO: Add the resulting partition to the device-tree */
101
102 if (sat_id > 1 || (sat = sats[sat_id]) == NULL)
103 return NULL;
104
105 err = i2c_smbus_write_word_data(&sat->i2c, 8, id << 8);
106 if (err) {
107 printk(KERN_ERR "smu_sat_get_sdb_part wr error %d\n", err);
108 return NULL;
109 }
110
111 len = i2c_smbus_read_word_data(&sat->i2c, 9);
112 if (len < 0) {
113 printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n");
114 return NULL;
115 }
116 if (len == 0) {
117 printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id);
118 return NULL;
119 }
120
121 len = le16_to_cpu(len);
122 len = (len + 3) & ~3;
123 buf = kmalloc(len, GFP_KERNEL);
124 if (buf == NULL)
125 return NULL;
126
127 for (i = 0; i < len; i += 4) {
128 err = sat_read_block(&sat->i2c, 0xa, data, 4);
129 if (err) {
130 printk(KERN_ERR "smu_sat_get_sdb_part rd err %d\n",
131 err);
132 goto fail;
133 }
134 buf[i] = data[1];
135 buf[i+1] = data[0];
136 buf[i+2] = data[3];
137 buf[i+3] = data[2];
138 }
139#ifdef DEBUG
140 DBG(KERN_DEBUG "sat %d partition %x:", sat_id, id);
141 for (i = 0; i < len; ++i)
142 DBG(" %x", buf[i]);
143 DBG("\n");
144#endif
145
146 if (size)
147 *size = len;
148 return (struct smu_sdbp_header *) buf;
149
150 fail:
151 kfree(buf);
152 return NULL;
153}
154
155/* refresh the cache */
156static int wf_sat_read_cache(struct wf_sat *sat)
157{
158 int err;
159
160 err = sat_read_block(&sat->i2c, 0x3f, sat->cache, 16);
161 if (err)
162 return err;
163 sat->last_read = jiffies;
164#ifdef LOTSA_DEBUG
165 {
166 int i;
167 DBG(KERN_DEBUG "wf_sat_get: data is");
168 for (i = 0; i < 16; ++i)
169 DBG(" %.2x", sat->cache[i]);
170 DBG("\n");
171 }
172#endif
173 return 0;
174}
175
176static int wf_sat_get(struct wf_sensor *sr, s32 *value)
177{
178 struct wf_sat_sensor *sens = wf_to_sat(sr);
179 struct wf_sat *sat = sens->sat;
180 int i, err;
181 s32 val;
182
183 if (sat->i2c.adapter == NULL)
184 return -ENODEV;
185
186 down(&sat->mutex);
187 if (time_after(jiffies, (sat->last_read + MAX_AGE))) {
188 err = wf_sat_read_cache(sat);
189 if (err)
190 goto fail;
191 }
192
193 i = sens->index * 2;
194 val = ((sat->cache[i] << 8) + sat->cache[i+1]) << sens->shift;
195 if (sens->index2 >= 0) {
196 i = sens->index2 * 2;
197 /* 4.12 * 8.8 -> 12.20; shift right 4 to get 16.16 */
198 val = (val * ((sat->cache[i] << 8) + sat->cache[i+1])) >> 4;
199 }
200
201 *value = val;
202 err = 0;
203
204 fail:
205 up(&sat->mutex);
206 return err;
207}
208
209static void wf_sat_release(struct wf_sensor *sr)
210{
211 struct wf_sat_sensor *sens = wf_to_sat(sr);
212 struct wf_sat *sat = sens->sat;
213
214 if (atomic_dec_and_test(&sat->refcnt)) {
215 if (sat->i2c.adapter) {
216 i2c_detach_client(&sat->i2c);
217 sat->i2c.adapter = NULL;
218 }
219 if (sat->nr >= 0)
220 sats[sat->nr] = NULL;
221 kfree(sat);
222 }
223 kfree(sens);
224}
225
226static struct wf_sensor_ops wf_sat_ops = {
227 .get_value = wf_sat_get,
228 .release = wf_sat_release,
229 .owner = THIS_MODULE,
230};
231
232static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
233{
234 struct wf_sat *sat;
235 struct wf_sat_sensor *sens;
236 u32 *reg;
237 char *loc, *type;
238 u8 addr, chip, core;
239 struct device_node *child;
240 int shift, cpu, index;
241 char *name;
242 int vsens[2], isens[2];
243
244 reg = (u32 *) get_property(dev, "reg", NULL);
245 if (reg == NULL)
246 return;
247 addr = *reg;
248 DBG(KERN_DEBUG "wf_sat: creating sat at address %x\n", addr);
249
250 sat = kzalloc(sizeof(struct wf_sat), GFP_KERNEL);
251 if (sat == NULL)
252 return;
253 sat->nr = -1;
254 sat->node = of_node_get(dev);
255 atomic_set(&sat->refcnt, 0);
256 init_MUTEX(&sat->mutex);
257 sat->i2c.addr = (addr >> 1) & 0x7f;
258 sat->i2c.adapter = adapter;
259 sat->i2c.driver = &wf_sat_driver;
260 strncpy(sat->i2c.name, "smu-sat", I2C_NAME_SIZE-1);
261
262 if (i2c_attach_client(&sat->i2c)) {
263 printk(KERN_ERR "windfarm: failed to attach smu-sat to i2c\n");
264 goto fail;
265 }
266
267 vsens[0] = vsens[1] = -1;
268 isens[0] = isens[1] = -1;
269 child = NULL;
270 while ((child = of_get_next_child(dev, child)) != NULL) {
271 reg = (u32 *) get_property(child, "reg", NULL);
272 type = get_property(child, "device_type", NULL);
273 loc = get_property(child, "location", NULL);
274 if (reg == NULL || loc == NULL)
275 continue;
276
277 /* the cooked sensors are between 0x30 and 0x37 */
278 if (*reg < 0x30 || *reg > 0x37)
279 continue;
280 index = *reg - 0x30;
281
282 /* expect location to be CPU [AB][01] ... */
283 if (strncmp(loc, "CPU ", 4) != 0)
284 continue;
285 chip = loc[4] - 'A';
286 core = loc[5] - '0';
287 if (chip > 1 || core > 1) {
288 printk(KERN_ERR "wf_sat_create: don't understand "
289 "location %s for %s\n", loc, child->full_name);
290 continue;
291 }
292 cpu = 2 * chip + core;
293 if (sat->nr < 0)
294 sat->nr = chip;
295 else if (sat->nr != chip) {
296 printk(KERN_ERR "wf_sat_create: can't cope with "
297 "multiple CPU chips on one SAT (%s)\n", loc);
298 continue;
299 }
300
301 if (strcmp(type, "voltage-sensor") == 0) {
302 name = "cpu-voltage";
303 shift = 4;
304 vsens[core] = index;
305 } else if (strcmp(type, "current-sensor") == 0) {
306 name = "cpu-current";
307 shift = 8;
308 isens[core] = index;
309 } else if (strcmp(type, "temp-sensor") == 0) {
310 name = "cpu-temp";
311 shift = 10;
312 } else
313 continue; /* hmmm shouldn't happen */
314
315 /* the +16 is enough for "cpu-voltage-n" */
316 sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL);
317 if (sens == NULL) {
318 printk(KERN_ERR "wf_sat_create: couldn't create "
319 "%s sensor %d (no memory)\n", name, cpu);
320 continue;
321 }
322 sens->index = index;
323 sens->index2 = -1;
324 sens->shift = shift;
325 sens->sat = sat;
326 atomic_inc(&sat->refcnt);
327 sens->sens.ops = &wf_sat_ops;
328 sens->sens.name = (char *) (sens + 1);
329 snprintf(sens->sens.name, 16, "%s-%d", name, cpu);
330
331 if (wf_register_sensor(&sens->sens)) {
332 atomic_dec(&sat->refcnt);
333 kfree(sens);
334 }
335 }
336
337 /* make the power sensors */
338 for (core = 0; core < 2; ++core) {
339 if (vsens[core] < 0 || isens[core] < 0)
340 continue;
341 cpu = 2 * sat->nr + core;
342 sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL);
343 if (sens == NULL) {
344 printk(KERN_ERR "wf_sat_create: couldn't create power "
345 "sensor %d (no memory)\n", cpu);
346 continue;
347 }
348 sens->index = vsens[core];
349 sens->index2 = isens[core];
350 sens->shift = 0;
351 sens->sat = sat;
352 atomic_inc(&sat->refcnt);
353 sens->sens.ops = &wf_sat_ops;
354 sens->sens.name = (char *) (sens + 1);
355 snprintf(sens->sens.name, 16, "cpu-power-%d", cpu);
356
357 if (wf_register_sensor(&sens->sens)) {
358 atomic_dec(&sat->refcnt);
359 kfree(sens);
360 }
361 }
362
363 if (sat->nr >= 0)
364 sats[sat->nr] = sat;
365
366 return;
367
368 fail:
369 kfree(sat);
370}
371
372static int wf_sat_attach(struct i2c_adapter *adapter)
373{
374 struct device_node *busnode, *dev = NULL;
375 struct pmac_i2c_bus *bus;
376
377 bus = pmac_i2c_adapter_to_bus(adapter);
378 if (bus == NULL)
379 return -ENODEV;
380 busnode = pmac_i2c_get_bus_node(bus);
381
382 while ((dev = of_get_next_child(busnode, dev)) != NULL)
383 if (device_is_compatible(dev, "smu-sat"))
384 wf_sat_create(adapter, dev);
385 return 0;
386}
387
388static int wf_sat_detach(struct i2c_client *client)
389{
390 struct wf_sat *sat = i2c_to_sat(client);
391
392 /* XXX TODO */
393
394 sat->i2c.adapter = NULL;
395 return 0;
396}
397
398static int __init sat_sensors_init(void)
399{
400 int err;
401
402 err = i2c_add_driver(&wf_sat_driver);
403 if (err < 0)
404 return err;
405 return 0;
406}
407
408static void __exit sat_sensors_exit(void)
409{
410 i2c_del_driver(&wf_sat_driver);
411}
412
413module_init(sat_sensors_init);
414/*module_exit(sat_sensors_exit); Uncomment when cleanup is implemented */
415
416MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
417MODULE_DESCRIPTION("SMU satellite sensors for PowerMac thermal control");
418MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c
index 1a00d9c75a23..bed25dcf8a1e 100644
--- a/drivers/macintosh/windfarm_smu_sensors.c
+++ b/drivers/macintosh/windfarm_smu_sensors.c
@@ -220,14 +220,29 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
220 !strcmp(l, "CPU T-Diode")) { 220 !strcmp(l, "CPU T-Diode")) {
221 ads->sens.ops = &smu_cputemp_ops; 221 ads->sens.ops = &smu_cputemp_ops;
222 ads->sens.name = "cpu-temp"; 222 ads->sens.name = "cpu-temp";
223 if (cpudiode == NULL) {
224 DBG("wf: cpudiode partition (%02x) not found\n",
225 SMU_SDB_CPUDIODE_ID);
226 goto fail;
227 }
223 } else if (!strcmp(c, "current-sensor") && 228 } else if (!strcmp(c, "current-sensor") &&
224 !strcmp(l, "CPU Current")) { 229 !strcmp(l, "CPU Current")) {
225 ads->sens.ops = &smu_cpuamp_ops; 230 ads->sens.ops = &smu_cpuamp_ops;
226 ads->sens.name = "cpu-current"; 231 ads->sens.name = "cpu-current";
232 if (cpuvcp == NULL) {
233 DBG("wf: cpuvcp partition (%02x) not found\n",
234 SMU_SDB_CPUVCP_ID);
235 goto fail;
236 }
227 } else if (!strcmp(c, "voltage-sensor") && 237 } else if (!strcmp(c, "voltage-sensor") &&
228 !strcmp(l, "CPU Voltage")) { 238 !strcmp(l, "CPU Voltage")) {
229 ads->sens.ops = &smu_cpuvolt_ops; 239 ads->sens.ops = &smu_cpuvolt_ops;
230 ads->sens.name = "cpu-voltage"; 240 ads->sens.name = "cpu-voltage";
241 if (cpuvcp == NULL) {
242 DBG("wf: cpuvcp partition (%02x) not found\n",
243 SMU_SDB_CPUVCP_ID);
244 goto fail;
245 }
231 } else if (!strcmp(c, "power-sensor") && 246 } else if (!strcmp(c, "power-sensor") &&
232 !strcmp(l, "Slots Power")) { 247 !strcmp(l, "Slots Power")) {
233 ads->sens.ops = &smu_slotspow_ops; 248 ads->sens.ops = &smu_slotspow_ops;
@@ -365,29 +380,22 @@ smu_cpu_power_create(struct wf_sensor *volts, struct wf_sensor *amps)
365 return NULL; 380 return NULL;
366} 381}
367 382
368static int smu_fetch_param_partitions(void) 383static void smu_fetch_param_partitions(void)
369{ 384{
370 struct smu_sdbp_header *hdr; 385 struct smu_sdbp_header *hdr;
371 386
372 /* Get CPU voltage/current/power calibration data */ 387 /* Get CPU voltage/current/power calibration data */
373 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); 388 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL);
374 if (hdr == NULL) { 389 if (hdr != NULL) {
375 DBG("wf: cpuvcp partition (%02x) not found\n", 390 cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1];
376 SMU_SDB_CPUVCP_ID); 391 /* Keep version around */
377 return -ENODEV; 392 cpuvcp_version = hdr->version;
378 } 393 }
379 cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1];
380 /* Keep version around */
381 cpuvcp_version = hdr->version;
382 394
383 /* Get CPU diode calibration data */ 395 /* Get CPU diode calibration data */
384 hdr = smu_get_sdb_partition(SMU_SDB_CPUDIODE_ID, NULL); 396 hdr = smu_get_sdb_partition(SMU_SDB_CPUDIODE_ID, NULL);
385 if (hdr == NULL) { 397 if (hdr != NULL)
386 DBG("wf: cpudiode partition (%02x) not found\n", 398 cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1];
387 SMU_SDB_CPUDIODE_ID);
388 return -ENODEV;
389 }
390 cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1];
391 399
392 /* Get slots power calibration data if any */ 400 /* Get slots power calibration data if any */
393 hdr = smu_get_sdb_partition(SMU_SDB_SLOTSPOW_ID, NULL); 401 hdr = smu_get_sdb_partition(SMU_SDB_SLOTSPOW_ID, NULL);
@@ -398,23 +406,18 @@ static int smu_fetch_param_partitions(void)
398 hdr = smu_get_sdb_partition(SMU_SDB_DEBUG_SWITCHES_ID, NULL); 406 hdr = smu_get_sdb_partition(SMU_SDB_DEBUG_SWITCHES_ID, NULL);
399 if (hdr != NULL) 407 if (hdr != NULL)
400 debugswitches = (u8 *)&hdr[1]; 408 debugswitches = (u8 *)&hdr[1];
401
402 return 0;
403} 409}
404 410
405static int __init smu_sensors_init(void) 411static int __init smu_sensors_init(void)
406{ 412{
407 struct device_node *smu, *sensors, *s; 413 struct device_node *smu, *sensors, *s;
408 struct smu_ad_sensor *volt_sensor = NULL, *curr_sensor = NULL; 414 struct smu_ad_sensor *volt_sensor = NULL, *curr_sensor = NULL;
409 int rc;
410 415
411 if (!smu_present()) 416 if (!smu_present())
412 return -ENODEV; 417 return -ENODEV;
413 418
414 /* Get parameters partitions */ 419 /* Get parameters partitions */
415 rc = smu_fetch_param_partitions(); 420 smu_fetch_param_partitions();
416 if (rc)
417 return rc;
418 421
419 smu = of_find_node_by_type(NULL, "smu"); 422 smu = of_find_node_by_type(NULL, "smu");
420 if (smu == NULL) 423 if (smu == NULL)
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig
index 2583a865a58e..2963605c0ecc 100644
--- a/drivers/media/dvb/b2c2/Kconfig
+++ b/drivers/media/dvb/b2c2/Kconfig
@@ -4,7 +4,7 @@ config DVB_B2C2_FLEXCOP
4 select DVB_STV0299 4 select DVB_STV0299
5 select DVB_MT352 5 select DVB_MT352
6 select DVB_MT312 6 select DVB_MT312
7 select DVB_NXT2002 7 select DVB_NXT200X
8 select DVB_STV0297 8 select DVB_STV0297
9 select DVB_BCM3510 9 select DVB_BCM3510
10 select DVB_LGDT330X 10 select DVB_LGDT330X
diff --git a/drivers/media/dvb/b2c2/flexcop-common.h b/drivers/media/dvb/b2c2/flexcop-common.h
index 344a3c898460..7d7e1613c5a7 100644
--- a/drivers/media/dvb/b2c2/flexcop-common.h
+++ b/drivers/media/dvb/b2c2/flexcop-common.h
@@ -116,11 +116,9 @@ void flexcop_dma_free(struct flexcop_dma *dma);
116 116
117int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); 117int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff);
118int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); 118int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff);
119int flexcop_dma_control_packet_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff);
120int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx); 119int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx);
121int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff); 120int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff);
122int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles); 121int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles);
123int flexcop_dma_config_packet_count(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 packets);
124 122
125/* from flexcop-eeprom.c */ 123/* from flexcop-eeprom.c */
126/* the PCI part uses this call to get the MAC address, the USB part has its own */ 124/* the PCI part uses this call to get the MAC address, the USB part has its own */
diff --git a/drivers/media/dvb/b2c2/flexcop-dma.c b/drivers/media/dvb/b2c2/flexcop-dma.c
index cf4ed1df6086..6f592bc32d22 100644
--- a/drivers/media/dvb/b2c2/flexcop-dma.c
+++ b/drivers/media/dvb/b2c2/flexcop-dma.c
@@ -169,38 +169,3 @@ int flexcop_dma_config_timer(struct flexcop_device *fc,
169} 169}
170EXPORT_SYMBOL(flexcop_dma_config_timer); 170EXPORT_SYMBOL(flexcop_dma_config_timer);
171 171
172/* packet IRQ does not exist in FCII or FCIIb - according to data book and tests */
173int flexcop_dma_control_packet_irq(struct flexcop_device *fc,
174 flexcop_dma_index_t no,
175 int onoff)
176{
177 flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208);
178
179 deb_rdump("reg: %03x: %x\n",ctrl_208,v.raw);
180 if (no & FC_DMA_1)
181 v.ctrl_208.DMA1_Size_IRQ_Enable_sig = onoff;
182
183 if (no & FC_DMA_2)
184 v.ctrl_208.DMA2_Size_IRQ_Enable_sig = onoff;
185
186 fc->write_ibi_reg(fc,ctrl_208,v);
187 deb_rdump("reg: %03x: %x\n",ctrl_208,v.raw);
188
189 return 0;
190}
191EXPORT_SYMBOL(flexcop_dma_control_packet_irq);
192
193int flexcop_dma_config_packet_count(struct flexcop_device *fc,
194 flexcop_dma_index_t dma_idx,
195 u8 packets)
196{
197 flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014;
198 flexcop_ibi_value v = fc->read_ibi_reg(fc,r);
199
200 flexcop_dma_remap(fc,dma_idx,1);
201
202 v.dma_0x4_remap.DMA_maxpackets = packets;
203 fc->write_ibi_reg(fc,r,v);
204 return 0;
205}
206EXPORT_SYMBOL(flexcop_dma_config_packet_count);
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index 0b940e152b79..390cc3a99ce6 100644
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -9,7 +9,7 @@
9 9
10#include "stv0299.h" 10#include "stv0299.h"
11#include "mt352.h" 11#include "mt352.h"
12#include "nxt2002.h" 12#include "nxt200x.h"
13#include "bcm3510.h" 13#include "bcm3510.h"
14#include "stv0297.h" 14#include "stv0297.h"
15#include "mt312.h" 15#include "mt312.h"
@@ -343,9 +343,10 @@ static struct lgdt330x_config air2pc_atsc_hd5000_config = {
343 .clock_polarity_flip = 1, 343 .clock_polarity_flip = 1,
344}; 344};
345 345
346static struct nxt2002_config samsung_tbmv_config = { 346static struct nxt200x_config samsung_tbmv_config = {
347 .demod_address = 0x0a, 347 .demod_address = 0x0a,
348 .request_firmware = flexcop_fe_request_firmware, 348 .pll_address = 0xc2,
349 .pll_desc = &dvb_pll_samsung_tbmv,
349}; 350};
350 351
351static struct bcm3510_config air2pc_atsc_first_gen_config = { 352static struct bcm3510_config air2pc_atsc_first_gen_config = {
@@ -505,7 +506,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
505 info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); 506 info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address);
506 } else 507 } else
507 /* try the air atsc 2nd generation (nxt2002) */ 508 /* try the air atsc 2nd generation (nxt2002) */
508 if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { 509 if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
509 fc->dev_type = FC_AIR_ATSC2; 510 fc->dev_type = FC_AIR_ATSC2;
510 info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); 511 info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address);
511 } else 512 } else
diff --git a/drivers/media/dvb/b2c2/flexcop-misc.c b/drivers/media/dvb/b2c2/flexcop-misc.c
index 62282d8dbfa8..167583bf0621 100644
--- a/drivers/media/dvb/b2c2/flexcop-misc.c
+++ b/drivers/media/dvb/b2c2/flexcop-misc.c
@@ -36,14 +36,14 @@ void flexcop_determine_revision(struct flexcop_device *fc)
36 /* bus parts have to decide if hw pid filtering is used or not. */ 36 /* bus parts have to decide if hw pid filtering is used or not. */
37} 37}
38 38
39const char *flexcop_revision_names[] = { 39static const char *flexcop_revision_names[] = {
40 "Unkown chip", 40 "Unkown chip",
41 "FlexCopII", 41 "FlexCopII",
42 "FlexCopIIb", 42 "FlexCopIIb",
43 "FlexCopIII", 43 "FlexCopIII",
44}; 44};
45 45
46const char *flexcop_device_names[] = { 46static const char *flexcop_device_names[] = {
47 "Unkown device", 47 "Unkown device",
48 "Air2PC/AirStar 2 DVB-T", 48 "Air2PC/AirStar 2 DVB-T",
49 "Air2PC/AirStar 2 ATSC 1st generation", 49 "Air2PC/AirStar 2 ATSC 1st generation",
@@ -54,7 +54,7 @@ const char *flexcop_device_names[] = {
54 "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", 54 "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)",
55}; 55};
56 56
57const char *flexcop_bus_names[] = { 57static const char *flexcop_bus_names[] = {
58 "USB", 58 "USB",
59 "PCI", 59 "PCI",
60}; 60};
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
index 2f76eb3fea40..9bc40bdcc282 100644
--- a/drivers/media/dvb/b2c2/flexcop-pci.c
+++ b/drivers/media/dvb/b2c2/flexcop-pci.c
@@ -161,8 +161,10 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id, struct pt_regs *regs)
161 fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; 161 fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2;
162 u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; 162 u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0;
163 163
164 deb_irq("%u irq: %08x cur_addr: %08x: cur_pos: %08x, last_cur_pos: %08x ", 164 deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ",
165 jiffies_to_usecs(jiffies - fc_pci->last_irq),v.raw,cur_addr,cur_pos,fc_pci->last_dma1_cur_pos); 165 jiffies_to_usecs(jiffies - fc_pci->last_irq),
166 v.raw, (unsigned long long)cur_addr, cur_pos,
167 fc_pci->last_dma1_cur_pos);
166 fc_pci->last_irq = jiffies; 168 fc_pci->last_irq = jiffies;
167 169
168 /* buffer end was reached, restarted from the beginning 170 /* buffer end was reached, restarted from the beginning
diff --git a/drivers/media/dvb/b2c2/flexcop-reg.h b/drivers/media/dvb/b2c2/flexcop-reg.h
index 3153f9513c63..491f9bd6e195 100644
--- a/drivers/media/dvb/b2c2/flexcop-reg.h
+++ b/drivers/media/dvb/b2c2/flexcop-reg.h
@@ -16,8 +16,6 @@ typedef enum {
16 FLEXCOP_III, 16 FLEXCOP_III,
17} flexcop_revision_t; 17} flexcop_revision_t;
18 18
19extern const char *flexcop_revision_names[];
20
21typedef enum { 19typedef enum {
22 FC_UNK = 0, 20 FC_UNK = 0,
23 FC_AIR_DVB, 21 FC_AIR_DVB,
@@ -34,8 +32,6 @@ typedef enum {
34 FC_PCI, 32 FC_PCI,
35} flexcop_bus_t; 33} flexcop_bus_t;
36 34
37extern const char *flexcop_device_names[];
38
39/* FlexCop IBI Registers */ 35/* FlexCop IBI Registers */
40#if defined(__LITTLE_ENDIAN) 36#if defined(__LITTLE_ENDIAN)
41 #include "flexcop_ibi_value_le.h" 37 #include "flexcop_ibi_value_le.h"
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index a04bb61f21f4..34c3189a1a33 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -381,6 +381,23 @@ bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *
381 381
382EXPORT_SYMBOL(bt878_device_control); 382EXPORT_SYMBOL(bt878_device_control);
383 383
384
385struct cards card_list[] __devinitdata = {
386
387 { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
388 { 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" },
389 { 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" },
390 { 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
391 { 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" },
392 { 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
393 { 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" },
394 { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" },
395 { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" },
396 { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"},
397 { 0, -1, NULL }
398};
399
400
384/***********************/ 401/***********************/
385/* PCI device handling */ 402/* PCI device handling */
386/***********************/ 403/***********************/
@@ -388,18 +405,41 @@ EXPORT_SYMBOL(bt878_device_control);
388static int __devinit bt878_probe(struct pci_dev *dev, 405static int __devinit bt878_probe(struct pci_dev *dev,
389 const struct pci_device_id *pci_id) 406 const struct pci_device_id *pci_id)
390{ 407{
391 int result; 408 int result = 0, has_dvb = 0, i;
392 unsigned char lat; 409 unsigned char lat;
393 struct bt878 *bt; 410 struct bt878 *bt;
394#if defined(__powerpc__) 411#if defined(__powerpc__)
395 unsigned int cmd; 412 unsigned int cmd;
396#endif 413#endif
414 unsigned int cardid;
415 unsigned short id;
416 struct cards *dvb_cards;
397 417
398 printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n", 418 printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
399 bt878_num); 419 bt878_num);
400 if (pci_enable_device(dev)) 420 if (pci_enable_device(dev))
401 return -EIO; 421 return -EIO;
402 422
423 pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &id);
424 cardid = id << 16;
425 pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &id);
426 cardid |= id;
427
428 for (i = 0, dvb_cards = card_list; i < ARRAY_SIZE(card_list); i++, dvb_cards++) {
429 if (cardid == dvb_cards->pci_id) {
430 printk("%s: card id=[0x%x],[ %s ] has DVB functions.\n",
431 __func__, cardid, dvb_cards->name);
432 has_dvb = 1;
433 }
434 }
435
436 if (!has_dvb) {
437 printk("%s: card id=[0x%x], Unknown card.\nExiting..\n", __func__, cardid);
438 result = -EINVAL;
439
440 goto fail0;
441 }
442
403 bt = &bt878[bt878_num]; 443 bt = &bt878[bt878_num];
404 bt->dev = dev; 444 bt->dev = dev;
405 bt->nr = bt878_num; 445 bt->nr = bt878_num;
@@ -416,6 +456,8 @@ static int __devinit bt878_probe(struct pci_dev *dev,
416 456
417 pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision); 457 pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision);
418 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); 458 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
459
460
419 printk(KERN_INFO "bt878(%d): Bt%x (rev %d) at %02x:%02x.%x, ", 461 printk(KERN_INFO "bt878(%d): Bt%x (rev %d) at %02x:%02x.%x, ",
420 bt878_num, bt->id, bt->revision, dev->bus->number, 462 bt878_num, bt->id, bt->revision, dev->bus->number,
421 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); 463 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
diff --git a/drivers/media/dvb/bt8xx/bt878.h b/drivers/media/dvb/bt8xx/bt878.h
index a73baf00ca39..9faf93770d08 100644
--- a/drivers/media/dvb/bt8xx/bt878.h
+++ b/drivers/media/dvb/bt8xx/bt878.h
@@ -88,6 +88,23 @@
88 88
89#define BT878_RISC_SYNC_MASK (1 << 15) 89#define BT878_RISC_SYNC_MASK (1 << 15)
90 90
91
92#define BTTV_BOARD_UNKNOWN 0x00
93#define BTTV_BOARD_PINNACLESAT 0x5e
94#define BTTV_BOARD_NEBULA_DIGITV 0x68
95#define BTTV_BOARD_PC_HDTV 0x70
96#define BTTV_BOARD_TWINHAN_DST 0x71
97#define BTTV_BOARD_AVDVBT_771 0x7b
98#define BTTV_BOARD_AVDVBT_761 0x7c
99#define BTTV_BOARD_DVICO_DVBT_LITE 0x80
100#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87
101
102struct cards {
103 __u32 pci_id;
104 __u16 card_id;
105 char *name;
106};
107
91extern int bt878_num; 108extern int bt878_num;
92 109
93struct bt878 { 110struct bt878 {
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 90a69d343b79..d3df12039b06 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -83,12 +83,18 @@ config DVB_USB_UMT_010
83 Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. 83 Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver.
84 84
85config DVB_USB_CXUSB 85config DVB_USB_CXUSB
86 tristate "Medion MD95700 hybrid USB2.0 (Conexant) support" 86 tristate "Conexant USB2.0 hybrid reference design support"
87 depends on DVB_USB 87 depends on DVB_USB
88 select DVB_CX22702 88 select DVB_CX22702
89 select DVB_LGDT330X
90 select DVB_MT352
89 help 91 help
90 Say Y here to support the Medion MD95700 hybrid USB2.0 device. Currently 92 Say Y here to support the Conexant USB2.0 hybrid reference design.
91 only the DVB-T part is supported. 93 Currently, only DVB and ATSC modes are supported, analog mode
94 shall be added in the future. Devices that require this module:
95
96 Medion MD95700 hybrid USB2.0 device.
97 DViCO FusionHDTV (Bluebird) USB2.0 devices
92 98
93config DVB_USB_DIGITV 99config DVB_USB_DIGITV
94 tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" 100 tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support"
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index a7fb06f4cd34..f327fac1688e 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -184,7 +184,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
184 return 0; 184 return 0;
185} 185}
186 186
187struct dvb_usb_rc_key dvico_mce_rc_keys[] = { 187static struct dvb_usb_rc_key dvico_mce_rc_keys[] = {
188 { 0xfe, 0x02, KEY_TV }, 188 { 0xfe, 0x02, KEY_TV },
189 { 0xfe, 0x0e, KEY_MP3 }, 189 { 0xfe, 0x0e, KEY_MP3 },
190 { 0xfe, 0x1a, KEY_DVD }, 190 { 0xfe, 0x1a, KEY_DVD },
@@ -234,7 +234,7 @@ struct dvb_usb_rc_key dvico_mce_rc_keys[] = {
234 234
235static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) 235static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
236{ 236{
237 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; 237 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
238 static u8 reset [] = { RESET, 0x80 }; 238 static u8 reset [] = { RESET, 0x80 };
239 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 239 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
240 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; 240 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
@@ -255,7 +255,7 @@ static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
255 255
256static int cxusb_mt352_demod_init(struct dvb_frontend* fe) 256static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
257{ /* used in both lgz201 and th7579 */ 257{ /* used in both lgz201 and th7579 */
258 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 258 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
259 static u8 reset [] = { RESET, 0x80 }; 259 static u8 reset [] = { RESET, 0x80 };
260 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 260 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
261 static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; 261 static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
@@ -273,7 +273,7 @@ static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
273 return 0; 273 return 0;
274} 274}
275 275
276struct cx22702_config cxusb_cx22702_config = { 276static struct cx22702_config cxusb_cx22702_config = {
277 .demod_address = 0x63, 277 .demod_address = 0x63,
278 278
279 .output_mode = CX22702_PARALLEL_OUTPUT, 279 .output_mode = CX22702_PARALLEL_OUTPUT,
@@ -282,13 +282,13 @@ struct cx22702_config cxusb_cx22702_config = {
282 .pll_set = dvb_usb_pll_set_i2c, 282 .pll_set = dvb_usb_pll_set_i2c,
283}; 283};
284 284
285struct lgdt330x_config cxusb_lgdt330x_config = { 285static struct lgdt330x_config cxusb_lgdt330x_config = {
286 .demod_address = 0x0e, 286 .demod_address = 0x0e,
287 .demod_chip = LGDT3303, 287 .demod_chip = LGDT3303,
288 .pll_set = dvb_usb_pll_set_i2c, 288 .pll_set = dvb_usb_pll_set_i2c,
289}; 289};
290 290
291struct mt352_config cxusb_dee1601_config = { 291static struct mt352_config cxusb_dee1601_config = {
292 .demod_address = 0x0f, 292 .demod_address = 0x0f,
293 .demod_init = cxusb_dee1601_demod_init, 293 .demod_init = cxusb_dee1601_demod_init,
294 .pll_set = dvb_usb_pll_set, 294 .pll_set = dvb_usb_pll_set,
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index e6c55c9c9417..caa1346e3063 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -175,11 +175,13 @@ static int digitv_probe(struct usb_interface *intf,
175 if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) { 175 if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) {
176 u8 b[4] = { 0 }; 176 u8 b[4] = { 0 };
177 177
178 b[0] = 1; 178 if (d != NULL) { /* do that only when the firmware is loaded */
179 digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0); 179 b[0] = 1;
180 digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0);
180 181
181 b[0] = 0; 182 b[0] = 0;
182 digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); 183 digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);
184 }
183 } 185 }
184 return ret; 186 return ret;
185} 187}
@@ -194,7 +196,7 @@ static struct dvb_usb_properties digitv_properties = {
194 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 196 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
195 197
196 .usb_ctrl = CYPRESS_FX2, 198 .usb_ctrl = CYPRESS_FX2,
197 .firmware = "dvb-usb-digitv-01.fw", 199 .firmware = "dvb-usb-digitv-02.fw",
198 200
199 .size_of_priv = 0, 201 .size_of_priv = 0,
200 202
@@ -229,6 +231,7 @@ static struct dvb_usb_properties digitv_properties = {
229 { &digitv_table[0], NULL }, 231 { &digitv_table[0], NULL },
230 { NULL }, 232 { NULL },
231 }, 233 },
234 { NULL },
232 } 235 }
233}; 236};
234 237
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index 130ea7f21f5e..12ebaf8bddca 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -151,7 +151,7 @@ static struct dvb_usb_properties dtt200u_properties = {
151 .cold_ids = { &dtt200u_usb_table[0], NULL }, 151 .cold_ids = { &dtt200u_usb_table[0], NULL },
152 .warm_ids = { &dtt200u_usb_table[1], NULL }, 152 .warm_ids = { &dtt200u_usb_table[1], NULL },
153 }, 153 },
154 { 0 }, 154 { NULL },
155 } 155 }
156}; 156};
157 157
@@ -192,7 +192,7 @@ static struct dvb_usb_properties wt220u_properties = {
192 .cold_ids = { &dtt200u_usb_table[2], NULL }, 192 .cold_ids = { &dtt200u_usb_table[2], NULL },
193 .warm_ids = { &dtt200u_usb_table[3], NULL }, 193 .warm_ids = { &dtt200u_usb_table[3], NULL },
194 }, 194 },
195 { 0 }, 195 { NULL },
196 } 196 }
197}; 197};
198 198
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
index 8535895819fb..9222b0a81f74 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
@@ -24,6 +24,9 @@ static struct usb_cypress_controller cypress[] = {
24 { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, 24 { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 },
25}; 25};
26 26
27static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
28 int *pos);
29
27/* 30/*
28 * load a firmware packet to the device 31 * load a firmware packet to the device
29 */ 32 */
@@ -112,7 +115,8 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties
112 return ret; 115 return ret;
113} 116}
114 117
115int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos) 118static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
119 int *pos)
116{ 120{
117 u8 *b = (u8 *) &fw->data[*pos]; 121 u8 *b = (u8 *) &fw->data[*pos];
118 int data_offs = 4; 122 int data_offs = 4;
@@ -142,5 +146,3 @@ int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos)
142 146
143 return *pos; 147 return *pos;
144} 148}
145EXPORT_SYMBOL(dvb_usb_get_hexline);
146
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index dd568396e594..5e5d21ad93c9 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -341,7 +341,6 @@ struct hexline {
341 u8 data[255]; 341 u8 data[255];
342 u8 chk; 342 u8 chk;
343}; 343};
344extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *);
345extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); 344extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
346 345
347#endif 346#endif
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c
index afa00fdb5ec0..4a95eca81c5c 100644
--- a/drivers/media/dvb/dvb-usb/vp702x.c
+++ b/drivers/media/dvb/dvb-usb/vp702x.c
@@ -53,7 +53,8 @@ int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8
53 return ret; 53 return ret;
54} 54}
55 55
56int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) 56static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
57 u16 index, u8 *b, int blen)
57{ 58{
58 deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); 59 deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
59 debug_dump(b,blen,deb_xfer); 60 debug_dump(b,blen,deb_xfer);
@@ -88,7 +89,8 @@ unlock:
88 return ret; 89 return ret;
89} 90}
90 91
91int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, int olen, u8 *i, int ilen, int msec) 92static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o,
93 int olen, u8 *i, int ilen, int msec)
92{ 94{
93 u8 bout[olen+2]; 95 u8 bout[olen+2];
94 u8 bin[ilen+1]; 96 u8 bin[ilen+1];
diff --git a/drivers/media/dvb/dvb-usb/vp702x.h b/drivers/media/dvb/dvb-usb/vp702x.h
index a808d48e7bf2..c2f97f96c21f 100644
--- a/drivers/media/dvb/dvb-usb/vp702x.h
+++ b/drivers/media/dvb/dvb-usb/vp702x.h
@@ -101,8 +101,6 @@ extern int dvb_usb_vp702x_debug;
101extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); 101extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d);
102 102
103extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); 103extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec);
104extern int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, int olen, u8 *i, int ilen, int msec);
105extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); 104extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
106extern int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
107 105
108#endif 106#endif
diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c
index 5242cca5db4a..9999336aeeb6 100644
--- a/drivers/media/dvb/dvb-usb/vp7045-fe.c
+++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c
@@ -23,10 +23,11 @@
23 23
24struct vp7045_fe_state { 24struct vp7045_fe_state {
25 struct dvb_frontend fe; 25 struct dvb_frontend fe;
26 struct dvb_frontend_ops ops;
27
26 struct dvb_usb_device *d; 28 struct dvb_usb_device *d;
27}; 29};
28 30
29
30static int vp7045_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) 31static int vp7045_fe_read_status(struct dvb_frontend* fe, fe_status_t *status)
31{ 32{
32 struct vp7045_fe_state *state = fe->demodulator_priv; 33 struct vp7045_fe_state *state = fe->demodulator_priv;
@@ -150,7 +151,8 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d)
150 goto error; 151 goto error;
151 152
152 s->d = d; 153 s->d = d;
153 s->fe.ops = &vp7045_fe_ops; 154 memcpy(&s->ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops));
155 s->fe.ops = &s->ops;
154 s->fe.demodulator_priv = s; 156 s->fe.demodulator_priv = s;
155 157
156 goto success; 158 goto success;
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 028204956bb0..3835235b68df 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -247,7 +247,7 @@ static struct dvb_usb_properties vp7045_properties = {
247 .cold_ids = { &vp7045_usb_table[2], NULL }, 247 .cold_ids = { &vp7045_usb_table[2], NULL },
248 .warm_ids = { &vp7045_usb_table[3], NULL }, 248 .warm_ids = { &vp7045_usb_table[3], NULL },
249 }, 249 },
250 { 0 }, 250 { NULL },
251 } 251 }
252}; 252};
253 253
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index db3a8b40031e..76b6a2aef32f 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -28,12 +28,6 @@ config DVB_TDA8083
28 help 28 help
29 A DVB-S tuner module. Say Y when you want to support this frontend. 29 A DVB-S tuner module. Say Y when you want to support this frontend.
30 30
31config DVB_TDA80XX
32 tristate "Philips TDA8044 or TDA8083 based"
33 depends on DVB_CORE
34 help
35 A DVB-S tuner module. Say Y when you want to support this frontend.
36
37config DVB_MT312 31config DVB_MT312
38 tristate "Zarlink MT312 based" 32 tristate "Zarlink MT312 based"
39 depends on DVB_CORE 33 depends on DVB_CORE
@@ -139,12 +133,6 @@ config DVB_DIB3000MC
139comment "DVB-C (cable) frontends" 133comment "DVB-C (cable) frontends"
140 depends on DVB_CORE 134 depends on DVB_CORE
141 135
142config DVB_ATMEL_AT76C651
143 tristate "Atmel AT76C651 based"
144 depends on DVB_CORE
145 help
146 A DVB-C tuner module. Say Y when you want to support this frontend.
147
148config DVB_VES1820 136config DVB_VES1820
149 tristate "VLSI VES1820 based" 137 tristate "VLSI VES1820 based"
150 depends on DVB_CORE 138 depends on DVB_CORE
@@ -166,18 +154,6 @@ config DVB_STV0297
166comment "ATSC (North American/Korean Terresterial DTV) frontends" 154comment "ATSC (North American/Korean Terresterial DTV) frontends"
167 depends on DVB_CORE 155 depends on DVB_CORE
168 156
169config DVB_NXT2002
170 tristate "Nxt2002 based"
171 depends on DVB_CORE
172 select FW_LOADER
173 help
174 An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
175
176 This driver needs external firmware. Please use the command
177 "<kerneldir>/Documentation/dvb/get_dvb_firmware nxt2002" to
178 download/extract it, and then copy it to /usr/lib/hotplug/firmware
179 or /lib/firmware (depending on configuration of firmware hotplug).
180
181config DVB_NXT200X 157config DVB_NXT200X
182 tristate "Nextwave NXT2002/NXT2004 based" 158 tristate "Nextwave NXT2002/NXT2004 based"
183 depends on DVB_CORE 159 depends on DVB_CORE
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 615ec830e1c9..1af769cd90c0 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -8,7 +8,6 @@ obj-$(CONFIG_DVB_CORE) += dvb-pll.o
8obj-$(CONFIG_DVB_STV0299) += stv0299.o 8obj-$(CONFIG_DVB_STV0299) += stv0299.o
9obj-$(CONFIG_DVB_SP8870) += sp8870.o 9obj-$(CONFIG_DVB_SP8870) += sp8870.o
10obj-$(CONFIG_DVB_CX22700) += cx22700.o 10obj-$(CONFIG_DVB_CX22700) += cx22700.o
11obj-$(CONFIG_DVB_ATMEL_AT76C651) += at76c651.o
12obj-$(CONFIG_DVB_CX24110) += cx24110.o 11obj-$(CONFIG_DVB_CX24110) += cx24110.o
13obj-$(CONFIG_DVB_TDA8083) += tda8083.o 12obj-$(CONFIG_DVB_TDA8083) += tda8083.o
14obj-$(CONFIG_DVB_L64781) += l64781.o 13obj-$(CONFIG_DVB_L64781) += l64781.o
@@ -22,10 +21,8 @@ obj-$(CONFIG_DVB_SP887X) += sp887x.o
22obj-$(CONFIG_DVB_NXT6000) += nxt6000.o 21obj-$(CONFIG_DVB_NXT6000) += nxt6000.o
23obj-$(CONFIG_DVB_MT352) += mt352.o 22obj-$(CONFIG_DVB_MT352) += mt352.o
24obj-$(CONFIG_DVB_CX22702) += cx22702.o 23obj-$(CONFIG_DVB_CX22702) += cx22702.o
25obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o
26obj-$(CONFIG_DVB_TDA10021) += tda10021.o 24obj-$(CONFIG_DVB_TDA10021) += tda10021.o
27obj-$(CONFIG_DVB_STV0297) += stv0297.o 25obj-$(CONFIG_DVB_STV0297) += stv0297.o
28obj-$(CONFIG_DVB_NXT2002) += nxt2002.o
29obj-$(CONFIG_DVB_NXT200X) += nxt200x.o 26obj-$(CONFIG_DVB_NXT200X) += nxt200x.o
30obj-$(CONFIG_DVB_OR51211) += or51211.o 27obj-$(CONFIG_DVB_OR51211) += or51211.o
31obj-$(CONFIG_DVB_OR51132) += or51132.o 28obj-$(CONFIG_DVB_OR51132) += or51132.o
diff --git a/drivers/media/dvb/frontends/at76c651.c b/drivers/media/dvb/frontends/at76c651.c
deleted file mode 100644
index 8e0f4b3a1417..000000000000
--- a/drivers/media/dvb/frontends/at76c651.c
+++ /dev/null
@@ -1,450 +0,0 @@
1/*
2 * at76c651.c
3 *
4 * Atmel DVB-C Frontend Driver (at76c651/tua6010xs)
5 *
6 * Copyright (C) 2001 fnbrd <fnbrd@gmx.de>
7 * & 2002-2004 Andreas Oberritter <obi@linuxtv.org>
8 * & 2003 Wolfram Joost <dbox2@frokaschwei.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * AT76C651
25 * http://www.nalanda.nitc.ac.in/industry/datasheets/atmel/acrobat/doc1293.pdf
26 * http://www.atmel.com/atmel/acrobat/doc1320.pdf
27 */
28
29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/moduleparam.h>
32#include <linux/kernel.h>
33#include <linux/string.h>
34#include <linux/slab.h>
35#include <linux/bitops.h>
36#include "dvb_frontend.h"
37#include "at76c651.h"
38
39
40struct at76c651_state {
41
42 struct i2c_adapter* i2c;
43
44 struct dvb_frontend_ops ops;
45
46 const struct at76c651_config* config;
47
48 struct dvb_frontend frontend;
49
50 /* revision of the chip */
51 u8 revision;
52
53 /* last QAM value set */
54 u8 qam;
55};
56
57static int debug;
58#define dprintk(args...) \
59 do { \
60 if (debug) printk(KERN_DEBUG "at76c651: " args); \
61 } while (0)
62
63
64#if ! defined(__powerpc__)
65static __inline__ int __ilog2(unsigned long x)
66{
67 int i;
68
69 if (x == 0)
70 return -1;
71
72 for (i = 0; x != 0; i++)
73 x >>= 1;
74
75 return i - 1;
76}
77#endif
78
79static int at76c651_writereg(struct at76c651_state* state, u8 reg, u8 data)
80{
81 int ret;
82 u8 buf[] = { reg, data };
83 struct i2c_msg msg =
84 { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
85
86 ret = i2c_transfer(state->i2c, &msg, 1);
87
88 if (ret != 1)
89 dprintk("%s: writereg error "
90 "(reg == 0x%02x, val == 0x%02x, ret == %i)\n",
91 __FUNCTION__, reg, data, ret);
92
93 msleep(10);
94
95 return (ret != 1) ? -EREMOTEIO : 0;
96}
97
98static u8 at76c651_readreg(struct at76c651_state* state, u8 reg)
99{
100 int ret;
101 u8 val;
102 struct i2c_msg msg[] = {
103 { .addr = state->config->demod_address, .flags = 0, .buf = &reg, .len = 1 },
104 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = &val, .len = 1 }
105 };
106
107 ret = i2c_transfer(state->i2c, msg, 2);
108
109 if (ret != 2)
110 dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret);
111
112 return val;
113}
114
115static int at76c651_reset(struct at76c651_state* state)
116{
117 return at76c651_writereg(state, 0x07, 0x01);
118}
119
120static void at76c651_disable_interrupts(struct at76c651_state* state)
121{
122 at76c651_writereg(state, 0x0b, 0x00);
123}
124
125static int at76c651_set_auto_config(struct at76c651_state *state)
126{
127 /*
128 * Autoconfig
129 */
130
131 at76c651_writereg(state, 0x06, 0x01);
132
133 /*
134 * Performance optimizations, should be done after autoconfig
135 */
136
137 at76c651_writereg(state, 0x10, 0x06);
138 at76c651_writereg(state, 0x11, ((state->qam == 5) || (state->qam == 7)) ? 0x12 : 0x10);
139 at76c651_writereg(state, 0x15, 0x28);
140 at76c651_writereg(state, 0x20, 0x09);
141 at76c651_writereg(state, 0x24, ((state->qam == 5) || (state->qam == 7)) ? 0xC0 : 0x90);
142 at76c651_writereg(state, 0x30, 0x90);
143 if (state->qam == 5)
144 at76c651_writereg(state, 0x35, 0x2A);
145
146 /*
147 * Initialize A/D-converter
148 */
149
150 if (state->revision == 0x11) {
151 at76c651_writereg(state, 0x2E, 0x38);
152 at76c651_writereg(state, 0x2F, 0x13);
153 }
154
155 at76c651_disable_interrupts(state);
156
157 /*
158 * Restart operation
159 */
160
161 at76c651_reset(state);
162
163 return 0;
164}
165
166static void at76c651_set_bbfreq(struct at76c651_state* state)
167{
168 at76c651_writereg(state, 0x04, 0x3f);
169 at76c651_writereg(state, 0x05, 0xee);
170}
171
172static int at76c651_set_symbol_rate(struct at76c651_state* state, u32 symbol_rate)
173{
174 u8 exponent;
175 u32 mantissa;
176
177 if (symbol_rate > 9360000)
178 return -EINVAL;
179
180 /*
181 * FREF = 57800 kHz
182 * exponent = 10 + floor (log2(symbol_rate / FREF))
183 * mantissa = (symbol_rate / FREF) * (1 << (30 - exponent))
184 */
185
186 exponent = __ilog2((symbol_rate << 4) / 903125);
187 mantissa = ((symbol_rate / 3125) * (1 << (24 - exponent))) / 289;
188
189 at76c651_writereg(state, 0x00, mantissa >> 13);
190 at76c651_writereg(state, 0x01, mantissa >> 5);
191 at76c651_writereg(state, 0x02, (mantissa << 3) | exponent);
192
193 return 0;
194}
195
196static int at76c651_set_qam(struct at76c651_state *state, fe_modulation_t qam)
197{
198 switch (qam) {
199 case QPSK:
200 state->qam = 0x02;
201 break;
202 case QAM_16:
203 state->qam = 0x04;
204 break;
205 case QAM_32:
206 state->qam = 0x05;
207 break;
208 case QAM_64:
209 state->qam = 0x06;
210 break;
211 case QAM_128:
212 state->qam = 0x07;
213 break;
214 case QAM_256:
215 state->qam = 0x08;
216 break;
217#if 0
218 case QAM_512:
219 state->qam = 0x09;
220 break;
221 case QAM_1024:
222 state->qam = 0x0A;
223 break;
224#endif
225 default:
226 return -EINVAL;
227
228 }
229
230 return at76c651_writereg(state, 0x03, state->qam);
231}
232
233static int at76c651_set_inversion(struct at76c651_state* state, fe_spectral_inversion_t inversion)
234{
235 u8 feciqinv = at76c651_readreg(state, 0x60);
236
237 switch (inversion) {
238 case INVERSION_OFF:
239 feciqinv |= 0x02;
240 feciqinv &= 0xFE;
241 break;
242
243 case INVERSION_ON:
244 feciqinv |= 0x03;
245 break;
246
247 case INVERSION_AUTO:
248 feciqinv &= 0xFC;
249 break;
250
251 default:
252 return -EINVAL;
253 }
254
255 return at76c651_writereg(state, 0x60, feciqinv);
256}
257
258static int at76c651_set_parameters(struct dvb_frontend* fe,
259 struct dvb_frontend_parameters *p)
260{
261 int ret;
262 struct at76c651_state* state = fe->demodulator_priv;
263
264 at76c651_writereg(state, 0x0c, 0xc3);
265 state->config->pll_set(fe, p);
266 at76c651_writereg(state, 0x0c, 0xc2);
267
268 if ((ret = at76c651_set_symbol_rate(state, p->u.qam.symbol_rate)))
269 return ret;
270
271 if ((ret = at76c651_set_inversion(state, p->inversion)))
272 return ret;
273
274 return at76c651_set_auto_config(state);
275}
276
277static int at76c651_set_defaults(struct dvb_frontend* fe)
278{
279 struct at76c651_state* state = fe->demodulator_priv;
280
281 at76c651_set_symbol_rate(state, 6900000);
282 at76c651_set_qam(state, QAM_64);
283 at76c651_set_bbfreq(state);
284 at76c651_set_auto_config(state);
285
286 if (state->config->pll_init) {
287 at76c651_writereg(state, 0x0c, 0xc3);
288 state->config->pll_init(fe);
289 at76c651_writereg(state, 0x0c, 0xc2);
290 }
291
292 return 0;
293}
294
295static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status)
296{
297 struct at76c651_state* state = fe->demodulator_priv;
298 u8 sync;
299
300 /*
301 * Bits: FEC, CAR, EQU, TIM, AGC2, AGC1, ADC, PLL (PLL=0)
302 */
303 sync = at76c651_readreg(state, 0x80);
304 *status = 0;
305
306 if (sync & (0x04 | 0x10)) /* AGC1 || TIM */
307 *status |= FE_HAS_SIGNAL;
308 if (sync & 0x10) /* TIM */
309 *status |= FE_HAS_CARRIER;
310 if (sync & 0x80) /* FEC */
311 *status |= FE_HAS_VITERBI;
312 if (sync & 0x40) /* CAR */
313 *status |= FE_HAS_SYNC;
314 if ((sync & 0xF0) == 0xF0) /* TIM && EQU && CAR && FEC */
315 *status |= FE_HAS_LOCK;
316
317 return 0;
318}
319
320static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber)
321{
322 struct at76c651_state* state = fe->demodulator_priv;
323
324 *ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16;
325 *ber |= at76c651_readreg(state, 0x82) << 8;
326 *ber |= at76c651_readreg(state, 0x83);
327 *ber *= 10;
328
329 return 0;
330}
331
332static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength)
333{
334 struct at76c651_state* state = fe->demodulator_priv;
335
336 u8 gain = ~at76c651_readreg(state, 0x91);
337 *strength = (gain << 8) | gain;
338
339 return 0;
340}
341
342static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr)
343{
344 struct at76c651_state* state = fe->demodulator_priv;
345
346 *snr = 0xFFFF -
347 ((at76c651_readreg(state, 0x8F) << 8) |
348 at76c651_readreg(state, 0x90));
349
350 return 0;
351}
352
353static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
354{
355 struct at76c651_state* state = fe->demodulator_priv;
356
357 *ucblocks = at76c651_readreg(state, 0x82);
358
359 return 0;
360}
361
362static int at76c651_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *fesettings)
363{
364 fesettings->min_delay_ms = 50;
365 fesettings->step_size = 0;
366 fesettings->max_drift = 0;
367 return 0;
368}
369
370static void at76c651_release(struct dvb_frontend* fe)
371{
372 struct at76c651_state* state = fe->demodulator_priv;
373 kfree(state);
374}
375
376static struct dvb_frontend_ops at76c651_ops;
377
378struct dvb_frontend* at76c651_attach(const struct at76c651_config* config,
379 struct i2c_adapter* i2c)
380{
381 struct at76c651_state* state = NULL;
382
383 /* allocate memory for the internal state */
384 state = kmalloc(sizeof(struct at76c651_state), GFP_KERNEL);
385 if (state == NULL) goto error;
386
387 /* setup the state */
388 state->config = config;
389 state->qam = 0;
390
391 /* check if the demod is there */
392 if (at76c651_readreg(state, 0x0e) != 0x65) goto error;
393
394 /* finalise state setup */
395 state->i2c = i2c;
396 state->revision = at76c651_readreg(state, 0x0f) & 0xfe;
397 memcpy(&state->ops, &at76c651_ops, sizeof(struct dvb_frontend_ops));
398
399 /* create dvb_frontend */
400 state->frontend.ops = &state->ops;
401 state->frontend.demodulator_priv = state;
402 return &state->frontend;
403
404error:
405 kfree(state);
406 return NULL;
407}
408
409static struct dvb_frontend_ops at76c651_ops = {
410
411 .info = {
412 .name = "Atmel AT76C651B DVB-C",
413 .type = FE_QAM,
414 .frequency_min = 48250000,
415 .frequency_max = 863250000,
416 .frequency_stepsize = 62500,
417 /*.frequency_tolerance = */ /* FIXME: 12% of SR */
418 .symbol_rate_min = 0, /* FIXME */
419 .symbol_rate_max = 9360000, /* FIXME */
420 .symbol_rate_tolerance = 4000,
421 .caps = FE_CAN_INVERSION_AUTO |
422 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
423 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
424 FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
425 FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | FE_CAN_QAM_128 |
426 FE_CAN_MUTE_TS | FE_CAN_QAM_256 | FE_CAN_RECOVER
427 },
428
429 .release = at76c651_release,
430
431 .init = at76c651_set_defaults,
432
433 .set_frontend = at76c651_set_parameters,
434 .get_tune_settings = at76c651_get_tune_settings,
435
436 .read_status = at76c651_read_status,
437 .read_ber = at76c651_read_ber,
438 .read_signal_strength = at76c651_read_signal_strength,
439 .read_snr = at76c651_read_snr,
440 .read_ucblocks = at76c651_read_ucblocks,
441};
442
443module_param(debug, int, 0644);
444MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
445
446MODULE_DESCRIPTION("Atmel AT76C651 DVB-C Demodulator Driver");
447MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>");
448MODULE_LICENSE("GPL");
449
450EXPORT_SYMBOL(at76c651_attach);
diff --git a/drivers/media/dvb/frontends/at76c651.h b/drivers/media/dvb/frontends/at76c651.h
deleted file mode 100644
index 34054df93608..000000000000
--- a/drivers/media/dvb/frontends/at76c651.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * at76c651.c
3 *
4 * Atmel DVB-C Frontend Driver (at76c651)
5 *
6 * Copyright (C) 2001 fnbrd <fnbrd@gmx.de>
7 * & 2002-2004 Andreas Oberritter <obi@linuxtv.org>
8 * & 2003 Wolfram Joost <dbox2@frokaschwei.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * AT76C651
25 * http://www.nalanda.nitc.ac.in/industry/datasheets/atmel/acrobat/doc1293.pdf
26 * http://www.atmel.com/atmel/acrobat/doc1320.pdf
27 */
28
29#ifndef AT76C651_H
30#define AT76C651_H
31
32#include <linux/dvb/frontend.h>
33
34struct at76c651_config
35{
36 /* the demodulator's i2c address */
37 u8 demod_address;
38
39 /* PLL maintenance */
40 int (*pll_init)(struct dvb_frontend* fe);
41 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
42};
43
44extern struct dvb_frontend* at76c651_attach(const struct at76c651_config* config,
45 struct i2c_adapter* i2c);
46
47#endif // AT76C651_H
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 1b9934ea5b06..4dcb6050d4fa 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -326,11 +326,11 @@ struct dvb_pll_desc dvb_pll_tuv1236d = {
326}; 326};
327EXPORT_SYMBOL(dvb_pll_tuv1236d); 327EXPORT_SYMBOL(dvb_pll_tuv1236d);
328 328
329/* Samsung TBMV30111IN 329/* Samsung TBMV30111IN / TBMV30712IN1
330 * used in Air2PC ATSC - 2nd generation (nxt2002) 330 * used in Air2PC ATSC - 2nd generation (nxt2002)
331 */ 331 */
332struct dvb_pll_desc dvb_pll_tbmv30111in = { 332struct dvb_pll_desc dvb_pll_samsung_tbmv = {
333 .name = "Samsung TBMV30111IN", 333 .name = "Samsung TBMV30111IN / TBMV30712IN1",
334 .min = 54000000, 334 .min = 54000000,
335 .max = 860000000, 335 .max = 860000000,
336 .count = 6, 336 .count = 6,
@@ -343,7 +343,7 @@ struct dvb_pll_desc dvb_pll_tbmv30111in = {
343 { 999999999, 44000000, 166666, 0xfc, 0x02 }, 343 { 999999999, 44000000, 166666, 0xfc, 0x02 },
344 } 344 }
345}; 345};
346EXPORT_SYMBOL(dvb_pll_tbmv30111in); 346EXPORT_SYMBOL(dvb_pll_samsung_tbmv);
347 347
348/* 348/*
349 * Philips SD1878 Tuner. 349 * Philips SD1878 Tuner.
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
index f682c09189b3..bb8d4b4eb183 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -38,7 +38,7 @@ extern struct dvb_pll_desc dvb_pll_tded4;
38 38
39extern struct dvb_pll_desc dvb_pll_tuv1236d; 39extern struct dvb_pll_desc dvb_pll_tuv1236d;
40extern struct dvb_pll_desc dvb_pll_tdhu2; 40extern struct dvb_pll_desc dvb_pll_tdhu2;
41extern struct dvb_pll_desc dvb_pll_tbmv30111in; 41extern struct dvb_pll_desc dvb_pll_samsung_tbmv;
42extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261; 42extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261;
43 43
44int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, 44int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c
deleted file mode 100644
index 4f263e65ba14..000000000000
--- a/drivers/media/dvb/frontends/nxt2002.c
+++ /dev/null
@@ -1,706 +0,0 @@
1/*
2 Support for B2C2/BBTI Technisat Air2PC - ATSC
3
4 Copyright (C) 2004 Taylor Jacob <rtjacob@earthlink.net>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20*/
21
22/*
23 * This driver needs external firmware. Please use the command
24 * "<kerneldir>/Documentation/dvb/get_dvb_firmware nxt2002" to
25 * download/extract it, and then copy it to /usr/lib/hotplug/firmware
26 * or /lib/firmware (depending on configuration of firmware hotplug).
27 */
28#define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw"
29#define CRC_CCIT_MASK 0x1021
30
31#include <linux/init.h>
32#include <linux/module.h>
33#include <linux/moduleparam.h>
34#include <linux/device.h>
35#include <linux/firmware.h>
36#include <linux/string.h>
37#include <linux/slab.h>
38
39#include "dvb_frontend.h"
40#include "nxt2002.h"
41
42struct nxt2002_state {
43
44 struct i2c_adapter* i2c;
45 struct dvb_frontend_ops ops;
46 const struct nxt2002_config* config;
47 struct dvb_frontend frontend;
48
49 /* demodulator private data */
50 u8 initialised:1;
51};
52
53static int debug;
54#define dprintk(args...) \
55 do { \
56 if (debug) printk(KERN_DEBUG "nxt2002: " args); \
57 } while (0)
58
59static int i2c_writebytes (struct nxt2002_state* state, u8 reg, u8 *buf, u8 len)
60{
61 /* probbably a much better way or doing this */
62 u8 buf2 [256],x;
63 int err;
64 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 };
65
66 buf2[0] = reg;
67 for (x = 0 ; x < len ; x++)
68 buf2[x+1] = buf[x];
69
70 if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
71 printk ("%s: i2c write error (addr %02x, err == %i)\n",
72 __FUNCTION__, state->config->demod_address, err);
73 return -EREMOTEIO;
74 }
75
76 return 0;
77}
78
79static u8 i2c_readbytes (struct nxt2002_state* state, u8 reg, u8* buf, u8 len)
80{
81 u8 reg2 [] = { reg };
82
83 struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = reg2, .len = 1 },
84 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } };
85
86 int err;
87
88 if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) {
89 printk ("%s: i2c read error (addr %02x, err == %i)\n",
90 __FUNCTION__, state->config->demod_address, err);
91 return -EREMOTEIO;
92 }
93
94 return 0;
95}
96
97static u16 nxt2002_crc(u16 crc, u8 c)
98{
99
100 u8 i;
101 u16 input = (u16) c & 0xFF;
102
103 input<<=8;
104 for(i=0 ;i<8 ;i++) {
105 if((crc ^ input) & 0x8000)
106 crc=(crc<<1)^CRC_CCIT_MASK;
107 else
108 crc<<=1;
109 input<<=1;
110 }
111 return crc;
112}
113
114static int nxt2002_writereg_multibyte (struct nxt2002_state* state, u8 reg, u8* data, u8 len)
115{
116 u8 buf;
117 dprintk("%s\n", __FUNCTION__);
118
119 /* set multi register length */
120 i2c_writebytes(state,0x34,&len,1);
121
122 /* set mutli register register */
123 i2c_writebytes(state,0x35,&reg,1);
124
125 /* send the actual data */
126 i2c_writebytes(state,0x36,data,len);
127
128 /* toggle the multireg write bit*/
129 buf = 0x02;
130 i2c_writebytes(state,0x21,&buf,1);
131
132 i2c_readbytes(state,0x21,&buf,1);
133
134 if ((buf & 0x02) == 0)
135 return 0;
136
137 dprintk("Error writing multireg register %02X\n",reg);
138
139 return 0;
140}
141
142static int nxt2002_readreg_multibyte (struct nxt2002_state* state, u8 reg, u8* data, u8 len)
143{
144 u8 len2;
145 dprintk("%s\n", __FUNCTION__);
146
147 /* set multi register length */
148 len2 = len & 0x80;
149 i2c_writebytes(state,0x34,&len2,1);
150
151 /* set mutli register register */
152 i2c_writebytes(state,0x35,&reg,1);
153
154 /* send the actual data */
155 i2c_readbytes(state,reg,data,len);
156
157 return 0;
158}
159
160static void nxt2002_microcontroller_stop (struct nxt2002_state* state)
161{
162 u8 buf[2],counter = 0;
163 dprintk("%s\n", __FUNCTION__);
164
165 buf[0] = 0x80;
166 i2c_writebytes(state,0x22,buf,1);
167
168 while (counter < 20) {
169 i2c_readbytes(state,0x31,buf,1);
170 if (buf[0] & 0x40)
171 return;
172 msleep(10);
173 counter++;
174 }
175
176 dprintk("Timeout waiting for micro to stop.. This is ok after firmware upload\n");
177 return;
178}
179
180static void nxt2002_microcontroller_start (struct nxt2002_state* state)
181{
182 u8 buf;
183 dprintk("%s\n", __FUNCTION__);
184
185 buf = 0x00;
186 i2c_writebytes(state,0x22,&buf,1);
187}
188
189static int nxt2002_writetuner (struct nxt2002_state* state, u8* data)
190{
191 u8 buf,count = 0;
192
193 dprintk("Tuner Bytes: %02X %02X %02X %02X\n",data[0],data[1],data[2],data[3]);
194
195 dprintk("%s\n", __FUNCTION__);
196 /* stop the micro first */
197 nxt2002_microcontroller_stop(state);
198
199 /* set the i2c transfer speed to the tuner */
200 buf = 0x03;
201 i2c_writebytes(state,0x20,&buf,1);
202
203 /* setup to transfer 4 bytes via i2c */
204 buf = 0x04;
205 i2c_writebytes(state,0x34,&buf,1);
206
207 /* write actual tuner bytes */
208 i2c_writebytes(state,0x36,data,4);
209
210 /* set tuner i2c address */
211 buf = 0xC2;
212 i2c_writebytes(state,0x35,&buf,1);
213
214 /* write UC Opmode to begin transfer */
215 buf = 0x80;
216 i2c_writebytes(state,0x21,&buf,1);
217
218 while (count < 20) {
219 i2c_readbytes(state,0x21,&buf,1);
220 if ((buf & 0x80)== 0x00)
221 return 0;
222 msleep(100);
223 count++;
224 }
225
226 printk("nxt2002: timeout error writing tuner\n");
227 return 0;
228}
229
230static void nxt2002_agc_reset(struct nxt2002_state* state)
231{
232 u8 buf;
233 dprintk("%s\n", __FUNCTION__);
234
235 buf = 0x08;
236 i2c_writebytes(state,0x08,&buf,1);
237
238 buf = 0x00;
239 i2c_writebytes(state,0x08,&buf,1);
240
241 return;
242}
243
244static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware *fw)
245{
246
247 struct nxt2002_state* state = fe->demodulator_priv;
248 u8 buf[256],written = 0,chunkpos = 0;
249 u16 rambase,position,crc = 0;
250
251 dprintk("%s\n", __FUNCTION__);
252 dprintk("Firmware is %zu bytes\n",fw->size);
253
254 /* Get the RAM base for this nxt2002 */
255 i2c_readbytes(state,0x10,buf,1);
256
257 if (buf[0] & 0x10)
258 rambase = 0x1000;
259 else
260 rambase = 0x0000;
261
262 dprintk("rambase on this nxt2002 is %04X\n",rambase);
263
264 /* Hold the micro in reset while loading firmware */
265 buf[0] = 0x80;
266 i2c_writebytes(state,0x2B,buf,1);
267
268 for (position = 0; position < fw->size ; position++) {
269 if (written == 0) {
270 crc = 0;
271 chunkpos = 0x28;
272 buf[0] = ((rambase + position) >> 8);
273 buf[1] = (rambase + position) & 0xFF;
274 buf[2] = 0x81;
275 /* write starting address */
276 i2c_writebytes(state,0x29,buf,3);
277 }
278 written++;
279 chunkpos++;
280
281 if ((written % 4) == 0)
282 i2c_writebytes(state,chunkpos,&fw->data[position-3],4);
283
284 crc = nxt2002_crc(crc,fw->data[position]);
285
286 if ((written == 255) || (position+1 == fw->size)) {
287 /* write remaining bytes of firmware */
288 i2c_writebytes(state, chunkpos+4-(written %4),
289 &fw->data[position-(written %4) + 1],
290 written %4);
291 buf[0] = crc << 8;
292 buf[1] = crc & 0xFF;
293
294 /* write crc */
295 i2c_writebytes(state,0x2C,buf,2);
296
297 /* do a read to stop things */
298 i2c_readbytes(state,0x2A,buf,1);
299
300 /* set transfer mode to complete */
301 buf[0] = 0x80;
302 i2c_writebytes(state,0x2B,buf,1);
303
304 written = 0;
305 }
306 }
307
308 printk ("done.\n");
309 return 0;
310};
311
312static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe,
313 struct dvb_frontend_parameters *p)
314{
315 struct nxt2002_state* state = fe->demodulator_priv;
316 u32 freq = 0;
317 u16 tunerfreq = 0;
318 u8 buf[4];
319
320 freq = 44000 + ( p->frequency / 1000 );
321
322 dprintk("freq = %d p->frequency = %d\n",freq,p->frequency);
323
324 tunerfreq = freq * 24/4000;
325
326 buf[0] = (tunerfreq >> 8) & 0x7F;
327 buf[1] = (tunerfreq & 0xFF);
328
329 if (p->frequency <= 214000000) {
330 buf[2] = 0x84 + (0x06 << 3);
331 buf[3] = (p->frequency <= 172000000) ? 0x01 : 0x02;
332 } else if (p->frequency <= 721000000) {
333 buf[2] = 0x84 + (0x07 << 3);
334 buf[3] = (p->frequency <= 467000000) ? 0x02 : 0x08;
335 } else if (p->frequency <= 841000000) {
336 buf[2] = 0x84 + (0x0E << 3);
337 buf[3] = 0x08;
338 } else {
339 buf[2] = 0x84 + (0x0F << 3);
340 buf[3] = 0x02;
341 }
342
343 /* write frequency information */
344 nxt2002_writetuner(state,buf);
345
346 /* reset the agc now that tuning has been completed */
347 nxt2002_agc_reset(state);
348
349 /* set target power level */
350 switch (p->u.vsb.modulation) {
351 case QAM_64:
352 case QAM_256:
353 buf[0] = 0x74;
354 break;
355 case VSB_8:
356 buf[0] = 0x70;
357 break;
358 default:
359 return -EINVAL;
360 break;
361 }
362 i2c_writebytes(state,0x42,buf,1);
363
364 /* configure sdm */
365 buf[0] = 0x87;
366 i2c_writebytes(state,0x57,buf,1);
367
368 /* write sdm1 input */
369 buf[0] = 0x10;
370 buf[1] = 0x00;
371 nxt2002_writereg_multibyte(state,0x58,buf,2);
372
373 /* write sdmx input */
374 switch (p->u.vsb.modulation) {
375 case QAM_64:
376 buf[0] = 0x68;
377 break;
378 case QAM_256:
379 buf[0] = 0x64;
380 break;
381 case VSB_8:
382 buf[0] = 0x60;
383 break;
384 default:
385 return -EINVAL;
386 break;
387 }
388 buf[1] = 0x00;
389 nxt2002_writereg_multibyte(state,0x5C,buf,2);
390
391 /* write adc power lpf fc */
392 buf[0] = 0x05;
393 i2c_writebytes(state,0x43,buf,1);
394
395 /* write adc power lpf fc */
396 buf[0] = 0x05;
397 i2c_writebytes(state,0x43,buf,1);
398
399 /* write accumulator2 input */
400 buf[0] = 0x80;
401 buf[1] = 0x00;
402 nxt2002_writereg_multibyte(state,0x4B,buf,2);
403
404 /* write kg1 */
405 buf[0] = 0x00;
406 i2c_writebytes(state,0x4D,buf,1);
407
408 /* write sdm12 lpf fc */
409 buf[0] = 0x44;
410 i2c_writebytes(state,0x55,buf,1);
411
412 /* write agc control reg */
413 buf[0] = 0x04;
414 i2c_writebytes(state,0x41,buf,1);
415
416 /* write agc ucgp0 */
417 switch (p->u.vsb.modulation) {
418 case QAM_64:
419 buf[0] = 0x02;
420 break;
421 case QAM_256:
422 buf[0] = 0x03;
423 break;
424 case VSB_8:
425 buf[0] = 0x00;
426 break;
427 default:
428 return -EINVAL;
429 break;
430 }
431 i2c_writebytes(state,0x30,buf,1);
432
433 /* write agc control reg */
434 buf[0] = 0x00;
435 i2c_writebytes(state,0x41,buf,1);
436
437 /* write accumulator2 input */
438 buf[0] = 0x80;
439 buf[1] = 0x00;
440 nxt2002_writereg_multibyte(state,0x49,buf,2);
441 nxt2002_writereg_multibyte(state,0x4B,buf,2);
442
443 /* write agc control reg */
444 buf[0] = 0x04;
445 i2c_writebytes(state,0x41,buf,1);
446
447 nxt2002_microcontroller_start(state);
448
449 /* adjacent channel detection should be done here, but I don't
450 have any stations with this need so I cannot test it */
451
452 return 0;
453}
454
455static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status)
456{
457 struct nxt2002_state* state = fe->demodulator_priv;
458 u8 lock;
459 i2c_readbytes(state,0x31,&lock,1);
460
461 *status = 0;
462 if (lock & 0x20) {
463 *status |= FE_HAS_SIGNAL;
464 *status |= FE_HAS_CARRIER;
465 *status |= FE_HAS_VITERBI;
466 *status |= FE_HAS_SYNC;
467 *status |= FE_HAS_LOCK;
468 }
469 return 0;
470}
471
472static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber)
473{
474 struct nxt2002_state* state = fe->demodulator_priv;
475 u8 b[3];
476
477 nxt2002_readreg_multibyte(state,0xE6,b,3);
478
479 *ber = ((b[0] << 8) + b[1]) * 8;
480
481 return 0;
482}
483
484static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength)
485{
486 struct nxt2002_state* state = fe->demodulator_priv;
487 u8 b[2];
488 u16 temp = 0;
489
490 /* setup to read cluster variance */
491 b[0] = 0x00;
492 i2c_writebytes(state,0xA1,b,1);
493
494 /* get multreg val */
495 nxt2002_readreg_multibyte(state,0xA6,b,2);
496
497 temp = (b[0] << 8) | b[1];
498 *strength = ((0x7FFF - temp) & 0x0FFF) * 16;
499
500 return 0;
501}
502
503static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr)
504{
505
506 struct nxt2002_state* state = fe->demodulator_priv;
507 u8 b[2];
508 u16 temp = 0, temp2;
509 u32 snrdb = 0;
510
511 /* setup to read cluster variance */
512 b[0] = 0x00;
513 i2c_writebytes(state,0xA1,b,1);
514
515 /* get multreg val from 0xA6 */
516 nxt2002_readreg_multibyte(state,0xA6,b,2);
517
518 temp = (b[0] << 8) | b[1];
519 temp2 = 0x7FFF - temp;
520
521 /* snr will be in db */
522 if (temp2 > 0x7F00)
523 snrdb = 1000*24 + ( 1000*(30-24) * ( temp2 - 0x7F00 ) / ( 0x7FFF - 0x7F00 ) );
524 else if (temp2 > 0x7EC0)
525 snrdb = 1000*18 + ( 1000*(24-18) * ( temp2 - 0x7EC0 ) / ( 0x7F00 - 0x7EC0 ) );
526 else if (temp2 > 0x7C00)
527 snrdb = 1000*12 + ( 1000*(18-12) * ( temp2 - 0x7C00 ) / ( 0x7EC0 - 0x7C00 ) );
528 else
529 snrdb = 1000*0 + ( 1000*(12-0) * ( temp2 - 0 ) / ( 0x7C00 - 0 ) );
530
531 /* the value reported back from the frontend will be FFFF=32db 0000=0db */
532
533 *snr = snrdb * (0xFFFF/32000);
534
535 return 0;
536}
537
538static int nxt2002_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
539{
540 struct nxt2002_state* state = fe->demodulator_priv;
541 u8 b[3];
542
543 nxt2002_readreg_multibyte(state,0xE6,b,3);
544 *ucblocks = b[2];
545
546 return 0;
547}
548
549static int nxt2002_sleep(struct dvb_frontend* fe)
550{
551 return 0;
552}
553
554static int nxt2002_init(struct dvb_frontend* fe)
555{
556 struct nxt2002_state* state = fe->demodulator_priv;
557 const struct firmware *fw;
558 int ret;
559 u8 buf[2];
560
561 if (!state->initialised) {
562 /* request the firmware, this will block until someone uploads it */
563 printk("nxt2002: Waiting for firmware upload (%s)...\n", NXT2002_DEFAULT_FIRMWARE);
564 ret = state->config->request_firmware(fe, &fw, NXT2002_DEFAULT_FIRMWARE);
565 printk("nxt2002: Waiting for firmware upload(2)...\n");
566 if (ret) {
567 printk("nxt2002: no firmware upload (timeout or file not found?)\n");
568 return ret;
569 }
570
571 ret = nxt2002_load_firmware(fe, fw);
572 if (ret) {
573 printk("nxt2002: writing firmware to device failed\n");
574 release_firmware(fw);
575 return ret;
576 }
577 printk("nxt2002: firmware upload complete\n");
578
579 /* Put the micro into reset */
580 nxt2002_microcontroller_stop(state);
581
582 /* ensure transfer is complete */
583 buf[0]=0;
584 i2c_writebytes(state,0x2B,buf,1);
585
586 /* Put the micro into reset for real this time */
587 nxt2002_microcontroller_stop(state);
588
589 /* soft reset everything (agc,frontend,eq,fec)*/
590 buf[0] = 0x0F;
591 i2c_writebytes(state,0x08,buf,1);
592 buf[0] = 0x00;
593 i2c_writebytes(state,0x08,buf,1);
594
595 /* write agc sdm configure */
596 buf[0] = 0xF1;
597 i2c_writebytes(state,0x57,buf,1);
598
599 /* write mod output format */
600 buf[0] = 0x20;
601 i2c_writebytes(state,0x09,buf,1);
602
603 /* write fec mpeg mode */
604 buf[0] = 0x7E;
605 buf[1] = 0x00;
606 i2c_writebytes(state,0xE9,buf,2);
607
608 /* write mux selection */
609 buf[0] = 0x00;
610 i2c_writebytes(state,0xCC,buf,1);
611
612 state->initialised = 1;
613 }
614
615 return 0;
616}
617
618static int nxt2002_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings)
619{
620 fesettings->min_delay_ms = 500;
621 fesettings->step_size = 0;
622 fesettings->max_drift = 0;
623 return 0;
624}
625
626static void nxt2002_release(struct dvb_frontend* fe)
627{
628 struct nxt2002_state* state = fe->demodulator_priv;
629 kfree(state);
630}
631
632static struct dvb_frontend_ops nxt2002_ops;
633
634struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config,
635 struct i2c_adapter* i2c)
636{
637 struct nxt2002_state* state = NULL;
638 u8 buf [] = {0,0,0,0,0};
639
640 /* allocate memory for the internal state */
641 state = kmalloc(sizeof(struct nxt2002_state), GFP_KERNEL);
642 if (state == NULL) goto error;
643
644 /* setup the state */
645 state->config = config;
646 state->i2c = i2c;
647 memcpy(&state->ops, &nxt2002_ops, sizeof(struct dvb_frontend_ops));
648 state->initialised = 0;
649
650 /* Check the first 5 registers to ensure this a revision we can handle */
651
652 i2c_readbytes(state, 0x00, buf, 5);
653 if (buf[0] != 0x04) goto error; /* device id */
654 if (buf[1] != 0x02) goto error; /* fab id */
655 if (buf[2] != 0x11) goto error; /* month */
656 if (buf[3] != 0x20) goto error; /* year msb */
657 if (buf[4] != 0x00) goto error; /* year lsb */
658
659 /* create dvb_frontend */
660 state->frontend.ops = &state->ops;
661 state->frontend.demodulator_priv = state;
662 return &state->frontend;
663
664error:
665 kfree(state);
666 return NULL;
667}
668
669static struct dvb_frontend_ops nxt2002_ops = {
670
671 .info = {
672 .name = "Nextwave nxt2002 VSB/QAM frontend",
673 .type = FE_ATSC,
674 .frequency_min = 54000000,
675 .frequency_max = 860000000,
676 /* stepsize is just a guess */
677 .frequency_stepsize = 166666,
678 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
679 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
680 FE_CAN_8VSB | FE_CAN_QAM_64 | FE_CAN_QAM_256
681 },
682
683 .release = nxt2002_release,
684
685 .init = nxt2002_init,
686 .sleep = nxt2002_sleep,
687
688 .set_frontend = nxt2002_setup_frontend_parameters,
689 .get_tune_settings = nxt2002_get_tune_settings,
690
691 .read_status = nxt2002_read_status,
692 .read_ber = nxt2002_read_ber,
693 .read_signal_strength = nxt2002_read_signal_strength,
694 .read_snr = nxt2002_read_snr,
695 .read_ucblocks = nxt2002_read_ucblocks,
696
697};
698
699module_param(debug, int, 0644);
700MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
701
702MODULE_DESCRIPTION("NXT2002 ATSC (8VSB & ITU J83 AnnexB FEC QAM64/256) demodulator driver");
703MODULE_AUTHOR("Taylor Jacob");
704MODULE_LICENSE("GPL");
705
706EXPORT_SYMBOL(nxt2002_attach);
diff --git a/drivers/media/dvb/frontends/nxt2002.h b/drivers/media/dvb/frontends/nxt2002.h
deleted file mode 100644
index 462301f577ee..000000000000
--- a/drivers/media/dvb/frontends/nxt2002.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 Driver for the Nxt2002 demodulator
3*/
4
5#ifndef NXT2002_H
6#define NXT2002_H
7
8#include <linux/dvb/frontend.h>
9#include <linux/firmware.h>
10
11struct nxt2002_config
12{
13 /* the demodulator's i2c address */
14 u8 demod_address;
15
16 /* request firmware for device */
17 int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
18};
19
20extern struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config,
21 struct i2c_adapter* i2c);
22
23#endif // NXT2002_H
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 78d2b93d35b9..9e3535394509 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * Support for NXT2002 and NXT2004 - VSB/QAM 2 * Support for NXT2002 and NXT2004 - VSB/QAM
3 * 3 *
4 * Copyright (C) 2005 Kirk Lapray (kirk.lapray@gmail.com) 4 * Copyright (C) 2005 Kirk Lapray <kirk.lapray@gmail.com>
5 * Copyright (C) 2006 Michael Krufky <mkrufky@m1k.net>
5 * based on nxt2002 by Taylor Jacob <rtjacob@earthlink.net> 6 * based on nxt2002 by Taylor Jacob <rtjacob@earthlink.net>
6 * and nxt2004 by Jean-Francois Thibert (jeanfrancois@sagetv.com) 7 * and nxt2004 by Jean-Francois Thibert <jeanfrancois@sagetv.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License as published by
@@ -614,7 +615,17 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
614 /* write sdm1 input */ 615 /* write sdm1 input */
615 buf[0] = 0x10; 616 buf[0] = 0x10;
616 buf[1] = 0x00; 617 buf[1] = 0x00;
617 nxt200x_writebytes(state, 0x58, buf, 2); 618 switch (state->demod_chip) {
619 case NXT2002:
620 nxt200x_writereg_multibyte(state, 0x58, buf, 2);
621 break;
622 case NXT2004:
623 nxt200x_writebytes(state, 0x58, buf, 2);
624 break;
625 default:
626 return -EINVAL;
627 break;
628 }
618 629
619 /* write sdmx input */ 630 /* write sdmx input */
620 switch (p->u.vsb.modulation) { 631 switch (p->u.vsb.modulation) {
@@ -632,7 +643,17 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
632 break; 643 break;
633 } 644 }
634 buf[1] = 0x00; 645 buf[1] = 0x00;
635 nxt200x_writebytes(state, 0x5C, buf, 2); 646 switch (state->demod_chip) {
647 case NXT2002:
648 nxt200x_writereg_multibyte(state, 0x5C, buf, 2);
649 break;
650 case NXT2004:
651 nxt200x_writebytes(state, 0x5C, buf, 2);
652 break;
653 default:
654 return -EINVAL;
655 break;
656 }
636 657
637 /* write adc power lpf fc */ 658 /* write adc power lpf fc */
638 buf[0] = 0x05; 659 buf[0] = 0x05;
@@ -648,7 +669,17 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
648 /* write accumulator2 input */ 669 /* write accumulator2 input */
649 buf[0] = 0x80; 670 buf[0] = 0x80;
650 buf[1] = 0x00; 671 buf[1] = 0x00;
651 nxt200x_writebytes(state, 0x4B, buf, 2); 672 switch (state->demod_chip) {
673 case NXT2002:
674 nxt200x_writereg_multibyte(state, 0x4B, buf, 2);
675 break;
676 case NXT2004:
677 nxt200x_writebytes(state, 0x4B, buf, 2);
678 break;
679 default:
680 return -EINVAL;
681 break;
682 }
652 683
653 /* write kg1 */ 684 /* write kg1 */
654 buf[0] = 0x00; 685 buf[0] = 0x00;
@@ -714,8 +745,19 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
714 /* write accumulator2 input */ 745 /* write accumulator2 input */
715 buf[0] = 0x80; 746 buf[0] = 0x80;
716 buf[1] = 0x00; 747 buf[1] = 0x00;
717 nxt200x_writebytes(state, 0x49, buf,2); 748 switch (state->demod_chip) {
718 nxt200x_writebytes(state, 0x4B, buf,2); 749 case NXT2002:
750 nxt200x_writereg_multibyte(state, 0x49, buf, 2);
751 nxt200x_writereg_multibyte(state, 0x4B, buf, 2);
752 break;
753 case NXT2004:
754 nxt200x_writebytes(state, 0x49, buf, 2);
755 nxt200x_writebytes(state, 0x4B, buf, 2);
756 break;
757 default:
758 return -EINVAL;
759 break;
760 }
719 761
720 /* write agc control reg */ 762 /* write agc control reg */
721 buf[0] = 0x04; 763 buf[0] = 0x04;
@@ -1199,7 +1241,7 @@ module_param(debug, int, 0644);
1199MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); 1241MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
1200 1242
1201MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); 1243MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
1202MODULE_AUTHOR("Kirk Lapray, Jean-Francois Thibert, and Taylor Jacob"); 1244MODULE_AUTHOR("Kirk Lapray, Michael Krufky, Jean-Francois Thibert, and Taylor Jacob");
1203MODULE_LICENSE("GPL"); 1245MODULE_LICENSE("GPL");
1204 1246
1205EXPORT_SYMBOL(nxt200x_attach); 1247EXPORT_SYMBOL(nxt200x_attach);
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c
deleted file mode 100644
index d1cabb6a0a13..000000000000
--- a/drivers/media/dvb/frontends/tda80xx.c
+++ /dev/null
@@ -1,734 +0,0 @@
1/*
2 * tda80xx.c
3 *
4 * Philips TDA8044 / TDA8083 QPSK demodulator driver
5 *
6 * Copyright (C) 2001 Felix Domke <tmbinc@elitedvb.net>
7 * Copyright (C) 2002-2004 Andreas Oberritter <obi@linuxtv.org>
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#include <linux/config.h>
25#include <linux/delay.h>
26#include <linux/init.h>
27#include <linux/spinlock.h>
28#include <linux/threads.h>
29#include <linux/interrupt.h>
30#include <linux/kernel.h>
31#include <linux/module.h>
32#include <linux/slab.h>
33#include <asm/irq.h>
34#include <asm/div64.h>
35
36#include "dvb_frontend.h"
37#include "tda80xx.h"
38
39enum {
40 ID_TDA8044 = 0x04,
41 ID_TDA8083 = 0x05,
42};
43
44
45struct tda80xx_state {
46
47 struct i2c_adapter* i2c;
48
49 struct dvb_frontend_ops ops;
50
51 /* configuration settings */
52 const struct tda80xx_config* config;
53
54 struct dvb_frontend frontend;
55
56 u32 clk;
57 int afc_loop;
58 struct work_struct worklet;
59 fe_code_rate_t code_rate;
60 fe_spectral_inversion_t spectral_inversion;
61 fe_status_t status;
62 u8 id;
63};
64
65static int debug = 1;
66#define dprintk if (debug) printk
67
68static u8 tda8044_inittab_pre[] = {
69 0x02, 0x00, 0x6f, 0xb5, 0x86, 0x22, 0x00, 0xea,
70 0x30, 0x42, 0x98, 0x68, 0x70, 0x42, 0x99, 0x58,
71 0x95, 0x10, 0xf5, 0xe7, 0x93, 0x0b, 0x15, 0x68,
72 0x9a, 0x90, 0x61, 0x80, 0x00, 0xe0, 0x40, 0x00,
73 0x0f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00
75};
76
77static u8 tda8044_inittab_post[] = {
78 0x04, 0x00, 0x6f, 0xb5, 0x86, 0x22, 0x00, 0xea,
79 0x30, 0x42, 0x98, 0x68, 0x70, 0x42, 0x99, 0x50,
80 0x95, 0x10, 0xf5, 0xe7, 0x93, 0x0b, 0x15, 0x68,
81 0x9a, 0x90, 0x61, 0x80, 0x00, 0xe0, 0x40, 0x6c,
82 0x0f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x00
84};
85
86static u8 tda8083_inittab[] = {
87 0x04, 0x00, 0x4a, 0x79, 0x04, 0x00, 0xff, 0xea,
88 0x48, 0x42, 0x79, 0x60, 0x70, 0x52, 0x9a, 0x10,
89 0x0e, 0x10, 0xf2, 0xa7, 0x93, 0x0b, 0x05, 0xc8,
90 0x9d, 0x00, 0x42, 0x80, 0x00, 0x60, 0x40, 0x00,
91 0x00, 0x75, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
92 0x00, 0x00, 0x00, 0x00
93};
94
95static __inline__ u32 tda80xx_div(u32 a, u32 b)
96{
97 return (a + (b / 2)) / b;
98}
99
100static __inline__ u32 tda80xx_gcd(u32 a, u32 b)
101{
102 u32 r;
103
104 while ((r = a % b)) {
105 a = b;
106 b = r;
107 }
108
109 return b;
110}
111
112static int tda80xx_read(struct tda80xx_state* state, u8 reg, u8 *buf, u8 len)
113{
114 int ret;
115 struct i2c_msg msg[] = { { .addr = state->config->demod_address, .flags = 0, .buf = &reg, .len = 1 },
116 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } };
117
118 ret = i2c_transfer(state->i2c, msg, 2);
119
120 if (ret != 2)
121 dprintk("%s: readreg error (reg %02x, ret == %i)\n",
122 __FUNCTION__, reg, ret);
123
124 mdelay(10);
125
126 return (ret == 2) ? 0 : -EREMOTEIO;
127}
128
129static int tda80xx_write(struct tda80xx_state* state, u8 reg, const u8 *buf, u8 len)
130{
131 int ret;
132 u8 wbuf[len + 1];
133 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = wbuf, .len = len + 1 };
134
135 wbuf[0] = reg;
136 memcpy(&wbuf[1], buf, len);
137
138 ret = i2c_transfer(state->i2c, &msg, 1);
139
140 if (ret != 1)
141 dprintk("%s: i2c xfer error (ret == %i)\n", __FUNCTION__, ret);
142
143 mdelay(10);
144
145 return (ret == 1) ? 0 : -EREMOTEIO;
146}
147
148static __inline__ u8 tda80xx_readreg(struct tda80xx_state* state, u8 reg)
149{
150 u8 val;
151
152 tda80xx_read(state, reg, &val, 1);
153
154 return val;
155}
156
157static __inline__ int tda80xx_writereg(struct tda80xx_state* state, u8 reg, u8 data)
158{
159 return tda80xx_write(state, reg, &data, 1);
160}
161
162static int tda80xx_set_parameters(struct tda80xx_state* state,
163 fe_spectral_inversion_t inversion,
164 u32 symbol_rate,
165 fe_code_rate_t fec_inner)
166{
167 u8 buf[15];
168 u64 ratio;
169 u32 clk;
170 u32 k;
171 u32 sr = symbol_rate;
172 u32 gcd;
173 u8 scd;
174
175 if (symbol_rate > (state->clk * 3) / 16)
176 scd = 0;
177 else if (symbol_rate > (state->clk * 3) / 32)
178 scd = 1;
179 else if (symbol_rate > (state->clk * 3) / 64)
180 scd = 2;
181 else
182 scd = 3;
183
184 clk = scd ? (state->clk / (scd * 2)) : state->clk;
185
186 /*
187 * Viterbi decoder:
188 * Differential decoding off
189 * Spectral inversion unknown
190 * QPSK modulation
191 */
192 if (inversion == INVERSION_ON)
193 buf[0] = 0x60;
194 else if (inversion == INVERSION_OFF)
195 buf[0] = 0x20;
196 else
197 buf[0] = 0x00;
198
199 /*
200 * CLK ratio:
201 * system clock frequency is up to 64 or 96 MHz
202 *
203 * formula:
204 * r = k * clk / symbol_rate
205 *
206 * k: 2^21 for caa 0..3,
207 * 2^20 for caa 4..5,
208 * 2^19 for caa 6..7
209 */
210 if (symbol_rate <= (clk * 3) / 32)
211 k = (1 << 19);
212 else if (symbol_rate <= (clk * 3) / 16)
213 k = (1 << 20);
214 else
215 k = (1 << 21);
216
217 gcd = tda80xx_gcd(clk, sr);
218 clk /= gcd;
219 sr /= gcd;
220
221 gcd = tda80xx_gcd(k, sr);
222 k /= gcd;
223 sr /= gcd;
224
225 ratio = (u64)k * (u64)clk;
226 do_div(ratio, sr);
227
228 buf[1] = ratio >> 16;
229 buf[2] = ratio >> 8;
230 buf[3] = ratio;
231
232 /* nyquist filter roll-off factor 35% */
233 buf[4] = 0x20;
234
235 clk = scd ? (state->clk / (scd * 2)) : state->clk;
236
237 /* Anti Alias Filter */
238 if (symbol_rate < (clk * 3) / 64)
239 printk("tda80xx: unsupported symbol rate: %u\n", symbol_rate);
240 else if (symbol_rate <= clk / 16)
241 buf[4] |= 0x07;
242 else if (symbol_rate <= (clk * 3) / 32)
243 buf[4] |= 0x06;
244 else if (symbol_rate <= clk / 8)
245 buf[4] |= 0x05;
246 else if (symbol_rate <= (clk * 3) / 16)
247 buf[4] |= 0x04;
248 else if (symbol_rate <= clk / 4)
249 buf[4] |= 0x03;
250 else if (symbol_rate <= (clk * 3) / 8)
251 buf[4] |= 0x02;
252 else if (symbol_rate <= clk / 2)
253 buf[4] |= 0x01;
254 else
255 buf[4] |= 0x00;
256
257 /* Sigma Delta converter */
258 buf[5] = 0x00;
259
260 /* FEC: Possible puncturing rates */
261 if (fec_inner == FEC_NONE)
262 buf[6] = 0x00;
263 else if ((fec_inner >= FEC_1_2) && (fec_inner <= FEC_8_9))
264 buf[6] = (1 << (8 - fec_inner));
265 else if (fec_inner == FEC_AUTO)
266 buf[6] = 0xff;
267 else
268 return -EINVAL;
269
270 /* carrier lock detector threshold value */
271 buf[7] = 0x30;
272 /* AFC1: proportional part settings */
273 buf[8] = 0x42;
274 /* AFC1: integral part settings */
275 buf[9] = 0x98;
276 /* PD: Leaky integrator SCPC mode */
277 buf[10] = 0x28;
278 /* AFC2, AFC1 controls */
279 buf[11] = 0x30;
280 /* PD: proportional part settings */
281 buf[12] = 0x42;
282 /* PD: integral part settings */
283 buf[13] = 0x99;
284 /* AGC */
285 buf[14] = 0x50 | scd;
286
287 printk("symbol_rate=%u clk=%u\n", symbol_rate, clk);
288
289 return tda80xx_write(state, 0x01, buf, sizeof(buf));
290}
291
292static int tda80xx_set_clk(struct tda80xx_state* state)
293{
294 u8 buf[2];
295
296 /* CLK proportional part */
297 buf[0] = (0x06 << 5) | 0x08; /* CMP[2:0], CSP[4:0] */
298 /* CLK integral part */
299 buf[1] = (0x04 << 5) | 0x1a; /* CMI[2:0], CSI[4:0] */
300
301 return tda80xx_write(state, 0x17, buf, sizeof(buf));
302}
303
304#if 0
305static int tda80xx_set_scpc_freq_offset(struct tda80xx_state* state)
306{
307 /* a constant value is nonsense here imho */
308 return tda80xx_writereg(state, 0x22, 0xf9);
309}
310#endif
311
312static int tda80xx_close_loop(struct tda80xx_state* state)
313{
314 u8 buf[2];
315
316 /* PD: Loop closed, LD: lock detect enable, SCPC: Sweep mode - AFC1 loop closed */
317 buf[0] = 0x68;
318 /* AFC1: Loop closed, CAR Feedback: 8192 */
319 buf[1] = 0x70;
320
321 return tda80xx_write(state, 0x0b, buf, sizeof(buf));
322}
323
324static irqreturn_t tda80xx_irq(int irq, void *priv, struct pt_regs *pt)
325{
326 schedule_work(priv);
327
328 return IRQ_HANDLED;
329}
330
331static void tda80xx_read_status_int(struct tda80xx_state* state)
332{
333 u8 val;
334
335 static const fe_spectral_inversion_t inv_tab[] = {
336 INVERSION_OFF, INVERSION_ON
337 };
338
339 static const fe_code_rate_t fec_tab[] = {
340 FEC_8_9, FEC_1_2, FEC_2_3, FEC_3_4,
341 FEC_4_5, FEC_5_6, FEC_6_7, FEC_7_8,
342 };
343
344 val = tda80xx_readreg(state, 0x02);
345
346 state->status = 0;
347
348 if (val & 0x01) /* demodulator lock */
349 state->status |= FE_HAS_SIGNAL;
350 if (val & 0x02) /* clock recovery lock */
351 state->status |= FE_HAS_CARRIER;
352 if (val & 0x04) /* viterbi lock */
353 state->status |= FE_HAS_VITERBI;
354 if (val & 0x08) /* deinterleaver lock (packet sync) */
355 state->status |= FE_HAS_SYNC;
356 if (val & 0x10) /* derandomizer lock (frame sync) */
357 state->status |= FE_HAS_LOCK;
358 if (val & 0x20) /* frontend can not lock */
359 state->status |= FE_TIMEDOUT;
360
361 if ((state->status & (FE_HAS_CARRIER)) && (state->afc_loop)) {
362 printk("tda80xx: closing loop\n");
363 tda80xx_close_loop(state);
364 state->afc_loop = 0;
365 }
366
367 if (state->status & (FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK)) {
368 val = tda80xx_readreg(state, 0x0e);
369 state->code_rate = fec_tab[val & 0x07];
370 if (state->status & (FE_HAS_SYNC | FE_HAS_LOCK))
371 state->spectral_inversion = inv_tab[(val >> 7) & 0x01];
372 else
373 state->spectral_inversion = INVERSION_AUTO;
374 }
375 else {
376 state->code_rate = FEC_AUTO;
377 }
378}
379
380static void tda80xx_worklet(void *priv)
381{
382 struct tda80xx_state *state = priv;
383
384 tda80xx_writereg(state, 0x00, 0x04);
385 enable_irq(state->config->irq);
386
387 tda80xx_read_status_int(state);
388}
389
390static void tda80xx_wait_diseqc_fifo(struct tda80xx_state* state)
391{
392 size_t i;
393
394 for (i = 0; i < 100; i++) {
395 if (tda80xx_readreg(state, 0x02) & 0x80)
396 break;
397 msleep(10);
398 }
399}
400
401static int tda8044_init(struct dvb_frontend* fe)
402{
403 struct tda80xx_state* state = fe->demodulator_priv;
404 int ret;
405
406 /*
407 * this function is a mess...
408 */
409
410 if ((ret = tda80xx_write(state, 0x00, tda8044_inittab_pre, sizeof(tda8044_inittab_pre))))
411 return ret;
412
413 tda80xx_writereg(state, 0x0f, 0x50);
414#if 1
415 tda80xx_writereg(state, 0x20, 0x8F); /* FIXME */
416 tda80xx_writereg(state, 0x20, state->config->volt18setting); /* FIXME */
417 //tda80xx_writereg(state, 0x00, 0x04);
418 tda80xx_writereg(state, 0x00, 0x0C);
419#endif
420 //tda80xx_writereg(state, 0x00, 0x08); /* Reset AFC1 loop filter */
421
422 tda80xx_write(state, 0x00, tda8044_inittab_post, sizeof(tda8044_inittab_post));
423
424 if (state->config->pll_init) {
425 tda80xx_writereg(state, 0x1c, 0x80);
426 state->config->pll_init(fe);
427 tda80xx_writereg(state, 0x1c, 0x00);
428 }
429
430 return 0;
431}
432
433static int tda8083_init(struct dvb_frontend* fe)
434{
435 struct tda80xx_state* state = fe->demodulator_priv;
436
437 tda80xx_write(state, 0x00, tda8083_inittab, sizeof(tda8083_inittab));
438
439 if (state->config->pll_init) {
440 tda80xx_writereg(state, 0x1c, 0x80);
441 state->config->pll_init(fe);
442 tda80xx_writereg(state, 0x1c, 0x00);
443 }
444
445 return 0;
446}
447
448static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
449{
450 struct tda80xx_state* state = fe->demodulator_priv;
451
452 switch (voltage) {
453 case SEC_VOLTAGE_13:
454 return tda80xx_writereg(state, 0x20, state->config->volt13setting);
455 case SEC_VOLTAGE_18:
456 return tda80xx_writereg(state, 0x20, state->config->volt18setting);
457 case SEC_VOLTAGE_OFF:
458 return tda80xx_writereg(state, 0x20, 0);
459 default:
460 return -EINVAL;
461 }
462}
463
464static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
465{
466 struct tda80xx_state* state = fe->demodulator_priv;
467
468 switch (tone) {
469 case SEC_TONE_OFF:
470 return tda80xx_writereg(state, 0x29, 0x00);
471 case SEC_TONE_ON:
472 return tda80xx_writereg(state, 0x29, 0x80);
473 default:
474 return -EINVAL;
475 }
476}
477
478static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
479{
480 struct tda80xx_state* state = fe->demodulator_priv;
481
482 if (cmd->msg_len > 6)
483 return -EINVAL;
484
485 tda80xx_writereg(state, 0x29, 0x08 | (cmd->msg_len - 3));
486 tda80xx_write(state, 0x23, cmd->msg, cmd->msg_len);
487 tda80xx_writereg(state, 0x29, 0x0c | (cmd->msg_len - 3));
488 tda80xx_wait_diseqc_fifo(state);
489
490 return 0;
491}
492
493static int tda80xx_send_diseqc_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t cmd)
494{
495 struct tda80xx_state* state = fe->demodulator_priv;
496
497 switch (cmd) {
498 case SEC_MINI_A:
499 tda80xx_writereg(state, 0x29, 0x14);
500 break;
501 case SEC_MINI_B:
502 tda80xx_writereg(state, 0x29, 0x1c);
503 break;
504 default:
505 return -EINVAL;
506 }
507
508 tda80xx_wait_diseqc_fifo(state);
509
510 return 0;
511}
512
513static int tda80xx_sleep(struct dvb_frontend* fe)
514{
515 struct tda80xx_state* state = fe->demodulator_priv;
516
517 tda80xx_writereg(state, 0x00, 0x02); /* enter standby */
518
519 return 0;
520}
521
522static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
523{
524 struct tda80xx_state* state = fe->demodulator_priv;
525
526 tda80xx_writereg(state, 0x1c, 0x80);
527 state->config->pll_set(fe, p);
528 tda80xx_writereg(state, 0x1c, 0x00);
529
530 tda80xx_set_parameters(state, p->inversion, p->u.qpsk.symbol_rate, p->u.qpsk.fec_inner);
531 tda80xx_set_clk(state);
532 //tda80xx_set_scpc_freq_offset(state);
533 state->afc_loop = 1;
534
535 return 0;
536}
537
538static int tda80xx_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
539{
540 struct tda80xx_state* state = fe->demodulator_priv;
541
542 if (!state->config->irq)
543 tda80xx_read_status_int(state);
544
545 p->inversion = state->spectral_inversion;
546 p->u.qpsk.fec_inner = state->code_rate;
547
548 return 0;
549}
550
551static int tda80xx_read_status(struct dvb_frontend* fe, fe_status_t* status)
552{
553 struct tda80xx_state* state = fe->demodulator_priv;
554
555 if (!state->config->irq)
556 tda80xx_read_status_int(state);
557 *status = state->status;
558
559 return 0;
560}
561
562static int tda80xx_read_ber(struct dvb_frontend* fe, u32* ber)
563{
564 struct tda80xx_state* state = fe->demodulator_priv;
565 int ret;
566 u8 buf[3];
567
568 if ((ret = tda80xx_read(state, 0x0b, buf, sizeof(buf))))
569 return ret;
570
571 *ber = ((buf[0] & 0x1f) << 16) | (buf[1] << 8) | buf[2];
572
573 return 0;
574}
575
576static int tda80xx_read_signal_strength(struct dvb_frontend* fe, u16* strength)
577{
578 struct tda80xx_state* state = fe->demodulator_priv;
579
580 u8 gain = ~tda80xx_readreg(state, 0x01);
581 *strength = (gain << 8) | gain;
582
583 return 0;
584}
585
586static int tda80xx_read_snr(struct dvb_frontend* fe, u16* snr)
587{
588 struct tda80xx_state* state = fe->demodulator_priv;
589
590 u8 quality = tda80xx_readreg(state, 0x08);
591 *snr = (quality << 8) | quality;
592
593 return 0;
594}
595
596static int tda80xx_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
597{
598 struct tda80xx_state* state = fe->demodulator_priv;
599
600 *ucblocks = tda80xx_readreg(state, 0x0f);
601 if (*ucblocks == 0xff)
602 *ucblocks = 0xffffffff;
603
604 return 0;
605}
606
607static int tda80xx_init(struct dvb_frontend* fe)
608{
609 struct tda80xx_state* state = fe->demodulator_priv;
610
611 switch(state->id) {
612 case ID_TDA8044:
613 return tda8044_init(fe);
614
615 case ID_TDA8083:
616 return tda8083_init(fe);
617 }
618 return 0;
619}
620
621static void tda80xx_release(struct dvb_frontend* fe)
622{
623 struct tda80xx_state* state = fe->demodulator_priv;
624
625 if (state->config->irq)
626 free_irq(state->config->irq, &state->worklet);
627
628 kfree(state);
629}
630
631static struct dvb_frontend_ops tda80xx_ops;
632
633struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config,
634 struct i2c_adapter* i2c)
635{
636 struct tda80xx_state* state = NULL;
637 int ret;
638
639 /* allocate memory for the internal state */
640 state = kmalloc(sizeof(struct tda80xx_state), GFP_KERNEL);
641 if (state == NULL) goto error;
642
643 /* setup the state */
644 state->config = config;
645 state->i2c = i2c;
646 memcpy(&state->ops, &tda80xx_ops, sizeof(struct dvb_frontend_ops));
647 state->spectral_inversion = INVERSION_AUTO;
648 state->code_rate = FEC_AUTO;
649 state->status = 0;
650 state->afc_loop = 0;
651
652 /* check if the demod is there */
653 if (tda80xx_writereg(state, 0x89, 0x00) < 0) goto error;
654 state->id = tda80xx_readreg(state, 0x00);
655
656 switch (state->id) {
657 case ID_TDA8044:
658 state->clk = 96000000;
659 printk("tda80xx: Detected tda8044\n");
660 break;
661
662 case ID_TDA8083:
663 state->clk = 64000000;
664 printk("tda80xx: Detected tda8083\n");
665 break;
666
667 default:
668 goto error;
669 }
670
671 /* setup IRQ */
672 if (state->config->irq) {
673 INIT_WORK(&state->worklet, tda80xx_worklet, state);
674 if ((ret = request_irq(state->config->irq, tda80xx_irq, SA_ONESHOT, "tda80xx", &state->worklet)) < 0) {
675 printk(KERN_ERR "tda80xx: request_irq failed (%d)\n", ret);
676 goto error;
677 }
678 }
679
680 /* create dvb_frontend */
681 state->frontend.ops = &state->ops;
682 state->frontend.demodulator_priv = state;
683 return &state->frontend;
684
685error:
686 kfree(state);
687 return NULL;
688}
689
690static struct dvb_frontend_ops tda80xx_ops = {
691
692 .info = {
693 .name = "Philips TDA80xx DVB-S",
694 .type = FE_QPSK,
695 .frequency_min = 500000,
696 .frequency_max = 2700000,
697 .frequency_stepsize = 125,
698 .symbol_rate_min = 4500000,
699 .symbol_rate_max = 45000000,
700 .caps = FE_CAN_INVERSION_AUTO |
701 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
702 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
703 FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
704 FE_CAN_QPSK |
705 FE_CAN_MUTE_TS
706 },
707
708 .release = tda80xx_release,
709
710 .init = tda80xx_init,
711 .sleep = tda80xx_sleep,
712
713 .set_frontend = tda80xx_set_frontend,
714 .get_frontend = tda80xx_get_frontend,
715
716 .read_status = tda80xx_read_status,
717 .read_ber = tda80xx_read_ber,
718 .read_signal_strength = tda80xx_read_signal_strength,
719 .read_snr = tda80xx_read_snr,
720 .read_ucblocks = tda80xx_read_ucblocks,
721
722 .diseqc_send_master_cmd = tda80xx_send_diseqc_msg,
723 .diseqc_send_burst = tda80xx_send_diseqc_burst,
724 .set_tone = tda80xx_set_tone,
725 .set_voltage = tda80xx_set_voltage,
726};
727
728module_param(debug, int, 0644);
729
730MODULE_DESCRIPTION("Philips TDA8044 / TDA8083 DVB-S Demodulator driver");
731MODULE_AUTHOR("Felix Domke, Andreas Oberritter");
732MODULE_LICENSE("GPL");
733
734EXPORT_SYMBOL(tda80xx_attach);
diff --git a/drivers/media/dvb/frontends/tda80xx.h b/drivers/media/dvb/frontends/tda80xx.h
deleted file mode 100644
index cd639a0aad55..000000000000
--- a/drivers/media/dvb/frontends/tda80xx.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * tda80xx.c
3 *
4 * Philips TDA8044 / TDA8083 QPSK demodulator driver
5 *
6 * Copyright (C) 2001 Felix Domke <tmbinc@elitedvb.net>
7 * Copyright (C) 2002-2004 Andreas Oberritter <obi@linuxtv.org>
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 TDA80XX_H
25#define TDA80XX_H
26
27#include <linux/dvb/frontend.h>
28
29struct tda80xx_config
30{
31 /* the demodulator's i2c address */
32 u8 demod_address;
33
34 /* IRQ to use (0=>no IRQ used) */
35 u32 irq;
36
37 /* Register setting to use for 13v */
38 u8 volt13setting;
39
40 /* Register setting to use for 18v */
41 u8 volt18setting;
42
43 /* PLL maintenance */
44 int (*pll_init)(struct dvb_frontend* fe);
45 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
46};
47
48extern struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config,
49 struct i2c_adapter* i2c);
50
51#endif // TDA80XX_H
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 27494901975f..d36369e9e88f 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2329,6 +2329,17 @@ static int frontend_init(struct av7110 *av7110)
2329 av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); 2329 av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110));
2330 break; 2330 break;
2331 2331
2332 case 0x0004: // Galaxis DVB-S rev1.3
2333 /* ALPS BSRV2 */
2334 av7110->fe = ves1x93_attach(&alps_bsrv2_config, &av7110->i2c_adap);
2335 if (av7110->fe) {
2336 av7110->fe->ops->diseqc_send_master_cmd = av7110_diseqc_send_master_cmd;
2337 av7110->fe->ops->diseqc_send_burst = av7110_diseqc_send_burst;
2338 av7110->fe->ops->set_tone = av7110_set_tone;
2339 av7110->recover = dvb_s_recover;
2340 }
2341 break;
2342
2332 case 0x0006: /* Fujitsu-Siemens DVB-S rev 1.6 */ 2343 case 0x0006: /* Fujitsu-Siemens DVB-S rev 1.6 */
2333 /* Grundig 29504-451 */ 2344 /* Grundig 29504-451 */
2334 av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap); 2345 av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap);
@@ -2930,6 +2941,7 @@ MAKE_AV7110_INFO(tts_1_3se, "Technotrend/Hauppauge WinTV DVB-S rev1.3 SE");
2930MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T"); 2941MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T");
2931MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C"); 2942MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C");
2932MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); 2943MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6");
2944MAKE_AV7110_INFO(gxs_1_3, "Galaxis DVB-S rev1.3");
2933 2945
2934static struct pci_device_id pci_tbl[] = { 2946static struct pci_device_id pci_tbl[] = {
2935 MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000), 2947 MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000),
@@ -2937,13 +2949,13 @@ static struct pci_device_id pci_tbl[] = {
2937 MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), 2949 MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001),
2938 MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), 2950 MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002),
2939 MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), 2951 MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003),
2952 MAKE_EXTENSION_PCI(gxs_1_3, 0x13c2, 0x0004),
2940 MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), 2953 MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006),
2941 MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), 2954 MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008),
2942 MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a), 2955 MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a),
2943 MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e), 2956 MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e),
2944 MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002), 2957 MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002),
2945 2958
2946/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte
2947/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 2959/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1
2948/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0009), UNDEFINED CARD */ // TT/Hauppauge WinTV Nexus-CA v???? 2960/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0009), UNDEFINED CARD */ // TT/Hauppauge WinTV Nexus-CA v????
2949 2961
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h
index 6ea30df2e823..fafd25fab835 100644
--- a/drivers/media/dvb/ttpci/av7110.h
+++ b/drivers/media/dvb/ttpci/av7110.h
@@ -273,8 +273,6 @@ struct av7110 {
273extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, 273extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
274 u16 subpid, u16 pcrpid); 274 u16 subpid, u16 pcrpid);
275 275
276extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config);
277
278extern int av7110_ir_init(struct av7110 *av7110); 276extern int av7110_ir_init(struct av7110 *av7110);
279extern void av7110_ir_exit(struct av7110 *av7110); 277extern void av7110_ir_exit(struct av7110 *av7110);
280 278
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c
index 9138132ad25f..617e4f6c0ed7 100644
--- a/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/drivers/media/dvb/ttpci/av7110_ir.c
@@ -155,6 +155,19 @@ static void input_repeat_key(unsigned long data)
155} 155}
156 156
157 157
158static int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config)
159{
160 int ret = 0;
161
162 dprintk(4, "%p\n", av7110);
163 if (av7110) {
164 ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config);
165 av7110->ir_config = ir_config;
166 }
167 return ret;
168}
169
170
158static int av7110_ir_write_proc(struct file *file, const char __user *buffer, 171static int av7110_ir_write_proc(struct file *file, const char __user *buffer,
159 unsigned long count, void *data) 172 unsigned long count, void *data)
160{ 173{
@@ -187,19 +200,6 @@ static int av7110_ir_write_proc(struct file *file, const char __user *buffer,
187} 200}
188 201
189 202
190int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config)
191{
192 int ret = 0;
193
194 dprintk(4, "%p\n", av7110);
195 if (av7110) {
196 ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config);
197 av7110->ir_config = ir_config;
198 }
199 return ret;
200}
201
202
203static void ir_handler(struct av7110 *av7110, u32 ircom) 203static void ir_handler(struct av7110 *av7110, u32 ircom)
204{ 204{
205 dprintk(4, "ircommand = %08x\n", ircom); 205 dprintk(4, "ircommand = %08x\n", ircom);
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index aa4c4c521880..578b20085082 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -214,7 +214,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
214 we can capture, of the first and second field. */ 214 we can capture, of the first and second field. */
215 .vbistart = { 7,320 }, 215 .vbistart = { 7,320 },
216 },{ 216 },{
217 .v4l2_id = V4L2_STD_NTSC_M, 217 .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR,
218 .name = "NTSC", 218 .name = "NTSC",
219 .Fsc = 28636363, 219 .Fsc = 28636363,
220 .swidth = 768, 220 .swidth = 768,
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 297c32ab51e3..840fe0177121 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -167,29 +167,32 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
167 if (kp->clipcount > 2048) 167 if (kp->clipcount > 2048)
168 return -EINVAL; 168 return -EINVAL;
169 if (kp->clipcount) { 169 if (kp->clipcount) {
170 struct v4l2_clip32 *uclips = compat_ptr(up->clips); 170 struct v4l2_clip32 __user *uclips;
171 struct v4l2_clip *kclips; 171 struct v4l2_clip __user *kclips;
172 int n = kp->clipcount; 172 int n = kp->clipcount;
173 compat_caddr_t p;
173 174
175 if (get_user(p, &up->clips))
176 return -EFAULT;
177 uclips = compat_ptr(p);
174 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip)); 178 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
175 kp->clips = kclips; 179 kp->clips = kclips;
176 while (--n >= 0) { 180 while (--n >= 0) {
177 if (!access_ok(VERIFY_READ, &uclips->c, sizeof(uclips->c)) || 181 if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
178 copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c))) 182 return -EFAULT;
183 if (put_user(n ? kclips + 1 : NULL, &kclips->next))
179 return -EFAULT; 184 return -EFAULT;
180 kclips->next = n ? kclips + 1 : 0;
181 uclips += 1; 185 uclips += 1;
182 kclips += 1; 186 kclips += 1;
183 } 187 }
184 } else 188 } else
185 kp->clips = 0; 189 kp->clips = NULL;
186 return 0; 190 return 0;
187} 191}
188 192
189static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) 193static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
190{ 194{
191 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_window32)) || 195 if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
192 copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
193 put_user(kp->field, &up->field) || 196 put_user(kp->field, &up->field) ||
194 put_user(kp->chromakey, &up->chromakey) || 197 put_user(kp->chromakey, &up->chromakey) ||
195 put_user(kp->clipcount, &up->clipcount)) 198 put_user(kp->clipcount, &up->clipcount))
@@ -199,33 +202,29 @@ static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
199 202
200static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 203static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
201{ 204{
202 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_pix_format)) || 205 if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
203 copy_from_user(kp, up, sizeof(struct v4l2_pix_format))) 206 return -EFAULT;
204 return -EFAULT;
205 return 0; 207 return 0;
206} 208}
207 209
208static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 210static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
209{ 211{
210 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_pix_format)) || 212 if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
211 copy_to_user(up, kp, sizeof(struct v4l2_pix_format))) 213 return -EFAULT;
212 return -EFAULT;
213 return 0; 214 return 0;
214} 215}
215 216
216static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 217static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
217{ 218{
218 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_vbi_format)) || 219 if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
219 copy_from_user(kp, up, sizeof(struct v4l2_vbi_format))) 220 return -EFAULT;
220 return -EFAULT;
221 return 0; 221 return 0;
222} 222}
223 223
224static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 224static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
225{ 225{
226 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_vbi_format)) || 226 if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
227 copy_to_user(up, kp, sizeof(struct v4l2_vbi_format))) 227 return -EFAULT;
228 return -EFAULT;
229 return 0; 228 return 0;
230} 229}
231 230
@@ -279,18 +278,16 @@ static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
279 278
280static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 279static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
281{ 280{
282 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard)) || 281 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
283 copy_from_user(kp, up, sizeof(struct v4l2_standard))) 282 return -EFAULT;
284 return -EFAULT;
285 return 0; 283 return 0;
286 284
287} 285}
288 286
289static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 287static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
290{ 288{
291 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard)) || 289 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
292 copy_to_user(up, kp, sizeof(struct v4l2_standard))) 290 return -EFAULT;
293 return -EFAULT;
294 return 0; 291 return 0;
295} 292}
296 293
@@ -328,18 +325,16 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
328 325
329static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 326static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
330{ 327{
331 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_tuner)) || 328 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
332 copy_from_user(kp, up, sizeof(struct v4l2_tuner))) 329 return -EFAULT;
333 return -EFAULT;
334 return 0; 330 return 0;
335 331
336} 332}
337 333
338static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 334static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
339{ 335{
340 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_tuner)) || 336 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
341 copy_to_user(up, kp, sizeof(struct v4l2_tuner))) 337 return -EFAULT;
342 return -EFAULT;
343 return 0; 338 return 0;
344} 339}
345 340
@@ -380,11 +375,13 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
380 break; 375 break;
381 case V4L2_MEMORY_USERPTR: 376 case V4L2_MEMORY_USERPTR:
382 { 377 {
383 unsigned long tmp = (unsigned long)compat_ptr(up->m.userptr); 378 compat_long_t tmp;
384 379
385 if(get_user(kp->length, &up->length) || 380 if (get_user(kp->length, &up->length) ||
386 get_user(kp->m.userptr, &tmp)) 381 get_user(tmp, &up->m.userptr))
387 return -EFAULT; 382 return -EFAULT;
383
384 kp->m.userptr = (unsigned long)compat_ptr(tmp);
388 } 385 }
389 break; 386 break;
390 case V4L2_MEMORY_OVERLAY: 387 case V4L2_MEMORY_OVERLAY:
@@ -468,33 +465,29 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
468 465
469static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 466static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
470{ 467{
471 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input) - 4) || 468 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
472 copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 469 return -EFAULT;
473 return -EFAULT;
474 return 0; 470 return 0;
475} 471}
476 472
477static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 473static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
478{ 474{
479 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input) - 4) || 475 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
480 copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 476 return -EFAULT;
481 return -EFAULT;
482 return 0; 477 return 0;
483} 478}
484 479
485static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 480static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
486{ 481{
487 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input)) || 482 if (copy_from_user(kp, up, sizeof(struct v4l2_input)))
488 copy_from_user(kp, up, sizeof(struct v4l2_input))) 483 return -EFAULT;
489 return -EFAULT;
490 return 0; 484 return 0;
491} 485}
492 486
493static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 487static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
494{ 488{
495 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input)) || 489 if (copy_to_user(up, kp, sizeof(struct v4l2_input)))
496 copy_to_user(up, kp, sizeof(struct v4l2_input))) 490 return -EFAULT;
497 return -EFAULT;
498 return 0; 491 return 0;
499} 492}
500 493
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index c66c2c1f4809..08ffd1f325fc 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -220,33 +220,23 @@ static void input_change(struct i2c_client *client)
220 cx25840_write(client, 0x808, 0xff); 220 cx25840_write(client, 0x808, 0xff);
221 cx25840_write(client, 0x80b, 0x10); 221 cx25840_write(client, 0x80b, 0x10);
222 } else if (std & V4L2_STD_NTSC) { 222 } else if (std & V4L2_STD_NTSC) {
223 /* NTSC */ 223 /* Certain Hauppauge PVR150 models have a hardware bug
224 if (state->pvr150_workaround) { 224 that causes audio to drop out. For these models the
225 /* Certain Hauppauge PVR150 models have a hardware bug 225 audio standard must be set explicitly.
226 that causes audio to drop out. For these models the 226 To be precise: it affects cards with tuner models
227 audio standard must be set explicitly. 227 85, 99 and 112 (model numbers from tveeprom). */
228 To be precise: it affects cards with tuner models 228 int hw_fix = state->pvr150_workaround;
229 85, 99 and 112 (model numbers from tveeprom). */ 229
230 if (std == V4L2_STD_NTSC_M_JP) { 230 if (std == V4L2_STD_NTSC_M_JP) {
231 /* Japan uses EIAJ audio standard */
232 cx25840_write(client, 0x808, 0x2f);
233 } else {
234 /* Others use the BTSC audio standard */
235 cx25840_write(client, 0x808, 0x1f);
236 }
237 /* South Korea uses the A2-M (aka Zweiton M) audio
238 standard, and should set 0x808 to 0x3f, but I don't
239 know how to detect this. */
240 } else if (std == V4L2_STD_NTSC_M_JP) {
241 /* Japan uses EIAJ audio standard */ 231 /* Japan uses EIAJ audio standard */
242 cx25840_write(client, 0x808, 0xf7); 232 cx25840_write(client, 0x808, hw_fix ? 0x2f : 0xf7);
233 } else if (std == V4L2_STD_NTSC_M_KR) {
234 /* South Korea uses A2 audio standard */
235 cx25840_write(client, 0x808, hw_fix ? 0x3f : 0xf8);
243 } else { 236 } else {
244 /* Others use the BTSC audio standard */ 237 /* Others use the BTSC audio standard */
245 cx25840_write(client, 0x808, 0xf6); 238 cx25840_write(client, 0x808, hw_fix ? 0x1f : 0xf6);
246 } 239 }
247 /* South Korea uses the A2-M (aka Zweiton M) audio standard,
248 and should set 0x808 to 0xf8, but I don't know how to
249 detect this. */
250 cx25840_write(client, 0x80b, 0x00); 240 cx25840_write(client, 0x80b, 0x00);
251 } 241 }
252 242
@@ -330,17 +320,17 @@ static int set_v4lstd(struct i2c_client *client, v4l2_std_id std)
330 u8 fmt=0; /* zero is autodetect */ 320 u8 fmt=0; /* zero is autodetect */
331 321
332 /* First tests should be against specific std */ 322 /* First tests should be against specific std */
333 if (std & V4L2_STD_NTSC_M_JP) { 323 if (std == V4L2_STD_NTSC_M_JP) {
334 fmt=0x2; 324 fmt=0x2;
335 } else if (std & V4L2_STD_NTSC_443) { 325 } else if (std == V4L2_STD_NTSC_443) {
336 fmt=0x3; 326 fmt=0x3;
337 } else if (std & V4L2_STD_PAL_M) { 327 } else if (std == V4L2_STD_PAL_M) {
338 fmt=0x5; 328 fmt=0x5;
339 } else if (std & V4L2_STD_PAL_N) { 329 } else if (std == V4L2_STD_PAL_N) {
340 fmt=0x6; 330 fmt=0x6;
341 } else if (std & V4L2_STD_PAL_Nc) { 331 } else if (std == V4L2_STD_PAL_Nc) {
342 fmt=0x7; 332 fmt=0x7;
343 } else if (std & V4L2_STD_PAL_60) { 333 } else if (std == V4L2_STD_PAL_60) {
344 fmt=0x8; 334 fmt=0x8;
345 } else { 335 } else {
346 /* Then, test against generic ones */ 336 /* Then, test against generic ones */
@@ -369,7 +359,7 @@ v4l2_std_id cx25840_get_v4lstd(struct i2c_client * client)
369 } 359 }
370 360
371 switch (fmt) { 361 switch (fmt) {
372 case 0x1: return V4L2_STD_NTSC_M; 362 case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR;
373 case 0x2: return V4L2_STD_NTSC_M_JP; 363 case 0x2: return V4L2_STD_NTSC_M_JP;
374 case 0x3: return V4L2_STD_NTSC_443; 364 case 0x3: return V4L2_STD_NTSC_443;
375 case 0x4: return V4L2_STD_PAL; 365 case 0x4: return V4L2_STD_PAL;
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 53308911ae6e..e99dfbbf3e95 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -32,6 +32,7 @@ config VIDEO_CX88_DVB
32config VIDEO_CX88_ALSA 32config VIDEO_CX88_ALSA
33 tristate "ALSA DMA audio support" 33 tristate "ALSA DMA audio support"
34 depends on VIDEO_CX88 && SND && EXPERIMENTAL 34 depends on VIDEO_CX88 && SND && EXPERIMENTAL
35 select SND_PCM
35 ---help--- 36 ---help---
36 This is a video4linux driver for direct (DMA) audio on 37 This is a video4linux driver for direct (DMA) audio on
37 Conexant 2388x based TV cards. 38 Conexant 2388x based TV cards.
@@ -48,6 +49,7 @@ config VIDEO_CX88_DVB_ALL_FRONTENDS
48 default y 49 default y
49 depends on VIDEO_CX88_DVB 50 depends on VIDEO_CX88_DVB
50 select DVB_MT352 51 select DVB_MT352
52 select VIDEO_CX88_VP3054
51 select DVB_OR51132 53 select DVB_OR51132
52 select DVB_CX22702 54 select DVB_CX22702
53 select DVB_LGDT330X 55 select DVB_LGDT330X
@@ -69,6 +71,16 @@ config VIDEO_CX88_DVB_MT352
69 This adds DVB-T support for cards based on the 71 This adds DVB-T support for cards based on the
70 Connexant 2388x chip and the MT352 demodulator. 72 Connexant 2388x chip and the MT352 demodulator.
71 73
74config VIDEO_CX88_VP3054
75 tristate "VP-3054 Secondary I2C Bus Support"
76 default m
77 depends on DVB_MT352
78 ---help---
79 This adds DVB-T support for cards based on the
80 Connexant 2388x chip and the MT352 demodulator,
81 which also require support for the VP-3054
82 Secondary I2C bus, such at DNTV Live! DVB-T Pro.
83
72config VIDEO_CX88_DVB_OR51132 84config VIDEO_CX88_DVB_OR51132
73 bool "OR51132 ATSC Support" 85 bool "OR51132 ATSC Support"
74 default y 86 default y
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 6e5eaa22619e..2b902784facc 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -4,8 +4,9 @@ cx8800-objs := cx88-video.o cx88-vbi.o
4cx8802-objs := cx88-mpeg.o 4cx8802-objs := cx88-mpeg.o
5 5
6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o 6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o
7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o 7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o 8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
9obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
9 10
10EXTRA_CFLAGS += -I$(src)/.. 11EXTRA_CFLAGS += -I$(src)/..
11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 12EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
@@ -18,6 +19,6 @@ extra-cflags-$(CONFIG_DVB_LGDT330X) += -DHAVE_LGDT330X=1
18extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 19extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1
19extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 20extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1
20extra-cflags-$(CONFIG_DVB_CX24123) += -DHAVE_CX24123=1 21extra-cflags-$(CONFIG_DVB_CX24123) += -DHAVE_CX24123=1
21extra-cflags-$(CONFIG_VIDEO_CX88_DVB)+= -DHAVE_VP3054_I2C=1 22extra-cflags-$(CONFIG_VIDEO_CX88_VP3054)+= -DHAVE_VP3054_I2C=1
22 23
23EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) 24EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m)
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index a2e36a1e5f59..2acccd6d49bc 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -128,7 +128,7 @@ MODULE_PARM_DESC(debug,"enable debug messages");
128 * BOARD Specific: Sets audio DMA 128 * BOARD Specific: Sets audio DMA
129 */ 129 */
130 130
131int _cx88_start_audio_dma(snd_cx88_card_t *chip) 131static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
132{ 132{
133 struct cx88_buffer *buf = chip->buf; 133 struct cx88_buffer *buf = chip->buf;
134 struct cx88_core *core=chip->core; 134 struct cx88_core *core=chip->core;
@@ -173,7 +173,7 @@ int _cx88_start_audio_dma(snd_cx88_card_t *chip)
173/* 173/*
174 * BOARD Specific: Resets audio DMA 174 * BOARD Specific: Resets audio DMA
175 */ 175 */
176int _cx88_stop_audio_dma(snd_cx88_card_t *chip) 176static int _cx88_stop_audio_dma(snd_cx88_card_t *chip)
177{ 177{
178 struct cx88_core *core=chip->core; 178 struct cx88_core *core=chip->core;
179 dprintk(1, "Stopping audio DMA\n"); 179 dprintk(1, "Stopping audio DMA\n");
@@ -613,7 +613,7 @@ static snd_kcontrol_new_t snd_cx88_capture_volume = {
613 * Only boards with eeprom and byte 1 at eeprom=1 have it 613 * Only boards with eeprom and byte 1 at eeprom=1 have it
614 */ 614 */
615 615
616struct pci_device_id cx88_audio_pci_tbl[] = { 616static struct pci_device_id cx88_audio_pci_tbl[] = {
617 {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 617 {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
618 {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 618 {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
619 {0, } 619 {0, }
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index ad2f565f522c..1bc999247fdc 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1246,6 +1246,11 @@ struct cx88_subid cx88_subids[] = {
1246 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL, 1246 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
1247 },{ 1247 },{
1248 .subvendor = 0x18ac, 1248 .subvendor = 0x18ac,
1249 .subdevice = 0xdb54,
1250 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
1251 /* Re-branded DViCO: DigitalNow DVB-T Dual */
1252 },{
1253 .subvendor = 0x18ac,
1249 .subdevice = 0xdb11, 1254 .subdevice = 0xdb11,
1250 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, 1255 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
1251 /* Re-branded DViCO: UltraView DVB-T Plus */ 1256 /* Re-branded DViCO: UltraView DVB-T Plus */
@@ -1293,6 +1298,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
1293 switch (tv.model) 1298 switch (tv.model)
1294 { 1299 {
1295 case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ 1300 case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
1301 case 34519: /* WinTV-PCI-FM */
1296 case 90002: /* Nova-T-PCI (9002) */ 1302 case 90002: /* Nova-T-PCI (9002) */
1297 case 92001: /* Nova-S-Plus (Video and IR) */ 1303 case 92001: /* Nova-S-Plus (Video and IR) */
1298 case 92002: /* Nova-S-Plus (Video and IR) */ 1304 case 92002: /* Nova-S-Plus (Video and IR) */
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 8d6d6a6cf785..3720f24a25cf 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -787,12 +787,14 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
787 787
788int cx88_start_audio_dma(struct cx88_core *core) 788int cx88_start_audio_dma(struct cx88_core *core)
789{ 789{
790 /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */
791 int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4;
790 /* setup fifo + format */ 792 /* setup fifo + format */
791 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], 128, 0); 793 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0);
792 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], 128, 0); 794 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], bpl, 0);
793 795
794 cx_write(MO_AUDD_LNGTH, 128); /* fifo bpl size */ 796 cx_write(MO_AUDD_LNGTH, bpl); /* fifo bpl size */
795 cx_write(MO_AUDR_LNGTH, 128); /* fifo bpl size */ 797 cx_write(MO_AUDR_LNGTH, bpl); /* fifo bpl size */
796 798
797 /* start dma */ 799 /* start dma */
798 cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */ 800 cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index da2ad5c4b553..165d948624a3 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -482,6 +482,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
482 switch (core->board) { 482 switch (core->board) {
483 case CX88_BOARD_DNTV_LIVE_DVB_T: 483 case CX88_BOARD_DNTV_LIVE_DVB_T:
484 case CX88_BOARD_KWORLD_DVB_T: 484 case CX88_BOARD_KWORLD_DVB_T:
485 case CX88_BOARD_KWORLD_DVB_T_CX22702:
485 ir_codes = ir_codes_dntv_live_dvb_t; 486 ir_codes = ir_codes_dntv_live_dvb_t;
486 ir->gpio_addr = MO_GP1_IO; 487 ir->gpio_addr = MO_GP1_IO;
487 ir->mask_keycode = 0x1f; 488 ir->mask_keycode = 0x1f;
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index dff3893f32fd..e5ee8bceb210 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -139,6 +139,9 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
139{ 139{
140 int ret, byte; 140 int ret, byte;
141 141
142 if (dev->state & DEV_DISCONNECTED)
143 return(-ENODEV);
144
142 em28xx_regdbg("req=%02x, reg=%02x ", req, reg); 145 em28xx_regdbg("req=%02x, reg=%02x ", req, reg);
143 146
144 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, 147 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
@@ -165,6 +168,9 @@ int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg)
165 u8 val; 168 u8 val;
166 int ret; 169 int ret;
167 170
171 if (dev->state & DEV_DISCONNECTED)
172 return(-ENODEV);
173
168 em28xx_regdbg("req=%02x, reg=%02x:", req, reg); 174 em28xx_regdbg("req=%02x, reg=%02x:", req, reg);
169 175
170 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, 176 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
@@ -195,7 +201,12 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
195 int ret; 201 int ret;
196 202
197 /*usb_control_msg seems to expect a kmalloced buffer */ 203 /*usb_control_msg seems to expect a kmalloced buffer */
198 unsigned char *bufs = kmalloc(len, GFP_KERNEL); 204 unsigned char *bufs;
205
206 if (dev->state & DEV_DISCONNECTED)
207 return(-ENODEV);
208
209 bufs = kmalloc(len, GFP_KERNEL);
199 210
200 em28xx_regdbg("req=%02x reg=%02x:", req, reg); 211 em28xx_regdbg("req=%02x reg=%02x:", req, reg);
201 212
@@ -212,7 +223,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
212 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, 223 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req,
213 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 224 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
214 0x0000, reg, bufs, len, HZ); 225 0x0000, reg, bufs, len, HZ);
215 mdelay(5); /* FIXME: magic number */ 226 msleep(5); /* FIXME: magic number */
216 kfree(bufs); 227 kfree(bufs);
217 return ret; 228 return ret;
218} 229}
@@ -253,7 +264,7 @@ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val)
253 if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) 264 if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
254 return ret; 265 return ret;
255 else if (((u8) ret) & 0x01) { 266 else if (((u8) ret) & 0x01) {
256 em28xx_warn ("AC97 command still being exectuted: not handled properly!\n"); 267 em28xx_warn ("AC97 command still being executed: not handled properly!\n");
257 } 268 }
258 return 0; 269 return 0;
259} 270}
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 0591a705b7a1..6ca8631bc36d 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -78,7 +78,7 @@ static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr,
78 ret = dev->em28xx_read_reg(dev, 0x05); 78 ret = dev->em28xx_read_reg(dev, 0x05);
79 if (ret == 0x80 + len - 1) 79 if (ret == 0x80 + len - 1)
80 return len; 80 return len;
81 mdelay(5); 81 msleep(5);
82 } 82 }
83 em28xx_warn("i2c write timed out\n"); 83 em28xx_warn("i2c write timed out\n");
84 return -EIO; 84 return -EIO;
@@ -138,7 +138,7 @@ static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr)
138 return -ENODEV; 138 return -ENODEV;
139 else if (msg == 0x84) 139 else if (msg == 0x84)
140 return 0; 140 return 0;
141 mdelay(5); 141 msleep(5);
142 } 142 }
143 return -ENODEV; 143 return -ENODEV;
144} 144}
@@ -278,9 +278,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
278 msgs[i].buf, 278 msgs[i].buf,
279 msgs[i].len, 279 msgs[i].len,
280 i == num - 1); 280 i == num - 1);
281 if (rc < 0)
282 goto err;
283 } 281 }
282 if (rc < 0)
283 goto err;
284 if (i2c_debug>=2) 284 if (i2c_debug>=2)
285 printk("\n"); 285 printk("\n");
286 } 286 }
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index eea304f75176..94a14a2bb6d6 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -6,6 +6,9 @@
6 Mauro Carvalho Chehab <mchehab@brturbo.com.br> 6 Mauro Carvalho Chehab <mchehab@brturbo.com.br>
7 Sascha Sommer <saschasommer@freenet.de> 7 Sascha Sommer <saschasommer@freenet.de>
8 8
9 Some parts based on SN9C10x PC Camera Controllers GPL driver made
10 by Luca Risolia <luca.risolia@studio.unibo.it>
11
9 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 13 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 14 the Free Software Foundation; either version 2 of the License, or
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index c64718aec9cb..5a35d3b6550d 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -136,7 +136,7 @@ struct saa7134_board saa7134_boards[] = {
136 }, 136 },
137 [SAA7134_BOARD_FLYVIDEO2000] = { 137 [SAA7134_BOARD_FLYVIDEO2000] = {
138 /* "TC Wan" <tcwan@cs.usm.my> */ 138 /* "TC Wan" <tcwan@cs.usm.my> */
139 .name = "LifeView FlyVIDEO2000", 139 .name = "LifeView/Typhoon FlyVIDEO2000",
140 .audio_clock = 0x00200000, 140 .audio_clock = 0x00200000,
141 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 141 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
142 .radio_type = UNSET, 142 .radio_type = UNSET,
@@ -1884,44 +1884,38 @@ struct saa7134_board saa7134_boards[] = {
1884 .gpio = 0x000, 1884 .gpio = 0x000,
1885 }, 1885 },
1886 }, 1886 },
1887 [SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS] = { 1887 [SAA7134_BOARD_FLYDVBT_DUO_CARDBUS] = {
1888 .name = "Typhoon DVB-T Duo Digital/Analog Cardbus", 1888 .name = "LifeView/Typhoon FlyDVB-T Duo Cardbus",
1889 .audio_clock = 0x00200000, 1889 .audio_clock = 0x00200000,
1890 .tuner_type = TUNER_PHILIPS_TDA8290, 1890 .tuner_type = TUNER_PHILIPS_TDA8290,
1891 .radio_type = UNSET, 1891 .radio_type = UNSET,
1892 .tuner_addr = ADDR_UNSET, 1892 .tuner_addr = ADDR_UNSET,
1893 .radio_addr = ADDR_UNSET, 1893 .radio_addr = ADDR_UNSET,
1894 .mpeg = SAA7134_MPEG_DVB, 1894 .mpeg = SAA7134_MPEG_DVB,
1895 /* .gpiomask = 0xe000, */ 1895 .gpiomask = 0x00200000,
1896 .inputs = {{ 1896 .inputs = {{
1897 .name = name_tv, 1897 .name = name_tv,
1898 .vmux = 1, 1898 .vmux = 1,
1899 .amux = TV, 1899 .amux = TV,
1900 /* .gpio = 0x0000, */ 1900 .gpio = 0x200000, /* GPIO21=High for TV input */
1901 .tv = 1, 1901 .tv = 1,
1902 },{ 1902 },{
1903 .name = name_svideo, /* S-Video signal on S-Video input */
1904 .vmux = 8,
1905 .amux = LINE2,
1906 },{
1903 .name = name_comp1, /* Composite signal on S-Video input */ 1907 .name = name_comp1, /* Composite signal on S-Video input */
1904 .vmux = 0, 1908 .vmux = 0,
1905 .amux = LINE2, 1909 .amux = LINE2,
1906 /* .gpio = 0x4000, */
1907 },{ 1910 },{
1908 .name = name_comp2, /* Composite input */ 1911 .name = name_comp2, /* Composite input */
1909 .vmux = 3, 1912 .vmux = 3,
1910 .amux = LINE2, 1913 .amux = LINE2,
1911 /* .gpio = 0x4000, */
1912 },{
1913 .name = name_svideo, /* S-Video signal on S-Video input */
1914 .vmux = 8,
1915 .amux = LINE2,
1916 /* .gpio = 0x4000, */
1917 }}, 1914 }},
1918 .radio = { 1915 .radio = {
1919 .name = name_radio, 1916 .name = name_radio,
1920 .amux = LINE2, 1917 .amux = TV,
1921 }, 1918 .gpio = 0x000000, /* GPIO21=Low for FM radio antenna */
1922 .mute = {
1923 .name = name_mute,
1924 .amux = LINE1,
1925 }, 1919 },
1926 }, 1920 },
1927 [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = { 1921 [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = {
@@ -2701,6 +2695,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
2701 .driver_data = SAA7134_BOARD_FLYVIDEO2000, 2695 .driver_data = SAA7134_BOARD_FLYVIDEO2000,
2702 },{ 2696 },{
2703 .vendor = PCI_VENDOR_ID_PHILIPS, 2697 .vendor = PCI_VENDOR_ID_PHILIPS,
2698 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
2699 .subvendor = 0x4e42, /* Typhoon */
2700 .subdevice = 0x0138, /* LifeView FlyTV Prime30 OEM */
2701 .driver_data = SAA7134_BOARD_FLYVIDEO2000,
2702 },{
2703 .vendor = PCI_VENDOR_ID_PHILIPS,
2704 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2704 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2705 .subvendor = 0x5168, 2705 .subvendor = 0x5168,
2706 .subdevice = 0x0212, /* minipci, LR212 */ 2706 .subdevice = 0x0212, /* minipci, LR212 */
@@ -2935,7 +2935,7 @@ struct pci_device_id saa7134_pci_tbl[] = {
2935 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2935 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2936 .subvendor = 0x5168, 2936 .subvendor = 0x5168,
2937 .subdevice = 0x0502, /* Cardbus version */ 2937 .subdevice = 0x0502, /* Cardbus version */
2938 .driver_data = SAA7134_BOARD_FLYDVBTDUO, 2938 .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS,
2939 },{ 2939 },{
2940 .vendor = PCI_VENDOR_ID_PHILIPS, 2940 .vendor = PCI_VENDOR_ID_PHILIPS,
2941 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2941 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
@@ -2980,12 +2980,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
2980 .subdevice = 0x1370, /* cardbus version */ 2980 .subdevice = 0x1370, /* cardbus version */
2981 .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, 2981 .driver_data = SAA7134_BOARD_ADS_INSTANT_TV,
2982 2982
2983 },{ /* Typhoon DVB-T Duo Digital/Analog Cardbus */ 2983 },{
2984 .vendor = PCI_VENDOR_ID_PHILIPS, 2984 .vendor = PCI_VENDOR_ID_PHILIPS,
2985 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2985 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2986 .subvendor = 0x4e42, 2986 .subvendor = 0x4e42, /* Typhoon */
2987 .subdevice = 0x0502, 2987 .subdevice = 0x0502, /* LifeView LR502 OEM */
2988 .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS, 2988 .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS,
2989 },{ 2989 },{
2990 .vendor = PCI_VENDOR_ID_PHILIPS, 2990 .vendor = PCI_VENDOR_ID_PHILIPS,
2991 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2991 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
@@ -3206,8 +3206,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
3206 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); 3206 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000);
3207 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000004); 3207 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000004);
3208 break; 3208 break;
3209 case SAA7134_BOARD_FLYDVBTDUO: 3209 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
3210 case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS:
3211 /* turn the fan on */ 3210 /* turn the fan on */
3212 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); 3211 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
3213 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); 3212 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06);
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 399f9952596c..1a536e865277 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -861,7 +861,7 @@ static int dvb_init(struct saa7134_dev *dev)
861 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 861 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
862 &dev->i2c_adap); 862 &dev->i2c_adap);
863 break; 863 break;
864 case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: 864 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
865 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 865 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
866 &dev->i2c_adap); 866 &dev->i2c_adap);
867 break; 867 break;
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index e70eae8d29bb..3261d8bebdd1 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -185,7 +185,7 @@ struct saa7134_format {
185#define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 185#define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57
186#define SAA7134_BOARD_ADS_INSTANT_TV 58 186#define SAA7134_BOARD_ADS_INSTANT_TV 58
187#define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 187#define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59
188#define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60 188#define SAA7134_BOARD_FLYDVBT_DUO_CARDBUS 60
189#define SAA7134_BOARD_PHILIPS_TOUGH 61 189#define SAA7134_BOARD_PHILIPS_TOUGH 61
190#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 190#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62
191#define SAA7134_BOARD_KWORLD_XPERT 63 191#define SAA7134_BOARD_KWORLD_XPERT 63
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index 54fc33011ffb..9d769264a329 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -2012,7 +2012,6 @@ static int __devinit init_saa7146(struct pci_dev *pdev)
2012{ 2012{
2013 struct saa7146 *saa = pci_get_drvdata(pdev); 2013 struct saa7146 *saa = pci_get_drvdata(pdev);
2014 2014
2015 memset(saa, 0, sizeof(*saa));
2016 saa->user = 0; 2015 saa->user = 0;
2017 /* reset the saa7146 */ 2016 /* reset the saa7146 */
2018 saawrite(0xffff0000, SAA7146_MC1); 2017 saawrite(0xffff0000, SAA7146_MC1);
@@ -2062,16 +2061,16 @@ static int __devinit init_saa7146(struct pci_dev *pdev)
2062 } 2061 }
2063 if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) { 2062 if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) {
2064 dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); 2063 dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
2065 goto errvid; 2064 goto errfree;
2066 } 2065 }
2067 if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) { 2066 if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) {
2068 dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); 2067 dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
2069 goto erraud; 2068 goto errfree;
2070 } 2069 }
2071 /* allocate 81920 byte buffer for clipping */ 2070 /* allocate 81920 byte buffer for clipping */
2072 if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) { 2071 if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) {
2073 dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr); 2072 dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr);
2074 goto errosd; 2073 goto errfree;
2075 } 2074 }
2076 /* setup clipping registers */ 2075 /* setup clipping registers */
2077 saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2); 2076 saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2);
@@ -2085,15 +2084,11 @@ static int __devinit init_saa7146(struct pci_dev *pdev)
2085 I2CBusScan(saa); 2084 I2CBusScan(saa);
2086 2085
2087 return 0; 2086 return 0;
2088errosd: 2087errfree:
2089 vfree(saa->osdbuf); 2088 vfree(saa->osdbuf);
2090 saa->osdbuf = NULL;
2091erraud:
2092 vfree(saa->audbuf); 2089 vfree(saa->audbuf);
2093 saa->audbuf = NULL;
2094errvid:
2095 vfree(saa->vidbuf); 2090 vfree(saa->vidbuf);
2096 saa->vidbuf = NULL; 2091 saa->audbuf = saa->osdbuf = saa->vidbuf = NULL;
2097err: 2092err:
2098 return -ENOMEM; 2093 return -ENOMEM;
2099} 2094}
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 5815649bdc78..0d54f6c1982b 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -231,7 +231,7 @@ static struct tvnorm tvnorms[] = {
231 cAudioIF_6_5 | 231 cAudioIF_6_5 |
232 cVideoIF_38_90 ), 232 cVideoIF_38_90 ),
233 },{ 233 },{
234 .std = V4L2_STD_NTSC_M, 234 .std = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR,
235 .name = "NTSC-M", 235 .name = "NTSC-M",
236 .b = ( cNegativeFmTV | 236 .b = ( cNegativeFmTV |
237 cQSS ), 237 cQSS ),
@@ -619,6 +619,11 @@ static int tda9887_fixup_std(struct tda9887 *t)
619 tda9887_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); 619 tda9887_dbg("insmod fixup: NTSC => NTSC_M_JP\n");
620 t->std = V4L2_STD_NTSC_M_JP; 620 t->std = V4L2_STD_NTSC_M_JP;
621 break; 621 break;
622 case 'k':
623 case 'K':
624 tda9887_dbg("insmod fixup: NTSC => NTSC_M_KR\n");
625 t->std = V4L2_STD_NTSC_M_KR;
626 break;
622 case '-': 627 case '-':
623 /* default parameter, do nothing */ 628 /* default parameter, do nothing */
624 break; 629 break;
@@ -876,7 +881,7 @@ static int tda9887_resume(struct device * dev)
876/* ----------------------------------------------------------------------- */ 881/* ----------------------------------------------------------------------- */
877 882
878static struct i2c_driver driver = { 883static struct i2c_driver driver = {
879 .id = -1, /* FIXME */ 884 .id = I2C_DRIVERID_TDA9887,
880 .attach_adapter = tda9887_probe, 885 .attach_adapter = tda9887_probe,
881 .detach_client = tda9887_detach, 886 .detach_client = tda9887_detach,
882 .command = tda9887_command, 887 .command = tda9887_command,
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 2995b22acb43..e7ee619d62c5 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -216,6 +216,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
216 buffer[3] = 0xa4; 216 buffer[3] = 0xa4;
217 i2c_master_send(c,buffer,4); 217 i2c_master_send(c,buffer,4);
218 default_tuner_init(c); 218 default_tuner_init(c);
219 break;
219 default: 220 default:
220 default_tuner_init(c); 221 default_tuner_init(c);
221 break; 222 break;
@@ -365,6 +366,11 @@ static int tuner_fixup_std(struct tuner *t)
365 tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); 366 tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n");
366 t->std = V4L2_STD_NTSC_M_JP; 367 t->std = V4L2_STD_NTSC_M_JP;
367 break; 368 break;
369 case 'k':
370 case 'K':
371 tuner_dbg("insmod fixup: NTSC => NTSC_M_KR\n");
372 t->std = V4L2_STD_NTSC_M_KR;
373 break;
368 case '-': 374 case '-':
369 /* default parameter, do nothing */ 375 /* default parameter, do nothing */
370 break; 376 break;
@@ -448,7 +454,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
448 printk("%02x ",buffer[i]); 454 printk("%02x ",buffer[i]);
449 printk("\n"); 455 printk("\n");
450 } 456 }
451 /* TEA5767 autodetection code - only for addr = 0xc0 */ 457 /* autodetection code based on the i2c addr */
452 if (!no_autodetect) { 458 if (!no_autodetect) {
453 switch (addr) { 459 switch (addr) {
454 case 0x42: 460 case 0x42:
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 6d03b9b05c6e..c8e5ad0e8185 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -390,6 +390,14 @@ static void tda9840_setmode(struct CHIPSTATE *chip, int mode)
390 chip_write(chip, TDA9840_SW, t); 390 chip_write(chip, TDA9840_SW, t);
391} 391}
392 392
393static int tda9840_checkit(struct CHIPSTATE *chip)
394{
395 int rc;
396 rc = chip_read(chip);
397 /* lower 5 bits should be 0 */
398 return ((rc & 0x1f) == 0) ? 1 : 0;
399}
400
393/* ---------------------------------------------------------------------- */ 401/* ---------------------------------------------------------------------- */
394/* audio chip descriptions - defines+functions for tda985x */ 402/* audio chip descriptions - defines+functions for tda985x */
395 403
@@ -1264,6 +1272,7 @@ static struct CHIPDESC chiplist[] = {
1264 .addr_hi = I2C_TDA9840 >> 1, 1272 .addr_hi = I2C_TDA9840 >> 1,
1265 .registers = 5, 1273 .registers = 5,
1266 1274
1275 .checkit = tda9840_checkit,
1267 .getmode = tda9840_getmode, 1276 .getmode = tda9840_getmode,
1268 .setmode = tda9840_setmode, 1277 .setmode = tda9840_setmode,
1269 .checkmode = generic_checkmode, 1278 .checkmode = generic_checkmode,
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index fad9ea0ae4f2..1864423b3046 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -746,24 +746,27 @@ static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std)
746 746
747static inline void tvp5150_reset(struct i2c_client *c) 747static inline void tvp5150_reset(struct i2c_client *c)
748{ 748{
749 u8 type, ver_656, msb_id, lsb_id, msb_rom, lsb_rom; 749 u8 msb_id, lsb_id, msb_rom, lsb_rom;
750 struct tvp5150 *decoder = i2c_get_clientdata(c); 750 struct tvp5150 *decoder = i2c_get_clientdata(c);
751 751
752 type=tvp5150_read(c,TVP5150_AUTOSW_MSK);
753 msb_id=tvp5150_read(c,TVP5150_MSB_DEV_ID); 752 msb_id=tvp5150_read(c,TVP5150_MSB_DEV_ID);
754 lsb_id=tvp5150_read(c,TVP5150_LSB_DEV_ID); 753 lsb_id=tvp5150_read(c,TVP5150_LSB_DEV_ID);
755 msb_rom=tvp5150_read(c,TVP5150_ROM_MAJOR_VER); 754 msb_rom=tvp5150_read(c,TVP5150_ROM_MAJOR_VER);
756 lsb_rom=tvp5150_read(c,TVP5150_ROM_MINOR_VER); 755 lsb_rom=tvp5150_read(c,TVP5150_ROM_MINOR_VER);
757 756
758 if (type==0xdc) { 757 if ((msb_rom==4)&&(lsb_rom==0)) { /* Is TVP5150AM1 */
759 ver_656=tvp5150_read(c,TVP5150_REV_SELECT); 758 tvp5150_info("tvp%02x%02xam1 detected.\n",msb_id, lsb_id);
760 tvp5150_info("tvp%02x%02xam1 detected 656 version is %d.\n",msb_id, lsb_id,ver_656); 759
761 } else if (type==0xfc) { 760 /* ITU-T BT.656.4 timing */
762 tvp5150_info("tvp%02x%02xa detected.\n",msb_id, lsb_id); 761 tvp5150_write(c,TVP5150_REV_SELECT,0);
763 } else { 762 } else {
764 tvp5150_info("unknown tvp%02x%02x chip detected(%d).\n",msb_id,lsb_id,type); 763 if ((msb_rom==3)||(lsb_rom==0x21)) { /* Is TVP5150A */
764 tvp5150_info("tvp%02x%02xa detected.\n",msb_id, lsb_id);
765 } else {
766 tvp5150_info("*** unknown tvp%02x%02x chip detected.\n",msb_id,lsb_id);
767 tvp5150_info("*** Rom ver is %d.%d\n",msb_rom,lsb_rom);
768 }
765 } 769 }
766 tvp5150_info("Rom ver is %d.%d\n",msb_rom,lsb_rom);
767 770
768 /* Initializes TVP5150 to its default values */ 771 /* Initializes TVP5150 to its default values */
769 tvp5150_write_inittab(c, tvp5150_init_default); 772 tvp5150_write_inittab(c, tvp5150_init_default);
@@ -893,6 +896,17 @@ static int tvp5150_command(struct i2c_client *c,
893 } 896 }
894 case DECODER_GET_STATUS: 897 case DECODER_GET_STATUS:
895 { 898 {
899 int *iarg = arg;
900 int status;
901 int res=0;
902 status = tvp5150_read(c, 0x88);
903 if(status&0x08){
904 res |= DECODER_STATUS_COLOR;
905 }
906 if(status&0x04 && status&0x02){
907 res |= DECODER_STATUS_GOOD;
908 }
909 *iarg=res;
896 break; 910 break;
897 } 911 }
898 912
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index c483a863b116..5d397b7a5497 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -65,7 +65,7 @@ config MMC_AU1X
65 depends on SOC_AU1X00 && MMC 65 depends on SOC_AU1X00 && MMC
66 help 66 help
67 This selects the AMD Alchemy(R) Multimedia card interface. 67 This selects the AMD Alchemy(R) Multimedia card interface.
68 iIf you have a Alchemy platform with a MMC slot, say Y or M here. 68 If you have a Alchemy platform with a MMC slot, say Y or M here.
69 69
70 If unsure, say N. 70 If unsure, say N.
71 71
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index effa0d7a73ac..205bb7083335 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -301,7 +301,7 @@ config MTD_JEDEC
301 301
302config MTD_XIP 302config MTD_XIP
303 bool "XIP aware MTD support" 303 bool "XIP aware MTD support"
304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM 304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARCH_MTD_XIP
305 default y if XIP_KERNEL 305 default y if XIP_KERNEL
306 help 306 help
307 This allows MTD support to work with flash memory which is also 307 This allows MTD support to work with flash memory which is also
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index adfba44dac5a..2beac55b57d6 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -586,6 +586,7 @@ struct rtl8139_private {
586 dma_addr_t tx_bufs_dma; 586 dma_addr_t tx_bufs_dma;
587 signed char phys[4]; /* MII device addresses. */ 587 signed char phys[4]; /* MII device addresses. */
588 char twistie, twist_row, twist_col; /* Twister tune state. */ 588 char twistie, twist_row, twist_col; /* Twister tune state. */
589 unsigned int watchdog_fired : 1;
589 unsigned int default_port : 4; /* Last dev->if_port value. */ 590 unsigned int default_port : 4; /* Last dev->if_port value. */
590 unsigned int have_thread : 1; 591 unsigned int have_thread : 1;
591 spinlock_t lock; 592 spinlock_t lock;
@@ -638,6 +639,7 @@ static void rtl8139_set_rx_mode (struct net_device *dev);
638static void __set_rx_mode (struct net_device *dev); 639static void __set_rx_mode (struct net_device *dev);
639static void rtl8139_hw_start (struct net_device *dev); 640static void rtl8139_hw_start (struct net_device *dev);
640static void rtl8139_thread (void *_data); 641static void rtl8139_thread (void *_data);
642static void rtl8139_tx_timeout_task(void *_data);
641static struct ethtool_ops rtl8139_ethtool_ops; 643static struct ethtool_ops rtl8139_ethtool_ops;
642 644
643/* write MMIO register, with flush */ 645/* write MMIO register, with flush */
@@ -1598,13 +1600,14 @@ static void rtl8139_thread (void *_data)
1598{ 1600{
1599 struct net_device *dev = _data; 1601 struct net_device *dev = _data;
1600 struct rtl8139_private *tp = netdev_priv(dev); 1602 struct rtl8139_private *tp = netdev_priv(dev);
1601 unsigned long thr_delay; 1603 unsigned long thr_delay = next_tick;
1602 1604
1603 if (rtnl_shlock_nowait() == 0) { 1605 if (tp->watchdog_fired) {
1606 tp->watchdog_fired = 0;
1607 rtl8139_tx_timeout_task(_data);
1608 } else if (rtnl_shlock_nowait() == 0) {
1604 rtl8139_thread_iter (dev, tp, tp->mmio_addr); 1609 rtl8139_thread_iter (dev, tp, tp->mmio_addr);
1605 rtnl_unlock (); 1610 rtnl_unlock ();
1606
1607 thr_delay = next_tick;
1608 } else { 1611 } else {
1609 /* unlikely race. mitigate with fast poll. */ 1612 /* unlikely race. mitigate with fast poll. */
1610 thr_delay = HZ / 2; 1613 thr_delay = HZ / 2;
@@ -1631,7 +1634,8 @@ static void rtl8139_stop_thread(struct rtl8139_private *tp)
1631 if (tp->have_thread) { 1634 if (tp->have_thread) {
1632 cancel_rearming_delayed_work(&tp->thread); 1635 cancel_rearming_delayed_work(&tp->thread);
1633 tp->have_thread = 0; 1636 tp->have_thread = 0;
1634 } 1637 } else
1638 flush_scheduled_work();
1635} 1639}
1636 1640
1637static inline void rtl8139_tx_clear (struct rtl8139_private *tp) 1641static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
@@ -1642,14 +1646,13 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
1642 /* XXX account for unsent Tx packets in tp->stats.tx_dropped */ 1646 /* XXX account for unsent Tx packets in tp->stats.tx_dropped */
1643} 1647}
1644 1648
1645 1649static void rtl8139_tx_timeout_task (void *_data)
1646static void rtl8139_tx_timeout (struct net_device *dev)
1647{ 1650{
1651 struct net_device *dev = _data;
1648 struct rtl8139_private *tp = netdev_priv(dev); 1652 struct rtl8139_private *tp = netdev_priv(dev);
1649 void __iomem *ioaddr = tp->mmio_addr; 1653 void __iomem *ioaddr = tp->mmio_addr;
1650 int i; 1654 int i;
1651 u8 tmp8; 1655 u8 tmp8;
1652 unsigned long flags;
1653 1656
1654 printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x " 1657 printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x "
1655 "media %2.2x.\n", dev->name, RTL_R8 (ChipCmd), 1658 "media %2.2x.\n", dev->name, RTL_R8 (ChipCmd),
@@ -1670,23 +1673,34 @@ static void rtl8139_tx_timeout (struct net_device *dev)
1670 if (tmp8 & CmdTxEnb) 1673 if (tmp8 & CmdTxEnb)
1671 RTL_W8 (ChipCmd, CmdRxEnb); 1674 RTL_W8 (ChipCmd, CmdRxEnb);
1672 1675
1673 spin_lock(&tp->rx_lock); 1676 spin_lock_bh(&tp->rx_lock);
1674 /* Disable interrupts by clearing the interrupt mask. */ 1677 /* Disable interrupts by clearing the interrupt mask. */
1675 RTL_W16 (IntrMask, 0x0000); 1678 RTL_W16 (IntrMask, 0x0000);
1676 1679
1677 /* Stop a shared interrupt from scavenging while we are. */ 1680 /* Stop a shared interrupt from scavenging while we are. */
1678 spin_lock_irqsave (&tp->lock, flags); 1681 spin_lock_irq(&tp->lock);
1679 rtl8139_tx_clear (tp); 1682 rtl8139_tx_clear (tp);
1680 spin_unlock_irqrestore (&tp->lock, flags); 1683 spin_unlock_irq(&tp->lock);
1681 1684
1682 /* ...and finally, reset everything */ 1685 /* ...and finally, reset everything */
1683 if (netif_running(dev)) { 1686 if (netif_running(dev)) {
1684 rtl8139_hw_start (dev); 1687 rtl8139_hw_start (dev);
1685 netif_wake_queue (dev); 1688 netif_wake_queue (dev);
1686 } 1689 }
1687 spin_unlock(&tp->rx_lock); 1690 spin_unlock_bh(&tp->rx_lock);
1688} 1691}
1689 1692
1693static void rtl8139_tx_timeout (struct net_device *dev)
1694{
1695 struct rtl8139_private *tp = netdev_priv(dev);
1696
1697 if (!tp->have_thread) {
1698 INIT_WORK(&tp->thread, rtl8139_tx_timeout_task, dev);
1699 schedule_delayed_work(&tp->thread, next_tick);
1700 } else
1701 tp->watchdog_fired = 1;
1702
1703}
1690 1704
1691static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) 1705static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
1692{ 1706{
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6a6a08441804..47c72a63dfe1 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -4,9 +4,9 @@
4# 4#
5 5
6menu "Network device support" 6menu "Network device support"
7 depends on NET
7 8
8config NETDEVICES 9config NETDEVICES
9 depends on NET
10 default y if UML 10 default y if UML
11 bool "Network device support" 11 bool "Network device support"
12 ---help--- 12 ---help---
@@ -24,9 +24,6 @@ config NETDEVICES
24 24
25 If unsure, say Y. 25 If unsure, say Y.
26 26
27# All the following symbols are dependent on NETDEVICES - do not repeat
28# that for each of the symbols.
29if NETDEVICES
30 27
31config IFB 28config IFB
32 tristate "Intermediate Functional Block support" 29 tristate "Intermediate Functional Block support"
@@ -2718,8 +2715,6 @@ config NETCONSOLE
2718 If you want to log kernel messages over the network, enable this. 2715 If you want to log kernel messages over the network, enable this.
2719 See <file:Documentation/networking/netconsole.txt> for details. 2716 See <file:Documentation/networking/netconsole.txt> for details.
2720 2717
2721endif #NETDEVICES
2722
2723config NETPOLL 2718config NETPOLL
2724 def_bool NETCONSOLE 2719 def_bool NETCONSOLE
2725 2720
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4ff006c37626..e0f51afec778 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1145,7 +1145,8 @@ int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev)
1145} 1145}
1146 1146
1147#define BOND_INTERSECT_FEATURES \ 1147#define BOND_INTERSECT_FEATURES \
1148 (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) 1148 (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\
1149 NETIF_F_TSO|NETIF_F_UFO)
1149 1150
1150/* 1151/*
1151 * Compute the common dev->feature set available to all slaves. Some 1152 * Compute the common dev->feature set available to all slaves. Some
@@ -1168,6 +1169,16 @@ static int bond_compute_features(struct bonding *bond)
1168 NETIF_F_HW_CSUM))) 1169 NETIF_F_HW_CSUM)))
1169 features &= ~NETIF_F_SG; 1170 features &= ~NETIF_F_SG;
1170 1171
1172 /*
1173 * features will include NETIF_F_TSO (NETIF_F_UFO) iff all
1174 * slave devices support NETIF_F_TSO (NETIF_F_UFO), which
1175 * implies that all slaves also support scatter-gather
1176 * (NETIF_F_SG), which implies that features also includes
1177 * NETIF_F_SG. So no need to check whether we have an
1178 * illegal combination of NETIF_F_{TSO,UFO} and
1179 * !NETIF_F_SG
1180 */
1181
1171 features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); 1182 features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
1172 bond_dev->features = features; 1183 bond_dev->features = features;
1173 1184
@@ -4080,6 +4091,8 @@ static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,
4080 4091
4081static struct ethtool_ops bond_ethtool_ops = { 4092static struct ethtool_ops bond_ethtool_ops = {
4082 .get_tx_csum = ethtool_op_get_tx_csum, 4093 .get_tx_csum = ethtool_op_get_tx_csum,
4094 .get_tso = ethtool_op_get_tso,
4095 .get_ufo = ethtool_op_get_ufo,
4083 .get_sg = ethtool_op_get_sg, 4096 .get_sg = ethtool_op_get_sg,
4084 .get_drvinfo = bond_ethtool_get_drvinfo, 4097 .get_drvinfo = bond_ethtool_get_drvinfo,
4085}; 4098};
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 32d13da43a0b..041bcc583557 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -260,7 +260,7 @@ static ssize_t bonding_store_slaves(struct class_device *cd, const char *buffer,
260 char *ifname; 260 char *ifname;
261 int i, res, found, ret = count; 261 int i, res, found, ret = count;
262 struct slave *slave; 262 struct slave *slave;
263 struct net_device *dev = 0; 263 struct net_device *dev = NULL;
264 struct bonding *bond = to_bond(cd); 264 struct bonding *bond = to_bond(cd);
265 265
266 /* Quick sanity check -- is the bond interface up? */ 266 /* Quick sanity check -- is the bond interface up? */
@@ -995,7 +995,7 @@ static ssize_t bonding_store_primary(struct class_device *cd, const char *buf, s
995 printk(KERN_INFO DRV_NAME 995 printk(KERN_INFO DRV_NAME
996 ": %s: Setting primary slave to None.\n", 996 ": %s: Setting primary slave to None.\n",
997 bond->dev->name); 997 bond->dev->name);
998 bond->primary_slave = 0; 998 bond->primary_slave = NULL;
999 bond_select_active_slave(bond); 999 bond_select_active_slave(bond);
1000 } else { 1000 } else {
1001 printk(KERN_INFO DRV_NAME 1001 printk(KERN_INFO DRV_NAME
@@ -1123,7 +1123,7 @@ static ssize_t bonding_store_active_slave(struct class_device *cd, const char *b
1123 printk(KERN_INFO DRV_NAME 1123 printk(KERN_INFO DRV_NAME
1124 ": %s: Setting active slave to None.\n", 1124 ": %s: Setting active slave to None.\n",
1125 bond->dev->name); 1125 bond->dev->name);
1126 bond->primary_slave = 0; 1126 bond->primary_slave = NULL;
1127 bond_select_active_slave(bond); 1127 bond_select_active_slave(bond);
1128 } else { 1128 } else {
1129 printk(KERN_INFO DRV_NAME 1129 printk(KERN_INFO DRV_NAME
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index bf1fd2b98bf8..24253c807e55 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2752,8 +2752,6 @@ static int e100_resume(struct pci_dev *pdev)
2752 retval = pci_enable_wake(pdev, 0, 0); 2752 retval = pci_enable_wake(pdev, 0, 0);
2753 if (retval) 2753 if (retval)
2754 DPRINTK(PROBE,ERR, "Error clearing wake events\n"); 2754 DPRINTK(PROBE,ERR, "Error clearing wake events\n");
2755 if(e100_hw_init(nic))
2756 DPRINTK(HW, ERR, "e100_hw_init failed\n");
2757 2755
2758 netif_device_attach(netdev); 2756 netif_device_attach(netdev);
2759 if(netif_running(netdev)) 2757 if(netif_running(netdev))
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0c18dbd67d3b..0e8e3fcde9ff 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -199,8 +199,7 @@ static int gfar_probe(struct platform_device *pdev)
199 199
200 /* get a pointer to the register memory */ 200 /* get a pointer to the register memory */
201 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 201 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
202 priv->regs = (struct gfar *) 202 priv->regs = ioremap(r->start, sizeof (struct gfar));
203 ioremap(r->start, sizeof (struct gfar));
204 203
205 if (NULL == priv->regs) { 204 if (NULL == priv->regs) {
206 err = -ENOMEM; 205 err = -ENOMEM;
@@ -369,7 +368,7 @@ static int gfar_probe(struct platform_device *pdev)
369 return 0; 368 return 0;
370 369
371register_fail: 370register_fail:
372 iounmap((void *) priv->regs); 371 iounmap(priv->regs);
373regs_fail: 372regs_fail:
374 free_netdev(dev); 373 free_netdev(dev);
375 return err; 374 return err;
@@ -382,7 +381,7 @@ static int gfar_remove(struct platform_device *pdev)
382 381
383 platform_set_drvdata(pdev, NULL); 382 platform_set_drvdata(pdev, NULL);
384 383
385 iounmap((void *) priv->regs); 384 iounmap(priv->regs);
386 free_netdev(dev); 385 free_netdev(dev);
387 386
388 return 0; 387 return 0;
@@ -454,8 +453,7 @@ static void init_registers(struct net_device *dev)
454 453
455 /* Zero out the rmon mib registers if it has them */ 454 /* Zero out the rmon mib registers if it has them */
456 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { 455 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
457 memset((void *) &(priv->regs->rmon), 0, 456 memset_io(&(priv->regs->rmon), 0, sizeof (struct rmon_mib));
458 sizeof (struct rmon_mib));
459 457
460 /* Mask off the CAM interrupts */ 458 /* Mask off the CAM interrupts */
461 gfar_write(&priv->regs->rmon.cam1, 0xffffffff); 459 gfar_write(&priv->regs->rmon.cam1, 0xffffffff);
@@ -477,7 +475,7 @@ static void init_registers(struct net_device *dev)
477void gfar_halt(struct net_device *dev) 475void gfar_halt(struct net_device *dev)
478{ 476{
479 struct gfar_private *priv = netdev_priv(dev); 477 struct gfar_private *priv = netdev_priv(dev);
480 struct gfar *regs = priv->regs; 478 struct gfar __iomem *regs = priv->regs;
481 u32 tempval; 479 u32 tempval;
482 480
483 /* Mask all interrupts */ 481 /* Mask all interrupts */
@@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev)
507void stop_gfar(struct net_device *dev) 505void stop_gfar(struct net_device *dev)
508{ 506{
509 struct gfar_private *priv = netdev_priv(dev); 507 struct gfar_private *priv = netdev_priv(dev);
510 struct gfar *regs = priv->regs; 508 struct gfar __iomem *regs = priv->regs;
511 unsigned long flags; 509 unsigned long flags;
512 510
513 phy_stop(priv->phydev); 511 phy_stop(priv->phydev);
@@ -590,7 +588,7 @@ static void free_skb_resources(struct gfar_private *priv)
590void gfar_start(struct net_device *dev) 588void gfar_start(struct net_device *dev)
591{ 589{
592 struct gfar_private *priv = netdev_priv(dev); 590 struct gfar_private *priv = netdev_priv(dev);
593 struct gfar *regs = priv->regs; 591 struct gfar __iomem *regs = priv->regs;
594 u32 tempval; 592 u32 tempval;
595 593
596 /* Enable Rx and Tx in MACCFG1 */ 594 /* Enable Rx and Tx in MACCFG1 */
@@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev)
624 unsigned long vaddr; 622 unsigned long vaddr;
625 int i; 623 int i;
626 struct gfar_private *priv = netdev_priv(dev); 624 struct gfar_private *priv = netdev_priv(dev);
627 struct gfar *regs = priv->regs; 625 struct gfar __iomem *regs = priv->regs;
628 int err = 0; 626 int err = 0;
629 u32 rctrl = 0; 627 u32 rctrl = 0;
630 u32 attrs = 0; 628 u32 attrs = 0;
@@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1622static void adjust_link(struct net_device *dev) 1620static void adjust_link(struct net_device *dev)
1623{ 1621{
1624 struct gfar_private *priv = netdev_priv(dev); 1622 struct gfar_private *priv = netdev_priv(dev);
1625 struct gfar *regs = priv->regs; 1623 struct gfar __iomem *regs = priv->regs;
1626 unsigned long flags; 1624 unsigned long flags;
1627 struct phy_device *phydev = priv->phydev; 1625 struct phy_device *phydev = priv->phydev;
1628 int new_state = 0; 1626 int new_state = 0;
@@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_device *dev)
1703{ 1701{
1704 struct dev_mc_list *mc_ptr; 1702 struct dev_mc_list *mc_ptr;
1705 struct gfar_private *priv = netdev_priv(dev); 1703 struct gfar_private *priv = netdev_priv(dev);
1706 struct gfar *regs = priv->regs; 1704 struct gfar __iomem *regs = priv->regs;
1707 u32 tempval; 1705 u32 tempval;
1708 1706
1709 if(dev->flags & IFF_PROMISC) { 1707 if(dev->flags & IFF_PROMISC) {
@@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr)
1842 int idx; 1840 int idx;
1843 char tmpbuf[MAC_ADDR_LEN]; 1841 char tmpbuf[MAC_ADDR_LEN];
1844 u32 tempval; 1842 u32 tempval;
1845 u32 *macptr = &priv->regs->macstnaddr1; 1843 u32 __iomem *macptr = &priv->regs->macstnaddr1;
1846 1844
1847 macptr += num*2; 1845 macptr += num*2;
1848 1846
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index cb9d66ac3ab9..d37d5401be6e 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -682,8 +682,8 @@ struct gfar_private {
682 struct rxbd8 *cur_rx; /* Next free rx ring entry */ 682 struct rxbd8 *cur_rx; /* Next free rx ring entry */
683 struct txbd8 *cur_tx; /* Next free ring entry */ 683 struct txbd8 *cur_tx; /* Next free ring entry */
684 struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ 684 struct txbd8 *dirty_tx; /* The Ring entry to be freed. */
685 struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ 685 struct gfar __iomem *regs; /* Pointer to the GFAR memory mapped Registers */
686 u32 *hash_regs[16]; 686 u32 __iomem *hash_regs[16];
687 int hash_width; 687 int hash_width;
688 struct net_device_stats stats; /* linux network statistics */ 688 struct net_device_stats stats; /* linux network statistics */
689 struct gfar_extra_stats extra_stats; 689 struct gfar_extra_stats extra_stats;
@@ -718,14 +718,14 @@ struct gfar_private {
718 uint32_t msg_enable; 718 uint32_t msg_enable;
719}; 719};
720 720
721static inline u32 gfar_read(volatile unsigned *addr) 721static inline u32 gfar_read(volatile unsigned __iomem *addr)
722{ 722{
723 u32 val; 723 u32 val;
724 val = in_be32(addr); 724 val = in_be32(addr);
725 return val; 725 return val;
726} 726}
727 727
728static inline void gfar_write(volatile unsigned *addr, u32 val) 728static inline void gfar_write(volatile unsigned __iomem *addr, u32 val)
729{ 729{
730 out_be32(addr, val); 730 out_be32(addr, val);
731} 731}
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 765e810620fe..5de7b2e259dc 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
144 u64 *extra = (u64 *) & priv->extra_stats; 144 u64 *extra = (u64 *) & priv->extra_stats;
145 145
146 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { 146 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
147 u32 *rmon = (u32 *) & priv->regs->rmon; 147 u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon;
148 struct gfar_stats *stats = (struct gfar_stats *) buf; 148 struct gfar_stats *stats = (struct gfar_stats *) buf;
149 149
150 for (i = 0; i < GFAR_RMON_LEN; i++) 150 for (i = 0; i < GFAR_RMON_LEN; i++)
151 stats->rmon[i] = (u64) (rmon[i]); 151 stats->rmon[i] = (u64) gfar_read(&rmon[i]);
152 152
153 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) 153 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
154 stats->extra[i] = extra[i]; 154 stats->extra[i] = extra[i];
@@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi
221{ 221{
222 int i; 222 int i;
223 struct gfar_private *priv = netdev_priv(dev); 223 struct gfar_private *priv = netdev_priv(dev);
224 u32 *theregs = (u32 *) priv->regs; 224 u32 __iomem *theregs = (u32 __iomem *) priv->regs;
225 u32 *buf = (u32 *) regbuf; 225 u32 *buf = (u32 *) regbuf;
226 226
227 for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++) 227 for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
228 buf[i] = theregs[i]; 228 buf[i] = gfar_read(&theregs[i]);
229} 229}
230 230
231/* Convert microseconds to ethernet clock ticks, which changes 231/* Convert microseconds to ethernet clock ticks, which changes
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 74e52fcbf806..c6b725529af5 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -50,7 +50,7 @@
50 * All PHY configuration is done through the TSEC1 MIIM regs */ 50 * All PHY configuration is done through the TSEC1 MIIM regs */
51int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) 51int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
52{ 52{
53 struct gfar_mii *regs = bus->priv; 53 struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
54 54
55 /* Set the PHY address and the register address we want to write */ 55 /* Set the PHY address and the register address we want to write */
56 gfar_write(&regs->miimadd, (mii_id << 8) | regnum); 56 gfar_write(&regs->miimadd, (mii_id << 8) | regnum);
@@ -70,7 +70,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
70 * configuration has to be done through the TSEC1 MIIM regs */ 70 * configuration has to be done through the TSEC1 MIIM regs */
71int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) 71int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
72{ 72{
73 struct gfar_mii *regs = bus->priv; 73 struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
74 u16 value; 74 u16 value;
75 75
76 /* Set the PHY address and the register address we want to read */ 76 /* Set the PHY address and the register address we want to read */
@@ -94,7 +94,7 @@ int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
94/* Reset the MIIM registers, and wait for the bus to free */ 94/* Reset the MIIM registers, and wait for the bus to free */
95int gfar_mdio_reset(struct mii_bus *bus) 95int gfar_mdio_reset(struct mii_bus *bus)
96{ 96{
97 struct gfar_mii *regs = bus->priv; 97 struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
98 unsigned int timeout = PHY_INIT_TIMEOUT; 98 unsigned int timeout = PHY_INIT_TIMEOUT;
99 99
100 spin_lock_bh(&bus->mdio_lock); 100 spin_lock_bh(&bus->mdio_lock);
@@ -126,7 +126,7 @@ int gfar_mdio_probe(struct device *dev)
126{ 126{
127 struct platform_device *pdev = to_platform_device(dev); 127 struct platform_device *pdev = to_platform_device(dev);
128 struct gianfar_mdio_data *pdata; 128 struct gianfar_mdio_data *pdata;
129 struct gfar_mii *regs; 129 struct gfar_mii __iomem *regs;
130 struct mii_bus *new_bus; 130 struct mii_bus *new_bus;
131 struct resource *r; 131 struct resource *r;
132 int err = 0; 132 int err = 0;
@@ -155,15 +155,14 @@ int gfar_mdio_probe(struct device *dev)
155 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 155 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
156 156
157 /* Set the PHY base address */ 157 /* Set the PHY base address */
158 regs = (struct gfar_mii *) ioremap(r->start, 158 regs = ioremap(r->start, sizeof (struct gfar_mii));
159 sizeof (struct gfar_mii));
160 159
161 if (NULL == regs) { 160 if (NULL == regs) {
162 err = -ENOMEM; 161 err = -ENOMEM;
163 goto reg_map_fail; 162 goto reg_map_fail;
164 } 163 }
165 164
166 new_bus->priv = regs; 165 new_bus->priv = (void __force *)regs;
167 166
168 new_bus->irq = pdata->irq; 167 new_bus->irq = pdata->irq;
169 168
@@ -181,7 +180,7 @@ int gfar_mdio_probe(struct device *dev)
181 return 0; 180 return 0;
182 181
183bus_register_fail: 182bus_register_fail:
184 iounmap((void *) regs); 183 iounmap(regs);
185reg_map_fail: 184reg_map_fail:
186 kfree(new_bus); 185 kfree(new_bus);
187 186
@@ -197,7 +196,7 @@ int gfar_mdio_remove(struct device *dev)
197 196
198 dev_set_drvdata(dev, NULL); 197 dev_set_drvdata(dev, NULL);
199 198
200 iounmap((void *) (&bus->priv)); 199 iounmap((void __iomem *)bus->priv);
201 bus->priv = NULL; 200 bus->priv = NULL;
202 kfree(bus); 201 kfree(bus);
203 202
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index 3b1bef1ee215..77411a00d1ee 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -86,7 +86,6 @@
86#include <linux/bitops.h> 86#include <linux/bitops.h>
87#include <linux/jiffies.h> 87#include <linux/jiffies.h>
88 88
89#include <asm/bug.h>
90#include <asm/system.h> 89#include <asm/system.h>
91#include <asm/uaccess.h> 90#include <asm/uaccess.h>
92 91
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 7ef4b0434a3f..c0998ef938e0 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -32,6 +32,8 @@
32 */ 32 */
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/in.h>
36#include <linux/ip.h>
35#include <linux/tcp.h> 37#include <linux/tcp.h>
36#include <linux/udp.h> 38#include <linux/udp.h>
37#include <linux/etherdevice.h> 39#include <linux/etherdevice.h>
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 2e1bed153c39..6e1018448eea 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -484,13 +484,12 @@ static void mdio_write(void __iomem *ioaddr, int RegAddr, int value)
484 int i; 484 int i;
485 485
486 RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value); 486 RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value);
487 udelay(1000);
488 487
489 for (i = 2000; i > 0; i--) { 488 for (i = 20; i > 0; i--) {
490 /* Check if the RTL8169 has completed writing to the specified MII register */ 489 /* Check if the RTL8169 has completed writing to the specified MII register */
491 if (!(RTL_R32(PHYAR) & 0x80000000)) 490 if (!(RTL_R32(PHYAR) & 0x80000000))
492 break; 491 break;
493 udelay(100); 492 udelay(25);
494 } 493 }
495} 494}
496 495
@@ -499,15 +498,14 @@ static int mdio_read(void __iomem *ioaddr, int RegAddr)
499 int i, value = -1; 498 int i, value = -1;
500 499
501 RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16); 500 RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16);
502 udelay(1000);
503 501
504 for (i = 2000; i > 0; i--) { 502 for (i = 20; i > 0; i--) {
505 /* Check if the RTL8169 has completed retrieving data from the specified MII register */ 503 /* Check if the RTL8169 has completed retrieving data from the specified MII register */
506 if (RTL_R32(PHYAR) & 0x80000000) { 504 if (RTL_R32(PHYAR) & 0x80000000) {
507 value = (int) (RTL_R32(PHYAR) & 0xFFFF); 505 value = (int) (RTL_R32(PHYAR) & 0xFFFF);
508 break; 506 break;
509 } 507 }
510 udelay(100); 508 udelay(25);
511 } 509 }
512 return value; 510 return value;
513} 511}
@@ -677,6 +675,9 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
677 675
678 if (duplex == DUPLEX_HALF) 676 if (duplex == DUPLEX_HALF)
679 auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full); 677 auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full);
678
679 if (duplex == DUPLEX_FULL)
680 auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_100_Half);
680 } 681 }
681 682
682 tp->phy_auto_nego_reg = auto_nego; 683 tp->phy_auto_nego_reg = auto_nego;
diff --git a/drivers/net/sis900.h b/drivers/net/sis900.h
index 4233ea55670f..50323941e3c0 100644
--- a/drivers/net/sis900.h
+++ b/drivers/net/sis900.h
@@ -33,7 +33,6 @@ enum sis900_registers {
33 rxcfg=0x34, //Receive Configuration Register 33 rxcfg=0x34, //Receive Configuration Register
34 flctrl=0x38, //Flow Control Register 34 flctrl=0x38, //Flow Control Register
35 rxlen=0x3c, //Receive Packet Length Register 35 rxlen=0x3c, //Receive Packet Length Register
36 cfgpmcsr=0x44, //Configuration Power Management Control/Status Register
37 rfcr=0x48, //Receive Filter Control Register 36 rfcr=0x48, //Receive Filter Control Register
38 rfdr=0x4C, //Receive Filter Data Register 37 rfdr=0x4C, //Receive Filter Data Register
39 pmctrl=0xB0, //Power Management Control Register 38 pmctrl=0xB0, //Power Management Control Register
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index f8b973a04b65..cae2edf23004 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -23,12 +23,6 @@
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25 25
26/*
27 * TOTEST
28 * - speed setting
29 * - suspend/resume
30 */
31
32#include <linux/config.h> 26#include <linux/config.h>
33#include <linux/crc32.h> 27#include <linux/crc32.h>
34#include <linux/kernel.h> 28#include <linux/kernel.h>
@@ -57,7 +51,7 @@
57#include "sky2.h" 51#include "sky2.h"
58 52
59#define DRV_NAME "sky2" 53#define DRV_NAME "sky2"
60#define DRV_VERSION "0.13" 54#define DRV_VERSION "0.15"
61#define PFX DRV_NAME " " 55#define PFX DRV_NAME " "
62 56
63/* 57/*
@@ -102,6 +96,10 @@ static int copybreak __read_mostly = 256;
102module_param(copybreak, int, 0); 96module_param(copybreak, int, 0);
103MODULE_PARM_DESC(copybreak, "Receive copy threshold"); 97MODULE_PARM_DESC(copybreak, "Receive copy threshold");
104 98
99static int disable_msi = 0;
100module_param(disable_msi, int, 0);
101MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
102
105static const struct pci_device_id sky2_id_table[] = { 103static const struct pci_device_id sky2_id_table[] = {
106 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, 104 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
107 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, 105 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
@@ -198,7 +196,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
198 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 196 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
199 197
200 pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_PMC, &power_control); 198 pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_PMC, &power_control);
201 vaux = (sky2_read8(hw, B0_CTST) & Y2_VAUX_AVAIL) && 199 vaux = (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) &&
202 (power_control & PCI_PM_CAP_PME_D3cold); 200 (power_control & PCI_PM_CAP_PME_D3cold);
203 201
204 pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_CTRL, &power_control); 202 pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_CTRL, &power_control);
@@ -1834,6 +1832,8 @@ static int sky2_poll(struct net_device *dev0, int *budget)
1834 u16 hwidx; 1832 u16 hwidx;
1835 u16 tx_done[2] = { TX_NO_STATUS, TX_NO_STATUS }; 1833 u16 tx_done[2] = { TX_NO_STATUS, TX_NO_STATUS };
1836 1834
1835 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
1836
1837 hwidx = sky2_read16(hw, STAT_PUT_IDX); 1837 hwidx = sky2_read16(hw, STAT_PUT_IDX);
1838 BUG_ON(hwidx >= STATUS_RING_SIZE); 1838 BUG_ON(hwidx >= STATUS_RING_SIZE);
1839 rmb(); 1839 rmb();
@@ -1913,12 +1913,10 @@ static int sky2_poll(struct net_device *dev0, int *budget)
1913 } 1913 }
1914 1914
1915exit_loop: 1915exit_loop:
1916 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
1917
1918 sky2_tx_check(hw, 0, tx_done[0]); 1916 sky2_tx_check(hw, 0, tx_done[0]);
1919 sky2_tx_check(hw, 1, tx_done[1]); 1917 sky2_tx_check(hw, 1, tx_done[1]);
1920 1918
1921 if (sky2_read16(hw, STAT_PUT_IDX) == hw->st_idx) { 1919 if (likely(work_done < to_do)) {
1922 /* need to restart TX timer */ 1920 /* need to restart TX timer */
1923 if (is_ec_a1(hw)) { 1921 if (is_ec_a1(hw)) {
1924 sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP); 1922 sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP);
@@ -2141,14 +2139,12 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk)
2141 2139
2142static int sky2_reset(struct sky2_hw *hw) 2140static int sky2_reset(struct sky2_hw *hw)
2143{ 2141{
2144 u32 ctst;
2145 u16 status; 2142 u16 status;
2146 u8 t8, pmd_type; 2143 u8 t8, pmd_type;
2147 int i; 2144 int i, err;
2148
2149 ctst = sky2_read32(hw, B0_CTST);
2150 2145
2151 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2146 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2147
2152 hw->chip_id = sky2_read8(hw, B2_CHIP_ID); 2148 hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
2153 if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) { 2149 if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) {
2154 printk(KERN_ERR PFX "%s: unsupported chip type 0x%x\n", 2150 printk(KERN_ERR PFX "%s: unsupported chip type 0x%x\n",
@@ -2156,12 +2152,6 @@ static int sky2_reset(struct sky2_hw *hw)
2156 return -EOPNOTSUPP; 2152 return -EOPNOTSUPP;
2157 } 2153 }
2158 2154
2159 /* ring for status responses */
2160 hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES,
2161 &hw->st_dma);
2162 if (!hw->st_le)
2163 return -ENOMEM;
2164
2165 /* disable ASF */ 2155 /* disable ASF */
2166 if (hw->chip_id <= CHIP_ID_YUKON_EC) { 2156 if (hw->chip_id <= CHIP_ID_YUKON_EC) {
2167 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); 2157 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
@@ -2173,19 +2163,24 @@ static int sky2_reset(struct sky2_hw *hw)
2173 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2163 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2174 2164
2175 /* clear PCI errors, if any */ 2165 /* clear PCI errors, if any */
2176 pci_read_config_word(hw->pdev, PCI_STATUS, &status); 2166 err = pci_read_config_word(hw->pdev, PCI_STATUS, &status);
2167 if (err)
2168 goto pci_err;
2169
2177 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 2170 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2178 pci_write_config_word(hw->pdev, PCI_STATUS, 2171 err = pci_write_config_word(hw->pdev, PCI_STATUS,
2179 status | PCI_STATUS_ERROR_BITS); 2172 status | PCI_STATUS_ERROR_BITS);
2173 if (err)
2174 goto pci_err;
2180 2175
2181 sky2_write8(hw, B0_CTST, CS_MRST_CLR); 2176 sky2_write8(hw, B0_CTST, CS_MRST_CLR);
2182 2177
2183 /* clear any PEX errors */ 2178 /* clear any PEX errors */
2184 if (is_pciex(hw)) { 2179 if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) {
2185 u16 lstat; 2180 err = pci_write_config_dword(hw->pdev, PEX_UNC_ERR_STAT,
2186 pci_write_config_dword(hw->pdev, PEX_UNC_ERR_STAT, 2181 0xffffffffUL);
2187 0xffffffffUL); 2182 if (err)
2188 pci_read_config_word(hw->pdev, PEX_LNK_STAT, &lstat); 2183 goto pci_err;
2189 } 2184 }
2190 2185
2191 pmd_type = sky2_read8(hw, B2_PMD_TYP); 2186 pmd_type = sky2_read8(hw, B2_PMD_TYP);
@@ -2297,6 +2292,14 @@ static int sky2_reset(struct sky2_hw *hw)
2297 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); 2292 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START);
2298 2293
2299 return 0; 2294 return 0;
2295
2296pci_err:
2297 /* This is to catch a BIOS bug workaround where
2298 * mmconfig table doesn't have other buses.
2299 */
2300 printk(KERN_ERR PFX "%s: can't access PCI config space\n",
2301 pci_name(hw->pdev));
2302 return err;
2300} 2303}
2301 2304
2302static u32 sky2_supported_modes(const struct sky2_hw *hw) 2305static u32 sky2_supported_modes(const struct sky2_hw *hw)
@@ -2551,19 +2554,24 @@ static struct net_device_stats *sky2_get_stats(struct net_device *dev)
2551static int sky2_set_mac_address(struct net_device *dev, void *p) 2554static int sky2_set_mac_address(struct net_device *dev, void *p)
2552{ 2555{
2553 struct sky2_port *sky2 = netdev_priv(dev); 2556 struct sky2_port *sky2 = netdev_priv(dev);
2554 struct sockaddr *addr = p; 2557 struct sky2_hw *hw = sky2->hw;
2558 unsigned port = sky2->port;
2559 const struct sockaddr *addr = p;
2555 2560
2556 if (!is_valid_ether_addr(addr->sa_data)) 2561 if (!is_valid_ether_addr(addr->sa_data))
2557 return -EADDRNOTAVAIL; 2562 return -EADDRNOTAVAIL;
2558 2563
2559 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 2564 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
2560 memcpy_toio(sky2->hw->regs + B2_MAC_1 + sky2->port * 8, 2565 memcpy_toio(hw->regs + B2_MAC_1 + port * 8,
2561 dev->dev_addr, ETH_ALEN); 2566 dev->dev_addr, ETH_ALEN);
2562 memcpy_toio(sky2->hw->regs + B2_MAC_2 + sky2->port * 8, 2567 memcpy_toio(hw->regs + B2_MAC_2 + port * 8,
2563 dev->dev_addr, ETH_ALEN); 2568 dev->dev_addr, ETH_ALEN);
2564 2569
2565 if (netif_running(dev)) 2570 /* virtual address for data */
2566 sky2_phy_reinit(sky2); 2571 gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
2572
2573 /* physical address: used for pause frames */
2574 gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
2567 2575
2568 return 0; 2576 return 0;
2569} 2577}
@@ -2843,7 +2851,7 @@ static int sky2_set_coalesce(struct net_device *dev,
2843 if (ecmd->rx_coalesce_usecs_irq == 0) 2851 if (ecmd->rx_coalesce_usecs_irq == 0)
2844 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_STOP); 2852 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_STOP);
2845 else { 2853 else {
2846 sky2_write32(hw, STAT_TX_TIMER_INI, 2854 sky2_write32(hw, STAT_ISR_TIMER_INI,
2847 sky2_us2clk(hw, ecmd->rx_coalesce_usecs_irq)); 2855 sky2_us2clk(hw, ecmd->rx_coalesce_usecs_irq));
2848 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); 2856 sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START);
2849 } 2857 }
@@ -3055,6 +3063,61 @@ static void __devinit sky2_show_addr(struct net_device *dev)
3055 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); 3063 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
3056} 3064}
3057 3065
3066/* Handle software interrupt used during MSI test */
3067static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id,
3068 struct pt_regs *regs)
3069{
3070 struct sky2_hw *hw = dev_id;
3071 u32 status = sky2_read32(hw, B0_Y2_SP_ISRC2);
3072
3073 if (status == 0)
3074 return IRQ_NONE;
3075
3076 if (status & Y2_IS_IRQ_SW) {
3077 sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
3078 hw->msi = 1;
3079 }
3080 sky2_write32(hw, B0_Y2_SP_ICR, 2);
3081
3082 sky2_read32(hw, B0_IMSK);
3083 return IRQ_HANDLED;
3084}
3085
3086/* Test interrupt path by forcing a a software IRQ */
3087static int __devinit sky2_test_msi(struct sky2_hw *hw)
3088{
3089 struct pci_dev *pdev = hw->pdev;
3090 int i, err;
3091
3092 sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
3093
3094 err = request_irq(pdev->irq, sky2_test_intr, SA_SHIRQ, DRV_NAME, hw);
3095 if (err) {
3096 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
3097 pci_name(pdev), pdev->irq);
3098 return err;
3099 }
3100
3101 sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
3102 wmb();
3103
3104 for (i = 0; i < 10; i++) {
3105 barrier();
3106 if (hw->msi)
3107 goto found;
3108 mdelay(1);
3109 }
3110
3111 err = -EOPNOTSUPP;
3112 sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
3113 found:
3114 sky2_write32(hw, B0_IMSK, 0);
3115
3116 free_irq(pdev->irq, hw);
3117
3118 return err;
3119}
3120
3058static int __devinit sky2_probe(struct pci_dev *pdev, 3121static int __devinit sky2_probe(struct pci_dev *pdev,
3059 const struct pci_device_id *ent) 3122 const struct pci_device_id *ent)
3060{ 3123{
@@ -3135,6 +3198,12 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3135 } 3198 }
3136 hw->pm_cap = pm_cap; 3199 hw->pm_cap = pm_cap;
3137 3200
3201 /* ring for status responses */
3202 hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES,
3203 &hw->st_dma);
3204 if (!hw->st_le)
3205 goto err_out_iounmap;
3206
3138 err = sky2_reset(hw); 3207 err = sky2_reset(hw);
3139 if (err) 3208 if (err)
3140 goto err_out_iounmap; 3209 goto err_out_iounmap;
@@ -3169,7 +3238,22 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3169 } 3238 }
3170 } 3239 }
3171 3240
3172 err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ, DRV_NAME, hw); 3241 if (!disable_msi && pci_enable_msi(pdev) == 0) {
3242 err = sky2_test_msi(hw);
3243 if (err == -EOPNOTSUPP) {
3244 /* MSI test failed, go back to INTx mode */
3245 printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, "
3246 "switching to INTx mode. Please report this failure to "
3247 "the PCI maintainer and include system chipset information.\n",
3248 pci_name(pdev));
3249 pci_disable_msi(pdev);
3250 }
3251 else if (err)
3252 goto err_out_unregister;
3253 }
3254
3255 err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ | SA_SAMPLE_RANDOM,
3256 DRV_NAME, hw);
3173 if (err) { 3257 if (err) {
3174 printk(KERN_ERR PFX "%s: cannot assign irq %d\n", 3258 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
3175 pci_name(pdev), pdev->irq); 3259 pci_name(pdev), pdev->irq);
@@ -3184,6 +3268,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3184 return 0; 3268 return 0;
3185 3269
3186err_out_unregister: 3270err_out_unregister:
3271 if (hw->msi)
3272 pci_disable_msi(pdev);
3187 if (dev1) { 3273 if (dev1) {
3188 unregister_netdev(dev1); 3274 unregister_netdev(dev1);
3189 free_netdev(dev1); 3275 free_netdev(dev1);
@@ -3226,6 +3312,8 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
3226 sky2_read8(hw, B0_CTST); 3312 sky2_read8(hw, B0_CTST);
3227 3313
3228 free_irq(pdev->irq, hw); 3314 free_irq(pdev->irq, hw);
3315 if (hw->msi)
3316 pci_disable_msi(pdev);
3229 pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); 3317 pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
3230 pci_release_regions(pdev); 3318 pci_release_regions(pdev);
3231 pci_disable_device(pdev); 3319 pci_disable_device(pdev);
@@ -3263,25 +3351,33 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
3263static int sky2_resume(struct pci_dev *pdev) 3351static int sky2_resume(struct pci_dev *pdev)
3264{ 3352{
3265 struct sky2_hw *hw = pci_get_drvdata(pdev); 3353 struct sky2_hw *hw = pci_get_drvdata(pdev);
3266 int i; 3354 int i, err;
3267 3355
3268 pci_restore_state(pdev); 3356 pci_restore_state(pdev);
3269 pci_enable_wake(pdev, PCI_D0, 0); 3357 pci_enable_wake(pdev, PCI_D0, 0);
3270 sky2_set_power_state(hw, PCI_D0); 3358 err = sky2_set_power_state(hw, PCI_D0);
3359 if (err)
3360 goto out;
3271 3361
3272 sky2_reset(hw); 3362 err = sky2_reset(hw);
3363 if (err)
3364 goto out;
3273 3365
3274 for (i = 0; i < 2; i++) { 3366 for (i = 0; i < 2; i++) {
3275 struct net_device *dev = hw->dev[i]; 3367 struct net_device *dev = hw->dev[i];
3276 if (dev) { 3368 if (dev && netif_running(dev)) {
3277 if (netif_running(dev)) { 3369 netif_device_attach(dev);
3278 netif_device_attach(dev); 3370 err = sky2_up(dev);
3279 if (sky2_up(dev)) 3371 if (err) {
3280 dev_close(dev); 3372 printk(KERN_ERR PFX "%s: could not up: %d\n",
3373 dev->name, err);
3374 dev_close(dev);
3375 break;
3281 } 3376 }
3282 } 3377 }
3283 } 3378 }
3284 return 0; 3379out:
3380 return err;
3285} 3381}
3286#endif 3382#endif
3287 3383
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 95518921001c..fd12c289a238 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1841,6 +1841,7 @@ struct sky2_hw {
1841 struct net_device *dev[2]; 1841 struct net_device *dev[2];
1842 1842
1843 int pm_cap; 1843 int pm_cap;
1844 int msi;
1844 u8 chip_id; 1845 u8 chip_id;
1845 u8 chip_rev; 1846 u8 chip_rev;
1846 u8 copper; 1847 u8 copper;
@@ -1867,14 +1868,6 @@ static inline u8 sky2_read8(const struct sky2_hw *hw, unsigned reg)
1867 return readb(hw->regs + reg); 1868 return readb(hw->regs + reg);
1868} 1869}
1869 1870
1870/* This should probably go away, bus based tweeks suck */
1871static inline int is_pciex(const struct sky2_hw *hw)
1872{
1873 u32 status;
1874 pci_read_config_dword(hw->pdev, PCI_DEV_STATUS, &status);
1875 return (status & PCI_OS_PCI_X) == 0;
1876}
1877
1878static inline void sky2_write32(const struct sky2_hw *hw, unsigned reg, u32 val) 1871static inline void sky2_write32(const struct sky2_hw *hw, unsigned reg, u32 val)
1879{ 1872{
1880 writel(val, hw->regs + reg); 1873 writel(val, hw->regs + reg);
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 983981666800..238e9c72cb3a 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -214,7 +214,7 @@ static u32 uli526x_cr6_user_set;
214/* For module input parameter */ 214/* For module input parameter */
215static int debug; 215static int debug;
216static u32 cr6set; 216static u32 cr6set;
217static unsigned char mode = 8; 217static int mode = 8;
218 218
219/* function declaration ------------------------------------- */ 219/* function declaration ------------------------------------- */
220static int uli526x_open(struct net_device *); 220static int uli526x_open(struct net_device *);
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 2f61a47b4716..1ff5de076d21 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -1943,7 +1943,7 @@ static int dscc4_init_ring(struct net_device *dev)
1943 (++i%TX_RING_SIZE)*sizeof(*tx_fd)); 1943 (++i%TX_RING_SIZE)*sizeof(*tx_fd));
1944 } while (i < TX_RING_SIZE); 1944 } while (i < TX_RING_SIZE);
1945 1945
1946 if (dscc4_init_dummy_skb(dpriv) < 0) 1946 if (!dscc4_init_dummy_skb(dpriv))
1947 goto err_free_dma_tx; 1947 goto err_free_dma_tx;
1948 1948
1949 memset(dpriv->rx_skbuff, 0, sizeof(struct sk_buff *)*RX_RING_SIZE); 1949 memset(dpriv->rx_skbuff, 0, sizeof(struct sk_buff *)*RX_RING_SIZE);
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index 8dea07b47999..eba8e5cfacc2 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -29,7 +29,7 @@
29#include <linux/netdevice.h> 29#include <linux/netdevice.h>
30#include <linux/hdlc.h> 30#include <linux/hdlc.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <asm/delay.h> 32#include <linux/delay.h>
33#include <asm/io.h> 33#include <asm/io.h>
34 34
35#include "hd64572.h" 35#include "hd64572.h"
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 9c1e10602f2b..9d3b51c3ef54 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -27,8 +27,8 @@
27#include <linux/hdlc.h> 27#include <linux/hdlc.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/delay.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/delay.h>
32 32
33#include "wanxl.h" 33#include "wanxl.h"
34 34
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 233a4f608084..ef85d76575a2 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -148,7 +148,7 @@ config IPW2100
148 In order to use this driver, you will need a firmware image for it. 148 In order to use this driver, you will need a firmware image for it.
149 You can obtain the firmware from 149 You can obtain the firmware from
150 <http://ipw2100.sf.net/>. Once you have the firmware image, you 150 <http://ipw2100.sf.net/>. Once you have the firmware image, you
151 will need to place it in /etc/firmware. 151 will need to place it in /lib/firmware.
152 152
153 You will also very likely need the Wireless Tools in order to 153 You will also very likely need the Wireless Tools in order to
154 configure your card: 154 configure your card:
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index c5cd61c7f927..e5bb9f5ae429 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -748,7 +748,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
748 if (essid->length) { 748 if (essid->length) {
749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ 749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
750 /* if it is to big, trunk it */ 750 /* if it is to big, trunk it */
751 dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length); 751 dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length);
752 } else { 752 } else {
753 dwrq->flags = 0; 753 dwrq->flags = 0;
754 dwrq->length = 0; 754 dwrq->length = 0;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 38d6d00fb0fc..014cc8d54a9f 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -38,10 +38,10 @@
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/completion.h> 39#include <linux/completion.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41#include <linux/delay.h>
41#include <scsi/scsi_host.h> 42#include <scsi/scsi_host.h>
42#include <scsi/scsi_device.h> 43#include <scsi/scsi_device.h>
43#include <asm/semaphore.h> 44#include <asm/semaphore.h>
44#include <asm/delay.h>
45 45
46#include "aacraid.h" 46#include "aacraid.h"
47 47
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index 311a4122bd70..93edaa8696cf 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -537,9 +537,9 @@ static int mac53c94_remove(struct macio_dev *mdev)
537 free_irq(fp->intr, fp); 537 free_irq(fp->intr, fp);
538 538
539 if (fp->regs) 539 if (fp->regs)
540 iounmap((void *) fp->regs); 540 iounmap(fp->regs);
541 if (fp->dma) 541 if (fp->dma)
542 iounmap((void *) fp->dma); 542 iounmap(fp->dma);
543 kfree(fp->dma_cmd_space); 543 kfree(fp->dma_cmd_space);
544 544
545 scsi_host_put(host); 545 scsi_host_put(host);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index cd54244058b5..6fddf17a3b70 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -510,6 +510,12 @@ static const struct mv_hw_ops mv6xxx_ops = {
510}; 510};
511 511
512/* 512/*
513 * module options
514 */
515static int msi; /* Use PCI msi; either zero (off, default) or non-zero */
516
517
518/*
513 * Functions 519 * Functions
514 */ 520 */
515 521
@@ -2191,7 +2197,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2191 } 2197 }
2192 2198
2193 /* Enable interrupts */ 2199 /* Enable interrupts */
2194 if (pci_enable_msi(pdev) == 0) { 2200 if (msi && pci_enable_msi(pdev) == 0) {
2195 hpriv->hp_flags |= MV_HP_FLAG_MSI; 2201 hpriv->hp_flags |= MV_HP_FLAG_MSI;
2196 } else { 2202 } else {
2197 pci_intx(pdev, 1); 2203 pci_intx(pdev, 1);
@@ -2246,5 +2252,8 @@ MODULE_LICENSE("GPL");
2246MODULE_DEVICE_TABLE(pci, mv_pci_tbl); 2252MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
2247MODULE_VERSION(DRV_VERSION); 2253MODULE_VERSION(DRV_VERSION);
2248 2254
2255module_param(msi, int, 0444);
2256MODULE_PARM_DESC(msi, "Enable use of PCI MSI (0=off, 1=on)");
2257
2249module_init(mv_init); 2258module_init(mv_init);
2250module_exit(mv_exit); 2259module_exit(mv_exit);
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index b017f85e6d6a..17f74d3c10e7 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -231,6 +231,10 @@ MODULE_LICENSE("GPL");
231MODULE_DEVICE_TABLE(pci, sil_pci_tbl); 231MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
232MODULE_VERSION(DRV_VERSION); 232MODULE_VERSION(DRV_VERSION);
233 233
234static int slow_down = 0;
235module_param(slow_down, int, 0444);
236MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)");
237
234 238
235static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) 239static unsigned char sil_get_device_cache_line(struct pci_dev *pdev)
236{ 240{
@@ -354,8 +358,10 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
354 } 358 }
355 359
356 /* limit requests to 15 sectors */ 360 /* limit requests to 15 sectors */
357 if ((ap->flags & SIL_FLAG_MOD15WRITE) && (quirks & SIL_QUIRK_MOD15WRITE)) { 361 if (slow_down ||
358 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix\n", 362 ((ap->flags & SIL_FLAG_MOD15WRITE) &&
363 (quirks & SIL_QUIRK_MOD15WRITE))) {
364 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n",
359 ap->id, dev->devno); 365 ap->id, dev->devno);
360 ap->host->max_sectors = 15; 366 ap->host->max_sectors = 15;
361 ap->host->hostt->max_sectors = 15; 367 ap->host->hostt->max_sectors = 15;
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 59a1c9d9d3bd..723f7acbeb12 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -463,7 +463,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
463} 463}
464 464
465static void* 465static void*
466mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 466mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
467{ 467{
468 struct mempool_zone *zone = pool_data; 468 struct mempool_zone *zone = pool_data;
469 469
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 7d0700091f3d..2a547538d444 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1679,7 +1679,7 @@ static int
1679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) 1679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
1680{ 1680{
1681 int sg_bufflen = tablesize * sizeof(struct scatterlist); 1681 int sg_bufflen = tablesize * sizeof(struct scatterlist);
1682 unsigned int gfp_flags = GFP_ATOMIC | __GFP_NOWARN; 1682 gfp_t gfp_flags = GFP_ATOMIC | __GFP_NOWARN;
1683 1683
1684 /* 1684 /*
1685 * TODO: test without low_dma, we should not need it since 1685 * TODO: test without low_dma, we should not need it since
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 7aef7518b0d1..8c5c276c5577 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -362,7 +362,7 @@ static struct uart_ops serial21285_ops = {
362 362
363static struct uart_port serial21285_port = { 363static struct uart_port serial21285_port = {
364 .mapbase = 0x42000160, 364 .mapbase = 0x42000160,
365 .iotype = SERIAL_IO_MEM, 365 .iotype = UPIO_MEM,
366 .irq = NO_IRQ, 366 .irq = NO_IRQ,
367 .fifosize = 16, 367 .fifosize = 16,
368 .ops = &serial21285_ops, 368 .ops = &serial21285_ops,
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 8cbf0fc5a225..7f0f35a05dca 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -332,7 +332,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg
332 * Make sure that we do not overflow the buffer 332 * Make sure that we do not overflow the buffer
333 */ 333 */
334 if (tty_request_buffer_room(tty, 1) == 0) { 334 if (tty_request_buffer_room(tty, 1) == 0) {
335 schedule_work(&tty->flip.work); 335 tty_schedule_flip(tty);
336 return; 336 return;
337 } 337 }
338 338
@@ -353,7 +353,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg
353 } while((rx = uart->urx.w) & URX_DATA_READY); 353 } while((rx = uart->urx.w) & URX_DATA_READY);
354#endif 354#endif
355 355
356 schedule_work(&tty->flip.work); 356 tty_schedule_flip(tty);
357 357
358clear_and_exit: 358clear_and_exit:
359 return; 359 return;
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index 60f5a5dc17f1..9843ae3d420e 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -509,7 +509,7 @@ static _INLINE_ void receive_chars(ser_info_t *info)
509 509
510 info->rx_cur = (QUICC_BD *)bdp; 510 info->rx_cur = (QUICC_BD *)bdp;
511 511
512 schedule_work(&tty->flip.work); 512 tty_schedule_flip(tty);
513} 513}
514 514
515static _INLINE_ void receive_break(ser_info_t *info) 515static _INLINE_ void receive_break(ser_info_t *info)
@@ -521,7 +521,7 @@ static _INLINE_ void receive_break(ser_info_t *info)
521 * the break. If not, we exit now, losing the break. FIXME 521 * the break. If not, we exit now, losing the break. FIXME
522 */ 522 */
523 tty_insert_flip_char(tty, 0, TTY_BREAK); 523 tty_insert_flip_char(tty, 0, TTY_BREAK);
524 schedule_work(&tty->flip.work); 524 tty_schedule_flip(tty);
525} 525}
526 526
527static _INLINE_ void transmit_chars(ser_info_t *info) 527static _INLINE_ void transmit_chars(ser_info_t *info)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 179c1f065e60..b1fc97d5f643 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2229,6 +2229,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2229 * and restore the IER 2229 * and restore the IER
2230 */ 2230 */
2231 wait_for_xmitr(up, BOTH_EMPTY); 2231 wait_for_xmitr(up, BOTH_EMPTY);
2232 up->ier |= UART_IER_THRI;
2232 serial_out(up, UART_IER, ier | UART_IER_THRI); 2233 serial_out(up, UART_IER, ier | UART_IER_THRI);
2233} 2234}
2234 2235
diff --git a/drivers/serial/8250_au1x00.c b/drivers/serial/8250_au1x00.c
index 06ae8fbcc947..8d8d7a70d03e 100644
--- a/drivers/serial/8250_au1x00.c
+++ b/drivers/serial/8250_au1x00.c
@@ -56,7 +56,6 @@ static struct plat_serial8250_port au1x00_data[] = {
56#elif defined(CONFIG_SOC_AU1550) 56#elif defined(CONFIG_SOC_AU1550)
57 PORT(UART0_ADDR, AU1550_UART0_INT), 57 PORT(UART0_ADDR, AU1550_UART0_INT),
58 PORT(UART1_ADDR, AU1550_UART1_INT), 58 PORT(UART1_ADDR, AU1550_UART1_INT),
59 PORT(UART2_ADDR, AU1550_UART2_INT),
60 PORT(UART3_ADDR, AU1550_UART3_INT), 59 PORT(UART3_ADDR, AU1550_UART3_INT),
61#elif defined(CONFIG_SOC_AU1200) 60#elif defined(CONFIG_SOC_AU1200)
62 PORT(UART0_ADDR, AU1200_UART0_INT), 61 PORT(UART0_ADDR, AU1200_UART0_INT),
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index bb9ec28ccc2b..94886c000d2a 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1882,6 +1882,10 @@ static struct pci_device_id serial_pci_tbl[] = {
1882 PCI_SUBVENDOR_ID_CONNECT_TECH, 1882 PCI_SUBVENDOR_ID_CONNECT_TECH,
1883 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0, 1883 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
1884 pbn_b0_4_1843200 }, 1884 pbn_b0_4_1843200 },
1885 { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
1886 PCI_VENDOR_ID_AFAVLAB,
1887 PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
1888 pbn_b0_4_1152000 },
1885 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152, 1889 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
1886 PCI_SUBVENDOR_ID_CONNECT_TECH, 1890 PCI_SUBVENDOR_ID_CONNECT_TECH,
1887 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0, 1891 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 429de2723a1c..321a3b3a5728 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -561,7 +561,7 @@ static struct uart_amba_port amba_ports[UART_NR] = {
561 .port = { 561 .port = {
562 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART0_BASE), 562 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART0_BASE),
563 .mapbase = INTEGRATOR_UART0_BASE, 563 .mapbase = INTEGRATOR_UART0_BASE,
564 .iotype = SERIAL_IO_MEM, 564 .iotype = UPIO_MEM,
565 .irq = IRQ_UARTINT0, 565 .irq = IRQ_UARTINT0,
566 .uartclk = 14745600, 566 .uartclk = 14745600,
567 .fifosize = 16, 567 .fifosize = 16,
@@ -576,7 +576,7 @@ static struct uart_amba_port amba_ports[UART_NR] = {
576 .port = { 576 .port = {
577 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART1_BASE), 577 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART1_BASE),
578 .mapbase = INTEGRATOR_UART1_BASE, 578 .mapbase = INTEGRATOR_UART1_BASE,
579 .iotype = SERIAL_IO_MEM, 579 .iotype = UPIO_MEM,
580 .irq = IRQ_UARTINT1, 580 .irq = IRQ_UARTINT1,
581 .uartclk = 14745600, 581 .uartclk = 14745600,
582 .fifosize = 16, 582 .fifosize = 16,
diff --git a/drivers/serial/au1x00_uart.c b/drivers/serial/au1x00_uart.c
index ceb5d7f37bbd..344022fe53ef 100644
--- a/drivers/serial/au1x00_uart.c
+++ b/drivers/serial/au1x00_uart.c
@@ -892,7 +892,7 @@ serial8250_request_std_resource(struct uart_8250_port *up, struct resource **res
892 int ret = 0; 892 int ret = 0;
893 893
894 switch (up->port.iotype) { 894 switch (up->port.iotype) {
895 case SERIAL_IO_MEM: 895 case UPIO_MEM:
896 if (up->port.mapbase) { 896 if (up->port.mapbase) {
897 *res = request_mem_region(up->port.mapbase, size, "serial"); 897 *res = request_mem_region(up->port.mapbase, size, "serial");
898 if (!*res) 898 if (!*res)
@@ -900,8 +900,8 @@ serial8250_request_std_resource(struct uart_8250_port *up, struct resource **res
900 } 900 }
901 break; 901 break;
902 902
903 case SERIAL_IO_HUB6: 903 case UPIO_HUB6:
904 case SERIAL_IO_PORT: 904 case UPIO_PORT:
905 *res = request_region(up->port.iobase, size, "serial"); 905 *res = request_region(up->port.iobase, size, "serial");
906 if (!*res) 906 if (!*res)
907 ret = -EBUSY; 907 ret = -EBUSY;
@@ -919,7 +919,7 @@ static void serial8250_release_port(struct uart_port *port)
919 size <<= up->port.regshift; 919 size <<= up->port.regshift;
920 920
921 switch (up->port.iotype) { 921 switch (up->port.iotype) {
922 case SERIAL_IO_MEM: 922 case UPIO_MEM:
923 if (up->port.mapbase) { 923 if (up->port.mapbase) {
924 /* 924 /*
925 * Unmap the area. 925 * Unmap the area.
@@ -935,8 +935,8 @@ static void serial8250_release_port(struct uart_port *port)
935 } 935 }
936 break; 936 break;
937 937
938 case SERIAL_IO_HUB6: 938 case UPIO_HUB6:
939 case SERIAL_IO_PORT: 939 case UPIO_PORT:
940 start = up->port.iobase; 940 start = up->port.iobase;
941 941
942 if (size) 942 if (size)
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 16af5626c243..b7bf4c698a47 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -252,12 +252,9 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs)
252 /* If we have not enough room in tty flip buffer, then we try 252 /* If we have not enough room in tty flip buffer, then we try
253 * later, which will be the next rx-interrupt or a timeout 253 * later, which will be the next rx-interrupt or a timeout
254 */ 254 */
255 if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { 255 if(tty_buffer_request_room(tty, i) < i) {
256 tty->flip.work.func((void *)tty); 256 printk(KERN_WARNING "No room in flip buffer\n");
257 if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { 257 return;
258 printk(KERN_WARNING "TTY_DONT_FLIP set\n");
259 return;
260 }
261 } 258 }
262 259
263 /* get pointer */ 260 /* get pointer */
@@ -276,9 +273,7 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs)
276 continue; 273 continue;
277 274
278 error_return: 275 error_return:
279 *tty->flip.char_buf_ptr++ = ch; 276 tty_insert_flip_char(tty, ch, flg);
280 *tty->flip.flag_buf_ptr++ = flg;
281 tty->flip.count++;
282 277
283 } /* End while (i--) */ 278 } /* End while (i--) */
284 279
@@ -908,7 +903,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
908 .port = { 903 .port = {
909 .irq = SMC1_IRQ, 904 .irq = SMC1_IRQ,
910 .ops = &cpm_uart_pops, 905 .ops = &cpm_uart_pops,
911 .iotype = SERIAL_IO_MEM, 906 .iotype = UPIO_MEM,
912 .lock = SPIN_LOCK_UNLOCKED, 907 .lock = SPIN_LOCK_UNLOCKED,
913 }, 908 },
914 .flags = FLAG_SMC, 909 .flags = FLAG_SMC,
@@ -922,7 +917,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
922 .port = { 917 .port = {
923 .irq = SMC2_IRQ, 918 .irq = SMC2_IRQ,
924 .ops = &cpm_uart_pops, 919 .ops = &cpm_uart_pops,
925 .iotype = SERIAL_IO_MEM, 920 .iotype = UPIO_MEM,
926 .lock = SPIN_LOCK_UNLOCKED, 921 .lock = SPIN_LOCK_UNLOCKED,
927 }, 922 },
928 .flags = FLAG_SMC, 923 .flags = FLAG_SMC,
@@ -939,7 +934,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
939 .port = { 934 .port = {
940 .irq = SCC1_IRQ, 935 .irq = SCC1_IRQ,
941 .ops = &cpm_uart_pops, 936 .ops = &cpm_uart_pops,
942 .iotype = SERIAL_IO_MEM, 937 .iotype = UPIO_MEM,
943 .lock = SPIN_LOCK_UNLOCKED, 938 .lock = SPIN_LOCK_UNLOCKED,
944 }, 939 },
945 .tx_nrfifos = TX_NUM_FIFO, 940 .tx_nrfifos = TX_NUM_FIFO,
@@ -953,7 +948,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
953 .port = { 948 .port = {
954 .irq = SCC2_IRQ, 949 .irq = SCC2_IRQ,
955 .ops = &cpm_uart_pops, 950 .ops = &cpm_uart_pops,
956 .iotype = SERIAL_IO_MEM, 951 .iotype = UPIO_MEM,
957 .lock = SPIN_LOCK_UNLOCKED, 952 .lock = SPIN_LOCK_UNLOCKED,
958 }, 953 },
959 .tx_nrfifos = TX_NUM_FIFO, 954 .tx_nrfifos = TX_NUM_FIFO,
@@ -967,7 +962,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
967 .port = { 962 .port = {
968 .irq = SCC3_IRQ, 963 .irq = SCC3_IRQ,
969 .ops = &cpm_uart_pops, 964 .ops = &cpm_uart_pops,
970 .iotype = SERIAL_IO_MEM, 965 .iotype = UPIO_MEM,
971 .lock = SPIN_LOCK_UNLOCKED, 966 .lock = SPIN_LOCK_UNLOCKED,
972 }, 967 },
973 .tx_nrfifos = TX_NUM_FIFO, 968 .tx_nrfifos = TX_NUM_FIFO,
@@ -981,7 +976,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
981 .port = { 976 .port = {
982 .irq = SCC4_IRQ, 977 .irq = SCC4_IRQ,
983 .ops = &cpm_uart_pops, 978 .ops = &cpm_uart_pops,
984 .iotype = SERIAL_IO_MEM, 979 .iotype = UPIO_MEM,
985 .lock = SPIN_LOCK_UNLOCKED, 980 .lock = SPIN_LOCK_UNLOCKED,
986 }, 981 },
987 .tx_nrfifos = TX_NUM_FIFO, 982 .tx_nrfifos = TX_NUM_FIFO,
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index a64ba26a94e8..ba5541de673b 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -262,6 +262,7 @@ static inline void dz_receive_chars(struct dz_port *dport)
262 } 262 }
263 tty_insert_flip_char(tty, ch, flag); 263 tty_insert_flip_char(tty, ch, flag);
264 ignore_char: 264 ignore_char:
265 ;
265 } while (status & DZ_DVAL); 266 } while (status & DZ_DVAL);
266 267
267 if (tty) 268 if (tty)
@@ -650,7 +651,7 @@ static void __init dz_init_ports(void)
650 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) { 651 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) {
651 spin_lock_init(&dport->port.lock); 652 spin_lock_init(&dport->port.lock);
652 dport->port.membase = (char *) base; 653 dport->port.membase = (char *) base;
653 dport->port.iotype = SERIAL_IO_PORT; 654 dport->port.iotype = UPIO_PORT;
654 dport->port.irq = dec_interrupt[DEC_IRQ_DZ11]; 655 dport->port.irq = dec_interrupt[DEC_IRQ_DZ11];
655 dport->port.line = i; 656 dport->port.line = i;
656 dport->port.fifosize = 1; 657 dport->port.fifosize = 1;
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 858048efe1ed..4d53fb5ca87b 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -668,7 +668,7 @@ static struct imx_port imx_ports[] = {
668 .rtsirq = UART1_MINT_RTS, 668 .rtsirq = UART1_MINT_RTS,
669 .port = { 669 .port = {
670 .type = PORT_IMX, 670 .type = PORT_IMX,
671 .iotype = SERIAL_IO_MEM, 671 .iotype = UPIO_MEM,
672 .membase = (void *)IMX_UART1_BASE, 672 .membase = (void *)IMX_UART1_BASE,
673 .mapbase = IMX_UART1_BASE, /* FIXME */ 673 .mapbase = IMX_UART1_BASE, /* FIXME */
674 .irq = UART1_MINT_RX, 674 .irq = UART1_MINT_RX,
@@ -684,7 +684,7 @@ static struct imx_port imx_ports[] = {
684 .rtsirq = UART2_MINT_RTS, 684 .rtsirq = UART2_MINT_RTS,
685 .port = { 685 .port = {
686 .type = PORT_IMX, 686 .type = PORT_IMX,
687 .iotype = SERIAL_IO_MEM, 687 .iotype = UPIO_MEM,
688 .membase = (void *)IMX_UART2_BASE, 688 .membase = (void *)IMX_UART2_BASE,
689 .mapbase = IMX_UART2_BASE, /* FIXME */ 689 .mapbase = IMX_UART2_BASE, /* FIXME */
690 .irq = UART2_MINT_RX, 690 .irq = UART2_MINT_RX,
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 66f117d15065..419dd3cd7862 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -215,7 +215,7 @@ static void __load_zsregs(struct zilog_channel *channel, unsigned char *regs)
215 /* Lower and upper byte of baud rate generator divisor. */ 215 /* Lower and upper byte of baud rate generator divisor. */
216 write_zsreg(channel, R12, regs[R12]); 216 write_zsreg(channel, R12, regs[R12]);
217 write_zsreg(channel, R13, regs[R13]); 217 write_zsreg(channel, R13, regs[R13]);
218 218
219 /* Now rewrite R14, with BRENAB (if set). */ 219 /* Now rewrite R14, with BRENAB (if set). */
220 write_zsreg(channel, R14, regs[R14]); 220 write_zsreg(channel, R14, regs[R14]);
221 221
@@ -571,7 +571,7 @@ static void ip22zilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
571 else 571 else
572 clear_bits |= DTR; 572 clear_bits |= DTR;
573 573
574 /* NOTE: Not subject to 'transmitter active' rule. */ 574 /* NOTE: Not subject to 'transmitter active' rule. */
575 up->curregs[R5] |= set_bits; 575 up->curregs[R5] |= set_bits;
576 up->curregs[R5] &= ~clear_bits; 576 up->curregs[R5] &= ~clear_bits;
577 write_zsreg(channel, R5, up->curregs[R5]); 577 write_zsreg(channel, R5, up->curregs[R5]);
@@ -654,7 +654,7 @@ static void ip22zilog_enable_ms(struct uart_port *port)
654 if (new_reg != up->curregs[R15]) { 654 if (new_reg != up->curregs[R15]) {
655 up->curregs[R15] = new_reg; 655 up->curregs[R15] = new_reg;
656 656
657 /* NOTE: Not subject to 'transmitter active' rule. */ 657 /* NOTE: Not subject to 'transmitter active' rule. */
658 write_zsreg(channel, R15, up->curregs[R15]); 658 write_zsreg(channel, R15, up->curregs[R15]);
659 } 659 }
660} 660}
@@ -680,7 +680,7 @@ static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
680 if (new_reg != up->curregs[R5]) { 680 if (new_reg != up->curregs[R5]) {
681 up->curregs[R5] = new_reg; 681 up->curregs[R5] = new_reg;
682 682
683 /* NOTE: Not subject to 'transmitter active' rule. */ 683 /* NOTE: Not subject to 'transmitter active' rule. */
684 write_zsreg(channel, R5, up->curregs[R5]); 684 write_zsreg(channel, R5, up->curregs[R5]);
685 } 685 }
686 686
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index b48066a64a7d..242a04104393 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -80,7 +80,7 @@
80#include <asm/serial.h> 80#include <asm/serial.h>
81 81
82/* Standard COM flags */ 82/* Standard COM flags */
83#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) 83#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
84 84
85/* 85/*
86 * SERIAL_PORT_DFNS tells us about built-in ports that have no 86 * SERIAL_PORT_DFNS tells us about built-in ports that have no
diff --git a/drivers/serial/m32r_sio.h b/drivers/serial/m32r_sio.h
index 07d0dd80aa3d..7c3ec24f7e50 100644
--- a/drivers/serial/m32r_sio.h
+++ b/drivers/serial/m32r_sio.h
@@ -37,7 +37,7 @@ struct old_serial_port {
37 unsigned int irq; 37 unsigned int irq;
38 unsigned int flags; 38 unsigned int flags;
39 unsigned char io_type; 39 unsigned char io_type;
40 unsigned char *iomem_base; 40 unsigned char __iomem *iomem_base;
41 unsigned short iomem_reg_shift; 41 unsigned short iomem_reg_shift;
42}; 42};
43 43
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 0ef648fa4b2d..8cbbb954df2c 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -57,20 +57,16 @@ struct timer_list mcfrs_timer_struct;
57 * keep going. Perhaps one day the cflag settings for the 57 * keep going. Perhaps one day the cflag settings for the
58 * console can be used instead. 58 * console can be used instead.
59 */ 59 */
60#if defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \
61 defined(CONFIG_senTec) || defined(CONFIG_SNEHA)
62#define CONSOLE_BAUD_RATE 19200
63#define DEFAULT_CBAUD B19200
64#endif
65
66#if defined(CONFIG_HW_FEITH) 60#if defined(CONFIG_HW_FEITH)
67#define CONSOLE_BAUD_RATE 38400 61#define CONSOLE_BAUD_RATE 38400
68#define DEFAULT_CBAUD B38400 62#define DEFAULT_CBAUD B38400
69#endif 63#elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)
70
71#if defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)
72#define CONSOLE_BAUD_RATE 115200 64#define CONSOLE_BAUD_RATE 115200
73#define DEFAULT_CBAUD B115200 65#define DEFAULT_CBAUD B115200
66#elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \
67 defined(CONFIG_senTec) || defined(CONFIG_SNEHA)
68#define CONSOLE_BAUD_RATE 19200
69#define DEFAULT_CBAUD B19200
74#endif 70#endif
75 71
76#ifndef CONSOLE_BAUD_RATE 72#ifndef CONSOLE_BAUD_RATE
@@ -350,7 +346,7 @@ static inline void receive_chars(struct mcf_serial *info)
350 } 346 }
351 tty_insert_flip_char(tty, ch, flag); 347 tty_insert_flip_char(tty, ch, flag);
352 } 348 }
353 tty_flip_buffer_push(tty); 349 tty_schedule_flip(tty);
354 return; 350 return;
355} 351}
356 352
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 4e49168c3176..868eaf4a1a68 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -462,7 +462,7 @@ static int __init mux_probe(struct parisc_device *dev)
462 port->mapbase = dev->hpa.start + MUX_OFFSET + 462 port->mapbase = dev->hpa.start + MUX_OFFSET +
463 (i * MUX_LINE_OFFSET); 463 (i * MUX_LINE_OFFSET);
464 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); 464 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET);
465 port->iotype = SERIAL_IO_MEM; 465 port->iotype = UPIO_MEM;
466 port->type = PORT_MUX; 466 port->type = PORT_MUX;
467 port->irq = NO_IRQ; 467 port->irq = NO_IRQ;
468 port->uartclk = 0; 468 port->uartclk = 0;
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 4e03a87f3fb4..9b7ed58cb53b 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1492,7 +1492,7 @@ no_dma:
1492 /* 1492 /*
1493 * Init remaining bits of "port" structure 1493 * Init remaining bits of "port" structure
1494 */ 1494 */
1495 uap->port.iotype = SERIAL_IO_MEM; 1495 uap->port.iotype = UPIO_MEM;
1496 uap->port.irq = np->intrs[0].line; 1496 uap->port.irq = np->intrs[0].line;
1497 uap->port.uartclk = ZS_CLOCK; 1497 uap->port.uartclk = ZS_CLOCK;
1498 uap->port.fifosize = 1; 1498 uap->port.fifosize = 1;
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 0a2dd6c5b95f..7410e093a6b9 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -161,7 +161,11 @@ s3c24xx_serial_dbg(const char *fmt, ...)
161 161
162/* we can support 3 uarts, but not always use them */ 162/* we can support 3 uarts, but not always use them */
163 163
164#ifdef CONFIG_CPU_S3C2400
165#define NR_PORTS (2)
166#else
164#define NR_PORTS (3) 167#define NR_PORTS (3)
168#endif
165 169
166/* port irq numbers */ 170/* port irq numbers */
167 171
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index ff7b60b4de37..2c00b8625852 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -628,7 +628,7 @@ static void __init sa1100_init_ports(void)
628 sa1100_ports[i].port.ops = &sa1100_pops; 628 sa1100_ports[i].port.ops = &sa1100_pops;
629 sa1100_ports[i].port.fifosize = 8; 629 sa1100_ports[i].port.fifosize = 8;
630 sa1100_ports[i].port.line = i; 630 sa1100_ports[i].port.line = i;
631 sa1100_ports[i].port.iotype = SERIAL_IO_MEM; 631 sa1100_ports[i].port.iotype = UPIO_MEM;
632 init_timer(&sa1100_ports[i].timer); 632 init_timer(&sa1100_ports[i].timer);
633 sa1100_ports[i].timer.function = sa1100_timeout; 633 sa1100_ports[i].timer.function = sa1100_timeout;
634 sa1100_ports[i].timer.data = (unsigned long)&sa1100_ports[i]; 634 sa1100_ports[i].timer.data = (unsigned long)&sa1100_ports[i];
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index d0490f67f597..04186eaae227 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -501,7 +501,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = {
501 .port = { 501 .port = {
502 .membase = (void*) io_p2v (UART1_PHYS), 502 .membase = (void*) io_p2v (UART1_PHYS),
503 .mapbase = UART1_PHYS, 503 .mapbase = UART1_PHYS,
504 .iotype = SERIAL_IO_MEM, 504 .iotype = UPIO_MEM,
505 .irq = IRQ_UART1INTR, 505 .irq = IRQ_UART1INTR,
506 .uartclk = 14745600/2, 506 .uartclk = 14745600/2,
507 .fifosize = 16, 507 .fifosize = 16,
@@ -514,7 +514,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = {
514 .port = { 514 .port = {
515 .membase = (void*) io_p2v (UART2_PHYS), 515 .membase = (void*) io_p2v (UART2_PHYS),
516 .mapbase = UART2_PHYS, 516 .mapbase = UART2_PHYS,
517 .iotype = SERIAL_IO_MEM, 517 .iotype = UPIO_MEM,
518 .irq = IRQ_UART2INTR, 518 .irq = IRQ_UART2INTR,
519 .uartclk = 14745600/2, 519 .uartclk = 14745600/2,
520 .fifosize = 16, 520 .fifosize = 16,
@@ -527,7 +527,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = {
527 .port = { 527 .port = {
528 .membase = (void*) io_p2v (UART3_PHYS), 528 .membase = (void*) io_p2v (UART3_PHYS),
529 .mapbase = UART3_PHYS, 529 .mapbase = UART3_PHYS,
530 .iotype = SERIAL_IO_MEM, 530 .iotype = UPIO_MEM,
531 .irq = IRQ_UART3INTR, 531 .irq = IRQ_UART3INTR,
532 .uartclk = 14745600/2, 532 .uartclk = 14745600/2,
533 .fifosize = 16, 533 .fifosize = 16,
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 80737c131ce7..44f6bf79bbe1 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1468,10 +1468,10 @@ static struct sci_port sci_ports[] = {
1468 .port = { 1468 .port = {
1469 .membase = (void *)0xff923000, 1469 .membase = (void *)0xff923000,
1470 .mapbase = 0xff923000, 1470 .mapbase = 0xff923000,
1471 .iotype = SERIAL_IO_MEM, 1471 .iotype = UPIO_MEM,
1472 .irq = 61, 1472 .irq = 61,
1473 .ops = &sci_uart_ops, 1473 .ops = &sci_uart_ops,
1474 .flags = ASYNC_BOOT_AUTOCONF, 1474 .flags = UPF_BOOT_AUTOCONF,
1475 .line = 0, 1475 .line = 0,
1476 }, 1476 },
1477 .type = PORT_SCIF, 1477 .type = PORT_SCIF,
@@ -1482,10 +1482,10 @@ static struct sci_port sci_ports[] = {
1482 .port = { 1482 .port = {
1483 .membase = (void *)0xff924000, 1483 .membase = (void *)0xff924000,
1484 .mapbase = 0xff924000, 1484 .mapbase = 0xff924000,
1485 .iotype = SERIAL_IO_MEM, 1485 .iotype = UPIO_MEM,
1486 .irq = 62, 1486 .irq = 62,
1487 .ops = &sci_uart_ops, 1487 .ops = &sci_uart_ops,
1488 .flags = ASYNC_BOOT_AUTOCONF, 1488 .flags = UPF_BOOT_AUTOCONF,
1489 .line = 1, 1489 .line = 1,
1490 }, 1490 },
1491 .type = PORT_SCIF, 1491 .type = PORT_SCIF,
@@ -1496,10 +1496,10 @@ static struct sci_port sci_ports[] = {
1496 .port = { 1496 .port = {
1497 .membase = (void *)0xff925000, 1497 .membase = (void *)0xff925000,
1498 .mapbase = 0xff925000, 1498 .mapbase = 0xff925000,
1499 .iotype = SERIAL_IO_MEM, 1499 .iotype = UPIO_MEM,
1500 .irq = 63, 1500 .irq = 63,
1501 .ops = &sci_uart_ops, 1501 .ops = &sci_uart_ops,
1502 .flags = ASYNC_BOOT_AUTOCONF, 1502 .flags = UPF_BOOT_AUTOCONF,
1503 .line = 2, 1503 .line = 2,
1504 }, 1504 },
1505 .type = PORT_SCIF, 1505 .type = PORT_SCIF,
@@ -1511,10 +1511,10 @@ static struct sci_port sci_ports[] = {
1511 .port = { 1511 .port = {
1512 .membase = (void *)0xffe00000, 1512 .membase = (void *)0xffe00000,
1513 .mapbase = 0xffe00000, 1513 .mapbase = 0xffe00000,
1514 .iotype = SERIAL_IO_MEM, 1514 .iotype = UPIO_MEM,
1515 .irq = 43, 1515 .irq = 43,
1516 .ops = &sci_uart_ops, 1516 .ops = &sci_uart_ops,
1517 .flags = ASYNC_BOOT_AUTOCONF, 1517 .flags = UPF_BOOT_AUTOCONF,
1518 .line = 0, 1518 .line = 0,
1519 }, 1519 },
1520 .type = PORT_SCIF, 1520 .type = PORT_SCIF,
@@ -1525,10 +1525,10 @@ static struct sci_port sci_ports[] = {
1525 .port = { 1525 .port = {
1526 .membase = (void *)0xffe10000, 1526 .membase = (void *)0xffe10000,
1527 .mapbase = 0xffe10000, 1527 .mapbase = 0xffe10000,
1528 .iotype = SERIAL_IO_MEM, 1528 .iotype = UPIO_MEM,
1529 .irq = 79, 1529 .irq = 79,
1530 .ops = &sci_uart_ops, 1530 .ops = &sci_uart_ops,
1531 .flags = ASYNC_BOOT_AUTOCONF, 1531 .flags = UPF_BOOT_AUTOCONF,
1532 .line = 1, 1532 .line = 1,
1533 }, 1533 },
1534 .type = PORT_SCIF, 1534 .type = PORT_SCIF,
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 8bcaebcc0ad7..85664228a0b6 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -1036,7 +1036,7 @@ static void __init sab_attach_callback(struct linux_ebus_device *edev, void *arg
1036 up->port.irq = edev->irqs[0]; 1036 up->port.irq = edev->irqs[0];
1037 up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; 1037 up->port.fifosize = SAB82532_XMIT_FIFO_SIZE;
1038 up->port.mapbase = (unsigned long)up->regs; 1038 up->port.mapbase = (unsigned long)up->regs;
1039 up->port.iotype = SERIAL_IO_MEM; 1039 up->port.iotype = UPIO_MEM;
1040 1040
1041 writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); 1041 writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc);
1042 1042
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index bc67442c6b4c..308704566948 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -109,11 +109,11 @@ static _INLINE_ unsigned int serial_in(struct uart_sunsu_port *up, int offset)
109 offset <<= up->port.regshift; 109 offset <<= up->port.regshift;
110 110
111 switch (up->port.iotype) { 111 switch (up->port.iotype) {
112 case SERIAL_IO_HUB6: 112 case UPIO_HUB6:
113 outb(up->port.hub6 - 1 + offset, up->port.iobase); 113 outb(up->port.hub6 - 1 + offset, up->port.iobase);
114 return inb(up->port.iobase + 1); 114 return inb(up->port.iobase + 1);
115 115
116 case SERIAL_IO_MEM: 116 case UPIO_MEM:
117 return readb(up->port.membase + offset); 117 return readb(up->port.membase + offset);
118 118
119 default: 119 default:
@@ -139,12 +139,12 @@ serial_out(struct uart_sunsu_port *up, int offset, int value)
139 offset <<= up->port.regshift; 139 offset <<= up->port.regshift;
140 140
141 switch (up->port.iotype) { 141 switch (up->port.iotype) {
142 case SERIAL_IO_HUB6: 142 case UPIO_HUB6:
143 outb(up->port.hub6 - 1 + offset, up->port.iobase); 143 outb(up->port.hub6 - 1 + offset, up->port.iobase);
144 outb(value, up->port.iobase + 1); 144 outb(value, up->port.iobase + 1);
145 break; 145 break;
146 146
147 case SERIAL_IO_MEM: 147 case UPIO_MEM:
148 writeb(value, up->port.membase + offset); 148 writeb(value, up->port.membase + offset);
149 break; 149 break;
150 150
@@ -1052,7 +1052,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
1052 return; 1052 return;
1053 1053
1054 up->type_probed = PORT_UNKNOWN; 1054 up->type_probed = PORT_UNKNOWN;
1055 up->port.iotype = SERIAL_IO_MEM; 1055 up->port.iotype = UPIO_MEM;
1056 1056
1057 /* 1057 /*
1058 * First we look for Ebus-bases su's 1058 * First we look for Ebus-bases su's
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 3c72484adea7..5cc4d4c2935c 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1487,7 +1487,7 @@ static void __init sunzilog_prepare(void)
1487 up[(chip * 2) + 1].port.membase = (void __iomem *)&rp->channelB; 1487 up[(chip * 2) + 1].port.membase = (void __iomem *)&rp->channelB;
1488 1488
1489 /* Channel A */ 1489 /* Channel A */
1490 up[(chip * 2) + 0].port.iotype = SERIAL_IO_MEM; 1490 up[(chip * 2) + 0].port.iotype = UPIO_MEM;
1491 up[(chip * 2) + 0].port.irq = zilog_irq; 1491 up[(chip * 2) + 0].port.irq = zilog_irq;
1492 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; 1492 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
1493 up[(chip * 2) + 0].port.fifosize = 1; 1493 up[(chip * 2) + 0].port.fifosize = 1;
@@ -1498,7 +1498,7 @@ static void __init sunzilog_prepare(void)
1498 up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; 1498 up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A;
1499 1499
1500 /* Channel B */ 1500 /* Channel B */
1501 up[(chip * 2) + 1].port.iotype = SERIAL_IO_MEM; 1501 up[(chip * 2) + 1].port.iotype = UPIO_MEM;
1502 up[(chip * 2) + 1].port.irq = zilog_irq; 1502 up[(chip * 2) + 1].port.irq = zilog_irq;
1503 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; 1503 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK;
1504 up[(chip * 2) + 1].port.fifosize = 1; 1504 up[(chip * 2) + 1].port.fifosize = 1;
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
index 9378895a8d56..df705fda4243 100644
--- a/drivers/serial/v850e_uart.c
+++ b/drivers/serial/v850e_uart.c
@@ -496,7 +496,7 @@ static int __init v850e_uart_init (void)
496 496
497 port->ops = &v850e_uart_ops; 497 port->ops = &v850e_uart_ops;
498 port->line = chan; 498 port->line = chan;
499 port->iotype = SERIAL_IO_MEM; 499 port->iotype = UPIO_MEM;
500 port->flags = UPF_BOOT_AUTOCONF; 500 port->flags = UPF_BOOT_AUTOCONF;
501 501
502 /* We actually use multiple IRQs, but the serial 502 /* We actually use multiple IRQs, but the serial
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index c70ae81b5d98..12357e1fa558 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -38,10 +38,10 @@ static inline unsigned mcr_pack(unsigned pulse, unsigned sample)
38 38
39static int nic_wait(struct ioc3_driver_data *idd) 39static int nic_wait(struct ioc3_driver_data *idd)
40{ 40{
41 volatile unsigned mcr; 41 unsigned mcr;
42 42
43 do { 43 do {
44 mcr = (volatile unsigned)idd->vma->mcr; 44 mcr = readl(&idd->vma->mcr);
45 } while (!(mcr & 2)); 45 } while (!(mcr & 2));
46 46
47 return mcr & 1; 47 return mcr & 1;
@@ -53,7 +53,7 @@ static int nic_reset(struct ioc3_driver_data *idd)
53 unsigned long flags; 53 unsigned long flags;
54 54
55 local_irq_save(flags); 55 local_irq_save(flags);
56 idd->vma->mcr = mcr_pack(500, 65); 56 writel(mcr_pack(500, 65), &idd->vma->mcr);
57 presence = nic_wait(idd); 57 presence = nic_wait(idd);
58 local_irq_restore(flags); 58 local_irq_restore(flags);
59 59
@@ -68,7 +68,7 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
68 unsigned long flags; 68 unsigned long flags;
69 69
70 local_irq_save(flags); 70 local_irq_save(flags);
71 idd->vma->mcr = mcr_pack(6, 13); 71 writel(mcr_pack(6, 13), &idd->vma->mcr);
72 result = nic_wait(idd); 72 result = nic_wait(idd);
73 local_irq_restore(flags); 73 local_irq_restore(flags);
74 74
@@ -80,9 +80,9 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit) 80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit)
81{ 81{
82 if (bit) 82 if (bit)
83 idd->vma->mcr = mcr_pack(6, 110); 83 writel(mcr_pack(6, 110), &idd->vma->mcr);
84 else 84 else
85 idd->vma->mcr = mcr_pack(80, 30); 85 writel(mcr_pack(80, 30), &idd->vma->mcr);
86 86
87 nic_wait(idd); 87 nic_wait(idd);
88} 88}
@@ -337,7 +337,7 @@ static void probe_nic(struct ioc3_driver_data *idd)
337 int save = 0, loops = 3; 337 int save = 0, loops = 3;
338 unsigned long first, addr; 338 unsigned long first, addr;
339 339
340 idd->vma->gpcr_s = GPCR_MLAN_EN; 340 writel(GPCR_MLAN_EN, &idd->vma->gpcr_s);
341 341
342 while(loops>0) { 342 while(loops>0) {
343 idd->nic_part[0] = 0; 343 idd->nic_part[0] = 0;
@@ -408,7 +408,7 @@ static irqreturn_t ioc3_intr_io(int irq, void *arg, struct pt_regs *regs)
408 408
409 read_lock_irqsave(&ioc3_submodules_lock, flags); 409 read_lock_irqsave(&ioc3_submodules_lock, flags);
410 410
411 if(idd->dual_irq && idd->vma->eisr) { 411 if(idd->dual_irq && readb(&idd->vma->eisr)) {
412 /* send Ethernet IRQ to the driver */ 412 /* send Ethernet IRQ to the driver */
413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] && 413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] &&
414 ioc3_ethernet->intr) { 414 ioc3_ethernet->intr) {
@@ -682,7 +682,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
682 idd->id = ioc3_counter++; 682 idd->id = ioc3_counter++;
683 up_write(&ioc3_devices_rwsem); 683 up_write(&ioc3_devices_rwsem);
684 684
685 idd->gpdr_shadow = idd->vma->gpdr; 685 idd->gpdr_shadow = readl(&idd->vma->gpdr);
686 686
687 /* Read IOC3 NIC contents */ 687 /* Read IOC3 NIC contents */
688 probe_nic(idd); 688 probe_nic(idd);
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index b77dbd63e596..7a75faeb0526 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -75,16 +75,6 @@ config SPI_BUTTERFLY
75 inexpensive battery powered microcontroller evaluation board. 75 inexpensive battery powered microcontroller evaluation board.
76 This same cable can be used to flash new firmware. 76 This same cable can be used to flash new firmware.
77 77
78config SPI_BUTTERFLY
79 tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)"
80 depends on SPI_MASTER && PARPORT && EXPERIMENTAL
81 select SPI_BITBANG
82 help
83 This uses a custom parallel port cable to connect to an AVR
84 Butterfly <http://www.atmel.com/products/avr/butterfly>, an
85 inexpensive battery powered microcontroller evaluation board.
86 This same cable can be used to flash new firmware.
87
88# 78#
89# Add new SPI master controllers in alphabetical order above this line 79# Add new SPI master controllers in alphabetical order above this line
90# 80#
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 79a3c59615ab..ff9e5faa4dc9 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -163,21 +163,20 @@ static void butterfly_chipselect(struct spi_device *spi, int value)
163 struct butterfly *pp = spidev_to_pp(spi); 163 struct butterfly *pp = spidev_to_pp(spi);
164 164
165 /* set default clock polarity */ 165 /* set default clock polarity */
166 if (value) 166 if (value != BITBANG_CS_INACTIVE)
167 setsck(spi, spi->mode & SPI_CPOL); 167 setsck(spi, spi->mode & SPI_CPOL);
168 168
169 /* no chipselect on this USI link config */ 169 /* no chipselect on this USI link config */
170 if (is_usidev(spi)) 170 if (is_usidev(spi))
171 return; 171 return;
172 172
173 /* here, value == "activate or not" */ 173 /* here, value == "activate or not";
174 174 * most PARPORT_CONTROL_* bits are negated, so we must
175 /* most PARPORT_CONTROL_* bits are negated */ 175 * morph it to value == "bit value to write in control register"
176 */
176 if (spi_cs_bit == PARPORT_CONTROL_INIT) 177 if (spi_cs_bit == PARPORT_CONTROL_INIT)
177 value = !value; 178 value = !value;
178 179
179 /* here, value == "bit value to write in control register" */
180
181 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0); 180 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0);
182} 181}
183 182
@@ -202,7 +201,9 @@ butterfly_txrx_word_mode0(struct spi_device *spi,
202 201
203/* override default partitioning with cmdlinepart */ 202/* override default partitioning with cmdlinepart */
204static struct mtd_partition partitions[] = { { 203static struct mtd_partition partitions[] = { {
205 /* JFFS2 wants partitions of 4*N blocks for this device ... */ 204 /* JFFS2 wants partitions of 4*N blocks for this device,
205 * so sectors 0 and 1 can't be partitions by themselves.
206 */
206 207
207 /* sector 0 = 8 pages * 264 bytes/page (1 block) 208 /* sector 0 = 8 pages * 264 bytes/page (1 block)
208 * sector 1 = 248 pages * 264 bytes/page 209 * sector 1 = 248 pages * 264 bytes/page
@@ -316,8 +317,9 @@ static void butterfly_attach(struct parport *p)
316 if (status < 0) 317 if (status < 0)
317 goto clean2; 318 goto clean2;
318 319
319 /* Bus 1 lets us talk to at45db041b (firmware disables AVR) 320 /* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR
320 * or AVR (firmware resets at45, acts as spi slave) 321 * (firmware resets at45, acts as spi slave) or neither (we ignore
322 * both, AVR uses AT45). Here we expect firmware for the first option.
321 */ 323 */
322 pp->info[0].max_speed_hz = 15 * 1000 * 1000; 324 pp->info[0].max_speed_hz = 15 * 1000 * 1000;
323 strcpy(pp->info[0].modalias, "mtd_dataflash"); 325 strcpy(pp->info[0].modalias, "mtd_dataflash");
@@ -330,7 +332,9 @@ static void butterfly_attach(struct parport *p)
330 pp->dataflash->dev.bus_id); 332 pp->dataflash->dev.bus_id);
331 333
332#ifdef HAVE_USI 334#ifdef HAVE_USI
333 /* even more custom AVR firmware */ 335 /* Bus 2 is only for talking to the AVR, and it can work no
336 * matter who masters bus 1; needs appropriate AVR firmware.
337 */
334 pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000; 338 pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000;
335 strcpy(pp->info[1].modalias, "butterfly"); 339 strcpy(pp->info[1].modalias, "butterfly");
336 // pp->info[1].platform_data = ... TBD ... ; 340 // pp->info[1].platform_data = ... TBD ... ;
@@ -378,13 +382,8 @@ static void butterfly_detach(struct parport *p)
378 pp = butterfly; 382 pp = butterfly;
379 butterfly = NULL; 383 butterfly = NULL;
380 384
381#ifdef HAVE_USI 385 /* stop() unregisters child devices too */
382 spi_unregister_device(pp->butterfly); 386 pdev = to_platform_device(pp->bitbang.master->cdev.dev);
383 pp->butterfly = NULL;
384#endif
385 spi_unregister_device(pp->dataflash);
386 pp->dataflash = NULL;
387
388 status = spi_bitbang_stop(&pp->bitbang); 387 status = spi_bitbang_stop(&pp->bitbang);
389 388
390 /* turn off VCC */ 389 /* turn off VCC */
@@ -394,8 +393,6 @@ static void butterfly_detach(struct parport *p)
394 parport_release(pp->pd); 393 parport_release(pp->pd);
395 parport_unregister_device(pp->pd); 394 parport_unregister_device(pp->pd);
396 395
397 pdev = to_platform_device(pp->bitbang.master->cdev.dev);
398
399 (void) spi_master_put(pp->bitbang.master); 396 (void) spi_master_put(pp->bitbang.master);
400 397
401 platform_device_unregister(pdev); 398 platform_device_unregister(pdev);
@@ -420,4 +417,5 @@ static void __exit butterfly_exit(void)
420} 417}
421module_exit(butterfly_exit); 418module_exit(butterfly_exit);
422 419
420MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly");
423MODULE_LICENSE("GPL"); 421MODULE_LICENSE("GPL");
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c
index a0e5af638e0e..4a51e56f85b6 100644
--- a/drivers/tc/tc.c
+++ b/drivers/tc/tc.c
@@ -17,7 +17,6 @@
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19#include <asm/addrspace.h> 19#include <asm/addrspace.h>
20#include <asm/bug.h>
21#include <asm/errno.h> 20#include <asm/errno.h>
22#include <asm/io.h> 21#include <asm/io.h>
23#include <asm/paccess.h> 22#include <asm/paccess.h>
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 9d5015e99372..bd39bbd88d41 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -13,7 +13,6 @@
13#include <linux/ctype.h> 13#include <linux/ctype.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <asm/bug.h>
17 16
18static ssize_t backlight_show_power(struct class_device *cdev, char *buf) 17static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
19{ 18{
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 68c690605aa7..9e32485ee7bb 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -13,7 +13,6 @@
13#include <linux/ctype.h> 13#include <linux/ctype.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <asm/bug.h>
17 16
18static ssize_t lcd_show_power(struct class_device *cdev, char *buf) 17static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
19{ 18{
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c
index f3927b6cda9d..f5361cd8ccce 100644
--- a/drivers/video/pmag-ba-fb.c
+++ b/drivers/video/pmag-ba-fb.c
@@ -30,7 +30,6 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/types.h> 31#include <linux/types.h>
32 32
33#include <asm/bug.h>
34#include <asm/io.h> 33#include <asm/io.h>
35#include <asm/system.h> 34#include <asm/system.h>
36 35
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c
index 25148de5fe67..eeeac924b500 100644
--- a/drivers/video/pmagb-b-fb.c
+++ b/drivers/video/pmagb-b-fb.c
@@ -27,7 +27,6 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30#include <asm/bug.h>
31#include <asm/io.h> 30#include <asm/io.h>
32#include <asm/system.h> 31#include <asm/system.h>
33 32
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5dd0207ffd46..057e60217fc5 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -931,8 +931,8 @@ struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
932{ 932{
933 int err, i; 933 int err, i;
934 sg_req_info_t *r; 934 sg_req_info_t __user *r;
935 struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; 935 struct compat_sg_req_info __user *o = (void __user *)arg;
936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); 936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);
937 err = sys_ioctl(fd,cmd,(unsigned long)r); 937 err = sys_ioctl(fd,cmd,(unsigned long)r);
938 if (err < 0) 938 if (err < 0)
@@ -2739,8 +2739,8 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
2739static int 2739static int
2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
2741{ 2741{
2742 struct compat_timeval *tc = (struct compat_timeval *)arg; 2742 struct compat_timeval __user *tc = (struct compat_timeval __user *)arg;
2743 struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval)); 2743 struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval));
2744 struct timeval ts; 2744 struct timeval ts;
2745 if (get_user(ts.tv_sec, &tc->tv_sec) || 2745 if (get_user(ts.tv_sec, &tc->tv_sec) ||
2746 get_user(ts.tv_usec, &tc->tv_usec) || 2746 get_user(ts.tv_usec, &tc->tv_usec) ||
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index efc97d9b7860..d575452cd9f7 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -56,7 +56,7 @@ static u64 debugfs_u8_get(void *data)
56DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); 56DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");
57 57
58/** 58/**
59 * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 59 * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value.
60 * 60 *
61 * @name: a pointer to a string containing the name of the file to create. 61 * @name: a pointer to a string containing the name of the file to create.
62 * @mode: the permission that the file should have 62 * @mode: the permission that the file should have
@@ -98,7 +98,7 @@ static u64 debugfs_u16_get(void *data)
98DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); 98DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");
99 99
100/** 100/**
101 * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 101 * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value.
102 * 102 *
103 * @name: a pointer to a string containing the name of the file to create. 103 * @name: a pointer to a string containing the name of the file to create.
104 * @mode: the permission that the file should have 104 * @mode: the permission that the file should have
@@ -140,7 +140,7 @@ static u64 debugfs_u32_get(void *data)
140DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); 140DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");
141 141
142/** 142/**
143 * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 143 * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value.
144 * 144 *
145 * @name: a pointer to a string containing the name of the file to create. 145 * @name: a pointer to a string containing the name of the file to create.
146 * @mode: the permission that the file should have 146 * @mode: the permission that the file should have
diff --git a/fs/inotify.c b/fs/inotify.c
index 878ccca61213..3041503bde02 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -967,7 +967,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
967 mask_add = 1; 967 mask_add = 1;
968 968
969 /* don't let user-space set invalid bits: we don't want flags set */ 969 /* don't let user-space set invalid bits: we don't want flags set */
970 mask &= IN_ALL_EVENTS; 970 mask &= IN_ALL_EVENTS | IN_ONESHOT;
971 if (unlikely(!mask)) { 971 if (unlikely(!mask)) {
972 ret = -EINVAL; 972 ret = -EINVAL;
973 goto out; 973 goto out;
diff --git a/fs/namei.c b/fs/namei.c
index faf61c35308c..e28de846c591 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name,
1119 current->total_link_count = 0; 1119 current->total_link_count = 0;
1120 retval = link_path_walk(name, nd); 1120 retval = link_path_walk(name, nd);
1121out: 1121out:
1122 if (unlikely(current->audit_context 1122 if (likely(retval == 0)) {
1123 && nd && nd->dentry && nd->dentry->d_inode)) 1123 if (unlikely(current->audit_context && nd && nd->dentry &&
1124 nd->dentry->d_inode))
1124 audit_inode(name, nd->dentry->d_inode, flags); 1125 audit_inode(name, nd->dentry->d_inode, flags);
1126 }
1125 return retval; 1127 return retval;
1126 1128
1127fput_unlock_fail: 1129fput_unlock_fail:
diff --git a/fs/namespace.c b/fs/namespace.c
index ce97becff461..058a44865beb 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -494,7 +494,7 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
494 p->mnt_namespace = NULL; 494 p->mnt_namespace = NULL;
495 list_del_init(&p->mnt_child); 495 list_del_init(&p->mnt_child);
496 if (p->mnt_parent != p) 496 if (p->mnt_parent != p)
497 mnt->mnt_mountpoint->d_mounted--; 497 p->mnt_mountpoint->d_mounted--;
498 change_mnt_propagation(p, MS_PRIVATE); 498 change_mnt_propagation(p, MS_PRIVATE);
499 } 499 }
500} 500}
@@ -1325,27 +1325,17 @@ dput_out:
1325 return retval; 1325 return retval;
1326} 1326}
1327 1327
1328int copy_namespace(int flags, struct task_struct *tsk) 1328/*
1329 * Allocate a new namespace structure and populate it with contents
1330 * copied from the namespace of the passed in task structure.
1331 */
1332struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1329{ 1333{
1330 struct namespace *namespace = tsk->namespace; 1334 struct namespace *namespace = tsk->namespace;
1331 struct namespace *new_ns; 1335 struct namespace *new_ns;
1332 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; 1336 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;
1333 struct fs_struct *fs = tsk->fs;
1334 struct vfsmount *p, *q; 1337 struct vfsmount *p, *q;
1335 1338
1336 if (!namespace)
1337 return 0;
1338
1339 get_namespace(namespace);
1340
1341 if (!(flags & CLONE_NEWNS))
1342 return 0;
1343
1344 if (!capable(CAP_SYS_ADMIN)) {
1345 put_namespace(namespace);
1346 return -EPERM;
1347 }
1348
1349 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); 1339 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL);
1350 if (!new_ns) 1340 if (!new_ns)
1351 goto out; 1341 goto out;
@@ -1396,8 +1386,6 @@ int copy_namespace(int flags, struct task_struct *tsk)
1396 } 1386 }
1397 up_write(&namespace_sem); 1387 up_write(&namespace_sem);
1398 1388
1399 tsk->namespace = new_ns;
1400
1401 if (rootmnt) 1389 if (rootmnt)
1402 mntput(rootmnt); 1390 mntput(rootmnt);
1403 if (pwdmnt) 1391 if (pwdmnt)
@@ -1405,12 +1393,40 @@ int copy_namespace(int flags, struct task_struct *tsk)
1405 if (altrootmnt) 1393 if (altrootmnt)
1406 mntput(altrootmnt); 1394 mntput(altrootmnt);
1407 1395
1408 put_namespace(namespace); 1396out:
1409 return 0; 1397 return new_ns;
1398}
1399
1400int copy_namespace(int flags, struct task_struct *tsk)
1401{
1402 struct namespace *namespace = tsk->namespace;
1403 struct namespace *new_ns;
1404 int err = 0;
1405
1406 if (!namespace)
1407 return 0;
1408
1409 get_namespace(namespace);
1410
1411 if (!(flags & CLONE_NEWNS))
1412 return 0;
1413
1414 if (!capable(CAP_SYS_ADMIN)) {
1415 err = -EPERM;
1416 goto out;
1417 }
1418
1419 new_ns = dup_namespace(tsk, tsk->fs);
1420 if (!new_ns) {
1421 err = -ENOMEM;
1422 goto out;
1423 }
1424
1425 tsk->namespace = new_ns;
1410 1426
1411out: 1427out:
1412 put_namespace(namespace); 1428 put_namespace(namespace);
1413 return -ENOMEM; 1429 return err;
1414} 1430}
1415 1431
1416asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, 1432asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name,
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index e897e00c2c9d..c0a754ecdee6 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -465,10 +465,11 @@ static int __init root_nfs_ports(void)
465 "number from server, using default\n"); 465 "number from server, using default\n");
466 port = nfsd_port; 466 port = nfsd_port;
467 } 467 }
468 nfs_port = htons(port); 468 nfs_port = port;
469 dprintk("Root-NFS: Portmapper on server returned %d " 469 dprintk("Root-NFS: Portmapper on server returned %d "
470 "as nfsd port\n", port); 470 "as nfsd port\n", port);
471 } 471 }
472 nfs_port = htons(nfs_port);
472 473
473 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { 474 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) {
474 printk(KERN_ERR "Root-NFS: Unable to get mountd port " 475 printk(KERN_ERR "Root-NFS: Unable to get mountd port "
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index a00fe8686293..6d63f1d9e5f5 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -195,10 +195,12 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
195 195
196 /* Openowner is now set, so sequence id will get bumped. Now we need 196 /* Openowner is now set, so sequence id will get bumped. Now we need
197 * these checks before we do any creates: */ 197 * these checks before we do any creates: */
198 status = nfserr_grace;
198 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) 199 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
199 return nfserr_grace; 200 goto out;
201 status = nfserr_no_grace;
200 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) 202 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
201 return nfserr_no_grace; 203 goto out;
202 204
203 switch (open->op_claim_type) { 205 switch (open->op_claim_type) {
204 case NFS4_OPEN_CLAIM_DELEGATE_CUR: 206 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
diff --git a/fs/reiserfs/hashes.c b/fs/reiserfs/hashes.c
index a3ec238fd9e0..e664ac16fad9 100644
--- a/fs/reiserfs/hashes.c
+++ b/fs/reiserfs/hashes.c
@@ -21,7 +21,6 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/reiserfs_fs.h> 22#include <linux/reiserfs_fs.h>
23#include <asm/types.h> 23#include <asm/types.h>
24#include <asm/bug.h>
25 24
26#define DELTA 0x9E3779B9 25#define DELTA 0x9E3779B9
27#define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */ 26#define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
diff --git a/fs/select.c b/fs/select.c
index c0f02d36c60e..bc60a3e14ef3 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -510,9 +510,9 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
510 510
511 if (sig) { 511 if (sig) {
512 if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t)) 512 if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t))
513 || __get_user(up, (sigset_t * __user *)sig) 513 || __get_user(up, (sigset_t __user * __user *)sig)
514 || __get_user(sigsetsize, 514 || __get_user(sigsetsize,
515 (size_t * __user)(sig+sizeof(void *)))) 515 (size_t __user *)(sig+sizeof(void *))))
516 return -EFAULT; 516 return -EFAULT;
517 } 517 }
518 518
diff --git a/fs/super.c b/fs/super.c
index c177b92419c5..30294218fa63 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -247,8 +247,9 @@ void generic_shutdown_super(struct super_block *sb)
247 247
248 /* Forget any remaining inodes */ 248 /* Forget any remaining inodes */
249 if (invalidate_inodes(sb)) { 249 if (invalidate_inodes(sb)) {
250 printk("VFS: Busy inodes after unmount. " 250 printk("VFS: Busy inodes after unmount of %s. "
251 "Self-destruct in 5 seconds. Have a nice day...\n"); 251 "Self-destruct in 5 seconds. Have a nice day...\n",
252 sb->s_id);
252 } 253 }
253 254
254 unlock_kernel(); 255 unlock_kernel();
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 9892268e3005..8f2beec526cf 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -747,10 +747,11 @@ xfs_convert_page(
747 struct backing_dev_info *bdi; 747 struct backing_dev_info *bdi;
748 748
749 bdi = inode->i_mapping->backing_dev_info; 749 bdi = inode->i_mapping->backing_dev_info;
750 wbc->nr_to_write--;
750 if (bdi_write_congested(bdi)) { 751 if (bdi_write_congested(bdi)) {
751 wbc->encountered_congestion = 1; 752 wbc->encountered_congestion = 1;
752 done = 1; 753 done = 1;
753 } else if (--wbc->nr_to_write <= 0) { 754 } else if (wbc->nr_to_write <= 0) {
754 done = 1; 755 done = 1;
755 } 756 }
756 } 757 }
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index eda7919b70a1..d7f6f2d8ac8e 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -673,6 +673,8 @@ linvfs_setattr(
673 if (ia_valid & ATTR_ATIME) { 673 if (ia_valid & ATTR_ATIME) {
674 vattr.va_mask |= XFS_AT_ATIME; 674 vattr.va_mask |= XFS_AT_ATIME;
675 vattr.va_atime = attr->ia_atime; 675 vattr.va_atime = attr->ia_atime;
676 if (ia_valid & ATTR_ATIME_SET)
677 inode->i_atime = attr->ia_atime;
676 } 678 }
677 if (ia_valid & ATTR_MTIME) { 679 if (ia_valid & ATTR_MTIME) {
678 vattr.va_mask |= XFS_AT_MTIME; 680 vattr.va_mask |= XFS_AT_MTIME;
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index cc9c7e8cced5..f3b7b1a59c56 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -572,7 +572,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
572 if something tries to do an invalid cmpxchg(). */ 572 if something tries to do an invalid cmpxchg(). */
573extern void __cmpxchg_called_with_bad_pointer(void); 573extern void __cmpxchg_called_with_bad_pointer(void);
574 574
575static inline unsigned long 575static __always_inline unsigned long
576__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 576__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
577{ 577{
578 switch (size) { 578 switch (size) {
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
index f5bcc9a1aed6..b726acfcab14 100644
--- a/include/asm-arm/arch-omap/io.h
+++ b/include/asm-arm/arch-omap/io.h
@@ -116,7 +116,11 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
116 ->offset[((vaddr)&4095)>>2] 116 ->offset[((vaddr)&4095)>>2]
117#define __REG32(paddr) __REGV32(io_p2v(paddr)) 117#define __REG32(paddr) __REGV32(io_p2v(paddr))
118 118
119extern void omap_map_common_io(void); 119extern void omap1_map_common_io(void);
120extern void omap1_init_common_hw(void);
121
122extern void omap2_map_common_io(void);
123extern void omap2_init_common_hw(void);
120 124
121#else 125#else
122 126
diff --git a/include/asm-arm/mutex.h b/include/asm-arm/mutex.h
index 6caa59f1f595..cb29d84e690d 100644
--- a/include/asm-arm/mutex.h
+++ b/include/asm-arm/mutex.h
@@ -23,72 +23,71 @@
23 * simply bail out immediately through the slow path where the lock will be 23 * simply bail out immediately through the slow path where the lock will be
24 * reattempted until it succeeds. 24 * reattempted until it succeeds.
25 */ 25 */
26#define __mutex_fastpath_lock(count, fail_fn) \ 26static inline void
27do { \ 27__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
28 int __ex_flag, __res; \ 28{
29 \ 29 int __ex_flag, __res;
30 typecheck(atomic_t *, count); \ 30
31 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 31 __asm__ (
32 \ 32
33 __asm__ ( \ 33 "ldrex %0, [%2] \n\t"
34 "ldrex %0, [%2] \n" \ 34 "sub %0, %0, #1 \n\t"
35 "sub %0, %0, #1 \n" \ 35 "strex %1, %0, [%2] "
36 "strex %1, %0, [%2] \n" \ 36
37 \ 37 : "=&r" (__res), "=&r" (__ex_flag)
38 : "=&r" (__res), "=&r" (__ex_flag) \ 38 : "r" (&(count)->counter)
39 : "r" (&(count)->counter) \ 39 : "cc","memory" );
40 : "cc","memory" ); \ 40
41 \ 41 __res |= __ex_flag;
42 if (unlikely(__res || __ex_flag)) \ 42 if (unlikely(__res != 0))
43 fail_fn(count); \ 43 fail_fn(count);
44} while (0) 44}
45 45
46#define __mutex_fastpath_lock_retval(count, fail_fn) \ 46static inline int
47({ \ 47__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
48 int __ex_flag, __res; \ 48{
49 \ 49 int __ex_flag, __res;
50 typecheck(atomic_t *, count); \ 50
51 typecheck_fn(fastcall int (*)(atomic_t *), fail_fn); \ 51 __asm__ (
52 \ 52
53 __asm__ ( \ 53 "ldrex %0, [%2] \n\t"
54 "ldrex %0, [%2] \n" \ 54 "sub %0, %0, #1 \n\t"
55 "sub %0, %0, #1 \n" \ 55 "strex %1, %0, [%2] "
56 "strex %1, %0, [%2] \n" \ 56
57 \ 57 : "=&r" (__res), "=&r" (__ex_flag)
58 : "=&r" (__res), "=&r" (__ex_flag) \ 58 : "r" (&(count)->counter)
59 : "r" (&(count)->counter) \ 59 : "cc","memory" );
60 : "cc","memory" ); \ 60
61 \ 61 __res |= __ex_flag;
62 __res |= __ex_flag; \ 62 if (unlikely(__res != 0))
63 if (unlikely(__res != 0)) \ 63 __res = fail_fn(count);
64 __res = fail_fn(count); \ 64 return __res;
65 __res; \ 65}
66})
67 66
68/* 67/*
69 * Same trick is used for the unlock fast path. However the original value, 68 * Same trick is used for the unlock fast path. However the original value,
70 * rather than the result, is used to test for success in order to have 69 * rather than the result, is used to test for success in order to have
71 * better generated assembly. 70 * better generated assembly.
72 */ 71 */
73#define __mutex_fastpath_unlock(count, fail_fn) \ 72static inline void
74do { \ 73__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
75 int __ex_flag, __res, __orig; \ 74{
76 \ 75 int __ex_flag, __res, __orig;
77 typecheck(atomic_t *, count); \ 76
78 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 77 __asm__ (
79 \ 78
80 __asm__ ( \ 79 "ldrex %0, [%3] \n\t"
81 "ldrex %0, [%3] \n" \ 80 "add %1, %0, #1 \n\t"
82 "add %1, %0, #1 \n" \ 81 "strex %2, %1, [%3] "
83 "strex %2, %1, [%3] \n" \ 82
84 \ 83 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
85 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) \ 84 : "r" (&(count)->counter)
86 : "r" (&(count)->counter) \ 85 : "cc","memory" );
87 : "cc","memory" ); \ 86
88 \ 87 __orig |= __ex_flag;
89 if (unlikely(__orig || __ex_flag)) \ 88 if (unlikely(__orig != 0))
90 fail_fn(count); \ 89 fail_fn(count);
91} while (0) 90}
92 91
93/* 92/*
94 * If the unlock was done on a contended lock, or if the unlock simply fails 93 * If the unlock was done on a contended lock, or if the unlock simply fails
@@ -110,12 +109,12 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
110 109
111 __asm__ ( 110 __asm__ (
112 111
113 "1: ldrex %0, [%3] \n" 112 "1: ldrex %0, [%3] \n\t"
114 "subs %1, %0, #1 \n" 113 "subs %1, %0, #1 \n\t"
115 "strexeq %2, %1, [%3] \n" 114 "strexeq %2, %1, [%3] \n\t"
116 "movlt %0, #0 \n" 115 "movlt %0, #0 \n\t"
117 "cmpeq %2, #0 \n" 116 "cmpeq %2, #0 \n\t"
118 "bgt 1b \n" 117 "bgt 1b "
119 118
120 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) 119 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
121 : "r" (&count->counter) 120 : "r" (&count->counter)
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 597496ed2aee..cf6f2cd9c514 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -315,8 +315,9 @@
315#define __NR_faccessat 307 315#define __NR_faccessat 307
316#define __NR_pselect6 308 316#define __NR_pselect6 308
317#define __NR_ppoll 309 317#define __NR_ppoll 309
318#define __NR_unshare 310
318 319
319#define NR_syscalls 310 320#define NR_syscalls 311
320 321
321/* 322/*
322 * user-visible error numbers are in the range -1 - -128: see 323 * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 09b99029ac1a..23c8e1be1911 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -559,6 +559,23 @@ ia64_eoi (void)
559 559
560#define cpu_relax() ia64_hint(ia64_hint_pause) 560#define cpu_relax() ia64_hint(ia64_hint_pause)
561 561
562static inline int
563ia64_get_irr(unsigned int vector)
564{
565 unsigned int reg = vector / 64;
566 unsigned int bit = vector % 64;
567 u64 irr;
568
569 switch (reg) {
570 case 0: irr = ia64_getreg(_IA64_REG_CR_IRR0); break;
571 case 1: irr = ia64_getreg(_IA64_REG_CR_IRR1); break;
572 case 2: irr = ia64_getreg(_IA64_REG_CR_IRR2); break;
573 case 3: irr = ia64_getreg(_IA64_REG_CR_IRR3); break;
574 }
575
576 return test_bit(bit, &irr);
577}
578
562static inline void 579static inline void
563ia64_set_lrr0 (unsigned long val) 580ia64_set_lrr0 (unsigned long val)
564{ 581{
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index 313cad0628d0..0b210abbe003 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -658,15 +658,7 @@ ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
658 return isrv.status; 658 return isrv.status;
659} 659}
660 660
661/* Flush all the processor and platform level instruction and/or data caches */ 661extern s64 ia64_sal_cache_flush (u64 cache_type);
662static inline s64
663ia64_sal_cache_flush (u64 cache_type)
664{
665 struct ia64_sal_retval isrv;
666 SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0);
667 return isrv.status;
668}
669
670 662
671/* Initialize all the processor and platform level instruction and data caches */ 663/* Initialize all the processor and platform level instruction and data caches */
672static inline s64 664static inline s64
diff --git a/include/asm-ia64/sn/bte.h b/include/asm-ia64/sn/bte.h
index f50da3d91d07..01e5b4103235 100644
--- a/include/asm-ia64/sn/bte.h
+++ b/include/asm-ia64/sn/bte.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -100,13 +100,28 @@
100#define BTE_LNSTAT_STORE(_bte, _x) \ 100#define BTE_LNSTAT_STORE(_bte, _x) \
101 HUB_S(_bte->bte_base_addr, (_x)) 101 HUB_S(_bte->bte_base_addr, (_x))
102#define BTE_SRC_STORE(_bte, _x) \ 102#define BTE_SRC_STORE(_bte, _x) \
103 HUB_S(_bte->bte_source_addr, (_x)) 103({ \
104 u64 __addr = ((_x) & ~AS_MASK); \
105 if (is_shub2()) \
106 __addr = SH2_TIO_PHYS_TO_DMA(__addr); \
107 HUB_S(_bte->bte_source_addr, __addr); \
108})
104#define BTE_DEST_STORE(_bte, _x) \ 109#define BTE_DEST_STORE(_bte, _x) \
105 HUB_S(_bte->bte_destination_addr, (_x)) 110({ \
111 u64 __addr = ((_x) & ~AS_MASK); \
112 if (is_shub2()) \
113 __addr = SH2_TIO_PHYS_TO_DMA(__addr); \
114 HUB_S(_bte->bte_destination_addr, __addr); \
115})
106#define BTE_CTRL_STORE(_bte, _x) \ 116#define BTE_CTRL_STORE(_bte, _x) \
107 HUB_S(_bte->bte_control_addr, (_x)) 117 HUB_S(_bte->bte_control_addr, (_x))
108#define BTE_NOTIF_STORE(_bte, _x) \ 118#define BTE_NOTIF_STORE(_bte, _x) \
109 HUB_S(_bte->bte_notify_addr, (_x)) 119({ \
120 u64 __addr = ia64_tpa((_x) & ~AS_MASK); \
121 if (is_shub2()) \
122 __addr = SH2_TIO_PHYS_TO_DMA(__addr); \
123 HUB_S(_bte->bte_notify_addr, __addr); \
124})
110 125
111#define BTE_START_TRANSFER(_bte, _len, _mode) \ 126#define BTE_START_TRANSFER(_bte, _len, _mode) \
112 is_shub2() ? BTE_CTRL_STORE(_bte, IBLS_BUSY | (_mode << 24) | _len) \ 127 is_shub2() ? BTE_CTRL_STORE(_bte, IBLS_BUSY | (_mode << 24) | _len) \
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
index a3431372c6e7..60a51a406eec 100644
--- a/include/asm-ia64/sn/intr.h
+++ b/include/asm-ia64/sn/intr.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2006 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#ifndef _ASM_IA64_SN_INTR_H 9#ifndef _ASM_IA64_SN_INTR_H
@@ -11,26 +11,26 @@
11 11
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13 13
14#define SGI_UART_VECTOR (0xe9) 14#define SGI_UART_VECTOR 0xe9
15 15
16/* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */ 16/* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */
17#define SGI_XPC_ACTIVATE (0x30) 17#define SGI_XPC_ACTIVATE 0x30
18#define SGI_II_ERROR (0x31) 18#define SGI_II_ERROR 0x31
19#define SGI_XBOW_ERROR (0x32) 19#define SGI_XBOW_ERROR 0x32
20#define SGI_PCIASIC_ERROR (0x33) 20#define SGI_PCIASIC_ERROR 0x33
21#define SGI_ACPI_SCI_INT (0x34) 21#define SGI_ACPI_SCI_INT 0x34
22#define SGI_TIOCA_ERROR (0x35) 22#define SGI_TIOCA_ERROR 0x35
23#define SGI_TIO_ERROR (0x36) 23#define SGI_TIO_ERROR 0x36
24#define SGI_TIOCX_ERROR (0x37) 24#define SGI_TIOCX_ERROR 0x37
25#define SGI_MMTIMER_VECTOR (0x38) 25#define SGI_MMTIMER_VECTOR 0x38
26#define SGI_XPC_NOTIFY (0xe7) 26#define SGI_XPC_NOTIFY 0xe7
27 27
28#define IA64_SN2_FIRST_DEVICE_VECTOR (0x3c) 28#define IA64_SN2_FIRST_DEVICE_VECTOR 0x3c
29#define IA64_SN2_LAST_DEVICE_VECTOR (0xe6) 29#define IA64_SN2_LAST_DEVICE_VECTOR 0xe6
30 30
31#define SN2_IRQ_RESERVED (0x1) 31#define SN2_IRQ_RESERVED 0x1
32#define SN2_IRQ_CONNECTED (0x2) 32#define SN2_IRQ_CONNECTED 0x2
33#define SN2_IRQ_SHARED (0x4) 33#define SN2_IRQ_SHARED 0x4
34 34
35// The SN PROM irq struct 35// The SN PROM irq struct
36struct sn_irq_info { 36struct sn_irq_info {
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 80c5a234e259..062538715623 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -249,32 +249,7 @@ extern void ia64_load_extra (struct task_struct *task);
249# define switch_to(prev,next,last) __switch_to(prev, next, last) 249# define switch_to(prev,next,last) __switch_to(prev, next, last)
250#endif 250#endif
251 251
252/*
253 * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
254 * because that could cause a deadlock. Here is an example by Erich Focht:
255 *
256 * Example:
257 * CPU#0:
258 * schedule()
259 * -> spin_lock_irq(&rq->lock)
260 * -> context_switch()
261 * -> wrap_mmu_context()
262 * -> read_lock(&tasklist_lock)
263 *
264 * CPU#1:
265 * sys_wait4() or release_task() or forget_original_parent()
266 * -> write_lock(&tasklist_lock)
267 * -> do_notify_parent()
268 * -> wake_up_parent()
269 * -> try_to_wake_up()
270 * -> spin_lock_irq(&parent_rq->lock)
271 *
272 * If the parent's rq happens to be on CPU#0, we'll wait for the rq->lock
273 * of that CPU which will not be released, because there we wait for the
274 * tasklist_lock to become available.
275 */
276#define __ARCH_WANT_UNLOCKED_CTXSW 252#define __ARCH_WANT_UNLOCKED_CTXSW
277
278#define ARCH_HAS_PREFETCH_SWITCH_STACK 253#define ARCH_HAS_PREFETCH_SWITCH_STACK
279#define ia64_platform_is(x) (strcmp(x, platform_name) == 0) 254#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
280 255
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 962f9bd1bdff..019956c613e4 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -270,12 +270,27 @@
270#define __NR_inotify_add_watch 1278 270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279 271#define __NR_inotify_rm_watch 1279
272#define __NR_migrate_pages 1280 272#define __NR_migrate_pages 1280
273#define __NR_openat 1281
274#define __NR_mkdirat 1282
275#define __NR_mknodat 1283
276#define __NR_fchownat 1284
277#define __NR_futimesat 1285
278#define __NR_newfstatat 1286
279#define __NR_unlinkat 1287
280#define __NR_renameat 1288
281#define __NR_linkat 1289
282#define __NR_symlinkat 1290
283#define __NR_readlinkat 1291
284#define __NR_fchmodat 1292
285#define __NR_faccessat 1293
286/* 1294, 1295 reserved for pselect/ppoll */
287#define __NR_unshare 1296
273 288
274#ifdef __KERNEL__ 289#ifdef __KERNEL__
275 290
276#include <linux/config.h> 291#include <linux/config.h>
277 292
278#define NR_syscalls 270 /* length of syscall table */ 293#define NR_syscalls 273 /* length of syscall table */
279 294
280#define __ARCH_WANT_SYS_RT_SIGACTION 295#define __ARCH_WANT_SYS_RT_SIGACTION
281 296
diff --git a/include/asm-m68knommu/hardirq.h b/include/asm-m68knommu/hardirq.h
index e8659e739a64..476180f4cba2 100644
--- a/include/asm-m68knommu/hardirq.h
+++ b/include/asm-m68knommu/hardirq.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/cache.h> 5#include <linux/cache.h>
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <asm/irq.h>
7 8
8typedef struct { 9typedef struct {
9 unsigned int __softirq_pending; 10 unsigned int __softirq_pending;
diff --git a/include/asm-mips/abi.h b/include/asm-mips/abi.h
index 2e7e651c3e3f..1ce0518ace2e 100644
--- a/include/asm-mips/abi.h
+++ b/include/asm-mips/abi.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2005 by Ralf Baechle 6 * Copyright (C) 2005, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2005 MIPS Technologies, Inc. 7 * Copyright (C) 2005 MIPS Technologies, Inc.
8 */ 8 */
9#ifndef _ASM_ABI_H 9#ifndef _ASM_ABI_H
@@ -13,7 +13,7 @@
13#include <asm/siginfo.h> 13#include <asm/siginfo.h>
14 14
15struct mips_abi { 15struct mips_abi {
16 int (* const do_signal)(sigset_t *oldset, struct pt_regs *regs); 16 void (* const do_signal)(struct pt_regs *regs);
17 int (* const setup_frame)(struct k_sigaction * ka, 17 int (* const setup_frame)(struct k_sigaction * ka,
18 struct pt_regs *regs, int signr, 18 struct pt_regs *regs, int signr,
19 sigset_t *set); 19 sigset_t *set);
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 3b0c8aaf6e8b..8e802059fe67 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -644,20 +644,26 @@ static inline unsigned long ffz(unsigned long word)
644} 644}
645 645
646/* 646/*
647 * flz - find last zero in word. 647 * fls - find last bit set.
648 * @word: The word to search 648 * @word: The word to search
649 * 649 *
650 * Returns 0..SZLONG-1 650 * Returns 1..SZLONG
651 * Undefined if no zero exists, so code should check against ~0UL first. 651 * Returns 0 if no bit exists
652 */ 652 */
653static inline unsigned long flz(unsigned long word) 653static inline unsigned long fls(unsigned long word)
654{ 654{
655#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
656 return __ilog2(~word);
657#else
658#ifdef CONFIG_32BIT 655#ifdef CONFIG_32BIT
659 int r = 31, s; 656#ifdef CONFIG_CPU_MIPS32
660 word = ~word; 657 __asm__ ("clz %0, %1" : "=r" (word) : "r" (word));
658
659 return 32 - word;
660#else
661 {
662 int r = 32, s;
663
664 if (word == 0)
665 return 0;
666
661 s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s; 667 s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s;
662 s = 8; if ((word & 0xff000000)) s = 0; r -= s; word <<= s; 668 s = 8; if ((word & 0xff000000)) s = 0; r -= s; word <<= s;
663 s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s; 669 s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s;
@@ -665,10 +671,23 @@ static inline unsigned long flz(unsigned long word)
665 s = 1; if ((word & 0x80000000)) s = 0; r -= s; 671 s = 1; if ((word & 0x80000000)) s = 0; r -= s;
666 672
667 return r; 673 return r;
674 }
668#endif 675#endif
676#endif /* CONFIG_32BIT */
677
669#ifdef CONFIG_64BIT 678#ifdef CONFIG_64BIT
670 int r = 63, s; 679#ifdef CONFIG_CPU_MIPS64
671 word = ~word; 680
681 __asm__ ("dclz %0, %1" : "=r" (word) : "r" (word));
682
683 return 64 - word;
684#else
685 {
686 int r = 64, s;
687
688 if (word == 0)
689 return 0;
690
672 s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s; 691 s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s;
673 s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s; 692 s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s;
674 s = 8; if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s; 693 s = 8; if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s;
@@ -677,24 +696,11 @@ static inline unsigned long flz(unsigned long word)
677 s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s; 696 s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s;
678 697
679 return r; 698 return r;
699 }
680#endif 700#endif
681#endif 701#endif /* CONFIG_64BIT */
682} 702}
683 703
684/*
685 * fls - find last bit set.
686 * @word: The word to search
687 *
688 * Returns 1..SZLONG
689 * Returns 0 if no bit exists
690 */
691static inline unsigned long fls(unsigned long word)
692{
693 if (word == 0)
694 return 0;
695
696 return flz(~word) + 1;
697}
698#define fls64(x) generic_fls64(x) 704#define fls64(x) generic_fls64(x)
699 705
700/* 706/*
diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h
index d1fe9e5c62e4..584f8128fffd 100644
--- a/include/asm-mips/byteorder.h
+++ b/include/asm-mips/byteorder.h
@@ -8,10 +8,39 @@
8#ifndef _ASM_BYTEORDER_H 8#ifndef _ASM_BYTEORDER_H
9#define _ASM_BYTEORDER_H 9#define _ASM_BYTEORDER_H
10 10
11#include <linux/config.h>
12#include <linux/compiler.h>
11#include <asm/types.h> 13#include <asm/types.h>
12 14
13#ifdef __GNUC__ 15#ifdef __GNUC__
14 16
17#ifdef CONFIG_CPU_MIPSR2
18
19static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
20{
21 __asm__(
22 " wsbh %0, %1 \n"
23 : "=r" (x)
24 : "r" (x));
25
26 return x;
27}
28#define __arch__swab16(x) ___arch__swab16(x)
29
30static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
31{
32 __asm__(
33 " wsbh %0, %1 \n"
34 " rotr %0, %0, 16 \n"
35 : "=r" (x)
36 : "r" (x));
37
38 return x;
39}
40#define __arch__swab32(x) ___arch__swab32(x)
41
42#endif /* CONFIG_CPU_MIPSR2 */
43
15#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 44#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
16# define __BYTEORDER_HAS_U64__ 45# define __BYTEORDER_HAS_U64__
17# define __SWAB_64_THRU_32__ 46# define __SWAB_64_THRU_32__
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index a18ba2edc0b6..aeae9fabf4a9 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -49,8 +49,7 @@ static inline void flush_dcache_page(struct page *page)
49 49
50extern void (*flush_icache_page)(struct vm_area_struct *vma, 50extern void (*flush_icache_page)(struct vm_area_struct *vma,
51 struct page *page); 51 struct page *page);
52extern void (*flush_icache_range)(unsigned long __user start, 52extern void (*flush_icache_range)(unsigned long start, unsigned long end);
53 unsigned long __user end);
54#define flush_cache_vmap(start, end) flush_cache_all() 53#define flush_cache_vmap(start, end) flush_cache_all()
55#define flush_cache_vunmap(start, end) flush_cache_all() 54#define flush_cache_vunmap(start, end) flush_cache_all()
56 55
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 2fc90632f88c..6111a0ce58c4 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -100,7 +100,7 @@
100 100
101__asm__( 101__asm__(
102 " .macro _ssnop \n\t" 102 " .macro _ssnop \n\t"
103 " sll $0, $2, 1 \n\t" 103 " sll $0, $0, 1 \n\t"
104 " .endm \n\t" 104 " .endm \n\t"
105 " \n\t" 105 " \n\t"
106 " .macro _ehb \n\t" 106 " .macro _ehb \n\t"
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
index abdf54ee64cf..774348734fa0 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/interrupt.h
@@ -47,6 +47,17 @@ static inline void local_irq_enable(void)
47 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs 47 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
48 * no nops at all. 48 * no nops at all.
49 */ 49 */
50/*
51 * For TX49, operating only IE bit is not enough.
52 *
53 * If mfc0 $12 follows store and the mfc0 is last instruction of a
54 * page and fetching the next instruction causes TLB miss, the result
55 * of the mfc0 might wrongly contain EXL bit.
56 *
57 * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
58 *
59 * Workaround: mask EXL bit of the result or place a nop before mfc0.
60 */
50__asm__ ( 61__asm__ (
51 " .macro local_irq_disable\n" 62 " .macro local_irq_disable\n"
52 " .set push \n" 63 " .set push \n"
@@ -55,8 +66,8 @@ __asm__ (
55 " di \n" 66 " di \n"
56#else 67#else
57 " mfc0 $1,$12 \n" 68 " mfc0 $1,$12 \n"
58 " ori $1,1 \n" 69 " ori $1,0x1f \n"
59 " xori $1,1 \n" 70 " xori $1,0x1f \n"
60 " .set noreorder \n" 71 " .set noreorder \n"
61 " mtc0 $1,$12 \n" 72 " mtc0 $1,$12 \n"
62#endif 73#endif
@@ -96,8 +107,8 @@ __asm__ (
96 " andi \\result, 1 \n" 107 " andi \\result, 1 \n"
97#else 108#else
98 " mfc0 \\result, $12 \n" 109 " mfc0 \\result, $12 \n"
99 " ori $1, \\result, 1 \n" 110 " ori $1, \\result, 0x1f \n"
100 " xori $1, 1 \n" 111 " xori $1, 0x1f \n"
101 " .set noreorder \n" 112 " .set noreorder \n"
102 " mtc0 $1, $12 \n" 113 " mtc0 $1, $12 \n"
103#endif 114#endif
@@ -114,6 +125,7 @@ __asm__ __volatile__( \
114 125
115__asm__ ( 126__asm__ (
116 " .macro local_irq_restore flags \n" 127 " .macro local_irq_restore flags \n"
128 " .set push \n"
117 " .set noreorder \n" 129 " .set noreorder \n"
118 " .set noat \n" 130 " .set noat \n"
119#if defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU) 131#if defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
@@ -135,14 +147,13 @@ __asm__ (
135#else 147#else
136 " mfc0 $1, $12 \n" 148 " mfc0 $1, $12 \n"
137 " andi \\flags, 1 \n" 149 " andi \\flags, 1 \n"
138 " ori $1, 1 \n" 150 " ori $1, 0x1f \n"
139 " xori $1, 1 \n" 151 " xori $1, 0x1f \n"
140 " or \\flags, $1 \n" 152 " or \\flags, $1 \n"
141 " mtc0 \\flags, $12 \n" 153 " mtc0 \\flags, $12 \n"
142#endif 154#endif
143 " irq_disable_hazard \n" 155 " irq_disable_hazard \n"
144 " .set at \n" 156 " .set pop \n"
145 " .set reorder \n"
146 " .endm \n"); 157 " .endm \n");
147 158
148#define local_irq_restore(flags) \ 159#define local_irq_restore(flags) \
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index d42685747e7d..5a4c8a54b8f4 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -18,7 +18,6 @@
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20#include <asm/addrspace.h> 20#include <asm/addrspace.h>
21#include <asm/bug.h>
22#include <asm/byteorder.h> 21#include <asm/byteorder.h>
23#include <asm/cpu.h> 22#include <asm/cpu.h>
24#include <asm/cpu-features.h> 23#include <asm/cpu-features.h>
@@ -57,38 +56,38 @@
57 * variations of functions: non-prefixed ones that preserve the value 56 * variations of functions: non-prefixed ones that preserve the value
58 * and prefixed ones that preserve byte addresses. The latters are 57 * and prefixed ones that preserve byte addresses. The latters are
59 * typically used for moving raw data between a peripheral and memory (cf. 58 * typically used for moving raw data between a peripheral and memory (cf.
60 * string I/O functions), hence the "mem_" prefix. 59 * string I/O functions), hence the "__mem_" prefix.
61 */ 60 */
62#if defined(CONFIG_SWAP_IO_SPACE) 61#if defined(CONFIG_SWAP_IO_SPACE)
63 62
64# define ioswabb(x) (x) 63# define ioswabb(x) (x)
65# define mem_ioswabb(x) (x) 64# define __mem_ioswabb(x) (x)
66# ifdef CONFIG_SGI_IP22 65# ifdef CONFIG_SGI_IP22
67/* 66/*
68 * IP22 seems braindead enough to swap 16bits values in hardware, but 67 * IP22 seems braindead enough to swap 16bits values in hardware, but
69 * not 32bits. Go figure... Can't tell without documentation. 68 * not 32bits. Go figure... Can't tell without documentation.
70 */ 69 */
71# define ioswabw(x) (x) 70# define ioswabw(x) (x)
72# define mem_ioswabw(x) le16_to_cpu(x) 71# define __mem_ioswabw(x) le16_to_cpu(x)
73# else 72# else
74# define ioswabw(x) le16_to_cpu(x) 73# define ioswabw(x) le16_to_cpu(x)
75# define mem_ioswabw(x) (x) 74# define __mem_ioswabw(x) (x)
76# endif 75# endif
77# define ioswabl(x) le32_to_cpu(x) 76# define ioswabl(x) le32_to_cpu(x)
78# define mem_ioswabl(x) (x) 77# define __mem_ioswabl(x) (x)
79# define ioswabq(x) le64_to_cpu(x) 78# define ioswabq(x) le64_to_cpu(x)
80# define mem_ioswabq(x) (x) 79# define __mem_ioswabq(x) (x)
81 80
82#else 81#else
83 82
84# define ioswabb(x) (x) 83# define ioswabb(x) (x)
85# define mem_ioswabb(x) (x) 84# define __mem_ioswabb(x) (x)
86# define ioswabw(x) (x) 85# define ioswabw(x) (x)
87# define mem_ioswabw(x) cpu_to_le16(x) 86# define __mem_ioswabw(x) cpu_to_le16(x)
88# define ioswabl(x) (x) 87# define ioswabl(x) (x)
89# define mem_ioswabl(x) cpu_to_le32(x) 88# define __mem_ioswabl(x) cpu_to_le32(x)
90# define ioswabq(x) (x) 89# define ioswabq(x) (x)
91# define mem_ioswabq(x) cpu_to_le32(x) 90# define __mem_ioswabq(x) cpu_to_le32(x)
92 91
93#endif 92#endif
94 93
@@ -343,7 +342,7 @@ static inline void pfx##write##bwlq(type val, \
343 BUG(); \ 342 BUG(); \
344} \ 343} \
345 \ 344 \
346static inline type pfx##read##bwlq(volatile void __iomem *mem) \ 345static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
347{ \ 346{ \
348 volatile type *__mem; \ 347 volatile type *__mem; \
349 type __val; \ 348 type __val; \
@@ -418,7 +417,7 @@ __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
418 \ 417 \
419__BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 418__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
420__BUILD_MEMORY_PFX(, bwlq, type) \ 419__BUILD_MEMORY_PFX(, bwlq, type) \
421__BUILD_MEMORY_PFX(mem_, bwlq, type) \ 420__BUILD_MEMORY_PFX(__mem_, bwlq, type) \
422 421
423BUILDIO_MEM(b, u8) 422BUILDIO_MEM(b, u8)
424BUILDIO_MEM(w, u16) 423BUILDIO_MEM(w, u16)
@@ -431,7 +430,7 @@ BUILDIO_MEM(q, u64)
431 430
432#define BUILDIO_IOPORT(bwlq, type) \ 431#define BUILDIO_IOPORT(bwlq, type) \
433 __BUILD_IOPORT_PFX(, bwlq, type) \ 432 __BUILD_IOPORT_PFX(, bwlq, type) \
434 __BUILD_IOPORT_PFX(mem_, bwlq, type) 433 __BUILD_IOPORT_PFX(__mem_, bwlq, type)
435 434
436BUILDIO_IOPORT(b, u8) 435BUILDIO_IOPORT(b, u8)
437BUILDIO_IOPORT(w, u16) 436BUILDIO_IOPORT(w, u16)
@@ -465,7 +464,7 @@ static inline void writes##bwlq(volatile void __iomem *mem, \
465 const volatile type *__addr = addr; \ 464 const volatile type *__addr = addr; \
466 \ 465 \
467 while (count--) { \ 466 while (count--) { \
468 mem_write##bwlq(*__addr, mem); \ 467 __mem_write##bwlq(*__addr, mem); \
469 __addr++; \ 468 __addr++; \
470 } \ 469 } \
471} \ 470} \
@@ -476,7 +475,7 @@ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
476 volatile type *__addr = addr; \ 475 volatile type *__addr = addr; \
477 \ 476 \
478 while (count--) { \ 477 while (count--) { \
479 *__addr = mem_read##bwlq(mem); \ 478 *__addr = __mem_read##bwlq(mem); \
480 __addr++; \ 479 __addr++; \
481 } \ 480 } \
482} 481}
@@ -489,7 +488,7 @@ static inline void outs##bwlq(unsigned long port, const void *addr, \
489 const volatile type *__addr = addr; \ 488 const volatile type *__addr = addr; \
490 \ 489 \
491 while (count--) { \ 490 while (count--) { \
492 mem_out##bwlq(*__addr, port); \ 491 __mem_out##bwlq(*__addr, port); \
493 __addr++; \ 492 __addr++; \
494 } \ 493 } \
495} \ 494} \
@@ -500,7 +499,7 @@ static inline void ins##bwlq(unsigned long port, void *addr, \
500 volatile type *__addr = addr; \ 499 volatile type *__addr = addr; \
501 \ 500 \
502 while (count--) { \ 501 while (count--) { \
503 *__addr = mem_in##bwlq(port); \ 502 *__addr = __mem_in##bwlq(port); \
504 __addr++; \ 503 __addr++; \
505 } \ 504 } \
506} 505}
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index 8e1d7ed7d8e3..4686e17c206c 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -1198,7 +1198,11 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1198 1198
1199/* UARTS 0-3 */ 1199/* UARTS 0-3 */
1200#define UART_BASE UART0_ADDR 1200#define UART_BASE UART0_ADDR
1201#ifdef CONFIG_SOC_AU1200
1202#define UART_DEBUG_BASE UART1_ADDR
1203#else
1201#define UART_DEBUG_BASE UART3_ADDR 1204#define UART_DEBUG_BASE UART3_ADDR
1205#endif
1202 1206
1203#define UART_RX 0 /* Receive buffer */ 1207#define UART_RX 0 /* Receive buffer */
1204#define UART_TX 4 /* Transmit buffer */ 1208#define UART_TX 4 /* Transmit buffer */
diff --git a/include/asm-mips/cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
index 78e1df2095fb..78e1df2095fb 100644
--- a/include/asm-mips/cobalt/cobalt.h
+++ b/include/asm-mips/mach-cobalt/cobalt.h
diff --git a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
new file mode 100644
index 000000000000..ace8c5ef9701
--- /dev/null
+++ b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
@@ -0,0 +1,56 @@
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) 2006 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
9#define __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
10
11#include <linux/config.h>
12
13#define cpu_has_tlb 1
14#define cpu_has_4kex 1
15#define cpu_has_3k_cache 0
16#define cpu_has_4k_cache 1
17#define cpu_has_tx39_cache 0
18#define cpu_has_sb1_cache 0
19#define cpu_has_fpu 1
20#define cpu_has_32fpr 1
21#define cpu_has_counter 1
22#define cpu_has_watch 0
23#define cpu_has_divec 1
24#define cpu_has_vce 0
25#define cpu_has_cache_cdex_p 0
26#define cpu_has_cache_cdex_s 0
27#define cpu_has_prefetch 0
28#define cpu_has_mcheck 0
29#define cpu_has_ejtag 0
30
31#define cpu_has_subset_pcaches 0
32#define cpu_dcache_line_size() 32
33#define cpu_icache_line_size() 32
34#define cpu_scache_line_size() 0
35
36#ifdef CONFIG_64BIT
37#define cpu_has_llsc 0
38#else
39#define cpu_has_llsc 1
40#endif
41
42#define cpu_has_mips16 0
43#define cpu_has_mdmx 0
44#define cpu_has_mips3d 0
45#define cpu_has_smartmips 0
46#define cpu_has_vtag_icache 0
47#define cpu_has_ic_fills_f_dc 0
48#define cpu_icache_snoops_remote_store 0
49#define cpu_has_dsp 0
50
51#define cpu_has_mips32r1 0
52#define cpu_has_mips32r2 0
53#define cpu_has_mips64r1 0
54#define cpu_has_mips64r2 0
55
56#endif /* __ASM_COBALT_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/cobalt/mach-gt64120.h b/include/asm-mips/mach-cobalt/mach-gt64120.h
index 587fc4378f44..587fc4378f44 100644
--- a/include/asm-mips/cobalt/mach-gt64120.h
+++ b/include/asm-mips/mach-cobalt/mach-gt64120.h
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index b80c30725cf6..36070b5654ab 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -18,7 +18,7 @@
18 * so, for 64bit IP32 kernel we just don't use ll/sc. 18 * so, for 64bit IP32 kernel we just don't use ll/sc.
19 * This does not affect luserland. 19 * This does not affect luserland.
20 */ 20 */
21#if defined(CONFIG_CPU_R5000) && defined(CONFIG_64BIT) 21#if (defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_NEVADA)) && defined(CONFIG_64BIT)
22#define cpu_has_llsc 0 22#define cpu_has_llsc 0
23#else 23#else
24#define cpu_has_llsc 1 24#define cpu_has_llsc 1
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index a5ea9d828aee..cc53196efa40 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -166,123 +166,6 @@ static inline void invalidate_tcache_page(unsigned long addr)
166 : "r" (base), \ 166 : "r" (base), \
167 "i" (op)); 167 "i" (op));
168 168
169static inline void blast_dcache16(void)
170{
171 unsigned long start = INDEX_BASE;
172 unsigned long end = start + current_cpu_data.dcache.waysize;
173 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
174 unsigned long ws_end = current_cpu_data.dcache.ways <<
175 current_cpu_data.dcache.waybit;
176 unsigned long ws, addr;
177
178 for (ws = 0; ws < ws_end; ws += ws_inc)
179 for (addr = start; addr < end; addr += 0x200)
180 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
181}
182
183static inline void blast_dcache16_page(unsigned long page)
184{
185 unsigned long start = page;
186 unsigned long end = start + PAGE_SIZE;
187
188 do {
189 cache16_unroll32(start,Hit_Writeback_Inv_D);
190 start += 0x200;
191 } while (start < end);
192}
193
194static inline void blast_dcache16_page_indexed(unsigned long page)
195{
196 unsigned long start = page;
197 unsigned long end = start + PAGE_SIZE;
198 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
199 unsigned long ws_end = current_cpu_data.dcache.ways <<
200 current_cpu_data.dcache.waybit;
201 unsigned long ws, addr;
202
203 for (ws = 0; ws < ws_end; ws += ws_inc)
204 for (addr = start; addr < end; addr += 0x200)
205 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
206}
207
208static inline void blast_icache16(void)
209{
210 unsigned long start = INDEX_BASE;
211 unsigned long end = start + current_cpu_data.icache.waysize;
212 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
213 unsigned long ws_end = current_cpu_data.icache.ways <<
214 current_cpu_data.icache.waybit;
215 unsigned long ws, addr;
216
217 for (ws = 0; ws < ws_end; ws += ws_inc)
218 for (addr = start; addr < end; addr += 0x200)
219 cache16_unroll32(addr|ws,Index_Invalidate_I);
220}
221
222static inline void blast_icache16_page(unsigned long page)
223{
224 unsigned long start = page;
225 unsigned long end = start + PAGE_SIZE;
226
227 do {
228 cache16_unroll32(start,Hit_Invalidate_I);
229 start += 0x200;
230 } while (start < end);
231}
232
233static inline void blast_icache16_page_indexed(unsigned long page)
234{
235 unsigned long start = page;
236 unsigned long end = start + PAGE_SIZE;
237 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
238 unsigned long ws_end = current_cpu_data.icache.ways <<
239 current_cpu_data.icache.waybit;
240 unsigned long ws, addr;
241
242 for (ws = 0; ws < ws_end; ws += ws_inc)
243 for (addr = start; addr < end; addr += 0x200)
244 cache16_unroll32(addr|ws,Index_Invalidate_I);
245}
246
247static inline void blast_scache16(void)
248{
249 unsigned long start = INDEX_BASE;
250 unsigned long end = start + current_cpu_data.scache.waysize;
251 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
252 unsigned long ws_end = current_cpu_data.scache.ways <<
253 current_cpu_data.scache.waybit;
254 unsigned long ws, addr;
255
256 for (ws = 0; ws < ws_end; ws += ws_inc)
257 for (addr = start; addr < end; addr += 0x200)
258 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD);
259}
260
261static inline void blast_scache16_page(unsigned long page)
262{
263 unsigned long start = page;
264 unsigned long end = page + PAGE_SIZE;
265
266 do {
267 cache16_unroll32(start,Hit_Writeback_Inv_SD);
268 start += 0x200;
269 } while (start < end);
270}
271
272static inline void blast_scache16_page_indexed(unsigned long page)
273{
274 unsigned long start = page;
275 unsigned long end = start + PAGE_SIZE;
276 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
277 unsigned long ws_end = current_cpu_data.scache.ways <<
278 current_cpu_data.scache.waybit;
279 unsigned long ws, addr;
280
281 for (ws = 0; ws < ws_end; ws += ws_inc)
282 for (addr = start; addr < end; addr += 0x200)
283 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD);
284}
285
286#define cache32_unroll32(base,op) \ 169#define cache32_unroll32(base,op) \
287 __asm__ __volatile__( \ 170 __asm__ __volatile__( \
288 " .set push \n" \ 171 " .set push \n" \
@@ -309,123 +192,6 @@ static inline void blast_scache16_page_indexed(unsigned long page)
309 : "r" (base), \ 192 : "r" (base), \
310 "i" (op)); 193 "i" (op));
311 194
312static inline void blast_dcache32(void)
313{
314 unsigned long start = INDEX_BASE;
315 unsigned long end = start + current_cpu_data.dcache.waysize;
316 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
317 unsigned long ws_end = current_cpu_data.dcache.ways <<
318 current_cpu_data.dcache.waybit;
319 unsigned long ws, addr;
320
321 for (ws = 0; ws < ws_end; ws += ws_inc)
322 for (addr = start; addr < end; addr += 0x400)
323 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
324}
325
326static inline void blast_dcache32_page(unsigned long page)
327{
328 unsigned long start = page;
329 unsigned long end = start + PAGE_SIZE;
330
331 do {
332 cache32_unroll32(start,Hit_Writeback_Inv_D);
333 start += 0x400;
334 } while (start < end);
335}
336
337static inline void blast_dcache32_page_indexed(unsigned long page)
338{
339 unsigned long start = page;
340 unsigned long end = start + PAGE_SIZE;
341 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
342 unsigned long ws_end = current_cpu_data.dcache.ways <<
343 current_cpu_data.dcache.waybit;
344 unsigned long ws, addr;
345
346 for (ws = 0; ws < ws_end; ws += ws_inc)
347 for (addr = start; addr < end; addr += 0x400)
348 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
349}
350
351static inline void blast_icache32(void)
352{
353 unsigned long start = INDEX_BASE;
354 unsigned long end = start + current_cpu_data.icache.waysize;
355 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
356 unsigned long ws_end = current_cpu_data.icache.ways <<
357 current_cpu_data.icache.waybit;
358 unsigned long ws, addr;
359
360 for (ws = 0; ws < ws_end; ws += ws_inc)
361 for (addr = start; addr < end; addr += 0x400)
362 cache32_unroll32(addr|ws,Index_Invalidate_I);
363}
364
365static inline void blast_icache32_page(unsigned long page)
366{
367 unsigned long start = page;
368 unsigned long end = start + PAGE_SIZE;
369
370 do {
371 cache32_unroll32(start,Hit_Invalidate_I);
372 start += 0x400;
373 } while (start < end);
374}
375
376static inline void blast_icache32_page_indexed(unsigned long page)
377{
378 unsigned long start = page;
379 unsigned long end = start + PAGE_SIZE;
380 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
381 unsigned long ws_end = current_cpu_data.icache.ways <<
382 current_cpu_data.icache.waybit;
383 unsigned long ws, addr;
384
385 for (ws = 0; ws < ws_end; ws += ws_inc)
386 for (addr = start; addr < end; addr += 0x400)
387 cache32_unroll32(addr|ws,Index_Invalidate_I);
388}
389
390static inline void blast_scache32(void)
391{
392 unsigned long start = INDEX_BASE;
393 unsigned long end = start + current_cpu_data.scache.waysize;
394 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
395 unsigned long ws_end = current_cpu_data.scache.ways <<
396 current_cpu_data.scache.waybit;
397 unsigned long ws, addr;
398
399 for (ws = 0; ws < ws_end; ws += ws_inc)
400 for (addr = start; addr < end; addr += 0x400)
401 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD);
402}
403
404static inline void blast_scache32_page(unsigned long page)
405{
406 unsigned long start = page;
407 unsigned long end = page + PAGE_SIZE;
408
409 do {
410 cache32_unroll32(start,Hit_Writeback_Inv_SD);
411 start += 0x400;
412 } while (start < end);
413}
414
415static inline void blast_scache32_page_indexed(unsigned long page)
416{
417 unsigned long start = page;
418 unsigned long end = start + PAGE_SIZE;
419 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
420 unsigned long ws_end = current_cpu_data.scache.ways <<
421 current_cpu_data.scache.waybit;
422 unsigned long ws, addr;
423
424 for (ws = 0; ws < ws_end; ws += ws_inc)
425 for (addr = start; addr < end; addr += 0x400)
426 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD);
427}
428
429#define cache64_unroll32(base,op) \ 195#define cache64_unroll32(base,op) \
430 __asm__ __volatile__( \ 196 __asm__ __volatile__( \
431 " .set push \n" \ 197 " .set push \n" \
@@ -452,84 +218,6 @@ static inline void blast_scache32_page_indexed(unsigned long page)
452 : "r" (base), \ 218 : "r" (base), \
453 "i" (op)); 219 "i" (op));
454 220
455static inline void blast_icache64(void)
456{
457 unsigned long start = INDEX_BASE;
458 unsigned long end = start + current_cpu_data.icache.waysize;
459 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
460 unsigned long ws_end = current_cpu_data.icache.ways <<
461 current_cpu_data.icache.waybit;
462 unsigned long ws, addr;
463
464 for (ws = 0; ws < ws_end; ws += ws_inc)
465 for (addr = start; addr < end; addr += 0x800)
466 cache64_unroll32(addr|ws,Index_Invalidate_I);
467}
468
469static inline void blast_icache64_page(unsigned long page)
470{
471 unsigned long start = page;
472 unsigned long end = start + PAGE_SIZE;
473
474 do {
475 cache64_unroll32(start,Hit_Invalidate_I);
476 start += 0x800;
477 } while (start < end);
478}
479
480static inline void blast_icache64_page_indexed(unsigned long page)
481{
482 unsigned long start = page;
483 unsigned long end = start + PAGE_SIZE;
484 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
485 unsigned long ws_end = current_cpu_data.icache.ways <<
486 current_cpu_data.icache.waybit;
487 unsigned long ws, addr;
488
489 for (ws = 0; ws < ws_end; ws += ws_inc)
490 for (addr = start; addr < end; addr += 0x800)
491 cache64_unroll32(addr|ws,Index_Invalidate_I);
492}
493
494static inline void blast_scache64(void)
495{
496 unsigned long start = INDEX_BASE;
497 unsigned long end = start + current_cpu_data.scache.waysize;
498 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
499 unsigned long ws_end = current_cpu_data.scache.ways <<
500 current_cpu_data.scache.waybit;
501 unsigned long ws, addr;
502
503 for (ws = 0; ws < ws_end; ws += ws_inc)
504 for (addr = start; addr < end; addr += 0x800)
505 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD);
506}
507
508static inline void blast_scache64_page(unsigned long page)
509{
510 unsigned long start = page;
511 unsigned long end = page + PAGE_SIZE;
512
513 do {
514 cache64_unroll32(start,Hit_Writeback_Inv_SD);
515 start += 0x800;
516 } while (start < end);
517}
518
519static inline void blast_scache64_page_indexed(unsigned long page)
520{
521 unsigned long start = page;
522 unsigned long end = start + PAGE_SIZE;
523 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
524 unsigned long ws_end = current_cpu_data.scache.ways <<
525 current_cpu_data.scache.waybit;
526 unsigned long ws, addr;
527
528 for (ws = 0; ws < ws_end; ws += ws_inc)
529 for (addr = start; addr < end; addr += 0x800)
530 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD);
531}
532
533#define cache128_unroll32(base,op) \ 221#define cache128_unroll32(base,op) \
534 __asm__ __volatile__( \ 222 __asm__ __volatile__( \
535 " .set push \n" \ 223 " .set push \n" \
@@ -556,43 +244,55 @@ static inline void blast_scache64_page_indexed(unsigned long page)
556 : "r" (base), \ 244 : "r" (base), \
557 "i" (op)); 245 "i" (op));
558 246
559static inline void blast_scache128(void) 247/* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */
560{ 248#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize) \
561 unsigned long start = INDEX_BASE; 249static inline void blast_##pfx##cache##lsize(void) \
562 unsigned long end = start + current_cpu_data.scache.waysize; 250{ \
563 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; 251 unsigned long start = INDEX_BASE; \
564 unsigned long ws_end = current_cpu_data.scache.ways << 252 unsigned long end = start + current_cpu_data.desc.waysize; \
565 current_cpu_data.scache.waybit; 253 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
566 unsigned long ws, addr; 254 unsigned long ws_end = current_cpu_data.desc.ways << \
567 255 current_cpu_data.desc.waybit; \
568 for (ws = 0; ws < ws_end; ws += ws_inc) 256 unsigned long ws, addr; \
569 for (addr = start; addr < end; addr += 0x1000) 257 \
570 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); 258 for (ws = 0; ws < ws_end; ws += ws_inc) \
571} 259 for (addr = start; addr < end; addr += lsize * 32) \
572 260 cache##lsize##_unroll32(addr|ws,indexop); \
573static inline void blast_scache128_page(unsigned long page) 261} \
574{ 262 \
575 unsigned long start = page; 263static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \
576 unsigned long end = page + PAGE_SIZE; 264{ \
577 265 unsigned long start = page; \
578 do { 266 unsigned long end = page + PAGE_SIZE; \
579 cache128_unroll32(start,Hit_Writeback_Inv_SD); 267 \
580 start += 0x1000; 268 do { \
581 } while (start < end); 269 cache##lsize##_unroll32(start,hitop); \
582} 270 start += lsize * 32; \
583 271 } while (start < end); \
584static inline void blast_scache128_page_indexed(unsigned long page) 272} \
585{ 273 \
586 unsigned long start = page; 274static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
587 unsigned long end = start + PAGE_SIZE; 275{ \
588 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; 276 unsigned long start = page; \
589 unsigned long ws_end = current_cpu_data.scache.ways << 277 unsigned long end = start + PAGE_SIZE; \
590 current_cpu_data.scache.waybit; 278 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
591 unsigned long ws, addr; 279 unsigned long ws_end = current_cpu_data.desc.ways << \
592 280 current_cpu_data.desc.waybit; \
593 for (ws = 0; ws < ws_end; ws += ws_inc) 281 unsigned long ws, addr; \
594 for (addr = start; addr < end; addr += 0x1000) 282 \
595 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); 283 for (ws = 0; ws < ws_end; ws += ws_inc) \
596} 284 for (addr = start; addr < end; addr += lsize * 32) \
285 cache##lsize##_unroll32(addr|ws,indexop); \
286}
287
288__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16)
289__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16)
290__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16)
291__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32)
292__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32)
293__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32)
294__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
295__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
296__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
597 297
598#endif /* _ASM_R4KCACHE_H */ 298#endif /* _ASM_R4KCACHE_H */
diff --git a/include/asm-mips/reboot.h b/include/asm-mips/reboot.h
index 2f10ebcbe141..e48c0bfab257 100644
--- a/include/asm-mips/reboot.h
+++ b/include/asm-mips/reboot.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1997, 1999, 2001 by Ralf Baechle 6 * Copyright (C) 1997, 1999, 2001, 06 by Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc. 7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */ 8 */
9#ifndef _ASM_REBOOT_H 9#ifndef _ASM_REBOOT_H
@@ -11,6 +11,5 @@
11 11
12extern void (*_machine_restart)(char *command); 12extern void (*_machine_restart)(char *command);
13extern void (*_machine_halt)(void); 13extern void (*_machine_halt)(void);
14extern void (*_machine_power_off)(void);
15 14
16#endif /* _ASM_REBOOT_H */ 15#endif /* _ASM_REBOOT_H */
diff --git a/include/asm-mips/string.h b/include/asm-mips/string.h
index 5a06f6d13899..907da600fddd 100644
--- a/include/asm-mips/string.h
+++ b/include/asm-mips/string.h
@@ -141,26 +141,4 @@ extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
141#define __HAVE_ARCH_MEMMOVE 141#define __HAVE_ARCH_MEMMOVE
142extern void *memmove(void *__dest, __const__ void *__src, size_t __n); 142extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
143 143
144#ifdef CONFIG_32BIT
145#define __HAVE_ARCH_MEMSCAN
146static __inline__ void *memscan(void *__addr, int __c, size_t __size)
147{
148 char *__end = (char *)__addr + __size;
149 unsigned char __uc = (unsigned char) __c;
150
151 __asm__(".set\tpush\n\t"
152 ".set\tnoat\n\t"
153 ".set\treorder\n\t"
154 "1:\tbeq\t%0,%1,2f\n\t"
155 "addiu\t%0,1\n\t"
156 "lbu\t$1,-1(%0)\n\t"
157 "bne\t$1,%z4,1b\n"
158 "2:\t.set\tpop"
159 : "=r" (__addr), "=r" (__end)
160 : "0" (__addr), "1" (__end), "Jr" (__uc));
161
162 return __addr;
163}
164#endif /* CONFIG_32BIT */
165
166#endif /* _ASM_STRING_H */ 144#endif /* _ASM_STRING_H */
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index 1612b3fe1080..fa193f861e71 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -114,6 +114,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
116#define TIF_SECCOMP 5 /* secure computing */ 116#define TIF_SECCOMP 5 /* secure computing */
117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
117#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
118#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
119#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
@@ -125,6 +126,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
125#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 126#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
126#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 127#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
127#define _TIF_SECCOMP (1<<TIF_SECCOMP) 128#define _TIF_SECCOMP (1<<TIF_SECCOMP)
129#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
128#define _TIF_USEDFPU (1<<TIF_USEDFPU) 130#define _TIF_USEDFPU (1<<TIF_USEDFPU)
129#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
130 132
diff --git a/include/asm-mips/tx4927/tx4927.h b/include/asm-mips/tx4927/tx4927.h
index 3bb7f0087d68..de85bd2245f7 100644
--- a/include/asm-mips/tx4927/tx4927.h
+++ b/include/asm-mips/tx4927/tx4927.h
@@ -2,7 +2,7 @@
2 * Author: MontaVista Software, Inc. 2 * Author: MontaVista Software, Inc.
3 * source@mvista.com 3 * source@mvista.com
4 * 4 *
5 * Copyright 2001-2002 MontaVista Software Inc. 5 * Copyright 2001-2006 MontaVista Software Inc.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -30,10 +30,10 @@
30#include <asm/tx4927/tx4927_mips.h> 30#include <asm/tx4927/tx4927_mips.h>
31 31
32/* 32/*
33 This register naming came from the intergrate cpu/controoler name TX4927 33 This register naming came from the integrated CPU/controller name TX4927
34 followed by the device name from table 4.2.2 on page 4-3 and then followed 34 followed by the device name from table 4.2.2 on page 4-3 and then followed
35 by the register name from table 4.2.3 on pages 4-4 to 4-8. The manaul 35 by the register name from table 4.2.3 on pages 4-4 to 4-8. The manaul
36 used is "TMPR4927BT Preliminary Rev 0.1 20.Jul.2001". 36 used was "TMPR4927BT Preliminary Rev 0.1 20.Jul.2001".
37 */ 37 */
38 38
39#define TX4927_SIO_0_BASE 39#define TX4927_SIO_0_BASE
@@ -251,8 +251,8 @@
251 251
252/* TX4927 Timer 0 (32-bit registers) */ 252/* TX4927 Timer 0 (32-bit registers) */
253#define TX4927_TMR0_BASE 0xf000 253#define TX4927_TMR0_BASE 0xf000
254#define TX4927_TMR0_TMTCR0 0xf004 254#define TX4927_TMR0_TMTCR0 0xf000
255#define TX4927_TMR0_TMTISR0 0xf008 255#define TX4927_TMR0_TMTISR0 0xf004
256#define TX4927_TMR0_TMCPRA0 0xf008 256#define TX4927_TMR0_TMCPRA0 0xf008
257#define TX4927_TMR0_TMCPRB0 0xf00c 257#define TX4927_TMR0_TMCPRB0 0xf00c
258#define TX4927_TMR0_TMITMR0 0xf010 258#define TX4927_TMR0_TMITMR0 0xf010
@@ -264,8 +264,8 @@
264 264
265/* TX4927 Timer 1 (32-bit registers) */ 265/* TX4927 Timer 1 (32-bit registers) */
266#define TX4927_TMR1_BASE 0xf100 266#define TX4927_TMR1_BASE 0xf100
267#define TX4927_TMR1_TMTCR1 0xf104 267#define TX4927_TMR1_TMTCR1 0xf100
268#define TX4927_TMR1_TMTISR1 0xf108 268#define TX4927_TMR1_TMTISR1 0xf104
269#define TX4927_TMR1_TMCPRA1 0xf108 269#define TX4927_TMR1_TMCPRA1 0xf108
270#define TX4927_TMR1_TMCPRB1 0xf10c 270#define TX4927_TMR1_TMCPRB1 0xf10c
271#define TX4927_TMR1_TMITMR1 0xf110 271#define TX4927_TMR1_TMITMR1 0xf110
@@ -277,13 +277,12 @@
277 277
278/* TX4927 Timer 2 (32-bit registers) */ 278/* TX4927 Timer 2 (32-bit registers) */
279#define TX4927_TMR2_BASE 0xf200 279#define TX4927_TMR2_BASE 0xf200
280#define TX4927_TMR2_TMTCR2 0xf104 280#define TX4927_TMR2_TMTCR2 0xf200
281#define TX4927_TMR2_TMTISR2 0xf208 281#define TX4927_TMR2_TMTISR2 0xf204
282#define TX4927_TMR2_TMCPRA2 0xf208 282#define TX4927_TMR2_TMCPRA2 0xf208
283#define TX4927_TMR2_TMCPRB2 0xf20c
284#define TX4927_TMR2_TMITMR2 0xf210 283#define TX4927_TMR2_TMITMR2 0xf210
285#define TX4927_TMR2_TMCCDR2 0xf220 284#define TX4927_TMR2_TMCCDR2 0xf220
286#define TX4927_TMR2_TMPGMR2 0xf230 285#define TX4927_TMR2_TMWTMR2 0xf240
287#define TX4927_TMR2_TMTRR2 0xf2f0 286#define TX4927_TMR2_TMTRR2 0xf2f0
288#define TX4927_TMR2_LIMIT 0xf2ff 287#define TX4927_TMR2_LIMIT 0xf2ff
289 288
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h
index 165f6b8b217f..66c064690f41 100644
--- a/include/asm-mips/tx4927/tx4927_pci.h
+++ b/include/asm-mips/tx4927/tx4927_pci.h
@@ -253,6 +253,16 @@ struct tx4927_pcic_reg {
253#define TX4927_CCFG_PCIDIVMODE_5 0x00001000 253#define TX4927_CCFG_PCIDIVMODE_5 0x00001000
254#define TX4927_CCFG_PCIDIVMODE_6 0x00001800 254#define TX4927_CCFG_PCIDIVMODE_6 0x00001800
255 255
256#define TX4937_CCFG_PCIDIVMODE_MASK 0x00001c00
257#define TX4937_CCFG_PCIDIVMODE_8 0x00000000
258#define TX4937_CCFG_PCIDIVMODE_4 0x00000400
259#define TX4937_CCFG_PCIDIVMODE_9 0x00000800
260#define TX4937_CCFG_PCIDIVMODE_4_5 0x00000c00
261#define TX4937_CCFG_PCIDIVMODE_10 0x00001000
262#define TX4937_CCFG_PCIDIVMODE_5 0x00001400
263#define TX4937_CCFG_PCIDIVMODE_11 0x00001800
264#define TX4937_CCFG_PCIDIVMODE_5_5 0x00001c00
265
256/* PCFG : Pin Configuration */ 266/* PCFG : Pin Configuration */
257#define TX4927_PCFG_PCICLKEN_ALL 0x003f0000 267#define TX4927_PCFG_PCICLKEN_ALL 0x003f0000
258#define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch)) 268#define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 41bb96bb2120..91d813a37823 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -202,49 +202,49 @@ struct __large_struct { unsigned long buf[100]; };
202 * Yuck. We need two variants, one for 64bit operation and one 202 * Yuck. We need two variants, one for 64bit operation and one
203 * for 32 bit mode and old iron. 203 * for 32 bit mode and old iron.
204 */ 204 */
205#ifdef __mips64 205#ifdef CONFIG_32BIT
206#define __GET_USER_DW(ptr) __get_user_asm("ld", ptr) 206#define __GET_USER_DW(val, ptr) __get_user_asm_ll32(val, ptr)
207#else 207#endif
208#define __GET_USER_DW(ptr) __get_user_asm_ll32(ptr) 208#ifdef CONFIG_64BIT
209#define __GET_USER_DW(val, ptr) __get_user_asm(val, "ld", ptr)
209#endif 210#endif
210 211
211#define __get_user_nocheck(x,ptr,size) \ 212extern void __get_user_unknown(void);
212({ \ 213
213 __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \ 214#define __get_user_common(val, size, ptr) \
214 long __gu_err = 0; \ 215do { \
215 \
216 switch (size) { \ 216 switch (size) { \
217 case 1: __get_user_asm("lb", ptr); break; \ 217 case 1: __get_user_asm(val, "lb", ptr); break; \
218 case 2: __get_user_asm("lh", ptr); break; \ 218 case 2: __get_user_asm(val, "lh", ptr); break; \
219 case 4: __get_user_asm("lw", ptr); break; \ 219 case 4: __get_user_asm(val, "lw", ptr); break; \
220 case 8: __GET_USER_DW(ptr); break; \ 220 case 8: __GET_USER_DW(val, ptr); break; \
221 default: __get_user_unknown(); break; \ 221 default: __get_user_unknown(); break; \
222 } \ 222 } \
223 (x) = (__typeof__(*(ptr))) __gu_val; \ 223} while (0)
224
225#define __get_user_nocheck(x,ptr,size) \
226({ \
227 long __gu_err; \
228 \
229 __get_user_common((x), size, ptr); \
224 __gu_err; \ 230 __gu_err; \
225}) 231})
226 232
227#define __get_user_check(x,ptr,size) \ 233#define __get_user_check(x,ptr,size) \
228({ \ 234({ \
229 const __typeof__(*(ptr)) __user * __gu_addr = (ptr); \
230 __typeof__(*(ptr)) __gu_val = 0; \
231 long __gu_err = -EFAULT; \ 235 long __gu_err = -EFAULT; \
236 const void __user * __gu_ptr = (ptr); \
237 \
238 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \
239 __get_user_common((x), size, __gu_ptr); \
232 \ 240 \
233 if (likely(access_ok(VERIFY_READ, __gu_addr, size))) { \
234 switch (size) { \
235 case 1: __get_user_asm("lb", __gu_addr); break; \
236 case 2: __get_user_asm("lh", __gu_addr); break; \
237 case 4: __get_user_asm("lw", __gu_addr); break; \
238 case 8: __GET_USER_DW(__gu_addr); break; \
239 default: __get_user_unknown(); break; \
240 } \
241 } \
242 (x) = (__typeof__(*(ptr))) __gu_val; \
243 __gu_err; \ 241 __gu_err; \
244}) 242})
245 243
246#define __get_user_asm(insn, addr) \ 244#define __get_user_asm(val, insn, addr) \
247{ \ 245{ \
246 long __gu_tmp; \
247 \
248 __asm__ __volatile__( \ 248 __asm__ __volatile__( \
249 "1: " insn " %1, %3 \n" \ 249 "1: " insn " %1, %3 \n" \
250 "2: \n" \ 250 "2: \n" \
@@ -255,14 +255,16 @@ struct __large_struct { unsigned long buf[100]; };
255 " .section __ex_table,\"a\" \n" \ 255 " .section __ex_table,\"a\" \n" \
256 " "__UA_ADDR "\t1b, 3b \n" \ 256 " "__UA_ADDR "\t1b, 3b \n" \
257 " .previous \n" \ 257 " .previous \n" \
258 : "=r" (__gu_err), "=r" (__gu_val) \ 258 : "=r" (__gu_err), "=r" (__gu_tmp) \
259 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \ 259 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \
260 \
261 (val) = (__typeof__(val)) __gu_tmp; \
260} 262}
261 263
262/* 264/*
263 * Get a long long 64 using 32 bit registers. 265 * Get a long long 64 using 32 bit registers.
264 */ 266 */
265#define __get_user_asm_ll32(addr) \ 267#define __get_user_asm_ll32(val, addr) \
266{ \ 268{ \
267 __asm__ __volatile__( \ 269 __asm__ __volatile__( \
268 "1: lw %1, (%3) \n" \ 270 "1: lw %1, (%3) \n" \
@@ -278,21 +280,20 @@ struct __large_struct { unsigned long buf[100]; };
278 " " __UA_ADDR " 1b, 4b \n" \ 280 " " __UA_ADDR " 1b, 4b \n" \
279 " " __UA_ADDR " 2b, 4b \n" \ 281 " " __UA_ADDR " 2b, 4b \n" \
280 " .previous \n" \ 282 " .previous \n" \
281 : "=r" (__gu_err), "=&r" (__gu_val) \ 283 : "=r" (__gu_err), "=&r" (val) \
282 : "0" (0), "r" (addr), "i" (-EFAULT)); \ 284 : "0" (0), "r" (addr), "i" (-EFAULT)); \
283} 285}
284 286
285extern void __get_user_unknown(void);
286
287/* 287/*
288 * Yuck. We need two variants, one for 64bit operation and one 288 * Yuck. We need two variants, one for 64bit operation and one
289 * for 32 bit mode and old iron. 289 * for 32 bit mode and old iron.
290 */ 290 */
291#ifdef __mips64 291#ifdef CONFIG_32BIT
292#define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr)
293#else
294#define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr) 292#define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr)
295#endif 293#endif
294#ifdef CONFIG_64BIT
295#define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr)
296#endif
296 297
297#define __put_user_nocheck(x,ptr,size) \ 298#define __put_user_nocheck(x,ptr,size) \
298({ \ 299({ \
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 89ea8b60e945..e7ff9b187783 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -307,17 +307,33 @@
307#define __NR_inotify_init (__NR_Linux + 284) 307#define __NR_inotify_init (__NR_Linux + 284)
308#define __NR_inotify_add_watch (__NR_Linux + 285) 308#define __NR_inotify_add_watch (__NR_Linux + 285)
309#define __NR_inotify_rm_watch (__NR_Linux + 286) 309#define __NR_inotify_rm_watch (__NR_Linux + 286)
310 310#define __NR_migrate_pages (__NR_Linux + 287)
311#define __NR_openat (__NR_Linux + 288)
312#define __NR_mkdirat (__NR_Linux + 289)
313#define __NR_mknodat (__NR_Linux + 290)
314#define __NR_fchownat (__NR_Linux + 291)
315#define __NR_futimesat (__NR_Linux + 292)
316#define __NR_newfstatat (__NR_Linux + 293)
317#define __NR_unlinkat (__NR_Linux + 294)
318#define __NR_renameat (__NR_Linux + 295)
319#define __NR_linkat (__NR_Linux + 296)
320#define __NR_symlinkat (__NR_Linux + 297)
321#define __NR_readlinkat (__NR_Linux + 298)
322#define __NR_fchmodat (__NR_Linux + 299)
323#define __NR_faccessat (__NR_Linux + 300)
324#define __NR_pselect6 (__NR_Linux + 301)
325#define __NR_ppoll (__NR_Linux + 302)
326#define __NR_unshare (__NR_Linux + 303)
311 327
312/* 328/*
313 * Offset of the last Linux o32 flavoured syscall 329 * Offset of the last Linux o32 flavoured syscall
314 */ 330 */
315#define __NR_Linux_syscalls 286 331#define __NR_Linux_syscalls 303
316 332
317#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 333#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
318 334
319#define __NR_O32_Linux 4000 335#define __NR_O32_Linux 4000
320#define __NR_O32_Linux_syscalls 283 336#define __NR_O32_Linux_syscalls 303
321 337
322#if _MIPS_SIM == _MIPS_SIM_ABI64 338#if _MIPS_SIM == _MIPS_SIM_ABI64
323 339
@@ -571,16 +587,33 @@
571#define __NR_inotify_init (__NR_Linux + 243) 587#define __NR_inotify_init (__NR_Linux + 243)
572#define __NR_inotify_add_watch (__NR_Linux + 244) 588#define __NR_inotify_add_watch (__NR_Linux + 244)
573#define __NR_inotify_rm_watch (__NR_Linux + 245) 589#define __NR_inotify_rm_watch (__NR_Linux + 245)
590#define __NR_migrate_pages (__NR_Linux + 246)
591#define __NR_openat (__NR_Linux + 247)
592#define __NR_mkdirat (__NR_Linux + 248)
593#define __NR_mknodat (__NR_Linux + 249)
594#define __NR_fchownat (__NR_Linux + 250)
595#define __NR_futimesat (__NR_Linux + 251)
596#define __NR_newfstatat (__NR_Linux + 252)
597#define __NR_unlinkat (__NR_Linux + 253)
598#define __NR_renameat (__NR_Linux + 254)
599#define __NR_linkat (__NR_Linux + 255)
600#define __NR_symlinkat (__NR_Linux + 256)
601#define __NR_readlinkat (__NR_Linux + 257)
602#define __NR_fchmodat (__NR_Linux + 258)
603#define __NR_faccessat (__NR_Linux + 259)
604#define __NR_pselect6 (__NR_Linux + 260)
605#define __NR_ppoll (__NR_Linux + 261)
606#define __NR_unshare (__NR_Linux + 262)
574 607
575/* 608/*
576 * Offset of the last Linux 64-bit flavoured syscall 609 * Offset of the last Linux 64-bit flavoured syscall
577 */ 610 */
578#define __NR_Linux_syscalls 245 611#define __NR_Linux_syscalls 262
579 612
580#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 613#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
581 614
582#define __NR_64_Linux 5000 615#define __NR_64_Linux 5000
583#define __NR_64_Linux_syscalls 242 616#define __NR_64_Linux_syscalls 262
584 617
585#if _MIPS_SIM == _MIPS_SIM_NABI32 618#if _MIPS_SIM == _MIPS_SIM_NABI32
586 619
@@ -838,16 +871,33 @@
838#define __NR_inotify_init (__NR_Linux + 247) 871#define __NR_inotify_init (__NR_Linux + 247)
839#define __NR_inotify_add_watch (__NR_Linux + 248) 872#define __NR_inotify_add_watch (__NR_Linux + 248)
840#define __NR_inotify_rm_watch (__NR_Linux + 249) 873#define __NR_inotify_rm_watch (__NR_Linux + 249)
874#define __NR_migrate_pages (__NR_Linux + 250)
875#define __NR_openat (__NR_Linux + 251)
876#define __NR_mkdirat (__NR_Linux + 252)
877#define __NR_mknodat (__NR_Linux + 253)
878#define __NR_fchownat (__NR_Linux + 254)
879#define __NR_futimesat (__NR_Linux + 255)
880#define __NR_newfstatat (__NR_Linux + 256)
881#define __NR_unlinkat (__NR_Linux + 257)
882#define __NR_renameat (__NR_Linux + 258)
883#define __NR_linkat (__NR_Linux + 259)
884#define __NR_symlinkat (__NR_Linux + 260)
885#define __NR_readlinkat (__NR_Linux + 261)
886#define __NR_fchmodat (__NR_Linux + 262)
887#define __NR_faccessat (__NR_Linux + 263)
888#define __NR_pselect6 (__NR_Linux + 264)
889#define __NR_ppoll (__NR_Linux + 265)
890#define __NR_unshare (__NR_Linux + 266)
841 891
842/* 892/*
843 * Offset of the last N32 flavoured syscall 893 * Offset of the last N32 flavoured syscall
844 */ 894 */
845#define __NR_Linux_syscalls 249 895#define __NR_Linux_syscalls 266
846 896
847#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 897#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
848 898
849#define __NR_N32_Linux 6000 899#define __NR_N32_Linux 6000
850#define __NR_N32_Linux_syscalls 246 900#define __NR_N32_Linux_syscalls 266
851 901
852#ifndef __ASSEMBLY__ 902#ifndef __ASSEMBLY__
853 903
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index accb80c9a339..aacaabd28ac1 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -126,6 +126,11 @@ static inline void __user *compat_ptr(compat_uptr_t uptr)
126 return (void __user *)(unsigned long)uptr; 126 return (void __user *)(unsigned long)uptr;
127} 127}
128 128
129static inline compat_uptr_t ptr_to_compat(void __user *uptr)
130{
131 return (u32)(unsigned long)uptr;
132}
133
129static inline void __user *compat_alloc_user_space(long len) 134static inline void __user *compat_alloc_user_space(long len)
130{ 135{
131 struct pt_regs *regs = current->thread.regs; 136 struct pt_regs *regs = current->thread.regs;
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 837756ab7dc7..2ac63f569592 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -15,7 +15,6 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <asm/scatterlist.h> 16#include <asm/scatterlist.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/bug.h>
19 18
20#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 19#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
21 20
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 5b2bd4eefb01..cbd297f44cce 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -222,5 +222,7 @@ extern int of_address_to_resource(struct device_node *dev, int index,
222extern int of_pci_address_to_resource(struct device_node *dev, int bar, 222extern int of_pci_address_to_resource(struct device_node *dev, int bar,
223 struct resource *r); 223 struct resource *r);
224 224
225extern void kdump_move_device_tree(void);
226
225#endif /* __KERNEL__ */ 227#endif /* __KERNEL__ */
226#endif /* _POWERPC_PROM_H */ 228#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h
index 82ce47607774..2dc93632f210 100644
--- a/include/asm-powerpc/smu.h
+++ b/include/asm-powerpc/smu.h
@@ -521,6 +521,11 @@ struct smu_sdbp_cpupiddata {
521extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 521extern struct smu_sdbp_header *smu_get_sdb_partition(int id,
522 unsigned int *size); 522 unsigned int *size);
523 523
524/* Get "sdb" partition data from an SMU satellite */
525extern struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id,
526 int id, unsigned int *size);
527
528
524#endif /* __KERNEL__ */ 529#endif /* __KERNEL__ */
525 530
526 531
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index 67cdaf3ae9fc..c044ec16a879 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -37,7 +37,7 @@ struct thread_info {
37 int preempt_count; /* 0 => preemptable, 37 int preempt_count; /* 0 => preemptable,
38 <0 => BUG */ 38 <0 => BUG */
39 struct restart_block restart_block; 39 struct restart_block restart_block;
40 void *nvgprs_frame; 40 void __user *nvgprs_frame;
41 /* low level flags - has atomic operations done on it */ 41 /* low level flags - has atomic operations done on it */
42 unsigned long flags ____cacheline_aligned_in_smp; 42 unsigned long flags ____cacheline_aligned_in_smp;
43}; 43};
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index be104f21c70a..0b7c0ca4c3d7 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -61,7 +61,7 @@
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 61#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 62
63 63
64static inline int __access_ok(const void *addr, unsigned long size) 64static inline int __access_ok(const void __user *addr, unsigned long size)
65{ 65{
66 return 1; 66 return 1;
67} 67}
@@ -208,25 +208,25 @@ extern int __put_user_bad(void) __attribute__((noreturn));
208 case 1: { \ 208 case 1: { \
209 unsigned char __x; \ 209 unsigned char __x; \
210 __get_user_asm(__x, ptr, __gu_err); \ 210 __get_user_asm(__x, ptr, __gu_err); \
211 (x) = *(__typeof__(*(ptr)) *) &__x; \ 211 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
212 break; \ 212 break; \
213 }; \ 213 }; \
214 case 2: { \ 214 case 2: { \
215 unsigned short __x; \ 215 unsigned short __x; \
216 __get_user_asm(__x, ptr, __gu_err); \ 216 __get_user_asm(__x, ptr, __gu_err); \
217 (x) = *(__typeof__(*(ptr)) *) &__x; \ 217 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
218 break; \ 218 break; \
219 }; \ 219 }; \
220 case 4: { \ 220 case 4: { \
221 unsigned int __x; \ 221 unsigned int __x; \
222 __get_user_asm(__x, ptr, __gu_err); \ 222 __get_user_asm(__x, ptr, __gu_err); \
223 (x) = *(__typeof__(*(ptr)) *) &__x; \ 223 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
224 break; \ 224 break; \
225 }; \ 225 }; \
226 case 8: { \ 226 case 8: { \
227 unsigned long long __x; \ 227 unsigned long long __x; \
228 __get_user_asm(__x, ptr, __gu_err); \ 228 __get_user_asm(__x, ptr, __gu_err); \
229 (x) = *(__typeof__(*(ptr)) *) &__x; \ 229 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
230 break; \ 230 break; \
231 }; \ 231 }; \
232 default: \ 232 default: \
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 2ac64e65e336..0615d601a7c6 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -315,11 +315,12 @@
315#define __NR_faccessat 296 315#define __NR_faccessat 296
316#define __NR_pselect6 297 316#define __NR_pselect6 297
317#define __NR_ppoll 298 317#define __NR_ppoll 298
318#define __NR_unshare 299
318 319
319/* WARNING: You MAY NOT add syscall numbers larger than 298, since 320/* WARNING: You MAY NOT add syscall numbers larger than 299, since
320 * all of the syscall tables in the Sparc kernel are 321 * all of the syscall tables in the Sparc kernel are
321 * sized to have 298 entries (starting at zero). Therefore 322 * sized to have 299 entries (starting at zero). Therefore
322 * find a free slot in the 0-298 range. 323 * find a free slot in the 0-299 range.
323 */ 324 */
324 325
325#define _syscall0(type,name) \ 326#define _syscall0(type,name) \
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 84ac2bdb0902..c58ba8a096cf 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -317,11 +317,12 @@
317#define __NR_faccessat 296 317#define __NR_faccessat 296
318#define __NR_pselect6 297 318#define __NR_pselect6 297
319#define __NR_ppoll 298 319#define __NR_ppoll 298
320#define __NR_unshare 299
320 321
321/* WARNING: You MAY NOT add syscall numbers larger than 298, since 322/* WARNING: You MAY NOT add syscall numbers larger than 299, since
322 * all of the syscall tables in the Sparc kernel are 323 * all of the syscall tables in the Sparc kernel are
323 * sized to have 298 entries (starting at zero). Therefore 324 * sized to have 299 entries (starting at zero). Therefore
324 * find a free slot in the 0-298 range. 325 * find a free slot in the 0-299 range.
325 */ 326 */
326 327
327#define _syscall0(type,name) \ 328#define _syscall0(type,name) \
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index 9afc0c7d3661..20468983d453 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -313,7 +313,10 @@
313#define __NR_ia32_readlinkat 305 313#define __NR_ia32_readlinkat 305
314#define __NR_ia32_fchmodat 306 314#define __NR_ia32_fchmodat 306
315#define __NR_ia32_faccessat 307 315#define __NR_ia32_faccessat 307
316#define __NR_ia32_pselect6 308
317#define __NR_ia32_ppoll 309
318#define __NR_ia32_unshare 310
316 319
317#define IA32_NR_syscalls 308 /* must be > than biggest syscall! */ 320#define IA32_NR_syscalls 315 /* must be > than biggest syscall! */
318 321
319#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ 322#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index 34e434ce3268..dffe276ca2df 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -22,8 +22,15 @@ extern void numa_set_node(int cpu, int node);
22extern unsigned char apicid_to_node[256]; 22extern unsigned char apicid_to_node[256];
23#ifdef CONFIG_NUMA 23#ifdef CONFIG_NUMA
24extern void __init init_cpu_to_node(void); 24extern void __init init_cpu_to_node(void);
25
26static inline void clear_node_cpumask(int cpu)
27{
28 clear_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
29}
30
25#else 31#else
26#define init_cpu_to_node() do {} while (0) 32#define init_cpu_to_node() do {} while (0)
33#define clear_node_cpumask(cpu) do {} while (0)
27#endif 34#endif
28 35
29#define NUMA_NO_NODE 0xff 36#define NUMA_NO_NODE 0xff
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 436d099b5b6b..da0341c57949 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -599,8 +599,14 @@ __SYSCALL(__NR_readlinkat, sys_readlinkat)
599__SYSCALL(__NR_fchmodat, sys_fchmodat) 599__SYSCALL(__NR_fchmodat, sys_fchmodat)
600#define __NR_faccessat 269 600#define __NR_faccessat 269
601__SYSCALL(__NR_faccessat, sys_faccessat) 601__SYSCALL(__NR_faccessat, sys_faccessat)
602 602#define __NR_pselect6 270
603#define __NR_syscall_max __NR_faccessat 603__SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */
604#define __NR_ppoll 271
605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */
606#define __NR_unshare 272
607__SYSCALL(__NR_unshare, sys_unshare)
608
609#define __NR_syscall_max __NR_unshare
604 610
605#ifndef __NO_STUBS 611#ifndef __NO_STUBS
606 612
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 13e9f4a3ab26..60e56c6e03dd 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -84,7 +84,6 @@
84#include <linux/kernel.h> 84#include <linux/kernel.h>
85#include <linux/threads.h> 85#include <linux/threads.h>
86#include <linux/bitmap.h> 86#include <linux/bitmap.h>
87#include <asm/bug.h>
88 87
89typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 88typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
90extern cpumask_t _unused_cpumask_arg_; 89extern cpumask_t _unused_cpumask_arg_;
@@ -329,7 +328,7 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
329 * bitmap of size NR_CPUS. 328 * bitmap of size NR_CPUS.
330 * 329 *
331 * #ifdef CONFIG_HOTPLUG_CPU 330 * #ifdef CONFIG_HOTPLUG_CPU
332 * cpu_possible_map - all NR_CPUS bits set 331 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable
333 * cpu_present_map - has bit 'cpu' set iff cpu is populated 332 * cpu_present_map - has bit 'cpu' set iff cpu is populated
334 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler 333 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
335 * #else 334 * #else
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index a3f09947940e..4361f3789975 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -8,7 +8,6 @@
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/cache.h> 9#include <linux/cache.h>
10#include <linux/rcupdate.h> 10#include <linux/rcupdate.h>
11#include <asm/bug.h>
12 11
13struct nameidata; 12struct nameidata;
14struct vfsmount; 13struct vfsmount;
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index b1999bfeaa56..b81e58b2ebf8 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -135,7 +135,7 @@ typedef struct video_spu {
135 135
136typedef struct video_spu_palette { /* SPU Palette information */ 136typedef struct video_spu_palette { /* SPU Palette information */
137 int length; 137 int length;
138 uint8_t *palette; 138 uint8_t __user *palette;
139} video_spu_palette_t; 139} video_spu_palette_t;
140 140
141 141
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 23fe746a1d51..18cf1f3e1184 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -82,6 +82,7 @@ struct elevator_queue
82extern void elv_dispatch_sort(request_queue_t *, struct request *); 82extern void elv_dispatch_sort(request_queue_t *, struct request *);
83extern void elv_add_request(request_queue_t *, struct request *, int, int); 83extern void elv_add_request(request_queue_t *, struct request *, int, int);
84extern void __elv_add_request(request_queue_t *, struct request *, int, int); 84extern void __elv_add_request(request_queue_t *, struct request *, int, int);
85extern void elv_insert(request_queue_t *, struct request *, int);
85extern int elv_merge(request_queue_t *, struct request **, struct bio *); 86extern int elv_merge(request_queue_t *, struct request **, struct bio *);
86extern void elv_merge_requests(request_queue_t *, struct request *, 87extern void elv_merge_requests(request_queue_t *, struct request *,
87 struct request *); 88 struct request *);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 7863a59bd598..63f1d63cc1d8 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -100,6 +100,9 @@ extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
100/* Returns the number of read bytes */ 100/* Returns the number of read bytes */
101extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 101extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
102 u8 command, u8 *values); 102 u8 command, u8 *values);
103extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
104 u8 command, u8 length,
105 u8 *values);
103 106
104/* 107/*
105 * A driver is capable of handling one or more physical devices present on 108 * A driver is capable of handling one or more physical devices present on
diff --git a/include/linux/ioc3.h b/include/linux/ioc3.h
index e7906a72a4f1..da7c09e4ede6 100644
--- a/include/linux/ioc3.h
+++ b/include/linux/ioc3.h
@@ -27,7 +27,7 @@ struct ioc3_driver_data {
27 int id; /* IOC3 sequence number */ 27 int id; /* IOC3 sequence number */
28 /* PCI mapping */ 28 /* PCI mapping */
29 unsigned long pma; /* physical address */ 29 unsigned long pma; /* physical address */
30 struct __iomem ioc3 *vma; /* pointer to registers */ 30 struct ioc3 __iomem *vma; /* pointer to registers */
31 struct pci_dev *pdev; /* PCI device */ 31 struct pci_dev *pdev; /* PCI device */
32 /* IRQ stuff */ 32 /* IRQ stuff */
33 int dual_irq; /* set if separate IRQs are used */ 33 int dual_irq; /* set if separate IRQs are used */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 751bb3849467..0fe4aa891ddc 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -239,7 +239,6 @@ typedef struct journal_superblock_s
239 239
240#include <linux/fs.h> 240#include <linux/fs.h>
241#include <linux/sched.h> 241#include <linux/sched.h>
242#include <asm/bug.h>
243 242
244#define JBD_ASSERTIONS 243#define JBD_ASSERTIONS
245#ifdef JBD_ASSERTIONS 244#ifdef JBD_ASSERTIONS
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 3aed37314ab8..e87c32a5c86a 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -153,8 +153,10 @@ static inline void con_schedule_flip(struct tty_struct *t)
153{ 153{
154 unsigned long flags; 154 unsigned long flags;
155 spin_lock_irqsave(&t->buf.lock, flags); 155 spin_lock_irqsave(&t->buf.lock, flags);
156 if (t->buf.tail != NULL) 156 if (t->buf.tail != NULL) {
157 t->buf.tail->active = 0; 157 t->buf.tail->active = 0;
158 t->buf.tail->commit = t->buf.tail->used;
159 }
158 spin_unlock_irqrestore(&t->buf.lock, flags); 160 spin_unlock_irqrestore(&t->buf.lock, flags);
159 schedule_work(&t->buf.work); 161 schedule_work(&t->buf.work);
160} 162}
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index a311f58c8a7c..cfb3410e32b1 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -6,6 +6,7 @@
6#include <linux/list.h> 6#include <linux/list.h>
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/ioport.h>
9#include <asm/kexec.h> 10#include <asm/kexec.h>
10 11
11/* Verify architecture specific macros are defined */ 12/* Verify architecture specific macros are defined */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 85854b867463..75e9f0724997 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -303,7 +303,7 @@ struct page {
303 */ 303 */
304#define put_page_testzero(p) \ 304#define put_page_testzero(p) \
305 ({ \ 305 ({ \
306 BUG_ON(page_count(p) == 0); \ 306 BUG_ON(atomic_read(&(p)->_count) == -1);\
307 atomic_add_negative(-1, &(p)->_count); \ 307 atomic_add_negative(-1, &(p)->_count); \
308 }) 308 })
309 309
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index fedfbc8a287f..7dfd6e1fcde7 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -15,7 +15,6 @@
15#include <asm/unaligned.h> 15#include <asm/unaligned.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/bug.h>
19 18
20#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 19#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1
21#define map_bankwidth(map) 1 20#define map_bankwidth(map) 1
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 6731977c4c13..3abc8e3b4879 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -15,6 +15,7 @@ struct namespace {
15 15
16extern int copy_namespace(int, struct task_struct *); 16extern int copy_namespace(int, struct task_struct *);
17extern void __put_namespace(struct namespace *namespace); 17extern void __put_namespace(struct namespace *namespace);
18extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *);
18 19
19static inline void put_namespace(struct namespace *namespace) 20static inline void put_namespace(struct namespace *namespace)
20{ 21{
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6a2ccf78a356..c256ebe2a7b4 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -160,7 +160,8 @@ extern int netlink_unregister_notifier(struct notifier_block *nb);
160 160
161/* finegrained unicast helpers: */ 161/* finegrained unicast helpers: */
162struct sock *netlink_getsockbyfilp(struct file *filp); 162struct sock *netlink_getsockbyfilp(struct file *filp);
163int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo); 163int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
164 long timeo, struct sock *ssk);
164void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 165void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
165int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); 166int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
166 167
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 4726ef7ba8e8..b959a4525cbd 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -84,7 +84,6 @@
84#include <linux/threads.h> 84#include <linux/threads.h>
85#include <linux/bitmap.h> 85#include <linux/bitmap.h>
86#include <linux/numa.h> 86#include <linux/numa.h>
87#include <asm/bug.h>
88 87
89typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 88typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
90extern nodemask_t _unused_nodemask_arg_; 89extern nodemask_t _unused_nodemask_arg_;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 92a619ba163f..7a61ccdcbc4b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1832,6 +1832,7 @@
1832#define PCI_VENDOR_ID_AFAVLAB 0x14db 1832#define PCI_VENDOR_ID_AFAVLAB 0x14db
1833#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 1833#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180
1834#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 1834#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182
1835#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150
1835 1836
1836#define PCI_VENDOR_ID_BROADCOM 0x14e4 1837#define PCI_VENDOR_ID_BROADCOM 0x14e4
1837#define PCI_DEVICE_ID_TIGON3_5752 0x1600 1838#define PCI_DEVICE_ID_TIGON3_5752 0x1600
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0cfcd1c7865e..9c1da0269a18 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1098,7 +1098,7 @@ extern struct sigqueue *sigqueue_alloc(void);
1098extern void sigqueue_free(struct sigqueue *); 1098extern void sigqueue_free(struct sigqueue *);
1099extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); 1099extern int send_sigqueue(int, struct sigqueue *, struct task_struct *);
1100extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *); 1100extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
1101extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *); 1101extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
1102extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 1102extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
1103 1103
1104/* These can be the second arg to send_sig_info/send_group_sig_info. */ 1104/* These can be the second arg to send_sig_info/send_group_sig_info. */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9dfa3ee769ae..44153fdf73fc 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -17,7 +17,6 @@ extern void cpu_idle(void);
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/thread_info.h> 18#include <linux/thread_info.h>
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/bug.h>
21 20
22/* 21/*
23 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. 22 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 43bcd13eb1ec..37c1c76fd547 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -42,13 +42,21 @@ extern void mark_free_pages(struct zone *zone);
42#ifdef CONFIG_PM 42#ifdef CONFIG_PM
43/* kernel/power/swsusp.c */ 43/* kernel/power/swsusp.c */
44extern int software_suspend(void); 44extern int software_suspend(void);
45
46#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
47extern int pm_prepare_console(void);
48extern void pm_restore_console(void);
49#else
50static inline int pm_prepare_console(void) { return 0; }
51static inline void pm_restore_console(void) {}
52#endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */
45#else 53#else
46static inline int software_suspend(void) 54static inline int software_suspend(void)
47{ 55{
48 printk("Warning: fake suspend called\n"); 56 printk("Warning: fake suspend called\n");
49 return -EPERM; 57 return -EPERM;
50} 58}
51#endif 59#endif /* CONFIG_PM */
52 60
53#ifdef CONFIG_SUSPEND_SMP 61#ifdef CONFIG_SUSPEND_SMP
54extern void disable_nonboot_cpus(void); 62extern void disable_nonboot_cpus(void);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a7bd3b4558d2..f45cd74e6f24 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -58,6 +58,8 @@ struct tty_buffer {
58 int used; 58 int used;
59 int size; 59 int size;
60 int active; 60 int active;
61 int commit;
62 int read;
61 /* Data points here */ 63 /* Data points here */
62 unsigned long data[0]; 64 unsigned long data[0];
63}; 65};
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 82961eb19888..222faf97d5f9 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -29,8 +29,10 @@ _INLINE_ void tty_schedule_flip(struct tty_struct *tty)
29{ 29{
30 unsigned long flags; 30 unsigned long flags;
31 spin_lock_irqsave(&tty->buf.lock, flags); 31 spin_lock_irqsave(&tty->buf.lock, flags);
32 if (tty->buf.tail != NULL) 32 if (tty->buf.tail != NULL) {
33 tty->buf.tail->active = 0; 33 tty->buf.tail->active = 0;
34 tty->buf.tail->commit = tty->buf.tail->used;
35 }
34 spin_unlock_irqrestore(&tty->buf.lock, flags); 36 spin_unlock_irqrestore(&tty->buf.lock, flags);
35 schedule_delayed_work(&tty->buf.work, 1); 37 schedule_delayed_work(&tty->buf.work, 1);
36} 38}
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 6f6c69777648..5208b12d5550 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -549,7 +549,7 @@ struct v4l2_framebuffer
549struct v4l2_clip 549struct v4l2_clip
550{ 550{
551 struct v4l2_rect c; 551 struct v4l2_rect c;
552 struct v4l2_clip *next; 552 struct v4l2_clip __user *next;
553}; 553};
554 554
555struct v4l2_window 555struct v4l2_window
@@ -629,6 +629,7 @@ typedef __u64 v4l2_std_id;
629#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) 629#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
630#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) 630#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
631#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) 631#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
632#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
632 633
633#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) 634#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
634#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) 635#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
@@ -661,7 +662,8 @@ typedef __u64 v4l2_std_id;
661 V4L2_STD_PAL_H |\ 662 V4L2_STD_PAL_H |\
662 V4L2_STD_PAL_I) 663 V4L2_STD_PAL_I)
663#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ 664#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
664 V4L2_STD_NTSC_M_JP) 665 V4L2_STD_NTSC_M_JP |\
666 V4L2_STD_NTSC_M_KR)
665#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ 667#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
666 V4L2_STD_SECAM_K |\ 668 V4L2_STD_SECAM_K |\
667 V4L2_STD_SECAM_K1) 669 V4L2_STD_SECAM_K1)
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index f55e86e75030..2127cae1e0a6 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -50,6 +50,9 @@
50/* May be different when we get VFIR */ 50/* May be different when we get VFIR */
51#define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER) 51#define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER)
52 52
53/* Each IrDA device gets a random 32 bits IRLAP device address */
54#define LAP_ALEN 4
55
53#define BROADCAST 0xffffffff /* Broadcast device address */ 56#define BROADCAST 0xffffffff /* Broadcast device address */
54#define CBROADCAST 0xfe /* Connection broadcast address */ 57#define CBROADCAST 0xfe /* Connection broadcast address */
55#define XID_FORMAT 0x01 /* Discovery XID format */ 58#define XID_FORMAT 0x01 /* Discovery XID format */
diff --git a/init/Kconfig b/init/Kconfig
index 8b7abae87bf9..38416a199def 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -169,7 +169,6 @@ config SYSCTL
169config AUDIT 169config AUDIT
170 bool "Auditing support" 170 bool "Auditing support"
171 depends on NET 171 depends on NET
172 default y if SECURITY_SELINUX
173 help 172 help
174 Enable auditing infrastructure that can be used with another 173 Enable auditing infrastructure that can be used with another
175 kernel subsystem, such as SELinux (which requires this for 174 kernel subsystem, such as SELinux (which requires this for
diff --git a/init/initramfs.c b/init/initramfs.c
index 0c5d9a3f951b..637344b05981 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -466,10 +466,32 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
466extern char __initramfs_start[], __initramfs_end[]; 466extern char __initramfs_start[], __initramfs_end[];
467#ifdef CONFIG_BLK_DEV_INITRD 467#ifdef CONFIG_BLK_DEV_INITRD
468#include <linux/initrd.h> 468#include <linux/initrd.h>
469#include <linux/kexec.h>
469 470
470static void __init free_initrd(void) 471static void __init free_initrd(void)
471{ 472{
472 free_initrd_mem(initrd_start, initrd_end); 473#ifdef CONFIG_KEXEC
474 unsigned long crashk_start = (unsigned long)__va(crashk_res.start);
475 unsigned long crashk_end = (unsigned long)__va(crashk_res.end);
476
477 /*
478 * If the initrd region is overlapped with crashkernel reserved region,
479 * free only memory that is not part of crashkernel region.
480 */
481 if (initrd_start < crashk_end && initrd_end > crashk_start) {
482 /*
483 * Initialize initrd memory region since the kexec boot does
484 * not do.
485 */
486 memset((void *)initrd_start, 0, initrd_end - initrd_start);
487 if (initrd_start < crashk_start)
488 free_initrd_mem(initrd_start, crashk_start);
489 if (initrd_end > crashk_end)
490 free_initrd_mem(crashk_end, initrd_end);
491 } else
492#endif
493 free_initrd_mem(initrd_start, initrd_end);
494
473 initrd_start = 0; 495 initrd_start = 0;
474 initrd_end = 0; 496 initrd_end = 0;
475} 497}
diff --git a/init/main.c b/init/main.c
index 7c79da57d3a2..4c194c47395f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -668,7 +668,6 @@ static int init(void * unused)
668 */ 668 */
669 child_reaper = current; 669 child_reaper = current;
670 670
671 /* Sets up cpus_possible() */
672 smp_prepare_cpus(max_cpus); 671 smp_prepare_cpus(max_cpus);
673 672
674 do_pre_smp_initcalls(); 673 do_pre_smp_initcalls();
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 59302fc3643b..fd2e26b6f966 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1018,7 +1018,8 @@ retry:
1018 goto out; 1018 goto out;
1019 } 1019 }
1020 1020
1021 ret = netlink_attachskb(sock, nc, 0, MAX_SCHEDULE_TIMEOUT); 1021 ret = netlink_attachskb(sock, nc, 0,
1022 MAX_SCHEDULE_TIMEOUT, NULL);
1022 if (ret == 1) 1023 if (ret == 1)
1023 goto retry; 1024 goto retry;
1024 if (ret) { 1025 if (ret) {
diff --git a/ipc/shm.c b/ipc/shm.c
index 4c28d2d8e305..9162123a7b23 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -870,6 +870,7 @@ asmlinkage long sys_shmdt(char __user *shmaddr)
870 * could possibly have landed at. Also cast things to loff_t to 870 * could possibly have landed at. Also cast things to loff_t to
871 * prevent overflows and make comparisions vs. equal-width types. 871 * prevent overflows and make comparisions vs. equal-width types.
872 */ 872 */
873 size = PAGE_ALIGN(size);
873 while (vma && (loff_t)(vma->vm_end - addr) <= size) { 874 while (vma && (loff_t)(vma->vm_end - addr) <= size) {
874 next = vma->vm_next; 875 next = vma->vm_next;
875 876
diff --git a/kernel/compat.c b/kernel/compat.c
index 1867290c37e3..8c9cd88b6785 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -23,7 +23,6 @@
23#include <linux/security.h> 23#include <linux/security.h>
24 24
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/bug.h>
27 26
28int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) 27int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
29{ 28{
diff --git a/kernel/fork.c b/kernel/fork.c
index 7f0ab5ee948c..8e88b374cee9 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -446,6 +446,55 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
446 } 446 }
447} 447}
448 448
449/*
450 * Allocate a new mm structure and copy contents from the
451 * mm structure of the passed in task structure.
452 */
453static struct mm_struct *dup_mm(struct task_struct *tsk)
454{
455 struct mm_struct *mm, *oldmm = current->mm;
456 int err;
457
458 if (!oldmm)
459 return NULL;
460
461 mm = allocate_mm();
462 if (!mm)
463 goto fail_nomem;
464
465 memcpy(mm, oldmm, sizeof(*mm));
466
467 if (!mm_init(mm))
468 goto fail_nomem;
469
470 if (init_new_context(tsk, mm))
471 goto fail_nocontext;
472
473 err = dup_mmap(mm, oldmm);
474 if (err)
475 goto free_pt;
476
477 mm->hiwater_rss = get_mm_rss(mm);
478 mm->hiwater_vm = mm->total_vm;
479
480 return mm;
481
482free_pt:
483 mmput(mm);
484
485fail_nomem:
486 return NULL;
487
488fail_nocontext:
489 /*
490 * If init_new_context() failed, we cannot use mmput() to free the mm
491 * because it calls destroy_context()
492 */
493 mm_free_pgd(mm);
494 free_mm(mm);
495 return NULL;
496}
497
449static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) 498static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
450{ 499{
451 struct mm_struct * mm, *oldmm; 500 struct mm_struct * mm, *oldmm;
@@ -473,43 +522,17 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
473 } 522 }
474 523
475 retval = -ENOMEM; 524 retval = -ENOMEM;
476 mm = allocate_mm(); 525 mm = dup_mm(tsk);
477 if (!mm) 526 if (!mm)
478 goto fail_nomem; 527 goto fail_nomem;
479 528
480 /* Copy the current MM stuff.. */
481 memcpy(mm, oldmm, sizeof(*mm));
482 if (!mm_init(mm))
483 goto fail_nomem;
484
485 if (init_new_context(tsk,mm))
486 goto fail_nocontext;
487
488 retval = dup_mmap(mm, oldmm);
489 if (retval)
490 goto free_pt;
491
492 mm->hiwater_rss = get_mm_rss(mm);
493 mm->hiwater_vm = mm->total_vm;
494
495good_mm: 529good_mm:
496 tsk->mm = mm; 530 tsk->mm = mm;
497 tsk->active_mm = mm; 531 tsk->active_mm = mm;
498 return 0; 532 return 0;
499 533
500free_pt:
501 mmput(mm);
502fail_nomem: 534fail_nomem:
503 return retval; 535 return retval;
504
505fail_nocontext:
506 /*
507 * If init_new_context() failed, we cannot use mmput() to free the mm
508 * because it calls destroy_context()
509 */
510 mm_free_pgd(mm);
511 free_mm(mm);
512 return retval;
513} 536}
514 537
515static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) 538static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old)
@@ -597,32 +620,17 @@ out:
597 return newf; 620 return newf;
598} 621}
599 622
600static int copy_files(unsigned long clone_flags, struct task_struct * tsk) 623/*
624 * Allocate a new files structure and copy contents from the
625 * passed in files structure.
626 */
627static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
601{ 628{
602 struct files_struct *oldf, *newf; 629 struct files_struct *newf;
603 struct file **old_fds, **new_fds; 630 struct file **old_fds, **new_fds;
604 int open_files, size, i, error = 0, expand; 631 int open_files, size, i, expand;
605 struct fdtable *old_fdt, *new_fdt; 632 struct fdtable *old_fdt, *new_fdt;
606 633
607 /*
608 * A background process may not have any files ...
609 */
610 oldf = current->files;
611 if (!oldf)
612 goto out;
613
614 if (clone_flags & CLONE_FILES) {
615 atomic_inc(&oldf->count);
616 goto out;
617 }
618
619 /*
620 * Note: we may be using current for both targets (See exec.c)
621 * This works because we cache current->files (old) as oldf. Don't
622 * break this.
623 */
624 tsk->files = NULL;
625 error = -ENOMEM;
626 newf = alloc_files(); 634 newf = alloc_files();
627 if (!newf) 635 if (!newf)
628 goto out; 636 goto out;
@@ -651,9 +659,9 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
651 if (expand) { 659 if (expand) {
652 spin_unlock(&oldf->file_lock); 660 spin_unlock(&oldf->file_lock);
653 spin_lock(&newf->file_lock); 661 spin_lock(&newf->file_lock);
654 error = expand_files(newf, open_files-1); 662 *errorp = expand_files(newf, open_files-1);
655 spin_unlock(&newf->file_lock); 663 spin_unlock(&newf->file_lock);
656 if (error < 0) 664 if (*errorp < 0)
657 goto out_release; 665 goto out_release;
658 new_fdt = files_fdtable(newf); 666 new_fdt = files_fdtable(newf);
659 /* 667 /*
@@ -702,10 +710,8 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
702 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); 710 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
703 } 711 }
704 712
705 tsk->files = newf;
706 error = 0;
707out: 713out:
708 return error; 714 return newf;
709 715
710out_release: 716out_release:
711 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset); 717 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset);
@@ -715,6 +721,40 @@ out_release:
715 goto out; 721 goto out;
716} 722}
717 723
724static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
725{
726 struct files_struct *oldf, *newf;
727 int error = 0;
728
729 /*
730 * A background process may not have any files ...
731 */
732 oldf = current->files;
733 if (!oldf)
734 goto out;
735
736 if (clone_flags & CLONE_FILES) {
737 atomic_inc(&oldf->count);
738 goto out;
739 }
740
741 /*
742 * Note: we may be using current for both targets (See exec.c)
743 * This works because we cache current->files (old) as oldf. Don't
744 * break this.
745 */
746 tsk->files = NULL;
747 error = -ENOMEM;
748 newf = dup_fd(oldf, &error);
749 if (!newf)
750 goto out;
751
752 tsk->files = newf;
753 error = 0;
754out:
755 return error;
756}
757
718/* 758/*
719 * Helper to unshare the files of the current task. 759 * Helper to unshare the files of the current task.
720 * We don't want to expose copy_files internals to 760 * We don't want to expose copy_files internals to
@@ -1323,3 +1363,249 @@ void __init proc_caches_init(void)
1323 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, 1363 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
1324 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 1364 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
1325} 1365}
1366
1367
1368/*
1369 * Check constraints on flags passed to the unshare system call and
1370 * force unsharing of additional process context as appropriate.
1371 */
1372static inline void check_unshare_flags(unsigned long *flags_ptr)
1373{
1374 /*
1375 * If unsharing a thread from a thread group, must also
1376 * unshare vm.
1377 */
1378 if (*flags_ptr & CLONE_THREAD)
1379 *flags_ptr |= CLONE_VM;
1380
1381 /*
1382 * If unsharing vm, must also unshare signal handlers.
1383 */
1384 if (*flags_ptr & CLONE_VM)
1385 *flags_ptr |= CLONE_SIGHAND;
1386
1387 /*
1388 * If unsharing signal handlers and the task was created
1389 * using CLONE_THREAD, then must unshare the thread
1390 */
1391 if ((*flags_ptr & CLONE_SIGHAND) &&
1392 (atomic_read(&current->signal->count) > 1))
1393 *flags_ptr |= CLONE_THREAD;
1394
1395 /*
1396 * If unsharing namespace, must also unshare filesystem information.
1397 */
1398 if (*flags_ptr & CLONE_NEWNS)
1399 *flags_ptr |= CLONE_FS;
1400}
1401
1402/*
1403 * Unsharing of tasks created with CLONE_THREAD is not supported yet
1404 */
1405static int unshare_thread(unsigned long unshare_flags)
1406{
1407 if (unshare_flags & CLONE_THREAD)
1408 return -EINVAL;
1409
1410 return 0;
1411}
1412
1413/*
1414 * Unshare the filesystem structure if it is being shared
1415 */
1416static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)
1417{
1418 struct fs_struct *fs = current->fs;
1419
1420 if ((unshare_flags & CLONE_FS) &&
1421 (fs && atomic_read(&fs->count) > 1)) {
1422 *new_fsp = __copy_fs_struct(current->fs);
1423 if (!*new_fsp)
1424 return -ENOMEM;
1425 }
1426
1427 return 0;
1428}
1429
1430/*
1431 * Unshare the namespace structure if it is being shared
1432 */
1433static int unshare_namespace(unsigned long unshare_flags, struct namespace **new_nsp, struct fs_struct *new_fs)
1434{
1435 struct namespace *ns = current->namespace;
1436
1437 if ((unshare_flags & CLONE_NEWNS) &&
1438 (ns && atomic_read(&ns->count) > 1)) {
1439 if (!capable(CAP_SYS_ADMIN))
1440 return -EPERM;
1441
1442 *new_nsp = dup_namespace(current, new_fs ? new_fs : current->fs);
1443 if (!*new_nsp)
1444 return -ENOMEM;
1445 }
1446
1447 return 0;
1448}
1449
1450/*
1451 * Unsharing of sighand for tasks created with CLONE_SIGHAND is not
1452 * supported yet
1453 */
1454static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp)
1455{
1456 struct sighand_struct *sigh = current->sighand;
1457
1458 if ((unshare_flags & CLONE_SIGHAND) &&
1459 (sigh && atomic_read(&sigh->count) > 1))
1460 return -EINVAL;
1461 else
1462 return 0;
1463}
1464
1465/*
1466 * Unshare vm if it is being shared
1467 */
1468static int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp)
1469{
1470 struct mm_struct *mm = current->mm;
1471
1472 if ((unshare_flags & CLONE_VM) &&
1473 (mm && atomic_read(&mm->mm_users) > 1)) {
1474 *new_mmp = dup_mm(current);
1475 if (!*new_mmp)
1476 return -ENOMEM;
1477 }
1478
1479 return 0;
1480}
1481
1482/*
1483 * Unshare file descriptor table if it is being shared
1484 */
1485static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp)
1486{
1487 struct files_struct *fd = current->files;
1488 int error = 0;
1489
1490 if ((unshare_flags & CLONE_FILES) &&
1491 (fd && atomic_read(&fd->count) > 1)) {
1492 *new_fdp = dup_fd(fd, &error);
1493 if (!*new_fdp)
1494 return error;
1495 }
1496
1497 return 0;
1498}
1499
1500/*
1501 * Unsharing of semundo for tasks created with CLONE_SYSVSEM is not
1502 * supported yet
1503 */
1504static int unshare_semundo(unsigned long unshare_flags, struct sem_undo_list **new_ulistp)
1505{
1506 if (unshare_flags & CLONE_SYSVSEM)
1507 return -EINVAL;
1508
1509 return 0;
1510}
1511
1512/*
1513 * unshare allows a process to 'unshare' part of the process
1514 * context which was originally shared using clone. copy_*
1515 * functions used by do_fork() cannot be used here directly
1516 * because they modify an inactive task_struct that is being
1517 * constructed. Here we are modifying the current, active,
1518 * task_struct.
1519 */
1520asmlinkage long sys_unshare(unsigned long unshare_flags)
1521{
1522 int err = 0;
1523 struct fs_struct *fs, *new_fs = NULL;
1524 struct namespace *ns, *new_ns = NULL;
1525 struct sighand_struct *sigh, *new_sigh = NULL;
1526 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
1527 struct files_struct *fd, *new_fd = NULL;
1528 struct sem_undo_list *new_ulist = NULL;
1529
1530 check_unshare_flags(&unshare_flags);
1531
1532 if ((err = unshare_thread(unshare_flags)))
1533 goto bad_unshare_out;
1534 if ((err = unshare_fs(unshare_flags, &new_fs)))
1535 goto bad_unshare_cleanup_thread;
1536 if ((err = unshare_namespace(unshare_flags, &new_ns, new_fs)))
1537 goto bad_unshare_cleanup_fs;
1538 if ((err = unshare_sighand(unshare_flags, &new_sigh)))
1539 goto bad_unshare_cleanup_ns;
1540 if ((err = unshare_vm(unshare_flags, &new_mm)))
1541 goto bad_unshare_cleanup_sigh;
1542 if ((err = unshare_fd(unshare_flags, &new_fd)))
1543 goto bad_unshare_cleanup_vm;
1544 if ((err = unshare_semundo(unshare_flags, &new_ulist)))
1545 goto bad_unshare_cleanup_fd;
1546
1547 if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist) {
1548
1549 task_lock(current);
1550
1551 if (new_fs) {
1552 fs = current->fs;
1553 current->fs = new_fs;
1554 new_fs = fs;
1555 }
1556
1557 if (new_ns) {
1558 ns = current->namespace;
1559 current->namespace = new_ns;
1560 new_ns = ns;
1561 }
1562
1563 if (new_sigh) {
1564 sigh = current->sighand;
1565 current->sighand = new_sigh;
1566 new_sigh = sigh;
1567 }
1568
1569 if (new_mm) {
1570 mm = current->mm;
1571 active_mm = current->active_mm;
1572 current->mm = new_mm;
1573 current->active_mm = new_mm;
1574 activate_mm(active_mm, new_mm);
1575 new_mm = mm;
1576 }
1577
1578 if (new_fd) {
1579 fd = current->files;
1580 current->files = new_fd;
1581 new_fd = fd;
1582 }
1583
1584 task_unlock(current);
1585 }
1586
1587bad_unshare_cleanup_fd:
1588 if (new_fd)
1589 put_files_struct(new_fd);
1590
1591bad_unshare_cleanup_vm:
1592 if (new_mm)
1593 mmput(new_mm);
1594
1595bad_unshare_cleanup_sigh:
1596 if (new_sigh)
1597 if (atomic_dec_and_test(&new_sigh->count))
1598 kmem_cache_free(sighand_cachep, new_sigh);
1599
1600bad_unshare_cleanup_ns:
1601 if (new_ns)
1602 put_namespace(new_ns);
1603
1604bad_unshare_cleanup_fs:
1605 if (new_fs)
1606 put_fs_struct(new_fs);
1607
1608bad_unshare_cleanup_thread:
1609bad_unshare_out:
1610 return err;
1611}
diff --git a/kernel/module.c b/kernel/module.c
index e058aedf6b93..5aad477ddc79 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1670,6 +1670,9 @@ static struct module *load_module(void __user *umod,
1670 goto free_mod; 1670 goto free_mod;
1671 } 1671 }
1672 1672
1673 /* Userspace could have altered the string after the strlen_user() */
1674 args[arglen - 1] = '\0';
1675
1673 if (find_module(mod->name)) { 1676 if (find_module(mod->name)) {
1674 err = -EEXIST; 1677 err = -EEXIST;
1675 goto free_mod; 1678 goto free_mod;
diff --git a/kernel/panic.c b/kernel/panic.c
index c5c4ab255834..126dc43f1c74 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -130,6 +130,7 @@ NORET_TYPE void panic(const char * fmt, ...)
130#endif 130#endif
131 local_irq_enable(); 131 local_irq_enable();
132 for (i = 0;;) { 132 for (i = 0;;) {
133 touch_softlockup_watchdog();
133 i += panic_blink(i); 134 i += panic_blink(i);
134 mdelay(1); 135 mdelay(1);
135 i++; 136 i++;
diff --git a/kernel/power/console.c b/kernel/power/console.c
index 579d239d129f..623786d44159 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -9,7 +9,9 @@
9#include <linux/console.h> 9#include <linux/console.h>
10#include "power.h" 10#include "power.h"
11 11
12#ifdef SUSPEND_CONSOLE 12#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
13#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
14
13static int orig_fgconsole, orig_kmsg; 15static int orig_fgconsole, orig_kmsg;
14 16
15int pm_prepare_console(void) 17int pm_prepare_console(void)
diff --git a/kernel/power/power.h b/kernel/power/power.h
index d8f0d1a76bae..388dba680841 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -1,14 +1,6 @@
1#include <linux/suspend.h> 1#include <linux/suspend.h>
2#include <linux/utsname.h> 2#include <linux/utsname.h>
3 3
4/* With SUSPEND_CONSOLE defined suspend looks *really* cool, but
5 we probably do not take enough locks for switching consoles, etc,
6 so bad things might happen.
7*/
8#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
9#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
10#endif
11
12struct swsusp_info { 4struct swsusp_info {
13 struct new_utsname uts; 5 struct new_utsname uts;
14 u32 version_code; 6 u32 version_code;
@@ -42,14 +34,6 @@ static struct subsys_attribute _name##_attr = { \
42 34
43extern struct subsystem power_subsys; 35extern struct subsystem power_subsys;
44 36
45#ifdef SUSPEND_CONSOLE
46extern int pm_prepare_console(void);
47extern void pm_restore_console(void);
48#else
49static int pm_prepare_console(void) { return 0; }
50static void pm_restore_console(void) {}
51#endif
52
53/* References to section boundaries */ 37/* References to section boundaries */
54extern const void __nosave_begin, __nosave_end; 38extern const void __nosave_begin, __nosave_end;
55 39
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 59c91c148e82..4e90905f0e87 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -743,7 +743,6 @@ static int submit(int rw, pgoff_t page_off, void *page)
743 if (!bio) 743 if (!bio)
744 return -ENOMEM; 744 return -ENOMEM;
745 bio->bi_sector = page_off * (PAGE_SIZE >> 9); 745 bio->bi_sector = page_off * (PAGE_SIZE >> 9);
746 bio_get(bio);
747 bio->bi_bdev = resume_bdev; 746 bio->bi_bdev = resume_bdev;
748 bio->bi_end_io = end_io; 747 bio->bi_end_io = end_io;
749 748
@@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page)
753 goto Done; 752 goto Done;
754 } 753 }
755 754
756 if (rw == WRITE)
757 bio_set_pages_dirty(bio);
758 755
759 atomic_set(&io_done, 1); 756 atomic_set(&io_done, 1);
760 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 757 submit_bio(rw | (1 << BIO_RW_SYNC), bio);
761 while (atomic_read(&io_done)) 758 while (atomic_read(&io_done))
762 yield(); 759 yield();
763 760 if (rw == READ)
761 bio_set_pages_dirty(bio);
764 Done: 762 Done:
765 bio_put(bio); 763 bio_put(bio);
766 return error; 764 return error;
diff --git a/kernel/sched.c b/kernel/sched.c
index bc38804e40dd..87d93be336a1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -215,7 +215,6 @@ struct runqueue {
215 */ 215 */
216 unsigned long nr_running; 216 unsigned long nr_running;
217#ifdef CONFIG_SMP 217#ifdef CONFIG_SMP
218 unsigned long prio_bias;
219 unsigned long cpu_load[3]; 218 unsigned long cpu_load[3];
220#endif 219#endif
221 unsigned long long nr_switches; 220 unsigned long long nr_switches;
@@ -669,68 +668,13 @@ static int effective_prio(task_t *p)
669 return prio; 668 return prio;
670} 669}
671 670
672#ifdef CONFIG_SMP
673static inline void inc_prio_bias(runqueue_t *rq, int prio)
674{
675 rq->prio_bias += MAX_PRIO - prio;
676}
677
678static inline void dec_prio_bias(runqueue_t *rq, int prio)
679{
680 rq->prio_bias -= MAX_PRIO - prio;
681}
682
683static inline void inc_nr_running(task_t *p, runqueue_t *rq)
684{
685 rq->nr_running++;
686 if (rt_task(p)) {
687 if (p != rq->migration_thread)
688 /*
689 * The migration thread does the actual balancing. Do
690 * not bias by its priority as the ultra high priority
691 * will skew balancing adversely.
692 */
693 inc_prio_bias(rq, p->prio);
694 } else
695 inc_prio_bias(rq, p->static_prio);
696}
697
698static inline void dec_nr_running(task_t *p, runqueue_t *rq)
699{
700 rq->nr_running--;
701 if (rt_task(p)) {
702 if (p != rq->migration_thread)
703 dec_prio_bias(rq, p->prio);
704 } else
705 dec_prio_bias(rq, p->static_prio);
706}
707#else
708static inline void inc_prio_bias(runqueue_t *rq, int prio)
709{
710}
711
712static inline void dec_prio_bias(runqueue_t *rq, int prio)
713{
714}
715
716static inline void inc_nr_running(task_t *p, runqueue_t *rq)
717{
718 rq->nr_running++;
719}
720
721static inline void dec_nr_running(task_t *p, runqueue_t *rq)
722{
723 rq->nr_running--;
724}
725#endif
726
727/* 671/*
728 * __activate_task - move a task to the runqueue. 672 * __activate_task - move a task to the runqueue.
729 */ 673 */
730static inline void __activate_task(task_t *p, runqueue_t *rq) 674static inline void __activate_task(task_t *p, runqueue_t *rq)
731{ 675{
732 enqueue_task(p, rq->active); 676 enqueue_task(p, rq->active);
733 inc_nr_running(p, rq); 677 rq->nr_running++;
734} 678}
735 679
736/* 680/*
@@ -739,7 +683,7 @@ static inline void __activate_task(task_t *p, runqueue_t *rq)
739static inline void __activate_idle_task(task_t *p, runqueue_t *rq) 683static inline void __activate_idle_task(task_t *p, runqueue_t *rq)
740{ 684{
741 enqueue_task_head(p, rq->active); 685 enqueue_task_head(p, rq->active);
742 inc_nr_running(p, rq); 686 rq->nr_running++;
743} 687}
744 688
745static int recalc_task_prio(task_t *p, unsigned long long now) 689static int recalc_task_prio(task_t *p, unsigned long long now)
@@ -863,7 +807,7 @@ static void activate_task(task_t *p, runqueue_t *rq, int local)
863 */ 807 */
864static void deactivate_task(struct task_struct *p, runqueue_t *rq) 808static void deactivate_task(struct task_struct *p, runqueue_t *rq)
865{ 809{
866 dec_nr_running(p, rq); 810 rq->nr_running--;
867 dequeue_task(p, p->array); 811 dequeue_task(p, p->array);
868 p->array = NULL; 812 p->array = NULL;
869} 813}
@@ -1007,61 +951,27 @@ void kick_process(task_t *p)
1007 * We want to under-estimate the load of migration sources, to 951 * We want to under-estimate the load of migration sources, to
1008 * balance conservatively. 952 * balance conservatively.
1009 */ 953 */
1010static unsigned long __source_load(int cpu, int type, enum idle_type idle) 954static inline unsigned long source_load(int cpu, int type)
1011{ 955{
1012 runqueue_t *rq = cpu_rq(cpu); 956 runqueue_t *rq = cpu_rq(cpu);
1013 unsigned long running = rq->nr_running; 957 unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
1014 unsigned long source_load, cpu_load = rq->cpu_load[type-1],
1015 load_now = running * SCHED_LOAD_SCALE;
1016
1017 if (type == 0) 958 if (type == 0)
1018 source_load = load_now; 959 return load_now;
1019 else
1020 source_load = min(cpu_load, load_now);
1021
1022 if (running > 1 || (idle == NOT_IDLE && running))
1023 /*
1024 * If we are busy rebalancing the load is biased by
1025 * priority to create 'nice' support across cpus. When
1026 * idle rebalancing we should only bias the source_load if
1027 * there is more than one task running on that queue to
1028 * prevent idle rebalance from trying to pull tasks from a
1029 * queue with only one running task.
1030 */
1031 source_load = source_load * rq->prio_bias / running;
1032 960
1033 return source_load; 961 return min(rq->cpu_load[type-1], load_now);
1034}
1035
1036static inline unsigned long source_load(int cpu, int type)
1037{
1038 return __source_load(cpu, type, NOT_IDLE);
1039} 962}
1040 963
1041/* 964/*
1042 * Return a high guess at the load of a migration-target cpu 965 * Return a high guess at the load of a migration-target cpu
1043 */ 966 */
1044static inline unsigned long __target_load(int cpu, int type, enum idle_type idle) 967static inline unsigned long target_load(int cpu, int type)
1045{ 968{
1046 runqueue_t *rq = cpu_rq(cpu); 969 runqueue_t *rq = cpu_rq(cpu);
1047 unsigned long running = rq->nr_running; 970 unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
1048 unsigned long target_load, cpu_load = rq->cpu_load[type-1],
1049 load_now = running * SCHED_LOAD_SCALE;
1050
1051 if (type == 0) 971 if (type == 0)
1052 target_load = load_now; 972 return load_now;
1053 else
1054 target_load = max(cpu_load, load_now);
1055 973
1056 if (running > 1 || (idle == NOT_IDLE && running)) 974 return max(rq->cpu_load[type-1], load_now);
1057 target_load = target_load * rq->prio_bias / running;
1058
1059 return target_load;
1060}
1061
1062static inline unsigned long target_load(int cpu, int type)
1063{
1064 return __target_load(cpu, type, NOT_IDLE);
1065} 975}
1066 976
1067/* 977/*
@@ -1530,7 +1440,7 @@ void fastcall wake_up_new_task(task_t *p, unsigned long clone_flags)
1530 list_add_tail(&p->run_list, &current->run_list); 1440 list_add_tail(&p->run_list, &current->run_list);
1531 p->array = current->array; 1441 p->array = current->array;
1532 p->array->nr_active++; 1442 p->array->nr_active++;
1533 inc_nr_running(p, rq); 1443 rq->nr_running++;
1534 } 1444 }
1535 set_need_resched(); 1445 set_need_resched();
1536 } else 1446 } else
@@ -1875,9 +1785,9 @@ void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p,
1875 runqueue_t *this_rq, prio_array_t *this_array, int this_cpu) 1785 runqueue_t *this_rq, prio_array_t *this_array, int this_cpu)
1876{ 1786{
1877 dequeue_task(p, src_array); 1787 dequeue_task(p, src_array);
1878 dec_nr_running(p, src_rq); 1788 src_rq->nr_running--;
1879 set_task_cpu(p, this_cpu); 1789 set_task_cpu(p, this_cpu);
1880 inc_nr_running(p, this_rq); 1790 this_rq->nr_running++;
1881 enqueue_task(p, this_array); 1791 enqueue_task(p, this_array);
1882 p->timestamp = (p->timestamp - src_rq->timestamp_last_tick) 1792 p->timestamp = (p->timestamp - src_rq->timestamp_last_tick)
1883 + this_rq->timestamp_last_tick; 1793 + this_rq->timestamp_last_tick;
@@ -2056,9 +1966,9 @@ find_busiest_group(struct sched_domain *sd, int this_cpu,
2056 1966
2057 /* Bias balancing toward cpus of our domain */ 1967 /* Bias balancing toward cpus of our domain */
2058 if (local_group) 1968 if (local_group)
2059 load = __target_load(i, load_idx, idle); 1969 load = target_load(i, load_idx);
2060 else 1970 else
2061 load = __source_load(i, load_idx, idle); 1971 load = source_load(i, load_idx);
2062 1972
2063 avg_load += load; 1973 avg_load += load;
2064 } 1974 }
@@ -2171,7 +2081,7 @@ static runqueue_t *find_busiest_queue(struct sched_group *group,
2171 int i; 2081 int i;
2172 2082
2173 for_each_cpu_mask(i, group->cpumask) { 2083 for_each_cpu_mask(i, group->cpumask) {
2174 load = __source_load(i, 0, idle); 2084 load = source_load(i, 0);
2175 2085
2176 if (load > max_load) { 2086 if (load > max_load) {
2177 max_load = load; 2087 max_load = load;
@@ -3571,10 +3481,8 @@ void set_user_nice(task_t *p, long nice)
3571 goto out_unlock; 3481 goto out_unlock;
3572 } 3482 }
3573 array = p->array; 3483 array = p->array;
3574 if (array) { 3484 if (array)
3575 dequeue_task(p, array); 3485 dequeue_task(p, array);
3576 dec_prio_bias(rq, p->static_prio);
3577 }
3578 3486
3579 old_prio = p->prio; 3487 old_prio = p->prio;
3580 new_prio = NICE_TO_PRIO(nice); 3488 new_prio = NICE_TO_PRIO(nice);
@@ -3584,7 +3492,6 @@ void set_user_nice(task_t *p, long nice)
3584 3492
3585 if (array) { 3493 if (array) {
3586 enqueue_task(p, array); 3494 enqueue_task(p, array);
3587 inc_prio_bias(rq, p->static_prio);
3588 /* 3495 /*
3589 * If the task increased its priority or is running and 3496 * If the task increased its priority or is running and
3590 * lowered its priority, then reschedule its CPU: 3497 * lowered its priority, then reschedule its CPU:
diff --git a/kernel/signal.c b/kernel/signal.c
index b373fc2420da..ea154104a00b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2430,7 +2430,7 @@ sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo)
2430} 2430}
2431 2431
2432int 2432int
2433do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact) 2433do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2434{ 2434{
2435 struct k_sigaction *k; 2435 struct k_sigaction *k;
2436 sigset_t mask; 2436 sigset_t mask;
@@ -2454,6 +2454,8 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2454 *oact = *k; 2454 *oact = *k;
2455 2455
2456 if (act) { 2456 if (act) {
2457 sigdelsetmask(&act->sa.sa_mask,
2458 sigmask(SIGKILL) | sigmask(SIGSTOP));
2457 /* 2459 /*
2458 * POSIX 3.3.1.3: 2460 * POSIX 3.3.1.3:
2459 * "Setting a signal action to SIG_IGN for a signal that is 2461 * "Setting a signal action to SIG_IGN for a signal that is
@@ -2479,8 +2481,6 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2479 read_lock(&tasklist_lock); 2481 read_lock(&tasklist_lock);
2480 spin_lock_irq(&t->sighand->siglock); 2482 spin_lock_irq(&t->sighand->siglock);
2481 *k = *act; 2483 *k = *act;
2482 sigdelsetmask(&k->sa.sa_mask,
2483 sigmask(SIGKILL) | sigmask(SIGSTOP));
2484 sigemptyset(&mask); 2484 sigemptyset(&mask);
2485 sigaddset(&mask, sig); 2485 sigaddset(&mask, sig);
2486 rm_from_queue_full(&mask, &t->signal->shared_pending); 2486 rm_from_queue_full(&mask, &t->signal->shared_pending);
@@ -2495,8 +2495,6 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2495 } 2495 }
2496 2496
2497 *k = *act; 2497 *k = *act;
2498 sigdelsetmask(&k->sa.sa_mask,
2499 sigmask(SIGKILL) | sigmask(SIGSTOP));
2500 } 2498 }
2501 2499
2502 spin_unlock_irq(&current->sighand->siglock); 2500 spin_unlock_irq(&current->sighand->siglock);
@@ -2702,6 +2700,7 @@ sys_signal(int sig, __sighandler_t handler)
2702 2700
2703 new_sa.sa.sa_handler = handler; 2701 new_sa.sa.sa_handler = handler;
2704 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK; 2702 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
2703 sigemptyset(&new_sa.sa.sa_mask);
2705 2704
2706 ret = do_sigaction(sig, &new_sa, &old_sa); 2705 ret = do_sigaction(sig, &new_sa, &old_sa);
2707 2706
diff --git a/kernel/sys.c b/kernel/sys.c
index 0929c698affc..f91218a5463e 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -428,7 +428,7 @@ void kernel_kexec(void)
428{ 428{
429#ifdef CONFIG_KEXEC 429#ifdef CONFIG_KEXEC
430 struct kimage *image; 430 struct kimage *image;
431 image = xchg(&kexec_image, 0); 431 image = xchg(&kexec_image, NULL);
432 if (!image) { 432 if (!image) {
433 return; 433 return;
434 } 434 }
diff --git a/kernel/timer.c b/kernel/timer.c
index 4f1cb0ab5251..b9dad3994676 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -495,7 +495,7 @@ unsigned long next_timer_interrupt(void)
495 base = &__get_cpu_var(tvec_bases); 495 base = &__get_cpu_var(tvec_bases);
496 spin_lock(&base->t_base.lock); 496 spin_lock(&base->t_base.lock);
497 expires = base->timer_jiffies + (LONG_MAX >> 1); 497 expires = base->timer_jiffies + (LONG_MAX >> 1);
498 list = 0; 498 list = NULL;
499 499
500 /* Look for timer events in tv1. */ 500 /* Look for timer events in tv1. */
501 j = base->timer_jiffies & TVR_MASK; 501 j = base->timer_jiffies & TVR_MASK;
diff --git a/lib/kobject.c b/lib/kobject.c
index 7a0e6809490d..efe67fa96a71 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -72,6 +72,8 @@ static int get_kobj_path_length(struct kobject *kobj)
72 * Add 1 to strlen for leading '/' of each level. 72 * Add 1 to strlen for leading '/' of each level.
73 */ 73 */
74 do { 74 do {
75 if (kobject_name(parent) == NULL)
76 return 0;
75 length += strlen(kobject_name(parent)) + 1; 77 length += strlen(kobject_name(parent)) + 1;
76 parent = parent->parent; 78 parent = parent->parent;
77 } while (parent); 79 } while (parent);
@@ -107,6 +109,8 @@ char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
107 int len; 109 int len;
108 110
109 len = get_kobj_path_length(kobj); 111 len = get_kobj_path_length(kobj);
112 if (len == 0)
113 return NULL;
110 path = kmalloc(len, gfp_mask); 114 path = kmalloc(len, gfp_mask);
111 if (!path) 115 if (!path)
112 return NULL; 116 return NULL;
@@ -162,6 +166,11 @@ int kobject_add(struct kobject * kobj)
162 return -ENOENT; 166 return -ENOENT;
163 if (!kobj->k_name) 167 if (!kobj->k_name)
164 kobj->k_name = kobj->name; 168 kobj->k_name = kobj->name;
169 if (!kobj->k_name) {
170 pr_debug("kobject attempted to be registered with no name!\n");
171 WARN_ON(1);
172 return -EINVAL;
173 }
165 parent = kobject_get(kobj->parent); 174 parent = kobject_get(kobj->parent);
166 175
167 pr_debug("kobject %s: registering. parent: %s, set: %s\n", 176 pr_debug("kobject %s: registering. parent: %s, set: %s\n",
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index f56e27ae9d52..1b1985c136ec 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -22,7 +22,7 @@
22#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <net/sock.h> 23#include <net/sock.h>
24 24
25#define BUFFER_SIZE 1024 /* buffer for the variables */ 25#define BUFFER_SIZE 2048 /* buffer for the variables */
26#define NUM_ENVP 32 /* number of env pointers */ 26#define NUM_ENVP 32 /* number of env pointers */
27 27
28#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 28#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
index c8bb8cc899d7..d8b6bb419d49 100644
--- a/lib/spinlock_debug.c
+++ b/lib/spinlock_debug.c
@@ -72,9 +72,9 @@ static void __spin_lock_debug(spinlock_t *lock)
72 72
73 for (;;) { 73 for (;;) {
74 for (i = 0; i < loops_per_jiffy * HZ; i++) { 74 for (i = 0; i < loops_per_jiffy * HZ; i++) {
75 cpu_relax();
76 if (__raw_spin_trylock(&lock->raw_lock)) 75 if (__raw_spin_trylock(&lock->raw_lock))
77 return; 76 return;
77 __delay(1);
78 } 78 }
79 /* lockup suspected: */ 79 /* lockup suspected: */
80 if (print_once) { 80 if (print_once) {
@@ -144,9 +144,9 @@ static void __read_lock_debug(rwlock_t *lock)
144 144
145 for (;;) { 145 for (;;) {
146 for (i = 0; i < loops_per_jiffy * HZ; i++) { 146 for (i = 0; i < loops_per_jiffy * HZ; i++) {
147 cpu_relax();
148 if (__raw_read_trylock(&lock->raw_lock)) 147 if (__raw_read_trylock(&lock->raw_lock))
149 return; 148 return;
149 __delay(1);
150 } 150 }
151 /* lockup suspected: */ 151 /* lockup suspected: */
152 if (print_once) { 152 if (print_once) {
@@ -217,9 +217,9 @@ static void __write_lock_debug(rwlock_t *lock)
217 217
218 for (;;) { 218 for (;;) {
219 for (i = 0; i < loops_per_jiffy * HZ; i++) { 219 for (i = 0; i < loops_per_jiffy * HZ; i++) {
220 cpu_relax();
221 if (__raw_write_trylock(&lock->raw_lock)) 220 if (__raw_write_trylock(&lock->raw_lock))
222 return; 221 return;
222 __delay(1);
223 } 223 }
224 /* lockup suspected: */ 224 /* lockup suspected: */
225 if (print_once) { 225 if (print_once) {
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ceb3ebb3c399..67f29516662a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -107,7 +107,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
107 set_page_count(page, 1); 107 set_page_count(page, 1);
108 page[1].mapping = (void *)free_huge_page; 108 page[1].mapping = (void *)free_huge_page;
109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) 109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
110 clear_highpage(&page[i]); 110 clear_user_highpage(&page[i], addr);
111 return page; 111 return page;
112} 112}
113 113
@@ -391,12 +391,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
391 391
392 if (!new_page) { 392 if (!new_page) {
393 page_cache_release(old_page); 393 page_cache_release(old_page);
394 394 return VM_FAULT_OOM;
395 /* Logically this is OOM, not a SIGBUS, but an OOM
396 * could cause the kernel to go killing other
397 * processes which won't help the hugepage situation
398 * at all (?) */
399 return VM_FAULT_SIGBUS;
400 } 395 }
401 396
402 spin_unlock(&mm->page_table_lock); 397 spin_unlock(&mm->page_table_lock);
@@ -444,15 +439,7 @@ retry:
444 page = alloc_huge_page(vma, address); 439 page = alloc_huge_page(vma, address);
445 if (!page) { 440 if (!page) {
446 hugetlb_put_quota(mapping); 441 hugetlb_put_quota(mapping);
447 /* 442 ret = VM_FAULT_OOM;
448 * No huge pages available. So this is an OOM
449 * condition but we do not want to trigger the OOM
450 * killer, so we return VM_FAULT_SIGBUS.
451 *
452 * A program using hugepages may fault with Bus Error
453 * because no huge pages are available in the cpuset, per
454 * memory policy or because all are in use!
455 */
456 goto out; 443 goto out;
457 } 444 }
458 445
diff --git a/mm/slab.c b/mm/slab.c
index d66c2b0d9715..add05d808a4a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1717,6 +1717,12 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1717 BUG(); 1717 BUG();
1718 } 1718 }
1719 1719
1720 /*
1721 * Prevent CPUs from coming and going.
1722 * lock_cpu_hotplug() nests outside cache_chain_mutex
1723 */
1724 lock_cpu_hotplug();
1725
1720 mutex_lock(&cache_chain_mutex); 1726 mutex_lock(&cache_chain_mutex);
1721 1727
1722 list_for_each(p, &cache_chain) { 1728 list_for_each(p, &cache_chain) {
@@ -1918,8 +1924,6 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1918 cachep->dtor = dtor; 1924 cachep->dtor = dtor;
1919 cachep->name = name; 1925 cachep->name = name;
1920 1926
1921 /* Don't let CPUs to come and go */
1922 lock_cpu_hotplug();
1923 1927
1924 if (g_cpucache_up == FULL) { 1928 if (g_cpucache_up == FULL) {
1925 enable_cpucache(cachep); 1929 enable_cpucache(cachep);
@@ -1978,12 +1982,12 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1978 1982
1979 /* cache setup completed, link it into the list */ 1983 /* cache setup completed, link it into the list */
1980 list_add(&cachep->next, &cache_chain); 1984 list_add(&cachep->next, &cache_chain);
1981 unlock_cpu_hotplug();
1982 oops: 1985 oops:
1983 if (!cachep && (flags & SLAB_PANIC)) 1986 if (!cachep && (flags & SLAB_PANIC))
1984 panic("kmem_cache_create(): failed to create slab `%s'\n", 1987 panic("kmem_cache_create(): failed to create slab `%s'\n",
1985 name); 1988 name);
1986 mutex_unlock(&cache_chain_mutex); 1989 mutex_unlock(&cache_chain_mutex);
1990 unlock_cpu_hotplug();
1987 return cachep; 1991 return cachep;
1988} 1992}
1989EXPORT_SYMBOL(kmem_cache_create); 1993EXPORT_SYMBOL(kmem_cache_create);
diff --git a/mm/slob.c b/mm/slob.c
index 1c240c4b71d9..a1f42bdc0245 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(slab_reclaim_pages);
336 336
337#ifdef CONFIG_SMP 337#ifdef CONFIG_SMP
338 338
339void *__alloc_percpu(size_t size, size_t align) 339void *__alloc_percpu(size_t size)
340{ 340{
341 int i; 341 int i;
342 struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL); 342 struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL);
diff --git a/mm/swap.c b/mm/swap.c
index bc2442a7b0ee..76247424dea1 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -34,19 +34,22 @@
34/* How many pages do we try to swap or page in/out together? */ 34/* How many pages do we try to swap or page in/out together? */
35int page_cluster; 35int page_cluster;
36 36
37void put_page(struct page *page) 37static void put_compound_page(struct page *page)
38{ 38{
39 if (unlikely(PageCompound(page))) { 39 page = (struct page *)page_private(page);
40 page = (struct page *)page_private(page); 40 if (put_page_testzero(page)) {
41 if (put_page_testzero(page)) { 41 void (*dtor)(struct page *page);
42 void (*dtor)(struct page *page);
43 42
44 dtor = (void (*)(struct page *))page[1].mapping; 43 dtor = (void (*)(struct page *))page[1].mapping;
45 (*dtor)(page); 44 (*dtor)(page);
46 }
47 return;
48 } 45 }
49 if (put_page_testzero(page)) 46}
47
48void put_page(struct page *page)
49{
50 if (unlikely(PageCompound(page)))
51 put_compound_page(page);
52 else if (put_page_testzero(page))
50 __page_cache_release(page); 53 __page_cache_release(page);
51} 54}
52EXPORT_SYMBOL(put_page); 55EXPORT_SYMBOL(put_page);
@@ -244,6 +247,15 @@ void release_pages(struct page **pages, int nr, int cold)
244 struct page *page = pages[i]; 247 struct page *page = pages[i];
245 struct zone *pagezone; 248 struct zone *pagezone;
246 249
250 if (unlikely(PageCompound(page))) {
251 if (zone) {
252 spin_unlock_irq(&zone->lru_lock);
253 zone = NULL;
254 }
255 put_compound_page(page);
256 continue;
257 }
258
247 if (!put_page_testzero(page)) 259 if (!put_page_testzero(page))
248 continue; 260 continue;
249 261
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5a610804cd06..5db32fdfaf39 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -632,7 +632,7 @@ static int swap_page(struct page *page)
632 struct address_space *mapping = page_mapping(page); 632 struct address_space *mapping = page_mapping(page);
633 633
634 if (page_mapped(page) && mapping) 634 if (page_mapped(page) && mapping)
635 if (try_to_unmap(page, 0) != SWAP_SUCCESS) 635 if (try_to_unmap(page, 1) != SWAP_SUCCESS)
636 goto unlock_retry; 636 goto unlock_retry;
637 637
638 if (PageDirty(page)) { 638 if (PageDirty(page)) {
@@ -839,7 +839,7 @@ EXPORT_SYMBOL(migrate_page);
839 * pages are swapped out. 839 * pages are swapped out.
840 * 840 *
841 * The function returns after 10 attempts or if no pages 841 * The function returns after 10 attempts or if no pages
842 * are movable anymore because t has become empty 842 * are movable anymore because to has become empty
843 * or no retryable pages exist anymore. 843 * or no retryable pages exist anymore.
844 * 844 *
845 * Return: Number of pages not migrated when "to" ran empty. 845 * Return: Number of pages not migrated when "to" ran empty.
@@ -928,12 +928,21 @@ redo:
928 goto unlock_both; 928 goto unlock_both;
929 929
930 if (mapping->a_ops->migratepage) { 930 if (mapping->a_ops->migratepage) {
931 /*
932 * Most pages have a mapping and most filesystems
933 * should provide a migration function. Anonymous
934 * pages are part of swap space which also has its
935 * own migration function. This is the most common
936 * path for page migration.
937 */
931 rc = mapping->a_ops->migratepage(newpage, page); 938 rc = mapping->a_ops->migratepage(newpage, page);
932 goto unlock_both; 939 goto unlock_both;
933 } 940 }
934 941
935 /* 942 /*
936 * Trigger writeout if page is dirty 943 * Default handling if a filesystem does not provide
944 * a migration function. We can only migrate clean
945 * pages so try to write out any dirty pages first.
937 */ 946 */
938 if (PageDirty(page)) { 947 if (PageDirty(page)) {
939 switch (pageout(page, mapping)) { 948 switch (pageout(page, mapping)) {
@@ -949,9 +958,10 @@ redo:
949 ; /* try to migrate the page below */ 958 ; /* try to migrate the page below */
950 } 959 }
951 } 960 }
961
952 /* 962 /*
953 * If we have no buffer or can release the buffer 963 * Buffers are managed in a filesystem specific way.
954 * then do a simple migration. 964 * We must have no buffers or drop them.
955 */ 965 */
956 if (!page_has_buffers(page) || 966 if (!page_has_buffers(page) ||
957 try_to_release_page(page, GFP_KERNEL)) { 967 try_to_release_page(page, GFP_KERNEL)) {
@@ -966,6 +976,11 @@ redo:
966 * swap them out. 976 * swap them out.
967 */ 977 */
968 if (pass > 4) { 978 if (pass > 4) {
979 /*
980 * Persistently unable to drop buffers..... As a
981 * measure of last resort we fall back to
982 * swap_page().
983 */
969 unlock_page(newpage); 984 unlock_page(newpage);
970 newpage = NULL; 985 newpage = NULL;
971 rc = swap_page(page); 986 rc = swap_page(page);
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index da687c8dc6ff..7fa3a5a9971f 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -79,9 +79,14 @@ static int port_cost(struct net_device *dev)
79 */ 79 */
80static void port_carrier_check(void *arg) 80static void port_carrier_check(void *arg)
81{ 81{
82 struct net_bridge_port *p = arg; 82 struct net_device *dev = arg;
83 struct net_bridge_port *p;
83 84
84 rtnl_lock(); 85 rtnl_lock();
86 p = dev->br_port;
87 if (!p)
88 goto done;
89
85 if (netif_carrier_ok(p->dev)) { 90 if (netif_carrier_ok(p->dev)) {
86 u32 cost = port_cost(p->dev); 91 u32 cost = port_cost(p->dev);
87 92
@@ -97,19 +102,33 @@ static void port_carrier_check(void *arg)
97 br_stp_disable_port(p); 102 br_stp_disable_port(p);
98 spin_unlock_bh(&p->br->lock); 103 spin_unlock_bh(&p->br->lock);
99 } 104 }
105done:
100 rtnl_unlock(); 106 rtnl_unlock();
101} 107}
102 108
109static void release_nbp(struct kobject *kobj)
110{
111 struct net_bridge_port *p
112 = container_of(kobj, struct net_bridge_port, kobj);
113 kfree(p);
114}
115
116static struct kobj_type brport_ktype = {
117#ifdef CONFIG_SYSFS
118 .sysfs_ops = &brport_sysfs_ops,
119#endif
120 .release = release_nbp,
121};
122
103static void destroy_nbp(struct net_bridge_port *p) 123static void destroy_nbp(struct net_bridge_port *p)
104{ 124{
105 struct net_device *dev = p->dev; 125 struct net_device *dev = p->dev;
106 126
107 dev->br_port = NULL;
108 p->br = NULL; 127 p->br = NULL;
109 p->dev = NULL; 128 p->dev = NULL;
110 dev_put(dev); 129 dev_put(dev);
111 130
112 br_sysfs_freeif(p); 131 kobject_put(&p->kobj);
113} 132}
114 133
115static void destroy_nbp_rcu(struct rcu_head *head) 134static void destroy_nbp_rcu(struct rcu_head *head)
@@ -133,24 +152,24 @@ static void del_nbp(struct net_bridge_port *p)
133 struct net_bridge *br = p->br; 152 struct net_bridge *br = p->br;
134 struct net_device *dev = p->dev; 153 struct net_device *dev = p->dev;
135 154
136 /* Race between RTNL notify and RCU callback */ 155 sysfs_remove_link(&br->ifobj, dev->name);
137 if (p->deleted)
138 return;
139 156
140 dev_set_promiscuity(dev, -1); 157 dev_set_promiscuity(dev, -1);
141 158
142 cancel_delayed_work(&p->carrier_check); 159 cancel_delayed_work(&p->carrier_check);
143 flush_scheduled_work();
144 160
145 spin_lock_bh(&br->lock); 161 spin_lock_bh(&br->lock);
146 br_stp_disable_port(p); 162 br_stp_disable_port(p);
147 p->deleted = 1;
148 spin_unlock_bh(&br->lock); 163 spin_unlock_bh(&br->lock);
149 164
150 br_fdb_delete_by_port(br, p); 165 br_fdb_delete_by_port(br, p);
151 166
152 list_del_rcu(&p->list); 167 list_del_rcu(&p->list);
153 168
169 rcu_assign_pointer(dev->br_port, NULL);
170
171 kobject_del(&p->kobj);
172
154 call_rcu(&p->rcu, destroy_nbp_rcu); 173 call_rcu(&p->rcu, destroy_nbp_rcu);
155} 174}
156 175
@@ -160,7 +179,6 @@ static void del_br(struct net_bridge *br)
160 struct net_bridge_port *p, *n; 179 struct net_bridge_port *p, *n;
161 180
162 list_for_each_entry_safe(p, n, &br->port_list, list) { 181 list_for_each_entry_safe(p, n, &br->port_list, list) {
163 br_sysfs_removeif(p);
164 del_nbp(p); 182 del_nbp(p);
165 } 183 }
166 184
@@ -254,13 +272,17 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
254 p->dev = dev; 272 p->dev = dev;
255 p->path_cost = port_cost(dev); 273 p->path_cost = port_cost(dev);
256 p->priority = 0x8000 >> BR_PORT_BITS; 274 p->priority = 0x8000 >> BR_PORT_BITS;
257 dev->br_port = p;
258 p->port_no = index; 275 p->port_no = index;
259 br_init_port(p); 276 br_init_port(p);
260 p->state = BR_STATE_DISABLED; 277 p->state = BR_STATE_DISABLED;
261 INIT_WORK(&p->carrier_check, port_carrier_check, p); 278 INIT_WORK(&p->carrier_check, port_carrier_check, dev);
262 kobject_init(&p->kobj); 279 kobject_init(&p->kobj);
263 280
281 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
282 p->kobj.ktype = &brport_ktype;
283 p->kobj.parent = &(dev->class_dev.kobj);
284 p->kobj.kset = NULL;
285
264 return p; 286 return p;
265} 287}
266 288
@@ -388,30 +410,43 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
388 if (dev->br_port != NULL) 410 if (dev->br_port != NULL)
389 return -EBUSY; 411 return -EBUSY;
390 412
391 if (IS_ERR(p = new_nbp(br, dev))) 413 p = new_nbp(br, dev);
414 if (IS_ERR(p))
392 return PTR_ERR(p); 415 return PTR_ERR(p);
393 416
394 if ((err = br_fdb_insert(br, p, dev->dev_addr))) 417 err = kobject_add(&p->kobj);
395 destroy_nbp(p); 418 if (err)
396 419 goto err0;
397 else if ((err = br_sysfs_addif(p)))
398 del_nbp(p);
399 else {
400 dev_set_promiscuity(dev, 1);
401 420
402 list_add_rcu(&p->list, &br->port_list); 421 err = br_fdb_insert(br, p, dev->dev_addr);
422 if (err)
423 goto err1;
403 424
404 spin_lock_bh(&br->lock); 425 err = br_sysfs_addif(p);
405 br_stp_recalculate_bridge_id(br); 426 if (err)
406 br_features_recompute(br); 427 goto err2;
407 if ((br->dev->flags & IFF_UP)
408 && (dev->flags & IFF_UP) && netif_carrier_ok(dev))
409 br_stp_enable_port(p);
410 spin_unlock_bh(&br->lock);
411 428
412 dev_set_mtu(br->dev, br_min_mtu(br)); 429 rcu_assign_pointer(dev->br_port, p);
413 } 430 dev_set_promiscuity(dev, 1);
431
432 list_add_rcu(&p->list, &br->port_list);
414 433
434 spin_lock_bh(&br->lock);
435 br_stp_recalculate_bridge_id(br);
436 br_features_recompute(br);
437 schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE);
438 spin_unlock_bh(&br->lock);
439
440 dev_set_mtu(br->dev, br_min_mtu(br));
441 kobject_uevent(&p->kobj, KOBJ_ADD);
442
443 return 0;
444err2:
445 br_fdb_delete_by_port(br, p);
446err1:
447 kobject_del(&p->kobj);
448err0:
449 kobject_put(&p->kobj);
415 return err; 450 return err;
416} 451}
417 452
@@ -423,7 +458,6 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
423 if (!p || p->br != br) 458 if (!p || p->br != br)
424 return -EINVAL; 459 return -EINVAL;
425 460
426 br_sysfs_removeif(p);
427 del_nbp(p); 461 del_nbp(p);
428 462
429 spin_lock_bh(&br->lock); 463 spin_lock_bh(&br->lock);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index e3a73cead6b6..4eef83755315 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -45,18 +45,20 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb)
45int br_handle_frame_finish(struct sk_buff *skb) 45int br_handle_frame_finish(struct sk_buff *skb)
46{ 46{
47 const unsigned char *dest = eth_hdr(skb)->h_dest; 47 const unsigned char *dest = eth_hdr(skb)->h_dest;
48 struct net_bridge_port *p = skb->dev->br_port; 48 struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
49 struct net_bridge *br = p->br; 49 struct net_bridge *br;
50 struct net_bridge_fdb_entry *dst; 50 struct net_bridge_fdb_entry *dst;
51 int passedup = 0; 51 int passedup = 0;
52 52
53 if (!p || p->state == BR_STATE_DISABLED)
54 goto drop;
55
53 /* insert into forwarding database after filtering to avoid spoofing */ 56 /* insert into forwarding database after filtering to avoid spoofing */
54 br_fdb_update(p->br, p, eth_hdr(skb)->h_source); 57 br = p->br;
58 br_fdb_update(br, p, eth_hdr(skb)->h_source);
55 59
56 if (p->state == BR_STATE_LEARNING) { 60 if (p->state == BR_STATE_LEARNING)
57 kfree_skb(skb); 61 goto drop;
58 goto out;
59 }
60 62
61 if (br->dev->flags & IFF_PROMISC) { 63 if (br->dev->flags & IFF_PROMISC) {
62 struct sk_buff *skb2; 64 struct sk_buff *skb2;
@@ -93,6 +95,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
93 95
94out: 96out:
95 return 0; 97 return 0;
98drop:
99 kfree_skb(skb);
100 goto out;
96} 101}
97 102
98/* 103/*
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 7cac3fb9f809..b5018166b0e5 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -51,9 +51,6 @@
51#define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr) 51#define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr)
52#define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr) 52#define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr)
53 53
54#define has_bridge_parent(device) ((device)->br_port != NULL)
55#define bridge_parent(device) ((device)->br_port->br->dev)
56
57#ifdef CONFIG_SYSCTL 54#ifdef CONFIG_SYSCTL
58static struct ctl_table_header *brnf_sysctl_header; 55static struct ctl_table_header *brnf_sysctl_header;
59static int brnf_call_iptables = 1; 56static int brnf_call_iptables = 1;
@@ -98,6 +95,12 @@ static struct rtable __fake_rtable = {
98 .rt_flags = 0, 95 .rt_flags = 0,
99}; 96};
100 97
98static inline struct net_device *bridge_parent(const struct net_device *dev)
99{
100 struct net_bridge_port *port = rcu_dereference(dev->br_port);
101
102 return port ? port->br->dev : NULL;
103}
101 104
102/* PF_BRIDGE/PRE_ROUTING *********************************************/ 105/* PF_BRIDGE/PRE_ROUTING *********************************************/
103/* Undo the changes made for ip6tables PREROUTING and continue the 106/* Undo the changes made for ip6tables PREROUTING and continue the
@@ -189,11 +192,15 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
189 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 192 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
190 193
191 skb->dev = bridge_parent(skb->dev); 194 skb->dev = bridge_parent(skb->dev);
192 if (skb->protocol == __constant_htons(ETH_P_8021Q)) { 195 if (!skb->dev)
193 skb_pull(skb, VLAN_HLEN); 196 kfree_skb(skb);
194 skb->nh.raw += VLAN_HLEN; 197 else {
198 if (skb->protocol == __constant_htons(ETH_P_8021Q)) {
199 skb_pull(skb, VLAN_HLEN);
200 skb->nh.raw += VLAN_HLEN;
201 }
202 skb->dst->output(skb);
195 } 203 }
196 skb->dst->output(skb);
197 return 0; 204 return 0;
198} 205}
199 206
@@ -270,7 +277,7 @@ bridged_dnat:
270} 277}
271 278
272/* Some common code for IPv4/IPv6 */ 279/* Some common code for IPv4/IPv6 */
273static void setup_pre_routing(struct sk_buff *skb) 280static struct net_device *setup_pre_routing(struct sk_buff *skb)
274{ 281{
275 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 282 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
276 283
@@ -282,6 +289,8 @@ static void setup_pre_routing(struct sk_buff *skb)
282 nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING; 289 nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING;
283 nf_bridge->physindev = skb->dev; 290 nf_bridge->physindev = skb->dev;
284 skb->dev = bridge_parent(skb->dev); 291 skb->dev = bridge_parent(skb->dev);
292
293 return skb->dev;
285} 294}
286 295
287/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */ 296/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */
@@ -376,7 +385,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
376 nf_bridge_put(skb->nf_bridge); 385 nf_bridge_put(skb->nf_bridge);
377 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) 386 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
378 return NF_DROP; 387 return NF_DROP;
379 setup_pre_routing(skb); 388 if (!setup_pre_routing(skb))
389 return NF_DROP;
380 390
381 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, 391 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
382 br_nf_pre_routing_finish_ipv6); 392 br_nf_pre_routing_finish_ipv6);
@@ -465,7 +475,8 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
465 nf_bridge_put(skb->nf_bridge); 475 nf_bridge_put(skb->nf_bridge);
466 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) 476 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
467 return NF_DROP; 477 return NF_DROP;
468 setup_pre_routing(skb); 478 if (!setup_pre_routing(skb))
479 return NF_DROP;
469 store_orig_dstaddr(skb); 480 store_orig_dstaddr(skb);
470 481
471 NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, 482 NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL,
@@ -539,11 +550,16 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb,
539 struct sk_buff *skb = *pskb; 550 struct sk_buff *skb = *pskb;
540 struct nf_bridge_info *nf_bridge; 551 struct nf_bridge_info *nf_bridge;
541 struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); 552 struct vlan_ethhdr *hdr = vlan_eth_hdr(skb);
553 struct net_device *parent;
542 int pf; 554 int pf;
543 555
544 if (!skb->nf_bridge) 556 if (!skb->nf_bridge)
545 return NF_ACCEPT; 557 return NF_ACCEPT;
546 558
559 parent = bridge_parent(out);
560 if (!parent)
561 return NF_DROP;
562
547 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) 563 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP)
548 pf = PF_INET; 564 pf = PF_INET;
549 else 565 else
@@ -564,8 +580,8 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb,
564 nf_bridge->mask |= BRNF_BRIDGED; 580 nf_bridge->mask |= BRNF_BRIDGED;
565 nf_bridge->physoutdev = skb->dev; 581 nf_bridge->physoutdev = skb->dev;
566 582
567 NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), 583 NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), parent,
568 bridge_parent(out), br_nf_forward_finish); 584 br_nf_forward_finish);
569 585
570 return NF_STOLEN; 586 return NF_STOLEN;
571} 587}
@@ -688,6 +704,8 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb,
688 goto out; 704 goto out;
689 } 705 }
690 realoutdev = bridge_parent(skb->dev); 706 realoutdev = bridge_parent(skb->dev);
707 if (!realoutdev)
708 return NF_DROP;
691 709
692#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 710#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
693 /* iptables should match -o br0.x */ 711 /* iptables should match -o br0.x */
@@ -701,9 +719,11 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb,
701 /* IP forwarded traffic has a physindev, locally 719 /* IP forwarded traffic has a physindev, locally
702 * generated traffic hasn't. */ 720 * generated traffic hasn't. */
703 if (realindev != NULL) { 721 if (realindev != NULL) {
704 if (!(nf_bridge->mask & BRNF_DONT_TAKE_PARENT) && 722 if (!(nf_bridge->mask & BRNF_DONT_TAKE_PARENT) ) {
705 has_bridge_parent(realindev)) 723 struct net_device *parent = bridge_parent(realindev);
706 realindev = bridge_parent(realindev); 724 if (parent)
725 realindev = parent;
726 }
707 727
708 NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev, 728 NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev,
709 realoutdev, br_nf_local_out_finish, 729 realoutdev, br_nf_local_out_finish,
@@ -743,6 +763,9 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
743 if (!nf_bridge) 763 if (!nf_bridge)
744 return NF_ACCEPT; 764 return NF_ACCEPT;
745 765
766 if (!realoutdev)
767 return NF_DROP;
768
746 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) 769 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP)
747 pf = PF_INET; 770 pf = PF_INET;
748 else 771 else
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index e330b17b6d81..8f10e09f251b 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -68,7 +68,6 @@ struct net_bridge_port
68 /* STP */ 68 /* STP */
69 u8 priority; 69 u8 priority;
70 u8 state; 70 u8 state;
71 u8 deleted;
72 u16 port_no; 71 u16 port_no;
73 unsigned char topology_change_ack; 72 unsigned char topology_change_ack;
74 unsigned char config_pending; 73 unsigned char config_pending;
@@ -233,9 +232,8 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
233 232
234#ifdef CONFIG_SYSFS 233#ifdef CONFIG_SYSFS
235/* br_sysfs_if.c */ 234/* br_sysfs_if.c */
235extern struct sysfs_ops brport_sysfs_ops;
236extern int br_sysfs_addif(struct net_bridge_port *p); 236extern int br_sysfs_addif(struct net_bridge_port *p);
237extern void br_sysfs_removeif(struct net_bridge_port *p);
238extern void br_sysfs_freeif(struct net_bridge_port *p);
239 237
240/* br_sysfs_br.c */ 238/* br_sysfs_br.c */
241extern int br_sysfs_addbr(struct net_device *dev); 239extern int br_sysfs_addbr(struct net_device *dev);
@@ -244,8 +242,6 @@ extern void br_sysfs_delbr(struct net_device *dev);
244#else 242#else
245 243
246#define br_sysfs_addif(p) (0) 244#define br_sysfs_addif(p) (0)
247#define br_sysfs_removeif(p) do { } while(0)
248#define br_sysfs_freeif(p) kfree(p)
249#define br_sysfs_addbr(dev) (0) 245#define br_sysfs_addbr(dev) (0)
250#define br_sysfs_delbr(dev) do { } while(0) 246#define br_sysfs_delbr(dev) do { } while(0)
251#endif /* CONFIG_SYSFS */ 247#endif /* CONFIG_SYSFS */
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index d071f1c9ad0b..296f6a487c52 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -133,29 +133,35 @@ void br_send_tcn_bpdu(struct net_bridge_port *p)
133 133
134static const unsigned char header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00}; 134static const unsigned char header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00};
135 135
136/* NO locks */ 136/* NO locks, but rcu_read_lock (preempt_disabled) */
137int br_stp_handle_bpdu(struct sk_buff *skb) 137int br_stp_handle_bpdu(struct sk_buff *skb)
138{ 138{
139 struct net_bridge_port *p = skb->dev->br_port; 139 struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
140 struct net_bridge *br = p->br; 140 struct net_bridge *br;
141 unsigned char *buf; 141 unsigned char *buf;
142 142
143 if (!p)
144 goto err;
145
146 br = p->br;
147 spin_lock(&br->lock);
148
149 if (p->state == BR_STATE_DISABLED || !(br->dev->flags & IFF_UP))
150 goto out;
151
143 /* insert into forwarding database after filtering to avoid spoofing */ 152 /* insert into forwarding database after filtering to avoid spoofing */
144 br_fdb_update(p->br, p, eth_hdr(skb)->h_source); 153 br_fdb_update(br, p, eth_hdr(skb)->h_source);
154
155 if (!br->stp_enabled)
156 goto out;
145 157
146 /* need at least the 802 and STP headers */ 158 /* need at least the 802 and STP headers */
147 if (!pskb_may_pull(skb, sizeof(header)+1) || 159 if (!pskb_may_pull(skb, sizeof(header)+1) ||
148 memcmp(skb->data, header, sizeof(header))) 160 memcmp(skb->data, header, sizeof(header)))
149 goto err; 161 goto out;
150 162
151 buf = skb_pull(skb, sizeof(header)); 163 buf = skb_pull(skb, sizeof(header));
152 164
153 spin_lock_bh(&br->lock);
154 if (p->state == BR_STATE_DISABLED
155 || !(br->dev->flags & IFF_UP)
156 || !br->stp_enabled)
157 goto out;
158
159 if (buf[0] == BPDU_TYPE_CONFIG) { 165 if (buf[0] == BPDU_TYPE_CONFIG) {
160 struct br_config_bpdu bpdu; 166 struct br_config_bpdu bpdu;
161 167
@@ -201,7 +207,7 @@ int br_stp_handle_bpdu(struct sk_buff *skb)
201 br_received_tcn_bpdu(p); 207 br_received_tcn_bpdu(p);
202 } 208 }
203 out: 209 out:
204 spin_unlock_bh(&br->lock); 210 spin_unlock(&br->lock);
205 err: 211 err:
206 kfree_skb(skb); 212 kfree_skb(skb);
207 return 0; 213 return 0;
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 0ac0355d16dd..c51c9e42aeb3 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -195,23 +195,11 @@ static ssize_t brport_store(struct kobject * kobj,
195 return ret; 195 return ret;
196} 196}
197 197
198/* called from kobject_put when port ref count goes to zero. */ 198struct sysfs_ops brport_sysfs_ops = {
199static void brport_release(struct kobject *kobj)
200{
201 kfree(container_of(kobj, struct net_bridge_port, kobj));
202}
203
204static struct sysfs_ops brport_sysfs_ops = {
205 .show = brport_show, 199 .show = brport_show,
206 .store = brport_store, 200 .store = brport_store,
207}; 201};
208 202
209static struct kobj_type brport_ktype = {
210 .sysfs_ops = &brport_sysfs_ops,
211 .release = brport_release,
212};
213
214
215/* 203/*
216 * Add sysfs entries to ethernet device added to a bridge. 204 * Add sysfs entries to ethernet device added to a bridge.
217 * Creates a brport subdirectory with bridge attributes. 205 * Creates a brport subdirectory with bridge attributes.
@@ -223,17 +211,6 @@ int br_sysfs_addif(struct net_bridge_port *p)
223 struct brport_attribute **a; 211 struct brport_attribute **a;
224 int err; 212 int err;
225 213
226 ASSERT_RTNL();
227
228 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
229 p->kobj.ktype = &brport_ktype;
230 p->kobj.parent = &(p->dev->class_dev.kobj);
231 p->kobj.kset = NULL;
232
233 err = kobject_add(&p->kobj);
234 if(err)
235 goto out1;
236
237 err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, 214 err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj,
238 SYSFS_BRIDGE_PORT_LINK); 215 SYSFS_BRIDGE_PORT_LINK);
239 if (err) 216 if (err)
@@ -245,28 +222,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
245 goto out2; 222 goto out2;
246 } 223 }
247 224
248 err = sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); 225 err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name);
249 if (err) 226out2:
250 goto out2;
251
252 kobject_uevent(&p->kobj, KOBJ_ADD);
253 return 0;
254 out2:
255 kobject_del(&p->kobj);
256 out1:
257 return err; 227 return err;
258} 228}
259
260void br_sysfs_removeif(struct net_bridge_port *p)
261{
262 pr_debug("br_sysfs_removeif\n");
263 sysfs_remove_link(&p->br->ifobj, p->dev->name);
264 kobject_uevent(&p->kobj, KOBJ_REMOVE);
265 kobject_del(&p->kobj);
266}
267
268void br_sysfs_freeif(struct net_bridge_port *p)
269{
270 pr_debug("br_sysfs_freeif\n");
271 kobject_put(&p->kobj);
272}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8700379685e0..eca2976abb25 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -455,7 +455,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
455 if (!skb) 455 if (!skb)
456 return; 456 return;
457 457
458 if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) { 458 if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) {
459 kfree_skb(skb); 459 kfree_skb(skb);
460 return; 460 return;
461 } 461 }
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index d2b5933b4510..add3cae65e2d 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -15,7 +15,6 @@
15#include <linux/config.h> 15#include <linux/config.h>
16#include <linux/module.h> 16#include <linux/module.h>
17 17
18#include <asm/bug.h>
19#include <asm/div64.h> 18#include <asm/div64.h>
20 19
21#include "tfrc.h" 20#include "tfrc.h"
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 95b9d81ac488..3ffa60dadc0c 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1135,7 +1135,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa)
1135 1135
1136 if (!skb) 1136 if (!skb)
1137 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS); 1137 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
1138 else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) { 1138 else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
1139 kfree_skb(skb); 1139 kfree_skb(skb);
1140 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL); 1140 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
1141 } else { 1141 } else {
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index ef4724de7350..0f4145babb14 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1045,7 +1045,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
1045 } 1045 }
1046 1046
1047 nl->nlmsg_flags = NLM_F_REQUEST; 1047 nl->nlmsg_flags = NLM_F_REQUEST;
1048 nl->nlmsg_pid = current->pid; 1048 nl->nlmsg_pid = 0;
1049 nl->nlmsg_seq = 0; 1049 nl->nlmsg_seq = 0;
1050 nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm)); 1050 nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
1051 if (cmd == SIOCDELRT) { 1051 if (cmd == SIOCDELRT) {
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 0b4e95f93dad..64ce52bf0485 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1578,7 +1578,7 @@ static int sf_setstate(struct ip_mc_list *pmc)
1578 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1578 new_in = psf->sf_count[MCAST_INCLUDE] != 0;
1579 if (new_in) { 1579 if (new_in) {
1580 if (!psf->sf_oldin) { 1580 if (!psf->sf_oldin) {
1581 struct ip_sf_list *prev = 0; 1581 struct ip_sf_list *prev = NULL;
1582 1582
1583 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) { 1583 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) {
1584 if (dpsf->sf_inaddr == psf->sf_inaddr) 1584 if (dpsf->sf_inaddr == psf->sf_inaddr)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a97ed5416c28..e9a54ae7d690 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -456,7 +456,8 @@ void tcp_rcv_space_adjust(struct sock *sk)
456 456
457 tp->rcvq_space.space = space; 457 tp->rcvq_space.space = space;
458 458
459 if (sysctl_tcp_moderate_rcvbuf) { 459 if (sysctl_tcp_moderate_rcvbuf &&
460 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
460 int new_clamp = space; 461 int new_clamp = space;
461 462
462 /* Receive space grows, normalize in order to 463 /* Receive space grows, normalize in order to
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 42196ba3b0b9..45f7ae58f2c0 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -8,7 +8,6 @@
8 * 8 *
9 */ 9 */
10 10
11#include <asm/bug.h>
12#include <linux/compiler.h> 11#include <linux/compiler.h>
13#include <linux/config.h> 12#include <linux/config.h>
14#include <linux/inetdevice.h> 13#include <linux/inetdevice.h>
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1db50487916b..b7d8822c1be4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2165,6 +2165,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2165 dev->name); 2165 dev->name);
2166 break; 2166 break;
2167 } 2167 }
2168
2169 if (idev)
2170 idev->if_flags |= IF_READY;
2168 } else { 2171 } else {
2169 if (!netif_carrier_ok(dev)) { 2172 if (!netif_carrier_ok(dev)) {
2170 /* device is still not ready. */ 2173 /* device is still not ready. */
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 4420948a1bfe..807c021d64a2 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1978,7 +1978,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
1978 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1978 new_in = psf->sf_count[MCAST_INCLUDE] != 0;
1979 if (new_in) { 1979 if (new_in) {
1980 if (!psf->sf_oldin) { 1980 if (!psf->sf_oldin) {
1981 struct ip6_sf_list *prev = 0; 1981 struct ip6_sf_list *prev = NULL;
1982 1982
1983 for (dpsf=pmc->mca_tomb; dpsf; 1983 for (dpsf=pmc->mca_tomb; dpsf;
1984 dpsf=dpsf->sf_next) { 1984 dpsf=dpsf->sf_next) {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 66f1d12ea578..738376cf0c51 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -35,7 +35,6 @@
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/ioctls.h> 37#include <asm/ioctls.h>
38#include <asm/bug.h>
39 38
40#include <net/ip.h> 39#include <net/ip.h>
41#include <net/sock.h> 40#include <net/sock.h>
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 69bd957380e7..91cce8b2d7a5 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -11,7 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14#include <asm/bug.h>
15#include <linux/compiler.h> 14#include <linux/compiler.h>
16#include <linux/config.h> 15#include <linux/config.h>
17#include <linux/netdevice.h> 16#include <linux/netdevice.h>
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index 890bac0d4a56..e3debbdb67f5 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -343,12 +343,12 @@ static void irda_task_timer_expired(void *data)
343static void irda_device_setup(struct net_device *dev) 343static void irda_device_setup(struct net_device *dev)
344{ 344{
345 dev->hard_header_len = 0; 345 dev->hard_header_len = 0;
346 dev->addr_len = 0; 346 dev->addr_len = LAP_ALEN;
347 347
348 dev->type = ARPHRD_IRDA; 348 dev->type = ARPHRD_IRDA;
349 dev->tx_queue_len = 8; /* Window size + 1 s-frame */ 349 dev->tx_queue_len = 8; /* Window size + 1 s-frame */
350 350
351 memset(dev->broadcast, 0xff, 4); 351 memset(dev->broadcast, 0xff, LAP_ALEN);
352 352
353 dev->mtu = 2048; 353 dev->mtu = 2048;
354 dev->flags = IFF_NOARP; 354 dev->flags = IFF_NOARP;
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index 07ec326c71f5..f65c7a83bc5c 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -696,7 +696,7 @@ irnet_daddr_to_dname(irnet_socket * self)
696 { 696 {
697 /* Yes !!! Get it.. */ 697 /* Yes !!! Get it.. */
698 strlcpy(self->rname, discoveries[i].info, sizeof(self->rname)); 698 strlcpy(self->rname, discoveries[i].info, sizeof(self->rname));
699 self->rname[NICKNAME_MAX_LEN + 1] = '\0'; 699 self->rname[sizeof(self->rname) - 1] = '\0';
700 DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n", 700 DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n",
701 self->daddr, self->rname); 701 self->daddr, self->rname);
702 kfree(discoveries); 702 kfree(discoveries);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 2101b45d2ec6..6b9772d95872 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -702,7 +702,8 @@ struct sock *netlink_getsockbyfilp(struct file *filp)
702 * 0: continue 702 * 0: continue
703 * 1: repeat lookup - reference dropped while waiting for socket memory. 703 * 1: repeat lookup - reference dropped while waiting for socket memory.
704 */ 704 */
705int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo) 705int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
706 long timeo, struct sock *ssk)
706{ 707{
707 struct netlink_sock *nlk; 708 struct netlink_sock *nlk;
708 709
@@ -712,7 +713,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long t
712 test_bit(0, &nlk->state)) { 713 test_bit(0, &nlk->state)) {
713 DECLARE_WAITQUEUE(wait, current); 714 DECLARE_WAITQUEUE(wait, current);
714 if (!timeo) { 715 if (!timeo) {
715 if (!nlk->pid) 716 if (!ssk || nlk_sk(ssk)->pid == 0)
716 netlink_overrun(sk); 717 netlink_overrun(sk);
717 sock_put(sk); 718 sock_put(sk);
718 kfree_skb(skb); 719 kfree_skb(skb);
@@ -797,7 +798,7 @@ retry:
797 kfree_skb(skb); 798 kfree_skb(skb);
798 return PTR_ERR(sk); 799 return PTR_ERR(sk);
799 } 800 }
800 err = netlink_attachskb(sk, skb, nonblock, timeo); 801 err = netlink_attachskb(sk, skb, nonblock, timeo, ssk);
801 if (err == 1) 802 if (err == 1)
802 goto retry; 803 goto retry;
803 if (err) 804 if (err)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 077bbf9fb9b7..dbf4620768d6 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -13,7 +13,6 @@
13 * 13 *
14 */ 14 */
15 15
16#include <asm/bug.h>
17#include <linux/config.h> 16#include <linux/config.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/kmod.h> 18#include <linux/kmod.h>
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index d64aae85c378..5760e057ecba 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -123,17 +123,7 @@ KBUILD_HAVE_NLS := $(shell \
123 then echo yes ; \ 123 then echo yes ; \
124 else echo no ; fi) 124 else echo no ; fi)
125ifeq ($(KBUILD_HAVE_NLS),no) 125ifeq ($(KBUILD_HAVE_NLS),no)
126 HOSTCFLAGS += -DKBUILD_NO_NLS 126HOSTCFLAGS += -DKBUILD_NO_NLS
127else
128 KBUILD_NEED_LINTL := $(shell \
129 if echo -e "\#include <libintl.h>\nint main(int a, char** b) { gettext(\"\"); return 0; }\n" | \
130 $(HOSTCC) $(HOSTCFLAGS) -x c - -o /dev/null> /dev/null 2>&1 ; \
131 then echo no ; \
132 else echo yes ; fi)
133 ifeq ($(KBUILD_NEED_LINTL),yes)
134 HOSTLOADLIBES_conf += -lintl
135 HOSTLOADLIBES_mconf += -lintl
136 endif
137endif 127endif
138 128
139# generated files seem to need this to find local include files 129# generated files seem to need this to find local include files
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile
index fae3e29fc924..bbf4887cff74 100644
--- a/scripts/kconfig/lxdialog/Makefile
+++ b/scripts/kconfig/lxdialog/Makefile
@@ -2,8 +2,11 @@
2# 2#
3 3
4check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh 4check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
5HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 5
6HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 6# Use reursively expanded variables so we do not call gcc unless
7# we really need to do so. (Do not call gcc as part of make mrproper)
8HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
9HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
7 10
8HOST_EXTRACFLAGS += -DLOCALE 11HOST_EXTRACFLAGS += -DLOCALE
9 12
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 448e353923f3..120d624e672c 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,17 +4,17 @@
4# What library to link 4# What library to link
5ldflags() 5ldflags()
6{ 6{
7 echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null 7 $cc -print-file-name=libncursesw.so | grep -q /
8 if [ $? -eq 0 ]; then 8 if [ $? -eq 0 ]; then
9 echo '-lncursesw' 9 echo '-lncursesw'
10 exit 10 exit
11 fi 11 fi
12 echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null 12 $cc -print-file-name=libncurses.so | grep -q /
13 if [ $? -eq 0 ]; then 13 if [ $? -eq 0 ]; then
14 echo '-lncurses' 14 echo '-lncurses'
15 exit 15 exit
16 fi 16 fi
17 echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null 17 $cc -print-file-name=libcurses.so | grep -q /
18 if [ $? -eq 0 ]; then 18 if [ $? -eq 0 ]; then
19 echo '-lcurses' 19 echo '-lcurses'
20 exit 20 exit
@@ -36,10 +36,13 @@ ccflags()
36 fi 36 fi
37} 37}
38 38
39compiler="" 39# Temp file, try to clean up after us
40tmp=.lxdialog.tmp
41trap "rm -f $tmp" 0 1 2 3 15
42
40# Check if we can link to ncurses 43# Check if we can link to ncurses
41check() { 44check() {
42 echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null 45 echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
43 if [ $? != 0 ]; then 46 if [ $? != 0 ]; then
44 echo " *** Unable to find the ncurses libraries." 1>&2 47 echo " *** Unable to find the ncurses libraries." 1>&2
45 echo " *** make menuconfig require the ncurses libraries" 1>&2 48 echo " *** make menuconfig require the ncurses libraries" 1>&2
@@ -59,6 +62,7 @@ if [ $# == 0 ]; then
59 exit 1 62 exit 1
60fi 63fi
61 64
65cc=""
62case "$1" in 66case "$1" in
63 "-check") 67 "-check")
64 shift 68 shift
diff --git a/security/selinux/Kconfig b/security/selinux/Kconfig
index 502f78f13f5f..f636f53ca544 100644
--- a/security/selinux/Kconfig
+++ b/security/selinux/Kconfig
@@ -1,6 +1,6 @@
1config SECURITY_SELINUX 1config SECURITY_SELINUX
2 bool "NSA SELinux Support" 2 bool "NSA SELinux Support"
3 depends on SECURITY_NETWORK && NET && INET 3 depends on SECURITY_NETWORK && AUDIT && NET && INET
4 default n 4 default n
5 help 5 help
6 This selects NSA Security-Enhanced Linux (SELinux). 6 This selects NSA Security-Enhanced Linux (SELinux).
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 53d6c7bbf564..ac5d69bb3377 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -43,13 +43,11 @@ static const struct av_perm_to_string
43#undef S_ 43#undef S_
44}; 44};
45 45
46#ifdef CONFIG_AUDIT
47static const char *class_to_string[] = { 46static const char *class_to_string[] = {
48#define S_(s) s, 47#define S_(s) s,
49#include "class_to_string.h" 48#include "class_to_string.h"
50#undef S_ 49#undef S_
51}; 50};
52#endif
53 51
54#define TB_(s) static const char * s [] = { 52#define TB_(s) static const char * s [] = {
55#define TE_(s) }; 53#define TE_(s) };
diff --git a/sound/oss/dmasound/tas_common.h b/sound/oss/dmasound/tas_common.h
index 3a6d48666db0..0741c28e56ce 100644
--- a/sound/oss/dmasound/tas_common.h
+++ b/sound/oss/dmasound/tas_common.h
@@ -178,10 +178,10 @@ tas_write_register( struct tas_data_t *self,
178 if (write_mode & WRITE_SHADOW) 178 if (write_mode & WRITE_SHADOW)
179 memcpy(self->shadow[reg_num],data,reg_width); 179 memcpy(self->shadow[reg_num],data,reg_width);
180 if (write_mode & WRITE_HW) { 180 if (write_mode & WRITE_HW) {
181 rc=i2c_smbus_write_block_data(self->client, 181 rc=i2c_smbus_write_i2c_block_data(self->client,
182 reg_num, 182 reg_num,
183 reg_width, 183 reg_width,
184 data); 184 data);
185 if (rc < 0) { 185 if (rc < 0) {
186 printk("tas: I2C block write failed \n"); 186 printk("tas: I2C block write failed \n");
187 return rc; 187 return rc;
@@ -199,10 +199,10 @@ tas_sync_register( struct tas_data_t *self,
199 199
200 if (reg_width==0 || self==NULL) 200 if (reg_width==0 || self==NULL)
201 return -EINVAL; 201 return -EINVAL;
202 rc=i2c_smbus_write_block_data(self->client, 202 rc=i2c_smbus_write_i2c_block_data(self->client,
203 reg_num, 203 reg_num,
204 reg_width, 204 reg_width,
205 self->shadow[reg_num]); 205 self->shadow[reg_num]);
206 if (rc < 0) { 206 if (rc < 0) {
207 printk("tas: I2C block write failed \n"); 207 printk("tas: I2C block write failed \n");
208 return rc; 208 return rc;
diff --git a/sound/oss/emu10k1/recmgr.c b/sound/oss/emu10k1/recmgr.c
index 67c3fd04cfdd..2ce56180e7d4 100644
--- a/sound/oss/emu10k1/recmgr.c
+++ b/sound/oss/emu10k1/recmgr.c
@@ -29,7 +29,7 @@
29 ********************************************************************** 29 **********************************************************************
30 */ 30 */
31 31
32#include <asm/delay.h> 32#include <linux/delay.h>
33#include "8010.h" 33#include "8010.h"
34#include "recmgr.h" 34#include "recmgr.h"
35 35
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 4988f873a7ba..aa57170101fd 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -66,7 +66,7 @@ static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, i
66 66
67static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) 67static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec)
68{ 68{
69 if (rec) { 69 if (rec->space) {
70 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); 70 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1);
71 71
72 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); 72 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base);
@@ -881,6 +881,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
881 chip->can_capture = 1; 881 chip->can_capture = 1;
882 chip->num_freqs = ARRAY_SIZE(awacs_freqs); 882 chip->num_freqs = ARRAY_SIZE(awacs_freqs);
883 chip->freq_table = awacs_freqs; 883 chip->freq_table = awacs_freqs;
884 chip->pdev = NULL;
884 885
885 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ 886 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */
886 887
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 15c63cb2ccba..838fc113c441 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -239,8 +239,8 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix)
239 block[4] = (right_vol >> 8) & 0xff; 239 block[4] = (right_vol >> 8) & 0xff;
240 block[5] = (right_vol >> 0) & 0xff; 240 block[5] = (right_vol >> 0) & 0xff;
241 241
242 if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL, 242 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6,
243 6, block) < 0) { 243 block) < 0) {
244 snd_printk("failed to set volume \n"); 244 snd_printk("failed to set volume \n");
245 return -EINVAL; 245 return -EINVAL;
246 } 246 }
@@ -345,8 +345,8 @@ static int tumbler_set_drc(struct pmac_tumbler *mix)
345 val[1] = 0; 345 val[1] = 0;
346 } 346 }
347 347
348 if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, 348 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
349 2, val) < 0) { 349 2, val) < 0) {
350 snd_printk("failed to set DRC\n"); 350 snd_printk("failed to set DRC\n");
351 return -EINVAL; 351 return -EINVAL;
352 } 352 }
@@ -381,8 +381,8 @@ static int snapper_set_drc(struct pmac_tumbler *mix)
381 val[4] = 0x60; 381 val[4] = 0x60;
382 val[5] = 0xa0; 382 val[5] = 0xa0;
383 383
384 if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, 384 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
385 6, val) < 0) { 385 6, val) < 0) {
386 snd_printk("failed to set DRC\n"); 386 snd_printk("failed to set DRC\n");
387 return -EINVAL; 387 return -EINVAL;
388 } 388 }
@@ -492,8 +492,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
492 vol = info->table[vol]; 492 vol = info->table[vol];
493 for (i = 0; i < info->bytes; i++) 493 for (i = 0; i < info->bytes; i++)
494 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; 494 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
495 if (i2c_smbus_write_block_data(mix->i2c.client, info->reg, 495 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg,
496 info->bytes, block) < 0) { 496 info->bytes, block) < 0) {
497 snd_printk("failed to set mono volume %d\n", info->index); 497 snd_printk("failed to set mono volume %d\n", info->index);
498 return -EINVAL; 498 return -EINVAL;
499 } 499 }
@@ -625,7 +625,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r
625 for (j = 0; j < 3; j++) 625 for (j = 0; j < 3; j++)
626 block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; 626 block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff;
627 } 627 }
628 if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) { 628 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg,
629 9, block) < 0) {
629 snd_printk("failed to set mono volume %d\n", reg); 630 snd_printk("failed to set mono volume %d\n", reg);
630 return -EINVAL; 631 return -EINVAL;
631 } 632 }